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 268061 - DataEditorSupport.openDocument() taking long time to open the document
Summary: DataEditorSupport.openDocument() taking long time to open the document
Status: NEW
Alias: None
Product: ide
Classification: Unclassified
Component: UI (show other bugs)
Version: 8.1
Hardware: PC Other
: P2 normal (vote)
Assignee: issues@ide
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2016-09-16 12:51 UTC by sureshpisupati
Modified: 2016-09-29 12:35 UTC (History)
2 users (show)

See Also:
Issue Type: DEFECT
Exception Reporter:


Attachments
Messages.log (662.21 KB, application/octet-stream)
2016-09-29 09:25 UTC, sureshpisupati
Details

Note You need to log in before you can comment on or make changes to this bug.
Description sureshpisupati 2016-09-16 12:51:07 UTC
Hi,

We are trying to migrate our product which is built based on NetBeans libraries from NetBeans 7.0 to NetBeans 8.
At the high level the functionality of the product will be like: the changes made in the UI ( for example selecting the check box or selecting a value from drop down ) will be reflected in the xml file in the background. For this we are using StyledDocument and this we are doing using DataEditorSupport class.

Till NetBeans 7 this was working fine but when we migrated to NetBeans 8.1 we are facing issue. It is taking lot of time and not updating the changes.

Here is the snippet of the code:
public class XmlEditorSupport extends DataEditorSupport implements OpenCookie, EditCookie, EditorCookie, Serializable, PropertyChangeListener, Runnable, DocumentListener, DataDictionaryEditorSupportAdapter {

....
private synchronized void update( String xmlData ) {

      try {
         StyledDocument document = this.openDocument();
         document.remove( 0, document.getLength() );
         document.insertString( 0, xmlData, null );
      }
      catch( BadLocationException ex ) {
         ex.printStackTrace();
      }
      catch( IOException e ) {
         e.printStackTrace();
      }
   }
}
and at openDocument() the application getting hanged.

Please help in resolving this issue.
Comment 1 Miloslav Metelka 2016-09-26 14:42:55 UTC
Please add

-J-Dorg.openide.text.CloneableEditorSupport.level=FINEST

to your netbeans.conf (possibly see http://wiki.netbeans.org/FaqNetbeansConf ) and attach the resulting messages.log after the NB got hanged to this issue.

If the IDE hangs please take a thread dump and attach it to this issue.
Thanks.
Comment 2 sureshpisupati 2016-09-27 10:34:21 UTC
Thanks for the reply...

when i tried that option, i was getting a warning message stating that "Lengthy Operation in Progress". And when i click on cancel button and proceed with the changes, i am getting the below exception:

javax.swing.text.BadLocationException: Modification not allowed
	at org.openide.text.CloneableEditorSupport$DocFilter.modificationNotAllowed(CloneableEditorSupport.java:2433)
	at org.openide.text.CloneableEditorSupport$DocFilter.checkModificationAllowed(CloneableEditorSupport.java:2427)
	at org.openide.text.CloneableEditorSupport$DocFilter.remove(CloneableEditorSupport.java:2383)
	at org.netbeans.editor.BaseDocument.remove(BaseDocument.java:960)
	at com.adminserver.asgraphicrulesidemodule.editors.xmleditorsupport.XmlEditorSupport.update(XmlEditorSupport.java:849)
	at com.adminserver.asgraphicrulesidemodule.editors.xmleditorsupport.XmlEditorSupport.update(XmlEditorSupport.java:764)
	at com.adminserver.asgraphicrulesidemodule.editors.ui.AbstractEditorUi.synchWithEditorSupport(AbstractEditorUi.java:94)
	at com.adminserver.asgraphicrulesidemodule.editors.ui.AbstractEditorUi.notifyModified(AbstractEditorUi.java:112)
Comment 3 Petr Pisl 2016-09-27 13:32:46 UTC
Could you attached the messages.log file.
Comment 4 Miloslav Metelka 2016-09-27 15:10:16 UTC
(In reply to sureshpisupati from comment #2)
> Thanks for the reply...
> 
> when i tried that option, i was getting a warning message stating that
> "Lengthy Operation in Progress". And when i click on cancel button and
> proceed with the changes, i am getting the below exception:
> 
Despite this please attach your messages.log file. Without that we cannot go further in helping you. It might be that you e.g. call certain methods from an incorrect context (e.g. in notification methods or you have some locks acquired etc.) and the log file with the output from
-J-Dorg.openide.text.CloneableEditorSupport.level=FINEST
is a first step in trying to understand what went wrong.
Comment 5 Miloslav Metelka 2016-09-29 08:30:01 UTC
In addition you could put

  Thread.dumpStack();

before "StyledDocument document = this.openDocument();" so that the resulting messages.log will show us in which context you call the methods. Thanks.
Comment 6 Miloslav Metelka 2016-09-29 08:40:20 UTC
The process of attaching the messages.log is at
http://wiki.netbeans.org/FaqLogMessagesFile
Comment 7 sureshpisupati 2016-09-29 09:25:17 UTC
Created attachment 162265 [details]
Messages.log
Comment 8 Miloslav Metelka 2016-09-29 11:58:12 UTC
I don't see your update() method that would be calling DataEditorSupport.openDocument() in the attached log. Did the IDE go through your added piece of code? In what package(s) does your extra code reside?
Comment 9 sureshpisupati 2016-09-29 12:17:07 UTC
(In reply to Miloslav Metelka from comment #8)
> I don't see your update() method that would be calling
> DataEditorSupport.openDocument() in the attached log. Did the IDE go through
> your added piece of code? In what package(s) does your extra code reside?

Yes, the IDE went thru the added piece of the code, and in the update() will call openDocument() and this is the one that is causing the problem as i mentioned in my first issue.

Please let me know in case of any other places i need to put some more debug points so that we can get the information that you are looking for to solve this issue.
Comment 10 sureshpisupati 2016-09-29 12:35:13 UTC
(In reply to sureshpisupati from comment #9)
> (In reply to Miloslav Metelka from comment #8)
> > I don't see your update() method that would be calling
> > DataEditorSupport.openDocument() in the attached log. Did the IDE go through
> > your added piece of code? In what package(s) does your extra code reside?
> 
> Yes, the IDE went thru the added piece of the code, and in the update() will
> call openDocument() and this is the one that is causing the problem as i
> mentioned in my first issue.
> 
> Please let me know in case of any other places i need to put some more debug
> points so that we can get the information that you are looking for to solve
> this issue.

Here is the exception that is thrown in View->IDE Log:
java.lang.Exception: Stack trace
	at java.lang.Thread.dumpStack(Thread.java:1329)
	at com.adminserver.asgraphicrulesidemodule.editors.xmleditorsupport.XmlEditorSupport.update(XmlEditorSupport.java:858)
	at com.adminserver.asgraphicrulesidemodule.editors.xmleditorsupport.XmlEditorSupport.update(XmlEditorSupport.java:764)
	at com.adminserver.asgraphicrulesidemodule.editors.ui.AbstractEditorUi.synchWithEditorSupport(AbstractEditorUi.java:94)
	at com.adminserver.asgraphicrulesidemodule.editors.AbstractEditorPane.synchWithEditorSupport(AbstractEditorPane.java:416)
	at com.adminserver.asgraphicrulesidemodule.editors.AbstractEditorPane.componentHidden(AbstractEditorPane.java:285)
	at org.netbeans.core.multiview.MultiViewPeer.peerComponentHidden(MultiViewPeer.java:361)
	at org.netbeans.core.multiview.MultiViewCloneableTopComponent.componentHidden(MultiViewCloneableTopComponent.java:139)
	at org.openide.windows.WindowManager.componentHidden(WindowManager.java:352)
	at org.netbeans.core.windows.WindowManagerImpl.componentHidden(WindowManagerImpl.java:1215)
	at org.netbeans.core.windows.view.DefaultView.changeGUI(DefaultView.java:535)
	at org.netbeans.core.windows.ViewRequestor.dispatchRequest(ViewRequestor.java:275)
	at org.netbeans.core.windows.ViewRequestor.processRequest(ViewRequestor.java:251)
	at org.netbeans.core.windows.ViewRequestor.postRequest(ViewRequestor.java:189)
	at org.netbeans.core.windows.ViewRequestor.scheduleRequest(ViewRequestor.java:127)
	at org.netbeans.core.windows.Central.removeModeTopComponent(Central.java:1018)
	at org.netbeans.core.windows.ModeImpl.removeTopComponent(ModeImpl.java:478)
	at org.netbeans.core.windows.ModeImpl.close(ModeImpl.java:286)
	at org.netbeans.core.windows.WindowManagerImpl.topComponentClose(WindowManagerImpl.java:1321)
	at org.openide.windows.TopComponent.close(TopComponent.java:561)
	at org.openide.windows.TopComponent.close(TopComponent.java:548)
	at org.openide.windows.CloneableOpenSupport$2.run(CloneableOpenSupport.java:164)
	at org.openide.windows.CloneableOpenSupport$2.run(CloneableOpenSupport.java:150)
	at org.netbeans.modules.openide.util.NbMutexEventProvider$Event.doEventAccess(NbMutexEventProvider.java:138)
	at org.netbeans.modules.openide.util.NbMutexEventProvider$Event.writeAccess(NbMutexEventProvider.java:88)
	at org.netbeans.modules.openide.util.LazyMutexImplementation.writeAccess(LazyMutexImplementation.java:84)
	at org.openide.util.Mutex.writeAccess(Mutex.java:271)
	at org.openide.windows.CloneableOpenSupport.close(CloneableOpenSupport.java:149)
	at org.openide.text.CloneableEditorSupport.close(CloneableEditorSupport.java:1707)
	at org.openide.windows.CloneableOpenSupport.close(CloneableOpenSupport.java:135)
	at com.adminserver.asgraphicrulesidemodule.explorers.actions.RevertModifications.performAction(RevertModifications.java:53)
	at org.openide.util.actions.CallableSystemAction$1.run(CallableSystemAction.java:130)
	at org.openide.util.actions.ActionInvoker$1.run(ActionInvoker.java:95)
	at org.openide.util.actions.ActionInvoker.doPerformAction(ActionInvoker.java:116)
	at org.openide.util.actions.ActionInvoker.invokeAction(ActionInvoker.java:99)
	at org.openide.util.actions.CallableSystemAction.actionPerformed(CallableSystemAction.java:127)
	at javax.swing.AbstractButton.fireActionPerformed(AbstractButton.java:2022)
	at javax.swing.AbstractButton$Handler.actionPerformed(AbstractButton.java:2348)
	at javax.swing.DefaultButtonModel.fireActionPerformed(DefaultButtonModel.java:402)
	at javax.swing.DefaultButtonModel.setPressed(DefaultButtonModel.java:259)
	at javax.swing.AbstractButton.doClick(AbstractButton.java:376)
	at javax.swing.plaf.basic.BasicMenuItemUI.doClick(BasicMenuItemUI.java:833)
	at javax.swing.plaf.basic.BasicMenuItemUI$Handler.mouseReleased(BasicMenuItemUI.java:877)
	at java.awt.Component.processMouseEvent(Component.java:6535)
	at javax.swing.JComponent.processMouseEvent(JComponent.java:3324)
	at java.awt.Component.processEvent(Component.java:6300)
	at java.awt.Container.processEvent(Container.java:2236)
	at java.awt.Component.dispatchEventImpl(Component.java:4891)
	at java.awt.Container.dispatchEventImpl(Container.java:2294)
	at java.awt.Component.dispatchEvent(Component.java:4713)
	at java.awt.LightweightDispatcher.retargetMouseEvent(Container.java:4888)
	at java.awt.LightweightDispatcher.processMouseEvent(Container.java:4525)
	at java.awt.LightweightDispatcher.dispatchEvent(Container.java:4466)
	at java.awt.Container.dispatchEventImpl(Container.java:2280)
	at java.awt.Window.dispatchEventImpl(Window.java:2750)
	at java.awt.Component.dispatchEvent(Component.java:4713)
	at java.awt.EventQueue.dispatchEventImpl(EventQueue.java:758)
	at java.awt.EventQueue.access$500(EventQueue.java:97)
	at java.awt.EventQueue$3.run(EventQueue.java:709)
	at java.awt.EventQueue$3.run(EventQueue.java:703)
	at java.security.AccessController.doPrivileged(Native Method)
	at java.security.ProtectionDomain$JavaSecurityAccessImpl.doIntersectionPrivilege(ProtectionDomain.java:76)
	at java.security.ProtectionDomain$JavaSecurityAccessImpl.doIntersectionPrivilege(ProtectionDomain.java:86)
	at java.awt.EventQueue$4.run(EventQueue.java:731)
	at java.awt.EventQueue$4.run(EventQueue.java:729)
	at java.security.AccessController.doPrivileged(Native Method)
	at java.security.ProtectionDomain$JavaSecurityAccessImpl.doIntersectionPrivilege(ProtectionDomain.java:76)
	at java.awt.EventQueue.dispatchEvent(EventQueue.java:728)
	at org.netbeans.core.TimableEventQueue.dispatchEvent(TimableEventQueue.java:159)
	at java.awt.EventDispatchThread.pumpOneEventForFilters(EventDispatchThread.java:201)
	at java.awt.EventDispatchThread.pumpEventsForFilter(EventDispatchThread.java:116)
	at java.awt.EventDispatchThread.pumpEventsForHierarchy(EventDispatchThread.java:105)
	at java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:101)
	at java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:93)
	at java.awt.EventDispatchThread.run(EventDispatchThread.java:82)