--- openjdk-boot/jdk/src/share/classes/java/io/PrintStream.java.orig +++ openjdk-boot/jdk/src/share/classes/java/io/PrintStream.java @@ -91,7 +91,10 @@ requireNonNull(csn, "charsetName"); try { return Charset.forName(csn); - } catch (IllegalCharsetNameException|UnsupportedCharsetException unused) { + } catch (IllegalCharsetNameException unused) { + // UnsupportedEncodingException should be thrown + throw new UnsupportedEncodingException(csn); + } catch (UnsupportedCharsetException unused) { // UnsupportedEncodingException should be thrown throw new UnsupportedEncodingException(csn); } --- openjdk-boot/jdk/src/share/classes/java/io/PrintWriter.java.orig +++ openjdk-boot/jdk/src/share/classes/java/io/PrintWriter.java @@ -85,7 +85,10 @@ Objects.requireNonNull(csn, "charsetName"); try { return Charset.forName(csn); - } catch (IllegalCharsetNameException|UnsupportedCharsetException unused) { + } catch (IllegalCharsetNameException unused) { + // UnsupportedEncodingException should be thrown + throw new UnsupportedEncodingException(csn); + } catch (UnsupportedCharsetException unused) { // UnsupportedEncodingException should be thrown throw new UnsupportedEncodingException(csn); } --- openjdk-boot/jdk/src/share/classes/java/lang/management/ManagementFactory.java.orig +++ openjdk-boot/jdk/src/share/classes/java/lang/management/ManagementFactory.java @@ -606,7 +606,9 @@ // create an MXBean proxy return JMX.newMXBeanProxy(connection, objName, mxbeanInterface, emitter); - } catch (InstanceNotFoundException|MalformedObjectNameException e) { + } catch (InstanceNotFoundException e) { + throw new IllegalArgumentException(e); + } catch (MalformedObjectNameException e) { throw new IllegalArgumentException(e); } } --- openjdk-boot/jdk/src/share/classes/java/util/Formatter.java.orig +++ openjdk-boot/jdk/src/share/classes/java/util/Formatter.java @@ -1857,7 +1857,10 @@ Objects.requireNonNull(csn, "charsetName"); try { return Charset.forName(csn); - } catch (IllegalCharsetNameException|UnsupportedCharsetException unused) { + } catch (IllegalCharsetNameException unused) { + // UnsupportedEncodingException should be thrown + throw new UnsupportedEncodingException(csn); + } catch (UnsupportedCharsetException unused) { // UnsupportedEncodingException should be thrown throw new UnsupportedEncodingException(csn); } --- openjdk-boot/jdk/src/share/classes/java/util/Scanner.java.orig +++ openjdk-boot/jdk/src/share/classes/java/util/Scanner.java @@ -633,7 +633,10 @@ Objects.requireNonNull(csn, "charsetName"); try { return Charset.forName(csn); - } catch (IllegalCharsetNameException|UnsupportedCharsetException e) { + } catch (IllegalCharsetNameException e) { + // IllegalArgumentException should be thrown + throw new IllegalArgumentException(e); + } catch (UnsupportedCharsetException e) { // IllegalArgumentException should be thrown throw new IllegalArgumentException(e); } @@ -684,7 +687,9 @@ Objects.requireNonNull(charsetName, "charsetName"); try { return Charset.forName(charsetName).newDecoder(); - } catch (IllegalCharsetNameException|UnsupportedCharsetException unused) { + } catch (IllegalCharsetNameException unused) { + throw new IllegalArgumentException(charsetName); + } catch (UnsupportedCharsetException unused) { throw new IllegalArgumentException(charsetName); } } --- openjdk-boot/jdk/src/share/classes/sun/invoke/util/ValueConversions.java.orig +++ openjdk-boot/jdk/src/share/classes/sun/invoke/util/ValueConversions.java @@ -676,7 +676,11 @@ IGNORE = IMPL_LOOKUP.findStatic(THIS_CLASS, "ignore", ignoreType); 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) { + } catch (NoSuchMethodException ex) { + Error err = new InternalError("uncaught exception"); + err.initCause(ex); + throw err; + } catch (IllegalAccessException ex) { Error err = new InternalError("uncaught exception"); err.initCause(ex); throw err; --- openjdk-boot/jdk/src/share/classes/sun/security/krb5/internal/PAData.java.orig +++ openjdk-boot/jdk/src/share/classes/sun/security/krb5/internal/PAData.java @@ -280,7 +280,9 @@ .append(info.getSalt()) .append('\n'); } - } catch (IOException|Asn1Exception e) { + } catch (Asn1Exception e) { + sb.append("\t \n"); + } catch (IOException e) { sb.append("\t \n"); } } @@ -307,7 +309,9 @@ .encodeBuffer(s2kparams)); } } - } catch (IOException|Asn1Exception e) { + } catch (IOException e) { + sb.append("\t \n"); + } catch (Asn1Exception e) { sb.append("\t \n"); } } --- openjdk-boot/jdk/src/share/classes/sun/text/bidi/BidiBase.java.orig +++ openjdk-boot/jdk/src/share/classes/sun/text/bidi/BidiBase.java @@ -3477,7 +3477,9 @@ try { Field f = clazz.getField(name); return f.get(null); - } catch (NoSuchFieldException | IllegalAccessException x) { + } catch (NoSuchFieldException x) { + throw new AssertionError(x); + } catch (IllegalAccessException x) { throw new AssertionError(x); } } diff -Nru openjdk-boot.orig/jdk/src/share/classes/sun/tools/jcmd/JCmd.java openjdk-boot/jdk/src/share/classes/sun/tools/jcmd/JCmd.java --- openjdk-boot.orig/jdk/src/share/classes/sun/tools/jcmd/JCmd.java 2012-03-22 10:00:56.029260268 +0000 +++ openjdk-boot/jdk/src/share/classes/sun/tools/jcmd/JCmd.java 2012-03-22 10:02:41.275789667 +0000 @@ -94,7 +94,7 @@ && mainClass.indexOf(arg.getProcessSubstring()) != -1) { pids.add(vmd.id()); } - } catch (MonitorException|URISyntaxException e) { + } catch (MonitorException e) { if (e.getMessage() != null) { System.err.println(e.getMessage()); } else { @@ -105,7 +105,18 @@ e.printStackTrace(); } } - } + } catch (URISyntaxException e) { + if (e.getMessage() != null) { + System.err.println(e.getMessage()); + } else { + Throwable cause = e.getCause(); + if ((cause != null) && (cause.getMessage() != null)) { + System.err.println(cause.getMessage()); + } else { + e.printStackTrace(); + } + } + } } if (pids.isEmpty()) { System.err.println("Could not find any processes matching : '" @@ -185,9 +196,11 @@ try { String mainClass = getMainClass(vmd); return mainClass != null && mainClass.equals(JCmd.class.getName()); - } catch (URISyntaxException|MonitorException ex) { + } catch (URISyntaxException ex) { return false; - } + } catch (MonitorException ex) { + return false; + } } private static String getMainClass(VirtualMachineDescriptor vmd) diff -Nru openjdk-boot.orig/jdk/src/share/classes/sun/security/util/UntrustedCertificates.java openjdk-boot/jdk/src/share/classes/sun/security/util/UntrustedCertificates.java --- openjdk-boot.orig/jdk/src/share/classes/sun/security/util/UntrustedCertificates.java 2012-05-02 20:50:17.549643066 +0100 +++ openjdk-boot/jdk/src/share/classes/sun/security/util/UntrustedCertificates.java 2012-05-02 20:52:03.435320716 +0100 @@ -65,7 +65,10 @@ throw new RuntimeException("Duplicate untrusted certificate: " + cert.getSubjectX500Principal()); } - } catch (CertificateException | IOException e) { + } catch (CertificateException e) { + throw new RuntimeException( + "Incorrect untrusted certificate: " + alias, e); + } catch (IOException e) { throw new RuntimeException( "Incorrect untrusted certificate: " + alias, e); } diff -Nru openjdk-boot.orig/jdk/src/share/classes/java/util/HashMap.java openjdk-boot/jdk/src/share/classes/java/util/HashMap.java --- openjdk-boot.orig/jdk/src/share/classes/java/util/HashMap.java 2012-06-08 17:12:17.000000000 +0100 +++ openjdk-boot/jdk/src/share/classes/java/util/HashMap.java 2012-06-11 14:54:16.123125601 +0100 @@ -237,7 +237,9 @@ UNSAFE = sun.misc.Unsafe.getUnsafe(); HASHSEED_OFFSET = UNSAFE.objectFieldOffset( HashMap.class.getDeclaredField("hashSeed")); - } catch (NoSuchFieldException | SecurityException e) { + } catch (NoSuchFieldException e ) { + throw new Error("Failed to record hashSeed offset", e); + } catch (SecurityException e) { throw new Error("Failed to record hashSeed offset", e); } } diff -Nru openjdk-boot.orig/jdk/src/share/classes/java/util/Hashtable.java openjdk-boot/jdk/src/share/classes/java/util/Hashtable.java --- openjdk-boot.orig/jdk/src/share/classes/java/util/Hashtable.java 2012-06-08 17:12:17.000000000 +0100 +++ openjdk-boot/jdk/src/share/classes/java/util/Hashtable.java 2012-06-11 14:54:40.275511896 +0100 @@ -227,7 +227,9 @@ UNSAFE = sun.misc.Unsafe.getUnsafe(); HASHSEED_OFFSET = UNSAFE.objectFieldOffset( Hashtable.class.getDeclaredField("hashSeed")); - } catch (NoSuchFieldException | SecurityException e) { + } catch (NoSuchFieldException e) { + throw new Error("Failed to record hashSeed offset", e); + } catch (SecurityException e) { throw new Error("Failed to record hashSeed offset", e); } } diff -Nru openjdk-boot.orig/jdk/src/share/classes/java/lang/reflect/Proxy.java openjdk-boot/jdk/src/share/classes/java/lang/reflect/Proxy.java --- openjdk-boot.orig/jdk/src/share/classes/java/lang/reflect/Proxy.java 2013-02-02 16:14:27.971429681 +0000 +++ openjdk-boot/jdk/src/share/classes/java/lang/reflect/Proxy.java 2013-02-02 16:14:58.283922372 +0000 @@ -738,7 +738,9 @@ private static Object newInstance(Constructor cons, InvocationHandler h) { try { return cons.newInstance(new Object[] {h} ); - } catch (IllegalAccessException | InstantiationException e) { + } catch (IllegalAccessException e) { + throw new InternalError(e.toString()); + } catch (InstantiationException e) { throw new InternalError(e.toString()); } catch (InvocationTargetException e) { Throwable t = e.getCause();