forked from Qortal/qortal
Convert ClassLoader.getSystemResource* calls to class.getResource* variant for OSGi, etc. safety
This commit is contained in:
parent
94fceeb34a
commit
cd5f9a1e6c
@ -80,7 +80,7 @@ public class Controller extends Thread {
|
||||
|
||||
private Controller() {
|
||||
Properties properties = new Properties();
|
||||
try (InputStream in = ClassLoader.getSystemResourceAsStream("build.properties")) {
|
||||
try (InputStream in = this.getClass().getResourceAsStream("/build.properties")) {
|
||||
properties.load(in);
|
||||
} catch (IOException e) {
|
||||
throw new RuntimeException("Can't read build.properties resource", e);
|
||||
|
@ -42,9 +42,9 @@ public class Gui {
|
||||
}
|
||||
|
||||
protected static BufferedImage loadImage(String resourceName) {
|
||||
try (InputStream in = ClassLoader.getSystemResourceAsStream("images/" + resourceName)) {
|
||||
try (InputStream in = Gui.class.getResourceAsStream("/images/" + resourceName)) {
|
||||
return ImageIO.read(in);
|
||||
} catch (IOException e) {
|
||||
} catch (IllegalArgumentException | IOException e) {
|
||||
LOGGER.warn(String.format("Couldn't locate image resource \"images/%s\"", resourceName));
|
||||
return null;
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user