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 25847 - bad characters in TLD comments make taglibraries unreadable, lose data
Summary: bad characters in TLD comments make taglibraries unreadable, lose data
Status: VERIFIED FIXED
Alias: None
Product: javaee
Classification: Unclassified
Component: Code (show other bugs)
Version: 3.x
Hardware: All All
: P1 blocker (vote)
Assignee: sgleason
URL:
Keywords:
: 25173 28192 (view as bug list)
Depends on:
Blocks:
 
Reported: 2002-07-19 23:38 UTC by sgleason
Modified: 2010-01-12 02:05 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 sgleason 2002-07-19 23:38:56 UTC
null characters (ascii 0x0) are being inserted
into xml comments when TLD files are being 
read in. 

This shows up in the source editor as little
boxes at the end of each XML comment. 

This causes a problem when parsing TLD files
(which happens during initial reading and two-way
editing). The parser throws an exception
complaining about illegal chars in comments, and
then misses some XML tags. The result is that data
is lost from the TLDs, for example tags go awol,
the jsp version is set to null (I think this
caused a previously intermittent problem where the
version upgrade dialog came up unexpectedly).

basically, the tag library editor is unusable
because of this.
Comment 1 sgleason 2002-07-19 23:44:43 UTC
Investigation indicates that this bug is caused by an XML parser
difference in 3.4, together with  a not terribly wise use of one of
the parser APIs. 

in TaglibDocumentHandler, which implements the LexicalHandler
interface, there is a method
comment(chars[], start, length) intended to handle XML comments. The
current code converts the chars array to a String by using new
String(chars).  This assumes that the char array will be exactly the
same length of the string. This assumption proved correct on previous
parsers, but was a dangerous assumption to make. 

On the parser being used in 3.4, the chars array is usually longer
than the String, probably for a more efficent implementation. The
start and length parameters are used to figure out the correct string
length. 

The solution is to create the String using new String(chars,
start,length). 

  
Comment 2 sgleason 2002-07-23 19:08:55 UTC
fixed in release34. Fix in trunk will happen as side effect to change
to use the standard XML parser APIs instead of relying in xerces to 
get the parser. 
Comment 3 Ana.von Klopp 2002-08-28 06:11:01 UTC
I can reproduce this in NB3.4 RC2 by creating a new tag 
library as follows: 

1. Create a new web module. 
2. Select WEB-INF/classes
3. Create a new tag library. 
4. Create a new tag. 
5. Generate tag handlers. 
6. Inspect the TLD - it has the same characters. 

I'm using Win2K, JDK1.4.0


Comment 4 _ rkubacki 2002-10-24 07:27:39 UTC
*** Issue 28192 has been marked as a duplicate of this issue. ***
Comment 5 sgleason 2002-10-24 23:10:21 UTC
I committed the fix that handles comment strings properly, 
along with changes that remove the dependency on the xerces
parser, but instead use the org.openide.xml.XMLUtil factory APIs to
  get an XMLReader.
Comment 6 Jason Rush 2003-02-21 10:39:04 UTC
Verified in NetBeans dev build 200302220100.
Comment 7 sgleason 2003-02-28 23:05:58 UTC
*** Issue 25173 has been marked as a duplicate of this issue. ***