You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@commons.apache.org by "Bas (JIRA)" <ji...@apache.org> on 2011/03/15 21:46:29 UTC

[jira] Commented: (NET-373) NNTP Listgroups not working - broken server implementation

    [ https://issues.apache.org/jira/browse/NET-373?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13007166#comment-13007166 ] 

Bas commented on NET-373:
-------------------------

What would be the best to handle this from this point in time?

> NNTP Listgroups not working - broken server implementation
> ----------------------------------------------------------
>
>                 Key: NET-373
>                 URL: https://issues.apache.org/jira/browse/NET-373
>             Project: Commons Net
>          Issue Type: Improvement
>          Components: NNTP
>    Affects Versions: 3.0
>         Environment: Eclipse Build id: 20110218-0911
>            Reporter: Bas
>              Labels: ioexception, java, listnewsgroups, nntp, nntpclient
>         Attachments: Bar.java, listing.txt
>
>
> In addition to NET-276 I tried to get all newsgroups from my server with the example script. Unfortunately I got with underneath code the following error:
> As can be imagined this is a pay server so it has more than 31 groups. Unfortunately I have no idea how to get those printed underneath, probably also a bug!
> {noformat:title=Output| borderStyle=dashed| borderColor=#ccc| titleBGColor=#F7D6C1| bgColor=#FFFFCE} 
> 201 reader.xsnews.nl (frontend-F04-05) Server Ready - support@xsnews.nl
> AUTHINFO USER *******
> 381 PASS required
> AUTHINFO PASS *********
> 281 Ok
> Authentication succeeded
> LIST ACTIVE alt.fan.*
> 215 Newsgroups in form "group high low flags".
>  000000000000000 000000000000000 y
> ! 000000000000023 000000000000001 y
> !!! 000000000000001 000000000000001 y
> !vaux23 000000000000001 000000000000001 y
> " 000000000000001 000000000000001 y
> "0.test 000000000000001 000000000000001 y
> ": 000000000000001 000000000000001 y
> "Phyllis 000000000000001 000000000000001 y
> "alt.binaries.boneless 000000000001053 000000000001002 y
> "alt.binaries.multimedia 000000000002422 000000000000004 y
> "alt.binaries.multimedia.erotica 000000000000001 000000000000001 y
> "alt.binaries.multimedia.erotica.lesbians 000000000000002 000000000000001 y
> "alt.binaries.multimedia.scifi; 000000000000001 000000000000001 y
> "alt.binaries.sounds.mp3.lounge 000000000000001 000000000000001 y
> "alt.binaries.sounds.mp3.reggae 000000000000001 000000000000001 y
> "alt.binaries.tv.canadian 000000000000002 000000000000001 y
> "alt.internet 000000000000001 000000000000001 y
> "alt.politics 000000000000002 000000000000001 y
> "alt.religion.christian.east 000000000000001 000000000000001 y
> "webstump+urcm-noack@chiark.greenend.org.uk" 000000000000001 000000000000001 y
> #alt.binaries.department.pron 000000022885781 000000000000001 y
> ( 000000000000007 000000000000005 y
> (analog-island@t-online.de 000000000000001 000000000000001 y
> (cross 000000000000001 000000000000001 y
> * 000000000000006 000000000000006 y
> *.binaries.* 000000000000001 000000000000001 y
> +a.uninarch 000000000000353 000000000000353 y
> - 000000000000002 000000000000002 y
> -- 000000000000005 000000000000001 y
> ------------------ 000000000000004 000000000000002 y
> -adams 000000000000001 000000000000001 y
> 31
> LIST ACTIVE alt.fan.*
> 00000000000000 000000000000000 y
> java.io.IOException: 00000000000000 000000000000000 y
> 	at org.apache.commons.net.nntp.NNTPClient.iterateNewsgroupListing(NNTPClient.java:1043)
> 	at org.apache.commons.net.nntp.NNTPClient.iterateNewsgroups(NNTPClient.java:1059)
> 	at ListNewsgroups_1.main(ListNewsgroups_1.java:89)
> 	at Testing_NNTP.main(Testing_NNTP.java:25){panel}
> {noformat}
> Code:
> {code:title=Bar.java|borderStyle=solid}
> // Some comments here
> /*
>  * Licensed to the Apache Software Foundation (ASF) under one or more
>  * contributor license agreements.  See the NOTICE file distributed with
>  * this work for additional information regarding copyright ownership.
>  * The ASF licenses this file to You under the Apache License, Version 2.0
>  * (the "License"); you may not use this file except in compliance with
>  * the License.  You may obtain a copy of the License at
>  *
>  *      http://www.apache.org/licenses/LICENSE-2.0
>  *
>  * Unless required by applicable law or agreed to in writing, software
>  * distributed under the License is distributed on an "AS IS" BASIS,
>  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
>  * See the License for the specific language governing permissions and
>  * limitations under the License.
>  */
> //package examples.nntp;
> import java.io.IOException;
> import java.io.PrintWriter;
> import org.apache.commons.net.PrintCommandListener;
> import org.apache.commons.net.nntp.NNTPClient;
> import org.apache.commons.net.nntp.NewsgroupInfo;
> import javax.net.ssl.SSLSocketFactory;
> /***
>  * This is a trivial example using the NNTP package to approximate the
>  * Unix newsgroups command.  It merely connects to the specified news
>  * server and issues fetches the list of newsgroups stored by the server.
>  * On servers that store a lot of newsgroups, this command can take a very
>  * long time (listing upwards of 30,000 groups).
>  * <p>
>  ***/
> public final class ListNewsgroups_1
> {
>     public final static void main(String[] args)
>     {
>         if (args.length < 1)
>         {
>             System.err.println("Usage: newsgroups newsserver [pattern]");
>             return;
>         }
>         NNTPClient client = new NNTPClient();
>         client.addProtocolCommandListener(new PrintCommandListener(new PrintWriter(System.out)));
>         //String pattern = args.length >= 2 ? args[1] : "";
>         //String pattern = "";
>         String pattern = "alt.fan.*";
>         try
>         {
>             
>         	if (args[4] == "SSL")
>         	{
>         		client.setSocketFactory(SSLSocketFactory.getDefault());
>             } 
>         	else 
>         	{
>         		//factory = createSocket(host, port);
>             }
> 			client.connect(args[0],Integer.parseInt(args[3]));
> 			// AUTHINFO USER/AUTHINFO PASS
>             boolean success = client.authenticate(args[1], args[2]);
>             if (success) {
>                 System.out.println("Authentication succeeded");
>             } else {
>                 System.out.println("Authentication failed, error =" + client.getReplyString());
>             }
>             int j = 0;
>             try {
>                 for(String s : client.iterateNewsgroupListing(pattern)) {
>                     j++;
>                     System.out.println(s);
>                 }
>             } catch (IOException e1) {
>                 e1.printStackTrace();
>             }
>             System.out.println(j);
>             j = 0;
>             for(NewsgroupInfo n : client.iterateNewsgroups(pattern)) {
>                 j++;
>                 System.out.println(n.getNewsgroup());
>             }
>             System.out.println(j);
>         }
>         catch (IOException e)
>         {
>             e.printStackTrace();
>         }
>         finally
>         {
>             try
>             {
>                 if (client.isConnected())
>                     client.disconnect();
>             }
>             catch (IOException e)
>             {
>                 System.err.println("Error disconnecting from server.");
>                 e.printStackTrace();
>                 System.exit(1);
>             }
>         }
>     }
> }
> {code} 
> If I missed something let me know and I will try to supply you with necessary data

--
This message is automatically generated by JIRA.
For more information on JIRA, see: http://www.atlassian.com/software/jira