File tree Expand file tree Collapse file tree 1 file changed +4
-2
lines changed
core/src/main/scala/com/microsoft/azure/synapse/ml/fabric Expand file tree Collapse file tree 1 file changed +4
-2
lines changed Original file line number Diff line number Diff line change @@ -8,7 +8,6 @@ import spray.json._
8
8
9
9
import java .net .{MalformedURLException , URL }
10
10
import java .util .UUID
11
- import java .nio .file .{Files , Paths }
12
11
import scala .io .Source
13
12
14
13
object FabricClient extends RESTUtils {
@@ -124,13 +123,16 @@ object FabricClient extends RESTUtils {
124
123
}
125
124
126
125
private def readClusterMetadata (): Map [String , String ] = {
126
+ val source = Source .fromFile(ClusterInfoPath )
127
127
try {
128
- val jsonString = Files .readString( Paths .get( ClusterInfoPath ) )
128
+ val jsonString = try source.mkString finally source.close( )
129
129
val jsValue = jsonString.parseJson
130
130
val clusterMetadataJson = jsValue.asJsObject.fields(" cluster_metadata" )
131
131
clusterMetadataJson.convertTo[Map [String , String ]]
132
132
} catch {
133
133
case _ : Exception => Map .empty[String , String ]
134
+ } finally {
135
+ source.close()
134
136
}
135
137
}
136
138
You can’t perform that action at this time.
0 commit comments