view patches/boot/ecj-trywithresources.patch @ 2910:df0f259a2fcc icedtea-2.7.0pre10

Bump to icedtea-2.7.0pre10. Upstream changes: - Bump to icedtea-2.7.0pre10 - S6253144: Long narrowing conversion should describe the algorithm used and implied "risks" - S6328537: Improve javadocs for Socket class by adding references to SocketOptions - S6624200: Regression test fails: test/closed/javax/swing/JMenuItem/4654927/bug4654927.java - S6882559: new JEditorPane("text/plain","") fails for null context class loader - S6978886: javadoc shows stacktrace after print error resulting from disk full - S6995421: Eliminate the static dependency to sun.security.ec.ECKeyFactory - S6996372: synchronizing handshaking hash - S7027045: (doc) java/awt/Window.java has several typos in javadoc - S7054969: Null-check-in-finally pattern in java/security documentation - S7059542: JNDI name operations should be locale independent - S7072353: JNDI libraries do not build with javac -Xlint:all -Werror - S7075563: Broken link in "javax.swing.SwingWorker" - S7077672: jdk8_tl nightly fail in step-2 build on 8/10/11 - S7088502: Security libraries don't build with javac -Werror - S7090158: Networking Libraries don't build with javac -Werror - S7092447: Clarify the default locale used in each locale sensitive operation - S7093640: Enable client-side TLS 1.2 by default - S7103570: AtomicIntegerFieldUpdater does not work when SecurityManager is installed - S7117360: Warnings in java.util.concurrent.atomic package - S7117465: Warning cleanup for IMF classes - S7125055: ContentHandler.getContent API changed in error - S7145960: sun/security/mscapi/ShortRSAKey1024.sh failing on windows - S7172012: Make test-in-build an option (Queens) - S7187051: ShortRSAKeynnn.sh tests should do cleanup before start test - S7187144: JavaDoc for ScriptEngineFactory.getProgram() contains an error - S8000418: javadoc should used a standard "generated by javadoc" string - S8000626: Implement dead key detection for KeyEvent on Linux - S8000666: javadoc should write directly to Writer instead of composing strings - S8000673: remove dead code from HtmlWriter and subtypes - S8000897: VM crash in CompileBroker - S8000970: break out auxiliary classes that will prevent multi-core compilation of the JDK - S8001669: javadoc internal DocletAbortException should set cause when appropriate - S8003890: corelibs test scripts should pass TESTVMOPTS - S8005629: javac warnings compiling java.awt.EventDispatchThread and sun.awt.X11.XIconWindow - S8008949: javadoc stopped copying doc-files - S8010297: Missing isLoggable() checks in logging code - S8010782: clean up source files containing carriage return characters - S8011402: Move blacklisting certificate logic from hard code to data - S8011547: Update XML Signature implementation to Apache Santuario 1.5.4 - S8012288: XML DSig API allows wrong tag names and extra elements in SignedInfo - S8014431: cleanup warnings indicated by the -Wunused-value compiler option on linux - S8015265: revise the fix for 8007037 - S8016217: More javadoc warnings - S8016491: PPC64 (part 2): Clean up PPC defines. - S8016586: PPC64 (part 3): basic changes for PPC64 - S8016696: PPC64 (part 4): add relocation for trampoline stubs - S8016747: Replace deprecated PlatformLogger isLoggable(int) with isLoggable(Level) - S8017313: PPC64 (part 6): stack handling improvements - S8017317: PPC64 (part 7): cppInterpreter: implement support for biased locking - S8017325: Cleanup of the javadoc <code> tag in java.security.cert - S8017326: Cleanup of the javadoc <code> tag in java.security.spec - S8019517: PPC64 (part 102): cppInterpreter: implement G1 support - S8019518: PPC64 (part 103): cppInterpreter: implement support for compressed Oops - S8019519: PPC64 (part 105): C interpreter: implement support for jvmti early return. - S8019772: Fix doclint issues in javax.crypto and javax.security subpackages - S8019929: PPC64 (part 107): Extend ELF-decoder to support PPC64 function descriptor tables - S8019973: PPC64 (part 11): Fix IA64 preprocessor conditionals on AIX. - S8020121: PPC64: fix build in cppInterpreter after 8019519 - S8020190: Fatal: Bug in native code: jfieldID must match object - S8020557: javadoc cleanup in javax.security - S8020688: Broken links in documentation at http://docs.oracle.com/javase/6/docs/api/index. - S8020708: NLS mnemonics missing in SwingSet2/JInternalFrame demo - S8021108: Clean up doclint warnings and errors in java.text package - S8021417: Fix doclint issues in java.util.concurrent - S8021833: javadoc cleanup in java.net - S8022120: JCK test api/javax_xml/crypto/dsig/TransformService/index_ParamMethods fails - S8022175: Fix doclint warnings in javax.print - S8022406: Fix doclint issues in java.beans - S8022746: List of spelling errors in API doc - S8024344: PPC64 (part 112): C argument in register AND stack slot. - S8024468: PPC64 (part 201): cppInterpreter: implement bytecode profiling - S8024469: PPC64 (part 202): cppInterpreter: support for OSR. - S8024756: method grouping tabs are not selectable - S8024779: [macosx] SwingNode crashes on exit - S8024854: PPC64: Basic changes and files to build the class library on AIX - S8024900: PPC64: Enable new build on AIX (jdk part) - S8025085: [javadoc] some errors in javax/swing - S8025218: [javadoc] some errors in java/awt classes - S8025249: [javadoc] fix some javadoc errors in javax/swing/ - S8025409: Fix javadoc comments errors and warning reported by doclint report - S8026021: more fix of javadoc errors and warnings reported by doclint, see the description - S8026119: Regression test DHEKeySizing.java failing intermittently - S8026741: jdk8 l10n resource file translation update 5 - S8029957: PPC64 (part 213): cppInterpreter: memory ordering for object initialization - S8033168: PPC64: gcc 4.8 warning in output_c.cpp - S8034797: AIX: Fix os::naked_short_sleep() in os_aix.cpp after 8028280 - S8035396: Introduce accessor for tmp_oop in frame. - S8035647: PPC64: Support for elf v2 abi. - S8036767: PPC64: Support for little endian execution model - S8036976: PPC64: implement the template interpreter - S8037099: [macosx] Remove all references to GC from native OBJ-C code - S8037915: PPC64/AIX: Several smaller fixes - S8038184: XMLSignature throws StringIndexOutOfBoundsException if ID attribute value is empty String - S8038349: Signing XML with DSA throws Exception when key is larger than 1024 bits - S8042309: Some bugfixes for the ppc64 port - S8048147: Privilege tests with JAAS Subject.doAs - S8048357: PKCS basic tests - S8049171: Additional tests for jarsigner's warnings - S8049244: XML Signature performance issue caused by unbuffered signature data - S8049432: New tests for TLS property jdk.tls.client.protocols - S8050893: (smartcardio) Invert reset argument in tests in sun/security/smartcardio - S8050942: PPC64: implement template interpreter for ppc64le - S8050972: Concurrency problem in PcDesc cache - S8056122: Upgrade JDK to use LittleCMS 2.6 - S8057934: Upgrade to LittleCMS 2.6 breaks AIX build - S8059177: jdk8u40 l10n resource file translation update 1 - S8059212: Modify sun/security/smartcardio manual regression tests so that they do not just fail if no cardreader found - S8067364: Printing to Postscript doesn't support dieresis - S8068279: (typo in the spec) javax.script.ScriptEngineFactory.getLanguageName - S8068491: Update the protocol for references of docs.oracle.com to HTTPS. - S8069038: javax/net/ssl/TLS/TLSClientPropertyTest.java needs to be updated for JDK-8061210 - S8069590: AIX port of "8050807: Better performing performance data handling" - S8075118: JVM stuck in infinite loop during verification - S8075584: test for 8067364 depends on hardwired text advance - S8076369: Introduce the jdk.tls.client.protocols system property for JDK 7u - S8076486: [TESTBUG] javax/security/auth/Subject/doAs/NestedActions.java fails if extra VM options are given - S8077953: [TEST_BUG] com/sun/management/OperatingSystemMXBean/TestTotalSwap.java Compilation failed after JDK-8077387 - S8078482: ppc: pass thread to throw_AbstractMethodError - S8078823, PR2809: javax/net/ssl/ciphersuites/DisabledAlgorithms.java fails intermittently - S8080190: PPC64: Fix wrong rotate instructions in the .ad file - S8080628: No mnemonics on Open and Save buttons in JFileChooser - S8083601: jdk8u60 l10n resource file translation update 2 - S8138725: Add options for Javadoc generation - S8139258: PPC64LE: argument passing problem when passing 15 floats in native call - S8139421: PPC64LE: MacroAssembler::bxx64_patchable kill register R12 - S8139565: Restrict certificates with DSA keys less than 1024 bits - S8140353: Improve signature checking - S8140422: Add mechanism to allow non default root CAs to be not subject to algorithm restrictions - S8140530: Creating a VolatileImage with size 0,0 results in no longer working g2d.drawString - S8140587: Atomic*FieldUpdaters should use Class.isInstance instead of direct class check - S8142926: OutputAnalyzer's shouldXXX() calls return this - S8143134: L10n resource file translation update - S8143959: Certificates requiring blacklisting - S8145984: [macosx] sun.lwawt.macosx.CAccessible leaks - S8147077: IllegalArgumentException thrown by api/java_awt/Component/FlipBufferStrategy/indexTGF_General - S8148127: IllegalArgumentException thrown by JCK test api/java_awt/Component/FlipBufferStrategy/indexTGF_General in opengl pipeline - S8148487: PPC64: Better byte behavior - S8148516: Improve the default strength of EC in JDK - S8148516, PR2809: Improve the default strength of EC in JDK [test/javax/net/ssl/ciphersuites/DisabledAlgorithms.java update] - S8149029: Secure validation of XML based digital signature always enabled when checking wrapping attacks - S8150611: Security problem on sun.misc.resources.Messages* - S8151893: Add security property to configure XML Signature secure validation mode - S8151921: Improved page resolution - S8151934: Resolve class resolution - S8155760: Implement Serialization Filtering - S8155968: Update command line options - S8155973: Tighten jar checks - S8156802: Better constraint checking - S8157176: Improved classfile parsing - S8157653: [Parfait] Uninitialised variable in awt_Font.cpp - S8157739: Classloader Consistency Checking - S8157749: Improve handling of DNS error replies - S8157753: Audio replay enhancement - S8157759: LCMS Transform Sampling Enhancement - S8157764: Better handling of interpolation plugins - S8158260: PPC64: unaligned Unsafe.getInt can lead to the generation of illegal instructions - S8158302: Handle contextual glyph substitutions - S8158406: Limited Parameter Processing - S8158734: JEditorPane.createEditorKitForContentType throws NPE after 6882559 - S8158993: Service Menu services - S8158997: JNDI Protocols Switch - S8159495: Fix index offsets - S8159503: Amend Annotation Actions - S8159507: RuntimeVisibleAnnotation validation - S8159511: Stack map validation - S8159515: Improve indy validation - S8159519: Reformat JDWP messages - S8159684: (tz) Support tzdata2016f - S8160090: Better signature handling in pack200 - S8160094: Improve pack200 layout - S8160098: Clean up color profiles - S8160591: Improve internal array handling - S8160838: Better HTTP service - S8160934: isnan() is not available on older MSVC compilers - S8161218: Better bytecode loading - S8161228: URL objects with custom protocol handlers have port changed after deserializing - S8161571: Verifying ECDSA signatures permits trailing bytes - S8161743: Provide proper login context - S8162411: Service Menu services 2 - S8162419: closed/com/oracle/jfr/runtime/TestVMInfoEvent.sh failing after JDK-8155968 - S8162511: 8u111 L10n resource file updates - S8162577: Standardize logging levels - S8162792: Remove constraint DSA keySize < 1024 from jdk.jar.disabledAlgorithms in jdk8 - S8162973: Better component components - S8163304: jarsigner -verbose -verify should print the algorithms used to sign the jar - S8164143: Improve components for menu items - S8164147: Improve streaming socket output - S8164452: 8u111 L10n resource file update - msgdrop 20 - S8164908: ReflectionFactory support for IIOP and custom serialization - S8165071: Expand TLS support - S8165230: RMIConnection addNotificationListeners failing with specific inputs - S8165344: Update concurrency support - S8165807: PPC64: Backport PPC64 port to OpenJDK 7 - S8165816: jarsigner -verify shows jar unsigned if it was signed with a weak algorithm - S8166381: Back out changes to the java.security file to not disable MD5 - S8166393: disabledAlgorithms property should not be strictly parsed - S8166591: [macos 10.12] Trackpad scrolling of text on OS X 10.12 Sierra is very fast (Trackpad, Retina only) - S8166739: Improve extensibility of ObjectInputFilter information passed to the filter - S8166875: (tz) Support tzdata2016g - S8166878: Connection reset during TLS handshake - S8166988: Improve image processing performance - S8167104: Additional class construction refinements - S8167144: Fix aix after 8022507: SIGSEGV at ParMarkBitMap::verify_clear() - S8167198: Changes to make AIX compile after the merge - S8167223: URL handling improvements - S8167335: Fix build on Linux with 64kb default page size - S8167356: Follow up fix for jdk8 backport of 8164143. Changes for CMenuComponent.m were missed - S8167459: Add debug output for indicating if a chosen ciphersuite was legacy - S8167472: Chrome interop regression with JDK-8148516 - S8167591: Add MD5 to signed JAR restrictions - S8168705: Better ObjectIdentifier validation - S8168714: Tighten ECDSA validation - S8168724: ECDSA signing improvments - S8168728: DSA signing improvments - S8168861: AnchorCertificates uses hardcoded password for cacerts keystore - S8168993: JDK8u121 L10n resource file update - S8169191: (tz) Support tzdata2016i - S8169688: Backout (remove) MD5 from jdk.jar.disabledAlgorithms for January CPU - S8169911: Enhanced tests for jarsigner -verbose -verify after JDK-8163304 - S8170131: Certificates not being blocked by jdk.tls.disabledAlgorithms property - S8170268: 8u121 L10n resource file update - msgdrop 20 - S8173622: Backport of 7180907 is incomplete - S8173849: Fix use of java.util.Base64 in test cases - S8173854: [TEST] Update DHEKeySizing test case following 8076328 & 8081760 ChangeLog: 2017-04-07 Andrew John Hughes <gnu_andrew@member.fsf.org> Bump to icedtea-2.7.0pre10. * Makefile.am: (JDK_UPDATE_VERSION): Bump to 131. (BUILD_VERSION): Reset to b00. (CORBA_CHANGESET): Update to icedtea-2.7.0pre10. (JAXP_CHANGESET): Likewise. (JAXWS_CHANGESET): Likewise. (JDK_CHANGESET): Likewise. (LANGTOOLS_CHANGESET): Likewise. (OPENJDK_CHANGESET): Likewise. (CORBA_SHA256SUM): Likewise. (JAXP_SHA256SUM): Likewise. (JAXWS_SHA256SUM): Likewise. (JDK_SHA256SUM): Likewise. (LANGTOOLS_SHA256SUM): Likewise. (OPENJDK_SHA256SUM): Likewise. (install-data-local): Install blacklisted.certs. * NEWS: Updated. * configure.ac: Bump to 2.7.0pre10. * hotspot.map.in: Update to icedtea-2.7.0pre10. * patches/boot/ecj-diamond.patch, Regenerated. Add new cases in com.sun.jndi.cosnaming.CNCtx, com.sun.jndi.cosnaming.CNNameParser, com.sun.jndi.cosnaming.IiopUrl, com.sun.jndi.dns.DnsContextFactory, com.sun.jndi.dns.DnsName, com.sun.jndi.dns.NameNode, com.sun.jndi.dns.ResourceRecords, com.sun.jndi.ldap.EventSupport, com.sun.jndi.ldap.LdapClient, com.sun.jndi.ldap.LdapCtxFactory, com.sun.jndi.ldap.LdapCtx, com.sun.jndi.ldap.LdapName, com.sun.jndi.ldap.LdapResult, com.sun.jndi.ldap.LdapSchemaParser, com.sun.jndi.ldap.NamingEventNotifier, com.sun.jndi.ldap.Obj, com.sun.jndi.ldap.pool.Connections, com.sun.jndi.ldap.pool.Pool, com.sun.jndi.ldap.sasl.LdapSasl, com.sun.jndi.toolkit.ctx.Continuation, com.sun.jndi.toolkit.dir.HierMemDirCtx, com.sun.jndi.toolkit.dir.SearchFilter, com.sun.jndi.toolkit.url.GenericURLContext, com.sun.naming.internal.FactoryEnumeration, com.sun.naming.internal.ResourceManager, com.sun.naming.internal.VersionHelper, java.net.SocketPermission, java.net.URLConnection, java.net.URL, java.util.logging.LogRecord, javax.naming.directory.BasicAttribute, javax.naming.directory.BasicAttributes, javax.naming.ldap.InitialLdapContext, javax.naming.ldap.LdapName, javax.naming.ldap.Rdn, javax.naming.ldap.Rdn, javax.naming.ldap.Rfc2253Parser, javax.naming.NamingImpl, javax.naming.Reference, javax.naming.spi.DirectoryManager, javax.naming.spi.NamingManager, org.jcp.xml.dsig.internal.dom.Policy, sun.awt.im.ExecutableInputMethodManager, sun.awt.im.InputContext, sun.misc.ObjectInputFilter, sun.net.TransferProtocolClient, sun.net.www.protocol.http.AuthenticationHeader, sun.net.www.protocol.http.HttpURLConnection. sun.security.ssl.ExtensionType, sun.security.ssl.SupportedEllipticCurvesExtension, sun.security.ssl.SupportedEllipticPointFormatsExtension, sun.security.tools.jarsigner.Main, sun.security.util.UntrustedCertificates, sun.security.util.AnchorCertificates, sun.security.util.DisabledAlgorithmConstraints and sun.security.x509.X509CertImpl. * patches/boot/ecj-multicatch.patch: Regenerated. Add new cases in com.sun.naming.internal.ResourceManager, sun.net.www.protocol.http.HttpURLConnection, sun.reflect.ReflectionFactory, sun.security.x509.X509CertImpl, com.sun.net.httpserver.spi.HttpServerProvider, sun.net.ftp.FtpClientProvider, com.sun.jndi.ldap.AbstractLdapNamingEnumeration, com.sun.jndi.ldap.Connection and com.sun.jndi.ldap.LdapCtx. Drop case in sun.security.util.UntrustedCertificates. * patches/boot/ecj-stringswitch.patch: Regenerated. Add new cases in com.sun.jndi.ldap.LdapCtx and org.jcp.xml.dsig.internal.dom.Policy. * patches/boot/ecj-trywithresources.patch: Regenerated. Updated case in sun.security.util.UntrustedCertificates. Add new cases in com.sun.jndi.ldap.Obj, sun.security.util.AnchorCertificates and sun.security.tools.jarsigner.Main. * patches/boot/ecj-underscored_literals.patch: Move case from sun.security.ssl.ServerHandshaker to sun.security.util.Parsing. * patches/pr2124.patch, Extend following changes made in 8148516. * patches/rh1022017.patch: Adapt to changes made in 8148516.
author Andrew John Hughes <gnu_andrew@member.fsf.org>
date Fri, 14 Apr 2017 07:14:20 +0100
parents 11416bb1b308
children 0e1ff6b44292
line wrap: on
line source

diff -Nru openjdk-boot.orig/jdk/src/share/classes/com/sun/java/util/jar/pack/BandStructure.java openjdk-boot/jdk/src/share/classes/com/sun/java/util/jar/pack/BandStructure.java
--- openjdk-boot.orig/jdk/src/share/classes/com/sun/java/util/jar/pack/BandStructure.java	2016-09-19 11:44:50.000000000 +0100
+++ openjdk-boot/jdk/src/share/classes/com/sun/java/util/jar/pack/BandStructure.java	2017-04-04 19:12:04.788060862 +0100
@@ -743,7 +743,9 @@
 
         private void dumpBand() throws IOException {
             assert(optDumpBands);
-            try (PrintStream ps = new PrintStream(getDumpStream(this, ".txt"))) {
+            PrintStream ps = null;
+            try {
+                ps = new PrintStream(getDumpStream(this, ".txt"));
                 String irr = (bandCoding == regularCoding) ? "" : " irregular";
                 ps.print("# length="+length+
                          " size="+outputSize()+
@@ -758,9 +760,19 @@
                 }
                 printArrayTo(ps, values, 0, length);
             }
-            try (OutputStream ds = getDumpStream(this, ".bnd")) {
+            finally {
+                if (ps != null)
+                    ps.close();
+            }
+            OutputStream ds = null;
+            try {
+                ds = getDumpStream(this, ".bnd");
                 bandCoding.writeArrayTo(ds, values, 0, length);
             }
+            finally {
+                if (ds != null)
+                    ds.close();
+            }
         }
 
         /** Disburse one value. */
@@ -829,12 +841,18 @@
 
         private void dumpBand() throws IOException {
             assert(optDumpBands);
-            try (OutputStream ds = getDumpStream(this, ".bnd")) {
+            OutputStream ds = null;
+            try {
+                ds = getDumpStream(this, ".bnd");
                 if (bytesForDump != null)
                     bytesForDump.writeTo(ds);
                 else
                     bytes.writeTo(ds);
             }
+            finally {
+                if (ds != null)
+                    ds.close();
+            }
         }
 
         public void readDataFrom(InputStream in) throws IOException {
diff -Nru openjdk-boot.orig/jdk/src/share/classes/com/sun/java/util/jar/pack/Driver.java openjdk-boot/jdk/src/share/classes/com/sun/java/util/jar/pack/Driver.java
--- openjdk-boot.orig/jdk/src/share/classes/com/sun/java/util/jar/pack/Driver.java	2017-04-04 18:43:19.639569675 +0100
+++ openjdk-boot/jdk/src/share/classes/com/sun/java/util/jar/pack/Driver.java	2017-04-04 19:12:04.788060862 +0100
@@ -151,8 +151,13 @@
                 if ("--config-file=".equals(state)) {
                     String propFile = av.remove(0);
                     Properties fileProps = new Properties();
-                    try (InputStream propIn = new FileInputStream(propFile)) {
+                    InputStream propIn = null;
+                    try {
+                        propIn = new FileInputStream(propFile);
                         fileProps.load(propIn);
+                    } finally {
+                        if (propIn != null)
+                            propIn.close();
                     }
                     if (engProps.get(verboseProp) != null)
                         fileProps.list(System.out);
@@ -343,9 +348,14 @@
                 else
                     fileOut = new FileOutputStream(outfile);
                 fileOut = new BufferedOutputStream(fileOut);
-                try (JarOutputStream out = new JarOutputStream(fileOut)) {
+                JarOutputStream out = null;
+                try {
+                    out = new JarOutputStream(fileOut);
                     junpack.unpack(in, out);
                     // p200 closes in but not out
+                } finally {
+                    if (out != null)
+                        out.close();
                 }
                 // At this point, we have a good jarfile (or newfile, if -r)
             }
@@ -407,7 +417,9 @@
         long filelen = new File(jarfile).length();
         if (filelen <= 0)  return "";
         long skiplen = Math.max(0, filelen - tail.length);
-        try (InputStream in = new FileInputStream(new File(jarfile))) {
+        InputStream in = null;
+        try {
+            in = new FileInputStream(new File(jarfile));
             in.skip(skiplen);
             in.read(tail);
             for (int i = tail.length-4; i >= 0; i--) {
@@ -421,6 +433,9 @@
                 }
             }
             return "";
+        } finally {
+            if (in != null)
+                in.close();
         }
     }
 
diff -Nru openjdk-boot.orig/jdk/src/share/classes/com/sun/java/util/jar/pack/NativeUnpack.java openjdk-boot/jdk/src/share/classes/com/sun/java/util/jar/pack/NativeUnpack.java
--- openjdk-boot.orig/jdk/src/share/classes/com/sun/java/util/jar/pack/NativeUnpack.java	2016-09-19 11:44:50.000000000 +0100
+++ openjdk-boot/jdk/src/share/classes/com/sun/java/util/jar/pack/NativeUnpack.java	2017-04-04 19:12:04.788060862 +0100
@@ -245,9 +245,15 @@
     void run(File inFile, JarOutputStream jstream) throws IOException {
         // %%% maybe memory-map the file, and pass it straight into unpacker
         ByteBuffer mappedFile = null;
-        try (FileInputStream fis = new FileInputStream(inFile)) {
+        FileInputStream fis = null;
+        try {
+            fis = new FileInputStream(inFile);
             run(fis, jstream, mappedFile);
         }
+        finally {
+            if (fis != null)
+                fis.close();
+        }
         // Note:  caller is responsible to finish with jstream.
     }
 
diff -Nru openjdk-boot.orig/jdk/src/share/classes/com/sun/java/util/jar/pack/PackageReader.java openjdk-boot/jdk/src/share/classes/com/sun/java/util/jar/pack/PackageReader.java
--- openjdk-boot.orig/jdk/src/share/classes/com/sun/java/util/jar/pack/PackageReader.java	2016-09-19 11:44:50.000000000 +0100
+++ openjdk-boot/jdk/src/share/classes/com/sun/java/util/jar/pack/PackageReader.java	2017-04-04 19:12:04.788060862 +0100
@@ -540,9 +540,15 @@
             Index index = initCPIndex(tag, cpMap);
 
             if (optDumpBands) {
-                try (PrintStream ps = new PrintStream(getDumpStream(index, ".idx"))) {
+                PrintStream ps = null;
+                try {
+                    ps = new PrintStream(getDumpStream(index, ".idx"));
                     printArrayTo(ps, index.cpMap, 0, index.cpMap.length);
                 }
+                finally {
+                    if (ps != null)
+                        ps.close();
+                }
             }
         }
 
@@ -828,9 +834,10 @@
         attr_definition_headers.readFrom(in);
         attr_definition_name.readFrom(in);
         attr_definition_layout.readFrom(in);
-        try (PrintStream dump = !optDumpBands ? null
-                 : new PrintStream(getDumpStream(attr_definition_headers, ".def")))
-        {
+        PrintStream dump = null;
+        try {
+            dump = !optDumpBands ? null
+                : new PrintStream(getDumpStream(attr_definition_headers, ".def"));
             for (int i = 0; i < numAttrDefs; i++) {
                 int       header = attr_definition_headers.getByte();
                 Utf8Entry name   = (Utf8Entry) attr_definition_name.getRef();
@@ -849,6 +856,10 @@
                 if (dump != null)  dump.println(index+" "+def);
             }
         }
+        finally {
+            if (dump != null)
+                dump.close();
+        }
         attr_definition_headers.doneDisbursing();
         attr_definition_name.doneDisbursing();
         attr_definition_layout.doneDisbursing();
diff -Nru openjdk-boot.orig/jdk/src/share/classes/com/sun/java/util/jar/pack/PackageWriter.java openjdk-boot/jdk/src/share/classes/com/sun/java/util/jar/pack/PackageWriter.java
--- openjdk-boot.orig/jdk/src/share/classes/com/sun/java/util/jar/pack/PackageWriter.java	2016-09-19 11:44:50.000000000 +0100
+++ openjdk-boot/jdk/src/share/classes/com/sun/java/util/jar/pack/PackageWriter.java	2017-04-04 19:12:04.788060862 +0100
@@ -458,9 +458,15 @@
                 Utils.log.info("Writing "+cpMap.length+" "+ConstantPool.tagName(tag)+" entries...");
 
             if (optDumpBands) {
-                try (PrintStream ps = new PrintStream(getDumpStream(index, ".idx"))) {
+                PrintStream ps = null;
+                try {
+                    ps = new PrintStream(getDumpStream(index, ".idx"));
                     printArrayTo(ps, cpMap, 0, cpMap.length);
                 }
+                finally {
+                    if (ps != null)
+                        ps.close();
+                }
             }
 
             switch (tag) {
@@ -921,9 +927,10 @@
             }
         });
         attrDefsWritten = new Attribute.Layout[numAttrDefs];
-        try (PrintStream dump = !optDumpBands ? null
-                 : new PrintStream(getDumpStream(attr_definition_headers, ".def")))
-        {
+        PrintStream dump = null;
+        try {
+            dump = !optDumpBands ? null
+                : new PrintStream(getDumpStream(attr_definition_headers, ".def"));
             int[] indexForDebug = Arrays.copyOf(attrIndexLimit, ATTR_CONTEXT_LIMIT);
             for (int i = 0; i < defs.length; i++) {
                 int header = ((Integer)defs[i][0]).intValue();
@@ -949,6 +956,10 @@
                 }
             }
         }
+        finally {
+            if (dump != null)
+                dump.close();
+        }
     }
 
     void writeAttrCounts() throws IOException {
diff -Nru openjdk-boot.orig/jdk/src/share/classes/com/sun/java/util/jar/pack/PropMap.java openjdk-boot/jdk/src/share/classes/com/sun/java/util/jar/pack/PropMap.java
--- openjdk-boot.orig/jdk/src/share/classes/com/sun/java/util/jar/pack/PropMap.java	2016-09-19 11:44:50.000000000 +0100
+++ openjdk-boot/jdk/src/share/classes/com/sun/java/util/jar/pack/PropMap.java	2017-04-04 19:12:04.792060798 +0100
@@ -122,8 +122,9 @@
         // Do this after the previous props are put in place,
         // to allow override if necessary.
         String propFile = "intrinsic.properties";
-
-        try (InputStream propStr = PackerImpl.class.getResourceAsStream(propFile)) {
+        InputStream propStr = null;
+        try {
+            propStr = PackerImpl.class.getResourceAsStream(propFile);
             if (propStr == null) {
                 throw new RuntimeException(propFile + " cannot be loaded");
             }
@@ -131,6 +132,14 @@
         } catch (IOException ee) {
             throw new RuntimeException(ee);
         }
+        finally {
+            try {
+                if (propStr != null)
+                    propStr.close();
+            } catch (IOException ee) {
+                throw new RuntimeException(ee);
+            }
+        }
 
         for (Map.Entry<Object, Object> e : props.entrySet()) {
             String key = (String) e.getKey();
diff -Nru openjdk-boot.orig/jdk/src/share/classes/com/sun/java/util/jar/pack/UnpackerImpl.java openjdk-boot/jdk/src/share/classes/com/sun/java/util/jar/pack/UnpackerImpl.java
--- openjdk-boot.orig/jdk/src/share/classes/com/sun/java/util/jar/pack/UnpackerImpl.java	2016-09-19 11:44:50.000000000 +0100
+++ openjdk-boot/jdk/src/share/classes/com/sun/java/util/jar/pack/UnpackerImpl.java	2017-04-04 19:12:04.792060798 +0100
@@ -160,9 +160,15 @@
         }
         // Use the stream-based implementation.
         // %%% Reconsider if native unpacker learns to memory-map the file.
-        try (FileInputStream instr = new FileInputStream(in)) {
+        FileInputStream instr = null;
+        try {
+            instr = new FileInputStream(in);
             unpack(instr, out);
         }
+        finally {
+            if (instr != null)
+                instr.close();
+        }
         if (props.getBoolean(Utils.UNPACK_REMOVE_PACKFILE)) {
             in.delete();
         }
diff -Nru openjdk-boot.orig/jdk/src/share/classes/com/sun/java/util/jar/pack/Utils.java openjdk-boot/jdk/src/share/classes/com/sun/java/util/jar/pack/Utils.java
--- openjdk-boot.orig/jdk/src/share/classes/com/sun/java/util/jar/pack/Utils.java	2016-09-19 11:44:50.000000000 +0100
+++ openjdk-boot/jdk/src/share/classes/com/sun/java/util/jar/pack/Utils.java	2017-04-04 19:12:04.792060798 +0100
@@ -268,18 +268,30 @@
         // 4947205 : Peformance is slow when using pack-effort=0
         out = new BufferedOutputStream(out);
         out = new NonCloser(out); // protect from JarOutputStream.close()
-        try (JarOutputStream jout = new JarOutputStream(out)) {
+        JarOutputStream jout = null;
+        try {
+            jout = new JarOutputStream(out);
             copyJarFile(in, jout);
         }
+        finally {
+            if (jout != null)
+                jout.close();
+        }
     }
     static void copyJarFile(JarFile in, OutputStream out) throws IOException {
 
         // 4947205 : Peformance is slow when using pack-effort=0
         out = new BufferedOutputStream(out);
         out = new NonCloser(out); // protect from JarOutputStream.close()
-        try (JarOutputStream jout = new JarOutputStream(out)) {
+        JarOutputStream jout = null;
+        try {
+            jout = new JarOutputStream(out);
             copyJarFile(in, jout);
         }
+        finally {
+            if (jout != null)
+                jout.close();
+        }
     }
         // Wrapper to prevent closing of client-supplied stream.
     static private
diff -Nru openjdk-boot.orig/jdk/src/share/classes/com/sun/jndi/ldap/Obj.java openjdk-boot/jdk/src/share/classes/com/sun/jndi/ldap/Obj.java
--- openjdk-boot.orig/jdk/src/share/classes/com/sun/jndi/ldap/Obj.java	2017-04-07 16:36:15.903029077 +0100
+++ openjdk-boot/jdk/src/share/classes/com/sun/jndi/ldap/Obj.java	2017-04-07 16:39:34.403810259 +0100
@@ -503,9 +503,15 @@
 
         try {
             ByteArrayOutputStream bytes = new ByteArrayOutputStream();
-            try (ObjectOutputStream serial = new ObjectOutputStream(bytes)) {
+	    ObjectOutputStream serial = null;
+            try {
+		serial = new ObjectOutputStream(bytes);
                 serial.writeObject(obj);
-            }
+            } finally {
+		if (serial != null) {
+		    serial.close();
+		}
+	    }
 
             return (bytes.toByteArray());
 
@@ -525,15 +531,21 @@
         try {
             // Create ObjectInputStream for deserialization
             ByteArrayInputStream bytes = new ByteArrayInputStream(obj);
-            try (ObjectInputStream deserial = cl == null ?
+	    ObjectInputStream deserial = null;
+            try {
+		deserial = cl == null ?
                     new ObjectInputStream(bytes) :
-                    new LoaderInputStream(bytes, cl)) {
+                    new LoaderInputStream(bytes, cl);
                 return deserial.readObject();
             } catch (ClassNotFoundException e) {
                 NamingException ne = new NamingException();
                 ne.setRootCause(e);
                 throw ne;
-            }
+            } finally {
+		if (deserial != null) {
+		    try { deserial.close(); } catch (IOException ex) {}
+		}
+	    }
         } catch (IOException e) {
             NamingException ne = new NamingException();
             ne.setRootCause(e);
diff -Nru openjdk-boot.orig/jdk/src/share/classes/java/lang/invoke/MethodHandleImpl.java openjdk-boot/jdk/src/share/classes/java/lang/invoke/MethodHandleImpl.java
--- openjdk-boot.orig/jdk/src/share/classes/java/lang/invoke/MethodHandleImpl.java	2016-09-19 11:44:50.000000000 +0100
+++ openjdk-boot/jdk/src/share/classes/java/lang/invoke/MethodHandleImpl.java	2017-04-04 19:12:04.792060798 +0100
@@ -912,10 +912,15 @@
                             java.net.URLConnection uconn = tClass.getResource(tResource).openConnection();
                             int len = uconn.getContentLength();
                             byte[] bytes = new byte[len];
-                            try (java.io.InputStream str = uconn.getInputStream()) {
+			    java.io.InputStream str = null;
+                            try {
+			        str = uconn.getInputStream();
                                 int nr = str.read(bytes);
                                 if (nr != len)  throw new java.io.IOException(tResource);
-                            }
+                            } finally {
+			      if (str != null)
+				str.close();
+			    }
                             values[0] = bytes;
                         } catch (java.io.IOException ex) {
                             throw newInternalError(ex);
diff -Nru openjdk-boot.orig/jdk/src/share/classes/java/lang/Package.java openjdk-boot/jdk/src/share/classes/java/lang/Package.java
--- openjdk-boot.orig/jdk/src/share/classes/java/lang/Package.java	2016-09-19 11:44:50.000000000 +0100
+++ openjdk-boot/jdk/src/share/classes/java/lang/Package.java	2017-04-04 19:12:04.792060798 +0100
@@ -578,12 +578,23 @@
      * Returns the Manifest for the specified JAR file name.
      */
     private static Manifest loadManifest(String fn) {
-        try (FileInputStream fis = new FileInputStream(fn);
-             JarInputStream jis = new JarInputStream(fis, false))
-        {
+        FileInputStream fis = null;
+        JarInputStream jis = null;
+        try {
+            fis = new FileInputStream(fn);
+            jis = new JarInputStream(fis, false);
             return jis.getManifest();
         } catch (IOException e) {
             return null;
+        } finally {
+            try {
+                if (jis != null)
+                    jis.close();
+                if (fis != null)
+                    fis.close();
+            } catch (IOException e) {
+                return null;
+            }
         }
     }
 
diff -Nru openjdk-boot.orig/jdk/src/share/classes/java/nio/channels/SocketChannel.java openjdk-boot/jdk/src/share/classes/java/nio/channels/SocketChannel.java
--- openjdk-boot.orig/jdk/src/share/classes/java/nio/channels/SocketChannel.java	2016-09-19 11:44:50.000000000 +0100
+++ openjdk-boot/jdk/src/share/classes/java/nio/channels/SocketChannel.java	2017-04-04 19:12:04.792060798 +0100
@@ -188,7 +188,7 @@
             } catch (Throwable suppressed) {
                 x.addSuppressed(suppressed);
             }
-            throw x;
+            throw (IOException) x;
         }
         assert sc.isConnected();
         return sc;
diff -Nru openjdk-boot.orig/jdk/src/share/classes/java/nio/file/CopyMoveHelper.java openjdk-boot/jdk/src/share/classes/java/nio/file/CopyMoveHelper.java
--- openjdk-boot.orig/jdk/src/share/classes/java/nio/file/CopyMoveHelper.java	2016-09-19 11:44:50.000000000 +0100
+++ openjdk-boot/jdk/src/share/classes/java/nio/file/CopyMoveHelper.java	2017-04-04 19:12:04.792060798 +0100
@@ -122,9 +122,15 @@
         if (attrs.isDirectory()) {
             Files.createDirectory(target);
         } else {
-            try (InputStream in = Files.newInputStream(source)) {
+            InputStream in = null;
+            try {
+                in = Files.newInputStream(source);
                 Files.copy(in, target);
             }
+            finally {
+                if (in != null)
+                    in.close();
+            }
         }
 
         // copy basic attributes to target
@@ -142,7 +148,7 @@
                 } catch (Throwable suppressed) {
                     x.addSuppressed(suppressed);
                 }
-                throw x;
+                throw (IOException) x;
             }
         }
     }
diff -Nru openjdk-boot.orig/jdk/src/share/classes/java/nio/file/Files.java openjdk-boot/jdk/src/share/classes/java/nio/file/Files.java
--- openjdk-boot.orig/jdk/src/share/classes/java/nio/file/Files.java	2016-09-19 11:44:50.000000000 +0100
+++ openjdk-boot/jdk/src/share/classes/java/nio/file/Files.java	2017-04-04 19:12:04.792060798 +0100
@@ -2850,8 +2850,11 @@
         }
 
         // do the copy
-        try (OutputStream out = ostream) {
-            return copy(in, out);
+        try {
+            return copy(in, ostream);
+        }
+        finally {
+            ostream.close();
         }
     }
 
@@ -2892,9 +2895,15 @@
         // ensure not null before opening file
         Objects.requireNonNull(out);
 
-        try (InputStream in = newInputStream(source)) {
+        InputStream in = null;
+        try {
+            in = newInputStream(source);
             return copy(in, out);
         }
+        finally {
+            if (in != null)
+                in.close();
+        }
     }
 
     /**
@@ -2978,14 +2987,27 @@
      *          method is invoked to check read access to the file.
      */
     public static byte[] readAllBytes(Path path) throws IOException {
-        try (SeekableByteChannel sbc = Files.newByteChannel(path);
-             InputStream in = Channels.newInputStream(sbc)) {
+        SeekableByteChannel sbc = null;
+	 InputStream in = null;
+
+        try {
+	    sbc = Files.newByteChannel(path);
+            in = Channels.newInputStream(sbc);
             long size = sbc.size();
             if (size > (long)MAX_BUFFER_SIZE)
                 throw new OutOfMemoryError("Required array size too large");
 
             return read(in, (int)size);
-        }
+        } finally {
+	    IOException e = null;
+
+	    if (in != null)
+		try { in.close(); } catch (IOException ex) { e = ex; }
+	    if (sbc != null)
+		try { sbc.close(); } catch (IOException ex) { e = ex; }
+
+	    if (e != null) throw e;
+	}
     }
 
     /**
@@ -3030,7 +3052,9 @@
     public static List<String> readAllLines(Path path, Charset cs)
         throws IOException
     {
-        try (BufferedReader reader = newBufferedReader(path, cs)) {
+        BufferedReader reader = null;
+        try {
+            reader = newBufferedReader(path, cs);
             List<String> result = new ArrayList<>();
             for (;;) {
                 String line = reader.readLine();
@@ -3040,6 +3064,10 @@
             }
             return result;
         }
+        finally {
+            if (reader != null)
+                reader.close();
+        }
     }
 
     /**
@@ -3089,7 +3117,9 @@
         // ensure bytes is not null before opening file
         Objects.requireNonNull(bytes);
 
-        try (OutputStream out = Files.newOutputStream(path, options)) {
+        OutputStream out = null;
+        try {
+            out = Files.newOutputStream(path, options);
             int len = bytes.length;
             int rem = len;
             while (rem > 0) {
@@ -3098,6 +3128,10 @@
                 rem -= n;
             }
         }
+        finally {
+            if (out != null)
+                out.close();
+        }
         return path;
     }
 
@@ -3149,12 +3183,18 @@
         Objects.requireNonNull(lines);
         CharsetEncoder encoder = cs.newEncoder();
         OutputStream out = newOutputStream(path, options);
-        try (BufferedWriter writer = new BufferedWriter(new OutputStreamWriter(out, encoder))) {
+        BufferedWriter writer = null;
+        try {
+            writer = new BufferedWriter(new OutputStreamWriter(out, encoder));
             for (CharSequence line: lines) {
                 writer.append(line);
                 writer.newLine();
             }
         }
+        finally {
+            if (writer != null)
+                writer.close();
+        }
         return path;
     }
 }
diff -Nru openjdk-boot.orig/jdk/src/share/classes/java/util/Currency.java openjdk-boot/jdk/src/share/classes/java/util/Currency.java
--- openjdk-boot.orig/jdk/src/share/classes/java/util/Currency.java	2016-09-19 11:44:50.000000000 +0100
+++ openjdk-boot/jdk/src/share/classes/java/util/Currency.java	2017-04-04 19:12:04.792060798 +0100
@@ -237,9 +237,14 @@
                                              "currency.properties");
                     if (propFile.exists()) {
                         Properties props = new Properties();
-                        try (FileReader fr = new FileReader(propFile)) {
+                        FileReader fr = null;
+                        try {
+                            fr = new FileReader(propFile);
                             props.load(fr);
                         }
+                        finally {
+                            fr.close();
+                        }
                         Set<String> keys = props.stringPropertyNames();
                         Pattern propertiesPattern =
                             Pattern.compile("([A-Z]{3})\\s*,\\s*(\\d{3})\\s*,\\s*(\\d+)");
diff -Nru openjdk-boot.orig/jdk/src/share/classes/java/util/jar/JarFile.java openjdk-boot/jdk/src/share/classes/java/util/jar/JarFile.java
--- openjdk-boot.orig/jdk/src/share/classes/java/util/jar/JarFile.java	2016-09-19 11:44:50.000000000 +0100
+++ openjdk-boot/jdk/src/share/classes/java/util/jar/JarFile.java	2017-04-04 19:12:04.792060798 +0100
@@ -386,9 +386,14 @@
      * META-INF files.
      */
     private byte[] getBytes(ZipEntry ze) throws IOException {
-        try (InputStream is = super.getInputStream(ze)) {
+	InputStream is = null;
+	try {
+	    is = super.getInputStream(ze);
             return IOUtils.readFully(is, (int)ze.getSize(), true);
-        }
+        } finally {
+	    if (is != null)
+		is.close();
+	}
     }
 
     /**
diff -Nru openjdk-boot.orig/jdk/src/share/classes/javax/sql/rowset/serial/SerialClob.java openjdk-boot/jdk/src/share/classes/javax/sql/rowset/serial/SerialClob.java
--- openjdk-boot.orig/jdk/src/share/classes/javax/sql/rowset/serial/SerialClob.java	2016-09-19 11:44:50.000000000 +0100
+++ openjdk-boot/jdk/src/share/classes/javax/sql/rowset/serial/SerialClob.java	2017-04-04 19:12:04.792060798 +0100
@@ -144,8 +144,9 @@
         buf = new char[(int)len];
         int read = 0;
         int offset = 0;
-
-        try (Reader charStream = clob.getCharacterStream()) {
+        Reader charStream = null;
+        try {
+            charStream = clob.getCharacterStream();
             if (charStream == null) {
                 throw new SQLException("Invalid Clob object. The call to getCharacterStream " +
                     "returned null which cannot be serialized.");
@@ -153,23 +154,41 @@
 
             // Note: get an ASCII stream in order to null-check it,
             // even though we don't do anything with it.
-            try (InputStream asciiStream = clob.getAsciiStream()) {
+            InputStream asciiStream = null;
+            try {
+                asciiStream = clob.getAsciiStream();
                 if (asciiStream == null) {
                     throw new SQLException("Invalid Clob object. The call to getAsciiStream " +
                         "returned null which cannot be serialized.");
                 }
             }
-
-            try (Reader reader = new BufferedReader(charStream)) {
+            finally {
+                if (asciiStream != null)
+                    asciiStream.close();
+            }
+            Reader reader = null;
+            try {
+                reader = new BufferedReader(charStream);
                 do {
                     read = reader.read(buf, offset, (int)(len - offset));
                     offset += read;
                 } while (read > 0);
             }
+            finally {
+                if (reader != null)
+                    reader.close();
+            }
         } catch (java.io.IOException ex) {
             throw new SerialException("SerialClob: " + ex.getMessage());
         }
-
+        finally {
+            try {
+                if (charStream != null)
+                    charStream.close();
+            } catch (java.io.IOException ex) {
+                throw new SerialException("SerialClob: " + ex.getMessage());
+            }
+        }
         origLen = len;
     }
 
diff -Nru openjdk-boot.orig/jdk/src/share/classes/javax/sql/rowset/spi/SyncFactory.java openjdk-boot/jdk/src/share/classes/javax/sql/rowset/spi/SyncFactory.java
--- openjdk-boot.orig/jdk/src/share/classes/javax/sql/rowset/spi/SyncFactory.java	2016-09-19 11:44:50.000000000 +0100
+++ openjdk-boot/jdk/src/share/classes/javax/sql/rowset/spi/SyncFactory.java	2017-04-04 19:12:04.792060798 +0100
@@ -382,9 +382,15 @@
                     // Load user's implementation of SyncProvider
                     // here. -Drowset.properties=/abc/def/pqr.txt
                     ROWSET_PROPERTIES = strRowsetProperties;
-                    try (FileInputStream fis = new FileInputStream(ROWSET_PROPERTIES)) {
+                    FileInputStream fis = null;
+                    try {
+                        fis = new FileInputStream(ROWSET_PROPERTIES);
                         properties.load(fis);
                     }
+                    finally {
+                        if (fis != null)
+                            fis.close();
+                    }
                     parseProperties(properties);
                 }
 
@@ -401,17 +407,20 @@
                     AccessController.doPrivileged(new PrivilegedExceptionAction<Void>() {
                         @Override
                         public Void run()  throws SyncFactoryException, IOException, FileNotFoundException {
-                            try (InputStream stream  = (cl == null) ?
-                                    ClassLoader.getSystemResourceAsStream(ROWSET_PROPERTIES)
-                                    : cl.getResourceAsStream(ROWSET_PROPERTIES)) {
-                                if (stream == null) {
-                                    throw new SyncFactoryException("Resource " + ROWSET_PROPERTIES + " not found");
-                                }
-                                properties.load(stream);
-                            }
-                            return null;
-                        }
-
+			  InputStream stream = null;
+			  try {
+			    stream =
+			      (cl == null) ? ClassLoader.getSystemResourceAsStream(ROWSET_PROPERTIES)
+			      : cl.getResourceAsStream(ROWSET_PROPERTIES);
+			    if (stream == null) {
+			      throw new SyncFactoryException("Resource " + ROWSET_PROPERTIES + " not found");
+			    }
+			    properties.load(stream);
+			  } finally {
+			    if (stream != null)
+			      stream.close();
+			  }
+			  return null; }
                     });
                 } catch (PrivilegedActionException ex) {
                     Throwable e = ex.getException();
diff -Nru openjdk-boot.orig/jdk/src/share/classes/sun/launcher/LauncherHelper.java openjdk-boot/jdk/src/share/classes/sun/launcher/LauncherHelper.java
--- openjdk-boot.orig/jdk/src/share/classes/sun/launcher/LauncherHelper.java	2017-04-04 18:43:19.643569612 +0100
+++ openjdk-boot/jdk/src/share/classes/sun/launcher/LauncherHelper.java	2017-04-04 19:12:04.792060798 +0100
@@ -555,8 +555,9 @@
                 if (parent == null) {
                     parent = new File(".");
                 }
-                try (DirectoryStream<Path> dstream =
-                        Files.newDirectoryStream(parent.toPath(), glob)) {
+                DirectoryStream<Path> dstream = null;
+                try {
+                    dstream = Files.newDirectoryStream(parent.toPath(), glob);
                     int entries = 0;
                     for (Path p : dstream) {
                         out.add(p.normalize().toString());
@@ -571,6 +572,9 @@
                         System.err.println("Warning: passing argument as-is " + a);
                         System.err.print(e);
                     }
+                } finally {
+                    if (dstream != null)
+                        try { dstream.close(); } catch (IOException e) {}
                 }
             } else {
                 out.add(a.arg);
diff -Nru openjdk-boot.orig/jdk/src/share/classes/sun/net/www/protocol/jar/URLJarFile.java openjdk-boot/jdk/src/share/classes/sun/net/www/protocol/jar/URLJarFile.java
--- openjdk-boot.orig/jdk/src/share/classes/sun/net/www/protocol/jar/URLJarFile.java	2016-09-19 11:44:50.000000000 +0100
+++ openjdk-boot/jdk/src/share/classes/sun/net/www/protocol/jar/URLJarFile.java	2017-04-04 19:12:04.792060798 +0100
@@ -194,7 +194,8 @@
      * Given a URL, retrieves a JAR file, caches it to disk, and creates a
      * cached JAR file object.
      */
-     private static JarFile retrieve(final URL url, final URLJarFileCloseController closeController) throws IOException {
+     private static JarFile retrieve(final URL url, final URLJarFileCloseController closeController)
+         throws IOException {
         /*
          * See if interface is set, then call retrieve function of the class
          * that implements URLJarFileCallBack interface (sun.plugin - to
@@ -211,7 +212,8 @@
             JarFile result = null;
 
             /* get the stream before asserting privileges */
-            try (final InputStream in = url.openConnection().getInputStream()) {
+            try {
+                final InputStream in = url.openConnection().getInputStream();
                 result = AccessController.doPrivileged(
                     new PrivilegedExceptionAction<JarFile>() {
                         public JarFile run() throws IOException {
@@ -227,7 +229,10 @@
                                 } catch (IOException ioe) {
                                     thr.addSuppressed(ioe);
                                 }
-                                throw thr;
+                                throw (IOException) thr;
+                            } finally {
+                                if (in != null)
+                                    in.close();
                             }
                         }
                     });
diff -Nru openjdk-boot.orig/jdk/src/share/classes/sun/nio/fs/PollingWatchService.java openjdk-boot/jdk/src/share/classes/sun/nio/fs/PollingWatchService.java
--- openjdk-boot.orig/jdk/src/share/classes/sun/nio/fs/PollingWatchService.java	2016-09-19 11:44:50.000000000 +0100
+++ openjdk-boot/jdk/src/share/classes/sun/nio/fs/PollingWatchService.java	2017-04-04 19:12:04.792060798 +0100
@@ -255,7 +255,9 @@
             this.entries = new HashMap<Path,CacheEntry>();
 
             // get the initial entries in the directory
-            try (DirectoryStream<Path> stream = Files.newDirectoryStream(dir)) {
+            DirectoryStream<Path> stream = null;
+            try {
+                stream = Files.newDirectoryStream(dir);
                 for (Path entry: stream) {
                     // don't follow links
                     long lastModified =
@@ -264,6 +266,10 @@
                 }
             } catch (DirectoryIteratorException e) {
                 throw e.getCause();
+            } finally {
+                if (stream != null) {
+                    stream.close();
+                }
             }
         }
 
diff -Nru openjdk-boot.orig/jdk/src/share/classes/sun/print/PSPrinterJob.java openjdk-boot/jdk/src/share/classes/sun/print/PSPrinterJob.java
--- openjdk-boot.orig/jdk/src/share/classes/sun/print/PSPrinterJob.java	2016-09-19 11:44:50.000000000 +0100
+++ openjdk-boot/jdk/src/share/classes/sun/print/PSPrinterJob.java	2017-04-04 19:12:04.792060798 +0100
@@ -680,25 +680,38 @@
 
         private void handleProcessFailure(final Process failedProcess,
                 final String[] execCmd, final int result) throws IOException {
-            try (StringWriter sw = new StringWriter();
-                    PrintWriter pw = new PrintWriter(sw)) {
+	    StringWriter sw = null;
+	    PrintWriter pw = null;
+            try { 
+		sw = new StringWriter();
+		pw = new PrintWriter(sw);
                 pw.append("error=").append(Integer.toString(result));
                 pw.append(" running:");
                 for (String arg: execCmd) {
                     pw.append(" '").append(arg).append("'");
                 }
-                try (InputStream is = failedProcess.getErrorStream();
-                        InputStreamReader isr = new InputStreamReader(is);
-                        BufferedReader br = new BufferedReader(isr)) {
+		InputStream is = null;
+		InputStreamReader isr = null;
+		BufferedReader br = null;
+                try {
+		    is = failedProcess.getErrorStream();
+                    isr = new InputStreamReader(is);
+                    br = new BufferedReader(isr);
                     while (br.ready()) {
                         pw.println();
                         pw.append("\t\t").append(br.readLine());
                     }
                 } finally {
                     pw.flush();
+		    if (br != null) br.close();
+		    if (isr != null) isr.close();
+		    if (is != null) is.close();
                     throw new IOException(sw.toString());
                 }
-            }
+            } finally {
+		if (pw != null) pw.close();
+		if (sw != null) sw.close();
+	    }
         }
 
         public Object run() {
diff -Nru openjdk-boot.orig/jdk/src/share/classes/sun/rmi/log/ReliableLog.java openjdk-boot/jdk/src/share/classes/sun/rmi/log/ReliableLog.java
--- openjdk-boot.orig/jdk/src/share/classes/sun/rmi/log/ReliableLog.java	2016-09-19 11:44:50.000000000 +0100
+++ openjdk-boot/jdk/src/share/classes/sun/rmi/log/ReliableLog.java	2017-04-04 19:12:04.792060798 +0100
@@ -594,10 +594,16 @@
         } else {
             name = versionFile;
         }
-        try (FileOutputStream fos = new FileOutputStream(fName(name));
-             DataOutputStream out = new DataOutputStream(fos)) {
+	FileOutputStream fos = null;
+	DataOutputStream out = null;
+        try {
+	    fos = new FileOutputStream(fName(name));
+	    out = new DataOutputStream(fos);
             writeInt(out, version);
-        }
+        } finally {
+	    if (out != null) out.close();
+	    if (fos != null) fos.close();
+	}
     }
 
     /**
@@ -628,10 +634,13 @@
      * @exception IOException If an I/O error has occurred.
      */
     private int readVersion(String name) throws IOException {
-        try (DataInputStream in = new DataInputStream
-                (new FileInputStream(name))) {
+	DataInputStream in = null;
+        try {
+	    in = new DataInputStream(new FileInputStream(name));
             return in.readInt();
-        }
+        } finally {
+	    if (in != null) in.close();
+	}
     }
 
     /**
diff -Nru openjdk-boot.orig/jdk/src/share/classes/sun/rmi/server/Activation.java openjdk-boot/jdk/src/share/classes/sun/rmi/server/Activation.java
--- openjdk-boot.orig/jdk/src/share/classes/sun/rmi/server/Activation.java	2016-09-19 11:44:50.000000000 +0100
+++ openjdk-boot/jdk/src/share/classes/sun/rmi/server/Activation.java	2017-04-04 19:12:04.792060798 +0100
@@ -1233,13 +1233,16 @@
                     PipeWriter.plugTogetherPair
                         (child.getInputStream(), System.out,
                          child.getErrorStream(), System.err);
-                    try (MarshalOutputStream out =
-                            new MarshalOutputStream(child.getOutputStream())) {
+		    MarshalOutputStream out = null;
+                    try {
+			out = new MarshalOutputStream(child.getOutputStream());
                         out.writeObject(id);
                         out.writeObject(desc);
                         out.writeLong(incarnation);
                         out.flush();
-                    }
+                    } finally {
+			if (out != null) out.close();
+		    }
 
 
                 } catch (IOException e) {
diff -Nru openjdk-boot.orig/jdk/src/share/classes/sun/rmi/transport/proxy/RMIMasterSocketFactory.java openjdk-boot/jdk/src/share/classes/sun/rmi/transport/proxy/RMIMasterSocketFactory.java
--- openjdk-boot.orig/jdk/src/share/classes/sun/rmi/transport/proxy/RMIMasterSocketFactory.java	2017-04-04 18:43:20.319558954 +0100
+++ openjdk-boot/jdk/src/share/classes/sun/rmi/transport/proxy/RMIMasterSocketFactory.java	2017-04-04 19:12:04.792060798 +0100
@@ -233,13 +233,14 @@
                         proxyLog.log(Log.BRIEF,
                             "trying with factory: " + factory);
                     }
-                    try (Socket testSocket =
-                            factory.createSocket(host, port)) {
+		    Socket testSocket = null;
+                    try {
                         // For HTTP connections, the output (POST request) must
                         // be sent before we verify a successful connection.
                         // So, sacrifice a socket for the sake of testing...
                         // The following sequence should verify a successful
                         // HTTP connection if no IOException is thrown.
+			testSocket = factory.createSocket(host, port);
                         InputStream in = testSocket.getInputStream();
                         int b = in.read(); // probably -1 for EOF...
                     } catch (IOException ex) {
@@ -249,6 +250,10 @@
 
                         continue;
                     }
+		    finally {
+			if (testSocket != null)
+			    testSocket.close();
+		    }
                     proxyLog.log(Log.BRIEF, "factory succeeded");
 
                     // factory succeeded, open new socket for caller's use
diff -Nru openjdk-boot.orig/jdk/src/share/classes/sun/security/krb5/internal/ccache/FileCredentialsCache.java openjdk-boot/jdk/src/share/classes/sun/security/krb5/internal/ccache/FileCredentialsCache.java
--- openjdk-boot.orig/jdk/src/share/classes/sun/security/krb5/internal/ccache/FileCredentialsCache.java	2016-09-19 11:44:50.000000000 +0100
+++ openjdk-boot/jdk/src/share/classes/sun/security/krb5/internal/ccache/FileCredentialsCache.java	2017-04-04 19:12:04.796060734 +0100
@@ -156,18 +156,33 @@
     synchronized void init(PrincipalName principal, String name)
         throws IOException, KrbException {
         primaryPrincipal = principal;
-        try (FileOutputStream fos = new FileOutputStream(name);
-             CCacheOutputStream cos = new CCacheOutputStream(fos)) {
+        FileOutputStream fos = null;
+        CCacheOutputStream cos = null;
+        try {
+            fos = new FileOutputStream(name);
+            cos = new CCacheOutputStream(fos);
             version = KRB5_FCC_FVNO_3;
             cos.writeHeader(primaryPrincipal, version);
+        } finally {
+            try {
+                if (cos != null)
+                    cos.close();
+            } finally {
+                if (fos != null)
+                    fos.close();
+            }
         }
+
         load(name);
     }
 
     synchronized void load(String name) throws IOException, KrbException {
         PrincipalName p;
-        try (FileInputStream fis = new FileInputStream(name);
-             CCacheInputStream cis = new CCacheInputStream(fis)) {
+        FileInputStream fis = null;
+        CCacheInputStream cis = null;
+        try {
+            fis = new FileInputStream(name);
+            cis = new CCacheInputStream(fis);
             version = cis.readVersion();
             if (version == KRB5_FCC_FVNO_4) {
                 tag = cis.readTag();
@@ -192,6 +207,14 @@
                     credentialsList.addElement(cred);
                 }
             }
+        } finally {
+            try {
+                if (cis != null)
+                    cis.close();
+            } finally {
+                if (fis != null)
+                    fis.close();
+            }
         }
     }
 
@@ -251,8 +274,11 @@
      * Saves the credentials cache file to the disk.
      */
     public synchronized void save() throws IOException, Asn1Exception {
-        try (FileOutputStream fos = new FileOutputStream(cacheName);
-             CCacheOutputStream cos = new CCacheOutputStream(fos)) {
+        FileOutputStream fos = null;
+        CCacheOutputStream cos = null;
+        try {
+            fos = new FileOutputStream(cacheName);
+            cos = new CCacheOutputStream(fos);
             cos.writeHeader(primaryPrincipal, version);
             Credentials[] tmp = null;
             if ((tmp = getCredsList()) != null) {
@@ -260,6 +286,14 @@
                     cos.addCreds(tmp[i]);
                 }
             }
+        } finally {
+            try {
+                if (cos != null)
+                    cos.close();
+            } finally {
+                if (fos != null)
+                    fos.close();
+            }
         }
     }
 
diff -Nru openjdk-boot.orig/jdk/src/share/classes/sun/security/krb5/internal/ktab/KeyTab.java openjdk-boot/jdk/src/share/classes/sun/security/krb5/internal/ktab/KeyTab.java
--- openjdk-boot.orig/jdk/src/share/classes/sun/security/krb5/internal/ktab/KeyTab.java	2016-09-19 11:44:50.000000000 +0100
+++ openjdk-boot/jdk/src/share/classes/sun/security/krb5/internal/ktab/KeyTab.java	2017-04-04 19:12:04.796060734 +0100
@@ -92,9 +92,13 @@
         tabName = filename;
         try {
             lastModified = new File(tabName).lastModified();
-            try (KeyTabInputStream kis =
-                    new KeyTabInputStream(new FileInputStream(filename))) {
+            KeyTabInputStream kis = null;
+            try {
+                kis = new KeyTabInputStream(new FileInputStream(filename));
                 load(kis);
+            } finally {
+                if (kis != null)
+                    kis.close();
             }
         } catch (FileNotFoundException e) {
             entries.clear();
@@ -441,9 +445,13 @@
     public synchronized static KeyTab create(String name)
         throws IOException, RealmException {
 
-        try (KeyTabOutputStream kos =
-                new KeyTabOutputStream(new FileOutputStream(name))) {
+        KeyTabOutputStream kos = null;
+        try {
+            kos = new KeyTabOutputStream(new FileOutputStream(name));
             kos.writeVersion(KRB5_KT_VNO);
+        } finally {
+            if (kos != null)
+                kos.close();
         }
         return new KeyTab(name);
     }
@@ -452,12 +460,16 @@
      * Saves the file at the directory.
      */
     public synchronized void save() throws IOException {
-        try (KeyTabOutputStream kos =
-                new KeyTabOutputStream(new FileOutputStream(tabName))) {
+        KeyTabOutputStream kos = null;
+        try {
+            kos = new KeyTabOutputStream(new FileOutputStream(tabName));
             kos.writeVersion(kt_vno);
             for (int i = 0; i < entries.size(); i++) {
                 kos.writeEntry(entries.elementAt(i));
             }
+        } finally {
+            if (kos != null)
+                kos.close();
         }
     }
 
@@ -521,9 +533,13 @@
      * @exception IOException.
      */
     public synchronized void createVersion(File file) throws IOException {
-        try (KeyTabOutputStream kos =
-                new KeyTabOutputStream(new FileOutputStream(file))) {
+        KeyTabOutputStream kos = null;
+        try {
+            kos = new KeyTabOutputStream(new FileOutputStream(file));
             kos.write16(KRB5_KT_VNO);
+        } finally {
+            if (kos != null)
+                kos.close();
         }
     }
 }
diff -Nru openjdk-boot.orig/jdk/src/share/classes/sun/security/provider/certpath/URICertStore.java openjdk-boot/jdk/src/share/classes/sun/security/provider/certpath/URICertStore.java
--- openjdk-boot.orig/jdk/src/share/classes/sun/security/provider/certpath/URICertStore.java	2017-04-04 18:43:20.319558954 +0100
+++ openjdk-boot/jdk/src/share/classes/sun/security/provider/certpath/URICertStore.java	2017-04-04 19:12:04.796060734 +0100
@@ -279,7 +279,9 @@
                 connection.setIfModifiedSince(lastModified);
             }
             long oldLastModified = lastModified;
-            try (InputStream in = connection.getInputStream()) {
+            InputStream in = null;
+            try {
+                in = connection.getInputStream();
                 lastModified = connection.getLastModified();
                 if (oldLastModified != 0) {
                     if (oldLastModified == lastModified) {
@@ -305,6 +307,8 @@
                 // Safe cast since factory is an X.509 certificate factory
                 certs = (Collection<X509Certificate>)
                     factory.generateCertificates(in);
+            } finally {
+                if (in != null) { in.close(); }
             }
             return getMatchingCerts(certs, selector);
         } catch (IOException e) {
@@ -393,7 +397,9 @@
             }
             long oldLastModified = lastModified;
             connection.setConnectTimeout(CRL_CONNECT_TIMEOUT);
-            try (InputStream in = connection.getInputStream()) {
+            InputStream in = null;
+            try {
+                in = connection.getInputStream();
                 lastModified = connection.getLastModified();
                 if (oldLastModified != 0) {
                     if (oldLastModified == lastModified) {
@@ -417,6 +423,8 @@
                     debug.println("Downloading new CRL...");
                 }
                 crl = (X509CRL) factory.generateCRL(in);
+            } finally {
+                if (in != null) { in.close(); }
             }
             return getMatchingCRLs(crl, selector);
         } catch (IOException e) {
diff -Nru openjdk-boot.orig/jdk/src/share/classes/sun/security/provider/SeedGenerator.java openjdk-boot/jdk/src/share/classes/sun/security/provider/SeedGenerator.java
--- openjdk-boot.orig/jdk/src/share/classes/sun/security/provider/SeedGenerator.java	2016-09-19 11:44:50.000000000 +0100
+++ openjdk-boot/jdk/src/share/classes/sun/security/provider/SeedGenerator.java	2017-04-04 19:12:04.796060734 +0100
@@ -179,7 +179,9 @@
                         // The temporary dir
                         File f = new File(p.getProperty("java.io.tmpdir"));
                         int count = 0;
-                        try (DirectoryStream<Path> stream = Files.newDirectoryStream(f.toPath())) {
+                        DirectoryStream<Path> stream = null;
+                        try {
+                            stream = Files.newDirectoryStream(f.toPath());
                             // We use a Random object to choose what file names
                             // should be used. Otherwise on a machine with too
                             // many files, the same first 1024 files always get
@@ -194,6 +196,10 @@
                                     break;
                                 }
                             }
+                        } finally {
+                            if (stream != null) {
+                                stream.close();
+                            }
                         }
                     } catch (Exception ex) {
                         md.update((byte)ex.hashCode());
diff -Nru openjdk-boot.orig/jdk/src/share/classes/sun/security/tools/jarsigner/Main.java openjdk-boot/jdk/src/share/classes/sun/security/tools/jarsigner/Main.java
--- openjdk-boot.orig/jdk/src/share/classes/sun/security/tools/jarsigner/Main.java	2017-04-06 04:20:36.335954421 +0100
+++ openjdk-boot/jdk/src/share/classes/sun/security/tools/jarsigner/Main.java	2017-04-06 04:22:10.078450933 +0100
@@ -606,13 +606,15 @@
             while (entries.hasMoreElements()) {
                 JarEntry je = entries.nextElement();
                 entriesVec.addElement(je);
-                try (InputStream is = jf.getInputStream(je)) {
+                InputStream is = null;
+                try {
+                    is = jf.getInputStream(je);
                     String name = je.getName();
                     if (signatureRelated(name)
                             && SignatureFileVerifier.isBlockOrSF(name)) {
                         String alias = name.substring(name.lastIndexOf('/') + 1,
                                 name.lastIndexOf('.'));
-                try {
+                        try {
                             if (name.endsWith(".SF")) {
                                 Manifest sf = new Manifest(is);
                                 boolean found = false;
@@ -647,7 +649,11 @@
                         while (is.read(buffer, 0, buffer.length) != -1) {
                         // we just read. this will throw a SecurityException
                         // if  a signature/digest check fails.
+                        }
                     }
+                } finally {
+                    if (is != null) {
+                        is.close();
                     }
                 }
             }
diff -Nru openjdk-boot.orig/jdk/src/share/classes/sun/security/tools/KeyStoreUtil.java openjdk-boot/jdk/src/share/classes/sun/security/tools/KeyStoreUtil.java
--- openjdk-boot.orig/jdk/src/share/classes/sun/security/tools/KeyStoreUtil.java	2016-09-19 11:44:50.000000000 +0100
+++ openjdk-boot/jdk/src/share/classes/sun/security/tools/KeyStoreUtil.java	2017-04-04 19:12:04.796060734 +0100
@@ -94,9 +94,13 @@
             return null;
         }
         KeyStore caks = null;
-        try (FileInputStream fis = new FileInputStream(file)) {
+        FileInputStream fis = null;
+        try {
+            fis = new FileInputStream(file);
             caks = KeyStore.getInstance(JKS);
             caks.load(fis, null);
+        } finally {
+            if (fis != null) { fis.close(); }
         }
         return caks;
     }
@@ -130,9 +134,9 @@
                     }
                 }
 
-                try (BufferedReader br =
-                     new BufferedReader(new InputStreamReader(
-                         url.openStream()))) {
+                BufferedReader br = null;
+                try {
+                    br = new BufferedReader(new InputStreamReader(url.openStream()));
                     String value = br.readLine();
 
                     if (value == null) {
@@ -140,6 +144,8 @@
                     }
 
                     return value.toCharArray();
+                } finally {
+                    if (br != null) { br.close(); }
                 }
             } catch (IOException ioe) {
                 System.err.println(ioe);
diff -Nru openjdk-boot.orig/jdk/src/share/classes/sun/security/tools/keytool/Main.java openjdk-boot/jdk/src/share/classes/sun/security/tools/keytool/Main.java
--- openjdk-boot.orig/jdk/src/share/classes/sun/security/tools/keytool/Main.java	2017-04-04 18:43:20.323558891 +0100
+++ openjdk-boot/jdk/src/share/classes/sun/security/tools/keytool/Main.java	2017-04-04 19:12:04.796060734 +0100
@@ -917,9 +917,12 @@
         // Perform the specified command
         if (command == CERTREQ) {
             if (filename != null) {
-                try (PrintStream ps = new PrintStream(new FileOutputStream
-                                                      (filename))) {
+                PrintStream ps = null;
+                try {
+                    ps = new PrintStream(new FileOutputStream(filename));
                     doCertReq(alias, sigAlgName, ps);
+                } finally {
+                    if (ps != null) { ps.close(); }
                 }
             } else {
                 doCertReq(alias, sigAlgName, out);
@@ -936,9 +939,12 @@
             kssave = true;
         } else if (command == EXPORTCERT) {
             if (filename != null) {
-                try (PrintStream ps = new PrintStream(new FileOutputStream
-                                                   (filename))) {
+                PrintStream ps = null;
+                try {
+                    ps = new PrintStream(new FileOutputStream(filename));
                     doExportCert(alias, ps);
+                } finally {
+                    if (ps != null) { ps.close(); }
                 }
             } else {
                 doExportCert(alias, out);
@@ -963,8 +969,12 @@
             kssave = true;
         } else if (command == IDENTITYDB) {
             if (filename != null) {
-                try (InputStream inStream = new FileInputStream(filename)) {
+                InputStream inStream = null;
+                try {
+                    inStream = new FileInputStream(filename);
                     doImportIdentityDatabase(inStream);
+                } finally {
+                    if (inStream != null) { inStream.close(); }
                 }
             } else {
                 doImportIdentityDatabase(System.in);
@@ -1087,17 +1097,24 @@
                 alias = keyAlias;
             }
             if (filename != null) {
-                try (PrintStream ps =
-                         new PrintStream(new FileOutputStream(filename))) {
+                PrintStream ps = null;
+                try {
+                    ps = new PrintStream(new FileOutputStream(filename));
                     doGenCRL(ps);
+                } finally {
+                    if (ps != null) { ps.close(); }
                 }
             } else {
                 doGenCRL(out);
             }
         } else if (command == PRINTCERTREQ) {
             if (filename != null) {
-                try (InputStream inStream = new FileInputStream(filename)) {
+                InputStream inStream = null;
+                try {
+                    inStream = new FileInputStream(filename);
                     doPrintCertReq(inStream, out);
+                } finally {
+                    if (inStream != null) { inStream.close(); }
                 }
             } else {
                 doPrintCertReq(System.in, out);
@@ -1124,8 +1141,13 @@
                 } else {
                     ByteArrayOutputStream bout = new ByteArrayOutputStream();
                     keyStore.store(bout, pass);
-                    try (FileOutputStream fout = new FileOutputStream(ksfname)) {
+                    FileOutputStream fout = null;
+                    try {
+                        fout = new FileOutputStream(ksfname);
                         fout.write(bout.toByteArray());
+                    } finally {
+                        if (fout != null)
+                            fout.close();
                     }
                 }
             }
@@ -2241,12 +2263,16 @@
             int pos = 0;
             while (entries.hasMoreElements()) {
                 JarEntry je = entries.nextElement();
-                try (InputStream is = jf.getInputStream(je)) {
+                InputStream is = null;
+                try {
+                    is = jf.getInputStream(je);
                     while (is.read(buffer) != -1) {
                         // we just read. this will throw a SecurityException
                         // if a signature/digest check fails. This also
                         // populate the signers
                     }
+                } finally {
+                    if (is != null) { is.close(); }
                 }
                 CodeSigner[] signers = je.getCodeSigners();
                 if (signers != null) {
@@ -2333,8 +2359,12 @@
             }
         } else {
             if (filename != null) {
-                try (FileInputStream inStream = new FileInputStream(filename)) {
+                FileInputStream inStream = null;
+                try {
+                    inStream = new FileInputStream(filename);
                     printCertFromStream(inStream, out);
+                } finally {
+                    if (inStream != null) { inStream.close(); }
                 }
             } else {
                 printCertFromStream(System.in, out);
diff -Nru openjdk-boot.orig/jdk/src/share/classes/sun/security/util/AnchorCertificates.java openjdk-boot/jdk/src/share/classes/sun/security/util/AnchorCertificates.java
--- openjdk-boot.orig/jdk/src/share/classes/sun/security/util/AnchorCertificates.java	2017-04-06 03:44:19.666859284 +0100
+++ openjdk-boot/jdk/src/share/classes/sun/security/util/AnchorCertificates.java	2017-04-06 04:15:13.837131378 +0100
@@ -27,6 +27,7 @@
 
 import java.io.File;
 import java.io.FileInputStream;
+import java.io.IOException;
 import java.security.AccessController;
 import java.security.KeyStore;
 import java.security.PrivilegedAction;
@@ -55,7 +56,9 @@
                 KeyStore cacerts;
                 try {
                     cacerts = KeyStore.getInstance("JKS");
-                    try (FileInputStream fis = new FileInputStream(f)) {
+                    FileInputStream fis = null;
+                    try {
+                        fis = new FileInputStream(f);
                         cacerts.load(fis, null);
                         certs = new HashSet<>();
                         Enumeration<String> list = cacerts.aliases();
@@ -69,6 +72,10 @@
                                 certs.add(X509CertImpl.getFingerprint(HASH, cert));
                             }
                         }
+		    } finally {
+			if (fis != null) {
+			    try { fis.close(); } catch (IOException ex) {}
+			}
                     }
                 } catch (Exception e) {
                     if (debug != null) {
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	2016-09-19 11:44:50.000000000 +0100
+++ openjdk-boot/jdk/src/share/classes/sun/security/util/UntrustedCertificates.java	2017-04-06 04:03:53.524046185 +0100
@@ -56,7 +56,9 @@
             public Void run() {
                 File f = new File(System.getProperty("java.home"),
                         "lib/security/blacklisted.certs");
-                try (FileInputStream fin = new FileInputStream(f)) {
+		FileInputStream fin = null;
+                try {
+		    fin = new FileInputStream(f);
                     props.load(fin);
                     // It's said that the fingerprint could contain colons
                     for (Map.Entry<Object,Object> e: props.entrySet()) {
@@ -66,7 +68,11 @@
                     if (debug != null) {
                         debug.println("Error parsing blacklisted.certs");
                     }
-                }
+                } finally {
+		    if (fin != null) {
+			try { fin.close(); } catch (IOException ex) {}
+		    }
+		}
                 return null;
             }
         });
diff -Nru openjdk-boot.orig/jdk/src/share/classes/sun/tools/jcmd/Arguments.java openjdk-boot/jdk/src/share/classes/sun/tools/jcmd/Arguments.java
--- openjdk-boot.orig/jdk/src/share/classes/sun/tools/jcmd/Arguments.java	2016-09-19 11:44:50.000000000 +0100
+++ openjdk-boot/jdk/src/share/classes/sun/tools/jcmd/Arguments.java	2017-04-04 19:12:04.796060734 +0100
@@ -99,14 +99,19 @@
     }
 
     private void readCommandFile(String path) throws IOException {
-        try (BufferedReader bf = new BufferedReader(new FileReader(path));) {
-                StringBuilder sb = new StringBuilder();
-                String s;
-                while ((s = bf.readLine()) != null) {
-                    sb.append(s).append("\n");
-                }
-                command = sb.toString();
-            }
+	BufferedReader bf = null;
+        try {
+	    bf = new BufferedReader(new FileReader(path));
+	    StringBuilder sb = new StringBuilder();
+	    String s;
+	    while ((s = bf.readLine()) != null) {
+		sb.append(s).append("\n");
+	    }
+	    command = sb.toString();
+	} finally {
+	    if (bf != null)
+		bf.close();
+	}
     }
 
     public static void usage() {
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	2017-04-04 18:43:20.327558828 +0100
+++ openjdk-boot/jdk/src/share/classes/sun/tools/jcmd/JCmd.java	2017-04-04 19:12:04.796060734 +0100
@@ -158,7 +158,9 @@
             if (line.trim().equals("stop")) {
                 break;
             }
-            try (InputStream in = hvm.executeJCmd(line);) {
+            InputStream in = null;
+            try {
+                in = hvm.executeJCmd(line);
                 // read to EOF and just print output
                 byte b[] = new byte[256];
                 int n;
@@ -169,6 +171,9 @@
                         System.out.print(s);
                     }
                 } while (n > 0);
+            } finally {
+                if (in != null)
+                    in.close();
             }
         }
         vm.detach();
diff -Nru openjdk-boot.orig/jdk/src/share/classes/sun/util/calendar/LocalGregorianCalendar.java openjdk-boot/jdk/src/share/classes/sun/util/calendar/LocalGregorianCalendar.java
--- openjdk-boot.orig/jdk/src/share/classes/sun/util/calendar/LocalGregorianCalendar.java	2016-09-19 11:44:50.000000000 +0100
+++ openjdk-boot/jdk/src/share/classes/sun/util/calendar/LocalGregorianCalendar.java	2017-04-04 19:12:04.796060734 +0100
@@ -127,9 +127,15 @@
             calendarProps = (Properties) AccessController.doPrivileged(new PrivilegedExceptionAction() {
                 public Object run() throws IOException {
                     Properties props = new Properties();
-                    try (FileInputStream fis = new FileInputStream(fname)) {
+                    FileInputStream fis = null;
+                    try {
+                        fis = new FileInputStream(fname);
                         props.load(fis);
                     }
+                    finally {
+                        if (fis != null)
+                            fis.close();
+                    }
                     return props;
                 }
             });
diff -Nru openjdk-boot.orig/jdk/src/share/demo/jfc/Font2DTest/RangeMenu.java openjdk-boot/jdk/src/share/demo/jfc/Font2DTest/RangeMenu.java
--- openjdk-boot.orig/jdk/src/share/demo/jfc/Font2DTest/RangeMenu.java	2016-09-19 11:44:50.000000000 +0100
+++ openjdk-boot/jdk/src/share/demo/jfc/Font2DTest/RangeMenu.java	2017-04-04 19:12:04.796060734 +0100
@@ -200,7 +200,7 @@
     }
 
     private static int[][] getUnicodeRanges() {
-        List<Integer> ranges = new ArrayList<>();
+        List<Integer> ranges = new ArrayList<Integer>();
         ranges.add(0);
         Character.UnicodeBlock currentBlock = Character.UnicodeBlock.of(0);
         for (int cp = 0x000001; cp < 0x110000; cp++ ) {
diff -Nru openjdk-boot.orig/jdk/src/solaris/classes/java/util/prefs/FileSystemPreferences.java openjdk-boot/jdk/src/solaris/classes/java/util/prefs/FileSystemPreferences.java
--- openjdk-boot.orig/jdk/src/solaris/classes/java/util/prefs/FileSystemPreferences.java	2016-09-19 11:44:50.000000000 +0100
+++ openjdk-boot/jdk/src/solaris/classes/java/util/prefs/FileSystemPreferences.java	2017-04-04 19:12:04.796060734 +0100
@@ -569,11 +569,11 @@
                 public Void run() throws BackingStoreException {
                     Map<String, String> m = new TreeMap<>();
                     long newLastSyncTime = 0;
+                    FileInputStream fis = null;
                     try {
                         newLastSyncTime = prefsFile.lastModified();
-                        try (FileInputStream fis = new FileInputStream(prefsFile)) {
-                            XmlSupport.importMap(fis, m);
-                        }
+                        fis = new FileInputStream(prefsFile);
+                        XmlSupport.importMap(fis, m);
                     } catch(Exception e) {
                         if (e instanceof InvalidPreferencesFormatException) {
                             getLogger().warning("Invalid preferences format in "
@@ -588,6 +588,13 @@
                         } else {
                             throw new BackingStoreException(e);
                         }
+                    } finally {
+                        try {
+                            if (fis != null)
+                                fis.close();
+                        } catch (IOException e) {
+                            throw new BackingStoreException(e);
+                        }
                     }
                     // Attempt succeeded; update state
                     prefsCache = m;
@@ -614,13 +621,14 @@
             AccessController.doPrivileged(
                 new PrivilegedExceptionAction<Void>() {
                 public Void run() throws BackingStoreException {
+                    FileOutputStream fos = null;
                     try {
                         if (!dir.exists() && !dir.mkdirs())
                             throw new BackingStoreException(dir +
                                                              " create failed.");
-                        try (FileOutputStream fos = new FileOutputStream(tmpFile)) {
-                            XmlSupport.exportMap(fos, prefsCache);
-                        }
+
+                        fos = new FileOutputStream(tmpFile);
+                        XmlSupport.exportMap(fos, prefsCache);
                         if (!tmpFile.renameTo(prefsFile))
                             throw new BackingStoreException("Can't rename " +
                             tmpFile + " to " + prefsFile);
@@ -629,6 +637,14 @@
                             throw (BackingStoreException)e;
                         throw new BackingStoreException(e);
                     }
+                    finally {
+                        try {
+                            if (fos != null)
+                                fos.close();
+                        } catch (IOException e) {
+                            throw new BackingStoreException(e);
+                        }
+                    }
                     return null;
                 }
             });
diff -Nru openjdk-boot.orig/jdk/src/solaris/classes/sun/nio/fs/UnixFileStore.java openjdk-boot/jdk/src/solaris/classes/sun/nio/fs/UnixFileStore.java
--- openjdk-boot.orig/jdk/src/solaris/classes/sun/nio/fs/UnixFileStore.java	2016-09-19 11:44:50.000000000 +0100
+++ openjdk-boot/jdk/src/solaris/classes/sun/nio/fs/UnixFileStore.java	2017-04-04 19:12:04.796060734 +0100
@@ -256,9 +256,16 @@
         String fstypes = System.getProperty("java.home") + "/lib/fstypes.properties";
         Path file = Paths.get(fstypes);
         try {
-            try (ReadableByteChannel rbc = Files.newByteChannel(file)) {
+            ReadableByteChannel rbc = null;
+            try {
+                rbc = Files.newByteChannel(file);
                 result.load(Channels.newReader(rbc, "UTF-8"));
             }
+            finally {
+                if (rbc != null) {
+                    rbc.close();
+                }
+            }
         } catch (IOException x) {
         }
         return result;
diff -Nru openjdk-boot.orig/jdk/src/solaris/classes/sun/print/UnixPrintJob.java openjdk-boot/jdk/src/solaris/classes/sun/print/UnixPrintJob.java
--- openjdk-boot.orig/jdk/src/solaris/classes/sun/print/UnixPrintJob.java	2016-09-19 11:44:50.000000000 +0100
+++ openjdk-boot/jdk/src/solaris/classes/sun/print/UnixPrintJob.java	2017-04-04 19:12:04.796060734 +0100
@@ -960,25 +960,38 @@
 
         private void handleProcessFailure(final Process failedProcess,
                 final String[] execCmd, final int result) throws IOException {
-            try (StringWriter sw = new StringWriter();
-                    PrintWriter pw = new PrintWriter(sw)) {
+	    StringWriter sw = null;
+	    PrintWriter pw = null;
+            try {
+		sw = new StringWriter();
+                pw = new PrintWriter(sw);
                 pw.append("error=").append(Integer.toString(result));
                 pw.append(" running:");
                 for (String arg: execCmd) {
                     pw.append(" '").append(arg).append("'");
                 }
-                try (InputStream is = failedProcess.getErrorStream();
-                        InputStreamReader isr = new InputStreamReader(is);
-                        BufferedReader br = new BufferedReader(isr)) {
+		InputStream is = null;
+		InputStreamReader isr = null;
+		BufferedReader br = null;
+                try {
+		    is = failedProcess.getErrorStream();
+                    isr = new InputStreamReader(is);
+                    br = new BufferedReader(isr);
                     while (br.ready()) {
                         pw.println();
                         pw.append("\t\t").append(br.readLine());
                     }
                 } finally {
                     pw.flush();
+		    if (br != null) br.close();
+		    if (isr != null) isr.close();
+		    if (is != null) is.close();
                     throw new IOException(sw.toString());
                 }
-            }
+            } finally {
+		if (pw != null) pw.close();
+		if (sw != null) sw.close();
+	    }
         }
 
         public Object run() {