Fwd: Re: Suppress creation of SocksSocketImpl in SocketAdaptor's constructor
Chris Hegarty
chris.hegarty at oracle.com
Fri Nov 25 03:38:33 PST 2011
For clarity, the changes I intend to push for this are as follows:
diff -r 2db942c7eb9c src/share/classes/sun/nio/ch/SocketAdaptor.java
--- a/src/share/classes/sun/nio/ch/SocketAdaptor.java Mon Nov 21
12:57:36 2011 +0000
+++ b/src/share/classes/sun/nio/ch/SocketAdaptor.java Fri Nov 25
11:33:47 2011 +0000
@@ -57,13 +57,17 @@ public class SocketAdaptor
// Timeout "option" value for reads
private volatile int timeout = 0;
- // ## super will create a useless impl
- private SocketAdaptor(SocketChannelImpl sc) {
+ private SocketAdaptor(SocketChannelImpl sc) throws SocketException {
+ super((SocketImpl) null);
this.sc = sc;
}
public static Socket create(SocketChannelImpl sc) {
- return new SocketAdaptor(sc);
+ try {
+ return new SocketAdaptor(sc);
+ } catch (SocketException e) {
+ throw new InternalError("should not reach here");
+ }
}
public SocketChannel getChannel() {
Thanks,
-Chris.
On 21/11/2011 10:11, Krystal Mok wrote:
> Thank you very much. I agree InternalError is better, too, even though
> it shouldn't be reached anyway.
>
> - Kris
>
> 2011/11/21 Chris Hegarty <chris.hegarty at oracle.com
> <mailto:chris.hegarty at oracle.com>>
>
> On 19/11/2011 19:44, Alan Bateman wrote:
> > On 18/11/2011 10:57, Chris Hegarty wrote:
> >> Hi Kris,
> >>
> >> I think this change should be fine, but I would like Alan to
> comment also.
> >>
> > I looked at it in more detail and I think it should okay. Will you
> > sponsor it? My only comment on the change is the catching of
> > SocketException causes a RuntimeException to be thrown but that is
> > inconsistent with other areas of this code where AssertionError or
> > InternalError is thrown.
>
> Yes, I can sponsor this change. And yes, I agree InternalError would be
> better.
>
> -Chris.
>
> >
> > -Alan
>
>
More information about the nio-dev
mailing list