Good Saturday!

I believe I am getting the same bug.

I am getting:
Caused by: java.lang.IndexOutOfBoundsException: Index: 2, Size: 0
at java.util.ArrayList.RangeCheck(ArrayList.java:508)
at java.util.ArrayList.get(ArrayList.java:320)
at test.IndexedForm.getParameter(IndexedForm.java:28)
... 46 more

running jakarta-struts-1.1-b2 on Apache Tomcat/4.1.12 JSDK=1.4.1_01-b01

Trying to do this simple indexed ArrayList I built on top of the struts-example webapp. See source code attached.

What are the alternatives here. Go back to JDK 1.3.1 ?

Thank you so much,

Leo


From: Jim Krygowski <[EMAIL PROTECTED]>
Reply-To: "Struts Users Mailing List" <[EMAIL PROTECTED]>
To: Struts Users Mailing List <[EMAIL PROTECTED]>
Subject: RE: IndexOutOfBounds error, Struts 1.1b2, J2SDK 1.4.1
Date: Fri, 15 Nov 2002 10:01:35 -0500

We've run some more tests, and documented them. The results are totally
consistent and reproducible across all my developers' machines. We develop
targeting JRun, but we've tested against Tomcat and seen the same
IndexOutOfBoundsException. The cause is always due to the misidentification
of an ArrayList attribute as a PropertyDescriptor instead of an
IndexedPropertyDescriptor. In the table below are our testing outcomes.
Success means that the ArrayList attribute was correctly identified as a
IndexedPropertyDescriptor and the code ran without exceptions. Fail
consistently means that the ArrayList was misidentified causing an exception
to be thrown.

We see the problem in JRun and Tomcat, so we can rule out the App Servers.
We see the problem in 1.1b2+1.4.1 and Nightly+1.4.1. I've written a test
case independent of struts that examines my ActionForm
(Introspector.getBeanInfo, beanInfo.getPropertyDescriptors) and regardless
of which JDK I'm using, the results come out correctly each time.

That leads me to believe that something funny is happening to my ActionForm
somewhere in the Struts code. Has anyone else seen this?? I have three
developers who came across this error independently so I have to imagine
that some of you out there bumped into it too when you moved up to JDK
1.4.1.


App Svr; Struts Rel; JDK; Outcome;
-------; ----------; -----; -------;
JRun 4.1; 1.1b2; 1.3.1; Success;
JRun 4.1; 1.1b2; 1.4.1; Fail;
Tomcat4.0.9; 1.1b2; 1.3.1; Success;
Tomcat4.0.9; 1.1b2; 1.4.1; Fail;
JRun 4.1; Nightly; 1.3.1; Success;
JRun 4.1; Nightly; 1.4.1; Fail;
NONE; NONE; 1.3.1; Success;
NONE; NONE; 1.4.1; Success;


thanks in advance for you suggestions.

jk


_________________________________________________________________
MSN 8 helps eliminate e-mail viruses. Get 2 months FREE*. http://join.msn.com/?page=features/virus
<%@ page contentType="text/html;charset=UTF-8" language="java" %>
<%@ taglib uri="/WEB-INF/struts-bean.tld" prefix="bean" %>
<%@ taglib uri="/WEB-INF/struts-html.tld" prefix="html" %>
<%@ taglib uri="/WEB-INF/struts-logic.tld" prefix="logic" %>

<head>
<title>Indexed Test</title>

</head>
<body bgcolor="white">

<h3>Indexed Form</h3>

<logic:iterate id="parameter" name="indexedForm" property="pair">

     <bean:write name="parameter" property="value" />
     &nbsp;&nbsp;
     <bean:write name="parameter" property="name" />

<br><br>
</logic:iterate>

</body>
</html:html>

<%@ page contentType="text/html;charset=UTF-8" language="java" %>
<%@ taglib uri="/WEB-INF/struts-bean.tld" prefix="bean" %>
<%@ taglib uri="/WEB-INF/struts-html.tld" prefix="html" %>
<%@ taglib uri="/WEB-INF/struts-logic.tld" prefix="logic" %>

<head>
<title>Indexed Test</title>

</head>
<body bgcolor="white">

<h3>Indexed Form</h3>

<html:form action="/indexedResult">

<logic:iterate id="parameter" name="indexedForm" property="pair">

     <bean:write name="parameter" property="value" />
     &nbsp;&nbsp;
     <html:text name="parameter" property="name" indexed="true"/>

<br><br>
</logic:iterate>

<html:submit value="Submit"/>

</html:form>
</body>
</html:html>

<?xml version="1.0" encoding="ISO-8859-1" ?>

<!DOCTYPE struts-config PUBLIC
          "-//Apache Software Foundation//DTD Struts Configuration 1.1//EN"
          "http://jakarta.apache.org/struts/dtds/struts-config_1_1.dtd";>

<!--
     This is the Struts configuration file for the example application,
     using the proposed new syntax.

     NOTE:  You would only flesh out the details in the "form-bean"
     declarations if you had a generator tool that used them to create
     the corresponding Java classes for you.  Otherwise, you would
     need only the "form-bean" element itself, with the corresponding
     "name" and "type" attributes.
-->


<struts-config>


  <!-- ========== Data Source Configuration =============================== -->
<!--
 <data-sources>
   <data-source>
     <set-property property="autoCommit"
                      value="false"/>
     <set-property property="description"
                      value="Example Data Source Configuration"/>
     <set-property property="driverClass"
                      value="org.postgresql.Driver"/>
     <set-property property="maxCount"
                      value="4"/>
     <set-property property="minCount"
                      value="2"/>
     <set-property property="password"
                      value="mypassword"/>
     <set-property property="url"
                      value="jdbc:postgresql://localhost/mydatabase"/>
     <set-property property="user"
                      value="myusername"/>
   </data-source>
 </data-sources>
-->
  <!-- ========== Form Bean Definitions =================================== -->
  <form-beans>

    <!-- Logon form bean -->
<!--
    <form-bean      name="logonForm"
                    type="org.apache.struts.webapp.example.LogonForm"/>
-->
<!--
    <form-bean      name="logonForm"
                    type="org.apache.struts.action.DynaActionForm">
-->
    <form-bean      name="logonForm"
                    type="org.apache.struts.validator.DynaValidatorForm">
      <form-property name="username" type="java.lang.String"/>
      <form-property name="password" type="java.lang.String"/>
    </form-bean>


    <!-- Registration form bean -->
    <form-bean      name="registrationForm"
                    type="org.apache.struts.webapp.example.RegistrationForm"/>

    <!-- Subscription form bean -->
    <form-bean      name="subscriptionForm"
                    type="org.apache.struts.webapp.example.SubscriptionForm"/>

    <form-bean      name="indexedForm"
                    type="test.IndexedForm"/>



  </form-beans>


  <!-- ========== Global Forward Definitions ============================== -->
  <global-forwards>
    <forward   name="logoff"               path="/logoff.do"/>
    <forward   name="logon"                path="/logon.jsp"/>
    <forward   name="registration"         path="/registration.jsp"/>
    <forward   name="success"              path="/mainMenu.jsp"/>
  </global-forwards>



  <!-- ========== Action Mapping Definitions ============================== -->
  <action-mappings>


  <!-- ========== Action Mapping Indexed Test ===================== -->

    <action    path="/indexed"
               type="test.IndexedAction"
               name="indexedForm"
              scope="request"
           validate="false">
      <forward name="success" path="/indexed.jsp"/>
    </action>

    <action    path="/indexedResult"
               type="test.IndexedResultAction"
               name="indexedForm"
              scope="request"
           validate="false">
      <forward name="success" path="/indexedResult.jsp"/>
    </action>


  <!-- ========== Action Mapping Indexed Test ===================== -->


    <!-- Edit user registration -->
    <action    path="/editRegistration"
               type="org.apache.struts.webapp.example.EditRegistrationAction"
          attribute="registrationForm"
              scope="request"
           validate="false">
      <forward name="success"              path="/registration.jsp"/>
    </action>

    <!-- Edit mail subscription -->
    <action    path="/editSubscription"
               type="org.apache.struts.webapp.example.EditSubscriptionAction"
          attribute="subscriptionForm"
              scope="request"
           validate="false">
      <forward name="failure"              path="/mainMenu.jsp"/>
      <forward name="success"              path="/subscription.jsp"/>
    </action>

    <!-- Process a user logoff -->
    <action    path="/logoff"
               type="org.apache.struts.webapp.example.LogoffAction">
      <forward name="success"              path="/index.jsp"/>
    </action>

    <!-- Process a user logon -->
    <action    path="/logon"
               type="org.apache.struts.webapp.example.LogonAction"
               name="logonForm"
              scope="session"
              input="logon">
      <exception
                key="expired.password"
               type="org.apache.struts.webapp.example.ExpiredPasswordException"
               path="/changePassword.jsp"/>
    </action>

    <!-- Save user registration -->
    <action    path="/saveRegistration"
               type="org.apache.struts.webapp.example.SaveRegistrationAction"
               name="registrationForm"
              scope="request"
              input="registration"/>

    <!-- Save mail subscription -->
    <action    path="/saveSubscription"
               type="org.apache.struts.webapp.example.SaveSubscriptionAction"
               name="subscriptionForm"
              scope="request"
              input="subscription">
      <forward name="subscription"    path="/subscription.jsp"/>
      <forward name="success"         path="/editRegistration.do?action=Edit"/>
    </action>


    <!-- Display the "walking tour" documentation -->
    <action    path="/tour"
            forward="/tour.htm">
    </action>

  </action-mappings>


  <!-- ========== Controller Configuration ================================ -->

  <controller>
    <!-- The "input" parameter on "action" elements is the name of a
         local or global "forward" rather than a subapp-relative path -->
    <set-property property="inputForward" value="true"/>
  </controller>


  <!-- ========== Message Resources Definitions =========================== -->

  <message-resources
    parameter="org.apache.struts.webapp.example.ApplicationResources"/>


  <!-- ========== Plug Ins Configuration ================================== -->

  <plug-in className="org.apache.struts.webapp.example.memory.MemoryDatabasePlugIn">
    <set-property property="pathname" value="/WEB-INF/database.xml"/>
  </plug-in>

  <plug-in className="org.apache.struts.validator.ValidatorPlugIn">
    <set-property property="pathnames"
                     value="/WEB-INF/validator-rules.xml,
                            /WEB-INF/validation.xml"/>
  </plug-in>


</struts-config>

Attachment: test.zip
Description: Zip compressed data

<%@ page contentType="text/html;charset=UTF-8" language="java" %>
<%@ taglib uri="/WEB-INF/struts-bean.tld" prefix="bean" %>
<%@ taglib uri="/WEB-INF/struts-html.tld" prefix="html" %>
<%@ taglib uri="/WEB-INF/struts-logic.tld" prefix="logic" %>

<html:html locale="true">
<head>
<title><bean:message key="index.title"/></title>
<html:base/>
</head>
<body bgcolor="white">

<logic:notPresent name="database" scope="application">
<font color="red">
ERROR: User database not loaded -- check servlet container logs
for error messages.
</font>
<hr>
</logic:notPresent>

<logic:notPresent name="org.apache.struts.action.MESSAGE" scope="application">
<font color="red">
ERROR: Application resources not loaded -- check servlet container
logs for error messages.
</font>
</logic:notPresent>

<h3><bean:message key="index.heading"/></h3>
<ul>
<li><html:link page="/editRegistration.do?action=Create"><bean:message key="index.registration"/></html:link></li>
<li><html:link page="/logon.jsp"><bean:message key="index.logon"/></html:link></li>
</ul>



<html:link page="/indexed.do">Iterate html:text indexed example</html:link>



<p>&nbsp;</p>
<html:link page="/tour.do">
<font size="-1"><bean:message key="index.tour"/></font>
</html:link>
<p>&nbsp;</p>

<html:img page="/struts-power.gif" alt="Powered by Struts"/>

</body>
</html:html>


--
To unsubscribe, e-mail:   <mailto:[EMAIL PROTECTED]>
For additional commands, e-mail: <mailto:[EMAIL PROTECTED]>

Reply via email to