Top Description Fields Constructors Methods
com.sun.mail.util.logging

pack-priv final Class LogManagerProperties

extends Properties
Class Inheritance
Imports
java.io.*, java.lang.reflect.InvocationTargetException, .Method, .Modifier, .UndeclaredThrowableException, java.security.AccessController, .PrivilegedAction, java.util.*, java.util.logging.*, .Formatter

An adapter class to allow the Mail API to access the LogManager properties. The LogManager properties are treated as the root of all properties. First, the parent properties are searched. If no value is found, then, the LogManager is searched with prefix value. If not found, then, just the key itself is searched in the LogManager. If a value is found in the LogManager it is then copied to this properties object with no key prefix. If no value is found in the LogManager or the parent properties, then this properties object is searched only by passing the key value.

This class also emulates the LogManager functions for creating new objects from string class names. This is to support initial setup of objects such as log filters, formatters, error managers, etc.

This class should never be exposed outside of this package. Keep this class package private (default access).

Author
Jason Mehrens
Since
JavaMail 1.4.3

Field Summary

Modifier and TypeField and Description
private static final Object
LOG_MANAGER

Caches the LogManager or Properties so we only read the configuration once.

private static final Method
LR_GET_INSTANT

Holds the method used to get the LogRecord instant if running on JDK 9 or later.

private final String
prefix

The namespace prefix to search LogManager and defaults.

private static volatile String[]
REFLECT_NAMES

Caches the read only reflection class names string array.

private static final long
private static final Method
ZDT_OF_INSTANT

Holds the method used to convert and instant to a zoned date time if running on JDK 9 later.

private static final Method
ZI_SYSTEM_DEFAULT

Holds the method used to get the default time zone if running on JDK 9 or later.

Inherited from java.util.Properties:
defaults

Constructor Summary

AccessConstructor and Description
pack-priv
LogManagerProperties(final Properties
the parent properties.
parent
,
final String
the namespace prefix.
prefix
)

Creates a log manager properties object.

Method Summary

Modifier and TypeMethod and Description
private static void
checkLoggingAccess()

Check that the current context is trusted to modify the logging configuration when the LogManager is not present.

pack-priv static void
checkLogManagerAccess()

Check that the current context is trusted to modify the logging configuration.

public synchronized Object

Returns:

the snapshot.
clone
()

Overrides java.util.Properties.clone.

Returns a properties object that contains a snapshot of the current state.
public synchronized boolean

Returns:

the value for the key or null.
containsKey
(final Object
any key.
key
)

Overrides java.util.Properties.containsKey.

Implements java.util.Map.containsKey.

Required to work with PropUtil.
public boolean

Returns:

true if equal, otherwise false.
equals
(final Object
any object or null.
o
)

Overrides java.util.Properties.equals.

Implements java.util.Map.equals.

It is assumed that this method will never be called.
private Properties

Returns:

the safe snapshot.
exportCopy
(final Properties
the defaults to use with the snapshot.
parent
)

Creates a public snapshot of this properties object using the given parent properties.

private static Class<?>

Returns:

the class.
findClass
(String
full class name
name
)

This code is modified from the LogManager, which explictly states searching the system class loader first, then the context class loader.

pack-priv static String

Returns:

the LogManager.
fromLogManager
(final String
the property name.
name
)

Gets LogManger property for the running JVM.

public synchronized Object

Returns:

the value for the key or null.
get
(final Object
any key.
key
)

Overrides java.util.Properties.get.

Implements java.util.Map.get.

Required to work with PropUtil.
private static ClassLoader[]

Returns:

any array of class loaders. Indexes may be null.
getClassLoaders
()

Gets the class loaders using elevated privileges.

pack-priv static String

Returns:

the local host name or null.
getLocalHost
(final Object
the service to examine.
s
)

Gets the local host name from the given service.

public synchronized String

Returns:

the value for that key.
getProperty
(final String
a non null key.
key
)

Overrides java.util.Properties.getProperty.

Searches defaults, then searches the log manager if available or the system properties by the prefix property, and then by the key itself.
public String

Returns:

the value for the key.
getProperty
(final String
a key to search for.
key
,
final String
the default value to use if not found.
def
)

Overrides java.util.Properties.getProperty.

Calls getProperty directly.
pack-priv static Comparable<?>

Returns:

null if LogRecord doesn't support nanoseconds otherwise a new zoned date time is returned.
getZonedDateTime
(LogRecord
used to generate the zoned date time.
record
)

Gets the ZonedDateTime from the given log record.

public int

Returns:

the hash code.
hashCode
()

Overrides java.util.Properties.hashCode.

Implements java.util.Map.hashCode.

It is assumed that this method will never be called.
pack-priv static boolean

Returns:

true if a LogManager is present.
hasLogManager
()

Determines if access to the java.util.logging.LogManager class is restricted by the class loader.

pack-priv static boolean

Returns:

true if the given class name
isReflectionClass
(String
the fully qualified class name.
name
)

Determines if the given class name is a reflection class name responsible for invoking methods and or constructors.

pack-priv static boolean

Returns:

true if the given class name
isStaticUtilityClass
(String
the fully qualified class name.
name
)

Determines if the given class name identifies a utility class.

private static Object

Returns:

the LogManager or a loaded Properties object.
loadLogManager
()

Get the LogManager or loads a Properties object to use as the LogManager.

pack-priv static Comparator<? super LogRecord>

Returns:

a new comparator.
newComparator
(String
the fully qualified class name.
name
)

Creates a new log record comparator from the given class name.

pack-priv static ErrorManager

Returns:

a new error manager.
newErrorManager
(String
the fully qualified class name.
name
)

Creates a new error manager from the given class name.

pack-priv static Filter

Returns:

a new filter.
newFilter
(String
the fully qualified class name.
name
)

Creates a new filter from the given class name.

pack-priv static Formatter

Returns:

a new formatter.
newFormatter
(String
the fully qualified class name.
name
)

Creates a new formatter from the given class name.

pack-priv static <
The generic class type.
T
>
T

Returns:

a new object assignable to the given type.
newObjectFrom
(String
the fully qualified class name.
name
,
Class<T>
the assignable type for the given name.
type
)

Creates a new object from the given class name.

private static Exception

Returns:

the exception.
paramOrError
(InvocationTargetException
any invocation target.
ite
)

Returns the given exception or throws the escaping cause.

pack-priv static long

Returns:

the number of milliseconds parsed from the duration.
parseDurationToMillis
(final CharSequence
an ISO-8601 duration character sequence.
value
)

Used to parse an ISO-8601 duration format of PnDTnHnMn.nS.

private Object

Returns:

the default value for the key.
preWrite
(final Object
the key to search.
key
)

Called before a write operation of a key.

public Enumeration<?>

Returns:

the property names
propertyNames
()

Overrides java.util.Properties.propertyNames.

It is assumed that this method will never be called.
public synchronized Object

Returns:

the value for the key or the default value for the key.
put
(final Object
any key.
key
,
final Object
the value
value
)

Overrides java.util.Properties.put.

Implements java.util.Map.put.

Required to work with PropUtil.
private static Properties

Returns:

a properties object loaded with the default configuration.
readConfiguration
()

Create a properties object from the default logging configuration file.

private static String[]

Returns:

a string array containing the fully qualified class names.
reflectionClassNames
()

Determines all of the reflection class names used to invoke methods.

public synchronized Object

Returns:

the value for the key or the default value for the key.
remove
(final Object
any key.
key
)

Overrides java.util.Properties.remove.

Implements java.util.Map.remove.

Required to work with PropUtil.
pack-priv static <
the element type to be compared
T
>
Comparator<T>

Returns:

A comparator that imposes the reverse ordering of the specified comparator.
reverseOrder
(final Comparator<T>
a comparator whose ordering is to be reversed by the returned comparator
c
)

Returns a comparator that imposes the reverse ordering of the specified Comparator.

public Object

Returns:

the value for the key or the default value for the key.
setProperty
(String
any key.
key
,
String
the value corresponding to key.
value
)

Overrides java.util.Properties.setProperty.

Calls the put method directly.
pack-priv static String

Returns:

the language tag.
toLanguageTag
(final Locale
the locale to convert.
locale
)

Converts a locale to a language tag.

private static Class<?>

Returns:

the raw class.
tryLoad
(String
the class name.
name
,
ClassLoader
any class loader or null.
l
)

Loads a class using the given loader or the class loader of this class.

private static InvocationTargetException

Returns:

an InvocationTargetException.
wrapOrThrow
(ExceptionInInitializerError
the error.
eiie
)

Throws the given error if the cause is an error otherwise the given error is wrapped.

private synchronized Object

Returns:

the parent properties.
writeReplace
()

It is assumed that this method will never be called.

Inherited from java.util.Properties:
clearcomputecomputeIfAbsentcomputeIfPresentcontainscontainsValueelementsentrySetforEachgetOrDefaultisEmptykeyskeySetlistlistloadloadloadFromXMLmergeputAllputIfAbsentrehashremovereplacereplacereplaceAllsavesizestorestorestoreToXMLstoreToXMLstoreToXMLstringPropertyNamestoStringvalues

Field Detail

LOG_MANAGERback to summary
private static final Object LOG_MANAGER

Caches the LogManager or Properties so we only read the configuration once.

LR_GET_INSTANTback to summary
private static final Method LR_GET_INSTANT

Holds the method used to get the LogRecord instant if running on JDK 9 or later.

prefixback to summary
private final String prefix

The namespace prefix to search LogManager and defaults.

REFLECT_NAMESback to summary
private static volatile String[] REFLECT_NAMES

Caches the read only reflection class names string array. Declared volatile for safe publishing only. The VO_VOLATILE_REFERENCE_TO_ARRAY warning is a false positive.

Annotations
@SuppressWarnings:VolatileArrayField
serialVersionUIDback to summary
private static final long serialVersionUID

Hides java.util.Properties.serialVersionUID.

Generated serial id.

ZDT_OF_INSTANTback to summary
private static final Method ZDT_OF_INSTANT

Holds the method used to convert and instant to a zoned date time if running on JDK 9 later.

ZI_SYSTEM_DEFAULTback to summary
private static final Method ZI_SYSTEM_DEFAULT

Holds the method used to get the default time zone if running on JDK 9 or later.

Constructor Detail

LogManagerPropertiesback to summary
pack-priv LogManagerProperties(final Properties parent, final String prefix)

Creates a log manager properties object.

Parameters
parent:Properties

the parent properties.

prefix:String

the namespace prefix.

Exceptions
NullPointerException:
if prefix or parent is null.

Method Detail

checkLoggingAccessback to summary
private static void checkLoggingAccess()

Check that the current context is trusted to modify the logging configuration when the LogManager is not present. This requires LoggingPermission("control").

Exceptions
SecurityException:
if a security manager exists and the caller does not have LoggingPermission("control").
Since
JavaMail 1.5.3
checkLogManagerAccessback to summary
pack-priv static void checkLogManagerAccess()

Check that the current context is trusted to modify the logging configuration. This requires LoggingPermission("control").

Exceptions
SecurityException:
if a security manager exists and the caller does not have LoggingPermission("control").
Since
JavaMail 1.5.3
cloneback to summary
public synchronized Object clone()

Overrides java.util.Properties.clone.

Returns a properties object that contains a snapshot of the current state. This method violates the clone contract so that no instances of LogManagerProperties is exported for public use.

Returns:Object

the snapshot.

Annotations
@Override
@SuppressWarnings:CloneDoesntCallSuperClone
Since
JavaMail 1.4.4
containsKeyback to summary
public synchronized boolean containsKey(final Object key)

Overrides java.util.Properties.containsKey.

Implements java.util.Map.containsKey.

Required to work with PropUtil. An updated copy of the key is fetched from the log manager prior to returning.

Parameters
key:Object

any key.

Returns:boolean

the value for the key or null.

Annotations
@Override
Since
JavaMail 1.4.5
equalsback to summary
public boolean equals(final Object o)

Overrides java.util.Properties.equals.

Implements java.util.Map.equals.

It is assumed that this method will never be called. The prefix value is not used for the equals method.

Parameters
o:Object

any object or null.

Returns:boolean

true if equal, otherwise false.

Annotations
@Override
exportCopyback to summary
private Properties exportCopy(final Properties parent)

Creates a public snapshot of this properties object using the given parent properties.

Parameters
parent:Properties

the defaults to use with the snapshot.

Returns:Properties

the safe snapshot.

findClassback to summary
private static Class<?> findClass(String name) throws ClassNotFoundException

This code is modified from the LogManager, which explictly states searching the system class loader first, then the context class loader. There is resistance (compatibility) to change this behavior to simply searching the context class loader.

Parameters
name:String

full class name

Returns:Class<?>

the class.

Exceptions
ClassNotFoundException:
if the class name was not found.
LinkageError:
if the linkage fails.
ExceptionInInitializerError:
if static initializer fails.
fromLogManagerback to summary
pack-priv static String fromLogManager(final String name)

Gets LogManger property for the running JVM. If the LogManager doesn't exist then the default LogManger properties are used.

Parameters
name:String

the property name.

Returns:String

the LogManager.

Exceptions
NullPointerException:
if the given name is null.
Since
JavaMail 1.5.3
getback to summary
public synchronized Object get(final Object key)

Overrides java.util.Properties.get.

Implements java.util.Map.get.

Required to work with PropUtil. Calls getProperty directly if the given key is a string. Otherwise, performs a get operation on the defaults followed by the normal hash table get.

Parameters
key:Object

any key.

Returns:Object

the value for the key or null.

Annotations
@Override
Since
JavaMail 1.4.5
getClassLoadersback to summary
private static ClassLoader[] getClassLoaders()

Gets the class loaders using elevated privileges.

Returns:ClassLoader[]

any array of class loaders. Indexes may be null.

getLocalHostback to summary
pack-priv static String getLocalHost(final Object s) throws Exception

Gets the local host name from the given service.

Parameters
s:Object

the service to examine.

Returns:String

the local host name or null.

Exceptions
Exception:
if there is a problem.
IllegalAccessException:
if the method is inaccessible.
InvocationTargetException:
if the method throws an exception.
LinkageError:
if the linkage fails.
NullPointerException:
if the given service is null.
ExceptionInInitializerError:
if the static initializer fails.
NoSuchMethodException:
if the given service does not have a method to get the local host name as a string.
SecurityException:
if unable to inspect properties of object.
Since
JavaMail 1.5.3
getPropertyback to summary
public synchronized String getProperty(final String key)

Overrides java.util.Properties.getProperty.

Searches defaults, then searches the log manager if available or the system properties by the prefix property, and then by the key itself.

Parameters
key:String

a non null key.

Returns:String

the value for that key.

Annotations
@Override
getPropertyback to summary
public String getProperty(final String key, final String def)

Overrides java.util.Properties.getProperty.

Calls getProperty directly. If getProperty returns null the default value is returned.

Parameters
key:String

a key to search for.

def:String

the default value to use if not found.

Returns:String

the value for the key.

Annotations
@Override
Since
JavaMail 1.4.4
getZonedDateTimeback to summary
pack-priv static Comparable<?> getZonedDateTime(LogRecord record)

Gets the ZonedDateTime from the given log record.

Parameters
record:LogRecord

used to generate the zoned date time.

Returns:Comparable<?>

null if LogRecord doesn't support nanoseconds otherwise a new zoned date time is returned.

Annotations
@SuppressWarnings:UseSpecificCatch
Exceptions
NullPointerException:
if record is null.
Since
JavaMail 1.5.6
hashCodeback to summary
public int hashCode()

Overrides java.util.Properties.hashCode.

Implements java.util.Map.hashCode.

It is assumed that this method will never be called. See equals.

Returns:int

the hash code.

Annotations
@Override
hasLogManagerback to summary
pack-priv static boolean hasLogManager()

Determines if access to the java.util.logging.LogManager class is restricted by the class loader.

Returns:boolean

true if a LogManager is present.

Since
JavaMail 1.5.3
isReflectionClassback to summary
pack-priv static boolean isReflectionClass(String name) throws Exception

Determines if the given class name is a reflection class name responsible for invoking methods and or constructors.

Parameters
name:String

the fully qualified class name.

Returns:boolean

true if the given class name

Exceptions
Exception:
to match the error method of the ErrorManager.
ClassNotFoundException:
if the class name was not found.
IllegalAccessException:
if the constructor is inaccessible.
LinkageError:
if the linkage fails.
ExceptionInInitializerError:
if the static initializer fails.
SecurityException:
if unable to inspect properties of class.
Since
JavaMail 1.5.2
isStaticUtilityClassback to summary
pack-priv static boolean isStaticUtilityClass(String name) throws Exception

Determines if the given class name identifies a utility class.

Parameters
name:String

the fully qualified class name.

Returns:boolean

true if the given class name

Exceptions
Exception:
to match the error method of the ErrorManager.
ClassNotFoundException:
if the class name was not found.
IllegalAccessException:
if the constructor is inaccessible.
LinkageError:
if the linkage fails.
ExceptionInInitializerError:
if the static initializer fails.
SecurityException:
if unable to inspect properties of class.
Since
JavaMail 1.5.2
loadLogManagerback to summary
private static Object loadLogManager()

Get the LogManager or loads a Properties object to use as the LogManager.

Returns:Object

the LogManager or a loaded Properties object.

Since
JavaMail 1.5.3
newComparatorback to summary
pack-priv static Comparator<? super LogRecord> newComparator(String name) throws Exception

Creates a new log record comparator from the given class name.

Parameters
name:String

the fully qualified class name.

Returns:Comparator<? super LogRecord>

a new comparator.

Annotations
@SuppressWarnings:unchecked
Exceptions
Exception:
to match the error method of the ErrorManager.
ClassCastException:
if class name does not match the type.
ClassNotFoundException:
if the class name was not found.
IllegalAccessException:
if the constructor is inaccessible.
InstantiationException:
if the given class name is abstract.
InvocationTargetException:
if the constructor throws an exception.
LinkageError:
if the linkage fails.
ExceptionInInitializerError:
if the static initializer fails.
NoSuchMethodException:
if the class name does not have a no argument constructor.
Since
JavaMail 1.4.5
See Also
java.util.logging.LogRecord
newErrorManagerback to summary
pack-priv static ErrorManager newErrorManager(String name) throws Exception

Creates a new error manager from the given class name.

Parameters
name:String

the fully qualified class name.

Returns:ErrorManager

a new error manager.

Exceptions
Exception:
to match the error method of the ErrorManager.
ClassCastException:
if class name does not match the type.
ClassNotFoundException:
if the class name was not found.
IllegalAccessException:
if the constructor is inaccessible.
InstantiationException:
if the given class name is abstract.
InvocationTargetException:
if the constructor throws an exception.
LinkageError:
if the linkage fails.
ExceptionInInitializerError:
if the static initializer fails.
NoSuchMethodException:
if the class name does not have a no argument constructor.
Since
JavaMail 1.4.5
newFilterback to summary
pack-priv static Filter newFilter(String name) throws Exception

Creates a new filter from the given class name.

Parameters
name:String

the fully qualified class name.

Returns:Filter

a new filter.

Exceptions
Exception:
to match the error method of the ErrorManager.
ClassCastException:
if class name does not match the type.
ClassNotFoundException:
if the class name was not found.
IllegalAccessException:
if the constructor is inaccessible.
InstantiationException:
if the given class name is abstract.
InvocationTargetException:
if the constructor throws an exception.
LinkageError:
if the linkage fails.
ExceptionInInitializerError:
if the static initializer fails.
NoSuchMethodException:
if the class name does not have a no argument constructor.
Since
JavaMail 1.4.5
newFormatterback to summary
pack-priv static Formatter newFormatter(String name) throws Exception

Creates a new formatter from the given class name.

Parameters
name:String

the fully qualified class name.

Returns:Formatter

a new formatter.

Exceptions
Exception:
to match the error method of the ErrorManager.
ClassCastException:
if class name does not match the type.
ClassNotFoundException:
if the class name was not found.
IllegalAccessException:
if the constructor is inaccessible.
InstantiationException:
if the given class name is abstract.
InvocationTargetException:
if the constructor throws an exception.
LinkageError:
if the linkage fails.
ExceptionInInitializerError:
if the static initializer fails.
NoSuchMethodException:
if the class name does not have a no argument constructor.
Since
JavaMail 1.4.5
newObjectFromback to summary
pack-priv static <T> T newObjectFrom(String name, Class<T> type) throws Exception

Creates a new object from the given class name.

Parameters
<T>
The generic class type.
name:String

the fully qualified class name.

type:Class<T>

the assignable type for the given name.

Returns:T

a new object assignable to the given type.

Exceptions
Exception:
to match the error method of the ErrorManager.
ClassCastException:
if class name does not match the type.
ClassNotFoundException:
if the class name was not found.
IllegalAccessException:
if the constructor is inaccessible.
InstantiationException:
if the given class name is abstract.
InvocationTargetException:
if the constructor throws an exception.
LinkageError:
if the linkage fails.
ExceptionInInitializerError:
if the static initializer fails.
NoSuchMethodException:
if the class name does not have a no argument constructor.
Since
JavaMail 1.4.5
paramOrErrorback to summary
private static Exception paramOrError(InvocationTargetException ite)

Returns the given exception or throws the escaping cause.

Parameters
ite:InvocationTargetException

any invocation target.

Returns:Exception

the exception.

Exceptions
VirtualMachineError:
if present as cause.
ThreadDeath:
if present as cause.
Since
JavaMail 1.4.5
parseDurationToMillisback to summary
pack-priv static long parseDurationToMillis(final CharSequence value) throws Exception

Used to parse an ISO-8601 duration format of PnDTnHnMn.nS.

Parameters
value:CharSequence

an ISO-8601 duration character sequence.

Returns:long

the number of milliseconds parsed from the duration.

Exceptions
Exception:
if there is a problem.
ClassNotFoundException:
if the java.time classes are not present.
IllegalAccessException:
if the method is inaccessible.
InvocationTargetException:
if the method throws an exception.
LinkageError:
if the linkage fails.
NullPointerException:
if the given duration is null.
ExceptionInInitializerError:
if the static initializer fails.
NoSuchMethodException:
if the correct time methods are missing.
SecurityException:
if reflective access to the java.time classes are not allowed.
Since
JavaMail 1.5.5
preWriteback to summary
private Object preWrite(final Object key)

Called before a write operation of a key. Caches a key read from the log manager in this properties object. The key is only cached if it is an instance of a String and this properties doesn't contain a copy of the key.

Parameters
key:Object

the key to search.

Returns:Object

the default value for the key.

propertyNamesback to summary
public Enumeration<?> propertyNames()

Overrides java.util.Properties.propertyNames.

It is assumed that this method will never be called. No way to get the property names from LogManager.

Returns:Enumeration<?>

the property names

Annotations
@Override
putback to summary
public synchronized Object put(final Object key, final Object value)

Overrides java.util.Properties.put.

Implements java.util.Map.put.

Required to work with PropUtil. An updated copy of the key is fetched from the log manager if the key doesn't exist in this properties.

Parameters
key:Object

any key.

value:Object

Doc from java.util.Hashtable.put.

the value

Returns:Object

the value for the key or the default value for the key.

Annotations
@Override
Since
JavaMail 1.4.5
readConfigurationback to summary
private static Properties readConfiguration()

Create a properties object from the default logging configuration file. Since the LogManager is not available in restricted environments, only the default configuration is applicable.

Returns:Properties

a properties object loaded with the default configuration.

Since
JavaMail 1.5.3
reflectionClassNamesback to summary
private static String[] reflectionClassNames() throws Exception

Determines all of the reflection class names used to invoke methods. This method performs indirect and direct calls on a throwable to capture the standard class names and the implementation class names.

Returns:String[]

a string array containing the fully qualified class names.

Exceptions
Exception:
if there is a problem.
removeback to summary
public synchronized Object remove(final Object key)

Overrides java.util.Properties.remove.

Implements java.util.Map.remove.

Required to work with PropUtil. An updated copy of the key is fetched from the log manager if the key doesn't exist in this properties.

Parameters
key:Object

any key.

Returns:Object

the value for the key or the default value for the key.

Annotations
@Override
Since
JavaMail 1.4.5
reverseOrderback to summary
pack-priv static <T> Comparator<T> reverseOrder(final Comparator<T> c)

Returns a comparator that imposes the reverse ordering of the specified Comparator. If the given comparator declares a public reverseOrder method that method is called first and the return value is used. If that method is not declared or the caller does not have access then a comparator wrapping the given comparator is returned.

Parameters
<T>
the element type to be compared
c:Comparator<T>

a comparator whose ordering is to be reversed by the returned comparator

Returns:Comparator<T>

A comparator that imposes the reverse ordering of the specified comparator.

Annotations
@SuppressWarnings:unchecked, ThrowableResultIgnored
Exceptions
NullPointerException:
if the given comparator is null.
Since
JavaMail 1.5.0
setPropertyback to summary
public Object setProperty(String key, String value)

Overrides java.util.Properties.setProperty.

Calls the put method directly.

Parameters
key:String

any key.

value:String

Doc from java.util.Properties.setProperty.

the value corresponding to key.

Returns:Object

the value for the key or the default value for the key.

Annotations
@Override
Since
JavaMail 1.4.5
toLanguageTagback to summary
pack-priv static String toLanguageTag(final Locale locale)

Converts a locale to a language tag.

Parameters
locale:Locale

the locale to convert.

Returns:String

the language tag.

Exceptions
NullPointerException:
if the given locale is null.
Since
JavaMail 1.4.5
tryLoadback to summary
private static Class<?> tryLoad(String name, ClassLoader l) throws ClassNotFoundException

Loads a class using the given loader or the class loader of this class.

Parameters
name:String

the class name.

l:ClassLoader

any class loader or null.

Returns:Class<?>

the raw class.

Exceptions
ClassNotFoundException:
if not found.
wrapOrThrowback to summary
private static InvocationTargetException wrapOrThrow(ExceptionInInitializerError eiie)

Throws the given error if the cause is an error otherwise the given error is wrapped.

Parameters
eiie:ExceptionInInitializerError

the error.

Returns:InvocationTargetException

an InvocationTargetException.

Since
JavaMail 1.5.0
writeReplaceback to summary
private synchronized Object writeReplace() throws ObjectStreamException

It is assumed that this method will never be called. We return a safe copy for export to avoid locking this properties object or the defaults during write.

Returns:Object

the parent properties.

Exceptions
ObjectStreamException:
if there is a problem.