_id stringlengths 2 7 | title stringlengths 3 140 | partition stringclasses 3
values | text stringlengths 73 34.1k | language stringclasses 1
value | meta_information dict |
|---|---|---|---|---|---|
q24600 | Reflector.getClasses | train | public static Class[] getClasses(Object[] objs) {
Class[] cls = new Class[objs.length];
for (int i = 0; i < objs.length; i++) {
if (objs[i] == null) cls[i] = Object.class;
else cls[i] = objs[i].getClass();
}
return cls;
} | java | {
"resource": ""
} |
q24601 | Reflector.getDspMethods | train | public static String getDspMethods(Class... clazzArgs) {
StringBuffer sb = new StringBuffer();
for (int i = 0; i < clazzArgs.length; i++) {
if (i > 0) sb.append(", ");
sb.append(Caster.toTypeName(clazzArgs[i]));
}
return sb.toString();
} | java | {
"resource": ""
} |
q24602 | Reflector.like | train | public static boolean like(Class src, Class trg) {
if (src == trg) return true;
return isInstaneOf(src, trg);
} | java | {
"resource": ""
} |
q24603 | Reflector.convert | train | public static Object convert(Object src, Class trgClass, RefInteger rating) throws PageException {
if (rating != null) {
Object trg = _convert(src, trgClass);
if (src == trg) {
rating.plus(10);
return trg;
}
if (src == null || trg == null) {
rating.plus(0);
return trg;
}
if (isIns... | java | {
"resource": ""
} |
q24604 | Reflector.getConstructorInstance | train | public static ConstructorInstance getConstructorInstance(Class clazz, Object[] args) throws NoSuchMethodException {
ConstructorInstance ci = getConstructorInstance(clazz, args, null);
if (ci != null) return ci;
throw new NoSuchMethodException("No matching Constructor for " + clazz.getName() + "(" + getDspMethods(get... | java | {
"resource": ""
} |
q24605 | Reflector.callConstructor | train | public static Object callConstructor(Class clazz, Object[] args) throws PageException {
args = cleanArgs(args);
try {
return getConstructorInstance(clazz, args).invoke();
}
catch (InvocationTargetException e) {
Throwable target = e.getTargetException();
if (target instanceof PageException) throw (Pag... | java | {
"resource": ""
} |
q24606 | Reflector.callMethod | train | public static Object callMethod(Object obj, String methodName, Object[] args) throws PageException {
return callMethod(obj, KeyImpl.getInstance(methodName), args);
} | java | {
"resource": ""
} |
q24607 | Reflector.callStaticMethod | train | public static Object callStaticMethod(Class clazz, String methodName, Object[] args) throws PageException {
try {
return getMethodInstance(null, clazz, methodName, args).invoke(null);
}
catch (InvocationTargetException e) {
Throwable target = e.getTargetException();
if (target instanceof PageException... | java | {
"resource": ""
} |
q24608 | Reflector.callSetterEL | train | public static void callSetterEL(Object obj, String prop, Object value) throws PageException {
try {
MethodInstance setter = getSetter(obj, prop, value, null);
if (setter != null) setter.invoke(obj);
}
catch (InvocationTargetException e) {
Throwable target = e.getTargetException();
if (target inst... | java | {
"resource": ""
} |
q24609 | Reflector.getField | train | public static Object getField(Object obj, String prop) throws PageException {
try {
return getFieldsIgnoreCase(obj.getClass(), prop)[0].get(obj);
}
catch (Throwable e) {
ExceptionUtil.rethrowIfNecessary(e);
throw Caster.toPageException(e);
}
} | java | {
"resource": ""
} |
q24610 | Reflector.setField | train | public static boolean setField(Object obj, String prop, Object value) throws PageException {
Class clazz = value.getClass();
try {
Field[] fields = getFieldsIgnoreCase(obj.getClass(), prop);
// exact comparsion
for (int i = 0; i < fields.length; i++) {
if (toReferenceClass(fields[i].getType()) == cla... | java | {
"resource": ""
} |
q24611 | Reflector.canConvert | train | public static boolean canConvert(Class from, Class to) {
// Identity Conversions
if (from == to) return true;
// Widening Primitive Conversion
if (from == byte.class) {
return to == short.class || to == int.class || to == long.class || to == float.class || to == double.class;
}
if (from == short.class) {
... | java | {
"resource": ""
} |
q24612 | DatabaseException.getCatchBlock | train | @Override
public CatchBlock getCatchBlock(Config config) {
String strSQL = sql == null ? "" : sql.toString();
if (StringUtil.isEmpty(strSQL)) strSQL = Caster.toString(getAdditional().get("SQL", ""), "");
String datasourceName = datasource == null ? "" : datasource.getName();
if (StringUtil.isEmpty(datasourceNa... | java | {
"resource": ""
} |
q24613 | XMLEventParser.start | train | public void start(Resource xmlFile) throws PageException {
InputStream is = null;
try {
XMLReader xmlReader = XMLUtil.createXMLReader();
xmlReader.setContentHandler(this);
xmlReader.setErrorHandler(this);
xmlReader.parse(new InputSource(is = IOUtil.toBufferedInputStream(xmlFile.getInputStream())))... | java | {
"resource": ""
} |
q24614 | XMLEventParser.call | train | private void call(UDF udf, Object[] arguments) {
try {
udf.call(pc, arguments, false);
}
catch (PageException pe) {
error(pe);
}
} | java | {
"resource": ""
} |
q24615 | XMLEventParser.error | train | private void error(PageException pe) {
if (error == null) throw new PageRuntimeException(pe);
try {
pc = ThreadLocalPageContext.get(pc);
error.call(pc, new Object[] { pe.getCatchBlock(pc.getConfig()) }, false);
}
catch (PageException e) {}
} | java | {
"resource": ""
} |
q24616 | XMLEventParser.toStruct | train | private Struct toStruct(Attributes att) {
int len = att.getLength();
Struct sct = new StructImpl();
for (int i = 0; i < len; i++) {
sct.setEL(att.getQName(i), att.getValue(i));
}
return sct;
} | java | {
"resource": ""
} |
q24617 | HttpUtil.cloneHeaders | train | public static Pair<String, String>[] cloneHeaders(HttpServletRequest req) {
List<Pair<String, String>> headers = new ArrayList<Pair<String, String>>();
Enumeration<String> e = req.getHeaderNames(), ee;
String name;
while (e.hasMoreElements()) {
name = e.nextElement();
ee = req.getHeaders(name);
while... | java | {
"resource": ""
} |
q24618 | XMLConfigWebFactory.loadExtensionBundles | train | private static void loadExtensionBundles(ConfigServerImpl cs, ConfigImpl config, Document doc, Log log) {
try {
Element parent = getChildByName(doc.getDocumentElement(), "extensions");
Element[] children = getChildren(parent, "rhextension");
String strBundles;
List<RHExtension> extensions = new Arr... | java | {
"resource": ""
} |
q24619 | XMLConfigWebFactory.toBoolean | train | private static boolean toBoolean(String value, boolean defaultValue) {
if (value == null || value.trim().length() == 0) return defaultValue;
try {
return Caster.toBooleanValue(value.trim());
}
catch (PageException e) {
return defaultValue;
}
} | java | {
"resource": ""
} |
q24620 | XMLConfigWebFactory.getAttr | train | public static String getAttr(Element el, String name) {
String v = el.getAttribute(name);
return replaceConfigPlaceHolder(v);
} | java | {
"resource": ""
} |
q24621 | FileTag.setAction | train | public void setAction(String strAction) throws ApplicationException {
strAction = strAction.toLowerCase();
if (strAction.equals("move") || strAction.equals("rename")) action = ACTION_MOVE;
else if (strAction.equals("copy")) action = ACTION_COPY;
else if (strAction.equals("delete")) action = ACTION_DELETE;
else if ... | java | {
"resource": ""
} |
q24622 | FileTag.setCharset | train | public void setCharset(String charset) {
if (StringUtil.isEmpty(charset)) return;
this.charset = CharsetUtil.toCharSet(charset.trim());
} | java | {
"resource": ""
} |
q24623 | FileTag.actionMove | train | public static void actionMove(PageContext pageContext, lucee.runtime.security.SecurityManager securityManager, Resource source, String strDestination, int nameconflict,
String serverPassword, Object acl, int mode, String attributes) throws PageException {
if (nameconflict == NAMECONFLICT_UNDEFINED) nameconflict =... | java | {
"resource": ""
} |
q24624 | FileTag.actionAppend | train | private void actionAppend() throws PageException {
if (output == null) throw new ApplicationException("attribute output is not defined for tag file");
checkFile(pageContext, securityManager, file, serverPassword, createPath, true, false, true);
setACL(pageContext, file, acl);
try {
if (!file.exists()) file.cr... | java | {
"resource": ""
} |
q24625 | FileTag.checkContentType | train | private static void checkContentType(String contentType, String accept, String ext, boolean strict) throws PageException {
if (!StringUtil.isEmpty(ext, true)) {
ext = ext.trim().toLowerCase();
if (ext.startsWith("*.")) ext = ext.substring(2);
if (ext.startsWith(".")) ext = ext.substring(1);
String b... | java | {
"resource": ""
} |
q24626 | FileTag.getFormItem | train | private static FormItem getFormItem(PageContext pageContext, String filefield) throws PageException {
// check filefield
if (StringUtil.isEmpty(filefield)) {
FormItem[] items = getFormItems(pageContext);
if (ArrayUtil.isEmpty(items)) throw new ApplicationException("no file send with this form");
return... | java | {
"resource": ""
} |
q24627 | FileTag.getFileName | train | private static String getFileName(Resource file) {
String name = file.getName();
int pos = name.lastIndexOf(".");
if (pos == -1) return name;
return name.substring(0, pos);
} | java | {
"resource": ""
} |
q24628 | FileTag.setAttributes | train | private static void setAttributes(Resource file, String attributes) throws PageException {
if (!SystemUtil.isWindows() || StringUtil.isEmpty(attributes)) return;
try {
ResourceUtil.setAttribute(file, attributes);
}
catch (IOException e) {
throw new ApplicationException("can't change attributes of file " +... | java | {
"resource": ""
} |
q24629 | FileTag.setMode | train | private static void setMode(Resource file, int mode) throws ApplicationException {
if (mode == -1 || SystemUtil.isWindows()) return;
try {
file.setMode(mode);
// FileUtil.setMode(file,mode);
}
catch (IOException e) {
throw new ApplicationException("can't change mode of file " + file, e.getMessage());... | java | {
"resource": ""
} |
q24630 | VariableImpl.methodExists | train | private static Boolean methodExists(Class clazz, String methodName, Type[] args, Type returnType) {
try {
Class<?>[] _args = new Class[args.length];
for (int i = 0; i < _args.length; i++) {
_args[i] = Types.toClass(args[i]);
}
Class<?> rtn = Types.toClass(returnType);
try {
java.lang.refle... | java | {
"resource": ""
} |
q24631 | VariableImpl.toNamedArguments | train | private static NamedArgument[] toNamedArguments(Argument[] args) {
NamedArgument[] nargs = new NamedArgument[args.length];
for (int i = 0; i < args.length; i++) {
nargs[i] = (NamedArgument) args[i];
}
return nargs;
} | java | {
"resource": ""
} |
q24632 | VariableImpl.isNamed | train | private static boolean isNamed(String funcName, Argument[] args) throws TransformerException {
if (ArrayUtil.isEmpty(args)) return false;
boolean named = false;
for (int i = 0; i < args.length; i++) {
if (args[i] instanceof NamedArgument) named = true;
else if (named) throw new TransformerException("invali... | java | {
"resource": ""
} |
q24633 | TagLibTag.getFullName | train | public String getFullName() {
String fullName;
if (tagLib != null) {
fullName = tagLib.getNameSpaceAndSeparator() + name;
}
else {
fullName = name;
}
return fullName;
} | java | {
"resource": ""
} |
q24634 | TagLibTag.getBodyTransformer | train | public TagDependentBodyTransformer getBodyTransformer() throws TagLibException {
if (!hasTDBTClassDefinition()) return null;
if (tdbt != null) return tdbt;
try {
tdbt = (TagDependentBodyTransformer) tdbtCD.getClazz().newInstance();
}
catch (Throwable t) {
ExceptionUtil.rethrowIfNecessary(t);
throw n... | java | {
"resource": ""
} |
q24635 | TagLibTag.setBodyContent | train | public void setBodyContent(String value) {
// empty, free, must, tagdependent
value = value.toLowerCase().trim();
// if(value.equals("jsp")) value="free";
this.hasBody = !value.equals("empty");
this.isBodyReq = !value.equals("free");
this.isTagDependent = value.equals("tagdependent");
bodyFree = value.equals("f... | java | {
"resource": ""
} |
q24636 | TagLibTag.setTDBTClassDefinition | train | public void setTDBTClassDefinition(String tdbtClass, Identification id, Attributes attr) {
this.tdbtCD = ClassDefinitionImpl.toClassDefinition(tdbtClass, id, attr);
this.tdbt = null;
} | java | {
"resource": ""
} |
q24637 | TagLibTag.setAttributeEvaluatorClassDefinition | train | public void setAttributeEvaluatorClassDefinition(String className, Identification id, Attributes attr) {
cdAttributeEvaluator = ClassDefinitionImpl.toClassDefinition(className, id, attr);
;
} | java | {
"resource": ""
} |
q24638 | TagLibTag.getTag | train | public Tag getTag(Factory f, Position start, Position end) throws TagLibException {
if (StringUtil.isEmpty(tttCD)) return new TagOther(f, start, end);
try {
return _getTag(f, start, end);
}
catch (ClassException e) {
throw new TagLibException(e.getMessage());
}
catch (NoSuchMethodException e) {
thr... | java | {
"resource": ""
} |
q24639 | TagLibTag.getAttributeUndefinedValue | train | public Expression getAttributeUndefinedValue(Factory factory) {
if (attrUndefinedValue == null) return factory.TRUE();
return factory.createLiteral(attrUndefinedValue, factory.TRUE());
} | java | {
"resource": ""
} |
q24640 | PageContextImpl.initialize | train | public PageContextImpl initialize(HttpServlet servlet, HttpServletRequest req, HttpServletResponse rsp, String errorPageURL, boolean needsSession, int bufferSize,
boolean autoFlush, boolean isChild, boolean ignoreScopes) {
parent = null;
requestId = counter++;
appListenerType = ApplicationListener.TYPE_NONE;
... | java | {
"resource": ""
} |
q24641 | PageContextImpl.writeEncodeFor | train | public void writeEncodeFor(String value, String encodeType) throws IOException, PageException { // FUTURE keyword:encodefore add to interface
write(ESAPIUtil.esapiEncode(this, encodeType, value));
} | java | {
"resource": ""
} |
q24642 | PageContextImpl.doInclude | train | public void doInclude(String realPath, boolean runOnce, Object cachedWithin) throws PageException {
if (cachedWithin == null) cachedWithin = getCachedWithin(ConfigWeb.CACHEDWITHIN_INCLUDE);
_doInclude(getRelativePageSources(realPath), runOnce, cachedWithin);
} | java | {
"resource": ""
} |
q24643 | PageContextImpl._doInclude | train | public void _doInclude(PageSource[] sources, boolean runOnce, Object cachedWithin) throws PageException {
if (cachedWithin == null) {
_doInclude(sources, runOnce);
return;
}
// ignore call when runonce an it is not first call
if (runOnce) {
Page currentPage = PageSourceImpl.loadPage(this, sources);
... | java | {
"resource": ""
} |
q24644 | PageContextImpl.subparam | train | public void subparam(String type, String name, final Object value, double min, double max, String strPattern, int maxLength, final boolean isNew) throws PageException {
// check attributes type
if (type == null) type = "any";
else type = type.trim().toLowerCase();
// cast and set value
if (!"any".equals(type)) {... | java | {
"resource": ""
} |
q24645 | PageContextImpl.initIdAndToken | train | private void initIdAndToken() {
boolean setCookie = true;
// From URL
Object oCfid = urlScope().get(KeyConstants._cfid, null);
Object oCftoken = urlScope().get(KeyConstants._cftoken, null);
// if CFID comes from URL, we only accept if already exists
if (oCfid != null) {
if (Decision.isGUIdSimple(oCfid)) {
... | java | {
"resource": ""
} |
q24646 | NullSupportHelper._full | train | private static boolean _full(PageContext pc) {
pc = ThreadLocalPageContext.get(pc);
if (pc == null) return false;
return pc.getCurrentTemplateDialect() != CFMLEngine.DIALECT_CFML || ((PageContextImpl) pc).getFullNullSupport();
} | java | {
"resource": ""
} |
q24647 | ThreadLocalPageContext.register | train | public static void register(PageContext pc) {// print.ds(Thread.currentThread().getName());
if (pc == null) return; // TODO happens with Gateway, but should not!
// TODO should i set the old one by "release"?
Thread t = Thread.currentThread();
t.setContextClassLoader(((ConfigImpl) pc.getConfig()).getClassLoaderEnv(... | java | {
"resource": ""
} |
q24648 | NativeReference.getInstance | train | public static Reference getInstance(Object o, String key) {
if (o instanceof Reference) {
return new ReferenceReference((Reference) o, key);
}
Collection coll = Caster.toCollection(o, null);
if (coll != null) return new VariableReference(coll, key);
return new NativeReference(o, key);
} | java | {
"resource": ""
} |
q24649 | ScopeContext.getSubMap | train | private Map<String, Scope> getSubMap(Map<String, Map<String, Scope>> parent, String key) {
Map<String, Scope> context = parent.get(key);
if (context != null) return context;
context = MapFactory.<String, Scope>getConcurrentMap();
parent.put(key, context);
return context;
} | java | {
"resource": ""
} |
q24650 | ScopeContext.getServerScope | train | public static Server getServerScope(PageContext pc, boolean jsr223) {
if (server == null) {
server = new ServerImpl(pc, jsr223);
}
return server;
} | java | {
"resource": ""
} |
q24651 | ScopeContext.getClusterScope | train | public static Cluster getClusterScope(Config config, boolean create) throws PageException {
if (cluster == null && create) {
cluster = ((ConfigImpl) config).createClusterScope();
}
return cluster;
} | java | {
"resource": ""
} |
q24652 | ScopeContext.getAppContextSessionCount | train | public int getAppContextSessionCount(PageContext pc) {
ApplicationContext appContext = pc.getApplicationContext();
if (pc.getSessionType() == Config.SESSION_TYPE_JEE) return 0;
Map<String, Scope> context = getSubMap(cfSessionContexts, appContext.getName());
return getCount(context);
} | java | {
"resource": ""
} |
q24653 | ScopeContext.getScopesSize | train | public long getScopesSize(int scope) throws ExpressionException {
if (scope == Scope.SCOPE_APPLICATION) return SizeOf.size(applicationContexts);
if (scope == Scope.SCOPE_CLUSTER) return SizeOf.size(cluster);
if (scope == Scope.SCOPE_SERVER) return SizeOf.size(server);
if (scope == Scope.SCOPE_SESSION) return SizeOf... | java | {
"resource": ""
} |
q24654 | ScopeContext.getJSessionScope | train | private Session getJSessionScope(PageContext pc, RefBoolean isNew) throws PageException {
HttpSession httpSession = pc.getSession();
ApplicationContext appContext = pc.getApplicationContext();
Object session = null;// this is from type object, because it is possible that httpSession return object from
// prior rest... | java | {
"resource": ""
} |
q24655 | ScopeContext.clearUnused | train | public void clearUnused() {
Log log = getLog();
try {
// create cleaner engine for session/client scope
if (session == null) session = new StorageScopeEngine(factory, log, new StorageScopeCleaner[] { new FileStorageScopeCleaner(Scope.SCOPE_SESSION, null)// new
// SessionEndListener())
, new Data... | java | {
"resource": ""
} |
q24656 | ScopeContext.clear | train | public void clear() {
try {
Scope scope;
// Map.Entry entry,e;
// Map context;
// release all session scopes
Iterator<Entry<String, Map<String, Scope>>> sit = cfSessionContexts.entrySet().iterator();
Entry<String, Map<String, Scope>> sentry;
Map<String, Scope> context;
Iterator... | java | {
"resource": ""
} |
q24657 | CFMLEngineWrapper.equalTo | train | public boolean equalTo(CFMLEngine other, final boolean checkReferenceEqualityOnly) {
while (other instanceof CFMLEngineWrapper)
other = ((CFMLEngineWrapper) other).engine;
if (checkReferenceEqualityOnly) return engine == other;
return engine.equals(other);
} | java | {
"resource": ""
} |
q24658 | BlowfishECB.cleanUp | train | public void cleanUp() {
int nI;
for (nI = 0; nI < PBOX_ENTRIES; nI++)
m_pbox[nI] = 0;
for (nI = 0; nI < SBOX_ENTRIES; nI++)
m_sbox1[nI] = m_sbox2[nI] = m_sbox3[nI] = m_sbox4[nI] = 0;
} | java | {
"resource": ""
} |
q24659 | FDUtil.toVariableName | train | private static String toVariableName(String str) {
StringBuffer rtn = new StringBuffer();
char[] chars = str.toCharArray();
long changes = 0;
boolean doCorrect = true;
for (int i = 0; i < chars.length; i++) {
char c = chars[i];
if (i == 0 && (c >= '0' && c <= '9')) rtn.append("_" + c);
else if ((c ... | java | {
"resource": ""
} |
q24660 | FDUtil.toClassName | train | public static String toClassName(String str) {
StringBuffer javaName = new StringBuffer();
String[] arr = lucee.runtime.type.util.ListUtil.listToStringArray(str, '/');
for (int i = 0; i < arr.length; i++) {
if (i == (arr.length - 1)) arr[i] = replaceLast(arr[i], '.', '$');
if (i != 0) javaName.append('.')... | java | {
"resource": ""
} |
q24661 | Property.setType | train | public void setType(String type) {
property.setType(type);
setDynamicAttribute(null, KeyConstants._type, type);
} | java | {
"resource": ""
} |
q24662 | Property.setName | train | public void setName(String name) {
// Fix for axis 1.4, axis can not handle when first char is upper case
// name=StringUtil.lcFirst(name.toLowerCase());
property.setName(name);
setDynamicAttribute(null, KeyConstants._name, name);
} | java | {
"resource": ""
} |
q24663 | ComponentFactory.deploy | train | public static void deploy(Resource dir, boolean doNew) {
String path = "/resource/component/" + (Constants.DEFAULT_PACKAGE.replace('.', '/')) + "/";
deploy(dir, path, doNew, "Base");
deploy(dir, path, doNew, "Feed");
deploy(dir, path, doNew, "Ftp");
deploy(dir, path, doNew, "Http");
deploy(dir, path, doNew, "Mai... | java | {
"resource": ""
} |
q24664 | FileUtil.URLToFile | train | public static final File URLToFile(URL url) throws MalformedURLException {
if (!"file".equals(url.getProtocol())) throw new MalformedURLException("URL protocol must be 'file'.");
return new File(URIToFilename(url.getFile()));
} | java | {
"resource": ""
} |
q24665 | FileUtil.URIToFilename | train | public static final String URIToFilename(String str) {
// Windows fix
if (str.length() >= 3) {
if (str.charAt(0) == '/' && str.charAt(2) == ':') {
char ch1 = Character.toUpperCase(str.charAt(1));
if (ch1 >= 'A' && ch1 <= 'Z') str = str.substring(1);
}
}
// handle platform dependent strings
str = str.... | java | {
"resource": ""
} |
q24666 | FTPWrap.connect | train | private void connect() throws IOException {
client = AFTPClient.getInstance(conn.secure(), address, conn.getPort(), conn.getUsername(), conn.getPassword(), conn.getFingerprint(), conn.getStopOnError());
if (client instanceof SFTPClientImpl && conn.getKey() != null) {
((SFTPClientImpl) client).setSshKey(conn.ge... | java | {
"resource": ""
} |
q24667 | SessionMemory.getInstance | train | public static Session getInstance(PageContext pc, RefBoolean isNew, Log log) {
isNew.setValue(true);
return new SessionMemory(pc, log);
} | java | {
"resource": ""
} |
q24668 | CredentialImpl.toRole | train | public static String[] toRole(Object oRoles) throws PageException {
if (oRoles instanceof String) {
oRoles = ListUtil.listToArrayRemoveEmpty(oRoles.toString(), ",");
}
if (oRoles instanceof Array) {
Array arrRoles = (Array) oRoles;
String[] roles = new String[arrRoles.size()];
for (int i = 0; i ... | java | {
"resource": ""
} |
q24669 | CredentialImpl.decode | train | public static Credential decode(Object encoded, Resource rolesDir) throws PageException {
String dec;
try {
dec = Base64Coder.decodeToString(Caster.toString(encoded), "UTF-8");
}
catch (Exception e) {
throw Caster.toPageException(e);
}
Array arr = ListUtil.listToArray(dec, "" + ONE);
int len = arr.siz... | java | {
"resource": ""
} |
q24670 | Base64Coder.decodeToString | train | public static String decodeToString(String encoded, String charset) throws CoderException, UnsupportedEncodingException {
byte[] dec = decode(Caster.toString(encoded, null));
return new String(dec, charset);
} | java | {
"resource": ""
} |
q24671 | Base64Coder.encodeFromString | train | public static String encodeFromString(String plain, String charset) throws CoderException, UnsupportedEncodingException {
return encode(plain.getBytes(charset));
} | java | {
"resource": ""
} |
q24672 | Duplicator.duplicate | train | public static Object duplicate(Object object, boolean deepCopy) {
if (object == null) return null;
if (object instanceof Number) return object;
if (object instanceof String) return object;
if (object instanceof Date) return ((Date) object).clone();
if (object instanceof Boolean) return object;
RefBoolean before ... | java | {
"resource": ""
} |
q24673 | Duplicator.duplicateMap | train | public static Map duplicateMap(Map map, boolean doKeysLower, boolean deepCopy) throws PageException {
if (doKeysLower) {
Map newMap;
try {
newMap = (Map) ClassUtil.loadInstance(map.getClass());
}
catch (ClassException e) {
newMap = new HashMap();
}
boolean inside = ThreadLocalDuplicat... | java | {
"resource": ""
} |
q24674 | Error.setType | train | public void setType(String type) throws ExpressionException {
type = type.toLowerCase().trim();
if (type.equals("exception")) {
errorPage.setType(ErrorPage.TYPE_EXCEPTION);
}
else if (type.equals("request")) {
errorPage.setType(ErrorPage.TYPE_REQUEST);
}
// else if(type.equals("validation")) this.type=V... | java | {
"resource": ""
} |
q24675 | Error.setTemplate | train | public void setTemplate(String template) throws MissingIncludeException {
PageSource ps = pageContext.getCurrentPageSource().getRealPage(template);
if (!ps.exists()) throw new MissingIncludeException(ps);
errorPage.setTemplate(ps);
} | java | {
"resource": ""
} |
q24676 | ResourceDataSource.getOutputStream | train | @Override
public OutputStream getOutputStream() throws IOException {
if (!_file.isWriteable()) {
throw new IOException("Cannot write");
}
return IOUtil.toBufferedOutputStream(_file.getOutputStream());
} | java | {
"resource": ""
} |
q24677 | StatementBase.writeOut | train | @Override
public final void writeOut(Context c) throws TransformerException {
BytecodeContext bc = (BytecodeContext) c;
ExpressionUtil.visitLine(bc, start);
_writeOut(bc);
ExpressionUtil.visitLine(bc, end);
} | java | {
"resource": ""
} |
q24678 | SourceCode.forwardIfCurrent | train | public boolean forwardIfCurrent(String first, char second) {
int start = pos;
if (!forwardIfCurrent(first)) return false;
removeSpace();
boolean rtn = forwardIfCurrent(second);
if (!rtn) pos = start;
return rtn;
} | java | {
"resource": ""
} |
q24679 | SourceCode.forwardIfCurrent | train | public boolean forwardIfCurrent(short before, String val, short after) {
int start = pos;
// space before
if (before == AT_LEAST_ONE_SPACE) {
if (!removeSpace()) return false;
}
else removeSpace();
// value
if (!forwardIfCurrent(val)) {
setPos(start);
return false;
}
// space after
if (after ... | java | {
"resource": ""
} |
q24680 | SourceCode.subCFMLString | train | public SourceCode subCFMLString(int start, int count) {
return new SourceCode(String.valueOf(text, start, count), writeLog, dialect);
} | java | {
"resource": ""
} |
q24681 | SourceCode.getLine | train | public int getLine(int pos) {
for (int i = 0; i < lines.length; i++) {
if (pos <= lines[i].intValue()) return i + 1;
}
return lines.length;
} | java | {
"resource": ""
} |
q24682 | SourceCode.getColumn | train | public int getColumn(int pos) {
int line = getLine(pos) - 1;
if (line == 0) return pos + 1;
return pos - lines[line - 1].intValue();
} | java | {
"resource": ""
} |
q24683 | SourceCode.getLineAsString | train | public String getLineAsString(int line) {
int index = line - 1;
if (lines.length <= index) return null;
int max = lines[index].intValue();
int min = 0;
if (index != 0) min = lines[index - 1].intValue() + 1;
if (min < max && max - 1 < lcText.length) return this.substring(min, max - min);
return "";
} | java | {
"resource": ""
} |
q24684 | SourceCode.indexOfNext | train | public int indexOfNext(char c) {
for (int i = pos; i < lcText.length; i++) {
if (lcText[i] == c) return i;
}
return -1;
} | java | {
"resource": ""
} |
q24685 | SourceCode.lastWord | train | public String lastWord() {
int size = 1;
while (pos - size > 0 && lcText[pos - size] == ' ') {
size++;
}
while (pos - size > 0 && lcText[pos - size] != ' ' && lcText[pos - size] != ';') {
size++;
}
return this.substring((pos - size + 1), (pos - 1));
} | java | {
"resource": ""
} |
q24686 | ResourceAppender.closeFile | train | protected void closeFile() {
if (this.qw != null) {
try {
this.qw.close();
}
catch (java.io.IOException e) {
// Exceptionally, it does not make sense to delegate to an
// ErrorHandler. Since a closed appender is basically dead.
LogLog.error("Could not close " + qw, e);
}
}
} | java | {
"resource": ""
} |
q24687 | HSQLDBHandler.removeTable | train | private static void removeTable(Connection conn, String name) throws SQLException {
name = name.replace('.', '_');
Statement stat = conn.createStatement();
stat.execute("DROP TABLE " + name);
DBUtil.commitEL(conn);
} | java | {
"resource": ""
} |
q24688 | HSQLDBHandler.removeAll | train | private static void removeAll(Connection conn, ArrayList<String> usedTables) {
int len = usedTables.size();
for (int i = 0; i < len; i++) {
String tableName = usedTables.get(i).toString();
// print.out("remove:"+tableName);
try {
removeTable(conn, tableName);
}
catch (Throwable t) {
Exc... | java | {
"resource": ""
} |
q24689 | HSQLDBHandler.execute | train | public Query execute(PageContext pc, SQL sql, int maxrows, int fetchsize, TimeSpan timeout) throws PageException {
Stopwatch stopwatch = new Stopwatch(Stopwatch.UNIT_NANO);
stopwatch.start();
String prettySQL = null;
Selects selects = null;
// First Chance
try {
SelectParser parser = new SelectParser();
... | java | {
"resource": ""
} |
q24690 | HashMapPro.getEntry | train | final Entry<K, V> getEntry(Object key) {
int hash = (key == null) ? 0 : hash(key);
for (Entry<K, V> e = table[indexFor(hash, table.length)]; e != null; e = e.next) {
if (e.hash == hash && ((e.key) == key || (key != null && key.equals(e.key)))) return e;
}
return null;
} | java | {
"resource": ""
} |
q24691 | HashMapPro.putForNullKey | train | private V putForNullKey(V value) {
for (Entry<K, V> e = table[0]; e != null; e = e.next) {
if (e.key == null) {
V oldValue = e.value;
e.value = value;
e.recordAccess(this);
return oldValue;
}
}
modCount++;
addEntry(0, null, value, 0);
return null;
} | java | {
"resource": ""
} |
q24692 | StorageScopeFile.getFolderName | train | public static String getFolderName(String name, String cfid, boolean addExtension) {
if (addExtension) return getFolderName(name, cfid, false) + ".scpt";
if (!StringUtil.isEmpty(name)) name = encode(name);// StringUtil.toVariableName(StringUtil.toLowerCase(name));
else name = "__empty__";
return name + "/" + cfid.s... | java | {
"resource": ""
} |
q24693 | ClobImpl.toClob | train | public static Clob toClob(Object value) throws PageException {
if (value instanceof Clob) return (Clob) value;
else if (value instanceof char[]) return toClob(new String((char[]) value));
else if (value instanceof Reader) {
StringWriter sw = new StringWriter();
try {
IOUtil.copy((Reader) value, sw, false... | java | {
"resource": ""
} |
q24694 | UnixCrypt.crypt | train | public static final String crypt(String original) {
java.util.Random randomGenerator = new java.util.Random();
int numSaltChars = saltChars.length;
String salt;
salt = (new StringBuffer()).append(saltChars[Math.abs(randomGenerator.nextInt()) % numSaltChars]).append(saltChars[Math.abs(randomGenerator.nextInt()) % nu... | java | {
"resource": ""
} |
q24695 | IniFile.setKeyValue | train | public void setKeyValue(String strSection, String key, String value) {
Map section = getSectionEL(strSection);
if (section == null) {
section = newMap();
sections.put(strSection.toLowerCase(), section);
}
section.put(key.toLowerCase(), value);
} | java | {
"resource": ""
} |
q24696 | IniFile.getSection | train | public Map getSection(String strSection) throws IOException {
Object o = sections.get(strSection.toLowerCase());
if (o == null) throw new IOException("section with name " + strSection + " does not exist");
return (Map) o;
} | java | {
"resource": ""
} |
q24697 | IniFile.getSectionEL | train | public Map getSectionEL(String strSection) {
Object o = sections.get(strSection.toLowerCase());
if (o == null) return null;
return (Map) o;
} | java | {
"resource": ""
} |
q24698 | IniFile.isNullOrEmpty | train | public boolean isNullOrEmpty(String section, String key) {
String value = getKeyValueEL(section, key);
return (value == null || value.length() == 0);
} | java | {
"resource": ""
} |
q24699 | IniFile.getKeyValue | train | public String getKeyValue(String strSection, String key) throws IOException {
Object o = getSection(strSection).get(key.toLowerCase());
if (o == null) throw new IOException("key " + key + " doesn't exist in section " + strSection);
return (String) o;
} | java | {
"resource": ""
} |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.