idx
int64
0
41.2k
question
stringlengths
74
4.21k
target
stringlengths
5
888
23,000
public static int contrast ( Color left , Color right ) throws ServletException { return ( Math . max ( left . getRed ( ) , right . getRed ( ) ) - Math . min ( left . getRed ( ) , right . getRed ( ) ) ) + ( Math . max ( left . getGreen ( ) , right . getGreen ( ) ) - Math . min ( left . getGreen ( ) , right . getGreen (...
calculate the contrast between 2 colors
23,001
public void setAction ( String action ) throws ApplicationException { action = action . toLowerCase ( ) . trim ( ) ; if ( action . equals ( "getall" ) ) this . action = ACTION_GET_ALL ; else if ( action . equals ( "get" ) ) this . action = ACTION_GET ; else if ( action . equals ( "set" ) ) this . action = ACTION_SET ; ...
set the value action action to the registry
23,002
public static boolean operate ( PageContext pc , String [ ] varNames ) { int scope = VariableInterpreter . scopeString2Int ( pc . ignoreScopes ( ) , varNames [ 0 ] ) ; return _operate ( pc , scope , KeyImpl . toKeyArray ( varNames ) , scope == Scope . SCOPE_UNDEFINED ? 0 : 1 ) ; }
called by the Elvis operator from the interpreter
23,003
protected void setTldFile ( Resource fileTld , int dialect ) throws TagLibException { if ( dialect == CFMLEngine . DIALECT_BOTH ) { setTldFile ( fileTld , CFMLEngine . DIALECT_CFML ) ; setTldFile ( fileTld , CFMLEngine . DIALECT_LUCEE ) ; return ; } TagLib [ ] tlds = dialect == CFMLEngine . DIALECT_CFML ? cfmlTlds : lu...
set the optional directory of the tag library deskriptors
23,004
protected void setScheduler ( CFMLEngine engine , Resource scheduleDirectory ) throws PageException { if ( scheduleDirectory == null ) { if ( this . scheduler == null ) this . scheduler = new SchedulerImpl ( engine , "<?xml version=\"1.0\"?>\n<schedule></schedule>" , this ) ; return ; } if ( ! isDirectory ( scheduleDir...
sets the Schedule Directory
23,005
protected void setLocale ( String strLocale ) { if ( strLocale == null ) { this . locale = Locale . US ; } else { try { this . locale = Caster . toLocale ( strLocale ) ; if ( this . locale == null ) this . locale = Locale . US ; } catch ( ExpressionException e ) { this . locale = Locale . US ; } } }
sets the locale
23,006
protected boolean isDirectory ( Resource directory ) { if ( directory . exists ( ) ) return directory . isDirectory ( ) ; try { directory . createDirectory ( true ) ; return true ; } catch ( IOException e ) { e . printStackTrace ( getErrWriter ( ) ) ; } return false ; }
is file a directory or not touch if not exist
23,007
public Cache createRAMCache ( Struct arguments ) throws IOException { RamCache rc = new RamCache ( ) ; if ( arguments == null ) arguments = new StructImpl ( ) ; rc . init ( this , "" + CreateUniqueId . invoke ( ) , arguments ) ; return rc ; }
creates a new RamCache please make sure to finalize .
23,008
public static MapPro duplicateDataMember ( ComponentImpl c , MapPro map , MapPro newMap , boolean deepCopy ) { Iterator it = map . entrySet ( ) . iterator ( ) ; Map . Entry entry ; Object value ; while ( it . hasNext ( ) ) { entry = ( Entry ) it . next ( ) ; value = entry . getValue ( ) ; if ( ! ( value instanceof UDF ...
duplicate the datamember in the map ignores the udfs
23,009
public void init ( PageContext pageContext , ComponentPageImpl componentPage , boolean executeConstr ) throws PageException { this . pageSource = componentPage . getPageSource ( ) ; if ( ! StringUtil . isEmpty ( properties . extend ) ) { base = ComponentLoader . searchComponent ( pageContext , componentPage . getPageSo...
initalize the Component
23,010
public Variables beforeCall ( PageContext pc ) { Variables parent = pc . variablesScope ( ) ; pc . setVariablesScope ( scope ) ; return parent ; }
will be called before executing method or constructor
23,011
public Set < Key > keySet ( int access ) { Set < Key > set = new LinkedHashSet < Key > ( ) ; Map . Entry < Key , Member > entry ; Iterator < Entry < Key , Member > > it = _data . entrySet ( ) . iterator ( ) ; while ( it . hasNext ( ) ) { entry = it . next ( ) ; if ( entry . getValue ( ) . getAccess ( ) <= access ) set ...
list of keys
23,012
protected Member getMember ( PageContext pc , Collection . Key key , boolean dataMember , boolean superAccess ) { if ( dataMember && key . equalsIgnoreCase ( KeyConstants . _super ) && isPrivate ( pc ) ) { Component ac = ComponentUtil . getActiveComponent ( pc , this ) ; return SuperComponent . superMember ( ( Componen...
get entry matching key
23,013
private int getAccess ( Collection . Key key ) { Member member = getMember ( ACCESS_PRIVATE , key , false , false ) ; if ( member == null ) return Component . ACCESS_PRIVATE ; return member . getAccess ( ) ; }
return the access of a member
23,014
int getAccess ( PageContext pc ) { if ( pc == null ) return ACCESS_PUBLIC ; if ( isPrivate ( pc ) ) return ACCESS_PRIVATE ; if ( isPackage ( pc ) ) return ACCESS_PACKAGE ; return ACCESS_PUBLIC ; }
returns current access to this component
23,015
private Object _set ( PageContext pc , Collection . Key key , Object value ) throws ExpressionException { if ( value instanceof Member ) { Member m = ( Member ) value ; if ( m instanceof UDFPlus ) { UDFPlus udf = ( UDFPlus ) m ; if ( udf . getAccess ( ) > Component . ACCESS_PUBLIC ) udf . setAccess ( Component . ACCESS...
sets a value to the current Component dont to base Component
23,016
public void readExternal ( ObjectInput in ) throws IOException , ClassNotFoundException { boolean pcCreated = false ; PageContext pc = ThreadLocalPageContext . get ( ) ; try { if ( pc == null ) { pcCreated = true ; ConfigWeb config = ( ConfigWeb ) ThreadLocalPageContext . getConfig ( ) ; Pair [ ] parr = new Pair [ 0 ] ...
MUST more native impl
23,017
public void add ( TagLibTag libTag , Tag tag , FunctionLib [ ] flibs , SourceCode cfml ) { tags . add ( new TagData ( libTag , tag , flibs , cfml ) ) ; }
add a tag to the pool to evaluate at the end
23,018
public void run ( ) throws TemplateException { { Iterator < TagData > it = tags . iterator ( ) ; while ( it . hasNext ( ) ) { TagData td = it . next ( ) ; SourceCode cfml = td . cfml ; cfml . setPos ( td . pos ) ; try { if ( td . libTag . getEvaluator ( ) != null ) td . libTag . getEvaluator ( ) . evaluate ( td . tag ,...
Die Methode run wird aufgerufen sobald der CFML Transformer den uebersetzungsprozess angeschlossen hat . Die metode run rauft darauf alle Evaluatoren auf die intern gespeicher wurden und loescht den internen Speicher .
23,019
public static Object [ ] getValue ( PageContext pc , Ref [ ] refs ) throws PageException { Object [ ] objs = new Object [ refs . length ] ; for ( int i = 0 ; i < refs . length ; i ++ ) { objs [ i ] = refs [ i ] . getValue ( pc ) ; } return objs ; }
transalte a Ref array to a Object array
23,020
public static Bundle installBundle ( BundleContext context , Resource bundle , boolean checkExistence ) throws IOException , BundleException { if ( checkExistence ) { BundleFile bf = new BundleFile ( bundle ) ; if ( ! bf . isBundle ( ) ) throw new BundleException ( bundle + " is not a valid bundle!" ) ; Bundle existing...
only installs a bundle if the bundle does not already exist if the bundle exists the existing bundle is unloaded first .
23,021
private static Bundle _loadBundle ( BundleContext context , String path , InputStream is , boolean closeStream ) throws BundleException { log ( Log . LEVEL_INFO , "add bundle:" + path ) ; try { return context . installBundle ( path , is ) ; } finally { if ( closeStream && is != null ) { try { is . close ( ) ; } catch (...
does not check if the bundle already exists!
23,022
public static Bundle installBundle ( BundleContext context , InputStream bundleIS , boolean closeStream , boolean checkExistence ) throws IOException , BundleException { String name = System . currentTimeMillis ( ) + ".tmp" ; Resource dir = SystemUtil . getTempDirectory ( ) ; Resource tmp = dir . getRealResource ( name...
only installs a bundle if the bundle does not already exist if the bundle exists the existing bundle is unloaded first . the bundle is not stored physically on the system .
23,023
public static Class loadClass ( String className , Class defaultValue ) { className = className . trim ( ) ; CFMLEngine engine = CFMLEngineFactory . getInstance ( ) ; BundleCollection bc = engine . getBundleCollection ( ) ; try { return bc . core . loadClass ( className ) ; } catch ( Throwable t ) { ExceptionUtil . ret...
tries to load a class with ni bundle definition
23,024
public static void removeLocalBundle ( String name , Version version , boolean removePhysical , boolean doubleTap ) throws BundleException { name = name . trim ( ) ; CFMLEngine engine = CFMLEngineFactory . getInstance ( ) ; CFMLEngineFactory factory = engine . getCFMLEngineFactory ( ) ; BundleFile bf = _getBundleFile (...
get local bundle but does not download from update provider!
23,025
private void move ( Resource ext ) throws PageException { Resource trg ; Resource trgDir ; try { trg = getExtensionFile ( config , ext , id , name , version ) ; trgDir = trg . getParentResource ( ) ; trgDir . mkdirs ( ) ; if ( ! ext . getParentResource ( ) . equals ( trgDir ) ) { if ( trg . exists ( ) ) trg . delete ( ...
copy the file to extension dir if it is not already there
23,026
public void setData ( byte [ ] data , boolean append ) { lastModified = System . currentTimeMillis ( ) ; if ( append ) { if ( this . data != null && data != null ) { byte [ ] newData = new byte [ this . data . length + data . length ] ; int i = 0 ; for ( ; i < this . data . length ; i ++ ) { newData [ i ] = this . data...
Setzt den Feldnamen data .
23,027
public static void translate ( Struct sct ) { Iterator < Entry < Key , Object > > it = sct . entryIterator ( ) ; Entry < Key , Object > e ; Object value ; while ( it . hasNext ( ) ) { e = it . next ( ) ; value = e . getValue ( ) ; if ( value instanceof String ) { sct . setEL ( e . getKey ( ) , translate ( ( String ) va...
translate all strig values of the struct i script - protected form
23,028
public static String translate ( String str ) { if ( str == null ) return "" ; int index , last = 0 , endIndex ; StringBuilder sb = null ; String tagName ; while ( ( index = str . indexOf ( '<' , last ) ) != - 1 ) { int len = str . length ( ) ; char c ; for ( endIndex = index + 1 ; endIndex < len ; endIndex ++ ) { c = ...
translate string to script - protected form
23,029
public static String translateScriptProtect ( int scriptProtect ) { if ( scriptProtect == ApplicationContext . SCRIPT_PROTECT_NONE ) return "none" ; if ( scriptProtect == ApplicationContext . SCRIPT_PROTECT_ALL ) return "all" ; Array arr = new ArrayImpl ( ) ; if ( ( scriptProtect & ApplicationContext . SCRIPT_PROTECT_C...
translate int definition of script protect to string definition
23,030
public static int translateScriptProtect ( String strScriptProtect ) { strScriptProtect = strScriptProtect . toLowerCase ( ) . trim ( ) ; if ( "none" . equals ( strScriptProtect ) ) return ApplicationContext . SCRIPT_PROTECT_NONE ; if ( "no" . equals ( strScriptProtect ) ) return ApplicationContext . SCRIPT_PROTECT_NON...
translate string definition of script protect to int definition
23,031
private void callListeners ( final CFMLEngine engine ) { final Iterator < EngineChangeListener > it = listeners . iterator ( ) ; while ( it . hasNext ( ) ) it . next ( ) . onUpdate ( ) ; }
call all registered listener for update of the engine
23,032
public File getResourceRoot ( ) throws IOException { if ( resourceRoot == null ) { resourceRoot = new File ( _getResourceRoot ( ) , "lucee-server" ) ; if ( ! resourceRoot . exists ( ) ) resourceRoot . mkdirs ( ) ; } return resourceRoot ; }
return directory to lucee resource root
23,033
public static void addFunctionDoc ( PageExceptionImpl pe , FunctionLibFunction flf ) { ArrayList < FunctionLibFunctionArg > args = flf . getArg ( ) ; Iterator < FunctionLibFunctionArg > it = args . iterator ( ) ; StringBuilder pattern = new StringBuilder ( flf . getName ( ) ) ; StringBuilder end = new StringBuilder ( )...
add detailed function documentation to the exception
23,034
public long stop ( ) { if ( isRunning ) { long time = _time ( ) - start ; total += time ; count ++ ; isRunning = false ; return time ; } return 0 ; }
stops the watch
23,035
public void addArg ( FunctionLibFunctionArg arg ) { arg . setFunction ( this ) ; argument . add ( arg ) ; if ( arg . getDefaultValue ( ) != null ) hasDefaultValues = true ; }
Fuegt der Funktion ein Argument hinzu .
23,036
public void setFunctionClass ( String value , Identification id , Attributes attrs ) { functionCD = ClassDefinitionImpl . toClassDefinition ( value , id , attrs ) ; }
Setzt die Klassendefinition als Zeichenkette welche diese Funktion implementiert .
23,037
public static Text toText ( Document doc , Object o ) throws PageException { if ( o instanceof Text ) return ( Text ) o ; else if ( o instanceof CharacterData ) return doc . createTextNode ( ( ( CharacterData ) o ) . getData ( ) ) ; return doc . createTextNode ( Caster . toString ( o ) ) ; }
casts a value to a XML Text
23,038
public static Text [ ] toTextArray ( Document doc , Object o ) throws PageException { if ( o instanceof Node [ ] ) { Node [ ] nodes = ( Node [ ] ) o ; if ( _isAllOfSameType ( nodes , Node . TEXT_NODE ) ) return ( Text [ ] ) nodes ; Text [ ] textes = new Text [ nodes . length ] ; for ( int i = 0 ; i < nodes . length ; i...
casts a value to a XML Text Array
23,039
public static Attr toAttr ( Document doc , Object o ) throws PageException { if ( o instanceof Attr ) return ( Attr ) o ; if ( o instanceof Struct && ( ( Struct ) o ) . size ( ) == 1 ) { Struct sct = ( Struct ) o ; Entry < Key , Object > e = sct . entryIterator ( ) . next ( ) ; Attr attr = doc . createAttribute ( e . g...
casts a value to a XML Attribute Object
23,040
public static Attr [ ] toAttrArray ( Document doc , Object o ) throws PageException { if ( o instanceof Node [ ] ) { Node [ ] nodes = ( Node [ ] ) o ; if ( _isAllOfSameType ( nodes , Node . ATTRIBUTE_NODE ) ) return ( Attr [ ] ) nodes ; Attr [ ] attres = new Attr [ nodes . length ] ; for ( int i = 0 ; i < nodes . lengt...
casts a value to a XML Attr Array
23,041
public static Comment toComment ( Document doc , Object o ) throws PageException { if ( o instanceof Comment ) return ( Comment ) o ; else if ( o instanceof CharacterData ) return doc . createComment ( ( ( CharacterData ) o ) . getData ( ) ) ; return doc . createComment ( Caster . toString ( o ) ) ; }
casts a value to a XML Comment Object
23,042
public static Comment [ ] toCommentArray ( Document doc , Object o ) throws PageException { if ( o instanceof Node [ ] ) { Node [ ] nodes = ( Node [ ] ) o ; if ( _isAllOfSameType ( nodes , Node . COMMENT_NODE ) ) return ( Comment [ ] ) nodes ; Comment [ ] comments = new Comment [ nodes . length ] ; for ( int i = 0 ; i ...
casts a value to a XML Comment Array
23,043
public static Element toElement ( Document doc , Object o ) throws PageException { if ( o instanceof Element ) return ( Element ) o ; else if ( o instanceof Node ) throw new ExpressionException ( "Object " + Caster . toClassName ( o ) + " must be a XML Element" ) ; return doc . createElement ( Caster . toString ( o ) )...
casts a value to a XML Element
23,044
public static Node toNode ( Object o ) throws PageException { if ( o instanceof XMLStruct ) return ( ( XMLStruct ) o ) . toNode ( ) ; if ( o instanceof Node ) return ( Node ) o ; throw new CasterException ( o , "node" ) ; }
casts a value to a XML Node
23,045
public static Node toNode ( Document doc , Object o , short type ) throws PageException { if ( Node . TEXT_NODE == type ) toText ( doc , o ) ; else if ( Node . ATTRIBUTE_NODE == type ) toAttr ( doc , o ) ; else if ( Node . COMMENT_NODE == type ) toComment ( doc , o ) ; else if ( Node . ELEMENT_NODE == type ) toElement ...
casts a value to a XML Object defined by type parameter
23,046
public static Node [ ] toNodeArray ( Document doc , Object o , short type ) throws PageException { if ( Node . TEXT_NODE == type ) toTextArray ( doc , o ) ; else if ( Node . ATTRIBUTE_NODE == type ) toAttrArray ( doc , o ) ; else if ( Node . COMMENT_NODE == type ) toCommentArray ( doc , o ) ; else if ( Node . ELEMENT_N...
casts a value to a XML Object Array defined by type parameter
23,047
public static void writeTo ( Node node , Resource file ) throws PageException { OutputStream os = null ; try { os = IOUtil . toBufferedOutputStream ( file . getOutputStream ( ) ) ; writeTo ( node , new StreamResult ( os ) , false , false , null , null , null ) ; } catch ( IOException ioe ) { throw Caster . toPageExcept...
write a xml Dom to a file
23,048
private static Node [ ] _toNodeArray ( Document doc , Object o ) { if ( o instanceof Node ) return new Node [ ] { ( Node ) o } ; if ( o instanceof Node [ ] ) return ( ( Node [ ] ) o ) ; else if ( o instanceof NamedNodeMap ) { NamedNodeMap map = ( NamedNodeMap ) o ; int len = map . getLength ( ) ; Node [ ] nodes = new N...
casts a value to a XML named Node Map
23,049
private static boolean _isAllOfSameType ( Node [ ] nodes , short type ) { for ( int i = 0 ; i < nodes . length ; i ++ ) { if ( nodes [ i ] . getNodeType ( ) != type ) return false ; } return true ; }
Check if all Node are of the type defnined by para meter
23,050
public void setRequired ( String value ) { value = value . toLowerCase ( ) . trim ( ) ; required = ( value . equals ( "yes" ) || value . equals ( "true" ) ) ; }
Setzt ob das Argument Pflicht ist oder nicht .
23,051
public static Object invoke ( String name , Object [ ] args ) throws PageException { return invoke ( null , name , args ) ; }
used by genertaed bytecode
23,052
public static Blob toBlob ( Connection conn , Object value ) throws PageException , SQLException { if ( value instanceof Blob ) return ( Blob ) value ; if ( SystemUtil . JAVA_VERSION >= SystemUtil . JAVA_VERSION_6 ) { try { Blob blob = conn . createBlob ( ) ; blob . setBytes ( 1 , Caster . toBinary ( value ) ) ; return...
create a blog Object
23,053
public static Clob toClob ( Connection conn , Object value ) throws PageException , SQLException { if ( value instanceof Clob ) return ( Clob ) value ; if ( SystemUtil . JAVA_VERSION >= SystemUtil . JAVA_VERSION_6 ) { Clob clob = conn . createClob ( ) ; clob . setString ( 1 , Caster . toString ( value ) ) ; return clob...
create a clob Object
23,054
public DateTime toDateTime ( double days ) { long utc = Math . round ( days * DAY_MILLIS ) ; utc -= CF_UNIX_OFFSET ; utc -= getLocalTimeZoneOffset ( utc ) ; return new DateTimeImpl ( utc , false ) ; }
returns a date time instance by a number the conversion from the double to date is o the base of the CFML rules .
23,055
public static String toHTTPTimeString ( Date date , boolean oldFormat ) { if ( oldFormat ) { synchronized ( HTTP_TIME_STRING_FORMAT_OLD ) { return StringUtil . replace ( HTTP_TIME_STRING_FORMAT_OLD . format ( date ) , "+00:00" , "" , true ) ; } } synchronized ( HTTP_TIME_STRING_FORMAT ) { return StringUtil . replace ( ...
converts a date to a http time String
23,056
public static URL [ ] doURLs ( Resource [ ] reses ) throws IOException { List < URL > list = new ArrayList < URL > ( ) ; for ( int i = 0 ; i < reses . length ; i ++ ) { if ( reses [ i ] . isDirectory ( ) || "jar" . equalsIgnoreCase ( ResourceUtil . getExtension ( reses [ i ] , null ) ) ) list . add ( doURL ( reses [ i ...
translate resources to url Objects
23,057
private ScheduleTaskImpl [ ] readInAllTasks ( ) throws PageException { Element root = doc . getDocumentElement ( ) ; NodeList children = root . getChildNodes ( ) ; ArrayList < ScheduleTaskImpl > list = new ArrayList < ScheduleTaskImpl > ( ) ; int len = children . getLength ( ) ; for ( int i = 0 ; i < len ; i ++ ) { Nod...
read in all schedule tasks
23,058
private ScheduleTaskImpl readInTask ( Element el ) throws PageException { long timeout = su . toLong ( el , "timeout" ) ; if ( timeout > 0 && timeout < 1000 ) timeout *= 1000 ; if ( timeout < 0 ) timeout = 600000 ; try { ScheduleTaskImpl st = new ScheduleTaskImpl ( this , su . toString ( el , "name" ) . trim ( ) , su ....
read in a single task element
23,059
private void setAttributes ( Element el , ScheduleTask task ) { if ( el == null ) return ; NamedNodeMap atts = el . getAttributes ( ) ; for ( int i = atts . getLength ( ) - 1 ; i >= 0 ; i -- ) { Attr att = ( Attr ) atts . item ( i ) ; el . removeAttribute ( att . getName ( ) ) ; } su . setString ( el , "name" , task . ...
sets all attributes in XML Element from Schedule Task
23,060
private Element toElement ( ScheduleTask task ) { Element el = doc . createElement ( "task" ) ; setAttributes ( el , task ) ; return el ; }
translate a schedule task object to a XML Element
23,061
public void rollOver ( ) { Resource target ; Resource file ; if ( qw != null ) { long size = ( ( CountingQuietWriter ) qw ) . getCount ( ) ; LogLog . debug ( "rolling over count=" + size ) ; nextRollover = size + maxFileSize ; } LogLog . debug ( "maxBackupIndex=" + maxBackupIndex ) ; boolean renameSucceeded = true ; Re...
Implements the usual roll over behavior .
23,062
protected void subAppend ( LoggingEvent event ) { super . subAppend ( event ) ; if ( res != null && qw != null ) { long size = ( ( CountingQuietWriter ) qw ) . getCount ( ) ; if ( size >= maxFileSize && size >= nextRollover ) { rollOver ( ) ; } } }
This method differentiates RollingFileAppender from its super class .
23,063
public ErrorPage getErrorPage ( PageException pe , short type ) { for ( int i = pages . size ( ) - 1 ; i >= 0 ; i -- ) { ErrorPageImpl ep = ( ErrorPageImpl ) pages . get ( i ) ; if ( ep . getType ( ) == type ) { if ( type == ErrorPage . TYPE_EXCEPTION ) { if ( pe . typeEqual ( ep . getTypeAsString ( ) ) ) return ep ; }...
returns the error page
23,064
public void removeErrorPage ( PageException pe ) { ErrorPage ep = getErrorPage ( pe , ErrorPage . TYPE_EXCEPTION ) ; if ( ep != null ) { pages . remove ( ep ) ; hasChanged = true ; } ep = getErrorPage ( pe , ErrorPage . TYPE_REQUEST ) ; if ( ep != null ) { pages . remove ( ep ) ; hasChanged = true ; } ep = getErrorPage...
remove this error page
23,065
public static String escapeHTML ( String str , short version ) { String [ ] [ ] data ; int [ ] offset ; StringBuilder rtn = new StringBuilder ( str . length ( ) ) ; char [ ] chars = str . toCharArray ( ) ; if ( version == HTMLV20 ) { data = HTML20_DATA ; offset = HTML20_OFFSET ; } else if ( version == HTMLV32 ) { data ...
escapes html character inside a string
23,066
public static String unescapeHTML ( String str ) { StringBuilder rtn = new StringBuilder ( ) ; int posStart = - 1 ; int posFinish = - 1 ; while ( ( posStart = str . indexOf ( '&' , posStart ) ) != - 1 ) { int last = posFinish + 1 ; posFinish = str . indexOf ( ';' , posStart ) ; if ( posFinish == - 1 ) break ; rtn . app...
unescapes html character inside a string
23,067
public static Class [ ] getClasses ( Object [ ] objs ) { Class [ ] cls = new Class [ objs . length ] ; for ( int i = 0 ; i < objs . length ; i ++ ) { if ( objs [ i ] == null ) cls [ i ] = Object . class ; else cls [ i ] = objs [ i ] . getClass ( ) ; } return cls ; }
get all Classes from a Object Array
23,068
public static String getDspMethods ( Class ... clazzArgs ) { StringBuffer sb = new StringBuffer ( ) ; for ( int i = 0 ; i < clazzArgs . length ; i ++ ) { if ( i > 0 ) sb . append ( ", " ) ; sb . append ( Caster . toTypeName ( clazzArgs [ i ] ) ) ; } return sb . toString ( ) ; }
creates a string list with class arguments in a displable form
23,069
public static boolean like ( Class src , Class trg ) { if ( src == trg ) return true ; return isInstaneOf ( src , trg ) ; }
checks if src Class is like trg class
23,070
public static Object convert ( Object src , Class trgClass , RefInteger rating ) throws PageException { if ( rating != null ) { Object trg = _convert ( src , trgClass ) ; if ( src == trg ) { rating . plus ( 10 ) ; return trg ; } if ( src == null || trg == null ) { rating . plus ( 0 ) ; return trg ; } if ( isInstaneOf (...
convert Object from src to trg Type if possible
23,071
public static ConstructorInstance getConstructorInstance ( Class clazz , Object [ ] args ) throws NoSuchMethodException { ConstructorInstance ci = getConstructorInstance ( clazz , args , null ) ; if ( ci != null ) return ci ; throw new NoSuchMethodException ( "No matching Constructor for " + clazz . getName ( ) + "(" +...
gets Constructor Instance matching given parameter
23,072
public static Object callConstructor ( Class clazz , Object [ ] args ) throws PageException { args = cleanArgs ( args ) ; try { return getConstructorInstance ( clazz , args ) . invoke ( ) ; } catch ( InvocationTargetException e ) { Throwable target = e . getTargetException ( ) ; if ( target instanceof PageException ) t...
call constructor of a class with matching arguments
23,073
public static Object callMethod ( Object obj , String methodName , Object [ ] args ) throws PageException { return callMethod ( obj , KeyImpl . getInstance ( methodName ) , args ) ; }
calls a Method of a Objct
23,074
public static Object callStaticMethod ( Class clazz , String methodName , Object [ ] args ) throws PageException { try { return getMethodInstance ( null , clazz , methodName , args ) . invoke ( null ) ; } catch ( InvocationTargetException e ) { Throwable target = e . getTargetException ( ) ; if ( target instanceof Page...
calls a Static Method on the given CLass
23,075
public static void callSetterEL ( Object obj , String prop , Object value ) throws PageException { try { MethodInstance setter = getSetter ( obj , prop , value , null ) ; if ( setter != null ) setter . invoke ( obj ) ; } catch ( InvocationTargetException e ) { Throwable target = e . getTargetException ( ) ; if ( target...
do nothing when not exist
23,076
public static Object getField ( Object obj , String prop ) throws PageException { try { return getFieldsIgnoreCase ( obj . getClass ( ) , prop ) [ 0 ] . get ( obj ) ; } catch ( Throwable e ) { ExceptionUtil . rethrowIfNecessary ( e ) ; throw Caster . toPageException ( e ) ; } }
to get a visible Field of a object
23,077
public static boolean setField ( Object obj , String prop , Object value ) throws PageException { Class clazz = value . getClass ( ) ; try { Field [ ] fields = getFieldsIgnoreCase ( obj . getClass ( ) , prop ) ; for ( int i = 0 ; i < fields . length ; i ++ ) { if ( toReferenceClass ( fields [ i ] . getType ( ) ) == cla...
assign a value to a visible Field of a object
23,078
public static boolean canConvert ( Class from , Class to ) { if ( from == to ) return true ; if ( from == byte . class ) { return to == short . class || to == int . class || to == long . class || to == float . class || to == double . class ; } if ( from == short . class ) { return to == int . class || to == long . clas...
check if given class from can be converted to class to without explicit casting
23,079
public CatchBlock getCatchBlock ( Config config ) { String strSQL = sql == null ? "" : sql . toString ( ) ; if ( StringUtil . isEmpty ( strSQL ) ) strSQL = Caster . toString ( getAdditional ( ) . get ( "SQL" , "" ) , "" ) ; String datasourceName = datasource == null ? "" : datasource . getName ( ) ; if ( StringUtil . i...
Constructor of the class
23,080
public void start ( Resource xmlFile ) throws PageException { InputStream is = null ; try { XMLReader xmlReader = XMLUtil . createXMLReader ( ) ; xmlReader . setContentHandler ( this ) ; xmlReader . setErrorHandler ( this ) ; xmlReader . parse ( new InputSource ( is = IOUtil . toBufferedInputStream ( xmlFile . getInput...
start execution of the parser
23,081
private void call ( UDF udf , Object [ ] arguments ) { try { udf . call ( pc , arguments , false ) ; } catch ( PageException pe ) { error ( pe ) ; } }
call a user defined function
23,082
private void error ( PageException pe ) { if ( error == null ) throw new PageRuntimeException ( pe ) ; try { pc = ThreadLocalPageContext . get ( pc ) ; error . call ( pc , new Object [ ] { pe . getCatchBlock ( pc . getConfig ( ) ) } , false ) ; } catch ( PageException e ) { } }
call back error function if a error occour
23,083
private Struct toStruct ( Attributes att ) { int len = att . getLength ( ) ; Struct sct = new StructImpl ( ) ; for ( int i = 0 ; i < len ; i ++ ) { sct . setEL ( att . getQName ( i ) , att . getValue ( i ) ) ; } return sct ; }
cast a Attributes object to a Struct
23,084
public static Pair < String , String > [ ] cloneHeaders ( HttpServletRequest req ) { List < Pair < String , String > > headers = new ArrayList < Pair < String , String > > ( ) ; Enumeration < String > e = req . getHeaderNames ( ) , ee ; String name ; while ( e . hasMoreElements ( ) ) { name = e . nextElement ( ) ; ee =...
read all headers from request and return it
23,085
private static void loadExtensionBundles ( ConfigServerImpl cs , ConfigImpl config , Document doc , Log log ) { try { Element parent = getChildByName ( doc . getDocumentElement ( ) , "extensions" ) ; Element [ ] children = getChildren ( parent , "rhextension" ) ; String strBundles ; List < RHExtension > extensions = ne...
loads the bundles defined in the extensions
23,086
private static boolean toBoolean ( String value , boolean defaultValue ) { if ( value == null || value . trim ( ) . length ( ) == 0 ) return defaultValue ; try { return Caster . toBooleanValue ( value . trim ( ) ) ; } catch ( PageException e ) { return defaultValue ; } }
cast a string value to a boolean
23,087
public static String getAttr ( Element el , String name ) { String v = el . getAttribute ( name ) ; return replaceConfigPlaceHolder ( v ) ; }
reads an attribute from a xml Element and parses placeholders
23,088
public void setAction ( String strAction ) throws ApplicationException { strAction = strAction . toLowerCase ( ) ; if ( strAction . equals ( "move" ) || strAction . equals ( "rename" ) ) action = ACTION_MOVE ; else if ( strAction . equals ( "copy" ) ) action = ACTION_COPY ; else if ( strAction . equals ( "delete" ) ) a...
set the value action Type of file manipulation that the tag performs .
23,089
public void setCharset ( String charset ) { if ( StringUtil . isEmpty ( charset ) ) return ; this . charset = CharsetUtil . toCharSet ( charset . trim ( ) ) ; }
set the value charset Character set name for the file contents .
23,090
public static void actionMove ( PageContext pageContext , lucee . runtime . security . SecurityManager securityManager , Resource source , String strDestination , int nameconflict , String serverPassword , Object acl , int mode , String attributes ) throws PageException { if ( nameconflict == NAMECONFLICT_UNDEFINED ) n...
move source file to destination path or file
23,091
private void actionAppend ( ) throws PageException { if ( output == null ) throw new ApplicationException ( "attribute output is not defined for tag file" ) ; checkFile ( pageContext , securityManager , file , serverPassword , createPath , true , false , true ) ; setACL ( pageContext , file , acl ) ; try { if ( ! file ...
append data to source file
23,092
private static void checkContentType ( String contentType , String accept , String ext , boolean strict ) throws PageException { if ( ! StringUtil . isEmpty ( ext , true ) ) { ext = ext . trim ( ) . toLowerCase ( ) ; if ( ext . startsWith ( "*." ) ) ext = ext . substring ( 2 ) ; if ( ext . startsWith ( "." ) ) ext = ex...
check if the content type is permitted
23,093
private static FormItem getFormItem ( PageContext pageContext , String filefield ) throws PageException { if ( StringUtil . isEmpty ( filefield ) ) { FormItem [ ] items = getFormItems ( pageContext ) ; if ( ArrayUtil . isEmpty ( items ) ) throw new ApplicationException ( "no file send with this form" ) ; return items [...
rreturn fileItem matching to filefiled definition or throw a exception
23,094
private static String getFileName ( Resource file ) { String name = file . getName ( ) ; int pos = name . lastIndexOf ( "." ) ; if ( pos == - 1 ) return name ; return name . substring ( 0 , pos ) ; }
get file name of a file object without extension
23,095
private static void setAttributes ( Resource file , String attributes ) throws PageException { if ( ! SystemUtil . isWindows ( ) || StringUtil . isEmpty ( attributes ) ) return ; try { ResourceUtil . setAttribute ( file , attributes ) ; } catch ( IOException e ) { throw new ApplicationException ( "can't change attribut...
set attributes on file
23,096
private static void setMode ( Resource file , int mode ) throws ApplicationException { if ( mode == - 1 || SystemUtil . isWindows ( ) ) return ; try { file . setMode ( mode ) ; } catch ( IOException e ) { throw new ApplicationException ( "can't change mode of file " + file , e . getMessage ( ) ) ; } }
change mode of given file
23,097
private static Boolean methodExists ( Class clazz , String methodName , Type [ ] args , Type returnType ) { try { Class < ? > [ ] _args = new Class [ args . length ] ; for ( int i = 0 ; i < _args . length ; i ++ ) { _args [ i ] = Types . toClass ( args [ i ] ) ; } Class < ? > rtn = Types . toClass ( returnType ) ; try ...
checks if a method exists
23,098
private static NamedArgument [ ] toNamedArguments ( Argument [ ] args ) { NamedArgument [ ] nargs = new NamedArgument [ args . length ] ; for ( int i = 0 ; i < args . length ; i ++ ) { nargs [ i ] = ( NamedArgument ) args [ i ] ; } return nargs ; }
translate a array of arguments to a araay of NamedArguments attention no check if the elements are really named arguments
23,099
private static boolean isNamed ( String funcName , Argument [ ] args ) throws TransformerException { if ( ArrayUtil . isEmpty ( args ) ) return false ; boolean named = false ; for ( int i = 0 ; i < args . length ; i ++ ) { if ( args [ i ] instanceof NamedArgument ) named = true ; else if ( named ) throw new Transformer...
check if the arguments are named arguments or regular arguments throws a exception when mixed