[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Bug classpath/22750] Closing a socket nulls impl but getImpl() isn't ch
From: |
gcc-bugzilla at gcc dot gnu dot org |
Subject: |
[Bug classpath/22750] Closing a socket nulls impl but getImpl() isn't checked for null |
Date: |
16 Oct 2005 01:26:59 -0000 |
java.net.Socket:
When a socket is closed impl is set to null. However, some methods use
getImpl() without checking for isClosed() first. In particular:
- isConnected() will throw NullPointerException if called on a closed socket.
Hence so will
- getPort
- getInetAddress
- getRemoteSocketAddress
- toString
- getLocalAddress() will throw NullPointerException if called on a closed
socket.
- setReuseAddress() will throw NullPointerException if called on a closed
socket.
------- Comment #1 from from-classpath at savannah dot gnu dot org 2004-07-17
07:39 -------
Fixed by the following patch:
2004-07-17 Michael Koch <address@hidden>
* java/net/DatagramSocket.java
(getLocalAddress): Check if socket is bound or not.
* java/net/Socket.java
(getLocalAddrss): Check if socket is bound or not.
(getPort): Return -1 when not connected. Dont check getImpl() for
null.
(setReuseAddress): Check if socket is closed.
(isConnected): Check if getImpl() returns null.
--
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=22750
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [Bug classpath/22750] Closing a socket nulls impl but getImpl() isn't checked for null,
gcc-bugzilla at gcc dot gnu dot org <=