ICU-13727 add U_INPUT_TOO_LONG_ERROR & ICUInputTooLongException
This commit is contained in:
parent
ffd450c637
commit
650bd402fe
@ -479,6 +479,14 @@ typedef enum UErrorCode {
|
||||
U_COLLATOR_VERSION_MISMATCH = 28, /**< Collator version is not compatible with the base version */
|
||||
U_USELESS_COLLATOR_ERROR = 29, /**< Collator is options only and no base is specified */
|
||||
U_NO_WRITE_PERMISSION = 30, /**< Attempt to modify read-only or constant data. */
|
||||
/**
|
||||
* The input is impractically long for an operation.
|
||||
* It is rejected because it may lead to problems such as excessive
|
||||
* processing time, stack depth, or heap memory requirements.
|
||||
*
|
||||
* @draft ICU 68
|
||||
*/
|
||||
U_INPUT_TOO_LONG_ERROR = 31,
|
||||
|
||||
#ifndef U_HIDE_DEPRECATED_API
|
||||
/**
|
||||
|
@ -104,7 +104,8 @@ _uErrorName[U_STANDARD_ERROR_LIMIT]={
|
||||
"U_INVALID_STATE_ERROR",
|
||||
"U_COLLATOR_VERSION_MISMATCH",
|
||||
"U_USELESS_COLLATOR_ERROR",
|
||||
"U_NO_WRITE_PERMISSION"
|
||||
"U_NO_WRITE_PERMISSION",
|
||||
"U_INPUT_TOO_LONG_ERROR"
|
||||
};
|
||||
static const char * const
|
||||
_uFmtErrorName[U_FMT_PARSE_ERROR_LIMIT - U_FMT_PARSE_ERROR_START] = {
|
||||
|
@ -0,0 +1,58 @@
|
||||
// © 2020 and later: Unicode, Inc. and others.
|
||||
// License & terms of use: http://www.unicode.org/copyright.html
|
||||
package com.ibm.icu.util;
|
||||
|
||||
/**
|
||||
* The input is impractically long for an operation.
|
||||
* It is rejected because it may lead to problems such as excessive
|
||||
* processing time, stack depth, or heap memory requirements.
|
||||
*
|
||||
* @draft ICU 68
|
||||
* @provisional This API might change or be removed in a future release.
|
||||
*/
|
||||
public class ICUInputTooLongException extends ICUException {
|
||||
private static final long serialVersionUID = -2602876786689338226L;
|
||||
|
||||
/**
|
||||
* Default constructor.
|
||||
*
|
||||
* @draft ICU 68
|
||||
* @provisional This API might change or be removed in a future release.
|
||||
*/
|
||||
public ICUInputTooLongException() {
|
||||
}
|
||||
|
||||
/**
|
||||
* Constructor.
|
||||
*
|
||||
* @param message exception message string
|
||||
* @draft ICU 68
|
||||
* @provisional This API might change or be removed in a future release.
|
||||
*/
|
||||
public ICUInputTooLongException(String message) {
|
||||
super(message);
|
||||
}
|
||||
|
||||
/**
|
||||
* Constructor.
|
||||
*
|
||||
* @param cause original exception
|
||||
* @draft ICU 68
|
||||
* @provisional This API might change or be removed in a future release.
|
||||
*/
|
||||
public ICUInputTooLongException(Throwable cause) {
|
||||
super(cause);
|
||||
}
|
||||
|
||||
/**
|
||||
* Constructor.
|
||||
*
|
||||
* @param message exception message string
|
||||
* @param cause original exception
|
||||
* @draft ICU 68
|
||||
* @provisional This API might change or be removed in a future release.
|
||||
*/
|
||||
public ICUInputTooLongException(String message, Throwable cause) {
|
||||
super(message, cause);
|
||||
}
|
||||
}
|
@ -47,6 +47,7 @@ import com.ibm.icu.util.DateTimeRule;
|
||||
import com.ibm.icu.util.GregorianCalendar;
|
||||
import com.ibm.icu.util.ICUCloneNotSupportedException;
|
||||
import com.ibm.icu.util.ICUException;
|
||||
import com.ibm.icu.util.ICUInputTooLongException;
|
||||
import com.ibm.icu.util.ICUUncheckedIOException;
|
||||
import com.ibm.icu.util.InitialTimeZoneRule;
|
||||
import com.ibm.icu.util.RuleBasedTimeZone;
|
||||
@ -749,6 +750,18 @@ public class SerializableTestUtility {
|
||||
}
|
||||
}
|
||||
|
||||
private static class ICUInputTooLongExceptionHandler extends ExceptionHandlerBase {
|
||||
@Override
|
||||
public Object[] getTestObjects() {
|
||||
return new ICUInputTooLongException[] {
|
||||
new ICUInputTooLongException(),
|
||||
new ICUInputTooLongException("msg1"),
|
||||
new ICUInputTooLongException(new RuntimeException("rte1")),
|
||||
new ICUInputTooLongException("msg2", new RuntimeException("rte2"))
|
||||
};
|
||||
}
|
||||
}
|
||||
|
||||
private static HashMap map = new HashMap();
|
||||
|
||||
static {
|
||||
@ -843,6 +856,7 @@ public class SerializableTestUtility {
|
||||
map.put("com.ibm.icu.util.ICUException", new ICUExceptionHandler());
|
||||
map.put("com.ibm.icu.util.ICUUncheckedIOException", new ICUUncheckedIOExceptionHandler());
|
||||
map.put("com.ibm.icu.util.ICUCloneNotSupportedException", new ICUCloneNotSupportedExceptionHandler());
|
||||
map.put("com.ibm.icu.util.ICUInputTooLongException", new ICUInputTooLongExceptionHandler());
|
||||
}
|
||||
|
||||
/*
|
||||
|
Loading…
Reference in New Issue
Block a user