svn commit: r921455 - /ofbiz/trunk/framework/base/src/org/ofbiz/base/conversion/MiscConverters.java

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
1 message Options
Reply | Threaded
Open this post in threaded view
|

svn commit: r921455 - /ofbiz/trunk/framework/base/src/org/ofbiz/base/conversion/MiscConverters.java

adrianc
Author: adrianc
Date: Wed Mar 10 17:11:18 2010
New Revision: 921455

URL: http://svn.apache.org/viewvc?rev=921455&view=rev
Log:
Revert rev 902341 - which seemed to cause problems with the Derby database.

Modified:
    ofbiz/trunk/framework/base/src/org/ofbiz/base/conversion/MiscConverters.java

Modified: ofbiz/trunk/framework/base/src/org/ofbiz/base/conversion/MiscConverters.java
URL: http://svn.apache.org/viewvc/ofbiz/trunk/framework/base/src/org/ofbiz/base/conversion/MiscConverters.java?rev=921455&r1=921454&r2=921455&view=diff
==============================================================================
--- ofbiz/trunk/framework/base/src/org/ofbiz/base/conversion/MiscConverters.java (original)
+++ ofbiz/trunk/framework/base/src/org/ofbiz/base/conversion/MiscConverters.java Wed Mar 10 17:11:18 2010
@@ -114,13 +114,15 @@ public class MiscConverters implements C
         }
 
         public String convert(Clob obj) throws ConversionException {
-            char[] charBuffer = null;
+            StringBuilder strBuf = new StringBuilder();
+            char[] inCharBuffer = new char[CHAR_BUFFER_SIZE];
+            int charsRead = 0;
             Reader clobReader = null;
             try {
-                int clobLength = (int) obj.length();
-                charBuffer = new char[clobLength];
-                clobReader = obj.getCharacterStream();
-                clobReader.read(charBuffer, 0, clobLength);
+                clobReader =  obj.getCharacterStream();
+                while ((charsRead = clobReader.read(inCharBuffer, 0, CHAR_BUFFER_SIZE)) > 0) {
+                    strBuf.append(inCharBuffer, 0, charsRead);
+                }
             } catch (Exception e) {
                 throw new ConversionException(e);
             }
@@ -131,7 +133,7 @@ public class MiscConverters implements C
                     } catch (IOException e) {}
                 }
             }
-            return new String(charBuffer);
+            return strBuf.toString();
         }
     }