struts-issues mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Markus Fischer (JIRA)" <j...@apache.org>
Subject [jira] [Commented] (WW-4813) NP with TextProvider and wildcardmapping
Date Fri, 14 Jul 2017 09:53:00 GMT

    [ https://issues.apache.org/jira/browse/WW-4813?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=16087121#comment-16087121
] 

Markus Fischer commented on WW-4813:
------------------------------------

Thanks for this great documentation!

Version 1 and 3 do work perfect. However version 2 does lead to an Exception, at least if
called in a Class extending {{ActionSupport}}:

{code}
com.opensymphony.xwork2.inject.DependencyException: com.opensymphony.xwork2.inject.ContainerImpl$MissingDependencyException:
No mapping found for dependency [type=util.Texti18n, name='default'] in public void ch.myPackage.myClass.setI18n(util.Texti18n).
	com.opensymphony.xwork2.inject.ContainerImpl.addInjectorsForMembers(ContainerImpl.java:145)
	com.opensymphony.xwork2.inject.ContainerImpl.addInjectorsForMethods(ContainerImpl.java:116)
	com.opensymphony.xwork2.inject.ContainerImpl.addInjectors(ContainerImpl.java:94)
	com.opensymphony.xwork2.inject.ContainerImpl$1.create(ContainerImpl.java:75)
	com.opensymphony.xwork2.inject.ContainerImpl$1.create(ContainerImpl.java:71)
	com.opensymphony.xwork2.inject.util.ReferenceCache$CallableCreate.call(ReferenceCache.java:155)
	java.util.concurrent.FutureTask.run(FutureTask.java:266)
	com.opensymphony.xwork2.inject.util.ReferenceCache.internalCreate(ReferenceCache.java:79)
	com.opensymphony.xwork2.inject.util.ReferenceCache.get(ReferenceCache.java:123)
	com.opensymphony.xwork2.inject.ContainerImpl.inject(ContainerImpl.java:468)
	com.opensymphony.xwork2.inject.ContainerImpl$6.call(ContainerImpl.java:507)
	com.opensymphony.xwork2.inject.ContainerImpl$6.call(ContainerImpl.java:505)
	com.opensymphony.xwork2.inject.ContainerImpl.callInContext(ContainerImpl.java:560)
	com.opensymphony.xwork2.inject.ContainerImpl.inject(ContainerImpl.java:505)
	com.opensymphony.xwork2.ObjectFactory.injectInternalBeans(ObjectFactory.java:158)
	com.opensymphony.xwork2.ObjectFactory.buildBean(ObjectFactory.java:188)
	com.opensymphony.xwork2.ObjectFactory.buildBean(ObjectFactory.java:172)
	com.opensymphony.xwork2.factory.DefaultActionFactory.buildAction(DefaultActionFactory.java:22)
	com.opensymphony.xwork2.ObjectFactory.buildAction(ObjectFactory.java:137)
	com.opensymphony.xwork2.DefaultActionInvocation.createAction(DefaultActionInvocation.java:299)
	com.opensymphony.xwork2.DefaultActionInvocation.init(DefaultActionInvocation.java:399)
	com.opensymphony.xwork2.DefaultActionProxy.prepare(DefaultActionProxy.java:204)
	org.apache.struts2.factory.StrutsActionProxy.prepare(StrutsActionProxy.java:62)
	org.apache.struts2.factory.StrutsActionProxyFactory.createActionProxy(StrutsActionProxyFactory.java:37)
	com.opensymphony.xwork2.DefaultActionProxyFactory.createActionProxy(DefaultActionProxyFactory.java:58)
	org.apache.struts2.dispatcher.Dispatcher.serviceAction(Dispatcher.java:567)
	org.apache.struts2.dispatcher.ExecuteOperations.executeAction(ExecuteOperations.java:81)
	org.apache.struts2.dispatcher.filter.StrutsPrepareAndExecuteFilter.doFilter(StrutsPrepareAndExecuteFilter.java:143)
{code}

Maybe I am doing this wrong, but using i18n seems to remain quite a bit mor complex than it
used to be. Do not worry too much. My helper class Texti18n does work perfectly and your inputs
above do open some more usable options.

> NP with TextProvider and wildcardmapping
> ----------------------------------------
>
>                 Key: WW-4813
>                 URL: https://issues.apache.org/jira/browse/WW-4813
>             Project: Struts 2
>          Issue Type: Bug
>          Components: Core
>    Affects Versions: 2.5.12
>         Environment: Linux / FF / Java 8
>            Reporter: Markus Fischer
>             Fix For: 2.5.x
>
>
> Probably another corner case around TextProvider in connection with wildcard mapping:
> Embeded elements (in URLs, image tags...) in jsp like {{<s:text name="edit"/>}}
throw an NP-Exception.
> {{struts.xml}}
> {code}
>         <action name="**" class="org.package.MyClassDoingNothing">
>           <result name="test">/view/test.jsp</result>
>         </action>
> {code}
> {{test.jsp}} contains an element like this:
> {code}
> <img title="<s:text name="edit"/>" alt="<s:text name="edit"/>" src="editImage.jpg"/>
> {code}
> This will give since 2.5.12 null pointer exception:
> {code}
> ERROR DefaultDispatcherErrorHandler - Exception occurred during processing request: java.lang.NullPointerException
> org.apache.jasper.JasperException: java.lang.NullPointerException
> 	at org.apache.jasper.servlet.JspServletWrapper.handleJspException(JspServletWrapper.java:591)
> 	at org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:476)
> 	at org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:396)
> 	at org.apache.jasper.servlet.JspServlet.service(JspServlet.java:340)
> 	at javax.servlet.http.HttpServlet.service(HttpServlet.java:729)
> 	at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:291)
> 	at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)
> 	at org.apache.tomcat.websocket.server.WsFilter.doFilter(WsFilter.java:52)
> 	at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:239)
> 	at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)
> 	at org.apache.catalina.core.ApplicationDispatcher.invoke(ApplicationDispatcher.java:719)
> 	at org.apache.catalina.core.ApplicationDispatcher.processRequest(ApplicationDispatcher.java:465)
> 	at org.apache.catalina.core.ApplicationDispatcher.doForward(ApplicationDispatcher.java:390)
> 	at org.apache.catalina.core.ApplicationDispatcher.forward(ApplicationDispatcher.java:317)
> 	at org.apache.struts2.result.ServletDispatcherResult.doExecute(ServletDispatcherResult.java:173)
> 	at org.apache.struts2.result.StrutsResultSupport.execute(StrutsResultSupport.java:208)
> 	at com.opensymphony.xwork2.DefaultActionInvocation.executeResult(DefaultActionInvocation.java:373)
> 	at com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:277)
> 	at org.apache.struts2.interceptor.debugging.DebuggingInterceptor.intercept(DebuggingInterceptor.java:253)
> 	at com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:247)
> 	at com.opensymphony.xwork2.interceptor.DefaultWorkflowInterceptor.doIntercept(DefaultWorkflowInterceptor.java:176)
> 	at com.opensymphony.xwork2.interceptor.MethodFilterInterceptor.intercept(MethodFilterInterceptor.java:98)
> 	at com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:247)
> 	at com.opensymphony.xwork2.validator.ValidationInterceptor.doIntercept(ValidationInterceptor.java:260)
> 	at org.apache.struts2.interceptor.validation.AnnotationValidationInterceptor.doIntercept(AnnotationValidationInterceptor.java:52)
> 	at com.opensymphony.xwork2.interceptor.MethodFilterInterceptor.intercept(MethodFilterInterceptor.java:98)
> 	at com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:247)
> 	at com.opensymphony.xwork2.interceptor.ConversionErrorInterceptor.doIntercept(ConversionErrorInterceptor.java:139)
> 	at com.opensymphony.xwork2.interceptor.MethodFilterInterceptor.intercept(MethodFilterInterceptor.java:98)
> 	at com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:247)
> 	at com.opensymphony.xwork2.interceptor.ParametersInterceptor.doIntercept(ParametersInterceptor.java:134)
> 	at com.opensymphony.xwork2.interceptor.MethodFilterInterceptor.intercept(MethodFilterInterceptor.java:98)
> 	at com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:247)
> 	at com.opensymphony.xwork2.interceptor.ParametersInterceptor.doIntercept(ParametersInterceptor.java:134)
> 	at com.opensymphony.xwork2.interceptor.MethodFilterInterceptor.intercept(MethodFilterInterceptor.java:98)
> 	at com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:247)
> 	at com.opensymphony.xwork2.interceptor.StaticParametersInterceptor.intercept(StaticParametersInterceptor.java:199)
> 	at com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:247)
> 	at org.apache.struts2.interceptor.MultiselectInterceptor.intercept(MultiselectInterceptor.java:69)
> 	at com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:247)
> 	at org.apache.struts2.interceptor.DateTextFieldInterceptor.intercept(DateTextFieldInterceptor.java:115)
> 	at com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:247)
> 	at org.apache.struts2.interceptor.CheckboxInterceptor.intercept(CheckboxInterceptor.java:88)
> 	at com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:247)
> 	at org.apache.struts2.interceptor.FileUploadInterceptor.intercept(FileUploadInterceptor.java:246)
> 	at com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:247)
> 	at com.opensymphony.xwork2.interceptor.ModelDrivenInterceptor.intercept(ModelDrivenInterceptor.java:99)
> 	at com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:247)
> 	at com.opensymphony.xwork2.interceptor.ScopedModelDrivenInterceptor.intercept(ScopedModelDrivenInterceptor.java:139)
> 	at com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:247)
> 	at com.opensymphony.xwork2.interceptor.ChainingInterceptor.intercept(ChainingInterceptor.java:157)
> 	at com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:247)
> 	at com.opensymphony.xwork2.interceptor.PrepareInterceptor.doIntercept(PrepareInterceptor.java:174)
> 	at com.opensymphony.xwork2.interceptor.MethodFilterInterceptor.intercept(MethodFilterInterceptor.java:98)
> 	at com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:247)
> 	at org.apache.struts2.interceptor.I18nInterceptor.intercept(I18nInterceptor.java:123)
> 	at com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:247)
> 	at org.apache.struts2.interceptor.ServletConfigInterceptor.intercept(ServletConfigInterceptor.java:171)
> 	at com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:247)
> 	at com.opensymphony.xwork2.interceptor.AliasInterceptor.intercept(AliasInterceptor.java:201)
> 	at com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:247)
> 	at com.opensymphony.xwork2.interceptor.ExceptionMappingInterceptor.intercept(ExceptionMappingInterceptor.java:193)
> 	at com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:247)
> 	at util.AuthenticationInterceptor.intercept(AuthenticationInterceptor.java:88)
> 	at com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:247)
> 	at org.apache.struts2.factory.StrutsActionProxy.execute(StrutsActionProxy.java:53)
> 	at org.apache.struts2.dispatcher.Dispatcher.serviceAction(Dispatcher.java:577)
> 	at org.apache.struts2.dispatcher.ExecuteOperations.executeAction(ExecuteOperations.java:81)
> 	at org.apache.struts2.dispatcher.filter.StrutsPrepareAndExecuteFilter.doFilter(StrutsPrepareAndExecuteFilter.java:143)
> 	at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:239)
> 	at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)
> 	at customization.RequestFilter.doFilter(RequestFilter.java:57)
> 	at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:239)
> 	at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)
> 	at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:212)
> 	at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:106)
> 	at org.apache.catalina.authenticator.AuthenticatorBase.invoke(AuthenticatorBase.java:502)
> 	at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:141)
> 	at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:79)
> 	at org.apache.catalina.valves.AbstractAccessLogValve.invoke(AbstractAccessLogValve.java:616)
> 	at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:88)
> 	at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:521)
> 	at org.apache.coyote.http11.AbstractHttp11Processor.process(AbstractHttp11Processor.java:1096)
> 	at org.apache.coyote.AbstractProtocol$AbstractConnectionHandler.process(AbstractProtocol.java:674)
> 	at org.apache.tomcat.util.net.NioEndpoint$SocketProcessor.doRun(NioEndpoint.java:1500)
> 	at org.apache.tomcat.util.net.NioEndpoint$SocketProcessor.run(NioEndpoint.java:1456)
> 	at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142)
> 	at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617)
> 	at org.apache.tomcat.util.threads.TaskThread$WrappingRunnable.run(TaskThread.java:61)
> 	at java.lang.Thread.run(Thread.java:748)
> Caused by: java.lang.NullPointerException
> 	at com.opensymphony.xwork2.ActionSupport.getTextProvider(ActionSupport.java:278)
> 	at com.opensymphony.xwork2.ActionSupport.getText(ActionSupport.java:111)
> 	at org.apache.struts2.util.TextProviderHelper.getText(TextProviderHelper.java:76)
> 	at org.apache.struts2.components.Text.end(Text.java:162)
> 	at org.apache.struts2.views.jsp.ComponentTagSupport.doEndTag(ComponentTagSupport.java:42)
> 	at org.apache.jsp.view.admin_jsp._jspx_meth_s_005ftext_005f23(admin_jsp.java:1441)
> 	at org.apache.jsp.view.admin_jsp._jspx_meth_s_005fiterator_005f0(admin_jsp.java:1331)
> 	at org.apache.jsp.view.admin_jsp._jspx_meth_s_005fif_005f0(admin_jsp.java:1242)
> 	at org.apache.jsp.view.admin_jsp._jspService(admin_jsp.java:269)
> 	at org.apache.jasper.runtime.HttpJspBase.service(HttpJspBase.java:70)
> 	at javax.servlet.http.HttpServlet.service(HttpServlet.java:729)
> 	at org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:438)
> 	... 88 more
> {code}



--
This message was sent by Atlassian JIRA
(v6.4.14#64029)

Mime
View raw message