Your browser was unable to load all of the resources. They may have been blocked by your firewall, proxy or browser configuration.
Press Ctrl+F5 or Ctrl+Shift+R to have your browser try again.

Removing from list of java.util.list<Step> type #2415

mtyde ·
Removing from list of java.util.list<Step> type in for loop give me error:

${groovy:
def master_step=build.getStep("master")
buildSteps=build.getSteps()
for (step in buildSteps){
if (step.isFailed()) {
buildSteps.remove(step)
\}
\}
}


Step 'master>execute script' is failed: java.util.ConcurrentModificationException
at java.util.ArrayList$Itr.checkForComodification(ArrayList.java:819)
at java.util.ArrayList$Itr.next(ArrayList.java:791)
at script1374787457117451622534.run(script1374787457117451622534.groovy:7)
at com.pmease.quickbuild.plugin.basis.BasisPlugin$24.evaluate(BasisPlugin.java:313)
at com.pmease.quickbuild.DefaultScriptEngine.evaluate(DefaultScriptEngine.java:80)


I have tried a different of ways. Remove function outside the foor loop works correctly. What am I doing wrong?
  • replies 2
  • views 1047
  • stars 0
robinshen ADMIN ·
Why you want to remove the failed step? The steps are assumed not to be removed by users; otherwise the build may not work.
mtyde ·
What I was looking for was:
Script which tell me just the last name of last child step.
I got configuration with steps:
master
> compile
>> windows
>>> msbuild MyProject
>>> msbuild MyProject2
Step msbuild MyProject is failing and causing that steps compile, windows and master are also visible as failed.
I wanted to know that step msbuild MyProject is failing.

I think that your script
for (step in build.steps) {
if (step.failed && !(step instanceof CompositeStep))

is doing exactly what I need.