public class SyntaxErrorException
extends java.lang.Exception
This should be thrown only from methods that parse a string (e.g. a command-line parser, etc) whenever the
format of the string argument is wrong. This should NOT be used for internal parsing errors, but rather when
string itself has an identifiable syntax error.
These derive from Exception
(rather than the unchecked RuntimeException
because the caller
should be aware of the potential for errors in user-provided input.
Modifier and Type | Field and Description |
---|---|
protected int |
columnOffset
The estimated column number or character offset of the start of the syntax error.
|
protected java.lang.String |
errorDescription
A brief description or name of the error, e.g.
|
static java.lang.String |
leftCodeQuote
leftCodeQuote and rightCodeQuote are the quote
characters used to distinguish the offending segment of code in the error message. |
protected int |
lineOffset
The estimated line where the syntax error occurred.
|
protected java.lang.String |
location
Information about the location of the offending segment in the subject, so the user can find it easily.
|
protected java.lang.String |
offendingText
The part of the subject string most closely associated with the error.
|
static java.lang.String |
rightCodeQuote
leftCodeQuote and rightCodeQuote are the quote
characters used to distinguish the offending segment of code in the error message. |
private static long |
serialVersionUID |
Constructor and Description |
---|
SyntaxErrorException()
Default constructor.
|
SyntaxErrorException(java.lang.String message)
Basic exception constructor, delegated to super class.
|
SyntaxErrorException(java.lang.String errorDescription,
java.lang.String offendingText,
int line,
int column) |
SyntaxErrorException(java.lang.String errorDescription,
java.lang.String offendingText,
java.lang.String locationDescription) |
SyntaxErrorException(java.lang.String message,
java.lang.String briefErrorDescription,
java.lang.String offendingText,
java.lang.String errorLocationDescription,
int line,
int column,
java.lang.Throwable cause) |
SyntaxErrorException(java.lang.String message,
java.lang.Throwable cause)
Basic exception constructor, delegated to super class.
|
SyntaxErrorException(java.lang.Throwable cause) |
Modifier and Type | Method and Description |
---|---|
protected static void |
buildLocationInfo(StringBuilderEx sb,
int line,
int column,
java.lang.String location) |
private static java.lang.String |
buildMessage(java.lang.String error,
java.lang.String text,
int line,
int column,
java.lang.String location) |
int |
getColumn() |
java.lang.String |
getErrorDescription() |
int |
getLine() |
java.lang.String |
getLocation() |
java.lang.String |
getLocationDescription() |
java.lang.String |
getOffendingText() |
boolean |
hasLocationInfo() |
protected int columnOffset
protected java.lang.String errorDescription
public static java.lang.String leftCodeQuote
leftCodeQuote
and rightCodeQuote
are the quote
characters used to distinguish the offending segment of code in the error message.protected int lineOffset
protected java.lang.String location
getLocation()
.protected java.lang.String offendingText
public static java.lang.String rightCodeQuote
leftCodeQuote
and rightCodeQuote
are the quote
characters used to distinguish the offending segment of code in the error message.private static final long serialVersionUID
public SyntaxErrorException()
public SyntaxErrorException(java.lang.String message)
Throwable.Throwable(String)
Does not fill in details of the error.public SyntaxErrorException(@Nullable java.lang.String errorDescription, @Nullable java.lang.String offendingText, int line, int column)
public SyntaxErrorException(@Nullable java.lang.String errorDescription, @Nullable java.lang.String offendingText, java.lang.String locationDescription)
public SyntaxErrorException(@Nullable java.lang.String message, @Nullable java.lang.String briefErrorDescription, @Nullable java.lang.String offendingText, @Nullable java.lang.String errorLocationDescription, int line, int column, @Nullable java.lang.Throwable cause)
public SyntaxErrorException(java.lang.String message, java.lang.Throwable cause)
Throwable.Throwable(String,Throwable)
Does not fill in details of the error.public SyntaxErrorException(java.lang.Throwable cause)
protected static void buildLocationInfo(StringBuilderEx sb, int line, int column, java.lang.String location)
private static java.lang.String buildMessage(java.lang.String error, java.lang.String text, int line, int column, java.lang.String location)
public int getColumn()
public java.lang.String getErrorDescription()
public int getLine()
public java.lang.String getLocation()
public java.lang.String getLocationDescription()
public java.lang.String getOffendingText()
public boolean hasLocationInfo()