signature:
public class WebDavClient { /** * ( non - Javadoc )
 * @ see org . guvnor . tools . utils . webdav . IWebDavClient # deleteResource ( java . lang . String ) */
public void deleteResource ( String resource ) throws Exception { } }

implementation: IResponse response = null ; try { ILocator locator = WebDAVFactory . locatorFactory . newLocator ( resource ) ; response = client . delete ( locator , createContext ( ) ) ; if ( response . getStatusCode ( ) != IResponse . SC_NO_CONTENT && response . getStatusCode ( ) != IResponse . SC_OK ) { throw new WebDavException ( response ) ; } } finally { if ( response != null ) { response . close ( ) ; } }


signature:
public class DeleteAction { /** * ( non - Javadoc )
 * @ see org . eclipse . ui . IActionDelegate # run ( org . eclipse . jface . action . IAction ) */
@ SuppressWarnings ( "unchecked" ) public void run ( IAction action ) { } }

implementation:
if ( selectedItems == null ) { return ; } String msg = null ; if ( selectedItems . size ( ) == 1 ) { msg = MessageFormat . format ( Messages . getString ( "delete.singlefile.confirmation" ) , // $ NON - NLS - 1 $
new Object [ ] { ( ( IFile ) selectedItems . getFirstElement ( ) ) . getName ( ) } ) ; } else { msg = MessageFormat . format ( Messages . getString ( "delete.multifile.confirmation" ) , // $ NON - NLS - 1 $
new Object [ ] { String . valueOf ( selectedItems . size ( ) ) } ) ; } if ( ! MessageDialog . openConfirm ( targetPart . getSite ( ) . getShell ( ) , Messages . getString ( "delete.confirmation.dialog.caption" ) , msg ) ) { // $ NON - NLS - 1 $
return ; } for ( Iterator it = selectedItems . iterator ( ) ; it . hasNext ( ) ; ) { Object oneItem = it . next ( ) ; if ( oneItem instanceof IFile ) { processDelete ( ( IFile ) oneItem ) ; } } DisconnectAction dsAction = new DisconnectAction ( ) ; dsAction . disconnect ( selectedItems ) ; PlatformUtils . updateDecoration ( ) ; PlatformUtils . refreshRepositoryView ( ) ;


signature:
public class CollectionHandle { /** * Create a new version - controlled configuration on the given baseline .
 * @ throws DAVException if the baseline control operation failed .
 * @ see IServer # baselineControl ( Locator , Context , Document ) */
public void baselineControl ( ILocator baseline ) throws DAVException { } }

implementation:
Assert . isNotNull ( baseline ) ; // Build the document body to describe the baseline control element .
Document document = newDocument ( ) ; Element root = ElementEditor . create ( document , "baseline-control" ) ; // $ NON - NLS - 1 $
ElementEditor . addChild ( root , "baseline" , // $ NON - NLS - 1 $
baseline . getResourceURL ( ) , new String [ ] { "baseline" } , // $ NON - NLS - 1 $
true ) ; // Send the baseline control method to the server and check the response .
IResponse response = null ; try { response = davClient . baselineControl ( locator , newContext ( ) , document ) ; examineResponse ( response ) ; } catch ( IOException e ) { throw new SystemException ( e ) ; } finally { closeResponse ( response ) ; }


signature:
public class CollectionHandle { /** * Binds the given member in this collection to the resource identified
 * by the given source locator . If the member already exists , or is
 * already bound to a resource , it is not replaced .
 * @ param member a member in this collection
 * @ param source the location of a resource
 * @ throws DAVException if the binding could not be created
 * @ see # bind ( String , Locator , boolean )
 * @ see IServer # bind ( Locator , Locator , Context ) */
public void bind ( String member , ILocator source ) throws DAVException { } }

implementation: bind ( member , source , false ) ;


signature:
public class CollectionHandle { /** * Binds the given member in this collection to the resource identified
 * by the given source locator . If overwrite is < code > false < / code > and
 * such a member already exists , or such a member is already bound to a
 * resource , it is not replaced . Otherwise , if overwrite is
 * < code > true < / code > and such a member already exists , or such a member
 * is already bound to a resource , it is replaced .
 * @ param member a member in this collection
 * @ param source the location of a resource
 * @ param overwrite a boolean indicating whether or not any existing
 * resource or binding is replaced
 * @ throws DAVException if the binding could not be created
 * @ see # bind ( String , Locator , boolean )
 * @ see IServer # bind ( Locator , Locator , Context ) */
public void bind ( String member , ILocator source , boolean overwrite ) throws DAVException { } }

implementation: IContext context = newContext ( ) ; context . setOverwrite ( overwrite ) ; ILocator destination = getMember ( member ) ; IResponse response = null ; try { response = davClient . bind ( source , destination , context ) ; examineResponse ( response ) ; } catch ( IOException e ) { throw new SystemException ( e ) ; } finally { closeResponse ( response ) ; }


signature:
public class CollectionHandle { /** * Return the locator of the member of this collection , with the given
 * name . Does NOT perform a call to the server to check the existence
 * of the member .
 * @ param memberName the name of the receiver ' s internal member .
 * @ return the Locator for the member . */
public ILocator getMember ( String memberName ) { } }

implementation:
Assert . isTrue ( locator . getLabel ( ) == null ) ; Assert . isTrue ( ! locator . isStable ( ) ) ; String parentName = locator . getResourceURL ( ) ; String childName ; if ( parentName . endsWith ( "/" ) ) // $ NON - NLS - 1 $
childName = parentName + memberName ; else childName = parentName + "/" + memberName ; // $ NON - NLS - 1 $
return davClient . getDAVFactory ( ) . newLocator ( childName ) ;


signature:
public class CollectionHandle { /** * Return a set of handles representing the members of this
 * collection .
 * Each member of the set will be typed to be a < code > ResourceHandle < / code >
 * or a < code > CollectionHandle < / code > depending upon whether it implements
 * collection semantics . Note that workspaces will be returned as
 * regular collection handles and should be converted to workspace handles
 * if required ( test using isWorkspace ( ) ) . < / p >
 * @ return a < code > Set < / code > of < code > ResourceHandle < / code > and / or < code >
 * CollectionHandle < / code > or an empty set if the receiver has no members .
 * @ exception DAVException if there was a problem getting the members . */
public Set getMembers ( ) throws DAVException { } }

implementation:
// Query the DAV : resource - type property to depth one .
Collection querySet = new Vector ( ) ; querySet . add ( DAV_RESOURCE_TYPE ) ; URLTable resourceTable = getProperties ( querySet , IContext . DEPTH_ONE ) ; // Create a collection for the reply , and remove
// ourselves from the answer .
Set reply = new HashSet ( ) ; try { resourceTable . remove ( locator . getResourceURL ( ) ) ; } catch ( MalformedURLException exception ) { throw new DAVException ( Policy . bind ( "exception.malformedLocator" ) ) ; // $ NON - NLS - 1 $
} // The keys of the result correspond to the receiver ' s internal members .
Enumeration resourceNameEnum = resourceTable . keys ( ) ; while ( resourceNameEnum . hasMoreElements ( ) ) { URL url = ( URL ) resourceNameEnum . nextElement ( ) ; // Get the props for that resource
Hashtable propertyTable = ( Hashtable ) resourceTable . get ( url ) ; Assert . isNotNull ( propertyTable ) ; PropertyStatus propertyStatus = ( PropertyStatus ) propertyTable . get ( DAV_RESOURCE_TYPE ) ; Assert . isNotNull ( propertyStatus ) ; // If we have a DAV : collection element , then create a collection handle ,
// all other resource types are created as regular resource handles .
ILocator newLocator = davClient . getDAVFactory ( ) . newLocator ( url . toString ( ) ) ; Element property = propertyStatus . getProperty ( ) ; try { if ( ElementEditor . hasChild ( property , DAV_COLLECTION_RESOURCE_TYPE ) ) reply . add ( new CollectionHandle ( davClient , newLocator ) ) ; else reply . add ( new ResourceHandle ( davClient , newLocator ) ) ; } catch ( MalformedElementException exception ) { throw new SystemException ( exception ) ; } } // end - while
return reply ;


signature:
public class Row { /** * Optimizing vertices for optimal presentation */
public void optimize ( ) { } }

implementation: final List < BaseVertex > sorted = new ArrayList < BaseVertex > ( this . vertices ) ; Collections . sort ( sorted , new Comparator < BaseVertex > ( ) { public int compare ( final BaseVertex v1 , final BaseVertex v2 ) { int v1OutDegree = v1 . getSourceConnections ( ) . size ( ) ; int v2OutDegree = v2 . getSourceConnections ( ) . size ( ) ; if ( v1OutDegree < v2OutDegree ) { return 1 ; } if ( v1OutDegree > v2OutDegree ) { return - 1 ; } return 0 ; } } ) ; final LinkedList < BaseVertex > optimized = new LinkedList < BaseVertex > ( ) ; boolean front = false ; for ( final Iterator < BaseVertex > vertexIter = sorted . iterator ( ) ; vertexIter . hasNext ( ) ; ) { final BaseVertex vertex = vertexIter . next ( ) ; if ( front ) { optimized . addFirst ( vertex ) ; } else { optimized . addLast ( vertex ) ; } front = ! front ; } this . vertices = optimized ;


signature:
public class AuthorizationAuthority { /** * Authorizes the given request by setting its authorization credentials
 * in the given context . If the given response is not < code > null < / code > ,
 * it is assumed to contain an authenticate challenge that is used to
 * derive the authorization credentials . Returns true if the authorization
 * succeeds , and false otherwise .
 * @ param request the request to authorize
 * @ param response the response containing the authenticate challenge
 * @ param context the context where the authorization credentials are set
 * @ param proxyServerUrl the URL of the proxy server , or < code > null < / code >
 * if there is no proxy server
 * @ param isProxyAuthorization a boolean indicating whether the
 * authorization credentials should be computed for the proxy server or
 * the origin server
 * @ return a boolean indicating whether the request was successfully
 * authorized */
public boolean authorize ( Request request , IResponse response , IContext context , URL proxyServerUrl , boolean isProxyAuthorization ) { } }

implementation:
Assert . isNotNull ( request ) ; Assert . isNotNull ( context ) ; URL serverUrl = null ; URL protectionSpaceUrl = null ; if ( isProxyAuthorization ) { if ( proxyServerUrl == null ) { return false ; } serverUrl = proxyServerUrl ; protectionSpaceUrl = proxyServerUrl ; } else { URL resourceUrl = request . getResourceUrl ( ) ; try { serverUrl = new URL ( resourceUrl . getProtocol ( ) , resourceUrl . getHost ( ) , resourceUrl . getPort ( ) , "/" ) ; // $ NON - NLS - 1 $
} catch ( MalformedURLException e ) { return false ; } protectionSpaceUrl = resourceUrl ; } if ( response != null ) { String challengeString = null ; if ( isProxyAuthorization ) { challengeString = response . getContext ( ) . getProxyAuthenticate ( ) ; } else { challengeString = response . getContext ( ) . getWWWAuthenticate ( ) ; } if ( challengeString == null ) { return false ; } AuthenticateChallenge challenge = null ; try { challenge = new AuthenticateChallenge ( challengeString ) ; } catch ( ParserException e ) { return false ; } String authScheme = challenge . getAuthScheme ( ) ; String realm = challenge . getRealm ( ) ; AuthorizationAuthority authority = getAuthorizationAuthority ( authScheme ) ; if ( authority == null ) { return false ; } Map oldInfo = authenticatorStore . getAuthenticationInfo ( serverUrl , realm , authScheme ) ; Map info = authority . getAuthenticationInfo ( challenge , oldInfo , serverUrl , protectionSpaceUrl ) ; if ( info == null ) { return false ; } authenticatorStore . addAuthenticationInfo ( serverUrl , realm , authScheme , info ) ; authenticatorStore . addProtectionSpace ( protectionSpaceUrl , realm ) ; } String realm = authenticatorStore . getProtectionSpace ( protectionSpaceUrl ) ; if ( realm == null ) { return false ; } Map info = null ; String authScheme = null ; for ( int i = 0 ; i < authenticationSchemes . length ; ++ i ) { authScheme = authenticationSchemes [ i ] ; info = authenticatorStore . getAuthenticationInfo ( serverUrl , realm , authScheme ) ; if ( info != null ) { break ; } } if ( info == null ) { return false ; } AuthorizationAuthority authority = getAuthorizationAuthority ( authScheme ) ; if ( authority == null ) { return false ; } String authorization = authority . getAuthorization ( request , info , serverUrl , protectionSpaceUrl , proxyServerUrl ) ; if ( authorization == null ) { return false ; } if ( isProxyAuthorization ) { if ( authorization . equals ( context . getProxyAuthorization ( ) ) ) return false ; // we already had that auth so it must ' ve failed
context . setProxyAuthorization ( authorization ) ; } else { if ( authorization . equals ( context . getAuthorization ( ) ) ) return false ; // we already had that auth so it must ' ve failed
context . setAuthorization ( authorization ) ; } return true ;


signature:
public class AuthorizationAuthority { /** * Confirms whether the given response is valid by proving the server
 * knows the client ' s authentication secret ( password ) . Moreover , the
 * server may wish to communicate some authentication information in the
 * response for the purposes of authorizing future request .
 * @ param request the request that has already been sent
 * @ param response the response back from the server to be verified
 * @ param proxyServerUrl the URL of the proxy server , or < code > null < / code >
 * if there is none
 * @ returns a boolean indicating whether the given response is valid */
public boolean confirm ( Request request , IResponse response , URL proxyServerUrl ) { } }

implementation:
Assert . isNotNull ( request ) ; Assert . isNotNull ( response ) ; URL resourceUrl = request . getResourceUrl ( ) ; URL serverUrl = null ; try { serverUrl = new URL ( resourceUrl . getProtocol ( ) , resourceUrl . getHost ( ) , resourceUrl . getPort ( ) , "/" ) ; // $ NON - NLS - 1 $
} catch ( MalformedURLException e ) { return false ; } String realm = authenticatorStore . getProtectionSpace ( resourceUrl ) ; if ( realm == null ) { return false ; } Map info = null ; String authScheme = null ; for ( int i = 0 ; i < authenticationSchemes . length ; ++ i ) { authScheme = authenticationSchemes [ i ] ; info = authenticatorStore . getAuthenticationInfo ( serverUrl , realm , authScheme ) ; if ( info != null ) { break ; } } if ( info == null ) { return false ; } AuthorizationAuthority authority = getAuthorizationAuthority ( authScheme ) ; if ( authority == null ) { return false ; } return authority . confirmResponse ( request , response , proxyServerUrl ) ;


signature:
public class AuthorizationAuthority { /** * Confirms whether the given response is valid by proving the server
 * knows the client ' s authentication secret ( password ) . Moreover , the
 * server may wish to communicate some authentication information in the
 * response for the purposes of authorizing future request .
 * < p > This method should be overridden by schema specific authenticators .
 * @ param request the request that has already been sent
 * @ param response the response back from the server to be verified
 * @ param proxyServerUrl the URL of the proxy server , or < code > null < / code >
 * if there is none
 * @ returns a boolean indicating whether the given response is valid */
protected boolean confirmResponse ( Request request , IResponse response , URL proxyServerUrl ) { } }

implementation: Assert . isNotNull ( request ) ; Assert . isNotNull ( response ) ; return false ;


signature:
public class AuthorizationAuthority { /** * Returns the new authentication information gleaned from the given
 * authenticate challenge and the given old authentication information .
 * The old authentication information may be < code > null < / code > .
 * The authentication information usually contains directives such as
 * usernames and passwords .
 * < p > This method should be overridden by schema specific authenticators .
 * @ param challenge the authenticate challenge from the server
 * @ param oldInfo the old authentication information
 * @ param serverUrl the URL of the server
 * @ param protectionSpaceUrl the URL of the protected resource
 * @ return new authentication information */
protected Map getAuthenticationInfo ( AuthenticateChallenge challenge , Map oldInfo , URL serverUrl , URL protectionSpaceUrl ) { } }

implementation: Assert . isNotNull ( challenge ) ; Assert . isNotNull ( serverUrl ) ; Assert . isNotNull ( protectionSpaceUrl ) ; return null ;


signature:
public class AuthorizationAuthority { /** * Returns the authorization credentials for the given request . The
 * authorization credentials are derived from the given authentication
 * info . The authentication info may contain directives such as usernames
 * and passwords .
 * < p > This method should be overridden by schema specific authenticators .
 * @ param request the request being authorized
 * @ param info the authentication information used to derive the
 * authorization credentials
 * @ param serverUrl the URL of the server
 * @ param protectionSpaceUrl the URL of the protected resource
 * @ param proxyServerUrl the URL of the proxy server , or < code > null < / code >
 * if there is none
 * @ return the authorization credentials for the given request */
protected String getAuthorization ( Request request , Map info , URL serverUrl , URL protectionSpaceUrl , URL proxyServerUrl ) { } }

implementation: Assert . isNotNull ( request ) ; Assert . isNotNull ( info ) ; Assert . isNotNull ( serverUrl ) ; Assert . isNotNull ( protectionSpaceUrl ) ; return null ;


signature:
public class AuthorizationAuthority { /** * Returns an authorization authority for the given authentication
 * scheme , or < code > null < / code > if there is no such authority .
 * @ param scheme an authentication scheme , for example : " Basic "
 * @ return an authorization authority for the given authentication scheme */
private AuthorizationAuthority getAuthorizationAuthority ( String scheme ) { } }

implementation:
try { scheme = Character . toUpperCase ( scheme . charAt ( 0 ) ) + scheme . substring ( 1 ) . toLowerCase ( ) ; String packageName = "org.eclipse.webdav.internal.authentication" ; // $ NON - NLS - 1 $
String className = scheme + "Authority" ; // $ NON - NLS - 1 $
Class clazz = Class . forName ( packageName + "." + className ) ; // $ NON - NLS - 1 $
Constructor constructor = clazz . getConstructor ( new Class [ ] { IAuthenticator . class } ) ; return ( AuthorizationAuthority ) constructor . newInstance ( new Object [ ] { authenticatorStore } ) ; } catch ( ClassCastException e ) { // ignore or log ?
} catch ( Exception e ) { // ignore or log ?
} return null ;


signature:
public class AuthorizationAuthority { /** * Computes the MD5 hash value of the given < code > String < / code > and
 * returns the result as a HEX < code > String < / code > .
 * @ param s
 * @ return a HEX < code > String < / code > containing the MD5 hash value of the
 * given < code > String < / code >
 * @ exception NoSuchAlgorithmException
 * @ exception UnsupportedEncodingException */
protected String md5 ( String s ) throws NoSuchAlgorithmException , UnsupportedEncodingException { } }

implementation:
MessageDigest md5 = MessageDigest . getInstance ( "MD5" ) ; // $ NON - NLS - 1 $
byte [ ] hash = md5 . digest ( s . getBytes ( "UTF8" ) ) ; // $ NON - NLS - 1 $
return HexConverter . toHex ( hash ) ;


signature:
public class AuthorizationAuthority { /** * Computes the MD5 hash value of the body of the given request and
 * returns the result as a HEX < code > String < / code > .
 * @ param request
 * @ return a HEX < code > String < / code > containing the MD5 hash value of the
 * body of the given request
 * @ exception NoSuchAlgorithmException
 * @ exception IOException */
protected String md5 ( Request request ) throws NoSuchAlgorithmException , IOException { } }

implementation:
DigestOutputStream dos = new DigestOutputStream ( "MD5" ) ; // $ NON - NLS - 1 $
request . write ( dos ) ; String result = HexConverter . toHex ( dos . digest ( ) ) ; dos . close ( ) ; return result ;


signature:
public class AuthorizationAuthority { /** * Returns the given < code > String < / code > with its quotes removed .
 * @ param s a < code > String < / code >
 * @ return the given < code > String < / code > with its quotes removed */
protected String unquote ( String s ) { } }

implementation:
if ( s . charAt ( 0 ) == '"' && s . charAt ( s . length ( ) - 1 ) == '"' ) // $ NON - NLS - 1 $ / / $ NON - NLS - 2 $
return s . substring ( 1 , s . length ( ) - 1 ) ; return s ;


signature:
public class ConditionFactor { /** * Create a ConditionFactor ( either a StateToken or EntityTag ) by parsing
 * the tokenizer contining an If header value .
 * @ param tokenizer a StreamTokenizer containing the contents of a state token or entity tag
 * from a WebDAV If header
 * @ return the parsed ConditionFactor
 * @ exception WebDAVException thrown if there is a syntax error in the If header */
public static ConditionFactor create ( StreamTokenizer tokenizer ) throws WebDAVException { } }

implementation:
boolean not = false ; ConditionFactor factor = null ; try { int token = tokenizer . ttype ; if ( token == StreamTokenizer . TT_WORD ) { if ( tokenizer . sval . equalsIgnoreCase ( "Not" ) ) { // $ NON - NLS - 1 $
not = true ; } else { throw new WebDAVException ( IResponse . SC_BAD_REQUEST , Policy . bind ( "error.parseMissingNot" ) ) ; // $ NON - NLS - 1 $
} token = tokenizer . nextToken ( ) ; } switch ( token ) { case '<' : factor = StateToken . create ( tokenizer ) ; break ; case '[' : factor = EntityTag . create ( tokenizer ) ; break ; default : throw new WebDAVException ( IResponse . SC_BAD_REQUEST , Policy . bind ( "error.parseMissingOpen" , String . valueOf ( token ) ) ) ; // $ NON - NLS - 1 $
} } catch ( IOException exc ) { // ignore or log ?
} factor . setNot ( not ) ; return factor ;


signature:
public class Kie770Service { /** * Repository */
@ Override public void createRepository ( final IKieRepositoryHandler repository ) throws IOException { } }

implementation: runJob ( "Request to create repository '" + repository . getName ( ) + "'" , new Requester . Action ( ) { @ Override public String execute ( ) throws IOException { return httpPost ( "spaces/" + repository . getParent ( ) . getName ( ) + "/projects/" , repository . getProperties ( ) ) ; } } ) ;


signature:
public class ExportImageDialog { /** * Initializes the controls of this dialog . */
private void initializeControls ( ) { } }

implementation: if ( originalFile != null ) { resourceGroup . setContainerFullPath ( originalFile . getParent ( ) . getFullPath ( ) ) ; String fileName = originalFile . getName ( ) ; int index = fileName . lastIndexOf ( "." ) ; if ( index != - 1 ) { fileName = fileName . substring ( 0 , index ) ; } fileName += "-image.png" ; resourceGroup . setResource ( fileName ) ; } else if ( originalName != null ) { resourceGroup . setResource ( originalName ) ; } setDialogComplete ( validatePage ( ) ) ;


signature:
public class ExportImageDialog { /** * / * ( non - Javadoc )
 * Method declared on Dialog . */
protected void okPressed ( ) { } }

implementation:
// Get new path .
IPath path = resourceGroup . getContainerFullPath ( ) . append ( resourceGroup . getResource ( ) ) ; // If the user does not supply a file extension and if the save
// as dialog was provided a default file name append the extension
// of the default filename to the new name
if ( path . getFileExtension ( ) == null ) { if ( originalFile != null && originalFile . getFileExtension ( ) != null ) { path = path . addFileExtension ( originalFile . getFileExtension ( ) ) ; } else if ( originalName != null ) { int pos = originalName . lastIndexOf ( '.' ) ; if ( ++ pos > 0 && pos < originalName . length ( ) ) { path = path . addFileExtension ( originalName . substring ( pos ) ) ; } } } // If the path already exists then confirm overwrite .
IFile file = ResourcesPlugin . getWorkspace ( ) . getRoot ( ) . getFile ( path ) ; if ( file . exists ( ) ) { String [ ] buttons = new String [ ] { IDialogConstants . YES_LABEL , IDialogConstants . NO_LABEL , IDialogConstants . CANCEL_LABEL } ; String question = NLS . bind ( IDEWorkbenchMessages . SaveAsDialog_overwriteQuestion , path . toString ( ) ) ; MessageDialog d = new MessageDialog ( getShell ( ) , IDEWorkbenchMessages . Question , null , question , MessageDialog . QUESTION , buttons , 0 ) ; int overwrite = d . open ( ) ; switch ( overwrite ) { case 0 : // Yes
break ; case 1 : // No
return ; case 2 : // Cancel
default : cancelPressed ( ) ; return ; } } // Store path and close .
result = path ; close ( ) ;


signature:
public class ExportImageDialog { /** * Returns whether this page ' s visual components all contain valid values .
 * @ return < code > true < / code > if valid , and < code > false < / code > otherwise */
private boolean validatePage ( ) { } }

implementation:
if ( ! resourceGroup . areAllValuesValid ( ) ) { if ( ! resourceGroup . getResource ( ) . equals ( "" ) ) { // $ NON - NLS - 1 $
setErrorMessage ( resourceGroup . getProblemMessage ( ) ) ; } else { setErrorMessage ( null ) ; } return false ; } String resourceName = resourceGroup . getResource ( ) ; IWorkspace workspace = ResourcesPlugin . getWorkspace ( ) ; // Do not allow a closed project to be selected
IPath fullPath = resourceGroup . getContainerFullPath ( ) ; if ( fullPath != null ) { String projectName = fullPath . segment ( 0 ) ; IStatus isValidProjectName = workspace . validateName ( projectName , IResource . PROJECT ) ; if ( isValidProjectName . isOK ( ) ) { IProject project = workspace . getRoot ( ) . getProject ( projectName ) ; if ( ! project . isOpen ( ) ) { setErrorMessage ( IDEWorkbenchMessages . SaveAsDialog_closedProjectMessage ) ; return false ; } } } IStatus result = workspace . validateName ( resourceName , IResource . FILE ) ; if ( ! result . isOK ( ) ) { setErrorMessage ( result . getMessage ( ) ) ; return false ; } setErrorMessage ( null ) ; return true ;


signature:
public class ExportImageDialog { /** * / * ( non - Javadoc )
 * @ see org . eclipse . jface . window . Dialog # getDialogBoundsSettings ( )
 * @ since 3.2 */
protected IDialogSettings getDialogBoundsSettings ( ) { } }

implementation: IDialogSettings settings = IDEWorkbenchPlugin . getDefault ( ) . getDialogSettings ( ) ; IDialogSettings section = settings . getSection ( DIALOG_SETTINGS_SECTION ) ; if ( section == null ) { section = settings . addNewSection ( DIALOG_SETTINGS_SECTION ) ; } return section ;


signature:
public class EntityTag { /** * Create an EntityTag by parsing the given If header as defined by
 * section 3.11 of the HTTP / 1.1 spec .
 * @ param tokenizer a StreamTokenizer on the contents of a WebDAV If header
 * @ return the parsed ConditionFactor ( EntityTag )
 * @ exception WebDAVException thrown if there is a syntax error in the If header */
public static ConditionFactor create ( StreamTokenizer tokenizer ) throws WebDAVException { } }

implementation:
EntityTag entityTag = new EntityTag ( ) ; try { int token = tokenizer . ttype ; if ( token == '[' ) token = tokenizer . nextToken ( ) ; else throw new WebDAVException ( IResponse . SC_BAD_REQUEST , Policy . bind ( "error.parseMissing" , String . valueOf ( token ) , "[" ) ) ; // $ NON - NLS - 1 $ / / $ NON - NLS - 2 $
if ( token == '"' ) { // $ NON - NLS - 1 $
entityTag . setETag ( tokenizer . sval ) ; token = tokenizer . nextToken ( ) ; } else throw new WebDAVException ( IResponse . SC_BAD_REQUEST , Policy . bind ( "error.parseMissingQuotedString" , String . valueOf ( token ) ) ) ; // $ NON - NLS - 1 $
if ( token == ']' ) token = tokenizer . nextToken ( ) ; else throw new WebDAVException ( IResponse . SC_BAD_REQUEST , Policy . bind ( "error.parseMissing" , String . valueOf ( token ) , "]" ) ) ; // $ NON - NLS - 1 $ / / $ NON - NLS - 2 $
} catch ( IOException exc ) { // ignore or log ?
} return entityTag ;


signature:
public class EntityTag { /** * Construct a unique EntityTag . The tag is constructed by concatening the
 * current time with the current thread ' s hash code .
 * @ return a unique entity tag that servers may use for any purpose */
public static EntityTag generateEntityTag ( ) { } }

implementation:
String xx = basetime + ":" + Integer . toHexString ( Thread . currentThread ( ) . hashCode ( ) ) ; // $ NON - NLS - 1 $
bcnt ++ ; xx += ":" + bcnt ; // $ NON - NLS - 1 $
return new EntityTag ( xx ) ;


signature:
public class WorkspaceHandle { /** * Create a new workspace in the location described by this handle .
 * A new workspace is created using a MKWORKSPACE method call . < / p >
 * @ throws DAVException if a problem occured creating the workspace
 * on the WebDAV server . */
public void create ( ) throws DAVException { } }

implementation: Document document = newDocument ( ) ; Mkworkspace . create ( document ) ; IResponse response = null ; try { response = davClient . mkworkspace ( locator , newContext ( ) , document ) ; examineResponse ( response ) ; } catch ( IOException e ) { throw new SystemException ( e ) ; } finally { closeResponse ( response ) ; }


signature:
public class Connection { /** * Gets opposite of specified vertex .
 * Returning < code > null < / code > if specified not does not belong into this connection .
 * @ param vertex
 * @ return opposite of vertex */
public BaseVertex getOpposite ( BaseVertex vertex ) { } }

implementation:
// If null or not part of this connection
if ( vertex == null || ( ! vertex . equals ( getSource ( ) ) && ! vertex . equals ( getTarget ( ) ) ) ) { return null ; } if ( vertex . equals ( getSource ( ) ) ) { return getTarget ( ) ; } return getSource ( ) ;


signature:
public class BCECUtil { /** * 生成ECC密钥对
 * @ return ECC密钥对 */
public static AsymmetricCipherKeyPair generateKeyPairParameter ( ECDomainParameters domainParameters , SecureRandom random ) { } }

implementation: ECKeyGenerationParameters keyGenerationParams = new ECKeyGenerationParameters ( domainParameters , random ) ; ECKeyPairGenerator keyGen = new ECKeyPairGenerator ( ) ; keyGen . init ( keyGenerationParams ) ; return keyGen . generateKeyPair ( ) ;


signature:
public class BCECUtil { /** * 将ECC私钥转换为PKCS8标准的字节流
 * @ param priKey
 * @ param pubKey 可以为空 , 但是如果为空的话得到的结果OpenSSL可能解析不了
 * @ return */
public static byte [ ] convertECPrivateKeyToPKCS8 ( ECPrivateKeyParameters priKey , ECPublicKeyParameters pubKey ) { } }

implementation: ECDomainParameters domainParams = priKey . getParameters ( ) ; ECParameterSpec spec = new ECParameterSpec ( domainParams . getCurve ( ) , domainParams . getG ( ) , domainParams . getN ( ) , domainParams . getH ( ) ) ; BCECPublicKey publicKey = null ; if ( pubKey != null ) { publicKey = new BCECPublicKey ( ALGO_NAME_EC , pubKey , spec , BouncyCastleProvider . CONFIGURATION ) ; } BCECPrivateKey privateKey = new BCECPrivateKey ( ALGO_NAME_EC , priKey , publicKey , spec , BouncyCastleProvider . CONFIGURATION ) ; return privateKey . getEncoded ( ) ;


signature:
public class BCECUtil { /** * 将PKCS8标准的私钥字节流转换为私钥对象
 * @ param pkcs8Key
 * @ return
 * @ throws NoSuchAlgorithmException
 * @ throws NoSuchProviderException
 * @ throws InvalidKeySpecException */
public static BCECPrivateKey convertPKCS8ToECPrivateKey ( byte [ ] pkcs8Key ) throws NoSuchAlgorithmException , NoSuchProviderException , InvalidKeySpecException { } }

implementation: PKCS8EncodedKeySpec peks = new PKCS8EncodedKeySpec ( pkcs8Key ) ; KeyFactory kf = KeyFactory . getInstance ( ALGO_NAME_EC , BouncyCastleProvider . PROVIDER_NAME ) ; return ( BCECPrivateKey ) kf . generatePrivate ( peks ) ;


signature:
public class BCECUtil { /** * 将ECC私钥转换为SEC1标准的字节流
 * openssl d2i _ ECPrivateKey函数要求的DER编码的私钥也是SEC1标准的 ,
 * 这个工具函数的主要目的就是为了能生成一个openssl可以直接 “ 识别 ” 的ECC私钥 .
 * 相对RSA私钥的PKCS1标准 , ECC私钥的标准为SEC1
 * @ param priKey
 * @ param pubKey
 * @ return
 * @ throws IOException */
public static byte [ ] convertECPrivateKeyToSEC1 ( ECPrivateKeyParameters priKey , ECPublicKeyParameters pubKey ) throws IOException { } }

implementation: byte [ ] pkcs8Bytes = convertECPrivateKeyToPKCS8 ( priKey , pubKey ) ; PrivateKeyInfo pki = PrivateKeyInfo . getInstance ( pkcs8Bytes ) ; ASN1Encodable encodable = pki . parsePrivateKey ( ) ; ASN1Primitive primitive = encodable . toASN1Primitive ( ) ; byte [ ] sec1Bytes = primitive . getEncoded ( ) ; return sec1Bytes ;


signature:
public class BCECUtil { /** * 将SEC1标准的私钥字节流转为BCECPrivateKey对象
 * @ param sec1Key
 * @ return
 * @ throws NoSuchAlgorithmException
 * @ throws NoSuchProviderException
 * @ throws InvalidKeySpecException
 * @ throws IOException */
public static BCECPrivateKey convertSEC1ToBCECPrivateKey ( byte [ ] sec1Key ) throws NoSuchAlgorithmException , NoSuchProviderException , InvalidKeySpecException , IOException { } }

implementation: PKCS8EncodedKeySpec peks = new PKCS8EncodedKeySpec ( convertECPrivateKeySEC1ToPKCS8 ( sec1Key ) ) ; KeyFactory kf = KeyFactory . getInstance ( ALGO_NAME_EC , BouncyCastleProvider . PROVIDER_NAME ) ; return ( BCECPrivateKey ) kf . generatePrivate ( peks ) ;


signature:
public class BCECUtil { /** * 将SEC1标准的私钥字节流转为ECPrivateKeyParameters对象
 * openssl i2d _ ECPrivateKey函数生成的DER编码的ecc私钥是 : SEC1标准的 、 带有EC _ GROUP 、 带有公钥的 ,
 * 这个工具函数的主要目的就是为了使Java程序能够 “ 识别 ” openssl生成的ECC私钥
 * @ param sec1Key
 * @ return
 * @ throws NoSuchAlgorithmException
 * @ throws NoSuchProviderException
 * @ throws InvalidKeySpecException */
public static ECPrivateKeyParameters convertSEC1ToECPrivateKey ( byte [ ] sec1Key ) throws NoSuchAlgorithmException , NoSuchProviderException , InvalidKeySpecException , IOException { } }

implementation: BCECPrivateKey privateKey = convertSEC1ToBCECPrivateKey ( sec1Key ) ; return convertPrivateKeyToParameters ( privateKey ) ;


signature:
public class BCECUtil { /** * 将ECC公钥对象转换为X509标准的字节流
 * @ param pubKey
 * @ return */
public static byte [ ] convertECPublicKeyToX509 ( ECPublicKeyParameters pubKey ) { } }

implementation: ECDomainParameters domainParams = pubKey . getParameters ( ) ; ECParameterSpec spec = new ECParameterSpec ( domainParams . getCurve ( ) , domainParams . getG ( ) , domainParams . getN ( ) , domainParams . getH ( ) ) ; BCECPublicKey publicKey = new BCECPublicKey ( ALGO_NAME_EC , pubKey , spec , BouncyCastleProvider . CONFIGURATION ) ; return publicKey . getEncoded ( ) ;


signature:
public class BCECUtil { /** * 将X509标准的公钥字节流转为公钥对象
 * @ param x509Bytes
 * @ return
 * @ throws NoSuchProviderException
 * @ throws NoSuchAlgorithmException
 * @ throws InvalidKeySpecException */
public static BCECPublicKey convertX509ToECPublicKey ( byte [ ] x509Bytes ) throws NoSuchProviderException , NoSuchAlgorithmException , InvalidKeySpecException { } }

implementation: X509EncodedKeySpec eks = new X509EncodedKeySpec ( x509Bytes ) ; KeyFactory kf = KeyFactory . getInstance ( "EC" , BouncyCastleProvider . PROVIDER_NAME ) ; return ( BCECPublicKey ) kf . generatePublic ( eks ) ;


signature:
public class BCECUtil { /** * copy from BC
 * @ param curveName
 * @ return */
public static X9ECParameters getDomainParametersFromName ( String curveName ) { } }

implementation: X9ECParameters domainParameters ; try { if ( curveName . charAt ( 0 ) >= '0' && curveName . charAt ( 0 ) <= '2' ) { ASN1ObjectIdentifier oidID = new ASN1ObjectIdentifier ( curveName ) ; domainParameters = ECUtil . getNamedCurveByOid ( oidID ) ; } else { if ( curveName . indexOf ( ' ' ) > 0 ) { curveName = curveName . substring ( curveName . indexOf ( ' ' ) + 1 ) ; domainParameters = ECUtil . getNamedCurveByName ( curveName ) ; } else { domainParameters = ECUtil . getNamedCurveByName ( curveName ) ; } } } catch ( IllegalArgumentException ex ) { domainParameters = ECUtil . getNamedCurveByName ( curveName ) ; } return domainParameters ;


signature:
public class BCECUtil { /** * copy from BC
 * @ param ecSpec
 * @ param withCompression
 * @ return */
public static X962Parameters getDomainParametersFromName ( java . security . spec . ECParameterSpec ecSpec , boolean withCompression ) { } }

implementation: X962Parameters params ; if ( ecSpec instanceof ECNamedCurveSpec ) { ASN1ObjectIdentifier curveOid = ECUtil . getNamedCurveOid ( ( ( ECNamedCurveSpec ) ecSpec ) . getName ( ) ) ; if ( curveOid == null ) { curveOid = new ASN1ObjectIdentifier ( ( ( ECNamedCurveSpec ) ecSpec ) . getName ( ) ) ; } params = new X962Parameters ( curveOid ) ; } else if ( ecSpec == null ) { params = new X962Parameters ( DERNull . INSTANCE ) ; } else { ECCurve curve = EC5Util . convertCurve ( ecSpec . getCurve ( ) ) ; X9ECParameters ecP = new X9ECParameters ( curve , EC5Util . convertPoint ( curve , ecSpec . getGenerator ( ) , withCompression ) , ecSpec . getOrder ( ) , BigInteger . valueOf ( ecSpec . getCofactor ( ) ) , ecSpec . getCurve ( ) . getSeed ( ) ) ; params = new X962Parameters ( ecP ) ; } return params ;


signature:
public class SM2Util { /** * 加密数据
 * @ param srcData
 * @ param publicKey
 * @ return
 * @ throws Exception */
public static byte [ ] encrypt ( String srcData , String publicKey ) throws Exception { } }

implementation: if ( RUNNING_PUBLIC_KEY == null ) { try { LOCK . lock ( ) ; if ( RUNNING_PUBLIC_KEY == null ) { ECPoint ecPoint = CURVE . decodePoint ( Base64 . decode ( publicKey . toCharArray ( ) ) ) ; RUNNING_PUBLIC_KEY = new ECPublicKeyParameters ( ecPoint , DOMAIN_PARAMS ) ; } } catch ( Exception e ) { throw new RuntimeException ( "init public key error" , e ) ; } finally { LOCK . unlock ( ) ; } } return encrypt ( RUNNING_PUBLIC_KEY , srcData . getBytes ( ) ) ;


signature:
public class SM2Util { /** * 只获取公钥里的XY分量 , 64字节
 * @ param publicKey
 * @ return */
public static byte [ ] getRawPublicKey ( BCECPublicKey publicKey ) { } }

implementation:
byte [ ] src65 = publicKey . getQ ( ) . getEncoded ( false ) ; byte [ ] rawXY = new byte [ CURVE_LEN * 2 ] ; // SM2的话这里应该是64字节
System . arraycopy ( src65 , 1 , rawXY , 0 , rawXY . length ) ; return rawXY ;


signature:
public class SM2Util { /** * ECC公钥加密
 * @ param pubKeyParameters ECC公钥
 * @ param srcData 源数据
 * @ return SM2密文 , 实际包含三部分 : ECC公钥 、 真正的密文 、 公钥和原文的SM3 - HASH值
 * @ throws InvalidCipherTextException */
public static byte [ ] encrypt ( ECPublicKeyParameters pubKeyParameters , byte [ ] srcData ) throws InvalidCipherTextException { } }

implementation: SM2Engine engine = new SM2Engine ( ) ; ParametersWithRandom pwr = new ParametersWithRandom ( pubKeyParameters , new SecureRandom ( ) ) ; engine . init ( true , pwr ) ; return engine . processBlock ( srcData , 0 , srcData . length ) ;


signature:
public class SM2Util { /** * ECC私钥解密
 * @ param priKeyParameters ECC私钥
 * @ param sm2Cipher SM2密文 , 实际包含三部分 : ECC公钥 、 真正的密文 、 公钥和原文的SM3 - HASH值
 * @ return 原文
 * @ throws InvalidCipherTextException */
public static byte [ ] decrypt ( ECPrivateKeyParameters priKeyParameters , byte [ ] sm2Cipher ) throws InvalidCipherTextException { } }

implementation: SM2Engine engine = new SM2Engine ( ) ; engine . init ( false , priKeyParameters ) ; return engine . processBlock ( sm2Cipher , 0 , sm2Cipher . length ) ;


signature:
public class InsertMetrics { /** * Sums two { @ link InsertMetrics } instances
 * @ param m1
 * @ param m2
 * @ return the sum aggregate result */
public static InsertMetrics sum ( InsertMetrics m1 , InsertMetrics m2 ) { } }

implementation: long totalDocsInserted = m1 . numberOfDocumentsInserted + m2 . numberOfDocumentsInserted ; Duration totalTimeTaken = m1 . timeTaken . plus ( m2 . timeTaken ) ; double totalRequestUnitsConsumed = m1 . requestUnitsConsumed + m2 . requestUnitsConsumed ; long totalNumberOfThrottles = m1 . numberOfThrottles + m2 . numberOfThrottles ; return new InsertMetrics ( totalDocsInserted , totalTimeTaken , totalRequestUnitsConsumed , totalNumberOfThrottles ) ;


signature:
public class DocumentBulkImporter { /** * Releases any internal resources .
 * It is responsibility of the caller to close { @ link DocumentClient } . */
@ Override public void close ( ) { } }

implementation:
// disable submission of new tasks
listeningExecutorService . shutdown ( ) ; try { // wait for existing tasks to terminate
if ( ! listeningExecutorService . awaitTermination ( 60 , TimeUnit . SECONDS ) ) { // cancel any currently running executing tasks
listeningExecutorService . shutdownNow ( ) ; // wait for cancelled tasks to terminate
if ( ! listeningExecutorService . awaitTermination ( 60 , TimeUnit . SECONDS ) ) { logger . error ( "some tasks did not terminate" ) ; } } } catch ( InterruptedException e ) { listeningExecutorService . shutdownNow ( ) ; Thread . currentThread ( ) . interrupt ( ) ; }


signature:
public class DocumentBulkImporter { /** * Initializes { @ link DocumentBulkImporter } . This happens only once
 * @ throws DocumentClientException */
private void initialize ( ) throws DocumentClientException { } }

implementation: logger . debug ( "Initializing ..." ) ; this . bulkImportStoredProcLink = String . format ( "%s/sprocs/%s" , collectionLink , BULK_IMPORT_STORED_PROCECURE_NAME ) ; logger . trace ( "Fetching partition map of collection" ) ; Range < String > fullRange = new Range < String > ( PartitionKeyInternal . MinimumInclusiveEffectivePartitionKey , PartitionKeyInternal . MaximumExclusiveEffectivePartitionKey , true , false ) ; this . collectionRoutingMap = getCollectionRoutingMap ( client ) ; Collection < PartitionKeyRange > partitionKeyRanges = this . collectionRoutingMap . getOverlappingRanges ( fullRange ) ; this . partitionKeyRangeIds = partitionKeyRanges . stream ( ) . map ( partitionKeyRange -> partitionKeyRange . getId ( ) ) . collect ( Collectors . toList ( ) ) ; logger . debug ( "Initialization completed" ) ;


signature:
public class DocumentBulkImporter { /** * Executes a bulk import in the Azure Cosmos DB database service .
 * < blockquote >
 * < pre >
 * { @ code
 * ConnectionPolicy connectionPolicy = new ConnectionPolicy ( ) ;
 * RetryOptions retryOptions = new RetryOptions ( ) ;
 * / / set to 0 to let bulk importer handles throttling
 * retryOptions . setMaxRetryAttemptsOnThrottledRequests ( 0 ) ;
 * connectionPolicy . setRetryOptions ( retryOptions ) ;
 * connectionPolicy . setMaxPoolSize ( 200 ) ;
 * DocumentClient client = new DocumentClient ( HOST , MASTER _ KEY , connectionPolicy , null ) ;
 * String collectionLink = String . format ( " / dbs / % s / colls / % s " , " mydb " , " mycol " ) ;
 * DocumentCollection collection = client . readCollection ( collectionLink , null ) . getResource ( ) ;
 * DocumentBulkImporter importer = DocumentBulkImporter . builder ( ) . from ( client , collection ) . build ( ) ;
 * for ( int i = 0 ; i < 10 ; i + + ) {
 * List < String > documents = documentSource . getMoreDocuments ( ) ;
 * BulkImportResponse bulkImportResponse = importer . importAll ( documents , false ) ;
 * / / validate that all documents inserted to ensure no failure .
 * / / bulkImportResponse . getNumberOfDocumentsImported ( ) = = documents . size ( )
 * if ( bulkImportResponse . getNumberOfDocumentsImported ( ) < documents . size ( ) ) {
 * for ( Exception e : bulkImportResponse . getFailuresIfAny ( ) ) {
 * / / validate why there were some failures
 * / / in case if you decide to re - import these batch of documents
 * / / ( as some of them may already have inserted )
 * / / you should import them with upsert enable option
 * e . printStackTrace ( ) ;
 * break ;
 * importer . close ( ) ;
 * client . close ( ) ;
 * < / pre >
 * < / blockquote >
 * @ param documents to insert
 * @ param isUpsert whether enable upsert ( overwrite if it exists )
 * @ return an instance of { @ link BulkImportResponse }
 * @ throws DocumentClientException if any failure happens */
public BulkImportResponse importAll ( Collection < String > documents , boolean isUpsert ) throws DocumentClientException { } }

implementation: return executeBulkImportInternal ( documents , isUpsert ) ;


signature:
public class DocumentAnalyzer { /** * Extracts effective { @ link PartitionKeyInternal } from serialized document .
 * @ param documentAsString Serialized document to extract partition key value from .
 * @ param partitionKeyDefinition Information about partition key .
 * @ return PartitionKeyInternal */
public static PartitionKeyInternal extractPartitionKeyValue ( String documentAsString , PartitionKeyDefinition partitionKeyDefinition ) { } }

implementation: if ( partitionKeyDefinition == null || partitionKeyDefinition . getPaths ( ) . size ( ) == 0 ) { return PartitionKeyInternal . getEmpty ( ) ; } return DocumentAnalyzer . extractPartitionKeyValueInternal ( documentAsString , partitionKeyDefinition ) ;


signature:
public class YubikeyLoginModule { /** * / * ( non - Javadoc )
 * @ see javax . security . auth . spi . LoginModule # abort ( ) */
public boolean abort ( ) throws LoginException { } }

implementation: log . trace ( "In abort()" ) ; for ( YubikeyPrincipal p : this . principals ) { this . subject . getPrincipals ( ) . remove ( p ) ; } return true ;


signature:
public class YubikeyLoginModule { /** * / * ( non - Javadoc )
 * @ see javax . security . auth . spi . LoginModule # commit ( ) */
public boolean commit ( ) throws LoginException { } }

implementation: log . trace ( "In commit()" ) ; for ( YubikeyPrincipal p : this . principals ) { log . debug ( "Committing principal {}" , p ) ; this . subject . getPrincipals ( ) . add ( p ) ; } return true ;


signature:
public class YubikeyLoginModule { /** * / * ( non - Javadoc )
 * @ see javax . security . auth . spi . LoginModule # logout ( ) */
public boolean logout ( ) throws LoginException { } }

implementation: log . trace ( "In logout()" ) ; for ( YubikeyPrincipal p : this . principals ) { this . subject . getPrincipals ( ) . remove ( p ) ; } return false ;


signature:
public class YubikeyLoginModule { /** * / * ( non - Javadoc )
 * @ see javax . security . auth . spi . LoginModule # initialize ( javax . security . auth . Subject , javax . security . auth . callback . CallbackHandler , java . util . Map , java . util . Map ) */
public void initialize ( Subject newSubject , CallbackHandler newCallbackHandler , Map < String , ? > sharedState , Map < String , ? > options ) { } }

implementation:
log . debug ( "Initializing YubikeyLoginModule" ) ; this . subject = newSubject ; this . callbackHandler = newCallbackHandler ; /* Yubico verification client */
Integer clientId = Integer . parseInt ( options . get ( OPTION_YUBICO_CLIENT_ID ) . toString ( ) ) ; String clientKey = options . get ( OPTION_YUBICO_CLIENT_KEY ) . toString ( ) ; this . yc = YubicoClient . getClient ( clientId , clientKey ) ; /* Realm of principals added after authentication */
if ( options . containsKey ( OPTION_YUBICO_ID_REALM ) ) { this . idRealm = options . get ( OPTION_YUBICO_ID_REALM ) . toString ( ) ; } /* Should this JAAS module be ignored when no OTPs are supplied ? */
if ( options . containsKey ( OPTION_YUBICO_SOFT_FAIL_NO_OTPS ) ) { if ( "true" . equals ( options . get ( OPTION_YUBICO_SOFT_FAIL_NO_OTPS ) . toString ( ) ) ) { this . soft_fail_on_no_otps = true ; } } /* Should this JAAS module uses j _ otp form to pick up otp */
if ( options . containsKey ( OPTION_YUBICO_JACC ) ) { if ( "true" . equals ( options . get ( OPTION_YUBICO_JACC ) . toString ( ) ) ) { this . jacc = true ; } } /* User - provided URLs to the Yubico validation service , separated by " | " . */
if ( options . containsKey ( OPTION_YUBICO_WSAPI_URLS ) ) { String in = options . get ( OPTION_YUBICO_WSAPI_URLS ) . toString ( ) ; String l [ ] = in . split ( "\\|" ) ; this . yc . setWsapiUrls ( l ) ; } if ( options . containsKey ( OPTION_YUBICO_SYNC_POLICY ) ) { this . yc . setSync ( Integer . parseInt ( options . get ( OPTION_YUBICO_SYNC_POLICY ) . toString ( ) ) ) ; } /* Instantiate the specified usermap implementation . */
String usermap_class_name = null ; if ( options . containsKey ( OPTION_YUBICO_USERMAP_CLASS ) ) { usermap_class_name = options . get ( OPTION_YUBICO_USERMAP_CLASS ) . toString ( ) ; } else { usermap_class_name = "com.yubico.jaas.impl.YubikeyToUserMapImpl" ; // Default implementation
} try { log . debug ( "Trying to instantiate {}" , usermap_class_name ) ; this . ykmap = ( YubikeyToUserMap ) Class . forName ( usermap_class_name ) . newInstance ( ) ; this . ykmap . setOptions ( options ) ; } catch ( ClassNotFoundException ex ) { log . error ( "Could not create usermap from class " + usermap_class_name , ex ) ; } catch ( InstantiationException ex ) { log . error ( "Could not create usermap from class " + usermap_class_name , ex ) ; } catch ( IllegalAccessException ex ) { log . error ( "Could not create usermap from class " + usermap_class_name , ex ) ; }


signature:
public class YubikeyLoginModule { /** * / * ( non - Javadoc )
 * @ see javax . security . auth . spi . LoginModule # login ( ) */
public boolean login ( ) throws LoginException { } }

implementation: NameCallback nameCb = new NameCallback ( "Enter username: " ) ; log . debug ( "Begin OTP login" ) ; if ( callbackHandler == null ) { throw new LoginException ( "No callback handler available in login()" ) ; } List < String > otps = get_tokens ( nameCb ) ; if ( otps . size ( ) == 0 ) { if ( this . soft_fail_on_no_otps ) { log . debug ( "No OTPs found, and soft-fail is on. Making JAAS ignore this module." ) ; return false ; } throw new LoginException ( "YubiKey OTP authentication failed - no OTPs supplied" ) ; } if ( validate_otps ( otps , nameCb ) ) { return true ; } log . info ( "None out of {} possible YubiKey OTPs for user {} validated successful" , otps . size ( ) , nameCb . getName ( ) ) ; throw new LoginException ( "YubiKey OTP authentication failed" ) ;


signature:
public class YubikeyLoginModule { /** * Try to validate all the OTPs provided .
 * @ param otps Possible YubiKey OTPs
 * @ param nameCb JAAS callback to get authenticating username
 * @ return true if one or more of the OTPs validated OK , otherwise false
 * @ throws LoginException for exceptions during validation , logging real exception at warn level */
private boolean validate_otps ( List < String > otps , NameCallback nameCb ) throws LoginException { } }

implementation:
boolean validated = false ; for ( String otp : otps ) { log . trace ( "Checking OTP {}" , otp ) ; VerificationResponse ykr ; try { ykr = this . yc . verify ( otp ) ; } catch ( YubicoVerificationException e ) { log . warn ( "Errors during validation: " , e ) ; throw new LoginException ( "Errors during validation: " + e . getMessage ( ) ) ; } catch ( YubicoValidationFailure e ) { log . warn ( "Something went very wrong during authentication: " , e ) ; throw new LoginException ( "Something went very wrong during authentication: " + e . getMessage ( ) ) ; } if ( ykr != null ) { log . trace ( "OTP {} verify result : {}" , otp , ykr . getStatus ( ) . toString ( ) ) ; if ( ykr . getStatus ( ) == ResponseStatus . OK ) { String publicId = YubicoClient . getPublicId ( otp ) ; log . info ( "OTP verified successfully (YubiKey id {})" , publicId ) ; if ( is_right_user ( nameCb . getName ( ) , publicId ) ) { this . principals . add ( new YubikeyPrincipal ( publicId , this . idRealm ) ) ; /* Don ' t just return here , we want to " consume " all OTPs if
 * more than one is provided . */
validated = true ; } } else { log . debug ( "OTP validation returned {}" , ykr . getStatus ( ) . toString ( ) ) ; } } } return validated ;


signature:
public class YubikeyLoginModule { /** * After validation of an OTP , check that it came from a YubiKey that actually
 * belongs to the user trying to authenticate .
 * @ param username Username to match against YubiKey publicId .
 * @ param publicId The public ID of the authenticated YubiKey .
 * @ return true if the username matched the YubiKey , false otherwise */
private boolean is_right_user ( String username , String publicId ) { } }

implementation: log . debug ( "Check if YubiKey {} belongs to user {}" , publicId , username ) ; return this . ykmap . is_right_user ( username , publicId ) ;


signature:
public class YubikeyLoginModule { /** * Get username and token ( s ) from the application , using the
 * javax . security . auth . callback . CallbackHandler passed to our initialize ( )
 * function .
 * The tokens returned have been identified as plausible YubiKey OTPs .
 * @ param nameCb
 * @ return list of possible YubiKey OTPs */
private List < String > get_tokens ( NameCallback nameCb ) { } }

implementation:
MultiValuePasswordCallback mv_passCb = new MultiValuePasswordCallback ( "Enter authentication tokens: " , false ) ; List < String > result = new ArrayList < String > ( ) ; try { /* Fetch a password using the callbackHandler */
callbackHandler . handle ( new Callback [ ] { nameCb , mv_passCb } ) ; for ( char [ ] c : mv_passCb . getSecrets ( ) ) { String s = new String ( c ) ; /* Check that OTP is at least 32 chars before we verify it . User might have entered
 * some other password instead of an OTP , and we don ' t want to send that , possibly
 * in clear text , over the network . */
if ( s . length ( ) < 32 ) { log . debug ( "Skipping token, not a valid YubiKey OTP (too short, {} < 32)" , s . length ( ) ) ; } else { result . add ( s ) ; } } } catch ( UnsupportedCallbackException ex ) { log . error ( "Callback type not supported" , ex ) ; } catch ( IOException ex ) { log . error ( "CallbackHandler failed" , ex ) ; } if ( jacc ) { // This is JACC specific mechanism
try { HttpServletRequest request = ( HttpServletRequest ) PolicyContext . getContext ( JACC_ATTR_WEB_REQUEST_KEY ) ; String j_otp = request . getParameter ( HTTP_REQUEST_ATTR_TOTP ) ; if ( j_otp == null || j_otp . length ( ) < 32 ) { log . debug ( "Skipping token from j_otp, not a valid YubiKey OTP (too short, {} < 32)" , j_otp == null ? 0 : j_otp . length ( ) ) ; } else { result . add ( j_otp ) ; } log . debug ( "OTP from j_otp token : {}" , j_otp ) ; } catch ( PolicyContextException e ) { log . debug ( "No OTP from j_otp token)" ) ; } } return result ;


signature:
public class YubikeyToUserMapImpl { /** * { @ inheritDoc } */
public final void setOptions ( Map < String , ? > options ) { } }

implementation:
/* Is verification of YubiKey owners enabled ? */
this . verify_yubikey_owner = true ; if ( options . get ( OPTION_YUBICO_VERIFY_YK_OWNER ) != null ) { if ( "false" . equals ( options . get ( OPTION_YUBICO_VERIFY_YK_OWNER ) . toString ( ) ) ) { this . verify_yubikey_owner = false ; } } /* id2name text file */
if ( options . get ( OPTION_YUBICO_ID2NAME_TEXTFILE ) != null ) { this . id2name_textfile = options . get ( OPTION_YUBICO_ID2NAME_TEXTFILE ) . toString ( ) ; } /* should we automatically assign new yubikeys to users ? */
if ( options . get ( OPTION_YUBICO_AUTO_PROVISION ) != null ) { if ( "true" . equals ( options . get ( OPTION_YUBICO_AUTO_PROVISION ) . toString ( ) ) ) { this . auto_provision_owners = true ; } }


signature:
public class YubikeyToUserMapImpl { /** * { @ inheritDoc } */
public boolean is_right_user ( String username , String publicId ) { } }

implementation: if ( ! this . verify_yubikey_owner ) { log . debug ( "YubiKey owner verification disabled, returning 'true'" ) ; return true ; } if ( this . id2name_textfile == null ) { log . debug ( "No id2name configuration. Defaulting to {}." , this . verify_yubikey_owner ) ; return this . verify_yubikey_owner ; } String ykuser ; try { ykuser = get_username_for_id ( publicId , this . id2name_textfile ) ; } catch ( FileNotFoundException ex ) { log . error ( "Yubikey to username textfile {} not found" , this . id2name_textfile ) ; return false ; } if ( ykuser != null ) { if ( ! ykuser . equals ( username ) ) { log . info ( "YubiKey " + publicId + " registered to user {}, NOT {}" , ykuser , username ) ; return false ; } return true ; } else { if ( this . auto_provision_owners ) { log . info ( "Registering new YubiKey " + publicId + " as belonging to {}" , username ) ; add_yubikey_to_user ( publicId , username , this . id2name_textfile ) ; return true ; } log . debug ( "No record of YubiKey {} found. Returning 'false'." , publicId ) ; return false ; }


signature:
public class YubikeyToUserMapImpl { /** * Given publicId " vvcccccfhc " , scans filename for a line like " yk . vvcccccfhc . user = alice "
 * and returns " alice " if found . Null is returned in case there is no matching line in file .
 * @ param publicId YubiKey public ID to scan for
 * @ param filename name of the file to scan
 * @ return String username
 * @ throws FileNotFoundException if the filename does not match an existing file */
private String get_username_for_id ( String publicId , String filename ) throws FileNotFoundException { } }

implementation: Scanner sc = null ; File file = new File ( filename ) ; try { sc = new Scanner ( file ) ; while ( sc . hasNextLine ( ) ) { String line = sc . nextLine ( ) ; if ( line . startsWith ( "yk." + publicId + ".user" ) ) { String ykuser = line . split ( "=" ) [ 1 ] . trim ( ) ; return ykuser ; } } } finally { if ( sc != null ) { sc . close ( ) ; } } return null ;


signature:
public class YubikeyToUserMapImpl { /** * Stores an association between username and YubiKey publicId in filename .
 * @ param publicId YubiKey public ID to associate with user
 * @ param username username to associate with a YubiKey public ID
 * @ param filename name of the file to store to */
private void add_yubikey_to_user ( String publicId , String username , String filename ) { } }

implementation: try { File file = new File ( filename ) ; FileWriter writer = new FileWriter ( file , true ) ; writer . write ( "yk." + publicId + ".user = " + username + System . getProperty ( "line.separator" ) ) ; writer . close ( ) ; } catch ( IOException ex ) { log . error ( "Failed appending entry to file {}" , filename , ex ) ; }


signature:
public class YubicoClientImpl { /** * { @ inheritDoc } */
public VerificationResponse verify ( String otp ) throws YubicoVerificationException , YubicoValidationFailure { } }

implementation:
if ( ! isValidOTPFormat ( otp ) ) { throw new IllegalArgumentException ( "The OTP is not a valid format" ) ; } Map < String , String > requestMap = new TreeMap < String , String > ( ) ; String nonce = UUID . randomUUID ( ) . toString ( ) . replaceAll ( "-" , "" ) ; requestMap . put ( "nonce" , nonce ) ; requestMap . put ( "id" , clientId . toString ( ) ) ; requestMap . put ( "otp" , otp ) ; requestMap . put ( "timestamp" , "1" ) ; if ( sync != null ) { requestMap . put ( "sl" , sync . toString ( ) ) ; } String queryString ; try { queryString = toQueryString ( requestMap ) ; } catch ( UnsupportedEncodingException e ) { throw new YubicoVerificationException ( "Failed to encode parameter." , e ) ; } if ( key != null ) { queryString = sign ( queryString ) ; } String [ ] wsapiUrls = this . getWsapiUrls ( ) ; List < String > validationUrls = new ArrayList < String > ( ) ; for ( String wsapiUrl : wsapiUrls ) { warnIfDeprecatedUrl ( wsapiUrl ) ; validationUrls . add ( wsapiUrl + "?" + queryString ) ; } VerificationResponse response = validationService . fetch ( validationUrls , userAgent ) ; if ( key != null ) { verifySignature ( response ) ; } // NONCE / OTP fields are not returned to the client when sending error codes .
// If there is an error response , don ' t need to check them .
if ( ! response . getStatus ( ) . isError ( ) ) { if ( response . getOtp ( ) == null || ! otp . equals ( response . getOtp ( ) ) ) { throw new YubicoValidationFailure ( "OTP mismatch in response, is there a man-in-the-middle?" ) ; } if ( response . getNonce ( ) == null || ! nonce . equals ( response . getNonce ( ) ) ) { throw new YubicoValidationFailure ( "Nonce mismatch in response, is there a man-in-the-middle?" ) ; } } return response ;


signature:
public class YubikeyToUserLDAPMap { /** * { @ inheritDoc } */
public boolean is_right_user ( String username , String publicId ) { } }

implementation: log . trace ( "In is_right_user()" ) ; if ( ! this . verify_yubikey_owner ) { log . debug ( "YubiKey owner verification disabled, returning 'true'" ) ; return true ; } String ykuser = null ; try { SearchFilter filter = new SearchFilter ( "({0}={1})" , new String [ ] { this . publicid_attribute , publicId } ) ; log . debug ( "Searching for YubiKey publicId with filter: {}" , filter . toString ( ) ) ; Iterator < SearchResult > results = ldap . search ( filter , new String [ ] { this . username_attribute } ) ; if ( results . hasNext ( ) ) { Attributes results_attributes = results . next ( ) . getAttributes ( ) ; log . debug ( "Found attributes: {}" , results_attributes . toString ( ) ) ; ykuser = results_attributes . get ( this . username_attribute ) . get ( ) . toString ( ) ; } else { log . debug ( "No search results" ) ; } } catch ( NamingException ex ) { log . error ( ex . getMessage ( ) , ex ) ; return false ; } if ( ykuser != null ) { if ( ! ykuser . equals ( username ) ) { log . info ( "YubiKey " + publicId + " registered to user {}, NOT {}" , ykuser , username ) ; return false ; } else { log . info ( "YubiKey " + publicId + " registered to user {}" , ykuser ) ; return true ; } } else { log . info ( "No record of YubiKey {} found. Returning 'false'." , publicId ) ; return false ; }


signature:
public class YubikeyToUserLDAPMap { /** * { @ inheritDoc } */
public final void setOptions ( Map < String , ? > options ) { } }

implementation:
/* Is verification of YubiKey owners enabled ? */
this . verify_yubikey_owner = true ; if ( options . get ( OPTION_YUBICO_VERIFY_YK_OWNER ) != null ) { if ( "false" . equals ( options . get ( OPTION_YUBICO_VERIFY_YK_OWNER ) . toString ( ) ) ) { this . verify_yubikey_owner = false ; } } if ( options . get ( OPTION_YUBICO_LDAP_PUBLICID_ATTRIBUTE ) != null ) { this . publicid_attribute = options . get ( OPTION_YUBICO_LDAP_PUBLICID_ATTRIBUTE ) . toString ( ) ; } if ( options . get ( OPTION_YUBICO_LDAP_USERNAME_ATTRIBUTE ) != null ) { this . username_attribute = options . get ( OPTION_YUBICO_LDAP_USERNAME_ATTRIBUTE ) . toString ( ) ; } if ( options . get ( OPTION_LDAP_URL ) != null ) { this . ldap_url = options . get ( OPTION_LDAP_URL ) . toString ( ) ; } if ( options . get ( OPTION_LDAP_BASE_DN ) != null ) { this . ldap_base_dn = options . get ( OPTION_LDAP_BASE_DN ) . toString ( ) ; } if ( options . get ( OPTION_LDAP_BIND_DN ) != null ) { this . ldap_bind_dn = options . get ( OPTION_LDAP_BIND_DN ) . toString ( ) ; } if ( options . get ( OPTION_LDAP_BIND_CREDENTIAL ) != null ) { this . ldap_bind_credential = options . get ( OPTION_LDAP_BIND_CREDENTIAL ) . toString ( ) ; } LdapConfig config = new LdapConfig ( this . ldap_url , this . ldap_base_dn ) ; config . setBindDn ( this . ldap_bind_dn ) ; config . setBindCredential ( this . ldap_bind_credential ) ; this . ldap = new Ldap ( config ) ;


signature:
public class HttpOathOtpLoginModule { /** * / * ( non - Javadoc )
 * @ see javax . security . auth . spi . LoginModule # initialize ( javax . security . auth . Subject , javax . security . auth . callback . CallbackHandler , java . util . Map , java . util . Map ) */
public void initialize ( Subject newSubject , CallbackHandler newCallbackHandler , Map < String , ? > sharedState , Map < String , ? > options ) { } }

implementation:
log . trace ( "Initializing HTTP OATH OTP LoginModule" ) ; this . subject = newSubject ; this . callbackHandler = newCallbackHandler ; this . protectedUrl = options . get ( OPTION_HTTPOATHOTP_PROTECTED_URL ) . toString ( ) ; if ( options . get ( OPTION_HTTPOATHOTP_EXPECTED_OUTPUT ) != null ) { this . expectedOutput = options . get ( OPTION_HTTPOATHOTP_EXPECTED_OUTPUT ) . toString ( ) ; } if ( options . get ( OPTION_HTTPOATHOTP_MIN_LENGTH ) != null ) { this . minLength = Integer . parseInt ( options . get ( OPTION_HTTPOATHOTP_MIN_LENGTH ) . toString ( ) ) ; } if ( options . get ( OPTION_HTTPOATHOTP_MAX_LENGTH ) != null ) { this . maxLength = Integer . parseInt ( options . get ( OPTION_HTTPOATHOTP_MAX_LENGTH ) . toString ( ) ) ; } if ( options . get ( OPTION_HTTPOATHOTP_REQUIRE_ALL_DIGITS ) != null ) { String s = options . get ( OPTION_HTTPOATHOTP_REQUIRE_ALL_DIGITS ) . toString ( ) ; if ( s . equals ( "true" ) ) { this . requireAllDigits = true ; } else if ( s . equals ( "false" ) ) { this . requireAllDigits = false ; } else { log . error ( "Bad value for option {}" , OPTION_HTTPOATHOTP_REQUIRE_ALL_DIGITS ) ; } } /* Realm of principals added after authentication */
if ( options . get ( OPTION_HTTPOATHOTP_ID_REALM ) != null ) { this . idRealm = options . get ( OPTION_HTTPOATHOTP_ID_REALM ) . toString ( ) ; }


signature:
public class HttpOathOtpLoginModule { /** * / * ( non - Javadoc )
 * @ see javax . security . auth . spi . LoginModule # login ( ) */
public boolean login ( ) throws LoginException { } }

implementation: log . trace ( "Begin OATH OTP login" ) ; if ( callbackHandler == null ) { throw new LoginException ( "No callback handler available in login()" ) ; } NameCallback nameCb = new NameCallback ( "Enter username: " ) ; List < String > otps = get_tokens ( nameCb ) ; for ( String otp : otps ) { String userName = nameCb . getName ( ) ; log . trace ( "Checking OATH OTP for user {}" , userName ) ; if ( verify_otp ( userName , otp ) ) { log . info ( "OATH OTP verified successfully" ) ; principal = new YubikeyPrincipal ( userName , this . idRealm ) ; return true ; } log . info ( "OATH OTP did NOT verify" ) ; } throw new LoginException ( "OATH OTP verification failed" ) ;


signature:
public class HttpOathOtpLoginModule { /** * Access protectedUrl using userName and otp for basic auth .
 * Check if what we get back contains expectedOutput .
 * @ param userName
 * @ param otp
 * @ return boolean */
boolean verify_otp ( String userName , String otp ) { } }

implementation: try { String authString = userName + ":" + otp ; String authStringEnc = Base64 . encodeBase64URLSafeString ( authString . getBytes ( ) ) ; BufferedReader in = attemptAuthentication ( authStringEnc ) ; String inputLine ; while ( ( inputLine = in . readLine ( ) ) != null ) { if ( inputLine . contains ( expectedOutput ) ) { return true ; } } } catch ( Exception ex ) { log . error ( "Failed verifying OATH OTP :" , ex ) ; } return false ;


signature:
public class MultiValuePasswordCallback { /** * Tries to clear all the passwords from memory . */
public void clearPassword ( ) { } }

implementation:
for ( char pw [ ] : this . secrets ) { for ( int i = 0 ; i < pw . length ; i ++ ) { pw [ i ] = 0 ; } } /* Now discard the list . */
this . secrets = new ArrayList < char [ ] > ( ) ;


signature:
public class YubicoClient { /** * Configure what URLs to use for validating OTPs . These URLs will have
 * all the necessary parameters appended to them . Example :
 * { " https : / / api . yubico . com / wsapi / 2.0 / verify " }
 * @ param wsapi list of base URLs */
public void setWsapiUrls ( String [ ] wsapi ) { } }

implementation: for ( String url : wsapi ) { warnIfDeprecatedUrl ( url ) ; } this . wsapi_urls = wsapi ;


signature:
public class YubicoClient { /** * Extract the public ID of a YubiKey from an OTP it generated .
 * @ param otpThe OTP to extract ID from , in modhex format .
 * @ return stringPublic ID of YubiKey that generated otp . Between 0 and 12 lower - case characters .
 * @ throws IllegalArgumentException for arguments that are null or too short to be valid OTP strings . */
public static String getPublicId ( String otp ) { } }

implementation:
if ( ( otp == null ) || ( otp . length ( ) < OTP_MIN_LEN ) ) { // not a valid OTP format , throw an exception
throw new IllegalArgumentException ( "The OTP is too short to be valid" ) ; } Integer len = otp . length ( ) ; /* The OTP part is always the last 32 bytes of otp . Whatever is before that
 * ( if anything ) is the public ID of the YubiKey . The ID can be set to ' '
 * through personalization . */
return otp . substring ( 0 , len - 32 ) . toLowerCase ( ) ;


signature:
public class YubicoClient { /** * Determines whether a given OTP is of the correct length
 * and only contains printable characters , as per the recommendation .
 * @ param otp The OTP to validate
 * @ return boolean Returns true if it ' s valid ; false otherwise */
public static boolean isValidOTPFormat ( String otp ) { } }

implementation: if ( otp == null ) { return false ; } int len = otp . length ( ) ; for ( char c : otp . toCharArray ( ) ) { if ( c < 0x20 || c > 0x7E ) { return false ; } } return OTP_MIN_LEN <= len && len <= OTP_MAX_LEN ;


signature:
public class EvaluationPool { /** * Returns an Evaluation that contains the node , source and whether it
 * is a set operation . If there are no Evaluation objects in the
 * pool one is created and returned . */
public Evaluation create ( SimpleNode node , Object source ) { } }

implementation: return create ( node , source , false ) ;


signature:
public class EvaluationPool { /** * Returns an Evaluation that contains the node , source and whether it
 * is a set operation . */
public Evaluation create ( SimpleNode node , Object source , boolean setOperation ) { } }

implementation:
// synchronization is removed as we do not rely anymore on the in - house object pooling
return new Evaluation ( node , source , setOperation ) ;


signature:
public class ASTProperty { /** * Returns true if this property is described by an IndexedPropertyDescriptor and that if
 * followed by an index specifier it will call the index get / set methods rather than go through
 * property accessors . */
public int getIndexedPropertyType ( OgnlContext context , Object source ) throws OgnlException { } }

implementation: Class type = context . getCurrentType ( ) ; Class prevType = context . getPreviousType ( ) ; try { if ( ! isIndexedAccess ( ) ) { Object property = getProperty ( context , source ) ; if ( property instanceof String ) { return OgnlRuntime . getIndexedPropertyType ( context , ( source == null ) ? null : OgnlRuntime . getCompiler ( ) . getInterfaceClass ( source . getClass ( ) ) , ( String ) property ) ; } } return OgnlRuntime . INDEXED_PROPERTY_NONE ; } finally { context . setCurrentObject ( source ) ; context . setCurrentType ( type ) ; context . setPreviousType ( prevType ) ; }


signature:
public class ObjectMethodAccessor { /** * / * MethodAccessor interface */
public Object callStaticMethod ( Map context , Class targetClass , String methodName , Object [ ] args ) throws MethodFailedException { } }

implementation: List methods = OgnlRuntime . getMethods ( targetClass , methodName , true ) ; return OgnlRuntime . callAppropriateMethod ( ( OgnlContext ) context , targetClass , null , methodName , null , methods , args ) ;


signature:
public class OgnlRuntime { /** * Clears all of the cached reflection information normally used
 * to improve the speed of expressions that operate on the same classes
 * or are executed multiple times .
 * < strong > Warning : < / strong > Calling this too often can be a huge performance
 * drain on your expressions - use with care . */
public static void clearCache ( ) { } }

implementation: _methodParameterTypesCache . clear ( ) ; _ctorParameterTypesCache . clear ( ) ; _propertyDescriptorCache . clear ( ) ; _constructorCache . clear ( ) ; _staticMethodCache . clear ( ) ; _instanceMethodCache . clear ( ) ; _invokePermissionCache . clear ( ) ; _fieldCache . clear ( ) ; _superclasses . clear ( ) ; _declaredMethods [ 0 ] . clear ( ) ; _declaredMethods [ 1 ] . clear ( ) ; _methodAccessCache . clear ( ) ; _methodPermCache . clear ( ) ;


signature:
public class OgnlRuntime { /** * Checks if the current jvm is java language > = 1.5 compatible .
 * @ return True if jdk15 features are present . */
public static boolean isJdk15 ( ) { } }

implementation:
if ( _jdkChecked ) return _jdk15 ; try { Class . forName ( "java.lang.annotation.Annotation" ) ; _jdk15 = true ; } catch ( Exception e ) { /* ignore */
} _jdkChecked = true ; return _jdk15 ;


signature:
public class OgnlRuntime { /** * Gets the " target " class of an object for looking up accessors that are registered on the
 * target . If the object is a Class object this will return the Class itself , else it will
 * return object ' s getClass ( ) result . */
public static Class getTargetClass ( Object o ) { } }

implementation: return ( o == null ) ? null : ( ( o instanceof Class ) ? ( Class ) o : o . getClass ( ) ) ;


signature:
public class OgnlRuntime { /** * Returns the base name ( the class name without the package name prepended ) of the object
 * given . */
public static String getBaseName ( Object o ) { } }

implementation: return ( o == null ) ? null : getClassBaseName ( o . getClass ( ) ) ;


signature:
public class OgnlRuntime { /** * Returns the base name ( the class name without the package name prepended ) of the class given . */
public static String getClassBaseName ( Class c ) { } }

implementation: String s = c . getName ( ) ; return s . substring ( s . lastIndexOf ( '.' ) + 1 ) ;


signature:
public class OgnlRuntime { /** * Returns the package name of the object ' s class . */
public static String getPackageName ( Object o ) { } }

implementation: return ( o == null ) ? null : getClassPackageName ( o . getClass ( ) ) ;


signature:
public class OgnlRuntime { /** * Returns the package name of the class given . */
public static String getClassPackageName ( Class c ) { } }

implementation: String s = c . getName ( ) ; int i = s . lastIndexOf ( '.' ) ; return ( i < 0 ) ? null : s . substring ( 0 , i ) ;


signature:
public class OgnlRuntime { /** * Returns a " pointer " string in the usual format for these things - 0x < hex digits > . */
public static String getPointerString ( int num ) { } }

implementation:
StringBuffer result = new StringBuffer ( ) ; String hex = Integer . toHexString ( num ) , pad ; Integer l = new Integer ( hex . length ( ) ) ; // result . append ( HEX _ PREFIX ) ;
if ( ( pad = ( String ) HEX_PADDING . get ( l ) ) == null ) { StringBuffer pb = new StringBuffer ( ) ; for ( int i = hex . length ( ) ; i < HEX_LENGTH ; i ++ ) { pb . append ( '0' ) ; } pad = new String ( pb ) ; HEX_PADDING . put ( l , pad ) ; } result . append ( pad ) ; result . append ( hex ) ; return new String ( result ) ;


signature:
public class OgnlRuntime { /** * Returns a " pointer " string in the usual format for these things - 0x < hex digits > for the
 * object given . This will always return a unique value for each object . */
public static String getPointerString ( Object o ) { } }

implementation: return getPointerString ( ( o == null ) ? 0 : System . identityHashCode ( o ) ) ;


signature:
public class OgnlRuntime { /** * Returns a unique descriptor string that includes the object ' s class and a unique integer
 * identifier . If fullyQualified is true then the class name will be fully qualified to include
 * the package name , else it will be just the class ' base name . */
public static String getUniqueDescriptor ( Object object , boolean fullyQualified ) { } }

implementation: StringBuffer result = new StringBuffer ( ) ; if ( object != null ) { if ( object instanceof Proxy ) { Class interfaceClass = object . getClass ( ) . getInterfaces ( ) [ 0 ] ; result . append ( getClassName ( interfaceClass , fullyQualified ) ) ; result . append ( '^' ) ; object = Proxy . getInvocationHandler ( object ) ; } result . append ( getClassName ( object , fullyQualified ) ) ; result . append ( '@' ) ; result . append ( getPointerString ( object ) ) ; } else { result . append ( NULL_OBJECT_STRING ) ; } return new String ( result ) ;


signature:
public class OgnlRuntime { /** * Utility to convert a List into an Object [ ] array . If the list is zero elements this will
 * return a constant array ; toArray ( ) on List always returns a new object and this is wasteful
 * for our purposes . */
public static Object [ ] toArray ( List list ) { } }

implementation: Object [ ] result ; int size = list . size ( ) ; if ( size == 0 ) { result = NoArguments ; } else { result = getObjectArrayPool ( ) . create ( list . size ( ) ) ; for ( int i = 0 ; i < size ; i ++ ) { result [ i ] = list . get ( i ) ; } } return result ;


signature:
public class OgnlRuntime { /** * Returns the parameter types of the given method . */
public static Class [ ] getParameterTypes ( Method m ) { } }

implementation: synchronized ( _methodParameterTypesCache ) { Class [ ] result ; if ( ( result = ( Class [ ] ) _methodParameterTypesCache . get ( m ) ) == null ) { _methodParameterTypesCache . put ( m , result = m . getParameterTypes ( ) ) ; } return result ; }


signature:
public class OgnlRuntime { /** * Finds the appropriate parameter types for the given { @ link Method } and
 * { @ link Class } instance of the type the method is associated with . Correctly
 * finds generic types if running in > = 1.5 jre as well .
 * @ param type The class type the method is being executed against .
 * @ param m The method to find types for .
 * @ return Array of parameter types for the given method . */
public static Class [ ] findParameterTypes ( Class type , Method m ) { } }

implementation: Type [ ] genTypes = m . getGenericParameterTypes ( ) ; Class [ ] types = new Class [ genTypes . length ] ; ; boolean noGenericParameter = true ; for ( int i = 0 ; i < genTypes . length ; i ++ ) { if ( Class . class . isInstance ( genTypes [ i ] ) ) { types [ i ] = ( Class ) genTypes [ i ] ; continue ; } noGenericParameter = false ; break ; } if ( noGenericParameter ) { return types ; } if ( type == null || ! isJdk15 ( ) ) { return getParameterTypes ( m ) ; } final Type typeGenericSuperclass = type . getGenericSuperclass ( ) ; if ( typeGenericSuperclass == null || ! ParameterizedType . class . isInstance ( typeGenericSuperclass ) || m . getDeclaringClass ( ) . getTypeParameters ( ) == null ) { return getParameterTypes ( m ) ; } if ( ( types = ( Class [ ] ) _genericMethodParameterTypesCache . get ( m ) ) != null ) { ParameterizedType genericSuperclass = ( ParameterizedType ) typeGenericSuperclass ; if ( Arrays . equals ( types , genericSuperclass . getActualTypeArguments ( ) ) ) { return types ; } } ParameterizedType param = ( ParameterizedType ) typeGenericSuperclass ; TypeVariable [ ] declaredTypes = m . getDeclaringClass ( ) . getTypeParameters ( ) ; types = new Class [ genTypes . length ] ; for ( int i = 0 ; i < genTypes . length ; i ++ ) { TypeVariable paramType = null ; if ( TypeVariable . class . isInstance ( genTypes [ i ] ) ) { paramType = ( TypeVariable ) genTypes [ i ] ; } else if ( GenericArrayType . class . isInstance ( genTypes [ i ] ) ) { paramType = ( TypeVariable ) ( ( GenericArrayType ) genTypes [ i ] ) . getGenericComponentType ( ) ; } else if ( ParameterizedType . class . isInstance ( genTypes [ i ] ) ) { types [ i ] = ( Class ) ( ( ParameterizedType ) genTypes [ i ] ) . getRawType ( ) ; continue ; } else if ( Class . class . isInstance ( genTypes [ i ] ) ) { types [ i ] = ( Class ) genTypes [ i ] ; continue ; } Class resolved = resolveType ( param , paramType , declaredTypes ) ; if ( resolved != null ) { if ( GenericArrayType . class . isInstance ( genTypes [ i ] ) ) { resolved = Array . newInstance ( resolved , 0 ) . getClass ( ) ; } types [ i ] = resolved ; continue ; } types [ i ] = m . getParameterTypes ( ) [ i ] ; } synchronized ( _genericMethodParameterTypesCache ) { _genericMethodParameterTypesCache . put ( m , types ) ; } return types ;


signature:
public class OgnlRuntime { /** * Returns the parameter types of the given method . */
public static Class [ ] getParameterTypes ( Constructor c ) { } }

implementation: Class [ ] result ; if ( ( result = ( Class [ ] ) _ctorParameterTypesCache . get ( c ) ) == null ) { synchronized ( _ctorParameterTypesCache ) { if ( ( result = ( Class [ ] ) _ctorParameterTypesCache . get ( c ) ) == null ) { _ctorParameterTypesCache . put ( c , result = c . getParameterTypes ( ) ) ; } } } return result ;


signature:
public class OgnlRuntime { /** * Permission will be named " invoke . < declaring - class > . < method - name > " . */
public static Permission getPermission ( Method method ) { } }

implementation: Permission result ; Class mc = method . getDeclaringClass ( ) ; synchronized ( _invokePermissionCache ) { Map permissions = ( Map ) _invokePermissionCache . get ( mc ) ; if ( permissions == null ) { _invokePermissionCache . put ( mc , permissions = new HashMap ( 101 ) ) ; } if ( ( result = ( Permission ) permissions . get ( method . getName ( ) ) ) == null ) { result = new OgnlInvokePermission ( "invoke." + mc . getName ( ) + "." + method . getName ( ) ) ; permissions . put ( method . getName ( ) , result ) ; } } return result ;


signature:
public class OgnlRuntime { /** * Gets the class for a method argument that is appropriate for looking up methods by
 * reflection , by looking for the standard primitive wrapper classes and exchanging for them
 * their underlying primitive class objects . Other classes are passed through unchanged .
 * @ param arg an object that is being passed to a method
 * @ return the class to use to look up the method */
public static final Class getArgClass ( Object arg ) { } }

implementation: if ( arg == null ) return null ; Class c = arg . getClass ( ) ; if ( c == Boolean . class ) return Boolean . TYPE ; else if ( c . getSuperclass ( ) == Number . class ) { if ( c == Integer . class ) return Integer . TYPE ; if ( c == Double . class ) return Double . TYPE ; if ( c == Byte . class ) return Byte . TYPE ; if ( c == Long . class ) return Long . TYPE ; if ( c == Float . class ) return Float . TYPE ; if ( c == Short . class ) return Short . TYPE ; } else if ( c == Character . class ) return Character . TYPE ; return c ;


signature:
public class OgnlRuntime { /** * Tells whether the given object is compatible with the given class - - - that is , whether the
 * given object can be passed as an argument to a method or constructor whose parameter type is
 * the given class . If object is null this will return true because null is compatible with any
 * type . */
public static final boolean isTypeCompatible ( Object object , Class c ) { } }

implementation:
if ( object == null ) return true ; ArgsCompatbilityReport report = new ArgsCompatbilityReport ( 0 , new boolean [ 1 ] ) ; if ( ! isTypeCompatible ( getArgClass ( object ) , c , 0 , report ) ) return false ; if ( report . conversionNeeded [ 0 ] ) return false ; // we don ' t allow conversions during this path . . .
return true ;


signature:
public class OgnlRuntime { /** * Tells whether the first array of classes is more specific than the second . Assumes that the
 * two arrays are of the same length . */
public static final boolean isMoreSpecific ( Class [ ] classes1 , Class [ ] classes2 ) { } }

implementation:
for ( int index = 0 , count = classes1 . length ; index < count ; ++ index ) { Class c1 = classes1 [ index ] , c2 = classes2 [ index ] ; if ( c1 == c2 ) continue ; else if ( c1 . isPrimitive ( ) ) return true ; else if ( c1 . isAssignableFrom ( c2 ) ) return false ; else if ( c2 . isAssignableFrom ( c1 ) ) return true ; } // They are the same ! So the first is not more specific than the second .
return false ;


signature:
public class OgnlRuntime { /** * Gets the appropriate method to be called for the given target , method name and arguments . If
 * successful this method will return the Method within the target that can be called and the
 * converted arguments in actualArgs . If unsuccessful this method will return null and the
 * actualArgs will be empty .
 * @ param context The current execution context .
 * @ param source Target object to run against or method name .
 * @ param target Instance of object to be run against .
 * @ param propertyName Name of property to get method of .
 * @ param methods List of current known methods .
 * @ param args Arguments originally passed in .
 * @ param actualArgs Converted arguments .
 * @ return Best method match or null if none could be found . */
public static Method getAppropriateMethod ( OgnlContext context , Object source , Object target , String propertyName , String methodName , List methods , Object [ ] args , Object [ ] actualArgs ) { } }

implementation: Method result = null ; if ( methods != null ) { Class typeClass = target != null ? target . getClass ( ) : null ; if ( typeClass == null && source != null && Class . class . isInstance ( source ) ) { typeClass = ( Class ) source ; } Class [ ] argClasses = getArgClasses ( args ) ; MatchingMethod mm = findBestMethod ( methods , typeClass , methodName , argClasses ) ; if ( mm != null ) { result = mm . mMethod ; Class [ ] mParameterTypes = mm . mParameterTypes ; System . arraycopy ( args , 0 , actualArgs , 0 , args . length ) ; for ( int j = 0 ; j < mParameterTypes . length ; j ++ ) { Class type = mParameterTypes [ j ] ; if ( mm . report . conversionNeeded [ j ] || ( type . isPrimitive ( ) && ( actualArgs [ j ] == null ) ) ) { actualArgs [ j ] = getConvertedType ( context , source , result , propertyName , args [ j ] , type ) ; } } } } if ( result == null ) { result = getConvertedMethodAndArgs ( context , target , propertyName , methods , args , actualArgs ) ; } return result ;


signature:
public class OgnlRuntime { /** * Invokes the specified method against the target object .
 * @ param context
 * The current execution context .
 * @ param target
 * The object to invoke the method on .
 * @ param methodName
 * Name of the method - as in " getValue " or " add " , etc . .
 * @ param propertyName
 * Name of the property to call instead ?
 * @ param args
 * Optional arguments needed for method .
 * @ return Result of invoking method .
 * @ deprecated Use { @ link # callMethod ( OgnlContext , Object , String , Object [ ] ) } instead .
 * @ throws OgnlException For lots of different reasons . */
public static Object callMethod ( OgnlContext context , Object target , String methodName , String propertyName , Object [ ] args ) throws OgnlException { } }

implementation: return callMethod ( context , target , methodName == null ? propertyName : methodName , args ) ;


signature:
public class OgnlRuntime { /** * Invokes the specified method against the target object .
 * @ param context
 * The current execution context .
 * @ param target
 * The object to invoke the method on .
 * @ param methodName
 * Name of the method - as in " getValue " or " add " , etc . .
 * @ param args
 * Optional arguments needed for method .
 * @ return Result of invoking method .
 * @ throws OgnlException For lots of different reasons . */
public static Object callMethod ( OgnlContext context , Object target , String methodName , Object [ ] args ) throws OgnlException { } }

implementation: if ( target == null ) throw new NullPointerException ( "target is null for method " + methodName ) ; return getMethodAccessor ( target . getClass ( ) ) . callMethod ( context , target , methodName , args ) ;


signature:
public class OgnlRuntime { /** * If the checkAccessAndExistence flag is true this method will check to see if the method
 * exists and if it is accessible according to the context ' s MemberAccess . If neither test
 * passes this will return NotFound . */
public static final Object getMethodValue ( OgnlContext context , Object target , String propertyName , boolean checkAccessAndExistence ) throws OgnlException , IllegalAccessException , NoSuchMethodException , IntrospectionException { } }

implementation: Object result = null ; Method m = getGetMethod ( context , ( target == null ) ? null : target . getClass ( ) , propertyName ) ; if ( m == null ) m = getReadMethod ( ( target == null ) ? null : target . getClass ( ) , propertyName , null ) ; if ( checkAccessAndExistence ) { if ( ( m == null ) || ! context . getMemberAccess ( ) . isAccessible ( context , target , m , propertyName ) ) { result = NotFound ; } } if ( result == null ) { if ( m != null ) { try { result = invokeMethod ( target , m , NoArguments ) ; } catch ( InvocationTargetException ex ) { throw new OgnlException ( propertyName , ex . getTargetException ( ) ) ; } } else { throw new NoSuchMethodException ( propertyName ) ; } } return result ;


signature:
public class OgnlRuntime { /** * Don ' t use this method as it doesn ' t check member access rights via { @ link MemberAccess } interface */
@ Deprecated public static boolean setMethodValue ( OgnlContext context , Object target , String propertyName , Object value ) throws OgnlException , IllegalAccessException , NoSuchMethodException , IntrospectionException { } }

implementation: return setMethodValue ( context , target , propertyName , value , false ) ;


signature:
public class OgnlRuntime { /** * This method returns the property descriptors for the given class as a Map .
 * @ param targetClass The class to get the descriptors for .
 * @ return Map map of property descriptors for class .
 * @ throws IntrospectionException on errors using { @ link Introspector } .
 * @ throws OgnlException On general errors . */
public static Map getPropertyDescriptors ( Class targetClass ) throws IntrospectionException , OgnlException { } }

implementation:
Map result ; if ( ( result = ( Map ) _propertyDescriptorCache . get ( targetClass ) ) == null ) { synchronized ( _propertyDescriptorCache ) { if ( ( result = ( Map ) _propertyDescriptorCache . get ( targetClass ) ) == null ) { PropertyDescriptor [ ] pda = Introspector . getBeanInfo ( targetClass ) . getPropertyDescriptors ( ) ; result = new HashMap ( 101 ) ; for ( int i = 0 , icount = pda . length ; i < icount ; i ++ ) { // workaround for Introspector bug 6528714 ( bugs . sun . com )
if ( pda [ i ] . getReadMethod ( ) != null && ! isMethodCallable ( pda [ i ] . getReadMethod ( ) ) ) { pda [ i ] . setReadMethod ( findClosestMatchingMethod ( targetClass , pda [ i ] . getReadMethod ( ) , pda [ i ] . getName ( ) , pda [ i ] . getPropertyType ( ) , true ) ) ; } if ( pda [ i ] . getWriteMethod ( ) != null && ! isMethodCallable ( pda [ i ] . getWriteMethod ( ) ) ) { pda [ i ] . setWriteMethod ( findClosestMatchingMethod ( targetClass , pda [ i ] . getWriteMethod ( ) , pda [ i ] . getName ( ) , pda [ i ] . getPropertyType ( ) , false ) ) ; } result . put ( pda [ i ] . getName ( ) , pda [ i ] ) ; } findObjectIndexedPropertyDescriptors ( targetClass , result ) ; _propertyDescriptorCache . put ( targetClass , result ) ; } } } return result ;


signature:
public class OgnlRuntime { /** * This method returns a PropertyDescriptor for the given class and property name using a Map
 * lookup ( using getPropertyDescriptorsMap ( ) ) . */
public static PropertyDescriptor getPropertyDescriptor ( Class targetClass , String propertyName ) throws IntrospectionException , OgnlException { } }

implementation: if ( targetClass == null ) return null ; return ( PropertyDescriptor ) getPropertyDescriptors ( targetClass ) . get ( propertyName ) ;


signature:
public class OgnlRuntime { /** * Gets the property descriptor with the given name for the target class given .
 * @ param targetClass Class for which property descriptor is desired
 * @ param name Name of property
 * @ return PropertyDescriptor of the named property or null if the class has no property with
 * the given name */
public static PropertyDescriptor getPropertyDescriptorFromArray ( Class targetClass , String name ) throws IntrospectionException { } }

implementation: PropertyDescriptor result = null ; PropertyDescriptor [ ] pda = getPropertyDescriptorsArray ( targetClass ) ; for ( int i = 0 , icount = pda . length ; ( result == null ) && ( i < icount ) ; i ++ ) { if ( pda [ i ] . getName ( ) . compareTo ( name ) == 0 ) { result = pda [ i ] ; } } return result ;


signature:
public class OgnlRuntime { /** * Determines the index property type , if any . Returns < code > INDEXED _ PROPERTY _ NONE < / code > if
 * the property is not index - accessible as determined by OGNL or JavaBeans . If it is indexable
 * then this will return whether it is a JavaBeans indexed property , conforming to the indexed
 * property patterns ( returns < code > INDEXED _ PROPERTY _ INT < / code > ) or if it conforms to the
 * OGNL arbitrary object indexable ( returns < code > INDEXED _ PROPERTY _ OBJECT < / code > ) . */
public static int getIndexedPropertyType ( OgnlContext context , Class sourceClass , String name ) throws OgnlException { } }

implementation: int result = INDEXED_PROPERTY_NONE ; try { PropertyDescriptor pd = getPropertyDescriptor ( sourceClass , name ) ; if ( pd != null ) { if ( pd instanceof IndexedPropertyDescriptor ) { result = INDEXED_PROPERTY_INT ; } else { if ( pd instanceof ObjectIndexedPropertyDescriptor ) { result = INDEXED_PROPERTY_OBJECT ; } } } } catch ( Exception ex ) { throw new OgnlException ( "problem determining if '" + name + "' is an indexed property" , ex ) ; } return result ;


signature:
public class OgnlRuntime { /** * Registers the specified { @ link ClassCacheInspector } with all class reflection based internal
 * caches . This may have a significant performance impact so be careful using this in production scenarios .
 * @ param inspector
 * The inspector instance that will be registered with all internal cache instances . */
public static void setClassCacheInspector ( ClassCacheInspector inspector ) { } }

implementation: _cacheInspector = inspector ; _propertyDescriptorCache . setClassInspector ( _cacheInspector ) ; _constructorCache . setClassInspector ( _cacheInspector ) ; _staticMethodCache . setClassInspector ( _cacheInspector ) ; _instanceMethodCache . setClassInspector ( _cacheInspector ) ; _invokePermissionCache . setClassInspector ( _cacheInspector ) ; _fieldCache . setClassInspector ( _cacheInspector ) ; _declaredMethods [ 0 ] . setClassInspector ( _cacheInspector ) ; _declaredMethods [ 1 ] . setClassInspector ( _cacheInspector ) ;


signature:
public class OgnlRuntime { /** * Finds the best possible match for a method on the specified target class with a matching
 * name .
 * The name matched will also try different combinations like < code > is + name , has + name , get + name , etc . . < / code >
 * @ param target
 * The class to find a matching method against .
 * @ param name
 * The name of the method .
 * @ return The most likely matching { @ link Method } , or null if none could be found . */
public static Method getReadMethod ( Class target , String name ) { } }

implementation: return getReadMethod ( target , name , null ) ;


signature:
public class OgnlRuntime { /** * Compares the { @ link OgnlContext # getCurrentType ( ) } and { @ link OgnlContext # getPreviousType ( ) } class types
 * on the stack to determine if a numeric expression should force object conversion .
 * Normally used in conjunction with the < code > forceConversion < / code > parameter of
 * { @ link OgnlRuntime # getChildSource ( OgnlContext , Object , Node , boolean ) } .
 * @ param context The current context .
 * @ return True , if the class types on the stack wouldn ' t be comparable in a pure numeric expression such as < code > o1 > = o2 < / code > . */
public static boolean shouldConvertNumericTypes ( OgnlContext context ) { } }

implementation: if ( context . getCurrentType ( ) == null || context . getPreviousType ( ) == null ) return true ; if ( context . getCurrentType ( ) == context . getPreviousType ( ) && context . getCurrentType ( ) . isPrimitive ( ) && context . getPreviousType ( ) . isPrimitive ( ) ) return false ; return context . getCurrentType ( ) != null && ! context . getCurrentType ( ) . isArray ( ) && context . getPreviousType ( ) != null && ! context . getPreviousType ( ) . isArray ( ) ;


signature:
public class OgnlRuntime { /** * Attempts to get the java source string represented by the specific child expression
 * via the { @ link JavaSource # toGetSourceString ( OgnlContext , Object ) } interface method .
 * @ param context The ognl context to pass to the child .
 * @ param target The current object target to use .
 * @ param child The child expression .
 * @ return The result of calling { @ link JavaSource # toGetSourceString ( OgnlContext , Object ) } plus additional
 * enclosures of { @ link OgnlOps # convertValue ( Object , Class , boolean ) } for conversions .
 * @ throws OgnlException Mandatory exception throwing catching . . ( blehh ) */
public static String getChildSource ( OgnlContext context , Object target , Node child ) throws OgnlException { } }

implementation: return getChildSource ( context , target , child , false ) ;


signature:
public class OgnlRuntime { /** * Attempts to get the java source string represented by the specific child expression
 * via the { @ link JavaSource # toGetSourceString ( OgnlContext , Object ) } interface method .
 * @ param context The ognl context to pass to the child .
 * @ param target The current object target to use .
 * @ param child The child expression .
 * @ param forceConversion If true , forces { @ link OgnlOps # convertValue ( Object , Class ) } conversions on the objects .
 * @ return The result of calling { @ link JavaSource # toGetSourceString ( OgnlContext , Object ) } plus additional
 * enclosures of { @ link OgnlOps # convertValue ( Object , Class , boolean ) } for conversions .
 * @ throws OgnlException Mandatory exception throwing catching . . ( blehh ) */
public static String getChildSource ( OgnlContext context , Object target , Node child , boolean forceConversion ) throws OgnlException { } }

implementation:
String pre = ( String ) context . get ( "_currentChain" ) ; if ( pre == null ) pre = "" ; try { child . getValue ( context , target ) ; } catch ( NullPointerException e ) { // ignore
} catch ( ArithmeticException e ) { context . setCurrentType ( int . class ) ; return "0" ; } catch ( Throwable t ) { throw OgnlOps . castToRuntime ( t ) ; } String source = null ; try { source = child . toGetSourceString ( context , target ) ; } catch ( Throwable t ) { throw OgnlOps . castToRuntime ( t ) ; } // handle root / method expressions that may not have proper root java source access
if ( ! ASTConst . class . isInstance ( child ) && ( target == null || context . getRoot ( ) != target ) ) { source = pre + source ; } if ( context . getRoot ( ) != null ) { source = ExpressionCompiler . getRootExpression ( child , context . getRoot ( ) , context ) + source ; context . setCurrentAccessor ( context . getRoot ( ) . getClass ( ) ) ; } if ( ASTChain . class . isInstance ( child ) ) { String cast = ( String ) context . remove ( ExpressionCompiler . PRE_CAST ) ; if ( cast == null ) cast = "" ; source = cast + source ; } if ( source == null || source . trim ( ) . length ( ) < 1 ) source = "null" ; return source ;


signature:
public class OgnlException { /** * Prints the stack trace for this ( and possibly the encapsulated ) exception on the
 * given print stream . */
public void printStackTrace ( java . io . PrintStream s ) { } }

implementation: synchronized ( s ) { super . printStackTrace ( s ) ; if ( _reason != null ) { s . println ( "/-- Encapsulated exception ------------\\" ) ; _reason . printStackTrace ( s ) ; s . println ( "\\--------------------------------------/" ) ; } }


signature:
public class OgnlException { /** * Prints the stack trace for this ( and possibly the encapsulated ) exception on the
 * given print writer . */
public void printStackTrace ( java . io . PrintWriter s ) { } }


signature:
public class ObjectNullHandler { /** * / * NullHandler interface */
public Object nullMethodResult ( Map context , Object target , String methodName , Object [ ] args ) { } }

implementation: return null ;