jdk/src/java.base/unix/classes/java/net/PlainSocketImpl.java
changeset 34968 93b315c61ca3
parent 30963 88469d06e03f
child 36115 0676e37a0b9c
equal deleted inserted replaced
34967:5921e8a0ff14 34968:93b315c61ca3
    59 
    59 
    60     protected <T> void setOption(SocketOption<T> name, T value) throws IOException {
    60     protected <T> void setOption(SocketOption<T> name, T value) throws IOException {
    61         if (!name.equals(ExtendedSocketOptions.SO_FLOW_SLA)) {
    61         if (!name.equals(ExtendedSocketOptions.SO_FLOW_SLA)) {
    62             super.setOption(name, value);
    62             super.setOption(name, value);
    63         } else {
    63         } else {
       
    64             if (getSocket() == null || !flowSupported()) {
       
    65                 throw new UnsupportedOperationException("unsupported option");
       
    66             }
    64             if (isClosedOrPending()) {
    67             if (isClosedOrPending()) {
    65                 throw new SocketException("Socket closed");
    68                 throw new SocketException("Socket closed");
    66             }
    69             }
    67             checkSetOptionPermission(name);
    70             checkSetOptionPermission(name);
    68             checkValueType(value, SocketFlow.class);
    71             checkValueType(value, SocketFlow.class);
    72 
    75 
    73     @SuppressWarnings("unchecked")
    76     @SuppressWarnings("unchecked")
    74     protected <T> T getOption(SocketOption<T> name) throws IOException {
    77     protected <T> T getOption(SocketOption<T> name) throws IOException {
    75         if (!name.equals(ExtendedSocketOptions.SO_FLOW_SLA)) {
    78         if (!name.equals(ExtendedSocketOptions.SO_FLOW_SLA)) {
    76             return super.getOption(name);
    79             return super.getOption(name);
       
    80         }
       
    81         if (getSocket() == null || !flowSupported()) {
       
    82             throw new UnsupportedOperationException("unsupported option");
    77         }
    83         }
    78         if (isClosedOrPending()) {
    84         if (isClosedOrPending()) {
    79             throw new SocketException("Socket closed");
    85             throw new SocketException("Socket closed");
    80         }
    86         }
    81         checkGetOptionPermission(name);
    87         checkGetOptionPermission(name);