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

Overwriting a file using the JWS FileSaveService hangs both the client JVM and browser

XMLWordPrintable

    • Icon: Bug Bug
    • Resolution: Fixed
    • Icon: P2 P2
    • 7u6
    • fx2.0.2, fx2.0.3
    • deploy
    • windows xp 32-bit, FF, Chrome, JavaFX 2.0.2

      Java Plug-in 10.2.1.255
      Using JRE version 1.7.0_02-b13 Java HotSpot(TM) Client VM

      I have an application that provides a feature to export part of the scene as an image. I'm using FileSaveService to do that..something like that:


              exportWorkflowButton.setOnAction(new EventHandler<ActionEvent>() {
                  public void handle(ActionEvent event) {
                      try {
                          if(fileSaveService == null)//lazy init
                              fileSaveService = (FileSaveService) ServiceManager.lookup("javax.jnlp.FileSaveService");

                          
                          Object renderToImage = canvas.renderToImage(null, 1.5f);
                          Image sceneImage = Image.impl_fromPlatformImage(renderToImage);
                          
                          ByteArrayOutputStream os = new ByteArrayOutputStream();
                          ImageIO.write(ImageConverter.convertToAwtImage(sceneImage), "png", os);
                          InputStream imageInputStream = new ByteArrayInputStream(os.toByteArray());
                          
                          //Save the image using the JNLP FileSaveService
                          fileSaveService.saveFileDialog(null, supportedImageExportExtensions, imageInputStream, workSession.getWorkflow().getId()+".png");
                          
                          
                      } catch(Exception e) { //Can't locate JNLP service or can't write to filesystem
                          logger.warning("Can't export canvas to image, due to: " + formatStackTrace(e));
                          DialogManager.showErrorDialog(ImperiaResourceBundle.getBundle().getString("gui.error.exportToImage"));
                      }
                  }
              });


      When the user clicks on the Export button: there's a File Chooser Dialog(swing-based ?!)... then the user needs to input a filename.
      If the user selects an existing file and clicks 'Save' the applet crashes. Otherwise if there's no an existing file the image is saved correctly

            dcherepanov Dmitry Cherepanov
            kiriljfx Kiril (Inactive)
            Votes:
            0 Vote for this issue
            Watchers:
            1 Start watching this issue

              Created:
              Updated:
              Resolved:
              Imported: