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.
Summary: | bad characters in TLD comments make taglibraries unreadable, lose data | ||
---|---|---|---|
Product: | javaee | Reporter: | sgleason <sgleason> |
Component: | Code | Assignee: | sgleason <sgleason> |
Status: | VERIFIED FIXED | ||
Severity: | blocker | ||
Priority: | P1 | ||
Version: | 3.x | ||
Hardware: | All | ||
OS: | All | ||
Issue Type: | DEFECT | Exception Reporter: |
Description
sgleason
2002-07-19 23:38:56 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). 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. 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 *** Issue 28192 has been marked as a duplicate of this issue. *** 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. Verified in NetBeans dev build 200302220100. *** Issue 25173 has been marked as a duplicate of this issue. *** |