Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit c05b257

Browse files
authored
Merge pull request #67 from utPLSQL/feature/outsource_version_info_to_file
Use ResourceStream instead of NIO File access
2 parents f2746dc + e7f8000 commit c05b257

File tree

1 file changed

+9
-5
lines changed

1 file changed

+9
-5
lines changed

src/main/java/org/utplsql/api/JavaApiVersionInfo.java

+9-5
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
package org.utplsql.api;
22

3+
import java.io.BufferedReader;
34
import java.io.IOException;
45
import java.io.InputStream;
56
import java.io.InputStreamReader;
@@ -23,12 +24,15 @@ private JavaApiVersionInfo() { }
2324

2425
static {
2526
try {
26-
MAVEN_PROJECT_VERSION = Files.readAllLines(
27-
Paths.get(JavaApiVersionInfo.class.getClassLoader().getResource("utplsql-api.version").toURI())
28-
, Charset.defaultCharset())
29-
.get(0);
27+
28+
try ( InputStream in = JavaApiVersionInfo.class.getClassLoader().getResourceAsStream("utplsql-api.version")) {
29+
BufferedReader reader = new BufferedReader(new InputStreamReader(in));
30+
MAVEN_PROJECT_VERSION = reader.readLine();
31+
32+
reader.close();
33+
}
3034
}
31-
catch ( IOException | URISyntaxException e ) {
35+
catch ( IOException e ) {
3236
System.out.println("WARNING: Could not get Version information!");
3337
}
3438
}

0 commit comments

Comments
 (0)