changeset 56558:3e0a90050182

8222917: GraphicsEnvironment for Unix still have an unused dependency on Solaris Reviewed-by: prr
author serb
date Fri, 26 Apr 2019 23:32:46 -0700
parents e2a90479dfe5
children eba6a83dc23b
files src/java.desktop/share/classes/sun/java2d/SunGraphicsEnvironment.java
diffstat 1 files changed, 3 insertions(+), 55 deletions(-) [+]
line wrap: on
line diff
--- a/src/java.desktop/share/classes/sun/java2d/SunGraphicsEnvironment.java	Mon May 20 12:17:34 2019 -0700
+++ b/src/java.desktop/share/classes/sun/java2d/SunGraphicsEnvironment.java	Fri Apr 26 23:32:46 2019 -0700
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 1997, 2018, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1997, 2019, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -39,10 +39,6 @@
 import java.awt.geom.AffineTransform;
 import java.awt.image.BufferedImage;
 import java.awt.peer.ComponentPeer;
-import java.io.BufferedReader;
-import java.io.File;
-import java.io.FileInputStream;
-import java.io.InputStreamReader;
 import java.security.AccessController;
 import java.util.Locale;
 import java.util.TreeMap;
@@ -65,8 +61,8 @@
 public abstract class SunGraphicsEnvironment extends GraphicsEnvironment
     implements DisplayChangedListener {
 
-    public static boolean isOpenSolaris;
-    private static Font defaultFont;
+    /** Establish the default font to be used by SG2D. */
+    private final Font defaultFont = new Font(Font.DIALOG, Font.PLAIN, 12);
 
     private static final boolean uiScaleEnabled;
     private static final double debugScale;
@@ -77,54 +73,6 @@
         debugScale = uiScaleEnabled ? getScaleFactor("sun.java2d.uiScale") : -1;
     }
 
-    public SunGraphicsEnvironment() {
-        java.security.AccessController.doPrivileged(
-                                    new java.security.PrivilegedAction<Object>() {
-            public Object run() {
-                String osName = System.getProperty("os.name");
-                if ("SunOS".equals(osName)) {
-                    String version = System.getProperty("os.version", "0.0");
-                    try {
-                        float ver = Float.parseFloat(version);
-                        if (ver > 5.10f) {
-                            File f = new File("/etc/release");
-                            FileInputStream fis = new FileInputStream(f);
-                            InputStreamReader isr
-                                = new InputStreamReader(fis, "ISO-8859-1");
-                            BufferedReader br = new BufferedReader(isr);
-                            String line = br.readLine();
-                            if (line.indexOf("OpenSolaris") >= 0) {
-                                isOpenSolaris = true;
-                            } else {
-                                /* We are using isOpenSolaris as meaning
-                                 * we know the Solaris commercial fonts aren't
-                                 * present. "Solaris Next" (03/10) did not
-                                 * include these even though its was not
-                                 * OpenSolaris. Need to revisit how this is
-                                 * handled but for now as in 6ux, we'll use
-                                 * the test for a standard font resource as
-                                 * being an indicator as to whether we need
-                                 * to treat this as OpenSolaris from a font
-                                 * config perspective.
-                                 */
-                                String courierNew =
-                                    "/usr/openwin/lib/X11/fonts/TrueType/CourierNew.ttf";
-                                File courierFile = new File(courierNew);
-                                isOpenSolaris = !courierFile.exists();
-                            }
-                            fis.close();
-                        }
-                    } catch (Exception e) {
-                    }
-                }
-                /* Establish the default font to be used by SG2D etc */
-                defaultFont = new Font(Font.DIALOG, Font.PLAIN, 12);
-
-                return null;
-            }
-        });
-    }
-
     protected GraphicsDevice[] screens;
 
     /**