Explicitly close some streams.
authorwassa <wassa@ab3bd59b-922f-494d-bb5f-6f0a3c29deca>
Wed, 19 Feb 2003 21:18:06 +0000 (21:18 +0000)
committerwassa <wassa@ab3bd59b-922f-494d-bb5f-6f0a3c29deca>
Wed, 19 Feb 2003 21:18:06 +0000 (21:18 +0000)
git-svn-id: https://subversion.switch.ch/svn/shibboleth/java-idp/trunk@483 ab3bd59b-922f-494d-bb5f-6f0a3c29deca

src/edu/internet2/middleware/shibboleth/aa/AAServlet.java
src/edu/internet2/middleware/shibboleth/aa/arp/provider/FileSystemArpRepository.java
src/edu/internet2/middleware/shibboleth/hs/HandleServlet.java
src/edu/internet2/middleware/shibboleth/hs/provider/CryptoHandleRepository.java

index e511fbe..f7fa1ef 100755 (executable)
@@ -189,6 +189,11 @@ public class AAServlet extends HttpServlet {
                        properties.list(debugPrinter);
                        log.debug(
                                "Runtime configuration parameters: " + System.getProperty("line.separator") + debugStream.toString());
+                       try {
+                               debugStream.close();
+                       } catch (IOException e) {
+                               log.error("Encountered a problem cleaning up resources: could not close debug stream.");
+                       }
                }
 
                return properties;
index 71253b3..fce5b18 100755 (executable)
@@ -161,6 +161,7 @@ public class FileSystemArpRepository extends BaseArpRepository implements ArpRep
                InputStream inStream = new ShibResource(fileName).getInputStream();
                DOMParser parser = new DOMParser();
                parser.parse(new InputSource(inStream));
+               inStream.close();
                return parser.getDocument().getDocumentElement();
        }
 
index 3f65fdd..be5e161 100644 (file)
@@ -156,6 +156,11 @@ public class HandleServlet extends HttpServlet {
                        properties.list(debugPrinter);
                        log.debug(
                                "Runtime configuration parameters: " + System.getProperty("line.separator") + debugStream.toString());
+                       try {
+                               debugStream.close();
+                       } catch (IOException e) {
+                               log.error("Encountered a problem cleaning up resources: could not close debug stream.");
+                       }
                }
 
                return properties;
@@ -174,7 +179,11 @@ public class HandleServlet extends HttpServlet {
 
                        postProfile =
                                ShibPOSTProfileFactory.getInstance(
-                                       Arrays.asList(configuration.getProperty("edu.internet2.middleware.shibboleth.audiences").replaceAll("\\s", "") .split(",")),
+                                       Arrays.asList(
+                                               configuration.getProperty("edu.internet2.middleware.shibboleth.audiences").replaceAll(
+                                                       "\\s",
+                                                       "").split(
+                                                       ",")),
                                        configuration.getProperty("edu.internet2.middleware.shibboleth.hs.HandleServlet.issuer"));
 
                        handleRepository = HandleRepositoryFactory.getInstance(configuration);
@@ -294,7 +303,7 @@ public class HandleServlet extends HttpServlet {
                                Arrays.asList(certificates),
                                null,
                                null);
-                               
+
                return r.toBase64();
        }
 
index c58ae09..98fcb43 100644 (file)
@@ -157,9 +157,12 @@ public class CryptoHandleRepository extends BaseHandleRepository implements Hand
                        objectStream.flush();
                        objectStream.close();
 
+
                        Cipher cipher = Cipher.getInstance("DESede/ECB/PKCS5Padding");
                        cipher.init(Cipher.ENCRYPT_MODE, secret);
                        byte[] cipherTextHandle = cipher.doFinal(outStream.toByteArray());
+                       zipStream.close();
+                       outStream.close();
 
                        String handle = new BASE64Encoder().encode(cipherTextHandle);
                        return handle.replaceAll(System.getProperty("line.separator"), "");
@@ -189,6 +192,7 @@ public class CryptoHandleRepository extends BaseHandleRepository implements Hand
                        ObjectInputStream objectStream =
                                new ObjectInputStream(new GZIPInputStream(new ByteArrayInputStream(objectArray)));
                        HandleEntry handleEntry = (HandleEntry) objectStream.readObject();
+                       objectStream.close();
                        return handleEntry.principal;
 
                } catch (Exception e) {