yurloc commented on code in PR #5778:
URL: 
https://github.com/apache/incubator-kie-drools/pull/5778#discussion_r1521577291


##########
drools-drl/drools-drl-parser/src/main/java/org/drools/drl/parser/antlr4/DroolsParserExceptionFactory.java:
##########
@@ -103,58 +100,45 @@ public DroolsParserException 
createTrailingSemicolonException( int line,
     /**
      * This method creates a DroolsParserException full of information.
      *
-     * @param e
-     *            original exception
+     * @param offendingSymbol
+     * @param line
+     * @param charPositionInLine
+     * @param e original exception
      * @return DroolsParserException filled.
      */
-    public DroolsParserException createDroolsException( RecognitionException e 
) {
-        List<String> codeAndMessage = createErrorMessage( e );
-        return new DroolsParserException( codeAndMessage.get( 1 ),
-                                          codeAndMessage
-                                                  .get( 0 ),
-                                          // TODO verify this is correct
-                                          e.getOffendingToken().getLine(),
-                                          
e.getOffendingToken().getCharPositionInLine(),
-                                          
e.getOffendingToken().getStartIndex(),
+    public DroolsParserException createDroolsException(Object offendingSymbol, 
int line, int charPositionInLine, String message, RecognitionException e ) {
+        return new DroolsParserException( determineErrorCode( e ),
+                                          String.format("Line %d:%d %s", line, 
charPositionInLine, message),

Review Comment:
   The `message` produced by the parser is almost identical to the original 
message. It just needs prepending the line/column information. That allows me 
to drop the `createErrorMessage` and the formatting strings.



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]


---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to