svn commit: r687884 - /ofbiz/trunk/framework/base/src/org/ofbiz/base/util/UtilObject.java

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

svn commit: r687884 - /ofbiz/trunk/framework/base/src/org/ofbiz/base/util/UtilObject.java

adrianc
Author: adrianc
Date: Thu Aug 21 15:31:58 2008
New Revision: 687884

URL: http://svn.apache.org/viewvc?rev=687884&view=rev
Log:
Changed UtilObject.getByteCount(Object obj) exception handling to log verbose, since exceptions are regularly thrown and they were clogging up the console log.

Modified:
    ofbiz/trunk/framework/base/src/org/ofbiz/base/util/UtilObject.java

Modified: ofbiz/trunk/framework/base/src/org/ofbiz/base/util/UtilObject.java
URL: http://svn.apache.org/viewvc/ofbiz/trunk/framework/base/src/org/ofbiz/base/util/UtilObject.java?rev=687884&r1=687883&r2=687884&view=diff
==============================================================================
--- ofbiz/trunk/framework/base/src/org/ofbiz/base/util/UtilObject.java (original)
+++ ofbiz/trunk/framework/base/src/org/ofbiz/base/util/UtilObject.java Thu Aug 21 15:31:58 2008
@@ -92,7 +92,7 @@
     }
 
     /** Returns the size of a serializable object. Non-serializable objects
-     * will output an error message and return zero.<p>It is important to note
+     * will return zero.<p>It is important to note
      * that the returned value is length of the byte stream after the object has
      * been serialized. The returned value does not represent the amount of memory
      * the object uses. There is no accurate way to determine the size of an
@@ -109,20 +109,21 @@
             oos = new ObjectOutputStream(osbc);
             oos.writeObject(obj);
             objSize = osbc.getByteCount();
-        } catch (Exception e) {
-            Debug.logError(e, module);
-        } finally {
-            try {
-                if (oos != null) {
-                    oos.flush();
-                    oos.close();
-                }
-                if (osbc != null) {
-                    osbc.close();
-                }
-            } catch (IOException e) {
-                Debug.logError(e, module);
+        } catch (IOException e) {
+            // Non-serializable objects will cause this exception, so
+            // logging verbose to cut down on console log size
+            Debug.logVerbose(e, module);
+        }
+        try {
+            if (oos != null) {
+                oos.flush();
+                oos.close();
             }
+            if (osbc != null) {
+                osbc.close();
+            }
+        } catch (IOException e) {
+            Debug.logError(e, module);
         }
         return objSize;
     }