commons-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From d..@apache.org
Subject cvs commit: jakarta-commons/net/src/java/org/apache/commons/net/nntp NNTP.java NNTPClient.java
Date Sat, 19 Apr 2003 20:49:13 GMT
dfs         2003/04/19 13:49:13

  Modified:    net/src/java/org/apache/commons/net/nntp NNTP.java
                        NNTPClient.java
  Log:
  Changed package private variables _reader and _writer to protected
  variables _reader_ and _writer_ in response to Issue 17224 extensibility
  enhancement request.  Documented variables and added note that
  _connectAction_() initializes the variables.
  
  Revision  Changes    Path
  1.5       +26 -12    jakarta-commons/net/src/java/org/apache/commons/net/nntp/NNTP.java
  
  Index: NNTP.java
  ===================================================================
  RCS file: /home/cvs/jakarta-commons/net/src/java/org/apache/commons/net/nntp/NNTP.java,v
  retrieving revision 1.4
  retrieving revision 1.5
  diff -u -r1.4 -r1.5
  --- NNTP.java	26 Jan 2003 00:21:44 -0000	1.4
  +++ NNTP.java	19 Apr 2003 20:49:13 -0000	1.5
  @@ -123,11 +123,23 @@
       private StringBuffer __commandBuffer;
   
       boolean _isAllowedToPost;
  -    BufferedWriter _writer;
  -    BufferedReader _reader;
       int _replyCode;
       String _replyString;
   
  +    /**
  +     * Wraps {@link SocketClient#_input_}
  +     * to communicate with server.  Initialized by {@link #_connectAction_}.
  +     * All server reads should be done through this variable.
  +     */
  +    protected BufferedReader _reader_;
  +
  +    /**
  +     * Wraps {@link SocketClient#_output_}
  +     * to communicate with server.  Initialized by {@link #_connectAction_}.
  +     * All server reads should be done through this variable.
  +     */
  +    protected BufferedWriter _writer_;
  +
       /***
        * A ProtocolCommandSupport object used to manage the registering of
        * ProtocolCommandListeners and te firing of ProtocolCommandEvents.
  @@ -144,15 +156,15 @@
           setDefaultPort(DEFAULT_PORT);
           __commandBuffer = new StringBuffer();
           _replyString = null;
  -        _reader = null;
  -        _writer = null;
  +        _reader_ = null;
  +        _writer_ = null;
           _isAllowedToPost = false;
           _commandSupport_ = new ProtocolCommandSupport(this);
       }
   
       private void __getReply() throws IOException
       {
  -        _replyString = _reader.readLine();
  +        _replyString = _reader_.readLine();
   
           if (_replyString == null)
               throw new NNTPConnectionClosedException(
  @@ -184,14 +196,16 @@
   
       /***
        * Initiates control connections and gets initial reply, determining
  -     * if the client is allowed to post to the server.
  +     * if the client is allowed to post to the server.  Initializes
  +     * {@link #_reader_} and {@link #_writer_} to wrap
  +     * {@link SocketClient#_input_} and {@link SocketClient#_output_}.
        ***/
       protected void _connectAction_() throws IOException
       {
           super._connectAction_();
  -        _reader =
  +        _reader_ =
               new BufferedReader(new InputStreamReader(_input_));
  -        _writer =
  +        _writer_ =
               new BufferedWriter(new OutputStreamWriter(_output_));
           __getReply();
   
  @@ -231,8 +245,8 @@
       public void disconnect() throws IOException
       {
           super.disconnect();
  -        _reader = null;
  -        _writer = null;
  +        _reader_ = null;
  +        _writer_ = null;
           _replyString = null;
           _isAllowedToPost = false;
       }
  @@ -284,8 +298,8 @@
           }
           __commandBuffer.append(SocketClient.NETASCII_EOL);
   
  -        _writer.write(message = __commandBuffer.toString());
  -        _writer.flush();
  +        _writer_.write(message = __commandBuffer.toString());
  +        _writer_.flush();
   
           if (_commandSupport_.getListenerCount() > 0)
               _commandSupport_.fireCommandSent(command, message);
  
  
  
  1.4       +7 -7      jakarta-commons/net/src/java/org/apache/commons/net/nntp/NNTPClient.java
  
  Index: NNTPClient.java
  ===================================================================
  RCS file: /home/cvs/jakarta-commons/net/src/java/org/apache/commons/net/nntp/NNTPClient.java,v
  retrieving revision 1.3
  retrieving revision 1.4
  diff -u -r1.3 -r1.4
  --- NNTPClient.java	26 Jan 2003 00:21:44 -0000	1.3
  +++ NNTPClient.java	19 Apr 2003 20:49:13 -0000	1.4
  @@ -271,7 +271,7 @@
           BufferedReader reader;
           NewsgroupInfo tmp, info[];
   
  -        reader = new BufferedReader(new DotTerminatedMessageReader(_reader));
  +        reader = new BufferedReader(new DotTerminatedMessageReader(_reader_));
           // Start of with a big vector because we may be reading a very large
           // amount of groups.
           list = new Vector(2048);
  @@ -316,7 +316,7 @@
           if (pointer != null)
               __parseArticlePointer(getReplyString(), pointer);
   
  -        reader = new DotTerminatedMessageReader(_reader);
  +        reader = new DotTerminatedMessageReader(_reader_);
           return reader;
       }
   
  @@ -334,7 +334,7 @@
           if (pointer != null)
               __parseArticlePointer(getReplyString(), pointer);
   
  -        reader = new DotTerminatedMessageReader(_reader);
  +        reader = new DotTerminatedMessageReader(_reader_);
           return reader;
       }
   
  @@ -735,7 +735,7 @@
               return null;
   
           help = new StringWriter();
  -        reader = new DotTerminatedMessageReader(_reader);
  +        reader = new DotTerminatedMessageReader(_reader_);
           Util.copyReader(reader, help);
           reader.close();
           help.close();
  @@ -1030,7 +1030,7 @@
               return null;
   
           list = new Vector();
  -        reader = new BufferedReader(new DotTerminatedMessageReader(_reader));
  +        reader = new BufferedReader(new DotTerminatedMessageReader(_reader_));
   
           while ((line = reader.readLine()) != null)
               list.addElement(line);
  @@ -1125,7 +1125,7 @@
           if (!NNTPReply.isPositiveIntermediate(post()))
               return null;
   
  -        return new DotTerminatedMessageWriter(_writer);
  +        return new DotTerminatedMessageWriter(_writer_);
       }
   
   
  @@ -1134,7 +1134,7 @@
           if (!NNTPReply.isPositiveIntermediate(ihave(articleId)))
               return null;
   
  -        return new DotTerminatedMessageWriter(_writer);
  +        return new DotTerminatedMessageWriter(_writer_);
       }
   
   
  
  
  

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


Mime
View raw message