This is an automated email from the ASF dual-hosted git repository.

lresende pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/bahir.git


The following commit(s) were added to refs/heads/master by this push:
     new 68ac1be  [BAHIR-172 ] Replace FileInputStream with 
Files.newInputStream (#92)
68ac1be is described below

commit 68ac1be22ddccecf105aee355a8c2652868e9f7d
Author: Like <[email protected]>
AuthorDate: Tue Sep 3 08:01:49 2019 +0800

    [BAHIR-172 ] Replace FileInputStream with Files.newInputStream (#92)
---
 .../scala/org/apache/bahir/sql/streaming/mqtt/MQTTTestUtils.scala     | 4 ++--
 .../scala/org/apache/spark/streaming/pubsub/SparkGCPCredentials.scala | 2 +-
 2 files changed, 3 insertions(+), 3 deletions(-)

diff --git 
a/sql-streaming-mqtt/src/test/scala/org/apache/bahir/sql/streaming/mqtt/MQTTTestUtils.scala
 
b/sql-streaming-mqtt/src/test/scala/org/apache/bahir/sql/streaming/mqtt/MQTTTestUtils.scala
index b891c93..ba04599 100644
--- 
a/sql-streaming-mqtt/src/test/scala/org/apache/bahir/sql/streaming/mqtt/MQTTTestUtils.scala
+++ 
b/sql-streaming-mqtt/src/test/scala/org/apache/bahir/sql/streaming/mqtt/MQTTTestUtils.scala
@@ -18,9 +18,9 @@
 package org.apache.bahir.sql.streaming.mqtt
 
 import java.io.File
-import java.io.FileInputStream
 import java.net.{ServerSocket, URI}
 import java.nio.charset.Charset
+import java.nio.file.Files
 import java.security.{KeyStore, SecureRandom}
 import java.util.Properties
 import javax.net.ssl.KeyManagerFactory
@@ -63,7 +63,7 @@ class MQTTTestUtils(tempDir: File, port: Int = 0, ssl: 
Boolean = false) extends
     val protocol = if (ssl) "mqtt+ssl" else "mqtt"
     if (ssl) {
       val keyStore = KeyStore.getInstance("JKS")
-      keyStore.load(new FileInputStream(serverKeyStore), 
serverKeyStorePassword.toCharArray)
+      keyStore.load(Files.newInputStream(serverKeyStore.toPath), 
serverKeyStorePassword.toCharArray)
       val keyManagerFactory = 
KeyManagerFactory.getInstance(KeyManagerFactory.getDefaultAlgorithm)
       keyManagerFactory.init(keyStore, serverKeyStorePassword.toCharArray)
       broker.setSslContext(
diff --git 
a/streaming-pubsub/src/main/scala/org/apache/spark/streaming/pubsub/SparkGCPCredentials.scala
 
b/streaming-pubsub/src/main/scala/org/apache/spark/streaming/pubsub/SparkGCPCredentials.scala
index 4352d7f..6121b47 100644
--- 
a/streaming-pubsub/src/main/scala/org/apache/spark/streaming/pubsub/SparkGCPCredentials.scala
+++ 
b/streaming-pubsub/src/main/scala/org/apache/spark/streaming/pubsub/SparkGCPCredentials.scala
@@ -86,7 +86,7 @@ private[pubsub] final case class EMailPrivateKeyCredentials(
   override def provider: Credential = {
     val tempFile = File.createTempFile(emailAccount, ".p12")
     tempFile.deleteOnExit()
-    val p12Out = new FileOutputStream(tempFile)
+    val p12Out = Files.newOutputStream(tempFile.toPath)
     p12Out.write(p12Content, 0, p12Content.length)
     p12Out.flush()
     p12Out.close()

Reply via email to