Author: coheigea Date: Wed Oct 12 09:18:45 2016 New Revision: 1764416 URL: http://svn.apache.org/viewvc?rev=1764416&view=rev Log: Some changes to the previous patch. This closes #4.
Modified: webservices/wss4j/branches/2_1_x-fixes/ws-security-common/src/main/java/org/apache/wss4j/common/crypto/Merlin.java Modified: webservices/wss4j/branches/2_1_x-fixes/ws-security-common/src/main/java/org/apache/wss4j/common/crypto/Merlin.java URL: http://svn.apache.org/viewvc/webservices/wss4j/branches/2_1_x-fixes/ws-security-common/src/main/java/org/apache/wss4j/common/crypto/Merlin.java?rev=1764416&r1=1764415&r2=1764416&view=diff ============================================================================== --- webservices/wss4j/branches/2_1_x-fixes/ws-security-common/src/main/java/org/apache/wss4j/common/crypto/Merlin.java (original) +++ webservices/wss4j/branches/2_1_x-fixes/ws-security-common/src/main/java/org/apache/wss4j/common/crypto/Merlin.java Wed Oct 12 09:18:45 2016 @@ -302,17 +302,14 @@ public class Merlin extends CryptoBase { } // - // Load the CRL file + // Load the CRL file(s) // String crlLocations = properties.getProperty(prefix + X509_CRL_FILE); if (crlLocations != null) { String[] splittedCrlsLocations = crlLocations.split(COMMA_SEPARATOR); - List<X509CRL> crls = new ArrayList(); - for (int i = 0; i < splittedCrlsLocations.length; i++) { - String crlLocation = splittedCrlsLocations[i]; - crlLocation = crlLocation.trim(); - InputStream is = loadInputStream(loader, crlLocation); - try { + List<X509CRL> crls = new ArrayList<>(splittedCrlsLocations.length); + for (String crlLocation : splittedCrlsLocations) { + try (InputStream is = loadInputStream(loader, crlLocation.trim())) { CertificateFactory cf = getCertificateFactory(); X509CRL crl = (X509CRL)cf.generateCRL(is); crls.add(crl); @@ -321,10 +318,6 @@ public class Merlin extends CryptoBase { LOG.debug(e.getMessage(), e); } throw new WSSecurityException(WSSecurityException.ErrorCode.FAILURE,e, "ioError00"); - } finally { - if (is != null) { - is.close(); - } } } try { @@ -351,7 +344,7 @@ public class Merlin extends CryptoBase { } if (DO_DEBUG) { LOG.debug( - "The CRL " + crlLocations + " has been loaded" + "The CRL files " + crlLocations + " have been loaded" ); }