Bug#414983: gcj-4.1: Compilation bug with java.awt.Component.x

2007-03-15 Thread Eugen Dedu
Package: gcj-4.1
Version: 4.1.1-20
Severity: normal

Hi,

The following program gives error at compilation:

import javax.swing.*;
import java.awt.*;

public class B
{
int x = 0;
class MonJPanel extends JPanel{
protected void paintComponent (Graphics g){
g.fillOval(x-1,9,52,52);
}
}
}

The error is:

snoopy:~/Balle$ javac B.java 
B.java: In class 'B$MonJPanel':
B.java: In method 'B$MonJPanel.paintComponent(java.awt.Graphics)':
B.java:9: error: Can't access package-private field
'java.awt.Component.x' from 'B$MonJPanel'.
g.fillOval(x-1,9,52,52);
  ^
1 error

Why does it try to use x from class Component instead of class B?

If I change x by xx, the compilation is ok.

Cheers,
Eugen Dedu

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

Versions of packages gcj-4.1 depends on:
ii  gcc-4.1 4.1.1-21 The GNU C compiler
ii  gcj-4.1-base4.1.1-20 The GNU Compiler Collection (gcj b
ii  gij-4.1 4.1.1-20 The GNU Java bytecode interpreter
ii  java-common 0.25 Base of all Java packages
ii  libc6   2.3.6.ds1-13 GNU C Library: Shared libraries
ii  libc6-dev   2.3.6.ds1-13 GNU C Library: Development Librari
ii  libgcc1 1:4.2-20060923-1 GCC support library
ii  libgcj7-0   4.1.1-20 Java runtime library for use with 
ii  libgcj7-dev 4.1.1-20 Java development headers and stati
ii  libgcj7-jar 4.1.1-20 Java runtime library for use with 
ii  zlib1g  1:1.2.3-13   compression library - runtime

Versions of packages gcj-4.1 recommends:
ii  fastjar   1:4.1.1-21 Jar creation utility

-- no debconf information


-- 
To UNSUBSCRIBE, email to [EMAIL PROTECTED]
with a subject of "unsubscribe". Trouble? Contact [EMAIL PROTECTED]



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

2007-03-15 Thread Mike Simons
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
[EMAIL PROTECTED]:~/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
[EMAIL PROTECTED]:~/java/listen$ java test2
[EMAIL PROTECTED]:~/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-base4.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


-- 
To UNSUBSCRIBE, email to [EMAIL PROTECTED]
with a subject of "unsubscribe". Trouble? Contact [EMAIL PROTECTED]



Bug#415110: /usr/bin/gij-wrapper-4.1: SocketChannel.get(ByteBuffer) does not detect EOF on a non-blocking socket

2007-03-15 Thread Mike Simons
Package: gij-4.1
Version: 4.1.1-20
Severity: normal
File: /usr/bin/gij-wrapper-4.1

This bug report is a variation of bug:
  http://bugs.donarmstrong.com/cgi-bin/bugreport.cgi?bug=281602
I've confirmed that bug 281602 was fixed... the source code in that
example used a blocking socket, this example uses a non-blocking socket.


To run:
===
# compile
javac test.java  

# start server
java test

# connect a client, send "foo" and close after 3 seconds
echo "foo" | nc -q 3 localhost 2003
===


If you strace the java test process you should see a bunch of this after
the socket is closed:
===
ioctl(6, FIONREAD, [0]) = 0
ioctl(6, FIONREAD, [0]) = 0
ioctl(6, FIONREAD, [0]) = 0
===

GIJ never actually calls read to determine if the socket was closed,
it just assumes that because no bytes are available to read now, that
it can return 0 to caller.


sample source code:
===
import java.net.*;
import java.nio.*;
import java.nio.channels.*;
import java.util.Iterator;

public class test {
public static void main(String[] args) {
try {
Selector serverSelector;

serverSelector = Selector.open();
ServerSocketChannel ssc = ServerSocketChannel.open();
ssc.configureBlocking(true);
ssc.socket().bind(new InetSocketAddress(2003));
SocketChannel sc = ssc.accept();
sc.configureBlocking(false);
while (true) {
ByteBuffer bb = ByteBuffer.allocate(100);
int i = sc.read(bb);
if (i > 0) {
System.out.println("Read : " + i + " bytes.");
for(int j = 0; j < i; j++) {
System.out.print((char)bb.get(j));
}
}
if (i < 0) {
System.out.println("Closing : " + i);
sc.close();
return;
}
}
} catch(Exception ex) {
}
}
}
===


-- 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-base4.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


-- 
To UNSUBSCRIBE, email to [EMAIL PROTECTED]
with a subject of "unsubscribe". Trouble? Contact [EMAIL PROTECTED]