Login
[x]
Log in using an account from:
Fedora Account System
Red Hat Associate
Red Hat Customer
Or login using a Red Hat Bugzilla account
Forgot Password
Login:
Hide Forgot
Create an Account
Red Hat Bugzilla – Attachment 1451592 Details for
Bug 1582404
Java font tmp files are deleted from /tmp, leading to JVM crash
[?]
New
Simple Search
Advanced Search
My Links
Browse
Requests
Reports
Current State
Search
Tabular reports
Graphical reports
Duplicates
Other Reports
User Changes
Plotly Reports
Bug Status
Bug Severity
Non-Defaults
|
Product Dashboard
Help
Page Help!
Bug Writing Guidelines
What's new
Browser Support Policy
5.0.4.rh83 Release notes
FAQ
Guides index
User guide
Web Services
Contact
Legal
This site requires JavaScript to be enabled to function correctly, please enable it.
reproducer for the bug
JDK8051956TestCase.java (text/plain), 3.15 KB, created by
István Tóth
on 2018-06-14 20:23:54 UTC
(
hide
)
Description:
reproducer for the bug
Filename:
MIME Type:
Creator:
István Tóth
Created:
2018-06-14 20:23:54 UTC
Size:
3.15 KB
patch
obsolete
>package hu.stoty.jdk8051956.testcase; > >import java.awt.Font; >import java.awt.FontFormatException; >import java.awt.Graphics2D; >import java.awt.font.FontRenderContext; >import java.awt.image.BufferedImage; >import java.io.IOException; >import java.io.InputStream; >import java.nio.file.DirectoryIteratorException; >import java.nio.file.DirectoryStream; >import java.nio.file.FileSystems; >import java.nio.file.FileVisitResult; >import java.nio.file.Files; >import java.nio.file.Path; >import java.nio.file.SimpleFileVisitor; >import java.nio.file.attribute.BasicFileAttributes; >import java.util.ArrayList; > >public class JDK8051956TestCase { > > static ArrayList<Font> fonts = new ArrayList<>(); > > public static Font loadFont(Path fontFilePath) throws IOException, FontFormatException { > > InputStream is = Files.newInputStream(fontFilePath); > if (is == null) { > throw new IOException("Cannot open " + fontFilePath.toString()); > } > > return Font.createFont(Font.TRUETYPE_FONT, is); > } > > public static void loadFonts(Path fontRoot) throws IOException { > > Files.walkFileTree(fontRoot, new SimpleFileVisitor<Path>() { > > @Override > public FileVisitResult visitFile(Path path, BasicFileAttributes attrs) throws IOException { > > if (path.toString().endsWith(".ttf")) { > > try { > fonts.add(loadFont(path)); > System.out.println("loaded " + path.getFileName().toString()); > } catch (FontFormatException e) { > // TODO Auto-generated catch block > e.printStackTrace(); > } > } > > return FileVisitResult.CONTINUE; > } > > @Override > public FileVisitResult visitFileFailed(Path file, IOException exc) throws IOException { > return FileVisitResult.CONTINUE; > } > }); > } > > public static void main(String[] argv) throws FontFormatException, InterruptedException, IOException { > > String ttfDir = "/usr/share/fonts/"; > > if (argv.length > 0) { > ttfDir = argv[0]; > } > > int count = 10; > > if (argv.length > 1) { > count = Integer.parseInt(argv[1]); > } > > BufferedImage i = new BufferedImage(1000, 1000, BufferedImage.TYPE_INT_RGB); > Graphics2D g = i.createGraphics(); > FontRenderContext frc = g.getFontRenderContext(); > > Path dir = FileSystems.getDefault().getPath(ttfDir); > > for (int z = 1; z < count; z++) { > loadFonts(dir); > } > > getBounds(frc, Font.PLAIN, 10); > > // deleteTmpFiles(); > > System.out.println("rm /tmp/*JF* now, then press enter"); > System.in.read(); > > getBounds(frc, Font.ITALIC, 20); > > } > > private static void getBounds(FontRenderContext frc, int fontSize, int fontStyle) > throws FontFormatException, InterruptedException { > > for (Font font : fonts) { > > System.out.println("Get bounds for" + font.getFontName() + " " > + font.deriveFont(fontStyle, fontSize).getStringBounds(font.getFontName(), frc).getHeight()); > > } > > } > > private static void deleteTmpFiles() { > Path dir = FileSystems.getDefault().getPath("/tmp"); > try (DirectoryStream<Path> stream = Files.newDirectoryStream(dir)) { > for (Path file : stream) { > if (file.getFileName().toString().startsWith("+~JF")) { > System.out.println("deleting " + file.toString()); > Files.delete(file); > } > } > > } catch (IOException | DirectoryIteratorException x) { > System.err.println(x); > } > } > >}
You cannot view the attachment while viewing its details because your browser does not support IFRAMEs.
View the attachment on a separate page
.
View Attachment As Raw
Actions:
View
Attachments on
bug 1582404
:
1441429
|
1441443
| 1451592