mirror of
https://github.com/ethauvin/bld.git
synced 2025-04-25 16:27:11 -07:00
Initialize BldVersion directly using the classloader resources.
This commit is contained in:
parent
2fa65fc302
commit
ddf31fd1a5
2 changed files with 15 additions and 6 deletions
|
@ -4,8 +4,9 @@
|
||||||
*/
|
*/
|
||||||
package rife.bld;
|
package rife.bld;
|
||||||
|
|
||||||
import rife.resources.ResourceFinderClasspath;
|
import rife.tools.FileUtils;
|
||||||
import rife.resources.exceptions.ResourceFinderErrorException;
|
|
||||||
|
import java.io.IOException;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Singleton class that provides access to the current bld version as a string.
|
* Singleton class that provides access to the current bld version as a string.
|
||||||
|
@ -17,10 +18,18 @@ public class BldVersion {
|
||||||
private String version_;
|
private String version_;
|
||||||
|
|
||||||
BldVersion() {
|
BldVersion() {
|
||||||
ResourceFinderClasspath resource_finder = ResourceFinderClasspath.instance();
|
var resource = getClass().getClassLoader().getResource("BLD_VERSION");
|
||||||
try {
|
try {
|
||||||
version_ = resource_finder.getContent("BLD_VERSION");
|
if (resource == null) {
|
||||||
} catch (ResourceFinderErrorException e) {
|
version_ = null;
|
||||||
|
} else {
|
||||||
|
var connection = resource.openConnection();
|
||||||
|
connection.setUseCaches(false);
|
||||||
|
try (var input_stream = connection.getInputStream()) {
|
||||||
|
version_ = FileUtils.readString(input_stream);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
} catch (IOException e) {
|
||||||
version_ = null;
|
version_ = null;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -429,7 +429,7 @@ public class Wrapper {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// find the wrapper classloader in the hierarchy and add the RIFE2 jar to it
|
// find the wrapper classloader in the hierarchy and add the bld jar to it
|
||||||
classloader_ = new WrapperClassLoader();
|
classloader_ = new WrapperClassLoader();
|
||||||
classloader_.add(distribution_file.toURI().toURL());
|
classloader_.add(distribution_file.toURI().toURL());
|
||||||
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue