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:
Henri Yandell 2009-07-20 23:55:30 +00:00
parent 5e58c2cfd8
commit f957d81625
3 changed files with 5 additions and 9 deletions

View File

@ -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);
}
}

View File

@ -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 {

View File

@ -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 {