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 121135 - FileEncoding query should be optained before open stream in
Summary: FileEncoding query should be optained before open stream in
Status: RESOLVED FIXED
Alias: None
Product: platform
Classification: Unclassified
Component: Data Systems (show other bugs)
Version: 6.x
Hardware: Sun Solaris
: P2 blocker (vote)
Assignee: Jaroslav Tulach
URL:
Keywords:
Depends on:
Blocks: 121004
  Show dependency tree
 
Reported: 2007-11-04 23:23 UTC by Nam Nguyen
Modified: 2008-12-22 10:52 UTC (History)
5 users (show)

See Also:
Issue Type: DEFECT
Exception Reporter:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Nam Nguyen 2007-11-04 23:23:17 UTC
It is currently called from inside DataEditorSupport.saveFromKitToStream (about line 368) which prevent implementation
of MIME-based FileEncodingQueryImplementation due File

Please refer to the stack trace in issue 121004 for more info.
Comment 1 Jaroslav Tulach 2007-11-05 08:49:01 UTC
I guess my task is to solve this exception:

org.netbeans.modules.masterfs.filebasedfs.utils.FSException: Cannot get shared access to
/hudson/workdir/jobs/trunk/workspace/visualweb/test/work/projects/SanityProject/SanityProject/web/WEB-INF/faces-config.xml
(probably opened for writing).
org.netbeans.modules.masterfs.filebasedfs.utils.FSException.io(FSException.java:125)
org.netbeans.modules.masterfs.filebasedfs.fileobjects.MutualExclusionSupport.addResource(MutualExclusionSupport.java:97)
org.netbeans.modules.masterfs.filebasedfs.fileobjects.FileObj.getInputStream(FileObj.java:129)
Caused: java.io.FileNotFoundException
org.netbeans.modules.masterfs.filebasedfs.fileobjects.FileObj.getInputStream(FileObj.java:154)
org.openide.filesystems.MIMESupport$CachedFileObject.getInputStream(MIMESupport.java:284)
org.netbeans.core.filesystems.MIMEResolverImpl$Type.accept(MIMEResolverImpl.java:583)
org.netbeans.core.filesystems.MIMEResolverImpl$Type.access$1400(MIMEResolverImpl.java:458)
[catch] at org.netbeans.core.filesystems.MIMEResolverImpl$FileElement.resolve(MIMEResolverImpl.java:425)
org.netbeans.core.filesystems.MIMEResolverImpl$FileElement.access$100(MIMEResolverImpl.java:410)
org.netbeans.core.filesystems.MIMEResolverImpl$Impl.findMIMEType(MIMEResolverImpl.java:139)
org.openide.filesystems.MIMESupport$CachedFileObject.resolveMIME(MIMESupport.java:253)
org.openide.filesystems.MIMESupport$CachedFileObject.getMIMEType(MIMESupport.java:241)
org.openide.filesystems.MIMESupport.findMIMEType(MIMESupport.java:115)
org.openide.filesystems.FileUtil.getMIMETypeOrDefault(FileUtil.java:1004)
org.openide.filesystems.FileObject.getMIMEType(FileObject.java:489)
org.netbeans.modules.masterfs.MasterFileObject.getMIMEType(MasterFileObject.java:219)
org.netbeans.modules.xml.core.DefaultXmlFileEncodingQueryImpl.getEncoding(DefaultXmlFileEncodingQueryImpl.java:42)
org.netbeans.api.queries.FileEncodingQuery.getEncoding(FileEncodingQuery.java:91)
org.openide.text.DataEditorSupport.saveFromKitToStream(DataEditorSupport.java:368)
org.openide.text.CloneableEditorSupport$1SaveAsReader.run(CloneableEditorSupport.java:847)

I'll check what can be done in org.openide.text. However it seems to me that the root cause of the problem is in 
filesystems - one cannot ask for getMIMEType() while having open output stream. This is unfortunate, imho.
Comment 2 Jesse Glick 2007-11-05 09:24:40 UTC
BTW I suggested a more limited fix for issue #121004 (check only file extension) which would make this issue still
desirable but not necessary for 6.0.
Comment 3 Jaroslav Tulach 2007-11-05 09:43:27 UTC
IDE:-------------------------------------------------
IDE: [5.11.07 10:41] Committing started
Checking in test/unit/src/org/openide/text/DataEditorSupportTest.java;
/shared/data/ccvs/repository/openide/loaders/test/unit/src/org/openide/text/DataEditorSupportTest.java,v  <--  
DataEditorSupportTest.java
new revision: 1.11; previous revision: 1.10
done
Checking in test/unit/src/org/openide/text/DataEditorSupportSaveAsTest.java;
/shared/data/ccvs/repository/openide/loaders/test/unit/src/org/openide/text/DataEditorSupportSaveAsTest.java,v  <--  
DataEditorSupportSaveAsTest.java
new revision: 1.5; previous revision: 1.4
done
Checking in src/org/openide/text/DataEditorSupport.java;
/shared/data/ccvs/repository/openide/loaders/src/org/openide/text/DataEditorSupport.java,v  <--  
DataEditorSupport.java
new revision: 1.50; previous revision: 1.49
done
IDE: [5.11.07 10:42] Committing finished
Comment 4 Tomas Zezula 2007-11-05 10:48:00 UTC
Seems good, thanks Jardo.