You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@ws.apache.org by co...@apache.org on 2017/04/24 11:15:48 UTC

svn commit: r1792454 - in /webservices/wss4j/branches/2_1_x-fixes/ws-security-common/src/main/java/org/apache/wss4j/common/crypto: Merlin.java MerlinDevice.java

Author: coheigea
Date: Mon Apr 24 11:15:48 2017
New Revision: 1792454

URL: http://svn.apache.org/viewvc?rev=1792454&view=rev
Log:
Removing FileInputStream

Modified:
    webservices/wss4j/branches/2_1_x-fixes/ws-security-common/src/main/java/org/apache/wss4j/common/crypto/Merlin.java
    webservices/wss4j/branches/2_1_x-fixes/ws-security-common/src/main/java/org/apache/wss4j/common/crypto/MerlinDevice.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=1792454&r1=1792453&r2=1792454&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 Mon Apr 24 11:15:48 2017
@@ -19,11 +19,12 @@
 
 package org.apache.wss4j.common.crypto;
 
-import java.io.FileInputStream;
 import java.io.IOException;
 import java.io.InputStream;
 import java.math.BigInteger;
 import java.net.MalformedURLException;
+import java.nio.file.Files;
+import java.nio.file.Paths;
 import java.security.GeneralSecurityException;
 import java.security.InvalidAlgorithmParameterException;
 import java.security.Key;
@@ -137,7 +138,7 @@ public class Merlin extends CryptoBase {
         if (truststore == null && loadCACerts) {
             String cacertsPath = System.getProperty("java.home") + "/lib/security/cacerts";
 
-            try (InputStream cacertsIs = new FileInputStream(cacertsPath)) {
+            try (InputStream cacertsIs = Files.newInputStream(Paths.get(cacertsPath))) {
 
                 truststore = KeyStore.getInstance(KeyStore.getDefaultType());
                 truststore.load(cacertsIs, cacertsPasswd.toCharArray());
@@ -286,7 +287,7 @@ public class Merlin extends CryptoBase {
                 if (cacertsPath != null) {
                     cacertsPath = cacertsPath.trim();
                 }
-                try (InputStream is = new FileInputStream(cacertsPath)) {
+                try (InputStream is = Files.newInputStream(Paths.get(cacertsPath))) {
                     String cacertsPasswd = properties.getProperty(prefix + TRUSTSTORE_PASSWORD, "changeit");
                     if (cacertsPasswd != null) {
                         cacertsPasswd = cacertsPasswd.trim();
@@ -378,7 +379,7 @@ public class Merlin extends CryptoBase {
             //
             if (is == null) {
                 try {
-                    is = new FileInputStream(location);
+                    is = Files.newInputStream(Paths.get(location));
                 } catch (Exception e) {
                     if (DO_DEBUG) {
                         LOG.debug(e.getMessage(), e);

Modified: webservices/wss4j/branches/2_1_x-fixes/ws-security-common/src/main/java/org/apache/wss4j/common/crypto/MerlinDevice.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/MerlinDevice.java?rev=1792454&r1=1792453&r2=1792454&view=diff
==============================================================================
--- webservices/wss4j/branches/2_1_x-fixes/ws-security-common/src/main/java/org/apache/wss4j/common/crypto/MerlinDevice.java (original)
+++ webservices/wss4j/branches/2_1_x-fixes/ws-security-common/src/main/java/org/apache/wss4j/common/crypto/MerlinDevice.java Mon Apr 24 11:15:48 2017
@@ -19,9 +19,10 @@
 
 package org.apache.wss4j.common.crypto;
 
-import java.io.FileInputStream;
 import java.io.IOException;
 import java.io.InputStream;
+import java.nio.file.Files;
+import java.nio.file.Paths;
 import java.security.KeyStore;
 import java.security.cert.CertStore;
 import java.security.cert.CertificateFactory;
@@ -157,7 +158,7 @@ public class MerlinDevice extends Merlin
             if (cacertsPath != null) {
                 cacertsPath = cacertsPath.trim();
             }
-            try (InputStream is = new FileInputStream(cacertsPath)) {
+            try (InputStream is = Files.newInputStream(Paths.get(cacertsPath))) {
                 String cacertsPasswd = properties.getProperty(prefix + TRUSTSTORE_PASSWORD, "changeit");
                 if (cacertsPasswd != null) {
                     cacertsPasswd = cacertsPasswd.trim();