idx int64 0 41.2k | question stringlengths 73 5.81k | target stringlengths 5 918 |
|---|---|---|
36,500 | public final FacetOptions addFacetOnFlieldnames ( Collection < String > fieldnames ) { Assert . notNull ( fieldnames , "Fieldnames must not be null!" ) ; for ( String fieldname : fieldnames ) { addFacetOnField ( fieldname ) ; } return this ; } | Append all fieldnames for faceting |
36,501 | public String createQueryStringFromNode ( Node node , int position ) { return createQueryStringFromNode ( node , position , null ) ; } | Create the plain query string representation of the given node . |
36,502 | @ SuppressWarnings ( "unchecked" ) public final < T extends SolrDataQuery > T addCriteria ( Criteria criteria ) { Assert . notNull ( criteria , "Cannot add null criteria." ) ; if ( this . criteria == null ) { this . criteria = criteria ; } else { if ( this . criteria instanceof Crotch ) { ( ( Crotch ) this . criteria )... | Add an criteria to the query . The criteria will be connected using AND . |
36,503 | protected void doClose ( ) { this . delegate = Collections . < T > emptyList ( ) . iterator ( ) ; this . referenceQuery . clear ( ) ; this . position = - 1 ; this . cursorMark = null ; } | Customization hook for clean up operations |
36,504 | public static Set < Exclusion > setupExcludedArtifacts ( List < String > excludedArtifacts ) throws MojoExecutionException { Set < Exclusion > exclusionSet = new HashSet < > ( ) ; for ( String artifact : Optional . ofNullable ( excludedArtifacts ) . orElse ( Collections . emptyList ( ) ) ) { exclusionSet . add ( conver... | Build up an exclusion set |
36,505 | static Exclusion convertExclusionPatternIntoExclusion ( String exceptionPattern ) throws MojoExecutionException { Matcher matcher = COORDINATE_PATTERN . matcher ( exceptionPattern ) ; if ( ! matcher . matches ( ) ) { throw new MojoExecutionException ( String . format ( "Bad artifact coordinates %s, expected format is <... | Convert an exclusion pattern into an Exclusion object |
36,506 | public static boolean artifactIsNotExcluded ( Collection < Exclusion > exclusions , Artifact artifact ) { return Optional . ofNullable ( exclusions ) . orElse ( Collections . emptyList ( ) ) . stream ( ) . noneMatch ( selectedExclusion -> null != artifact && selectedExclusion . getGroupId ( ) . equals ( artifact . getG... | Check that an artifact is not excluded |
36,507 | public static List < String > createDefaultJmeterArtifactsArray ( String jmeterVersion ) { List < String > artifacts = new ArrayList < > ( ) ; JMETER_ARTIFACT_NAMES . forEach ( artifactName -> artifacts . add ( String . format ( "%s:%s:%s" , JMETER_GROUP_ID , artifactName , jmeterVersion ) ) ) ; return artifacts ; } | Create a default Array of JMeter artifact coordinates |
36,508 | public static boolean isArtifactIsOlderThanArtifact ( Artifact artifact , Artifact comparisonArtifact ) throws InvalidVersionSpecificationException { GenericVersionScheme genericVersionScheme = new GenericVersionScheme ( ) ; Version firstArtifactVersion = genericVersionScheme . parseVersion ( artifact . getVersion ( ) ... | Check to see if a specified artifact is the same version or a newer version that the comparative artifact |
36,509 | public void doExecute ( ) throws MojoExecutionException { getLog ( ) . info ( " " ) ; getLog ( ) . info ( LINE_SEPARATOR ) ; getLog ( ) . info ( "C O N F I G U R I N G J M E T E R" ) ; getLog ( ) . info ( LINE_SEPARATOR ) ; getLog ( ) . info ( " " ) ; processedArtifacts . clear ( ) ; JMeterConfigurationHolder . getI... | Configure a local instance of JMeter |
36,510 | private void generateJMeterDirectoryTree ( ) { File workingDirectory = new File ( jmeterDirectory , "bin" ) ; workingDirectory . mkdirs ( ) ; JMeterConfigurationHolder . getInstance ( ) . setWorkingDirectory ( workingDirectory ) ; customPropertiesDirectory = new File ( jmeterDirectory , "custom_properties" ) ; customPr... | Generate the directory tree utilised by JMeter . |
36,511 | private void configureJMeterArtifacts ( ) { if ( jmeterArtifacts . isEmpty ( ) ) { jmeterArtifacts = createDefaultJmeterArtifactsArray ( jmeterVersion ) ; } getLog ( ) . debug ( "JMeter Artifact List:" ) ; jmeterArtifacts . forEach ( artifact -> getLog ( ) . debug ( artifact ) ) ; } | This sets the default list of artifacts that we use to set up a local instance of JMeter . We only use this default list if < ; jmeterArtifacts> ; has not been overridden in the POM . |
36,512 | private void copyExplicitLibraries ( List < String > desiredArtifacts , File destination , boolean downloadDependencies ) throws MojoExecutionException { for ( String desiredArtifact : desiredArtifacts ) { copyExplicitLibrary ( desiredArtifact , destination , downloadDependencies ) ; } } | Copy a list of libraries to a specific folder . |
36,513 | private Artifact getArtifactResult ( Artifact desiredArtifact ) throws MojoExecutionException { ArtifactRequest artifactRequest = new ArtifactRequest ( ) ; artifactRequest . setArtifact ( desiredArtifact ) ; artifactRequest . setRepositories ( repositoryList ) ; try { return repositorySystem . resolveArtifact ( reposit... | Find a specific artifact in a remote repository |
36,514 | private boolean copyArtifactIfRequired ( Artifact artifactToCopy , Path destinationDirectory ) throws MojoExecutionException { for ( String ignoredArtifact : ignoredArtifacts ) { Artifact artifactToIgnore = getArtifactResult ( new DefaultArtifact ( ignoredArtifact ) ) ; if ( artifactToCopy . getFile ( ) . getName ( ) .... | Copy an Artifact to a directory |
36,515 | public List < String > buildArgumentsArray ( ) throws MojoExecutionException { if ( ! argumentList . contains ( TESTFILE_OPT ) && ! disableTests ) { throw new MojoExecutionException ( "No test(s) specified!" ) ; } List < String > argumentsArray = new ArrayList < > ( ) ; for ( JMeterCommandLineArguments argument : argum... | Generate an arguments array representing the command line options you want to send to JMeter . The order of the array is determined by the order the values in JMeterCommandLineArguments are defined . |
36,516 | public void doExecute ( ) throws MojoExecutionException { getLog ( ) . info ( " " ) ; getLog ( ) . info ( LINE_SEPARATOR ) ; getLog ( ) . info ( " S T A R T I N G J M E T E R S E R V E R " ) ; getLog ( ) . info ( LINE_SEPARATOR ) ; getLog ( ) . info ( String . format ( " Host: %s" , exportedRmiHostname ) ) ; getL... | Load the JMeter server |
36,517 | public void doExecute ( ) throws MojoExecutionException { getLog ( ) . info ( " " ) ; getLog ( ) . info ( LINE_SEPARATOR ) ; getLog ( ) . info ( " P E R F O R M A N C E T E S T S" ) ; getLog ( ) . info ( LINE_SEPARATOR ) ; getLog ( ) . info ( " " ) ; if ( ! testFilesDirectory . exists ( ) ) { getLog ( ) . info ( "<t... | Run all the JMeter tests . |
36,518 | protected JMeterArgumentsArray computeJMeterArgumentsArray ( boolean disableGUI , boolean isCSVFormat ) throws MojoExecutionException { JMeterArgumentsArray testArgs = new JMeterArgumentsArray ( disableGUI , jmeterDirectory . getAbsolutePath ( ) ) . setResultsDirectory ( resultsDirectory . getAbsolutePath ( ) ) . setRe... | Generate the initial JMeter Arguments array that is used to create the command line that we pass to JMeter . |
36,519 | protected void loadMavenProxy ( ) { if ( null == settings ) { return ; } Proxy mvnProxy = settings . getActiveProxy ( ) ; if ( mvnProxy != null ) { ProxyConfiguration newProxyConfiguration = new ProxyConfiguration ( ) ; newProxyConfiguration . setHost ( mvnProxy . getHost ( ) ) ; newProxyConfiguration . setPort ( mvnPr... | Try to load the active maven proxy . |
36,520 | public static String humanReadableCommandLineOutput ( List < String > arguments ) { StringBuilder debugOutput = new StringBuilder ( ) ; for ( String argument : arguments ) { debugOutput . append ( argument ) . append ( " " ) ; } return debugOutput . toString ( ) . trim ( ) ; } | Build a human readable command line from the arguments set by the plugin |
36,521 | public static Boolean isNotSet ( String value ) { return null == value || value . isEmpty ( ) || value . trim ( ) . length ( ) == 0 ; } | Utility function to check if a String is defined and not empty |
36,522 | public static Boolean isNotSet ( File value ) { return null == value || value . toString ( ) . isEmpty ( ) || value . toString ( ) . trim ( ) . length ( ) == 0 ; } | Utility function to check if File is defined and not empty |
36,523 | public void doExecute ( ) throws MojoExecutionException { getLog ( ) . info ( " " ) ; getLog ( ) . info ( LINE_SEPARATOR ) ; getLog ( ) . info ( " S T A R T I N G J M E T E R G U I " ) ; getLog ( ) . info ( LINE_SEPARATOR ) ; startJMeterGUI ( initialiseJMeterArgumentsArray ( ) ) ; } | Load the JMeter GUI |
36,524 | private Properties loadPropertiesFile ( File propertiesFile ) throws MojoExecutionException { try ( FileInputStream propertiesFileInputStream = new FileInputStream ( propertiesFile ) ) { Properties loadedProperties = new Properties ( ) ; loadedProperties . load ( propertiesFileInputStream ) ; return loadedProperties ; ... | Take a properties file and load it into a Properties Object |
36,525 | public void loadProvidedPropertiesIfAvailable ( File providedPropertiesFile , boolean replaceAllProperties ) throws MojoExecutionException { if ( providedPropertiesFile . exists ( ) ) { Properties providedPropertySet = loadPropertiesFile ( providedPropertiesFile ) ; if ( replaceAllProperties ) { this . properties = pro... | Check if a file exists . If it does calculate if we need to merge it with existing properties or replace all existing properties . |
36,526 | public void addAndOverwriteProperties ( Map < String , String > additionalProperties ) { additionalProperties . values ( ) . removeAll ( Collections . singleton ( null ) ) ; for ( Map . Entry < String , String > additionalPropertiesMap : additionalProperties . entrySet ( ) ) { if ( ! additionalPropertiesMap . getValue ... | Merge a Map of properties into our Properties object The additions will overwrite any existing properties |
36,527 | public void writePropertiesToFile ( File outputFile ) throws MojoExecutionException { stripOutReservedProperties ( ) ; if ( properties . isEmpty ( ) ) { return ; } try { try ( FileOutputStream writeOutFinalPropertiesFile = new FileOutputStream ( outputFile ) ) { properties . store ( writeOutFinalPropertiesFile , null )... | Strip out any reserved properties and then write properties object to a file . |
36,528 | private void warnUserOfPossibleErrors ( String newKey , Properties baseProperties ) { for ( String key : baseProperties . stringPropertyNames ( ) ) { if ( ! key . equals ( newKey ) && key . equalsIgnoreCase ( newKey ) ) { LOGGER . warn ( "You have set a property called '{}' which is very similar to '{}'!" , newKey , ke... | Print a warning out to the user to highlight potential typos in the properties they have set . |
36,529 | public boolean load ( String name , boolean verify ) { boolean loaded = false ; try { Platform platform = Platform . detect ( ) ; JarFile jar = new JarFile ( codeSource . getLocation ( ) . getPath ( ) , verify ) ; try { for ( String path : libCandidates ( platform , name ) ) { JarEntry entry = jar . getJarEntry ( path ... | Load a shared library and optionally verify the jar signatures . |
36,530 | private static File extract ( String name , InputStream is ) throws IOException { byte [ ] buf = new byte [ 4096 ] ; int len ; File lib = File . createTempFile ( name , "lib" ) ; FileOutputStream os = new FileOutputStream ( lib ) ; try { while ( ( len = is . read ( buf ) ) > 0 ) { os . write ( buf , 0 , len ) ; } } cat... | Extract a jar entry to a temp file . |
36,531 | private List < String > libCandidates ( Platform platform , String name ) { List < String > candidates = new ArrayList < String > ( ) ; StringBuilder sb = new StringBuilder ( ) ; sb . append ( libraryPath ) . append ( "/" ) ; sb . append ( platform . arch ) . append ( "/" ) ; sb . append ( platform . os ) . append ( "/... | Generate a list of candidate libraries for the supplied library name and suitable for the current platform . |
36,532 | public static byte [ ] decode ( char [ ] src , int [ ] table , char pad ) { int len = src . length ; if ( len == 0 ) return new byte [ 0 ] ; int padCount = ( src [ len - 1 ] == pad ? ( src [ len - 2 ] == pad ? 2 : 1 ) : 0 ) ; int bytes = ( len * 6 >> 3 ) - padCount ; int blocks = ( bytes / 3 ) * 3 ; byte [ ] dst = new ... | Decode base64 chars to bytes using the supplied decode table and padding character . |
36,533 | public static char [ ] encode ( byte [ ] src , char [ ] table , char pad ) { int len = src . length ; if ( len == 0 ) return new char [ 0 ] ; int blocks = ( len / 3 ) * 3 ; int chars = ( ( len - 1 ) / 3 + 1 ) << 2 ; int tail = len - blocks ; if ( pad == 0 && tail > 0 ) chars -= 3 - tail ; char [ ] dst = new char [ char... | Encode bytes to base64 chars using the supplied encode table and with optional padding . |
36,534 | public boolean load ( String name , boolean verify ) { boolean loaded ; try { System . loadLibrary ( name ) ; loaded = true ; } catch ( Throwable e ) { loaded = false ; } return loaded ; } | Load a shared library . |
36,535 | public Object createContext ( ApplicationRequest request , ApplicationResponse response ) { return new CookieContext ( request , response , mDomain , mPath , mIsSecure ) ; } | Creates a context for the templates . |
36,536 | public File [ ] getFiles ( ) { String path = mRequest . getParameter ( "path" ) ; if ( path == null ) { path = mApp . getInitParameter ( "defaultPath" ) ; } if ( path == null ) { path = "/" ; } File activefile = new File ( path ) ; if ( activefile . isDirectory ( ) ) { return activefile . listFiles ( ) ; } else { retur... | Gets an array of files in the directory specified by the path query parameter . |
36,537 | public void clear ( ) { mPutLock . lock ( ) ; mPollLock . lock ( ) ; try { mSize . set ( 0 ) ; mHead = new Node ( null ) ; mTail = new Node ( null ) ; mHead . mNext = mTail ; } finally { mPollLock . unlock ( ) ; mPutLock . unlock ( ) ; } } | Clears the contents of the queue . This is a blocking operation . |
36,538 | public boolean remove ( Node < E > e ) { mPutLock . lock ( ) ; mPollLock . lock ( ) ; try { if ( e == null ) return false ; if ( e . mRemoved ) return false ; if ( mSize . get ( ) == 0 ) return false ; if ( e == mTail ) { removeTail ( ) ; return true ; } if ( e == mHead . mNext ) { removeHead ( ) ; return true ; } if (... | Removes a given Node handle . This is a blocking operation that runs in constant time . |
36,539 | public Object getComponent ( String role , String roleHint ) throws ComponentLookupException { return container . lookup ( role , roleHint ) ; } | Gets the component . |
36,540 | public void setTcpNoDelay ( boolean on ) throws SocketException { if ( mSocket != null ) { mSocket . setTcpNoDelay ( on ) ; } else { setOption ( 0 , on ? Boolean . TRUE : Boolean . FALSE ) ; } } | Option 0 . |
36,541 | public void setSoLinger ( boolean on , int linger ) throws SocketException { if ( mSocket != null ) { mSocket . setSoLinger ( on , linger ) ; } else { Object value ; if ( on ) { value = new Integer ( linger ) ; } else { value = Boolean . FALSE ; } setOption ( 1 , value ) ; } } | Option 1 . |
36,542 | public void setSoTimeout ( int timeout ) throws SocketException { if ( mSocket != null ) { mSocket . setSoTimeout ( timeout ) ; } else { setOption ( 2 , new Integer ( timeout ) ) ; } } | Option 2 . |
36,543 | public void setSendBufferSize ( int size ) throws SocketException { if ( mSocket != null ) { mSocket . setSendBufferSize ( size ) ; } else { setOption ( 3 , new Integer ( size ) ) ; } } | Option 3 . |
36,544 | public void setReceiveBufferSize ( int size ) throws SocketException { if ( mSocket != null ) { mSocket . setReceiveBufferSize ( size ) ; } else { setOption ( 4 , new Integer ( size ) ) ; } } | Option 4 . |
36,545 | CheckedSocket recycle ( ) { CheckedSocket s ; if ( mClosed ) { s = null ; } else { s = mSocket ; mSocket = null ; mClosed = true ; } return s ; } | Returns the internal wrapped socket or null if not connected . After calling recycle this LazySocket instance is closed . |
36,546 | public AppAdminLinks getAdminLinks ( ) { AppAdminLinks links = new AppAdminLinks ( mConfig . getName ( ) ) ; links . addAdminLink ( "Templates" , "/system/teaservlet/AdminTemplates" ) ; links . addAdminLink ( "Functions" , "/system/teaservlet/AdminFunctions" ) ; links . addAdminLink ( "Applications" , "/system/teaservl... | This implementation uses hard coded link information but other applications can dynamically determine their admin links . |
36,547 | public void init ( ServletConfig config ) throws ServletException { super . init ( config ) ; mServletConfig = config ; config . getServletContext ( ) . log ( "Initializing TeaServlet..." ) ; String ver = System . getProperty ( "java.version" ) ; if ( ver . startsWith ( "0." ) || ver . startsWith ( "1.2" ) || ver . sta... | Initializes the TeaServlet . Creates the logger and loads the user s application . |
36,548 | protected void doGet ( HttpServletRequest request , HttpServletResponse response ) throws ServletException , IOException { if ( processStatus ( request , response ) ) { return ; } if ( ! isRunning ( ) ) { int errorCode = mProperties . getInt ( "startup.codes.error" , 503 ) ; response . sendError ( errorCode ) ; return ... | Process the user s http get request . Process the template that maps to the URI that was hit . |
36,549 | private boolean processResource ( ApplicationRequest appRequest , ApplicationResponse appResponse ) throws IOException { String requestURI = null ; if ( ( requestURI = appRequest . getPathInfo ( ) ) == null ) { String context = appRequest . getContextPath ( ) ; requestURI = appRequest . getRequestURI ( ) ; if ( request... | Inserts a plugin to expose parts of the teaservlet via the EngineAccess interface . |
36,550 | protected Object convertParameter ( String value , Class < ? > toType ) { if ( toType == Boolean . class ) { return ! "" . equals ( value ) ? new Boolean ( "true" . equals ( value ) ) : null ; } if ( toType == Integer . class ) { try { return new Integer ( value ) ; } catch ( NumberFormatException e ) { return null ; }... | Converts the given HTTP parameter value to the requested type so that it can be passed directly as a template parameter . This method is called if the template that is directly requested accepts non - String parameters and the request provides non - null values for those parameters . The template may request an array o... |
36,551 | public static String replace ( String source , String pattern , String replacement ) { return replace ( source , pattern , replacement , 0 ) ; } | Replaces all exact matches of the given pattern in the source string with the provided replacement . |
36,552 | public void print ( Object obj ) throws IOException { if ( mOut != null ) { mOut . write ( toString ( obj ) ) ; } } | The standard context method implemented to write to the file . |
36,553 | public void setType ( Type type ) { Type actual = Type . preserveType ( this . getType ( ) , type ) ; mConversions . clear ( ) ; mExceptionPossible = false ; if ( actual != null ) { mConversions . add ( new Conversion ( null , actual , true ) ) ; } } | Sets the type of this expression clearing the conversion chain . |
36,554 | public void setInitialType ( Type type ) { Type initial = getInitialType ( ) ; Type actual = Type . preserveType ( initial , type ) ; if ( actual != null && ! actual . equals ( initial ) ) { if ( initial == null ) { setType ( actual ) ; } else { Iterator < Conversion > it = mConversions . iterator ( ) ; mConversions = ... | Sets the intial type in the conversion chain but does not clear the conversions . |
36,555 | public synchronized Token peekToken ( ) throws IOException { if ( mLookahead . empty ( ) ) { return mLookahead . push ( scanToken ( ) ) ; } else { return mLookahead . peek ( ) ; } } | Returns EOF as the last token . |
36,556 | private Token scanText ( int c ) throws IOException { c = mSource . read ( ) ; int startLine = mSource . getLineNumber ( ) ; int startPos = mSource . getStartPosition ( ) ; int endPos = mSource . getEndPosition ( ) ; StringBuilder buf = new StringBuilder ( 256 ) ; while ( c != - 1 ) { if ( c == SourceReader . ENTER_COD... | The ENTER_TEXT code has already been scanned when this is called . |
36,557 | public static void main ( String [ ] args ) throws Exception { Map map = getAllProperties ( Class . forName ( args [ 0 ] ) ) ; Iterator keys = map . keySet ( ) . iterator ( ) ; while ( keys . hasNext ( ) ) { String key = ( String ) keys . next ( ) ; PropertyDescriptor desc = ( PropertyDescriptor ) map . get ( key ) ; S... | Test program . |
36,558 | public static Map getAllProperties ( Class clazz ) throws IntrospectionException { synchronized ( cPropertiesCache ) { Map properties ; Reference ref = ( Reference ) cPropertiesCache . get ( clazz ) ; if ( ref != null ) { properties = ( Map ) ref . get ( ) ; if ( properties != null ) { return properties ; } else { cPro... | A function that returns a Map of all the available properties on a given class including write - only properties . The properties returned is mostly a superset of those returned from the standard JavaBeans Introspector except more properties are made available to interfaces . |
36,559 | static ConstantLongInfo make ( ConstantPool cp , long value ) { ConstantInfo ci = new ConstantLongInfo ( value ) ; return ( ConstantLongInfo ) cp . addConstant ( ci ) ; } | Will return either a new ConstantLongInfo object or one already in the constant pool . If it is a new ConstantLongInfo it will be inserted into the pool . |
36,560 | public Template parse ( ) throws IOException { Template t = parseTemplate ( ) ; if ( t != null ) { return t ; } return new Template ( new SourceInfo ( 0 , 0 , 0 ) , null , null , false , null , null ) ; } | Returns a parse tree by its root node . The parse tree is generated from tokens read from the scanner . Any errors encountered while parsing are delivered by dispatching an event . Add a compile listener in order to capture parse errors . |
36,561 | private IfStatement parseIfStatement ( Token token ) throws IOException { SourceInfo info = token . getSourceInfo ( ) ; Expression condition = parseExpression ( ) ; if ( ! ( condition instanceof ParenExpression ) ) { error ( "if.condition" , condition . getSourceInfo ( ) ) ; } Block thenPart = parseBlock ( ) ; Block el... | When this is called the keyword if has already been read . |
36,562 | private ForeachStatement parseForeachStatement ( Token token ) throws IOException { SourceInfo info = token . getSourceInfo ( ) ; token = peek ( ) ; if ( token . getID ( ) == Token . LPAREN ) { read ( ) ; } else { error ( "foreach.lparen.expected" , token ) ; } VariableRef loopVar = parseLValue ( ) ; boolean foundASTok... | When this is called the keyword foreach has already been read . |
36,563 | private AssignmentStatement parseAssignmentStatement ( Token token ) throws IOException { SourceInfo info = token . getSourceInfo ( ) ; VariableRef lvalue = parseLValue ( token ) ; if ( peek ( ) . getID ( ) == Token . ASSIGN ) { read ( ) ; } else { error ( "assignment.equals.expected" , peek ( ) ) ; } Expression rvalue... | When this is called the identifier token has already been read . |
36,564 | private FunctionCallExpression parseFunctionCallExpression ( Token token ) throws IOException { Token next = peek ( ) ; if ( next . getID ( ) != Token . LPAREN ) { return null ; } SourceInfo info = token . getSourceInfo ( ) ; Name target = new Name ( info , token . getStringValue ( ) ) ; return parseCallExpression ( Fu... | a FunctionCallExpression . Token passed in must be an identifier . |
36,565 | public ConstantInfo getConstant ( int index ) { if ( mIndexedConstants == null ) { throw new ArrayIndexOutOfBoundsException ( "Constant pool indexes have not been assigned" ) ; } return ( ConstantInfo ) mIndexedConstants . get ( index ) ; } | Returns a constant from the pool by index or throws an exception if not found . If this constant pool has not yet been written or was not created by the read method indexes are not assigned . |
36,566 | public ConstantMethodInfo addConstantConstructor ( String className , TypeDesc [ ] params ) { return addConstantMethod ( className , "<init>" , null , params ) ; } | Get or create a constant from the constant pool representing a constructor in any class . |
36,567 | public ConstantInfo addConstant ( ConstantInfo constant ) { ConstantInfo info = ( ConstantInfo ) mConstants . get ( constant ) ; if ( info != null ) { return info ; } int entryCount = constant . getEntryCount ( ) ; if ( mIndexedConstants != null && mPreserveOrder ) { int size = mIndexedConstants . size ( ) ; mIndexedCo... | Will only insert into the pool if the constant is not already in the pool . |
36,568 | public String doGet ( String host , String path , int port , Map < String , String > headers , int timeout ) throws UnknownHostException , ConnectException , IOException { return doHttpCall ( host , path , null , port , headers , timeout , false ) ; } | Perform an HTTP GET at the given path returning the results of the response . |
36,569 | public String doSecureGet ( String host , String path , int port , Map < String , String > headers , int timeout ) throws UnknownHostException , ConnectException , IOException { return doHttpCall ( host , path , null , port , headers , timeout , true ) ; } | Perform a secure HTTPS GET at the given path returning the results of the response . |
36,570 | public String doPost ( String host , String path , String postData , int port , Map < String , String > headers , int timeout ) throws UnknownHostException , ConnectException , IOException { return doHttpCall ( host , path , postData , port , headers , timeout , false ) ; } | Perform an HTTP POST at the given path sending in the given post data returning the results of the response . |
36,571 | public String doSecurePost ( String host , String path , String postData , int port , Map < String , String > headers , int timeout ) throws UnknownHostException , ConnectException , IOException { return doHttpCall ( host , path , postData , port , headers , timeout , true ) ; } | Perform a secure HTTPS POST at the given path sending in the given post data returning the results of the response . |
36,572 | public TypeDescription getArrayType ( ) { Class < ? > c = getTeaToolsUtils ( ) . getArrayType ( mType ) ; if ( mType == c ) { return this ; } return getTeaToolsUtils ( ) . createTypeDescription ( c ) ; } | Returns the array type . Returns this if it is not an array type . |
36,573 | public BeanInfo getBeanInfo ( ) { if ( mBeanInfo == null ) { try { mBeanInfo = getTeaToolsUtils ( ) . getBeanInfo ( mType ) ; } catch ( Exception e ) { return null ; } } return mBeanInfo ; } | Introspects a Java bean to learn about all its properties exposed methods and events . Returns null if the BeanInfo could not be created . |
36,574 | public PropertyDescriptor [ ] getPropertyDescriptors ( ) { BeanInfo info = getBeanInfo ( ) ; if ( info == null ) { return null ; } PropertyDescriptor [ ] pds = info . getPropertyDescriptors ( ) ; getTeaToolsUtils ( ) . sortPropertyDescriptors ( pds ) ; return pds ; } | Returns the type s PropertyDescriptors . |
36,575 | public MethodDescriptor [ ] getMethodDescriptors ( ) { BeanInfo info = getBeanInfo ( ) ; if ( info == null ) { return null ; } MethodDescriptor [ ] mds = info . getMethodDescriptors ( ) ; getTeaToolsUtils ( ) . sortMethodDescriptors ( mds ) ; return mds ; } | Returns the type s MethodDescriptors . |
36,576 | public final static byte reverseIfOpcode ( byte opcode ) { switch ( opcode ) { case IF_ACMPEQ : return IF_ACMPNE ; case IF_ACMPNE : return IF_ACMPEQ ; case IF_ICMPEQ : return IF_ICMPNE ; case IF_ICMPNE : return IF_ICMPEQ ; case IF_ICMPLT : return IF_ICMPGE ; case IF_ICMPGE : return IF_ICMPLT ; case IF_ICMPGT : return I... | Reverses the condition for an if opcode . i . e . IFEQ is changed to IFNE . |
36,577 | public FunctionInfo [ ] getFunctions ( ) { ApplicationInfo [ ] AppInf = getApplications ( ) ; FunctionInfo [ ] funcArray = null ; try { MethodDescriptor [ ] methods = Introspector . getBeanInfo ( HttpContext . class ) . getMethodDescriptors ( ) ; List < FunctionInfo > funcList = new Vector < FunctionInfo > ( 50 ) ; for... | Returns information about all functions available to the templates . |
36,578 | @ SuppressWarnings ( "unchecked" ) public TemplateWrapper [ ] getKnownTemplates ( ) { if ( mTemplateOrdering == null ) { setTemplateOrdering ( "name" ) ; } Comparator < TemplateWrapper > comparator = BeanComparator . forClass ( TemplateWrapper . class ) . orderBy ( "name" ) ; Set < TemplateWrapper > known = new TreeSet... | Provides an ordered array of available templates using a handy wrapper class . |
36,579 | private HttpClient getTemplateServerClient ( String remoteSource ) throws IOException { int port = 80 ; String host = remoteSource . substring ( RemoteCompilationProvider . TEMPLATE_LOAD_PROTOCOL . length ( ) ) ; int portIndex = host . indexOf ( "/" ) ; if ( portIndex >= 0 ) { host = host . substring ( 0 , portIndex ) ... | returns a socket connected to a host running the TemplateServerServlet |
36,580 | private static InetAddress [ ] getAllLocalInetAddresses ( final Log log ) throws SocketException { final List addresses = new ArrayList ( ) ; final Enumeration netInterfaces = NetworkInterface . getNetworkInterfaces ( ) ; while ( netInterfaces . hasMoreElements ( ) ) { final NetworkInterface ni = ( NetworkInterface ) n... | calling getHostName returns the IP . how do we get the host? |
36,581 | public LogEvent [ ] getLogEvents ( ) { if ( mLogEvents == null ) { return new LogEvent [ 0 ] ; } else { LogEvent [ ] events = new LogEvent [ mLogEvents . size ( ) ] ; return ( LogEvent [ ] ) mLogEvents . toArray ( events ) ; } } | Returns the lines that have been written to the log file . This is used by the admin functions . |
36,582 | public Template findTemplate ( String uri , HttpServletRequest request , HttpServletResponse response ) throws ServletException , IOException { return findTemplate ( uri , request , response , getTemplateSource ( ) ) ; } | Finds a template based on the given URI . If path ends in a slash revert to loading default template . If default not found or not specified return null . |
36,583 | public HttpContext createHttpContext ( ApplicationRequest req , ApplicationResponse resp ) throws Exception { Template template = ( Template ) req . getTemplate ( ) ; return createHttpContext ( req , resp , template . getTemplateSource ( ) . getContextSource ( ) ) ; } | Lets external classes use the HttpContext for their own possibly malicious purposes . |
36,584 | private TeaServletTemplateSource createTemplateSource ( ContextSource contextSource ) { return TeaServletTemplateSource . createTemplateSource ( getServletContext ( ) , ( TeaServletContextSource ) contextSource , getProperties ( ) . subMap ( "template" ) , getLog ( ) ) ; } | Create a template source using the composite context passed to the method . |
36,585 | public synchronized Object put ( Object obj ) { if ( obj == null ) { return null ; } Entry tab [ ] = mTable ; int hash = hashCode ( obj ) ; int index = ( hash & 0x7FFFFFFF ) % tab . length ; for ( Entry e = tab [ index ] , prev = null ; e != null ; e = e . mNext ) { Object iobj = e . get ( ) ; if ( iobj == null ) { if ... | Pass in a candidate flyweight object and get a unique instance from this set . The returned object will always be of the same type as that passed in . If the object passed in does not equal any object currently in the set it will be added to the set becoming a flyweight . |
36,586 | private String printTeaStackTraceLines ( TeaStackTraceLine [ ] lines ) { String result = "" ; for ( int line = 0 ; line < lines . length ; line ++ ) { if ( line > 0 ) { result += '\n' ; } result += lines [ line ] . toString ( ) ; } return result ; } | Prints the stack trace lines to a String . |
36,587 | private TeaStackTraceLine [ ] getTeaStackTraceLines ( Throwable t ) { StringWriter stackTraceGrabber = new StringWriter ( ) ; t . printStackTrace ( new PrintWriter ( stackTraceGrabber ) ) ; String stackTrace = stackTraceGrabber . toString ( ) ; int extensionIndex = stackTrace . lastIndexOf ( TEA_EXCEPTION ) ; boolean i... | Splits the stack trace into separate lines and extracts the template name and line number . |
36,588 | public String getName ( ) { String name = super . getName ( ) ; if ( name != null ) { if ( name . equals ( getParameterDescriptor ( ) . getDisplayName ( ) ) || name . length ( ) == 0 ) { name = null ; } } return name ; } | Returns the formal param name or null if the formal name is not available . |
36,589 | static ConstantNameAndTypeInfo make ( ConstantPool cp , String name , Descriptor type ) { ConstantInfo ci = new ConstantNameAndTypeInfo ( cp , name , type ) ; return ( ConstantNameAndTypeInfo ) cp . addConstant ( ci ) ; } | Will return either a new ConstantNameAndTypeInfo object or one already in the constant pool . If it is a new ConstantNameAndTypeInfo it will be inserted into the pool . |
36,590 | public TypeDescription getReturnType ( ) { if ( mReturnType == null ) { mReturnType = getTeaToolsUtils ( ) . createTypeDescription ( getMethod ( ) . getReturnType ( ) ) ; } return mReturnType ; } | Returns the method s return type |
36,591 | public < T > void add ( List < T > list , int index , T value ) { list . add ( index , value ) ; } | Insert the given value to the given list at the given index . This will insert the value at the index shifting the elements accordingly . |
36,592 | public < T > boolean addAll ( List < T > listToAddTo , Collection < ? extends T > collectionToAdd ) { return listToAddTo . addAll ( collectionToAdd ) ; } | Add all items of the given collection to the given list . |
36,593 | public < T > T set ( List < T > list , int index , T obj ) { return list . set ( index , obj ) ; } | Set the value at the given index in the given list . If the value is properly set the previous value will be returned . |
36,594 | public < T > List < T > subList ( List < T > list , int fromIndex , int toIndex ) { return list . subList ( fromIndex , toIndex ) ; } | Get a portion of the given list as a new list . |
36,595 | public Object [ ] toArray ( List < ? > list , Class < ? > arrayType ) { int [ ] dims = findArrayDimensions ( list , arrayType ) ; Object [ ] typedArray = ( Object [ ] ) Array . newInstance ( arrayType , dims ) ; return list . toArray ( typedArray ) ; } | Convert the given list to an array of the given array type . |
36,596 | public void addPlugin ( Plugin plugin ) { if ( ! mPluginMap . containsKey ( plugin . getName ( ) ) ) { mPluginMap . put ( plugin . getName ( ) , plugin ) ; PluginEvent event = new PluginEvent ( this , plugin ) ; firePluginAddedEvent ( event ) ; } } | Adds a Plugin to the PluginContext . Plugins that want to make themselves available to other Plugins should add themselves to the PluginContext through this method . All PluginListeners will be notified of the new addition . |
36,597 | public static int findReservedWordID ( StringBuilder word ) { char c = word . charAt ( 0 ) ; switch ( c ) { case 'a' : if ( matches ( word , "and" ) ) return AND ; if ( matches ( word , "as" ) ) return AS ; break ; case 'b' : if ( matches ( word , "break" ) ) return BREAK ; break ; case 'c' : if ( matches ( word , "cal... | If the given StringBuilder starts with a valid token type its ID is returned . Otherwise the token ID UNKNOWN is returned . |
36,598 | private static boolean matches ( StringBuilder word , String val ) { int len = word . length ( ) ; if ( len != val . length ( ) ) return false ; for ( int index = 1 ; index < len ; index ++ ) { char cw = word . charAt ( index ) ; char cv = val . charAt ( index ) ; if ( cw != cv ) { return false ; } } return true ; } | Case sensitive match test . |
36,599 | public final void dump ( PrintStream out ) { out . println ( "Token [Code: " + getCode ( ) + "] [Image: " + getImage ( ) + "] [Value: " + getStringValue ( ) + "] [Id: " + getID ( ) + "] [start: " + mInfo . getStartPosition ( ) + "] [end " + mInfo . getEndPosition ( ) + "]" ) ; } | Dumps the contents of this Token . |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.