-
Type:
Bug
-
Status: Verified
-
Resolution: Unresolved
-
Affects Version/s: 6.2.4 CE GA5, 6.2.10 EE GA1
-
Fix Version/s: None
-
Labels:None
-
Fix Priority:3
If a portlet in a plugin specifies an AssetRendererFactory implementation that implements getClassTypes(long[], Locale) the Asset Publisher configuration doesn't work anymore.
This happens because in AssetPublisherImpl.getClassName(AssetRendererFactory) we retrieve the "human class name" of a factory by doing .getClass().getName() and splitting for "." and using the last part. When called on elements that come from other contexts returns something in the form "it.smc.SomeAssetRendererFactory.$Proxy987", and "$Proxy987" as a result of "humanization".
This would not be a problem if this value wasn't used as part of composed DOM ids in the multi-level className/classType selection of the dynamic configuration of the Asset Publisher.
The script then tries to do A.one('#something<%= className %>'), but while special characters are valid DOM id characters, they are not valid selector characters un-escaped.
There are a lot of possible solutions to this:
- stop using Java class names or part of those as DOM ids;
- (preferred by reporter) change AssetPublisherImpl.getClassName so it acknowledges Class Loader proxies;
- escape className replacing invalid characters in their textual representation (from $ to DOLLAR);
- escape selectors so that A.one('#a$b$c') becomes A.one('#a\\$b
$c'); - stop using A.one('#...') instead of the slightly faster A.one(document.getElementById('...')) that would have prevented this issue.
STEPS TO REPRODUCE
- Create a plugin with a custom entity
- Define your own *AssetRenderer and *AssetRendererFactory for your entity
- Implement *AssetRendererFactory.getClassTypes so that returns a non-empty Map of (even fictitious) class types
- Create a page
- Place the Asset Publisher
- Configure it to filter only for one of your class types
EXPECTED RESULT
- The Asset Publisher correctly filters assets of the configured class type
ACTUAL RESULT
- The Asset Publisher configuration doesn't work at all, thus preventing the user from selecting any classType