svn commit: r591834 - /ofbiz/trunk/framework/entity/src/org/ofbiz/entity/jdbc/SqlJdbcUtil.java

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

svn commit: r591834 - /ofbiz/trunk/framework/entity/src/org/ofbiz/entity/jdbc/SqlJdbcUtil.java

jonesde
Author: jonesde
Date: Sun Nov  4 12:50:06 2007
New Revision: 591834

URL: http://svn.apache.org/viewvc?rev=591834&view=rev
Log:
Fixed issue reported by Scott Gray in OFBIZ-1378; tested for save and load actual images, and for the broken case with an AgreementItactual image data and for the broken case of an AgreementItem that has no image associated with it, based on the patch from Scott but improves to be more efficient to do nothing on null, and only create a SerialBlob when needed, ie when setting it on an entity field

Modified:
    ofbiz/trunk/framework/entity/src/org/ofbiz/entity/jdbc/SqlJdbcUtil.java

Modified: ofbiz/trunk/framework/entity/src/org/ofbiz/entity/jdbc/SqlJdbcUtil.java
URL: http://svn.apache.org/viewvc/ofbiz/trunk/framework/entity/src/org/ofbiz/entity/jdbc/SqlJdbcUtil.java?rev=591834&r1=591833&r2=591834&view=diff
==============================================================================
--- ofbiz/trunk/framework/entity/src/org/ofbiz/entity/jdbc/SqlJdbcUtil.java (original)
+++ ofbiz/trunk/framework/entity/src/org/ofbiz/entity/jdbc/SqlJdbcUtil.java Sun Nov  4 12:50:06 2007
@@ -559,14 +559,17 @@
                     }
                     break;
                 case 12:
-                    Blob theBlob = new SerialBlob(rs.getBlob(ind));
+                    Blob theBlob = rs.getBlob(ind);
                     
-                    // for backward compatibility, check to see if there is a serialized object and if so return that
-                    Object blobObject = deserializeField(theBlob.getBytes(1, (int) theBlob.length()), ind, curField);
-                    if (blobObject != null) {
-                        entity.dangerousSetNoCheckButFast(curField, blobObject);
-                    } else {
-                        entity.dangerousSetNoCheckButFast(curField, theBlob);
+                    if (theBlob != null) {
+                    // for backward compatibility, check to see if there is a serialized object and if so return that
+                    Object blobObject = deserializeField(theBlob.getBytes(1, (int) theBlob.length()), ind, curField);
+                    if (blobObject != null) {
+                        entity.dangerousSetNoCheckButFast(curField, blobObject);
+                    } else {
+                     // NOTE using SerialBlob here instead of the Blob from the database to make sure we can pass it around, serialize it, etc
+                        entity.dangerousSetNoCheckButFast(curField, new SerialBlob(theBlob));
+                    }
                     }
                     
                     break;