Skip to content

Commit

Permalink
8284920: Incorrect Token type causes XPath expression to return empty…
Browse files Browse the repository at this point in the history
… result

Reviewed-by: andrew
  • Loading branch information
AntonKozlov authored and RealCLanger committed Apr 19, 2022
1 parent e58378a commit c1a8749
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 8 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -360,7 +360,7 @@ else if ((Token.LPAREN != c) && (Token.RPAREN != c) && (Token.RBRACK != c)) {

addToTokenQueue(pat.substring(i, i + 1));
break;
case Token.COLON :
case Token.COLON_CHAR:
if (i>0)
{
if (posOfNSSep == (i - 1))
Expand Down Expand Up @@ -615,7 +615,7 @@ private void recordTokenString(List<String> targetStrings)
resetTokenMark(tokPos + 1);
}

if (m_processor.lookahead(Token.COLON, 1))
if (m_processor.lookahead(Token.COLON_CHAR, 1))
{
tokPos += 2;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -45,10 +45,9 @@ public final class Token {
static final char LPAREN = '(';
static final char RPAREN = ')';
static final char COMMA = ',';
static final char DOT = '.';
static final char AT = '@';
static final char US = '_';
static final char COLON = ':';
static final char COLON_CHAR = ':';
static final char SQ = '\'';
static final char DQ = '"';
static final char DOLLAR = '$';
Expand All @@ -58,6 +57,7 @@ public final class Token {
static final String DIV = "div";
static final String MOD = "mod";
static final String QUO = "quo";
static final String DOT = ".";
static final String DDOT = "..";
static final String DCOLON = "::";
static final String ATTR = "attribute";
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -1413,7 +1413,7 @@ else if ((null != m_token) && ((('.' == m_tokenChar) && (m_token.length() > 1) &

matchFound = true;
}
else if (lookahead(Token.LPAREN, 1) || (lookahead(Token.COLON, 1) && lookahead(Token.LPAREN, 3)))
else if (lookahead(Token.LPAREN, 1) || (lookahead(Token.COLON_CHAR, 1) && lookahead(Token.LPAREN, 3)))
{
matchFound = FunctionCall();
}
Expand Down Expand Up @@ -1457,7 +1457,7 @@ protected boolean FunctionCall() throws TransformerException

int opPos = m_ops.getOp(OpMap.MAPINDEX_LENGTH);

if (lookahead(Token.COLON, 1))
if (lookahead(Token.COLON_CHAR, 1))
{
appendOp(4, OpCodes.OP_EXTFUNCTION);

Expand Down Expand Up @@ -1841,7 +1841,7 @@ protected void NodeTest(int axesType) throws TransformerException
m_ops.setOp(m_ops.getOp(OpMap.MAPINDEX_LENGTH), OpCodes.NODENAME);
m_ops.setOp(OpMap.MAPINDEX_LENGTH, m_ops.getOp(OpMap.MAPINDEX_LENGTH) + 1);

if (lookahead(Token.COLON, 1))
if (lookahead(Token.COLON_CHAR, 1))
{
if (tokenIs(Token.STAR))
{
Expand Down Expand Up @@ -1944,7 +1944,7 @@ protected void PredicateExpr() throws TransformerException
protected void QName() throws TransformerException
{
// Namespace
if(lookahead(Token.COLON, 1))
if(lookahead(Token.COLON_CHAR, 1))
{
m_ops.setOp(m_ops.getOp(OpMap.MAPINDEX_LENGTH), m_queueMark - 1);
m_ops.setOp(OpMap.MAPINDEX_LENGTH, m_ops.getOp(OpMap.MAPINDEX_LENGTH) + 1);
Expand Down

0 comments on commit c1a8749

Please sign in to comment.