commons-issues mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Bas (JIRA)" <j...@apache.org>
Subject [jira] Issue Comment Edited: (NET-373) NNTP Listgroups not working as expected with payserver envronment
Date Tue, 15 Mar 2011 13:51:29 GMT

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

Bas edited comment on NET-373 at 3/15/11 1:49 PM:
--------------------------------------------------

so I do need to update my svn rep?
I will give you a different output when using no pattern at all!

As you can see I have disabled the first newsgroup listening. In that case the second is running
proberly. However still only 31 groups are listed. My server has more than 1000, that I know
for sure...

So what I see is that when running the 2 independand commands the server gives me the IO

Code:

{code:title=Bar.java|borderStyle=solid}
/*
 * 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());
            }
            //client.iterateNewsgroupListing();
                   
            int 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}

Output (1 function):

{noformat}
201 reader.xsnews.nl (frontend-F05-04) Server Ready - support@xsnews.nl
AUTHINFO USER yyyyyyyy
381 PASS required
AUTHINFO PASS yyyyyyyy
281 Ok
Authentication succeeded
LIST ACTIVE 
215 Newsgroups in form "group high low flags".

!
!!!
!vaux23
"
"0.test
":
"Phyllis
"alt.binaries.boneless
"alt.binaries.multimedia
"alt.binaries.multimedia.erotica
"alt.binaries.multimedia.erotica.lesbians
"alt.binaries.multimedia.scifi;
"alt.binaries.sounds.mp3.lounge
"alt.binaries.sounds.mp3.reggae
"alt.binaries.tv.canadian
"alt.internet
"alt.politics
"alt.religion.christian.east
"webstump+urcm-noack@chiark.greenend.org.uk"
#alt.binaries.department.pron
(
(analog-island@t-online.de
(cross
*
*.binaries.*
+a.uninarch
-
--
------------------
-adams
31
{noformat}

Output both functions:

{noformat}
201 reader.xsnews.nl (frontend-E06-02) Server Ready - support@xsnews.nl
AUTHINFO USER yyyyyyy
381 PASS required
AUTHINFO PASS yyyyyyyyy
281 Ok
Authentication succeeded
LIST ACTIVE 
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 000000000000808 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 000000022953499 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 
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:91)
	at Testing_NNTP.main(Testing_NNTP.java:25)
{noformat}

      was (Author: tudstudent):
    so I do need to update my svn rep?
I will give you a different output when using no pattern at all!

As you can see I have disabled the first newsgroup listening. In that case the second is running
proberly. However still only 31 groups are listed. My server has more than 1000, that I know
for sure...

So what I see is that when running the 2 independand commands the server gives me the IO

Code:

{code:title=Bar.java|borderStyle=solid}
/*
 * 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());
            }
            //client.iterateNewsgroupListing();
            
        /**    try
            {
            Thread.sleep(60000); // do nothing for 1000 miliseconds (1 second)
            }
            catch(InterruptedException e)
            {
            e.printStackTrace();
            }

            
            int j = 0;
            try {
                for(String s : client.iterateNewsgroupListing(pattern)) {
                    j++;
                    System.out.println(s);
                }
            } catch (IOException e1) {
                e1.printStackTrace();
            }
            System.out.println(j);
*/
            int 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}

Output (1 function):

{noformat}
201 reader.xsnews.nl (frontend-F05-04) Server Ready - support@xsnews.nl
AUTHINFO USER yyyyyyyy
381 PASS required
AUTHINFO PASS yyyyyyyy
281 Ok
Authentication succeeded
LIST ACTIVE 
215 Newsgroups in form "group high low flags".

!
!!!
!vaux23
"
"0.test
":
"Phyllis
"alt.binaries.boneless
"alt.binaries.multimedia
"alt.binaries.multimedia.erotica
"alt.binaries.multimedia.erotica.lesbians
"alt.binaries.multimedia.scifi;
"alt.binaries.sounds.mp3.lounge
"alt.binaries.sounds.mp3.reggae
"alt.binaries.tv.canadian
"alt.internet
"alt.politics
"alt.religion.christian.east
"webstump+urcm-noack@chiark.greenend.org.uk"
#alt.binaries.department.pron
(
(analog-island@t-online.de
(cross
*
*.binaries.*
+a.uninarch
-
--
------------------
-adams
31
{noformat}

Output both functions:

{noformat}
201 reader.xsnews.nl (frontend-E06-02) Server Ready - support@xsnews.nl
AUTHINFO USER yyyyyyy
381 PASS required
AUTHINFO PASS yyyyyyyyy
281 Ok
Authentication succeeded
LIST ACTIVE 
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 000000000000808 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 000000022953499 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 
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:91)
	at Testing_NNTP.main(Testing_NNTP.java:25)
{noformat}
  
> NNTP Listgroups not working as expected with payserver envronment
> -----------------------------------------------------------------
>
>                 Key: NET-373
>                 URL: https://issues.apache.org/jira/browse/NET-373
>             Project: Commons Net
>          Issue Type: Bug
>          Components: NNTP
>    Affects Versions: 3.0
>         Environment: Eclipse Build id: 20110218-0911
>            Reporter: Bas
>              Labels: ioexception, java, listnewsgroups, nntp, nntpclient
>
> 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

Mime
View raw message