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.
I have an application that tries to update form file programmatically, as follows FileObject[] fileObjects=(FileObject[])dataObject.files().toArray(new FileObject[0]); for(int i=0;i<fileObjects.length;i++) { FileObject fileObject=fileObjects[i]; String fileContent=<Latest file contents> try { FileSystem fs = fileObject.getFilesystem(); fs.runAtomicAction(new FileSystem.AtomicAction() { public void run() throws IOException { ByteArrayInputStream inputStream= new ByteArrayInputStream(fileContent); try { fileLock = fileObject.lock(); } catch (FileAlreadyLockedException ale) { //ignore } fileOutputStream = fileObject.getOutputStream(fileLock); StreamCopier.copyStream(inputStream,fileOutputStream); } }); } catch(FileStateInvalidException ex) { ErrorManager.getDefault().notify(ex); } catch(IOException ex) { ErrorManager.getDefault().notify(ex); } catch(Exception ex) { ErrorManager.getDefault().notify(ex); } finally { if(fileLock!=null) { fileLock.releaseLock(); } try { if(fileOutputStream!=null) { fileOutputStream.close(); } } catch (IOException e) { e.printStactTrace(); } } fileObject.refresh(false); } After update, I get the following NPE. It looks like the form dataloader is trying to invoke reload of form document, even though the document is not open. When a form document is not opened, its MultiView components are null. This exception is related to this. java.lang.NullPointerException at org.netbeans.modules.form.FormEditorSupport.reloadDocument(FormEditorSupport.java:717) at org.openide.text.CloneableEditorSupport.checkReload(CloneableEditorSupport.java:1744) at org.openide.text.CloneableEditorSupport.access$1600(CloneableEditorSupport.java:79) at org.openide.text.CloneableEditorSupport$9.run(CloneableEditorSupport.java:2112) at org.netbeans.editor.BaseDocument.runAtomicAsUser(BaseDocument.java:1086) at org.netbeans.editor.GuardedDocument.runAtomic(GuardedDocument.java:217) at org.openide.text.NbDocument.runAtomic(NbDocument.java:341) [catch] at org.openide.text.CloneableEditorSupport$9.run(CloneableEditorSupport.java:2108) at java.awt.event.InvocationEvent.dispatch(InvocationEvent.java:209) at java.awt.EventQueue.dispatchEvent(EventQueue.java:461) at java.awt.EventDispatchThread.pumpOneEventForHierarchy(EventDispatchThread.java:234) at java.awt.EventDispatchThread.pumpEventsForHierarchy(EventDispatchThread.java:163) at java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:157) at java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:149) at java.awt.EventDispatchThread.run(EventDispatchThread.java:110)
This is a showstopper bug for Java Studio Enterprise 8 Release.
I am sorry I am not able to reproduce the issue. Please, describe steps to reproduce. If the issue cannot be reproduced using normal user gestures then attach a test case.
A testcase was sent to jstola
I've made a very simple fix trying to avoid the exception. It is in trunk, please test. /cvs/form/src/org/netbeans/modules/form/FormEditorSupport.java,v <-- FormEditorSupport.java new revision: 1.173; previous revision: 1.172 http://form.netbeans.org/source/browse/form/src/org/netbeans/modules/form/FormEditorSupport.java?r1=1.172&r2=1.173
The fix works. Thanks. Backported into release41_fixes. Checking in form/src/org/netbeans/modules/form/FormEditorSupport.java; /cvs/form/src/org/netbeans/modules/form/FormEditorSupport.java,v <-- FormEditorSupport.java new revision: 1.171.16.1; previous revision: 1.171
Verified