You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@jena.apache.org by an...@apache.org on 2012/10/11 15:21:28 UTC

svn commit: r1397034 - /jena/trunk/jena-arq/src/test/java/com/hp/hpl/jena/sparql/expr/TestNodeValueOps.java

Author: andy
Date: Thu Oct 11 13:21:27 2012
New Revision: 1397034

URL: http://svn.apache.org/viewvc?rev=1397034&view=rev
Log:
Workaround for IBM JDK issue with subtracting durations causing an NPE.

Modified:
    jena/trunk/jena-arq/src/test/java/com/hp/hpl/jena/sparql/expr/TestNodeValueOps.java

Modified: jena/trunk/jena-arq/src/test/java/com/hp/hpl/jena/sparql/expr/TestNodeValueOps.java
URL: http://svn.apache.org/viewvc/jena/trunk/jena-arq/src/test/java/com/hp/hpl/jena/sparql/expr/TestNodeValueOps.java?rev=1397034&r1=1397033&r2=1397034&view=diff
==============================================================================
--- jena/trunk/jena-arq/src/test/java/com/hp/hpl/jena/sparql/expr/TestNodeValueOps.java (original)
+++ jena/trunk/jena-arq/src/test/java/com/hp/hpl/jena/sparql/expr/TestNodeValueOps.java Thu Oct 11 13:21:27 2012
@@ -42,6 +42,7 @@ public class TestNodeValueOps extends Ba
     @Test public void nv_add_21() { testAdd("'PT1H'^^xsd:dayTimeDuration", "'PT1H'^^xsd:dayTimeDuration", "'PT2H'^^xsd:dayTimeDuration" ) ; }
     
     // Outside the XSD spec.
+    //@Test public void nv_add_22() { testAdd("'P1Y'^^xsd:yearMonthDuration", "'PT4H'^^xsd:dayTimeDuration", "'P1YT4H'^^xsd:duration" ) ; }
     @Test public void nv_add_22() {
         try { 
             testAdd("'P1Y'^^xsd:yearMonthDuration", "'PT4H'^^xsd:dayTimeDuration", "'P1YT4H'^^xsd:duration" ) ;
@@ -49,7 +50,7 @@ public class TestNodeValueOps extends Ba
             if ( isProbablyIBMJVM() )
                 // IBM JDK causes NPE on this one.
                 // IllegalStateException is acceptable; NullPointerException is not. 
-                Log.warn(this, "IBM JVM does not support xsd:yearMonthDuration + xsd:dayTimeDuration") ;
+                Log.warn(this, "TestNodeValueOps.nv_add_22 - IBM JVM - reported issue in the support for xsd:xsd:yearMonthDuration/xsd:dayTimeDuration") ;
             else
                 throw ex ;
         }
@@ -93,7 +94,21 @@ public class TestNodeValueOps extends Ba
     //Durations (need to test the wiring, not whether the calculation is right)
     @Test public void nv_sub_20() { testSub("'PT2H'^^xsd:duration", "'PT1H'^^xsd:duration", "'PT1H'^^xsd:duration" ) ; }
     @Test public void nv_sub_21() { testSub("'PT2H'^^xsd:dayTimeDuration", "'PT1H'^^xsd:dayTimeDuration", "'PT1H'^^xsd:dayTimeDuration" ) ; }
-    @Test public void nv_sub_22() { testSub("'P2Y'^^xsd:yearMonthDuration", "'P1Y'^^xsd:yearMonthDuration", "'P1Y'^^xsd:yearMonthDuration" ) ; }
+    
+    //@Test public void nv_sub_22() { testSub("'P2Y'^^xsd:yearMonthDuration", "'P1Y'^^xsd:yearMonthDuration", "'P1Y'^^xsd:yearMonthDuration" ) ; }
+    @Test public void nv_sub_22() {
+        try { 
+            testSub("'P2Y'^^xsd:yearMonthDuration", "'P1Y'^^xsd:yearMonthDuration", "'P1Y'^^xsd:yearMonthDuration" ) ;
+        } catch (NullPointerException ex) {
+            if ( isProbablyIBMJVM() )
+                // IBM JDK causes NPE on this one.
+                Log.warn(this, "TestNodeValueOps.nv_sub_22 - IBM JVM - reported issue in the support for xsd:xsd:yearMonthDuration/xsd:dayTimeDuration") ;
+            else
+                throw ex ;
+        }
+        catch (IllegalStateException ex) {}
+    }
+    
     @Test public void nv_sub_23() { testSub("'P3D'^^xsd:dayTimeDuration", "'PT4H'^^xsd:dayTimeDuration", "'P2DT20H'^^xsd:dayTimeDuration" ) ; }
     
     // Date/time - duration