>From d9bd7259dd8b47c4d267bf0f9eab912bdbb9c1b5 Mon Sep 17 00:00:00 2001
From: Ade Lee <alee@redhat.com>
Date: Tue, 28 Jan 2014 11:21:44 -0500
Subject: [PATCH 185/187] Fix some errors flagged by eclipse

---
 base/java-tools/src/com/netscape/cmstools/AuditVerify.java  |  3 ++-
 .../cms/authentication/UserPwdDirAuthentication.java        |  4 ++--
 base/util/src/netscape/security/x509/CRLExtensions.java     | 13 ++++++-------
 base/util/src/netscape/security/x509/EDIPartyName.java      |  5 ++++-
 4 files changed, 14 insertions(+), 11 deletions(-)

diff --git a/base/java-tools/src/com/netscape/cmstools/AuditVerify.java b/base/java-tools/src/com/netscape/cmstools/AuditVerify.java
index fb92cf12cb4bfb7a6ec03bda651156eb6d7f3727..82323ab09d4fee088c32268ad27fe5a86526993e 100644
--- a/base/java-tools/src/com/netscape/cmstools/AuditVerify.java
+++ b/base/java-tools/src/com/netscape/cmstools/AuditVerify.java
@@ -164,6 +164,7 @@ public class AuditVerify {
                     logFiles.addElement(((String) tok.nextElement()).trim());
                 }
             }
+            r.close();
             if (logFiles.size() == 0) {
                 System.out.println("Error: no log files listed in " + logListFile);
                 System.exit(1);
@@ -297,7 +298,7 @@ public class AuditVerify {
                     sigStopLine = linenum;
                     sigStopFile = curfileName;
                 }
-
+                br.close();
             }
 
             // Make sure there were no unsigned log entries at the end.
diff --git a/base/server/cms/src/com/netscape/cms/authentication/UserPwdDirAuthentication.java b/base/server/cms/src/com/netscape/cms/authentication/UserPwdDirAuthentication.java
index c5f0611a24e15509880f761abb241253f4c0b778..7bcab25d3e82d242615781be641ff45a68a551f9 100644
--- a/base/server/cms/src/com/netscape/cms/authentication/UserPwdDirAuthentication.java
+++ b/base/server/cms/src/com/netscape/cms/authentication/UserPwdDirAuthentication.java
@@ -257,8 +257,8 @@ public class UserPwdDirAuthentication extends DirBasedAuthentication
     /**
      * Retrieves a list of names of the value parameter.
      */
-    public Enumeration getValueNames() {
-        Vector v = new Vector();
+    public Enumeration<String> getValueNames() {
+        Vector<String> v = new Vector<String>();
 
         v.addElement(mAttr);
         v.addElement(CRED_PWD);
diff --git a/base/util/src/netscape/security/x509/CRLExtensions.java b/base/util/src/netscape/security/x509/CRLExtensions.java
index 9c844cd3dc0b13bd1ffbf01c62d478e1351f6a4a..d9eaffd89de7b1b8e94c128f63ad788c4547f7fd 100755
--- a/base/util/src/netscape/security/x509/CRLExtensions.java
+++ b/base/util/src/netscape/security/x509/CRLExtensions.java
@@ -150,7 +150,7 @@ public class CRLExtensions extends Vector<Extension> {
      */
     public void encode(OutputStream out, boolean isExplicit)
             throws CRLException {
-        try {
+        try (DerOutputStream tmp = new DerOutputStream()) {
             // #381559
             if (size() == 0)
                 return;
@@ -168,14 +168,13 @@ public class CRLExtensions extends Vector<Extension> {
             DerOutputStream seq = new DerOutputStream();
             seq.write(DerValue.tag_Sequence, extOut);
 
-            DerOutputStream tmp = new DerOutputStream();
-            if (isExplicit)
+            if (isExplicit) {
                 tmp.write(DerValue.createTag(DerValue.TAG_CONTEXT,
                                              true, (byte) 0), seq);
-            else
-                tmp = seq;
-
-            out.write(tmp.toByteArray());
+                out.write(tmp.toByteArray());
+            } else {
+                out.write(seq.toByteArray());
+            }
         } catch (IOException e) {
             throw new CRLException("Encoding error: " + e.toString());
         } catch (CertificateException e) {
diff --git a/base/util/src/netscape/security/x509/EDIPartyName.java b/base/util/src/netscape/security/x509/EDIPartyName.java
index def86ffa58684a26d5859741ebd741abb6e0ec6f..0efb1c59c7a258f61eeab600018a127abeff333e 100644
--- a/base/util/src/netscape/security/x509/EDIPartyName.java
+++ b/base/util/src/netscape/security/x509/EDIPartyName.java
@@ -131,8 +131,11 @@ public class EDIPartyName implements GeneralNameInterface {
             tagged.write(DerValue.createTag(DerValue.TAG_CONTEXT,
                                  false, TAG_ASSIGNER), tmp2);
         }
-        if (party == null)
+        if (party == null) {
+            tagged.close();
+            tmp.close();
             throw new IOException("Cannot have null partyName");
+        }
 
         // XXX - shd check is chars fit into PrintableString
         tmp.putPrintableString(party);
-- 
1.8.4.2

