_id stringlengths 2 7 | title stringlengths 3 140 | partition stringclasses 3
values | text stringlengths 73 34.1k | language stringclasses 1
value | meta_information dict |
|---|---|---|---|---|---|
q24500 | ComponentUtil.hasChangesOfChildren | train | private static boolean hasChangesOfChildren(long last, PageContext pc, Class clazz) {
java.lang.reflect.Method[] methods = clazz.getMethods();
java.lang.reflect.Method method;
Class[] params;
for (int i = 0; i < methods.length; i++) {
method = methods[i];
if (method.getDeclaringClass() == clazz) {
if (... | java | {
"resource": ""
} |
q24501 | ComponentUtil.toIntAccess | train | public static int toIntAccess(String access) throws ApplicationException {
access = StringUtil.toLowerCase(access.trim());
if (access.equals("package")) return Component.ACCESS_PACKAGE;
else if (access.equals("private")) return Component.ACCESS_PRIVATE;
else if (access.equals("public")) return Component.ACCESS_PUBL... | java | {
"resource": ""
} |
q24502 | ComponentUtil.toStringAccess | train | public static String toStringAccess(int access) throws ApplicationException {
String res = toStringAccess(access, null);
if (res != null) return res;
throw new ApplicationException(
"invalid access type [" + access + "], access types are Component.ACCESS_PACKAGE, Component.ACCESS_PRIVATE, Component.ACCESS_PUBLIC, ... | java | {
"resource": ""
} |
q24503 | Col.setAlign | train | public void setAlign(String align) throws ApplicationException {
align = StringUtil.toLowerCase(align);
if (align.equals("left")) this.align = Table.ALIGN_LEFT;
else if (align.equals("center")) this.align = Table.ALIGN_CENTER;
else if (align.equals("right")) this.align = Table.ALIGN_RIGHT;
else throw new Applicati... | java | {
"resource": ""
} |
q24504 | JSConverter.serialize | train | public String serialize(Object object, String clientVariableName) throws ConverterException {
StringBuilder sb = new StringBuilder();
_serialize(clientVariableName, object, sb, new HashSet<Object>());
String str = sb.toString().trim();
return clientVariableName + "=" + str + (StringUtil.endsWith(str, ';') ? "" : ";... | java | {
"resource": ""
} |
q24505 | GetTickCount.call | train | public static double call(PageContext pc, double unit) {
if (UNIT_NANO == unit) return System.nanoTime();
if (UNIT_MICRO == unit) return System.nanoTime() / 1000;
if (UNIT_MILLI == unit) return System.currentTimeMillis();
return System.currentTimeMillis() / 1000;
} | java | {
"resource": ""
} |
q24506 | Perl5Util.indexOf | train | public static Object indexOf(String strPattern, String strInput, int offset, boolean caseSensitive, boolean matchAll) throws MalformedPatternException {
// Perl5Compiler compiler = new Perl5Compiler();
PatternMatcherInput input = new PatternMatcherInput(strInput);
Perl5Matcher matcher = new Perl5Matcher();
int com... | java | {
"resource": ""
} |
q24507 | ConfigWebUtil.deployWeb | train | public static void deployWeb(ConfigServer cs, ConfigWeb cw, boolean throwError) throws IOException {
Resource deploy = cs.getConfigDir().getRealResource("web-deployment"), trg;
if (!deploy.isDirectory()) return;
trg = cw.getRootDirectory();
try {
_deploy(cw, deploy, trg);
}
catch (IOException ioe) {
if... | java | {
"resource": ""
} |
q24508 | ConfigWebUtil.getFile | train | public static Resource getFile(Config config, Resource directory, String path, short type) {
path = replacePlaceholder(path, config);
if (!StringUtil.isEmpty(path, true)) {
Resource file = getFile(directory.getRealResource(path), type);
if (file != null) return file;
file = getFile(config.getResource(... | java | {
"resource": ""
} |
q24509 | ConfigWebUtil.getFile | train | static Resource getFile(Resource rootDir, String strDir, String defaultDir, Resource configDir, short type, ConfigImpl config) {
strDir = replacePlaceholder(strDir, config);
if (!StringUtil.isEmpty(strDir, true)) {
Resource res;
if (strDir.indexOf("://") != -1) { // TODO better impl.
res = getFile(config.... | java | {
"resource": ""
} |
q24510 | ConfigWebUtil.getExistingResource | train | public static Resource getExistingResource(ServletContext sc, String strDir, String defaultDir, Resource configDir, short type, Config config) {
// ARP
strDir = replacePlaceholder(strDir, config);
if (strDir != null && strDir.trim().length() > 0) {
Resource res = sc == null ? null : _getExistingFile(config.get... | java | {
"resource": ""
} |
q24511 | ConfigWebUtil.isFile | train | public static boolean isFile(Resource file) {
if (file.exists()) return file.isFile();
Resource parent = file.getParentResource();
return parent.mkdirs() && file.createNewFile();
} | java | {
"resource": ""
} |
q24512 | ConfigWebUtil.hasAccess | train | public static boolean hasAccess(Config config, int type) {
boolean has = true;
if (config instanceof ConfigWeb) {
has = ((ConfigWeb) config).getSecurityManager().getAccess(type) != SecurityManager.VALUE_NO;
}
return has;
} | java | {
"resource": ""
} |
q24513 | JavaConverter.serialize | train | public static String serialize(Serializable o) throws IOException {
ByteArrayOutputStream baos = new ByteArrayOutputStream();
serialize(o, baos);
return Base64Coder.encode(baos.toByteArray());
} | java | {
"resource": ""
} |
q24514 | JavaConverter.deserialize | train | public static Object deserialize(String str) throws IOException, ClassNotFoundException, CoderException {
ByteArrayInputStream bais = new ByteArrayInputStream(Base64Coder.decode(str));
return deserialize(bais);
} | java | {
"resource": ""
} |
q24515 | ComponentLoader.loadComponent | train | public static ComponentImpl loadComponent(PageContext pc, Page page, String callPath, boolean isRealPath, boolean silent, boolean isExtendedComponent, boolean executeConstr)
throws PageException {
CIPage cip = toCIPage(page, callPath);
if (silent) {
// TODO is there a more direct way
BodyContent bc = p... | java | {
"resource": ""
} |
q24516 | CFMLWriterImpl.setBufferConfig | train | @Override
public void setBufferConfig(int bufferSize, boolean autoFlush) throws IOException {
this.bufferSize = bufferSize;
this.autoFlush = autoFlush;
_check();
} | java | {
"resource": ""
} |
q24517 | OpDecision.toExprBoolean | train | public static ExprBoolean toExprBoolean(Expression left, Expression right, int operation) {
return new OpDecision(left, right, operation);
} | java | {
"resource": ""
} |
q24518 | BundleFile.newInstance | train | public static BundleFile newInstance(Resource res) {
try {
BundleFile bf = new BundleFile(res);
if (bf.isBundle()) return bf;
}
catch (Throwable t) {
ExceptionUtil.rethrowIfNecessary(t);
}
return null;
} | java | {
"resource": ""
} |
q24519 | PageSourceImpl.loadPhysical | train | private Page loadPhysical(PageContext pc, Page page) throws TemplateException {
if (!mapping.hasPhysical()) return null;
ConfigWeb config = pc.getConfig();
PageContextImpl pci = (PageContextImpl) pc;
if ((mapping.getInspectTemplate() == Config.INSPECT_NEVER || pci.isTrusted(page)) && isLoad(LOAD_PHYSICAL)) return ... | java | {
"resource": ""
} |
q24520 | PageSourceImpl.getDisplayPath | train | @Override
public String getDisplayPath() {
if (!mapping.hasArchive()) {
return StringUtil.toString(getPhyscalFile(), null);
}
else if (isLoad(LOAD_PHYSICAL)) {
return StringUtil.toString(getPhyscalFile(), null);
}
else if (isLoad(LOAD_ARCHIVE)) {
return StringUtil.toString(getArchiveSourcePath()... | java | {
"resource": ""
} |
q24521 | PageSourceImpl.getPhyscalFile | train | @Override
public Resource getPhyscalFile() {
if (physcalSource == null) {
if (!mapping.hasPhysical()) {
return null;
}
Resource tmp = mapping.getPhysical().getRealResource(relPath);
physcalSource = ResourceUtil.toExactResource(tmp);
// fix if the case not match
if (!tmp.getAbsoluteP... | java | {
"resource": ""
} |
q24522 | PageSourceImpl.mergeRealPathes | train | private static String mergeRealPathes(Mapping mapping, String parentRealPath, String newRealPath, RefBoolean isOutSide) {
parentRealPath = pathRemoveLast(parentRealPath, isOutSide);
while (newRealPath.startsWith("../")) {
parentRealPath = pathRemoveLast(parentRealPath, isOutSide);
newRealPath = newRealPath.... | java | {
"resource": ""
} |
q24523 | PageSourceImpl.list | train | private static String list(String[] arr, int from, int len) {
StringBuffer sb = new StringBuffer();
for (int i = from; i < len; i++) {
sb.append(arr[i]);
if (i + 1 != arr.length) sb.append('/');
}
return sb.toString();
} | java | {
"resource": ""
} |
q24524 | PageSourceImpl.pathRemoveLast | train | private static String pathRemoveLast(String path, RefBoolean isOutSide) {
if (path.length() == 0) {
isOutSide.setValue(true);
return "..";
}
else if (path.endsWith("..")) {
isOutSide.setValue(true);
return path.concat("/..");// path+"/..";
}
return path.substring(0, path.lastIndexOf('/'));
... | java | {
"resource": ""
} |
q24525 | PageSourceImpl.getSourceAsInputStream | train | private InputStream getSourceAsInputStream() throws IOException {
if (!mapping.hasArchive()) return IOUtil.toBufferedInputStream(getPhyscalFile().getInputStream());
else if (isLoad(LOAD_PHYSICAL)) return IOUtil.toBufferedInputStream(getPhyscalFile().getInputStream());
else if (isLoad(LOAD_ARCHIVE)) {
StringBuff... | java | {
"resource": ""
} |
q24526 | PageSourceImpl.clear | train | public void clear(ClassLoader cl) {
Page page = this.page;
if (page != null && page.getClass().getClassLoader().equals(cl)) {
this.page = null;
}
} | java | {
"resource": ""
} |
q24527 | ScheduleTaskImpl.toInterval | train | private static int toInterval(String interval) throws ScheduleException {
interval = interval.trim().toLowerCase();
int i = Caster.toIntValue(interval, 0);
if (i == 0) {
interval = interval.trim();
if (interval.equals("once")) return INTERVAL_ONCE;
else if (interval.equals("daily")) return INTERVAL_DA... | java | {
"resource": ""
} |
q24528 | ScheduleTaskImpl.toURL | train | private static URL toURL(String url, int port) throws MalformedURLException {
URL u = HTTPUtil.toURL(url, true);
if (port == -1) return u;
return new URL(u.getProtocol(), u.getHost(), port, u.getFile());
} | java | {
"resource": ""
} |
q24529 | RamResourceProviderOld.init | train | @Override
public ResourceProvider init(String scheme, Map arguments) {
if (!StringUtil.isEmpty(scheme)) this.scheme = scheme;
if (arguments != null) {
this.arguments = arguments;
Object oCaseSensitive = arguments.get("case-sensitive");
if (oCaseSensitive != null) {
caseSensitive = Caster.toBoole... | java | {
"resource": ""
} |
q24530 | ScopeFactory.toStringScope | train | public static String toStringScope(int scope, String defaultValue) {
switch (scope) {
case Scope.SCOPE_APPLICATION:
return "application";
case Scope.SCOPE_ARGUMENTS:
return "arguments";
case Scope.SCOPE_CALLER:
return "caller";
case Scope.SCOPE_CGI:
return "cgi";
case Scope.SCOPE_CLIENT:
... | java | {
"resource": ""
} |
q24531 | BodyContentStack.release | train | public void release() {
this.base = null;
current = root;
current.body = null;
current.after = null;
current.before = null;
} | java | {
"resource": ""
} |
q24532 | BodyContentStack.push | train | public BodyContent push() {
if (current.after == null) {
current.after = new Entry(current, new BodyContentImpl(current.body == null ? (JspWriter) base : current.body));
}
else {
current.after.doDevNull = false;
current.after.body.init(current.body == null ? (JspWriter) base : current.body);
}
curre... | java | {
"resource": ""
} |
q24533 | ColorCaster.contrast | train | public static int contrast(Color left, Color right) throws ServletException {
return (Math.max(left.getRed(), right.getRed()) - Math.min(left.getRed(), right.getRed()))
+ (Math.max(left.getGreen(), right.getGreen()) - Math.min(left.getGreen(), right.getGreen()))
+ (Math.max(left.getBlue(), right.getBlue()) - Math.... | java | {
"resource": ""
} |
q24534 | Registry.setAction | train | public void setAction(String action) throws ApplicationException {
action = action.toLowerCase().trim();
if (action.equals("getall")) this.action = ACTION_GET_ALL;
else if (action.equals("get")) this.action = ACTION_GET;
else if (action.equals("set")) this.action = ACTION_SET;
else if (action.equals("delete")) thi... | java | {
"resource": ""
} |
q24535 | Elvis.operate | train | public static boolean operate(PageContext pc, String[] varNames) {
int scope = VariableInterpreter.scopeString2Int(pc.ignoreScopes(), varNames[0]);
return _operate(pc, scope, KeyImpl.toKeyArray(varNames), scope == Scope.SCOPE_UNDEFINED ? 0 : 1);
} | java | {
"resource": ""
} |
q24536 | ConfigImpl.setTldFile | train | protected void setTldFile(Resource fileTld, int dialect) throws TagLibException {
if (dialect == CFMLEngine.DIALECT_BOTH) {
setTldFile(fileTld, CFMLEngine.DIALECT_CFML);
setTldFile(fileTld, CFMLEngine.DIALECT_LUCEE);
return;
}
TagLib[] tlds = dialect == CFMLEngine.DIALECT_CFML ? cfmlTlds : luceeTlds;... | java | {
"resource": ""
} |
q24537 | ConfigImpl.setScheduler | train | protected void setScheduler(CFMLEngine engine, Resource scheduleDirectory) throws PageException {
if (scheduleDirectory == null) {
if (this.scheduler == null) this.scheduler = new SchedulerImpl(engine, "<?xml version=\"1.0\"?>\n<schedule></schedule>", this);
return;
}
if (!isDirectory(scheduleDirectory)) ... | java | {
"resource": ""
} |
q24538 | ConfigImpl.setLocale | train | protected void setLocale(String strLocale) {
if (strLocale == null) {
this.locale = Locale.US;
}
else {
try {
this.locale = Caster.toLocale(strLocale);
if (this.locale == null) this.locale = Locale.US;
}
catch (ExpressionException e) {
this.locale = Locale.US;
}
}
} | java | {
"resource": ""
} |
q24539 | ConfigImpl.isDirectory | train | protected boolean isDirectory(Resource directory) {
if (directory.exists()) return directory.isDirectory();
try {
directory.createDirectory(true);
return true;
}
catch (IOException e) {
e.printStackTrace(getErrWriter());
}
return false;
} | java | {
"resource": ""
} |
q24540 | ConfigImpl.createRAMCache | train | public Cache createRAMCache(Struct arguments) throws IOException {
RamCache rc = new RamCache();
if (arguments == null) arguments = new StructImpl();
rc.init(this, "" + CreateUniqueId.invoke(), arguments);
return rc;
} | java | {
"resource": ""
} |
q24541 | ComponentImpl.duplicateDataMember | train | public static MapPro duplicateDataMember(ComponentImpl c, MapPro map, MapPro newMap, boolean deepCopy) {
Iterator it = map.entrySet().iterator();
Map.Entry entry;
Object value;
while (it.hasNext()) {
entry = (Entry) it.next();
value = entry.getValue();
if (!(value instanceof UDF)) {
if (deepCopy) ... | java | {
"resource": ""
} |
q24542 | ComponentImpl.init | train | public void init(PageContext pageContext, ComponentPageImpl componentPage, boolean executeConstr) throws PageException {
this.pageSource = componentPage.getPageSource();
// extends
if (!StringUtil.isEmpty(properties.extend)) {
base = ComponentLoader.searchComponent(pageContext, componentPage.getPageSource(), p... | java | {
"resource": ""
} |
q24543 | ComponentImpl.beforeCall | train | public Variables beforeCall(PageContext pc) {
Variables parent = pc.variablesScope();
pc.setVariablesScope(scope);
return parent;
} | java | {
"resource": ""
} |
q24544 | ComponentImpl.keySet | train | public Set<Key> keySet(int access) {
Set<Key> set = new LinkedHashSet<Key>();
Map.Entry<Key, Member> entry;
Iterator<Entry<Key, Member>> it = _data.entrySet().iterator();
while (it.hasNext()) {
entry = it.next();
if (entry.getValue().getAccess() <= access) set.add(entry.getKey());
}
return set;
} | java | {
"resource": ""
} |
q24545 | ComponentImpl.getMember | train | protected Member getMember(PageContext pc, Collection.Key key, boolean dataMember, boolean superAccess) {
// check super
if (dataMember && key.equalsIgnoreCase(KeyConstants._super) && isPrivate(pc)) {
Component ac = ComponentUtil.getActiveComponent(pc, this);
return SuperComponent.superMember((ComponentImpl... | java | {
"resource": ""
} |
q24546 | ComponentImpl.getAccess | train | private int getAccess(Collection.Key key) {
Member member = getMember(ACCESS_PRIVATE, key, false, false);
if (member == null) return Component.ACCESS_PRIVATE;
return member.getAccess();
} | java | {
"resource": ""
} |
q24547 | ComponentImpl.getAccess | train | int getAccess(PageContext pc) {
if (pc == null) return ACCESS_PUBLIC;
if (isPrivate(pc)) return ACCESS_PRIVATE;
if (isPackage(pc)) return ACCESS_PACKAGE;
return ACCESS_PUBLIC;
} | java | {
"resource": ""
} |
q24548 | ComponentImpl._set | train | private Object _set(PageContext pc, Collection.Key key, Object value) throws ExpressionException {
if (value instanceof Member) {
Member m = (Member) value;
if (m instanceof UDFPlus) {
UDFPlus udf = (UDFPlus) m;
if (udf.getAccess() > Component.ACCESS_PUBLIC) udf.setAccess(Component.ACCESS_PUBLIC);
_dat... | java | {
"resource": ""
} |
q24549 | ComponentImpl.readExternal | train | public void readExternal(ObjectInput in) throws IOException, ClassNotFoundException {
boolean pcCreated = false;
PageContext pc = ThreadLocalPageContext.get();
try {
if (pc == null) {
pcCreated = true;
ConfigWeb config = (ConfigWeb) ThreadLocalPageContext.getConfig();
Pair[] parr = new Pair[0];
pc = Thr... | java | {
"resource": ""
} |
q24550 | EvaluatorPool.add | train | public void add(TagLibTag libTag, Tag tag, FunctionLib[] flibs, SourceCode cfml) {
tags.add(new TagData(libTag, tag, flibs, cfml));
} | java | {
"resource": ""
} |
q24551 | EvaluatorPool.run | train | public void run() throws TemplateException {
{
// tags
Iterator<TagData> it = tags.iterator();
while (it.hasNext()) {
TagData td = it.next();
SourceCode cfml = td.cfml;
cfml.setPos(td.pos);
try {
if (td.libTag.getEvaluator() != null) td.libTag.getEvaluator().evaluate(td.tag, td.libTag, td.... | java | {
"resource": ""
} |
q24552 | RefUtil.getValue | train | public static Object[] getValue(PageContext pc, Ref[] refs) throws PageException {
Object[] objs = new Object[refs.length];
for (int i = 0; i < refs.length; i++) {
objs[i] = refs[i].getValue(pc);
}
return objs;
} | java | {
"resource": ""
} |
q24553 | OSGiUtil.installBundle | train | public static Bundle installBundle(BundleContext context, Resource bundle, boolean checkExistence) throws IOException, BundleException {
if (checkExistence) {
BundleFile bf = new BundleFile(bundle);
if (!bf.isBundle()) throw new BundleException(bundle + " is not a valid bundle!");
Bundle existing = loa... | java | {
"resource": ""
} |
q24554 | OSGiUtil._loadBundle | train | private static Bundle _loadBundle(BundleContext context, String path, InputStream is, boolean closeStream) throws BundleException {
log(Log.LEVEL_INFO, "add bundle:" + path);
try {
// we make this very simply so an old loader that is calling this still works
return context.installBundle(path, is);
}
fina... | java | {
"resource": ""
} |
q24555 | OSGiUtil.installBundle | train | public static Bundle installBundle(BundleContext context, InputStream bundleIS, boolean closeStream, boolean checkExistence) throws IOException, BundleException {
// store locally to test the bundle
String name = System.currentTimeMillis() + ".tmp";
Resource dir = SystemUtil.getTempDirectory();
Resource tmp = dir.g... | java | {
"resource": ""
} |
q24556 | OSGiUtil.loadClass | train | public static Class loadClass(String className, Class defaultValue) {
className = className.trim();
CFMLEngine engine = CFMLEngineFactory.getInstance();
BundleCollection bc = engine.getBundleCollection();
// first we try to load the class from the Lucee core
try {
// load from core
return bc.core.loadC... | java | {
"resource": ""
} |
q24557 | OSGiUtil.removeLocalBundle | train | public static void removeLocalBundle(String name, Version version, boolean removePhysical, boolean doubleTap) throws BundleException {
name = name.trim();
CFMLEngine engine = CFMLEngineFactory.getInstance();
CFMLEngineFactory factory = engine.getCFMLEngineFactory();
BundleFile bf = _getBundleFile(factory, name, ve... | java | {
"resource": ""
} |
q24558 | RHExtension.move | train | private void move(Resource ext) throws PageException {
Resource trg;
Resource trgDir;
try {
trg = getExtensionFile(config, ext, id, name, version);
trgDir = trg.getParentResource();
trgDir.mkdirs();
if (!ext.getParentResource().equals(trgDir)) {
if (trg.exists()) trg.delete();
ResourceUtil.mo... | java | {
"resource": ""
} |
q24559 | CacheResourceCore.setData | train | public void setData(byte[] data, boolean append) {
lastModified = System.currentTimeMillis();
// set data
if (append) {
if (this.data != null && data != null) {
byte[] newData = new byte[this.data.length + data.length];
int i = 0;
for (; i < this.data.length; i++) {
newData[i] = this.data[i];
}
... | java | {
"resource": ""
} |
q24560 | ScriptProtect.translate | train | public static void translate(Struct sct) {
Iterator<Entry<Key, Object>> it = sct.entryIterator();
Entry<Key, Object> e;
Object value;
while (it.hasNext()) {
e = it.next();
value = e.getValue();
if (value instanceof String) {
sct.setEL(e.getKey(), translate((String) value));
}
}
} | java | {
"resource": ""
} |
q24561 | ScriptProtect.translate | train | public static String translate(String str) {
if (str == null) return "";
// TODO do-while machen
int index, last = 0, endIndex;
StringBuilder sb = null;
String tagName;
while ((index = str.indexOf('<', last)) != -1) {
// read tagname
int len = str.length();
char c;
for (endIndex = index + 1; e... | java | {
"resource": ""
} |
q24562 | AppListenerUtil.translateScriptProtect | train | public static String translateScriptProtect(int scriptProtect) {
if (scriptProtect == ApplicationContext.SCRIPT_PROTECT_NONE) return "none";
if (scriptProtect == ApplicationContext.SCRIPT_PROTECT_ALL) return "all";
Array arr = new ArrayImpl();
if ((scriptProtect & ApplicationContext.SCRIPT_PROTECT_CGI) > 0) arr.ap... | java | {
"resource": ""
} |
q24563 | AppListenerUtil.translateScriptProtect | train | public static int translateScriptProtect(String strScriptProtect) {
strScriptProtect = strScriptProtect.toLowerCase().trim();
if ("none".equals(strScriptProtect)) return ApplicationContext.SCRIPT_PROTECT_NONE;
if ("no".equals(strScriptProtect)) return ApplicationContext.SCRIPT_PROTECT_NONE;
if ("false".equals(strS... | java | {
"resource": ""
} |
q24564 | CFMLEngineFactory.callListeners | train | private void callListeners(final CFMLEngine engine) {
final Iterator<EngineChangeListener> it = listeners.iterator();
while (it.hasNext())
it.next().onUpdate();
} | java | {
"resource": ""
} |
q24565 | CFMLEngineFactory.getResourceRoot | train | public File getResourceRoot() throws IOException {
if (resourceRoot == null) {
resourceRoot = new File(_getResourceRoot(), "lucee-server");
if (!resourceRoot.exists()) resourceRoot.mkdirs();
}
return resourceRoot;
} | java | {
"resource": ""
} |
q24566 | UDFUtil.addFunctionDoc | train | public static void addFunctionDoc(PageExceptionImpl pe, FunctionLibFunction flf) {
ArrayList<FunctionLibFunctionArg> args = flf.getArg();
Iterator<FunctionLibFunctionArg> it = args.iterator();
// Pattern
StringBuilder pattern = new StringBuilder(flf.getName());
StringBuilder end = new StringBuilder();
pattern.ap... | java | {
"resource": ""
} |
q24567 | Stopwatch.stop | train | public long stop() {
if (isRunning) {
long time = _time() - start;
total += time;
count++;
isRunning = false;
return time;
}
return 0;
} | java | {
"resource": ""
} |
q24568 | FunctionLibFunction.addArg | train | public void addArg(FunctionLibFunctionArg arg) {
arg.setFunction(this);
argument.add(arg);
if (arg.getDefaultValue() != null) hasDefaultValues = true;
} | java | {
"resource": ""
} |
q24569 | FunctionLibFunction.setFunctionClass | train | public void setFunctionClass(String value, Identification id, Attributes attrs) {
functionCD = ClassDefinitionImpl.toClassDefinition(value, id, attrs);
} | java | {
"resource": ""
} |
q24570 | XMLCaster.toText | train | public static Text toText(Document doc, Object o) throws PageException {
if (o instanceof Text) return (Text) o;
else if (o instanceof CharacterData) return doc.createTextNode(((CharacterData) o).getData());
return doc.createTextNode(Caster.toString(o));
} | java | {
"resource": ""
} |
q24571 | XMLCaster.toTextArray | train | public static Text[] toTextArray(Document doc, Object o) throws PageException {
// Node[]
if (o instanceof Node[]) {
Node[] nodes = (Node[]) o;
if (_isAllOfSameType(nodes, Node.TEXT_NODE)) return (Text[]) nodes;
Text[] textes = new Text[nodes.length];
for (int i = 0; i < nodes.length; i++) {
te... | java | {
"resource": ""
} |
q24572 | XMLCaster.toAttr | train | public static Attr toAttr(Document doc, Object o) throws PageException {
if (o instanceof Attr) return (Attr) o;
if (o instanceof Struct && ((Struct) o).size() == 1) {
Struct sct = (Struct) o;
Entry<Key, Object> e = sct.entryIterator().next();
Attr attr = doc.createAttribute(e.getKey().getString());
... | java | {
"resource": ""
} |
q24573 | XMLCaster.toAttrArray | train | public static Attr[] toAttrArray(Document doc, Object o) throws PageException {
// Node[]
if (o instanceof Node[]) {
Node[] nodes = (Node[]) o;
if (_isAllOfSameType(nodes, Node.ATTRIBUTE_NODE)) return (Attr[]) nodes;
Attr[] attres = new Attr[nodes.length];
for (int i = 0; i < nodes.length; i++) {... | java | {
"resource": ""
} |
q24574 | XMLCaster.toComment | train | public static Comment toComment(Document doc, Object o) throws PageException {
if (o instanceof Comment) return (Comment) o;
else if (o instanceof CharacterData) return doc.createComment(((CharacterData) o).getData());
return doc.createComment(Caster.toString(o));
} | java | {
"resource": ""
} |
q24575 | XMLCaster.toCommentArray | train | public static Comment[] toCommentArray(Document doc, Object o) throws PageException {
// Node[]
if (o instanceof Node[]) {
Node[] nodes = (Node[]) o;
if (_isAllOfSameType(nodes, Node.COMMENT_NODE)) return (Comment[]) nodes;
Comment[] comments = new Comment[nodes.length];
for (int i = 0; i < nodes... | java | {
"resource": ""
} |
q24576 | XMLCaster.toElement | train | public static Element toElement(Document doc, Object o) throws PageException {
if (o instanceof Element) return (Element) o;
else if (o instanceof Node) throw new ExpressionException("Object " + Caster.toClassName(o) + " must be a XML Element");
return doc.createElement(Caster.toString(o));
} | java | {
"resource": ""
} |
q24577 | XMLCaster.toNode | train | @Deprecated
public static Node toNode(Object o) throws PageException {
if (o instanceof XMLStruct) return ((XMLStruct) o).toNode();
if (o instanceof Node) return (Node) o;
throw new CasterException(o, "node");
} | java | {
"resource": ""
} |
q24578 | XMLCaster.toNode | train | public static Node toNode(Document doc, Object o, short type) throws PageException {
if (Node.TEXT_NODE == type) toText(doc, o);
else if (Node.ATTRIBUTE_NODE == type) toAttr(doc, o);
else if (Node.COMMENT_NODE == type) toComment(doc, o);
else if (Node.ELEMENT_NODE == type) toElement(doc, o);
throw new Expression... | java | {
"resource": ""
} |
q24579 | XMLCaster.toNodeArray | train | public static Node[] toNodeArray(Document doc, Object o, short type) throws PageException {
if (Node.TEXT_NODE == type) toTextArray(doc, o);
else if (Node.ATTRIBUTE_NODE == type) toAttrArray(doc, o);
else if (Node.COMMENT_NODE == type) toCommentArray(doc, o);
else if (Node.ELEMENT_NODE == type) toElementArray(doc,... | java | {
"resource": ""
} |
q24580 | XMLCaster.writeTo | train | public static void writeTo(Node node, Resource file) throws PageException {
OutputStream os = null;
try {
os = IOUtil.toBufferedOutputStream(file.getOutputStream());
writeTo(node, new StreamResult(os), false, false, null, null, null);
}
catch (IOException ioe) {
throw Caster.toPageException(ioe);
}
... | java | {
"resource": ""
} |
q24581 | XMLCaster._toNodeArray | train | private static Node[] _toNodeArray(Document doc, Object o) {
if (o instanceof Node) return new Node[] { (Node) o };
// Node[]
if (o instanceof Node[]) return ((Node[]) o);
// NamedNodeMap
else if (o instanceof NamedNodeMap) {
NamedNodeMap map = (NamedNodeMap) o;
int len = map.getLength();
Node[] nod... | java | {
"resource": ""
} |
q24582 | XMLCaster._isAllOfSameType | train | private static boolean _isAllOfSameType(Node[] nodes, short type) {
for (int i = 0; i < nodes.length; i++) {
if (nodes[i].getNodeType() != type) return false;
}
return true;
} | java | {
"resource": ""
} |
q24583 | FunctionLibFunctionArg.setRequired | train | public void setRequired(String value) {
value = value.toLowerCase().trim();
required = (value.equals("yes") || value.equals("true"));
} | java | {
"resource": ""
} |
q24584 | WSUtil.invoke | train | public static Object invoke(String name, Object[] args) throws PageException {
return invoke(null, name, args);
} | java | {
"resource": ""
} |
q24585 | SQLUtil.toBlob | train | public static Blob toBlob(Connection conn, Object value) throws PageException, SQLException {
if (value instanceof Blob) return (Blob) value;
// Java >= 1.6
if (SystemUtil.JAVA_VERSION >= SystemUtil.JAVA_VERSION_6) {
try {
Blob blob = conn.createBlob();
blob.setBytes(1, Caster.toBinary(value));
return bl... | java | {
"resource": ""
} |
q24586 | SQLUtil.toClob | train | public static Clob toClob(Connection conn, Object value) throws PageException, SQLException {
if (value instanceof Clob) return (Clob) value;
// Java >= 1.6
if (SystemUtil.JAVA_VERSION >= SystemUtil.JAVA_VERSION_6) {
Clob clob = conn.createClob();
clob.setString(1, Caster.toString(value));
return clob... | java | {
"resource": ""
} |
q24587 | DateTimeUtil.toDateTime | train | public DateTime toDateTime(double days) {
long utc = Math.round(days * DAY_MILLIS);
utc -= CF_UNIX_OFFSET;
utc -= getLocalTimeZoneOffset(utc);
return new DateTimeImpl(utc, false);
} | java | {
"resource": ""
} |
q24588 | DateTimeUtil.toHTTPTimeString | train | public static String toHTTPTimeString(Date date, boolean oldFormat) {
if (oldFormat) {
synchronized (HTTP_TIME_STRING_FORMAT_OLD) {
return StringUtil.replace(HTTP_TIME_STRING_FORMAT_OLD.format(date), "+00:00", "", true);
}
}
synchronized (HTTP_TIME_STRING_FORMAT) {
return StringUtil.replace(HTTP_TIM... | java | {
"resource": ""
} |
q24589 | ResourceClassLoader.doURLs | train | public static URL[] doURLs(Resource[] reses) throws IOException {
List<URL> list = new ArrayList<URL>();
for (int i = 0; i < reses.length; i++) {
if (reses[i].isDirectory() || "jar".equalsIgnoreCase(ResourceUtil.getExtension(reses[i], null))) list.add(doURL(reses[i]));
}
return list.toArray(new URL[list.size()... | java | {
"resource": ""
} |
q24590 | SchedulerImpl.readInAllTasks | train | private ScheduleTaskImpl[] readInAllTasks() throws PageException {
Element root = doc.getDocumentElement();
NodeList children = root.getChildNodes();
ArrayList<ScheduleTaskImpl> list = new ArrayList<ScheduleTaskImpl>();
int len = children.getLength();
for (int i = 0; i < len; i++) {
Node n = children.item(i)... | java | {
"resource": ""
} |
q24591 | SchedulerImpl.readInTask | train | private ScheduleTaskImpl readInTask(Element el) throws PageException {
long timeout = su.toLong(el, "timeout");
if (timeout > 0 && timeout < 1000) timeout *= 1000;
if (timeout < 0) timeout = 600000;
try {
ScheduleTaskImpl st = new ScheduleTaskImpl(this, su.toString(el, "name").trim(), su.toResource(config, el,... | java | {
"resource": ""
} |
q24592 | SchedulerImpl.setAttributes | train | private void setAttributes(Element el, ScheduleTask task) {
if (el == null) return;
NamedNodeMap atts = el.getAttributes();
for (int i = atts.getLength() - 1; i >= 0; i--) {
Attr att = (Attr) atts.item(i);
el.removeAttribute(att.getName());
}
su.setString(el, "name", task.getTask());
su.setFile(el, "f... | java | {
"resource": ""
} |
q24593 | SchedulerImpl.toElement | train | private Element toElement(ScheduleTask task) {
Element el = doc.createElement("task");
setAttributes(el, task);
return el;
} | java | {
"resource": ""
} |
q24594 | RollingResourceAppender.rollOver | train | public void rollOver() {
Resource target;
Resource file;
if (qw != null) {
long size = ((CountingQuietWriter) qw).getCount();
LogLog.debug("rolling over count=" + size);
// if operation fails, do not roll again until
// maxFileSize more bytes are written
nextRollover = size + maxFileSize;
... | java | {
"resource": ""
} |
q24595 | RollingResourceAppender.subAppend | train | @Override
protected void subAppend(LoggingEvent event) {
super.subAppend(event);
if (res != null && qw != null) {
long size = ((CountingQuietWriter) qw).getCount();
if (size >= maxFileSize && size >= nextRollover) {
rollOver();
}
}
} | java | {
"resource": ""
} |
q24596 | ErrorPagePool.getErrorPage | train | public ErrorPage getErrorPage(PageException pe, short type) {
for (int i = pages.size() - 1; i >= 0; i--) {
ErrorPageImpl ep = (ErrorPageImpl) pages.get(i);
if (ep.getType() == type) {
if (type == ErrorPage.TYPE_EXCEPTION) {
if (pe.typeEqual(ep.getTypeAsString())) return ep;
}
else return ep;
... | java | {
"resource": ""
} |
q24597 | ErrorPagePool.removeErrorPage | train | public void removeErrorPage(PageException pe) {
// exception
ErrorPage ep = getErrorPage(pe, ErrorPage.TYPE_EXCEPTION);
if (ep != null) {
pages.remove(ep);
hasChanged = true;
}
// request
ep = getErrorPage(pe, ErrorPage.TYPE_REQUEST);
if (ep != null) {
pages.remove(ep);
hasChanged = true;
}
... | java | {
"resource": ""
} |
q24598 | HTMLEntities.escapeHTML | train | public static String escapeHTML(String str, short version) {
String[][] data;
int[] offset;
StringBuilder rtn = new StringBuilder(str.length());
char[] chars = str.toCharArray();
if (version == HTMLV20) {
data = HTML20_DATA;
offset = HTML20_OFFSET;
}
else if (version == HTMLV32) {
data = HTML32_D... | java | {
"resource": ""
} |
q24599 | HTMLEntities.unescapeHTML | train | public static String unescapeHTML(String str) {
StringBuilder rtn = new StringBuilder();
int posStart = -1;
int posFinish = -1;
while ((posStart = str.indexOf('&', posStart)) != -1) {
int last = posFinish + 1;
posFinish = str.indexOf(';', posStart);
if (posFinish == -1) break;
rtn.append(str.s... | java | {
"resource": ""
} |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.