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,600 | lucee/Lucee | core/src/main/java/lucee/runtime/net/ftp/FTPPoolImpl.java | FTPPoolImpl.disconnect | private void disconnect(AFTPClient client) {
try {
if (client != null && client.isConnected()) {
client.quit();
client.disconnect();
}
}
catch (IOException ioe) {}
} | java | private void disconnect(AFTPClient client) {
try {
if (client != null && client.isConnected()) {
client.quit();
client.disconnect();
}
}
catch (IOException ioe) {}
} | [
"private",
"void",
"disconnect",
"(",
"AFTPClient",
"client",
")",
"{",
"try",
"{",
"if",
"(",
"client",
"!=",
"null",
"&&",
"client",
".",
"isConnected",
"(",
")",
")",
"{",
"client",
".",
"quit",
"(",
")",
";",
"client",
".",
"disconnect",
"(",
")"... | disconnect a client
@param client | [
"disconnect",
"a",
"client"
] | 29b153fc4e126e5edb97da937f2ee2e231b87593 | https://github.com/lucee/Lucee/blob/29b153fc4e126e5edb97da937f2ee2e231b87593/core/src/main/java/lucee/runtime/net/ftp/FTPPoolImpl.java#L94-L102 |
30,601 | lucee/Lucee | core/src/main/java/lucee/runtime/config/XMLConfigFactory.java | XMLConfigFactory.createConfigFile | static void createConfigFile(String xmlName, Resource configFile) throws IOException {
configFile.createFile(true);
createFileFromResource("/resource/config/" + xmlName + ".xml", configFile.getAbsoluteResource());
} | java | static void createConfigFile(String xmlName, Resource configFile) throws IOException {
configFile.createFile(true);
createFileFromResource("/resource/config/" + xmlName + ".xml", configFile.getAbsoluteResource());
} | [
"static",
"void",
"createConfigFile",
"(",
"String",
"xmlName",
",",
"Resource",
"configFile",
")",
"throws",
"IOException",
"{",
"configFile",
".",
"createFile",
"(",
"true",
")",
";",
"createFileFromResource",
"(",
"\"/resource/config/\"",
"+",
"xmlName",
"+",
"... | creates the Config File, if File not exist
@param xmlName
@param configFile
@throws IOException | [
"creates",
"the",
"Config",
"File",
"if",
"File",
"not",
"exist"
] | 29b153fc4e126e5edb97da937f2ee2e231b87593 | https://github.com/lucee/Lucee/blob/29b153fc4e126e5edb97da937f2ee2e231b87593/core/src/main/java/lucee/runtime/config/XMLConfigFactory.java#L185-L188 |
30,602 | lucee/Lucee | core/src/main/java/lucee/runtime/config/XMLConfigFactory.java | XMLConfigFactory.getChildByName | static Element getChildByName(Node parent, String nodeName) {
return getChildByName(parent, nodeName, false);
} | java | static Element getChildByName(Node parent, String nodeName) {
return getChildByName(parent, nodeName, false);
} | [
"static",
"Element",
"getChildByName",
"(",
"Node",
"parent",
",",
"String",
"nodeName",
")",
"{",
"return",
"getChildByName",
"(",
"parent",
",",
"nodeName",
",",
"false",
")",
";",
"}"
] | return first direct child Elements of a Element with given Name
@param parent
@param nodeName
@return matching children | [
"return",
"first",
"direct",
"child",
"Elements",
"of",
"a",
"Element",
"with",
"given",
"Name"
] | 29b153fc4e126e5edb97da937f2ee2e231b87593 | https://github.com/lucee/Lucee/blob/29b153fc4e126e5edb97da937f2ee2e231b87593/core/src/main/java/lucee/runtime/config/XMLConfigFactory.java#L211-L213 |
30,603 | lucee/Lucee | core/src/main/java/lucee/runtime/type/util/QueryUtil.java | QueryUtil.getColumnNames | public static Key[] getColumnNames(Query qry) {
Query qp = Caster.toQuery(qry, null);
if (qp != null) return qp.getColumnNames();
String[] strNames = qry.getColumns();
Key[] names = new Key[strNames.length];
for (int i = 0; i < names.length; i++) {
names[i] = KeyImpl.getInstance(strNames[i]);
}
return names;
} | java | public static Key[] getColumnNames(Query qry) {
Query qp = Caster.toQuery(qry, null);
if (qp != null) return qp.getColumnNames();
String[] strNames = qry.getColumns();
Key[] names = new Key[strNames.length];
for (int i = 0; i < names.length; i++) {
names[i] = KeyImpl.getInstance(strNames[i]);
}
return names;
} | [
"public",
"static",
"Key",
"[",
"]",
"getColumnNames",
"(",
"Query",
"qry",
")",
"{",
"Query",
"qp",
"=",
"Caster",
".",
"toQuery",
"(",
"qry",
",",
"null",
")",
";",
"if",
"(",
"qp",
"!=",
"null",
")",
"return",
"qp",
".",
"getColumnNames",
"(",
"... | return column names as Key from a query
@param qry
@return | [
"return",
"column",
"names",
"as",
"Key",
"from",
"a",
"query"
] | 29b153fc4e126e5edb97da937f2ee2e231b87593 | https://github.com/lucee/Lucee/blob/29b153fc4e126e5edb97da937f2ee2e231b87593/core/src/main/java/lucee/runtime/type/util/QueryUtil.java#L145-L155 |
30,604 | lucee/Lucee | core/src/main/java/lucee/runtime/type/util/QueryUtil.java | QueryUtil.checkSQLRestriction | public static void checkSQLRestriction(DatasourceConnection dc, SQL sql) throws PageException {
Array sqlparts = ListUtil.listToArrayRemoveEmpty(SQLUtil.removeLiterals(sql.getSQLString()), " \t" + System.getProperty("line.separator"));
// print.ln(List.toStringArray(sqlparts));
DataSource ds = dc.getDatasource();
if (!ds.hasAllow(DataSource.ALLOW_ALTER)) checkSQLRestriction(dc, "alter", sqlparts, sql);
if (!ds.hasAllow(DataSource.ALLOW_CREATE)) checkSQLRestriction(dc, "create", sqlparts, sql);
if (!ds.hasAllow(DataSource.ALLOW_DELETE)) checkSQLRestriction(dc, "delete", sqlparts, sql);
if (!ds.hasAllow(DataSource.ALLOW_DROP)) checkSQLRestriction(dc, "drop", sqlparts, sql);
if (!ds.hasAllow(DataSource.ALLOW_GRANT)) checkSQLRestriction(dc, "grant", sqlparts, sql);
if (!ds.hasAllow(DataSource.ALLOW_INSERT)) checkSQLRestriction(dc, "insert", sqlparts, sql);
if (!ds.hasAllow(DataSource.ALLOW_REVOKE)) checkSQLRestriction(dc, "revoke", sqlparts, sql);
if (!ds.hasAllow(DataSource.ALLOW_SELECT)) checkSQLRestriction(dc, "select", sqlparts, sql);
if (!ds.hasAllow(DataSource.ALLOW_UPDATE)) checkSQLRestriction(dc, "update", sqlparts, sql);
} | java | public static void checkSQLRestriction(DatasourceConnection dc, SQL sql) throws PageException {
Array sqlparts = ListUtil.listToArrayRemoveEmpty(SQLUtil.removeLiterals(sql.getSQLString()), " \t" + System.getProperty("line.separator"));
// print.ln(List.toStringArray(sqlparts));
DataSource ds = dc.getDatasource();
if (!ds.hasAllow(DataSource.ALLOW_ALTER)) checkSQLRestriction(dc, "alter", sqlparts, sql);
if (!ds.hasAllow(DataSource.ALLOW_CREATE)) checkSQLRestriction(dc, "create", sqlparts, sql);
if (!ds.hasAllow(DataSource.ALLOW_DELETE)) checkSQLRestriction(dc, "delete", sqlparts, sql);
if (!ds.hasAllow(DataSource.ALLOW_DROP)) checkSQLRestriction(dc, "drop", sqlparts, sql);
if (!ds.hasAllow(DataSource.ALLOW_GRANT)) checkSQLRestriction(dc, "grant", sqlparts, sql);
if (!ds.hasAllow(DataSource.ALLOW_INSERT)) checkSQLRestriction(dc, "insert", sqlparts, sql);
if (!ds.hasAllow(DataSource.ALLOW_REVOKE)) checkSQLRestriction(dc, "revoke", sqlparts, sql);
if (!ds.hasAllow(DataSource.ALLOW_SELECT)) checkSQLRestriction(dc, "select", sqlparts, sql);
if (!ds.hasAllow(DataSource.ALLOW_UPDATE)) checkSQLRestriction(dc, "update", sqlparts, sql);
} | [
"public",
"static",
"void",
"checkSQLRestriction",
"(",
"DatasourceConnection",
"dc",
",",
"SQL",
"sql",
")",
"throws",
"PageException",
"{",
"Array",
"sqlparts",
"=",
"ListUtil",
".",
"listToArrayRemoveEmpty",
"(",
"SQLUtil",
".",
"removeLiterals",
"(",
"sql",
".... | check if there is a sql restriction
@param dc
@param sql
@throws PageException | [
"check",
"if",
"there",
"is",
"a",
"sql",
"restriction"
] | 29b153fc4e126e5edb97da937f2ee2e231b87593 | https://github.com/lucee/Lucee/blob/29b153fc4e126e5edb97da937f2ee2e231b87593/core/src/main/java/lucee/runtime/type/util/QueryUtil.java#L173-L187 |
30,605 | lucee/Lucee | core/src/main/java/lucee/commons/lang/StringList.java | StringList.add | public void add(String str) {
curr.next = new Entry(str, Entry.NUL);
curr = curr.next;
count++;
} | java | public void add(String str) {
curr.next = new Entry(str, Entry.NUL);
curr = curr.next;
count++;
} | [
"public",
"void",
"add",
"(",
"String",
"str",
")",
"{",
"curr",
".",
"next",
"=",
"new",
"Entry",
"(",
"str",
",",
"Entry",
".",
"NUL",
")",
";",
"curr",
"=",
"curr",
".",
"next",
";",
"count",
"++",
";",
"}"
] | adds a element to the list
@param str String Element to add | [
"adds",
"a",
"element",
"to",
"the",
"list"
] | 29b153fc4e126e5edb97da937f2ee2e231b87593 | https://github.com/lucee/Lucee/blob/29b153fc4e126e5edb97da937f2ee2e231b87593/core/src/main/java/lucee/commons/lang/StringList.java#L116-L120 |
30,606 | lucee/Lucee | core/src/main/java/lucee/transformer/cfml/expression/SimpleExprTransformer.java | SimpleExprTransformer.string | public Expression string(Factory f, SourceCode cfml) throws TemplateException {
cfml.removeSpace();
char quoter = cfml.getCurrentLower();
if (quoter != '"' && quoter != '\'') return null;
StringBuffer str = new StringBuffer();
boolean insideSpecial = false;
Position line = cfml.getPosition();
while (cfml.hasNext()) {
cfml.next();
// check special
if (cfml.isCurrent(specialChar)) {
insideSpecial = !insideSpecial;
str.append(specialChar);
}
// check quoter
else if (!insideSpecial && cfml.isCurrent(quoter)) {
// Ecaped sharp
if (cfml.isNext(quoter)) {
cfml.next();
str.append(quoter);
}
// finsish
else {
break;
}
}
// all other character
else {
str.append(cfml.getCurrent());
}
}
if (!cfml.forwardIfCurrent(quoter)) throw new TemplateException(cfml, "Invalid Syntax Closing [" + quoter + "] not found");
LitString rtn = f.createLitString(str.toString(), line, cfml.getPosition());
cfml.removeSpace();
return rtn;
} | java | public Expression string(Factory f, SourceCode cfml) throws TemplateException {
cfml.removeSpace();
char quoter = cfml.getCurrentLower();
if (quoter != '"' && quoter != '\'') return null;
StringBuffer str = new StringBuffer();
boolean insideSpecial = false;
Position line = cfml.getPosition();
while (cfml.hasNext()) {
cfml.next();
// check special
if (cfml.isCurrent(specialChar)) {
insideSpecial = !insideSpecial;
str.append(specialChar);
}
// check quoter
else if (!insideSpecial && cfml.isCurrent(quoter)) {
// Ecaped sharp
if (cfml.isNext(quoter)) {
cfml.next();
str.append(quoter);
}
// finsish
else {
break;
}
}
// all other character
else {
str.append(cfml.getCurrent());
}
}
if (!cfml.forwardIfCurrent(quoter)) throw new TemplateException(cfml, "Invalid Syntax Closing [" + quoter + "] not found");
LitString rtn = f.createLitString(str.toString(), line, cfml.getPosition());
cfml.removeSpace();
return rtn;
} | [
"public",
"Expression",
"string",
"(",
"Factory",
"f",
",",
"SourceCode",
"cfml",
")",
"throws",
"TemplateException",
"{",
"cfml",
".",
"removeSpace",
"(",
")",
";",
"char",
"quoter",
"=",
"cfml",
".",
"getCurrentLower",
"(",
")",
";",
"if",
"(",
"quoter",... | Liest den String ein
@return Element
@throws TemplateException | [
"Liest",
"den",
"String",
"ein"
] | 29b153fc4e126e5edb97da937f2ee2e231b87593 | https://github.com/lucee/Lucee/blob/29b153fc4e126e5edb97da937f2ee2e231b87593/core/src/main/java/lucee/transformer/cfml/expression/SimpleExprTransformer.java#L69-L108 |
30,607 | lucee/Lucee | core/src/main/java/lucee/runtime/tag/Collection.java | Collection.release | @Override
public void release() {
super.release();
action = "list";
path = null;
collection = null;
name = null;
language = "english";
// categories=false;
} | java | @Override
public void release() {
super.release();
action = "list";
path = null;
collection = null;
name = null;
language = "english";
// categories=false;
} | [
"@",
"Override",
"public",
"void",
"release",
"(",
")",
"{",
"super",
".",
"release",
"(",
")",
";",
"action",
"=",
"\"list\"",
";",
"path",
"=",
"null",
";",
"collection",
"=",
"null",
";",
"name",
"=",
"null",
";",
"language",
"=",
"\"english\"",
"... | private boolean categories=false; | [
"private",
"boolean",
"categories",
"=",
"false",
";"
] | 29b153fc4e126e5edb97da937f2ee2e231b87593 | https://github.com/lucee/Lucee/blob/29b153fc4e126e5edb97da937f2ee2e231b87593/core/src/main/java/lucee/runtime/tag/Collection.java#L54-L63 |
30,608 | lucee/Lucee | core/src/main/java/lucee/runtime/tag/Collection.java | Collection.setPath | public void setPath(String strPath) throws PageException {
if (strPath == null) return;
this.path = ResourceUtil.toResourceNotExisting(pageContext, strPath.trim());
// this.path=new File(path.toLowerCase().trim());
pageContext.getConfig().getSecurityManager().checkFileLocation(this.path);
if (!this.path.exists()) {
Resource parent = this.path.getParentResource();
if (parent != null && parent.exists()) this.path.mkdirs();
else {
throw new ApplicationException("attribute path of the tag collection must be a existing directory");
}
}
else if (!this.path.isDirectory()) throw new ApplicationException("attribute path of the tag collection must be a existing directory");
} | java | public void setPath(String strPath) throws PageException {
if (strPath == null) return;
this.path = ResourceUtil.toResourceNotExisting(pageContext, strPath.trim());
// this.path=new File(path.toLowerCase().trim());
pageContext.getConfig().getSecurityManager().checkFileLocation(this.path);
if (!this.path.exists()) {
Resource parent = this.path.getParentResource();
if (parent != null && parent.exists()) this.path.mkdirs();
else {
throw new ApplicationException("attribute path of the tag collection must be a existing directory");
}
}
else if (!this.path.isDirectory()) throw new ApplicationException("attribute path of the tag collection must be a existing directory");
} | [
"public",
"void",
"setPath",
"(",
"String",
"strPath",
")",
"throws",
"PageException",
"{",
"if",
"(",
"strPath",
"==",
"null",
")",
"return",
";",
"this",
".",
"path",
"=",
"ResourceUtil",
".",
"toResourceNotExisting",
"(",
"pageContext",
",",
"strPath",
".... | set the value path
@param path value to set
@throws PageException | [
"set",
"the",
"value",
"path"
] | 29b153fc4e126e5edb97da937f2ee2e231b87593 | https://github.com/lucee/Lucee/blob/29b153fc4e126e5edb97da937f2ee2e231b87593/core/src/main/java/lucee/runtime/tag/Collection.java#L95-L110 |
30,609 | lucee/Lucee | core/src/main/java/lucee/runtime/tag/Collection.java | Collection.doList | private void doList() throws PageException, SearchException {
required("collection", action, "name", name);
// if(StringUtil.isEmpty(name))throw new ApplicationException("for action list attribute name is
// required");
pageContext.setVariable(name, getSearchEngine().getCollectionsAsQuery());
} | java | private void doList() throws PageException, SearchException {
required("collection", action, "name", name);
// if(StringUtil.isEmpty(name))throw new ApplicationException("for action list attribute name is
// required");
pageContext.setVariable(name, getSearchEngine().getCollectionsAsQuery());
} | [
"private",
"void",
"doList",
"(",
")",
"throws",
"PageException",
",",
"SearchException",
"{",
"required",
"(",
"\"collection\"",
",",
"action",
",",
"\"name\"",
",",
"name",
")",
";",
"// if(StringUtil.isEmpty(name))throw new ApplicationException(\"for action list attribut... | Creates a query in the PageContext containing all available Collections of the current
searchStorage
@throws ApplicationException
@throws PageException
@throws SearchException | [
"Creates",
"a",
"query",
"in",
"the",
"PageContext",
"containing",
"all",
"available",
"Collections",
"of",
"the",
"current",
"searchStorage"
] | 29b153fc4e126e5edb97da937f2ee2e231b87593 | https://github.com/lucee/Lucee/blob/29b153fc4e126e5edb97da937f2ee2e231b87593/core/src/main/java/lucee/runtime/tag/Collection.java#L193-L198 |
30,610 | lucee/Lucee | core/src/main/java/lucee/runtime/tag/Collection.java | Collection.doCreate | private void doCreate() throws SearchException, PageException {
required("collection", action, "collection", collection);
required("collection", action, "path", path);
getSearchEngine().createCollection(collection, path, language, SearchEngine.DENY_OVERWRITE);
} | java | private void doCreate() throws SearchException, PageException {
required("collection", action, "collection", collection);
required("collection", action, "path", path);
getSearchEngine().createCollection(collection, path, language, SearchEngine.DENY_OVERWRITE);
} | [
"private",
"void",
"doCreate",
"(",
")",
"throws",
"SearchException",
",",
"PageException",
"{",
"required",
"(",
"\"collection\"",
",",
"action",
",",
"\"collection\"",
",",
"collection",
")",
";",
"required",
"(",
"\"collection\"",
",",
"action",
",",
"\"path\... | Creates a new collection
@throws SearchException
@throws PageException | [
"Creates",
"a",
"new",
"collection"
] | 29b153fc4e126e5edb97da937f2ee2e231b87593 | https://github.com/lucee/Lucee/blob/29b153fc4e126e5edb97da937f2ee2e231b87593/core/src/main/java/lucee/runtime/tag/Collection.java#L249-L253 |
30,611 | lucee/Lucee | core/src/main/java/lucee/commons/lang/ClassUtil.java | ClassUtil.isBytecode | public static boolean isBytecode(InputStream is) throws IOException {
if (!is.markSupported()) throw new IOException("can only read input streams that support mark/reset");
is.mark(-1);
// print(bytes);
int first = is.read();
int second = is.read();
boolean rtn = (first == ICA && second == IFE && is.read() == IBA && is.read() == IBE);
is.reset();
return rtn;
} | java | public static boolean isBytecode(InputStream is) throws IOException {
if (!is.markSupported()) throw new IOException("can only read input streams that support mark/reset");
is.mark(-1);
// print(bytes);
int first = is.read();
int second = is.read();
boolean rtn = (first == ICA && second == IFE && is.read() == IBA && is.read() == IBE);
is.reset();
return rtn;
} | [
"public",
"static",
"boolean",
"isBytecode",
"(",
"InputStream",
"is",
")",
"throws",
"IOException",
"{",
"if",
"(",
"!",
"is",
".",
"markSupported",
"(",
")",
")",
"throw",
"new",
"IOException",
"(",
"\"can only read input streams that support mark/reset\"",
")",
... | check if given stream is a bytecode stream, if yes remove bytecode mark
@param is
@return is bytecode stream
@throws IOException | [
"check",
"if",
"given",
"stream",
"is",
"a",
"bytecode",
"stream",
"if",
"yes",
"remove",
"bytecode",
"mark"
] | 29b153fc4e126e5edb97da937f2ee2e231b87593 | https://github.com/lucee/Lucee/blob/29b153fc4e126e5edb97da937f2ee2e231b87593/core/src/main/java/lucee/commons/lang/ClassUtil.java#L597-L607 |
30,612 | lucee/Lucee | core/src/main/java/lucee/commons/lang/ClassUtil.java | ClassUtil.getFieldNames | public static String[] getFieldNames(Class clazz) {
Field[] fields = clazz.getFields();
String[] names = new String[fields.length];
for (int i = 0; i < names.length; i++) {
names[i] = fields[i].getName();
}
return names;
} | java | public static String[] getFieldNames(Class clazz) {
Field[] fields = clazz.getFields();
String[] names = new String[fields.length];
for (int i = 0; i < names.length; i++) {
names[i] = fields[i].getName();
}
return names;
} | [
"public",
"static",
"String",
"[",
"]",
"getFieldNames",
"(",
"Class",
"clazz",
")",
"{",
"Field",
"[",
"]",
"fields",
"=",
"clazz",
".",
"getFields",
"(",
")",
";",
"String",
"[",
"]",
"names",
"=",
"new",
"String",
"[",
"fields",
".",
"length",
"]"... | return all field names as String array
@param clazz class to get field names from
@return field names | [
"return",
"all",
"field",
"names",
"as",
"String",
"array"
] | 29b153fc4e126e5edb97da937f2ee2e231b87593 | https://github.com/lucee/Lucee/blob/29b153fc4e126e5edb97da937f2ee2e231b87593/core/src/main/java/lucee/commons/lang/ClassUtil.java#L686-L693 |
30,613 | lucee/Lucee | core/src/main/java/lucee/commons/lang/ClassUtil.java | ClassUtil.getSourcePathForClass | public static String getSourcePathForClass(Class clazz, String defaultValue) {
try {
String result = clazz.getProtectionDomain().getCodeSource().getLocation().getPath();
result = URLDecoder.decode(result, CharsetUtil.UTF8.name());
result = SystemUtil.fixWindowsPath(result);
return result;
}
catch (Throwable t) {
ExceptionUtil.rethrowIfNecessary(t);
}
return defaultValue;
} | java | public static String getSourcePathForClass(Class clazz, String defaultValue) {
try {
String result = clazz.getProtectionDomain().getCodeSource().getLocation().getPath();
result = URLDecoder.decode(result, CharsetUtil.UTF8.name());
result = SystemUtil.fixWindowsPath(result);
return result;
}
catch (Throwable t) {
ExceptionUtil.rethrowIfNecessary(t);
}
return defaultValue;
} | [
"public",
"static",
"String",
"getSourcePathForClass",
"(",
"Class",
"clazz",
",",
"String",
"defaultValue",
")",
"{",
"try",
"{",
"String",
"result",
"=",
"clazz",
".",
"getProtectionDomain",
"(",
")",
".",
"getCodeSource",
"(",
")",
".",
"getLocation",
"(",
... | returns the path to the directory or jar file that the class was loaded from
@param clazz - the Class object to check, for a live object pass obj.getClass();
@param defaultValue - a value to return in case the source could not be determined
@return | [
"returns",
"the",
"path",
"to",
"the",
"directory",
"or",
"jar",
"file",
"that",
"the",
"class",
"was",
"loaded",
"from"
] | 29b153fc4e126e5edb97da937f2ee2e231b87593 | https://github.com/lucee/Lucee/blob/29b153fc4e126e5edb97da937f2ee2e231b87593/core/src/main/java/lucee/commons/lang/ClassUtil.java#L726-L740 |
30,614 | lucee/Lucee | core/src/main/java/lucee/commons/lang/ClassUtil.java | ClassUtil.getSourcePathForClass | public static String getSourcePathForClass(String className, String defaultValue) {
try {
return getSourcePathForClass(ClassUtil.loadClass(className), defaultValue);
}
catch (Throwable t) {
ExceptionUtil.rethrowIfNecessary(t);
}
return defaultValue;
} | java | public static String getSourcePathForClass(String className, String defaultValue) {
try {
return getSourcePathForClass(ClassUtil.loadClass(className), defaultValue);
}
catch (Throwable t) {
ExceptionUtil.rethrowIfNecessary(t);
}
return defaultValue;
} | [
"public",
"static",
"String",
"getSourcePathForClass",
"(",
"String",
"className",
",",
"String",
"defaultValue",
")",
"{",
"try",
"{",
"return",
"getSourcePathForClass",
"(",
"ClassUtil",
".",
"loadClass",
"(",
"className",
")",
",",
"defaultValue",
")",
";",
"... | tries to load the class and returns the path that it was loaded from
@param className - the name of the class to check
@param defaultValue - a value to return in case the source could not be determined
@return | [
"tries",
"to",
"load",
"the",
"class",
"and",
"returns",
"the",
"path",
"that",
"it",
"was",
"loaded",
"from"
] | 29b153fc4e126e5edb97da937f2ee2e231b87593 | https://github.com/lucee/Lucee/blob/29b153fc4e126e5edb97da937f2ee2e231b87593/core/src/main/java/lucee/commons/lang/ClassUtil.java#L749-L760 |
30,615 | lucee/Lucee | core/src/main/java/lucee/commons/lang/ClassUtil.java | ClassUtil.extractPackage | public static String extractPackage(String className) {
if (className == null) return null;
int index = className.lastIndexOf('.');
if (index != -1) return className.substring(0, index);
return null;
} | java | public static String extractPackage(String className) {
if (className == null) return null;
int index = className.lastIndexOf('.');
if (index != -1) return className.substring(0, index);
return null;
} | [
"public",
"static",
"String",
"extractPackage",
"(",
"String",
"className",
")",
"{",
"if",
"(",
"className",
"==",
"null",
")",
"return",
"null",
";",
"int",
"index",
"=",
"className",
".",
"lastIndexOf",
"(",
"'",
"'",
")",
";",
"if",
"(",
"index",
"... | extracts the package from a className, return null, if there is none.
@param className
@return | [
"extracts",
"the",
"package",
"from",
"a",
"className",
"return",
"null",
"if",
"there",
"is",
"none",
"."
] | 29b153fc4e126e5edb97da937f2ee2e231b87593 | https://github.com/lucee/Lucee/blob/29b153fc4e126e5edb97da937f2ee2e231b87593/core/src/main/java/lucee/commons/lang/ClassUtil.java#L768-L773 |
30,616 | lucee/Lucee | core/src/main/java/lucee/commons/lang/ClassUtil.java | ClassUtil.extractName | public static String extractName(String className) {
if (className == null) return null;
int index = className.lastIndexOf('.');
if (index != -1) return className.substring(index + 1);
return className;
} | java | public static String extractName(String className) {
if (className == null) return null;
int index = className.lastIndexOf('.');
if (index != -1) return className.substring(index + 1);
return className;
} | [
"public",
"static",
"String",
"extractName",
"(",
"String",
"className",
")",
"{",
"if",
"(",
"className",
"==",
"null",
")",
"return",
"null",
";",
"int",
"index",
"=",
"className",
".",
"lastIndexOf",
"(",
"'",
"'",
")",
";",
"if",
"(",
"index",
"!="... | extracts the class name of a classname with package
@param className
@return | [
"extracts",
"the",
"class",
"name",
"of",
"a",
"classname",
"with",
"package"
] | 29b153fc4e126e5edb97da937f2ee2e231b87593 | https://github.com/lucee/Lucee/blob/29b153fc4e126e5edb97da937f2ee2e231b87593/core/src/main/java/lucee/commons/lang/ClassUtil.java#L781-L786 |
30,617 | lucee/Lucee | core/src/main/java/lucee/commons/lang/ClassUtil.java | ClassUtil.loadClass | public static Class loadClass(String className, String bundleName, String bundleVersion, Identification id) throws ClassException, BundleException {
if (StringUtil.isEmpty(bundleName)) return loadClass(className);
return loadClassByBundle(className, bundleName, bundleVersion, id);
} | java | public static Class loadClass(String className, String bundleName, String bundleVersion, Identification id) throws ClassException, BundleException {
if (StringUtil.isEmpty(bundleName)) return loadClass(className);
return loadClassByBundle(className, bundleName, bundleVersion, id);
} | [
"public",
"static",
"Class",
"loadClass",
"(",
"String",
"className",
",",
"String",
"bundleName",
",",
"String",
"bundleVersion",
",",
"Identification",
"id",
")",
"throws",
"ClassException",
",",
"BundleException",
"{",
"if",
"(",
"StringUtil",
".",
"isEmpty",
... | if no bundle is defined it is loaded the old way
@param className
@param bundleName
@param bundleVersion
@param id
@return
@throws ClassException
@throws BundleException | [
"if",
"no",
"bundle",
"is",
"defined",
"it",
"is",
"loaded",
"the",
"old",
"way"
] | 29b153fc4e126e5edb97da937f2ee2e231b87593 | https://github.com/lucee/Lucee/blob/29b153fc4e126e5edb97da937f2ee2e231b87593/core/src/main/java/lucee/commons/lang/ClassUtil.java#L799-L802 |
30,618 | lucee/Lucee | core/src/main/java/lucee/runtime/type/scope/UndefinedImpl.java | UndefinedImpl.getScopeFor | public Collection getScopeFor(Collection.Key key, Scope defaultValue) {
Object rtn = null;
if (checkArguments) {
rtn = local.get(key, NullSupportHelper.NULL());
if (rtn != NullSupportHelper.NULL()) return local;
rtn = argument.getFunctionArgument(key, NullSupportHelper.NULL());
if (rtn != NullSupportHelper.NULL()) return argument;
}
// get data from queries
if (allowImplicidQueryCall && pc.getCurrentTemplateDialect() == CFMLEngine.DIALECT_CFML && !qryStack.isEmpty()) {
QueryColumn qc = qryStack.getColumnFromACollection(key);
if (qc != null) return (Query) qc.getParent();
}
// variable
rtn = variable.get(key, NullSupportHelper.NULL());
if (rtn != NullSupportHelper.NULL()) {
return variable;
}
// thread scopes
if (pc.hasFamily()) {
Threads t = (Threads) pc.getThreadScope(key, NullSupportHelper.NULL());
if (rtn != NullSupportHelper.NULL()) return t;
}
// get a scope value (only cfml is searcing additional scopes)
if (pc.getCurrentTemplateDialect() == CFMLEngine.DIALECT_CFML) {
for (int i = 0; i < scopes.length; i++) {
rtn = scopes[i].get(key, NullSupportHelper.NULL());
if (rtn != NullSupportHelper.NULL()) {
return scopes[i];
}
}
}
return defaultValue;
} | java | public Collection getScopeFor(Collection.Key key, Scope defaultValue) {
Object rtn = null;
if (checkArguments) {
rtn = local.get(key, NullSupportHelper.NULL());
if (rtn != NullSupportHelper.NULL()) return local;
rtn = argument.getFunctionArgument(key, NullSupportHelper.NULL());
if (rtn != NullSupportHelper.NULL()) return argument;
}
// get data from queries
if (allowImplicidQueryCall && pc.getCurrentTemplateDialect() == CFMLEngine.DIALECT_CFML && !qryStack.isEmpty()) {
QueryColumn qc = qryStack.getColumnFromACollection(key);
if (qc != null) return (Query) qc.getParent();
}
// variable
rtn = variable.get(key, NullSupportHelper.NULL());
if (rtn != NullSupportHelper.NULL()) {
return variable;
}
// thread scopes
if (pc.hasFamily()) {
Threads t = (Threads) pc.getThreadScope(key, NullSupportHelper.NULL());
if (rtn != NullSupportHelper.NULL()) return t;
}
// get a scope value (only cfml is searcing additional scopes)
if (pc.getCurrentTemplateDialect() == CFMLEngine.DIALECT_CFML) {
for (int i = 0; i < scopes.length; i++) {
rtn = scopes[i].get(key, NullSupportHelper.NULL());
if (rtn != NullSupportHelper.NULL()) {
return scopes[i];
}
}
}
return defaultValue;
} | [
"public",
"Collection",
"getScopeFor",
"(",
"Collection",
".",
"Key",
"key",
",",
"Scope",
"defaultValue",
")",
"{",
"Object",
"rtn",
"=",
"null",
";",
"if",
"(",
"checkArguments",
")",
"{",
"rtn",
"=",
"local",
".",
"get",
"(",
"key",
",",
"NullSupportH... | returns the scope that contains a specific key
@param key
@return | [
"returns",
"the",
"scope",
"that",
"contains",
"a",
"specific",
"key"
] | 29b153fc4e126e5edb97da937f2ee2e231b87593 | https://github.com/lucee/Lucee/blob/29b153fc4e126e5edb97da937f2ee2e231b87593/core/src/main/java/lucee/runtime/type/scope/UndefinedImpl.java#L304-L342 |
30,619 | lucee/Lucee | core/src/main/java/lucee/runtime/type/scope/UndefinedImpl.java | UndefinedImpl.getScopeNames | @Override
public List<String> getScopeNames() {
List<String> scopeNames = new ArrayList<String>();
if (checkArguments) {
scopeNames.add("local");
scopeNames.add("arguments");
}
scopeNames.add("variables");
// thread scopes
if (pc.hasFamily()) {
String[] names = pc.getThreadScopeNames();
for (int i = 0; i < names.length; i++)
scopeNames.add(i, names[i]);
}
for (int i = 0; i < scopes.length; i++) {
scopeNames.add((scopes[i]).getTypeAsString());
}
return scopeNames;
}
@Override
public Object getCollection(Key key) throws PageException {
Object rtn = null;
if (checkArguments) {
rtn = local.get(key, NullSupportHelper.NULL());
if (rtn != NullSupportHelper.NULL()) return rtn;
rtn = argument.getFunctionArgument(key, NullSupportHelper.NULL());
if (rtn != NullSupportHelper.NULL()) {
if (debug) debugCascadedAccess(pc, argument.getTypeAsString(), key);
return rtn;
}
}
// get data from queries
if (allowImplicidQueryCall && pc.getCurrentTemplateDialect() == CFMLEngine.DIALECT_CFML && !qryStack.isEmpty()) {
rtn = qryStack.getColumnFromACollection(key);
if (rtn != null) {
if (debug) debugCascadedAccess(pc, "query", key);
return rtn;
}
}
// variable
rtn = variable.get(key, NullSupportHelper.NULL());
if (rtn != NullSupportHelper.NULL()) {
if (debug && checkArguments) debugCascadedAccess(pc, variable, rtn, key);
return rtn;
}
// thread scopes
if (pc.hasFamily()) {
rtn = pc.getThreadScope(key, NullSupportHelper.NULL());
if (rtn != NullSupportHelper.NULL()) {
if (debug) debugCascadedAccess(pc, "thread", key);
return rtn;
}
}
// get a scope value (only CFML is searching addioanl scopes)
if (pc.getCurrentTemplateDialect() == CFMLEngine.DIALECT_CFML) {
for (int i = 0; i < scopes.length; i++) {
rtn = scopes[i].get(key, NullSupportHelper.NULL());
if (rtn != NullSupportHelper.NULL()) {
if (debug) debugCascadedAccess(pc, scopes[i].getTypeAsString(), key);
return rtn;
}
}
}
throw new ExpressionException("variable [" + key.getString() + "] doesn't exist");
}
@Override
public Object get(Collection.Key key, Object defaultValue) {
Object rtn = null;
if (checkArguments) {
rtn = local.get(key, NullSupportHelper.NULL());
if (rtn != NullSupportHelper.NULL()) return rtn;
rtn = argument.getFunctionArgument(key, NullSupportHelper.NULL());
if (rtn != NullSupportHelper.NULL()) {
if (debug) debugCascadedAccess(pc, argument.getTypeAsString(), key);
return rtn;
}
}
// get data from queries
if (allowImplicidQueryCall && pc.getCurrentTemplateDialect() == CFMLEngine.DIALECT_CFML && !qryStack.isEmpty()) {
rtn = qryStack.getDataFromACollection(pc, key, NullSupportHelper.NULL());
if (rtn != NullSupportHelper.NULL()) {
if (debug) debugCascadedAccess(pc, "query", key);
return rtn;
}
}
// variable
rtn = variable.get(key, NullSupportHelper.NULL());
if (rtn != NullSupportHelper.NULL()) {
if (debug && checkArguments) debugCascadedAccess(pc, variable, rtn, key);
return rtn;
}
// thread scopes
if (pc.hasFamily()) {
rtn = pc.getThreadScope(key, NullSupportHelper.NULL());
if (rtn != NullSupportHelper.NULL()) {
if (debug && checkArguments) debugCascadedAccess(pc, "thread", key);
return rtn;
}
}
// get a scope value (only CFML is searching additional scopes)
if (pc.getCurrentTemplateDialect() == CFMLEngine.DIALECT_CFML) {
for (int i = 0; i < scopes.length; i++) {
rtn = scopes[i].get(key, NullSupportHelper.NULL());
if (rtn != NullSupportHelper.NULL()) {
if (debug) debugCascadedAccess(pc, scopes[i].getTypeAsString(), key);
return rtn;
}
}
}
return defaultValue;
}
@Override
public Object getCascading(Collection.Key key) {
throw new RuntimeException("this method is no longer supported, use getCascading(Collection.Key key, Object defaultValue) instead");
}
@Override
public Object getCascading(Collection.Key key, Object defaultValue) {
Object rtn;
// get a scope value (only CFML is searching additional scopes)
if (pc.getCurrentTemplateDialect() == CFMLEngine.DIALECT_CFML) {
for (int i = 0; i < scopes.length; i++) {
rtn = scopes[i].get(key, NullSupportHelper.NULL());
if (rtn != NullSupportHelper.NULL()) {
return rtn;
}
}
}
return defaultValue;
}
@Override
public Object setEL(Collection.Key key, Object value) {
if (checkArguments) {
if (localAlways || local.containsKey(key)) return local.setEL(key, value);
if (argument.containsFunctionArgumentKey(key)) {
if (debug) debugCascadedAccess(pc, argument.getTypeAsString(), key);
return argument.setEL(key, value);
}
}
if (debug && checkArguments) debugCascadedAccess(pc, variable.getTypeAsString(), key);
return variable.setEL(key, value);
}
@Override
public Object set(Collection.Key key, Object value) throws PageException {
if (checkArguments) {
if (localAlways || local.containsKey(key)) return local.set(key, value);
if (argument.containsFunctionArgumentKey(key)) {
if (debug) debugCascadedAccess(pc, argument.getTypeAsString(), key);
return argument.set(key, value);
}
}
if (debug && checkArguments) debugCascadedAccess(pc, variable.getTypeAsString(), key);
return variable.set(key, value);
}
@Override
public DumpData toDumpData(PageContext pageContext, int maxlevel, DumpProperties dp) {
return variable.toDumpData(pageContext, maxlevel, dp);
}
@Override
public Iterator<Collection.Key> keyIterator() {
return variable.keyIterator();
}
@Override
public Iterator<String> keysAsStringIterator() {
return variable.keysAsStringIterator();
}
@Override
public Iterator<Entry<Key, Object>> entryIterator() {
return variable.entryIterator();
}
@Override
public Iterator<Object> valueIterator() {
return variable.valueIterator();
}
@Override
public boolean isInitalized() {
return isInit;
}
@Override
public void initialize(PageContext pc) {
// if(isInitalized()) return;
isInit = true;
variable = pc.variablesScope();
argument = pc.argumentsScope();
local = pc.localScope();
allowImplicidQueryCall = pc.getConfig().allowImplicidQueryCall();
type = ((PageContextImpl) pc).getScopeCascadingType();
debug = pc.getConfig().debug() && ((ConfigImpl) pc.getConfig()).hasDebugOptions(ConfigImpl.DEBUG_IMPLICIT_ACCESS);
// Strict
if (type == Config.SCOPE_STRICT) {
// print.ln("strict");
scopes = new Scope[] {};
}
// small
else if (type == Config.SCOPE_SMALL) {
// print.ln("small");
if (pc.getConfig().mergeFormAndURL()) {
scopes = new Scope[] { pc.formScope() };
}
else {
scopes = new Scope[] { pc.urlScope(), pc.formScope() };
}
}
// standard
else {
reinitialize(pc);
}
}
@Override
public void reinitialize(PageContext pc) {
if (type != Config.SCOPE_STANDARD) return;
Client cs = pc.clientScopeEL();
// print.ln("standard");
if (pc.getConfig().mergeFormAndURL()) {
scopes = new Scope[cs == null ? 3 : 4];
scopes[0] = pc.cgiScope();
scopes[1] = pc.formScope();
scopes[2] = pc.cookieScope();
if (cs != null) scopes[3] = cs;
}
else {
scopes = new Scope[cs == null ? 4 : 5];
scopes[0] = pc.cgiScope();
scopes[1] = pc.urlScope();
scopes[2] = pc.formScope();
scopes[3] = pc.cookieScope();
if (cs != null) scopes[4] = cs;
}
}
@Override
public final void release(PageContext pc) {
isInit = false;
argument = null;
local = null;
variable = null;
scopes = null;
checkArguments = false;
localAlways = false;
if (allowImplicidQueryCall) qryStack.clear();
}
@Override
public Collection duplicate(boolean deepCopy) {
UndefinedImpl dupl = new UndefinedImpl(pc, type);
dupl.allowImplicidQueryCall = allowImplicidQueryCall;
dupl.checkArguments = checkArguments;
dupl.argument = deepCopy ? (Argument) Duplicator.duplicate(argument, deepCopy) : argument;
dupl.isInit = isInit;
dupl.local = deepCopy ? (Local) Duplicator.duplicate(local, deepCopy) : local;
dupl.localAlways = localAlways;
dupl.qryStack = (deepCopy ? (QueryStackImpl) Duplicator.duplicate(qryStack, deepCopy) : qryStack);
dupl.variable = deepCopy ? (Variables) Duplicator.duplicate(variable, deepCopy) : variable;
dupl.pc = pc;
dupl.debug = debug;
// scopes
if (deepCopy) {
dupl.scopes = new Scope[scopes.length];
for (int i = 0; i < scopes.length; i++) {
dupl.scopes[i] = (Scope) Duplicator.duplicate(scopes[i], deepCopy);
}
}
else dupl.scopes = scopes;
return dupl;
}
@Override
public boolean containsKey(Key key) {
return get(key, null) != null;
}
@Override
public String castToString() throws ExpressionException {
throw new ExpressionException("Can't cast Complex Object Type Struct to String", "Use Built-In-Function \"serialize(Struct):String\" to create a String from Struct");
}
@Override
public String castToString(String defaultValue) {
return defaultValue;
}
@Override
public boolean castToBooleanValue() throws ExpressionException {
throw new ExpressionException("Can't cast Complex Object Type Struct to a boolean value");
}
@Override
public Boolean castToBoolean(Boolean defaultValue) {
return defaultValue;
}
@Override
public double castToDoubleValue() throws ExpressionException {
throw new ExpressionException("Can't cast Complex Object Type Struct to a number value");
}
@Override
public double castToDoubleValue(double defaultValue) {
return defaultValue;
}
@Override
public DateTime castToDateTime() throws ExpressionException {
throw new ExpressionException("Can't cast Complex Object Type Struct to a Date");
}
@Override
public DateTime castToDateTime(DateTime defaultValue) {
return defaultValue;
}
@Override
public int compareTo(boolean b) throws ExpressionException {
throw new ExpressionException("can't compare Complex Object Type Struct with a boolean value");
}
@Override
public int compareTo(DateTime dt) throws PageException {
throw new ExpressionException("can't compare Complex Object Type Struct with a DateTime Object");
}
@Override
public int compareTo(double d) throws PageException {
throw new ExpressionException("can't compare Complex Object Type Struct with a numeric value");
}
@Override
public int compareTo(String str) throws PageException {
throw new ExpressionException("can't compare Complex Object Type Struct with a String");
}
@Override
public void setVariableScope(Variables scope) {
variable = scope;
}
@Override
public int getType() {
return SCOPE_UNDEFINED;
}
@Override
public String getTypeAsString() {
return "undefined";
}
/**
* @return the allowImplicidQueryCall
*/
public boolean isAllowImplicidQueryCall() {
return allowImplicidQueryCall;
}
/**
* @param allowImplicidQueryCall the allowImplicidQueryCall to set
*/
@Override
public boolean setAllowImplicidQueryCall(boolean allowImplicidQueryCall) {
boolean old = this.allowImplicidQueryCall;
this.allowImplicidQueryCall = allowImplicidQueryCall;
return old;
}
/**
* @return the checkArguments
*/
@Override
public boolean getCheckArguments() {
return checkArguments;
}
@Override
public Object call(PageContext pc, final Key methodName, Object[] args) throws PageException {
Object obj = get(methodName, null); // every none UDF value is fine as default argument
if (obj instanceof UDFPlus) {
return ((UDFPlus) obj).call(pc, methodName, args, false);
}
UDF udf = getUDF(pc, methodName);
if (udf instanceof UDFPlus) {
return ((UDFPlus) udf).call(pc, methodName, args, false);
}
throw new ExpressionException("No matching function [" + methodName + "] found");
}
@Override
public Object callWithNamedValues(PageContext pc, Key methodName, Struct args) throws PageException {
Object obj = get(methodName, null);
if (obj instanceof UDFPlus) {
return ((UDFPlus) obj).callWithNamedValues(pc, methodName, args, false);
}
UDF udf = getUDF(pc, methodName);
if (udf instanceof UDFPlus) {
return ((UDFPlus) udf).callWithNamedValues(pc, methodName, args, false);
}
throw new ExpressionException("No matching function [" + methodName + "] found");
}
private UDF getUDF(PageContext pc, Key methodName) throws PageException {
ApplicationContextSupport ac = (ApplicationContextSupport) pc.getApplicationContext();
if (ac != null) {
List<Resource> dirs = ac.getFunctionDirectories();
Resource[] files;
if (dirs != null && dirs.size() > 0) {
Resource file = null;
Iterator<Resource> it = dirs.iterator();
Resource dir;
while (it.hasNext()) {
dir = it.next();
files = dir.listResources(new ResourceNameFilter() {
@Override
public boolean accept(Resource dir, String name) {
String[] exts = Constants.getTemplateExtensions();
for (String ex: exts) {
if (name.equalsIgnoreCase(methodName + "." + ex)) return true;
}
return false;
}
});
if (files != null && files.length > 0) {
file = files[0];
break;
}
}
if (file != null) {
return CFFunction.loadUDF(pc, file, methodName, pc.getConfig() instanceof ConfigWeb, false);
}
}
}
return null;
}
public short getScopeCascadingType() {
return type;
} | java | @Override
public List<String> getScopeNames() {
List<String> scopeNames = new ArrayList<String>();
if (checkArguments) {
scopeNames.add("local");
scopeNames.add("arguments");
}
scopeNames.add("variables");
// thread scopes
if (pc.hasFamily()) {
String[] names = pc.getThreadScopeNames();
for (int i = 0; i < names.length; i++)
scopeNames.add(i, names[i]);
}
for (int i = 0; i < scopes.length; i++) {
scopeNames.add((scopes[i]).getTypeAsString());
}
return scopeNames;
}
@Override
public Object getCollection(Key key) throws PageException {
Object rtn = null;
if (checkArguments) {
rtn = local.get(key, NullSupportHelper.NULL());
if (rtn != NullSupportHelper.NULL()) return rtn;
rtn = argument.getFunctionArgument(key, NullSupportHelper.NULL());
if (rtn != NullSupportHelper.NULL()) {
if (debug) debugCascadedAccess(pc, argument.getTypeAsString(), key);
return rtn;
}
}
// get data from queries
if (allowImplicidQueryCall && pc.getCurrentTemplateDialect() == CFMLEngine.DIALECT_CFML && !qryStack.isEmpty()) {
rtn = qryStack.getColumnFromACollection(key);
if (rtn != null) {
if (debug) debugCascadedAccess(pc, "query", key);
return rtn;
}
}
// variable
rtn = variable.get(key, NullSupportHelper.NULL());
if (rtn != NullSupportHelper.NULL()) {
if (debug && checkArguments) debugCascadedAccess(pc, variable, rtn, key);
return rtn;
}
// thread scopes
if (pc.hasFamily()) {
rtn = pc.getThreadScope(key, NullSupportHelper.NULL());
if (rtn != NullSupportHelper.NULL()) {
if (debug) debugCascadedAccess(pc, "thread", key);
return rtn;
}
}
// get a scope value (only CFML is searching addioanl scopes)
if (pc.getCurrentTemplateDialect() == CFMLEngine.DIALECT_CFML) {
for (int i = 0; i < scopes.length; i++) {
rtn = scopes[i].get(key, NullSupportHelper.NULL());
if (rtn != NullSupportHelper.NULL()) {
if (debug) debugCascadedAccess(pc, scopes[i].getTypeAsString(), key);
return rtn;
}
}
}
throw new ExpressionException("variable [" + key.getString() + "] doesn't exist");
}
@Override
public Object get(Collection.Key key, Object defaultValue) {
Object rtn = null;
if (checkArguments) {
rtn = local.get(key, NullSupportHelper.NULL());
if (rtn != NullSupportHelper.NULL()) return rtn;
rtn = argument.getFunctionArgument(key, NullSupportHelper.NULL());
if (rtn != NullSupportHelper.NULL()) {
if (debug) debugCascadedAccess(pc, argument.getTypeAsString(), key);
return rtn;
}
}
// get data from queries
if (allowImplicidQueryCall && pc.getCurrentTemplateDialect() == CFMLEngine.DIALECT_CFML && !qryStack.isEmpty()) {
rtn = qryStack.getDataFromACollection(pc, key, NullSupportHelper.NULL());
if (rtn != NullSupportHelper.NULL()) {
if (debug) debugCascadedAccess(pc, "query", key);
return rtn;
}
}
// variable
rtn = variable.get(key, NullSupportHelper.NULL());
if (rtn != NullSupportHelper.NULL()) {
if (debug && checkArguments) debugCascadedAccess(pc, variable, rtn, key);
return rtn;
}
// thread scopes
if (pc.hasFamily()) {
rtn = pc.getThreadScope(key, NullSupportHelper.NULL());
if (rtn != NullSupportHelper.NULL()) {
if (debug && checkArguments) debugCascadedAccess(pc, "thread", key);
return rtn;
}
}
// get a scope value (only CFML is searching additional scopes)
if (pc.getCurrentTemplateDialect() == CFMLEngine.DIALECT_CFML) {
for (int i = 0; i < scopes.length; i++) {
rtn = scopes[i].get(key, NullSupportHelper.NULL());
if (rtn != NullSupportHelper.NULL()) {
if (debug) debugCascadedAccess(pc, scopes[i].getTypeAsString(), key);
return rtn;
}
}
}
return defaultValue;
}
@Override
public Object getCascading(Collection.Key key) {
throw new RuntimeException("this method is no longer supported, use getCascading(Collection.Key key, Object defaultValue) instead");
}
@Override
public Object getCascading(Collection.Key key, Object defaultValue) {
Object rtn;
// get a scope value (only CFML is searching additional scopes)
if (pc.getCurrentTemplateDialect() == CFMLEngine.DIALECT_CFML) {
for (int i = 0; i < scopes.length; i++) {
rtn = scopes[i].get(key, NullSupportHelper.NULL());
if (rtn != NullSupportHelper.NULL()) {
return rtn;
}
}
}
return defaultValue;
}
@Override
public Object setEL(Collection.Key key, Object value) {
if (checkArguments) {
if (localAlways || local.containsKey(key)) return local.setEL(key, value);
if (argument.containsFunctionArgumentKey(key)) {
if (debug) debugCascadedAccess(pc, argument.getTypeAsString(), key);
return argument.setEL(key, value);
}
}
if (debug && checkArguments) debugCascadedAccess(pc, variable.getTypeAsString(), key);
return variable.setEL(key, value);
}
@Override
public Object set(Collection.Key key, Object value) throws PageException {
if (checkArguments) {
if (localAlways || local.containsKey(key)) return local.set(key, value);
if (argument.containsFunctionArgumentKey(key)) {
if (debug) debugCascadedAccess(pc, argument.getTypeAsString(), key);
return argument.set(key, value);
}
}
if (debug && checkArguments) debugCascadedAccess(pc, variable.getTypeAsString(), key);
return variable.set(key, value);
}
@Override
public DumpData toDumpData(PageContext pageContext, int maxlevel, DumpProperties dp) {
return variable.toDumpData(pageContext, maxlevel, dp);
}
@Override
public Iterator<Collection.Key> keyIterator() {
return variable.keyIterator();
}
@Override
public Iterator<String> keysAsStringIterator() {
return variable.keysAsStringIterator();
}
@Override
public Iterator<Entry<Key, Object>> entryIterator() {
return variable.entryIterator();
}
@Override
public Iterator<Object> valueIterator() {
return variable.valueIterator();
}
@Override
public boolean isInitalized() {
return isInit;
}
@Override
public void initialize(PageContext pc) {
// if(isInitalized()) return;
isInit = true;
variable = pc.variablesScope();
argument = pc.argumentsScope();
local = pc.localScope();
allowImplicidQueryCall = pc.getConfig().allowImplicidQueryCall();
type = ((PageContextImpl) pc).getScopeCascadingType();
debug = pc.getConfig().debug() && ((ConfigImpl) pc.getConfig()).hasDebugOptions(ConfigImpl.DEBUG_IMPLICIT_ACCESS);
// Strict
if (type == Config.SCOPE_STRICT) {
// print.ln("strict");
scopes = new Scope[] {};
}
// small
else if (type == Config.SCOPE_SMALL) {
// print.ln("small");
if (pc.getConfig().mergeFormAndURL()) {
scopes = new Scope[] { pc.formScope() };
}
else {
scopes = new Scope[] { pc.urlScope(), pc.formScope() };
}
}
// standard
else {
reinitialize(pc);
}
}
@Override
public void reinitialize(PageContext pc) {
if (type != Config.SCOPE_STANDARD) return;
Client cs = pc.clientScopeEL();
// print.ln("standard");
if (pc.getConfig().mergeFormAndURL()) {
scopes = new Scope[cs == null ? 3 : 4];
scopes[0] = pc.cgiScope();
scopes[1] = pc.formScope();
scopes[2] = pc.cookieScope();
if (cs != null) scopes[3] = cs;
}
else {
scopes = new Scope[cs == null ? 4 : 5];
scopes[0] = pc.cgiScope();
scopes[1] = pc.urlScope();
scopes[2] = pc.formScope();
scopes[3] = pc.cookieScope();
if (cs != null) scopes[4] = cs;
}
}
@Override
public final void release(PageContext pc) {
isInit = false;
argument = null;
local = null;
variable = null;
scopes = null;
checkArguments = false;
localAlways = false;
if (allowImplicidQueryCall) qryStack.clear();
}
@Override
public Collection duplicate(boolean deepCopy) {
UndefinedImpl dupl = new UndefinedImpl(pc, type);
dupl.allowImplicidQueryCall = allowImplicidQueryCall;
dupl.checkArguments = checkArguments;
dupl.argument = deepCopy ? (Argument) Duplicator.duplicate(argument, deepCopy) : argument;
dupl.isInit = isInit;
dupl.local = deepCopy ? (Local) Duplicator.duplicate(local, deepCopy) : local;
dupl.localAlways = localAlways;
dupl.qryStack = (deepCopy ? (QueryStackImpl) Duplicator.duplicate(qryStack, deepCopy) : qryStack);
dupl.variable = deepCopy ? (Variables) Duplicator.duplicate(variable, deepCopy) : variable;
dupl.pc = pc;
dupl.debug = debug;
// scopes
if (deepCopy) {
dupl.scopes = new Scope[scopes.length];
for (int i = 0; i < scopes.length; i++) {
dupl.scopes[i] = (Scope) Duplicator.duplicate(scopes[i], deepCopy);
}
}
else dupl.scopes = scopes;
return dupl;
}
@Override
public boolean containsKey(Key key) {
return get(key, null) != null;
}
@Override
public String castToString() throws ExpressionException {
throw new ExpressionException("Can't cast Complex Object Type Struct to String", "Use Built-In-Function \"serialize(Struct):String\" to create a String from Struct");
}
@Override
public String castToString(String defaultValue) {
return defaultValue;
}
@Override
public boolean castToBooleanValue() throws ExpressionException {
throw new ExpressionException("Can't cast Complex Object Type Struct to a boolean value");
}
@Override
public Boolean castToBoolean(Boolean defaultValue) {
return defaultValue;
}
@Override
public double castToDoubleValue() throws ExpressionException {
throw new ExpressionException("Can't cast Complex Object Type Struct to a number value");
}
@Override
public double castToDoubleValue(double defaultValue) {
return defaultValue;
}
@Override
public DateTime castToDateTime() throws ExpressionException {
throw new ExpressionException("Can't cast Complex Object Type Struct to a Date");
}
@Override
public DateTime castToDateTime(DateTime defaultValue) {
return defaultValue;
}
@Override
public int compareTo(boolean b) throws ExpressionException {
throw new ExpressionException("can't compare Complex Object Type Struct with a boolean value");
}
@Override
public int compareTo(DateTime dt) throws PageException {
throw new ExpressionException("can't compare Complex Object Type Struct with a DateTime Object");
}
@Override
public int compareTo(double d) throws PageException {
throw new ExpressionException("can't compare Complex Object Type Struct with a numeric value");
}
@Override
public int compareTo(String str) throws PageException {
throw new ExpressionException("can't compare Complex Object Type Struct with a String");
}
@Override
public void setVariableScope(Variables scope) {
variable = scope;
}
@Override
public int getType() {
return SCOPE_UNDEFINED;
}
@Override
public String getTypeAsString() {
return "undefined";
}
/**
* @return the allowImplicidQueryCall
*/
public boolean isAllowImplicidQueryCall() {
return allowImplicidQueryCall;
}
/**
* @param allowImplicidQueryCall the allowImplicidQueryCall to set
*/
@Override
public boolean setAllowImplicidQueryCall(boolean allowImplicidQueryCall) {
boolean old = this.allowImplicidQueryCall;
this.allowImplicidQueryCall = allowImplicidQueryCall;
return old;
}
/**
* @return the checkArguments
*/
@Override
public boolean getCheckArguments() {
return checkArguments;
}
@Override
public Object call(PageContext pc, final Key methodName, Object[] args) throws PageException {
Object obj = get(methodName, null); // every none UDF value is fine as default argument
if (obj instanceof UDFPlus) {
return ((UDFPlus) obj).call(pc, methodName, args, false);
}
UDF udf = getUDF(pc, methodName);
if (udf instanceof UDFPlus) {
return ((UDFPlus) udf).call(pc, methodName, args, false);
}
throw new ExpressionException("No matching function [" + methodName + "] found");
}
@Override
public Object callWithNamedValues(PageContext pc, Key methodName, Struct args) throws PageException {
Object obj = get(methodName, null);
if (obj instanceof UDFPlus) {
return ((UDFPlus) obj).callWithNamedValues(pc, methodName, args, false);
}
UDF udf = getUDF(pc, methodName);
if (udf instanceof UDFPlus) {
return ((UDFPlus) udf).callWithNamedValues(pc, methodName, args, false);
}
throw new ExpressionException("No matching function [" + methodName + "] found");
}
private UDF getUDF(PageContext pc, Key methodName) throws PageException {
ApplicationContextSupport ac = (ApplicationContextSupport) pc.getApplicationContext();
if (ac != null) {
List<Resource> dirs = ac.getFunctionDirectories();
Resource[] files;
if (dirs != null && dirs.size() > 0) {
Resource file = null;
Iterator<Resource> it = dirs.iterator();
Resource dir;
while (it.hasNext()) {
dir = it.next();
files = dir.listResources(new ResourceNameFilter() {
@Override
public boolean accept(Resource dir, String name) {
String[] exts = Constants.getTemplateExtensions();
for (String ex: exts) {
if (name.equalsIgnoreCase(methodName + "." + ex)) return true;
}
return false;
}
});
if (files != null && files.length > 0) {
file = files[0];
break;
}
}
if (file != null) {
return CFFunction.loadUDF(pc, file, methodName, pc.getConfig() instanceof ConfigWeb, false);
}
}
}
return null;
}
public short getScopeCascadingType() {
return type;
} | [
"@",
"Override",
"public",
"List",
"<",
"String",
">",
"getScopeNames",
"(",
")",
"{",
"List",
"<",
"String",
">",
"scopeNames",
"=",
"new",
"ArrayList",
"<",
"String",
">",
"(",
")",
";",
"if",
"(",
"checkArguments",
")",
"{",
"scopeNames",
".",
"add"... | return a list of String with the scope names
@param key
@return | [
"return",
"a",
"list",
"of",
"String",
"with",
"the",
"scope",
"names"
] | 29b153fc4e126e5edb97da937f2ee2e231b87593 | https://github.com/lucee/Lucee/blob/29b153fc4e126e5edb97da937f2ee2e231b87593/core/src/main/java/lucee/runtime/type/scope/UndefinedImpl.java#L350-L818 |
30,620 | lucee/Lucee | core/src/main/java/lucee/runtime/type/scope/ServerImpl.java | ServerImpl.isReadOnlyKey | private boolean isReadOnlyKey(Collection.Key key) {
return (key.equals(KeyConstants._java) || key.equals(KeyConstants._separator) || key.equals(KeyConstants._os) || key.equals(KeyConstants._coldfusion)
|| key.equals(KeyConstants._lucee));
} | java | private boolean isReadOnlyKey(Collection.Key key) {
return (key.equals(KeyConstants._java) || key.equals(KeyConstants._separator) || key.equals(KeyConstants._os) || key.equals(KeyConstants._coldfusion)
|| key.equals(KeyConstants._lucee));
} | [
"private",
"boolean",
"isReadOnlyKey",
"(",
"Collection",
".",
"Key",
"key",
")",
"{",
"return",
"(",
"key",
".",
"equals",
"(",
"KeyConstants",
".",
"_java",
")",
"||",
"key",
".",
"equals",
"(",
"KeyConstants",
".",
"_separator",
")",
"||",
"key",
".",... | returns if the key is a readonly key
@param key key to check
@return is readonly | [
"returns",
"if",
"the",
"key",
"is",
"a",
"readonly",
"key"
] | 29b153fc4e126e5edb97da937f2ee2e231b87593 | https://github.com/lucee/Lucee/blob/29b153fc4e126e5edb97da937f2ee2e231b87593/core/src/main/java/lucee/runtime/type/scope/ServerImpl.java#L263-L267 |
30,621 | lucee/Lucee | core/src/main/java/lucee/intergral/fusiondebug/server/FDControllerImpl.java | FDControllerImpl.getByNativeIdentifier | private FDThreadImpl getByNativeIdentifier(String name, CFMLFactoryImpl factory, String id) {
Map<Integer, PageContextImpl> pcs = factory.getActivePageContexts();
Iterator<PageContextImpl> it = pcs.values().iterator();
PageContextImpl pc;
while (it.hasNext()) {
pc = it.next();
if (equals(pc, id)) return new FDThreadImpl(this, factory, name, pc);
}
return null;
} | java | private FDThreadImpl getByNativeIdentifier(String name, CFMLFactoryImpl factory, String id) {
Map<Integer, PageContextImpl> pcs = factory.getActivePageContexts();
Iterator<PageContextImpl> it = pcs.values().iterator();
PageContextImpl pc;
while (it.hasNext()) {
pc = it.next();
if (equals(pc, id)) return new FDThreadImpl(this, factory, name, pc);
}
return null;
} | [
"private",
"FDThreadImpl",
"getByNativeIdentifier",
"(",
"String",
"name",
",",
"CFMLFactoryImpl",
"factory",
",",
"String",
"id",
")",
"{",
"Map",
"<",
"Integer",
",",
"PageContextImpl",
">",
"pcs",
"=",
"factory",
".",
"getActivePageContexts",
"(",
")",
";",
... | checks a single CFMLFactory for the thread
@param name
@param factory
@param id
@return matching thread or null | [
"checks",
"a",
"single",
"CFMLFactory",
"for",
"the",
"thread"
] | 29b153fc4e126e5edb97da937f2ee2e231b87593 | https://github.com/lucee/Lucee/blob/29b153fc4e126e5edb97da937f2ee2e231b87593/core/src/main/java/lucee/intergral/fusiondebug/server/FDControllerImpl.java#L167-L177 |
30,622 | lucee/Lucee | core/src/main/java/lucee/commons/lang/mimetype/MimeType.java | MimeType.getInstance | public static MimeType getInstance(String strMimeType) {
if (strMimeType == null) return ALL;
strMimeType = strMimeType.trim();
if ("*".equals(strMimeType) || strMimeType.length() == 0) return ALL;
String[] arr = ListUtil.listToStringArray(strMimeType, ';');
if (arr.length == 0) return ALL;
String[] arrCT = ListUtil.listToStringArray(arr[0].trim(), '/');
// subtype
String type = null, subtype = null;
// type
if (arrCT.length >= 1) {
type = arrCT[0].trim();
if ("*".equals(type)) type = null;
if (arrCT.length >= 2) {
subtype = arrCT[1].trim();
if ("*".equals(subtype)) subtype = null;
}
}
if (arr.length == 1) return getInstance(type, subtype, null);
final Map<String, String> properties = new HashMap<String, String>();
String entry;
String[] _arr;
for (int i = 1; i < arr.length; i++) {
entry = arr[i].trim();
_arr = ListUtil.listToStringArray(entry, '=');
if (_arr.length >= 2) properties.put(_arr[0].trim().toLowerCase(), _arr[1].trim());
else if (_arr.length == 1 && !_arr[0].trim().toLowerCase().equals("*")) properties.put(_arr[0].trim().toLowerCase(), "");
}
return getInstance(type, subtype, properties);
} | java | public static MimeType getInstance(String strMimeType) {
if (strMimeType == null) return ALL;
strMimeType = strMimeType.trim();
if ("*".equals(strMimeType) || strMimeType.length() == 0) return ALL;
String[] arr = ListUtil.listToStringArray(strMimeType, ';');
if (arr.length == 0) return ALL;
String[] arrCT = ListUtil.listToStringArray(arr[0].trim(), '/');
// subtype
String type = null, subtype = null;
// type
if (arrCT.length >= 1) {
type = arrCT[0].trim();
if ("*".equals(type)) type = null;
if (arrCT.length >= 2) {
subtype = arrCT[1].trim();
if ("*".equals(subtype)) subtype = null;
}
}
if (arr.length == 1) return getInstance(type, subtype, null);
final Map<String, String> properties = new HashMap<String, String>();
String entry;
String[] _arr;
for (int i = 1; i < arr.length; i++) {
entry = arr[i].trim();
_arr = ListUtil.listToStringArray(entry, '=');
if (_arr.length >= 2) properties.put(_arr[0].trim().toLowerCase(), _arr[1].trim());
else if (_arr.length == 1 && !_arr[0].trim().toLowerCase().equals("*")) properties.put(_arr[0].trim().toLowerCase(), "");
}
return getInstance(type, subtype, properties);
} | [
"public",
"static",
"MimeType",
"getInstance",
"(",
"String",
"strMimeType",
")",
"{",
"if",
"(",
"strMimeType",
"==",
"null",
")",
"return",
"ALL",
";",
"strMimeType",
"=",
"strMimeType",
".",
"trim",
"(",
")",
";",
"if",
"(",
"\"*\"",
".",
"equals",
"(... | returns a mimetype that match given string
@param strMimeType
@return | [
"returns",
"a",
"mimetype",
"that",
"match",
"given",
"string"
] | 29b153fc4e126e5edb97da937f2ee2e231b87593 | https://github.com/lucee/Lucee/blob/29b153fc4e126e5edb97da937f2ee2e231b87593/core/src/main/java/lucee/commons/lang/mimetype/MimeType.java#L187-L223 |
30,623 | lucee/Lucee | core/src/main/java/lucee/commons/lang/mimetype/MimeType.java | MimeType.match | public boolean match(MimeType other) {
if (this == other) return true;
if (type != null && other.type != null && !type.equals(other.type)) return false;
if (subtype != null && other.subtype != null && !subtype.equals(other.subtype)) return false;
return true;
} | java | public boolean match(MimeType other) {
if (this == other) return true;
if (type != null && other.type != null && !type.equals(other.type)) return false;
if (subtype != null && other.subtype != null && !subtype.equals(other.subtype)) return false;
return true;
} | [
"public",
"boolean",
"match",
"(",
"MimeType",
"other",
")",
"{",
"if",
"(",
"this",
"==",
"other",
")",
"return",
"true",
";",
"if",
"(",
"type",
"!=",
"null",
"&&",
"other",
".",
"type",
"!=",
"null",
"&&",
"!",
"type",
".",
"equals",
"(",
"other... | checks if given mimetype is covered by current mimetype
@param other
@return | [
"checks",
"if",
"given",
"mimetype",
"is",
"covered",
"by",
"current",
"mimetype"
] | 29b153fc4e126e5edb97da937f2ee2e231b87593 | https://github.com/lucee/Lucee/blob/29b153fc4e126e5edb97da937f2ee2e231b87593/core/src/main/java/lucee/commons/lang/mimetype/MimeType.java#L318-L323 |
30,624 | lucee/Lucee | core/src/main/java/lucee/runtime/db/HSQLUtil.java | HSQLUtil.getInvokedTables | public Set<String> getInvokedTables() throws ParseException {
// Read all SQL statements from input
ZStatement st;
Set<String> tables = new HashSet<String>();
while ((st = parser.readStatement()) != null) {
this.sql = st.toString();
if (st instanceof ZQuery) { // An SQL query: query the DB
getInvokedTables((ZQuery) st, tables);
}
break;
}
return tables;
} | java | public Set<String> getInvokedTables() throws ParseException {
// Read all SQL statements from input
ZStatement st;
Set<String> tables = new HashSet<String>();
while ((st = parser.readStatement()) != null) {
this.sql = st.toString();
if (st instanceof ZQuery) { // An SQL query: query the DB
getInvokedTables((ZQuery) st, tables);
}
break;
}
return tables;
} | [
"public",
"Set",
"<",
"String",
">",
"getInvokedTables",
"(",
")",
"throws",
"ParseException",
"{",
"// Read all SQL statements from input",
"ZStatement",
"st",
";",
"Set",
"<",
"String",
">",
"tables",
"=",
"new",
"HashSet",
"<",
"String",
">",
"(",
")",
";",... | return all invoked tables by a sql statement
@return invoked tables in a ArrayList
@throws ParseException | [
"return",
"all",
"invoked",
"tables",
"by",
"a",
"sql",
"statement"
] | 29b153fc4e126e5edb97da937f2ee2e231b87593 | https://github.com/lucee/Lucee/blob/29b153fc4e126e5edb97da937f2ee2e231b87593/core/src/main/java/lucee/runtime/db/HSQLUtil.java#L101-L115 |
30,625 | lucee/Lucee | core/src/main/java/lucee/commons/io/res/util/ResourceUtil.java | ResourceUtil.toExactResource | public static Resource toExactResource(Resource res) {
res = getCanonicalResourceEL(res);
if (res.getResourceProvider().isCaseSensitive()) {
if (res.exists()) return res;
return _check(res);
}
return res;
} | java | public static Resource toExactResource(Resource res) {
res = getCanonicalResourceEL(res);
if (res.getResourceProvider().isCaseSensitive()) {
if (res.exists()) return res;
return _check(res);
}
return res;
} | [
"public",
"static",
"Resource",
"toExactResource",
"(",
"Resource",
"res",
")",
"{",
"res",
"=",
"getCanonicalResourceEL",
"(",
"res",
")",
";",
"if",
"(",
"res",
".",
"getResourceProvider",
"(",
")",
".",
"isCaseSensitive",
"(",
")",
")",
"{",
"if",
"(",
... | translate the path of the file to a existing file path by changing case of letters Works only on
Linux, because
Example Unix: we have a existing file with path "/usr/virtual/myFile.txt" now you call this
method with path "/Usr/Virtual/myfile.txt" the result of the method will be
"/usr/virtual/myFile.txt"
if there are more file with rhe same name but different cases Example: /usr/virtual/myFile.txt
/usr/virtual/myfile.txt /Usr/Virtual/myFile.txt the nearest case wil returned
@param res
@return file | [
"translate",
"the",
"path",
"of",
"the",
"file",
"to",
"a",
"existing",
"file",
"path",
"by",
"changing",
"case",
"of",
"letters",
"Works",
"only",
"on",
"Linux",
"because"
] | 29b153fc4e126e5edb97da937f2ee2e231b87593 | https://github.com/lucee/Lucee/blob/29b153fc4e126e5edb97da937f2ee2e231b87593/core/src/main/java/lucee/commons/io/res/util/ResourceUtil.java#L382-L390 |
30,626 | lucee/Lucee | core/src/main/java/lucee/commons/io/res/util/ResourceUtil.java | ResourceUtil.createResource | public static Resource createResource(Resource res, short level, short type) {
boolean asDir = type == TYPE_DIR;
// File
if (level >= LEVEL_FILE && res.exists() && ((res.isDirectory() && asDir) || (res.isFile() && !asDir))) {
return getCanonicalResourceEL(res);
}
// Parent
Resource parent = res.getParentResource();
if (level >= LEVEL_PARENT_FILE && parent != null && parent.exists() && canRW(parent)) {
if (asDir) {
if (res.mkdirs()) return getCanonicalResourceEL(res);
}
else {
if (createNewResourceEL(res)) return getCanonicalResourceEL(res);
}
return getCanonicalResourceEL(res);
}
// Grand Parent
if (level >= LEVEL_GRAND_PARENT_FILE && parent != null) {
Resource gparent = parent.getParentResource();
if (gparent != null && gparent.exists() && canRW(gparent)) {
if (asDir) {
if (res.mkdirs()) return getCanonicalResourceEL(res);
}
else {
if (parent.mkdirs() && createNewResourceEL(res)) return getCanonicalResourceEL(res);
}
}
}
return null;
} | java | public static Resource createResource(Resource res, short level, short type) {
boolean asDir = type == TYPE_DIR;
// File
if (level >= LEVEL_FILE && res.exists() && ((res.isDirectory() && asDir) || (res.isFile() && !asDir))) {
return getCanonicalResourceEL(res);
}
// Parent
Resource parent = res.getParentResource();
if (level >= LEVEL_PARENT_FILE && parent != null && parent.exists() && canRW(parent)) {
if (asDir) {
if (res.mkdirs()) return getCanonicalResourceEL(res);
}
else {
if (createNewResourceEL(res)) return getCanonicalResourceEL(res);
}
return getCanonicalResourceEL(res);
}
// Grand Parent
if (level >= LEVEL_GRAND_PARENT_FILE && parent != null) {
Resource gparent = parent.getParentResource();
if (gparent != null && gparent.exists() && canRW(gparent)) {
if (asDir) {
if (res.mkdirs()) return getCanonicalResourceEL(res);
}
else {
if (parent.mkdirs() && createNewResourceEL(res)) return getCanonicalResourceEL(res);
}
}
}
return null;
} | [
"public",
"static",
"Resource",
"createResource",
"(",
"Resource",
"res",
",",
"short",
"level",
",",
"short",
"type",
")",
"{",
"boolean",
"asDir",
"=",
"type",
"==",
"TYPE_DIR",
";",
"// File",
"if",
"(",
"level",
">=",
"LEVEL_FILE",
"&&",
"res",
".",
... | create a file if possible, return file if ok, otherwise return null
@param res file to touch
@param level touch also parent and grand parent
@param type is file or directory
@return file if exists, otherwise null | [
"create",
"a",
"file",
"if",
"possible",
"return",
"file",
"if",
"ok",
"otherwise",
"return",
"null"
] | 29b153fc4e126e5edb97da937f2ee2e231b87593 | https://github.com/lucee/Lucee/blob/29b153fc4e126e5edb97da937f2ee2e231b87593/core/src/main/java/lucee/commons/io/res/util/ResourceUtil.java#L421-L454 |
30,627 | lucee/Lucee | core/src/main/java/lucee/commons/io/res/util/ResourceUtil.java | ResourceUtil.translateAttribute | public static String translateAttribute(String attributes) throws IOException {
short[] flags = strAttrToBooleanFlags(attributes);
StringBuilder sb = new StringBuilder();
if (flags[READ_ONLY] == YES) sb.append(" +R");
else if (flags[READ_ONLY] == NO) sb.append(" -R");
if (flags[HIDDEN] == YES) sb.append(" +H");
else if (flags[HIDDEN] == NO) sb.append(" -H");
if (flags[SYSTEM] == YES) sb.append(" +S");
else if (flags[SYSTEM] == NO) sb.append(" -S");
if (flags[ARCHIVE] == YES) sb.append(" +A");
else if (flags[ARCHIVE] == NO) sb.append(" -A");
return sb.toString();
} | java | public static String translateAttribute(String attributes) throws IOException {
short[] flags = strAttrToBooleanFlags(attributes);
StringBuilder sb = new StringBuilder();
if (flags[READ_ONLY] == YES) sb.append(" +R");
else if (flags[READ_ONLY] == NO) sb.append(" -R");
if (flags[HIDDEN] == YES) sb.append(" +H");
else if (flags[HIDDEN] == NO) sb.append(" -H");
if (flags[SYSTEM] == YES) sb.append(" +S");
else if (flags[SYSTEM] == NO) sb.append(" -S");
if (flags[ARCHIVE] == YES) sb.append(" +A");
else if (flags[ARCHIVE] == NO) sb.append(" -A");
return sb.toString();
} | [
"public",
"static",
"String",
"translateAttribute",
"(",
"String",
"attributes",
")",
"throws",
"IOException",
"{",
"short",
"[",
"]",
"flags",
"=",
"strAttrToBooleanFlags",
"(",
"attributes",
")",
";",
"StringBuilder",
"sb",
"=",
"new",
"StringBuilder",
"(",
")... | sets attributes of a file on Windows system
@param res
@param attributes
@throws PageException
@throws IOException | [
"sets",
"attributes",
"of",
"a",
"file",
"on",
"Windows",
"system"
] | 29b153fc4e126e5edb97da937f2ee2e231b87593 | https://github.com/lucee/Lucee/blob/29b153fc4e126e5edb97da937f2ee2e231b87593/core/src/main/java/lucee/commons/io/res/util/ResourceUtil.java#L540-L557 |
30,628 | lucee/Lucee | core/src/main/java/lucee/commons/io/res/util/ResourceUtil.java | ResourceUtil.merge | public static String merge(String parent, String child) {
if (child.length() <= 2) {
if (child.length() == 0) return parent;
if (child.equals(".")) return parent;
if (child.equals("..")) child = "../";
}
parent = translatePath(parent, true, false);
child = prettifyPath(child);// child.replace('\\', '/');
if (child.startsWith("./")) child = child.substring(2);
if (StringUtil.startsWith(child, '/')) return parent.concat(child);
if (!StringUtil.startsWith(child, '.')) return parent.concat("/").concat(child);
while (child.startsWith("../")) {
parent = pathRemoveLast(parent);
child = child.substring(3);
}
if (StringUtil.startsWith(child, '/')) return parent.concat(child);
return parent.concat("/").concat(child);
} | java | public static String merge(String parent, String child) {
if (child.length() <= 2) {
if (child.length() == 0) return parent;
if (child.equals(".")) return parent;
if (child.equals("..")) child = "../";
}
parent = translatePath(parent, true, false);
child = prettifyPath(child);// child.replace('\\', '/');
if (child.startsWith("./")) child = child.substring(2);
if (StringUtil.startsWith(child, '/')) return parent.concat(child);
if (!StringUtil.startsWith(child, '.')) return parent.concat("/").concat(child);
while (child.startsWith("../")) {
parent = pathRemoveLast(parent);
child = child.substring(3);
}
if (StringUtil.startsWith(child, '/')) return parent.concat(child);
return parent.concat("/").concat(child);
} | [
"public",
"static",
"String",
"merge",
"(",
"String",
"parent",
",",
"String",
"child",
")",
"{",
"if",
"(",
"child",
".",
"length",
"(",
")",
"<=",
"2",
")",
"{",
"if",
"(",
"child",
".",
"length",
"(",
")",
"==",
"0",
")",
"return",
"parent",
"... | merge to path parts to one
@param parent
@param child
@return | [
"merge",
"to",
"path",
"parts",
"to",
"one"
] | 29b153fc4e126e5edb97da937f2ee2e231b87593 | https://github.com/lucee/Lucee/blob/29b153fc4e126e5edb97da937f2ee2e231b87593/core/src/main/java/lucee/commons/io/res/util/ResourceUtil.java#L648-L668 |
30,629 | lucee/Lucee | core/src/main/java/lucee/commons/io/res/util/ResourceUtil.java | ResourceUtil.getCanonicalPathEL | public static String getCanonicalPathEL(Resource res) {
try {
return res.getCanonicalPath();
}
catch (IOException e) {
return res.toString();
}
} | java | public static String getCanonicalPathEL(Resource res) {
try {
return res.getCanonicalPath();
}
catch (IOException e) {
return res.toString();
}
} | [
"public",
"static",
"String",
"getCanonicalPathEL",
"(",
"Resource",
"res",
")",
"{",
"try",
"{",
"return",
"res",
".",
"getCanonicalPath",
"(",
")",
";",
"}",
"catch",
"(",
"IOException",
"e",
")",
"{",
"return",
"res",
".",
"toString",
"(",
")",
";",
... | Returns the canonical form of this abstract pathname.
@param res file to get canonical form from it
@return The canonical pathname string denoting the same file or directory as this abstract
pathname
@throws SecurityException If a required system property value cannot be accessed. | [
"Returns",
"the",
"canonical",
"form",
"of",
"this",
"abstract",
"pathname",
"."
] | 29b153fc4e126e5edb97da937f2ee2e231b87593 | https://github.com/lucee/Lucee/blob/29b153fc4e126e5edb97da937f2ee2e231b87593/core/src/main/java/lucee/commons/io/res/util/ResourceUtil.java#L689-L696 |
30,630 | lucee/Lucee | core/src/main/java/lucee/commons/io/res/util/ResourceUtil.java | ResourceUtil.createNewResourceEL | public static boolean createNewResourceEL(Resource res) {
try {
res.createFile(false);
return true;
}
catch (IOException e) {
return false;
}
} | java | public static boolean createNewResourceEL(Resource res) {
try {
res.createFile(false);
return true;
}
catch (IOException e) {
return false;
}
} | [
"public",
"static",
"boolean",
"createNewResourceEL",
"(",
"Resource",
"res",
")",
"{",
"try",
"{",
"res",
".",
"createFile",
"(",
"false",
")",
";",
"return",
"true",
";",
"}",
"catch",
"(",
"IOException",
"e",
")",
"{",
"return",
"false",
";",
"}",
"... | creates a new File
@param res
@return was successfull | [
"creates",
"a",
"new",
"File"
] | 29b153fc4e126e5edb97da937f2ee2e231b87593 | https://github.com/lucee/Lucee/blob/29b153fc4e126e5edb97da937f2ee2e231b87593/core/src/main/java/lucee/commons/io/res/util/ResourceUtil.java#L724-L732 |
30,631 | lucee/Lucee | core/src/main/java/lucee/commons/io/res/util/ResourceUtil.java | ResourceUtil.touch | public static void touch(Resource res) throws IOException {
if (res.exists()) {
res.setLastModified(System.currentTimeMillis());
}
else {
res.createFile(true);
}
} | java | public static void touch(Resource res) throws IOException {
if (res.exists()) {
res.setLastModified(System.currentTimeMillis());
}
else {
res.createFile(true);
}
} | [
"public",
"static",
"void",
"touch",
"(",
"Resource",
"res",
")",
"throws",
"IOException",
"{",
"if",
"(",
"res",
".",
"exists",
"(",
")",
")",
"{",
"res",
".",
"setLastModified",
"(",
"System",
".",
"currentTimeMillis",
"(",
")",
")",
";",
"}",
"else"... | similar to linux bash function touch, create file if not exist otherwise change last modified
date
@param res
@throws IOException | [
"similar",
"to",
"linux",
"bash",
"function",
"touch",
"create",
"file",
"if",
"not",
"exist",
"otherwise",
"change",
"last",
"modified",
"date"
] | 29b153fc4e126e5edb97da937f2ee2e231b87593 | https://github.com/lucee/Lucee/blob/29b153fc4e126e5edb97da937f2ee2e231b87593/core/src/main/java/lucee/commons/io/res/util/ResourceUtil.java#L755-L762 |
30,632 | lucee/Lucee | core/src/main/java/lucee/commons/io/res/util/ResourceUtil.java | ResourceUtil.isChildOf | public static boolean isChildOf(Resource file, Resource dir) {
while (file != null) {
if (file.equals(dir)) return true;
file = file.getParentResource();
}
return false;
} | java | public static boolean isChildOf(Resource file, Resource dir) {
while (file != null) {
if (file.equals(dir)) return true;
file = file.getParentResource();
}
return false;
} | [
"public",
"static",
"boolean",
"isChildOf",
"(",
"Resource",
"file",
",",
"Resource",
"dir",
")",
"{",
"while",
"(",
"file",
"!=",
"null",
")",
"{",
"if",
"(",
"file",
".",
"equals",
"(",
"dir",
")",
")",
"return",
"true",
";",
"file",
"=",
"file",
... | check if file is a child of given directory
@param file file to search
@param dir directory to search
@return is inside or not | [
"check",
"if",
"file",
"is",
"a",
"child",
"of",
"given",
"directory"
] | 29b153fc4e126e5edb97da937f2ee2e231b87593 | https://github.com/lucee/Lucee/blob/29b153fc4e126e5edb97da937f2ee2e231b87593/core/src/main/java/lucee/commons/io/res/util/ResourceUtil.java#L805-L811 |
30,633 | lucee/Lucee | core/src/main/java/lucee/commons/io/res/util/ResourceUtil.java | ResourceUtil.getPathToChild | public static String getPathToChild(Resource file, Resource dir) {
if (dir == null || !file.getResourceProvider().getScheme().equals(dir.getResourceProvider().getScheme())) return null;
boolean isFile = file.isFile();
String str = "/";
while (file != null) {
if (file.equals(dir)) {
if (isFile) return str.substring(0, str.length() - 1);
return str;
}
str = "/" + file.getName() + str;
file = file.getParentResource();
}
return null;
} | java | public static String getPathToChild(Resource file, Resource dir) {
if (dir == null || !file.getResourceProvider().getScheme().equals(dir.getResourceProvider().getScheme())) return null;
boolean isFile = file.isFile();
String str = "/";
while (file != null) {
if (file.equals(dir)) {
if (isFile) return str.substring(0, str.length() - 1);
return str;
}
str = "/" + file.getName() + str;
file = file.getParentResource();
}
return null;
} | [
"public",
"static",
"String",
"getPathToChild",
"(",
"Resource",
"file",
",",
"Resource",
"dir",
")",
"{",
"if",
"(",
"dir",
"==",
"null",
"||",
"!",
"file",
".",
"getResourceProvider",
"(",
")",
".",
"getScheme",
"(",
")",
".",
"equals",
"(",
"dir",
"... | return diffrents of one file to a other if first is child of second otherwise return null
@param file file to search
@param dir directory to search | [
"return",
"diffrents",
"of",
"one",
"file",
"to",
"a",
"other",
"if",
"first",
"is",
"child",
"of",
"second",
"otherwise",
"return",
"null"
] | 29b153fc4e126e5edb97da937f2ee2e231b87593 | https://github.com/lucee/Lucee/blob/29b153fc4e126e5edb97da937f2ee2e231b87593/core/src/main/java/lucee/commons/io/res/util/ResourceUtil.java#L819-L832 |
30,634 | lucee/Lucee | core/src/main/java/lucee/commons/io/res/util/ResourceUtil.java | ResourceUtil.splitFileName | public static String[] splitFileName(String fileName) {
int pos = fileName.lastIndexOf('.');
if (pos == -1) {
return new String[] { fileName };
}
return new String[] { fileName.substring(0, pos), fileName.substring(pos + 1) };
} | java | public static String[] splitFileName(String fileName) {
int pos = fileName.lastIndexOf('.');
if (pos == -1) {
return new String[] { fileName };
}
return new String[] { fileName.substring(0, pos), fileName.substring(pos + 1) };
} | [
"public",
"static",
"String",
"[",
"]",
"splitFileName",
"(",
"String",
"fileName",
")",
"{",
"int",
"pos",
"=",
"fileName",
".",
"lastIndexOf",
"(",
"'",
"'",
")",
";",
"if",
"(",
"pos",
"==",
"-",
"1",
")",
"{",
"return",
"new",
"String",
"[",
"]... | split a FileName in Parts
@param fileName
@return new String[]{name[,extension]} | [
"split",
"a",
"FileName",
"in",
"Parts"
] | 29b153fc4e126e5edb97da937f2ee2e231b87593 | https://github.com/lucee/Lucee/blob/29b153fc4e126e5edb97da937f2ee2e231b87593/core/src/main/java/lucee/commons/io/res/util/ResourceUtil.java#L868-L874 |
30,635 | lucee/Lucee | core/src/main/java/lucee/commons/io/res/util/ResourceUtil.java | ResourceUtil.changeExtension | public static Resource changeExtension(Resource file, String newExtension) {
String ext = getExtension(file, null);
if (ext == null) return file.getParentResource().getRealResource(file.getName() + '.' + newExtension);
// new File(file.getParentFile(),file.getName()+'.'+newExtension);
String name = file.getName();
return file.getParentResource().getRealResource(name.substring(0, name.length() - ext.length()) + newExtension);
// new File(file.getParentFile(),name.substring(0,name.length()-ext.length())+newExtension);
} | java | public static Resource changeExtension(Resource file, String newExtension) {
String ext = getExtension(file, null);
if (ext == null) return file.getParentResource().getRealResource(file.getName() + '.' + newExtension);
// new File(file.getParentFile(),file.getName()+'.'+newExtension);
String name = file.getName();
return file.getParentResource().getRealResource(name.substring(0, name.length() - ext.length()) + newExtension);
// new File(file.getParentFile(),name.substring(0,name.length()-ext.length())+newExtension);
} | [
"public",
"static",
"Resource",
"changeExtension",
"(",
"Resource",
"file",
",",
"String",
"newExtension",
")",
"{",
"String",
"ext",
"=",
"getExtension",
"(",
"file",
",",
"null",
")",
";",
"if",
"(",
"ext",
"==",
"null",
")",
"return",
"file",
".",
"ge... | change extension of file and return new file
@param file
@param newExtension
@return file with new Extension | [
"change",
"extension",
"of",
"file",
"and",
"return",
"new",
"file"
] | 29b153fc4e126e5edb97da937f2ee2e231b87593 | https://github.com/lucee/Lucee/blob/29b153fc4e126e5edb97da937f2ee2e231b87593/core/src/main/java/lucee/commons/io/res/util/ResourceUtil.java#L883-L890 |
30,636 | lucee/Lucee | core/src/main/java/lucee/commons/io/res/util/ResourceUtil.java | ResourceUtil.parentExists | private static boolean parentExists(Resource res) {
res = res.getParentResource();
return res != null && res.exists();
} | java | private static boolean parentExists(Resource res) {
res = res.getParentResource();
return res != null && res.exists();
} | [
"private",
"static",
"boolean",
"parentExists",
"(",
"Resource",
"res",
")",
"{",
"res",
"=",
"res",
".",
"getParentResource",
"(",
")",
";",
"return",
"res",
"!=",
"null",
"&&",
"res",
".",
"exists",
"(",
")",
";",
"}"
] | return if parent file exists
@param res file to check
@return parent exists? | [
"return",
"if",
"parent",
"file",
"exists"
] | 29b153fc4e126e5edb97da937f2ee2e231b87593 | https://github.com/lucee/Lucee/blob/29b153fc4e126e5edb97da937f2ee2e231b87593/core/src/main/java/lucee/commons/io/res/util/ResourceUtil.java#L968-L971 |
30,637 | lucee/Lucee | core/src/main/java/lucee/commons/io/res/util/ResourceUtil.java | ResourceUtil.getRealSize | public static long getRealSize(Resource res, ResourceFilter filter) {
if (res.isFile()) {
return res.length();
}
else if (res.isDirectory()) {
long size = 0;
Resource[] children = filter == null ? res.listResources() : res.listResources(filter);
for (int i = 0; i < children.length; i++) {
size += getRealSize(children[i]);
}
return size;
}
return 0;
} | java | public static long getRealSize(Resource res, ResourceFilter filter) {
if (res.isFile()) {
return res.length();
}
else if (res.isDirectory()) {
long size = 0;
Resource[] children = filter == null ? res.listResources() : res.listResources(filter);
for (int i = 0; i < children.length; i++) {
size += getRealSize(children[i]);
}
return size;
}
return 0;
} | [
"public",
"static",
"long",
"getRealSize",
"(",
"Resource",
"res",
",",
"ResourceFilter",
"filter",
")",
"{",
"if",
"(",
"res",
".",
"isFile",
"(",
")",
")",
"{",
"return",
"res",
".",
"length",
"(",
")",
";",
"}",
"else",
"if",
"(",
"res",
".",
"i... | return the size of the Resource, other than method length of Resource this method return the size
of all files in a directory
@param collectionDir
@return | [
"return",
"the",
"size",
"of",
"the",
"Resource",
"other",
"than",
"method",
"length",
"of",
"Resource",
"this",
"method",
"return",
"the",
"size",
"of",
"all",
"files",
"in",
"a",
"directory"
] | 29b153fc4e126e5edb97da937f2ee2e231b87593 | https://github.com/lucee/Lucee/blob/29b153fc4e126e5edb97da937f2ee2e231b87593/core/src/main/java/lucee/commons/io/res/util/ResourceUtil.java#L1136-L1150 |
30,638 | lucee/Lucee | core/src/main/java/lucee/commons/io/res/util/ResourceUtil.java | ResourceUtil.isEmptyDirectory | public static boolean isEmptyDirectory(Resource res, ResourceFilter filter) {
if (res.isDirectory()) {
Resource[] children = filter == null ? res.listResources() : res.listResources(filter);
if (children == null || children.length == 0) return true;
for (int i = 0; i < children.length; i++) {
if (children[i].isFile()) return false;
if (children[i].isDirectory() && !isEmptyDirectory(children[i], filter)) return false;
}
}
return true;
} | java | public static boolean isEmptyDirectory(Resource res, ResourceFilter filter) {
if (res.isDirectory()) {
Resource[] children = filter == null ? res.listResources() : res.listResources(filter);
if (children == null || children.length == 0) return true;
for (int i = 0; i < children.length; i++) {
if (children[i].isFile()) return false;
if (children[i].isDirectory() && !isEmptyDirectory(children[i], filter)) return false;
}
}
return true;
} | [
"public",
"static",
"boolean",
"isEmptyDirectory",
"(",
"Resource",
"res",
",",
"ResourceFilter",
"filter",
")",
"{",
"if",
"(",
"res",
".",
"isDirectory",
"(",
")",
")",
"{",
"Resource",
"[",
"]",
"children",
"=",
"filter",
"==",
"null",
"?",
"res",
"."... | return Boolean.True when directory is empty, Boolean.FALSE when directory s not empty and null if
directory does not exists
@param res
@return | [
"return",
"Boolean",
".",
"True",
"when",
"directory",
"is",
"empty",
"Boolean",
".",
"FALSE",
"when",
"directory",
"s",
"not",
"empty",
"and",
"null",
"if",
"directory",
"does",
"not",
"exists"
] | 29b153fc4e126e5edb97da937f2ee2e231b87593 | https://github.com/lucee/Lucee/blob/29b153fc4e126e5edb97da937f2ee2e231b87593/core/src/main/java/lucee/commons/io/res/util/ResourceUtil.java#L1190-L1202 |
30,639 | lucee/Lucee | core/src/main/java/lucee/commons/io/res/util/ResourceUtil.java | ResourceUtil.listResources | public static Resource[] listResources(Resource[] resources, ResourceFilter filter) {
int count = 0;
Resource[] children;
ArrayList<Resource[]> list = new ArrayList<Resource[]>();
for (int i = 0; i < resources.length; i++) {
children = filter == null ? resources[i].listResources() : resources[i].listResources(filter);
if (children != null) {
count += children.length;
list.add(children);
}
else list.add(new Resource[0]);
}
Resource[] rtn = new Resource[count];
int index = 0;
for (int i = 0; i < resources.length; i++) {
children = list.get(i);
for (int y = 0; y < children.length; y++) {
rtn[index++] = children[y];
}
}
// print.out(rtn);
return rtn;
} | java | public static Resource[] listResources(Resource[] resources, ResourceFilter filter) {
int count = 0;
Resource[] children;
ArrayList<Resource[]> list = new ArrayList<Resource[]>();
for (int i = 0; i < resources.length; i++) {
children = filter == null ? resources[i].listResources() : resources[i].listResources(filter);
if (children != null) {
count += children.length;
list.add(children);
}
else list.add(new Resource[0]);
}
Resource[] rtn = new Resource[count];
int index = 0;
for (int i = 0; i < resources.length; i++) {
children = list.get(i);
for (int y = 0; y < children.length; y++) {
rtn[index++] = children[y];
}
}
// print.out(rtn);
return rtn;
} | [
"public",
"static",
"Resource",
"[",
"]",
"listResources",
"(",
"Resource",
"[",
"]",
"resources",
",",
"ResourceFilter",
"filter",
")",
"{",
"int",
"count",
"=",
"0",
";",
"Resource",
"[",
"]",
"children",
";",
"ArrayList",
"<",
"Resource",
"[",
"]",
">... | list children of all given resources
@param resources
@return | [
"list",
"children",
"of",
"all",
"given",
"resources"
] | 29b153fc4e126e5edb97da937f2ee2e231b87593 | https://github.com/lucee/Lucee/blob/29b153fc4e126e5edb97da937f2ee2e231b87593/core/src/main/java/lucee/commons/io/res/util/ResourceUtil.java#L1221-L1243 |
30,640 | lucee/Lucee | core/src/main/java/lucee/commons/io/res/util/ResourceUtil.java | ResourceUtil.checkCreateDirectoryOK | public static void checkCreateDirectoryOK(Resource resource, boolean createParentWhenNotExists) throws IOException {
if (resource.exists()) {
if (resource.isFile()) throw new IOException("can't create directory [" + resource.getPath() + "], resource already exists as a file");
if (resource.isDirectory()) throw new IOException("can't create directory [" + resource.getPath() + "], directory already exists");
}
Resource parent = resource.getParentResource();
// when there is a parent but the parent does not exist
if (parent != null) {
if (!parent.exists()) {
if (createParentWhenNotExists) parent.createDirectory(true);
else throw new IOException("can't create file [" + resource.getPath() + "], missing parent directory");
}
else if (parent.isFile()) {
throw new IOException("can't create directory [" + resource.getPath() + "], parent is a file");
}
}
} | java | public static void checkCreateDirectoryOK(Resource resource, boolean createParentWhenNotExists) throws IOException {
if (resource.exists()) {
if (resource.isFile()) throw new IOException("can't create directory [" + resource.getPath() + "], resource already exists as a file");
if (resource.isDirectory()) throw new IOException("can't create directory [" + resource.getPath() + "], directory already exists");
}
Resource parent = resource.getParentResource();
// when there is a parent but the parent does not exist
if (parent != null) {
if (!parent.exists()) {
if (createParentWhenNotExists) parent.createDirectory(true);
else throw new IOException("can't create file [" + resource.getPath() + "], missing parent directory");
}
else if (parent.isFile()) {
throw new IOException("can't create directory [" + resource.getPath() + "], parent is a file");
}
}
} | [
"public",
"static",
"void",
"checkCreateDirectoryOK",
"(",
"Resource",
"resource",
",",
"boolean",
"createParentWhenNotExists",
")",
"throws",
"IOException",
"{",
"if",
"(",
"resource",
".",
"exists",
"(",
")",
")",
"{",
"if",
"(",
"resource",
".",
"isFile",
"... | check if directory creation is ok with the rules for the Resource interface, to not change this
rules.
@param resource
@param createParentWhenNotExists
@throws IOException | [
"check",
"if",
"directory",
"creation",
"is",
"ok",
"with",
"the",
"rules",
"for",
"the",
"Resource",
"interface",
"to",
"not",
"change",
"this",
"rules",
"."
] | 29b153fc4e126e5edb97da937f2ee2e231b87593 | https://github.com/lucee/Lucee/blob/29b153fc4e126e5edb97da937f2ee2e231b87593/core/src/main/java/lucee/commons/io/res/util/ResourceUtil.java#L1269-L1286 |
30,641 | lucee/Lucee | core/src/main/java/lucee/commons/io/res/util/ResourceUtil.java | ResourceUtil.checkCopyToOK | public static void checkCopyToOK(Resource source, Resource target) throws IOException {
if (!source.isFile()) {
if (source.isDirectory()) throw new IOException("can't copy [" + source.getPath() + "] to [" + target.getPath() + "], source is a directory");
throw new IOException("can't copy [" + source.getPath() + "] to [" + target.getPath() + "], source file does not exist");
}
else if (target.isDirectory()) {
throw new IOException("can't copy [" + source.getPath() + "] to [" + target.getPath() + "], target is a directory");
}
} | java | public static void checkCopyToOK(Resource source, Resource target) throws IOException {
if (!source.isFile()) {
if (source.isDirectory()) throw new IOException("can't copy [" + source.getPath() + "] to [" + target.getPath() + "], source is a directory");
throw new IOException("can't copy [" + source.getPath() + "] to [" + target.getPath() + "], source file does not exist");
}
else if (target.isDirectory()) {
throw new IOException("can't copy [" + source.getPath() + "] to [" + target.getPath() + "], target is a directory");
}
} | [
"public",
"static",
"void",
"checkCopyToOK",
"(",
"Resource",
"source",
",",
"Resource",
"target",
")",
"throws",
"IOException",
"{",
"if",
"(",
"!",
"source",
".",
"isFile",
"(",
")",
")",
"{",
"if",
"(",
"source",
".",
"isDirectory",
"(",
")",
")",
"... | check if copying a file is ok with the rules for the Resource interface, to not change this
rules.
@param source
@param target
@throws IOException | [
"check",
"if",
"copying",
"a",
"file",
"is",
"ok",
"with",
"the",
"rules",
"for",
"the",
"Resource",
"interface",
"to",
"not",
"change",
"this",
"rules",
"."
] | 29b153fc4e126e5edb97da937f2ee2e231b87593 | https://github.com/lucee/Lucee/blob/29b153fc4e126e5edb97da937f2ee2e231b87593/core/src/main/java/lucee/commons/io/res/util/ResourceUtil.java#L1322-L1330 |
30,642 | lucee/Lucee | core/src/main/java/lucee/commons/io/res/util/ResourceUtil.java | ResourceUtil.checkMoveToOK | public static void checkMoveToOK(Resource source, Resource target) throws IOException {
if (!source.exists()) {
throw new IOException("can't move [" + source.getPath() + "] to [" + target.getPath() + "], source file does not exist");
}
if (source.isDirectory() && target.isFile()) throw new IOException("can't move [" + source.getPath() + "] directory to [" + target.getPath() + "], target is a file");
if (source.isFile() && target.isDirectory()) throw new IOException("can't move [" + source.getPath() + "] file to [" + target.getPath() + "], target is a directory");
} | java | public static void checkMoveToOK(Resource source, Resource target) throws IOException {
if (!source.exists()) {
throw new IOException("can't move [" + source.getPath() + "] to [" + target.getPath() + "], source file does not exist");
}
if (source.isDirectory() && target.isFile()) throw new IOException("can't move [" + source.getPath() + "] directory to [" + target.getPath() + "], target is a file");
if (source.isFile() && target.isDirectory()) throw new IOException("can't move [" + source.getPath() + "] file to [" + target.getPath() + "], target is a directory");
} | [
"public",
"static",
"void",
"checkMoveToOK",
"(",
"Resource",
"source",
",",
"Resource",
"target",
")",
"throws",
"IOException",
"{",
"if",
"(",
"!",
"source",
".",
"exists",
"(",
")",
")",
"{",
"throw",
"new",
"IOException",
"(",
"\"can't move [\"",
"+",
... | check if moveing a file is ok with the rules for the Resource interface, to not change this
rules.
@param source
@param target
@throws IOException | [
"check",
"if",
"moveing",
"a",
"file",
"is",
"ok",
"with",
"the",
"rules",
"for",
"the",
"Resource",
"interface",
"to",
"not",
"change",
"this",
"rules",
"."
] | 29b153fc4e126e5edb97da937f2ee2e231b87593 | https://github.com/lucee/Lucee/blob/29b153fc4e126e5edb97da937f2ee2e231b87593/core/src/main/java/lucee/commons/io/res/util/ResourceUtil.java#L1340-L1346 |
30,643 | lucee/Lucee | core/src/main/java/lucee/commons/io/res/util/ResourceUtil.java | ResourceUtil.checkGetInputStreamOK | public static void checkGetInputStreamOK(Resource resource) throws IOException {
if (!resource.exists()) throw new IOException("file [" + resource.getPath() + "] does not exist");
if (resource.isDirectory()) throw new IOException("can't read directory [" + resource.getPath() + "] as a file");
} | java | public static void checkGetInputStreamOK(Resource resource) throws IOException {
if (!resource.exists()) throw new IOException("file [" + resource.getPath() + "] does not exist");
if (resource.isDirectory()) throw new IOException("can't read directory [" + resource.getPath() + "] as a file");
} | [
"public",
"static",
"void",
"checkGetInputStreamOK",
"(",
"Resource",
"resource",
")",
"throws",
"IOException",
"{",
"if",
"(",
"!",
"resource",
".",
"exists",
"(",
")",
")",
"throw",
"new",
"IOException",
"(",
"\"file [\"",
"+",
"resource",
".",
"getPath",
... | check if getting a inputstream of the file is ok with the rules for the Resource interface, to
not change this rules.
@param resource
@throws IOException | [
"check",
"if",
"getting",
"a",
"inputstream",
"of",
"the",
"file",
"is",
"ok",
"with",
"the",
"rules",
"for",
"the",
"Resource",
"interface",
"to",
"not",
"change",
"this",
"rules",
"."
] | 29b153fc4e126e5edb97da937f2ee2e231b87593 | https://github.com/lucee/Lucee/blob/29b153fc4e126e5edb97da937f2ee2e231b87593/core/src/main/java/lucee/commons/io/res/util/ResourceUtil.java#L1355-L1360 |
30,644 | lucee/Lucee | core/src/main/java/lucee/commons/io/res/util/ResourceUtil.java | ResourceUtil.checkGetOutputStreamOK | public static void checkGetOutputStreamOK(Resource resource) throws IOException {
if (resource.exists() && !resource.isWriteable()) {
throw new IOException("can't write to file [" + resource.getPath() + "],file is readonly");
}
if (resource.isDirectory()) throw new IOException("can't write directory [" + resource.getPath() + "] as a file");
if (!resource.getParentResource().exists())
throw new IOException("can't write file [" + resource.getPath() + "] as a file, missing parent directory [" + resource.getParent() + "]");
} | java | public static void checkGetOutputStreamOK(Resource resource) throws IOException {
if (resource.exists() && !resource.isWriteable()) {
throw new IOException("can't write to file [" + resource.getPath() + "],file is readonly");
}
if (resource.isDirectory()) throw new IOException("can't write directory [" + resource.getPath() + "] as a file");
if (!resource.getParentResource().exists())
throw new IOException("can't write file [" + resource.getPath() + "] as a file, missing parent directory [" + resource.getParent() + "]");
} | [
"public",
"static",
"void",
"checkGetOutputStreamOK",
"(",
"Resource",
"resource",
")",
"throws",
"IOException",
"{",
"if",
"(",
"resource",
".",
"exists",
"(",
")",
"&&",
"!",
"resource",
".",
"isWriteable",
"(",
")",
")",
"{",
"throw",
"new",
"IOException"... | check if getting a outputstream of the file is ok with the rules for the Resource interface, to
not change this rules.
@param resource
@throws IOException | [
"check",
"if",
"getting",
"a",
"outputstream",
"of",
"the",
"file",
"is",
"ok",
"with",
"the",
"rules",
"for",
"the",
"Resource",
"interface",
"to",
"not",
"change",
"this",
"rules",
"."
] | 29b153fc4e126e5edb97da937f2ee2e231b87593 | https://github.com/lucee/Lucee/blob/29b153fc4e126e5edb97da937f2ee2e231b87593/core/src/main/java/lucee/commons/io/res/util/ResourceUtil.java#L1369-L1376 |
30,645 | lucee/Lucee | core/src/main/java/lucee/commons/io/res/util/ResourceUtil.java | ResourceUtil.checkRemoveOK | public static void checkRemoveOK(Resource resource) throws IOException {
if (!resource.exists()) throw new IOException("can't delete resource " + resource + ", resource does not exist");
if (!resource.canWrite()) throw new IOException("can't delete resource " + resource + ", no access");
} | java | public static void checkRemoveOK(Resource resource) throws IOException {
if (!resource.exists()) throw new IOException("can't delete resource " + resource + ", resource does not exist");
if (!resource.canWrite()) throw new IOException("can't delete resource " + resource + ", no access");
} | [
"public",
"static",
"void",
"checkRemoveOK",
"(",
"Resource",
"resource",
")",
"throws",
"IOException",
"{",
"if",
"(",
"!",
"resource",
".",
"exists",
"(",
")",
")",
"throw",
"new",
"IOException",
"(",
"\"can't delete resource \"",
"+",
"resource",
"+",
"\", ... | check if removing the file is ok with the rules for the Resource interface, to not change this
rules.
@param resource
@throws IOException | [
"check",
"if",
"removing",
"the",
"file",
"is",
"ok",
"with",
"the",
"rules",
"for",
"the",
"Resource",
"interface",
"to",
"not",
"change",
"this",
"rules",
"."
] | 29b153fc4e126e5edb97da937f2ee2e231b87593 | https://github.com/lucee/Lucee/blob/29b153fc4e126e5edb97da937f2ee2e231b87593/core/src/main/java/lucee/commons/io/res/util/ResourceUtil.java#L1385-L1389 |
30,646 | lucee/Lucee | core/src/main/java/lucee/runtime/tag/Http.java | Http.setTimeout | public void setTimeout(Object timeout) throws PageException {
if (timeout instanceof TimeSpan) this.timeout = (TimeSpan) timeout;
// seconds
else {
int i = Caster.toIntValue(timeout);
if (i < 0) throw new ApplicationException("invalid value [" + i + "] for attribute timeout, value must be a positive integer greater or equal than 0");
this.timeout = new TimeSpanImpl(0, 0, 0, i);
}
} | java | public void setTimeout(Object timeout) throws PageException {
if (timeout instanceof TimeSpan) this.timeout = (TimeSpan) timeout;
// seconds
else {
int i = Caster.toIntValue(timeout);
if (i < 0) throw new ApplicationException("invalid value [" + i + "] for attribute timeout, value must be a positive integer greater or equal than 0");
this.timeout = new TimeSpanImpl(0, 0, 0, i);
}
} | [
"public",
"void",
"setTimeout",
"(",
"Object",
"timeout",
")",
"throws",
"PageException",
"{",
"if",
"(",
"timeout",
"instanceof",
"TimeSpan",
")",
"this",
".",
"timeout",
"=",
"(",
"TimeSpan",
")",
"timeout",
";",
"// seconds",
"else",
"{",
"int",
"i",
"=... | set the value timeout
@param timeout value to set
@throws ExpressionException | [
"set",
"the",
"value",
"timeout"
] | 29b153fc4e126e5edb97da937f2ee2e231b87593 | https://github.com/lucee/Lucee/blob/29b153fc4e126e5edb97da937f2ee2e231b87593/core/src/main/java/lucee/runtime/tag/Http.java#L439-L448 |
30,647 | lucee/Lucee | core/src/main/java/lucee/runtime/tag/Http.java | Http.setColumns | public void setColumns(String columns) throws PageException {
this.columns = ListUtil.toStringArray(ListUtil.listToArrayRemoveEmpty(columns, ","));
} | java | public void setColumns(String columns) throws PageException {
this.columns = ListUtil.toStringArray(ListUtil.listToArrayRemoveEmpty(columns, ","));
} | [
"public",
"void",
"setColumns",
"(",
"String",
"columns",
")",
"throws",
"PageException",
"{",
"this",
".",
"columns",
"=",
"ListUtil",
".",
"toStringArray",
"(",
"ListUtil",
".",
"listToArrayRemoveEmpty",
"(",
"columns",
",",
"\",\"",
")",
")",
";",
"}"
] | set the value columns
@param columns value to set
@throws PageException | [
"set",
"the",
"value",
"columns"
] | 29b153fc4e126e5edb97da937f2ee2e231b87593 | https://github.com/lucee/Lucee/blob/29b153fc4e126e5edb97da937f2ee2e231b87593/core/src/main/java/lucee/runtime/tag/Http.java#L505-L507 |
30,648 | lucee/Lucee | core/src/main/java/lucee/runtime/tag/Http.java | Http.setMethod | public void setMethod(String method) throws ApplicationException {
method = method.toLowerCase().trim();
if (method.equals("post")) this.method = METHOD_POST;
else if (method.equals("get")) this.method = METHOD_GET;
else if (method.equals("head")) this.method = METHOD_HEAD;
else if (method.equals("delete")) this.method = METHOD_DELETE;
else if (method.equals("put")) this.method = METHOD_PUT;
else if (method.equals("trace")) this.method = METHOD_TRACE;
else if (method.equals("options")) this.method = METHOD_OPTIONS;
else if (method.equals("patch")) this.method = METHOD_PATCH;
else throw new ApplicationException("invalid method type [" + (method.toUpperCase()) + "], valid types are POST,GET,HEAD,DELETE,PUT,TRACE,OPTIONS,PATCH");
} | java | public void setMethod(String method) throws ApplicationException {
method = method.toLowerCase().trim();
if (method.equals("post")) this.method = METHOD_POST;
else if (method.equals("get")) this.method = METHOD_GET;
else if (method.equals("head")) this.method = METHOD_HEAD;
else if (method.equals("delete")) this.method = METHOD_DELETE;
else if (method.equals("put")) this.method = METHOD_PUT;
else if (method.equals("trace")) this.method = METHOD_TRACE;
else if (method.equals("options")) this.method = METHOD_OPTIONS;
else if (method.equals("patch")) this.method = METHOD_PATCH;
else throw new ApplicationException("invalid method type [" + (method.toUpperCase()) + "], valid types are POST,GET,HEAD,DELETE,PUT,TRACE,OPTIONS,PATCH");
} | [
"public",
"void",
"setMethod",
"(",
"String",
"method",
")",
"throws",
"ApplicationException",
"{",
"method",
"=",
"method",
".",
"toLowerCase",
"(",
")",
".",
"trim",
"(",
")",
";",
"if",
"(",
"method",
".",
"equals",
"(",
"\"post\"",
")",
")",
"this",
... | set the value method GET or POST. Use GET to download a text or binary file or to create a query
from the contents of a text file. Use POST to send information to a server page or a CGI program
for processing. POST requires the use of a cfhttpparam tag.
@param method value to set
@throws ApplicationException | [
"set",
"the",
"value",
"method",
"GET",
"or",
"POST",
".",
"Use",
"GET",
"to",
"download",
"a",
"text",
"or",
"binary",
"file",
"or",
"to",
"create",
"a",
"query",
"from",
"the",
"contents",
"of",
"a",
"text",
"file",
".",
"Use",
"POST",
"to",
"send"... | 29b153fc4e126e5edb97da937f2ee2e231b87593 | https://github.com/lucee/Lucee/blob/29b153fc4e126e5edb97da937f2ee2e231b87593/core/src/main/java/lucee/runtime/tag/Http.java#L625-L636 |
30,649 | lucee/Lucee | core/src/main/java/lucee/runtime/tag/Http.java | Http.isRedirect | static boolean isRedirect(int status) {
return status == STATUS_REDIRECT_FOUND || status == STATUS_REDIRECT_MOVED_PERMANENTLY || status == STATUS_REDIRECT_SEE_OTHER
|| status == STATUS_REDIRECT_TEMPORARY_REDIRECT;
} | java | static boolean isRedirect(int status) {
return status == STATUS_REDIRECT_FOUND || status == STATUS_REDIRECT_MOVED_PERMANENTLY || status == STATUS_REDIRECT_SEE_OTHER
|| status == STATUS_REDIRECT_TEMPORARY_REDIRECT;
} | [
"static",
"boolean",
"isRedirect",
"(",
"int",
"status",
")",
"{",
"return",
"status",
"==",
"STATUS_REDIRECT_FOUND",
"||",
"status",
"==",
"STATUS_REDIRECT_MOVED_PERMANENTLY",
"||",
"status",
"==",
"STATUS_REDIRECT_SEE_OTHER",
"||",
"status",
"==",
"STATUS_REDIRECT_TEM... | checks if status code is a redirect
@param status
@return is redirect | [
"checks",
"if",
"status",
"code",
"is",
"a",
"redirect"
] | 29b153fc4e126e5edb97da937f2ee2e231b87593 | https://github.com/lucee/Lucee/blob/29b153fc4e126e5edb97da937f2ee2e231b87593/core/src/main/java/lucee/runtime/tag/Http.java#L1804-L1808 |
30,650 | lucee/Lucee | core/src/main/java/lucee/runtime/tag/Http.java | Http.mergePath | public static String mergePath(String current, String realPath) throws MalformedURLException {
// get current directory
String currDir;
if (current == null || current.indexOf('/') == -1) currDir = "/";
else if (current.endsWith("/")) currDir = current;
else currDir = current.substring(0, current.lastIndexOf('/') + 1);
// merge together
String path;
if (realPath.startsWith("./")) path = currDir + realPath.substring(2);
else if (realPath.startsWith("/")) path = realPath;
else if (!realPath.startsWith("../")) path = currDir + realPath;
else {
while (realPath.startsWith("../") || currDir.length() == 0) {
realPath = realPath.substring(3);
currDir = currDir.substring(0, currDir.length() - 1);
int index = currDir.lastIndexOf('/');
if (index == -1) throw new MalformedURLException("invalid realpath definition for URL");
currDir = currDir.substring(0, index + 1);
}
path = currDir + realPath;
}
return path;
} | java | public static String mergePath(String current, String realPath) throws MalformedURLException {
// get current directory
String currDir;
if (current == null || current.indexOf('/') == -1) currDir = "/";
else if (current.endsWith("/")) currDir = current;
else currDir = current.substring(0, current.lastIndexOf('/') + 1);
// merge together
String path;
if (realPath.startsWith("./")) path = currDir + realPath.substring(2);
else if (realPath.startsWith("/")) path = realPath;
else if (!realPath.startsWith("../")) path = currDir + realPath;
else {
while (realPath.startsWith("../") || currDir.length() == 0) {
realPath = realPath.substring(3);
currDir = currDir.substring(0, currDir.length() - 1);
int index = currDir.lastIndexOf('/');
if (index == -1) throw new MalformedURLException("invalid realpath definition for URL");
currDir = currDir.substring(0, index + 1);
}
path = currDir + realPath;
}
return path;
} | [
"public",
"static",
"String",
"mergePath",
"(",
"String",
"current",
",",
"String",
"realPath",
")",
"throws",
"MalformedURLException",
"{",
"// get current directory",
"String",
"currDir",
";",
"if",
"(",
"current",
"==",
"null",
"||",
"current",
".",
"indexOf",
... | merge to pathes to one
@param current
@param realPath
@return
@throws MalformedURLException | [
"merge",
"to",
"pathes",
"to",
"one"
] | 29b153fc4e126e5edb97da937f2ee2e231b87593 | https://github.com/lucee/Lucee/blob/29b153fc4e126e5edb97da937f2ee2e231b87593/core/src/main/java/lucee/runtime/tag/Http.java#L1818-L1843 |
30,651 | lucee/Lucee | core/src/main/java/lucee/runtime/exp/PageExceptionImpl.java | PageExceptionImpl.setAdditional | public void setAdditional(Collection.Key key, Object value) {
additional.setEL(key, StringUtil.toStringEmptyIfNull(value));
} | java | public void setAdditional(Collection.Key key, Object value) {
additional.setEL(key, StringUtil.toStringEmptyIfNull(value));
} | [
"public",
"void",
"setAdditional",
"(",
"Collection",
".",
"Key",
"key",
",",
"Object",
"value",
")",
"{",
"additional",
".",
"setEL",
"(",
"key",
",",
"StringUtil",
".",
"toStringEmptyIfNull",
"(",
"value",
")",
")",
";",
"}"
] | set a additional key value
@param key
@param value | [
"set",
"a",
"additional",
"key",
"value"
] | 29b153fc4e126e5edb97da937f2ee2e231b87593 | https://github.com/lucee/Lucee/blob/29b153fc4e126e5edb97da937f2ee2e231b87593/core/src/main/java/lucee/runtime/exp/PageExceptionImpl.java#L616-L618 |
30,652 | lucee/Lucee | core/src/main/java/lucee/runtime/crypt/BinConverter.java | BinConverter.byteArrayToLong | public static long byteArrayToLong(byte[] buffer, int nStartIndex) {
return (((long) buffer[nStartIndex]) << 56) | ((buffer[nStartIndex + 1] & 0x0ffL) << 48) | ((buffer[nStartIndex + 2] & 0x0ffL) << 40)
| ((buffer[nStartIndex + 3] & 0x0ffL) << 32) | ((buffer[nStartIndex + 4] & 0x0ffL) << 24) | ((buffer[nStartIndex + 5] & 0x0ffL) << 16)
| ((buffer[nStartIndex + 6] & 0x0ffL) << 8) | ((long) buffer[nStartIndex + 7] & 0x0ff);
} | java | public static long byteArrayToLong(byte[] buffer, int nStartIndex) {
return (((long) buffer[nStartIndex]) << 56) | ((buffer[nStartIndex + 1] & 0x0ffL) << 48) | ((buffer[nStartIndex + 2] & 0x0ffL) << 40)
| ((buffer[nStartIndex + 3] & 0x0ffL) << 32) | ((buffer[nStartIndex + 4] & 0x0ffL) << 24) | ((buffer[nStartIndex + 5] & 0x0ffL) << 16)
| ((buffer[nStartIndex + 6] & 0x0ffL) << 8) | ((long) buffer[nStartIndex + 7] & 0x0ff);
} | [
"public",
"static",
"long",
"byteArrayToLong",
"(",
"byte",
"[",
"]",
"buffer",
",",
"int",
"nStartIndex",
")",
"{",
"return",
"(",
"(",
"(",
"long",
")",
"buffer",
"[",
"nStartIndex",
"]",
")",
"<<",
"56",
")",
"|",
"(",
"(",
"buffer",
"[",
"nStartI... | gets bytes from an array into a long
@param buffer where to get the bytes
@param nStartIndex index from where to read the data
@return the 64bit integer | [
"gets",
"bytes",
"from",
"an",
"array",
"into",
"a",
"long"
] | 29b153fc4e126e5edb97da937f2ee2e231b87593 | https://github.com/lucee/Lucee/blob/29b153fc4e126e5edb97da937f2ee2e231b87593/core/src/main/java/lucee/runtime/crypt/BinConverter.java#L30-L36 |
30,653 | lucee/Lucee | core/src/main/java/lucee/runtime/crypt/BinConverter.java | BinConverter.longToByteArray | public static void longToByteArray(long lValue, byte[] buffer, int nStartIndex) {
buffer[nStartIndex] = (byte) (lValue >>> 56);
buffer[nStartIndex + 1] = (byte) ((lValue >>> 48) & 0x0ff);
buffer[nStartIndex + 2] = (byte) ((lValue >>> 40) & 0x0ff);
buffer[nStartIndex + 3] = (byte) ((lValue >>> 32) & 0x0ff);
buffer[nStartIndex + 4] = (byte) ((lValue >>> 24) & 0x0ff);
buffer[nStartIndex + 5] = (byte) ((lValue >>> 16) & 0x0ff);
buffer[nStartIndex + 6] = (byte) ((lValue >>> 8) & 0x0ff);
buffer[nStartIndex + 7] = (byte) lValue;
} | java | public static void longToByteArray(long lValue, byte[] buffer, int nStartIndex) {
buffer[nStartIndex] = (byte) (lValue >>> 56);
buffer[nStartIndex + 1] = (byte) ((lValue >>> 48) & 0x0ff);
buffer[nStartIndex + 2] = (byte) ((lValue >>> 40) & 0x0ff);
buffer[nStartIndex + 3] = (byte) ((lValue >>> 32) & 0x0ff);
buffer[nStartIndex + 4] = (byte) ((lValue >>> 24) & 0x0ff);
buffer[nStartIndex + 5] = (byte) ((lValue >>> 16) & 0x0ff);
buffer[nStartIndex + 6] = (byte) ((lValue >>> 8) & 0x0ff);
buffer[nStartIndex + 7] = (byte) lValue;
} | [
"public",
"static",
"void",
"longToByteArray",
"(",
"long",
"lValue",
",",
"byte",
"[",
"]",
"buffer",
",",
"int",
"nStartIndex",
")",
"{",
"buffer",
"[",
"nStartIndex",
"]",
"=",
"(",
"byte",
")",
"(",
"lValue",
">>>",
"56",
")",
";",
"buffer",
"[",
... | converts a long o bytes which are put into a given array
@param lValue the 64bit integer to convert
@param buffer the target buffer
@param nStartIndex where to place the bytes in the buffer | [
"converts",
"a",
"long",
"o",
"bytes",
"which",
"are",
"put",
"into",
"a",
"given",
"array"
] | 29b153fc4e126e5edb97da937f2ee2e231b87593 | https://github.com/lucee/Lucee/blob/29b153fc4e126e5edb97da937f2ee2e231b87593/core/src/main/java/lucee/runtime/crypt/BinConverter.java#L45-L54 |
30,654 | lucee/Lucee | core/src/main/java/lucee/runtime/crypt/BinConverter.java | BinConverter.longToIntArray | public static void longToIntArray(long lValue, int[] buffer, int nStartIndex) {
buffer[nStartIndex] = (int) (lValue >>> 32);
buffer[nStartIndex + 1] = (int) lValue;
} | java | public static void longToIntArray(long lValue, int[] buffer, int nStartIndex) {
buffer[nStartIndex] = (int) (lValue >>> 32);
buffer[nStartIndex + 1] = (int) lValue;
} | [
"public",
"static",
"void",
"longToIntArray",
"(",
"long",
"lValue",
",",
"int",
"[",
"]",
"buffer",
",",
"int",
"nStartIndex",
")",
"{",
"buffer",
"[",
"nStartIndex",
"]",
"=",
"(",
"int",
")",
"(",
"lValue",
">>>",
"32",
")",
";",
"buffer",
"[",
"n... | converts a long to integers which are put into a given array
@param lValue the 64bit integer to convert
@param buffer the target buffer
@param nStartIndex where to place the bytes in the buffer | [
"converts",
"a",
"long",
"to",
"integers",
"which",
"are",
"put",
"into",
"a",
"given",
"array"
] | 29b153fc4e126e5edb97da937f2ee2e231b87593 | https://github.com/lucee/Lucee/blob/29b153fc4e126e5edb97da937f2ee2e231b87593/core/src/main/java/lucee/runtime/crypt/BinConverter.java#L74-L77 |
30,655 | lucee/Lucee | core/src/main/java/lucee/runtime/crypt/BinConverter.java | BinConverter.byteArrayToUNCString | public static String byteArrayToUNCString(byte[] data, int nStartPos, int nNumOfBytes) {
// we need two bytes for every character
nNumOfBytes &= ~1;
// enough bytes in the buffer?
int nAvailCapacity = data.length - nStartPos;
if (nAvailCapacity < nNumOfBytes) nNumOfBytes = nAvailCapacity;
StringBuilder sbuf = new StringBuilder();
sbuf.setLength(nNumOfBytes >> 1);
int nSBufPos = 0;
while (nNumOfBytes > 0) {
sbuf.setCharAt(nSBufPos++, (char) ((data[nStartPos] << 8) | (data[nStartPos + 1] & 0x0ff)));
nStartPos += 2;
nNumOfBytes -= 2;
}
return sbuf.toString();
} | java | public static String byteArrayToUNCString(byte[] data, int nStartPos, int nNumOfBytes) {
// we need two bytes for every character
nNumOfBytes &= ~1;
// enough bytes in the buffer?
int nAvailCapacity = data.length - nStartPos;
if (nAvailCapacity < nNumOfBytes) nNumOfBytes = nAvailCapacity;
StringBuilder sbuf = new StringBuilder();
sbuf.setLength(nNumOfBytes >> 1);
int nSBufPos = 0;
while (nNumOfBytes > 0) {
sbuf.setCharAt(nSBufPos++, (char) ((data[nStartPos] << 8) | (data[nStartPos + 1] & 0x0ff)));
nStartPos += 2;
nNumOfBytes -= 2;
}
return sbuf.toString();
} | [
"public",
"static",
"String",
"byteArrayToUNCString",
"(",
"byte",
"[",
"]",
"data",
",",
"int",
"nStartPos",
",",
"int",
"nNumOfBytes",
")",
"{",
"// we need two bytes for every character",
"nNumOfBytes",
"&=",
"~",
"1",
";",
"// enough bytes in the buffer?",
"int",
... | converts a byte array into an UNICODE string
@param data the byte array
@param nStartPos where to begin the conversion
@param nNumOfBytes number of bytes to handle
@return the string | [
"converts",
"a",
"byte",
"array",
"into",
"an",
"UNICODE",
"string"
] | 29b153fc4e126e5edb97da937f2ee2e231b87593 | https://github.com/lucee/Lucee/blob/29b153fc4e126e5edb97da937f2ee2e231b87593/core/src/main/java/lucee/runtime/crypt/BinConverter.java#L187-L202 |
30,656 | lucee/Lucee | core/src/main/java/lucee/transformer/library/function/FunctionLib.java | FunctionLib.duplicate | public FunctionLib duplicate(boolean deepCopy) {
FunctionLib fl = new FunctionLib();
fl.description = this.description;
fl.displayName = this.displayName;
fl.functions = duplicate(this.functions, deepCopy);
fl.shortName = this.shortName;
fl.uri = this.uri;
fl.version = this.version;
return fl;
} | java | public FunctionLib duplicate(boolean deepCopy) {
FunctionLib fl = new FunctionLib();
fl.description = this.description;
fl.displayName = this.displayName;
fl.functions = duplicate(this.functions, deepCopy);
fl.shortName = this.shortName;
fl.uri = this.uri;
fl.version = this.version;
return fl;
} | [
"public",
"FunctionLib",
"duplicate",
"(",
"boolean",
"deepCopy",
")",
"{",
"FunctionLib",
"fl",
"=",
"new",
"FunctionLib",
"(",
")",
";",
"fl",
".",
"description",
"=",
"this",
".",
"description",
";",
"fl",
".",
"displayName",
"=",
"this",
".",
"displayN... | duplicate this FunctionLib
@param deepCopy
@return | [
"duplicate",
"this",
"FunctionLib"
] | 29b153fc4e126e5edb97da937f2ee2e231b87593 | https://github.com/lucee/Lucee/blob/29b153fc4e126e5edb97da937f2ee2e231b87593/core/src/main/java/lucee/transformer/library/function/FunctionLib.java#L205-L216 |
30,657 | lucee/Lucee | core/src/main/java/lucee/transformer/library/function/FunctionLib.java | FunctionLib.duplicate | private HashMap duplicate(HashMap funcs, boolean deepCopy) {
if (deepCopy) throw new PageRuntimeException(new ExpressionException("deep copy not supported"));
Iterator it = funcs.entrySet().iterator();
Map.Entry entry;
HashMap cm = new HashMap();
while (it.hasNext()) {
entry = (Entry) it.next();
cm.put(entry.getKey(), deepCopy ? entry.getValue() : // TODO add support for deepcopy ((FunctionLibFunction)entry.getValue()).duplicate(deepCopy):
entry.getValue());
}
return cm;
} | java | private HashMap duplicate(HashMap funcs, boolean deepCopy) {
if (deepCopy) throw new PageRuntimeException(new ExpressionException("deep copy not supported"));
Iterator it = funcs.entrySet().iterator();
Map.Entry entry;
HashMap cm = new HashMap();
while (it.hasNext()) {
entry = (Entry) it.next();
cm.put(entry.getKey(), deepCopy ? entry.getValue() : // TODO add support for deepcopy ((FunctionLibFunction)entry.getValue()).duplicate(deepCopy):
entry.getValue());
}
return cm;
} | [
"private",
"HashMap",
"duplicate",
"(",
"HashMap",
"funcs",
",",
"boolean",
"deepCopy",
")",
"{",
"if",
"(",
"deepCopy",
")",
"throw",
"new",
"PageRuntimeException",
"(",
"new",
"ExpressionException",
"(",
"\"deep copy not supported\"",
")",
")",
";",
"Iterator",
... | duplcate a hashmap with FunctionLibFunction's
@param funcs
@param deepCopy
@return cloned map | [
"duplcate",
"a",
"hashmap",
"with",
"FunctionLibFunction",
"s"
] | 29b153fc4e126e5edb97da937f2ee2e231b87593 | https://github.com/lucee/Lucee/blob/29b153fc4e126e5edb97da937f2ee2e231b87593/core/src/main/java/lucee/transformer/library/function/FunctionLib.java#L239-L251 |
30,658 | lucee/Lucee | loader/src/main/java/lucee/loader/engine/CFMLEngineFactorySupport.java | CFMLEngineFactorySupport.toVersion | public static Version toVersion(String version, final Version defaultValue) {
// remove extension if there is any
final int rIndex = version.lastIndexOf(".lco");
if (rIndex != -1) version = version.substring(0, rIndex);
try {
return Version.parseVersion(version);
}
catch (final IllegalArgumentException iae) {
return defaultValue;
}
} | java | public static Version toVersion(String version, final Version defaultValue) {
// remove extension if there is any
final int rIndex = version.lastIndexOf(".lco");
if (rIndex != -1) version = version.substring(0, rIndex);
try {
return Version.parseVersion(version);
}
catch (final IllegalArgumentException iae) {
return defaultValue;
}
} | [
"public",
"static",
"Version",
"toVersion",
"(",
"String",
"version",
",",
"final",
"Version",
"defaultValue",
")",
"{",
"// remove extension if there is any",
"final",
"int",
"rIndex",
"=",
"version",
".",
"lastIndexOf",
"(",
"\".lco\"",
")",
";",
"if",
"(",
"r... | cast a lucee string version to a int version
@param version
@return int version | [
"cast",
"a",
"lucee",
"string",
"version",
"to",
"a",
"int",
"version"
] | 29b153fc4e126e5edb97da937f2ee2e231b87593 | https://github.com/lucee/Lucee/blob/29b153fc4e126e5edb97da937f2ee2e231b87593/loader/src/main/java/lucee/loader/engine/CFMLEngineFactorySupport.java#L106-L117 |
30,659 | lucee/Lucee | loader/src/main/java/lucee/loader/engine/CFMLEngineFactorySupport.java | CFMLEngineFactorySupport.getTempDirectory | public static File getTempDirectory() {
if (tempFile != null) return tempFile;
final String tmpStr = System.getProperty("java.io.tmpdir");
if (tmpStr != null) {
tempFile = new File(tmpStr);
if (tempFile.exists()) {
tempFile = getCanonicalFileEL(tempFile);
return tempFile;
}
}
try {
final File tmp = File.createTempFile("a", "a");
tempFile = tmp.getParentFile();
tempFile = getCanonicalFileEL(tempFile);
tmp.delete();
}
catch (final IOException ioe) {}
return tempFile;
} | java | public static File getTempDirectory() {
if (tempFile != null) return tempFile;
final String tmpStr = System.getProperty("java.io.tmpdir");
if (tmpStr != null) {
tempFile = new File(tmpStr);
if (tempFile.exists()) {
tempFile = getCanonicalFileEL(tempFile);
return tempFile;
}
}
try {
final File tmp = File.createTempFile("a", "a");
tempFile = tmp.getParentFile();
tempFile = getCanonicalFileEL(tempFile);
tmp.delete();
}
catch (final IOException ioe) {}
return tempFile;
} | [
"public",
"static",
"File",
"getTempDirectory",
"(",
")",
"{",
"if",
"(",
"tempFile",
"!=",
"null",
")",
"return",
"tempFile",
";",
"final",
"String",
"tmpStr",
"=",
"System",
".",
"getProperty",
"(",
"\"java.io.tmpdir\"",
")",
";",
"if",
"(",
"tmpStr",
"!... | returns the Temp Directory of the System
@return temp directory | [
"returns",
"the",
"Temp",
"Directory",
"of",
"the",
"System"
] | 29b153fc4e126e5edb97da937f2ee2e231b87593 | https://github.com/lucee/Lucee/blob/29b153fc4e126e5edb97da937f2ee2e231b87593/loader/src/main/java/lucee/loader/engine/CFMLEngineFactorySupport.java#L210-L230 |
30,660 | lucee/Lucee | core/src/main/java/lucee/commons/net/HTTPUtil.java | HTTPUtil.toURL | public static URL toURL(String strUrl, int port, boolean encodeIfNecessary) throws MalformedURLException {
URL url;
try {
url = new URL(strUrl);
}
catch (MalformedURLException mue) {
url = new URL("http://" + strUrl);
}
if (!encodeIfNecessary) return url;
return encodeURL(url, port);
} | java | public static URL toURL(String strUrl, int port, boolean encodeIfNecessary) throws MalformedURLException {
URL url;
try {
url = new URL(strUrl);
}
catch (MalformedURLException mue) {
url = new URL("http://" + strUrl);
}
if (!encodeIfNecessary) return url;
return encodeURL(url, port);
} | [
"public",
"static",
"URL",
"toURL",
"(",
"String",
"strUrl",
",",
"int",
"port",
",",
"boolean",
"encodeIfNecessary",
")",
"throws",
"MalformedURLException",
"{",
"URL",
"url",
";",
"try",
"{",
"url",
"=",
"new",
"URL",
"(",
"strUrl",
")",
";",
"}",
"cat... | cast a string to a url
@param strUrl string represent a url
@return url from string
@throws MalformedURLException | [
"cast",
"a",
"string",
"to",
"a",
"url"
] | 29b153fc4e126e5edb97da937f2ee2e231b87593 | https://github.com/lucee/Lucee/blob/29b153fc4e126e5edb97da937f2ee2e231b87593/core/src/main/java/lucee/commons/net/HTTPUtil.java#L117-L127 |
30,661 | lucee/Lucee | core/src/main/java/lucee/commons/net/HTTPUtil.java | HTTPUtil.encode | public static String encode(String realpath) {
int qIndex = realpath.indexOf('?');
if (qIndex == -1) return realpath;
String file = realpath.substring(0, qIndex);
String query = realpath.substring(qIndex + 1);
int sIndex = query.indexOf('#');
String anker = null;
if (sIndex != -1) {
// print.o(sIndex);
anker = query.substring(sIndex + 1);
query = query.substring(0, sIndex);
}
StringBuilder res = new StringBuilder(file);
// query
if (!StringUtil.isEmpty(query)) {
StringList list = ListUtil.toList(query, '&');
String str;
int index;
char del = '?';
while (list.hasNext()) {
res.append(del);
del = '&';
str = list.next();
index = str.indexOf('=');
if (index == -1) res.append(escapeQSValue(str));
else {
res.append(escapeQSValue(str.substring(0, index)));
res.append('=');
res.append(escapeQSValue(str.substring(index + 1)));
}
}
}
// anker
if (anker != null) {
res.append('#');
res.append(escapeQSValue(anker));
}
return res.toString();
} | java | public static String encode(String realpath) {
int qIndex = realpath.indexOf('?');
if (qIndex == -1) return realpath;
String file = realpath.substring(0, qIndex);
String query = realpath.substring(qIndex + 1);
int sIndex = query.indexOf('#');
String anker = null;
if (sIndex != -1) {
// print.o(sIndex);
anker = query.substring(sIndex + 1);
query = query.substring(0, sIndex);
}
StringBuilder res = new StringBuilder(file);
// query
if (!StringUtil.isEmpty(query)) {
StringList list = ListUtil.toList(query, '&');
String str;
int index;
char del = '?';
while (list.hasNext()) {
res.append(del);
del = '&';
str = list.next();
index = str.indexOf('=');
if (index == -1) res.append(escapeQSValue(str));
else {
res.append(escapeQSValue(str.substring(0, index)));
res.append('=');
res.append(escapeQSValue(str.substring(index + 1)));
}
}
}
// anker
if (anker != null) {
res.append('#');
res.append(escapeQSValue(anker));
}
return res.toString();
} | [
"public",
"static",
"String",
"encode",
"(",
"String",
"realpath",
")",
"{",
"int",
"qIndex",
"=",
"realpath",
".",
"indexOf",
"(",
"'",
"'",
")",
";",
"if",
"(",
"qIndex",
"==",
"-",
"1",
")",
"return",
"realpath",
";",
"String",
"file",
"=",
"realp... | merge them somehow | [
"merge",
"them",
"somehow"
] | 29b153fc4e126e5edb97da937f2ee2e231b87593 | https://github.com/lucee/Lucee/blob/29b153fc4e126e5edb97da937f2ee2e231b87593/core/src/main/java/lucee/commons/net/HTTPUtil.java#L466-L513 |
30,662 | lucee/Lucee | core/src/main/java/lucee/commons/net/HTTPUtil.java | HTTPUtil.length | public static long length(URL url) throws IOException {
HTTPResponse http = HTTPEngine.head(url, null, null, -1, true, null, Constants.NAME, null, null);
long len = http.getContentLength();
HTTPEngine.closeEL(http);
return len;
} | java | public static long length(URL url) throws IOException {
HTTPResponse http = HTTPEngine.head(url, null, null, -1, true, null, Constants.NAME, null, null);
long len = http.getContentLength();
HTTPEngine.closeEL(http);
return len;
} | [
"public",
"static",
"long",
"length",
"(",
"URL",
"url",
")",
"throws",
"IOException",
"{",
"HTTPResponse",
"http",
"=",
"HTTPEngine",
".",
"head",
"(",
"url",
",",
"null",
",",
"null",
",",
"-",
"1",
",",
"true",
",",
"null",
",",
"Constants",
".",
... | return the length of a file defined by a url.
@param dataUrl
@return
@throws IOException | [
"return",
"the",
"length",
"of",
"a",
"file",
"defined",
"by",
"a",
"url",
"."
] | 29b153fc4e126e5edb97da937f2ee2e231b87593 | https://github.com/lucee/Lucee/blob/29b153fc4e126e5edb97da937f2ee2e231b87593/core/src/main/java/lucee/commons/net/HTTPUtil.java#L528-L533 |
30,663 | lucee/Lucee | core/src/main/java/lucee/runtime/net/http/ReqRspUtil.java | ReqRspUtil.self | public static String self(HttpServletRequest req) {
StringBuffer sb = new StringBuffer(req.getServletPath());
String qs = req.getQueryString();
if (!StringUtil.isEmpty(qs)) sb.append('?').append(qs);
return sb.toString();
} | java | public static String self(HttpServletRequest req) {
StringBuffer sb = new StringBuffer(req.getServletPath());
String qs = req.getQueryString();
if (!StringUtil.isEmpty(qs)) sb.append('?').append(qs);
return sb.toString();
} | [
"public",
"static",
"String",
"self",
"(",
"HttpServletRequest",
"req",
")",
"{",
"StringBuffer",
"sb",
"=",
"new",
"StringBuffer",
"(",
"req",
".",
"getServletPath",
"(",
")",
")",
";",
"String",
"qs",
"=",
"req",
".",
"getQueryString",
"(",
")",
";",
"... | return path to itself
@param req | [
"return",
"path",
"to",
"itself"
] | 29b153fc4e126e5edb97da937f2ee2e231b87593 | https://github.com/lucee/Lucee/blob/29b153fc4e126e5edb97da937f2ee2e231b87593/core/src/main/java/lucee/runtime/net/http/ReqRspUtil.java#L103-L108 |
30,664 | lucee/Lucee | core/src/main/java/lucee/runtime/net/http/ReqRspUtil.java | ReqRspUtil.getRequestBody | public static Object getRequestBody(PageContext pc, boolean deserialized, Object defaultValue) {
HttpServletRequest req = pc.getHttpServletRequest();
MimeType contentType = getContentType(pc);
String strContentType = contentType == MimeType.ALL ? null : contentType.toString();
Charset cs = getCharacterEncoding(pc, req);
boolean isBinary = !(strContentType == null || HTTPUtil.isTextMimeType(contentType) || strContentType.toLowerCase().startsWith("application/x-www-form-urlencoded"));
if (req.getContentLength() > -1) {
ServletInputStream is = null;
try {
byte[] data = IOUtil.toBytes(is = req.getInputStream());// new byte[req.getContentLength()];
Object obj = NULL;
if (deserialized) {
int format = MimeType.toFormat(contentType, -1);
obj = toObject(pc, data, format, cs, obj);
}
if (obj == NULL) {
if (isBinary) obj = data;
else obj = toString(data, cs);
}
return obj;
}
catch (Exception e) {
pc.getConfig().getLog("application").error("request", e);
return defaultValue;
}
finally {
IOUtil.closeEL(is);
}
}
return defaultValue;
} | java | public static Object getRequestBody(PageContext pc, boolean deserialized, Object defaultValue) {
HttpServletRequest req = pc.getHttpServletRequest();
MimeType contentType = getContentType(pc);
String strContentType = contentType == MimeType.ALL ? null : contentType.toString();
Charset cs = getCharacterEncoding(pc, req);
boolean isBinary = !(strContentType == null || HTTPUtil.isTextMimeType(contentType) || strContentType.toLowerCase().startsWith("application/x-www-form-urlencoded"));
if (req.getContentLength() > -1) {
ServletInputStream is = null;
try {
byte[] data = IOUtil.toBytes(is = req.getInputStream());// new byte[req.getContentLength()];
Object obj = NULL;
if (deserialized) {
int format = MimeType.toFormat(contentType, -1);
obj = toObject(pc, data, format, cs, obj);
}
if (obj == NULL) {
if (isBinary) obj = data;
else obj = toString(data, cs);
}
return obj;
}
catch (Exception e) {
pc.getConfig().getLog("application").error("request", e);
return defaultValue;
}
finally {
IOUtil.closeEL(is);
}
}
return defaultValue;
} | [
"public",
"static",
"Object",
"getRequestBody",
"(",
"PageContext",
"pc",
",",
"boolean",
"deserialized",
",",
"Object",
"defaultValue",
")",
"{",
"HttpServletRequest",
"req",
"=",
"pc",
".",
"getHttpServletRequest",
"(",
")",
";",
"MimeType",
"contentType",
"=",
... | returns the body of the request
@param pc
@param deserialized if true lucee tries to deserialize the body based on the content-type, for
example when the content type is "application/json"
@param defaultValue value returned if there is no body
@return | [
"returns",
"the",
"body",
"of",
"the",
"request"
] | 29b153fc4e126e5edb97da937f2ee2e231b87593 | https://github.com/lucee/Lucee/blob/29b153fc4e126e5edb97da937f2ee2e231b87593/core/src/main/java/lucee/runtime/net/http/ReqRspUtil.java#L443-L480 |
30,665 | lucee/Lucee | core/src/main/java/lucee/runtime/net/http/ReqRspUtil.java | ReqRspUtil.getRequestURL | public static String getRequestURL(HttpServletRequest req, boolean includeQueryString) {
StringBuffer sb = req.getRequestURL();
int maxpos = sb.indexOf("/", 8);
if (maxpos > -1) {
if (req.isSecure()) {
if (sb.substring(maxpos - 4, maxpos).equals(":443")) sb.delete(maxpos - 4, maxpos);
}
else {
if (sb.substring(maxpos - 3, maxpos).equals(":80")) sb.delete(maxpos - 3, maxpos);
}
if (includeQueryString && !StringUtil.isEmpty(req.getQueryString())) sb.append('?').append(req.getQueryString());
}
return sb.toString();
} | java | public static String getRequestURL(HttpServletRequest req, boolean includeQueryString) {
StringBuffer sb = req.getRequestURL();
int maxpos = sb.indexOf("/", 8);
if (maxpos > -1) {
if (req.isSecure()) {
if (sb.substring(maxpos - 4, maxpos).equals(":443")) sb.delete(maxpos - 4, maxpos);
}
else {
if (sb.substring(maxpos - 3, maxpos).equals(":80")) sb.delete(maxpos - 3, maxpos);
}
if (includeQueryString && !StringUtil.isEmpty(req.getQueryString())) sb.append('?').append(req.getQueryString());
}
return sb.toString();
} | [
"public",
"static",
"String",
"getRequestURL",
"(",
"HttpServletRequest",
"req",
",",
"boolean",
"includeQueryString",
")",
"{",
"StringBuffer",
"sb",
"=",
"req",
".",
"getRequestURL",
"(",
")",
";",
"int",
"maxpos",
"=",
"sb",
".",
"indexOf",
"(",
"\"/\"",
... | returns the full request URL
@param req - the HttpServletRequest
@param includeQueryString - if true, the QueryString will be appended if one exists | [
"returns",
"the",
"full",
"request",
"URL"
] | 29b153fc4e126e5edb97da937f2ee2e231b87593 | https://github.com/lucee/Lucee/blob/29b153fc4e126e5edb97da937f2ee2e231b87593/core/src/main/java/lucee/runtime/net/http/ReqRspUtil.java#L493-L511 |
30,666 | lucee/Lucee | core/src/main/java/lucee/runtime/net/http/ReqRspUtil.java | ReqRspUtil.encodeRedirectURLEL | public static String encodeRedirectURLEL(HttpServletResponse rsp, String url) {
try {
return rsp.encodeRedirectURL(url);
}
catch (Throwable t) {
ExceptionUtil.rethrowIfNecessary(t);
return url;
}
} | java | public static String encodeRedirectURLEL(HttpServletResponse rsp, String url) {
try {
return rsp.encodeRedirectURL(url);
}
catch (Throwable t) {
ExceptionUtil.rethrowIfNecessary(t);
return url;
}
} | [
"public",
"static",
"String",
"encodeRedirectURLEL",
"(",
"HttpServletResponse",
"rsp",
",",
"String",
"url",
")",
"{",
"try",
"{",
"return",
"rsp",
".",
"encodeRedirectURL",
"(",
"url",
")",
";",
"}",
"catch",
"(",
"Throwable",
"t",
")",
"{",
"ExceptionUtil... | if encodings fails the given url is returned
@param rsp
@param url
@return | [
"if",
"encodings",
"fails",
"the",
"given",
"url",
"is",
"returned"
] | 29b153fc4e126e5edb97da937f2ee2e231b87593 | https://github.com/lucee/Lucee/blob/29b153fc4e126e5edb97da937f2ee2e231b87593/core/src/main/java/lucee/runtime/net/http/ReqRspUtil.java#L612-L620 |
30,667 | lucee/Lucee | core/src/main/java/lucee/runtime/tag/Schedule.java | Schedule.setStartdate | public void setStartdate(Object objStartDate) throws PageException {
if (StringUtil.isEmpty(objStartDate)) return;
this.startdate = new DateImpl(DateCaster.toDateAdvanced(objStartDate, pageContext.getTimeZone()));
} | java | public void setStartdate(Object objStartDate) throws PageException {
if (StringUtil.isEmpty(objStartDate)) return;
this.startdate = new DateImpl(DateCaster.toDateAdvanced(objStartDate, pageContext.getTimeZone()));
} | [
"public",
"void",
"setStartdate",
"(",
"Object",
"objStartDate",
")",
"throws",
"PageException",
"{",
"if",
"(",
"StringUtil",
".",
"isEmpty",
"(",
"objStartDate",
")",
")",
"return",
";",
"this",
".",
"startdate",
"=",
"new",
"DateImpl",
"(",
"DateCaster",
... | set the value startdate Required when action ='update'. The date when scheduling of the task
should start.
@param objStartDate value to set
@throws PageException | [
"set",
"the",
"value",
"startdate",
"Required",
"when",
"action",
"=",
"update",
".",
"The",
"date",
"when",
"scheduling",
"of",
"the",
"task",
"should",
"start",
"."
] | 29b153fc4e126e5edb97da937f2ee2e231b87593 | https://github.com/lucee/Lucee/blob/29b153fc4e126e5edb97da937f2ee2e231b87593/core/src/main/java/lucee/runtime/tag/Schedule.java#L204-L207 |
30,668 | lucee/Lucee | core/src/main/java/lucee/runtime/tag/Schedule.java | Schedule.setEnddate | public void setEnddate(Object enddate) throws PageException {
if (StringUtil.isEmpty(enddate)) return;
this.enddate = new DateImpl(DateCaster.toDateAdvanced(enddate, pageContext.getTimeZone()));
} | java | public void setEnddate(Object enddate) throws PageException {
if (StringUtil.isEmpty(enddate)) return;
this.enddate = new DateImpl(DateCaster.toDateAdvanced(enddate, pageContext.getTimeZone()));
} | [
"public",
"void",
"setEnddate",
"(",
"Object",
"enddate",
")",
"throws",
"PageException",
"{",
"if",
"(",
"StringUtil",
".",
"isEmpty",
"(",
"enddate",
")",
")",
"return",
";",
"this",
".",
"enddate",
"=",
"new",
"DateImpl",
"(",
"DateCaster",
".",
"toDate... | set the value enddate The date when the scheduled task ends.
@param enddate value to set
@throws PageException | [
"set",
"the",
"value",
"enddate",
"The",
"date",
"when",
"the",
"scheduled",
"task",
"ends",
"."
] | 29b153fc4e126e5edb97da937f2ee2e231b87593 | https://github.com/lucee/Lucee/blob/29b153fc4e126e5edb97da937f2ee2e231b87593/core/src/main/java/lucee/runtime/tag/Schedule.java#L258-L261 |
30,669 | lucee/Lucee | core/src/main/java/lucee/runtime/tag/Schedule.java | Schedule.setStarttime | public void setStarttime(Object starttime) throws PageException {
if (StringUtil.isEmpty(starttime)) return;
this.starttime = DateCaster.toTime(pageContext.getTimeZone(), starttime);
} | java | public void setStarttime(Object starttime) throws PageException {
if (StringUtil.isEmpty(starttime)) return;
this.starttime = DateCaster.toTime(pageContext.getTimeZone(), starttime);
} | [
"public",
"void",
"setStarttime",
"(",
"Object",
"starttime",
")",
"throws",
"PageException",
"{",
"if",
"(",
"StringUtil",
".",
"isEmpty",
"(",
"starttime",
")",
")",
"return",
";",
"this",
".",
"starttime",
"=",
"DateCaster",
".",
"toTime",
"(",
"pageConte... | set the value starttime Required when creating tasks with action = 'update'. Enter a value in
seconds. The time when scheduling of the task starts.
@param starttime value to set
@throws PageException | [
"set",
"the",
"value",
"starttime",
"Required",
"when",
"creating",
"tasks",
"with",
"action",
"=",
"update",
".",
"Enter",
"a",
"value",
"in",
"seconds",
".",
"The",
"time",
"when",
"scheduling",
"of",
"the",
"task",
"starts",
"."
] | 29b153fc4e126e5edb97da937f2ee2e231b87593 | https://github.com/lucee/Lucee/blob/29b153fc4e126e5edb97da937f2ee2e231b87593/core/src/main/java/lucee/runtime/tag/Schedule.java#L279-L282 |
30,670 | lucee/Lucee | core/src/main/java/lucee/runtime/tag/Schedule.java | Schedule.setProxyport | public void setProxyport(Object oProxyport) throws PageException {
if (StringUtil.isEmpty(oProxyport)) return;
this.proxyport = Caster.toIntValue(oProxyport);
} | java | public void setProxyport(Object oProxyport) throws PageException {
if (StringUtil.isEmpty(oProxyport)) return;
this.proxyport = Caster.toIntValue(oProxyport);
} | [
"public",
"void",
"setProxyport",
"(",
"Object",
"oProxyport",
")",
"throws",
"PageException",
"{",
"if",
"(",
"StringUtil",
".",
"isEmpty",
"(",
"oProxyport",
")",
")",
"return",
";",
"this",
".",
"proxyport",
"=",
"Caster",
".",
"toIntValue",
"(",
"oProxyp... | set the value proxyport The port number on the proxy server from which the task is being
requested. Default is 80. When used with resolveURL, the URLs of retrieved documents that specify
a port number are automatically resolved to preserve links in the retrieved document.
@param proxyport value to set
@throws PageException | [
"set",
"the",
"value",
"proxyport",
"The",
"port",
"number",
"on",
"the",
"proxy",
"server",
"from",
"which",
"the",
"task",
"is",
"being",
"requested",
".",
"Default",
"is",
"80",
".",
"When",
"used",
"with",
"resolveURL",
"the",
"URLs",
"of",
"retrieved"... | 29b153fc4e126e5edb97da937f2ee2e231b87593 | https://github.com/lucee/Lucee/blob/29b153fc4e126e5edb97da937f2ee2e231b87593/core/src/main/java/lucee/runtime/tag/Schedule.java#L292-L295 |
30,671 | lucee/Lucee | core/src/main/java/lucee/runtime/tag/Schedule.java | Schedule.setPort | public void setPort(Object oPort) throws PageException {
if (StringUtil.isEmpty(oPort)) return;
this.port = Caster.toIntValue(oPort);
} | java | public void setPort(Object oPort) throws PageException {
if (StringUtil.isEmpty(oPort)) return;
this.port = Caster.toIntValue(oPort);
} | [
"public",
"void",
"setPort",
"(",
"Object",
"oPort",
")",
"throws",
"PageException",
"{",
"if",
"(",
"StringUtil",
".",
"isEmpty",
"(",
"oPort",
")",
")",
"return",
";",
"this",
".",
"port",
"=",
"Caster",
".",
"toIntValue",
"(",
"oPort",
")",
";",
"}"... | set the value port The port number on the server from which the task is being scheduled. Default
is 80. When used with resolveURL, the URLs of retrieved documents that specify a port number are
automatically resolved to preserve links in the retrieved document.
@param port value to set
@throws PageException | [
"set",
"the",
"value",
"port",
"The",
"port",
"number",
"on",
"the",
"server",
"from",
"which",
"the",
"task",
"is",
"being",
"scheduled",
".",
"Default",
"is",
"80",
".",
"When",
"used",
"with",
"resolveURL",
"the",
"URLs",
"of",
"retrieved",
"documents",... | 29b153fc4e126e5edb97da937f2ee2e231b87593 | https://github.com/lucee/Lucee/blob/29b153fc4e126e5edb97da937f2ee2e231b87593/core/src/main/java/lucee/runtime/tag/Schedule.java#L305-L308 |
30,672 | lucee/Lucee | core/src/main/java/lucee/runtime/tag/Schedule.java | Schedule.setEndtime | public void setEndtime(Object endtime) throws PageException {
if (StringUtil.isEmpty(endtime)) return;
this.endtime = DateCaster.toTime(pageContext.getTimeZone(), endtime);
} | java | public void setEndtime(Object endtime) throws PageException {
if (StringUtil.isEmpty(endtime)) return;
this.endtime = DateCaster.toTime(pageContext.getTimeZone(), endtime);
} | [
"public",
"void",
"setEndtime",
"(",
"Object",
"endtime",
")",
"throws",
"PageException",
"{",
"if",
"(",
"StringUtil",
".",
"isEmpty",
"(",
"endtime",
")",
")",
"return",
";",
"this",
".",
"endtime",
"=",
"DateCaster",
".",
"toTime",
"(",
"pageContext",
"... | set the value endtime The time when the scheduled task ends. Enter a value in seconds.
@param endtime value to set
@throws PageException | [
"set",
"the",
"value",
"endtime",
"The",
"time",
"when",
"the",
"scheduled",
"task",
"ends",
".",
"Enter",
"a",
"value",
"in",
"seconds",
"."
] | 29b153fc4e126e5edb97da937f2ee2e231b87593 | https://github.com/lucee/Lucee/blob/29b153fc4e126e5edb97da937f2ee2e231b87593/core/src/main/java/lucee/runtime/tag/Schedule.java#L316-L319 |
30,673 | lucee/Lucee | core/src/main/java/lucee/runtime/tag/Schedule.java | Schedule.setOperation | public void setOperation(String operation) throws ApplicationException {
if (StringUtil.isEmpty(operation)) return;
operation = operation.toLowerCase().trim();
if (!operation.equals("httprequest")) throw new ApplicationException("attribute operation must have the value [HTTPRequest]");
} | java | public void setOperation(String operation) throws ApplicationException {
if (StringUtil.isEmpty(operation)) return;
operation = operation.toLowerCase().trim();
if (!operation.equals("httprequest")) throw new ApplicationException("attribute operation must have the value [HTTPRequest]");
} | [
"public",
"void",
"setOperation",
"(",
"String",
"operation",
")",
"throws",
"ApplicationException",
"{",
"if",
"(",
"StringUtil",
".",
"isEmpty",
"(",
"operation",
")",
")",
"return",
";",
"operation",
"=",
"operation",
".",
"toLowerCase",
"(",
")",
".",
"t... | set the value operation The type of operation the scheduler performs when executing this task.
@param operation value to set
@throws ApplicationException | [
"set",
"the",
"value",
"operation",
"The",
"type",
"of",
"operation",
"the",
"scheduler",
"performs",
"when",
"executing",
"this",
"task",
"."
] | 29b153fc4e126e5edb97da937f2ee2e231b87593 | https://github.com/lucee/Lucee/blob/29b153fc4e126e5edb97da937f2ee2e231b87593/core/src/main/java/lucee/runtime/tag/Schedule.java#L327-L331 |
30,674 | lucee/Lucee | core/src/main/java/lucee/runtime/tag/Schedule.java | Schedule.setInterval | public void setInterval(String interval) {
if (StringUtil.isEmpty(interval)) return;
interval = interval.trim().toLowerCase();
if (interval.equals("week")) this.interval = "weekly";
else if (interval.equals("day")) this.interval = "daily";
else if (interval.equals("month")) this.interval = "monthly";
else if (interval.equals("year")) this.interval = "yearly";
this.interval = interval;
} | java | public void setInterval(String interval) {
if (StringUtil.isEmpty(interval)) return;
interval = interval.trim().toLowerCase();
if (interval.equals("week")) this.interval = "weekly";
else if (interval.equals("day")) this.interval = "daily";
else if (interval.equals("month")) this.interval = "monthly";
else if (interval.equals("year")) this.interval = "yearly";
this.interval = interval;
} | [
"public",
"void",
"setInterval",
"(",
"String",
"interval",
")",
"{",
"if",
"(",
"StringUtil",
".",
"isEmpty",
"(",
"interval",
")",
")",
"return",
";",
"interval",
"=",
"interval",
".",
"trim",
"(",
")",
".",
"toLowerCase",
"(",
")",
";",
"if",
"(",
... | set the value interval Required when creating tasks with action = 'update'. Interval at which
task should be scheduled. Can be set in seconds or as Once, Daily, Weekly, and Monthly. The
default interval is one hour. The minimum interval is one minute.
@param interval value to set | [
"set",
"the",
"value",
"interval",
"Required",
"when",
"creating",
"tasks",
"with",
"action",
"=",
"update",
".",
"Interval",
"at",
"which",
"task",
"should",
"be",
"scheduled",
".",
"Can",
"be",
"set",
"in",
"seconds",
"or",
"as",
"Once",
"Daily",
"Weekly... | 29b153fc4e126e5edb97da937f2ee2e231b87593 | https://github.com/lucee/Lucee/blob/29b153fc4e126e5edb97da937f2ee2e231b87593/core/src/main/java/lucee/runtime/tag/Schedule.java#L340-L348 |
30,675 | lucee/Lucee | core/src/main/java/lucee/runtime/tag/Schedule.java | Schedule.setRequesttimeout | public void setRequesttimeout(Object oRequesttimeout) throws PageException {
if (StringUtil.isEmpty(oRequesttimeout)) return;
this.requesttimeout = Caster.toLongValue(oRequesttimeout) * 1000L;
} | java | public void setRequesttimeout(Object oRequesttimeout) throws PageException {
if (StringUtil.isEmpty(oRequesttimeout)) return;
this.requesttimeout = Caster.toLongValue(oRequesttimeout) * 1000L;
} | [
"public",
"void",
"setRequesttimeout",
"(",
"Object",
"oRequesttimeout",
")",
"throws",
"PageException",
"{",
"if",
"(",
"StringUtil",
".",
"isEmpty",
"(",
"oRequesttimeout",
")",
")",
"return",
";",
"this",
".",
"requesttimeout",
"=",
"Caster",
".",
"toLongValu... | set the value requesttimeout Customizes the requestTimeOut for the task operation. Can be used to
extend the default timeout for operations that require more time to execute.
@param requesttimeout value to set | [
"set",
"the",
"value",
"requesttimeout",
"Customizes",
"the",
"requestTimeOut",
"for",
"the",
"task",
"operation",
".",
"Can",
"be",
"used",
"to",
"extend",
"the",
"default",
"timeout",
"for",
"operations",
"that",
"require",
"more",
"time",
"to",
"execute",
"... | 29b153fc4e126e5edb97da937f2ee2e231b87593 | https://github.com/lucee/Lucee/blob/29b153fc4e126e5edb97da937f2ee2e231b87593/core/src/main/java/lucee/runtime/tag/Schedule.java#L365-L368 |
30,676 | lucee/Lucee | core/src/main/java/lucee/runtime/interpreter/CFMLExpressionInterpreter.java | CFMLExpressionInterpreter.negateMinusOp | private Ref negateMinusOp() throws PageException {
// And Operation
if (cfml.forwardIfCurrent('-')) {
if (cfml.forwardIfCurrent('-')) {
cfml.removeSpace();
Ref expr = clip();
Ref res = preciseMath ? new BigMinus(expr, new LNumber(new Double(1)), limited) : new Minus(expr, new LNumber(new Double(1)), limited);
return new Assign(expr, res, limited);
}
cfml.removeSpace();
return new Negate(clip(), limited);
}
if (cfml.forwardIfCurrent('+')) {
if (cfml.forwardIfCurrent('+')) {
cfml.removeSpace();
Ref expr = clip();
Ref res = preciseMath ? new BigPlus(expr, new LNumber(new Double(1)), limited) : new Plus(expr, new LNumber(new Double(1)), limited);
return new Assign(expr, res, limited);
}
cfml.removeSpace();
return new Casting("numeric", CFTypes.TYPE_NUMERIC, clip());
}
return clip();
} | java | private Ref negateMinusOp() throws PageException {
// And Operation
if (cfml.forwardIfCurrent('-')) {
if (cfml.forwardIfCurrent('-')) {
cfml.removeSpace();
Ref expr = clip();
Ref res = preciseMath ? new BigMinus(expr, new LNumber(new Double(1)), limited) : new Minus(expr, new LNumber(new Double(1)), limited);
return new Assign(expr, res, limited);
}
cfml.removeSpace();
return new Negate(clip(), limited);
}
if (cfml.forwardIfCurrent('+')) {
if (cfml.forwardIfCurrent('+')) {
cfml.removeSpace();
Ref expr = clip();
Ref res = preciseMath ? new BigPlus(expr, new LNumber(new Double(1)), limited) : new Plus(expr, new LNumber(new Double(1)), limited);
return new Assign(expr, res, limited);
}
cfml.removeSpace();
return new Casting("numeric", CFTypes.TYPE_NUMERIC, clip());
}
return clip();
} | [
"private",
"Ref",
"negateMinusOp",
"(",
")",
"throws",
"PageException",
"{",
"// And Operation",
"if",
"(",
"cfml",
".",
"forwardIfCurrent",
"(",
"'",
"'",
")",
")",
"{",
"if",
"(",
"cfml",
".",
"forwardIfCurrent",
"(",
"'",
"'",
")",
")",
"{",
"cfml",
... | Liest die Vordlobe einer Zahl ein
@return CFXD Element
@throws PageException | [
"Liest",
"die",
"Vordlobe",
"einer",
"Zahl",
"ein"
] | 29b153fc4e126e5edb97da937f2ee2e231b87593 | https://github.com/lucee/Lucee/blob/29b153fc4e126e5edb97da937f2ee2e231b87593/core/src/main/java/lucee/runtime/interpreter/CFMLExpressionInterpreter.java#L894-L919 |
30,677 | lucee/Lucee | core/src/main/java/lucee/commons/digest/Base64Encoder.java | Base64Encoder.encode | public static String encode(byte[] data) {
StringBuilder builder = new StringBuilder();
for (int position = 0; position < data.length; position += 3) {
builder.append(encodeGroup(data, position));
}
return builder.toString();
} | java | public static String encode(byte[] data) {
StringBuilder builder = new StringBuilder();
for (int position = 0; position < data.length; position += 3) {
builder.append(encodeGroup(data, position));
}
return builder.toString();
} | [
"public",
"static",
"String",
"encode",
"(",
"byte",
"[",
"]",
"data",
")",
"{",
"StringBuilder",
"builder",
"=",
"new",
"StringBuilder",
"(",
")",
";",
"for",
"(",
"int",
"position",
"=",
"0",
";",
"position",
"<",
"data",
".",
"length",
";",
"positio... | Translates the specified byte array into Base64 string.
@param data the byte array (not null)
@return the translated Base64 string (not null) | [
"Translates",
"the",
"specified",
"byte",
"array",
"into",
"Base64",
"string",
"."
] | 29b153fc4e126e5edb97da937f2ee2e231b87593 | https://github.com/lucee/Lucee/blob/29b153fc4e126e5edb97da937f2ee2e231b87593/core/src/main/java/lucee/commons/digest/Base64Encoder.java#L53-L59 |
30,678 | lucee/Lucee | core/src/main/java/lucee/commons/digest/Base64Encoder.java | Base64Encoder.encodeGroup | private static char[] encodeGroup(byte[] data, int position) {
final char[] c = new char[] { '=', '=', '=', '=' };
int b1 = 0, b2 = 0, b3 = 0;
int length = data.length - position;
if (length == 0) return c;
if (length >= 1) {
b1 = (data[position]) & 0xFF;
}
if (length >= 2) {
b2 = (data[position + 1]) & 0xFF;
}
if (length >= 3) {
b3 = (data[position + 2]) & 0xFF;
}
c[0] = ALPHABET[b1 >> 2];
c[1] = ALPHABET[(b1 & 3) << 4 | (b2 >> 4)];
if (length == 1) return c;
c[2] = ALPHABET[(b2 & 15) << 2 | (b3 >> 6)];
if (length == 2) return c;
c[3] = ALPHABET[b3 & 0x3f];
return c;
} | java | private static char[] encodeGroup(byte[] data, int position) {
final char[] c = new char[] { '=', '=', '=', '=' };
int b1 = 0, b2 = 0, b3 = 0;
int length = data.length - position;
if (length == 0) return c;
if (length >= 1) {
b1 = (data[position]) & 0xFF;
}
if (length >= 2) {
b2 = (data[position + 1]) & 0xFF;
}
if (length >= 3) {
b3 = (data[position + 2]) & 0xFF;
}
c[0] = ALPHABET[b1 >> 2];
c[1] = ALPHABET[(b1 & 3) << 4 | (b2 >> 4)];
if (length == 1) return c;
c[2] = ALPHABET[(b2 & 15) << 2 | (b3 >> 6)];
if (length == 2) return c;
c[3] = ALPHABET[b3 & 0x3f];
return c;
} | [
"private",
"static",
"char",
"[",
"]",
"encodeGroup",
"(",
"byte",
"[",
"]",
"data",
",",
"int",
"position",
")",
"{",
"final",
"char",
"[",
"]",
"c",
"=",
"new",
"char",
"[",
"]",
"{",
"'",
"'",
",",
"'",
"'",
",",
"'",
"'",
",",
"'",
"'",
... | Encode three bytes of data into four characters. | [
"Encode",
"three",
"bytes",
"of",
"data",
"into",
"four",
"characters",
"."
] | 29b153fc4e126e5edb97da937f2ee2e231b87593 | https://github.com/lucee/Lucee/blob/29b153fc4e126e5edb97da937f2ee2e231b87593/core/src/main/java/lucee/commons/digest/Base64Encoder.java#L66-L90 |
30,679 | lucee/Lucee | core/src/main/java/lucee/runtime/config/DeployHandler.java | DeployHandler.deploy | public static void deploy(Config config) {
if (!contextIsValid(config)) return;
synchronized (config) {
Resource dir = config.getDeployDirectory();
if (!dir.exists()) dir.mkdirs();
Resource[] children = dir.listResources(ALL_EXT);
Resource child;
String ext;
for (int i = 0; i < children.length; i++) {
child = children[i];
try {
// Lucee archives
ext = ResourceUtil.getExtension(child, null);
if ("lar".equalsIgnoreCase(ext)) {
// deployArchive(config,child,true);
XMLConfigAdmin.updateArchive((ConfigImpl) config, child, true);
}
// Lucee Extensions
else if ("lex".equalsIgnoreCase(ext)) XMLConfigAdmin._updateRHExtension((ConfigImpl) config, child, true);
// Lucee core
else if (config instanceof ConfigServer && "lco".equalsIgnoreCase(ext)) XMLConfigAdmin.updateCore((ConfigServerImpl) config, child, true);
}
catch (Throwable t) {
ExceptionUtil.rethrowIfNecessary(t);
Log log = config.getLog("deploy");
log.error("Extension", t);
}
}
}
} | java | public static void deploy(Config config) {
if (!contextIsValid(config)) return;
synchronized (config) {
Resource dir = config.getDeployDirectory();
if (!dir.exists()) dir.mkdirs();
Resource[] children = dir.listResources(ALL_EXT);
Resource child;
String ext;
for (int i = 0; i < children.length; i++) {
child = children[i];
try {
// Lucee archives
ext = ResourceUtil.getExtension(child, null);
if ("lar".equalsIgnoreCase(ext)) {
// deployArchive(config,child,true);
XMLConfigAdmin.updateArchive((ConfigImpl) config, child, true);
}
// Lucee Extensions
else if ("lex".equalsIgnoreCase(ext)) XMLConfigAdmin._updateRHExtension((ConfigImpl) config, child, true);
// Lucee core
else if (config instanceof ConfigServer && "lco".equalsIgnoreCase(ext)) XMLConfigAdmin.updateCore((ConfigServerImpl) config, child, true);
}
catch (Throwable t) {
ExceptionUtil.rethrowIfNecessary(t);
Log log = config.getLog("deploy");
log.error("Extension", t);
}
}
}
} | [
"public",
"static",
"void",
"deploy",
"(",
"Config",
"config",
")",
"{",
"if",
"(",
"!",
"contextIsValid",
"(",
"config",
")",
")",
"return",
";",
"synchronized",
"(",
"config",
")",
"{",
"Resource",
"dir",
"=",
"config",
".",
"getDeployDirectory",
"(",
... | deploys all files found
@param config | [
"deploys",
"all",
"files",
"found"
] | 29b153fc4e126e5edb97da937f2ee2e231b87593 | https://github.com/lucee/Lucee/blob/29b153fc4e126e5edb97da937f2ee2e231b87593/core/src/main/java/lucee/runtime/config/DeployHandler.java#L61-L94 |
30,680 | lucee/Lucee | core/src/main/java/lucee/commons/img/AbstractCaptcha.java | AbstractCaptcha.generate | public BufferedImage generate(String text, int width, int height, String[] fonts, boolean useAntiAlias, Color fontColor, int fontSize, int difficulty) throws CaptchaException {
if (difficulty == DIFFICULTY_LOW) {
return generate(text, width, height, fonts, useAntiAlias, fontColor, fontSize, 0, 0, 0, 0, 0, 0, 230, 25);
}
if (difficulty == DIFFICULTY_MEDIUM) {
return generate(text, width, height, fonts, useAntiAlias, fontColor, fontSize, 0, 0, 5, 30, 0, 0, 200, 35);
}
return generate(text, width, height, fonts, useAntiAlias, fontColor, fontSize, 4, 10, 30, 60, 4, 10, 170, 45);
} | java | public BufferedImage generate(String text, int width, int height, String[] fonts, boolean useAntiAlias, Color fontColor, int fontSize, int difficulty) throws CaptchaException {
if (difficulty == DIFFICULTY_LOW) {
return generate(text, width, height, fonts, useAntiAlias, fontColor, fontSize, 0, 0, 0, 0, 0, 0, 230, 25);
}
if (difficulty == DIFFICULTY_MEDIUM) {
return generate(text, width, height, fonts, useAntiAlias, fontColor, fontSize, 0, 0, 5, 30, 0, 0, 200, 35);
}
return generate(text, width, height, fonts, useAntiAlias, fontColor, fontSize, 4, 10, 30, 60, 4, 10, 170, 45);
} | [
"public",
"BufferedImage",
"generate",
"(",
"String",
"text",
",",
"int",
"width",
",",
"int",
"height",
",",
"String",
"[",
"]",
"fonts",
",",
"boolean",
"useAntiAlias",
",",
"Color",
"fontColor",
",",
"int",
"fontSize",
",",
"int",
"difficulty",
")",
"th... | generates a Captcha as a Buffered Image file
@param text text for the captcha
@param width width of the resulting image
@param height height of the resulting image
@param fonts list of font used for the captcha (all font are random used)
@param useAntiAlias use anti aliasing or not
@param fontColor color of the font
@param fontSize size of the font
@param difficulty difficulty of the reslting captcha
@return captcha image
@throws CaptchaException | [
"generates",
"a",
"Captcha",
"as",
"a",
"Buffered",
"Image",
"file"
] | 29b153fc4e126e5edb97da937f2ee2e231b87593 | https://github.com/lucee/Lucee/blob/29b153fc4e126e5edb97da937f2ee2e231b87593/core/src/main/java/lucee/commons/img/AbstractCaptcha.java#L58-L66 |
30,681 | lucee/Lucee | core/src/main/java/lucee/runtime/type/scope/ArgumentImpl.java | ArgumentImpl.getE | @Override
public Object getE(int intKey) throws PageException {
Iterator it = valueIterator();// getMap().keySet().iterator();
int count = 0;
Object o;
while (it.hasNext()) {
o = it.next();
if ((++count) == intKey) {
return o;// super.get(o.toString());
}
}
throw new ExpressionException("invalid index [" + intKey + "] for argument scope");
} | java | @Override
public Object getE(int intKey) throws PageException {
Iterator it = valueIterator();// getMap().keySet().iterator();
int count = 0;
Object o;
while (it.hasNext()) {
o = it.next();
if ((++count) == intKey) {
return o;// super.get(o.toString());
}
}
throw new ExpressionException("invalid index [" + intKey + "] for argument scope");
} | [
"@",
"Override",
"public",
"Object",
"getE",
"(",
"int",
"intKey",
")",
"throws",
"PageException",
"{",
"Iterator",
"it",
"=",
"valueIterator",
"(",
")",
";",
"// getMap().keySet().iterator();",
"int",
"count",
"=",
"0",
";",
"Object",
"o",
";",
"while",
"("... | return a value matching to key
@param intKey
@return value matching key
@throws PageException | [
"return",
"a",
"value",
"matching",
"to",
"key"
] | 29b153fc4e126e5edb97da937f2ee2e231b87593 | https://github.com/lucee/Lucee/blob/29b153fc4e126e5edb97da937f2ee2e231b87593/core/src/main/java/lucee/runtime/type/scope/ArgumentImpl.java#L167-L179 |
30,682 | lucee/Lucee | core/src/main/java/lucee/runtime/type/scope/ArgumentImpl.java | ArgumentImpl.toStruct | public static Struct toStruct(Argument arg) {
Struct trg = new StructImpl();
StructImpl.copy(arg, trg, false);
return trg;
} | java | public static Struct toStruct(Argument arg) {
Struct trg = new StructImpl();
StructImpl.copy(arg, trg, false);
return trg;
} | [
"public",
"static",
"Struct",
"toStruct",
"(",
"Argument",
"arg",
")",
"{",
"Struct",
"trg",
"=",
"new",
"StructImpl",
"(",
")",
";",
"StructImpl",
".",
"copy",
"(",
"arg",
",",
"trg",
",",
"false",
")",
";",
"return",
"trg",
";",
"}"
] | converts a argument scope to a regular struct
@param arg argument scope to convert
@return resulting struct | [
"converts",
"a",
"argument",
"scope",
"to",
"a",
"regular",
"struct"
] | 29b153fc4e126e5edb97da937f2ee2e231b87593 | https://github.com/lucee/Lucee/blob/29b153fc4e126e5edb97da937f2ee2e231b87593/core/src/main/java/lucee/runtime/type/scope/ArgumentImpl.java#L439-L443 |
30,683 | lucee/Lucee | core/src/main/java/lucee/runtime/type/scope/ArgumentImpl.java | ArgumentImpl.toArray | public static Array toArray(Argument arg) {
ArrayImpl trg = new ArrayImpl();
int[] keys = arg.intKeys();
for (int i = 0; i < keys.length; i++) {
trg.setEL(keys[i], arg.get(keys[i], null));
}
return trg;
} | java | public static Array toArray(Argument arg) {
ArrayImpl trg = new ArrayImpl();
int[] keys = arg.intKeys();
for (int i = 0; i < keys.length; i++) {
trg.setEL(keys[i], arg.get(keys[i], null));
}
return trg;
} | [
"public",
"static",
"Array",
"toArray",
"(",
"Argument",
"arg",
")",
"{",
"ArrayImpl",
"trg",
"=",
"new",
"ArrayImpl",
"(",
")",
";",
"int",
"[",
"]",
"keys",
"=",
"arg",
".",
"intKeys",
"(",
")",
";",
"for",
"(",
"int",
"i",
"=",
"0",
";",
"i",
... | converts a argument scope to a regular array
@param arg argument scope to convert
@return resulting array | [
"converts",
"a",
"argument",
"scope",
"to",
"a",
"regular",
"array"
] | 29b153fc4e126e5edb97da937f2ee2e231b87593 | https://github.com/lucee/Lucee/blob/29b153fc4e126e5edb97da937f2ee2e231b87593/core/src/main/java/lucee/runtime/type/scope/ArgumentImpl.java#L451-L458 |
30,684 | lucee/Lucee | core/src/main/java/lucee/runtime/type/util/StructSupport.java | StructSupport.invalidKey | public static ExpressionException invalidKey(Config config, Struct sct, Key key, String in) {
String appendix = StringUtil.isEmpty(in, true) ? "" : " in the " + in;
Iterator<Key> it = sct.keyIterator();
Key k;
while (it.hasNext()) {
k = it.next();
if (k.equals(key)) return new ExpressionException("the value from key [" + key.getString() + "] " + appendix + " is NULL, which is the same as not existing in CFML");
}
config = ThreadLocalPageContext.getConfig(config);
if (config != null && config.debug()) return new ExpressionException(ExceptionUtil.similarKeyMessage(sct, key.getString(), "key", "keys", in, true));
return new ExpressionException("key [" + key.getString() + "] doesn't exist" + appendix);
} | java | public static ExpressionException invalidKey(Config config, Struct sct, Key key, String in) {
String appendix = StringUtil.isEmpty(in, true) ? "" : " in the " + in;
Iterator<Key> it = sct.keyIterator();
Key k;
while (it.hasNext()) {
k = it.next();
if (k.equals(key)) return new ExpressionException("the value from key [" + key.getString() + "] " + appendix + " is NULL, which is the same as not existing in CFML");
}
config = ThreadLocalPageContext.getConfig(config);
if (config != null && config.debug()) return new ExpressionException(ExceptionUtil.similarKeyMessage(sct, key.getString(), "key", "keys", in, true));
return new ExpressionException("key [" + key.getString() + "] doesn't exist" + appendix);
} | [
"public",
"static",
"ExpressionException",
"invalidKey",
"(",
"Config",
"config",
",",
"Struct",
"sct",
",",
"Key",
"key",
",",
"String",
"in",
")",
"{",
"String",
"appendix",
"=",
"StringUtil",
".",
"isEmpty",
"(",
"in",
",",
"true",
")",
"?",
"\"\"",
"... | throw exception for invalid key
@param key Invalid key
@return returns an invalid key Exception | [
"throw",
"exception",
"for",
"invalid",
"key"
] | 29b153fc4e126e5edb97da937f2ee2e231b87593 | https://github.com/lucee/Lucee/blob/29b153fc4e126e5edb97da937f2ee2e231b87593/core/src/main/java/lucee/runtime/type/util/StructSupport.java#L55-L68 |
30,685 | lucee/Lucee | core/src/main/java/lucee/commons/surveillance/HeapDumper.java | HeapDumper.dumpTo | public static void dumpTo(Resource res, boolean live) throws IOException {
MBeanServer mbserver = ManagementFactory.getPlatformMBeanServer();
HotSpotDiagnosticMXBean mxbean = ManagementFactory.newPlatformMXBeanProxy(mbserver, "com.sun.management:type=HotSpotDiagnostic", HotSpotDiagnosticMXBean.class);
String path;
Resource tmp = null;
if (res instanceof FileResource) path = res.getAbsolutePath();
else {
tmp = SystemUtil.getTempFile("hprof", false);
path = tmp.getAbsolutePath();
}
try {
// it only
mxbean.dumpHeap(path, live);
}
finally {
if (tmp != null && tmp.exists()) {
tmp.moveTo(res);
}
}
} | java | public static void dumpTo(Resource res, boolean live) throws IOException {
MBeanServer mbserver = ManagementFactory.getPlatformMBeanServer();
HotSpotDiagnosticMXBean mxbean = ManagementFactory.newPlatformMXBeanProxy(mbserver, "com.sun.management:type=HotSpotDiagnostic", HotSpotDiagnosticMXBean.class);
String path;
Resource tmp = null;
if (res instanceof FileResource) path = res.getAbsolutePath();
else {
tmp = SystemUtil.getTempFile("hprof", false);
path = tmp.getAbsolutePath();
}
try {
// it only
mxbean.dumpHeap(path, live);
}
finally {
if (tmp != null && tmp.exists()) {
tmp.moveTo(res);
}
}
} | [
"public",
"static",
"void",
"dumpTo",
"(",
"Resource",
"res",
",",
"boolean",
"live",
")",
"throws",
"IOException",
"{",
"MBeanServer",
"mbserver",
"=",
"ManagementFactory",
".",
"getPlatformMBeanServer",
"(",
")",
";",
"HotSpotDiagnosticMXBean",
"mxbean",
"=",
"M... | Dumps the heap to the outputFile file in the same format as the hprof heap dump. If this method
is called remotely from another process, the heap dump output is written to a file named
outputFile on the machine where the target VM is running. If outputFile is a relative path, it is
relative to the working directory where the target VM was started.
@param res Resource to write the .hprof file.
@param live if true dump only live objects i.e. objects that are reachable from others
@throws IOException | [
"Dumps",
"the",
"heap",
"to",
"the",
"outputFile",
"file",
"in",
"the",
"same",
"format",
"as",
"the",
"hprof",
"heap",
"dump",
".",
"If",
"this",
"method",
"is",
"called",
"remotely",
"from",
"another",
"process",
"the",
"heap",
"dump",
"output",
"is",
... | 29b153fc4e126e5edb97da937f2ee2e231b87593 | https://github.com/lucee/Lucee/blob/29b153fc4e126e5edb97da937f2ee2e231b87593/core/src/main/java/lucee/commons/surveillance/HeapDumper.java#L44-L65 |
30,686 | lucee/Lucee | core/src/main/java/lucee/commons/net/http/httpclient/HTTPEngine4Impl.java | HTTPEngine4Impl.get | public static HTTPResponse get(URL url, String username, String password, long timeout, boolean redirect, String charset, String useragent, ProxyData proxy,
lucee.commons.net.http.Header[] headers) throws IOException {
HttpGet get = new HttpGet(url.toExternalForm());
return _invoke(url, get, username, password, timeout, redirect, charset, useragent, proxy, headers, null);
} | java | public static HTTPResponse get(URL url, String username, String password, long timeout, boolean redirect, String charset, String useragent, ProxyData proxy,
lucee.commons.net.http.Header[] headers) throws IOException {
HttpGet get = new HttpGet(url.toExternalForm());
return _invoke(url, get, username, password, timeout, redirect, charset, useragent, proxy, headers, null);
} | [
"public",
"static",
"HTTPResponse",
"get",
"(",
"URL",
"url",
",",
"String",
"username",
",",
"String",
"password",
",",
"long",
"timeout",
",",
"boolean",
"redirect",
",",
"String",
"charset",
",",
"String",
"useragent",
",",
"ProxyData",
"proxy",
",",
"luc... | does a http get request
@param url
@param username
@param password
@param timeout
@param charset
@param useragent
@param proxyserver
@param proxyport
@param proxyuser
@param proxypassword
@param headers
@return
@throws IOException | [
"does",
"a",
"http",
"get",
"request"
] | 29b153fc4e126e5edb97da937f2ee2e231b87593 | https://github.com/lucee/Lucee/blob/29b153fc4e126e5edb97da937f2ee2e231b87593/core/src/main/java/lucee/commons/net/http/httpclient/HTTPEngine4Impl.java#L110-L114 |
30,687 | lucee/Lucee | core/src/main/java/lucee/commons/net/http/httpclient/HTTPEngine4Impl.java | HTTPEngine4Impl.put | public static HTTPResponse put(URL url, String username, String password, long timeout, boolean redirect, String mimetype, String charset, String useragent, ProxyData proxy,
lucee.commons.net.http.Header[] headers, Object body) throws IOException {
HttpPut put = new HttpPut(url.toExternalForm());
setBody(put, body, mimetype, charset);
return _invoke(url, put, username, password, timeout, redirect, charset, useragent, proxy, headers, null);
} | java | public static HTTPResponse put(URL url, String username, String password, long timeout, boolean redirect, String mimetype, String charset, String useragent, ProxyData proxy,
lucee.commons.net.http.Header[] headers, Object body) throws IOException {
HttpPut put = new HttpPut(url.toExternalForm());
setBody(put, body, mimetype, charset);
return _invoke(url, put, username, password, timeout, redirect, charset, useragent, proxy, headers, null);
} | [
"public",
"static",
"HTTPResponse",
"put",
"(",
"URL",
"url",
",",
"String",
"username",
",",
"String",
"password",
",",
"long",
"timeout",
",",
"boolean",
"redirect",
",",
"String",
"mimetype",
",",
"String",
"charset",
",",
"String",
"useragent",
",",
"Pro... | does a http put request
@param url
@param username
@param password
@param timeout
@param charset
@param useragent
@param proxyserver
@param proxyport
@param proxyuser
@param proxypassword
@param headers
@param body
@return
@throws IOException
@throws PageException | [
"does",
"a",
"http",
"put",
"request"
] | 29b153fc4e126e5edb97da937f2ee2e231b87593 | https://github.com/lucee/Lucee/blob/29b153fc4e126e5edb97da937f2ee2e231b87593/core/src/main/java/lucee/commons/net/http/httpclient/HTTPEngine4Impl.java#L165-L171 |
30,688 | lucee/Lucee | core/src/main/java/lucee/commons/net/http/httpclient/HTTPEngine4Impl.java | HTTPEngine4Impl.toHttpEntity | private static HttpEntity toHttpEntity(Object value, String mimetype, String charset) throws IOException {
if (value instanceof HttpEntity) return (HttpEntity) value;
// content type
ContentType ct = HTTPEngine.toContentType(mimetype, charset);
try {
if (value instanceof TemporaryStream) {
if (ct != null) return new TemporaryStreamHttpEntity((TemporaryStream) value, ct);
return new TemporaryStreamHttpEntity((TemporaryStream) value, null);
}
else if (value instanceof InputStream) {
if (ct != null) return new ByteArrayEntity(IOUtil.toBytes((InputStream) value), ct);
return new ByteArrayEntity(IOUtil.toBytes((InputStream) value));
}
else if (Decision.isCastableToBinary(value, false)) {
if (ct != null) return new ByteArrayEntity(Caster.toBinary(value), ct);
return new ByteArrayEntity(Caster.toBinary(value));
}
else {
boolean wasNull = false;
if (ct == null) {
wasNull = true;
ct = ContentType.APPLICATION_OCTET_STREAM;
}
String str = Caster.toString(value);
if (str.equals("<empty>")) {
return new EmptyHttpEntity(ct);
}
if (wasNull && !StringUtil.isEmpty(charset, true)) return new StringEntity(str, charset.trim());
else return new StringEntity(str, ct);
}
}
catch (Exception e) {
throw ExceptionUtil.toIOException(e);
}
} | java | private static HttpEntity toHttpEntity(Object value, String mimetype, String charset) throws IOException {
if (value instanceof HttpEntity) return (HttpEntity) value;
// content type
ContentType ct = HTTPEngine.toContentType(mimetype, charset);
try {
if (value instanceof TemporaryStream) {
if (ct != null) return new TemporaryStreamHttpEntity((TemporaryStream) value, ct);
return new TemporaryStreamHttpEntity((TemporaryStream) value, null);
}
else if (value instanceof InputStream) {
if (ct != null) return new ByteArrayEntity(IOUtil.toBytes((InputStream) value), ct);
return new ByteArrayEntity(IOUtil.toBytes((InputStream) value));
}
else if (Decision.isCastableToBinary(value, false)) {
if (ct != null) return new ByteArrayEntity(Caster.toBinary(value), ct);
return new ByteArrayEntity(Caster.toBinary(value));
}
else {
boolean wasNull = false;
if (ct == null) {
wasNull = true;
ct = ContentType.APPLICATION_OCTET_STREAM;
}
String str = Caster.toString(value);
if (str.equals("<empty>")) {
return new EmptyHttpEntity(ct);
}
if (wasNull && !StringUtil.isEmpty(charset, true)) return new StringEntity(str, charset.trim());
else return new StringEntity(str, ct);
}
}
catch (Exception e) {
throw ExceptionUtil.toIOException(e);
}
} | [
"private",
"static",
"HttpEntity",
"toHttpEntity",
"(",
"Object",
"value",
",",
"String",
"mimetype",
",",
"String",
"charset",
")",
"throws",
"IOException",
"{",
"if",
"(",
"value",
"instanceof",
"HttpEntity",
")",
"return",
"(",
"HttpEntity",
")",
"value",
"... | convert input to HTTP Entity
@param value
@param mimetype not used for binary input
@param charset not used for binary input
@return
@throws IOException | [
"convert",
"input",
"to",
"HTTP",
"Entity"
] | 29b153fc4e126e5edb97da937f2ee2e231b87593 | https://github.com/lucee/Lucee/blob/29b153fc4e126e5edb97da937f2ee2e231b87593/core/src/main/java/lucee/commons/net/http/httpclient/HTTPEngine4Impl.java#L377-L412 |
30,689 | lucee/Lucee | core/src/main/java/lucee/runtime/tag/Execute.java | Execute.setArguments | public void setArguments(Object args) {
if (args instanceof lucee.runtime.type.Collection) {
StringBuilder sb = new StringBuilder();
lucee.runtime.type.Collection coll = (lucee.runtime.type.Collection) args;
// lucee.runtime.type.Collection.Key[] keys=coll.keys();
Iterator<Object> it = coll.valueIterator();
while (it.hasNext()) {
sb.append(' ');
sb.append(it.next());
}
arguments = sb.toString();
}
else if (args instanceof String) {
arguments = " " + args.toString();
}
else this.arguments = "";
} | java | public void setArguments(Object args) {
if (args instanceof lucee.runtime.type.Collection) {
StringBuilder sb = new StringBuilder();
lucee.runtime.type.Collection coll = (lucee.runtime.type.Collection) args;
// lucee.runtime.type.Collection.Key[] keys=coll.keys();
Iterator<Object> it = coll.valueIterator();
while (it.hasNext()) {
sb.append(' ');
sb.append(it.next());
}
arguments = sb.toString();
}
else if (args instanceof String) {
arguments = " " + args.toString();
}
else this.arguments = "";
} | [
"public",
"void",
"setArguments",
"(",
"Object",
"args",
")",
"{",
"if",
"(",
"args",
"instanceof",
"lucee",
".",
"runtime",
".",
"type",
".",
"Collection",
")",
"{",
"StringBuilder",
"sb",
"=",
"new",
"StringBuilder",
"(",
")",
";",
"lucee",
".",
"runti... | set the value arguments Command-line arguments passed to the application.
@param args value to set | [
"set",
"the",
"value",
"arguments",
"Command",
"-",
"line",
"arguments",
"passed",
"to",
"the",
"application",
"."
] | 29b153fc4e126e5edb97da937f2ee2e231b87593 | https://github.com/lucee/Lucee/blob/29b153fc4e126e5edb97da937f2ee2e231b87593/core/src/main/java/lucee/runtime/tag/Execute.java#L93-L110 |
30,690 | lucee/Lucee | core/src/main/java/lucee/runtime/tag/Execute.java | Execute.setTimeout | public void setTimeout(double timeout) throws ApplicationException {
if (timeout < 0) throw new ApplicationException("value must be a positive number now [" + Caster.toString(timeout) + "]");
this.timeout = (long) (timeout * 1000L);
} | java | public void setTimeout(double timeout) throws ApplicationException {
if (timeout < 0) throw new ApplicationException("value must be a positive number now [" + Caster.toString(timeout) + "]");
this.timeout = (long) (timeout * 1000L);
} | [
"public",
"void",
"setTimeout",
"(",
"double",
"timeout",
")",
"throws",
"ApplicationException",
"{",
"if",
"(",
"timeout",
"<",
"0",
")",
"throw",
"new",
"ApplicationException",
"(",
"\"value must be a positive number now [\"",
"+",
"Caster",
".",
"toString",
"(",
... | set the value timeout Indicates how long, in seconds, the CFML executing thread waits for the
spawned process. A timeout of 0 is equivalent to the non-blocking mode of executing. A very high
timeout value is equivalent to a blocking mode of execution. The default is 0; therefore, the
CFML thread spawns a process and returns without waiting for the process to terminate.If no
output file is specified, and the timeout value is 0, the program output is discarded.
@param timeout value to set
@throws ApplicationException | [
"set",
"the",
"value",
"timeout",
"Indicates",
"how",
"long",
"in",
"seconds",
"the",
"CFML",
"executing",
"thread",
"waits",
"for",
"the",
"spawned",
"process",
".",
"A",
"timeout",
"of",
"0",
"is",
"equivalent",
"to",
"the",
"non",
"-",
"blocking",
"mode... | 29b153fc4e126e5edb97da937f2ee2e231b87593 | https://github.com/lucee/Lucee/blob/29b153fc4e126e5edb97da937f2ee2e231b87593/core/src/main/java/lucee/runtime/tag/Execute.java#L122-L125 |
30,691 | lucee/Lucee | core/src/main/java/lucee/runtime/tag/Execute.java | Execute.setOutputfile | public void setOutputfile(String outputfile) {
try {
this.outputfile = ResourceUtil.toResourceExistingParent(pageContext, outputfile);
pageContext.getConfig().getSecurityManager().checkFileLocation(this.outputfile);
}
catch (PageException e) {
this.outputfile = pageContext.getConfig().getTempDirectory().getRealResource(outputfile);
if (!this.outputfile.getParentResource().exists()) this.outputfile = null;
else if (!this.outputfile.isFile()) this.outputfile = null;
else if (!this.outputfile.exists()) {
ResourceUtil.createFileEL(this.outputfile, false);
// try {
// this.outputfile.createNewFile();
/*
* } catch (IOException e1) { this.outputfile=null; }
*/
}
}
} | java | public void setOutputfile(String outputfile) {
try {
this.outputfile = ResourceUtil.toResourceExistingParent(pageContext, outputfile);
pageContext.getConfig().getSecurityManager().checkFileLocation(this.outputfile);
}
catch (PageException e) {
this.outputfile = pageContext.getConfig().getTempDirectory().getRealResource(outputfile);
if (!this.outputfile.getParentResource().exists()) this.outputfile = null;
else if (!this.outputfile.isFile()) this.outputfile = null;
else if (!this.outputfile.exists()) {
ResourceUtil.createFileEL(this.outputfile, false);
// try {
// this.outputfile.createNewFile();
/*
* } catch (IOException e1) { this.outputfile=null; }
*/
}
}
} | [
"public",
"void",
"setOutputfile",
"(",
"String",
"outputfile",
")",
"{",
"try",
"{",
"this",
".",
"outputfile",
"=",
"ResourceUtil",
".",
"toResourceExistingParent",
"(",
"pageContext",
",",
"outputfile",
")",
";",
"pageContext",
".",
"getConfig",
"(",
")",
"... | set the value outputfile The file to which to direct the output of the program. If not specified,
the output is displayed on the page from which it was called.
@param outputfile value to set
@throws SecurityException | [
"set",
"the",
"value",
"outputfile",
"The",
"file",
"to",
"which",
"to",
"direct",
"the",
"output",
"of",
"the",
"program",
".",
"If",
"not",
"specified",
"the",
"output",
"is",
"displayed",
"on",
"the",
"page",
"from",
"which",
"it",
"was",
"called",
".... | 29b153fc4e126e5edb97da937f2ee2e231b87593 | https://github.com/lucee/Lucee/blob/29b153fc4e126e5edb97da937f2ee2e231b87593/core/src/main/java/lucee/runtime/tag/Execute.java#L164-L183 |
30,692 | lucee/Lucee | core/src/main/java/lucee/commons/io/SystemUtil.java | SystemUtil.isFSCaseSensitive | public static boolean isFSCaseSensitive() {
if (isFSCaseSensitive == null) {
try {
_isFSCaseSensitive(File.createTempFile("abcx", "txt"));
}
catch (IOException e) {
File f = new File("abcx.txt").getAbsoluteFile();
try {
f.createNewFile();
_isFSCaseSensitive(f);
}
catch (IOException e1) {
throw new RuntimeException(e1.getMessage());
}
}
}
return isFSCaseSensitive.booleanValue();
} | java | public static boolean isFSCaseSensitive() {
if (isFSCaseSensitive == null) {
try {
_isFSCaseSensitive(File.createTempFile("abcx", "txt"));
}
catch (IOException e) {
File f = new File("abcx.txt").getAbsoluteFile();
try {
f.createNewFile();
_isFSCaseSensitive(f);
}
catch (IOException e1) {
throw new RuntimeException(e1.getMessage());
}
}
}
return isFSCaseSensitive.booleanValue();
} | [
"public",
"static",
"boolean",
"isFSCaseSensitive",
"(",
")",
"{",
"if",
"(",
"isFSCaseSensitive",
"==",
"null",
")",
"{",
"try",
"{",
"_isFSCaseSensitive",
"(",
"File",
".",
"createTempFile",
"(",
"\"abcx\"",
",",
"\"txt\"",
")",
")",
";",
"}",
"catch",
"... | returns if the file system case sensitive or not
@return is the file system case sensitive or not | [
"returns",
"if",
"the",
"file",
"system",
"case",
"sensitive",
"or",
"not"
] | 29b153fc4e126e5edb97da937f2ee2e231b87593 | https://github.com/lucee/Lucee/blob/29b153fc4e126e5edb97da937f2ee2e231b87593/core/src/main/java/lucee/commons/io/SystemUtil.java#L267-L285 |
30,693 | lucee/Lucee | core/src/main/java/lucee/commons/io/SystemUtil.java | SystemUtil.getHomeDirectory | public static Resource getHomeDirectory() {
if (homeFile != null) return homeFile;
ResourceProvider frp = ResourcesImpl.getFileResourceProvider();
String homeStr = System.getProperty("user.home");
if (homeStr != null) {
homeFile = frp.getResource(homeStr);
homeFile = ResourceUtil.getCanonicalResourceEL(homeFile);
}
return homeFile;
} | java | public static Resource getHomeDirectory() {
if (homeFile != null) return homeFile;
ResourceProvider frp = ResourcesImpl.getFileResourceProvider();
String homeStr = System.getProperty("user.home");
if (homeStr != null) {
homeFile = frp.getResource(homeStr);
homeFile = ResourceUtil.getCanonicalResourceEL(homeFile);
}
return homeFile;
} | [
"public",
"static",
"Resource",
"getHomeDirectory",
"(",
")",
"{",
"if",
"(",
"homeFile",
"!=",
"null",
")",
"return",
"homeFile",
";",
"ResourceProvider",
"frp",
"=",
"ResourcesImpl",
".",
"getFileResourceProvider",
"(",
")",
";",
"String",
"homeStr",
"=",
"S... | returns the Hoome Directory of the System
@return home directory | [
"returns",
"the",
"Hoome",
"Directory",
"of",
"the",
"System"
] | 29b153fc4e126e5edb97da937f2ee2e231b87593 | https://github.com/lucee/Lucee/blob/29b153fc4e126e5edb97da937f2ee2e231b87593/core/src/main/java/lucee/commons/io/SystemUtil.java#L436-L447 |
30,694 | lucee/Lucee | core/src/main/java/lucee/commons/io/SystemUtil.java | SystemUtil.getOSArch | public static int getOSArch() {
if (osArch == -1) {
osArch = toIntArch(System.getProperty("os.arch.data.model"));
if (osArch == ARCH_UNKNOW) osArch = toIntArch(System.getProperty("os.arch"));
}
return osArch;
} | java | public static int getOSArch() {
if (osArch == -1) {
osArch = toIntArch(System.getProperty("os.arch.data.model"));
if (osArch == ARCH_UNKNOW) osArch = toIntArch(System.getProperty("os.arch"));
}
return osArch;
} | [
"public",
"static",
"int",
"getOSArch",
"(",
")",
"{",
"if",
"(",
"osArch",
"==",
"-",
"1",
")",
"{",
"osArch",
"=",
"toIntArch",
"(",
"System",
".",
"getProperty",
"(",
"\"os.arch.data.model\"",
")",
")",
";",
"if",
"(",
"osArch",
"==",
"ARCH_UNKNOW",
... | return the operating system architecture
@return one of the following SystemUtil.ARCH_UNKNOW, SystemUtil.ARCH_32, SystemUtil.ARCH_64 | [
"return",
"the",
"operating",
"system",
"architecture"
] | 29b153fc4e126e5edb97da937f2ee2e231b87593 | https://github.com/lucee/Lucee/blob/29b153fc4e126e5edb97da937f2ee2e231b87593/core/src/main/java/lucee/commons/io/SystemUtil.java#L724-L730 |
30,695 | lucee/Lucee | core/src/main/java/lucee/commons/io/SystemUtil.java | SystemUtil.getSystemPropOrEnvVar | public static String getSystemPropOrEnvVar(String name, String defaultValue) {
// env
String value = System.getenv(name);
if (!StringUtil.isEmpty(value)) return value;
// prop
value = System.getProperty(name);
if (!StringUtil.isEmpty(value)) return value;
// env 2
name = convertSystemPropToEnvVar(name);
value = System.getenv(name);
if (!StringUtil.isEmpty(value)) return value;
return defaultValue;
} | java | public static String getSystemPropOrEnvVar(String name, String defaultValue) {
// env
String value = System.getenv(name);
if (!StringUtil.isEmpty(value)) return value;
// prop
value = System.getProperty(name);
if (!StringUtil.isEmpty(value)) return value;
// env 2
name = convertSystemPropToEnvVar(name);
value = System.getenv(name);
if (!StringUtil.isEmpty(value)) return value;
return defaultValue;
} | [
"public",
"static",
"String",
"getSystemPropOrEnvVar",
"(",
"String",
"name",
",",
"String",
"defaultValue",
")",
"{",
"// env",
"String",
"value",
"=",
"System",
".",
"getenv",
"(",
"name",
")",
";",
"if",
"(",
"!",
"StringUtil",
".",
"isEmpty",
"(",
"val... | returns a system setting by either a Java property name or a System environment variable
@param name - either a lowercased Java property name (e.g. lucee.controller.disabled) or an
UPPERCASED Environment variable name ((e.g. LUCEE_CONTROLLER_DISABLED))
@param defaultValue - value to return if the neither the property nor the environment setting was
found
@return - the value of the property referenced by propOrEnv or the defaultValue if not found | [
"returns",
"a",
"system",
"setting",
"by",
"either",
"a",
"Java",
"property",
"name",
"or",
"a",
"System",
"environment",
"variable"
] | 29b153fc4e126e5edb97da937f2ee2e231b87593 | https://github.com/lucee/Lucee/blob/29b153fc4e126e5edb97da937f2ee2e231b87593/core/src/main/java/lucee/commons/io/SystemUtil.java#L1165-L1180 |
30,696 | lucee/Lucee | core/src/main/java/lucee/commons/io/SystemUtil.java | SystemUtil.arePathsSame | public static boolean arePathsSame(String path1, String path2) {
if (StringUtil.isEmpty(path1, true) || StringUtil.isEmpty(path2, true)) return false;
String p1 = path1.replace('\\', '/');
String p2 = path2.replace('\\', '/');
if (p1.endsWith("/") && !p2.endsWith("/")) p2 = p2 + "/";
else if (p2.endsWith("/") && !p1.endsWith("/")) p1 = p1 + "/";
return p1.equalsIgnoreCase(p2);
} | java | public static boolean arePathsSame(String path1, String path2) {
if (StringUtil.isEmpty(path1, true) || StringUtil.isEmpty(path2, true)) return false;
String p1 = path1.replace('\\', '/');
String p2 = path2.replace('\\', '/');
if (p1.endsWith("/") && !p2.endsWith("/")) p2 = p2 + "/";
else if (p2.endsWith("/") && !p1.endsWith("/")) p1 = p1 + "/";
return p1.equalsIgnoreCase(p2);
} | [
"public",
"static",
"boolean",
"arePathsSame",
"(",
"String",
"path1",
",",
"String",
"path2",
")",
"{",
"if",
"(",
"StringUtil",
".",
"isEmpty",
"(",
"path1",
",",
"true",
")",
"||",
"StringUtil",
".",
"isEmpty",
"(",
"path2",
",",
"true",
")",
")",
"... | checks if both paths are the same ignoring CaSe, file separator type, and whether one path ends
with a separator while the other does not. if either path is empty then false is returned.
@param path1
@param path2
@return true if neither path is empty and the paths are the same ignoring case, separator, and
whether either path ends with a separator. | [
"checks",
"if",
"both",
"paths",
"are",
"the",
"same",
"ignoring",
"CaSe",
"file",
"separator",
"type",
"and",
"whether",
"one",
"path",
"ends",
"with",
"a",
"separator",
"while",
"the",
"other",
"does",
"not",
".",
"if",
"either",
"path",
"is",
"empty",
... | 29b153fc4e126e5edb97da937f2ee2e231b87593 | https://github.com/lucee/Lucee/blob/29b153fc4e126e5edb97da937f2ee2e231b87593/core/src/main/java/lucee/commons/io/SystemUtil.java#L1441-L1452 |
30,697 | lucee/Lucee | core/src/main/java/lucee/transformer/library/tag/TagLib.java | TagLib.getExprTransfomer | public ExprTransformer getExprTransfomer() throws TagLibException {
// Class cls;
if (exprTransformer != null) return exprTransformer;
try {
exprTransformer = (ExprTransformer) ClassUtil.loadInstance(ELClass.getClazz());
// exprTransformer = (ExprTransformer) cls.newInstance();
}
catch (Exception e) {
throw new TagLibException(e);
}
return exprTransformer;
} | java | public ExprTransformer getExprTransfomer() throws TagLibException {
// Class cls;
if (exprTransformer != null) return exprTransformer;
try {
exprTransformer = (ExprTransformer) ClassUtil.loadInstance(ELClass.getClazz());
// exprTransformer = (ExprTransformer) cls.newInstance();
}
catch (Exception e) {
throw new TagLibException(e);
}
return exprTransformer;
} | [
"public",
"ExprTransformer",
"getExprTransfomer",
"(",
")",
"throws",
"TagLibException",
"{",
"// Class cls;",
"if",
"(",
"exprTransformer",
"!=",
"null",
")",
"return",
"exprTransformer",
";",
"try",
"{",
"exprTransformer",
"=",
"(",
"ExprTransformer",
")",
"ClassU... | Laedt den innerhalb der TagLib definierten ExprTransfomer und gibt diesen zurueck. Load
Expression Transfomer defined in the tag library and return it.
@return ExprTransformer
@throws TagLibException | [
"Laedt",
"den",
"innerhalb",
"der",
"TagLib",
"definierten",
"ExprTransfomer",
"und",
"gibt",
"diesen",
"zurueck",
".",
"Load",
"Expression",
"Transfomer",
"defined",
"in",
"the",
"tag",
"library",
"and",
"return",
"it",
"."
] | 29b153fc4e126e5edb97da937f2ee2e231b87593 | https://github.com/lucee/Lucee/blob/29b153fc4e126e5edb97da937f2ee2e231b87593/core/src/main/java/lucee/transformer/library/tag/TagLib.java#L210-L222 |
30,698 | lucee/Lucee | core/src/main/java/lucee/transformer/library/tag/TagLib.java | TagLib.setTag | public void setTag(TagLibTag tag) {
tag.setTagLib(this);
tags.put(tag.getName(), tag);
if (tag.hasAppendix()) appendixTags.put(tag.getName(), tag);
else if (appendixTags.containsKey(tag.getName())) appendixTags.remove(tag.getName());
} | java | public void setTag(TagLibTag tag) {
tag.setTagLib(this);
tags.put(tag.getName(), tag);
if (tag.hasAppendix()) appendixTags.put(tag.getName(), tag);
else if (appendixTags.containsKey(tag.getName())) appendixTags.remove(tag.getName());
} | [
"public",
"void",
"setTag",
"(",
"TagLibTag",
"tag",
")",
"{",
"tag",
".",
"setTagLib",
"(",
"this",
")",
";",
"tags",
".",
"put",
"(",
"tag",
".",
"getName",
"(",
")",
",",
"tag",
")",
";",
"if",
"(",
"tag",
".",
"hasAppendix",
"(",
")",
")",
... | Fuegt der TagLib einen weiteren Tag hinzu. Diese Methode wird durch die Klasse TagLibFactory
verwendet.
@param tag Neuer Tag. | [
"Fuegt",
"der",
"TagLib",
"einen",
"weiteren",
"Tag",
"hinzu",
".",
"Diese",
"Methode",
"wird",
"durch",
"die",
"Klasse",
"TagLibFactory",
"verwendet",
"."
] | 29b153fc4e126e5edb97da937f2ee2e231b87593 | https://github.com/lucee/Lucee/blob/29b153fc4e126e5edb97da937f2ee2e231b87593/core/src/main/java/lucee/transformer/library/tag/TagLib.java#L230-L236 |
30,699 | lucee/Lucee | core/src/main/java/lucee/transformer/library/tag/TagLib.java | TagLib.setELClass | protected void setELClass(String eLClass, Identification id, Attributes attributes) {
this.ELClass = ClassDefinitionImpl.toClassDefinition(eLClass, id, attributes);
} | java | protected void setELClass(String eLClass, Identification id, Attributes attributes) {
this.ELClass = ClassDefinitionImpl.toClassDefinition(eLClass, id, attributes);
} | [
"protected",
"void",
"setELClass",
"(",
"String",
"eLClass",
",",
"Identification",
"id",
",",
"Attributes",
"attributes",
")",
"{",
"this",
".",
"ELClass",
"=",
"ClassDefinitionImpl",
".",
"toClassDefinition",
"(",
"eLClass",
",",
"id",
",",
"attributes",
")",
... | Fuegt der TagLib die Evaluator Klassendefinition als Zeichenkette hinzu. Diese Methode wird durch
die Klasse TagLibFactory verwendet.
@param eLClass Zeichenkette der Evaluator Klassendefinition. | [
"Fuegt",
"der",
"TagLib",
"die",
"Evaluator",
"Klassendefinition",
"als",
"Zeichenkette",
"hinzu",
".",
"Diese",
"Methode",
"wird",
"durch",
"die",
"Klasse",
"TagLibFactory",
"verwendet",
"."
] | 29b153fc4e126e5edb97da937f2ee2e231b87593 | https://github.com/lucee/Lucee/blob/29b153fc4e126e5edb97da937f2ee2e231b87593/core/src/main/java/lucee/transformer/library/tag/TagLib.java#L244-L246 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.