File tree Expand file tree Collapse file tree 2 files changed +7
-7
lines changed
main/scala/za/co/absa/cobrix/spark/cobol
test/scala/za/co/absa/cobrix/spark/cobol/source/fixtures Expand file tree Collapse file tree 2 files changed +7
-7
lines changed Original file line number Diff line number Diff line change @@ -233,9 +233,11 @@ object SparkCobolProcessor {
233233
234234 val seq = Future .sequence(futures)
235235
236- val recordCuntProcessed = Await .result(seq, Duration .Inf ).sum
237-
238- threadPool.shutdown()
236+ val recordCuntProcessed = try {
237+ Await .result(seq, Duration .Inf ).sum
238+ } finally {
239+ threadPool.shutdown()
240+ }
239241
240242 recordCuntProcessed
241243 }
Original file line number Diff line number Diff line change @@ -21,7 +21,7 @@ import org.apache.commons.io.FileUtils
2121import java .io .File .createTempFile
2222import java .io .{DataOutputStream , File , FileOutputStream }
2323import java .nio .charset .Charset
24- import java .nio .file .Files
24+ import java .nio .file .{ Files , Paths }
2525
2626/**
2727 * This fixture adds ability for a unit test to create temporary files for using them in the tests.
@@ -114,9 +114,7 @@ trait BinaryFileFixture {
114114 }
115115
116116 def writeBinaryFile (filePath : String , content : Array [Byte ]): Unit = {
117- val ostream = new DataOutputStream (new FileOutputStream (filePath))
118- ostream.write(content)
119- ostream.close()
117+ Files .write(Paths .get(filePath), content)
120118 }
121119
122120 def readBinaryFile (filePath : String ): Array [Byte ] = {
You can’t perform that action at this time.
0 commit comments