_id
stringlengths
2
7
title
stringlengths
3
140
partition
stringclasses
3 values
text
stringlengths
73
34.1k
language
stringclasses
1 value
meta_information
dict
q24400
MailUtil.parseEmail
train
public static InternetAddress parseEmail(Object value, InternetAddress defaultValue) { String str = Caster.toString(value, ""); if (str.indexOf('@') > -1) { try { str = fixIDN(str); InternetAddress addr = new InternetAddress(str); // fixIDN( addr ); return addr; } catch (AddressException ex) {}...
java
{ "resource": "" }
q24401
MailUtil.fixIDN
train
public static String fixIDN(String addr) { int pos = addr.indexOf('@'); if (pos > 0 && pos < addr.length() - 1) { String domain = addr.substring(pos + 1); if (!StringUtil.isAscii(domain)) { domain = IDN.toASCII(domain); return addr.substring(0, pos) + "@" + domain; } } return addr; }
java
{ "resource": "" }
q24402
TagHandlerPool.reuse
train
public void reuse(Tag tag) { tag.release(); Queue<Tag> queue = getQueue(tag.getClass().getName()); queue.add(tag); }
java
{ "resource": "" }
q24403
RegistryQuery.executeQuery
train
public static String executeQuery(String[] cmd) throws IOException, InterruptedException { return Command.execute(cmd).getOutput(); }
java
{ "resource": "" }
q24404
RegistryQuery.getValue
train
public static RegistryEntry getValue(String branch, String entry, short type) throws RegistryException, IOException, InterruptedException { String[] cmd = new String[] { "reg", "query", cleanBrunch(branch), "/v", entry }; RegistryEntry[] rst = filter(executeQuery(cmd), branch, type); if (rst.length == 1) { retu...
java
{ "resource": "" }
q24405
RegistryQuery.getValues
train
public static RegistryEntry[] getValues(String branch, short type) throws RegistryException, IOException, InterruptedException { String[] cmd = new String[] { "reg", "query", branch }; return filter(executeQuery(cmd), cleanBrunch(branch), type); }
java
{ "resource": "" }
q24406
RegistryQuery.setValue
train
public static void setValue(String branch, String entry, short type, String value) throws RegistryException, IOException, InterruptedException { if (type == RegistryEntry.TYPE_KEY) { String fullKey = ListUtil.trim(branch, "\\") + "\\" + ListUtil.trim(entry, "\\"); // String[] cmd = new String[]{"reg","add",...
java
{ "resource": "" }
q24407
RegistryQuery.deleteValue
train
public static void deleteValue(String branch, String entry) throws IOException, InterruptedException { if (entry == null) { String[] cmd = new String[] { "reg", "delete", cleanBrunch(branch), "/f" }; executeQuery(cmd); // executeQuery("reg delete \""+List.trim(branch,"\\")+"\" /f"); } else { Stri...
java
{ "resource": "" }
q24408
RegistryQuery.filter
train
private static RegistryEntry[] filter(String string, String branch, short type) throws RegistryException { branch = ListUtil.trim(branch, "\\"); StringBuffer result = new StringBuffer(); ArrayList array = new ArrayList(); String[] arr = string.split("\n"); for (int i = 0; i < arr.length; i++) { String line =...
java
{ "resource": "" }
q24409
QueryColumnImpl.touch
train
public Object touch(int row) { if (row < 1 || row > size) return NullSupportHelper.full() ? null : ""; Object o = data[row - 1]; if (o != null) return o; return setEL(row, new StructImpl()); }
java
{ "resource": "" }
q24410
SQLCaster.toCFTypex
train
public static Object toCFTypex(SQLItem item) throws PageException { try { return _toCFTypex(item); } catch (PageException e) { if (item.isNulls()) return item.getValue(); throw e; } }
java
{ "resource": "" }
q24411
SQLCaster.toStringType
train
public static String toStringType(int type, String defaultValue) { switch (type) { case Types.ARRAY: return "CF_SQL_ARRAY"; case Types.BIGINT: return "CF_SQL_BIGINT"; case Types.BINARY: return "CF_SQL_BINARY"; case Types.BIT: return "CF_SQL_BIT"; case Types.BOOLEAN: return "CF_SQL_BOOLEAN...
java
{ "resource": "" }
q24412
XMLConfigAdmin.setMailLog
train
public void setMailLog(String logFile, String level) throws PageException { checkWriteAccess(); boolean hasAccess = ConfigWebUtil.hasAccess(config, SecurityManager.TYPE_MAIL); if (!hasAccess) throw new SecurityException("no access to update mail server settings"); ConfigWebUtil.getFile(config, config.getRootDirect...
java
{ "resource": "" }
q24413
XMLConfigAdmin.setMailSpoolEnable
train
public void setMailSpoolEnable(Boolean spoolEnable) throws SecurityException { checkWriteAccess(); boolean hasAccess = ConfigWebUtil.hasAccess(config, SecurityManager.TYPE_MAIL); if (!hasAccess) throw new SecurityException("no access to update mail server settings"); Element mail = _getRootElement("mail"); mail.s...
java
{ "resource": "" }
q24414
XMLConfigAdmin.setMailTimeout
train
public void setMailTimeout(Integer timeout) throws SecurityException { checkWriteAccess(); boolean hasAccess = ConfigWebUtil.hasAccess(config, SecurityManager.TYPE_MAIL); if (!hasAccess) throw new SecurityException("no access to update mail server settings"); Element mail = _getRootElement("mail"); mail.setAttribu...
java
{ "resource": "" }
q24415
XMLConfigAdmin.setMailDefaultCharset
train
public void setMailDefaultCharset(String charset) throws PageException { checkWriteAccess(); boolean hasAccess = ConfigWebUtil.hasAccess(config, SecurityManager.TYPE_MAIL); if (!hasAccess) throw new SecurityException("no access to update mail server settings"); if (!StringUtil.isEmpty(charset)) { try { IOUt...
java
{ "resource": "" }
q24416
XMLConfigAdmin.updateMailServer
train
public void updateMailServer(int id, String hostName, String username, String password, int port, boolean tls, boolean ssl, long lifeTimeSpan, long idleTimeSpan, boolean reuseConnections) throws PageException { checkWriteAccess(); boolean hasAccess = ConfigWebUtil.hasAccess(config, SecurityManager.TYPE_MAIL); i...
java
{ "resource": "" }
q24417
XMLConfigAdmin.removeMailServer
train
public void removeMailServer(String hostName, String username) throws SecurityException { checkWriteAccess(); Element mail = _getRootElement("mail"); Element[] children = XMLConfigWebFactory.getChildren(mail, "server"); String _hostName, _username; if (children.length > 0) { for (int i = 0; i < children.leng...
java
{ "resource": "" }
q24418
XMLConfigAdmin.updateMapping
train
public void updateMapping(String virtual, String physical, String archive, String primary, short inspect, boolean toplevel, int listenerMode, int listenerType, boolean readOnly) throws ExpressionException, SecurityException { checkWriteAccess(); _updateMapping(virtual, physical, archive, primary, inspect, toplev...
java
{ "resource": "" }
q24419
XMLConfigAdmin.removeCustomTag
train
public void removeCustomTag(String virtual) throws SecurityException { checkWriteAccess(); Element mappings = _getRootElement("custom-tag"); Element[] children = XMLConfigWebFactory.getChildren(mappings, "mapping"); for (int i = 0; i < children.length; i++) { if (virtual.equals(createVirtual(children[i]))) ma...
java
{ "resource": "" }
q24420
XMLConfigAdmin.updateCustomTag
train
public void updateCustomTag(String virtual, String physical, String archive, String primary, short inspect) throws ExpressionException, SecurityException { checkWriteAccess(); _updateCustomTag(virtual, physical, archive, primary, inspect); }
java
{ "resource": "" }
q24421
XMLConfigAdmin.updateJavaCFX
train
public void updateJavaCFX(String name, ClassDefinition cd) throws PageException { checkWriteAccess(); boolean hasAccess = ConfigWebUtil.hasAccess(config, SecurityManager.TYPE_CFX_SETTING); if (!hasAccess) throw new SecurityException("no access to change cfx settings"); if (name == null || name.length() == 0) thro...
java
{ "resource": "" }
q24422
XMLConfigAdmin.fixSalt
train
public static boolean fixSalt(Document doc) { Element root = doc.getDocumentElement(); String salt = root.getAttribute("salt"); if (StringUtil.isEmpty(salt, true) || !Decision.isUUId(salt)) { // create salt root.setAttribute("salt", CreateUUID.invoke()); return true; } return false; }
java
{ "resource": "" }
q24423
XMLConfigAdmin.removeCFX
train
public void removeCFX(String name) throws ExpressionException, SecurityException { checkWriteAccess(); // check parameters if (name == null || name.length() == 0) throw new ExpressionException("name for CFX Tag can be a empty value"); renameOldstyleCFX(); Element mappings = _getRootElement("ext-tags"); Element...
java
{ "resource": "" }
q24424
XMLConfigAdmin.removeDataSource
train
public void removeDataSource(String name) throws ExpressionException, SecurityException { checkWriteAccess(); // check parameters if (name == null || name.length() == 0) throw new ExpressionException("name for Datasource Connection can be a empty value"); Element datasources = _getRootElement("data-sources"); El...
java
{ "resource": "" }
q24425
XMLConfigAdmin.updatePSQ
train
public void updatePSQ(Boolean psq) throws SecurityException { checkWriteAccess(); boolean hasAccess = ConfigWebUtil.hasAccess(config, SecurityManager.TYPE_DATASOURCE); if (!hasAccess) throw new SecurityException("no access to update datsource connections"); Element datasources = _getRootElement("data-sources"); ...
java
{ "resource": "" }
q24426
XMLConfigAdmin.updateAllowImplicidQueryCall
train
public void updateAllowImplicidQueryCall(Boolean allow) throws SecurityException { checkWriteAccess(); boolean hasAccess = ConfigWebUtil.hasAccess(config, SecurityManager.TYPE_SETTING); if (!hasAccess) throw new SecurityException("no access to update scope setting"); Element scope = _getRootElement("scope"); sco...
java
{ "resource": "" }
q24427
XMLConfigAdmin.updateApplicationTimeout
train
public void updateApplicationTimeout(TimeSpan span) throws SecurityException { checkWriteAccess(); boolean hasAccess = ConfigWebUtil.hasAccess(config, SecurityManager.TYPE_SETTING); if (!hasAccess) throw new SecurityException("no access to update scope setting"); Element scope = _getRootElement("scope"); if (spa...
java
{ "resource": "" }
q24428
XMLConfigAdmin.updateSessionManagement
train
public void updateSessionManagement(Boolean sessionManagement) throws SecurityException { checkWriteAccess(); boolean hasAccess = ConfigWebUtil.hasAccess(config, SecurityManager.TYPE_SETTING); if (!hasAccess) throw new SecurityException("no access to update scope setting"); Element scope = _getRootElement("scope"...
java
{ "resource": "" }
q24429
XMLConfigAdmin.updateClientManagement
train
public void updateClientManagement(Boolean clientManagement) throws SecurityException { checkWriteAccess(); boolean hasAccess = ConfigWebUtil.hasAccess(config, SecurityManager.TYPE_SETTING); if (!hasAccess) throw new SecurityException("no access to update scope setting"); Element scope = _getRootElement("scope");...
java
{ "resource": "" }
q24430
XMLConfigAdmin.updateClientCookies
train
public void updateClientCookies(Boolean clientCookies) throws SecurityException { checkWriteAccess(); boolean hasAccess = ConfigWebUtil.hasAccess(config, SecurityManager.TYPE_SETTING); if (!hasAccess) throw new SecurityException("no access to update scope setting"); Element scope = _getRootElement("scope"); scope...
java
{ "resource": "" }
q24431
XMLConfigAdmin.updateMode
train
public void updateMode(Boolean developmode) throws SecurityException { checkWriteAccess(); boolean hasAccess = ConfigWebUtil.hasAccess(config, SecurityManager.TYPE_SETTING); if (!hasAccess) throw new SecurityException("no access to update scope setting"); Element mode = _getRootElement("mode"); mode.setAttribute(...
java
{ "resource": "" }
q24432
XMLConfigAdmin.updateDomaincookies
train
public void updateDomaincookies(Boolean domainCookies) throws SecurityException { checkWriteAccess(); boolean hasAccess = ConfigWebUtil.hasAccess(config, SecurityManager.TYPE_SETTING); if (!hasAccess) throw new SecurityException("no access to update scope setting"); Element scope = _getRootElement("scope"); scope...
java
{ "resource": "" }
q24433
XMLConfigAdmin.updateLocale
train
public void updateLocale(String locale) throws SecurityException { checkWriteAccess(); boolean hasAccess = ConfigWebUtil.hasAccess(config, SecurityManager.TYPE_SETTING); if (!hasAccess) throw new SecurityException("no access to update regional setting"); Element scope = _getRootElement("regional"); scope.setAttri...
java
{ "resource": "" }
q24434
XMLConfigAdmin.updateTimeZone
train
public void updateTimeZone(String timeZone) throws SecurityException { checkWriteAccess(); boolean hasAccess = ConfigWebUtil.hasAccess(config, SecurityManager.TYPE_SETTING); if (!hasAccess) throw new SecurityException("no access to update regional setting"); Element regional = _getRootElement("regional"); regiona...
java
{ "resource": "" }
q24435
XMLConfigAdmin.updateTimeServer
train
public void updateTimeServer(String timeServer, Boolean useTimeServer) throws PageException { checkWriteAccess(); if (useTimeServer != null && useTimeServer.booleanValue() && !StringUtil.isEmpty(timeServer, true)) { try { new NtpClient(timeServer).getOffset(); } catch (IOException e) { try { ...
java
{ "resource": "" }
q24436
XMLConfigAdmin.updateBaseComponent
train
public void updateBaseComponent(String baseComponentCFML, String baseComponentLucee) throws SecurityException { checkWriteAccess(); boolean hasAccess = ConfigWebUtil.hasAccess(config, SecurityManager.TYPE_SETTING); if (!hasAccess) throw new SecurityException("no access to update component setting"); // config.reset...
java
{ "resource": "" }
q24437
XMLConfigAdmin.updateDebug
train
public void updateDebug(Boolean debug, Boolean database, Boolean exception, Boolean tracing, Boolean dump, Boolean timer, Boolean implicitAccess, Boolean queryUsage) throws SecurityException { checkWriteAccess(); boolean hasAccess = ConfigWebUtil.hasAccess(config, SecurityManager.TYPE_DEBUGGING); if (!hasAccess...
java
{ "resource": "" }
q24438
XMLConfigAdmin.updateErrorTemplate
train
public void updateErrorTemplate(int statusCode, String template) throws SecurityException { checkWriteAccess(); boolean hasAccess = ConfigWebUtil.hasAccess(config, SecurityManager.TYPE_DEBUGGING); if (!hasAccess) throw new SecurityException("no access to change error settings"); Element error = _getRootElement("er...
java
{ "resource": "" }
q24439
XMLConfigAdmin.updateSessionType
train
public void updateSessionType(String type) throws SecurityException { checkWriteAccess(); boolean hasAccess = ConfigWebUtil.hasAccess(config, SecurityManager.TYPE_SETTING); if (!hasAccess) throw new SecurityException("no access to update scope setting"); type = type.toLowerCase().trim(); Element scope = _getRoot...
java
{ "resource": "" }
q24440
XMLConfigAdmin.updateUpdate
train
public void updateUpdate(String type, String location) throws SecurityException { checkWriteAccess(); if (!(config instanceof ConfigServer)) { throw new SecurityException("can't change update setting from this context, access is denied"); } Element update = _getRootElement("update"); update.setAttribute("typ...
java
{ "resource": "" }
q24441
XMLConfigAdmin.removeSecurityManager
train
public void removeSecurityManager(Password password, String id) throws PageException { checkWriteAccess(); ((ConfigServerImpl) ConfigImpl.getConfigServer(config, password)).removeSecurityManager(id); Element security = _getRootElement("security"); Element[] children = XMLConfigWebFactory.getChildren(security, "ac...
java
{ "resource": "" }
q24442
XMLConfigAdmin.runUpdate
train
public void runUpdate(Password password) throws PageException { checkWriteAccess(); ConfigServerImpl cs = (ConfigServerImpl) ConfigImpl.getConfigServer(config, password); CFMLEngineFactory factory = cs.getCFMLEngine().getCFMLEngineFactory(); synchronized (factory) { try { cleanUp(factory); factory.update(...
java
{ "resource": "" }
q24443
XMLConfigAdmin.hasRHExtensions
train
public static RHExtension hasRHExtensions(ConfigImpl config, ExtensionDefintion ed) throws PageException, SAXException, IOException { XMLConfigAdmin admin = new XMLConfigAdmin(config, null); return admin._hasRHExtensions(config, ed); }
java
{ "resource": "" }
q24444
IsNull.call
train
public static boolean call(PageContext pc, String str) { try { return pc.evaluate(str) == null; } catch (PageException e) { return true; } }
java
{ "resource": "" }
q24445
Lock.setTimeout
train
public void setTimeout(Object oTimeout) throws PageException { if (oTimeout instanceof TimeSpan) this.timeoutInMillis = toInt(((TimeSpan) oTimeout).getMillis()); else this.timeoutInMillis = toInt(Caster.toDoubleValue(oTimeout) * 1000D); // print.out(Caster.toString(timeoutInMillis)); }
java
{ "resource": "" }
q24446
Lock.setName
train
public void setName(String name) throws ApplicationException { if (name == null) return; this.name = name.trim(); if (name.length() == 0) throw new ApplicationException("invalid attribute definition", "attribute [name] can't be a empty string"); }
java
{ "resource": "" }
q24447
ResourceSnippet.createResourceSnippet
train
public static ResourceSnippet createResourceSnippet(InputStream is, int startChar, int endChar, String charset) { return createResourceSnippet(getContents(is, charset), startChar, endChar); }
java
{ "resource": "" }
q24448
ResourceSnippet.createResourceSnippet
train
public static ResourceSnippet createResourceSnippet(Resource res, int startChar, int endChar, String charset) { try { return createResourceSnippet(res.getInputStream(), startChar, endChar, charset); } catch (IOException ex) { return ResourceSnippet.Empty; } }
java
{ "resource": "" }
q24449
ResourceSnippet.getLineNumber
train
public static int getLineNumber(String text, int posChar) { int len = Math.min(posChar, text.length()); int result = 1; for (int i = 0; i < len; i++) { if (text.charAt(i) == '\n') result++; } return result; }
java
{ "resource": "" }
q24450
CacheUtil.getPassword
train
public static Password getPassword(PageContext pc, String password, boolean server) throws lucee.runtime.exp.SecurityException { // TODO: move this to a utility class in a more // generic package? // no password passed if (StringUtil.isEmpty(password, true)) { ApplicationContext appContext =...
java
{ "resource": "" }
q24451
URLDataSource2.getContentType
train
@Override public String getContentType() { URLConnection connection = null; try { connection = url.openConnection(); } catch (IOException e) {} if (connection == null) return DEFAULT_CONTENT_TYPE; return connection.getContentType(); }
java
{ "resource": "" }
q24452
URLDataSource2.getInputStream
train
@Override public InputStream getInputStream() throws IOException { if (barr == null) { barr = IOUtil.toBytes(url.openStream()); } return new ByteArrayInputStream(barr); }
java
{ "resource": "" }
q24453
URLDataSource2.getOutputStream
train
@Override public OutputStream getOutputStream() throws IOException { URLConnection connection = url.openConnection(); if (connection == null) return null; connection.setDoOutput(true); // is it necessary? return connection.getOutputStream(); }
java
{ "resource": "" }
q24454
RegistryEntry.toType
train
public static short toType(String strType) throws RegistryException { if (strType.equals(REGDWORD_TOKEN)) return RegistryEntry.TYPE_DWORD; else if (strType.equals(REGSTR_TOKEN)) return RegistryEntry.TYPE_STRING; else if (strType.equals(REGKEY_TOKEN)) return RegistryEntry.TYPE_KEY; throw new RegistryException(strTyp...
java
{ "resource": "" }
q24455
WeakHashMapPro.expungeStaleEntries
train
private void expungeStaleEntries() { for (Object x; (x = queue.poll()) != null;) { synchronized (queue) { @SuppressWarnings("unchecked") Entry<K, V> e = (Entry<K, V>) x; int i = indexFor(e.hash, table.length); Entry<K, V> prev = table[i]; Entry<K, V> p = prev; while (p != null) { Entry<K, V> ne...
java
{ "resource": "" }
q24456
WeakHashMapPro.getEntry
train
Entry<K, V> getEntry(Object key) { Object k = maskNull(key); int h = hash(k); Entry<K, V>[] tab = getTable(); int index = indexFor(h, tab.length); Entry<K, V> e = tab[index]; while (e != null && !(e.hash == h && eq(k, e.get()))) e = e.next; return e; }
java
{ "resource": "" }
q24457
ResourcesImpl.registerResourceProvider
train
@Override public void registerResourceProvider(ResourceProvider provider) { provider.setResources(this); String scheme = provider.getScheme(); if (StringUtil.isEmpty(scheme)) return; ResourceProviderFactory[] tmp = new ResourceProviderFactory[resources.length + 1]; for (int i = 0; i < resources.length; i++) {...
java
{ "resource": "" }
q24458
ResourcesImpl.getResource
train
@Override public Resource getResource(String path) { int index = path.indexOf("://"); if (index != -1) { String scheme = path.substring(0, index).toLowerCase().trim(); String subPath = path.substring(index + 3); for (int i = 0; i < resources.length; i++) { if (scheme.equalsIgnoreCase(resources[i]...
java
{ "resource": "" }
q24459
QueryImpl.getPid
train
private int getPid() { PageContext pc = ThreadLocalPageContext.get(); if (pc == null) { pc = CFMLEngineFactory.getInstance().getThreadPageContext(); if (pc == null) throw new RuntimeException("cannot get pid for current thread"); } return pc.getId(); }
java
{ "resource": "" }
q24460
QueryImpl.getColumnlist
train
public String getColumnlist(boolean upperCase) { StringBuilder sb = new StringBuilder(); for (int i = 0; i < columnNames.length; i++) { if (i > 0) sb.append(','); sb.append(upperCase ? columnNames[i].getUpperString() : columnNames[i].getString()); } return sb.toString(); }
java
{ "resource": "" }
q24461
QueryImpl.sort
train
@Override public synchronized void sort(String strColumn, int order) throws PageException { // disconnectCache(); sort(getColumn(strColumn), order); }
java
{ "resource": "" }
q24462
WDDXConverter._deserializeQuery
train
private Object _deserializeQuery(Element recordset) throws ConverterException { try { // create Query Object Query query = new QueryImpl(lucee.runtime.type.util.ListUtil.listToArray(recordset.getAttribute("fieldNames"), ','), Caster.toIntValue(recordset.getAttribute("rowCount")), "query"); NodeLi...
java
{ "resource": "" }
q24463
WDDXConverter._deserializeQueryField
train
private void _deserializeQueryField(Query query, Element field) throws PageException, ConverterException { String name = field.getAttribute("name"); NodeList list = field.getChildNodes(); int len = list.getLength(); int count = 0; for (int i = 0; i < len; i++) { Node node = list.item(i); if (node instanc...
java
{ "resource": "" }
q24464
WDDXConverter._deserializeComponent
train
private Object _deserializeComponent(Element elComp) throws ConverterException { // String type=elStruct.getAttribute("type"); String name = elComp.getAttribute("name"); String md5 = elComp.getAttribute("md5"); // TLPC PageContext pc = ThreadLocalPageContext.get(); // Load comp Component comp = null; try { ...
java
{ "resource": "" }
q24465
WDDXConverter.getChildElement
train
private Element getChildElement(Element parent) { NodeList list = parent.getChildNodes(); int len = list.getLength(); for (int i = 0; i < len; i++) { Node node = list.item(i); if (node instanceof Element) { return (Element) node; } } return null; }
java
{ "resource": "" }
q24466
NumberFormat.format
train
public String format(Locale locale, double number) { DecimalFormat df = getDecimalFormat(locale); df.applyPattern(",0"); df.setGroupingSize(3); return df.format(number); }
java
{ "resource": "" }
q24467
NumberFormat.formatX
train
public String formatX(Locale locale, double number, String mask) throws InvalidMaskException { return format(locale, number, convertMask(mask)); }
java
{ "resource": "" }
q24468
ArrayClassic.enlargeOffset
train
private void enlargeOffset() { if (offset == 0) { offCount = offCount == 0 ? 1 : offCount * 2; offset = offCount; Object[] narr = new Object[arr.length + offset]; for (int i = 0; i < size; i++) { narr[offset + i] = arr[i]; } arr = narr; } }
java
{ "resource": "" }
q24469
Component.isInsideCITemplate
train
private Boolean isInsideCITemplate(Page page) { SourceCode sc = page.getSourceCode(); if (!(sc instanceof PageSourceCode)) return null; PageSource psc = ((PageSourceCode) sc).getPageSource(); String src = psc.getDisplayPath(); return Constants.isComponentExtension(ResourceUtil.getExtension(src, "")); // int pos=s...
java
{ "resource": "" }
q24470
Caster.toNumber
train
public static Number toNumber(String str, Number defaultValue) { try { // float if (str.indexOf('.') != -1) { return new BigDecimal(str); } // integer BigInteger bi = new BigInteger(str); int l = bi.bitLength(); if (l < 32) return new Integer(bi.intValue()); if (l < 64) return...
java
{ "resource": "" }
q24471
Caster.toString3
train
public static String toString3(double d) { long l = (long) d; if (l == d) return toString(l); String str = Double.toString(d); int pos; if ((pos = str.indexOf('E')) != -1 && pos == str.length() - 2) { return new StringBuffer(pos + 2).append(str.charAt(0)).append(str.substring(2, toDigit(str.charAt(pos + 1)) ...
java
{ "resource": "" }
q24472
Caster.toBinary
train
public static byte[] toBinary(Object o) throws PageException { if (o instanceof byte[]) return (byte[]) o; else if (o instanceof ObjectWrap) return toBinary(((ObjectWrap) o).getEmbededObject("")); else if (o instanceof InputStream) { ByteArrayOutputStream barr = new ByteArrayOutputStream(); try { IOUtil...
java
{ "resource": "" }
q24473
Caster.toBase64
train
public static String toBase64(Object o, String charset, String defaultValue) { ; if (o instanceof byte[]) return toB64((byte[]) o, defaultValue); else if (o instanceof String) return toB64((String) o, charset, defaultValue); else if (o instanceof Number) return toB64(toString(((Number) o)), charset, defaultValue); ...
java
{ "resource": "" }
q24474
Caster.toQueryColumn
train
public static QueryColumn toQueryColumn(Object o) throws PageException { if (o instanceof QueryColumn) return (QueryColumn) o; throw new CasterException(o, "querycolumn"); }
java
{ "resource": "" }
q24475
Caster.toQueryColumn
train
public static QueryColumn toQueryColumn(Object o, PageContext pc) throws PageException { if (o instanceof QueryColumn) return (QueryColumn) o; if (o instanceof String) { o = VariableInterpreter.getVariableAsCollection(pc, (String) o); if (o instanceof QueryColumn) return (QueryColumn) o; } throw new Cast...
java
{ "resource": "" }
q24476
Caster.toCollection
train
public static Collection toCollection(Object o) throws PageException { if (o instanceof Collection) return (Collection) o; else if (o instanceof Node) return XMLCaster.toXMLStruct((Node) o, false); else if (o instanceof Map) { return MapAsStruct.toStruct((Map) o, true);// StructImpl((Map)o); } else if (o inst...
java
{ "resource": "" }
q24477
Caster.toComponent
train
public static Component toComponent(Object o) throws PageException { if (o instanceof Component) return (Component) o; else if (o instanceof ObjectWrap) { return toComponent(((ObjectWrap) o).getEmbededObject()); } throw new CasterException(o, "Component"); }
java
{ "resource": "" }
q24478
Caster.toLocale
train
public static Locale toLocale(String strLocale, Locale defaultValue) { return LocaleFactory.getLocale(strLocale, defaultValue); }
java
{ "resource": "" }
q24479
Caster.toTimeZone
train
public static TimeZone toTimeZone(String strTimeZone, TimeZone defaultValue) { return TimeZoneUtil.toTimeZone(strTimeZone, defaultValue); }
java
{ "resource": "" }
q24480
Caster.toInteger
train
public static Integer toInteger(Object o, Integer defaultValue) { if (defaultValue != null) return Integer.valueOf(toIntValue(o, defaultValue.intValue())); int res = toIntValue(o, Integer.MIN_VALUE); if (res == Integer.MIN_VALUE) return defaultValue; return Integer.valueOf(res); }
java
{ "resource": "" }
q24481
FormatTag.doAfterBody
train
@Override public final int doAfterBody() throws JspException { // Use the body of the tag as input for the date BodyContent body = getBodyContent(); String s = body.getString().trim(); // Clear the body since we will output only the formatted date body.clearBody(); if (output_date == null) { long time; ...
java
{ "resource": "" }
q24482
FormatTag.doEndTag
train
@Override public final int doEndTag() throws JspException { String date_formatted = default_text; if (output_date != null) { // Get the pattern to use SimpleDateFormat sdf; String pat = pattern; if (pat == null && patternid != null) { Object attr = pageContext.findAttribute(patternid); i...
java
{ "resource": "" }
q24483
PCLCollection.loadClass
train
public synchronized Class<?> loadClass(String className) throws ClassNotFoundException { // if class is already loaded flush the classloader and do new classloader PCLBlock cl = index.get(className); if (cl != null) { return cl.loadClass(className); } throw new ClassNotFoundException("class " + className + " ...
java
{ "resource": "" }
q24484
PCLCollection.shrink
train
public synchronized int shrink(boolean force) { int before = index.size(); // CFM int flushCFM = 0; while (cfms.size() > 1) { flush(cfms.poll()); flushCFM++; } // CFC if (force && flushCFM < 2 && cfcs.size() > 1) { flush(oldest(cfcs)); if (cfcs.size() > 1) flush(cfcs.poll()); } // print.o...
java
{ "resource": "" }
q24485
ArrayImplNS.setE
train
@Override public Object setE(int key, Object value) throws ExpressionException { if (offset + key > arr.length) enlargeCapacity(key); if (key > size) size = key; arr[(offset + key) - 1] = checkValue(value); return value; }
java
{ "resource": "" }
q24486
ArrayImplNS.add
train
@Override public boolean add(Object o) { if (offset + size + 1 > arr.length) enlargeCapacity(size + 1); arr[offset + size] = o; size++; return true; }
java
{ "resource": "" }
q24487
PicServlet.service
train
@Override protected void service(HttpServletRequest req, HttpServletResponse rsp) throws ServletException, IOException { // get out Stream // pic String[] arrPath = (req.getServletPath()).split("\\."); String pic = PIC_SOURCE + "404.gif"; if (arrPath.length >= 3) { pic = PIC_SOURCE + ((arrPath[arrPath.le...
java
{ "resource": "" }
q24488
Hash.getHashText
train
public static String getHashText(String plainText, String algorithm) throws NoSuchAlgorithmException { MessageDigest mdAlgorithm = MessageDigest.getInstance(algorithm); mdAlgorithm.update(plainText.getBytes()); byte[] digest = mdAlgorithm.digest(); StringBuffer hexString = new StringBuffer(); for (int i = 0; i ...
java
{ "resource": "" }
q24489
FunctionLibFactory.characters
train
@Override public void characters(char ch[], int start, int length) { content.append(new String(ch, start, length)); }
java
{ "resource": "" }
q24490
FunctionLibFactory.loadFromDirectory
train
public static FunctionLib[] loadFromDirectory(Resource dir, Identification id) throws FunctionLibException { if (!dir.isDirectory()) return new FunctionLib[0]; ArrayList<FunctionLib> arr = new ArrayList<FunctionLib>(); Resource[] files = dir.listResources(new ExtensionResourceFilter(new String[] { "fld", "fldx" }))...
java
{ "resource": "" }
q24491
FunctionLibFactory.loadFromFile
train
public static FunctionLib loadFromFile(Resource res, Identification id) throws FunctionLibException { // Read in XML FunctionLib lib = FunctionLibFactory.hashLib.get(id(res));// getHashLib(file.getAbsolutePath()); if (lib == null) { lib = new FunctionLibFactory(null, res, id, false).getLib(); FunctionLibFa...
java
{ "resource": "" }
q24492
FunctionLibFactory.loadFromSystem
train
public static FunctionLib[] loadFromSystem(Identification id) throws FunctionLibException { if (systemFLDs[CFMLEngine.DIALECT_CFML] == null) { FunctionLib cfml = new FunctionLibFactory(null, FLD_BASE, id, true).getLib(); FunctionLib lucee = cfml.duplicate(false); systemFLDs[CFMLEngine.DIALECT_CFML] = ne...
java
{ "resource": "" }
q24493
FunctionLibFactory.copyFunctions
train
private static void copyFunctions(FunctionLib extFL, FunctionLib newFL) { Iterator<Entry<String, FunctionLibFunction>> it = extFL.getFunctions().entrySet().iterator(); FunctionLibFunction flf; while (it.hasNext()) { flf = it.next().getValue(); // TODO function must be duplicated because it gets a new FunctionLi...
java
{ "resource": "" }
q24494
FunctionLibFactory.setAttributes
train
private static void setAttributes(FunctionLib extFL, FunctionLib newFL) { newFL.setDescription(extFL.getDescription()); newFL.setDisplayName(extFL.getDisplayName()); newFL.setShortName(extFL.getShortName()); newFL.setUri(extFL.getUri()); newFL.setVersion(extFL.getVersion()); }
java
{ "resource": "" }
q24495
BlowfishCBC.encryptBlock
train
@Override protected long encryptBlock(long lPlainblock) { // chain with the CBC IV lPlainblock ^= m_lCBCIV; // encrypt the block lPlainblock = super.encryptBlock(lPlainblock); // the encrypted block is the new CBC IV return (m_lCBCIV = lPlainblock); }
java
{ "resource": "" }
q24496
BlowfishCBC.decryptBlock
train
@Override protected long decryptBlock(long lCipherblock) { // save the current block long lTemp = lCipherblock; // decrypt the block lCipherblock = super.decryptBlock(lCipherblock); // dechain the block lCipherblock ^= m_lCBCIV; // set the new CBC IV m_lCBCIV = lTemp; // return the decrypted block...
java
{ "resource": "" }
q24497
Exit.setMethod
train
public void setMethod(String method) { method = method.toLowerCase(); if (method.equals("loop")) this.method = MODE_LOOP; else if (method.equals("exittag")) this.method = MODE_EXIT_TAG; else if (method.equals("exittemplate")) this.method = MODE_EXIT_TEMPLATE; }
java
{ "resource": "" }
q24498
FileCacheEntry.isOK
train
private boolean isOK(TimeSpan timeSpan) { return res.exists() && (res.lastModified() + timeSpan.getMillis() >= System.currentTimeMillis()); }
java
{ "resource": "" }
q24499
Page.registerString
train
public Range registerString(BytecodeContext bc, String str) throws IOException { boolean append = true; if (staticTextLocation == null) { if (bc.getPageSource() == null) return null; PageSource ps = bc.getPageSource(); Mapping m = ps.getMapping(); staticTextLocation = m.getClassRootDirectory(); ...
java
{ "resource": "" }