활동이 없어 이 대화는 잠겼습니다. 새 게시물을 작성해 주세요.
활동이 없어 이 대화는 잠겼습니다. 새 게시물을 작성해 주세요.
Hi,
We are using AEM 6 at the moment, and take advantage of ValueMap's in Sightly. We use the following code:
import org.apache.sling.api.resource.ValueMap;import org.apache.sling.api.wrappers.ValueMapDecorator;
ValueMap map = new ValueMapDecorator(new HashMap<String, Object>() {{ put("key", "value"); }});
map.size() is expected to be equal to 1, but with AEM 6.1, the values aren't wrapped anymore and the size of ValueMapDecorator is equal to 0.
In the attach there is map var expansion.
Thanks
P.S. using
com.adobe.cq.commerce.common.ValueMapDecorator;
didn't solve the problem, but in AEM 6 both approaches worked fine
P.S.1 this classes are referenced from this dependency:
<dependency> <groupId>com.adobe.aem</groupId><artifactId>uber-jar</artifactId><version>6.1.0</version><scope>provided</scope></dependency>
해결되었습니다! 솔루션으로 이동.
조회 수
답글
좋아요 수
Sounds like a bug to me. Please file support request to investigate further.
조회 수
답글
좋아요 수
Sounds like a bug to me. Please file support request to investigate further.
조회 수
답글
좋아요 수
Hi Dmytro,
Using AEM Fiddle (available here) I have put together the following test, based on your code:
<%@page session="false" contentType="text/html; charset=utf-8" pageEncoding="UTF-8" import="java.util.*, org.apache.sling.api.resource.ValueMap, org.apache.sling.api.wrappers.ValueMapDecorator" %> <% ValueMap map = new ValueMapDecorator(new HashMap<String, Object>() {{ put("key", "value"); }}); out.println(map.size()); %>
This outputs '1' and not '0' on my AEM 6.1 installation (clean install), so I cannot reproduce your issue at this time. Could you please try this same thing on your environment via AEM Fiddle?
Thanks.
조회 수
답글
좋아요 수
Hi Tim,
We're facing the same issue as Dmytro mentioned above. I think AEM Fiddle proves that AEM 6.1 runtime environment provides a valid implementation of ValueMapDecorator - that's awesome, but doesn't help for unit tests running outside CQ.
As if you put your test into JUnit test class and run it on your local machine in Maven or in an IDE - the unit test will fail. The reason of this is uber-jar provides just an empty wrapper for ValueMapDecorator along with other empty wrapper classes in org.apache.sling.api.*, com.day.cq.* and com.google.common.* packages.
So I'm wondering whether we're using the wrong dependency for AEM 6.1 API (https://repo.adobe.com/nexus/content/repositories/releases/com/adobe/aem/uber-jar/6.1.0/)?
As AEM 6.0 API contains not just wrappers but valid implementations for Sling API.
Thank you,
Anton
조회 수
답글
좋아요 수
Hey Anton,
The code in the Uber jar is intentionally obfuscated. A request for unobfuscated classes can be raised via a support request and will be reviewed on a case-by-case basis.
Thanks,
Tim
조회 수
답글
좋아요 수