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 29752 - (XML) File Types (MIME resolvers) do not handle case-insensitive OS's
Summary: (XML) File Types (MIME resolvers) do not handle case-insensitive OS's
Status: VERIFIED FIXED
Alias: None
Product: platform
Classification: Unclassified
Component: -- Other -- (show other bugs)
Version: 3.x
Hardware: PC Windows ME/2000
: P3 blocker (vote)
Assignee: rmatous
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2002-12-31 20:12 UTC by dnoyeB
Modified: 2008-12-22 19:48 UTC (History)
3 users (show)

See Also:
Issue Type: DEFECT
Exception Reporter:


Attachments
patched java file1 (20.99 KB, text/plain)
2003-02-14 17:01 UTC, dnoyeB
Details
Util.java - patched java file 2 (1.83 KB, text/plain)
2003-02-14 17:03 UTC, dnoyeB
Details
attempted patch file (2.51 KB, patch)
2003-02-14 22:36 UTC, dnoyeB
Details | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description dnoyeB 2002-12-31 20:12:52 UTC
I can not define XML as an XML Object extension so
that my files that end in XML will be seen as
proper XML files.  it is only allowing 'xml' but
will not allow the upper case 'XML' to be entered.

Perhaps the parsing should be case insensitive and
recognize both XML and xml as XML files???
Comment 1 mslama 2003-01-03 13:57:31 UTC
I tried it in Tools -> Options and it works fine. I have now "XML,
application/xml, text/xml, xml" value in "XML Objects" node,
"Extensions and MIME Types" property. My file "extras.XML" is
recognized as XML file. I am on Linux. I just added "XML" extension
either directly appended ",XML" to text of using dialog if you press
"..." button to invoke property editor. Is behaviour different on Win
2000? I tried dev build, 3.4 and last 3.4.1 build. All works for me.
Comment 2 mslama 2003-01-03 14:07:01 UTC
Yes you are right. It is not allowed on Windows but both "xml" and
"XML" are recognized as XML files. I think it is because Windows
filesystem is not case sensitive. Actually I do not know what code is
responsible for such difference. Is it enough or should I investigate
it further? Or are you using case sensitive file system under Windows?
Is it possible? You say that IDE does not recognize files with "XML"
extension as XML files. What filesystem is at your disk? For me it
works fine on Win 2000 on local disk (probably with FAT32).
Comment 3 dnoyeB 2003-01-03 19:13:46 UTC
Win2000 sp3
-ui com.sun.java.swing.plaf.windows.WindowsLookAndFeel
1.3.1_06

I gave a bad description.  It is recognized as a plain xml file, but
it is not recognized as the "ant" file it is, unless it has a
lowercase xml.  I just reverified this on my computer at work.
Comment 4 mslama 2003-01-06 13:09:23 UTC
AFAIK recognition of ant script is done by data loader in ant module.
So I reassign to ant module. Please ant module could you give us some
explanation?
Comment 5 David Konecny 2003-01-06 14:46:57 UTC
The problem (or limitation?) is in implementation of MIMEResolver. The
definition of <MIME-resolver> for Ant script contains "<ext
name="xml"/>" and implementation of MIMEResolver is case sensitive.
Therefore only files ending with ".xml" are accepted for MIME recognition.
Comment 6 Jesse Glick 2003-01-06 15:30:41 UTC
Agreed w/ David; MIMEResolverImpl.Type.accept should contain logic
similar to that in ExtensionList and automatically be insensitive to
case on OS's which do not grok file case: currently listed as Windows
+ OpenVMS, though ideally this would be controlled by some kind of
configuration elsewhere.
Comment 7 dnoyeB 2003-01-24 15:45:59 UTC
Soooo..  Its a matter of cut and paste code?
Comment 8 dnoyeB 2003-02-12 16:15:58 UTC
If you point me in the right direction, I will make the change myself
and hand it off to you.
Comment 9 David Konecny 2003-02-12 16:25:56 UTC
Cool!

Jesse mentioned relevant source code. The extension comparison is done in 
core/src/org.netbeans.core.filesystems.MIMEResolverImpl.Type.accept()

Example how correctly it is handled is for example in:
openide/src/org.openide.loaders.ExtensionList - search for
"CASE_INSENSITIVE".
Comment 10 dnoyeB 2003-02-14 15:22:23 UTC
Is their any way for me to run this code in the debugger? can I start
NB and connect the debugger to it???
Comment 11 David Konecny 2003-02-14 15:31:13 UTC
Check <http://debuggercore.netbeans.org/> - there are two useful docs:
* How to debug NetBeans
* How to debug an application by attaching to it from NetBeans

I'm debugging NB from time to time and it works fine.
Comment 12 dnoyeB 2003-02-14 16:59:21 UTC
Fixed against 3.4.1 release.  2 files.
org.netbeans.core.filesystems.MimeResolverImpl
org.netbeans.core.filesystems.Util

Comment 13 dnoyeB 2003-02-14 17:01:23 UTC
Created attachment 8968 [details]
patched java file1
Comment 14 dnoyeB 2003-02-14 17:03:11 UTC
Created attachment 8969 [details]
Util.java - patched java file 2
Comment 15 dnoyeB 2003-02-14 17:05:12 UTC
Need validation of this fix, expecially on non-windows platforms.
Comment 16 Jesse Glick 2003-02-14 17:08:55 UTC
dnoyeB - you probably want to read

http://www.netbeans.org/devhome/community/contrib-patches.html

Specifically, best format is one patch (can cover multiple files),
diff -u format (not changed copy of files), and relative to trunk
sources (not older files). Otherwise someone has to "reverse-engineer"
your submitted files to figure out what the patch is before it can be
used.
Comment 17 dnoyeB 2003-02-14 17:30:35 UTC
Yes, yes...I knew better but I didn't feel like checking out the whole
CVS thing...I suppose I'll do this now as an exercise since I have yet
to actually produce a patch file successfully.


...in progress...
Comment 18 dnoyeB 2003-02-14 17:31:29 UTC
I recall their was either some bug with the patch file creation from
netbeans, or I had to have checkin access to create the patch file
from the netbeans CVS.  do you know anything about that?
Comment 19 Jesse Glick 2003-02-14 19:04:48 UTC
I don't know anything about patch creation from inside NB. From the
command-line, you certainly don't need commit access. Just check out
the sources (or some of them), make changes, then run "cvs diff -u" to
get a patch.

If you were *adding* files then "cvs add" refuses to work on working
sources, even though you are not touching the repository. However
added files can be easily zipped up (cvs diff -N will include them if
they have been cvs add'ed). Or if you know the trick, get the effect
of cvs add directly: rather than

cvs add Foo.java

use (Unix syntax here)

echo /Foo.java/0/whenever// >> CVS/Entries
Comment 20 dnoyeB 2003-02-14 19:47:08 UTC
Ill use command line from dos prompt.  

The fix works but I'm dying trying to integrate in dev build.  For
some reason the core.jar I make is smaller than the core.jar with
today's (2/14/02) build.  Then when I put it in, 1/2 the modules get
mad.  So after I remove it, and restart, only 3 modules load and I
have like 2 menu items and am dead in the water :D

Does only the core's source affect the core's size, or are their files
creeping in from elsewhere I need to DL too?  What modules do I need?
I just got the ones the build process complained were not there.
Comment 21 dnoyeB 2003-02-14 19:56:48 UTC
all the class files in the downloaded build are bigger than the ones I
am building.  baffled.
Comment 22 dnoyeB 2003-02-14 22:36:45 UTC
Created attachment 8975 [details]
attempted patch file
Comment 23 David Konecny 2003-02-17 08:47:40 UTC
THANX! I skimed the patch and it looks good. I did not try it however.

One cosmetic comment: we are not using tab characters in the source code.
Comment 24 dnoyeB 2003-02-17 15:05:08 UTC
Cool.  I managed to turn on whitespace so to speak by changing the
color of it.  Is their a way to change the color of specific
whitespace characters?  In codewright each character gets a specific
visible char like a space is '~' and a tab is '_' or something like
that...

If I could tell at a glance I would have erased all the tab chars.
Comment 25 David Konecny 2003-02-17 15:23:54 UTC
I'm not aware of this feature in NB editor. I'm using external editor
for this. (scite)
Comment 26 rmatous 2003-02-20 14:23:16 UTC
Patch applied in trunk with tiny modifications.

/cvs/core/src/org/netbeans/core/filesystems/MIMEResolverImpl.java,v 
new revision: 1.11; previous revision: 1.10

/cvs/core/src/org/netbeans/core/filesystems/Util.java,v  <--  new
revision: 1.3; previous revision: 1.2
Comment 27 Marian Mirilovic 2005-07-13 13:20:09 UTC
closed