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

Generated temp files (+JXF...temp) for custom fonts not deleted on exit.

XMLWordPrintable

    • Icon: Bug Bug
    • Resolution: Fixed
    • Icon: P4 P4
    • 9
    • 8u74, 9
    • javafx
    • x86_64
    • windows_7

        FULL PRODUCT VERSION :
        java version "1.8.0_74"
        Java(TM) SE Runtime Environment (build 1.8.0_74-b02)
        Java HotSpot(TM) 64-Bit Server VM (build 25.74-b02, mixed mode)


        ADDITIONAL OS VERSION INFORMATION :
        Win 7 x64

        A DESCRIPTION OF THE PROBLEM :
        Generated temp files (+JXF...temp) for custom fonts not deleted on exit.



        STEPS TO FOLLOW TO REPRODUCE THE PROBLEM :
        Run the attached code with font "ARIAL.ttf"

        EXPECTED VERSUS ACTUAL BEHAVIOR :
        EXPECTED -
        The generated temp font file "[user_home]/AppData/Local/Temp/+JXF....tmp" deleted on exit
        ACTUAL -
        Temp file not deleted.

        ERROR MESSAGES/STACK TRACES THAT OCCUR :
        No error message.

        REPRODUCIBILITY :
        This bug can be reproduced always.

        ---------- BEGIN SOURCE ----------
        import java.io.IOException;
        import java.io.InputStream;

        import javax.naming.ConfigurationException;

        import javafx.application.Application;
        import javafx.scene.Scene;
        import javafx.scene.control.Label;
        import javafx.scene.layout.StackPane;
        import javafx.stage.Stage;

        public class FxFontApplication extends Application {

        private static final String fontName = "ARIAL.ttf";

        public static void main(String[] args) {
        launch(args);
        }

        @Override
        public void start(Stage primaryStage) throws ConfigurationException, IOException {

        loadFontForFX();

        StackPane root = new StackPane();
        root.getChildren().add(new Label("Hello Font"));

        Scene scene = new Scene(root, 300, 200, javafx.scene.paint.Color.ALICEBLUE);
        // No difference with or without css
        // scene.getStylesheets().add(getClass().getResource("application.css").toExternalForm());

        primaryStage.setScene(scene);
        primaryStage.show();
        }

        private void loadFontForFX() throws ConfigurationException, IOException {

        InputStream inputStream = FxFontApplication.class.getResourceAsStream(fontName);
        javafx.scene.text.Font loadedFont = javafx.scene.text.Font.loadFont(inputStream, -1);
        if (loadedFont == null) {
        throw new ConfigurationException("Cannot load font for JavaFX from file '" + fontName + "'.");
        }
        inputStream.close();
        }

        }
        ---------- END SOURCE ----------

        CUSTOMER SUBMITTED WORKAROUND :
        No workaround found.

              prr Philip Race
              webbuggrp Webbug Group
              Votes:
              0 Vote for this issue
              Watchers:
              6 Start watching this issue

                Created:
                Updated:
                Resolved: