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 TypeMethodDescriptionvoidAdd an exception to the chain of collections.Convenience method to return the first exception from the exception chain.booleanConvenience method that checks if the chain only has a single exception.voidSets the line for all exceptions collected.voidsetLineNumber(long lineNumber) Sets the line number for all exceptions collected.Methods inherited from class com.opencsv.exceptions.CsvException
getLine, getLineNumberMethods 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:
setLinein 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:
setLineNumberin 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:
trueif chain has only a single exception,falseotherwise
-
getFirstException
Convenience method to return the first exception from the exception chain.- Returns:
CsvFieldAssignmentExceptionat the first position in the list,nullotherwise.
-