Top Description Inners Fields Constructors Methods
sun.security.util

public Class Debug

extends Object
Class Inheritance
Imports
java.io.PrintStream, java.math.BigInteger, java.time.Instant, .ZoneId, java.time.format.DateTimeFormatter, java.util.HexFormat, .Locale, java.util.regex.Pattern, .Matcher, sun.security.action.GetPropertyAction

A utility class for debugging.
Author
Roland Schemers

Nested and Inner Type Summary

Modifier and TypeClass and Description
private static class

Field Summary

Modifier and TypeField and Description
private static String
private String
private boolean
private boolean
private static final String
private static boolean
private static final String
private static boolean

Constructor Summary

AccessConstructor and Description
public

Method Summary

Modifier and TypeMethod and Description
private void
private String

Returns:

extra info if debug option enabled.
extraInfo
()

If thread debug option enabled, include information containing hex value of threadId and the current thread name If timestamp debug option enabled, include timestamp string

private static String
public static Debug
getInstance(String option)

Get a Debug object corresponding to whether or not the given option is set.

public static Debug
getInstance(String option, String prefix)

Get a Debug object corresponding to whether or not the given option is set.

public PrintStream
getPrintStream()

PrintStream for debug methods.

public static void
Help()

public static boolean
isOn(String option)

True if the system property "security.debug" contains the string "option".

public static boolean
isVerbose()

Check if verbose messages is enabled for extra debugging.

private static String
marshal(String args)

change a string into lower case except permission classes and URLs.

public static Debug

Returns:

a new Debug object if the property is true
of
(String
the debug option name
prefix
,
String
debug setting for this option
property
)

Get a Debug object corresponding to the given option on the given property value.

public void
println(String message)

print a message to stderr that is prefixed with the prefix created from the call to getInstance.

public void
println(Object obj, String message)

print a message to stderr that is prefixed with the prefix created from the call to getInstance and obj.

public void
println()

print a blank line to stderr that is prefixed with the prefix.

public void
println(String prefix, String message)

print a message to stderr that is prefixed with the prefix.

public static String
toHexString(BigInteger b)

return a hexadecimal printed representation of the specified BigInteger object.

public static String
toString(byte[] b)

public static String
Inherited from java.lang.Object:
cloneequalsfinalizegetClasshashCodenotifynotifyAlltoStringwaitwaitwait

Field Detail

argsback to summary
private static String args
prefixback to summary
private String prefix
printDateTimeback to summary
private boolean printDateTime
printThreadDetailsback to summary
private boolean printThreadDetails
THREAD_OPTIONback to summary
private static final String THREAD_OPTION
threadInfoAllback to summary
private static boolean threadInfoAll
TIMESTAMP_OPTIONback to summary
private static final String TIMESTAMP_OPTION
timeStampInfoAllback to summary
private static boolean timeStampInfoAll

Constructor Detail

Debugback to summary
public Debug()

Method Detail

configureExtrasback to summary
private void configureExtras(String option)
extraInfoback to summary
private String extraInfo()

If thread debug option enabled, include information containing hex value of threadId and the current thread name If timestamp debug option enabled, include timestamp string

Returns:String

extra info if debug option enabled.

formatCallerback to summary
private static String formatCaller()
getInstanceback to summary
public static Debug getInstance(String option)

Get a Debug object corresponding to whether or not the given option is set. Set the prefix to be the same as option.

getInstanceback to summary
public static Debug getInstance(String option, String prefix)

Get a Debug object corresponding to whether or not the given option is set. Set the prefix to prefix.

getPrintStreamback to summary
public PrintStream getPrintStream()

PrintStream for debug methods. Currently, only System.err is supported.

Helpback to summary
public static void Help()
isOnback to summary
public static boolean isOn(String option)

True if the system property "security.debug" contains the string "option".

isVerboseback to summary
public static boolean isVerbose()

Check if verbose messages is enabled for extra debugging.

marshalback to summary
private static String marshal(String args)

change a string into lower case except permission classes and URLs.

ofback to summary
public static Debug of(String prefix, String property)

Get a Debug object corresponding to the given option on the given property value.

Note

unlike other getInstance methods, this method does not use the java.security.debug system property.

Usually, this method is used by other individual area-specific debug settings. For example,

Map<String, String> settings = loadLoginSettings(); String property = settings.get("login"); Debug debug = Debug.of("login", property);
Map<String, String> settings = loadLoginSettings();
String property = settings.get("login");
Debug debug = Debug.of("login", property);
+timestamp string can be appended to property value to print timestamp information. (e.g. true+timestamp) +thread string can be appended to property value to print thread and caller information. (e.g. true+thread)
Parameters
prefix:String

the debug option name

property:String

debug setting for this option

Returns:Debug

a new Debug object if the property is true

printlnback to summary
public void println(String message)

print a message to stderr that is prefixed with the prefix created from the call to getInstance.

printlnback to summary
public void println(Object obj, String message)

print a message to stderr that is prefixed with the prefix created from the call to getInstance and obj.

printlnback to summary
public void println()

print a blank line to stderr that is prefixed with the prefix.

printlnback to summary
public void println(String prefix, String message)

print a message to stderr that is prefixed with the prefix.

toHexStringback to summary
public static String toHexString(BigInteger b)

return a hexadecimal printed representation of the specified BigInteger object. the value is formatted to fit on lines of at least 75 characters, with embedded newlines. Words are separated for readability, with eight words (32 bytes) per line.

toStringback to summary
public static String toString(byte[] b)
toStringback to summary
public static String toString(BigInteger b)
sun.security.util back to summary

private Class Debug.FormatHolder

extends Object
Class Inheritance

Field Summary

Modifier and TypeField and Description
private static final DateTimeFormatter
private static final String

Constructor Summary

AccessConstructor and Description
private

Method Summary

Inherited from java.lang.Object:
cloneequalsfinalizegetClasshashCodenotifynotifyAlltoStringwaitwaitwait

Field Detail

DATE_TIME_FORMATTERback to summary
private static final DateTimeFormatter DATE_TIME_FORMATTER
PATTERNback to summary
private static final String PATTERN

Constructor Detail

FormatHolderback to summary
private FormatHolder()