Author: vmassol
Date: 2008-01-08 15:51:19 +0100 (Tue, 08 Jan 2008)
New Revision: 6669

Modified:
   
xwiki-platform/core/trunk/xwiki-core/src/main/java/com/xpn/xwiki/doc/rcs/XWikiRCSNodeInfo.java
   xwiki-platform/core/trunk/xwiki-core/src/main/resources/xwiki.oracle.hbm.xml
Log:
XWIKI-1995: Error inserting NULL values in NOT-NULL fields under Oracle for 
Version Comments/Authors


Modified: 
xwiki-platform/core/trunk/xwiki-core/src/main/java/com/xpn/xwiki/doc/rcs/XWikiRCSNodeInfo.java
===================================================================
--- 
xwiki-platform/core/trunk/xwiki-core/src/main/java/com/xpn/xwiki/doc/rcs/XWikiRCSNodeInfo.java
      2008-01-08 14:49:33 UTC (rev 6668)
+++ 
xwiki-platform/core/trunk/xwiki-core/src/main/java/com/xpn/xwiki/doc/rcs/XWikiRCSNodeInfo.java
      2008-01-08 14:51:19 UTC (rev 6669)
@@ -106,7 +106,10 @@
      */
     public String getAuthor()
     {
-        return author;
+        // For Oracle and other databases, an empty string is equivalent to a 
NULL and thus
+        // we had to remove the NOT-NULL condition on this field. Hence we 
need to test if it's
+        // null here and return an empty string so that all code calling this 
will not be impacted.
+        return author != null ? author : "";
     }
     /**
      * @param updateAuthor - author of modification.
@@ -120,7 +123,10 @@
      */
     public String getComment()
     {
-        return comment;
+        // For Oracle and other databases, an empty string is equivalent to a 
NULL and thus
+        // we had to remove the NOT-NULL condition on this field. Hence we 
need to test if it's
+        // null here and return an empty string so that all code calling this 
will not be impacted.
+        return comment != null ? comment : "";
     }
     /**
      * @param comment - modification's comment.

Modified: 
xwiki-platform/core/trunk/xwiki-core/src/main/resources/xwiki.oracle.hbm.xml
===================================================================
--- 
xwiki-platform/core/trunk/xwiki-core/src/main/resources/xwiki.oracle.hbm.xml    
    2008-01-08 14:49:33 UTC (rev 6668)
+++ 
xwiki-platform/core/trunk/xwiki-core/src/main/resources/xwiki.oracle.hbm.xml    
    2008-01-08 14:51:19 UTC (rev 6669)
@@ -114,9 +114,9 @@
         </composite-id>
         <property name="date"    type="timestamp" column="XWR_DATE"    
not-null="true" />
         <property name="comment" type="text">
-            <column name="XWR_COMMENT" sql-type="clob" not-null="true" />
+            <column name="XWR_COMMENT" sql-type="clob" />
         </property>
-        <property name="author"  type="string" column="XWR_AUTHOR"  
not-null="true" />
+        <property name="author"  type="string" column="XWR_AUTHOR" />
         <property name="diff"    type="boolean"   column="XWR_ISDIFF"  
not-null="false" update="false" insert="false" />
     </class>
 

_______________________________________________
notifications mailing list
[email protected]
http://lists.xwiki.org/mailman/listinfo/notifications

Reply via email to