_id stringlengths 2 7 | title stringlengths 3 140 | partition stringclasses 3
values | text stringlengths 73 34.1k | language stringclasses 1
value | meta_information dict |
|---|---|---|---|---|---|
q24700 | IniFile.getKeyValueEL | train | public String getKeyValueEL(String strSection, String key) {
Map map = getSectionEL(strSection);
if (map == null) return null;
Object o = map.get(key.toLowerCase());
if (o == null) return null;
return (String) o;
} | java | {
"resource": ""
} |
q24701 | IniFile.load | train | public void load(InputStream in) throws IOException {
BufferedReader input = IOUtil.toBufferedReader(new InputStreamReader(in));
String read;
Map section = null;
String sectionName;
while ((read = input.readLine()) != null) {
if (read.startsWith(";") || read.startsWith("#")) {
continue;
}
else if... | java | {
"resource": ""
} |
q24702 | IniFile.save | train | public void save() throws IOException {
if (!file.exists()) file.createFile(true);
OutputStream out = IOUtil.toBufferedOutputStream(file.getOutputStream());
Iterator it = sections.keySet().iterator();
PrintWriter output = new PrintWriter(out);
try {
while (it.hasNext()) {
String strSection = (String) it.nex... | java | {
"resource": ""
} |
q24703 | AbstrCFMLScriptTransformer.switchStatement | train | private final Switch switchStatement(Data data) throws TemplateException {
if (!data.srcCode.forwardIfCurrent("switch", '(')) return null;
Position line = data.srcCode.getPosition();
comments(data);
Expression expr = super.expression(data);
comments(data);
// end )
if (!data.srcCode.forwardIfCurrent(')')) thro... | java | {
"resource": ""
} |
q24704 | AbstrCFMLScriptTransformer.caseStatement | train | private final boolean caseStatement(Data data, Switch swit) throws TemplateException {
if (!data.srcCode.forwardIfCurrentAndNoWordAfter("case")) return false;
// int line=data.srcCode.getLine();
comments(data);
Expression expr = super.expression(data);
comments(data);
if (!data.srcCode.forwardIfCurrent(':')) th... | java | {
"resource": ""
} |
q24705 | AbstrCFMLScriptTransformer.defaultStatement | train | private final boolean defaultStatement(Data data, Switch swit) throws TemplateException {
if (!data.srcCode.forwardIfCurrent("default", ':')) return false;
// int line=data.srcCode.getLine();
Body body = new BodyBase(data.factory);
swit.setDefaultCase(body);
switchBlock(data, body);
return true;
} | java | {
"resource": ""
} |
q24706 | AbstrCFMLScriptTransformer.switchBlock | train | private final void switchBlock(Data data, Body body) throws TemplateException {
while (data.srcCode.isValidIndex()) {
comments(data);
if (data.srcCode.isCurrent("case ") || data.srcCode.isCurrent("default", ':') || data.srcCode.isCurrent('}')) return;
Body prior = data.setParent(body);
statement(d... | java | {
"resource": ""
} |
q24707 | AbstrCFMLScriptTransformer.isFinish | train | private final boolean isFinish(Data data) throws TemplateException {
comments(data);
if (data.tagName == null) return false;
return data.srcCode.isCurrent("</", data.tagName);
} | java | {
"resource": ""
} |
q24708 | HTMLUtil.getURLS | train | public List<URL> getURLS(String html, URL url) {
List<URL> urls = new ArrayList<URL>();
SourceCode cfml = new SourceCode(html, false, CFMLEngine.DIALECT_CFML);
while (!cfml.isAfterLast()) {
if (cfml.forwardIfCurrent('<')) {
for (int i = 0; i < tags.length; i++) {
if (cfml.forwardIfCurrent(tags[i].tag +... | java | {
"resource": ""
} |
q24709 | CFMXCompat.isCfmxCompat | train | public static boolean isCfmxCompat(String algorithm) {
if (StringUtil.isEmpty(algorithm, true)) return true;
return algorithm.equalsIgnoreCase(CFMXCompat.ALGORITHM_NAME);
} | java | {
"resource": ""
} |
q24710 | TagLibFactory.loadFromDirectory | train | public static TagLib[] loadFromDirectory(Resource dir, Identification id) throws TagLibException {
if (!dir.isDirectory()) return new TagLib[0];
ArrayList<TagLib> arr = new ArrayList<TagLib>();
Resource[] files = dir.listResources(new ExtensionResourceFilter(new String[] { "tld", "tldx" }));
for (int i = 0; i < fi... | java | {
"resource": ""
} |
q24711 | TagLibFactory.loadFromSystem | train | private static TagLib[] loadFromSystem(Identification id) throws TagLibException {
if (systemTLDs[CFMLEngine.DIALECT_CFML] == null) {
TagLib cfml = new TagLibFactory(null, TLD_BASE, id).getLib();
TagLib lucee = cfml.duplicate(false);
systemTLDs[CFMLEngine.DIALECT_CFML] = new TagLibFactory(cfml, TLD_CFM... | java | {
"resource": ""
} |
q24712 | Mail.setProxyport | train | public void setProxyport(double proxyport) throws ApplicationException {
try {
smtp.getProxyData().setPort((int) proxyport);
}
catch (Exception e) {
throw new ApplicationException("attribute [proxyport] of the tag [mail] is invalid", e.getMessage());
}
} | java | {
"resource": ""
} |
q24713 | Mail.setProxyuser | train | public void setProxyuser(String proxyuser) throws ApplicationException {
try {
smtp.getProxyData().setUsername(proxyuser);
}
catch (Exception e) {
throw new ApplicationException("attribute [proxyuser] of the tag [mail] is invalid", e.getMessage());
}
} | java | {
"resource": ""
} |
q24714 | Mail.setProxypassword | train | public void setProxypassword(String proxypassword) throws ApplicationException {
try {
smtp.getProxyData().setPassword(proxypassword);
}
catch (Exception e) {
throw new ApplicationException("attribute [proxypassword] of the tag [mail] is invalid", e.getMessage());
}
} | java | {
"resource": ""
} |
q24715 | Mail.setFrom | train | public void setFrom(Object from) throws PageException {
if (StringUtil.isEmpty(from, true)) throw new ApplicationException("attribute [from] cannot be empty");
try {
smtp.setFrom(from);
}
catch (Exception e) {
throw Caster.toPageException(e);
}
} | java | {
"resource": ""
} |
q24716 | Mail.setTo | train | public void setTo(Object to) throws ApplicationException {
if (StringUtil.isEmpty(to)) return;
try {
smtp.addTo(to);
}
catch (Exception e) {
throw new ApplicationException("attribute [to] of the tag [mail] is invalid", e.getMessage());
}
} | java | {
"resource": ""
} |
q24717 | Mail.setCc | train | public void setCc(Object cc) throws ApplicationException {
if (StringUtil.isEmpty(cc)) return;
try {
smtp.addCC(cc);
}
catch (Exception e) {
throw new ApplicationException("attribute [cc] of the tag [mail] is invalid", e.getMessage());
}
} | java | {
"resource": ""
} |
q24718 | Mail.setBcc | train | public void setBcc(Object bcc) throws ApplicationException {
if (StringUtil.isEmpty(bcc)) return;
try {
smtp.addBCC(bcc);
}
catch (Exception e) {
throw new ApplicationException("attribute [bcc] of the tag [mail] is invalid", e.getMessage());
}
} | java | {
"resource": ""
} |
q24719 | Mail.setType | train | public void setType(String type) throws ApplicationException {
type = type.toLowerCase().trim();
if (type.equals("text/plain") || type.equals("plain") || type.equals("text")) getPart().isHTML(false);
// mail.setType(lucee.runtime.mail.Mail.TYPE_TEXT);
else if (type.equals("text/html") || type.equals("html") || type... | java | {
"resource": ""
} |
q24720 | Mail.setMimeattach | train | public void setMimeattach(String strMimeattach, String fileName, String type, String disposition, String contentID, boolean removeAfterSend) throws PageException {
Resource file = ResourceUtil.toResourceNotExisting(pageContext, strMimeattach);
pageContext.getConfig().getSecurityManager().checkFileLocation(file);
if ... | java | {
"resource": ""
} |
q24721 | Mail.setParam | train | public void setParam(String type, String file, String fileName, String name, String value, String disposition, String contentID, Boolean oRemoveAfterSend)
throws PageException {
if (file != null) {
boolean removeAfterSend = (oRemoveAfterSend == null) ? remove : oRemoveAfterSend.booleanValue();
setMimea... | java | {
"resource": ""
} |
q24722 | SoftMethodStorage.getMethods | train | public Method[] getMethods(Class clazz, Collection.Key methodName, int count) {
Map<Key, Array> methodsMap = map.get(clazz);
if (methodsMap == null) methodsMap = store(clazz);
Array methods = methodsMap.get(methodName);
if (methods == null) return null;
Object o = methods.get(count + 1, null);
if (o == null) re... | java | {
"resource": ""
} |
q24723 | SoftMethodStorage.storeArgs | train | private void storeArgs(Method method, Array methodArgs) {
Class[] pmt = method.getParameterTypes();
Method[] args;
synchronized (methodArgs) {
Object o = methodArgs.get(pmt.length + 1, null);
if (o == null) {
args = new Method[1];
methodArgs.setEL(pmt.length + 1, args);
}
else {
Method[] m... | java | {
"resource": ""
} |
q24724 | ConfigWebImpl.getApplicationMapping | train | public Mapping getApplicationMapping(String virtual, String physical) {
return getApplicationMapping("application", virtual, physical, null, true, false);
} | java | {
"resource": ""
} |
q24725 | CSVString.fwdQuote | train | StringBuilder fwdQuote(char q) {
StringBuilder sb = new StringBuilder();
while (hasNext()) {
next();
sb.append(buffer[pos]);
if (isCurr(q)) {
if (isNext(q)) { // consecutive quote sign
next();
}
else {
break;
}
}
}
if (sb.length() > 0) sb.setLength(sb.length() - 1); // r... | java | {
"resource": ""
} |
q24726 | MD5Checksum.getMD5Checksum | train | public static String getMD5Checksum(Resource res) throws Exception {
byte[] b = createChecksum(res);
String result = "";
for (int i = 0; i < b.length; i++) {
result += Integer.toString((b[i] & 0xff) + 0x100, 16).substring(1);
}
return result;
} | java | {
"resource": ""
} |
q24727 | FTPPoolImpl._get | train | protected FTPWrap _get(FTPConnection conn) throws IOException, ApplicationException {
FTPWrap wrap = null;
if (!conn.hasLoginData()) {
if (StringUtil.isEmpty(conn.getName())) {
throw new ApplicationException("can't connect ftp server, missing connection definition");
}
wrap = wraps.get(conn.getName... | java | {
"resource": ""
} |
q24728 | FTPPoolImpl.disconnect | train | private void disconnect(AFTPClient client) {
try {
if (client != null && client.isConnected()) {
client.quit();
client.disconnect();
}
}
catch (IOException ioe) {}
} | java | {
"resource": ""
} |
q24729 | XMLConfigFactory.createConfigFile | train | static void createConfigFile(String xmlName, Resource configFile) throws IOException {
configFile.createFile(true);
createFileFromResource("/resource/config/" + xmlName + ".xml", configFile.getAbsoluteResource());
} | java | {
"resource": ""
} |
q24730 | XMLConfigFactory.getChildByName | train | static Element getChildByName(Node parent, String nodeName) {
return getChildByName(parent, nodeName, false);
} | java | {
"resource": ""
} |
q24731 | QueryUtil.getColumnNames | train | public static Key[] getColumnNames(Query qry) {
Query qp = Caster.toQuery(qry, null);
if (qp != null) return qp.getColumnNames();
String[] strNames = qry.getColumns();
Key[] names = new Key[strNames.length];
for (int i = 0; i < names.length; i++) {
names[i] = KeyImpl.getInstance(strNames[i]);
}
return name... | java | {
"resource": ""
} |
q24732 | QueryUtil.checkSQLRestriction | train | public static void checkSQLRestriction(DatasourceConnection dc, SQL sql) throws PageException {
Array sqlparts = ListUtil.listToArrayRemoveEmpty(SQLUtil.removeLiterals(sql.getSQLString()), " \t" + System.getProperty("line.separator"));
// print.ln(List.toStringArray(sqlparts));
DataSource ds = dc.getDatasource();
... | java | {
"resource": ""
} |
q24733 | StringList.add | train | public void add(String str) {
curr.next = new Entry(str, Entry.NUL);
curr = curr.next;
count++;
} | java | {
"resource": ""
} |
q24734 | SimpleExprTransformer.string | train | public Expression string(Factory f, SourceCode cfml) throws TemplateException {
cfml.removeSpace();
char quoter = cfml.getCurrentLower();
if (quoter != '"' && quoter != '\'') return null;
StringBuffer str = new StringBuffer();
boolean insideSpecial = false;
Position line = cfml.getPosition();
while (cfml.hasNex... | java | {
"resource": ""
} |
q24735 | Collection.release | train | @Override
public void release() {
super.release();
action = "list";
path = null;
collection = null;
name = null;
language = "english";
// categories=false;
} | java | {
"resource": ""
} |
q24736 | Collection.setPath | train | public void setPath(String strPath) throws PageException {
if (strPath == null) return;
this.path = ResourceUtil.toResourceNotExisting(pageContext, strPath.trim());
// this.path=new File(path.toLowerCase().trim());
pageContext.getConfig().getSecurityManager().checkFileLocation(this.path);
if (!this.path.exists()... | java | {
"resource": ""
} |
q24737 | Collection.doList | train | private void doList() throws PageException, SearchException {
required("collection", action, "name", name);
// if(StringUtil.isEmpty(name))throw new ApplicationException("for action list attribute name is
// required");
pageContext.setVariable(name, getSearchEngine().getCollectionsAsQuery());
} | java | {
"resource": ""
} |
q24738 | Collection.doCreate | train | private void doCreate() throws SearchException, PageException {
required("collection", action, "collection", collection);
required("collection", action, "path", path);
getSearchEngine().createCollection(collection, path, language, SearchEngine.DENY_OVERWRITE);
} | java | {
"resource": ""
} |
q24739 | ClassUtil.isBytecode | train | public static boolean isBytecode(InputStream is) throws IOException {
if (!is.markSupported()) throw new IOException("can only read input streams that support mark/reset");
is.mark(-1);
// print(bytes);
int first = is.read();
int second = is.read();
boolean rtn = (first == ICA && second == IFE && is.read() == IBA... | java | {
"resource": ""
} |
q24740 | ClassUtil.getFieldNames | train | public static String[] getFieldNames(Class clazz) {
Field[] fields = clazz.getFields();
String[] names = new String[fields.length];
for (int i = 0; i < names.length; i++) {
names[i] = fields[i].getName();
}
return names;
} | java | {
"resource": ""
} |
q24741 | ClassUtil.getSourcePathForClass | train | public static String getSourcePathForClass(Class clazz, String defaultValue) {
try {
String result = clazz.getProtectionDomain().getCodeSource().getLocation().getPath();
result = URLDecoder.decode(result, CharsetUtil.UTF8.name());
result = SystemUtil.fixWindowsPath(result);
return result;
}
cat... | java | {
"resource": ""
} |
q24742 | ClassUtil.getSourcePathForClass | train | public static String getSourcePathForClass(String className, String defaultValue) {
try {
return getSourcePathForClass(ClassUtil.loadClass(className), defaultValue);
}
catch (Throwable t) {
ExceptionUtil.rethrowIfNecessary(t);
}
return defaultValue;
} | java | {
"resource": ""
} |
q24743 | ClassUtil.extractPackage | train | public static String extractPackage(String className) {
if (className == null) return null;
int index = className.lastIndexOf('.');
if (index != -1) return className.substring(0, index);
return null;
} | java | {
"resource": ""
} |
q24744 | ClassUtil.extractName | train | public static String extractName(String className) {
if (className == null) return null;
int index = className.lastIndexOf('.');
if (index != -1) return className.substring(index + 1);
return className;
} | java | {
"resource": ""
} |
q24745 | ClassUtil.loadClass | train | public static Class loadClass(String className, String bundleName, String bundleVersion, Identification id) throws ClassException, BundleException {
if (StringUtil.isEmpty(bundleName)) return loadClass(className);
return loadClassByBundle(className, bundleName, bundleVersion, id);
} | java | {
"resource": ""
} |
q24746 | UndefinedImpl.getScopeFor | train | public Collection getScopeFor(Collection.Key key, Scope defaultValue) {
Object rtn = null;
if (checkArguments) {
rtn = local.get(key, NullSupportHelper.NULL());
if (rtn != NullSupportHelper.NULL()) return local;
rtn = argument.getFunctionArgument(key, NullSupportHelper.NULL());
if (rtn != NullSup... | java | {
"resource": ""
} |
q24747 | UndefinedImpl.getScopeNames | train | @Override
public List<String> getScopeNames() {
List<String> scopeNames = new ArrayList<String>();
if (checkArguments) {
scopeNames.add("local");
scopeNames.add("arguments");
}
scopeNames.add("variables");
// thread scopes
if (pc.hasFamily()) {
String[] names = pc.getThreadScopeNames();
... | java | {
"resource": ""
} |
q24748 | ServerImpl.isReadOnlyKey | train | private boolean isReadOnlyKey(Collection.Key key) {
return (key.equals(KeyConstants._java) || key.equals(KeyConstants._separator) || key.equals(KeyConstants._os) || key.equals(KeyConstants._coldfusion)
|| key.equals(KeyConstants._lucee));
} | java | {
"resource": ""
} |
q24749 | FDControllerImpl.getByNativeIdentifier | train | private FDThreadImpl getByNativeIdentifier(String name, CFMLFactoryImpl factory, String id) {
Map<Integer, PageContextImpl> pcs = factory.getActivePageContexts();
Iterator<PageContextImpl> it = pcs.values().iterator();
PageContextImpl pc;
while (it.hasNext()) {
pc = it.next();
if (equals(pc, id)) return ... | java | {
"resource": ""
} |
q24750 | MimeType.getInstance | train | public static MimeType getInstance(String strMimeType) {
if (strMimeType == null) return ALL;
strMimeType = strMimeType.trim();
if ("*".equals(strMimeType) || strMimeType.length() == 0) return ALL;
String[] arr = ListUtil.listToStringArray(strMimeType, ';');
if (arr.length == 0) return ALL;
String[] arrCT = Lis... | java | {
"resource": ""
} |
q24751 | MimeType.match | train | public boolean match(MimeType other) {
if (this == other) return true;
if (type != null && other.type != null && !type.equals(other.type)) return false;
if (subtype != null && other.subtype != null && !subtype.equals(other.subtype)) return false;
return true;
} | java | {
"resource": ""
} |
q24752 | HSQLUtil.getInvokedTables | train | public Set<String> getInvokedTables() throws ParseException {
// Read all SQL statements from input
ZStatement st;
Set<String> tables = new HashSet<String>();
while ((st = parser.readStatement()) != null) {
this.sql = st.toString();
if (st instanceof ZQuery) { // An SQL query: query the DB
getInvokedT... | java | {
"resource": ""
} |
q24753 | ResourceUtil.toExactResource | train | public static Resource toExactResource(Resource res) {
res = getCanonicalResourceEL(res);
if (res.getResourceProvider().isCaseSensitive()) {
if (res.exists()) return res;
return _check(res);
}
return res;
} | java | {
"resource": ""
} |
q24754 | ResourceUtil.createResource | train | public static Resource createResource(Resource res, short level, short type) {
boolean asDir = type == TYPE_DIR;
// File
if (level >= LEVEL_FILE && res.exists() && ((res.isDirectory() && asDir) || (res.isFile() && !asDir))) {
return getCanonicalResourceEL(res);
}
// Parent
Resource parent = res.getParentRe... | java | {
"resource": ""
} |
q24755 | ResourceUtil.translateAttribute | train | public static String translateAttribute(String attributes) throws IOException {
short[] flags = strAttrToBooleanFlags(attributes);
StringBuilder sb = new StringBuilder();
if (flags[READ_ONLY] == YES) sb.append(" +R");
else if (flags[READ_ONLY] == NO) sb.append(" -R");
if (flags[HIDDEN] == YES) sb.append(" +H");
... | java | {
"resource": ""
} |
q24756 | ResourceUtil.merge | train | public static String merge(String parent, String child) {
if (child.length() <= 2) {
if (child.length() == 0) return parent;
if (child.equals(".")) return parent;
if (child.equals("..")) child = "../";
}
parent = translatePath(parent, true, false);
child = prettifyPath(child);// child.replace('\\', ... | java | {
"resource": ""
} |
q24757 | ResourceUtil.getCanonicalPathEL | train | public static String getCanonicalPathEL(Resource res) {
try {
return res.getCanonicalPath();
}
catch (IOException e) {
return res.toString();
}
} | java | {
"resource": ""
} |
q24758 | ResourceUtil.createNewResourceEL | train | public static boolean createNewResourceEL(Resource res) {
try {
res.createFile(false);
return true;
}
catch (IOException e) {
return false;
}
} | java | {
"resource": ""
} |
q24759 | ResourceUtil.touch | train | public static void touch(Resource res) throws IOException {
if (res.exists()) {
res.setLastModified(System.currentTimeMillis());
}
else {
res.createFile(true);
}
} | java | {
"resource": ""
} |
q24760 | ResourceUtil.isChildOf | train | public static boolean isChildOf(Resource file, Resource dir) {
while (file != null) {
if (file.equals(dir)) return true;
file = file.getParentResource();
}
return false;
} | java | {
"resource": ""
} |
q24761 | ResourceUtil.getPathToChild | train | public static String getPathToChild(Resource file, Resource dir) {
if (dir == null || !file.getResourceProvider().getScheme().equals(dir.getResourceProvider().getScheme())) return null;
boolean isFile = file.isFile();
String str = "/";
while (file != null) {
if (file.equals(dir)) {
if (isFile) return str.sub... | java | {
"resource": ""
} |
q24762 | ResourceUtil.splitFileName | train | public static String[] splitFileName(String fileName) {
int pos = fileName.lastIndexOf('.');
if (pos == -1) {
return new String[] { fileName };
}
return new String[] { fileName.substring(0, pos), fileName.substring(pos + 1) };
} | java | {
"resource": ""
} |
q24763 | ResourceUtil.changeExtension | train | public static Resource changeExtension(Resource file, String newExtension) {
String ext = getExtension(file, null);
if (ext == null) return file.getParentResource().getRealResource(file.getName() + '.' + newExtension);
// new File(file.getParentFile(),file.getName()+'.'+newExtension);
String name = file.getName();
... | java | {
"resource": ""
} |
q24764 | ResourceUtil.parentExists | train | private static boolean parentExists(Resource res) {
res = res.getParentResource();
return res != null && res.exists();
} | java | {
"resource": ""
} |
q24765 | ResourceUtil.getRealSize | train | public static long getRealSize(Resource res, ResourceFilter filter) {
if (res.isFile()) {
return res.length();
}
else if (res.isDirectory()) {
long size = 0;
Resource[] children = filter == null ? res.listResources() : res.listResources(filter);
for (int i = 0; i < children.length; i++) {
size ... | java | {
"resource": ""
} |
q24766 | ResourceUtil.isEmptyDirectory | train | public static boolean isEmptyDirectory(Resource res, ResourceFilter filter) {
if (res.isDirectory()) {
Resource[] children = filter == null ? res.listResources() : res.listResources(filter);
if (children == null || children.length == 0) return true;
for (int i = 0; i < children.length; i++) {
if (chi... | java | {
"resource": ""
} |
q24767 | ResourceUtil.listResources | train | public static Resource[] listResources(Resource[] resources, ResourceFilter filter) {
int count = 0;
Resource[] children;
ArrayList<Resource[]> list = new ArrayList<Resource[]>();
for (int i = 0; i < resources.length; i++) {
children = filter == null ? resources[i].listResources() : resources[i].listResources(... | java | {
"resource": ""
} |
q24768 | ResourceUtil.checkCreateDirectoryOK | train | public static void checkCreateDirectoryOK(Resource resource, boolean createParentWhenNotExists) throws IOException {
if (resource.exists()) {
if (resource.isFile()) throw new IOException("can't create directory [" + resource.getPath() + "], resource already exists as a file");
if (resource.isDirectory()) thr... | java | {
"resource": ""
} |
q24769 | ResourceUtil.checkCopyToOK | train | public static void checkCopyToOK(Resource source, Resource target) throws IOException {
if (!source.isFile()) {
if (source.isDirectory()) throw new IOException("can't copy [" + source.getPath() + "] to [" + target.getPath() + "], source is a directory");
throw new IOException("can't copy [" + source.getPath(... | java | {
"resource": ""
} |
q24770 | ResourceUtil.checkMoveToOK | train | public static void checkMoveToOK(Resource source, Resource target) throws IOException {
if (!source.exists()) {
throw new IOException("can't move [" + source.getPath() + "] to [" + target.getPath() + "], source file does not exist");
}
if (source.isDirectory() && target.isFile()) throw new IOException("can't mo... | java | {
"resource": ""
} |
q24771 | ResourceUtil.checkGetInputStreamOK | train | public static void checkGetInputStreamOK(Resource resource) throws IOException {
if (!resource.exists()) throw new IOException("file [" + resource.getPath() + "] does not exist");
if (resource.isDirectory()) throw new IOException("can't read directory [" + resource.getPath() + "] as a file");
} | java | {
"resource": ""
} |
q24772 | ResourceUtil.checkGetOutputStreamOK | train | public static void checkGetOutputStreamOK(Resource resource) throws IOException {
if (resource.exists() && !resource.isWriteable()) {
throw new IOException("can't write to file [" + resource.getPath() + "],file is readonly");
}
if (resource.isDirectory()) throw new IOException("can't write directory [" + resour... | java | {
"resource": ""
} |
q24773 | ResourceUtil.checkRemoveOK | train | public static void checkRemoveOK(Resource resource) throws IOException {
if (!resource.exists()) throw new IOException("can't delete resource " + resource + ", resource does not exist");
if (!resource.canWrite()) throw new IOException("can't delete resource " + resource + ", no access");
} | java | {
"resource": ""
} |
q24774 | Http.setTimeout | train | public void setTimeout(Object timeout) throws PageException {
if (timeout instanceof TimeSpan) this.timeout = (TimeSpan) timeout;
// seconds
else {
int i = Caster.toIntValue(timeout);
if (i < 0) throw new ApplicationException("invalid value [" + i + "] for attribute timeout, value must be a positive intege... | java | {
"resource": ""
} |
q24775 | Http.setColumns | train | public void setColumns(String columns) throws PageException {
this.columns = ListUtil.toStringArray(ListUtil.listToArrayRemoveEmpty(columns, ","));
} | java | {
"resource": ""
} |
q24776 | Http.setMethod | train | public void setMethod(String method) throws ApplicationException {
method = method.toLowerCase().trim();
if (method.equals("post")) this.method = METHOD_POST;
else if (method.equals("get")) this.method = METHOD_GET;
else if (method.equals("head")) this.method = METHOD_HEAD;
else if (method.equals("delete")) this.m... | java | {
"resource": ""
} |
q24777 | Http.isRedirect | train | static boolean isRedirect(int status) {
return status == STATUS_REDIRECT_FOUND || status == STATUS_REDIRECT_MOVED_PERMANENTLY || status == STATUS_REDIRECT_SEE_OTHER
|| status == STATUS_REDIRECT_TEMPORARY_REDIRECT;
} | java | {
"resource": ""
} |
q24778 | Http.mergePath | train | public static String mergePath(String current, String realPath) throws MalformedURLException {
// get current directory
String currDir;
if (current == null || current.indexOf('/') == -1) currDir = "/";
else if (current.endsWith("/")) currDir = current;
else currDir = current.substring(0, current.lastIndexOf('/') ... | java | {
"resource": ""
} |
q24779 | PageExceptionImpl.setAdditional | train | public void setAdditional(Collection.Key key, Object value) {
additional.setEL(key, StringUtil.toStringEmptyIfNull(value));
} | java | {
"resource": ""
} |
q24780 | BinConverter.byteArrayToLong | train | public static long byteArrayToLong(byte[] buffer, int nStartIndex) {
return (((long) buffer[nStartIndex]) << 56) | ((buffer[nStartIndex + 1] & 0x0ffL) << 48) | ((buffer[nStartIndex + 2] & 0x0ffL) << 40)
| ((buffer[nStartIndex + 3] & 0x0ffL) << 32) | ((buffer[nStartIndex + 4] & 0x0ffL) << 24) | ((buffer[nStartIndex ... | java | {
"resource": ""
} |
q24781 | BinConverter.longToByteArray | train | public static void longToByteArray(long lValue, byte[] buffer, int nStartIndex) {
buffer[nStartIndex] = (byte) (lValue >>> 56);
buffer[nStartIndex + 1] = (byte) ((lValue >>> 48) & 0x0ff);
buffer[nStartIndex + 2] = (byte) ((lValue >>> 40) & 0x0ff);
buffer[nStartIndex + 3] = (byte) ((lValue >>> 32) & 0x0ff);
buffer[... | java | {
"resource": ""
} |
q24782 | BinConverter.longToIntArray | train | public static void longToIntArray(long lValue, int[] buffer, int nStartIndex) {
buffer[nStartIndex] = (int) (lValue >>> 32);
buffer[nStartIndex + 1] = (int) lValue;
} | java | {
"resource": ""
} |
q24783 | BinConverter.byteArrayToUNCString | train | public static String byteArrayToUNCString(byte[] data, int nStartPos, int nNumOfBytes) {
// we need two bytes for every character
nNumOfBytes &= ~1;
// enough bytes in the buffer?
int nAvailCapacity = data.length - nStartPos;
if (nAvailCapacity < nNumOfBytes) nNumOfBytes = nAvailCapacity;
StringBuilder sbuf = new... | java | {
"resource": ""
} |
q24784 | FunctionLib.duplicate | train | public FunctionLib duplicate(boolean deepCopy) {
FunctionLib fl = new FunctionLib();
fl.description = this.description;
fl.displayName = this.displayName;
fl.functions = duplicate(this.functions, deepCopy);
fl.shortName = this.shortName;
fl.uri = this.uri;
fl.version = this.version;
return fl;
} | java | {
"resource": ""
} |
q24785 | FunctionLib.duplicate | train | private HashMap duplicate(HashMap funcs, boolean deepCopy) {
if (deepCopy) throw new PageRuntimeException(new ExpressionException("deep copy not supported"));
Iterator it = funcs.entrySet().iterator();
Map.Entry entry;
HashMap cm = new HashMap();
while (it.hasNext()) {
entry = (Entry) it.next();
cm.put(... | java | {
"resource": ""
} |
q24786 | CFMLEngineFactorySupport.toVersion | train | public static Version toVersion(String version, final Version defaultValue) {
// remove extension if there is any
final int rIndex = version.lastIndexOf(".lco");
if (rIndex != -1) version = version.substring(0, rIndex);
try {
return Version.parseVersion(version);
}
catch (final IllegalArgumentException iae)... | java | {
"resource": ""
} |
q24787 | CFMLEngineFactorySupport.getTempDirectory | train | public static File getTempDirectory() {
if (tempFile != null) return tempFile;
final String tmpStr = System.getProperty("java.io.tmpdir");
if (tmpStr != null) {
tempFile = new File(tmpStr);
if (tempFile.exists()) {
tempFile = getCanonicalFileEL(tempFile);
return tempFile;
}
}
try {
final F... | java | {
"resource": ""
} |
q24788 | HTTPUtil.toURL | train | public static URL toURL(String strUrl, int port, boolean encodeIfNecessary) throws MalformedURLException {
URL url;
try {
url = new URL(strUrl);
}
catch (MalformedURLException mue) {
url = new URL("http://" + strUrl);
}
if (!encodeIfNecessary) return url;
return encodeURL(url, port);
} | java | {
"resource": ""
} |
q24789 | HTTPUtil.encode | train | public static String encode(String realpath) {
int qIndex = realpath.indexOf('?');
if (qIndex == -1) return realpath;
String file = realpath.substring(0, qIndex);
String query = realpath.substring(qIndex + 1);
int sIndex = query.indexOf('#');
String anker = null;
if (sIndex != -1) {
// print.o(sIndex);
... | java | {
"resource": ""
} |
q24790 | HTTPUtil.length | train | public static long length(URL url) throws IOException {
HTTPResponse http = HTTPEngine.head(url, null, null, -1, true, null, Constants.NAME, null, null);
long len = http.getContentLength();
HTTPEngine.closeEL(http);
return len;
} | java | {
"resource": ""
} |
q24791 | ReqRspUtil.self | train | public static String self(HttpServletRequest req) {
StringBuffer sb = new StringBuffer(req.getServletPath());
String qs = req.getQueryString();
if (!StringUtil.isEmpty(qs)) sb.append('?').append(qs);
return sb.toString();
} | java | {
"resource": ""
} |
q24792 | ReqRspUtil.getRequestBody | train | public static Object getRequestBody(PageContext pc, boolean deserialized, Object defaultValue) {
HttpServletRequest req = pc.getHttpServletRequest();
MimeType contentType = getContentType(pc);
String strContentType = contentType == MimeType.ALL ? null : contentType.toString();
Charset cs = getCharacterEncoding(pc... | java | {
"resource": ""
} |
q24793 | ReqRspUtil.getRequestURL | train | public static String getRequestURL(HttpServletRequest req, boolean includeQueryString) {
StringBuffer sb = req.getRequestURL();
int maxpos = sb.indexOf("/", 8);
if (maxpos > -1) {
if (req.isSecure()) {
if (sb.substring(maxpos - 4, maxpos).equals(":443")) sb.delete(maxpos - 4, maxpos);
}
else {
... | java | {
"resource": ""
} |
q24794 | ReqRspUtil.encodeRedirectURLEL | train | public static String encodeRedirectURLEL(HttpServletResponse rsp, String url) {
try {
return rsp.encodeRedirectURL(url);
}
catch (Throwable t) {
ExceptionUtil.rethrowIfNecessary(t);
return url;
}
} | java | {
"resource": ""
} |
q24795 | Schedule.setStartdate | train | public void setStartdate(Object objStartDate) throws PageException {
if (StringUtil.isEmpty(objStartDate)) return;
this.startdate = new DateImpl(DateCaster.toDateAdvanced(objStartDate, pageContext.getTimeZone()));
} | java | {
"resource": ""
} |
q24796 | Schedule.setEnddate | train | public void setEnddate(Object enddate) throws PageException {
if (StringUtil.isEmpty(enddate)) return;
this.enddate = new DateImpl(DateCaster.toDateAdvanced(enddate, pageContext.getTimeZone()));
} | java | {
"resource": ""
} |
q24797 | Schedule.setStarttime | train | public void setStarttime(Object starttime) throws PageException {
if (StringUtil.isEmpty(starttime)) return;
this.starttime = DateCaster.toTime(pageContext.getTimeZone(), starttime);
} | java | {
"resource": ""
} |
q24798 | Schedule.setProxyport | train | public void setProxyport(Object oProxyport) throws PageException {
if (StringUtil.isEmpty(oProxyport)) return;
this.proxyport = Caster.toIntValue(oProxyport);
} | java | {
"resource": ""
} |
q24799 | Schedule.setPort | train | public void setPort(Object oPort) throws PageException {
if (StringUtil.isEmpty(oPort)) return;
this.port = Caster.toIntValue(oPort);
} | java | {
"resource": ""
} |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.