You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@vxquery.apache.org by pr...@apache.org on 2012/08/01 23:55:42 UTC

svn commit: r1368288 - /incubator/vxquery/trunk/vxquery/vxquery-core/src/main/java/org/apache/vxquery/runtime/functions/cast/

Author: prestonc
Date: Wed Aug  1 21:55:41 2012
New Revision: 1368288

URL: http://svn.apache.org/viewvc?rev=1368288&view=rev
Log:
Fixed an issue with the timezone being negative when there was actually no timezone set.

Modified:
    incubator/vxquery/trunk/vxquery/vxquery-core/src/main/java/org/apache/vxquery/runtime/functions/cast/CastToGDayOperation.java
    incubator/vxquery/trunk/vxquery/vxquery-core/src/main/java/org/apache/vxquery/runtime/functions/cast/CastToGMonthDayOperation.java
    incubator/vxquery/trunk/vxquery/vxquery-core/src/main/java/org/apache/vxquery/runtime/functions/cast/CastToGMonthOperation.java
    incubator/vxquery/trunk/vxquery/vxquery-core/src/main/java/org/apache/vxquery/runtime/functions/cast/CastToGYearMonthOperation.java
    incubator/vxquery/trunk/vxquery/vxquery-core/src/main/java/org/apache/vxquery/runtime/functions/cast/CastToGYearOperation.java

Modified: incubator/vxquery/trunk/vxquery/vxquery-core/src/main/java/org/apache/vxquery/runtime/functions/cast/CastToGDayOperation.java
URL: http://svn.apache.org/viewvc/incubator/vxquery/trunk/vxquery/vxquery-core/src/main/java/org/apache/vxquery/runtime/functions/cast/CastToGDayOperation.java?rev=1368288&r1=1368287&r2=1368288&view=diff
==============================================================================
--- incubator/vxquery/trunk/vxquery/vxquery-core/src/main/java/org/apache/vxquery/runtime/functions/cast/CastToGDayOperation.java (original)
+++ incubator/vxquery/trunk/vxquery/vxquery-core/src/main/java/org/apache/vxquery/runtime/functions/cast/CastToGDayOperation.java Wed Aug  1 21:55:41 2012
@@ -71,6 +71,13 @@ public class CastToGDayOperation extends
                 throw new SystemException(ErrorCode.FORG0001);
             }
         }
+        // Final touches on timezone.
+        if (!positiveTimezone && date[4] != DateTime.TIMEZONE_HOUR_NULL) {
+            date[4] *= -1;
+        }
+        if (!positiveTimezone && date[5] != DateTime.TIMEZONE_MINUTE_NULL) {
+            date[5] *= -1;
+        }
         if (!DateTime.valid(1972, 12, date[3], 0, 0, 0, date[4], date[5])) {
             throw new SystemException(ErrorCode.FODT0001);
         }
@@ -79,8 +86,8 @@ public class CastToGDayOperation extends
         dOut.writeShort((short) 1972);
         dOut.write((byte) 12);
         dOut.write((byte) date[3]);
-        dOut.write((byte) ((positiveTimezone ? 1 : -1) * date[4]));
-        dOut.write((byte) ((positiveTimezone ? 1 : -1) * date[5]));
+        dOut.write((byte) date[4]);
+        dOut.write((byte) date[5]);
     }
 
     @Override

Modified: incubator/vxquery/trunk/vxquery/vxquery-core/src/main/java/org/apache/vxquery/runtime/functions/cast/CastToGMonthDayOperation.java
URL: http://svn.apache.org/viewvc/incubator/vxquery/trunk/vxquery/vxquery-core/src/main/java/org/apache/vxquery/runtime/functions/cast/CastToGMonthDayOperation.java?rev=1368288&r1=1368287&r2=1368288&view=diff
==============================================================================
--- incubator/vxquery/trunk/vxquery/vxquery-core/src/main/java/org/apache/vxquery/runtime/functions/cast/CastToGMonthDayOperation.java (original)
+++ incubator/vxquery/trunk/vxquery/vxquery-core/src/main/java/org/apache/vxquery/runtime/functions/cast/CastToGMonthDayOperation.java Wed Aug  1 21:55:41 2012
@@ -71,6 +71,13 @@ public class CastToGMonthDayOperation ex
                 throw new SystemException(ErrorCode.FORG0001);
             }
         }
+        // Final touches on timezone.
+        if (!positiveTimezone && date[4] != DateTime.TIMEZONE_HOUR_NULL) {
+            date[4] *= -1;
+        }
+        if (!positiveTimezone && date[5] != DateTime.TIMEZONE_MINUTE_NULL) {
+            date[5] *= -1;
+        }
         if (!DateTime.valid(1972, date[2], date[3], 0, 0, 0, date[4], date[5])) {
             throw new SystemException(ErrorCode.FODT0001);
         }
@@ -79,8 +86,8 @@ public class CastToGMonthDayOperation ex
         dOut.writeShort((short) 1972);
         dOut.write((byte) date[2]);
         dOut.write((byte) date[3]);
-        dOut.write((byte) ((positiveTimezone ? 1 : -1) * date[4]));
-        dOut.write((byte) ((positiveTimezone ? 1 : -1) * date[5]));
+        dOut.write((byte) date[4]);
+        dOut.write((byte) date[5]);
     }
 
     @Override

Modified: incubator/vxquery/trunk/vxquery/vxquery-core/src/main/java/org/apache/vxquery/runtime/functions/cast/CastToGMonthOperation.java
URL: http://svn.apache.org/viewvc/incubator/vxquery/trunk/vxquery/vxquery-core/src/main/java/org/apache/vxquery/runtime/functions/cast/CastToGMonthOperation.java?rev=1368288&r1=1368287&r2=1368288&view=diff
==============================================================================
--- incubator/vxquery/trunk/vxquery/vxquery-core/src/main/java/org/apache/vxquery/runtime/functions/cast/CastToGMonthOperation.java (original)
+++ incubator/vxquery/trunk/vxquery/vxquery-core/src/main/java/org/apache/vxquery/runtime/functions/cast/CastToGMonthOperation.java Wed Aug  1 21:55:41 2012
@@ -71,6 +71,13 @@ public class CastToGMonthOperation exten
                 throw new SystemException(ErrorCode.FORG0001);
             }
         }
+        // Final touches on timezone.
+        if (!positiveTimezone && date[1] != DateTime.TIMEZONE_HOUR_NULL) {
+            date[1] *= -1;
+        }
+        if (!positiveTimezone && date[2] != DateTime.TIMEZONE_MINUTE_NULL) {
+            date[2] *= -1;
+        }
         if (!DateTime.valid(1972, date[0], 29, 0, 0, 0, date[1], date[2])) {
             throw new SystemException(ErrorCode.FODT0001);
         }
@@ -79,8 +86,8 @@ public class CastToGMonthOperation exten
         dOut.writeShort((short) 1972);
         dOut.write((byte) date[0]);
         dOut.write((byte) 29);
-        dOut.write((byte) ((positiveTimezone ? 1 : -1) * date[1]));
-        dOut.write((byte) ((positiveTimezone ? 1 : -1) * date[2]));
+        dOut.write((byte) date[1]);
+        dOut.write((byte) date[2]);
     }
 
     @Override

Modified: incubator/vxquery/trunk/vxquery/vxquery-core/src/main/java/org/apache/vxquery/runtime/functions/cast/CastToGYearMonthOperation.java
URL: http://svn.apache.org/viewvc/incubator/vxquery/trunk/vxquery/vxquery-core/src/main/java/org/apache/vxquery/runtime/functions/cast/CastToGYearMonthOperation.java?rev=1368288&r1=1368287&r2=1368288&view=diff
==============================================================================
--- incubator/vxquery/trunk/vxquery/vxquery-core/src/main/java/org/apache/vxquery/runtime/functions/cast/CastToGYearMonthOperation.java (original)
+++ incubator/vxquery/trunk/vxquery/vxquery-core/src/main/java/org/apache/vxquery/runtime/functions/cast/CastToGYearMonthOperation.java Wed Aug  1 21:55:41 2012
@@ -79,6 +79,13 @@ public class CastToGYearMonthOperation e
                 throw new SystemException(ErrorCode.FORG0001);
             }
         }
+        // Final touches on timezone.
+        if (!positiveTimezone && date[2] != DateTime.TIMEZONE_HOUR_NULL) {
+            date[2] *= -1;
+        }
+        if (!positiveTimezone && date[3] != DateTime.TIMEZONE_MINUTE_NULL) {
+            date[3] *= -1;
+        }
         long day;
         if (DateTime.isLeapYear(date[0])) {
             day = DateTime.DAYS_OF_MONTH_ORDI[(int) (date[1] - 1)];
@@ -93,8 +100,8 @@ public class CastToGYearMonthOperation e
         dOut.writeShort((short) date[0]);
         dOut.write((byte) date[1]);
         dOut.write((byte) day);
-        dOut.write((byte) ((positiveTimezone ? 1 : -1) * date[2]));
-        dOut.write((byte) ((positiveTimezone ? 1 : -1) * date[3]));
+        dOut.write((byte) date[2]);
+        dOut.write((byte) date[3]);
     }
 
     @Override

Modified: incubator/vxquery/trunk/vxquery/vxquery-core/src/main/java/org/apache/vxquery/runtime/functions/cast/CastToGYearOperation.java
URL: http://svn.apache.org/viewvc/incubator/vxquery/trunk/vxquery/vxquery-core/src/main/java/org/apache/vxquery/runtime/functions/cast/CastToGYearOperation.java?rev=1368288&r1=1368287&r2=1368288&view=diff
==============================================================================
--- incubator/vxquery/trunk/vxquery/vxquery-core/src/main/java/org/apache/vxquery/runtime/functions/cast/CastToGYearOperation.java (original)
+++ incubator/vxquery/trunk/vxquery/vxquery-core/src/main/java/org/apache/vxquery/runtime/functions/cast/CastToGYearOperation.java Wed Aug  1 21:55:41 2012
@@ -71,6 +71,13 @@ public class CastToGYearOperation extend
                 throw new SystemException(ErrorCode.FORG0001);
             }
         }
+        // Final touches on timezone.
+        if (!positiveTimezone && date[1] != DateTime.TIMEZONE_HOUR_NULL) {
+            date[1] *= -1;
+        }
+        if (!positiveTimezone && date[2] != DateTime.TIMEZONE_MINUTE_NULL) {
+            date[2] *= -1;
+        }
         if (!DateTime.valid(date[0], 1, 1, 0, 0, 0, date[1], date[2])) {
             throw new SystemException(ErrorCode.FODT0001);
         }
@@ -79,8 +86,8 @@ public class CastToGYearOperation extend
         dOut.writeShort((short) date[0]);
         dOut.write((byte) 1);
         dOut.write((byte) 1);
-        dOut.write((byte) ((positiveTimezone ? 1 : -1) * date[1]));
-        dOut.write((byte) ((positiveTimezone ? 1 : -1) * date[2]));
+        dOut.write((byte) date[1]);
+        dOut.write((byte) date[2]);
     }
 
     @Override