public class ErrorHandler extends Object
| Modifier and Type | Class and Description |
|---|---|
class |
ErrorHandler.Error |
| Modifier and Type | Field and Description |
|---|---|
static int |
ERROR_TYPO
ERROR_TYPO indicates that an even less severe problem was found with the record, such as the record leader ends
with characters other than "4500" or a field tag contains non-numeric characters the record contains a html-style
entity reference such as & or "e; which was replaced with the unescaped version.
|
static int |
FATAL
FATAL is the most severe error, it is usually set in conjunction with throwing an exception, generally no record
is returned when a FATAL error occurs.
|
static int |
INFO
INFO is used to pass information about the record translation process.
|
static int |
MAJOR_ERROR
MAJOR_ERROR indicates that a serious problem existed with the record, such as a malformed directory or an invalid
subfield tag, or an encoding error where missing data had to be inferred through some heuristic process.
|
static int |
MINOR_ERROR
MINOR_ERROR indicates that a less serious problem existed with the record, such as a mismatch between the
directory stated field sizes and the actual field sizes, or an encoding error where extraneous data had to be
discarded to correctly interpret the data.
|
| Constructor and Description |
|---|
ErrorHandler()
Constructs an error handler.
|
| Modifier and Type | Method and Description |
|---|---|
void |
addError(int severity,
String message)
Logs an error message using the stated severity level.
|
void |
addError(String id,
String field,
String subfield,
int severity,
String message)
Logs an error message using the stated severity level.
|
void |
addErrors(List newErrors)
Copys a List of errors into the current error handler
|
List |
getErrors()
Returns a list of all of the errors encountered in processing the current record.
|
int |
getMaxSeverity()
Returns the highest error severity level encountered in processing the current record.
|
boolean |
hasErrors()
Returns true if any errors (or warnings) were encountered in processing the current record.
|
void |
reset()
Resets the list of errors to empty.
|
void |
setCurrentField(String curField)
Sets the field tag to be stored for subsequent error messages that are logged
|
void |
setCurrentSubfield(String curSubfield)
Sets the subfield tag to be stored for subsequent error messages that are logged
|
void |
setRecordID(String recordID)
Sets the record ID to be stored for subsequent error messages that are logged If any previous messages are stored
for the current record that don't have a stored record ID, set the value for those entries to this value also.
|
public static final int FATAL
public static final int MAJOR_ERROR
public static final int MINOR_ERROR
public static final int ERROR_TYPO
public static final int INFO
public boolean hasErrors()
public int getMaxSeverity()
public List getErrors()
public void reset()
public void addError(String id, String field, String subfield, int severity, String message)
id - - the record ID of the record currently being processedfield - - the tag of the field currently being processedsubfield - - the subfield tag of the subfield currently being processedseverity - - An indication of the relative severity of the error that was encountered.message - - A descriptive message about the error that was encountered.public void addError(int severity,
String message)
severity - - An indication of the relative severity of the error that was encountered.message - - A descriptive message about the error that was encountered.public void addErrors(List newErrors)
newErrors - - A list of Errors.public void setRecordID(String recordID)
recordID - - the record ID of the record currently being processedpublic void setCurrentField(String curField)
curField - - the tag of the field currently being processedpublic void setCurrentSubfield(String curSubfield)
curSubfield - - the subfield tag of the subfield currently being processedCopyright © 2014 FreeLibrary. All Rights Reserved.