_id stringlengths 2 7 | title stringlengths 3 140 | partition stringclasses 3
values | text stringlengths 73 34.1k | language stringclasses 1
value | meta_information dict |
|---|---|---|---|---|---|
q24800 | Schedule.setEndtime | train | public void setEndtime(Object endtime) throws PageException {
if (StringUtil.isEmpty(endtime)) return;
this.endtime = DateCaster.toTime(pageContext.getTimeZone(), endtime);
} | java | {
"resource": ""
} |
q24801 | Schedule.setOperation | train | public void setOperation(String operation) throws ApplicationException {
if (StringUtil.isEmpty(operation)) return;
operation = operation.toLowerCase().trim();
if (!operation.equals("httprequest")) throw new ApplicationException("attribute operation must have the value [HTTPRequest]");
} | java | {
"resource": ""
} |
q24802 | Schedule.setInterval | train | public void setInterval(String interval) {
if (StringUtil.isEmpty(interval)) return;
interval = interval.trim().toLowerCase();
if (interval.equals("week")) this.interval = "weekly";
else if (interval.equals("day")) this.interval = "daily";
else if (interval.equals("month")) this.interval = "monthly";
else if (int... | java | {
"resource": ""
} |
q24803 | Schedule.setRequesttimeout | train | public void setRequesttimeout(Object oRequesttimeout) throws PageException {
if (StringUtil.isEmpty(oRequesttimeout)) return;
this.requesttimeout = Caster.toLongValue(oRequesttimeout) * 1000L;
} | java | {
"resource": ""
} |
q24804 | CFMLExpressionInterpreter.negateMinusOp | train | private Ref negateMinusOp() throws PageException {
// And Operation
if (cfml.forwardIfCurrent('-')) {
if (cfml.forwardIfCurrent('-')) {
cfml.removeSpace();
Ref expr = clip();
Ref res = preciseMath ? new BigMinus(expr, new LNumber(new Double(1)), limited) : new Minus(expr, new LNumber(new Double(1)), limite... | java | {
"resource": ""
} |
q24805 | Base64Encoder.encode | train | public static String encode(byte[] data) {
StringBuilder builder = new StringBuilder();
for (int position = 0; position < data.length; position += 3) {
builder.append(encodeGroup(data, position));
}
return builder.toString();
} | java | {
"resource": ""
} |
q24806 | Base64Encoder.encodeGroup | train | private static char[] encodeGroup(byte[] data, int position) {
final char[] c = new char[] { '=', '=', '=', '=' };
int b1 = 0, b2 = 0, b3 = 0;
int length = data.length - position;
if (length == 0) return c;
if (length >= 1) {
b1 = (data[position]) & 0xFF;
}
if (length >= 2) {
b2 = (data[position + 1]... | java | {
"resource": ""
} |
q24807 | DeployHandler.deploy | train | public static void deploy(Config config) {
if (!contextIsValid(config)) return;
synchronized (config) {
Resource dir = config.getDeployDirectory();
if (!dir.exists()) dir.mkdirs();
Resource[] children = dir.listResources(ALL_EXT);
Resource child;
String ext;
for (int i = 0; i < childre... | java | {
"resource": ""
} |
q24808 | AbstractCaptcha.generate | train | public BufferedImage generate(String text, int width, int height, String[] fonts, boolean useAntiAlias, Color fontColor, int fontSize, int difficulty) throws CaptchaException {
if (difficulty == DIFFICULTY_LOW) {
return generate(text, width, height, fonts, useAntiAlias, fontColor, fontSize, 0, 0, 0, 0, 0, 0, 230,... | java | {
"resource": ""
} |
q24809 | ArgumentImpl.getE | train | @Override
public Object getE(int intKey) throws PageException {
Iterator it = valueIterator();// getMap().keySet().iterator();
int count = 0;
Object o;
while (it.hasNext()) {
o = it.next();
if ((++count) == intKey) {
return o;// super.get(o.toString());
}
}
throw new ExpressionException("inva... | java | {
"resource": ""
} |
q24810 | ArgumentImpl.toStruct | train | public static Struct toStruct(Argument arg) {
Struct trg = new StructImpl();
StructImpl.copy(arg, trg, false);
return trg;
} | java | {
"resource": ""
} |
q24811 | ArgumentImpl.toArray | train | public static Array toArray(Argument arg) {
ArrayImpl trg = new ArrayImpl();
int[] keys = arg.intKeys();
for (int i = 0; i < keys.length; i++) {
trg.setEL(keys[i], arg.get(keys[i], null));
}
return trg;
} | java | {
"resource": ""
} |
q24812 | StructSupport.invalidKey | train | public static ExpressionException invalidKey(Config config, Struct sct, Key key, String in) {
String appendix = StringUtil.isEmpty(in, true) ? "" : " in the " + in;
Iterator<Key> it = sct.keyIterator();
Key k;
while (it.hasNext()) {
k = it.next();
if (k.equals(key)) return new ExpressionException("the va... | java | {
"resource": ""
} |
q24813 | HeapDumper.dumpTo | train | public static void dumpTo(Resource res, boolean live) throws IOException {
MBeanServer mbserver = ManagementFactory.getPlatformMBeanServer();
HotSpotDiagnosticMXBean mxbean = ManagementFactory.newPlatformMXBeanProxy(mbserver, "com.sun.management:type=HotSpotDiagnostic", HotSpotDiagnosticMXBean.class);
String path;
... | java | {
"resource": ""
} |
q24814 | HTTPEngine4Impl.get | train | public static HTTPResponse get(URL url, String username, String password, long timeout, boolean redirect, String charset, String useragent, ProxyData proxy,
lucee.commons.net.http.Header[] headers) throws IOException {
HttpGet get = new HttpGet(url.toExternalForm());
return _invoke(url, get, username, password, ... | java | {
"resource": ""
} |
q24815 | HTTPEngine4Impl.put | train | public static HTTPResponse put(URL url, String username, String password, long timeout, boolean redirect, String mimetype, String charset, String useragent, ProxyData proxy,
lucee.commons.net.http.Header[] headers, Object body) throws IOException {
HttpPut put = new HttpPut(url.toExternalForm());
setBody(put, bo... | java | {
"resource": ""
} |
q24816 | HTTPEngine4Impl.toHttpEntity | train | private static HttpEntity toHttpEntity(Object value, String mimetype, String charset) throws IOException {
if (value instanceof HttpEntity) return (HttpEntity) value;
// content type
ContentType ct = HTTPEngine.toContentType(mimetype, charset);
try {
if (value instanceof TemporaryStream) {
if (ct != null) r... | java | {
"resource": ""
} |
q24817 | Execute.setArguments | train | public void setArguments(Object args) {
if (args instanceof lucee.runtime.type.Collection) {
StringBuilder sb = new StringBuilder();
lucee.runtime.type.Collection coll = (lucee.runtime.type.Collection) args;
// lucee.runtime.type.Collection.Key[] keys=coll.keys();
Iterator<Object> it = coll.valueI... | java | {
"resource": ""
} |
q24818 | Execute.setTimeout | train | public void setTimeout(double timeout) throws ApplicationException {
if (timeout < 0) throw new ApplicationException("value must be a positive number now [" + Caster.toString(timeout) + "]");
this.timeout = (long) (timeout * 1000L);
} | java | {
"resource": ""
} |
q24819 | Execute.setOutputfile | train | public void setOutputfile(String outputfile) {
try {
this.outputfile = ResourceUtil.toResourceExistingParent(pageContext, outputfile);
pageContext.getConfig().getSecurityManager().checkFileLocation(this.outputfile);
}
catch (PageException e) {
this.outputfile = pageContext.getConfig().getTempDirector... | java | {
"resource": ""
} |
q24820 | SystemUtil.isFSCaseSensitive | train | public static boolean isFSCaseSensitive() {
if (isFSCaseSensitive == null) {
try {
_isFSCaseSensitive(File.createTempFile("abcx", "txt"));
}
catch (IOException e) {
File f = new File("abcx.txt").getAbsoluteFile();
try {
f.createNewFile();
_isFSCaseSensitive(f);
}
catch (IOExceptio... | java | {
"resource": ""
} |
q24821 | SystemUtil.getHomeDirectory | train | public static Resource getHomeDirectory() {
if (homeFile != null) return homeFile;
ResourceProvider frp = ResourcesImpl.getFileResourceProvider();
String homeStr = System.getProperty("user.home");
if (homeStr != null) {
homeFile = frp.getResource(homeStr);
homeFile = ResourceUtil.getCanonicalResourceEL(... | java | {
"resource": ""
} |
q24822 | SystemUtil.getOSArch | train | public static int getOSArch() {
if (osArch == -1) {
osArch = toIntArch(System.getProperty("os.arch.data.model"));
if (osArch == ARCH_UNKNOW) osArch = toIntArch(System.getProperty("os.arch"));
}
return osArch;
} | java | {
"resource": ""
} |
q24823 | SystemUtil.getSystemPropOrEnvVar | train | public static String getSystemPropOrEnvVar(String name, String defaultValue) {
// env
String value = System.getenv(name);
if (!StringUtil.isEmpty(value)) return value;
// prop
value = System.getProperty(name);
if (!StringUtil.isEmpty(value)) return value;
// env 2
name = convertSystemPropToEnvVar(name);
valu... | java | {
"resource": ""
} |
q24824 | SystemUtil.arePathsSame | train | public static boolean arePathsSame(String path1, String path2) {
if (StringUtil.isEmpty(path1, true) || StringUtil.isEmpty(path2, true)) return false;
String p1 = path1.replace('\\', '/');
String p2 = path2.replace('\\', '/');
if (p1.endsWith("/") && !p2.endsWith("/")) p2 = p2 + "/";
else if (p2.endsWith("/") &... | java | {
"resource": ""
} |
q24825 | TagLib.getExprTransfomer | train | public ExprTransformer getExprTransfomer() throws TagLibException {
// Class cls;
if (exprTransformer != null) return exprTransformer;
try {
exprTransformer = (ExprTransformer) ClassUtil.loadInstance(ELClass.getClazz());
// exprTransformer = (ExprTransformer) cls.newInstance();
}
catch (Exception e) {
... | java | {
"resource": ""
} |
q24826 | TagLib.setTag | train | public void setTag(TagLibTag tag) {
tag.setTagLib(this);
tags.put(tag.getName(), tag);
if (tag.hasAppendix()) appendixTags.put(tag.getName(), tag);
else if (appendixTags.containsKey(tag.getName())) appendixTags.remove(tag.getName());
} | java | {
"resource": ""
} |
q24827 | TagLib.setELClass | train | protected void setELClass(String eLClass, Identification id, Attributes attributes) {
this.ELClass = ClassDefinitionImpl.toClassDefinition(eLClass, id, attributes);
} | java | {
"resource": ""
} |
q24828 | TagLib.duplicate | train | public TagLib duplicate(boolean deepCopy) {
TagLib tl = new TagLib(isCore);
tl.appendixTags = duplicate(this.appendixTags, deepCopy);
tl.displayName = this.displayName;
tl.ELClass = this.ELClass;
tl.exprTransformer = this.exprTransformer;
tl.isCore = this.isCore;
tl.nameSpace = this.nameSpace;
tl.nameSpaceAndNa... | java | {
"resource": ""
} |
q24829 | TagLib.duplicate | train | private HashMap<String, TagLibTag> duplicate(HashMap<String, TagLibTag> tags, boolean deepCopy) {
if (deepCopy) throw new PageRuntimeException(new ExpressionException("deep copy not supported"));
Iterator<Entry<String, TagLibTag>> it = tags.entrySet().iterator();
HashMap<String, TagLibTag> cm = new HashMap<String, ... | java | {
"resource": ""
} |
q24830 | ExceptionUtil.similarKeyMessage | train | public static String similarKeyMessage(Collection.Key[] _keys, String keySearched, String keyLabel, String keyLabels, String in, boolean listAll) {
String inThe = StringUtil.isEmpty(in, true) ? "" : " in the " + in;
boolean empty = _keys.length == 0;
if (listAll && (_keys.length > 50 || empty)) {
listAll = fa... | java | {
"resource": ""
} |
q24831 | WeakConstructorStorage.getConstructors | train | public Constructor[] getConstructors(Class clazz, int count) {
Array con;
Object o;
synchronized (map) {
o = map.get(clazz);
if (o == null) {
con = store(clazz);
}
else con = (Array) o;
}
o = con.get(count + 1, null);
if (o == null) return null;
return (Constructor[]) o;
} | java | {
"resource": ""
} |
q24832 | WeakConstructorStorage.store | train | private Array store(Class clazz) {
Constructor[] conArr = clazz.getConstructors();
Array args = new ArrayImpl();
for (int i = 0; i < conArr.length; i++) {
storeArgs(conArr[i], args);
}
map.put(clazz, args);
return args;
} | java | {
"resource": ""
} |
q24833 | WeakConstructorStorage.storeArgs | train | private void storeArgs(Constructor constructor, Array conArgs) {
Class[] pmt = constructor.getParameterTypes();
Object o = conArgs.get(pmt.length + 1, null);
Constructor[] args;
if (o == null) {
args = new Constructor[1];
conArgs.setEL(pmt.length + 1, args);
}
else {
Constructor[] cs = (Constructor... | java | {
"resource": ""
} |
q24834 | Search.release | train | @Override
public void release() {
super.release();
type = SearchCollection.SEARCH_TYPE_SIMPLE;
maxrows = -1;
criteria = "";
startrow = 1;
collections = null;
category = EMPTY;
categoryTree = "";
status = null;
suggestions = SUGGESTIONS_NEVER;
contextPassages = 0;
contextBytes = 300;
contextHighlightBe... | java | {
"resource": ""
} |
q24835 | Search.setType | train | public void setType(String type) throws ApplicationException {
if (type == null) return;
type = type.toLowerCase().trim();
if (type.equals("simple")) this.type = SearchCollection.SEARCH_TYPE_SIMPLE;
else if (type.equals("explicit")) this.type = SearchCollection.SEARCH_TYPE_EXPLICIT;
else throw new ApplicationExcep... | java | {
"resource": ""
} |
q24836 | Search.setCollection | train | public void setCollection(String collection) throws PageException {
String[] collNames = ListUtil.toStringArrayTrim(ListUtil.listToArrayRemoveEmpty(collection, ','));
collections = new SearchCollection[collNames.length];
SearchEngine se = pageContext.getConfig().getSearchEngine(pageContext);
try {
for (int i =... | java | {
"resource": ""
} |
q24837 | QueryColumnUtil.reDefineType | train | protected static Object reDefineType(QueryColumnImpl column, Object value) {
column.typeChecked = false;
if (value == null || column.type == Types.OTHER) return value;
if (value instanceof String && ((String) value).isEmpty()) return value;
switch (column.type) {
// Numeric Values
case Types.DOUBLE:
return... | java | {
"resource": ""
} |
q24838 | QueryColumnUtil.reOrganizeType | train | protected static void reOrganizeType(QueryColumnImpl column) {
if ((column.type == Types.OTHER) && !column.typeChecked) {
column.typeChecked = true;
if (column.size() > 0) {
checkOther(column, column.data[0]);
// get Type
for (int i = 1; i < column.size(); i++) {
switch (column.type) {
cas... | java | {
"resource": ""
} |
q24839 | Wrap.wrap | train | public static String wrap(String str, int wrapTextLength) {
if (wrapTextLength <= 0) return str;
StringBuilder rtn = new StringBuilder();
String ls = SystemUtil.getOSSpecificLineSeparator();
Array arr = ListUtil.listToArray(str, ls);
int len = arr.size();
for (int i = 1; i <= len; i++) {
rtn.append(wrapLin... | java | {
"resource": ""
} |
q24840 | EvaluatorSupport.execute | train | @Override
public TagLib execute(Config config, Tag tag, TagLibTag libTag, FunctionLib[] flibs, Data data) throws TemplateException {
return null;
} | java | {
"resource": ""
} |
q24841 | EvaluatorSupport.evaluate | train | @Override
public void evaluate(Tag tag, TagLibTag libTag, FunctionLib[] flibs) throws EvaluatorException {
evaluate(tag);
evaluate(tag, libTag);
} | java | {
"resource": ""
} |
q24842 | StorageUtil.getElement | train | public Element getElement(NodeList list, String key, String value) {
int len = list.getLength();
for (int i = 0; i < len; i++) {
Node n = list.item(i);
if (n instanceof Element) {
Element el = (Element) n;
if (el.getAttribute(key).equalsIgnoreCase(value)) return el;
}
}
return null;
} | java | {
"resource": ""
} |
q24843 | StorageUtil.toDateTime | train | public DateTime toDateTime(Config config, Element el, String attributeName) {
String str = el.getAttribute(attributeName);
if (str == null) return null;
return DateCaster.toDateAdvanced(str, ThreadLocalPageContext.getTimeZone(config), null);
} | java | {
"resource": ""
} |
q24844 | StorageUtil.toDateTime | train | public DateTime toDateTime(Element el, String attributeName, DateTime defaultValue) {
String value = el.getAttribute(attributeName);
if (value == null) return defaultValue;
DateTime dtValue = Caster.toDate(value, false, null, null);
if (dtValue == null) return defaultValue;
return dtValue;
} | java | {
"resource": ""
} |
q24845 | StorageUtil.toDate | train | public Date toDate(Config config, Element el, String attributeName) {
DateTime dt = toDateTime(config, el, attributeName);
if (dt == null) return null;
return new DateImpl(dt);
} | java | {
"resource": ""
} |
q24846 | StorageUtil.toTime | train | public Time toTime(Config config, Element el, String attributeName) {
DateTime dt = toDateTime(config, el, attributeName);
if (dt == null) return null;
return new TimeImpl(dt);
} | java | {
"resource": ""
} |
q24847 | StorageUtil.toCredentials | train | public Credentials toCredentials(Element el, String attributeUser, String attributePassword, Credentials defaultCredentials) {
String user = el.getAttribute(attributeUser);
String pass = el.getAttribute(attributePassword);
if (user == null) return defaultCredentials;
if (pass == null) pass = "";
return Credentials... | java | {
"resource": ""
} |
q24848 | StorageUtil.setString | train | public void setString(Element el, String key, String value) {
if (value != null) el.setAttribute(key, value);
} | java | {
"resource": ""
} |
q24849 | StorageUtil.setBoolean | train | public void setBoolean(Element el, String key, boolean value) {
el.setAttribute(key, String.valueOf(value));
} | java | {
"resource": ""
} |
q24850 | StorageUtil.setInt | train | public void setInt(Element el, String key, int value) {
el.setAttribute(key, String.valueOf(value));
} | java | {
"resource": ""
} |
q24851 | StorageUtil.setDateTime | train | public void setDateTime(Element el, String key, DateTime value) {
if (value != null) {
String str = value.castToString(null);
if (str != null) el.setAttribute(key, str);
}
} | java | {
"resource": ""
} |
q24852 | StorageUtil.setCredentials | train | public void setCredentials(Element el, String username, String password, Credentials c) {
if (c == null) return;
if (c.getUsername() != null) el.setAttribute(username, c.getUsername());
if (c.getPassword() != null) el.setAttribute(password, c.getPassword());
} | java | {
"resource": ""
} |
q24853 | ParserString.removeSpace | train | public boolean removeSpace() {
int start = pos;
while (pos < text.length && lcText[pos] == ' ') {
pos++;
}
return (start < pos);
} | java | {
"resource": ""
} |
q24854 | ParserString.subCFMLString | train | public ParserString subCFMLString(int start, int count) {
return new ParserString(String.valueOf(text, start, count));
/*
* NICE die untermenge direkter ermiiteln, das problem hierbei sind die lines
*
* int endPos=start+count; int LineFrom=-1; int LineTo=-1; for(int i=0;i<lines.length;i++) { if() }
*
* re... | java | {
"resource": ""
} |
q24855 | CFMLEngineImpl.getInstance | train | public static synchronized CFMLEngine getInstance(CFMLEngineFactory factory, BundleCollection bc) {
if (engine == null) {
if (SystemUtil.getLoaderVersion() < 6.0D) {
// windows needs 6.0 because restart is not working with older versions
if (SystemUtil.isWindows())
throw new RuntimeException("You need t... | java | {
"resource": ""
} |
q24856 | Ldap.setScope | train | public void setScope(String strScope) throws ApplicationException {
strScope = strScope.trim().toLowerCase();
if (strScope.equals("onelevel")) scope = SearchControls.ONELEVEL_SCOPE;
else if (strScope.equals("base")) scope = SearchControls.OBJECT_SCOPE;
else if (strScope.equals("subtree")) scope = SearchControls.SUB... | java | {
"resource": ""
} |
q24857 | Ldap.setModifytype | train | public void setModifytype(String modifyType) throws ApplicationException {
modifyType = modifyType.trim().toLowerCase();
if (modifyType.equals("add")) this.modifyType = DirContext.ADD_ATTRIBUTE;
else if (modifyType.equals("delete")) this.modifyType = DirContext.REMOVE_ATTRIBUTE;
else if (modifyType.equals("replace"... | java | {
"resource": ""
} |
q24858 | Ldap.setSortcontrol | train | public void setSortcontrol(String sortControl) throws PageException {
String[] sortControlArr = ArrayUtil.trim(ListUtil.toStringArray(ListUtil.listToArrayRemoveEmpty(sortControl, ',')));
for (int i = 0; i < sortControlArr.length; i++) {
String scs = sortControlArr[i].trim().toLowerCase();
if (scs.equals("a... | java | {
"resource": ""
} |
q24859 | RamResourceCore.getChildNames | train | public String[] getChildNames() {
if (children == null || children.size() == 0) return EMPTY_NAMES;
String[] arr = new String[children.size()];
for (int i = 0; i < arr.length; i++) {
arr[i] = ((RamResourceCore) children.get(i)).getName();
}
return arr;
} | java | {
"resource": ""
} |
q24860 | RamResourceCore.getChild | train | public RamResourceCore getChild(String name, boolean caseSensitive) {
if (children == null) return null;
RamResourceCore child;
for (int i = children.size() - 1; i >= 0; i--) {
child = (RamResourceCore) children.get(i);
if (child != null && (caseSensitive ? child.getName().equals(name) : child.getName().e... | java | {
"resource": ""
} |
q24861 | RamResourceCore.removeChild | train | public void removeChild(RamResourceCore core) {
if (children == null) return;
RamResourceCore child;
for (int i = children.size() - 1; i >= 0; i--) {
child = (RamResourceCore) children.get(i);
if (child == core) {
children.remove(i);
break;
}
}
} | java | {
"resource": ""
} |
q24862 | VariableInterpreter.getVariable | train | public static Object getVariable(PageContext pc, Collection collection, String var) throws PageException {
StringList list = parse(pc, new ParserString(var), false);
if (list == null) throw new InterpreterException("invalid variable declaration [" + var + "]");
while (list.hasNextNext()) {
collection = Caster.... | java | {
"resource": ""
} |
q24863 | VariableInterpreter.getVariableEL | train | public static Object getVariableEL(PageContext pc, String var, Object defaultValue) {
StringList list = parse(pc, new ParserString(var), false);
if (list == null) return defaultValue;
int scope = scopeString2Int(pc.ignoreScopes(), list.next());
Object coll = null;
if (scope == Scope.SCOPE_UNDEFINED) {
coll =... | java | {
"resource": ""
} |
q24864 | VariableInterpreter.setVariable | train | public static Object setVariable(PageContext pc, String var, Object value) throws PageException {
StringList list = parse(pc, new ParserString(var), false);
if (list == null) throw new InterpreterException("invalid variable name declaration [" + var + "]");
if (list.size() == 1) {
return pc.undefinedScope().se... | java | {
"resource": ""
} |
q24865 | VariableInterpreter.removeVariable | train | public static Object removeVariable(PageContext pc, String var) throws PageException {
// print.ln("var:"+var);
StringList list = parse(pc, new ParserString(var), false);
if (list == null) throw new InterpreterException("invalid variable declaration [" + var + "]");
if (list.size() == 1) {
return pc.undefined... | java | {
"resource": ""
} |
q24866 | VariableInterpreter.parse | train | private static StringList parse(PageContext pc, ParserString ps, boolean doLowerCase) {
String id = readIdentifier(ps, doLowerCase);
if (id == null) return null;
StringList list = new StringList(id);
CFMLExpressionInterpreter interpreter = null;
while (true) {
if (ps.forwardIfCurrent('.')) {
id = readIdent... | java | {
"resource": ""
} |
q24867 | VariableInterpreter.scopeString2Int | train | public static int scopeString2Int(boolean ignoreScope, String type) {
type = StringUtil.toLowerCase(type);
char c = type.charAt(0);
// ignore scope only handles only reconize local,arguments as scope, the rest is ignored
if (ignoreScope) {
if ('a' == c) {
if ("arguments".equals(type)) return Scope.SCOPE_ARG... | java | {
"resource": ""
} |
q24868 | PageSourcePool.getPageSource | train | public PageSource getPageSource(String key, boolean updateAccesTime) { // DO NOT CHANGE INTERFACE (used by Argus Monitor)
PageSource ps = pageSources.get(key.toLowerCase());
if (ps == null) return null;
if (updateAccesTime) ps.setLastAccessTime();
return ps;
} | java | {
"resource": ""
} |
q24869 | PageSourcePool.setPage | train | public void setPage(String key, PageSource ps) {
ps.setLastAccessTime();
pageSources.put(key.toLowerCase(), ps);
} | java | {
"resource": ""
} |
q24870 | PageSourcePool.remove | train | public boolean remove(String key) {
if (pageSources.remove(key.toLowerCase()) != null) return true;
Set<String> set = pageSources.keySet();
String[] keys = set.toArray(new String[set.size()]); // done this way to avoid ConcurrentModificationException
PageSource ps;
for (String k: keys) {
ps = pageSources.ge... | java | {
"resource": ""
} |
q24871 | PageSourcePool.clearUnused | train | public void clearUnused(ConfigImpl config) {
SystemOut.printDate(config.getOutWriter(), "PagePool: " + size() + ">(" + maxSize + ")");
if (size() > maxSize) {
String[] keys = keys();
LongKeyList list = new LongKeyList();
for (int i = 0; i < keys.length; i++) {
PageSource ps = getPageSource(keys[i], ... | java | {
"resource": ""
} |
q24872 | PageSourcePool.clearPages | train | public void clearPages(ClassLoader cl) {
Iterator<PageSource> it = this.pageSources.values().iterator();
PageSourceImpl entry;
while (it.hasNext()) {
entry = (PageSourceImpl) it.next();
if (cl != null) entry.clear(cl);
else entry.clear();
}
} | java | {
"resource": ""
} |
q24873 | Captcha.writeOut | train | public static void writeOut(BufferedImage image, OutputStream os, String format) throws IOException {
ImageIO.write(image, format, os);
} | java | {
"resource": ""
} |
q24874 | Captcha.randomString | train | public static String randomString(int length) {
StringBuilder sb = new StringBuilder();
for (int i = 0; i < length; i++) {
sb.append(chars[AbstractCaptcha.rnd(0, chars.length - 1)]);
}
return sb.toString();
} | java | {
"resource": ""
} |
q24875 | HttpServletRequestDummy.translateQS | train | private Pair[] translateQS(String qs) {
if (qs == null) return new Pair[0];
Array arr = lucee.runtime.type.util.ListUtil.listToArrayRemoveEmpty(qs, "&");
Pair[] parameters = new Pair[arr.size()];
// Array item;
int index;
String name;
for (int i = 1; i <= parameters.length; i++) {
name = Caster.toString(ar... | java | {
"resource": ""
} |
q24876 | HttpServletRequestDummy.setHeader | train | public void setHeader(String name, String value) {
headers = ReqRspUtil.set(headers, name, value);
} | java | {
"resource": ""
} |
q24877 | HttpServletRequestDummy.addHeader | train | public void addHeader(String name, String value) {
headers = ReqRspUtil.add(headers, name, value);
} | java | {
"resource": ""
} |
q24878 | RunAsync.call | train | public static Object call(PageContext pc, Object udf, double timeout) throws PageException {
return Future._then(pc, Caster.toFunction(udf), (long) timeout);
} | java | {
"resource": ""
} |
q24879 | InstrumentationFactory.loadAgent | train | private static void loadAgent(Config config, Log log, String agentJar, Class<?> vmClass) {
try {
// addAttach(config,log);
// first obtain the PID of the currently-running process
// ### this relies on the undocumented convention of the
// RuntimeMXBean's
// ### name starting with the PID, b... | java | {
"resource": ""
} |
q24880 | DebuggerImpl.getDebugEntry | train | public static lucee.runtime.config.DebugEntry getDebugEntry(PageContext pc) {
String addr = pc.getHttpServletRequest().getRemoteAddr();
lucee.runtime.config.DebugEntry debugEntry = ((ConfigImpl) pc.getConfig()).getDebugEntry(addr, null);
return debugEntry;
} | java | {
"resource": ""
} |
q24881 | ValidateCreditCard.buildRanges | train | private static void buildRanges() {
// careful, no lead zeros allowed
// low high len vendor mod-10?
ranges = new LCR[] { new LCR(4000000000000L, 4999999999999L, 13, VISA, true), new LCR(30000000000000L, 30599999999999L, 14, DINERS, true),
new LCR(36000000000000L, 36999999999999L, 14, DINERS, true), new LCR(380000... | java | {
"resource": ""
} |
q24882 | ValidateCreditCard.findMatchingRange | train | protected static int findMatchingRange(long creditCardNumber) {
if (creditCardNumber < 1000000000000L) {
return NOT_ENOUGH_DIGITS;
}
if (creditCardNumber > 9999999999999999L) {
return TOO_MANY_DIGITS;
}
// check the cached index first, where we last found a number.
if (ranges[cachedLastFind].low <= cred... | java | {
"resource": ""
} |
q24883 | ValidateCreditCard.isValid | train | public static boolean isValid(long creditCardNumber) {
int i = findMatchingRange(creditCardNumber);
if (i < 0) {
return false;
}
// else {
// we have a match
if (ranges[i].hasCheckDigit) {
// there is a checkdigit to be validated
/*
* Manual method MOD 10 checkdigit 706-511-227 7 0 6 5 1 1 2 ... | java | {
"resource": ""
} |
q24884 | ValidateCreditCard.recognizeVendor | train | public static int recognizeVendor(long creditCardNumber) {
int i = findMatchingRange(creditCardNumber);
if (i < 0) {
return i;
}
return ranges[i].vendor;
} | java | {
"resource": ""
} |
q24885 | ValidateCreditCard.toCreditcard | train | public static String toCreditcard(String strCreditCardNumber) throws ExpressionException {
long number = toLong(strCreditCardNumber, -1);
if (number == -1) throw new ExpressionException("invalid creditcard number [" + strCreditCardNumber + "]");
return toPrettyString(number);
} | java | {
"resource": ""
} |
q24886 | ValidateCreditCard.toPrettyString | train | private static String toPrettyString(long creditCardNumber) {
String plain = Long.toString(creditCardNumber);
// int i = findMatchingRange(creditCardNumber);
int length = plain.length();
switch (length) {
case 12:
// 12 pattern 3-3-3-3
return plain.substring(0, 3) + ' ' + plain.substring(3, 6) + ' ' + p... | java | {
"resource": ""
} |
q24887 | ArrayUtil.swap | train | public static void swap(Array array, int left, int right) throws ExpressionException {
int len = array.size();
if (len == 0) throw new ExpressionException("array is empty");
if (left < 1 || left > len) throw new ExpressionException("invalid index [" + left + "]", "valid indexes are from 1 to " + len);
if (right < ... | java | {
"resource": ""
} |
q24888 | ArrayUtil.find | train | public static int find(Array array, Object object) {
int len = array.size();
for (int i = 1; i <= len; i++) {
Object tmp = array.get(i, null);
try {
if (tmp != null && Operator.compare(object, tmp) == 0) return i;
}
catch (PageException e) {}
}
return 0;
} | java | {
"resource": ""
} |
q24889 | ArrayUtil.avg | train | public static double avg(Array array) throws ExpressionException {
if (array.size() == 0) return 0;
return sum(array) / array.size();
} | java | {
"resource": ""
} |
q24890 | ArrayUtil.sum | train | public static double sum(Array array) throws ExpressionException {
if (array.getDimension() > 1) throw new ExpressionException("can only get sum/avg from 1 dimensional arrays");
double rtn = 0;
int len = array.size();
// try {
for (int i = 1; i <= len; i++) {
rtn += _toDoubleValue(array, i);
}
/*
* } cat... | java | {
"resource": ""
} |
q24891 | ArrayUtil.median | train | public static double median(Array array) throws ExpressionException {
int len = array.size();
if (len == 0) return 0;
if (array.getDimension() > 1) throw new ExpressionException("Median() can only be calculated for one dimensional arrays");
double[] arr = new double[len];
for (int i = 0; i < len; i++)
ar... | java | {
"resource": ""
} |
q24892 | ArrayUtil.min | train | public static double min(Array array) throws PageException {
if (array.getDimension() > 1) throw new ExpressionException("can only get max value from 1 dimensional arrays");
if (array.size() == 0) return 0;
double rtn = _toDoubleValue(array, 1);
int len = array.size();
try {
for (int i = 2; i <= len; i++) {
... | java | {
"resource": ""
} |
q24893 | ArrayUtil.setEL | train | public static Object setEL(Object o, int index, Object value) {
try {
return set(o, index, value);
}
catch (ArrayUtilException e) {
return null;
}
} | java | {
"resource": ""
} |
q24894 | ArrayUtil.toArray | train | public static Object[] toArray(List<?> list) {
Iterator<?> it = list.iterator();
Class clazz = null;
while (it.hasNext()) {
Object v = it.next();
if (v == null) continue;
if (clazz == null) clazz = v.getClass();
else if (clazz != v.getClass()) return list.toArray();
}
if (clazz == Object.class ... | java | {
"resource": ""
} |
q24895 | ArrayUtil.resizeIfNeeded | train | public static Object[] resizeIfNeeded(Object[] arr, int minSize, boolean doPowerOf2) {
if (arr.length >= minSize) return arr;
if (doPowerOf2) minSize = MathUtil.nextPowerOf2(minSize);
Object[] result = new Object[minSize];
System.arraycopy(arr, 0, result, 0, arr.length);
return result;
} | java | {
"resource": ""
} |
q24896 | Log.setLog | train | public void setLog(String log) throws ApplicationException {
if (StringUtil.isEmpty(log, true)) return;
this.log = log.trim();
// throw new ApplicationException("invalid value for attribute log ["+log+"]","valid values are
// [application, scheduler,console]");
} | java | {
"resource": ""
} |
q24897 | Log.setType | train | public void setType(String type) throws ApplicationException {
type = type.toLowerCase().trim();
if (type.equals("information")) this.type = lucee.commons.io.log.Log.LEVEL_INFO;
else if (type.equals("info")) this.type = lucee.commons.io.log.Log.LEVEL_INFO;
else if (type.equals("warning")) this.type = lucee.commons.... | java | {
"resource": ""
} |
q24898 | Log.setFile | train | public void setFile(String file) throws ApplicationException {
if (StringUtil.isEmpty(file)) return;
if (file.indexOf('/') != -1 || file.indexOf('\\') != -1)
throw new ApplicationException("value [" + file + "] from attribute [file] at tag [log] can only contain a filename, file separators like [\\/] are not al... | java | {
"resource": ""
} |
q24899 | FDStackFrameImpl.copyValues | train | private static List copyValues(FDStackFrameImpl frame, List to, Struct from) {
Iterator it = from.entrySet().iterator();
Entry entry;
while (it.hasNext()) {
entry = (Entry) it.next();
to.add(new FDVariable(frame, (String) entry.getKey(), FDCaster.toFDValue(frame, entry.getValue())));
}
return to;
} | java | {
"resource": ""
} |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.