JDK-4250457 : InputStream.read() contains undocumented behaviour when interrupted
  • Type: Bug
  • Component: core-libs
  • Sub-Component: java.io
  • Affected Version: 1.2.1
  • Priority: P4
  • Status: Closed
  • Resolution: Not an Issue
  • OS: generic
  • CPU: generic
  • Submitted: 1999-06-29
  • Updated: 2011-06-10
  • Resolved: 2011-06-10
Related Reports
Relates :  
Description
Name: vi73552			Date: 06/29/99


- The documentation of the method read-methods of 
  java.io.InputStream dos not explain what happens,
  if a thread is blocked in read and another thread
  send interrupt() to the blocked thread.

- Unter Linux/JDK 1.1.6 and Win95/1.2 read ends with
  -1 as result. Bad: The -1 stands for EOF. But an
  interrupt isn't EOF!!!!

- Unter Solaris/JDK1.2.1 the read is interrupted with
  an IOException with message "Interrupted systen call".
  Bad: A interrupt isn't a I/O-Error!!!

I thing this is the correct solution: InterruptedException
should extend RuntimeExeption, so read can throw these
Exception. interrupt to an blocked read should throw
InterruptedException.

At least you should define a uniq behaviour in the 
documentation.

Write once, run everwhere....
(Review ID: 84964) 
======================================================================

Comments
EVALUATION This is no longer an issue in jdk7 because legacy interruptible I/O is disabled by default on Solaris. It was never implemented on Winodws, and not has been implemented on Linux since jdk1.3.
10-06-2011

EVALUATION Solaris specific and general behavior falling under the label of "interruptible I/O", that is, connected with InterruptedIOException and in some cases InterruptedException, does need better documentation. See CR 4385444 for additional details and CR 4329256 for workaround info.
16-02-2006

WORK AROUND Name: vi73552 Date: 06/29/99 - Test IOException against "Interrupted system call" - Don't thing a result of -1 from read means EOF! - What happens unter AIX, MacOS,... ======================================================================
25-09-2004