Skip to content

GitLab

  • Projects
  • Groups
  • Snippets
  • Help
    • Loading...
  • Help
    • Help
    • Support
    • Community forum
    • Submit feedback
    • Contribute to GitLab
  • Sign in / Register
aports
aports
  • Project overview
    • Project overview
    • Details
    • Activity
    • Releases
  • Repository
    • Repository
    • Files
    • Commits
    • Branches
    • Tags
    • Contributors
    • Graph
    • Compare
  • Issues 636
    • Issues 636
    • List
    • Boards
    • Labels
    • Service Desk
    • Milestones
  • Merge Requests 193
    • Merge Requests 193
  • CI / CD
    • CI / CD
    • Pipelines
    • Jobs
    • Schedules
  • Operations
    • Operations
    • Incidents
    • Environments
  • Analytics
    • Analytics
    • CI / CD
    • Repository
    • Value Stream
  • Members
    • Members
  • Collapse sidebar
  • Activity
  • Graph
  • Create a new issue
  • Jobs
  • Commits
  • Issue Boards
  • alpine
  • aportsaports
  • Issues
  • #12030

Closed
Open
Opened Oct 20, 2020 by Simon F@bratkartoffelReporter1 of 9 tasks completed1/9 tasks

all java version: Using AWT in non-headless JRE yields NPE in internal class

Installing the non-headless version of a JRE should include everything needed to run applications in non-headless modes. This mainly affects drawing / printing applications using jfreechart or batik. This is not the case with current java packages in alpine, but also affects other vendors like AdoptOpenJDK (https://github.com/AdoptOpenJDK/openjdk-docker/issues/75).

The stacktrace differes between Java-Version, but looks like this:

Caused by: java.lang.NullPointerException
	at sun.awt.FontConfiguration.getVersion(FontConfiguration.java:1264)
	at sun.awt.FontConfiguration.readFontConfigFile(FontConfiguration.java:219)
	at sun.awt.FontConfiguration.init(FontConfiguration.java:107)
	at sun.awt.X11FontManager.createFontConfiguration(X11FontManager.java:774)
	at sun.font.SunFontManager$2.run(SunFontManager.java:431)
	at java.security.AccessController.doPrivileged(Native Method)
	at sun.font.SunFontManager.<init>(SunFontManager.java:376)
	at sun.awt.FcFontManager.<init>(FcFontManager.java:35)
	at sun.awt.X11FontManager.<init>(X11FontManager.java:57)

and
Caused by: java.lang.NullPointerException
        at java.desktop/sun.awt.FontConfiguration.getVersion(FontConfiguration.java:1262)
        at java.desktop/sun.awt.FontConfiguration.readFontConfigFile(FontConfiguration.java:225)
        at java.desktop/sun.awt.FontConfiguration.init(FontConfiguration.java:107)
        at java.desktop/sun.awt.X11FontManager.createFontConfiguration(X11FontManager.java:719)

The error can be reproduced with the following class:

import java.awt.image.BufferedImage;

public class Test {
    public static void main(String[] args) {
        BufferedImage image = new BufferedImage(10, 10, BufferedImage.TYPE_INT_RGB);
        System.out.println(image.getGraphics());
    }
}

The issue can be fixed quite easily by installing a font. But as this error is not intuitive we should install some font by default wehn installing the JRE.

  • openjdk7
  • openjdk8 (!13758 (closed))
  • openjdk9
  • openjdk10
  • openjdk11
  • openjdk12
  • openjdk13
  • openjdk14
  • openjdk15
Edited Oct 20, 2020 by Simon F
To upload designs, you'll need to enable LFS and have admin enable hashed storage. More information
Assignee
Assign to
None
Milestone
None
Assign milestone
Time tracking
None
Due date
None
Reference: alpine/aports#12030