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/10 15:35:21 UTC
svn commit: r1396592 -
/jena/trunk/jena-arq/src/test/java/com/hp/hpl/jena/sparql/expr/TestNodeValueOps.java
Author: andy
Date: Wed Oct 10 13:35:20 2012
New Revision: 1396592
URL: http://svn.apache.org/viewvc?rev=1396592&view=rev
Log:
Workaround for IBM JDK issue with adding mismatched 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=1396592&r1=1396591&r2=1396592&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 Wed Oct 10 13:35:20 2012
@@ -18,12 +18,11 @@
package com.hp.hpl.jena.sparql.expr;
-import com.hp.hpl.jena.sparql.expr.ExprEvalException ;
-import com.hp.hpl.jena.sparql.expr.NodeValue ;
-import com.hp.hpl.jena.sparql.expr.nodevalue.NodeValueOps ;
-
import org.junit.Test ;
import org.openjena.atlas.junit.BaseTest ;
+import org.openjena.atlas.logging.Log ;
+
+import com.hp.hpl.jena.sparql.expr.nodevalue.NodeValueOps ;
public class TestNodeValueOps extends BaseTest
{
@@ -41,8 +40,26 @@ public class TestNodeValueOps extends Ba
@Test public void nv_add_20() { testAdd("'PT1H'^^xsd:duration", "'PT1H'^^xsd:duration", "'PT2H'^^xsd:duration" ) ; }
@Test public void nv_add_21() { testAdd("'PT1H'^^xsd:dayTimeDuration", "'PT1H'^^xsd:dayTimeDuration", "'PT2H'^^xsd:dayTimeDuration" ) ; }
- @Test public void nv_add_22() { testAdd("'P1Y'^^xsd:yearMonthDuration", "'PT4H'^^xsd:dayTimeDuration", "'P1YT4H'^^xsd:duration" ) ; }
+
+ // Outside the XSD spec.
+ @Test public void nv_add_22() {
+ try {
+ testAdd("'P1Y'^^xsd:yearMonthDuration", "'PT4H'^^xsd:dayTimeDuration", "'P1YT4H'^^xsd:duration" ) ;
+ } catch (NullPointerException ex) {
+ 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") ;
+ else
+ throw ex ;
+ }
+ catch (IllegalStateException ex) {}
+ }
+ private static boolean isProbablyIBMJVM()
+ {
+ return System.getProperty("java.vm.name", "").contains("IBM");
+ }
// Date/time + duration
@Test public void nv_add_23() { testAdd("'2000-01-01'^^xsd:date", "'P1Y'^^xsd:duration", "'2001-01-01'^^xsd:date") ; }