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,800 | lucee/Lucee | core/src/main/java/lucee/commons/lang/StringUtil.java | StringUtil.startsWith | public static boolean startsWith(String str, char prefix) {
return str != null && str.length() > 0 && str.charAt(0) == prefix;
} | java | public static boolean startsWith(String str, char prefix) {
return str != null && str.length() > 0 && str.charAt(0) == prefix;
} | [
"public",
"static",
"boolean",
"startsWith",
"(",
"String",
"str",
",",
"char",
"prefix",
")",
"{",
"return",
"str",
"!=",
"null",
"&&",
"str",
".",
"length",
"(",
")",
">",
"0",
"&&",
"str",
".",
"charAt",
"(",
"0",
")",
"==",
"prefix",
";",
"}"
] | Tests if this string starts with the specified prefix.
@param str string to check first char
@param prefix the prefix.
@return is first of given type | [
"Tests",
"if",
"this",
"string",
"starts",
"with",
"the",
"specified",
"prefix",
"."
] | 29b153fc4e126e5edb97da937f2ee2e231b87593 | https://github.com/lucee/Lucee/blob/29b153fc4e126e5edb97da937f2ee2e231b87593/core/src/main/java/lucee/commons/lang/StringUtil.java#L851-L853 |
30,801 | lucee/Lucee | core/src/main/java/lucee/commons/lang/StringUtil.java | StringUtil.endsWith | public static boolean endsWith(String str, char suffix) {
return str != null && str.length() > 0 && str.charAt(str.length() - 1) == suffix;
} | java | public static boolean endsWith(String str, char suffix) {
return str != null && str.length() > 0 && str.charAt(str.length() - 1) == suffix;
} | [
"public",
"static",
"boolean",
"endsWith",
"(",
"String",
"str",
",",
"char",
"suffix",
")",
"{",
"return",
"str",
"!=",
"null",
"&&",
"str",
".",
"length",
"(",
")",
">",
"0",
"&&",
"str",
".",
"charAt",
"(",
"str",
".",
"length",
"(",
")",
"-",
... | Tests if this string ends with the specified suffix.
@param str string to check first char
@param suffix the suffix.
@return is last of given type | [
"Tests",
"if",
"this",
"string",
"ends",
"with",
"the",
"specified",
"suffix",
"."
] | 29b153fc4e126e5edb97da937f2ee2e231b87593 | https://github.com/lucee/Lucee/blob/29b153fc4e126e5edb97da937f2ee2e231b87593/core/src/main/java/lucee/commons/lang/StringUtil.java#L866-L868 |
30,802 | lucee/Lucee | core/src/main/java/lucee/commons/lang/StringUtil.java | StringUtil.startsWithIgnoreCase | public static boolean startsWithIgnoreCase(final String base, final String start) {
if (base.length() < start.length()) {
return false;
}
return base.regionMatches(true, 0, start, 0, start.length());
} | java | public static boolean startsWithIgnoreCase(final String base, final String start) {
if (base.length() < start.length()) {
return false;
}
return base.regionMatches(true, 0, start, 0, start.length());
} | [
"public",
"static",
"boolean",
"startsWithIgnoreCase",
"(",
"final",
"String",
"base",
",",
"final",
"String",
"start",
")",
"{",
"if",
"(",
"base",
".",
"length",
"(",
")",
"<",
"start",
".",
"length",
"(",
")",
")",
"{",
"return",
"false",
";",
"}",
... | Helper functions to query a strings start portion. The comparison is case insensitive.
@param base the base string.
@param start the starting text.
@return true, if the string starts with the given starting text. | [
"Helper",
"functions",
"to",
"query",
"a",
"strings",
"start",
"portion",
".",
"The",
"comparison",
"is",
"case",
"insensitive",
"."
] | 29b153fc4e126e5edb97da937f2ee2e231b87593 | https://github.com/lucee/Lucee/blob/29b153fc4e126e5edb97da937f2ee2e231b87593/core/src/main/java/lucee/commons/lang/StringUtil.java#L889-L894 |
30,803 | lucee/Lucee | core/src/main/java/lucee/commons/lang/StringUtil.java | StringUtil.endsWithIgnoreCase | public static boolean endsWithIgnoreCase(final String base, final String end) {
if (base.length() < end.length()) {
return false;
}
return base.regionMatches(true, base.length() - end.length(), end, 0, end.length());
} | java | public static boolean endsWithIgnoreCase(final String base, final String end) {
if (base.length() < end.length()) {
return false;
}
return base.regionMatches(true, base.length() - end.length(), end, 0, end.length());
} | [
"public",
"static",
"boolean",
"endsWithIgnoreCase",
"(",
"final",
"String",
"base",
",",
"final",
"String",
"end",
")",
"{",
"if",
"(",
"base",
".",
"length",
"(",
")",
"<",
"end",
".",
"length",
"(",
")",
")",
"{",
"return",
"false",
";",
"}",
"ret... | Helper functions to query a strings end portion. The comparison is case insensitive.
@param base the base string.
@param end the ending text.
@return true, if the string ends with the given ending text. | [
"Helper",
"functions",
"to",
"query",
"a",
"strings",
"end",
"portion",
".",
"The",
"comparison",
"is",
"case",
"insensitive",
"."
] | 29b153fc4e126e5edb97da937f2ee2e231b87593 | https://github.com/lucee/Lucee/blob/29b153fc4e126e5edb97da937f2ee2e231b87593/core/src/main/java/lucee/commons/lang/StringUtil.java#L904-L909 |
30,804 | lucee/Lucee | core/src/main/java/lucee/commons/lang/StringUtil.java | StringUtil.toLowerCase | public static String toLowerCase(String str) {
int len = str.length();
char c;
for (int i = 0; i < len; i++) {
c = str.charAt(i);
if (!((c >= 'a' && c <= 'z') || (c >= '0' && c <= '9'))) {
return str.toLowerCase();
}
}
return str;
} | java | public static String toLowerCase(String str) {
int len = str.length();
char c;
for (int i = 0; i < len; i++) {
c = str.charAt(i);
if (!((c >= 'a' && c <= 'z') || (c >= '0' && c <= '9'))) {
return str.toLowerCase();
}
}
return str;
} | [
"public",
"static",
"String",
"toLowerCase",
"(",
"String",
"str",
")",
"{",
"int",
"len",
"=",
"str",
".",
"length",
"(",
")",
";",
"char",
"c",
";",
"for",
"(",
"int",
"i",
"=",
"0",
";",
"i",
"<",
"len",
";",
"i",
"++",
")",
"{",
"c",
"=",... | cast a string a lower case String, is faster than the String.toLowerCase, if all Character are
already Low Case
@param str
@return lower case value | [
"cast",
"a",
"string",
"a",
"lower",
"case",
"String",
"is",
"faster",
"than",
"the",
"String",
".",
"toLowerCase",
"if",
"all",
"Character",
"are",
"already",
"Low",
"Case"
] | 29b153fc4e126e5edb97da937f2ee2e231b87593 | https://github.com/lucee/Lucee/blob/29b153fc4e126e5edb97da937f2ee2e231b87593/core/src/main/java/lucee/commons/lang/StringUtil.java#L939-L950 |
30,805 | lucee/Lucee | core/src/main/java/lucee/commons/lang/StringUtil.java | StringUtil.lastChar | public static char lastChar(String str) {
if (str == null || str.length() == 0) return 0;
return str.charAt(str.length() - 1);
} | java | public static char lastChar(String str) {
if (str == null || str.length() == 0) return 0;
return str.charAt(str.length() - 1);
} | [
"public",
"static",
"char",
"lastChar",
"(",
"String",
"str",
")",
"{",
"if",
"(",
"str",
"==",
"null",
"||",
"str",
".",
"length",
"(",
")",
"==",
"0",
")",
"return",
"0",
";",
"return",
"str",
".",
"charAt",
"(",
"str",
".",
"length",
"(",
")",... | return the last character of a string, if string ist empty return 0;
@param str string to get last character
@return last character | [
"return",
"the",
"last",
"character",
"of",
"a",
"string",
"if",
"string",
"ist",
"empty",
"return",
"0",
";"
] | 29b153fc4e126e5edb97da937f2ee2e231b87593 | https://github.com/lucee/Lucee/blob/29b153fc4e126e5edb97da937f2ee2e231b87593/core/src/main/java/lucee/commons/lang/StringUtil.java#L981-L984 |
30,806 | lucee/Lucee | core/src/main/java/lucee/commons/lang/StringUtil.java | StringUtil.isAllAlpha | public static boolean isAllAlpha(String str) {
if (str == null) return false;
for (int i = str.length() - 1; i >= 0; i--) {
if (!Character.isLetter(str.charAt(i))) return false;
}
return true;
} | java | public static boolean isAllAlpha(String str) {
if (str == null) return false;
for (int i = str.length() - 1; i >= 0; i--) {
if (!Character.isLetter(str.charAt(i))) return false;
}
return true;
} | [
"public",
"static",
"boolean",
"isAllAlpha",
"(",
"String",
"str",
")",
"{",
"if",
"(",
"str",
"==",
"null",
")",
"return",
"false",
";",
"for",
"(",
"int",
"i",
"=",
"str",
".",
"length",
"(",
")",
"-",
"1",
";",
"i",
">=",
"0",
";",
"i",
"--"... | returns true if all characters in the string are letters
@param str
@return | [
"returns",
"true",
"if",
"all",
"characters",
"in",
"the",
"string",
"are",
"letters"
] | 29b153fc4e126e5edb97da937f2ee2e231b87593 | https://github.com/lucee/Lucee/blob/29b153fc4e126e5edb97da937f2ee2e231b87593/core/src/main/java/lucee/commons/lang/StringUtil.java#L1236-L1246 |
30,807 | lucee/Lucee | core/src/main/java/lucee/commons/lang/StringUtil.java | StringUtil.isAllUpperCase | public static boolean isAllUpperCase(String str) {
if (str == null) return false;
boolean hasLetters = false;
char c;
for (int i = str.length() - 1; i >= 0; i--) {
c = str.charAt(i);
if (Character.isLetter(c)) {
if (!Character.isUpperCase(c)) return false;
hasLetters = true;
}
}
return hasLetters;
} | java | public static boolean isAllUpperCase(String str) {
if (str == null) return false;
boolean hasLetters = false;
char c;
for (int i = str.length() - 1; i >= 0; i--) {
c = str.charAt(i);
if (Character.isLetter(c)) {
if (!Character.isUpperCase(c)) return false;
hasLetters = true;
}
}
return hasLetters;
} | [
"public",
"static",
"boolean",
"isAllUpperCase",
"(",
"String",
"str",
")",
"{",
"if",
"(",
"str",
"==",
"null",
")",
"return",
"false",
";",
"boolean",
"hasLetters",
"=",
"false",
";",
"char",
"c",
";",
"for",
"(",
"int",
"i",
"=",
"str",
".",
"leng... | returns true if the input string has letters and they are all UPPERCASE
@param str
@return | [
"returns",
"true",
"if",
"the",
"input",
"string",
"has",
"letters",
"and",
"they",
"are",
"all",
"UPPERCASE"
] | 29b153fc4e126e5edb97da937f2ee2e231b87593 | https://github.com/lucee/Lucee/blob/29b153fc4e126e5edb97da937f2ee2e231b87593/core/src/main/java/lucee/commons/lang/StringUtil.java#L1254-L1273 |
30,808 | lucee/Lucee | core/src/main/java/lucee/commons/lang/StringUtil.java | StringUtil.substring | public static String substring(String str, int off, int len) {
return str.substring(off, off + len);
} | java | public static String substring(String str, int off, int len) {
return str.substring(off, off + len);
} | [
"public",
"static",
"String",
"substring",
"(",
"String",
"str",
",",
"int",
"off",
",",
"int",
"len",
")",
"{",
"return",
"str",
".",
"substring",
"(",
"off",
",",
"off",
"+",
"len",
")",
";",
"}"
] | this method works different from the regular substring method, the regular substring method takes
startIndex and endIndex as second and third argument, this method takes offset and length
@param str
@param off
@param len
@return | [
"this",
"method",
"works",
"different",
"from",
"the",
"regular",
"substring",
"method",
"the",
"regular",
"substring",
"method",
"takes",
"startIndex",
"and",
"endIndex",
"as",
"second",
"and",
"third",
"argument",
"this",
"method",
"takes",
"offset",
"and",
"l... | 29b153fc4e126e5edb97da937f2ee2e231b87593 | https://github.com/lucee/Lucee/blob/29b153fc4e126e5edb97da937f2ee2e231b87593/core/src/main/java/lucee/commons/lang/StringUtil.java#L1292-L1294 |
30,809 | lucee/Lucee | core/src/main/java/lucee/runtime/tag/Video.java | Video.setNameconflict | public void setNameconflict(String nameconflict) throws PageException {
nameconflict = nameconflict.toLowerCase().trim();
if ("error".equals(nameconflict)) this.nameconflict = NAMECONFLICT_ERROR;
else if ("skip".equals(nameconflict)) this.nameconflict = NAMECONFLICT_SKIP;
else if ("overwrite".equals(nameconflict)) this.nameconflict = NAMECONFLICT_OVERWRITE;
else if ("makeunique".equals(nameconflict)) this.nameconflict = NAMECONFLICT_MAKEUNIQUE;
else throw doThrow("invalid value for attribute nameconflict [" + nameconflict + "]", "valid values are [error,skip,overwrite,makeunique]");
} | java | public void setNameconflict(String nameconflict) throws PageException {
nameconflict = nameconflict.toLowerCase().trim();
if ("error".equals(nameconflict)) this.nameconflict = NAMECONFLICT_ERROR;
else if ("skip".equals(nameconflict)) this.nameconflict = NAMECONFLICT_SKIP;
else if ("overwrite".equals(nameconflict)) this.nameconflict = NAMECONFLICT_OVERWRITE;
else if ("makeunique".equals(nameconflict)) this.nameconflict = NAMECONFLICT_MAKEUNIQUE;
else throw doThrow("invalid value for attribute nameconflict [" + nameconflict + "]", "valid values are [error,skip,overwrite,makeunique]");
} | [
"public",
"void",
"setNameconflict",
"(",
"String",
"nameconflict",
")",
"throws",
"PageException",
"{",
"nameconflict",
"=",
"nameconflict",
".",
"toLowerCase",
"(",
")",
".",
"trim",
"(",
")",
";",
"if",
"(",
"\"error\"",
".",
"equals",
"(",
"nameconflict",
... | set the value nameconflict Action to take if filename is the same as that of a file in the
directory.
@param nameconflict value to set
@throws ApplicationException | [
"set",
"the",
"value",
"nameconflict",
"Action",
"to",
"take",
"if",
"filename",
"is",
"the",
"same",
"as",
"that",
"of",
"a",
"file",
"in",
"the",
"directory",
"."
] | 29b153fc4e126e5edb97da937f2ee2e231b87593 | https://github.com/lucee/Lucee/blob/29b153fc4e126e5edb97da937f2ee2e231b87593/core/src/main/java/lucee/runtime/tag/Video.java#L221-L228 |
30,810 | lucee/Lucee | core/src/main/java/lucee/runtime/type/QueryColumnRef.java | QueryColumnRef.touch | public Object touch(int row) throws PageException {
Object o = query.getAt(columnName, row, NullSupportHelper.NULL());
if (o != NullSupportHelper.NULL()) return o;
return query.setAt(columnName, row, new StructImpl());
} | java | public Object touch(int row) throws PageException {
Object o = query.getAt(columnName, row, NullSupportHelper.NULL());
if (o != NullSupportHelper.NULL()) return o;
return query.setAt(columnName, row, new StructImpl());
} | [
"public",
"Object",
"touch",
"(",
"int",
"row",
")",
"throws",
"PageException",
"{",
"Object",
"o",
"=",
"query",
".",
"getAt",
"(",
"columnName",
",",
"row",
",",
"NullSupportHelper",
".",
"NULL",
"(",
")",
")",
";",
"if",
"(",
"o",
"!=",
"NullSupport... | touch a value, means if key dosent exist, it will created
@param row
@return matching value or created value
@throws PageException | [
"touch",
"a",
"value",
"means",
"if",
"key",
"dosent",
"exist",
"it",
"will",
"created"
] | 29b153fc4e126e5edb97da937f2ee2e231b87593 | https://github.com/lucee/Lucee/blob/29b153fc4e126e5edb97da937f2ee2e231b87593/core/src/main/java/lucee/runtime/type/QueryColumnRef.java#L88-L92 |
30,811 | lucee/Lucee | core/src/main/java/lucee/runtime/net/ipsettings/IPRangeCollection.java | IPRangeCollection.findFast | public IPRangeNode findFast(String addr) {
InetAddress iaddr;
try {
iaddr = InetAddress.getByName(addr);
}
catch (UnknownHostException ex) {
return null;
}
return findFast(iaddr);
} | java | public IPRangeNode findFast(String addr) {
InetAddress iaddr;
try {
iaddr = InetAddress.getByName(addr);
}
catch (UnknownHostException ex) {
return null;
}
return findFast(iaddr);
} | [
"public",
"IPRangeNode",
"findFast",
"(",
"String",
"addr",
")",
"{",
"InetAddress",
"iaddr",
";",
"try",
"{",
"iaddr",
"=",
"InetAddress",
".",
"getByName",
"(",
"addr",
")",
";",
"}",
"catch",
"(",
"UnknownHostException",
"ex",
")",
"{",
"return",
"null"... | performs a binary search over sorted list
@param addr
@return | [
"performs",
"a",
"binary",
"search",
"over",
"sorted",
"list"
] | 29b153fc4e126e5edb97da937f2ee2e231b87593 | https://github.com/lucee/Lucee/blob/29b153fc4e126e5edb97da937f2ee2e231b87593/core/src/main/java/lucee/runtime/net/ipsettings/IPRangeCollection.java#L138-L152 |
30,812 | lucee/Lucee | core/src/main/java/lucee/runtime/reflection/Invoker.java | Invoker.getConstructorParameterPairIgnoreCase | public static ConstructorParameterPair getConstructorParameterPairIgnoreCase(Class clazz, Object[] parameters) throws NoSuchMethodException {
// set all values
// Class objectClass=object.getClass();
if (parameters == null) parameters = new Object[0];
// set parameter classes
Class[] parameterClasses = new Class[parameters.length];
for (int i = 0; i < parameters.length; i++) {
parameterClasses[i] = parameters[i].getClass();
}
// search right method
Constructor[] constructor = clazz.getConstructors();
for (int mode = 0; mode < 2; mode++) {
outer: for (int i = 0; i < constructor.length; i++) {
Constructor c = constructor[i];
Class[] paramTrg = c.getParameterTypes();
// Same Parameter count
if (parameterClasses.length == paramTrg.length) {
for (int y = 0; y < parameterClasses.length; y++) {
if (mode == 0 && parameterClasses[y] != primitiveToWrapperType(paramTrg[y])) {
continue outer;
}
else if (mode == 1) {
Object o = compareClasses(parameters[y], paramTrg[y]);
if (o == null) continue outer;
parameters[y] = o;
parameterClasses[y] = o.getClass();
}
}
return new ConstructorParameterPair(c, parameters);
}
}
}
// Exeception
String parameter = "";
for (int i = 0; i < parameterClasses.length; i++) {
if (i != 0) parameter += ", ";
parameter += parameterClasses[i].getName();
}
throw new NoSuchMethodException("class constructor " + clazz.getName() + "(" + parameter + ") doesn't exist");
} | java | public static ConstructorParameterPair getConstructorParameterPairIgnoreCase(Class clazz, Object[] parameters) throws NoSuchMethodException {
// set all values
// Class objectClass=object.getClass();
if (parameters == null) parameters = new Object[0];
// set parameter classes
Class[] parameterClasses = new Class[parameters.length];
for (int i = 0; i < parameters.length; i++) {
parameterClasses[i] = parameters[i].getClass();
}
// search right method
Constructor[] constructor = clazz.getConstructors();
for (int mode = 0; mode < 2; mode++) {
outer: for (int i = 0; i < constructor.length; i++) {
Constructor c = constructor[i];
Class[] paramTrg = c.getParameterTypes();
// Same Parameter count
if (parameterClasses.length == paramTrg.length) {
for (int y = 0; y < parameterClasses.length; y++) {
if (mode == 0 && parameterClasses[y] != primitiveToWrapperType(paramTrg[y])) {
continue outer;
}
else if (mode == 1) {
Object o = compareClasses(parameters[y], paramTrg[y]);
if (o == null) continue outer;
parameters[y] = o;
parameterClasses[y] = o.getClass();
}
}
return new ConstructorParameterPair(c, parameters);
}
}
}
// Exeception
String parameter = "";
for (int i = 0; i < parameterClasses.length; i++) {
if (i != 0) parameter += ", ";
parameter += parameterClasses[i].getName();
}
throw new NoSuchMethodException("class constructor " + clazz.getName() + "(" + parameter + ") doesn't exist");
} | [
"public",
"static",
"ConstructorParameterPair",
"getConstructorParameterPairIgnoreCase",
"(",
"Class",
"clazz",
",",
"Object",
"[",
"]",
"parameters",
")",
"throws",
"NoSuchMethodException",
"{",
"// set all values",
"// Class objectClass=object.getClass();",
"if",
"(",
"para... | search the matching constructor to defined parameter list, also translate parameters for matching
@param clazz class to get constructo from
@param parameters parameter for the constructor
@return Constructor parameter pair
@throws NoSuchMethodException | [
"search",
"the",
"matching",
"constructor",
"to",
"defined",
"parameter",
"list",
"also",
"translate",
"parameters",
"for",
"matching"
] | 29b153fc4e126e5edb97da937f2ee2e231b87593 | https://github.com/lucee/Lucee/blob/29b153fc4e126e5edb97da937f2ee2e231b87593/core/src/main/java/lucee/runtime/reflection/Invoker.java#L65-L111 |
30,813 | lucee/Lucee | core/src/main/java/lucee/runtime/reflection/Invoker.java | Invoker.callMethod | public static Object callMethod(Object object, String methodName, Object[] parameters)
throws NoSuchMethodException, IllegalArgumentException, IllegalAccessException, InvocationTargetException {
MethodParameterPair pair = getMethodParameterPairIgnoreCase(object.getClass(), methodName, parameters);
return pair.getMethod().invoke(object, pair.getParameters());
} | java | public static Object callMethod(Object object, String methodName, Object[] parameters)
throws NoSuchMethodException, IllegalArgumentException, IllegalAccessException, InvocationTargetException {
MethodParameterPair pair = getMethodParameterPairIgnoreCase(object.getClass(), methodName, parameters);
return pair.getMethod().invoke(object, pair.getParameters());
} | [
"public",
"static",
"Object",
"callMethod",
"(",
"Object",
"object",
",",
"String",
"methodName",
",",
"Object",
"[",
"]",
"parameters",
")",
"throws",
"NoSuchMethodException",
",",
"IllegalArgumentException",
",",
"IllegalAccessException",
",",
"InvocationTargetExcepti... | call of a method from given object
@param object object to call method from
@param methodName name of the method to call
@param parameters parameter for method
@return return value of the method
@throws SecurityException
@throws NoSuchMethodException
@throws IllegalArgumentException
@throws IllegalAccessException
@throws InvocationTargetException | [
"call",
"of",
"a",
"method",
"from",
"given",
"object"
] | 29b153fc4e126e5edb97da937f2ee2e231b87593 | https://github.com/lucee/Lucee/blob/29b153fc4e126e5edb97da937f2ee2e231b87593/core/src/main/java/lucee/runtime/reflection/Invoker.java#L126-L131 |
30,814 | lucee/Lucee | core/src/main/java/lucee/runtime/reflection/Invoker.java | Invoker.getMethodParameterPairIgnoreCase | public static MethodParameterPair getMethodParameterPairIgnoreCase(Class objectClass, String methodName, Object[] parameters) throws NoSuchMethodException {
// set all values
if (parameters == null) parameters = new Object[0];
// set parameter classes
Class[] parameterClasses = new Class[parameters.length];
for (int i = 0; i < parameters.length; i++) {
parameterClasses[i] = parameters[i].getClass();
}
// search right method
Method[] methods = null;
if (lastClass != null && lastClass.equals(objectClass)) {
methods = lastMethods;
}
else {
methods = objectClass.getDeclaredMethods();
}
lastClass = objectClass;
lastMethods = methods;
// Method[] methods=objectClass.getMethods();
// Method[] methods=objectClass.getDeclaredMethods();
// methods=objectClass.getDeclaredMethods();
for (int mode = 0; mode < 2; mode++) {
outer: for (int i = 0; i < methods.length; i++) {
Method method = methods[i];
// Same Name
if (method.getName().equalsIgnoreCase(methodName)) {
Class[] paramTrg = method.getParameterTypes();
// Same Parameter count
if (parameterClasses.length == paramTrg.length) {
// if(parameterClasses.length==0)return m;
for (int y = 0; y < parameterClasses.length; y++) {
if (mode == 0 && parameterClasses[y] != primitiveToWrapperType(paramTrg[y])) {
continue outer;
}
else if (mode == 1) {
Object o = compareClasses(parameters[y], paramTrg[y]);
if (o == null) {
continue outer;
}
parameters[y] = o;
parameterClasses[y] = o.getClass();
}
// if(parameterClasses.length-1==y) return m;
}
return new MethodParameterPair(method, parameters);
}
}
}
}
// Exeception
String parameter = "";
for (int i = 0; i < parameterClasses.length; i++) {
if (i != 0) parameter += ", ";
parameter += parameterClasses[i].getName();
}
throw new NoSuchMethodException("method " + methodName + "(" + parameter + ") doesn't exist in class " + objectClass.getName());
} | java | public static MethodParameterPair getMethodParameterPairIgnoreCase(Class objectClass, String methodName, Object[] parameters) throws NoSuchMethodException {
// set all values
if (parameters == null) parameters = new Object[0];
// set parameter classes
Class[] parameterClasses = new Class[parameters.length];
for (int i = 0; i < parameters.length; i++) {
parameterClasses[i] = parameters[i].getClass();
}
// search right method
Method[] methods = null;
if (lastClass != null && lastClass.equals(objectClass)) {
methods = lastMethods;
}
else {
methods = objectClass.getDeclaredMethods();
}
lastClass = objectClass;
lastMethods = methods;
// Method[] methods=objectClass.getMethods();
// Method[] methods=objectClass.getDeclaredMethods();
// methods=objectClass.getDeclaredMethods();
for (int mode = 0; mode < 2; mode++) {
outer: for (int i = 0; i < methods.length; i++) {
Method method = methods[i];
// Same Name
if (method.getName().equalsIgnoreCase(methodName)) {
Class[] paramTrg = method.getParameterTypes();
// Same Parameter count
if (parameterClasses.length == paramTrg.length) {
// if(parameterClasses.length==0)return m;
for (int y = 0; y < parameterClasses.length; y++) {
if (mode == 0 && parameterClasses[y] != primitiveToWrapperType(paramTrg[y])) {
continue outer;
}
else if (mode == 1) {
Object o = compareClasses(parameters[y], paramTrg[y]);
if (o == null) {
continue outer;
}
parameters[y] = o;
parameterClasses[y] = o.getClass();
}
// if(parameterClasses.length-1==y) return m;
}
return new MethodParameterPair(method, parameters);
}
}
}
}
// Exeception
String parameter = "";
for (int i = 0; i < parameterClasses.length; i++) {
if (i != 0) parameter += ", ";
parameter += parameterClasses[i].getName();
}
throw new NoSuchMethodException("method " + methodName + "(" + parameter + ") doesn't exist in class " + objectClass.getName());
} | [
"public",
"static",
"MethodParameterPair",
"getMethodParameterPairIgnoreCase",
"(",
"Class",
"objectClass",
",",
"String",
"methodName",
",",
"Object",
"[",
"]",
"parameters",
")",
"throws",
"NoSuchMethodException",
"{",
"// set all values",
"if",
"(",
"parameters",
"==... | search the matching method to defined Method Name, also translate parameters for matching
@param objectClass class object where searching method from
@param methodName name of the method to search
@param parameters whished parameter list
@return pair with method matching and parameterlist matching
@throws NoSuchMethodException | [
"search",
"the",
"matching",
"method",
"to",
"defined",
"Method",
"Name",
"also",
"translate",
"parameters",
"for",
"matching"
] | 29b153fc4e126e5edb97da937f2ee2e231b87593 | https://github.com/lucee/Lucee/blob/29b153fc4e126e5edb97da937f2ee2e231b87593/core/src/main/java/lucee/runtime/reflection/Invoker.java#L142-L209 |
30,815 | lucee/Lucee | core/src/main/java/lucee/runtime/reflection/Invoker.java | Invoker.compareClasses | private static Object compareClasses(Object parameter, Class trgClass) {
Class srcClass = parameter.getClass();
trgClass = primitiveToWrapperType(trgClass);
try {
if (parameter instanceof ObjectWrap) parameter = ((ObjectWrap) parameter).getEmbededObject();
// parameter is already ok
if (srcClass == trgClass) return parameter;
else if (instaceOf(srcClass, trgClass)) {
return parameter;
}
else if (trgClass.getName().equals("java.lang.String")) {
return Caster.toString(parameter);
}
else if (trgClass.getName().equals("java.lang.Boolean")) {
return Caster.toBoolean(parameter);
}
else if (trgClass.getName().equals("java.lang.Byte")) {
return new Byte(Caster.toString(parameter));
}
else if (trgClass.getName().equals("java.lang.Character")) {
String str = Caster.toString(parameter);
if (str.length() == 1) return new Character(str.toCharArray()[0]);
return null;
}
else if (trgClass.getName().equals("java.lang.Short")) {
return Short.valueOf((short) Caster.toIntValue(parameter));
}
else if (trgClass.getName().equals("java.lang.Integer")) {
return Integer.valueOf(Caster.toIntValue(parameter));
}
else if (trgClass.getName().equals("java.lang.Long")) {
return Long.valueOf((long) Caster.toDoubleValue(parameter));
}
else if (trgClass.getName().equals("java.lang.Float")) {
return Float.valueOf((float) Caster.toDoubleValue(parameter));
}
else if (trgClass.getName().equals("java.lang.Double")) {
return Caster.toDouble(parameter);
}
}
catch (PageException e) {
return null;
}
return null;
} | java | private static Object compareClasses(Object parameter, Class trgClass) {
Class srcClass = parameter.getClass();
trgClass = primitiveToWrapperType(trgClass);
try {
if (parameter instanceof ObjectWrap) parameter = ((ObjectWrap) parameter).getEmbededObject();
// parameter is already ok
if (srcClass == trgClass) return parameter;
else if (instaceOf(srcClass, trgClass)) {
return parameter;
}
else if (trgClass.getName().equals("java.lang.String")) {
return Caster.toString(parameter);
}
else if (trgClass.getName().equals("java.lang.Boolean")) {
return Caster.toBoolean(parameter);
}
else if (trgClass.getName().equals("java.lang.Byte")) {
return new Byte(Caster.toString(parameter));
}
else if (trgClass.getName().equals("java.lang.Character")) {
String str = Caster.toString(parameter);
if (str.length() == 1) return new Character(str.toCharArray()[0]);
return null;
}
else if (trgClass.getName().equals("java.lang.Short")) {
return Short.valueOf((short) Caster.toIntValue(parameter));
}
else if (trgClass.getName().equals("java.lang.Integer")) {
return Integer.valueOf(Caster.toIntValue(parameter));
}
else if (trgClass.getName().equals("java.lang.Long")) {
return Long.valueOf((long) Caster.toDoubleValue(parameter));
}
else if (trgClass.getName().equals("java.lang.Float")) {
return Float.valueOf((float) Caster.toDoubleValue(parameter));
}
else if (trgClass.getName().equals("java.lang.Double")) {
return Caster.toDouble(parameter);
}
}
catch (PageException e) {
return null;
}
return null;
} | [
"private",
"static",
"Object",
"compareClasses",
"(",
"Object",
"parameter",
",",
"Class",
"trgClass",
")",
"{",
"Class",
"srcClass",
"=",
"parameter",
".",
"getClass",
"(",
")",
";",
"trgClass",
"=",
"primitiveToWrapperType",
"(",
"trgClass",
")",
";",
"try",... | compare parameter with whished parameter class and convert parameter to whished type
@param parameter parameter to compare
@param trgClass whished type of the parameter
@return converted parameter (to whished type) or null | [
"compare",
"parameter",
"with",
"whished",
"parameter",
"class",
"and",
"convert",
"parameter",
"to",
"whished",
"type"
] | 29b153fc4e126e5edb97da937f2ee2e231b87593 | https://github.com/lucee/Lucee/blob/29b153fc4e126e5edb97da937f2ee2e231b87593/core/src/main/java/lucee/runtime/reflection/Invoker.java#L218-L266 |
30,816 | lucee/Lucee | core/src/main/java/lucee/runtime/reflection/Invoker.java | Invoker.primitiveToWrapperType | private static Class primitiveToWrapperType(Class clazz) {
// boolean, byte, char, short, int, long, float, and double
if (clazz == null) return null;
else if (clazz.isPrimitive()) {
if (clazz.getName().equals("boolean")) return Boolean.class;
else if (clazz.getName().equals("byte")) return Byte.class;
else if (clazz.getName().equals("char")) return Character.class;
else if (clazz.getName().equals("short")) return Short.class;
else if (clazz.getName().equals("int")) return Integer.class;
else if (clazz.getName().equals("long")) return Long.class;
else if (clazz.getName().equals("float")) return Float.class;
else if (clazz.getName().equals("double")) return Double.class;
}
return clazz;
} | java | private static Class primitiveToWrapperType(Class clazz) {
// boolean, byte, char, short, int, long, float, and double
if (clazz == null) return null;
else if (clazz.isPrimitive()) {
if (clazz.getName().equals("boolean")) return Boolean.class;
else if (clazz.getName().equals("byte")) return Byte.class;
else if (clazz.getName().equals("char")) return Character.class;
else if (clazz.getName().equals("short")) return Short.class;
else if (clazz.getName().equals("int")) return Integer.class;
else if (clazz.getName().equals("long")) return Long.class;
else if (clazz.getName().equals("float")) return Float.class;
else if (clazz.getName().equals("double")) return Double.class;
}
return clazz;
} | [
"private",
"static",
"Class",
"primitiveToWrapperType",
"(",
"Class",
"clazz",
")",
"{",
"// boolean, byte, char, short, int, long, float, and double",
"if",
"(",
"clazz",
"==",
"null",
")",
"return",
"null",
";",
"else",
"if",
"(",
"clazz",
".",
"isPrimitive",
"(",... | cast a primitive type class definition to his object reference type
@param clazz class object to check and convert if it is of primitive type
@return object reference class object | [
"cast",
"a",
"primitive",
"type",
"class",
"definition",
"to",
"his",
"object",
"reference",
"type"
] | 29b153fc4e126e5edb97da937f2ee2e231b87593 | https://github.com/lucee/Lucee/blob/29b153fc4e126e5edb97da937f2ee2e231b87593/core/src/main/java/lucee/runtime/reflection/Invoker.java#L287-L301 |
30,817 | lucee/Lucee | core/src/main/java/lucee/runtime/reflection/Invoker.java | Invoker.getProperty | public static Object getProperty(Object o, String prop) throws NoSuchFieldException, IllegalArgumentException, IllegalAccessException {
Field f = getFieldIgnoreCase(o.getClass(), prop);
return f.get(o);
} | java | public static Object getProperty(Object o, String prop) throws NoSuchFieldException, IllegalArgumentException, IllegalAccessException {
Field f = getFieldIgnoreCase(o.getClass(), prop);
return f.get(o);
} | [
"public",
"static",
"Object",
"getProperty",
"(",
"Object",
"o",
",",
"String",
"prop",
")",
"throws",
"NoSuchFieldException",
",",
"IllegalArgumentException",
",",
"IllegalAccessException",
"{",
"Field",
"f",
"=",
"getFieldIgnoreCase",
"(",
"o",
".",
"getClass",
... | to get a visible Property of a object
@param o Object to invoke
@param prop property to call
@return property value
@throws NoSuchFieldException
@throws IllegalArgumentException
@throws IllegalAccessException | [
"to",
"get",
"a",
"visible",
"Property",
"of",
"a",
"object"
] | 29b153fc4e126e5edb97da937f2ee2e231b87593 | https://github.com/lucee/Lucee/blob/29b153fc4e126e5edb97da937f2ee2e231b87593/core/src/main/java/lucee/runtime/reflection/Invoker.java#L361-L364 |
30,818 | lucee/Lucee | core/src/main/java/lucee/runtime/reflection/Invoker.java | Invoker.setProperty | public static void setProperty(Object o, String prop, Object value) throws IllegalArgumentException, IllegalAccessException, NoSuchFieldException {
getFieldIgnoreCase(o.getClass(), prop).set(o, value);
} | java | public static void setProperty(Object o, String prop, Object value) throws IllegalArgumentException, IllegalAccessException, NoSuchFieldException {
getFieldIgnoreCase(o.getClass(), prop).set(o, value);
} | [
"public",
"static",
"void",
"setProperty",
"(",
"Object",
"o",
",",
"String",
"prop",
",",
"Object",
"value",
")",
"throws",
"IllegalArgumentException",
",",
"IllegalAccessException",
",",
"NoSuchFieldException",
"{",
"getFieldIgnoreCase",
"(",
"o",
".",
"getClass",... | assign a value to a visible property of a object
@param o Object to assign value to his property
@param prop name of property
@param value Value to assign
@throws IllegalArgumentException
@throws IllegalAccessException
@throws NoSuchFieldException | [
"assign",
"a",
"value",
"to",
"a",
"visible",
"property",
"of",
"a",
"object"
] | 29b153fc4e126e5edb97da937f2ee2e231b87593 | https://github.com/lucee/Lucee/blob/29b153fc4e126e5edb97da937f2ee2e231b87593/core/src/main/java/lucee/runtime/reflection/Invoker.java#L376-L378 |
30,819 | lucee/Lucee | core/src/main/java/lucee/runtime/reflection/Invoker.java | Invoker.callStaticMethod | public static Object callStaticMethod(Class staticClass, String methodName, Object[] values) throws PageException {
if (values == null) values = new Object[0];
MethodParameterPair mp;
try {
mp = getMethodParameterPairIgnoreCase(staticClass, methodName, values);
}
catch (NoSuchMethodException e) {
throw Caster.toPageException(e);
}
try {
return mp.getMethod().invoke(null, mp.getParameters());
}
catch (InvocationTargetException e) {
Throwable target = e.getTargetException();
if (target instanceof PageException) throw (PageException) target;
throw Caster.toPageException(e.getTargetException());
}
catch (Exception e) {
throw Caster.toPageException(e);
}
} | java | public static Object callStaticMethod(Class staticClass, String methodName, Object[] values) throws PageException {
if (values == null) values = new Object[0];
MethodParameterPair mp;
try {
mp = getMethodParameterPairIgnoreCase(staticClass, methodName, values);
}
catch (NoSuchMethodException e) {
throw Caster.toPageException(e);
}
try {
return mp.getMethod().invoke(null, mp.getParameters());
}
catch (InvocationTargetException e) {
Throwable target = e.getTargetException();
if (target instanceof PageException) throw (PageException) target;
throw Caster.toPageException(e.getTargetException());
}
catch (Exception e) {
throw Caster.toPageException(e);
}
} | [
"public",
"static",
"Object",
"callStaticMethod",
"(",
"Class",
"staticClass",
",",
"String",
"methodName",
",",
"Object",
"[",
"]",
"values",
")",
"throws",
"PageException",
"{",
"if",
"(",
"values",
"==",
"null",
")",
"values",
"=",
"new",
"Object",
"[",
... | call of a static method of a Class
@param staticClass class how contains method to invoke
@param methodName method name to invoke
@param values Arguments for the Method
@return return value from method
@throws PageException | [
"call",
"of",
"a",
"static",
"method",
"of",
"a",
"Class"
] | 29b153fc4e126e5edb97da937f2ee2e231b87593 | https://github.com/lucee/Lucee/blob/29b153fc4e126e5edb97da937f2ee2e231b87593/core/src/main/java/lucee/runtime/reflection/Invoker.java#L409-L431 |
30,820 | lucee/Lucee | core/src/main/java/lucee/runtime/CFMLFactoryImpl.java | CFMLFactoryImpl.resetPageContext | @Override
public void resetPageContext() {
SystemOut.printDate(config.getOutWriter(), "Reset " + pcs.size() + " Unused PageContexts");
pcs.clear();
Iterator<PageContextImpl> it = runningPcs.values().iterator();
while (it.hasNext()) {
it.next().reset();
}
} | java | @Override
public void resetPageContext() {
SystemOut.printDate(config.getOutWriter(), "Reset " + pcs.size() + " Unused PageContexts");
pcs.clear();
Iterator<PageContextImpl> it = runningPcs.values().iterator();
while (it.hasNext()) {
it.next().reset();
}
} | [
"@",
"Override",
"public",
"void",
"resetPageContext",
"(",
")",
"{",
"SystemOut",
".",
"printDate",
"(",
"config",
".",
"getOutWriter",
"(",
")",
",",
"\"Reset \"",
"+",
"pcs",
".",
"size",
"(",
")",
"+",
"\" Unused PageContexts\"",
")",
";",
"pcs",
".",
... | reset the PageContexes | [
"reset",
"the",
"PageContexes"
] | 29b153fc4e126e5edb97da937f2ee2e231b87593 | https://github.com/lucee/Lucee/blob/29b153fc4e126e5edb97da937f2ee2e231b87593/core/src/main/java/lucee/runtime/CFMLFactoryImpl.java#L110-L118 |
30,821 | lucee/Lucee | core/src/main/java/lucee/runtime/CFMLFactoryImpl.java | CFMLFactoryImpl.checkTimeout | @Override
public void checkTimeout() {
if (!engine.allowRequestTimeout()) return;
// print.e(MonitorState.checkForBlockedThreads(runningPcs.values()));
// print.e(MonitorState.checkForBlockedThreads(runningChildPcs.values()));
// synchronized (runningPcs) {
// int len=runningPcs.size();
// we only terminate child threads
Map<Integer, PageContextImpl> map = engine.exeRequestAsync() ? runningChildPcs : runningPcs;
{
Iterator<Entry<Integer, PageContextImpl>> it = map.entrySet().iterator();
PageContextImpl pc;
Entry<Integer, PageContextImpl> e;
while (it.hasNext()) {
e = it.next();
pc = e.getValue();
long timeout = pc.getRequestTimeout();
if (pc.getStartTime() + timeout < System.currentTimeMillis() && Long.MAX_VALUE != timeout) {
Log log = ((ConfigImpl) pc.getConfig()).getLog("requesttimeout");
if (log != null) {
log.log(Log.LEVEL_ERROR, "controller",
"stop " + (pc.getParentPageContext() == null ? "request" : "thread") + " (" + pc.getId() + ") because run into a timeout " + getPath(pc) + "."
+ MonitorState.getBlockedThreads(pc) + RequestTimeoutException.locks(pc) + "\n" + MonitorState.toString(pc.getThread().getStackTrace()));
}
terminate(pc, true);
runningPcs.remove(Integer.valueOf(pc.getId()));
it.remove();
}
// after 10 seconds downgrade priority of the thread
else if (pc.getStartTime() + 10000 < System.currentTimeMillis() && pc.getThread().getPriority() != Thread.MIN_PRIORITY) {
Log log = ((ConfigImpl) pc.getConfig()).getLog("requesttimeout");
if (log != null) {
log.log(Log.LEVEL_WARN, "controller", "downgrade priority of the a " + (pc.getParentPageContext() == null ? "request" : "thread") + " at " + getPath(pc)
+ ". " + MonitorState.getBlockedThreads(pc) + RequestTimeoutException.locks(pc) + "\n" + MonitorState.toString(pc.getThread().getStackTrace()));
}
try {
pc.getThread().setPriority(Thread.MIN_PRIORITY);
}
catch (Throwable t) {
ExceptionUtil.rethrowIfNecessary(t);
}
}
}
}
} | java | @Override
public void checkTimeout() {
if (!engine.allowRequestTimeout()) return;
// print.e(MonitorState.checkForBlockedThreads(runningPcs.values()));
// print.e(MonitorState.checkForBlockedThreads(runningChildPcs.values()));
// synchronized (runningPcs) {
// int len=runningPcs.size();
// we only terminate child threads
Map<Integer, PageContextImpl> map = engine.exeRequestAsync() ? runningChildPcs : runningPcs;
{
Iterator<Entry<Integer, PageContextImpl>> it = map.entrySet().iterator();
PageContextImpl pc;
Entry<Integer, PageContextImpl> e;
while (it.hasNext()) {
e = it.next();
pc = e.getValue();
long timeout = pc.getRequestTimeout();
if (pc.getStartTime() + timeout < System.currentTimeMillis() && Long.MAX_VALUE != timeout) {
Log log = ((ConfigImpl) pc.getConfig()).getLog("requesttimeout");
if (log != null) {
log.log(Log.LEVEL_ERROR, "controller",
"stop " + (pc.getParentPageContext() == null ? "request" : "thread") + " (" + pc.getId() + ") because run into a timeout " + getPath(pc) + "."
+ MonitorState.getBlockedThreads(pc) + RequestTimeoutException.locks(pc) + "\n" + MonitorState.toString(pc.getThread().getStackTrace()));
}
terminate(pc, true);
runningPcs.remove(Integer.valueOf(pc.getId()));
it.remove();
}
// after 10 seconds downgrade priority of the thread
else if (pc.getStartTime() + 10000 < System.currentTimeMillis() && pc.getThread().getPriority() != Thread.MIN_PRIORITY) {
Log log = ((ConfigImpl) pc.getConfig()).getLog("requesttimeout");
if (log != null) {
log.log(Log.LEVEL_WARN, "controller", "downgrade priority of the a " + (pc.getParentPageContext() == null ? "request" : "thread") + " at " + getPath(pc)
+ ". " + MonitorState.getBlockedThreads(pc) + RequestTimeoutException.locks(pc) + "\n" + MonitorState.toString(pc.getThread().getStackTrace()));
}
try {
pc.getThread().setPriority(Thread.MIN_PRIORITY);
}
catch (Throwable t) {
ExceptionUtil.rethrowIfNecessary(t);
}
}
}
}
} | [
"@",
"Override",
"public",
"void",
"checkTimeout",
"(",
")",
"{",
"if",
"(",
"!",
"engine",
".",
"allowRequestTimeout",
"(",
")",
")",
"return",
";",
"// print.e(MonitorState.checkForBlockedThreads(runningPcs.values()));",
"// print.e(MonitorState.checkForBlockedThreads(runni... | check timeout of all running threads, downgrade also priority from all thread run longer than 10
seconds | [
"check",
"timeout",
"of",
"all",
"running",
"threads",
"downgrade",
"also",
"priority",
"from",
"all",
"thread",
"run",
"longer",
"than",
"10",
"seconds"
] | 29b153fc4e126e5edb97da937f2ee2e231b87593 | https://github.com/lucee/Lucee/blob/29b153fc4e126e5edb97da937f2ee2e231b87593/core/src/main/java/lucee/runtime/CFMLFactoryImpl.java#L282-L331 |
30,822 | lucee/Lucee | loader/src/main/java/com/allaire/cfx/DebugResponse.java | DebugResponse.printResults | public void printResults() {
System.out.println("[ --- Lucee Debug Response --- ]");
System.out.println();
System.out.println("----------------------------");
System.out.println("| Output |");
System.out.println("----------------------------");
System.out.println(write);
System.out.println();
System.out.println("----------------------------");
System.out.println("| Debug Output |");
System.out.println("----------------------------");
System.out.println(writeDebug);
System.out.println();
System.out.println("----------------------------");
System.out.println("| Variables |");
System.out.println("----------------------------");
Enumeration e = variables.keys();
while (e.hasMoreElements()) {
final Object key = e.nextElement();
System.out.println("[Variable:" + key + "]");
System.out.println(escapeString(variables.get(key).toString()));
}
System.out.println();
e = queries.keys();
while (e.hasMoreElements()) {
final Query query = (Query) queries.get(e.nextElement());
printQuery(query);
System.out.println();
}
} | java | public void printResults() {
System.out.println("[ --- Lucee Debug Response --- ]");
System.out.println();
System.out.println("----------------------------");
System.out.println("| Output |");
System.out.println("----------------------------");
System.out.println(write);
System.out.println();
System.out.println("----------------------------");
System.out.println("| Debug Output |");
System.out.println("----------------------------");
System.out.println(writeDebug);
System.out.println();
System.out.println("----------------------------");
System.out.println("| Variables |");
System.out.println("----------------------------");
Enumeration e = variables.keys();
while (e.hasMoreElements()) {
final Object key = e.nextElement();
System.out.println("[Variable:" + key + "]");
System.out.println(escapeString(variables.get(key).toString()));
}
System.out.println();
e = queries.keys();
while (e.hasMoreElements()) {
final Query query = (Query) queries.get(e.nextElement());
printQuery(query);
System.out.println();
}
} | [
"public",
"void",
"printResults",
"(",
")",
"{",
"System",
".",
"out",
".",
"println",
"(",
"\"[ --- Lucee Debug Response --- ]\"",
")",
";",
"System",
".",
"out",
".",
"println",
"(",
")",
";",
"System",
".",
"out",
".",
"println",
"(",
"\"-----------------... | print out the response | [
"print",
"out",
"the",
"response"
] | 29b153fc4e126e5edb97da937f2ee2e231b87593 | https://github.com/lucee/Lucee/blob/29b153fc4e126e5edb97da937f2ee2e231b87593/loader/src/main/java/com/allaire/cfx/DebugResponse.java#L59-L94 |
30,823 | lucee/Lucee | loader/src/main/java/com/allaire/cfx/DebugResponse.java | DebugResponse.printQuery | public void printQuery(final Query query) {
if (query != null) {
final String[] cols = query.getColumns();
final int rows = query.getRowCount();
System.out.println("[Query:" + query.getName() + "]");
for (int i = 0; i < cols.length; i++) {
if (i > 0) System.out.print(", ");
System.out.print(cols[i]);
}
System.out.println();
for (int row = 1; row <= rows; row++) {
for (int col = 1; col <= cols.length; col++) {
if (col > 1) System.out.print(", ");
System.out.print(escapeString(query.getData(row, col)));
}
System.out.println();
}
}
} | java | public void printQuery(final Query query) {
if (query != null) {
final String[] cols = query.getColumns();
final int rows = query.getRowCount();
System.out.println("[Query:" + query.getName() + "]");
for (int i = 0; i < cols.length; i++) {
if (i > 0) System.out.print(", ");
System.out.print(cols[i]);
}
System.out.println();
for (int row = 1; row <= rows; row++) {
for (int col = 1; col <= cols.length; col++) {
if (col > 1) System.out.print(", ");
System.out.print(escapeString(query.getData(row, col)));
}
System.out.println();
}
}
} | [
"public",
"void",
"printQuery",
"(",
"final",
"Query",
"query",
")",
"{",
"if",
"(",
"query",
"!=",
"null",
")",
"{",
"final",
"String",
"[",
"]",
"cols",
"=",
"query",
".",
"getColumns",
"(",
")",
";",
"final",
"int",
"rows",
"=",
"query",
".",
"g... | print out a query
@param query query to print | [
"print",
"out",
"a",
"query"
] | 29b153fc4e126e5edb97da937f2ee2e231b87593 | https://github.com/lucee/Lucee/blob/29b153fc4e126e5edb97da937f2ee2e231b87593/loader/src/main/java/com/allaire/cfx/DebugResponse.java#L101-L120 |
30,824 | lucee/Lucee | core/src/main/java/lucee/runtime/tag/Module.java | Module.toRealPath | private static String[] toRealPath(Config config, String dotPath) throws ExpressionException {
dotPath = dotPath.trim();
while (dotPath.indexOf('.') == 0) {
dotPath = dotPath.substring(1);
}
int len = -1;
while ((len = dotPath.length()) > 0 && dotPath.lastIndexOf('.') == len - 1) {
dotPath = dotPath.substring(0, len - 2);
}
return CustomTagUtil.getFileNames(config, dotPath.replace('.', '/'));
} | java | private static String[] toRealPath(Config config, String dotPath) throws ExpressionException {
dotPath = dotPath.trim();
while (dotPath.indexOf('.') == 0) {
dotPath = dotPath.substring(1);
}
int len = -1;
while ((len = dotPath.length()) > 0 && dotPath.lastIndexOf('.') == len - 1) {
dotPath = dotPath.substring(0, len - 2);
}
return CustomTagUtil.getFileNames(config, dotPath.replace('.', '/'));
} | [
"private",
"static",
"String",
"[",
"]",
"toRealPath",
"(",
"Config",
"config",
",",
"String",
"dotPath",
")",
"throws",
"ExpressionException",
"{",
"dotPath",
"=",
"dotPath",
".",
"trim",
"(",
")",
";",
"while",
"(",
"dotPath",
".",
"indexOf",
"(",
"'",
... | translate a dot-notation path to a realpath
@param dotPath
@return realpath
@throws ExpressionException | [
"translate",
"a",
"dot",
"-",
"notation",
"path",
"to",
"a",
"realpath"
] | 29b153fc4e126e5edb97da937f2ee2e231b87593 | https://github.com/lucee/Lucee/blob/29b153fc4e126e5edb97da937f2ee2e231b87593/core/src/main/java/lucee/runtime/tag/Module.java#L130-L141 |
30,825 | lucee/Lucee | core/src/main/java/lucee/runtime/op/date/DateCaster.java | DateCaster.toDateTime | public static DateTime toDateTime(Locale locale, String str, TimeZone tz, boolean useCommomDateParserAsWell) throws PageException {
DateTime dt = toDateTime(locale, str, tz, null, useCommomDateParserAsWell);
if (dt == null) {
String prefix = locale.getLanguage() + "-" + locale.getCountry() + "-";
throw new ExpressionException("can't cast [" + str + "] to date value",
"to add custom formats for " + LocaleFactory.toString(locale) + ", create/extend on of the following files [" + prefix + "datetime.df (for date time formats), "
+ prefix + "date.df (for date formats) or " + prefix + "time.df (for time formats)] in the following directory [<context>/lucee/locales]." + "");
// throw new ExpressionException("can't cast ["+str+"] to date value");
}
return dt;
} | java | public static DateTime toDateTime(Locale locale, String str, TimeZone tz, boolean useCommomDateParserAsWell) throws PageException {
DateTime dt = toDateTime(locale, str, tz, null, useCommomDateParserAsWell);
if (dt == null) {
String prefix = locale.getLanguage() + "-" + locale.getCountry() + "-";
throw new ExpressionException("can't cast [" + str + "] to date value",
"to add custom formats for " + LocaleFactory.toString(locale) + ", create/extend on of the following files [" + prefix + "datetime.df (for date time formats), "
+ prefix + "date.df (for date formats) or " + prefix + "time.df (for time formats)] in the following directory [<context>/lucee/locales]." + "");
// throw new ExpressionException("can't cast ["+str+"] to date value");
}
return dt;
} | [
"public",
"static",
"DateTime",
"toDateTime",
"(",
"Locale",
"locale",
",",
"String",
"str",
",",
"TimeZone",
"tz",
",",
"boolean",
"useCommomDateParserAsWell",
")",
"throws",
"PageException",
"{",
"DateTime",
"dt",
"=",
"toDateTime",
"(",
"locale",
",",
"str",
... | parse a string to a Datetime Object
@param locale
@param str String representation of a locale Date
@param tz
@return DateTime Object
@throws PageException | [
"parse",
"a",
"string",
"to",
"a",
"Datetime",
"Object"
] | 29b153fc4e126e5edb97da937f2ee2e231b87593 | https://github.com/lucee/Lucee/blob/29b153fc4e126e5edb97da937f2ee2e231b87593/core/src/main/java/lucee/runtime/op/date/DateCaster.java#L186-L198 |
30,826 | lucee/Lucee | core/src/main/java/lucee/runtime/op/date/DateCaster.java | DateCaster.toDateTime | public static DateTime toDateTime(Locale locale, String str, TimeZone tz, DateTime defaultValue, boolean useCommomDateParserAsWell) {
str = str.trim();
tz = ThreadLocalPageContext.getTimeZone(tz);
DateFormat[] df;
// get Calendar
Calendar c = JREDateTimeUtil.getThreadCalendar(locale, tz);
// datetime
ParsePosition pp = new ParsePosition(0);
df = FormatUtil.getDateTimeFormats(locale, tz, false);// dfc[FORMATS_DATE_TIME];
Date d;
for (int i = 0; i < df.length; i++) {
SimpleDateFormat sdf = (SimpleDateFormat) df[i];
// print.e(sdf.format(new Date(108,3,6,1,2,1)) + " : "+sdf.toPattern());
pp.setErrorIndex(-1);
pp.setIndex(0);
sdf.setTimeZone(tz);
d = sdf.parse(str, pp);
if (pp.getIndex() == 0 || d == null || pp.getIndex() < str.length()) continue;
optimzeDate(c, tz, d);
return new DateTimeImpl(c.getTime());
}
// date
df = FormatUtil.getDateFormats(locale, tz, false);
for (int i = 0; i < df.length; i++) {
SimpleDateFormat sdf = (SimpleDateFormat) df[i];
// print.e(sdf.format(new Date(108,3,6,1,2,1)) + " : "+sdf.toPattern());
pp.setErrorIndex(-1);
pp.setIndex(0);
sdf.setTimeZone(tz);
d = sdf.parse(str, pp);
if (pp.getIndex() == 0 || d == null || pp.getIndex() < str.length()) continue;
optimzeDate(c, tz, d);
return new DateTimeImpl(c.getTime());
}
// time
df = FormatUtil.getTimeFormats(locale, tz, false);// dfc[FORMATS_TIME];
for (int i = 0; i < df.length; i++) {
SimpleDateFormat sdf = (SimpleDateFormat) df[i];
// print.e(sdf.format(new Date(108,3,6,1,2,1))+ " : "+sdf.toPattern());
pp.setErrorIndex(-1);
pp.setIndex(0);
sdf.setTimeZone(tz);
d = sdf.parse(str, pp);
if (pp.getIndex() == 0 || d == null || pp.getIndex() < str.length()) continue;
c.setTimeZone(tz);
c.setTime(d);
c.set(Calendar.YEAR, 1899);
c.set(Calendar.MONTH, 11);
c.set(Calendar.DAY_OF_MONTH, 30);
c.setTimeZone(tz);
return new DateTimeImpl(c.getTime());
}
if (useCommomDateParserAsWell) return DateCaster.toDateSimple(str, CONVERTING_TYPE_NONE, true, tz, defaultValue);
return defaultValue;
} | java | public static DateTime toDateTime(Locale locale, String str, TimeZone tz, DateTime defaultValue, boolean useCommomDateParserAsWell) {
str = str.trim();
tz = ThreadLocalPageContext.getTimeZone(tz);
DateFormat[] df;
// get Calendar
Calendar c = JREDateTimeUtil.getThreadCalendar(locale, tz);
// datetime
ParsePosition pp = new ParsePosition(0);
df = FormatUtil.getDateTimeFormats(locale, tz, false);// dfc[FORMATS_DATE_TIME];
Date d;
for (int i = 0; i < df.length; i++) {
SimpleDateFormat sdf = (SimpleDateFormat) df[i];
// print.e(sdf.format(new Date(108,3,6,1,2,1)) + " : "+sdf.toPattern());
pp.setErrorIndex(-1);
pp.setIndex(0);
sdf.setTimeZone(tz);
d = sdf.parse(str, pp);
if (pp.getIndex() == 0 || d == null || pp.getIndex() < str.length()) continue;
optimzeDate(c, tz, d);
return new DateTimeImpl(c.getTime());
}
// date
df = FormatUtil.getDateFormats(locale, tz, false);
for (int i = 0; i < df.length; i++) {
SimpleDateFormat sdf = (SimpleDateFormat) df[i];
// print.e(sdf.format(new Date(108,3,6,1,2,1)) + " : "+sdf.toPattern());
pp.setErrorIndex(-1);
pp.setIndex(0);
sdf.setTimeZone(tz);
d = sdf.parse(str, pp);
if (pp.getIndex() == 0 || d == null || pp.getIndex() < str.length()) continue;
optimzeDate(c, tz, d);
return new DateTimeImpl(c.getTime());
}
// time
df = FormatUtil.getTimeFormats(locale, tz, false);// dfc[FORMATS_TIME];
for (int i = 0; i < df.length; i++) {
SimpleDateFormat sdf = (SimpleDateFormat) df[i];
// print.e(sdf.format(new Date(108,3,6,1,2,1))+ " : "+sdf.toPattern());
pp.setErrorIndex(-1);
pp.setIndex(0);
sdf.setTimeZone(tz);
d = sdf.parse(str, pp);
if (pp.getIndex() == 0 || d == null || pp.getIndex() < str.length()) continue;
c.setTimeZone(tz);
c.setTime(d);
c.set(Calendar.YEAR, 1899);
c.set(Calendar.MONTH, 11);
c.set(Calendar.DAY_OF_MONTH, 30);
c.setTimeZone(tz);
return new DateTimeImpl(c.getTime());
}
if (useCommomDateParserAsWell) return DateCaster.toDateSimple(str, CONVERTING_TYPE_NONE, true, tz, defaultValue);
return defaultValue;
} | [
"public",
"static",
"DateTime",
"toDateTime",
"(",
"Locale",
"locale",
",",
"String",
"str",
",",
"TimeZone",
"tz",
",",
"DateTime",
"defaultValue",
",",
"boolean",
"useCommomDateParserAsWell",
")",
"{",
"str",
"=",
"str",
".",
"trim",
"(",
")",
";",
"tz",
... | parse a string to a Datetime Object, returns null if can't convert
@param locale
@param str String representation of a locale Date
@param tz
@param defaultValue
@return datetime object | [
"parse",
"a",
"string",
"to",
"a",
"Datetime",
"Object",
"returns",
"null",
"if",
"can",
"t",
"convert"
] | 29b153fc4e126e5edb97da937f2ee2e231b87593 | https://github.com/lucee/Lucee/blob/29b153fc4e126e5edb97da937f2ee2e231b87593/core/src/main/java/lucee/runtime/op/date/DateCaster.java#L229-L289 |
30,827 | lucee/Lucee | core/src/main/java/lucee/runtime/op/date/DateCaster.java | DateCaster.toTime | public static Time toTime(TimeZone timeZone, Object o) throws PageException {
if (o instanceof Time) return (Time) o;
else if (o instanceof Date) return new TimeImpl((Date) o);
else if (o instanceof Castable) return new TimeImpl(((Castable) o).castToDateTime());
else if (o instanceof String) {
Time dt = toTime(timeZone, o.toString(), null);
if (dt == null) throw new ExpressionException("can't cast [" + o + "] to time value");
return dt;
}
else if (o instanceof ObjectWrap) return toTime(timeZone, ((ObjectWrap) o).getEmbededObject());
else if (o instanceof Calendar) {
// TODO check timezone offset
return new TimeImpl(((Calendar) o).getTimeInMillis(), false);
}
throw new ExpressionException("can't cast [" + Caster.toClassName(o) + "] to time value");
} | java | public static Time toTime(TimeZone timeZone, Object o) throws PageException {
if (o instanceof Time) return (Time) o;
else if (o instanceof Date) return new TimeImpl((Date) o);
else if (o instanceof Castable) return new TimeImpl(((Castable) o).castToDateTime());
else if (o instanceof String) {
Time dt = toTime(timeZone, o.toString(), null);
if (dt == null) throw new ExpressionException("can't cast [" + o + "] to time value");
return dt;
}
else if (o instanceof ObjectWrap) return toTime(timeZone, ((ObjectWrap) o).getEmbededObject());
else if (o instanceof Calendar) {
// TODO check timezone offset
return new TimeImpl(((Calendar) o).getTimeInMillis(), false);
}
throw new ExpressionException("can't cast [" + Caster.toClassName(o) + "] to time value");
} | [
"public",
"static",
"Time",
"toTime",
"(",
"TimeZone",
"timeZone",
",",
"Object",
"o",
")",
"throws",
"PageException",
"{",
"if",
"(",
"o",
"instanceof",
"Time",
")",
"return",
"(",
"Time",
")",
"o",
";",
"else",
"if",
"(",
"o",
"instanceof",
"Date",
"... | converts a Object to a Time Object, returns null if invalid string
@param o Object to Convert
@return coverted Date Time Object
@throws PageException | [
"converts",
"a",
"Object",
"to",
"a",
"Time",
"Object",
"returns",
"null",
"if",
"invalid",
"string"
] | 29b153fc4e126e5edb97da937f2ee2e231b87593 | https://github.com/lucee/Lucee/blob/29b153fc4e126e5edb97da937f2ee2e231b87593/core/src/main/java/lucee/runtime/op/date/DateCaster.java#L436-L451 |
30,828 | lucee/Lucee | core/src/main/java/lucee/runtime/op/date/DateCaster.java | DateCaster.toTime | public static Time toTime(TimeZone timeZone, String str, Time defaultValue) {
if (str == null || str.length() < 3) {
return defaultValue;
}
DateString ds = new DateString(str);
// Timestamp
if (ds.isCurrent('{') && ds.isLast('}')) {
// Time
// "^\\{t '([0-9]{1,2}):([0-9]{1,2}):([0-9]{2})'\\}$"
if (ds.fwIfNext('t')) {
// Time
if (!(ds.fwIfNext(' ') && ds.fwIfNext('\''))) return defaultValue;
ds.next();
// hour
int hour = ds.readDigits();
if (hour == -1) return defaultValue;
if (!ds.fwIfCurrent(':')) return defaultValue;
// minute
int minute = ds.readDigits();
if (minute == -1) return defaultValue;
if (!ds.fwIfCurrent(':')) return defaultValue;
// second
int second = ds.readDigits();
if (second == -1) return defaultValue;
if (!(ds.fwIfCurrent('\'') && ds.fwIfCurrent('}'))) return defaultValue;
if (ds.isAfterLast()) {
long time = util.toTime(timeZone, 1899, 12, 30, hour, minute, second, 0, DEFAULT_VALUE);
if (time == DEFAULT_VALUE) return defaultValue;
return new TimeImpl(time, false);
}
return defaultValue;
}
return defaultValue;
}
// Time start with int
/*
* else if(ds.isDigit()) { char sec=ds.charAt(1); char third=ds.charAt(2); // 16.10.2004 (02:15)?
* if(sec==':' || third==':') { // hour int hour=ds.readDigits(); if(hour==-1) return defaultValue;
*
* if(!ds.fwIfCurrent(':'))return defaultValue;
*
* // minutes int minutes=ds.readDigits(); if(minutes==-1) return defaultValue;
*
* if(ds.isAfterLast()) { long time=util.toTime(timeZone,1899,12,30,hour,minutes,0,0,DEFAULT_VALUE);
* if(time==DEFAULT_VALUE) return defaultValue;
*
* return new TimeImpl(time,false); } //else if(!ds.fwIfCurrent(':'))return null; else
* if(!ds.fwIfCurrent(':')) { if(!ds.fwIfCurrent(' '))return defaultValue;
*
* if(ds.fwIfCurrent('a') || ds.fwIfCurrent('A')) { if(ds.fwIfCurrent('m') || ds.fwIfCurrent('M')) {
* if(ds.isAfterLast()) { long time=util.toTime(timeZone,1899,12,30,hour,minutes,0,0,DEFAULT_VALUE);
* if(time==DEFAULT_VALUE) return defaultValue; return new TimeImpl(time,false); } } return
* defaultValue; } else if(ds.fwIfCurrent('p') || ds.fwIfCurrent('P')) { if(ds.fwIfCurrent('m') ||
* ds.fwIfCurrent('M')) { if(ds.isAfterLast()) { long
* time=util.toTime(timeZone,1899,12,30,hour<13?hour+12:hour,minutes,0,0,DEFAULT_VALUE);
* if(time==DEFAULT_VALUE) return defaultValue; return new TimeImpl(time,false); } } return
* defaultValue; } return defaultValue; }
*
*
* // seconds int seconds=ds.readDigits(); if(seconds==-1) return defaultValue;
*
* if(ds.isAfterLast()) { long
* time=util.toTime(timeZone,1899,12,30,hour,minutes,seconds,0,DEFAULT_VALUE);
* if(time==DEFAULT_VALUE) return defaultValue; return new TimeImpl(time,false); }
*
* } }
*/
// TODO bessere impl
ds.reset();
DateTime rtn = parseTime(timeZone, new int[] { 1899, 12, 30 }, ds, defaultValue, -1);
if (rtn == defaultValue) return defaultValue;
return new TimeImpl(rtn);
// return defaultValue;
} | java | public static Time toTime(TimeZone timeZone, String str, Time defaultValue) {
if (str == null || str.length() < 3) {
return defaultValue;
}
DateString ds = new DateString(str);
// Timestamp
if (ds.isCurrent('{') && ds.isLast('}')) {
// Time
// "^\\{t '([0-9]{1,2}):([0-9]{1,2}):([0-9]{2})'\\}$"
if (ds.fwIfNext('t')) {
// Time
if (!(ds.fwIfNext(' ') && ds.fwIfNext('\''))) return defaultValue;
ds.next();
// hour
int hour = ds.readDigits();
if (hour == -1) return defaultValue;
if (!ds.fwIfCurrent(':')) return defaultValue;
// minute
int minute = ds.readDigits();
if (minute == -1) return defaultValue;
if (!ds.fwIfCurrent(':')) return defaultValue;
// second
int second = ds.readDigits();
if (second == -1) return defaultValue;
if (!(ds.fwIfCurrent('\'') && ds.fwIfCurrent('}'))) return defaultValue;
if (ds.isAfterLast()) {
long time = util.toTime(timeZone, 1899, 12, 30, hour, minute, second, 0, DEFAULT_VALUE);
if (time == DEFAULT_VALUE) return defaultValue;
return new TimeImpl(time, false);
}
return defaultValue;
}
return defaultValue;
}
// Time start with int
/*
* else if(ds.isDigit()) { char sec=ds.charAt(1); char third=ds.charAt(2); // 16.10.2004 (02:15)?
* if(sec==':' || third==':') { // hour int hour=ds.readDigits(); if(hour==-1) return defaultValue;
*
* if(!ds.fwIfCurrent(':'))return defaultValue;
*
* // minutes int minutes=ds.readDigits(); if(minutes==-1) return defaultValue;
*
* if(ds.isAfterLast()) { long time=util.toTime(timeZone,1899,12,30,hour,minutes,0,0,DEFAULT_VALUE);
* if(time==DEFAULT_VALUE) return defaultValue;
*
* return new TimeImpl(time,false); } //else if(!ds.fwIfCurrent(':'))return null; else
* if(!ds.fwIfCurrent(':')) { if(!ds.fwIfCurrent(' '))return defaultValue;
*
* if(ds.fwIfCurrent('a') || ds.fwIfCurrent('A')) { if(ds.fwIfCurrent('m') || ds.fwIfCurrent('M')) {
* if(ds.isAfterLast()) { long time=util.toTime(timeZone,1899,12,30,hour,minutes,0,0,DEFAULT_VALUE);
* if(time==DEFAULT_VALUE) return defaultValue; return new TimeImpl(time,false); } } return
* defaultValue; } else if(ds.fwIfCurrent('p') || ds.fwIfCurrent('P')) { if(ds.fwIfCurrent('m') ||
* ds.fwIfCurrent('M')) { if(ds.isAfterLast()) { long
* time=util.toTime(timeZone,1899,12,30,hour<13?hour+12:hour,minutes,0,0,DEFAULT_VALUE);
* if(time==DEFAULT_VALUE) return defaultValue; return new TimeImpl(time,false); } } return
* defaultValue; } return defaultValue; }
*
*
* // seconds int seconds=ds.readDigits(); if(seconds==-1) return defaultValue;
*
* if(ds.isAfterLast()) { long
* time=util.toTime(timeZone,1899,12,30,hour,minutes,seconds,0,DEFAULT_VALUE);
* if(time==DEFAULT_VALUE) return defaultValue; return new TimeImpl(time,false); }
*
* } }
*/
// TODO bessere impl
ds.reset();
DateTime rtn = parseTime(timeZone, new int[] { 1899, 12, 30 }, ds, defaultValue, -1);
if (rtn == defaultValue) return defaultValue;
return new TimeImpl(rtn);
// return defaultValue;
} | [
"public",
"static",
"Time",
"toTime",
"(",
"TimeZone",
"timeZone",
",",
"String",
"str",
",",
"Time",
"defaultValue",
")",
"{",
"if",
"(",
"str",
"==",
"null",
"||",
"str",
".",
"length",
"(",
")",
"<",
"3",
")",
"{",
"return",
"defaultValue",
";",
"... | converts a String to a Time Object, returns null if invalid string @param str String to
convert @param defaultValue @return Time Object @throws | [
"converts",
"a",
"String",
"to",
"a",
"Time",
"Object",
"returns",
"null",
"if",
"invalid",
"string"
] | 29b153fc4e126e5edb97da937f2ee2e231b87593 | https://github.com/lucee/Lucee/blob/29b153fc4e126e5edb97da937f2ee2e231b87593/core/src/main/java/lucee/runtime/op/date/DateCaster.java#L520-L605 |
30,829 | lucee/Lucee | core/src/main/java/lucee/runtime/op/date/DateCaster.java | DateCaster.parseDateTime | private static DateTime parseDateTime(String str, DateString ds, short convertingType, boolean alsoMonthString, TimeZone timeZone, DateTime defaultValue) {
int month = 0;
int first = ds.readDigits();
// first
if (first == -1) {
if (!alsoMonthString) return defaultValue;
first = ds.readMonthString();
if (first == -1) return defaultValue;
month = 1;
}
if (ds.isAfterLast()) return month == 1 ? defaultValue : numberToDate(timeZone, Caster.toDoubleValue(str, Double.NaN), convertingType, defaultValue);
char del = ds.current();
if (del != '.' && del != '/' && del != '-' && del != ' ' && del != '\t') {
if (ds.fwIfCurrent(':')) {
return parseTime(timeZone, new int[] { 1899, 12, 30 }, ds, defaultValue, first);
}
return defaultValue;
}
ds.next();
ds.removeWhitespace();
// second
int second = ds.readDigits();
if (second == -1) {
if (!alsoMonthString || month != 0) return defaultValue;
second = ds.readMonthString();
if (second == -1) return defaultValue;
month = 2;
}
if (ds.isAfterLast()) {
return toDate(month, timeZone, first, second, defaultValue);
}
char del2 = ds.current();
if (del != del2) {
ds.fwIfCurrent(' ');
ds.fwIfCurrent('T');
ds.fwIfCurrent(' ');
return parseTime(timeZone, _toDate(timeZone, month, first, second), ds, defaultValue, -1);
}
ds.next();
ds.removeWhitespace();
int third = ds.readDigits();
if (third == -1) {
return defaultValue;
}
if (ds.isAfterLast()) {
if (classicStyle() && del == '.') return toDate(month, timeZone, second, first, third, defaultValue);
return toDate(month, timeZone, first, second, third, defaultValue);
}
ds.fwIfCurrent(' ');
ds.fwIfCurrent('T');
ds.fwIfCurrent(' ');
if (classicStyle() && del == '.') return parseTime(timeZone, _toDate(month, second, first, third), ds, defaultValue, -1);
return parseTime(timeZone, _toDate(month, first, second, third), ds, defaultValue, -1);
} | java | private static DateTime parseDateTime(String str, DateString ds, short convertingType, boolean alsoMonthString, TimeZone timeZone, DateTime defaultValue) {
int month = 0;
int first = ds.readDigits();
// first
if (first == -1) {
if (!alsoMonthString) return defaultValue;
first = ds.readMonthString();
if (first == -1) return defaultValue;
month = 1;
}
if (ds.isAfterLast()) return month == 1 ? defaultValue : numberToDate(timeZone, Caster.toDoubleValue(str, Double.NaN), convertingType, defaultValue);
char del = ds.current();
if (del != '.' && del != '/' && del != '-' && del != ' ' && del != '\t') {
if (ds.fwIfCurrent(':')) {
return parseTime(timeZone, new int[] { 1899, 12, 30 }, ds, defaultValue, first);
}
return defaultValue;
}
ds.next();
ds.removeWhitespace();
// second
int second = ds.readDigits();
if (second == -1) {
if (!alsoMonthString || month != 0) return defaultValue;
second = ds.readMonthString();
if (second == -1) return defaultValue;
month = 2;
}
if (ds.isAfterLast()) {
return toDate(month, timeZone, first, second, defaultValue);
}
char del2 = ds.current();
if (del != del2) {
ds.fwIfCurrent(' ');
ds.fwIfCurrent('T');
ds.fwIfCurrent(' ');
return parseTime(timeZone, _toDate(timeZone, month, first, second), ds, defaultValue, -1);
}
ds.next();
ds.removeWhitespace();
int third = ds.readDigits();
if (third == -1) {
return defaultValue;
}
if (ds.isAfterLast()) {
if (classicStyle() && del == '.') return toDate(month, timeZone, second, first, third, defaultValue);
return toDate(month, timeZone, first, second, third, defaultValue);
}
ds.fwIfCurrent(' ');
ds.fwIfCurrent('T');
ds.fwIfCurrent(' ');
if (classicStyle() && del == '.') return parseTime(timeZone, _toDate(month, second, first, third), ds, defaultValue, -1);
return parseTime(timeZone, _toDate(month, first, second, third), ds, defaultValue, -1);
} | [
"private",
"static",
"DateTime",
"parseDateTime",
"(",
"String",
"str",
",",
"DateString",
"ds",
",",
"short",
"convertingType",
",",
"boolean",
"alsoMonthString",
",",
"TimeZone",
"timeZone",
",",
"DateTime",
"defaultValue",
")",
"{",
"int",
"month",
"=",
"0",
... | converts a String to a DateTime Object, returns null if invalid string
@param str String to convert
@param convertingType one of the following values: - CONVERTING_TYPE_NONE: number are not
converted at all - CONVERTING_TYPE_YEAR: integers are handled as years -
CONVERTING_TYPE_OFFSET: numbers are handled as offset from 1899-12-30 00:00:00 UTC
@param alsoMonthString allow that the month is a english name
@param timeZone
@param defaultValue
@return Date Time Object | [
"converts",
"a",
"String",
"to",
"a",
"DateTime",
"Object",
"returns",
"null",
"if",
"invalid",
"string"
] | 29b153fc4e126e5edb97da937f2ee2e231b87593 | https://github.com/lucee/Lucee/blob/29b153fc4e126e5edb97da937f2ee2e231b87593/core/src/main/java/lucee/runtime/op/date/DateCaster.java#L619-L680 |
30,830 | lucee/Lucee | core/src/main/java/lucee/runtime/op/date/DateCaster.java | DateCaster.readOffset | private static DateTime readOffset(boolean isPlus, TimeZone timeZone, DateTime dt, int years, int months, int days, int hours, int minutes, int seconds, int milliSeconds,
DateString ds, boolean checkAfterLast, DateTime defaultValue) {
// timeZone=ThreadLocalPageContext.getTimeZone(timeZone);
if (timeZone == null) return defaultValue;
// HOUR
int hourLength = ds.getPos();
int hour = ds.readDigits();
hourLength = ds.getPos() - hourLength;
if (hour == -1) return defaultValue;
// MINUTE
int minute = 0;
if (!ds.isAfterLast()) {
if (!(ds.fwIfCurrent(':') || ds.fwIfCurrent('.'))) return defaultValue;
minute = ds.readDigits();
if (minute == -1) return defaultValue;
}
else if (hourLength > 2) {
int h = hour / 100;
minute = hour - (h * 100);
hour = h;
}
if (minute > 59) return defaultValue;
if (hour > 14 || (hour == 14 && minute > 0)) return defaultValue;
long offset = hour * 60L * 60L * 1000L;
offset += minute * 60 * 1000;
if (!checkAfterLast || ds.isAfterLast()) {
long time = util.toTime(TimeZoneConstants.UTC, years, months, days, hours, minutes, seconds, milliSeconds, 0);
if (isPlus) time -= offset;
else time += offset;
return new DateTimeImpl(time, false);
}
return defaultValue;
} | java | private static DateTime readOffset(boolean isPlus, TimeZone timeZone, DateTime dt, int years, int months, int days, int hours, int minutes, int seconds, int milliSeconds,
DateString ds, boolean checkAfterLast, DateTime defaultValue) {
// timeZone=ThreadLocalPageContext.getTimeZone(timeZone);
if (timeZone == null) return defaultValue;
// HOUR
int hourLength = ds.getPos();
int hour = ds.readDigits();
hourLength = ds.getPos() - hourLength;
if (hour == -1) return defaultValue;
// MINUTE
int minute = 0;
if (!ds.isAfterLast()) {
if (!(ds.fwIfCurrent(':') || ds.fwIfCurrent('.'))) return defaultValue;
minute = ds.readDigits();
if (minute == -1) return defaultValue;
}
else if (hourLength > 2) {
int h = hour / 100;
minute = hour - (h * 100);
hour = h;
}
if (minute > 59) return defaultValue;
if (hour > 14 || (hour == 14 && minute > 0)) return defaultValue;
long offset = hour * 60L * 60L * 1000L;
offset += minute * 60 * 1000;
if (!checkAfterLast || ds.isAfterLast()) {
long time = util.toTime(TimeZoneConstants.UTC, years, months, days, hours, minutes, seconds, milliSeconds, 0);
if (isPlus) time -= offset;
else time += offset;
return new DateTimeImpl(time, false);
}
return defaultValue;
} | [
"private",
"static",
"DateTime",
"readOffset",
"(",
"boolean",
"isPlus",
",",
"TimeZone",
"timeZone",
",",
"DateTime",
"dt",
",",
"int",
"years",
",",
"int",
"months",
",",
"int",
"days",
",",
"int",
"hours",
",",
"int",
"minutes",
",",
"int",
"seconds",
... | reads a offset definition at the end of a date string
@param timeZone
@param dt previous parsed date Object
@param ds DateString to parse
@param defaultValue
@return date Object with offset | [
"reads",
"a",
"offset",
"definition",
"at",
"the",
"end",
"of",
"a",
"date",
"string"
] | 29b153fc4e126e5edb97da937f2ee2e231b87593 | https://github.com/lucee/Lucee/blob/29b153fc4e126e5edb97da937f2ee2e231b87593/core/src/main/java/lucee/runtime/op/date/DateCaster.java#L1018-L1056 |
30,831 | lucee/Lucee | core/src/main/java/lucee/runtime/writer/CFMLWriterWSPref.java | CFMLWriterWSPref.printBuffer | synchronized void printBuffer() throws IOException { // TODO: is synchronized really needed here?
int len = sb.length();
if (len > 0) {
char[] chars = new char[len];
sb.getChars(0, len, chars, 0);
sb.setLength(0);
super.write(chars, 0, chars.length);
}
} | java | synchronized void printBuffer() throws IOException { // TODO: is synchronized really needed here?
int len = sb.length();
if (len > 0) {
char[] chars = new char[len];
sb.getChars(0, len, chars, 0);
sb.setLength(0);
super.write(chars, 0, chars.length);
}
} | [
"synchronized",
"void",
"printBuffer",
"(",
")",
"throws",
"IOException",
"{",
"// TODO: is synchronized really needed here?",
"int",
"len",
"=",
"sb",
".",
"length",
"(",
")",
";",
"if",
"(",
"len",
">",
"0",
")",
"{",
"char",
"[",
"]",
"chars",
"=",
"new... | prints the characters from the buffer and resets it
TODO: make sure that printBuffer() is called at the end of the stream in case we have some
characters there! (flush() ?) | [
"prints",
"the",
"characters",
"from",
"the",
"buffer",
"and",
"resets",
"it"
] | 29b153fc4e126e5edb97da937f2ee2e231b87593 | https://github.com/lucee/Lucee/blob/29b153fc4e126e5edb97da937f2ee2e231b87593/core/src/main/java/lucee/runtime/writer/CFMLWriterWSPref.java#L79-L87 |
30,832 | lucee/Lucee | core/src/main/java/lucee/runtime/writer/CFMLWriterWSPref.java | CFMLWriterWSPref.addToBuffer | boolean addToBuffer(char c) throws IOException {
int len = sb.length();
if (len == 0 && c != CHAR_LT) return false; // buffer must starts with '<'
sb.append(c); // if we reached this point then we will return true
if (++len >= minTagLen) { // increment len as it was sampled before we appended c
boolean isClosingTag = (len >= 2 && sb.charAt(1) == CHAR_SL);
String substr;
if (isClosingTag) substr = sb.substring(2); // we know that the 1st two chars are "</"
else substr = sb.substring(1); // we know that the 1st char is "<"
for (int i = 0; i < EXCLUDE_TAGS.length; i++) { // loop thru list of WS-preserving tags
if (substr.equalsIgnoreCase(EXCLUDE_TAGS[i])) { // we have a match
if (isClosingTag) {
depthDec(i); // decrement the depth at i and calc depthSum
printBuffer();
lastChar = 0; // needed to allow WS after buffer was printed
}
else {
depthInc(i); // increment the depth at i and calc depthSum
}
}
}
}
return true;
} | java | boolean addToBuffer(char c) throws IOException {
int len = sb.length();
if (len == 0 && c != CHAR_LT) return false; // buffer must starts with '<'
sb.append(c); // if we reached this point then we will return true
if (++len >= minTagLen) { // increment len as it was sampled before we appended c
boolean isClosingTag = (len >= 2 && sb.charAt(1) == CHAR_SL);
String substr;
if (isClosingTag) substr = sb.substring(2); // we know that the 1st two chars are "</"
else substr = sb.substring(1); // we know that the 1st char is "<"
for (int i = 0; i < EXCLUDE_TAGS.length; i++) { // loop thru list of WS-preserving tags
if (substr.equalsIgnoreCase(EXCLUDE_TAGS[i])) { // we have a match
if (isClosingTag) {
depthDec(i); // decrement the depth at i and calc depthSum
printBuffer();
lastChar = 0; // needed to allow WS after buffer was printed
}
else {
depthInc(i); // increment the depth at i and calc depthSum
}
}
}
}
return true;
} | [
"boolean",
"addToBuffer",
"(",
"char",
"c",
")",
"throws",
"IOException",
"{",
"int",
"len",
"=",
"sb",
".",
"length",
"(",
")",
";",
"if",
"(",
"len",
"==",
"0",
"&&",
"c",
"!=",
"CHAR_LT",
")",
"return",
"false",
";",
"// buffer must starts with '<'",
... | checks if a character is part of an open html tag or close html tag, and if so adds it to the
buffer, otherwise returns false.
@param c
@return true if the char was added to the buffer, false otherwise | [
"checks",
"if",
"a",
"character",
"is",
"part",
"of",
"an",
"open",
"html",
"tag",
"or",
"close",
"html",
"tag",
"and",
"if",
"so",
"adds",
"it",
"to",
"the",
"buffer",
"otherwise",
"returns",
"false",
"."
] | 29b153fc4e126e5edb97da937f2ee2e231b87593 | https://github.com/lucee/Lucee/blob/29b153fc4e126e5edb97da937f2ee2e231b87593/core/src/main/java/lucee/runtime/writer/CFMLWriterWSPref.java#L105-L129 |
30,833 | lucee/Lucee | core/src/main/java/lucee/runtime/writer/CFMLWriterWSPref.java | CFMLWriterWSPref.print | @Override
public void print(char c) throws IOException {
boolean isWS = Character.isWhitespace(c);
if (isWS) {
if (isFirstChar) // ignore all WS before non-WS content
return;
if (c == CHAR_RETURN) // ignore Carriage-Return chars
return;
if (sb.length() > 0) {
printBuffer(); // buffer should never contain WS so flush it
lastChar = (c == CHAR_NL) ? CHAR_NL : c;
super.print(lastChar);
return;
}
}
isFirstChar = false;
if (c == CHAR_GT && sb.length() > 0) printBuffer(); // buffer should never contain ">" so flush it
if (isWS || !addToBuffer(c)) {
if (depthSum == 0) { // we're not in a WS-preserving tag; suppress whitespace
if (isWS) { // this char is WS
if (lastChar == CHAR_NL) // lastChar was NL; discard this WS char
return;
if (c != CHAR_NL) { // this WS char is not NL
if (Character.isWhitespace(lastChar)) return; // lastChar was WS but Not NL; discard this WS char
}
}
}
lastChar = c; // remember c as lastChar and write it to output stream
super.print(c);
}
} | java | @Override
public void print(char c) throws IOException {
boolean isWS = Character.isWhitespace(c);
if (isWS) {
if (isFirstChar) // ignore all WS before non-WS content
return;
if (c == CHAR_RETURN) // ignore Carriage-Return chars
return;
if (sb.length() > 0) {
printBuffer(); // buffer should never contain WS so flush it
lastChar = (c == CHAR_NL) ? CHAR_NL : c;
super.print(lastChar);
return;
}
}
isFirstChar = false;
if (c == CHAR_GT && sb.length() > 0) printBuffer(); // buffer should never contain ">" so flush it
if (isWS || !addToBuffer(c)) {
if (depthSum == 0) { // we're not in a WS-preserving tag; suppress whitespace
if (isWS) { // this char is WS
if (lastChar == CHAR_NL) // lastChar was NL; discard this WS char
return;
if (c != CHAR_NL) { // this WS char is not NL
if (Character.isWhitespace(lastChar)) return; // lastChar was WS but Not NL; discard this WS char
}
}
}
lastChar = c; // remember c as lastChar and write it to output stream
super.print(c);
}
} | [
"@",
"Override",
"public",
"void",
"print",
"(",
"char",
"c",
")",
"throws",
"IOException",
"{",
"boolean",
"isWS",
"=",
"Character",
".",
"isWhitespace",
"(",
"c",
")",
";",
"if",
"(",
"isWS",
")",
"{",
"if",
"(",
"isFirstChar",
")",
"// ignore all WS b... | sends a character to output stream if it is not a consecutive white-space unless we're inside a
PRE or TEXTAREA tag.
@param c
@throws IOException | [
"sends",
"a",
"character",
"to",
"output",
"stream",
"if",
"it",
"is",
"not",
"a",
"consecutive",
"white",
"-",
"space",
"unless",
"we",
"re",
"inside",
"a",
"PRE",
"or",
"TEXTAREA",
"tag",
"."
] | 29b153fc4e126e5edb97da937f2ee2e231b87593 | https://github.com/lucee/Lucee/blob/29b153fc4e126e5edb97da937f2ee2e231b87593/core/src/main/java/lucee/runtime/writer/CFMLWriterWSPref.java#L168-L200 |
30,834 | lucee/Lucee | core/src/main/java/lucee/runtime/net/mail/HtmlEmailImpl.java | HtmlEmailImpl.setTextMsg | public HtmlEmailImpl setTextMsg(String aText) throws EmailException {
if (StringUtil.isEmpty(aText)) {
throw new EmailException("Invalid message supplied");
}
this.text = aText;
return this;
} | java | public HtmlEmailImpl setTextMsg(String aText) throws EmailException {
if (StringUtil.isEmpty(aText)) {
throw new EmailException("Invalid message supplied");
}
this.text = aText;
return this;
} | [
"public",
"HtmlEmailImpl",
"setTextMsg",
"(",
"String",
"aText",
")",
"throws",
"EmailException",
"{",
"if",
"(",
"StringUtil",
".",
"isEmpty",
"(",
"aText",
")",
")",
"{",
"throw",
"new",
"EmailException",
"(",
"\"Invalid message supplied\"",
")",
";",
"}",
"... | Set the text content.
@param aText A String.
@return An HtmlEmail.
@throws EmailException see javax.mail.internet.MimeBodyPart for definitions | [
"Set",
"the",
"text",
"content",
"."
] | 29b153fc4e126e5edb97da937f2ee2e231b87593 | https://github.com/lucee/Lucee/blob/29b153fc4e126e5edb97da937f2ee2e231b87593/core/src/main/java/lucee/runtime/net/mail/HtmlEmailImpl.java#L86-L92 |
30,835 | lucee/Lucee | core/src/main/java/lucee/runtime/net/mail/HtmlEmailImpl.java | HtmlEmailImpl.setHtmlMsg | public HtmlEmailImpl setHtmlMsg(String aHtml) throws EmailException {
if (StringUtil.isEmpty(aHtml)) {
throw new EmailException("Invalid message supplied");
}
this.html = aHtml;
return this;
} | java | public HtmlEmailImpl setHtmlMsg(String aHtml) throws EmailException {
if (StringUtil.isEmpty(aHtml)) {
throw new EmailException("Invalid message supplied");
}
this.html = aHtml;
return this;
} | [
"public",
"HtmlEmailImpl",
"setHtmlMsg",
"(",
"String",
"aHtml",
")",
"throws",
"EmailException",
"{",
"if",
"(",
"StringUtil",
".",
"isEmpty",
"(",
"aHtml",
")",
")",
"{",
"throw",
"new",
"EmailException",
"(",
"\"Invalid message supplied\"",
")",
";",
"}",
"... | Set the HTML content.
@param aHtml A String.
@return An HtmlEmail.
@throws EmailException see javax.mail.internet.MimeBodyPart for definitions | [
"Set",
"the",
"HTML",
"content",
"."
] | 29b153fc4e126e5edb97da937f2ee2e231b87593 | https://github.com/lucee/Lucee/blob/29b153fc4e126e5edb97da937f2ee2e231b87593/core/src/main/java/lucee/runtime/net/mail/HtmlEmailImpl.java#L102-L108 |
30,836 | lucee/Lucee | core/src/main/java/lucee/runtime/net/mail/HtmlEmailImpl.java | HtmlEmailImpl.embed | public void embed(URL url, String cid, String name) throws EmailException {
// verify that the URL is valid
try {
InputStream is = url.openStream();
is.close();
}
catch (IOException e) {
throw new EmailException("Invalid URL");
}
MimeBodyPart mbp = new MimeBodyPart();
try {
mbp.setDataHandler(new DataHandler(new URLDataSource(url)));
mbp.setFileName(name);
mbp.setDisposition("inline");
mbp.addHeader("Content-ID", "<" + cid + ">");
this.inlineImages.add(mbp);
}
catch (MessagingException me) {
throw new EmailException(me);
}
} | java | public void embed(URL url, String cid, String name) throws EmailException {
// verify that the URL is valid
try {
InputStream is = url.openStream();
is.close();
}
catch (IOException e) {
throw new EmailException("Invalid URL");
}
MimeBodyPart mbp = new MimeBodyPart();
try {
mbp.setDataHandler(new DataHandler(new URLDataSource(url)));
mbp.setFileName(name);
mbp.setDisposition("inline");
mbp.addHeader("Content-ID", "<" + cid + ">");
this.inlineImages.add(mbp);
}
catch (MessagingException me) {
throw new EmailException(me);
}
} | [
"public",
"void",
"embed",
"(",
"URL",
"url",
",",
"String",
"cid",
",",
"String",
"name",
")",
"throws",
"EmailException",
"{",
"// verify that the URL is valid",
"try",
"{",
"InputStream",
"is",
"=",
"url",
".",
"openStream",
"(",
")",
";",
"is",
".",
"c... | Embeds an URL in the HTML.
<p>
This method allows to embed a file located by an URL into the mail body. It allows, for instance,
to add inline images to the email. Inline files may be referenced with a <code>cid:xxxxxx</code>
URL, where xxxxxx is the Content-ID returned by the embed function.
<p>
Example of use:<br>
<code><pre>
HtmlEmail he = new HtmlEmail();
he.setHtmlMsg("<html><img src=cid:" +
embed("file:/my/image.gif","image.gif") +
"></html>");
// code to set the others email fields (not shown)
</pre></code>
@param url The URL of the file.
@param cid A String with the Content-ID of the file.
@param name The name that will be set in the filename header field.
@throws EmailException when URL supplied is invalid also see javax.mail.internet.MimeBodyPart for
definitions | [
"Embeds",
"an",
"URL",
"in",
"the",
"HTML",
"."
] | 29b153fc4e126e5edb97da937f2ee2e231b87593 | https://github.com/lucee/Lucee/blob/29b153fc4e126e5edb97da937f2ee2e231b87593/core/src/main/java/lucee/runtime/net/mail/HtmlEmailImpl.java#L161-L183 |
30,837 | lucee/Lucee | core/src/main/java/lucee/runtime/net/mail/HtmlEmailImpl.java | HtmlEmailImpl.buildMimeMessage | @Override
public void buildMimeMessage() throws EmailException {
try {
// if the email has attachments then the base type is mixed,
// otherwise it should be related
if (this.isBoolHasAttachments()) {
this.buildAttachments();
}
else {
this.buildNoAttachments();
}
}
catch (MessagingException me) {
throw new EmailException(me);
}
super.buildMimeMessage();
} | java | @Override
public void buildMimeMessage() throws EmailException {
try {
// if the email has attachments then the base type is mixed,
// otherwise it should be related
if (this.isBoolHasAttachments()) {
this.buildAttachments();
}
else {
this.buildNoAttachments();
}
}
catch (MessagingException me) {
throw new EmailException(me);
}
super.buildMimeMessage();
} | [
"@",
"Override",
"public",
"void",
"buildMimeMessage",
"(",
")",
"throws",
"EmailException",
"{",
"try",
"{",
"// if the email has attachments then the base type is mixed,",
"// otherwise it should be related",
"if",
"(",
"this",
".",
"isBoolHasAttachments",
"(",
")",
")",
... | Does the work of actually building the email.
@exception EmailException if there was an error. | [
"Does",
"the",
"work",
"of",
"actually",
"building",
"the",
"email",
"."
] | 29b153fc4e126e5edb97da937f2ee2e231b87593 | https://github.com/lucee/Lucee/blob/29b153fc4e126e5edb97da937f2ee2e231b87593/core/src/main/java/lucee/runtime/net/mail/HtmlEmailImpl.java#L191-L208 |
30,838 | lucee/Lucee | core/src/main/java/lucee/runtime/net/ipsettings/IPSettings.java | IPSettings.put | public synchronized void put(IPRangeNode<Map> ipr, boolean doCheck) {
IPRangeNode parent = ipr.isV4() ? ipv4 : ipv6;
parent.addChild(ipr, doCheck);
version++;
isSorted = false;
} | java | public synchronized void put(IPRangeNode<Map> ipr, boolean doCheck) {
IPRangeNode parent = ipr.isV4() ? ipv4 : ipv6;
parent.addChild(ipr, doCheck);
version++;
isSorted = false;
} | [
"public",
"synchronized",
"void",
"put",
"(",
"IPRangeNode",
"<",
"Map",
">",
"ipr",
",",
"boolean",
"doCheck",
")",
"{",
"IPRangeNode",
"parent",
"=",
"ipr",
".",
"isV4",
"(",
")",
"?",
"ipv4",
":",
"ipv6",
";",
"parent",
".",
"addChild",
"(",
"ipr",
... | all added data should go through this method
@param ipr
@param doCheck | [
"all",
"added",
"data",
"should",
"go",
"through",
"this",
"method"
] | 29b153fc4e126e5edb97da937f2ee2e231b87593 | https://github.com/lucee/Lucee/blob/29b153fc4e126e5edb97da937f2ee2e231b87593/core/src/main/java/lucee/runtime/net/ipsettings/IPSettings.java#L64-L69 |
30,839 | lucee/Lucee | core/src/main/java/lucee/runtime/net/ipsettings/IPSettings.java | IPSettings.get | public IPRangeNode get(InetAddress addr) {
if (version == 0) // no data was added
return null;
IPRangeNode node = isV4(addr) ? ipv4 : ipv6;
if (!this.isSorted) this.optimize();
return node.findFast(addr);
} | java | public IPRangeNode get(InetAddress addr) {
if (version == 0) // no data was added
return null;
IPRangeNode node = isV4(addr) ? ipv4 : ipv6;
if (!this.isSorted) this.optimize();
return node.findFast(addr);
} | [
"public",
"IPRangeNode",
"get",
"(",
"InetAddress",
"addr",
")",
"{",
"if",
"(",
"version",
"==",
"0",
")",
"// no data was added",
"return",
"null",
";",
"IPRangeNode",
"node",
"=",
"isV4",
"(",
"addr",
")",
"?",
"ipv4",
":",
"ipv6",
";",
"if",
"(",
"... | returns a single, best matching node for the given address
@param addr
@return | [
"returns",
"a",
"single",
"best",
"matching",
"node",
"for",
"the",
"given",
"address"
] | 29b153fc4e126e5edb97da937f2ee2e231b87593 | https://github.com/lucee/Lucee/blob/29b153fc4e126e5edb97da937f2ee2e231b87593/core/src/main/java/lucee/runtime/net/ipsettings/IPSettings.java#L120-L130 |
30,840 | lucee/Lucee | core/src/main/java/lucee/runtime/ComponentProperties.java | ComponentProperties.getWsdlFile | public String getWsdlFile() {
if (meta == null) return null;
return (String) meta.get(WSDL_FILE, null);
} | java | public String getWsdlFile() {
if (meta == null) return null;
return (String) meta.get(WSDL_FILE, null);
} | [
"public",
"String",
"getWsdlFile",
"(",
")",
"{",
"if",
"(",
"meta",
"==",
"null",
")",
"return",
"null",
";",
"return",
"(",
"String",
")",
"meta",
".",
"get",
"(",
"WSDL_FILE",
",",
"null",
")",
";",
"}"
] | returns null if there is no wsdlFile defined
@return the wsdlFile
@throws ExpressionException | [
"returns",
"null",
"if",
"there",
"is",
"no",
"wsdlFile",
"defined"
] | 29b153fc4e126e5edb97da937f2ee2e231b87593 | https://github.com/lucee/Lucee/blob/29b153fc4e126e5edb97da937f2ee2e231b87593/core/src/main/java/lucee/runtime/ComponentProperties.java#L78-L81 |
30,841 | lucee/Lucee | core/src/main/java/lucee/runtime/net/ntp/NtpMessage.java | NtpMessage.toByteArray | public byte[] toByteArray() {
// All bytes are automatically set to 0
byte[] p = new byte[48];
p[0] = (byte) (leapIndicator << 6 | version << 3 | mode);
p[1] = (byte) stratum;
p[2] = pollInterval;
p[3] = precision;
// root delay is a signed 16.16-bit FP, in Java an int is 32-bits
int l = (int) (rootDelay * 65536.0);
p[4] = (byte) ((l >> 24) & 0xFF);
p[5] = (byte) ((l >> 16) & 0xFF);
p[6] = (byte) ((l >> 8) & 0xFF);
p[7] = (byte) (l & 0xFF);
// root dispersion is an unsigned 16.16-bit FP, in Java there are no
// unsigned primitive types, so we use a long which is 64-bits
long ul = (long) (rootDispersion * 65536.0);
p[8] = (byte) ((ul >> 24) & 0xFF);
p[9] = (byte) ((ul >> 16) & 0xFF);
p[10] = (byte) ((ul >> 8) & 0xFF);
p[11] = (byte) (ul & 0xFF);
p[12] = referenceIdentifier[0];
p[13] = referenceIdentifier[1];
p[14] = referenceIdentifier[2];
p[15] = referenceIdentifier[3];
encodeTimestamp(p, 16, referenceTimestamp);
encodeTimestamp(p, 24, originateTimestamp);
encodeTimestamp(p, 32, receiveTimestamp);
encodeTimestamp(p, 40, transmitTimestamp);
return p;
} | java | public byte[] toByteArray() {
// All bytes are automatically set to 0
byte[] p = new byte[48];
p[0] = (byte) (leapIndicator << 6 | version << 3 | mode);
p[1] = (byte) stratum;
p[2] = pollInterval;
p[3] = precision;
// root delay is a signed 16.16-bit FP, in Java an int is 32-bits
int l = (int) (rootDelay * 65536.0);
p[4] = (byte) ((l >> 24) & 0xFF);
p[5] = (byte) ((l >> 16) & 0xFF);
p[6] = (byte) ((l >> 8) & 0xFF);
p[7] = (byte) (l & 0xFF);
// root dispersion is an unsigned 16.16-bit FP, in Java there are no
// unsigned primitive types, so we use a long which is 64-bits
long ul = (long) (rootDispersion * 65536.0);
p[8] = (byte) ((ul >> 24) & 0xFF);
p[9] = (byte) ((ul >> 16) & 0xFF);
p[10] = (byte) ((ul >> 8) & 0xFF);
p[11] = (byte) (ul & 0xFF);
p[12] = referenceIdentifier[0];
p[13] = referenceIdentifier[1];
p[14] = referenceIdentifier[2];
p[15] = referenceIdentifier[3];
encodeTimestamp(p, 16, referenceTimestamp);
encodeTimestamp(p, 24, originateTimestamp);
encodeTimestamp(p, 32, receiveTimestamp);
encodeTimestamp(p, 40, transmitTimestamp);
return p;
} | [
"public",
"byte",
"[",
"]",
"toByteArray",
"(",
")",
"{",
"// All bytes are automatically set to 0",
"byte",
"[",
"]",
"p",
"=",
"new",
"byte",
"[",
"48",
"]",
";",
"p",
"[",
"0",
"]",
"=",
"(",
"byte",
")",
"(",
"leapIndicator",
"<<",
"6",
"|",
"ver... | This method constructs the data bytes of a raw NTP packet.
@return | [
"This",
"method",
"constructs",
"the",
"data",
"bytes",
"of",
"a",
"raw",
"NTP",
"packet",
"."
] | 29b153fc4e126e5edb97da937f2ee2e231b87593 | https://github.com/lucee/Lucee/blob/29b153fc4e126e5edb97da937f2ee2e231b87593/core/src/main/java/lucee/runtime/net/ntp/NtpMessage.java#L217-L252 |
30,842 | lucee/Lucee | core/src/main/java/lucee/runtime/net/ntp/NtpMessage.java | NtpMessage.encodeTimestamp | public static void encodeTimestamp(byte[] array, int pointer, double timestamp) {
// Converts a double into a 64-bit fixed point
for (int i = 0; i < 8; i++) {
// 2^24, 2^16, 2^8, .. 2^-32
double base = Math.pow(2, (3 - i) * 8);
// Capture byte value
array[pointer + i] = (byte) (timestamp / base);
// Subtract captured value from remaining total
timestamp = timestamp - (unsignedByteToShort(array[pointer + i]) * base);
}
// From RFC 2030: It is advisable to fill the non-significan't
// low order bits of the timestamp with a random, unbiased
// bitstring, both to avoid systematic roundoff errors and as
// a means of loop detection and replay detection.
array[7] = (byte) (Math.random() * 255.0);
} | java | public static void encodeTimestamp(byte[] array, int pointer, double timestamp) {
// Converts a double into a 64-bit fixed point
for (int i = 0; i < 8; i++) {
// 2^24, 2^16, 2^8, .. 2^-32
double base = Math.pow(2, (3 - i) * 8);
// Capture byte value
array[pointer + i] = (byte) (timestamp / base);
// Subtract captured value from remaining total
timestamp = timestamp - (unsignedByteToShort(array[pointer + i]) * base);
}
// From RFC 2030: It is advisable to fill the non-significan't
// low order bits of the timestamp with a random, unbiased
// bitstring, both to avoid systematic roundoff errors and as
// a means of loop detection and replay detection.
array[7] = (byte) (Math.random() * 255.0);
} | [
"public",
"static",
"void",
"encodeTimestamp",
"(",
"byte",
"[",
"]",
"array",
",",
"int",
"pointer",
",",
"double",
"timestamp",
")",
"{",
"// Converts a double into a 64-bit fixed point",
"for",
"(",
"int",
"i",
"=",
"0",
";",
"i",
"<",
"8",
";",
"i",
"+... | Encodes a timestamp in the specified position in the message
@param array
@param pointer
@param timestamp | [
"Encodes",
"a",
"timestamp",
"in",
"the",
"specified",
"position",
"in",
"the",
"message"
] | 29b153fc4e126e5edb97da937f2ee2e231b87593 | https://github.com/lucee/Lucee/blob/29b153fc4e126e5edb97da937f2ee2e231b87593/core/src/main/java/lucee/runtime/net/ntp/NtpMessage.java#L306-L324 |
30,843 | lucee/Lucee | core/src/main/java/lucee/runtime/net/ntp/NtpMessage.java | NtpMessage.referenceIdentifierToString | public static String referenceIdentifierToString(byte[] ref, short stratum, byte version) {
// From the RFC 2030:
// In the case of NTP Version 3 or Version 4 stratum-0 (unspecified)
// or stratum-1 (primary) servers, this is a four-character ASCII
// string, left justified and zero padded to 32 bits.
if (stratum == 0 || stratum == 1) {
return new String(ref);
}
// In NTP Version 3 secondary servers, this is the 32-bit IPv4
// address of the reference source.
else if (version == 3) {
return unsignedByteToShort(ref[0]) + "." + unsignedByteToShort(ref[1]) + "." + unsignedByteToShort(ref[2]) + "." + unsignedByteToShort(ref[3]);
}
// In NTP Version 4 secondary servers, this is the low order 32 bits
// of the latest transmit timestamp of the reference source.
else if (version == 4) {
return "" + ((unsignedByteToShort(ref[0]) / 256.0) + (unsignedByteToShort(ref[1]) / 65536.0) + (unsignedByteToShort(ref[2]) / 16777216.0)
+ (unsignedByteToShort(ref[3]) / 4294967296.0));
}
return "";
} | java | public static String referenceIdentifierToString(byte[] ref, short stratum, byte version) {
// From the RFC 2030:
// In the case of NTP Version 3 or Version 4 stratum-0 (unspecified)
// or stratum-1 (primary) servers, this is a four-character ASCII
// string, left justified and zero padded to 32 bits.
if (stratum == 0 || stratum == 1) {
return new String(ref);
}
// In NTP Version 3 secondary servers, this is the 32-bit IPv4
// address of the reference source.
else if (version == 3) {
return unsignedByteToShort(ref[0]) + "." + unsignedByteToShort(ref[1]) + "." + unsignedByteToShort(ref[2]) + "." + unsignedByteToShort(ref[3]);
}
// In NTP Version 4 secondary servers, this is the low order 32 bits
// of the latest transmit timestamp of the reference source.
else if (version == 4) {
return "" + ((unsignedByteToShort(ref[0]) / 256.0) + (unsignedByteToShort(ref[1]) / 65536.0) + (unsignedByteToShort(ref[2]) / 16777216.0)
+ (unsignedByteToShort(ref[3]) / 4294967296.0));
}
return "";
} | [
"public",
"static",
"String",
"referenceIdentifierToString",
"(",
"byte",
"[",
"]",
"ref",
",",
"short",
"stratum",
",",
"byte",
"version",
")",
"{",
"// From the RFC 2030:",
"// In the case of NTP Version 3 or Version 4 stratum-0 (unspecified)",
"// or stratum-1 (primary) serv... | Returns a string representation of a reference identifier according to the rules set out in RFC
2030.
@param ref
@param stratum
@param version
@return | [
"Returns",
"a",
"string",
"representation",
"of",
"a",
"reference",
"identifier",
"according",
"to",
"the",
"rules",
"set",
"out",
"in",
"RFC",
"2030",
"."
] | 29b153fc4e126e5edb97da937f2ee2e231b87593 | https://github.com/lucee/Lucee/blob/29b153fc4e126e5edb97da937f2ee2e231b87593/core/src/main/java/lucee/runtime/net/ntp/NtpMessage.java#L361-L384 |
30,844 | lucee/Lucee | core/src/main/java/lucee/runtime/op/Operator.java | Operator.compare | public static int compare(Object left, Object right) throws PageException {
// print.dumpStack();
if (left instanceof String) return compare((String) left, right);
else if (left instanceof Number) return compare(((Number) left).doubleValue(), right);
else if (left instanceof Boolean) return compare(((Boolean) left).booleanValue(), right);
else if (left instanceof Date) return compare((Date) left, right);
else if (left instanceof Castable) return compare(((Castable) left), right);
else if (left instanceof Locale) return compare(((Locale) left), right);
else if (left == null) return compare("", right);
/*
* /NICE disabled at the moment left Comparable else if(left instanceof Comparable) { return
* ((Comparable)left).compareTo(right); }
*/
else if (left instanceof Character) return compare(((Character) left).toString(), right);
else if (left instanceof Calendar) return compare(((Calendar) left).getTime(), right);
else if (left instanceof TimeZone) return compare(((TimeZone) left), right);
else {
return error(false, true);
}
} | java | public static int compare(Object left, Object right) throws PageException {
// print.dumpStack();
if (left instanceof String) return compare((String) left, right);
else if (left instanceof Number) return compare(((Number) left).doubleValue(), right);
else if (left instanceof Boolean) return compare(((Boolean) left).booleanValue(), right);
else if (left instanceof Date) return compare((Date) left, right);
else if (left instanceof Castable) return compare(((Castable) left), right);
else if (left instanceof Locale) return compare(((Locale) left), right);
else if (left == null) return compare("", right);
/*
* /NICE disabled at the moment left Comparable else if(left instanceof Comparable) { return
* ((Comparable)left).compareTo(right); }
*/
else if (left instanceof Character) return compare(((Character) left).toString(), right);
else if (left instanceof Calendar) return compare(((Calendar) left).getTime(), right);
else if (left instanceof TimeZone) return compare(((TimeZone) left), right);
else {
return error(false, true);
}
} | [
"public",
"static",
"int",
"compare",
"(",
"Object",
"left",
",",
"Object",
"right",
")",
"throws",
"PageException",
"{",
"// print.dumpStack();",
"if",
"(",
"left",
"instanceof",
"String",
")",
"return",
"compare",
"(",
"(",
"String",
")",
"left",
",",
"rig... | compares two Objects
@param left
@param right
@return different of objects as int
@throws PageException | [
"compares",
"two",
"Objects"
] | 29b153fc4e126e5edb97da937f2ee2e231b87593 | https://github.com/lucee/Lucee/blob/29b153fc4e126e5edb97da937f2ee2e231b87593/core/src/main/java/lucee/runtime/op/Operator.java#L73-L92 |
30,845 | lucee/Lucee | core/src/main/java/lucee/runtime/op/Operator.java | Operator.compare | public static int compare(String left, String right) {
if (Decision.isNumber(left)) {
if (Decision.isNumber(right)) {
// long numbers
if (left.length() > 9 || right.length() > 9) {
try {
return new BigDecimal(left).compareTo(new BigDecimal(right));
}
catch (Throwable t) {
ExceptionUtil.rethrowIfNecessary(t);
}
}
return compare(Caster.toDoubleValue(left, Double.NaN), Caster.toDoubleValue(right, Double.NaN));
}
return compare(Caster.toDoubleValue(left, Double.NaN), right);
}
if (Decision.isBoolean(left)) return compare(Caster.toBooleanValue(left, false) ? 1D : 0D, right);
// NICE Date compare, perhaps datetime to double
return left.compareToIgnoreCase(right);
} | java | public static int compare(String left, String right) {
if (Decision.isNumber(left)) {
if (Decision.isNumber(right)) {
// long numbers
if (left.length() > 9 || right.length() > 9) {
try {
return new BigDecimal(left).compareTo(new BigDecimal(right));
}
catch (Throwable t) {
ExceptionUtil.rethrowIfNecessary(t);
}
}
return compare(Caster.toDoubleValue(left, Double.NaN), Caster.toDoubleValue(right, Double.NaN));
}
return compare(Caster.toDoubleValue(left, Double.NaN), right);
}
if (Decision.isBoolean(left)) return compare(Caster.toBooleanValue(left, false) ? 1D : 0D, right);
// NICE Date compare, perhaps datetime to double
return left.compareToIgnoreCase(right);
} | [
"public",
"static",
"int",
"compare",
"(",
"String",
"left",
",",
"String",
"right",
")",
"{",
"if",
"(",
"Decision",
".",
"isNumber",
"(",
"left",
")",
")",
"{",
"if",
"(",
"Decision",
".",
"isNumber",
"(",
"right",
")",
")",
"{",
"// long numbers",
... | compares a String with a String
@param left
@param right
@return difference as int | [
"compares",
"a",
"String",
"with",
"a",
"String"
] | 29b153fc4e126e5edb97da937f2ee2e231b87593 | https://github.com/lucee/Lucee/blob/29b153fc4e126e5edb97da937f2ee2e231b87593/core/src/main/java/lucee/runtime/op/Operator.java#L407-L427 |
30,846 | lucee/Lucee | core/src/main/java/lucee/runtime/op/Operator.java | Operator.compare | public static int compare(String left, double right) {
if (Decision.isNumber(left)) {
if (left.length() > 9) {
try {
return new BigDecimal(left).compareTo(new BigDecimal(Caster.toString(right)));
}
catch (Exception e) {}
}
return compare(Caster.toDoubleValue(left, Double.NaN), right);
}
if (Decision.isBoolean(left)) return compare(Caster.toBooleanValue(left, false), right);
if (left.length() == 0) return -1;
char leftFirst = left.charAt(0);
if (leftFirst >= '0' && leftFirst <= '9') return left.compareToIgnoreCase(Caster.toString(right));
return leftFirst - '0';
} | java | public static int compare(String left, double right) {
if (Decision.isNumber(left)) {
if (left.length() > 9) {
try {
return new BigDecimal(left).compareTo(new BigDecimal(Caster.toString(right)));
}
catch (Exception e) {}
}
return compare(Caster.toDoubleValue(left, Double.NaN), right);
}
if (Decision.isBoolean(left)) return compare(Caster.toBooleanValue(left, false), right);
if (left.length() == 0) return -1;
char leftFirst = left.charAt(0);
if (leftFirst >= '0' && leftFirst <= '9') return left.compareToIgnoreCase(Caster.toString(right));
return leftFirst - '0';
} | [
"public",
"static",
"int",
"compare",
"(",
"String",
"left",
",",
"double",
"right",
")",
"{",
"if",
"(",
"Decision",
".",
"isNumber",
"(",
"left",
")",
")",
"{",
"if",
"(",
"left",
".",
"length",
"(",
")",
">",
"9",
")",
"{",
"try",
"{",
"return... | compares a String with a double
@param left
@param right
@return difference as int | [
"compares",
"a",
"String",
"with",
"a",
"double"
] | 29b153fc4e126e5edb97da937f2ee2e231b87593 | https://github.com/lucee/Lucee/blob/29b153fc4e126e5edb97da937f2ee2e231b87593/core/src/main/java/lucee/runtime/op/Operator.java#L436-L452 |
30,847 | lucee/Lucee | core/src/main/java/lucee/runtime/op/Operator.java | Operator.compare | public static int compare(Date left, String right) throws PageException {
if (Decision.isNumber(right)) return compare(left.getTime() / 1000, Caster.toDoubleValue(right));
DateTime dt = DateCaster.toDateAdvanced(right, DateCaster.CONVERTING_TYPE_OFFSET, null, null);
if (dt != null) {
return compare(left.getTime() / 1000, dt.getTime() / 1000);
}
return Caster.toString(left).compareToIgnoreCase(right);
} | java | public static int compare(Date left, String right) throws PageException {
if (Decision.isNumber(right)) return compare(left.getTime() / 1000, Caster.toDoubleValue(right));
DateTime dt = DateCaster.toDateAdvanced(right, DateCaster.CONVERTING_TYPE_OFFSET, null, null);
if (dt != null) {
return compare(left.getTime() / 1000, dt.getTime() / 1000);
}
return Caster.toString(left).compareToIgnoreCase(right);
} | [
"public",
"static",
"int",
"compare",
"(",
"Date",
"left",
",",
"String",
"right",
")",
"throws",
"PageException",
"{",
"if",
"(",
"Decision",
".",
"isNumber",
"(",
"right",
")",
")",
"return",
"compare",
"(",
"left",
".",
"getTime",
"(",
")",
"/",
"10... | compares a Date with a String
@param left
@param right
@return difference as int
@throws PageException | [
"compares",
"a",
"Date",
"with",
"a",
"String"
] | 29b153fc4e126e5edb97da937f2ee2e231b87593 | https://github.com/lucee/Lucee/blob/29b153fc4e126e5edb97da937f2ee2e231b87593/core/src/main/java/lucee/runtime/op/Operator.java#L584-L591 |
30,848 | lucee/Lucee | core/src/main/java/lucee/runtime/op/Operator.java | Operator.compare | public static int compare(Date left, double right) {
return compare(left.getTime() / 1000, DateTimeUtil.getInstance().toDateTime(right).getTime() / 1000);
} | java | public static int compare(Date left, double right) {
return compare(left.getTime() / 1000, DateTimeUtil.getInstance().toDateTime(right).getTime() / 1000);
} | [
"public",
"static",
"int",
"compare",
"(",
"Date",
"left",
",",
"double",
"right",
")",
"{",
"return",
"compare",
"(",
"left",
".",
"getTime",
"(",
")",
"/",
"1000",
",",
"DateTimeUtil",
".",
"getInstance",
"(",
")",
".",
"toDateTime",
"(",
"right",
")... | compares a Date with a double
@param left
@param right
@return difference as int | [
"compares",
"a",
"Date",
"with",
"a",
"double"
] | 29b153fc4e126e5edb97da937f2ee2e231b87593 | https://github.com/lucee/Lucee/blob/29b153fc4e126e5edb97da937f2ee2e231b87593/core/src/main/java/lucee/runtime/op/Operator.java#L600-L602 |
30,849 | lucee/Lucee | core/src/main/java/lucee/runtime/op/Operator.java | Operator.compare | public static int compare(Date left, Date right) {
return compare(left.getTime() / 1000, right.getTime() / 1000);
} | java | public static int compare(Date left, Date right) {
return compare(left.getTime() / 1000, right.getTime() / 1000);
} | [
"public",
"static",
"int",
"compare",
"(",
"Date",
"left",
",",
"Date",
"right",
")",
"{",
"return",
"compare",
"(",
"left",
".",
"getTime",
"(",
")",
"/",
"1000",
",",
"right",
".",
"getTime",
"(",
")",
"/",
"1000",
")",
";",
"}"
] | compares a Date with a Date
@param left
@param right
@return difference as int | [
"compares",
"a",
"Date",
"with",
"a",
"Date"
] | 29b153fc4e126e5edb97da937f2ee2e231b87593 | https://github.com/lucee/Lucee/blob/29b153fc4e126e5edb97da937f2ee2e231b87593/core/src/main/java/lucee/runtime/op/Operator.java#L622-L624 |
30,850 | lucee/Lucee | core/src/main/java/lucee/runtime/op/Operator.java | Operator.exponent | public static double exponent(Object left, Object right) throws PageException {
return StrictMath.pow(Caster.toDoubleValue(left), Caster.toDoubleValue(right));
} | java | public static double exponent(Object left, Object right) throws PageException {
return StrictMath.pow(Caster.toDoubleValue(left), Caster.toDoubleValue(right));
} | [
"public",
"static",
"double",
"exponent",
"(",
"Object",
"left",
",",
"Object",
"right",
")",
"throws",
"PageException",
"{",
"return",
"StrictMath",
".",
"pow",
"(",
"Caster",
".",
"toDoubleValue",
"(",
"left",
")",
",",
"Caster",
".",
"toDoubleValue",
"(",... | calculate the exponent of the left value
@param left value to get exponent from
@param right exponent count
@return return expoinended value
@throws PageException | [
"calculate",
"the",
"exponent",
"of",
"the",
"left",
"value"
] | 29b153fc4e126e5edb97da937f2ee2e231b87593 | https://github.com/lucee/Lucee/blob/29b153fc4e126e5edb97da937f2ee2e231b87593/core/src/main/java/lucee/runtime/op/Operator.java#L891-L893 |
30,851 | lucee/Lucee | core/src/main/java/lucee/runtime/op/Operator.java | Operator.concat | public static CharSequence concat(CharSequence left, CharSequence right) {
if (left instanceof Appendable) {
try {
((Appendable) left).append(right);
return left;
}
catch (IOException e) {}
}
return new StringBuilder(left).append(right);
} | java | public static CharSequence concat(CharSequence left, CharSequence right) {
if (left instanceof Appendable) {
try {
((Appendable) left).append(right);
return left;
}
catch (IOException e) {}
}
return new StringBuilder(left).append(right);
} | [
"public",
"static",
"CharSequence",
"concat",
"(",
"CharSequence",
"left",
",",
"CharSequence",
"right",
")",
"{",
"if",
"(",
"left",
"instanceof",
"Appendable",
")",
"{",
"try",
"{",
"(",
"(",
"Appendable",
")",
"left",
")",
".",
"append",
"(",
"right",
... | concat 2 CharSequences
@param left
@param right
@return concated String | [
"concat",
"2",
"CharSequences"
] | 29b153fc4e126e5edb97da937f2ee2e231b87593 | https://github.com/lucee/Lucee/blob/29b153fc4e126e5edb97da937f2ee2e231b87593/core/src/main/java/lucee/runtime/op/Operator.java#L919-L928 |
30,852 | lucee/Lucee | core/src/main/java/lucee/transformer/bytecode/util/ExpressionUtil.java | ExpressionUtil.visitLine | public static void visitLine(BytecodeContext bc, Position pos) {
if (pos != null) {
visitLine(bc, pos.line);
}
} | java | public static void visitLine(BytecodeContext bc, Position pos) {
if (pos != null) {
visitLine(bc, pos.line);
}
} | [
"public",
"static",
"void",
"visitLine",
"(",
"BytecodeContext",
"bc",
",",
"Position",
"pos",
")",
"{",
"if",
"(",
"pos",
"!=",
"null",
")",
"{",
"visitLine",
"(",
"bc",
",",
"pos",
".",
"line",
")",
";",
"}",
"}"
] | visit line number
@param adapter
@param line
@param silent id silent this is ignored for log | [
"visit",
"line",
"number"
] | 29b153fc4e126e5edb97da937f2ee2e231b87593 | https://github.com/lucee/Lucee/blob/29b153fc4e126e5edb97da937f2ee2e231b87593/core/src/main/java/lucee/transformer/bytecode/util/ExpressionUtil.java#L72-L76 |
30,853 | lucee/Lucee | core/src/main/java/lucee/transformer/bytecode/util/ExpressionUtil.java | ExpressionUtil.writeOutSilent | public static void writeOutSilent(Expression value, BytecodeContext bc, int mode) throws TransformerException {
Position start = value.getStart();
Position end = value.getEnd();
value.setStart(null);
value.setEnd(null);
value.writeOut(bc, mode);
value.setStart(start);
value.setEnd(end);
} | java | public static void writeOutSilent(Expression value, BytecodeContext bc, int mode) throws TransformerException {
Position start = value.getStart();
Position end = value.getEnd();
value.setStart(null);
value.setEnd(null);
value.writeOut(bc, mode);
value.setStart(start);
value.setEnd(end);
} | [
"public",
"static",
"void",
"writeOutSilent",
"(",
"Expression",
"value",
",",
"BytecodeContext",
"bc",
",",
"int",
"mode",
")",
"throws",
"TransformerException",
"{",
"Position",
"start",
"=",
"value",
".",
"getStart",
"(",
")",
";",
"Position",
"end",
"=",
... | write out expression without LNT
@param value
@param bc
@param mode
@throws TransformerException | [
"write",
"out",
"expression",
"without",
"LNT"
] | 29b153fc4e126e5edb97da937f2ee2e231b87593 | https://github.com/lucee/Lucee/blob/29b153fc4e126e5edb97da937f2ee2e231b87593/core/src/main/java/lucee/transformer/bytecode/util/ExpressionUtil.java#L105-L113 |
30,854 | lucee/Lucee | core/src/main/java/lucee/runtime/tag/TagUtil.java | TagUtil.addTagMetaData | public static void addTagMetaData(ConfigWebImpl cw, lucee.commons.io.log.Log log) {
if (true) return;
PageContextImpl pc = null;
try {
pc = ThreadUtil.createPageContext(cw, DevNullOutputStream.DEV_NULL_OUTPUT_STREAM, "localhost", "/", "", new Cookie[0], new Pair[0], null, new Pair[0], new StructImpl(),
false, -1);
}
catch (Throwable t) {
ExceptionUtil.rethrowIfNecessary(t);
return;
}
PageContext orgPC = ThreadLocalPageContext.get();
try {
ThreadLocalPageContext.register(pc);
// MUST MOST of them are the same, so this is a huge overhead
_addTagMetaData(pc, cw, CFMLEngine.DIALECT_CFML);
_addTagMetaData(pc, cw, CFMLEngine.DIALECT_LUCEE);
}
catch (Exception e) {
XMLConfigWebFactory.log(cw, log, e);
}
finally {
pc.getConfig().getFactory().releaseLuceePageContext(pc, true);
ThreadLocalPageContext.register(orgPC);
}
} | java | public static void addTagMetaData(ConfigWebImpl cw, lucee.commons.io.log.Log log) {
if (true) return;
PageContextImpl pc = null;
try {
pc = ThreadUtil.createPageContext(cw, DevNullOutputStream.DEV_NULL_OUTPUT_STREAM, "localhost", "/", "", new Cookie[0], new Pair[0], null, new Pair[0], new StructImpl(),
false, -1);
}
catch (Throwable t) {
ExceptionUtil.rethrowIfNecessary(t);
return;
}
PageContext orgPC = ThreadLocalPageContext.get();
try {
ThreadLocalPageContext.register(pc);
// MUST MOST of them are the same, so this is a huge overhead
_addTagMetaData(pc, cw, CFMLEngine.DIALECT_CFML);
_addTagMetaData(pc, cw, CFMLEngine.DIALECT_LUCEE);
}
catch (Exception e) {
XMLConfigWebFactory.log(cw, log, e);
}
finally {
pc.getConfig().getFactory().releaseLuceePageContext(pc, true);
ThreadLocalPageContext.register(orgPC);
}
} | [
"public",
"static",
"void",
"addTagMetaData",
"(",
"ConfigWebImpl",
"cw",
",",
"lucee",
".",
"commons",
".",
"io",
".",
"log",
".",
"Log",
"log",
")",
"{",
"if",
"(",
"true",
")",
"return",
";",
"PageContextImpl",
"pc",
"=",
"null",
";",
"try",
"{",
... | load metadata from cfc based custom tags and add the info to the tag
@param cs
@param config | [
"load",
"metadata",
"from",
"cfc",
"based",
"custom",
"tags",
"and",
"add",
"the",
"info",
"to",
"the",
"tag"
] | 29b153fc4e126e5edb97da937f2ee2e231b87593 | https://github.com/lucee/Lucee/blob/29b153fc4e126e5edb97da937f2ee2e231b87593/core/src/main/java/lucee/runtime/tag/TagUtil.java#L257-L286 |
30,855 | lucee/Lucee | core/src/main/java/lucee/runtime/tag/TagUtil.java | TagUtil.invokeBIF | public static Object invokeBIF(PageContext pc, Object[] args, String className, String bundleName, String bundleVersion) throws PageException {
try {
Class<?> clazz = ClassUtil.loadClassByBundle(className, bundleName, bundleVersion, pc.getConfig().getIdentification());
BIF bif;
if (Reflector.isInstaneOf(clazz, BIF.class)) bif = (BIF) clazz.newInstance();
else bif = new BIFProxy(clazz);
return bif.invoke(pc, args);
}
catch (Exception e) {
throw Caster.toPageException(e);
}
} | java | public static Object invokeBIF(PageContext pc, Object[] args, String className, String bundleName, String bundleVersion) throws PageException {
try {
Class<?> clazz = ClassUtil.loadClassByBundle(className, bundleName, bundleVersion, pc.getConfig().getIdentification());
BIF bif;
if (Reflector.isInstaneOf(clazz, BIF.class)) bif = (BIF) clazz.newInstance();
else bif = new BIFProxy(clazz);
return bif.invoke(pc, args);
}
catch (Exception e) {
throw Caster.toPageException(e);
}
} | [
"public",
"static",
"Object",
"invokeBIF",
"(",
"PageContext",
"pc",
",",
"Object",
"[",
"]",
"args",
",",
"String",
"className",
",",
"String",
"bundleName",
",",
"String",
"bundleVersion",
")",
"throws",
"PageException",
"{",
"try",
"{",
"Class",
"<",
"?",... | used by the bytecode builded
@param pc pageContext
@param className
@param bundleName
@param bundleVersion
@return
@throws BundleException
@throws ClassException | [
"used",
"by",
"the",
"bytecode",
"builded"
] | 29b153fc4e126e5edb97da937f2ee2e231b87593 | https://github.com/lucee/Lucee/blob/29b153fc4e126e5edb97da937f2ee2e231b87593/core/src/main/java/lucee/runtime/tag/TagUtil.java#L357-L370 |
30,856 | lucee/Lucee | core/src/main/java/lucee/runtime/net/ldap/LDAPClient.java | LDAPClient.setCredential | public void setCredential(String username, String password) {
if (username != null) {
env.put("java.naming.security.principal", username);
env.put("java.naming.security.credentials", password);
}
else {
env.remove("java.naming.security.principal");
env.remove("java.naming.security.credentials");
}
} | java | public void setCredential(String username, String password) {
if (username != null) {
env.put("java.naming.security.principal", username);
env.put("java.naming.security.credentials", password);
}
else {
env.remove("java.naming.security.principal");
env.remove("java.naming.security.credentials");
}
} | [
"public",
"void",
"setCredential",
"(",
"String",
"username",
",",
"String",
"password",
")",
"{",
"if",
"(",
"username",
"!=",
"null",
")",
"{",
"env",
".",
"put",
"(",
"\"java.naming.security.principal\"",
",",
"username",
")",
";",
"env",
".",
"put",
"(... | sets username password for the connection
@param username
@param password | [
"sets",
"username",
"password",
"for",
"the",
"connection"
] | 29b153fc4e126e5edb97da937f2ee2e231b87593 | https://github.com/lucee/Lucee/blob/29b153fc4e126e5edb97da937f2ee2e231b87593/core/src/main/java/lucee/runtime/net/ldap/LDAPClient.java#L114-L123 |
30,857 | lucee/Lucee | core/src/main/java/lucee/runtime/net/ldap/LDAPClient.java | LDAPClient.setSecureLevel | public void setSecureLevel(short secureLevel) throws ClassException {
// Security
if (secureLevel == SECURE_CFSSL_BASIC) {
env.put("java.naming.security.protocol", "ssl");
env.put("java.naming.ldap.factory.socket", "javax.net.ssl.SSLSocketFactory");
ClassUtil.loadClass("com.sun.net.ssl.internal.ssl.Provider");
Security.addProvider(new com.sun.net.ssl.internal.ssl.Provider());
}
else if (secureLevel == SECURE_CFSSL_CLIENT_AUTH) {
env.put("java.naming.security.protocol", "ssl");
env.put("java.naming.security.authentication", "EXTERNAL");
}
else {
env.put("java.naming.security.authentication", "simple");
env.remove("java.naming.security.protocol");
env.remove("java.naming.ldap.factory.socket");
}
} | java | public void setSecureLevel(short secureLevel) throws ClassException {
// Security
if (secureLevel == SECURE_CFSSL_BASIC) {
env.put("java.naming.security.protocol", "ssl");
env.put("java.naming.ldap.factory.socket", "javax.net.ssl.SSLSocketFactory");
ClassUtil.loadClass("com.sun.net.ssl.internal.ssl.Provider");
Security.addProvider(new com.sun.net.ssl.internal.ssl.Provider());
}
else if (secureLevel == SECURE_CFSSL_CLIENT_AUTH) {
env.put("java.naming.security.protocol", "ssl");
env.put("java.naming.security.authentication", "EXTERNAL");
}
else {
env.put("java.naming.security.authentication", "simple");
env.remove("java.naming.security.protocol");
env.remove("java.naming.ldap.factory.socket");
}
} | [
"public",
"void",
"setSecureLevel",
"(",
"short",
"secureLevel",
")",
"throws",
"ClassException",
"{",
"// Security",
"if",
"(",
"secureLevel",
"==",
"SECURE_CFSSL_BASIC",
")",
"{",
"env",
".",
"put",
"(",
"\"java.naming.security.protocol\"",
",",
"\"ssl\"",
")",
... | sets the secure Level
@param secureLevel [SECURE_CFSSL_BASIC, SECURE_CFSSL_CLIENT_AUTH, SECURE_NONE]
@throws ClassNotFoundException
@throws ClassException | [
"sets",
"the",
"secure",
"Level"
] | 29b153fc4e126e5edb97da937f2ee2e231b87593 | https://github.com/lucee/Lucee/blob/29b153fc4e126e5edb97da937f2ee2e231b87593/core/src/main/java/lucee/runtime/net/ldap/LDAPClient.java#L132-L151 |
30,858 | lucee/Lucee | core/src/main/java/lucee/runtime/net/ldap/LDAPClient.java | LDAPClient.setReferral | public void setReferral(int referral) {
if (referral > 0) {
env.put("java.naming.referral", "follow");
env.put("java.naming.ldap.referral.limit", Caster.toString(referral));
}
else {
env.put("java.naming.referral", "ignore");
env.remove("java.naming.ldap.referral.limit");
}
} | java | public void setReferral(int referral) {
if (referral > 0) {
env.put("java.naming.referral", "follow");
env.put("java.naming.ldap.referral.limit", Caster.toString(referral));
}
else {
env.put("java.naming.referral", "ignore");
env.remove("java.naming.ldap.referral.limit");
}
} | [
"public",
"void",
"setReferral",
"(",
"int",
"referral",
")",
"{",
"if",
"(",
"referral",
">",
"0",
")",
"{",
"env",
".",
"put",
"(",
"\"java.naming.referral\"",
",",
"\"follow\"",
")",
";",
"env",
".",
"put",
"(",
"\"java.naming.ldap.referral.limit\"",
",",... | sets thr referral
@param referral | [
"sets",
"thr",
"referral"
] | 29b153fc4e126e5edb97da937f2ee2e231b87593 | https://github.com/lucee/Lucee/blob/29b153fc4e126e5edb97da937f2ee2e231b87593/core/src/main/java/lucee/runtime/net/ldap/LDAPClient.java#L158-L167 |
30,859 | lucee/Lucee | core/src/main/java/lucee/runtime/net/ldap/LDAPClient.java | LDAPClient.add | public void add(String dn, String attributes, String delimiter, String seperator) throws NamingException, PageException {
DirContext ctx = new InitialDirContext(env);
ctx.createSubcontext(dn, toAttributes(attributes, delimiter, seperator));
ctx.close();
} | java | public void add(String dn, String attributes, String delimiter, String seperator) throws NamingException, PageException {
DirContext ctx = new InitialDirContext(env);
ctx.createSubcontext(dn, toAttributes(attributes, delimiter, seperator));
ctx.close();
} | [
"public",
"void",
"add",
"(",
"String",
"dn",
",",
"String",
"attributes",
",",
"String",
"delimiter",
",",
"String",
"seperator",
")",
"throws",
"NamingException",
",",
"PageException",
"{",
"DirContext",
"ctx",
"=",
"new",
"InitialDirContext",
"(",
"env",
")... | adds LDAP entries to LDAP server
@param dn
@param attributes
@param delimiter
@throws NamingException
@throws PageException | [
"adds",
"LDAP",
"entries",
"to",
"LDAP",
"server"
] | 29b153fc4e126e5edb97da937f2ee2e231b87593 | https://github.com/lucee/Lucee/blob/29b153fc4e126e5edb97da937f2ee2e231b87593/core/src/main/java/lucee/runtime/net/ldap/LDAPClient.java#L178-L182 |
30,860 | lucee/Lucee | core/src/main/java/lucee/runtime/net/ldap/LDAPClient.java | LDAPClient.delete | public void delete(String dn) throws NamingException {
DirContext ctx = new InitialDirContext(env);
ctx.destroySubcontext(dn);
ctx.close();
} | java | public void delete(String dn) throws NamingException {
DirContext ctx = new InitialDirContext(env);
ctx.destroySubcontext(dn);
ctx.close();
} | [
"public",
"void",
"delete",
"(",
"String",
"dn",
")",
"throws",
"NamingException",
"{",
"DirContext",
"ctx",
"=",
"new",
"InitialDirContext",
"(",
"env",
")",
";",
"ctx",
".",
"destroySubcontext",
"(",
"dn",
")",
";",
"ctx",
".",
"close",
"(",
")",
";",
... | deletes LDAP entries on an LDAP server
@param dn
@throws NamingException | [
"deletes",
"LDAP",
"entries",
"on",
"an",
"LDAP",
"server"
] | 29b153fc4e126e5edb97da937f2ee2e231b87593 | https://github.com/lucee/Lucee/blob/29b153fc4e126e5edb97da937f2ee2e231b87593/core/src/main/java/lucee/runtime/net/ldap/LDAPClient.java#L190-L194 |
30,861 | lucee/Lucee | core/src/main/java/lucee/runtime/net/ldap/LDAPClient.java | LDAPClient.modifydn | public void modifydn(String dn, String attributes) throws NamingException {
DirContext ctx = new InitialDirContext(env);
ctx.rename(dn, attributes);
ctx.close();
} | java | public void modifydn(String dn, String attributes) throws NamingException {
DirContext ctx = new InitialDirContext(env);
ctx.rename(dn, attributes);
ctx.close();
} | [
"public",
"void",
"modifydn",
"(",
"String",
"dn",
",",
"String",
"attributes",
")",
"throws",
"NamingException",
"{",
"DirContext",
"ctx",
"=",
"new",
"InitialDirContext",
"(",
"env",
")",
";",
"ctx",
".",
"rename",
"(",
"dn",
",",
"attributes",
")",
";",... | modifies distinguished name attribute for LDAP entries on LDAP server
@param dn
@param attributes
@throws NamingException | [
"modifies",
"distinguished",
"name",
"attribute",
"for",
"LDAP",
"entries",
"on",
"LDAP",
"server"
] | 29b153fc4e126e5edb97da937f2ee2e231b87593 | https://github.com/lucee/Lucee/blob/29b153fc4e126e5edb97da937f2ee2e231b87593/core/src/main/java/lucee/runtime/net/ldap/LDAPClient.java#L203-L207 |
30,862 | lucee/Lucee | core/src/main/java/lucee/runtime/spooler/SpoolerEngineImpl.java | SpoolerEngineImpl.execute | @Override
public PageException execute(String id) {
SpoolerTask task = getTaskById(openDirectory, id);
if (task == null) task = getTaskById(closedDirectory, id);
if (task != null) {
return execute(task);
}
return null;
} | java | @Override
public PageException execute(String id) {
SpoolerTask task = getTaskById(openDirectory, id);
if (task == null) task = getTaskById(closedDirectory, id);
if (task != null) {
return execute(task);
}
return null;
} | [
"@",
"Override",
"public",
"PageException",
"execute",
"(",
"String",
"id",
")",
"{",
"SpoolerTask",
"task",
"=",
"getTaskById",
"(",
"openDirectory",
",",
"id",
")",
";",
"if",
"(",
"task",
"==",
"null",
")",
"task",
"=",
"getTaskById",
"(",
"closedDirect... | execute task by id and return eror throwd by task
@param id | [
"execute",
"task",
"by",
"id",
"and",
"return",
"eror",
"throwd",
"by",
"task"
] | 29b153fc4e126e5edb97da937f2ee2e231b87593 | https://github.com/lucee/Lucee/blob/29b153fc4e126e5edb97da937f2ee2e231b87593/core/src/main/java/lucee/runtime/spooler/SpoolerEngineImpl.java#L575-L583 |
30,863 | lucee/Lucee | core/src/main/java/lucee/runtime/net/smtp/SMTPClient.java | SMTPClient.add | protected static InternetAddress[] add(InternetAddress[] oldArr, InternetAddress newValue) {
if (oldArr == null) return new InternetAddress[] { newValue };
// else {
InternetAddress[] tmp = new InternetAddress[oldArr.length + 1];
for (int i = 0; i < oldArr.length; i++) {
tmp[i] = oldArr[i];
}
tmp[oldArr.length] = newValue;
return tmp;
// }
} | java | protected static InternetAddress[] add(InternetAddress[] oldArr, InternetAddress newValue) {
if (oldArr == null) return new InternetAddress[] { newValue };
// else {
InternetAddress[] tmp = new InternetAddress[oldArr.length + 1];
for (int i = 0; i < oldArr.length; i++) {
tmp[i] = oldArr[i];
}
tmp[oldArr.length] = newValue;
return tmp;
// }
} | [
"protected",
"static",
"InternetAddress",
"[",
"]",
"add",
"(",
"InternetAddress",
"[",
"]",
"oldArr",
",",
"InternetAddress",
"newValue",
")",
"{",
"if",
"(",
"oldArr",
"==",
"null",
")",
"return",
"new",
"InternetAddress",
"[",
"]",
"{",
"newValue",
"}",
... | creates a new expanded array and return it;
@param oldArr
@param newValue
@return new expanded array | [
"creates",
"a",
"new",
"expanded",
"array",
"and",
"return",
"it",
";"
] | 29b153fc4e126e5edb97da937f2ee2e231b87593 | https://github.com/lucee/Lucee/blob/29b153fc4e126e5edb97da937f2ee2e231b87593/core/src/main/java/lucee/runtime/net/smtp/SMTPClient.java#L368-L378 |
30,864 | lucee/Lucee | core/src/main/java/lucee/runtime/net/smtp/SMTPClient.java | SMTPClient.clean | private static void clean(Config config, Attachment[] attachmentz) {
if (attachmentz != null) for (int i = 0; i < attachmentz.length; i++) {
if (attachmentz[i].isRemoveAfterSend()) {
Resource res = config.getResource(attachmentz[i].getAbsolutePath());
ResourceUtil.removeEL(res, true);
}
}
} | java | private static void clean(Config config, Attachment[] attachmentz) {
if (attachmentz != null) for (int i = 0; i < attachmentz.length; i++) {
if (attachmentz[i].isRemoveAfterSend()) {
Resource res = config.getResource(attachmentz[i].getAbsolutePath());
ResourceUtil.removeEL(res, true);
}
}
} | [
"private",
"static",
"void",
"clean",
"(",
"Config",
"config",
",",
"Attachment",
"[",
"]",
"attachmentz",
")",
"{",
"if",
"(",
"attachmentz",
"!=",
"null",
")",
"for",
"(",
"int",
"i",
"=",
"0",
";",
"i",
"<",
"attachmentz",
".",
"length",
";",
"i",... | remove all atttachements that are marked to remove | [
"remove",
"all",
"atttachements",
"that",
"are",
"marked",
"to",
"remove"
] | 29b153fc4e126e5edb97da937f2ee2e231b87593 | https://github.com/lucee/Lucee/blob/29b153fc4e126e5edb97da937f2ee2e231b87593/core/src/main/java/lucee/runtime/net/smtp/SMTPClient.java#L925-L932 |
30,865 | lucee/Lucee | core/src/main/java/lucee/commons/lock/rw/RWKeyLock.java | RWKeyLock.isWriteLocked | public Boolean isWriteLocked(K token) {
RWLock<K> lock = locks.get(token);
if (lock == null) return null;
return lock.isWriteLocked();
} | java | public Boolean isWriteLocked(K token) {
RWLock<K> lock = locks.get(token);
if (lock == null) return null;
return lock.isWriteLocked();
} | [
"public",
"Boolean",
"isWriteLocked",
"(",
"K",
"token",
")",
"{",
"RWLock",
"<",
"K",
">",
"lock",
"=",
"locks",
".",
"get",
"(",
"token",
")",
";",
"if",
"(",
"lock",
"==",
"null",
")",
"return",
"null",
";",
"return",
"lock",
".",
"isWriteLocked",... | Queries if the write lock is held by any thread on given lock token, returns null when lock with
this token does not exists
@param token name of the lock to check
@return | [
"Queries",
"if",
"the",
"write",
"lock",
"is",
"held",
"by",
"any",
"thread",
"on",
"given",
"lock",
"token",
"returns",
"null",
"when",
"lock",
"with",
"this",
"token",
"does",
"not",
"exists"
] | 29b153fc4e126e5edb97da937f2ee2e231b87593 | https://github.com/lucee/Lucee/blob/29b153fc4e126e5edb97da937f2ee2e231b87593/core/src/main/java/lucee/commons/lock/rw/RWKeyLock.java#L111-L115 |
30,866 | lucee/Lucee | core/src/main/java/lucee/commons/i18n/FormatUtil.java | FormatUtil.getCFMLFormats | public static DateFormat[] getCFMLFormats(TimeZone tz, boolean lenient) {
String id = "cfml-" + Locale.ENGLISH.toString() + "-" + tz.getID() + "-" + lenient;
DateFormat[] df = formats.get(id);
if (df == null) {
df = new SimpleDateFormat[] { new SimpleDateFormat("EEE MMM dd HH:mm:ss z yyyy", Locale.ENGLISH), new SimpleDateFormat("MMMM dd, yyyy HH:mm:ss a zzz", Locale.ENGLISH),
new SimpleDateFormat("MMM dd, yyyy HH:mm:ss a", Locale.ENGLISH), new SimpleDateFormat("MMM dd, yyyy HH:mm:ss", Locale.ENGLISH),
new SimpleDateFormat("MMMM d yyyy HH:mm:ssZ", Locale.ENGLISH), new SimpleDateFormat("MMMM d yyyy HH:mm:ss", Locale.ENGLISH),
new SimpleDateFormat("MMMM d yyyy HH:mm", Locale.ENGLISH), new SimpleDateFormat("EEE, MMM dd, yyyy HH:mm:ssZ", Locale.ENGLISH),
new SimpleDateFormat("EEE, MMM dd, yyyy HH:mm:ss", Locale.ENGLISH), new SimpleDateFormat("EEEE, MMMM dd, yyyy H:mm:ss a zzz", Locale.ENGLISH),
new SimpleDateFormat("dd-MMM-yy HH:mm a", Locale.ENGLISH), new SimpleDateFormat("dd-MMMM-yy HH:mm a", Locale.ENGLISH),
new SimpleDateFormat("EE, dd-MMM-yyyy HH:mm:ss zz", Locale.ENGLISH), new SimpleDateFormat("EE, dd MMM yyyy HH:mm:ss zz", Locale.ENGLISH),
new SimpleDateFormat("EEE d, MMM yyyy HH:mm:ss zz", Locale.ENGLISH), new SimpleDateFormat("dd-MMM-yyyy", Locale.ENGLISH),
new SimpleDateFormat("MMMM, dd yyyy HH:mm:ssZ", Locale.ENGLISH), new SimpleDateFormat("MMMM, dd yyyy HH:mm:ss", Locale.ENGLISH),
new SimpleDateFormat("yyyy/MM/dd HH:mm:ss zz", Locale.ENGLISH), new SimpleDateFormat("dd MMM yyyy HH:mm:ss zz", Locale.ENGLISH),
new SimpleDateFormat("EEE MMM dd yyyy HH:mm:ss 'GMT'ZZ (z)", Locale.ENGLISH), new SimpleDateFormat("dd MMM, yyyy HH:mm:ss", Locale.ENGLISH)
// ,new SimpleDateFormat("yyyy-MM-dd'T'HH:mm:ss",Locale.ENGLISH)
};
for (int i = 0; i < df.length; i++) {
df[i].setLenient(lenient);
df[i].setTimeZone(tz);
}
formats.put(id, df);
}
return clone(df);
} | java | public static DateFormat[] getCFMLFormats(TimeZone tz, boolean lenient) {
String id = "cfml-" + Locale.ENGLISH.toString() + "-" + tz.getID() + "-" + lenient;
DateFormat[] df = formats.get(id);
if (df == null) {
df = new SimpleDateFormat[] { new SimpleDateFormat("EEE MMM dd HH:mm:ss z yyyy", Locale.ENGLISH), new SimpleDateFormat("MMMM dd, yyyy HH:mm:ss a zzz", Locale.ENGLISH),
new SimpleDateFormat("MMM dd, yyyy HH:mm:ss a", Locale.ENGLISH), new SimpleDateFormat("MMM dd, yyyy HH:mm:ss", Locale.ENGLISH),
new SimpleDateFormat("MMMM d yyyy HH:mm:ssZ", Locale.ENGLISH), new SimpleDateFormat("MMMM d yyyy HH:mm:ss", Locale.ENGLISH),
new SimpleDateFormat("MMMM d yyyy HH:mm", Locale.ENGLISH), new SimpleDateFormat("EEE, MMM dd, yyyy HH:mm:ssZ", Locale.ENGLISH),
new SimpleDateFormat("EEE, MMM dd, yyyy HH:mm:ss", Locale.ENGLISH), new SimpleDateFormat("EEEE, MMMM dd, yyyy H:mm:ss a zzz", Locale.ENGLISH),
new SimpleDateFormat("dd-MMM-yy HH:mm a", Locale.ENGLISH), new SimpleDateFormat("dd-MMMM-yy HH:mm a", Locale.ENGLISH),
new SimpleDateFormat("EE, dd-MMM-yyyy HH:mm:ss zz", Locale.ENGLISH), new SimpleDateFormat("EE, dd MMM yyyy HH:mm:ss zz", Locale.ENGLISH),
new SimpleDateFormat("EEE d, MMM yyyy HH:mm:ss zz", Locale.ENGLISH), new SimpleDateFormat("dd-MMM-yyyy", Locale.ENGLISH),
new SimpleDateFormat("MMMM, dd yyyy HH:mm:ssZ", Locale.ENGLISH), new SimpleDateFormat("MMMM, dd yyyy HH:mm:ss", Locale.ENGLISH),
new SimpleDateFormat("yyyy/MM/dd HH:mm:ss zz", Locale.ENGLISH), new SimpleDateFormat("dd MMM yyyy HH:mm:ss zz", Locale.ENGLISH),
new SimpleDateFormat("EEE MMM dd yyyy HH:mm:ss 'GMT'ZZ (z)", Locale.ENGLISH), new SimpleDateFormat("dd MMM, yyyy HH:mm:ss", Locale.ENGLISH)
// ,new SimpleDateFormat("yyyy-MM-dd'T'HH:mm:ss",Locale.ENGLISH)
};
for (int i = 0; i < df.length; i++) {
df[i].setLenient(lenient);
df[i].setTimeZone(tz);
}
formats.put(id, df);
}
return clone(df);
} | [
"public",
"static",
"DateFormat",
"[",
"]",
"getCFMLFormats",
"(",
"TimeZone",
"tz",
",",
"boolean",
"lenient",
")",
"{",
"String",
"id",
"=",
"\"cfml-\"",
"+",
"Locale",
".",
"ENGLISH",
".",
"toString",
"(",
")",
"+",
"\"-\"",
"+",
"tz",
".",
"getID",
... | CFML Supported LS Formats
@param locale
@param tz
@param lenient
@return | [
"CFML",
"Supported",
"LS",
"Formats"
] | 29b153fc4e126e5edb97da937f2ee2e231b87593 | https://github.com/lucee/Lucee/blob/29b153fc4e126e5edb97da937f2ee2e231b87593/core/src/main/java/lucee/commons/i18n/FormatUtil.java#L246-L271 |
30,867 | lucee/Lucee | core/src/main/java/lucee/runtime/tag/Directory.java | Directory.setMode | public void setMode(String mode) throws PageException {
try {
this.mode = ModeUtil.toOctalMode(mode);
}
catch (IOException e) {
throw Caster.toPageException(e);
}
} | java | public void setMode(String mode) throws PageException {
try {
this.mode = ModeUtil.toOctalMode(mode);
}
catch (IOException e) {
throw Caster.toPageException(e);
}
} | [
"public",
"void",
"setMode",
"(",
"String",
"mode",
")",
"throws",
"PageException",
"{",
"try",
"{",
"this",
".",
"mode",
"=",
"ModeUtil",
".",
"toOctalMode",
"(",
"mode",
")",
";",
"}",
"catch",
"(",
"IOException",
"e",
")",
"{",
"throw",
"Caster",
".... | set the value mode Used with action = "Create" to define the permissions for a directory on UNIX
and Linux platforms. Ignored on Windows. Options correspond to the octal values of the UNIX chmod
command. From left to right, permissions are assigned for owner, group, and other.
@param mode value to set
@throws PageException | [
"set",
"the",
"value",
"mode",
"Used",
"with",
"action",
"=",
"Create",
"to",
"define",
"the",
"permissions",
"for",
"a",
"directory",
"on",
"UNIX",
"and",
"Linux",
"platforms",
".",
"Ignored",
"on",
"Windows",
".",
"Options",
"correspond",
"to",
"the",
"o... | 29b153fc4e126e5edb97da937f2ee2e231b87593 | https://github.com/lucee/Lucee/blob/29b153fc4e126e5edb97da937f2ee2e231b87593/core/src/main/java/lucee/runtime/tag/Directory.java#L318-L325 |
30,868 | lucee/Lucee | core/src/main/java/lucee/runtime/tag/Directory.java | Directory.setNameconflict | public void setNameconflict(String nameconflict) throws ApplicationException {
this.nameconflict = FileUtil.toNameConflict(nameconflict, NAMECONFLICT_UNDEFINED | NAMECONFLICT_ERROR | NAMECONFLICT_OVERWRITE, NAMECONFLICT_DEFAULT);
} | java | public void setNameconflict(String nameconflict) throws ApplicationException {
this.nameconflict = FileUtil.toNameConflict(nameconflict, NAMECONFLICT_UNDEFINED | NAMECONFLICT_ERROR | NAMECONFLICT_OVERWRITE, NAMECONFLICT_DEFAULT);
} | [
"public",
"void",
"setNameconflict",
"(",
"String",
"nameconflict",
")",
"throws",
"ApplicationException",
"{",
"this",
".",
"nameconflict",
"=",
"FileUtil",
".",
"toNameConflict",
"(",
"nameconflict",
",",
"NAMECONFLICT_UNDEFINED",
"|",
"NAMECONFLICT_ERROR",
"|",
"NA... | set the value nameconflict Action to take if destination directory is the same as that of a file
in the directory.
@param nameconflict value to set
@throws ApplicationException | [
"set",
"the",
"value",
"nameconflict",
"Action",
"to",
"take",
"if",
"destination",
"directory",
"is",
"the",
"same",
"as",
"that",
"of",
"a",
"file",
"in",
"the",
"directory",
"."
] | 29b153fc4e126e5edb97da937f2ee2e231b87593 | https://github.com/lucee/Lucee/blob/29b153fc4e126e5edb97da937f2ee2e231b87593/core/src/main/java/lucee/runtime/tag/Directory.java#L366-L369 |
30,869 | lucee/Lucee | core/src/main/java/lucee/runtime/tag/Directory.java | Directory.actionRename | public static void actionRename(PageContext pc, Resource directory, String strNewdirectory, String serverPassword, boolean createPath, Object acl, String storage)
throws PageException {
// check directory
SecurityManager securityManager = pc.getConfig().getSecurityManager();
securityManager.checkFileLocation(pc.getConfig(), directory, serverPassword);
if (!directory.exists()) throw new ApplicationException("the directory [" + directory.toString() + "] doesn't exist");
if (!directory.isDirectory()) throw new ApplicationException("the file [" + directory.toString() + "] exists, but it isn't a directory");
if (!directory.canRead()) throw new ApplicationException("no access to read directory [" + directory.toString() + "]");
if (strNewdirectory == null) throw new ApplicationException("the attribute [newDirectory] is not defined");
// real to source
Resource newdirectory = toDestination(pc, strNewdirectory, directory);
securityManager.checkFileLocation(pc.getConfig(), newdirectory, serverPassword);
if (newdirectory.exists()) throw new ApplicationException("new directory [" + newdirectory.toString() + "] already exists");
if (createPath) {
newdirectory.getParentResource().mkdirs();
}
try {
directory.moveTo(newdirectory);
}
catch (Throwable t) {
ExceptionUtil.rethrowIfNecessary(t);
throw Caster.toPageException(t);
}
// set S3 stuff
setS3Attrs(pc, directory, acl, storage);
} | java | public static void actionRename(PageContext pc, Resource directory, String strNewdirectory, String serverPassword, boolean createPath, Object acl, String storage)
throws PageException {
// check directory
SecurityManager securityManager = pc.getConfig().getSecurityManager();
securityManager.checkFileLocation(pc.getConfig(), directory, serverPassword);
if (!directory.exists()) throw new ApplicationException("the directory [" + directory.toString() + "] doesn't exist");
if (!directory.isDirectory()) throw new ApplicationException("the file [" + directory.toString() + "] exists, but it isn't a directory");
if (!directory.canRead()) throw new ApplicationException("no access to read directory [" + directory.toString() + "]");
if (strNewdirectory == null) throw new ApplicationException("the attribute [newDirectory] is not defined");
// real to source
Resource newdirectory = toDestination(pc, strNewdirectory, directory);
securityManager.checkFileLocation(pc.getConfig(), newdirectory, serverPassword);
if (newdirectory.exists()) throw new ApplicationException("new directory [" + newdirectory.toString() + "] already exists");
if (createPath) {
newdirectory.getParentResource().mkdirs();
}
try {
directory.moveTo(newdirectory);
}
catch (Throwable t) {
ExceptionUtil.rethrowIfNecessary(t);
throw Caster.toPageException(t);
}
// set S3 stuff
setS3Attrs(pc, directory, acl, storage);
} | [
"public",
"static",
"void",
"actionRename",
"(",
"PageContext",
"pc",
",",
"Resource",
"directory",
",",
"String",
"strNewdirectory",
",",
"String",
"serverPassword",
",",
"boolean",
"createPath",
",",
"Object",
"acl",
",",
"String",
"storage",
")",
"throws",
"P... | rename a directory to a new Name
@throws PageException | [
"rename",
"a",
"directory",
"to",
"a",
"new",
"Name"
] | 29b153fc4e126e5edb97da937f2ee2e231b87593 | https://github.com/lucee/Lucee/blob/29b153fc4e126e5edb97da937f2ee2e231b87593/core/src/main/java/lucee/runtime/tag/Directory.java#L737-L769 |
30,870 | lucee/Lucee | core/src/main/java/lucee/commons/lang/CharBuffer.java | CharBuffer.append | public void append(String str) {
if (str == null) return;
int restLength = buffer.length - pos;
if (str.length() < restLength) {
str.getChars(0, str.length(), buffer, pos);
pos += str.length();
}
else {
str.getChars(0, restLength, buffer, pos);
curr.next = new Entity(buffer);
curr = curr.next;
length += buffer.length;
buffer = new char[(buffer.length > str.length() - restLength) ? buffer.length : str.length() - restLength];
str.getChars(restLength, str.length(), buffer, 0);
pos = str.length() - restLength;
}
} | java | public void append(String str) {
if (str == null) return;
int restLength = buffer.length - pos;
if (str.length() < restLength) {
str.getChars(0, str.length(), buffer, pos);
pos += str.length();
}
else {
str.getChars(0, restLength, buffer, pos);
curr.next = new Entity(buffer);
curr = curr.next;
length += buffer.length;
buffer = new char[(buffer.length > str.length() - restLength) ? buffer.length : str.length() - restLength];
str.getChars(restLength, str.length(), buffer, 0);
pos = str.length() - restLength;
}
} | [
"public",
"void",
"append",
"(",
"String",
"str",
")",
"{",
"if",
"(",
"str",
"==",
"null",
")",
"return",
";",
"int",
"restLength",
"=",
"buffer",
".",
"length",
"-",
"pos",
";",
"if",
"(",
"str",
".",
"length",
"(",
")",
"<",
"restLength",
")",
... | Method to append a string to char buffer
@param str String to append | [
"Method",
"to",
"append",
"a",
"string",
"to",
"char",
"buffer"
] | 29b153fc4e126e5edb97da937f2ee2e231b87593 | https://github.com/lucee/Lucee/blob/29b153fc4e126e5edb97da937f2ee2e231b87593/core/src/main/java/lucee/commons/lang/CharBuffer.java#L116-L134 |
30,871 | lucee/Lucee | core/src/main/java/lucee/commons/lang/CharBuffer.java | CharBuffer.toCharArray | public char[] toCharArray() {
Entity e = root;
char[] chrs = new char[size()];
int off = 0;
while (e.next != null) {
e = e.next;
System.arraycopy(e.data, 0, chrs, off, e.data.length);
off += e.data.length;
}
System.arraycopy(buffer, 0, chrs, off, pos);
return chrs;
} | java | public char[] toCharArray() {
Entity e = root;
char[] chrs = new char[size()];
int off = 0;
while (e.next != null) {
e = e.next;
System.arraycopy(e.data, 0, chrs, off, e.data.length);
off += e.data.length;
}
System.arraycopy(buffer, 0, chrs, off, pos);
return chrs;
} | [
"public",
"char",
"[",
"]",
"toCharArray",
"(",
")",
"{",
"Entity",
"e",
"=",
"root",
";",
"char",
"[",
"]",
"chrs",
"=",
"new",
"char",
"[",
"size",
"(",
")",
"]",
";",
"int",
"off",
"=",
"0",
";",
"while",
"(",
"e",
".",
"next",
"!=",
"null... | return content of the Char Buffer as char array
@return char array | [
"return",
"content",
"of",
"the",
"Char",
"Buffer",
"as",
"char",
"array"
] | 29b153fc4e126e5edb97da937f2ee2e231b87593 | https://github.com/lucee/Lucee/blob/29b153fc4e126e5edb97da937f2ee2e231b87593/core/src/main/java/lucee/commons/lang/CharBuffer.java#L193-L204 |
30,872 | lucee/Lucee | core/src/main/java/lucee/commons/lang/CharBuffer.java | CharBuffer.clear | public void clear() {
if (size() == 0) return;
buffer = new char[buffer.length];
root.next = null;
pos = 0;
length = 0;
curr = root;
} | java | public void clear() {
if (size() == 0) return;
buffer = new char[buffer.length];
root.next = null;
pos = 0;
length = 0;
curr = root;
} | [
"public",
"void",
"clear",
"(",
")",
"{",
"if",
"(",
"size",
"(",
")",
"==",
"0",
")",
"return",
";",
"buffer",
"=",
"new",
"char",
"[",
"buffer",
".",
"length",
"]",
";",
"root",
".",
"next",
"=",
"null",
";",
"pos",
"=",
"0",
";",
"length",
... | clear the content of the buffer | [
"clear",
"the",
"content",
"of",
"the",
"buffer"
] | 29b153fc4e126e5edb97da937f2ee2e231b87593 | https://github.com/lucee/Lucee/blob/29b153fc4e126e5edb97da937f2ee2e231b87593/core/src/main/java/lucee/commons/lang/CharBuffer.java#L214-L221 |
30,873 | lucee/Lucee | core/src/main/java/lucee/runtime/tag/Ftp.java | Ftp.actionExistsDir | private AFTPClient actionExistsDir() throws PageException, IOException {
required("directory", directory);
AFTPClient client = getClient();
boolean res = existsDir(client, directory);
Struct cfftp = writeCfftp(client);
cfftp.setEL(RETURN_VALUE, Caster.toBoolean(res));
cfftp.setEL(SUCCEEDED, Boolean.TRUE);
stoponerror = false;
return client;
} | java | private AFTPClient actionExistsDir() throws PageException, IOException {
required("directory", directory);
AFTPClient client = getClient();
boolean res = existsDir(client, directory);
Struct cfftp = writeCfftp(client);
cfftp.setEL(RETURN_VALUE, Caster.toBoolean(res));
cfftp.setEL(SUCCEEDED, Boolean.TRUE);
stoponerror = false;
return client;
} | [
"private",
"AFTPClient",
"actionExistsDir",
"(",
")",
"throws",
"PageException",
",",
"IOException",
"{",
"required",
"(",
"\"directory\"",
",",
"directory",
")",
";",
"AFTPClient",
"client",
"=",
"getClient",
"(",
")",
";",
"boolean",
"res",
"=",
"existsDir",
... | check if a directory exists or not
@return FTPCLient
@throws PageException
@throws IOException | [
"check",
"if",
"a",
"directory",
"exists",
"or",
"not"
] | 29b153fc4e126e5edb97da937f2ee2e231b87593 | https://github.com/lucee/Lucee/blob/29b153fc4e126e5edb97da937f2ee2e231b87593/core/src/main/java/lucee/runtime/tag/Ftp.java#L219-L231 |
30,874 | lucee/Lucee | core/src/main/java/lucee/runtime/tag/Ftp.java | Ftp.actionExistsFile | private AFTPClient actionExistsFile() throws PageException, IOException {
required("remotefile", remotefile);
AFTPClient client = getClient();
FTPFile file = existsFile(client, remotefile, true);
Struct cfftp = writeCfftp(client);
cfftp.setEL(RETURN_VALUE, Caster.toBoolean(file != null && file.isFile()));
cfftp.setEL(SUCCEEDED, Boolean.TRUE);
stoponerror = false;
return client;
} | java | private AFTPClient actionExistsFile() throws PageException, IOException {
required("remotefile", remotefile);
AFTPClient client = getClient();
FTPFile file = existsFile(client, remotefile, true);
Struct cfftp = writeCfftp(client);
cfftp.setEL(RETURN_VALUE, Caster.toBoolean(file != null && file.isFile()));
cfftp.setEL(SUCCEEDED, Boolean.TRUE);
stoponerror = false;
return client;
} | [
"private",
"AFTPClient",
"actionExistsFile",
"(",
")",
"throws",
"PageException",
",",
"IOException",
"{",
"required",
"(",
"\"remotefile\"",
",",
"remotefile",
")",
";",
"AFTPClient",
"client",
"=",
"getClient",
"(",
")",
";",
"FTPFile",
"file",
"=",
"existsFil... | check if a file exists or not
@return FTPCLient
@throws IOException
@throws PageException | [
"check",
"if",
"a",
"file",
"exists",
"or",
"not"
] | 29b153fc4e126e5edb97da937f2ee2e231b87593 | https://github.com/lucee/Lucee/blob/29b153fc4e126e5edb97da937f2ee2e231b87593/core/src/main/java/lucee/runtime/tag/Ftp.java#L240-L253 |
30,875 | lucee/Lucee | core/src/main/java/lucee/runtime/tag/Ftp.java | Ftp.actionExists | private AFTPClient actionExists() throws PageException, IOException {
required("item", item);
AFTPClient client = getClient();
FTPFile file = existsFile(client, item, false);
Struct cfftp = writeCfftp(client);
cfftp.setEL(RETURN_VALUE, Caster.toBoolean(file != null));
cfftp.setEL(SUCCEEDED, Boolean.TRUE);
return client;
} | java | private AFTPClient actionExists() throws PageException, IOException {
required("item", item);
AFTPClient client = getClient();
FTPFile file = existsFile(client, item, false);
Struct cfftp = writeCfftp(client);
cfftp.setEL(RETURN_VALUE, Caster.toBoolean(file != null));
cfftp.setEL(SUCCEEDED, Boolean.TRUE);
return client;
} | [
"private",
"AFTPClient",
"actionExists",
"(",
")",
"throws",
"PageException",
",",
"IOException",
"{",
"required",
"(",
"\"item\"",
",",
"item",
")",
";",
"AFTPClient",
"client",
"=",
"getClient",
"(",
")",
";",
"FTPFile",
"file",
"=",
"existsFile",
"(",
"cl... | check if a file or directory exists
@return FTPCLient
@throws PageException
@throws IOException | [
"check",
"if",
"a",
"file",
"or",
"directory",
"exists"
] | 29b153fc4e126e5edb97da937f2ee2e231b87593 | https://github.com/lucee/Lucee/blob/29b153fc4e126e5edb97da937f2ee2e231b87593/core/src/main/java/lucee/runtime/tag/Ftp.java#L262-L273 |
30,876 | lucee/Lucee | core/src/main/java/lucee/runtime/tag/Ftp.java | Ftp.actionRemove | private AFTPClient actionRemove() throws IOException, PageException {
required("item", item);
AFTPClient client = getClient();
client.deleteFile(item);
writeCfftp(client);
return client;
} | java | private AFTPClient actionRemove() throws IOException, PageException {
required("item", item);
AFTPClient client = getClient();
client.deleteFile(item);
writeCfftp(client);
return client;
} | [
"private",
"AFTPClient",
"actionRemove",
"(",
")",
"throws",
"IOException",
",",
"PageException",
"{",
"required",
"(",
"\"item\"",
",",
"item",
")",
";",
"AFTPClient",
"client",
"=",
"getClient",
"(",
")",
";",
"client",
".",
"deleteFile",
"(",
"item",
")",... | removes a file on the server
@return FTPCLient
@throws IOException
@throws PageException | [
"removes",
"a",
"file",
"on",
"the",
"server"
] | 29b153fc4e126e5edb97da937f2ee2e231b87593 | https://github.com/lucee/Lucee/blob/29b153fc4e126e5edb97da937f2ee2e231b87593/core/src/main/java/lucee/runtime/tag/Ftp.java#L359-L366 |
30,877 | lucee/Lucee | core/src/main/java/lucee/runtime/tag/Ftp.java | Ftp.actionRename | private AFTPClient actionRename() throws PageException, IOException {
required("existing", existing);
required("new", _new);
AFTPClient client = getClient();
client.rename(existing, _new);
writeCfftp(client);
return client;
} | java | private AFTPClient actionRename() throws PageException, IOException {
required("existing", existing);
required("new", _new);
AFTPClient client = getClient();
client.rename(existing, _new);
writeCfftp(client);
return client;
} | [
"private",
"AFTPClient",
"actionRename",
"(",
")",
"throws",
"PageException",
",",
"IOException",
"{",
"required",
"(",
"\"existing\"",
",",
"existing",
")",
";",
"required",
"(",
"\"new\"",
",",
"_new",
")",
";",
"AFTPClient",
"client",
"=",
"getClient",
"(",... | rename a file on the server
@return FTPCLient
@throws PageException
@throws IOException | [
"rename",
"a",
"file",
"on",
"the",
"server"
] | 29b153fc4e126e5edb97da937f2ee2e231b87593 | https://github.com/lucee/Lucee/blob/29b153fc4e126e5edb97da937f2ee2e231b87593/core/src/main/java/lucee/runtime/tag/Ftp.java#L375-L384 |
30,878 | lucee/Lucee | core/src/main/java/lucee/runtime/tag/Ftp.java | Ftp.actionPutFile | private AFTPClient actionPutFile() throws IOException, PageException {
required("remotefile", remotefile);
required("localfile", localfile);
AFTPClient client = getClient();
Resource local = ResourceUtil.toResourceExisting(pageContext, localfile);// new File(localfile);
// if(failifexists && local.exists()) throw new ApplicationException("File ["+local+"] already
// exist, if you want to overwrite, set attribute
// failIfExists to false");
InputStream is = null;
try {
is = IOUtil.toBufferedInputStream(local.getInputStream());
client.setFileType(getType(local));
client.storeFile(remotefile, is);
}
finally {
IOUtil.closeEL(is);
}
writeCfftp(client);
return client;
} | java | private AFTPClient actionPutFile() throws IOException, PageException {
required("remotefile", remotefile);
required("localfile", localfile);
AFTPClient client = getClient();
Resource local = ResourceUtil.toResourceExisting(pageContext, localfile);// new File(localfile);
// if(failifexists && local.exists()) throw new ApplicationException("File ["+local+"] already
// exist, if you want to overwrite, set attribute
// failIfExists to false");
InputStream is = null;
try {
is = IOUtil.toBufferedInputStream(local.getInputStream());
client.setFileType(getType(local));
client.storeFile(remotefile, is);
}
finally {
IOUtil.closeEL(is);
}
writeCfftp(client);
return client;
} | [
"private",
"AFTPClient",
"actionPutFile",
"(",
")",
"throws",
"IOException",
",",
"PageException",
"{",
"required",
"(",
"\"remotefile\"",
",",
"remotefile",
")",
";",
"required",
"(",
"\"localfile\"",
",",
"localfile",
")",
";",
"AFTPClient",
"client",
"=",
"ge... | copy a local file to server
@return FTPClient
@throws IOException
@throws PageException | [
"copy",
"a",
"local",
"file",
"to",
"server"
] | 29b153fc4e126e5edb97da937f2ee2e231b87593 | https://github.com/lucee/Lucee/blob/29b153fc4e126e5edb97da937f2ee2e231b87593/core/src/main/java/lucee/runtime/tag/Ftp.java#L393-L415 |
30,879 | lucee/Lucee | core/src/main/java/lucee/runtime/tag/Ftp.java | Ftp.actionGetFile | private AFTPClient actionGetFile() throws PageException, IOException {
required("remotefile", remotefile);
required("localfile", localfile);
AFTPClient client = getClient();
Resource local = ResourceUtil.toResourceExistingParent(pageContext, localfile);// new File(localfile);
pageContext.getConfig().getSecurityManager().checkFileLocation(local);
if (failifexists && local.exists()) throw new ApplicationException("File [" + local + "] already exist, if you want to overwrite, set attribute failIfExists to false");
OutputStream fos = null;
client.setFileType(getType(local));
boolean success = false;
try {
fos = IOUtil.toBufferedOutputStream(local.getOutputStream());
success = client.retrieveFile(remotefile, fos);
}
finally {
IOUtil.closeEL(fos);
if (!success) local.delete();
}
writeCfftp(client);
return client;
} | java | private AFTPClient actionGetFile() throws PageException, IOException {
required("remotefile", remotefile);
required("localfile", localfile);
AFTPClient client = getClient();
Resource local = ResourceUtil.toResourceExistingParent(pageContext, localfile);// new File(localfile);
pageContext.getConfig().getSecurityManager().checkFileLocation(local);
if (failifexists && local.exists()) throw new ApplicationException("File [" + local + "] already exist, if you want to overwrite, set attribute failIfExists to false");
OutputStream fos = null;
client.setFileType(getType(local));
boolean success = false;
try {
fos = IOUtil.toBufferedOutputStream(local.getOutputStream());
success = client.retrieveFile(remotefile, fos);
}
finally {
IOUtil.closeEL(fos);
if (!success) local.delete();
}
writeCfftp(client);
return client;
} | [
"private",
"AFTPClient",
"actionGetFile",
"(",
")",
"throws",
"PageException",
",",
"IOException",
"{",
"required",
"(",
"\"remotefile\"",
",",
"remotefile",
")",
";",
"required",
"(",
"\"localfile\"",
",",
"localfile",
")",
";",
"AFTPClient",
"client",
"=",
"ge... | gets a file from server and copy it local
@return FTPCLient
@throws PageException
@throws IOException | [
"gets",
"a",
"file",
"from",
"server",
"and",
"copy",
"it",
"local"
] | 29b153fc4e126e5edb97da937f2ee2e231b87593 | https://github.com/lucee/Lucee/blob/29b153fc4e126e5edb97da937f2ee2e231b87593/core/src/main/java/lucee/runtime/tag/Ftp.java#L424-L446 |
30,880 | lucee/Lucee | core/src/main/java/lucee/runtime/tag/Ftp.java | Ftp.actionGetCurrentURL | private AFTPClient actionGetCurrentURL() throws PageException, IOException {
AFTPClient client = getClient();
String pwd = client.printWorkingDirectory();
Struct cfftp = writeCfftp(client);
cfftp.setEL("returnValue", client.getPrefix() + "://" + client.getRemoteAddress().getHostName() + pwd);
return client;
} | java | private AFTPClient actionGetCurrentURL() throws PageException, IOException {
AFTPClient client = getClient();
String pwd = client.printWorkingDirectory();
Struct cfftp = writeCfftp(client);
cfftp.setEL("returnValue", client.getPrefix() + "://" + client.getRemoteAddress().getHostName() + pwd);
return client;
} | [
"private",
"AFTPClient",
"actionGetCurrentURL",
"(",
")",
"throws",
"PageException",
",",
"IOException",
"{",
"AFTPClient",
"client",
"=",
"getClient",
"(",
")",
";",
"String",
"pwd",
"=",
"client",
".",
"printWorkingDirectory",
"(",
")",
";",
"Struct",
"cfftp",... | get url of the working directory
@return FTPCLient
@throws IOException
@throws PageException | [
"get",
"url",
"of",
"the",
"working",
"directory"
] | 29b153fc4e126e5edb97da937f2ee2e231b87593 | https://github.com/lucee/Lucee/blob/29b153fc4e126e5edb97da937f2ee2e231b87593/core/src/main/java/lucee/runtime/tag/Ftp.java#L455-L461 |
30,881 | lucee/Lucee | core/src/main/java/lucee/runtime/tag/Ftp.java | Ftp.actionGetCurrentDir | private AFTPClient actionGetCurrentDir() throws PageException, IOException {
AFTPClient client = getClient();
String pwd = client.printWorkingDirectory();
Struct cfftp = writeCfftp(client);
cfftp.setEL("returnValue", pwd);
return client;
} | java | private AFTPClient actionGetCurrentDir() throws PageException, IOException {
AFTPClient client = getClient();
String pwd = client.printWorkingDirectory();
Struct cfftp = writeCfftp(client);
cfftp.setEL("returnValue", pwd);
return client;
} | [
"private",
"AFTPClient",
"actionGetCurrentDir",
"(",
")",
"throws",
"PageException",
",",
"IOException",
"{",
"AFTPClient",
"client",
"=",
"getClient",
"(",
")",
";",
"String",
"pwd",
"=",
"client",
".",
"printWorkingDirectory",
"(",
")",
";",
"Struct",
"cfftp",... | get path from the working directory
@return FTPCLient
@throws IOException
@throws PageException | [
"get",
"path",
"from",
"the",
"working",
"directory"
] | 29b153fc4e126e5edb97da937f2ee2e231b87593 | https://github.com/lucee/Lucee/blob/29b153fc4e126e5edb97da937f2ee2e231b87593/core/src/main/java/lucee/runtime/tag/Ftp.java#L470-L476 |
30,882 | lucee/Lucee | core/src/main/java/lucee/runtime/tag/Ftp.java | Ftp.actionChangeDir | private AFTPClient actionChangeDir() throws IOException, PageException {
required("directory", directory);
AFTPClient client = getClient();
client.changeWorkingDirectory(directory);
writeCfftp(client);
return client;
} | java | private AFTPClient actionChangeDir() throws IOException, PageException {
required("directory", directory);
AFTPClient client = getClient();
client.changeWorkingDirectory(directory);
writeCfftp(client);
return client;
} | [
"private",
"AFTPClient",
"actionChangeDir",
"(",
")",
"throws",
"IOException",
",",
"PageException",
"{",
"required",
"(",
"\"directory\"",
",",
"directory",
")",
";",
"AFTPClient",
"client",
"=",
"getClient",
"(",
")",
";",
"client",
".",
"changeWorkingDirectory"... | change working directory
@return FTPCLient
@throws IOException
@throws PageException | [
"change",
"working",
"directory"
] | 29b153fc4e126e5edb97da937f2ee2e231b87593 | https://github.com/lucee/Lucee/blob/29b153fc4e126e5edb97da937f2ee2e231b87593/core/src/main/java/lucee/runtime/tag/Ftp.java#L485-L492 |
30,883 | lucee/Lucee | core/src/main/java/lucee/runtime/tag/Ftp.java | Ftp.actionRemoveDir | private AFTPClient actionRemoveDir() throws IOException, PageException {
required("directory", directory);
AFTPClient client = getClient();
if (recursive) {
removeRecursive(client, directory, FTPFile.DIRECTORY_TYPE);
}
else client.removeDirectory(directory);
writeCfftp(client);
return client;
} | java | private AFTPClient actionRemoveDir() throws IOException, PageException {
required("directory", directory);
AFTPClient client = getClient();
if (recursive) {
removeRecursive(client, directory, FTPFile.DIRECTORY_TYPE);
}
else client.removeDirectory(directory);
writeCfftp(client);
return client;
} | [
"private",
"AFTPClient",
"actionRemoveDir",
"(",
")",
"throws",
"IOException",
",",
"PageException",
"{",
"required",
"(",
"\"directory\"",
",",
"directory",
")",
";",
"AFTPClient",
"client",
"=",
"getClient",
"(",
")",
";",
"if",
"(",
"recursive",
")",
"{",
... | removes a remote directory on server
@return FTPCLient
@throws IOException
@throws PageException | [
"removes",
"a",
"remote",
"directory",
"on",
"server"
] | 29b153fc4e126e5edb97da937f2ee2e231b87593 | https://github.com/lucee/Lucee/blob/29b153fc4e126e5edb97da937f2ee2e231b87593/core/src/main/java/lucee/runtime/tag/Ftp.java#L505-L516 |
30,884 | lucee/Lucee | core/src/main/java/lucee/runtime/tag/Ftp.java | Ftp.actionCreateDir | private AFTPClient actionCreateDir() throws IOException, PageException {
required("directory", directory);
AFTPClient client = getClient();
client.makeDirectory(directory);
writeCfftp(client);
return client;
} | java | private AFTPClient actionCreateDir() throws IOException, PageException {
required("directory", directory);
AFTPClient client = getClient();
client.makeDirectory(directory);
writeCfftp(client);
return client;
} | [
"private",
"AFTPClient",
"actionCreateDir",
"(",
")",
"throws",
"IOException",
",",
"PageException",
"{",
"required",
"(",
"\"directory\"",
",",
"directory",
")",
";",
"AFTPClient",
"client",
"=",
"getClient",
"(",
")",
";",
"client",
".",
"makeDirectory",
"(",
... | create a remote directory
@return FTPCLient
@throws IOException
@throws PageException | [
"create",
"a",
"remote",
"directory"
] | 29b153fc4e126e5edb97da937f2ee2e231b87593 | https://github.com/lucee/Lucee/blob/29b153fc4e126e5edb97da937f2ee2e231b87593/core/src/main/java/lucee/runtime/tag/Ftp.java#L545-L552 |
30,885 | lucee/Lucee | core/src/main/java/lucee/runtime/tag/Ftp.java | Ftp.actionListDir | private AFTPClient actionListDir() throws PageException, IOException {
required("name", name);
required("directory", directory);
AFTPClient client = getClient();
FTPFile[] files = client.listFiles(directory);
if (files == null) files = new FTPFile[0];
pageContext.setVariable(name, toQuery(files, "ftp", directory, client.getRemoteAddress().getHostName()));
writeCfftp(client);
return client;
} | java | private AFTPClient actionListDir() throws PageException, IOException {
required("name", name);
required("directory", directory);
AFTPClient client = getClient();
FTPFile[] files = client.listFiles(directory);
if (files == null) files = new FTPFile[0];
pageContext.setVariable(name, toQuery(files, "ftp", directory, client.getRemoteAddress().getHostName()));
writeCfftp(client);
return client;
} | [
"private",
"AFTPClient",
"actionListDir",
"(",
")",
"throws",
"PageException",
",",
"IOException",
"{",
"required",
"(",
"\"name\"",
",",
"name",
")",
";",
"required",
"(",
"\"directory\"",
",",
"directory",
")",
";",
"AFTPClient",
"client",
"=",
"getClient",
... | List data of a ftp connection
@return FTPCLient
@throws PageException
@throws IOException | [
"List",
"data",
"of",
"a",
"ftp",
"connection"
] | 29b153fc4e126e5edb97da937f2ee2e231b87593 | https://github.com/lucee/Lucee/blob/29b153fc4e126e5edb97da937f2ee2e231b87593/core/src/main/java/lucee/runtime/tag/Ftp.java#L561-L572 |
30,886 | lucee/Lucee | core/src/main/java/lucee/runtime/tag/Ftp.java | Ftp.actionOpen | private AFTPClient actionOpen() throws IOException, PageException {
required("server", server);
required("username", username);
// required("password", password);
AFTPClient client = getClient();
writeCfftp(client);
return client;
} | java | private AFTPClient actionOpen() throws IOException, PageException {
required("server", server);
required("username", username);
// required("password", password);
AFTPClient client = getClient();
writeCfftp(client);
return client;
} | [
"private",
"AFTPClient",
"actionOpen",
"(",
")",
"throws",
"IOException",
",",
"PageException",
"{",
"required",
"(",
"\"server\"",
",",
"server",
")",
";",
"required",
"(",
"\"username\"",
",",
"username",
")",
";",
"// required(\"password\", password);",
"AFTPClie... | Opens a FTP Connection
@return FTPCLinet
@throws IOException
@throws PageException | [
"Opens",
"a",
"FTP",
"Connection"
] | 29b153fc4e126e5edb97da937f2ee2e231b87593 | https://github.com/lucee/Lucee/blob/29b153fc4e126e5edb97da937f2ee2e231b87593/core/src/main/java/lucee/runtime/tag/Ftp.java#L614-L622 |
30,887 | lucee/Lucee | core/src/main/java/lucee/runtime/tag/Ftp.java | Ftp.actionClose | private AFTPClient actionClose() throws PageException {
FTPConnection conn = _createConnection();
AFTPClient client = pool.remove(conn);
Struct cfftp = writeCfftp(client);
cfftp.setEL("succeeded", Caster.toBoolean(client != null));
return client;
} | java | private AFTPClient actionClose() throws PageException {
FTPConnection conn = _createConnection();
AFTPClient client = pool.remove(conn);
Struct cfftp = writeCfftp(client);
cfftp.setEL("succeeded", Caster.toBoolean(client != null));
return client;
} | [
"private",
"AFTPClient",
"actionClose",
"(",
")",
"throws",
"PageException",
"{",
"FTPConnection",
"conn",
"=",
"_createConnection",
"(",
")",
";",
"AFTPClient",
"client",
"=",
"pool",
".",
"remove",
"(",
"conn",
")",
";",
"Struct",
"cfftp",
"=",
"writeCfftp",... | close a existing ftp connection
@return FTPCLient
@throws PageException | [
"close",
"a",
"existing",
"ftp",
"connection"
] | 29b153fc4e126e5edb97da937f2ee2e231b87593 | https://github.com/lucee/Lucee/blob/29b153fc4e126e5edb97da937f2ee2e231b87593/core/src/main/java/lucee/runtime/tag/Ftp.java#L630-L637 |
30,888 | lucee/Lucee | core/src/main/java/lucee/runtime/tag/Ftp.java | Ftp.writeCfftp | private Struct writeCfftp(AFTPClient client) throws PageException {
Struct cfftp = new StructImpl();
if (result == null) pageContext.variablesScope().setEL(CFFTP, cfftp);
else pageContext.setVariable(result, cfftp);
if (client == null) {
cfftp.setEL(SUCCEEDED, Boolean.FALSE);
cfftp.setEL(ERROR_CODE, new Double(-1));
cfftp.setEL(ERROR_TEXT, "");
cfftp.setEL(RETURN_VALUE, "");
return cfftp;
}
int repCode = client.getReplyCode();
String repStr = client.getReplyString();
cfftp.setEL(ERROR_CODE, new Double(repCode));
cfftp.setEL(ERROR_TEXT, repStr);
cfftp.setEL(SUCCEEDED, Caster.toBoolean(client.isPositiveCompletion()));
cfftp.setEL(RETURN_VALUE, repStr);
return cfftp;
} | java | private Struct writeCfftp(AFTPClient client) throws PageException {
Struct cfftp = new StructImpl();
if (result == null) pageContext.variablesScope().setEL(CFFTP, cfftp);
else pageContext.setVariable(result, cfftp);
if (client == null) {
cfftp.setEL(SUCCEEDED, Boolean.FALSE);
cfftp.setEL(ERROR_CODE, new Double(-1));
cfftp.setEL(ERROR_TEXT, "");
cfftp.setEL(RETURN_VALUE, "");
return cfftp;
}
int repCode = client.getReplyCode();
String repStr = client.getReplyString();
cfftp.setEL(ERROR_CODE, new Double(repCode));
cfftp.setEL(ERROR_TEXT, repStr);
cfftp.setEL(SUCCEEDED, Caster.toBoolean(client.isPositiveCompletion()));
cfftp.setEL(RETURN_VALUE, repStr);
return cfftp;
} | [
"private",
"Struct",
"writeCfftp",
"(",
"AFTPClient",
"client",
")",
"throws",
"PageException",
"{",
"Struct",
"cfftp",
"=",
"new",
"StructImpl",
"(",
")",
";",
"if",
"(",
"result",
"==",
"null",
")",
"pageContext",
".",
"variablesScope",
"(",
")",
".",
"s... | writes cfftp variable
@param client
@return FTPCLient
@throws PageException | [
"writes",
"cfftp",
"variable"
] | 29b153fc4e126e5edb97da937f2ee2e231b87593 | https://github.com/lucee/Lucee/blob/29b153fc4e126e5edb97da937f2ee2e231b87593/core/src/main/java/lucee/runtime/tag/Ftp.java#L658-L678 |
30,889 | lucee/Lucee | core/src/main/java/lucee/runtime/tag/Ftp.java | Ftp.checkCompletion | private boolean checkCompletion(AFTPClient client) throws ApplicationException {
boolean isPositiveCompletion = client.isPositiveCompletion();
if (isPositiveCompletion) return false;
if (count++ < retrycount) return true;
if (stoponerror) {
throw new lucee.runtime.exp.FTPException(action, client);
}
return false;
} | java | private boolean checkCompletion(AFTPClient client) throws ApplicationException {
boolean isPositiveCompletion = client.isPositiveCompletion();
if (isPositiveCompletion) return false;
if (count++ < retrycount) return true;
if (stoponerror) {
throw new lucee.runtime.exp.FTPException(action, client);
}
return false;
} | [
"private",
"boolean",
"checkCompletion",
"(",
"AFTPClient",
"client",
")",
"throws",
"ApplicationException",
"{",
"boolean",
"isPositiveCompletion",
"=",
"client",
".",
"isPositiveCompletion",
"(",
")",
";",
"if",
"(",
"isPositiveCompletion",
")",
"return",
"false",
... | check completion status of the client
@param client
@return FTPCLient
@throws ApplicationException | [
"check",
"completion",
"status",
"of",
"the",
"client"
] | 29b153fc4e126e5edb97da937f2ee2e231b87593 | https://github.com/lucee/Lucee/blob/29b153fc4e126e5edb97da937f2ee2e231b87593/core/src/main/java/lucee/runtime/tag/Ftp.java#L687-L696 |
30,890 | lucee/Lucee | core/src/main/java/lucee/runtime/tag/Ftp.java | Ftp.getType | private int getType(Resource file) {
if (transferMode == FTPConstant.TRANSFER_MODE_BINARY) return AFTPClient.FILE_TYPE_BINARY;
else if (transferMode == FTPConstant.TRANSFER_MODE_ASCCI) return AFTPClient.FILE_TYPE_TEXT;
else {
String ext = ResourceUtil.getExtension(file, null);
if (ext == null || ListUtil.listContainsNoCase(ASCIIExtensionList, ext, ";", true, false) == -1) return AFTPClient.FILE_TYPE_BINARY;
return AFTPClient.FILE_TYPE_TEXT;
}
} | java | private int getType(Resource file) {
if (transferMode == FTPConstant.TRANSFER_MODE_BINARY) return AFTPClient.FILE_TYPE_BINARY;
else if (transferMode == FTPConstant.TRANSFER_MODE_ASCCI) return AFTPClient.FILE_TYPE_TEXT;
else {
String ext = ResourceUtil.getExtension(file, null);
if (ext == null || ListUtil.listContainsNoCase(ASCIIExtensionList, ext, ";", true, false) == -1) return AFTPClient.FILE_TYPE_BINARY;
return AFTPClient.FILE_TYPE_TEXT;
}
} | [
"private",
"int",
"getType",
"(",
"Resource",
"file",
")",
"{",
"if",
"(",
"transferMode",
"==",
"FTPConstant",
".",
"TRANSFER_MODE_BINARY",
")",
"return",
"AFTPClient",
".",
"FILE_TYPE_BINARY",
";",
"else",
"if",
"(",
"transferMode",
"==",
"FTPConstant",
".",
... | get FTP. ... _FILE_TYPE
@param file
@return type | [
"get",
"FTP",
".",
"...",
"_FILE_TYPE"
] | 29b153fc4e126e5edb97da937f2ee2e231b87593 | https://github.com/lucee/Lucee/blob/29b153fc4e126e5edb97da937f2ee2e231b87593/core/src/main/java/lucee/runtime/tag/Ftp.java#L704-L712 |
30,891 | lucee/Lucee | core/src/main/java/lucee/transformer/bytecode/statement/Condition.java | Condition.addElseIf | public Pair addElseIf(ExprBoolean condition, Statement body, Position start, Position end) {
Pair pair;
ifs.add(pair = new Pair(condition, body, start, end));
body.setParent(this);
return pair;
} | java | public Pair addElseIf(ExprBoolean condition, Statement body, Position start, Position end) {
Pair pair;
ifs.add(pair = new Pair(condition, body, start, end));
body.setParent(this);
return pair;
} | [
"public",
"Pair",
"addElseIf",
"(",
"ExprBoolean",
"condition",
",",
"Statement",
"body",
",",
"Position",
"start",
",",
"Position",
"end",
")",
"{",
"Pair",
"pair",
";",
"ifs",
".",
"add",
"(",
"pair",
"=",
"new",
"Pair",
"(",
"condition",
",",
"body",
... | adds a else statement
@param condition
@param body | [
"adds",
"a",
"else",
"statement"
] | 29b153fc4e126e5edb97da937f2ee2e231b87593 | https://github.com/lucee/Lucee/blob/29b153fc4e126e5edb97da937f2ee2e231b87593/core/src/main/java/lucee/transformer/bytecode/statement/Condition.java#L75-L80 |
30,892 | lucee/Lucee | core/src/main/java/lucee/transformer/bytecode/statement/Condition.java | Condition.setElse | public Pair setElse(Statement body, Position start, Position end) {
_else = new Pair(null, body, start, end);
body.setParent(this);
return _else;
} | java | public Pair setElse(Statement body, Position start, Position end) {
_else = new Pair(null, body, start, end);
body.setParent(this);
return _else;
} | [
"public",
"Pair",
"setElse",
"(",
"Statement",
"body",
",",
"Position",
"start",
",",
"Position",
"end",
")",
"{",
"_else",
"=",
"new",
"Pair",
"(",
"null",
",",
"body",
",",
"start",
",",
"end",
")",
";",
"body",
".",
"setParent",
"(",
"this",
")",
... | sets the else Block of the condition
@param body | [
"sets",
"the",
"else",
"Block",
"of",
"the",
"condition"
] | 29b153fc4e126e5edb97da937f2ee2e231b87593 | https://github.com/lucee/Lucee/blob/29b153fc4e126e5edb97da937f2ee2e231b87593/core/src/main/java/lucee/transformer/bytecode/statement/Condition.java#L87-L91 |
30,893 | lucee/Lucee | core/src/main/java/lucee/runtime/type/util/StructUtil.java | StructUtil.copy | public static void copy(Struct source, Struct target, boolean overwrite) {
Iterator<Entry<Key, Object>> it = source.entryIterator();
Entry<Key, Object> e;
while (it.hasNext()) {
e = it.next();
if (overwrite || !target.containsKey(e.getKey())) target.setEL(e.getKey(), e.getValue());
}
} | java | public static void copy(Struct source, Struct target, boolean overwrite) {
Iterator<Entry<Key, Object>> it = source.entryIterator();
Entry<Key, Object> e;
while (it.hasNext()) {
e = it.next();
if (overwrite || !target.containsKey(e.getKey())) target.setEL(e.getKey(), e.getValue());
}
} | [
"public",
"static",
"void",
"copy",
"(",
"Struct",
"source",
",",
"Struct",
"target",
",",
"boolean",
"overwrite",
")",
"{",
"Iterator",
"<",
"Entry",
"<",
"Key",
",",
"Object",
">",
">",
"it",
"=",
"source",
".",
"entryIterator",
"(",
")",
";",
"Entry... | copy data from source struct to target struct
@param source
@param target
@param overwrite overwrite data if exist in target | [
"copy",
"data",
"from",
"source",
"struct",
"to",
"target",
"struct"
] | 29b153fc4e126e5edb97da937f2ee2e231b87593 | https://github.com/lucee/Lucee/blob/29b153fc4e126e5edb97da937f2ee2e231b87593/core/src/main/java/lucee/runtime/type/util/StructUtil.java#L68-L75 |
30,894 | lucee/Lucee | core/src/main/java/lucee/runtime/type/util/StructUtil.java | StructUtil.values | public static java.util.Collection<?> values(Struct sct) {
ArrayList<Object> arr = new ArrayList<Object>();
// Key[] keys = sct.keys();
Iterator<Object> it = sct.valueIterator();
while (it.hasNext()) {
arr.add(it.next());
}
return arr;
} | java | public static java.util.Collection<?> values(Struct sct) {
ArrayList<Object> arr = new ArrayList<Object>();
// Key[] keys = sct.keys();
Iterator<Object> it = sct.valueIterator();
while (it.hasNext()) {
arr.add(it.next());
}
return arr;
} | [
"public",
"static",
"java",
".",
"util",
".",
"Collection",
"<",
"?",
">",
"values",
"(",
"Struct",
"sct",
")",
"{",
"ArrayList",
"<",
"Object",
">",
"arr",
"=",
"new",
"ArrayList",
"<",
"Object",
">",
"(",
")",
";",
"// Key[] keys = sct.keys();",
"Itera... | create a value return value out of a struct
@param sct
@return | [
"create",
"a",
"value",
"return",
"value",
"out",
"of",
"a",
"struct"
] | 29b153fc4e126e5edb97da937f2ee2e231b87593 | https://github.com/lucee/Lucee/blob/29b153fc4e126e5edb97da937f2ee2e231b87593/core/src/main/java/lucee/runtime/type/util/StructUtil.java#L193-L201 |
30,895 | lucee/Lucee | core/src/main/java/lucee/runtime/type/util/StructUtil.java | StructUtil.sizeOf | public static long sizeOf(Struct sct) {
Iterator<Entry<Key, Object>> it = sct.entryIterator();
Entry<Key, Object> e;
long size = 0;
while (it.hasNext()) {
e = it.next();
size += SizeOf.size(e.getKey());
size += SizeOf.size(e.getValue());
}
return size;
} | java | public static long sizeOf(Struct sct) {
Iterator<Entry<Key, Object>> it = sct.entryIterator();
Entry<Key, Object> e;
long size = 0;
while (it.hasNext()) {
e = it.next();
size += SizeOf.size(e.getKey());
size += SizeOf.size(e.getValue());
}
return size;
} | [
"public",
"static",
"long",
"sizeOf",
"(",
"Struct",
"sct",
")",
"{",
"Iterator",
"<",
"Entry",
"<",
"Key",
",",
"Object",
">",
">",
"it",
"=",
"sct",
".",
"entryIterator",
"(",
")",
";",
"Entry",
"<",
"Key",
",",
"Object",
">",
"e",
";",
"long",
... | return the size of given struct, size of values + keys
@param sct
@return | [
"return",
"the",
"size",
"of",
"given",
"struct",
"size",
"of",
"values",
"+",
"keys"
] | 29b153fc4e126e5edb97da937f2ee2e231b87593 | https://github.com/lucee/Lucee/blob/29b153fc4e126e5edb97da937f2ee2e231b87593/core/src/main/java/lucee/runtime/type/util/StructUtil.java#L220-L230 |
30,896 | lucee/Lucee | core/src/main/java/lucee/runtime/type/util/StructUtil.java | StructUtil.removeValue | public static void removeValue(Map map, Object value) {
Iterator it = map.entrySet().iterator();
Map.Entry entry;
while (it.hasNext()) {
entry = (Entry) it.next();
if (entry.getValue() == value) it.remove();
}
} | java | public static void removeValue(Map map, Object value) {
Iterator it = map.entrySet().iterator();
Map.Entry entry;
while (it.hasNext()) {
entry = (Entry) it.next();
if (entry.getValue() == value) it.remove();
}
} | [
"public",
"static",
"void",
"removeValue",
"(",
"Map",
"map",
",",
"Object",
"value",
")",
"{",
"Iterator",
"it",
"=",
"map",
".",
"entrySet",
"(",
")",
".",
"iterator",
"(",
")",
";",
"Map",
".",
"Entry",
"entry",
";",
"while",
"(",
"it",
".",
"ha... | remove every entry hat has this value
@param map
@param obj | [
"remove",
"every",
"entry",
"hat",
"has",
"this",
"value"
] | 29b153fc4e126e5edb97da937f2ee2e231b87593 | https://github.com/lucee/Lucee/blob/29b153fc4e126e5edb97da937f2ee2e231b87593/core/src/main/java/lucee/runtime/type/util/StructUtil.java#L246-L253 |
30,897 | lucee/Lucee | core/src/main/java/lucee/transformer/bytecode/statement/tag/TagOutput.java | TagOutput.writeOutTypeNormal | private void writeOutTypeNormal(BytecodeContext bc) throws TransformerException {
ParseBodyVisitor pbv = new ParseBodyVisitor();
pbv.visitBegin(bc);
getBody().writeOut(bc);
pbv.visitEnd(bc);
} | java | private void writeOutTypeNormal(BytecodeContext bc) throws TransformerException {
ParseBodyVisitor pbv = new ParseBodyVisitor();
pbv.visitBegin(bc);
getBody().writeOut(bc);
pbv.visitEnd(bc);
} | [
"private",
"void",
"writeOutTypeNormal",
"(",
"BytecodeContext",
"bc",
")",
"throws",
"TransformerException",
"{",
"ParseBodyVisitor",
"pbv",
"=",
"new",
"ParseBodyVisitor",
"(",
")",
";",
"pbv",
".",
"visitBegin",
"(",
"bc",
")",
";",
"getBody",
"(",
")",
"."... | write out normal query
@param adapter
@throws TemplateException | [
"write",
"out",
"normal",
"query"
] | 29b153fc4e126e5edb97da937f2ee2e231b87593 | https://github.com/lucee/Lucee/blob/29b153fc4e126e5edb97da937f2ee2e231b87593/core/src/main/java/lucee/transformer/bytecode/statement/tag/TagOutput.java#L100-L105 |
30,898 | lucee/Lucee | core/src/main/java/lucee/runtime/tag/Table.java | Table.setQuery | public void setQuery(String query) throws PageException {
this.query = Caster.toQuery(pageContext.getVariable(query));
} | java | public void setQuery(String query) throws PageException {
this.query = Caster.toQuery(pageContext.getVariable(query));
} | [
"public",
"void",
"setQuery",
"(",
"String",
"query",
")",
"throws",
"PageException",
"{",
"this",
".",
"query",
"=",
"Caster",
".",
"toQuery",
"(",
"pageContext",
".",
"getVariable",
"(",
"query",
")",
")",
";",
"}"
] | set the value query Name of the cfquery from which to draw data.
@param query value to set
@throws PageException | [
"set",
"the",
"value",
"query",
"Name",
"of",
"the",
"cfquery",
"from",
"which",
"to",
"draw",
"data",
"."
] | 29b153fc4e126e5edb97da937f2ee2e231b87593 | https://github.com/lucee/Lucee/blob/29b153fc4e126e5edb97da937f2ee2e231b87593/core/src/main/java/lucee/runtime/tag/Table.java#L113-L115 |
30,899 | ronmamo/reflections | src/main/java/org/reflections/Reflections.java | Reflections.merge | public Reflections merge(final Reflections reflections) {
if (reflections.store != null) {
for (String indexName : reflections.store.keySet()) {
Multimap<String, String> index = reflections.store.get(indexName);
for (String key : index.keySet()) {
for (String string : index.get(key)) {
store.getOrCreate(indexName).put(key, string);
}
}
}
}
return this;
} | java | public Reflections merge(final Reflections reflections) {
if (reflections.store != null) {
for (String indexName : reflections.store.keySet()) {
Multimap<String, String> index = reflections.store.get(indexName);
for (String key : index.keySet()) {
for (String string : index.get(key)) {
store.getOrCreate(indexName).put(key, string);
}
}
}
}
return this;
} | [
"public",
"Reflections",
"merge",
"(",
"final",
"Reflections",
"reflections",
")",
"{",
"if",
"(",
"reflections",
".",
"store",
"!=",
"null",
")",
"{",
"for",
"(",
"String",
"indexName",
":",
"reflections",
".",
"store",
".",
"keySet",
"(",
")",
")",
"{"... | merges a Reflections instance metadata into this instance | [
"merges",
"a",
"Reflections",
"instance",
"metadata",
"into",
"this",
"instance"
] | 084cf4a759a06d88e88753ac00397478c2e0ed52 | https://github.com/ronmamo/reflections/blob/084cf4a759a06d88e88753ac00397478c2e0ed52/src/main/java/org/reflections/Reflections.java#L356-L368 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.