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 145545 - Cannot load form after setting a JPasswordField echoChar to character zero (\u0000)
Summary: Cannot load form after setting a JPasswordField echoChar to character zero (\...
Status: NEW
Alias: None
Product: guibuilder
Classification: Unclassified
Component: Code (show other bugs)
Version: 6.x
Hardware: All Linux
: P3 blocker (vote)
Assignee: issues@guibuilder
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2008-08-29 10:32 UTC by didgeridoo
Modified: 2009-05-25 20:57 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 didgeridoo 2008-08-29 10:32:52 UTC
Cannot load form after setting a JPasswordField echoChar to \u0000.

Steps to reproduce:

- Create a new JPanel form.
- Add a JPasswordField in the Design view.
- Set the password fields "echoChar" value to \u0000 in the design view
- Save and Close the form
- Open the form in design view again.


After setting the value the form contains the following code:

    <Component class="javax.swing.JPasswordField" name="jPasswordField1">
      <Properties>
        <Property name="text" type="java.lang.String" value="jPasswordField1"/>
        <Property name="echoChar" type="char" value="&#x0;"/>
      </Properties>
    </Component>

Opening the form cannot handle the value "&#x0;".
Comment 1 Peter Pis 2008-08-29 15:24:09 UTC
Reassigning to form.
Comment 2 didgeridoo 2008-09-04 13:29:16 UTC
This error occurs in Netbeans 6.5 Beta (GUI Builder 1.2) and Netbeans 6.1 (GUI Builder 1.1.1)
Comment 3 Jiri Vagner 2008-09-08 14:40:26 UTC
Reproducible

Designer correctly saved char '\u0000' into XML form file. This value is stored using unicode character entity with code
in hexadecimal form. Designer throws following exception while we are trying to parse xml form file using
org.openide.xml.XMLUtil.parse() ...

org.xml.sax.SAXParseException: Character reference "&#x0" is an invalid XML character.
        at com.sun.org.apache.xerces.internal.parsers.DOMParser.parse(DOMParser.java:239)
        at com.sun.org.apache.xerces.internal.jaxp.DocumentBuilderImpl.parse(DocumentBuilderImpl.java:283)
        at org.openide.xml.XMLUtil.parse(XMLUtil.java:337)
        at org.netbeans.modules.form.GandalfPersistenceManager.canLoadForm(GandalfPersistenceManager.java:259)
        at org.netbeans.modules.form.FormEditor.recognizeForm(FormEditor.java:446)

All "control" codes x00-1f failed, x20-... works.
Comment 4 Jiri Vagner 2008-09-09 09:44:41 UTC
...There are certain characters that are forbidden from being in XML as per the official specification
(http://www.w3.org/TR/REC-xml/#charsets). These characters are the low ascii characters such as NULL, EOF etc. Its
important to note that this is not a case of unescaped/unencoded versions of this character being disallowed, the
encoded characters are also disallowed. ... (http://blog.cwa.me.uk/2007/10/01/invalid-xml-from-a-net-web-service/)

We should use CDDATA element or external own entity definition to save these chars into xml.