4

I have a Schema which contains an image and multiple other values. I am trying to make XPM work so that this image can be changed by editors.

The image is loaded as follows inside of the view:

<div ${markup.entity(entity)}>
        <a href="${entity.link.url}">
            <div ${markup.property(entity, "image")}>
                <dxa:media media="${entity.image}" />
            </div>
        </a>
</div>

Changing the image inside XPM results in an Internal Server Error for the editor.

On the console the following error is printed:

18:25:00.803 [http-nio-8080-exec-8] ERROR c.s.w.c.controller.PageController - Exception while processing request for: /index-toerisme.html
java.lang.NumberFormatException: For input string: "v0"
    at java.lang.NumberFormatException.forInputString(NumberFormatException.java:65) ~[na:1.8.0_101]
    at java.lang.Integer.parseInt(Integer.java:580) ~[na:1.8.0_101]
    at java.lang.Integer.parseInt(Integer.java:615) ~[na:1.8.0_101]
    at com.sdl.webapp.tridion.linking.AbstractTridionLinkResolver.resolveLink(AbstractTridionLinkResolver.java:66) ~[dxa-tridion-provider-1.5.0.jar:1.5.0]
    at com.sdl.webapp.tridion.linking.AbstractTridionLinkResolver.resolveLink(AbstractTridionLinkResolver.java:35) ~[dxa-tridion-provider-1.5.0.jar:1.5.0]
    at com.sdl.webapp.tridion.linking.AbstractTridionLinkResolver.resolveLink(AbstractTridionLinkResolver.java:28) ~[dxa-tridion-provider-1.5.0.jar:1.5.0]
    at com.sdl.webapp.tridion.fields.converters.ComponentLinkFieldConverter.createComponentLink(ComponentLinkFieldConverter.java:109) ~[dxa-tridion-provider-1.5.0.jar:1.5.0]
    at com.sdl.webapp.tridion.SemanticFieldDataProviderImpl$ComponentEntity.createLink(SemanticFieldDataProviderImpl.java:274) ~[dxa-tridion-provider-1.5.0.jar:1.5.0]
    at com.sdl.webapp.tridion.SemanticFieldDataProviderImpl.getSelfFieldData(SemanticFieldDataProviderImpl.java:162) ~[dxa-tridion-provider-1.5.0.jar:1.5.0]
    at com.sdl.webapp.common.impl.mapping.SemanticMapperImpl$1.doWith(SemanticMapperImpl.java:161) ~[dxa-common-impl-1.5.0.jar:1.5.0]
    at org.springframework.util.ReflectionUtils.doWithFields(ReflectionUtils.java:570) ~[spring-core-3.1.4.RELEASE.jar:3.1.4.RELEASE]
    at org.springframework.util.ReflectionUtils.doWithFields(ReflectionUtils.java:547) ~[spring-core-3.1.4.RELEASE.jar:3.1.4.RELEASE]
    at com.sdl.webapp.common.impl.mapping.SemanticMapperImpl.createEntity(SemanticMapperImpl.java:102) ~[dxa-common-impl-1.5.0.jar:1.5.0]
    at com.sdl.webapp.tridion.mapping.EntityBuilderImpl.createEntity(EntityBuilderImpl.java:298) ~[dxa-tridion-provider-1.5.0.jar:1.5.0]
    at com.sdl.webapp.tridion.mapping.EntityBuilderImpl.createEntity(EntityBuilderImpl.java:259) ~[dxa-tridion-provider-1.5.0.jar:1.5.0]
    at com.sdl.webapp.tridion.mapping.ModelBuilderPipeline.createEntityModel(ModelBuilderPipeline.java:88) ~[dxa-tridion-provider-1.5.0.jar:1.5.0]
    at com.sdl.webapp.tridion.mapping.PageBuilderImpl$DD4TRegionBuilderCallback.buildEntity(PageBuilderImpl.java:623) ~[dxa-tridion-provider-1.5.0.jar:1.5.0]
    at com.sdl.webapp.common.impl.DefaultRegionBuilder.buildRegions(DefaultRegionBuilder.java:46) ~[dxa-common-impl-1.5.0.jar:1.5.0]
    at com.sdl.webapp.tridion.mapping.PageBuilderImpl.createPage(PageBuilderImpl.java:257) ~[dxa-tridion-provider-1.5.0.jar:1.5.0]
    at com.sdl.webapp.tridion.mapping.ModelBuilderPipeline.createPageModel(ModelBuilderPipeline.java:72) ~[dxa-tridion-provider-1.5.0.jar:1.5.0]
    at com.sdl.webapp.tridion.mapping.AbstractDefaultProvider$1.tryFindPage(AbstractDefaultProvider.java:287) ~[dxa-tridion-provider-1.5.0.jar:1.5.0]
    at com.sdl.webapp.tridion.mapping.AbstractDefaultProvider$1.tryFindPage(AbstractDefaultProvider.java:267) ~[dxa-tridion-provider-1.5.0.jar:1.5.0]
    at com.sdl.webapp.tridion.mapping.AbstractDefaultProvider.findPage(AbstractDefaultProvider.java:102) ~[dxa-tridion-provider-1.5.0.jar:1.5.0]
    at com.sdl.webapp.tridion.mapping.AbstractDefaultProvider.getPageModel(AbstractDefaultProvider.java:267) ~[dxa-tridion-provider-1.5.0.jar:1.5.0]
    at com.sdl.webapp.common.controller.PageController.getPageModel(PageController.java:342) ~[dxa-common-api-1.5.0.jar:1.5.0]
    at com.sdl.webapp.common.controller.PageController.handleGetPage(PageController.java:124) ~[dxa-common-api-1.5.0.jar:1.5.0]
    at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) ~[na:1.8.0_101]
    at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62) ~[na:1.8.0_101]
    at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) ~[na:1.8.0_101]
    at java.lang.reflect.Method.invoke(Method.java:498) ~[na:1.8.0_101]
    at org.springframework.web.method.support.InvocableHandlerMethod.invoke(InvocableHandlerMethod.java:219) ~[spring-web-3.1.4.RELEASE.jar:3.1.4.RELEASE]
    at org.springframework.web.method.support.InvocableHandlerMethod.invokeForRequest(InvocableHandlerMethod.java:132) ~[spring-web-3.1.4.RELEASE.jar:3.1.4.RELEASE]
    at org.springframework.web.servlet.mvc.method.annotation.ServletInvocableHandlerMethod.invokeAndHandle(ServletInvocableHandlerMethod.java:100) ~[spring-webmvc-3.1.4.RELEASE.jar:3.1.4.RELEASE]
    at org.springframework.web.servlet.mvc.method.annotation.RequestMappingHandlerAdapter.invokeHandlerMethod(RequestMappingHandlerAdapter.java:604) ~[spring-webmvc-3.1.4.RELEASE.jar:3.1.4.RELEASE]
    at org.springframework.web.servlet.mvc.method.annotation.RequestMappingHandlerAdapter.handleInternal(RequestMappingHandlerAdapter.java:565) ~[spring-webmvc-3.1.4.RELEASE.jar:3.1.4.RELEASE]
    at org.springframework.web.servlet.mvc.method.AbstractHandlerMethodAdapter.handle(AbstractHandlerMethodAdapter.java:80) ~[spring-webmvc-3.1.4.RELEASE.jar:3.1.4.RELEASE]
    at org.springframework.web.servlet.DispatcherServlet.doDispatch(DispatcherServlet.java:923) ~[spring-webmvc-3.1.4.RELEASE.jar:3.1.4.RELEASE]
    at org.springframework.web.servlet.DispatcherServlet.doService(DispatcherServlet.java:852) ~[spring-webmvc-3.1.4.RELEASE.jar:3.1.4.RELEASE]
    at org.springframework.web.servlet.FrameworkServlet.processRequest(FrameworkServlet.java:882) ~[spring-webmvc-3.1.4.RELEASE.jar:3.1.4.RELEASE]
    at org.springframework.web.servlet.FrameworkServlet.doGet(FrameworkServlet.java:778) ~[spring-webmvc-3.1.4.RELEASE.jar:3.1.4.RELEASE]
    at javax.servlet.http.HttpServlet.service(HttpServlet.java:622) [servlet-api.jar:na]
    at javax.servlet.http.HttpServlet.service(HttpServlet.java:729) [servlet-api.jar:na]
    at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:230) [catalina.jar:8.5.5]
    at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:165) [catalina.jar:8.5.5]
    at org.apache.tomcat.websocket.server.WsFilter.doFilter(WsFilter.java:52) [tomcat-websocket.jar:8.5.5]
    at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:192) [catalina.jar:8.5.5]
    at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:165) [catalina.jar:8.5.5]
    at com.tridion.ambientdata.web.AbstractAmbientDataServletFilter.doFilter(AbstractAmbientDataServletFilter.java:286) [web-ambient-client-8.2.0-1005.jar:8.2.0-1005]
    at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:192) [catalina.jar:8.5.5]
    at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:165) [catalina.jar:8.5.5]
    at org.springframework.web.filter.CharacterEncodingFilter.doFilterInternal(CharacterEncodingFilter.java:88) [spring-web-3.1.4.RELEASE.jar:3.1.4.RELEASE]
    at org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:76) [spring-web-3.1.4.RELEASE.jar:3.1.4.RELEASE]
    at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:192) [catalina.jar:8.5.5]
    at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:165) [catalina.jar:8.5.5]
    at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:198) [catalina.jar:8.5.5]
    at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:108) [catalina.jar:8.5.5]
    at org.apache.catalina.authenticator.AuthenticatorBase.invoke(AuthenticatorBase.java:472) [catalina.jar:8.5.5]
    at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:140) [catalina.jar:8.5.5]
    at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:79) [catalina.jar:8.5.5]
    at org.apache.catalina.valves.AbstractAccessLogValve.invoke(AbstractAccessLogValve.java:620) [catalina.jar:8.5.5]
    at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:87) [catalina.jar:8.5.5]
    at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:349) [catalina.jar:8.5.5]
    at org.apache.coyote.http11.Http11Processor.service(Http11Processor.java:784) [tomcat-coyote.jar:8.5.5]
    at org.apache.coyote.AbstractProcessorLight.process(AbstractProcessorLight.java:66) [tomcat-coyote.jar:8.5.5]
    at org.apache.coyote.AbstractProtocol$ConnectionHandler.process(AbstractProtocol.java:802) [tomcat-coyote.jar:8.5.5]
    at org.apache.tomcat.util.net.NioEndpoint$SocketProcessor.doRun(NioEndpoint.java:1410) [tomcat-coyote.jar:8.5.5]
    at org.apache.tomcat.util.net.SocketProcessorBase.run(SocketProcessorBase.java:49) [tomcat-coyote.jar:8.5.5]
    at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142) [na:1.8.0_101]
    at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617) [na:1.8.0_101]
    at org.apache.tomcat.util.threads.TaskThread$WrappingRunnable.run(TaskThread.java:61) [tomcat-util.jar:8.5.5]
    at java.lang.Thread.run(Thread.java:745) [na:1.8.0_101]

Editing String values using XPM works fine.

1
  • 1
    I'm not sure if it's directly related to the image, but the error looks like the web app is trying to resolve a link to a versioned ID. You've probably got the versioned ID because of session preview publishing a minor version. Maybe you need to strip the -v0 in code before trying to resolve the link? Commented Oct 25, 2016 at 17:07

1 Answer 1

3

Interesting... indeed, the problem seems to be that you get a -v0 TCM URI of a Component to be resolved and AbstractTridionLinkResolver contains very primitive TCM URI parsing logic, which tries to interpret the v0 as an (integer) item type.

I'm not sure why we didn't encounter this defect earlier in our testing (we do have quite some XPM test cases), but it looks like a DXA defect to me. Can you report this issue in GitHub? https://github.com/sdl/dxa-web-application-java/issues

I'm afraid that you will have to change the LinkResolver implementation to fix this issue (if you do so, please submit a Pull Request).

2

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.