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 19070 - Saving data object for form causes null pointer exception
Summary: Saving data object for form causes null pointer exception
Status: CLOSED FIXED
Alias: None
Product: java
Classification: Unclassified
Component: Unsupported (show other bugs)
Version: -FFJ-
Hardware: PC Windows ME/2000
: P3 blocker (vote)
Assignee: Tomas Hurka
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2002-01-04 21:46 UTC by Jeffrey Norton
Modified: 2007-09-26 09:14 UTC (History)
1 user (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 Jeffrey Norton 2002-01-04 21:46:51 UTC
Tool Designer generates the .form and .java files for a Swing form.
It then needs the form editor to generate the Swing initialization code
into the .java file from the definition in the .form file.  In Pilsen
we used the following technique:
   1) Open the data object associated with the form
   2) Save it
   3) Close it
(See the code at the bottom).  When I moved to Orion (FFJEE build 011217)
I started getting the following exception.  It is not deterministic but
very likely (happens in about 30% of the forms processed although not 
always the same ones).

TD: --> GenericGeneratorDataObject.forceFormEditorCodeGeneration
(gen/src/XSLT/XSLTtesterPanel.java)
Fri Jan 04 13:38:05 PST 2002: java.lang.NullPointerException: <no message>
java.lang.NullPointerException
        at javax.swing.text.JTextComponent.getCaretPosition
(JTextComponent.java:1139)
        at org.netbeans.modules.java.JavaEditor$10.actionPerformed
(JavaEditor.java:1073)
        at javax.swing.Timer.fireActionPerformed(Timer.java:150)
        at javax.swing.Timer$DoPostEvent.run(Timer.java:108)
        at java.awt.event.InvocationEvent.dispatch(InvocationEvent.java:154)
        at java.awt.EventQueue.dispatchEvent(EventQueue.java:337)
[catch] at java.awt.EventDispatchThread.pumpOneEventForHierarchy
(EventDispatchThread.java:131)
        at java.awt.EventDispatchThread.pumpEventsForHierarchy
(EventDispatchThread.java:98)
        at java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:93)
        at java.awt.EventDispatchThread.run(EventDispatchThread.java:85)
TD: <-- GenericGeneratorDataObject.forceFormEditorCodeGeneration

Java Method:
------------
    public void forceFormEditorCodeGeneration(final String resource) {
        ctx.logEntry
("GenericGeneratorDataObject.forceFormEditorCodeGeneration", resource); //NOI18N
        try {
            FileObject parent = this.getFolder().getPrimaryFile();
            FileObject fileObject = Util.getFileObject(parent, resource);
            if (fileObject == null) {
                String errMsg = ctx.getMessage("MSG_UnableToOpenFile", 
resource);
                Exception e = new Exception(errMsg);
                throw e;
            }
            final DataObject dataObject = DataObject.find(fileObject);
            ((OpenCookie)dataObject.getCookie(OpenCookie.class)).open();
            SwingUtilities.invokeAndWait(new Runnable() {
                public void run() {
                    if (dataObject.isModified()) {
                        try {
                            ((SaveCookie)dataObject.getCookie
(SaveCookie.class)).save();
                        } catch (Exception ex) {
                            ctx.raiseDialog
("MSG_UnableToForceFormEditorCodeGeneration", resource, 
ex);                             //NOI18N
                        }
                    }
                    ((CloseCookie)dataObject.getCookie(CloseCookie.class)).close
();
                }
            });
            
        } catch (Exception e) {
            ctx.raiseDialog("MSG_ExceptionInFormEditorCodeGeneration", 
resource, e); //NOI18N
            ctx.logException(e);
        }
        ctx.logExit();
    }
Comment 1 Tomas Pavek 2002-01-05 16:41:08 UTC
I don't know what could cause the NPE - looks like it happens in java 
module. Reassigning...
Comment 2 Tomas Hurka 2002-01-07 09:44:21 UTC
I don't understand why this is P1 issue. Lowering priority.
Comment 3 Tomas Hurka 2002-01-08 17:40:27 UTC
fixed in trunk, will be merged to release33 branch tomorrow
Comment 4 Svata Dedic 2002-01-08 18:30:21 UTC
I've merged it in - there was additional change, which has to be
merged into 3.3 branch, so I've merged them both.
Comment 5 Jan Becicka 2002-06-27 12:36:44 UTC
VERIFIED
Comment 6 Quality Engineering 2003-07-01 13:15:25 UTC
Resolved for 3.4.x or earlier, no new info since then -> closing.