提交 9b290695 编写于 作者: S sherman

7084245: Update usages of InternalError to use exception chaining

Summary: to use new InternalError constructor with cause chainning
Reviewed-by: alanb, ksrini, xuelei, neugens
Contributed-by: sebastian.sickelmann@gmx.de
上级 1f3794e5
......@@ -763,7 +763,7 @@ class JFIFMarkerSegment extends MarkerSegment {
}
} catch (IllegalThumbException e) {
// Should never happen
throw new InternalError("Illegal thumb in setThumbnail!");
throw new InternalError("Illegal thumb in setThumbnail!", e);
}
}
......
......@@ -186,7 +186,7 @@ public class SnmpCounter64 extends SnmpValue {
newclone = (SnmpCounter64) super.clone() ;
newclone.value = value ;
} catch (CloneNotSupportedException e) {
throw new InternalError() ; // vm bug.
throw new InternalError(e) ; // vm bug.
}
return newclone ;
}
......
......@@ -232,7 +232,7 @@ public class SnmpInt extends SnmpValue {
newclone = (SnmpInt) super.clone() ;
newclone.value = value ;
} catch (CloneNotSupportedException e) {
throw new InternalError() ; // vm bug.
throw new InternalError(e) ; // vm bug.
}
return newclone ;
}
......
......@@ -129,7 +129,7 @@ public class SnmpNull extends SnmpValue {
newclone = (SnmpNull) super.clone() ;
newclone.tag = tag ;
} catch (CloneNotSupportedException e) {
throw new InternalError() ; // vm bug.
throw new InternalError(e) ; // vm bug.
}
return newclone ;
}
......
......@@ -250,7 +250,7 @@ public class SnmpString extends SnmpValue {
newclone.value = new byte[value.length] ;
System.arraycopy(value, 0, newclone.value, 0, value.length) ;
} catch (CloneNotSupportedException e) {
throw new InternalError() ; // vm bug.
throw new InternalError(e) ; // vm bug.
}
return newclone ;
}
......
......@@ -921,7 +921,7 @@ class SnmpRequestHandler extends ClientHandler implements SnmpDefinitions {
SNMP_ADAPTOR_LOGGER.logp(Level.FINEST, dbgTag,
"newTooBigMessage", "Internal error", x);
}
throw new InternalError() ;
throw new InternalError(x) ;
}
return result ;
......
......@@ -77,9 +77,7 @@ class BrowserSupport {
result = (Boolean) isDesktopSupportedMethod.invoke(null);
} catch (IllegalAccessException e) {
// should never reach here
InternalError x =
new InternalError("Desktop.getDesktop() method not found");
x.initCause(e);
throw new InternalError("Desktop.getDesktop() method not found", e);
} catch (InvocationTargetException e) {
// browser not supported
if (Util.isVerbose()) {
......@@ -101,28 +99,10 @@ class BrowserSupport {
result = (Boolean) isSupportedMethod.invoke(desktopObj, browseField.get(null));
supported = result.booleanValue();
}
} catch (ClassNotFoundException e) {
// browser not supported
if (Util.isVerbose()) {
e.printStackTrace();
}
} catch (NoSuchMethodException e) {
// browser not supported
if (Util.isVerbose()) {
e.printStackTrace();
}
} catch (NoSuchFieldException e) {
// browser not supported
if (Util.isVerbose()) {
e.printStackTrace();
}
} catch (IllegalAccessException e) {
// should never reach here
InternalError x =
new InternalError("Desktop.getDesktop() method not found");
x.initCause(e);
throw x;
} catch (InvocationTargetException e) {
throw new InternalError("Desktop.getDesktop() method not found", e);
} catch (ReflectiveOperationException e) {
// browser not supported
if (Util.isVerbose()) {
e.printStackTrace();
......@@ -175,10 +155,7 @@ class BrowserSupport {
browseMethod.invoke(desktop, uri);
} catch (IllegalAccessException e) {
// should never reach here
InternalError x =
new InternalError("Desktop.getDesktop() method not found");
x.initCause(e);
throw x;
throw new InternalError("Desktop.getDesktop() method not found", e);
} catch (InvocationTargetException e) {
Throwable x = e.getCause();
if (x != null) {
......
......@@ -150,9 +150,7 @@ class RegistrationDocument {
} catch (ParserConfigurationException pce) {
// Parser with specific options can't be built
// should not reach here
InternalError x = new InternalError("Error in creating the new document");
x.initCause(pce);
throw x;
throw new InternalError("Error in creating the new document", pce);
}
}
......@@ -172,9 +170,7 @@ class RegistrationDocument {
} catch (ParserConfigurationException pce) {
// Parser with specified options can't be built
// should not reach here
InternalError x = new InternalError("Error in creating the new document");
x.initCause(pce);
throw x;
throw new InternalError("Error in creating the new document", pce);
}
}
......@@ -195,20 +191,14 @@ class RegistrationDocument {
new StreamResult(new BufferedWriter(new OutputStreamWriter(os, "UTF-8"))));
} catch (UnsupportedEncodingException ue) {
// Should not reach here
InternalError x = new InternalError("Error generated during transformation");
x.initCause(ue);
throw x;
throw new InternalError("Error generated during transformation", ue);
} catch (TransformerConfigurationException tce) {
// Error generated by the parser
// Should not reach here
InternalError x = new InternalError("Error in creating the new document");
x.initCause(tce);
throw x;
throw new InternalError("Error in creating the new document", tce);
} catch (TransformerException te) {
// Error generated by the transformer
InternalError x = new InternalError("Error generated during transformation");
x.initCause(te);
throw x;
throw new InternalError("Error generated during transformation", te);
}
}
......
......@@ -137,7 +137,7 @@ public class BufferCapabilities implements Cloneable {
return super.clone();
} catch (CloneNotSupportedException e) {
// Since we implement Cloneable, this should never happen
throw new InternalError();
throw new InternalError(e);
}
}
......
......@@ -3776,11 +3776,10 @@ public abstract class Component implements ImageObserver, MenuContainer,
createBufferStrategy(numBuffers, bufferCaps);
return; // Success
} catch (AWTException e) {
// Failed
// Code should never reach here (an unaccelerated blitting
// strategy should always work)
throw new InternalError("Could not create a buffer strategy", e);
}
// Code should never reach here (an unaccelerated blitting
// strategy should always work)
throw new InternalError("Could not create a buffer strategy");
}
/**
......
......@@ -653,7 +653,7 @@ public class GridBagConstraints implements Cloneable, java.io.Serializable {
return c;
} catch (CloneNotSupportedException e) {
// this shouldn't happen, since we are Cloneable
throw new InternalError();
throw new InternalError(e);
}
}
......
......@@ -74,7 +74,7 @@ public class ImageCapabilities implements Cloneable {
return super.clone();
} catch (CloneNotSupportedException e) {
// Since we implement Cloneable, this should never happen
throw new InternalError();
throw new InternalError(e);
}
}
......
......@@ -177,7 +177,7 @@ public class Insets implements Cloneable, java.io.Serializable {
return super.clone();
} catch (CloneNotSupportedException e) {
// this shouldn't happen, since we are Cloneable
throw new InternalError();
throw new InternalError(e);
}
}
/**
......
......@@ -361,7 +361,7 @@ public final class JobAttributes implements Cloneable {
return super.clone();
} catch (CloneNotSupportedException e) {
// Since we implement Cloneable, this should never happen
throw new InternalError();
throw new InternalError(e);
}
}
......
......@@ -969,7 +969,7 @@ public final class PageAttributes implements Cloneable {
return super.clone();
} catch (CloneNotSupportedException e) {
// Since we implement Cloneable, this should never happen
throw new InternalError();
throw new InternalError(e);
}
}
......
......@@ -1276,7 +1276,7 @@ public class RenderingHints
}
} catch (CloneNotSupportedException e) {
// this shouldn't happen, since we are Cloneable
throw new InternalError();
throw new InternalError(e);
}
return rh;
......
......@@ -753,7 +753,7 @@ public final class TextLayout implements Cloneable {
return super.clone();
}
catch (CloneNotSupportedException e) {
throw new InternalError();
throw new InternalError(e);
}
}
......
......@@ -3856,7 +3856,7 @@ public class AffineTransform implements Cloneable, java.io.Serializable {
return super.clone();
} catch (CloneNotSupportedException e) {
// this shouldn't happen, since we are Cloneable
throw new InternalError();
throw new InternalError(e);
}
}
......
......@@ -1569,7 +1569,7 @@ public abstract class CubicCurve2D implements Shape, Cloneable {
return super.clone();
} catch (CloneNotSupportedException e) {
// this shouldn't happen, since we are Cloneable
throw new InternalError();
throw new InternalError(e);
}
}
}
......@@ -108,7 +108,7 @@ public abstract class Dimension2D implements Cloneable {
return super.clone();
} catch (CloneNotSupportedException e) {
// this shouldn't happen, since we are Cloneable
throw new InternalError();
throw new InternalError(e);
}
}
}
......@@ -1122,7 +1122,7 @@ public abstract class Line2D implements Shape, Cloneable {
return super.clone();
} catch (CloneNotSupportedException e) {
// this shouldn't happen, since we are Cloneable
throw new InternalError();
throw new InternalError(e);
}
}
}
......@@ -393,7 +393,7 @@ public abstract class Point2D implements Cloneable {
return super.clone();
} catch (CloneNotSupportedException e) {
// this shouldn't happen, since we are Cloneable
throw new InternalError();
throw new InternalError(e);
}
}
......
......@@ -1395,7 +1395,7 @@ public abstract class QuadCurve2D implements Shape, Cloneable {
return super.clone();
} catch (CloneNotSupportedException e) {
// this shouldn't happen, since we are Cloneable
throw new InternalError();
throw new InternalError(e);
}
}
}
......@@ -391,7 +391,7 @@ public abstract class RectangularShape implements Shape, Cloneable {
return super.clone();
} catch (CloneNotSupportedException e) {
// this shouldn't happen, since we are Cloneable
throw new InternalError();
throw new InternalError(e);
}
}
}
......@@ -252,7 +252,7 @@ public class ImageFilter implements ImageConsumer, Cloneable {
return super.clone();
} catch (CloneNotSupportedException e) {
// this shouldn't happen, since we are Cloneable
throw new InternalError();
throw new InternalError(e);
}
}
}
......@@ -147,7 +147,7 @@ public class Kernel implements Cloneable {
return super.clone();
} catch (CloneNotSupportedException e) {
// this shouldn't happen, since we are Cloneable
throw new InternalError();
throw new InternalError(e);
}
}
}
......@@ -478,7 +478,7 @@ public class ObjectStreamClass implements Serializable {
fieldRefl = getReflector(fields, this);
} catch (InvalidClassException ex) {
// field mismatches impossible when matching local fields vs. self
throw new InternalError();
throw new InternalError(ex);
}
if (deserializeEx == null) {
......@@ -941,7 +941,7 @@ public class ObjectStreamClass implements Serializable {
return cons.newInstance();
} catch (IllegalAccessException ex) {
// should not occur, as access checks have been suppressed
throw new InternalError();
throw new InternalError(ex);
}
} else {
throw new UnsupportedOperationException();
......@@ -969,7 +969,7 @@ public class ObjectStreamClass implements Serializable {
}
} catch (IllegalAccessException ex) {
// should not occur, as access checks have been suppressed
throw new InternalError();
throw new InternalError(ex);
}
} else {
throw new UnsupportedOperationException();
......@@ -1000,7 +1000,7 @@ public class ObjectStreamClass implements Serializable {
}
} catch (IllegalAccessException ex) {
// should not occur, as access checks have been suppressed
throw new InternalError();
throw new InternalError(ex);
}
} else {
throw new UnsupportedOperationException();
......@@ -1028,7 +1028,7 @@ public class ObjectStreamClass implements Serializable {
}
} catch (IllegalAccessException ex) {
// should not occur, as access checks have been suppressed
throw new InternalError();
throw new InternalError(ex);
}
} else {
throw new UnsupportedOperationException();
......@@ -1053,11 +1053,11 @@ public class ObjectStreamClass implements Serializable {
throw (ObjectStreamException) th;
} else {
throwMiscException(th);
throw new InternalError(); // never reached
throw new InternalError(th); // never reached
}
} catch (IllegalAccessException ex) {
// should not occur, as access checks have been suppressed
throw new InternalError();
throw new InternalError(ex);
}
} else {
throw new UnsupportedOperationException();
......@@ -1082,11 +1082,11 @@ public class ObjectStreamClass implements Serializable {
throw (ObjectStreamException) th;
} else {
throwMiscException(th);
throw new InternalError(); // never reached
throw new InternalError(th); // never reached
}
} catch (IllegalAccessException ex) {
// should not occur, as access checks have been suppressed
throw new InternalError();
throw new InternalError(ex);
}
} else {
throw new UnsupportedOperationException();
......@@ -1774,7 +1774,7 @@ public class ObjectStreamClass implements Serializable {
}
return hash;
} catch (IOException ex) {
throw new InternalError();
throw new InternalError(ex);
} catch (NoSuchAlgorithmException ex) {
throw new SecurityException(ex.getMessage());
}
......
......@@ -83,7 +83,7 @@ class CharacterName {
dis.readFully(strPool);
refStrPool = new SoftReference<>(strPool);
} catch (Exception x) {
throw new InternalError(x.getMessage());
throw new InternalError(x.getMessage(), x);
} finally {
try {
if (dis != null)
......
......@@ -974,8 +974,7 @@ public final
descriptor = (String) enclosingInfo[2];
assert((name != null && descriptor != null) || name == descriptor);
} catch (ClassCastException cce) {
throw (InternalError)
new InternalError("Invalid type in enclosing method information").initCause(cce);
throw new InternalError("Invalid type in enclosing method information", cce);
}
}
......@@ -1241,8 +1240,7 @@ public final
try {
return getName().substring(enclosingClass.getName().length());
} catch (IndexOutOfBoundsException ex) {
throw (InternalError)
new InternalError("Malformed class name").initCause(ex);
throw new InternalError("Malformed class name", ex);
}
}
......
......@@ -27,7 +27,6 @@ package java.lang.invoke;
import sun.invoke.empty.Empty;
import sun.misc.Unsafe;
import static java.lang.invoke.MethodHandleStatics.*;
import static java.lang.invoke.MethodHandles.Lookup.IMPL_LOOKUP;
/**
......@@ -244,8 +243,8 @@ public class CallSite {
try {
GET_TARGET = IMPL_LOOKUP.
findVirtual(CallSite.class, "getTarget", MethodType.methodType(MethodHandle.class));
} catch (ReflectiveOperationException ignore) {
throw new InternalError();
} catch (ReflectiveOperationException e) {
throw new InternalError(e);
}
}
......
......@@ -88,7 +88,7 @@ class Invokers {
try {
invoker = IMPL_LOOKUP.findVirtual(MethodHandle.class, name, targetType);
} catch (ReflectiveOperationException ex) {
throw new InternalError("JVM cannot find invoker for "+targetType);
throw new InternalError("JVM cannot find invoker for "+targetType, ex);
}
assert(invokerType(targetType) == invoker.type());
assert(!invoker.isVarargsCollector());
......
......@@ -382,7 +382,7 @@ import static java.lang.invoke.MethodHandleStatics.*;
try {
return (MemberName) super.clone();
} catch (CloneNotSupportedException ex) {
throw new InternalError();
throw new InternalError(ex);
}
}
......
......@@ -108,9 +108,7 @@ import java.security.PrivilegedAction;
return new IllegalArgumentException(message(message, obj, obj2));
}
/*non-public*/ static Error uncaughtException(Exception ex) {
Error err = new InternalError("uncaught exception");
err.initCause(ex);
return err;
throw new InternalError("uncaught exception", ex);
}
private static String message(String message, Object obj) {
if (obj != null) message = message + ": " + obj;
......
......@@ -461,7 +461,7 @@ class MethodTypeForm {
// Trigger adapter creation.
genericInvoker = InvokeGeneric.generalInvokerOf(erasedType);
} catch (Exception ex) {
Error err = new InternalError("Exception while resolving inexact invoke");
Error err = new InternalError("Exception while resolving inexact invoke", ex);
err.initCause(ex);
throw err;
}
......
......@@ -610,7 +610,7 @@ public class Proxy implements java.io.Serializable {
IllegalAccessException |
InstantiationException |
InvocationTargetException e) {
throw new InternalError(e.toString());
throw new InternalError(e.toString(), e);
}
}
......
......@@ -170,7 +170,7 @@ public final class VMID implements java.io.Serializable {
/* can't happen, but be deterministic anyway. */
addrHash = new byte[0];
} catch (NoSuchAlgorithmException complain) {
throw new InternalError(complain.toString());
throw new InternalError(complain.toString(), complain);
}
return addrHash;
}
......
......@@ -122,7 +122,7 @@ public class CollectionCertStoreParameters
return super.clone();
} catch (CloneNotSupportedException e) {
/* Cannot happen */
throw new InternalError(e.toString());
throw new InternalError(e.toString(), e);
}
}
......
......@@ -128,7 +128,7 @@ public class LDAPCertStoreParameters implements CertStoreParameters {
return super.clone();
} catch (CloneNotSupportedException e) {
/* Cannot happen */
throw new InternalError(e.toString());
throw new InternalError(e.toString(), e);
}
}
......
......@@ -175,7 +175,7 @@ public abstract class PKIXCertPathChecker implements Cloneable {
return super.clone();
} catch (CloneNotSupportedException e) {
/* Cannot happen */
throw new InternalError(e.toString());
throw new InternalError(e.toString(), e);
}
}
}
......@@ -136,7 +136,7 @@ public class PKIXCertPathValidatorResult implements CertPathValidatorResult {
return super.clone();
} catch (CloneNotSupportedException e) {
/* Cannot happen */
throw new InternalError(e.toString());
throw new InternalError(e.toString(), e);
}
}
......
......@@ -683,7 +683,7 @@ public class PKIXParameters implements CertPathParameters {
return copy;
} catch (CloneNotSupportedException e) {
/* Cannot happen */
throw new InternalError(e.toString());
throw new InternalError(e.toString(), e);
}
}
......
......@@ -708,7 +708,7 @@ public class X509CRLSelector implements CRLSelector {
return copy;
} catch (CloneNotSupportedException e) {
/* Cannot happen */
throw new InternalError(e.toString());
throw new InternalError(e.toString(), e);
}
}
}
......@@ -2615,7 +2615,7 @@ public class X509CertSelector implements CertSelector {
return copy;
} catch (CloneNotSupportedException e) {
/* Cannot happen */
throw new InternalError(e.toString());
throw new InternalError(e.toString(), e);
}
}
}
......@@ -794,7 +794,7 @@ public class AttributedString {
return other;
}
catch (CloneNotSupportedException e) {
throw new InternalError();
throw new InternalError(e);
}
}
......
......@@ -154,7 +154,7 @@ class BreakDictionary {
);
}
catch (PrivilegedActionException e) {
throw new InternalError(e.toString());
throw new InternalError(e.toString(), e);
}
byte[] buf = new byte[8];
......
......@@ -254,7 +254,7 @@ public abstract class BreakIterator implements Cloneable
return super.clone();
}
catch (CloneNotSupportedException e) {
throw new InternalError();
throw new InternalError(e);
}
}
......@@ -617,7 +617,7 @@ public abstract class BreakIterator implements Cloneable
}
}
catch (Exception e) {
throw new InternalError(e.toString());
throw new InternalError(e.toString(), e);
}
}
......
......@@ -461,7 +461,7 @@ public abstract class Collator
try {
return (Collator)super.clone();
} catch (CloneNotSupportedException e) {
throw new InternalError();
throw new InternalError(e);
}
}
......
......@@ -597,7 +597,7 @@ public class DateFormatSymbols implements Serializable, Cloneable {
copyMembers(this, other);
return other;
} catch (CloneNotSupportedException e) {
throw new InternalError();
throw new InternalError(e);
}
}
......
......@@ -1891,14 +1891,10 @@ public class DecimalFormat extends NumberFormat {
* Standard override; no change in semantics.
*/
public Object clone() {
try {
DecimalFormat other = (DecimalFormat) super.clone();
other.symbols = (DecimalFormatSymbols) symbols.clone();
other.digitList = (DigitList) digitList.clone();
return other;
} catch (Exception e) {
throw new InternalError();
}
DecimalFormat other = (DecimalFormat) super.clone();
other.symbols = (DecimalFormatSymbols) symbols.clone();
other.digitList = (DigitList) digitList.clone();
return other;
}
/**
......
......@@ -479,7 +479,7 @@ public class DecimalFormatSymbols implements Cloneable, Serializable {
return (DecimalFormatSymbols)super.clone();
// other fields are bit-copied
} catch (CloneNotSupportedException e) {
throw new InternalError();
throw new InternalError(e);
}
}
......
......@@ -632,7 +632,7 @@ final class DigitList implements Cloneable {
other.tempBuffer = null;
return other;
} catch (CloneNotSupportedException e) {
throw new InternalError();
throw new InternalError(e);
}
}
......
......@@ -258,7 +258,7 @@ public abstract class Format implements Serializable, Cloneable {
return super.clone();
} catch (CloneNotSupportedException e) {
// will never happen
return null;
throw new InternalError(e);
}
}
......
......@@ -453,7 +453,7 @@ class RuleBasedBreakIterator extends BreakIterator {
);
}
catch (PrivilegedActionException e) {
throw new InternalError(e.toString());
throw new InternalError(e.toString(), e);
}
int offset = 0;
......
......@@ -272,7 +272,7 @@ public final class StringCharacterIterator implements CharacterIterator
return other;
}
catch (CloneNotSupportedException e) {
throw new InternalError();
throw new InternalError(e);
}
}
......
......@@ -307,7 +307,7 @@ public class ArrayList<E> extends AbstractList<E>
return v;
} catch (CloneNotSupportedException e) {
// this shouldn't happen, since we are Cloneable
throw new InternalError();
throw new InternalError(e);
}
}
......
......@@ -1092,7 +1092,7 @@ public class BitSet implements Cloneable, java.io.Serializable {
result.checkInvariants();
return result;
} catch (CloneNotSupportedException e) {
throw new InternalError();
throw new InternalError(e);
}
}
......
......@@ -2512,7 +2512,7 @@ public abstract class Calendar implements Serializable, Cloneable, Comparable<Ca
}
catch (CloneNotSupportedException e) {
// this shouldn't happen, since we are Cloneable
throw new InternalError();
throw new InternalError(e);
}
}
......
......@@ -221,9 +221,7 @@ public final class Currency implements Serializable {
otherCurrenciesNumericCode = readIntArray(dis, ocCount);
dis.close();
} catch (IOException e) {
InternalError ie = new InternalError();
ie.initCause(e);
throw ie;
throw new InternalError(e);
}
// look for the properties file for overrides
......
......@@ -253,7 +253,7 @@ public class HashSet<E>
newSet.map = (HashMap<E, Object>) map.clone();
return newSet;
} catch (CloneNotSupportedException e) {
throw new InternalError();
throw new InternalError(e);
}
}
......
......@@ -537,7 +537,7 @@ public class Hashtable<K,V>
return t;
} catch (CloneNotSupportedException e) {
// this shouldn't happen, since we are Cloneable
throw new InternalError();
throw new InternalError(e);
}
}
......
......@@ -703,7 +703,7 @@ public class IdentityHashMap<K,V>
m.table = table.clone();
return m;
} catch (CloneNotSupportedException e) {
throw new InternalError();
throw new InternalError(e);
}
}
......
......@@ -994,7 +994,7 @@ public class LinkedList<E>
try {
return (LinkedList<E>) super.clone();
} catch (CloneNotSupportedException e) {
throw new InternalError();
throw new InternalError(e);
}
}
......
......@@ -1859,7 +1859,7 @@ public final class Locale implements Cloneable, Serializable {
Locale that = (Locale)super.clone();
return that;
} catch (CloneNotSupportedException e) {
throw new InternalError();
throw new InternalError(e);
}
}
......
......@@ -614,7 +614,7 @@ public abstract class ResourceBundle {
return clone;
} catch (CloneNotSupportedException e) {
//this should never happen
throw new InternalError();
throw new InternalError(e);
}
}
......
......@@ -739,7 +739,7 @@ abstract public class TimeZone implements Serializable, Cloneable {
other.ID = ID;
return other;
} catch (CloneNotSupportedException e) {
throw new InternalError();
throw new InternalError(e);
}
}
......
......@@ -622,7 +622,7 @@ public class TreeMap<K,V>
try {
clone = (TreeMap<K,V>) super.clone();
} catch (CloneNotSupportedException e) {
throw new InternalError();
throw new InternalError(e);
}
// Put clone into "virgin" state (except for comparator)
......
......@@ -474,7 +474,7 @@ public class TreeSet<E> extends AbstractSet<E>
try {
clone = (TreeSet<E>) super.clone();
} catch (CloneNotSupportedException e) {
throw new InternalError();
throw new InternalError(e);
}
clone.m = new TreeMap<>(m);
......
......@@ -165,7 +165,7 @@ public final class UUID implements java.io.Serializable, Comparable<UUID> {
try {
md = MessageDigest.getInstance("MD5");
} catch (NoSuchAlgorithmException nsae) {
throw new InternalError("MD5 not supported");
throw new InternalError("MD5 not supported", nsae);
}
byte[] md5Bytes = md.digest(name);
md5Bytes[6] &= 0x0f; /* clear version */
......
......@@ -673,7 +673,7 @@ public class Vector<E>
return v;
} catch (CloneNotSupportedException e) {
// this shouldn't happen, since we are Cloneable
throw new InternalError();
throw new InternalError(e);
}
}
......
......@@ -321,7 +321,7 @@ class ZipEntry implements ZipConstants, Cloneable {
return e;
} catch (CloneNotSupportedException e) {
// This should never happen, since we are Cloneable
throw new InternalError();
throw new InternalError(e);
}
}
}
......@@ -671,7 +671,7 @@ public class TabularDataSupport
return c;
}
catch (CloneNotSupportedException e) {
throw new InternalError(e.toString());
throw new InternalError(e.toString(), e);
}
}
......
......@@ -157,7 +157,7 @@ public class ElementIterator implements Cloneable {
}
return it;
} catch (CloneNotSupportedException e) {
throw new InternalError();
throw new InternalError(e);
}
}
......
......@@ -528,7 +528,7 @@ public void setCharacterSet(String name)
try {
translationTable = (char[])getCharacterSet("ansi");
} catch (IOException e) {
throw new InternalError("RTFReader: Unable to find character set resources (" + e + ")");
throw new InternalError("RTFReader: Unable to find character set resources (" + e + ")", e);
}
}
}
......@@ -1614,7 +1614,7 @@ class DocumentDestination
} catch (BadLocationException ble) {
/* This shouldn't be able to happen, of course */
/* TODO is InternalError the correct error to throw? */
throw new InternalError(ble.getMessage());
throw new InternalError(ble.getMessage(), ble);
}
}
......@@ -1628,7 +1628,7 @@ class DocumentDestination
} catch (BadLocationException ble) {
/* This shouldn't be able to happen, of course */
/* TODO is InternalError the correct error to throw? */
throw new InternalError(ble.getMessage());
throw new InternalError(ble.getMessage(), ble);
}
}
......
......@@ -158,7 +158,7 @@ public class DuctusRenderingEngine extends RenderingEngine {
feedConsumer(pi, consumer, normalize, 0.25f);
} catch (PathException e) {
throw new InternalError("Unable to Stroke shape ("+
e.getMessage()+")");
e.getMessage()+")", e);
} finally {
while (consumer != null && consumer != sr) {
PathConsumer next = consumer.getConsumer();
......@@ -763,7 +763,7 @@ public class DuctusRenderingEngine extends RenderingEngine {
consumer.endPath();
} catch (PathException e) {
throw new InternalError("Unable to Stroke shape ("+
e.getMessage()+")");
e.getMessage()+")", e);
}
}
......
......@@ -113,7 +113,7 @@ public final class FontLineMetrics extends LineMetrics implements Cloneable {
return super.clone();
}
catch (CloneNotSupportedException e) {
throw new InternalError();
throw new InternalError(e);
}
}
}
......@@ -233,7 +233,7 @@ public final class GlyphLayout {
invdtx = dtx.createInverse();
}
catch (NoninvertibleTransformException e) {
throw new InternalError();
throw new InternalError(e);
}
}
......
......@@ -677,9 +677,7 @@ public class ValueConversions {
EMPTY = IMPL_LOOKUP.findStatic(THIS_CLASS, "empty", ignoreType.dropParameterTypes(0, 1));
NEW_ARRAY = IMPL_LOOKUP.findStatic(THIS_CLASS, "newArray", MethodType.methodType(Object[].class, int.class));
} catch (NoSuchMethodException | IllegalAccessException ex) {
Error err = new InternalError("uncaught exception");
err.initCause(ex);
throw err;
throw new InternalError("uncaught exception", ex);
}
}
......@@ -693,9 +691,7 @@ public class ValueConversions {
COPY_AS_PRIMITIVE_ARRAY = IMPL_LOOKUP.findStatic(THIS_CLASS, "copyAsPrimitiveArray", MethodType.methodType(Object.class, Wrapper.class, Object[].class));
MAKE_LIST = IMPL_LOOKUP.findStatic(THIS_CLASS, "makeList", MethodType.methodType(List.class, Object[].class));
} catch (ReflectiveOperationException ex) {
Error err = new InternalError("uncaught exception");
err.initCause(ex);
throw err;
throw new InternalError("uncaught exception", ex);
}
}
}
......
......@@ -281,9 +281,8 @@ public class LoopPipe
} catch (Throwable t) {
sr.dispose();
sr = null;
t.printStackTrace();
throw new InternalError("Unable to Stroke shape ("+
t.getMessage()+")");
t.getMessage()+")", t);
}
return sr;
}
......
......@@ -133,7 +133,7 @@ class PerfDataEntry {
catch (UnsupportedEncodingException e) {
// should not reach here
// "UTF-8" is always a known encoding
throw new InternalError(e.getMessage());
throw new InternalError(e.getMessage(), e);
}
if (variability == Variability.INVALID) {
......
......@@ -93,7 +93,7 @@ class PerfDataType {
this.value = b[0];
} catch (UnsupportedEncodingException e) {
// ignore, "UTF-8" is always a known encoding
throw new InternalError("Unknown encoding");
throw new InternalError("Unknown encoding", e);
}
}
}
......@@ -71,7 +71,7 @@ public class Launcher {
extcl = ExtClassLoader.getExtClassLoader();
} catch (IOException e) {
throw new InternalError(
"Could not create extension class loader");
"Could not create extension class loader", e);
}
// Now create the class loader to use to launch the application
......@@ -79,7 +79,7 @@ public class Launcher {
loader = AppClassLoader.getAppClassLoader(extcl);
} catch (IOException e) {
throw new InternalError(
"Could not create application class loader");
"Could not create application class loader", e);
}
// Also set the context class loader for the primordial thread.
......@@ -460,7 +460,7 @@ public class Launcher {
return ParseUtil.fileToEncodedURL(file);
} catch (MalformedURLException e) {
// Should never happen since we specify the protocol...
throw new InternalError();
throw new InternalError(e);
}
}
......@@ -475,15 +475,10 @@ public class Launcher {
try {
Class c = Class.forName(name);
return (URLStreamHandler)c.newInstance();
} catch (ClassNotFoundException e) {
e.printStackTrace();
} catch (InstantiationException e) {
e.printStackTrace();
} catch (IllegalAccessException e) {
e.printStackTrace();
} catch (ReflectiveOperationException e) {
throw new InternalError("could not load " + protocol +
"system protocol handler", e);
}
throw new InternalError("could not load " + protocol +
"system protocol handler");
}
}
}
......
......@@ -460,7 +460,7 @@ public class ProxyGenerator {
methods.add(generateStaticInitializer());
} catch (IOException e) {
throw new InternalError("unexpected I/O Exception");
throw new InternalError("unexpected I/O Exception", e);
}
if (methods.size() > 65535) {
......@@ -540,7 +540,7 @@ public class ProxyGenerator {
dout.writeShort(0); // (no ClassFile attributes for proxy classes)
} catch (IOException e) {
throw new InternalError("unexpected I/O Exception");
throw new InternalError("unexpected I/O Exception", e);
}
return bout.toByteArray();
......
......@@ -139,7 +139,7 @@ public class NetworkClient {
serverSocket.getOutputStream()),
true, encoding);
} catch (UnsupportedEncodingException e) {
throw new InternalError(encoding +"encoding not found");
throw new InternalError(encoding +"encoding not found", e);
}
serverInput = new BufferedInputStream(serverSocket.getInputStream());
}
......
......@@ -142,7 +142,7 @@ public class NetworkServer implements Runnable, Cloneable {
return super.clone();
} catch (CloneNotSupportedException e) {
// this shouldn't happen, since we are Cloneable
throw new InternalError();
throw new InternalError(e);
}
}
......
......@@ -905,7 +905,7 @@ public class FtpClient extends sun.net.ftp.FtpClient {
out = new PrintStream(new BufferedOutputStream(server.getOutputStream()),
true, encoding);
} catch (UnsupportedEncodingException e) {
throw new InternalError(encoding + "encoding not found");
throw new InternalError(encoding + "encoding not found", e);
}
in = new BufferedInputStream(server.getInputStream());
}
......@@ -1621,7 +1621,7 @@ public class FtpClient extends sun.net.ftp.FtpClient {
out = new PrintStream(new BufferedOutputStream(server.getOutputStream()),
true, encoding);
} catch (UnsupportedEncodingException e) {
throw new InternalError(encoding + "encoding not found");
throw new InternalError(encoding + "encoding not found", e);
}
in = new BufferedInputStream(server.getInputStream());
}
......@@ -2056,7 +2056,7 @@ public class FtpClient extends sun.net.ftp.FtpClient {
out = new PrintStream(new BufferedOutputStream(server.getOutputStream()),
true, encoding);
} catch (UnsupportedEncodingException e) {
throw new InternalError(encoding + "encoding not found");
throw new InternalError(encoding + "encoding not found", e);
}
in = new BufferedInputStream(server.getInputStream());
......@@ -2090,7 +2090,7 @@ public class FtpClient extends sun.net.ftp.FtpClient {
out = new PrintStream(new BufferedOutputStream(server.getOutputStream()),
true, encoding);
} catch (UnsupportedEncodingException e) {
throw new InternalError(encoding + "encoding not found");
throw new InternalError(encoding + "encoding not found", e);
}
in = new BufferedInputStream(server.getInputStream());
......
......@@ -134,7 +134,7 @@ public class SmtpClient extends TransferProtocolClient {
try {
message = new SmtpPrintStream(serverOutput, this);
} catch (UnsupportedEncodingException e) {
throw new InternalError(encoding+" encoding not found");
throw new InternalError(encoding+" encoding not found", e);
}
return message;
}
......
......@@ -79,7 +79,7 @@ public class ChunkedOutputStream extends PrintStream {
return header;
} catch (java.io.UnsupportedEncodingException e) {
/* This should never happen */
throw new InternalError(e.getMessage());
throw new InternalError(e.getMessage(), e);
}
}
......
......@@ -395,7 +395,7 @@ public class HttpClient extends NetworkClient {
new BufferedOutputStream(out),
false, encoding);
} catch (UnsupportedEncodingException e) {
throw new InternalError(encoding+" encoding not found");
throw new InternalError(encoding+" encoding not found", e);
}
serverSocket.setTcpNoDelay(true);
}
......
......@@ -324,7 +324,7 @@ public class GopherClient extends NetworkClient implements Runnable {
}
} catch (UnsupportedEncodingException e) {
throw new InternalError(encoding+ " encoding not found");
throw new InternalError(encoding+ " encoding not found", e);
} catch (IOException e) {
} finally {
try {
......
......@@ -529,7 +529,7 @@ final class HttpsClient extends HttpClient
new BufferedOutputStream(serverSocket.getOutputStream()),
false, encoding);
} catch (UnsupportedEncodingException e) {
throw new InternalError(encoding+" encoding not found");
throw new InternalError(encoding+" encoding not found", e);
}
// check URL spoofing if it has not been checked under handshaking
......
......@@ -373,7 +373,7 @@ class Util {
NoSuchMethodException |
IllegalArgumentException |
ClassCastException x) {
throw new InternalError();
throw new InternalError(x);
}
return null;
}});
......@@ -395,7 +395,7 @@ class Util {
} catch (InstantiationException |
IllegalAccessException |
InvocationTargetException e) {
throw new InternalError();
throw new InternalError(e);
}
return dbb;
}
......@@ -418,7 +418,7 @@ class Util {
NoSuchMethodException |
IllegalArgumentException |
ClassCastException x) {
throw new InternalError();
throw new InternalError(x);
}
return null;
}});
......@@ -440,7 +440,7 @@ class Util {
} catch (InstantiationException |
IllegalAccessException |
InvocationTargetException e) {
throw new InternalError();
throw new InternalError(e);
}
return dbb;
}
......
......@@ -52,7 +52,7 @@ class UTF8 {
}
} catch (ArrayIndexOutOfBoundsException e) {
throw new InternalError
("Bug in sun.reflect bootstrap UTF-8 encoder");
("Bug in sun.reflect bootstrap UTF-8 encoder", e);
}
return res;
}
......
......@@ -292,7 +292,7 @@ public final class MethodUtil extends SecureClassLoader {
}
});
} catch (Exception e) {
throw new InternalError("bouncer cannot be found");
throw new InternalError("bouncer cannot be found", e);
}
}
......
......@@ -111,7 +111,7 @@ public class LiveRef implements Cloneable {
LiveRef newRef = (LiveRef) super.clone();
return newRef;
} catch (CloneNotSupportedException e) {
throw new InternalError(e.toString());
throw new InternalError(e.toString(), e);
}
}
......
......@@ -249,7 +249,7 @@ implements java.io.Serializable {
try {
digest = MessageDigest.getInstance ("SHA");
} catch (NoSuchAlgorithmException e) {
throw new InternalError("internal error: SHA-1 not available.");
throw new InternalError("internal error: SHA-1 not available.", e);
}
}
}
......@@ -151,7 +151,8 @@ abstract class SeedGenerator {
try {
md = MessageDigest.getInstance("SHA");
} catch (NoSuchAlgorithmException nsae) {
throw new InternalError("internal error: SHA-1 not available.");
throw new InternalError("internal error: SHA-1 not available."
, nsae);
}
// The current time in millis
......@@ -258,7 +259,8 @@ abstract class SeedGenerator {
try {
digest = MessageDigest.getInstance("SHA");
} catch (NoSuchAlgorithmException e) {
throw new InternalError("internal error: SHA-1 not available.");
throw new InternalError("internal error: SHA-1 not available."
, e);
}
final ThreadGroup[] finalsg = new ThreadGroup[1];
......@@ -311,7 +313,8 @@ abstract class SeedGenerator {
t.start();
} catch (Exception e) {
throw new InternalError("internal error: " +
"SeedGenerator thread creation error.");
"SeedGenerator thread creation error."
, e);
}
// We wait 250milli quanta, so the minimum wait time
......@@ -344,7 +347,8 @@ abstract class SeedGenerator {
}
} catch (Exception e) {
throw new InternalError("internal error: " +
"SeedGenerator thread generated an exception.");
"SeedGenerator thread generated an exception."
, e);
}
}
......@@ -367,7 +371,8 @@ abstract class SeedGenerator {
} catch (Exception e) {
if (count <= 0)
throw new InternalError("internal error: " +
"SeedGenerator thread generated an exception.");
"SeedGenerator thread generated an exception."
,e);
}
synchronized(this) {
......@@ -533,7 +538,7 @@ abstract class SeedGenerator {
} catch (IOException ioe) {
throw new InternalError("URLSeedGenerator " + deviceName +
" generated exception: " +
ioe.getMessage());
ioe.getMessage(), ioe);
}
}
......
......@@ -262,7 +262,7 @@ class ForwardState implements State {
= (HashSet<GeneralNameInterface>)subjectNamesTraversed.clone();
return clonedState;
} catch (CloneNotSupportedException e) {
throw new InternalError(e.toString());
throw new InternalError(e.toString(), e);
}
}
}
......@@ -394,7 +394,7 @@ class ReverseState implements State {
return clonedState;
} catch (CloneNotSupportedException e) {
throw new InternalError(e.toString());
throw new InternalError(e.toString(), e);
}
}
}
......@@ -494,7 +494,7 @@ class URICertStore extends CertStoreSpi {
return super.clone();
} catch (CloneNotSupportedException e) {
/* Cannot happen */
throw new InternalError(e.toString());
throw new InternalError(e.toString(), e);
}
}
}
......
......@@ -127,10 +127,8 @@ public final class SecurityConstants {
// AWT present
try {
return (PermissionFactory<?>)c.newInstance();
} catch (InstantiationException x) {
throw new InternalError(x.getMessage());
} catch (IllegalAccessException x) {
throw new InternalError(x.getMessage());
} catch (ReflectiveOperationException x) {
throw new InternalError(x.getMessage(), x);
}
} else {
// AWT not present
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册