IllegalFormatConversionException

  • IllegalFormatConversionException is an unchecked exception indicating an argument type mismatch with a format specifier.

  • It's thrown when the argument's data type is incompatible with the expected type for the format specifier in a string formatting operation.

  • This exception provides methods to retrieve the incorrect conversion character, the argument's class, and a detailed message.

  • Passing a null argument to IllegalFormatConversionException methods or constructor results in a NullPointerException.

public class IllegalFormatConversionException extends IllegalFormatException

Unchecked exception thrown when the argument corresponding to the format specifier is of an incompatible type.

Unless otherwise specified, passing a null argument to any method or constructor in this class will cause a NullPointerException to be thrown.

Public Constructor Summary

IllegalFormatConversionException(char c, Class<?> arg)
Constructs an instance of this class with the mismatched conversion and the corresponding argument class.

Public Method Summary

Class<?>
getArgumentClass()
Returns the class of the mismatched argument.
char
getConversion()
Returns the inapplicable conversion.
String
getMessage()
Returns the detail message string of this throwable.

Inherited Method Summary

Public Constructors

public IllegalFormatConversionException (char c, Class<?> arg)

Constructs an instance of this class with the mismatched conversion and the corresponding argument class.

Parameters
c Inapplicable conversion
arg Class of the mismatched argument

Public Methods

public Class<?> getArgumentClass ()

Returns the class of the mismatched argument.

Returns
  • The class of the mismatched argument

public char getConversion ()

Returns the inapplicable conversion.

Returns
  • The inapplicable conversion

public String getMessage ()

Returns the detail message string of this throwable.

Returns
  • the detail message string of this Throwable instance (which may be null).