Skip to content

Commit 6f8f2cb

Browse files
committed
Read the info from stream instead of NIO
1 parent 3c0c467 commit 6f8f2cb

File tree

1 file changed

+10
-8
lines changed

1 file changed

+10
-8
lines changed

src/main/java/org/utplsql/cli/CliVersionInfo.java

Lines changed: 10 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -2,11 +2,11 @@
22

33
import org.utplsql.api.JavaApiVersionInfo;
44

5+
import java.io.BufferedReader;
56
import java.io.IOException;
7+
import java.io.InputStream;
8+
import java.io.InputStreamReader;
69
import java.net.URISyntaxException;
7-
import java.nio.charset.Charset;
8-
import java.nio.file.Files;
9-
import java.nio.file.Paths;
1010

1111
/** This class is getting updated automatically by the build process.
1212
* Please do not update its constants manually cause they will be overwritten.
@@ -20,12 +20,14 @@ public class CliVersionInfo {
2020

2121
static {
2222
try {
23-
MAVEN_PROJECT_VERSION = Files.readAllLines(
24-
Paths.get(CliVersionInfo.class.getClassLoader().getResource("utplsql-cli.version").toURI())
25-
, Charset.defaultCharset())
26-
.get(0);
23+
try ( InputStream in = JavaApiVersionInfo.class.getClassLoader().getResourceAsStream("utplsql-cli.version")) {
24+
BufferedReader reader = new BufferedReader(new InputStreamReader(in));
25+
MAVEN_PROJECT_VERSION = reader.readLine();
26+
27+
reader.close();
28+
}
2729
}
28-
catch ( IOException | URISyntaxException e ) {
30+
catch ( IOException e ) {
2931
System.out.println("WARNING: Could not get Version information!");
3032
}
3133
}

0 commit comments

Comments
 (0)