[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Bug#415109: /usr/bin/gij-wrapper-4.1: SelectableChannel.configureBlocking fails to throw IllegalBlockingModeException



Package: gij-4.1
Version: 4.1.1-20
Severity: normal
File: /usr/bin/gij-wrapper-4.1

The java API for SelectableChannel requires that attempts to toggle
blocking mode with configureBlocking fail when a channel is registered.

This test program demonstrates that gcj fails to throw the expected
exception...

===
# first use sun jvm
msimons@blitz:~/java/listen$ ~/java/jdk1.5.0_10/bin/java test2
java.nio.channels.IllegalBlockingModeException
        at java.nio.channels.spi.AbstractSelectableChannel.configureBlocking(AbstractSelectableChannel.java:257)
        at test2.main(test2.java:19)
# now gcj
msimons@blitz:~/java/listen$ java test2
msimons@blitz:~/java/listen$ reportbug -o blocking.bug `which java`
===


http://java.sun.com/j2se/1.4.2/docs/api/java/nio/channels/SelectableChannel.html
===
Blocking mode

A selectable channel is either in blocking mode or in non-blocking
mode. In blocking mode, every I/O operation invoked upon the channel
will block until it completes. In non-blocking mode an I/O operation
will never block and may transfer fewer bytes than were requested or
possibly no bytes at all. The blocking mode of a selectable channel may
be determined by invoking its isBlocking method.

Newly-created selectable channels are always in blocking
mode. Non-blocking mode is most useful in conjunction with selector-based
multiplexing. A channel must be placed into non-blocking mode before
being registered with a selector, and may not be returned to blocking
mode until it has been deregistered.
===

sample code:
===
import java.net.InetSocketAddress;
import java.nio.channels.SelectionKey;
import java.nio.channels.Selector;
import java.nio.channels.ServerSocketChannel;
import java.nio.channels.spi.SelectorProvider;

public class test2 {
  public static void main(String[] args) {
    try {
      Selector sel = null;
      InetSocketAddress isa = new InetSocketAddress(2300);
      ServerSocketChannel ssc = ServerSocketChannel.open();

      ssc.configureBlocking(false);
      ssc.socket().bind(isa);

      sel = SelectorProvider.provider().openSelector();
      ssc.register(sel, SelectionKey.OP_ACCEPT);
      ssc.configureBlocking(true);
    } catch(Exception e) {
      e.printStackTrace();            
    }
  }
}
===

-- System Information:
Debian Release: 4.0
  APT prefers testing
  APT policy: (990, 'testing'), (500, 'unstable')
Architecture: i386 (i686)
Shell:  /bin/sh linked to /bin/bash
Kernel: Linux 2.6.18-blitz8
Locale: LANG=C, LC_CTYPE=C (charmap=ANSI_X3.4-1968)

Versions of packages gij-4.1 depends on:
ii  gcj-4.1-base                4.1.1-20     The GNU Compiler Collection (gcj b
ii  libc6                       2.3.6.ds1-13 GNU C Library: Shared libraries
ii  libgcc1                     1:4.1.1-21   GCC support library
ii  libgcj7-0                   4.1.1-20     Java runtime library for use with 
ii  zlib1g                      1:1.2.3-13   compression library - runtime

gij-4.1 recommends no packages.

-- debconf-show failed



Reply to: