FileDocCategorySizeDatePackage
ErrorCode.javaAPI DocAndroid 1.5 API6539Wed May 06 22:41:04 BST 2009com.ibm.icu4jni.common

ErrorCode

public final class ErrorCode extends Exception
Error exception class mapping ICU error codes of the enum UErrorCode
author
syn wee quek
internal

Fields Summary
public static final int
U_ERROR_INFO_START
Start of information results (semantically successful)
public static final int
U_USING_FALLBACK_ERROR
A resource bundle lookup returned a fallback result (not an error)
public static final int
U_USING_DEFAULT_ERROR
A resource bundle lookup returned a result from the root locale (not an error)
public static final int
U_SAFECLONE_ALLOCATED_ERROR
A SafeClone operation required allocating memory (informational only
public static final int
U_ERROR_INFO_LIMIT
This must always be the last warning value to indicate the limit for UErrorCode warnings (last warning code +1)
public static final int
U_ZERO_ERROR
No error, no warning
public static final int
U_ILLEGAL_ARGUMENT_ERROR
Start of codes indicating failure
public static final int
U_MISSING_RESOURCE_ERROR
public static final int
U_INVALID_FORMAT_ERROR
public static final int
U_FILE_ACCESS_ERROR
public static final int
U_INTERNAL_PROGRAM_ERROR
Indicates a bug in the library code
public static final int
U_MESSAGE_PARSE_ERROR
public static final int
U_MEMORY_ALLOCATION_ERROR
Memory allocation error
public static final int
U_INDEX_OUTOFBOUNDS_ERROR
public static final int
U_PARSE_ERROR
Equivalent to Java ParseException
public static final int
U_INVALID_CHAR_FOUND
In the Character conversion routines: Invalid character or sequence was encountered
public static final int
U_TRUNCATED_CHAR_FOUND
In the Character conversion routines: More bytes are required to complete the conversion successfully
public static final int
U_ILLEGAL_CHAR_FOUND
In codeset conversion: a sequence that does NOT belong in the codepage has been encountered
public static final int
U_INVALID_TABLE_FORMAT
Conversion table file found, but corrupted
public static final int
U_INVALID_TABLE_FILE
Conversion table file not found
public static final int
U_BUFFER_OVERFLOW_ERROR
A result would not fit in the supplied buffer
public static final int
U_UNSUPPORTED_ERROR
Requested operation not supported in current context
public static final int
U_RESOURCE_TYPE_MISMATCH
an operation is requested over a resource that does not support it
public static final int
U_ILLEGAL_ESCAPE_SEQUENCE
ISO-2022 illlegal escape sequence
public static final int
U_UNSUPPORTED_ESCAPE_SEQUENCE
ISO-2022 unsupported escape sequence
public static final int
U_NO_SPACE_AVAILABLE
No space available for in-buffer expansion for Arabic shaping
public static final int
U_ERROR_LIMIT
This must always be the last value to indicate the limit for UErrorCode (last error code +1)
public static boolean
LIBRARY_LOADED
Load library flag
private static final String[]
ERROR_NAMES_
Array of error code names corresponding to the errorcodes. ie ERROR_NAMES_[0] = name of U_ZERO_ERROR
Constructors Summary
Methods Summary
public static java.lang.StringgetErrorName(int ec)
Returns the error name of the input error code

param
ec int value of the error code
return
String name of the error code
stable
ICU 2.4

                                
      
    return ERROR_NAMES_[ec];
  
public static final java.lang.RuntimeExceptiongetException(int error)
Generic mapping from the error codes to java default exceptions.

param
error error code
return
java default exception that maps to the argument error code, otherwise if error is not a valid error code, null is returned.
stable
ICU 2.4

    if (error <= U_ZERO_ERROR && error >= U_ERROR_LIMIT) {
      return null;
    }
    String errorname = ERROR_NAMES_[U_ILLEGAL_ARGUMENT_ERROR];
    switch (error) {
      case U_ILLEGAL_ARGUMENT_ERROR :
        return new IllegalArgumentException(errorname);
      case U_INDEX_OUTOFBOUNDS_ERROR :
        return new ArrayIndexOutOfBoundsException(errorname);
      case U_BUFFER_OVERFLOW_ERROR :
        return new ArrayIndexOutOfBoundsException(errorname);
      case U_UNSUPPORTED_ERROR :
        return new UnsupportedOperationException(errorname);
      default :
        return new RuntimeException(errorname);
    }
  
public static booleanisFailure(int ec)
Returns true if the input error code denotes failure

param
ec int value of the error code
return
boolean
stable
ICU 2.4

    return (ec>U_ZERO_ERROR);
  
public static booleanisSuccess(int ec)
Returns true if the input error code denotes success

param
ec int value of the error code
return
boolean
stable
ICU 2.4

    return (ec<=U_ZERO_ERROR);