_id
stringlengths
2
7
title
stringlengths
3
140
partition
stringclasses
3 values
text
stringlengths
73
34.1k
language
stringclasses
1 value
meta_information
dict
q24300
Solo.getButton
train
public Button getButton(String text, boolean onlyVisible) { if(config.commandLogging){ Log.d(config.commandLoggingTag, "getButton(\""+text+"\", "+onlyVisible+")"); } return getter.getView(Button.class, text, onlyVisible); }
java
{ "resource": "" }
q24301
Solo.getEditText
train
public EditText getEditText(String text) { if(config.commandLogging){ Log.d(config.commandLoggingTag, "getEditText(\""+text+"\")"); } return getter.getView(EditText.class, text, false); }
java
{ "resource": "" }
q24302
Solo.getView
train
public View getView(int id){ if(config.commandLogging){ Log.d(config.commandLoggingTag, "getView("+id+")"); } return getView(id, 0); }
java
{ "resource": "" }
q24303
Solo.getView
train
public View getView(Object tag){ if(config.commandLogging){ Log.d(config.commandLoggingTag, "getView("+tag+")"); } return getView(tag, 0); }
java
{ "resource": "" }
q24304
Solo.getView
train
public View getView(Object tag, int index){ if(config.commandLogging){ Log.d(config.commandLoggingTag, "getView("+tag+", "+index+")"); } View viewToReturn = getter.getView(tag, index); if(viewToReturn == null) { int match = index + 1; if(match > 1){ Assert.fail(match + " Views with id: '" + tag...
java
{ "resource": "" }
q24305
Solo.getView
train
public <T extends View> T getView(Class<T> viewClass, int index){ if(config.commandLogging){ Log.d(config.commandLoggingTag, "getView("+viewClass+", "+index+")"); } return waiter.waitForAndGetView(index, viewClass); }
java
{ "resource": "" }
q24306
Solo.getWebElement
train
public WebElement getWebElement(By by, int index){ if(config.commandLogging){ Log.d(config.commandLoggingTag, "getWebElement("+by+", "+index+")"); } int match = index + 1; WebElement webElement = waiter.waitForWebElement(by, match, Timeout.getSmallTimeout(), true); if(webElement == null) { if(match ...
java
{ "resource": "" }
q24307
Solo.getWebUrl
train
public String getWebUrl() { if(config.commandLogging){ Log.d(config.commandLoggingTag, "getWebUrl()"); } final WebView webView = waiter.waitForAndGetView(0, WebView.class); if(webView == null) Assert.fail("WebView is not found!"); instrumentation.runOnMainSync(new Runnable() { public void run() ...
java
{ "resource": "" }
q24308
Solo.getCurrentViews
train
public ArrayList<View> getCurrentViews() { if(config.commandLogging){ Log.d(config.commandLoggingTag, "getCurrentViews()"); } return viewFetcher.getViews(null, true); }
java
{ "resource": "" }
q24309
Solo.getCurrentViews
train
public <T extends View> ArrayList<T> getCurrentViews(Class<T> classToFilterBy, boolean includeSubclasses, View parent) { if(config.commandLogging){ Log.d(config.commandLoggingTag, "getCurrentViews("+classToFilterBy+", "+includeSubclasses+", "+parent+")"); } return viewFetcher.getCurrentViews(classToFilterBy...
java
{ "resource": "" }
q24310
Solo.getWebElements
train
public ArrayList<WebElement> getWebElements(){ if(config.commandLogging){ Log.d(config.commandLoggingTag, "getWebElements()"); } return webUtils.getWebElements(false); }
java
{ "resource": "" }
q24311
Solo.getCurrentWebElements
train
public ArrayList<WebElement> getCurrentWebElements(){ if(config.commandLogging){ Log.d(config.commandLoggingTag, "getCurrentWebElements()"); } return webUtils.getWebElements(true); }
java
{ "resource": "" }
q24312
Solo.isRadioButtonChecked
train
public boolean isRadioButtonChecked(int index) { if(config.commandLogging){ Log.d(config.commandLoggingTag, "isRadioButtonChecked("+index+")"); } return checker.isButtonChecked(RadioButton.class, index); }
java
{ "resource": "" }
q24313
Solo.isRadioButtonChecked
train
public boolean isRadioButtonChecked(String text) { if(config.commandLogging){ Log.d(config.commandLoggingTag, "isRadioButtonChecked(\""+text+"\")"); } return checker.isButtonChecked(RadioButton.class, text); }
java
{ "resource": "" }
q24314
Solo.isCheckBoxChecked
train
public boolean isCheckBoxChecked(int index) { if(config.commandLogging){ Log.d(config.commandLoggingTag, "isCheckBoxChecked("+index+")"); } return checker.isButtonChecked(CheckBox.class, index); }
java
{ "resource": "" }
q24315
Solo.isToggleButtonChecked
train
public boolean isToggleButtonChecked(String text) { if(config.commandLogging){ Log.d(config.commandLoggingTag, "isToggleButtonChecked(\""+text+"\")"); } return checker.isButtonChecked(ToggleButton.class, text); }
java
{ "resource": "" }
q24316
Solo.isToggleButtonChecked
train
public boolean isToggleButtonChecked(int index) { if(config.commandLogging){ Log.d(config.commandLoggingTag, "isToggleButtonChecked("+index+")"); } return checker.isButtonChecked(ToggleButton.class, index); }
java
{ "resource": "" }
q24317
Solo.isCheckBoxChecked
train
public boolean isCheckBoxChecked(String text) { if(config.commandLogging){ Log.d(config.commandLoggingTag, "isCheckBoxChecked(\""+text+"\")"); } return checker.isButtonChecked(CheckBox.class, text); }
java
{ "resource": "" }
q24318
Solo.isTextChecked
train
@SuppressWarnings("unchecked") public boolean isTextChecked(String text){ if(config.commandLogging){ Log.d(config.commandLoggingTag, "isTextChecked(\""+text+"\")"); } waiter.waitForViews(false, CheckedTextView.class, CompoundButton.class); if(viewFetcher.getCurrentViews(CheckedTextView.class, true).size...
java
{ "resource": "" }
q24319
Solo.isSpinnerTextSelected
train
public boolean isSpinnerTextSelected(String text) { if(config.commandLogging){ Log.d(config.commandLoggingTag, "isSpinnerTextSelected(\""+text+"\")"); } return checker.isSpinnerTextSelected(text); }
java
{ "resource": "" }
q24320
Solo.hideSoftKeyboard
train
public void hideSoftKeyboard() { if(config.commandLogging){ Log.d(config.commandLoggingTag, "hideSoftKeyboard()"); } dialogUtils.hideSoftKeyboard(null, true, false); }
java
{ "resource": "" }
q24321
Solo.unlockScreen
train
public void unlockScreen(){ if(config.commandLogging){ Log.d(config.commandLoggingTag, "unlockScreen()"); } final Activity activity = activityUtils.getCurrentActivity(false); instrumentation.runOnMainSync(new Runnable() { @Override public void run() { if(activity != null){ activity.getWindo...
java
{ "resource": "" }
q24322
Solo.goBackToActivity
train
public void goBackToActivity(String name) { if(config.commandLogging){ Log.d(config.commandLoggingTag, "goBackToActivity(\""+name+"\")"); } activityUtils.goBackToActivity(name); }
java
{ "resource": "" }
q24323
Solo.waitForActivity
train
public boolean waitForActivity(String name){ if(config.commandLogging){ Log.d(config.commandLoggingTag, "waitForActivity(\""+name+"\")"); } return waiter.waitForActivity(name, Timeout.getLargeTimeout()); }
java
{ "resource": "" }
q24324
Solo.waitForActivity
train
public boolean waitForActivity(String name, int timeout) { if(config.commandLogging){ Log.d(config.commandLoggingTag, "waitForActivity(\""+name+"\", "+timeout+")"); } return waiter.waitForActivity(name, timeout); }
java
{ "resource": "" }
q24325
Solo.waitForActivity
train
public boolean waitForActivity(Class<? extends Activity> activityClass){ if(config.commandLogging){ Log.d(config.commandLoggingTag, "waitForActivity("+activityClass+")"); } return waiter.waitForActivity(activityClass, Timeout.getLargeTimeout()); }
java
{ "resource": "" }
q24326
Solo.waitForActivity
train
public boolean waitForActivity(Class<? extends Activity> activityClass, int timeout) { if(config.commandLogging){ Log.d(config.commandLoggingTag, "waitForActivity("+activityClass+", "+timeout+")"); } return waiter.waitForActivity(activityClass, timeout); }
java
{ "resource": "" }
q24327
Solo.waitForEmptyActivityStack
train
public boolean waitForEmptyActivityStack(int timeout) { if(config.commandLogging){ Log.d(config.commandLoggingTag, "waitForEmptyActivityStack("+timeout+")"); } return waiter.waitForCondition( new Condition(){ @Override public boolean isSatisfied() { return activityUtils.isActivityStackE...
java
{ "resource": "" }
q24328
Solo.waitForFragmentByTag
train
public boolean waitForFragmentByTag(String tag){ if(config.commandLogging){ Log.d(config.commandLoggingTag, "waitForFragmentByTag(\""+tag+"\")"); } return waiter.waitForFragment(tag, 0, Timeout.getLargeTimeout()); }
java
{ "resource": "" }
q24329
Solo.waitForFragmentByTag
train
public boolean waitForFragmentByTag(String tag, int timeout){ if(config.commandLogging){ Log.d(config.commandLoggingTag, "waitForFragmentByTag(\""+tag+"\", "+timeout+")"); } return waiter.waitForFragment(tag, 0, timeout); }
java
{ "resource": "" }
q24330
Solo.waitForFragmentById
train
public boolean waitForFragmentById(int id){ if(config.commandLogging){ Log.d(config.commandLoggingTag, "waitForFragmentById("+id+")"); } return waiter.waitForFragment(null, id, Timeout.getLargeTimeout()); }
java
{ "resource": "" }
q24331
Solo.waitForFragmentById
train
public boolean waitForFragmentById(int id, int timeout){ if(config.commandLogging){ Log.d(config.commandLoggingTag, "waitForFragmentById("+id+", "+timeout+")"); } return waiter.waitForFragment(null, id, timeout); }
java
{ "resource": "" }
q24332
Solo.getString
train
public String getString(int id) { if(config.commandLogging){ Log.d(config.commandLoggingTag, "getString("+id+")"); } return getter.getString(id); }
java
{ "resource": "" }
q24333
Solo.sleep
train
public void sleep(int time) { if(config.commandLogging){ Log.d(config.commandLoggingTag, "sleep("+time+")"); } sleeper.sleep(time); }
java
{ "resource": "" }
q24334
Solo.initializeTimeout
train
@SuppressWarnings({ "rawtypes", "unchecked" }) private static int initializeTimeout(String property, int defaultValue) { try { Class clazz = Class.forName("android.os.SystemProperties"); Method method = clazz.getDeclaredMethod("get", String.class); String value = (String) method.invoke(null, property); ...
java
{ "resource": "" }
q24335
Index.setUrlpath
train
public void setUrlpath(String urlpath) { if (StringUtil.isEmpty(urlpath)) return; this.urlpath = urlpath.toLowerCase().trim(); }
java
{ "resource": "" }
q24336
Index.setType
train
public void setType(String type) throws PageException { if (type == null) return; try { this.type = toType(type); } catch (SearchException e) { throw Caster.toPageException(e); } }
java
{ "resource": "" }
q24337
Index.setLanguage
train
public void setLanguage(String language) { if (StringUtil.isEmpty(language)) return; this.language = Collection.validateLanguage(language); }
java
{ "resource": "" }
q24338
Index.setExtensions
train
public void setExtensions(String extensions) throws PageException { if (extensions == null) return; this.extensions = ListUtil.toStringArrayTrim(ListUtil.listToArray(extensions, ',')); }
java
{ "resource": "" }
q24339
Index.setCollection
train
public void setCollection(String collection) throws PageException { try { this.collection = pageContext.getConfig().getSearchEngine(pageContext).getCollectionByName(collection.toLowerCase().trim()); } catch (SearchException e) { throw Caster.toPageException(e); } }
java
{ "resource": "" }
q24340
Index.doDelete
train
private void doDelete() throws PageException, SearchException { required("index", action, "collection", collection); if (type != SearchIndex.TYPE_CUSTOM) required("index", action, "key", key); // no type defined if (type == -1) { if (query != null) { type = SearchIndex.TYPE_CUSTOM; } else { Reso...
java
{ "resource": "" }
q24341
Index.doUpdate
train
private void doUpdate() throws PageException, SearchException, IOException { // check attributes required("index", action, "collection", collection); required("index", action, "key", key); if (type == -1) type = (query == null) ? SearchIndex.TYPE_FILE : SearchIndex.TYPE_CUSTOM; if (type == SearchIndex.TYPE_CUSTO...
java
{ "resource": "" }
q24342
PClassLoader._getResource
train
public Resource _getResource(String name) { Resource f = directory.getRealResource(name); if (f != null && f.exists() && f.isFile()) return f; return null; }
java
{ "resource": "" }
q24343
NtpClient.getOffset
train
public long getOffset() throws IOException { /// Send request DatagramSocket socket = null; try { socket = new DatagramSocket(); socket.setSoTimeout(20000); InetAddress address = InetAddress.getByName(serverName); byte[] buf = new NtpMessage().toByteArray(); DatagramPacket packet = new Datag...
java
{ "resource": "" }
q24344
QueryExecute.call
train
public static Object call(PageContext pc, String sql, Object params, Struct options, String name) throws PageException { PageContextImpl pci = (PageContextImpl) pc; lucee.runtime.tag.Query qry = (lucee.runtime.tag.Query) pci.use(lucee.runtime.tag.Query.class.getName(), "cfquery", TagLibTag.ATTRIBUTE_TYPE_FIXED); tr...
java
{ "resource": "" }
q24345
ThreadUtil.toStringPriority
train
public static String toStringPriority(int priority) { if (priority == Thread.NORM_PRIORITY) return "NORMAL"; if (priority == Thread.MAX_PRIORITY) return "HIGH"; if (priority == Thread.MIN_PRIORITY) return "LOW"; return null; }
java
{ "resource": "" }
q24346
ThreadUtil.toIntPriority
train
public static int toIntPriority(String strPriority) { strPriority = strPriority.trim().toLowerCase(); if ("low".equals(strPriority)) return Thread.MIN_PRIORITY; if ("min".equals(strPriority)) return Thread.MIN_PRIORITY; if ("high".equals(strPriority)) return Thread.MAX_PRIORITY; if ("max".equals(strPriority)) ret...
java
{ "resource": "" }
q24347
MailClient.start
train
public void start() throws MessagingException { Properties properties = new Properties(); String type = getTypeAsString(); properties.put("mail." + type + ".host", server); properties.put("mail." + type + ".port", new Double(port)); properties.put("mail." + type + ".connectiontimeout", String.valueOf(timeout)); p...
java
{ "resource": "" }
q24348
MailClient.deleteMails
train
public void deleteMails(String as[], String as1[]) throws MessagingException, IOException { Folder folder; Message amessage[]; folder = _store.getFolder("INBOX"); folder.open(2); Map<String, Message> map = getMessages(null, folder, as1, as, startrow, maxrows, false); Iterator<String> iterator = map.keySet().itera...
java
{ "resource": "" }
q24349
MailClient.getMails
train
public Query getMails(String[] messageNumbers, String[] uids, boolean all) throws MessagingException, IOException { Query qry = new QueryImpl(all ? _fldnew : _flddo, 0, "query"); Folder folder = _store.getFolder("INBOX"); folder.open(Folder.READ_ONLY); try { getMessages(qry, folder, uids, messageNumbers, start...
java
{ "resource": "" }
q24350
MailClient.getMessages
train
private Map<String, Message> getMessages(Query qry, Folder folder, String[] uids, String[] messageNumbers, int startRow, int maxRow, boolean all) throws MessagingException { Message[] messages = folder.getMessages(); Map<String, Message> map = qry == null ? new HashMap<String, Message>() : null; int k = 0; if (uid...
java
{ "resource": "" }
q24351
MailClient.getContent
train
private void getContent(Query query, Message message, int row) throws MessagingException, IOException { StringBuffer body = new StringBuffer(); Struct cids = new StructImpl(); query.setAtEL(CIDS, row, cids); if (message.isMimeType("text/plain")) { String content = getConent(message); query.setAtEL(TEXT_BO...
java
{ "resource": "" }
q24352
TryCatchFinally.setFinally
train
public void setFinally(Body body, Position finallyLine) { body.setParent(this); this.finallyBody = body; this.finallyLine = finallyLine; }
java
{ "resource": "" }
q24353
TagLoop.writeOutTypeCondition
train
private void writeOutTypeCondition(BytecodeContext bc) throws TransformerException { WhileVisitor whileVisitor = new WhileVisitor(); loopVisitor = whileVisitor; whileVisitor.visitBeforeExpression(bc); bc.getFactory().toExprBoolean(getAttribute("condition").getValue()).writeOut(bc, Expression.MODE_VALUE); whileVisi...
java
{ "resource": "" }
q24354
Dump.call
train
public static String call(PageContext pc, Object object) throws PageException { return call(pc, object, null, true, 9999, null, null, null, null, 9999, true, true); }
java
{ "resource": "" }
q24355
Compress.getInstance
train
public static Compress getInstance(Resource zipFile, int format, boolean caseSensitive) throws IOException { ConfigImpl config = (ConfigImpl) ThreadLocalPageContext.getConfig(); return config.getCompressInstance(zipFile, format, caseSensitive); }
java
{ "resource": "" }
q24356
Setting.setRequesttimeout
train
public void setRequesttimeout(double requesttimeout) { long rt; if (requesttimeout <= 0) rt = Long.MAX_VALUE; else rt = (long) (requesttimeout * 1000); pageContext.setRequestTimeout(rt); }
java
{ "resource": "" }
q24357
Setting.setEnablecfoutputonly
train
public void setEnablecfoutputonly(Object enablecfoutputonly) throws PageException { if (enablecfoutputonly instanceof String && Caster.toString(enablecfoutputonly).trim().equalsIgnoreCase("reset")) { pageContext.setCFOutputOnly((short) 0); } else { pageContext.setCFOutputOnly(Caster.toBooleanValue(enablecf...
java
{ "resource": "" }
q24358
URLResolver.transform
train
public String transform(String html, URL url, boolean setBaseTag) throws PageException { StringBuffer target = new StringBuffer(); SourceCode cfml = new SourceCode(html, false, CFMLEngine.DIALECT_CFML); while (!cfml.isAfterLast()) { if (cfml.forwardIfCurrent('<')) { target.append('<'); try { for (int ...
java
{ "resource": "" }
q24359
DatasourceConnectionPool.getDatasourceConnection
train
public DatasourceConnection getDatasourceConnection(Config config, DataSource datasource, String user, String pass) throws PageException { config = ThreadLocalPageContext.getConfig(config); if (StringUtil.isEmpty(user)) { user = datasource.getUsername(); pass = datasource.getPassword(); } if (pass == nul...
java
{ "resource": "" }
q24360
DatasourceConnectionPool.openConnections
train
public Map<String, Integer> openConnections() { Map<String, Integer> map = new HashMap<String, Integer>(); Iterator<DCStack> it = dcs.values().iterator(); // all connections in pool DCStack dcstack; while (it.hasNext()) { dcstack = it.next(); Integer val = map.get(dcstack.getDatasource().getName()); ...
java
{ "resource": "" }
q24361
ListUtil.listToArray
train
public static Array listToArray(String list, char delimiter) { if (list.length() == 0) return new ArrayImpl(); int len = list.length(); int last = 0; Array array = new ArrayImpl(); try { for (int i = 0; i < len; i++) { if (list.charAt(i) == delimiter) { array.append(list.substring(last, i)); la...
java
{ "resource": "" }
q24362
ListUtil.listToArrayRemoveEmpty
train
public static Array listToArrayRemoveEmpty(String list, char delimiter) { int len = list.length(); ArrayImpl array = new ArrayImpl(); if (len == 0) return array; int last = 0; for (int i = 0; i < len; i++) { if (list.charAt(i) == delimiter) { if (last < i) array.appendEL(list.substring(last, i)); last = ...
java
{ "resource": "" }
q24363
ListUtil.listToArrayTrim
train
public static Array listToArrayTrim(String list, char delimiter) { if (list.length() == 0) return new ArrayImpl(); // remove at start while (list.indexOf(delimiter) == 0) { list = list.substring(1); } int len = list.length(); if (len == 0) return new ArrayImpl(); while (list.lastIndexOf(delimiter) == len - ...
java
{ "resource": "" }
q24364
ListUtil.listFind
train
public static int listFind(String list, String value, String delimiter) { Array arr = listToArrayTrim(list, delimiter); int len = arr.size(); for (int i = 1; i <= len; i++) { if (arr.get(i, "").equals(value)) return i - 1; } return -1; }
java
{ "resource": "" }
q24365
ListUtil.listFindIgnoreEmpty
train
public static int listFindIgnoreEmpty(String list, String value, char delimiter) { if (list == null) return -1; int len = list.length(); if (len == 0) return -1; int last = 0; int count = 0; for (int i = 0; i < len; i++) { if (list.charAt(i) == delimiter) { if (last < i) { if (list.substring(last, i...
java
{ "resource": "" }
q24366
ListUtil.listContainsNoCase
train
public static int listContainsNoCase(String list, String value, String delimiter, boolean includeEmptyFields, boolean multiCharacterDelimiter) { if (StringUtil.isEmpty(value)) return -1; Array arr = listToArray(list, delimiter, includeEmptyFields, multiCharacterDelimiter); int len = arr.size(); for (int i = 1; i ...
java
{ "resource": "" }
q24367
ListUtil.arrayToListTrim
train
public static String arrayToListTrim(String[] array, String delimiter) { return trim(arrayToList(array, delimiter), delimiter, false); }
java
{ "resource": "" }
q24368
ListUtil.arrayToList
train
public static String arrayToList(String[] array, String delimiter) { if (ArrayUtil.isEmpty(array)) return ""; StringBuilder sb = new StringBuilder(array[0]); if (delimiter.length() == 1) { char c = delimiter.charAt(0); for (int i = 1; i < array.length; i++) { sb.append(c); sb.append(array[i]); } ...
java
{ "resource": "" }
q24369
ListUtil.arrayToList
train
public static String arrayToList(Array array, String delimiter) throws PageException { if (array.size() == 0) return ""; StringBuilder sb = new StringBuilder(Caster.toString(array.get(1, ""))); int len = array.size(); for (int i = 2; i <= len; i++) { sb.append(delimiter); sb.append(Caster.toString(array....
java
{ "resource": "" }
q24370
ListUtil.trim
train
public static String[] trim(String[] array) { int from = 0; int to = 0; // test start for (int i = 0; i < array.length; i++) { from = i; if (array[i].length() != 0) break; } // test end for (int i = array.length - 1; i >= 0; i--) { to = i; if (array[i].length() != 0) break; } int newLen ...
java
{ "resource": "" }
q24371
ListUtil.toStringArrayTrim
train
public static String[] toStringArrayTrim(Array array) throws PageException { String[] arr = new String[array.size()]; for (int i = 0; i < arr.length; i++) { arr[i] = Caster.toString(array.get(i + 1, "")).trim(); } return arr; }
java
{ "resource": "" }
q24372
ListUtil.first
train
@Deprecated public static String first(String list, String delimiter) { return first(list, delimiter, true, 1); }
java
{ "resource": "" }
q24373
ListUtil.getAt
train
public static String getAt(String list, String delimiter, int position, boolean ignoreEmpty, String defaultValue) { if (delimiter.length() == 1) return getAt(list, delimiter.charAt(0), position, ignoreEmpty, defaultValue); int len = list.length(); if (len == 0) return defaultValue; int last = -1; int count = -1; ...
java
{ "resource": "" }
q24374
ListUtil.getAt
train
public static String getAt(String list, char delimiter, int position, boolean ignoreEmpty, String defaultValue) { int len = list.length(); if (len == 0) return defaultValue; int last = -1; int count = -1; for (int i = 0; i < len; i++) { // char == delimiter if (list.charAt(i) == delimiter) { if (ignor...
java
{ "resource": "" }
q24375
ListUtil.getDelimIndex
train
public static int getDelimIndex(StringBuilder sb, int itemPos, char[] delims, boolean ignoreEmpty) { if (StringUtil.isEmpty(sb)) return -1; int curr = -1, listIndex = 0; int len = sb.length(); for (int i = 0; i < len; i++) { if (contains(delims, sb.charAt(i))) { curr = i; if (ignoreEmpty) { if (i =...
java
{ "resource": "" }
q24376
AbstrCFMLExprTransformer.init
train
protected Data init(Data data) { if (JSON_ARRAY == null) JSON_ARRAY = getFLF(data, "_literalArray"); if (JSON_STRUCT == null) JSON_STRUCT = getFLF(data, "_literalStruct"); if (GET_STATIC_SCOPE == null) GET_STATIC_SCOPE = getFLF(data, "_getStaticScope"); if (GET_SUPER_STATIC_SCOPE == null) GET_SUPER_STATIC_SCOPE = g...
java
{ "resource": "" }
q24377
SMTPVerifier.verify
train
public static boolean verify(String host, String username, String password, int port) throws SMTPException { try { return _verify(host, username, password, port); } catch (MessagingException e) { // check user if (!StringUtil.isEmpty(username)) { try { _verify(host, null, null, port); t...
java
{ "resource": "" }
q24378
ConfigServerImpl.getConfigWebImpl
train
protected ConfigWebImpl getConfigWebImpl(String realpath) { Iterator<String> it = initContextes.keySet().iterator(); while (it.hasNext()) { ConfigWebImpl cw = ((CFMLFactoryImpl) initContextes.get(it.next())).getConfigWebImpl(); if (ReqRspUtil.getRootPath(cw.getServletContext()).equals(realpath)) return cw; ...
java
{ "resource": "" }
q24379
ScopeSupport.fillDecoded
train
protected void fillDecoded(URLItem[] raw, String encoding, boolean scriptProteced, boolean sameAsArray) throws UnsupportedEncodingException { clear(); String name, value; // Object curr; for (int i = 0; i < raw.length; i++) { name = raw[i].getName(); value = raw[i].getValue(); if (raw[i].isUrlEncoded...
java
{ "resource": "" }
q24380
HttpParam.setType
train
public void setType(String type) throws ApplicationException { if (StringUtil.isEmpty(type, true)) return; type = type.toLowerCase().trim(); if (type.equals("url")) param.setType(HttpParamBean.TYPE_URL); else if (type.equals("formfield") || type.equals("form")) param.setType(HttpParamBean.TYPE_FORM); else if (typ...
java
{ "resource": "" }
q24381
ColumnExpression.getValue
train
@Override public Object getValue(Query qr, int row) throws PageException { if (col == null) col = qr.getColumn(getColumn()); return QueryUtil.getValue(col, row); }
java
{ "resource": "" }
q24382
ASMUtil.getParentTag
train
public static Tag getParentTag(Tag tag) { Statement p = tag.getParent(); if (p == null) return null; p = p.getParent(); if (p instanceof Tag) return (Tag) p; return null; }
java
{ "resource": "" }
q24383
ASMUtil.hasSisterTagAfter
train
public static boolean hasSisterTagAfter(Tag tag, String nameToFind) { Body body = (Body) tag.getParent(); List<Statement> stats = body.getStatements(); Iterator<Statement> it = stats.iterator(); Statement other; boolean isAfter = false; while (it.hasNext()) { other = it.next(); if (other instanceof Ta...
java
{ "resource": "" }
q24384
ASMUtil.remove
train
public static void remove(Tag tag) { Body body = (Body) tag.getParent(); body.getStatements().remove(tag); }
java
{ "resource": "" }
q24385
ASMUtil.replace
train
public static void replace(Tag src, Tag trg, boolean moveBody) { trg.setParent(src.getParent()); Body p = (Body) src.getParent(); List<Statement> stats = p.getStatements(); Iterator<Statement> it = stats.iterator(); Statement stat; int count = 0; while (it.hasNext()) { stat = it.next(); if (stat == s...
java
{ "resource": "" }
q24386
ASMUtil.toValueType
train
public static Type toValueType(Type type) { if (type == Types.BYTE) return Types.BYTE_VALUE; if (type == Types.BOOLEAN) return Types.BOOLEAN_VALUE; if (type == Types.CHARACTER) return Types.CHAR; if (type == Types.DOUBLE) return Types.DOUBLE_VALUE; if (type == Types.FLOAT) return Types.FLOAT_VALUE; if (type == Ty...
java
{ "resource": "" }
q24387
ScriptConverter._serializeDate
train
private void _serializeDate(Date date, StringBuilder sb) throws ConverterException { _serializeDateTime(new DateTimeImpl(date), sb); }
java
{ "resource": "" }
q24388
ScriptConverter.serialize
train
public String serialize(Object object) throws ConverterException { deep = 0; StringBuilder sb = new StringBuilder(); _serialize(object, sb, new HashSet<Object>()); return sb.toString(); }
java
{ "resource": "" }
q24389
Query.setDatasource
train
public void setDatasource(Object datasource) throws PageException, ClassException, BundleException { if (datasource == null) return; data.rawDatasource = datasource; data.datasource = toDatasource(pageContext, datasource); }
java
{ "resource": "" }
q24390
IsValid.call
train
public static boolean call(PageContext pc, String type, Object value) throws ExpressionException { type = type.trim(); if ("range".equalsIgnoreCase(type)) throw new FunctionException(pc, "isValid", 1, "type", "for [range] you have to define a min and max value"); if ("regex".equalsIgnoreCase(type) || "regular_expr...
java
{ "resource": "" }
q24391
IOUtil.merge
train
public static final void merge(InputStream in1, InputStream in2, OutputStream out, boolean closeIS1, boolean closeIS2, boolean closeOS) throws IOException { try { merge(in1, in2, out, 0xffff); } finally { if (closeIS1) closeEL(in1); if (closeIS2) closeEL(in2); if (closeOS) closeEL(out); } }
java
{ "resource": "" }
q24392
IOUtil.copy
train
public void copy(File in, File out) throws IOException { InputStream is = null; OutputStream os = null; try { is = new BufferedFileInputStream(in); os = new BufferedFileOutputStream(out); } catch (IOException ioe) { closeEL(is, os); throw ioe; } copy(is, os, true, true); }
java
{ "resource": "" }
q24393
IOUtil.closeEL
train
public static void closeEL(InputStream is) { try { if (is != null) is.close(); } // catch (AlwaysThrow at) {throw at;} catch (Throwable t) { ExceptionUtil.rethrowIfNecessary(t); } }
java
{ "resource": "" }
q24394
IOUtil.closeEL
train
public static void closeEL(OutputStream os) { try { if (os != null) os.close(); } // catch (AlwaysThrow at) {throw at;} catch (Throwable t) { ExceptionUtil.rethrowIfNecessary(t); } }
java
{ "resource": "" }
q24395
IOUtil.closeEL
train
public static void closeEL(Reader r) { try { if (r != null) r.close(); } // catch (AlwaysThrow at) {throw at;} catch (Throwable e) { ExceptionUtil.rethrowIfNecessary(e); } }
java
{ "resource": "" }
q24396
IOUtil.closeEL
train
public static void closeEL(Closeable c) { try { if (c != null) c.close(); } // catch (AlwaysThrow at) {throw at;} catch (Throwable e) { ExceptionUtil.rethrowIfNecessary(e); } }
java
{ "resource": "" }
q24397
IOUtil.closeEL
train
public static void closeEL(Object obj) { if (obj instanceof InputStream) IOUtil.closeEL((InputStream) obj); else if (obj instanceof OutputStream) IOUtil.closeEL((OutputStream) obj); else if (obj instanceof Writer) IOUtil.closeEL((Writer) obj); else if (obj instanceof Reader) IOUtil.closeEL((Reader) obj); else if (...
java
{ "resource": "" }
q24398
IOUtil.checkEncoding
train
public static void checkEncoding(String encoding) throws IOException { try { URLEncoder.encode("", encoding); } catch (UnsupportedEncodingException e) { throw new IOException("invalid encoding [" + encoding + "]"); } }
java
{ "resource": "" }
q24399
MailUtil.isValidEmail
train
public static boolean isValidEmail(Object value) { InternetAddress addr = parseEmail(value, null); if (addr != null) { String address = addr.getAddress(); if (address.contains("..")) return false; int pos = address.indexOf('@'); if (pos < 1 || pos == address.length() - 1) return false; ...
java
{ "resource": "" }