commons-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From sebb <seb...@gmail.com>
Subject Re: NNTPClient.retrieveArticleBody returns MalformedServerReplyException
Date Mon, 26 Mar 2012 18:14:03 GMT
On 26 March 2012 15:23, Thufir <hawat.thufir@gmail.com> wrote:
> On 03/26/2012 06:06 AM, sebb wrote:
>>
>> Try NNTPClient.retrieveArticle(long articleNumber, ArticleInfo
>> pointer)  and NNTPClient.retrieveArticle(long articleNumber)
>
>
> Both of those return with MalformedServerReplyException for me, as before.
>
> I notice that Article API says, about Article, that:
>
> This is a class that contains the basic state needed for message retrieval
> and threading. With thanks to Jamie Zawinski
> https://commons.apache.org/net/api-3.1/org/apache/commons/net/nntp/Article.html
>
> So, the message body is not in the Article, I don't think.

I did not write that it was.

> Maybe I'm
> misunderstanding the docs.  My reading is that some variant of
> NNTPClient.retrieveBody will return the body.

Yes.

> However, there's a note that:
>
> "A DotTerminatedMessageReader is returned from which the article can be
> read. If the article does not exist, null is returned.
>
> You must not issue any commands to the NNTP server (i.e., call any other
> methods) until you finish reading the message from the returned
> BufferedReader instance. The NNTP protocol uses the same stream for issuing
> commands as it does for returning results. Therefore the returned
> BufferedReader actually reads directly from the NNTP connection. After the
> end of message has been reached, new commands can be executed and their
> replies read. If you do not follow these requirements, your program will not
> work properly. "
>
> throughout the NNTPClient documentation, for many methods.
>
> That being said, there are zero examples of retrieving the message body.
>  Maybe it's a completely different approach then retrieving Articles?

As I already wrote, use NNTPClient.retrieveArticle(long articleNumber).

I tried using it with news.gmane.org and it worked fine.

See the sample app I created recently:

https://svn.apache.org/repos/asf/commons/proper/net/trunk/src/main/java/examples/nntp/ArticleReader.java

This will be added to the site when it is next updated.


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

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


Mime
View raw message