You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@struts.apache.org by "Martin Gainty (JIRA)" <ji...@apache.org> on 2009/03/27 02:54:02 UTC

[jira] Created: (WW-3062) //java.lang.NullPointerException at org.apache.struts2.components.UIBean.evaluateParams(UIBean.java:792)..(UIBean fails when accessing tagNames Map in Map)

//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/struts/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.


[jira] Commented: (WW-3062) //java.lang.NullPointerException at org.apache.struts2.components.UIBean.evaluateParams(UIBean.java:792)..(UIBean fails when accessing tagNames Map in Map)

Posted by "Musachy Barroso (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/struts/browse/WW-3062?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=45778#action_45778 ] 

Musachy Barroso commented on WW-3062:
-------------------------------------

Martin can you post the stack trace of the exception, and the relevant part of the JSP?

> //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/struts/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.


[jira] Resolved: (WW-3062) //java.lang.NullPointerException at org.apache.struts2.components.UIBean.evaluateParams(UIBean.java:792)..(UIBean fails when accessing tagNames Map in Map)

Posted by "Musachy Barroso (JIRA)" <ji...@apache.org>.
     [ https://issues.apache.org/struts/browse/WW-3062?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Musachy Barroso resolved WW-3062.
---------------------------------

    Resolution: Incomplete

Please reopen with a testcase to reproduce. I honestly have no idea what that code is about.

> //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/struts/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.