Package org.beanio
Class BeanReaderException
- java.lang.Object
-
- java.lang.Throwable
-
- java.lang.Exception
-
- java.lang.RuntimeException
-
- org.beanio.BeanIOException
-
- org.beanio.BeanReaderException
-
- All Implemented Interfaces:
java.io.Serializable
- Direct Known Subclasses:
BeanReaderIOException
,InvalidRecordException
,MalformedRecordException
,UnexpectedRecordException
,UnidentifiedRecordException
public class BeanReaderException extends BeanIOException
Exception thrown by aBeanReader
orUnmarshaller
.In most cases, a subclass of this exception is thrown. In a few (but rare) fatal cases, this exception may be thrown directly.
- Since:
- 1.0
- See Also:
BeanReader
, Serialized Form
-
-
Constructor Summary
Constructors Constructor Description BeanReaderException(java.lang.String message)
Constructs a newBeanReaderException
.BeanReaderException(java.lang.String message, java.lang.Throwable cause)
Constructs a newBeanReaderException
.
-
Method Summary
All Methods Instance Methods Concrete Methods Deprecated Methods Modifier and Type Method Description RecordContext
getContext()
Deprecated.RecordContext
getRecordContext()
Returns the record context that caused the error.RecordContext
getRecordContext(int index)
Returns the record context for a given record index.int
getRecordCount()
Returns the number of unmarshalled records with context information available ifgetRecordContext(int)
is called.protected void
setRecordContext(RecordContext recordContext)
Sets the record context that caused the exception.protected void
setRecordContext(RecordContext[] recordContext)
Sets the record context(s) that caused the exception.
-
-
-
Constructor Detail
-
BeanReaderException
public BeanReaderException(java.lang.String message)
Constructs a newBeanReaderException
.- Parameters:
message
- the error message
-
BeanReaderException
public BeanReaderException(java.lang.String message, java.lang.Throwable cause)
Constructs a newBeanReaderException
.- Parameters:
message
- the error messagecause
- the root cause
-
-
Method Detail
-
getRecordCount
public int getRecordCount()
Returns the number of unmarshalled records with context information available ifgetRecordContext(int)
is called.- Returns:
- the unmarshalled record count
-
getContext
@Deprecated public RecordContext getContext()
Deprecated.Returns the record context that caused the error. May be null if there is no context information associated with the exception. If there is more than one record context, this method returns the context of the first record and is equivalent to calling getRecordContext(0).- Returns:
- the
RecordContext
- Since:
- 2.0
-
getRecordContext
public RecordContext getRecordContext()
Returns the record context that caused the error. May be null if there is no context information associated with the exception. If there is more than one record context, this method returns the context of the first record and is equivalent to calling getRecordContext(0).- Returns:
- the
RecordContext
- Since:
- 2.0
- See Also:
getRecordContext(int)
-
getRecordContext
public RecordContext getRecordContext(int index) throws java.lang.IndexOutOfBoundsException
Returns the record context for a given record index. The first record uses index 0.- Parameters:
index
- the record index- Returns:
- the
RecordContext
- Throws:
java.lang.IndexOutOfBoundsException
- if there is no record for the given index- Since:
- 2.0
- See Also:
getRecordCount()
-
setRecordContext
protected void setRecordContext(RecordContext recordContext)
Sets the record context that caused the exception. This method simply wraps the supplied context in an array and invokessetRecordContext(RecordContext[])
.- Parameters:
recordContext
- theRecordContext
- Since:
- 2.0
-
setRecordContext
protected void setRecordContext(RecordContext[] recordContext)
Sets the record context(s) that caused the exception.- Parameters:
recordContext
- the array ofRecordContext
- Since:
- 2.0
-
-