gnu.text

Class SourceError

public class SourceError extends Object implements SourceLocator

Represents an error message from processing a "source" file.
Field Summary
Stringcode
If non-null, an error code, as might be specified by a standard.
intcolumn
The column number of the error, with 1 being the left-most column.
ThrowablefakeException
Provides optional stack trace.
Stringfilename
The name or URL of the file containing the error.
intline
The (1-origin) location of the error.
Stringmessage
The actual error message.
SourceErrornext
Used to chain to the "next" message.
charseverity
The seriousness of the error - one of 'w' (for warning), 'e' (for error), or 'f' (for fatal error).
Constructor Summary
SourceError(char severity, String filename, int line, int column, String message)
SourceError(char severity, SourceLocator location, String message)
SourceError(LineBufferedReader port, char severity, String message)
Create a new SourceError using the current line/column from a LineBufferedReader.
Method Summary
intgetColumnNumber()
StringgetFileName()
intgetLineNumber()
StringgetPublicId()
StringgetSystemId()
booleanisStableSourceLocation()
voidprint(PrintWriter out)
voidprintln(PrintWriter out)
voidprintln(PrintStream out)
StringtoString()
Convert the error to a String.

Field Detail

code

public String code
If non-null, an error code, as might be specified by a standard.

column

public int column
The column number of the error, with 1 being the left-most column. The value 0 means unknown or not applicable (such as the entire line).

fakeException

public Throwable fakeException
Provides optional stack trace. Filled when --debug-error-prints-stack-trace or --debug-warning-prints-stack-trace option is used.

filename

public String filename
The name or URL of the file containing the error.

line

public int line
The (1-origin) location of the error.

message

public String message
The actual error message. This is post-localization and -formatting. It can contain multiple lines, separated by '\n'.

public SourceError next
Used to chain to the "next" message.

severity

public char severity
The seriousness of the error - one of 'w' (for warning), 'e' (for error), or 'f' (for fatal error).

Constructor Detail

SourceError

public SourceError(char severity, String filename, int line, int column, String message)

SourceError

public SourceError(char severity, SourceLocator location, String message)

SourceError

public SourceError(LineBufferedReader port, char severity, String message)
Create a new SourceError using the current line/column from a LineBufferedReader.

Method Detail

getColumnNumber

public int getColumnNumber()

getFileName

public String getFileName()

getLineNumber

public int getLineNumber()

getPublicId

public String getPublicId()

getSystemId

public String getSystemId()

isStableSourceLocation

public boolean isStableSourceLocation()

print

public void print(PrintWriter out)

println

public void println(PrintWriter out)

println

public void println(PrintStream out)

toString

public String toString()
Convert the error to a String. The String starts with filename, line and option column, followed by the message. Warning messages are indicated as such.