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 33297 - NPE in ManifestTab.ensureVersionAttribute
Summary: NPE in ManifestTab.ensureVersionAttribute
Status: VERIFIED FIXED
Alias: None
Product: obsolete
Classification: Unclassified
Component: jarpackager (show other bugs)
Version: 3.x
Hardware: All All
: P2 blocker (vote)
Assignee: issues@obsolete
URL:
Keywords:
Depends on:
Blocks: 29447
  Show dependency tree
 
Reported: 2003-04-29 11:51 UTC by _ tboudreau
Modified: 2003-12-11 14:22 UTC (History)
0 users

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 _ tboudreau 2003-04-29 11:51:07 UTC
Using the new property sheet, one thing seems not
to be
working at all:  Creating JARs from template.  As soon
as wizard is completed, and whenever the JAR node is 
selected, the following NPE is fired:

java.lang.NullPointerException
        at
org.netbeans.modules.jarpackager.ManifestTab.ensureVersionAttribute(Manifes
tTab.java:607)
        at
org.netbeans.modules.jarpackager.ManifestTab.getValue(ManifestTab.java:471)

        at
org.openide.explorer.propertysheet.PropUtils.updateEdFromProp(PropUtils.jav
a:559)
        at
org.openide.explorer.propertysheet.PropUtils.getPropertyEditor(PropUtils.ja
va:530)
        at
org.openide.explorer.propertysheet.ReusablePropertyModel.getPropertyEditor(
ReusablePropertyModel.java:57)
        at
org.openide.explorer.propertysheet.SheetCellRenderer.setCurrentModelAndEnv(
SheetCellRenderer.java:284)
        at
org.openide.explorer.propertysheet.SheetCellRenderer.getTableCellRendererCo
mponent(SheetCellRenderer.java:82)
        at
javax.swing.JTable.prepareRenderer(JTable.java:3731)
        at
javax.swing.plaf.basic.BasicTableUI.paintCell(BasicTableUI.java:1149)
        [snip]


The triggering method is simple boilerplate code
to fetch
the property editor for the property, and ensure
that its
value matches the value of the property (you have
to do
this - primitive property editors will not have
the value
set;  property editors implemented as inner classes of
Property subclasses probably will, but there is no
way to
know which kind of editor you have except to test the 
values).

Is it possible that the property sheet is getting the
JAR DataObject too soon, and calling this method
while the
manifest attributes are still being created?  Or
is the
answer something more simple?

    static void updateEdFromProp(Property p,
PropertyEditor ed, 
                                    String title)
throws 
                                   
ProxyNode.DifferentValuesException, 
                                   
IllegalAccessException, 
                                   
InvocationTargetException {
        Object newValue = p.getValue();
        Object oldValue = ed.getValue();
        // test if newValue is not equal to oldValue
        if ((newValue != null &&
!newValue.equals(oldValue)) ||
        (newValue == null && oldValue != null)) {
            ed.setValue(newValue);
        }
    }
Comment 1 Ondrej Rypacek 2003-04-29 13:05:57 UTC
I cannot reproduce it on the latest build. Could you give more details
on when it appears? Steps to reproduce, build number, os? thanks.
Comment 2 Ondrej Rypacek 2003-04-29 13:07:37 UTC
Well, I missed the dependency to 29447 and the "new property sheets".
Ignore my previous post, I'll check it out with the new prop-sheets.
Comment 3 Ondrej Rypacek 2003-04-29 14:47:08 UTC
Reproduced and fixed. The problem was in that the code of getValue
depended on that setValue is called before. In other words, it did not
handle "no value" correctly. I fixed it to return null in the case the
value was not initialized yet.
Also fixed the same issue in DataObjectListEditor .

1.28      +9 -6     
jarpackager/src/org/netbeans/modules/jarpackager/ManifestTab.java

 1.52      +3 -0     
jarpackager/src/org/netbeans/modules/jarpackager/DataObjectListEditor.java


Comment 4 David Kaspar 2003-06-30 15:28:27 UTC
Verified in trunk