r9559 - helma/helma/trunk/src/helma/objectmodel/db

[email protected]
Newsgroups gmane.comp.java.helma.cvs
Message-ID <20090331125333.3A47F3D0D6@mia>
Author: hannes
Date: 2009-03-31 14:53:33 +0200 (Tue, 31 Mar 2009)
New Revision: 9559

Modified:
   helma/helma/trunk/src/helma/objectmodel/db/Relation.java
Log:
Make getIntegerProperty() more robust by catching and logging NumberFormatExceptions.

Details at http://dev.helma.org/trac/helma/changeset/9559

Modified: helma/helma/trunk/src/helma/objectmodel/db/Relation.java
===================================================================
--- helma/helma/trunk/src/helma/objectmodel/db/Relation.java	2009-03-31 12:52:24 UTC (rev 9558)
+++ helma/helma/trunk/src/helma/objectmodel/db/Relation.java	2009-03-31 12:53:33 UTC (rev 9559)
@@ -444,11 +444,15 @@
 
     private int getIntegerProperty(String name, Properties props, int defaultValue) {
         Object value = props.get(name);
-
         if (value instanceof Number) {
             return ((Number) value).intValue();
         } else if (value instanceof String) {
-            return Integer.parseInt((String) value);
+            try {
+                return Integer.parseInt((String) value);
+            } catch (NumberFormatException nfx) {
+                ownType.getApplication().logError("Can't parse integer for property "
+                        + name + " from value " + value, nfx);
+            }
         }
         return defaultValue;
     }
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.