jena-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From a...@apache.org
Subject jena git commit: Fix: Spec says ENCODE_FOR_URI should work with lang tag strings.
Date Tue, 03 Nov 2015 11:24:04 GMT
Repository: jena
Updated Branches:
  refs/heads/master b0d1a9dc9 -> be12606ca


Fix: Spec says ENCODE_FOR_URI should work with lang tag strings.

Project: http://git-wip-us.apache.org/repos/asf/jena/repo
Commit: http://git-wip-us.apache.org/repos/asf/jena/commit/be12606c
Tree: http://git-wip-us.apache.org/repos/asf/jena/tree/be12606c
Diff: http://git-wip-us.apache.org/repos/asf/jena/diff/be12606c

Branch: refs/heads/master
Commit: be12606cab9b7107d877635a75dc0069f7689e30
Parents: b0d1a9d
Author: Andy Seaborne <andy@apache.org>
Authored: Mon Nov 2 22:00:31 2015 +0000
Committer: Andy Seaborne <andy@apache.org>
Committed: Tue Nov 3 11:23:16 2015 +0000

----------------------------------------------------------------------
 .../java/org/apache/jena/sparql/expr/nodevalue/XSDFuncOp.java | 7 +++----
 .../test/java/org/apache/jena/sparql/expr/TestFunctions2.java | 4 +++-
 2 files changed, 6 insertions(+), 5 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/jena/blob/be12606c/jena-arq/src/main/java/org/apache/jena/sparql/expr/nodevalue/XSDFuncOp.java
----------------------------------------------------------------------
diff --git a/jena-arq/src/main/java/org/apache/jena/sparql/expr/nodevalue/XSDFuncOp.java b/jena-arq/src/main/java/org/apache/jena/sparql/expr/nodevalue/XSDFuncOp.java
index 57a2497..6b2ea50 100644
--- a/jena-arq/src/main/java/org/apache/jena/sparql/expr/nodevalue/XSDFuncOp.java
+++ b/jena-arq/src/main/java/org/apache/jena/sparql/expr/nodevalue/XSDFuncOp.java
@@ -52,6 +52,7 @@ import org.apache.jena.datatypes.xsd.XSDDatatype ;
 import org.apache.jena.datatypes.xsd.XSDDateTime ;
 import org.apache.jena.graph.Node ;
 import org.apache.jena.graph.NodeFactory ;
+import org.apache.jena.rdf.model.impl.Util ;
 import org.apache.jena.sparql.ARQInternalErrorException ;
 import org.apache.jena.sparql.SystemARQ ;
 import org.apache.jena.sparql.expr.* ;
@@ -583,10 +584,8 @@ public class XSDFuncOp
         Node n = v.asNode() ;
         if ( !n.isLiteral() )
             throw new ExprEvalException("Not a literal") ;
-        if ( n.getLiteralDatatype() != null ) {
-            if ( !n.getLiteralDatatype().equals(XSDDatatype.XSDstring) )
-                throw new ExprEvalException("Not a string literal") ;
-        }
+        if ( ! Util.isSimpleString(n) && ! Util.isLangString(n) )  
+            throw new ExprEvalException("Not a string literal") ;
 
         String str = n.getLiteralLexicalForm() ;
         String encStr = IRILib.encodeUriComponent(str) ;

http://git-wip-us.apache.org/repos/asf/jena/blob/be12606c/jena-arq/src/test/java/org/apache/jena/sparql/expr/TestFunctions2.java
----------------------------------------------------------------------
diff --git a/jena-arq/src/test/java/org/apache/jena/sparql/expr/TestFunctions2.java b/jena-arq/src/test/java/org/apache/jena/sparql/expr/TestFunctions2.java
index 7b8c04d..10e1747 100644
--- a/jena-arq/src/test/java/org/apache/jena/sparql/expr/TestFunctions2.java
+++ b/jena-arq/src/test/java/org/apache/jena/sparql/expr/TestFunctions2.java
@@ -188,9 +188,11 @@ public class TestFunctions2 extends BaseTest
     @Test public void encodeURI_01()    { test("encode_for_uri('a:b cd/~')",  "'a%3Ab%20cd%2F~'")
; }
     @Test public void encodeURI_02()    { test("encode_for_uri('\\n')",  "'%0A'") ; }
     @Test public void encodeURI_03()    { test("encode_for_uri('\\t')",  "'%09'") ; }
+    @Test public void encodeURI_04()    { test("encode_for_uri('abc')",     "'abc'") ; }
+    @Test public void encodeURI_05()    { test("encode_for_uri('abc'@en)",  "'abc'") ; }
     
     @Test(expected=ExprEvalException.class)
-    public void encodeURI_04()          { test("encode_for_uri(1234)",  "'1234'") ; }
+    public void encodeURI_09()          { test("encode_for_uri(1234)",  "'1234'") ; }
     
     /* Compatibility rules
     # pairs of simple literals,


Mime
View raw message