Bug in Text.append(String)

"Jack Punt" <[email protected]>
Newsgroups gmane.comp.java.jdom.general
Message-ID <CA671D6CB6CE464097A9EA0F13CD0804@blue>
This does the wrong thing when str = EMPTY_STRING
(dubious: should be str.equals("") since new String() != "")
but the real bug is that value=str; clears the old value instead of appending...

    public void append(String str) {
        String reason;

        if (str == null) {
            return;
        }
        if ((reason = Verifier.checkCharacterData(str)) != null) {
            throw new IllegalDataException(str, "character content", reason);
        }

        if (str == EMPTY_STRING)
             value = str;
        else value += str;
    }

_______________________________________________
To control your jdom-interest membership:
http://www.jdom.org/mailman/options/jdom-interest/[email protected]
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.