signature:
public class LoggingEvent { /** * Get the caller information for this logging event . If caller information is
 * null at the time of its invocation , this method extracts location
 * information . The collected information is cached for future use .
 * Note that after serialization it is impossible to correctly extract caller
 * information . */
public StackTraceElement [ ] getCallerData ( ) { } }

implementation: if ( callerDataArray == null ) { callerDataArray = CallerData . extract ( new Throwable ( ) , fqnOfLoggerClass , loggerContext . getMaxCallerDataDepth ( ) , loggerContext . getFrameworkPackages ( ) ) ; } return callerDataArray ;


signature:
public class LoggingEvent { /** * Set the MDC map for this event .
 * @ param map map of MDC properties to values
 * @ since 1.0.8 */
public void setMDCPropertyMap ( Map < String , String > map ) { } }

implementation: if ( mdcPropertyMap != null ) { throw new IllegalStateException ( "The MDCPropertyMap has been already set for this event." ) ; } this . mdcPropertyMap = map ;


signature:
public class MDCConverter { /** * if no key is specified , return all the values present in the MDC , in the format " k1 = v1 , k2 = v2 , . . . " */
private String outputMDCForAllKeys ( Map < String , String > mdcPropertyMap ) { } }

implementation:
StringBuilder buf = new StringBuilder ( ) ; boolean first = true ; for ( Map . Entry < String , String > entry : mdcPropertyMap . entrySet ( ) ) { if ( first ) { first = false ; } else { buf . append ( ", " ) ; } // format : key0 = value0 , key1 = value1
buf . append ( entry . getKey ( ) ) . append ( '=' ) . append ( entry . getValue ( ) ) ; } return buf . toString ( ) ;


signature:
public class FileExistsPropertyDefiner { /** * Returns " true " if the file specified by { @ link # setPath ( String ) path } property exists .
 * Returns " false " otherwise .
 * @ return " true " | " false " depending on the existence of file */
public String getPropertyValue ( ) { } }

implementation: if ( OptionHelper . isEmpty ( path ) ) { addError ( "The \"path\" property must be set." ) ; return null ; } File file = new File ( path ) ; return booleanAsStr ( file . exists ( ) ) ;


signature:
public class RemoteReceiverServerRunner { /** * { @ inheritDoc } */
@ Override protected boolean configureClient ( RemoteReceiverClient client ) { } }

implementation: client . setContext ( getContext ( ) ) ; client . setQueue ( new ArrayBlockingQueue < Serializable > ( clientQueueSize ) ) ; return true ;


signature:
public class CallerData { /** * Extract caller data information as an array based on a Throwable passed as
 * parameter
 * @ param t Throwable to extract data from
 * @ param fqnOfInvokingClass Fully qualified name of invoking class
 * @ param maxDepth maximum stack depth
 * @ param frameworkPackageList list of framework package names to search
 * @ return caller stack trace array */
public static StackTraceElement [ ] extract ( Throwable t , String fqnOfInvokingClass , final int maxDepth , List < String > frameworkPackageList ) { } }

implementation:
if ( t == null ) { return null ; } StackTraceElement [ ] steArray = t . getStackTrace ( ) ; StackTraceElement [ ] callerDataArray ; int found = LINE_NA ; for ( int i = 0 ; i < steArray . length ; i ++ ) { if ( isInFrameworkSpace ( steArray [ i ] . getClassName ( ) , fqnOfInvokingClass , frameworkPackageList ) ) { // the caller is assumed to be the next stack frame , hence the + 1.
found = i + 1 ; } else { if ( found != LINE_NA ) { break ; } } } // we failed to extract caller data
if ( found == LINE_NA ) { return EMPTY_CALLER_DATA_ARRAY ; } int availableDepth = steArray . length - found ; int desiredDepth = maxDepth < ( availableDepth ) ? maxDepth : availableDepth ; callerDataArray = new StackTraceElement [ desiredDepth ] ; for ( int i = 0 ; i < desiredDepth ; i ++ ) { callerDataArray [ i ] = steArray [ found + i ] ; } return callerDataArray ;


signature:
public class CallerData { /** * Is currentClass present in the list of packages considered part of the logging framework ? */
private static boolean isInFrameworkSpaceList ( String currentClass , List < String > frameworkPackageList ) { } }

implementation: if ( frameworkPackageList == null ) return false ; for ( String s : frameworkPackageList ) { if ( currentClass . startsWith ( s ) ) return true ; } return false ;


signature:
public class BasicStatusManager { /** * Add a new status object .
 * @ param newStatus
 * the status message to add */
public void add ( Status newStatus ) { } }

implementation:
// LBCORE - 72 : fire event before the count check
fireStatusAddEvent ( newStatus ) ; count ++ ; if ( newStatus . getLevel ( ) > level ) { level = newStatus . getLevel ( ) ; } synchronized ( statusListLock ) { if ( statusList . size ( ) < MAX_HEADER_COUNT ) { statusList . add ( newStatus ) ; } else { tailBuffer . add ( newStatus ) ; } }


signature:
public class BasicStatusManager { /** * This implementation does not allow duplicate installations of OnConsoleStatusListener
 * @ param listener */
public boolean add ( StatusListener listener ) { } }

implementation: synchronized ( statusListenerListLock ) { if ( listener instanceof OnConsoleStatusListener ) { boolean alreadyPresent = checkForPresence ( statusListenerList , listener . getClass ( ) ) ; if ( alreadyPresent ) { return false ; } } statusListenerList . add ( listener ) ; } return true ;


signature:
public class Interpreter { /** * Check if any implicit actions are applicable . As soon as an applicable
 * action is found , it is returned . Thus , the returned list will have at most
 * one element . */
List < Action > lookupImplicitAction ( ElementPath elementPath , Attributes attributes , InterpretationContext ec ) { } }

implementation: int len = implicitActions . size ( ) ; for ( int i = 0 ; i < len ; i ++ ) { ImplicitAction ia = ( ImplicitAction ) implicitActions . get ( i ) ; if ( ia . isApplicable ( elementPath , attributes , ec ) ) { List < Action > actionList = new ArrayList < Action > ( 1 ) ; actionList . add ( ia ) ; return actionList ; } } return null ;


signature:
public class Interpreter { /** * Return the list of applicable patterns for this */
List < Action > getApplicableActionList ( ElementPath elementPath , Attributes attributes ) { } }

implementation:
List < Action > applicableActionList = ruleStore . matchActions ( elementPath ) ; // logger . debug ( " set of applicable patterns : " + applicableActionList ) ;
if ( applicableActionList == null ) { applicableActionList = lookupImplicitAction ( elementPath , attributes , interpretationContext ) ; } return applicableActionList ;


signature:
public class SystemPropertiesProxy { /** * Sets the classloader to lookup the class for android . os . SystemProperties
 * @ param cl desired classloader
 * @ throws ClassNotFoundException android . os . SystemProperties class not found
 * @ throws SecurityException security manager does not allow class loading
 * @ throws NoSuchMethodException get / getBoolean method does not exist */
public void setClassLoader ( ClassLoader cl ) throws ClassNotFoundException , SecurityException , NoSuchMethodException { } }

implementation: if ( cl == null ) cl = this . getClass ( ) . getClassLoader ( ) ; SystemProperties = cl . loadClass ( "android.os.SystemProperties" ) ; getString = SystemProperties . getMethod ( "get" , new Class [ ] { String . class , String . class } ) ; getBoolean = SystemProperties . getMethod ( "getBoolean" , new Class [ ] { String . class , boolean . class } ) ;


signature:
public class SystemPropertiesProxy { /** * Get the value for the given key in the Android system properties
 * @ param key
 * the key to lookup
 * @ param def
 * a default value to return
 * @ return an empty string if the key isn ' t found
 * @ throws IllegalArgumentException
 * if the key exceeds 32 characters */
public String get ( String key , String def ) throws IllegalArgumentException { } }

implementation:
if ( SystemProperties == null || getString == null ) return null ; String ret = null ; try { ret = ( String ) getString . invoke ( SystemProperties , new Object [ ] { key , def } ) ; } catch ( IllegalArgumentException e ) { throw e ; } catch ( Exception e ) { } // if return value is null or empty , use the default
// since neither of those are valid values
if ( ret == null || ret . length ( ) == 0 ) { ret = def ; } return ret ;


signature:
public class SystemPropertiesProxy { /** * Get the value for the given key in the Android system properties , returned
 * as a boolean .
 * Values ' n ' , ' no ' , ' 0 ' , ' false ' or ' off ' are considered false . Values ' y ' ,
 * ' yes ' , ' 1 ' , ' true ' or ' on ' are considered true . ( case insensitive ) . If the
 * key does not exist , or has any other value , then the default result is
 * returned .
 * @ param key
 * the key to lookup
 * @ param def
 * a default value to return
 * @ return the key parsed as a boolean , or def if the key isn ' t found or is
 * not able to be parsed as a boolean .
 * @ throws IllegalArgumentException
 * if the key exceeds 32 characters */
public Boolean getBoolean ( String key , boolean def ) throws IllegalArgumentException { } }

implementation: if ( SystemProperties == null || getBoolean == null ) return def ; Boolean ret = def ; try { ret = ( Boolean ) getBoolean . invoke ( SystemProperties , new Object [ ] { key , def } ) ; } catch ( IllegalArgumentException e ) { throw e ; } catch ( Exception e ) { } return ret ;


signature:
public class Introspector { /** * Converts a name string ' s first letter to lowercase
 * @ param name
 * name string to evaluate
 * @ return the name with its first letter in lowercase */
static public String decapitalize ( String name ) { } }

implementation: if ( name == null || name . length ( ) == 0 ) { return name ; } else { String nm = name . substring ( 0 , 1 ) . toLowerCase ( Locale . US ) ; if ( name . length ( ) > 1 ) { nm += name . substring ( 1 ) ; } return nm ; }


signature:
public class Introspector { /** * Gets a class ' s method descriptors
 * @ param clazz
 * class to be evaluated
 * @ return method descriptors */
static public MethodDescriptor [ ] getMethodDescriptors ( Class < ? > clazz ) { } }

implementation: ArrayList < MethodDescriptor > methods = new ArrayList < MethodDescriptor > ( ) ; for ( Method m : clazz . getMethods ( ) ) { methods . add ( new MethodDescriptor ( m . getName ( ) , m ) ) ; } return methods . toArray ( new MethodDescriptor [ 0 ] ) ;


signature:
public class Introspector { /** * Gets a class ' s property descriptors . All properties have methods whose name
 * begins with " set " or " get " . The setters must have a single parameter and
 * getters must have none .
 * @ param clazz
 * class to be evaluated
 * @ return property descriptors */
static public PropertyDescriptor [ ] getPropertyDescriptors ( Class < ? > clazz ) { } }

implementation:
final String SETTER_PREFIX = "set" ; final String GETTER_PREFIX = "get" ; final int LEN_PREFIX = SETTER_PREFIX . length ( ) ; Map < String , PropertyDescriptor > map = new HashMap < String , PropertyDescriptor > ( ) ; for ( Method m : clazz . getMethods ( ) ) { PropertyDescriptor pd = null ; String mName = m . getName ( ) ; boolean isGet = mName . startsWith ( GETTER_PREFIX ) && ( mName . length ( ) > LEN_PREFIX ) ; boolean isSet = mName . startsWith ( SETTER_PREFIX ) && ( mName . length ( ) > LEN_PREFIX ) ; if ( isGet || isSet ) { String propName = decapitalize ( mName . substring ( LEN_PREFIX ) ) ; pd = map . get ( propName ) ; if ( pd == null ) { pd = new PropertyDescriptor ( propName ) ; map . put ( propName , pd ) ; } Class < ? > [ ] parmTypes = m . getParameterTypes ( ) ; if ( isSet ) { if ( parmTypes . length == 1 ) { // we only want the single - parm setter
pd . setWriteMethod ( m ) ; pd . setPropertyType ( parmTypes [ 0 ] ) ; } } else if ( isGet ) { if ( parmTypes . length == 0 ) { // we only want the zero - parm getter
pd . setReadMethod ( m ) ; // let setter ' s type take priority
if ( pd . getPropertyType ( ) == null ) { pd . setPropertyType ( m . getReturnType ( ) ) ; } } } } } return map . values ( ) . toArray ( new PropertyDescriptor [ 0 ] ) ;


signature:
public class SocketReceiver { /** * { @ inheritDoc } */
protected boolean shouldStart ( ) { } }

implementation: int errorCount = 0 ; if ( port == 0 ) { errorCount ++ ; addError ( "No port was configured for receiver. " + "For more information, please visit http://logback.qos.ch/codes.html#receiver_no_port" ) ; } if ( remoteHost == null ) { errorCount ++ ; addError ( "No host name or address was configured for receiver. " + "For more information, please visit http://logback.qos.ch/codes.html#receiver_no_host" ) ; } if ( reconnectionDelay == 0 ) { reconnectionDelay = AbstractSocketAppender . DEFAULT_RECONNECTION_DELAY ; } if ( errorCount == 0 ) { try { address = InetAddress . getByName ( remoteHost ) ; } catch ( UnknownHostException ex ) { addError ( "unknown host: " + remoteHost ) ; errorCount ++ ; } } if ( errorCount == 0 ) { receiverId = "receiver " + remoteHost + ":" + port + ": " ; } return errorCount == 0 ;


signature:
public class SocketReceiver { /** * { @ inheritDoc } */
public void run ( ) { } }

implementation:
try { LoggerContext lc = ( LoggerContext ) getContext ( ) ; while ( ! Thread . currentThread ( ) . isInterrupted ( ) ) { SocketConnector connector = createConnector ( address , port , 0 , reconnectionDelay ) ; connectorTask = activateConnector ( connector ) ; if ( connectorTask == null ) { break ; } socket = waitForConnectorToReturnASocket ( ) ; if ( socket == null ) break ; dispatchEvents ( lc ) ; } } catch ( InterruptedException ex ) { assert true ; // ok . . . we ' ll exit now
} addInfo ( "shutting down" ) ;


signature:
public class SocketReceiver { /** * { @ inheritDoc } */
public void connectionFailed ( SocketConnector connector , Exception ex ) { } }

implementation: if ( ex instanceof InterruptedException ) { addWarn ( "connector interrupted" , ex ) ; } else if ( ex instanceof ConnectException ) { addWarn ( receiverId + "connection refused" , ex ) ; } else { addWarn ( receiverId + "unspecified error" , ex ) ; }


signature:
public class ConsoleAppender { /** * Sets the value of the < b > Target < / b > option . Recognized values are
 * " System . out " and " System . err " . Any other value will be ignored .
 * @ param value desired console - output target */
public void setTarget ( String value ) { } }

implementation: @ SuppressWarnings ( "deprecation" ) ConsoleTarget t = ConsoleTarget . findByName ( value . trim ( ) ) ; if ( t == null ) { targetWarn ( value ) ; } else { target = t ; }


signature:
public class OutputStreamAppender { /** * Checks that requires parameters are set and if everything is in order ,
 * activates this appender . */
public void start ( ) { } }

implementation:
int errors = 0 ; if ( this . encoder == null ) { addStatus ( new ErrorStatus ( "No encoder set for the appender named \"" + name + "\"." , this ) ) ; errors ++ ; } if ( this . outputStream == null ) { addStatus ( new ErrorStatus ( "No output stream set for the appender named \"" + name + "\"." , this ) ) ; errors ++ ; } // only error free appenders should be activated
if ( errors == 0 ) { super . start ( ) ; }


signature:
public class OutputStreamAppender { /** * Close the underlying { @ link OutputStream } . */
protected void closeOutputStream ( ) { } }

implementation:
if ( this . outputStream != null ) { try { // before closing we have to output out layout ' s footer
encoderClose ( ) ; this . outputStream . close ( ) ; this . outputStream = null ; } catch ( IOException e ) { addStatus ( new ErrorStatus ( "Could not close output stream for OutputStreamAppender." , this , e ) ) ; } }


signature:
public class OutputStreamAppender { /** * Sets the @ link OutputStream } where the log output will go . The specified
 * < code > OutputStream < / code > must be opened by the user and be writable . The
 * < code > OutputStream < / code > will be closed when the appender instance is
 * closed .
 * @ param outputStream
 * An already opened OutputStream . */
public void setOutputStream ( OutputStream outputStream ) { } }

implementation:
lock . lock ( ) ; try { // close any previously opened output stream
closeOutputStream ( ) ; this . outputStream = outputStream ; if ( encoder == null ) { addWarn ( "Encoder has not been set. Cannot invoke its init method." ) ; return ; } encoderInit ( ) ; } finally { lock . unlock ( ) ; }


signature:
public class OutputStreamAppender { /** * Actual writing occurs here .
 * Most subclasses of < code > WriterAppender < / code > will need to override this
 * method .
 * @ param event the log event
 * @ since 0.9.0 */
protected void subAppend ( E event ) { } }

implementation:
if ( ! isStarted ( ) ) { return ; } try { // this step avoids LBCLASSIC - 139
if ( event instanceof DeferredProcessingAware ) { ( ( DeferredProcessingAware ) event ) . prepareForDeferredProcessing ( ) ; } // the synchronization prevents the OutputStream from being closed while we
// are writing . It also prevents multiple threads from entering the same
// converter . Converters assume that they are in a synchronized block .
// lock . lock ( ) ;
byte [ ] byteArray = this . encoder . encode ( event ) ; writeBytes ( byteArray ) ; } catch ( IOException ioe ) { // as soon as an exception occurs , move to non - started state
// and add a single ErrorStatus to the SM .
this . started = false ; addStatus ( new ErrorStatus ( "IO failure in appender" , this , ioe ) ) ; }


signature:
public class LifeCycleManager { /** * Resets this manager .
 * All registered components are stopped and removed from the manager . */
public void reset ( ) { } }

implementation: for ( LifeCycle component : components ) { if ( component . isStarted ( ) ) { component . stop ( ) ; } } components . clear ( ) ;


signature:
public class StatusListenerConfigHelper { /** * This utility method adds a new OnConsoleStatusListener to the context
 * passed as parameter .
 * @ param context
 * @ since 1.0.1 */
static public void addOnConsoleListenerInstance ( Context context , OnConsoleStatusListener onConsoleStatusListener ) { } }

implementation: onConsoleStatusListener . setContext ( context ) ; boolean effectivelyAdded = context . getStatusManager ( ) . add ( onConsoleStatusListener ) ; if ( effectivelyAdded ) { onConsoleStatusListener . start ( ) ; }


signature:
public class DefinePropertyAction { /** * Now property definer is initialized by all properties and we can put
 * property value to context */
public void end ( InterpretationContext ec , String name ) { } }

implementation:
if ( inError ) { return ; } Object o = ec . peekObject ( ) ; if ( o != definer ) { addWarn ( "The object at the of the stack is not the property definer for property named [" + propertyName + "] pushed earlier." ) ; } else { addInfo ( "Popping property definer for property named [" + propertyName + "] from the object stack" ) ; ec . popObject ( ) ; // let ' s put defined property and value to context but only if it is
// not null
String propertyValue = definer . getPropertyValue ( ) ; if ( propertyValue != null ) { ActionUtil . setProperty ( ec , propertyName , propertyValue , scope ) ; } }


signature:
public class ContextBasedDiscriminator { /** * Return the name of the current context name as found in the logging event . */
public String getDiscriminatingValue ( ILoggingEvent event ) { } }

implementation: String contextName = event . getLoggerContextVO ( ) . getName ( ) ; if ( contextName == null ) { return defaultValue ; } else { return contextName ; }


signature:
public class AsIsEscapeUtil { /** * Do not perform any character escaping .
 * Note that this method assumes that it is called after the escape character
 * has been consumed . */
public void escape ( String escapeChars , StringBuffer buf , char next , int pointer ) { } }

implementation:
// restitute the escape char ( because it was consumed
// before this method was called ) .
buf . append ( "\\" ) ; // restitute the next character
buf . append ( next ) ;


signature:
public class AsyncAppender { /** * Events of level TRACE , DEBUG and INFO are deemed to be discardable .
 * @ param event
 * @ return true if the event is of level TRACE , DEBUG or INFO false otherwise . */
protected boolean isDiscardable ( ILoggingEvent event ) { } }

implementation: Level level = event . getLevel ( ) ; return level . toInt ( ) <= Level . INFO_INT ;


signature:
public class ShutdownHookAction { /** * Instantiates a shutdown hook of the given class and sets its name .
 * The hook thus generated is placed in the { @ link InterpretationContext } ' s
 * shutdown hook bag . */
@ Override public void begin ( InterpretationContext ic , String name , Attributes attributes ) throws ActionException { } }

implementation: hook = null ; inError = false ; String className = attributes . getValue ( CLASS_ATTRIBUTE ) ; if ( OptionHelper . isEmpty ( className ) ) { className = DefaultShutdownHook . class . getName ( ) ; addInfo ( "Assuming className [" + className + "]" ) ; } try { addInfo ( "About to instantiate shutdown hook of type [" + className + "]" ) ; hook = ( ShutdownHookBase ) OptionHelper . instantiateByClassName ( className , ShutdownHookBase . class , context ) ; hook . setContext ( context ) ; ic . pushObject ( hook ) ; } catch ( Exception e ) { inError = true ; addError ( "Could not create a shutdown hook of type [" + className + "]." , e ) ; throw new ActionException ( e ) ; }


signature:
public class ShutdownHookAction { /** * Once the children elements are also parsed , now is the time to activate the
 * shutdown hook options . */
@ Override public void end ( InterpretationContext ic , String name ) throws ActionException { } }

implementation: if ( inError ) { return ; } Object o = ic . peekObject ( ) ; if ( o != hook ) { addWarn ( "The object at the of the stack is not the hook pushed earlier." ) ; } else { ic . popObject ( ) ; Thread hookThread = new Thread ( hook , "Logback shutdown hook [" + context . getName ( ) + "]" ) ; addInfo ( "Registering shutdown hook with JVM runtime" ) ; context . putObject ( CoreConstants . SHUTDOWN_HOOK_THREAD , hookThread ) ; Runtime . getRuntime ( ) . addShutdownHook ( hookThread ) ; }


signature:
public class KeyManagerFactoryFactoryBean { /** * Creates a { @ link KeyManagerFactory } using the receiver ' s configuration .
 * @ return factory object
 * @ throws NoSuchProviderException if the provider specified by
 * { @ link # setProvider ( String ) } is not known to the platform
 * @ throws NoSuchAlgorithmException if the algorithm specified by
 * { @ link # setAlgorithm ( String ) } is not known to the specified provider
 * ( or to the default platform provider if no provider is specified ) */
public KeyManagerFactory createKeyManagerFactory ( ) throws NoSuchProviderException , NoSuchAlgorithmException { } }

implementation: return getProvider ( ) != null ? KeyManagerFactory . getInstance ( getAlgorithm ( ) , getProvider ( ) ) : KeyManagerFactory . getInstance ( getAlgorithm ( ) ) ;


signature:
public class CloseUtil { /** * Closes a closeable while suppressing any { @ code IOException } that occurs .
 * @ param closeable the socket to close */
public static void closeQuietly ( Closeable closeable ) { } }

implementation:
if ( closeable == null ) return ; try { closeable . close ( ) ; } catch ( IOException ex ) { assert true ; // avoid an empty catch
}


signature:
public class CloseUtil { /** * Closes a socket while suppressing any { @ code IOException } that occurs .
 * @ param socket the socket to close */
public static void closeQuietly ( Socket socket ) { } }

implementation:
if ( socket == null ) return ; try { socket . close ( ) ; } catch ( IOException ex ) { assert true ; // avoid an empty catch
}


signature:
public class CloseUtil { /** * Closes a server socket while suppressing any { @ code IOException } that
 * occurs .
 * @ param serverSocket the socket to close */
public static void closeQuietly ( ServerSocket serverSocket ) { } }

implementation:
if ( serverSocket == null ) return ; try { serverSocket . close ( ) ; } catch ( IOException ex ) { assert true ; // avoid an empty catch
}


signature:
public class SSLParametersConfiguration { /** * Configures SSL parameters on an { @ link SSLConfigurable } .
 * @ param socket the subject configurable */
public void configure ( SSLConfigurable socket ) { } }

implementation: socket . setEnabledProtocols ( enabledProtocols ( socket . getSupportedProtocols ( ) , socket . getDefaultProtocols ( ) ) ) ; socket . setEnabledCipherSuites ( enabledCipherSuites ( socket . getSupportedCipherSuites ( ) , socket . getDefaultCipherSuites ( ) ) ) ; if ( isNeedClientAuth ( ) != null ) { socket . setNeedClientAuth ( isNeedClientAuth ( ) ) ; } if ( isWantClientAuth ( ) != null ) { socket . setWantClientAuth ( isWantClientAuth ( ) ) ; }


signature:
public class SSLParametersConfiguration { /** * Gets the set of enabled protocols based on the configuration .
 * @ param supportedProtocols protocols supported by the SSL engine
 * @ param defaultProtocols default protocols enabled by the SSL engine
 * @ return enabled protocols */
private String [ ] enabledProtocols ( String [ ] supportedProtocols , String [ ] defaultProtocols ) { } }

implementation:
if ( enabledProtocols == null ) { // we ' re assuming that the same engine is used for all configurables
// so once we determine the enabled set , we won ' t do it again
if ( OptionHelper . isEmpty ( getIncludedProtocols ( ) ) && OptionHelper . isEmpty ( getExcludedProtocols ( ) ) ) { enabledProtocols = Arrays . copyOf ( defaultProtocols , defaultProtocols . length ) ; } else { enabledProtocols = includedStrings ( supportedProtocols , getIncludedProtocols ( ) , getExcludedProtocols ( ) ) ; } for ( String protocol : enabledProtocols ) { addInfo ( "enabled protocol: " + protocol ) ; } } return enabledProtocols ;


signature:
public class SSLParametersConfiguration { /** * Gets the set of enabled cipher suites based on the configuration .
 * @ param supportedCipherSuites cipher suites supported by the SSL engine
 * @ param defaultCipherSuites default cipher suites enabled by the SSL engine
 * @ return enabled cipher suites */
private String [ ] enabledCipherSuites ( String [ ] supportedCipherSuites , String [ ] defaultCipherSuites ) { } }

implementation:
if ( enabledCipherSuites == null ) { // we ' re assuming that the same engine is used for all configurables
// so once we determine the enabled set , we won ' t do it again
if ( OptionHelper . isEmpty ( getIncludedCipherSuites ( ) ) && OptionHelper . isEmpty ( getExcludedCipherSuites ( ) ) ) { enabledCipherSuites = Arrays . copyOf ( defaultCipherSuites , defaultCipherSuites . length ) ; } else { enabledCipherSuites = includedStrings ( supportedCipherSuites , getIncludedCipherSuites ( ) , getExcludedCipherSuites ( ) ) ; } for ( String cipherSuite : enabledCipherSuites ) { addInfo ( "enabled cipher suite: " + cipherSuite ) ; } } return enabledCipherSuites ;


signature:
public class SSLParametersConfiguration { /** * Applies include and exclude patterns to an array of default string values
 * to produce an array of strings included by the patterns .
 * @ param defaults default list of string values
 * @ param included comma - separated patterns that identity values to include
 * @ param excluded comma - separated patterns that identity string to exclude
 * @ return an array of strings containing those strings from { @ code defaults }
 * that match at least one pattern in { @ code included } that are not
 * matched by any pattern in { @ code excluded } */
private String [ ] includedStrings ( String [ ] defaults , String included , String excluded ) { } }

implementation: List < String > values = new ArrayList < String > ( defaults . length ) ; values . addAll ( Arrays . asList ( defaults ) ) ; if ( included != null ) { StringCollectionUtil . retainMatching ( values , stringToArray ( included ) ) ; } if ( excluded != null ) { StringCollectionUtil . removeMatching ( values , stringToArray ( excluded ) ) ; } return values . toArray ( new String [ values . size ( ) ] ) ;


signature:
public class QueueFactory { /** * Creates a new { @ link LinkedBlockingDeque } with the given { @ code capacity } .
 * In case the given capacity is smaller than one it will automatically be
 * converted to one .
 * @ param capacity the capacity to use for the queue
 * @ param < E > the type of elements held in the queue
 * @ return a new instance of { @ link ArrayBlockingQueue } */
public < E > LinkedBlockingDeque < E > newLinkedBlockingDeque ( int capacity ) { } }

implementation: final int actualCapacity = capacity < 1 ? 1 : capacity ; return new LinkedBlockingDeque < E > ( actualCapacity ) ;


signature:
public class ActionUtil { /** * Convert a string into a scope . Scope . LOCAL is returned by default .
 * @ param scopeStr the string to be converted
 * @ return a scope corresponding to the input string ; Scope . LOCAL by default . */
static public Scope stringToScope ( String scopeStr ) { } }

implementation: if ( Scope . SYSTEM . toString ( ) . equalsIgnoreCase ( scopeStr ) ) return Scope . SYSTEM ; if ( Scope . CONTEXT . toString ( ) . equalsIgnoreCase ( scopeStr ) ) return Scope . CONTEXT ; return Scope . LOCAL ;


signature:
public class ActionUtil { /** * Add all the properties found in the argument named ' props ' to an
 * InterpretationContext .
 * @ param ic interpretation context
 * @ param props the properties to set in the context
 * @ param scope scope of properties */
static public void setProperties ( InterpretationContext ic , Properties props , Scope scope ) { } }

implementation: switch ( scope ) { case LOCAL : ic . addSubstitutionProperties ( props ) ; break ; case CONTEXT : ContextUtil cu = new ContextUtil ( ic . getContext ( ) ) ; cu . addProperties ( props ) ; break ; case SYSTEM : OptionHelper . setSystemProperties ( ic , props ) ; }


signature:
public class AppenderAttachableImpl { /** * Attach an appender . If the appender is already in the list in won ' t be
 * added again . */
public void addAppender ( Appender < E > newAppender ) { } }

implementation: if ( newAppender == null ) { throw new IllegalArgumentException ( "Null argument disallowed" ) ; } appenderList . addIfAbsent ( newAppender ) ;


signature:
public class AppenderAttachableImpl { /** * Call the < code > doAppend < / code > method on all attached appenders . */
public int appendLoopOnAppenders ( E e ) { } }

implementation: int size = 0 ; final Appender < E > [ ] appenderArray = appenderList . asTypedArray ( ) ; final int len = appenderArray . length ; for ( int i = 0 ; i < len ; i ++ ) { appenderArray [ i ] . doAppend ( e ) ; size ++ ; } return size ;


signature:
public class AppenderAttachableImpl { /** * Returns < code > true < / code > if the specified appender is in the list of
 * attached appenders , < code > false < / code > otherwise .
 * @ since 1.2 */
public boolean isAttached ( Appender < E > appender ) { } }

implementation: if ( appender == null ) { return false ; } for ( Appender < E > a : appenderList ) { if ( a == appender ) return true ; } return false ;


signature:
public class AppenderAttachableImpl { /** * Remove the appender passed as parameter form the list of attached
 * appenders . */
public boolean detachAppender ( Appender < E > appender ) { } }

implementation: if ( appender == null ) { return false ; } boolean result ; result = appenderList . remove ( appender ) ; return result ;


signature:
public class AppenderAttachableImpl { /** * Remove the appender with the name passed as parameter form the list of
 * appenders . */
public boolean detachAppender ( String name ) { } }

implementation: if ( name == null ) { return false ; } boolean removed = false ; for ( Appender < E > a : appenderList ) { if ( name . equals ( ( a ) . getName ( ) ) ) { removed = appenderList . remove ( a ) ; break ; } } return removed ;


signature:
public class Logger { /** * This method is invoked by parent logger to let this logger know that the
 * prent ' s levelInt changed .
 * @ param newParentLevelInt */
private synchronized void handleParentLevelChange ( int newParentLevelInt ) { } }

implementation:
// changes in the parent levelInt affect children only if their levelInt is
// null
if ( level == null ) { effectiveLevelInt = newParentLevelInt ; // propagate the parent levelInt change to this logger ' s children
if ( childrenList != null ) { int len = childrenList . size ( ) ; for ( int i = 0 ; i < len ; i ++ ) { Logger child = ( Logger ) childrenList . get ( i ) ; child . handleParentLevelChange ( newParentLevelInt ) ; } } }


signature:
public class Logger { /** * details . */
public synchronized void addAppender ( Appender < ILoggingEvent > newAppender ) { } }

implementation: if ( aai == null ) { aai = new AppenderAttachableImpl < ILoggingEvent > ( ) ; } aai . addAppender ( newAppender ) ;


signature:
public class Logger { /** * Invoke all the appenders of this logger .
 * @ param event
 * The event to log */
public void callAppenders ( ILoggingEvent event ) { } }

implementation:
int writes = 0 ; for ( Logger l = this ; l != null ; l = l . parent ) { writes += l . appendLoopOnAppenders ( event ) ; if ( ! l . additive ) { break ; } } // No appenders in hierarchy
if ( writes == 0 ) { loggerContext . noAppenderDefinedWarning ( this ) ; }


signature:
public class Logger { /** * Remove the appender passed as parameter form the list of appenders . */
public boolean detachAppender ( Appender < ILoggingEvent > appender ) { } }

implementation: if ( aai == null ) { return false ; } return aai . detachAppender ( appender ) ;


signature:
public class Logger { /** * Create a child of this logger by suffix , that is , the part of the name
 * extending this logger . For example , if this logger is named " x . y " and the
 * lastPart is " z " , then the created child logger will be named " x . y . z " .
 * IMPORTANT : Calls to this method must be within a synchronized block on this
 * logger .
 * @ param lastPart
 * the suffix ( i . e . last part ) of the child logger name . This
 * parameter may not include dots , i . e . the logger separator
 * character .
 * @ return */
Logger createChildByLastNamePart ( final String lastPart ) { } }

implementation: int i_index = LoggerNameUtil . getFirstSeparatorIndexOf ( lastPart ) ; if ( i_index != - 1 ) { throw new IllegalArgumentException ( "Child name [" + lastPart + " passed as parameter, may not include [" + CoreConstants . DOT + "]" ) ; } if ( childrenList == null ) { childrenList = new CopyOnWriteArrayList < Logger > ( ) ; } Logger childLogger ; if ( this . isRootLogger ( ) ) { childLogger = new Logger ( lastPart , this , this . loggerContext ) ; } else { childLogger = new Logger ( name + CoreConstants . DOT + lastPart , this , this . loggerContext ) ; } childrenList . add ( childLogger ) ; childLogger . effectiveLevelInt = this . effectiveLevelInt ; return childLogger ;


signature:
public class Logger { /** * The next methods are not merged into one because of the time we gain by not
 * creating a new Object [ ] with the params . This reduces the cost of not
 * logging by about 20 nanoseconds . */
private void filterAndLog_0_Or3Plus ( final String localFQCN , final Marker marker , final Level level , final String msg , final Object [ ] params , final Throwable t ) { } }

implementation: final FilterReply decision = loggerContext . getTurboFilterChainDecision_0_3OrMore ( marker , this , level , msg , params , t ) ; if ( decision == FilterReply . NEUTRAL ) { if ( effectiveLevelInt > level . levelInt ) { return ; } } else if ( decision == FilterReply . DENY ) { return ; } buildLoggingEventAndAppend ( localFQCN , marker , level , msg , params , t ) ;


signature:
public class Logger { /** * Method that calls the attached TurboFilter objects based on the logger and
 * the level .
 * It is used by isYYYEnabled ( ) methods .
 * It returns the typical FilterReply values : ACCEPT , NEUTRAL or DENY .
 * @ param level
 * @ return the reply given by the TurboFilters */
private FilterReply callTurboFilters ( Marker marker , Level level ) { } }

implementation: return loggerContext . getTurboFilterChainDecision_0_3OrMore ( marker , this , level , null , null , null ) ;


signature:
public class Logger { /** * Support SLF4J interception during initialization as introduced in SLF4J version 1.7.15
 * @ since 1.1.4
 * @ param slf4jEvent */
public void log ( org . slf4j . event . LoggingEvent slf4jEvent ) { } }

implementation: Level level = Level . fromLocationAwareLoggerInteger ( slf4jEvent . getLevel ( ) . toInt ( ) ) ; filterAndLog_0_Or3Plus ( FQCN , slf4jEvent . getMarker ( ) , level , slf4jEvent . getMessage ( ) , slf4jEvent . getArgumentArray ( ) , slf4jEvent . getThrowable ( ) ) ;


signature:
public class DefaultSocketConnector { /** * Loops until the desired connection is established and returns the resulting connector . */
public Socket call ( ) throws InterruptedException { } }

implementation: useDefaultsForMissingFields ( ) ; Socket socket = createSocket ( ) ; while ( socket == null && ! Thread . currentThread ( ) . isInterrupted ( ) ) { Thread . sleep ( delayStrategy . nextDelay ( ) ) ; socket = createSocket ( ) ; } return socket ;


signature:
public class FileUtil { /** * Creates the parent directories of a file . If parent directories not
 * specified in file ' s path , then nothing is done and this returns
 * gracefully .
 * @ param file file whose parent directories ( if any ) should be created
 * @ return { @ code true } if either no parents were specified , or if all
 * parent directories were created successfully ; { @ code false } otherwise */
static public boolean createMissingParentDirectories ( File file ) { } }

implementation:
File parent = file . getParentFile ( ) ; if ( parent == null ) { // Parent directory not specified , therefore it ' s a request to
// create nothing . Done ! ; )
return true ; } // File . mkdirs ( ) creates the parent directories only if they don ' t
// already exist ; and it ' s okay if they do .
parent . mkdirs ( ) ; return parent . exists ( ) ;


signature:
public class FileUtil { /** * Prepends a string to a path if the path is relative . If the path
 * is already absolute , the same path is returned ( nothing changed ) .
 * This is useful for converting relative paths to absolute ones ,
 * given the absolute directory path as a prefix .
 * @ param prefix string to prepend to the evaluated path if it ' s not
 * already absolute
 * @ param path path to evaluate
 * @ return path ( prefixed if relative ) */
public static String prefixRelativePath ( String prefix , String path ) { } }

implementation: if ( prefix != null && ! OptionHelper . isEmpty ( prefix . trim ( ) ) && ! new File ( path ) . isAbsolute ( ) ) { path = prefix + "/" + path ; } return path ;


signature:
public class Level { /** * Convert a Level to an Integer object .
 * @ return This level ' s Integer mapping . */
public Integer toInteger ( ) { } }

implementation: switch ( levelInt ) { case ALL_INT : return ALL_INTEGER ; case TRACE_INT : return TRACE_INTEGER ; case DEBUG_INT : return DEBUG_INTEGER ; case INFO_INT : return INFO_INTEGER ; case WARN_INT : return WARN_INTEGER ; case ERROR_INT : return ERROR_INTEGER ; case OFF_INT : return OFF_INTEGER ; default : throw new IllegalStateException ( "Level " + levelStr + ", " + levelInt + " is unknown." ) ; }


signature:
public class Level { /** * Convert an integer passed as argument to a Level . If the conversion fails ,
 * then this method returns the specified default .
 * @ param val integer to be evaluated
 * @ param defaultLevel default level if val could not be converted
 * @ return the corresponding level */
public static Level toLevel ( int val , Level defaultLevel ) { } }

implementation: switch ( val ) { case ALL_INT : return ALL ; case TRACE_INT : return TRACE ; case DEBUG_INT : return DEBUG ; case INFO_INT : return INFO ; case WARN_INT : return WARN ; case ERROR_INT : return ERROR ; case OFF_INT : return OFF ; default : return defaultLevel ; }


signature:
public class Level { /** * Convert the string passed as argument to a Level . If the conversion fails ,
 * then this method returns the value of < code > defaultLevel < / code > .
 * @ param sArg string to be evaluated
 * @ param defaultLevel default level if sArg could not be converted
 * @ return the corresponding level */
public static Level toLevel ( final String sArg , Level defaultLevel ) { } }

implementation: if ( sArg == null ) { return defaultLevel ; } final String in = sArg . trim ( ) ; if ( in . equalsIgnoreCase ( "ALL" ) ) { return Level . ALL ; } if ( in . equalsIgnoreCase ( "TRACE" ) ) { return Level . TRACE ; } if ( in . equalsIgnoreCase ( "DEBUG" ) ) { return Level . DEBUG ; } if ( in . equalsIgnoreCase ( "INFO" ) ) { return Level . INFO ; } if ( in . equalsIgnoreCase ( "WARN" ) ) { return Level . WARN ; } if ( in . equalsIgnoreCase ( "ERROR" ) ) { return Level . ERROR ; } if ( in . equalsIgnoreCase ( "OFF" ) ) { return Level . OFF ; } return defaultLevel ;


signature:
public class Level { /** * Convert one of the integer values defined in { @ link LocationAwareLogger }
 * interface to an instance of this class , i . e . a Level .
 * @ param levelInt An integer value representing a level as defined in LocationAwareLogger
 * @ return an instance of this class , i . e . a Level .
 * @ since 1.0.1 */
public static Level fromLocationAwareLoggerInteger ( int levelInt ) { } }

implementation: Level level ; switch ( levelInt ) { case LocationAwareLogger . TRACE_INT : level = TRACE ; break ; case LocationAwareLogger . DEBUG_INT : level = DEBUG ; break ; case LocationAwareLogger . INFO_INT : level = INFO ; break ; case LocationAwareLogger . WARN_INT : level = WARN ; break ; case LocationAwareLogger . ERROR_INT : level = ERROR ; break ; default : throw new IllegalArgumentException ( levelInt + " not a valid level value" ) ; } return level ;


signature:
public class Level { /** * Convert this level instance to an integer value defined in the
 * { @ link LocationAwareLogger } interface .
 * @ param level The level to convert to LocationAwareLogger integer
 * @ return int An integer corresponding to this level as defined in LocationAwareLogger
 * @ since 1.0.1 */
public static int toLocationAwareLoggerInteger ( Level level ) { } }

implementation: if ( level == null ) throw new IllegalArgumentException ( "null level parameter is not admitted" ) ; switch ( level . toInt ( ) ) { case Level . TRACE_INT : return LocationAwareLogger . TRACE_INT ; case Level . DEBUG_INT : return LocationAwareLogger . DEBUG_INT ; case Level . INFO_INT : return LocationAwareLogger . INFO_INT ; case Level . WARN_INT : return LocationAwareLogger . WARN_INT ; case Level . ERROR_INT : return LocationAwareLogger . ERROR_INT ; default : throw new IllegalArgumentException ( level + " not a valid level value" ) ; }


signature:
public class NoAutoStartUtil { /** * Returns true if the class of the object ' o ' passed as parameter is * not *
 * marked with the NoAutoStart annotation . Return true otherwise .
 * @ param o the object to evaluate
 * @ return true for classes not marked with the NoAutoStart annotation */
static public boolean notMarkedWithNoAutoStart ( Object o ) { } }

implementation: if ( o == null ) { return false ; } Class < ? > clazz = o . getClass ( ) ; NoAutoStart a = clazz . getAnnotation ( NoAutoStart . class ) ; return a == null ;


signature:
public class KeyStoreFactoryBean { /** * Creates a new { @ link KeyStore } using the receiver ' s configuration .
 * @ return key store
 * @ throws NoSuchProviderException if the provider specified by
 * { @ link # setProvider ( String ) } is not known to the platform
 * @ throws NoSuchAlgorithmException if the key store type specified by
 * { @ link # setType ( String ) } is not known to the specified provider
 * ( or the platform ' s default provider if the provider isn ' t specified )
 * @ throws KeyStoreException if some other error occurs in loading
 * the key store from the resource specified by
 * { @ link # setLocation ( String ) } */
public KeyStore createKeyStore ( ) throws NoSuchProviderException , NoSuchAlgorithmException , KeyStoreException { } }

implementation: if ( getLocation ( ) == null ) { throw new IllegalArgumentException ( "location is required" ) ; } InputStream inputStream = null ; try { URL url = LocationUtil . urlForResource ( getLocation ( ) ) ; inputStream = url . openStream ( ) ; KeyStore keyStore = newKeyStore ( ) ; keyStore . load ( inputStream , getPassword ( ) . toCharArray ( ) ) ; return keyStore ; } catch ( NoSuchProviderException ex ) { throw new NoSuchProviderException ( "no such keystore provider: " + getProvider ( ) ) ; } catch ( NoSuchAlgorithmException ex ) { throw new NoSuchAlgorithmException ( "no such keystore type: " + getType ( ) ) ; } catch ( FileNotFoundException ex ) { throw new KeyStoreException ( getLocation ( ) + ": file not found" ) ; } catch ( Exception ex ) { throw new KeyStoreException ( getLocation ( ) + ": " + ex . getMessage ( ) , ex ) ; } finally { try { if ( inputStream != null ) { inputStream . close ( ) ; } } catch ( IOException ex ) { ex . printStackTrace ( System . err ) ; } }


signature:
public class KeyStoreFactoryBean { /** * Invokes the appropriate JCE factory method to obtain a new
 * { @ link KeyStore } object . */
private KeyStore newKeyStore ( ) throws NoSuchAlgorithmException , NoSuchProviderException , KeyStoreException { } }

implementation: return getProvider ( ) != null ? KeyStore . getInstance ( getType ( ) , getProvider ( ) ) : KeyStore . getInstance ( getType ( ) ) ;


signature:
public class Loader { /** * Compute the number of occurrences a resource can be found by a class
 * loader .
 * @ param resource the resource name to look for
 * @ param classLoader the classloader used for the search
 * @ return matching resource URLs
 * @ throws IOException */
public static Set < URL > getResourceOccurrenceCount ( String resource , ClassLoader classLoader ) throws IOException { } }

implementation:
// See LBCLASSIC - 159
Set < URL > urlSet = new HashSet < URL > ( ) ; Enumeration < URL > urlEnum = classLoader . getResources ( resource ) ; while ( urlEnum . hasMoreElements ( ) ) { URL url = urlEnum . nextElement ( ) ; urlSet . add ( url ) ; } return urlSet ;


signature:
public class Loader { /** * Search for a resource using the classloader passed as parameter .
 * @ param resource the resource name to look for
 * @ param classLoader the classloader used for the search */
public static URL getResource ( String resource , ClassLoader classLoader ) { } }

implementation: try { return classLoader . getResource ( resource ) ; } catch ( Throwable t ) { return null ; }


signature:
public class Loader { /** * Get the class loader of the object passed as argument . Return the system
 * class loader if appropriate .
 * @ param o object to evaluate
 * @ return the classloader of the object */
public static ClassLoader getClassLoaderOfObject ( Object o ) { } }

implementation: if ( o == null ) { throw new NullPointerException ( "Argument cannot be null" ) ; } return getClassLoaderOfClass ( o . getClass ( ) ) ;


signature:
public class Loader { /** * Returns the class loader of clazz in an access privileged section .
 * @ param clazz the class to evaluate
 * @ return the classloader of the object */
public static ClassLoader getClassLoaderAsPrivileged ( final Class < ? > clazz ) { } }

implementation: if ( ! HAS_GET_CLASS_LOADER_PERMISSION ) return null ; else return AccessController . doPrivileged ( new PrivilegedAction < ClassLoader > ( ) { public ClassLoader run ( ) { return clazz . getClassLoader ( ) ; } } ) ;


signature:
public class Loader { /** * Return the class loader which loaded the class passed as argument . Return
 * the system class loader if appropriate .
 * @ param clazz the class to evaluate
 * @ return the classloader of the object */
public static ClassLoader getClassLoaderOfClass ( final Class < ? > clazz ) { } }

implementation: ClassLoader cl = clazz . getClassLoader ( ) ; if ( cl == null ) { return ClassLoader . getSystemClassLoader ( ) ; } else { return cl ; }


signature:
public class Loader { /** * If running under JDK 1.2 load the specified class using the
 * < code > Thread < / code > < code > contextClassLoader < / code > if that fails try
 * Class . forname . Under JDK 1.1 only Class . forName is used .
 * @ param clazz the name of the class to find
 * @ return the class */
public static Class < ? > loadClass ( String clazz ) throws ClassNotFoundException { } }

implementation:
// Just call Class . forName ( clazz ) if we are running under JDK 1.1
// or if we are instructed to ignore the TCL .
if ( ignoreTCL ) { return Class . forName ( clazz ) ; } else { try { return getTCL ( ) . loadClass ( clazz ) ; } catch ( Throwable e ) { // we reached here because tcl was null or because of a
// security exception , or because clazz could not be loaded . . .
// In any case we now try one more time
return Class . forName ( clazz ) ; } }


signature:
public class LogcatAppender { /** * Checks that required parameters are set , and if everything is in order ,
 * activates this appender . */
@ Override public void start ( ) { } }

implementation:
if ( ( this . encoder == null ) || ( this . encoder . getLayout ( ) == null ) ) { addError ( "No layout set for the appender named [" + name + "]." ) ; return ; } // tag encoder is optional but needs a layout
if ( this . tagEncoder != null ) { final Layout < ? > layout = this . tagEncoder . getLayout ( ) ; if ( layout == null ) { addError ( "No tag layout set for the appender named [" + name + "]." ) ; return ; } // prevent stack traces from showing up in the tag
// ( which could lead to very confusing error messages )
if ( layout instanceof PatternLayout ) { String pattern = this . tagEncoder . getPattern ( ) ; if ( ! pattern . contains ( "%nopex" ) ) { this . tagEncoder . stop ( ) ; this . tagEncoder . setPattern ( pattern + "%nopex" ) ; this . tagEncoder . start ( ) ; } PatternLayout tagLayout = ( PatternLayout ) layout ; tagLayout . setPostCompileProcessor ( null ) ; } } super . start ( ) ;


signature:
public class LogcatAppender { /** * Writes an event to Android ' s logging mechanism ( logcat )
 * @ param event
 * the event to be logged */
public void append ( ILoggingEvent event ) { } }

implementation: if ( ! isStarted ( ) ) { return ; } String tag = getTag ( event ) ; switch ( event . getLevel ( ) . levelInt ) { case Level . ALL_INT : case Level . TRACE_INT : if ( ! checkLoggable || Log . isLoggable ( tag , Log . VERBOSE ) ) { Log . v ( tag , this . encoder . getLayout ( ) . doLayout ( event ) ) ; } break ; case Level . DEBUG_INT : if ( ! checkLoggable || Log . isLoggable ( tag , Log . DEBUG ) ) { Log . d ( tag , this . encoder . getLayout ( ) . doLayout ( event ) ) ; } break ; case Level . INFO_INT : if ( ! checkLoggable || Log . isLoggable ( tag , Log . INFO ) ) { Log . i ( tag , this . encoder . getLayout ( ) . doLayout ( event ) ) ; } break ; case Level . WARN_INT : if ( ! checkLoggable || Log . isLoggable ( tag , Log . WARN ) ) { Log . w ( tag , this . encoder . getLayout ( ) . doLayout ( event ) ) ; } break ; case Level . ERROR_INT : if ( ! checkLoggable || Log . isLoggable ( tag , Log . ERROR ) ) { Log . e ( tag , this . encoder . getLayout ( ) . doLayout ( event ) ) ; } break ; case Level . OFF_INT : default : break ; }


signature:
public class LogcatAppender { /** * Gets the logcat tag string of a logging event
 * @ param event logging event to evaluate
 * @ return the tag string , truncated if max length exceeded */
protected String getTag ( ILoggingEvent event ) { } }

implementation:
// format tag based on encoder layout ; truncate if max length
// exceeded ( only necessary for isLoggable ( ) , which throws
// IllegalArgumentException )
String tag = ( this . tagEncoder != null ) ? this . tagEncoder . getLayout ( ) . doLayout ( event ) : event . getLoggerName ( ) ; if ( checkLoggable && ( tag . length ( ) > MAX_TAG_LENGTH ) ) { tag = tag . substring ( 0 , MAX_TAG_LENGTH - 1 ) + "*" ; } return tag ;


signature:
public class RemoteAppenderStreamClient { /** * { @ inheritDoc } */
public void setLoggerContext ( LoggerContext lc ) { } }

implementation: this . lc = lc ; this . logger = lc . getLogger ( getClass ( ) . getPackage ( ) . getName ( ) ) ;


signature:
public class RemoteAppenderStreamClient { /** * { @ inheritDoc } */
public void run ( ) { } }

implementation:
logger . info ( this + ": connected" ) ; HardenedObjectInputStream ois = null ; try { ois = createObjectInputStream ( ) ; while ( true ) { // read an event from the wire
ILoggingEvent event = ( ILoggingEvent ) ois . readObject ( ) ; // get a logger from the hierarchy . The name of the logger is taken to
// be the name contained in the event .
Logger remoteLogger = lc . getLogger ( event . getLoggerName ( ) ) ; // apply the logger - level filter
if ( remoteLogger . isEnabledFor ( event . getLevel ( ) ) ) { // finally log the event as if was generated locally
remoteLogger . callAppenders ( event ) ; } } } catch ( EOFException ex ) { // this is normal and expected
assert true ; } catch ( IOException ex ) { logger . info ( this + ": " + ex ) ; } catch ( ClassNotFoundException ex ) { logger . error ( this + ": unknown event class" ) ; } catch ( RuntimeException ex ) { logger . error ( this + ": " + ex ) ; } finally { if ( ois != null ) { CloseUtil . closeQuietly ( ois ) ; } close ( ) ; logger . info ( this + ": connection closed" ) ; }


signature:
public class PropertyAction { /** * Set a new property for the execution context by name , value pair , or adds
 * all the properties found in the given file . */
public void begin ( InterpretationContext ec , String localName , Attributes attributes ) { } }

implementation:
if ( "substitutionProperty" . equals ( localName ) ) { addWarn ( "[substitutionProperty] element has been deprecated. Please use the [property] element instead." ) ; } String name = attributes . getValue ( NAME_ATTRIBUTE ) ; String value = attributes . getValue ( VALUE_ATTRIBUTE ) ; String scopeStr = attributes . getValue ( SCOPE_ATTRIBUTE ) ; Scope scope = ActionUtil . stringToScope ( scopeStr ) ; if ( checkFileAttributeSanity ( attributes ) ) { String file = attributes . getValue ( FILE_ATTRIBUTE ) ; file = ec . subst ( file ) ; try { FileInputStream istream = new FileInputStream ( file ) ; loadAndSetProperties ( ec , istream , scope ) ; } catch ( FileNotFoundException e ) { addError ( "Could not find properties file [" + file + "]." ) ; } catch ( IOException e1 ) { addError ( "Could not read properties file [" + file + "]." , e1 ) ; } } else if ( checkResourceAttributeSanity ( attributes ) ) { String resource = attributes . getValue ( RESOURCE_ATTRIBUTE ) ; resource = ec . subst ( resource ) ; URL resourceURL = Loader . getResourceBySelfClassLoader ( resource ) ; if ( resourceURL == null ) { addError ( "Could not find resource [" + resource + "]." ) ; } else { try { InputStream istream = resourceURL . openStream ( ) ; loadAndSetProperties ( ec , istream , scope ) ; } catch ( IOException e ) { addError ( "Could not read resource file [" + resource + "]." , e ) ; } } } else if ( checkValueNameAttributesSanity ( attributes ) ) { value = RegularEscapeUtil . basicEscape ( value ) ; // now remove both leading and trailing spaces
value = value . trim ( ) ; value = ec . subst ( value ) ; ActionUtil . setProperty ( ec , name , value , scope ) ; } else { addError ( INVALID_ATTRIBUTES ) ; }


signature:
public class LoggerNameUtil { /** * Get the position of the separator character , if any , starting at position
 * ' fromIndex ' .
 * @ param name string to search
 * @ param fromIndex starting search index
 * @ return position of separator */
public static int getSeparatorIndexOf ( String name , int fromIndex ) { } }

implementation: int dotIndex = name . indexOf ( CoreConstants . DOT , fromIndex ) ; int dollarIndex = name . indexOf ( CoreConstants . DOLLAR , fromIndex ) ; if ( dotIndex == - 1 && dollarIndex == - 1 ) return - 1 ; if ( dotIndex == - 1 ) return dollarIndex ; if ( dollarIndex == - 1 ) return dotIndex ; return dotIndex < dollarIndex ? dotIndex : dollarIndex ;


signature:
public class OnMarkerEvaluator { /** * Return true if event passed as parameter contains one of the specified
 * user - markers . */
public boolean evaluate ( ILoggingEvent event ) throws NullPointerException , EvaluationException { } }

implementation: Marker eventsMarker = event . getMarker ( ) ; if ( eventsMarker == null ) { return false ; } for ( String markerStr : markerList ) { if ( eventsMarker . contains ( markerStr ) ) { return true ; } } return false ;


signature:
public class TrustManagerFactoryFactoryBean { /** * Creates a { @ link TrustManagerFactory } using the receiver ' s configuration .
 * @ return factory object
 * @ throws NoSuchProviderException if the provider specified by
 * { @ link # setProvider ( String ) } is not known to the platform
 * @ throws NoSuchAlgorithmException if the algorithm specified by
 * { @ link # setAlgorithm ( String ) } is not known to the specified provider
 * ( or to the default platform provider if no provider is specified ) */
public TrustManagerFactory createTrustManagerFactory ( ) throws NoSuchProviderException , NoSuchAlgorithmException { } }

implementation: return getProvider ( ) != null ? TrustManagerFactory . getInstance ( getAlgorithm ( ) , getProvider ( ) ) : TrustManagerFactory . getInstance ( getAlgorithm ( ) ) ;


signature:
public class SimpleSocketServer { /** * Returns a name to identify each client thread . */
protected String getClientThreadName ( Socket socket ) { } }

implementation: return String . format ( Locale . US , "Logback SocketNode (client: %s)" , socket . getRemoteSocketAddress ( ) ) ;


signature:
public class FileStoreUtil { /** * This method assumes that both files a and b exists .
 * @ param a first file
 * @ param b second file
 * @ return whether files are on same store
 * @ throws IllegalArgumentException */
static public boolean areOnSameFileStore ( File a , File b ) throws RolloverFailure { } }

implementation:
if ( ! a . exists ( ) ) { throw new IllegalArgumentException ( "File [" + a + "] does not exist." ) ; } if ( ! b . exists ( ) ) { throw new IllegalArgumentException ( "File [" + b + "] does not exist." ) ; } // Implements the following by reflection
// Path pathA = a . toPath ( ) ;
// Path pathB = b . toPath ( ) ;
// FileStore fileStoreA = Files . getFileStore ( pathA ) ;
// FileStore fileStoreB = Files . getFileStore ( pathB ) ;
// return fileStoreA . equals ( fileStoreB ) ;
try { Class < ? > pathClass = Class . forName ( PATH_CLASS_STR ) ; Class < ? > filesClass = Class . forName ( FILES_CLASS_STR ) ; Method toPath = File . class . getMethod ( "toPath" ) ; Method getFileStoreMethod = filesClass . getMethod ( "getFileStore" , pathClass ) ; Object pathA = toPath . invoke ( a ) ; Object pathB = toPath . invoke ( b ) ; Object fileStoreA = getFileStoreMethod . invoke ( null , pathA ) ; Object fileStoreB = getFileStoreMethod . invoke ( null , pathB ) ; return fileStoreA . equals ( fileStoreB ) ; } catch ( Exception e ) { throw new RolloverFailure ( "Failed to check file store equality for [" + a + "] and [" + b + "]" , e ) ; }


signature:
public class SMTPAppenderBase { /** * Start the appender */
public void start ( ) { } }

implementation: if ( cbTracker == null ) { cbTracker = new CyclicBufferTracker < E > ( ) ; } session = buildSessionFromProperties ( ) ; if ( session == null ) { addError ( "Failed to obtain javax.mail.Session. Cannot start." ) ; return ; } subjectLayout = makeSubjectLayout ( subjectStr ) ; started = true ;


signature:
public class SMTPAppenderBase { /** * Perform SMTPAppender specific appending actions , delegating some of them to
 * a subclass and checking if the event triggers an e - mail to be sent . */
protected void append ( E eventObject ) { } }

implementation:
if ( ! checkEntryConditions ( ) ) { return ; } String key = discriminator . getDiscriminatingValue ( eventObject ) ; long now = System . currentTimeMillis ( ) ; final CyclicBuffer < E > cb = cbTracker . getOrCreate ( key , now ) ; subAppend ( cb , eventObject ) ; try { if ( eventEvaluator . evaluate ( eventObject ) ) { // clone the CyclicBuffer before sending out asynchronously
CyclicBuffer < E > cbClone = new CyclicBuffer < E > ( cb ) ; // see http : / / jira . qos . ch / browse / LBCLASSIC - 221
cb . clear ( ) ; if ( asynchronousSending ) { // perform actual sending asynchronously
SenderRunnable senderRunnable = new SenderRunnable ( cbClone , eventObject ) ; context . getScheduledExecutorService ( ) . execute ( senderRunnable ) ; } else { // synchronous sending
sendBuffer ( cbClone , eventObject ) ; } } } catch ( EvaluationException ex ) { errorCount ++ ; if ( errorCount < CoreConstants . MAX_ERROR_COUNT ) { addError ( "SMTPAppender's EventEvaluator threw an Exception-" , ex ) ; } } // immediately remove the buffer if asked by the user
if ( eventMarksEndOfLife ( eventObject ) ) { cbTracker . endOfLife ( key ) ; } cbTracker . removeStaleComponents ( now ) ; if ( lastTrackerStatusPrint + delayBetweenStatusMessages < now ) { addInfo ( "SMTPAppender [" + name + "] is tracking [" + cbTracker . getComponentCount ( ) + "] buffers" ) ; lastTrackerStatusPrint = now ; // quadruple ' delay ' assuming less than max delay
if ( delayBetweenStatusMessages < MAX_DELAY_BETWEEN_STATUS_MESSAGES ) { delayBetweenStatusMessages *= 4 ; } }


signature:
public class SMTPAppenderBase { /** * This method determines if there is a sense in attempting to append .
 * It checks whether there is a set output target and also if there is a set
 * layout . If these checks fail , then the boolean value < code > false < / code > is
 * returned .
 * @ return true if appender is setup properly */
public boolean checkEntryConditions ( ) { } }

implementation: if ( ! this . started ) { addError ( "Attempting to append to a non-started appender: " + this . getName ( ) ) ; return false ; } if ( this . eventEvaluator == null ) { addError ( "No EventEvaluator is set for appender [" + name + "]." ) ; return false ; } if ( this . layout == null ) { addError ( "No layout set for appender named [" + name + "]. For more information, please visit http://logback.qos.ch/codes.html#smtp_no_layout" ) ; return false ; } return true ;


signature:
public class SMTPAppenderBase { /** * Send the contents of the cyclic buffer as an e - mail message .
 * @ param cb the cyclic buffer
 * @ param lastEventObject the log event */
protected void sendBuffer ( CyclicBuffer < E > cb , E lastEventObject ) { } }

implementation:
// Note : this code already owns the monitor for this
// appender . This frees us from needing to synchronize on ' cb ' .
try { MimeBodyPart part = new MimeBodyPart ( ) ; StringBuffer sbuf = new StringBuffer ( ) ; String header = layout . getFileHeader ( ) ; if ( header != null ) { sbuf . append ( header ) ; } String presentationHeader = layout . getPresentationHeader ( ) ; if ( presentationHeader != null ) { sbuf . append ( presentationHeader ) ; } fillBuffer ( cb , sbuf ) ; String presentationFooter = layout . getPresentationFooter ( ) ; if ( presentationFooter != null ) { sbuf . append ( presentationFooter ) ; } String footer = layout . getFileFooter ( ) ; if ( footer != null ) { sbuf . append ( footer ) ; } String subjectStr = "Undefined subject" ; if ( subjectLayout != null ) { subjectStr = subjectLayout . doLayout ( lastEventObject ) ; // The subject must not contain new - line characters , which cause
// an SMTP error ( LOGBACK - 865 ) . Truncate the string at the first
// new - line character .
int newLinePos = ( subjectStr != null ) ? subjectStr . indexOf ( '\n' ) : - 1 ; if ( newLinePos > - 1 ) { subjectStr = subjectStr . substring ( 0 , newLinePos ) ; } } MimeMessage mimeMsg = new MimeMessage ( session ) ; if ( from != null ) { mimeMsg . setFrom ( getAddress ( from ) ) ; } else { mimeMsg . setFrom ( ) ; } mimeMsg . setSubject ( subjectStr , charsetEncoding ) ; List < InternetAddress > destinationAddresses = parseAddress ( lastEventObject ) ; if ( destinationAddresses . isEmpty ( ) ) { addInfo ( "Empty destination address. Aborting email transmission" ) ; return ; } InternetAddress [ ] toAddressArray = destinationAddresses . toArray ( EMPTY_IA_ARRAY ) ; mimeMsg . setRecipients ( Message . RecipientType . TO , toAddressArray ) ; String contentType = layout . getContentType ( ) ; if ( ContentTypeUtil . isTextual ( contentType ) ) { part . setText ( sbuf . toString ( ) , charsetEncoding , ContentTypeUtil . getSubType ( contentType ) ) ; } else { part . setContent ( sbuf . toString ( ) , layout . getContentType ( ) ) ; } Multipart mp = new MimeMultipart ( ) ; mp . addBodyPart ( part ) ; mimeMsg . setContent ( mp ) ; updateMimeMsg ( mimeMsg , cb , lastEventObject ) ; mimeMsg . setSentDate ( new Date ( ) ) ; addInfo ( "About to send out SMTP message \"" + subjectStr + "\" to " + Arrays . toString ( toAddressArray ) ) ; Transport . send ( mimeMsg ) ; } catch ( Exception e ) { addError ( "Error occurred while sending e-mail notification." , e ) ; }


signature: public class SocketNode { public void run ( ) { } }

implementation:
try { hardenedLoggingEventInputStream = new HardenedLoggingEventInputStream ( new BufferedInputStream ( socket . getInputStream ( ) ) ) ; } catch ( Exception e ) { logger . error ( "Could not open ObjectInputStream to " + socket , e ) ; closed = true ; } ILoggingEvent event ; Logger remoteLogger ; try { while ( ! closed ) { // read an event from the wire
event = ( ILoggingEvent ) hardenedLoggingEventInputStream . readObject ( ) ; // get a logger from the hierarchy . The name of the logger is taken to
// be the name contained in the event .
remoteLogger = context . getLogger ( event . getLoggerName ( ) ) ; // apply the logger - level filter
if ( remoteLogger . isEnabledFor ( event . getLevel ( ) ) ) { // finally log the event as if was generated locally
remoteLogger . callAppenders ( event ) ; } } } catch ( java . io . EOFException e ) { logger . info ( "Caught java.io.EOFException closing connection." ) ; } catch ( java . net . SocketException e ) { logger . info ( "Caught java.net.SocketException closing connection." ) ; } catch ( IOException e ) { logger . info ( "Caught java.io.IOException: " + e ) ; logger . info ( "Closing connection." ) ; } catch ( Exception e ) { logger . error ( "Unexpected exception. Closing connection." , e ) ; } socketServer . socketNodeClosing ( this ) ; close ( ) ;


signature:
public class DynamicThresholdFilter { /** * Add a new MDCValuePair */
public void addMDCValueLevelPair ( MDCValueLevelPair mdcValueLevelPair ) { } }

implementation: if ( valueLevelMap . containsKey ( mdcValueLevelPair . getValue ( ) ) ) { addError ( mdcValueLevelPair . getValue ( ) + " has been already set" ) ; } else { valueLevelMap . put ( mdcValueLevelPair . getValue ( ) , mdcValueLevelPair . getLevel ( ) ) ; }


signature:
public class DynamicThresholdFilter { /** * This method first finds the MDC value for ' key ' . It then finds the level
 * threshold associated with this MDC value from the list of MDCValueLevelPair
 * passed to this filter . This value is stored in a variable called
 * ' levelAssociatedWithMDCValue ' . If it null , then it is set to the
 * { @ link # defaultThreshold } value .
 * @ param marker
 * @ param logger
 * @ param level
 * @ param s
 * @ param objects
 * @ param throwable
 * @ return FilterReply - this filter ' s decision */
@ Override public FilterReply decide ( Marker marker , Logger logger , Level level , String s , Object [ ] objects , Throwable throwable ) { } }

implementation: String mdcValue = MDC . get ( this . key ) ; if ( ! isStarted ( ) ) { return FilterReply . NEUTRAL ; } Level levelAssociatedWithMDCValue = null ; if ( mdcValue != null ) { levelAssociatedWithMDCValue = valueLevelMap . get ( mdcValue ) ; } if ( levelAssociatedWithMDCValue == null ) { levelAssociatedWithMDCValue = defaultThreshold ; } if ( level . isGreaterOrEqual ( levelAssociatedWithMDCValue ) ) { return onHigherOrEqual ; } else { return onLower ; }


signature:
public class Compiler { /** * Attempt to create a converter using the information found in
 * ' converterMap ' .
 * @ param kn
 * @ return */
@ SuppressWarnings ( "unchecked" ) DynamicConverter < E > createConverter ( SimpleKeywordNode kn ) { } }

implementation: String keyword = ( String ) kn . getValue ( ) ; String converterClassStr = ( String ) converterMap . get ( keyword ) ; if ( converterClassStr != null ) { try { return ( DynamicConverter < E > ) OptionHelper . instantiateByClassName ( converterClassStr , DynamicConverter . class , context ) ; } catch ( Exception e ) { addError ( "Failed to instantiate converter class [" + converterClassStr + "] for keyword [" + keyword + "]" , e ) ; return null ; } } else { addError ( "There is no conversion class registered for conversion word [" + keyword + "]" ) ; return null ; }


signature:
public class Compiler { /** * Attempt to create a converter using the information found in
 * ' compositeConverterMap ' .
 * @ param cn
 * @ return */
@ SuppressWarnings ( "unchecked" ) CompositeConverter < E > createCompositeConverter ( CompositeNode cn ) { } }

implementation: String keyword = ( String ) cn . getValue ( ) ; String converterClassStr = ( String ) converterMap . get ( keyword ) ; if ( converterClassStr != null ) { try { return ( CompositeConverter < E > ) OptionHelper . instantiateByClassName ( converterClassStr , CompositeConverter . class , context ) ; } catch ( Exception e ) { addError ( "Failed to instantiate converter class [" + converterClassStr + "] as a composite converter for keyword [" + keyword + "]" , e ) ; return null ; } } else { addError ( "There is no conversion class registered for composite conversion word [" + keyword + "]" ) ; return null ; }


signature:
public class RollingPolicyBase { /** * Given the FileNamePattern string , this method determines the compression
 * mode depending on last letters of the fileNamePatternStr . Patterns ending
 * with . gz imply GZIP compression , endings with ' . zip ' imply ZIP compression .
 * Otherwise and by default , there is no compression . */
protected void determineCompressionMode ( ) { } }

implementation: if ( fileNamePatternStr . endsWith ( ".gz" ) ) { addInfo ( "Will use gz compression" ) ; compressionMode = CompressionMode . GZ ; } else if ( fileNamePatternStr . endsWith ( ".zip" ) ) { addInfo ( "Will use zip compression" ) ; compressionMode = CompressionMode . ZIP ; } else { addInfo ( "No compression will be used" ) ; compressionMode = CompressionMode . NONE ; }


signature:
public class GenericConfigurator { /** * Configures logback with the configuration XML read from a file ,
 * located at the given URL
 * @ param url URL to the file , containing the configuration XML
 * @ throws JoranException configuration error occurred */
public final void doConfigure ( URL url ) throws JoranException { } }

implementation:
InputStream in = null ; try { informContextOfURLUsedForConfiguration ( getContext ( ) , url ) ; URLConnection urlConnection = url . openConnection ( ) ; // per http : / / jira . qos . ch / browse / LBCORE - 105
// per http : / / jira . qos . ch / browse / LBCORE - 127
urlConnection . setUseCaches ( false ) ; // this closes the stream for us
in = urlConnection . getInputStream ( ) ; doConfigure ( in , url . toExternalForm ( ) ) ; } catch ( IOException ioe ) { String errMsg = "Could not open URL [" + url + "]." ; addError ( errMsg , ioe ) ; throw new JoranException ( errMsg , ioe ) ; } finally { CloseUtil . closeQuietly ( in ) ; }


signature:
public class GenericConfigurator { /** * Configures logback with the configuration XML read from a given file
 * @ param file the file , containing the configuration XML
 * @ throws JoranException configuration error occurred */
public final void doConfigure ( File file ) throws JoranException { } }

implementation:
FileInputStream fis = null ; try { URL url = file . toURI ( ) . toURL ( ) ; informContextOfURLUsedForConfiguration ( getContext ( ) , url ) ; fis = new FileInputStream ( file ) ; // this closes the stream for us
doConfigure ( fis , url . toExternalForm ( ) ) ; } catch ( IOException ioe ) { String errMsg = "Could not open [" + file . getPath ( ) + "]." ; addError ( errMsg , ioe ) ; throw new JoranException ( errMsg , ioe ) ; } finally { CloseUtil . closeQuietly ( fis ) ; }


signature:
public class GenericConfigurator { /** * Configures logback with the configuraiton XML read from an input stream ,
 * and then closes the stream
 * @ param inputStream stream to contents of configuration XML
 * @ throws JoranException configuration error occurred */
public final void doConfigure ( InputStream inputStream ) throws JoranException { } }

implementation: try { doConfigure ( new InputSource ( inputStream ) ) ; } finally { try { inputStream . close ( ) ; } catch ( IOException ioe ) { String errMsg = "Could not close the stream" ; addError ( errMsg , ioe ) ; throw new JoranException ( errMsg , ioe ) ; } }


signature:
public class GenericConfigurator { /** * Builds a generic configuration - XML interpreter */
protected void buildInterpreter ( ) { } }

implementation: RuleStore rs = new SimpleRuleStore ( context ) ; addInstanceRules ( rs ) ; this . interpreter = new Interpreter ( context , rs , initialElementPath ( ) ) ; InterpretationContext interpretationContext = interpreter . getInterpretationContext ( ) ; interpretationContext . setContext ( context ) ; addImplicitRules ( interpreter ) ; addDefaultNestedComponentRegistryRules ( interpretationContext . getDefaultNestedComponentRegistry ( ) ) ;


signature:
public class GenericConfigurator { /** * Configures logback with the configuration XML read from an input source .
 * @ param inputSource the input source , containing the configuration XML
 * @ throws JoranException */
private final void doConfigure ( final InputSource inputSource ) throws JoranException { } }

implementation:
long threshold = System . currentTimeMillis ( ) ; // if ( ! ConfigurationWatchListUtil . wasConfigurationWatchListReset ( context ) ) {
// informContextOfURLUsedForConfiguration ( getContext ( ) , null ) ;
SaxEventRecorder recorder = new SaxEventRecorder ( context ) ; recorder . recordEvents ( inputSource ) ; doConfigure ( recorder . getSaxEventList ( ) ) ; // no exceptions a this level
StatusUtil statusUtil = new StatusUtil ( context ) ; if ( statusUtil . noXMLParsingErrorsOccurred ( threshold ) ) { addInfo ( "Registering current configuration as safe fallback point" ) ; registerSafeConfiguration ( recorder . getSaxEventList ( ) ) ; }


signature:
public class GenericConfigurator { /** * Configures logback with SAX events of configuration XML
 * @ param eventList list of SAX events
 * @ throws JoranException configuration error occurred */
public void doConfigure ( final List < SaxEvent > eventList ) throws JoranException { } }

implementation:
buildInterpreter ( ) ; // disallow simultaneous configurations of the same context
synchronized ( context . getConfigurationLock ( ) ) { interpreter . getEventPlayer ( ) . play ( eventList ) ; }


signature:
public class ContextBase { /** * Given a key , return the corresponding property value . If invoked with
 * the special key " CONTEXT _ NAME " , the name of the context is returned .
 * @ param key the property ' s key
 * @ return the string value associated with the key */
public String getProperty ( String key ) { } }

implementation: if ( CONTEXT_NAME_KEY . equals ( key ) ) return getName ( ) ; return ( String ) this . propertyMap . get ( key ) ;


signature:
public class ContextBase { /** * The context name can be set only if it is not already set , or if the
 * current name is the default context name , namely " default " , or if the
 * current name and the old name are the same .
 * @ throws IllegalStateException if the context already has a name , other than " default " . */
public void setName ( String name ) throws IllegalStateException { } }

implementation:
if ( name != null && name . equals ( this . name ) ) { return ; // idempotent naming
} if ( this . name == null || CoreConstants . DEFAULT_CONTEXT_NAME . equals ( this . name ) ) { this . name = name ; } else { throw new IllegalStateException ( "Context has been already given a name" ) ; }


signature:
public class StatusUtil { /** * Returns true if the StatusManager associated with the context passed
 * as parameter has one or more StatusListener instances registered . Returns
 * false otherwise .
 * @ param context
 * @ return true if one or more StatusListeners registered , false otherwise
 * @ since 1.0.8 */
static public boolean contextHasStatusListener ( Context context ) { } }

implementation: StatusManager sm = context . getStatusManager ( ) ; if ( sm == null ) return false ; List < StatusListener > listeners = sm . getCopyOfStatusListenerList ( ) ; if ( listeners == null || listeners . size ( ) == 0 ) return false ; else return true ;


signature:
public class StatusUtil { /** * Return the time of last reset . - 1 if last reset time could not be found
 * @ return time of last reset or - 1 */
public long timeOfLastReset ( ) { } }

implementation: List < Status > statusList = sm . getCopyOfStatusList ( ) ; if ( statusList == null ) return - 1 ; int len = statusList . size ( ) ; for ( int i = len - 1 ; i >= 0 ; i -- ) { Status s = statusList . get ( i ) ; if ( CoreConstants . RESET_MSG_PREFIX . equals ( s . getMessage ( ) ) ) { return s . getDate ( ) ; } } return - 1 ;


signature:
public class CyclicBuffer { /** * Add an < code > event < / code > as the last event in the buffer .
 * @ param event the log event */
public void add ( E event ) { } }

implementation: ea [ last ] = event ; if ( ++ last == maxSize ) last = 0 ; if ( numElems < maxSize ) numElems ++ ; else if ( ++ first == maxSize ) first = 0 ;


signature:
public class CyclicBuffer { /** * Get the < i > i < / i > th oldest event currently in the buffer . If < em > i < / em >
 * is outside the range 0 to the number of elements currently in the buffer ,
 * then < code > null < / code > is returned .
 * @ param i the index of the oldest event to fetch
 * @ return the event */
public E get ( int i ) { } }

implementation: if ( i < 0 || i >= numElems ) return null ; return ea [ ( first + i ) % maxSize ] ;


signature:
public class CyclicBuffer { /** * Get the oldest ( first ) element in the buffer . The oldest element is removed
 * from the buffer .
 * @ return the element */
public E get ( ) { } }

implementation: E r = null ; if ( numElems > 0 ) { numElems -- ; r = ea [ first ] ; ea [ first ] = null ; if ( ++ first == maxSize ) first = 0 ; } return r ;


signature:
public class CyclicBuffer { /** * Resize the cyclic buffer to < code > newSize < / code > .
 * @ param newSize the desired size
 * @ throws IllegalArgumentException
 * if < code > newSize < / code > is negative . */
@ SuppressWarnings ( "unchecked" ) public void resize ( int newSize ) { } }

implementation:
if ( newSize < 0 ) { throw new IllegalArgumentException ( "Negative array size [" + newSize + "] not allowed." ) ; } if ( newSize == numElems ) return ; // nothing to do
E [ ] temp = ( E [ ] ) new Object [ newSize ] ; int loopLen = newSize < numElems ? newSize : numElems ; for ( int i = 0 ; i < loopLen ; i ++ ) { temp [ i ] = ea [ first ] ; ea [ first ] = null ; if ( ++ first == numElems ) first = 0 ; } ea = temp ; first = 0 ; numElems = loopLen ; maxSize = newSize ; if ( loopLen == newSize ) { last = 0 ; } else { last = loopLen ; }


signature:
public class RemoteReceiverServerListener { /** * { @ inheritDoc } */
@ Override protected RemoteReceiverClient createClient ( String id , Socket socket ) throws IOException { } }

implementation: return new RemoteReceiverStreamClient ( id , socket ) ;


signature:
public class ConfigurableSSLSocketFactory { /** * { @ inheritDoc } */
@ Override public Socket createSocket ( InetAddress address , int port , InetAddress localAddress , int localPort ) throws IOException { } }

implementation: SSLSocket socket = ( SSLSocket ) delegate . createSocket ( address , port , localAddress , localPort ) ; parameters . configure ( new SSLConfigurableSocket ( socket ) ) ; return socket ;


signature:
public class ConfigurableSSLSocketFactory { /** * { @ inheritDoc } */
@ Override public Socket createSocket ( InetAddress host , int port ) throws IOException { } }

implementation: SSLSocket socket = ( SSLSocket ) delegate . createSocket ( host , port ) ; parameters . configure ( new SSLConfigurableSocket ( socket ) ) ; return socket ;


signature: public class ConfigurationWatchListUtil { public static ConfigurationWatchList getConfigurationWatchList ( Context context ) { } }

implementation: if ( context == null ) return null ; return ( ConfigurationWatchList ) context . getObject ( CoreConstants . CONFIGURATION_WATCH_LIST ) ;


signature:
public class HTMLLayoutBase { /** * Parses the pattern and creates the Converter linked list . */
@ Override public void start ( ) { } }

implementation: int errorCount = 0 ; try { Parser < E > p = new Parser < E > ( pattern ) ; p . setContext ( getContext ( ) ) ; Node t = p . parse ( ) ; this . head = p . compile ( t , getEffectiveConverterMap ( ) ) ; ConverterUtil . startConverters ( this . head ) ; } catch ( ScanException ex ) { addError ( "Incorrect pattern found" , ex ) ; errorCount ++ ; } if ( errorCount == 0 ) { super . started = true ; }


signature:
public class HTMLLayoutBase { /** * Returns a map where the default converter map is merged with the map
 * contained in the context .
 * @ return the converter map */
public Map < String , String > getEffectiveConverterMap ( ) { } }

implementation:
Map < String , String > effectiveMap = new HashMap < String , String > ( ) ; // add the least specific map fist
Map < String , String > defaultMap = getDefaultConverterMap ( ) ; if ( defaultMap != null ) { effectiveMap . putAll ( defaultMap ) ; } // contextMap is more specific than the default map
Context context = getContext ( ) ; if ( context != null ) { @ SuppressWarnings ( "unchecked" ) Map < String , String > contextMap = ( Map < String , String > ) context . getObject ( CoreConstants . PATTERN_RULE_REGISTRY ) ; if ( contextMap != null ) { effectiveMap . putAll ( contextMap ) ; } } return effectiveMap ;


signature:
public class HTMLLayoutBase { /** * Returns appropriate HTML headers .
 * @ return the headers */
@ Override public String getFileHeader ( ) { } }

implementation: StringBuilder sbuf = new StringBuilder ( ) ; sbuf . append ( "<!DOCTYPE html PUBLIC \"-//W3C//DTD XHTML 1.0 Strict//EN\"" ) ; sbuf . append ( " \"http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd\">" ) ; sbuf . append ( LINE_SEPARATOR ) ; sbuf . append ( "<html>" ) ; sbuf . append ( LINE_SEPARATOR ) ; sbuf . append ( "  <head>" ) ; sbuf . append ( LINE_SEPARATOR ) ; sbuf . append ( "    <title>" ) ; sbuf . append ( title ) ; sbuf . append ( "</title>" ) ; sbuf . append ( LINE_SEPARATOR ) ; cssBuilder . addCss ( sbuf ) ; sbuf . append ( LINE_SEPARATOR ) ; sbuf . append ( "  </head>" ) ; sbuf . append ( LINE_SEPARATOR ) ; sbuf . append ( "<body>" ) ; sbuf . append ( LINE_SEPARATOR ) ; return sbuf . toString ( ) ;


signature:
public class HTMLLayoutBase { /** * Returns the appropriate HTML footers . */
@ Override public String getFileFooter ( ) { } }

implementation: StringBuilder sbuf = new StringBuilder ( ) ; sbuf . append ( LINE_SEPARATOR ) ; sbuf . append ( "" ) ; return sbuf . toString ( ) ;


signature:
public class AppenderAction { /** * Instantiates an appender of the given class and sets its name .
 * The appender thus generated is placed in the { @ link InterpretationContext } ' s
 * appender bag . */
@ SuppressWarnings ( "unchecked" ) public void begin ( InterpretationContext ec , String localName , Attributes attributes ) throws ActionException { } }

implementation:
// We are just beginning , reset variables
appender = null ; inError = false ; String className = attributes . getValue ( CLASS_ATTRIBUTE ) ; if ( OptionHelper . isEmpty ( className ) ) { addError ( "Missing class name for appender. Near [" + localName + "] line " + getLineNumber ( ec ) ) ; inError = true ; return ; } try { addInfo ( "About to instantiate appender of type [" + className + "]" ) ; warnDeprecated ( className ) ; appender = ( Appender < E > ) OptionHelper . instantiateByClassName ( className , ch . qos . logback . core . Appender . class , context ) ; appender . setContext ( context ) ; String appenderName = ec . subst ( attributes . getValue ( NAME_ATTRIBUTE ) ) ; if ( OptionHelper . isEmpty ( appenderName ) ) { addWarn ( "No appender name given for appender of type " + className + "]." ) ; } else { appender . setName ( appenderName ) ; addInfo ( "Naming appender as [" + appenderName + "]" ) ; } // The execution context contains a bag which contains the appenders
// created thus far .
HashMap < String , Appender < E > > appenderBag = ( HashMap < String , Appender < E > > ) ec . getObjectMap ( ) . get ( ActionConst . APPENDER_BAG ) ; // add the appender just created to the appender bag .
appenderBag . put ( appenderName , appender ) ; ec . pushObject ( appender ) ; } catch ( Exception oops ) { inError = true ; addError ( "Could not create an Appender of type [" + className + "]." , oops ) ; throw new ActionException ( oops ) ; }


signature:
public class AppenderAction { /** * Once the children elements are also parsed , now is the time to activate the
 * appender options . */
public void end ( InterpretationContext ec , String name ) { } }

implementation: if ( inError ) { return ; } if ( appender instanceof LifeCycle ) { ( ( LifeCycle ) appender ) . start ( ) ; } Object o = ec . peekObject ( ) ; if ( o != appender ) { addWarn ( "The object at the of the stack is not the appender named [" + appender . getName ( ) + "] pushed earlier." ) ; } else { ec . popObject ( ) ; }


signature:
public class DefaultInvocationGate { /** * ( non - Javadoc )
 * @ see ch . qos . logback . core . util . InvocationGate # skipFurtherWork ( ) */
@ Override final public boolean isTooSoon ( long currentTime ) { } }

implementation: boolean maskMatch = ( ( invocationCounter ++ ) & mask ) == mask ; if ( maskMatch ) { if ( currentTime < this . lowerLimitForMaskMatch ) { increaseMask ( ) ; } updateLimits ( currentTime ) ; } else { if ( currentTime > this . upperLimitForNoMaskMatch ) { decreaseMask ( ) ; updateLimits ( currentTime ) ; return false ; } } return ! maskMatch ;


signature:
public class ConcurrentServerRunner { /** * { @ inheritDoc } */
public void stop ( ) throws IOException { } }

implementation: listener . close ( ) ; accept ( new ClientVisitor < T > ( ) { public void visit ( T client ) { client . close ( ) ; } } ) ;


signature:
public class ConcurrentServerRunner { /** * { @ inheritDoc } */
public void accept ( ClientVisitor < T > visitor ) { } }

implementation: Collection < T > clients = copyClients ( ) ; for ( T client : clients ) { try { visitor . visit ( client ) ; } catch ( RuntimeException ex ) { addError ( client + ": " + ex ) ; } }


signature:
public class ConcurrentServerRunner { /** * Creates a copy of the collection of all clients that are presently
 * being tracked by the server .
 * @ return collection of client objects */
private Collection < T > copyClients ( ) { } }

implementation: clientsLock . lock ( ) ; try { Collection < T > copy = new ArrayList < T > ( clients ) ; return copy ; } finally { clientsLock . unlock ( ) ; }


signature:
public class ConcurrentServerRunner { /** * { @ inheritDoc } */
public void run ( ) { } }

implementation:
setRunning ( true ) ; try { addInfo ( "listening on " + listener ) ; while ( ! Thread . currentThread ( ) . isInterrupted ( ) ) { T client = listener . acceptClient ( ) ; if ( ! configureClient ( client ) ) { addError ( client + ": connection dropped" ) ; client . close ( ) ; continue ; } try { executor . execute ( new ClientWrapper ( client ) ) ; } catch ( RejectedExecutionException ex ) { addError ( client + ": connection dropped" ) ; client . close ( ) ; } } } catch ( InterruptedException ex ) { assert true ; // ok . . . we ' ll shut down
} catch ( Exception ex ) { addError ( "listener: " + ex ) ; } setRunning ( false ) ; addInfo ( "shutting down" ) ; listener . close ( ) ;


signature:
public class ConcurrentServerRunner { /** * Adds a client to the collection of those being tracked by the server .
 * @ param client the client to add */
private void addClient ( T client ) { } }

implementation: clientsLock . lock ( ) ; try { clients . add ( client ) ; } finally { clientsLock . unlock ( ) ; }


signature:
public class ConcurrentServerRunner { /** * Removes a client from the collection of those being tracked by the server .
 * @ param client the client to remote */
private void removeClient ( T client ) { } }

implementation: clientsLock . lock ( ) ; try { clients . remove ( client ) ; } finally { clientsLock . unlock ( ) ; }


signature:
public class LogbackMDCAdapter { /** * Put a context value ( the < code > val < / code > parameter ) as identified with the
 * < code > key < / code > parameter into the current thread ' s context map . Note that
 * contrary to log4j , the < code > val < / code > parameter can be null .
 * If the current thread does not have a context map it is created as a side
 * effect of this call .
 * @ throws IllegalArgumentException in case the " key " parameter is null */
public void put ( String key , String val ) throws IllegalArgumentException { } }

implementation: if ( key == null ) { throw new IllegalArgumentException ( "key cannot be null" ) ; } Map < String , String > oldMap = copyOnThreadLocal . get ( ) ; Integer lastOp = getAndSetLastOperation ( WRITE_OPERATION ) ; if ( wasLastOpReadOrNull ( lastOp ) || oldMap == null ) { Map < String , String > newMap = duplicateAndInsertNewMap ( oldMap ) ; newMap . put ( key , val ) ; } else { oldMap . put ( key , val ) ; }


signature:
public class LogbackMDCAdapter { /** * Remove the the context identified by the < code > key < / code > parameter . */
public void remove ( String key ) { } }

implementation: if ( key == null ) { return ; } Map < String , String > oldMap = copyOnThreadLocal . get ( ) ; if ( oldMap == null ) return ; Integer lastOp = getAndSetLastOperation ( WRITE_OPERATION ) ; if ( wasLastOpReadOrNull ( lastOp ) ) { Map < String , String > newMap = duplicateAndInsertNewMap ( oldMap ) ; newMap . remove ( key ) ; } else { oldMap . remove ( key ) ; }


signature:
public class LogbackMDCAdapter { /** * Get the context identified by the < code > key < / code > parameter . */
public String get ( String key ) { } }

implementation: final Map < String , String > map = copyOnThreadLocal . get ( ) ; if ( ( map != null ) && ( key != null ) ) { return map . get ( key ) ; } else { return null ; }


signature:
public class LogbackMDCAdapter { /** * Returns the keys in the MDC as a { @ link Set } . The returned value can be
 * null . */
public Set < String > getKeys ( ) { } }

implementation: Map < String , String > map = getPropertyMap ( ) ; if ( map != null ) { return map . keySet ( ) ; } else { return null ; }


signature:
public class LogbackMDCAdapter { /** * Return a copy of the current thread ' s context map . Returned value may be
 * null . */
public Map < String , String > getCopyOfContextMap ( ) { } }

implementation: Map < String , String > hashMap = copyOnThreadLocal . get ( ) ; if ( hashMap == null ) { return null ; } else { return new HashMap < String , String > ( hashMap ) ; }


signature:
public class StringToObjectConverter { /** * Convert < code > val < / code > a String parameter to an object of a given type .
 * @ param ca context
 * @ param val string representation of value
 * @ param type target class to convert val into
 * @ return the object created from the string */
@ SuppressWarnings ( "unchecked" ) public static Object convertArg ( ContextAware ca , String val , Class < ? > type ) { } }

implementation: if ( val == null ) { return null ; } String v = val . trim ( ) ; if ( String . class . isAssignableFrom ( type ) ) { return v ; } else if ( Integer . TYPE . isAssignableFrom ( type ) ) { return Integer . valueOf ( v ) ; } else if ( Long . TYPE . isAssignableFrom ( type ) ) { return Long . valueOf ( v ) ; } else if ( Float . TYPE . isAssignableFrom ( type ) ) { return Float . valueOf ( v ) ; } else if ( Double . TYPE . isAssignableFrom ( type ) ) { return Double . valueOf ( v ) ; } else if ( Boolean . TYPE . isAssignableFrom ( type ) ) { if ( "true" . equalsIgnoreCase ( v ) ) { return Boolean . TRUE ; } else if ( "false" . equalsIgnoreCase ( v ) ) { return Boolean . FALSE ; } } else if ( type . isEnum ( ) ) { return convertToEnum ( ca , v , ( Class < ? extends Enum < ? > > ) type ) ; } else if ( StringToObjectConverter . followsTheValueOfConvention ( type ) ) { return convertByValueOfMethod ( ca , type , v ) ; } else if ( isOfTypeCharset ( type ) ) { return convertToCharset ( ca , val ) ; } return null ;


signature:
public class StringToObjectConverter { /** * returned value may be null and in most cases it is null . */
public static Method getValueOfMethod ( Class < ? > type ) { } }

implementation: try { return type . getMethod ( CoreConstants . VALUE_OF , STING_CLASS_PARAMETER ) ; } catch ( NoSuchMethodException e ) { return null ; } catch ( SecurityException e ) { return null ; }


signature:
public class TurboFilterList { /** * Loop through the filters in the chain . As soon as a filter decides on
 * ACCEPT or DENY , then that value is returned . If all of the filters return
 * NEUTRAL , then NEUTRAL is returned . */
public FilterReply getTurboFilterChainDecision ( final Marker marker , final Logger logger , final Level level , final String format , final Object [ ] params , final Throwable t ) { } }

implementation:
final int size = size ( ) ; // if ( size = = 0 ) {
// return FilterReply . NEUTRAL ;
if ( size == 1 ) { try { TurboFilter tf = get ( 0 ) ; return tf . decide ( marker , logger , level , format , params , t ) ; } catch ( IndexOutOfBoundsException iobe ) { return FilterReply . NEUTRAL ; } } Object [ ] tfa = toArray ( ) ; final int len = tfa . length ; for ( int i = 0 ; i < len ; i ++ ) { // for ( TurboFilter tf : this ) {
final TurboFilter tf = ( TurboFilter ) tfa [ i ] ; final FilterReply r = tf . decide ( marker , logger , level , format , params , t ) ; if ( r == FilterReply . DENY || r == FilterReply . ACCEPT ) { return r ; } } return FilterReply . NEUTRAL ;


signature:
public class RemoteAppenderServerListener { /** * { @ inheritDoc } */
@ Override protected RemoteAppenderClient createClient ( String id , Socket socket ) throws IOException { } }

implementation: return new RemoteAppenderStreamClient ( id , socket ) ;


signature:
public class SimpleRuleStore { /** * Add a new rule , i . e . a pattern , action pair to the rule store . < p > Note
 * that the added action ' s LoggerRepository will be set in the process . */
public void addRule ( ElementSelector elementSelector , Action action ) { } }

implementation: action . setContext ( context ) ; List < Action > a4p = rules . get ( elementSelector ) ; if ( a4p == null ) { a4p = new ArrayList < Action > ( ) ; rules . put ( elementSelector , a4p ) ; } a4p . add ( action ) ;


signature:
public class SimpleRuleStore { /** * match for x / y / * has higher priority than matches for x / * */
public List < Action > matchActions ( ElementPath elementPath ) { } }

implementation: List < Action > actionList ; if ( ( actionList = fullPathMatch ( elementPath ) ) != null ) { return actionList ; } else if ( ( actionList = suffixMatch ( elementPath ) ) != null ) { return actionList ; } else if ( ( actionList = prefixMatch ( elementPath ) ) != null ) { return actionList ; } else if ( ( actionList = middleMatch ( elementPath ) ) != null ) { return actionList ; } else { return null ; }


signature:
public class SimpleRuleStore { /** * Suffix matches are matches of type */
x / y * / List < Action > suffixMatch ( ElementPath elementPath ) { } }

implementation: int max = 0 ; ElementSelector longestMatchingElementSelector = null ; for ( ElementSelector selector : rules . keySet ( ) ) { if ( isSuffixPattern ( selector ) ) { int r = selector . getTailMatchLength ( elementPath ) ; if ( r > max ) { max = r ; longestMatchingElementSelector = selector ; } } } if ( longestMatchingElementSelector != null ) { return rules . get ( longestMatchingElementSelector ) ; } else { return null ; }


signature:
public class EnvUtil { /** * Heuristically determines whether the current OS is Android */
static public boolean isAndroidOS ( ) { } }

implementation: String osname = OptionHelper . getSystemProperty ( "os.name" ) ; String root = OptionHelper . getEnv ( "ANDROID_ROOT" ) ; String data = OptionHelper . getEnv ( "ANDROID_DATA" ) ; return osname != null && osname . contains ( "Linux" ) && root != null && root . contains ( "/system" ) && data != null && data . contains ( "/data" ) ;


signature:
public class StaticLoggerBinder { /** * Package access for testing purposes . */
void init ( ) { } }

implementation:
try { try { new ContextInitializer ( defaultLoggerContext ) . autoConfig ( ) ; } catch ( JoranException je ) { Util . report ( "Failed to auto configure default logger context" , je ) ; } // logback - 292
if ( ! StatusUtil . contextHasStatusListener ( defaultLoggerContext ) ) { StatusPrinter . printInCaseOfErrorsOrWarnings ( defaultLoggerContext ) ; } contextSelectorBinder . init ( defaultLoggerContext , KEY ) ; initialized = true ; } catch ( Exception t ) { // see LOGBACK - 1159
Util . report ( "Failed to instantiate [" + LoggerContext . class . getName ( ) + "]" , t ) ; }


signature:
public class FileFilterUtil { /** * Return the set of files matching the stemRegex as found in ' directory ' . A
 * stemRegex does not contain any slash characters or any folder separators .
 * @ param file folder ' s file object
 * @ param stemRegex regex file pattern to match
 * @ return matching files */
public static File [ ] filesInFolderMatchingStemRegex ( File file , final String stemRegex ) { } }

implementation: if ( file == null ) { return new File [ 0 ] ; } if ( ! file . exists ( ) || ! file . isDirectory ( ) ) { return new File [ 0 ] ; } return file . listFiles ( new FilenameFilter ( ) { public boolean accept ( File dir , String name ) { return name . matches ( stemRegex ) ; } } ) ;


signature:
public class ReceiverBase { /** * { @ inheritDoc } */
public final void start ( ) { } }

implementation: if ( isStarted ( ) ) return ; if ( getContext ( ) == null ) { throw new IllegalStateException ( "context not set" ) ; } if ( shouldStart ( ) ) { getContext ( ) . getScheduledExecutorService ( ) . execute ( getRunnableTask ( ) ) ; started = true ; }


signature:
public class ReceiverBase { /** * { @ inheritDoc } */
public final void stop ( ) { } }

implementation: if ( ! isStarted ( ) ) return ; try { onStop ( ) ; } catch ( RuntimeException ex ) { addError ( "on stop: " + ex , ex ) ; } started = false ;