commons-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From s...@apache.org
Subject svn commit: r922748 [1/2] - in /commons/proper/net/branches/NET_2_0/src: main/java/examples/nntp/ main/java/org/apache/commons/net/ main/java/org/apache/commons/net/ftp/ main/java/org/apache/commons/net/ftp/parser/ main/java/org/apache/commons/net/io/ ...
Date Sun, 14 Mar 2010 03:23:18 GMT
Author: sebb
Date: Sun Mar 14 03:23:18 2010
New Revision: 922748

URL: http://svn.apache.org/viewvc?rev=922748&view=rev
Log:
Tab police

Modified:
    commons/proper/net/branches/NET_2_0/src/main/java/examples/nntp/NNTPUtils.java
    commons/proper/net/branches/NET_2_0/src/main/java/org/apache/commons/net/SocketClient.java
    commons/proper/net/branches/NET_2_0/src/main/java/org/apache/commons/net/ftp/FTP.java
    commons/proper/net/branches/NET_2_0/src/main/java/org/apache/commons/net/ftp/FTPSClient.java
    commons/proper/net/branches/NET_2_0/src/main/java/org/apache/commons/net/ftp/FTPSServerSocketFactory.java
    commons/proper/net/branches/NET_2_0/src/main/java/org/apache/commons/net/ftp/parser/DefaultFTPFileEntryParserFactory.java
    commons/proper/net/branches/NET_2_0/src/main/java/org/apache/commons/net/io/DotTerminatedMessageReader.java
    commons/proper/net/branches/NET_2_0/src/main/java/org/apache/commons/net/nntp/Threader.java
    commons/proper/net/branches/NET_2_0/src/main/java/org/apache/commons/net/smtp/SMTP.java
    commons/proper/net/branches/NET_2_0/src/main/java/org/apache/commons/net/util/SubnetUtils.java
    commons/proper/net/branches/NET_2_0/src/test/java/org/apache/commons/net/SubnetUtilsTest.java
    commons/proper/net/branches/NET_2_0/src/test/java/org/apache/commons/net/ftp/parser/UnixFTPEntryParserTest.java
    commons/proper/net/branches/NET_2_0/src/test/java/org/apache/commons/net/io/DotTerminatedMessageReaderTest.java

Modified: commons/proper/net/branches/NET_2_0/src/main/java/examples/nntp/NNTPUtils.java
URL: http://svn.apache.org/viewvc/commons/proper/net/branches/NET_2_0/src/main/java/examples/nntp/NNTPUtils.java?rev=922748&r1=922747&r2=922748&view=diff
==============================================================================
--- commons/proper/net/branches/NET_2_0/src/main/java/examples/nntp/NNTPUtils.java (original)
+++ commons/proper/net/branches/NET_2_0/src/main/java/examples/nntp/NNTPUtils.java Sun Mar 14 03:23:18 2010
@@ -29,91 +29,91 @@ import org.apache.commons.net.nntp.Artic
 import org.apache.commons.net.nntp.NNTPClient;
 
 /**
- * 
+ *
  * Some convenience methods for NNTP example classes.
- * 
+ *
  * @author Rory Winston <rwinston@checkfree.com>
  */
 public class NNTPUtils {
 
-	/**
-	 * Given an {@link NNTPClient} instance, and an integer range of messages, return 
-	 * an array of {@link Article} instances.
-	 * @param client 
-	 * @param lowArticleNumber
-	 * @param highArticleNumber
-	 * @return Article[] An array of Article
-	 * @throws IOException
-	 */
-	public  static List<Article> getArticleInfo(NNTPClient client, long lowArticleNumber, long highArticleNumber)
-	throws IOException {
-		Reader reader = null;
-		List<Article> articles = new ArrayList<Article>();
-		reader =
-			(DotTerminatedMessageReader) client.retrieveArticleInfo(
-					lowArticleNumber,
-					highArticleNumber);
-
-		if (reader != null) {
-			String theInfo = readerToString(reader);
-			StringTokenizer st = new StringTokenizer(theInfo, "\n");
-
-			// Extract the article information
-			// Mandatory format (from NNTP RFC 2980) is :
-			// Subject\tAuthor\tDate\tID\tReference(s)\tByte Count\tLine Count
-
-			int count = st.countTokens();
-			int index = 0;
-
-			while (st.hasMoreTokens()) {
-				String msg = st.nextToken();
-				System.out.println("Message:" + msg);
-				StringTokenizer stt = new StringTokenizer(msg, "\t");
-
-				try {
-					Article article = new Article();
-					article.setArticleNumber(Integer.parseInt(stt.nextToken()));
-					article.setSubject(stt.nextToken());
-					article.setFrom(stt.nextToken());
-					article.setDate(stt.nextToken());
-					article.setArticleId(stt.nextToken());
-					article.addHeaderField("References", stt.nextToken());
-					articles.add(article); 
-				}
-				catch (NoSuchElementException nse) {
-					// ignore this message
-				}
-			}
-		} else {
-			return null;
-		}
-
-		return articles;
-	}
-
-
-	/**
-	 * Convert a {@link Reader} instance to a String
-	 * @param reader The Reader instance
-	 * @return String
-	 */
-	public static String readerToString(Reader reader) {
-		String temp = null;
-		StringBuffer sb = null;
-		BufferedReader bufReader = new BufferedReader(reader);
-
-		sb = new StringBuffer();
-		try {
-			temp = bufReader.readLine();
-			while (temp != null) {
-				sb.append(temp);
-				sb.append("\n");
-				temp = bufReader.readLine();
-			}
-		} catch (IOException e) {
-			e.printStackTrace();
-		}
+    /**
+     * Given an {@link NNTPClient} instance, and an integer range of messages, return
+     * an array of {@link Article} instances.
+     * @param client
+     * @param lowArticleNumber
+     * @param highArticleNumber
+     * @return Article[] An array of Article
+     * @throws IOException
+     */
+    public  static List<Article> getArticleInfo(NNTPClient client, long lowArticleNumber, long highArticleNumber)
+    throws IOException {
+        Reader reader = null;
+        List<Article> articles = new ArrayList<Article>();
+        reader =
+            (DotTerminatedMessageReader) client.retrieveArticleInfo(
+                    lowArticleNumber,
+                    highArticleNumber);
+
+        if (reader != null) {
+            String theInfo = readerToString(reader);
+            StringTokenizer st = new StringTokenizer(theInfo, "\n");
+
+            // Extract the article information
+            // Mandatory format (from NNTP RFC 2980) is :
+            // Subject\tAuthor\tDate\tID\tReference(s)\tByte Count\tLine Count
+
+            int count = st.countTokens();
+            int index = 0;
+
+            while (st.hasMoreTokens()) {
+                String msg = st.nextToken();
+                System.out.println("Message:" + msg);
+                StringTokenizer stt = new StringTokenizer(msg, "\t");
+
+                try {
+                    Article article = new Article();
+                    article.setArticleNumber(Integer.parseInt(stt.nextToken()));
+                    article.setSubject(stt.nextToken());
+                    article.setFrom(stt.nextToken());
+                    article.setDate(stt.nextToken());
+                    article.setArticleId(stt.nextToken());
+                    article.addHeaderField("References", stt.nextToken());
+                    articles.add(article);
+                }
+                catch (NoSuchElementException nse) {
+                    // ignore this message
+                }
+            }
+        } else {
+            return null;
+        }
+
+        return articles;
+    }
+
+
+    /**
+     * Convert a {@link Reader} instance to a String
+     * @param reader The Reader instance
+     * @return String
+     */
+    public static String readerToString(Reader reader) {
+        String temp = null;
+        StringBuffer sb = null;
+        BufferedReader bufReader = new BufferedReader(reader);
+
+        sb = new StringBuffer();
+        try {
+            temp = bufReader.readLine();
+            while (temp != null) {
+                sb.append(temp);
+                sb.append("\n");
+                temp = bufReader.readLine();
+            }
+        } catch (IOException e) {
+            e.printStackTrace();
+        }
 
-		return sb.toString();
-	}
+        return sb.toString();
+    }
 }

Modified: commons/proper/net/branches/NET_2_0/src/main/java/org/apache/commons/net/SocketClient.java
URL: http://svn.apache.org/viewvc/commons/proper/net/branches/NET_2_0/src/main/java/org/apache/commons/net/SocketClient.java?rev=922748&r1=922747&r2=922748&view=diff
==============================================================================
--- commons/proper/net/branches/NET_2_0/src/main/java/org/apache/commons/net/SocketClient.java (original)
+++ commons/proper/net/branches/NET_2_0/src/main/java/org/apache/commons/net/SocketClient.java Sun Mar 14 03:23:18 2010
@@ -62,9 +62,9 @@ public abstract class SocketClient
     /** The default SocketFactory shared by all SocketClient instances. */
     private static final SocketFactory __DEFAULT_SOCKET_FACTORY =
             SocketFactory.getDefault();
-    
+
     /** The default {@link ServerSocketFactory} */
-    private static final ServerSocketFactory __DEFAULT_SERVER_SOCKET_FACTORY = 
+    private static final ServerSocketFactory __DEFAULT_SERVER_SOCKET_FACTORY =
             ServerSocketFactory.getDefault();
 
     /** The timeout to use after opening a socket. */
@@ -84,20 +84,20 @@ public abstract class SocketClient
 
     /** The socket's SocketFactory. */
     protected SocketFactory _socketFactory_;
-    
+
     /** The socket's ServerSocket Factory. */
     protected ServerSocketFactory _serverSocketFactory_;
-    
+
     /** The socket's connect timeout (0 = infinite timeout) */
     private static final int DEFAULT_CONNECT_TIMEOUT = 0;
     protected int connectTimeout = DEFAULT_CONNECT_TIMEOUT;
-    
+
     /** Hint for SO_RCVBUF size */
     int receiveBufferSize = -1;
-    
+
     /** Hint for SO_SNDBUF size */
     int sendBufferSize = -1;
-    
+
     /**
      * Default constructor for SocketClient.  Initializes
      * _socket_ to null, _timeout_ to 0, _defaultPort to 0,
@@ -203,7 +203,7 @@ public abstract class SocketClient
                         InetAddress localAddr, int localPort)
     throws SocketException, IOException
     {
-        _socket_ = _socketFactory_.createSocket();     
+        _socket_ = _socketFactory_.createSocket();
         if (receiveBufferSize != -1) _socket_.setReceiveBufferSize(receiveBufferSize);
         if (sendBufferSize != -1) _socket_.setSendBufferSize(sendBufferSize);
         _socket_.bind(new InetSocketAddress(localAddr, localPort));
@@ -304,7 +304,7 @@ public abstract class SocketClient
     {
         if (_socket_ == null)
             return false;
-        
+
         return _socket_.isConnected();
     }
 
@@ -377,25 +377,25 @@ public abstract class SocketClient
     {
         _socket_.setSoTimeout(timeout);
     }
-    
-    
+
+
     /**
      * Set the underlying socket send buffer size.
      * <p>
      * @param size The size of the buffer in bytes.
-     * @throws SocketException 
+     * @throws SocketException
      * @since 2.0
      */
     public void setSendBufferSize(int size) throws SocketException {
         sendBufferSize = size;
     }
-    
-    
+
+
     /**
      * Sets the underlying socket receive buffer size.
      * <p>
      * @param size The size of the buffer in bytes.
-     * @throws SocketException 
+     * @throws SocketException
      * @since 2.0
      */
     public void setReceiveBufferSize(int size) throws SocketException  {
@@ -439,31 +439,31 @@ public abstract class SocketClient
     {
         return _socket_.getTcpNoDelay();
     }
-    
+
     /**
      * Sets the SO_KEEPALIVE flag on the currently opened socket.
-     * 
-     * From the Javadocs, the default keepalive time is 2 hours (although this is 
+     *
+     * From the Javadocs, the default keepalive time is 2 hours (although this is
      * implementation  dependent). It looks as though the Windows WSA sockets implementation
-     * allows a specific keepalive value to be set, although this seems not to be the case on 
+     * allows a specific keepalive value to be set, although this seems not to be the case on
      * other systems.
      * @param  keepAlive If true, keepAlive is turned on
      * @throws SocketException
      */
     public void setKeepAlive(boolean keepAlive) throws SocketException {
-    	_socket_.setKeepAlive(keepAlive);
+        _socket_.setKeepAlive(keepAlive);
     }
-    
+
     /**
      * Returns the current value of the SO_KEEPALIVE flag on the currently opened socket.
-     * 
+     *
      * @return True if SO_KEEPALIVE is enabled.
      * @throws SocketException
      */
     public boolean getKeepAlive() throws SocketException {
-    	return _socket_.getKeepAlive();
+        return _socket_.getKeepAlive();
     }
-    
+
     /**
      * Sets the SO_LINGER timeout on the currently opened socket.
      * <p>
@@ -570,7 +570,7 @@ public abstract class SocketClient
         else
             _socketFactory_ = factory;
     }
-    
+
     /**
      * Sets the ServerSocketFactory used by the SocketClient to open ServerSocket
      * connections.  If the factory value is null, then a default
@@ -586,17 +586,17 @@ public abstract class SocketClient
         else
             _serverSocketFactory_ = factory;
     }
-    
+
     /**
      * Sets the connection timeout in milliseconds, which will be passed to the {@link Socket} object's
-     * connect() method. 
+     * connect() method.
      * @param connectTimeout The connection timeout to use (in ms)
      * @since 2.0
      */
     public void setConnectTimeout(int connectTimeout) {
         this.connectTimeout = connectTimeout;
     }
-    
+
     /**
      * Get the underlying socket connection timeout.
      * @return timeout (in ms)
@@ -611,10 +611,10 @@ public abstract class SocketClient
      * @return The server socket factory
      * @since 2.1
      */
-	public ServerSocketFactory getServerSocketFactory() {
-		return _serverSocketFactory_;
-	}
-	
+    public ServerSocketFactory getServerSocketFactory() {
+        return _serverSocketFactory_;
+    }
+
 }
 
 

Modified: commons/proper/net/branches/NET_2_0/src/main/java/org/apache/commons/net/ftp/FTP.java
URL: http://svn.apache.org/viewvc/commons/proper/net/branches/NET_2_0/src/main/java/org/apache/commons/net/ftp/FTP.java?rev=922748&r1=922747&r2=922748&view=diff
==============================================================================
--- commons/proper/net/branches/NET_2_0/src/main/java/org/apache/commons/net/ftp/FTP.java (original)
+++ commons/proper/net/branches/NET_2_0/src/main/java/org/apache/commons/net/ftp/FTP.java Sun Mar 14 03:23:18 2010
@@ -87,7 +87,7 @@ import org.apache.commons.net.SocketClie
  * <p>
  * <p>
  * @author Daniel F. Savarese
- * @author Rory Winston 
+ * @author Rory Winston
  * @author Joseph Hindsley
  * @see FTPClient
  * @see FTPConnectionClosedException
@@ -117,7 +117,7 @@ public class FTP extends SocketClient
      ***/
     public static final int EBCDIC_FILE_TYPE = 1;
 
-   
+
     /***
      * A constant used to indicate the file(s) being transfered should
      * be treated as a binary image, i.e., no translations should be
@@ -222,11 +222,11 @@ public class FTP extends SocketClient
     protected boolean _newReplyString;
     protected String _replyString;
     protected String _controlEncoding;
-    
+
     /**
      * This is used to signal whether a block of multiline responses beginning
      * with xxx must be terminated by the same numeric code xxx
-     * See section 4.2 of RFC 959 for details. 
+     * See section 4.2 of RFC 959 for details.
      */
     protected boolean strictMultilineParsing = false;
 
@@ -274,7 +274,7 @@ public class FTP extends SocketClient
     private boolean __strictCheck(String line, String code) {
         return (!(line.startsWith(code) && line.charAt(3) == ' '));
     }
-    
+
     // The strict check is too strong a condition because of non-conforming ftp
     // servers like ftp.funet.fi which sent 226 as the last line of a
     // 426 multi-line reply in response to ls /.  We relax the condition to
@@ -284,7 +284,7 @@ public class FTP extends SocketClient
         return (!(line.length() >= 4 && line.charAt(3) != '-' &&
                 Character.isDigit(line.charAt(0))));
     }
-    
+
     private void __getReply() throws IOException
     {
         int length;
@@ -304,7 +304,7 @@ public class FTP extends SocketClient
         if (length < 3)
             throw new MalformedServerReplyException(
                 "Truncated server reply: " + line);
-        
+
         String code = null;
         try
         {
@@ -483,7 +483,7 @@ public class FTP extends SocketClient
                 throw e;
             }
         }
-    
+
 
         if (_commandSupport_.getListenerCount() > 0)
             _commandSupport_.fireCommandSent(command, message);
@@ -493,7 +493,7 @@ public class FTP extends SocketClient
     }
 
     /**
-     * Checks if the socket is connected 
+     * Checks if the socket is connected
      *
      * @param socket
      * @return true if connected
@@ -648,12 +648,12 @@ public class FTP extends SocketClient
         }
 
         buffer = new StringBuilder(256);
-        
+
         for (String line : _replyLines) {
                 buffer.append(line);
                 buffer.append(SocketClient.NETASCII_EOL);
         }
-        
+
          _newReplyString = false;
 
         return (_replyString = buffer.toString());
@@ -861,9 +861,9 @@ public class FTP extends SocketClient
     /***
      * A convenience method to send the FTP EPRT command to the server,
      * receive the reply, and return the reply code.
-     * 
+     *
      * @see http://www.faqs.org/rfcs/rfc2428.html
-     * 
+     *
      * Examples:
      * <code>
      * <ul>
@@ -896,7 +896,7 @@ public class FTP extends SocketClient
             h = h.substring(0, num);
 
         info.append("|");
-        
+
         if (host instanceof Inet4Address)
             info.append("1");
         else if (host instanceof Inet6Address)
@@ -1175,7 +1175,7 @@ public class FTP extends SocketClient
     {
         return sendCommand(FTPCommand.ALLO, Integer.toString(bytes));
     }
-    
+
     /**
      * A convenience method to send the FTP FEAT command to the server, receive the reply,
      * and return the reply code.
@@ -1185,7 +1185,7 @@ public class FTP extends SocketClient
      */
     public int feat() throws IOException
     {
-    	return sendCommand(FTPCommand.FEAT);
+        return sendCommand(FTPCommand.FEAT);
     }
 
     /***
@@ -1227,17 +1227,17 @@ public class FTP extends SocketClient
     {
         return sendCommand(FTPCommand.REST, marker);
     }
-    
-    
+
+
     /**
      * @since 2.0
      **/
-    public int mdtm(String file) throws IOException 
+    public int mdtm(String file) throws IOException
     {
         return sendCommand(FTPCommand.MDTM, file);
     }
-    
-    
+
+
     /**
      * A convenience method to send the FTP MFMT command to the server,
      * receive the reply, and return the reply code.
@@ -1254,12 +1254,12 @@ public class FTP extends SocketClient
      *      command or receiving the server reply.
      * @see <a href="http://tools.ietf.org/html/draft-somers-ftp-mfxx-04">http://tools.ietf.org/html/draft-somers-ftp-mfxx-04</a>
      **/
-    public int mfmt(String pathname, String timeval) throws IOException 
+    public int mfmt(String pathname, String timeval) throws IOException
     {
-    	return sendCommand(FTPCommand.MFMT, timeval + " " + pathname);
+        return sendCommand(FTPCommand.MFMT, timeval + " " + pathname);
     }
-    
-    
+
+
     /***
      * A convenience method to send the FTP RNFR command to the server,
      * receive the reply, and return the reply code.

Modified: commons/proper/net/branches/NET_2_0/src/main/java/org/apache/commons/net/ftp/FTPSClient.java
URL: http://svn.apache.org/viewvc/commons/proper/net/branches/NET_2_0/src/main/java/org/apache/commons/net/ftp/FTPSClient.java?rev=922748&r1=922747&r2=922748&view=diff
==============================================================================
--- commons/proper/net/branches/NET_2_0/src/main/java/org/apache/commons/net/ftp/FTPSClient.java (original)
+++ commons/proper/net/branches/NET_2_0/src/main/java/org/apache/commons/net/ftp/FTPSClient.java Sun Mar 14 03:23:18 2010
@@ -34,25 +34,16 @@ import javax.net.ssl.SSLSocketFactory;
 import javax.net.ssl.TrustManager;
 
 /**
- * FTP over SSL processing. If desired, the JVM property -Djavax.net.debug=all can be used to 
+ * FTP over SSL processing. If desired, the JVM property -Djavax.net.debug=all can be used to
  * see wire-level SSL details.
- * 
+ *
  * @version $Id$
  * @since 2.0
  */
 public class FTPSClient extends FTPClient {
 
-    /** keystore algorithm name. */
-    public static String KEYSTORE_ALGORITHM;
-    /** truststore algorithm name. */
-    public static String TRUSTSTORE_ALGORITHM;
-    /** provider name. */
-    public static String PROVIDER;
-    /** truststore type. */
-    public static String STORE_TYPE;
-
     /** The value that I can set in PROT command  (C = Clear, P = Protected) */
-    private static final String[] PROT_COMMAND_VALUE = {"C","E","S","P"}; 
+    private static final String[] PROT_COMMAND_VALUE = {"C","E","S","P"};
     /** Default PROT Command */
     private static final String DEFAULT_PROT = "C";
     /** Default protocol name */
@@ -80,16 +71,16 @@ public class FTPSClient extends FTPClien
     private String[] suites = null;
     /** The protocol versions */
     private String[] protocols = null;
-    
+
     /** The FTPS {@link TrustManager} implementation. */
     private TrustManager trustManager = new FTPSTrustManager();
-    
+
     /** The {@link KeyManager} */
     private KeyManager keyManager;
 
     /**
      * Constructor for FTPSClient.
-     * @throws NoSuchAlgorithmException A requested cryptographic algorithm 
+     * @throws NoSuchAlgorithmException A requested cryptographic algorithm
      * is not available in the environment.
      */
     public FTPSClient() throws NoSuchAlgorithmException {
@@ -100,7 +91,7 @@ public class FTPSClient extends FTPClien
     /**
      * Constructor for FTPSClient.
      * @param isImplicit The secutiry mode(Implicit/Explicit).
-     * @throws NoSuchAlgorithmException A requested cryptographic algorithm 
+     * @throws NoSuchAlgorithmException A requested cryptographic algorithm
      * is not available in the environment.
      */
     public FTPSClient(boolean isImplicit) throws NoSuchAlgorithmException {
@@ -111,7 +102,7 @@ public class FTPSClient extends FTPClien
     /**
      * Constructor for FTPSClient.
      * @param protocol the protocol
-     * @throws NoSuchAlgorithmException A requested cryptographic algorithm 
+     * @throws NoSuchAlgorithmException A requested cryptographic algorithm
      * is not available in the environment.
      */
     public FTPSClient(String protocol) throws NoSuchAlgorithmException {
@@ -123,15 +114,15 @@ public class FTPSClient extends FTPClien
      * Constructor for FTPSClient.
      * @param protocol the protocol
      * @param isImplicit The secutiry mode(Implicit/Explicit).
-     * @throws NoSuchAlgorithmException A requested cryptographic algorithm 
+     * @throws NoSuchAlgorithmException A requested cryptographic algorithm
      * is not available in the environment.
      */
-    public FTPSClient(String protocol, boolean isImplicit) 
+    public FTPSClient(String protocol, boolean isImplicit)
             throws NoSuchAlgorithmException {
         this.protocol = protocol;
         this.isImplicit = isImplicit;
     }
-    
+
     /**
      * Constructor for FTPSClient.
      * @param isImplicit The secutiry mode(Implicit/Explicit).
@@ -142,7 +133,7 @@ public class FTPSClient extends FTPClien
         this.context = context;
         this.protocol = DEFAULT_PROTOCOL;
     }
-    
+
     /**
      * Constructor for FTPSClient.
      * @param context A pre-configured SSL Context
@@ -169,11 +160,11 @@ public class FTPSClient extends FTPClien
         return this.auth;
     }
 
-    
+
     /**
-     * Because there are so many connect() methods, 
-     * the _connectAction_() method is provided as a means of performing 
-     * some action immediately after establishing a connection, 
+     * Because there are so many connect() methods,
+     * the _connectAction_() method is provided as a means of performing
+     * some action immediately after establishing a connection,
      * rather than reimplementing all of the connect() methods.
      * @throws IOException If it throw by _connectAction_.
      * @see org.apache.commons.net.SocketClient#_connectAction_()
@@ -193,7 +184,7 @@ public class FTPSClient extends FTPClien
     /**
      * AUTH command.
      * @throws SSLException If it server reply code not equal "234" and "334".
-     * @throws IOException If an I/O error occurs while either sending 
+     * @throws IOException If an I/O error occurs while either sending
      * the command.
      */
     private void execAUTH() throws SSLException, IOException {
@@ -208,8 +199,8 @@ public class FTPSClient extends FTPClien
     }
 
     /**
-     * Performs a lazy init of the SSL context 
-     * @throws IOException 
+     * Performs a lazy init of the SSL context
+     * @throws IOException
      */
     private void initSslContext() throws IOException {
         if(context == null) {
@@ -227,9 +218,9 @@ public class FTPSClient extends FTPClien
             }
         }
     }
-    
+
     /**
-     * SSL/TLS negotiation. Acquires an SSL socket of a control 
+     * SSL/TLS negotiation. Acquires an SSL socket of a control
      * connection and carries out handshake processing.
      * @throws IOException If server negotiation fails
      */
@@ -240,7 +231,7 @@ public class FTPSClient extends FTPClien
         SSLSocketFactory ssf = context.getSocketFactory();
         String ip = _socket_.getInetAddress().getHostAddress();
         int port = _socket_.getPort();
-        SSLSocket socket = 
+        SSLSocket socket =
             (SSLSocket) ssf.createSocket(_socket_, ip, port, true);
         socket.setEnableSessionCreation(isCreation);
         socket.setUseClientMode(isClientMode);
@@ -260,7 +251,7 @@ public class FTPSClient extends FTPClien
         _controlOutput_ = new BufferedWriter(new OutputStreamWriter(
                 socket.getOutputStream(), getControlEncoding()));
     }
-    
+
     /**
      * Get the {@link KeyManager} instance.
      * @return The {@link KeyManager} instance
@@ -268,10 +259,10 @@ public class FTPSClient extends FTPClien
     private KeyManager getKeyManager() {
         return keyManager;
     }
-    
+
     /**
     * Set a {@link KeyManager} to use
-    * 
+    *
     * @param keyManager The KeyManager implementation to set.
     */
     public void setKeyManager(KeyManager keyManager) {
@@ -286,17 +277,17 @@ public class FTPSClient extends FTPClien
         this.isCreation = isCreation;
     }
 
-	/**
+    /**
      * Returns true if new SSL sessions may be established by this socket.
      * When the underlying {@link Socket} instance is not SSL-enabled (i.e. an
      * instance of {@link SSLSocket} with {@link SSLSocket}{@link #getEnableSessionCreation()}) enabled,
      * this returns False.
      * @return true - Indicates that sessions may be created;
-     * this is the default. 
+     * this is the default.
      * false - indicates that an existing session must be resumed.
      */
     public boolean getEnableSessionCreation() {
-        if (_socket_ instanceof SSLSocket) 
+        if (_socket_ instanceof SSLSocket)
             return ((SSLSocket)_socket_).getEnableSessionCreation();
         return false;
     }
@@ -312,18 +303,18 @@ public class FTPSClient extends FTPClien
     /**
      * Returns true if the socket will require client authentication.
      * When the underlying {@link Socket} is not an {@link SSLSocket} instance, returns false.
-     * @return true - If the server mode socket should request 
+     * @return true - If the server mode socket should request
      * that the client authenticate itself.
      */
     public boolean getNeedClientAuth() {
-        if (_socket_ instanceof SSLSocket) 
+        if (_socket_ instanceof SSLSocket)
             return ((SSLSocket)_socket_).getNeedClientAuth();
         return false;
     }
 
     /**
-     * Configures the socket to request client authentication, 
-     * but only if such a request is appropriate to the cipher 
+     * Configures the socket to request client authentication,
+     * but only if such a request is appropriate to the cipher
      * suite negotiated.
      * @param isWantClientAuth The want client auth flag.
      */
@@ -334,17 +325,17 @@ public class FTPSClient extends FTPClien
     /**
      * Returns true if the socket will request client authentication.
      * When the underlying {@link Socket} is not an {@link SSLSocket} instance, returns false.
-     * @return true - If the server mode socket should request 
+     * @return true - If the server mode socket should request
      * that the client authenticate itself.
      */
     public boolean getWantClientAuth() {
-        if (_socket_ instanceof SSLSocket) 
+        if (_socket_ instanceof SSLSocket)
             return ((SSLSocket)_socket_).getWantClientAuth();
         return false;
     }
 
     /**
-     * Configures the socket to use client (or server) mode in its first 
+     * Configures the socket to use client (or server) mode in its first
      * handshake.
      * @param isClientMode The use client mode flag.
      */
@@ -353,20 +344,20 @@ public class FTPSClient extends FTPClien
     }
 
     /**
-     * Returns true if the socket is set to use client mode 
+     * Returns true if the socket is set to use client mode
      * in its first handshake.
      * When the underlying {@link Socket} is not an {@link SSLSocket} instance, returns false.
-     * @return true - If the socket should start its first handshake 
+     * @return true - If the socket should start its first handshake
      * in "client" mode.
      */
     public boolean getUseClientMode() {
-        if (_socket_ instanceof SSLSocket) 
+        if (_socket_ instanceof SSLSocket)
             return ((SSLSocket)_socket_).getUseClientMode();
         return false;
     }
 
     /**
-     * Controls which particular cipher suites are enabled for use on this 
+     * Controls which particular cipher suites are enabled for use on this
      * connection. Called before server negotiation.
      * @param cipherSuites The cipher suites.
      */
@@ -376,13 +367,13 @@ public class FTPSClient extends FTPClien
     }
 
     /**
-     * Returns the names of the cipher suites which could be enabled 
+     * Returns the names of the cipher suites which could be enabled
      * for use on this connection.
      * When the underlying {@link Socket} is not an {@link SSLSocket} instance, returns false.
      * @return An array of cipher suite names.
      */
     public String[] getEnabledCipherSuites() {
-        if (_socket_ instanceof SSLSocket) 
+        if (_socket_ instanceof SSLSocket)
             return ((SSLSocket)_socket_).getEnabledCipherSuites();
         return null;
     }
@@ -398,13 +389,13 @@ public class FTPSClient extends FTPClien
     }
 
     /**
-     * Returns the names of the protocol versions which are currently 
+     * Returns the names of the protocol versions which are currently
      * enabled for use on this connection.
      * When the underlying {@link Socket} is not an {@link SSLSocket} instance, returns false.
      * @return An array of protocols.
      */
     public String[] getEnabledProtocols() {
-        if (_socket_ instanceof SSLSocket) 
+        if (_socket_ instanceof SSLSocket)
             return ((SSLSocket)_socket_).getEnabledProtocols();
         return null;
     }
@@ -413,11 +404,11 @@ public class FTPSClient extends FTPClien
      * PBSZ command. pbsz value: 0 to (2^32)-1 decimal integer.
      * @param pbsz Protection Buffer Size.
      * @throws SSLException If the server reply code does not equal "200".
-     * @throws IOException If an I/O error occurs while sending 
+     * @throws IOException If an I/O error occurs while sending
      * the command.
      */
     public void execPBSZ(long pbsz) throws SSLException, IOException {
-        if (pbsz < 0 || 4294967295L < pbsz) 
+        if (pbsz < 0 || 4294967295L < pbsz)
             throw new IllegalArgumentException();
         if (FTPReply.COMMAND_OK != sendCommand(
                 FTPSCommand._commands[FTPSCommand.PBSZ],String.valueOf(pbsz)))
@@ -432,14 +423,14 @@ public class FTPSClient extends FTPClien
      * P - Private
      * @param prot Data Channel Protection Level.
      * @throws SSLException If the server reply code does not equal "200".
-     * @throws IOException If an I/O error occurs while sending 
+     * @throws IOException If an I/O error occurs while sending
      * the command.
      */
     public void execPROT(String prot) throws SSLException, IOException {
         if (prot == null) prot = DEFAULT_PROT;
         if (!checkPROTValue(prot)) throw new IllegalArgumentException();
         if (FTPReply.COMMAND_OK != sendCommand(
-                FTPSCommand._commands[FTPSCommand.PROT], prot)) 
+                FTPSCommand._commands[FTPSCommand.PROT], prot))
             throw new SSLException(getReplyString());
         if (DEFAULT_PROT.equals(prot)) {
             setSocketFactory(null);
@@ -465,11 +456,11 @@ public class FTPSClient extends FTPClien
 
     /**
      * Send an FTP command.
-     * The CCC (Clear Command Channel) command causes the underlying {@link SSLSocket} instance  to be assigned 
+     * The CCC (Clear Command Channel) command causes the underlying {@link SSLSocket} instance  to be assigned
      * to a plain {@link Socket} instances
      * @param command The FTP command.
      * @return server reply.
-     * @throws IOException If an I/O error occurs while sending 
+     * @throws IOException If an I/O error occurs while sending
      * the command.
      * @see org.apache.commons.net.ftp.FTP#sendCommand(java.lang.String)
      */
@@ -480,12 +471,12 @@ public class FTPSClient extends FTPClien
         if (FTPSCommand._commands[FTPSCommand.CCC].equals(command)) {
             if (FTPReply.COMMAND_OK == repCode) {
                 _socket_ = plainSocket;
-		_controlInput_ = new BufferedReader(
-				new InputStreamReader( 
-					_socket_ .getInputStream(), getControlEncoding()));
-		_controlOutput_ = new BufferedWriter(
-				new OutputStreamWriter( 
-					_socket_.getOutputStream(), getControlEncoding()));
+        _controlInput_ = new BufferedReader(
+                new InputStreamReader(
+                    _socket_ .getInputStream(), getControlEncoding()));
+        _controlOutput_ = new BufferedWriter(
+                new OutputStreamWriter(
+                    _socket_.getOutputStream(), getControlEncoding()));
                 setSocketFactory(null);
             } else {
                 throw new SSLException(getReplyString());
@@ -495,14 +486,14 @@ public class FTPSClient extends FTPClien
     }
 
     /**
-     * Returns a socket of the data connection. 
+     * Returns a socket of the data connection.
      * Wrapped as an {@link SSLSocket}, which carries out handshake processing.
      * @param command The textual representation of the FTP command to send.
-     * @param arg The arguments to the FTP command. 
-     * If this parameter is set to null, then the command is sent with 
+     * @param arg The arguments to the FTP command.
+     * If this parameter is set to null, then the command is sent with
      * no arguments.
-     * @return corresponding to the established data connection. 
-     * Null is returned if an FTP protocol error is reported at any point 
+     * @return corresponding to the established data connection.
+     * Null is returned if an FTP protocol error is reported at any point
      * during the establishment and initialization of the connection.
      * @throws IOException If there is any problem with the connection.
      * @see org.apache.commons.net.ftp.FTPClient#_openDataConnection_(java.lang.String, int)
@@ -510,15 +501,15 @@ public class FTPSClient extends FTPClien
     @Override
     protected Socket _openDataConnection_(int command, String arg)
             throws IOException {
-        Socket socket = super._openDataConnection_(command, arg); 
+        Socket socket = super._openDataConnection_(command, arg);
         if (socket != null && socket instanceof SSLSocket) {
-        	SSLSocket sslSocket = (SSLSocket)socket;
+            SSLSocket sslSocket = (SSLSocket)socket;
 
             sslSocket.setUseClientMode(isClientMode);
             sslSocket.setEnableSessionCreation(isCreation);
-       
+
             // server mode
-            if (!isClientMode) {     	
+            if (!isClientMode) {
                 sslSocket.setNeedClientAuth(isNeedClientAuth);
                 sslSocket.setWantClientAuth(isWantClientAuth);
             }
@@ -528,13 +519,13 @@ public class FTPSClient extends FTPClien
                 sslSocket.setEnabledProtocols(protocols);
             sslSocket.startHandshake();
         }
-       
+
         return socket;
     }
 
     /**
      * Get the currently configured {@link TrustManager}.
-     * 
+     *
      * @return A TrustManager instance.
      */
     public TrustManager getTrustManager() {
@@ -543,10 +534,10 @@ public class FTPSClient extends FTPClien
 
     /**
      * Override the default {@link TrustManager} to use.
-     * 
+     *
      * @param trustManager The TrustManager implementation to set.
      */
     public void setTrustManager(TrustManager trustManager) {
         this.trustManager = trustManager;
-    }    
+    }
 }

Modified: commons/proper/net/branches/NET_2_0/src/main/java/org/apache/commons/net/ftp/FTPSServerSocketFactory.java
URL: http://svn.apache.org/viewvc/commons/proper/net/branches/NET_2_0/src/main/java/org/apache/commons/net/ftp/FTPSServerSocketFactory.java?rev=922748&r1=922747&r2=922748&view=diff
==============================================================================
--- commons/proper/net/branches/NET_2_0/src/main/java/org/apache/commons/net/ftp/FTPSServerSocketFactory.java (original)
+++ commons/proper/net/branches/NET_2_0/src/main/java/org/apache/commons/net/ftp/FTPSServerSocketFactory.java Sun Mar 14 03:23:18 2010
@@ -29,14 +29,14 @@ import javax.net.ssl.SSLServerSocket;
  * Server socket factory for FTPS connections.
  */
 public class FTPSServerSocketFactory extends ServerSocketFactory {
-    
-	/** Factory for secure socket factories */
+
+    /** Factory for secure socket factories */
     private final SSLContext context;
-    
+
     public FTPSServerSocketFactory(SSLContext context) {
         this.context = context;
     }
-    
+
     @Override
     public ServerSocket createServerSocket(int port) throws IOException {
         return init(this.context.getServerSocketFactory().createServerSocket(port));
@@ -44,14 +44,14 @@ public class FTPSServerSocketFactory ext
 
     @Override
     public ServerSocket createServerSocket(int port, int backlog) throws IOException {
-        return 	init(this.context.getServerSocketFactory().createServerSocket(port, backlog));
+        return init(this.context.getServerSocketFactory().createServerSocket(port, backlog));
     }
 
     @Override
     public ServerSocket createServerSocket(int port, int backlog, InetAddress ifAddress) throws IOException {
-    	return init(this.context.getServerSocketFactory().createServerSocket(port, backlog, ifAddress));
+        return init(this.context.getServerSocketFactory().createServerSocket(port, backlog, ifAddress));
     }
-        
+
     public ServerSocket init(ServerSocket socket) throws IOException {
         ((SSLServerSocket) socket).setUseClientMode(true);
         return socket;

Modified: commons/proper/net/branches/NET_2_0/src/main/java/org/apache/commons/net/ftp/parser/DefaultFTPFileEntryParserFactory.java
URL: http://svn.apache.org/viewvc/commons/proper/net/branches/NET_2_0/src/main/java/org/apache/commons/net/ftp/parser/DefaultFTPFileEntryParserFactory.java?rev=922748&r1=922747&r2=922748&view=diff
==============================================================================
--- commons/proper/net/branches/NET_2_0/src/main/java/org/apache/commons/net/ftp/parser/DefaultFTPFileEntryParserFactory.java (original)
+++ commons/proper/net/branches/NET_2_0/src/main/java/org/apache/commons/net/ftp/parser/DefaultFTPFileEntryParserFactory.java Sun Mar 14 03:23:18 2010
@@ -35,15 +35,15 @@ import org.apache.commons.net.ftp.FTPFil
 public class DefaultFTPFileEntryParserFactory
     implements FTPFileEntryParserFactory
 {
-	private FTPClientConfig config = null;
+    private FTPClientConfig config = null;
 
-	/**
+    /**
      * This default implementation of the FTPFileEntryParserFactory
      * interface works according to the following logic:
      * First it attempts to interpret the supplied key as a fully
      * qualified classname of a class implementing the
      * FTPFileEntryParser interface.  If that succeeds, a parser
-     * object of this class is instantiated and is returned; 
+     * object of this class is instantiated and is returned;
      * otherwise it attempts to interpret the key as an identirier
      * commonly used by the FTP SYST command to identify systems.
      * <p/>
@@ -78,9 +78,9 @@ public class DefaultFTPFileEntryParserFa
      */
     public FTPFileEntryParser createFileEntryParser(String key)
     {
-    	if (key == null)
-    		throw new ParserInitializationException("Parser key cannot be null");
-    		
+        if (key == null)
+            throw new ParserInitializationException("Parser key cannot be null");
+
         Class<?> parserClass = null;
         FTPFileEntryParser parser = null;
         try
@@ -90,56 +90,56 @@ public class DefaultFTPFileEntryParserFa
         }
         catch (ClassNotFoundException e)
         {
-            try 
+            try
             {
-	            String ukey = key.toUpperCase(java.util.Locale.ENGLISH);
-	            if (ukey.indexOf(FTPClientConfig.SYST_UNIX) >= 0) 
-	            {
-	                parser = createUnixFTPEntryParser();
-	            }
-	            else if (ukey.indexOf(FTPClientConfig.SYST_VMS) >= 0)
-	            {
-	                parser = createVMSVersioningFTPEntryParser();
-	            }
-	            else if (ukey.indexOf(FTPClientConfig.SYST_NT) >= 0)
-	            {
-	                parser = createNTFTPEntryParser();
-	            }
-	            else if (ukey.indexOf(FTPClientConfig.SYST_OS2) >= 0)
-	            {
-	                parser = createOS2FTPEntryParser();
-	            }
-	            else if (ukey.indexOf(FTPClientConfig.SYST_OS400) >= 0 ||
-	            		ukey.indexOf(FTPClientConfig.SYST_AS400) >= 0)
-	            {
-	                parser = createOS400FTPEntryParser();
-	            }
-	            else if (ukey.indexOf(FTPClientConfig.SYST_MVS) >= 0)
-	            {
-	                parser = createMVSEntryParser();
-	        	}
-	            else if (ukey.indexOf(FTPClientConfig.SYST_NETWARE) >= 0) 
-	            {
-	            	parser = createNetwareFTPEntryParser();
-	            }
-	            else if (ukey.indexOf(FTPClientConfig.SYST_L8) >= 0) 
-	            {
-	            	// L8 normally means Unix, but move it to the end for some L8 systems that aren't.
-	            	// This check should be last!
-	            	parser = createUnixFTPEntryParser();
-	            }
-	            else
-	            {
-	                throw new ParserInitializationException("Unknown parser type: " + key);
-	            }
-            } 
+                String ukey = key.toUpperCase(java.util.Locale.ENGLISH);
+                if (ukey.indexOf(FTPClientConfig.SYST_UNIX) >= 0)
+                {
+                    parser = createUnixFTPEntryParser();
+                }
+                else if (ukey.indexOf(FTPClientConfig.SYST_VMS) >= 0)
+                {
+                    parser = createVMSVersioningFTPEntryParser();
+                }
+                else if (ukey.indexOf(FTPClientConfig.SYST_NT) >= 0)
+                {
+                    parser = createNTFTPEntryParser();
+                }
+                else if (ukey.indexOf(FTPClientConfig.SYST_OS2) >= 0)
+                {
+                    parser = createOS2FTPEntryParser();
+                }
+                else if (ukey.indexOf(FTPClientConfig.SYST_OS400) >= 0 ||
+                        ukey.indexOf(FTPClientConfig.SYST_AS400) >= 0)
+                {
+                    parser = createOS400FTPEntryParser();
+                }
+                else if (ukey.indexOf(FTPClientConfig.SYST_MVS) >= 0)
+                {
+                    parser = createMVSEntryParser();
+                }
+                else if (ukey.indexOf(FTPClientConfig.SYST_NETWARE) >= 0)
+                {
+                    parser = createNetwareFTPEntryParser();
+                }
+                else if (ukey.indexOf(FTPClientConfig.SYST_L8) >= 0)
+                {
+                    // L8 normally means Unix, but move it to the end for some L8 systems that aren't.
+                    // This check should be last!
+                    parser = createUnixFTPEntryParser();
+                }
+                else
+                {
+                    throw new ParserInitializationException("Unknown parser type: " + key);
+                }
+            }
             catch (NoClassDefFoundError nf) {
                     throw new ParserInitializationException("Error initializing parser", nf);
             }
 
         }
         catch (NoClassDefFoundError e)
-        { 	
+        {
             throw new ParserInitializationException("Error initializing parser", e);
         }
         catch (ClassCastException e)
@@ -155,12 +155,12 @@ public class DefaultFTPFileEntryParserFa
 
         if (parser instanceof Configurable) {
             ((Configurable)parser).configure(this.config);
-        }    
+        }
         return parser;
     }
-    
+
     /**
-     * <p>Implementation extracts a key from the supplied 
+     * <p>Implementation extracts a key from the supplied
      * {@link  FTPClientConfig FTPClientConfig}
      * parameter and creates an object implementing the
      * interface FTPFileEntryParser and uses the supplied configuration
@@ -171,7 +171,7 @@ public class DefaultFTPFileEntryParserFa
      * where the user knows that the server uses a non-default configuration
      * and knows what that configuration is.
      * </p>
-     * @param config  A {@link  FTPClientConfig FTPClientConfig}  
+     * @param config  A {@link  FTPClientConfig FTPClientConfig}
      * used to configure the parser created
      *
      * @return the @link  FTPFileEntryParser FTPFileEntryParser} so created.
@@ -179,13 +179,13 @@ public class DefaultFTPFileEntryParserFa
      *                   Thrown on any exception in instantiation
      * @since 1.4
      */
-	public FTPFileEntryParser createFileEntryParser(FTPClientConfig config) 
-	throws ParserInitializationException 
-	{
-	    this.config = config;
-		String key = config.getServerSystemKey();
-		return createFileEntryParser(key);
-	}
+    public FTPFileEntryParser createFileEntryParser(FTPClientConfig config)
+    throws ParserInitializationException
+    {
+        this.config = config;
+        String key = config.getServerSystemKey();
+        return createFileEntryParser(key);
+    }
 
 
     public FTPFileEntryParser createUnixFTPEntryParser()
@@ -197,26 +197,26 @@ public class DefaultFTPFileEntryParserFa
     {
         return new VMSVersioningFTPEntryParser();
     }
-    
+
     public FTPFileEntryParser createNetwareFTPEntryParser() {
-    	return new NetwareFTPEntryParser();
+        return new NetwareFTPEntryParser();
     }
 
     public FTPFileEntryParser createNTFTPEntryParser()
     {
-    	if (config != null && FTPClientConfig.SYST_NT.equals(
-    	        config.getServerSystemKey())) 
-    	{
+        if (config != null && FTPClientConfig.SYST_NT.equals(
+                config.getServerSystemKey()))
+        {
             return new NTFTPEntryParser();
-    	} else {
+        } else {
             return new CompositeFileEntryParser(new FTPFileEntryParser[]
-	   	        {
-	   	            new NTFTPEntryParser(),
-	   	            new UnixFTPEntryParser()
-	   	        });
-    	}
+                   {
+                       new NTFTPEntryParser(),
+                       new UnixFTPEntryParser()
+                   });
+        }
     }
-    
+
      public FTPFileEntryParser createOS2FTPEntryParser()
     {
         return new OS2FTPEntryParser();
@@ -224,17 +224,17 @@ public class DefaultFTPFileEntryParserFa
 
     public FTPFileEntryParser createOS400FTPEntryParser()
     {
-    	if (config != null && 
-    	        FTPClientConfig.SYST_OS400.equals(config.getServerSystemKey())) 
-    	{
+        if (config != null &&
+                FTPClientConfig.SYST_OS400.equals(config.getServerSystemKey()))
+        {
             return new OS400FTPEntryParser();
-    	} else {
-	        return new CompositeFileEntryParser(new FTPFileEntryParser[]
-	            {
-	                new OS400FTPEntryParser(),
-	                new UnixFTPEntryParser()
-	            });
-    	}
+        } else {
+            return new CompositeFileEntryParser(new FTPFileEntryParser[]
+                {
+                    new OS400FTPEntryParser(),
+                    new UnixFTPEntryParser()
+                });
+        }
     }
 
     public FTPFileEntryParser createMVSEntryParser()
@@ -242,7 +242,5 @@ public class DefaultFTPFileEntryParserFa
         return new MVSFTPEntryParser();
     }
 
-
-	
 }
 

Modified: commons/proper/net/branches/NET_2_0/src/main/java/org/apache/commons/net/io/DotTerminatedMessageReader.java
URL: http://svn.apache.org/viewvc/commons/proper/net/branches/NET_2_0/src/main/java/org/apache/commons/net/io/DotTerminatedMessageReader.java?rev=922748&r1=922747&r2=922748&view=diff
==============================================================================
--- commons/proper/net/branches/NET_2_0/src/main/java/org/apache/commons/net/io/DotTerminatedMessageReader.java (original)
+++ commons/proper/net/branches/NET_2_0/src/main/java/org/apache/commons/net/io/DotTerminatedMessageReader.java Sun Mar 14 03:23:18 2010
@@ -154,7 +154,7 @@ public final class DotTerminatedMessageR
                     ch = internalBuffer[pos++];
                 }
                 else if (ch == '\r') {
-                	internalReader.unread(ch);
+                    internalReader.unread(ch);
                 }
                 else
                 {

Modified: commons/proper/net/branches/NET_2_0/src/main/java/org/apache/commons/net/nntp/Threader.java
URL: http://svn.apache.org/viewvc/commons/proper/net/branches/NET_2_0/src/main/java/org/apache/commons/net/nntp/Threader.java?rev=922748&r1=922747&r2=922748&view=diff
==============================================================================
--- commons/proper/net/branches/NET_2_0/src/main/java/org/apache/commons/net/nntp/Threader.java (original)
+++ commons/proper/net/branches/NET_2_0/src/main/java/org/apache/commons/net/nntp/Threader.java Sun Mar 14 03:23:18 2010
@@ -22,7 +22,7 @@ package org.apache.commons.net.nntp;
  * This is an implementation of a message threading algorithm, as originally devised by Zamie Zawinski.
  * See <a href="http://www.jwz.org/doc/threading.html">http://www.jwz.org/doc/threading.html</a> for details.
  * For his Java implementation, see <a href="http://lxr.mozilla.org/mozilla/source/grendel/sources/grendel/view/Threader.java">http://lxr.mozilla.org/mozilla/source/grendel/sources/grendel/view/Threader.java</a>
- *  
+ *
  * @author rwinston <rwinston@checkfree.com>
  *
  */
@@ -37,7 +37,7 @@ public class Threader {
     private int bogusIdCount = 0;
 
     /**
-     * The main threader entry point - The client passes in an array of Threadable objects, and 
+     * The main threader entry point - The client passes in an array of Threadable objects, and
      * the Threader constructs a connected 'graph' of messages
      * @param messages
      * @return null if messages == null or root.child == null
@@ -48,10 +48,10 @@ public class Threader {
 
         idTable = new HashMap<String,ThreadContainer>();
 
-        // walk through each Threadable element    
+        // walk through each Threadable element
         for (Threadable t : messages) {
-        	if (!t.isDummy())
-        		buildContainer(t);
+            if (!t.isDummy())
+                buildContainer(t);
         }
 
         root = findRootSet();
@@ -79,14 +79,14 @@ public class Threader {
     }
 
     /**
-     * 
+     *
      * @param threadable
      */
     private void buildContainer(Threadable threadable) {
         String id = threadable.messageThreadId();
         ThreadContainer container = idTable.get(id);
 
-        // A ThreadContainer exists for this id already. This should be a forward reference, but may 
+        // A ThreadContainer exists for this id already. This should be a forward reference, but may
         // be a duplicate id, in which case we will need to generate a bogus placeholder id
         if (container != null) {
             if (container.threadable != null) { // oops! duplicate ids...
@@ -137,7 +137,7 @@ public class Threader {
             }
         }
 
-        // parentRef is now set to the container of the last element in the references field. make that 
+        // parentRef is now set to the container of the last element in the references field. make that
         // be the parent of this container, unless doing so causes a circular reference
         if (parentRef != null
             && (parentRef == container || container.findChild(parentRef)))
@@ -216,7 +216,7 @@ public class Threader {
                 container = next,
                 next = (container == null ? null : container.next)) {
 
-            // Is it empty and without any children? If so,delete it 
+            // Is it empty and without any children? If so,delete it
             if (container.threadable == null && container.child == null) {
                 if (prev == null)
                     parent.child = container.next;
@@ -233,7 +233,7 @@ public class Threader {
                     && container.child != null
                     && (container.parent != null
                         || container.child.next == null)) {
-                // We have an invalid/expired message with kids. Promote the kids to this level. 
+                // We have an invalid/expired message with kids. Promote the kids to this level.
                 ThreadContainer tail;
                 ThreadContainer kids = container.child;
 
@@ -266,7 +266,7 @@ public class Threader {
     }
 
     /**
-     *  If any two members of the root set have the same subject, merge them. This is to attempt to accomodate messages without References: headers. 
+     *  If any two members of the root set have the same subject, merge them. This is to attempt to accomodate messages without References: headers.
      */
     private void gatherSubjects() {
 
@@ -299,7 +299,7 @@ public class Threader {
             // - There exists no container with this subject
             // - or this is a dummy container and the old one is not - the dummy one is
             // more interesting as a root, so put it in the table instead
-            // - The container in the table has a "Re:" version of this subject, and 
+            // - The container in the table has a "Re:" version of this subject, and
             // this container has a non-"Re:" version of this subject. The non-"Re:" version
             // is the more interesting of the two.
             if (old == null
@@ -317,7 +317,7 @@ public class Threader {
         if (count == 0)
             return;
 
-        // subjectTable is now populated with one entry for each subject which occurs in the 
+        // subjectTable is now populated with one entry for each subject which occurs in the
         // root set. Iterate over the root set, and gather together the difference.
         ThreadContainer prev, c, rest;
         for (prev = null, c = root.child, rest = c.next;

Modified: commons/proper/net/branches/NET_2_0/src/main/java/org/apache/commons/net/smtp/SMTP.java
URL: http://svn.apache.org/viewvc/commons/proper/net/branches/NET_2_0/src/main/java/org/apache/commons/net/smtp/SMTP.java?rev=922748&r1=922747&r2=922748&view=diff
==============================================================================
--- commons/proper/net/branches/NET_2_0/src/main/java/org/apache/commons/net/smtp/SMTP.java (original)
+++ commons/proper/net/branches/NET_2_0/src/main/java/org/apache/commons/net/smtp/SMTP.java Sun Mar 14 03:23:18 2010
@@ -92,7 +92,7 @@ public class SMTP extends SocketClient
     // but we use ISO-8859-1 just in case 8-bit characters cross
     // the wire.
     private static final String __DEFAULT_ENCODING = "ISO-8859-1";
-    
+
     /** The encoding to use (user-settable) */
     private String encoding = __DEFAULT_ENCODING;
 
@@ -125,7 +125,7 @@ public class SMTP extends SocketClient
         _replyString = null;
         _commandSupport_ = new ProtocolCommandSupport(this);
     }
-    
+
     /**
      * Overloaded constructor where the user may specify a default encoding.
      * @param encoding
@@ -246,7 +246,7 @@ public class SMTP extends SocketClient
             new BufferedWriter(new OutputStreamWriter(_output_,
                                                       encoding));
         __getReply();
-        
+
     }
 
 
@@ -441,7 +441,7 @@ public class SMTP extends SocketClient
      ***/
     public String[] getReplyStrings()
     {
-    	  return _replyLines.toArray(new String[_replyLines.size()]);
+        return _replyLines.toArray(new String[_replyLines.size()]);
     }
 
     /***
@@ -459,7 +459,7 @@ public class SMTP extends SocketClient
             return _replyString;
 
         buffer = new StringBuilder();
-        
+
         for (String line : _replyLines)
         {
             buffer.append(line);

Modified: commons/proper/net/branches/NET_2_0/src/main/java/org/apache/commons/net/util/SubnetUtils.java
URL: http://svn.apache.org/viewvc/commons/proper/net/branches/NET_2_0/src/main/java/org/apache/commons/net/util/SubnetUtils.java?rev=922748&r1=922747&r2=922748&view=diff
==============================================================================
--- commons/proper/net/branches/NET_2_0/src/main/java/org/apache/commons/net/util/SubnetUtils.java (original)
+++ commons/proper/net/branches/NET_2_0/src/main/java/org/apache/commons/net/util/SubnetUtils.java Sun Mar 14 03:23:18 2010
@@ -20,7 +20,7 @@ import java.util.regex.Matcher;
 import java.util.regex.Pattern;
 
 /**
- * A class that performs some subnet calculations given a network address and a subnet mask. 
+ * A class that performs some subnet calculations given a network address and a subnet mask.
  * @see "http://www.faqs.org/rfcs/rfc1519.html"
  * @author <rwinston@apache.org>
  * @since 2.0
@@ -40,8 +40,8 @@ public class SubnetUtils {
 
     /** Whether the broadcast/network address are included in host count */
     private boolean inclusiveHostCount = false;
-    
-    
+
+
     /**
      * Constructor that takes a CIDR-notation string, e.g. "192.168.0.1/16"
      * @param cidrNotation A CIDR-notation string, e.g. "192.168.0.1/16"
@@ -51,36 +51,36 @@ public class SubnetUtils {
     }
 
     /**
-     * Constructor that takes a dotted decimal address and a dotted decimal mask. 
+     * Constructor that takes a dotted decimal address and a dotted decimal mask.
      * @param address An IP address, e.g. "192.168.0.1"
      * @param mask A dotted decimal netmask e.g. "255.255.0.0"
      */
     public SubnetUtils(String address, String mask) {
         calculate(toCidrNotation(address, mask));
     }
-    
-    
+
+
     /**
      * Returns <code>true</code> if the return value of {@link SubnetInfo#getAddressCount()}
      * includes the network address and broadcast addresses.
      * @return
      */
     public boolean isInclusiveHostCount() {
-		return inclusiveHostCount;
-	}
+        return inclusiveHostCount;
+    }
 
     /**
      * Set to <code>true</code> if you want the return value of {@link SubnetInfo#getAddressCount()}
      * to include the network and broadcast addresses.
      * @param inclusiveHostCount
      */
-	public void setInclusiveHostCount(boolean inclusiveHostCount) {
-		this.inclusiveHostCount = inclusiveHostCount;
-	}
+    public void setInclusiveHostCount(boolean inclusiveHostCount) {
+        this.inclusiveHostCount = inclusiveHostCount;
+    }
 
 
 
-	/**
+    /**
      * Convenience container for subnet summary information.
      *
      */
@@ -95,15 +95,15 @@ public class SubnetUtils {
         private int high()          { return broadcast() - (isInclusiveHostCount() ? 0 : 1); }
 
         /**
-         * Returns true if the parameter <code>address</code> is in the 
+         * Returns true if the parameter <code>address</code> is in the
          * range of usable endpoint addresses for this subnet. This excludes the
          * network and broadcast adresses.
          * @param address A dot-delimited IPv4 address, e.g. "192.168.0.1"
          * @return True if in range, false otherwise
          */
         public boolean isInRange(String address)    { return isInRange(toInteger(address)); }
-        
-        private boolean isInRange(int address)      { 
+
+        private boolean isInRange(int address)      {
             int diff = address-low();
             return (diff >= 0 && (diff <= (high()-low())));
         }
@@ -117,33 +117,33 @@ public class SubnetUtils {
         public int getAddressCount()                { return (broadcast() - low() + (isInclusiveHostCount() ? 1 : 0)); }
 
         public int asInteger(String address)        { return toInteger(address); }
-        
-        public String getCidrSignature() { 
+
+        public String getCidrSignature() {
             return toCidrNotation(
-                    format(toArray(address())), 
+                    format(toArray(address())),
                     format(toArray(netmask()))
             );
         }
-        
-        public String[] getAllAddresses() { 
+
+        public String[] getAllAddresses() {
             String[] addresses = new String[getAddressCount()];
             for (int add = low(), j=0; add <= high(); ++add, ++j) {
                 addresses[j] = format(toArray(add));
             }
             return addresses;
         }
-        
+
         @Override
         public String toString() {
-        	final StringBuilder buf = new StringBuilder();
-        	buf.append("CIDR Signature:\t[").append(getCidrSignature()).append("]")
-        		.append(" Netmask: [").append(getNetmask()).append("]\n")
-        		.append("Network:\t[").append(getNetworkAddress()).append("]\n")
-        		.append("Broadcast:\t[").append(getBroadcastAddress()).append("]\n")
-        	 	.append("First Address:\t[").append(getLowAddress()).append("]\n")
-        	 	.append("Last Address:\t[").append(getHighAddress()).append("]\n")
-        	 	.append("# Addresses:\t[").append(getAddressCount()).append("]\n");        	 	
-        	return buf.toString();
+            final StringBuilder buf = new StringBuilder();
+            buf.append("CIDR Signature:\t[").append(getCidrSignature()).append("]")
+                .append(" Netmask: [").append(getNetmask()).append("]\n")
+                .append("Network:\t[").append(getNetworkAddress()).append("]\n")
+                .append("Broadcast:\t[").append(getBroadcastAddress()).append("]\n")
+                 .append("First Address:\t[").append(getLowAddress()).append("]\n")
+                 .append("Last Address:\t[").append(getHighAddress()).append("]\n")
+                 .append("# Addresses:\t[").append(getAddressCount()).append("]\n");
+            return buf.toString();
         }
     }
 
@@ -167,7 +167,7 @@ public class SubnetUtils {
             for (int j = 0; j < cidrPart; ++j) {
                 netmask |= (1 << 31-j);
             }
-            
+
             rangeCheck(pop(netmask),0, NBITS);
 
             /* Calculate base network address */
@@ -176,7 +176,7 @@ public class SubnetUtils {
             /* Calculate broadcast address */
             broadcast = network | ~(netmask);
         }
-        else 
+        else
             throw new IllegalArgumentException("Could not parse [" + mask + "]");
     }
 
@@ -193,12 +193,12 @@ public class SubnetUtils {
     }
 
     /*
-     * Convenience method to extract the components of a dotted decimal address and 
+     * Convenience method to extract the components of a dotted decimal address and
      * pack into an integer using a regex match
      */
     private int matchAddress(Matcher matcher) {
         int addr = 0;
-        for (int i = 1; i <= 4; ++i) { 
+        for (int i = 1; i <= 4; ++i) {
             int n = (rangeCheck(Integer.parseInt(matcher.group(i)), -1, 255));
             addr |= ((n & 0xff) << 8*(4-i));
         }
@@ -223,7 +223,7 @@ public class SubnetUtils {
         for (int i =0; i < octets.length; ++i){
             str.append(octets[i]);
             if (i != octets.length - 1) {
-                str.append("."); 
+                str.append(".");
             }
         }
         return str.toString();
@@ -243,19 +243,19 @@ public class SubnetUtils {
 
     /*
      * Count the number of 1-bits in a 32-bit integer using a divide-and-conquer strategy
-     * see Hacker's Delight section 5.1 
+     * see Hacker's Delight section 5.1
      */
     int pop(int x) {
-        x = x - ((x >>> 1) & 0x55555555); 
-        x = (x & 0x33333333) + ((x >>> 2) & 0x33333333); 
-        x = (x + (x >>> 4)) & 0x0F0F0F0F; 
-        x = x + (x >>> 8); 
-        x = x + (x >>> 16); 
-        return x & 0x0000003F; 
-    } 
+        x = x - ((x >>> 1) & 0x55555555);
+        x = (x & 0x33333333) + ((x >>> 2) & 0x33333333);
+        x = (x + (x >>> 4)) & 0x0F0F0F0F;
+        x = x + (x >>> 8);
+        x = x + (x >>> 16);
+        return x & 0x0000003F;
+    }
 
     /* Convert two dotted decimal addresses to a single xxx.xxx.xxx.xxx/yy format
-     * by counting the 1-bit population in the mask address. (It may be better to count 
+     * by counting the 1-bit population in the mask address. (It may be better to count
      * NBITS-#trailing zeroes for this case)
      */
     private String toCidrNotation(String addr, String mask) {

Modified: commons/proper/net/branches/NET_2_0/src/test/java/org/apache/commons/net/SubnetUtilsTest.java
URL: http://svn.apache.org/viewvc/commons/proper/net/branches/NET_2_0/src/test/java/org/apache/commons/net/SubnetUtilsTest.java?rev=922748&r1=922747&r2=922748&view=diff
==============================================================================
--- commons/proper/net/branches/NET_2_0/src/test/java/org/apache/commons/net/SubnetUtilsTest.java (original)
+++ commons/proper/net/branches/NET_2_0/src/test/java/org/apache/commons/net/SubnetUtilsTest.java Sun Mar 14 03:23:18 2010
@@ -23,7 +23,7 @@ import org.apache.commons.net.util.Subne
 import junit.framework.TestCase;
 
 public class SubnetUtilsTest extends TestCase {
-    
+
     public void testParseSimpleNetmask() {
         final String address = "192.168.0.1";
         final String masks[] = new String[] { "255.0.0.0", "255.255.0.0", "255.255.255.0", "255.255.255.248"};
@@ -33,7 +33,7 @@ public class SubnetUtilsTest extends Tes
         final String networkAddresses[] = new String[] { "192.0.0.0", "192.168.0.0", "192.168.0.0", "192.168.0.0" };
         final String cidrSignatures[] = new String[] { "192.168.0.1/8", "192.168.0.1/16", "192.168.0.1/24", "192.168.0.1/29" };
         final int usableAddresses[] = new int[] { 16777214, 65534, 254, 6 };
-        
+
         for (int i = 0; i < masks.length; ++i) {
             SubnetUtils utils = new SubnetUtils(address, masks[i]);
             SubnetInfo info = utils.getInfo();
@@ -45,7 +45,7 @@ public class SubnetUtilsTest extends Tes
             assertEquals(usableAddresses[i], info.getAddressCount());
         }
     }
-    
+
     // TODO Lower address test
     public void testAddresses() {
         SubnetUtils utils = new SubnetUtils("192.168.0.1/29");
@@ -58,170 +58,170 @@ public class SubnetUtilsTest extends Tes
         assertFalse(info.isInRange("192.168.1.1"));
         assertFalse(info.isInRange("192.168.0.255"));
     }
-    
+
     public void testZeroNetmaskBits() {
-    	try {
-    		@SuppressWarnings("unused")
+        try {
+            @SuppressWarnings("unused")
             SubnetUtils utils = new SubnetUtils("192.168.0.1/0");
-    		fail("Mask /0 should have generated an IllegalArgumentException");
-    	}
-    	catch (IllegalArgumentException expected) {
-    	}
+            fail("Mask /0 should have generated an IllegalArgumentException");
+        }
+        catch (IllegalArgumentException expected) {
+        }
     }
-    
-    /** 
+
+    /**
      * Test using the inclusiveHostCount flag, which includes
      * the network and broadcast addresses in host counts
      */
     public void testCidrAddresses() {
-    	SubnetUtils utils = new SubnetUtils("192.168.0.1/8");
-    	utils.setInclusiveHostCount(true);
-    	SubnetInfo info = utils.getInfo();
-    	assertEquals("255.0.0.0",info.getNetmask());
-    	assertEquals(16777216, info.getAddressCount());
-
-    	utils = new SubnetUtils("192.168.0.1/9");
-    	utils.setInclusiveHostCount(true);
-    	info = utils.getInfo();
-    	assertEquals("255.128.0.0",info.getNetmask());
-    	assertEquals(8388608, info.getAddressCount());
-
-    	utils = new SubnetUtils("192.168.0.1/10");
-    	utils.setInclusiveHostCount(true);
-    	info = utils.getInfo();
-    	assertEquals("255.192.0.0",info.getNetmask());
-    	assertEquals(4194304, info.getAddressCount());
-
-    	utils = new SubnetUtils("192.168.0.1/11");
-    	utils.setInclusiveHostCount(true);
-    	info = utils.getInfo();
-    	assertEquals("255.224.0.0",info.getNetmask());
-    	assertEquals(2097152, info.getAddressCount());
-
-    	utils = new SubnetUtils("192.168.0.1/12");
-    	utils.setInclusiveHostCount(true);
-    	info = utils.getInfo();
-    	assertEquals("255.240.0.0",info.getNetmask());
-    	assertEquals(1048576, info.getAddressCount());
-
-    	utils = new SubnetUtils("192.168.0.1/13");
-    	utils.setInclusiveHostCount(true);
-    	info = utils.getInfo();
-    	assertEquals("255.248.0.0",info.getNetmask());
-    	assertEquals(524288, info.getAddressCount());
-
-    	utils = new SubnetUtils("192.168.0.1/14");
-    	utils.setInclusiveHostCount(true);
-    	info = utils.getInfo();
-    	assertEquals("255.252.0.0",info.getNetmask());
-    	assertEquals(262144, info.getAddressCount());
-
-    	utils = new SubnetUtils("192.168.0.1/15");
-    	utils.setInclusiveHostCount(true);
-    	info = utils.getInfo();
-    	assertEquals("255.254.0.0",info.getNetmask());
-    	assertEquals(131072, info.getAddressCount());
-
-    	utils = new SubnetUtils("192.168.0.1/16");
-    	utils.setInclusiveHostCount(true);
-    	info = utils.getInfo();
-    	assertEquals("255.255.0.0",info.getNetmask());
-    	assertEquals(65536, info.getAddressCount());
-
-    	utils = new SubnetUtils("192.168.0.1/17");
-    	utils.setInclusiveHostCount(true);
-    	info = utils.getInfo();
-    	assertEquals("255.255.128.0",info.getNetmask());
-    	assertEquals(32768, info.getAddressCount());
-
-    	utils = new SubnetUtils("192.168.0.1/18");
-    	utils.setInclusiveHostCount(true);
-    	info = utils.getInfo();
-    	assertEquals("255.255.192.0",info.getNetmask());
-    	assertEquals(16384, info.getAddressCount());
-
-    	utils = new SubnetUtils("192.168.0.1/19");
-    	utils.setInclusiveHostCount(true);
-    	info = utils.getInfo();
-    	assertEquals("255.255.224.0",info.getNetmask());
-    	assertEquals(8192, info.getAddressCount());
-
-    	utils = new SubnetUtils("192.168.0.1/20");
-    	utils.setInclusiveHostCount(true);
-    	info = utils.getInfo();
-    	assertEquals("255.255.240.0",info.getNetmask());
-    	assertEquals(4096, info.getAddressCount());
-
-    	utils = new SubnetUtils("192.168.0.1/21");
-    	utils.setInclusiveHostCount(true);
-    	info = utils.getInfo();
-    	assertEquals("255.255.248.0",info.getNetmask());
-    	assertEquals(2048, info.getAddressCount());
-
-    	utils = new SubnetUtils("192.168.0.1/22");
-    	utils.setInclusiveHostCount(true);
-    	info = utils.getInfo();
-    	assertEquals("255.255.252.0",info.getNetmask());
-    	assertEquals(1024, info.getAddressCount());
-
-    	utils = new SubnetUtils("192.168.0.1/23");
-    	utils.setInclusiveHostCount(true);
-    	info = utils.getInfo();
-    	assertEquals("255.255.254.0",info.getNetmask());
-    	assertEquals(512, info.getAddressCount());
-
-    	utils = new SubnetUtils("192.168.0.1/24");
-    	utils.setInclusiveHostCount(true);
-    	info = utils.getInfo();
-    	assertEquals("255.255.255.0",info.getNetmask());
-    	assertEquals(256, info.getAddressCount());
-
-    	utils = new SubnetUtils("192.168.0.1/25");
-    	utils.setInclusiveHostCount(true);
-    	info = utils.getInfo();
-    	assertEquals("255.255.255.128",info.getNetmask());
-    	assertEquals(128, info.getAddressCount());
-
-    	utils = new SubnetUtils("192.168.0.1/26");
-    	utils.setInclusiveHostCount(true);
-    	info = utils.getInfo();
-    	assertEquals("255.255.255.192",info.getNetmask());
-    	assertEquals(64, info.getAddressCount());
-
-    	utils = new SubnetUtils("192.168.0.1/27");
-    	utils.setInclusiveHostCount(true);
-    	info = utils.getInfo();
-    	assertEquals("255.255.255.224",info.getNetmask());
-    	assertEquals(32, info.getAddressCount());
-
-    	utils = new SubnetUtils("192.168.0.1/28");
-    	utils.setInclusiveHostCount(true);
-    	info = utils.getInfo();
-    	assertEquals("255.255.255.240",info.getNetmask());
-    	assertEquals(16, info.getAddressCount());
-
-    	utils = new SubnetUtils("192.168.0.1/29");
-    	utils.setInclusiveHostCount(true);
-    	info = utils.getInfo();
-    	assertEquals("255.255.255.248",info.getNetmask());
-    	assertEquals(8, info.getAddressCount());
-
-    	utils = new SubnetUtils("192.168.0.1/30");
-    	utils.setInclusiveHostCount(true);
-    	info = utils.getInfo();
-    	assertEquals("255.255.255.252",info.getNetmask());
-    	assertEquals(4, info.getAddressCount());
-
-    	utils = new SubnetUtils("192.168.0.1/31");
-    	utils.setInclusiveHostCount(true);
-    	info = utils.getInfo();
-    	assertEquals("255.255.255.254",info.getNetmask());
-    	assertEquals(2, info.getAddressCount());
-
-    	utils = new SubnetUtils("192.168.0.1/32");
-    	utils.setInclusiveHostCount(true);
-    	info = utils.getInfo();
-    	assertEquals("255.255.255.255",info.getNetmask());
-    	assertEquals(1, info.getAddressCount());
+        SubnetUtils utils = new SubnetUtils("192.168.0.1/8");
+        utils.setInclusiveHostCount(true);
+        SubnetInfo info = utils.getInfo();
+        assertEquals("255.0.0.0",info.getNetmask());
+        assertEquals(16777216, info.getAddressCount());
+
+        utils = new SubnetUtils("192.168.0.1/9");
+        utils.setInclusiveHostCount(true);
+        info = utils.getInfo();
+        assertEquals("255.128.0.0",info.getNetmask());
+        assertEquals(8388608, info.getAddressCount());
+
+        utils = new SubnetUtils("192.168.0.1/10");
+        utils.setInclusiveHostCount(true);
+        info = utils.getInfo();
+        assertEquals("255.192.0.0",info.getNetmask());
+        assertEquals(4194304, info.getAddressCount());
+
+        utils = new SubnetUtils("192.168.0.1/11");
+        utils.setInclusiveHostCount(true);
+        info = utils.getInfo();
+        assertEquals("255.224.0.0",info.getNetmask());
+        assertEquals(2097152, info.getAddressCount());
+
+        utils = new SubnetUtils("192.168.0.1/12");
+        utils.setInclusiveHostCount(true);
+        info = utils.getInfo();
+        assertEquals("255.240.0.0",info.getNetmask());
+        assertEquals(1048576, info.getAddressCount());
+
+        utils = new SubnetUtils("192.168.0.1/13");
+        utils.setInclusiveHostCount(true);
+        info = utils.getInfo();
+        assertEquals("255.248.0.0",info.getNetmask());
+        assertEquals(524288, info.getAddressCount());
+
+        utils = new SubnetUtils("192.168.0.1/14");
+        utils.setInclusiveHostCount(true);
+        info = utils.getInfo();
+        assertEquals("255.252.0.0",info.getNetmask());
+        assertEquals(262144, info.getAddressCount());
+
+        utils = new SubnetUtils("192.168.0.1/15");
+        utils.setInclusiveHostCount(true);
+        info = utils.getInfo();
+        assertEquals("255.254.0.0",info.getNetmask());
+        assertEquals(131072, info.getAddressCount());
+
+        utils = new SubnetUtils("192.168.0.1/16");
+        utils.setInclusiveHostCount(true);
+        info = utils.getInfo();
+        assertEquals("255.255.0.0",info.getNetmask());
+        assertEquals(65536, info.getAddressCount());
+
+        utils = new SubnetUtils("192.168.0.1/17");
+        utils.setInclusiveHostCount(true);
+        info = utils.getInfo();
+        assertEquals("255.255.128.0",info.getNetmask());
+        assertEquals(32768, info.getAddressCount());
+
+        utils = new SubnetUtils("192.168.0.1/18");
+        utils.setInclusiveHostCount(true);
+        info = utils.getInfo();
+        assertEquals("255.255.192.0",info.getNetmask());
+        assertEquals(16384, info.getAddressCount());
+
+        utils = new SubnetUtils("192.168.0.1/19");
+        utils.setInclusiveHostCount(true);
+        info = utils.getInfo();
+        assertEquals("255.255.224.0",info.getNetmask());
+        assertEquals(8192, info.getAddressCount());
+
+        utils = new SubnetUtils("192.168.0.1/20");
+        utils.setInclusiveHostCount(true);
+        info = utils.getInfo();
+        assertEquals("255.255.240.0",info.getNetmask());
+        assertEquals(4096, info.getAddressCount());
+
+        utils = new SubnetUtils("192.168.0.1/21");
+        utils.setInclusiveHostCount(true);
+        info = utils.getInfo();
+        assertEquals("255.255.248.0",info.getNetmask());
+        assertEquals(2048, info.getAddressCount());
+
+        utils = new SubnetUtils("192.168.0.1/22");
+        utils.setInclusiveHostCount(true);
+        info = utils.getInfo();
+        assertEquals("255.255.252.0",info.getNetmask());
+        assertEquals(1024, info.getAddressCount());
+
+        utils = new SubnetUtils("192.168.0.1/23");
+        utils.setInclusiveHostCount(true);
+        info = utils.getInfo();
+        assertEquals("255.255.254.0",info.getNetmask());
+        assertEquals(512, info.getAddressCount());
+
+        utils = new SubnetUtils("192.168.0.1/24");
+        utils.setInclusiveHostCount(true);
+        info = utils.getInfo();
+        assertEquals("255.255.255.0",info.getNetmask());
+        assertEquals(256, info.getAddressCount());
+
+        utils = new SubnetUtils("192.168.0.1/25");
+        utils.setInclusiveHostCount(true);
+        info = utils.getInfo();
+        assertEquals("255.255.255.128",info.getNetmask());
+        assertEquals(128, info.getAddressCount());
+
+        utils = new SubnetUtils("192.168.0.1/26");
+        utils.setInclusiveHostCount(true);
+        info = utils.getInfo();
+        assertEquals("255.255.255.192",info.getNetmask());
+        assertEquals(64, info.getAddressCount());
+
+        utils = new SubnetUtils("192.168.0.1/27");
+        utils.setInclusiveHostCount(true);
+        info = utils.getInfo();
+        assertEquals("255.255.255.224",info.getNetmask());
+        assertEquals(32, info.getAddressCount());
+
+        utils = new SubnetUtils("192.168.0.1/28");
+        utils.setInclusiveHostCount(true);
+        info = utils.getInfo();
+        assertEquals("255.255.255.240",info.getNetmask());
+        assertEquals(16, info.getAddressCount());
+
+        utils = new SubnetUtils("192.168.0.1/29");
+        utils.setInclusiveHostCount(true);
+        info = utils.getInfo();
+        assertEquals("255.255.255.248",info.getNetmask());
+        assertEquals(8, info.getAddressCount());
+
+        utils = new SubnetUtils("192.168.0.1/30");
+        utils.setInclusiveHostCount(true);
+        info = utils.getInfo();
+        assertEquals("255.255.255.252",info.getNetmask());
+        assertEquals(4, info.getAddressCount());
+
+        utils = new SubnetUtils("192.168.0.1/31");
+        utils.setInclusiveHostCount(true);
+        info = utils.getInfo();
+        assertEquals("255.255.255.254",info.getNetmask());
+        assertEquals(2, info.getAddressCount());
+
+        utils = new SubnetUtils("192.168.0.1/32");
+        utils.setInclusiveHostCount(true);
+        info = utils.getInfo();
+        assertEquals("255.255.255.255",info.getNetmask());
+        assertEquals(1, info.getAddressCount());
     }
 }



Mime
View raw message