public class TextWritingException extends RuntimeException
It generally provides location and data information in case of a writing failure.
Modifier and Type | Field and Description |
---|---|
protected int |
errorContentLength |
Constructor and Description |
---|
TextWritingException(String message)
Creates a new exception with information about an error that occurred when writing data to some output.
|
TextWritingException(String message,
long line,
Object[] row)
Creates a new exception with information about an error that occurred when writing data to some output.
|
TextWritingException(String message,
long recordCount,
Object[] row,
Throwable cause)
Creates a new exception with information about an error that occurred when writing data to some output.
|
TextWritingException(String message,
long line,
String recordCharacters)
Creates a new exception with information about an error that occurred when writing data to some output.
|
TextWritingException(String message,
long recordCount,
String recordCharacters,
Throwable cause)
Creates a new exception with information about an error that occurred when writing data to some output.
|
TextWritingException(Throwable cause)
Creates a new exception with information about an error that occurred when writing data to some output.
|
Modifier and Type | Method and Description |
---|---|
protected String |
getDetails()
Subclasses must implement this method to return as much information as possible about the internal state of the parser/writer.
|
protected String |
getErrorDescription()
Returns a generic description of the error.
|
String |
getMessage()
Returns a detailed message describing the error, and the internal state of the parser/writer.
|
String |
getRecordCharacters()
Returns the character data that failed to be written
|
long |
getRecordCount()
Returns the number of records written before the exception occurred.
|
Object[] |
getRecordData()
Returns the data that failed to be written
|
protected static String |
printIfNotEmpty(String previous,
String description,
Object o) |
protected String |
restrictContent(CharSequence content) |
static String |
restrictContent(int errorContentLength,
CharSequence content) |
static Object[] |
restrictContent(int errorContentLength,
Object[] content) |
protected String |
restrictContent(Object content) |
protected Object[] |
restrictContent(Object[] content) |
void |
setErrorContentLength(int errorContentLength) |
protected String |
updateMessage(String msg)
Allows subclasses to alter the exception message that should be displayed to end users.
|
addSuppressed, fillInStackTrace, getCause, getLocalizedMessage, getStackTrace, getSuppressed, initCause, printStackTrace, printStackTrace, printStackTrace, setStackTrace, toString
public TextWritingException(String message, long recordCount, String recordCharacters, Throwable cause)
message
- message with details about the errorrecordCount
- the number of records written until the error occurredrecordCharacters
- the characters already written to the output record.cause
- the cause of the errorpublic TextWritingException(String message, long recordCount, Object[] row, Throwable cause)
message
- message with details about the errorrecordCount
- the number of records written until the error occurredrow
- the input row that was being written when the error occurredcause
- the cause of the errorpublic TextWritingException(String message)
message
- message with details about the errorpublic TextWritingException(Throwable cause)
cause
- the cause of the errorpublic TextWritingException(String message, long line, Object[] row)
message
- message with details about the errorline
- index of the line being written to the output when the error occurredrow
- the input row that was being written when the error occurredpublic TextWritingException(String message, long line, String recordCharacters)
message
- message with details about the errorline
- index of the line being written to the output when the error occurredrecordCharacters
- the characters already written to the output record.public long getRecordCount()
public Object[] getRecordData()
public String getRecordCharacters()
protected String getDetails()
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.protected String getErrorDescription()
getMessage()
to print out a general description of the error before a detailed message of the root cause.public final String getMessage()
getMessage
in class Throwable
protected String updateMessage(String msg)
msg
- the original messageprotected static String printIfNotEmpty(String previous, String description, Object o)
public static String restrictContent(int errorContentLength, CharSequence content)
public void setErrorContentLength(int errorContentLength)
protected String restrictContent(CharSequence content)
Copyright © 2019 Univocity Software Pty Ltd. All rights reserved.