src/java.base/share/classes/java/net/Socket.java
branchniosocketimpl-branch
changeset 57336 766140c67efa
parent 57321 eef9324f94cc
child 57341 733e9746d615
--- a/src/java.base/share/classes/java/net/Socket.java	Sat Apr 13 07:23:18 2019 +0100
+++ b/src/java.base/share/classes/java/net/Socket.java	Sun Apr 21 07:05:04 2019 +0100
@@ -1469,8 +1469,9 @@
         try {
             getImpl().setOption(SocketOptions.IP_TOS, tc);
         } catch (SocketException se) {
-            // may not be supported to change when socket is connected
-            if (!isConnected())
+            // not supported if socket already connected
+            // Solaris returns error in such cases
+            if(!isConnected())
                 throw se;
         }
     }
@@ -1858,14 +1859,7 @@
      * @since 9
      */
     public <T> Socket setOption(SocketOption<T> name, T value) throws IOException {
-        try {
-            getImpl().setOption(name, value);
-        } catch (SocketException se) {
-            // may not be supported to change when socket is connected
-            if (name != StandardSocketOptions.IP_TOS || !isConnected()) {
-                throw se;
-            }
-        }
+        getImpl().setOption(name, value);
         return this;
     }