Sophie

Sophie

distrib > Mageia > 3 > i586 > media > core-release-src > by-pkgid > 8daf2e1da87d6ee2406f0321b0c46865 > files > 16

java-1.7.0-openjdk-1.7.0.19-2.3.9.1.mga3.src.rpm

diff -r 1631a3dee8fc 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	Wed Apr 20 04:38:36 2011 +0100
+++ openjdk-boot/jdk/src/share/classes/com/sun/java/util/jar/pack/BandStructure.java	Fri Apr 29 01:50:44 2011 +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 -r 1631a3dee8fc 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	Wed Apr 20 04:38:36 2011 +0100
+++ openjdk-boot/jdk/src/share/classes/com/sun/java/util/jar/pack/Driver.java	Fri Apr 29 01:50:44 2011 +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);
@@ -348,9 +353,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)
             }
@@ -411,7 +421,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--) {
@@ -425,6 +437,9 @@
                 }
             }
             return "";
+        } finally {
+            if (in != null)
+                in.close();
         }
     }
 
diff -r 1631a3dee8fc 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	Wed Apr 20 04:38:36 2011 +0100
+++ openjdk-boot/jdk/src/share/classes/com/sun/java/util/jar/pack/NativeUnpack.java	Fri Apr 29 01:50:44 2011 +0100
@@ -241,9 +241,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 -r 1631a3dee8fc 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	Wed Apr 20 04:38:36 2011 +0100
+++ openjdk-boot/jdk/src/share/classes/com/sun/java/util/jar/pack/PackageReader.java	Fri Apr 29 01:50:44 2011 +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 -r 1631a3dee8fc 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	Wed Apr 20 04:38:36 2011 +0100
+++ openjdk-boot/jdk/src/share/classes/com/sun/java/util/jar/pack/PackageWriter.java	Fri Apr 29 01:50:44 2011 +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) {
@@ -923,9 +929,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();
@@ -951,6 +958,10 @@
                 }
             }
         }
+        finally {
+            if (dump != null)
+                dump.close();
+        }
     }
 
     void writeAttrCounts() throws IOException {
diff -r 1631a3dee8fc 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	Wed Apr 20 04:38:36 2011 +0100
+++ openjdk-boot/jdk/src/share/classes/com/sun/java/util/jar/pack/PropMap.java	Fri Apr 29 01:50:44 2011 +0100
@@ -123,8 +123,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");
             }
@@ -132,6 +133,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 -r 1631a3dee8fc 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	Wed Apr 20 04:38:36 2011 +0100
+++ openjdk-boot/jdk/src/share/classes/com/sun/java/util/jar/pack/UnpackerImpl.java	Fri Apr 29 01:50:44 2011 +0100
@@ -161,9 +161,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 -r 1631a3dee8fc 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	Wed Apr 20 04:38:36 2011 +0100
+++ openjdk-boot/jdk/src/share/classes/com/sun/java/util/jar/pack/Utils.java	Fri Apr 29 01:50:44 2011 +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 -r 1631a3dee8fc src/share/classes/java/lang/Package.java
--- openjdk-boot/jdk/src/share/classes/java/lang/Package.java	Wed Apr 20 04:38:36 2011 +0100
+++ openjdk-boot/jdk/src/share/classes/java/lang/Package.java	Fri Apr 29 01:50:44 2011 +0100
@@ -576,12 +576,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 -r 1631a3dee8fc src/share/classes/java/nio/channels/SocketChannel.java
--- openjdk-boot/jdk/src/share/classes/java/nio/channels/SocketChannel.java	Wed Apr 20 04:38:36 2011 +0100
+++ openjdk-boot/jdk/src/share/classes/java/nio/channels/SocketChannel.java	Fri Apr 29 01:50:44 2011 +0100
@@ -188,7 +188,7 @@
             } catch (Throwable suppressed) {
                 x.addSuppressed(suppressed);
             }
-            throw x;
+            throw (IOException) x;
         }
         assert sc.isConnected();
         return sc;
diff -r 1631a3dee8fc src/share/classes/java/nio/file/CopyMoveHelper.java
--- openjdk-boot/jdk/src/share/classes/java/nio/file/CopyMoveHelper.java	Wed Apr 20 04:38:36 2011 +0100
+++ openjdk-boot/jdk/src/share/classes/java/nio/file/CopyMoveHelper.java	Fri Apr 29 01:50:44 2011 +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 -r 1631a3dee8fc src/share/classes/java/nio/file/Files.java
--- openjdk-boot/jdk/src/share/classes/java/nio/file/Files.java	Wed Apr 20 04:38:36 2011 +0100
+++ openjdk-boot/jdk/src/share/classes/java/nio/file/Files.java	Fri Apr 29 01:50:44 2011 +0100
@@ -2833,8 +2833,11 @@
         }
 
         // do the copy
-        try (OutputStream out = ostream) {
-            return copy(in, out);
+        try {
+            return copy(in, ostream);
+        }
+        finally {
+            ostream.close();
         }
     }
 
@@ -2875,9 +2878,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();
+        }
     }
 
     /**
@@ -2943,8 +2952,14 @@
         if (size > (long)Integer.MAX_VALUE)
             throw new OutOfMemoryError("Required array size too large");
 
-        try (InputStream in = newInputStream(path)) {
-             return read(in, (int)size);
+        InputStream in = null;
+        try {
+            in = newInputStream(path);
+            return read(in, (int)size);
+        }
+        finally {
+            if (in != null)
+                in.close();
         }
     }
 
@@ -2990,7 +3005,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();
@@ -3000,6 +3017,10 @@
             }
             return result;
         }
+        finally {
+            if (reader != null)
+                reader.close();
+        }
     }
 
     /**
@@ -3049,7 +3070,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) {
@@ -3058,6 +3081,10 @@
                 rem -= n;
             }
         }
+        finally {
+            if (out != null)
+                out.close();
+        }
         return path;
     }
 
@@ -3109,12 +3136,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 -r 1631a3dee8fc src/share/classes/java/util/Currency.java
--- openjdk-boot/jdk/src/share/classes/java/util/Currency.java	Wed Apr 20 04:38:36 2011 +0100
+++ openjdk-boot/jdk/src/share/classes/java/util/Currency.java	Fri Apr 29 01:50:44 2011 +0100
@@ -233,9 +233,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*([0-3])");
diff -r 1631a3dee8fc src/share/classes/java/util/jar/JarFile.java
--- openjdk-boot/jdk/src/share/classes/java/util/jar/JarFile.java	Wed Apr 20 04:38:36 2011 +0100
+++ openjdk-boot/jdk/src/share/classes/java/util/jar/JarFile.java	Fri Apr 29 01:50:44 2011 +0100
@@ -376,9 +376,15 @@
      */
     private byte[] getBytes(ZipEntry ze) throws IOException {
         byte[] b = new byte[(int)ze.getSize()];
-        try (DataInputStream is = new DataInputStream(super.getInputStream(ze))) {
+        DataInputStream is = null;
+        try {
+            is = new DataInputStream(super.getInputStream(ze));
             is.readFully(b, 0, b.length);
         }
+        finally {
+            if (is != null)
+                is.close();
+        }
         return b;
     }
 
@@ -480,11 +486,15 @@
             JarEntry manEntry = getManEntry();
             if (manEntry != null) {
                 byte[] b = new byte[(int)manEntry.getSize()];
-                try (DataInputStream dis = new DataInputStream(
-                         super.getInputStream(manEntry))) {
+                DataInputStream dis = null;
+                try {
+                    dis = new DataInputStream(super.getInputStream(manEntry));
                     dis.readFully(b, 0, b.length);
                 }
-
+                finally {
+                    if (dis != null)
+                        dis.close();
+                }
                 int last = b.length - src.length;
                 int i = 0;
                 next:
diff -r 1631a3dee8fc src/share/classes/javax/sql/rowset/serial/SerialClob.java
--- openjdk-boot/jdk/src/share/classes/javax/sql/rowset/serial/SerialClob.java	Wed Apr 20 04:38:36 2011 +0100
+++ openjdk-boot/jdk/src/share/classes/javax/sql/rowset/serial/SerialClob.java	Fri Apr 29 01:50:44 2011 +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 -r 1631a3dee8fc src/share/classes/javax/sql/rowset/spi/SyncFactory.java
--- openjdk-boot/jdk/src/share/classes/javax/sql/rowset/spi/SyncFactory.java	Wed Apr 20 04:38:36 2011 +0100
+++ openjdk-boot/jdk/src/share/classes/javax/sql/rowset/spi/SyncFactory.java	Fri Apr 29 01:50:44 2011 +0100
@@ -367,9 +367,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);
                 }
 
@@ -381,15 +387,19 @@
                         "rowset.properties";
 
                 ClassLoader cl = Thread.currentThread().getContextClassLoader();
-
-                try (InputStream stream =
-                         (cl == null) ? ClassLoader.getSystemResourceAsStream(ROWSET_PROPERTIES)
-                                      : cl.getResourceAsStream(ROWSET_PROPERTIES)) {
+                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();
                 }
 
                 parseProperties(properties);
diff -r 1631a3dee8fc src/share/classes/sun/net/www/protocol/jar/URLJarFile.java
--- openjdk-boot/jdk/src/share/classes/sun/net/www/protocol/jar/URLJarFile.java	Wed Apr 20 04:38:36 2011 +0100
+++ openjdk-boot/jdk/src/share/classes/sun/net/www/protocol/jar/URLJarFile.java	Fri Apr 29 01:50:44 2011 +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 -r 1631a3dee8fc src/share/classes/sun/nio/fs/PollingWatchService.java
--- openjdk-boot/jdk/src/share/classes/sun/nio/fs/PollingWatchService.java	Wed Apr 20 04:38:36 2011 +0100
+++ openjdk-boot/jdk/src/share/classes/sun/nio/fs/PollingWatchService.java	Fri Apr 29 01:50:44 2011 +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 -r 1631a3dee8fc src/share/classes/sun/security/provider/SeedGenerator.java
--- openjdk-boot/jdk/src/share/classes/sun/security/provider/SeedGenerator.java	Wed Apr 20 04:38:36 2011 +0100
+++ openjdk-boot/jdk/src/share/classes/sun/security/provider/SeedGenerator.java	Fri Apr 29 01:50:44 2011 +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 -r 1631a3dee8fc src/share/classes/sun/util/calendar/LocalGregorianCalendar.java
--- openjdk-boot/jdk/src/share/classes/sun/util/calendar/LocalGregorianCalendar.java	Wed Apr 20 04:38:36 2011 +0100
+++ openjdk-boot/jdk/src/share/classes/sun/util/calendar/LocalGregorianCalendar.java	Fri Apr 29 01:50:44 2011 +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 -r 1631a3dee8fc src/share/demo/jfc/Font2DTest/RangeMenu.java
--- openjdk-boot/jdk/src/share/demo/jfc/Font2DTest/RangeMenu.java	Wed Apr 20 04:38:36 2011 +0100
+++ openjdk-boot/jdk/src/share/demo/jfc/Font2DTest/RangeMenu.java	Fri Apr 29 01:50:44 2011 +0100
@@ -191,7 +191,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 -r 1631a3dee8fc src/solaris/classes/java/util/prefs/FileSystemPreferences.java
--- openjdk-boot/jdk/src/solaris/classes/java/util/prefs/FileSystemPreferences.java	Wed Apr 20 04:38:36 2011 +0100
+++ openjdk-boot/jdk/src/solaris/classes/java/util/prefs/FileSystemPreferences.java	Fri Apr 29 01:50:44 2011 +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 -r 1631a3dee8fc src/solaris/classes/sun/nio/fs/UnixFileStore.java
--- openjdk-boot/jdk/src/solaris/classes/sun/nio/fs/UnixFileStore.java	Wed Apr 20 04:38:36 2011 +0100
+++ openjdk-boot/jdk/src/solaris/classes/sun/nio/fs/UnixFileStore.java	Fri Apr 29 01:50:44 2011 +0100
@@ -255,9 +255,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 -r d28f54a421b1 src/share/classes/sun/security/krb5/internal/ktab/KeyTab.java
--- openjdk-boot/jdk/src/share/classes/sun/security/krb5/internal/ktab/KeyTab.java	Mon Jun 13 15:58:42 2011 +0100
+++ openjdk-boot/jdk/src/share/classes/sun/security/krb5/internal/ktab/KeyTab.java	Tue Jun 21 14:46:11 2011 +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();
@@ -439,9 +443,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);
     }
@@ -450,12 +458,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();
         }
     }
 
@@ -519,9 +531,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();
         }
     }
 }