Uploaded image for project: 'JDK'
  1. JDK
  2. JDK-6479615

Splash screen cause the VM to crash.

XMLWordPrintable

    • Icon: Bug Bug
    • Resolution: Duplicate
    • Icon: P2 P2
    • None
    • 6
    • client-libs
    • 2d
    • x86
    • windows_xp

      FULL PRODUCT VERSION :
      Hotspot client 1.6.0-rc-b99 mixed mode, sharing.

      FULL OS VERSION :
      Microsoft Windows XP Professional Version 2002 Service Pack 2

      EXTRA RELEVANT SYSTEM CONFIGURATION :
        Toshiba Pentium M laptop (1.7GHz, 496Mb RAM)

      A DESCRIPTION OF THE PROBLEM :
      I am experimenting with the new splash screen options and was trying to manipulate BufferedImage objects when the system crashed. What I am doing very likely contains mistakes as I am manipulating classes I don't know well.

      THE PROBLEM WAS REPRODUCIBLE WITH -Xint FLAG: Yes

      THE PROBLEM WAS REPRODUCIBLE WITH -server FLAG: Did not try

      STEPS TO FOLLOW TO REPRODUCE THE PROBLEM :
      Just run the program.

      EXPECTED VERSUS ACTUAL BEHAVIOR :
      Would like a window to display

      ERROR MESSAGES/STACK TRACES THAT OCCUR :
      Attached seperatly

      REPRODUCIBILITY :
      This bug can be reproduced always.

      ---------- BEGIN SOURCE ----------
      import java.awt.Graphics;
      import java.awt.Graphics2D;
      import java.awt.image.BufferedImage;
      import java.awt.image.RescaleOp;
      import java.io.File;
      import java.io.IOException;

      import javax.imageio.ImageIO;
      import javax.swing.JPanel;
      import javax.swing.JWindow;

      public class BugSplashScreen {

          private JWindow oldFashionedSplashScreen;
          private BufferedImage splashScreenImage;
          private BufferedImage overlay;
         
          BugSplashScreen(String fileName) {
              try {
                  File file = new File(fileName);
                  if (!file.exists()) {
                      throw new IllegalArgumentException("File doesn't exist: "+file.getAbsolutePath());
                  }
                  this.splashScreenImage = getSplashScreenImage(file);
              } catch (IOException e) {
                  throw new Error("Problem with the splash screen image",e);
              }
              int height = this.splashScreenImage.getHeight();
              int width = this.splashScreenImage.getWidth();
              this.oldFashionedSplashScreen = new JWindow();
              this.oldFashionedSplashScreen.setSize(width, height);
              this.oldFashionedSplashScreen.add(new SplashPanel(this.splashScreenImage));
              this.oldFashionedSplashScreen.setVisible(true);
          }
         
          private BufferedImage getSplashScreenImage(File file) throws IOException {
              return ImageIO.read(file);
          }
         
          /**
           * Creates a graphics context (as a {@link Graphics2D} object) for the splash
           * screen overlay image, which allows you to draw over the splash screen.
           * Note that you do not draw on the main image but on the image that is
           * displayed over the main image using alpha blending. Also note that drawing
           * on the overlay image does not necessarily update the contents of splash
           * screen window. You should call {@code update()} on the
           * <code>SplashScreen</code> when you want the splash screen to be
           * updated immediately.
           *
           * @return graphics context for the splash screen overlay surface
           * @throws IllegalStateException if the splash screen has already been closed
           */
          public Graphics2D createGraphics() throws IllegalStateException {
              return this.overlay.createGraphics();
          }

          public void close() {
              this.oldFashionedSplashScreen.setVisible(false);
              this.oldFashionedSplashScreen.dispose();
              this.oldFashionedSplashScreen = null;
          }
         
          class SplashPanel extends JPanel {
             
              BufferedImage bufferedImage;
             
              SplashPanel(BufferedImage bufferedImage) {
                  this.bufferedImage = bufferedImage;
              }
             
              @Override
              protected void paintComponent(Graphics g) {
                  Graphics2D componentGraphics = (Graphics2D)g;
                  //componentGraphics.drawImage(this.bufferedImage, new AffineTransformOp(new AffineTransform(),null),0,0);
                  componentGraphics.drawImage(this.bufferedImage, new RescaleOp(1.0f,0.0f,null),0,0);
              }
          }

          public static void main(String[] args) {
              BugSplashScreen hmss = new BugSplashScreen("PICT0112A.jpg");
              //JETSplashScreen jetSplashScreen = JETSplashScreen.getJETSplashScreen("src/images/PICT0112A.jpg");
              try {
                  Thread.sleep(10000);
              } catch (InterruptedException e) {
                  throw new Error("",e);
              }
              hmss.close();
              //jetSplashScreen.close();
          }
         
      }
      ---------- END SOURCE ----------

      CUSTOMER SUBMITTED WORKAROUND :
      Not yet

            bae Andrew Brygin
            ndcosta Nelson Dcosta (Inactive)
            Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

              Created:
              Updated:
              Resolved:
              Imported:
              Indexed: