james-server-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Robert Burrell Donkin" <robertburrelldon...@gmail.com>
Subject Re: [mime4J] MessageSearcher...? [WAS Re: [Mime4J] getReader]
Date Sun, 09 Mar 2008 22:57:32 GMT
On Sun, Mar 9, 2008 at 10:01 PM, Noel J. Bergman <noel@devtech.com> wrote:
> Robert Burrell Donkin wrote:
>  > > > IMAP requires case-insensitive charset-aware searching of mail body
>  > > > parts (a bit of a PITA, i know and most likely slow). ATM the Mime4J
>  > > > pull parser has a getInputStream method but i plan to add a getReader
>  > > > method which will perform charset-aware content-decoding for text
>  > > > parts and return null for others (seems easier than throwing an
>  > > > exception but i'm willing to be talked out of this decision) since i
>  > > > think that this function may be generally useful.
>  I think that I'd rather we follow the example of other
>  getInputStream/getReader exemplars, and throw
>  java.io.UnsupportedEncodingException if it is called on a type for which a
>  Reader is not appropriate.

in the end, i decided that consistency was more important and elected
to throw the appropriate exception. so that's what the implementation
does. i don't really like having to catch runtime exceptions but it's
not unreasonable in this case.

>  > does the message searcher (which searches a mail for a particular
>  > sequence of characters)  sounds like something which might be
>  > generally useful addition to Mime4J?
>  Yes.  But what do you propose as the interface?  If I asked you to search
>  for SOMETEXT, what do I get back?  I might want a collection of [part,
>  first_offset]-tuples.  Less than that, and you would be discarding
>  information that you should already have, more than that and I would be
>  forcing you to do extra work that a given use case might not require.  On
>  the other hand, perhaps I just want to know about the first part in which
>  you find it, not all parts containing it.  And can I ask that you search
>  only headers or parts of only certain content-type(s)?
>  Point being that, yes, I'd like to have a search functionality, but I'd like
>  some discussion over the interface and supported use cases.  And if we don't
>  build this into an existing class, it could be a shared utility, rather than
>  leaving it as just an example for people to clone.

(as jukka posted) given getReader search is just a trivial pull parser
application. definitely not worth a major design exercise. probably
best as a worked example somewhere in the documentation.

- robert

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

View raw message