[jboss-svn-commits] JBL Code SVN: r20349 - labs/jbossrules/branches/parser-rewrite/drools-compiler/src/main/java/org/drools/compiler.

jboss-svn-commits at lists.jboss.org jboss-svn-commits at lists.jboss.org
Thu Jun 5 22:46:19 EDT 2008


Author: porcelli
Date: 2008-06-05 22:46:19 -0400 (Thu, 05 Jun 2008)
New Revision: 20349

Modified:
   labs/jbossrules/branches/parser-rewrite/drools-compiler/src/main/java/org/drools/compiler/DroolsParserException.java
Log:
Improved Execption data.

Modified: labs/jbossrules/branches/parser-rewrite/drools-compiler/src/main/java/org/drools/compiler/DroolsParserException.java
===================================================================
--- labs/jbossrules/branches/parser-rewrite/drools-compiler/src/main/java/org/drools/compiler/DroolsParserException.java	2008-06-06 02:45:49 UTC (rev 20348)
+++ labs/jbossrules/branches/parser-rewrite/drools-compiler/src/main/java/org/drools/compiler/DroolsParserException.java	2008-06-06 02:46:19 UTC (rev 20349)
@@ -19,38 +19,105 @@
 import org.drools.CheckedDroolsException;
 
 public class DroolsParserException extends CheckedDroolsException {
-    /**
-     * 
-     */
-    private static final long serialVersionUID = 400L;
+	/**
+	 * 
+	 */
+	private static final long serialVersionUID = 400L;
 
-    /**
-     * @see java.lang.Exception#Exception()
-     */
-    public DroolsParserException() {
-        super();
-    }
+	private String errorCode = null;
+	private int lineNumber;
+	private int column;
+	private int offset;
 
-    /**
-     * @see java.lang.Exception#Exception(String message)
-     */
-    public DroolsParserException(final String message) {
-        super( message );
-    }
+	/**
+	 * @see java.lang.Exception#Exception()
+	 */
+	public DroolsParserException() {
+		super();
+	}
 
-    /**
-     * @see java.lang.Exception#Exception(String message, Throwable cause)
-     */
-    public DroolsParserException(final String message,
-                                 final Throwable cause) {
-        super( message );
-    }
+	/**
+	 * @see java.lang.Exception#Exception(String message)
+	 */
+	public DroolsParserException(final String message) {
+		super(message);
+	}
 
-    /**
-     * @see java.lang.Exception#Exception(Throwable cause)
-     */
-    public DroolsParserException(final Throwable cause) {
-        super( cause );
-    }
+	/**
+	 * @see java.lang.Exception#Exception(String message, Throwable cause)
+	 */
+	public DroolsParserException(final String message, final Throwable cause) {
+		super(message);
+	}
 
+	/**
+	 * @see java.lang.Exception#Exception(Throwable cause)
+	 */
+	public DroolsParserException(final Throwable cause) {
+		super(cause);
+	}
+
+	/**
+	 * DroolsParserException constructor.
+	 * 
+	 * @param errorCode
+	 *            error code
+	 * @param message
+	 *            message
+	 * @param lineNumber
+	 *            line number
+	 * @param column
+	 *            column
+	 * @param offset
+	 *            offset
+	 * @param cause
+	 *            exception cause
+	 */
+	public DroolsParserException(String errorCode, String message, int lineNumber,
+			int column, int offset, Throwable cause) {
+		super(message, cause);
+		this.errorCode = errorCode;
+		this.lineNumber = lineNumber;
+		this.column = column;
+		this.offset = offset;
+	}
+
+	public String getMessage() {
+		if (null == errorCode) {
+			return super.getMessage();
+		}
+		return "[" + errorCode + "] " + super.getMessage();
+	}
+
+	/**
+	 * getter for error code
+	 * 
+	 */
+	public String getErrorCode() {
+		return errorCode;
+	}
+
+	/**
+	 * getter for line number
+	 * 
+	 */
+	public int getLineNumber() {
+		return lineNumber;
+	}
+
+	/**
+	 * getter for column position
+	 * 
+	 */
+	public int getColumn() {
+		return column;
+	}
+
+	/**
+	 * getter for char offset
+	 * 
+	 */
+	public int getOffset() {
+		return offset;
+	}
 }
\ No newline at end of file




More information about the jboss-svn-commits mailing list