java.lang.IndexOutOfBoundsException

tip

Thrown to indicate that an index of some sort (such as to an array, to a string, or to a vector) is out of range. Applications can subclass this class to indicate similar exceptions.


rafael

You have a different solution? A short tip here would help you and many other users who saw this issue last week.

  • Trying to execute the following script: {code} // Project creation project --topLevelPackage org.springframework.roo.test // Database configuration (PostgreSQL) jpa setup --provider HIBERNATE --database POSTGRES --databaseName rooDB --userName admin --password admin // DATA MODEL GENERATION // GeoBoundaryRelationType enum type --class ~.domain.enumerated.GeoBoundaryRelationType enum constant --name MUNICIPIO // HousingType enum type --class ~.domain.enumerated.HousingType enum constant --name COBRA enum constant --name NINGUNO enum constant --name PAGA //Entities entity jpa --class ~.domain.Location --identifierField id --abstract --inheritanceType JOINED entity jpa --class ~.domain.place.Place --extends ~.domain.Location --testAutomatically // GeographicBoundaryRelationship entity jpa --class ~.domain.GeographicBoundary --identifierField id --testAutomatically entity jpa --class ~.domain.GeographicBoundaryRelationship --identifierField id --testAutomatically field enum --fieldName type --type ~.domain.enumerated.GeoBoundaryRelationType --notNull --enumType STRING field reference --fieldName fromGeographicBoundary --type ~.domain.GeographicBoundary --cardinality MANY_TO_ONE --notNull field reference --fieldName toGeographicBoundary --type ~.domain.GeographicBoundary --cardinality MANY_TO_ONE --notNull // GeographicBoundary focus --class ~.domain.GeographicBoundary field string --fieldName name --notNull field string --fieldName nameWithoutAccents field set --fieldName relationshipChildren --type ~.domain.GeographicBoundaryRelationship --cardinality ONE_TO_MANY --mappedBy fromGeographicBoundary field set --fieldName relationshipParents --type ~.domain.GeographicBoundaryRelationship --cardinality ONE_TO_MANY --mappedBy toGeographicBoundary // Location focus --class ~.domain.Location field string --fieldName name --notNull field reference --fieldName province --type ~.domain.GeographicBoundary --cardinality MANY_TO_ONE --notNull field reference --fieldName city --type ~.domain.GeographicBoundary --cardinality MANY_TO_ONE --notNull field string --fieldName address --notNull // Place focus --class ~.domain.place.Place field boolean --fieldName operational --notNull --primitive field boolean --fieldName shared --notNull --primitive field enum --fieldName housing --type ~.domain.enumerated.HousingType --notNull --enumType STRING field string --fieldName notes // Web layout (Spring MVC) web mvc setup // Web Mvc Scaffold web mvc scaffold --backingType ~.domain.place.Place --class ~.web.place.PlaceController {code} When script finish appears the following error: {code} Script execution aborted Index: 1, Size: 1 {code} Activating {{development mode}} on Roo Shell appears the following log error: {code} Index: 1, Size: 1 java.lang.IndexOutOfBoundsException: Index: 1, Size: 1 at java.util.ArrayList.RangeCheck(ArrayList.java:547) at java.util.ArrayList.get(ArrayList.java:322) at org.springframework.roo.addon.web.mvc.controller.scaffold.WebScaffoldMetadata.getCreateFormMethod(WebScaffoldMetadata.java:377) at org.springframework.roo.addon.web.mvc.controller.scaffold.WebScaffoldMetadata.<init>(WebScaffoldMetadata.java:170) at org.springframework.roo.addon.web.mvc.controller.scaffold.WebScaffoldMetadataProviderImpl.getMetadata(WebScaffoldMetadataProviderImpl.java:190) at org.springframework.roo.classpath.itd.AbstractItdMetadataProvider.get(AbstractItdMetadataProvider.java:264) at org.springframework.roo.metadata.DefaultMetadataService.getInternal(DefaultMetadataService.java:212) at org.springframework.roo.metadata.DefaultMetadataService.evictAndGet(DefaultMetadataService.java:121) at org.springframework.roo.classpath.itd.AbstractItdMetadataProvider.notify(AbstractItdMetadataProvider.java:601) at org.springframework.roo.metadata.DefaultMetadataService.notify(DefaultMetadataService.java:325) at org.springframework.roo.metadata.internal.DefaultMetadataDependencyRegistry.notifyDownstream(DefaultMetadataDependencyRegistry.java:238) at org.springframework.roo.classpath.DefaultPhysicalTypeMetadataProvider.onFileEvent(DefaultPhysicalTypeMetadataProvider.java:250) at org.springframework.roo.file.monitor.polling.PollingFileMonitorService.publish(PollingFileMonitorService.java:433) at org.springframework.roo.file.monitor.polling.PollingFileMonitorService.publishRequestedFileEvents(PollingFileMonitorService.java:456) at org.springframework.roo.file.monitor.polling.PollingFileMonitorService.scanNotified(PollingFileMonitorService.java:660) at org.springframework.roo.process.manager.internal.DefaultProcessManager.doTransactionally(DefaultProcessManager.java:335) at org.springframework.roo.process.manager.internal.DefaultProcessManager.execute(DefaultProcessManager.java:71) at org.springframework.roo.process.manager.ProcessManagerHostedExecutionStrategy.execute(ProcessManagerHostedExecutionStrategy.java:44) at org.springframework.roo.shell.AbstractShell.executeCommandImpl(AbstractShell.java:242) at org.springframework.roo.shell.AbstractShell.executeCommand(AbstractShell.java:149) at org.springframework.roo.shell.AbstractShell.executeScriptLine(AbstractShell.java:298) at org.springframework.roo.shell.AbstractShell.script(AbstractShell.java:521) 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:597) at org.springframework.roo.process.manager.ProcessManagerHostedExecutionStrategy$1.callback(ProcessManagerHostedExecutionStrategy.java:47) at org.springframework.roo.process.manager.internal.DefaultProcessManager.doTransactionally(DefaultProcessManager.java:325) at org.springframework.roo.process.manager.internal.DefaultProcessManager.execute(DefaultProcessManager.java:71) at org.springframework.roo.process.manager.ProcessManagerHostedExecutionStrategy.execute(ProcessManagerHostedExecutionStrategy.java:44) at org.springframework.roo.shell.AbstractShell.executeCommandImpl(AbstractShell.java:242) at org.springframework.roo.shell.AbstractShell.executeCommand(AbstractShell.java:149) at org.springframework.roo.shell.jline.JLineShell.promptLoop(JLineShell.java:421) at org.springframework.roo.shell.jline.JLineShell.run(JLineShell.java:539) {code} Debugging WebScaffoldMetadata seems like {{dependentTypes}} is getting parent class references too, but on {{fieldNamesList}} are only registered the extended class fields... dependentTypes size is 2 and fieldNamesList size is 1 so, when method tries to get fieldNamesList position 1 is showing an {{IndexOutOfBounds}} exception.
    via by Juan Carlos García del Canto,
  • Trying to execute the following script: {code} // Project creation project --topLevelPackage org.springframework.roo.test // Database configuration (PostgreSQL) jpa setup --provider HIBERNATE --database POSTGRES --databaseName rooDB --userName admin --password admin // DATA MODEL GENERATION // GeoBoundaryRelationType enum type --class ~.domain.enumerated.GeoBoundaryRelationType enum constant --name MUNICIPIO // HousingType enum type --class ~.domain.enumerated.HousingType enum constant --name COBRA enum constant --name NINGUNO enum constant --name PAGA //Entities entity jpa --class ~.domain.Location --identifierField id --abstract --inheritanceType JOINED entity jpa --class ~.domain.place.Place --extends ~.domain.Location --testAutomatically // GeographicBoundaryRelationship entity jpa --class ~.domain.GeographicBoundary --identifierField id --testAutomatically entity jpa --class ~.domain.GeographicBoundaryRelationship --identifierField id --testAutomatically field enum --fieldName type --type ~.domain.enumerated.GeoBoundaryRelationType --notNull --enumType STRING field reference --fieldName fromGeographicBoundary --type ~.domain.GeographicBoundary --cardinality MANY_TO_ONE --notNull field reference --fieldName toGeographicBoundary --type ~.domain.GeographicBoundary --cardinality MANY_TO_ONE --notNull // GeographicBoundary focus --class ~.domain.GeographicBoundary field string --fieldName name --notNull field string --fieldName nameWithoutAccents field set --fieldName relationshipChildren --type ~.domain.GeographicBoundaryRelationship --cardinality ONE_TO_MANY --mappedBy fromGeographicBoundary field set --fieldName relationshipParents --type ~.domain.GeographicBoundaryRelationship --cardinality ONE_TO_MANY --mappedBy toGeographicBoundary // Location focus --class ~.domain.Location field string --fieldName name --notNull field reference --fieldName province --type ~.domain.GeographicBoundary --cardinality MANY_TO_ONE --notNull field reference --fieldName city --type ~.domain.GeographicBoundary --cardinality MANY_TO_ONE --notNull field string --fieldName address --notNull // Place focus --class ~.domain.place.Place field boolean --fieldName operational --notNull --primitive field boolean --fieldName shared --notNull --primitive field enum --fieldName housing --type ~.domain.enumerated.HousingType --notNull --enumType STRING field string --fieldName notes // Web layout (Spring MVC) web mvc setup // Web Mvc Scaffold web mvc scaffold --backingType ~.domain.place.Place --class ~.web.place.PlaceController {code} When script finish appears the following error: {code} Script execution aborted Index: 1, Size: 1 {code} Activating {{development mode}} on Roo Shell appears the following log error: {code} Index: 1, Size: 1 java.lang.IndexOutOfBoundsException: Index: 1, Size: 1 at java.util.ArrayList.RangeCheck(ArrayList.java:547) at java.util.ArrayList.get(ArrayList.java:322) at org.springframework.roo.addon.web.mvc.controller.scaffold.WebScaffoldMetadata.getCreateFormMethod(WebScaffoldMetadata.java:377) at org.springframework.roo.addon.web.mvc.controller.scaffold.WebScaffoldMetadata.<init>(WebScaffoldMetadata.java:170) at org.springframework.roo.addon.web.mvc.controller.scaffold.WebScaffoldMetadataProviderImpl.getMetadata(WebScaffoldMetadataProviderImpl.java:190) at org.springframework.roo.classpath.itd.AbstractItdMetadataProvider.get(AbstractItdMetadataProvider.java:264) at org.springframework.roo.metadata.DefaultMetadataService.getInternal(DefaultMetadataService.java:212) at org.springframework.roo.metadata.DefaultMetadataService.evictAndGet(DefaultMetadataService.java:121) at org.springframework.roo.classpath.itd.AbstractItdMetadataProvider.notify(AbstractItdMetadataProvider.java:601) at org.springframework.roo.metadata.DefaultMetadataService.notify(DefaultMetadataService.java:325) at org.springframework.roo.metadata.internal.DefaultMetadataDependencyRegistry.notifyDownstream(DefaultMetadataDependencyRegistry.java:238) at org.springframework.roo.classpath.DefaultPhysicalTypeMetadataProvider.onFileEvent(DefaultPhysicalTypeMetadataProvider.java:250) at org.springframework.roo.file.monitor.polling.PollingFileMonitorService.publish(PollingFileMonitorService.java:433) at org.springframework.roo.file.monitor.polling.PollingFileMonitorService.publishRequestedFileEvents(PollingFileMonitorService.java:456) at org.springframework.roo.file.monitor.polling.PollingFileMonitorService.scanNotified(PollingFileMonitorService.java:660) at org.springframework.roo.process.manager.internal.DefaultProcessManager.doTransactionally(DefaultProcessManager.java:335) at org.springframework.roo.process.manager.internal.DefaultProcessManager.execute(DefaultProcessManager.java:71) at org.springframework.roo.process.manager.ProcessManagerHostedExecutionStrategy.execute(ProcessManagerHostedExecutionStrategy.java:44) at org.springframework.roo.shell.AbstractShell.executeCommandImpl(AbstractShell.java:242) at org.springframework.roo.shell.AbstractShell.executeCommand(AbstractShell.java:149) at org.springframework.roo.shell.AbstractShell.executeScriptLine(AbstractShell.java:298) at org.springframework.roo.shell.AbstractShell.script(AbstractShell.java:521) 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:597) at org.springframework.roo.process.manager.ProcessManagerHostedExecutionStrategy$1.callback(ProcessManagerHostedExecutionStrategy.java:47) at org.springframework.roo.process.manager.internal.DefaultProcessManager.doTransactionally(DefaultProcessManager.java:325) at org.springframework.roo.process.manager.internal.DefaultProcessManager.execute(DefaultProcessManager.java:71) at org.springframework.roo.process.manager.ProcessManagerHostedExecutionStrategy.execute(ProcessManagerHostedExecutionStrategy.java:44) at org.springframework.roo.shell.AbstractShell.executeCommandImpl(AbstractShell.java:242) at org.springframework.roo.shell.AbstractShell.executeCommand(AbstractShell.java:149) at org.springframework.roo.shell.jline.JLineShell.promptLoop(JLineShell.java:421) at org.springframework.roo.shell.jline.JLineShell.run(JLineShell.java:539) {code} Debugging WebScaffoldMetadata seems like {{dependentTypes}} is getting parent class references too, but on {{fieldNamesList}} are only registered the extended class fields... dependentTypes size is 2 and fieldNamesList size is 1 so, when method tries to get fieldNamesList position 1 is showing an {{IndexOutOfBounds}} exception.
    via by Juan Carlos García del Canto,
  • What is the cause
    via Stack Overflow by Max
    ,
    • java.lang.IndexOutOfBoundsException: Index: 1, Size: 1 at java.util.ArrayList.RangeCheck(ArrayList.java:547) at java.util.ArrayList.get(ArrayList.java:322) at org.springframework.roo.addon.web.mvc.controller.scaffold.WebScaffoldMetadata.getCreateFormMethod(WebScaffoldMetadata.java:377) at org.springframework.roo.addon.web.mvc.controller.scaffold.WebScaffoldMetadata.<init>(WebScaffoldMetadata.java:170) at org.springframework.roo.addon.web.mvc.controller.scaffold.WebScaffoldMetadataProviderImpl.getMetadata(WebScaffoldMetadataProviderImpl.java:190) at org.springframework.roo.classpath.itd.AbstractItdMetadataProvider.get(AbstractItdMetadataProvider.java:264) at org.springframework.roo.metadata.DefaultMetadataService.getInternal(DefaultMetadataService.java:212) at org.springframework.roo.metadata.DefaultMetadataService.evictAndGet(DefaultMetadataService.java:121) at org.springframework.roo.classpath.itd.AbstractItdMetadataProvider.notify(AbstractItdMetadataProvider.java:601) at org.springframework.roo.metadata.DefaultMetadataService.notify(DefaultMetadataService.java:325) at org.springframework.roo.metadata.internal.DefaultMetadataDependencyRegistry.notifyDownstream(DefaultMetadataDependencyRegistry.java:238) at org.springframework.roo.classpath.DefaultPhysicalTypeMetadataProvider.onFileEvent(DefaultPhysicalTypeMetadataProvider.java:250) at org.springframework.roo.file.monitor.polling.PollingFileMonitorService.publish(PollingFileMonitorService.java:433) at org.springframework.roo.file.monitor.polling.PollingFileMonitorService.publishRequestedFileEvents(PollingFileMonitorService.java:456) at org.springframework.roo.file.monitor.polling.PollingFileMonitorService.scanNotified(PollingFileMonitorService.java:660) at org.springframework.roo.process.manager.internal.DefaultProcessManager.doTransactionally(DefaultProcessManager.java:335) at org.springframework.roo.process.manager.internal.DefaultProcessManager.execute(DefaultProcessManager.java:71) at org.springframework.roo.process.manager.ProcessManagerHostedExecutionStrategy.execute(ProcessManagerHostedExecutionStrategy.java:44) at org.springframework.roo.shell.AbstractShell.executeCommandImpl(AbstractShell.java:242) at org.springframework.roo.shell.AbstractShell.executeCommand(AbstractShell.java:149) at org.springframework.roo.shell.AbstractShell.executeScriptLine(AbstractShell.java:298) at org.springframework.roo.shell.AbstractShell.script(AbstractShell.java:521) 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:597) at org.springframework.roo.process.manager.ProcessManagerHostedExecutionStrategy$1.callback(ProcessManagerHostedExecutionStrategy.java:47) at org.springframework.roo.process.manager.internal.DefaultProcessManager.doTransactionally(DefaultProcessManager.java:325) at org.springframework.roo.process.manager.internal.DefaultProcessManager.execute(DefaultProcessManager.java:71) at org.springframework.roo.process.manager.ProcessManagerHostedExecutionStrategy.execute(ProcessManagerHostedExecutionStrategy.java:44) at org.springframework.roo.shell.AbstractShell.executeCommandImpl(AbstractShell.java:242) at org.springframework.roo.shell.AbstractShell.executeCommand(AbstractShell.java:149) at org.springframework.roo.shell.jline.JLineShell.promptLoop(JLineShell.java:421) at org.springframework.roo.shell.jline.JLineShell.run(JLineShell.java:539)

    Users with the same issue

    aidoan
    2 times, last one,
    tyson925
    2 times, last one,
    arturgajowy
    12 times, last one,
    SteVio1989
    1 times, last one,
    Pilleo
    3 times, last one,
    225 more bugmates