/[classpath]/classpath/java/net/DatagramSocket.java
ViewVC logotype

Diff of /classpath/java/net/DatagramSocket.java

Parent Directory Parent Directory | Revision Log Revision Log | View Patch Patch

revision 1.29 by mkoch, Fri Sep 19 07:07:40 2003 UTC revision 1.30 by mkoch, Sat Sep 20 07:55:55 2003 UTC
# Line 249  public class DatagramSocket Line 249  public class DatagramSocket
249     */     */
250    public InetAddress getLocalAddress()    public InetAddress getLocalAddress()
251    {    {
252      if (impl == null)      if (impl == null
253            || closed)
254        return null;        return null;
255            
     // FIXME: According to libgcj, checkConnect() is supposed to be called  
     // before performing this operation.  Problems: 1) We don't have the  
     // addr until after we do it, so we do a post check.  2). The docs I  
     // see don't require this in the Socket case, only DatagramSocket, but  
     // we'll assume they mean both.  
   
256      InetAddress localAddr;      InetAddress localAddr;
257            
258      try      try
259        {        {
260          localAddr = (InetAddress) impl.getOption (SocketOptions.SO_BINDADDR);          localAddr = (InetAddress) impl.getOption (SocketOptions.SO_BINDADDR);
261    
262            SecurityManager s = System.getSecurityManager();
263            if (s != null)
264              s.checkConnect (localAddr.getHostName(), -1);
265          }
266        catch (SecurityException e)
267          {
268            localAddr = InetAddress.ANY_IF;
269        }        }
270      catch (SocketException e)      catch (SocketException e)
271        {        {
272          return null;          return null;
273        }        }
       
     SecurityManager sm = System.getSecurityManager();  
     if (sm != null)  
       sm.checkConnect(localAddr.getHostName(), getLocalPort());  
274    
275      return localAddr;      return localAddr;
276    }    }

Legend:
Removed from v.1.29  
changed lines
  Added in v.1.30

savannah-hackers-public@gnu.org
ViewVC Help
Powered by ViewVC 1.1.26