[
https://issues.apache.org/jira/browse/WICKET-6744?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=17060016#comment-17060016
]
Thorsten Schöning commented on WICKET-6744:
-------------------------------------------
The problem is removing a leading slash in "getResource", which in this case
results in a empty name. In case of no "webappRoot", this leads to
"META-INF/resources/" searched for in the classpath and it is simply very
likely that this exists in some JAR in the classpath. [~karel.haruda], try it
with some additional file name, check if "webappRoot" is really empty and be
prepared for
[WICKET-6755|https://issues.apache.org/jira/projects/WICKET/issues/WICKET-6755].
{code:java}
@Override
public URL getResource(String name) throws MalformedURLException
{
if (name.startsWith("/"))
{
name = name.substring(1);
}
if (webappRoot != null)
{
File f = new File(webappRoot, name);
if (f.exists())
{
return f.toURI().toURL();
}
}
return
getClass().getClassLoader().getResource("META-INF/resources/" + name);
}
{code}
> WebApplication.get().getServletContext().getRealPath("/") returning nonsense
> path
> ---------------------------------------------------------------------------------
>
> Key: WICKET-6744
> URL: https://issues.apache.org/jira/browse/WICKET-6744
> Project: Wicket
> Issue Type: Sub-task
> Affects Versions: 8.7.0
> Environment: OS WINDOWS 10 (64bit)
> java version "1.8.0_212"
> Java(TM) SE Runtime Environment (build 1.8.0_212-b10)
> Java HotSpot(TM) 64-Bit Server VM (build 25.212-b10, mixed mode)
> Reporter: Karel Haruda
> Assignee: Sven Meier
> Priority: Major
>
> After changes in WICKET-6714, method
> WebApplication.get().getServletContext().getRealPath("/") starts returning
> nonsense path somewhere inside maven local repository
>
> [file:/C:/Users/karel/.m2/repository/org/webjars/jquery-atmosphere/2.2.13/jquery-atmosphere-2.2.13.jar!/META-INF/resources/|file:///C:/Users/karel/.m2/repository/org/webjars/jquery-atmosphere/2.2.13/jquery-atmosphere-2.2.13.jar!/META-INF/resources/]
> This occurs when you run tests using WicketTester.
> WebApplication.get().getServletContext() is MockServletContext,
>
> Tests are OK only on our Jenkins, which runs on the Linux operating system.
>
--
This message was sent by Atlassian Jira
(v8.3.4#803005)