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 225281

Summary: SQL file opened by openfile.DefaultOpenFileImpl$3.run() queries its encoding in EDT
Product: platform Reporter: Vladimir Voskresensky <vv159170>
Component: Data SystemsAssignee: Jaroslav Havlin <jhavlin>
Status: NEW ---    
Severity: normal CC: alexvsimon, almircampos, AvanOsch, azinkey, issues, sarmiste, scriptoid
Priority: P3 Keywords: PERFORMANCE
Version: 7.3   
Hardware: All   
OS: All   
Issue Type: DEFECT Exception Reporter: 197942
Attachments: nps snapshot
nps snapshot
nps snapshot

Description Vladimir Voskresensky 2013-01-24 11:38:21 UTC
This issue was reported manually by vv159170.
It already has 1 duplicates 


Build: NetBeans IDE Dev (Build 20130124-94e02e22bb69)
VM: Java HotSpot(TM) Server VM, 23.6-b04, Java(TM) SE Runtime Environment, 1.7.0_10-b18
OS: SunOS

User Comments:
vv159170: switch to/from IDE

vv159170: close project from project's context menu



Maximum slowness yet reported was 7759 ms, average is 6793
Comment 1 Vladimir Voskresensky 2013-01-24 11:38:23 UTC
Created attachment 130575 [details]
nps snapshot
Comment 2 Alexander Simon 2013-01-28 12:16:47 UTC
Created attachment 130722 [details]
nps snapshot
Comment 3 sarmiste 2013-01-28 16:46:45 UTC
Created attachment 130736 [details]
nps snapshot

Opening .SQL file
Comment 4 Jaroslav Havlin 2013-02-04 11:09:26 UTC
SQL file is not run in EDT, only opened.

The problem is that the encoding has to be detected during opening of the file, and in some cases, it's needed to access filesystem to do so.

Method org.openide.actions.OpenAction.performAction() must be called from EDT, so DefaultOpenFileImpl cannot run it in background.

Some important part of the snapshot:

org.netbeans.modules.openfile.DefaultOpenFileImpl$3.run()       34 382 ms
org.openide.actions.OpenAction.performAction()                  34 382 ms
org.openide.text.DataEditorSupport.openDocument()               34 366 ms
org.netbeans.api.queries.FileEncodingQuery.getEncoding()        34 319 ms
org.netbeans.modules.projectapi.SimpleFileOwnerQueryImplementation.getOwner()
                                                                34 319 ms
org.netbeans.api.project.ProjectManager.createProject()         34 319 ms
java.io.File.exists()	                                        31 293 ms
java.io.WinNTFileSystem.getBooleanAttributes[native]()          31 293 ms

Reassigning to Platform/Text. Please evaluate. Thank you.
Comment 5 Alexander Simon 2014-01-14 12:44:06 UTC
33 reports => P2
Comment 6 Miloslav Metelka 2014-02-13 12:35:05 UTC
The DataEditorSupport.openDocument() uses "charsets" cache which pre-reads the charset synchronously before the actual loading (in a background thread) takes place. I have tried to remove the caching but several tests failed and I'm not sure I understand all the context and consequences so passing to platform/datasystems for evaluation.
Comment 7 Jaroslav Havlin 2014-02-17 14:44:31 UTC
(In reply to Alexander Simon from comment #5)
> 33 reports => P2
Unrelated duplicates were moved to bug 242012.