[jboss-jira] [JBoss JIRA] Created: (GPD-131) XmlAdapter.getTextContent() appends null

Imran Naqvi (JIRA) jira-events at lists.jboss.org
Mon Aug 6 16:50:04 EDT 2007


XmlAdapter.getTextContent() appends null
----------------------------------------

                 Key: GPD-131
                 URL: http://jira.jboss.com/jira/browse/GPD-131
             Project: JBoss jBPM GPD
          Issue Type: Bug
            Reporter: Imran Naqvi
         Assigned To: Koen Aers


the getTextContent() method in XmlAdapter class. There should be a null check while getting the node value (this issue also comes up when you have nested configInfoElements). So the following method in XmlAdapter.java : 


protected String getTextContent() {
		StringBuffer buffer = new StringBuffer();
		NodeList list = getNode().getChildNodes();
		for (int i = 0; i < list.getLength(); i++) {
			buffer.append(list.item(i).getNodeValue());
		}
		return buffer.toString().trim();
	}
	 

should be changed to: 


protected String getTextContent() {
		StringBuffer buffer = new StringBuffer();
		NodeList list = getNode().getChildNodes();
		for (int i = 0; i < list.getLength(); i++) {
			String nodeValue = list.item(i).getNodeValue();
			if (nodeValue != null)
				buffer.append(nodeValue);
		}
		return buffer.toString().trim();
	}
	 


-- 
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators: http://jira.jboss.com/jira/secure/Administrators.jspa
-
For more information on JIRA, see: http://www.atlassian.com/software/jira

        



More information about the jboss-jira mailing list