Skip to content

Commit

Permalink
play1-1223 [#1823] Fix play.exceptions.CompilationException (fix for …
Browse files Browse the repository at this point in the history
…the fix #786)
  • Loading branch information
flybyray committed Mar 8, 2018
1 parent 71874ce commit ccb76af
Showing 1 changed file with 23 additions and 18 deletions.
41 changes: 23 additions & 18 deletions framework/src/play/classloading/ApplicationClassloader.java
Original file line number Diff line number Diff line change
Expand Up @@ -238,34 +238,39 @@ public InputStream getResourceAsStream(String name) {
return res.inputstream();
}
}
URL url = this.getResource(name);
if (url != null) {
try {
File file = new File(url.toURI());
String fileName = file.getCanonicalFile().getName();
if (!name.endsWith(fileName)) {
return null;
}
} catch (Exception e) {
}
}
URL url = getResource(name);

return super.getResourceAsStream(name);
}

@Override
public URL getResource(String name) {
for (VirtualFile vf : Play.javaPath) {
VirtualFile res = vf.child(name);
if (res != null && res.exists()) {
URL url = null;
for (VirtualFile vf : Play.javaPath) {
VirtualFile res = vf.child(name);
if (res != null && res.exists()) {
try {
return res.getRealFile().toURI().toURL();
} catch (MalformedURLException ex) {
throw new UnexpectedException(ex);
url = res.getRealFile().toURI().toURL();
break;
} catch (MalformedURLException ex) {
throw new UnexpectedException(ex);
}
}
}
if (url == null) {
url = super.getResource(name);
if (url != null) {
try {
File file = new File(url.toURI());
String fileName = file.getCanonicalFile().getName();
if (!name.endsWith(fileName)) {
url = null;
}
} catch (Exception ignore) {
}
}
}
return super.getResource(name);
return url;
}

@Override
Expand Down

0 comments on commit ccb76af

Please sign in to comment.