|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectorg.activemath.omdocjdom.mbase.MBaseErrorReporter
public class MBaseErrorReporter
MBaseErrorReporter is a configurable way to report errors when building and/or reloading a OmdocJdomMBase. This object is passed as argument to the methods candidate to throw errors
(mostly for unresolved references) which then acts in various ways:
This object was created in the hope of facilitating the construction of clean OMdoc source collections so as to, one day, avoid the need of heuristical methods to resolve references.
Its only methods when in function are reportError(org.activemath.omdocjdom.MBaseBuildException) and warnForGuess(java.lang.String, java.lang.Object, java.lang.Object, java.lang.Object, java.lang.Object) which are to
be used instead of the throw instruction. Note that warnForGuess(java.lang.String, java.lang.Object, java.lang.Object, java.lang.Object, java.lang.Object) is not yet
really complete.
| Field Summary | |
|---|---|
static String |
CVS_ID
|
int |
maxErrors
If -1 then never stops displaying errors, otherwise displays the given number of errors and then throws an exception. |
PrintStream |
out
The stream to output the messages to, if any. |
boolean |
throwExceptions
If true, throws the given exception |
boolean |
warnWhenGuessing
If false, says nothing when warnForGuess(java.lang.String, java.lang.Object, java.lang.Object, java.lang.Object, java.lang.Object) is invoked. |
boolean |
withDetails
If true prints the element XML dump and other content where the error occured. |
boolean |
withStackTrace
If true, prints the stackTrace of the exception. |
| Constructor Summary | |
|---|---|
MBaseErrorReporter()
Creates a fully ignoring error-reporter. |
|
MBaseErrorReporter(boolean throwExceptions)
Creates an error reporter that will throw exceptions which means that, most probably, the parsing or reload will stop. |
|
MBaseErrorReporter(PrintStream out,
boolean throwExceptions,
boolean withDetails,
boolean withStackTrace,
boolean warnWhenGuessing,
int maxErrors,
String basePath)
Creates a fully configure error-reporter. |
|
MBaseErrorReporter(PrintStream out,
boolean withDetails,
int maxErrors)
Create an error-reporter that no throw exceptions but simply report to the given print-stream. |
|
| Method Summary | |
|---|---|
Hashtable |
makeAsRecord(MBaseBuildException exception)
Makes a Hashtable of the given exception including the keys:
message: the exception message
exceptionClass: the exception class
systemId: the path to the file
lineNumber the line-number in the file
columnNumber the column-number in the file
|
static void |
printErrorDetails(NoSuchIDException exception,
PrintStream out)
Outputs the things in full detail independent of the settings but does not print a stack-trace. |
void |
reportError(MBaseBuildException exception)
Reports error according to the policy given. |
void |
reportError(String message)
|
void |
resetErrorNumber()
Resets the error counter so that, once again, the maxErrors number of errors is displayed. |
void |
setAccumulator(List accumulator)
Sets a list where all further errors will be added as well. |
void |
warnForGuess(String message,
Object faulty1,
Object faulty2,
Object faulty3,
Object faulty4)
This method wants to be quick, it will print a GUESS WARNING : followed by the toString conversion of all the objects given, if non-null and if warnWhenGuessing is turned
on. |
void |
warnForGuess(String message,
Object faulty1,
Object faulty2,
Object faulty3,
Object faulty4,
Object faulty5)
|
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Field Detail |
|---|
public static final String CVS_ID
public PrintStream out
public boolean throwExceptions
public boolean withDetails
public boolean withStackTrace
public boolean warnWhenGuessing
warnForGuess(java.lang.String, java.lang.Object, java.lang.Object, java.lang.Object, java.lang.Object) is invoked.
public int maxErrors
| Constructor Detail |
|---|
public MBaseErrorReporter()
public MBaseErrorReporter(boolean throwExceptions)
throwExceptions - Missing description of Parameter
public MBaseErrorReporter(PrintStream out,
boolean withDetails,
int maxErrors)
out - Missing description of ParameterwithDetails - Missing description of ParametermaxErrors - Missing description of Parameter
ignored.
public MBaseErrorReporter(PrintStream out,
boolean throwExceptions,
boolean withDetails,
boolean withStackTrace,
boolean warnWhenGuessing,
int maxErrors,
String basePath)
out - Missing description of ParameterthrowExceptions - Missing description of ParameterwithDetails - Missing description of ParameterwithStackTrace - Missing description of ParameterwarnWhenGuessing - Missing description of ParametermaxErrors - Missing description of ParameterbasePath - The path from which one can compute relative paths| Method Detail |
|---|
public static final void printErrorDetails(NoSuchIDException exception,
PrintStream out)
exception - Missing description of Parameterout - Missing description of Parameterpublic void setAccumulator(List accumulator)
makeAsRecord(org.activemath.omdocjdom.MBaseBuildException).
accumulator - a list where errors will be List.add(E)ed may be null
in which case accumulating is disabled.public void resetErrorNumber()
public final void reportError(MBaseBuildException exception)
throws NoSuchIDException
exception - Missing description of Parameter
NoSuchIDException - Missing description of Exceptionpublic Hashtable makeAsRecord(MBaseBuildException exception)
Hashtable of the given exception including the keys:
message: the exception messageexceptionClass: the exception classsystemId: the path to the filelineNumber the line-number in the filecolumnNumber the column-number in the file
public void reportError(String message)
public final void warnForGuess(String message,
Object faulty1,
Object faulty2,
Object faulty3,
Object faulty4)
warnWhenGuessing is turned
on. The idea of passing these four objects instead of a one string is to avoid the conversion
to String of the parameters if the warnWhenGuessing is off. Don't use it as: warnForGuess("This variable " + varA + " is stupid, value " + value, null, null, null, null)
message - Missing description of Parameterfaulty1 - Missing description of Parameterfaulty2 - Missing description of Parameterfaulty3 - Missing description of Parameterfaulty4 - Missing description of Parameter
public final void warnForGuess(String message,
Object faulty1,
Object faulty2,
Object faulty3,
Object faulty4,
Object faulty5)
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||