com.ricebridge.csvman
Class CsvManagerException
java.lang.Object
java.lang.Throwable
java.lang.Exception
java.lang.RuntimeException
org.jostraca.util.StandardException
com.ricebridge.csvman.CsvManagerBaseException
com.ricebridge.csvman.CsvManagerException
- All Implemented Interfaces:
- Serializable
- public class CsvManagerException
- extends CsvManagerBaseException
CSV Manager has a single Exception type for indicating errors.
CsvManagerException is a RuntimeException. This choice is deliberate as
it makes the API more user-friendly (less to think about) and more maintainable (easier to extend).
In addition, if you wish to catch CsvManagerExceptions at source instead of higher up
the call stack, you can still do so:
try {
List data = csvManager.load( "mydata.csv");
}
catch( CsvManagerException ce ) {
System.out.println( ce );
}
CsvManagerExceptions produce human readable error messages if you call getUserMessage()
or toString(). Calls to Throwable.getMessage() will return a more technical description of the error.
Loading and saving of CSV data can made more fault tolerant. By default, a CsvManagerException is thrown
as soon as an error occurs and processing halts. If you want to continue loading or saving data lines, set
CsvManager.setIgnoreBadLines(boolean) to true. In this case, errors are stored until the operation is complete
and can be retrieved with CsvManager.getBadLines().
CsvManagerExceptions have error codes to allow automated handling. The full list is given in
MsgCode. The human readable text for each message is given here:
message.properties.
Here is an example of using the error codes:
...
catch( CsvManagerException ce ) {
if( CsvManagerException.CODE_bad_line == ce.getCode() ) {
System.out.println( "BAD LINE: "+ce );
} else { throw ce; }
}
If you implement your own LineListener you may need to throw Exceptions when errors occur.
To do this you should use the code CODE_general like so:
...
catch( Exception e ) {
throw new CsvManagerException( CsvManagerException.CODE_general, "message", e );
}
You can access the contained Exception using getContained()
Note that when CSV Manager reports a problem in a custom LineListener or LineProvider that was caused by an
Exception inside the custom object, then you can also get hold of this exception using the getContained method.
This is useful if you want to get a stack trace of this contained Exception.
The Ricebridge CSV Manager component makes use of code from the open source template engine
Jostraca.
For further documentation concerning the super classes of CsvManagerException,
see StandardException.
Note: you cannot use the .CODE_* shortcuts with CsvManagerException as they return only
CsvManagerBaseExceptions.
- See Also:
- Serialized Form
| Fields inherited from class com.ricebridge.csvman.CsvManagerBaseException |
CODE_bad_dfmaxlen, CODE_bad_encoding, CODE_bad_end_line, CODE_bad_file, CODE_bad_line, CODE_bad_num_lines, CODE_bad_sink, CODE_bad_source, CODE_bad_start_line, CODE_cce_list_line, CODE_close_reader, CODE_close_writer, CODE_csvrs_new, CODE_csvtm_new, CODE_dfmaxlen, CODE_empty_char_string, CODE_emptyfieldname, CODE_escape_is_quote, CODE_escape_is_sep, CODE_escmap_key_not_char, CODE_escmap_value_not_char, CODE_field_endload, CODE_fieldlistener_exception, CODE_file_cant_read, CODE_file_cant_write, CODE_file_not_exist, CODE_file_not_found, CODE_general, CODE_getbadlines_notlist, CODE_getbeanfield, CODE_getbeanfield_msg, CODE_geterrmsgs_notlist, CODE_internal_exception, CODE_line_endload, CODE_line_errmsgs, CODE_linelistener_exception, CODE_lineprovider_exception, CODE_lineprovider_set, CODE_new_ll, CODE_new_lp, CODE_newbean, CODE_no_input_source, CODE_no_output_sink, CODE_nofieldnames, CODE_null_line, CODE_null_list_line, CODE_parse_error, CODE_parse_warning, CODE_quote_is_escape, CODE_quote_is_sep, CODE_rejected_line, CODE_resultset_getmetadata, CODE_resultset_getobject, CODE_resultset_next, CODE_rsmd_getcolcount, CODE_rsmd_getcolname, CODE_save_failed, CODE_setbeanfield, CODE_setbeanfield_msg, CODE_system, CODE_unknown_column |
|
Constructor Summary |
CsvManagerException(CsvManagerBaseException.Code pCode)
|
CsvManagerException(CsvManagerBaseException.Code pCode,
BadLine pBadLine)
|
CsvManagerException(CsvManagerBaseException.Code pCode,
BadLine pBadLine,
Throwable pContained)
|
CsvManagerException(CsvManagerBaseException.Code pCode,
Object pContext)
|
CsvManagerException(CsvManagerBaseException.Code pCode,
String pText)
|
CsvManagerException(CsvManagerBaseException.Code pCode,
String[] pContext)
|
CsvManagerException(CsvManagerBaseException.Code pCode,
String[] pContext,
Throwable pContained)
|
CsvManagerException(CsvManagerBaseException.Code pCode,
String pText,
Throwable pContained)
|
CsvManagerException(CsvManagerBaseException.Code pCode,
Throwable pContained)
|
CsvManagerException(Throwable pContained)
|
| Methods inherited from class com.ricebridge.csvman.CsvManagerBaseException |
CODE_bad_dfmaxlen, CODE_bad_dfmaxlen, CODE_bad_dfmaxlen, CODE_bad_dfmaxlen, CODE_bad_dfmaxlen, CODE_bad_dfmaxlen, CODE_bad_encoding, CODE_bad_encoding, CODE_bad_encoding, CODE_bad_encoding, CODE_bad_encoding, CODE_bad_encoding, CODE_bad_end_line, CODE_bad_end_line, CODE_bad_end_line, CODE_bad_end_line, CODE_bad_end_line, CODE_bad_end_line, CODE_bad_file, CODE_bad_file, CODE_bad_file, CODE_bad_file, CODE_bad_file, CODE_bad_file, CODE_bad_line, CODE_bad_line, CODE_bad_line, CODE_bad_line, CODE_bad_line, CODE_bad_line, CODE_bad_num_lines, CODE_bad_num_lines, CODE_bad_num_lines, CODE_bad_num_lines, CODE_bad_num_lines, CODE_bad_num_lines, CODE_bad_sink, CODE_bad_sink, CODE_bad_sink, CODE_bad_sink, CODE_bad_sink, CODE_bad_sink, CODE_bad_source, CODE_bad_source, CODE_bad_source, CODE_bad_source, CODE_bad_source, CODE_bad_source, CODE_bad_start_line, CODE_bad_start_line, CODE_bad_start_line, CODE_bad_start_line, CODE_bad_start_line, CODE_bad_start_line, CODE_cce_list_line, CODE_cce_list_line, CODE_cce_list_line, CODE_cce_list_line, CODE_cce_list_line, CODE_cce_list_line, CODE_close_reader, CODE_close_reader, CODE_close_reader, CODE_close_reader, CODE_close_reader, CODE_close_reader, CODE_close_writer, CODE_close_writer, CODE_close_writer, CODE_close_writer, CODE_close_writer, CODE_close_writer, CODE_csvrs_new, CODE_csvrs_new, CODE_csvrs_new, CODE_csvrs_new, CODE_csvrs_new, CODE_csvrs_new, CODE_csvtm_new, CODE_csvtm_new, CODE_csvtm_new, CODE_csvtm_new, CODE_csvtm_new, CODE_csvtm_new, CODE_dfmaxlen, CODE_dfmaxlen, CODE_dfmaxlen, CODE_dfmaxlen, CODE_dfmaxlen, CODE_dfmaxlen, CODE_empty_char_string, CODE_empty_char_string, CODE_empty_char_string, CODE_empty_char_string, CODE_empty_char_string, CODE_empty_char_string, CODE_emptyfieldname, CODE_emptyfieldname, CODE_emptyfieldname, CODE_emptyfieldname, CODE_emptyfieldname, CODE_emptyfieldname, CODE_escape_is_quote, CODE_escape_is_quote, CODE_escape_is_quote, CODE_escape_is_quote, CODE_escape_is_quote, CODE_escape_is_quote, CODE_escape_is_sep, CODE_escape_is_sep, CODE_escape_is_sep, CODE_escape_is_sep, CODE_escape_is_sep, CODE_escape_is_sep, CODE_escmap_key_not_char, CODE_escmap_key_not_char, CODE_escmap_key_not_char, CODE_escmap_key_not_char, CODE_escmap_key_not_char, CODE_escmap_key_not_char, CODE_escmap_value_not_char, CODE_escmap_value_not_char, CODE_escmap_value_not_char, CODE_escmap_value_not_char, CODE_escmap_value_not_char, CODE_escmap_value_not_char, CODE_field_endload, CODE_field_endload, CODE_field_endload, CODE_field_endload, CODE_field_endload, CODE_field_endload, CODE_fieldlistener_exception, CODE_fieldlistener_exception, CODE_fieldlistener_exception, CODE_fieldlistener_exception, CODE_fieldlistener_exception, CODE_fieldlistener_exception, CODE_file_cant_read, CODE_file_cant_read, CODE_file_cant_read, CODE_file_cant_read, CODE_file_cant_read, CODE_file_cant_read, CODE_file_cant_write, CODE_file_cant_write, CODE_file_cant_write, CODE_file_cant_write, CODE_file_cant_write, CODE_file_cant_write, CODE_file_not_exist, CODE_file_not_exist, CODE_file_not_exist, CODE_file_not_exist, CODE_file_not_exist, CODE_file_not_exist, CODE_file_not_found, CODE_file_not_found, CODE_file_not_found, CODE_file_not_found, CODE_file_not_found, CODE_file_not_found, CODE_general, CODE_general, CODE_general, CODE_general, CODE_general, CODE_general, CODE_getbadlines_notlist, CODE_getbadlines_notlist, CODE_getbadlines_notlist, CODE_getbadlines_notlist, CODE_getbadlines_notlist, CODE_getbadlines_notlist, CODE_getbeanfield_msg, CODE_getbeanfield_msg, CODE_getbeanfield_msg, CODE_getbeanfield_msg, CODE_getbeanfield_msg, CODE_getbeanfield_msg, CODE_getbeanfield, CODE_getbeanfield, CODE_getbeanfield, CODE_getbeanfield, CODE_getbeanfield, CODE_getbeanfield, CODE_geterrmsgs_notlist, CODE_geterrmsgs_notlist, CODE_geterrmsgs_notlist, CODE_geterrmsgs_notlist, CODE_geterrmsgs_notlist, CODE_geterrmsgs_notlist, CODE_internal_exception, CODE_internal_exception, CODE_internal_exception, CODE_internal_exception, CODE_internal_exception, CODE_internal_exception, CODE_line_endload, CODE_line_endload, CODE_line_endload, CODE_line_endload, CODE_line_endload, CODE_line_endload, CODE_line_errmsgs, CODE_line_errmsgs, CODE_line_errmsgs, CODE_line_errmsgs, CODE_line_errmsgs, CODE_line_errmsgs, CODE_linelistener_exception, CODE_linelistener_exception, CODE_linelistener_exception, CODE_linelistener_exception, CODE_linelistener_exception, CODE_linelistener_exception, CODE_lineprovider_exception, CODE_lineprovider_exception, CODE_lineprovider_exception, CODE_lineprovider_exception, CODE_lineprovider_exception, CODE_lineprovider_exception, CODE_lineprovider_set, CODE_lineprovider_set, CODE_lineprovider_set, CODE_lineprovider_set, CODE_lineprovider_set, CODE_lineprovider_set, CODE_new_ll, CODE_new_ll, CODE_new_ll, CODE_new_ll, CODE_new_ll, CODE_new_ll, CODE_new_lp, CODE_new_lp, CODE_new_lp, CODE_new_lp, CODE_new_lp, CODE_new_lp, CODE_newbean, CODE_newbean, CODE_newbean, CODE_newbean, CODE_newbean, CODE_newbean, CODE_no_input_source, CODE_no_input_source, CODE_no_input_source, CODE_no_input_source, CODE_no_input_source, CODE_no_input_source, CODE_no_output_sink, CODE_no_output_sink, CODE_no_output_sink, CODE_no_output_sink, CODE_no_output_sink, CODE_no_output_sink, CODE_nofieldnames, CODE_nofieldnames, CODE_nofieldnames, CODE_nofieldnames, CODE_nofieldnames, CODE_nofieldnames, CODE_null_line, CODE_null_line, CODE_null_line, CODE_null_line, CODE_null_line, CODE_null_line, CODE_null_list_line, CODE_null_list_line, CODE_null_list_line, CODE_null_list_line, CODE_null_list_line, CODE_null_list_line, CODE_parse_error, CODE_parse_error, CODE_parse_error, CODE_parse_error, CODE_parse_error, CODE_parse_error, CODE_parse_warning, CODE_parse_warning, CODE_parse_warning, CODE_parse_warning, CODE_parse_warning, CODE_parse_warning, CODE_quote_is_escape, CODE_quote_is_escape, CODE_quote_is_escape, CODE_quote_is_escape, CODE_quote_is_escape, CODE_quote_is_escape, CODE_quote_is_sep, CODE_quote_is_sep, CODE_quote_is_sep, CODE_quote_is_sep, CODE_quote_is_sep, CODE_quote_is_sep, CODE_rejected_line, CODE_rejected_line, CODE_rejected_line, CODE_rejected_line, CODE_rejected_line, CODE_rejected_line, CODE_resultset_getmetadata, CODE_resultset_getmetadata, CODE_resultset_getmetadata, CODE_resultset_getmetadata, CODE_resultset_getmetadata, CODE_resultset_getmetadata, CODE_resultset_getobject, CODE_resultset_getobject, CODE_resultset_getobject, CODE_resultset_getobject, CODE_resultset_getobject, CODE_resultset_getobject, CODE_resultset_next, CODE_resultset_next, CODE_resultset_next, CODE_resultset_next, CODE_resultset_next, CODE_resultset_next, CODE_rsmd_getcolcount, CODE_rsmd_getcolcount, CODE_rsmd_getcolcount, CODE_rsmd_getcolcount, CODE_rsmd_getcolcount, CODE_rsmd_getcolcount, CODE_rsmd_getcolname, CODE_rsmd_getcolname, CODE_rsmd_getcolname, CODE_rsmd_getcolname, CODE_rsmd_getcolname, CODE_rsmd_getcolname, CODE_save_failed, CODE_save_failed, CODE_save_failed, CODE_save_failed, CODE_save_failed, CODE_save_failed, CODE_setbeanfield_msg, CODE_setbeanfield_msg, CODE_setbeanfield_msg, CODE_setbeanfield_msg, CODE_setbeanfield_msg, CODE_setbeanfield_msg, CODE_setbeanfield, CODE_setbeanfield, CODE_setbeanfield, CODE_setbeanfield, CODE_setbeanfield, CODE_setbeanfield, CODE_system, CODE_system, CODE_system, CODE_system, CODE_system, CODE_system, CODE_unknown_column, CODE_unknown_column, CODE_unknown_column, CODE_unknown_column, CODE_unknown_column, CODE_unknown_column, getPackage |
| Methods inherited from class org.jostraca.util.StandardException |
formatContextValues, formatContextValues, formatContextValues, getCat, getCode, getContained, getContainedStandard, getContext, getContextValues, getContextValues, getKey, getOriginalMessage, hasContained, makeStackTrace |
CsvManagerException
public CsvManagerException(CsvManagerBaseException.Code pCode)
CsvManagerException
public CsvManagerException(CsvManagerBaseException.Code pCode,
BadLine pBadLine)
CsvManagerException
public CsvManagerException(CsvManagerBaseException.Code pCode,
Object pContext)
CsvManagerException
public CsvManagerException(CsvManagerBaseException.Code pCode,
String pText)
CsvManagerException
public CsvManagerException(CsvManagerBaseException.Code pCode,
String pText,
Throwable pContained)
CsvManagerException
public CsvManagerException(CsvManagerBaseException.Code pCode,
String[] pContext)
CsvManagerException
public CsvManagerException(CsvManagerBaseException.Code pCode,
Throwable pContained)
CsvManagerException
public CsvManagerException(CsvManagerBaseException.Code pCode,
String[] pContext,
Throwable pContained)
CsvManagerException
public CsvManagerException(CsvManagerBaseException.Code pCode,
BadLine pBadLine,
Throwable pContained)
CsvManagerException
public CsvManagerException(Throwable pContained)
hasBadLine
public boolean hasBadLine()
getBadLine
public BadLine getBadLine()
- may return empty BadLine if none set
toString
public String toString()
getUserMessage
public String getUserMessage()
setBadLine
protected void setBadLine(BadLine pBadLine)
handleBadLine
protected static PropertySet handleBadLine(BadLine pBadLine)
handleBadLine
protected static void handleBadLine(BadLine pBadLine,
PropertySet pPropertySet)
Copyright © 2003-2006 Ricebridge