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 47063 - #47063: typo in MIMEResolverImpl.java affecting optional MIME-type parameters
Summary: #47063: typo in MIMEResolverImpl.java affecting optional MIME-type parameters
Status: CLOSED FIXED
Alias: None
Product: platform
Classification: Unclassified
Component: -- Other -- (show other bugs)
Version: 3.x
Hardware: All All
: P3 blocker (vote)
Assignee: rmatous
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2004-08-10 19:49 UTC by amoeba
Modified: 2008-12-22 21:56 UTC (History)
2 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 amoeba 2004-08-10 19:49:45 UTC
In the code for
/org/netbeans/core/filesystems/MIMEResolverImpl.java
 version 1.14, I found what looks like a typo in
the following lines:

   int l = s.indexOf(';');
   if (i>=0) s = s.substring(0, l-1);

In that second line, the variable 'i' probably is
a typo for 'l'

This is code that supposedly trims optional
parameters out of Strings representing MIME types
Comment 1 Jesse Glick 2004-08-16 17:44:03 UTC
Since pkuzel's version 1.2, no less! The code is clearly wrong. The
condition will always be true. If there is no ';' in s,
s.substring(0,-2) will be called, which cannot be good - should throw
IndexOutOfBoundsException if it ever gets here. The only explanation I
have is that no one else ever tried putting <mime> inside <file>,
either in real life or in unit tests. Radek or Petr please try writing
a test that tries to do this, confirm that it doesn't work, fix the
typo, confirm that that makes it work.
Comment 2 rmatous 2004-08-23 16:09:11 UTC
Fixed.

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

/cvs/core/test/unit/src/org/netbeans/core/filesystems/MIMEResolverImplTest.java,
new revision: 1.9; previous revision: 1.8

/cvs/core/test/unit/src/org/netbeans/core/filesystems/code-fs.xml,v 
new revision: 1.3; previous revision: 1.2

/cvs/core/test/unit/src/org/netbeans/core/filesystems/data-fs.xml,v 
new revision: 1.3; previous revision: 1.2
Comment 3 Tomas Danek 2005-08-01 09:41:29 UTC
closing.