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/30 23:39:12 UTC

svn commit: r1379171 - /incubator/vxquery/trunk/vxquery/vxquery-core/src/main/java/org/apache/vxquery/runtime/functions/arithmetic/DivideOperation.java

Author: prestonc
Date: Thu Aug 30 21:39:11 2012
New Revision: 1379171

URL: http://svn.apache.org/viewvc?rev=1379171&view=rev
Log:
Changed the system exceptions for DTDuration.

Modified:
    incubator/vxquery/trunk/vxquery/vxquery-core/src/main/java/org/apache/vxquery/runtime/functions/arithmetic/DivideOperation.java

Modified: incubator/vxquery/trunk/vxquery/vxquery-core/src/main/java/org/apache/vxquery/runtime/functions/arithmetic/DivideOperation.java
URL: http://svn.apache.org/viewvc/incubator/vxquery/trunk/vxquery/vxquery-core/src/main/java/org/apache/vxquery/runtime/functions/arithmetic/DivideOperation.java?rev=1379171&r1=1379170&r2=1379171&view=diff
==============================================================================
--- incubator/vxquery/trunk/vxquery/vxquery-core/src/main/java/org/apache/vxquery/runtime/functions/arithmetic/DivideOperation.java (original)
+++ incubator/vxquery/trunk/vxquery/vxquery-core/src/main/java/org/apache/vxquery/runtime/functions/arithmetic/DivideOperation.java Thu Aug 30 21:39:11 2012
@@ -195,7 +195,7 @@ public class DivideOperation extends Abs
     public void operateDTDurationDecimal(LongPointable longp, XSDecimalPointable decp, DataOutput dOut)
             throws SystemException, IOException {
         if (decp.getDecimalValue() == 0) {
-            throw new SystemException(ErrorCode.FOAR0001);
+            throw new SystemException(ErrorCode.FODT0002);
         }
         long value = longp.longValue();
         value /= decp.longValue();
@@ -206,6 +206,12 @@ public class DivideOperation extends Abs
     @Override
     public void operateDTDurationDouble(LongPointable longp, DoublePointable doublep, DataOutput dOut)
             throws SystemException, IOException {
+        if (Double.isNaN(doublep.doubleValue())) {
+            throw new SystemException(ErrorCode.FOCA0005);
+        }
+        if (doublep.doubleValue() == 0.0) {
+            throw new SystemException(ErrorCode.FODT0002);
+        }
         double value = longp.doubleValue();
         value /= doublep.doubleValue();
         dOut.write(ValueTag.XS_DAY_TIME_DURATION_TAG);
@@ -228,6 +234,12 @@ public class DivideOperation extends Abs
     @Override
     public void operateDTDurationFloat(LongPointable longp, FloatPointable floatp, DataOutput dOut)
             throws SystemException, IOException {
+        if (Float.isNaN(floatp.floatValue())) {
+            throw new SystemException(ErrorCode.FOCA0005);
+        }
+        if (floatp.floatValue() == 0.0f) {
+            throw new SystemException(ErrorCode.FODT0002);
+        }
         float value = longp.floatValue();
         value /= floatp.intValue();
         dOut.write(ValueTag.XS_DAY_TIME_DURATION_TAG);
@@ -238,7 +250,7 @@ public class DivideOperation extends Abs
     public void operateDTDurationInteger(LongPointable longp1, LongPointable longp2, DataOutput dOut)
             throws SystemException, IOException {
         if (longp2.getLong() == 0) {
-            throw new SystemException(ErrorCode.FOAR0001);
+            throw new SystemException(ErrorCode.FODT0002);
         }
         long value = longp1.longValue();
         value /= longp2.longValue();