Please use the Apache issue tracking system for new NetBeans issues ( !!

Bug 213141

Summary: Document does not have up-to-date content immediately after reload
Product: platform Reporter: Tomas Mysik <tmysik>
Component: TextAssignee: Miloslav Metelka <mmetelka>
Status: RESOLVED WONTFIX QA Contact: issues <>
Priority: P3 CC: jtulach, mmetelka, sdedic
Version: 7.2   
Target Milestone: 7.3   
Hardware: All   
OS: All   
Issue Type: DEFECT Exception Report:
Bug Depends on:    
Bug Blocks: 211358, 228826    
Attachments: unit test

Description Tomas Mysik 2012-05-29 08:58:04 UTC
Created attachment 119982 [details]
unit test

If one saves document and immediately copies new content via streams, document still contains the old content.

Unit test attached, I hope it is correct :)


Product Version: NetBeans IDE Dev (Build 20120528-3c75442ef118)
Updates: Updates available
Java: 1.6.0_32; Java HotSpot(TM) 64-Bit Server VM 20.7-b02
System: Linux version 3.4.0-030400-generic running on amd64; UTF-8; cs_CZ (nb
Comment 1 Jaroslav Tulach 2012-06-01 22:21:43 UTC

*** This bug has been marked as a duplicate of bug 207060 ***
Comment 2 Tomas Mysik 2012-11-07 08:59:09 UTC
Have to reopen, it does not seem to be fixed - at least the test still fails for me. Can you please verify, Jardo?


Product Version: NetBeans IDE 7.3 Beta 2 (Build 201211052012)
Updates: NetBeans IDE is updated to version NetBeans 7.3 Beta 2
Java: 1.6.0_35; Java HotSpot(TM) 64-Bit Server VM 20.10-b01
Runtime: Java(TM) SE Runtime Environment 1.6.0_35-b10
System: Linux version 3.2.0-32-generic running on amd64; UTF-8; cs_CZ (nb)
Comment 3 Jaroslav Tulach 2012-11-07 14:39:25 UTC
Thanks for the test. The FileChange event is delivered as soon as the stream closed and is synchronously passed to CloneableEditorSupport as PROP_TIME change. The support detects it needs to reload. Then it however starts to switch between EDT and outside of EDT, so it is not easy to find out the document has already been refreshed.

Passing to openide.text...
Comment 4 Miloslav Metelka 2012-11-12 13:52:34 UTC
Btw getting the content of editor in the test should definitely be done in Document.render().
The reload is done in AWT since the caret position needs to be restored after the reload which has to occur in AWT.
In the future we could think about doing the reload by applying diffs between current editor's content and the loaded content which could possibly eliminate  need for a caret update but it is rather a thin ice.
So I close this as wontfix. I guess that getting the content in invokeLater() would probably work (since the reload task would already be in the AWT queue) if it would work for you as a workaround for your usecase.
Comment 5 Tomas Mysik 2013-06-04 09:34:01 UTC
BTW workaround for this issue (at least for me) was to add a sleep() for 1 second.
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