Please use the Apache issue tracking system for new NetBeans issues (https://issues.apache.org/jira/projects/NETBEANS0/issues) !!

Bug 33297

Summary: NPE in ManifestTab.ensureVersionAttribute
Product: obsolete Reporter: _ tboudreau <tboudreau>
Component: jarpackagerAssignee: issues <issues.netbeans.org>
Status: VERIFIED FIXED QA Contact: issues <issues.netbeans.org>
Priority: P2    
Version: 3.x   
Target Milestone: 3.x   
Hardware: All   
OS: All   
Whiteboard:
Issue Type: DEFECT Exception Report:
Bug Depends on:    
Bug Blocks: 29447    

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
By use of this website, you agree to the NetBeans Policies and Terms of Use. © 2014, Oracle Corporation and/or its affiliates. Sponsored by Oracle logo