jdk/src/share/classes/sun/nio/ch/AsynchronousSocketChannelImpl.java
changeset 7298 895772293d6e
parent 5506 202f599c92aa
child 7668 d4a77089c587
equal deleted inserted replaced
7297:906c58a8b849 7298:895772293d6e
   233             return null;
   233             return null;
   234         }
   234         }
   235 
   235 
   236         if (remoteAddress == null)
   236         if (remoteAddress == null)
   237             throw new NotYetConnectedException();
   237             throw new NotYetConnectedException();
   238         if (timeout < 0L)
       
   239             throw new IllegalArgumentException("Negative timeout");
       
   240 
   238 
   241         boolean hasSpaceToRead = isScatteringRead || dst.hasRemaining();
   239         boolean hasSpaceToRead = isScatteringRead || dst.hasRemaining();
   242         boolean shutdown = false;
   240         boolean shutdown = false;
   243 
   241 
   244         // check and update state
   242         // check and update state
   340 
   338 
   341         boolean closed = false;
   339         boolean closed = false;
   342         if (isOpen()) {
   340         if (isOpen()) {
   343             if (remoteAddress == null)
   341             if (remoteAddress == null)
   344                 throw new NotYetConnectedException();
   342                 throw new NotYetConnectedException();
   345              if (timeout < 0L)
       
   346                 throw new IllegalArgumentException("Negative timeout");
       
   347             // check and update state
   343             // check and update state
   348             synchronized (writeLock) {
   344             synchronized (writeLock) {
   349                 if (writeKilled)
   345                 if (writeKilled)
   350                     throw new IllegalStateException("Writing not allowed due to timeout or cancellation");
   346                     throw new IllegalStateException("Writing not allowed due to timeout or cancellation");
   351                 if (writing)
   347                 if (writing)