You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@xerces.apache.org by mr...@apache.org on 2007/07/11 06:36:07 UTC

svn commit: r555165 - /xerces/java/trunk/src/org/apache/xerces/jaxp/datatype/XMLGregorianCalendarImpl.java

Author: mrglavas
Date: Tue Jul 10 21:36:02 2007
New Revision: 555165

URL: http://svn.apache.org/viewvc?view=rev&rev=555165
Log:
Shuffling code around to allow millisecond = 1000 to be specified in the factory methods as they were before.

Modified:
    xerces/java/trunk/src/org/apache/xerces/jaxp/datatype/XMLGregorianCalendarImpl.java

Modified: xerces/java/trunk/src/org/apache/xerces/jaxp/datatype/XMLGregorianCalendarImpl.java
URL: http://svn.apache.org/viewvc/xerces/java/trunk/src/org/apache/xerces/jaxp/datatype/XMLGregorianCalendarImpl.java?view=diff&rev=555165&r1=555164&r2=555165
==============================================================================
--- xerces/java/trunk/src/org/apache/xerces/jaxp/datatype/XMLGregorianCalendarImpl.java (original)
+++ xerces/java/trunk/src/org/apache/xerces/jaxp/datatype/XMLGregorianCalendarImpl.java Tue Jul 10 21:36:02 2007
@@ -318,7 +318,7 @@
         23,       //hour
         59,       //minute
         60,       //second (leap second allows for 60)
-        1000,     //millisecond
+        999,      //millisecond
         14 * 60   //timezone
     }; 
 
@@ -610,26 +610,30 @@
         int hour,
         int minute,
         int second,
-		int millisecond,
+        int millisecond,
         int timezone) {
-        	
-		setYear(year);
+
+        setYear(year);
         setMonth(month);
         setDay(day);
         setTime(hour, minute, second);
-		setTimezone(timezone);
-		setMillisecond(millisecond);
+        setTimezone(timezone);
+        BigDecimal realMilliseconds = null;
+        if (millisecond != DatatypeConstants.FIELD_UNDEFINED) {
+            realMilliseconds = BigDecimal.valueOf(millisecond, 3);
+        }
+        setFractionalSecond(realMilliseconds);
+
+        if (!isValid()) {		
 
-		if (!isValid()) {		
-            
             throw new IllegalArgumentException(
-                DatatypeMessageFormatter.formatMessage(null, 
-                "InvalidXGCValue-milli", 
-                new Object[] { new Integer(year), new Integer(month), new Integer(day), 
-                new Integer(hour), new Integer(minute), new Integer(second), 
-                new Integer(millisecond), new Integer(timezone)})                
-			);
-                /*
+                    DatatypeMessageFormatter.formatMessage(null, 
+                            "InvalidXGCValue-milli", 
+                            new Object[] { new Integer(year), new Integer(month), new Integer(day), 
+                            new Integer(hour), new Integer(minute), new Integer(second), 
+                            new Integer(millisecond), new Integer(timezone)})                
+            );
+            /*
                 throw new IllegalArgumentException(
                     "year = " + year
                     + ", month = " + month
@@ -641,9 +645,9 @@
                     + ", timezone = " + timezone
                     + ", is not a valid representation of an XML Gregorian Calendar value."
                     );
-                 */
-            
-		}
+             */
+
+        }
         save();
     }
     
@@ -2802,7 +2806,7 @@
         } 
         else {
             checkFieldValueConstraint(MILLISECOND, millisecond);
-            fractionalSecond = new BigDecimal((long) millisecond).movePointLeft(3);
+            fractionalSecond = BigDecimal.valueOf(millisecond, 3);
         } 
     }
 



---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@xerces.apache.org
For additional commands, e-mail: commits-help@xerces.apache.org