Java program crashes vnc 4.0 server
Peter Fales
psfales "at" lucent.com
Fri Jan 14 21:21:01 2005
We're seeing cases where where java applications can consistently cause
the 4.0 server to crash. It requires a fairly specific set of circumstances
- Solaris 8 (doesn't crash on Linux, not sure about other Solaris versions)
- Sun's J2SDK 1.4.2_06 (doesn't crash with 1.4.0 or 1.4.1)
- VNC 4.0 server running in default 8 bit mode (doesn't crash with -depth 24)
To reproduce, copy the following code (from
http://java.sun.com/developer/qow/archive/24/) into a file called
SplashTest.java, and run
$ javac SplashTest.java
$ java SplashTest
(Move the mouse onto the splash screen when it comes up)
Given that java 1.4.0 and 1.4.1 are OK, I almost wonder if there is a bug
in java. But even if there is, it would be nice if it didn't crash
the server.
============================ cut here ==============================
import java.awt.event.*;
import java.awt.*;
public class SplashTest {
public static void main(String args[]) {
new SplashWindowFrame();
}
}
class SplashWindowFrame extends Frame {
SplashWindow sw;
Image splashIm;
SplashWindowFrame() {
super();
/* Add the window listener */
addWindowListener(new WindowAdapter() {
public void windowClosing(WindowEvent evt) {
dispose();
System.exit(0);
}});
/* Size the frame */
setSize(200,200);
/* Center the frame */
Dimension screenDim =
Toolkit.getDefaultToolkit().getScreenSize();
Rectangle frameDim = getBounds();
setLocation((screenDim.width - frameDim.width) / 2,
(screenDim.height - frameDim.height) / 2);
MediaTracker mt = new MediaTracker(this);
splashIm = Toolkit.getDefaultToolkit(
).getImage("test.gif");
mt.addImage(splashIm,0);
try {
mt.waitForID(0);
} catch(InterruptedException ie){}
sw = new SplashWindow(this,splashIm);
try {
Thread.sleep(3000);
} catch(InterruptedException ie){}
sw.dispose();
/* Show the frame */
setVisible(true);
}
}
class SplashWindow extends Window {
Image splashIm;
SplashWindow(Frame parent, Image splashIm) {
super(parent);
this.splashIm = splashIm;
setSize(200,200);
/* Center the window */
Dimension screenDim =
Toolkit.getDefaultToolkit().getScreenSize();
Rectangle winDim = getBounds();
setLocation((screenDim.width - winDim.width) / 2,
(screenDim.height - winDim.height) / 2);
setVisible(true);
}
public void paint(Graphics g) {
if (splashIm != null) {
g.drawImage(splashIm,0,0,this);
}
}
}
============================ cut here ==============================
--
Peter Fales Lucent Technologies, Room 1C-436
N9IYJ 2000 N Naperville Rd PO Box 3033
internet: psfales "at" lucent.com Naperville, IL 60566-7033
work: (630) 979-8031