harmony-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From apavle...@apache.org
Subject svn commit: r635992 - in /harmony/enhanced/classlib/trunk/modules/awt/src/main/java: common/org/apache/harmony/awt/ common/org/apache/harmony/awt/gl/ common/org/apache/harmony/awt/gl/color/ common/org/apache/harmony/awt/gl/font/ common/org/apache/harmo...
Date Tue, 11 Mar 2008 16:08:09 GMT
Author: apavlenko
Date: Tue Mar 11 09:08:06 2008
New Revision: 635992

URL: http://svn.apache.org/viewvc?rev=635992&view=rev
Log:
Secured actions wrapped in PrivilegedAction objects

Added:
    harmony/enhanced/classlib/trunk/modules/awt/src/main/java/common/org/apache/harmony/awt/Utils.java
  (with props)
Modified:
    harmony/enhanced/classlib/trunk/modules/awt/src/main/java/common/org/apache/harmony/awt/gl/CommonGraphics2D.java
    harmony/enhanced/classlib/trunk/modules/awt/src/main/java/common/org/apache/harmony/awt/gl/Surface.java
    harmony/enhanced/classlib/trunk/modules/awt/src/main/java/common/org/apache/harmony/awt/gl/color/NativeCMM.java
    harmony/enhanced/classlib/trunk/modules/awt/src/main/java/common/org/apache/harmony/awt/gl/font/FontManager.java
    harmony/enhanced/classlib/trunk/modules/awt/src/main/java/common/org/apache/harmony/awt/gl/font/fontlib/FLFontManager.java
    harmony/enhanced/classlib/trunk/modules/awt/src/main/java/common/org/apache/harmony/awt/gl/image/GifDecoder.java
    harmony/enhanced/classlib/trunk/modules/awt/src/main/java/common/org/apache/harmony/awt/gl/image/JpegDecoder.java
    harmony/enhanced/classlib/trunk/modules/awt/src/main/java/common/org/apache/harmony/awt/gl/image/PngDecoder.java
    harmony/enhanced/classlib/trunk/modules/awt/src/main/java/common/org/apache/harmony/awt/gl/opengl/GL.java
    harmony/enhanced/classlib/trunk/modules/awt/src/main/java/common/org/apache/harmony/awt/nativebridge/NativeBridge.java
    harmony/enhanced/classlib/trunk/modules/awt/src/main/java/unix/org/apache/harmony/awt/gl/font/LinuxNativeFont.java
    harmony/enhanced/classlib/trunk/modules/awt/src/main/java/unix/org/apache/harmony/awt/nativebridge/linux/GLX.java
    harmony/enhanced/classlib/trunk/modules/awt/src/main/java/unix/org/apache/harmony/awt/nativebridge/linux/X11.java
    harmony/enhanced/classlib/trunk/modules/awt/src/main/java/unix/org/apache/harmony/awt/nativebridge/linux/Xft.java
    harmony/enhanced/classlib/trunk/modules/awt/src/main/java/unix/org/apache/harmony/awt/wtk/linux/LinuxWTK.java
    harmony/enhanced/classlib/trunk/modules/awt/src/main/java/unix/org/apache/harmony/awt/wtk/linux/XServerConnection.java
    harmony/enhanced/classlib/trunk/modules/awt/src/main/java/windows/org/apache/harmony/awt/datatransfer/windows/WinDTK.java
    harmony/enhanced/classlib/trunk/modules/awt/src/main/java/windows/org/apache/harmony/awt/gl/font/NativeFont.java
    harmony/enhanced/classlib/trunk/modules/awt/src/main/java/windows/org/apache/harmony/awt/gl/windows/WinGDIGraphics2D.java
    harmony/enhanced/classlib/trunk/modules/awt/src/main/java/windows/org/apache/harmony/awt/gl/windows/WinGDIPGraphics2D.java
    harmony/enhanced/classlib/trunk/modules/awt/src/main/java/windows/org/apache/harmony/awt/gl/windows/WinGraphicsEnvironment.java
    harmony/enhanced/classlib/trunk/modules/awt/src/main/java/windows/org/apache/harmony/awt/nativebridge/windows/Callback.java
    harmony/enhanced/classlib/trunk/modules/awt/src/main/java/windows/org/apache/harmony/awt/nativebridge/windows/WGL.java
    harmony/enhanced/classlib/trunk/modules/awt/src/main/java/windows/org/apache/harmony/awt/nativebridge/windows/Win32.java
    harmony/enhanced/classlib/trunk/modules/awt/src/main/java/windows/org/apache/harmony/awt/nativebridge/windows/WinDataTransfer.java
    harmony/enhanced/classlib/trunk/modules/awt/src/main/java/windows/org/apache/harmony/awt/wtk/windows/WinWTK.java

Added: harmony/enhanced/classlib/trunk/modules/awt/src/main/java/common/org/apache/harmony/awt/Utils.java
URL: http://svn.apache.org/viewvc/harmony/enhanced/classlib/trunk/modules/awt/src/main/java/common/org/apache/harmony/awt/Utils.java?rev=635992&view=auto
==============================================================================
--- harmony/enhanced/classlib/trunk/modules/awt/src/main/java/common/org/apache/harmony/awt/Utils.java
(added)
+++ harmony/enhanced/classlib/trunk/modules/awt/src/main/java/common/org/apache/harmony/awt/Utils.java
Tue Mar 11 09:08:06 2008
@@ -0,0 +1,56 @@
+/*
+ *  Licensed to the Apache Software Foundation (ASF) under one or more
+ *  contributor license agreements.  See the NOTICE file distributed with
+ *  this work for additional information regarding copyright ownership.
+ *  The ASF licenses this file to You under the Apache License, Version 2.0
+ *  (the "License"); you may not use this file except in compliance with
+ *  the License.  You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ *  Unless required by applicable law or agreed to in writing, software
+ *  distributed under the License is distributed on an "AS IS" BASIS,
+ *  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ *  See the License for the specific language governing permissions and
+ *  limitations under the License.
+ */
+
+package org.apache.harmony.awt;
+
+import java.security.AccessController;
+import java.security.PrivilegedAction;
+import java.security.PrivilegedActionException;
+import java.security.PrivilegedExceptionAction;
+
+public final class Utils {
+
+    public static String getSystemProperty(final String name) {
+        return AccessController.doPrivileged(new PrivilegedAction<String>() {
+            public String run() {
+                return System.getProperty(name);
+            }
+        });
+    }
+
+    public static void loadLibrary(final String name)
+                    throws UnsatisfiedLinkError, NullPointerException {
+        try {
+            AccessController.doPrivileged(new PrivilegedExceptionAction<Object>() {
+                public Object run() {
+                    System.loadLibrary(name);
+                    return null;
+                }
+            });
+        } catch (final PrivilegedActionException ex) {
+            final Throwable cause = ex.getCause();
+
+            if (cause instanceof UnsatisfiedLinkError) {
+                throw (UnsatisfiedLinkError) cause;
+            }
+
+            if (cause instanceof NullPointerException) {
+                throw (NullPointerException) cause;
+            }
+        }
+    }
+}

Propchange: harmony/enhanced/classlib/trunk/modules/awt/src/main/java/common/org/apache/harmony/awt/Utils.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: harmony/enhanced/classlib/trunk/modules/awt/src/main/java/common/org/apache/harmony/awt/Utils.java
------------------------------------------------------------------------------
    svn:executable = *

Modified: harmony/enhanced/classlib/trunk/modules/awt/src/main/java/common/org/apache/harmony/awt/gl/CommonGraphics2D.java
URL: http://svn.apache.org/viewvc/harmony/enhanced/classlib/trunk/modules/awt/src/main/java/common/org/apache/harmony/awt/gl/CommonGraphics2D.java?rev=635992&r1=635991&r2=635992&view=diff
==============================================================================
--- harmony/enhanced/classlib/trunk/modules/awt/src/main/java/common/org/apache/harmony/awt/gl/CommonGraphics2D.java
(original)
+++ harmony/enhanced/classlib/trunk/modules/awt/src/main/java/common/org/apache/harmony/awt/gl/CommonGraphics2D.java
Tue Mar 11 09:08:06 2008
@@ -180,7 +180,7 @@
 
 
     // Print debug output or not
-    protected static final boolean debugOutput = "1".equals(System.getProperty("g2d.debug"));
//$NON-NLS-1$ //$NON-NLS-2$
+    protected static final boolean debugOutput = "1".equals(org.apache.harmony.awt.Utils.getSystemProperty("g2d.debug"));
//$NON-NLS-1$ //$NON-NLS-2$
 
     // Constructors
     protected CommonGraphics2D() {

Modified: harmony/enhanced/classlib/trunk/modules/awt/src/main/java/common/org/apache/harmony/awt/gl/Surface.java
URL: http://svn.apache.org/viewvc/harmony/enhanced/classlib/trunk/modules/awt/src/main/java/common/org/apache/harmony/awt/gl/Surface.java?rev=635992&r1=635991&r2=635992&view=diff
==============================================================================
--- harmony/enhanced/classlib/trunk/modules/awt/src/main/java/common/org/apache/harmony/awt/gl/Surface.java
(original)
+++ harmony/enhanced/classlib/trunk/modules/awt/src/main/java/common/org/apache/harmony/awt/gl/Surface.java
Tue Mar 11 09:08:06 2008
@@ -82,7 +82,7 @@
     private static final int BLUE_555_MASK = 0x001f;
 
     static{
-        System.loadLibrary("gl"); //$NON-NLS-1$
+        org.apache.harmony.awt.Utils.loadLibrary("gl"); //$NON-NLS-1$
         initIDs();
     }
 

Modified: harmony/enhanced/classlib/trunk/modules/awt/src/main/java/common/org/apache/harmony/awt/gl/color/NativeCMM.java
URL: http://svn.apache.org/viewvc/harmony/enhanced/classlib/trunk/modules/awt/src/main/java/common/org/apache/harmony/awt/gl/color/NativeCMM.java?rev=635992&r1=635991&r2=635992&view=diff
==============================================================================
--- harmony/enhanced/classlib/trunk/modules/awt/src/main/java/common/org/apache/harmony/awt/gl/color/NativeCMM.java
(original)
+++ harmony/enhanced/classlib/trunk/modules/awt/src/main/java/common/org/apache/harmony/awt/gl/color/NativeCMM.java
Tue Mar 11 09:08:06 2008
@@ -77,7 +77,7 @@
             AccessController.doPrivileged(
                   new PrivilegedAction<Void>() {
                     public Void run() {
-                        System.loadLibrary("lcmm"); //$NON-NLS-1$
+                        org.apache.harmony.awt.Utils.loadLibrary("lcmm"); //$NON-NLS-1$
                         return null;
                     }
             } );

Modified: harmony/enhanced/classlib/trunk/modules/awt/src/main/java/common/org/apache/harmony/awt/gl/font/FontManager.java
URL: http://svn.apache.org/viewvc/harmony/enhanced/classlib/trunk/modules/awt/src/main/java/common/org/apache/harmony/awt/gl/font/FontManager.java?rev=635992&r1=635991&r2=635992&view=diff
==============================================================================
--- harmony/enhanced/classlib/trunk/modules/awt/src/main/java/common/org/apache/harmony/awt/gl/font/FontManager.java
(original)
+++ harmony/enhanced/classlib/trunk/modules/awt/src/main/java/common/org/apache/harmony/awt/gl/font/FontManager.java
Tue Mar 11 09:08:06 2008
@@ -28,6 +28,8 @@
 import java.io.IOException;
 import java.lang.ref.ReferenceQueue;
 import java.lang.ref.SoftReference;
+import java.security.AccessController;
+import java.security.PrivilegedAction;
 import java.util.Enumeration;
 import java.util.Hashtable;
 import java.util.Locale;
@@ -36,7 +38,7 @@
 
 import org.apache.harmony.awt.gl.CommonGraphics2DFactory;
 import org.apache.harmony.awt.gl.font.fontlib.FLFontManager;
-
+import org.apache.harmony.awt.Utils;
 
 public abstract class FontManager {
 
@@ -44,8 +46,7 @@
         java.awt.Toolkit.getDefaultToolkit();
     }
     
-    public static final boolean IS_FONTLIB = "true".equals(System.getProperty("java.awt.fontlib"))
|| 
-        GraphicsEnvironment.isHeadless();
+    public static final boolean IS_FONTLIB  = "true".equals(Utils.getSystemProperty("java.awt.fontlib"))
|| GraphicsEnvironment.isHeadless();    
     
     /**
      * array of font families names
@@ -205,16 +206,19 @@
      */
     public Hashtable<String, Vector<FontProperty>> fProperties = new Hashtable<String,
Vector<FontProperty>>();
 
-    public FontManager(){
-        
+    public FontManager() {
         if (!IS_FONTLIB) {
             allFamilies = getAllFamilies();
             /*
              * Creating and registering shutdown hook to free resources
              * before object is destroyed.
              */
-            DisposeNativeHook shutdownHook = new DisposeNativeHook();
-            Runtime.getRuntime().addShutdownHook(shutdownHook);
+            AccessController.doPrivileged(new PrivilegedAction<Object>() {
+                public Object run() {
+                    Runtime.getRuntime().addShutdownHook(new DisposeNativeHook());
+                    return null;
+                }
+            });
         }
     }
 
@@ -577,11 +581,11 @@
     public static File getFontPropertyFile(){
         File file = null;
 
-        String javaHome = System.getProperty("java.home"); //$NON-NLS-1$
+        String javaHome = Utils.getSystemProperty("java.home"); //$NON-NLS-1$
         Locale l = Locale.getDefault();
         String language = l.getLanguage();
         String country = l.getCountry();
-        String fileEncoding = System.getProperty("file.encoding"); //$NON-NLS-1$
+        String fileEncoding = Utils.getSystemProperty("file.encoding"); //$NON-NLS-1$
 
         String os = System.getProperty("os.name"); //$NON-NLS-1$
 

Modified: harmony/enhanced/classlib/trunk/modules/awt/src/main/java/common/org/apache/harmony/awt/gl/font/fontlib/FLFontManager.java
URL: http://svn.apache.org/viewvc/harmony/enhanced/classlib/trunk/modules/awt/src/main/java/common/org/apache/harmony/awt/gl/font/fontlib/FLFontManager.java?rev=635992&r1=635991&r2=635992&view=diff
==============================================================================
--- harmony/enhanced/classlib/trunk/modules/awt/src/main/java/common/org/apache/harmony/awt/gl/font/fontlib/FLFontManager.java
(original)
+++ harmony/enhanced/classlib/trunk/modules/awt/src/main/java/common/org/apache/harmony/awt/gl/font/fontlib/FLFontManager.java
Tue Mar 11 09:08:06 2008
@@ -22,6 +22,8 @@
 import java.io.File;
 import java.io.FilenameFilter;
 import java.io.IOException;
+import java.security.AccessController;
+import java.security.PrivilegedAction;
 import java.util.ArrayList;
 import java.util.Enumeration;
 import java.util.Hashtable;
@@ -37,12 +39,16 @@
     private ArrayList<Font> allFonts = new ArrayList<Font>(); 
     
     static {
-        System.loadLibrary("FL");
+        org.apache.harmony.awt.Utils.loadLibrary("FL");
     }
 
     public FLFontManager() {
-        
-        Runtime.getRuntime().addShutdownHook(new DisposeNativeHook());
+        AccessController.doPrivileged(new PrivilegedAction<Object>() {
+            public Object run() {
+                Runtime.getRuntime().addShutdownHook(new DisposeNativeHook());
+                return null;
+            }
+        });
 
         initManager();
         

Modified: harmony/enhanced/classlib/trunk/modules/awt/src/main/java/common/org/apache/harmony/awt/gl/image/GifDecoder.java
URL: http://svn.apache.org/viewvc/harmony/enhanced/classlib/trunk/modules/awt/src/main/java/common/org/apache/harmony/awt/gl/image/GifDecoder.java?rev=635992&r1=635991&r2=635992&view=diff
==============================================================================
--- harmony/enhanced/classlib/trunk/modules/awt/src/main/java/common/org/apache/harmony/awt/gl/image/GifDecoder.java
(original)
+++ harmony/enhanced/classlib/trunk/modules/awt/src/main/java/common/org/apache/harmony/awt/gl/image/GifDecoder.java
Tue Mar 11 09:08:06 2008
@@ -32,7 +32,7 @@
     private static native void initIDs();
 
     static {
-        System.loadLibrary("gl"); //$NON-NLS-1$
+        org.apache.harmony.awt.Utils.loadLibrary("gl"); //$NON-NLS-1$
         initIDs();
     }
 

Modified: harmony/enhanced/classlib/trunk/modules/awt/src/main/java/common/org/apache/harmony/awt/gl/image/JpegDecoder.java
URL: http://svn.apache.org/viewvc/harmony/enhanced/classlib/trunk/modules/awt/src/main/java/common/org/apache/harmony/awt/gl/image/JpegDecoder.java?rev=635992&r1=635991&r2=635992&view=diff
==============================================================================
--- harmony/enhanced/classlib/trunk/modules/awt/src/main/java/common/org/apache/harmony/awt/gl/image/JpegDecoder.java
(original)
+++ harmony/enhanced/classlib/trunk/modules/awt/src/main/java/common/org/apache/harmony/awt/gl/image/JpegDecoder.java
Tue Mar 11 09:08:06 2008
@@ -82,7 +82,7 @@
     private ColorModel cm = null;
 
     static {
-        System.loadLibrary("jpegdecoder"); //$NON-NLS-1$
+        org.apache.harmony.awt.Utils.loadLibrary("jpegdecoder"); //$NON-NLS-1$
 
         cmGray = new ComponentColorModel(
                 ColorSpace.getInstance(ColorSpace.CS_GRAY),

Modified: harmony/enhanced/classlib/trunk/modules/awt/src/main/java/common/org/apache/harmony/awt/gl/image/PngDecoder.java
URL: http://svn.apache.org/viewvc/harmony/enhanced/classlib/trunk/modules/awt/src/main/java/common/org/apache/harmony/awt/gl/image/PngDecoder.java?rev=635992&r1=635991&r2=635992&view=diff
==============================================================================
--- harmony/enhanced/classlib/trunk/modules/awt/src/main/java/common/org/apache/harmony/awt/gl/image/PngDecoder.java
(original)
+++ harmony/enhanced/classlib/trunk/modules/awt/src/main/java/common/org/apache/harmony/awt/gl/image/PngDecoder.java
Tue Mar 11 09:08:06 2008
@@ -37,7 +37,7 @@
     private static native void initIDs();
 
     static {
-        System.loadLibrary("gl"); //$NON-NLS-1$
+        org.apache.harmony.awt.Utils.loadLibrary("gl"); //$NON-NLS-1$
         initIDs();
     }
 

Modified: harmony/enhanced/classlib/trunk/modules/awt/src/main/java/common/org/apache/harmony/awt/gl/opengl/GL.java
URL: http://svn.apache.org/viewvc/harmony/enhanced/classlib/trunk/modules/awt/src/main/java/common/org/apache/harmony/awt/gl/opengl/GL.java?rev=635992&r1=635991&r2=635992&view=diff
==============================================================================
--- harmony/enhanced/classlib/trunk/modules/awt/src/main/java/common/org/apache/harmony/awt/gl/opengl/GL.java
(original)
+++ harmony/enhanced/classlib/trunk/modules/awt/src/main/java/common/org/apache/harmony/awt/gl/opengl/GL.java
Tue Mar 11 09:08:06 2008
@@ -38,7 +38,7 @@
     }
 
     private GL() {
-        System.loadLibrary("oglwrapper"); //$NON-NLS-1$
+        org.apache.harmony.awt.Utils.loadLibrary("oglwrapper"); //$NON-NLS-1$
         init();
     }
 

Modified: harmony/enhanced/classlib/trunk/modules/awt/src/main/java/common/org/apache/harmony/awt/nativebridge/NativeBridge.java
URL: http://svn.apache.org/viewvc/harmony/enhanced/classlib/trunk/modules/awt/src/main/java/common/org/apache/harmony/awt/nativebridge/NativeBridge.java?rev=635992&r1=635991&r2=635992&view=diff
==============================================================================
--- harmony/enhanced/classlib/trunk/modules/awt/src/main/java/common/org/apache/harmony/awt/nativebridge/NativeBridge.java
(original)
+++ harmony/enhanced/classlib/trunk/modules/awt/src/main/java/common/org/apache/harmony/awt/nativebridge/NativeBridge.java
Tue Mar 11 09:08:06 2008
@@ -20,6 +20,9 @@
  */
 package org.apache.harmony.awt.nativebridge;
 
+import java.security.AccessController;
+import java.security.PrivilegedAction;
+
 import org.apache.harmony.misc.accessors.AccessorFactory;
 import org.apache.harmony.misc.accessors.MemoryAccessor;
 
@@ -28,8 +31,13 @@
     private NativeBridge() {
     }
 
+    private static final MemoryAccessor memAccess = AccessController.doPrivileged(new PrivilegedAction<MemoryAccessor>()
{
+                                                      public MemoryAccessor run() {
+                                                          return AccessorFactory.getMemoryAccessor();
+                                                      }
+                                                  });
+
     private static final NativeBridge instance = new NativeBridge();
-    private static final MemoryAccessor memAccess = AccessorFactory.getMemoryAccessor();
     public static final int ptrSize = memAccess.getPointerSize();
     public static final boolean is64 = (ptrSize == 8);
 

Modified: harmony/enhanced/classlib/trunk/modules/awt/src/main/java/unix/org/apache/harmony/awt/gl/font/LinuxNativeFont.java
URL: http://svn.apache.org/viewvc/harmony/enhanced/classlib/trunk/modules/awt/src/main/java/unix/org/apache/harmony/awt/gl/font/LinuxNativeFont.java?rev=635992&r1=635991&r2=635992&view=diff
==============================================================================
--- harmony/enhanced/classlib/trunk/modules/awt/src/main/java/unix/org/apache/harmony/awt/gl/font/LinuxNativeFont.java
(original)
+++ harmony/enhanced/classlib/trunk/modules/awt/src/main/java/unix/org/apache/harmony/awt/gl/font/LinuxNativeFont.java
Tue Mar 11 09:08:06 2008
@@ -713,7 +713,7 @@
             java.security.AccessController
                     .doPrivileged(new java.security.PrivilegedAction() {
                         public Object run() {
-                            System.loadLibrary("linuxfont"); //$NON-NLS-1$
+                            org.apache.harmony.awt.Utils.loadLibrary("linuxfont"); //$NON-NLS-1$
                             return null;
                         }
                     });

Modified: harmony/enhanced/classlib/trunk/modules/awt/src/main/java/unix/org/apache/harmony/awt/nativebridge/linux/GLX.java
URL: http://svn.apache.org/viewvc/harmony/enhanced/classlib/trunk/modules/awt/src/main/java/unix/org/apache/harmony/awt/nativebridge/linux/GLX.java?rev=635992&r1=635991&r2=635992&view=diff
==============================================================================
--- harmony/enhanced/classlib/trunk/modules/awt/src/main/java/unix/org/apache/harmony/awt/nativebridge/linux/GLX.java
(original)
+++ harmony/enhanced/classlib/trunk/modules/awt/src/main/java/unix/org/apache/harmony/awt/nativebridge/linux/GLX.java
Tue Mar 11 09:08:06 2008
@@ -37,7 +37,7 @@
     }
 
     private GLX() {
-        System.loadLibrary("X11Wrapper");
+        org.apache.harmony.awt.Utils.loadLibrary("X11Wrapper");
         init();
     }
 

Modified: harmony/enhanced/classlib/trunk/modules/awt/src/main/java/unix/org/apache/harmony/awt/nativebridge/linux/X11.java
URL: http://svn.apache.org/viewvc/harmony/enhanced/classlib/trunk/modules/awt/src/main/java/unix/org/apache/harmony/awt/nativebridge/linux/X11.java?rev=635992&r1=635991&r2=635992&view=diff
==============================================================================
--- harmony/enhanced/classlib/trunk/modules/awt/src/main/java/unix/org/apache/harmony/awt/nativebridge/linux/X11.java
(original)
+++ harmony/enhanced/classlib/trunk/modules/awt/src/main/java/unix/org/apache/harmony/awt/nativebridge/linux/X11.java
Tue Mar 11 09:08:06 2008
@@ -39,7 +39,7 @@
     }
 
     private X11() {
-        System.loadLibrary("X11Wrapper"); //$NON-NLS-1$
+        org.apache.harmony.awt.Utils.loadLibrary("X11Wrapper"); //$NON-NLS-1$
         init();
     }
 

Modified: harmony/enhanced/classlib/trunk/modules/awt/src/main/java/unix/org/apache/harmony/awt/nativebridge/linux/Xft.java
URL: http://svn.apache.org/viewvc/harmony/enhanced/classlib/trunk/modules/awt/src/main/java/unix/org/apache/harmony/awt/nativebridge/linux/Xft.java?rev=635992&r1=635991&r2=635992&view=diff
==============================================================================
--- harmony/enhanced/classlib/trunk/modules/awt/src/main/java/unix/org/apache/harmony/awt/nativebridge/linux/Xft.java
(original)
+++ harmony/enhanced/classlib/trunk/modules/awt/src/main/java/unix/org/apache/harmony/awt/nativebridge/linux/Xft.java
Tue Mar 11 09:08:06 2008
@@ -39,7 +39,7 @@
     }
 
     private Xft() {
-        System.loadLibrary("X11Wrapper"); //$NON-NLS-1$
+        org.apache.harmony.awt.Utils.loadLibrary("X11Wrapper"); //$NON-NLS-1$
         init();
     }
 

Modified: harmony/enhanced/classlib/trunk/modules/awt/src/main/java/unix/org/apache/harmony/awt/wtk/linux/LinuxWTK.java
URL: http://svn.apache.org/viewvc/harmony/enhanced/classlib/trunk/modules/awt/src/main/java/unix/org/apache/harmony/awt/wtk/linux/LinuxWTK.java?rev=635992&r1=635991&r2=635992&view=diff
==============================================================================
--- harmony/enhanced/classlib/trunk/modules/awt/src/main/java/unix/org/apache/harmony/awt/wtk/linux/LinuxWTK.java
(original)
+++ harmony/enhanced/classlib/trunk/modules/awt/src/main/java/unix/org/apache/harmony/awt/wtk/linux/LinuxWTK.java
Tue Mar 11 09:08:06 2008
@@ -30,7 +30,7 @@
 public final class LinuxWTK extends WTK {
 
     static {
-        System.loadLibrary("gl");
+        org.apache.harmony.awt.Utils.loadLibrary("gl");
     }
 
     /**

Modified: harmony/enhanced/classlib/trunk/modules/awt/src/main/java/unix/org/apache/harmony/awt/wtk/linux/XServerConnection.java
URL: http://svn.apache.org/viewvc/harmony/enhanced/classlib/trunk/modules/awt/src/main/java/unix/org/apache/harmony/awt/wtk/linux/XServerConnection.java?rev=635992&r1=635991&r2=635992&view=diff
==============================================================================
--- harmony/enhanced/classlib/trunk/modules/awt/src/main/java/unix/org/apache/harmony/awt/wtk/linux/XServerConnection.java
(original)
+++ harmony/enhanced/classlib/trunk/modules/awt/src/main/java/unix/org/apache/harmony/awt/wtk/linux/XServerConnection.java
Tue Mar 11 09:08:06 2008
@@ -45,7 +45,7 @@
 
         screen = x11.XDefaultScreen(display);
 
-        System.loadLibrary("gl");
+        org.apache.harmony.awt.Utils.loadLibrary("gl");
         init(display, screen);
     }
 

Modified: harmony/enhanced/classlib/trunk/modules/awt/src/main/java/windows/org/apache/harmony/awt/datatransfer/windows/WinDTK.java
URL: http://svn.apache.org/viewvc/harmony/enhanced/classlib/trunk/modules/awt/src/main/java/windows/org/apache/harmony/awt/datatransfer/windows/WinDTK.java?rev=635992&r1=635991&r2=635992&view=diff
==============================================================================
--- harmony/enhanced/classlib/trunk/modules/awt/src/main/java/windows/org/apache/harmony/awt/datatransfer/windows/WinDTK.java
(original)
+++ harmony/enhanced/classlib/trunk/modules/awt/src/main/java/windows/org/apache/harmony/awt/datatransfer/windows/WinDTK.java
Tue Mar 11 09:08:06 2008
@@ -24,6 +24,8 @@
 import java.awt.dnd.DropTargetContext;
 import java.awt.dnd.peer.DragSourceContextPeer;
 import java.awt.dnd.peer.DropTargetContextPeer;
+import java.security.AccessController;
+import java.security.PrivilegedAction;
 
 import org.apache.harmony.awt.datatransfer.DTK;
 import org.apache.harmony.awt.datatransfer.NativeClipboard;
@@ -39,8 +41,11 @@
 public final class WinDTK extends DTK implements Callback.Handler {
     
     private static final Win32 win32 = Win32.getInstance();
-    private static final ObjectAccessor objAccessor = 
-        AccessorFactory.getObjectAccessor();
+    private static final ObjectAccessor objAccessor = AccessController.doPrivileged(new PrivilegedAction<ObjectAccessor>()
{
+                                                        public ObjectAccessor run() {
+                                                            return AccessorFactory.getObjectAccessor();
+                                                        }
+                                                    });    
     
     private static final int WM_TASK = WindowsDefs.WM_USER + 1;
     

Modified: harmony/enhanced/classlib/trunk/modules/awt/src/main/java/windows/org/apache/harmony/awt/gl/font/NativeFont.java
URL: http://svn.apache.org/viewvc/harmony/enhanced/classlib/trunk/modules/awt/src/main/java/windows/org/apache/harmony/awt/gl/font/NativeFont.java?rev=635992&r1=635991&r2=635992&view=diff
==============================================================================
--- harmony/enhanced/classlib/trunk/modules/awt/src/main/java/windows/org/apache/harmony/awt/gl/font/NativeFont.java
(original)
+++ harmony/enhanced/classlib/trunk/modules/awt/src/main/java/windows/org/apache/harmony/awt/gl/font/NativeFont.java
Tue Mar 11 09:08:06 2008
@@ -534,7 +534,7 @@
             AccessController.doPrivileged(
                   new PrivilegedAction<Void>() {
                     public Void run() {
-                        System.loadLibrary("fontlib"); //$NON-NLS-1$
+                        org.apache.harmony.awt.Utils.loadLibrary("fontlib"); //$NON-NLS-1$
                         return null;
                     }
             } );

Modified: harmony/enhanced/classlib/trunk/modules/awt/src/main/java/windows/org/apache/harmony/awt/gl/windows/WinGDIGraphics2D.java
URL: http://svn.apache.org/viewvc/harmony/enhanced/classlib/trunk/modules/awt/src/main/java/windows/org/apache/harmony/awt/gl/windows/WinGDIGraphics2D.java?rev=635992&r1=635991&r2=635992&view=diff
==============================================================================
--- harmony/enhanced/classlib/trunk/modules/awt/src/main/java/windows/org/apache/harmony/awt/gl/windows/WinGDIGraphics2D.java
(original)
+++ harmony/enhanced/classlib/trunk/modules/awt/src/main/java/windows/org/apache/harmony/awt/gl/windows/WinGDIGraphics2D.java
Tue Mar 11 09:08:06 2008
@@ -76,7 +76,7 @@
 
 
     static {
-        System.loadLibrary("gl"); //$NON-NLS-1$
+        org.apache.harmony.awt.Utils.loadLibrary("gl"); //$NON-NLS-1$
     }
 
     public WinGDIGraphics2D(NativeWindow nw, int tx, int ty, MultiRectArea clip) {

Modified: harmony/enhanced/classlib/trunk/modules/awt/src/main/java/windows/org/apache/harmony/awt/gl/windows/WinGDIPGraphics2D.java
URL: http://svn.apache.org/viewvc/harmony/enhanced/classlib/trunk/modules/awt/src/main/java/windows/org/apache/harmony/awt/gl/windows/WinGDIPGraphics2D.java?rev=635992&r1=635991&r2=635992&view=diff
==============================================================================
--- harmony/enhanced/classlib/trunk/modules/awt/src/main/java/windows/org/apache/harmony/awt/gl/windows/WinGDIPGraphics2D.java
(original)
+++ harmony/enhanced/classlib/trunk/modules/awt/src/main/java/windows/org/apache/harmony/awt/gl/windows/WinGDIPGraphics2D.java
Tue Mar 11 09:08:06 2008
@@ -36,6 +36,8 @@
 import java.awt.geom.AffineTransform;
 import java.awt.geom.PathIterator;
 import java.awt.geom.Point2D;
+import java.security.AccessController;
+import java.security.PrivilegedAction;
 import java.util.Map;
 
 import org.apache.harmony.awt.gl.CommonGraphics2D;
@@ -79,14 +81,18 @@
     private static final long gdipToken;
 
     static {
-        System.loadLibrary("gl"); //$NON-NLS-1$
+        org.apache.harmony.awt.Utils.loadLibrary("gl"); //$NON-NLS-1$
 
         // GDI+ startup
         gdipToken = gdiPlusStartup();
 
         // Prepare GDI+ shutdown
-        GDIPShutdown hook = new GDIPShutdown();
-        Runtime.getRuntime().addShutdownHook(hook);
+        AccessController.doPrivileged(new PrivilegedAction<Object>() {
+            public Object run() {
+                Runtime.getRuntime().addShutdownHook(new GDIPShutdown());
+                return null;
+            }
+        });
     }
 
     public WinGDIPGraphics2D(NativeWindow nw, int tx, int ty, MultiRectArea clip) {

Modified: harmony/enhanced/classlib/trunk/modules/awt/src/main/java/windows/org/apache/harmony/awt/gl/windows/WinGraphicsEnvironment.java
URL: http://svn.apache.org/viewvc/harmony/enhanced/classlib/trunk/modules/awt/src/main/java/windows/org/apache/harmony/awt/gl/windows/WinGraphicsEnvironment.java?rev=635992&r1=635991&r2=635992&view=diff
==============================================================================
--- harmony/enhanced/classlib/trunk/modules/awt/src/main/java/windows/org/apache/harmony/awt/gl/windows/WinGraphicsEnvironment.java
(original)
+++ harmony/enhanced/classlib/trunk/modules/awt/src/main/java/windows/org/apache/harmony/awt/gl/windows/WinGraphicsEnvironment.java
Tue Mar 11 09:08:06 2008
@@ -25,7 +25,7 @@
 
 import org.apache.harmony.awt.gl.CommonGraphicsEnvironment;
 import org.apache.harmony.awt.wtk.WindowFactory;
-
+import org.apache.harmony.awt.Utils;
 
 /**
  * Windows GraphicsEnvironment implementation
@@ -36,7 +36,7 @@
     WinGraphicsDevice []devices = null;
 
     static {
-        System.loadLibrary("gl"); //$NON-NLS-1$
+        Utils.loadLibrary("gl"); //$NON-NLS-1$
     }
 
     public WinGraphicsEnvironment(WindowFactory wf) {

Modified: harmony/enhanced/classlib/trunk/modules/awt/src/main/java/windows/org/apache/harmony/awt/nativebridge/windows/Callback.java
URL: http://svn.apache.org/viewvc/harmony/enhanced/classlib/trunk/modules/awt/src/main/java/windows/org/apache/harmony/awt/nativebridge/windows/Callback.java?rev=635992&r1=635991&r2=635992&view=diff
==============================================================================
--- harmony/enhanced/classlib/trunk/modules/awt/src/main/java/windows/org/apache/harmony/awt/nativebridge/windows/Callback.java
(original)
+++ harmony/enhanced/classlib/trunk/modules/awt/src/main/java/windows/org/apache/harmony/awt/nativebridge/windows/Callback.java
Tue Mar 11 09:08:06 2008
@@ -37,7 +37,7 @@
     private static Handler handlerDataTransfer;
 
     static {
-        System.loadLibrary("Win32Wrapper"); //$NON-NLS-1$
+        org.apache.harmony.awt.Utils.loadLibrary("Win32Wrapper"); //$NON-NLS-1$
         callbackWNDPROC = initCallBackWNDPROC();
         callbackOFNHOOKPROC = initCallBackOFNHOOKPROC();
         callbackDataTransferProc = initCallBackDataTransferProc();

Modified: harmony/enhanced/classlib/trunk/modules/awt/src/main/java/windows/org/apache/harmony/awt/nativebridge/windows/WGL.java
URL: http://svn.apache.org/viewvc/harmony/enhanced/classlib/trunk/modules/awt/src/main/java/windows/org/apache/harmony/awt/nativebridge/windows/WGL.java?rev=635992&r1=635991&r2=635992&view=diff
==============================================================================
--- harmony/enhanced/classlib/trunk/modules/awt/src/main/java/windows/org/apache/harmony/awt/nativebridge/windows/WGL.java
(original)
+++ harmony/enhanced/classlib/trunk/modules/awt/src/main/java/windows/org/apache/harmony/awt/nativebridge/windows/WGL.java
Tue Mar 11 09:08:06 2008
@@ -40,7 +40,7 @@
     }
 
     private WGL() {
-        System.loadLibrary("Win32Wrapper");
+        org.apache.harmony.awt.Utils.loadLibrary("Win32Wrapper");
         init();
     }
 

Modified: harmony/enhanced/classlib/trunk/modules/awt/src/main/java/windows/org/apache/harmony/awt/nativebridge/windows/Win32.java
URL: http://svn.apache.org/viewvc/harmony/enhanced/classlib/trunk/modules/awt/src/main/java/windows/org/apache/harmony/awt/nativebridge/windows/Win32.java?rev=635992&r1=635991&r2=635992&view=diff
==============================================================================
--- harmony/enhanced/classlib/trunk/modules/awt/src/main/java/windows/org/apache/harmony/awt/nativebridge/windows/Win32.java
(original)
+++ harmony/enhanced/classlib/trunk/modules/awt/src/main/java/windows/org/apache/harmony/awt/nativebridge/windows/Win32.java
Tue Mar 11 09:08:06 2008
@@ -23,8 +23,8 @@
  */
 package org.apache.harmony.awt.nativebridge.windows;
 
-
 import org.apache.harmony.awt.nativebridge.*;
+import org.apache.harmony.awt.Utils;
 
 public class Win32 extends BasicLibWrapper {
     static Win32 instance;
@@ -37,7 +37,7 @@
     }
 
     private Win32() {
-        System.loadLibrary("Win32Wrapper"); //$NON-NLS-1$
+        Utils.loadLibrary("Win32Wrapper"); //$NON-NLS-1$
         init();
     }
 

Modified: harmony/enhanced/classlib/trunk/modules/awt/src/main/java/windows/org/apache/harmony/awt/nativebridge/windows/WinDataTransfer.java
URL: http://svn.apache.org/viewvc/harmony/enhanced/classlib/trunk/modules/awt/src/main/java/windows/org/apache/harmony/awt/nativebridge/windows/WinDataTransfer.java?rev=635992&r1=635991&r2=635992&view=diff
==============================================================================
--- harmony/enhanced/classlib/trunk/modules/awt/src/main/java/windows/org/apache/harmony/awt/nativebridge/windows/WinDataTransfer.java
(original)
+++ harmony/enhanced/classlib/trunk/modules/awt/src/main/java/windows/org/apache/harmony/awt/nativebridge/windows/WinDataTransfer.java
Tue Mar 11 09:08:06 2008
@@ -36,7 +36,7 @@
 public final class WinDataTransfer {
     
     static {
-        System.loadLibrary("Win32Wrapper"); //$NON-NLS-1$
+        org.apache.harmony.awt.Utils.loadLibrary("Win32Wrapper"); //$NON-NLS-1$
     }
 
     /**

Modified: harmony/enhanced/classlib/trunk/modules/awt/src/main/java/windows/org/apache/harmony/awt/wtk/windows/WinWTK.java
URL: http://svn.apache.org/viewvc/harmony/enhanced/classlib/trunk/modules/awt/src/main/java/windows/org/apache/harmony/awt/wtk/windows/WinWTK.java?rev=635992&r1=635991&r2=635992&view=diff
==============================================================================
--- harmony/enhanced/classlib/trunk/modules/awt/src/main/java/windows/org/apache/harmony/awt/wtk/windows/WinWTK.java
(original)
+++ harmony/enhanced/classlib/trunk/modules/awt/src/main/java/windows/org/apache/harmony/awt/wtk/windows/WinWTK.java
Tue Mar 11 09:08:06 2008
@@ -28,7 +28,7 @@
 public class WinWTK extends WTK {
 
     static {
-        System.loadLibrary("gl"); //$NON-NLS-1$
+        org.apache.harmony.awt.Utils.loadLibrary("gl"); //$NON-NLS-1$
     }
 
     /**



Mime
View raw message