[ 
https://issues.apache.org/jira/browse/JCR-3985?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=15324454#comment-15324454
 ] 

Alfusainey Jallow commented on JCR-3985:
----------------------------------------

[~dbu], the problem is in the query string itself since -2e is not a valid 
representation of a BigDecimal[0]. the query parser, upon reading the character 
e or E, tries to check if the next character following it is a number. since 
there is no number that follows the letter e, it returns an 
'InvalidQueryException'.

the exact place where it fails is in the private method 'readDecimal(..,..,) of 
the org.apache.jackrabbit.commons.query.sql2.Parser class:

{code}
private void readDecimal(int start, int i) throws RepositoryException {
  ...
  if (chars[i] == 'E' || chars[i] == 'e') {
            i++;
            if (chars[i] == '+' || chars[i] == '-') {
                i++;
            }
            if (types[i] != CHAR_VALUE) { // this if-check fails
                throw getSyntaxError();
            }
            do {
                i++; // go until the first non-number
            } while (types[i] == CHAR_VALUE);
        }
  ...
}
{code}

if i modify the query to take 'test-2e10' or 'test-2e-10', the query is 
successfully executed.

[1] 
https://docs.oracle.com/javase/7/docs/api/java/math/BigDecimal.html#BigDecimal(java.lang.String)
  (it says that "The exponent consists of the character 'e' ('\u0065') or 'E' 
('\u0045') followed by one or more decimal digits"

> jackrabbit remoting fails on number followed by "e"
> ---------------------------------------------------
>
>                 Key: JCR-3985
>                 URL: https://issues.apache.org/jira/browse/JCR-3985
>             Project: Jackrabbit Content Repository
>          Issue Type: Bug
>          Components: jackrabbit-spi
>    Affects Versions: 2.12.1
>            Reporter: David Buchmann
>
> with our PHP client using the jackrabbit remoting, we found a very strange 
> bug. when we try to query for a node with ISCHILDNODE and a name that has -, 
> . or %, followed by a number and then followed by e or E, we get an error 400 
> response. I tried the same with a simple java client to see if we do 
> something wrong on our side, but the result is the same.
> so what does not work are names like `-2e`, `.3e` or `%0E`
> the problem does not happen if the character before <NUMBER>e is something 
> else, and it does not happen with other letters than "e". it happens with all 
> numbers however. 



--
This message was sent by Atlassian JIRA
(v6.3.4#6332)

Reply via email to