Top Description Fields Constructors Methods
com.univocity.parsers.common

pack-priv abstract Class AbstractException

extends RuntimeException
Class Inheritance
Known Direct Subclasses
com.univocity.parsers.common.TextParsingException, com.univocity.parsers.common.TextWritingException
Imports
java.util.*

Parent class of the Exception classes thrown by univocity-parsers. This class provides utility methods to print out the internal state of the parser/writer at the time an error occurred.
Author
Univocity Software Pty Ltd - [email protected]

Field Summary

Modifier and TypeField and Description
protected int
private static final long

Constructor Summary

AccessConstructor and Description
protected

Method Summary

Modifier and TypeMethod and Description
protected abstract String

Returns:

a String describing the internal state of the parser/writer.
getDetails
()

Subclasses must implement this method to return as much information as possible about the internal state of the parser/writer.

protected abstract String

Returns:

a generic description of the error.
getErrorDescription
()

Returns a generic description of the error.

public final String

Returns:

a detailed message describing the error
getMessage
()

Overrides java.lang.Throwable.getMessage.

Returns a detailed message describing the error, and the internal state of the parser/writer.
protected static String
printIfNotEmpty(String previous, String description, Object o)

public static String
restrictContent(int errorContentLength, CharSequence content)

public static Object[]
restrictContent(int errorContentLength, Object[] content)

protected String
protected String
protected Object[]
public void
setErrorContentLength(int errorContentLength)

protected String

Returns:

the updated message.
updateMessage
(String
the original message
msg
)

Allows subclasses to alter the exception message that should be displayed to end users.

Field Detail

errorContentLengthback to summary
protected int errorContentLength
serialVersionUIDback to summary
private static final long serialVersionUID

Hides java.lang.RuntimeException.serialVersionUID.

Constructor Detail

AbstractExceptionback to summary
protected AbstractException(String message, Throwable cause)

Method Detail

getDetailsback to summary
protected abstract String getDetails()

Subclasses must implement this method to return as much information as possible about the internal state of the parser/writer. Use printIfNotEmpty(String, String, Object) to create a comma-separated list of relevant properties and their (non null) values. The result of this method is used by the getMessage() method to print out these details after the error message.

Returns:String

a String describing the internal state of the parser/writer.

getErrorDescriptionback to summary
protected abstract String getErrorDescription()

Returns a generic description of the error. The result of this method is used by getMessage() to print out a general description of the error before a detailed message of the root cause.

Returns:String

a generic description of the error.

getMessageback to summary
public final String getMessage()

Overrides java.lang.Throwable.getMessage.

Returns a detailed message describing the error, and the internal state of the parser/writer.

Returns:String

a detailed message describing the error

Annotations
@Override
printIfNotEmptyback to summary
protected static String printIfNotEmpty(String previous, String description, Object o)
restrictContentback to summary
public static String restrictContent(int errorContentLength, CharSequence content)
restrictContentback to summary
public static Object[] restrictContent(int errorContentLength, Object[] content)
restrictContentback to summary
protected String restrictContent(CharSequence content)
restrictContentback to summary
protected String restrictContent(Object content)
restrictContentback to summary
protected Object[] restrictContent(Object[] content)
setErrorContentLengthback to summary
public void setErrorContentLength(int errorContentLength)
updateMessageback to summary
protected String updateMessage(String msg)

Allows subclasses to alter the exception message that should be displayed to end users. By default the original message is kept unchanged.

Parameters
msg:String

the original message

Returns:String

the updated message.