id
int32
0
165k
repo
stringlengths
7
58
path
stringlengths
12
218
func_name
stringlengths
3
140
original_string
stringlengths
73
34.1k
language
stringclasses
1 value
code
stringlengths
73
34.1k
code_tokens
list
docstring
stringlengths
3
16k
docstring_tokens
list
sha
stringlengths
40
40
url
stringlengths
105
339
30,400
lucee/Lucee
core/src/main/java/lucee/runtime/schedule/ScheduleTaskImpl.java
ScheduleTaskImpl.toURL
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()); }
java
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()); }
[ "private", "static", "URL", "toURL", "(", "String", "url", ",", "int", "port", ")", "throws", "MalformedURLException", "{", "URL", "u", "=", "HTTPUtil", ".", "toURL", "(", "url", ",", "true", ")", ";", "if", "(", "port", "==", "-", "1", ")", "return"...
translate a urlString and a port definition to a URL Object @param url URL String @param port URL Port Definition @return returns a URL Object @throws MalformedURLException
[ "translate", "a", "urlString", "and", "a", "port", "definition", "to", "a", "URL", "Object" ]
29b153fc4e126e5edb97da937f2ee2e231b87593
https://github.com/lucee/Lucee/blob/29b153fc4e126e5edb97da937f2ee2e231b87593/core/src/main/java/lucee/runtime/schedule/ScheduleTaskImpl.java#L169-L173
30,401
lucee/Lucee
core/src/main/java/lucee/commons/io/res/type/ram/RamResourceProviderOld.java
RamResourceProviderOld.init
@Override 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); } // lock-timeout 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; }
java
@Override 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); } // lock-timeout 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; }
[ "@", "Override", "public", "ResourceProvider", "init", "(", "String", "scheme", ",", "Map", "arguments", ")", "{", "if", "(", "!", "StringUtil", ".", "isEmpty", "(", "scheme", ")", ")", "this", ".", "scheme", "=", "scheme", ";", "if", "(", "arguments", ...
initialize ram resource @param scheme @param arguments @return RamResource
[ "initialize", "ram", "resource" ]
29b153fc4e126e5edb97da937f2ee2e231b87593
https://github.com/lucee/Lucee/blob/29b153fc4e126e5edb97da937f2ee2e231b87593/core/src/main/java/lucee/commons/io/res/type/ram/RamResourceProviderOld.java#L55-L77
30,402
lucee/Lucee
core/src/main/java/lucee/runtime/type/scope/ScopeFactory.java
ScopeFactory.toStringScope
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; }
java
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; }
[ "public", "static", "String", "toStringScope", "(", "int", "scope", ",", "String", "defaultValue", ")", "{", "switch", "(", "scope", ")", "{", "case", "Scope", ".", "SCOPE_APPLICATION", ":", "return", "\"application\"", ";", "case", "Scope", ".", "SCOPE_ARGUME...
cast a int scope definition to a string definition @param scope @return
[ "cast", "a", "int", "scope", "definition", "to", "a", "string", "definition" ]
29b153fc4e126e5edb97da937f2ee2e231b87593
https://github.com/lucee/Lucee/blob/29b153fc4e126e5edb97da937f2ee2e231b87593/core/src/main/java/lucee/runtime/type/scope/ScopeFactory.java#L82-L118
30,403
lucee/Lucee
core/src/main/java/lucee/commons/io/BodyContentStack.java
BodyContentStack.release
public void release() { this.base = null; current = root; current.body = null; current.after = null; current.before = null; }
java
public void release() { this.base = null; current = root; current.body = null; current.after = null; current.before = null; }
[ "public", "void", "release", "(", ")", "{", "this", ".", "base", "=", "null", ";", "current", "=", "root", ";", "current", ".", "body", "=", "null", ";", "current", ".", "after", "=", "null", ";", "current", ".", "before", "=", "null", ";", "}" ]
release the BodyContentStack
[ "release", "the", "BodyContentStack" ]
29b153fc4e126e5edb97da937f2ee2e231b87593
https://github.com/lucee/Lucee/blob/29b153fc4e126e5edb97da937f2ee2e231b87593/core/src/main/java/lucee/commons/io/BodyContentStack.java#L59-L65
30,404
lucee/Lucee
core/src/main/java/lucee/commons/io/BodyContentStack.java
BodyContentStack.push
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; }
java
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; }
[ "public", "BodyContent", "push", "(", ")", "{", "if", "(", "current", ".", "after", "==", "null", ")", "{", "current", ".", "after", "=", "new", "Entry", "(", "current", ",", "new", "BodyContentImpl", "(", "current", ".", "body", "==", "null", "?", "...
push a new BodyContent to Stack @return new BodyContent
[ "push", "a", "new", "BodyContent", "to", "Stack" ]
29b153fc4e126e5edb97da937f2ee2e231b87593
https://github.com/lucee/Lucee/blob/29b153fc4e126e5edb97da937f2ee2e231b87593/core/src/main/java/lucee/commons/io/BodyContentStack.java#L72-L82
30,405
lucee/Lucee
core/src/main/java/lucee/commons/color/ColorCaster.java
ColorCaster.contrast
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())) + (Math.max(left.getBlue(), right.getBlue()) - Math.max(left.getBlue(), right.getBlue())); }
java
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())) + (Math.max(left.getBlue(), right.getBlue()) - Math.max(left.getBlue(), right.getBlue())); }
[ "public", "static", "int", "contrast", "(", "Color", "left", ",", "Color", "right", ")", "throws", "ServletException", "{", "return", "(", "Math", ".", "max", "(", "left", ".", "getRed", "(", ")", ",", "right", ".", "getRed", "(", ")", ")", "-", "Mat...
calculate the contrast between 2 colors @param left @param right @return a int between 0 (badest) and 510 (best) @throws ServletException
[ "calculate", "the", "contrast", "between", "2", "colors" ]
29b153fc4e126e5edb97da937f2ee2e231b87593
https://github.com/lucee/Lucee/blob/29b153fc4e126e5edb97da937f2ee2e231b87593/core/src/main/java/lucee/commons/color/ColorCaster.java#L41-L45
30,406
lucee/Lucee
core/src/main/java/lucee/runtime/tag/Registry.java
Registry.setAction
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; else if (action.equals("delete")) this.action = ACTION_DELETE; else throw new ApplicationException("attribute action of the tag registry has an invalid value [" + action + "], valid values are [getAll, get, set, delete]"); }
java
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; else if (action.equals("delete")) this.action = ACTION_DELETE; else throw new ApplicationException("attribute action of the tag registry has an invalid value [" + action + "], valid values are [getAll, get, set, delete]"); }
[ "public", "void", "setAction", "(", "String", "action", ")", "throws", "ApplicationException", "{", "action", "=", "action", ".", "toLowerCase", "(", ")", ".", "trim", "(", ")", ";", "if", "(", "action", ".", "equals", "(", "\"getall\"", ")", ")", "this"...
set the value action action to the registry @param action value to set @throws ApplicationException
[ "set", "the", "value", "action", "action", "to", "the", "registry" ]
29b153fc4e126e5edb97da937f2ee2e231b87593
https://github.com/lucee/Lucee/blob/29b153fc4e126e5edb97da937f2ee2e231b87593/core/src/main/java/lucee/runtime/tag/Registry.java#L115-L122
30,407
lucee/Lucee
core/src/main/java/lucee/runtime/op/Elvis.java
Elvis.operate
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); }
java
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); }
[ "public", "static", "boolean", "operate", "(", "PageContext", "pc", ",", "String", "[", "]", "varNames", ")", "{", "int", "scope", "=", "VariableInterpreter", ".", "scopeString2Int", "(", "pc", ".", "ignoreScopes", "(", ")", ",", "varNames", "[", "0", "]",...
called by the Elvis operator from the interpreter @param pc @param scope @param varNames @return
[ "called", "by", "the", "Elvis", "operator", "from", "the", "interpreter" ]
29b153fc4e126e5edb97da937f2ee2e231b87593
https://github.com/lucee/Lucee/blob/29b153fc4e126e5edb97da937f2ee2e231b87593/core/src/main/java/lucee/runtime/op/Elvis.java#L63-L66
30,408
lucee/Lucee
core/src/main/java/lucee/runtime/config/ConfigImpl.java
ConfigImpl.setTldFile
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 : luceeTlds; if (fileTld == null) return; this.tldFile = fileTld; String key; Map<String, TagLib> map = new HashMap<String, TagLib>(); // First fill existing to set for (int i = 0; i < tlds.length; i++) { key = getKey(tlds[i]); map.put(key, tlds[i]); } TagLib tl; // now overwrite with new data if (fileTld.isDirectory()) { Resource[] files = fileTld.listResources(new ExtensionResourceFilter(new String[] { "tld", "tldx" })); for (int i = 0; i < files.length; i++) { try { tl = TagLibFactory.loadFromFile(files[i], getIdentification()); key = getKey(tl); if (!map.containsKey(key)) map.put(key, tl); else overwrite(map.get(key), tl); } catch (TagLibException tle) { SystemOut.printDate(out, "can't load tld " + files[i]); tle.printStackTrace(getErrWriter()); } } } else if (fileTld.isFile()) { tl = TagLibFactory.loadFromFile(fileTld, getIdentification()); key = getKey(tl); if (!map.containsKey(key)) map.put(key, tl); else overwrite(map.get(key), tl); } // now fill back to array tlds = new TagLib[map.size()]; if (dialect == CFMLEngine.DIALECT_CFML) cfmlTlds = tlds; else luceeTlds = tlds; int index = 0; Iterator<TagLib> it = map.values().iterator(); while (it.hasNext()) { tlds[index++] = it.next(); } }
java
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 : luceeTlds; if (fileTld == null) return; this.tldFile = fileTld; String key; Map<String, TagLib> map = new HashMap<String, TagLib>(); // First fill existing to set for (int i = 0; i < tlds.length; i++) { key = getKey(tlds[i]); map.put(key, tlds[i]); } TagLib tl; // now overwrite with new data if (fileTld.isDirectory()) { Resource[] files = fileTld.listResources(new ExtensionResourceFilter(new String[] { "tld", "tldx" })); for (int i = 0; i < files.length; i++) { try { tl = TagLibFactory.loadFromFile(files[i], getIdentification()); key = getKey(tl); if (!map.containsKey(key)) map.put(key, tl); else overwrite(map.get(key), tl); } catch (TagLibException tle) { SystemOut.printDate(out, "can't load tld " + files[i]); tle.printStackTrace(getErrWriter()); } } } else if (fileTld.isFile()) { tl = TagLibFactory.loadFromFile(fileTld, getIdentification()); key = getKey(tl); if (!map.containsKey(key)) map.put(key, tl); else overwrite(map.get(key), tl); } // now fill back to array tlds = new TagLib[map.size()]; if (dialect == CFMLEngine.DIALECT_CFML) cfmlTlds = tlds; else luceeTlds = tlds; int index = 0; Iterator<TagLib> it = map.values().iterator(); while (it.hasNext()) { tlds[index++] = it.next(); } }
[ "protected", "void", "setTldFile", "(", "Resource", "fileTld", ",", "int", "dialect", ")", "throws", "TagLibException", "{", "if", "(", "dialect", "==", "CFMLEngine", ".", "DIALECT_BOTH", ")", "{", "setTldFile", "(", "fileTld", ",", "CFMLEngine", ".", "DIALECT...
set the optional directory of the tag library deskriptors @param fileTld directory of the tag libray deskriptors @throws TagLibException
[ "set", "the", "optional", "directory", "of", "the", "tag", "library", "deskriptors" ]
29b153fc4e126e5edb97da937f2ee2e231b87593
https://github.com/lucee/Lucee/blob/29b153fc4e126e5edb97da937f2ee2e231b87593/core/src/main/java/lucee/runtime/config/ConfigImpl.java#L1154-L1209
30,409
lucee/Lucee
core/src/main/java/lucee/runtime/config/ConfigImpl.java
ConfigImpl.setScheduler
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(scheduleDirectory)) throw new ExpressionException("schedule task directory " + scheduleDirectory + " doesn't exist or is not a directory"); try { if (this.scheduler == null) this.scheduler = new SchedulerImpl(engine, this, scheduleDirectory, SystemUtil.getCharset().name()); } catch (Exception e) { throw Caster.toPageException(e); } }
java
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(scheduleDirectory)) throw new ExpressionException("schedule task directory " + scheduleDirectory + " doesn't exist or is not a directory"); try { if (this.scheduler == null) this.scheduler = new SchedulerImpl(engine, this, scheduleDirectory, SystemUtil.getCharset().name()); } catch (Exception e) { throw Caster.toPageException(e); } }
[ "protected", "void", "setScheduler", "(", "CFMLEngine", "engine", ",", "Resource", "scheduleDirectory", ")", "throws", "PageException", "{", "if", "(", "scheduleDirectory", "==", "null", ")", "{", "if", "(", "this", ".", "scheduler", "==", "null", ")", "this",...
sets the Schedule Directory @param scheduleDirectory sets the schedule Directory @param logger @throws PageException
[ "sets", "the", "Schedule", "Directory" ]
29b153fc4e126e5edb97da937f2ee2e231b87593
https://github.com/lucee/Lucee/blob/29b153fc4e126e5edb97da937f2ee2e231b87593/core/src/main/java/lucee/runtime/config/ConfigImpl.java#L1654-L1667
30,410
lucee/Lucee
core/src/main/java/lucee/runtime/config/ConfigImpl.java
ConfigImpl.setLocale
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; } } }
java
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; } } }
[ "protected", "void", "setLocale", "(", "String", "strLocale", ")", "{", "if", "(", "strLocale", "==", "null", ")", "{", "this", ".", "locale", "=", "Locale", ".", "US", ";", "}", "else", "{", "try", "{", "this", ".", "locale", "=", "Caster", ".", "...
sets the locale @param strLocale
[ "sets", "the", "locale" ]
29b153fc4e126e5edb97da937f2ee2e231b87593
https://github.com/lucee/Lucee/blob/29b153fc4e126e5edb97da937f2ee2e231b87593/core/src/main/java/lucee/runtime/config/ConfigImpl.java#L1699-L1712
30,411
lucee/Lucee
core/src/main/java/lucee/runtime/config/ConfigImpl.java
ConfigImpl.isDirectory
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; }
java
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; }
[ "protected", "boolean", "isDirectory", "(", "Resource", "directory", ")", "{", "if", "(", "directory", ".", "exists", "(", ")", ")", "return", "directory", ".", "isDirectory", "(", ")", ";", "try", "{", "directory", ".", "createDirectory", "(", "true", ")"...
is file a directory or not, touch if not exist @param directory @return true if existing directory or has created new one
[ "is", "file", "a", "directory", "or", "not", "touch", "if", "not", "exist" ]
29b153fc4e126e5edb97da937f2ee2e231b87593
https://github.com/lucee/Lucee/blob/29b153fc4e126e5edb97da937f2ee2e231b87593/core/src/main/java/lucee/runtime/config/ConfigImpl.java#L1762-L1772
30,412
lucee/Lucee
core/src/main/java/lucee/runtime/config/ConfigImpl.java
ConfigImpl.createRAMCache
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; }
java
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; }
[ "public", "Cache", "createRAMCache", "(", "Struct", "arguments", ")", "throws", "IOException", "{", "RamCache", "rc", "=", "new", "RamCache", "(", ")", ";", "if", "(", "arguments", "==", "null", ")", "arguments", "=", "new", "StructImpl", "(", ")", ";", ...
creates a new RamCache, please make sure to finalize. @param arguments possible arguments are "timeToLiveSeconds", "timeToIdleSeconds" and "controlInterval" @throws IOException
[ "creates", "a", "new", "RamCache", "please", "make", "sure", "to", "finalize", "." ]
29b153fc4e126e5edb97da937f2ee2e231b87593
https://github.com/lucee/Lucee/blob/29b153fc4e126e5edb97da937f2ee2e231b87593/core/src/main/java/lucee/runtime/config/ConfigImpl.java#L2994-L2999
30,413
lucee/Lucee
core/src/main/java/lucee/runtime/ComponentImpl.java
ComponentImpl.duplicateDataMember
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)) { if (deepCopy) value = Duplicator.duplicate(value, deepCopy); newMap.put(entry.getKey(), value); } } return newMap; }
java
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)) { if (deepCopy) value = Duplicator.duplicate(value, deepCopy); newMap.put(entry.getKey(), value); } } return newMap; }
[ "public", "static", "MapPro", "duplicateDataMember", "(", "ComponentImpl", "c", ",", "MapPro", "map", ",", "MapPro", "newMap", ",", "boolean", "deepCopy", ")", "{", "Iterator", "it", "=", "map", ".", "entrySet", "(", ")", ".", "iterator", "(", ")", ";", ...
duplicate the datamember in the map, ignores the udfs @param c @param map @param newMap @param deepCopy @return
[ "duplicate", "the", "datamember", "in", "the", "map", "ignores", "the", "udfs" ]
29b153fc4e126e5edb97da937f2ee2e231b87593
https://github.com/lucee/Lucee/blob/29b153fc4e126e5edb97da937f2ee2e231b87593/core/src/main/java/lucee/runtime/ComponentImpl.java#L326-L340
30,414
lucee/Lucee
core/src/main/java/lucee/runtime/ComponentImpl.java
ComponentImpl.init
public void init(PageContext pageContext, ComponentPageImpl componentPage, boolean executeConstr) throws PageException { this.pageSource = componentPage.getPageSource(); // extends if (!StringUtil.isEmpty(properties.extend)) { base = ComponentLoader.searchComponent(pageContext, componentPage.getPageSource(), properties.extend, Boolean.TRUE, null, true, executeConstr); } else { CIPage p = ((ConfigWebImpl) pageContext.getConfig()).getBaseComponentPage(pageSource.getDialect(), pageContext); if (!componentPage.getPageSource().equals(p.getPageSource())) { base = ComponentLoader.loadComponent(pageContext, p, "Component", false, false, true, executeConstr); } } if (base != null) { this.dataMemberDefaultAccess = base.dataMemberDefaultAccess; this._static = new StaticScope(base._static, this, componentPage, dataMemberDefaultAccess); // this._triggerDataMember=base._triggerDataMember; this.absFin = base.absFin; _data = base._data; _udfs = new HashMapPro<Key, UDF>(base._udfs); setTop(this, base); } else { this.dataMemberDefaultAccess = pageContext.getCurrentTemplateDialect() == CFMLEngine.DIALECT_CFML ? pageContext.getConfig().getComponentDataMemberDefaultAccess() : Component.ACCESS_PRIVATE; this._static = new StaticScope(null, this, componentPage, dataMemberDefaultAccess); // TODO get per CFC setting // this._triggerDataMember=pageContext.getConfig().getTriggerComponentDataMember(); _udfs = new HashMapPro<Key, UDF>(); _data = MapFactory.getConcurrentMap(); } // implements if (!StringUtil.isEmpty(properties.implement)) { if (absFin == null) absFin = new AbstractFinal(); absFin.add(InterfaceImpl.loadInterfaces(pageContext, getPageSource(), properties.implement)); // abstrCollection.implement(pageContext,getPageSource(),properties.implement); } /* * print.e("--------------------------------------"); print.e(_getPageSource().getDisplayPath()); * print.e(abstrCollection.getUdfs()); */ // scope useShadow = base == null ? (pageSource.getDialect() == CFMLEngine.DIALECT_CFML ? pageContext.getConfig().useComponentShadow() : false) : base.useShadow; if (useShadow) { if (base == null) scope = new ComponentScopeShadow(this, MapFactory.getConcurrentMap()); else scope = new ComponentScopeShadow(this, (ComponentScopeShadow) base.scope, false); } else { scope = new ComponentScopeThis(this); } initProperties(); // invoke static constructor if (!componentPage._static.isInit()) { componentPage._static.setInit(true);// this needs to happen before the call try { componentPage.staticConstructor(pageContext, this); } catch (Throwable t) { ExceptionUtil.rethrowIfNecessary(t); componentPage._static.setInit(false); throw Caster.toPageException(t); } } }
java
public void init(PageContext pageContext, ComponentPageImpl componentPage, boolean executeConstr) throws PageException { this.pageSource = componentPage.getPageSource(); // extends if (!StringUtil.isEmpty(properties.extend)) { base = ComponentLoader.searchComponent(pageContext, componentPage.getPageSource(), properties.extend, Boolean.TRUE, null, true, executeConstr); } else { CIPage p = ((ConfigWebImpl) pageContext.getConfig()).getBaseComponentPage(pageSource.getDialect(), pageContext); if (!componentPage.getPageSource().equals(p.getPageSource())) { base = ComponentLoader.loadComponent(pageContext, p, "Component", false, false, true, executeConstr); } } if (base != null) { this.dataMemberDefaultAccess = base.dataMemberDefaultAccess; this._static = new StaticScope(base._static, this, componentPage, dataMemberDefaultAccess); // this._triggerDataMember=base._triggerDataMember; this.absFin = base.absFin; _data = base._data; _udfs = new HashMapPro<Key, UDF>(base._udfs); setTop(this, base); } else { this.dataMemberDefaultAccess = pageContext.getCurrentTemplateDialect() == CFMLEngine.DIALECT_CFML ? pageContext.getConfig().getComponentDataMemberDefaultAccess() : Component.ACCESS_PRIVATE; this._static = new StaticScope(null, this, componentPage, dataMemberDefaultAccess); // TODO get per CFC setting // this._triggerDataMember=pageContext.getConfig().getTriggerComponentDataMember(); _udfs = new HashMapPro<Key, UDF>(); _data = MapFactory.getConcurrentMap(); } // implements if (!StringUtil.isEmpty(properties.implement)) { if (absFin == null) absFin = new AbstractFinal(); absFin.add(InterfaceImpl.loadInterfaces(pageContext, getPageSource(), properties.implement)); // abstrCollection.implement(pageContext,getPageSource(),properties.implement); } /* * print.e("--------------------------------------"); print.e(_getPageSource().getDisplayPath()); * print.e(abstrCollection.getUdfs()); */ // scope useShadow = base == null ? (pageSource.getDialect() == CFMLEngine.DIALECT_CFML ? pageContext.getConfig().useComponentShadow() : false) : base.useShadow; if (useShadow) { if (base == null) scope = new ComponentScopeShadow(this, MapFactory.getConcurrentMap()); else scope = new ComponentScopeShadow(this, (ComponentScopeShadow) base.scope, false); } else { scope = new ComponentScopeThis(this); } initProperties(); // invoke static constructor if (!componentPage._static.isInit()) { componentPage._static.setInit(true);// this needs to happen before the call try { componentPage.staticConstructor(pageContext, this); } catch (Throwable t) { ExceptionUtil.rethrowIfNecessary(t); componentPage._static.setInit(false); throw Caster.toPageException(t); } } }
[ "public", "void", "init", "(", "PageContext", "pageContext", ",", "ComponentPageImpl", "componentPage", ",", "boolean", "executeConstr", ")", "throws", "PageException", "{", "this", ".", "pageSource", "=", "componentPage", ".", "getPageSource", "(", ")", ";", "// ...
initalize the Component @param pageContext @param componentPage @throws PageException
[ "initalize", "the", "Component" ]
29b153fc4e126e5edb97da937f2ee2e231b87593
https://github.com/lucee/Lucee/blob/29b153fc4e126e5edb97da937f2ee2e231b87593/core/src/main/java/lucee/runtime/ComponentImpl.java#L368-L435
30,415
lucee/Lucee
core/src/main/java/lucee/runtime/ComponentImpl.java
ComponentImpl.beforeCall
public Variables beforeCall(PageContext pc) { Variables parent = pc.variablesScope(); pc.setVariablesScope(scope); return parent; }
java
public Variables beforeCall(PageContext pc) { Variables parent = pc.variablesScope(); pc.setVariablesScope(scope); return parent; }
[ "public", "Variables", "beforeCall", "(", "PageContext", "pc", ")", "{", "Variables", "parent", "=", "pc", ".", "variablesScope", "(", ")", ";", "pc", ".", "setVariablesScope", "(", "scope", ")", ";", "return", "parent", ";", "}" ]
will be called before executing method or constructor @param pc @return the old scope map
[ "will", "be", "called", "before", "executing", "method", "or", "constructor" ]
29b153fc4e126e5edb97da937f2ee2e231b87593
https://github.com/lucee/Lucee/blob/29b153fc4e126e5edb97da937f2ee2e231b87593/core/src/main/java/lucee/runtime/ComponentImpl.java#L709-L713
30,416
lucee/Lucee
core/src/main/java/lucee/runtime/ComponentImpl.java
ComponentImpl.keySet
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.add(entry.getKey()); } return set; }
java
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.add(entry.getKey()); } return set; }
[ "public", "Set", "<", "Key", ">", "keySet", "(", "int", "access", ")", "{", "Set", "<", "Key", ">", "set", "=", "new", "LinkedHashSet", "<", "Key", ">", "(", ")", ";", "Map", ".", "Entry", "<", "Key", ",", "Member", ">", "entry", ";", "Iterator",...
list of keys @param c @param access @param doBase @return key set
[ "list", "of", "keys" ]
29b153fc4e126e5edb97da937f2ee2e231b87593
https://github.com/lucee/Lucee/blob/29b153fc4e126e5edb97da937f2ee2e231b87593/core/src/main/java/lucee/runtime/ComponentImpl.java#L771-L781
30,417
lucee/Lucee
core/src/main/java/lucee/runtime/ComponentImpl.java
ComponentImpl.getMember
protected Member getMember(PageContext pc, Collection.Key key, boolean dataMember, boolean superAccess) { // check super if (dataMember && key.equalsIgnoreCase(KeyConstants._super) && isPrivate(pc)) { Component ac = ComponentUtil.getActiveComponent(pc, this); return SuperComponent.superMember((ComponentImpl) ac.getBaseComponent()); } if (superAccess) return _udfs.get(key); // check data Member member = _data.get(key); if (isAccessible(pc, member)) return member; return null; }
java
protected Member getMember(PageContext pc, Collection.Key key, boolean dataMember, boolean superAccess) { // check super if (dataMember && key.equalsIgnoreCase(KeyConstants._super) && isPrivate(pc)) { Component ac = ComponentUtil.getActiveComponent(pc, this); return SuperComponent.superMember((ComponentImpl) ac.getBaseComponent()); } if (superAccess) return _udfs.get(key); // check data Member member = _data.get(key); if (isAccessible(pc, member)) return member; return null; }
[ "protected", "Member", "getMember", "(", "PageContext", "pc", ",", "Collection", ".", "Key", "key", ",", "boolean", "dataMember", ",", "boolean", "superAccess", ")", "{", "// check super", "if", "(", "dataMember", "&&", "key", ".", "equalsIgnoreCase", "(", "Ke...
get entry matching key @param access @param keyLowerCase key lower case (case sensitive) @param doBase do check also base component @param dataMember do also check if key super @return matching entry if exists otherwise null
[ "get", "entry", "matching", "key" ]
29b153fc4e126e5edb97da937f2ee2e231b87593
https://github.com/lucee/Lucee/blob/29b153fc4e126e5edb97da937f2ee2e231b87593/core/src/main/java/lucee/runtime/ComponentImpl.java#L877-L889
30,418
lucee/Lucee
core/src/main/java/lucee/runtime/ComponentImpl.java
ComponentImpl.getAccess
private int getAccess(Collection.Key key) { Member member = getMember(ACCESS_PRIVATE, key, false, false); if (member == null) return Component.ACCESS_PRIVATE; return member.getAccess(); }
java
private int getAccess(Collection.Key key) { Member member = getMember(ACCESS_PRIVATE, key, false, false); if (member == null) return Component.ACCESS_PRIVATE; return member.getAccess(); }
[ "private", "int", "getAccess", "(", "Collection", ".", "Key", "key", ")", "{", "Member", "member", "=", "getMember", "(", "ACCESS_PRIVATE", ",", "key", ",", "false", ",", "false", ")", ";", "if", "(", "member", "==", "null", ")", "return", "Component", ...
return the access of a member @param key @return returns the access (Component.ACCESS_REMOTE, ACCESS_PUBLIC, ACCESS_PACKAGE,Component.ACCESS_PRIVATE)
[ "return", "the", "access", "of", "a", "member" ]
29b153fc4e126e5edb97da937f2ee2e231b87593
https://github.com/lucee/Lucee/blob/29b153fc4e126e5edb97da937f2ee2e231b87593/core/src/main/java/lucee/runtime/ComponentImpl.java#L957-L961
30,419
lucee/Lucee
core/src/main/java/lucee/runtime/ComponentImpl.java
ComponentImpl.getAccess
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; }
java
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; }
[ "int", "getAccess", "(", "PageContext", "pc", ")", "{", "if", "(", "pc", "==", "null", ")", "return", "ACCESS_PUBLIC", ";", "if", "(", "isPrivate", "(", "pc", ")", ")", "return", "ACCESS_PRIVATE", ";", "if", "(", "isPackage", "(", "pc", ")", ")", "re...
returns current access to this component @param pc @return access
[ "returns", "current", "access", "to", "this", "component" ]
29b153fc4e126e5edb97da937f2ee2e231b87593
https://github.com/lucee/Lucee/blob/29b153fc4e126e5edb97da937f2ee2e231b87593/core/src/main/java/lucee/runtime/ComponentImpl.java#L969-L975
30,420
lucee/Lucee
core/src/main/java/lucee/runtime/ComponentImpl.java
ComponentImpl._set
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_PUBLIC); _data.put(key, udf); _udfs.put(key, udf); hasInjectedFunctions = true; } else _data.put(key, m); } else { Member existing = _data.get(key); if (loaded && !isAccessible(pc, existing != null ? existing.getAccess() : dataMemberDefaultAccess)) throw new ExpressionException("Component [" + getCallName() + "] has no accessible Member with name [" + key + "]", "enable [trigger data member] in administrator to also invoke getters and setters"); _data.put(key, new DataMember(existing != null ? existing.getAccess() : dataMemberDefaultAccess, existing != null ? existing.getModifier() : Member.MODIFIER_NONE, value)); } return value; }
java
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_PUBLIC); _data.put(key, udf); _udfs.put(key, udf); hasInjectedFunctions = true; } else _data.put(key, m); } else { Member existing = _data.get(key); if (loaded && !isAccessible(pc, existing != null ? existing.getAccess() : dataMemberDefaultAccess)) throw new ExpressionException("Component [" + getCallName() + "] has no accessible Member with name [" + key + "]", "enable [trigger data member] in administrator to also invoke getters and setters"); _data.put(key, new DataMember(existing != null ? existing.getAccess() : dataMemberDefaultAccess, existing != null ? existing.getModifier() : Member.MODIFIER_NONE, value)); } return value; }
[ "private", "Object", "_set", "(", "PageContext", "pc", ",", "Collection", ".", "Key", "key", ",", "Object", "value", ")", "throws", "ExpressionException", "{", "if", "(", "value", "instanceof", "Member", ")", "{", "Member", "m", "=", "(", "Member", ")", ...
sets a value to the current Component, dont to base Component @param key @param value @return value set @throws ExpressionException
[ "sets", "a", "value", "to", "the", "current", "Component", "dont", "to", "base", "Component" ]
29b153fc4e126e5edb97da937f2ee2e231b87593
https://github.com/lucee/Lucee/blob/29b153fc4e126e5edb97da937f2ee2e231b87593/core/src/main/java/lucee/runtime/ComponentImpl.java#L1634-L1655
30,421
lucee/Lucee
core/src/main/java/lucee/runtime/ComponentImpl.java
ComponentImpl.readExternal
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]; pc = ThreadUtil.createPageContext(config, DevNullOutputStream.DEV_NULL_OUTPUT_STREAM, "localhost", "/", "", new Cookie[0], parr, null, parr, new StructImpl(), true, -1); } // reading fails for serialized data from Lucee version 4.1.2.002 String name = in.readUTF(); // oldest style of serialisation if (name.startsWith("evaluateComponent('") && name.endsWith("})")) { readExternalOldStyle(pc, name); return; } // newest version (5.2.8.16) also holds the path String path = null; int index = name.indexOf('|'); if (index != -1) { path = name.substring(index + 1); name = name.substring(0, index); } String md5 = in.readUTF(); Struct _this = Caster.toStruct(in.readObject(), null); Struct _var = Caster.toStruct(in.readObject(), null); String template = in.readUTF(); if (pc != null && pc.getBasePageSource() == null && !StringUtil.isEmpty(template)) { Resource res = ResourceUtil.toResourceNotExisting(pc, template); PageSource ps = pc.toPageSource(res, null); if (ps != null) { ((PageContextImpl) pc).setBase(ps); } } try { ComponentImpl other = (ComponentImpl) EvaluateComponent.invoke(pc, name, md5, _this, _var); _readExternal(other); } catch (PageException pe) { boolean done = false; if (!StringUtil.isEmpty(path)) { Resource res = ResourceUtil.toResourceExisting(pc, path, false, null); if (res != null) { PageSource ps = pc.toPageSource(res, null); if (ps != null) { try { ComponentImpl other = ComponentLoader.loadComponent(pc, ps, name, false, true); _readExternal(other); done = true; } catch (PageException pe2) { throw ExceptionUtil.toIOException(pe2); } } } } if (!done) throw ExceptionUtil.toIOException(pe); } } finally { if (pcCreated) ThreadLocalPageContext.release(); } }
java
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]; pc = ThreadUtil.createPageContext(config, DevNullOutputStream.DEV_NULL_OUTPUT_STREAM, "localhost", "/", "", new Cookie[0], parr, null, parr, new StructImpl(), true, -1); } // reading fails for serialized data from Lucee version 4.1.2.002 String name = in.readUTF(); // oldest style of serialisation if (name.startsWith("evaluateComponent('") && name.endsWith("})")) { readExternalOldStyle(pc, name); return; } // newest version (5.2.8.16) also holds the path String path = null; int index = name.indexOf('|'); if (index != -1) { path = name.substring(index + 1); name = name.substring(0, index); } String md5 = in.readUTF(); Struct _this = Caster.toStruct(in.readObject(), null); Struct _var = Caster.toStruct(in.readObject(), null); String template = in.readUTF(); if (pc != null && pc.getBasePageSource() == null && !StringUtil.isEmpty(template)) { Resource res = ResourceUtil.toResourceNotExisting(pc, template); PageSource ps = pc.toPageSource(res, null); if (ps != null) { ((PageContextImpl) pc).setBase(ps); } } try { ComponentImpl other = (ComponentImpl) EvaluateComponent.invoke(pc, name, md5, _this, _var); _readExternal(other); } catch (PageException pe) { boolean done = false; if (!StringUtil.isEmpty(path)) { Resource res = ResourceUtil.toResourceExisting(pc, path, false, null); if (res != null) { PageSource ps = pc.toPageSource(res, null); if (ps != null) { try { ComponentImpl other = ComponentLoader.loadComponent(pc, ps, name, false, true); _readExternal(other); done = true; } catch (PageException pe2) { throw ExceptionUtil.toIOException(pe2); } } } } if (!done) throw ExceptionUtil.toIOException(pe); } } finally { if (pcCreated) ThreadLocalPageContext.release(); } }
[ "public", "void", "readExternal", "(", "ObjectInput", "in", ")", "throws", "IOException", ",", "ClassNotFoundException", "{", "boolean", "pcCreated", "=", "false", ";", "PageContext", "pc", "=", "ThreadLocalPageContext", ".", "get", "(", ")", ";", "try", "{", ...
MUST more native impl
[ "MUST", "more", "native", "impl" ]
29b153fc4e126e5edb97da937f2ee2e231b87593
https://github.com/lucee/Lucee/blob/29b153fc4e126e5edb97da937f2ee2e231b87593/core/src/main/java/lucee/runtime/ComponentImpl.java#L2133-L2204
30,422
lucee/Lucee
core/src/main/java/lucee/transformer/cfml/evaluator/EvaluatorPool.java
EvaluatorPool.add
public void add(TagLibTag libTag, Tag tag, FunctionLib[] flibs, SourceCode cfml) { tags.add(new TagData(libTag, tag, flibs, cfml)); }
java
public void add(TagLibTag libTag, Tag tag, FunctionLib[] flibs, SourceCode cfml) { tags.add(new TagData(libTag, tag, flibs, cfml)); }
[ "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
[ "add", "a", "tag", "to", "the", "pool", "to", "evaluate", "at", "the", "end" ]
29b153fc4e126e5edb97da937f2ee2e231b87593
https://github.com/lucee/Lucee/blob/29b153fc4e126e5edb97da937f2ee2e231b87593/core/src/main/java/lucee/transformer/cfml/evaluator/EvaluatorPool.java#L54-L56
30,423
lucee/Lucee
core/src/main/java/lucee/transformer/cfml/evaluator/EvaluatorPool.java
EvaluatorPool.run
public void run() throws TemplateException { { // tags 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, td.libTag, td.flibs); } catch (EvaluatorException e) { clear();// print.printST(e); throw new TemplateException(cfml, e); } catch (Throwable e) { ExceptionUtil.rethrowIfNecessary(e); clear(); throw new TemplateException(cfml, e); } } tags.clear(); } // functions Iterator<FunctionData> it = functions.iterator(); while (it.hasNext()) { FunctionData td = it.next(); SourceCode cfml = td.cfml; cfml.setPos(td.pos); try { if (td.flf.getEvaluator() != null) td.flf.getEvaluator().evaluate(td.bif, td.flf); } catch (EvaluatorException e) { clear();// print.printST(e); throw new TemplateException(cfml, e); } catch (Throwable e) { ExceptionUtil.rethrowIfNecessary(e); clear(); throw new TemplateException(cfml, e); } } functions.clear(); }
java
public void run() throws TemplateException { { // tags 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, td.libTag, td.flibs); } catch (EvaluatorException e) { clear();// print.printST(e); throw new TemplateException(cfml, e); } catch (Throwable e) { ExceptionUtil.rethrowIfNecessary(e); clear(); throw new TemplateException(cfml, e); } } tags.clear(); } // functions Iterator<FunctionData> it = functions.iterator(); while (it.hasNext()) { FunctionData td = it.next(); SourceCode cfml = td.cfml; cfml.setPos(td.pos); try { if (td.flf.getEvaluator() != null) td.flf.getEvaluator().evaluate(td.bif, td.flf); } catch (EvaluatorException e) { clear();// print.printST(e); throw new TemplateException(cfml, e); } catch (Throwable e) { ExceptionUtil.rethrowIfNecessary(e); clear(); throw new TemplateException(cfml, e); } } functions.clear(); }
[ "public", "void", "run", "(", ")", "throws", "TemplateException", "{", "{", "// tags", "Iterator", "<", "TagData", ">", "it", "=", "tags", ".", "iterator", "(", ")", ";", "while", "(", "it", ".", "hasNext", "(", ")", ")", "{", "TagData", "td", "=", ...
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. @throws TemplateException
[ "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", "un...
29b153fc4e126e5edb97da937f2ee2e231b87593
https://github.com/lucee/Lucee/blob/29b153fc4e126e5edb97da937f2ee2e231b87593/core/src/main/java/lucee/transformer/cfml/evaluator/EvaluatorPool.java#L70-L116
30,424
lucee/Lucee
core/src/main/java/lucee/runtime/interpreter/ref/util/RefUtil.java
RefUtil.getValue
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; }
java
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; }
[ "public", "static", "Object", "[", "]", "getValue", "(", "PageContext", "pc", ",", "Ref", "[", "]", "refs", ")", "throws", "PageException", "{", "Object", "[", "]", "objs", "=", "new", "Object", "[", "refs", ".", "length", "]", ";", "for", "(", "int"...
transalte a Ref array to a Object array @param refs @return objects @throws PageException
[ "transalte", "a", "Ref", "array", "to", "a", "Object", "array" ]
29b153fc4e126e5edb97da937f2ee2e231b87593
https://github.com/lucee/Lucee/blob/29b153fc4e126e5edb97da937f2ee2e231b87593/core/src/main/java/lucee/runtime/interpreter/ref/util/RefUtil.java#L34-L40
30,425
lucee/Lucee
core/src/main/java/lucee/runtime/osgi/OSGiUtil.java
OSGiUtil.installBundle
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 = loadBundleFromLocal(context, bf.getSymbolicName(), bf.getVersion(), false, null); if (existing != null) return existing; } return _loadBundle(context, bundle.getAbsolutePath(), bundle.getInputStream(), true); }
java
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 = loadBundleFromLocal(context, bf.getSymbolicName(), bf.getVersion(), false, null); if (existing != null) return existing; } return _loadBundle(context, bundle.getAbsolutePath(), bundle.getInputStream(), true); }
[ "public", "static", "Bundle", "installBundle", "(", "BundleContext", "context", ",", "Resource", "bundle", ",", "boolean", "checkExistence", ")", "throws", "IOException", ",", "BundleException", "{", "if", "(", "checkExistence", ")", "{", "BundleFile", "bf", "=", ...
only installs a bundle, if the bundle does not already exist, if the bundle exists the existing bundle is unloaded first. @param factory @param context @param bundle @return @throws IOException @throws BundleException
[ "only", "installs", "a", "bundle", "if", "the", "bundle", "does", "not", "already", "exist", "if", "the", "bundle", "exists", "the", "existing", "bundle", "is", "unloaded", "first", "." ]
29b153fc4e126e5edb97da937f2ee2e231b87593
https://github.com/lucee/Lucee/blob/29b153fc4e126e5edb97da937f2ee2e231b87593/core/src/main/java/lucee/runtime/osgi/OSGiUtil.java#L103-L113
30,426
lucee/Lucee
core/src/main/java/lucee/runtime/osgi/OSGiUtil.java
OSGiUtil._loadBundle
private static Bundle _loadBundle(BundleContext context, String path, InputStream is, boolean closeStream) throws BundleException { log(Log.LEVEL_INFO, "add bundle:" + path); try { // we make this very simply so an old loader that is calling this still works return context.installBundle(path, is); } finally { // we make this very simply so an old loader that is calling this still works if (closeStream && is != null) { try { is.close(); } catch (Throwable t) { ExceptionUtil.rethrowIfNecessary(t); } } } }
java
private static Bundle _loadBundle(BundleContext context, String path, InputStream is, boolean closeStream) throws BundleException { log(Log.LEVEL_INFO, "add bundle:" + path); try { // we make this very simply so an old loader that is calling this still works return context.installBundle(path, is); } finally { // we make this very simply so an old loader that is calling this still works if (closeStream && is != null) { try { is.close(); } catch (Throwable t) { ExceptionUtil.rethrowIfNecessary(t); } } } }
[ "private", "static", "Bundle", "_loadBundle", "(", "BundleContext", "context", ",", "String", "path", ",", "InputStream", "is", ",", "boolean", "closeStream", ")", "throws", "BundleException", "{", "log", "(", "Log", ".", "LEVEL_INFO", ",", "\"add bundle:\"", "+...
does not check if the bundle already exists! @param context @param path @param is @param closeStream @return @throws BundleException
[ "does", "not", "check", "if", "the", "bundle", "already", "exists!" ]
29b153fc4e126e5edb97da937f2ee2e231b87593
https://github.com/lucee/Lucee/blob/29b153fc4e126e5edb97da937f2ee2e231b87593/core/src/main/java/lucee/runtime/osgi/OSGiUtil.java#L125-L143
30,427
lucee/Lucee
core/src/main/java/lucee/runtime/osgi/OSGiUtil.java
OSGiUtil.installBundle
public static Bundle installBundle(BundleContext context, InputStream bundleIS, boolean closeStream, boolean checkExistence) throws IOException, BundleException { // store locally to test the bundle String name = System.currentTimeMillis() + ".tmp"; Resource dir = SystemUtil.getTempDirectory(); Resource tmp = dir.getRealResource(name); int count = 0; while (tmp.exists()) tmp = dir.getRealResource((count++) + "_" + name); IOUtil.copy(bundleIS, tmp, closeStream); try { return installBundle(context, tmp, checkExistence); } finally { tmp.delete(); } }
java
public static Bundle installBundle(BundleContext context, InputStream bundleIS, boolean closeStream, boolean checkExistence) throws IOException, BundleException { // store locally to test the bundle String name = System.currentTimeMillis() + ".tmp"; Resource dir = SystemUtil.getTempDirectory(); Resource tmp = dir.getRealResource(name); int count = 0; while (tmp.exists()) tmp = dir.getRealResource((count++) + "_" + name); IOUtil.copy(bundleIS, tmp, closeStream); try { return installBundle(context, tmp, checkExistence); } finally { tmp.delete(); } }
[ "public", "static", "Bundle", "installBundle", "(", "BundleContext", "context", ",", "InputStream", "bundleIS", ",", "boolean", "closeStream", ",", "boolean", "checkExistence", ")", "throws", "IOException", ",", "BundleException", "{", "// store locally to test the bundle...
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. @param factory @param context @param bundle @return @throws IOException @throws BundleException
[ "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", "s...
29b153fc4e126e5edb97da937f2ee2e231b87593
https://github.com/lucee/Lucee/blob/29b153fc4e126e5edb97da937f2ee2e231b87593/core/src/main/java/lucee/runtime/osgi/OSGiUtil.java#L156-L172
30,428
lucee/Lucee
core/src/main/java/lucee/runtime/osgi/OSGiUtil.java
OSGiUtil.loadClass
public static Class loadClass(String className, Class defaultValue) { className = className.trim(); CFMLEngine engine = CFMLEngineFactory.getInstance(); BundleCollection bc = engine.getBundleCollection(); // first we try to load the class from the Lucee core try { // load from core return bc.core.loadClass(className); } catch (Throwable t) { ExceptionUtil.rethrowIfNecessary(t); } // class is not visible to the Lucee core // now we check all started bundled (not only bundles used by core) Bundle[] bundles = bc.getBundleContext().getBundles(); for (Bundle b: bundles) { if (b == bc.core) continue; try { return b.loadClass(className); } catch (Throwable t) { ExceptionUtil.rethrowIfNecessary(t); } // class is not visible to that bundle } // now we check lucee loader (SystemClassLoader?) CFMLEngineFactory factory = engine.getCFMLEngineFactory(); try { // print.e("loader:"); return factory.getClass().getClassLoader().loadClass(className); } catch (Throwable t) { ExceptionUtil.rethrowIfNecessary(t); } /* * try { return Class.forName(className); } catch (Throwable t3) { * * } */ // now we check bundles not loaded Set<String> loaded = new HashSet<String>(); for (Bundle b: bundles) { loaded.add(b.getSymbolicName() + "|" + b.getVersion()); } try { File dir = factory.getBundleDirectory(); File[] children = dir.listFiles(JAR_EXT_FILTER); BundleFile bf; for (int i = 0; i < children.length; i++) { try { bf = new BundleFile(children[i]); if (bf.isBundle() && !loaded.contains(bf.getSymbolicName() + "|" + bf.getVersion()) && bf.hasClass(className)) { Bundle b = null; try { b = _loadBundle(bc.getBundleContext(), bf.getFile()); } catch (IOException e) {} if (b != null) { startIfNecessary(b); return b.loadClass(className); } } } catch (Throwable t2) { ExceptionUtil.rethrowIfNecessary(t2); } } } catch (Throwable t1) { ExceptionUtil.rethrowIfNecessary(t1); } return defaultValue; }
java
public static Class loadClass(String className, Class defaultValue) { className = className.trim(); CFMLEngine engine = CFMLEngineFactory.getInstance(); BundleCollection bc = engine.getBundleCollection(); // first we try to load the class from the Lucee core try { // load from core return bc.core.loadClass(className); } catch (Throwable t) { ExceptionUtil.rethrowIfNecessary(t); } // class is not visible to the Lucee core // now we check all started bundled (not only bundles used by core) Bundle[] bundles = bc.getBundleContext().getBundles(); for (Bundle b: bundles) { if (b == bc.core) continue; try { return b.loadClass(className); } catch (Throwable t) { ExceptionUtil.rethrowIfNecessary(t); } // class is not visible to that bundle } // now we check lucee loader (SystemClassLoader?) CFMLEngineFactory factory = engine.getCFMLEngineFactory(); try { // print.e("loader:"); return factory.getClass().getClassLoader().loadClass(className); } catch (Throwable t) { ExceptionUtil.rethrowIfNecessary(t); } /* * try { return Class.forName(className); } catch (Throwable t3) { * * } */ // now we check bundles not loaded Set<String> loaded = new HashSet<String>(); for (Bundle b: bundles) { loaded.add(b.getSymbolicName() + "|" + b.getVersion()); } try { File dir = factory.getBundleDirectory(); File[] children = dir.listFiles(JAR_EXT_FILTER); BundleFile bf; for (int i = 0; i < children.length; i++) { try { bf = new BundleFile(children[i]); if (bf.isBundle() && !loaded.contains(bf.getSymbolicName() + "|" + bf.getVersion()) && bf.hasClass(className)) { Bundle b = null; try { b = _loadBundle(bc.getBundleContext(), bf.getFile()); } catch (IOException e) {} if (b != null) { startIfNecessary(b); return b.loadClass(className); } } } catch (Throwable t2) { ExceptionUtil.rethrowIfNecessary(t2); } } } catch (Throwable t1) { ExceptionUtil.rethrowIfNecessary(t1); } return defaultValue; }
[ "public", "static", "Class", "loadClass", "(", "String", "className", ",", "Class", "defaultValue", ")", "{", "className", "=", "className", ".", "trim", "(", ")", ";", "CFMLEngine", "engine", "=", "CFMLEngineFactory", ".", "getInstance", "(", ")", ";", "Bun...
tries to load a class with ni bundle definition @param name @param version @param id @param startIfNecessary @return @throws BundleException
[ "tries", "to", "load", "a", "class", "with", "ni", "bundle", "definition" ]
29b153fc4e126e5edb97da937f2ee2e231b87593
https://github.com/lucee/Lucee/blob/29b153fc4e126e5edb97da937f2ee2e231b87593/core/src/main/java/lucee/runtime/osgi/OSGiUtil.java#L269-L349
30,429
lucee/Lucee
core/src/main/java/lucee/runtime/osgi/OSGiUtil.java
OSGiUtil.removeLocalBundle
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(factory, name, version, null); if (bf != null) { BundleDefinition bd = bf.toBundleDefinition(); if (bd != null) { Bundle b = bd.getLocalBundle(); if (b != null) { stopIfNecessary(b); b.uninstall(); } } } if (!removePhysical) return; // remove file if (bf != null) { if (!bf.getFile().delete() && doubleTap) bf.getFile().deleteOnExit(); } }
java
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(factory, name, version, null); if (bf != null) { BundleDefinition bd = bf.toBundleDefinition(); if (bd != null) { Bundle b = bd.getLocalBundle(); if (b != null) { stopIfNecessary(b); b.uninstall(); } } } if (!removePhysical) return; // remove file if (bf != null) { if (!bf.getFile().delete() && doubleTap) bf.getFile().deleteOnExit(); } }
[ "public", "static", "void", "removeLocalBundle", "(", "String", "name", ",", "Version", "version", ",", "boolean", "removePhysical", ",", "boolean", "doubleTap", ")", "throws", "BundleException", "{", "name", "=", "name", ".", "trim", "(", ")", ";", "CFMLEngin...
get local bundle, but does not download from update provider! @param name @param version @return @throws BundleException
[ "get", "local", "bundle", "but", "does", "not", "download", "from", "update", "provider!" ]
29b153fc4e126e5edb97da937f2ee2e231b87593
https://github.com/lucee/Lucee/blob/29b153fc4e126e5edb97da937f2ee2e231b87593/core/src/main/java/lucee/runtime/osgi/OSGiUtil.java#L1000-L1023
30,430
lucee/Lucee
core/src/main/java/lucee/runtime/extension/RHExtension.java
RHExtension.move
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(); ResourceUtil.moveTo(ext, trg, true); this.extensionFile = trg; } } catch (Exception e) { throw Caster.toPageException(e); } }
java
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(); ResourceUtil.moveTo(ext, trg, true); this.extensionFile = trg; } } catch (Exception e) { throw Caster.toPageException(e); } }
[ "private", "void", "move", "(", "Resource", "ext", ")", "throws", "PageException", "{", "Resource", "trg", ";", "Resource", "trgDir", ";", "try", "{", "trg", "=", "getExtensionFile", "(", "config", ",", "ext", ",", "id", ",", "name", ",", "version", ")",...
copy the file to extension dir if it is not already there
[ "copy", "the", "file", "to", "extension", "dir", "if", "it", "is", "not", "already", "there" ]
29b153fc4e126e5edb97da937f2ee2e231b87593
https://github.com/lucee/Lucee/blob/29b153fc4e126e5edb97da937f2ee2e231b87593/core/src/main/java/lucee/runtime/extension/RHExtension.java#L237-L253
30,431
lucee/Lucee
core/src/main/java/lucee/commons/io/res/type/cache/CacheResourceCore.java
CacheResourceCore.setData
public void setData(byte[] data, boolean append) { lastModified = System.currentTimeMillis(); // set data 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[i]; } for (; i < this.data.length + data.length; i++) { newData[i] = data[i - this.data.length]; } this.data = newData; } else if (data != null) { this.data = data; } } else { this.data = data; } // set type if (this.data != null) this.type = TYPE_FILE; }
java
public void setData(byte[] data, boolean append) { lastModified = System.currentTimeMillis(); // set data 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[i]; } for (; i < this.data.length + data.length; i++) { newData[i] = data[i - this.data.length]; } this.data = newData; } else if (data != null) { this.data = data; } } else { this.data = data; } // set type if (this.data != null) this.type = TYPE_FILE; }
[ "public", "void", "setData", "(", "byte", "[", "]", "data", ",", "boolean", "append", ")", "{", "lastModified", "=", "System", ".", "currentTimeMillis", "(", ")", ";", "// set data", "if", "(", "append", ")", "{", "if", "(", "this", ".", "data", "!=", ...
Setzt den Feldnamen data. @param data data @param append
[ "Setzt", "den", "Feldnamen", "data", "." ]
29b153fc4e126e5edb97da937f2ee2e231b87593
https://github.com/lucee/Lucee/blob/29b153fc4e126e5edb97da937f2ee2e231b87593/core/src/main/java/lucee/commons/io/res/type/cache/CacheResourceCore.java#L95-L122
30,432
lucee/Lucee
core/src/main/java/lucee/runtime/security/ScriptProtect.java
ScriptProtect.translate
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) value)); } } }
java
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) value)); } } }
[ "public", "static", "void", "translate", "(", "Struct", "sct", ")", "{", "Iterator", "<", "Entry", "<", "Key", ",", "Object", ">", ">", "it", "=", "sct", ".", "entryIterator", "(", ")", ";", "Entry", "<", "Key", ",", "Object", ">", "e", ";", "Objec...
translate all strig values of the struct i script-protected form @param sct Struct to translate its values
[ "translate", "all", "strig", "values", "of", "the", "struct", "i", "script", "-", "protected", "form" ]
29b153fc4e126e5edb97da937f2ee2e231b87593
https://github.com/lucee/Lucee/blob/29b153fc4e126e5edb97da937f2ee2e231b87593/core/src/main/java/lucee/runtime/security/ScriptProtect.java#L39-L50
30,433
lucee/Lucee
core/src/main/java/lucee/runtime/security/ScriptProtect.java
ScriptProtect.translate
public static String translate(String str) { if (str == null) return ""; // TODO do-while machen int index, last = 0, endIndex; StringBuilder sb = null; String tagName; while ((index = str.indexOf('<', last)) != -1) { // read tagname int len = str.length(); char c; for (endIndex = index + 1; endIndex < len; endIndex++) { c = str.charAt(endIndex); if ((c < 'a' || c > 'z') && (c < 'A' || c > 'Z')) break; } tagName = str.substring(index + 1, endIndex); if (compareTagName(tagName)) { if (sb == null) { sb = new StringBuilder(); last = 0; } sb.append(str.substring(last, index + 1)); sb.append("invalidTag"); last = endIndex; } else if (sb != null) { sb.append(str.substring(last, index + 1)); last = index + 1; } else last = index + 1; } if (sb != null) { if (last != str.length()) sb.append(str.substring(last)); return sb.toString(); } return str; }
java
public static String translate(String str) { if (str == null) return ""; // TODO do-while machen int index, last = 0, endIndex; StringBuilder sb = null; String tagName; while ((index = str.indexOf('<', last)) != -1) { // read tagname int len = str.length(); char c; for (endIndex = index + 1; endIndex < len; endIndex++) { c = str.charAt(endIndex); if ((c < 'a' || c > 'z') && (c < 'A' || c > 'Z')) break; } tagName = str.substring(index + 1, endIndex); if (compareTagName(tagName)) { if (sb == null) { sb = new StringBuilder(); last = 0; } sb.append(str.substring(last, index + 1)); sb.append("invalidTag"); last = endIndex; } else if (sb != null) { sb.append(str.substring(last, index + 1)); last = index + 1; } else last = index + 1; } if (sb != null) { if (last != str.length()) sb.append(str.substring(last)); return sb.toString(); } return str; }
[ "public", "static", "String", "translate", "(", "String", "str", ")", "{", "if", "(", "str", "==", "null", ")", "return", "\"\"", ";", "// TODO do-while machen", "int", "index", ",", "last", "=", "0", ",", "endIndex", ";", "StringBuilder", "sb", "=", "nu...
translate string to script-protected form @param str @return translated String
[ "translate", "string", "to", "script", "-", "protected", "form" ]
29b153fc4e126e5edb97da937f2ee2e231b87593
https://github.com/lucee/Lucee/blob/29b153fc4e126e5edb97da937f2ee2e231b87593/core/src/main/java/lucee/runtime/security/ScriptProtect.java#L58-L95
30,434
lucee/Lucee
core/src/main/java/lucee/runtime/listener/AppListenerUtil.java
AppListenerUtil.translateScriptProtect
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_CGI) > 0) arr.appendEL("cgi"); if ((scriptProtect & ApplicationContext.SCRIPT_PROTECT_COOKIE) > 0) arr.appendEL("cookie"); if ((scriptProtect & ApplicationContext.SCRIPT_PROTECT_FORM) > 0) arr.appendEL("form"); if ((scriptProtect & ApplicationContext.SCRIPT_PROTECT_URL) > 0) arr.appendEL("url"); try { return ListUtil.arrayToList(arr, ","); } catch (PageException e) { return "none"; } }
java
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_CGI) > 0) arr.appendEL("cgi"); if ((scriptProtect & ApplicationContext.SCRIPT_PROTECT_COOKIE) > 0) arr.appendEL("cookie"); if ((scriptProtect & ApplicationContext.SCRIPT_PROTECT_FORM) > 0) arr.appendEL("form"); if ((scriptProtect & ApplicationContext.SCRIPT_PROTECT_URL) > 0) arr.appendEL("url"); try { return ListUtil.arrayToList(arr, ","); } catch (PageException e) { return "none"; } }
[ "public", "static", "String", "translateScriptProtect", "(", "int", "scriptProtect", ")", "{", "if", "(", "scriptProtect", "==", "ApplicationContext", ".", "SCRIPT_PROTECT_NONE", ")", "return", "\"none\"", ";", "if", "(", "scriptProtect", "==", "ApplicationContext", ...
translate int definition of script protect to string definition @param scriptProtect @return
[ "translate", "int", "definition", "of", "script", "protect", "to", "string", "definition" ]
29b153fc4e126e5edb97da937f2ee2e231b87593
https://github.com/lucee/Lucee/blob/29b153fc4e126e5edb97da937f2ee2e231b87593/core/src/main/java/lucee/runtime/listener/AppListenerUtil.java#L491-L507
30,435
lucee/Lucee
core/src/main/java/lucee/runtime/listener/AppListenerUtil.java
AppListenerUtil.translateScriptProtect
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_NONE; if ("false".equals(strScriptProtect)) return ApplicationContext.SCRIPT_PROTECT_NONE; if ("all".equals(strScriptProtect)) return ApplicationContext.SCRIPT_PROTECT_ALL; if ("true".equals(strScriptProtect)) return ApplicationContext.SCRIPT_PROTECT_ALL; if ("yes".equals(strScriptProtect)) return ApplicationContext.SCRIPT_PROTECT_ALL; String[] arr = ListUtil.listToStringArray(strScriptProtect, ','); String item; int scriptProtect = 0; for (int i = 0; i < arr.length; i++) { item = arr[i].trim(); if ("cgi".equals(item) && (scriptProtect & ApplicationContext.SCRIPT_PROTECT_CGI) == 0) scriptProtect += ApplicationContext.SCRIPT_PROTECT_CGI; else if ("cookie".equals(item) && (scriptProtect & ApplicationContext.SCRIPT_PROTECT_COOKIE) == 0) scriptProtect += ApplicationContext.SCRIPT_PROTECT_COOKIE; else if ("form".equals(item) && (scriptProtect & ApplicationContext.SCRIPT_PROTECT_FORM) == 0) scriptProtect += ApplicationContext.SCRIPT_PROTECT_FORM; else if ("url".equals(item) && (scriptProtect & ApplicationContext.SCRIPT_PROTECT_URL) == 0) scriptProtect += ApplicationContext.SCRIPT_PROTECT_URL; } return scriptProtect; }
java
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_NONE; if ("false".equals(strScriptProtect)) return ApplicationContext.SCRIPT_PROTECT_NONE; if ("all".equals(strScriptProtect)) return ApplicationContext.SCRIPT_PROTECT_ALL; if ("true".equals(strScriptProtect)) return ApplicationContext.SCRIPT_PROTECT_ALL; if ("yes".equals(strScriptProtect)) return ApplicationContext.SCRIPT_PROTECT_ALL; String[] arr = ListUtil.listToStringArray(strScriptProtect, ','); String item; int scriptProtect = 0; for (int i = 0; i < arr.length; i++) { item = arr[i].trim(); if ("cgi".equals(item) && (scriptProtect & ApplicationContext.SCRIPT_PROTECT_CGI) == 0) scriptProtect += ApplicationContext.SCRIPT_PROTECT_CGI; else if ("cookie".equals(item) && (scriptProtect & ApplicationContext.SCRIPT_PROTECT_COOKIE) == 0) scriptProtect += ApplicationContext.SCRIPT_PROTECT_COOKIE; else if ("form".equals(item) && (scriptProtect & ApplicationContext.SCRIPT_PROTECT_FORM) == 0) scriptProtect += ApplicationContext.SCRIPT_PROTECT_FORM; else if ("url".equals(item) && (scriptProtect & ApplicationContext.SCRIPT_PROTECT_URL) == 0) scriptProtect += ApplicationContext.SCRIPT_PROTECT_URL; } return scriptProtect; }
[ "public", "static", "int", "translateScriptProtect", "(", "String", "strScriptProtect", ")", "{", "strScriptProtect", "=", "strScriptProtect", ".", "toLowerCase", "(", ")", ".", "trim", "(", ")", ";", "if", "(", "\"none\"", ".", "equals", "(", "strScriptProtect"...
translate string definition of script protect to int definition @param strScriptProtect @return
[ "translate", "string", "definition", "of", "script", "protect", "to", "int", "definition" ]
29b153fc4e126e5edb97da937f2ee2e231b87593
https://github.com/lucee/Lucee/blob/29b153fc4e126e5edb97da937f2ee2e231b87593/core/src/main/java/lucee/runtime/listener/AppListenerUtil.java#L515-L537
30,436
lucee/Lucee
loader/src/main/java/lucee/loader/engine/CFMLEngineFactory.java
CFMLEngineFactory.callListeners
private void callListeners(final CFMLEngine engine) { final Iterator<EngineChangeListener> it = listeners.iterator(); while (it.hasNext()) it.next().onUpdate(); }
java
private void callListeners(final CFMLEngine engine) { final Iterator<EngineChangeListener> it = listeners.iterator(); while (it.hasNext()) it.next().onUpdate(); }
[ "private", "void", "callListeners", "(", "final", "CFMLEngine", "engine", ")", "{", "final", "Iterator", "<", "EngineChangeListener", ">", "it", "=", "listeners", ".", "iterator", "(", ")", ";", "while", "(", "it", ".", "hasNext", "(", ")", ")", "it", "....
call all registered listener for update of the engine @param engine
[ "call", "all", "registered", "listener", "for", "update", "of", "the", "engine" ]
29b153fc4e126e5edb97da937f2ee2e231b87593
https://github.com/lucee/Lucee/blob/29b153fc4e126e5edb97da937f2ee2e231b87593/loader/src/main/java/lucee/loader/engine/CFMLEngineFactory.java#L1126-L1130
30,437
lucee/Lucee
loader/src/main/java/lucee/loader/engine/CFMLEngineFactory.java
CFMLEngineFactory.getResourceRoot
public File getResourceRoot() throws IOException { if (resourceRoot == null) { resourceRoot = new File(_getResourceRoot(), "lucee-server"); if (!resourceRoot.exists()) resourceRoot.mkdirs(); } return resourceRoot; }
java
public File getResourceRoot() throws IOException { if (resourceRoot == null) { resourceRoot = new File(_getResourceRoot(), "lucee-server"); if (!resourceRoot.exists()) resourceRoot.mkdirs(); } return resourceRoot; }
[ "public", "File", "getResourceRoot", "(", ")", "throws", "IOException", "{", "if", "(", "resourceRoot", "==", "null", ")", "{", "resourceRoot", "=", "new", "File", "(", "_getResourceRoot", "(", ")", ",", "\"lucee-server\"", ")", ";", "if", "(", "!", "resou...
return directory to lucee resource root @return lucee root directory @throws IOException
[ "return", "directory", "to", "lucee", "resource", "root" ]
29b153fc4e126e5edb97da937f2ee2e231b87593
https://github.com/lucee/Lucee/blob/29b153fc4e126e5edb97da937f2ee2e231b87593/loader/src/main/java/lucee/loader/engine/CFMLEngineFactory.java#L1163-L1169
30,438
lucee/Lucee
core/src/main/java/lucee/runtime/type/util/UDFUtil.java
UDFUtil.addFunctionDoc
public static void addFunctionDoc(PageExceptionImpl pe, FunctionLibFunction flf) { ArrayList<FunctionLibFunctionArg> args = flf.getArg(); Iterator<FunctionLibFunctionArg> it = args.iterator(); // Pattern StringBuilder pattern = new StringBuilder(flf.getName()); StringBuilder end = new StringBuilder(); pattern.append("("); FunctionLibFunctionArg arg; int c = 0; while (it.hasNext()) { arg = it.next(); if (!arg.isRequired()) { pattern.append(" ["); end.append("]"); } if (c++ > 0) pattern.append(", "); pattern.append(arg.getName()); pattern.append(":"); pattern.append(arg.getTypeAsString()); } pattern.append(end); pattern.append("):"); pattern.append(flf.getReturnTypeAsString()); pe.setAdditional(KeyConstants._Pattern, pattern); // Documentation StringBuilder doc = new StringBuilder(flf.getDescription()); StringBuilder req = new StringBuilder(); StringBuilder opt = new StringBuilder(); StringBuilder tmp; doc.append("\n"); it = args.iterator(); while (it.hasNext()) { arg = it.next(); tmp = arg.isRequired() ? req : opt; tmp.append("- "); tmp.append(arg.getName()); tmp.append(" ("); tmp.append(arg.getTypeAsString()); tmp.append("): "); tmp.append(arg.getDescription()); tmp.append("\n"); } if (req.length() > 0) doc.append("\nRequired:\n").append(req); if (opt.length() > 0) doc.append("\nOptional:\n").append(opt); pe.setAdditional(KeyImpl.init("Documentation"), doc); }
java
public static void addFunctionDoc(PageExceptionImpl pe, FunctionLibFunction flf) { ArrayList<FunctionLibFunctionArg> args = flf.getArg(); Iterator<FunctionLibFunctionArg> it = args.iterator(); // Pattern StringBuilder pattern = new StringBuilder(flf.getName()); StringBuilder end = new StringBuilder(); pattern.append("("); FunctionLibFunctionArg arg; int c = 0; while (it.hasNext()) { arg = it.next(); if (!arg.isRequired()) { pattern.append(" ["); end.append("]"); } if (c++ > 0) pattern.append(", "); pattern.append(arg.getName()); pattern.append(":"); pattern.append(arg.getTypeAsString()); } pattern.append(end); pattern.append("):"); pattern.append(flf.getReturnTypeAsString()); pe.setAdditional(KeyConstants._Pattern, pattern); // Documentation StringBuilder doc = new StringBuilder(flf.getDescription()); StringBuilder req = new StringBuilder(); StringBuilder opt = new StringBuilder(); StringBuilder tmp; doc.append("\n"); it = args.iterator(); while (it.hasNext()) { arg = it.next(); tmp = arg.isRequired() ? req : opt; tmp.append("- "); tmp.append(arg.getName()); tmp.append(" ("); tmp.append(arg.getTypeAsString()); tmp.append("): "); tmp.append(arg.getDescription()); tmp.append("\n"); } if (req.length() > 0) doc.append("\nRequired:\n").append(req); if (opt.length() > 0) doc.append("\nOptional:\n").append(opt); pe.setAdditional(KeyImpl.init("Documentation"), doc); }
[ "public", "static", "void", "addFunctionDoc", "(", "PageExceptionImpl", "pe", ",", "FunctionLibFunction", "flf", ")", "{", "ArrayList", "<", "FunctionLibFunctionArg", ">", "args", "=", "flf", ".", "getArg", "(", ")", ";", "Iterator", "<", "FunctionLibFunctionArg",...
add detailed function documentation to the exception @param pe @param flf
[ "add", "detailed", "function", "documentation", "to", "the", "exception" ]
29b153fc4e126e5edb97da937f2ee2e231b87593
https://github.com/lucee/Lucee/blob/29b153fc4e126e5edb97da937f2ee2e231b87593/core/src/main/java/lucee/runtime/type/util/UDFUtil.java#L69-L123
30,439
lucee/Lucee
core/src/main/java/lucee/runtime/timer/Stopwatch.java
Stopwatch.stop
public long stop() { if (isRunning) { long time = _time() - start; total += time; count++; isRunning = false; return time; } return 0; }
java
public long stop() { if (isRunning) { long time = _time() - start; total += time; count++; isRunning = false; return time; } return 0; }
[ "public", "long", "stop", "(", ")", "{", "if", "(", "isRunning", ")", "{", "long", "time", "=", "_time", "(", ")", "-", "start", ";", "total", "+=", "time", ";", "count", "++", ";", "isRunning", "=", "false", ";", "return", "time", ";", "}", "ret...
stops the watch @return returns the current time or 0 if watch not was running
[ "stops", "the", "watch" ]
29b153fc4e126e5edb97da937f2ee2e231b87593
https://github.com/lucee/Lucee/blob/29b153fc4e126e5edb97da937f2ee2e231b87593/core/src/main/java/lucee/runtime/timer/Stopwatch.java#L57-L67
30,440
lucee/Lucee
core/src/main/java/lucee/transformer/library/function/FunctionLibFunction.java
FunctionLibFunction.addArg
public void addArg(FunctionLibFunctionArg arg) { arg.setFunction(this); argument.add(arg); if (arg.getDefaultValue() != null) hasDefaultValues = true; }
java
public void addArg(FunctionLibFunctionArg arg) { arg.setFunction(this); argument.add(arg); if (arg.getDefaultValue() != null) hasDefaultValues = true; }
[ "public", "void", "addArg", "(", "FunctionLibFunctionArg", "arg", ")", "{", "arg", ".", "setFunction", "(", "this", ")", ";", "argument", ".", "add", "(", "arg", ")", ";", "if", "(", "arg", ".", "getDefaultValue", "(", ")", "!=", "null", ")", "hasDefau...
Fuegt der Funktion ein Argument hinzu. @param arg Argument zur Funktion.
[ "Fuegt", "der", "Funktion", "ein", "Argument", "hinzu", "." ]
29b153fc4e126e5edb97da937f2ee2e231b87593
https://github.com/lucee/Lucee/blob/29b153fc4e126e5edb97da937f2ee2e231b87593/core/src/main/java/lucee/transformer/library/function/FunctionLibFunction.java#L224-L228
30,441
lucee/Lucee
core/src/main/java/lucee/transformer/library/function/FunctionLibFunction.java
FunctionLibFunction.setFunctionClass
public void setFunctionClass(String value, Identification id, Attributes attrs) { functionCD = ClassDefinitionImpl.toClassDefinition(value, id, attrs); }
java
public void setFunctionClass(String value, Identification id, Attributes attrs) { functionCD = ClassDefinitionImpl.toClassDefinition(value, id, attrs); }
[ "public", "void", "setFunctionClass", "(", "String", "value", ",", "Identification", "id", ",", "Attributes", "attrs", ")", "{", "functionCD", "=", "ClassDefinitionImpl", ".", "toClassDefinition", "(", "value", ",", "id", ",", "attrs", ")", ";", "}" ]
Setzt die Klassendefinition als Zeichenkette, welche diese Funktion implementiert. @param value Klassendefinition als Zeichenkette.
[ "Setzt", "die", "Klassendefinition", "als", "Zeichenkette", "welche", "diese", "Funktion", "implementiert", "." ]
29b153fc4e126e5edb97da937f2ee2e231b87593
https://github.com/lucee/Lucee/blob/29b153fc4e126e5edb97da937f2ee2e231b87593/core/src/main/java/lucee/transformer/library/function/FunctionLibFunction.java#L271-L274
30,442
lucee/Lucee
core/src/main/java/lucee/runtime/text/xml/XMLCaster.java
XMLCaster.toText
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)); }
java
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)); }
[ "public", "static", "Text", "toText", "(", "Document", "doc", ",", "Object", "o", ")", "throws", "PageException", "{", "if", "(", "o", "instanceof", "Text", ")", "return", "(", "Text", ")", "o", ";", "else", "if", "(", "o", "instanceof", "CharacterData",...
casts a value to a XML Text @param doc XML Document @param o Object to cast @return XML Text Object @throws PageException
[ "casts", "a", "value", "to", "a", "XML", "Text" ]
29b153fc4e126e5edb97da937f2ee2e231b87593
https://github.com/lucee/Lucee/blob/29b153fc4e126e5edb97da937f2ee2e231b87593/core/src/main/java/lucee/runtime/text/xml/XMLCaster.java#L86-L90
30,443
lucee/Lucee
core/src/main/java/lucee/runtime/text/xml/XMLCaster.java
XMLCaster.toTextArray
public static Text[] toTextArray(Document doc, Object o) throws PageException { // Node[] 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++) { textes[i] = toText(doc, nodes[i]); } return textes; } // Collection else if (o instanceof Collection) { Collection coll = (Collection) o; Iterator<Object> it = coll.valueIterator(); List<Text> textes = new ArrayList<Text>(); while (it.hasNext()) { textes.add(toText(doc, it.next())); } return textes.toArray(new Text[textes.size()]); } // Node Map and List Node[] nodes = _toNodeArray(doc, o); if (nodes != null) return toTextArray(doc, nodes); // Single Text Node try { return new Text[] { toText(doc, o) }; } catch (ExpressionException e) { throw new XMLException("can't cast Object of type " + Caster.toClassName(o) + " to a XML Text Array"); } }
java
public static Text[] toTextArray(Document doc, Object o) throws PageException { // Node[] 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++) { textes[i] = toText(doc, nodes[i]); } return textes; } // Collection else if (o instanceof Collection) { Collection coll = (Collection) o; Iterator<Object> it = coll.valueIterator(); List<Text> textes = new ArrayList<Text>(); while (it.hasNext()) { textes.add(toText(doc, it.next())); } return textes.toArray(new Text[textes.size()]); } // Node Map and List Node[] nodes = _toNodeArray(doc, o); if (nodes != null) return toTextArray(doc, nodes); // Single Text Node try { return new Text[] { toText(doc, o) }; } catch (ExpressionException e) { throw new XMLException("can't cast Object of type " + Caster.toClassName(o) + " to a XML Text Array"); } }
[ "public", "static", "Text", "[", "]", "toTextArray", "(", "Document", "doc", ",", "Object", "o", ")", "throws", "PageException", "{", "// Node[]", "if", "(", "o", "instanceof", "Node", "[", "]", ")", "{", "Node", "[", "]", "nodes", "=", "(", "Node", ...
casts a value to a XML Text Array @param doc XML Document @param o Object to cast @return XML Text Array @throws PageException
[ "casts", "a", "value", "to", "a", "XML", "Text", "Array" ]
29b153fc4e126e5edb97da937f2ee2e231b87593
https://github.com/lucee/Lucee/blob/29b153fc4e126e5edb97da937f2ee2e231b87593/core/src/main/java/lucee/runtime/text/xml/XMLCaster.java#L106-L138
30,444
lucee/Lucee
core/src/main/java/lucee/runtime/text/xml/XMLCaster.java
XMLCaster.toAttr
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.getKey().getString()); attr.setValue(Caster.toString(e.getValue())); return attr; } throw new XMLException("can't cast Object of type " + Caster.toClassName(o) + " to a XML Attribute"); }
java
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.getKey().getString()); attr.setValue(Caster.toString(e.getValue())); return attr; } throw new XMLException("can't cast Object of type " + Caster.toClassName(o) + " to a XML Attribute"); }
[ "public", "static", "Attr", "toAttr", "(", "Document", "doc", ",", "Object", "o", ")", "throws", "PageException", "{", "if", "(", "o", "instanceof", "Attr", ")", "return", "(", "Attr", ")", "o", ";", "if", "(", "o", "instanceof", "Struct", "&&", "(", ...
casts a value to a XML Attribute Object @param doc XML Document @param o Object to cast @return XML Comment Object @throws PageException
[ "casts", "a", "value", "to", "a", "XML", "Attribute", "Object" ]
29b153fc4e126e5edb97da937f2ee2e231b87593
https://github.com/lucee/Lucee/blob/29b153fc4e126e5edb97da937f2ee2e231b87593/core/src/main/java/lucee/runtime/text/xml/XMLCaster.java#L148-L159
30,445
lucee/Lucee
core/src/main/java/lucee/runtime/text/xml/XMLCaster.java
XMLCaster.toAttrArray
public static Attr[] toAttrArray(Document doc, Object o) throws PageException { // Node[] 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.length; i++) { attres[i] = toAttr(doc, nodes[i]); } return attres; } // Collection else if (o instanceof Collection) { Collection coll = (Collection) o; Iterator<Entry<Key, Object>> it = coll.entryIterator(); Entry<Key, Object> e; List<Attr> attres = new ArrayList<Attr>(); Attr attr; Collection.Key k; while (it.hasNext()) { e = it.next(); k = e.getKey(); attr = doc.createAttribute(Decision.isNumber(k.getString()) ? "attribute-" + k.getString() : k.getString()); attr.setValue(Caster.toString(e.getValue())); attres.add(attr); } return attres.toArray(new Attr[attres.size()]); } // Node Map and List Node[] nodes = _toNodeArray(doc, o); if (nodes != null) return toAttrArray(doc, nodes); // Single Text Node try { return new Attr[] { toAttr(doc, o) }; } catch (ExpressionException e) { throw new XMLException("can't cast Object of type " + Caster.toClassName(o) + " to a XML Attributes Array"); } }
java
public static Attr[] toAttrArray(Document doc, Object o) throws PageException { // Node[] 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.length; i++) { attres[i] = toAttr(doc, nodes[i]); } return attres; } // Collection else if (o instanceof Collection) { Collection coll = (Collection) o; Iterator<Entry<Key, Object>> it = coll.entryIterator(); Entry<Key, Object> e; List<Attr> attres = new ArrayList<Attr>(); Attr attr; Collection.Key k; while (it.hasNext()) { e = it.next(); k = e.getKey(); attr = doc.createAttribute(Decision.isNumber(k.getString()) ? "attribute-" + k.getString() : k.getString()); attr.setValue(Caster.toString(e.getValue())); attres.add(attr); } return attres.toArray(new Attr[attres.size()]); } // Node Map and List Node[] nodes = _toNodeArray(doc, o); if (nodes != null) return toAttrArray(doc, nodes); // Single Text Node try { return new Attr[] { toAttr(doc, o) }; } catch (ExpressionException e) { throw new XMLException("can't cast Object of type " + Caster.toClassName(o) + " to a XML Attributes Array"); } }
[ "public", "static", "Attr", "[", "]", "toAttrArray", "(", "Document", "doc", ",", "Object", "o", ")", "throws", "PageException", "{", "// Node[]", "if", "(", "o", "instanceof", "Node", "[", "]", ")", "{", "Node", "[", "]", "nodes", "=", "(", "Node", ...
casts a value to a XML Attr Array @param doc XML Document @param o Object to cast @return XML Attr Array @throws PageException
[ "casts", "a", "value", "to", "a", "XML", "Attr", "Array" ]
29b153fc4e126e5edb97da937f2ee2e231b87593
https://github.com/lucee/Lucee/blob/29b153fc4e126e5edb97da937f2ee2e231b87593/core/src/main/java/lucee/runtime/text/xml/XMLCaster.java#L169-L208
30,446
lucee/Lucee
core/src/main/java/lucee/runtime/text/xml/XMLCaster.java
XMLCaster.toComment
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)); }
java
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)); }
[ "public", "static", "Comment", "toComment", "(", "Document", "doc", ",", "Object", "o", ")", "throws", "PageException", "{", "if", "(", "o", "instanceof", "Comment", ")", "return", "(", "Comment", ")", "o", ";", "else", "if", "(", "o", "instanceof", "Cha...
casts a value to a XML Comment Object @param doc XML Document @param o Object to cast @return XML Comment Object @throws PageException
[ "casts", "a", "value", "to", "a", "XML", "Comment", "Object" ]
29b153fc4e126e5edb97da937f2ee2e231b87593
https://github.com/lucee/Lucee/blob/29b153fc4e126e5edb97da937f2ee2e231b87593/core/src/main/java/lucee/runtime/text/xml/XMLCaster.java#L218-L222
30,447
lucee/Lucee
core/src/main/java/lucee/runtime/text/xml/XMLCaster.java
XMLCaster.toCommentArray
public static Comment[] toCommentArray(Document doc, Object o) throws PageException { // Node[] 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 < nodes.length; i++) { comments[i] = toComment(doc, nodes[i]); } return comments; } // Collection else if (o instanceof Collection) { Collection coll = (Collection) o; Iterator<Object> it = coll.valueIterator(); List<Comment> comments = new ArrayList<Comment>(); while (it.hasNext()) { comments.add(toComment(doc, it.next())); } return comments.toArray(new Comment[comments.size()]); } // Node Map and List Node[] nodes = _toNodeArray(doc, o); if (nodes != null) return toCommentArray(doc, nodes); // Single Text Node try { return new Comment[] { toComment(doc, o) }; } catch (ExpressionException e) { throw new XMLException("can't cast Object of type " + Caster.toClassName(o) + " to a XML Comment Array"); } }
java
public static Comment[] toCommentArray(Document doc, Object o) throws PageException { // Node[] 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 < nodes.length; i++) { comments[i] = toComment(doc, nodes[i]); } return comments; } // Collection else if (o instanceof Collection) { Collection coll = (Collection) o; Iterator<Object> it = coll.valueIterator(); List<Comment> comments = new ArrayList<Comment>(); while (it.hasNext()) { comments.add(toComment(doc, it.next())); } return comments.toArray(new Comment[comments.size()]); } // Node Map and List Node[] nodes = _toNodeArray(doc, o); if (nodes != null) return toCommentArray(doc, nodes); // Single Text Node try { return new Comment[] { toComment(doc, o) }; } catch (ExpressionException e) { throw new XMLException("can't cast Object of type " + Caster.toClassName(o) + " to a XML Comment Array"); } }
[ "public", "static", "Comment", "[", "]", "toCommentArray", "(", "Document", "doc", ",", "Object", "o", ")", "throws", "PageException", "{", "// Node[]", "if", "(", "o", "instanceof", "Node", "[", "]", ")", "{", "Node", "[", "]", "nodes", "=", "(", "Nod...
casts a value to a XML Comment Array @param doc XML Document @param o Object to cast @return XML Comment Array @throws PageException
[ "casts", "a", "value", "to", "a", "XML", "Comment", "Array" ]
29b153fc4e126e5edb97da937f2ee2e231b87593
https://github.com/lucee/Lucee/blob/29b153fc4e126e5edb97da937f2ee2e231b87593/core/src/main/java/lucee/runtime/text/xml/XMLCaster.java#L232-L264
30,448
lucee/Lucee
core/src/main/java/lucee/runtime/text/xml/XMLCaster.java
XMLCaster.toElement
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)); }
java
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)); }
[ "public", "static", "Element", "toElement", "(", "Document", "doc", ",", "Object", "o", ")", "throws", "PageException", "{", "if", "(", "o", "instanceof", "Element", ")", "return", "(", "Element", ")", "o", ";", "else", "if", "(", "o", "instanceof", "Nod...
casts a value to a XML Element @param doc XML Document @param o Object to cast @return XML Element Object @throws PageException
[ "casts", "a", "value", "to", "a", "XML", "Element" ]
29b153fc4e126e5edb97da937f2ee2e231b87593
https://github.com/lucee/Lucee/blob/29b153fc4e126e5edb97da937f2ee2e231b87593/core/src/main/java/lucee/runtime/text/xml/XMLCaster.java#L274-L278
30,449
lucee/Lucee
core/src/main/java/lucee/runtime/text/xml/XMLCaster.java
XMLCaster.toNode
@Deprecated 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"); }
java
@Deprecated 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"); }
[ "@", "Deprecated", "public", "static", "Node", "toNode", "(", "Object", "o", ")", "throws", "PageException", "{", "if", "(", "o", "instanceof", "XMLStruct", ")", "return", "(", "(", "XMLStruct", ")", "o", ")", ".", "toNode", "(", ")", ";", "if", "(", ...
casts a value to a XML Node @param doc XML Document @param o Object to cast @return XML Element Object @throws PageException @deprecated replaced with toRawNode
[ "casts", "a", "value", "to", "a", "XML", "Node" ]
29b153fc4e126e5edb97da937f2ee2e231b87593
https://github.com/lucee/Lucee/blob/29b153fc4e126e5edb97da937f2ee2e231b87593/core/src/main/java/lucee/runtime/text/xml/XMLCaster.java#L331-L336
30,450
lucee/Lucee
core/src/main/java/lucee/runtime/text/xml/XMLCaster.java
XMLCaster.toNode
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(doc, o); throw new ExpressionException("invalid node type definition"); }
java
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(doc, o); throw new ExpressionException("invalid node type definition"); }
[ "public", "static", "Node", "toNode", "(", "Document", "doc", ",", "Object", "o", ",", "short", "type", ")", "throws", "PageException", "{", "if", "(", "Node", ".", "TEXT_NODE", "==", "type", ")", "toText", "(", "doc", ",", "o", ")", ";", "else", "if...
casts a value to a XML Object defined by type parameter @param doc XML Document @param o Object to cast @param type type to cast to @return XML Text Object @throws PageException
[ "casts", "a", "value", "to", "a", "XML", "Object", "defined", "by", "type", "parameter" ]
29b153fc4e126e5edb97da937f2ee2e231b87593
https://github.com/lucee/Lucee/blob/29b153fc4e126e5edb97da937f2ee2e231b87593/core/src/main/java/lucee/runtime/text/xml/XMLCaster.java#L406-L414
30,451
lucee/Lucee
core/src/main/java/lucee/runtime/text/xml/XMLCaster.java
XMLCaster.toNodeArray
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_NODE == type) toElementArray(doc, o); throw new ExpressionException("invalid node type definition"); }
java
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_NODE == type) toElementArray(doc, o); throw new ExpressionException("invalid node type definition"); }
[ "public", "static", "Node", "[", "]", "toNodeArray", "(", "Document", "doc", ",", "Object", "o", ",", "short", "type", ")", "throws", "PageException", "{", "if", "(", "Node", ".", "TEXT_NODE", "==", "type", ")", "toTextArray", "(", "doc", ",", "o", ")"...
casts a value to a XML Object Array defined by type parameter @param doc XML Document @param o Object to cast @param type type to cast to @return XML Node Array Object @throws PageException
[ "casts", "a", "value", "to", "a", "XML", "Object", "Array", "defined", "by", "type", "parameter" ]
29b153fc4e126e5edb97da937f2ee2e231b87593
https://github.com/lucee/Lucee/blob/29b153fc4e126e5edb97da937f2ee2e231b87593/core/src/main/java/lucee/runtime/text/xml/XMLCaster.java#L425-L433
30,452
lucee/Lucee
core/src/main/java/lucee/runtime/text/xml/XMLCaster.java
XMLCaster.writeTo
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.toPageException(ioe); } finally { IOUtil.closeEL(os); } }
java
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.toPageException(ioe); } finally { IOUtil.closeEL(os); } }
[ "public", "static", "void", "writeTo", "(", "Node", "node", ",", "Resource", "file", ")", "throws", "PageException", "{", "OutputStream", "os", "=", "null", ";", "try", "{", "os", "=", "IOUtil", ".", "toBufferedOutputStream", "(", "file", ".", "getOutputStre...
write a xml Dom to a file @param node @param file @throws PageException
[ "write", "a", "xml", "Dom", "to", "a", "file" ]
29b153fc4e126e5edb97da937f2ee2e231b87593
https://github.com/lucee/Lucee/blob/29b153fc4e126e5edb97da937f2ee2e231b87593/core/src/main/java/lucee/runtime/text/xml/XMLCaster.java#L518-L530
30,453
lucee/Lucee
core/src/main/java/lucee/runtime/text/xml/XMLCaster.java
XMLCaster._toNodeArray
private static Node[] _toNodeArray(Document doc, Object o) { if (o instanceof Node) return new Node[] { (Node) o }; // Node[] if (o instanceof Node[]) return ((Node[]) o); // NamedNodeMap else if (o instanceof NamedNodeMap) { NamedNodeMap map = (NamedNodeMap) o; int len = map.getLength(); Node[] nodes = new Node[len]; for (int i = 0; i < len; i++) { nodes[i] = map.item(i); } return nodes; } // XMLAttributes else if (o instanceof XMLAttributes) { return _toNodeArray(doc, ((XMLAttributes) o).toNamedNodeMap()); } // NodeList else if (o instanceof NodeList) { NodeList list = (NodeList) o; int len = list.getLength(); Node[] nodes = new Node[len]; for (int i = 0; i < nodes.length; i++) { nodes[i] = list.item(i); } return nodes; } return null; }
java
private static Node[] _toNodeArray(Document doc, Object o) { if (o instanceof Node) return new Node[] { (Node) o }; // Node[] if (o instanceof Node[]) return ((Node[]) o); // NamedNodeMap else if (o instanceof NamedNodeMap) { NamedNodeMap map = (NamedNodeMap) o; int len = map.getLength(); Node[] nodes = new Node[len]; for (int i = 0; i < len; i++) { nodes[i] = map.item(i); } return nodes; } // XMLAttributes else if (o instanceof XMLAttributes) { return _toNodeArray(doc, ((XMLAttributes) o).toNamedNodeMap()); } // NodeList else if (o instanceof NodeList) { NodeList list = (NodeList) o; int len = list.getLength(); Node[] nodes = new Node[len]; for (int i = 0; i < nodes.length; i++) { nodes[i] = list.item(i); } return nodes; } return null; }
[ "private", "static", "Node", "[", "]", "_toNodeArray", "(", "Document", "doc", ",", "Object", "o", ")", "{", "if", "(", "o", "instanceof", "Node", ")", "return", "new", "Node", "[", "]", "{", "(", "Node", ")", "o", "}", ";", "// Node[]", "if", "(",...
casts a value to a XML named Node Map @param doc XML Document @param o Object to cast @return XML named Node Map Object
[ "casts", "a", "value", "to", "a", "XML", "named", "Node", "Map" ]
29b153fc4e126e5edb97da937f2ee2e231b87593
https://github.com/lucee/Lucee/blob/29b153fc4e126e5edb97da937f2ee2e231b87593/core/src/main/java/lucee/runtime/text/xml/XMLCaster.java#L692-L721
30,454
lucee/Lucee
core/src/main/java/lucee/runtime/text/xml/XMLCaster.java
XMLCaster._isAllOfSameType
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; }
java
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; }
[ "private", "static", "boolean", "_isAllOfSameType", "(", "Node", "[", "]", "nodes", ",", "short", "type", ")", "{", "for", "(", "int", "i", "=", "0", ";", "i", "<", "nodes", ".", "length", ";", "i", "++", ")", "{", "if", "(", "nodes", "[", "i", ...
Check if all Node are of the type defnined by para,meter @param nodes nodes to check @param type to compare @return are all of the same type
[ "Check", "if", "all", "Node", "are", "of", "the", "type", "defnined", "by", "para", "meter" ]
29b153fc4e126e5edb97da937f2ee2e231b87593
https://github.com/lucee/Lucee/blob/29b153fc4e126e5edb97da937f2ee2e231b87593/core/src/main/java/lucee/runtime/text/xml/XMLCaster.java#L730-L735
30,455
lucee/Lucee
core/src/main/java/lucee/transformer/library/function/FunctionLibFunctionArg.java
FunctionLibFunctionArg.setRequired
public void setRequired(String value) { value = value.toLowerCase().trim(); required = (value.equals("yes") || value.equals("true")); }
java
public void setRequired(String value) { value = value.toLowerCase().trim(); required = (value.equals("yes") || value.equals("true")); }
[ "public", "void", "setRequired", "(", "String", "value", ")", "{", "value", "=", "value", ".", "toLowerCase", "(", ")", ".", "trim", "(", ")", ";", "required", "=", "(", "value", ".", "equals", "(", "\"yes\"", ")", "||", "value", ".", "equals", "(", ...
Setzt, ob das Argument Pflicht ist oder nicht. @param value Ist das Argument Pflicht.
[ "Setzt", "ob", "das", "Argument", "Pflicht", "ist", "oder", "nicht", "." ]
29b153fc4e126e5edb97da937f2ee2e231b87593
https://github.com/lucee/Lucee/blob/29b153fc4e126e5edb97da937f2ee2e231b87593/core/src/main/java/lucee/transformer/library/function/FunctionLibFunctionArg.java#L152-L155
30,456
lucee/Lucee
core/src/main/java/lucee/runtime/net/rpc/server/WSUtil.java
WSUtil.invoke
public static Object invoke(String name, Object[] args) throws PageException { return invoke(null, name, args); }
java
public static Object invoke(String name, Object[] args) throws PageException { return invoke(null, name, args); }
[ "public", "static", "Object", "invoke", "(", "String", "name", ",", "Object", "[", "]", "args", ")", "throws", "PageException", "{", "return", "invoke", "(", "null", ",", "name", ",", "args", ")", ";", "}" ]
used by genertaed bytecode
[ "used", "by", "genertaed", "bytecode" ]
29b153fc4e126e5edb97da937f2ee2e231b87593
https://github.com/lucee/Lucee/blob/29b153fc4e126e5edb97da937f2ee2e231b87593/core/src/main/java/lucee/runtime/net/rpc/server/WSUtil.java#L12-L14
30,457
lucee/Lucee
core/src/main/java/lucee/commons/sql/SQLUtil.java
SQLUtil.toBlob
public static Blob toBlob(Connection conn, Object value) throws PageException, SQLException { if (value instanceof Blob) return (Blob) value; // Java >= 1.6 if (SystemUtil.JAVA_VERSION >= SystemUtil.JAVA_VERSION_6) { try { Blob blob = conn.createBlob(); blob.setBytes(1, Caster.toBinary(value)); return blob; } catch (Throwable t) { ExceptionUtil.rethrowIfNecessary(t); return BlobImpl.toBlob(value); } } // Java < 1.6 if (isOracle(conn)) { Blob blob = OracleBlob.createBlob(conn, Caster.toBinary(value), null); if (blob != null) return blob; } return BlobImpl.toBlob(value); }
java
public static Blob toBlob(Connection conn, Object value) throws PageException, SQLException { if (value instanceof Blob) return (Blob) value; // Java >= 1.6 if (SystemUtil.JAVA_VERSION >= SystemUtil.JAVA_VERSION_6) { try { Blob blob = conn.createBlob(); blob.setBytes(1, Caster.toBinary(value)); return blob; } catch (Throwable t) { ExceptionUtil.rethrowIfNecessary(t); return BlobImpl.toBlob(value); } } // Java < 1.6 if (isOracle(conn)) { Blob blob = OracleBlob.createBlob(conn, Caster.toBinary(value), null); if (blob != null) return blob; } return BlobImpl.toBlob(value); }
[ "public", "static", "Blob", "toBlob", "(", "Connection", "conn", ",", "Object", "value", ")", "throws", "PageException", ",", "SQLException", "{", "if", "(", "value", "instanceof", "Blob", ")", "return", "(", "Blob", ")", "value", ";", "// Java >= 1.6", "if"...
create a blog Object @param conn @param value @return @throws PageException @throws SQLException
[ "create", "a", "blog", "Object" ]
29b153fc4e126e5edb97da937f2ee2e231b87593
https://github.com/lucee/Lucee/blob/29b153fc4e126e5edb97da937f2ee2e231b87593/core/src/main/java/lucee/commons/sql/SQLUtil.java#L124-L146
30,458
lucee/Lucee
core/src/main/java/lucee/commons/sql/SQLUtil.java
SQLUtil.toClob
public static Clob toClob(Connection conn, Object value) throws PageException, SQLException { if (value instanceof Clob) return (Clob) value; // Java >= 1.6 if (SystemUtil.JAVA_VERSION >= SystemUtil.JAVA_VERSION_6) { Clob clob = conn.createClob(); clob.setString(1, Caster.toString(value)); return clob; } // Java < 1.6 if (isOracle(conn)) { Clob clob = OracleClob.createClob(conn, Caster.toString(value), null); if (clob != null) return clob; } return ClobImpl.toClob(value); }
java
public static Clob toClob(Connection conn, Object value) throws PageException, SQLException { if (value instanceof Clob) return (Clob) value; // Java >= 1.6 if (SystemUtil.JAVA_VERSION >= SystemUtil.JAVA_VERSION_6) { Clob clob = conn.createClob(); clob.setString(1, Caster.toString(value)); return clob; } // Java < 1.6 if (isOracle(conn)) { Clob clob = OracleClob.createClob(conn, Caster.toString(value), null); if (clob != null) return clob; } return ClobImpl.toClob(value); }
[ "public", "static", "Clob", "toClob", "(", "Connection", "conn", ",", "Object", "value", ")", "throws", "PageException", ",", "SQLException", "{", "if", "(", "value", "instanceof", "Clob", ")", "return", "(", "Clob", ")", "value", ";", "// Java >= 1.6", "if"...
create a clob Object @param conn @param value @return @throws PageException @throws SQLException
[ "create", "a", "clob", "Object" ]
29b153fc4e126e5edb97da937f2ee2e231b87593
https://github.com/lucee/Lucee/blob/29b153fc4e126e5edb97da937f2ee2e231b87593/core/src/main/java/lucee/commons/sql/SQLUtil.java#L157-L172
30,459
lucee/Lucee
core/src/main/java/lucee/commons/date/DateTimeUtil.java
DateTimeUtil.toDateTime
public DateTime toDateTime(double days) { long utc = Math.round(days * DAY_MILLIS); utc -= CF_UNIX_OFFSET; utc -= getLocalTimeZoneOffset(utc); return new DateTimeImpl(utc, false); }
java
public DateTime toDateTime(double days) { long utc = Math.round(days * DAY_MILLIS); utc -= CF_UNIX_OFFSET; utc -= getLocalTimeZoneOffset(utc); return new DateTimeImpl(utc, false); }
[ "public", "DateTime", "toDateTime", "(", "double", "days", ")", "{", "long", "utc", "=", "Math", ".", "round", "(", "days", "*", "DAY_MILLIS", ")", ";", "utc", "-=", "CF_UNIX_OFFSET", ";", "utc", "-=", "getLocalTimeZoneOffset", "(", "utc", ")", ";", "ret...
returns a date time instance by a number, the conversion from the double to date is o the base of the CFML rules. @param days double value to convert to a number @return DateTime Instance
[ "returns", "a", "date", "time", "instance", "by", "a", "number", "the", "conversion", "from", "the", "double", "to", "date", "is", "o", "the", "base", "of", "the", "CFML", "rules", "." ]
29b153fc4e126e5edb97da937f2ee2e231b87593
https://github.com/lucee/Lucee/blob/29b153fc4e126e5edb97da937f2ee2e231b87593/core/src/main/java/lucee/commons/date/DateTimeUtil.java#L91-L96
30,460
lucee/Lucee
core/src/main/java/lucee/commons/date/DateTimeUtil.java
DateTimeUtil.toHTTPTimeString
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(HTTP_TIME_STRING_FORMAT.format(date), "+00:00", "", true); } }
java
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(HTTP_TIME_STRING_FORMAT.format(date), "+00:00", "", true); } }
[ "public", "static", "String", "toHTTPTimeString", "(", "Date", "date", ",", "boolean", "oldFormat", ")", "{", "if", "(", "oldFormat", ")", "{", "synchronized", "(", "HTTP_TIME_STRING_FORMAT_OLD", ")", "{", "return", "StringUtil", ".", "replace", "(", "HTTP_TIME_...
converts a date to a http time String @param date date to convert @param oldFormat "old" in that context means the format support the existing functionality in CFML like the function getHTTPTimeString, in that format the date parts are separated by a space (like "EE, dd MMM yyyy HH:mm:ss zz"), in the "new" format, the date part is separated by "-" (like "EE, dd-MMM-yyyy HH:mm:ss zz") @return
[ "converts", "a", "date", "to", "a", "http", "time", "String" ]
29b153fc4e126e5edb97da937f2ee2e231b87593
https://github.com/lucee/Lucee/blob/29b153fc4e126e5edb97da937f2ee2e231b87593/core/src/main/java/lucee/commons/date/DateTimeUtil.java#L279-L288
30,461
lucee/Lucee
core/src/main/java/lucee/commons/io/res/util/ResourceClassLoader.java
ResourceClassLoader.doURLs
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])); } return list.toArray(new URL[list.size()]); }
java
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])); } return list.toArray(new URL[list.size()]); }
[ "public", "static", "URL", "[", "]", "doURLs", "(", "Resource", "[", "]", "reses", ")", "throws", "IOException", "{", "List", "<", "URL", ">", "list", "=", "new", "ArrayList", "<", "URL", ">", "(", ")", ";", "for", "(", "int", "i", "=", "0", ";",...
translate resources to url Objects @param reses @return @throws PageException
[ "translate", "resources", "to", "url", "Objects" ]
29b153fc4e126e5edb97da937f2ee2e231b87593
https://github.com/lucee/Lucee/blob/29b153fc4e126e5edb97da937f2ee2e231b87593/core/src/main/java/lucee/commons/io/res/util/ResourceClassLoader.java#L82-L89
30,462
lucee/Lucee
core/src/main/java/lucee/runtime/schedule/SchedulerImpl.java
SchedulerImpl.readInAllTasks
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++) { Node n = children.item(i); if (n instanceof Element && n.getNodeName().equals("task")) { list.add(readInTask((Element) n)); } } return list.toArray(new ScheduleTaskImpl[list.size()]); }
java
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++) { Node n = children.item(i); if (n instanceof Element && n.getNodeName().equals("task")) { list.add(readInTask((Element) n)); } } return list.toArray(new ScheduleTaskImpl[list.size()]); }
[ "private", "ScheduleTaskImpl", "[", "]", "readInAllTasks", "(", ")", "throws", "PageException", "{", "Element", "root", "=", "doc", ".", "getDocumentElement", "(", ")", ";", "NodeList", "children", "=", "root", ".", "getChildNodes", "(", ")", ";", "ArrayList",...
read in all schedule tasks @return all schedule tasks @throws PageException
[ "read", "in", "all", "schedule", "tasks" ]
29b153fc4e126e5edb97da937f2ee2e231b87593
https://github.com/lucee/Lucee/blob/29b153fc4e126e5edb97da937f2ee2e231b87593/core/src/main/java/lucee/runtime/schedule/SchedulerImpl.java#L162-L175
30,463
lucee/Lucee
core/src/main/java/lucee/runtime/schedule/SchedulerImpl.java
SchedulerImpl.readInTask
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.toResource(config, el, "file"), su.toDate(config, el, "startDate"), su.toTime(config, el, "startTime"), su.toDate(config, el, "endDate"), su.toTime(config, el, "endTime"), su.toString(el, "url"), su.toInt(el, "port", -1), su.toString(el, "interval"), timeout, su.toCredentials(el, "username", "password"), ProxyDataImpl.getInstance(su.toString(el, "proxyHost"), su.toInt(el, "proxyPort", 80), su.toString(el, "proxyUser"), su.toString(el, "proxyPassword")), su.toBoolean(el, "resolveUrl"), su.toBoolean(el, "publish"), su.toBoolean(el, "hidden", false), su.toBoolean(el, "readonly", false), su.toBoolean(el, "paused", false), su.toBoolean(el, "autoDelete", false)); return st; } catch (Exception e) { SystemOut.printDate(e); throw Caster.toPageException(e); } }
java
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.toResource(config, el, "file"), su.toDate(config, el, "startDate"), su.toTime(config, el, "startTime"), su.toDate(config, el, "endDate"), su.toTime(config, el, "endTime"), su.toString(el, "url"), su.toInt(el, "port", -1), su.toString(el, "interval"), timeout, su.toCredentials(el, "username", "password"), ProxyDataImpl.getInstance(su.toString(el, "proxyHost"), su.toInt(el, "proxyPort", 80), su.toString(el, "proxyUser"), su.toString(el, "proxyPassword")), su.toBoolean(el, "resolveUrl"), su.toBoolean(el, "publish"), su.toBoolean(el, "hidden", false), su.toBoolean(el, "readonly", false), su.toBoolean(el, "paused", false), su.toBoolean(el, "autoDelete", false)); return st; } catch (Exception e) { SystemOut.printDate(e); throw Caster.toPageException(e); } }
[ "private", "ScheduleTaskImpl", "readInTask", "(", "Element", "el", ")", "throws", "PageException", "{", "long", "timeout", "=", "su", ".", "toLong", "(", "el", ",", "\"timeout\"", ")", ";", "if", "(", "timeout", ">", "0", "&&", "timeout", "<", "1000", ")...
read in a single task element @param el @return matching task to Element @throws PageException
[ "read", "in", "a", "single", "task", "element" ]
29b153fc4e126e5edb97da937f2ee2e231b87593
https://github.com/lucee/Lucee/blob/29b153fc4e126e5edb97da937f2ee2e231b87593/core/src/main/java/lucee/runtime/schedule/SchedulerImpl.java#L184-L201
30,464
lucee/Lucee
core/src/main/java/lucee/runtime/schedule/SchedulerImpl.java
SchedulerImpl.setAttributes
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.getTask()); su.setFile(el, "file", task.getResource()); su.setDateTime(el, "startDate", task.getStartDate()); su.setDateTime(el, "startTime", task.getStartTime()); su.setDateTime(el, "endDate", task.getEndDate()); su.setDateTime(el, "endTime", task.getEndTime()); su.setString(el, "url", task.getUrl().toExternalForm()); su.setInt(el, "port", task.getUrl().getPort()); su.setString(el, "interval", task.getIntervalAsString()); su.setInt(el, "timeout", (int) task.getTimeout()); su.setCredentials(el, "username", "password", task.getCredentials()); ProxyData pd = task.getProxyData(); su.setString(el, "proxyHost", StringUtil.emptyIfNull(pd == null ? "" : pd.getServer())); su.setString(el, "proxyUser", StringUtil.emptyIfNull(pd == null ? "" : pd.getUsername())); su.setString(el, "proxyPassword", StringUtil.emptyIfNull(pd == null ? "" : pd.getPassword())); su.setInt(el, "proxyPort", pd == null ? 0 : pd.getPort()); su.setBoolean(el, "resolveUrl", task.isResolveURL()); su.setBoolean(el, "publish", task.isPublish()); su.setBoolean(el, "hidden", ((ScheduleTaskImpl) task).isHidden()); su.setBoolean(el, "readonly", ((ScheduleTaskImpl) task).isReadonly()); su.setBoolean(el, "autoDelete", ((ScheduleTaskImpl) task).isAutoDelete()); }
java
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.getTask()); su.setFile(el, "file", task.getResource()); su.setDateTime(el, "startDate", task.getStartDate()); su.setDateTime(el, "startTime", task.getStartTime()); su.setDateTime(el, "endDate", task.getEndDate()); su.setDateTime(el, "endTime", task.getEndTime()); su.setString(el, "url", task.getUrl().toExternalForm()); su.setInt(el, "port", task.getUrl().getPort()); su.setString(el, "interval", task.getIntervalAsString()); su.setInt(el, "timeout", (int) task.getTimeout()); su.setCredentials(el, "username", "password", task.getCredentials()); ProxyData pd = task.getProxyData(); su.setString(el, "proxyHost", StringUtil.emptyIfNull(pd == null ? "" : pd.getServer())); su.setString(el, "proxyUser", StringUtil.emptyIfNull(pd == null ? "" : pd.getUsername())); su.setString(el, "proxyPassword", StringUtil.emptyIfNull(pd == null ? "" : pd.getPassword())); su.setInt(el, "proxyPort", pd == null ? 0 : pd.getPort()); su.setBoolean(el, "resolveUrl", task.isResolveURL()); su.setBoolean(el, "publish", task.isPublish()); su.setBoolean(el, "hidden", ((ScheduleTaskImpl) task).isHidden()); su.setBoolean(el, "readonly", ((ScheduleTaskImpl) task).isReadonly()); su.setBoolean(el, "autoDelete", ((ScheduleTaskImpl) task).isAutoDelete()); }
[ "private", "void", "setAttributes", "(", "Element", "el", ",", "ScheduleTask", "task", ")", "{", "if", "(", "el", "==", "null", ")", "return", ";", "NamedNodeMap", "atts", "=", "el", ".", "getAttributes", "(", ")", ";", "for", "(", "int", "i", "=", "...
sets all attributes in XML Element from Schedule Task @param el @param task
[ "sets", "all", "attributes", "in", "XML", "Element", "from", "Schedule", "Task" ]
29b153fc4e126e5edb97da937f2ee2e231b87593
https://github.com/lucee/Lucee/blob/29b153fc4e126e5edb97da937f2ee2e231b87593/core/src/main/java/lucee/runtime/schedule/SchedulerImpl.java#L229-L259
30,465
lucee/Lucee
core/src/main/java/lucee/runtime/schedule/SchedulerImpl.java
SchedulerImpl.toElement
private Element toElement(ScheduleTask task) { Element el = doc.createElement("task"); setAttributes(el, task); return el; }
java
private Element toElement(ScheduleTask task) { Element el = doc.createElement("task"); setAttributes(el, task); return el; }
[ "private", "Element", "toElement", "(", "ScheduleTask", "task", ")", "{", "Element", "el", "=", "doc", ".", "createElement", "(", "\"task\"", ")", ";", "setAttributes", "(", "el", ",", "task", ")", ";", "return", "el", ";", "}" ]
translate a schedule task object to a XML Element @param task schedule task to translate @return XML Element
[ "translate", "a", "schedule", "task", "object", "to", "a", "XML", "Element" ]
29b153fc4e126e5edb97da937f2ee2e231b87593
https://github.com/lucee/Lucee/blob/29b153fc4e126e5edb97da937f2ee2e231b87593/core/src/main/java/lucee/runtime/schedule/SchedulerImpl.java#L267-L271
30,466
lucee/Lucee
core/src/main/java/lucee/commons/io/log/log4j/appender/RollingResourceAppender.java
RollingResourceAppender.rollOver
public void rollOver() { Resource target; Resource file; if (qw != null) { long size = ((CountingQuietWriter) qw).getCount(); LogLog.debug("rolling over count=" + size); // if operation fails, do not roll again until // maxFileSize more bytes are written nextRollover = size + maxFileSize; } LogLog.debug("maxBackupIndex=" + maxBackupIndex); boolean renameSucceeded = true; Resource parent = res.getParentResource(); // If maxBackups <= 0, then there is no file renaming to be done. if (maxBackupIndex > 0) { // Delete the oldest file, to keep Windows happy. file = parent.getRealResource(res.getName() + "." + maxBackupIndex + ".bak"); if (file.exists()) renameSucceeded = file.delete(); // Map {(maxBackupIndex - 1), ..., 2, 1} to {maxBackupIndex, ..., 3, 2} for (int i = maxBackupIndex - 1; i >= 1 && renameSucceeded; i--) { file = parent.getRealResource(res.getName() + "." + i + ".bak"); if (file.exists()) { target = parent.getRealResource(res.getName() + "." + (i + 1) + ".bak"); LogLog.debug("Renaming file " + file + " to " + target); renameSucceeded = file.renameTo(target); } } if (renameSucceeded) { // Rename fileName to fileName.1 target = parent.getRealResource(res.getName() + ".1.bak"); this.closeFile(); // keep windows happy. file = res; LogLog.debug("Renaming file " + file + " to " + target); renameSucceeded = file.renameTo(target); // if file rename failed, reopen file with append = true if (!renameSucceeded) { try { this.setFile(true); } catch (IOException e) { LogLog.error("setFile(" + res + ", true) call failed.", e); } } } } // if all renames were successful, then if (renameSucceeded) { try { // This will also close the file. This is OK since multiple // close operations are safe. this.setFile(false); nextRollover = 0; } catch (IOException e) { LogLog.error("setFile(" + res + ", false) call failed.", e); } } }
java
public void rollOver() { Resource target; Resource file; if (qw != null) { long size = ((CountingQuietWriter) qw).getCount(); LogLog.debug("rolling over count=" + size); // if operation fails, do not roll again until // maxFileSize more bytes are written nextRollover = size + maxFileSize; } LogLog.debug("maxBackupIndex=" + maxBackupIndex); boolean renameSucceeded = true; Resource parent = res.getParentResource(); // If maxBackups <= 0, then there is no file renaming to be done. if (maxBackupIndex > 0) { // Delete the oldest file, to keep Windows happy. file = parent.getRealResource(res.getName() + "." + maxBackupIndex + ".bak"); if (file.exists()) renameSucceeded = file.delete(); // Map {(maxBackupIndex - 1), ..., 2, 1} to {maxBackupIndex, ..., 3, 2} for (int i = maxBackupIndex - 1; i >= 1 && renameSucceeded; i--) { file = parent.getRealResource(res.getName() + "." + i + ".bak"); if (file.exists()) { target = parent.getRealResource(res.getName() + "." + (i + 1) + ".bak"); LogLog.debug("Renaming file " + file + " to " + target); renameSucceeded = file.renameTo(target); } } if (renameSucceeded) { // Rename fileName to fileName.1 target = parent.getRealResource(res.getName() + ".1.bak"); this.closeFile(); // keep windows happy. file = res; LogLog.debug("Renaming file " + file + " to " + target); renameSucceeded = file.renameTo(target); // if file rename failed, reopen file with append = true if (!renameSucceeded) { try { this.setFile(true); } catch (IOException e) { LogLog.error("setFile(" + res + ", true) call failed.", e); } } } } // if all renames were successful, then if (renameSucceeded) { try { // This will also close the file. This is OK since multiple // close operations are safe. this.setFile(false); nextRollover = 0; } catch (IOException e) { LogLog.error("setFile(" + res + ", false) call failed.", e); } } }
[ "public", "void", "rollOver", "(", ")", "{", "Resource", "target", ";", "Resource", "file", ";", "if", "(", "qw", "!=", "null", ")", "{", "long", "size", "=", "(", "(", "CountingQuietWriter", ")", "qw", ")", ".", "getCount", "(", ")", ";", "LogLog", ...
Implements the usual roll over behavior. <p> If <code>MaxBackupIndex</code> is positive, then files {<code>File.1</code>, ..., <code>File.MaxBackupIndex -1</code>} are renamed to {<code>File.2</code>, ..., <code>File.MaxBackupIndex</code>}. Moreover, <code>File</code> is renamed <code>File.1</code> and closed. A new <code>File</code> is created to receive further log output. <p> If <code>MaxBackupIndex</code> is equal to zero, then the <code>File</code> is truncated with no backup files created.
[ "Implements", "the", "usual", "roll", "over", "behavior", "." ]
29b153fc4e126e5edb97da937f2ee2e231b87593
https://github.com/lucee/Lucee/blob/29b153fc4e126e5edb97da937f2ee2e231b87593/core/src/main/java/lucee/commons/io/log/log4j/appender/RollingResourceAppender.java#L112-L181
30,467
lucee/Lucee
core/src/main/java/lucee/commons/io/log/log4j/appender/RollingResourceAppender.java
RollingResourceAppender.subAppend
@Override protected void subAppend(LoggingEvent event) { super.subAppend(event); if (res != null && qw != null) { long size = ((CountingQuietWriter) qw).getCount(); if (size >= maxFileSize && size >= nextRollover) { rollOver(); } } }
java
@Override protected void subAppend(LoggingEvent event) { super.subAppend(event); if (res != null && qw != null) { long size = ((CountingQuietWriter) qw).getCount(); if (size >= maxFileSize && size >= nextRollover) { rollOver(); } } }
[ "@", "Override", "protected", "void", "subAppend", "(", "LoggingEvent", "event", ")", "{", "super", ".", "subAppend", "(", "event", ")", ";", "if", "(", "res", "!=", "null", "&&", "qw", "!=", "null", ")", "{", "long", "size", "=", "(", "(", "Counting...
This method differentiates RollingFileAppender from its super class. @since 0.9.0
[ "This", "method", "differentiates", "RollingFileAppender", "from", "its", "super", "class", "." ]
29b153fc4e126e5edb97da937f2ee2e231b87593
https://github.com/lucee/Lucee/blob/29b153fc4e126e5edb97da937f2ee2e231b87593/core/src/main/java/lucee/commons/io/log/log4j/appender/RollingResourceAppender.java#L214-L223
30,468
lucee/Lucee
core/src/main/java/lucee/runtime/err/ErrorPagePool.java
ErrorPagePool.getErrorPage
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; } else return ep; } } return null; }
java
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; } else return ep; } } return null; }
[ "public", "ErrorPage", "getErrorPage", "(", "PageException", "pe", ",", "short", "type", ")", "{", "for", "(", "int", "i", "=", "pages", ".", "size", "(", ")", "-", "1", ";", "i", ">=", "0", ";", "i", "--", ")", "{", "ErrorPageImpl", "ep", "=", "...
returns the error page @param pe Page Exception @return
[ "returns", "the", "error", "page" ]
29b153fc4e126e5edb97da937f2ee2e231b87593
https://github.com/lucee/Lucee/blob/29b153fc4e126e5edb97da937f2ee2e231b87593/core/src/main/java/lucee/runtime/err/ErrorPagePool.java#L49-L61
30,469
lucee/Lucee
core/src/main/java/lucee/runtime/err/ErrorPagePool.java
ErrorPagePool.removeErrorPage
public void removeErrorPage(PageException pe) { // exception ErrorPage ep = getErrorPage(pe, ErrorPage.TYPE_EXCEPTION); if (ep != null) { pages.remove(ep); hasChanged = true; } // request ep = getErrorPage(pe, ErrorPage.TYPE_REQUEST); if (ep != null) { pages.remove(ep); hasChanged = true; } // validation ep = getErrorPage(pe, ErrorPage.TYPE_VALIDATION); if (ep != null) { pages.remove(ep); hasChanged = true; } }
java
public void removeErrorPage(PageException pe) { // exception ErrorPage ep = getErrorPage(pe, ErrorPage.TYPE_EXCEPTION); if (ep != null) { pages.remove(ep); hasChanged = true; } // request ep = getErrorPage(pe, ErrorPage.TYPE_REQUEST); if (ep != null) { pages.remove(ep); hasChanged = true; } // validation ep = getErrorPage(pe, ErrorPage.TYPE_VALIDATION); if (ep != null) { pages.remove(ep); hasChanged = true; } }
[ "public", "void", "removeErrorPage", "(", "PageException", "pe", ")", "{", "// exception", "ErrorPage", "ep", "=", "getErrorPage", "(", "pe", ",", "ErrorPage", ".", "TYPE_EXCEPTION", ")", ";", "if", "(", "ep", "!=", "null", ")", "{", "pages", ".", "remove"...
remove this error page @param type
[ "remove", "this", "error", "page" ]
29b153fc4e126e5edb97da937f2ee2e231b87593
https://github.com/lucee/Lucee/blob/29b153fc4e126e5edb97da937f2ee2e231b87593/core/src/main/java/lucee/runtime/err/ErrorPagePool.java#L78-L98
30,470
lucee/Lucee
core/src/main/java/lucee/commons/lang/HTMLEntities.java
HTMLEntities.escapeHTML
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 = HTML32_DATA; offset = HTML32_OFFSET; } else { data = HTML40_DATA; offset = HTML40_OFFSET; } outer: for (int i = 0; i < chars.length; i++) { char c = chars[i]; if (c == CR) continue;// for compatibility to ACF for (int y = 0; y < offset.length; y++) { if (c >= offset[y] && c < data[y].length + offset[y]) { String replacement = data[y][c - offset[y]]; if (replacement != null) { rtn.append('&'); rtn.append(replacement); rtn.append(';'); continue outer; } } } rtn.append(c); } return rtn.toString(); }
java
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 = HTML32_DATA; offset = HTML32_OFFSET; } else { data = HTML40_DATA; offset = HTML40_OFFSET; } outer: for (int i = 0; i < chars.length; i++) { char c = chars[i]; if (c == CR) continue;// for compatibility to ACF for (int y = 0; y < offset.length; y++) { if (c >= offset[y] && c < data[y].length + offset[y]) { String replacement = data[y][c - offset[y]]; if (replacement != null) { rtn.append('&'); rtn.append(replacement); rtn.append(';'); continue outer; } } } rtn.append(c); } return rtn.toString(); }
[ "public", "static", "String", "escapeHTML", "(", "String", "str", ",", "short", "version", ")", "{", "String", "[", "]", "[", "]", "data", ";", "int", "[", "]", "offset", ";", "StringBuilder", "rtn", "=", "new", "StringBuilder", "(", "str", ".", "lengt...
escapes html character inside a string @param str html code to escape @param version HTML Version () @return escaped html code
[ "escapes", "html", "character", "inside", "a", "string" ]
29b153fc4e126e5edb97da937f2ee2e231b87593
https://github.com/lucee/Lucee/blob/29b153fc4e126e5edb97da937f2ee2e231b87593/core/src/main/java/lucee/commons/lang/HTMLEntities.java#L357-L394
30,471
lucee/Lucee
core/src/main/java/lucee/commons/lang/HTMLEntities.java
HTMLEntities.unescapeHTML
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.append(str.substring(last, posStart)); if (posStart + 1 < posFinish) { rtn.append(unescapeHTMLEntity(str.substring(posStart + 1, posFinish))); } else { rtn.append("&;"); } posStart = posFinish + 1; } rtn.append(str.substring(posFinish + 1)); return rtn.toString(); }
java
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.append(str.substring(last, posStart)); if (posStart + 1 < posFinish) { rtn.append(unescapeHTMLEntity(str.substring(posStart + 1, posFinish))); } else { rtn.append("&;"); } posStart = posFinish + 1; } rtn.append(str.substring(posFinish + 1)); return rtn.toString(); }
[ "public", "static", "String", "unescapeHTML", "(", "String", "str", ")", "{", "StringBuilder", "rtn", "=", "new", "StringBuilder", "(", ")", ";", "int", "posStart", "=", "-", "1", ";", "int", "posFinish", "=", "-", "1", ";", "while", "(", "(", "posStar...
unescapes html character inside a string @param str html code to unescape @return unescaped html code
[ "unescapes", "html", "character", "inside", "a", "string" ]
29b153fc4e126e5edb97da937f2ee2e231b87593
https://github.com/lucee/Lucee/blob/29b153fc4e126e5edb97da937f2ee2e231b87593/core/src/main/java/lucee/commons/lang/HTMLEntities.java#L402-L424
30,472
lucee/Lucee
core/src/main/java/lucee/runtime/reflection/Reflector.java
Reflector.getClasses
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; }
java
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; }
[ "public", "static", "Class", "[", "]", "getClasses", "(", "Object", "[", "]", "objs", ")", "{", "Class", "[", "]", "cls", "=", "new", "Class", "[", "objs", ".", "length", "]", ";", "for", "(", "int", "i", "=", "0", ";", "i", "<", "objs", ".", ...
get all Classes from a Object Array @param objs Objects to get @return classes from Objects
[ "get", "all", "Classes", "from", "a", "Object", "Array" ]
29b153fc4e126e5edb97da937f2ee2e231b87593
https://github.com/lucee/Lucee/blob/29b153fc4e126e5edb97da937f2ee2e231b87593/core/src/main/java/lucee/runtime/reflection/Reflector.java#L207-L214
30,473
lucee/Lucee
core/src/main/java/lucee/runtime/reflection/Reflector.java
Reflector.getDspMethods
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(); }
java
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(); }
[ "public", "static", "String", "getDspMethods", "(", "Class", "...", "clazzArgs", ")", "{", "StringBuffer", "sb", "=", "new", "StringBuffer", "(", ")", ";", "for", "(", "int", "i", "=", "0", ";", "i", "<", "clazzArgs", ".", "length", ";", "i", "++", "...
creates a string list with class arguments in a displable form @param clazzArgs arguments to display @return list
[ "creates", "a", "string", "list", "with", "class", "arguments", "in", "a", "displable", "form" ]
29b153fc4e126e5edb97da937f2ee2e231b87593
https://github.com/lucee/Lucee/blob/29b153fc4e126e5edb97da937f2ee2e231b87593/core/src/main/java/lucee/runtime/reflection/Reflector.java#L242-L249
30,474
lucee/Lucee
core/src/main/java/lucee/runtime/reflection/Reflector.java
Reflector.like
public static boolean like(Class src, Class trg) { if (src == trg) return true; return isInstaneOf(src, trg); }
java
public static boolean like(Class src, Class trg) { if (src == trg) return true; return isInstaneOf(src, trg); }
[ "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 @param src Source Class @param trg Target Class @return is similar
[ "checks", "if", "src", "Class", "is", "like", "trg", "class" ]
29b153fc4e126e5edb97da937f2ee2e231b87593
https://github.com/lucee/Lucee/blob/29b153fc4e126e5edb97da937f2ee2e231b87593/core/src/main/java/lucee/runtime/reflection/Reflector.java#L258-L261
30,475
lucee/Lucee
core/src/main/java/lucee/runtime/reflection/Reflector.java
Reflector.convert
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(src.getClass(), trg.getClass())) { rating.plus(9); return trg; } if (src.equals(trg)) { rating.plus(8); return trg; } // different number boolean bothNumbers = src instanceof Number && trg instanceof Number; if (bothNumbers && ((Number) src).doubleValue() == ((Number) trg).doubleValue()) { rating.plus(7); return trg; } String sSrc = Caster.toString(src, null); String sTrg = Caster.toString(trg, null); if (sSrc != null && sTrg != null) { // different number types if (src instanceof Number && trg instanceof Number && sSrc.equals(sTrg)) { rating.plus(6); return trg; } // looks the same if (sSrc.equals(sTrg)) { rating.plus(5); return trg; } if (sSrc.equalsIgnoreCase(sTrg)) { rating.plus(4); return trg; } } // CF Equal try { if (Operator.equals(src, trg, false, true)) { rating.plus(3); return trg; } } catch (Throwable t) { ExceptionUtil.rethrowIfNecessary(t); } return trg; } return _convert(src, trgClass); }
java
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(src.getClass(), trg.getClass())) { rating.plus(9); return trg; } if (src.equals(trg)) { rating.plus(8); return trg; } // different number boolean bothNumbers = src instanceof Number && trg instanceof Number; if (bothNumbers && ((Number) src).doubleValue() == ((Number) trg).doubleValue()) { rating.plus(7); return trg; } String sSrc = Caster.toString(src, null); String sTrg = Caster.toString(trg, null); if (sSrc != null && sTrg != null) { // different number types if (src instanceof Number && trg instanceof Number && sSrc.equals(sTrg)) { rating.plus(6); return trg; } // looks the same if (sSrc.equals(sTrg)) { rating.plus(5); return trg; } if (sSrc.equalsIgnoreCase(sTrg)) { rating.plus(4); return trg; } } // CF Equal try { if (Operator.equals(src, trg, false, true)) { rating.plus(3); return trg; } } catch (Throwable t) { ExceptionUtil.rethrowIfNecessary(t); } return trg; } return _convert(src, trgClass); }
[ "public", "static", "Object", "convert", "(", "Object", "src", ",", "Class", "trgClass", ",", "RefInteger", "rating", ")", "throws", "PageException", "{", "if", "(", "rating", "!=", "null", ")", "{", "Object", "trg", "=", "_convert", "(", "src", ",", "tr...
convert Object from src to trg Type, if possible @param src Object to convert @param srcClass Source Class @param trgClass Target Class @return converted Object @throws PageException
[ "convert", "Object", "from", "src", "to", "trg", "Type", "if", "possible" ]
29b153fc4e126e5edb97da937f2ee2e231b87593
https://github.com/lucee/Lucee/blob/29b153fc4e126e5edb97da937f2ee2e231b87593/core/src/main/java/lucee/runtime/reflection/Reflector.java#L272-L334
30,476
lucee/Lucee
core/src/main/java/lucee/runtime/reflection/Reflector.java
Reflector.getConstructorInstance
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() + "(" + getDspMethods(getClasses(args)) + ") found"); }
java
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() + "(" + getDspMethods(getClasses(args)) + ") found"); }
[ "public", "static", "ConstructorInstance", "getConstructorInstance", "(", "Class", "clazz", ",", "Object", "[", "]", "args", ")", "throws", "NoSuchMethodException", "{", "ConstructorInstance", "ci", "=", "getConstructorInstance", "(", "clazz", ",", "args", ",", "nul...
gets Constructor Instance matching given parameter @param clazz Clazz to Invoke @param args Matching args @return Matching ConstructorInstance @throws NoSuchMethodException @throws PageException
[ "gets", "Constructor", "Instance", "matching", "given", "parameter" ]
29b153fc4e126e5edb97da937f2ee2e231b87593
https://github.com/lucee/Lucee/blob/29b153fc4e126e5edb97da937f2ee2e231b87593/core/src/main/java/lucee/runtime/reflection/Reflector.java#L420-L424
30,477
lucee/Lucee
core/src/main/java/lucee/runtime/reflection/Reflector.java
Reflector.callConstructor
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) throw (PageException) target; throw Caster.toPageException(e.getTargetException()); } catch (Exception e) { throw Caster.toPageException(e); } }
java
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) throw (PageException) target; throw Caster.toPageException(e.getTargetException()); } catch (Exception e) { throw Caster.toPageException(e); } }
[ "public", "static", "Object", "callConstructor", "(", "Class", "clazz", ",", "Object", "[", "]", "args", ")", "throws", "PageException", "{", "args", "=", "cleanArgs", "(", "args", ")", ";", "try", "{", "return", "getConstructorInstance", "(", "clazz", ",", ...
call constructor of a class with matching arguments @param clazz Class to get Instance @param args Arguments for the Class @return invoked Instance @throws PageException
[ "call", "constructor", "of", "a", "class", "with", "matching", "arguments" ]
29b153fc4e126e5edb97da937f2ee2e231b87593
https://github.com/lucee/Lucee/blob/29b153fc4e126e5edb97da937f2ee2e231b87593/core/src/main/java/lucee/runtime/reflection/Reflector.java#L803-L816
30,478
lucee/Lucee
core/src/main/java/lucee/runtime/reflection/Reflector.java
Reflector.callMethod
public static Object callMethod(Object obj, String methodName, Object[] args) throws PageException { return callMethod(obj, KeyImpl.getInstance(methodName), args); }
java
public static Object callMethod(Object obj, String methodName, Object[] args) throws PageException { return callMethod(obj, KeyImpl.getInstance(methodName), args); }
[ "public", "static", "Object", "callMethod", "(", "Object", "obj", ",", "String", "methodName", ",", "Object", "[", "]", "args", ")", "throws", "PageException", "{", "return", "callMethod", "(", "obj", ",", "KeyImpl", ".", "getInstance", "(", "methodName", ")...
calls a Method of a Objct @param obj Object to call Method on it @param methodName Name of the Method to get @param args Arguments of the Method to get @return return return value of the called Method @throws PageException
[ "calls", "a", "Method", "of", "a", "Objct" ]
29b153fc4e126e5edb97da937f2ee2e231b87593
https://github.com/lucee/Lucee/blob/29b153fc4e126e5edb97da937f2ee2e231b87593/core/src/main/java/lucee/runtime/reflection/Reflector.java#L840-L842
30,479
lucee/Lucee
core/src/main/java/lucee/runtime/reflection/Reflector.java
Reflector.callStaticMethod
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 PageException) throw (PageException) target; throw Caster.toPageException(e.getTargetException()); } catch (Exception e) { throw Caster.toPageException(e); } }
java
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 PageException) throw (PageException) target; throw Caster.toPageException(e.getTargetException()); } catch (Exception e) { throw Caster.toPageException(e); } }
[ "public", "static", "Object", "callStaticMethod", "(", "Class", "clazz", ",", "String", "methodName", ",", "Object", "[", "]", "args", ")", "throws", "PageException", "{", "try", "{", "return", "getMethodInstance", "(", "null", ",", "clazz", ",", "methodName",...
calls a Static Method on the given CLass @param clazz Class to call Method on it @param methodName Name of the Method to get @param args Arguments of the Method to get @return return return value of the called Method @throws PageException
[ "calls", "a", "Static", "Method", "on", "the", "given", "CLass" ]
29b153fc4e126e5edb97da937f2ee2e231b87593
https://github.com/lucee/Lucee/blob/29b153fc4e126e5edb97da937f2ee2e231b87593/core/src/main/java/lucee/runtime/reflection/Reflector.java#L923-L935
30,480
lucee/Lucee
core/src/main/java/lucee/runtime/reflection/Reflector.java
Reflector.callSetterEL
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 instanceof PageException) throw (PageException) target; throw Caster.toPageException(e.getTargetException()); } catch (Exception e) { throw Caster.toPageException(e); } }
java
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 instanceof PageException) throw (PageException) target; throw Caster.toPageException(e.getTargetException()); } catch (Exception e) { throw Caster.toPageException(e); } }
[ "public", "static", "void", "callSetterEL", "(", "Object", "obj", ",", "String", "prop", ",", "Object", "value", ")", "throws", "PageException", "{", "try", "{", "MethodInstance", "setter", "=", "getSetter", "(", "obj", ",", "prop", ",", "value", ",", "nul...
do nothing when not exist @param obj @param prop @param value @throws PageException
[ "do", "nothing", "when", "not", "exist" ]
29b153fc4e126e5edb97da937f2ee2e231b87593
https://github.com/lucee/Lucee/blob/29b153fc4e126e5edb97da937f2ee2e231b87593/core/src/main/java/lucee/runtime/reflection/Reflector.java#L1096-L1109
30,481
lucee/Lucee
core/src/main/java/lucee/runtime/reflection/Reflector.java
Reflector.getField
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); } }
java
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); } }
[ "public", "static", "Object", "getField", "(", "Object", "obj", ",", "String", "prop", ")", "throws", "PageException", "{", "try", "{", "return", "getFieldsIgnoreCase", "(", "obj", ".", "getClass", "(", ")", ",", "prop", ")", "[", "0", "]", ".", "get", ...
to get a visible Field of a object @param obj Object to invoke @param prop property to call @return property value @throws PageException
[ "to", "get", "a", "visible", "Field", "of", "a", "object" ]
29b153fc4e126e5edb97da937f2ee2e231b87593
https://github.com/lucee/Lucee/blob/29b153fc4e126e5edb97da937f2ee2e231b87593/core/src/main/java/lucee/runtime/reflection/Reflector.java#L1119-L1127
30,482
lucee/Lucee
core/src/main/java/lucee/runtime/reflection/Reflector.java
Reflector.setField
public static boolean setField(Object obj, String prop, Object value) throws PageException { Class clazz = value.getClass(); try { Field[] fields = getFieldsIgnoreCase(obj.getClass(), prop); // exact comparsion for (int i = 0; i < fields.length; i++) { if (toReferenceClass(fields[i].getType()) == clazz) { fields[i].set(obj, value); return true; } } // like comparsion for (int i = 0; i < fields.length; i++) { if (like(fields[i].getType(), clazz)) { fields[i].set(obj, value); return true; } } // convert comparsion for (int i = 0; i < fields.length; i++) { try { fields[i].set(obj, convert(value, toReferenceClass(fields[i].getType()), null)); return true; } catch (PageException e) {} } } catch (Exception e) { throw Caster.toPageException(e); } return false; }
java
public static boolean setField(Object obj, String prop, Object value) throws PageException { Class clazz = value.getClass(); try { Field[] fields = getFieldsIgnoreCase(obj.getClass(), prop); // exact comparsion for (int i = 0; i < fields.length; i++) { if (toReferenceClass(fields[i].getType()) == clazz) { fields[i].set(obj, value); return true; } } // like comparsion for (int i = 0; i < fields.length; i++) { if (like(fields[i].getType(), clazz)) { fields[i].set(obj, value); return true; } } // convert comparsion for (int i = 0; i < fields.length; i++) { try { fields[i].set(obj, convert(value, toReferenceClass(fields[i].getType()), null)); return true; } catch (PageException e) {} } } catch (Exception e) { throw Caster.toPageException(e); } return false; }
[ "public", "static", "boolean", "setField", "(", "Object", "obj", ",", "String", "prop", ",", "Object", "value", ")", "throws", "PageException", "{", "Class", "clazz", "=", "value", ".", "getClass", "(", ")", ";", "try", "{", "Field", "[", "]", "fields", ...
assign a value to a visible Field of a object @param obj Object to assign value to his property @param prop name of property @param value Value to assign @throws PageException
[ "assign", "a", "value", "to", "a", "visible", "Field", "of", "a", "object" ]
29b153fc4e126e5edb97da937f2ee2e231b87593
https://github.com/lucee/Lucee/blob/29b153fc4e126e5edb97da937f2ee2e231b87593/core/src/main/java/lucee/runtime/reflection/Reflector.java#L1156-L1187
30,483
lucee/Lucee
core/src/main/java/lucee/runtime/reflection/Reflector.java
Reflector.canConvert
public static boolean canConvert(Class from, Class to) { // Identity Conversions if (from == to) return true; // Widening Primitive Conversion 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.class || to == float.class || to == double.class; } if (from == char.class) { return to == int.class || to == long.class || to == float.class || to == double.class; } if (from == int.class) { return to == long.class || to == float.class || to == double.class; } if (from == long.class) { return to == float.class || to == double.class; } if (from == float.class) { return to == double.class; } return false; }
java
public static boolean canConvert(Class from, Class to) { // Identity Conversions if (from == to) return true; // Widening Primitive Conversion 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.class || to == float.class || to == double.class; } if (from == char.class) { return to == int.class || to == long.class || to == float.class || to == double.class; } if (from == int.class) { return to == long.class || to == float.class || to == double.class; } if (from == long.class) { return to == float.class || to == double.class; } if (from == float.class) { return to == double.class; } return false; }
[ "public", "static", "boolean", "canConvert", "(", "Class", "from", ",", "Class", "to", ")", "{", "// Identity Conversions", "if", "(", "from", "==", "to", ")", "return", "true", ";", "// Widening Primitive Conversion", "if", "(", "from", "==", "byte", ".", "...
check if given class "from" can be converted to class "to" without explicit casting @param from source class @param to target class @return is it possible to convert from "from" to "to"
[ "check", "if", "given", "class", "from", "can", "be", "converted", "to", "class", "to", "without", "explicit", "casting" ]
29b153fc4e126e5edb97da937f2ee2e231b87593
https://github.com/lucee/Lucee/blob/29b153fc4e126e5edb97da937f2ee2e231b87593/core/src/main/java/lucee/runtime/reflection/Reflector.java#L1462-L1486
30,484
lucee/Lucee
core/src/main/java/lucee/runtime/exp/DatabaseException.java
DatabaseException.getCatchBlock
@Override 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.isEmpty(datasourceName)) datasourceName = Caster.toString(getAdditional().get("DataSource", ""), ""); CatchBlock sct = super.getCatchBlock(config); sct.setEL("NativeErrorCode", new Double(errorcode)); sct.setEL("DataSource", datasourceName); sct.setEL("SQLState", sqlstate); sct.setEL("Sql", strSQL); sct.setEL("queryError", strSQL); sct.setEL("where", ""); return sct; }
java
@Override 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.isEmpty(datasourceName)) datasourceName = Caster.toString(getAdditional().get("DataSource", ""), ""); CatchBlock sct = super.getCatchBlock(config); sct.setEL("NativeErrorCode", new Double(errorcode)); sct.setEL("DataSource", datasourceName); sct.setEL("SQLState", sqlstate); sct.setEL("Sql", strSQL); sct.setEL("queryError", strSQL); sct.setEL("where", ""); return sct; }
[ "@", "Override", "public", "CatchBlock", "getCatchBlock", "(", "Config", "config", ")", "{", "String", "strSQL", "=", "sql", "==", "null", "?", "\"\"", ":", "sql", ".", "toString", "(", ")", ";", "if", "(", "StringUtil", ".", "isEmpty", "(", "strSQL", ...
Constructor of the class @param sqle
[ "Constructor", "of", "the", "class" ]
29b153fc4e126e5edb97da937f2ee2e231b87593
https://github.com/lucee/Lucee/blob/29b153fc4e126e5edb97da937f2ee2e231b87593/core/src/main/java/lucee/runtime/exp/DatabaseException.java#L154-L170
30,485
lucee/Lucee
core/src/main/java/lucee/runtime/helpers/XMLEventParser.java
XMLEventParser.start
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.getInputStream()))); } catch (Exception e) { throw Caster.toPageException(e); } finally { IOUtil.closeEL(is); } }
java
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.getInputStream()))); } catch (Exception e) { throw Caster.toPageException(e); } finally { IOUtil.closeEL(is); } }
[ "public", "void", "start", "(", "Resource", "xmlFile", ")", "throws", "PageException", "{", "InputStream", "is", "=", "null", ";", "try", "{", "XMLReader", "xmlReader", "=", "XMLUtil", ".", "createXMLReader", "(", ")", ";", "xmlReader", ".", "setContentHandler...
start execution of the parser @param xmlFile @param saxParserCass @throws PageException
[ "start", "execution", "of", "the", "parser" ]
29b153fc4e126e5edb97da937f2ee2e231b87593
https://github.com/lucee/Lucee/blob/29b153fc4e126e5edb97da937f2ee2e231b87593/core/src/main/java/lucee/runtime/helpers/XMLEventParser.java#L95-L110
30,486
lucee/Lucee
core/src/main/java/lucee/runtime/helpers/XMLEventParser.java
XMLEventParser.call
private void call(UDF udf, Object[] arguments) { try { udf.call(pc, arguments, false); } catch (PageException pe) { error(pe); } }
java
private void call(UDF udf, Object[] arguments) { try { udf.call(pc, arguments, false); } catch (PageException pe) { error(pe); } }
[ "private", "void", "call", "(", "UDF", "udf", ",", "Object", "[", "]", "arguments", ")", "{", "try", "{", "udf", ".", "call", "(", "pc", ",", "arguments", ",", "false", ")", ";", "}", "catch", "(", "PageException", "pe", ")", "{", "error", "(", "...
call a user defined function @param udf @param arguments
[ "call", "a", "user", "defined", "function" ]
29b153fc4e126e5edb97da937f2ee2e231b87593
https://github.com/lucee/Lucee/blob/29b153fc4e126e5edb97da937f2ee2e231b87593/core/src/main/java/lucee/runtime/helpers/XMLEventParser.java#L156-L163
30,487
lucee/Lucee
core/src/main/java/lucee/runtime/helpers/XMLEventParser.java
XMLEventParser.error
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) {} }
java
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) {} }
[ "private", "void", "error", "(", "PageException", "pe", ")", "{", "if", "(", "error", "==", "null", ")", "throw", "new", "PageRuntimeException", "(", "pe", ")", ";", "try", "{", "pc", "=", "ThreadLocalPageContext", ".", "get", "(", "pc", ")", ";", "err...
call back error function if a error occour @param pe
[ "call", "back", "error", "function", "if", "a", "error", "occour" ]
29b153fc4e126e5edb97da937f2ee2e231b87593
https://github.com/lucee/Lucee/blob/29b153fc4e126e5edb97da937f2ee2e231b87593/core/src/main/java/lucee/runtime/helpers/XMLEventParser.java#L170-L177
30,488
lucee/Lucee
core/src/main/java/lucee/runtime/helpers/XMLEventParser.java
XMLEventParser.toStruct
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; }
java
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; }
[ "private", "Struct", "toStruct", "(", "Attributes", "att", ")", "{", "int", "len", "=", "att", ".", "getLength", "(", ")", ";", "Struct", "sct", "=", "new", "StructImpl", "(", ")", ";", "for", "(", "int", "i", "=", "0", ";", "i", "<", "len", ";",...
cast a Attributes object to a Struct @param att @return Attributes as Struct
[ "cast", "a", "Attributes", "object", "to", "a", "Struct" ]
29b153fc4e126e5edb97da937f2ee2e231b87593
https://github.com/lucee/Lucee/blob/29b153fc4e126e5edb97da937f2ee2e231b87593/core/src/main/java/lucee/runtime/helpers/XMLEventParser.java#L185-L192
30,489
lucee/Lucee
core/src/main/java/lucee/runtime/net/http/HttpUtil.java
HttpUtil.cloneHeaders
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 = req.getHeaders(name); while (ee.hasMoreElements()) { headers.add(new Pair<String, String>(name, ee.nextElement().toString())); } } return (Pair<String, String>[]) headers.toArray(new Pair[headers.size()]); }
java
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 = req.getHeaders(name); while (ee.hasMoreElements()) { headers.add(new Pair<String, String>(name, ee.nextElement().toString())); } } return (Pair<String, String>[]) headers.toArray(new Pair[headers.size()]); }
[ "public", "static", "Pair", "<", "String", ",", "String", ">", "[", "]", "cloneHeaders", "(", "HttpServletRequest", "req", ")", "{", "List", "<", "Pair", "<", "String", ",", "String", ">", ">", "headers", "=", "new", "ArrayList", "<", "Pair", "<", "Str...
read all headers from request and return it @param req @return
[ "read", "all", "headers", "from", "request", "and", "return", "it" ]
29b153fc4e126e5edb97da937f2ee2e231b87593
https://github.com/lucee/Lucee/blob/29b153fc4e126e5edb97da937f2ee2e231b87593/core/src/main/java/lucee/runtime/net/http/HttpUtil.java#L44-L56
30,490
lucee/Lucee
core/src/main/java/lucee/runtime/config/XMLConfigWebFactory.java
XMLConfigWebFactory.loadExtensionBundles
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 = new ArrayList<RHExtension>(); RHExtension rhe; for (Element child: children) { BundleInfo[] bfsq; try { rhe = new RHExtension(config, child); if (rhe.getStartBundles()) rhe.deployBundles(config); extensions.add(rhe); } catch (Exception e) { log.error("load-extension", e); continue; } } config.setExtensions(extensions.toArray(new RHExtension[extensions.size()])); } catch (Exception e) { log(config, log, e); } }
java
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 = new ArrayList<RHExtension>(); RHExtension rhe; for (Element child: children) { BundleInfo[] bfsq; try { rhe = new RHExtension(config, child); if (rhe.getStartBundles()) rhe.deployBundles(config); extensions.add(rhe); } catch (Exception e) { log.error("load-extension", e); continue; } } config.setExtensions(extensions.toArray(new RHExtension[extensions.size()])); } catch (Exception e) { log(config, log, e); } }
[ "private", "static", "void", "loadExtensionBundles", "(", "ConfigServerImpl", "cs", ",", "ConfigImpl", "config", ",", "Document", "doc", ",", "Log", "log", ")", "{", "try", "{", "Element", "parent", "=", "getChildByName", "(", "doc", ".", "getDocumentElement", ...
loads the bundles defined in the extensions @param cs @param config @param doc @param log
[ "loads", "the", "bundles", "defined", "in", "the", "extensions" ]
29b153fc4e126e5edb97da937f2ee2e231b87593
https://github.com/lucee/Lucee/blob/29b153fc4e126e5edb97da937f2ee2e231b87593/core/src/main/java/lucee/runtime/config/XMLConfigWebFactory.java#L4229-L4255
30,491
lucee/Lucee
core/src/main/java/lucee/runtime/config/XMLConfigWebFactory.java
XMLConfigWebFactory.toBoolean
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; } }
java
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; } }
[ "private", "static", "boolean", "toBoolean", "(", "String", "value", ",", "boolean", "defaultValue", ")", "{", "if", "(", "value", "==", "null", "||", "value", ".", "trim", "(", ")", ".", "length", "(", ")", "==", "0", ")", "return", "defaultValue", ";...
cast a string value to a boolean @param value String value represent a booolean ("yes", "no","true" aso.) @param defaultValue if can't cast to a boolean is value will be returned @return boolean value
[ "cast", "a", "string", "value", "to", "a", "boolean" ]
29b153fc4e126e5edb97da937f2ee2e231b87593
https://github.com/lucee/Lucee/blob/29b153fc4e126e5edb97da937f2ee2e231b87593/core/src/main/java/lucee/runtime/config/XMLConfigWebFactory.java#L4891-L4901
30,492
lucee/Lucee
core/src/main/java/lucee/runtime/config/XMLConfigWebFactory.java
XMLConfigWebFactory.getAttr
public static String getAttr(Element el, String name) { String v = el.getAttribute(name); return replaceConfigPlaceHolder(v); }
java
public static String getAttr(Element el, String name) { String v = el.getAttribute(name); return replaceConfigPlaceHolder(v); }
[ "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 @param el @param name @return
[ "reads", "an", "attribute", "from", "a", "xml", "Element", "and", "parses", "placeholders" ]
29b153fc4e126e5edb97da937f2ee2e231b87593
https://github.com/lucee/Lucee/blob/29b153fc4e126e5edb97da937f2ee2e231b87593/core/src/main/java/lucee/runtime/config/XMLConfigWebFactory.java#L4918-L4921
30,493
lucee/Lucee
core/src/main/java/lucee/runtime/tag/FileTag.java
FileTag.setAction
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")) action = ACTION_DELETE; else if (strAction.equals("read")) action = ACTION_READ; else if (strAction.equals("readbinary")) action = ACTION_READ_BINARY; else if (strAction.equals("write")) action = ACTION_WRITE; else if (strAction.equals("append")) action = ACTION_APPEND; else if (strAction.equals("upload")) action = ACTION_UPLOAD; else if (strAction.equals("uploadall")) action = ACTION_UPLOAD_ALL; else if (strAction.equals("info")) action = ACTION_INFO; else if (strAction.equals("touch")) action = ACTION_TOUCH; else throw new ApplicationException("invalid value [" + strAction + "] for attribute action", "values for attribute action are:info,move,rename,copy,delete,read,readbinary,write,append,upload,uploadall,touch"); }
java
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")) action = ACTION_DELETE; else if (strAction.equals("read")) action = ACTION_READ; else if (strAction.equals("readbinary")) action = ACTION_READ_BINARY; else if (strAction.equals("write")) action = ACTION_WRITE; else if (strAction.equals("append")) action = ACTION_APPEND; else if (strAction.equals("upload")) action = ACTION_UPLOAD; else if (strAction.equals("uploadall")) action = ACTION_UPLOAD_ALL; else if (strAction.equals("info")) action = ACTION_INFO; else if (strAction.equals("touch")) action = ACTION_TOUCH; else throw new ApplicationException("invalid value [" + strAction + "] for attribute action", "values for attribute action are:info,move,rename,copy,delete,read,readbinary,write,append,upload,uploadall,touch"); }
[ "public", "void", "setAction", "(", "String", "strAction", ")", "throws", "ApplicationException", "{", "strAction", "=", "strAction", ".", "toLowerCase", "(", ")", ";", "if", "(", "strAction", ".", "equals", "(", "\"move\"", ")", "||", "strAction", ".", "equ...
set the value action Type of file manipulation that the tag performs. @param strAction value to set
[ "set", "the", "value", "action", "Type", "of", "file", "manipulation", "that", "the", "tag", "performs", "." ]
29b153fc4e126e5edb97da937f2ee2e231b87593
https://github.com/lucee/Lucee/blob/29b153fc4e126e5edb97da937f2ee2e231b87593/core/src/main/java/lucee/runtime/tag/FileTag.java#L203-L218
30,494
lucee/Lucee
core/src/main/java/lucee/runtime/tag/FileTag.java
FileTag.setCharset
public void setCharset(String charset) { if (StringUtil.isEmpty(charset)) return; this.charset = CharsetUtil.toCharSet(charset.trim()); }
java
public void setCharset(String charset) { if (StringUtil.isEmpty(charset)) return; this.charset = CharsetUtil.toCharSet(charset.trim()); }
[ "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. @param charset value to set
[ "set", "the", "value", "charset", "Character", "set", "name", "for", "the", "file", "contents", "." ]
29b153fc4e126e5edb97da937f2ee2e231b87593
https://github.com/lucee/Lucee/blob/29b153fc4e126e5edb97da937f2ee2e231b87593/core/src/main/java/lucee/runtime/tag/FileTag.java#L293-L296
30,495
lucee/Lucee
core/src/main/java/lucee/runtime/tag/FileTag.java
FileTag.actionMove
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) nameconflict = NAMECONFLICT_OVERWRITE; if (source == null) throw new ApplicationException("attribute source is not defined for tag file"); if (StringUtil.isEmpty(strDestination)) throw new ApplicationException("attribute destination is not defined for tag file"); Resource destination = toDestination(pageContext, strDestination, source); securityManager.checkFileLocation(pageContext.getConfig(), source, serverPassword); securityManager.checkFileLocation(pageContext.getConfig(), destination, serverPassword); if (source.equals(destination)) return; // source if (!source.exists()) throw new ApplicationException("source file [" + source.toString() + "] doesn't exist"); else if (!source.isFile()) throw new ApplicationException("source file [" + source.toString() + "] is not a file"); else if (!source.isReadable() || !source.isWriteable()) throw new ApplicationException("no access to source file [" + source.toString() + "]"); // destination if (destination.isDirectory()) destination = destination.getRealResource(source.getName()); if (destination.exists()) { // SKIP if (nameconflict == NAMECONFLICT_SKIP) return; // OVERWRITE else if (nameconflict == NAMECONFLICT_OVERWRITE) destination.delete(); // MAKEUNIQUE else if (nameconflict == NAMECONFLICT_MAKEUNIQUE) destination = makeUnique(destination); // ERROR else throw new ApplicationException("destiniation file [" + destination.toString() + "] already exist"); } setACL(pageContext, destination, acl); try { source.moveTo(destination); } catch (Throwable t) { ExceptionUtil.rethrowIfNecessary(t); throw new ApplicationException(t.getMessage()); } setMode(destination, mode); setAttributes(destination, attributes); }
java
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) nameconflict = NAMECONFLICT_OVERWRITE; if (source == null) throw new ApplicationException("attribute source is not defined for tag file"); if (StringUtil.isEmpty(strDestination)) throw new ApplicationException("attribute destination is not defined for tag file"); Resource destination = toDestination(pageContext, strDestination, source); securityManager.checkFileLocation(pageContext.getConfig(), source, serverPassword); securityManager.checkFileLocation(pageContext.getConfig(), destination, serverPassword); if (source.equals(destination)) return; // source if (!source.exists()) throw new ApplicationException("source file [" + source.toString() + "] doesn't exist"); else if (!source.isFile()) throw new ApplicationException("source file [" + source.toString() + "] is not a file"); else if (!source.isReadable() || !source.isWriteable()) throw new ApplicationException("no access to source file [" + source.toString() + "]"); // destination if (destination.isDirectory()) destination = destination.getRealResource(source.getName()); if (destination.exists()) { // SKIP if (nameconflict == NAMECONFLICT_SKIP) return; // OVERWRITE else if (nameconflict == NAMECONFLICT_OVERWRITE) destination.delete(); // MAKEUNIQUE else if (nameconflict == NAMECONFLICT_MAKEUNIQUE) destination = makeUnique(destination); // ERROR else throw new ApplicationException("destiniation file [" + destination.toString() + "] already exist"); } setACL(pageContext, destination, acl); try { source.moveTo(destination); } catch (Throwable t) { ExceptionUtil.rethrowIfNecessary(t); throw new ApplicationException(t.getMessage()); } setMode(destination, mode); setAttributes(destination, attributes); }
[ "public", "static", "void", "actionMove", "(", "PageContext", "pageContext", ",", "lucee", ".", "runtime", ".", "security", ".", "SecurityManager", "securityManager", ",", "Resource", "source", ",", "String", "strDestination", ",", "int", "nameconflict", ",", "Str...
move source file to destination path or file @throws PageException
[ "move", "source", "file", "to", "destination", "path", "or", "file" ]
29b153fc4e126e5edb97da937f2ee2e231b87593
https://github.com/lucee/Lucee/blob/29b153fc4e126e5edb97da937f2ee2e231b87593/core/src/main/java/lucee/runtime/tag/FileTag.java#L468-L511
30,496
lucee/Lucee
core/src/main/java/lucee/runtime/tag/FileTag.java
FileTag.actionAppend
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.exists()) file.createNewFile(); String content = Caster.toString(output); if (fixnewline) content = doFixNewLine(content); if (addnewline) content += SystemUtil.getOSSpecificLineSeparator(); IOUtil.write(file, content, CharsetUtil.toCharset(charset), true); } catch (UnsupportedEncodingException e) { throw new ApplicationException("Unsupported Charset Definition [" + charset + "]", e.getMessage()); } catch (IOException e) { throw new ApplicationException("can't write file", e.getMessage()); } setMode(file, mode); setAttributes(file, attributes); }
java
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.exists()) file.createNewFile(); String content = Caster.toString(output); if (fixnewline) content = doFixNewLine(content); if (addnewline) content += SystemUtil.getOSSpecificLineSeparator(); IOUtil.write(file, content, CharsetUtil.toCharset(charset), true); } catch (UnsupportedEncodingException e) { throw new ApplicationException("Unsupported Charset Definition [" + charset + "]", e.getMessage()); } catch (IOException e) { throw new ApplicationException("can't write file", e.getMessage()); } setMode(file, mode); setAttributes(file, attributes); }
[ "private", "void", "actionAppend", "(", ")", "throws", "PageException", "{", "if", "(", "output", "==", "null", ")", "throw", "new", "ApplicationException", "(", "\"attribute output is not defined for tag file\"", ")", ";", "checkFile", "(", "pageContext", ",", "sec...
append data to source file @throws PageException
[ "append", "data", "to", "source", "file" ]
29b153fc4e126e5edb97da937f2ee2e231b87593
https://github.com/lucee/Lucee/blob/29b153fc4e126e5edb97da937f2ee2e231b87593/core/src/main/java/lucee/runtime/tag/FileTag.java#L745-L766
30,497
lucee/Lucee
core/src/main/java/lucee/runtime/tag/FileTag.java
FileTag.checkContentType
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 = ext.substring(1); String blacklistedTypes = SystemUtil.getSystemPropOrEnvVar( SystemUtil.SETTING_UPLOAD_EXT_BLACKLIST, SystemUtil.DEFAULT_UPLOAD_EXT_BLACKLIST ).toLowerCase(); Array blacklist = ListUtil.listToArrayRemoveEmpty(blacklistedTypes, ','); for (int i=blacklist.size(); i > 0; i--) { if (ext.equals(Caster.toString(blacklist.getE(i)).trim())){ throw new ApplicationException("Upload of files with extension [" + ext + "] is not permitted. " + "You can configure the " + SystemUtil.SETTING_UPLOAD_EXT_BLACKLIST + " System property or the " + SystemUtil.convertSystemPropToEnvVar(SystemUtil.SETTING_UPLOAD_EXT_BLACKLIST) + " Environment variable to allow that file type." ); } } } else ext = null; if (StringUtil.isEmpty(accept, true)) return; MimeType mt = MimeType.getInstance(contentType), sub; Array whishedTypes = ListUtil.listToArrayRemoveEmpty(accept, ','); int len = whishedTypes.size(); for (int i = 1; i <= len; i++) { String whishedType = Caster.toString(whishedTypes.getE(i)).trim().toLowerCase(); if (whishedType.equals("*")) return; // check mimetype if (ListUtil.len(whishedType, "/", true) == 2) { sub = MimeType.getInstance(whishedType); if (mt.match(sub)) return; } // check extension if (ext != null && !strict) { if (whishedType.startsWith("*.")) whishedType = whishedType.substring(2); if (whishedType.startsWith(".")) whishedType = whishedType.substring(1); if (ext.equals(whishedType)) return; } } throw new ApplicationException("The MIME type of the uploaded file [" + contentType + "] was not accepted by the server.", "only this [" + accept + "] mime type are accepted"); }
java
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 = ext.substring(1); String blacklistedTypes = SystemUtil.getSystemPropOrEnvVar( SystemUtil.SETTING_UPLOAD_EXT_BLACKLIST, SystemUtil.DEFAULT_UPLOAD_EXT_BLACKLIST ).toLowerCase(); Array blacklist = ListUtil.listToArrayRemoveEmpty(blacklistedTypes, ','); for (int i=blacklist.size(); i > 0; i--) { if (ext.equals(Caster.toString(blacklist.getE(i)).trim())){ throw new ApplicationException("Upload of files with extension [" + ext + "] is not permitted. " + "You can configure the " + SystemUtil.SETTING_UPLOAD_EXT_BLACKLIST + " System property or the " + SystemUtil.convertSystemPropToEnvVar(SystemUtil.SETTING_UPLOAD_EXT_BLACKLIST) + " Environment variable to allow that file type." ); } } } else ext = null; if (StringUtil.isEmpty(accept, true)) return; MimeType mt = MimeType.getInstance(contentType), sub; Array whishedTypes = ListUtil.listToArrayRemoveEmpty(accept, ','); int len = whishedTypes.size(); for (int i = 1; i <= len; i++) { String whishedType = Caster.toString(whishedTypes.getE(i)).trim().toLowerCase(); if (whishedType.equals("*")) return; // check mimetype if (ListUtil.len(whishedType, "/", true) == 2) { sub = MimeType.getInstance(whishedType); if (mt.match(sub)) return; } // check extension if (ext != null && !strict) { if (whishedType.startsWith("*.")) whishedType = whishedType.substring(2); if (whishedType.startsWith(".")) whishedType = whishedType.substring(1); if (ext.equals(whishedType)) return; } } throw new ApplicationException("The MIME type of the uploaded file [" + contentType + "] was not accepted by the server.", "only this [" + accept + "] mime type are accepted"); }
[ "private", "static", "void", "checkContentType", "(", "String", "contentType", ",", "String", "accept", ",", "String", "ext", ",", "boolean", "strict", ")", "throws", "PageException", "{", "if", "(", "!", "StringUtil", ".", "isEmpty", "(", "ext", ",", "true"...
check if the content type is permitted @param contentType @throws PageException
[ "check", "if", "the", "content", "type", "is", "permitted" ]
29b153fc4e126e5edb97da937f2ee2e231b87593
https://github.com/lucee/Lucee/blob/29b153fc4e126e5edb97da937f2ee2e231b87593/core/src/main/java/lucee/runtime/tag/FileTag.java#L1009-L1059
30,498
lucee/Lucee
core/src/main/java/lucee/runtime/tag/FileTag.java
FileTag.getFormItem
private static FormItem getFormItem(PageContext pageContext, String filefield) throws PageException { // check filefield if (StringUtil.isEmpty(filefield)) { FormItem[] items = getFormItems(pageContext); if (ArrayUtil.isEmpty(items)) throw new ApplicationException("no file send with this form"); return items[0]; } PageException pe = pageContext.formScope().getInitException(); if (pe != null) throw pe; lucee.runtime.type.scope.Form upload = pageContext.formScope(); FormItem fileItem = upload.getUploadResource(filefield); if (fileItem == null) { FormItem[] items = upload.getFileItems(); StringBuilder sb = new StringBuilder(); for (int i = 0; i < items.length; i++) { if (i != 0) sb.append(", "); sb.append(items[i].getFieldName()); } String add = "."; if (sb.length() > 0) add = ", valid field names are [" + sb + "]."; if (pageContext.formScope().get(filefield, null) == null) throw new ApplicationException("form field [" + filefield + "] is not a file field" + add); throw new ApplicationException("form field [" + filefield + "] doesn't exist or has no content" + add); } return fileItem; }
java
private static FormItem getFormItem(PageContext pageContext, String filefield) throws PageException { // check filefield if (StringUtil.isEmpty(filefield)) { FormItem[] items = getFormItems(pageContext); if (ArrayUtil.isEmpty(items)) throw new ApplicationException("no file send with this form"); return items[0]; } PageException pe = pageContext.formScope().getInitException(); if (pe != null) throw pe; lucee.runtime.type.scope.Form upload = pageContext.formScope(); FormItem fileItem = upload.getUploadResource(filefield); if (fileItem == null) { FormItem[] items = upload.getFileItems(); StringBuilder sb = new StringBuilder(); for (int i = 0; i < items.length; i++) { if (i != 0) sb.append(", "); sb.append(items[i].getFieldName()); } String add = "."; if (sb.length() > 0) add = ", valid field names are [" + sb + "]."; if (pageContext.formScope().get(filefield, null) == null) throw new ApplicationException("form field [" + filefield + "] is not a file field" + add); throw new ApplicationException("form field [" + filefield + "] doesn't exist or has no content" + add); } return fileItem; }
[ "private", "static", "FormItem", "getFormItem", "(", "PageContext", "pageContext", ",", "String", "filefield", ")", "throws", "PageException", "{", "// check filefield", "if", "(", "StringUtil", ".", "isEmpty", "(", "filefield", ")", ")", "{", "FormItem", "[", "...
rreturn fileItem matching to filefiled definition or throw a exception @return FileItem @throws ApplicationException
[ "rreturn", "fileItem", "matching", "to", "filefiled", "definition", "or", "throw", "a", "exception" ]
29b153fc4e126e5edb97da937f2ee2e231b87593
https://github.com/lucee/Lucee/blob/29b153fc4e126e5edb97da937f2ee2e231b87593/core/src/main/java/lucee/runtime/tag/FileTag.java#L1067-L1094
30,499
lucee/Lucee
core/src/main/java/lucee/runtime/tag/FileTag.java
FileTag.getFileName
private static String getFileName(Resource file) { String name = file.getName(); int pos = name.lastIndexOf("."); if (pos == -1) return name; return name.substring(0, pos); }
java
private static String getFileName(Resource file) { String name = file.getName(); int pos = name.lastIndexOf("."); if (pos == -1) return name; return name.substring(0, pos); }
[ "private", "static", "String", "getFileName", "(", "Resource", "file", ")", "{", "String", "name", "=", "file", ".", "getName", "(", ")", ";", "int", "pos", "=", "name", ".", "lastIndexOf", "(", "\".\"", ")", ";", "if", "(", "pos", "==", "-", "1", ...
get file name of a file object without extension @param file file object @return name of the file
[ "get", "file", "name", "of", "a", "file", "object", "without", "extension" ]
29b153fc4e126e5edb97da937f2ee2e231b87593
https://github.com/lucee/Lucee/blob/29b153fc4e126e5edb97da937f2ee2e231b87593/core/src/main/java/lucee/runtime/tag/FileTag.java#L1130-L1136