Hi, the attached patch refactors all of Classpath' code to use sun.security.action.GetPropertyAction instead of gnu.java.security.action.GetPropertyAction.
Additionally the class in question is moved to its new package. While I don't like the usage of a non-standard API as much as you I also think that with OpenJDK being available under the GPL it is equally bad to have gnu.java.security.action.GetPropertyAction or sun.security.action.GetPropertyAction But what I think what is even worse is having both. :) 2008-06-04 Robert Schuster <[EMAIL PROTECTED]> * gnu/java/security/action/GetPropertyAction.java: Removed. * sun/security/action/GetPropertyAction.java: Copied content from gnu/java/security/action/GetPropertyAction.java. * gnu/classpath/debug/Simple1LineFormatter.java: Changed import of gnu.java.security.action.GetPropertyAction to sun.security.action.GetPropertyAction * gnu/classpath/debug/SystemLogger.java: Dito. * gnu/java/security/PolicyFile.java: Dito. * gnu/java/security/key/dss/DSSKey.java: Dito. * gnu/java/security/key/dss/DSSPrivateKey.java: Dito. * gnu/java/security/key/dss/DSSPublicKey.java: Dito. * gnu/java/security/key/rsa/GnuRSAKey.java: Dito. * gnu/java/security/key/rsa/GnuRSAPrivateKey.java: Dito. * gnu/java/security/key/rsa/GnuRSAPublicKey.java: Dito. * gnu/javax/crypto/key/dh/GnuDHKey.java: Dito. * gnu/javax/crypto/key/dh/GnuDHPrivateKey.java: Dito. * gnu/javax/crypto/key/dh/GnuDHPublicKey.java: Dito. * gnu/javax/crypto/sasl/plain/PasswordFile.java: Dito. * gnu/javax/net/ssl/provider/X509TrustManagerFactory.java: Dito. * gnu/xml/aelfred2/XmlParser.java: Dito. Regards Robert
Index: gnu/classpath/debug/Simple1LineFormatter.java =================================================================== RCS file: /sources/classpath/classpath/gnu/classpath/debug/Simple1LineFormatter.java,v retrieving revision 1.3 diff -u -r1.3 Simple1LineFormatter.java --- gnu/classpath/debug/Simple1LineFormatter.java 11 Jul 2006 16:03:59 -0000 1.3 +++ gnu/classpath/debug/Simple1LineFormatter.java 4 Jun 2008 08:51:55 -0000 @@ -38,8 +38,6 @@ package gnu.classpath.debug; -import gnu.java.security.action.GetPropertyAction; - import java.io.PrintWriter; import java.io.StringWriter; import java.security.AccessController; @@ -51,6 +49,8 @@ import java.util.logging.Formatter; import java.util.logging.LogRecord; +import sun.security.action.GetPropertyAction; + /** * A simple 1-line formatter to use instead of the 2-line SimpleFormatter used * by default in the JDK logging handlers. Index: gnu/classpath/debug/SystemLogger.java =================================================================== RCS file: /sources/classpath/classpath/gnu/classpath/debug/SystemLogger.java,v retrieving revision 1.3 diff -u -r1.3 SystemLogger.java --- gnu/classpath/debug/SystemLogger.java 10 Dec 2006 20:25:41 -0000 1.3 +++ gnu/classpath/debug/SystemLogger.java 4 Jun 2008 08:51:55 -0000 @@ -38,13 +38,13 @@ package gnu.classpath.debug; -import gnu.java.security.action.GetPropertyAction; - import java.security.AccessController; import java.util.StringTokenizer; import java.util.logging.Level; import java.util.logging.Logger; +import sun.security.action.GetPropertyAction; + public final class SystemLogger extends Logger { public static final SystemLogger SYSTEM = new SystemLogger(); Index: gnu/java/security/PolicyFile.java =================================================================== RCS file: /sources/classpath/classpath/gnu/java/security/PolicyFile.java,v retrieving revision 1.10 diff -u -r1.10 PolicyFile.java --- gnu/java/security/PolicyFile.java 5 May 2008 17:12:40 -0000 1.10 +++ gnu/java/security/PolicyFile.java 4 Jun 2008 08:51:55 -0000 @@ -41,7 +41,6 @@ import gnu.classpath.debug.SystemLogger; import gnu.java.lang.CPStringBuilder; -import gnu.java.security.action.GetPropertyAction; import java.io.File; import java.io.IOException; @@ -74,6 +73,8 @@ import java.util.StringTokenizer; import java.util.logging.Logger; +import sun.security.action.GetPropertyAction; + /** * An implementation of a [EMAIL PROTECTED] java.security.Policy} object whose * permissions are specified by a <em>policy file</em>. Index: gnu/java/security/action/GetPropertyAction.java =================================================================== RCS file: gnu/java/security/action/GetPropertyAction.java diff -N gnu/java/security/action/GetPropertyAction.java --- gnu/java/security/action/GetPropertyAction.java 10 Dec 2006 20:25:42 -0000 1.4 +++ /dev/null 1 Jan 1970 00:00:00 -0000 @@ -1,89 +0,0 @@ -/* GetPropertyAction.java - Copyright (C) 2004 Free Software Foundation, Inc. - -This file is part of GNU Classpath. - -GNU Classpath is free software; you can redistribute it and/or modify -it under the terms of the GNU General Public License as published by -the Free Software Foundation; either version 2, or (at your option) -any later version. - -GNU Classpath is distributed in the hope that it will be useful, but -WITHOUT ANY WARRANTY; without even the implied warranty of -MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU -General Public License for more details. - -You should have received a copy of the GNU General Public License -along with GNU Classpath; see the file COPYING. If not, write to the -Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA -02110-1301 USA. - -Linking this library statically or dynamically with other modules is -making a combined work based on this library. Thus, the terms and -conditions of the GNU General Public License cover the whole -combination. - -As a special exception, the copyright holders of this library give you -permission to link this library with independent modules to produce an -executable, regardless of the license terms of these independent -modules, and to copy and distribute the resulting executable under -terms of your choice, provided that you also meet, for each linked -independent module, the terms and conditions of the license of that -module. An independent module is a module which is not derived from -or based on this library. If you modify this library, you may extend -this exception to your version of the library, but you are not -obligated to do so. If you do not wish to do so, delete this -exception statement from your version. */ - -package gnu.java.security.action; - -import java.security.PrivilegedAction; - -/** - * PrivilegedAction implementation that calls System.getProperty() with - * the property name passed to its constructor. - * - * Example of use: - * <code> - * GetPropertyAction action = new GetPropertyAction("http.proxyPort"); - * String port = AccessController.doPrivileged(action); - * </code> - */ -public class GetPropertyAction implements PrivilegedAction<String> -{ - String name; - String value = null; - - public GetPropertyAction() - { - } - - public GetPropertyAction(String propName) - { - setParameters(propName); - } - - public GetPropertyAction(String propName, String defaultValue) - { - setParameters(propName, defaultValue); - } - - public String run() - { - return System.getProperty(name, value); - } - - public GetPropertyAction setParameters(String propName) - { - this.name = propName; - this.value = null; - return this; - } - - public GetPropertyAction setParameters(String propName, String defaultValue) - { - this.name = propName; - this.value = defaultValue; - return this; - } -} Index: gnu/java/security/key/dss/DSSKey.java =================================================================== RCS file: /sources/classpath/classpath/gnu/java/security/key/dss/DSSKey.java,v retrieving revision 1.11 diff -u -r1.11 DSSKey.java --- gnu/java/security/key/dss/DSSKey.java 16 Mar 2008 22:04:49 -0000 1.11 +++ gnu/java/security/key/dss/DSSKey.java 4 Jun 2008 08:51:55 -0000 @@ -41,7 +41,6 @@ import gnu.java.lang.CPStringBuilder; import gnu.java.security.Registry; -import gnu.java.security.action.GetPropertyAction; import gnu.java.security.util.FormatUtil; import java.math.BigInteger; @@ -51,6 +50,8 @@ import java.security.interfaces.DSAParams; import java.security.spec.DSAParameterSpec; +import sun.security.action.GetPropertyAction; + /** * A base asbtract class for both public and private DSS (Digital Signature * Standard) keys. It encapsulates the three DSS numbers: <code>p</code>, Index: gnu/java/security/key/dss/DSSPrivateKey.java =================================================================== RCS file: /sources/classpath/classpath/gnu/java/security/key/dss/DSSPrivateKey.java,v retrieving revision 1.9 diff -u -r1.9 DSSPrivateKey.java --- gnu/java/security/key/dss/DSSPrivateKey.java 16 Mar 2008 22:04:49 -0000 1.9 +++ gnu/java/security/key/dss/DSSPrivateKey.java 4 Jun 2008 08:51:55 -0000 @@ -42,7 +42,6 @@ import gnu.java.security.Configuration; import gnu.java.security.Registry; -import gnu.java.security.action.GetPropertyAction; import gnu.java.security.key.IKeyPairCodec; import java.math.BigInteger; @@ -50,6 +49,8 @@ import java.security.PrivateKey; import java.security.interfaces.DSAPrivateKey; +import sun.security.action.GetPropertyAction; + /** * An object that embodies a DSS (Digital Signature Standard) private key. * Index: gnu/java/security/key/dss/DSSPublicKey.java =================================================================== RCS file: /sources/classpath/classpath/gnu/java/security/key/dss/DSSPublicKey.java,v retrieving revision 1.7 diff -u -r1.7 DSSPublicKey.java --- gnu/java/security/key/dss/DSSPublicKey.java 16 Mar 2008 22:04:49 -0000 1.7 +++ gnu/java/security/key/dss/DSSPublicKey.java 4 Jun 2008 08:51:55 -0000 @@ -41,7 +41,6 @@ import gnu.java.lang.CPStringBuilder; import gnu.java.security.Registry; -import gnu.java.security.action.GetPropertyAction; import gnu.java.security.key.IKeyPairCodec; import java.math.BigInteger; @@ -49,6 +48,8 @@ import java.security.PublicKey; import java.security.interfaces.DSAPublicKey; +import sun.security.action.GetPropertyAction; + /** * An object that embodies a DSS (Digital Signature Standard) public key. * Index: gnu/java/security/key/rsa/GnuRSAKey.java =================================================================== RCS file: /sources/classpath/classpath/gnu/java/security/key/rsa/GnuRSAKey.java,v retrieving revision 1.8 diff -u -r1.8 GnuRSAKey.java --- gnu/java/security/key/rsa/GnuRSAKey.java 16 Mar 2008 22:04:49 -0000 1.8 +++ gnu/java/security/key/rsa/GnuRSAKey.java 4 Jun 2008 08:51:55 -0000 @@ -41,7 +41,6 @@ import gnu.java.lang.CPStringBuilder; import gnu.java.security.Registry; -import gnu.java.security.action.GetPropertyAction; import gnu.java.security.util.FormatUtil; import java.math.BigInteger; @@ -49,6 +48,8 @@ import java.security.Key; import java.security.interfaces.RSAKey; +import sun.security.action.GetPropertyAction; + /** * A base asbtract class for both public and private RSA keys. */ Index: gnu/java/security/key/rsa/GnuRSAPrivateKey.java =================================================================== RCS file: /sources/classpath/classpath/gnu/java/security/key/rsa/GnuRSAPrivateKey.java,v retrieving revision 1.10 diff -u -r1.10 GnuRSAPrivateKey.java --- gnu/java/security/key/rsa/GnuRSAPrivateKey.java 16 Mar 2008 22:04:50 -0000 1.10 +++ gnu/java/security/key/rsa/GnuRSAPrivateKey.java 4 Jun 2008 08:51:55 -0000 @@ -41,7 +41,6 @@ import gnu.java.lang.CPStringBuilder; import gnu.java.security.Configuration; -import gnu.java.security.action.GetPropertyAction; import gnu.java.security.Registry; import gnu.java.security.key.IKeyPairCodec; @@ -51,6 +50,8 @@ import java.security.interfaces.RSAPrivateCrtKey; import java.security.interfaces.RSAPrivateKey; +import sun.security.action.GetPropertyAction; + /** * An object that embodies an RSA private key. * <p> Index: gnu/java/security/key/rsa/GnuRSAPublicKey.java =================================================================== RCS file: /sources/classpath/classpath/gnu/java/security/key/rsa/GnuRSAPublicKey.java,v retrieving revision 1.7 diff -u -r1.7 GnuRSAPublicKey.java --- gnu/java/security/key/rsa/GnuRSAPublicKey.java 16 Mar 2008 22:04:50 -0000 1.7 +++ gnu/java/security/key/rsa/GnuRSAPublicKey.java 4 Jun 2008 08:51:55 -0000 @@ -41,7 +41,6 @@ import gnu.java.lang.CPStringBuilder; import gnu.java.security.Registry; -import gnu.java.security.action.GetPropertyAction; import gnu.java.security.key.IKeyPairCodec; import java.math.BigInteger; @@ -49,6 +48,8 @@ import java.security.PublicKey; import java.security.interfaces.RSAPublicKey; +import sun.security.action.GetPropertyAction; + /** * An object that encapsulates an RSA public key. * <p> Index: gnu/javax/crypto/key/dh/GnuDHKey.java =================================================================== RCS file: /sources/classpath/classpath/gnu/javax/crypto/key/dh/GnuDHKey.java,v retrieving revision 1.7 diff -u -r1.7 GnuDHKey.java --- gnu/javax/crypto/key/dh/GnuDHKey.java 11 Jul 2006 16:03:59 -0000 1.7 +++ gnu/javax/crypto/key/dh/GnuDHKey.java 4 Jun 2008 08:51:55 -0000 @@ -39,7 +39,6 @@ package gnu.javax.crypto.key.dh; import gnu.java.security.Registry; -import gnu.java.security.action.GetPropertyAction; import gnu.java.security.util.FormatUtil; import java.math.BigInteger; @@ -49,6 +48,8 @@ import javax.crypto.interfaces.DHKey; import javax.crypto.spec.DHParameterSpec; +import sun.security.action.GetPropertyAction; + /** * A base asbtract class for both public and private Diffie-Hellman keys. It * encapsulates the two DH numbers: <code>p</code>, and <code>g</code>. Index: gnu/javax/crypto/key/dh/GnuDHPrivateKey.java =================================================================== RCS file: /sources/classpath/classpath/gnu/javax/crypto/key/dh/GnuDHPrivateKey.java,v retrieving revision 1.6 diff -u -r1.6 GnuDHPrivateKey.java --- gnu/javax/crypto/key/dh/GnuDHPrivateKey.java 11 Jul 2006 16:03:59 -0000 1.6 +++ gnu/javax/crypto/key/dh/GnuDHPrivateKey.java 4 Jun 2008 08:51:56 -0000 @@ -40,7 +40,6 @@ import gnu.java.security.Configuration; import gnu.java.security.Registry; -import gnu.java.security.action.GetPropertyAction; import gnu.java.security.key.IKeyPairCodec; import java.math.BigInteger; @@ -48,6 +47,8 @@ import javax.crypto.interfaces.DHPrivateKey; +import sun.security.action.GetPropertyAction; + /** * An implementation of the Diffie-Hellman private key. * <p> Index: gnu/javax/crypto/key/dh/GnuDHPublicKey.java =================================================================== RCS file: /sources/classpath/classpath/gnu/javax/crypto/key/dh/GnuDHPublicKey.java,v retrieving revision 1.5 diff -u -r1.5 GnuDHPublicKey.java --- gnu/javax/crypto/key/dh/GnuDHPublicKey.java 11 Jul 2006 16:03:59 -0000 1.5 +++ gnu/javax/crypto/key/dh/GnuDHPublicKey.java 4 Jun 2008 08:51:56 -0000 @@ -39,7 +39,6 @@ package gnu.javax.crypto.key.dh; import gnu.java.security.Registry; -import gnu.java.security.action.GetPropertyAction; import gnu.java.security.key.IKeyPairCodec; import java.math.BigInteger; @@ -47,6 +46,8 @@ import javax.crypto.interfaces.DHPublicKey; +import sun.security.action.GetPropertyAction; + /** * An implementation of the Diffie-Hellman public key. * <p> Index: gnu/javax/crypto/sasl/plain/PasswordFile.java =================================================================== RCS file: /sources/classpath/classpath/gnu/javax/crypto/sasl/plain/PasswordFile.java,v retrieving revision 1.4 diff -u -r1.4 PasswordFile.java --- gnu/javax/crypto/sasl/plain/PasswordFile.java 5 May 2008 21:29:46 -0000 1.4 +++ gnu/javax/crypto/sasl/plain/PasswordFile.java 4 Jun 2008 08:51:56 -0000 @@ -40,7 +40,6 @@ import gnu.java.lang.CPStringBuilder; -import gnu.java.security.action.GetPropertyAction; import gnu.javax.crypto.sasl.NoSuchUserException; import gnu.javax.crypto.sasl.UserAlreadyExistsException; @@ -58,6 +57,8 @@ import java.util.NoSuchElementException; import java.util.StringTokenizer; +import sun.security.action.GetPropertyAction; + /** * A representation of a Plain password file. */ Index: gnu/javax/net/ssl/provider/X509TrustManagerFactory.java =================================================================== RCS file: /sources/classpath/classpath/gnu/javax/net/ssl/provider/X509TrustManagerFactory.java,v retrieving revision 1.2 diff -u -r1.2 X509TrustManagerFactory.java --- gnu/javax/net/ssl/provider/X509TrustManagerFactory.java 10 Dec 2006 20:25:43 -0000 1.2 +++ gnu/javax/net/ssl/provider/X509TrustManagerFactory.java 4 Jun 2008 08:51:56 -0000 @@ -66,11 +66,12 @@ import javax.net.ssl.TrustManagerFactorySpi; import javax.net.ssl.X509TrustManager; -import gnu.java.security.action.GetPropertyAction; import gnu.java.security.x509.X509CertPath; import gnu.javax.net.ssl.NullManagerParameters; import gnu.javax.net.ssl.StaticTrustAnchors; +import sun.security.action.GetPropertyAction; + /** * This class implements a [EMAIL PROTECTED] javax.net.ssl.TrustManagerFactory} engine * for the ``JessieX509'' algorithm. Index: gnu/xml/aelfred2/XmlParser.java =================================================================== RCS file: /sources/classpath/classpath/gnu/xml/aelfred2/XmlParser.java,v retrieving revision 1.11 diff -u -r1.11 XmlParser.java --- gnu/xml/aelfred2/XmlParser.java 11 Jan 2008 21:22:59 -0000 1.11 +++ gnu/xml/aelfred2/XmlParser.java 4 Jun 2008 08:51:56 -0000 @@ -53,8 +53,6 @@ package gnu.xml.aelfred2; -import gnu.java.security.action.GetPropertyAction; - import java.io.BufferedInputStream; import java.io.CharConversionException; import java.io.EOFException; @@ -74,6 +72,7 @@ import org.xml.sax.InputSource; import org.xml.sax.SAXException; +import sun.security.action.GetPropertyAction; /** * Parse XML documents and return parse events through call-backs. Index: sun/security/action/GetPropertyAction.java --- /dev/null +++ sun/security/action/GetPropertyAction.java @@ -0,0 +1,92 @@ +/* GetPropertyAction.java + Copyright (C) 2004, 2008 Free Software Foundation, Inc. + +This file is part of GNU Classpath. + +GNU Classpath is free software; you can redistribute it and/or modify +it under the terms of the GNU General Public License as published by +the Free Software Foundation; either version 2, or (at your option) +any later version. + +GNU Classpath is distributed in the hope that it will be useful, but +WITHOUT ANY WARRANTY; without even the implied warranty of +MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +General Public License for more details. + +You should have received a copy of the GNU General Public License +along with GNU Classpath; see the file COPYING. If not, write to the +Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA +02110-1301 USA. + +Linking this library statically or dynamically with other modules is +making a combined work based on this library. Thus, the terms and +conditions of the GNU General Public License cover the whole +combination. + +As a special exception, the copyright holders of this library give you +permission to link this library with independent modules to produce an +executable, regardless of the license terms of these independent +modules, and to copy and distribute the resulting executable under +terms of your choice, provided that you also meet, for each linked +independent module, the terms and conditions of the license of that +module. An independent module is a module which is not derived from +or based on this library. If you modify this library, you may extend +this exception to your version of the library, but you are not +obligated to do so. If you do not wish to do so, delete this +exception statement from your version. */ + +package sun.security.action; + +import java.security.PrivilegedAction; + +/** + * PrivilegedAction implementation that calls System.getProperty() with + * the property name passed to its constructor. + * + * Example of use: + * <code> + * GetPropertyAction action = new GetPropertyAction("http.proxyPort"); + * String port = AccessController.doPrivileged(action); + * </code> + * + * Note: Usage of this class is discouraged as it is not a part of the + * J2SE API. + */ +public class GetPropertyAction implements PrivilegedAction<String> +{ + String name; + String value = null; + + public GetPropertyAction() + { + } + + public GetPropertyAction(String propName) + { + setParameters(propName); + } + + public GetPropertyAction(String propName, String defaultValue) + { + setParameters(propName, defaultValue); + } + + public String run() + { + return System.getProperty(name, value); + } + + public GetPropertyAction setParameters(String propName) + { + this.name = propName; + this.value = null; + return this; + } + + public GetPropertyAction setParameters(String propName, String defaultValue) + { + this.name = propName; + this.value = defaultValue; + return this; + } +}
signature.asc
Description: OpenPGP digital signature