mbox

[bug#46451,0/2] OpenJDK: Fix NullPointerException when accessing fonts

Message ID 20210212001405.48cabc72@alma-ubu.fritz.box
Headers show

Message

Björn Höfling Feb. 11, 2021, 11:14 p.m. UTC
These two patches fix a NullPointerException in the OpenJDK packages.

The patches apply only to OpenJDK9 and OpenJDK11, but with inheritence
all OpenJDKx with x\in[9..14] are covered.

Here is the bug report:

https://debbugs.gnu.org/cgi/bugreport.cgi?bug=41177

In order to test it you can use the following Main.java:

~~~~~~
import java.awt.*;

public class Main {

    public static void main(String[] args)
    {
        String fonts[] =
            GraphicsEnvironment.getLocalGraphicsEnvironment().getAvailableFontFamilyNames();

        for ( int i = 0; i < fonts.length; i++ )
	    {
		System.out.println(fonts[i]);
	    }
    }
}

~~~~~~~~
Compile: javac Main.java
Run: java -cp . Main

It should print a list of the available fonts.


Björn


Björn Höfling (2):
  gnu: openjdk@9 : Add phase to hardcode libraries.
  gnu: openjdk11: Add phase to hardcode libraries.

 gnu/packages/java.scm | 56 ++++++++++++++++++++++++++++++++++++++++++-
 1 file changed, 55 insertions(+), 1 deletion(-)

Comments

Leo Prikler Feb. 12, 2021, 10:52 a.m. UTC | #1
Hi Björn

Am Freitag, den 12.02.2021, 00:14 +0100 schrieb Björn Höfling:
> These two patches fix a NullPointerException in the OpenJDK packages.
> 
> The patches apply only to OpenJDK9 and OpenJDK11, but with
> inheritence
> all OpenJDKx with x\in[9..14] are covered.
> 
> Here is the bug report:
> 
> https://debbugs.gnu.org/cgi/bugreport.cgi?bug=41177
> 
> In order to test it you can use the following Main.java:
> 
> ~~~~~~
> import java.awt.*;
> 
> public class Main {
> 
>     public static void main(String[] args)
>     {
>         String fonts[] =
>             GraphicsEnvironment.getLocalGraphicsEnvironment().getAvai
> lableFontFamilyNames();
> 
>         for ( int i = 0; i < fonts.length; i++ )
> 	    {
> 		System.out.println(fonts[i]);
> 	    }
>     }
> }
> 
> ~~~~~~~~
> Compile: javac Main.java
> Run: java -cp . Main
> 
> It should print a list of the available fonts.
Indeed, that it does.  At least for 9 and 11, which I've invoked
directly from their store paths.

I've pushed your patches with small changes to the commit messages and
followed up with an indentation fix.

Regards,
Leo
Björn Höfling Feb. 12, 2021, 7:59 p.m. UTC | #2
On Fri, 12 Feb 2021 11:52:50 +0100
Leo Prikler <leo.prikler@student.tugraz.at> wrote:

> I've pushed your patches with small changes to the commit messages and
> followed up with an indentation fix.

Thanks! 

Björn