signature stringlengths 43 39.1k | implementation stringlengths 0 450k |
|---|---|
public class MirageUtil { /** * Returns the table name from the entity .
* < b > Note : < / b > This should not be used for Maps as entities .
* If the entity class has { @ link Table } annotation then this method returns the annotated table name ,
* otherwise creates table name from the entity class name using { @ link NameConverter } .
* @ param entityClass the entity class
* @ param nameConverter the name converter
* @ return the table name */
public static String getTableName ( Class < ? > entityClass , NameConverter nameConverter ) { } } | Table table = entityClass . getAnnotation ( Table . class ) ; if ( table != null ) { return table . name ( ) ; } else { return nameConverter . entityToTable ( entityClass . getName ( ) ) ; } |
public class ShapefileWriter { /** * Write the headers for this shapefile . Use this function before inserting the first geometry , then when all geometries are inserted .
* @ param type Shape type
* @ throws java . io . IOException */
public void writeHeaders ( ShapeType type ) throws IOException { } } | try { handler = type . getShapeHandler ( ) ; } catch ( ShapefileException se ) { throw new IOException ( "Error with type " + type , se ) ; } if ( indexBuffer != null ) { indexBuffer . flush ( ) ; } if ( shapeBuffer != null ) { shapeBuffer . flush ( ) ; } long fileLength = shpChannel . position ( ) ; shpChannel . position ( 0 ) ; shxChannel . position ( 0 ) ; ShapefileHeader header = new ShapefileHeader ( ) ; Envelope writeBounds = bounds ; if ( writeBounds == null ) { writeBounds = new Envelope ( ) ; } indexBuffer = new WriteBufferManager ( shxChannel ) ; shapeBuffer = new WriteBufferManager ( shpChannel ) ; header . write ( shapeBuffer , type , cnt , ( int ) ( fileLength / 2 ) , writeBounds . getMinX ( ) , writeBounds . getMinY ( ) , writeBounds . getMaxX ( ) , writeBounds . getMaxY ( ) ) ; header . write ( indexBuffer , type , cnt , 50 + 4 * cnt , writeBounds . getMinX ( ) , writeBounds . getMinY ( ) , writeBounds . getMaxX ( ) , writeBounds . getMaxY ( ) ) ; offset = 50 ; this . type = type ; |
public class FanartTvApi { /** * Get Label
* @ param id
* @ return
* @ throws FanartTvException */
public FTMusicLabel getMusicLabel ( String id ) throws FanartTvException { } } | URL url = ftapi . getImageUrl ( BaseType . LABEL , id ) ; String page = requestWebPage ( url ) ; FTMusicLabel label = null ; try { label = mapper . readValue ( page , FTMusicLabel . class ) ; } catch ( IOException ex ) { throw new FanartTvException ( ApiExceptionType . MAPPING_FAILED , "fauled to get Music Label with ID " + id , url , ex ) ; } return label ; |
public class CleartextPasswordContextListener { /** * Checks that passwords in the user files are not in clear text . If a hash
* value is found for some user , it is assumed that all user passwords have
* previously been hashed and no further checks are done . */
@ Override public void contextInitialized ( ServletContextEvent evt ) { } } | File usersDir = new File ( SetupOptions . getBaseConfigDirectory ( ) , "users" ) ; if ( ! usersDir . isDirectory ( ) ) { return ; } DocumentBuilder domBuilder = null ; try { domBuilder = DocumentBuilderFactory . newInstance ( ) . newDocumentBuilder ( ) ; } catch ( ParserConfigurationException e ) { LOGR . warning ( e . getMessage ( ) ) ; return ; } DOMImplementationLS lsFactory = buildDOM3LoadAndSaveFactory ( ) ; LSSerializer serializer = lsFactory . createLSSerializer ( ) ; serializer . getDomConfig ( ) . setParameter ( Constants . DOM_XMLDECL , Boolean . FALSE ) ; serializer . getDomConfig ( ) . setParameter ( Constants . DOM_FORMAT_PRETTY_PRINT , Boolean . TRUE ) ; LSOutput output = lsFactory . createLSOutput ( ) ; output . setEncoding ( "UTF-8" ) ; for ( File userDir : usersDir . listFiles ( ) ) { File userFile = new File ( userDir , "user.xml" ) ; if ( ! userFile . isFile ( ) ) { continue ; } try { Document doc = domBuilder . parse ( userFile ) ; Node pwNode = doc . getElementsByTagName ( "password" ) . item ( 0 ) ; if ( null == pwNode ) { continue ; } String password = pwNode . getTextContent ( ) ; if ( password . split ( ":" ) . length == 5 ) { break ; } pwNode . setTextContent ( PasswordStorage . createHash ( password ) ) ; // overwrite contents of file
// Fortify Mod : Make sure that the output stream is closed
// output . setByteStream ( new FileOutputStream ( userFile , false ) ) ;
FileOutputStream os = new FileOutputStream ( userFile , false ) ; output . setByteStream ( os ) ; serializer . write ( doc , output ) ; os . close ( ) ; } catch ( Exception e ) { LOGR . info ( e . getMessage ( ) ) ; continue ; } } |
public class OutputFileUriValueMarshaller { /** * Marshall the given parameter object . */
public void marshall ( OutputFileUriValue outputFileUriValue , ProtocolMarshaller protocolMarshaller ) { } } | if ( outputFileUriValue == null ) { throw new SdkClientException ( "Invalid argument passed to marshall(...)" ) ; } try { protocolMarshaller . marshall ( outputFileUriValue . getFileName ( ) , FILENAME_BINDING ) ; } catch ( Exception e ) { throw new SdkClientException ( "Unable to marshall request to JSON: " + e . getMessage ( ) , e ) ; } |
public class XmlRpcDataMarshaller { /** * Rebuild a List of Environment types based on the vector of Environment types parameters .
* @ param envTypesParams a { @ link java . util . Vector } object .
* @ return a List of Environment types based on the vector of Environment types parameters .
* @ see # toEnvironmentType ( Vector ) */
@ SuppressWarnings ( "unchecked" ) public static TreeSet < EnvironmentType > toEnvironmentTypeList ( Vector < Object > envTypesParams ) { } } | TreeSet < EnvironmentType > envTypes = new TreeSet < EnvironmentType > ( ) ; for ( Object envTypeParams : envTypesParams ) { envTypes . add ( toEnvironmentType ( ( Vector < Object > ) envTypeParams ) ) ; } return envTypes ; |
public class FLACDecoder { /** * Read a single metadata record .
* @ return The next metadata record
* @ throws IOException on read error */
public Metadata readNextMetadata ( ) throws IOException { } } | Metadata metadata = null ; boolean isLast = ( bitStream . readRawUInt ( Metadata . STREAM_METADATA_IS_LAST_LEN ) != 0 ) ; int type = bitStream . readRawUInt ( Metadata . STREAM_METADATA_TYPE_LEN ) ; int length = bitStream . readRawUInt ( Metadata . STREAM_METADATA_LENGTH_LEN ) ; if ( type == Metadata . METADATA_TYPE_STREAMINFO ) { metadata = streamInfo = new StreamInfo ( bitStream , length , isLast ) ; pcmProcessors . processStreamInfo ( ( StreamInfo ) metadata ) ; } else if ( type == Metadata . METADATA_TYPE_SEEKTABLE ) { metadata = seekTable = new SeekTable ( bitStream , length , isLast ) ; } else if ( type == Metadata . METADATA_TYPE_APPLICATION ) { metadata = new Application ( bitStream , length , isLast ) ; } else if ( type == Metadata . METADATA_TYPE_PADDING ) { metadata = new Padding ( bitStream , length , isLast ) ; } else if ( type == Metadata . METADATA_TYPE_VORBIS_COMMENT ) { metadata = vorbisComment = new VorbisComment ( bitStream , length , isLast ) ; } else if ( type == Metadata . METADATA_TYPE_CUESHEET ) { metadata = new CueSheet ( bitStream , length , isLast ) ; } else if ( type == Metadata . METADATA_TYPE_PICTURE ) { metadata = new Picture ( bitStream , length , isLast ) ; } else { metadata = new Unknown ( bitStream , length , isLast ) ; } frameListeners . processMetadata ( metadata ) ; // if ( isLast ) state = DECODER _ SEARCH _ FOR _ FRAME _ SYNC ;
return metadata ; |
public class Graph { /** * Update the underlying database with changes made on the graph
* @ return a list of errors , which is empty if no errors occurred */
List < JcError > store ( Map < Long , Integer > elementVersionsMap ) { } } | List < JcError > ret = null ; ITransaction txToClose = null ; try { if ( isModified ( ) ) { txToClose = this . resultHandler . createLockingTxIfNeeded ( ) ; ret = this . resultHandler . store ( elementVersionsMap ) ; } else ret = Collections . emptyList ( ) ; } finally { if ( txToClose != null ) { // we have created the transaction
if ( ret == null ) ret = new ArrayList < JcError > ( ) ; ret . addAll ( txToClose . close ( ) ) ; } } return ret ; |
public class diff_match_patch { /** * Compute and return the source text ( all equalities and deletions ) .
* @ param diffs
* LinkedList of Diff objects .
* @ return Source text . */
public String diff_text1 ( LinkedList < Diff > diffs ) { } } | StringBuilder text = new StringBuilder ( ) ; for ( Diff aDiff : diffs ) { if ( aDiff . operation != Operation . INSERT ) { text . append ( aDiff . text ) ; } } return text . toString ( ) ; |
public class IonSystemBuilder { /** * Builds a new { @ link IonSystem } instance based on this builder ' s
* configuration properties . */
public final IonSystem build ( ) { } } | IonCatalog catalog = ( myCatalog != null ? myCatalog : new SimpleCatalog ( ) ) ; IonTextWriterBuilder twb = IonTextWriterBuilder . standard ( ) . withCharsetAscii ( ) ; twb . setCatalog ( catalog ) ; _Private_IonBinaryWriterBuilder bwb = _Private_IonBinaryWriterBuilder . standard ( ) ; bwb . setCatalog ( catalog ) ; bwb . setStreamCopyOptimized ( myStreamCopyOptimized ) ; // TODO Would be nice to remove this since it ' s implied by the BWB .
// However that currently causes problems in the IonSystem
// constructors ( which get a null initialSymtab ) .
SymbolTable systemSymtab = _Private_Utils . systemSymtab ( 1 ) ; bwb . setInitialSymbolTable ( systemSymtab ) ; // This is what we need , more or less .
// bwb = bwb . fillDefaults ( ) ;
IonReaderBuilder rb = IonReaderBuilder . standard ( ) . withCatalog ( catalog ) ; IonSystem sys = newLiteSystem ( twb , bwb , rb ) ; return sys ; |
public class ActorSDKLauncher { /** * Launch User Profile Activity
* @ param context current context
* @ param uid user id */
public static void startProfileActivity ( Context context , int uid ) { } } | // Ignore call if context is empty , simple work - around when fragment was disconnected from
// activity
if ( context == null ) { return ; } Bundle b = new Bundle ( ) ; b . putInt ( Intents . EXTRA_UID , uid ) ; startActivity ( context , b , ProfileActivity . class ) ; |
public class DiscriminationProcessImpl { /** * @ see
* com . ibm . ws . channelfw . internal . discrim . DiscriminationGroup # removeDiscriminator
* ( com . ibm . wsspi . channelfw . Discriminator ) */
@ Override public void removeDiscriminator ( Discriminator d ) throws DiscriminationProcessException { } } | if ( TraceComponent . isAnyTracingEnabled ( ) && tc . isDebugEnabled ( ) ) { Tr . debug ( tc , "removeDiscriminator: " + d ) ; } if ( status == STARTED ) { DiscriminationProcessException e = new DiscriminationProcessException ( "Should not remove form DiscriminationGroup while started!" ) ; FFDCFilter . processException ( e , getClass ( ) . getName ( ) + ".removeDiscriminator" , "401" , this , new Object [ ] { d } ) ; throw e ; } // remove it from the list
if ( ! discAL . remove ( d ) ) { NoSuchElementException e = new NoSuchElementException ( "Discriminator does not exist, " + d . getChannel ( ) . getName ( ) ) ; FFDCFilter . processException ( e , getClass ( ) . getName ( ) + ".removeDiscriminator" , "410" , this , new Object [ ] { d } ) ; throw e ; } this . changed = true ; String chanName = d . getChannel ( ) . getName ( ) ; if ( channelList == null ) { NoSuchElementException e = new NoSuchElementException ( "No Channel's exist, " + chanName ) ; FFDCFilter . processException ( e , getClass ( ) . getName ( ) + ".removeDiscriminator" , "422" , this , new Object [ ] { d } ) ; throw e ; } Channel [ ] oldList = channelList ; channelList = new Channel [ oldList . length - 1 ] ; for ( int i = 0 , j = 0 ; i < oldList . length ; i ++ ) { String tempName = oldList [ i ] . getName ( ) ; if ( tempName != null && ! ( tempName . equals ( chanName ) ) ) { if ( j >= oldList . length ) { NoSuchElementException e = new NoSuchElementException ( "Channel does not exist, " + d . getChannel ( ) . getName ( ) ) ; FFDCFilter . processException ( e , getClass ( ) . getName ( ) + ".removeDiscriminator" , "440" , this , new Object [ ] { d } ) ; throw e ; } channelList [ j ++ ] = oldList [ i ] ; } else if ( chanName == null ) { DiscriminationProcessException e = new DiscriminationProcessException ( "Channel does not have a name associated with it, " + oldList [ i ] ) ; FFDCFilter . processException ( e , getClass ( ) . getName ( ) + ".removeDiscriminator" , "454" , this , new Object [ ] { oldList [ i ] } ) ; throw e ; } } // remove it from the node list
removeDiscriminatorNode ( d ) ; |
public class ElementMatchers { /** * Matches a method ' s return type ' s erasure by the given matcher .
* @ param matcher The matcher to apply to a method ' s return type ' s erasure .
* @ param < T > The type of the matched object .
* @ return A matcher that matches the matched method ' s return type ' s erasure . */
public static < T extends MethodDescription > ElementMatcher . Junction < T > returns ( ElementMatcher < ? super TypeDescription > matcher ) { } } | return returnsGeneric ( erasure ( matcher ) ) ; |
public class LoadBalancerDescription { /** * The listeners for the load balancer .
* < b > NOTE : < / b > This method appends the values to the existing list ( if any ) . Use
* { @ link # setListenerDescriptions ( java . util . Collection ) } or { @ link # withListenerDescriptions ( java . util . Collection ) }
* if you want to override the existing values .
* @ param listenerDescriptions
* The listeners for the load balancer .
* @ return Returns a reference to this object so that method calls can be chained together . */
public LoadBalancerDescription withListenerDescriptions ( ListenerDescription ... listenerDescriptions ) { } } | if ( this . listenerDescriptions == null ) { setListenerDescriptions ( new com . amazonaws . internal . SdkInternalList < ListenerDescription > ( listenerDescriptions . length ) ) ; } for ( ListenerDescription ele : listenerDescriptions ) { this . listenerDescriptions . add ( ele ) ; } return this ; |
public class JmsMessagingClient { /** * Starts the MessagingClient . This method must be called
* in order to receive messages .
* @ param wait Set to true to wait until the startup process
* is complete before returning . Set to false to
* allow for asynchronous startup . */
public void start ( boolean wait ) throws MessagingException { } } | Thread connector = new JMSBrokerConnector ( ) ; connector . start ( ) ; if ( wait ) { int maxWait = RETRY_INTERVAL * MAX_RETRIES ; int waitTime = 0 ; while ( ! isConnected ( ) ) { if ( waitTime < maxWait ) { try { Thread . sleep ( 100 ) ; waitTime += 100 ; } catch ( InterruptedException ie ) { Thread . currentThread ( ) . interrupt ( ) ; } } else { throw new MessagingException ( "Timeout reached waiting " + "for messaging client to start." ) ; } } } |
public class HELM1Utils { /** * method to transform the second and third section ( connection + group
* section ) to HELM1 - Format
* @ param connections List of ConnectionNotation
* @ return second and third section in String format
* @ throws HELM1ConverterException if it can not be downcasted to HELM1 , HELM2
* features were there */
private static List < String > setStandardHELMSecondSectionAndThirdSection ( List < ConnectionNotation > connections ) throws HELM1ConverterException { } } | List < String > result = new ArrayList < String > ( ) ; StringBuilder notationSecond = new StringBuilder ( ) ; StringBuilder notationThird = new StringBuilder ( ) ; for ( ConnectionNotation connectionNotation : connections ) { /* pairs will be not shown */
if ( ! ( connectionNotation . toHELM ( ) . equals ( "" ) ) ) { notationSecond . append ( connectionNotation . toHELM ( ) + "|" ) ; } else { notationThird . append ( connectionNotation . toHELM2 ( ) + "|" ) ; } } if ( notationSecond . length ( ) > 1 ) { notationSecond . setLength ( notationSecond . length ( ) - 1 ) ; } if ( notationThird . length ( ) > 1 ) { notationThird . setLength ( notationThird . length ( ) - 1 ) ; } result . add ( notationSecond . toString ( ) ) ; result . add ( notationThird . toString ( ) ) ; return result ; |
public class MtasBasicParser { /** * Compute variables from object .
* @ param object the object
* @ param currentList the current list
* @ param variables the variables */
protected void computeVariablesFromObject ( MtasParserObject object , Map < String , List < MtasParserObject > > currentList , Map < String , Map < String , String > > variables ) { } } | MtasParserType < MtasParserVariable > parserType = object . getType ( ) ; String id = object . getId ( ) ; if ( id != null ) { for ( MtasParserVariable variable : parserType . getItems ( ) ) { if ( ! variables . containsKey ( variable . variable ) ) { variables . put ( variable . variable , new HashMap < String , String > ( ) ) ; } StringBuilder builder = new StringBuilder ( ) ; for ( MtasParserVariableValue variableValue : variable . values ) { if ( variableValue . type . equals ( "attribute" ) ) { String subValue = object . getAttribute ( variableValue . name ) ; if ( subValue != null ) { builder . append ( subValue ) ; } } } variables . get ( variable . variable ) . put ( id , builder . toString ( ) ) ; } } |
public class AuthorizationResult { /** * Utility method to throw a standard failure if { @ link # getDecision ( ) } is
* { @ link org . jboss . as . controller . access . AuthorizationResult . Decision # DENY } .
* @ param operation the operation the triggered this authorization result . Cannot be { @ code null }
* @ param targetAddress the target address of the request that triggered this authorization result . Cannot be { @ code null }
* @ throws OperationFailedException if { @ link # getDecision ( ) } is
* { @ link org . jboss . as . controller . access . AuthorizationResult . Decision # DENY } */
public void failIfDenied ( ModelNode operation , PathAddress targetAddress ) throws OperationFailedException { } } | if ( decision == AuthorizationResult . Decision . DENY ) { throw ControllerLogger . ACCESS_LOGGER . unauthorized ( operation . get ( OP ) . asString ( ) , targetAddress , explanation ) ; } |
public class AbstractResultSetWrapper { /** * { @ inheritDoc }
* @ see java . sql . ResultSet # getTimestamp ( java . lang . String , java . util . Calendar ) */
@ Override public Timestamp getTimestamp ( final String columnLabel , final Calendar cal ) throws SQLException { } } | return wrapped . getTimestamp ( columnLabel , cal ) ; |
public class CommerceUserSegmentEntryServiceBaseImpl { /** * Sets the group local service .
* @ param groupLocalService the group local service */
public void setGroupLocalService ( com . liferay . portal . kernel . service . GroupLocalService groupLocalService ) { } } | this . groupLocalService = groupLocalService ; |
public class AnnotationInfoImpl { /** * base value . */
public AnnotationValueImpl addAnnotationValue ( String name , Object value ) { } } | AnnotationValueImpl annotationValue = new AnnotationValueImpl ( value ) ; addAnnotationValue ( name , annotationValue ) ; return annotationValue ; |
public class KeenClient { /** * Handles a response from the Keen service to a batch post events operation . In particular ,
* this method will iterate through the responses and remove any successfully processed events
* ( or events which failed for known fatal reasons ) from the event store so they won ' t be sent
* in subsequent posts .
* @ param handles A map from collection names to lists of handles in the event store . This is
* referenced against the response from the server to determine which events to
* remove from the store .
* @ param response The response from the server .
* @ throws IOException If there is an error removing events from the store . */
@ SuppressWarnings ( "unchecked" ) private void handleAddEventsResponse ( Map < String , List < Object > > handles , String response ) throws IOException { } } | // Parse the response into a map .
StringReader reader = new StringReader ( response ) ; Map < String , Object > responseMap ; responseMap = jsonHandler . readJson ( reader ) ; // It ' s not obvious what the best way is to try and recover from them , but just hoping it
// doesn ' t happen is probably the wrong answer .
// Loop through all the event collections .
for ( Map . Entry < String , Object > entry : responseMap . entrySet ( ) ) { String collectionName = entry . getKey ( ) ; // Get the list of handles in this collection .
List < Object > collectionHandles = handles . get ( collectionName ) ; // Iterate through the elements in the collection
List < Map < String , Object > > eventResults = ( List < Map < String , Object > > ) entry . getValue ( ) ; int index = 0 ; for ( Map < String , Object > eventResult : eventResults ) { // now loop through each event collection ' s individual results
boolean removeCacheEntry = true ; boolean success = ( Boolean ) eventResult . get ( KeenConstants . SUCCESS_PARAM ) ; if ( ! success ) { // grab error code and description
Map errorDict = ( Map ) eventResult . get ( KeenConstants . ERROR_PARAM ) ; String errorCode = ( String ) errorDict . get ( KeenConstants . NAME_PARAM ) ; if ( errorCode . equals ( KeenConstants . INVALID_COLLECTION_NAME_ERROR ) || errorCode . equals ( KeenConstants . INVALID_PROPERTY_NAME_ERROR ) || errorCode . equals ( KeenConstants . INVALID_PROPERTY_VALUE_ERROR ) ) { removeCacheEntry = true ; KeenLogging . log ( "An invalid event was found. Deleting it. Error: " + errorDict . get ( KeenConstants . DESCRIPTION_PARAM ) ) ; } else { String description = ( String ) errorDict . get ( KeenConstants . DESCRIPTION_PARAM ) ; removeCacheEntry = false ; KeenLogging . log ( String . format ( Locale . US , "The event could not be inserted for some reason. " + "Error name and description: %s %s" , errorCode , description ) ) ; } } // If the cache entry should be removed , get the handle at the appropriate index
// and ask the event store to remove it .
if ( removeCacheEntry ) { Object handle = collectionHandles . get ( index ) ; // Try to remove the object from the cache . Catch and log exceptions to prevent
// a single failure from derailing the rest of the cleanup .
try { eventStore . remove ( handle ) ; } catch ( IOException e ) { KeenLogging . log ( "Failed to remove object '" + handle + "' from cache" ) ; } } index ++ ; } } |
public class RabbitMqRequestHandler { /** * { @ inheritDoc } */
@ Override public void addEvent ( Event event ) throws NotAuthorizedException { } } | if ( ! initializedProperly ) { throw new IllegalStateException ( getUninitializedMessage ( ) ) ; } appSensorServer . getEventStore ( ) . addEvent ( event ) ; |
public class SubmitterNameIndexRenderer { /** * { @ inheritDoc } */
@ Override public String getIndexName ( ) { } } | final Submitter submitter = submitterRenderer . getGedObject ( ) ; if ( ! submitter . isSet ( ) ) { return "" ; } final String nameHtml = getNameHtml ( submitter ) ; return "<a class=\"name\" href=\"submitter?db=" + submitter . getDbName ( ) + "&id=" + submitter . getString ( ) + "\">" + nameHtml + " [" + submitter . getString ( ) + "]" + "</a>" ; |
public class HtmlSerialFieldWriter { /** * Return the header for serializable fields content section .
* @ param isLastContent true if the cotent being documented is the last content .
* @ return a content tree for the header */
public Content getFieldsContentHeader ( boolean isLastContent ) { } } | HtmlTree li = new HtmlTree ( HtmlTag . LI ) ; if ( isLastContent ) li . addStyle ( HtmlStyle . blockListLast ) ; else li . addStyle ( HtmlStyle . blockList ) ; return li ; |
public class AbstractMessageAwareFiller { /** * Returns the value of first property represented by the provided alias
* that has a value ( not { @ code null } ) .
* @ param alias
* the property alias to resolve
* @ return the property value or null */
protected String getProperty ( String alias ) { } } | String k = resolveKey ( alias ) ; return k == null ? null : resolver . getProperty ( k ) ; |
public class ClientFactory { /** * Creates a message sender asynchronously to the entity using the client settings .
* @ param namespaceEndpointURI endpoint uri of entity namespace
* @ param entityPath path of entity
* @ param clientSettings client settings
* @ return a CompletableFuture representing the pending creating of IMessageSender instance */
public static CompletableFuture < IMessageSender > createMessageSenderFromEntityPathAsync ( URI namespaceEndpointURI , String entityPath , ClientSettings clientSettings ) { } } | return createMessageSenderFromEntityPathAsync ( namespaceEndpointURI , entityPath , null , clientSettings ) ; |
public class RestletUtilSesameRealm { /** * Finds a user in the organization based on its identifier .
* @ param userIdentifier
* The identifier to match .
* @ return The matched user or null . */
public RestletUtilUser findUser ( final String userIdentifier ) { } } | if ( userIdentifier == null ) { throw new NullPointerException ( "User identifier was null" ) ; } RestletUtilUser result = null ; RepositoryConnection conn = null ; try { conn = this . repository . getConnection ( ) ; final String query = this . buildSparqlQueryToFindUser ( userIdentifier , false ) ; this . log . debug ( "findUser: query={}" , query ) ; final TupleQuery tupleQuery = conn . prepareTupleQuery ( QueryLanguage . SPARQL , query ) ; final TupleQueryResult queryResult = tupleQuery . evaluate ( ) ; try { if ( queryResult . hasNext ( ) ) { final BindingSet bindingSet = queryResult . next ( ) ; result = this . buildRestletUserFromSparqlResult ( userIdentifier , bindingSet ) ; } else { this . log . info ( "Could not find user with identifier, returning null: {}" , userIdentifier ) ; } } finally { queryResult . close ( ) ; } } catch ( final RepositoryException e ) { throw new RuntimeException ( "Failure finding user in repository" , e ) ; } catch ( final MalformedQueryException e ) { throw new RuntimeException ( "Failure finding user in repository" , e ) ; } catch ( final QueryEvaluationException e ) { throw new RuntimeException ( "Failure finding user in repository" , e ) ; } finally { try { conn . close ( ) ; } catch ( final RepositoryException e ) { this . log . error ( "Failure to close connection" , e ) ; } } return result ; |
public class DateTimeFormatterBuilder { /** * Internal method to create a DateTimeParser instance using all the
* appended elements .
* Most applications will not use this method .
* If you want a parser in an application , call { @ link # toFormatter ( ) }
* and just use the parsing API .
* Subsequent changes to this builder do not affect the returned parser .
* @ throws UnsupportedOperationException if parsing is not supported */
public DateTimeParser toParser ( ) { } } | Object f = getFormatter ( ) ; if ( isParser ( f ) ) { InternalParser ip = ( InternalParser ) f ; return InternalParserDateTimeParser . of ( ip ) ; } throw new UnsupportedOperationException ( "Parsing is not supported" ) ; |
public class Payload { /** * Sets the value used to associate a client session with an ID token or { @ code null } for none .
* Overriding is only supported for the purpose of calling the super implementation and changing
* the return type , but nothing else . */
public Payload setNonce ( String nonce ) { } } | this . nonce = nonce ; this . put ( PayloadConstants . NONCE , nonce ) ; return this ; |
public class CmsEntityBackend { /** * Generates a new entity id . < p >
* @ return the generated id */
private String generateId ( ) { } } | m_count ++ ; String id = "generic_id" + m_count ; while ( m_entities . containsKey ( id ) ) { m_count ++ ; id = "generic_id" + m_count ; } return id ; |
public class WyilFile { /** * Construct a binding function from another binding where a given set of
* variables are removed . This is necessary in situations where the given
* variables are captured .
* @ param binding
* @ param variables
* @ return */
public static java . util . function . Function < Identifier , SyntacticItem > removeFromBinding ( java . util . function . Function < Identifier , SyntacticItem > binding , Tuple < Identifier > variables ) { } } | return ( Identifier var ) -> { // Sanity check whether this is a variable which is being removed
for ( int i = 0 ; i != variables . size ( ) ; ++ i ) { if ( var . equals ( variables . get ( i ) ) ) { return null ; } } // Not being removed , reuse existing binding
return binding . apply ( var ) ; } ; |
public class JingleManager { /** * Creates an Jingle session to start a communication with another user .
* @ param responder the fully qualified jabber ID with resource of the other
* user .
* @ return The session on which the negotiation can be run . */
public JingleSession createOutgoingJingleSession ( EntityFullJid responder ) throws XMPPException { } } | JingleSession session = new JingleSession ( connection , null , connection . getUser ( ) , responder , jingleMediaManagers ) ; triggerSessionCreated ( session ) ; return session ; |
public class Parameters { /** * Gets a parameter whose value is a ( possibly empty ) comma - separated list of Symbols . */
public List < Symbol > getSymbolList ( final String param ) { } } | return get ( param , new StringToSymbolList ( "," ) , new AlwaysValid < List < Symbol > > ( ) , "comma-separated list of strings" ) ; |
public class FilterContext { /** * Registers CounterRequestMXBean beans for each of the enabled counters .
* The beans are registered under " net . bull . javamelody : type = CounterRequest , context = < webapp > , name = < counter name > " names .
* @ author Alexey Pushkin */
private void initJmxExpose ( ) { } } | final String packageName = getClass ( ) . getName ( ) . substring ( 0 , getClass ( ) . getName ( ) . length ( ) - getClass ( ) . getSimpleName ( ) . length ( ) - 1 ) ; String webapp = Parameters . getContextPath ( Parameters . getServletContext ( ) ) ; if ( webapp . length ( ) >= 1 && webapp . charAt ( 0 ) == '/' ) { webapp = webapp . substring ( 1 , webapp . length ( ) ) ; } final List < Counter > counters = collector . getCounters ( ) ; final MBeanServer platformMBeanServer = MBeans . getPlatformMBeanServer ( ) ; try { for ( final Counter counter : counters ) { if ( ! Parameters . isCounterHidden ( counter . getName ( ) ) ) { final CounterRequestMXBean . CounterRequestMXBeanImpl mxBean = new CounterRequestMXBean . CounterRequestMXBeanImpl ( counter ) ; final ObjectName name = new ObjectName ( packageName + ":type=CounterRequest,context=" + webapp + ",name=" + counter . getName ( ) ) ; platformMBeanServer . registerMBean ( mxBean , name ) ; jmxNames . add ( name ) ; } } LOG . debug ( "JMX mbeans registered" ) ; } catch ( final JMException e ) { LOG . warn ( "failed to register JMX mbeans" , e ) ; } |
public class A_CmsDirectEditButtons { /** * Updates the position of the expired resources overlay if present . < p >
* @ param positioningParent the positioning parent element */
protected void updateExpiredOverlayPosition ( Element positioningParent ) { } } | if ( m_expiredOverlay != null ) { Style expiredStyle = m_expiredOverlay . getStyle ( ) ; expiredStyle . setHeight ( m_position . getHeight ( ) + 4 , Unit . PX ) ; expiredStyle . setWidth ( m_position . getWidth ( ) + 4 , Unit . PX ) ; expiredStyle . setTop ( m_position . getTop ( ) - positioningParent . getAbsoluteTop ( ) - 2 , Unit . PX ) ; expiredStyle . setLeft ( m_position . getLeft ( ) - positioningParent . getAbsoluteLeft ( ) - 2 , Unit . PX ) ; } |
public class OutputColumns { /** * Gets the column type ( if specified ) by index
* @ param index
* the index of the column
* @ return the type ( if specified ) of the column */
public Class < ? > getColumnType ( final int index ) { } } | final Class < ? > cls = columnTypes [ index ] ; if ( cls == null ) { return Object . class ; } return cls ; |
public class IonReaderTextRawTokensX { /** * this is used to load a previously marked set of bytes
* into the StringBuilder without escaping . It expects
* the caller to have set a save point so that the EOF
* will stop us at the right time .
* This does handle UTF8 decoding and surrogate encoding
* as the bytes are transfered . */
protected void load_raw_characters ( StringBuilder sb ) throws IOException { } } | int c = read_char ( ) ; for ( ; ; ) { c = read_char ( ) ; switch ( c ) { case CharacterSequence . CHAR_SEQ_ESCAPED_NEWLINE_SEQUENCE_1 : case CharacterSequence . CHAR_SEQ_ESCAPED_NEWLINE_SEQUENCE_2 : case CharacterSequence . CHAR_SEQ_ESCAPED_NEWLINE_SEQUENCE_3 : // WAS : case IonTokenConstsX . ESCAPED _ NEWLINE _ SEQUENCE :
continue ; case - 1 : return ; default : if ( ! IonTokenConstsX . is7bitValue ( c ) ) { c = read_large_char_sequence ( c ) ; } } if ( IonUTF8 . needsSurrogateEncoding ( c ) ) { sb . append ( IonUTF8 . highSurrogate ( c ) ) ; c = IonUTF8 . lowSurrogate ( c ) ; } sb . append ( ( char ) c ) ; } |
public class VirtualNetworkGatewaysInner { /** * The GetBgpPeerStatus operation retrieves the status of all BGP peers .
* @ param resourceGroupName The name of the resource group .
* @ param virtualNetworkGatewayName The name of the virtual network gateway .
* @ throws IllegalArgumentException thrown if parameters fail the validation
* @ throws CloudException thrown if the request is rejected by server
* @ throws RuntimeException all other wrapped checked exceptions if the request fails to be sent
* @ return the BgpPeerStatusListResultInner object if successful . */
public BgpPeerStatusListResultInner beginGetBgpPeerStatus ( String resourceGroupName , String virtualNetworkGatewayName ) { } } | return beginGetBgpPeerStatusWithServiceResponseAsync ( resourceGroupName , virtualNetworkGatewayName ) . toBlocking ( ) . single ( ) . body ( ) ; |
public class ClusteringTreeHeadNode { /** * Projects a point to a random projection .
* @ param pointA
* the point to project
* @ param i
* the index of the projection
* @ return the position of the point */
private double project ( double [ ] pointA , int i ) { } } | assert ( this . projections . size ( ) < i && this . projections . get ( i ) . length == pointA . length ) ; return Metric . dotProduct ( pointA , this . projections . get ( i ) ) ; |
public class ContextManager { /** * Start the context manager . This initiates the root context .
* @ throws ContextClientCodeException if the root context can ' t be instantiated . */
public void start ( ) throws ContextClientCodeException { } } | synchronized ( this . contextStack ) { LOG . log ( Level . FINEST , "Instantiating root context." ) ; this . contextStack . push ( this . launchContext . get ( ) . getRootContext ( ) ) ; if ( this . launchContext . get ( ) . getInitialTaskConfiguration ( ) . isPresent ( ) ) { LOG . log ( Level . FINEST , "Launching the initial Task" ) ; try { this . contextStack . peek ( ) . startTask ( this . launchContext . get ( ) . getInitialTaskConfiguration ( ) . get ( ) ) ; } catch ( final TaskClientCodeException e ) { this . handleTaskException ( e ) ; } } } |
public class StructurePairAligner { /** * calculate the protein structure superimposition , between two sets of
* atoms .
* @ param ca1
* set of Atoms of structure 1
* @ param ca2
* set of Atoms of structure 2
* @ param params
* the parameters to use for the alignment
* @ throws StructureException */
public void align ( Atom [ ] ca1 , Atom [ ] ca2 , StrucAligParameters params ) throws StructureException { } } | reset ( ) ; this . params = params ; long timeStart = System . currentTimeMillis ( ) ; // step 1 get all Diagonals of length X that are similar between both
// structures
logger . debug ( " length atoms1:" + ca1 . length ) ; logger . debug ( " length atoms2:" + ca2 . length ) ; logger . debug ( "step 1 - get fragments with similar intramolecular distances " ) ; int k = params . getDiagonalDistance ( ) ; int k2 = params . getDiagonalDistance2 ( ) ; int fragmentLength = params . getFragmentLength ( ) ; if ( ca1 . length < ( fragmentLength + 1 ) ) { throw new StructureException ( "structure 1 too short (" + ca1 . length + "), can not align" ) ; } if ( ca2 . length < ( fragmentLength + 1 ) ) { throw new StructureException ( "structure 2 too short (" + ca2 . length + "), can not align" ) ; } int rows = ca1 . length - fragmentLength + 1 ; int cols = ca2 . length - fragmentLength + 1 ; distanceMatrix = new Matrix ( rows , cols , 0.0 ) ; double [ ] dist1 = AlignUtils . getDiagonalAtK ( ca1 , k ) ; double [ ] dist2 = AlignUtils . getDiagonalAtK ( ca2 , k ) ; double [ ] dist3 = new double [ 0 ] ; double [ ] dist4 = new double [ 0 ] ; if ( k2 > 0 ) { dist3 = AlignUtils . getDiagonalAtK ( ca1 , k2 ) ; dist4 = AlignUtils . getDiagonalAtK ( ca2 , k2 ) ; } double [ ] [ ] utmp = new double [ ] [ ] { { 0 , 0 , 1 } } ; Atom unitvector = new AtomImpl ( ) ; unitvector . setCoords ( utmp [ 0 ] ) ; List < FragmentPair > fragments = new ArrayList < FragmentPair > ( ) ; for ( int i = 0 ; i < rows ; i ++ ) { Atom [ ] catmp1 = AlignUtils . getFragment ( ca1 , i , fragmentLength ) ; Atom center1 = AlignUtils . getCenter ( ca1 , i , fragmentLength ) ; for ( int j = 0 ; j < cols ; j ++ ) { double rdd1 = AlignUtils . rms_dk_diag ( dist1 , dist2 , i , j , fragmentLength , k ) ; double rdd2 = 0 ; if ( k2 > 0 ) rdd2 = AlignUtils . rms_dk_diag ( dist3 , dist4 , i , j , fragmentLength , k2 ) ; double rdd = rdd1 + rdd2 ; distanceMatrix . set ( i , j , rdd ) ; if ( rdd < params . getFragmentMiniDistance ( ) ) { FragmentPair f = new FragmentPair ( fragmentLength , i , j ) ; Atom [ ] catmp2 = AlignUtils . getFragment ( ca2 , j , fragmentLength ) ; Atom center2 = AlignUtils . getCenter ( ca2 , j , fragmentLength ) ; f . setCenter1 ( center1 ) ; f . setCenter2 ( center2 ) ; Matrix4d t = SuperPositions . superpose ( Calc . atomsToPoints ( catmp1 ) , Calc . atomsToPoints ( catmp2 ) ) ; Matrix rotmat = Matrices . getRotationJAMA ( t ) ; f . setRot ( rotmat ) ; Atom aunitv = ( Atom ) unitvector . clone ( ) ; Calc . rotate ( aunitv , rotmat ) ; f . setUnitv ( aunitv ) ; boolean doNotAdd = false ; if ( params . reduceInitialFragments ( ) ) { doNotAdd = FragmentJoiner . reduceFragments ( fragments , f , distanceMatrix ) ; } if ( doNotAdd ) continue ; fragments . add ( f ) ; } } } notifyFragmentListeners ( fragments ) ; FragmentPair [ ] fp = fragments . toArray ( new FragmentPair [ fragments . size ( ) ] ) ; setFragmentPairs ( fp ) ; logger . debug ( " got # fragment pairs: {}" , fp . length ) ; logger . debug ( "step 2 - join fragments" ) ; // step 2 combine them to possible models
FragmentJoiner joiner = new FragmentJoiner ( ) ; JointFragments [ ] frags ; if ( params . isJoinFast ( ) ) { // apply the quick alignment procedure .
// less quality in alignments , better for DB searches . . .
frags = joiner . approach_ap3 ( ca1 , ca2 , fp , params ) ; joiner . extendFragments ( ca1 , ca2 , frags , params ) ; } else if ( params . isJoinPlo ( ) ) { // this approach by StrComPy ( peter lackner ) :
frags = joiner . frag_pairwise_compat ( fp , params . getAngleDiff ( ) , params . getFragCompat ( ) , params . getMaxrefine ( ) ) ; } else { // my first implementation
frags = joiner . approach_ap3 ( ca1 , ca2 , fp , params ) ; } notifyJointFragments ( frags ) ; logger . debug ( " number joint fragments: " , frags . length ) ; logger . debug ( "step 3 - refine alignments" ) ; List < AlternativeAlignment > aas = new ArrayList < AlternativeAlignment > ( ) ; for ( int i = 0 ; i < frags . length ; i ++ ) { JointFragments f = frags [ i ] ; AlternativeAlignment a = new AlternativeAlignment ( ) ; a . apairs_from_idxlst ( f ) ; a . setAltAligNumber ( i + 1 ) ; a . setDistanceMatrix ( distanceMatrix ) ; try { if ( params . getMaxIter ( ) > 0 ) { a . refine ( params , ca1 , ca2 ) ; } else { a . finish ( params , ca1 , ca2 ) ; } } catch ( StructureException e ) { logger . error ( "Refinement of fragment {} failed" , i , e ) ; } a . calcScores ( ca1 , ca2 ) ; aas . add ( a ) ; } // sort the alternative alignments
Comparator < AlternativeAlignment > comp = new AltAligComparator ( ) ; Collections . sort ( aas , comp ) ; Collections . reverse ( aas ) ; alts = aas . toArray ( new AlternativeAlignment [ aas . size ( ) ] ) ; // do final numbering of alternative solutions
int aanbr = 0 ; for ( AlternativeAlignment a : alts ) { aanbr ++ ; a . setAltAligNumber ( aanbr ) ; } logger . debug ( "total calculation time: {} ms." , ( System . currentTimeMillis ( ) - timeStart ) ) ; |
public class BasicTagList { /** * Returns a new tag list with an additional tag . If { @ code key } is
* already present in this tag list the value will be overwritten with
* { @ code value } . */
public BasicTagList copy ( String key , String value ) { } } | return concat ( this , Tags . newTag ( key , value ) ) ; |
public class ModifiersPreprocessor { /** * Fills the annotation cache for the specified class . This scans all fields of the class and
* checks if they have modifier annotations . This information is saved in a synchronized static
* cache .
* @ param objectClass the class to scan for preprocessing annotations
* @ param processors the map of registered preprocessors ( the map key is the annotation type ) */
private synchronized static void fillCache ( Class objectClass , Map < Class < ? extends Annotation > , IModifier > processors ) { } } | if ( cache . containsKey ( objectClass ) ) { return ; } final Map < Field , Set < Class < ? extends Annotation > > > classCache = new HashMap < > ( ) ; cache . put ( objectClass , classCache ) ; // for each field . . .
for ( Field field : getAllFields ( objectClass ) ) { final Set < Class < ? extends Annotation > > fieldCache = new HashSet < > ( ) ; // for each annotation on that field . . .
for ( Annotation annotation : field . getAnnotations ( ) ) { // cache the annotation type if there is a registered preprocessor for it
final Class < ? extends Annotation > annotationType = annotation . annotationType ( ) ; if ( processors . containsKey ( annotationType ) ) { fieldCache . add ( annotationType ) ; } } if ( ! fieldCache . isEmpty ( ) ) { classCache . put ( field , fieldCache ) ; } } |
public class JDBDT { /** * Dump the database contents for a data source ( file variant ) .
* The output file will be GZIP - compressed if it has a < code > . gz < / code > extension .
* @ param dataSource Data source .
* @ param outputFile Output file . */
public static void dump ( DataSource dataSource , File outputFile ) { } } | try ( Log log = Log . create ( outputFile ) ) { log . write ( CallInfo . create ( ) , executeQuery ( dataSource ) ) ; } |
public class ImportRestApiRequestMarshaller { /** * Marshall the given parameter object . */
public void marshall ( ImportRestApiRequest importRestApiRequest , ProtocolMarshaller protocolMarshaller ) { } } | if ( importRestApiRequest == null ) { throw new SdkClientException ( "Invalid argument passed to marshall(...)" ) ; } try { protocolMarshaller . marshall ( importRestApiRequest . getFailOnWarnings ( ) , FAILONWARNINGS_BINDING ) ; protocolMarshaller . marshall ( importRestApiRequest . getParameters ( ) , PARAMETERS_BINDING ) ; protocolMarshaller . marshall ( importRestApiRequest . getBody ( ) , BODY_BINDING ) ; } catch ( Exception e ) { throw new SdkClientException ( "Unable to marshall request to JSON: " + e . getMessage ( ) , e ) ; } |
public class ScalingPolicy { /** * Create a scaling policy to configure a stream to have a fixed number of segments .
* @ param numSegments Fixed number of segments for the stream .
* @ return Scaling policy object . */
public static ScalingPolicy fixed ( int numSegments ) { } } | Preconditions . checkArgument ( numSegments > 0 , "Number of segments should be > 0." ) ; return new ScalingPolicy ( ScaleType . FIXED_NUM_SEGMENTS , 0 , 0 , numSegments ) ; |
public class BinaryXmlParser { /** * Parse binary xml . */
public void parse ( ) { } } | ChunkHeader firstChunkHeader = readChunkHeader ( ) ; if ( firstChunkHeader == null ) { return ; } switch ( firstChunkHeader . getChunkType ( ) ) { case ChunkType . XML : case ChunkType . NULL : break ; case ChunkType . STRING_POOL : default : // strange chunk header type , just skip this chunk header ?
} // read string pool chunk
ChunkHeader stringPoolChunkHeader = readChunkHeader ( ) ; if ( stringPoolChunkHeader == null ) { return ; } ParseUtils . checkChunkType ( ChunkType . STRING_POOL , stringPoolChunkHeader . getChunkType ( ) ) ; stringPool = ParseUtils . readStringPool ( buffer , ( StringPoolHeader ) stringPoolChunkHeader ) ; // read on chunk , check if it was an optional XMLResourceMap chunk
ChunkHeader chunkHeader = readChunkHeader ( ) ; if ( chunkHeader == null ) { return ; } if ( chunkHeader . getChunkType ( ) == ChunkType . XML_RESOURCE_MAP ) { long [ ] resourceIds = readXmlResourceMap ( ( XmlResourceMapHeader ) chunkHeader ) ; resourceMap = new String [ resourceIds . length ] ; for ( int i = 0 ; i < resourceIds . length ; i ++ ) { resourceMap [ i ] = Attribute . AttrIds . getString ( resourceIds [ i ] ) ; } chunkHeader = readChunkHeader ( ) ; } while ( chunkHeader != null ) { /* if ( chunkHeader . chunkType = = ChunkType . XML _ END _ NAMESPACE ) {
break ; */
long beginPos = buffer . position ( ) ; switch ( chunkHeader . getChunkType ( ) ) { case ChunkType . XML_END_NAMESPACE : XmlNamespaceEndTag xmlNamespaceEndTag = readXmlNamespaceEndTag ( ) ; xmlStreamer . onNamespaceEnd ( xmlNamespaceEndTag ) ; break ; case ChunkType . XML_START_NAMESPACE : XmlNamespaceStartTag namespaceStartTag = readXmlNamespaceStartTag ( ) ; xmlStreamer . onNamespaceStart ( namespaceStartTag ) ; break ; case ChunkType . XML_START_ELEMENT : XmlNodeStartTag xmlNodeStartTag = readXmlNodeStartTag ( ) ; break ; case ChunkType . XML_END_ELEMENT : XmlNodeEndTag xmlNodeEndTag = readXmlNodeEndTag ( ) ; break ; case ChunkType . XML_CDATA : XmlCData xmlCData = readXmlCData ( ) ; break ; default : if ( chunkHeader . getChunkType ( ) >= ChunkType . XML_FIRST_CHUNK && chunkHeader . getChunkType ( ) <= ChunkType . XML_LAST_CHUNK ) { Buffers . skip ( buffer , chunkHeader . getBodySize ( ) ) ; } else { throw new ParserException ( "Unexpected chunk type:" + chunkHeader . getChunkType ( ) ) ; } } Buffers . position ( buffer , beginPos + chunkHeader . getBodySize ( ) ) ; chunkHeader = readChunkHeader ( ) ; } |
public class Product { /** * Sets the productMarketplaceInfo value for this Product .
* @ param productMarketplaceInfo * Marketplace information of this { @ code Product } .
* < span class = " constraint Applicable " > This attribute
* is applicable when : < ul > < li > using programmatic guaranteed , using sales
* management . < / li > < / ul > < / span >
* < span class = " constraint Required " > This attribute is
* required when : < ul > < li > using programmatic guaranteed , using sales management . < / li > < / ul > < / span > */
public void setProductMarketplaceInfo ( com . google . api . ads . admanager . axis . v201808 . ProductMarketplaceInfo productMarketplaceInfo ) { } } | this . productMarketplaceInfo = productMarketplaceInfo ; |
public class MethodWriterImpl { /** * { @ inheritDoc } */
@ Override protected void addSummaryType ( Element member , Content tdSummaryType ) { } } | ExecutableElement meth = ( ExecutableElement ) member ; addModifierAndType ( meth , utils . getReturnType ( meth ) , tdSummaryType ) ; |
public class IssueDescriptionReader { /** * Extracts the list of bug occurrences from the description .
* @ param pDescription
* the issue description
* @ param pStacktraceMD5
* the stacktrace MD5 hash the issue is related to
* @ return the ACRA bug occurrences listed in the description
* @ throws IssueParseException
* malformed issue description */
private List < ErrorOccurrence > parseAcraOccurrencesTable ( final String pDescription , final String pStacktraceMD5 ) throws IssueParseException { } } | final List < ErrorOccurrence > occur = new ArrayList < ErrorOccurrence > ( ) ; // escape braces { and } to use strings in regexp
final String header = IssueDescriptionUtils . getOccurrencesTableHeader ( ) ; final String escHeader = Pattern . quote ( header ) ; // regexp to find occurrences tables
final Pattern p = Pattern . compile ( escHeader + IssueDescriptionUtils . EOL + "(?:" + OCCURR_LINE_PATTERN + IssueDescriptionUtils . EOL + "+)+" , Pattern . DOTALL | Pattern . CASE_INSENSITIVE ) ; final Matcher m = p . matcher ( pDescription ) ; if ( m . find ( ) ) { // regexp to find occurrences lines
final Pattern pLine = Pattern . compile ( OCCURR_LINE_PATTERN ) ; final Matcher mLine = pLine . matcher ( m . group ( ) ) ; while ( mLine . find ( ) ) { try { final StringTokenizer line = new StringTokenizer ( mLine . group ( ) , "|" ) ; final String acraReportId = line . nextToken ( ) ; final String acraUserCrashDate = line . nextToken ( ) ; final String acraRunFor = line . nextToken ( ) ; final String acraAndroidVersion = line . nextToken ( ) ; final String acraVersionCode = line . nextToken ( ) ; final String acraVersionName = line . nextToken ( ) ; final String acraDevice = line . nextToken ( ) ; final ErrorOccurrence error = new ErrorOccurrence ( ) ; error . setReportId ( acraReportId ) ; try { error . setCrashDate ( IssueDescriptionUtils . parseDate ( acraUserCrashDate ) ) ; error . setRunFor ( RunningTimeUtils . parseRunningTime ( acraRunFor ) ) ; } catch ( final ParseException e ) { throw new IssueParseException ( "Unable to parse user crash date of ACRA report " + acraReportId , e ) ; } error . setAndroidVersion ( acraAndroidVersion ) ; error . setVersionCode ( acraVersionCode ) ; error . setVersionName ( acraVersionName ) ; error . setDevice ( acraDevice ) ; occur . add ( error ) ; } catch ( final NoSuchElementException e ) { throw new IssueParseException ( "Unable to parse ACRA report line: " + mLine . group ( ) , e ) ; } } } else { throw new IssueParseException ( "No crash occurrence table found in the description" ) ; } if ( m . find ( ) ) { throw new IssueParseException ( "More than 1 occurrence table found in the description" ) ; } if ( CollectionUtils . isEmpty ( occur ) ) { throw new IssueParseException ( "0 user crash occurrence found in the description" ) ; } return occur ; |
public class ActionFormMapper { protected Object prepareSimpleProperty ( Object bean , String name ) { } } | final BeanDesc beanDesc = BeanDescFactory . getBeanDesc ( bean . getClass ( ) ) ; if ( ! beanDesc . hasPropertyDesc ( name ) ) { return null ; } final PropertyDesc pd = beanDesc . getPropertyDesc ( name ) ; if ( ! pd . isReadable ( ) ) { return null ; } Object value = pd . getValue ( bean ) ; if ( value == null ) { final Class < ? > propertyType = pd . getPropertyType ( ) ; if ( ! LdiModifierUtil . isAbstract ( propertyType ) ) { value = LdiClassUtil . newInstance ( propertyType ) ; if ( pd . isWritable ( ) ) { pd . setValue ( bean , value ) ; } } else if ( Map . class . isAssignableFrom ( propertyType ) ) { value = new HashMap < String , Object > ( ) ; if ( pd . isWritable ( ) ) { pd . setValue ( bean , value ) ; } } } return value ; |
public class SecurityRulesInner { /** * Get the specified network security rule .
* @ param resourceGroupName The name of the resource group .
* @ param networkSecurityGroupName The name of the network security group .
* @ param securityRuleName The name of the security rule .
* @ param serviceCallback the async ServiceCallback to handle successful and failed responses .
* @ throws IllegalArgumentException thrown if parameters fail the validation
* @ return the { @ link ServiceFuture } object */
public ServiceFuture < SecurityRuleInner > getAsync ( String resourceGroupName , String networkSecurityGroupName , String securityRuleName , final ServiceCallback < SecurityRuleInner > serviceCallback ) { } } | return ServiceFuture . fromResponse ( getWithServiceResponseAsync ( resourceGroupName , networkSecurityGroupName , securityRuleName ) , serviceCallback ) ; |
public class MacFaxClientSpi { /** * This function initializes the fax client SPI . */
@ Override protected void initializeImpl ( ) { } } | // get values
this . submitCommand = this . getConfigurationValue ( FaxClientSpiConfigurationConstants . SUBMIT_FAX_JOB_COMMAND_PROPERTY_KEY ) ; if ( this . submitCommand == null ) { this . submitCommand = FaxClientSpiConfigurationConstants . SUBMIT_FAX_JOB_COMMAND_DEFAULT_VALUE . toString ( ) ; } this . printQueueParameter = this . getConfigurationValue ( FaxClientSpiConfigurationConstants . PRINT_QUEUE_PARAMETER_PROPERTY_KEY ) ; if ( this . printQueueParameter == null ) { this . printQueueParameter = FaxClientSpiConfigurationConstants . PRINT_QUEUE_PARAMETER_DEFAULT_VALUE . toString ( ) ; } this . printQueueName = this . getConfigurationValue ( FaxClientSpiConfigurationConstants . PRINT_QUEUE_NAME_PROPERTY_KEY ) ; if ( this . printQueueName == null ) { throw new FaxException ( "Print queue name not defined in fax4j.properties. Property: " + FaxClientSpiConfigurationConstants . PRINT_QUEUE_NAME_PROPERTY_KEY ) ; } this . generalParameters = this . getConfigurationValue ( FaxClientSpiConfigurationConstants . GENERAL_PARAMETERS_PROPERTY_KEY ) ; if ( this . generalParameters == null ) { this . generalParameters = FaxClientSpiConfigurationConstants . GENERAL_PARAMETERS_DEFAULT_VALUE . toString ( ) ; } this . phoneParameter = this . getConfigurationValue ( FaxClientSpiConfigurationConstants . PHONE_PARAMETER_PROPERTY_KEY ) ; if ( this . phoneParameter == null ) { this . phoneParameter = FaxClientSpiConfigurationConstants . PHONE_PARAMETER_DEFAULT_VALUE . toString ( ) ; } this . faxToParameter = this . getConfigurationValue ( FaxClientSpiConfigurationConstants . FAX_TO_PARAMETER_PROPERTY_KEY ) ; if ( this . faxToParameter == null ) { this . faxToParameter = FaxClientSpiConfigurationConstants . FAX_TO_PARAMETER_DEFAULT_VALUE . toString ( ) ; } // init process output validator
this . processOutputValidator = this . createMacProcessOutputValidator ( ) ; |
public class MTableModel { /** * { @ inheritDoc } */
@ Override public String getColumnName ( final int columnIndex ) { } } | final String identifier = getIdentifier ( columnIndex ) ; if ( identifier == null ) { return super . getColumnName ( columnIndex ) ; } return identifier ; |
public class TransformZooKeeperArbitrateEvent { /** * < pre >
* 算法 :
* 1 . 检查当前的Permit , 阻塞等待其授权 ( 解决Channel的pause状态处理 )
* 2 . 开始阻塞获取符合条件的processId
* 3 . 检查当前的即时Permit状态 ( 在阻塞获取processId过程会出现一些error信号 , process节点会被删除 )
* 4 . 获取Select传递的EventData数据 , 添加next node信息后直接返回
* < / pre >
* @ return */
public EtlEventData await ( Long pipelineId ) throws InterruptedException { } } | Assert . notNull ( pipelineId ) ; PermitMonitor permitMonitor = ArbitrateFactory . getInstance ( pipelineId , PermitMonitor . class ) ; permitMonitor . waitForPermit ( ) ; // 阻塞等待授权
TransformStageListener transformStageListener = ArbitrateFactory . getInstance ( pipelineId , TransformStageListener . class ) ; Long processId = transformStageListener . waitForProcess ( ) ; // 符合条件的processId
ChannelStatus status = permitMonitor . getChannelPermit ( ) ; if ( status . isStart ( ) ) { // 即时查询一下当前的状态 , 状态随时可能会变
// 根据pipelineId + processId构造对应的path
String path = StagePathUtils . getExtractStage ( pipelineId , processId ) ; try { byte [ ] data = zookeeper . readData ( path ) ; EtlEventData eventData = JsonUtils . unmarshalFromByte ( data , EtlEventData . class ) ; eventData . setNextNid ( ArbitrateConfigUtils . getCurrentNid ( ) ) ; // 下一个节点信息即为自己
return eventData ; // 只有这一条路返回
} catch ( ZkNoNodeException e ) { logger . error ( "pipeline[{}] processId[{}] is invalid , retry again" , pipelineId , processId ) ; return await ( pipelineId ) ; // / 出现节点不存在 , 说明出现了error情况 , 递归调用重新获取一次
} catch ( ZkException e ) { throw new ArbitrateException ( "transform_await" , e . getMessage ( ) , e ) ; } } else { logger . info ( "pipelineId[{}] transform ignore processId[{}] by status[{}]" , new Object [ ] { pipelineId , processId , status } ) ; // 释放下processId , 因为load是等待processId最小值完成Tranform才继续 , 如果这里不释放 , 会一直卡死等待
String path = StagePathUtils . getProcess ( pipelineId , processId ) ; zookeeper . delete ( path ) ; return await ( pipelineId ) ; // 递归调用
} |
public class LogDataFormatter { /** * Formats the log message in response to an exception during a previous logging attempt . A
* synthetic error message is generated from the original log data and the given exception is set
* as the cause . The level of this record is the maximum of WARNING or the original level . */
static void formatBadLogData ( RuntimeException error , LogData badLogData , SimpleLogHandler receiver ) { } } | StringBuilder errorMsg = new StringBuilder ( "LOGGING ERROR: " ) . append ( error . getMessage ( ) ) . append ( '\n' ) ; int length = errorMsg . length ( ) ; try { appendLogData ( badLogData , errorMsg ) ; } catch ( RuntimeException e ) { // Reset partially written buffer when an error occurs .
errorMsg . setLength ( length ) ; errorMsg . append ( "Cannot append LogData: " ) . append ( e ) ; } // Re - target this log message as a warning ( or above ) since it indicates a real bug .
Level level = badLogData . getLevel ( ) . intValue ( ) < WARNING . intValue ( ) ? WARNING : badLogData . getLevel ( ) ; receiver . handleFormattedLogMessage ( level , errorMsg . toString ( ) , error ) ; |
public class WriteQueue { /** * Process the queue of commands and dispatch them to the stream . This method is only
* called in the event loop */
private void flush ( ) { } } | try { QueuedCommand cmd ; int i = 0 ; boolean flushedOnce = false ; while ( ( cmd = queue . poll ( ) ) != null ) { cmd . run ( channel ) ; if ( ++ i == DEQUE_CHUNK_SIZE ) { i = 0 ; // Flush each chunk so we are releasing buffers periodically . In theory this loop
// might never end as new events are continuously added to the queue , if we never
// flushed in that case we would be guaranteed to OOM .
channel . flush ( ) ; flushedOnce = true ; } } // Must flush at least once , even if there were no writes .
if ( i != 0 || ! flushedOnce ) { channel . flush ( ) ; } } finally { // Mark the write as done , if the queue is non - empty after marking trigger a new write .
scheduled . set ( false ) ; if ( ! queue . isEmpty ( ) ) { scheduleFlush ( ) ; } } |
public class FloatArrayList { /** * Adds all the elements in the given array list to the array list .
* @ param values The values to add to the array list . */
public void add ( FloatArrayList values ) { } } | ensureCapacity ( size + values . size ) ; for ( int i = 0 ; i < values . size ; i ++ ) { this . add ( values . elements [ i ] ) ; } |
public class StringGroovyMethods { /** * TODO expose this for stream based stripping ? */
private static String stripIndentFromLine ( String line , int numChars ) { } } | int length = line . length ( ) ; return numChars <= length ? line . substring ( numChars ) : "" ; |
public class ApiOvhTelephony { /** * Get this object properties
* REST : GET / telephony / { billingAccount } / service / { serviceName } / repaymentConsumption / { consumptionId }
* @ param billingAccount [ required ] The name of your billingAccount
* @ param serviceName [ required ]
* @ param consumptionId [ required ] */
public OvhRepaymentConsumption billingAccount_service_serviceName_repaymentConsumption_consumptionId_GET ( String billingAccount , String serviceName , Long consumptionId ) throws IOException { } } | String qPath = "/telephony/{billingAccount}/service/{serviceName}/repaymentConsumption/{consumptionId}" ; StringBuilder sb = path ( qPath , billingAccount , serviceName , consumptionId ) ; String resp = exec ( qPath , "GET" , sb . toString ( ) , null ) ; return convertTo ( resp , OvhRepaymentConsumption . class ) ; |
public class PdfAction { /** * Creates a GoToR action to a named destination .
* @ param filename the file name to go to
* @ param dest the destination name
* @ param isName if true sets the destination as a name , if false sets it as a String
* @ param newWindow open the document in a new window if < CODE > true < / CODE > , if false the current document is replaced by the new document .
* @ return a GoToR action */
public static PdfAction gotoRemotePage ( String filename , String dest , boolean isName , boolean newWindow ) { } } | PdfAction action = new PdfAction ( ) ; action . put ( PdfName . F , new PdfString ( filename ) ) ; action . put ( PdfName . S , PdfName . GOTOR ) ; if ( isName ) action . put ( PdfName . D , new PdfName ( dest ) ) ; else action . put ( PdfName . D , new PdfString ( dest , null ) ) ; if ( newWindow ) action . put ( PdfName . NEWWINDOW , PdfBoolean . PDFTRUE ) ; return action ; |
public class ReflectUtils { /** * get method desc . " do ( I ) I " , " do ( ) V " , " do ( Ljava / lang / String ; Z ) V "
* @ param m
* method .
* @ return desc . */
public static String getDesc ( final CtMethod m ) throws NotFoundException { } } | StringBuilder ret = new StringBuilder ( m . getName ( ) ) . append ( '(' ) ; CtClass [ ] parameterTypes = m . getParameterTypes ( ) ; for ( int i = 0 ; i < parameterTypes . length ; i ++ ) ret . append ( getDesc ( parameterTypes [ i ] ) ) ; ret . append ( ')' ) . append ( getDesc ( m . getReturnType ( ) ) ) ; return ret . toString ( ) ; |
public class Retryer { /** * Executes a command with < code > retries < / code > retries . This can be
* executed multiple times .
* @ param operation the operation to attempt .
* @ return < code > true < / code > if the operation succeeded , < code > false < / code >
* if not . Consult { @ link # getErrors ( ) } for any error codes or exceptions
* that the operation returned . */
public boolean execute ( Retryable < E > operation ) { } } | Logger logger = IOUtil . logger ( ) ; int i = this . retries + 1 ; this . attempts = 0 ; this . errors . clear ( ) ; E error ; do { error = operation . attempt ( ) ; this . attempts ++ ; if ( error != null ) { this . errors . add ( error ) ; -- i ; logError ( logger , error , i ) ; if ( i > 0 ) { logger . log ( Level . WARNING , "Recovering..." ) ; operation . recover ( ) ; } } } while ( error != null && i > 0 ) ; return error == null ; |
public class MultipartFormDataParser { /** * Checks a Content - Type string to assert if it is " multipart / form - data " .
* @ param contentType Content - Type string .
* @ return { @ code true } if the content type is " multipart / form - data " , otherwise { @ code false } .
* @ since 1.620 */
public static boolean isMultiPartForm ( @ CheckForNull String contentType ) { } } | if ( contentType == null ) { return false ; } String [ ] parts = contentType . split ( ";" ) ; return ArrayUtils . contains ( parts , "multipart/form-data" ) ; |
public class RestItemHandlerImpl { /** * Performs a bulk creation of items , using a single { @ link javax . jcr . Session } . If any of the items cannot be created for whatever
* reason , the entire operation fails .
* @ param request the servlet request ; may not be null or unauthenticated
* @ param repositoryName the URL - encoded repository name
* @ param workspaceName the URL - encoded workspace name
* @ param requestContent the JSON - encoded representation of the nodes and , possibly , properties to be added
* @ return a { @ code non - null } { @ link Result }
* @ throws javax . jcr . RepositoryException if any of the JCR operations fail
* @ see RestItemHandlerImpl # addItem ( Request , String , String , String , String ) */
@ Override public void addItems ( Request request , String repositoryName , String workspaceName , String requestContent ) throws RepositoryException { } } | ObjectNode requestBody = stringToJSONObject ( requestContent ) ; if ( requestBody . size ( ) != 0 ) { Session session = getSession ( request , repositoryName , workspaceName ) ; TreeMap < String , JsonNode > nodesByPath = createNodesByPathMap ( requestBody ) ; addMultipleNodes ( request , nodesByPath , session ) ; } |
public class Pool { /** * Set the class .
* @ param poolClass The class
* @ exception IllegalStateException If the pool has already
* been started . */
public void setPoolClass ( Class poolClass ) throws IllegalStateException { } } | synchronized ( this ) { if ( _class != poolClass ) { if ( _running > 0 ) throw new IllegalStateException ( "Thread Pool Running" ) ; if ( ! PondLife . class . isAssignableFrom ( poolClass ) ) throw new IllegalArgumentException ( "Not PondLife: " + poolClass ) ; _class = poolClass ; _className = _class . getName ( ) ; } } |
public class Scope { /** * Returns the scope in which this name is defined
* @ param name the symbol to look up
* @ return this { @ link Scope } , one of its parent scopes , or { @ code null } if
* the name is not defined any this scope chain */
public Scope getDefiningScope ( String name ) { } } | for ( Scope s = this ; s != null ; s = s . parentScope ) { Map < String , Symbol > symbolTable = s . getSymbolTable ( ) ; if ( symbolTable != null && symbolTable . containsKey ( name ) ) { return s ; } } return null ; |
public class PluginConfigRequesterImpl { /** * { @ inheritDoc } */
@ Override public boolean generateClusterPlugin ( String cluster ) { } } | boolean result = false ; PluginUtilityConfigGenerator mBean = this . pluginConfigMbeans . get ( PluginUtilityConfigGenerator . Types . COLLECTIVE ) ; if ( mBean != null ) { if ( TraceComponent . isAnyTracingEnabled ( ) && tc . isDebugEnabled ( ) ) Tr . debug ( this , tc , "PluginConfigRequesterImpl.generateClusterPlugin : write directory : " + writeDirectory . getPath ( ) ) ; try { mBean . generatePluginConfig ( cluster , writeDirectory ) ; result = true ; } catch ( Throwable th ) { FFDCFilter . processException ( th , getClass ( ) . getName ( ) , "generateClusterPlugin" ) ; if ( TraceComponent . isAnyTracingEnabled ( ) && tc . isEventEnabled ( ) ) { Tr . event ( tc , "Error generating cluster plugin-cfg.xml: " + th . getMessage ( ) ) ; } } } else { result = false ; Tr . error ( tc , "collective.mbean.not.available" , cluster ) ; } return result ; |
public class FessMessages { /** * Add the created action message for the key ' errors . crud _ invalid _ mode ' with parameters .
* < pre >
* message : Invalid mode ( expected value is { 0 } , but it ' s { 1 } ) .
* < / pre >
* @ param property The property name for the message . ( NotNull )
* @ param arg0 The parameter arg0 for message . ( NotNull )
* @ param arg1 The parameter arg1 for message . ( NotNull )
* @ return this . ( NotNull ) */
public FessMessages addErrorsCrudInvalidMode ( String property , String arg0 , String arg1 ) { } } | assertPropertyNotNull ( property ) ; add ( property , new UserMessage ( ERRORS_crud_invalid_mode , arg0 , arg1 ) ) ; return this ; |
public class DefaultZoomableController { /** * Keeps the scaling factor within the specified limits .
* @ param pivotX x coordinate of the pivot point
* @ param pivotY y coordinate of the pivot point
* @ param limitTypes whether to limit scale .
* @ return whether limiting has been applied or not */
private boolean limitScale ( Matrix transform , float pivotX , float pivotY , @ LimitFlag int limitTypes ) { } } | if ( ! shouldLimit ( limitTypes , LIMIT_SCALE ) ) { return false ; } float currentScale = getMatrixScaleFactor ( transform ) ; float targetScale = limit ( currentScale , mMinScaleFactor , mMaxScaleFactor ) ; if ( targetScale != currentScale ) { float scale = targetScale / currentScale ; transform . postScale ( scale , scale , pivotX , pivotY ) ; return true ; } return false ; |
public class KeyVaultClientBaseImpl { /** * Requests that a backup of the specified key be downloaded to the client .
* The Key Backup operation exports a key from Azure Key Vault in a protected form . Note that this operation does NOT return key material in a form that can be used outside the Azure Key Vault system , the returned key material is either protected to a Azure Key Vault HSM or to Azure Key Vault itself . The intent of this operation is to allow a client to GENERATE a key in one Azure Key Vault instance , BACKUP the key , and then RESTORE it into another Azure Key Vault instance . The BACKUP operation may be used to export , in protected form , any key type from Azure Key Vault . Individual versions of a key cannot be backed up . BACKUP / RESTORE can be performed within geographical boundaries only ; meaning that a BACKUP from one geographical area cannot be restored to another geographical area . For example , a backup from the US geographical area cannot be restored in an EU geographical area . This operation requires the key / backup permission .
* @ param vaultBaseUrl The vault name , for example https : / / myvault . vault . azure . net .
* @ param keyName The name of the key .
* @ param serviceCallback the async ServiceCallback to handle successful and failed responses .
* @ throws IllegalArgumentException thrown if parameters fail the validation
* @ return the { @ link ServiceFuture } object */
public ServiceFuture < BackupKeyResult > backupKeyAsync ( String vaultBaseUrl , String keyName , final ServiceCallback < BackupKeyResult > serviceCallback ) { } } | return ServiceFuture . fromResponse ( backupKeyWithServiceResponseAsync ( vaultBaseUrl , keyName ) , serviceCallback ) ; |
public class ScheduledReporter { /** * Starts the reporter polling at the given period .
* @ param period the amount of time between polls
* @ param unit the unit for { @ code period } */
public void start ( long period , TimeUnit unit ) { } } | executor . scheduleAtFixedRate ( ( ) -> { try { report ( ) ; } catch ( RuntimeException ex ) { LOG . error ( "RuntimeException thrown from {}#report. Exception was suppressed." , ScheduledReporter . this . getClass ( ) . getSimpleName ( ) , ex ) ; } } , period , period , unit ) ; |
public class EnterpriseContainerBase { /** * ( non - Javadoc )
* @ see
* org . jboss . shrinkwrap . api . container . EnterpriseContainer # addApplicationResource ( org . jboss . shrinkwrap . api . Asset ,
* org . jboss . shrinkwrap . api . Path ) */
@ Override public T addAsApplicationResource ( Asset resource , ArchivePath target ) throws IllegalArgumentException { } } | Validate . notNull ( resource , "Resource must be specified" ) ; Validate . notNull ( target , "Target must be specified" ) ; ArchivePath location = new BasicPath ( getApplicationPath ( ) , target ) ; return add ( resource , location ) ; |
public class CacheEntryProcessorEntry { /** * Provides a similar functionality as committing a transaction . So , at the end of the process method , applyChanges
* will be called to apply latest data into { @ link CacheRecordStore } . */
public void applyChanges ( ) { } } | final boolean isStatisticsEnabled = cacheRecordStore . cacheConfig . isStatisticsEnabled ( ) ; final CacheStatisticsImpl statistics = cacheRecordStore . statistics ; switch ( state ) { case ACCESS : cacheRecordStore . accessRecord ( keyData , record , expiryPolicy , now ) ; break ; case CREATE : if ( isStatisticsEnabled ) { statistics . increaseCachePuts ( 1 ) ; statistics . addGetTimeNanos ( System . nanoTime ( ) - start ) ; } boolean saved = cacheRecordStore . createRecordWithExpiry ( keyData , value , expiryPolicy , now , false , completionId ) != null ; onCreate ( keyData , value , expiryPolicy , now , false , completionId , saved ) ; break ; case LOAD : saved = cacheRecordStore . createRecordWithExpiry ( keyData , valueLoaded , expiryPolicy , now , true , completionId ) != null ; onLoad ( keyData , valueLoaded , expiryPolicy , now , true , completionId , saved ) ; break ; case UPDATE : saved = cacheRecordStore . updateRecordWithExpiry ( keyData , value , record , expiryPolicy , now , false , completionId ) ; onUpdate ( keyData , value , record , expiryPolicy , now , false , completionId , saved ) ; if ( isStatisticsEnabled ) { statistics . increaseCachePuts ( 1 ) ; statistics . addGetTimeNanos ( System . nanoTime ( ) - start ) ; } break ; case REMOVE : boolean removed = cacheRecordStore . remove ( keyData , null , null , completionId ) ; onRemove ( keyData , null , completionId , removed ) ; break ; case NONE : cacheRecordStore . publishEvent ( CacheEventContextUtil . createCacheCompleteEvent ( cacheRecordStore . toEventData ( keyData ) , completionId ) ) ; break ; default : break ; } |
public class NumberBoundaryStage { /** * Parses the threshold to remove the matched number string .
* No checks are performed against the passed in string : the object assumes
* that the string is correct since the { @ link # canParse ( String ) } method
* < b > must < / b > be called < b > before < / b > this method .
* @ param threshold
* The threshold chunk to be parsed
* @ param tc
* The threshold config object . This object will be populated
* according to the passed in threshold .
* @ return the remaining part of the threshold * @ throws RangeException
* if the threshold can ' t be parsed */
@ Override public String parse ( final String threshold , final RangeConfig tc ) throws RangeException { } } | StringBuilder numberString = new StringBuilder ( ) ; for ( int i = 0 ; i < threshold . length ( ) ; i ++ ) { if ( Character . isDigit ( threshold . charAt ( i ) ) ) { numberString . append ( threshold . charAt ( i ) ) ; continue ; } if ( threshold . charAt ( i ) == '.' ) { if ( numberString . toString ( ) . endsWith ( "." ) ) { numberString . deleteCharAt ( numberString . length ( ) - 1 ) ; break ; } else { numberString . append ( threshold . charAt ( i ) ) ; continue ; } } if ( threshold . charAt ( i ) == '+' || threshold . charAt ( i ) == '-' ) { if ( numberString . length ( ) == 0 ) { numberString . append ( threshold . charAt ( i ) ) ; continue ; } else { throw new RangeException ( "Unexpected '" + threshold . charAt ( i ) + "' sign parsing boundary" ) ; } } // throw new InvalidRangeSyntaxException ( this ,
// threshold . substring ( numberString . length ( ) ) ) ;
break ; } if ( numberString . length ( ) != 0 && ! justSign ( numberString . toString ( ) ) ) { BigDecimal bd = new BigDecimal ( numberString . toString ( ) ) ; setBoundary ( tc , bd ) ; return threshold . substring ( numberString . length ( ) ) ; } else { throw new InvalidRangeSyntaxException ( this , threshold ) ; } |
public class CmsResourceTypeApp { /** * Is resource type name free . < p >
* @ param name to be checked
* @ return boolean */
public static boolean isResourceTypeNameFree ( String name ) { } } | try { OpenCms . getResourceManager ( ) . getResourceType ( name ) ; } catch ( CmsLoaderException e ) { return true ; } return false ; |
public class JDBCSessionImpl { /** * { @ inheritDoc } */
public void begin ( ) { } } | if ( logger . isInfoEnabled ( ) ) { logger . info ( "Begin transaction." ) ; } try { if ( StringUtil . isNotEmpty ( driver ) ) { Class . forName ( driver ) ; } Connection conn = DriverManager . getConnection ( url , user , password ) ; conn . setAutoCommit ( false ) ; provider . setConnection ( conn ) ; } catch ( ClassNotFoundException ex ) { throw new SessionException ( "Driver class not found." , ex ) ; } catch ( SQLException ex ) { throw new SessionException ( "Failed to begin transaction." , ex ) ; } |
public class Revision { /** * Returns a new { @ link Revision } whose revision number is earlier than this { @ link Revision } .
* @ param count the number of commits to go backward */
public Revision backward ( int count ) { } } | if ( count == 0 ) { return this ; } if ( count < 0 ) { throw new IllegalArgumentException ( "count " + count + " (expected: a non-negative integer)" ) ; } return new Revision ( subtract ( major , count ) ) ; |
public class DeviceProxyDAODefaultImpl { public void import_admin_device ( final DeviceProxy deviceProxy , final String origin ) throws DevFailed { } } | checkIfTango ( deviceProxy , origin ) ; build_connection ( deviceProxy ) ; // Get connection on administration device
if ( deviceProxy . getAdm_dev ( ) == null ) { deviceProxy . setAdm_dev ( DeviceProxyFactory . get ( adm_name ( deviceProxy ) , deviceProxy . getUrl ( ) . getTangoHost ( ) ) ) ; } |
public class TextCommandFactory { /** * ( non - Javadoc )
* @ see net . rubyeye . xmemcached . CommandFactory # createIncrDecrCommand ( java . lang . String , byte [ ] ,
* int , net . rubyeye . xmemcached . command . CommandType ) */
public final Command createIncrDecrCommand ( final String key , final byte [ ] keyBytes , final long amount , long initial , int exptime , CommandType cmdType , boolean noreply ) { } } | return new TextIncrDecrCommand ( key , keyBytes , cmdType , new CountDownLatch ( 1 ) , amount , initial , noreply ) ; |
public class ScoreTemplate { /** * Returns the field that are positionned on verticalSection , in order :
* < ul >
* < li > center
* < li > right
* < li > left
* < li > left + tab
* < / ul >
* @ param verticalSection
* { @ link VerticalPosition # TOP } , { @ link VerticalPosition # BOTTOM }
* @ return array of { @ link ScoreElements } constants */
private byte [ ] getSectionFields ( byte verticalSection ) { } } | byte [ ] center = getFieldsAtPosition ( verticalSection , HorizontalPosition . CENTER ) ; byte [ ] right = getFieldsAtPosition ( verticalSection , HorizontalPosition . RIGHT ) ; byte [ ] left = getFieldsAtPosition ( verticalSection , HorizontalPosition . LEFT ) ; byte [ ] leftTab = getFieldsAtPosition ( verticalSection , HorizontalPosition . LEFT_TAB ) ; byte [ ] ret = new byte [ center . length + right . length + left . length + leftTab . length ] ; int idx = 0 ; System . arraycopy ( center , 0 , ret , idx , center . length ) ; idx += center . length ; System . arraycopy ( right , 0 , ret , idx , right . length ) ; idx += right . length ; System . arraycopy ( left , 0 , ret , idx , left . length ) ; idx += left . length ; System . arraycopy ( leftTab , 0 , ret , idx , leftTab . length ) ; return ret ; |
public class BootSector { /** * Sets the OEM name , must be at most 8 characters long .
* @ param name the new OEM name */
public void setOemName ( String name ) { } } | if ( name . length ( ) > 8 ) throw new IllegalArgumentException ( "only 8 characters are allowed" ) ; for ( int i = 0 ; i < 8 ; i ++ ) { char ch ; if ( i < name . length ( ) ) { ch = name . charAt ( i ) ; } else { ch = ( char ) 0 ; } set8 ( 0x3 + i , ch ) ; } |
public class Pixel { /** * Calculates the grey value of this pixel using specified weights .
* @ param redWeight weight for red channel
* @ param greenWeight weight for green channel
* @ param blueWeight weight for blue channel
* @ return grey value of pixel for specified weights
* @ throws ArithmeticException divide by zero if the weights sum up to 0.
* @ throws ArrayIndexOutOfBoundsException if this Pixel ' s index is not in
* range of the Img ' s data array .
* @ see # getLuminance ( )
* @ see # getGrey ( int , int , int , int )
* @ since 1.2 */
public int getGrey ( final int redWeight , final int greenWeight , final int blueWeight ) { } } | return Pixel . getGrey ( getValue ( ) , redWeight , greenWeight , blueWeight ) ; |
public class BaseQuotaManager { /** * { @ inheritDoc } */
public long getRepositoryQuota ( String repositoryName ) throws QuotaManagerException { } } | RepositoryQuotaManager rqm = getRepositoryQuotaManager ( repositoryName ) ; return rqm . getRepositoryQuota ( ) ; |
public class DomainValidator { /** * Returns true if the specified < code > String < / code > matches any
* IANA - defined generic top - level domain . Leading dots are ignored
* if present . The search is case - insensitive .
* @ param gTld the parameter to check for generic TLD status , not null
* @ return true if the parameter is a generic TLD */
public boolean isValidGenericTld ( String gTld ) { } } | final String key = chompLeadingDot ( unicodeToASCII ( gTld ) . toLowerCase ( Locale . ENGLISH ) ) ; return ( arrayContains ( GENERIC_TLDS , key ) || arrayContains ( genericTLDsPlus , key ) ) && ! arrayContains ( genericTLDsMinus , key ) ; |
public class ConnectionImpl { /** * ( non - Javadoc )
* @ see com . ibm . wsspi . sib . core . SICoreConnection # checkMessagingRequired ( com . ibm . websphere . sib . SIDestinationAddress , com . ibm . websphere . sib . SIDestinationAddress ,
* com . ibm . wsspi . sib . core . DestinationType , java . lang . String ) */
@ Override public SIDestinationAddress checkMessagingRequired ( SIDestinationAddress requestDestAddr , SIDestinationAddress replyDestAddr , DestinationType destinationType , String alternateUser ) throws SIConnectionDroppedException , SIConnectionUnavailableException , SIErrorException , SIIncorrectCallException , SITemporaryDestinationNotFoundException , SIResourceException , SINotAuthorizedException , SINotPossibleInCurrentConfigurationException { } } | if ( TraceComponent . isAnyTracingEnabled ( ) && tc . isEntryEnabled ( ) ) SibTr . entry ( tc , "checkMessagingRequired" , new Object [ ] { requestDestAddr , replyDestAddr , alternateUser , destinationType } ) ; // Assume the bus cannot be skipped
boolean destinationIsFastPath = false ; boolean requestIsFastPath = false ; boolean replyIsFastPath = true ; boolean foreignBusFound = false ; boolean destinationIsSendAllowed ; List < JsDestinationAddress > rrp = new LinkedList < JsDestinationAddress > ( ) ; SIDestinationAddress targetPort = null ; boolean loopFound = false ; Set < String > duplicateDestinationNames = null ; // Synchronize on the close object , we don ' t want the connection closing
// while we check if the destination can be fast - pathed
synchronized ( this ) { // See if this connection has been closed
checkNotClosed ( ) ; // Validate the sending destination addresses is not null
checkProducerSessionNullParameters ( requestDestAddr ) ; SecurityContext secContext = null ; // If security is enabled then we need to set up a security context
if ( _isBusSecure ) { // Add the alternate user string to the security context
secContext = new SecurityContext ( _subject , alternateUser , null , _messageProcessor . getAuthorisationUtils ( ) ) ; } String destinationName = requestDestAddr . getDestinationName ( ) ; String busName = requestDestAddr . getBusName ( ) ; if ( ( busName == null ) || ( busName . equals ( _messageProcessor . getMessagingEngineBus ( ) ) ) ) { // Look up the named destination
DestinationHandler destination = null ; destination = _destinationManager . getDestination ( destinationName , busName , false ) ; // Check the destination type
checkDestinationType ( destinationType , requestDestAddr , destination , false ) ; // Ensure that the destination is put enabled
destinationIsSendAllowed = destination . isSendAllowed ( ) ; if ( ! destination . isPubSub ( ) && destination . hasLocal ( ) && destinationIsSendAllowed ) { PtoPLocalMsgsItemStream ptoPLocalMsgsItemStream = ( PtoPLocalMsgsItemStream ) destination . getQueuePoint ( _messageProcessor . getMessagingEngineUuid ( ) ) ; destinationIsSendAllowed = ptoPLocalMsgsItemStream . isSendAllowed ( ) ; } // Check authority to produce to destination
// If security is disabled then we ' ll bypass the check
if ( _isBusSecure ) { checkProducerAuthority ( requestDestAddr , destination , destinationName , busName , secContext , false ) ; // Go on to check authority to consume from the reply destination .
// We do this up front to ensure that an SINotAuth exception can
// be thrown as early as possible .
if ( replyDestAddr != null ) { String replyDestinationName = replyDestAddr . getDestinationName ( ) ; String replyBusName = replyDestAddr . getBusName ( ) ; // Look up the reply destination
DestinationHandler replyDestination = _destinationManager . getDestination ( replyDestinationName , replyBusName , false ) ; // Check authority to produce to the reply destination . The reply will
// be produced with the same userid as the request
// If security is disabled then we ' ll bypass the check
checkDestinationAccess ( replyDestination , replyDestinationName , replyBusName , secContext ) ; } } // Set up the reverse routing path as we go along .
JsDestinationAddress replyDest = destination . getReplyDestination ( ) ; if ( ( replyDest != null ) && ( replyDestAddr != null ) ) { rrp . add ( replyDest ) ; } // Now validate each entry on the administered forward routing path .
// If one is found that breaks the fastpath rules , then leave the
// loop
JsDestinationAddress entry = null ; DestinationHandler frpDestination = destination ; // Get the administered forward routing path from the named destination
List frp = destination . getForwardRoutingPath ( ) ; if ( frp != null ) { int frpSize = frp . size ( ) ; int frpCount = 0 ; // Ensure there is no infinite loop in the forward routing path
duplicateDestinationNames = new HashSet < String > ( ) ; duplicateDestinationNames . add ( destination . getName ( ) ) ; while ( ( ! frpDestination . isPubSub ( ) ) && // not a topicspace
( ! foreignBusFound ) && ( ! loopFound ) && ( destinationIsSendAllowed ) && ( frpCount < frpSize ) ) // forward routing path
// contains entries
{ // read element from FRP
entry = ( JsDestinationAddress ) frp . get ( frpCount ) ; frpCount ++ ; String frpName = entry . getDestinationName ( ) ; String frpBusName = entry . getBusName ( ) ; if ( ( frpBusName == null ) || ( frpBusName . equals ( _messageProcessor . getMessagingEngineBus ( ) ) ) ) { // Get the named destination from the destination manager
frpDestination = _destinationManager . getDestination ( frpName , frpBusName , false ) ; // If security is enabled , then we need to check authority to access
// the next destination
// Check authority to produce to destination
// If security is disabled then we ' ll bypass the check
if ( _isBusSecure ) { checkDestinationAccess ( frpDestination , frpName , frpBusName , secContext ) ; } // Set up the reverse routing path as we go along .
replyDest = frpDestination . getReplyDestination ( ) ; if ( ( replyDest != null ) && ( replyDestAddr != null ) ) { rrp . add ( replyDest ) ; } // If this is the last destination in the FRP , then see if this
// destination has a default adminstered FRP which we should now
// check .
if ( frpCount == frpSize ) { List additionalFRP = frpDestination . getForwardRoutingPath ( ) ; if ( additionalFRP != null ) { // Before adding an additional forward routing path , ensure it wont make us loop forever
if ( duplicateDestinationNames . contains ( frpDestination . getName ( ) ) ) { loopFound = true ; } else { duplicateDestinationNames . add ( frpDestination . getName ( ) ) ; frp = additionalFRP ; frpSize = frp . size ( ) ; frpCount = 0 ; } } } } else { foreignBusFound = true ; } } } // We have either succesfully checked all the destinations on the
// administered forward routing path , or frpDestination will be
// referencing the first destination that failed one of the
// checks . Determine here which is the correct response to give
// the caller .
if ( ( ! foreignBusFound ) && ( ! loopFound ) && ( destinationIsSendAllowed ) && ( frpDestination . hasLocal ( ) ) && // local queue - point
( frpDestination . getDestinationType ( ) == DestinationType . PORT ) && ( ! frpDestination . isPubSub ( ) ) ) // not a topicspace
{ requestIsFastPath = true ; targetPort = JsMainAdminComponentImpl . getSIDestinationAddressFactory ( ) . createSIDestinationAddress ( frpDestination . getName ( ) , frpDestination . getBus ( ) ) ; } // Now check if the reply message can also be fastpathed .
// Only worth checking if the request can be .
if ( requestIsFastPath ) { DestinationHandler rrpDestination = null ; while ( ! rrp . isEmpty ( ) ) { // Pop off first element of RRP
entry = rrp . remove ( 0 ) ; String rrpName = entry . getDestinationName ( ) ; String rrpBusName = entry . getBusName ( ) ; if ( ( rrpBusName != null ) && ( ! ( rrpBusName . equals ( _messageProcessor . getMessagingEngineBus ( ) ) ) ) ) { replyIsFastPath = false ; rrp . clear ( ) ; } else { // Get the named destination from the destination manager
rrpDestination = _destinationManager . getDestination ( rrpName , rrpBusName , false ) ; // If security is enabled , then we need to check authority to access
// the next destination
// Check authority to produce to destination
// If security is disabled then we ' ll bypass the check
if ( _isBusSecure ) { checkDestinationAccess ( rrpDestination , rrpName , rrpBusName , secContext ) ; } } } if ( replyIsFastPath ) { if ( replyDestAddr != null ) { // The reverse routing path was checked and is ok . Now check the final
// reply destination .
destinationName = replyDestAddr . getDestinationName ( ) ; busName = replyDestAddr . getBusName ( ) ; if ( ( busName != null ) && ( ! ( busName . equals ( _messageProcessor . getMessagingEngineBus ( ) ) ) ) ) { replyIsFastPath = false ; } else { // Look up the named destination
destination = _destinationManager . getDestination ( destinationName , busName , false ) ; boolean replyDestinationHasFRP = false ; List replyDestinationFRP = destination . getForwardRoutingPath ( ) ; if ( ( replyDestinationFRP != null ) && ( ! ( replyDestinationFRP . isEmpty ( ) ) ) ) { replyDestinationHasFRP = true ; } // The reply destination must also have a local queue point and no Forward Routing Path
if ( ( ! ( destination . hasLocal ( ) ) ) || ( replyDestinationHasFRP == true ) || ( ! ( destination . isReceiveAllowed ( ) ) ) ) { replyIsFastPath = false ; } } } } if ( ( requestIsFastPath ) && ( replyIsFastPath ) ) { destinationIsFastPath = true ; } } } } if ( ! destinationIsFastPath ) targetPort = null ; if ( TraceComponent . isAnyTracingEnabled ( ) && tc . isEntryEnabled ( ) ) SibTr . exit ( tc , "checkMessagingRequired" , targetPort ) ; return targetPort ; |
public class CmsLoginController { /** * Called when the user clicks on the login button . < p > */
public void onClickLogin ( ) { } } | String user = m_ui . getUser ( ) ; String password = m_ui . getPassword ( ) ; CmsMessageContainer message = CmsLoginHelper . validateUserAndPasswordNotEmpty ( user , password ) ; CmsLoginMessage loginMessage = OpenCms . getLoginManager ( ) . getLoginMessage ( ) ; String storedMessage = null ; if ( ( loginMessage != null ) && ! loginMessage . isLoginCurrentlyForbidden ( ) && loginMessage . isActive ( ) ) { storedMessage = loginMessage . getMessage ( ) ; // If login is forbidden , we will get an error message anyway , so we don ' t need to store the message here
} if ( message != null ) { String errorMessage = message . key ( m_params . getLocale ( ) ) ; // m _ ui . displayError ( errorMessage ) ;
displayError ( errorMessage , true ) ; return ; } String ou = m_ui . getOrgUnit ( ) ; String realUser = CmsStringUtil . joinPaths ( ou , user ) ; String pcType = m_ui . getPcType ( ) ; CmsObject currentCms = A_CmsUI . getCmsObject ( ) ; CmsUser userObj = null ; try { try { userObj = currentCms . readUser ( realUser ) ; } catch ( CmsException e ) { LOG . warn ( e . getLocalizedMessage ( ) , e ) ; message = org . opencms . workplace . Messages . get ( ) . container ( org . opencms . workplace . Messages . GUI_LOGIN_FAILED_0 ) ; displayError ( message . key ( m_params . getLocale ( ) ) , true , true ) ; return ; } if ( OpenCms . getLoginManager ( ) . canLockBecauseOfInactivity ( currentCms , userObj ) ) { boolean locked = null != userObj . getAdditionalInfo ( ) . get ( KEY_ACCOUNT_LOCKED ) ; if ( locked ) { displayError ( CmsInactiveUserMessages . getLockoutText ( A_CmsUI . get ( ) . getLocale ( ) ) , false ) ; return ; } } String messageToChange = "" ; if ( OpenCms . getLoginManager ( ) . isPasswordReset ( currentCms , userObj ) ) { messageToChange = CmsVaadinUtils . getMessageText ( Messages . GUI_PWCHANGE_RESET_0 ) ; } if ( OpenCms . getLoginManager ( ) . requiresPasswordChange ( currentCms , userObj ) ) { messageToChange = getPasswordChangeMessage ( ) ; } if ( ! CmsStringUtil . isEmptyOrWhitespaceOnly ( messageToChange ) ) { CmsChangePasswordDialog passwordDialog = new CmsChangePasswordDialog ( currentCms , userObj , A_CmsUI . get ( ) . getLocale ( ) ) ; passwordDialog . setAdditionalMessage ( messageToChange ) ; A_CmsUI . get ( ) . setContentToDialog ( Messages . get ( ) . getBundle ( A_CmsUI . get ( ) . getLocale ( ) ) . key ( Messages . GUI_PWCHANGE_HEADER_0 ) + userObj . getSimpleName ( ) , passwordDialog ) ; return ; } // do a provisional login first , to check the login target
CmsObject cloneCms = OpenCms . initCmsObject ( currentCms ) ; cloneCms . loginUser ( realUser , password ) ; CmsWorkplaceSettings settings = CmsLoginHelper . initSiteAndProject ( cloneCms ) ; final String loginTarget = getLoginTarget ( cloneCms , settings , m_params . getRequestedResource ( ) ) ; // make sure we have a new session after login for security reasons
HttpSession session = ( ( HttpServletRequest ) VaadinService . getCurrentRequest ( ) ) . getSession ( false ) ; if ( session != null ) { session . invalidate ( ) ; } session = ( ( HttpServletRequest ) VaadinService . getCurrentRequest ( ) ) . getSession ( true ) ; // provisional login successful , now do for real
currentCms . loginUser ( realUser , password ) ; if ( LOG . isInfoEnabled ( ) ) { CmsRequestContext context = currentCms . getRequestContext ( ) ; LOG . info ( org . opencms . jsp . Messages . get ( ) . getBundle ( ) . key ( org . opencms . jsp . Messages . LOG_LOGIN_SUCCESSFUL_3 , context . getCurrentUser ( ) . getName ( ) , "{workplace login dialog}" , context . getRemoteAddress ( ) ) ) ; } settings = CmsLoginHelper . initSiteAndProject ( currentCms ) ; OpenCms . getSessionManager ( ) . updateSessionInfo ( currentCms , ( HttpServletRequest ) VaadinService . getCurrentRequest ( ) ) ; if ( ( loginMessage != null ) && loginMessage . isLoginCurrentlyForbidden ( ) ) { if ( loginMessage . getTimeEnd ( ) == CmsLoginMessage . DEFAULT_TIME_END ) { // we are an administrator
storedMessage = org . opencms . workplace . Messages . get ( ) . container ( org . opencms . workplace . Messages . GUI_LOGIN_SUCCESS_WITH_MESSAGE_WITHOUT_TIME_1 , loginMessage . getMessage ( ) , new Date ( loginMessage . getTimeEnd ( ) ) ) . key ( A_CmsUI . get ( ) . getLocale ( ) ) ; } else { // we are an administrator
storedMessage = org . opencms . workplace . Messages . get ( ) . container ( org . opencms . workplace . Messages . GUI_LOGIN_SUCCESS_WITH_MESSAGE_2 , loginMessage . getMessage ( ) , new Date ( loginMessage . getTimeEnd ( ) ) ) . key ( A_CmsUI . get ( ) . getLocale ( ) ) ; } } if ( storedMessage != null ) { OpenCms . getSessionManager ( ) . sendBroadcast ( null , storedMessage , currentCms . getRequestContext ( ) . getCurrentUser ( ) ) ; } CmsLoginHelper . setCookieData ( pcType , user , ou , ( VaadinServletRequest ) ( VaadinService . getCurrentRequest ( ) ) , ( VaadinServletResponse ) ( VaadinService . getCurrentResponse ( ) ) ) ; VaadinService . getCurrentRequest ( ) . getWrappedSession ( ) . setAttribute ( CmsWorkplaceManager . SESSION_WORKPLACE_SETTINGS , settings ) ; final boolean isPublicPC = CmsLoginForm . PC_TYPE_PUBLIC . equals ( pcType ) ; if ( OpenCms . getLoginManager ( ) . requiresUserDataCheck ( currentCms , userObj ) ) { I_CmsDialogContext context = new A_CmsDialogContext ( "" , ContextType . appToolbar , null ) { @ Override public void finish ( CmsProject project , String siteRoot ) { finish ( null ) ; } @ Override public void finish ( Collection < CmsUUID > result ) { m_ui . openLoginTarget ( loginTarget , isPublicPC ) ; } public void focus ( CmsUUID structureId ) { // nothing to do
} public List < CmsUUID > getAllStructureIdsInView ( ) { return null ; } @ Override public void start ( String title , Component dialog , DialogWidth style ) { if ( dialog != null ) { m_window = CmsBasicDialog . prepareWindow ( style ) ; m_window . setCaption ( title ) ; m_window . setContent ( dialog ) ; UI . getCurrent ( ) . addWindow ( m_window ) ; if ( dialog instanceof CmsBasicDialog ) { ( ( CmsBasicDialog ) dialog ) . initActionHandler ( m_window ) ; } } } public void updateUserInfo ( ) { // not supported
} } ; CmsUser u = currentCms . readUser ( userObj . getId ( ) ) ; u . setAdditionalInfo ( CmsUserSettings . ADDITIONAL_INFO_LAST_USER_DATA_CHECK , Long . toString ( System . currentTimeMillis ( ) ) ) ; currentCms . writeUser ( u ) ; CmsUserDataDialog dialog = new CmsUserDataDialog ( context , true ) ; context . start ( dialog . getTitle ( UI . getCurrent ( ) . getLocale ( ) ) , dialog ) ; } else { m_ui . openLoginTarget ( loginTarget , isPublicPC ) ; } } catch ( Exception e ) { // there was an error during login
if ( e instanceof CmsException ) { CmsMessageContainer exceptionMessage = ( ( CmsException ) e ) . getMessageContainer ( ) ; if ( org . opencms . security . Messages . ERR_LOGIN_FAILED_DISABLED_2 == exceptionMessage . getKey ( ) ) { // the user account is disabled
message = org . opencms . workplace . Messages . get ( ) . container ( org . opencms . workplace . Messages . GUI_LOGIN_FAILED_DISABLED_0 ) ; } else if ( org . opencms . security . Messages . ERR_LOGIN_FAILED_TEMP_DISABLED_4 == exceptionMessage . getKey ( ) ) { // the user account is temporarily disabled because of too many login failures
message = org . opencms . workplace . Messages . get ( ) . container ( org . opencms . workplace . Messages . GUI_LOGIN_FAILED_TEMP_DISABLED_0 ) ; } else if ( org . opencms . security . Messages . ERR_LOGIN_FAILED_WITH_MESSAGE_1 == exceptionMessage . getKey ( ) ) { // all logins have been disabled be the Administration
CmsLoginMessage loginMessage2 = OpenCms . getLoginManager ( ) . getLoginMessage ( ) ; if ( loginMessage2 != null ) { message = org . opencms . workplace . Messages . get ( ) . container ( org . opencms . workplace . Messages . GUI_LOGIN_FAILED_WITH_MESSAGE_1 , loginMessage2 . getMessage ( ) ) ; } } } if ( message == null ) { if ( e instanceof CmsCustomLoginException ) { message = ( ( CmsCustomLoginException ) e ) . getMessageContainer ( ) ; } else { // any other error - display default message
message = org . opencms . workplace . Messages . get ( ) . container ( org . opencms . workplace . Messages . GUI_LOGIN_FAILED_0 ) ; displayError ( message . key ( m_params . getLocale ( ) ) , true , true ) ; return ; } } if ( e instanceof CmsException ) { CmsJspLoginBean . logLoginException ( currentCms . getRequestContext ( ) , user , ( CmsException ) e ) ; } else { LOG . error ( e . getLocalizedMessage ( ) , e ) ; } displayError ( message . key ( m_params . getLocale ( ) ) , false ) ; return ; } |
public class KeyDecoder { /** * Decodes the given BigInteger as originally encoded for descending order .
* @ param src source of encoded data
* @ param srcOffset offset into encoded data
* @ param valueRef decoded BigInteger is stored in element 0 , which may be null
* @ return amount of bytes read from source
* @ throws CorruptEncodingException if source data is corrupt
* @ since 1.2 */
public static int decodeDesc ( byte [ ] src , int srcOffset , BigInteger [ ] valueRef ) throws CorruptEncodingException { } } | int headerSize ; int bytesLength ; byte [ ] bytes ; try { int header = src [ srcOffset ] ; if ( header == NULL_BYTE_HIGH || header == NULL_BYTE_LOW ) { valueRef [ 0 ] = null ; return 1 ; } header &= 0xff ; if ( header > 1 && header < 0xfe ) { if ( header < 0x80 ) { bytesLength = 0x80 - header ; } else { bytesLength = header - 0x7f ; } headerSize = 1 ; } else { bytesLength = Math . abs ( DataDecoder . decodeInt ( src , srcOffset + 1 ) ) ; headerSize = 5 ; } bytes = new byte [ bytesLength ] ; srcOffset += headerSize ; for ( int i = 0 ; i < bytesLength ; i ++ ) { bytes [ i ] = ( byte ) ~ src [ srcOffset + i ] ; } } catch ( IndexOutOfBoundsException e ) { throw new CorruptEncodingException ( null , e ) ; } valueRef [ 0 ] = new BigInteger ( bytes ) ; return headerSize + bytesLength ; |
public class ClassFileVersion { /** * Extracts a class ' class version .
* @ param typeDescription The type for which to locate a class file version .
* @ param classFileLocator The class file locator to query for a class file .
* @ return The type ' s class file version .
* @ throws IOException If an error occurs while reading the class file . */
public static ClassFileVersion of ( TypeDescription typeDescription , ClassFileLocator classFileLocator ) throws IOException { } } | ClassReader classReader = OpenedClassReader . of ( classFileLocator . locate ( typeDescription . getName ( ) ) . resolve ( ) ) ; VersionExtractor versionExtractor = new VersionExtractor ( ) ; classReader . accept ( versionExtractor , ClassReader . SKIP_CODE ) ; return ClassFileVersion . ofMinorMajor ( versionExtractor . getClassFileVersionNumber ( ) ) ; |
public class CommonOps_DDRM { /** * Extracts the column from a matrix .
* @ param a Input matrix
* @ param column Which column is to be extracted
* @ param out output . Storage for the extracted column . If null then a new vector will be returned .
* @ return The extracted column . */
public static DMatrixRMaj extractColumn ( DMatrixRMaj a , int column , DMatrixRMaj out ) { } } | if ( out == null ) out = new DMatrixRMaj ( a . numRows , 1 ) ; else if ( ! MatrixFeatures_DDRM . isVector ( out ) || out . getNumElements ( ) != a . numRows ) throw new MatrixDimensionException ( "Output must be a vector of length " + a . numRows ) ; int index = column ; for ( int i = 0 ; i < a . numRows ; i ++ , index += a . numCols ) { out . data [ i ] = a . data [ index ] ; } return out ; |
public class CommonOps_DDF3 { /** * < p > Performs matrix to vector multiplication : < br >
* < br >
* c = a * b < br >
* < br >
* c < sub > i < / sub > = & sum ; < sub > k = 1 : n < / sub > { a < sub > ik < / sub > * b < sub > k < / sub > }
* @ param a The left matrix in the multiplication operation . Not modified .
* @ param b The right vector in the multiplication operation . Not modified .
* @ param c Where the results of the operation are stored . Modified . */
public static void mult ( DMatrix3x3 a , DMatrix3 b , DMatrix3 c ) { } } | c . a1 = a . a11 * b . a1 + a . a12 * b . a2 + a . a13 * b . a3 ; c . a2 = a . a21 * b . a1 + a . a22 * b . a2 + a . a23 * b . a3 ; c . a3 = a . a31 * b . a1 + a . a32 * b . a2 + a . a33 * b . a3 ; |
public class gslbsite { /** * Use this API to fetch filtered set of gslbsite resources .
* filter string should be in JSON format . eg : " port : 80 , servicetype : HTTP " . */
public static gslbsite [ ] get_filtered ( nitro_service service , String filter ) throws Exception { } } | gslbsite obj = new gslbsite ( ) ; options option = new options ( ) ; option . set_filter ( filter ) ; gslbsite [ ] response = ( gslbsite [ ] ) obj . getfiltered ( service , option ) ; return response ; |
public class HttpClientResponseBuilder { /** * Sets response header .
* @ param name header name
* @ param value header value
* @ return response builder */
public HttpClientResponseBuilder withHeader ( String name , String value ) { } } | Action lastAction = newRule . getLastAction ( ) ; HeaderAction headerAction = new HeaderAction ( lastAction , name , value ) ; newRule . overrideLastAction ( headerAction ) ; return this ; |
public class ListBuffer { /** * Prepend an element to buffer . */
public ListBuffer < A > prepend ( A x ) { } } | elems = elems . prepend ( x ) ; if ( last == null ) last = elems ; count ++ ; return this ; |
public class FlinkKinesisConsumer { @ Override public void initializeState ( FunctionInitializationContext context ) throws Exception { } } | TypeInformation < Tuple2 < StreamShardMetadata , SequenceNumber > > shardsStateTypeInfo = new TupleTypeInfo < > ( TypeInformation . of ( StreamShardMetadata . class ) , TypeInformation . of ( SequenceNumber . class ) ) ; sequenceNumsStateForCheckpoint = context . getOperatorStateStore ( ) . getUnionListState ( new ListStateDescriptor < > ( sequenceNumsStateStoreName , shardsStateTypeInfo ) ) ; if ( context . isRestored ( ) ) { if ( sequenceNumsToRestore == null ) { sequenceNumsToRestore = new HashMap < > ( ) ; for ( Tuple2 < StreamShardMetadata , SequenceNumber > kinesisSequenceNumber : sequenceNumsStateForCheckpoint . get ( ) ) { sequenceNumsToRestore . put ( // we wrap the restored metadata inside an equivalence wrapper that checks only stream name and shard id ,
// so that if a shard had been closed ( due to a Kinesis reshard operation , for example ) since
// the savepoint and has a different metadata than what we last stored ,
// we will still be able to match it in sequenceNumsToRestore . Please see FLINK - 8484 for details .
new StreamShardMetadata . EquivalenceWrapper ( kinesisSequenceNumber . f0 ) , kinesisSequenceNumber . f1 ) ; } LOG . info ( "Setting restore state in the FlinkKinesisConsumer. Using the following offsets: {}" , sequenceNumsToRestore ) ; } } else { LOG . info ( "No restore state for FlinkKinesisConsumer." ) ; } |
public class TargetCpaBiddingScheme { /** * Gets the targetCpa value for this TargetCpaBiddingScheme .
* @ return targetCpa * Average cost per acquisition ( CPA ) target . This target should
* be greater than or equal to
* minimum billable unit based on the currency for
* the account . */
public com . google . api . ads . adwords . axis . v201809 . cm . Money getTargetCpa ( ) { } } | return targetCpa ; |
public class Configuration { /** * Returns the value associated with the given key as a float .
* @ param key
* the key pointing to the associated value
* @ param defaultValue
* the default value which is returned in case there is no value associated with the given key
* @ return the ( default ) value associated with the given key */
public float getFloat ( final String key , final float defaultValue ) { } } | String val = getStringInternal ( key ) ; if ( val == null ) { return defaultValue ; } else { return Float . parseFloat ( val ) ; } |
public class SunCalc { /** * calculations for sun times */
private static double getApproxTransit ( double Ht , double lw , double n ) { } } | return J2000 + J0 + ( Ht + lw ) / ( 2 * Math . PI ) + n ; |
public class InstanceNetworkInterface { /** * One or more security groups .
* @ return One or more security groups . */
public java . util . List < GroupIdentifier > getGroups ( ) { } } | if ( groups == null ) { groups = new com . amazonaws . internal . SdkInternalList < GroupIdentifier > ( ) ; } return groups ; |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.