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 10260 - ClassCastException when executing Ant target
Summary: ClassCastException when executing Ant target
Status: CLOSED FIXED
Alias: None
Product: projects
Classification: Unclassified
Component: Ant (show other bugs)
Version: 3.x
Hardware: All All
: P2 blocker (vote)
Assignee: Jesse Glick
URL:
Keywords:
: 10300 21394 (view as bug list)
Depends on: 11920
Blocks:
  Show dependency tree
 
Reported: 2001-03-13 20:13 UTC by Scott Stark
Modified: 2003-06-30 14:45 UTC (History)
3 users (show)

See Also:
Issue Type: DEFECT
Exception Reporter:


Attachments
system/ide.log (3.80 KB, text/plain)
2001-07-20 20:40 UTC, Scott Stark
Details

Note You need to log in before you can comment on or make changes to this bug.
Description Scott Stark 2001-03-13 20:14:00 UTC
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>
Comment 1 Scott Stark 2001-03-13 20:14:40 UTC
Created attachment 777 [details]
system/ide.log
Comment 2 Jesse Glick 2001-03-14 14:46:46 UTC
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.
Comment 3 Jesse Glick 2001-03-14 15:33:38 UTC
*** Issue 10300 has been marked as a duplicate of this issue. ***
Comment 4 Milan Kubec 2001-03-14 16:41:23 UTC
I'd vote for *not* storing any Object to System.properties. 

This bug makes ant module almost unusable!
Comment 5 Jesse Glick 2001-03-15 15:26:13 UTC
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.
Comment 6 _ ttran 2001-03-15 16:05:21 UTC
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
Comment 7 Jesse Glick 2001-03-16 18:08:32 UTC
Worked around in release32 as well.
Comment 8 Build Virtual User 2001-03-27 09:35:29 UTC
Verified in build release32-13
Comment 9 Jan Chalupa 2001-05-05 19:30:14 UTC
Target milestone -> 3.2
Comment 10 Jesse Glick 2002-03-19 18:51:03 UTC
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.
Comment 11 Jesse Glick 2002-03-19 18:52:20 UTC
*** Issue 21394 has been marked as a duplicate of this issue. ***
Comment 12 Quality Engineering 2003-06-30 14:45:59 UTC
Resolved for 3.3.x or earlier, no new info since then -> closing.