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 - SQL file opened by openfile.DefaultOpenFileImpl$ queries its encoding in EDT
Summary: SQL file opened by openfile.DefaultOpenFileImpl$ queries its encoding ...
Status: NEW
Alias: None
Product: platform
Classification: Unclassified
Component: Data Systems (show other bugs)
Version: 7.3
Hardware: All All
: P3 normal (vote)
Assignee: Jaroslav Havlin
Depends on:
Reported: 2013-01-24 11:38 UTC by Vladimir Voskresensky
Modified: 2014-02-17 14:44 UTC (History)
7 users (show)

See Also:
Issue Type: DEFECT
Exception Reporter: 197942

nps snapshot (41.92 KB, application/nps)
2013-01-24 11:38 UTC, Vladimir Voskresensky
nps snapshot (53.51 KB, application/nps)
2013-01-28 12:16 UTC, Alexander Simon
nps snapshot (48.87 KB, application/nps)
2013-01-28 16:46 UTC, sarmiste

Note You need to log in before you can comment on or make changes to this bug.
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

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$       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
                                                                34 319 ms
org.netbeans.api.project.ProjectManager.createProject()         34 319 ms	                                        31 293 ms[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.