mirror of
https://github.com/apache/commons-lang.git
synced 2025-02-11 12:35:07 +00:00
Fixing classes to not need UnhandledException and IllegalArgumentException
git-svn-id: https://svn.apache.org/repos/asf/commons/proper/lang/trunk@796078 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
parent
5e58c2cfd8
commit
f957d81625
@ -21,8 +21,6 @@
|
||||
import java.io.StringWriter;
|
||||
import java.util.Locale;
|
||||
|
||||
import org.apache.commons.lang.UnhandledException;
|
||||
|
||||
/**
|
||||
* An API for translating text.
|
||||
* Its core use is to escape and unescape text. Because escaping and unescaping
|
||||
@ -60,7 +58,7 @@ public final String translate(CharSequence input) {
|
||||
return writer.toString();
|
||||
} catch (IOException ioe) {
|
||||
// this should never ever happen while writing to a StringWriter
|
||||
throw new UnhandledException(ioe);
|
||||
throw new RuntimeException(ioe);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -19,8 +19,6 @@
|
||||
import java.io.IOException;
|
||||
import java.io.Writer;
|
||||
|
||||
import org.apache.commons.lang.UnhandledException;
|
||||
|
||||
/**
|
||||
* Translates escaped unicode values of the form \\u+\d\d\d\d back to
|
||||
* unicode.
|
||||
@ -49,7 +47,7 @@ public int translate(CharSequence input, int index, Writer out) throws IOExcepti
|
||||
int value = Integer.parseInt(unicode.toString(), 16);
|
||||
out.write((char) value);
|
||||
} catch (NumberFormatException nfe) {
|
||||
throw new UnhandledException("Unable to parse unicode value: " + unicode, nfe);
|
||||
throw new RuntimeException("Unable to parse unicode value: " + unicode, nfe);
|
||||
}
|
||||
return i + 4;
|
||||
} else {
|
||||
|
@ -562,7 +562,7 @@ public void testGetClassClassNotFound() throws Exception {
|
||||
}
|
||||
|
||||
public void testGetClassInvalidArguments() throws Exception {
|
||||
assertGetClassThrowsIllegalArgument( null );
|
||||
assertGetClassThrowsNullPointerException( null );
|
||||
assertGetClassThrowsClassNotFound( "[][][]" );
|
||||
assertGetClassThrowsClassNotFound( "[[]" );
|
||||
assertGetClassThrowsClassNotFound( "[" );
|
||||
@ -651,8 +651,8 @@ private void assertGetClassThrowsException( String className, Class exceptionTyp
|
||||
}
|
||||
}
|
||||
|
||||
private void assertGetClassThrowsIllegalArgument( String className ) throws Exception {
|
||||
assertGetClassThrowsException( className, IllegalArgumentException.class );
|
||||
private void assertGetClassThrowsNullPointerException( String className ) throws Exception {
|
||||
assertGetClassThrowsException( className, NullPointerException.class );
|
||||
}
|
||||
|
||||
private void assertGetClassThrowsClassNotFound( String className ) throws Exception {
|
||||
|
Loading…
x
Reference in New Issue
Block a user