Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -83,8 +83,10 @@ private void read(TurtleJavacc parser, String baseURI, ContentType ct, StreamRDF
throw ex;
}
catch (ParseException ex) {
profile.getErrorHandler().error(ex.getMessage(), ex.currentToken.beginLine, ex.currentToken.beginColumn);
throw new RiotParseException(ex.getMessage(), ex.currentToken.beginLine, ex.currentToken.beginColumn);
// The error is at the token after the last successfully consumed token.
var errorToken = ex.currentToken.next != null ? ex.currentToken.next : ex.currentToken;
profile.getErrorHandler().error(ex.getMessage(), errorToken.beginLine, errorToken.beginColumn);
throw new RiotParseException(ex.getMessage(), errorToken.beginLine, errorToken.beginColumn);
}
catch (TokenMgrError ex) {
profile.getErrorHandler().error(ex.getMessage(), -1, -1);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -92,7 +92,9 @@ private static void perform(Query query, String string, Action action) {
parser.setQuery(query);
action.exec(parser);
} catch (org.apache.jena.sparql.lang.arq.javacc.ParseException ex) {
throw new QueryParseException(ex.getMessage(), ex.currentToken.beginLine, ex.currentToken.beginColumn);
// The error is at the token after the last successfully consumed token.
var errorToken = ex.currentToken.next != null ? ex.currentToken.next : ex.currentToken;
throw new QueryParseException(ex.getMessage(), errorToken.beginLine, errorToken.beginColumn);
} catch (org.apache.jena.sparql.lang.arq.javacc.TokenMgrError tErr) {
// Last valid token : not the same as token error message - but this
// should not happen
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,9 @@ protected void executeParse(UpdateSink sink, Prologue prologue, Reader r) {
parser.setUpdate(prologue, sink);
parser.UpdateUnit();
} catch (org.apache.jena.sparql.lang.arq.javacc.ParseException ex) {
throw new QueryParseException(ex.getMessage(), ex.currentToken.beginLine, ex.currentToken.beginColumn);
// The error is at the token after the last successfully consumed token.
var errorToken = ex.currentToken.next != null ? ex.currentToken.next : ex.currentToken;
throw new QueryParseException(ex.getMessage(), errorToken.beginLine, errorToken.beginColumn);
} catch (org.apache.jena.sparql.lang.arq.javacc.TokenMgrError tErr) {
// Last valid token : not the same as token error message - but this
// should not happen
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -75,7 +75,9 @@ private static void perform(Query query, String string, Action action) {
parser.setQuery(query);
action.exec(parser);
} catch (org.apache.jena.sparql.lang.sparql_10.javacc.ParseException ex) {
throw new QueryParseException(ex.getMessage(), ex.currentToken.beginLine, ex.currentToken.beginColumn);
// The error is at the token after the last successfully consumed token.
var errorToken = ex.currentToken.next != null ? ex.currentToken.next : ex.currentToken;
throw new QueryParseException(ex.getMessage(), errorToken.beginLine, errorToken.beginColumn);
} catch (org.apache.jena.sparql.lang.sparql_10.javacc.TokenMgrError tErr) {
// Last valid token : not the same as token error message - but this
// should not happen
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -75,7 +75,9 @@ private static void perform(Query query, String string, Action action) {
parser.setQuery(query);
action.exec(parser);
} catch (org.apache.jena.sparql.lang.sparql_11.javacc.ParseException ex) {
throw new QueryParseException(ex.getMessage(), ex.currentToken.beginLine, ex.currentToken.beginColumn);
// The error is at the token after the last successfully consumed token.
var errorToken = ex.currentToken.next != null ? ex.currentToken.next : ex.currentToken;
throw new QueryParseException(ex.getMessage(), errorToken.beginLine, errorToken.beginColumn);
} catch (org.apache.jena.sparql.lang.sparql_11.javacc.TokenMgrError tErr) {
// Last valid token : not the same as token error message - but this
// should not happen
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,9 @@ protected void executeParse(UpdateSink sink, Prologue prologue, Reader r) {
parser.setUpdate(prologue, sink);
parser.UpdateUnit();
} catch (org.apache.jena.sparql.lang.sparql_11.javacc.ParseException ex) {
throw new QueryParseException(ex.getMessage(), ex.currentToken.beginLine, ex.currentToken.beginColumn);
// The error is at the token after the last successfully consumed token.
var errorToken = ex.currentToken.next != null ? ex.currentToken.next : ex.currentToken;
throw new QueryParseException(ex.getMessage(), errorToken.beginLine, errorToken.beginColumn);
} catch (org.apache.jena.sparql.lang.sparql_11.javacc.TokenMgrError tErr) {
// Last valid token : not the same as token error message - but this
// should not happen
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -77,7 +77,9 @@ private static void perform(Query query, String string, Action action) {
parser.setQuery(query);
action.exec(parser);
} catch (org.apache.jena.sparql.lang.sparql_12.javacc.ParseException ex) {
throw new QueryParseException(ex.getMessage(), ex.currentToken.beginLine, ex.currentToken.beginColumn);
// The error is at the token after the last successfully consumed token.
var errorToken = ex.currentToken.next != null ? ex.currentToken.next : ex.currentToken;
throw new QueryParseException(ex.getMessage(), errorToken.beginLine, errorToken.beginColumn);
} catch (org.apache.jena.sparql.lang.sparql_12.javacc.TokenMgrError tErr) {
// Last valid token : not the same as token error message - but this
// should not happen
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,9 @@ protected void executeParse(UpdateSink sink, Prologue prologue, Reader r) {
parser.setUpdate(prologue, sink);
parser.UpdateUnit();
} catch (org.apache.jena.sparql.lang.sparql_12.javacc.ParseException ex) {
throw new QueryParseException(ex.getMessage(), ex.currentToken.beginLine, ex.currentToken.beginColumn);
// The error is at the token after the last successfully consumed token.
var errorToken = ex.currentToken.next != null ? ex.currentToken.next : ex.currentToken;
throw new QueryParseException(ex.getMessage(), errorToken.beginLine, errorToken.beginColumn);
} catch (org.apache.jena.sparql.lang.sparql_12.javacc.TokenMgrError tErr) {
// Last valid token : not the same as token error message - but this
// should not happen
Expand Down