abdera-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Garrett Rooney" <roo...@electricjellyfish.net>
Subject Re: Adding "ParseException" to entry.setContent()
Date Mon, 02 Apr 2007 13:45:47 GMT
On 3/31/07, Adam Constabaris <adam@clownsinmycoffee.net> wrote:
> Issue:
>
> Entry.setContent does not declare any exceptions, and FOMParser swallows
> exception when setContent is called with an X(HT)?ML content type and
> non well-formed X(HT)?ML content.
>
> Proposed Solution:
>
> Create org.apache.abdera.model.InvalidContentException as a
> RuntimeException and add the throws declaration to the javadoc for the
> Entry.setContent() methods; have the FOMParser throw the new exception
> (or a subclass thereof) when it encounters bad content.  Unchecked to
> allow for client code flexibility, since parsing exceptions aren't
> appropriate for all content types and ... "backward compilability" of
> existing client code =)
>
> I'm willing to create a patch if this approach seems like a reasonable one.

I played around with this on the plane yesterday, and it's not that
bad.  I didn't get far enough to generate anything really useful, but
the one thing that tripped me up at first was that exceptions in this
kind of situation don't get thrown when we call _parse(), it's
actually later, when we call setValueElement(), which surprised me at
first.  We've also already got a ParseException which seems to already
be a runtime exception, so we could just use that instead of bothering
with a new one.

-garrett

Mime
View raw message