Community
Participate
Working Groups
I have a vanilla eclipse 2.0 installation. My project compiles java code then invokes an ant script with no arguments. All is well with 2.0. When I upgrade to 2.0.1 I get an ArrayOutOfBoundsException when I build the project. If I run the ant script directly it works fine. If I change the build not to run the ant script automatically, the build works (minus what the ant script does). I get no output to the log window when this happens so I don't think the Ant script even starts. The message is: Problems occurred when invoking code from plug-in:"org.eclipse.core.resources" Here is the stack trace: java.lang.ArrayIndexOutOfBoundsException at org.eclipse.ui.externaltools.internal.core.AntFileRunner.execute (AntFileRunner.java:44) at org.eclipse.ui.externaltools.internal.core.DefaultRunnerContext.executeRunner (DefaultRunnerContext.java:413) at org.eclipse.ui.externaltools.internal.core.DefaultRunnerContext.run (DefaultRunnerContext.java:439) at org.eclipse.ui.externaltools.internal.core.ExternalToolsBuilder.build (ExternalToolsBuilder.java:50) at org.eclipse.core.internal.events.BuildManager$2.run(BuildManager.java:392) at org.eclipse.core.internal.runtime.InternalPlatform.run (InternalPlatform.java:839) at org.eclipse.core.runtime.Platform.run(Platform.java:416) at org.eclipse.core.internal.events.BuildManager.basicBuild (BuildManager.java:120) at org.eclipse.core.internal.events.BuildManager.basicBuild (BuildManager.java:176) at org.eclipse.core.internal.events.BuildManager.basicBuild (BuildManager.java:186) at org.eclipse.core.internal.events.BuildManager$1.run(BuildManager.java:146) at org.eclipse.core.internal.runtime.InternalPlatform.run (InternalPlatform.java:839) at org.eclipse.core.runtime.Platform.run(Platform.java:416) at org.eclipse.core.internal.events.BuildManager.basicBuild (BuildManager.java:160) at org.eclipse.core.internal.events.BuildManager.build(BuildManager.java:232) at org.eclipse.core.internal.resources.Project.build(Project.java:85) at org.eclipse.ui.actions.BuildAction.invokeOperation(BuildAction.java:151) at org.eclipse.ui.actions.WorkspaceAction.execute(WorkspaceAction.java:112) at org.eclipse.ui.actions.WorkspaceAction$1.execute(WorkspaceAction.java:269) at org.eclipse.ui.actions.WorkspaceModifyOperation$1.run (WorkspaceModifyOperation.java:64) at org.eclipse.core.internal.resources.Workspace.run(Workspace.java:1378) at org.eclipse.ui.actions.WorkspaceModifyOperation.run (WorkspaceModifyOperation.java:78) at org.eclipse.jface.operation.ModalContext$ModalContextThread.run (ModalContext.java:98)
Created attachment 2247 [details] Sample build file that causes the problem.
Problem appears to have been caused by fix to bug 20797.
Problem currently only exists in the 2.0.* streams. BUT the fix that caused the problem needs to be added to the 2.1 stream (bug 22402).
Problem is in AntFileRunner#execute Code is currently: String[] newArgs = new String[args.length + 1]; for (int i=0; i < newArgs.length; i++) { newArgs[i] = args[i]; } Code should be: String[] newArgs = new String[args.length + 1]; for (int i=0; i < newArgs.length - 1; i++) { //CHANGE HERE newArgs[i] = args[i]; }
Fixed in the 2.0.2 stream Please verify the changes to AntFileRunner (Darin W).
Verified.
Is there any way to tweak the build file so that this will not happen in 2.0.1?
Sorry for the delay in response but I was no longer "attached" to this bug. I believe if you do not set a working directory the problem should not occur.
If you don't specify a working directory, do you know what IS your working directory?
It would be the basedir specified in your build file. So it should work if you correctly specify your basedir in your build file but do not specify the working directory in the external tools setup.