This is the mail archive of the java-patches@gcc.gnu.org mailing list for the Java project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: [patch] make security tests silent


Bryce McKinlay wrote:

Michael Koch wrote:

Am Montag, 15. November 2004 20:40 schrieb Bryce McKinlay:


It would be nice for us to have a more fine-grained way to select
debug messages rather than just Configuration.DEBUG, to allow the
user select what types of debug messages get printed at runtime,
but we don't have that, yet.


What about java.util.logging ? I think JDK uses it internally too.



Yeah, we could use that, along with some developer guidelines about what types of messages should go into each logging level, etc. We'd want to have customized logging levels, or some way for a user to select which messages get printed by category. For example, I might want all levels of serialization debugging messages to be printed but nothing else. Also, we should still surround logging calls with a Configuration.DEBUG check, so that optimized builds don't have additional overhead.

Ok, for the moment we decided to stay with my approach. Later on when we agreed on a logging strategy we can change this to use it.


I commit the attached patch in a few minutes.

Thanks,
Andreas

2004-11-16 Andreas Tobler <a.tobler@schweiz.ch>

	* java/security/Security.java (Security): Silence the warning about no
	providers found in the no debug case.

Index: java/security/Security.java
===================================================================
RCS file: /cvs/gcc/gcc/libjava/java/security/Security.java,v
retrieving revision 1.23
diff -u -r1.23 Security.java
--- java/security/Security.java	21 Oct 2004 20:21:04 -0000	1.23
+++ java/security/Security.java	16 Nov 2004 21:27:25 -0000
@@ -40,6 +40,8 @@
 
 import gnu.java.security.action.GetPropertyAction;
 
+import gnu.classpath.Configuration;
+
 import java.io.IOException;
 import java.io.InputStream;
 import java.net.URL;
@@ -81,20 +83,27 @@
       if (!loadProviders (base, "classpath")
 	  && !loaded
 	  && providers.size() == 0)
-        {
-	  // No providers found and both security files failed to load properly.
-	  System.err.println
-	    ("WARNING: could not properly read security provider files:");
-	  System.err.println
-	    ("         " + base + "/security/" + vendor + ".security");
-	  System.err.println
-	    ("         " + base + "/security/" + "classpath" + ".security");
-	  System.err.println
-	    ("         Falling back to standard GNU security provider");
-	  providers.addElement (new gnu.java.security.provider.Gnu());
-        }
-  }
-
+	  {
+	      if (Configuration.DEBUG)
+		  {
+		      /* No providers found and both security files failed to
+		       * load properly. Give a warning in case of DEBUG is
+		       * enabled. Could be done with java.util.logging later.
+		       */
+		      System.err.println
+			  ("WARNING: could not properly read security provider files:");
+		      System.err.println
+			  ("         " + base + "/security/" + vendor
+			   + ".security");
+		      System.err.println
+			  ("         " + base + "/security/" + "classpath"
+			   + ".security");
+		      System.err.println
+			  ("         Falling back to standard GNU security provider");
+		  }
+	      providers.addElement (new gnu.java.security.provider.Gnu());
+	  }
+    }
   // This class can't be instantiated.
   private Security()
   {

Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]