From 8df3bcc3335e873151bf7dc9ef18a2e0aec14155 Mon Sep 17 00:00:00 2001 From: "Endi S. Dewata" Date: Tue, 7 Aug 2018 05:25:47 +0200 Subject: [PATCH] Removed unused Debug classes --- build_java.pl | 11 -- lib/jss.def | 1 - .../extensions/NSCertTypeExtension.java | 2 +- org/mozilla/jss/util/Assert.java | 3 - org/mozilla/jss/util/AssertionException.java | 1 - org/mozilla/jss/util/Debug_debug.jnot | 118 ----------------- org/mozilla/jss/util/Debug_ship.jnot | 119 ------------------ org/mozilla/jss/util/Makefile | 2 - org/mozilla/jss/util/java_ids.h | 7 -- org/mozilla/jss/util/jssutil.c | 15 +-- 10 files changed, 2 insertions(+), 277 deletions(-) delete mode 100644 org/mozilla/jss/util/Debug_debug.jnot delete mode 100644 org/mozilla/jss/util/Debug_ship.jnot diff --git a/build_java.pl b/build_java.pl index 8baaf8298..067b46c5b 100644 --- a/build_java.pl +++ b/build_java.pl @@ -55,7 +55,6 @@ org.mozilla.jss.ssl.SSLSocket org.mozilla.jss.ssl.SSLServerSocket org.mozilla.jss.ssl.SocketBase -org.mozilla.jss.util.Debug org.mozilla.jss.util.Password ); @@ -153,10 +152,8 @@ sub setup_vars { $class_release_dir .= "/$cmdline_vars{SOURCE_RELEASE_CLASSES_DIR}"; if( $ENV{BUILD_OPT} ) { $javac_opt_flag = "-O"; - $debug_source_file = "org/mozilla/jss/util/Debug_ship.jnot"; } else { $javac_opt_flag = "-g"; - $debug_source_file = "org/mozilla/jss/util/Debug_debug.jnot"; } $jni_header_dir = "$dist_dir/private/jss/_jni"; @@ -263,14 +260,6 @@ sub clean { sub build { - # - # copy the appropriate debug file - # - my $debug_target_file = "org/mozilla/jss/util/Debug.java"; - if( compare($debug_source_file, $debug_target_file) ) { - copy($debug_source_file, $debug_target_file) or die "Copying file: $!"; - } - # # generate MANIFEST.MF file in dist dir # diff --git a/lib/jss.def b/lib/jss.def index 231d05595..6178d9fc4 100644 --- a/lib/jss.def +++ b/lib/jss.def @@ -177,7 +177,6 @@ Java_org_mozilla_jss_ssl_SocketBase_setSSLOption; Java_org_mozilla_jss_ssl_SocketBase_socketBind; Java_org_mozilla_jss_ssl_SocketBase_socketClose; Java_org_mozilla_jss_ssl_SocketBase_socketCreate; -Java_org_mozilla_jss_util_Debug_setNativeLevel; Java_org_mozilla_jss_util_Password_readPasswordFromConsole; ;+# ;+# Data objects (NONE) diff --git a/org/mozilla/jss/netscape/security/extensions/NSCertTypeExtension.java b/org/mozilla/jss/netscape/security/extensions/NSCertTypeExtension.java index bd8b3fd5d..3dc37f293 100644 --- a/org/mozilla/jss/netscape/security/extensions/NSCertTypeExtension.java +++ b/org/mozilla/jss/netscape/security/extensions/NSCertTypeExtension.java @@ -231,7 +231,7 @@ public NSCertTypeExtension(Boolean critical, Object value) throws IOException { /** - * Debug.trace("NSCertTypeExtension"); + * logger.trace("NSCertTypeExtension"); * this.mBitString = new byte[1]; * this.mBitString[0] = (byte)0x00; * return; diff --git a/org/mozilla/jss/util/Assert.java b/org/mozilla/jss/util/Assert.java index 612144e58..45616fd6a 100644 --- a/org/mozilla/jss/util/Assert.java +++ b/org/mozilla/jss/util/Assert.java @@ -5,10 +5,7 @@ /** * C-style assertions in Java. - * These methods are only active in debug mode - * (org.mozilla.jss.Debug.DEBUG==true). * - * @see org.mozilla.jss.util.Debug * @see org.mozilla.jss.util.AssertionException * @version $Revision$ $Date$ */ diff --git a/org/mozilla/jss/util/AssertionException.java b/org/mozilla/jss/util/AssertionException.java index 7c20957f8..8e7d604b3 100644 --- a/org/mozilla/jss/util/AssertionException.java +++ b/org/mozilla/jss/util/AssertionException.java @@ -10,7 +10,6 @@ * VM to halt and print a stack trace. * * @see org.mozilla.jss.util.Assert - * @see org.mozilla.jss.util.Debug * @version $Revision$ $Date$ */ public class AssertionException extends RuntimeException { diff --git a/org/mozilla/jss/util/Debug_debug.jnot b/org/mozilla/jss/util/Debug_debug.jnot deleted file mode 100644 index 8aecb7397..000000000 --- a/org/mozilla/jss/util/Debug_debug.jnot +++ /dev/null @@ -1,118 +0,0 @@ -/* This Source Code Form is subject to the terms of the Mozilla Public - * License, v. 2.0. If a copy of the MPL was not distributed with this - * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ - -/********************************************************************** - * --------------------------- W A R N I N G -------------------------- - * - * This file is the same as Debug_ship.jnot, except the static final - * constants have been set to enable debugging and tracing. You must - * double-edit any changes in this file into Debug_ship.jnot, and - * vice-versa. - **********************************************************************/ - -package org.mozilla.jss.util; - -/** - * Controls debug-mode operation of JSS classes, and allows for printing - * trace statements to standard output. - * - * @see org.mozilla.jss.util.Assert - * @version $Revision$ $Date$ - */ -public class Debug -{ - /** - * Controls debug mode for JSS. If DEBUG==true, debugging - * code will be enabled. If DEBUG==false, debugging code will not be - * executed. This variable does not influence the printing of trace - * statements; their execution depends on the debug level, which can - * be accessed through setLevel and getLevel. - * - * @see org.mozilla.jss.util.Assert - */ - public static final boolean DEBUG = true; - - public static final int OBNOXIOUS = 10; - public static final int VERBOSE = 5; - public static final int ERROR = 1; - public static final int QUIET = 0; - - /** - * The debug level of the application. This gives the level of detail - * trace messages will contain. A level of 0 means no debugging - * statements will be printed. - * - * !!If you change this, change it in the native code too!! - */ - private static int mDebugLevel = VERBOSE; - - /** - * Print a trace statement to standard output. - * - * @param level The detail level of the statement. - * The level must be greater than 0. - * @param str The trace statement. - */ - public synchronized static void trace(int level, String str) - { - // validate arguments in debug mode - if(DEBUG && (level < 0) ) { - throw new AssertionException("invalid debugging level "+level+ - " in trace"); - } - if (level <= mDebugLevel) - { - System.out.println(Thread.currentThread().getName() + ": " + str); - System.out.flush(); - } - } - - /** - * Print a trace statement to standard output. - * Uses the VERBOSE detail level. - * - * @param str The trace statement. - */ - public synchronized static void trace(String str) - { - trace(VERBOSE, str); - } - - /** - * Set the debugging level of the application. - * The level must not be negative. - */ - public synchronized static void setLevel(int level) - { - // In debugging mode, validate argument - if( DEBUG && (level < 0) ) { - throw new AssertionException("invalid debugging level set"); - } - - mDebugLevel = level; - setNativeLevel(level); - } - private static native void setNativeLevel(int level); - - /** - * Get debugging level of the application. - * - * @return The current debugging level of the application. - */ - public synchronized static int getLevel() { - return mDebugLevel; - } - - public synchronized static String getLevelStr() { - switch(mDebugLevel) { - case QUIET: return "QUIET"; - case ERROR: return "ERROR"; - case VERBOSE: return "VERBOSE"; - case OBNOXIOUS: return "OBNOXIOUS"; - default: - return String.valueOf(mDebugLevel); - } - } -} - diff --git a/org/mozilla/jss/util/Debug_ship.jnot b/org/mozilla/jss/util/Debug_ship.jnot deleted file mode 100644 index c3020e7f1..000000000 --- a/org/mozilla/jss/util/Debug_ship.jnot +++ /dev/null @@ -1,119 +0,0 @@ -/* This Source Code Form is subject to the terms of the Mozilla Public - * License, v. 2.0. If a copy of the MPL was not distributed with this - * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ - -/********************************************************************** - * --------------------------- W A R N I N G -------------------------- - * - * This file is the same as Debug_debug.jnot, except the static final - * constants have been set to disable debugging and tracing. You must - * double-edit any changes in this file into Debug_debug.jnot, and - * vice-versa. - **********************************************************************/ - - -package org.mozilla.jss.util; - -/** - * Controls debug-mode operation of JSS classes, and allows for printing - * trace statements to standard output. - * - * @see org.mozilla.jss.util.Assert - * @version $Revision$ $Date$ - */ -public class Debug -{ - /** - * Controls debug mode for JSS. If DEBUG==true, debugging - * code will be enabled. If DEBUG==false, debugging code will not be - * executed. This variable does not influence the printing of trace - * statements; their execution depends on the debug level, which can - * be accessed through setLevel and getLevel. - * - * @see org.mozilla.jss.util.Assert - */ - public static final boolean DEBUG = false; - - public static final int OBNOXIOUS = 10; - public static final int VERBOSE = 5; - public static final int ERROR = 1; - public static final int QUIET = 0; - - /** - * The debug level of the application. This gives the level of detail - * trace messages will contain. A level of 0 means no debugging - * statements will be printed. - * - * !!If you change this, change it in the native code too!! - */ - private static int mDebugLevel = ERROR; - - /** - * Print a trace statement to standard output. - * - * @param level The detail level of the statement. - * The level must be greater than 0. - * @param str The trace statement. - */ - public synchronized static void trace(int level, String str) - { - // validate arguments in debug mode - if(DEBUG && (level < 0) ) { - throw new AssertionException("invalid debugging level "+level+ - " in trace"); - } - if (level <= mDebugLevel) - { - System.out.println(Thread.currentThread().getName() + ": " + str); - System.out.flush(); - } - } - - /** - * Print a trace statement to standard output. - * Uses the VERBOSE detail level. - * - * @param str The trace statement. - */ - public synchronized static void trace(String str) - { - trace(VERBOSE, str); - } - - /** - * Set the debugging level of the application. - * The level must not be negative. - */ - public synchronized static void setLevel(int level) - { - // In debugging mode, validate argument - if( DEBUG && (level < 0) ) { - throw new AssertionException("invalid debugging level set"); - } - - mDebugLevel = level; - setNativeLevel(level); - } - private static native void setNativeLevel(int level); - - /** - * Get debugging level of the application. - * - * @return The current debugging level of the application. - */ - public synchronized static int getLevel() { - return mDebugLevel; - } - - public synchronized static String getLevelStr() { - switch(mDebugLevel) { - case QUIET: return "QUIET"; - case ERROR: return "ERROR"; - case VERBOSE: return "VERBOSE"; - case OBNOXIOUS: return "OBNOXIOUS"; - default: - return String.valueOf(mDebugLevel); - } - } -} - diff --git a/org/mozilla/jss/util/Makefile b/org/mozilla/jss/util/Makefile index 87195f419..0ead59564 100644 --- a/org/mozilla/jss/util/Makefile +++ b/org/mozilla/jss/util/Makefile @@ -28,8 +28,6 @@ include $(CORE_DEPTH)/config/config.mk include config.mk -ALL_TRASH += Debug.java - ####################################################################### # (5) Execute "global" rules. (OPTIONAL) # ####################################################################### diff --git a/org/mozilla/jss/util/java_ids.h b/org/mozilla/jss/util/java_ids.h index 5623fcee1..73b31fa97 100644 --- a/org/mozilla/jss/util/java_ids.h +++ b/org/mozilla/jss/util/java_ids.h @@ -44,13 +44,6 @@ PR_BEGIN_EXTERN_C #define COLLECTION_ADD_NAME "add" #define COLLECTION_ADD_SIG "(Ljava/lang/Object;)Z" -/* - * Debug - */ -#define DEBUG_CLASS_NAME "org/mozilla/jss/util/Debug" -#define DEBUG_TRACE_NAME "trace" -#define DEBUG_TRACE_SIG "(ILjava/lang/String;)V" - /* * InetAddress */ diff --git a/org/mozilla/jss/util/jssutil.c b/org/mozilla/jss/util/jssutil.c index 0d19a8450..af7474938 100644 --- a/org/mozilla/jss/util/jssutil.c +++ b/org/mozilla/jss/util/jssutil.c @@ -476,7 +476,7 @@ static int debugLevel = JSS_TRACE_ERROR; * * INPUTS * level - * The trace level, from org.mozilla.jss.util.Debug. + * The trace level. * mesg * The trace message. Must not be NULL. */ @@ -525,19 +525,6 @@ JSS_assertOutOfMem(JNIEnv *env) (*env)->Throw(env, excep); } -/*********************************************************************** - * Debug.setNativeLevel - * - * If the debug level is changed in Java code, change it in native - * code as well. - */ -JNIEXPORT void JNICALL -Java_org_mozilla_jss_util_Debug_setNativeLevel - (JNIEnv *env, jclass clazz, jint level) -{ - debugLevel = level; -} - /*********************************************************************** * Copies the contents of a SECItem into a new Java byte array. *