Details
-
Bug
-
Status: Resolved
-
Major
-
Resolution: Fixed
-
None
-
None
Description
When the xml file uses the text "null" to describe a null column, the setSize does not handle this case, I wrapped it in number format exception, and null it out. Added log to column.java
Below is the patch to fix this issue:
Index: src/java/org/apache/ddlutils/model/Column.java
===================================================================
— src/java/org/apache/ddlutils/model/Column.java (revision 608559)
+++ src/java/org/apache/ddlutils/model/Column.java (working copy)
@@ -29,6 +29,9 @@
import org.apache.commons.beanutils.ConvertUtils;
import org.apache.commons.lang.builder.EqualsBuilder;
import org.apache.commons.lang.builder.HashCodeBuilder;
+import org.apache.commons.logging.Log;
+import org.apache.commons.logging.LogFactory;
+
import org.apache.ddlutils.util.Jdbc3Utils;
/**
@@ -41,6 +44,8 @@
/** Unique ID for serialization purposes. */
private static final long serialVersionUID = -6226348998874210093L;
+ private static final Log _log = LogFactory.getLog(Column.class);
+
/** The name of the column. */
private String _name;
/** The java name of the column (optional and unused by DdlUtils, for Torque compatibility). */
@@ -322,16 +327,24 @@
int pos = size.indexOf(",");
_size = size;
- if (pos < 0)
+ try
Unknown macro: {+ if (pos < 0)+ { + _scale = 0; + _sizeAsInt = new Integer(_size); + }+ else+ { + _sizeAsInt = new Integer(size.substring(0, pos)); + _scale = Integer.parseInt(size.substring(pos + 1)); + }+ }catch (NumberFormatException ex)
{ + _log.warn(String.format("Unable to convert %s to a number or number,scale. Setting to null", _size), ex); + _size = null; + _sizeAsInt = null; _scale = 0; - _sizeAsInt = new Integer(_size); } - else
- {
- _sizeAsInt = new Integer(size.substring(0, pos));
- _scale = Integer.parseInt(size.substring(pos + 1));
- }
}
else
{