You are viewing a plain text version of this content. The canonical link for it is here.
Posted to java-dev@axis.apache.org by is...@apache.org on 2009/09/01 14:00:42 UTC

svn commit: r809992 - /webservices/axis2/trunk/java/modules/json/src/org/apache/axis2/json/AbstractJSONDataSource.java

Author: isurues
Date: Tue Sep  1 12:00:42 2009
New Revision: 809992

URL: http://svn.apache.org/viewvc?rev=809992&view=rev
Log:
using a StringBuffer to support large JSON strings

Modified:
    webservices/axis2/trunk/java/modules/json/src/org/apache/axis2/json/AbstractJSONDataSource.java

Modified: webservices/axis2/trunk/java/modules/json/src/org/apache/axis2/json/AbstractJSONDataSource.java
URL: http://svn.apache.org/viewvc/webservices/axis2/trunk/java/modules/json/src/org/apache/axis2/json/AbstractJSONDataSource.java?rev=809992&r1=809991&r2=809992&view=diff
==============================================================================
--- webservices/axis2/trunk/java/modules/json/src/org/apache/axis2/json/AbstractJSONDataSource.java (original)
+++ webservices/axis2/trunk/java/modules/json/src/org/apache/axis2/json/AbstractJSONDataSource.java Tue Sep  1 12:00:42 2009
@@ -170,11 +170,13 @@
         } else {
             try {
                 char temp = (char)jsonReader.read();
-                jsonString = "";
+                // use a buffer to support long json strings better..
+                StringBuilder sb = new StringBuilder(100);
                 while ((int)temp != 65535) {
-                    jsonString += temp;
+                    sb.append(temp);
                     temp = (char)jsonReader.read();
                 }
+                jsonString = sb.toString();
             } catch (IOException e) {
                 throw new OMException();
             }