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 127935 - Problems with Beans.isDesignTime() when running custom components on NetBeans IDE
Summary: Problems with Beans.isDesignTime() when running custom components on NetBeans...
Status: VERIFIED WONTFIX
Alias: None
Product: guibuilder
Classification: Unclassified
Component: Code (show other bugs)
Version: 6.x
Hardware: All All
: P2 blocker with 1 vote (vote)
Assignee: issues@guibuilder
URL: http://bugs.sun.com/bugdatabase/view_...
Keywords:
Depends on:
Blocks:
 
Reported: 2008-02-20 18:37 UTC by Michel Graciano
Modified: 2009-02-05 15:32 UTC (History)
2 users (show)

See Also:
Issue Type: DEFECT
Exception Reporter:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Michel Graciano 2008-02-20 18:37:20 UTC
The blog entry http://weblogs.java.net/blog/mister__m/archive/2008/02/making_your_com.html describes how
Beans.isDesignTime can be useful, but someone mentions problems with this API when running on NetBeans IDE environment.
The JavaBeans specification says that this method should indicate if the component is running on a development tool, and
I understand that NetBeans should indicate it as true just when component is running on Matisse editor. Otherwise, if it
is a plugin, for instance, it must return false.
Comment 1 mbien 2008-02-20 18:59:47 UTC
I am the person who mentioned the issue with the plug-in components thinking they are still in design time.

This could be probably solved if the Beans class would be loaded in the GUI builder's classloader instead of its parent.
Comment 2 Jan Stola 2008-02-21 09:51:34 UTC
Interesting, I will try to investigate whether the proposed solution is possible.
Comment 3 Jan Stola 2008-02-26 15:03:50 UTC
Unfortunately, the proposed solution cannot be implemented. Attempts to define a new copy of java.beans.Beans class in 
another classloader ends with

    java.lang.SecurityException: Prohibited package name: java.beans
        at java.lang.ClassLoader.preDefineClass(ClassLoader.java:479)
        at java.lang.ClassLoader.defineClass(ClassLoader.java:614)
        at java.lang.ClassLoader.defineClass(ClassLoader.java:465)
        ...

According to documentation of ClassLoader.defineClass() all classes in the java.* packages can only be defined by the 
bootstrap class loader. There's no associated permission to overcome this check. See ClassLoader.preDefineClass(), it 
performs the mentioned check unconditionally.

Closing this issue as 'will not fix' because I don't see any possibility to fix it.
Comment 4 kate 2008-04-08 13:10:59 UTC
no new information in discussion -> verified as WONTFIX
Comment 5 mbien 2009-02-05 14:39:08 UTC
fyi,
this bug is fixed in jdk7, Beans.* works now AppContext sensitive
fix:
http://hg.openjdk.java.net/jdk7/swing/jdk/rev/27dabbdfdcac

bug report:
http://bugs.sun.com/bugdatabase/view_bug.do?bug_id=6669869
Comment 6 Tomas Pavek 2009-02-05 15:17:03 UTC
This fix won't help us I'm afraid, we don't have separate AppContext for the GUI builder in the IDE, and can't have 
since the GUI builder UI is part of the NetBeans IDE - i.e. the same hieararchy, event queue, etc. 

Note there is also java.beans.DesignMode interface which works correctly, except during the bean initialization (after 
the bean instance is created, the GUI builder calls setDesignTime on it, but code running in constructor does not have 
it set yet).