[OpenJDK 2D-Dev] [PATCH] Request for review: 6904882: java.awt.Font.createFont() causes AccessControlException if executed with "-Djava.security.manager"

Phil Race Phil.Race at Sun.COM
Mon Nov 30 19:49:27 UTC 2009


Like the last one, this could use a regression test - even though
there's a JCK failure. FWIW a trivial one like this :-

import java.awt.*;
import java.io.File;

public class CreateFontSMTest {
     public static void main(String[] args) throws Exception {
         System.setSecurityManager(new SecurityManager());
         Font font = new Font("Dialog", Font.PLAIN, 12);
         System.out.println(font.getFontName());
     }
}

will work, but I also found we already have a test .. which I
guess never got run :-(, called FontPrivilege.java that does
something very similar. Its also in closed and I leave it
up to you whether to open that or add a new one but opening
it would be best.

-phil.



Roman Kennke wrote:
> This patches fixes bug #6904882. As suggested by Phil it puts the whole
> static initializer in a privileged block, grouping the existing 4
> smaller blocks into one, and importantly including the offending
> File.exists() call. This requires to make the static fields non-final.
> 
> http://cr.openjdk.java.net/~rkennke/6904882/webrev.00/
> 
> Ok to commit?
> 
> /Roman
> 
> 



More information about the 2d-dev mailing list