harmony-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From telli...@apache.org
Subject svn commit: r493040 [7/11] - in /harmony/enhanced/classlib/trunk/modules/luni/src/main/java: java/net/ org/apache/harmony/luni/util/
Date Fri, 05 Jan 2007 14:44:06 GMT
Modified: harmony/enhanced/classlib/trunk/modules/luni/src/main/java/java/net/SocketImpl.java
URL: http://svn.apache.org/viewvc/harmony/enhanced/classlib/trunk/modules/luni/src/main/java/java/net/SocketImpl.java?view=diff&rev=493040&r1=493039&r2=493040
==============================================================================
--- harmony/enhanced/classlib/trunk/modules/luni/src/main/java/java/net/SocketImpl.java (original)
+++ harmony/enhanced/classlib/trunk/modules/luni/src/main/java/java/net/SocketImpl.java Fri Jan  5 06:44:04 2007
@@ -17,7 +17,6 @@
 
 package java.net;
 
-
 import java.io.FileDescriptor;
 import java.io.IOException;
 import java.io.InputStream;
@@ -27,7 +26,6 @@
 import org.apache.harmony.luni.platform.INetworkSystem;
 import org.apache.harmony.luni.platform.Platform;
 
-
 /**
  * The abstract superclass of all classes that implement streaming sockets.
  * 
@@ -44,462 +42,329 @@
  */
 public abstract class SocketImpl implements SocketOptions {
 
-	protected InetAddress address;
+    protected InetAddress address;
+
+    protected int port;
 
-	protected int port;
+    protected FileDescriptor fd;
 
-	protected FileDescriptor fd;
+    protected int localport;
 
-	protected int localport;
-    
     INetworkSystem netImpl;
-    
+
     int receiveTimeout;
 
     boolean streaming = true;
 
     boolean shutdownInput;
 
-//	Used when cache mode is OK
-//  Fill in the JNI id caches
-//	private static native void oneTimeInitialization(boolean jcl_supports_ipv6);
-//
-//	static {
-//		//OSNetworkSystem.oneTimeInitializationSocket(true);
-//        oneTimeInitialization(true);
-//	}
-
-	/**
-	 * Construct a connection-oriented SocketImpl.
-	 * 
-	 * @see SocketImplFactory
-	 */
-	public SocketImpl() {
-        this.netImpl = Platform.getNetworkSystem();        
-	}
-
-	/**
-	 * Accepts a connection on the provided socket.
-	 * 
-	 * @param newSocket
-	 *            the socket to accept connections on
-	 * @exception SocketException
-	 *                if an error occurs while accepting
-	 */
-	protected abstract void accept(SocketImpl newSocket) throws IOException;
-
-	/**
-	 * Answer the number of bytes that may be read from this socket without
-	 * blocking. This call does not block.
-	 * 
-	 * @return int the number of bytes that may be read without blocking
-	 * @exception SocketException
-	 *                if an error occurs while peeking
-	 */
-	protected abstract int available() throws IOException;
-
-	/**
-	 * Binds this socket to the specified local host/port.
-	 * 
-	 * @param address
-	 *            the local machine address to bind the socket to
-	 * @param port
-	 *            the port on the local machine to bind the socket to
-	 * @exception IOException
-	 *                if an error occurs while binding
-	 */
-	protected abstract void bind(InetAddress address, int port)
-			throws IOException;
-
-	/**
-	 * Close the socket. Usage thereafter is invalid.
-	 * 
-	 * @exception IOException
-	 *                if an error occurs while closing
-	 */
-	protected abstract void close() throws IOException;
-
-	/**
-	 * Connects this socket to the specified remote host/port.
-	 * 
-	 * @param host
-	 *            the remote host to connect to
-	 * @param port
-	 *            the remote port to connect to
-	 * @exception IOException
-	 *                if an error occurs while connecting
-	 */
-	protected abstract void connect(String host, int port) throws IOException;
-
-	/**
-	 * Connects this socket to the specified remote host address/port.
-	 * 
-	 * @param address
-	 *            the remote host address to connect to
-	 * @param port
-	 *            the remote port to connect to
-	 * @exception IOException
-	 *                if an error occurs while connecting
-	 */
-	protected abstract void connect(InetAddress address, int port)
-			throws IOException;
-
-	/**
-	 * Creates a new unconnected socket. If streaming is true, create a stream
-	 * socket, else a datagram socket.
-	 * 
-	 * @param isStreaming
-	 *            true, if the socket is type streaming
-	 * @exception SocketException
-	 *                if an error occurs while creating the socket
-	 */
-	protected abstract void create(boolean isStreaming) throws IOException;
-
-	/**
-	 * Answer the socket's file descriptor.
-	 * 
-	 * @return FileDescriptor the socket FileDescriptor
-	 */
-	protected FileDescriptor getFileDescriptor() {
-		return fd;
-	}
-
-	/**
-	 * Answer the socket's address. Refering to the class comment: Listener: The
-	 * local machines IP address to which this socket is bound. Host: The client
-	 * machine, to which this socket is connected. Client: The host machine, to
-	 * which this socket is connected.
-	 * 
-	 * @return InetAddress the socket address
-	 */
-	protected InetAddress getInetAddress() {
-		return address;
-	}
-
-	/**
-	 * Answer the socket input stream.
-	 * 
-	 * @return InputStream an InputStream on the socket
-	 * @exception IOException
-	 *                thrown if an error occurs while accessing the stream
-	 */
-	protected abstract InputStream getInputStream() throws IOException;
-
-	/**
-	 * Answer the socket's localport. The field is initialized to -1 and upon
-	 * demand will go to the IP stack to get the bound value. See the class
-	 * comment for the context of the local port.
-	 * 
-	 * @return int the socket localport
-	 */
-
-	protected int getLocalPort() {
-		return localport;
-	}
-
-	/**
-	 * Answer the nominated socket option.
-	 * 
-	 * @param optID
-	 *            the socket option to retrieve
-	 * @return Object the option value
-	 * @exception SocketException
-	 *                thrown if an error occurs while accessing the option
-	 */
-	public abstract Object getOption(int optID) throws SocketException;
-
-	/**
-	 * Answer the socket output stream.
-	 * 
-	 * @return OutputStream an OutputStream on the socket
-	 * @exception IOException
-	 *                thrown if an error occurs while accessing the stream
-	 */
-	protected abstract OutputStream getOutputStream() throws IOException;
-
-	/**
-	 * Answer the socket's remote port. This value is not meaningful when the
-	 * socketImpl is wrapped by a ServerSocket.
-	 * 
-	 * @return int the remote port the socket is connected to
-	 */
-	protected int getPort() {
-		return port;
-	}
-
-	/**
-	 * Listen for connection requests on this stream socket. Incoming connection
-	 * requests are queued, up to the limit nominated by backlog. Additional
-	 * requests are rejected. listen() may only be invoked on stream sockets.
-	 * 
-	 * @param backlog
-	 *            the max number of outstanding connection requests
-	 * @exception IOException
-	 *                thrown if an error occurs while listening
-	 */
-
-	protected abstract void listen(int backlog) throws IOException;
-
-    
-//	/**
-//	 * Answer the result of attempting to accept a connection request to this
-//	 * stream socket in the IP stack.
-//	 * 
-//	 * @param fdServer
-//	 *            the server socket FileDescriptor
-//	 * @param newSocket
-//	 *            the host socket a connection will be accepted on
-//	 * @param fdnewSocket
-//	 *            the FileDescriptor for the host socket
-//	 * @param timeout
-//	 *            the timeout that the server should listen for
-//	 * @exception SocketException
-//	 *                if an error occurs while accepting connections
-//	 */
-//	static native void acceptStreamSocketImpl(FileDescriptor fdServer,
-//			SocketImpl newSocket, FileDescriptor fdnewSocket, int timeout)
-//			throws IOException;
-//
-//	/**
-//	 * Answer the number of bytes available to read on the socket without
-//	 * blocking.
-//	 * 
-//	 * @param aFD
-//	 *            the socket FileDescriptor
-//	 * @exception SocketException
-//	 *                if an error occurs while peeking
-//	 */
-//	static native int availableStreamImpl(FileDescriptor aFD)
-//			throws SocketException;
-//
-//	/**
-//	 * Answer the result of attempting to create a stream socket in the IP
-//	 * stack.
-//	 * 
-//	 * @param aFD
-//	 *            the socket FileDescriptor
-//	 * @exception SocketException
-//	 *                if an error occurs while creating the socket
-//	 */
-//	static native void createStreamSocketImpl(FileDescriptor aFD,
-//			boolean preferIPv4Stack) throws SocketException;
-//
-//	/**
-//	 * Allocate a datagram socket in the IP stack. The socket is associated with
-//	 * the <code>aFD</code>.
-//	 * 
-//	 * @param aFD
-//	 *            the FileDescriptor to associate with the socket
-//	 * 
-//	 * @exception SocketException
-//	 *                upon an allocation error
-//	 */
-//
-//	static native void createDatagramSocketImpl(FileDescriptor aFD,
-//			boolean preferIPv4Stack) throws SocketException;
-//
-//	/**
-//	 * Answer the result of attempting to listen on a stream socket in the IP
-//	 * stack.
-//	 * 
-//	 * @param aFD
-//	 *            the socket FileDescriptor
-//	 * @param backlog
-//	 *            the number of connection requests that may be queued before
-//	 *            requests are rejected
-//	 * @exception SocketException
-//	 *                if an error occurs while listening
-//	 */
-//	static native void listenStreamSocketImpl(FileDescriptor aFD, int backlog)
-//			throws SocketException;
-//
-//	/**
-//	 * Recieve at most <code>count</code> bytes into the buffer
-//	 * <code>data</code> at the <code>offset</code> on the socket.
-//	 * 
-//	 * @param aFD
-//	 *            the socket FileDescriptor
-//	 * @param data
-//	 *            the receive buffer
-//	 * @param offset
-//	 *            the offset into the buffer
-//	 * @param count
-//	 *            the max number of bytes to receive
-//	 * @param timeout
-//	 *            the max time the read operation should block waiting for data
-//	 * @return int the actual number of bytes read
-//	 * @exception SocketException
-//	 *                if an error occurs while reading
-//	 */
-//	static native int receiveStreamImpl(FileDescriptor aFD, byte[] data,
-//			int offset, int count, int timeout) throws IOException;
-//
-//	/**
-//	 * Send <code>count</code> bytes from the buffer <code>data</code> at
-//	 * the <code>offset</code>, on the socket.
-//	 * 
-//	 * @param data
-//	 *            the send buffer
-//	 * @param offset
-//	 *            the offset into the buffer
-//	 * @param count
-//	 *            the number of bytes to receive
-//	 * @return int the actual number of bytes sent
-//	 * @exception SocketException
-//	 *                if an error occurs while writing
-//	 */
-//	static native int sendStreamImpl(FileDescriptor fd, byte[] data,
-//			int offset, int count) throws IOException;
-
-	/**
-	 * In the IP stack, read at most <code>count</code> bytes off the socket
-	 * into the <code>buffer</code>, at the <code>offset</code>. If the
-	 * timeout is zero, block indefinitely waiting for data, otherwise wait the
-	 * specified period (in milliseconds).
-	 * 
-	 * @param buffer
-	 *            the buffer to read into
-	 * @param offset
-	 *            the offset into the buffer
-	 * @param count
-	 *            the max number of bytes to read
-	 * @return int the actual number of bytes read
-	 * @exception IOException
-	 *                thrown if an error occurs while reading
-	 */
+    /**
+     * Construct a connection-oriented SocketImpl.
+     * 
+     * @see SocketImplFactory
+     */
+    public SocketImpl() {
+        this.netImpl = Platform.getNetworkSystem();
+    }
+
+    /**
+     * Accepts a connection on the provided socket.
+     * 
+     * @param newSocket
+     *            the socket to accept connections on
+     * @exception SocketException
+     *                if an error occurs while accepting
+     */
+    protected abstract void accept(SocketImpl newSocket) throws IOException;
 
-	int read(byte[] buffer, int offset, int count) throws IOException {
-		if (shutdownInput) {
+    /**
+     * Answer the number of bytes that may be read from this socket without
+     * blocking. This call does not block.
+     * 
+     * @return int the number of bytes that may be read without blocking
+     * @exception SocketException
+     *                if an error occurs while peeking
+     */
+    protected abstract int available() throws IOException;
+
+    /**
+     * Binds this socket to the specified local host/port.
+     * 
+     * @param address
+     *            the local machine address to bind the socket to
+     * @param port
+     *            the port on the local machine to bind the socket to
+     * @exception IOException
+     *                if an error occurs while binding
+     */
+    protected abstract void bind(InetAddress address, int port)
+            throws IOException;
+
+    /**
+     * Close the socket. Usage thereafter is invalid.
+     * 
+     * @exception IOException
+     *                if an error occurs while closing
+     */
+    protected abstract void close() throws IOException;
+
+    /**
+     * Connects this socket to the specified remote host/port.
+     * 
+     * @param host
+     *            the remote host to connect to
+     * @param port
+     *            the remote port to connect to
+     * @exception IOException
+     *                if an error occurs while connecting
+     */
+    protected abstract void connect(String host, int port) throws IOException;
+
+    /**
+     * Connects this socket to the specified remote host address/port.
+     * 
+     * @param address
+     *            the remote host address to connect to
+     * @param port
+     *            the remote port to connect to
+     * @exception IOException
+     *                if an error occurs while connecting
+     */
+    protected abstract void connect(InetAddress address, int port)
+            throws IOException;
+
+    /**
+     * Creates a new unconnected socket. If streaming is true, create a stream
+     * socket, else a datagram socket.
+     * 
+     * @param isStreaming
+     *            true, if the socket is type streaming
+     * @exception SocketException
+     *                if an error occurs while creating the socket
+     */
+    protected abstract void create(boolean isStreaming) throws IOException;
+
+    /**
+     * Answer the socket's file descriptor.
+     * 
+     * @return FileDescriptor the socket FileDescriptor
+     */
+    protected FileDescriptor getFileDescriptor() {
+        return fd;
+    }
+
+    /**
+     * Answer the socket's address. Refering to the class comment: Listener: The
+     * local machines IP address to which this socket is bound. Host: The client
+     * machine, to which this socket is connected. Client: The host machine, to
+     * which this socket is connected.
+     * 
+     * @return InetAddress the socket address
+     */
+    protected InetAddress getInetAddress() {
+        return address;
+    }
+
+    /**
+     * Answer the socket input stream.
+     * 
+     * @return InputStream an InputStream on the socket
+     * @exception IOException
+     *                thrown if an error occurs while accessing the stream
+     */
+    protected abstract InputStream getInputStream() throws IOException;
+
+    /**
+     * Answer the socket's localport. The field is initialized to -1 and upon
+     * demand will go to the IP stack to get the bound value. See the class
+     * comment for the context of the local port.
+     * 
+     * @return int the socket localport
+     */
+
+    protected int getLocalPort() {
+        return localport;
+    }
+
+    /**
+     * Answer the nominated socket option.
+     * 
+     * @param optID
+     *            the socket option to retrieve
+     * @return Object the option value
+     * @exception SocketException
+     *                thrown if an error occurs while accessing the option
+     */
+    public abstract Object getOption(int optID) throws SocketException;
+
+    /**
+     * Answer the socket output stream.
+     * 
+     * @return OutputStream an OutputStream on the socket
+     * @exception IOException
+     *                thrown if an error occurs while accessing the stream
+     */
+    protected abstract OutputStream getOutputStream() throws IOException;
+
+    /**
+     * Answer the socket's remote port. This value is not meaningful when the
+     * socketImpl is wrapped by a ServerSocket.
+     * 
+     * @return int the remote port the socket is connected to
+     */
+    protected int getPort() {
+        return port;
+    }
+
+    /**
+     * Listen for connection requests on this stream socket. Incoming connection
+     * requests are queued, up to the limit nominated by backlog. Additional
+     * requests are rejected. listen() may only be invoked on stream sockets.
+     * 
+     * @param backlog
+     *            the max number of outstanding connection requests
+     * @exception IOException
+     *                thrown if an error occurs while listening
+     */
+    protected abstract void listen(int backlog) throws IOException;
+
+    /**
+     * In the IP stack, read at most <code>count</code> bytes off the socket
+     * into the <code>buffer</code>, at the <code>offset</code>. If the
+     * timeout is zero, block indefinitely waiting for data, otherwise wait the
+     * specified period (in milliseconds).
+     * 
+     * @param buffer
+     *            the buffer to read into
+     * @param offset
+     *            the offset into the buffer
+     * @param count
+     *            the max number of bytes to read
+     * @return int the actual number of bytes read
+     * @exception IOException
+     *                thrown if an error occurs while reading
+     */
+    int read(byte[] buffer, int offset, int count) throws IOException {
+        if (shutdownInput) {
             return -1;
         }
-		try {
-//			int read = receiveStreamImpl(fd, buffer, offset, count,
-//					receiveTimeout);
+        try {
             int read = this.netImpl.receiveStream(fd, buffer, offset, count,
                     receiveTimeout);
-			if (read == -1) {
+            if (read == -1) {
                 shutdownInput = true;
             }
-			return read;
-		} catch (InterruptedIOException e) {
-			throw new SocketTimeoutException(e.getMessage());
-		}
-	}
-
-	/**
-	 * Set the nominated socket option.
-	 * 
-	 * @param optID
-	 *            the socket option to set
-	 * @param val
-	 *            the option value
-	 * @exception SocketException
-	 *                thrown if an error occurs while setting the option
-	 */
-
-	public abstract void setOption(int optID, Object val)
-			throws SocketException;
-
-	/**
-	 * Answers a string containing a concise, human-readable description of the
-	 * socket.
-	 * 
-	 * @return String the description
-	 */
-	@Override
+            return read;
+        } catch (InterruptedIOException e) {
+            throw new SocketTimeoutException(e.getMessage());
+        }
+    }
+
+    /**
+     * Set the nominated socket option.
+     * 
+     * @param optID
+     *            the socket option to set
+     * @param val
+     *            the option value
+     * @exception SocketException
+     *                thrown if an error occurs while setting the option
+     */
+    public abstract void setOption(int optID, Object val)
+            throws SocketException;
+
+    /**
+     * Answers a string containing a concise, human-readable description of the
+     * socket.
+     * 
+     * @return String the description
+     */
+    @SuppressWarnings("nls")
+    @Override
     public String toString() {
-		return new StringBuffer(100).append("Socket[addr=").append(
-				getInetAddress()).append(",port=").append(port).append(
-				",localport=").append(getLocalPort()).append("]").toString();
-	}
-
-	/**
-	 * In the IP stack, write at most <code>count</code> bytes on the socket
-	 * from the <code>buffer</code>, from the <code>offset</code>.
-	 * 
-	 * @param buffer
-	 *            the buffer to read into
-	 * @param offset
-	 *            the offset into the buffer
-	 * @param count
-	 *            the number of bytes to write
-	 * @return int the actual number of bytes written
-	 * @exception IOException
-	 *                thrown if an error occurs while writing
-	 */
-
-	int write(byte[] buffer, int offset, int count) throws IOException {
-		if (!streaming) {
-//			PlainSocketImpl2.sendDatagramImpl2(fd, buffer, offset, count, port,
-//					address);
-            this.netImpl.sendDatagram2(fd, buffer, offset, count, port,address);
-		}
-//		return sendStreamImpl(fd, buffer, offset, count);
+        return new StringBuffer(100).append("Socket[addr=").append(
+                getInetAddress()).append(",port=").append(port).append(
+                ",localport=").append(getLocalPort()).append("]").toString();
+    }
+
+    /**
+     * In the IP stack, write at most <code>count</code> bytes on the socket
+     * from the <code>buffer</code>, from the <code>offset</code>.
+     * 
+     * @param buffer
+     *            the buffer to read into
+     * @param offset
+     *            the offset into the buffer
+     * @param count
+     *            the number of bytes to write
+     * @return int the actual number of bytes written
+     * @exception IOException
+     *                thrown if an error occurs while writing
+     */
+    int write(byte[] buffer, int offset, int count) throws IOException {
+        if (!streaming) {
+            this.netImpl
+                    .sendDatagram2(fd, buffer, offset, count, port, address);
+        }
         return this.netImpl.sendStream(fd, buffer, offset, count);
-	}
+    }
 
-	/**
-	 * Shutdown the input portion of the socket.
-	 */
-	protected void shutdownInput() throws IOException {
-		shutdownInput = true;
-//		shutdownInputImpl(fd);
+    /**
+     * Shutdown the input portion of the socket.
+     */
+    protected void shutdownInput() throws IOException {
+        shutdownInput = true;
         this.netImpl.shutdownInput(fd);
-	}
-
-//	private native void shutdownInputImpl(FileDescriptor descriptor) throws IOException;
+    }
 
-	/**
-	 * Shutdown the output portion of the socket.
-	 */
-	protected void shutdownOutput() throws IOException {
-//		shutdownOutputImpl(fd);
+    /**
+     * Shutdown the output portion of the socket.
+     */
+    protected void shutdownOutput() throws IOException {
         this.netImpl.shutdownOutput(fd);
-	}
+    }
+
+    /**
+     * Connect the socket to the host/port specified by the SocketAddress with a
+     * specified timeout.
+     * 
+     * @param remoteAddr
+     *            the remote machine address and port to connect to
+     * @param timeout
+     *            the millisecond timeout value, the connect will block
+     *            indefinitely for a zero value.
+     * 
+     * @exception IOException
+     *                if a problem occurs during the connect
+     */
+    protected abstract void connect(SocketAddress remoteAddr, int timeout)
+            throws IOException;
 
-//	private native void shutdownOutputImpl(FileDescriptor descriptor)
-//			throws IOException;
+    /**
+     * Answer if the socket supports urgent data. Subclasses should override
+     * this method.
+     * 
+     * @return false, subclasses must override
+     */
+    protected boolean supportsUrgentData() {
+        return false;
+    }
+
+    /**
+     * Send the single byte of urgent data on the socket.
+     * 
+     * @param value
+     *            the byte of urgent data
+     * 
+     * @exception IOException
+     *                when an error occurs sending urgent data
+     */
+    protected abstract void sendUrgentData(int value) throws IOException;
 
-	/**
-	 * Connect the socket to the host/port specified by the SocketAddress with a
-	 * specified timeout.
-	 * 
-	 * @param remoteAddr
-	 *            the remote machine address and port to connect to
-	 * @param timeout
-	 *            the millisecond timeout value, the connect will block
-	 *            indefinitely for a zero value.
-	 * 
-	 * @exception IOException
-	 *                if a problem occurs during the connect
-	 */
-	protected abstract void connect(SocketAddress remoteAddr, int timeout)
-			throws IOException;
-
-	/**
-	 * Answer if the socket supports urgent data. Subclasses should override
-	 * this method.
-	 * 
-	 * @return false, subclasses must override
-	 */
-	protected boolean supportsUrgentData() {
-		return false;
-	}
-
-	/**
-	 * Send the single byte of urgent data on the socket.
-	 * 
-	 * @param value
-	 *            the byte of urgent data
-	 * 
-	 * @exception IOException
-	 *                when an error occurs sending urgent data
-	 */
-	protected abstract void sendUrgentData(int value) throws IOException;
-    
     /**
-     * sets performance preference for connectionTime,latency and bandwidth
-     * defaultly does nothing at all.
+     * Sets performance preference for connectionTime, latency and bandwidth.
+     * Does nothing by default.
+     * 
      * @param connectionTime
      *            the importance of connect time
      * @param latency
@@ -509,11 +374,7 @@
      */
     protected void setPerformancePreferences(int connectionTime, int latency,
             int bandwidth) {
-        // Our socket implementation only provide one protocol: TCP/IP, so 
+        // Our socket implementation only provide one protocol: TCP/IP, so
         // we do nothing for this method
     }
-    
-// static native boolean supportsUrgentDataImpl(FileDescriptor fd);
-//
-//	static native boolean sendUrgentDataImpl(FileDescriptor fd, byte value);
 }

Modified: harmony/enhanced/classlib/trunk/modules/luni/src/main/java/java/net/SocketImplFactory.java
URL: http://svn.apache.org/viewvc/harmony/enhanced/classlib/trunk/modules/luni/src/main/java/java/net/SocketImplFactory.java?view=diff&rev=493040&r1=493039&r2=493040
==============================================================================
--- harmony/enhanced/classlib/trunk/modules/luni/src/main/java/java/net/SocketImplFactory.java (original)
+++ harmony/enhanced/classlib/trunk/modules/luni/src/main/java/java/net/SocketImplFactory.java Fri Jan  5 06:44:04 2007
@@ -17,17 +17,16 @@
 
 package java.net;
 
-
 /**
  * This interface defines a factory for socket implementations. It is used by
  * the classes <code>Socket</code> and <code>ServerSocket</code> to create
  * socket implementations.
  */
 public interface SocketImplFactory {
-	/**
-	 * Creates a new <code>SocketImpl</code> instance.
-	 * 
-	 * @return SocketImpl
-	 */
-	SocketImpl createSocketImpl();
+    /**
+     * Creates a new <code>SocketImpl</code> instance.
+     * 
+     * @return SocketImpl
+     */
+    SocketImpl createSocketImpl();
 }

Modified: harmony/enhanced/classlib/trunk/modules/luni/src/main/java/java/net/SocketOptions.java
URL: http://svn.apache.org/viewvc/harmony/enhanced/classlib/trunk/modules/luni/src/main/java/java/net/SocketOptions.java?view=diff&rev=493040&r1=493039&r2=493040
==============================================================================
--- harmony/enhanced/classlib/trunk/modules/luni/src/main/java/java/net/SocketOptions.java (original)
+++ harmony/enhanced/classlib/trunk/modules/luni/src/main/java/java/net/SocketOptions.java Fri Jan  5 06:44:04 2007
@@ -80,5 +80,5 @@
 	 * @exception SocketException
 	 *                thrown if an error occurs setting the option
 	 */
-	public void setOption(int optID, Object val) throws SocketException;
+    public void setOption(int optID, Object val) throws SocketException;
 }

Modified: harmony/enhanced/classlib/trunk/modules/luni/src/main/java/java/net/SocketPermission.java
URL: http://svn.apache.org/viewvc/harmony/enhanced/classlib/trunk/modules/luni/src/main/java/java/net/SocketPermission.java?view=diff&rev=493040&r1=493039&r2=493040
==============================================================================
--- harmony/enhanced/classlib/trunk/modules/luni/src/main/java/java/net/SocketPermission.java (original)
+++ harmony/enhanced/classlib/trunk/modules/luni/src/main/java/java/net/SocketPermission.java Fri Jan  5 06:44:04 2007
@@ -17,7 +17,6 @@
 
 package java.net;
 
-
 import java.io.IOException;
 import java.io.ObjectInputStream;
 import java.io.ObjectOutputStream;
@@ -59,94 +58,94 @@
  * 
  * represents permission to connect to and accept connections from
  * www.company.com on ports in the range 7000 to 65535.
- * 
  */
 public final class SocketPermission extends Permission implements Serializable {
 
-	private static final long serialVersionUID = -7204263841984476862L;
+    private static final long serialVersionUID = -7204263841984476862L;
 
-	// Bit masks for each of the possible actions
-	static final int SP_CONNECT = 1;
+    // Bit masks for each of the possible actions
+    static final int SP_CONNECT = 1;
 
-	static final int SP_LISTEN = 2;
+    static final int SP_LISTEN = 2;
 
-	static final int SP_ACCEPT = 4;
+    static final int SP_ACCEPT = 4;
 
-	static final int SP_RESOLVE = 8;
+    static final int SP_RESOLVE = 8;
 
-	// list of actions permitted for socket permission in order, indexed by mask
-	// value
-	private static final String[] actionNames = { "", "connect", "listen", "",
-			"accept", "", "", "", "resolve" };
+    // list of actions permitted for socket permission in order, indexed by mask
+    // value
+    @SuppressWarnings("nls")
+    private static final String[] actionNames = { "", "connect", "listen", "",
+            "accept", "", "", "", "resolve" };
 
-	// If a wildcard is present store the information
-	private transient boolean isPartialWild;
+    // If a wildcard is present store the information
+    private transient boolean isPartialWild;
 
-	private transient boolean isWild;
+    private transient boolean isWild;
 
-	// The highest port number
-	private static final int HIGHEST_PORT = 65535;
+    // The highest port number
+    private static final int HIGHEST_PORT = 65535;
 
-	// The lowest port number
-	private static final int LOWEST_PORT = 0;
+    // The lowest port number
+    private static final int LOWEST_PORT = 0;
 
-	transient String hostName; // Host name as returned by InetAddress
+    transient String hostName; // Host name as returned by InetAddress
 
-	transient String ipString; // IP address as returned by InetAddress
+    transient String ipString; // IP address as returned by InetAddress
 
-	transient boolean resolved; // IP address has been resolved
+    transient boolean resolved; // IP address has been resolved
 
-	// the port range;
-	transient int portMin = LOWEST_PORT;
+    // the port range;
+    transient int portMin = LOWEST_PORT;
 
-	transient int portMax = HIGHEST_PORT;
+    transient int portMax = HIGHEST_PORT;
 
-	private String actions; // List of all actions allowed by this permission
+    private String actions; // List of all actions allowed by this permission
 
-	transient int actionsMask = SP_RESOLVE;
+    transient int actionsMask = SP_RESOLVE;
 
-	/**
-	 * Constructs an instance of this class. The host name can be a DNS name, an
-	 * individual hostname, an ip address or the empty string which implies
-	 * localhost. The port or port range is optional.
-	 * <p>
-	 * The action list is a comma-seperated list which can consist of "connect",
-	 * "listen", "accept", and "resolve". They are case-insensitive and can be
-	 * put together in any order. "resolve" is always implied.
-	 * 
-	 * @param host
-	 *            java.lang.String the host name
-	 * @param action
-	 *            java.lang.String the action string
-	 */
-	public SocketPermission(String host, String action) {
-		super(host.equals("") ? "localhost" : host);
-		hostName = getHostString(host);
-		if (action == null) {
+    /**
+     * Constructs an instance of this class. The host name can be a DNS name, an
+     * individual hostname, an ip address or the empty string which implies
+     * localhost. The port or port range is optional.
+     * <p>
+     * The action list is a comma-seperated list which can consist of "connect",
+     * "listen", "accept", and "resolve". They are case-insensitive and can be
+     * put together in any order. "resolve" is always implied.
+     * 
+     * @param host
+     *            java.lang.String the host name
+     * @param action
+     *            java.lang.String the action string
+     */
+    public SocketPermission(String host, String action) {
+        super(host.equals("") ? "localhost" : host); //$NON-NLS-1$ //$NON-NLS-2$
+        hostName = getHostString(host);
+        if (action == null) {
             throw new NullPointerException();
         }
-		if (action.equals("")) {
+        if (action.equals("")) { //$NON-NLS-1$
             throw new IllegalArgumentException();
         }
 
-		setActions(action);
-		actions = toCanonicalActionString(action);
-		parsePort(host); // Use host since we are only checking for port
-		// presence
-	}
-
-	/**
-	 * Compares the argument to the receiver, and answers true if they represent
-	 * the equal objects using a class specific comparison.
-	 * <p>
-	 * 
-	 * @param o
-	 *            the object to compare with this object
-	 * @return <code>true</code> if the object is the same as this object
-	 *         <code>false</code> if it is different from this object
-	 * @see #hashCode
-	 */
-	@Override
+        setActions(action);
+        actions = toCanonicalActionString(action);
+        // Use host since we are only checking for port presence
+        parsePort(host);
+    }
+
+    /**
+     * Compares the argument to the receiver, and answers true if they represent
+     * the equal objects using a class specific comparison.
+     * <p>
+     * 
+     * @param o
+     *            the object to compare with this object
+     * @return <code>true</code> if the object is the same as this object
+     *         <code>false</code> if it is different from this object
+     * @see #hashCode
+     */
+    @Override
     public boolean equals(Object o) {
         if (this == o) {
             return true;
@@ -154,157 +153,158 @@
         if (o == null || this.getClass() != o.getClass()) {
             return false;
         }
-		SocketPermission sp = (SocketPermission) o;
-		if (!hostName.equals(sp.hostName)) {
-			if (getIPString() == null || !ipString.equals(sp.getIPString())) {
+        SocketPermission sp = (SocketPermission) o;
+        if (!hostName.equals(sp.hostName)) {
+            if (getIPString() == null || !ipString.equals(sp.getIPString())) {
                 return false;
             }
-		}
-		if (this.portMin != sp.portMin) {
+        }
+        if (this.portMin != sp.portMin) {
             return false;
         }
-		if (this.portMax != sp.portMax) {
+        if (this.portMax != sp.portMax) {
             return false;
         }
-		return this.actionsMask == sp.actionsMask;
-	}
+        return this.actionsMask == sp.actionsMask;
+    }
 
-	/**
-	 * Answers an integer hash code for the receiver. Any two objects which
-	 * answer <code>true</code> when passed to <code>.equals</code> must
-	 * answer the same value for this method.
-	 * 
-	 * @return int the receiver's hash.
-	 * 
-	 * @see #equals
-	 */
-	@Override
+    /**
+     * Answers an integer hash code for the receiver. Any two objects which
+     * answer <code>true</code> when passed to <code>.equals</code> must
+     * answer the same value for this method.
+     * 
+     * @return int the receiver's hash.
+     * 
+     * @see #equals
+     */
+    @Override
     public int hashCode() {
-		return hostName.hashCode() ^ actionsMask ^ portMin ^ portMax;
-	}
+        return hostName.hashCode() ^ actionsMask ^ portMin ^ portMax;
+    }
 
-	/**
-	 * Answers the canonical action list of this SocketPermission in the order:
-	 * connect, listen, accept, resolve.
-	 * 
-	 * @return java.lang.String the canonical action list
-	 */
-	@Override
+    /**
+     * Answers the canonical action list of this SocketPermission in the order:
+     * connect, listen, accept, resolve.
+     * 
+     * @return java.lang.String the canonical action list
+     */
+    @Override
     public String getActions() {
-		return actions;
-	}
+        return actions;
+    }
 
-	/**
-	 * Stores the actions for this permission as a bit field
-	 * 
-	 * @param actions
-	 *            java.lang.String the action list
-	 */
-	private void setActions(String actions) throws IllegalArgumentException {
-		if (actions.equals("")) {
+    /**
+     * Stores the actions for this permission as a bit field
+     * 
+     * @param actions
+     *            java.lang.String the action list
+     */
+    private void setActions(String actions) throws IllegalArgumentException {
+        if (actions.equals("")) { //$NON-NLS-1$
             return;
         }
-		boolean parsing = true;
-		String action;
-		StringBuffer sb = new StringBuffer();
-		int pos = 0, length = actions.length();
-		while (parsing) {
-			char c;
-			sb.setLength(0);
-			while (pos < length && (c = actions.charAt(pos++)) != ',') {
+        boolean parsing = true;
+        String action;
+        StringBuffer sb = new StringBuffer();
+        int pos = 0, length = actions.length();
+        while (parsing) {
+            char c;
+            sb.setLength(0);
+            while (pos < length && (c = actions.charAt(pos++)) != ',') {
                 sb.append(c);
             }
-			if (pos == length) {
+            if (pos == length) {
                 parsing = false;
             }
-			action = sb.toString().trim().toLowerCase();
-			if (action.equals(actionNames[SP_CONNECT])) {
+            action = sb.toString().trim().toLowerCase();
+            if (action.equals(actionNames[SP_CONNECT])) {
                 actionsMask |= SP_CONNECT;
             } else if (action.equals(actionNames[SP_LISTEN])) {
                 actionsMask |= SP_LISTEN;
             } else if (action.equals(actionNames[SP_ACCEPT])) {
                 actionsMask |= SP_ACCEPT;
             } else if (action.equals(actionNames[SP_RESOLVE])) {
-			} else {
-                throw new IllegalArgumentException(Msg.getString("K0048", action));
+            } else {
+                throw new IllegalArgumentException(Msg.getString("K0048", //$NON-NLS-1$
+                        action));
             }
-		}
-	}
+        }
+    }
 
-	/**
-	 * Check the permission to see if the actions requested by the argument
-	 * permission are permissable. All argument permission actions, host and
-	 * port must be implied by this permission in order to return true. This
-	 * permission may imply additional actions etc. not present in the argument
-	 * permission.
-	 * 
-	 * @return boolean true if this permission implies <code>p</code>, and
-	 *         false otherwise
-	 * @param p
-	 *            java.security.Permission the other socket permission
-	 */
-	@Override
+    /**
+     * Check the permission to see if the actions requested by the argument
+     * permission are permissable. All argument permission actions, host and
+     * port must be implied by this permission in order to return true. This
+     * permission may imply additional actions etc. not present in the argument
+     * permission.
+     * 
+     * @return boolean true if this permission implies <code>p</code>, and
+     *         false otherwise
+     * @param p
+     *            java.security.Permission the other socket permission
+     */
+    @Override
     public boolean implies(Permission p) {
-		SocketPermission sp;
-		try {
-			sp = (SocketPermission) p;
-		} catch (ClassCastException e) {
-			return false;
-		}
+        SocketPermission sp;
+        try {
+            sp = (SocketPermission) p;
+        } catch (ClassCastException e) {
+            return false;
+        }
 
-		// tests if the action list of p is the subset of the one of the
-		// receiver
+        // tests if the action list of p is the subset of the one of the
+        // receiver
         if (sp == null || (actionsMask & sp.actionsMask) != sp.actionsMask) {
             return false;
         }
 
-		// only check the port range if the action string of the current object
-		// is not "resolve"
-		if (!p.getActions().equals("resolve")) {
+        // only check the port range if the action string of the current object
+        // is not "resolve"
+        if (!p.getActions().equals("resolve")) { //$NON-NLS-1$
             if ((sp.portMin < this.portMin) || (sp.portMax > this.portMax)) {
                 return false;
             }
         }
 
-		// Verify the host is valid
-		return checkHost(sp);
-	}
-
-	/**
-	 * Answers a PermissionCollection for storing SocketPermission objects.
-	 * 
-	 * @return java.security.PermissionCollection a permission collection
-	 */
-	@Override
+        // Verify the host is valid
+        return checkHost(sp);
+    }
+
+    /**
+     * Answers a PermissionCollection for storing SocketPermission objects.
+     * 
+     * @return java.security.PermissionCollection a permission collection
+     */
+    @Override
     public PermissionCollection newPermissionCollection() {
-		return new SocketPermissionCollection();
-	}
+        return new SocketPermissionCollection();
+    }
 
-	/**
-	 * Parses the port string into the lower and higher bound of the port range.
-	 * 
-	 */
-	private void parsePort(String hostString) throws IllegalArgumentException {
-		int negidx = -1;
-		int len = -1;
-		int lastIdx = hostString.lastIndexOf(':');
-		int idx = hostString.indexOf(':');
-		int endOfIPv6Addr = hostString.lastIndexOf(']');
-		if ((endOfIPv6Addr == -1) && (idx != lastIdx)) {
-			// there are no square braces, but there are more than one ':' which
-			// implies an IPv6 address with no port, or an illegal argument
-			// check for valid IPv6 address
-			if (Inet6Util.isValidIP6Address(hostString)) {
-				return;
-			}
-			// throw an invalid argument exception
-			throw new IllegalArgumentException(Msg.getString("K004a"));
-		}
-		// if there is a colon and it occurs after the ']' then there is a port
-		// to be parsed
-		if ((lastIdx > -1) && (lastIdx > endOfIPv6Addr)) {
-			try {
-				len = hostString.length();
+    /**
+     * Parses the port string into the lower and higher bound of the port range.
+     * 
+     */
+    private void parsePort(String hostString) throws IllegalArgumentException {
+        int negidx = -1;
+        int len = -1;
+        int lastIdx = hostString.lastIndexOf(':');
+        int idx = hostString.indexOf(':');
+        int endOfIPv6Addr = hostString.lastIndexOf(']');
+        if ((endOfIPv6Addr == -1) && (idx != lastIdx)) {
+            // there are no square braces, but there are more than one ':' which
+            // implies an IPv6 address with no port, or an illegal argument
+            // check for valid IPv6 address
+            if (Inet6Util.isValidIP6Address(hostString)) {
+                return;
+            }
+            // throw an invalid argument exception
+            throw new IllegalArgumentException(Msg.getString("K004a")); //$NON-NLS-1$
+        }
+        // if there is a colon and it occurs after the ']' then there is a port
+        // to be parsed
+        if ((lastIdx > -1) && (lastIdx > endOfIPv6Addr)) {
+            try {
+                len = hostString.length();
                 // if hostString ends with ":*", such as "localhost:*"
                 // the port range should be 0-65535
                 if (hostString.endsWith(":*")) { //$NON-NLS-1$
@@ -312,152 +312,151 @@
                     portMax = 65535;
                     return;
                 }
-				// look for a '-' after the colon
-				negidx = hostString.indexOf('-', lastIdx);
-				if (negidx == lastIdx + 1) {
-					portMax = Integer.parseInt(hostString.substring(
-							lastIdx + 2, len));
-				} else {
-					// A port range was provided
-					if (negidx != -1 && (negidx != len - 1)) {
-						portMin = Integer.parseInt(hostString.substring(
-								lastIdx + 1, negidx));
-						portMax = Integer.parseInt(hostString.substring(
-								negidx + 1, len));
-					} else {
-						if (negidx == -1) {
-							portMin = Integer.parseInt(hostString.substring(
-									lastIdx + 1, len));
-							portMax = portMin;
-						} else {
-							portMin = Integer.parseInt(hostString.substring(
-									lastIdx + 1, negidx));
-						}
-					}
-				}
-				if (portMax < portMin) {
-                    throw new IllegalArgumentException(Msg.getString("K0049"));
+                // look for a '-' after the colon
+                negidx = hostString.indexOf('-', lastIdx);
+                if (negidx == lastIdx + 1) {
+                    portMax = Integer.parseInt(hostString.substring(
+                            lastIdx + 2, len));
+                } else {
+                    // A port range was provided
+                    if (negidx != -1 && (negidx != len - 1)) {
+                        portMin = Integer.parseInt(hostString.substring(
+                                lastIdx + 1, negidx));
+                        portMax = Integer.parseInt(hostString.substring(
+                                negidx + 1, len));
+                    } else {
+                        if (negidx == -1) {
+                            portMin = Integer.parseInt(hostString.substring(
+                                    lastIdx + 1, len));
+                            portMax = portMin;
+                        } else {
+                            portMin = Integer.parseInt(hostString.substring(
+                                    lastIdx + 1, negidx));
+                        }
+                    }
+                }
+                if (portMax < portMin) {
+                    throw new IllegalArgumentException(Msg.getString("K0049")); //$NON-NLS-1$
                 }
 
-			} catch (NumberFormatException e) {
-				throw new IllegalArgumentException(Msg.getString("K004a"));
-			}
-		}
-	}
-
-	/**
-	 * Creates a canonical action list.
-	 * 
-	 * @param action
-	 *            java.lang.String
-	 * 
-	 * @return java.lang.String
-	 */
-	private String toCanonicalActionString(String action) {
-		if (action == null || action.equals("") || actionsMask == SP_RESOLVE) {
+            } catch (NumberFormatException e) {
+                throw new IllegalArgumentException(Msg.getString("K004a")); //$NON-NLS-1$
+            }
+        }
+    }
+
+    /**
+     * Creates a canonical action list.
+     * 
+     * @param action
+     *            java.lang.String
+     * 
+     * @return java.lang.String
+     */
+    private String toCanonicalActionString(String action) {
+        if (action == null || action.equals("") || actionsMask == SP_RESOLVE) { //$NON-NLS-1$
             return actionNames[SP_RESOLVE]; // If none specified return the
         }
-		// implied action resolve
-		StringBuffer sb = new StringBuffer();
-		if ((actionsMask & SP_CONNECT) == SP_CONNECT) {
-			sb.append(',');
-			sb.append(actionNames[SP_CONNECT]);
-		}
-		if ((actionsMask & SP_LISTEN) == SP_LISTEN) {
-			sb.append(',');
-			sb.append(actionNames[SP_LISTEN]);
-		}
-		if ((actionsMask & SP_ACCEPT) == SP_ACCEPT) {
-			sb.append(',');
-			sb.append(actionNames[SP_ACCEPT]);
-		}
-		sb.append(',');
-		sb.append(actionNames[SP_RESOLVE]);// Resolve is always implied
-		// Don't copy the first ','.
-		return actions = sb.substring(1, sb.length());
-	}
-
-	private String getIPString() {
-		if (!resolved) {
-			try {
-				ipString = InetAddress.getHostNameInternal(hostName);
-			} catch (UnknownHostException e) {
-			}
-			resolved = true;
-		}
-		return ipString;
-	}
-
-	private String getHostString(String host) throws IllegalArgumentException {
-		int idx = -1;
-		idx = host.indexOf(':');
-		isPartialWild = (host.length() > 0 && host.charAt(0) == '*');
-		if (isPartialWild) {
-			resolved = true;
-			isWild = (host.length() == 1);
-			if (isWild) {
-				return host;
-			}
-			if (idx > -1) {
-				host = host.substring(0, idx);
-			}
-			return host.toLowerCase();
-		}
-
-		int lastIdx = host.lastIndexOf(':');
-		if ((idx > -1) && (idx == lastIdx)) {
-			host = host.substring(0, idx);
-		} else {
-			// likely host is or contains an IPv6 address
-			if (lastIdx != -1) {
-				if (Inet6Util.isValidIP6Address(host)) {
-					return host.toLowerCase();
-				} else if (Inet6Util.isValidIP6Address(host.substring(0,
-						lastIdx))) {
-					host = host.substring(0, lastIdx);
-				} else {
-					throw new IllegalArgumentException(Msg.getString("K004a"));
-				}
-			}
-		}
-		return host.toLowerCase();
-	}
-
-	/*
-	 * Determines whether or not this permission could refer to the same host as
-	 * sp
-	 */
-	boolean checkHost(SocketPermission sp) {
-		if (isPartialWild) {
-			if (isWild) {
-                return true; // Match on any host
+        // implied action resolve
+        StringBuffer sb = new StringBuffer();
+        if ((actionsMask & SP_CONNECT) == SP_CONNECT) {
+            sb.append(',');
+            sb.append(actionNames[SP_CONNECT]);
+        }
+        if ((actionsMask & SP_LISTEN) == SP_LISTEN) {
+            sb.append(',');
+            sb.append(actionNames[SP_LISTEN]);
+        }
+        if ((actionsMask & SP_ACCEPT) == SP_ACCEPT) {
+            sb.append(',');
+            sb.append(actionNames[SP_ACCEPT]);
+        }
+        sb.append(',');
+        sb.append(actionNames[SP_RESOLVE]);// Resolve is always implied
+        // Don't copy the first ','.
+        return actions = sb.substring(1, sb.length());
+    }
+
+    private String getIPString() {
+        if (!resolved) {
+            try {
+                ipString = InetAddress.getHostNameInternal(hostName);
+            } catch (UnknownHostException e) {
+            }
+            resolved = true;
+        }
+        return ipString;
+    }
+
+    private String getHostString(String host) throws IllegalArgumentException {
+        int idx = -1;
+        idx = host.indexOf(':');
+        isPartialWild = (host.length() > 0 && host.charAt(0) == '*');
+        if (isPartialWild) {
+            resolved = true;
+            isWild = (host.length() == 1);
+            if (isWild) {
+                return host;
+            }
+            if (idx > -1) {
+                host = host.substring(0, idx);
+            }
+            return host.toLowerCase();
+        }
+
+        int lastIdx = host.lastIndexOf(':');
+        if ((idx > -1) && (idx == lastIdx)) {
+            host = host.substring(0, idx);
+        } else {
+            // likely host is or contains an IPv6 address
+            if (lastIdx != -1) {
+                if (Inet6Util.isValidIP6Address(host)) {
+                    return host.toLowerCase();
+                } else if (Inet6Util.isValidIP6Address(host.substring(0,
+                        lastIdx))) {
+                    host = host.substring(0, lastIdx);
+                } else {
+                    throw new IllegalArgumentException(Msg.getString("K004a")); //$NON-NLS-1$
+                }
             }
-			int length = hostName.length() - 1;
-			return sp.hostName.regionMatches(sp.hostName.length() - length,
-					hostName, 1, length);
-		}
-		// The ipString may not be the same, some hosts resolve to
-		// multiple ips
-		return (getIPString() != null && ipString.equals(sp.getIPString()))
-				|| hostName.equals(sp.hostName);
-	}
-
-	private void writeObject(ObjectOutputStream stream) throws IOException {
-		stream.defaultWriteObject();
-	}
-
-	private void readObject(ObjectInputStream stream) throws IOException,
-			ClassNotFoundException {
-		stream.defaultReadObject();
-		// Initialize locals
-		isPartialWild = false;
-		isWild = false;
-		portMin = LOWEST_PORT;
-		portMax = HIGHEST_PORT;
-		actionsMask = SP_RESOLVE;
-		hostName = getHostString(getName());
-		parsePort(getName());
-		setActions(actions);
-	}
+        }
+        return host.toLowerCase();
+    }
 
+    /*
+     * Determines whether or not this permission could refer to the same host as
+     * sp
+     */
+    boolean checkHost(SocketPermission sp) {
+        if (isPartialWild) {
+            if (isWild) {
+                return true; // Match on any host
+            }
+            int length = hostName.length() - 1;
+            return sp.hostName.regionMatches(sp.hostName.length() - length,
+                    hostName, 1, length);
+        }
+        // The ipString may not be the same, some hosts resolve to
+        // multiple ips
+        return (getIPString() != null && ipString.equals(sp.getIPString()))
+                || hostName.equals(sp.hostName);
+    }
+
+    private void writeObject(ObjectOutputStream stream) throws IOException {
+        stream.defaultWriteObject();
+    }
+
+    private void readObject(ObjectInputStream stream) throws IOException,
+            ClassNotFoundException {
+        stream.defaultReadObject();
+        // Initialize locals
+        isPartialWild = false;
+        isWild = false;
+        portMin = LOWEST_PORT;
+        portMax = HIGHEST_PORT;
+        actionsMask = SP_RESOLVE;
+        hostName = getHostString(getName());
+        parsePort(getName());
+        setActions(actions);
+    }
 }

Modified: harmony/enhanced/classlib/trunk/modules/luni/src/main/java/java/net/SocketPermissionCollection.java
URL: http://svn.apache.org/viewvc/harmony/enhanced/classlib/trunk/modules/luni/src/main/java/java/net/SocketPermissionCollection.java?view=diff&rev=493040&r1=493039&r2=493040
==============================================================================
--- harmony/enhanced/classlib/trunk/modules/luni/src/main/java/java/net/SocketPermissionCollection.java (original)
+++ harmony/enhanced/classlib/trunk/modules/luni/src/main/java/java/net/SocketPermissionCollection.java Fri Jan  5 06:44:04 2007
@@ -28,70 +28,71 @@
  * specific permissions is implied by a SocketPermissionCollection.
  */
 final class SocketPermissionCollection extends PermissionCollection {
-	
-	private static final long serialVersionUID = 2787186408602843674L;
 
-	private Vector<Permission> permissions = new Vector<Permission>();
+    private static final long serialVersionUID = 2787186408602843674L;
 
-	// Constructs a new instance of this class.
-	public SocketPermissionCollection() {
-		super();
-	}
+    private Vector<Permission> permissions = new Vector<Permission>();
 
-	// Adds the argument to the collection.
-	@Override
+    // Constructs a new instance of this class.
+    public SocketPermissionCollection() {
+        super();
+    }
+
+    // Adds the argument to the collection.
+    @Override
     public void add(Permission permission) {
-		if (isReadOnly()) {
+        if (isReadOnly()) {
             throw new IllegalStateException();
         }
-		if (!(permission instanceof SocketPermission)) {
+        if (!(permission instanceof SocketPermission)) {
             throw new IllegalArgumentException(permission.toString());
         }
-		permissions.addElement(permission);
-	}
+        permissions.addElement(permission);
+    }
 
-	// Answers an enumeration of the permissions
-	@Override
+    // Answers an enumeration of the permissions
+    @Override
     public Enumeration<Permission> elements() {
-		return permissions.elements();
-	}
+        return permissions.elements();
+    }
 
-	/** Answers if this permission collection implies <code>permission</code>.
-	 * Basically it tests
-	 * if <code>permission</code> is the subset of this collection.
-	 * */
-	@Override
+    /**
+     * Answers if this permission collection implies <code>permission</code>.
+     * Basically it tests if <code>permission</code> is the subset of this
+     * collection.
+     */
+    @Override
     public boolean implies(Permission permission) {
-		if (!(permission instanceof SocketPermission)) {
+        if (!(permission instanceof SocketPermission)) {
             return false;
         }
-		SocketPermission sp, argPerm = (SocketPermission) permission;
-		int pmask = argPerm.actionsMask;
-		int allMask = 0;
-		int i = 0, count = permissions.size();
-		while ((i < count) && ((allMask & pmask) != pmask)) {
-			sp = (SocketPermission) permissions.elementAt(i);
-			if (sp.checkHost(argPerm)) {
-				if ((sp.actionsMask & SocketPermission.SP_RESOLVE) == SocketPermission.SP_RESOLVE) {
+        SocketPermission sp, argPerm = (SocketPermission) permission;
+        int pmask = argPerm.actionsMask;
+        int allMask = 0;
+        int i = 0, count = permissions.size();
+        while ((i < count) && ((allMask & pmask) != pmask)) {
+            sp = (SocketPermission) permissions.elementAt(i);
+            if (sp.checkHost(argPerm)) {
+                if ((sp.actionsMask & SocketPermission.SP_RESOLVE) == SocketPermission.SP_RESOLVE) {
                     allMask |= SocketPermission.SP_RESOLVE;
                 }
-				// Only set flags if the port range and host can be implied
-				if ((argPerm.portMin >= sp.portMin)
-						&& (argPerm.portMax <= sp.portMax)) {
-					if ((sp.actionsMask & SocketPermission.SP_CONNECT) == SocketPermission.SP_CONNECT) {
+                // Only set flags if the port range and host can be implied
+                if ((argPerm.portMin >= sp.portMin)
+                        && (argPerm.portMax <= sp.portMax)) {
+                    if ((sp.actionsMask & SocketPermission.SP_CONNECT) == SocketPermission.SP_CONNECT) {
                         allMask |= SocketPermission.SP_CONNECT;
                     }
-					if ((sp.actionsMask & SocketPermission.SP_ACCEPT) == SocketPermission.SP_ACCEPT) {
+                    if ((sp.actionsMask & SocketPermission.SP_ACCEPT) == SocketPermission.SP_ACCEPT) {
                         allMask |= SocketPermission.SP_ACCEPT;
                     }
-					if ((sp.actionsMask & SocketPermission.SP_LISTEN) == SocketPermission.SP_LISTEN) {
+                    if ((sp.actionsMask & SocketPermission.SP_LISTEN) == SocketPermission.SP_LISTEN) {
                         allMask |= SocketPermission.SP_LISTEN;
                     }
-				}
-			}
-			++i;
-		}
+                }
+            }
+            ++i;
+        }
 
-		return (allMask & pmask) == pmask;
-	}
+        return (allMask & pmask) == pmask;
+    }
 }

Modified: harmony/enhanced/classlib/trunk/modules/luni/src/main/java/java/net/SocketTimeoutException.java
URL: http://svn.apache.org/viewvc/harmony/enhanced/classlib/trunk/modules/luni/src/main/java/java/net/SocketTimeoutException.java?view=diff&rev=493040&r1=493039&r2=493040
==============================================================================
--- harmony/enhanced/classlib/trunk/modules/luni/src/main/java/java/net/SocketTimeoutException.java (original)
+++ harmony/enhanced/classlib/trunk/modules/luni/src/main/java/java/net/SocketTimeoutException.java Fri Jan  5 06:44:04 2007
@@ -17,7 +17,6 @@
 
 package java.net;
 
-
 import java.io.InterruptedIOException;
 
 public class SocketTimeoutException extends InterruptedIOException {
@@ -25,20 +24,20 @@
     private static final long serialVersionUID = -8846654841826352300L;
 
     /**
-	 * Constructs a new instance of this class with its walkback filled in.
-	 */
-	public SocketTimeoutException() {
-		super();
-	}
+     * Constructs a new instance of this class with its walkback filled in.
+     */
+    public SocketTimeoutException() {
+        super();
+    }
 
-	/**
-	 * Constructs a new instance of this class with its walkback and message
-	 * filled in.
-	 * 
-	 * @param detailMessage
-	 *            String The detail message for the exception.
-	 */
-	public SocketTimeoutException(String detailMessage) {
-		super(detailMessage);
-	}
+    /**
+     * Constructs a new instance of this class with its walkback and message
+     * filled in.
+     * 
+     * @param detailMessage
+     *            String The detail message for the exception.
+     */
+    public SocketTimeoutException(String detailMessage) {
+        super(detailMessage);
+    }
 }

Modified: harmony/enhanced/classlib/trunk/modules/luni/src/main/java/java/net/URI.java
URL: http://svn.apache.org/viewvc/harmony/enhanced/classlib/trunk/modules/luni/src/main/java/java/net/URI.java?view=diff&rev=493040&r1=493039&r2=493040
==============================================================================
--- harmony/enhanced/classlib/trunk/modules/luni/src/main/java/java/net/URI.java (original)
+++ harmony/enhanced/classlib/trunk/modules/luni/src/main/java/java/net/URI.java Fri Jan  5 06:44:04 2007
@@ -421,8 +421,9 @@
                         tempPort = Integer.parseInt(temp.substring(index + 1));
                         if (tempPort < 0) {
                             if (forceServer) {
-                                throw new URISyntaxException(authority, Msg
-                                        .getString("K00b1"), hostindex + index + 1); //$NON-NLS-1$
+                                throw new URISyntaxException(
+                                        authority,
+                                        Msg.getString("K00b1"), hostindex + index + 1); //$NON-NLS-1$
                             }
                             return;
                         }
@@ -1257,9 +1258,9 @@
         if (path.equals(normalizedPath)) {
             return this;
         }
-        URI result = duplicate(); // get an exact copy of the URI
-        // re-calculate the scheme specific part since
-        // the path of the normalized URI is different from this URI.
+        // get an exact copy of the URI re-calculate the scheme specific part
+        // since the path of the normalized URI is different from this URI.
+        URI result = duplicate();
         result.path = normalizedPath;
         result.setSchemeSpecificPart();
         return result;
@@ -1544,4 +1545,4 @@
         toString();
         out.defaultWriteObject();
     }
-}
\ No newline at end of file
+}

Modified: harmony/enhanced/classlib/trunk/modules/luni/src/main/java/java/net/URIEncoderDecoder.java
URL: http://svn.apache.org/viewvc/harmony/enhanced/classlib/trunk/modules/luni/src/main/java/java/net/URIEncoderDecoder.java?view=diff&rev=493040&r1=493039&r2=493040
==============================================================================
--- harmony/enhanced/classlib/trunk/modules/luni/src/main/java/java/net/URIEncoderDecoder.java (original)
+++ harmony/enhanced/classlib/trunk/modules/luni/src/main/java/java/net/URIEncoderDecoder.java Fri Jan  5 06:44:04 2007
@@ -17,7 +17,6 @@
 
 package java.net;
 
-
 import java.io.ByteArrayOutputStream;
 import java.io.UnsupportedEncodingException;
 
@@ -32,192 +31,194 @@
  */
 class URIEncoderDecoder {
 
-	static final String digits = "0123456789ABCDEF";
+    static final String digits = "0123456789ABCDEF"; //$NON-NLS-1$
 
-	static final String encoding = "UTF8";
+    static final String encoding = "UTF8"; //$NON-NLS-1$
 
-	/**
-	 * Validate a string by checking if it contains any characters other than:
-	 * 
-	 * 1. letters ('a'..'z', 'A'..'Z') 2. numbers ('0'..'9') 3. characters in
-	 * the legalset parameter 4. others (Unicode characters that are not in
-	 * US-ASCII set, and are not ISO Control or are not ISO Space characters)
-	 * <p>
-	 * called from URI.Helper.parseURI() to validate each component
-	 * <p>
-	 * 
-	 * @param s
-	 *            java.lang.String the string to be validated
-	 * @param legal
-	 *            java.lang.String the characters allowed in the String s
-	 * 
-	 */
-	static void validate(String s, String legal) throws URISyntaxException {
-		for (int i = 0; i < s.length();) {
-			char ch = s.charAt(i);
-			if (ch == '%') {
-				do {
-					if (i + 2 >= s.length()) {
-						throw new URISyntaxException(s, Msg.getString("K0313"),
-								i);
-					}
-					int d1 = Character.digit(s.charAt(i + 1), 16);
-					int d2 = Character.digit(s.charAt(i + 2), 16);
-					if (d1 == -1 || d2 == -1) {
-						throw new URISyntaxException(s, Msg.getString("K0314",
-								s.substring(i, i + 3)), i);
-					}
-
-					i += 3;
-				} while (i < s.length() && s.charAt(i) == '%');
-
-				continue;
-			}
-			if (!((ch >= 'a' && ch <= 'z') || (ch >= 'A' && ch <= 'Z')
-					|| (ch >= '0' && ch <= '9') || legal.indexOf(ch) > -1 || (ch > 127
-					&& !Character.isSpaceChar(ch) && !Character
-					.isISOControl(ch)))) {
-				throw new URISyntaxException(s, Msg.getString("K00c1"), i);
-			}
-			i++;
-		}
-	}
-
-	static void validateSimple(String s, String legal)
-			throws URISyntaxException {
-		for (int i = 0; i < s.length();) {
-			char ch = s.charAt(i);
-			if (!((ch >= 'a' && ch <= 'z') || (ch >= 'A' && ch <= 'Z')
-					|| (ch >= '0' && ch <= '9') || legal.indexOf(ch) > -1)) {
-				throw new URISyntaxException(s, Msg.getString("K00c1"), i);
-			}
-			i++;
-		}
-	}
-
-	/**
-	 * All characters except letters ('a'..'z', 'A'..'Z') and numbers ('0'..'9')
-	 * and legal characters are converted into their hexidecimal value prepended
-	 * by '%'.
-	 * <p>
-	 * For example: '#' -> %23
-	 * <p>
-	 * Other characters, which are Unicode chars that are not US-ASCII, and are
-	 * not ISO Control or are not ISO Space chars, are preserved.
-	 * <p>
-	 * Called from URI.quoteComponent() (for multiple argument constructors)
-	 * <p>
-	 * 
-	 * @param s
-	 *            java.lang.String the string to be converted
-	 * @param legal
-	 *            java.lang.String the characters allowed to be preserved in the
-	 *            string s
-	 * @return java.lang.String the converted string
-	 */
-	static String quoteIllegal(String s, String legal)
-			throws UnsupportedEncodingException {
-		StringBuffer buf = new StringBuffer();
-		for (int i = 0; i < s.length(); i++) {
-			char ch = s.charAt(i);
-			if ((ch >= 'a' && ch <= 'z')
-					|| (ch >= 'A' && ch <= 'Z')
-					|| (ch >= '0' && ch <= '9')
-					|| legal.indexOf(ch) > -1
-					|| (ch > 127 && !Character.isSpaceChar(ch) && !Character
-							.isISOControl(ch))) {
-				buf.append(ch);
-			} else {
-				byte[] bytes = new String(new char[] { ch }).getBytes(encoding);
-				for (int j = 0; j < bytes.length; j++) {
-					buf.append('%');
-					buf.append(digits.charAt((bytes[j] & 0xf0) >> 4));
-					buf.append(digits.charAt(bytes[j] & 0xf));
-				}
-			}
-		}
-		return buf.toString();
-	}
-
-	/**
-	 * Other characters, which are Unicode chars that are not US-ASCII, and are
-	 * not ISO Control or are not ISO Space chars are not preserved. They are
-	 * converted into their hexidecimal value prepended by '%'.
-	 * <p>
-	 * For example: Euro currency symbol -> "%E2%82%AC".
-	 * <p>
-	 * Called from URI.toASCIIString()
-	 * <p>
-	 * 
-	 * @param s
-	 *            java.lang.String the string to be converted
-	 * @return java.lang.String the converted string
-	 */
-	static String encodeOthers(String s) throws UnsupportedEncodingException {
-		StringBuffer buf = new StringBuffer();
-		for (int i = 0; i < s.length(); i++) {
-			char ch = s.charAt(i);
-			if (ch <= 127)
-				buf.append(ch);
-			else {
-				byte[] bytes = new String(new char[] { ch }).getBytes(encoding);
-				for (int j = 0; j < bytes.length; j++) {
-					buf.append('%');
-					buf.append(digits.charAt((bytes[j] & 0xf0) >> 4));
-					buf.append(digits.charAt(bytes[j] & 0xf));
-				}
-			}
-		}
-		return buf.toString();
-	}
-
-	/**
-	 * Decodes the string argument which is assumed to be encoded in the
-	 * <code>x-www-form-urlencoded</code> MIME content type using the UTF-8
-	 * encoding scheme.
-	 * <p>
-	 * '%' and two following hex digit characters are converted to the
-	 * equivalent byte value. All other characters are passed through
-	 * unmodified.
-	 * 
-	 * <p>
-	 * e.g. "A%20B%20C %24%25" -> "A B C $%"
-	 * <p>
-	 * Called from URI.getXYZ() methods
-	 * <p>
-	 * 
-	 * @param s
-	 *            java.lang.String The encoded string.
-	 * @return java.lang.String The decoded version.
-	 */
-	static String decode(String s) throws UnsupportedEncodingException {
-
-		StringBuffer result = new StringBuffer();
-		ByteArrayOutputStream out = new ByteArrayOutputStream();
-		for (int i = 0; i < s.length();) {
-			char c = s.charAt(i);
-			if (c == '%') {
-				out.reset();
-				do {
-					if (i + 2 >= s.length())
-						throw new IllegalArgumentException(Msg.getString(
-								"K01fe", i));
-					int d1 = Character.digit(s.charAt(i + 1), 16);
-					int d2 = Character.digit(s.charAt(i + 2), 16);
-					if (d1 == -1 || d2 == -1)
-						throw new IllegalArgumentException(Msg.getString(
-								"K01ff", s.substring(i, i + 3), String
-										.valueOf(i)));
-					out.write((byte) ((d1 << 4) + d2));
-					i += 3;
-				} while (i < s.length() && s.charAt(i) == '%');
-				result.append(out.toString(encoding));
-				continue;
-			}
-			result.append(c);
-			i++;
-		}
-		return result.toString();
-	}
+    /**
+     * Validate a string by checking if it contains any characters other than:
+     * 
+     * 1. letters ('a'..'z', 'A'..'Z') 2. numbers ('0'..'9') 3. characters in
+     * the legalset parameter 4. others (Unicode characters that are not in
+     * US-ASCII set, and are not ISO Control or are not ISO Space characters)
+     * <p>
+     * called from URI.Helper.parseURI() to validate each component
+     * <p>
+     * 
+     * @param s
+     *            java.lang.String the string to be validated
+     * @param legal
+     *            java.lang.String the characters allowed in the String s
+     * 
+     */
+    static void validate(String s, String legal) throws URISyntaxException {
+        for (int i = 0; i < s.length();) {
+            char ch = s.charAt(i);
+            if (ch == '%') {
+                do {
+                    if (i + 2 >= s.length()) {
+                        throw new URISyntaxException(s, Msg.getString("K0313"), //$NON-NLS-1$
+                                i);
+                    }
+                    int d1 = Character.digit(s.charAt(i + 1), 16);
+                    int d2 = Character.digit(s.charAt(i + 2), 16);
+                    if (d1 == -1 || d2 == -1) {
+                        throw new URISyntaxException(s, Msg.getString("K0314", //$NON-NLS-1$
+                                s.substring(i, i + 3)), i);
+                    }
+
+                    i += 3;
+                } while (i < s.length() && s.charAt(i) == '%');
+
+                continue;
+            }
+            if (!((ch >= 'a' && ch <= 'z') || (ch >= 'A' && ch <= 'Z')
+                    || (ch >= '0' && ch <= '9') || legal.indexOf(ch) > -1 || (ch > 127
+                    && !Character.isSpaceChar(ch) && !Character
+                    .isISOControl(ch)))) {
+                throw new URISyntaxException(s, Msg.getString("K00c1"), i); //$NON-NLS-1$
+            }
+            i++;
+        }
+    }
+
+    static void validateSimple(String s, String legal)
+            throws URISyntaxException {
+        for (int i = 0; i < s.length();) {
+            char ch = s.charAt(i);
+            if (!((ch >= 'a' && ch <= 'z') || (ch >= 'A' && ch <= 'Z')
+                    || (ch >= '0' && ch <= '9') || legal.indexOf(ch) > -1)) {
+                throw new URISyntaxException(s, Msg.getString("K00c1"), i); //$NON-NLS-1$
+            }
+            i++;
+        }
+    }
+
+    /**
+     * All characters except letters ('a'..'z', 'A'..'Z') and numbers ('0'..'9')
+     * and legal characters are converted into their hexidecimal value prepended
+     * by '%'.
+     * <p>
+     * For example: '#' -> %23
+     * <p>
+     * Other characters, which are Unicode chars that are not US-ASCII, and are
+     * not ISO Control or are not ISO Space chars, are preserved.
+     * <p>
+     * Called from URI.quoteComponent() (for multiple argument constructors)
+     * <p>
+     * 
+     * @param s
+     *            java.lang.String the string to be converted
+     * @param legal
+     *            java.lang.String the characters allowed to be preserved in the
+     *            string s
+     * @return java.lang.String the converted string
+     */
+    static String quoteIllegal(String s, String legal)
+            throws UnsupportedEncodingException {
+        StringBuffer buf = new StringBuffer();
+        for (int i = 0; i < s.length(); i++) {
+            char ch = s.charAt(i);
+            if ((ch >= 'a' && ch <= 'z')
+                    || (ch >= 'A' && ch <= 'Z')
+                    || (ch >= '0' && ch <= '9')
+                    || legal.indexOf(ch) > -1
+                    || (ch > 127 && !Character.isSpaceChar(ch) && !Character
+                            .isISOControl(ch))) {
+                buf.append(ch);
+            } else {
+                byte[] bytes = new String(new char[] { ch }).getBytes(encoding);
+                for (int j = 0; j < bytes.length; j++) {
+                    buf.append('%');
+                    buf.append(digits.charAt((bytes[j] & 0xf0) >> 4));
+                    buf.append(digits.charAt(bytes[j] & 0xf));
+                }
+            }
+        }
+        return buf.toString();
+    }
+
+    /**
+     * Other characters, which are Unicode chars that are not US-ASCII, and are
+     * not ISO Control or are not ISO Space chars are not preserved. They are
+     * converted into their hexidecimal value prepended by '%'.
+     * <p>
+     * For example: Euro currency symbol -> "%E2%82%AC".
+     * <p>
+     * Called from URI.toASCIIString()
+     * <p>
+     * 
+     * @param s
+     *            java.lang.String the string to be converted
+     * @return java.lang.String the converted string
+     */
+    static String encodeOthers(String s) throws UnsupportedEncodingException {
+        StringBuffer buf = new StringBuffer();
+        for (int i = 0; i < s.length(); i++) {
+            char ch = s.charAt(i);
+            if (ch <= 127) {
+                buf.append(ch);
+            } else {
+                byte[] bytes = new String(new char[] { ch }).getBytes(encoding);
+                for (int j = 0; j < bytes.length; j++) {
+                    buf.append('%');
+                    buf.append(digits.charAt((bytes[j] & 0xf0) >> 4));
+                    buf.append(digits.charAt(bytes[j] & 0xf));
+                }
+            }
+        }
+        return buf.toString();
+    }
+
+    /**
+     * Decodes the string argument which is assumed to be encoded in the
+     * <code>x-www-form-urlencoded</code> MIME content type using the UTF-8
+     * encoding scheme.
+     * <p>
+     * '%' and two following hex digit characters are converted to the
+     * equivalent byte value. All other characters are passed through
+     * unmodified.
+     * 
+     * <p>
+     * e.g. "A%20B%20C %24%25" -> "A B C $%"
+     * <p>
+     * Called from URI.getXYZ() methods
+     * <p>
+     * 
+     * @param s
+     *            java.lang.String The encoded string.
+     * @return java.lang.String The decoded version.
+     */
+    static String decode(String s) throws UnsupportedEncodingException {
+
+        StringBuffer result = new StringBuffer();
+        ByteArrayOutputStream out = new ByteArrayOutputStream();
+        for (int i = 0; i < s.length();) {
+            char c = s.charAt(i);
+            if (c == '%') {
+                out.reset();
+                do {
+                    if (i + 2 >= s.length()) {
+                        throw new IllegalArgumentException(Msg.getString(
+                                "K01fe", i)); //$NON-NLS-1$
+                    }
+                    int d1 = Character.digit(s.charAt(i + 1), 16);
+                    int d2 = Character.digit(s.charAt(i + 2), 16);
+                    if (d1 == -1 || d2 == -1) {
+                        throw new IllegalArgumentException(Msg.getString(
+                                "K01ff", s.substring(i, i + 3), //$NON-NLS-1$
+                                String.valueOf(i)));
+                    }
+                    out.write((byte) ((d1 << 4) + d2));
+                    i += 3;
+                } while (i < s.length() && s.charAt(i) == '%');
+                result.append(out.toString(encoding));
+                continue;
+            }
+            result.append(c);
+            i++;
+        }
+        return result.toString();
+    }
 
 }

Modified: harmony/enhanced/classlib/trunk/modules/luni/src/main/java/java/net/URISyntaxException.java
URL: http://svn.apache.org/viewvc/harmony/enhanced/classlib/trunk/modules/luni/src/main/java/java/net/URISyntaxException.java?view=diff&rev=493040&r1=493039&r2=493040
==============================================================================
--- harmony/enhanced/classlib/trunk/modules/luni/src/main/java/java/net/URISyntaxException.java (original)
+++ harmony/enhanced/classlib/trunk/modules/luni/src/main/java/java/net/URISyntaxException.java Fri Jan  5 06:44:04 2007
@@ -19,7 +19,6 @@
 
 import org.apache.harmony.luni.util.Msg;
 
-
 /**
  * Represents an exception that occurred during parsing of a URI.
  */
@@ -29,98 +28,102 @@
 
     private String input;
 
-	private int index;
+    private int index;
 
-	/**
-	 * Constructs a URISyntaxException, containing the input that caused the
-	 * exception, a description of the problem, and the index at which the error
-	 * occurred.
-	 * 
-	 * @param input
-	 * @param reason
-	 * @param index
-	 * @exception NullPointerException
-	 *                if input or reason is null
-	 * @exception IllegalArgumentException
-	 *                if index < -1
-	 */
-	public URISyntaxException(String input, String reason, int index) {
-		super(reason);
-
-		if (input == null || reason == null)
-			throw new NullPointerException();
-
-		if (index < -1)
-			throw new IllegalArgumentException();
-
-		this.input = input;
-		this.index = index;
-	}
-
-	/**
-	 * Constructs a URISyntaxException containing the string that caused the
-	 * exception and a description of the error.
-	 * 
-	 * @param input
-	 * @param reason
-	 * 
-	 * @exception NullPointerException
-	 *                if input or reason is null
-	 */
-	public URISyntaxException(String input, String reason) {
-		super(reason);
-
-		if (input == null || reason == null)
-			throw new NullPointerException();
-
-		this.input = input;
-		index = -1;
-	}
-
-	/**
-	 * Answers the index at which the syntax error was found, or -1 if the index
-	 * is unknown/unavailable.
-	 * 
-	 * @return the index of the syntax error
-	 */
-	public int getIndex() {
-		return index;
-	}
-
-	/**
-	 * Answers a String describing the syntax error in the URI string
-	 * 
-	 * @return a String describing the syntax error
-	 */
-	public String getReason() {
-		return super.getMessage();
-	}
-
-	/**
-	 * Answers the String that contained the syntax error
-	 * 
-	 * @return the String that caused the exception
-	 */
-	public String getInput() {
-		return input;
-	}
-
-	/**
-	 * Returns a description of the exception, including the reason, the string
-	 * that had the syntax error, and the index of the syntax error if
-	 * available.
-	 * 
-	 * @return a String containing information about the exception.
-	 * @see java.lang.Throwable#getMessage()
-	 */
-	@Override
+    /**
+     * Constructs a URISyntaxException, containing the input that caused the
+     * exception, a description of the problem, and the index at which the error
+     * occurred.
+     * 
+     * @param input
+     * @param reason
+     * @param index
+     * @exception NullPointerException
+     *                if input or reason is null
+     * @exception IllegalArgumentException
+     *                if index < -1
+     */
+    public URISyntaxException(String input, String reason, int index) {
+        super(reason);
+
+        if (input == null || reason == null) {
+            throw new NullPointerException();
+        }
+
+        if (index < -1) {
+            throw new IllegalArgumentException();
+        }
+
+        this.input = input;
+        this.index = index;
+    }
+
+    /**
+     * Constructs a URISyntaxException containing the string that caused the
+     * exception and a description of the error.
+     * 
+     * @param input
+     * @param reason
+     * 
+     * @exception NullPointerException
+     *                if input or reason is null
+     */
+    public URISyntaxException(String input, String reason) {
+        super(reason);
+
+        if (input == null || reason == null) {
+            throw new NullPointerException();
+        }
+
+        this.input = input;
+        index = -1;
+    }
+
+    /**
+     * Answers the index at which the syntax error was found, or -1 if the index
+     * is unknown/unavailable.
+     * 
+     * @return the index of the syntax error
+     */
+    public int getIndex() {
+        return index;
+    }
+
+    /**
+     * Answers a String describing the syntax error in the URI string
+     * 
+     * @return a String describing the syntax error
+     */
+    public String getReason() {
+        return super.getMessage();
+    }
+
+    /**
+     * Answers the String that contained the syntax error
+     * 
+     * @return the String that caused the exception
+     */
+    public String getInput() {
+        return input;
+    }
+
+    /**
+     * Returns a description of the exception, including the reason, the string
+     * that had the syntax error, and the index of the syntax error if
+     * available.
+     * 
+     * @return a String containing information about the exception.
+     * @see java.lang.Throwable#getMessage()
+     */
+    @Override
     public String getMessage() {
-		String reason = super.getMessage();
+        String reason = super.getMessage();
 
-		if (index != -1) {
-			return Msg.getString("K0326", new String[] { reason,
-					Integer.toString(index), input });
-		}
-		return Msg.getString("K0327", new String[] { reason, input });
-	}
+        if (index != -1) {
+            return Msg.getString("K0326", //$NON-NLS-1$
+                    new String[] { reason, Integer.toString(index), input });
+        }
+        return Msg.getString("K0327", //$NON-NLS-1$
+                new String[] { reason, input });
+    }
 }



Mime
View raw message