Package org.apache.commons.lang
Class NotImplementedException
- java.lang.Object
-
- java.lang.Throwable
-
- java.lang.Exception
-
- java.lang.RuntimeException
-
- java.lang.UnsupportedOperationException
-
- org.apache.commons.lang.NotImplementedException
-
- All Implemented Interfaces:
java.io.Serializable
,Nestable
@Deprecated(since="2021-04-30") public class NotImplementedException extends java.lang.UnsupportedOperationException implements Nestable
Deprecated.Commons Lang 2 is in maintenance mode. Commons Lang 3 should be used instead.Thrown to indicate that a block of code has not been implemented. This exception supplements
UnsupportedOperationException
by providing a more semantically rich description of the problem.NotImplementedException
represents the case where the author has yet to implement the logic at this point in the program. This can act as an exception based TODO tag. Because this logic might be within a catch block, this exception suports exception chaining.public void foo() { try { // do something that throws an Exception } catch (Exception ex) { // don't know what to do here yet throw new NotImplementedException("TODO", ex); } }
- Since:
- 2.0
- See Also:
- Serialized Form
-
-
Constructor Summary
Constructors Constructor Description NotImplementedException()
Deprecated.Constructs a newNotImplementedException
with default message.NotImplementedException(java.lang.Class clazz)
Deprecated.Constructs a newNotImplementedException
referencing the specified class.NotImplementedException(java.lang.String msg)
Deprecated.Constructs a newNotImplementedException
with specified detail message.NotImplementedException(java.lang.String msg, java.lang.Throwable cause)
Deprecated.Constructs a newNotImplementedException
with specified detail message and nestedThrowable
.NotImplementedException(java.lang.Throwable cause)
Deprecated.Constructs a newNotImplementedException
with specified nestedThrowable
and default message.
-
Method Summary
All Methods Instance Methods Concrete Methods Deprecated Methods Modifier and Type Method Description java.lang.Throwable
getCause()
Deprecated.Gets the root cause of this exception.java.lang.String
getMessage()
Deprecated.Gets the combined the error message of this and any nested errors.java.lang.String
getMessage(int index)
Deprecated.Returns the error message of theThrowable
in the chain ofThrowable
s at the specified index, numbered from 0.java.lang.String[]
getMessages()
Deprecated.Returns the error message of this and any nestedThrowable
objects.java.lang.Throwable
getThrowable(int index)
Deprecated.Returns theThrowable
in the chain by index.int
getThrowableCount()
Deprecated.Returns the number of nestedThrowable
s represented by thisNestable
, including thisNestable
.java.lang.Throwable[]
getThrowables()
Deprecated.Returns thisNestable
and any nestedThrowable
s in an array ofThrowable
s, one element for eachThrowable
.int
indexOfThrowable(java.lang.Class type)
Deprecated.Returns the index of the first occurrence of the specified type.int
indexOfThrowable(java.lang.Class type, int fromIndex)
Deprecated.Returns the index of the first occurrence of the specified type starting from the specified index.void
printPartialStackTrace(java.io.PrintWriter out)
Deprecated.Prints the stack trace for this exception only (root cause not included) using the specified writer.void
printStackTrace()
Deprecated.Prints the stack trace of this exception.void
printStackTrace(java.io.PrintStream out)
Deprecated.Prints the stack trace of this exception to the specified stream.void
printStackTrace(java.io.PrintWriter out)
Deprecated.Prints the stack trace of this exception to the specified writer.
-
-
-
Constructor Detail
-
NotImplementedException
public NotImplementedException()
Deprecated.Constructs a newNotImplementedException
with default message.- Since:
- 2.1
-
NotImplementedException
public NotImplementedException(java.lang.String msg)
Deprecated.Constructs a newNotImplementedException
with specified detail message.- Parameters:
msg
- the error message.
-
NotImplementedException
public NotImplementedException(java.lang.Throwable cause)
Deprecated.Constructs a newNotImplementedException
with specified nestedThrowable
and default message.- Parameters:
cause
- the exception that caused this exception to be thrown- Since:
- 2.1
-
NotImplementedException
public NotImplementedException(java.lang.String msg, java.lang.Throwable cause)
Deprecated.Constructs a newNotImplementedException
with specified detail message and nestedThrowable
.- Parameters:
msg
- the error messagecause
- the exception that caused this exception to be thrown- Since:
- 2.1
-
NotImplementedException
public NotImplementedException(java.lang.Class clazz)
Deprecated.Constructs a newNotImplementedException
referencing the specified class.- Parameters:
clazz
- theClass
that has not implemented the method
-
-
Method Detail
-
getCause
public java.lang.Throwable getCause()
Deprecated.Gets the root cause of this exception.
-
getMessage
public java.lang.String getMessage()
Deprecated.Gets the combined the error message of this and any nested errors.- Specified by:
getMessage
in interfaceNestable
- Overrides:
getMessage
in classjava.lang.Throwable
- Returns:
- the error message
- Since:
- 2.1
-
getMessage
public java.lang.String getMessage(int index)
Deprecated.Returns the error message of theThrowable
in the chain ofThrowable
s at the specified index, numbered from 0.- Specified by:
getMessage
in interfaceNestable
- Parameters:
index
- the index of theThrowable
in the chain- Returns:
- the error message, or null if the
Throwable
at the specified index in the chain does not contain a message - Throws:
java.lang.IndexOutOfBoundsException
- if theindex
argument is negative or not less than the count ofThrowable
s in the chain- Since:
- 2.1
-
getMessages
public java.lang.String[] getMessages()
Deprecated.Returns the error message of this and any nestedThrowable
objects. Each throwable returns a message, a null string is included in the array if there is no message for a particularThrowable
.- Specified by:
getMessages
in interfaceNestable
- Returns:
- the error messages
- Since:
- 2.1
-
getThrowable
public java.lang.Throwable getThrowable(int index)
Deprecated.Returns theThrowable
in the chain by index.- Specified by:
getThrowable
in interfaceNestable
- Parameters:
index
- the index to retrieve- Returns:
- the
Throwable
- Throws:
java.lang.IndexOutOfBoundsException
- if theindex
argument is negative or not less than the count ofThrowable
s in the chain- Since:
- 2.1
-
getThrowableCount
public int getThrowableCount()
Deprecated.Returns the number of nestedThrowable
s represented by thisNestable
, including thisNestable
.- Specified by:
getThrowableCount
in interfaceNestable
- Returns:
- the throwable count
- Since:
- 2.1
-
getThrowables
public java.lang.Throwable[] getThrowables()
Deprecated.Returns thisNestable
and any nestedThrowable
s in an array ofThrowable
s, one element for eachThrowable
.- Specified by:
getThrowables
in interfaceNestable
- Returns:
- the
Throwable
s - Since:
- 2.1
-
indexOfThrowable
public int indexOfThrowable(java.lang.Class type)
Deprecated.Returns the index of the first occurrence of the specified type. If there is no match,-1
is returned.- Specified by:
indexOfThrowable
in interfaceNestable
- Parameters:
type
- the type to search for- Returns:
- index of the first occurrence of the type in the chain, or -1 if the type is not found
- Since:
- 2.1
-
indexOfThrowable
public int indexOfThrowable(java.lang.Class type, int fromIndex)
Deprecated.Returns the index of the first occurrence of the specified type starting from the specified index. If there is no match,-1
is returned.- Specified by:
indexOfThrowable
in interfaceNestable
- Parameters:
type
- the type to search forfromIndex
- the index of the starting position in the chain to be searched- Returns:
- index of the first occurrence of the type in the chain, or -1 if the type is not found
- Throws:
java.lang.IndexOutOfBoundsException
- if thefromIndex
argument is negative or not less than the count ofThrowable
s in the chain- Since:
- 2.1
-
printStackTrace
public void printStackTrace()
Deprecated.Prints the stack trace of this exception. Includes information from the exception, if any, which caused this exception.- Overrides:
printStackTrace
in classjava.lang.Throwable
- Since:
- 2.1
-
printStackTrace
public void printStackTrace(java.io.PrintStream out)
Deprecated.Prints the stack trace of this exception to the specified stream. Includes information from the exception, if any, which caused this exception.- Specified by:
printStackTrace
in interfaceNestable
- Overrides:
printStackTrace
in classjava.lang.Throwable
- Parameters:
out
- the stream to write to- Since:
- 2.1
-
printStackTrace
public void printStackTrace(java.io.PrintWriter out)
Deprecated.Prints the stack trace of this exception to the specified writer. Includes information from the exception, if any, which caused this exception.- Specified by:
printStackTrace
in interfaceNestable
- Overrides:
printStackTrace
in classjava.lang.Throwable
- Parameters:
out
- the writer to write to- Since:
- 2.1
-
printPartialStackTrace
public final void printPartialStackTrace(java.io.PrintWriter out)
Deprecated.Prints the stack trace for this exception only (root cause not included) using the specified writer.- Specified by:
printPartialStackTrace
in interfaceNestable
- Parameters:
out
- the writer to write to- Since:
- 2.1
-
-