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

Weston Bustraan commented on WW-3062:
-------------------------------------

I just encountered this in my own code. For me, the problem turned out to be 
that I had a form tag that was referencing an Action bean defined in Spring and 
Spring was failing to create an instance of the Action bean because my Spring 
config was wrong. This error then caused the <s:form> tag to fail. Apparently 
this failure wasn't fatal enough to prevent the rest of the page from rendering 
and the NullPointerException is triggered by the next form tag that relies on 
page parameters that would have been set up by the prior <s:form> tag.

> //java.lang.NullPointerException at 
> org.apache.struts2.components.UIBean.evaluateParams(UIBean.java:792)..(UIBean 
> fails when accessing tagNames Map in Map)
> -----------------------------------------------------------------------------------------------------------------------------------------------------------
>
>                 Key: WW-3062
>                 URL: https://issues.apache.org/jira/browse/WW-3062
>             Project: Struts 2
>          Issue Type: Bug
>          Components: Core Actions
>    Affects Versions: 2.1.6
>         Environment: (UIBean fails when accessing tagNames Map in Map)
> TC 6.0.14
> J2SE 1.6.10
> Struts 2.1.6
>            Reporter: Martin Gainty
>            Priority: Minor
>
> org.apache.struts2.components.UIBeans fails when accessing tagNames Map via 
> parameters from evaluateParams
> public void evaluateParams() {
> .......
>       //please read this caveat about using java.util.Map *from java.util.Map 
> JavaDoc*
>         //each key can map to at most ONE value.
>         try
>         {
>         PageContext pageContext = ServletActionContext.getPageContext();
>         java.util.ArrayList<String> tags=new java.util.ArrayList(50); //this 
> will be the newly constructed List
>         if (form != null )
>         {
>             addParameter("form", form.getParameters());
>             if ( name != null )
>             {
>             // form.getParameters is a Map so you are accessing an inner Map 
> in a Map?
>             //    List tags = (List) form.getParameters().get("tagNames");
>                        try
>                        { //go straight  to Request ..pull the parameters via 
> getParameterMap
>                for (java.util.Iterator i = 
> pageContext.getRequest().getParameterMap().values().iterator(); i.hasNext(); )
>                {
>                                    tags.add( i.next().toString() ); //this 
> will be a live form-field tag
>                          }
>                    }
>                    catch(java.lang.ArrayIndexOutOfBoundsException aie)
>                    {    //prevent walk beyond the end
>                                System.out.println("ArrayIndexException has 
> been produced message = "+aie.getMessage() );
>                                  log.debug(aie.getMessage() );
>                    }
> //java.lang.NullPointerException at 
> org.apache.struts2.components.UIBean.evaluateParams(UIBean.java:792)
> //                tags.add(name);
>             }
>         }
>           }
>           catch(java.lang.NullPointerException npe1)
>           {
>                       System.out.println("Eating the exception in UIBean");
>                         log.debug( npe1.getMessage() )
>          }

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.

Reply via email to