Return-Path: Delivered-To: apmail-jakarta-commons-dev-archive@www.apache.org Received: (qmail 25650 invoked from network); 10 Nov 2005 16:05:44 -0000 Received: from hermes.apache.org (HELO mail.apache.org) (209.237.227.199) by minotaur.apache.org with SMTP; 10 Nov 2005 16:05:44 -0000 Received: (qmail 66764 invoked by uid 500); 10 Nov 2005 16:05:30 -0000 Delivered-To: apmail-jakarta-commons-dev-archive@jakarta.apache.org Received: (qmail 66700 invoked by uid 500); 10 Nov 2005 16:05:30 -0000 Mailing-List: contact commons-dev-help@jakarta.apache.org; run by ezmlm Precedence: bulk List-Unsubscribe: List-Help: List-Post: List-Id: "Jakarta Commons Developers List" Reply-To: "Jakarta Commons Developers List" Delivered-To: mailing list commons-dev@jakarta.apache.org Received: (qmail 66689 invoked by uid 99); 10 Nov 2005 16:05:30 -0000 X-ASF-Spam-Status: No, hits=0.6 required=10.0 tests=NO_REAL_NAME X-Spam-Check-By: apache.org Received: from [192.87.106.226] (HELO ajax.apache.org) (192.87.106.226) by apache.org (qpsmtpd/0.29) with ESMTP; Thu, 10 Nov 2005 08:05:29 -0800 Received: by ajax.apache.org (Postfix, from userid 99) id B8A9D21E; Thu, 10 Nov 2005 17:05:08 +0100 (CET) From: bugzilla@apache.org To: commons-dev@jakarta.apache.org Subject: DO NOT REPLY [Bug 37450] New: - LazyList throws IndexOutOfBoundsException when trying to set a value out of list bounds X-Bugzilla-Reason: AssignedTo Message-Id: <20051110160508.B8A9D21E@ajax.apache.org> Date: Thu, 10 Nov 2005 17:05:08 +0100 (CET) X-Virus-Checked: Checked by ClamAV on apache.org X-Spam-Rating: minotaur.apache.org 1.6.2 0/1000/N DO NOT REPLY TO THIS EMAIL, BUT PLEASE POST YOUR BUG� RELATED COMMENTS THROUGH THE WEB INTERFACE AVAILABLE AT . ANY REPLY MADE TO THIS MESSAGE WILL NOT BE COLLECTED AND� INSERTED IN THE BUG DATABASE. http://issues.apache.org/bugzilla/show_bug.cgi?id=37450 Summary: LazyList throws IndexOutOfBoundsException when trying to set a value out of list bounds Product: Commons Version: 3.1 Platform: PC OS/Version: Windows XP Status: UNCONFIRMED Severity: normal Priority: P2 Component: Collections AssignedTo: commons-dev@jakarta.apache.org ReportedBy: hestonfernandes@yahoo.com This was discovered when using struts 1.2.7 with dynamic forms (Tomcat 5.0.24, jdk 1.4.2). The reset() method in the ActionForm used LazyList.decorate(). if(rooms==null) { rooms = new ArrayList(); roomPrefs.add("-"); roomPrefs = LazyList.decorate(roomPrefs, factory); } However after reset() I get the error below when it tries to initialize the ArrayList. IndexOutOfBoundsException -> Index: 1, Size: 1 java.lang.IndexOutOfBoundsException: Index: 1, Size: 1 at java.util.ArrayList.RangeCheck(ArrayList.java:507) at java.util.ArrayList.set(ArrayList.java:340) at org.apache.commons.collections.list.AbstractListDecorator.set(AbstractListDecorator.java:97) at org.apache.commons.beanutils.PropertyUtilsBean.setIndexedProperty(PropertyUtilsBean.java:1417) at org.apache.commons.beanutils.BeanUtilsBean.setProperty(BeanUtilsBean.java:1016) at org.apache.commons.beanutils.BeanUtilsBean.populate(BeanUtilsBean.java:811) at org.apache.commons.beanutils.BeanUtils.populate(BeanUtils.java:298) at org.apache.struts.util.RequestUtils.populate(RequestUtils.java:493) at org.apache.struts.action.RequestProcessor.processPopulate(RequestProcessor.java:805) at .... Possible Solution: For now I've created a class similar to LazyList and have overridden the set(object, element) method and it has worked. public Object set(int index, Object element) { int size = list.size(); // Grow the list if (index >= size) { for (int i = size; i <= index; i++) { list.add(null); } } return list.set(index, element); } I'm not sure if I'm using LazyList the right way but thought I'd bring it to your attention. Thanks! -- Configure bugmail: http://issues.apache.org/bugzilla/userprefs.cgi?tab=email ------- You are receiving this mail because: ------- You are the assignee for the bug, or are watching the assignee. --------------------------------------------------------------------- To unsubscribe, e-mail: commons-dev-unsubscribe@jakarta.apache.org For additional commands, e-mail: commons-dev-help@jakarta.apache.org