Skip to content

Commit

Permalink
Merge pull request apache#1802 from Aklakan/fastnvfail
Browse files Browse the repository at this point in the history
apacheGH-1801: Prevents needless materialization of lexical forms
  • Loading branch information
afs authored Mar 17, 2023
2 parents cf31ce1 + f42d652 commit 33c14fb
Showing 1 changed file with 3 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -671,7 +671,6 @@ private static NodeValue _setByValue(Node node) {
if ( NodeUtils.hasLang(node) )
return new NodeValueLang(node) ;
LiteralLabel lit = node.getLiteral() ;
String lex = lit.getLexicalForm() ;
RDFDatatype datatype = lit.getDatatype() ;

// Quick check.
Expand All @@ -683,10 +682,12 @@ private static NodeValue _setByValue(Node node) {
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)
Expand Down

0 comments on commit 33c14fb

Please sign in to comment.