< prev index next >

src/share/classes/sun/nio/ch/SocketAdaptor.java

Print this page
rev 1388 : 6600143: Remove another 450 unnecessary casts
Reviewed-by: alanb, iris, lmalvent, bristor, peterjones, darcy, wetmore

@@ -240,13 +240,13 @@
             throw new SocketException("Socket is not connected");
         if (!sc.isInputOpen())
             throw new SocketException("Socket input is shutdown");
         if (socketInputStream == null) {
             try {
-                socketInputStream = (InputStream)AccessController.doPrivileged(
-                    new PrivilegedExceptionAction() {
-                        public Object run() throws IOException {
+                socketInputStream = AccessController.doPrivileged(
+                    new PrivilegedExceptionAction<InputStream>() {
+                        public InputStream run() throws IOException {
                             return new SocketInputStream();
                         }
                     });
             } catch (java.security.PrivilegedActionException e) {
                 throw (IOException)e.getException();

@@ -262,13 +262,13 @@
             throw new SocketException("Socket is not connected");
         if (!sc.isOutputOpen())
             throw new SocketException("Socket output is shutdown");
         OutputStream os = null;
         try {
-            os = (OutputStream)
-                AccessController.doPrivileged(new PrivilegedExceptionAction() {
-                    public Object run() throws IOException {
+            os = AccessController.doPrivileged(
+                new PrivilegedExceptionAction<OutputStream>() {
+                    public OutputStream run() throws IOException {
                         return Channels.newOutputStream(sc);
                     }
                 });
         } catch (java.security.PrivilegedActionException e) {
             throw (IOException)e.getException();
< prev index next >