gnu.text
Class SourceError

java.lang.Object
  extended by gnu.text.SourceError
All Implemented Interfaces:
SourceLocator, org.xml.sax.Locator

public class SourceError
extends java.lang.Object
implements SourceLocator

Represents an error message from processing a "source" file.


Field Summary
 java.lang.String code
          If non-null, an error code, as might be specified by a standard.
 int column
          The column number of the error, with 1 being the left-most column.
 java.lang.Throwable fakeException
          Provides optional stack trace.
 java.lang.String filename
          The name or URL of the file containing the error.
 int line
          The (1-origin) location of the error.
 java.lang.String message
          The actual error message.
 SourceError next
          Used to chain to the "next" message.
 char severity
          The seriousness of the error - one of 'w' (for warning), 'e' (for error), or 'f' (for fatal error).
 
Constructor Summary
SourceError(char severity, SourceLocator location, java.lang.String message)
           
SourceError(char severity, java.lang.String filename, int line, int column, java.lang.String message)
           
SourceError(LineBufferedReader port, char severity, java.lang.String message)
          Create a new SourceError using the current line/column from a LineBufferedReader.
 
Method Summary
 int getColumnNumber()
          Return current column number.
 java.lang.String getFileName()
          Normally same as getSystemId.
 int getLineNumber()
          Return current line number.
 java.lang.String getPublicId()
           
 java.lang.String getSystemId()
           
 boolean isStableSourceLocation()
          True if position is unlikely to change.
 void print(java.io.PrintWriter out)
           
 void println(java.io.PrintStream out)
           
 void println(java.io.PrintWriter out)
           
 java.lang.String toString()
          Convert the error to a String.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

next

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).


filename

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


code

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


line

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


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).


message

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


fakeException

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

Constructor Detail

SourceError

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

SourceError

public SourceError(char severity,
                   SourceLocator location,
                   java.lang.String message)

SourceError

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

Method Detail

toString

public java.lang.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.

Overrides:
toString in class java.lang.Object

print

public void print(java.io.PrintWriter out)

println

public void println(java.io.PrintWriter out)

println

public void println(java.io.PrintStream out)

getLineNumber

public int getLineNumber()
Description copied from interface: SourceLocator
Return current line number. The "first" line is line 1; unknown is -1.

Specified by:
getLineNumber in interface SourceLocator
Specified by:
getLineNumber in interface org.xml.sax.Locator

getColumnNumber

public int getColumnNumber()
Description copied from interface: SourceLocator
Return current column number. The "first" column is column 1; unknown is -1.

Specified by:
getColumnNumber in interface SourceLocator
Specified by:
getColumnNumber in interface org.xml.sax.Locator

getPublicId

public java.lang.String getPublicId()
Specified by:
getPublicId in interface SourceLocator
Specified by:
getPublicId in interface org.xml.sax.Locator

getSystemId

public java.lang.String getSystemId()
Specified by:
getSystemId in interface SourceLocator
Specified by:
getSystemId in interface org.xml.sax.Locator

getFileName

public java.lang.String getFileName()
Description copied from interface: SourceLocator
Normally same as getSystemId.

Specified by:
getFileName in interface SourceLocator

isStableSourceLocation

public boolean isStableSourceLocation()
Description copied from interface: SourceLocator
True if position is unlikely to change. True for an expression but not an input file.

Specified by:
isStableSourceLocation in interface SourceLocator