You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@harmony.apache.org by te...@apache.org on 2006/12/08 23:26:26 UTC
svn commit: r484825 - in
/harmony/enhanced/classlib/trunk/modules/luni/src/main/java/java/net:
DatagramPacket.java DatagramSocket.java DatagramSocketImpl.java
HttpURLConnection.java MulticastSocket.java ServerSocket.java Socket.java
URI.java
Author: tellison
Date: Fri Dec 8 14:26:25 2006
New Revision: 484825
URL: http://svn.apache.org/viewvc?view=rev&rev=484825
Log:
Apply patch HARMONY-2473 ([classlib] [luni] Fixes for some minor issues in the java.net package found by Melody)
Modified:
harmony/enhanced/classlib/trunk/modules/luni/src/main/java/java/net/DatagramPacket.java
harmony/enhanced/classlib/trunk/modules/luni/src/main/java/java/net/DatagramSocket.java
harmony/enhanced/classlib/trunk/modules/luni/src/main/java/java/net/DatagramSocketImpl.java
harmony/enhanced/classlib/trunk/modules/luni/src/main/java/java/net/HttpURLConnection.java
harmony/enhanced/classlib/trunk/modules/luni/src/main/java/java/net/MulticastSocket.java
harmony/enhanced/classlib/trunk/modules/luni/src/main/java/java/net/ServerSocket.java
harmony/enhanced/classlib/trunk/modules/luni/src/main/java/java/net/Socket.java
harmony/enhanced/classlib/trunk/modules/luni/src/main/java/java/net/URI.java
Modified: harmony/enhanced/classlib/trunk/modules/luni/src/main/java/java/net/DatagramPacket.java
URL: http://svn.apache.org/viewvc/harmony/enhanced/classlib/trunk/modules/luni/src/main/java/java/net/DatagramPacket.java?view=diff&rev=484825&r1=484824&r2=484825
==============================================================================
--- harmony/enhanced/classlib/trunk/modules/luni/src/main/java/java/net/DatagramPacket.java (original)
+++ harmony/enhanced/classlib/trunk/modules/luni/src/main/java/java/net/DatagramPacket.java Fri Dec 8 14:26:25 2006
@@ -268,7 +268,7 @@
/**
* Answer the SocketAddress for this packet.
*/
- public SocketAddress getSocketAddress() {
+ public synchronized SocketAddress getSocketAddress() {
return new InetSocketAddress(getAddress(), getPort());
}
@@ -278,7 +278,7 @@
* @param sockAddr
* the machine address and port
*/
- public void setSocketAddress(SocketAddress sockAddr) {
+ public synchronized void setSocketAddress(SocketAddress sockAddr) {
if (!(sockAddr instanceof InetSocketAddress)) {
throw new IllegalArgumentException(Msg.getString(
"K0316", sockAddr == null ? null : sockAddr.getClass())); //$NON-NLS-1$
Modified: harmony/enhanced/classlib/trunk/modules/luni/src/main/java/java/net/DatagramSocket.java
URL: http://svn.apache.org/viewvc/harmony/enhanced/classlib/trunk/modules/luni/src/main/java/java/net/DatagramSocket.java?view=diff&rev=484825&r1=484824&r2=484825
==============================================================================
--- harmony/enhanced/classlib/trunk/modules/luni/src/main/java/java/net/DatagramSocket.java (original)
+++ harmony/enhanced/classlib/trunk/modules/luni/src/main/java/java/net/DatagramSocket.java Fri Dec 8 14:26:25 2006
@@ -435,7 +435,7 @@
public synchronized void setSendBufferSize(int size) throws SocketException {
if (size >= 1) {
checkClosedAndBind(false);
- impl.setOption(SocketOptions.SO_SNDBUF, new Integer(size));
+ impl.setOption(SocketOptions.SO_SNDBUF, Integer.valueOf(size));
} else
throw new IllegalArgumentException(Msg.getString("K0035"));
}
@@ -454,7 +454,7 @@
throws SocketException {
if (size >= 1) {
checkClosedAndBind(false);
- impl.setOption(SocketOptions.SO_RCVBUF, new Integer(size));
+ impl.setOption(SocketOptions.SO_RCVBUF, Integer.valueOf(size));
} else
throw new IllegalArgumentException(Msg.getString("K0035"));
}
@@ -474,7 +474,7 @@
public synchronized void setSoTimeout(int timeout) throws SocketException {
if (timeout >= 0) {
checkClosedAndBind(false);
- impl.setOption(SocketOptions.SO_TIMEOUT, new Integer(timeout));
+ impl.setOption(SocketOptions.SO_TIMEOUT, Integer.valueOf(timeout));
} else
throw new IllegalArgumentException(Msg.getString("K0036"));
}
@@ -767,7 +767,7 @@
checkClosedAndBind(false);
if (value < 0 || value > 255)
throw new IllegalArgumentException();
- impl.setOption(SocketOptions.IP_TOS, new Integer(value));
+ impl.setOption(SocketOptions.IP_TOS, Integer.valueOf(value));
}
/**
Modified: harmony/enhanced/classlib/trunk/modules/luni/src/main/java/java/net/DatagramSocketImpl.java
URL: http://svn.apache.org/viewvc/harmony/enhanced/classlib/trunk/modules/luni/src/main/java/java/net/DatagramSocketImpl.java?view=diff&rev=484825&r1=484824&r2=484825
==============================================================================
--- harmony/enhanced/classlib/trunk/modules/luni/src/main/java/java/net/DatagramSocketImpl.java (original)
+++ harmony/enhanced/classlib/trunk/modules/luni/src/main/java/java/net/DatagramSocketImpl.java Fri Dec 8 14:26:25 2006
@@ -33,14 +33,11 @@
protected int localPort;
- int receiveTimeout;
-
/**
* Constructs an unbound datagram socket implementation.
*/
public DatagramSocketImpl() {
localPort = -1;
- receiveTimeout = 0;
}
/**
Modified: harmony/enhanced/classlib/trunk/modules/luni/src/main/java/java/net/HttpURLConnection.java
URL: http://svn.apache.org/viewvc/harmony/enhanced/classlib/trunk/modules/luni/src/main/java/java/net/HttpURLConnection.java?view=diff&rev=484825&r1=484824&r2=484825
==============================================================================
--- harmony/enhanced/classlib/trunk/modules/luni/src/main/java/java/net/HttpURLConnection.java (original)
+++ harmony/enhanced/classlib/trunk/modules/luni/src/main/java/java/net/HttpURLConnection.java Fri Dec 8 14:26:25 2006
@@ -341,7 +341,7 @@
if (response == null) {
return -1;
}
- response.trim();
+ response = response.trim();
int mark = response.indexOf(" ") + 1;
if (mark == 0) {
return -1;
Modified: harmony/enhanced/classlib/trunk/modules/luni/src/main/java/java/net/MulticastSocket.java
URL: http://svn.apache.org/viewvc/harmony/enhanced/classlib/trunk/modules/luni/src/main/java/java/net/MulticastSocket.java?view=diff&rev=484825&r1=484824&r2=484825
==============================================================================
--- harmony/enhanced/classlib/trunk/modules/luni/src/main/java/java/net/MulticastSocket.java (original)
+++ harmony/enhanced/classlib/trunk/modules/luni/src/main/java/java/net/MulticastSocket.java Fri Dec 8 14:26:25 2006
@@ -111,7 +111,7 @@
// check if it is set at the IPV6 level. If so then use that. Otherwise
// do it at the IPV4 level
- Integer theIndex = new Integer(0);
+ Integer theIndex = Integer.valueOf(0);
try {
theIndex = (Integer) impl.getOption(SocketOptions.IP_MULTICAST_IF2);
} catch (SocketException e) {
@@ -231,7 +231,7 @@
NetworkInterface netInterface) throws IOException {
checkClosedAndBind(false);
if (null == groupAddress) {
- throw new IllegalArgumentException(Msg.getString("K0331"));
+ throw new IllegalArgumentException(Msg.getString("K0318"));
}
if ((netInterface != null) && (netInterface.getFirstAddress() == null)) {
@@ -243,9 +243,9 @@
InetAddress groupAddr = ((InetSocketAddress) groupAddress)
.getAddress();
- if ((groupAddr) == null) {
+ if (groupAddr == null) {
throw new SocketException(Msg.getString(
- "K0317", groupAddr.getHostName())); //$NON-NLS-1$
+ "K0331")); //$NON-NLS-1$
}
if (!groupAddr.isMulticastAddress()) {
@@ -307,7 +307,7 @@
NetworkInterface netInterface) throws IOException {
checkClosedAndBind(false);
if (null == groupAddress) {
- throw new IllegalArgumentException(Msg.getString("K0331"));
+ throw new IllegalArgumentException(Msg.getString("K0318"));
}
if ((netInterface != null) && (netInterface.getFirstAddress() == null)) {
@@ -319,9 +319,9 @@
InetAddress groupAddr = ((InetSocketAddress) groupAddress)
.getAddress();
- if ((groupAddr) == null) {
+ if (groupAddr == null) {
throw new SocketException(Msg.getString(
- "K0317", groupAddr.getHostName())); //$NON-NLS-1$
+ "K0331")); //$NON-NLS-1$
}
if (!groupAddr.isMulticastAddress()) {
@@ -411,13 +411,13 @@
NetworkInterface theInterface = NetworkInterface.getByInetAddress(addr);
if ((theInterface != null) && (theInterface.getIndex() != 0)) {
try {
- impl.setOption(SocketOptions.IP_MULTICAST_IF2, new Integer(
+ impl.setOption(SocketOptions.IP_MULTICAST_IF2, Integer.valueOf(
theInterface.getIndex()));
} catch (SocketException e) {
}
} else if (addr.isAnyLocalAddress()) {
try {
- impl.setOption(SocketOptions.IP_MULTICAST_IF2, new Integer(0));
+ impl.setOption(SocketOptions.IP_MULTICAST_IF2, Integer.valueOf(0));
} catch (SocketException e) {
}
} else if (addr instanceof Inet6Address) {
@@ -456,7 +456,7 @@
impl
.setOption(
SocketOptions.IP_MULTICAST_IF2,
- new Integer(
+ Integer.valueOf(
NetworkInterface.NO_INTERFACE_INDEX));
} catch (SocketException e) {
// for now just do this, -- could be narrowed?
@@ -509,7 +509,7 @@
// is used to set the interface on systems which support
// IPV6
impl.setOption(SocketOptions.IP_MULTICAST_IF2,
- new Integer(netInterface.getIndex()));
+ Integer.valueOf(netInterface.getIndex()));
} catch (SocketException e) {
// for now just do this -- could be narrowed?
}
Modified: harmony/enhanced/classlib/trunk/modules/luni/src/main/java/java/net/ServerSocket.java
URL: http://svn.apache.org/viewvc/harmony/enhanced/classlib/trunk/modules/luni/src/main/java/java/net/ServerSocket.java?view=diff&rev=484825&r1=484824&r2=484825
==============================================================================
--- harmony/enhanced/classlib/trunk/modules/luni/src/main/java/java/net/ServerSocket.java (original)
+++ harmony/enhanced/classlib/trunk/modules/luni/src/main/java/java/net/ServerSocket.java Fri Dec 8 14:26:25 2006
@@ -295,7 +295,7 @@
public synchronized void setSoTimeout(int timeout) throws SocketException {
checkClosedAndCreate(true);
if (timeout >= 0) {
- impl.setOption(SocketOptions.SO_TIMEOUT, new Integer(timeout));
+ impl.setOption(SocketOptions.SO_TIMEOUT, Integer.valueOf(timeout));
} else {
throw new IllegalArgumentException(Msg.getString("K0036")); //$NON-NLS-1$
}
@@ -478,7 +478,7 @@
public void setReceiveBufferSize(int size) throws SocketException {
checkClosedAndCreate(true);
if (size >= 1) {
- impl.setOption(SocketOptions.SO_RCVBUF, new Integer(size));
+ impl.setOption(SocketOptions.SO_RCVBUF, Integer.valueOf(size));
} else {
throw new IllegalArgumentException(Msg.getString("K0035")); //$NON-NLS-1$
}
Modified: harmony/enhanced/classlib/trunk/modules/luni/src/main/java/java/net/Socket.java
URL: http://svn.apache.org/viewvc/harmony/enhanced/classlib/trunk/modules/luni/src/main/java/java/net/Socket.java?view=diff&rev=484825&r1=484824&r2=484825
==============================================================================
--- harmony/enhanced/classlib/trunk/modules/luni/src/main/java/java/net/Socket.java (original)
+++ harmony/enhanced/classlib/trunk/modules/luni/src/main/java/java/net/Socket.java Fri Dec 8 14:26:25 2006
@@ -594,7 +594,7 @@
public synchronized void setSendBufferSize(int size) throws SocketException {
checkClosedAndCreate(true);
if (size >= 1) {
- impl.setOption(SocketOptions.SO_SNDBUF, new Integer(size));
+ impl.setOption(SocketOptions.SO_SNDBUF, Integer.valueOf(size));
} else {
throw new IllegalArgumentException(Msg.getString("K0035")); //$NON-NLS-1$
}
@@ -614,7 +614,7 @@
throws SocketException {
checkClosedAndCreate(true);
if (size >= 1) {
- impl.setOption(SocketOptions.SO_RCVBUF, new Integer(size));
+ impl.setOption(SocketOptions.SO_RCVBUF, Integer.valueOf(size));
} else {
throw new IllegalArgumentException(Msg.getString("K0035")); //$NON-NLS-1$
}
@@ -636,7 +636,7 @@
checkClosedAndCreate(true);
if (!on || 0 <= timeout) {
int val = on ? (65535 < timeout ? 65535 : timeout) : -1;
- impl.setOption(SocketOptions.SO_LINGER, new Integer(val));
+ impl.setOption(SocketOptions.SO_LINGER, Integer.valueOf(val));
} else {
throw new IllegalArgumentException(Msg.getString("K0045")); //$NON-NLS-1$
}
@@ -656,7 +656,7 @@
public synchronized void setSoTimeout(int timeout) throws SocketException {
checkClosedAndCreate(true);
if (timeout >= 0) {
- impl.setOption(SocketOptions.SO_TIMEOUT, new Integer(timeout));
+ impl.setOption(SocketOptions.SO_TIMEOUT, Integer.valueOf(timeout));
} else {
throw new IllegalArgumentException(Msg.getString("K0036")); //$NON-NLS-1$
}
@@ -674,7 +674,7 @@
*/
public void setTcpNoDelay(boolean on) throws SocketException {
checkClosedAndCreate(true);
- impl.setOption(SocketOptions.TCP_NODELAY, new Boolean(on));
+ impl.setOption(SocketOptions.TCP_NODELAY, Boolean.valueOf(on));
}
/**
@@ -1081,7 +1081,7 @@
if (value < 0 || value > 255) {
throw new IllegalArgumentException();
}
- impl.setOption(SocketOptions.IP_TOS, new Integer(value));
+ impl.setOption(SocketOptions.IP_TOS, Integer.valueOf(value));
}
/**
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=484825&r1=484824&r2=484825
==============================================================================
--- 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 Dec 8 14:26:25 2006
@@ -1173,8 +1173,6 @@
// (index > index2 && index2!=-1 || index == -1))
// return path;
- StringBuffer newpath = new StringBuffer();
-
index = 0;
index2 = 0;
int pathlen = path.length();
@@ -1228,7 +1226,7 @@
}
// put the path back together
- newpath = new StringBuffer();
+ StringBuffer newpath = new StringBuffer();
if (path.startsWith("/")) {
newpath.append('/');
}