http://nagoya.apache.org/bugzilla/show_bug.cgi?id=2204

*** shadow/2204 Sat Jun 16 11:06:11 2001
--- shadow/2204.tmp.24936       Sat Jun 16 11:06:11 2001
***************
*** 0 ****
--- 1,63 ----
+ +============================================================================+
+ | Column.readFromXML()initializes "isNotNull" wrong                          |
+ +----------------------------------------------------------------------------+
+ |        Bug #: 2204                        Product: Turbine                 |
+ |       Status: NEW                         Version: 2.1b3                   |
+ |   Resolution:                            Platform: All                     |
+ |     Severity: Normal                   OS/Version: All                     |
+ |     Priority: Other                     Component: Torque                  |
+ +----------------------------------------------------------------------------+
+ |  Assigned To: [EMAIL PROTECTED]                               |
+ |  Reported By: [EMAIL PROTECTED]                                           |
+ |      CC list: Cc:                                                          |
+ +----------------------------------------------------------------------------+
+ |          URL:                                                              |
+ +============================================================================+
+ |                              DESCRIPTION                                   |
+ CLASS: org.apache.turbine.torque.engine.database.model.Column
+ METHOD: readFromXML(Attributes)
+ CODE:
+         //Primary Key
+         String primaryKey = attrib.getValue("primaryKey");
+         //Avoid NullPointerExceptions on string comparisons.
+         isPrimaryKey = ("true".equals (primaryKey));
+ 
+         // If this column is a primary key then it can't be null.
+         if ("true".equals (primaryKey))
+         {
+             isNotNull = true;
+         }
+ 
+         String notNull = attrib.getValue("required");
+         isNotNull = (notNull != null && "true".equals(notNull));
+ DESCRIPTION:
+ If "primaryKey" has been set to "true" and "required" has not been set 
+ explicitly to "true" within the schema definition, the resulting Column object 
+ will allow "null" values. This is not intended?!
+ 
+ CORRECTION:
+ /* Changed order of attribute evaluation */
+ /* Added "isNotNull" assignment for ID autoIncrement columns
+         String notNull = attrib.getValue("required");
+         isNotNull = (notNull != null && "true".equals(notNull));
+ 
+         //Primary Key
+         String primaryKey = attrib.getValue("primaryKey");
+         //Avoid NullPointerExceptions on string comparisons.
+         isPrimaryKey = ("true".equals (primaryKey));
+ 
+         // If this column is a primary key then it can't be null.
+         if ("true".equals (primaryKey))
+         {
+             isNotNull = true;
+         }
+ 
+         //AutoIncrement/Sequences
+         String autoIncrement = attrib.getValue("autoIncrement");
+         isAutoIncrement = ("true".equals(autoIncrement));
+ 
+         // If this column is an autoincrement value then it can't be null.
+         if ("true".equals (isAutoIncrement))
+         {
+             isNotNull = true;
+         }
\ No newline at end of file

---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to