Skip to content

Commit

Permalink
Proper resource load via classloading delegation.
Browse files Browse the repository at this point in the history
  • Loading branch information
mmalohlava committed Oct 24, 2014
1 parent 6b7fa6e commit 303adbe
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion src/main/java/water/Boot.java
Original file line number Diff line number Diff line change
Expand Up @@ -75,6 +75,8 @@ private byte[] getMD5(InputStream is) throws IOException {
}

private Boot() throws IOException {

super(Thread.currentThread().getContextClassLoader());
final String ownJar = getClass().getProtectionDomain().getCodeSource().getLocation().getPath();
Log.POST(2000, "ownJar is " + ownJar);
ZipFile jar = null;
Expand Down Expand Up @@ -372,7 +374,10 @@ private void extractInternalFiles() throws IOException {

public InputStream getResource2(String uri) {
if( fromJar() ) {
return _systemLoader.getResourceAsStream("resources"+uri);
InputStream is = _systemLoader.getResourceAsStream("resources"+uri);
if (is==null) is = this.getClass().getClassLoader().getResourceAsStream("resources"+uri);
if (is==null) is = Thread.currentThread().getContextClassLoader().getResourceAsStream("resources"+uri);
return is;
} else {
try {
File resources = new File("lib/resources");
Expand Down

0 comments on commit 303adbe

Please sign in to comment.