Author: jleroux
Date: Sun Sep 9 03:25:13 2007
New Revision: 573980
URL:
http://svn.apache.org/viewvc?rev=573980&view=revLog:
Finally put toUpperCase in ModelFieldType.StringLength() on David's advice
Modified:
ofbiz/trunk/framework/entity/src/org/ofbiz/entity/model/ModelFieldType.java
Modified: ofbiz/trunk/framework/entity/src/org/ofbiz/entity/model/ModelFieldType.java
URL:
http://svn.apache.org/viewvc/ofbiz/trunk/framework/entity/src/org/ofbiz/entity/model/ModelFieldType.java?rev=573980&r1=573979&r2=573980&view=diff==============================================================================
--- ofbiz/trunk/framework/entity/src/org/ofbiz/entity/model/ModelFieldType.java (original)
+++ ofbiz/trunk/framework/entity/src/org/ofbiz/entity/model/ModelFieldType.java Sun Sep 9 03:25:13 2007
@@ -52,7 +52,7 @@
public ModelFieldType(Element fieldTypeElement) {
this.type = UtilXml.checkEmpty(fieldTypeElement.getAttribute("type"));
this.javaType = UtilXml.checkEmpty(fieldTypeElement.getAttribute("java-type"));
- this.sqlType = UtilXml.checkEmpty(fieldTypeElement.getAttribute("sql-type")).toUpperCase();
+ this.sqlType = UtilXml.checkEmpty(fieldTypeElement.getAttribute("sql-type"));
this.sqlTypeAlias = UtilXml.checkEmpty(fieldTypeElement.getAttribute("sql-type-alias"));
NodeList validateList = fieldTypeElement.getElementsByTagName("validate");
@@ -95,23 +95,24 @@
* @return max length of a String representing the Field value
*/
public int stringLength() {
- if (sqlType.indexOf("VARCHAR") >= 0) {
- if (sqlType.indexOf("(") > 0 && sqlType.indexOf(")") > 0) {
- String length = sqlType.substring(sqlType.indexOf("(") + 1, sqlType.indexOf(")"));
+ String sqlTypeUpperCase = sqlType.toUpperCase();
+ if (sqlTypeUpperCase.indexOf("VARCHAR") >= 0) {
+ if (sqlTypeUpperCase.indexOf("(") > 0 && sqlTypeUpperCase.indexOf(")") > 0) {
+ String length = sqlTypeUpperCase.substring(sqlTypeUpperCase.indexOf("(") + 1, sqlTypeUpperCase.indexOf(")"));
return Integer.parseInt(length);
} else {
return 255;
}
- } else if (sqlType.indexOf("CHAR") >= 0) {
- if (sqlType.indexOf("(") > 0 && sqlType.indexOf(")") > 0) {
- String length = sqlType.substring(sqlType.indexOf("(") + 1, sqlType.indexOf(")"));
+ } else if (sqlTypeUpperCase.indexOf("CHAR") >= 0) {
+ if (sqlTypeUpperCase.indexOf("(") > 0 && sqlTypeUpperCase.indexOf(")") > 0) {
+ String length = sqlTypeUpperCase.substring(sqlTypeUpperCase.indexOf("(") + 1, sqlTypeUpperCase.indexOf(")"));
return Integer.parseInt(length);
} else {
return 255;
}
- } else if (sqlType.indexOf("TEXT") >= 0 || sqlType.indexOf("LONG") >= 0) {
+ } else if (sqlTypeUpperCase.indexOf("TEXT") >= 0 || sqlTypeUpperCase.indexOf("LONG") >= 0) {
return 5000;
}
return 20;