File tree Expand file tree Collapse file tree
core/src/main/java/org/jruby/util/io Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -2578,37 +2578,39 @@ public ChannelFD fd() {
25782578 }
25792579
25802580 public Channel channel () {
2581- assert (fd != null );
2581+ // MRI equivalent: rb_io_check_closed(fptr) + fptr->fd access in io.c
2582+ // when an IO was closed from another thread MRI raises IOError("closed stream") via io_fd_check_closed (io.c)
2583+ checkClosed ();
25822584 return fd .ch ;
25832585 }
25842586
25852587 public ReadableByteChannel readChannel () {
2586- assert ( fd != null );
2588+ checkClosed ( );
25872589 return fd .chRead ;
25882590 }
25892591
25902592 public WritableByteChannel writeChannel () {
2591- assert ( fd != null );
2593+ checkClosed ( );
25922594 return fd .chWrite ;
25932595 }
25942596
25952597 public SeekableByteChannel seekChannel () {
2596- assert ( fd != null );
2598+ checkClosed ( );
25972599 return fd .chSeek ;
25982600 }
25992601
26002602 public SelectableChannel selectChannel () {
2601- assert ( fd != null );
2603+ checkClosed ( );
26022604 return fd .chSelect ;
26032605 }
26042606
26052607 public FileChannel fileChannel () {
2606- assert ( fd != null );
2608+ checkClosed ( );
26072609 return fd .chFile ;
26082610 }
26092611
26102612 public SocketChannel socketChannel () {
2611- assert ( fd != null );
2613+ checkClosed ( );
26122614 return fd .chSock ;
26132615 }
26142616
You can’t perform that action at this time.
0 commit comments