You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@commons.apache.org by Diego Peroni <di...@vodafone.it> on 2011/05/11 18:08:26 UTC

feedparser little bugfix

Hi,

I've fixed a bug in org.apache.commons.feedparser.MetaFeedParser.java to 
allow correct date parsing in case of presence of white spaces before or 
after the date string.

        try {
             //ok.  Support dc:date
             //String v = state.current.getChildText( name, ns );
             String v = state.current.getChild( name, ns 
).getTextTrim(); // fix
     		
             if ( v != null ) {

                 Date d = null;
                 if ( ISO8601 ) {
                     d = ISO8601DateParser.parse( v );
                 } else {
                     d = RFC822DateParser.parse( v );
                 }

                 listener.onCreated( state, d );
                 listener.onCreatedEnd();

                 return true;
             }
         } catch ( Throwable t ) {
             // ignore the exception, so we can just move on
         }

         return false;

     }


Best regards
Diego Peroni

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


Re: feedparser little bugfix

Posted by Henri Yandell <fl...@gmail.com>.
Bear in mind however that feedparser is in 'Dormant' (meaning not
being worked on). I doubt it's likely to become active again.

Hen

On Wed, May 11, 2011 at 9:55 AM, sebb <se...@gmail.com> wrote:
> On 11 May 2011 17:08, Diego Peroni <di...@vodafone.it> wrote:
>> Hi,
>>
>> I've fixed a bug in org.apache.commons.feedparser.MetaFeedParser.java to
>> allow correct date parsing in case of presence of white spaces before or
>> after the date string.
>
> Bugs should normally be reported via JIRA issues please.
>
> http://commons.apache.org/dormant/feedparser/issue-tracking.html
>
> This means they are less likely to be forgotten.
>
>>       try {
>>            //ok.  Support dc:date
>>            //String v = state.current.getChildText( name, ns );
>>            String v = state.current.getChild( name, ns ).getTextTrim(); //
>> fix
>>
>>            if ( v != null ) {
>>
>>                Date d = null;
>>                if ( ISO8601 ) {
>>                    d = ISO8601DateParser.parse( v );
>>                } else {
>>                    d = RFC822DateParser.parse( v );
>>                }
>>
>>                listener.onCreated( state, d );
>>                listener.onCreatedEnd();
>>
>>                return true;
>>            }
>>        } catch ( Throwable t ) {
>>            // ignore the exception, so we can just move on
>>        }
>>
>>        return false;
>>
>>    }
>>
>>
>> Best regards
>> Diego Peroni
>>
>> ---------------------------------------------------------------------
>> To unsubscribe, e-mail: dev-unsubscribe@commons.apache.org
>> For additional commands, e-mail: dev-help@commons.apache.org
>>
>>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: dev-unsubscribe@commons.apache.org
> For additional commands, e-mail: dev-help@commons.apache.org
>
>

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


Re: feedparser little bugfix

Posted by sebb <se...@gmail.com>.
On 11 May 2011 17:08, Diego Peroni <di...@vodafone.it> wrote:
> Hi,
>
> I've fixed a bug in org.apache.commons.feedparser.MetaFeedParser.java to
> allow correct date parsing in case of presence of white spaces before or
> after the date string.

Bugs should normally be reported via JIRA issues please.

http://commons.apache.org/dormant/feedparser/issue-tracking.html

This means they are less likely to be forgotten.

>       try {
>            //ok.  Support dc:date
>            //String v = state.current.getChildText( name, ns );
>            String v = state.current.getChild( name, ns ).getTextTrim(); //
> fix
>
>            if ( v != null ) {
>
>                Date d = null;
>                if ( ISO8601 ) {
>                    d = ISO8601DateParser.parse( v );
>                } else {
>                    d = RFC822DateParser.parse( v );
>                }
>
>                listener.onCreated( state, d );
>                listener.onCreatedEnd();
>
>                return true;
>            }
>        } catch ( Throwable t ) {
>            // ignore the exception, so we can just move on
>        }
>
>        return false;
>
>    }
>
>
> Best regards
> Diego Peroni
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: dev-unsubscribe@commons.apache.org
> For additional commands, e-mail: dev-help@commons.apache.org
>
>

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