Skip to content

Commit

Permalink
Fix parsing of Long.MIN_VALUE
Browse files Browse the repository at this point in the history
Resolves: #8365
  • Loading branch information
luigidellaquila committed Jul 2, 2018
1 parent fd03cb9 commit ab08844
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 6 deletions.
2 changes: 1 addition & 1 deletion core/src/main/grammar/OrientSQL.jjt
Original file line number Diff line number Diff line change
Expand Up @@ -863,7 +863,7 @@ OInteger Integer():
}
{
(
[ <MINUS> {sign = -1;} ] tokenVal = <INTEGER_LITERAL> {jjtThis.value = sign * Long.parseLong(tokenVal.image);}
[ <MINUS> {sign = -1;} ] tokenVal = <INTEGER_LITERAL> {jjtThis.value = Long.parseLong(sign >= 0 ? tokenVal.image : "-" + tokenVal.image);}
) { return jjtThis; }
}

Expand Down
Original file line number Diff line number Diff line change
@@ -1,12 +1,11 @@
/* Generated By:JJTree&JavaCC: Do not edit this line. OrientSql.java */
package com.orientechnologies.orient.core.sql.parser;

import com.orientechnologies.orient.core.exception.OQueryParsingException;
import com.orientechnologies.orient.core.sql.OCommandSQLParsingException;

import java.io.InputStream;
import java.util.ArrayList;
import java.util.List;
import java.util.ArrayList;
import com.orientechnologies.orient.core.sql.OCommandSQLParsingException;
import com.orientechnologies.orient.core.exception.OQueryParsingException;

/** Orient Database Sql grammar. */
public class OrientSql/*@bgen(jjtree)*/implements OrientSqlTreeConstants, OrientSqlConstants {/*@bgen(jjtree)*/
Expand Down Expand Up @@ -541,7 +540,7 @@ final public OInteger Integer() throws ParseException {
;
}
tokenVal = jj_consume_token(INTEGER_LITERAL);
jjtn000.value = sign * Long.parseLong(tokenVal.image);
jjtn000.value = Long.parseLong(sign >= 0 ? tokenVal.image : "-" + tokenVal.image);
jjtree.closeNodeScope(jjtn000, true);
jjtc000 = false;
jjtn000.jjtSetLastToken(getToken(0));
Expand Down

0 comments on commit ab08844

Please sign in to comment.