idx int64 0 41.2k | question stringlengths 74 4.21k | target stringlengths 5 888 |
|---|---|---|
22,900 | public void updateLocale ( String locale ) throws SecurityException { checkWriteAccess ( ) ; boolean hasAccess = ConfigWebUtil . hasAccess ( config , SecurityManager . TYPE_SETTING ) ; if ( ! hasAccess ) throw new SecurityException ( "no access to update regional setting" ) ; Element scope = _getRootElement ( "regional" ) ; scope . setAttribute ( "locale" , locale . trim ( ) ) ; } | update the locale |
22,901 | public void updateTimeZone ( String timeZone ) throws SecurityException { checkWriteAccess ( ) ; boolean hasAccess = ConfigWebUtil . hasAccess ( config , SecurityManager . TYPE_SETTING ) ; if ( ! hasAccess ) throw new SecurityException ( "no access to update regional setting" ) ; Element regional = _getRootElement ( "regional" ) ; regional . setAttribute ( "timezone" , timeZone . trim ( ) ) ; } | update the timeZone |
22,902 | public void updateTimeServer ( String timeServer , Boolean useTimeServer ) throws PageException { checkWriteAccess ( ) ; if ( useTimeServer != null && useTimeServer . booleanValue ( ) && ! StringUtil . isEmpty ( timeServer , true ) ) { try { new NtpClient ( timeServer ) . getOffset ( ) ; } catch ( IOException e ) { try { new NtpClient ( timeServer ) . getOffset ( ) ; } catch ( IOException ee ) { throw Caster . toPageException ( ee ) ; } } } boolean hasAccess = ConfigWebUtil . hasAccess ( config , SecurityManager . TYPE_SETTING ) ; if ( ! hasAccess ) throw new SecurityException ( "no access to update regional setting" ) ; Element scope = _getRootElement ( "regional" ) ; scope . setAttribute ( "timeserver" , timeServer . trim ( ) ) ; if ( useTimeServer != null ) scope . setAttribute ( "use-timeserver" , Caster . toString ( useTimeServer ) ) ; else scope . removeAttribute ( "use-timeserver" ) ; } | update the timeServer |
22,903 | public void updateBaseComponent ( String baseComponentCFML , String baseComponentLucee ) throws SecurityException { checkWriteAccess ( ) ; boolean hasAccess = ConfigWebUtil . hasAccess ( config , SecurityManager . TYPE_SETTING ) ; if ( ! hasAccess ) throw new SecurityException ( "no access to update component setting" ) ; Element scope = _getRootElement ( "component" ) ; scope . removeAttribute ( "base" ) ; scope . setAttribute ( "base-cfml" , baseComponentCFML ) ; scope . setAttribute ( "base-lucee" , baseComponentLucee ) ; } | update the baseComponent |
22,904 | public void updateDebug ( Boolean debug , Boolean database , Boolean exception , Boolean tracing , Boolean dump , Boolean timer , Boolean implicitAccess , Boolean queryUsage ) throws SecurityException { checkWriteAccess ( ) ; boolean hasAccess = ConfigWebUtil . hasAccess ( config , SecurityManager . TYPE_DEBUGGING ) ; if ( ! hasAccess ) throw new SecurityException ( "no access to change debugging settings" ) ; Element debugging = _getRootElement ( "debugging" ) ; if ( debug != null ) debugging . setAttribute ( "debug" , Caster . toString ( debug . booleanValue ( ) ) ) ; else debugging . removeAttribute ( "debug" ) ; if ( database != null ) debugging . setAttribute ( "database" , Caster . toString ( database . booleanValue ( ) ) ) ; else debugging . removeAttribute ( "database" ) ; if ( exception != null ) debugging . setAttribute ( "exception" , Caster . toString ( exception . booleanValue ( ) ) ) ; else debugging . removeAttribute ( "exception" ) ; if ( tracing != null ) debugging . setAttribute ( "tracing" , Caster . toString ( tracing . booleanValue ( ) ) ) ; else debugging . removeAttribute ( "tracing" ) ; if ( dump != null ) debugging . setAttribute ( "dump" , Caster . toString ( dump . booleanValue ( ) ) ) ; else debugging . removeAttribute ( "dump" ) ; if ( timer != null ) debugging . setAttribute ( "timer" , Caster . toString ( timer . booleanValue ( ) ) ) ; else debugging . removeAttribute ( "timer" ) ; if ( implicitAccess != null ) debugging . setAttribute ( "implicit-access" , Caster . toString ( implicitAccess . booleanValue ( ) ) ) ; else debugging . removeAttribute ( "implicit-access" ) ; if ( queryUsage != null ) debugging . setAttribute ( "query-usage" , Caster . toString ( queryUsage . booleanValue ( ) ) ) ; else debugging . removeAttribute ( "query-usage" ) ; } | updates if debugging or not |
22,905 | public void updateErrorTemplate ( int statusCode , String template ) throws SecurityException { checkWriteAccess ( ) ; boolean hasAccess = ConfigWebUtil . hasAccess ( config , SecurityManager . TYPE_DEBUGGING ) ; if ( ! hasAccess ) throw new SecurityException ( "no access to change error settings" ) ; Element error = _getRootElement ( "error" ) ; error . setAttribute ( "template-" + statusCode , template ) ; } | updates the ErrorTemplate |
22,906 | public void updateSessionType ( String type ) throws SecurityException { checkWriteAccess ( ) ; boolean hasAccess = ConfigWebUtil . hasAccess ( config , SecurityManager . TYPE_SETTING ) ; if ( ! hasAccess ) throw new SecurityException ( "no access to update scope setting" ) ; type = type . toLowerCase ( ) . trim ( ) ; Element scope = _getRootElement ( "scope" ) ; scope . setAttribute ( "session-type" , type ) ; } | session type update |
22,907 | public void updateUpdate ( String type , String location ) throws SecurityException { checkWriteAccess ( ) ; if ( ! ( config instanceof ConfigServer ) ) { throw new SecurityException ( "can't change update setting from this context, access is denied" ) ; } Element update = _getRootElement ( "update" ) ; update . setAttribute ( "type" , type ) ; try { location = HTTPUtil . toURL ( location , true ) . toString ( ) ; } catch ( Throwable e ) { ExceptionUtil . rethrowIfNecessary ( e ) ; } update . setAttribute ( "location" , location ) ; } | updates update settingd for Lucee |
22,908 | public void removeSecurityManager ( Password password , String id ) throws PageException { checkWriteAccess ( ) ; ( ( ConfigServerImpl ) ConfigImpl . getConfigServer ( config , password ) ) . removeSecurityManager ( id ) ; Element security = _getRootElement ( "security" ) ; Element [ ] children = XMLConfigWebFactory . getChildren ( security , "accessor" ) ; for ( int i = 0 ; i < children . length ; i ++ ) { if ( id . equals ( children [ i ] . getAttribute ( "id" ) ) ) { security . removeChild ( children [ i ] ) ; } } } | remove security manager matching given id |
22,909 | public void runUpdate ( Password password ) throws PageException { checkWriteAccess ( ) ; ConfigServerImpl cs = ( ConfigServerImpl ) ConfigImpl . getConfigServer ( config , password ) ; CFMLEngineFactory factory = cs . getCFMLEngine ( ) . getCFMLEngineFactory ( ) ; synchronized ( factory ) { try { cleanUp ( factory ) ; factory . update ( cs . getPassword ( ) , cs . getIdentification ( ) ) ; } catch ( Exception e ) { throw Caster . toPageException ( e ) ; } } } | run update from cfml engine |
22,910 | public static RHExtension hasRHExtensions ( ConfigImpl config , ExtensionDefintion ed ) throws PageException , SAXException , IOException { XMLConfigAdmin admin = new XMLConfigAdmin ( config , null ) ; return admin . _hasRHExtensions ( config , ed ) ; } | returns the version if the extension is available |
22,911 | public static boolean call ( PageContext pc , String str ) { try { return pc . evaluate ( str ) == null ; } catch ( PageException e ) { return true ; } } | called by modifed call from translation time evaluator |
22,912 | public void setTimeout ( Object oTimeout ) throws PageException { if ( oTimeout instanceof TimeSpan ) this . timeoutInMillis = toInt ( ( ( TimeSpan ) oTimeout ) . getMillis ( ) ) ; else this . timeoutInMillis = toInt ( Caster . toDoubleValue ( oTimeout ) * 1000D ) ; } | set the value timeout Specifies the maximum amount of time in seconds to wait to obtain a lock . If a lock can be obtained within the specified period execution continues inside the body of the tag . Otherwise the behavior depends on the value of the throwOnTimeout attribute . |
22,913 | public void setName ( String name ) throws ApplicationException { if ( name == null ) return ; this . name = name . trim ( ) ; if ( name . length ( ) == 0 ) throw new ApplicationException ( "invalid attribute definition" , "attribute [name] can't be a empty string" ) ; } | set the value name |
22,914 | public static ResourceSnippet createResourceSnippet ( InputStream is , int startChar , int endChar , String charset ) { return createResourceSnippet ( getContents ( is , charset ) , startChar , endChar ) ; } | extract a ResourceSnippet from InputStream at the given char positions |
22,915 | public static ResourceSnippet createResourceSnippet ( Resource res , int startChar , int endChar , String charset ) { try { return createResourceSnippet ( res . getInputStream ( ) , startChar , endChar , charset ) ; } catch ( IOException ex ) { return ResourceSnippet . Empty ; } } | extract a ResourceSnippet from a Resource at the given char positions |
22,916 | public static int getLineNumber ( String text , int posChar ) { int len = Math . min ( posChar , text . length ( ) ) ; int result = 1 ; for ( int i = 0 ; i < len ; i ++ ) { if ( text . charAt ( i ) == '\n' ) result ++ ; } return result ; } | returns the line number of the given char in the text |
22,917 | public static Password getPassword ( PageContext pc , String password , boolean server ) throws lucee . runtime . exp . SecurityException { if ( StringUtil . isEmpty ( password , true ) ) { ApplicationContext appContext = pc . getApplicationContext ( ) ; if ( appContext instanceof ModernApplicationContext ) password = Caster . toString ( ( ( ModernApplicationContext ) appContext ) . getCustom ( KeyConstants . _webAdminPassword ) , "" ) ; } else password = password . trim ( ) ; if ( StringUtil . isEmpty ( password , true ) ) throw new lucee . runtime . exp . SecurityException ( "A Web Admin Password is required to manipulate Cache connections. " + "You can either pass the password as an argument to this function, or set it in " + ( pc . getRequestDialect ( ) == CFMLEngine . DIALECT_CFML ? Constants . CFML_APPLICATION_EVENT_HANDLER : Constants . LUCEE_APPLICATION_EVENT_HANDLER ) + " with the variable [this.webAdminPassword]." ) ; return PasswordImpl . passwordToCompare ( pc . getConfig ( ) , server , password ) ; } | returns true if the webAdminPassword matches the passed password if one is passed or a password defined in Application . cfc as this . webAdminPassword if null or empty - string is passed for password |
22,918 | public String getContentType ( ) { URLConnection connection = null ; try { connection = url . openConnection ( ) ; } catch ( IOException e ) { } if ( connection == null ) return DEFAULT_CONTENT_TYPE ; return connection . getContentType ( ) ; } | Returns the value of the URL content - type header field |
22,919 | public InputStream getInputStream ( ) throws IOException { if ( barr == null ) { barr = IOUtil . toBytes ( url . openStream ( ) ) ; } return new ByteArrayInputStream ( barr ) ; } | Returns an InputStream obtained from the data source |
22,920 | public OutputStream getOutputStream ( ) throws IOException { URLConnection connection = url . openConnection ( ) ; if ( connection == null ) return null ; connection . setDoOutput ( true ) ; return connection . getOutputStream ( ) ; } | Returns an OutputStream obtained from the data source |
22,921 | public static short toType ( String strType ) throws RegistryException { if ( strType . equals ( REGDWORD_TOKEN ) ) return RegistryEntry . TYPE_DWORD ; else if ( strType . equals ( REGSTR_TOKEN ) ) return RegistryEntry . TYPE_STRING ; else if ( strType . equals ( REGKEY_TOKEN ) ) return RegistryEntry . TYPE_KEY ; throw new RegistryException ( strType + " is not a valid Registry Type" ) ; } | cast a String type to a short Type |
22,922 | private void expungeStaleEntries ( ) { for ( Object x ; ( x = queue . poll ( ) ) != null ; ) { synchronized ( queue ) { @ SuppressWarnings ( "unchecked" ) Entry < K , V > e = ( Entry < K , V > ) x ; int i = indexFor ( e . hash , table . length ) ; Entry < K , V > prev = table [ i ] ; Entry < K , V > p = prev ; while ( p != null ) { Entry < K , V > next = p . next ; if ( p == e ) { if ( prev == e ) table [ i ] = next ; else prev . next = next ; e . value = null ; size -- ; break ; } prev = p ; p = next ; } } } } | Expunges stale entries from the table . |
22,923 | Entry < K , V > getEntry ( Object key ) { Object k = maskNull ( key ) ; int h = hash ( k ) ; Entry < K , V > [ ] tab = getTable ( ) ; int index = indexFor ( h , tab . length ) ; Entry < K , V > e = tab [ index ] ; while ( e != null && ! ( e . hash == h && eq ( k , e . get ( ) ) ) ) e = e . next ; return e ; } | Returns the entry associated with the specified key in this map . Returns null if the map contains no mapping for this key . |
22,924 | public void registerResourceProvider ( ResourceProvider provider ) { provider . setResources ( this ) ; String scheme = provider . getScheme ( ) ; if ( StringUtil . isEmpty ( scheme ) ) return ; ResourceProviderFactory [ ] tmp = new ResourceProviderFactory [ resources . length + 1 ] ; for ( int i = 0 ; i < resources . length ; i ++ ) { if ( scheme . equalsIgnoreCase ( resources [ i ] . getScheme ( ) ) ) { resources [ i ] = new ResourceProviderFactory ( this , provider ) ; return ; } tmp [ i ] = resources [ i ] ; } tmp [ resources . length ] = new ResourceProviderFactory ( this , provider ) ; resources = tmp ; } | adds a additional resource to System |
22,925 | public Resource getResource ( String path ) { int index = path . indexOf ( "://" ) ; if ( index != - 1 ) { String scheme = path . substring ( 0 , index ) . toLowerCase ( ) . trim ( ) ; String subPath = path . substring ( index + 3 ) ; for ( int i = 0 ; i < resources . length ; i ++ ) { if ( scheme . equalsIgnoreCase ( resources [ i ] . getScheme ( ) ) ) { return resources [ i ] . instance ( ) . getResource ( subPath ) ; } } } return defaultResource . getResource ( path ) ; } | returns a resource that matching the given path |
22,926 | private int getPid ( ) { PageContext pc = ThreadLocalPageContext . get ( ) ; if ( pc == null ) { pc = CFMLEngineFactory . getInstance ( ) . getThreadPageContext ( ) ; if ( pc == null ) throw new RuntimeException ( "cannot get pid for current thread" ) ; } return pc . getId ( ) ; } | private static int pidc = 0 ; |
22,927 | public String getColumnlist ( boolean upperCase ) { StringBuilder sb = new StringBuilder ( ) ; for ( int i = 0 ; i < columnNames . length ; i ++ ) { if ( i > 0 ) sb . append ( ',' ) ; sb . append ( upperCase ? columnNames [ i ] . getUpperString ( ) : columnNames [ i ] . getString ( ) ) ; } return sb . toString ( ) ; } | return a string list of all columns |
22,928 | public synchronized void sort ( String strColumn , int order ) throws PageException { sort ( getColumn ( strColumn ) , order ) ; } | sorts a query by a column |
22,929 | private Object _deserializeQuery ( Element recordset ) throws ConverterException { try { Query query = new QueryImpl ( lucee . runtime . type . util . ListUtil . listToArray ( recordset . getAttribute ( "fieldNames" ) , ',' ) , Caster . toIntValue ( recordset . getAttribute ( "rowCount" ) ) , "query" ) ; NodeList list = recordset . getChildNodes ( ) ; int len = list . getLength ( ) ; for ( int i = 0 ; i < len ; i ++ ) { Node node = list . item ( i ) ; if ( node instanceof Element ) { _deserializeQueryField ( query , ( Element ) node ) ; } } return query ; } catch ( PageException e ) { throw toConverterException ( e ) ; } } | Desirialize a Query Object |
22,930 | private void _deserializeQueryField ( Query query , Element field ) throws PageException , ConverterException { String name = field . getAttribute ( "name" ) ; NodeList list = field . getChildNodes ( ) ; int len = list . getLength ( ) ; int count = 0 ; for ( int i = 0 ; i < len ; i ++ ) { Node node = list . item ( i ) ; if ( node instanceof Element ) { query . setAt ( KeyImpl . init ( name ) , ++ count , _deserialize ( ( Element ) node ) ) ; } } } | deserilize a single Field of a query WDDX Object |
22,931 | private Object _deserializeComponent ( Element elComp ) throws ConverterException { String name = elComp . getAttribute ( "name" ) ; String md5 = elComp . getAttribute ( "md5" ) ; PageContext pc = ThreadLocalPageContext . get ( ) ; Component comp = null ; try { comp = pc . loadComponent ( name ) ; if ( ! ComponentUtil . md5 ( comp ) . equals ( md5 ) ) { throw new ConverterException ( "component [" + name + "] in this enviroment has not the same interface as the component to load, it is possible that one off the components has Functions added dynamicly." ) ; } } catch ( ConverterException e ) { throw e ; } catch ( Exception e ) { throw new ConverterException ( e . getMessage ( ) ) ; } NodeList list = elComp . getChildNodes ( ) ; ComponentScope scope = comp . getComponentScope ( ) ; int len = list . getLength ( ) ; String scopeName ; Element var , value ; Collection . Key key ; for ( int i = 0 ; i < len ; i ++ ) { Node node = list . item ( i ) ; if ( node instanceof Element ) { var = ( Element ) node ; value = getChildElement ( ( Element ) node ) ; scopeName = var . getAttribute ( "scope" ) ; if ( value != null ) { key = Caster . toKey ( var . getAttribute ( "name" ) , null ) ; if ( key == null ) continue ; if ( "variables" . equalsIgnoreCase ( scopeName ) ) scope . setEL ( key , _deserialize ( value ) ) ; else comp . setEL ( key , _deserialize ( value ) ) ; } } } return comp ; } | Desirialize a Component Object |
22,932 | private Element getChildElement ( Element parent ) { NodeList list = parent . getChildNodes ( ) ; int len = list . getLength ( ) ; for ( int i = 0 ; i < len ; i ++ ) { Node node = list . item ( i ) ; if ( node instanceof Element ) { return ( Element ) node ; } } return null ; } | return fitst child Element of a Element if there are no child Elements return null |
22,933 | public String format ( Locale locale , double number ) { DecimalFormat df = getDecimalFormat ( locale ) ; df . applyPattern ( ",0" ) ; df . setGroupingSize ( 3 ) ; return df . format ( number ) ; } | formats a number |
22,934 | public String formatX ( Locale locale , double number , String mask ) throws InvalidMaskException { return format ( locale , number , convertMask ( mask ) ) ; } | format a number with given mask |
22,935 | private void enlargeOffset ( ) { if ( offset == 0 ) { offCount = offCount == 0 ? 1 : offCount * 2 ; offset = offCount ; Object [ ] narr = new Object [ arr . length + offset ] ; for ( int i = 0 ; i < size ; i ++ ) { narr [ offset + i ] = arr [ i ] ; } arr = narr ; } } | !!! all methods that use this method must be sync enlarge the offset if 0 |
22,936 | private Boolean isInsideCITemplate ( Page page ) { SourceCode sc = page . getSourceCode ( ) ; if ( ! ( sc instanceof PageSourceCode ) ) return null ; PageSource psc = ( ( PageSourceCode ) sc ) . getPageSource ( ) ; String src = psc . getDisplayPath ( ) ; return Constants . isComponentExtension ( ResourceUtil . getExtension ( src , "" ) ) ; } | is the template ending with a component extension? |
22,937 | public static Number toNumber ( String str , Number defaultValue ) { try { if ( str . indexOf ( '.' ) != - 1 ) { return new BigDecimal ( str ) ; } BigInteger bi = new BigInteger ( str ) ; int l = bi . bitLength ( ) ; if ( l < 32 ) return new Integer ( bi . intValue ( ) ) ; if ( l < 64 ) return new Long ( bi . longValue ( ) ) ; return bi ; } catch ( Throwable t ) { ExceptionUtil . rethrowIfNecessary ( t ) ; return defaultValue ; } } | returns a number Object this can be a BigDecimal BigInteger Long Double depending on the input . |
22,938 | public static String toString3 ( double d ) { long l = ( long ) d ; if ( l == d ) return toString ( l ) ; String str = Double . toString ( d ) ; int pos ; if ( ( pos = str . indexOf ( 'E' ) ) != - 1 && pos == str . length ( ) - 2 ) { return new StringBuffer ( pos + 2 ) . append ( str . charAt ( 0 ) ) . append ( str . substring ( 2 , toDigit ( str . charAt ( pos + 1 ) ) + 2 ) ) . append ( '.' ) . append ( str . substring ( toDigit ( str . charAt ( pos + 1 ) ) + 2 , pos ) ) . toString ( ) ; } return str ; } | cast a double value to a String |
22,939 | public static byte [ ] toBinary ( Object o ) throws PageException { if ( o instanceof byte [ ] ) return ( byte [ ] ) o ; else if ( o instanceof ObjectWrap ) return toBinary ( ( ( ObjectWrap ) o ) . getEmbededObject ( "" ) ) ; else if ( o instanceof InputStream ) { ByteArrayOutputStream barr = new ByteArrayOutputStream ( ) ; try { IOUtil . copy ( ( InputStream ) o , barr , false , true ) ; } catch ( IOException e ) { throw ExpressionException . newInstance ( e ) ; } return barr . toByteArray ( ) ; } else if ( o != null && o . getClass ( ) . getName ( ) . equals ( "org.lucee.extension.image.Image" ) ) { return ImageUtil . getImageBytes ( o , null ) ; } else if ( o instanceof BufferedImage ) { return ImageUtil . getImageBytes ( ( BufferedImage ) o ) ; } else if ( o instanceof ByteArrayOutputStream ) { return ( ( ByteArrayOutputStream ) o ) . toByteArray ( ) ; } else if ( o instanceof Blob ) { InputStream is = null ; try { is = ( ( Blob ) o ) . getBinaryStream ( ) ; return IOUtil . toBytes ( is ) ; } catch ( Exception e ) { throw new ExpressionException ( e . getMessage ( ) ) ; } finally { IOUtil . closeEL ( is ) ; } } try { return Base64Encoder . decode ( toString ( o ) ) ; } catch ( PageException e ) { throw new CasterException ( o , "binary" ) ; } } | cast a Object to a Binary |
22,940 | public static String toBase64 ( Object o , String charset , String defaultValue ) { ; if ( o instanceof byte [ ] ) return toB64 ( ( byte [ ] ) o , defaultValue ) ; else if ( o instanceof String ) return toB64 ( ( String ) o , charset , defaultValue ) ; else if ( o instanceof Number ) return toB64 ( toString ( ( ( Number ) o ) ) , charset , defaultValue ) ; else if ( o instanceof ObjectWrap ) { return toBase64 ( ( ( ObjectWrap ) o ) . getEmbededObject ( defaultValue ) , charset , defaultValue ) ; } else if ( o == null ) { return toBase64 ( "" , charset , defaultValue ) ; } else { byte [ ] b = toBinary ( o , null ) ; if ( b != null ) return toB64 ( b , defaultValue ) ; else { String str = toString ( o , null ) ; if ( str != null ) return toBase64 ( str , charset , defaultValue ) ; else return defaultValue ; } } } | cast a Object to a Base64 value |
22,941 | public static QueryColumn toQueryColumn ( Object o ) throws PageException { if ( o instanceof QueryColumn ) return ( QueryColumn ) o ; throw new CasterException ( o , "querycolumn" ) ; } | converts a object to a QueryColumn if possible |
22,942 | public static QueryColumn toQueryColumn ( Object o , PageContext pc ) throws PageException { if ( o instanceof QueryColumn ) return ( QueryColumn ) o ; if ( o instanceof String ) { o = VariableInterpreter . getVariableAsCollection ( pc , ( String ) o ) ; if ( o instanceof QueryColumn ) return ( QueryColumn ) o ; } throw new CasterException ( o , "querycolumn" ) ; } | converts a object to a QueryColumn if possible also variable declarations are allowed . this method is used within the generated bytecode |
22,943 | public static Collection toCollection ( Object o ) throws PageException { if ( o instanceof Collection ) return ( Collection ) o ; else if ( o instanceof Node ) return XMLCaster . toXMLStruct ( ( Node ) o , false ) ; else if ( o instanceof Map ) { return MapAsStruct . toStruct ( ( Map ) o , true ) ; } else if ( o instanceof ObjectWrap ) { return toCollection ( ( ( ObjectWrap ) o ) . getEmbededObject ( ) ) ; } else if ( Decision . isArray ( o ) ) { return toArray ( o ) ; } throw new CasterException ( o , "collection" ) ; } | cast a Object to a Collection |
22,944 | public static Component toComponent ( Object o ) throws PageException { if ( o instanceof Component ) return ( Component ) o ; else if ( o instanceof ObjectWrap ) { return toComponent ( ( ( ObjectWrap ) o ) . getEmbededObject ( ) ) ; } throw new CasterException ( o , "Component" ) ; } | cast a Object to a Component |
22,945 | public static Locale toLocale ( String strLocale , Locale defaultValue ) { return LocaleFactory . getLocale ( strLocale , defaultValue ) ; } | casts a string to a Locale |
22,946 | public static TimeZone toTimeZone ( String strTimeZone , TimeZone defaultValue ) { return TimeZoneUtil . toTimeZone ( strTimeZone , defaultValue ) ; } | casts a string to a TimeZone |
22,947 | public static Integer toInteger ( Object o , Integer defaultValue ) { if ( defaultValue != null ) return Integer . valueOf ( toIntValue ( o , defaultValue . intValue ( ) ) ) ; int res = toIntValue ( o , Integer . MIN_VALUE ) ; if ( res == Integer . MIN_VALUE ) return defaultValue ; return Integer . valueOf ( res ) ; } | casts a Object to a Integer |
22,948 | public final int doAfterBody ( ) throws JspException { BodyContent body = getBodyContent ( ) ; String s = body . getString ( ) . trim ( ) ; body . clearBody ( ) ; if ( output_date == null ) { long time ; try { time = Long . valueOf ( s ) . longValue ( ) ; output_date = new Date ( time ) ; } catch ( NumberFormatException nfe ) { } } return SKIP_BODY ; } | Method called at end of format tag body . |
22,949 | public final int doEndTag ( ) throws JspException { String date_formatted = default_text ; if ( output_date != null ) { SimpleDateFormat sdf ; String pat = pattern ; if ( pat == null && patternid != null ) { Object attr = pageContext . findAttribute ( patternid ) ; if ( attr != null ) pat = attr . toString ( ) ; } if ( pat == null ) { sdf = new SimpleDateFormat ( ) ; pat = sdf . toPattern ( ) ; } if ( symbolsRef != null ) { symbols = ( DateFormatSymbols ) pageContext . findAttribute ( symbolsRef ) ; if ( symbols == null ) { throw new JspException ( "datetime format tag could not find dateFormatSymbols for symbolsRef \"" + symbolsRef + "\"." ) ; } } if ( localeRef != null ) { Locale locale = ( Locale ) pageContext . findAttribute ( localeRef ) ; if ( locale == null ) { throw new JspException ( "datetime format tag could not find locale for localeRef \"" + localeRef + "\"." ) ; } sdf = new SimpleDateFormat ( pat , locale ) ; } else if ( locale_flag ) { sdf = new SimpleDateFormat ( pat , pageContext . getRequest ( ) . getLocale ( ) ) ; } else if ( symbols != null ) { sdf = new SimpleDateFormat ( pat , symbols ) ; } else { sdf = new SimpleDateFormat ( pat ) ; } if ( timeZone_string != null ) { TimeZone timeZone = ( TimeZone ) pageContext . getAttribute ( timeZone_string , PageContext . SESSION_SCOPE ) ; if ( timeZone == null ) { throw new JspTagException ( "Datetime format tag timeZone " + "script variable \"" + timeZone_string + " \" does not exist" ) ; } sdf . setTimeZone ( timeZone ) ; } date_formatted = sdf . format ( output_date ) ; } try { pageContext . getOut ( ) . write ( date_formatted ) ; } catch ( Exception e ) { throw new JspException ( "IO Error: " + e . getMessage ( ) ) ; } return EVAL_PAGE ; } | Method called at end of Tag |
22,950 | public synchronized Class < ? > loadClass ( String className ) throws ClassNotFoundException { PCLBlock cl = index . get ( className ) ; if ( cl != null ) { return cl . loadClass ( className ) ; } throw new ClassNotFoundException ( "class " + className + " not found" ) ; } | load existing class |
22,951 | public synchronized int shrink ( boolean force ) { int before = index . size ( ) ; int flushCFM = 0 ; while ( cfms . size ( ) > 1 ) { flush ( cfms . poll ( ) ) ; flushCFM ++ ; } if ( force && flushCFM < 2 && cfcs . size ( ) > 1 ) { flush ( oldest ( cfcs ) ) ; if ( cfcs . size ( ) > 1 ) flush ( cfcs . poll ( ) ) ; } return before - index . size ( ) ; } | shrink the classloader elements |
22,952 | public Object setE ( int key , Object value ) throws ExpressionException { if ( offset + key > arr . length ) enlargeCapacity ( key ) ; if ( key > size ) size = key ; arr [ ( offset + key ) - 1 ] = checkValue ( value ) ; return value ; } | set value at defined position |
22,953 | public boolean add ( Object o ) { if ( offset + size + 1 > arr . length ) enlargeCapacity ( size + 1 ) ; arr [ offset + size ] = o ; size ++ ; return true ; } | adds a value and return this array |
22,954 | protected void service ( HttpServletRequest req , HttpServletResponse rsp ) throws ServletException , IOException { String [ ] arrPath = ( req . getServletPath ( ) ) . split ( "\\." ) ; String pic = PIC_SOURCE + "404.gif" ; if ( arrPath . length >= 3 ) { pic = PIC_SOURCE + ( ( arrPath [ arrPath . length - 3 ] + "." + arrPath [ arrPath . length - 2 ] ) . replaceFirst ( "/" , "" ) ) ; String mime = "image/" + arrPath [ arrPath . length - 2 ] ; ReqRspUtil . setContentType ( rsp , mime ) ; } OutputStream os = null ; InputStream is = null ; try { os = rsp . getOutputStream ( ) ; is = getClass ( ) . getResourceAsStream ( pic ) ; if ( is == null ) { is = getClass ( ) . getResourceAsStream ( PIC_SOURCE + "404.gif" ) ; } byte [ ] buf = new byte [ 4 * 1024 ] ; int nread = 0 ; while ( ( nread = is . read ( buf ) ) >= 0 ) { os . write ( buf , 0 , nread ) ; } } catch ( FileNotFoundException e ) { } catch ( IOException e ) { } finally { IOUtil . closeEL ( is , os ) ; } } | Interpretiert den Script - Name und laedt das entsprechende Bild aus den internen Resourcen . |
22,955 | public static String getHashText ( String plainText , String algorithm ) throws NoSuchAlgorithmException { MessageDigest mdAlgorithm = MessageDigest . getInstance ( algorithm ) ; mdAlgorithm . update ( plainText . getBytes ( ) ) ; byte [ ] digest = mdAlgorithm . digest ( ) ; StringBuffer hexString = new StringBuffer ( ) ; for ( int i = 0 ; i < digest . length ; i ++ ) { plainText = Integer . toHexString ( 0xFF & digest [ i ] ) ; if ( plainText . length ( ) < 2 ) { plainText = "0" + plainText ; } hexString . append ( plainText ) ; } return hexString . toString ( ) ; } | Method getHashText . |
22,956 | public void characters ( char ch [ ] , int start , int length ) { content . append ( new String ( ch , start , length ) ) ; } | Geerbte Methode von org . xml . sax . ContentHandler wird bei durchparsen des XML zum einlesen des Content eines Body Element aufgerufen . |
22,957 | public static FunctionLib [ ] loadFromDirectory ( Resource dir , Identification id ) throws FunctionLibException { if ( ! dir . isDirectory ( ) ) return new FunctionLib [ 0 ] ; ArrayList < FunctionLib > arr = new ArrayList < FunctionLib > ( ) ; Resource [ ] files = dir . listResources ( new ExtensionResourceFilter ( new String [ ] { "fld" , "fldx" } ) ) ; for ( int i = 0 ; i < files . length ; i ++ ) { if ( files [ i ] . isFile ( ) ) arr . add ( FunctionLibFactory . loadFromFile ( files [ i ] , id ) ) ; } return arr . toArray ( new FunctionLib [ arr . size ( ) ] ) ; } | Laedt mehrere FunctionLib s die innerhalb eines Verzeichnisses liegen . |
22,958 | public static FunctionLib loadFromFile ( Resource res , Identification id ) throws FunctionLibException { FunctionLib lib = FunctionLibFactory . hashLib . get ( id ( res ) ) ; if ( lib == null ) { lib = new FunctionLibFactory ( null , res , id , false ) . getLib ( ) ; FunctionLibFactory . hashLib . put ( id ( res ) , lib ) ; } lib . setSource ( res . toString ( ) ) ; return lib ; } | Laedt eine einzelne FunctionLib . |
22,959 | public static FunctionLib [ ] loadFromSystem ( Identification id ) throws FunctionLibException { if ( systemFLDs [ CFMLEngine . DIALECT_CFML ] == null ) { FunctionLib cfml = new FunctionLibFactory ( null , FLD_BASE , id , true ) . getLib ( ) ; FunctionLib lucee = cfml . duplicate ( false ) ; systemFLDs [ CFMLEngine . DIALECT_CFML ] = new FunctionLibFactory ( cfml , FLD_CFML , id , true ) . getLib ( ) ; systemFLDs [ CFMLEngine . DIALECT_LUCEE ] = new FunctionLibFactory ( lucee , FLD_LUCEE , id , true ) . getLib ( ) ; } return systemFLDs ; } | Laedt die Systeminterne FLD . |
22,960 | private static void copyFunctions ( FunctionLib extFL , FunctionLib newFL ) { Iterator < Entry < String , FunctionLibFunction > > it = extFL . getFunctions ( ) . entrySet ( ) . iterator ( ) ; FunctionLibFunction flf ; while ( it . hasNext ( ) ) { flf = it . next ( ) . getValue ( ) ; newFL . setFunction ( flf ) ; } } | copy function from one FunctionLib to a other |
22,961 | private static void setAttributes ( FunctionLib extFL , FunctionLib newFL ) { newFL . setDescription ( extFL . getDescription ( ) ) ; newFL . setDisplayName ( extFL . getDisplayName ( ) ) ; newFL . setShortName ( extFL . getShortName ( ) ) ; newFL . setUri ( extFL . getUri ( ) ) ; newFL . setVersion ( extFL . getVersion ( ) ) ; } | copy attributes from old fld to the new |
22,962 | protected long encryptBlock ( long lPlainblock ) { lPlainblock ^= m_lCBCIV ; lPlainblock = super . encryptBlock ( lPlainblock ) ; return ( m_lCBCIV = lPlainblock ) ; } | internal routine to encrypt a block in CBC mode |
22,963 | protected long decryptBlock ( long lCipherblock ) { long lTemp = lCipherblock ; lCipherblock = super . decryptBlock ( lCipherblock ) ; lCipherblock ^= m_lCBCIV ; m_lCBCIV = lTemp ; return lCipherblock ; } | internal routine to decrypt a block in CBC mode |
22,964 | public void setMethod ( String method ) { method = method . toLowerCase ( ) ; if ( method . equals ( "loop" ) ) this . method = MODE_LOOP ; else if ( method . equals ( "exittag" ) ) this . method = MODE_EXIT_TAG ; else if ( method . equals ( "exittemplate" ) ) this . method = MODE_EXIT_TEMPLATE ; } | set the value method |
22,965 | private boolean isOK ( TimeSpan timeSpan ) { return res . exists ( ) && ( res . lastModified ( ) + timeSpan . getMillis ( ) >= System . currentTimeMillis ( ) ) ; } | private String name raw ; |
22,966 | public Range registerString ( BytecodeContext bc , String str ) throws IOException { boolean append = true ; if ( staticTextLocation == null ) { if ( bc . getPageSource ( ) == null ) return null ; PageSource ps = bc . getPageSource ( ) ; Mapping m = ps . getMapping ( ) ; staticTextLocation = m . getClassRootDirectory ( ) ; staticTextLocation . mkdirs ( ) ; staticTextLocation = staticTextLocation . getRealResource ( ps . getClassName ( ) . replace ( '.' , '/' ) + ".txt" ) ; if ( staticTextLocation . exists ( ) ) append = false ; else staticTextLocation . createFile ( true ) ; off = 0 ; } IOUtil . write ( staticTextLocation , str , CharsetUtil . UTF8 , append ) ; Range r = new Range ( off , str . length ( ) ) ; off += str . length ( ) ; return r ; } | return null if not possible to register |
22,967 | private static boolean hasChangesOfChildren ( long last , PageContext pc , Class clazz ) { java . lang . reflect . Method [ ] methods = clazz . getMethods ( ) ; java . lang . reflect . Method method ; Class [ ] params ; for ( int i = 0 ; i < methods . length ; i ++ ) { method = methods [ i ] ; if ( method . getDeclaringClass ( ) == clazz ) { if ( _hasChangesOfChildren ( pc , last , method . getReturnType ( ) ) ) return true ; params = method . getParameterTypes ( ) ; for ( int y = 0 ; y < params . length ; y ++ ) { if ( _hasChangesOfChildren ( pc , last , params [ y ] ) ) return true ; } } } return false ; } | check if one of the children is changed |
22,968 | public static int toIntAccess ( String access ) throws ApplicationException { access = StringUtil . toLowerCase ( access . trim ( ) ) ; if ( access . equals ( "package" ) ) return Component . ACCESS_PACKAGE ; else if ( access . equals ( "private" ) ) return Component . ACCESS_PRIVATE ; else if ( access . equals ( "public" ) ) return Component . ACCESS_PUBLIC ; else if ( access . equals ( "remote" ) ) return Component . ACCESS_REMOTE ; throw new ApplicationException ( "invalid access type [" + access + "], access types are remote, public, package, private" ) ; } | cast a strong access definition to the int type |
22,969 | public static String toStringAccess ( int access ) throws ApplicationException { String res = toStringAccess ( access , null ) ; if ( res != null ) return res ; throw new ApplicationException ( "invalid access type [" + access + "], access types are Component.ACCESS_PACKAGE, Component.ACCESS_PRIVATE, Component.ACCESS_PUBLIC, Component.ACCESS_REMOTE" ) ; } | cast int type to string type |
22,970 | public void setAlign ( String align ) throws ApplicationException { align = StringUtil . toLowerCase ( align ) ; if ( align . equals ( "left" ) ) this . align = Table . ALIGN_LEFT ; else if ( align . equals ( "center" ) ) this . align = Table . ALIGN_CENTER ; else if ( align . equals ( "right" ) ) this . align = Table . ALIGN_RIGHT ; else throw new ApplicationException ( "value [" + align + "] of attribute align from tag col is invalid" , "valid values are [left, center, right]" ) ; } | set the value align Column alignment Left Right or Center . |
22,971 | public String serialize ( Object object , String clientVariableName ) throws ConverterException { StringBuilder sb = new StringBuilder ( ) ; _serialize ( clientVariableName , object , sb , new HashSet < Object > ( ) ) ; String str = sb . toString ( ) . trim ( ) ; return clientVariableName + "=" + str + ( StringUtil . endsWith ( str , ';' ) ? "" : ";" ) ; } | serialize a CFML object to a JavaScript Object |
22,972 | public static double call ( PageContext pc , double unit ) { if ( UNIT_NANO == unit ) return System . nanoTime ( ) ; if ( UNIT_MICRO == unit ) return System . nanoTime ( ) / 1000 ; if ( UNIT_MILLI == unit ) return System . currentTimeMillis ( ) ; return System . currentTimeMillis ( ) / 1000 ; } | this function is only called when the evaluator validates the unit definition on compilation time |
22,973 | public static Object indexOf ( String strPattern , String strInput , int offset , boolean caseSensitive , boolean matchAll ) throws MalformedPatternException { PatternMatcherInput input = new PatternMatcherInput ( strInput ) ; Perl5Matcher matcher = new Perl5Matcher ( ) ; int compileOptions = caseSensitive ? 0 : Perl5Compiler . CASE_INSENSITIVE_MASK ; compileOptions += Perl5Compiler . SINGLELINE_MASK ; if ( offset < 1 ) offset = 1 ; Pattern pattern = getPattern ( strPattern , compileOptions ) ; if ( offset <= strInput . length ( ) ) input . setCurrentOffset ( offset - 1 ) ; if ( offset <= strInput . length ( ) ) { Array matches = new ArrayImpl ( ) ; while ( matcher . contains ( input , pattern ) ) { int match = matcher . getMatch ( ) . beginOffset ( 0 ) + 1 ; if ( ! matchAll ) { return new Double ( match ) ; } matches . appendEL ( match ) ; } if ( matches . size ( ) != 0 ) { return matches ; } } return 0 ; } | return index of the first occurence of the pattern in input text |
22,974 | public static void deployWeb ( ConfigServer cs , ConfigWeb cw , boolean throwError ) throws IOException { Resource deploy = cs . getConfigDir ( ) . getRealResource ( "web-deployment" ) , trg ; if ( ! deploy . isDirectory ( ) ) return ; trg = cw . getRootDirectory ( ) ; try { _deploy ( cw , deploy , trg ) ; } catch ( IOException ioe ) { if ( throwError ) throw ioe ; SystemOut . printDate ( cw . getErrWriter ( ) , ExceptionUtil . getStacktrace ( ioe , true ) ) ; } } | deploys all content in web - deployment to a web context used for new context mostly or update existings |
22,975 | public static Resource getFile ( Config config , Resource directory , String path , short type ) { path = replacePlaceholder ( path , config ) ; if ( ! StringUtil . isEmpty ( path , true ) ) { Resource file = getFile ( directory . getRealResource ( path ) , type ) ; if ( file != null ) return file ; file = getFile ( config . getResource ( path ) , type ) ; if ( file != null ) return file ; } return null ; } | touch a file object by the string definition |
22,976 | static Resource getFile ( Resource rootDir , String strDir , String defaultDir , Resource configDir , short type , ConfigImpl config ) { strDir = replacePlaceholder ( strDir , config ) ; if ( ! StringUtil . isEmpty ( strDir , true ) ) { Resource res ; if ( strDir . indexOf ( "://" ) != - 1 ) { res = getFile ( config . getResource ( strDir ) , type ) ; if ( res != null ) return res ; } res = rootDir == null ? null : getFile ( rootDir . getRealResource ( strDir ) , type ) ; if ( res != null ) return res ; res = getFile ( config . getResource ( strDir ) , type ) ; if ( res != null ) return res ; } if ( defaultDir == null ) return null ; Resource file = getFile ( configDir . getRealResource ( defaultDir ) , type ) ; return file ; } | generate a file object by the string definition |
22,977 | public static Resource getExistingResource ( ServletContext sc , String strDir , String defaultDir , Resource configDir , short type , Config config ) { strDir = replacePlaceholder ( strDir , config ) ; if ( strDir != null && strDir . trim ( ) . length ( ) > 0 ) { Resource res = sc == null ? null : _getExistingFile ( config . getResource ( ResourceUtil . merge ( ReqRspUtil . getRootPath ( sc ) , strDir ) ) , type ) ; if ( res != null ) return res ; res = _getExistingFile ( config . getResource ( strDir ) , type ) ; if ( res != null ) return res ; } if ( defaultDir == null ) return null ; return _getExistingFile ( configDir . getRealResource ( defaultDir ) , type ) ; } | get only a existing file dont create it |
22,978 | public static boolean isFile ( Resource file ) { if ( file . exists ( ) ) return file . isFile ( ) ; Resource parent = file . getParentResource ( ) ; return parent . mkdirs ( ) && file . createNewFile ( ) ; } | checks if file is a file or not if file doesn t exist it will be created |
22,979 | public static boolean hasAccess ( Config config , int type ) { boolean has = true ; if ( config instanceof ConfigWeb ) { has = ( ( ConfigWeb ) config ) . getSecurityManager ( ) . getAccess ( type ) != SecurityManager . VALUE_NO ; } return has ; } | has access checks if config object has access to given type |
22,980 | public static String serialize ( Serializable o ) throws IOException { ByteArrayOutputStream baos = new ByteArrayOutputStream ( ) ; serialize ( o , baos ) ; return Base64Coder . encode ( baos . toByteArray ( ) ) ; } | serialize a Java Object of Type Serializable |
22,981 | public static Object deserialize ( String str ) throws IOException , ClassNotFoundException , CoderException { ByteArrayInputStream bais = new ByteArrayInputStream ( Base64Coder . decode ( str ) ) ; return deserialize ( bais ) ; } | unserialize a serialized Object |
22,982 | public static ComponentImpl loadComponent ( PageContext pc , Page page , String callPath , boolean isRealPath , boolean silent , boolean isExtendedComponent , boolean executeConstr ) throws PageException { CIPage cip = toCIPage ( page , callPath ) ; if ( silent ) { BodyContent bc = pc . pushBody ( ) ; try { return _loadComponent ( pc , cip , callPath , isRealPath , isExtendedComponent , executeConstr ) ; } finally { BodyContentUtil . clearAndPop ( pc , bc ) ; } } return _loadComponent ( pc , cip , callPath , isRealPath , isExtendedComponent , executeConstr ) ; } | do not change method is used in flex extension |
22,983 | public void setBufferConfig ( int bufferSize , boolean autoFlush ) throws IOException { this . bufferSize = bufferSize ; this . autoFlush = autoFlush ; _check ( ) ; } | reset configuration of buffer |
22,984 | public static ExprBoolean toExprBoolean ( Expression left , Expression right , int operation ) { return new OpDecision ( left , right , operation ) ; } | Create a String expression from a operation |
22,985 | public static BundleFile newInstance ( Resource res ) { try { BundleFile bf = new BundleFile ( res ) ; if ( bf . isBundle ( ) ) return bf ; } catch ( Throwable t ) { ExceptionUtil . rethrowIfNecessary ( t ) ; } return null ; } | only return a instance if the Resource is a valid bundle otherwise it returns null |
22,986 | private Page loadPhysical ( PageContext pc , Page page ) throws TemplateException { if ( ! mapping . hasPhysical ( ) ) return null ; ConfigWeb config = pc . getConfig ( ) ; PageContextImpl pci = ( PageContextImpl ) pc ; if ( ( mapping . getInspectTemplate ( ) == Config . INSPECT_NEVER || pci . isTrusted ( page ) ) && isLoad ( LOAD_PHYSICAL ) ) return page ; Resource srcFile = getPhyscalFile ( ) ; long srcLastModified = srcFile . lastModified ( ) ; if ( srcLastModified == 0L ) return null ; if ( page != null ) { if ( srcLastModified != page . getSourceLastModified ( ) ) { boolean same = false ; if ( page instanceof PagePro && ( ( PagePro ) page ) . getSourceLength ( ) == srcFile . length ( ) ) { PagePro pp = ( PagePro ) page ; try { same = pp . getHash ( ) == PageSourceCode . toString ( this , config . getTemplateCharset ( ) ) . hashCode ( ) ; } catch ( IOException e ) { } } if ( ! same ) { this . page = page = compile ( config , mapping . getClassRootDirectory ( ) , page , false , pc . ignoreScopes ( ) ) ; page . setPageSource ( this ) ; page . setLoadType ( LOAD_PHYSICAL ) ; } } } else { Resource classRootDir = mapping . getClassRootDirectory ( ) ; Resource classFile = classRootDir . getRealResource ( getJavaName ( ) + ".class" ) ; boolean isNew = false ; if ( flush || ! classFile . exists ( ) ) { this . page = page = compile ( config , classRootDir , null , false , pc . ignoreScopes ( ) ) ; flush = false ; isNew = true ; } else { try { this . page = page = newInstance ( mapping . getPhysicalClass ( this . getClassName ( ) ) ) ; } catch ( Throwable t ) { ExceptionUtil . rethrowIfNecessary ( t ) ; this . page = page = null ; } if ( page == null ) this . page = page = compile ( config , classRootDir , null , false , pc . ignoreScopes ( ) ) ; } if ( ! isNew && ( srcLastModified != page . getSourceLastModified ( ) || page . getVersion ( ) != pc . getConfig ( ) . getFactory ( ) . getEngine ( ) . getInfo ( ) . getFullVersionInfo ( ) ) ) { isNew = true ; this . page = page = compile ( config , classRootDir , page , false , pc . ignoreScopes ( ) ) ; } page . setPageSource ( this ) ; page . setLoadType ( LOAD_PHYSICAL ) ; } pci . setPageUsed ( page ) ; return page ; } | throws only an exception when compilation fails |
22,987 | public String getDisplayPath ( ) { if ( ! mapping . hasArchive ( ) ) { return StringUtil . toString ( getPhyscalFile ( ) , null ) ; } else if ( isLoad ( LOAD_PHYSICAL ) ) { return StringUtil . toString ( getPhyscalFile ( ) , null ) ; } else if ( isLoad ( LOAD_ARCHIVE ) ) { return StringUtil . toString ( getArchiveSourcePath ( ) , null ) ; } else { boolean pse = physcalExists ( ) ; boolean ase = archiveExists ( ) ; if ( mapping . isPhysicalFirst ( ) ) { if ( pse ) return getPhyscalFile ( ) . toString ( ) ; else if ( ase ) return getArchiveSourcePath ( ) ; return getPhyscalFile ( ) . toString ( ) ; } if ( ase ) return getArchiveSourcePath ( ) ; else if ( pse ) return getPhyscalFile ( ) . toString ( ) ; return getArchiveSourcePath ( ) ; } } | return source path as String |
22,988 | public Resource getPhyscalFile ( ) { if ( physcalSource == null ) { if ( ! mapping . hasPhysical ( ) ) { return null ; } Resource tmp = mapping . getPhysical ( ) . getRealResource ( relPath ) ; physcalSource = ResourceUtil . toExactResource ( tmp ) ; if ( ! tmp . getAbsolutePath ( ) . equals ( physcalSource . getAbsolutePath ( ) ) ) { String relpath = extractRealpath ( relPath , physcalSource . getAbsolutePath ( ) ) ; if ( relPath . equalsIgnoreCase ( relpath ) ) { this . relPath = relpath ; createClassAndPackage ( ) ; } } } return physcalSource ; } | return file object based on physical path and realpath |
22,989 | private static String mergeRealPathes ( Mapping mapping , String parentRealPath , String newRealPath , RefBoolean isOutSide ) { parentRealPath = pathRemoveLast ( parentRealPath , isOutSide ) ; while ( newRealPath . startsWith ( "../" ) ) { parentRealPath = pathRemoveLast ( parentRealPath , isOutSide ) ; newRealPath = newRealPath . substring ( 3 ) ; } String path = parentRealPath . concat ( "/" ) . concat ( newRealPath ) ; if ( path . startsWith ( "../" ) ) { int count = 0 ; do { count ++ ; path = path . substring ( 3 ) ; } while ( path . startsWith ( "../" ) ) ; String strRoot = mapping . getPhysical ( ) . getAbsolutePath ( ) . replace ( '\\' , '/' ) ; if ( ! StringUtil . endsWith ( strRoot , '/' ) ) { strRoot += '/' ; } int rootLen = strRoot . length ( ) ; String [ ] arr = ListUtil . toStringArray ( ListUtil . listToArray ( path , '/' ) , "" ) ; int tmpLen ; for ( int i = count ; i > 0 ; i -- ) { if ( arr . length > i ) { String tmp = '/' + list ( arr , 0 , i ) ; tmpLen = rootLen - tmp . length ( ) ; if ( strRoot . lastIndexOf ( tmp ) == tmpLen && tmpLen >= 0 ) { StringBuffer rtn = new StringBuffer ( ) ; while ( i < count - i ) { count -- ; rtn . append ( "../" ) ; } isOutSide . setValue ( rtn . length ( ) != 0 ) ; return ( rtn . length ( ) == 0 ? "/" : rtn . toString ( ) ) + list ( arr , i , arr . length ) ; } } } } return parentRealPath . concat ( "/" ) . concat ( newRealPath ) ; } | merge to realpath to one |
22,990 | private static String list ( String [ ] arr , int from , int len ) { StringBuffer sb = new StringBuffer ( ) ; for ( int i = from ; i < len ; i ++ ) { sb . append ( arr [ i ] ) ; if ( i + 1 != arr . length ) sb . append ( '/' ) ; } return sb . toString ( ) ; } | convert a String array to a string list but only part of it |
22,991 | private static String pathRemoveLast ( String path , RefBoolean isOutSide ) { if ( path . length ( ) == 0 ) { isOutSide . setValue ( true ) ; return ".." ; } else if ( path . endsWith ( ".." ) ) { isOutSide . setValue ( true ) ; return path . concat ( "/.." ) ; } return path . substring ( 0 , path . lastIndexOf ( '/' ) ) ; } | remove the last elemtn of a path |
22,992 | private InputStream getSourceAsInputStream ( ) throws IOException { if ( ! mapping . hasArchive ( ) ) return IOUtil . toBufferedInputStream ( getPhyscalFile ( ) . getInputStream ( ) ) ; else if ( isLoad ( LOAD_PHYSICAL ) ) return IOUtil . toBufferedInputStream ( getPhyscalFile ( ) . getInputStream ( ) ) ; else if ( isLoad ( LOAD_ARCHIVE ) ) { StringBuffer name = new StringBuffer ( _getPackageName ( ) . replace ( '.' , '/' ) ) ; if ( name . length ( ) > 0 ) name . append ( "/" ) ; name . append ( getFileName ( ) ) ; return mapping . getArchiveResourceAsStream ( name . toString ( ) ) ; } else { return null ; } } | return the inputstream of the source file |
22,993 | public void clear ( ClassLoader cl ) { Page page = this . page ; if ( page != null && page . getClass ( ) . getClassLoader ( ) . equals ( cl ) ) { this . page = null ; } } | clear page but only when page use the same classloader as provided |
22,994 | private static int toInterval ( String interval ) throws ScheduleException { interval = interval . trim ( ) . toLowerCase ( ) ; int i = Caster . toIntValue ( interval , 0 ) ; if ( i == 0 ) { interval = interval . trim ( ) ; if ( interval . equals ( "once" ) ) return INTERVAL_ONCE ; else if ( interval . equals ( "daily" ) ) return INTERVAL_DAY ; else if ( interval . equals ( "day" ) ) return INTERVAL_DAY ; else if ( interval . equals ( "monthly" ) ) return INTERVAL_MONTH ; else if ( interval . equals ( "month" ) ) return INTERVAL_MONTH ; else if ( interval . equals ( "weekly" ) ) return INTERVAL_WEEK ; else if ( interval . equals ( "week" ) ) return INTERVAL_WEEK ; throw new ScheduleException ( "invalid interval definition [" + interval + "], valid values are [once,daily,monthly,weekly or number]" ) ; } if ( i < 10 ) { throw new ScheduleException ( "interval must be at least 10" ) ; } return i ; } | translate a String interval definition to a int definition |
22,995 | private static URL toURL ( String url , int port ) throws MalformedURLException { URL u = HTTPUtil . toURL ( url , true ) ; if ( port == - 1 ) return u ; return new URL ( u . getProtocol ( ) , u . getHost ( ) , port , u . getFile ( ) ) ; } | translate a urlString and a port definition to a URL Object |
22,996 | public ResourceProvider init ( String scheme , Map arguments ) { if ( ! StringUtil . isEmpty ( scheme ) ) this . scheme = scheme ; if ( arguments != null ) { this . arguments = arguments ; Object oCaseSensitive = arguments . get ( "case-sensitive" ) ; if ( oCaseSensitive != null ) { caseSensitive = Caster . toBooleanValue ( oCaseSensitive , true ) ; } Object oTimeout = arguments . get ( "lock-timeout" ) ; if ( oTimeout != null ) { lockTimeout = Caster . toLongValue ( oTimeout , lockTimeout ) ; } } lock . setLockTimeout ( lockTimeout ) ; lock . setCaseSensitive ( caseSensitive ) ; root = new RamResourceCore ( null , RamResourceCore . TYPE_DIRECTORY , "" ) ; return this ; } | initialize ram resource |
22,997 | public static String toStringScope ( int scope , String defaultValue ) { switch ( scope ) { case Scope . SCOPE_APPLICATION : return "application" ; case Scope . SCOPE_ARGUMENTS : return "arguments" ; case Scope . SCOPE_CALLER : return "caller" ; case Scope . SCOPE_CGI : return "cgi" ; case Scope . SCOPE_CLIENT : return "client" ; case Scope . SCOPE_COOKIE : return "cookie" ; case Scope . SCOPE_FORM : return "form" ; case Scope . SCOPE_VAR : case Scope . SCOPE_LOCAL : return "local" ; case Scope . SCOPE_REQUEST : return "request" ; case Scope . SCOPE_SERVER : return "server" ; case Scope . SCOPE_SESSION : return "session" ; case Scope . SCOPE_UNDEFINED : return "undefined" ; case Scope . SCOPE_URL : return "url" ; case Scope . SCOPE_VARIABLES : return "variables" ; case Scope . SCOPE_CLUSTER : return "cluster" ; } return defaultValue ; } | cast a int scope definition to a string definition |
22,998 | public void release ( ) { this . base = null ; current = root ; current . body = null ; current . after = null ; current . before = null ; } | release the BodyContentStack |
22,999 | public BodyContent push ( ) { if ( current . after == null ) { current . after = new Entry ( current , new BodyContentImpl ( current . body == null ? ( JspWriter ) base : current . body ) ) ; } else { current . after . doDevNull = false ; current . after . body . init ( current . body == null ? ( JspWriter ) base : current . body ) ; } current = current . after ; return current . body ; } | push a new BodyContent to Stack |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.