diff --git a/libjava/ChangeLog b/libjava/ChangeLog index ba68afef486b..db67e406552f 100644 --- a/libjava/ChangeLog +++ b/libjava/ChangeLog @@ -1,3 +1,26 @@ +2004-02-11 Michael Koch + + * java/net/DatagramSocket.java + (setReuseAddress): Use Boolean.valueOf() instead of creating a new + Boolean object. + (setBroadcast): Likewise. + * java/net/MulticastSocket.java + (setLoopbackMode): Likewise. + * java/net/ServerSocket.java + (setReuseAddress): Likewise. + * java/net/Socket.java + (setTcpNoDelay): Likewise. + (setSoLinger): Likewise. + (setOOBInline): Likewise. + (setKeepAlive): Likewise. + (setReuseAddress): Likewise. + * java/net/URLConnection.java + (setContentHandler): Replace == with equals(). + * java/net/URLStreamHandler.java + (hostSEquals): Fix checking host addresses. + (toExternalForm): Dont check protocol for null. We know already its + not null. + 2004-02-10 David Jee * java/awt/BorderLayout.java diff --git a/libjava/java/net/DatagramSocket.java b/libjava/java/net/DatagramSocket.java index c5920a094246..895db94fa525 100644 --- a/libjava/java/net/DatagramSocket.java +++ b/libjava/java/net/DatagramSocket.java @@ -798,7 +798,7 @@ public class DatagramSocket if (isClosed()) throw new SocketException("socket is closed"); - getImpl().setOption (SocketOptions.SO_REUSEADDR, new Boolean (on)); + getImpl().setOption (SocketOptions.SO_REUSEADDR, Boolean.valueOf(on)); } /** @@ -837,7 +837,7 @@ public class DatagramSocket if (isClosed()) throw new SocketException("socket is closed"); - getImpl().setOption(SocketOptions.SO_BROADCAST, new Boolean(enable)); + getImpl().setOption(SocketOptions.SO_BROADCAST, Boolean.valueOf(enable)); } /** diff --git a/libjava/java/net/MulticastSocket.java b/libjava/java/net/MulticastSocket.java index 12afc2f50c3d..28b76b365ee4 100644 --- a/libjava/java/net/MulticastSocket.java +++ b/libjava/java/net/MulticastSocket.java @@ -255,7 +255,7 @@ public class MulticastSocket extends DatagramSocket if (isClosed()) throw new SocketException("socket is closed"); - getImpl().setOption (SocketOptions.IP_MULTICAST_LOOP, new Boolean (disable)); + getImpl().setOption (SocketOptions.IP_MULTICAST_LOOP, Boolean.valueOf(disable)); } /** diff --git a/libjava/java/net/ServerSocket.java b/libjava/java/net/ServerSocket.java index a53ebf674d13..df338091291f 100644 --- a/libjava/java/net/ServerSocket.java +++ b/libjava/java/net/ServerSocket.java @@ -471,7 +471,7 @@ public class ServerSocket if (isClosed()) throw new SocketException("ServerSocket is closed"); - impl.setOption (SocketOptions.SO_REUSEADDR, new Boolean (on)); + impl.setOption (SocketOptions.SO_REUSEADDR, Boolean.valueOf(on)); } /** diff --git a/libjava/java/net/Socket.java b/libjava/java/net/Socket.java index f9cbb7e6cb34..4c14e8d99b34 100644 --- a/libjava/java/net/Socket.java +++ b/libjava/java/net/Socket.java @@ -657,7 +657,7 @@ public class Socket if (isClosed()) throw new SocketException("socket is closed"); - getImpl().setOption(SocketOptions.TCP_NODELAY, new Boolean(on)); + getImpl().setOption(SocketOptions.TCP_NODELAY, Boolean.valueOf(on)); } /** @@ -719,7 +719,7 @@ public class Socket } else { - getImpl().setOption(SocketOptions.SO_LINGER, new Boolean(false)); + getImpl().setOption(SocketOptions.SO_LINGER, Boolean.valueOf(false)); } } @@ -784,7 +784,7 @@ public class Socket if (isClosed()) throw new SocketException("socket is closed"); - getImpl().setOption(SocketOptions.SO_OOBINLINE, new Boolean(on)); + getImpl().setOption(SocketOptions.SO_OOBINLINE, Boolean.valueOf(on)); } /** @@ -975,7 +975,7 @@ public class Socket if (isClosed()) throw new SocketException("socket is closed"); - getImpl().setOption(SocketOptions.SO_KEEPALIVE, new Boolean(on)); + getImpl().setOption(SocketOptions.SO_KEEPALIVE, Boolean.valueOf(on)); } /** @@ -1150,7 +1150,7 @@ public class Socket */ public void setReuseAddress (boolean on) throws SocketException { - getImpl().setOption (SocketOptions.SO_REUSEADDR, new Boolean (on)); + getImpl().setOption (SocketOptions.SO_REUSEADDR, Boolean.valueOf(on)); } /** diff --git a/libjava/java/net/URLConnection.java b/libjava/java/net/URLConnection.java index 4707d9cf3a9d..2b383b5502a8 100644 --- a/libjava/java/net/URLConnection.java +++ b/libjava/java/net/URLConnection.java @@ -956,7 +956,7 @@ public abstract class URLConnection ContentHandler handler; // No content type so just handle it as the default. - if (contentType == null || contentType == "") + if (contentType == null || contentType.equals("")) return null; // See if a handler has been cached for this content type. diff --git a/libjava/java/net/URLStreamHandler.java b/libjava/java/net/URLStreamHandler.java index ec2512974539..af4335f4f44a 100644 --- a/libjava/java/net/URLStreamHandler.java +++ b/libjava/java/net/URLStreamHandler.java @@ -415,7 +415,7 @@ public abstract class URLStreamHandler InetAddress addr1 = getHostAddress (url1); InetAddress addr2 = getHostAddress (url2); - if (addr1 != null || addr2 != null) + if (addr1 != null && addr2 != null) return addr1.equals (addr2); String host1 = url1.getHost(); @@ -511,7 +511,7 @@ public abstract class URLStreamHandler int size = protocol.length() + host.length() + file.length() + 24; StringBuffer sb = new StringBuffer(size); - if (protocol != null && protocol.length() > 0) + if (protocol.length() != 0) { sb.append(protocol); sb.append(":");