ws-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From cohei...@apache.org
Subject svn commit: r1792453 - in /webservices/wss4j/trunk/ws-security-common/src/main/java/org/apache/wss4j/common/crypto: Merlin.java MerlinDevice.java
Date Mon, 24 Apr 2017 11:14:23 GMT
Author: coheigea
Date: Mon Apr 24 11:14:23 2017
New Revision: 1792453

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

Modified:
    webservices/wss4j/trunk/ws-security-common/src/main/java/org/apache/wss4j/common/crypto/Merlin.java
    webservices/wss4j/trunk/ws-security-common/src/main/java/org/apache/wss4j/common/crypto/MerlinDevice.java

Modified: webservices/wss4j/trunk/ws-security-common/src/main/java/org/apache/wss4j/common/crypto/Merlin.java
URL: http://svn.apache.org/viewvc/webservices/wss4j/trunk/ws-security-common/src/main/java/org/apache/wss4j/common/crypto/Merlin.java?rev=1792453&r1=1792452&r2=1792453&view=diff
==============================================================================
--- webservices/wss4j/trunk/ws-security-common/src/main/java/org/apache/wss4j/common/crypto/Merlin.java
(original)
+++ webservices/wss4j/trunk/ws-security-common/src/main/java/org/apache/wss4j/common/crypto/Merlin.java
Mon Apr 24 11:14:23 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;
@@ -136,7 +137,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());
@@ -277,7 +278,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();
@@ -358,7 +359,7 @@ public class Merlin extends CryptoBase {
             //
             if (is == null) {
                 try {
-                    is = new FileInputStream(location);
+                    is = Files.newInputStream(Paths.get(location));
                 } catch (Exception e) {
                     LOG.debug(e.getMessage(), e);
                     throw new WSSecurityException(

Modified: webservices/wss4j/trunk/ws-security-common/src/main/java/org/apache/wss4j/common/crypto/MerlinDevice.java
URL: http://svn.apache.org/viewvc/webservices/wss4j/trunk/ws-security-common/src/main/java/org/apache/wss4j/common/crypto/MerlinDevice.java?rev=1792453&r1=1792452&r2=1792453&view=diff
==============================================================================
--- webservices/wss4j/trunk/ws-security-common/src/main/java/org/apache/wss4j/common/crypto/MerlinDevice.java
(original)
+++ webservices/wss4j/trunk/ws-security-common/src/main/java/org/apache/wss4j/common/crypto/MerlinDevice.java
Mon Apr 24 11:14:23 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;
@@ -150,7 +151,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();



Mime
View raw message