[patch] make security tests silent
Bryce McKinlay
mckinlay@redhat.com
Mon Nov 15 19:41:00 GMT 2004
Generally speaking, it isn't good style to be printing debug messages
unless debugging is enabled. In this case, the user will get an
exception if they try to use an algorithm that isn't implemented by the
GNU provider, so the additional warning does seem (mostly) redundant.
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.
I think this patch is fine.
Bryce
Andreas Tobler wrote:
>Hi all,
>
>would this be accepted to make the security tests silent?
>Or do you have other DEBUG preferences?
>
>Andreas
>
>P.S, with CL if ok. And reposted.
>
>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 15 Nov 2004 08:08:44 -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.
>+ */
>+ 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()
> {
>
>
>
More information about the Java-patches
mailing list