Package com.opencsv.exceptions
Class CsvChainedException
java.lang.Object
java.lang.Throwable
java.lang.Exception
com.opencsv.exceptions.CsvException
com.opencsv.exceptions.CsvChainedException
- All Implemented Interfaces:
Serializable
An exception class for collecting multiple exceptions.
For internal use only.
- Since:
- 5.3
- See Also:
-
Field Summary
Fields -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoid
Add an exception to the chain of collections.Convenience method to return the first exception from the exception chain.boolean
Convenience method that checks if the chain only has a single exception.void
Sets the line for all exceptions collected.void
setLineNumber
(long lineNumber) Sets the line number for all exceptions collected.Methods inherited from class com.opencsv.exceptions.CsvException
getLine, getLineNumber
Methods inherited from class java.lang.Throwable
addSuppressed, fillInStackTrace, getCause, getLocalizedMessage, getMessage, getStackTrace, getSuppressed, initCause, printStackTrace, printStackTrace, printStackTrace, setStackTrace, toString
-
Field Details
-
exceptionChain
-
-
Constructor Details
-
CsvChainedException
Constructor.- Parameters:
csve
- The first exception for the list being collected. Must not benull
.
-
-
Method Details
-
add
Add an exception to the chain of collections.- Parameters:
csve
- Exception to be added to this chain. Must not benull
.
-
getExceptionChain
- Returns:
- A list of all exceptions collected
-
setLine
Sets the line for all exceptions collected.- Overrides:
setLine
in classCsvException
- Parameters:
line
- The line that caused the error on reading. May benull
.
-
setLineNumber
public void setLineNumber(long lineNumber) Sets the line number for all exceptions collected.- Overrides:
setLineNumber
in classCsvException
- Parameters:
lineNumber
- The line number that caused the error. This should be the one-based number of the line that caused the error, not including the header line, if present.
-
hasOnlyOneException
public boolean hasOnlyOneException()Convenience method that checks if the chain only has a single exception.- Returns:
true
if chain has only a single exception,false
otherwise
-
getFirstException
Convenience method to return the first exception from the exception chain.- Returns:
CsvFieldAssignmentException
at the first position in the list,null
otherwise.
-