idx int64 0 41.2k | question stringlengths 74 4.21k | target stringlengths 5 888 |
|---|---|---|
23,200 | public void add ( String str ) { curr . next = new Entry ( str , Entry . NUL ) ; curr = curr . next ; count ++ ; } | adds a element to the list |
23,201 | public Expression string ( Factory f , SourceCode cfml ) throws TemplateException { cfml . removeSpace ( ) ; char quoter = cfml . getCurrentLower ( ) ; if ( quoter != '"' && quoter != '\'' ) return null ; StringBuffer str = new StringBuffer ( ) ; boolean insideSpecial = false ; Position line = cfml . getPosition ( ) ; while ( cfml . hasNext ( ) ) { cfml . next ( ) ; if ( cfml . isCurrent ( specialChar ) ) { insideSpecial = ! insideSpecial ; str . append ( specialChar ) ; } else if ( ! insideSpecial && cfml . isCurrent ( quoter ) ) { if ( cfml . isNext ( quoter ) ) { cfml . next ( ) ; str . append ( quoter ) ; } else { break ; } } else { str . append ( cfml . getCurrent ( ) ) ; } } if ( ! cfml . forwardIfCurrent ( quoter ) ) throw new TemplateException ( cfml , "Invalid Syntax Closing [" + quoter + "] not found" ) ; LitString rtn = f . createLitString ( str . toString ( ) , line , cfml . getPosition ( ) ) ; cfml . removeSpace ( ) ; return rtn ; } | Liest den String ein |
23,202 | public void release ( ) { super . release ( ) ; action = "list" ; path = null ; collection = null ; name = null ; language = "english" ; } | private boolean categories = false ; |
23,203 | public void setPath ( String strPath ) throws PageException { if ( strPath == null ) return ; this . path = ResourceUtil . toResourceNotExisting ( pageContext , strPath . trim ( ) ) ; pageContext . getConfig ( ) . getSecurityManager ( ) . checkFileLocation ( this . path ) ; if ( ! this . path . exists ( ) ) { Resource parent = this . path . getParentResource ( ) ; if ( parent != null && parent . exists ( ) ) this . path . mkdirs ( ) ; else { throw new ApplicationException ( "attribute path of the tag collection must be a existing directory" ) ; } } else if ( ! this . path . isDirectory ( ) ) throw new ApplicationException ( "attribute path of the tag collection must be a existing directory" ) ; } | set the value path |
23,204 | private void doList ( ) throws PageException , SearchException { required ( "collection" , action , "name" , name ) ; pageContext . setVariable ( name , getSearchEngine ( ) . getCollectionsAsQuery ( ) ) ; } | Creates a query in the PageContext containing all available Collections of the current searchStorage |
23,205 | private void doCreate ( ) throws SearchException , PageException { required ( "collection" , action , "collection" , collection ) ; required ( "collection" , action , "path" , path ) ; getSearchEngine ( ) . createCollection ( collection , path , language , SearchEngine . DENY_OVERWRITE ) ; } | Creates a new collection |
23,206 | public static boolean isBytecode ( InputStream is ) throws IOException { if ( ! is . markSupported ( ) ) throw new IOException ( "can only read input streams that support mark/reset" ) ; is . mark ( - 1 ) ; int first = is . read ( ) ; int second = is . read ( ) ; boolean rtn = ( first == ICA && second == IFE && is . read ( ) == IBA && is . read ( ) == IBE ) ; is . reset ( ) ; return rtn ; } | check if given stream is a bytecode stream if yes remove bytecode mark |
23,207 | public static String [ ] getFieldNames ( Class clazz ) { Field [ ] fields = clazz . getFields ( ) ; String [ ] names = new String [ fields . length ] ; for ( int i = 0 ; i < names . length ; i ++ ) { names [ i ] = fields [ i ] . getName ( ) ; } return names ; } | return all field names as String array |
23,208 | public static String getSourcePathForClass ( Class clazz , String defaultValue ) { try { String result = clazz . getProtectionDomain ( ) . getCodeSource ( ) . getLocation ( ) . getPath ( ) ; result = URLDecoder . decode ( result , CharsetUtil . UTF8 . name ( ) ) ; result = SystemUtil . fixWindowsPath ( result ) ; return result ; } catch ( Throwable t ) { ExceptionUtil . rethrowIfNecessary ( t ) ; } return defaultValue ; } | returns the path to the directory or jar file that the class was loaded from |
23,209 | public static String getSourcePathForClass ( String className , String defaultValue ) { try { return getSourcePathForClass ( ClassUtil . loadClass ( className ) , defaultValue ) ; } catch ( Throwable t ) { ExceptionUtil . rethrowIfNecessary ( t ) ; } return defaultValue ; } | tries to load the class and returns the path that it was loaded from |
23,210 | public static String extractPackage ( String className ) { if ( className == null ) return null ; int index = className . lastIndexOf ( '.' ) ; if ( index != - 1 ) return className . substring ( 0 , index ) ; return null ; } | extracts the package from a className return null if there is none . |
23,211 | public static String extractName ( String className ) { if ( className == null ) return null ; int index = className . lastIndexOf ( '.' ) ; if ( index != - 1 ) return className . substring ( index + 1 ) ; return className ; } | extracts the class name of a classname with package |
23,212 | public static Class loadClass ( String className , String bundleName , String bundleVersion , Identification id ) throws ClassException , BundleException { if ( StringUtil . isEmpty ( bundleName ) ) return loadClass ( className ) ; return loadClassByBundle ( className , bundleName , bundleVersion , id ) ; } | if no bundle is defined it is loaded the old way |
23,213 | public Collection getScopeFor ( Collection . Key key , Scope defaultValue ) { Object rtn = null ; if ( checkArguments ) { rtn = local . get ( key , NullSupportHelper . NULL ( ) ) ; if ( rtn != NullSupportHelper . NULL ( ) ) return local ; rtn = argument . getFunctionArgument ( key , NullSupportHelper . NULL ( ) ) ; if ( rtn != NullSupportHelper . NULL ( ) ) return argument ; } if ( allowImplicidQueryCall && pc . getCurrentTemplateDialect ( ) == CFMLEngine . DIALECT_CFML && ! qryStack . isEmpty ( ) ) { QueryColumn qc = qryStack . getColumnFromACollection ( key ) ; if ( qc != null ) return ( Query ) qc . getParent ( ) ; } rtn = variable . get ( key , NullSupportHelper . NULL ( ) ) ; if ( rtn != NullSupportHelper . NULL ( ) ) { return variable ; } if ( pc . hasFamily ( ) ) { Threads t = ( Threads ) pc . getThreadScope ( key , NullSupportHelper . NULL ( ) ) ; if ( rtn != NullSupportHelper . NULL ( ) ) return t ; } if ( pc . getCurrentTemplateDialect ( ) == CFMLEngine . DIALECT_CFML ) { for ( int i = 0 ; i < scopes . length ; i ++ ) { rtn = scopes [ i ] . get ( key , NullSupportHelper . NULL ( ) ) ; if ( rtn != NullSupportHelper . NULL ( ) ) { return scopes [ i ] ; } } } return defaultValue ; } | returns the scope that contains a specific key |
23,214 | public List < String > getScopeNames ( ) { List < String > scopeNames = new ArrayList < String > ( ) ; if ( checkArguments ) { scopeNames . add ( "local" ) ; scopeNames . add ( "arguments" ) ; } scopeNames . add ( "variables" ) ; if ( pc . hasFamily ( ) ) { String [ ] names = pc . getThreadScopeNames ( ) ; for ( int i = 0 ; i < names . length ; i ++ ) scopeNames . add ( i , names [ i ] ) ; } for ( int i = 0 ; i < scopes . length ; i ++ ) { scopeNames . add ( ( scopes [ i ] ) . getTypeAsString ( ) ) ; } return scopeNames ; } | return a list of String with the scope names |
23,215 | private boolean isReadOnlyKey ( Collection . Key key ) { return ( key . equals ( KeyConstants . _java ) || key . equals ( KeyConstants . _separator ) || key . equals ( KeyConstants . _os ) || key . equals ( KeyConstants . _coldfusion ) || key . equals ( KeyConstants . _lucee ) ) ; } | returns if the key is a readonly key |
23,216 | private FDThreadImpl getByNativeIdentifier ( String name , CFMLFactoryImpl factory , String id ) { Map < Integer , PageContextImpl > pcs = factory . getActivePageContexts ( ) ; Iterator < PageContextImpl > it = pcs . values ( ) . iterator ( ) ; PageContextImpl pc ; while ( it . hasNext ( ) ) { pc = it . next ( ) ; if ( equals ( pc , id ) ) return new FDThreadImpl ( this , factory , name , pc ) ; } return null ; } | checks a single CFMLFactory for the thread |
23,217 | public static MimeType getInstance ( String strMimeType ) { if ( strMimeType == null ) return ALL ; strMimeType = strMimeType . trim ( ) ; if ( "*" . equals ( strMimeType ) || strMimeType . length ( ) == 0 ) return ALL ; String [ ] arr = ListUtil . listToStringArray ( strMimeType , ';' ) ; if ( arr . length == 0 ) return ALL ; String [ ] arrCT = ListUtil . listToStringArray ( arr [ 0 ] . trim ( ) , '/' ) ; String type = null , subtype = null ; if ( arrCT . length >= 1 ) { type = arrCT [ 0 ] . trim ( ) ; if ( "*" . equals ( type ) ) type = null ; if ( arrCT . length >= 2 ) { subtype = arrCT [ 1 ] . trim ( ) ; if ( "*" . equals ( subtype ) ) subtype = null ; } } if ( arr . length == 1 ) return getInstance ( type , subtype , null ) ; final Map < String , String > properties = new HashMap < String , String > ( ) ; String entry ; String [ ] _arr ; for ( int i = 1 ; i < arr . length ; i ++ ) { entry = arr [ i ] . trim ( ) ; _arr = ListUtil . listToStringArray ( entry , '=' ) ; if ( _arr . length >= 2 ) properties . put ( _arr [ 0 ] . trim ( ) . toLowerCase ( ) , _arr [ 1 ] . trim ( ) ) ; else if ( _arr . length == 1 && ! _arr [ 0 ] . trim ( ) . toLowerCase ( ) . equals ( "*" ) ) properties . put ( _arr [ 0 ] . trim ( ) . toLowerCase ( ) , "" ) ; } return getInstance ( type , subtype , properties ) ; } | returns a mimetype that match given string |
23,218 | public boolean match ( MimeType other ) { if ( this == other ) return true ; if ( type != null && other . type != null && ! type . equals ( other . type ) ) return false ; if ( subtype != null && other . subtype != null && ! subtype . equals ( other . subtype ) ) return false ; return true ; } | checks if given mimetype is covered by current mimetype |
23,219 | public Set < String > getInvokedTables ( ) throws ParseException { ZStatement st ; Set < String > tables = new HashSet < String > ( ) ; while ( ( st = parser . readStatement ( ) ) != null ) { this . sql = st . toString ( ) ; if ( st instanceof ZQuery ) { getInvokedTables ( ( ZQuery ) st , tables ) ; } break ; } return tables ; } | return all invoked tables by a sql statement |
23,220 | public static Resource toExactResource ( Resource res ) { res = getCanonicalResourceEL ( res ) ; if ( res . getResourceProvider ( ) . isCaseSensitive ( ) ) { if ( res . exists ( ) ) return res ; return _check ( res ) ; } return res ; } | translate the path of the file to a existing file path by changing case of letters Works only on Linux because |
23,221 | public static Resource createResource ( Resource res , short level , short type ) { boolean asDir = type == TYPE_DIR ; if ( level >= LEVEL_FILE && res . exists ( ) && ( ( res . isDirectory ( ) && asDir ) || ( res . isFile ( ) && ! asDir ) ) ) { return getCanonicalResourceEL ( res ) ; } Resource parent = res . getParentResource ( ) ; if ( level >= LEVEL_PARENT_FILE && parent != null && parent . exists ( ) && canRW ( parent ) ) { if ( asDir ) { if ( res . mkdirs ( ) ) return getCanonicalResourceEL ( res ) ; } else { if ( createNewResourceEL ( res ) ) return getCanonicalResourceEL ( res ) ; } return getCanonicalResourceEL ( res ) ; } if ( level >= LEVEL_GRAND_PARENT_FILE && parent != null ) { Resource gparent = parent . getParentResource ( ) ; if ( gparent != null && gparent . exists ( ) && canRW ( gparent ) ) { if ( asDir ) { if ( res . mkdirs ( ) ) return getCanonicalResourceEL ( res ) ; } else { if ( parent . mkdirs ( ) && createNewResourceEL ( res ) ) return getCanonicalResourceEL ( res ) ; } } } return null ; } | create a file if possible return file if ok otherwise return null |
23,222 | public static String translateAttribute ( String attributes ) throws IOException { short [ ] flags = strAttrToBooleanFlags ( attributes ) ; StringBuilder sb = new StringBuilder ( ) ; if ( flags [ READ_ONLY ] == YES ) sb . append ( " +R" ) ; else if ( flags [ READ_ONLY ] == NO ) sb . append ( " -R" ) ; if ( flags [ HIDDEN ] == YES ) sb . append ( " +H" ) ; else if ( flags [ HIDDEN ] == NO ) sb . append ( " -H" ) ; if ( flags [ SYSTEM ] == YES ) sb . append ( " +S" ) ; else if ( flags [ SYSTEM ] == NO ) sb . append ( " -S" ) ; if ( flags [ ARCHIVE ] == YES ) sb . append ( " +A" ) ; else if ( flags [ ARCHIVE ] == NO ) sb . append ( " -A" ) ; return sb . toString ( ) ; } | sets attributes of a file on Windows system |
23,223 | public static String merge ( String parent , String child ) { if ( child . length ( ) <= 2 ) { if ( child . length ( ) == 0 ) return parent ; if ( child . equals ( "." ) ) return parent ; if ( child . equals ( ".." ) ) child = "../" ; } parent = translatePath ( parent , true , false ) ; child = prettifyPath ( child ) ; if ( child . startsWith ( "./" ) ) child = child . substring ( 2 ) ; if ( StringUtil . startsWith ( child , '/' ) ) return parent . concat ( child ) ; if ( ! StringUtil . startsWith ( child , '.' ) ) return parent . concat ( "/" ) . concat ( child ) ; while ( child . startsWith ( "../" ) ) { parent = pathRemoveLast ( parent ) ; child = child . substring ( 3 ) ; } if ( StringUtil . startsWith ( child , '/' ) ) return parent . concat ( child ) ; return parent . concat ( "/" ) . concat ( child ) ; } | merge to path parts to one |
23,224 | public static String getCanonicalPathEL ( Resource res ) { try { return res . getCanonicalPath ( ) ; } catch ( IOException e ) { return res . toString ( ) ; } } | Returns the canonical form of this abstract pathname . |
23,225 | public static boolean createNewResourceEL ( Resource res ) { try { res . createFile ( false ) ; return true ; } catch ( IOException e ) { return false ; } } | creates a new File |
23,226 | public static void touch ( Resource res ) throws IOException { if ( res . exists ( ) ) { res . setLastModified ( System . currentTimeMillis ( ) ) ; } else { res . createFile ( true ) ; } } | similar to linux bash function touch create file if not exist otherwise change last modified date |
23,227 | public static boolean isChildOf ( Resource file , Resource dir ) { while ( file != null ) { if ( file . equals ( dir ) ) return true ; file = file . getParentResource ( ) ; } return false ; } | check if file is a child of given directory |
23,228 | public static String getPathToChild ( Resource file , Resource dir ) { if ( dir == null || ! file . getResourceProvider ( ) . getScheme ( ) . equals ( dir . getResourceProvider ( ) . getScheme ( ) ) ) return null ; boolean isFile = file . isFile ( ) ; String str = "/" ; while ( file != null ) { if ( file . equals ( dir ) ) { if ( isFile ) return str . substring ( 0 , str . length ( ) - 1 ) ; return str ; } str = "/" + file . getName ( ) + str ; file = file . getParentResource ( ) ; } return null ; } | return diffrents of one file to a other if first is child of second otherwise return null |
23,229 | public static String [ ] splitFileName ( String fileName ) { int pos = fileName . lastIndexOf ( '.' ) ; if ( pos == - 1 ) { return new String [ ] { fileName } ; } return new String [ ] { fileName . substring ( 0 , pos ) , fileName . substring ( pos + 1 ) } ; } | split a FileName in Parts |
23,230 | public static Resource changeExtension ( Resource file , String newExtension ) { String ext = getExtension ( file , null ) ; if ( ext == null ) return file . getParentResource ( ) . getRealResource ( file . getName ( ) + '.' + newExtension ) ; String name = file . getName ( ) ; return file . getParentResource ( ) . getRealResource ( name . substring ( 0 , name . length ( ) - ext . length ( ) ) + newExtension ) ; } | change extension of file and return new file |
23,231 | private static boolean parentExists ( Resource res ) { res = res . getParentResource ( ) ; return res != null && res . exists ( ) ; } | return if parent file exists |
23,232 | public static long getRealSize ( Resource res , ResourceFilter filter ) { if ( res . isFile ( ) ) { return res . length ( ) ; } else if ( res . isDirectory ( ) ) { long size = 0 ; Resource [ ] children = filter == null ? res . listResources ( ) : res . listResources ( filter ) ; for ( int i = 0 ; i < children . length ; i ++ ) { size += getRealSize ( children [ i ] ) ; } return size ; } return 0 ; } | return the size of the Resource other than method length of Resource this method return the size of all files in a directory |
23,233 | public static boolean isEmptyDirectory ( Resource res , ResourceFilter filter ) { if ( res . isDirectory ( ) ) { Resource [ ] children = filter == null ? res . listResources ( ) : res . listResources ( filter ) ; if ( children == null || children . length == 0 ) return true ; for ( int i = 0 ; i < children . length ; i ++ ) { if ( children [ i ] . isFile ( ) ) return false ; if ( children [ i ] . isDirectory ( ) && ! isEmptyDirectory ( children [ i ] , filter ) ) return false ; } } return true ; } | return Boolean . True when directory is empty Boolean . FALSE when directory s not empty and null if directory does not exists |
23,234 | public static Resource [ ] listResources ( Resource [ ] resources , ResourceFilter filter ) { int count = 0 ; Resource [ ] children ; ArrayList < Resource [ ] > list = new ArrayList < Resource [ ] > ( ) ; for ( int i = 0 ; i < resources . length ; i ++ ) { children = filter == null ? resources [ i ] . listResources ( ) : resources [ i ] . listResources ( filter ) ; if ( children != null ) { count += children . length ; list . add ( children ) ; } else list . add ( new Resource [ 0 ] ) ; } Resource [ ] rtn = new Resource [ count ] ; int index = 0 ; for ( int i = 0 ; i < resources . length ; i ++ ) { children = list . get ( i ) ; for ( int y = 0 ; y < children . length ; y ++ ) { rtn [ index ++ ] = children [ y ] ; } } return rtn ; } | list children of all given resources |
23,235 | public static void checkCreateDirectoryOK ( Resource resource , boolean createParentWhenNotExists ) throws IOException { if ( resource . exists ( ) ) { if ( resource . isFile ( ) ) throw new IOException ( "can't create directory [" + resource . getPath ( ) + "], resource already exists as a file" ) ; if ( resource . isDirectory ( ) ) throw new IOException ( "can't create directory [" + resource . getPath ( ) + "], directory already exists" ) ; } Resource parent = resource . getParentResource ( ) ; if ( parent != null ) { if ( ! parent . exists ( ) ) { if ( createParentWhenNotExists ) parent . createDirectory ( true ) ; else throw new IOException ( "can't create file [" + resource . getPath ( ) + "], missing parent directory" ) ; } else if ( parent . isFile ( ) ) { throw new IOException ( "can't create directory [" + resource . getPath ( ) + "], parent is a file" ) ; } } } | check if directory creation is ok with the rules for the Resource interface to not change this rules . |
23,236 | public static void checkCopyToOK ( Resource source , Resource target ) throws IOException { if ( ! source . isFile ( ) ) { if ( source . isDirectory ( ) ) throw new IOException ( "can't copy [" + source . getPath ( ) + "] to [" + target . getPath ( ) + "], source is a directory" ) ; throw new IOException ( "can't copy [" + source . getPath ( ) + "] to [" + target . getPath ( ) + "], source file does not exist" ) ; } else if ( target . isDirectory ( ) ) { throw new IOException ( "can't copy [" + source . getPath ( ) + "] to [" + target . getPath ( ) + "], target is a directory" ) ; } } | check if copying a file is ok with the rules for the Resource interface to not change this rules . |
23,237 | public static void checkMoveToOK ( Resource source , Resource target ) throws IOException { if ( ! source . exists ( ) ) { throw new IOException ( "can't move [" + source . getPath ( ) + "] to [" + target . getPath ( ) + "], source file does not exist" ) ; } if ( source . isDirectory ( ) && target . isFile ( ) ) throw new IOException ( "can't move [" + source . getPath ( ) + "] directory to [" + target . getPath ( ) + "], target is a file" ) ; if ( source . isFile ( ) && target . isDirectory ( ) ) throw new IOException ( "can't move [" + source . getPath ( ) + "] file to [" + target . getPath ( ) + "], target is a directory" ) ; } | check if moveing a file is ok with the rules for the Resource interface to not change this rules . |
23,238 | public static void checkGetInputStreamOK ( Resource resource ) throws IOException { if ( ! resource . exists ( ) ) throw new IOException ( "file [" + resource . getPath ( ) + "] does not exist" ) ; if ( resource . isDirectory ( ) ) throw new IOException ( "can't read directory [" + resource . getPath ( ) + "] as a file" ) ; } | check if getting a inputstream of the file is ok with the rules for the Resource interface to not change this rules . |
23,239 | public static void checkGetOutputStreamOK ( Resource resource ) throws IOException { if ( resource . exists ( ) && ! resource . isWriteable ( ) ) { throw new IOException ( "can't write to file [" + resource . getPath ( ) + "],file is readonly" ) ; } if ( resource . isDirectory ( ) ) throw new IOException ( "can't write directory [" + resource . getPath ( ) + "] as a file" ) ; if ( ! resource . getParentResource ( ) . exists ( ) ) throw new IOException ( "can't write file [" + resource . getPath ( ) + "] as a file, missing parent directory [" + resource . getParent ( ) + "]" ) ; } | check if getting a outputstream of the file is ok with the rules for the Resource interface to not change this rules . |
23,240 | public static void checkRemoveOK ( Resource resource ) throws IOException { if ( ! resource . exists ( ) ) throw new IOException ( "can't delete resource " + resource + ", resource does not exist" ) ; if ( ! resource . canWrite ( ) ) throw new IOException ( "can't delete resource " + resource + ", no access" ) ; } | check if removing the file is ok with the rules for the Resource interface to not change this rules . |
23,241 | public void setTimeout ( Object timeout ) throws PageException { if ( timeout instanceof TimeSpan ) this . timeout = ( TimeSpan ) timeout ; else { int i = Caster . toIntValue ( timeout ) ; if ( i < 0 ) throw new ApplicationException ( "invalid value [" + i + "] for attribute timeout, value must be a positive integer greater or equal than 0" ) ; this . timeout = new TimeSpanImpl ( 0 , 0 , 0 , i ) ; } } | set the value timeout |
23,242 | public void setColumns ( String columns ) throws PageException { this . columns = ListUtil . toStringArray ( ListUtil . listToArrayRemoveEmpty ( columns , "," ) ) ; } | set the value columns |
23,243 | public void setMethod ( String method ) throws ApplicationException { method = method . toLowerCase ( ) . trim ( ) ; if ( method . equals ( "post" ) ) this . method = METHOD_POST ; else if ( method . equals ( "get" ) ) this . method = METHOD_GET ; else if ( method . equals ( "head" ) ) this . method = METHOD_HEAD ; else if ( method . equals ( "delete" ) ) this . method = METHOD_DELETE ; else if ( method . equals ( "put" ) ) this . method = METHOD_PUT ; else if ( method . equals ( "trace" ) ) this . method = METHOD_TRACE ; else if ( method . equals ( "options" ) ) this . method = METHOD_OPTIONS ; else if ( method . equals ( "patch" ) ) this . method = METHOD_PATCH ; else throw new ApplicationException ( "invalid method type [" + ( method . toUpperCase ( ) ) + "], valid types are POST,GET,HEAD,DELETE,PUT,TRACE,OPTIONS,PATCH" ) ; } | set the value method GET or POST . Use GET to download a text or binary file or to create a query from the contents of a text file . Use POST to send information to a server page or a CGI program for processing . POST requires the use of a cfhttpparam tag . |
23,244 | static boolean isRedirect ( int status ) { return status == STATUS_REDIRECT_FOUND || status == STATUS_REDIRECT_MOVED_PERMANENTLY || status == STATUS_REDIRECT_SEE_OTHER || status == STATUS_REDIRECT_TEMPORARY_REDIRECT ; } | checks if status code is a redirect |
23,245 | public static String mergePath ( String current , String realPath ) throws MalformedURLException { String currDir ; if ( current == null || current . indexOf ( '/' ) == - 1 ) currDir = "/" ; else if ( current . endsWith ( "/" ) ) currDir = current ; else currDir = current . substring ( 0 , current . lastIndexOf ( '/' ) + 1 ) ; String path ; if ( realPath . startsWith ( "./" ) ) path = currDir + realPath . substring ( 2 ) ; else if ( realPath . startsWith ( "/" ) ) path = realPath ; else if ( ! realPath . startsWith ( "../" ) ) path = currDir + realPath ; else { while ( realPath . startsWith ( "../" ) || currDir . length ( ) == 0 ) { realPath = realPath . substring ( 3 ) ; currDir = currDir . substring ( 0 , currDir . length ( ) - 1 ) ; int index = currDir . lastIndexOf ( '/' ) ; if ( index == - 1 ) throw new MalformedURLException ( "invalid realpath definition for URL" ) ; currDir = currDir . substring ( 0 , index + 1 ) ; } path = currDir + realPath ; } return path ; } | merge to pathes to one |
23,246 | public void setAdditional ( Collection . Key key , Object value ) { additional . setEL ( key , StringUtil . toStringEmptyIfNull ( value ) ) ; } | set a additional key value |
23,247 | public static long byteArrayToLong ( byte [ ] buffer , int nStartIndex ) { return ( ( ( long ) buffer [ nStartIndex ] ) << 56 ) | ( ( buffer [ nStartIndex + 1 ] & 0x0ffL ) << 48 ) | ( ( buffer [ nStartIndex + 2 ] & 0x0ffL ) << 40 ) | ( ( buffer [ nStartIndex + 3 ] & 0x0ffL ) << 32 ) | ( ( buffer [ nStartIndex + 4 ] & 0x0ffL ) << 24 ) | ( ( buffer [ nStartIndex + 5 ] & 0x0ffL ) << 16 ) | ( ( buffer [ nStartIndex + 6 ] & 0x0ffL ) << 8 ) | ( ( long ) buffer [ nStartIndex + 7 ] & 0x0ff ) ; } | gets bytes from an array into a long |
23,248 | public static void longToByteArray ( long lValue , byte [ ] buffer , int nStartIndex ) { buffer [ nStartIndex ] = ( byte ) ( lValue >>> 56 ) ; buffer [ nStartIndex + 1 ] = ( byte ) ( ( lValue >>> 48 ) & 0x0ff ) ; buffer [ nStartIndex + 2 ] = ( byte ) ( ( lValue >>> 40 ) & 0x0ff ) ; buffer [ nStartIndex + 3 ] = ( byte ) ( ( lValue >>> 32 ) & 0x0ff ) ; buffer [ nStartIndex + 4 ] = ( byte ) ( ( lValue >>> 24 ) & 0x0ff ) ; buffer [ nStartIndex + 5 ] = ( byte ) ( ( lValue >>> 16 ) & 0x0ff ) ; buffer [ nStartIndex + 6 ] = ( byte ) ( ( lValue >>> 8 ) & 0x0ff ) ; buffer [ nStartIndex + 7 ] = ( byte ) lValue ; } | converts a long o bytes which are put into a given array |
23,249 | public static void longToIntArray ( long lValue , int [ ] buffer , int nStartIndex ) { buffer [ nStartIndex ] = ( int ) ( lValue >>> 32 ) ; buffer [ nStartIndex + 1 ] = ( int ) lValue ; } | converts a long to integers which are put into a given array |
23,250 | public static String byteArrayToUNCString ( byte [ ] data , int nStartPos , int nNumOfBytes ) { nNumOfBytes &= ~ 1 ; int nAvailCapacity = data . length - nStartPos ; if ( nAvailCapacity < nNumOfBytes ) nNumOfBytes = nAvailCapacity ; StringBuilder sbuf = new StringBuilder ( ) ; sbuf . setLength ( nNumOfBytes >> 1 ) ; int nSBufPos = 0 ; while ( nNumOfBytes > 0 ) { sbuf . setCharAt ( nSBufPos ++ , ( char ) ( ( data [ nStartPos ] << 8 ) | ( data [ nStartPos + 1 ] & 0x0ff ) ) ) ; nStartPos += 2 ; nNumOfBytes -= 2 ; } return sbuf . toString ( ) ; } | converts a byte array into an UNICODE string |
23,251 | public FunctionLib duplicate ( boolean deepCopy ) { FunctionLib fl = new FunctionLib ( ) ; fl . description = this . description ; fl . displayName = this . displayName ; fl . functions = duplicate ( this . functions , deepCopy ) ; fl . shortName = this . shortName ; fl . uri = this . uri ; fl . version = this . version ; return fl ; } | duplicate this FunctionLib |
23,252 | private HashMap duplicate ( HashMap funcs , boolean deepCopy ) { if ( deepCopy ) throw new PageRuntimeException ( new ExpressionException ( "deep copy not supported" ) ) ; Iterator it = funcs . entrySet ( ) . iterator ( ) ; Map . Entry entry ; HashMap cm = new HashMap ( ) ; while ( it . hasNext ( ) ) { entry = ( Entry ) it . next ( ) ; cm . put ( entry . getKey ( ) , deepCopy ? entry . getValue ( ) : entry . getValue ( ) ) ; } return cm ; } | duplcate a hashmap with FunctionLibFunction s |
23,253 | public static Version toVersion ( String version , final Version defaultValue ) { final int rIndex = version . lastIndexOf ( ".lco" ) ; if ( rIndex != - 1 ) version = version . substring ( 0 , rIndex ) ; try { return Version . parseVersion ( version ) ; } catch ( final IllegalArgumentException iae ) { return defaultValue ; } } | cast a lucee string version to a int version |
23,254 | public static File getTempDirectory ( ) { if ( tempFile != null ) return tempFile ; final String tmpStr = System . getProperty ( "java.io.tmpdir" ) ; if ( tmpStr != null ) { tempFile = new File ( tmpStr ) ; if ( tempFile . exists ( ) ) { tempFile = getCanonicalFileEL ( tempFile ) ; return tempFile ; } } try { final File tmp = File . createTempFile ( "a" , "a" ) ; tempFile = tmp . getParentFile ( ) ; tempFile = getCanonicalFileEL ( tempFile ) ; tmp . delete ( ) ; } catch ( final IOException ioe ) { } return tempFile ; } | returns the Temp Directory of the System |
23,255 | public static URL toURL ( String strUrl , int port , boolean encodeIfNecessary ) throws MalformedURLException { URL url ; try { url = new URL ( strUrl ) ; } catch ( MalformedURLException mue ) { url = new URL ( "http://" + strUrl ) ; } if ( ! encodeIfNecessary ) return url ; return encodeURL ( url , port ) ; } | cast a string to a url |
23,256 | public static String encode ( String realpath ) { int qIndex = realpath . indexOf ( '?' ) ; if ( qIndex == - 1 ) return realpath ; String file = realpath . substring ( 0 , qIndex ) ; String query = realpath . substring ( qIndex + 1 ) ; int sIndex = query . indexOf ( '#' ) ; String anker = null ; if ( sIndex != - 1 ) { anker = query . substring ( sIndex + 1 ) ; query = query . substring ( 0 , sIndex ) ; } StringBuilder res = new StringBuilder ( file ) ; if ( ! StringUtil . isEmpty ( query ) ) { StringList list = ListUtil . toList ( query , '&' ) ; String str ; int index ; char del = '?' ; while ( list . hasNext ( ) ) { res . append ( del ) ; del = '&' ; str = list . next ( ) ; index = str . indexOf ( '=' ) ; if ( index == - 1 ) res . append ( escapeQSValue ( str ) ) ; else { res . append ( escapeQSValue ( str . substring ( 0 , index ) ) ) ; res . append ( '=' ) ; res . append ( escapeQSValue ( str . substring ( index + 1 ) ) ) ; } } } if ( anker != null ) { res . append ( '#' ) ; res . append ( escapeQSValue ( anker ) ) ; } return res . toString ( ) ; } | merge them somehow |
23,257 | public static long length ( URL url ) throws IOException { HTTPResponse http = HTTPEngine . head ( url , null , null , - 1 , true , null , Constants . NAME , null , null ) ; long len = http . getContentLength ( ) ; HTTPEngine . closeEL ( http ) ; return len ; } | return the length of a file defined by a url . |
23,258 | public static String self ( HttpServletRequest req ) { StringBuffer sb = new StringBuffer ( req . getServletPath ( ) ) ; String qs = req . getQueryString ( ) ; if ( ! StringUtil . isEmpty ( qs ) ) sb . append ( '?' ) . append ( qs ) ; return sb . toString ( ) ; } | return path to itself |
23,259 | public static Object getRequestBody ( PageContext pc , boolean deserialized , Object defaultValue ) { HttpServletRequest req = pc . getHttpServletRequest ( ) ; MimeType contentType = getContentType ( pc ) ; String strContentType = contentType == MimeType . ALL ? null : contentType . toString ( ) ; Charset cs = getCharacterEncoding ( pc , req ) ; boolean isBinary = ! ( strContentType == null || HTTPUtil . isTextMimeType ( contentType ) || strContentType . toLowerCase ( ) . startsWith ( "application/x-www-form-urlencoded" ) ) ; if ( req . getContentLength ( ) > - 1 ) { ServletInputStream is = null ; try { byte [ ] data = IOUtil . toBytes ( is = req . getInputStream ( ) ) ; Object obj = NULL ; if ( deserialized ) { int format = MimeType . toFormat ( contentType , - 1 ) ; obj = toObject ( pc , data , format , cs , obj ) ; } if ( obj == NULL ) { if ( isBinary ) obj = data ; else obj = toString ( data , cs ) ; } return obj ; } catch ( Exception e ) { pc . getConfig ( ) . getLog ( "application" ) . error ( "request" , e ) ; return defaultValue ; } finally { IOUtil . closeEL ( is ) ; } } return defaultValue ; } | returns the body of the request |
23,260 | public static String getRequestURL ( HttpServletRequest req , boolean includeQueryString ) { StringBuffer sb = req . getRequestURL ( ) ; int maxpos = sb . indexOf ( "/" , 8 ) ; if ( maxpos > - 1 ) { if ( req . isSecure ( ) ) { if ( sb . substring ( maxpos - 4 , maxpos ) . equals ( ":443" ) ) sb . delete ( maxpos - 4 , maxpos ) ; } else { if ( sb . substring ( maxpos - 3 , maxpos ) . equals ( ":80" ) ) sb . delete ( maxpos - 3 , maxpos ) ; } if ( includeQueryString && ! StringUtil . isEmpty ( req . getQueryString ( ) ) ) sb . append ( '?' ) . append ( req . getQueryString ( ) ) ; } return sb . toString ( ) ; } | returns the full request URL |
23,261 | public static String encodeRedirectURLEL ( HttpServletResponse rsp , String url ) { try { return rsp . encodeRedirectURL ( url ) ; } catch ( Throwable t ) { ExceptionUtil . rethrowIfNecessary ( t ) ; return url ; } } | if encodings fails the given url is returned |
23,262 | public void setStartdate ( Object objStartDate ) throws PageException { if ( StringUtil . isEmpty ( objStartDate ) ) return ; this . startdate = new DateImpl ( DateCaster . toDateAdvanced ( objStartDate , pageContext . getTimeZone ( ) ) ) ; } | set the value startdate Required when action = update . The date when scheduling of the task should start . |
23,263 | public void setEnddate ( Object enddate ) throws PageException { if ( StringUtil . isEmpty ( enddate ) ) return ; this . enddate = new DateImpl ( DateCaster . toDateAdvanced ( enddate , pageContext . getTimeZone ( ) ) ) ; } | set the value enddate The date when the scheduled task ends . |
23,264 | public void setStarttime ( Object starttime ) throws PageException { if ( StringUtil . isEmpty ( starttime ) ) return ; this . starttime = DateCaster . toTime ( pageContext . getTimeZone ( ) , starttime ) ; } | set the value starttime Required when creating tasks with action = update . Enter a value in seconds . The time when scheduling of the task starts . |
23,265 | public void setProxyport ( Object oProxyport ) throws PageException { if ( StringUtil . isEmpty ( oProxyport ) ) return ; this . proxyport = Caster . toIntValue ( oProxyport ) ; } | set the value proxyport The port number on the proxy server from which the task is being requested . Default is 80 . When used with resolveURL the URLs of retrieved documents that specify a port number are automatically resolved to preserve links in the retrieved document . |
23,266 | public void setPort ( Object oPort ) throws PageException { if ( StringUtil . isEmpty ( oPort ) ) return ; this . port = Caster . toIntValue ( oPort ) ; } | set the value port The port number on the server from which the task is being scheduled . Default is 80 . When used with resolveURL the URLs of retrieved documents that specify a port number are automatically resolved to preserve links in the retrieved document . |
23,267 | public void setEndtime ( Object endtime ) throws PageException { if ( StringUtil . isEmpty ( endtime ) ) return ; this . endtime = DateCaster . toTime ( pageContext . getTimeZone ( ) , endtime ) ; } | set the value endtime The time when the scheduled task ends . Enter a value in seconds . |
23,268 | public void setOperation ( String operation ) throws ApplicationException { if ( StringUtil . isEmpty ( operation ) ) return ; operation = operation . toLowerCase ( ) . trim ( ) ; if ( ! operation . equals ( "httprequest" ) ) throw new ApplicationException ( "attribute operation must have the value [HTTPRequest]" ) ; } | set the value operation The type of operation the scheduler performs when executing this task . |
23,269 | public void setInterval ( String interval ) { if ( StringUtil . isEmpty ( interval ) ) return ; interval = interval . trim ( ) . toLowerCase ( ) ; if ( interval . equals ( "week" ) ) this . interval = "weekly" ; else if ( interval . equals ( "day" ) ) this . interval = "daily" ; else if ( interval . equals ( "month" ) ) this . interval = "monthly" ; else if ( interval . equals ( "year" ) ) this . interval = "yearly" ; this . interval = interval ; } | set the value interval Required when creating tasks with action = update . Interval at which task should be scheduled . Can be set in seconds or as Once Daily Weekly and Monthly . The default interval is one hour . The minimum interval is one minute . |
23,270 | public void setRequesttimeout ( Object oRequesttimeout ) throws PageException { if ( StringUtil . isEmpty ( oRequesttimeout ) ) return ; this . requesttimeout = Caster . toLongValue ( oRequesttimeout ) * 1000L ; } | set the value requesttimeout Customizes the requestTimeOut for the task operation . Can be used to extend the default timeout for operations that require more time to execute . |
23,271 | private Ref negateMinusOp ( ) throws PageException { if ( cfml . forwardIfCurrent ( '-' ) ) { if ( cfml . forwardIfCurrent ( '-' ) ) { cfml . removeSpace ( ) ; Ref expr = clip ( ) ; Ref res = preciseMath ? new BigMinus ( expr , new LNumber ( new Double ( 1 ) ) , limited ) : new Minus ( expr , new LNumber ( new Double ( 1 ) ) , limited ) ; return new Assign ( expr , res , limited ) ; } cfml . removeSpace ( ) ; return new Negate ( clip ( ) , limited ) ; } if ( cfml . forwardIfCurrent ( '+' ) ) { if ( cfml . forwardIfCurrent ( '+' ) ) { cfml . removeSpace ( ) ; Ref expr = clip ( ) ; Ref res = preciseMath ? new BigPlus ( expr , new LNumber ( new Double ( 1 ) ) , limited ) : new Plus ( expr , new LNumber ( new Double ( 1 ) ) , limited ) ; return new Assign ( expr , res , limited ) ; } cfml . removeSpace ( ) ; return new Casting ( "numeric" , CFTypes . TYPE_NUMERIC , clip ( ) ) ; } return clip ( ) ; } | Liest die Vordlobe einer Zahl ein |
23,272 | public static String encode ( byte [ ] data ) { StringBuilder builder = new StringBuilder ( ) ; for ( int position = 0 ; position < data . length ; position += 3 ) { builder . append ( encodeGroup ( data , position ) ) ; } return builder . toString ( ) ; } | Translates the specified byte array into Base64 string . |
23,273 | private static char [ ] encodeGroup ( byte [ ] data , int position ) { final char [ ] c = new char [ ] { '=' , '=' , '=' , '=' } ; int b1 = 0 , b2 = 0 , b3 = 0 ; int length = data . length - position ; if ( length == 0 ) return c ; if ( length >= 1 ) { b1 = ( data [ position ] ) & 0xFF ; } if ( length >= 2 ) { b2 = ( data [ position + 1 ] ) & 0xFF ; } if ( length >= 3 ) { b3 = ( data [ position + 2 ] ) & 0xFF ; } c [ 0 ] = ALPHABET [ b1 >> 2 ] ; c [ 1 ] = ALPHABET [ ( b1 & 3 ) << 4 | ( b2 >> 4 ) ] ; if ( length == 1 ) return c ; c [ 2 ] = ALPHABET [ ( b2 & 15 ) << 2 | ( b3 >> 6 ) ] ; if ( length == 2 ) return c ; c [ 3 ] = ALPHABET [ b3 & 0x3f ] ; return c ; } | Encode three bytes of data into four characters . |
23,274 | public static void deploy ( Config config ) { if ( ! contextIsValid ( config ) ) return ; synchronized ( config ) { Resource dir = config . getDeployDirectory ( ) ; if ( ! dir . exists ( ) ) dir . mkdirs ( ) ; Resource [ ] children = dir . listResources ( ALL_EXT ) ; Resource child ; String ext ; for ( int i = 0 ; i < children . length ; i ++ ) { child = children [ i ] ; try { ext = ResourceUtil . getExtension ( child , null ) ; if ( "lar" . equalsIgnoreCase ( ext ) ) { XMLConfigAdmin . updateArchive ( ( ConfigImpl ) config , child , true ) ; } else if ( "lex" . equalsIgnoreCase ( ext ) ) XMLConfigAdmin . _updateRHExtension ( ( ConfigImpl ) config , child , true ) ; else if ( config instanceof ConfigServer && "lco" . equalsIgnoreCase ( ext ) ) XMLConfigAdmin . updateCore ( ( ConfigServerImpl ) config , child , true ) ; } catch ( Throwable t ) { ExceptionUtil . rethrowIfNecessary ( t ) ; Log log = config . getLog ( "deploy" ) ; log . error ( "Extension" , t ) ; } } } } | deploys all files found |
23,275 | public BufferedImage generate ( String text , int width , int height , String [ ] fonts , boolean useAntiAlias , Color fontColor , int fontSize , int difficulty ) throws CaptchaException { if ( difficulty == DIFFICULTY_LOW ) { return generate ( text , width , height , fonts , useAntiAlias , fontColor , fontSize , 0 , 0 , 0 , 0 , 0 , 0 , 230 , 25 ) ; } if ( difficulty == DIFFICULTY_MEDIUM ) { return generate ( text , width , height , fonts , useAntiAlias , fontColor , fontSize , 0 , 0 , 5 , 30 , 0 , 0 , 200 , 35 ) ; } return generate ( text , width , height , fonts , useAntiAlias , fontColor , fontSize , 4 , 10 , 30 , 60 , 4 , 10 , 170 , 45 ) ; } | generates a Captcha as a Buffered Image file |
23,276 | public Object getE ( int intKey ) throws PageException { Iterator it = valueIterator ( ) ; int count = 0 ; Object o ; while ( it . hasNext ( ) ) { o = it . next ( ) ; if ( ( ++ count ) == intKey ) { return o ; } } throw new ExpressionException ( "invalid index [" + intKey + "] for argument scope" ) ; } | return a value matching to key |
23,277 | public static Struct toStruct ( Argument arg ) { Struct trg = new StructImpl ( ) ; StructImpl . copy ( arg , trg , false ) ; return trg ; } | converts a argument scope to a regular struct |
23,278 | public static Array toArray ( Argument arg ) { ArrayImpl trg = new ArrayImpl ( ) ; int [ ] keys = arg . intKeys ( ) ; for ( int i = 0 ; i < keys . length ; i ++ ) { trg . setEL ( keys [ i ] , arg . get ( keys [ i ] , null ) ) ; } return trg ; } | converts a argument scope to a regular array |
23,279 | public static ExpressionException invalidKey ( Config config , Struct sct , Key key , String in ) { String appendix = StringUtil . isEmpty ( in , true ) ? "" : " in the " + in ; Iterator < Key > it = sct . keyIterator ( ) ; Key k ; while ( it . hasNext ( ) ) { k = it . next ( ) ; if ( k . equals ( key ) ) return new ExpressionException ( "the value from key [" + key . getString ( ) + "] " + appendix + " is NULL, which is the same as not existing in CFML" ) ; } config = ThreadLocalPageContext . getConfig ( config ) ; if ( config != null && config . debug ( ) ) return new ExpressionException ( ExceptionUtil . similarKeyMessage ( sct , key . getString ( ) , "key" , "keys" , in , true ) ) ; return new ExpressionException ( "key [" + key . getString ( ) + "] doesn't exist" + appendix ) ; } | throw exception for invalid key |
23,280 | public static void dumpTo ( Resource res , boolean live ) throws IOException { MBeanServer mbserver = ManagementFactory . getPlatformMBeanServer ( ) ; HotSpotDiagnosticMXBean mxbean = ManagementFactory . newPlatformMXBeanProxy ( mbserver , "com.sun.management:type=HotSpotDiagnostic" , HotSpotDiagnosticMXBean . class ) ; String path ; Resource tmp = null ; if ( res instanceof FileResource ) path = res . getAbsolutePath ( ) ; else { tmp = SystemUtil . getTempFile ( "hprof" , false ) ; path = tmp . getAbsolutePath ( ) ; } try { mxbean . dumpHeap ( path , live ) ; } finally { if ( tmp != null && tmp . exists ( ) ) { tmp . moveTo ( res ) ; } } } | Dumps the heap to the outputFile file in the same format as the hprof heap dump . If this method is called remotely from another process the heap dump output is written to a file named outputFile on the machine where the target VM is running . If outputFile is a relative path it is relative to the working directory where the target VM was started . |
23,281 | public static HTTPResponse get ( URL url , String username , String password , long timeout , boolean redirect , String charset , String useragent , ProxyData proxy , lucee . commons . net . http . Header [ ] headers ) throws IOException { HttpGet get = new HttpGet ( url . toExternalForm ( ) ) ; return _invoke ( url , get , username , password , timeout , redirect , charset , useragent , proxy , headers , null ) ; } | does a http get request |
23,282 | public static HTTPResponse put ( URL url , String username , String password , long timeout , boolean redirect , String mimetype , String charset , String useragent , ProxyData proxy , lucee . commons . net . http . Header [ ] headers , Object body ) throws IOException { HttpPut put = new HttpPut ( url . toExternalForm ( ) ) ; setBody ( put , body , mimetype , charset ) ; return _invoke ( url , put , username , password , timeout , redirect , charset , useragent , proxy , headers , null ) ; } | does a http put request |
23,283 | private static HttpEntity toHttpEntity ( Object value , String mimetype , String charset ) throws IOException { if ( value instanceof HttpEntity ) return ( HttpEntity ) value ; ContentType ct = HTTPEngine . toContentType ( mimetype , charset ) ; try { if ( value instanceof TemporaryStream ) { if ( ct != null ) return new TemporaryStreamHttpEntity ( ( TemporaryStream ) value , ct ) ; return new TemporaryStreamHttpEntity ( ( TemporaryStream ) value , null ) ; } else if ( value instanceof InputStream ) { if ( ct != null ) return new ByteArrayEntity ( IOUtil . toBytes ( ( InputStream ) value ) , ct ) ; return new ByteArrayEntity ( IOUtil . toBytes ( ( InputStream ) value ) ) ; } else if ( Decision . isCastableToBinary ( value , false ) ) { if ( ct != null ) return new ByteArrayEntity ( Caster . toBinary ( value ) , ct ) ; return new ByteArrayEntity ( Caster . toBinary ( value ) ) ; } else { boolean wasNull = false ; if ( ct == null ) { wasNull = true ; ct = ContentType . APPLICATION_OCTET_STREAM ; } String str = Caster . toString ( value ) ; if ( str . equals ( "<empty>" ) ) { return new EmptyHttpEntity ( ct ) ; } if ( wasNull && ! StringUtil . isEmpty ( charset , true ) ) return new StringEntity ( str , charset . trim ( ) ) ; else return new StringEntity ( str , ct ) ; } } catch ( Exception e ) { throw ExceptionUtil . toIOException ( e ) ; } } | convert input to HTTP Entity |
23,284 | public void setArguments ( Object args ) { if ( args instanceof lucee . runtime . type . Collection ) { StringBuilder sb = new StringBuilder ( ) ; lucee . runtime . type . Collection coll = ( lucee . runtime . type . Collection ) args ; Iterator < Object > it = coll . valueIterator ( ) ; while ( it . hasNext ( ) ) { sb . append ( ' ' ) ; sb . append ( it . next ( ) ) ; } arguments = sb . toString ( ) ; } else if ( args instanceof String ) { arguments = " " + args . toString ( ) ; } else this . arguments = "" ; } | set the value arguments Command - line arguments passed to the application . |
23,285 | public void setTimeout ( double timeout ) throws ApplicationException { if ( timeout < 0 ) throw new ApplicationException ( "value must be a positive number now [" + Caster . toString ( timeout ) + "]" ) ; this . timeout = ( long ) ( timeout * 1000L ) ; } | set the value timeout Indicates how long in seconds the CFML executing thread waits for the spawned process . A timeout of 0 is equivalent to the non - blocking mode of executing . A very high timeout value is equivalent to a blocking mode of execution . The default is 0 ; therefore the CFML thread spawns a process and returns without waiting for the process to terminate . If no output file is specified and the timeout value is 0 the program output is discarded . |
23,286 | public void setOutputfile ( String outputfile ) { try { this . outputfile = ResourceUtil . toResourceExistingParent ( pageContext , outputfile ) ; pageContext . getConfig ( ) . getSecurityManager ( ) . checkFileLocation ( this . outputfile ) ; } catch ( PageException e ) { this . outputfile = pageContext . getConfig ( ) . getTempDirectory ( ) . getRealResource ( outputfile ) ; if ( ! this . outputfile . getParentResource ( ) . exists ( ) ) this . outputfile = null ; else if ( ! this . outputfile . isFile ( ) ) this . outputfile = null ; else if ( ! this . outputfile . exists ( ) ) { ResourceUtil . createFileEL ( this . outputfile , false ) ; } } } | set the value outputfile The file to which to direct the output of the program . If not specified the output is displayed on the page from which it was called . |
23,287 | public static boolean isFSCaseSensitive ( ) { if ( isFSCaseSensitive == null ) { try { _isFSCaseSensitive ( File . createTempFile ( "abcx" , "txt" ) ) ; } catch ( IOException e ) { File f = new File ( "abcx.txt" ) . getAbsoluteFile ( ) ; try { f . createNewFile ( ) ; _isFSCaseSensitive ( f ) ; } catch ( IOException e1 ) { throw new RuntimeException ( e1 . getMessage ( ) ) ; } } } return isFSCaseSensitive . booleanValue ( ) ; } | returns if the file system case sensitive or not |
23,288 | public static Resource getHomeDirectory ( ) { if ( homeFile != null ) return homeFile ; ResourceProvider frp = ResourcesImpl . getFileResourceProvider ( ) ; String homeStr = System . getProperty ( "user.home" ) ; if ( homeStr != null ) { homeFile = frp . getResource ( homeStr ) ; homeFile = ResourceUtil . getCanonicalResourceEL ( homeFile ) ; } return homeFile ; } | returns the Hoome Directory of the System |
23,289 | public static int getOSArch ( ) { if ( osArch == - 1 ) { osArch = toIntArch ( System . getProperty ( "os.arch.data.model" ) ) ; if ( osArch == ARCH_UNKNOW ) osArch = toIntArch ( System . getProperty ( "os.arch" ) ) ; } return osArch ; } | return the operating system architecture |
23,290 | public static String getSystemPropOrEnvVar ( String name , String defaultValue ) { String value = System . getenv ( name ) ; if ( ! StringUtil . isEmpty ( value ) ) return value ; value = System . getProperty ( name ) ; if ( ! StringUtil . isEmpty ( value ) ) return value ; name = convertSystemPropToEnvVar ( name ) ; value = System . getenv ( name ) ; if ( ! StringUtil . isEmpty ( value ) ) return value ; return defaultValue ; } | returns a system setting by either a Java property name or a System environment variable |
23,291 | public static boolean arePathsSame ( String path1 , String path2 ) { if ( StringUtil . isEmpty ( path1 , true ) || StringUtil . isEmpty ( path2 , true ) ) return false ; String p1 = path1 . replace ( '\\' , '/' ) ; String p2 = path2 . replace ( '\\' , '/' ) ; if ( p1 . endsWith ( "/" ) && ! p2 . endsWith ( "/" ) ) p2 = p2 + "/" ; else if ( p2 . endsWith ( "/" ) && ! p1 . endsWith ( "/" ) ) p1 = p1 + "/" ; return p1 . equalsIgnoreCase ( p2 ) ; } | checks if both paths are the same ignoring CaSe file separator type and whether one path ends with a separator while the other does not . if either path is empty then false is returned . |
23,292 | public ExprTransformer getExprTransfomer ( ) throws TagLibException { if ( exprTransformer != null ) return exprTransformer ; try { exprTransformer = ( ExprTransformer ) ClassUtil . loadInstance ( ELClass . getClazz ( ) ) ; } catch ( Exception e ) { throw new TagLibException ( e ) ; } return exprTransformer ; } | Laedt den innerhalb der TagLib definierten ExprTransfomer und gibt diesen zurueck . Load Expression Transfomer defined in the tag library and return it . |
23,293 | public void setTag ( TagLibTag tag ) { tag . setTagLib ( this ) ; tags . put ( tag . getName ( ) , tag ) ; if ( tag . hasAppendix ( ) ) appendixTags . put ( tag . getName ( ) , tag ) ; else if ( appendixTags . containsKey ( tag . getName ( ) ) ) appendixTags . remove ( tag . getName ( ) ) ; } | Fuegt der TagLib einen weiteren Tag hinzu . Diese Methode wird durch die Klasse TagLibFactory verwendet . |
23,294 | protected void setELClass ( String eLClass , Identification id , Attributes attributes ) { this . ELClass = ClassDefinitionImpl . toClassDefinition ( eLClass , id , attributes ) ; } | Fuegt der TagLib die Evaluator Klassendefinition als Zeichenkette hinzu . Diese Methode wird durch die Klasse TagLibFactory verwendet . |
23,295 | public TagLib duplicate ( boolean deepCopy ) { TagLib tl = new TagLib ( isCore ) ; tl . appendixTags = duplicate ( this . appendixTags , deepCopy ) ; tl . displayName = this . displayName ; tl . ELClass = this . ELClass ; tl . exprTransformer = this . exprTransformer ; tl . isCore = this . isCore ; tl . nameSpace = this . nameSpace ; tl . nameSpaceAndNameSpaceSeperator = this . nameSpaceAndNameSpaceSeperator ; tl . nameSpaceSeperator = this . nameSpaceSeperator ; tl . shortName = this . shortName ; tl . tags = duplicate ( this . tags , deepCopy ) ; tl . type = this . type ; tl . source = this . source ; tl . ignoreUnknowTags = this . ignoreUnknowTags ; return tl ; } | duplicate the taglib does not |
23,296 | private HashMap < String , TagLibTag > duplicate ( HashMap < String , TagLibTag > tags , boolean deepCopy ) { if ( deepCopy ) throw new PageRuntimeException ( new ExpressionException ( "deep copy not supported" ) ) ; Iterator < Entry < String , TagLibTag > > it = tags . entrySet ( ) . iterator ( ) ; HashMap < String , TagLibTag > cm = new HashMap < String , TagLibTag > ( ) ; Entry < String , TagLibTag > entry ; while ( it . hasNext ( ) ) { entry = it . next ( ) ; cm . put ( entry . getKey ( ) , deepCopy ? entry . getValue ( ) : entry . getValue ( ) ) ; } return cm ; } | duplcate a hashmap with TagLibTag s |
23,297 | public static String similarKeyMessage ( Collection . Key [ ] _keys , String keySearched , String keyLabel , String keyLabels , String in , boolean listAll ) { String inThe = StringUtil . isEmpty ( in , true ) ? "" : " in the " + in ; boolean empty = _keys . length == 0 ; if ( listAll && ( _keys . length > 50 || empty ) ) { listAll = false ; } String list = null ; if ( listAll ) { Arrays . sort ( _keys ) ; list = ListUtil . arrayToList ( _keys , "," ) ; } String keySearchedSoundex = StringUtil . soundex ( keySearched ) ; for ( int i = 0 ; i < _keys . length ; i ++ ) { String k = _keys [ i ] . getString ( ) ; if ( StringUtil . soundex ( k ) . equals ( keySearchedSoundex ) ) { if ( keySearched . equalsIgnoreCase ( k ) ) continue ; String appendix ; if ( listAll ) appendix = ". Here is a complete list of all available " + keyLabels + ": [" + list + "]." ; else if ( empty ) appendix = ". The structure is empty" ; else appendix = "." ; return "The " + keyLabel + " [" + keySearched + "] does not exist" + inThe + ", but there is a similar " + keyLabel + " with name [" + _keys [ i ] . getString ( ) + "] available" + appendix ; } } String appendix ; if ( listAll ) appendix = ", only the following " + keyLabels + " are available: [" + list + "]." ; else if ( empty ) appendix = ", the structure is empty" ; else appendix = "." ; return "The " + keyLabel + " [" + keySearched + "] does not exist" + inThe + appendix ; } | creates a message for key not found with soundex check for similar key |
23,298 | public Constructor [ ] getConstructors ( Class clazz , int count ) { Array con ; Object o ; synchronized ( map ) { o = map . get ( clazz ) ; if ( o == null ) { con = store ( clazz ) ; } else con = ( Array ) o ; } o = con . get ( count + 1 , null ) ; if ( o == null ) return null ; return ( Constructor [ ] ) o ; } | returns a constructor matching given criteria or null if Constructor doesn t exist |
23,299 | private Array store ( Class clazz ) { Constructor [ ] conArr = clazz . getConstructors ( ) ; Array args = new ArrayImpl ( ) ; for ( int i = 0 ; i < conArr . length ; i ++ ) { storeArgs ( conArr [ i ] , args ) ; } map . put ( clazz , args ) ; return args ; } | stores the constructors for a Class |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.