auphong2707/dl4se-code-review-dataset huggingface dataset:
Source:
public void info(Throwable thrown) { long startTime = System.nanoTime(); delegate.fine(thrown); logOnSlowLogging(startTime); }

Target:
public void info(Throwable thrown) { long startTime = System.nanoTime(); delegate.info(thrown); logOnSlowLogging(startTime); }
Source:
static String readString(ByteBuf buffer, int length, Charset charset) { if (buffer.isDirect()) { final String result = buffer.toString(buffer.readerIndex(), length, charset); buffer.skipBytes(length); return result; } else { if (buffer.hasArray()) { final int offset = buffer.arrayOffset() + buffer.readerIndex(); final String result; if (offset == 0 && length == buffer.array().length) { result = new String(buffer.array(), charset); } else { result = new String(buffer.array(), offset, length, charset); } buffer.skipBytes(length); return result; } final byte[] array = new byte[length]; buffer.readBytes(array); return new String(array, charset); } }

Target:
static String readString(ByteBuf buffer, int length, Charset charset) { if (buffer.isDirect()) { final String result = buffer.toString(buffer.readerIndex(), length, charset); buffer.skipBytes(length); return result; } else if (buffer.hasArray()) { final String result = new String(buffer.array(), buffer.arrayOffset() + buffer.readerIndex(), length, charset); buffer.skipBytes(length); return result; } else { final byte[] array = new byte[length]; buffer.readBytes(array); return new String(array, charset); } }
Source:
private IItemPropertyDescriptor getPropertyDescriptor(final EObject instance, final String featureName) { final EStructuralFeature structuralFeature = instance.eClass().getEStructuralFeature(featureName); ComposedAdapterFactory adapterFactory = new ComposedAdapterFactory(ComposedAdapterFactory.Descriptor.Registry.INSTANCE); final IItemPropertySource propertySource = (IItemPropertySource) adapterFactory.adapt(instance, IItemPropertySource.class); IItemPropertyDescriptor propertyDescriptor = null; if (propertySource != null) { final Iterator<?> iterDescriptors = propertySource.getPropertyDescriptors(instance).iterator(); while (iterDescriptors.hasNext() && propertyDescriptor == null) { final IItemPropertyDescriptor currentPropertyDescriptor = (IItemPropertyDescriptor) iterDescriptors.next(); final Object currentFeature = currentPropertyDescriptor.getFeature(instance); if (currentFeature != null && currentFeature.equals(structuralFeature)) { propertyDescriptor = currentPropertyDescriptor; } } } adapterFactory.dispose(); return propertyDescriptor; }

Target:
private IItemPropertyDescriptor getPropertyDescriptor(final EObject instance, final String featureName) { IItemPropertyDescriptor propertyDescriptor = null; final EStructuralFeature structuralFeature = instance.eClass().getEStructuralFeature(featureName); ComposedAdapterFactory adapterFactory = new ComposedAdapterFactory(ComposedAdapterFactory.Descriptor.Registry.INSTANCE); try { final IItemPropertySource propertySource = (IItemPropertySource) adapterFactory.adapt(instance, IItemPropertySource.class); if (propertySource != null) { final Iterator<?> iterDescriptors = propertySource.getPropertyDescriptors(instance).iterator(); while (iterDescriptors.hasNext() && propertyDescriptor == null) { final IItemPropertyDescriptor currentPropertyDescriptor = (IItemPropertyDescriptor) iterDescriptors.next(); final Object currentFeature = currentPropertyDescriptor.getFeature(instance); if (currentFeature != null && currentFeature.equals(structuralFeature)) { propertyDescriptor = currentPropertyDescriptor; } } } } finally { adapterFactory.dispose(); } return propertyDescriptor; }
Source:
public void configure(final DeploymentPhaseContext context, final ComponentDescription description, final ComponentConfiguration configuration) throws DeploymentUnitProcessingException { final ClassReflectionIndex classIndex = context.getDeploymentUnit().getAttachment(Attachments.REFLECTION_INDEX).getClassIndex(configuration.getComponentClass()); final Constructor<?> ctor = classIndex.getConstructor(new String[0]); boolean noInterface = false; for(ViewDescription view : description.getViews()) { if(view.getViewClassName().equals(description.getComponentClassName())) { noInterface = true; } } EjbValidationsUtil.verifyEjbClassAndDefaultConstructor(ctor, configuration.getComponentClass().getEnclosingClass(), noInterface, description.getComponentName(), description.getComponentClassName(), configuration.getComponentClass().getModifiers()); EjbValidationsUtil.verifyEjbMethodAreNotFinalNorStatic(configuration.getComponentClass().getDeclaredMethods(),description.getComponentClassName()); for ( Class<?> interfaceClass : configuration.getComponentClass().getInterfaces()) EjbValidationsUtil.verifyEjbMethodAreNotFinalNorStatic(interfaceClass.getDeclaredMethods(), interfaceClass.getCanonicalName()); }

Target:
public void configure(final DeploymentPhaseContext context, final ComponentDescription description, final ComponentConfiguration configuration) throws DeploymentUnitProcessingException { final ClassReflectionIndex classIndex = context.getDeploymentUnit().getAttachment(Attachments.REFLECTION_INDEX).getClassIndex(configuration.getComponentClass()); final Constructor<?> ctor = classIndex.getConstructor(new String[0]); boolean noInterface = false; for(ViewDescription view : description.getViews()) { if(view.getViewClassName().equals(description.getComponentClassName())) { noInterface = true; } } EjbValidationsUtil.getBusinessMethods(configuration.getComponentClass()); EjbValidationsUtil.verifyEjbClassAndDefaultConstructor(ctor, configuration.getComponentClass().getEnclosingClass(), noInterface, description.getComponentName(), description.getComponentClassName(), configuration.getComponentClass().getModifiers()); EjbValidationsUtil.verifyEjbPublicMethodAreNotFinalNorStatic(configuration.getComponentClass().getDeclaredMethods(),description.getComponentClassName()); for ( Class<?> interfaceClass : configuration.getComponentClass().getInterfaces()) EjbValidationsUtil.verifyEjbPublicMethodAreNotFinalNorStatic(interfaceClass.getDeclaredMethods(), interfaceClass.getCanonicalName()); }
Source:
public void progress() { if (!this.bPlayer.canBendIgnoreBinds(this) || !this.bPlayer.hasElement(Element.CHI)) { this.remove(); return; } else if (duration != 0 && System.currentTimeMillis() > this.getStartTime() + duration) { remove(); return; } if (!this.player.hasPotionEffect(PotionEffectType.SPEED)) { this.player.addPotionEffect(new PotionEffect(PotionEffectType.SPEED, 60, this.speed, true)); } if (!this.player.hasPotionEffect(PotionEffectType.JUMP)) { this.player.addPotionEffect(new PotionEffect(PotionEffectType.JUMP, 60, this.jump, true)); } }

Target:
public void progress() { if (!this.bPlayer.canBendIgnoreBinds(this) || !this.bPlayer.hasElement(Element.CHI)) { this.remove(); return; } else if (this.duration != 0 && System.currentTimeMillis() > this.getStartTime() + this.duration) { remove(); return; } if (!this.player.hasPotionEffect(PotionEffectType.SPEED)) { this.player.addPotionEffect(new PotionEffect(PotionEffectType.SPEED, 60, this.speed, true)); } if (!this.player.hasPotionEffect(PotionEffectType.JUMP)) { this.player.addPotionEffect(new PotionEffect(PotionEffectType.JUMP, 60, this.jump, true)); } }
Source:
public void evaluate_shouldReturnAllPatientsTakingDrugsBeforeSpecifiedDate() throws Exception { cohortDefinition.setActivatedOnOrBefore(DateUtil.getDateTime(2008, 8, 2)); Cohort cohort = Context.getService(CohortDefinitionService.class).evaluate(cohortDefinition, null); System.out.println("Taking Drugs in before " + cohort.getMemberIds() + " " + cohortDefinition); Assert.assertTrue(cohort.contains(2)); Assert.assertTrue(cohort.contains(8)); Assert.assertTrue(cohort.contains(22)); Assert.assertEquals(3, cohort.size()); }

Target:
public void evaluate_shouldReturnAllPatientsTakingDrugsBeforeSpecifiedDate() throws Exception { cohortDefinition.setActivatedOnOrBefore(DateUtil.getDateTime(2008, 8, 2)); Cohort cohort = Context.getService(CohortDefinitionService.class).evaluate(cohortDefinition, null); Assert.assertTrue(cohort.contains(2)); Assert.assertTrue(cohort.contains(22)); Assert.assertEquals(2, cohort.size()); }
Source:
private static List<List<Integer>> generateKeys(int beginInclusive, int endExclusive) { ImmutableList.Builder<List<Integer>> result = ImmutableList.builder(); for (int value = beginInclusive; value < endExclusive; value++) { result.add(ImmutableList.of(value)); } return result.build(); }

Target:
private static List<List<Integer>> generateKeys(int beginInclusive, int endExclusive) { return IntStream.range(beginInclusive, endExclusive) .mapToObj(ImmutableList::of) .collect(toImmutableList()); }
Source:
public void testFetchEmptyRecentlyFinishedFlows() throws Exception { final ExecutableFlow flow1 = createExecution(System.currentTimeMillis(), Status.SUCCEEDED); flow1.setEndTime(System.currentTimeMillis()); this.executionFlowDao.updateExecutableFlow(flow1); DateTimeUtils.setCurrentMillisOffset(-FLOW_FINISHED_TIME.toMillis()); flow1.setEndTime(DateTimeUtils.currentTimeMillis()); this.executionFlowDao.updateExecutableFlow(flow1); final List<ExecutableFlow> flows = this.executionFlowDao .fetchRecentlyFinishedFlows(RECENTLY_FINISHED_LIFETIME); assertThat(flows).isEmpty(); }

Target:
public void testFetchEmptyRecentlyFinishedFlows() throws Exception { final long currentTime = System.currentTimeMillis(); final long endTime = currentTime - FLOW_FINISHED_TIME.toMillis(); final long startTime = currentTime - FLOW_FINISHED_TIME.toMillis() - 10; final ExecutableFlow flow1 = createExecution(startTime, Status.SUCCEEDED); flow1.setEndTime(endTime); this.executionFlowDao.updateExecutableFlow(flow1); final List<ExecutableFlow> flows = this.executionFlowDao .fetchRecentlyFinishedFlows(RECENTLY_FINISHED_LIFETIME); assertThat(flows).isEmpty(); }
Source:
@Test void testTypeMismatch() { VolcanoPlanner planner = new VolcanoPlanner(); planner.addRelTraitDef(ConventionTraitDef.INSTANCE); planner.addRule(MockPhysLeafRule.INSTANCE); RelOptCluster cluster = newCluster(planner); NoneLeafRel leafRel = new NoneLeafRel( cluster, "a"); RelNode convertedRel = planner.changeTraits( leafRel, cluster.traitSetOf(PHYS_CALLING_CONVENTION)); planner.setRoot(convertedRel); try { planner.chooseDelegate().findBestExp(); } catch (RuntimeException e) { Throwable exception = ExceptionUtils.getRootCause(e); assertThat(exception, instanceOf(IllegalArgumentException.class)); assertThat( exception.getMessage(), isLinux("Type mismatch: \n" + "this: JavaType(class java.lang.Integer) -> JavaType(void) NOT NULL\n")); } }

Target:
@Test void testTypeMismatch() { VolcanoPlanner planner = new VolcanoPlanner(); planner.addRelTraitDef(ConventionTraitDef.INSTANCE); planner.addRule(MockPhysLeafRule.INSTANCE); RelOptCluster cluster = newCluster(planner); NoneLeafRel leafRel = new NoneLeafRel( cluster, "a"); RelNode convertedRel = planner.changeTraits( leafRel, cluster.traitSetOf(PHYS_CALLING_CONVENTION)); planner.setRoot(convertedRel); RuntimeException ex = assertThrows(RuntimeException.class, () -> { planner.chooseDelegate().findBestExp(); }, "Should throw exception fail since the type mismatches after applying rule."); Throwable exception = ExceptionUtils.getRootCause(ex); assertThat(exception, instanceOf(IllegalArgumentException.class)); assertThat( exception.getMessage(), isLinux("Type mismatch:\n" + "rel rowtype: RecordType(JavaType(class java.lang.Integer) this) NOT NULL\n" + "equiv rowtype: RecordType(JavaType(void) NOT NULL this) NOT NULL\n" + "Difference:\n" + "this: JavaType(class java.lang.Integer) -> JavaType(void) NOT NULL\n")); }
Source:
private void doVersionUpdate(Session session, String keyspace, long delay, int maxRetries) throws InterruptedException { String configId = "org.hawkular.metrics"; String configName = "version"; String version = VersionUtil.getVersion(); PreparedStatement updateVersion = null; int retries = 0; while (true) { try { if (updateVersion == null) { updateVersion = session.prepare( "INSERT INTO " + keyspace + ".sys_config (config_id, name, value) VALUES (?, ?, ?)"); } session.execute(updateVersion.bind(configId, configName, version)); logger.info("Updated system configuration to version {}", version); break; } catch (Exception e) { retries++; if (retries > maxRetries) { throw new RuntimeException("Failed to update version in system configuration after " + maxRetries + " attempts.", e); } logger.warn("Failed to update version in system configuration. Retrying in " + delay + " ms", e); Thread.sleep(delay); } } }

Target:
private void doVersionUpdate(Session session, String keyspace, long delay, int maxRetries) { String configId = "org.hawkular.metrics"; String configName = "version"; String version = VersionUtil.getVersion(); SimpleStatement updateVersion = new SimpleStatement( "INSERT INTO sys_config (config_id, name, value) VALUES (?, ?, ?)", configId, configName, version) .setKeyspace(keyspace); int retries = 0; while (true) { try { session.execute(updateVersion); logger.info("Updated system configuration to version {}", version); break; } catch (Exception e) { retries++; if (retries > maxRetries) { throw new VersionUpdateException("Failed to update version in system configuration after " + maxRetries + " attempts.", e); } logger.warn("Failed to update version in system configuration. Retrying in " + delay + " ms", e); try { Thread.sleep(delay); } catch (InterruptedException e1) { throw new VersionUpdateException("Aborting version update due to interrupt", e1); } } } }
Source:
protected Bitmap getBitmapFromUrl(String url) { ImageStore is = new ImageStore(context, "MixpanelPushNotification"); try { Bitmap bm = is.getImage(url); return bm; } catch (ImageStore.CantGetImageException e) { return null; } }

Target:
protected Bitmap getBitmapFromUrl(String url) { ImageStore is = new ImageStore(context, "MixpanelPushNotification"); try { return is.getImage(url); } catch (ImageStore.CantGetImageException e) { return null; } }
Source:
private String sign(final Long timestamp) throws NoSuchAlgorithmException, UnsupportedEncodingException, InvalidKeyException { String stringToSign = timestamp + "\n" + SECRET; System.out.println(stringToSign); Mac mac = Mac.getInstance("HmacSHA256"); mac.init(new SecretKeySpec(SECRET.getBytes("UTF-8"), "HmacSHA256")); byte[] signData = mac.doFinal(stringToSign.getBytes("UTF-8")); return new String(Base64.getEncoder().encode(signData), "UTF-8"); }

Target:
private String sign(final Long timestamp) throws NoSuchAlgorithmException, UnsupportedEncodingException, InvalidKeyException { String stringToSign = timestamp + "\n" + SECRET; System.out.println(stringToSign); Mac mac = Mac.getInstance("HmacSHA256"); mac.init(new SecretKeySpec(SECRET.getBytes(StandardCharsets.UTF_8.name()), "HmacSHA256")); byte[] signData = mac.doFinal(stringToSign.getBytes(StandardCharsets.UTF_8.name())); return new String(Base64.getEncoder().encode(signData), StandardCharsets.UTF_8.name()); }
Source:
private List<Object> searchKnowledgeGraph(String query) throws IOException { Kgsearch.Entities.Search kgRequest = kgClient.entities().search(); kgRequest.setQuery(query); kgRequest.setKey(API_KEY); return kgRequest.execute().getItemListElement(); }

Target:
JsonObject searchKnowledgeGraph(String query) throws IOException { Kgsearch.Entities.Search kgRequest = kgClient.entities().search(); kgRequest.setQuery(query); kgRequest.setKey(API_KEY); return gson.fromJson(kgRequest.execute().toString(), JsonObject.class); }
Source:
public void shouldUseSpecifiedNameForLeftJoinOperationBetweenKStreamAndKStream() { final KStream<String, String> streamOne = builder.stream(STREAM_TOPIC); final KStream<String, String> streamTwo = builder.stream(STREAM_TOPIC_TWO); streamOne.leftJoin(streamTwo, (value1, value2) -> value1, JoinWindows.of(Duration.ofHours(1)), Joined.as(STREAM_OPERATION_NAME), Materialized.as(STREAM_OPERATION_NAME)); builder.build(); final ProcessorTopology topology = builder.internalTopologyBuilder.rewriteTopology(new StreamsConfig(props)).build(); assertSpecifiedNameForStateStore(topology.stateStores(), STREAM_OPERATION_NAME + "-this-join-store", STREAM_OPERATION_NAME + "-outer-other-join-store" ); assertSpecifiedNameForOperation(topology, "KSTREAM-SOURCE-0000000000", "KSTREAM-SOURCE-0000000001", STREAM_OPERATION_NAME + "-this-windowed", STREAM_OPERATION_NAME + "-other-windowed", STREAM_OPERATION_NAME + "-this-join", STREAM_OPERATION_NAME + "-outer-other-join", STREAM_OPERATION_NAME + "-merge"); }

Target:
public void shouldUseSpecifiedNameForLeftJoinOperationBetweenKStreamAndKStream() { final KStream<String, String> streamOne = builder.stream(STREAM_TOPIC); final KStream<String, String> streamTwo = builder.stream(STREAM_TOPIC_TWO); streamOne.leftJoin(streamTwo, (value1, value2) -> value1, JoinWindows.of(Duration.ofHours(1)), StreamJoined.<String, String, String>as(STREAM_OPERATION_NAME).withName(STREAM_OPERATION_NAME)); builder.build(); final ProcessorTopology topology = builder.internalTopologyBuilder.rewriteTopology(new StreamsConfig(props)).build(); assertNamesForStateStore(topology.stateStores(), STREAM_OPERATION_NAME + "-this-join-store", STREAM_OPERATION_NAME + "-outer-other-join-store" ); assertNamesForOperation(topology, "KSTREAM-SOURCE-0000000000", "KSTREAM-SOURCE-0000000001", STREAM_OPERATION_NAME + "-this-windowed", STREAM_OPERATION_NAME + "-other-windowed", STREAM_OPERATION_NAME + "-this-join", STREAM_OPERATION_NAME + "-outer-other-join", STREAM_OPERATION_NAME + "-merge"); }
Source:
protected void doSetup(ManagementClient client, String containerId) throws Exception { ModelControllerClient mcc = client.getControllerClient(); ModelNode addRaOperation = Operations.createWriteAttributeOperation(RA_ADDRESS.toModelNode(), "default-jsf-impl-slot", "idontexist"); addRaOperation.get("archive").set("wf-ra-ely-security.rar"); addRaOperation.get("transaction-support").set("NoTransaction"); ModelNode response = mcc.execute(addRaOperation); ServerReload.executeReloadAndWaitForCompletion(client); }

Target:
protected void doSetup(ManagementClient client, String containerId) throws Exception { ModelControllerClient mcc = client.getControllerClient(); ModelNode writeJSFAttributeOperation = Operations.createWriteAttributeOperation(JSF_ADDRESS.toModelNode(), "default-jsf-impl-slot", "idontexist"); ModelNode response = mcc.execute(writeJSFAttributeOperation); Assert.assertEquals(SUCCESS, response.get(OUTCOME).asString()); ServerReload.executeReloadAndWaitForCompletion(client); }
Source:
private void createButtons() { btnClose = createButton(locale.buttonClose(), "git-compare-branch-close", new ClickHandler() { @Override public void onClick(ClickEvent event) { delegate.onCloseClicked(); } }); addButtonToFooter(btnClose); btnCompare = createButton(locale.buttonCompare(), "git-compare-branch-compare", new ClickHandler() { @Override public void onClick(ClickEvent event) { delegate.onCompareClicked(); } }); addButtonToFooter(btnCompare); }

Target:
private void createButtons() { btnClose = createButton(locale.buttonClose(), "git-compare-revision-close", new ClickHandler() { @Override public void onClick(ClickEvent event) { delegate.onCloseClicked(); } }); addButtonToFooter(btnClose); btnCompare = createButton(locale.buttonCompare(), "git-compare-revision-compare", new ClickHandler() { @Override public void onClick(ClickEvent event) { delegate.onCompareClicked(); } }); addButtonToFooter(btnCompare); }
Source:
public boolean isRESTRequest(String contentType) { return contentType != null && (contentType.indexOf(HTTPConstants.MEDIA_TYPE_APPLICATION_XML) > -1 || contentType.indexOf(HTTPConstants.MEDIA_TYPE_X_WWW_FORM) > -1 || contentType.indexOf(HTTPConstants.MEDIA_TYPE_MULTIPART_FORM_DATA) > -1 || contentType.indexOf(HTTPConstants.MEDIA_TYPE_APPLICATION_JSON) > -1); }

Target:
private boolean isRESTRequest(String contentType) { return contentType != null && (contentType.indexOf(HTTPConstants.MEDIA_TYPE_APPLICATION_XML) > -1 || contentType.indexOf(HTTPConstants.MEDIA_TYPE_X_WWW_FORM) > -1 || contentType.indexOf(HTTPConstants.MEDIA_TYPE_MULTIPART_FORM_DATA) > -1 || contentType.indexOf(HTTPConstants.MEDIA_TYPE_APPLICATION_JSON) > -1); }
Source:
private void setSSLOptions() { if (sslMode != null && sslMode != SSLMode.DISABLED) { this.useSSL(true); this.verifyServerCertificate(false); this.requireSSL(false); if (sslMode == SSLMode.REQUIRED || sslMode == SSLMode.VERIFY_CA || sslMode == SSLMode.VERIFY_IDENTITY) { this.requireSSL(true); } if (sslMode == SSLMode.VERIFY_IDENTITY) { this.verifyServerCertificate(true); } } else { this.useSSL(false); } }

Target:
private void setSSLOptions() { if (sslMode != null && sslMode != SSLMode.DISABLED) { this.useSSL(true); this.verifyServerCertificate(false); this.requireSSL(false); this.requireSSL(sslMode == SSLMode.REQUIRED || sslMode == SSLMode.VERIFY_CA || sslMode == SSLMode.VERIFY_IDENTITY); this.verifyServerCertificate(sslMode == SSLMode.VERIFY_IDENTITY); } else { this.useSSL(false); } }
Source:
public String category$getId() { return this.id; }

Target:
public String getId() { return this.id; }
Source:
private List<CramCompressionRecord> getNoRefRecords() { final List<CramCompressionRecord> records = new ArrayList<>(); for (int i = 0; i < TEST_RECORD_COUNT; i++) { records.add(createRecord(i, SAMRecord.NO_ALIGNMENT_REFERENCE_INDEX)); } return records; }

Target:
private List<CramCompressionRecord> getNoRefRecords() { final List<CramCompressionRecord> records = new ArrayList<>(); for (int index = 0; index < TEST_RECORD_COUNT; index++) { final CramCompressionRecord record = createRecord(index, SAMRecord.NO_ALIGNMENT_REFERENCE_INDEX); record.setSegmentUnmapped(true); records.add(record); } return records; }
Source:
public void execute(DelegateExecution execution) throws Exception { Pool pool = (Pool) execution.getVariable(CoreProcessVariables.POOL); checkNotNull(pool, "Please add the pool description as a process " + "variable with the name '%s'.", CoreProcessVariables.POOL); Machine machine = (Machine) execution.getVariable("machine"); LOG.info(">> Connecting to machine to setup admin access", machine); SSHClient client = Ssh.newClient(machine, pool.getAdminAccess().toBuilder().username("ubuntu").createAdminAccess(), 5 * 60000 ); try { String puppetScript = renderAndUploadAdminAccessPuppetScript(client, pool); renderAndUploadSshdConfig(client, pool); uploadSudoersFile(client); Session session = client.startSession(); try { session.allocateDefaultPTY(); final String shellCommand = "while ! which puppet &> /dev/null ; " + "do echo 'Puppet command not found. Waiting for userdata.sh script to finish (10s)' " + "&& sleep 10; " + "done " + "&& sudo puppet apply " + puppetScript; Session.Command command = session.exec(shellCommand); Ssh.logCommandOutput(LOG, machine.getExternalId(), command); command.join(); if (command.getExitStatus() != 0) { throw new RuntimeException(String.format("Failed to execute '%s'. Exit code: %d. Exit message: %s", shellCommand, command.getExitStatus(), command.getExitErrorMessage())); } else { LOG.info("<< Command completed successfully with exit code 0"); } } finally { session.close(); } } finally { client.close(); } }

Target:
public void execute(DelegateExecution execution) throws Exception { Pool pool = (Pool) execution.getVariable(CoreProcessVariables.POOL); checkNotNull(pool, "Please add the pool description as a process " + "variable with the name '%s'.", CoreProcessVariables.POOL); Machine machine = (Machine) execution.getVariable("machine"); LOG.info(">> Connecting to machine to setup admin access", machine); SSHClient client = Ssh.newClient(machine, pool.getAdminAccess().toBuilder().username("ubuntu").createAdminAccess()); try { String puppetScript = renderAndUploadAdminAccessPuppetScript(client, pool); renderAndUploadSshdConfig(client, pool); uploadSudoersFile(client); Session session = client.startSession(); try { session.allocateDefaultPTY(); final String shellCommand = "while ! which puppet &> /dev/null ; " + "do echo 'Puppet command not found. Waiting for userdata.sh script to finish (10s)' " + "&& sleep 10; " + "done " + "&& sudo puppet apply " + puppetScript; Session.Command command = session.exec(shellCommand); Ssh.logCommandOutput(LOG, machine.getExternalId(), command); command.join(); if (command.getExitStatus() != 0) { throw new RuntimeException(String.format("Failed to execute '%s'. Exit code: %d. Exit message: %s", shellCommand, command.getExitStatus(), command.getExitErrorMessage())); } else { LOG.info("<< Command completed successfully with exit code 0"); } } finally { session.close(); } } finally { client.close(); } }
Source:
public void afterDelete(AbstractProject project) { if (Util.isOverridden(WorkspaceListener.class, getClass(), "afterDelete", Job.class)) { afterDelete((Job) project); } else { throw new AssertionError("The plugin '" + this.getClass().getName() + "' still uses " + "deprecated afterDelete(AbstractProject) method. " + "Update the plugin to use afterDelete(Job) instead."); } }

Target:
@Deprecated public void afterDelete(AbstractProject project) { if (Util.isOverridden(WorkspaceListener.class, getClass(), "afterDelete", Job.class)) { afterDelete((Job) project); } }
Source:
private void validateParameters() throws Failure { if (projectName.endsWith(Constants.DOT_GIT_EXT)) { projectName = projectName.substring(0, projectName.length() - Constants.DOT_GIT_EXT.length()); } if (ownerIds != null && !ownerIds.isEmpty()) { ownerIds = new ArrayList<AccountGroup.Id>(new HashSet<AccountGroup.Id>(ownerIds)); } else { ownerIds = new ArrayList<AccountGroup.Id>(); ownerIds.add(authConfig.getAdministratorsGroup()); } if (newParent == null) { try { newParent = projectControlFactory.controlFor(wildProject); } catch (NoSuchProjectException e) { throw new Failure(1, "internal server error"); } } final boolean hasCreateProjectPermissions = newParent.canCreateProject(); if (!hasCreateProjectPermissions) { throw new Failure(1, "fatal: Not permitted to create " + projectName); } final Project.NameKey parentNameKey = newParent.getProject().getNameKey(); if (!parentNameKey.equals(wildProject)) { final String correctProjectPrefix = parentNameKey.get() + "/"; if (!projectName.startsWith(correctProjectPrefix)) { throw new Failure(1, "fatal: Not permitted to create " + projectName + " project name must start with: " + correctProjectPrefix); } } while (branch.startsWith("/")) { branch = branch.substring(1); } if (!branch.startsWith(Constants.R_HEADS)) { branch = Constants.R_HEADS + branch; } if (!Repository.isValidRefName(branch)) { throw new Failure(1, "--branch \"" + branch + "\" is not a valid name"); } }

Target:
private void validateParameters() throws Failure { if (projectName.endsWith(Constants.DOT_GIT_EXT)) { projectName = projectName.substring(0, projectName.length() - Constants.DOT_GIT_EXT.length()); } final ProjectControl extractedParent = findParent(projectName); if (extractedParent != null) { newParent = extractedParent; } else if (newParent == null) { try { newParent = projectControlFactory.controlFor(wildProject); } catch (NoSuchProjectException e) { throw new Failure(1, "internal server error"); } } if (ownerIds != null && !ownerIds.isEmpty()) { ownerIds = new ArrayList<AccountGroup.Id>(new HashSet<AccountGroup.Id>(ownerIds)); } else { ownerIds = newParent.allGroupsGrantingCreateProject(); if (ownerIds.isEmpty()) { ownerIds.add(authConfig.getAdministratorsGroup()); } } if (!newParent.canCreateProject()) { throw new Failure(1, "fatal: Not permitted to create " + projectName); } final Project.NameKey parentNameKey = newParent.getProject().getNameKey(); if (!parentNameKey.equals(wildProject)) { final String correctProjectPrefix = parentNameKey.get() + "/"; if (!projectName.startsWith(correctProjectPrefix)) { throw new Failure(1, "fatal: Not permitted to create " + projectName + " project name must start with: " + correctProjectPrefix); } } while (branch.startsWith("/")) { branch = branch.substring(1); } if (!branch.startsWith(Constants.R_HEADS)) { branch = Constants.R_HEADS + branch; } if (!Repository.isValidRefName(branch)) { throw new Failure(1, "--branch \"" + branch + "\" is not a valid name"); } }
Source:
synchronized public Tracker getDefaultTracker() { if (mTracker == null) { mTracker = getAnalyticsInstance().newTracker(DEV_TRACKING_ID); mTracker.enableAutoActivityTracking(true); } String userId = getCurrentUserId(); if (!"".equals(userId)) { mTracker.set("&uid", userId); } else { mTracker.set("&uid", null); } return mTracker; }

Target:
synchronized public Tracker getDefaultTracker() { if (analyticsTracker == null) { analyticsTracker = analyticsInstance.newTracker(DEV_TRACKING_ID); analyticsTracker.enableAutoActivityTracking(true); } String userId = getCurrentUserId(); if (!"".equals(userId)) { analyticsTracker.set("&uid", userId); } else { analyticsTracker.set("&uid", null); } return analyticsTracker; }
Source:
protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_provider_dashboard); provider = (Provider) (getIntent().getSerializableExtra(ApplicationConstants.BundleKeys.PROVIDER_ID_BUNDLE)); setupBackdrop(provider); initViewPager(); if (savedInstanceState != null) { mPresenter = new ProviderDashboardPresenter(this); } else { mPresenter = new ProviderDashboardPresenter(this); } }

Target:
protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_provider_dashboard); if (savedInstanceState != null) { mPresenter = new ProviderDashboardPresenter(this); } else { mPresenter = new ProviderDashboardPresenter(this); } provider = mPresenter.getProviderFromIntent(getIntent()); setupBackdrop(provider); initViewPager(); }
Source:
PostReviewers(Reviewers.Parser parser, ReviewerResource.Factory reviewerFactory, AddReviewerSender.Factory addReviewerSenderFactory, Provider<GroupsCollection> groupsCollection, GroupMembers.Factory groupMembersFactory, AccountInfo.Loader.Factory accountLoaderFactory, Provider<ReviewDb> db, IdentifiedUser currentUser, IdentifiedUser.GenericFactory identifiedUserFactory, ApprovalTypes approvalTypes, @GerritServerConfig Config cfg, ChangeHooks hooks, AccountCache accountCache, ReviewerJson json) { this.parser = parser; this.reviewerFactory = reviewerFactory; this.addReviewerSenderFactory = addReviewerSenderFactory; this.groupsCollection = groupsCollection; this.groupMembersFactory = groupMembersFactory; this.accountLoaderFactory = accountLoaderFactory; this.db = db; this.currentUser = currentUser; this.identifiedUserFactory = identifiedUserFactory; this.cfg = cfg; this.hooks = hooks; this.accountCache = accountCache; this.json = json; this.addReviewerCategoryId = new ApprovalCategory.Id(Iterables.getLast( approvalTypes.getApprovalTypes()).getId()); }

Target:
PostReviewers(Reviewers.Parser parser, ReviewerResource.Factory reviewerFactory, AddReviewerSender.Factory addReviewerSenderFactory, Provider<GroupsCollection> groupsCollection, GroupMembers.Factory groupMembersFactory, AccountInfo.Loader.Factory accountLoaderFactory, Provider<ReviewDb> db, IdentifiedUser currentUser, IdentifiedUser.GenericFactory identifiedUserFactory, ApprovalTypes approvalTypes, @GerritServerConfig Config cfg, ChangeHooks hooks, AccountCache accountCache, ReviewerJson json) { this.parser = parser; this.reviewerFactory = reviewerFactory; this.addReviewerSenderFactory = addReviewerSenderFactory; this.groupsCollection = groupsCollection; this.groupMembersFactory = groupMembersFactory; this.accountLoaderFactory = accountLoaderFactory; this.db = db; this.currentUser = currentUser; this.identifiedUserFactory = identifiedUserFactory; this.cfg = cfg; this.hooks = hooks; this.accountCache = accountCache; this.json = json; this.addReviewerCategoryId = Iterables.getLast(approvalTypes.getApprovalTypes()) .getApprovalCategoryId(); }
Source:
public void testDownloadAndExtractSuccessWithRealZip() throws Exception { verifyZeroInteractions(langs); TmcServerCommunicationTaskFactory realFactory = new TmcServerCommunicationTaskFactory(); assertNotNull(TmcSettingsHolder.get()); command = new DownloadAdaptiveExercise(mockObserver, realFactory); Path testPath = Paths.get(System.getProperty("user.dir")); when(settings.getTmcProjectDirectory()).thenReturn(testPath); Exercise exercise = command.call(); assertTrue(Files.exists(testPath.resolve(exercise.getCourseName()))); FileUtils.deleteDirectory(testPath.resolve(exercise.getCourseName()).toFile()); }

Target:
public void testDownloadAndExtractSuccessWithRealZip() throws Exception { verifyZeroInteractions(langs); TmcServerCommunicationTaskFactory realFactory = new TmcServerCommunicationTaskFactory(); assertNotNull(TmcSettingsHolder.get()); command = new DownloadAdaptiveExercise(mockObserver, realFactory); when(settings.getTmcProjectDirectory()).thenReturn(arithFuncsTempDir); Exercise exercise = command.call(); assertTrue(Files.exists(arithFuncsTempDir)); }
Source:
public void rewriteAST(CompilationUnitRewrite cuRewrite, LinkedProposalModel linkedModel) throws CoreException { TextEditGroup group= createTextEditGroup(isMove() ? FixMessages.TypeAnnotationFix_move : FixMessages.TypeAnnotationFix_remove, cuRewrite); ASTRewrite astRewrite= cuRewrite.getASTRewrite(); if (fAnnotation != null) { Annotation newAnnotation= (Annotation) ASTNode.copySubtree(astRewrite.getAST(), fAnnotation); if (fNewAnnotationTarget != null) { addTypeAnnotation(astRewrite, fNewAnnotationTarget, newAnnotation, group); } astRewrite.remove(fAnnotation, group); } }

Target:
public void rewriteAST(CompilationUnitRewrite cuRewrite, LinkedProposalModel linkedModel) throws CoreException { TextEditGroup group= createTextEditGroup(isMove() ? FixMessages.TypeAnnotationFix_move : FixMessages.TypeAnnotationFix_remove, cuRewrite); ASTRewrite astRewrite= cuRewrite.getASTRewrite(); if (fAnnotation != null) { if (fNewAnnotationTarget != null) { Annotation newAnnotation= (Annotation) astRewrite.createMoveTarget(fAnnotation); addTypeAnnotation(astRewrite, fNewAnnotationTarget, newAnnotation, group); } astRewrite.remove(fAnnotation, group); } }
Source:
public int read(String table, String key, Set<String> fields, HashMap<String, ByteIterator> result) { try { MongoCollection<Document> collection = database.getCollection(table); Document query = new Document("_id", key); FindIterable<Document> findIterable = collection.find(query); if (fields != null) { Document projection = new Document(); for (String field : fields) { projection.put(field, INCLUDE); } findIterable.projection(projection); } Document queryResult = findIterable.first(); if (queryResult != null) { fillMap(result, queryResult); } return queryResult != null ? StatusCode.OK : StatusCode.ERROR; } catch (Exception e) { System.err.println(e.toString()); return StatusCode.ERROR; } }

Target:
public Status read(String table, String key, Set<String> fields, HashMap<String, ByteIterator> result) { try { MongoCollection<Document> collection = database.getCollection(table); Document query = new Document("_id", key); FindIterable<Document> findIterable = collection.find(query); if (fields != null) { Document projection = new Document(); for (String field : fields) { projection.put(field, INCLUDE); } findIterable.projection(projection); } Document queryResult = findIterable.first(); if (queryResult != null) { fillMap(result, queryResult); } return queryResult != null ? Status.OK : Status.NOT_FOUND; } catch (Exception e) { System.err.println(e.toString()); return Status.ERROR; } }
Source:
private void setDictionaryBlockData(byte[] dictionaryData, int[] dictionaryOffsets, int positionCount) { verify(positionCount > 0); if (dictionaryBlock.getSlice().getBase() != dictionaryData) { boolean[] isNullVector = new boolean[positionCount]; isNullVector[isNullVector.length - 1] = true; dictionaryBlock = new VariableWidthBlock(positionCount, Slices.wrappedBuffer(dictionaryData), dictionaryOffsets, isNullVector); } }

Target:
private void setDictionaryBlockData(byte[] dictionaryData, int[] dictionaryOffsets, int positionCount) { verify(positionCount > 0); if (currentDictionaryData != dictionaryData) { boolean[] isNullVector = new boolean[positionCount]; isNullVector[isNullVector.length - 1] = true; dictionaryBlock = new VariableWidthBlock(positionCount, Slices.wrappedBuffer(dictionaryData), dictionaryOffsets, isNullVector); currentDictionaryData = dictionaryData; } }
Source:
public void testLzoRawBytesStorage() throws Exception { if (!GPLNativeCodeLoader.isNativeCodeLoaded()) { return; } setUp(); pigServer.registerQuery(String.format( "B = LOAD 'file:%s-thrift' USING %s() AS (thrift: bytearray);", tempFilename, LzoRawBytesLoader.class.getName())); pigServer.registerQuery(String.format( "STORE B INTO 'file:%s-bytes' USING %s();", tempFilename, LzoRawBytesStorage.class.getName())); pigServer.executeBatch(); pigServer.registerQuery(String.format( "B2 = LOAD 'file:%s-bytes' USING %s() AS (thrift: bytearray);", tempFilename, LzoRawBytesLoader.class.getName())); validate(pigServer.openIterator("B2")); }

Target:
public void testLzoRawBytesStorage() throws Exception { runTest(new Callable<Object>() { @Override public Object call() throws Exception { pigServer.registerQuery(String.format( "B = LOAD 'file:%s-thrift' USING %s() AS (thrift: bytearray);", tempFilename, LzoRawBytesLoader.class.getName())); pigServer.registerQuery(String.format( "STORE B INTO 'file:%s-bytes' USING %s();", tempFilename, LzoRawBytesStorage.class.getName())); pigServer.executeBatch(); pigServer.registerQuery(String.format( "B2 = LOAD 'file:%s-bytes' USING %s() AS (thrift: bytearray);", tempFilename, LzoRawBytesLoader.class.getName())); validate(pigServer.openIterator("B2")); return null; } }); }
Source:
public void testEOF() { StringReader reader = new StringReader("test"); CharacterStreamReadingMessageSource source = new CharacterStreamReadingMessageSource(reader, -1, true); ApplicationEventPublisher publisher = mock(ApplicationEventPublisher.class); source.setApplicationEventPublisher(publisher); Message<?> message1 = source.receive(); assertEquals("test", message1.getPayload()); Message<?> message2 = source.receive(); assertNull(message2); verify(publisher).publishEvent(any(ApplicationEvent.class)); }

Target:
public void testEOF() { StringReader reader = new StringReader("test"); CharacterStreamReadingMessageSource source = new CharacterStreamReadingMessageSource(reader, -1, true); ApplicationEventPublisher publisher = mock(ApplicationEventPublisher.class); source.setApplicationEventPublisher(publisher); Message<?> message1 = source.receive(); assertEquals("test", message1.getPayload()); Message<?> message2 = source.receive(); assertNull(message2); verify(publisher).publishEvent(any(StreamClosedEvent.class)); }
Source:
static <T, R> R apply(Function<T, R> f, T t) { try { return f.apply(t); } catch (Throwable ex) { throw ExceptionHelper.wrapOrThrow(ex); } }

Target:
static <T, R> R apply(Function<T, R> f, T t) { try { return f.apply(t); } catch (Throwable ex) { throw Exceptions.propagate(ex); } }
Source:
public int getUserId(String userName) { resultSet = executor.executeQuery("SELECT User_ID FROM Users WHERE Name LIKE '" + userName + "';"); if(resultSet == null) return -1; else { try { while(resultSet.next()) { return resultSet.getInt("User_ID"); } } catch (SQLException e) { new IllegalStateException("SQL Error: " + e); } } return -1; }

Target:
public int getUserId(String userName) { resultSet = executor.executeQuery("SELECT User_ID FROM Users WHERE Name LIKE '" + userName + "';"); if(resultSet == null) return -1; else { try { while(resultSet.next()) { return resultSet.getInt("User_ID"); } } catch (SQLException e) { throw new IllegalStateException("SQL Error: " + e); } } return -1; }
Source:
public void doNormalTreeRefAnalysis(TreeReference treeRef) throws AnalysisInvalidException { if (treeRef.getName(0).equals(mainInstanceRoot)) { this.result = true; this.shortCircuit = true; } }

Target:
public void doNormalTreeRefAnalysis(TreeReference treeRef) throws AnalysisInvalidException { if (referenceRefersToMainInstance(treeRef)) { this.result = true; this.shortCircuit = true; } }
Source:
public static boolean validateResources(IResource[] resources, Shell shell, String title) { List<IResource> readOnlyFiles= getReadonlyFiles(resources); if (readOnlyFiles.size() == 0) return true; Map<IFile, Long> oldTimeStamps= createModificationStampMap(readOnlyFiles); IFile[] files= readOnlyFiles.toArray(new IFile[readOnlyFiles.size()]); IStatus status= ResourcesPlugin.getWorkspace().validateEdit(files, shell); if (!status.isOK()) { String message= getString("ValidateEdit.error.unable_to_perform"); displayError(shell, title, status, message); return false; } IStatus modified= null; Map<IFile, Long> newTimeStamps= createModificationStampMap(readOnlyFiles); for (Iterator<IFile> iter= oldTimeStamps.keySet().iterator(); iter.hasNext();) { IFile file= iter.next(); if (file.isReadOnly()) { IStatus entry= new Status(IStatus.ERROR, CompareUIPlugin.getPluginId(), VALIDATE_EDIT_PROBLEM, getFormattedString("ValidateEdit.error.stillReadonly", file.getFullPath().toString()), null); modified= addStatus(modified, entry); } else if (! oldTimeStamps.get(file).equals(newTimeStamps.get(file))) { IStatus entry= new Status(IStatus.ERROR, CompareUIPlugin.getPluginId(), VALIDATE_EDIT_PROBLEM, getFormattedString("ValidateEdit.error.fileModified", file.getFullPath().toString()), null); modified= addStatus(modified, entry); } } if (modified != null) { String message= getString("ValidateEdit.error.unable_to_perform"); displayError(shell, title, modified, message); return false; } return true; }

Target:
public static boolean validateResources(IResource[] resources, Shell shell, String title) { List<IResource> readOnlyFiles= getReadonlyFiles(resources); if (readOnlyFiles.size() == 0) return true; Map<IFile, Long> oldTimeStamps= createModificationStampMap(readOnlyFiles); IFile[] files= readOnlyFiles.toArray(new IFile[readOnlyFiles.size()]); IStatus status= ResourcesPlugin.getWorkspace().validateEdit(files, shell); if (!status.isOK()) { String message= getString("ValidateEdit.error.unable_to_perform"); displayError(shell, title, status, message); return false; } IStatus modified= null; Map<IFile, Long> newTimeStamps= createModificationStampMap(readOnlyFiles); for (Map.Entry<IFile, Long> entry : newTimeStamps.entrySet()) { IFile file = entry.getKey(); Long newTimeStamp = entry.getValue(); if (file.isReadOnly()) { IStatus error = new Status(IStatus.ERROR, CompareUIPlugin.getPluginId(), VALIDATE_EDIT_PROBLEM, getFormattedString("ValidateEdit.error.stillReadonly", file.getFullPath().toString()), null); modified= addStatus(modified, error); } else if (!oldTimeStamps.get(file).equals(newTimeStamp)) { IStatus error = new Status(IStatus.ERROR, CompareUIPlugin.getPluginId(), VALIDATE_EDIT_PROBLEM, getFormattedString("ValidateEdit.error.fileModified", file.getFullPath().toString()), null); modified= addStatus(modified, error); } } if (modified != null) { String message= getString("ValidateEdit.error.unable_to_perform"); displayError(shell, title, modified, message); return false; } return true; }
Source:
public void testZKOperationsAfterClientSaslAuthFailure() throws Exception { CountdownWatcher watcher = new CountdownWatcher(); ZooKeeper zk = new ZooKeeper(hostPort, CONNECTION_TIMEOUT, watcher); watcher.waitForConnected(CONNECTION_TIMEOUT); try { setSaslFailureFlag(zk); int totalTry = 10; int tryCount = 0; boolean success = false; while (!success && tryCount++ <= totalTry) { try { zk.create("/saslAuthFail", "data".getBytes(), Ids.OPEN_ACL_UNSAFE, CreateMode.PERSISTENT_SEQUENTIAL); success = true; } catch (KeeperException.ConnectionLossException e) { Thread.sleep(1000); } } assertTrue("ZNode creation is failing continusly after Sasl auth failure.", success); } finally { zk.close(); } }

Target:
public void testZKOperationsAfterClientSaslAuthFailure() throws Exception { CountdownWatcher watcher = new CountdownWatcher(); ZooKeeper zk = new ZooKeeper(hostPort, CONNECTION_TIMEOUT, watcher); watcher.waitForConnected(CONNECTION_TIMEOUT); try { setSaslFailureFlag(zk); int totalTry = 10; int tryCount = 0; boolean success = false; while (!success && tryCount++ <= totalTry) { try { zk.create("/saslAuthFail", "data".getBytes(), Ids.OPEN_ACL_UNSAFE, CreateMode.PERSISTENT_SEQUENTIAL); success = true; } catch (KeeperException.ConnectionLossException e) { Thread.sleep(1000); } } assertTrue("ZNode creation is failing continuously after Sasl auth failure.", success); } finally { zk.close(); } }
Source:
private void load() { Toast.makeText(getApplicationContext(), R.string.loading, Toast.LENGTH_SHORT).show(); new ReadFileTask(getContentResolver(), mFile, getExternalCacheDir(), (data) -> { switch (data.error) { case ReadFileTask.NORMAL: cacheFile = data.cachedFile; mOriginal = data.fileContents; try { mInput.setText(data.fileContents); if (data.fileContents.isEmpty()) { Toast.makeText(getApplicationContext(), R.string.file_empty, Toast.LENGTH_SHORT).show(); } else { mInput.setHint(null); } } catch (OutOfMemoryError e) { Toast.makeText(getApplicationContext(), R.string.error, Toast.LENGTH_SHORT).show(); finish(); } break; case ReadFileTask.EXCEPTION_STREAM_NOT_FOUND: Toast.makeText(getApplicationContext(), R.string.error_file_not_found, Toast.LENGTH_SHORT).show(); finish(); break; case ReadFileTask.EXCEPTION_IO: Toast.makeText(getApplicationContext(), R.string.error_io, Toast.LENGTH_SHORT).show(); finish(); break; } }).execute(); }

Target:
private void load() { Snackbar.make(scrollView, R.string.loading, Snackbar.LENGTH_SHORT).show(); new ReadFileTask(getContentResolver(), mFile, getExternalCacheDir(), (data) -> { switch (data.error) { case ReadFileTask.NORMAL: cacheFile = data.cachedFile; mOriginal = data.fileContents; try { mInput.setText(data.fileContents); if (data.fileContents.isEmpty()) { mInput.setHint(R.string.file_empty); } else { mInput.setHint(null); } } catch (OutOfMemoryError e) { Toast.makeText(getApplicationContext(), R.string.error, Toast.LENGTH_SHORT).show(); finish(); } break; case ReadFileTask.EXCEPTION_STREAM_NOT_FOUND: Toast.makeText(getApplicationContext(), R.string.error_file_not_found, Toast.LENGTH_SHORT).show(); finish(); break; case ReadFileTask.EXCEPTION_IO: Toast.makeText(getApplicationContext(), R.string.error_io, Toast.LENGTH_SHORT).show(); finish(); break; } }).execute(); }
Source:
public void testACNVPlotting() { File tDir = IOUtils.tempDir("Test", "Plotting"); final String[] arguments = { "-" + ExomeStandardArgumentDefinitions.ALLELIC_COUNTS_FILE_SHORT_NAME, SNP_COUNTS_FILE.getAbsolutePath(), "-" + ExomeStandardArgumentDefinitions.TANGENT_NORMALIZED_COUNTS_FILE_SHORT_NAME, TANGENT_NORMALIZED_COVERAGE_FILE.getAbsolutePath(), "-" + ExomeStandardArgumentDefinitions.SEGMENT_FILE_SHORT_NAME, SEGMENTS_FILE.getAbsolutePath(), "-" + StandardArgumentDefinitions.OUTPUT_SHORT_NAME, tDir.getAbsolutePath() }; runCommandLine(arguments); Assert.assertTrue(new File(tDir, sampleName + "_ACNV.png").exists()); Assert.assertTrue(new File(tDir, sampleName + "_ACNV.png").length() > 0); }

Target:
public void testACNVPlotting() { File tDir = IOUtils.tempDir("Test", "Plotting"); final String[] arguments = { "-" + ExomeStandardArgumentDefinitions.ALLELIC_COUNTS_FILE_SHORT_NAME, TUMOR_ALLELIC_COUNTS_FILE.getAbsolutePath(), "-" + ExomeStandardArgumentDefinitions.TANGENT_NORMALIZED_COUNTS_FILE_SHORT_NAME, TANGENT_NORMALIZED_COVERAGE_FILE.getAbsolutePath(), "-" + ExomeStandardArgumentDefinitions.SEGMENT_FILE_SHORT_NAME, SEGMENTS_FILE.getAbsolutePath(), "-" + StandardArgumentDefinitions.OUTPUT_SHORT_NAME, tDir.getAbsolutePath() }; runCommandLine(arguments); Assert.assertTrue(new File(tDir, sampleName + "_ACNV.png").exists()); Assert.assertTrue(new File(tDir, sampleName + "_ACNV.png").length() > 0); }
Source:
public boolean recordBackPressure(Integer taskId) { return tasks.get(taskId).backpressure.getAndSet(true); }

Target:
public boolean recordBackPressure(Integer taskId) { return tasks.get(taskId).backpressure.getAndSet(true) == false; }
Source:
public HostValidator(VDS host) { this.host = host; }

Target:
protected HostValidator(VDS host) { this.host = host; }