svn commit: r573981 - /ofbiz/branches/release4.0/framework/entity/src/org/ofbiz/entity/model/ModelFieldType.java

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

svn commit: r573981 - /ofbiz/branches/release4.0/framework/entity/src/org/ofbiz/entity/model/ModelFieldType.java

jleroux@apache.org
Author: jleroux
Date: Sun Sep  9 03:26:18 2007
New Revision: 573981

URL: http://svn.apache.org/viewvc?rev=573981&view=rev
Log:
Applied fix from trunk for revision: 573980

Modified:
    ofbiz/branches/release4.0/framework/entity/src/org/ofbiz/entity/model/ModelFieldType.java

Modified: ofbiz/branches/release4.0/framework/entity/src/org/ofbiz/entity/model/ModelFieldType.java
URL: http://svn.apache.org/viewvc/ofbiz/branches/release4.0/framework/entity/src/org/ofbiz/entity/model/ModelFieldType.java?rev=573981&r1=573980&r2=573981&view=diff
==============================================================================
--- ofbiz/branches/release4.0/framework/entity/src/org/ofbiz/entity/model/ModelFieldType.java (original)
+++ ofbiz/branches/release4.0/framework/entity/src/org/ofbiz/entity/model/ModelFieldType.java Sun Sep  9 03:26:18 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;