7084245: Update usages of InternalError to use exception chaining
authorsherman
Tue, 30 Aug 2011 11:53:11 -0700
changeset 10419 12c063b39232
parent 10418 1d57022fdb6e
child 10420 924705f0b73f
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
jdk/src/share/classes/com/sun/imageio/plugins/jpeg/JFIFMarkerSegment.java
jdk/src/share/classes/com/sun/jmx/snmp/SnmpCounter64.java
jdk/src/share/classes/com/sun/jmx/snmp/SnmpInt.java
jdk/src/share/classes/com/sun/jmx/snmp/SnmpNull.java
jdk/src/share/classes/com/sun/jmx/snmp/SnmpString.java
jdk/src/share/classes/com/sun/jmx/snmp/daemon/SnmpRequestHandler.java
jdk/src/share/classes/com/sun/servicetag/BrowserSupport.java
jdk/src/share/classes/com/sun/servicetag/RegistrationDocument.java
jdk/src/share/classes/java/awt/BufferCapabilities.java
jdk/src/share/classes/java/awt/Component.java
jdk/src/share/classes/java/awt/GridBagConstraints.java
jdk/src/share/classes/java/awt/ImageCapabilities.java
jdk/src/share/classes/java/awt/Insets.java
jdk/src/share/classes/java/awt/JobAttributes.java
jdk/src/share/classes/java/awt/PageAttributes.java
jdk/src/share/classes/java/awt/RenderingHints.java
jdk/src/share/classes/java/awt/font/TextLayout.java
jdk/src/share/classes/java/awt/geom/AffineTransform.java
jdk/src/share/classes/java/awt/geom/CubicCurve2D.java
jdk/src/share/classes/java/awt/geom/Dimension2D.java
jdk/src/share/classes/java/awt/geom/Line2D.java
jdk/src/share/classes/java/awt/geom/Point2D.java
jdk/src/share/classes/java/awt/geom/QuadCurve2D.java
jdk/src/share/classes/java/awt/geom/RectangularShape.java
jdk/src/share/classes/java/awt/image/ImageFilter.java
jdk/src/share/classes/java/awt/image/Kernel.java
jdk/src/share/classes/java/io/ObjectStreamClass.java
jdk/src/share/classes/java/lang/CharacterName.java
jdk/src/share/classes/java/lang/Class.java
jdk/src/share/classes/java/lang/invoke/CallSite.java
jdk/src/share/classes/java/lang/invoke/Invokers.java
jdk/src/share/classes/java/lang/invoke/MemberName.java
jdk/src/share/classes/java/lang/invoke/MethodHandleStatics.java
jdk/src/share/classes/java/lang/invoke/MethodTypeForm.java
jdk/src/share/classes/java/lang/reflect/Proxy.java
jdk/src/share/classes/java/rmi/dgc/VMID.java
jdk/src/share/classes/java/security/cert/CollectionCertStoreParameters.java
jdk/src/share/classes/java/security/cert/LDAPCertStoreParameters.java
jdk/src/share/classes/java/security/cert/PKIXCertPathChecker.java
jdk/src/share/classes/java/security/cert/PKIXCertPathValidatorResult.java
jdk/src/share/classes/java/security/cert/PKIXParameters.java
jdk/src/share/classes/java/security/cert/X509CRLSelector.java
jdk/src/share/classes/java/security/cert/X509CertSelector.java
jdk/src/share/classes/java/text/AttributedString.java
jdk/src/share/classes/java/text/BreakDictionary.java
jdk/src/share/classes/java/text/BreakIterator.java
jdk/src/share/classes/java/text/Collator.java
jdk/src/share/classes/java/text/DateFormatSymbols.java
jdk/src/share/classes/java/text/DecimalFormat.java
jdk/src/share/classes/java/text/DecimalFormatSymbols.java
jdk/src/share/classes/java/text/DigitList.java
jdk/src/share/classes/java/text/Format.java
jdk/src/share/classes/java/text/RuleBasedBreakIterator.java
jdk/src/share/classes/java/text/StringCharacterIterator.java
jdk/src/share/classes/java/util/ArrayList.java
jdk/src/share/classes/java/util/BitSet.java
jdk/src/share/classes/java/util/Calendar.java
jdk/src/share/classes/java/util/Currency.java
jdk/src/share/classes/java/util/HashSet.java
jdk/src/share/classes/java/util/Hashtable.java
jdk/src/share/classes/java/util/IdentityHashMap.java
jdk/src/share/classes/java/util/LinkedList.java
jdk/src/share/classes/java/util/Locale.java
jdk/src/share/classes/java/util/ResourceBundle.java
jdk/src/share/classes/java/util/TimeZone.java
jdk/src/share/classes/java/util/TreeMap.java
jdk/src/share/classes/java/util/TreeSet.java
jdk/src/share/classes/java/util/UUID.java
jdk/src/share/classes/java/util/Vector.java
jdk/src/share/classes/java/util/zip/ZipEntry.java
jdk/src/share/classes/javax/management/openmbean/TabularDataSupport.java
jdk/src/share/classes/javax/swing/text/ElementIterator.java
jdk/src/share/classes/javax/swing/text/rtf/RTFReader.java
jdk/src/share/classes/sun/dc/DuctusRenderingEngine.java
jdk/src/share/classes/sun/font/FontLineMetrics.java
jdk/src/share/classes/sun/font/GlyphLayout.java
jdk/src/share/classes/sun/invoke/util/ValueConversions.java
jdk/src/share/classes/sun/java2d/pipe/LoopPipe.java
jdk/src/share/classes/sun/management/counter/perf/PerfDataEntry.java
jdk/src/share/classes/sun/management/counter/perf/PerfDataType.java
jdk/src/share/classes/sun/misc/Launcher.java
jdk/src/share/classes/sun/misc/ProxyGenerator.java
jdk/src/share/classes/sun/net/NetworkClient.java
jdk/src/share/classes/sun/net/NetworkServer.java
jdk/src/share/classes/sun/net/ftp/impl/FtpClient.java
jdk/src/share/classes/sun/net/smtp/SmtpClient.java
jdk/src/share/classes/sun/net/www/http/ChunkedOutputStream.java
jdk/src/share/classes/sun/net/www/http/HttpClient.java
jdk/src/share/classes/sun/net/www/protocol/gopher/GopherClient.java
jdk/src/share/classes/sun/net/www/protocol/https/HttpsClient.java
jdk/src/share/classes/sun/nio/ch/Util.java
jdk/src/share/classes/sun/reflect/UTF8.java
jdk/src/share/classes/sun/reflect/misc/MethodUtil.java
jdk/src/share/classes/sun/rmi/transport/LiveRef.java
jdk/src/share/classes/sun/security/provider/SecureRandom.java
jdk/src/share/classes/sun/security/provider/SeedGenerator.java
jdk/src/share/classes/sun/security/provider/certpath/ForwardState.java
jdk/src/share/classes/sun/security/provider/certpath/ReverseState.java
jdk/src/share/classes/sun/security/provider/certpath/URICertStore.java
jdk/src/share/classes/sun/security/util/SecurityConstants.java
jdk/src/share/classes/sun/text/CompactByteArray.java
jdk/src/share/classes/sun/text/normalizer/NormalizerBase.java
jdk/src/share/classes/sun/tools/attach/HotSpotAttachProvider.java
jdk/src/share/classes/sun/tools/attach/HotSpotVirtualMachine.java
jdk/src/share/classes/sun/tools/jconsole/LocalVirtualMachine.java
jdk/src/share/classes/sun/tools/tree/Node.java
jdk/src/share/classes/sun/tracing/dtrace/DTraceProvider.java
jdk/src/share/classes/sun/util/calendar/CalendarDate.java
jdk/src/solaris/classes/sun/awt/X11/XBaseMenuWindow.java
jdk/src/solaris/classes/sun/awt/X11/XMenuItemPeer.java
jdk/src/solaris/classes/sun/nio/ch/InheritedChannel.java
jdk/src/solaris/classes/sun/tools/attach/LinuxVirtualMachine.java
--- a/jdk/src/share/classes/com/sun/imageio/plugins/jpeg/JFIFMarkerSegment.java	Tue Aug 30 14:41:12 2011 +0100
+++ b/jdk/src/share/classes/com/sun/imageio/plugins/jpeg/JFIFMarkerSegment.java	Tue Aug 30 11:53:11 2011 -0700
@@ -763,7 +763,7 @@
                 }
             } catch (IllegalThumbException e) {
                 // Should never happen
-                throw new InternalError("Illegal thumb in setThumbnail!");
+                throw new InternalError("Illegal thumb in setThumbnail!", e);
             }
         }
 
--- a/jdk/src/share/classes/com/sun/jmx/snmp/SnmpCounter64.java	Tue Aug 30 14:41:12 2011 +0100
+++ b/jdk/src/share/classes/com/sun/jmx/snmp/SnmpCounter64.java	Tue Aug 30 11:53:11 2011 -0700
@@ -186,7 +186,7 @@
             newclone = (SnmpCounter64) super.clone() ;
             newclone.value = value ;
         } catch (CloneNotSupportedException e) {
-            throw new InternalError() ; // vm bug.
+            throw new InternalError(e) ; // vm bug.
         }
         return newclone ;
     }
--- a/jdk/src/share/classes/com/sun/jmx/snmp/SnmpInt.java	Tue Aug 30 14:41:12 2011 +0100
+++ b/jdk/src/share/classes/com/sun/jmx/snmp/SnmpInt.java	Tue Aug 30 11:53:11 2011 -0700
@@ -232,7 +232,7 @@
             newclone = (SnmpInt) super.clone() ;
             newclone.value = value ;
         } catch (CloneNotSupportedException e) {
-            throw new InternalError() ; // vm bug.
+            throw new InternalError(e) ; // vm bug.
         }
         return newclone ;
     }
--- a/jdk/src/share/classes/com/sun/jmx/snmp/SnmpNull.java	Tue Aug 30 14:41:12 2011 +0100
+++ b/jdk/src/share/classes/com/sun/jmx/snmp/SnmpNull.java	Tue Aug 30 11:53:11 2011 -0700
@@ -129,7 +129,7 @@
             newclone = (SnmpNull) super.clone() ;
             newclone.tag = tag ;
         } catch (CloneNotSupportedException e) {
-            throw new InternalError() ; // vm bug.
+            throw new InternalError(e) ; // vm bug.
         }
         return newclone ;
     }
--- a/jdk/src/share/classes/com/sun/jmx/snmp/SnmpString.java	Tue Aug 30 14:41:12 2011 +0100
+++ b/jdk/src/share/classes/com/sun/jmx/snmp/SnmpString.java	Tue Aug 30 11:53:11 2011 -0700
@@ -250,7 +250,7 @@
             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 ;
     }
--- a/jdk/src/share/classes/com/sun/jmx/snmp/daemon/SnmpRequestHandler.java	Tue Aug 30 14:41:12 2011 +0100
+++ b/jdk/src/share/classes/com/sun/jmx/snmp/daemon/SnmpRequestHandler.java	Tue Aug 30 11:53:11 2011 -0700
@@ -921,7 +921,7 @@
                 SNMP_ADAPTOR_LOGGER.logp(Level.FINEST, dbgTag,
                    "newTooBigMessage", "Internal error", x);
             }
-            throw new InternalError() ;
+            throw new InternalError(x) ;
         }
 
         return result ;
--- a/jdk/src/share/classes/com/sun/servicetag/BrowserSupport.java	Tue Aug 30 14:41:12 2011 +0100
+++ b/jdk/src/share/classes/com/sun/servicetag/BrowserSupport.java	Tue Aug 30 11:53:11 2011 -0700
@@ -77,9 +77,7 @@
                         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 @@
                 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 @@
             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) {
--- a/jdk/src/share/classes/com/sun/servicetag/RegistrationDocument.java	Tue Aug 30 14:41:12 2011 +0100
+++ b/jdk/src/share/classes/com/sun/servicetag/RegistrationDocument.java	Tue Aug 30 11:53:11 2011 -0700
@@ -150,9 +150,7 @@
         } 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 @@
         } 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 @@
                 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);
         }
     }
 
--- a/jdk/src/share/classes/java/awt/BufferCapabilities.java	Tue Aug 30 14:41:12 2011 +0100
+++ b/jdk/src/share/classes/java/awt/BufferCapabilities.java	Tue Aug 30 11:53:11 2011 -0700
@@ -137,7 +137,7 @@
             return super.clone();
         } catch (CloneNotSupportedException e) {
             // Since we implement Cloneable, this should never happen
-            throw new InternalError();
+            throw new InternalError(e);
         }
     }
 
--- a/jdk/src/share/classes/java/awt/Component.java	Tue Aug 30 14:41:12 2011 +0100
+++ b/jdk/src/share/classes/java/awt/Component.java	Tue Aug 30 11:53:11 2011 -0700
@@ -3776,11 +3776,10 @@
             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");
+            // Code should never reach here (an unaccelerated blitting
+            // strategy should always work)
+            throw new InternalError("Could not create a buffer strategy", e);
+        }
     }
 
     /**
--- a/jdk/src/share/classes/java/awt/GridBagConstraints.java	Tue Aug 30 14:41:12 2011 +0100
+++ b/jdk/src/share/classes/java/awt/GridBagConstraints.java	Tue Aug 30 11:53:11 2011 -0700
@@ -653,7 +653,7 @@
             return c;
         } catch (CloneNotSupportedException e) {
             // this shouldn't happen, since we are Cloneable
-            throw new InternalError();
+            throw new InternalError(e);
         }
     }
 
--- a/jdk/src/share/classes/java/awt/ImageCapabilities.java	Tue Aug 30 14:41:12 2011 +0100
+++ b/jdk/src/share/classes/java/awt/ImageCapabilities.java	Tue Aug 30 11:53:11 2011 -0700
@@ -74,7 +74,7 @@
             return super.clone();
         } catch (CloneNotSupportedException e) {
             // Since we implement Cloneable, this should never happen
-            throw new InternalError();
+            throw new InternalError(e);
         }
     }
 
--- a/jdk/src/share/classes/java/awt/Insets.java	Tue Aug 30 14:41:12 2011 +0100
+++ b/jdk/src/share/classes/java/awt/Insets.java	Tue Aug 30 11:53:11 2011 -0700
@@ -177,7 +177,7 @@
             return super.clone();
         } catch (CloneNotSupportedException e) {
             // this shouldn't happen, since we are Cloneable
-            throw new InternalError();
+            throw new InternalError(e);
         }
     }
     /**
--- a/jdk/src/share/classes/java/awt/JobAttributes.java	Tue Aug 30 14:41:12 2011 +0100
+++ b/jdk/src/share/classes/java/awt/JobAttributes.java	Tue Aug 30 11:53:11 2011 -0700
@@ -361,7 +361,7 @@
             return super.clone();
         } catch (CloneNotSupportedException e) {
             // Since we implement Cloneable, this should never happen
-            throw new InternalError();
+            throw new InternalError(e);
         }
     }
 
--- a/jdk/src/share/classes/java/awt/PageAttributes.java	Tue Aug 30 14:41:12 2011 +0100
+++ b/jdk/src/share/classes/java/awt/PageAttributes.java	Tue Aug 30 11:53:11 2011 -0700
@@ -969,7 +969,7 @@
             return super.clone();
         } catch (CloneNotSupportedException e) {
             // Since we implement Cloneable, this should never happen
-            throw new InternalError();
+            throw new InternalError(e);
         }
     }
 
--- a/jdk/src/share/classes/java/awt/RenderingHints.java	Tue Aug 30 14:41:12 2011 +0100
+++ b/jdk/src/share/classes/java/awt/RenderingHints.java	Tue Aug 30 11:53:11 2011 -0700
@@ -1276,7 +1276,7 @@
             }
         } catch (CloneNotSupportedException e) {
             // this shouldn't happen, since we are Cloneable
-            throw new InternalError();
+            throw new InternalError(e);
         }
 
         return rh;
--- a/jdk/src/share/classes/java/awt/font/TextLayout.java	Tue Aug 30 14:41:12 2011 +0100
+++ b/jdk/src/share/classes/java/awt/font/TextLayout.java	Tue Aug 30 11:53:11 2011 -0700
@@ -753,7 +753,7 @@
             return super.clone();
         }
         catch (CloneNotSupportedException e) {
-            throw new InternalError();
+            throw new InternalError(e);
         }
     }
 
--- a/jdk/src/share/classes/java/awt/geom/AffineTransform.java	Tue Aug 30 14:41:12 2011 +0100
+++ b/jdk/src/share/classes/java/awt/geom/AffineTransform.java	Tue Aug 30 11:53:11 2011 -0700
@@ -3856,7 +3856,7 @@
             return super.clone();
         } catch (CloneNotSupportedException e) {
             // this shouldn't happen, since we are Cloneable
-            throw new InternalError();
+            throw new InternalError(e);
         }
     }
 
--- a/jdk/src/share/classes/java/awt/geom/CubicCurve2D.java	Tue Aug 30 14:41:12 2011 +0100
+++ b/jdk/src/share/classes/java/awt/geom/CubicCurve2D.java	Tue Aug 30 11:53:11 2011 -0700
@@ -1569,7 +1569,7 @@
             return super.clone();
         } catch (CloneNotSupportedException e) {
             // this shouldn't happen, since we are Cloneable
-            throw new InternalError();
+            throw new InternalError(e);
         }
     }
 }
--- a/jdk/src/share/classes/java/awt/geom/Dimension2D.java	Tue Aug 30 14:41:12 2011 +0100
+++ b/jdk/src/share/classes/java/awt/geom/Dimension2D.java	Tue Aug 30 11:53:11 2011 -0700
@@ -108,7 +108,7 @@
             return super.clone();
         } catch (CloneNotSupportedException e) {
             // this shouldn't happen, since we are Cloneable
-            throw new InternalError();
+            throw new InternalError(e);
         }
     }
 }
--- a/jdk/src/share/classes/java/awt/geom/Line2D.java	Tue Aug 30 14:41:12 2011 +0100
+++ b/jdk/src/share/classes/java/awt/geom/Line2D.java	Tue Aug 30 11:53:11 2011 -0700
@@ -1122,7 +1122,7 @@
             return super.clone();
         } catch (CloneNotSupportedException e) {
             // this shouldn't happen, since we are Cloneable
-            throw new InternalError();
+            throw new InternalError(e);
         }
     }
 }
--- a/jdk/src/share/classes/java/awt/geom/Point2D.java	Tue Aug 30 14:41:12 2011 +0100
+++ b/jdk/src/share/classes/java/awt/geom/Point2D.java	Tue Aug 30 11:53:11 2011 -0700
@@ -393,7 +393,7 @@
             return super.clone();
         } catch (CloneNotSupportedException e) {
             // this shouldn't happen, since we are Cloneable
-            throw new InternalError();
+            throw new InternalError(e);
         }
     }
 
--- a/jdk/src/share/classes/java/awt/geom/QuadCurve2D.java	Tue Aug 30 14:41:12 2011 +0100
+++ b/jdk/src/share/classes/java/awt/geom/QuadCurve2D.java	Tue Aug 30 11:53:11 2011 -0700
@@ -1395,7 +1395,7 @@
             return super.clone();
         } catch (CloneNotSupportedException e) {
             // this shouldn't happen, since we are Cloneable
-            throw new InternalError();
+            throw new InternalError(e);
         }
     }
 }
--- a/jdk/src/share/classes/java/awt/geom/RectangularShape.java	Tue Aug 30 14:41:12 2011 +0100
+++ b/jdk/src/share/classes/java/awt/geom/RectangularShape.java	Tue Aug 30 11:53:11 2011 -0700
@@ -391,7 +391,7 @@
             return super.clone();
         } catch (CloneNotSupportedException e) {
             // this shouldn't happen, since we are Cloneable
-            throw new InternalError();
+            throw new InternalError(e);
         }
     }
 }
--- a/jdk/src/share/classes/java/awt/image/ImageFilter.java	Tue Aug 30 14:41:12 2011 +0100
+++ b/jdk/src/share/classes/java/awt/image/ImageFilter.java	Tue Aug 30 11:53:11 2011 -0700
@@ -252,7 +252,7 @@
             return super.clone();
         } catch (CloneNotSupportedException e) {
             // this shouldn't happen, since we are Cloneable
-            throw new InternalError();
+            throw new InternalError(e);
         }
     }
 }
--- a/jdk/src/share/classes/java/awt/image/Kernel.java	Tue Aug 30 14:41:12 2011 +0100
+++ b/jdk/src/share/classes/java/awt/image/Kernel.java	Tue Aug 30 11:53:11 2011 -0700
@@ -147,7 +147,7 @@
             return super.clone();
         } catch (CloneNotSupportedException e) {
             // this shouldn't happen, since we are Cloneable
-            throw new InternalError();
+            throw new InternalError(e);
         }
     }
 }
--- a/jdk/src/share/classes/java/io/ObjectStreamClass.java	Tue Aug 30 14:41:12 2011 +0100
+++ b/jdk/src/share/classes/java/io/ObjectStreamClass.java	Tue Aug 30 11:53:11 2011 -0700
@@ -478,7 +478,7 @@
             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 @@
                 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 @@
                 }
             } 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 @@
                 }
             } 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 @@
                 }
             } 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 @@
                     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 @@
                     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 @@
             }
             return hash;
         } catch (IOException ex) {
-            throw new InternalError();
+            throw new InternalError(ex);
         } catch (NoSuchAlgorithmException ex) {
             throw new SecurityException(ex.getMessage());
         }
--- a/jdk/src/share/classes/java/lang/CharacterName.java	Tue Aug 30 14:41:12 2011 +0100
+++ b/jdk/src/share/classes/java/lang/CharacterName.java	Tue Aug 30 11:53:11 2011 -0700
@@ -83,7 +83,7 @@
             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)
--- a/jdk/src/share/classes/java/lang/Class.java	Tue Aug 30 14:41:12 2011 +0100
+++ b/jdk/src/share/classes/java/lang/Class.java	Tue Aug 30 11:53:11 2011 -0700
@@ -974,8 +974,7 @@
                 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 @@
         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);
         }
     }
 
--- a/jdk/src/share/classes/java/lang/invoke/CallSite.java	Tue Aug 30 14:41:12 2011 +0100
+++ b/jdk/src/share/classes/java/lang/invoke/CallSite.java	Tue Aug 30 11:53:11 2011 -0700
@@ -27,7 +27,6 @@
 
 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 @@
         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);
         }
     }
 
--- a/jdk/src/share/classes/java/lang/invoke/Invokers.java	Tue Aug 30 14:41:12 2011 +0100
+++ b/jdk/src/share/classes/java/lang/invoke/Invokers.java	Tue Aug 30 11:53:11 2011 -0700
@@ -88,7 +88,7 @@
         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());
--- a/jdk/src/share/classes/java/lang/invoke/MemberName.java	Tue Aug 30 14:41:12 2011 +0100
+++ b/jdk/src/share/classes/java/lang/invoke/MemberName.java	Tue Aug 30 11:53:11 2011 -0700
@@ -382,7 +382,7 @@
         try {
             return (MemberName) super.clone();
         } catch (CloneNotSupportedException ex) {
-            throw new InternalError();
+            throw new InternalError(ex);
         }
      }
 
--- a/jdk/src/share/classes/java/lang/invoke/MethodHandleStatics.java	Tue Aug 30 14:41:12 2011 +0100
+++ b/jdk/src/share/classes/java/lang/invoke/MethodHandleStatics.java	Tue Aug 30 11:53:11 2011 -0700
@@ -108,9 +108,7 @@
         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;
--- a/jdk/src/share/classes/java/lang/invoke/MethodTypeForm.java	Tue Aug 30 14:41:12 2011 +0100
+++ b/jdk/src/share/classes/java/lang/invoke/MethodTypeForm.java	Tue Aug 30 11:53:11 2011 -0700
@@ -461,7 +461,7 @@
             // 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;
         }
--- a/jdk/src/share/classes/java/lang/reflect/Proxy.java	Tue Aug 30 14:41:12 2011 +0100
+++ b/jdk/src/share/classes/java/lang/reflect/Proxy.java	Tue Aug 30 11:53:11 2011 -0700
@@ -610,7 +610,7 @@
                  IllegalAccessException |
                  InstantiationException |
                  InvocationTargetException e) {
-            throw new InternalError(e.toString());
+            throw new InternalError(e.toString(), e);
         }
     }
 
--- a/jdk/src/share/classes/java/rmi/dgc/VMID.java	Tue Aug 30 14:41:12 2011 +0100
+++ b/jdk/src/share/classes/java/rmi/dgc/VMID.java	Tue Aug 30 11:53:11 2011 -0700
@@ -170,7 +170,7 @@
             /* 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;
     }
--- a/jdk/src/share/classes/java/security/cert/CollectionCertStoreParameters.java	Tue Aug 30 14:41:12 2011 +0100
+++ b/jdk/src/share/classes/java/security/cert/CollectionCertStoreParameters.java	Tue Aug 30 11:53:11 2011 -0700
@@ -122,7 +122,7 @@
             return super.clone();
         } catch (CloneNotSupportedException e) {
             /* Cannot happen */
-            throw new InternalError(e.toString());
+            throw new InternalError(e.toString(), e);
         }
     }
 
--- a/jdk/src/share/classes/java/security/cert/LDAPCertStoreParameters.java	Tue Aug 30 14:41:12 2011 +0100
+++ b/jdk/src/share/classes/java/security/cert/LDAPCertStoreParameters.java	Tue Aug 30 11:53:11 2011 -0700
@@ -128,7 +128,7 @@
             return super.clone();
         } catch (CloneNotSupportedException e) {
             /* Cannot happen */
-            throw new InternalError(e.toString());
+            throw new InternalError(e.toString(), e);
         }
     }
 
--- a/jdk/src/share/classes/java/security/cert/PKIXCertPathChecker.java	Tue Aug 30 14:41:12 2011 +0100
+++ b/jdk/src/share/classes/java/security/cert/PKIXCertPathChecker.java	Tue Aug 30 11:53:11 2011 -0700
@@ -175,7 +175,7 @@
             return super.clone();
         } catch (CloneNotSupportedException e) {
             /* Cannot happen */
-            throw new InternalError(e.toString());
+            throw new InternalError(e.toString(), e);
         }
     }
 }
--- a/jdk/src/share/classes/java/security/cert/PKIXCertPathValidatorResult.java	Tue Aug 30 14:41:12 2011 +0100
+++ b/jdk/src/share/classes/java/security/cert/PKIXCertPathValidatorResult.java	Tue Aug 30 11:53:11 2011 -0700
@@ -136,7 +136,7 @@
             return super.clone();
         } catch (CloneNotSupportedException e) {
             /* Cannot happen */
-            throw new InternalError(e.toString());
+            throw new InternalError(e.toString(), e);
         }
     }
 
--- a/jdk/src/share/classes/java/security/cert/PKIXParameters.java	Tue Aug 30 14:41:12 2011 +0100
+++ b/jdk/src/share/classes/java/security/cert/PKIXParameters.java	Tue Aug 30 11:53:11 2011 -0700
@@ -683,7 +683,7 @@
             return copy;
         } catch (CloneNotSupportedException e) {
             /* Cannot happen */
-            throw new InternalError(e.toString());
+            throw new InternalError(e.toString(), e);
         }
     }
 
--- a/jdk/src/share/classes/java/security/cert/X509CRLSelector.java	Tue Aug 30 14:41:12 2011 +0100
+++ b/jdk/src/share/classes/java/security/cert/X509CRLSelector.java	Tue Aug 30 11:53:11 2011 -0700
@@ -708,7 +708,7 @@
             return copy;
         } catch (CloneNotSupportedException e) {
             /* Cannot happen */
-            throw new InternalError(e.toString());
+            throw new InternalError(e.toString(), e);
         }
     }
 }
--- a/jdk/src/share/classes/java/security/cert/X509CertSelector.java	Tue Aug 30 14:41:12 2011 +0100
+++ b/jdk/src/share/classes/java/security/cert/X509CertSelector.java	Tue Aug 30 11:53:11 2011 -0700
@@ -2615,7 +2615,7 @@
             return copy;
         } catch (CloneNotSupportedException e) {
             /* Cannot happen */
-            throw new InternalError(e.toString());
+            throw new InternalError(e.toString(), e);
         }
     }
 }
--- a/jdk/src/share/classes/java/text/AttributedString.java	Tue Aug 30 14:41:12 2011 +0100
+++ b/jdk/src/share/classes/java/text/AttributedString.java	Tue Aug 30 11:53:11 2011 -0700
@@ -794,7 +794,7 @@
                 return other;
             }
             catch (CloneNotSupportedException e) {
-                throw new InternalError();
+                throw new InternalError(e);
             }
         }
 
--- a/jdk/src/share/classes/java/text/BreakDictionary.java	Tue Aug 30 14:41:12 2011 +0100
+++ b/jdk/src/share/classes/java/text/BreakDictionary.java	Tue Aug 30 11:53:11 2011 -0700
@@ -154,7 +154,7 @@
             );
         }
         catch (PrivilegedActionException e) {
-            throw new InternalError(e.toString());
+            throw new InternalError(e.toString(), e);
         }
 
         byte[] buf = new byte[8];
--- a/jdk/src/share/classes/java/text/BreakIterator.java	Tue Aug 30 14:41:12 2011 +0100
+++ b/jdk/src/share/classes/java/text/BreakIterator.java	Tue Aug 30 11:53:11 2011 -0700
@@ -254,7 +254,7 @@
             return super.clone();
         }
         catch (CloneNotSupportedException e) {
-            throw new InternalError();
+            throw new InternalError(e);
         }
     }
 
@@ -617,7 +617,7 @@
             }
         }
         catch (Exception e) {
-            throw new InternalError(e.toString());
+            throw new InternalError(e.toString(), e);
         }
     }
 
--- a/jdk/src/share/classes/java/text/Collator.java	Tue Aug 30 14:41:12 2011 +0100
+++ b/jdk/src/share/classes/java/text/Collator.java	Tue Aug 30 11:53:11 2011 -0700
@@ -461,7 +461,7 @@
         try {
             return (Collator)super.clone();
         } catch (CloneNotSupportedException e) {
-            throw new InternalError();
+            throw new InternalError(e);
         }
     }
 
--- a/jdk/src/share/classes/java/text/DateFormatSymbols.java	Tue Aug 30 14:41:12 2011 +0100
+++ b/jdk/src/share/classes/java/text/DateFormatSymbols.java	Tue Aug 30 11:53:11 2011 -0700
@@ -597,7 +597,7 @@
             copyMembers(this, other);
             return other;
         } catch (CloneNotSupportedException e) {
-            throw new InternalError();
+            throw new InternalError(e);
         }
     }
 
--- a/jdk/src/share/classes/java/text/DecimalFormat.java	Tue Aug 30 14:41:12 2011 +0100
+++ b/jdk/src/share/classes/java/text/DecimalFormat.java	Tue Aug 30 11:53:11 2011 -0700
@@ -1891,14 +1891,10 @@
      * 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;
     }
 
     /**
--- a/jdk/src/share/classes/java/text/DecimalFormatSymbols.java	Tue Aug 30 14:41:12 2011 +0100
+++ b/jdk/src/share/classes/java/text/DecimalFormatSymbols.java	Tue Aug 30 11:53:11 2011 -0700
@@ -479,7 +479,7 @@
             return (DecimalFormatSymbols)super.clone();
             // other fields are bit-copied
         } catch (CloneNotSupportedException e) {
-            throw new InternalError();
+            throw new InternalError(e);
         }
     }
 
--- a/jdk/src/share/classes/java/text/DigitList.java	Tue Aug 30 14:41:12 2011 +0100
+++ b/jdk/src/share/classes/java/text/DigitList.java	Tue Aug 30 11:53:11 2011 -0700
@@ -632,7 +632,7 @@
             other.tempBuffer = null;
             return other;
         } catch (CloneNotSupportedException e) {
-            throw new InternalError();
+            throw new InternalError(e);
         }
     }
 
--- a/jdk/src/share/classes/java/text/Format.java	Tue Aug 30 14:41:12 2011 +0100
+++ b/jdk/src/share/classes/java/text/Format.java	Tue Aug 30 11:53:11 2011 -0700
@@ -258,7 +258,7 @@
             return super.clone();
         } catch (CloneNotSupportedException e) {
             // will never happen
-            return null;
+            throw new InternalError(e);
         }
     }
 
--- a/jdk/src/share/classes/java/text/RuleBasedBreakIterator.java	Tue Aug 30 14:41:12 2011 +0100
+++ b/jdk/src/share/classes/java/text/RuleBasedBreakIterator.java	Tue Aug 30 11:53:11 2011 -0700
@@ -453,7 +453,7 @@
             );
         }
         catch (PrivilegedActionException e) {
-            throw new InternalError(e.toString());
+            throw new InternalError(e.toString(), e);
         }
 
         int offset = 0;
--- a/jdk/src/share/classes/java/text/StringCharacterIterator.java	Tue Aug 30 14:41:12 2011 +0100
+++ b/jdk/src/share/classes/java/text/StringCharacterIterator.java	Tue Aug 30 11:53:11 2011 -0700
@@ -272,7 +272,7 @@
             return other;
         }
         catch (CloneNotSupportedException e) {
-            throw new InternalError();
+            throw new InternalError(e);
         }
     }
 
--- a/jdk/src/share/classes/java/util/ArrayList.java	Tue Aug 30 14:41:12 2011 +0100
+++ b/jdk/src/share/classes/java/util/ArrayList.java	Tue Aug 30 11:53:11 2011 -0700
@@ -307,7 +307,7 @@
             return v;
         } catch (CloneNotSupportedException e) {
             // this shouldn't happen, since we are Cloneable
-            throw new InternalError();
+            throw new InternalError(e);
         }
     }
 
--- a/jdk/src/share/classes/java/util/BitSet.java	Tue Aug 30 14:41:12 2011 +0100
+++ b/jdk/src/share/classes/java/util/BitSet.java	Tue Aug 30 11:53:11 2011 -0700
@@ -1092,7 +1092,7 @@
             result.checkInvariants();
             return result;
         } catch (CloneNotSupportedException e) {
-            throw new InternalError();
+            throw new InternalError(e);
         }
     }
 
--- a/jdk/src/share/classes/java/util/Calendar.java	Tue Aug 30 14:41:12 2011 +0100
+++ b/jdk/src/share/classes/java/util/Calendar.java	Tue Aug 30 11:53:11 2011 -0700
@@ -2512,7 +2512,7 @@
         }
         catch (CloneNotSupportedException e) {
             // this shouldn't happen, since we are Cloneable
-            throw new InternalError();
+            throw new InternalError(e);
         }
     }
 
--- a/jdk/src/share/classes/java/util/Currency.java	Tue Aug 30 14:41:12 2011 +0100
+++ b/jdk/src/share/classes/java/util/Currency.java	Tue Aug 30 11:53:11 2011 -0700
@@ -221,9 +221,7 @@
                     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
--- a/jdk/src/share/classes/java/util/HashSet.java	Tue Aug 30 14:41:12 2011 +0100
+++ b/jdk/src/share/classes/java/util/HashSet.java	Tue Aug 30 11:53:11 2011 -0700
@@ -253,7 +253,7 @@
             newSet.map = (HashMap<E, Object>) map.clone();
             return newSet;
         } catch (CloneNotSupportedException e) {
-            throw new InternalError();
+            throw new InternalError(e);
         }
     }
 
--- a/jdk/src/share/classes/java/util/Hashtable.java	Tue Aug 30 14:41:12 2011 +0100
+++ b/jdk/src/share/classes/java/util/Hashtable.java	Tue Aug 30 11:53:11 2011 -0700
@@ -537,7 +537,7 @@
             return t;
         } catch (CloneNotSupportedException e) {
             // this shouldn't happen, since we are Cloneable
-            throw new InternalError();
+            throw new InternalError(e);
         }
     }
 
--- a/jdk/src/share/classes/java/util/IdentityHashMap.java	Tue Aug 30 14:41:12 2011 +0100
+++ b/jdk/src/share/classes/java/util/IdentityHashMap.java	Tue Aug 30 11:53:11 2011 -0700
@@ -703,7 +703,7 @@
             m.table = table.clone();
             return m;
         } catch (CloneNotSupportedException e) {
-            throw new InternalError();
+            throw new InternalError(e);
         }
     }
 
--- a/jdk/src/share/classes/java/util/LinkedList.java	Tue Aug 30 14:41:12 2011 +0100
+++ b/jdk/src/share/classes/java/util/LinkedList.java	Tue Aug 30 11:53:11 2011 -0700
@@ -994,7 +994,7 @@
         try {
             return (LinkedList<E>) super.clone();
         } catch (CloneNotSupportedException e) {
-            throw new InternalError();
+            throw new InternalError(e);
         }
     }
 
--- a/jdk/src/share/classes/java/util/Locale.java	Tue Aug 30 14:41:12 2011 +0100
+++ b/jdk/src/share/classes/java/util/Locale.java	Tue Aug 30 11:53:11 2011 -0700
@@ -1859,7 +1859,7 @@
             Locale that = (Locale)super.clone();
             return that;
         } catch (CloneNotSupportedException e) {
-            throw new InternalError();
+            throw new InternalError(e);
         }
     }
 
--- a/jdk/src/share/classes/java/util/ResourceBundle.java	Tue Aug 30 14:41:12 2011 +0100
+++ b/jdk/src/share/classes/java/util/ResourceBundle.java	Tue Aug 30 11:53:11 2011 -0700
@@ -614,7 +614,7 @@
                 return clone;
             } catch (CloneNotSupportedException e) {
                 //this should never happen
-                throw new InternalError();
+                throw new InternalError(e);
             }
         }
 
--- a/jdk/src/share/classes/java/util/TimeZone.java	Tue Aug 30 14:41:12 2011 +0100
+++ b/jdk/src/share/classes/java/util/TimeZone.java	Tue Aug 30 11:53:11 2011 -0700
@@ -739,7 +739,7 @@
             other.ID = ID;
             return other;
         } catch (CloneNotSupportedException e) {
-            throw new InternalError();
+            throw new InternalError(e);
         }
     }
 
--- a/jdk/src/share/classes/java/util/TreeMap.java	Tue Aug 30 14:41:12 2011 +0100
+++ b/jdk/src/share/classes/java/util/TreeMap.java	Tue Aug 30 11:53:11 2011 -0700
@@ -622,7 +622,7 @@
         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)
--- a/jdk/src/share/classes/java/util/TreeSet.java	Tue Aug 30 14:41:12 2011 +0100
+++ b/jdk/src/share/classes/java/util/TreeSet.java	Tue Aug 30 11:53:11 2011 -0700
@@ -474,7 +474,7 @@
         try {
             clone = (TreeSet<E>) super.clone();
         } catch (CloneNotSupportedException e) {
-            throw new InternalError();
+            throw new InternalError(e);
         }
 
         clone.m = new TreeMap<>(m);
--- a/jdk/src/share/classes/java/util/UUID.java	Tue Aug 30 14:41:12 2011 +0100
+++ b/jdk/src/share/classes/java/util/UUID.java	Tue Aug 30 11:53:11 2011 -0700
@@ -165,7 +165,7 @@
         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        */
--- a/jdk/src/share/classes/java/util/Vector.java	Tue Aug 30 14:41:12 2011 +0100
+++ b/jdk/src/share/classes/java/util/Vector.java	Tue Aug 30 11:53:11 2011 -0700
@@ -673,7 +673,7 @@
             return v;
         } catch (CloneNotSupportedException e) {
             // this shouldn't happen, since we are Cloneable
-            throw new InternalError();
+            throw new InternalError(e);
         }
     }
 
--- a/jdk/src/share/classes/java/util/zip/ZipEntry.java	Tue Aug 30 14:41:12 2011 +0100
+++ b/jdk/src/share/classes/java/util/zip/ZipEntry.java	Tue Aug 30 11:53:11 2011 -0700
@@ -321,7 +321,7 @@
             return e;
         } catch (CloneNotSupportedException e) {
             // This should never happen, since we are Cloneable
-            throw new InternalError();
+            throw new InternalError(e);
         }
     }
 }
--- a/jdk/src/share/classes/javax/management/openmbean/TabularDataSupport.java	Tue Aug 30 14:41:12 2011 +0100
+++ b/jdk/src/share/classes/javax/management/openmbean/TabularDataSupport.java	Tue Aug 30 11:53:11 2011 -0700
@@ -671,7 +671,7 @@
             return c;
         }
         catch (CloneNotSupportedException e) {
-            throw new InternalError(e.toString());
+            throw new InternalError(e.toString(), e);
         }
     }
 
--- a/jdk/src/share/classes/javax/swing/text/ElementIterator.java	Tue Aug 30 14:41:12 2011 +0100
+++ b/jdk/src/share/classes/javax/swing/text/ElementIterator.java	Tue Aug 30 11:53:11 2011 -0700
@@ -157,7 +157,7 @@
             }
             return it;
         } catch (CloneNotSupportedException e) {
-            throw new InternalError();
+            throw new InternalError(e);
         }
     }
 
--- a/jdk/src/share/classes/javax/swing/text/rtf/RTFReader.java	Tue Aug 30 14:41:12 2011 +0100
+++ b/jdk/src/share/classes/javax/swing/text/rtf/RTFReader.java	Tue Aug 30 11:53:11 2011 -0700
@@ -528,7 +528,7 @@
             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 @@
         } 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 @@
         } 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);
         }
     }
 
--- a/jdk/src/share/classes/sun/dc/DuctusRenderingEngine.java	Tue Aug 30 14:41:12 2011 +0100
+++ b/jdk/src/share/classes/sun/dc/DuctusRenderingEngine.java	Tue Aug 30 11:53:11 2011 -0700
@@ -158,7 +158,7 @@
             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 @@
             consumer.endPath();
         } catch (PathException e) {
             throw new InternalError("Unable to Stroke shape ("+
-                                    e.getMessage()+")");
+                                    e.getMessage()+")", e);
         }
     }
 
--- a/jdk/src/share/classes/sun/font/FontLineMetrics.java	Tue Aug 30 14:41:12 2011 +0100
+++ b/jdk/src/share/classes/sun/font/FontLineMetrics.java	Tue Aug 30 11:53:11 2011 -0700
@@ -113,7 +113,7 @@
             return super.clone();
         }
         catch (CloneNotSupportedException e) {
-            throw new InternalError();
+            throw new InternalError(e);
         }
     }
 }
--- a/jdk/src/share/classes/sun/font/GlyphLayout.java	Tue Aug 30 14:41:12 2011 +0100
+++ b/jdk/src/share/classes/sun/font/GlyphLayout.java	Tue Aug 30 11:53:11 2011 -0700
@@ -233,7 +233,7 @@
                     invdtx = dtx.createInverse();
                 }
                 catch (NoninvertibleTransformException e) {
-                    throw new InternalError();
+                    throw new InternalError(e);
                 }
             }
 
--- a/jdk/src/share/classes/sun/invoke/util/ValueConversions.java	Tue Aug 30 14:41:12 2011 +0100
+++ b/jdk/src/share/classes/sun/invoke/util/ValueConversions.java	Tue Aug 30 11:53:11 2011 -0700
@@ -677,9 +677,7 @@
             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 @@
                 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);
             }
         }
     }
--- a/jdk/src/share/classes/sun/java2d/pipe/LoopPipe.java	Tue Aug 30 14:41:12 2011 +0100
+++ b/jdk/src/share/classes/sun/java2d/pipe/LoopPipe.java	Tue Aug 30 11:53:11 2011 -0700
@@ -281,9 +281,8 @@
         } catch (Throwable t) {
             sr.dispose();
             sr = null;
-            t.printStackTrace();
             throw new InternalError("Unable to Stroke shape ("+
-                                    t.getMessage()+")");
+                                    t.getMessage()+")", t);
         }
         return sr;
     }
--- a/jdk/src/share/classes/sun/management/counter/perf/PerfDataEntry.java	Tue Aug 30 14:41:12 2011 +0100
+++ b/jdk/src/share/classes/sun/management/counter/perf/PerfDataEntry.java	Tue Aug 30 11:53:11 2011 -0700
@@ -133,7 +133,7 @@
         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) {
--- a/jdk/src/share/classes/sun/management/counter/perf/PerfDataType.java	Tue Aug 30 14:41:12 2011 +0100
+++ b/jdk/src/share/classes/sun/management/counter/perf/PerfDataType.java	Tue Aug 30 11:53:11 2011 -0700
@@ -93,7 +93,7 @@
             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);
         }
     }
 }
--- a/jdk/src/share/classes/sun/misc/Launcher.java	Tue Aug 30 14:41:12 2011 +0100
+++ b/jdk/src/share/classes/sun/misc/Launcher.java	Tue Aug 30 11:53:11 2011 -0700
@@ -71,7 +71,7 @@
             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 @@
             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 @@
             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 @@
             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");
         }
     }
 }
--- a/jdk/src/share/classes/sun/misc/ProxyGenerator.java	Tue Aug 30 14:41:12 2011 +0100
+++ b/jdk/src/share/classes/sun/misc/ProxyGenerator.java	Tue Aug 30 11:53:11 2011 -0700
@@ -460,7 +460,7 @@
             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 @@
             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();
--- a/jdk/src/share/classes/sun/net/NetworkClient.java	Tue Aug 30 14:41:12 2011 +0100
+++ b/jdk/src/share/classes/sun/net/NetworkClient.java	Tue Aug 30 11:53:11 2011 -0700
@@ -139,7 +139,7 @@
                                         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());
     }
--- a/jdk/src/share/classes/sun/net/NetworkServer.java	Tue Aug 30 14:41:12 2011 +0100
+++ b/jdk/src/share/classes/sun/net/NetworkServer.java	Tue Aug 30 11:53:11 2011 -0700
@@ -142,7 +142,7 @@
             return super.clone();
         } catch (CloneNotSupportedException e) {
             // this shouldn't happen, since we are Cloneable
-            throw new InternalError();
+            throw new InternalError(e);
         }
     }
 
--- a/jdk/src/share/classes/sun/net/ftp/impl/FtpClient.java	Tue Aug 30 14:41:12 2011 +0100
+++ b/jdk/src/share/classes/sun/net/ftp/impl/FtpClient.java	Tue Aug 30 11:53:11 2011 -0700
@@ -905,7 +905,7 @@
             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 @@
                     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 @@
             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 @@
             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());
 
--- a/jdk/src/share/classes/sun/net/smtp/SmtpClient.java	Tue Aug 30 14:41:12 2011 +0100
+++ b/jdk/src/share/classes/sun/net/smtp/SmtpClient.java	Tue Aug 30 11:53:11 2011 -0700
@@ -134,7 +134,7 @@
         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;
     }
--- a/jdk/src/share/classes/sun/net/www/http/ChunkedOutputStream.java	Tue Aug 30 14:41:12 2011 +0100
+++ b/jdk/src/share/classes/sun/net/www/http/ChunkedOutputStream.java	Tue Aug 30 11:53:11 2011 -0700
@@ -79,7 +79,7 @@
             return header;
         } catch (java.io.UnsupportedEncodingException e) {
             /* This should never happen */
-            throw new InternalError(e.getMessage());
+            throw new InternalError(e.getMessage(), e);
         }
     }
 
--- a/jdk/src/share/classes/sun/net/www/http/HttpClient.java	Tue Aug 30 14:41:12 2011 +0100
+++ b/jdk/src/share/classes/sun/net/www/http/HttpClient.java	Tue Aug 30 11:53:11 2011 -0700
@@ -395,7 +395,7 @@
                 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);
     }
--- a/jdk/src/share/classes/sun/net/www/protocol/gopher/GopherClient.java	Tue Aug 30 14:41:12 2011 +0100
+++ b/jdk/src/share/classes/sun/net/www/protocol/gopher/GopherClient.java	Tue Aug 30 11:53:11 2011 -0700
@@ -324,7 +324,7 @@
            }
 
        } catch (UnsupportedEncodingException e) {
-            throw new InternalError(encoding+ " encoding not found");
+            throw new InternalError(encoding+ " encoding not found", e);
        } catch (IOException e) {
        } finally {
            try {
--- a/jdk/src/share/classes/sun/net/www/protocol/https/HttpsClient.java	Tue Aug 30 14:41:12 2011 +0100
+++ b/jdk/src/share/classes/sun/net/www/protocol/https/HttpsClient.java	Tue Aug 30 11:53:11 2011 -0700
@@ -529,7 +529,7 @@
                     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
--- a/jdk/src/share/classes/sun/nio/ch/Util.java	Tue Aug 30 14:41:12 2011 +0100
+++ b/jdk/src/share/classes/sun/nio/ch/Util.java	Tue Aug 30 11:53:11 2011 -0700
@@ -373,7 +373,7 @@
                              NoSuchMethodException    |
                              IllegalArgumentException |
                              ClassCastException x) {
-                        throw new InternalError();
+                        throw new InternalError(x);
                     }
                     return null;
                 }});
@@ -395,7 +395,7 @@
         } catch (InstantiationException |
                  IllegalAccessException |
                  InvocationTargetException e) {
-            throw new InternalError();
+            throw new InternalError(e);
         }
         return dbb;
     }
@@ -418,7 +418,7 @@
                              NoSuchMethodException |
                              IllegalArgumentException |
                              ClassCastException x) {
-                        throw new InternalError();
+                        throw new InternalError(x);
                     }
                     return null;
                 }});
@@ -440,7 +440,7 @@
         } catch (InstantiationException |
                  IllegalAccessException |
                  InvocationTargetException e) {
-            throw new InternalError();
+            throw new InternalError(e);
         }
         return dbb;
     }
--- a/jdk/src/share/classes/sun/reflect/UTF8.java	Tue Aug 30 14:41:12 2011 +0100
+++ b/jdk/src/share/classes/sun/reflect/UTF8.java	Tue Aug 30 11:53:11 2011 -0700
@@ -52,7 +52,7 @@
             }
         } 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;
     }
--- a/jdk/src/share/classes/sun/reflect/misc/MethodUtil.java	Tue Aug 30 14:41:12 2011 +0100
+++ b/jdk/src/share/classes/sun/reflect/misc/MethodUtil.java	Tue Aug 30 11:53:11 2011 -0700
@@ -292,7 +292,7 @@
                 }
             });
         } catch (Exception e) {
-            throw new InternalError("bouncer cannot be found");
+            throw new InternalError("bouncer cannot be found", e);
         }
     }
 
--- a/jdk/src/share/classes/sun/rmi/transport/LiveRef.java	Tue Aug 30 14:41:12 2011 +0100
+++ b/jdk/src/share/classes/sun/rmi/transport/LiveRef.java	Tue Aug 30 11:53:11 2011 -0700
@@ -111,7 +111,7 @@
             LiveRef newRef = (LiveRef) super.clone();
             return newRef;
         } catch (CloneNotSupportedException e) {
-            throw new InternalError(e.toString());
+            throw new InternalError(e.toString(), e);
         }
     }
 
--- a/jdk/src/share/classes/sun/security/provider/SecureRandom.java	Tue Aug 30 14:41:12 2011 +0100
+++ b/jdk/src/share/classes/sun/security/provider/SecureRandom.java	Tue Aug 30 11:53:11 2011 -0700
@@ -249,7 +249,7 @@
         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);
         }
     }
 }
--- a/jdk/src/share/classes/sun/security/provider/SeedGenerator.java	Tue Aug 30 14:41:12 2011 +0100
+++ b/jdk/src/share/classes/sun/security/provider/SeedGenerator.java	Tue Aug 30 11:53:11 2011 -0700
@@ -151,7 +151,8 @@
         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 @@
             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 @@
                             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 @@
                 }
             } catch (Exception e) {
                 throw new InternalError("internal error: " +
-                                        "SeedGenerator thread generated an exception.");
+                                        "SeedGenerator thread generated an exception."
+                        , e);
             }
         }
 
@@ -367,7 +371,8 @@
             } 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 @@
             } catch (IOException ioe) {
                 throw new InternalError("URLSeedGenerator " + deviceName +
                                         " generated exception: " +
-                                        ioe.getMessage());
+                                        ioe.getMessage(), ioe);
             }
         }
 
--- a/jdk/src/share/classes/sun/security/provider/certpath/ForwardState.java	Tue Aug 30 14:41:12 2011 +0100
+++ b/jdk/src/share/classes/sun/security/provider/certpath/ForwardState.java	Tue Aug 30 11:53:11 2011 -0700
@@ -262,7 +262,7 @@
                 = (HashSet<GeneralNameInterface>)subjectNamesTraversed.clone();
             return clonedState;
         } catch (CloneNotSupportedException e) {
-            throw new InternalError(e.toString());
+            throw new InternalError(e.toString(), e);
         }
     }
 }
--- a/jdk/src/share/classes/sun/security/provider/certpath/ReverseState.java	Tue Aug 30 14:41:12 2011 +0100
+++ b/jdk/src/share/classes/sun/security/provider/certpath/ReverseState.java	Tue Aug 30 11:53:11 2011 -0700
@@ -394,7 +394,7 @@
 
             return clonedState;
         } catch (CloneNotSupportedException e) {
-            throw new InternalError(e.toString());
+            throw new InternalError(e.toString(), e);
         }
     }
 }
--- a/jdk/src/share/classes/sun/security/provider/certpath/URICertStore.java	Tue Aug 30 14:41:12 2011 +0100
+++ b/jdk/src/share/classes/sun/security/provider/certpath/URICertStore.java	Tue Aug 30 11:53:11 2011 -0700
@@ -494,7 +494,7 @@
                 return super.clone();
             } catch (CloneNotSupportedException e) {
                 /* Cannot happen */
-                throw new InternalError(e.toString());
+                throw new InternalError(e.toString(), e);
             }
         }
     }
--- a/jdk/src/share/classes/sun/security/util/SecurityConstants.java	Tue Aug 30 14:41:12 2011 +0100
+++ b/jdk/src/share/classes/sun/security/util/SecurityConstants.java	Tue Aug 30 11:53:11 2011 -0700
@@ -127,10 +127,8 @@
                 // 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
--- a/jdk/src/share/classes/sun/text/CompactByteArray.java	Tue Aug 30 14:41:12 2011 +0100
+++ b/jdk/src/share/classes/sun/text/CompactByteArray.java	Tue Aug 30 11:53:11 2011 -0700
@@ -269,7 +269,7 @@
             if (hashes != null) other.hashes = (int[])hashes.clone();
             return other;
         } catch (CloneNotSupportedException e) {
-            throw new InternalError();
+            throw new InternalError(e);
         }
     }
 
--- a/jdk/src/share/classes/sun/text/normalizer/NormalizerBase.java	Tue Aug 30 14:41:12 2011 +0100
+++ b/jdk/src/share/classes/sun/text/normalizer/NormalizerBase.java	Tue Aug 30 11:53:11 2011 -0700
@@ -636,7 +636,7 @@
             return copy;
         }
         catch (CloneNotSupportedException e) {
-            throw new InternalError(e.toString());
+            throw new InternalError(e.toString(), e);
         }
     }
 
--- a/jdk/src/share/classes/sun/tools/attach/HotSpotAttachProvider.java	Tue Aug 30 14:41:12 2011 +0100
+++ b/jdk/src/share/classes/sun/tools/attach/HotSpotAttachProvider.java	Tue Aug 30 11:53:11 2011 -0700
@@ -89,7 +89,7 @@
             if (t instanceof SecurityException) {
                 return result;
             }
-            throw new InternalError();          // shouldn't happen
+            throw new InternalError(t);          // shouldn't happen
         }
 
         for (Object vmid: vms) {
--- a/jdk/src/share/classes/sun/tools/attach/HotSpotVirtualMachine.java	Tue Aug 30 14:41:12 2011 +0100
+++ b/jdk/src/share/classes/sun/tools/attach/HotSpotVirtualMachine.java	Tue Aug 30 11:53:11 2011 -0700
@@ -102,7 +102,7 @@
         try {
             loadAgentLibrary("instrument", args);
         } catch (AgentLoadException x) {
-            throw new InternalError("instrument library is missing in target VM");
+            throw new InternalError("instrument library is missing in target VM", x);
         } catch (AgentInitializationException x) {
             /*
              * Translate interesting errors into the right exception and
@@ -212,7 +212,7 @@
         try {
             return execute(cmd, args);
         } catch (AgentLoadException x) {
-            throw new InternalError("Should not get here");
+            throw new InternalError("Should not get here", x);
         }
     }
 
--- a/jdk/src/share/classes/sun/tools/jconsole/LocalVirtualMachine.java	Tue Aug 30 14:41:12 2011 +0100
+++ b/jdk/src/share/classes/sun/tools/jconsole/LocalVirtualMachine.java	Tue Aug 30 11:53:11 2011 -0700
@@ -135,10 +135,8 @@
         try {
             host = MonitoredHost.getMonitoredHost(new HostIdentifier((String)null));
             vms = host.activeVms();
-        } catch (java.net.URISyntaxException sx) {
-            throw new InternalError(sx.getMessage());
-        } catch (MonitorException mx) {
-            throw new InternalError(mx.getMessage());
+        } catch (java.net.URISyntaxException | MonitorException x) {
+            throw new InternalError(x.getMessage(), x);
         }
         for (Object vmid: vms) {
             if (vmid instanceof Integer) {
--- a/jdk/src/share/classes/sun/tools/tree/Node.java	Tue Aug 30 14:41:12 2011 +0100
+++ b/jdk/src/share/classes/sun/tools/tree/Node.java	Tue Aug 30 11:53:11 2011 -0700
@@ -108,7 +108,7 @@
             return super.clone();
         } catch (CloneNotSupportedException e) {
             // this shouldn't happen, since we are Cloneable
-            throw new InternalError();
+            throw new InternalError(e);
         }
     }
 
--- a/jdk/src/share/classes/sun/tracing/dtrace/DTraceProvider.java	Tue Aug 30 14:41:12 2011 +0100
+++ b/jdk/src/share/classes/sun/tracing/dtrace/DTraceProvider.java	Tue Aug 30 11:53:11 2011 -0700
@@ -26,18 +26,15 @@
 package sun.tracing.dtrace;
 
 import java.lang.reflect.Method;
-import java.lang.reflect.InvocationTargetException;
 import java.lang.reflect.Modifier;
 import java.lang.reflect.Constructor;
 import java.lang.reflect.InvocationHandler;
 import java.lang.reflect.InvocationTargetException;
 import java.lang.annotation.Annotation;
-import java.util.HashMap;
 
 import sun.tracing.ProviderSkeleton;
 import sun.tracing.ProbeSkeleton;
 import com.sun.tracing.Provider;
-import com.sun.tracing.ProviderName;
 import com.sun.tracing.ProbeName;
 import com.sun.tracing.dtrace.Attributes;
 import com.sun.tracing.dtrace.ModuleName;
@@ -140,14 +137,8 @@
         try {
             Constructor cons = proxyClass.getConstructor(constructorParams);
             return (T)cons.newInstance(new Object[] { this });
-        } catch (NoSuchMethodException e) {
-            throw new InternalError(e.toString());
-        } catch (IllegalAccessException e) {
-            throw new InternalError(e.toString());
-        } catch (InstantiationException e) {
-            throw new InternalError(e.toString());
-        } catch (InvocationTargetException e) {
-            throw new InternalError(e.toString());
+        } catch (ReflectiveOperationException e) {
+            throw new InternalError(e.toString(), e);
         }
     }
 
--- a/jdk/src/share/classes/sun/util/calendar/CalendarDate.java	Tue Aug 30 14:41:12 2011 +0100
+++ b/jdk/src/share/classes/sun/util/calendar/CalendarDate.java	Tue Aug 30 11:53:11 2011 -0700
@@ -435,7 +435,7 @@
             return super.clone();
         } catch (CloneNotSupportedException e) {
             // this shouldn't happen
-            throw new InternalError();
+            throw new InternalError(e);
         }
     }
 
--- a/jdk/src/solaris/classes/sun/awt/X11/XBaseMenuWindow.java	Tue Aug 30 14:41:12 2011 +0100
+++ b/jdk/src/solaris/classes/sun/awt/X11/XBaseMenuWindow.java	Tue Aug 30 11:53:11 2011 -0700
@@ -157,7 +157,7 @@
             try {
                 return super.clone();
             } catch (CloneNotSupportedException ex) {
-                throw new InternalError();
+                throw new InternalError(ex);
             }
         }
 
--- a/jdk/src/solaris/classes/sun/awt/X11/XMenuItemPeer.java	Tue Aug 30 14:41:12 2011 +0100
+++ b/jdk/src/solaris/classes/sun/awt/X11/XMenuItemPeer.java	Tue Aug 30 11:53:11 2011 -0700
@@ -131,7 +131,7 @@
             try {
                 return super.clone();
             } catch (CloneNotSupportedException ex) {
-                throw new InternalError();
+                throw new InternalError(ex);
             }
         }
 
--- a/jdk/src/solaris/classes/sun/nio/ch/InheritedChannel.java	Tue Aug 30 14:41:12 2011 +0100
+++ b/jdk/src/solaris/classes/sun/nio/ch/InheritedChannel.java	Tue Aug 30 11:53:11 2011 -0700
@@ -64,7 +64,7 @@
             dup2(devnull, 2);
         } catch (IOException ioe) {
             // this shouldn't happen
-            throw new InternalError();
+            throw new InternalError(ioe);
         }
     }
 
--- a/jdk/src/solaris/classes/sun/tools/attach/LinuxVirtualMachine.java	Tue Aug 30 14:41:12 2011 +0100
+++ b/jdk/src/solaris/classes/sun/tools/attach/LinuxVirtualMachine.java	Tue Aug 30 11:53:11 2011 -0700
@@ -304,7 +304,7 @@
             try {
                 b = s.getBytes("UTF-8");
             } catch (java.io.UnsupportedEncodingException x) {
-                throw new InternalError();
+                throw new InternalError(x);
             }
             LinuxVirtualMachine.write(fd, b, 0, b.length);
         }