|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object org.marc4j.ErrorHandler
public class ErrorHandler
Defines and describes errors encountered in the processing a given MARC record. Used in conjunction with the MarcPermissiveReader class.
Nested Class Summary | |
---|---|
class |
ErrorHandler.Error
|
Field Summary | |
---|---|
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 Summary | |
---|---|
ErrorHandler()
|
Method Summary | |
---|---|
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. |
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. |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
---|
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
Constructor Detail |
---|
public ErrorHandler()
Method Detail |
---|
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 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 processed
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |