Author: isurues Date: Mon Jan 10 14:03:41 2011 New Revision: 1057198 URL: http://svn.apache.org/viewvc?rev=1057198&view=rev Log: committing an improvement proposed in https://issues.apache.org/jira/browse/AXIS2-4731
Modified: axis/axis2/java/core/trunk/modules/json/src/org/apache/axis2/json/AbstractJSONDataSource.java Modified: axis/axis2/java/core/trunk/modules/json/src/org/apache/axis2/json/AbstractJSONDataSource.java URL: http://svn.apache.org/viewvc/axis/axis2/java/core/trunk/modules/json/src/org/apache/axis2/json/AbstractJSONDataSource.java?rev=1057198&r1=1057197&r2=1057198&view=diff ============================================================================== --- axis/axis2/java/core/trunk/modules/json/src/org/apache/axis2/json/AbstractJSONDataSource.java (original) +++ axis/axis2/java/core/trunk/modules/json/src/org/apache/axis2/json/AbstractJSONDataSource.java Mon Jan 10 14:03:41 2011 @@ -31,6 +31,7 @@ import java.io.IOException; import java.io.OutputStream; import java.io.Reader; import java.io.Writer; +import java.io.BufferedReader; /** * JSONDataSource keeps the JSON String inside and consumes it when needed. This is to be kept in @@ -169,12 +170,13 @@ public abstract class AbstractJSONDataSo return jsonString; } else { try { - char temp = (char)jsonReader.read(); - // use a buffer to support long json strings better.. - StringBuilder sb = new StringBuilder(100); - while ((int)temp != 65535) { - sb.append(temp); - temp = (char)jsonReader.read(); + BufferedReader br = new BufferedReader(jsonReader); + StringBuilder sb = new StringBuilder(512); + char[] tempBuf = new char[512]; + int readLen; + + while((readLen = br.read(tempBuf)) != -1) { + sb.append(tempBuf, 0, readLen); } jsonString = sb.toString(); } catch (IOException e) {