PQ60990: CALLING SET METHOD ON THE FIELDARRAY WHEN THE FIRST ITEM IS BLANK, NO OTHER ITEMS IS SET | |||||||||||||||||||||||||||||||||||||
![]() |
|||||||||||||||||||||||||||||||||||||
APAR status Closed as program error. Error description Problem Description:From Customers point of view We have run into some inconsistencies with regard to the implementation behaviours of <jsp:setProperty> between Weblogic and IBM. Of course, Weblogic is providing a more favorable result for our application. Anyway, the problem is as follows: Our JSP is written to expect the setProperty to set the array with size equals to the number of indexed properties as defined in the form. Eg., if form is defined with 3 fields, our JSP is expecting an array of size 3 regardless of the number of indexed field filled The observed Websphere implementation behaviour is not consistent in that when none of the indexed properties was filled, it would not call the corresponding set method. This leaves our data improperly initialized. However, when one of the fields was filled, the corresponding set methodwould be called with the correct array size. Customers Observations from JSP version 1.1 specification Section 2.13.2.1 Syntax The name of the Bean property whose value you want to set If you set propertyName to * then the tag will iterate over the current ServletRequest parameters, matching parameter names and value type(s) to property names and setter method type(s), setting each matched property to the value of the matching parameter. If a parameter has a value of "", the corresponding property is notmodified The code block causing the issue is as follows <jsp:setProperty name="containerCreateForm" property="*"/> <% // get container from controller state ContainerSummaryEnt cont = (ContainerSummaryEnt) containerCreateControllerState.get ("container"); // populate the container cont.setQuantity (Integer.parseInt (containerCreateForm.getQuantity ())); cont.setType (containerCreateForm.getContainerType ()); cont.setDescription (containerCreateForm.getDescription ()); cont.setVolume (Double.parseDouble (containerCreateForm.getVolume ())); cont.setFreightClass (containerCreateForm.getFreightClass ()); cont.setUnitWeight (Double.parseDouble (containerCreateForm.getUnitWeight ())); cont.setOrderValue (CurrencyUtil.convertToDouble(containerCreateForm.getOrderValue( ),AppHtt pUtil.getLocale(session))); cont.setDeclValue (CurrencyUtil.convertToDouble(containerCreateForm.getDeclValue() ,AppHttp Util.getLocale(session))); cont.setLength (Double.parseDouble (containerCreateForm.getLength ())); cont.setWidth (Double.parseDouble (containerCreateForm.getWidth ())); cont.setHeight (Double.parseDouble (containerCreateForm.getHeight ())); cont.setLadenLength (Double.parseDouble (containerCreateForm.getLadenLength ())); // create vector of ref #s String[] mandatoryRefNumTypes = containerCreateViewParam.getMandatoryRefNumTypes (); String[] mandatoryRefNums = containerCreateForm.getMandatoryReferenceNumber (); . String[] optionalRefNumTypes = containerCreateViewParam.getOptionalRefNumTypes (); String[] optionalRefNums = containerCreateForm.getOptionalReferenceNumber (); Vector rns = new Vector (); Vector mandatoryTypes = (Vector) containerCreateControllerState.get ("MandatoryRefNumTypes"); String level = EntityType.CONTAINER.getName(); RefNumViewEnt rn; . for (int i = 0; i < mandatoryRefNumTypes.length; i++) { if (mandatoryRefNums[i]!= null && mandatoryRefNums[i].length()>0) { rn = new RefNumViewEnt ( level, ((CodeDescEnt) (mandatoryTypes.elementAt (i))).getCode(), mandatoryRefNums[i]); rns.addElement (rn); } } // end of for (mandatory ref #s) Vector optionalTypes = (Vector) containerCreateControllerState.get ("OptionalRefNumTypes"); for (int i = 0; i < optionalRefNumTypes.length; i++) { if (optionalRefNums[i]!= null && optionalRefNums[i].length()>0) { rn = new RefNumViewEnt ( level, ((CodeDescEnt) (optionalTypes.elementAt (i))).getCode(), optionalRefNums[i]); rns.addElement (rn); } } // end of for (optional ref #s) try { // create container String result = cf.createContainer (cont, rns); } catch (TMUserException e) { MessageTableParam mtp = new MessageTableParam(); mtp.addMessage(new ErrorMessage(e, session)); session.setAttribute("msgTableParam", mtp); session.setAttribute("messageTableParamName", "msgTableParam"); . JSPUtil.sendRedirect (session, "ContainerCreate.gsm"); return; } JSPUtil.sendRedirect (session, containerCreateControllerParam.getRefererURL()); return; } // action = "OK" The following is the stack trace of the problem. [4/2/02 15:56:13:179 EST] 4aad894a SystemOut U m_optionalReferenceNumber in ContainerEntryForm [Ljava.lang.String;@46e00951 [4/2/02 15:56:13:179 EST] 4aad894a SystemOut U m_optionalReferenceNumber length in ContainerEntryForm 0 [4/2/02 15:56:16:851 EST] 4aad894a SystemOut U Info: in method handleError (HttpGUIController) . [4/2/02 15:56:16:945 EST] 4aad894a SystemOut U Error: java.lang.ArrayIndexOutOfBoundsException: 0 at common._ContainerCreateController_jsp_6._jspService(ContainerCre ateContr oller.jsp :232) at org.apache.jasper.runtime.HttpJspBase.service(HttpJspBase.java:1 42) at javax.servlet.http.HttpServlet.service(HttpServlet.java:853) at org.apache.jasper.runtime.JspServlet$JspServletWrapper.service(J spServle t.java:300) at org.apache.jasper.runtime.JspServlet.serviceJspFile(JspServlet.j ava:430) at org.apache.jasper.runtime.JspServlet.service(JspServlet.java:565 ) at javax.servlet.http.HttpServlet.service(HttpServlet.java:853) at com.ibm.servlet.engine.webapp.StrictServletInstance.doService(Se rvletMan ager.java:827) at com.ibm.servlet.engine.webapp.StrictLifecycleServlet._service(St rictLife cycleServlet.java:167) at com.ibm.servlet.engine.webapp.IdleServletState.service(StrictLif ecycleSe rvlet.java:297) at com.ibm.servlet.engine.webapp.StrictLifecycleServlet.service(Str ictLifec ycleServlet.java:110) at com.ibm.servlet.engine.webapp.ServletInstance.service(ServletMan ager.jav a:472) at com.ibm.servlet.engine.webapp.ValidServletReferenceState.dispatc dispatch(Servle tManager.java:1012) at com.ibm.servlet.engine.webapp.ServletInstanceReference.dispatch( ServletM anager.java:913) at com.ibm.servlet.engine.webapp.WebAppRequestDispatcher.handleWebA ppDispat ch(WebAppRequestDispatcher.java:523) at com.ibm.servlet.engine.webapp.WebAppRequestDispatcher.dispatch(W ebAppReq uestDispatcher.java:282) at com.ibm.servlet.engine.webapp.WebAppRequestDispatcher.include(We bAppRequ estDispatcher.java:119) at org.apache.jasper.runtime.PageContextImpl.include(PageContextImp l.java:4 79) at ent_00025y._entry_jsp_32._jspService(entry.jsp :45) at org.apache.jasper.runtime.HttpJspBase.service(HttpJspBase.java:1 42) at javax.servlet.http.HttpServlet.service(HttpServlet.java:853) at org.apache.jasper.runtime.JspServlet$JspServletWrapper.service(J spServle t.java:300) at org.apache.jasper.runtime.JspServlet.serviceJspFile(JspServlet.j ava:430) at org.apache.jasper.runtime.JspServlet.service(JspServlet.java:565 ) at javax.servlet.http.HttpServlet.service(HttpServlet.java:853) at com.ibm.servlet.engine.webapp.StrictServletInstance.doService(Se rvletMan ager.java:827) at com.ibm.servlet.engine.webapp.StrictLifecycleServlet._service(St rictLife cycleServlet.java:167) at com.ibm.servlet.engine.webapp.IdleServletState.service(StrictLif ecycleSe rvlet.java:297) at com.ibm.servlet.engine.webapp.StrictLifecycleServlet.service(Str ictLifec ycleServlet.java:110) at com.ibm.servlet.engine.webapp.ServletInstance.service(ServletMan ager.jav a:472) at com.ibm.servlet.engine.webapp.ValidServletReferenceState.dispatc h(Servle tManager.java:1012) at com.ibm.servlet.engine.webapp.ServletInstanceReference.dispatch( (ServletM anager.java:913) at com.ibm.servlet.engine.webapp.WebAppRequestDispatcher.handleWebA ppDispat ch(WebAppRequestDispatcher.java:523) at com.ibm.servlet.engine.webapp.WebAppRequestDispatcher.dispatch(W ebAppReq uestDispatcher.java:282) at com.ibm.servlet.engine.webapp.WebAppRequestDispatcher.forward(We bAppRequ estDispatcher.java:112) at com.ibm.servlet.engine.srt.WebAppInvoker.doForward(WebAppInvoker .java:91 ) at com.ibm.servlet.engine.srt.WebAppInvoker.handleInvocationHook(We 1) calling set method on the fieldArray when the first item is blank, no other items is set. 2) In the case that a form field is left blank, the setter method is still called WAS 4.02 on NTLocal fix com.ibm.servlet.engine.oselistener.OSEListenerDispatcher.serv ice(OSEListener.java:315) at com.ibm.servlet.engine.http11.HttpConnection.handleRequest(Ht tpConnection.java:60) atcom.ibm.ws.http.HttpConnection.readAndHandleRequest(HttpConne ction.java:323) at com.ibm.ws.http.HttpConnection.run(HttpConnection.java:252)Problem summary **************************************************************** * USERS AFFECTED: WebSphere Application Server Developers * * using JSP's and JavaBeans. * **************************************************************** * PROBLEM DESCRIPTION: JSP setProperty tag fails to call * * setter method for attributes of type * * Array. * **************************************************************** * RECOMMENDATION: * **************************************************************** JSP setProperty fails to call the appropiate JavaBean's setter method when the first element value in the array is null. If the first element in the array is not null, the appropiate setter method is called and the array is initialized to the correct size.Problem conclusion Migrated current version of Tomcat's JSP 1.1 code that handles this requirement. JSP processor was incorrectly checking only the first element of the getParameter method call to determine whether to call setter method.Temporary fix //wasdoc0/apars/pq60990/<WAS_VERSION>Comments
APAR is sysrouted FROM one or more of the following: APAR is sysrouted TO one or more of the following: Modules/Macros
|
Document Information |
Product categories: Software > Application Servers >
Distributed Application & Web Servers > WebSphere Application
Server > General
Operating system(s):
Software version: 400
Software edition:
Reference #: PQ60990
IBM Group: Software Group
Modified date: May 15, 2002
(C) Copyright IBM Corporation 2000, 2006. All Rights Reserved.