Patch: security provider discovery

Anthony Green green@redhat.com
Sat Sep 22 17:28:00 GMT 2001


This patch does two thing..

(1) makes the security provider property file "gcj.security" instead
    of "classpath.security" on the theory that other VM's may be using
    classpath.security and they will likely want different providers.

(2) fixes a bug in loading multiple providers.  Instead of trying
    security.provider.1, security.provider.2, security.provider.3, ...
    it was trying
    security.provider.1, security.provider.12, security.provider.123, ...
    
Ok?

2001-09-22  Anthony Green  <green@redhat.com>

	* java/security/Security.java (loadProviders): Fix bug in how
	providers are loaded.
	Read providers from gcj.security, not classpath.security.


Index: java/security/Security.java
===================================================================
RCS file: /cvs/gcc/gcc/libjava/java/security/Security.java,v
retrieving revision 1.2
diff -c -u -r1.2 Security.java
--- Security.java	2001/04/25 15:45:12	1.2
+++ Security.java	2001/09/23 00:21:54
@@ -57,7 +57,7 @@
     String separator = System.getProperty("file.separator");
     String secfilestr = System.getProperty("java.home") +
       separator + "lib" + separator + "security" + separator +
-      "classpath.security";
+      "gcj.security";
 
     providerCount = 0;
     try
@@ -69,17 +69,16 @@
 
 	int i = 1;
 	String name;
-	StringBuffer pname = new StringBuffer("security.provider.");
 
-	while ((name = secprops.getProperty(pname.append(i).toString())) !=
-	       null)
+	while ((name = secprops.getProperty("security.provider." + i++)) 
+	       != null)
 	  {
 	    Exception exception = null;
+
 	    try
 	      {
 		providers.addElement(Class.forName(name).newInstance());
 		providerCount++;
-		i++;
 	      }
 	    catch (ClassNotFoundException x)
 	      {



More information about the Java-patches mailing list