You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@commons.apache.org by mv...@apache.org on 2006/01/30 23:27:46 UTC

svn commit: r373612 - /jakarta/commons/dormant/feedparser/trunk/src/java/org/apache/commons/feedparser/RSSFeedParser.java

Author: mvdb
Date: Mon Jan 30 14:27:44 2006
New Revision: 373612

URL: http://svn.apache.org/viewcvs?rev=373612&view=rev
Log:
In using the feedparser API I've encountered a number of RSS feeds that are
missing the lenght attribute for enclosures. This causes feedparser to throw a
NPE. The standard does say that length is a required element, but in practice
it's being ignored.

Applied bugzilla issue 38225.
Thanx Andrew McCall andrew.mccall at goroam.net

Modified:
    jakarta/commons/dormant/feedparser/trunk/src/java/org/apache/commons/feedparser/RSSFeedParser.java

Modified: jakarta/commons/dormant/feedparser/trunk/src/java/org/apache/commons/feedparser/RSSFeedParser.java
URL: http://svn.apache.org/viewcvs/jakarta/commons/dormant/feedparser/trunk/src/java/org/apache/commons/feedparser/RSSFeedParser.java?rev=373612&r1=373611&r2=373612&view=diff
==============================================================================
--- jakarta/commons/dormant/feedparser/trunk/src/java/org/apache/commons/feedparser/RSSFeedParser.java (original)
+++ jakarta/commons/dormant/feedparser/trunk/src/java/org/apache/commons/feedparser/RSSFeedParser.java Mon Jan 30 14:27:44 2006
@@ -297,7 +297,9 @@
         String type = element.getAttributeValue( "type" );
         String href = element.getAttributeValue( "url" );
         String title = null;
-        long length = Integer.parseInt( element.getAttributeValue( "length" ) );
+        long length = 0;
+        if (element.getAttributeValue("length") != null)
+        	length = Integer.parseInt( element.getAttributeValue( "length" ) );
 
         linkFeedParserListener.onLink( state,
                                        rel,



---------------------------------------------------------------------
To unsubscribe, e-mail: commons-dev-unsubscribe@jakarta.apache.org
For additional commands, e-mail: commons-dev-help@jakarta.apache.org