Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[#1823] Fix play.exceptions.CompilationException (fix for the fix #786) #1224

Merged
merged 1 commit into from
Mar 16, 2018
Merged
Changes from all commits
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
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