Skip to content

Commit

Permalink
[BAHIR-172 ] Replace FileInputStream with Files.newInputStream (apach…
Browse files Browse the repository at this point in the history
  • Loading branch information
liketic authored and lresende committed Sep 3, 2019
1 parent 549c50b commit 68ac1be
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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()
Expand Down

0 comments on commit 68ac1be

Please sign in to comment.