Return-Path: X-Original-To: apmail-incubator-jena-dev-archive@minotaur.apache.org Delivered-To: apmail-incubator-jena-dev-archive@minotaur.apache.org Received: from mail.apache.org (hermes.apache.org [140.211.11.3]) by minotaur.apache.org (Postfix) with SMTP id 3A00B9F6E for ; Wed, 4 Apr 2012 11:12:44 +0000 (UTC) Received: (qmail 33317 invoked by uid 500); 4 Apr 2012 11:12:44 -0000 Delivered-To: apmail-incubator-jena-dev-archive@incubator.apache.org Received: (qmail 33288 invoked by uid 500); 4 Apr 2012 11:12:44 -0000 Mailing-List: contact jena-dev-help@incubator.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: jena-dev@incubator.apache.org Delivered-To: mailing list jena-dev@incubator.apache.org Received: (qmail 33279 invoked by uid 99); 4 Apr 2012 11:12:44 -0000 Received: from athena.apache.org (HELO athena.apache.org) (140.211.11.136) by apache.org (qpsmtpd/0.29) with ESMTP; Wed, 04 Apr 2012 11:12:44 +0000 X-ASF-Spam-Status: No, hits=-2000.0 required=5.0 tests=ALL_TRUSTED,T_RP_MATCHES_RCVD X-Spam-Check-By: apache.org Received: from [140.211.11.116] (HELO hel.zones.apache.org) (140.211.11.116) by apache.org (qpsmtpd/0.29) with ESMTP; Wed, 04 Apr 2012 11:12:42 +0000 Received: from hel.zones.apache.org (hel.zones.apache.org [140.211.11.116]) by hel.zones.apache.org (Postfix) with ESMTP id 6D326357212 for ; Wed, 4 Apr 2012 11:12:22 +0000 (UTC) Date: Wed, 4 Apr 2012 11:12:22 +0000 (UTC) From: "Andy Seaborne (Resolved) (JIRA)" To: jena-dev@incubator.apache.org Message-ID: <1596097324.11053.1333537942448.JavaMail.tomcat@hel.zones.apache.org> In-Reply-To: <1638589551.5973.1333457664204.JavaMail.tomcat@hel.zones.apache.org> Subject: [jira] [Resolved] (JENA-231) NumberFormatException when casting to xsd:int in ARQ, with possible infinite loop MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 7bit X-JIRA-FingerPrint: 30527f35849b9dde25b450d4833f0394 X-Virus-Checked: Checked by ClamAV on apache.org [ https://issues.apache.org/jira/browse/JENA-231?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ] Andy Seaborne resolved JENA-231. -------------------------------- Resolution: Fixed Fix Version/s: ARQ 2.9.1 Fix applied in SVN. White space causes an evaluation error, following the text in RDF Concepts (2004). > NumberFormatException when casting to xsd:int in ARQ, with possible infinite loop > --------------------------------------------------------------------------------- > > Key: JENA-231 > URL: https://issues.apache.org/jira/browse/JENA-231 > Project: Apache Jena > Issue Type: Bug > Components: ARQ > Affects Versions: ARQ 2.9.0 > Reporter: Richard Cyganiak > Assignee: Andy Seaborne > Fix For: ARQ 2.9.1 > > > I'm running the following query on an empty dataset using the sparql command line command: > PREFIX xsd: > SELECT (xsd:int(" 1") AS ?x) {} > The result is an error: > java.lang.NumberFormatException: For input string: " 1" > I know that this is not a valid lexical form for xsd:int (note the extra space). But I expected this to produce an empty result set, like other non-int strings such as xsd:int("NaN"), and not an exception. > The problem appears to be triggered by the presence of leading or trailing spaces around an otherwise correct number. The same problem is present when casting to other types such as xsd:decimal. The problem is *not* present for xsd:double. > Command and full stack trace follows. > (I have a user report of an infinite loop in ARQ code that I distilled down to this root issue. The report involved a cast to xsd:decimal in a FILTER expression. The dataset is a D2RQ dataset, and the values came from a CHAR column, hence the extra spaces. I have not succeeded in actually reproducing the infinite loop as I don't have access to the original database.) > cygris:~$ sparql --query rob.sparql --data empty.nt > Exception > java.lang.NumberFormatException: For input string: " 1" > at java.lang.NumberFormatException.forInputString(NumberFormatException.java:48) > at java.lang.Integer.parseInt(Integer.java:449) > at java.math.BigInteger.(BigInteger.java:316) > at java.math.BigInteger.(BigInteger.java:451) > at com.hp.hpl.jena.sparql.expr.NodeValue._setByValue(NodeValue.java:957) > at com.hp.hpl.jena.sparql.expr.NodeValue.nodeToNodeValue(NodeValue.java:915) > at com.hp.hpl.jena.sparql.expr.NodeValue.makeNode(NodeValue.java:231) > at com.hp.hpl.jena.sparql.expr.NodeValue.makeNode(NodeValue.java:238) > at com.hp.hpl.jena.sparql.function.CastXSD$Instance.cast(CastXSD.java:96) > at com.hp.hpl.jena.sparql.function.CastXSD_Numeric$Instance.cast(CastXSD_Numeric.java:61) > at com.hp.hpl.jena.sparql.function.CastXSD$Instance.exec(CastXSD.java:86) > at com.hp.hpl.jena.sparql.function.FunctionBase1.exec(FunctionBase1.java:53) > at com.hp.hpl.jena.sparql.function.FunctionBase.exec(FunctionBase.java:68) > at com.hp.hpl.jena.sparql.expr.E_Function.evalSpecial(E_Function.java:71) > at com.hp.hpl.jena.sparql.expr.ExprFunctionN.eval(ExprFunctionN.java:102) > at com.hp.hpl.jena.sparql.core.VarExprList.get(VarExprList.java:82) > at com.hp.hpl.jena.sparql.engine.iterator.QueryIterAssign.accept(QueryIterAssign.java:68) > at com.hp.hpl.jena.sparql.engine.iterator.QueryIterProcessBinding.hasNextBinding(QueryIterProcessBinding.java:64) > at com.hp.hpl.jena.sparql.engine.iterator.QueryIteratorBase.hasNext(QueryIteratorBase.java:108) > at com.hp.hpl.jena.sparql.engine.iterator.QueryIterConvert.hasNextBinding(QueryIterConvert.java:65) > at com.hp.hpl.jena.sparql.engine.iterator.QueryIteratorBase.hasNext(QueryIteratorBase.java:108) > at com.hp.hpl.jena.sparql.engine.iterator.QueryIteratorWrapper.hasNextBinding(QueryIteratorWrapper.java:40) > at com.hp.hpl.jena.sparql.engine.iterator.QueryIteratorBase.hasNext(QueryIteratorBase.java:108) > at com.hp.hpl.jena.sparql.engine.iterator.QueryIteratorWrapper.hasNextBinding(QueryIteratorWrapper.java:40) > at com.hp.hpl.jena.sparql.engine.iterator.QueryIteratorBase.hasNext(QueryIteratorBase.java:108) > at com.hp.hpl.jena.sparql.engine.ResultSetStream.hasNext(ResultSetStream.java:72) > at com.hp.hpl.jena.sparql.resultset.ResultSetMem.(ResultSetMem.java:95) > at com.hp.hpl.jena.sparql.resultset.TextOutput.write(TextOutput.java:147) > at com.hp.hpl.jena.sparql.resultset.TextOutput.write(TextOutput.java:130) > at com.hp.hpl.jena.sparql.resultset.TextOutput.write(TextOutput.java:118) > at com.hp.hpl.jena.sparql.resultset.TextOutput.format(TextOutput.java:65) > at com.hp.hpl.jena.query.ResultSetFormatter.out(ResultSetFormatter.java:134) > at com.hp.hpl.jena.sparql.util.QueryExecUtils.outputResultSet(QueryExecUtils.java:169) > at com.hp.hpl.jena.sparql.util.QueryExecUtils.doSelectQuery(QueryExecUtils.java:211) > at com.hp.hpl.jena.sparql.util.QueryExecUtils.executeQuery(QueryExecUtils.java:75) > at arq.query.queryExec(query.java:186) > at arq.query.exec(query.java:145) > at arq.cmdline.CmdMain.mainMethod(CmdMain.java:97) > at arq.cmdline.CmdMain.mainRun(CmdMain.java:59) > at arq.cmdline.CmdMain.mainRun(CmdMain.java:46) > at arq.query.main(query.java:65) > at arq.sparql.main(sparql.java:27) -- This message is automatically generated by JIRA. If you think it was sent incorrectly, please contact your JIRA administrators: https://issues.apache.org/jira/secure/ContactAdministrators!default.jspa For more information on JIRA, see: http://www.atlassian.com/software/jira