Community
Participate
Working Groups
If an invalid target name is passed into the ProgressBuildListener constructor, an NPE occurs in countTarget(...). This is because the loop which stores the Target objects in an array doesn't check if mainProject.getTargets().get(targetName) returns null.
Fixed. I changed the implementation to use a List of targets and to only add the target to the list if it is not null. Please verify.
I verified the code change but isn't the bug in passing a name to the build listener that does not exist. We had this bug logged (bug 23350) before and you and I decided not to handle this case. Do you have a different use case now?
During the migration to launch configs I found that if I just passed in "arg1" as an argument, it was interpreted as a target name and caused this NPE.
The arg should be interpreted as a target name. We seem to be doing a lot of work for a build that will fail (should exit with "Target 'arg' does not exist in this project"). We should check the validity of the target names and bail as soon as possible from the build. Creating a progress monitor seems like overkill.
Opened bug 27123 as the problem is really elsewhere. I am going to remove the null check.
So I was wrong...the easiest path for this is too handle the target that does not exist. We bail about as soon as we can.