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.
When I tried to execute the following ant target I received a ClassCastException. <target name="test1"> <junit printsummary="yes" haltonfailure="no" fork="true" dir="${build.classes.dir}" timeout="1200000" > <jvmarg value="-Djbosstest.deploy.dir=${build.deploy.dir}" /> <jvmarg value="-Djava.security.manager" /> <jvmarg value="- Djava.security.policy=${src.resources}/security/tst.policy" /> <jvmarg value="- Djava.security.auth.login.config=${src.resources}/security/auth.conf" /> <classpath> <path refid="test.classpath" /> <pathelement path="${jboss.lib}/jboss-jaas.jar" /> </classpath> <formatter type="plain" usefile="false" /> <test name="org.jboss.test.security.test.TestEJBSpec" /> </junit> </target>
Created attachment 777 [details] system/ide.log
Interesting bug. It is caused by rev 1.7 of org.netbeans.core.windows.frames.DefaultContainerImpl. Here the window system stores a Runnable in System.properties. This is a serious hack. java.util.Properties is documented to only accept values of type String. 1. I can change Ant module to specifically remove this bogus property (generally, any non-String-valued system properties) right before calling Project.init() and put them back right afterwards. This is a workaround. 2. Post-1.3 versions of Ant actually accept non-String Ant properties internally, and in Project.init() only String-valued system properties, so this bug would not appear. 3. Dafe, please consider not using System.properties to store a non-String object, as any other code making the legitimate assumption that System.getProperties().get("foo") instanceof String, would also be broken.
*** Issue 10300 has been marked as a duplicate of this issue. ***
I'd vote for *not* storing any Object to System.properties. This bug makes ant module almost unusable!
Working around the bug in the trunk--should now occur only rarely if you click Execute a whole lot very quickly and are switching windows (a race condition I can do little to prevent). release32 later.
Historical background: The kludge of storing a reference to Runnable in system properties was invented by me in the focus-follows-mouse patch. I needed to call something in core from openide and couldn't find anything better less making openide depend on core. I was hoping that when Dafe integrates the patch he would find a better method for doing the same thing
Worked around in release32 as well.
Verified in build release32-13
Target milestone -> 3.2
Note that after 3.2, Ant 1.4.1 was used, which does not suffer from the problem, so even the rare occurrences should be gone; also #11920, the original bug, was fixed.
*** Issue 21394 has been marked as a duplicate of this issue. ***
Resolved for 3.3.x or earlier, no new info since then -> closing.