View | Details | Raw Unified | Return to bug 60066
Collapse All | Expand All

(-)src/protocol/jdbc/org/apache/jmeter/protocol/jdbc/AbstractJDBCTestElement.java (+23 lines)
Lines 19-27 Link Here
19
package org.apache.jmeter.protocol.jdbc;
19
package org.apache.jmeter.protocol.jdbc;
20
20
21
import java.io.IOException;
21
import java.io.IOException;
22
import java.io.Reader;
22
import java.io.UnsupportedEncodingException;
23
import java.io.UnsupportedEncodingException;
23
import java.lang.reflect.Field;
24
import java.lang.reflect.Field;
24
import java.math.BigDecimal;
25
import java.math.BigDecimal;
26
import java.nio.CharBuffer;
25
import java.nio.charset.StandardCharsets;
27
import java.nio.charset.StandardCharsets;
26
import java.sql.CallableStatement;
28
import java.sql.CallableStatement;
27
import java.sql.Connection;
29
import java.sql.Connection;
Lines 305-310 Link Here
305
                                jmvars.put(name, o.toString());
307
                                jmvars.put(name, o.toString());
306
                            }
308
                            }
307
                        }
309
                        }
310
                        else if ( o instanceof java.sql.Clob ) {
311
                        	java.sql.Clob clob = (java.sql.Clob)o;
312
                        	long rawClobLength = clob.length();
313
                        	int contentBufferLength = rawClobLength > Integer.MAX_VALUE ? Integer.MAX_VALUE : (int)rawClobLength;
314
                        	
315
                        	CharBuffer buffer = CharBuffer.allocate(contentBufferLength);
316
                        	try {
317
	                        	Reader clobReader = clob.getCharacterStream();
318
	                        	int currentRead;
319
	                        	int totalRead = 0;
320
	                        	do {
321
	                        	   currentRead = clobReader.read(buffer);
322
	                        	   totalRead += currentRead;
323
	                        	} while ( currentRead != -1 );
324
	
325
	                        	buffer.flip();
326
                        	} catch ( IOException ioex ) {
327
                        		sb.append( "Error processing clob: " + ioex.toString() );
328
                        	}
329
                        	jmvars.put(name, buffer.toString());
330
                        }
308
                        else {
331
                        else {
309
                            jmvars.put(name, o == null ? null : o.toString());
332
                            jmvars.put(name, o == null ? null : o.toString());
310
                        }
333
                        }

Return to bug 60066