I noticed that sometimes RSS feeds do not have values for all their
attributes, even in the title and the link nodes.
When this occurs, it causes a stack trace in RSSPortlet getItems. The
problem is that the handling of the title and link nodes needs to be coded
the same way the description node is written, with a "not null" check
before gettting the node value. It should look like this:

    private Item[] getItems( NodeList items ) {
....
            for ( int j = 0; j < itemChildren.getLength(); ++j ) {


                Node child = itemChildren.item( j );

                if ( child.getNodeName().equals( "title" ) ) {
 +                   if (child.getFirstChild() != null) {
                          title = child.getFirstChild().getNodeValue();
                }

                if ( child.getNodeName().equals( "link" ) ) {
+                    if (child.getFirstChild() != null) {
                          link = child.getFirstChild().getNodeValue();
                }

                if ( child.getNodeName().equals( "description" ) ) {
                   if (child.getFirstChild() != null) {
                       description = child.getFirstChild().getNodeValue();
                    }
                }

            }
....
}


Carol



--
--------------------------------------------------------------
Please read the FAQ! <http://java.apache.org/faq/>
To subscribe:        [EMAIL PROTECTED]
To unsubscribe:      [EMAIL PROTECTED]
Archives and Other:  <http://java.apache.org/main/mail.html>
Problems?:           [EMAIL PROTECTED]

Reply via email to