idx int64 0 165k | question stringlengths 73 5.81k | target stringlengths 5 918 |
|---|---|---|
11,200 | private Name makeOperatorName ( String name ) { Name opName = names . fromString ( name ) ; operatorNames . add ( opName ) ; return opName ; } | Create a new operator name from corresponding String representation and add the name to the set of known operator names . |
11,201 | public Widget put ( IWidgetFactory factory , String name ) { Widget widget = factory . getWidget ( ) ; put ( widget , name ) ; return widget ; } | Creates new widget and puts it to container at first free index |
11,202 | public static String getEventTypeDescription ( final XMLStreamReader reader ) { final int eventType = reader . getEventType ( ) ; if ( eventType == XMLStreamConstants . START_ELEMENT ) { final String namespace = reader . getNamespaceURI ( ) ; return "<" + reader . getLocalName ( ) + ( ! StringUtils . isEmpty ( namespace ) ? "@" + namespace : StringUtils . EMPTY ) + ">" ; } if ( eventType == XMLStreamConstants . END_ELEMENT ) { final String namespace = reader . getNamespaceURI ( ) ; return "</" + reader . getLocalName ( ) + ( ! StringUtils . isEmpty ( namespace ) ? "@" + namespace : StringUtils . EMPTY ) + ">" ; } return NAMES_OF_EVENTS [ reader . getEventType ( ) ] ; } | Returns string describing the current event . |
11,203 | public static boolean isStartElement ( final XMLStreamReader reader , final String namespace , final String localName ) { return reader . getEventType ( ) == XMLStreamConstants . START_ELEMENT && nameEquals ( reader , namespace , localName ) ; } | Method isStartElement . |
11,204 | public static boolean nameEquals ( final XMLStreamReader reader , final String namespace , final String localName ) { if ( ! reader . getLocalName ( ) . equals ( localName ) ) { return false ; } if ( namespace == null ) { return true ; } final String namespaceURI = reader . getNamespaceURI ( ) ; if ( namespaceURI == null ) { return StringUtils . isEmpty ( namespace ) ; } return namespaceURI . equals ( StringUtils . defaultString ( namespace ) ) ; } | Method nameEquals . |
11,205 | public static Class optionalClassAttribute ( final XMLStreamReader reader , final String localName , final Class defaultValue ) throws XMLStreamException { return optionalClassAttribute ( reader , null , localName , defaultValue ) ; } | Returns the value of an attribute as a Class . If the attribute is empty this method returns the default value provided . |
11,206 | public static void skipElement ( final XMLStreamReader reader ) throws XMLStreamException , IOException { if ( reader . getEventType ( ) != XMLStreamConstants . START_ELEMENT ) { return ; } final String namespace = reader . getNamespaceURI ( ) ; final String name = reader . getLocalName ( ) ; for ( ; ; ) { switch ( reader . nextTag ( ) ) { case XMLStreamConstants . START_ELEMENT : skipElement ( reader ) ; break ; case XMLStreamConstants . END_ELEMENT : case XMLStreamConstants . END_DOCUMENT : reader . require ( XMLStreamConstants . END_ELEMENT , namespace , name ) ; reader . next ( ) ; return ; } } } | Method skipElement . |
11,207 | public UriBuilder path ( String path ) throws URISyntaxException { path = path . trim ( ) ; if ( getPath ( ) . endsWith ( "/" ) ) { return new UriBuilder ( setPath ( String . format ( "%s%s" , getPath ( ) , path ) ) ) ; } else { return new UriBuilder ( setPath ( String . format ( "%s/%s" , getPath ( ) , path ) ) ) ; } } | Appends a path to the current one |
11,208 | public < T > ApruveResponse < List < T > > index ( String path , GenericType < List < T > > resultType ) { Response response = restRequest ( path ) . get ( ) ; List < T > responseObject = null ; ApruveResponse < List < T > > result ; if ( response . getStatusInfo ( ) . getFamily ( ) == Family . SUCCESSFUL ) { responseObject = response . readEntity ( resultType ) ; result = new ApruveResponse < List < T > > ( response . getStatus ( ) , responseObject ) ; } else { result = new ApruveResponse < List < T > > ( response . getStatus ( ) , null , response . readEntity ( String . class ) ) ; } return result ; } | is kind of a pain and it duplicates processResponse . |
11,209 | public < T > ApruveResponse < T > get ( String path , Class < T > resultType ) { Response response = restRequest ( path ) . get ( ) ; return processResponse ( response , resultType ) ; } | Issues a GET request against to the Apruve REST API using the specified path . |
11,210 | public boolean sync ( NewRelicCache cache ) { if ( cache == null ) throw new IllegalArgumentException ( "null cache" ) ; checkInitialize ( cache ) ; boolean ret = isInitialized ( ) ; if ( ! ret ) throw new IllegalStateException ( "cache not initialized" ) ; clear ( cache ) ; if ( ret ) ret = syncApplications ( cache ) ; if ( ret ) ret = syncPlugins ( cache ) ; if ( ret ) ret = syncMonitors ( cache ) ; if ( ret ) ret = syncServers ( cache ) ; if ( ret ) ret = syncLabels ( cache ) ; if ( ret ) ret = syncAlerts ( cache ) ; if ( ret ) ret = syncDashboards ( cache ) ; return ret ; } | Synchronises the cache . |
11,211 | public boolean syncAlerts ( NewRelicCache cache ) { boolean ret = true ; if ( apiClient == null ) throw new IllegalArgumentException ( "null API client" ) ; if ( cache . isAlertsEnabled ( ) ) { ret = false ; logger . info ( "Getting the alert policies" ) ; Collection < AlertPolicy > policies = apiClient . alertPolicies ( ) . list ( ) ; for ( AlertPolicy policy : policies ) { cache . alertPolicies ( ) . add ( policy ) ; if ( cache . isApmEnabled ( ) || cache . isServersEnabled ( ) || cache . isBrowserEnabled ( ) || cache . isMobileEnabled ( ) ) cache . alertPolicies ( ) . alertConditions ( policy . getId ( ) ) . add ( apiClient . alertConditions ( ) . list ( policy . getId ( ) ) ) ; cache . alertPolicies ( ) . nrqlAlertConditions ( policy . getId ( ) ) . add ( apiClient . nrqlAlertConditions ( ) . list ( policy . getId ( ) ) ) ; if ( cache . isApmEnabled ( ) || cache . isMobileEnabled ( ) ) cache . alertPolicies ( ) . externalServiceAlertConditions ( policy . getId ( ) ) . add ( apiClient . externalServiceAlertConditions ( ) . list ( policy . getId ( ) ) ) ; if ( cache . isSyntheticsEnabled ( ) ) cache . alertPolicies ( ) . syntheticsAlertConditions ( policy . getId ( ) ) . add ( apiClient . syntheticsAlertConditions ( ) . list ( policy . getId ( ) ) ) ; if ( cache . isPluginsEnabled ( ) ) cache . alertPolicies ( ) . pluginsAlertConditions ( policy . getId ( ) ) . add ( apiClient . pluginsAlertConditions ( ) . list ( policy . getId ( ) ) ) ; if ( cache . isInfrastructureEnabled ( ) ) cache . alertPolicies ( ) . infraAlertConditions ( policy . getId ( ) ) . add ( infraApiClient . infraAlertConditions ( ) . list ( policy . getId ( ) ) ) ; } logger . info ( "Getting the alert channels" ) ; Collection < AlertChannel > channels = apiClient . alertChannels ( ) . list ( ) ; cache . alertChannels ( ) . set ( channels ) ; cache . alertPolicies ( ) . setAlertChannels ( channels ) ; cache . setUpdatedAt ( ) ; ret = true ; } return ret ; } | Synchronise the alerts configuration with the cache . |
11,212 | public boolean syncApplications ( NewRelicCache cache ) { boolean ret = true ; if ( apiClient == null ) throw new IllegalArgumentException ( "null API client" ) ; if ( cache . isApmEnabled ( ) || cache . isBrowserEnabled ( ) || cache . isMobileEnabled ( ) ) { ret = false ; if ( cache . isApmEnabled ( ) ) { logger . info ( "Getting the applications" ) ; Collection < Application > applications = apiClient . applications ( ) . list ( ) ; for ( Application application : applications ) { cache . applications ( ) . add ( application ) ; logger . fine ( "Getting the hosts for application: " + application . getId ( ) ) ; cache . applications ( ) . applicationHosts ( application . getId ( ) ) . add ( apiClient . applicationHosts ( ) . list ( application . getId ( ) ) ) ; logger . fine ( "Getting the instances for application: " + application . getId ( ) ) ; cache . applications ( ) . applicationHosts ( application . getId ( ) ) . addApplicationInstances ( apiClient . applicationInstances ( ) . list ( application . getId ( ) ) ) ; logger . fine ( "Getting the deployments for application: " + application . getId ( ) ) ; cache . applications ( ) . deployments ( application . getId ( ) ) . add ( apiClient . deployments ( ) . list ( application . getId ( ) ) ) ; } try { logger . info ( "Getting the key transactions" ) ; cache . applications ( ) . addKeyTransactions ( apiClient . keyTransactions ( ) . list ( ) ) ; } catch ( ErrorResponseException e ) { if ( e . getStatus ( ) == 403 ) logger . warning ( "Error in get key transactions: " + e . getMessage ( ) ) ; else throw e ; } } if ( cache . isBrowserEnabled ( ) ) { logger . info ( "Getting the browser applications" ) ; cache . browserApplications ( ) . add ( apiClient . browserApplications ( ) . list ( ) ) ; } if ( cache . isBrowserEnabled ( ) ) { logger . info ( "Getting the mobile applications" ) ; cache . mobileApplications ( ) . add ( apiClient . mobileApplications ( ) . list ( ) ) ; } cache . setUpdatedAt ( ) ; ret = true ; } return ret ; } | Synchronise the application configuration with the cache . |
11,213 | public boolean syncPlugins ( NewRelicCache cache ) { boolean ret = true ; if ( apiClient == null ) throw new IllegalArgumentException ( "null API client" ) ; if ( cache . isPluginsEnabled ( ) ) { ret = false ; logger . info ( "Getting the plugins" ) ; Collection < Plugin > plugins = apiClient . plugins ( ) . list ( true ) ; for ( Plugin plugin : plugins ) { cache . plugins ( ) . add ( plugin ) ; logger . fine ( "Getting the components for plugin: " + plugin . getId ( ) ) ; Collection < PluginComponent > components = apiClient . pluginComponents ( ) . list ( PluginComponentService . filters ( ) . pluginId ( plugin . getId ( ) ) . build ( ) ) ; cache . plugins ( ) . components ( plugin . getId ( ) ) . add ( components ) ; } cache . setUpdatedAt ( ) ; ret = true ; } return ret ; } | Synchronise the Plugins configuration with the cache . |
11,214 | public boolean syncMonitors ( NewRelicCache cache ) { boolean ret = true ; if ( apiClient == null ) throw new IllegalArgumentException ( "null API client" ) ; if ( cache . isSyntheticsEnabled ( ) ) { ret = false ; logger . info ( "Getting the monitors" ) ; cache . monitors ( ) . add ( syntheticsApiClient . monitors ( ) . list ( ) ) ; cache . setUpdatedAt ( ) ; ret = true ; } return ret ; } | Synchronise the Synthetics configuration with the cache . |
11,215 | public boolean syncServers ( NewRelicCache cache ) { boolean ret = true ; if ( apiClient == null ) throw new IllegalArgumentException ( "null API client" ) ; if ( cache . isServersEnabled ( ) ) { ret = false ; logger . info ( "Getting the servers" ) ; cache . servers ( ) . add ( apiClient . servers ( ) . list ( ) ) ; cache . setUpdatedAt ( ) ; ret = true ; } return ret ; } | Synchronise the server configuration with the cache . |
11,216 | public boolean syncLabels ( NewRelicCache cache ) { boolean ret = true ; if ( apiClient == null ) throw new IllegalArgumentException ( "null API client" ) ; if ( cache . isApmEnabled ( ) || cache . isSyntheticsEnabled ( ) ) { ret = false ; logger . info ( "Getting the labels" ) ; Collection < Label > labels = apiClient . labels ( ) . list ( ) ; for ( Label label : labels ) { cache . applications ( ) . addLabel ( label ) ; try { Collection < Monitor > monitors = syntheticsApiClient . monitors ( ) . list ( label ) ; for ( Monitor monitor : monitors ) cache . monitors ( ) . labels ( monitor . getId ( ) ) . add ( label ) ; } catch ( NullPointerException e ) { logger . severe ( "Unable to get monitor labels: " + e . getClass ( ) . getName ( ) + ": " + e . getMessage ( ) ) ; } } cache . setUpdatedAt ( ) ; ret = true ; } return ret ; } | Synchronise the label configuration with the cache . |
11,217 | public boolean syncDashboards ( NewRelicCache cache ) { boolean ret = true ; if ( apiClient == null ) throw new IllegalArgumentException ( "null API client" ) ; if ( cache . isInsightsEnabled ( ) ) { ret = false ; logger . info ( "Getting the dashboards" ) ; cache . dashboards ( ) . set ( apiClient . dashboards ( ) . list ( ) ) ; cache . setUpdatedAt ( ) ; ret = true ; } return ret ; } | Synchronise the dashboard configuration with the cache . |
11,218 | public static String stringFor ( int m ) { switch ( m ) { case CUFFT_SUCCESS : return "CUFFT_SUCCESS" ; case CUFFT_INVALID_PLAN : return "CUFFT_INVALID_PLAN" ; case CUFFT_ALLOC_FAILED : return "CUFFT_ALLOC_FAILED" ; case CUFFT_INVALID_TYPE : return "CUFFT_INVALID_TYPE" ; case CUFFT_INVALID_VALUE : return "CUFFT_INVALID_VALUE" ; case CUFFT_INTERNAL_ERROR : return "CUFFT_INTERNAL_ERROR" ; case CUFFT_EXEC_FAILED : return "CUFFT_EXEC_FAILED" ; case CUFFT_SETUP_FAILED : return "CUFFT_SETUP_FAILED" ; case CUFFT_INVALID_SIZE : return "CUFFT_INVALID_SIZE" ; case CUFFT_UNALIGNED_DATA : return "CUFFT_UNALIGNED_DATA" ; case CUFFT_INCOMPLETE_PARAMETER_LIST : return "CUFFT_INCOMPLETE_PARAMETER_LIST" ; case CUFFT_INVALID_DEVICE : return "CUFFT_INVALID_DEVICE" ; case CUFFT_PARSE_ERROR : return "CUFFT_PARSE_ERROR" ; case CUFFT_NO_WORKSPACE : return "CUFFT_NO_WORKSPACE" ; case CUFFT_NOT_IMPLEMENTED : return "CUFFT_NOT_IMPLEMENTED" ; case CUFFT_LICENSE_ERROR : return "CUFFT_LICENSE_ERROR" ; case CUFFT_NOT_SUPPORTED : return "CUFFT_NOT_SUPPORTED" ; case JCUFFT_INTERNAL_ERROR : return "JCUFFT_INTERNAL_ERROR" ; } return "INVALID cufftResult: " + m ; } | Returns the String identifying the given cufftResult |
11,219 | protected SocialProfile parseProfile ( Map < String , Object > props ) { if ( ! props . containsKey ( "id" ) ) { throw new IllegalArgumentException ( "No id in profile" ) ; } SocialProfile profile = SocialProfile . with ( props ) . displayName ( "name" ) . first ( "first_name" ) . last ( "last_name" ) . id ( "id" ) . username ( "username" ) . profileUrl ( "link" ) . build ( ) ; profile . setThumbnailUrl ( getBaseUrl ( ) + "/" + profile . getId ( ) + "/picture" ) ; return profile ; } | Property names for Facebook - Override to customize |
11,220 | private void parsePackageClasses ( String name , List < JavaFileObject > files , ListBuffer < JCCompilationUnit > trees , List < String > excludedPackages ) throws IOException { if ( excludedPackages . contains ( name ) ) { return ; } docenv . notice ( "main.Loading_source_files_for_package" , name ) ; if ( files == null ) { Location location = docenv . fileManager . hasLocation ( StandardLocation . SOURCE_PATH ) ? StandardLocation . SOURCE_PATH : StandardLocation . CLASS_PATH ; ListBuffer < JavaFileObject > lb = new ListBuffer < JavaFileObject > ( ) ; for ( JavaFileObject fo : docenv . fileManager . list ( location , name , EnumSet . of ( JavaFileObject . Kind . SOURCE ) , false ) ) { String binaryName = docenv . fileManager . inferBinaryName ( location , fo ) ; String simpleName = getSimpleName ( binaryName ) ; if ( isValidClassName ( simpleName ) ) { lb . append ( fo ) ; } } files = lb . toList ( ) ; } if ( files . nonEmpty ( ) ) { for ( JavaFileObject fo : files ) { parse ( fo , trees , false ) ; } } else { messager . warning ( Messager . NOPOS , "main.no_source_files_for_package" , name . replace ( File . separatorChar , '.' ) ) ; } } | search all directories in path for subdirectory name . Add all . java files found in such a directory to args . |
11,221 | private static boolean isValidJavaClassFile ( String file ) { if ( ! file . endsWith ( ".class" ) ) return false ; String clazzName = file . substring ( 0 , file . length ( ) - ".class" . length ( ) ) ; return isValidClassName ( clazzName ) ; } | Return true if given file name is a valid class file name . |
11,222 | public void enter ( Symbol sym , Scope s , Scope origin , boolean staticallyImported ) { Assert . check ( shared == 0 ) ; if ( nelems * 3 >= hashMask * 2 ) dble ( ) ; int hash = getIndex ( sym . name ) ; Entry old = table [ hash ] ; if ( old == null ) { old = sentinel ; nelems ++ ; } Entry e = makeEntry ( sym , old , elems , s , origin , staticallyImported ) ; table [ hash ] = e ; elems = e ; for ( List < ScopeListener > l = listeners ; l . nonEmpty ( ) ; l = l . tail ) { l . head . symbolAdded ( sym , this ) ; } } | Enter symbol sym in this scope but mark that it comes from given scope s accessed through origin . The last two arguments are only used in import scopes . |
11,223 | public void reportDependence ( Symbol from , Symbol to ) { deps . collect ( from . packge ( ) . fullname , to . packge ( ) . fullname ) ; } | Collect dependencies in the enclosing class |
11,224 | public void put ( Object tree , int flags , int startPc , int endPc ) { entries . append ( new CRTEntry ( tree , flags , startPc , endPc ) ) ; } | Create a new CRTEntry and add it to the entries . |
11,225 | public int writeCRT ( ByteBuffer databuf , Position . LineMap lineMap , Log log ) { int crtEntries = 0 ; new SourceComputer ( ) . csp ( methodTree ) ; for ( List < CRTEntry > l = entries . toList ( ) ; l . nonEmpty ( ) ; l = l . tail ) { CRTEntry entry = l . head ; if ( entry . startPc == entry . endPc ) continue ; SourceRange pos = positions . get ( entry . tree ) ; Assert . checkNonNull ( pos , "CRT: tree source positions are undefined" ) ; if ( ( pos . startPos == Position . NOPOS ) || ( pos . endPos == Position . NOPOS ) ) continue ; if ( crtDebug ) { System . out . println ( "Tree: " + entry . tree + ", type:" + getTypes ( entry . flags ) ) ; System . out . print ( "Start: pos = " + pos . startPos + ", pc = " + entry . startPc ) ; } int startPos = encodePosition ( pos . startPos , lineMap , log ) ; if ( startPos == Position . NOPOS ) continue ; if ( crtDebug ) { System . out . print ( "End: pos = " + pos . endPos + ", pc = " + ( entry . endPc - 1 ) ) ; } int endPos = encodePosition ( pos . endPos , lineMap , log ) ; if ( endPos == Position . NOPOS ) continue ; databuf . appendChar ( entry . startPc ) ; databuf . appendChar ( entry . endPc - 1 ) ; databuf . appendInt ( startPos ) ; databuf . appendInt ( endPos ) ; databuf . appendChar ( entry . flags ) ; crtEntries ++ ; } return crtEntries ; } | Compute source positions and write CRT to the databuf . |
11,226 | private String getTypes ( int flags ) { String types = "" ; if ( ( flags & CRT_STATEMENT ) != 0 ) types += " CRT_STATEMENT" ; if ( ( flags & CRT_BLOCK ) != 0 ) types += " CRT_BLOCK" ; if ( ( flags & CRT_ASSIGNMENT ) != 0 ) types += " CRT_ASSIGNMENT" ; if ( ( flags & CRT_FLOW_CONTROLLER ) != 0 ) types += " CRT_FLOW_CONTROLLER" ; if ( ( flags & CRT_FLOW_TARGET ) != 0 ) types += " CRT_FLOW_TARGET" ; if ( ( flags & CRT_INVOKE ) != 0 ) types += " CRT_INVOKE" ; if ( ( flags & CRT_CREATE ) != 0 ) types += " CRT_CREATE" ; if ( ( flags & CRT_BRANCH_TRUE ) != 0 ) types += " CRT_BRANCH_TRUE" ; if ( ( flags & CRT_BRANCH_FALSE ) != 0 ) types += " CRT_BRANCH_FALSE" ; return types ; } | Return string describing flags enabled . |
11,227 | @ Path ( "{id}" ) @ RolesAllowed ( { "ROLE_ADMIN" } ) public Response read ( @ PathParam ( "id" ) Long id ) { checkNotNull ( id ) ; return Response . ok ( userService . getById ( id ) ) . build ( ) ; } | Get details for a single user . |
11,228 | @ Path ( "search" ) @ RolesAllowed ( { "ROLE_ADMIN" } ) public Response search ( @ QueryParam ( "email" ) String email , @ QueryParam ( "username" ) String username , @ QueryParam ( "pageSize" ) @ DefaultValue ( "10" ) int pageSize , @ QueryParam ( "cursorKey" ) String cursorKey ) { final CursorPage < DUser > page ; if ( null != email ) { page = userService . findMatchingUsersByEmail ( email , pageSize , cursorKey ) ; } else if ( null != username ) { page = userService . findMatchingUsersByUserName ( username , pageSize , cursorKey ) ; } else { throw new BadRequestRestException ( "No search key provided" ) ; } return Response . ok ( page ) . build ( ) ; } | Search for users with matching email or username . |
11,229 | @ RolesAllowed ( { "ROLE_ADMIN" } ) public Response readPage ( @ QueryParam ( "pageSize" ) @ DefaultValue ( "10" ) int pageSize , @ QueryParam ( "cursorKey" ) String cursorKey ) { CursorPage < DUser > page = userService . readPage ( pageSize , cursorKey ) ; return Response . ok ( page ) . build ( ) ; } | Get a page of users . |
11,230 | @ Path ( "{id}/username" ) @ RolesAllowed ( { "ROLE_ADMIN" } ) public Response changeUsername ( @ PathParam ( "id" ) Long id , UsernameRequest usernameRequest ) { checkUsernameFormat ( usernameRequest . username ) ; userService . changeUsername ( id , usernameRequest . getUsername ( ) ) ; return Response . ok ( id ) . build ( ) ; } | Change a users username . The username must be unique |
11,231 | @ Path ( "{id}/password" ) public Response changePassword ( @ PathParam ( "id" ) Long userId , PasswordRequest request ) { checkNotNull ( userId ) ; checkNotNull ( request . getToken ( ) ) ; checkPasswordFormat ( request . getNewPassword ( ) ) ; boolean isSuccess = userService . confirmResetPasswordUsingToken ( userId , request . getNewPassword ( ) , request . getToken ( ) ) ; return isSuccess ? Response . noContent ( ) . build ( ) : Response . status ( Response . Status . BAD_REQUEST ) . build ( ) ; } | Change password using a temporary token . Used during password reset flow . |
11,232 | @ Path ( "password/reset" ) public Response resetPassword ( PasswordRequest request ) { checkNotNull ( request . getEmail ( ) ) ; userService . resetPassword ( request . getEmail ( ) ) ; return Response . noContent ( ) . build ( ) ; } | Reset user password by sending out a reset email . |
11,233 | @ Path ( "{id}/account/confirm" ) public Response confirmAccount ( @ PathParam ( "id" ) Long userId , AccountRequest request ) { checkNotNull ( userId ) ; checkNotNull ( request . getToken ( ) ) ; boolean isSuccess = userService . confirmAccountUsingToken ( userId , request . getToken ( ) ) ; return isSuccess ? Response . noContent ( ) . build ( ) : Response . status ( Response . Status . BAD_REQUEST ) . build ( ) ; } | Confirm a newly create account using a temporary token . |
11,234 | @ Path ( "{id}/account/resend" ) public Response resendVerifyAccountEmail ( @ PathParam ( "id" ) Long userId ) { checkNotNull ( userId ) ; boolean isSuccess = userService . resendVerifyAccountEmail ( userId ) ; return isSuccess ? Response . noContent ( ) . build ( ) : Response . status ( Response . Status . BAD_REQUEST ) . build ( ) ; } | Resend account verification email . |
11,235 | @ Path ( "{id}/email" ) @ RolesAllowed ( { "ROLE_ADMIN" } ) public Response changeEmail ( @ PathParam ( "id" ) Long userId , EmailRequest request ) { checkNotNull ( userId ) ; checkEmailFormat ( request . getEmail ( ) ) ; boolean isSuccess = userService . changeEmailAddress ( userId , request . getEmail ( ) ) ; return isSuccess ? Response . noContent ( ) . build ( ) : Response . status ( Response . Status . BAD_REQUEST ) . build ( ) ; } | Admin changing a users email . |
11,236 | @ Path ( "{id}/email/confirm" ) public Response confirmChangeEmail ( @ PathParam ( "id" ) Long userId , EmailRequest request ) { checkNotNull ( userId ) ; checkNotNull ( request . getToken ( ) ) ; boolean isSuccess = userService . confirmEmailAddressChangeUsingToken ( userId , request . getToken ( ) ) ; return isSuccess ? Response . noContent ( ) . build ( ) : Response . status ( Response . Status . BAD_REQUEST ) . build ( ) ; } | User confirm changing email . The token is verified and the temporary stored email will not be permanently saved as the users email . |
11,237 | public static Protocol createInstance ( ProtocolVersion version , SocketManager socketManager ) { switch ( version ) { case _63 : return new Protocol63 ( socketManager ) ; case _72 : return new Protocol72 ( socketManager ) ; case _73 : return new Protocol73 ( socketManager ) ; case _74 : return new Protocol74 ( socketManager ) ; default : throw new IllegalArgumentException ( "Unknown protocol version: " + version ) ; } } | Create a new protocol instance . This instance cannot be used until the associated socket manager is connected . |
11,238 | public void prepareParameters ( Map < String , Object > extra ) { if ( paramConfig == null ) return ; for ( ParamConfig param : paramConfig ) { param . prepareParameter ( extra ) ; } } | Prepares the parameters for the report . This populates the Combo and ManyCombo box options if there is a groovy or report backing the data . |
11,239 | private FieldDoc getFieldDoc ( Configuration config , Tag tag , String name ) { if ( name == null || name . length ( ) == 0 ) { if ( tag . holder ( ) instanceof FieldDoc ) { return ( FieldDoc ) tag . holder ( ) ; } else { return null ; } } StringTokenizer st = new StringTokenizer ( name , "#" ) ; String memberName = null ; ClassDoc cd = null ; if ( st . countTokens ( ) == 1 ) { Doc holder = tag . holder ( ) ; if ( holder instanceof MemberDoc ) { cd = ( ( MemberDoc ) holder ) . containingClass ( ) ; } else if ( holder instanceof ClassDoc ) { cd = ( ClassDoc ) holder ; } memberName = st . nextToken ( ) ; } else { cd = config . root . classNamed ( st . nextToken ( ) ) ; memberName = st . nextToken ( ) ; } if ( cd == null ) { return null ; } FieldDoc [ ] fields = cd . fields ( ) ; for ( int i = 0 ; i < fields . length ; i ++ ) { if ( fields [ i ] . name ( ) . equals ( memberName ) ) { return fields [ i ] ; } } return null ; } | Given the name of the field return the corresponding FieldDoc . Return null due to invalid use of value tag if the name is null or empty string and if the value tag is not used on a field . |
11,240 | public void constructed ( ) { Context context = factory . enterContext ( ) ; try { scope = new ImporterTopLevel ( context ) ; } finally { Context . exit ( ) ; } Container container = Jaguar . component ( Container . class ) ; Object store = container . component ( container . contexts ( ) . get ( Application . class ) ) . store ( ) ; if ( store instanceof ServletContext ) { org . eiichiro . bootleg . Configuration configuration = new DefaultConfiguration ( ) ; configuration . init ( ( ServletContext ) store ) ; this . configuration = configuration ; } } | Sets up Mozilla Rhino s script scope . If the application is running on a Servlet container this method instantiates and initializes the Bootleg s default configuration internally . |
11,241 | public void activated ( ) { logger . info ( "Importing core packages ['org.eiichiro.gig', 'org.eiichiro.bootleg', 'org.eiichiro.jaguar', 'org.eiichiro.jaguar.deployment'] into JavaScript context" ) ; Context context = factory . enterContext ( ) ; try { context . evaluateString ( scope , "importPackage(Packages.org.eiichiro.gig)" , Configuration . class . getSimpleName ( ) , 146 , null ) ; context . evaluateString ( scope , "importPackage(Packages.org.eiichiro.bootleg)" , Configuration . class . getSimpleName ( ) , 147 , null ) ; context . evaluateString ( scope , "importPackage(Packages.org.eiichiro.jaguar)" , Configuration . class . getSimpleName ( ) , 148 , null ) ; context . evaluateString ( scope , "importPackage(Packages.org.eiichiro.jaguar.deployment)" , Configuration . class . getSimpleName ( ) , 149 , null ) ; } finally { Context . exit ( ) ; } load ( COMPONENTS_JS ) ; load ( ROUTING_JS ) ; load ( SETTINGS_JS ) ; } | Attempts to load pre - defined configuration files . |
11,242 | public void load ( String file ) { Context context = factory . enterContext ( ) ; try { URL url = Thread . currentThread ( ) . getContextClassLoader ( ) . getResource ( file ) ; if ( url == null ) { logger . debug ( "Configuration [" + file + "] does not exist" ) ; return ; } File f = new File ( url . getPath ( ) ) ; if ( f . exists ( ) ) { logger . info ( "Loading configuration [" + file + "]" ) ; context . evaluateReader ( scope , new FileReader ( f ) , file . substring ( file . lastIndexOf ( "/" ) + 1 ) , 1 , null ) ; } } catch ( Exception e ) { logger . error ( "Failed to load configuration [" + file + "]" , e ) ; throw new UncheckedException ( e ) ; } finally { Context . exit ( ) ; } } | Loads the specified configuration file written in JavaScript . |
11,243 | public < T > void set ( String key , T value ) { Preconditions . checkArgument ( key != null && ! key . isEmpty ( ) , "Parameter 'key' must not be [" + key + "]" ) ; values . put ( key , value ) ; scope . put ( key , scope , value ) ; } | Sets the specified configuration setting with the specified key . |
11,244 | protected static char calcChecksumChar ( final String sMsg , final int nLength ) { ValueEnforcer . notNull ( sMsg , "Msg" ) ; ValueEnforcer . isBetweenInclusive ( nLength , "Length" , 0 , sMsg . length ( ) ) ; return asChar ( calcChecksum ( sMsg . toCharArray ( ) , nLength ) ) ; } | Calculates the check character for a given message |
11,245 | protected char scanSurrogates ( ) { if ( surrogatesSupported && Character . isHighSurrogate ( ch ) ) { char high = ch ; scanChar ( ) ; if ( Character . isLowSurrogate ( ch ) ) { return high ; } ch = high ; } return 0 ; } | Scan surrogate pairs . If ch is a high surrogate and the next character is a low surrogate then put the low surrogate in ch and return the high surrogate . otherwise just return 0 . |
11,246 | public static EValidity validateMessage ( final String sMsg ) { final int nLen = StringHelper . getLength ( sMsg ) ; if ( nLen >= 7 && nLen <= 8 ) if ( AbstractUPCEAN . validateMessage ( sMsg ) . isValid ( ) ) return EValidity . VALID ; return EValidity . INVALID ; } | Validates a EAN - 8 message . The method throws IllegalArgumentExceptions if an invalid message is passed . |
11,247 | protected String makeMethodString ( ExecutableElement e ) { StringBuilder result = new StringBuilder ( ) ; for ( Modifier modifier : e . getModifiers ( ) ) { result . append ( modifier . toString ( ) ) ; result . append ( " " ) ; } result . append ( e . getReturnType ( ) . toString ( ) ) ; result . append ( " " ) ; result . append ( e . toString ( ) ) ; List < ? extends TypeMirror > thrownTypes = e . getThrownTypes ( ) ; if ( ! thrownTypes . isEmpty ( ) ) { result . append ( " throws " ) ; for ( Iterator < ? extends TypeMirror > iterator = thrownTypes . iterator ( ) ; iterator . hasNext ( ) ; ) { TypeMirror typeMirror = iterator . next ( ) ; result . append ( typeMirror . toString ( ) ) ; if ( iterator . hasNext ( ) ) { result . append ( ", " ) ; } } } return result . toString ( ) ; } | Creates a String representation of a method element with everything necessary to track all public aspects of it in an API . |
11,248 | protected String makeVariableString ( VariableElement e ) { StringBuilder result = new StringBuilder ( ) ; for ( Modifier modifier : e . getModifiers ( ) ) { result . append ( modifier . toString ( ) ) ; result . append ( " " ) ; } result . append ( e . asType ( ) . toString ( ) ) ; result . append ( " " ) ; result . append ( e . toString ( ) ) ; Object value = e . getConstantValue ( ) ; if ( value != null ) { result . append ( " = " ) ; if ( e . asType ( ) . toString ( ) . equals ( "char" ) ) { int v = ( int ) value . toString ( ) . charAt ( 0 ) ; result . append ( "'\\u" + Integer . toString ( v , 16 ) + "'" ) ; } else { result . append ( value . toString ( ) ) ; } } return result . toString ( ) ; } | Creates a String representation of a variable element with everything necessary to track all public aspects of it in an API . |
11,249 | public void add ( Collection < Deployment > deployments ) { for ( Deployment deployment : deployments ) this . deployments . put ( deployment . getId ( ) , deployment ) ; } | Adds the deployment list to the deployments for the account . |
11,250 | Type generateReturnConstraints ( JCTree tree , Attr . ResultInfo resultInfo , MethodType mt , InferenceContext inferenceContext ) { InferenceContext rsInfoInfContext = resultInfo . checkContext . inferenceContext ( ) ; Type from = mt . getReturnType ( ) ; if ( mt . getReturnType ( ) . containsAny ( inferenceContext . inferencevars ) && rsInfoInfContext != emptyContext ) { from = types . capture ( from ) ; for ( Type t : from . getTypeArguments ( ) ) { if ( t . hasTag ( TYPEVAR ) && ( ( TypeVar ) t ) . isCaptured ( ) ) { inferenceContext . addVar ( ( TypeVar ) t ) ; } } } Type qtype = inferenceContext . asUndetVar ( from ) ; Type to = resultInfo . pt ; if ( qtype . hasTag ( VOID ) ) { to = syms . voidType ; } else if ( to . hasTag ( NONE ) ) { to = from . isPrimitive ( ) ? from : syms . objectType ; } else if ( qtype . hasTag ( UNDETVAR ) ) { if ( resultInfo . pt . isReference ( ) ) { to = generateReturnConstraintsUndetVarToReference ( tree , ( UndetVar ) qtype , to , resultInfo , inferenceContext ) ; } else { if ( to . isPrimitive ( ) ) { to = generateReturnConstraintsPrimitive ( tree , ( UndetVar ) qtype , to , resultInfo , inferenceContext ) ; } } } Assert . check ( allowGraphInference || ! rsInfoInfContext . free ( to ) , "legacy inference engine cannot handle constraints on both sides of a subtyping assertion" ) ; Warner retWarn = new Warner ( ) ; if ( ! resultInfo . checkContext . compatible ( qtype , rsInfoInfContext . asUndetVar ( to ) , retWarn ) || ( ! allowGraphInference && retWarn . hasLint ( Lint . LintCategory . UNCHECKED ) ) ) { throw inferenceException . setMessage ( "infer.no.conforming.instance.exists" , inferenceContext . restvars ( ) , mt . getReturnType ( ) , to ) ; } return from ; } | Generate constraints from the generic method s return type . If the method call occurs in a context where a type T is expected use the expected type to derive more constraints on the generic method inference variables . |
11,251 | private void instantiateAsUninferredVars ( List < Type > vars , InferenceContext inferenceContext ) { ListBuffer < Type > todo = new ListBuffer < > ( ) ; for ( Type t : vars ) { UndetVar uv = ( UndetVar ) inferenceContext . asUndetVar ( t ) ; List < Type > upperBounds = uv . getBounds ( InferenceBound . UPPER ) ; if ( Type . containsAny ( upperBounds , vars ) ) { TypeSymbol fresh_tvar = new TypeVariableSymbol ( Flags . SYNTHETIC , uv . qtype . tsym . name , null , uv . qtype . tsym . owner ) ; fresh_tvar . type = new TypeVar ( fresh_tvar , types . makeIntersectionType ( uv . getBounds ( InferenceBound . UPPER ) ) , null ) ; todo . append ( uv ) ; uv . inst = fresh_tvar . type ; } else if ( upperBounds . nonEmpty ( ) ) { uv . inst = types . glb ( upperBounds ) ; } else { uv . inst = syms . objectType ; } } List < Type > formals = vars ; for ( Type t : todo ) { UndetVar uv = ( UndetVar ) t ; TypeVar ct = ( TypeVar ) uv . inst ; ct . bound = types . glb ( inferenceContext . asInstTypes ( types . getBounds ( ct ) ) ) ; if ( ct . bound . isErroneous ( ) ) { reportBoundError ( uv , BoundErrorKind . BAD_UPPER ) ; } formals = formals . tail ; } } | Infer cyclic inference variables as described in 15 . 12 . 2 . 8 . |
11,252 | Type instantiatePolymorphicSignatureInstance ( Env < AttrContext > env , MethodSymbol spMethod , Resolve . MethodResolutionContext resolveContext , List < Type > argtypes ) { final Type restype ; switch ( env . next . tree . getTag ( ) ) { case TYPECAST : JCTypeCast castTree = ( JCTypeCast ) env . next . tree ; restype = ( TreeInfo . skipParens ( castTree . expr ) == env . tree ) ? castTree . clazz . type : syms . objectType ; break ; case EXEC : JCTree . JCExpressionStatement execTree = ( JCTree . JCExpressionStatement ) env . next . tree ; restype = ( TreeInfo . skipParens ( execTree . expr ) == env . tree ) ? syms . voidType : syms . objectType ; break ; default : restype = syms . objectType ; } List < Type > paramtypes = Type . map ( argtypes , new ImplicitArgType ( spMethod , resolveContext . step ) ) ; List < Type > exType = spMethod != null ? spMethod . getThrownTypes ( ) : List . of ( syms . throwableType ) ; MethodType mtype = new MethodType ( paramtypes , restype , exType , syms . methodClass ) ; return mtype ; } | Compute a synthetic method type corresponding to the requested polymorphic method signature . The target return type is computed from the immediately enclosing scope surrounding the polymorphic - signature call . |
11,253 | void checkWithinBounds ( InferenceContext inferenceContext , Warner warn ) throws InferenceException { MultiUndetVarListener mlistener = new MultiUndetVarListener ( inferenceContext . undetvars ) ; List < Type > saved_undet = inferenceContext . save ( ) ; try { while ( true ) { mlistener . reset ( ) ; if ( ! allowGraphInference ) { for ( Type t : inferenceContext . undetvars ) { UndetVar uv = ( UndetVar ) t ; IncorporationStep . CHECK_BOUNDS . apply ( uv , inferenceContext , warn ) ; } } for ( Type t : inferenceContext . undetvars ) { UndetVar uv = ( UndetVar ) t ; EnumSet < IncorporationStep > incorporationSteps = allowGraphInference ? incorporationStepsGraph : incorporationStepsLegacy ; for ( IncorporationStep is : incorporationSteps ) { if ( is . accepts ( uv , inferenceContext ) ) { is . apply ( uv , inferenceContext , warn ) ; } } } if ( ! mlistener . changed || ! allowGraphInference ) break ; } } finally { mlistener . detach ( ) ; if ( incorporationCache . size ( ) == MAX_INCORPORATION_STEPS ) { inferenceContext . rollback ( saved_undet ) ; } incorporationCache . clear ( ) ; } } | Check bounds and perform incorporation |
11,254 | void checkCompatibleUpperBounds ( UndetVar uv , InferenceContext inferenceContext ) { List < Type > hibounds = Type . filter ( uv . getBounds ( InferenceBound . UPPER ) , new BoundFilter ( inferenceContext ) ) ; Type hb = null ; if ( hibounds . isEmpty ( ) ) hb = syms . objectType ; else if ( hibounds . tail . isEmpty ( ) ) hb = hibounds . head ; else hb = types . glb ( hibounds ) ; if ( hb == null || hb . isErroneous ( ) ) reportBoundError ( uv , BoundErrorKind . BAD_UPPER ) ; } | Make sure that the upper bounds we got so far lead to a solvable inference variable by making sure that a glb exists . |
11,255 | public JwwfServer bindWebapp ( final Class < ? extends User > user , String url ) { if ( ! url . endsWith ( "/" ) ) url = url + "/" ; context . addServlet ( new ServletHolder ( new WebClientServelt ( clientCreator ) ) , url + "" ) ; context . addServlet ( new ServletHolder ( new SkinServlet ( ) ) , url + "__jwwf/skins/*" ) ; ServletHolder fontServletHolder = new ServletHolder ( new ResourceServlet ( ) ) ; fontServletHolder . setInitParameter ( "basePackage" , "net/magik6k/jwwf/assets/fonts" ) ; context . addServlet ( fontServletHolder , url + "__jwwf/fonts/*" ) ; context . addServlet ( new ServletHolder ( new APISocketServlet ( new UserFactory ( ) { public User createUser ( ) { try { User u = user . getDeclaredConstructor ( ) . newInstance ( ) ; u . setServer ( jwwfServer ) ; return u ; } catch ( Exception e ) { e . printStackTrace ( ) ; } return null ; } } ) ) , url + "__jwwf/socket" ) ; for ( JwwfPlugin plugin : plugins ) { if ( plugin instanceof IPluginWebapp ) ( ( IPluginWebapp ) plugin ) . onWebappBound ( this , url ) ; } return this ; } | Binds webapp to address |
11,256 | public JwwfServer attachPlugin ( JwwfPlugin plugin ) { plugins . add ( plugin ) ; if ( plugin instanceof IPluginGlobal ) ( ( IPluginGlobal ) plugin ) . onAttach ( this ) ; return this ; } | Attahes new plugin to this server |
11,257 | public JwwfServer startAndJoin ( ) { try { server . start ( ) ; server . join ( ) ; } catch ( Exception e ) { e . printStackTrace ( ) ; } return this ; } | Starts Jetty server and waits for it |
11,258 | public static InputStream decode ( DataBinder binder , InputStream stream ) throws ParserConfigurationException , SAXException , IOException { XML . newSAXParser ( ) . parse ( stream , new XDBHandler ( binder ) ) ; return stream ; } | Decodes an XML stream . Returns the input stream . |
11,259 | void addBridge ( DiagnosticPosition pos , MethodSymbol meth , MethodSymbol impl , ClassSymbol origin , boolean hypothetical , ListBuffer < JCTree > bridges ) { make . at ( pos ) ; Type origType = types . memberType ( origin . type , meth ) ; Type origErasure = erasure ( origType ) ; Type bridgeType = meth . erasure ( types ) ; long flags = impl . flags ( ) & AccessFlags | SYNTHETIC | BRIDGE | ( origin . isInterface ( ) ? DEFAULT : 0 ) ; if ( hypothetical ) flags |= HYPOTHETICAL ; MethodSymbol bridge = new MethodSymbol ( flags , meth . name , bridgeType , origin ) ; bridge . params = createBridgeParams ( impl , bridge , bridgeType ) ; bridge . setAttributes ( impl ) ; if ( ! hypothetical ) { JCMethodDecl md = make . MethodDef ( bridge , null ) ; JCExpression receiver = ( impl . owner == origin ) ? make . This ( origin . erasure ( types ) ) : make . Super ( types . supertype ( origin . type ) . tsym . erasure ( types ) , origin ) ; Type calltype = erasure ( impl . type . getReturnType ( ) ) ; JCExpression call = make . Apply ( null , make . Select ( receiver , impl ) . setType ( calltype ) , translateArgs ( make . Idents ( md . params ) , origErasure . getParameterTypes ( ) , null ) ) . setType ( calltype ) ; JCStatement stat = ( origErasure . getReturnType ( ) . hasTag ( VOID ) ) ? make . Exec ( call ) : make . Return ( coerce ( call , bridgeType . getReturnType ( ) ) ) ; md . body = make . Block ( 0 , List . of ( stat ) ) ; bridges . append ( md ) ; } origin . members ( ) . enter ( bridge ) ; overridden . put ( bridge , meth ) ; } | Add a bridge definition and enter corresponding method symbol in local scope of origin . |
11,260 | void addBridges ( DiagnosticPosition pos , ClassSymbol origin , ListBuffer < JCTree > bridges ) { Type st = types . supertype ( origin . type ) ; while ( st . hasTag ( CLASS ) ) { addBridges ( pos , st . tsym , origin , bridges ) ; st = types . supertype ( st ) ; } for ( List < Type > l = types . interfaces ( origin . type ) ; l . nonEmpty ( ) ; l = l . tail ) addBridges ( pos , l . head . tsym , origin , bridges ) ; } | Add all necessary bridges to some class appending them to list buffer . |
11,261 | public void visitTypeApply ( JCTypeApply tree ) { JCTree clazz = translate ( tree . clazz , null ) ; result = clazz ; } | Visitor method for parameterized types . |
11,262 | public JCTree translateTopLevelClass ( JCTree cdef , TreeMaker make ) { this . make = make ; pt = null ; return translate ( cdef , null ) ; } | Translate a toplevel class definition . |
11,263 | protected void addAllProfilesLink ( Content div ) { Content linkContent = getHyperLink ( DocPaths . PROFILE_OVERVIEW_FRAME , allprofilesLabel , "" , "packageListFrame" ) ; Content span = HtmlTree . SPAN ( linkContent ) ; div . addContent ( span ) ; } | Adds All Profiles link for the top of the left - hand frame page to the documentation tree . |
11,264 | public BiStream < T , U > throwIfNull ( BiPredicate < ? super T , ? super U > biPredicate , Supplier < ? extends RuntimeException > e ) { Predicate < T > predicate = ( t ) -> biPredicate . test ( t , object ) ; return nonEmptyStream ( stream . filter ( predicate ) , e ) ; } | Compares the objects from stream to the injected object . If the rest of the stream equals null so exception is thrown . |
11,265 | void setCurrent ( TreePath path , DocCommentTree comment ) { currPath = path ; currDocComment = comment ; currElement = trees . getElement ( currPath ) ; currOverriddenMethods = ( ( JavacTypes ) types ) . getOverriddenMethods ( currElement ) ; AccessKind ak = AccessKind . PUBLIC ; for ( TreePath p = path ; p != null ; p = p . getParentPath ( ) ) { Element e = trees . getElement ( p ) ; if ( e != null && e . getKind ( ) != ElementKind . PACKAGE ) { ak = min ( ak , AccessKind . of ( e . getModifiers ( ) ) ) ; } } currAccess = ak ; } | Set the current declaration and its doc comment . |
11,266 | public static < E extends Enum < E > > Flags < E > valueOf ( Class < E > type , String values ) { Flags < E > flags = new Flags < E > ( type ) ; for ( String text : values . trim ( ) . split ( MULTI_VALUE_SEPARATOR ) ) { flags . set ( Enum . valueOf ( type , text ) ) ; } return flags ; } | Returns a Flags with a value represented by a string of concatenated enum literal names separated by any combination of a comma a colon or a white space . |
11,267 | public static void generate ( ConfigurationImpl configuration , PackageDoc packageDoc , int profileValue ) { ProfilePackageFrameWriter profpackgen ; try { String profileName = Profile . lookup ( profileValue ) . name ; profpackgen = new ProfilePackageFrameWriter ( configuration , packageDoc , profileName ) ; StringBuilder winTitle = new StringBuilder ( profileName ) ; String sep = " - " ; winTitle . append ( sep ) ; String pkgName = Util . getPackageName ( packageDoc ) ; winTitle . append ( pkgName ) ; Content body = profpackgen . getBody ( false , profpackgen . getWindowTitle ( winTitle . toString ( ) ) ) ; Content profName = new StringContent ( profileName ) ; Content sepContent = new StringContent ( sep ) ; Content pkgNameContent = new RawHtml ( pkgName ) ; Content heading = HtmlTree . HEADING ( HtmlConstants . TITLE_HEADING , HtmlStyle . bar , profpackgen . getTargetProfileLink ( "classFrame" , profName , profileName ) ) ; heading . addContent ( sepContent ) ; heading . addContent ( profpackgen . getTargetProfilePackageLink ( packageDoc , "classFrame" , pkgNameContent , profileName ) ) ; body . addContent ( heading ) ; HtmlTree div = new HtmlTree ( HtmlTag . DIV ) ; div . addStyle ( HtmlStyle . indexContainer ) ; profpackgen . addClassListing ( div , profileValue ) ; body . addContent ( div ) ; profpackgen . printHtmlDocument ( configuration . metakeywords . getMetaKeywords ( packageDoc ) , false , body ) ; profpackgen . close ( ) ; } catch ( IOException exc ) { configuration . standardmessage . error ( "doclet.exception_encountered" , exc . toString ( ) , DocPaths . PACKAGE_FRAME . getPath ( ) ) ; throw new DocletAbortException ( exc ) ; } } | Generate a profile package summary page for the left - hand bottom frame . Construct the ProfilePackageFrameWriter object and then uses it generate the file . |
11,268 | public static < First , Second > Pair < First , Second > from ( final First first , final Second second ) { return new ImmutablePair < First , Second > ( first , second ) ; } | Create a simple pair from it s first and second component . |
11,269 | public static < CommonSuperType , First extends CommonSuperType , Second extends CommonSuperType > CommonSuperType [ ] toArray ( final Pair < First , Second > pair , final Class < CommonSuperType > commonSuperType ) { @ SuppressWarnings ( "unchecked" ) final CommonSuperType [ ] array = ( CommonSuperType [ ] ) Array . newInstance ( commonSuperType , 2 ) ; return toArray ( pair , array , 0 ) ; } | Transform a pair into an array of the common super type of both components . |
11,270 | public static < CommonSuperType , First extends CommonSuperType , Second extends CommonSuperType > CommonSuperType [ ] toArray ( final Pair < First , Second > pair , final CommonSuperType [ ] target , final int offset ) { target [ offset ] = pair . getFirst ( ) ; target [ offset + 1 ] = pair . getSecond ( ) ; return target ; } | Write a pair into an array of the common super type of both components . |
11,271 | public void setFilter ( Service . Filter filter ) { _filter = _filter == null ? filter : new CompoundServiceFilter ( filter , _filter ) ; } | Installs a service filter . |
11,272 | public void setFilters ( List < Service . Filter > filters ) { for ( Service . Filter filter : filters ) setFilter ( filter ) ; } | Installs a list of service filters . This method is designed to facilitate Spring bean assembly . |
11,273 | private Interaction findContext ( String id ) { for ( int i = _currentInteractions . size ( ) - 1 ; i >= 0 ; i -- ) { Interaction ia = ( Interaction ) _currentInteractions . get ( i ) ; if ( ia . id . equals ( id ) ) { return ia ; } } return null ; } | Caller must hold lock on interactions |
11,274 | public List < RpcResponse > request ( List < RpcRequest > reqList ) { for ( RpcRequest req : reqList ) { this . reqList . add ( req ) ; } return null ; } | Adds all requests in reqList to internal request list |
11,275 | public static KindName kindName ( int kind ) { switch ( kind ) { case PCK : return KindName . PACKAGE ; case TYP : return KindName . CLASS ; case VAR : return KindName . VAR ; case VAL : return KindName . VAL ; case MTH : return KindName . METHOD ; default : throw new AssertionError ( "Unexpected kind: " + kind ) ; } } | A KindName representing a given symbol kind |
11,276 | public static KindName absentKind ( int kind ) { switch ( kind ) { case ABSENT_VAR : return KindName . VAR ; case WRONG_MTHS : case WRONG_MTH : case ABSENT_MTH : case WRONG_STATICNESS : return KindName . METHOD ; case ABSENT_TYP : return KindName . CLASS ; default : throw new AssertionError ( "Unexpected kind: " + kind ) ; } } | A KindName representing the kind of a missing symbol given an error kind . |
11,277 | public ICommonsList < IBANElementValue > parseToElementValues ( final String sIBAN ) { ValueEnforcer . notNull ( sIBAN , "IBANString" ) ; final String sRealIBAN = IBANManager . unifyIBAN ( sIBAN ) ; if ( sRealIBAN . length ( ) != m_nExpectedLength ) throw new IllegalArgumentException ( "Passed IBAN has an invalid length. Expected " + m_nExpectedLength + " but found " + sRealIBAN . length ( ) ) ; final ICommonsList < IBANElementValue > ret = new CommonsArrayList < > ( m_aElements . size ( ) ) ; int nIndex = 0 ; for ( final IBANElement aElement : m_aElements ) { final String sIBANPart = sRealIBAN . substring ( nIndex , nIndex + aElement . getLength ( ) ) ; ret . add ( new IBANElementValue ( aElement , sIBANPart ) ) ; nIndex += aElement . getLength ( ) ; } return ret ; } | Parse a given IBAN number string and convert it to elements according to this country s definition of IBAN numbers . |
11,278 | public static IBANCountryData createFromString ( final String sCountryCode , final int nExpectedLength , final String sLayout , final String sFixedCheckDigits , final LocalDate aValidFrom , final LocalDate aValidTo , final String sDesc ) { ValueEnforcer . notEmpty ( sDesc , "Desc" ) ; if ( sDesc . length ( ) < 4 ) throw new IllegalArgumentException ( "Cannot converted passed string because it is too short!" ) ; final ICommonsList < IBANElement > aList = _parseElements ( sDesc ) ; final Pattern aPattern = _parseLayout ( sCountryCode , nExpectedLength , sFixedCheckDigits , sLayout ) ; try { return new IBANCountryData ( nExpectedLength , aPattern , sFixedCheckDigits , aValidFrom , aValidTo , aList ) ; } catch ( final IllegalArgumentException ex ) { throw new IllegalArgumentException ( "Failed to parse '" + sDesc + "': " + ex . getMessage ( ) ) ; } } | This method is used to create an instance of this class from a string representation . |
11,279 | protected final void setControllerPath ( String path ) { requireNonNull ( path , "Global path cannot be change to 'null'" ) ; if ( ! "" . equals ( path ) && ! "/" . equals ( path ) ) { this . controllerPath = pathCorrector . apply ( path ) ; } } | Creates a resource part of the path unified for all routes defined in the inherited class |
11,280 | public void scan ( final String [ ] packages ) { LOGGER . info ( "Scanning packages {}:" , ArrayUtils . toString ( packages ) ) ; for ( final String pkg : packages ) { try { final String pkgFile = pkg . replace ( '.' , '/' ) ; final Enumeration < URL > urls = getRootClassloader ( ) . getResources ( pkgFile ) ; while ( urls . hasMoreElements ( ) ) { final URL url = urls . nextElement ( ) ; try { final URI uri = getURI ( url ) ; LOGGER . debug ( "Scanning {}" , uri ) ; scan ( uri , pkgFile ) ; } catch ( final URISyntaxException e ) { LOGGER . debug ( "URL {} cannot be converted to a URI" , url , e ) ; } } } catch ( final IOException ex ) { throw new RuntimeException ( "The resources for the package" + pkg + ", could not be obtained" , ex ) ; } } LOGGER . info ( "Found {} matching classes and {} matching files" , matchingClasses . size ( ) , matchingFiles . size ( ) ) ; } | Scans packages for matching Java classes . |
11,281 | int run ( String [ ] args ) { try { handleOptions ( args ) ; if ( classes == null || classes . size ( ) == 0 ) { if ( options . help || options . version || options . fullVersion ) return EXIT_OK ; else return EXIT_CMDERR ; } try { return run ( ) ; } finally { if ( defaultFileManager != null ) { try { defaultFileManager . close ( ) ; defaultFileManager = null ; } catch ( IOException e ) { throw new InternalError ( e ) ; } } } } catch ( BadArgs e ) { reportError ( e . key , e . args ) ; if ( e . showUsage ) { printLines ( getMessage ( "main.usage.summary" , progname ) ) ; } return EXIT_CMDERR ; } catch ( InternalError e ) { Object [ ] e_args ; if ( e . getCause ( ) == null ) e_args = e . args ; else { e_args = new Object [ e . args . length + 1 ] ; e_args [ 0 ] = e . getCause ( ) ; System . arraycopy ( e . args , 0 , e_args , 1 , e . args . length ) ; } reportError ( "err.internal.error" , e_args ) ; return EXIT_ABNORMAL ; } finally { log . flush ( ) ; } } | Compiler terminated abnormally |
11,282 | public String [ ] getMetaKeywords ( Profile profile ) { if ( configuration . keywords ) { String profileName = profile . name ; return new String [ ] { profileName + " " + "profile" } ; } else { return new String [ ] { } ; } } | Get the profile keywords . |
11,283 | public R scan ( Tree node , P p ) { return ( node == null ) ? null : node . accept ( this , p ) ; } | Scan a single node . |
11,284 | public void setAuthorizedPatternArray ( String [ ] patterns ) { Matcher matcher ; patterns : for ( String pattern : patterns ) { if ( ( matcher = IPv4_ADDRESS_PATTERN . matcher ( pattern ) ) . matches ( ) ) { short [ ] address = new short [ 4 ] ; for ( int i = 0 ; i < address . length ; ++ i ) { String p = matcher . group ( i + 1 ) ; try { address [ i ] = Short . parseShort ( p ) ; if ( address [ i ] > 255 ) { _logger . warning ( "Invalid pattern ignored: " + pattern ) ; continue patterns ; } } catch ( Exception x ) { if ( "*" . equals ( p ) ) { address [ i ] = 256 ; } else { _logger . warning ( "Invalid pattern ignored: " + pattern ) ; continue patterns ; } } } _logger . fine ( "normalized ipv4 address pattern = " + Strings . join ( address , '.' ) ) ; _ipv4patterns . add ( address ) ; } else if ( ( matcher = IPv6_ADDRESS_PATTERN . matcher ( pattern ) ) . matches ( ) ) { short [ ] address = new short [ 16 ] ; for ( int i = 0 ; i < address . length ; i += 2 ) { String p = matcher . group ( i / 2 + 1 ) ; try { int v = Integer . parseInt ( p , 16 ) ; address [ i ] = ( short ) ( v >> 8 ) ; address [ i + 1 ] = ( short ) ( v & 0x00ff ) ; } catch ( Exception x ) { if ( "*" . equals ( p ) ) { address [ i ] = 256 ; address [ i + 1 ] = 256 ; } else { _logger . warning ( "Invalid pattern ignored: " + pattern ) ; continue patterns ; } } } _logger . fine ( "normalized ipv6 address pattern = " + Strings . join ( address , '.' ) ) ; _ipv6patterns . add ( address ) ; } else { _logger . warning ( "Invalid pattern ignored: " + pattern ) ; } } } | Adds authorized address patterns as a String array . |
11,285 | private boolean findJavaSourceFiles ( String [ ] args ) { String prev = "" ; for ( String s : args ) { if ( s . endsWith ( ".java" ) && ! prev . equals ( "-xf" ) && ! prev . equals ( "-if" ) ) { return true ; } prev = s ; } return false ; } | Are java source files passed on the command line? |
11,286 | private boolean findAtFile ( String [ ] args ) { for ( String s : args ) { if ( s . startsWith ( "@" ) ) { return true ; } } return false ; } | Is an at file passed on the command line? |
11,287 | private String findLogLevel ( String [ ] args ) { for ( String s : args ) { if ( s . startsWith ( "--log=" ) && s . length ( ) > 6 ) { return s . substring ( 6 ) ; } if ( s . equals ( "-verbose" ) ) { return "info" ; } } return "info" ; } | Find the log level setting . |
11,288 | private static boolean makeSureExists ( File dir ) { if ( ! dir . exists ( ) ) { if ( ! dir . mkdirs ( ) ) { Log . error ( "Could not create the directory " + dir . getPath ( ) ) ; return false ; } } return true ; } | Make sure directory exist create it if not . |
11,289 | private static void checkPattern ( String s ) throws ProblemException { Pattern p = Pattern . compile ( "[a-zA-Z_]{1}[a-zA-Z0-9_]*(\\.[a-zA-Z_]{1}[a-zA-Z0-9_]*)*(\\.\\*)?+" ) ; Matcher m = p . matcher ( s ) ; if ( ! m . matches ( ) ) { throw new ProblemException ( "The string \"" + s + "\" is not a proper package name pattern." ) ; } } | Verify that a package pattern is valid . |
11,290 | private static void checkFilePattern ( String s ) throws ProblemException { Pattern p = null ; if ( File . separatorChar == '\\' ) { p = Pattern . compile ( "\\*?(.+\\\\)*.+" ) ; } else if ( File . separatorChar == '/' ) { p = Pattern . compile ( "\\*?(.+/)*.+" ) ; } else { throw new ProblemException ( "This platform uses the unsupported " + File . separatorChar + " as file separator character. Please add support for it!" ) ; } Matcher m = p . matcher ( s ) ; if ( ! m . matches ( ) ) { throw new ProblemException ( "The string \"" + s + "\" is not a proper file name." ) ; } } | Verify that a source file name is valid . |
11,291 | private static boolean hasOption ( String [ ] args , String option ) { for ( String a : args ) { if ( a . equals ( option ) ) return true ; } return false ; } | Scan the arguments to find an option is used . |
11,292 | private static void rewriteOptions ( String [ ] args , String option , String new_option ) { for ( int i = 0 ; i < args . length ; ++ i ) { if ( args [ i ] . equals ( option ) ) { args [ i ] = new_option ; } } } | Rewrite a single option into something else . |
11,293 | private static File findDirectoryOption ( String [ ] args , String option , String name , boolean needed , boolean allow_dups , boolean create ) throws ProblemException , ProblemException { File dir = null ; for ( int i = 0 ; i < args . length ; ++ i ) { if ( args [ i ] . equals ( option ) ) { if ( dir != null ) { throw new ProblemException ( "You have already specified the " + name + " dir!" ) ; } if ( i + 1 >= args . length ) { throw new ProblemException ( "You have to specify a directory following " + option + "." ) ; } if ( args [ i + 1 ] . indexOf ( File . pathSeparatorChar ) != - 1 ) { throw new ProblemException ( "You must only specify a single directory for " + option + "." ) ; } dir = new File ( args [ i + 1 ] ) ; if ( ! dir . exists ( ) ) { if ( ! create ) { throw new ProblemException ( "This directory does not exist: " + dir . getPath ( ) ) ; } else if ( ! makeSureExists ( dir ) ) { throw new ProblemException ( "Cannot create directory " + dir . getPath ( ) ) ; } } if ( ! dir . isDirectory ( ) ) { throw new ProblemException ( "\"" + args [ i + 1 ] + "\" is not a directory." ) ; } } } if ( dir == null && needed ) { throw new ProblemException ( "You have to specify " + option ) ; } try { if ( dir != null ) return dir . getCanonicalFile ( ) ; } catch ( IOException e ) { throw new ProblemException ( "" + e ) ; } return null ; } | Scan the arguments to find an option that specifies a directory . Create the directory if necessary . |
11,294 | private static boolean shouldBeFollowedByPath ( String o ) { return o . equals ( "-s" ) || o . equals ( "-h" ) || o . equals ( "-d" ) || o . equals ( "-sourcepath" ) || o . equals ( "-classpath" ) || o . equals ( "-cp" ) || o . equals ( "-bootclasspath" ) || o . equals ( "-src" ) ; } | Option is followed by path . |
11,295 | private static String [ ] addSrcBeforeDirectories ( String [ ] args ) { List < String > newargs = new ArrayList < String > ( ) ; for ( int i = 0 ; i < args . length ; ++ i ) { File dir = new File ( args [ i ] ) ; if ( dir . exists ( ) && dir . isDirectory ( ) ) { if ( i == 0 || ! shouldBeFollowedByPath ( args [ i - 1 ] ) ) { newargs . add ( "-src" ) ; } } newargs . add ( args [ i ] ) ; } return newargs . toArray ( new String [ 0 ] ) ; } | Add - src before source root directories if not already there . |
11,296 | private static void checkSrcOption ( String [ ] args ) throws ProblemException { Set < File > dirs = new HashSet < File > ( ) ; for ( int i = 0 ; i < args . length ; ++ i ) { if ( args [ i ] . equals ( "-src" ) ) { if ( i + 1 >= args . length ) { throw new ProblemException ( "You have to specify a directory following -src." ) ; } StringTokenizer st = new StringTokenizer ( args [ i + 1 ] , File . pathSeparator ) ; while ( st . hasMoreElements ( ) ) { File dir = new File ( st . nextToken ( ) ) ; if ( ! dir . exists ( ) ) { throw new ProblemException ( "This directory does not exist: " + dir . getPath ( ) ) ; } if ( ! dir . isDirectory ( ) ) { throw new ProblemException ( "\"" + dir . getPath ( ) + "\" is not a directory." ) ; } if ( dirs . contains ( dir ) ) { throw new ProblemException ( "The src directory \"" + dir . getPath ( ) + "\" is specified more than once!" ) ; } dirs . add ( dir ) ; } } } if ( dirs . isEmpty ( ) ) { throw new ProblemException ( "You have to specify -src." ) ; } } | Check the - src options . |
11,297 | private static File findFileOption ( String [ ] args , String option , String name , boolean needed ) throws ProblemException , ProblemException { File file = null ; for ( int i = 0 ; i < args . length ; ++ i ) { if ( args [ i ] . equals ( option ) ) { if ( file != null ) { throw new ProblemException ( "You have already specified the " + name + " file!" ) ; } if ( i + 1 >= args . length ) { throw new ProblemException ( "You have to specify a file following " + option + "." ) ; } file = new File ( args [ i + 1 ] ) ; if ( file . isDirectory ( ) ) { throw new ProblemException ( "\"" + args [ i + 1 ] + "\" is not a file." ) ; } if ( ! file . exists ( ) && needed ) { throw new ProblemException ( "The file \"" + args [ i + 1 ] + "\" does not exist." ) ; } } } if ( file == null && needed ) { throw new ProblemException ( "You have to specify " + option ) ; } return file ; } | Scan the arguments to find an option that specifies a file . |
11,298 | public static boolean findBooleanOption ( String [ ] args , String option ) { for ( int i = 0 ; i < args . length ; ++ i ) { if ( args [ i ] . equals ( option ) ) return true ; } return false ; } | Look for a specific switch return true if found . |
11,299 | public static int findNumberOption ( String [ ] args , String option ) { int rc = 0 ; for ( int i = 0 ; i < args . length ; ++ i ) { if ( args [ i ] . equals ( option ) ) { if ( args . length > i + 1 ) { rc = Integer . parseInt ( args [ i + 1 ] ) ; } } } return rc ; } | Scan the arguments to find an option that specifies a number . |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.