Skip to content

Commit 00c7eba

Browse files
authored
use Files.createTempFile (#8791)
1 parent 764a3b0 commit 00c7eba

File tree

4 files changed

+8
-4
lines changed

4 files changed

+8
-4
lines changed

modules/openapi-generator/src/main/resources/scala-finch/api.mustache

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,7 @@ import com.twitter.util.Future
1616
import com.twitter.io.Buf
1717
import io.finch._, items._
1818
import java.io.File
19+
import java.nio.file.Files
1920
import java.time._
2021

2122
object {{classname}} {
@@ -81,7 +82,7 @@ object {{classname}} {
8182
}
8283

8384
private def bytesToFile(input: Array[Byte]): java.io.File = {
84-
val file = File.createTempFile("tmp{{classname}}", null)
85+
val file = Files.createTempFile("tmp{{classname}}", null).toFile
8586
val output = new FileOutputStream(file)
8687
output.write(input)
8788
file

samples/server/petstore/scala-finch/src/main/scala/org/openapitools/apis/PetApi.scala

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,7 @@ import com.twitter.util.Future
1717
import com.twitter.io.Buf
1818
import io.finch._, items._
1919
import java.io.File
20+
import java.nio.file.Files
2021
import java.time._
2122

2223
object PetApi {
@@ -179,7 +180,7 @@ object PetApi {
179180
}
180181

181182
private def bytesToFile(input: Array[Byte]): java.io.File = {
182-
val file = File.createTempFile("tmpPetApi", null)
183+
val file = Files.createTempFile("tmpPetApi", null).toFile
183184
val output = new FileOutputStream(file)
184185
output.write(input)
185186
file

samples/server/petstore/scala-finch/src/main/scala/org/openapitools/apis/StoreApi.scala

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,7 @@ import com.twitter.util.Future
1515
import com.twitter.io.Buf
1616
import io.finch._, items._
1717
import java.io.File
18+
import java.nio.file.Files
1819
import java.time._
1920

2021
object StoreApi {
@@ -117,7 +118,7 @@ object StoreApi {
117118
}
118119

119120
private def bytesToFile(input: Array[Byte]): java.io.File = {
120-
val file = File.createTempFile("tmpStoreApi", null)
121+
val file = Files.createTempFile("tmpStoreApi", null).toFile
121122
val output = new FileOutputStream(file)
122123
output.write(input)
123124
file

samples/server/petstore/scala-finch/src/main/scala/org/openapitools/apis/UserApi.scala

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,7 @@ import com.twitter.util.Future
1616
import com.twitter.io.Buf
1717
import io.finch._, items._
1818
import java.io.File
19+
import java.nio.file.Files
1920
import java.time._
2021

2122
object UserApi {
@@ -178,7 +179,7 @@ object UserApi {
178179
}
179180

180181
private def bytesToFile(input: Array[Byte]): java.io.File = {
181-
val file = File.createTempFile("tmpUserApi", null)
182+
val file = Files.createTempFile("tmpUserApi", null).toFile
182183
val output = new FileOutputStream(file)
183184
output.write(input)
184185
file

0 commit comments

Comments
 (0)