Author: tfischer
Date: Wed Nov 2 19:00:04 2011
New Revision: 1196762
URL: http://svn.apache.org/viewvc?rev=1196762&view=rev
Log:
Also allow 0 or 1 as boolean values
Modified:
db/torque/torque4/trunk/torque-generator/src/main/java/org/apache/torque/generator/configuration/SaxHelper.java
Modified:
db/torque/torque4/trunk/torque-generator/src/main/java/org/apache/torque/generator/configuration/SaxHelper.java
URL:
http://svn.apache.org/viewvc/db/torque/torque4/trunk/torque-generator/src/main/java/org/apache/torque/generator/configuration/SaxHelper.java?rev=1196762&r1=1196761&r2=1196762&view=diff
==============================================================================
---
db/torque/torque4/trunk/torque-generator/src/main/java/org/apache/torque/generator/configuration/SaxHelper.java
(original)
+++
db/torque/torque4/trunk/torque-generator/src/main/java/org/apache/torque/generator/configuration/SaxHelper.java
Wed Nov 2 19:00:04 2011
@@ -19,7 +19,6 @@ package org.apache.torque.generator.conf
* under the License.
*/
-import org.apache.commons.lang.StringUtils;
import org.xml.sax.Attributes;
import org.xml.sax.SAXException;
@@ -48,7 +47,7 @@ public final class SaxHelper
* @return the value of the attribute, or null if the attribute is not set.
*
* @throws SAXException if the attribute contains content
- * other than "true" or "false"
+ * other than "true", "1" , "false" or "0".
*/
public static Boolean getBooleanAttribute(
String attributeName,
@@ -56,16 +55,18 @@ public final class SaxHelper
String elementDescription)
throws SAXException
{
- String acceptNotSet = attributes.getValue(attributeName);
- if (acceptNotSet == null)
+ String attributeAsString = attributes.getValue(attributeName);
+ if (attributeAsString == null)
{
return null;
}
- if ("false".equals(acceptNotSet))
+ if ("false".equals(attributeAsString)
+ || "0".equals(attributeAsString))
{
return false;
}
- else if ("true".equals(acceptNotSet))
+ else if ("true".equals(attributeAsString)
+ || "1".equals(attributeAsString))
{
return true;
}
@@ -75,7 +76,7 @@ public final class SaxHelper
+ attributeName
+ "of "
+ elementDescription
- + " must either be false or true");
+ + " must either be false, 0, true or 1");
}
}
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]