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.

Bug 124838 - Running custom Ant task freezes IDE
Summary: Running custom Ant task freezes IDE
Status: CLOSED WONTFIX
Alias: None
Product: projects
Classification: Unclassified
Component: Ant (show other bugs)
Version: 6.x
Hardware: All All
: P3 blocker (vote)
Assignee: Jesse Glick
URL: http://sourceforge.net/tracker/index....
Keywords: THREAD
Depends on:
Blocks:
 
Reported: 2008-01-07 21:08 UTC by chiss
Modified: 2008-01-08 13:39 UTC (History)
0 users

See Also:
Issue Type: DEFECT
Exception Reporter:


Attachments
The zipped project minus the PMD jar file (290.08 KB, application/x-compressed)
2008-01-07 21:11 UTC, chiss
Details
Deadlock section of thread dump (3.42 KB, text/plain)
2008-01-07 22:05 UTC, Jesse Glick
Details

Note You need to log in before you can comment on or make changes to this bug.
Description chiss 2008-01-07 21:08:38 UTC
I have added several Ant tasks to the default build script of my project. One of them simply calls PMD to generate a 
report. Once the task is completed, the whole IDE freezes and I have no choice but to kill the IDE process.

Calling the Ant task from the command line works ok.

I had the same problem with NetBeans 5.5.1, but my workaround was to have 2 Ant tasks, the first one was calling the 
other one using 'antcall'. This workaround doesn't work anymore.

Here is the stack trace I got in NetBeans log file in 5.5.1. Unfortunately, there is nothing the the log of NB6 that 
can help track the problem, so I'm assuming this stack trace from 5.5.1 shows the problem in 6.0 as well, but it could 
be a different problem (but somehow I don't think so).

java.lang.NullPointerException
	at org.apache.tools.ant.Project.fireMessageLoggedEvent(Project.java:2006)
	at org.apache.tools.ant.Project.fireMessageLogged(Project.java:2058)
	at org.apache.tools.ant.Project.log(Project.java:367)
	at org.apache.tools.ant.Task.log(Task.java:346)
	at net.sourceforge.pmd.util.AntLogHandler.publish(AntLogHandler.java:45)
	at java.util.logging.Logger.log(Logger.java:472)
	at java.util.logging.Logger.doLog(Logger.java:494)
	at java.util.logging.Logger.log(Logger.java:538)
	at java.awt.Component.dispatchEventImpl(Component.java:4253)
	at java.awt.Container.dispatchEventImpl(Container.java:2116)
	at java.awt.Component.dispatchEvent(Component.java:4240)
	at java.awt.LightweightDispatcher.retargetMouseEvent(Container.java:4322)
	at java.awt.LightweightDispatcher.trackMouseEnterExit(Container.java:4103)
	at java.awt.LightweightDispatcher.processMouseEvent(Container.java:3968)
	at java.awt.LightweightDispatcher.dispatchEvent(Container.java:3916)
	at java.awt.Container.dispatchEventImpl(Container.java:2102)
	at java.awt.Window.dispatchEventImpl(Window.java:2429)
	at java.awt.Component.dispatchEvent(Component.java:4240)
	at java.awt.EventQueue.dispatchEvent(EventQueue.java:599)
[catch] at java.awt.EventDispatchThread.pumpOneEventForFilters(EventDispatchThread.java:273)
	at java.awt.EventDispatchThread.pumpEventsForFilter(EventDispatchThread.java:183)
	at java.awt.EventDispatchThread.pumpEventsForHierarchy(EventDispatchThread.java:173)
	at java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:168)
	at java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:160)
	at java.awt.EventDispatchThread.run(EventDispatchThread.java:121)

Maybe I'm not calling PMD properly, but still I think NetBeans should be able to recover from whatever error happens 
when running Ant.

I will attach a sample project (a simple Hello world main class) with my custom build.xml. The zip file also includes 
PMD (I've tried with 4.0 and 4.1), so it should be simple to reproduce on your end.

I simply love NetBeans, I hope this report can make it a little better.

Francis
Comment 1 chiss 2008-01-07 21:11:45 UTC
Created attachment 54772 [details]
The zipped project minus the PMD jar file
Comment 2 chiss 2008-01-07 21:13:39 UTC
Because of the 1 meg size limit for the attachement, I was forced to delete the pmd-4.1.jar from the lib/PMD/lib 
directory. To reproduce the problem, you will have to get PMD from the project's site. Sorry!
Comment 3 Jesse Glick 2008-01-07 22:05:02 UTC
Something to do with PMD registering a custom global LogHandler, which a very dangerous thing for an Ant task to do.
Deadlock may not be easily fixable on the NB side, and anyway you would still have huge memory leaks.
Comment 4 Jesse Glick 2008-01-07 22:05:51 UTC
Created attachment 54776 [details]
Deadlock section of thread dump
Comment 5 Jesse Glick 2008-01-07 22:17:42 UTC
I filed a bug for PMD on your behalf; see the URL and add yourself to CC.
Comment 6 chiss 2008-01-08 13:39:45 UTC
Thanks Jesse, that was a very impressive response time!

Happy new year, long live NetBeans  ;-)

Francis