Just a correction, the NullPointerException is raised by : literal.getValue();

It seems the query is correctly parsed, it gets the identifiers, but seems to 
use the literal code (restriction) for identifier comparison (join).

Any idea ?

Frédéric Esnault - Ingénieur R&D


-----Message d'origine-----
De : Frédéric Esnault [mailto:[EMAIL PROTECTED] 
Envoyé : mercredi 20 juin 2007 13:39
À : [email protected]
Objet : SQL request parse error

Hi all,

 

I encountered a problem working with a SQL request :

 

SELECT lgw:contractorType.lgw:title FROM lgw:contractorType, lgw:contractType 

WHERE lgw:contractType.jcr:uuid= 'b744b41b-8425-4008-99a6-ce8456d87c4e' 

AND lgw:contractorType.jcr:uuid=lgw:contractType.lgw:internalContractor

 

After debug, here is the analysis. The error is : 
javax.jcr.query.InvalidQueryException

But actually, the error is a NullPointerException.

 

The problem comes from the join.

During the AndExpression evaluation, it evaluates the two AndOperands. The 
first one is :

 

lgw:contractType.jcr:uuid= 'b744b41b-8425-4008-99a6-ce8456d87c4e'

 

and everything goes fine. The second one is :

 

lgw:contractorType.jcr:uuid=lgw:contractType.lgw:internalContractor

 

and there it fails because during the evaluation,it calls 
createRelationQueryNode in JCRSQLQueryBuilder and in the first case, no 
problem, but in the second case it fails because the first thing done in this 
method is : String stringValue = literal.getValue();

 

But in the second case, there is no literal value, it deals with an Identifier 
instead of a literal, but it seems to try and evaluate  it as a literal. And as 
it's not a literal, the ASTLiteral[] value element is not filled, so it's null. 
Then, value[0].getValue() raises the NullPointerException.

 

Is it a bug? Or is join not implemented? There is a getIdentifier (SimpleNode 
node) method in the anonymous DefaultParserVisitor class defined in the 
visit(ASTPredicate node, Object data) of JCRSQLQueryBuilder, but cannot step 
into it.

 

Frederic Esnault

Reply via email to