_id
stringlengths
2
7
title
stringlengths
3
140
partition
stringclasses
3 values
text
stringlengths
73
34.1k
language
stringclasses
1 value
meta_information
dict
q179800
Observer.getMeters
test
private static List<InvocationMeter> getMeters() { List<InvocationMeter> invocationMeters = new ArrayList<InvocationMeter>(); ContainerSPI container = (ContainerSPI) Factory.getAppFactory(); for (ManagedMethodSPI managedMethod : container.getManagedMethods()) { invocationMeters.add(((ManagedMethod) managed...
java
{ "resource": "" }
q179801
EventStream.config
test
protected void config(EventStreamConfig config) { if (config.hasSecretKey()) { secretKey = config.getSecretKey(); } if (config.hasKeepAlivePeriod()) { keepAlivePeriod = config.getKeepAlivePeriod(); } parameters = config.getParameters(); }
java
{ "resource": "" }
q179802
EventStream.setRemoteHost
test
protected void setRemoteHost(String remoteHost) { if (string == null) { string = Strings.concat('#', STREAM_ID++, ':', remoteHost); } }
java
{ "resource": "" }
q179803
EventStream.getParameter
test
protected <T> T getParameter(String name, Class<T> type) { if (parameters == null) { throw new BugError("Event stream |%s| parameters not configured.", this); } String value = parameters.get(name); if (value == null) { throw new BugError("Missing event stream parameter |%s| of expected type |%s|.", ...
java
{ "resource": "" }
q179804
FileSystemDirectoryHelper.removePrefix
test
public String removePrefix(final String path, final String prefix) { String pathWithoutPrefix = path; if (pathWithoutPrefix.startsWith(prefix)) { pathWithoutPrefix = pathWithoutPrefix.substring(prefix.length()); while (pathWithoutPrefix.startsWith("/") || pathWithoutPrefix.startsWith("\\")) { pathWithou...
java
{ "resource": "" }
q179805
FileSystemDirectoryHelper.getCommonDir
test
public File getCommonDir(final File dir1, final File dir2) throws IOException { List<File> parts1 = getParentDirs(dir1); List<File> parts2 = getParentDirs(dir2); File matched = null; final int maxCommonSize = Math.min(parts1.size(), parts2.size()); for (int i = 0; i < maxCommonSize; ++i) { if (parts1.get(...
java
{ "resource": "" }
q179806
FileSystemDirectoryHelper.abs2rel
test
public String abs2rel(final String basePath, final String absPath) { if (!isAbsolutePath(absPath)) { return absPath; } if (isWindowsDrive(absPath) && isWindowsDrive(basePath) && absPath.charAt(0) != basePath.charAt(0)) { return absPath; } StringBuilder result = new StringBuilder(); String[] basePart...
java
{ "resource": "" }
q179807
FileSystemDirectoryHelper.rel2abs
test
public File rel2abs(final String basePath, final String relPath) { String[] baseParts = getParts(basePath); String[] relParts = getParts(relPath); if (isAbsolutePath(relPath)) { return new File(relPath); } List<String> parts = new ArrayList<>(); for (int i = 0; i < baseParts.length; ++i) { if (i > 0...
java
{ "resource": "" }
q179808
FileSystemDirectoryHelper.dirDepth
test
public int dirDepth(final File path) { final String stringPath = path.getPath(); return stringPath.length() - stringPath.replaceAll("[/\\\\]", "").length(); }
java
{ "resource": "" }
q179809
AppServlet.dumpError
test
protected static void dumpError(RequestContext context, Throwable throwable) { log.dump("Error on HTTP request:", throwable); context.dump(); }
java
{ "resource": "" }
q179810
AppServlet.sendJsonObject
test
protected static void sendJsonObject(RequestContext context, Object object, int statusCode) throws IOException { final HttpServletResponse httpResponse = context.getResponse(); if (httpResponse.isCommitted()) { log.fatal("Abort HTTP transaction. Attempt to send JSON object after reponse commited."); retur...
java
{ "resource": "" }
q179811
ParameterizedTemplateModels.addParamTemplate
test
public final void addParamTemplate(final ParameterizedTemplateModel paramTemplate) { if (paramTemplates == null) { paramTemplates = new ArrayList<ParameterizedTemplateModel>(); } paramTemplates.add(paramTemplate); }
java
{ "resource": "" }
q179812
ParameterizedTemplateModels.addParamTemplates
test
public final void addParamTemplates(final List<ParameterizedTemplateModel> list) { if (list != null) { for (final ParameterizedTemplateModel template : list) { addParamTemplate(template); } } }
java
{ "resource": "" }
q179813
ParameterizedTemplateModels.init
test
public final void init(final SrcGen4JContext context, final Map<String, String> vars) { if (paramTemplates != null) { for (final ParameterizedTemplateModel paramTemplate : paramTemplates) { paramTemplate.init(context, vars); } } }
java
{ "resource": "" }
q179814
ParameterizedTemplateModels.findReferencesTo
test
public final List<ParameterizedTemplateModel> findReferencesTo(final File templateDir, final File templateFile) { final List<ParameterizedTemplateModel> result = new ArrayList<ParameterizedTemplateModel>(); if ((paramTemplates != null) && Utils4J.fileInsideDirectory(templateDir, templateFile)) { ...
java
{ "resource": "" }
q179815
ElementView.setSaveEnabled
test
public void setSaveEnabled(boolean val) { saveButton.setVisible(val); setReadOnly(!val); entityForm.setReadOnly(!val); }
java
{ "resource": "" }
q179816
ElementView.delete
test
protected void delete() { String question = "Are you sure you want to delete " + getCaption() + "?"; ConfirmDialog.show(getUI(), question, (ConfirmDialog cd) -> { if (cd.isConfirmed()) { try { onDelete(); close(); } catc...
java
{ "resource": "" }
q179817
ElementView.onDelete
test
protected void onDelete() throws IOException, IllegalArgumentException, IllegalAccessException, FileNotFoundException, IllegalStateException { endpoint.delete(); eventBus.post(new ElementDeletedEvent<>(endpoint)); }
java
{ "resource": "" }
q179818
LocalInstanceFactory.newInstance
test
@SuppressWarnings("unchecked") @Override public <T> T newInstance(ManagedClassSPI managedClass, Object... args) { Constructor<?> constructor = managedClass.getConstructor(); if (constructor == null) { throw new BugError("Local instance factory cannot instantiate |%s|. Missing constructor.", managedClass);...
java
{ "resource": "" }
q179819
FitResultTable.getFiles
test
public File[] getFiles() { List<File> result = new ArrayList<>(); for (FileCount fileCount : results) { result.add(fileCount.getFile()); } Collections.sort(result, new FitFileComparator()); return result.toArray(new File[result.size()]); }
java
{ "resource": "" }
q179820
FitResultTable.getSummary
test
public Counts getSummary() { Counts result = new Counts(); for (FileCount fileCount : results) { if (fileCount.getCounts() != null) { result.tally(fileCount.getCounts()); } } return result; }
java
{ "resource": "" }
q179821
FitResultTable.getSummaryRow
test
public String getSummaryRow(final File directory) { StringBuilder builder = new StringBuilder(); Counts counts = getSummary(); builder.append("<tr bgcolor=\""); builder.append(color(counts)); builder.append("\"><th style=\"text-align: left\">"); builder.append(directory.getName()); builder.append("</th><...
java
{ "resource": "" }
q179822
FitResultTable.getSubSummaryRow
test
public String getSubSummaryRow(final File path) throws IOException { Counts sum = subDirSum(path); return String.format("<tr bgcolor=\"%s\"><th style=\"text-align: left\">%s</th><td>%s</td></tr>", color(sum), FitUtils.htmlSafeFile(dirHelper.abs2rel(new File("").getAbsolutePath(), path.getAbsolutePath())), sum....
java
{ "resource": "" }
q179823
ServiceInstanceFactory.newInstance
test
@SuppressWarnings("unchecked") @Override public <I> I newInstance(ManagedClassSPI managedClass, Object... args) { if (args.length > 0) { throw new IllegalArgumentException("Service instances factory does not support arguments."); } Class<?>[] interfaceClasses = managedClass.getInterfaceClasses(); if...
java
{ "resource": "" }
q179824
XtextParserConfig.getSetupClass
test
public final Class<?> getSetupClass() { if (setupClass != null) { return setupClass; } LOG.info("Creating setup class: {}", setupClassName); try { setupClass = Class.forName(setupClassName, true, context.getClassLoader()); } catch (final ClassNotFou...
java
{ "resource": "" }
q179825
XtextParserConfig.getModelDirs
test
public final List<File> getModelDirs() { if ((modelDirs == null) && (modelPath != null)) { modelDirs = paths().stream().filter(XtextParserConfig::isFile).map(XtextParserConfig::asFile).collect(Collectors.toList()); } return modelDirs; }
java
{ "resource": "" }
q179826
XtextParserConfig.getModelResources
test
public final List<URI> getModelResources() { if ((modelResources == null) && (modelPath != null)) { modelResources = new ArrayList<>(); modelResources = paths().stream().filter(XtextParserConfig::isResource).map(XtextParserConfig::asResource) .collect(Collectors.t...
java
{ "resource": "" }
q179827
EntityPicker.setCandidates
test
public void setCandidates(Collection<T> candidates) { twinColSelect.setContainerDataSource( container = new BeanItemContainer<>(entityType, candidates)); }
java
{ "resource": "" }
q179828
TinyConfigBuilder.loadXML
test
protected static void loadXML(InputStream inputStream, Loader loader) throws ConfigException { try { SAXParserFactory factory = SAXParserFactory.newInstance(); SAXParser parser = factory.newSAXParser(); XMLReader reader = parser.getXMLReader(); reader.setContentHandler(loader); reader.parse(new I...
java
{ "resource": "" }
q179829
AbstractEndpointView.onError
test
protected void onError(Exception ex) { Notification.show("Error", ex.getLocalizedMessage(), Notification.Type.ERROR_MESSAGE); }
java
{ "resource": "" }
q179830
QueryParametersParser.isObject
test
private static boolean isObject(Type[] formalParameters) { if (formalParameters.length != 1) { return false; } final Type type = formalParameters[0]; if (!(type instanceof Class)) { return false; } if (Types.isPrimitive(type)) { return false; } if (Types.isArrayLike(type)) { retu...
java
{ "resource": "" }
q179831
JsonArgumentsReader.read
test
@Override public Object[] read(HttpServletRequest httpRequest, Type[] formalParameters) throws IOException, IllegalArgumentException { JsonReader reader = new JsonReader(httpRequest.getInputStream(), expectedStartSequence(formalParameters)); try { return json.parse(reader, formalParameters); } catch (Jso...
java
{ "resource": "" }
q179832
JsonArgumentsReader.read
test
@Override public Object read(InputStream inputStream, Type type) throws IOException { try { return json.parse(new InputStreamReader(inputStream, "UTF-8"), type); } catch (JsonException | ClassCastException | UnsupportedEncodingException e) { throw new IllegalArgumentException(e.getMessage()); } }
java
{ "resource": "" }
q179833
FitUtils.extractCellParameter
test
public static String extractCellParameter(FitCell cell) { final Matcher matcher = PARAMETER_PATTERN.matcher(cell.getFitValue()); if (matcher.matches()) { cell.setFitValue(matcher.group(1)); return matcher.group(2); } else { return null; } }
java
{ "resource": "" }
q179834
TypedQueryAccessor.getHints
test
@Override public java.util.Map<java.lang.String, java.lang.Object> getHints() { return this.q.getHints(); }
java
{ "resource": "" }
q179835
HttpHeader.isXHR
test
public static boolean isXHR(HttpServletRequest httpRequest) { String requestedWith = httpRequest.getHeader(X_REQUESTED_WITH); return requestedWith != null ? requestedWith.equalsIgnoreCase(XML_HTTP_REQUEST) : false; }
java
{ "resource": "" }
q179836
HttpHeader.isAndroid
test
public static boolean isAndroid(HttpServletRequest httpRequest) { String requestedWith = httpRequest.getHeader(X_REQUESTED_WITH); return requestedWith != null ? requestedWith.equalsIgnoreCase(ANDROID_USER_AGENT) : false; }
java
{ "resource": "" }
q179837
AbstractCollectionView.handle
test
@Subscribe public void handle(ElementEvent<TEntity> message) { if (message.getEndpoint().getEntityType() == this.endpoint.getEntityType()) { refresh(); } }
java
{ "resource": "" }
q179838
BeanUtils.getPropertiesWithAnnotation
test
public static <TAnnotation extends Annotation> List<PropertyDescriptor> getPropertiesWithAnnotation(Class<?> beanType, Class<TAnnotation> annotationType) { LinkedList<PropertyDescriptor> result = new LinkedList<>(); getProperties(beanType).forEach(property -> { if (property.getReadMethod() !...
java
{ "resource": "" }
q179839
BeanUtils.getAnnotation
test
public static <TAnnotation extends Annotation> Optional<TAnnotation> getAnnotation(Class<?> beanType, PropertyDescriptor property, Class<TAnnotation> annotationType) { Optional<TAnnotation> annotation = stream(property.getReadMethod().getAnnotationsByType(annotationType)).findAny(); return annotation.is...
java
{ "resource": "" }
q179840
Server.log
test
private static String log(String message, Object... args) { message = String.format(message, args); java.util.logging.Logger.getLogger(Server.class.getCanonicalName()).log(java.util.logging.Level.SEVERE, message); return message; }
java
{ "resource": "" }
q179841
JRubyWhois.lookup
test
public WhoisResult lookup(String domain, int timeout) { container.put("domain", domain); container.put("timeout_param", timeout); try { return (WhoisResult) container.runScriptlet( JRubyWhois.class.getResourceAsStream("jruby-whois.rb"), "jruby-...
java
{ "resource": "" }
q179842
JRubyWhois.hasParserForWhoisHost
test
public boolean hasParserForWhoisHost(String whoisHost) { container.put("host", whoisHost); return (Boolean) container.runScriptlet( JRubyWhois.class.getResourceAsStream("jruby-has-parser.rb"), "jruby-has-parser.rb"); }
java
{ "resource": "" }
q179843
HttpRmiServlet.getManagedClass
test
private static ManagedClassSPI getManagedClass(ContainerSPI container, String interfaceName, String requestURI) throws ClassNotFoundException { Class<?> interfaceClass = Classes.forOptionalName(interfaceName); if (interfaceClass == null) { log.error("HTTP-RMI request for not existing class |%s|.", interfaceNa...
java
{ "resource": "" }
q179844
HttpRmiServlet.getManagedMethod
test
private static ManagedMethodSPI getManagedMethod(ManagedClassSPI managedClass, String methodName, String requestURI) throws NoSuchMethodException { ManagedMethodSPI managedMethod = managedClass.getNetMethod(methodName); if (managedMethod == null) { log.error("HTTP-RMI request for not existing managed method |...
java
{ "resource": "" }
q179845
LogEventAnalyzer.processNotContainsException
test
public void processNotContainsException(Map<String, String> parameters) { LoggingEvent match = getMessageWithException(parameters); if (match == null) { cell.right(); } else { cell.wrong(match.getThrowableInformation().getThrowableStrRep()[0]); } }
java
{ "resource": "" }
q179846
LogEventAnalyzer.processNotContains
test
public void processNotContains(Map<String, String> parameters) { LoggingEvent match = getMessageWithString(parameters); if (match == null) { cell.right(); } else { cell.wrong(match.getMessage().toString()); } }
java
{ "resource": "" }
q179847
ResultSetImpl.getBoolean2
test
public Boolean getBoolean2(String columnLabel) throws java.sql.SQLException { boolean value = this.rs.getBoolean(columnLabel); return !this.rs.wasNull() ? value : null; }
java
{ "resource": "" }
q179848
ResultSetImpl.isWrapperFor
test
@Override public boolean isWrapperFor(java.lang.Class<?> arg0) throws java.sql.SQLException { return this.rs.isWrapperFor(arg0); }
java
{ "resource": "" }
q179849
AbstractView.serialize
test
@Override public void serialize(HttpServletResponse httpResponse) throws IOException { httpResponse.setHeader(HttpHeader.CACHE_CONTROL, HttpHeader.NO_CACHE); httpResponse.addHeader(HttpHeader.CACHE_CONTROL, HttpHeader.NO_STORE); httpResponse.setHeader(HttpHeader.PRAGMA, HttpHeader.NO_CACHE); httpResponse....
java
{ "resource": "" }
q179850
Cookies.get
test
public String get(String name) { Params.notNullOrEmpty(name, "Cookie name"); if (cookies == null) { return null; } for (Cookie cookie : cookies) { if (name.equals(cookie.getName())) { return cookie.getValue(); } } return null; }
java
{ "resource": "" }
q179851
Cookies.add
test
public void add(String name, String value) { Params.notNullOrEmpty(name, "Cookie name"); Params.notNull(value, "Cookie value"); Cookie cookie = new Cookie(name, value); cookie.setPath("/"); httpResponse.addCookie(cookie); }
java
{ "resource": "" }
q179852
Cookies.remove
test
public void remove(String name) { Params.notNullOrEmpty(name, "Cookie name"); if (cookies == null) { return; } for (Cookie cookie : cookies) { if (name.equals(cookie.getName())) { cookie.setMaxAge(0); cookie.setValue(""); cookie.setPath("/"); httpResponse.addCookie(cookie); ...
java
{ "resource": "" }
q179853
Cookies.iterator
test
public Iterator<Cookie> iterator() { if (cookies == null) { return Collections.emptyIterator(); } return Arrays.asList(cookies).iterator(); }
java
{ "resource": "" }
q179854
TargetFileListProducerConfig.getTargetFileListProducer
test
public final TargetFileListProducer getTargetFileListProducer() { if (tflProducer != null) { return tflProducer; } final Object obj = Utils4J.createInstance(className); if (!(obj instanceof TargetFileListProducer)) { throw new IllegalStateException( ...
java
{ "resource": "" }
q179855
DynamicObjectFactory.add
test
public void add(final Class<?> type, final String name) throws ClassNotFoundException { FieldGen fg; if (result != null) { throw new IllegalStateException("Class already generated"); } fg = new FieldGen(Constants.ACC_PUBLIC | Constants.ACC_SUPER, Type.getType(type), name, cg.getConstantPool()); cg.ad...
java
{ "resource": "" }
q179856
DynamicObjectFactory.compile
test
public final Class<?> compile() { if (result == null) { loader.loadJavaClass(cg.getClassName(), cg.getJavaClass()); try { result = loader.loadClass(cg.getClassName()); } catch (ClassNotFoundException e) { throw new RuntimeException(e); } } return result; }
java
{ "resource": "" }
q179857
Challenge.verifyResponse
test
public boolean verifyResponse(String token) throws NullPointerException { return value.equals(getValue(tokenedImageFiles.get(token))); }
java
{ "resource": "" }
q179858
Challenge.getValue
test
private static String getValue(File file) throws NullPointerException { if (file == null) { return null; } return file.getName().toLowerCase().replaceAll(EXTENSION_REX, "").replaceAll(NOT_LETTERS_REX, " "); }
java
{ "resource": "" }
q179859
URIUtils.ensureTrailingSlash
test
@SneakyThrows public static URI ensureTrailingSlash(URI uri) { URIBuilder builder = new URIBuilder(uri); if (!builder.getPath().endsWith("/")) { builder.setPath(builder.getPath() + "/"); } return builder.build(); }
java
{ "resource": "" }
q179860
TinyContainer.login
test
@Override public boolean login(String username, String password) { try { getHttpServletRequest().login(username, password); } catch (ServletException e) { // exception is thrown if request is already authenticated, servlet container authentication is not enabled or // credentials are not accepted ...
java
{ "resource": "" }
q179861
TinyContainer.getHttpServletRequest
test
private HttpServletRequest getHttpServletRequest() { RequestContext context = getInstance(RequestContext.class); HttpServletRequest request = context.getRequest(); if (request == null) { throw new BugError("Attempt to use not initialized HTTP request."); } return request; }
java
{ "resource": "" }
q179862
ManagedProxyHandler.invoke
test
@Override public Object invoke(Object proxy, Method method, Object[] args) throws Throwable { final ManagedMethodSPI managedMethod = managedClass.getManagedMethod(method); log.trace("Invoke |%s|.", managedMethod); if (!managedMethod.isTransactional()) { // execute managed method that is not included wi...
java
{ "resource": "" }
q179863
ManagedProxyHandler.executeMutableTransaction
test
private Object executeMutableTransaction(ManagedMethodSPI managedMethod, Object[] args) throws Throwable { // store transaction session on current thread via transactional resource utility // it may happen to have multiple nested transaction on current thread // since all are created by the same transactional ...
java
{ "resource": "" }
q179864
ManagedProxyHandler.executeImmutableTransaction
test
private Object executeImmutableTransaction(ManagedMethodSPI managedMethod, Object[] args) throws Throwable { Transaction transaction = transactionalResource.createReadOnlyTransaction(); // see mutable transaction comment transactionalResource.storeSession(transaction.getSession()); try { Object result...
java
{ "resource": "" }
q179865
FileSelector.getFiles
test
public File[] getFiles() { final File[] files = directory.listFiles(filter); if (files == null) { return new File[0]; } else { return files; } }
java
{ "resource": "" }
q179866
FileSelector.getLastFile
test
public File getLastFile() throws FileNotFoundException { File[] files = directory.listFiles(filter); if (files == null || files.length == 0) { throw new FileNotFoundException(); } return files[files.length - 1]; }
java
{ "resource": "" }
q179867
AbstractParser.getConcreteConfig
test
@SuppressWarnings("unchecked") protected final CONFIG_TYPE getConcreteConfig(final ParserConfig config) { final Config<ParserConfig> cfg = config.getConfig(); if (cfg == null) { throw new IllegalStateException( "The configuration is expected to be of type '" + co...
java
{ "resource": "" }
q179868
RequestPreprocessor.startsWith
test
private static boolean startsWith(String requestPath, String pathComponent) { if (requestPath.charAt(0) != '/') { return false; } int i = 1; for (int j = 0; i < requestPath.length(); ++i, ++j) { if (requestPath.charAt(i) == '/') { return j == pathComponent.length(); } if (j == pathCompo...
java
{ "resource": "" }
q179869
EMFGeneratorConfig.getFactories
test
@SuppressWarnings("unchecked") @NotNull public final <MODEL> List<ArtifactFactory<MODEL>> getFactories(final Class<MODEL> modelType) { final List<ArtifactFactory<MODEL>> list = new ArrayList<ArtifactFactory<MODEL>>(); if (factories == null) { factories = new ArrayList<ArtifactFa...
java
{ "resource": "" }
q179870
SessionScopeFactory.getSession
test
private HttpSession getSession(InstanceKey instanceKey) { RequestContext requestContext = appFactory.getInstance(RequestContext.class); HttpServletRequest httpRequest = requestContext.getRequest(); if (httpRequest == null) { throw new BugError("Invalid web context due to null HTTP request. Cannot create ma...
java
{ "resource": "" }
q179871
FileResource.serialize
test
@Override public void serialize(HttpServletResponse httpResponse) throws IOException { httpResponse.setHeader(HttpHeader.CACHE_CONTROL, HttpHeader.NO_CACHE); httpResponse.addHeader(HttpHeader.CACHE_CONTROL, HttpHeader.NO_STORE); httpResponse.setHeader(HttpHeader.PRAGMA, HttpHeader.NO_CACHE); httpResponse....
java
{ "resource": "" }
q179872
EntryEndpoint.readMeta
test
public void readMeta() throws IOException, IllegalArgumentException, IllegalAccessException, FileNotFoundException, IllegalStateException { executeAndHandle(Request.Get(uri)); }
java
{ "resource": "" }
q179873
ResourceServlet.handleRequest
test
@Override protected void handleRequest(RequestContext context) throws ServletException, IOException { // for exceptions generated before response commit uses HttpServletResponse.sendError // on send error, servlet container prepares error response using container internal HTML for response body // if <error-...
java
{ "resource": "" }
q179874
TableFixture.tearDown
test
@Override public void tearDown() throws Exception { if (statement != null) { statement.close(); statement = null; } super.tearDown(); }
java
{ "resource": "" }
q179875
EventStreamManagerImpl.preDestroy
test
@Override public void preDestroy() { if (eventStreams.isEmpty()) { return; } // EventStream#close signals stream loop that breaks // as a consequence, EventStreamServlet ends current request processing and call this#closeEventStream // this#closeEventStream removes event stream from this#eventStr...
java
{ "resource": "" }
q179876
AbstractBlobView.handleAllowedMethods
test
protected void handleAllowedMethods() { endpoint.isDownloadAllowed().ifPresent(this::setDownloadEnabled); endpoint.isUploadAllowed().ifPresent(this::setUploadEnabled); endpoint.isDeleteAllowed().ifPresent(this::setDeleteEnabled); }
java
{ "resource": "" }
q179877
AbstractBlobView.upload
test
protected void upload() { try { onUpload(); eventBus.post(new BlobUploadEvent(endpoint)); Notification.show("Success", "Upload complete", Notification.Type.TRAY_NOTIFICATION); } catch (IOException | IllegalArgumentException | IllegalAccessException | IllegalStateExcep...
java
{ "resource": "" }
q179878
AbstractBlobView.delete
test
protected void delete() { String question = "Are you sure you want to delete the data from the server?"; ConfirmDialog.show(getUI(), question, new ConfirmDialog.Listener() { @Override public void onClose(ConfirmDialog cd) { if (cd.isConfirmed()) { ...
java
{ "resource": "" }
q179879
Fixture.extractColumnParameters
test
protected String[] extractColumnParameters(FitRow row) { final List<String> result = new ArrayList<>(); for (FitCell cell : row.cells()) { result.add(FitUtils.extractCellParameter(cell)); } return result.toArray(new String[result.size()]); }
java
{ "resource": "" }
q179880
Fixture.getArgNames
test
protected String[] getArgNames() { if (args == null) { return new String[]{}; } return args.keySet().toArray(new String[args.keySet().size()]); }
java
{ "resource": "" }
q179881
Timer.period
test
public synchronized void period(final PeriodicTask periodicTask, long period) { TimerTask task = new PeriodicTaskImpl(periodicTask); this.tasks.put(periodicTask, task); this.timer.schedule(task, 0L, period); }
java
{ "resource": "" }
q179882
Timer.timeout
test
public synchronized void timeout(final TimeoutTask timeoutTask, long timeout) { TimerTask task = this.tasks.get(timeoutTask); if (task != null) { task.cancel(); this.tasks.values().remove(task); } task = new TimeoutTaskImpl(timeoutTask); this.tasks.put(timeoutTask, task); this.timer.schedule(t...
java
{ "resource": "" }
q179883
ViewManagerImpl.config
test
@Override public void config(Config config) throws ConfigException, IOException { for (Config repositorySection : config.findChildren("repository")) { // view manager configuration section is named <views> // a <views> configuration section has one or many <repository> child sections // scan every repo...
java
{ "resource": "" }
q179884
RecursiveFileSelector.next
test
@Override public final File next() { if (files == null || fileIndex >= files.length) { if (!cacheNext()) { throw new NoSuchElementException(); } } return files[fileIndex++]; }
java
{ "resource": "" }
q179885
Launcher.configureApplication
test
private static void configureApplication() { // Try to load the file. File file = new File("chameria.props"); if (file.exists()) { Properties props = new Properties(); InputStream is = null; try { is = new FileInputStream(file); ...
java
{ "resource": "" }
q179886
Launcher.printWelcomeBanner
test
private static void printWelcomeBanner() { StringBuffer banner = new StringBuffer(); banner.append("\n"); banner.append("\t============================\n"); banner.append("\t| |\n"); banner.append("\t| Welcome to ChameRIA |\n"); banner.append...
java
{ "resource": "" }
q179887
Launcher.printStoppedBanner
test
private static void printStoppedBanner() { System.out.println("\n"); System.out.println("\t========================="); System.out.println("\t| ChameRIA stopped |"); System.out.println("\t========================="); System.out.println("\n"); }
java
{ "resource": "" }
q179888
Launcher.createChameleon
test
public static ChameRIA createChameleon(String[] args) throws Exception { boolean debug = isDebugModeEnabled(args); String core = getCore(args); String app = getApp(args); String runtime = getRuntime(args); String fileinstall = getDeployDirectory(args); String config = get...
java
{ "resource": "" }
q179889
Launcher.registerShutdownHook
test
private static void registerShutdownHook(final ChameRIA chameleon) { Runtime runtime = Runtime.getRuntime(); Runnable hook = new Runnable() { public void run() { try { if (chameleon != null) { chameleon.stop(); ...
java
{ "resource": "" }
q179890
ActionView.trigger
test
public void trigger() { try { onTrigger(); Notification.show(getCaption(), "Successful.", Notification.Type.TRAY_NOTIFICATION); } catch (IOException | IllegalArgumentException | IllegalAccessException | IllegalStateException ex) { onError(ex); } }
java
{ "resource": "" }
q179891
ActionView.onTrigger
test
protected void onTrigger() throws IOException, IllegalArgumentException, IllegalAccessException, FileNotFoundException, IllegalStateException { endpoint.trigger(); eventBus.post(new TriggerEvent(endpoint)); }
java
{ "resource": "" }
q179892
FitParseResult.insertAndReplace
test
public void insertAndReplace(final FitRow row) { if (results.isEmpty()) { return; } int index = row.getIndex(); FitTable table = row.getTable(); table.remove(index); addRows(table, index); }
java
{ "resource": "" }
q179893
FitParseResult.getCounts
test
public Counts getCounts() { Counts counts = new Counts(); for (FileCount fileCount : results) { counts.tally(fileCount.getCounts()); } return counts; }
java
{ "resource": "" }
q179894
Summary.setScore
test
public void setScore(double v) { if (Summary_Type.featOkTst && ((Summary_Type)jcasType).casFeat_score == null) jcasType.jcas.throwFeatMissing("score", "edu.cmu.lti.oaqa.type.answer.Summary"); jcasType.ll_cas.ll_setDoubleValue(addr, ((Summary_Type)jcasType).casFeatCode_score, v);}
java
{ "resource": "" }
q179895
Summary.getVariants
test
public StringList getVariants() { if (Summary_Type.featOkTst && ((Summary_Type)jcasType).casFeat_variants == null) jcasType.jcas.throwFeatMissing("variants", "edu.cmu.lti.oaqa.type.answer.Summary"); return (StringList)(jcasType.ll_cas.ll_getFSForRef(jcasType.ll_cas.ll_getRefValue(addr, ((Summary_Type)jcas...
java
{ "resource": "" }
q179896
Summary.setVariants
test
public void setVariants(StringList v) { if (Summary_Type.featOkTst && ((Summary_Type)jcasType).casFeat_variants == null) jcasType.jcas.throwFeatMissing("variants", "edu.cmu.lti.oaqa.type.answer.Summary"); jcasType.ll_cas.ll_setRefValue(addr, ((Summary_Type)jcasType).casFeatCode_variants, jcasType.ll_cas.l...
java
{ "resource": "" }
q179897
Question.getQuestionType
test
public String getQuestionType() { if (Question_Type.featOkTst && ((Question_Type)jcasType).casFeat_questionType == null) jcasType.jcas.throwFeatMissing("questionType", "edu.cmu.lti.oaqa.type.input.Question"); return jcasType.ll_cas.ll_getStringValue(addr, ((Question_Type)jcasType).casFeatCode_questionType...
java
{ "resource": "" }
q179898
Question.setQuestionType
test
public void setQuestionType(String v) { if (Question_Type.featOkTst && ((Question_Type)jcasType).casFeat_questionType == null) jcasType.jcas.throwFeatMissing("questionType", "edu.cmu.lti.oaqa.type.input.Question"); jcasType.ll_cas.ll_setStringValue(addr, ((Question_Type)jcasType).casFeatCode_questionType,...
java
{ "resource": "" }
q179899
Focus.getToken
test
public Token getToken() { if (Focus_Type.featOkTst && ((Focus_Type)jcasType).casFeat_token == null) jcasType.jcas.throwFeatMissing("token", "edu.cmu.lti.oaqa.type.nlp.Focus"); return (Token)(jcasType.ll_cas.ll_getFSForRef(jcasType.ll_cas.ll_getRefValue(addr, ((Focus_Type)jcasType).casFeatCode_token)));}
java
{ "resource": "" }