When used in inherited markup, <wicket:link> tries to load a class with an
illegal name
---------------------------------------------------------------------------------------
Key: WICKET-1731
URL: https://issues.apache.org/jira/browse/WICKET-1731
Project: Wicket
Issue Type: Bug
Components: wicket
Affects Versions: 1.3.4
Environment: Mac OS X 10.4.11, Java 1.5.0_13, Tomcat 6.0.16
Reporter: Willis Blackburn
Here are the classes involved. Each one has a .html markup file. The actual
app is more complicated than this, but I've reduced it to a simple example.
myapp.TemplatePage: Page with standard header that is extended by all other
pages. Includes this autolink:
<wicket:link><a href="HomePage.html">Home</a></wicket:link>
myapp.HomePage: Main page of the application.
myapp.login.LoginPage: Requests a user's login and password.
When I try to access LoginPage, I get a NoClassDefFoundError: IllegalName:
myapp/HomePage
I have determined why this is occurring. AutoLinkResolver resolves autolinks
to classes first by trying to load a class relative to the page's package, then
relative to the parent page's package. However, the first time it calls
Packages.absolutePath, it passes the output to Strings.replaceAll to replace
forward slashes with periods, while the second time, it doesn't, which leads to
the IllegalName error.
The solution is to invoke the class-name-mangling logic from
AutoLinkResolver.java lines 396-400 again after the call to
Packages.absolutePath on line 428.
Also, I'm suspicious of the logic for handling parent markup containers in
AutoLinkResolver. It uses "if" instead of "while." What if the autolink was
two levels up in the inheritance hierarchy? I think that it should walk the
parent links until it finds a null, not just check the first one.
--
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.