auphong2707/dl4se-code-review-dataset huggingface dataset:
Source:
public InputArgument(Block block) { inputText = new SimpleStringProperty("-"); this.loadFXML("InputArgument"); errorImage = new ImageView(new Image(this.getClass().getResourceAsStream("/ui/warningTriangle.png"))); inputAnchor = new InputAnchor(block); inputAnchor.layoutXProperty().bind(inputLabel.widthProperty().divide(2)); inputAnchor.errorStateProperty().addListener(this::checkError); double height = inputAnchor.getVisibleAnchor().getBoundsInLocal().getHeight(); double width = inputAnchor.getVisibleAnchor().getBoundsInLocal().getWidth(); errorImage.setFitHeight(height); errorImage.setFitWidth(width); errorImage.layoutXProperty().bind(inputAnchor.layoutXProperty().subtract(width / 2 - 0.5)); errorImage.layoutYProperty().bind(inputAnchor.layoutYProperty().subtract(height / 2 - 0.5)); errorImage.setMouseTransparent(true); inputLabel.layoutYProperty().bind(this.heightProperty().divide(2).subtract(inputLabel.heightProperty().divide(2))); this.setPrefHeight(ArgumentSpace.HEIGHT); this.getChildren().add(inputAnchor); this.getChildren().add(errorImage); setError(false); }

Target:
public InputArgument(Block block) { this.inputText = new SimpleStringProperty("-"); this.loadFXML("InputArgument"); this.errorImage = new ImageView(new Image(this.getClass().getResourceAsStream("/ui/warningTriangle.png"))); this.inputAnchor = new InputAnchor(block); this.inputAnchor.layoutXProperty().bind(this.inputLabel.widthProperty().divide(2)); this.inputAnchor.errorStateProperty().addListener(this::checkError); double height = this.inputAnchor.getVisibleAnchor().getBoundsInLocal().getHeight(); double width = this.inputAnchor.getVisibleAnchor().getBoundsInLocal().getWidth(); this.errorImage.setFitHeight(height); this.errorImage.setFitWidth(width); this.errorImage.layoutXProperty().bind(this.inputAnchor.layoutXProperty().subtract(width / 2 - 0.5)); this.errorImage.layoutYProperty().bind(this.inputAnchor.layoutYProperty().subtract(height / 2 - 0.5)); this.errorImage.setMouseTransparent(true); this.inputLabel.layoutYProperty().bind(this.heightProperty().divide(2).subtract(this.inputLabel.heightProperty().divide(2))); this.setPrefHeight(ArgumentSpace.HEIGHT); this.getChildren().add(this.inputAnchor); this.getChildren().add(this.errorImage); this.setError(false); }
Source:
public void addTtyDev(String ttyDev) { TtyDev dev = new TtyDev(ttyDev); if (!this.ttyDevs.contains(dev)) { this.ttyDevs.add(new TtyDev(ttyDev)); Collections.sort(this.ttyDevs, new TtyDevComparator()); } }

Target:
public void addTtyDev(String ttyDev) { addTtyDev(ttyDev, null); }
Source:
public Date date() throws IOException { try { return new JdbcSession(this.sql.source()) .sql("SELECT date FROM attachment WHERE bout = ? AND name = ?") .set(this.bout) .set(this.label) .select( new Outcome<Date>() { @Override public Date handle( final ResultSet rset, final Statement stmt ) throws SQLException { rset.next(); return new Date(rset.getTimestamp(1).getTime()); } } ); } catch (final SQLException ex) { throw new IOException(ex); } }

Target:
public Date date() throws IOException { try { return new JdbcSession(this.sql.source()) .sql("SELECT date FROM attachment WHERE bout = ? AND name = ?") .set(this.bout) .set(this.label) .select( new Outcome<Date>() { @Override public Date handle(final ResultSet rset, final Statement stmt) throws SQLException { rset.next(); return new Date(rset.getTimestamp(1).getTime()); } } ); } catch (final SQLException ex) { throw new IOException( String.format("Can't fetch date from bout #%d", this.bout), ex ); } }
Source:
public MatchResult matcher(HttpServletRequest request) { if (this.method != null && !this.method.name().equals(request.getMethod())) { return MatchResult.notMatch(); } if (this.servletPath != null && !this.servletPath.equals(request.getServletPath())) { return MatchResult.notMatch(); } MatchableHandlerMapping mapping = getMapping(request); if (mapping == null) { return this.defaultMatcher.matcher(request); } RequestMatchResult result = mapping.match(request, this.pattern); return (result != null) ? MatchResult.match(result.extractUriTemplateVariables()) : MatchResult.notMatch(); }

Target:
public MatchResult matcher(HttpServletRequest request) { if (notMatchMethodOrServletPath(request)) { return MatchResult.notMatch(); } MatchableHandlerMapping mapping = getMapping(request); if (mapping == null) { return this.defaultMatcher.matcher(request); } RequestMatchResult result = mapping.match(request, this.pattern); return (result != null) ? MatchResult.match(result.extractUriTemplateVariables()) : MatchResult.notMatch(); }
Source:
public Mono<Void> deleteById(Publisher<ID> id) { Assert.notNull(id, "Id must not be null!"); return Flux.from(id) .map(this::convertId) .collectList() .map(objects -> { return new StringQuery(QueryBuilders.idsQuery() .addIds(objects.toArray(new String[0])) .toString()); }) .flatMap(query -> { return elasticsearchOperations .deleteBy(query, entityInformation.getJavaType(), entityInformation.getIndexCoordinates()); }) .then(); }

Target:
public Mono<Void> deleteById(Publisher<ID> id) { Assert.notNull(id, "Id must not be null!"); return Mono.from(id).flatMap(this::deleteById); }
Source:
public synchronized void setSystemVmTmpltPermission(String mountPoint) { if (!s_isSystemVmTmpltPermissionSet) { s_logger.debug("Set permissions for " + mountPoint); String result = null; Script script = new Script(true, "chmod", _timeout, s_logger); script.add("-R", "0777", mountPoint); result = script.execute(); if (result != null) { s_logger.warn("Unable to set permissions for " + mountPoint + " due to " + result); } else { s_isSystemVmTmpltPermissionSet = true; } } }

Target:
public synchronized void setSystemVmTmpltPermission(String mountPoint) { if (!s_isSystemVmTmpltPermissionSet) { s_logger.debug("Set permissions for " + mountPoint); String result = null; Script script = new Script(true, "chmod", _timeout, s_logger); script.add("-R", TemplateConstants.VMWARE_SYSTEM_VM_TMPLT_PERMISSIONS, mountPoint); result = script.execute(); if (result != null) { s_logger.warn("Unable to set permissions for " + mountPoint + " due to " + result); } else { s_isSystemVmTmpltPermissionSet = true; } } }
Source:
private static ExecutorService createExecutor(CassandraKeyValueServiceConfig config) { int numServers = config.servers().size(); return PTExecutors.newThreadPoolExecutor( config.poolSize() * numServers, config.maxConnectionBurstSize() * numServers, 1, TimeUnit.MINUTES, new ArrayBlockingQueue<Runnable>(1) { @Override public boolean offer(Runnable runnable) { return false; } @Override public boolean offer(Runnable runnable, long timeout, TimeUnit unit) { return false; } }, new NamedThreadFactory("Atlas Cassandra KVS", false), new ThreadPoolExecutor.CallerRunsPolicy()); }

Target:
private static ExecutorService createExecutor(CassandraKeyValueServiceConfig config) { int numServers = config.servers().size(); ThreadPoolExecutor executor = PTExecutors.newThreadPoolExecutor( config.poolSize() * numServers, config.maxConnectionBurstSize() * numServers, 1, TimeUnit.MINUTES, new ArrayBlockingQueue<Runnable>(1) { @Override public boolean offer(Runnable runnable) { return false; } @Override public boolean offer(Runnable runnable, long timeout, TimeUnit unit) { return false; } }, new NamedThreadFactory("Atlas Cassandra KVS", false), new ThreadPoolExecutor.CallerRunsPolicy()); return new InstrumentedExecutorService(executor, AtlasDbMetrics.getMetricRegistry(), "atlasdb-cassandra-kvs"); }
Source:
private synchronized void updateTaskStatus(TaskStatus taskStatus) { try { StageState stageState = getState(); if (stageState.isDone()) { return; } TaskState taskState = taskStatus.getState(); if (taskState == TaskState.FAILED) { RuntimeException failure = taskStatus.getFailures().stream() .findFirst() .map(this::rewriteTransportFailure) .map(ExecutionFailureInfo::toException) .orElse(new PrestoException(GENERIC_INTERNAL_ERROR, "A task failed for an unknown reason")); if (stageTaskRecoveryCallback.isPresent() && taskStatus.getFailures().stream().allMatch(SqlStageExecution::isRecoverableFailure)) { failedTasks.add(taskStatus.getTaskId()); try { if (!stageTaskRecoveryCallback.get().recover(taskStatus.getTaskId())) { stateMachine.transitionToFailed(failure); } } catch (RuntimeException e) { stateMachine.transitionToFailed(failure); } } else { stateMachine.transitionToFailed(failure); } } else if (taskState == TaskState.ABORTED) { stateMachine.transitionToFailed(new PrestoException(GENERIC_INTERNAL_ERROR, "A task is in the ABORTED state but stage is " + stageState)); } else if (taskState == TaskState.FINISHED) { finishedTasks.add(taskStatus.getTaskId()); } if (stageState == StageState.SCHEDULED || stageState == StageState.RUNNING) { if (taskState == TaskState.RUNNING) { stateMachine.transitionToRunning(); } if (union(finishedTasks, failedTasks).containsAll(allTasks)) { stateMachine.transitionToFinished(); } } } finally { checkAllTaskFinal(); } }

Target:
private synchronized void updateTaskStatus(TaskStatus taskStatus) { try { StageState stageState = getState(); if (stageState.isDone()) { return; } TaskState taskState = taskStatus.getState(); if (taskState == TaskState.FAILED) { RuntimeException failure = taskStatus.getFailures().stream() .findFirst() .map(this::rewriteTransportFailure) .map(ExecutionFailureInfo::toException) .orElse(new PrestoException(GENERIC_INTERNAL_ERROR, "A task failed for an unknown reason")); if (isRecoverable(taskStatus.getFailures())) { try { stageTaskRecoveryCallback.get().recover(taskStatus.getTaskId()); finishedTasks.add(taskStatus.getTaskId()); failedTasks.add(taskStatus.getTaskId()); } catch (Throwable t) { failure.addSuppressed(new PrestoException(GENERIC_RECOVERY_ERROR, format("Encountered error when trying to recover task %s", taskStatus.getTaskId()), t)); stateMachine.transitionToFailed(failure); } } else { stateMachine.transitionToFailed(failure); } } else if (taskState == TaskState.ABORTED) { stateMachine.transitionToFailed(new PrestoException(GENERIC_INTERNAL_ERROR, "A task is in the ABORTED state but stage is " + stageState)); } else if (taskState == TaskState.FINISHED) { finishedTasks.add(taskStatus.getTaskId()); } if (stageState == StageState.SCHEDULED || stageState == StageState.RUNNING) { if (taskState == TaskState.RUNNING) { stateMachine.transitionToRunning(); } if (finishedTasks.containsAll(allTasks)) { stateMachine.transitionToFinished(); } } } finally { checkAllTaskFinal(); } }
Source:
private static boolean tryKubeConfig(Config config, String context) { LOGGER.debug("Trying to configure client from Kubernetes config..."); if (!Utils.getSystemPropertyOrEnvVar(KUBERNETES_AUTH_TRYKUBECONFIG_SYSTEM_PROPERTY, true)) { return false; } File kubeConfigFile = new File(getKubeconfigFilename()); if (!kubeConfigFile.isFile()) { LOGGER.debug("Did not find Kubernetes config at: ["+kubeConfigFile.getPath()+"]. Ignoring."); return false; } LOGGER.debug("Found for Kubernetes config at: [{}].", kubeConfigFile.getPath()); String kubeconfigContents = getKubeconfigContents(kubeConfigFile); if (kubeconfigContents == null) { return false; } loadFromKubeconfig(config, context, kubeconfigContents, kubeConfigFile.getPath()); return true; }

Target:
private static boolean tryKubeConfig(Config config, String context) { LOGGER.debug("Trying to configure client from Kubernetes config..."); if (!Utils.getSystemPropertyOrEnvVar(KUBERNETES_AUTH_TRYKUBECONFIG_SYSTEM_PROPERTY, true)) { return false; } File kubeConfigFile = new File(getKubeconfigFilename()); if (!kubeConfigFile.isFile()) { LOGGER.debug("Did not find Kubernetes config at: [{}]. Ignoring.", kubeConfigFile.getPath()); return false; } LOGGER.debug("Found for Kubernetes config at: [{}].", kubeConfigFile.getPath()); String kubeconfigContents = getKubeconfigContents(kubeConfigFile); if (kubeconfigContents == null) { return false; } loadFromKubeconfig(config, context, kubeconfigContents, kubeConfigFile.getPath()); return true; }
Source:
public PlainTextVaultProvider(@Nonnull Path path, @Nonnull String realmName) { vaultPath = path; secretMappingFunction = (vaultDirectory, secretId) -> vaultDirectory.resolve(realmName + "__" + secretId); logger.debugf("PlainTextVaultProvider will operate in %s directory", vaultPath.toAbsolutePath().toString()); }

Target:
public PlainTextVaultProvider(@Nonnull Path path, @Nonnull String realmName) { this.vaultPath = path; this.realmName = realmName; logger.debugf("PlainTextVaultProvider will operate in %s directory", vaultPath.toAbsolutePath()); }
Source:
public AuditLogType getAuditLogTypeValue() { switch (getActionState()) { case EXECUTE: return getSucceeded() ? AuditLogType.USER_REMOVE_VM_FINISHED : (hasImages ? AuditLogType. USER_REMOVE_VM_FINISHED_WITH_ILLEGAL_DISKS : AuditLogType.USER_FAILED_REMOVE_VM); case END_FAILURE: case END_SUCCESS: default: return disksLeftInVm.isEmpty() ? AuditLogType.USER_REMOVE_VM_FINISHED : AuditLogType.USER_REMOVE_VM_FINISHED_WITH_ILLEGAL_DISKS; } }

Target:
public AuditLogType getAuditLogTypeValue() { switch (getActionState()) { case EXECUTE: return getSucceeded() ? AuditLogType.USER_REMOVE_VM_FINISHED : (hasImages ? AuditLogType. USER_REMOVE_VM_FINISHED_WITH_ILLEGAL_DISKS : AuditLogType.USER_FAILED_REMOVE_VM); case END_FAILURE: case END_SUCCESS: default: return disksLeftInVm.isEmpty() ? AuditLogType.UNASSIGNED : AuditLogType.USER_REMOVE_VM_FINISHED_WITH_ILLEGAL_DISKS; } }
Source:
public static <T> CollectionStream<T> empty(String systemName, String streamName) { Preconditions.checkNotNull(systemName); Preconditions.checkNotNull(streamName); return new CollectionStream<>(systemName, streamName, 1); }

Target:
public static <T> CollectionStream<T> empty(String systemName, String streamName) { return new CollectionStream<>(systemName, streamName, 1); }
Source:
@Override protected void executeVdsBrokerCommand() { log.info("-- executeIrsBrokerCommand: calling an image action command. parameters:"); log.info("++ spId={}", getParameters().getStoragePoolId()); log.info("++ sdId={}", getParameters().getStorageDomainId()); log.info("++ image group Id={}", getParameters().getImageGroupId()); log.info("++ image Id={}", getParameters().getImageId()); status = executeImageActionVdsBrokerCommand( getParameters().getStoragePoolId().toString(), getParameters().getStorageDomainId().toString(), getParameters().getImageGroupId().toString(), getParameters().getImageId().toString()); proceedProxyReturnValue(); setReturnValue(status); }

Target:
@Override protected void executeVdsBrokerCommand() { status = executeImageActionVdsBrokerCommand( getParameters().getStoragePoolId().toString(), getParameters().getStorageDomainId().toString(), getParameters().getImageGroupId().toString(), getParameters().getImageId().toString()); proceedProxyReturnValue(); setReturnValue(status); }
Source:
default Value.Immutable<Double> eyeHeight() { return this.requireValue(Keys.EYE_HEIGHT).asImmutable(); }

Target:
default Value<Double> eyeHeight() { return this.requireValue(Keys.EYE_HEIGHT); }
Source:
public synchronized void flush() { JSONObject mlsObj; int wifiCount = 0; int cellCount = 0; if (mBundle == null) { return; } try { mlsObj = mBundle.toMLSJSON(); wifiCount = mlsObj.getInt(DataStorageContract.ReportsColumns.WIFI_COUNT); cellCount = mlsObj.getInt(DataStorageContract.ReportsColumns.CELL_COUNT); } catch (JSONException e) { Log.w(LOG_TAG, "Failed to convert bundle to JSON: " + e); return; } if (AppGlobals.isDebug) { Log.d(LOG_TAG, "Received bundle: " + mlsObj.toString()); } if (wifiCount + cellCount < 1) return; mPreviousBundleJSON = mlsObj; AppGlobals.guiLogInfo(mlsObj.toString()); try { DataStorageManager.getInstance().insert(mlsObj.toString(), wifiCount, cellCount); } catch (IOException e) { Log.w(LOG_TAG, e.toString()); } }

Target:
public synchronized void flush() { JSONObject mlsObj; int wifiCount = 0; int cellCount = 0; if (mBundle == null) { return; } try { mlsObj = mBundle.toMLSJSON(); wifiCount = mlsObj.getInt(DataStorageContract.ReportsColumns.WIFI_COUNT); cellCount = mlsObj.getInt(DataStorageContract.ReportsColumns.CELL_COUNT); } catch (JSONException e) { Log.w(LOG_TAG, "Failed to convert bundle to JSON: " + e); return; } if (AppGlobals.isDebug) { Log.d(LOG_TAG, "Received bundle: " + mlsObj.toString()); } if (wifiCount + cellCount < 1) { return; } mPreviousBundleJSON = mlsObj; AppGlobals.guiLogInfo(mlsObj.toString()); try { DataStorageManager.getInstance().insert(mlsObj.toString(), wifiCount, cellCount); } catch (IOException e) { Log.w(LOG_TAG, e.toString()); } }
Source:
public void testValidateNameSizeImportAsCloned() { checkVmName(true, StringUtils.repeat("aA0._", 60)); }

Target:
public void testValidateNameSizeImportAsCloned() { checkVmName(true, RandomUtils.instance().nextNameString(300)); }
Source:
private void resumeIfPossible(File uploadFile, String objectId, String md5, boolean checksum) { UploadProgress progress = null; try { progress = checkProgress(uploadFile, objectId); } catch (NotRetryableException e) { log.info("No upload id found for object id {}. Start new upload.", objectId); startUpload(uploadFile, objectId, md5, true); return; } resume(uploadFile, progress, objectId, checksum); }

Target:
private void resumeIfPossible(File uploadFile, String objectId, String md5, boolean checksum) { try { val progress = checkProgress(uploadFile, objectId); resume(uploadFile, progress, objectId, checksum); } catch (NotRetryableException e) { log.info("No upload id found for object id {}. Start new upload.", objectId); startUpload(uploadFile, objectId, md5, true); return; } }
Source:
private static String getRequestParameterValue(MutableHttpServletRequest mutableRequest, String key) throws InterceptorException { if (StringUtils.isEmpty(key)) { throw new InterceptorException("Missing parameter key"); } String value = StringUtils.EMPTY; Map<String, String[]> queryParams = mutableRequest.getParameterMap(); if (!queryParams.isEmpty()) { TreeMap<String, String[]> params = new TreeMap<String, String[]>( String.CASE_INSENSITIVE_ORDER); params.putAll(queryParams); if (params.containsKey(key)) { value = StringUtils.join(params.get(key), ";"); } } else { String xml = OgcXmlUtil.getRequestBody(mutableRequest); if (!StringUtils.isEmpty(xml)) { Document document = OgcXmlUtil.getDocumentFromString(xml); if (key.equalsIgnoreCase(OgcNaming.PARAMETER_SERVICE)) { value = OgcXmlUtil.getPathInDocument( document, "/*/@service"); } else if (key.equalsIgnoreCase(OgcNaming.PARAMETER_OPERATION)) { value = OgcXmlUtil.getPathInDocument( document, "name(/*)"); if (value.contains(":")) { value = value.split(":")[1]; } } else if (Arrays.asList(OgcNaming.PARAMETER_ENDPOINT).contains(key)) { value = OgcXmlUtil.getPathInDocument( document, " if (StringUtils.isEmpty(value)) { value = OgcXmlUtil.getPathInDocument(document, " } } } else { LOG.error("No body found"); } } return value; }

Target:
private static String getRequestParameterValue(MutableHttpServletRequest mutableRequest, String key) throws InterceptorException, IOException { if (StringUtils.isEmpty(key)) { throw new InterceptorException("Missing parameter key"); } String value = StringUtils.EMPTY; Map<String, String[]> queryParams = mutableRequest.getParameterMap(); if (!queryParams.isEmpty()) { Map<String, String[]> params = new TreeMap<String, String[]>( String.CASE_INSENSITIVE_ORDER); params.putAll(queryParams); if (params.containsKey(key)) { value = StringUtils.join(params.get(key), ","); } } else { String xml = OgcXmlUtil.getRequestBody(mutableRequest); if (!StringUtils.isEmpty(xml)) { Document document = OgcXmlUtil.getDocumentFromString(xml); if (key.equalsIgnoreCase(OgcNaming.PARAMETER_SERVICE)) { value = OgcXmlUtil.getPathInDocument( document, "/*/@service"); } else if (key.equalsIgnoreCase(OgcNaming.PARAMETER_OPERATION)) { value = OgcXmlUtil.getPathInDocument( document, "name(/*)"); if (value.contains(":")) { value = value.split(":")[1]; } } else if (Arrays.asList(OgcNaming.PARAMETER_ENDPOINT).contains(key)) { value = OgcXmlUtil.getPathInDocument( document, " if (StringUtils.isEmpty(value)) { value = OgcXmlUtil.getPathInDocument(document, " } } } else { LOG.error("No body found"); } } return value; }
Source:
public GroupByHashPageIndexer(List<? extends Type> hashTypes, JoinCompiler joinCompiler) { this(GroupByHash.createGroupByHash( hashTypes, IntStream.range(0, hashTypes.size()).toArray(), Optional.empty(), 20, false, joinCompiler, x -> true)); }

Target:
public GroupByHashPageIndexer(List<? extends Type> hashTypes, JoinCompiler joinCompiler) { this(GroupByHash.createGroupByHash( hashTypes, IntStream.range(0, hashTypes.size()).toArray(), Optional.empty(), 20, false, joinCompiler, NOOP)); }
Source:
protected boolean parametersResolveToSameTypes(Method subTypeMethod, Method superTypeMethod) { if (subTypeMethod.getParameterTypes().length == 0) { return true; } ResolvedType resolvedSubType = typeResolver.resolve(subTypeMethod.getDeclaringClass()); MemberResolver memberResolver = new MemberResolver(typeResolver); memberResolver.setMethodFilter(new SimpleMethodFilter(subTypeMethod, superTypeMethod)); final ResolvedTypeWithMembers typeWithMembers = memberResolver.resolve(resolvedSubType, null, null); ResolvedMethod[] resolvedMethods = new ResolvedMethod[0]; try { if (System.getSecurityManager() == null) { resolvedMethods = typeWithMembers.getMemberMethods(); } else { resolvedMethods = AccessController.doPrivileged(new PrivilegedExceptionAction<ResolvedMethod[]>() { @Override public ResolvedMethod[] run() throws Exception { return typeWithMembers.getMemberMethods(); } }); } } catch (PrivilegedActionException pae) { LogMessages.LOGGER.error(pae.getMessage()); } if (resolvedMethods.length == 1) { return true; } for (int i = 0; i < resolvedMethods[0].getArgumentCount(); i++) { if (!resolvedMethods[0].getArgumentType(i).equals(resolvedMethods[1].getArgumentType(i))) { return false; } } return true; }

Target:
protected boolean parametersResolveToSameTypes(Method subTypeMethod, Method superTypeMethod) { if (subTypeMethod.getParameterTypes().length == 0) { return true; } ResolvedType resolvedSubType = typeResolver.resolve(subTypeMethod.getDeclaringClass()); MemberResolver memberResolver = new MemberResolver(typeResolver); memberResolver.setMethodFilter(new SimpleMethodFilter(subTypeMethod, superTypeMethod)); final ResolvedTypeWithMembers typeWithMembers = memberResolver.resolve(resolvedSubType, null, null); ResolvedMethod[] resolvedMethods = new ResolvedMethod[0]; try { if (System.getSecurityManager() == null) { resolvedMethods = typeWithMembers.getMemberMethods(); } else { resolvedMethods = AccessController.doPrivileged(new PrivilegedExceptionAction<ResolvedMethod[]>() { @Override public ResolvedMethod[] run() throws Exception { return typeWithMembers.getMemberMethods(); } }); } } catch (PrivilegedActionException pae) { throw new ResteasyViolationException(pae.getMessage()); } if (resolvedMethods.length == 1) { return true; } for (int i = 0; i < resolvedMethods[0].getArgumentCount(); i++) { if (!resolvedMethods[0].getArgumentType(i).equals(resolvedMethods[1].getArgumentType(i))) { return false; } } return true; }
Source:
private void testRefreshToolsByOrg1() throws IOException { String url = usersURLPrefix + "/containers/dockstore2/refresh"; List<Tool> tools = clientHelperTool(url); assertThat(tools.size()).isGreaterThanOrEqualTo(4); }

Target:
private void testRefreshToolsByOrg1() throws IOException { String url = usersURLPrefix + "/containers/dockstore2/refresh"; List<Tool> tools = clientHelperTool(url); assertThat(tools.size() - previousTools.size()).isEqualTo(0); tools.removeIf(tool -> previousToolsHaveName(tool.getName())); assertThat(tools.size()).isEqualTo(0); }
Source:
private ArrayList<LogicalWindow> createPanes(PaneConfig config) { ArrayList<LogicalWindow> results = new ArrayList<>(); JsArrayString panes = config.getQuadrants(); for (int i = 0; i < 4; i++) { results.add(panesByName_.get(panes.get(i))); } return results; }

Target:
private ArrayList<LogicalWindow> createPanes(PaneConfig config) { ArrayList<LogicalWindow> results = new ArrayList<>(); JsArrayString panes = config.getQuadrants(); for (int i = 0; i < panes.length(); i++) { if (StringUtil.equals(panes.get(i), "HiddenTabSet")) continue; results.add(panesByName_.get(panes.get(i))); } return results; }
Source:
public Result execStatement( String rawsql, RowMetaInterface params, Object[] data ) throws KettleDatabaseException { Result result = new Result(); String sql = databaseMeta.getDatabaseInterface().createSqlScriptParser().removeComments( rawsql ).trim(); try { String sqlStripped = databaseMeta.stripCR( sql ); Statement stmt; if ( params != null ) { stmt = connection.prepareStatement( sqlStripped ); setValues( params, data, (PreparedStatement)stmt ); } else { stmt = connection.createStatement(); } boolean resultSet = stmt.execute( sqlStripped ); int count = stmt.getUpdateCount(); stmt.close(); while (stmt.getMoreResults()) stmt.close(); String upperSql = sql.toUpperCase(); if ( !resultSet ) { if ( count > 0 ) { if ( upperSql.startsWith( "INSERT" ) ) { result.setNrLinesOutput( count ); } else if ( upperSql.startsWith( "UPDATE" ) ) { result.setNrLinesUpdated( count ); } else if ( upperSql.startsWith( "DELETE" ) ) { result.setNrLinesDeleted( count ); } } } if ( upperSql.startsWith( "ALTER TABLE" ) || upperSql.startsWith( "DROP TABLE" ) || upperSql.startsWith( "CREATE TABLE" ) ) { DBCache.getInstance().clear( databaseMeta.getName() ); } } catch ( SQLException ex ) { throw new KettleDatabaseException( "Couldn't execute SQL: " + sql + Const.CR, ex ); } catch ( Exception e ) { throw new KettleDatabaseException( "Unexpected error executing SQL: " + Const.CR, e ); } return result; }

Target:
public Result execStatement( String rawsql, RowMetaInterface params, Object[] data ) throws KettleDatabaseException { Result result = new Result(); String sql = databaseMeta.getDatabaseInterface().createSqlScriptParser().removeComments( rawsql ).trim(); try { String sqlStripped = databaseMeta.stripCR( sql ); Statement stmt; if ( params != null ) { stmt = connection.prepareStatement( sqlStripped ); setValues( params, data, (PreparedStatement)stmt ); } else { stmt = connection.createStatement(); } boolean resultSet = stmt.execute( sqlStripped ); int count = stmt.getUpdateCount(); while (stmt.getMoreResults()) stmt.close(); String upperSql = sql.toUpperCase(); if ( !resultSet ) { if ( count > 0 ) { if ( upperSql.startsWith( "INSERT" ) ) { result.setNrLinesOutput( count ); } else if ( upperSql.startsWith( "UPDATE" ) ) { result.setNrLinesUpdated( count ); } else if ( upperSql.startsWith( "DELETE" ) ) { result.setNrLinesDeleted( count ); } } } if ( upperSql.startsWith( "ALTER TABLE" ) || upperSql.startsWith( "DROP TABLE" ) || upperSql.startsWith( "CREATE TABLE" ) ) { DBCache.getInstance().clear( databaseMeta.getName() ); } } catch ( SQLException ex ) { throw new KettleDatabaseException( "Couldn't execute SQL: " + sql + Const.CR, ex ); } catch ( Exception e ) { throw new KettleDatabaseException( "Unexpected error executing SQL: " + Const.CR, e ); } return result; }
Source:
public void testENG15273() throws Exception { final VoltDB.Configuration config = new VoltDB.Configuration(); final String ddl = "CREATE TABLE R21 (\n" + "ID INTEGER NOT NULL,\n" + "POLYGON GEOGRAPHY,\n" + "PRIMARY KEY (ID)\n" + ");\n" + "CREATE INDEX IDX_R21_POLY ON R21 (POLYGON);\n"; createSchema(config, ddl, 2, 1, 0); startSystem(config); Stream.of( "insert into R21 (ID) values -9355;", "CREATE VIEW DV1 (POLYGON) AS SELECT MIN(POLYGON) FROM R21;", "insert into R21 (ID, POLYGON) values 84, PolygonFromText('POLYGON((0.0 0.0, 0.0 -64.0, 51.0 0.0, 0.0 0.0))');", "UPDATE R21 SET POLYGON = POLYGON;") .forEachOrdered(stmt -> { try { m_client.callProcedure("@AdHoc", stmt); } catch (IOException | ProcCallException e) { fail("Query \"" + stmt + "\" should have worked fine"); } }); }

Target:
public void testENG15273() throws Exception { final VoltDB.Configuration config = new VoltDB.Configuration(); final String ddl = "CREATE TABLE R21 (\n" + "ID INTEGER NOT NULL,\n" + "POLYGON GEOGRAPHY,\n" + "PRIMARY KEY (ID)\n" + ");\n" + "CREATE INDEX IDX_R21_POLY ON R21 (POLYGON);\n"; try { createSchema(config, ddl, 2, 1, 0); startSystem(config); Stream.of( "insert into R21 (ID) values -9355;", "CREATE VIEW DV1 (POLYGON) AS SELECT MIN(POLYGON) FROM R21;", "insert into R21 (ID, POLYGON) values 84, PolygonFromText('POLYGON((0.0 0.0, 0.0 -64.0, 51.0 0.0, 0.0 0.0))');", "UPDATE R21 SET POLYGON = POLYGON;") .forEachOrdered(stmt -> { try { m_client.callProcedure("@AdHoc", stmt); } catch (IOException | ProcCallException e) { fail("Query \"" + stmt + "\" should have worked fine"); } }); } finally { try { teardownSystem(); } catch (Exception e) { } } }
Source:
protected static QemuImageInfo getQemuImageInfoFromVdsm(Guid storagePoolId, Guid newStorageDomainID, Guid newImageGroupId, Guid newImageId, Guid vdsId, boolean shouldPrepareAndTeardown) { if (vdsId == null) { vdsId = VdsCommandsHelper.getHostForExecution(storagePoolId, Collections.EMPTY_LIST); } QemuImageInfo qemuImageInfo = null; if (shouldPrepareAndTeardown) { prepareImage(storagePoolId, newStorageDomainID, newImageGroupId, newImageId, vdsId); } try { qemuImageInfo = (QemuImageInfo) Backend.getInstance() .getResourceManager() .runVdsCommand(VDSCommandType.GetQemuImageInfo, new GetVolumeInfoVDSCommandParameters(vdsId, storagePoolId, newStorageDomainID, newImageGroupId, newImageId)).getReturnValue(); } catch (Exception e) { log.error("Unable to get qemu image info from storage", e); } finally { if (shouldPrepareAndTeardown) { teardownImage(storagePoolId, newStorageDomainID, newImageGroupId, newImageId, vdsId); } } return qemuImageInfo; }

Target:
protected static QemuImageInfo getQemuImageInfoFromVdsm(Guid storagePoolId, Guid newStorageDomainID, Guid newImageGroupId, Guid newImageId, Guid vdsId, boolean shouldPrepareAndTeardown) { if (vdsId == null) { vdsId = VdsCommandsHelper.getHostForExecution(storagePoolId, Collections.emptyList()); } QemuImageInfo qemuImageInfo = null; if (shouldPrepareAndTeardown) { prepareImage(storagePoolId, newStorageDomainID, newImageGroupId, newImageId, vdsId); } try { qemuImageInfo = (QemuImageInfo) Backend.getInstance() .getResourceManager() .runVdsCommand(VDSCommandType.GetQemuImageInfo, new GetVolumeInfoVDSCommandParameters(vdsId, storagePoolId, newStorageDomainID, newImageGroupId, newImageId)).getReturnValue(); } catch (Exception e) { log.error("Unable to get qemu image info from storage", e); } finally { if (shouldPrepareAndTeardown) { teardownImage(storagePoolId, newStorageDomainID, newImageGroupId, newImageId, vdsId); } } return qemuImageInfo; }
Source:
public void updateSelection(LamiSelectionUpdateSignal signal) { if (fResultTable.hashCode() != signal.getSignalHash() || signal.getSource() == this) { return; } LamiTableContentProvider latencyContentProvider = (LamiTableContentProvider) getTableViewer().getContentProvider(); Set<Integer> selections = signal.getEntryIndex(); int[] selectionsIndexes = selections.stream() .map(index -> fResultTable.getEntries().get(index)) .mapToInt(entry -> latencyContentProvider.getIndexOf(entry)) .toArray(); fSelections = new HashSet<>(selections); if (fSelections.isEmpty()) { return; } Display.getDefault().asyncExec(() -> { getTableViewer().getTable().setSelection(selectionsIndexes); getTableViewer().getTable().redraw(); }); }

Target:
public void updateSelection(LamiSelectionUpdateSignal signal) { if (fResultTable.hashCode() != signal.getSignalHash() || equals(signal.getSource())) { return; } LamiTableContentProvider latencyContentProvider = (LamiTableContentProvider) getTableViewer().getContentProvider(); Set<Integer> selections = signal.getEntryIndex(); int[] selectionsIndexes = selections.stream() .map(index -> fResultTable.getEntries().get(index)) .mapToInt(entry -> latencyContentProvider.getIndexOf(entry)) .toArray(); fSelections = new HashSet<>(selections); if (fSelections.isEmpty()) { return; } Display.getDefault().asyncExec(() -> { getTableViewer().getTable().setSelection(selectionsIndexes); getTableViewer().getTable().redraw(); }); }
Source:
private void sendRedirect(HttpServletRequest request, HttpServletResponse response) throws IOException { if (!isAuthenticated()) { String requestURI = request.getRequestURI() + (Strings.hasText(request.getQueryString()) ? "?" + request.getQueryString() : ""); String encodedCurrentUrlString = URLEncoder.encode(requestURI, "UTF-8"); response.sendRedirect(this.loginUri + "?next=" + encodedCurrentUrlString); response.setStatus(HttpStatus.SC_TEMPORARY_REDIRECT); } }

Target:
private void sendRedirect(HttpServletRequest request, HttpServletResponse response) throws IOException { if (!isAuthenticated()) { try { MediaType mediaType = ContentNegotiationResolver.INSTANCE.getContentType(request, response, supportedMediaTypes); if (MediaType.APPLICATION_JSON.equals(mediaType) && request.getRequestURI().startsWith(meUri)) { response.setStatus(HttpStatus.SC_UNAUTHORIZED); } else { loginPageRedirector.redirectToLoginPage(request, response); } } catch (UnresolvedMediaTypeException e) { log.error("Couldn't resolve media type: {}", e.getMessage(), e); } catch (Exception e) { throw new RuntimeException("Couldn't redirect to login", e); } } }
Source:
public ServiceDefinitions(Logger logger, TypeOracle typeOracle, GeneratorUtil generatorUtil) throws UnableToCompleteException { this.logger = logger; this.typeOracle = typeOracle; this.generatorUtil = generatorUtil; findAllServices(); }

Target:
ServiceDefinitions(Logger logger, TypeOracle typeOracle, GeneratorUtil generatorUtil) throws UnableToCompleteException { this.logger = logger; this.typeOracle = typeOracle; this.generatorUtil = generatorUtil; findAllServices(); }
Source:
protected void onCreate(Bundle savedInstanceState) { Timber.d("onCreate()"); super.onCreate(savedInstanceState); if (getIntent().hasExtra("com.ichi2.anki.reset_done")) { Timber.d("reset done"); reset_done = true; } if (Intent.ACTION_VIEW.equals(getIntent().getAction())) { Timber.d("onCreate() :: received Intent with action = %s", getIntent().getAction()); selectDeckFromExtra(); } startLoadingCollection(); }

Target:
protected void onCreate(Bundle savedInstanceState) { Timber.d("onCreate()"); super.onCreate(savedInstanceState); if (getIntent().hasExtra("com.ichi2.anki.SchedResetDone")) { mSchedResetDone = true; } if (Intent.ACTION_VIEW.equals(getIntent().getAction())) { Timber.d("onCreate() :: received Intent with action = %s", getIntent().getAction()); selectDeckFromExtra(); } startLoadingCollection(); }
Source:
public void showPrivacyPolicy(View v) { Utils.visitInExternalBrowser(this, Uri.parse(getString(R.string.privacy_policy_url))); }

Target:
public void showPrivacyPolicy(View v) { Utils.showPrivacyPolicy(this); }
Source:
public JwtConfigurer jwt() { if ( this.jwtConfigurer == null ) { ApplicationContext context = this.getBuilder().getSharedObject(ApplicationContext.class); this.jwtConfigurer = new JwtConfigurer(context); } return this.jwtConfigurer; }

Target:
public JwtConfigurer jwt() { if ( this.jwtConfigurer == null ) { this.jwtConfigurer = new JwtConfigurer(this.context); } return this.jwtConfigurer; }
Source:
public AuthenticationResult authenticateJDBCContext(Map<String, Object> context) { String user = (String) context.get("user"); String password = (String) context.get("password"); if (user == null || password == null) { return null; } if (checkCredentials(user, password.toCharArray())) { return new AuthenticationResult(user, name, name, null); } else { return null; } }

Target:
public AuthenticationResult authenticateJDBCContext(Map<String, Object> context) { String user = (String) context.get("user"); String password = (String) context.get("password"); if (user == null || password == null) { return null; } if (checkCredentials(user, password.toCharArray())) { return new AuthenticationResult(user, authorizerName, name, null); } else { return null; } }
Source:
public void testCaseWithoutLineWrapping() throws Exception { final DefaultConfiguration checkConfig = createCheckConfig(NoLineWrapCheck.class); final String[] expected = CommonUtils.EMPTY_STRING_ARRAY; verify(checkConfig, getPath("InputnolinewrapGood.java"), expected); }

Target:
public void testCaseWithoutLineWrapping() throws Exception { final DefaultConfiguration checkConfig = createCheckConfig(NoLineWrapCheck.class); final String[] expected = CommonUtils.EMPTY_STRING_ARRAY; verify(checkConfig, getPath("InputNoLineWrapGood.java"), expected); }
Source:
protected String[] getPropertyAliases(Loadable persister, int j) { String[] propertyColumnNames = persister.getPropertyColumnNames(j); if (propertyColumnNames!=null && propertyColumnNames.length==1 && propertyColumnNames[0]==null) { return new String[]{ persister.getPropertyNames()[j] }; } return propertyColumnNames; }

Target:
protected String[] getPropertyAliases(Loadable persister, int j) { String[] propertyColumnNames = persister.getPropertyColumnNames(j); if ( Arrays.equals( propertyColumnNames, new String[] { null } ) ) { return new String[]{ persister.getPropertyNames()[j] }; } return propertyColumnNames; }
Source:
public void close() throws IOException { if (resultHTable != null) { resultHTable.close(); } }

Target:
public void close() throws IOException { if (resultTable != null) { resultTable.close(); } if (indexTable != null) { indexTable.close(); } }
Source:
public SimpleFeatureCollection parse(File file, CoordinateReferenceSystem sourceCRS, CoordinateReferenceSystem targetCRS) throws ServiceException { OGRDataStoreFactory factory = new BridjOGRDataStoreFactory(); if (!factory.isAvailable()) { throw new ServiceException("GDAL library is not found for GPX import"); } Map<String, String> connectionParams = new HashMap<>(); connectionParams.put("DriverName", "GPX"); connectionParams.put("DatasourceName", file.getAbsolutePath()); DataStore store = null; try { store = factory.createDataStore(connectionParams); for (String typeName : store.getTypeNames()) { if ("track_points".equals(typeName)) { continue; } sourceCRS = CRS.decode("EPSG:4326", true); SimpleFeatureSource source = store.getFeatureSource(typeName); return FeatureCollectionParsers.read(source, sourceCRS, targetCRS); } throw new ServiceException("Could not find any usable typeNames from GPX file"); } catch (FactoryException e) { throw new ServiceException("Failed to decode EPSG:4326"); } catch (Exception e) { throw new ServiceException("GPX parsing failed", e); } finally { if (store != null) { store.dispose(); } } }

Target:
public SimpleFeatureCollection parse(File file, CoordinateReferenceSystem sourceCRS, CoordinateReferenceSystem targetCRS) throws ServiceException { OGRDataStoreFactory factory = new BridjOGRDataStoreFactory(); if (!factory.isAvailable()) { throw new ServiceException("GDAL library is not found for GPX import"); } try { sourceCRS = CRS.decode("EPSG:4326", true); } catch (FactoryException e) { throw new ServiceException("Failed to decode EPSG:4326"); } Map<String, String> connectionParams = new HashMap<>(); connectionParams.put("DriverName", "GPX"); connectionParams.put("DatasourceName", file.getAbsolutePath()); DataStore store = null; try { store = factory.createDataStore(connectionParams); for (String typeName : store.getTypeNames()) { if ("track_points".equals(typeName)) { continue; } SimpleFeatureSource source = store.getFeatureSource(typeName); return FeatureCollectionParsers.read(source, sourceCRS, targetCRS); } throw new ServiceException("Could not find any usable typeNames from GPX file"); } catch (Exception e) { throw new ServiceException("GPX parsing failed", e); } finally { if (store != null) { store.dispose(); } } }
Source:
public Diagnosis unvoidDiagnosis(Diagnosis diagnosis) throws APIException { if (diagnosis.getVoided()) { diagnosis.setVoided(false); diagnosis.setVoidedBy(null); diagnosis.setDateVoided(null); diagnosis.setVoidReason(null); } return save(diagnosis); }

Target:
public Diagnosis unvoidDiagnosis(Diagnosis diagnosis) throws APIException { return Context.getDiagnosisService().save(diagnosis); }
Source:
public void append(JsonParser parser, BlockBuilder blockBuilder) throws IOException { Boolean result = castTokenAsBoolean(parser); if (result == null) { blockBuilder.appendNull(); } else { BOOLEAN.writeBoolean(blockBuilder, result); } }

Target:
public void append(JsonParser parser, BlockBuilder blockBuilder) throws IOException { Boolean result = currentTokenAsBoolean(parser); if (result == null) { blockBuilder.appendNull(); } else { BOOLEAN.writeBoolean(blockBuilder, result); } }
Source:
public List<FactMappingValidationError> validate(Simulation simulation, KieContainer kieContainer) { List<FactMappingValidationError> errors = new ArrayList<>(); String dmnFilePath = simulation.getSimulationDescriptor().getDmnFilePath(); DMNModel dmnModel = getDMNModel(kieContainer, dmnFilePath); for (FactMapping factMapping : simulation.getSimulationDescriptor().getFactMappings()) { if (isToSkip(factMapping)) { continue; } String nodeName = factMapping.getFactIdentifier().getName(); DMNType rootDMNType; try { rootDMNType = dmnModel.getDecisionByName(nodeName) != null ? dmnModel.getDecisionByName(nodeName).getResultType() : dmnModel.getInputByName(nodeName).getType(); } catch (NullPointerException e) { errors.add(createNodeChangedError(factMapping, "node not found")); continue; } List<String> steps = expressionElementToString(factMapping); Type rootType = getRootType((BaseDMNTypeImpl) rootDMNType); if (!CONTEXT.equals(rootType) && steps.size() == 0 && rootDMNType.isComposite()) { errors.add(createNodeChangedError(factMapping, rootDMNType.getName())); continue; } try { DMNType fieldType = navigateDMNType(rootDMNType, steps); if (!isDMNFactMappingValid(factMapping.getClassName(), factMapping, fieldType)) { errors.add(createFieldChangedError(factMapping, fieldType.getName())); } } catch (IllegalStateException e) { errors.add(createGenericError(factMapping, e.getMessage())); } } return errors; }

Target:
public List<FactMappingValidationError> validate(Simulation simulation, KieContainer kieContainer) { List<FactMappingValidationError> errors = new ArrayList<>(); String dmnFilePath = simulation.getSimulationDescriptor().getDmnFilePath(); DMNModel dmnModel = getDMNModel(kieContainer, dmnFilePath); for (FactMapping factMapping : simulation.getSimulationDescriptor().getFactMappings()) { if (isToSkip(factMapping)) { continue; } String nodeName = factMapping.getFactIdentifier().getName(); DMNType rootDMNType; try { rootDMNType = dmnModel.getDecisionByName(nodeName) != null ? dmnModel.getDecisionByName(nodeName).getResultType() : dmnModel.getInputByName(nodeName).getType(); } catch (NullPointerException e) { errors.add(createNodeChangedError(factMapping, "node not found")); continue; } List<String> steps = expressionElementToString(factMapping); Type rootType = getRootType((BaseDMNTypeImpl) rootDMNType); if (!CONTEXT.equals(rootType) && steps.isEmpty() && rootDMNType.isComposite()) { errors.add(createNodeChangedError(factMapping, rootDMNType.getName())); continue; } try { DMNType fieldType = navigateDMNType(rootDMNType, steps); if (!isDMNFactMappingValid(factMapping.getClassName(), factMapping, fieldType)) { errors.add(createFieldChangedError(factMapping, fieldType.getName())); } } catch (IllegalStateException e) { errors.add(createGenericError(factMapping, e.getMessage())); } } return errors; }
Source:
private void checkForPluginUpdate(File pluginsFolder, File pluginFile) { File updateFolder = new File( pluginsFolder, "update" ); if ( !updateFolder.isDirectory() ) { return; } File pluginUpdateFile = new File( updateFolder, pluginFile.getName() ); if ( pluginUpdateFile.isFile() ) { try ( FileInputStream fis = new FileInputStream( pluginUpdateFile ); FileOutputStream fos = new FileOutputStream( pluginFile ) ) { fos.getChannel().transferFrom( fis.getChannel(), 0, Long.MAX_VALUE ); } catch ( IOException e ) { ProxyServer.getInstance().getLogger().log( Level.WARNING, "Failed to update plugin " + pluginFile, e ); } pluginUpdateFile.delete(); } }

Target:
private void checkForPluginUpdate(File pluginsFolder, File pluginFile) { File updateFolder = new File( pluginsFolder, "update" ); if ( !updateFolder.isDirectory() ) { return; } File pluginUpdateFile = new File( updateFolder, pluginFile.getName() ); if ( pluginUpdateFile.isFile() ) { try { Files.copy( pluginUpdateFile.toPath(), pluginFile.toPath() ); } catch ( IOException ex ) { ProxyServer.getInstance().getLogger().log( Level.WARNING, "Failed to update plugin " + pluginFile, ex ); } pluginUpdateFile.delete(); } }
Source:
@Test public void replaceKeepsOriginals() { Screen able = new Screen("Able"); Screen baker = new Screen("Baker"); Backstack backstack = Backstack.emptyBuilder() .addAll(Arrays.<Object>asList(able, baker)) .build(); Flow flow = new Flow(backstack, new FlowListener()); assertThat(backstack.size()).isEqualTo(2); Object charlie = new HasParent<Screen>() { @Override public Screen getParent() { return new Screen("Able"); } }; flow.replaceTo(charlie); assertThat(lastStack.size()).isEqualTo(2); assertThat(lastStack.current().getScreen()).isSameAs(charlie); flow.goBack(); assertThat(lastStack.size()).isEqualTo(1); assertThat(lastStack.current().getScreen()).isSameAs(able); }

Target:
@Test public void replaceKeepsOriginals() { Screen able = new Able(); Screen baker = new Baker(); Screen charlie = new Charlie(); Screen delta = new Screen("Delta"); Backstack backstack = Backstack.emptyBuilder() .addAll(Arrays.<Object>asList(able, baker, charlie, delta)) .build(); Flow flow = new Flow(backstack, new FlowListener()); assertThat(backstack.size()).isEqualTo(4); Screen foxtrot = new Foxtrot(); flow.replaceTo(foxtrot); assertThat(lastStack.size()).isEqualTo(4); assertThat(lastStack.current().getScreen()).isSameAs(foxtrot); flow.goBack(); assertThat(lastStack.size()).isEqualTo(3); assertThat(lastStack.current().getScreen()).isEqualTo(new Echo()); flow.goBack(); assertThat(lastStack.size()).isEqualTo(2); assertThat(lastStack.current().getScreen()).isSameAs(baker); flow.goBack(); assertThat(lastStack.size()).isEqualTo(1); assertThat(lastStack.current().getScreen()).isSameAs(able); }
Source:
public void storeWorkerMetrics(final String workerId, final WorkerMetrics metrics) { final DataInfo dataInfo = new DataInfoImpl(metrics.getNumDataBlocks()); final EvaluatorParameters evaluatorParameters = new WorkerEvaluatorParameters(workerId, dataInfo, metrics); workerEvalParams.add(evaluatorParameters); try { final URL obj = new URL(this.dolphinURL); final HttpURLConnection con = (HttpURLConnection) obj.openConnection(); con.setRequestMethod("POST"); con.setDoOutput(true); con.setDoInput(true); con.connect(); final OutputStream os = con.getOutputStream(); final String param = "serverid=-1&workerid=" + workerId; System.out.println("request with " + param); os.write((param).getBytes()); os.flush(); os.close(); final BufferedReader in = new BufferedReader( new InputStreamReader(con.getInputStream()) ); String inputLine; final StringBuffer response = new StringBuffer(); while ((inputLine = in.readLine()) != null) { response.append(inputLine); } in.close(); } catch (Exception e) { System.out.println(e); } }

Target:
public void storeWorkerMetrics(final String workerId, final WorkerMetrics metrics) { final DataInfo dataInfo = new DataInfoImpl(metrics.getNumDataBlocks()); final EvaluatorParameters evaluatorParameters = new WorkerEvaluatorParameters(workerId, dataInfo, metrics); workerEvalParams.add(evaluatorParameters); if (this.dashboardEnabled) { sendMetrics(workerId, metrics.toString()); } }