This Bugzilla instance is a read-only archive of historic NetBeans bug reports. To report a bug in NetBeans please follow the project's instructions for reporting issues.
Development build #200606271800 of NetBeans 6.0 Windows XP, JDK 1.5.0_05 build #05 or JDK 1.6.0 RC build #87 Description: ============ Ant debugger steps into imported file if "Run|Step Over" is invoked from main menu on line with e.g. <import file="build-impl.xml"/> code. This happens when debugging targets with dependency on the imported targets. Steps to reproduce: =================== 1. Download and unzip build scripts from here: http://qa.netbeans.org/modules/debugger/promo-f/build-scripts.zip 2. Mount directory with the two XML files in Favourites view. 3. Right click build.xml filenode and invoke "Debug Target|Other Targets|run". 4. Once debugger stops at line 5 invoke "Run|Step Over" from main menu. 5. Debugger opens build-impl.xml file and stops at line 5. 6. Tha same does not occur when "Debug Target|all" is run.
Reproduced. Interestingly, I got a NPE in the console, which probably caused the debugger to stop inside the imported file.
IMHO the bug is in step #4, not step #5. An import statement is not supposed to be an executable statement; it is a declaration. That is, the first statement to stop on should be build-impl.xml:5, i.e. step #4 should be skipped but step #5 is correct.
Created attachment 31482 [details] The NPE I got in console.
Jesse, IMHO there is also a problem in ANT, because build-impl.xml is not recognized as an ANT file and therefore dobj.getCookie(AntProjectCookie.class) gives null. But $ ant compile -f build-impl.xml works fine. So this should be corrected in ANT module. Perhaps you're right with the import statement, but it's less user-friendly when it goes inside automatically IMHO.
build-impl.xml has no attrs on the <project> tag so it is not assumed to be an Ant script. This is as designed. (Could be a Maven POM, etc.) If you have code which expects an APC, do not rely on DataObject.getCookie. Use TargetLister.getAntProjectCookie or equivalent (this should probably be made an API sometime, feel free to file an RFE for it).
I agree that jumping into build-impl.xml:5 when debugging "run" target is very user confusing. In my opinion Ant debugger should simply stop at "run" target and that's it.
Jesse, TargetLister.getAntProjectCookie() is unfortunately package-private. I'll file a RFE to make it public. Is there a workaround in the mean time? getAntProjectCookie() caches the AntProjectCookie, so I guess creating new AntProjectSupport(fo); if there is no dobj cookie is not a good approach. IMHO the best is just to ignore the import statement as Jesse suggested and stop right before "-pre-run" at "<target name="run" depends="-pre-run, compile">" line. It should go into build-impl.xml when I do Step Into on "compile" at that line.
Re. getAntProjectCookie - for now you can just copy the impl from TargetLister.
moving opened issues from TM <= 6.1 to TM=Dev
The issue hasn't passed the nomination process for 65patch2 by cut-off date. It has been moved to 65patch3.
The status whiteboard "65fixes4-candidate" has been removed. At this time our proactive patches for the NetBeans 6.5.x IDE have concluded. If you own a Sun service plan contract for NetBeans, you may wish to contact Sun Service http://www.sun.com/contact/support.jsp to request a fix via the product defect escalation process. For more information on purchasing a Sun service plan contract for NetBeans, refer to the service plan item "Sun Software Service Plans (S3P) for Developers" in the Sun Service table found on our NetBeans Support Resources page http://www.netbeans.org/kb/support.html