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

Skip to content
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Read the info from stream instead of NIO
  • Loading branch information
pesse committed Dec 13, 2018
commit 6f8f2cbf56b945b0fe2013336effaf550990c67d
18 changes: 10 additions & 8 deletions src/main/java/org/utplsql/cli/CliVersionInfo.java
Original file line number Diff line number Diff line change
Expand Up @@ -2,11 +2,11 @@

import org.utplsql.api.JavaApiVersionInfo;

import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStream;
import java.io.InputStreamReader;
import java.net.URISyntaxException;
import java.nio.charset.Charset;
import java.nio.file.Files;
import java.nio.file.Paths;

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

static {
try {
MAVEN_PROJECT_VERSION = Files.readAllLines(
Paths.get(CliVersionInfo.class.getClassLoader().getResource("utplsql-cli.version").toURI())
, Charset.defaultCharset())
.get(0);
try ( InputStream in = JavaApiVersionInfo.class.getClassLoader().getResourceAsStream("utplsql-cli.version")) {
BufferedReader reader = new BufferedReader(new InputStreamReader(in));
MAVEN_PROJECT_VERSION = reader.readLine();

reader.close();
}
}
catch ( IOException | URISyntaxException e ) {
catch ( IOException e ) {
System.out.println("WARNING: Could not get Version information!");
}
}
Expand Down