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 16094 - Registering a new file extension in Tools|Options|... does not set the MIME for the extension
Summary: Registering a new file extension in Tools|Options|... does not set the MIME f...
Status: CLOSED INVALID
Alias: None
Product: editor
Classification: Unclassified
Component: -- Other -- (show other bugs)
Version: 3.x
Hardware: All All
: P3 blocker (vote)
Assignee: issues@editor
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2001-10-02 00:19 UTC by Sophie Deng
Modified: 2003-07-01 15:16 UTC (History)
0 users

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 Sophie Deng 2001-10-02 00:19:58 UTC
After adding an new extension in Tools|Options|IDE Configuration|System|Object
Types|..., the object will be recognized as the correct object type, however the
MIME type is not set for the extension. For example:

1. Create a new text file, with extension .mytxt.
2. Go to Tools|Options|IDE Configuration|System|Object Types|Textual Objects.
3. Bringup the property editor of the Extensions and MIME types, add "mytxt" to
the list.

The following methods still returns unknown MIME type for the file:
//fileobject is the fileobject of file test.mytxt
FileUtil.getMIMEType(fileobject) returns null
fileobject.getMIMEType() returns "content/unknown"
FileUtil.getMIMEType(fileobject.getExt()) returns null

These methods should return "text/plain" instead.
Comment 1 Petr Nejedly 2001-10-02 15:22:52 UTC
The option you mentioned is an option of the TxtLoader which tells
it which files to recognize as text files. It have nothing to do
with mime types except the TxtDataObject are edited by an editor
kit registered for text/plain mime type.
BTW: The option is in the text module, not in core.
Comment 2 Sophie Deng 2001-10-02 17:18:01 UTC
Thanks, I also had doubt about the bug category, just picked core as a
guess. Changed it to text. I still think this is a bug, the attribute
key is Extensions and MIME types, this leads the user to think it
registers the MIME with IDE as well. Furthermore, this causes problems
in Version Control System. It is recommended that VCS relies on the
MIME to determine whether a file is binary or text and conduct correct
VCS actions to it. I think all objects recognized by IDE should have
their MIME type set. BTW, there are some other object types also allow
the user to add new extensions to be recognized as certain types of
objects, e.g. jsp. They have the same problem as textual objects.
Comment 3 Jan Zajicek 2001-10-03 10:56:15 UTC
When changing the component, do not forget to change the qa contact
and assigned to fields too. Updating.
Comment 4 Petr Nejedly 2001-10-03 12:50:19 UTC
So it works very differently from your understanding.
the "Extensions and MIME types" means:
"Recognize all files with following extensions and all files
of the following MIME types as text objects".

It is in the different layer.

There are FileObjects on the filesystem
that have some filenames and that can be recognized as files
of some MIME type by MIMERecognizers or by mapping between
extension and mime type (FileUtil).

There are DataLoaders that recognize "their" FileObjects by some
recognition mechanism (some of them just compare extensions
or MIME types provided from the lower layer, some of them
parse the files e.g. to see whether the XML they see
is Ant build script, some do more magic) and provide a DataObject
for a FileObject or a set of FileObjects.

There are DataObjects that give more meaning to those FileObjects.

More cleanly: TxtDataObject doesn't mean that underlaying
FileObject is of type text/plain. It can be even more FileObjects.

The option you see is the option of TxtDataLoader which provides
DataObjects for recognized FileObjects. It doesn't modify/annotate
the FileObject at all, it may even be NOT ever asked to recognize
sepcific FileObject.

If you'd like to mark a FileObject for a file with some specific
extension as MIME text/plain, either put the mapping into FileUtil
or create a MIME resolver for it (Place a describing XML file
to System/MIMEResolvers, look at those in scripting module,
no UI for customizing them yet).

BTW: I think that every recognized file should have known MIME
type too, but it is the question of redesigning loaders architecture
for 4.0 I'm just thinking about.
Comment 5 Sophie Deng 2001-10-03 18:54:00 UTC
Thanks for the detailed explanation. I will file an Enhancement to
request that every recognized file should have known MIME type in NB
4.0, so that we won't lose the idea.
Comment 6 Quality Engineering 2003-07-01 15:15:00 UTC
Resolved for 3.3.x or earlier, no new info since then -> closing.
Comment 7 Quality Engineering 2003-07-01 15:16:47 UTC
Resolved for 3.4.x or earlier, no new info since then -> closing.