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 2023/03/17 14:13:43 UTC

[jena] branch main updated: GH1801 Prevent needless materialization of lexical forms

This is an automated email from the ASF dual-hosted git repository.

andy pushed a commit to branch main
in repository https://gitbox.apache.org/repos/asf/jena.git


The following commit(s) were added to refs/heads/main by this push:
     new f42d6522d1 GH1801 Prevent needless materialization of lexical forms
     new 33c14fb380 Merge pull request #1802 from Aklakan/fastnvfail
f42d6522d1 is described below

commit f42d6522d193690cf0b082bc9c1a64683edc076a
Author: Claus Stadler <Ra...@googlemail.com>
AuthorDate: Fri Mar 17 09:52:18 2023 +0100

    GH1801 Prevent needless materialization of lexical forms
---
 jena-arq/src/main/java/org/apache/jena/sparql/expr/NodeValue.java | 5 +++--
 1 file changed, 3 insertions(+), 2 deletions(-)

diff --git a/jena-arq/src/main/java/org/apache/jena/sparql/expr/NodeValue.java b/jena-arq/src/main/java/org/apache/jena/sparql/expr/NodeValue.java
index cdcf670f0c..d323019e6c 100644
--- a/jena-arq/src/main/java/org/apache/jena/sparql/expr/NodeValue.java
+++ b/jena-arq/src/main/java/org/apache/jena/sparql/expr/NodeValue.java
@@ -671,7 +671,6 @@ public abstract class NodeValue extends ExprNode
         if ( NodeUtils.hasLang(node) )
             return new NodeValueLang(node) ;
         LiteralLabel lit = node.getLiteral() ;
-        String lex = lit.getLexicalForm() ;
         RDFDatatype datatype = lit.getDatatype() ;
 
         // Quick check.
@@ -683,10 +682,12 @@ public abstract class NodeValue extends ExprNode
             return null ;
         }
 
+        String lex = lit.getLexicalForm() ;
+
         try { // DatatypeFormatException - should not happen
             if ( XSDstring.isValidLiteral(lit) )
                 // String - plain or xsd:string, or derived datatype.
-                return new NodeValueString(lit.getLexicalForm(), node) ;
+                return new NodeValueString(lex, node) ;
 
             // Otherwise xsd:string is like any other unknown datatype.
             // Ditto literals with language tags (which are handled by nodeToNodeValue)