From: Mark J. <mcj...@ma...> - 2007-04-24 15:19:31
|
Hello all, In one of our components, we use a WORepetition (ERXWORepetition under the covers, of course). I bind 'list' to an NSMutableArray, 'index' to an int, and 'item' to 'get/set' methods, which is supposed to reference the individual items in the NSMutableArray using the index. What happens, however, is that I get one too many calls to the 'set' method, with the index being out of bounds (5, instead of 4), which causes an IllegalArgumentException. The only other thing I can add is that the repetition is guarded by an ERXNonNullConditional, the result of which is true after the user has uploaded a file, and there is data for the repetition to iterate over. Does anyone with more of a clue know what's going on here? Switching logging on for ERXWORepetition is not much help. Regards, Mark Jackson From the .wod MappingRepetition: WORepetition { list = importPropertyKeys; item = currentImportKey; index = propertyIndex; } From the .java public int propertyIndex; private NSMutableArray _importPropertyKeys = null; public NSMutableArray importPropertyKeys() { if (_importPropertyKeys==null) { // Set up the array with appropriate number of entries } return _importPropertyKeys; } public void setCurrentImportKey(String value) { NSMutableArray keys = importPropertyKeys(); keys.replaceObjectAtIndex(value==null ? "" : value, propertyIndex); } Stack trace follows..... ERXWORepetition - takeValuesFromRequest: 0.3.3.0.1.9.0.3 - ("0.3.3.0.1.7.0.1.filename", "0.3.3.0.1.7.0.1", "0.3.3.0.1.7.0.3", "0.3.3.0.1.7.0.1.mimetype") ERXNSLogLog4jBridge - <com.webobjects.appserver._private.WOComponentRequestHandler>: Exception occurred while handling request: java.lang.IllegalArgumentException: Index (5) out of bounds [0, 4] [2007-04-24 16:41:01 CEST] <WorkerThread2> java.lang.IllegalArgumentException: Index (5) out of bounds [0, 4] at com.webobjects.foundation.NSMutableArray.replaceObjectAtIndex (NSMutableArray.java:351) at com.tecc.avida.components.ImportComponent.setCurrentImportKey (ImportComponent.java:347) at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) at sun.reflect.NativeMethodAccessorImpl.invoke (NativeMethodAccessorImpl.java:39) at sun.reflect.DelegatingMethodAccessorImpl.invoke (DelegatingMethodAccessorImpl.java:25) at java.lang.reflect.Method.invoke(Method.java:585) at com.webobjects.foundation.NSKeyValueCoding$ValueAccessor $1.setMethodValue(NSKeyValueCoding.java:688) at com.webobjects.foundation.NSKeyValueCoding $_MethodBinding.setValueInObject(NSKeyValueCoding.java:1175) at com.webobjects.foundation.NSKeyValueCoding $DefaultImplementation.takeValueForKey(NSKeyValueCoding.java:1293) at com.webobjects.appserver.WOComponent.takeValueForKey (WOComponent.java:1550) at com.webobjects.foundation.NSKeyValueCoding$Utility.takeValueForKey (NSKeyValueCoding.java:519) at com.webobjects.foundation.NSKeyValueCodingAdditions $DefaultImplementation.takeValueForKeyPath (NSKeyValueCodingAdditions.java:242) at com.webobjects.appserver.WOComponent.takeValueForKeyPath (WOComponent.java:1611) at com.webobjects.appserver._private.WOKeyValueAssociation._setValueNoValid ation(WOKeyValueAssociation.java:92) at er.extensions.ERXWORepetition._prepareForIterationWithIndex (ERXWORepetition.java:212) at er.extensions.ERXWORepetition.invokeAction(ERXWORepetition.java:398) at com.webobjects.appserver._private.WODynamicGroup.invokeChildrenAction (WODynamicGroup.java:101) at com.webobjects.appserver._private.WODynamicGroup.invokeAction (WODynamicGroup.java:110) at com.webobjects.appserver._private.WOComponentContent.invokeAction (WOComponentContent.java:31) at com.webobjects.appserver._private.WODynamicGroup.invokeChildrenAction (WODynamicGroup.java:101) at er.extensions.ERXWOConditional.invokeChildrenAction (ERXWOConditional.java:93) at com.webobjects.appserver._private.WODynamicGroup.invokeAction (WODynamicGroup.java:110) at er.extensions.ERXWOConditional.invokeAction(ERXWOConditional.java: 84) at com.webobjects.appserver.WOComponent.invokeAction (WOComponent.java:945) at com.webobjects.appserver._private.WOComponentReference.invokeAction (WOComponentReference.java:104) at com.webobjects.appserver._private.WODynamicGroup.invokeChildrenAction (WODynamicGroup.java:101) at com.webobjects.appserver._private.WODynamicGroup.invokeAction (WODynamicGroup.java:110) at er.extensions.ERXWOForm.invokeAction(ERXWOForm.java:127) at com.webobjects.appserver._private.WODynamicGroup.invokeChildrenAction (WODynamicGroup.java:101) at com.webobjects.appserver._private.WODynamicGroup.invokeAction (WODynamicGroup.java:110) at com.webobjects.appserver._private.WOComponentContent.invokeAction (WOComponentContent.java:31) at com.webobjects.appserver._private.WODynamicGroup.invokeChildrenAction (WODynamicGroup.java:101) at er.extensions.ERXWOConditional.invokeChildrenAction (ERXWOConditional.java:93) at com.webobjects.appserver._private.WODynamicGroup.invokeAction (WODynamicGroup.java:110) at er.extensions.ERXWOConditional.invokeAction(ERXWOConditional.java: 84) at com.webobjects.appserver._private.WODynamicGroup.invokeChildrenAction (WODynamicGroup.java:101) at com.webobjects.appserver._private.WODynamicGroup.invokeAction (WODynamicGroup.java:110) at com.webobjects.appserver._private.WOHTMLURLValuedElement.invokeAction (WOHTMLURLValuedElement.java:115) at com.webobjects.appserver._private.WODynamicGroup.invokeChildrenAction (WODynamicGroup.java:101) at com.webobjects.appserver._private.WODynamicGroup.invokeAction (WODynamicGroup.java:110) at com.webobjects.appserver.WOComponent.invokeAction (WOComponent.java:945) at com.webobjects.appserver._private.WOComponentReference.invokeAction (WOComponentReference.java:104) at com.webobjects.appserver._private.WODynamicGroup.invokeChildrenAction (WODynamicGroup.java:101) at com.webobjects.appserver._private.WODynamicGroup.invokeAction (WODynamicGroup.java:110) at com.webobjects.appserver.WOComponent.invokeAction (WOComponent.java:945) at com.webobjects.appserver.WOSession.invokeAction(WOSession.java:1168) at com.webobjects.appserver.WOApplication.invokeAction (WOApplication.java:1375) at er.extensions.ERXAjaxApplication.invokeAction (ERXAjaxApplication.java:74) at er.extensions.ERXApplication.invokeAction(ERXApplication.java:1053) at com.webobjects.appserver._private.WOComponentRequestHandler._dispatchWit hPreparedPage(WOComponentRequestHandler.java:196) at com.webobjects.appserver._private.WOComponentRequestHandler._dispatchWit hPreparedSession(WOComponentRequestHandler.java:287) at com.webobjects.appserver._private.WOComponentRequestHandler._dispatchWit hPreparedApplication(WOComponentRequestHandler.java:322) at com.webobjects.appserver._private.WOComponentRequestHandler._handleReque st(WOComponentRequestHandler.java:358) at com.webobjects.appserver._private.WOComponentRequestHandler.handleReques t(WOComponentRequestHandler.java:432) at com.webobjects.appserver.WOApplication.dispatchRequest (WOApplication.java:1306) at er.extensions.ERXApplication.dispatchRequest(ERXApplication.java: 1102) at com.webobjects.appserver._private.WOWorkerThread.runOnce (WOWorkerThread.java:173) at com.webobjects.appserver._private.WOWorkerThread.run (WOWorkerThread.java:254) at java.lang.Thread.run(Thread.java:613) |