public inbox for java-patches@gcc.gnu.org
 help / color / mirror / Atom feed
* Patch: FYI: minor fix in SSLSocketFactoryImpl
@ 2007-04-16 20:12 Tom Tromey
  2007-04-17  7:58 ` [cp-patches] " Mark Wielaard
  0 siblings, 1 reply; 2+ messages in thread
From: Tom Tromey @ 2007-04-16 20:12 UTC (permalink / raw)
  To: GCJ-patches; +Cc: GNU Classpath Patches

I'm checking this in to gcc svn trunk, RH 4.1 branch, and Classpath
cvs.

This fixes a bug found by Tom Fitzsimmons.

In SSLSocketFactoryImpl we were delegating createSocket calls in a way
where the 4-argument form would end up calling bind() twice on a
socket, yielding an exception.  This changes the code to delegate the
other way around.

I tested this on the test case (also hacked to try the 2-arg call) and
also on the javax.net subset of Mauve.

Tom

Index: classpath/ChangeLog
from  Tom Tromey  <tromey@redhat.com>

	https://bugzilla.redhat.com/bugzilla/show_bug.cgi?id=236614
	* gnu/javax/net/ssl/provider/SSLSocketFactoryImpl.java
	(createSocket): Change order of delegation.

Index: classpath/gnu/javax/net/ssl/provider/SSLSocketFactoryImpl.java
===================================================================
--- classpath/gnu/javax/net/ssl/provider/SSLSocketFactoryImpl.java	(revision 123877)
+++ classpath/gnu/javax/net/ssl/provider/SSLSocketFactoryImpl.java	(working copy)
@@ -1,5 +1,5 @@
 /* SSLSocketFactoryImpl.java -- 
-   Copyright (C) 2006  Free Software Foundation, Inc.
+   Copyright (C) 2006, 2007  Free Software Foundation, Inc.
 
 This file is a part of GNU Classpath.
 
@@ -93,10 +93,7 @@
   @Override public SSLSocketImpl createSocket(String host, int port)
     throws IOException, UnknownHostException
   {
-    SSLSocketImpl socket = new SSLSocketImpl(contextImpl, host, port);
-    InetSocketAddress endpoint = new InetSocketAddress(host, port);
-    socket.connect(endpoint);
-    return socket;
+    return createSocket(host, port, null, 0);
   }
 
   /* (non-Javadoc)
@@ -106,8 +103,10 @@
                                               InetAddress localHost, int localPort)
     throws IOException, UnknownHostException
   {
-    SSLSocketImpl socket = createSocket(host, port);
+    SSLSocketImpl socket = new SSLSocketImpl(contextImpl, host, port);
+    InetSocketAddress endpoint = new InetSocketAddress(host, port);
     socket.bind(new InetSocketAddress(localHost, localPort));
+    socket.connect(endpoint);
     return socket;
   }
 
@@ -117,10 +116,7 @@
   @Override public SSLSocketImpl createSocket(InetAddress host, int port)
     throws IOException
   {
-    SSLSocketImpl socket = new SSLSocketImpl(contextImpl,
-                                             host.getCanonicalHostName(), port);
-    socket.connect(new InetSocketAddress(host, port));
-    return socket;
+    return createSocket(host, port, null, 0);
   }
 
   /* (non-Javadoc)
@@ -130,8 +126,10 @@
                                               InetAddress localHost, int localPort)
     throws IOException
   {
-    SSLSocketImpl socket = createSocket(host, port);
+    SSLSocketImpl socket = new SSLSocketImpl(contextImpl,
+                                             host.getCanonicalHostName(), port);
     socket.bind(new InetSocketAddress(localHost, localPort));
+    socket.connect(new InetSocketAddress(host, port));
     return socket;
   }
 }

^ permalink raw reply	[flat|nested] 2+ messages in thread

* Re: [cp-patches] Patch: FYI: minor fix in SSLSocketFactoryImpl
  2007-04-16 20:12 Patch: FYI: minor fix in SSLSocketFactoryImpl Tom Tromey
@ 2007-04-17  7:58 ` Mark Wielaard
  0 siblings, 0 replies; 2+ messages in thread
From: Mark Wielaard @ 2007-04-17  7:58 UTC (permalink / raw)
  To: tromey; +Cc: GCJ-patches, GNU Classpath Patches

[-- Attachment #1: Type: text/plain, Size: 511 bytes --]

On Mon, 2007-04-16 at 13:55 -0600, Tom Tromey wrote:
> I'm checking this in to gcc svn trunk, RH 4.1 branch, and Classpath
> cvs.

After some additional testing (I installed cacert files on
builder.classpath.org). Also added to the classpath-0.95 release branch
now.

> from  Tom Tromey  <tromey@redhat.com>
> 
> 	https://bugzilla.redhat.com/bugzilla/show_bug.cgi?id=236614
> 	* gnu/javax/net/ssl/provider/SSLSocketFactoryImpl.java
> 	(createSocket): Change order of delegation.

Thanks,

Mark

[-- Attachment #2: This is a digitally signed message part --]
[-- Type: application/pgp-signature, Size: 189 bytes --]

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2007-04-17  7:58 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2007-04-16 20:12 Patch: FYI: minor fix in SSLSocketFactoryImpl Tom Tromey
2007-04-17  7:58 ` [cp-patches] " Mark Wielaard

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).