auphong2707/dl4se-code-review-dataset huggingface dataset:
Source:
<code>public void registerInterposedSynchronization(Synchronization sync) throws IllegalStateException { try { Transaction tx = transactionManager.getTransaction(); JCAOrderedLastSynchronizationList jcaOrderedLastSynchronization = interposedSyncs.get(tx); <START> if (jcaOrderedLastSynchronization == null) { <END> jcaOrderedLastSynchronization = new JCAOrderedLastSynchronizationList(tx, interposedSyncs); delegate.registerInterposedSynchronization(jcaOrderedLastSynchronization); } jcaOrderedLastSynchronization.add(sync); } catch (SystemException e) { throw new IllegalStateException(e); } }</code><technical_language>putIfAbsent semantics is</technical_language>

Target:
public void registerInterposedSynchronization(Synchronization sync) throws IllegalStateException { try { Transaction tx = transactionManager.getTransaction(); JCAOrderedLastSynchronizationList jcaOrderedLastSynchronization = interposedSyncs.get(tx); if (jcaOrderedLastSynchronization == null) { JCAOrderedLastSynchronizationList toPut = new JCAOrderedLastSynchronizationList(tx, interposedSyncs); jcaOrderedLastSynchronization = interposedSyncs.putIfAbsent(tx, toPut); if (jcaOrderedLastSynchronization == null) { jcaOrderedLastSynchronization = toPut; delegate.registerInterposedSynchronization(jcaOrderedLastSynchronization); } } jcaOrderedLastSynchronization.addInterposedSynchronization(sync); } catch (SystemException e) { throw new IllegalStateException(e); } }
Source:
<code>void setUp() { mockApplicationContext = mock(ApplicationContext.class); mockEventStore = mock(EventStore.class); mockRepositoryProvider = mock(RepositoryProvider.class); executor = spy(new MockExecutor()); testSubject = new SpringAggregateSnapshotterFactoryBean(); testSubject.setApplicationContext(mockApplicationContext); testSubject.setExecutor(executor); when(mockApplicationContext.getBeansOfType(AggregateFactory.class)).thenReturn( Collections.singletonMap("myFactory", new AbstractAggregateFactory<StubAggregate>(StubAggregate.class) { @Override public StubAggregate doCreateAggregate(String aggregateIdentifier, DomainEventMessage firstEvent) { return new StubAggregate(aggregateIdentifier); } })); testSubject.setEventStore(mockEventStore); testSubject.setRepositoryProvider(mockRepositoryProvider); mockTransactionManager = mock(PlatformTransactionManager.class); aggregateIdentifier = UUID.randomUUID().toString(); <START> String type = "StubAggregate"; <END> DomainEventMessage event1 = new GenericDomainEventMessage<>(type, aggregateIdentifier, 0L, "Mock contents", MetaData.emptyInstance()); DomainEventMessage event2 = new GenericDomainEventMessage<>(type, aggregateIdentifier, 1L, "Mock contents", MetaData.emptyInstance()); when(mockEventStore.readEvents(aggregateIdentifier)).thenReturn(DomainEventStream.of(event1, event2)); }</code><technical_language>nice for test pass modifications, show compatibility</technical_language>

Target:
void setUp() { mockApplicationContext = mock(ApplicationContext.class); mockEventStore = mock(EventStore.class); mockRepositoryProvider = mock(RepositoryProvider.class); executor = spy(new MockExecutor()); testSubject = new SpringAggregateSnapshotterFactoryBean(); testSubject.setApplicationContext(mockApplicationContext); testSubject.setExecutor(executor); when(mockApplicationContext.getBeansOfType(AggregateFactory.class)).thenReturn( Collections.singletonMap("myFactory", new AbstractAggregateFactory<StubAggregate>(StubAggregate.class) { @Override public StubAggregate doCreateAggregate(String aggregateIdentifier, DomainEventMessage firstEvent) { return new StubAggregate(aggregateIdentifier); } })); testSubject.setEventStore(mockEventStore); testSubject.setRepositoryProvider(mockRepositoryProvider); mockTransactionManager = mock(PlatformTransactionManager.class); aggregateIdentifier = UUID.randomUUID().toString(); String type = "testAggregate"; DomainEventMessage event1 = new GenericDomainEventMessage<>(type, aggregateIdentifier, 0L, "Mock contents", MetaData.emptyInstance()); DomainEventMessage event2 = new GenericDomainEventMessage<>(type, aggregateIdentifier, 1L, "Mock contents", MetaData.emptyInstance()); when(mockEventStore.readEvents(aggregateIdentifier)).thenReturn(DomainEventStream.of(event1, event2)); }
Source:
<code>private static Integer getPlatFormOffset() { String currentOs = System.getProperty("os.name").toLowerCase(Locale.ROOT); String currentJdk = System.getProperty("java.version").toLowerCase(Locale.ROOT); for (int i = 0; i < PLATFORM_LIST.size(); i++) { if (currentOs.toLowerCase(Locale.ROOT).contains(PLATFORM_LIST.get(i).split(",")[0].toLowerCase(Locale.ROOT)) && currentJdk.toLowerCase(Locale.ROOT).contains( PLATFORM_LIST.get(i).split(",")[1].toLowerCase(Locale.ROOT))) { return i; } } <START> return null; <END> }</code><technical_language>Throw exception log error including currentOs currentJdk. Returning null a NPE upstream OS, JDK name caused it</technical_language>

Target:
private static Integer getPlatFormOffset() { ClientLogger logger = new ClientLogger(TestBase.class); String currentOs = System.getProperty("os.name").toLowerCase(Locale.ROOT); logger.info("It is currently running on os: " + currentOs); String currentJdk = System.getProperty("java.version").toLowerCase(Locale.ROOT); logger.info("It is using jdk: " + currentJdk); for (int i = 0; i < PLATFORM_LIST.size(); i++) { if (isCurrentPlatformIncluded(currentOs, currentJdk, i)) { return i; } } throw new RuntimeException(String.format("Not running on the expected platform. os: %s, jdk: %s", currentOs, currentJdk)); }
Source:
<code>public void subscribeUnsubscribe() throws Exception { final Postman postman = Mockito.mock(Postman.class); final DyBase base = new DyBase(); final Alias alias = new EmAlias(this.randomAlias(base), postman); final Bout bout = alias.inbox().bout(alias.inbox().start()); final Alias friend = this.randomAlias(base); bout.friends().invite(friend.name()); final ArgumentCaptor<Envelope> captor = ArgumentCaptor.forClass(Envelope.class); friend.inbox().bout(bout.number()).subscribe(false); bout.messages().post(DON_T_SEND_IT); friend.inbox().bout(bout.number()).subscribe(true); bout.messages().post(SEND_IT); bout.messages().post(SEND_IT); friend.inbox().bout(bout.number()).subscribe(false); bout.messages().post(DON_T_SEND_IT); Mockito.verify(postman, Mockito.times(2)).send(captor.capture()); final List<Envelope> messages = captor.getAllValues(); for (final Envelope envelope : messages) { final ByteArrayOutputStream baos = new ByteArrayOutputStream(); MimeMultipart.class.cast(envelope.unwrap().getContent()) .writeTo(baos); MatcherAssert.assertThat( baos.toString(), Matchers.containsString( <START> SEND_IT <END> ) ); } }</code><technical_language>@pecko assert other string</technical_language>

Target:
public void subscribeUnsubscribe() throws Exception { final Postman postman = Mockito.mock(Postman.class); final DyBase base = new DyBase(); final Alias alias = new EmAlias(this.getAlias(base, 26, 6), postman); final Bout bout = alias.inbox().bout(alias.inbox().start()); final Alias friend = this.getAlias(base, 20, 1); bout.friends().invite(friend.name()); final ArgumentCaptor<Envelope> captor = ArgumentCaptor.forClass(Envelope.class); friend.inbox().bout(bout.number()).subscribe(false); final String dontsend = "don't send it"; bout.messages().post(dontsend); friend.inbox().bout(bout.number()).subscribe(true); final String send = "send it"; bout.messages().post(send); bout.messages().post(send); friend.inbox().bout(bout.number()).subscribe(false); bout.messages().post(dontsend); Mockito.verify(postman, Mockito.times(2)).send(captor.capture()); final List<Envelope> messages = captor.getAllValues(); for (final Envelope envelope : messages) { final ByteArrayOutputStream baos = new ByteArrayOutputStream(); MimeMultipart.class.cast(envelope.unwrap().getContent()) .writeTo(baos); MatcherAssert.assertThat( baos.toString(), Matchers.not(Matchers.containsString(dontsend)) ); MatcherAssert.assertThat( baos.toString(), Matchers.containsString(send) ); } }
Source:
<code>public Ban.Builder profile(org.spongepowered.api.profile.GameProfile profile) { checkNotNull(profile, "Profile cannot be null!"); <START> checkState(banType == BanTypes.PROFILE, "Cannot set a GameProfile if the BanType is not BanType.USER_BAN!"); <END> this.profile = profile; return this; }</code><technical_language>Message needs updating</technical_language>

Target:
public Ban.Builder profile(org.spongepowered.api.profile.GameProfile profile) { checkNotNull(profile, "Profile cannot be null!"); checkState(banType == BanTypes.PROFILE, "Cannot set a GameProfile if the BanType is not BanTypes.PROFILE!"); this.profile = profile; return this; }
Source:
<code>public void removeListener() { View view = getView(); if (view != null) { getDiagramEventBroker().removeNotificationListener(view, this); if (hostSemanticElement != null) { for (EObject stereotypeApplication : hostSemanticElement.getStereotypeApplications()) { getDiagramEventBroker().removeNotificationListener(stereotypeApplication, this); } getDiagramEventBroker().removeNotificationListener(hostSemanticElement, this); hostSemanticElement = null; } } if (!stereotypeList.isEmpty()) { for (Stereotype stereotype : stereotypeList) { View label = helper.getStereotypeLabel(hostView, stereotype); if (null != label) { getDiagramEventBroker().removeNotificationListener(label, this); } BasicCompartment compartment = helper.getStereotypeBraceCompartment(hostView, stereotype); <START> if (compartment != null) { <END> getDiagramEventBroker().addNotificationListener(helper.getStereotypeBraceCompartment(hostView, stereotype), this); } if (compartment != null && stereotype != null) { EList<Property> properties = stereotype.allAttributes(); for (Property property : properties) { getDiagramEventBroker().removeNotificationListener(helper.getStereotypePropertyInBrace(hostView, stereotype, property), this); } } } } }</code><technical_language>'null !=' is preferably</technical_language>

Target:
public void removeListener() { View view = getView(); if (null != view) { getDiagramEventBroker().removeNotificationListener(view, this); if (null != hostSemanticElement) { for (EObject stereotypeApplication : hostSemanticElement.getStereotypeApplications()) { getDiagramEventBroker().removeNotificationListener(stereotypeApplication, this); } getDiagramEventBroker().removeNotificationListener(hostSemanticElement, this); hostSemanticElement = null; } } if (!stereotypeList.isEmpty()) { for (Stereotype stereotype : stereotypeList) { View label = helper.getStereotypeLabel(hostView, stereotype); if (null != label) { getDiagramEventBroker().removeNotificationListener(label, this); } BasicCompartment compartment = helper.getStereotypeBraceCompartment(hostView, stereotype); if (null != compartment) { getDiagramEventBroker().addNotificationListener(helper.getStereotypeBraceCompartment(hostView, stereotype), this); } if (null != compartment && null != stereotype) { EList<Property> properties = stereotype.allAttributes(); for (Property property : properties) { getDiagramEventBroker().removeNotificationListener(helper.getStereotypePropertyInBrace(hostView, stereotype, property), this); } } } } }
Source:
<code>protected void reinitAllDatabases() throws IOException { boolean acquired = false; try { semaphore.acquire(Integer.MAX_VALUE); acquired = true; try { db.close(); } catch (IOException e) { log.warnUnableToCloseDb(e); } try { expiredDb.close(); } catch (IOException e) { log.warnUnableToCloseExpiredDb(e); } } catch (InterruptedException e) { log.warnUnableToCloseDb(e); log.warnUnableToCloseExpiredDb(e); } db = reinitDatabase(getQualifiedLocation(), dataDbOptions()); expiredDb = reinitDatabase(getQualifiedExpiredLocation(), expiredDbOptions()); if (acquired) { <START> semaphore.release(Integer.MAX_VALUE); <END> } }</code><technical_language>This done in a proper try finally block. If a reinitDatabase method threw IOException semaphore irreparably broken</technical_language>

Target:
protected void reinitAllDatabases() throws IOException { try { semaphore.acquire(Integer.MAX_VALUE); } catch (InterruptedException e) { throw new PersistenceException("Cannot acquire semaphore", e); } try { if (stopped) { throw new PersistenceException("LevelDB is stopped"); } try { db.close(); } catch (IOException e) { log.warnUnableToCloseDb(e); } try { expiredDb.close(); } catch (IOException e) { log.warnUnableToCloseExpiredDb(e); } db = reinitDatabase(getQualifiedLocation(), dataDbOptions()); expiredDb = reinitDatabase(getQualifiedExpiredLocation(), expiredDbOptions()); } finally { semaphore.release(Integer.MAX_VALUE); } }
Source:
<code>public MatchClause append(Filter filter) { if (clause == null) { clause = new StringBuilder("MATCH (n)"); <START> if (filter.getRelationshipDirection().equals(Direction.INCOMING)) { <END> clause.append("<"); } clause.append(String.format("-[%s:`%s`]-", relationshipIdentifier(), this.relationshipType)); if (filter.getRelationshipDirection().equals(Direction.OUTGOING)) { clause.append(">"); } clause.append(String.format("(%s) ", nodeIdentifier())); } clause.append(filter.toCypher(relationshipIdentifier(), clause.indexOf(" WHERE ") == -1)); return this; }</code><technical_language>suggestion if (filter.getRelationshipDirection() == Direction.INCOMING) {</technical_language>

Target:
public MatchClause append(Filter filter) { if (clause == null) { clause = new StringBuilder("MATCH (n)"); if (filter.getRelationshipDirection() == Direction.INCOMING) { clause.append("<"); } clause.append(String.format("-[%s:`%s`]-", relationshipIdentifier(), this.relationshipType)); if (filter.getRelationshipDirection() == Direction.OUTGOING) { clause.append(">"); } clause.append(String.format("(%s) ", nodeIdentifier())); } clause.append(filter.toCypher(relationshipIdentifier(), clause.indexOf(" WHERE ") == -1)); return this; }
Source:
<code>public static AdjustableSweepBatchConfigSource create( MetricsManager metricsManager, Supplier<SweepBatchConfig> rawSweepBatchConfig) { AdjustableSweepBatchConfigSource configSource = new AdjustableSweepBatchConfigSource(rawSweepBatchConfig); Gauge<Double> gauge = AdjustableSweepBatchConfigSource::getBatchSizeMultiplier; metricsManager.addMetricFilter(AdjustableSweepBatchConfigSource.class, "batchSizeMultiplier", ImmutableMap.of(), <START> () -> gauge.getValue() != 1.0); <END> metricsManager.registerMetric(AdjustableSweepBatchConfigSource.class, "batchSizeMultiplier", gauge); return configSource; }</code><technical_language>I confused b/w description implementation of filter here</technical_language>

Target:
public static AdjustableSweepBatchConfigSource create( MetricsManager metricsManager, Supplier<SweepBatchConfig> rawSweepBatchConfig) { AdjustableSweepBatchConfigSource configSource = new AdjustableSweepBatchConfigSource(rawSweepBatchConfig); Gauge<Double> gauge = AdjustableSweepBatchConfigSource::getBatchSizeMultiplier; metricsManager.addMetricFilter(AdjustableSweepBatchConfigSource.class, "batchSizeMultiplier", ImmutableMap.of(), () -> gauge.getValue() < 1.0); metricsManager.registerMetric(AdjustableSweepBatchConfigSource.class, "batchSizeMultiplier", gauge); return configSource; }
Source:
<code>public void configure(Binder binder) { JsonConfigProvider.bind(binder, "druid.metadata.storage.tables", MetadataStorageTablesConfig.class); JsonConfigProvider.bind(binder, "druid.metadata.storage.connector", MetadataStorageConnectorConfig.class); JsonConfigProvider.bind(binder, "druid.manager.segments", MetadataSegmentManagerConfig.class); JsonConfigProvider.bind(binder, "druid.manager.rules", MetadataRuleManagerConfig.class); binder.bind(PasswordProvider.class).toProvider( new Provider<PasswordProvider>() { @Inject MetadataStorageConnectorConfig metadataStorageConnectorConfig; @Inject Injector injector; @Override public PasswordProvider get() { final PasswordProvider passwordProvider; if (metadataStorageConnectorConfig == null || metadataStorageConnectorConfig.getPasswordProvider() == null) { JsonConfigProvider<PasswordProvider> provider = JsonConfigProvider.of("druid.password", PasswordProvider.class); provider.inject(injector.getInstance(Properties.class), injector.getInstance(JsonConfigurator.class)); <START> passwordProvider = provider.get().get(); <END> } else { passwordProvider = metadataStorageConnectorConfig.getPasswordProvider(); } injector.injectMembers(passwordProvider); return passwordProvider; } } ); }</code><technical_language>Logging helpful warn users this happen</technical_language>

Target:
public void configure(Binder binder) { JsonConfigProvider.bind(binder, "druid.metadata.storage.tables", MetadataStorageTablesConfig.class); JsonConfigProvider.bind(binder, "druid.metadata.storage.connector", MetadataStorageConnectorConfig.class); JsonConfigProvider.bind(binder, "druid.manager.segments", MetadataSegmentManagerConfig.class); JsonConfigProvider.bind(binder, "druid.manager.rules", MetadataRuleManagerConfig.class); }
Source:
<code><START> public void testMigrationTask() throws InterruptedException { <END> MigrationTask migrationTask = new MigrationTask(project); migrationTask.start(); Assert.assertTrue(migrationTask.isAlive()); migrationTask.join(); Assert.assertFalse(migrationTask.isAlive()); Assert.assertEquals(100, migrationTask.getProgress()); }</code><technical_language>test test, if metadata is migrated ;-)</technical_language>

Target:
public void testMigrationTask() throws Exception { MigrationTask migrationTask = new MigrationTask(project); Field dataEditorServiceField = ServiceManager.class.getDeclaredField("dataEditorService"); dataEditorServiceField.setAccessible(true); Assert.assertTrue(Objects.isNull(dataEditorServiceField.get(null))); migrationTask.start(); Assert.assertTrue(migrationTask.isAlive()); migrationTask.join(); Assert.assertTrue(Objects.nonNull(dataEditorServiceField.get(null))); Assert.assertFalse(migrationTask.isAlive()); Assert.assertEquals(100, migrationTask.getProgress()); Assert.assertNotNull("Process migration failed", metsService.loadWorkpiece(processService.getMetadataFileUri(processService.getById(2)))); }
Source:
<code>protected Object toNSCollection(ERXRestFormat.Delegate delegate, NSMutableDictionary<Object, Object> associatedObjects) { Object result = associatedObjects.get(_associatedObject); if (result == null) { if (delegate != null) { delegate.nodeWillWrite(this); } if (isArray()) { NSMutableArray<Object> array = new NSMutableArray<Object>(); for (ERXRestRequestNode child : _children) { array.add(child.toNSCollection(delegate, associatedObjects)); } result = array; } else if (isNull()) { result = NSKeyValueCoding.NullValue; } else if (_value != null) { result = _value; } else { NSMutableDictionary<Object, Object> dict = new NSMutableDictionary<Object, Object>(); for (Map.Entry<String, Object> attribute : _attributes.entrySet()) { String key = attribute.getKey(); Object value = attribute.getValue(); if (value == null) { value = NSKeyValueCoding.NullValue; } dict.put(key, value); } for (ERXRestRequestNode child : _children) { String name = child.name(); Object value = child.toNSCollection(delegate, associatedObjects); <START> if (value != NSKeyValueCoding.NullValue || ERXProperties.booleanForKeyWithDefault("ERXRest.includeNullValues", true) == true) { <END> dict.put(name, value); } } if (dict.isEmpty()) { result = NSKeyValueCoding.NullValue; } else { result = dict; } } if (_associatedObject != null) { associatedObjects.put(_associatedObject, result); } } return result; }</code><technical_language>_== true_ part is needed booleanForKeyWithDefault returns a boolean ;)</technical_language>

Target:
protected Object toNSCollection(ERXRestFormat.Delegate delegate, NSMutableDictionary<Object, Object> associatedObjects) { Object result = associatedObjects.get(_associatedObject); if (result == null) { if (delegate != null) { delegate.nodeWillWrite(this); } if (isArray()) { NSMutableArray<Object> array = new NSMutableArray<Object>(); for (ERXRestRequestNode child : _children) { array.add(child.toNSCollection(delegate, associatedObjects)); } result = array; } else if (isNull()) { result = NSKeyValueCoding.NullValue; } else if (_value != null) { result = _value; } else { NSMutableDictionary<Object, Object> dict = new NSMutableDictionary<Object, Object>(); for (Map.Entry<String, Object> attribute : _attributes.entrySet()) { String key = attribute.getKey(); Object value = attribute.getValue(); if (value == null) { value = NSKeyValueCoding.NullValue; } dict.put(key, value); } for (ERXRestRequestNode child : _children) { String name = child.name(); Object value = child.toNSCollection(delegate, associatedObjects); if (value != NSKeyValueCoding.NullValue || ERXProperties.booleanForKeyWithDefault("ERXRest.includeNullValues", true)) { dict.put(name, value); } } if (dict.isEmpty()) { result = NSKeyValueCoding.NullValue; } else { result = dict; } } if (_associatedObject != null) { associatedObjects.put(_associatedObject, result); } } return result; }
Source:
<code>public User addUserToProject(final Project project, final Account account, final Role... userRoles) { notNull(project, "project"); notNull(account, "account"); notEmpty(account.getUri(), "account.uri"); notNull(userRoles, "userRoles"); validateRoleURIs(userRoles); <START> noNullElements(Arrays.stream(userRoles).map(Role::getUri).collect(Collectors.toList()), "userRoles.uri"); <END> notEmpty(project.getId(), "project.id"); final User user = new User(account, userRoles); doPostProjectUsersUpdate(project, user); return getUser(project, account); }</code><technical_language>redundant check</technical_language>

Target:
public User addUserToProject(final Project project, final Account account, final Role... userRoles) { notNull(project, "project"); notNull(account, "account"); notEmpty(account.getUri(), "account.uri"); notNull(userRoles, "userRoles"); validateRoleURIs(userRoles); notEmpty(project.getId(), "project.id"); final User user = new User(account, userRoles); doPostProjectUsersUpdate(project, user); return getUser(project, account); }
Source:
<code>public void testDeadlock() throws Exception { doTest(1000 * 30); boolean <START> interrupted = <END> Thread.interrupted(); if (interrupted) { fail("Thread was interrupted at end of test"); } }</code><technical_language>inline this variable</technical_language>

Target:
public void testDeadlock() throws Exception { doTest(1000 * 30); if (Thread.interrupted()) { fail("Thread was interrupted at end of test"); } }
Source:
<code>public void makeSortable() { final Map<ImageResource, Integer> imageWeightMap = new HashMap<ImageResource, Integer>(); imageWeightMap.put(statusCell.upImage, 0); imageWeightMap.put(statusCell.volumeSomeBricksDownImage, 1); imageWeightMap.put(statusCell.allBricksDownImage, 2); imageWeightMap.put(statusCell.downImage, 3); makeSortable(new Comparator<GlusterVolumeEntity>() { private final CustomStatusImageComaparator imageComparator = new CustomStatusImageComaparator(imageWeightMap); @Override public int compare(GlusterVolumeEntity o1, GlusterVolumeEntity o2) { <START> return imageComparator.compare(statusCell.getStatusImage(statusCell.getVolumeStatus(o1)), statusCell.getStatusImage(statusCell.getVolumeStatus(o2))); <END> } }); }</code><technical_language>recalculating volume status here</technical_language>

Target:
public void makeSortable() { makeSortable(new Comparator<GlusterVolumeEntity>() { private final CustomStatusImageComaparator imageComparator = new CustomStatusImageComaparator(); @Override public int compare(GlusterVolumeEntity o1, GlusterVolumeEntity o2) { return imageComparator.compare(VolumeStatusCell.getVolumeStatus(o1), VolumeStatusCell.getVolumeStatus(o2)); } }); }
Source:
<code>public GoldenEgg(UUID ownerId, CardSetInfo setInfo) { super(ownerId, setInfo, new CardType[]{CardType.ARTIFACT}, "{2}"); this.subtype.add(SubType.FOOD); this.addAbility(new EntersBattlefieldTriggeredAbility(new DrawCardSourceControllerEffect(1))); Ability ability = new AnyColorManaAbility(new GenericManaCost(1)); ability.addCost(new TapSourceCost()); ability.addCost(new SacrificeSourceCost()); this.addAbility(ability); <START> Ability ability1 = new SimpleActivatedAbility(Zone.BATTLEFIELD, new GainLifeEffect(3), new ManaCostsImpl("{1}")); <END> ability1.addCost(new TapSourceCost()); ability1.addCost(new SacrificeSourceCost()); this.addAbility(ability1); }</code><technical_language>Costs 2</technical_language>

Target:
public GoldenEgg(UUID ownerId, CardSetInfo setInfo) { super(ownerId, setInfo, new CardType[]{CardType.ARTIFACT}, "{2}"); this.subtype.add(SubType.FOOD); this.addAbility(new EntersBattlefieldTriggeredAbility(new DrawCardSourceControllerEffect(1))); Ability ability = new AnyColorManaAbility(new GenericManaCost(1)); ability.addCost(new TapSourceCost()); ability.addCost(new SacrificeSourceCost()); this.addAbility(ability); Ability ability1 = new SimpleActivatedAbility(Zone.BATTLEFIELD, new GainLifeEffect(3), new ManaCostsImpl("{2}")); ability1.addCost(new TapSourceCost()); ability1.addCost(new SacrificeSourceCost()); this.addAbility(ability1); }
Source:
<code>public void unparse(SqlWriter writer, int leftPrec, int rightPrec) { writer.keyword("CREATE"); if (isTemporary()) { writer.keyword("TEMPORARY"); } <START> if (getReplace()) { writer.keyword("OR REPLACE"); } <END> writer.keyword("VIEW"); if (isIfNotExists()) { writer.keyword("IF NOT EXISTS"); } viewName.unparse(writer, leftPrec, rightPrec); if (fieldList.size() > 0) { fieldList.unparse(writer, 1, rightPrec); } if (comment != null) { writer.newlineAndIndent(); writer.keyword("COMMENT"); comment.unparse(writer, leftPrec, rightPrec); } writer.newlineAndIndent(); writer.keyword("AS"); writer.newlineAndIndent(); query.unparse(writer, leftPrec, rightPrec); }</code><technical_language>remove this</technical_language>

Target:
public void unparse(SqlWriter writer, int leftPrec, int rightPrec) { writer.keyword("CREATE"); if (isTemporary()) { writer.keyword("TEMPORARY"); } writer.keyword("VIEW"); if (isIfNotExists()) { writer.keyword("IF NOT EXISTS"); } viewName.unparse(writer, leftPrec, rightPrec); if (fieldList.size() > 0) { fieldList.unparse(writer, 1, rightPrec); } if (comment != null) { writer.newlineAndIndent(); writer.keyword("COMMENT"); comment.unparse(writer, leftPrec, rightPrec); } writer.newlineAndIndent(); writer.keyword("AS"); writer.newlineAndIndent(); query.unparse(writer, leftPrec, rightPrec); }
Source:
<code>public void testValidCRAMFileWithoutSeqDict() throws Exception { final SamReader samReader = SamReaderFactory. makeDefault(). validationStringency(ValidationStringency.SILENT). referenceSequence(new File(TEST_DATA_DIR, "nm_tag_validation.fa")). open(new File(TEST_DATA_DIR, "nm_tag_validation.cram")); <START> final ReferenceSequenceFile reference = new FastaSequenceFile(new File(TEST_DATA_DIR, "nm_tag_validation.fa"), true); <END> final Histogram<String> results = executeValidation(samReader, reference, IndexValidationStringency.EXHAUSTIVE); Assert.assertTrue(!results.isEmpty()); }</code><technical_language>is index/dictionary involved: final ReferenceSequenceFile reference = new FastaSequenceFile(new File(TEST_DATA_DIR, "nm_tag_validation.fa"), true); final SamReader samReader = SamReaderFactory. makeDefault(). validationStringency(ValidationStringency.SILENT). referenceSource(new ReferenceSource(reference)). ..</technical_language>

Target:
public void testValidCRAMFileWithoutSeqDict() throws Exception { final File reference = new File(TEST_DATA_DIR, "nm_tag_validation.fa"); final SamReader samReader = SamReaderFactory .makeDefault() .validationStringency(ValidationStringency.SILENT) .referenceSequence(reference) .open(new File(TEST_DATA_DIR, "nm_tag_validation.cram")); final Histogram<String> results = executeValidation(samReader, new FastaSequenceFile(reference, true), IndexValidationStringency.EXHAUSTIVE); Assert.assertTrue(!results.isEmpty()); }
Source:
<code>public void cleanup() { if (model != null) { model.cleanup(); model = null; } <START> if (modelItems != null) { for (T model: modelItems) { if (model instanceof HasCleanup) { ((HasCleanup)model).cleanup(); } } } <END> for (Pair<T, V> item : items) { T value = item.getFirst(); if (!isGhost(value)) { if (item instanceof HasCleanup) { ((HasCleanup)value).cleanup(); } } } cleanContentPanel(); }</code><technical_language>do list, missed it</technical_language>

Target:
public void cleanup() { if (model != null) { model.cleanup(); model = null; } cleanupModelItems(); for (Pair<T, V> item : items) { T value = item.getFirst(); if (!isGhost(value)) { if (item instanceof HasCleanup) { ((HasCleanup)value).cleanup(); } } } cleanContentPanel(); }
Source:
<code>public String get(String name) { <START> return (isSet(name)) ? myRecord.get(name) : new String(); <END> }</code><technical_language>return "" instead of new String()</technical_language>

Target:
public String get(String name) { return (isSet(name)) ? myRecord.get(name) : ""; }
Source:
<code>private void updateMutePreviewOverlayVisibility() { mutePreviewOverlay.setVisibility( <START> showMuteOverlayOnVideoCall() && muteButton.isChecked() && !isInGreenScreenMode <END> ? View.VISIBLE : View.GONE); }</code><technical_language>a tiny thing, I guess move condition assign statement, easier read conditional expression is complex now. int mutePreviewOverlayVisibility = showMuteOverlayOnVideoCall() && muteButton.isChecked() && !isInGreenScreenMode ? View.VISIBLE : View.GONE; mutePreviewOverlay.setVisibility(mutePreviewOverlayVisibility);</technical_language>

Target:
private void updateMutePreviewOverlayVisibility() { int mutePreviewOverlayVisibility = showMuteOverlayOnVideoCall() && muteButton.isChecked() && !isInGreenScreenMode ? View.VISIBLE : View.GONE; mutePreviewOverlay.setVisibility(mutePreviewOverlayVisibility); }
Source:
<code>public void resetAllResponses() { for (FeedbackQuestionAttributes question : questionResponseBundle.keySet()) { <START> questionResponseBundle.putIfAbsent(question, new ArrayList<>()); <END> } }</code><technical_language>emmmm i dont feel this replacement is necessary...and change code intends do, put replace question if question is a value, putIfAbsent associate question new ArrayList<>() if question is anything</technical_language>

Target:
public void resetAllResponses() { for (FeedbackQuestionAttributes question : questionResponseBundle.keySet()) { questionResponseBundle.put(question, new ArrayList<FeedbackResponseAttributes>()); } }
Source:
<code>protected URLConnection getExternalGraphic(AjaxRequestTarget target, Form<?> form) { onlineResource.processInput(); if (onlineResource.getModelObject() != null) { URL url = null; try { String baseUrl = baseURL(form); String external = onlineResource.getModelObject().toString(); URI uri = new URI( external ); if( uri.isAbsolute() ){ url = uri.toURL(); if( !external.startsWith(baseUrl)){ form.warn( "Recommend use of styles directory at "+baseUrl); } } else { <START> url = new URL( baseUrl + "styles/"+external ); <END> } URLConnection conn = url.openConnection(); if("text/html".equals(conn.getContentType())){ form.error("Unable to access url"); return null; } return conn; } catch (FileNotFoundException notFound ){ form.error( "Unable to access "+url); } catch (Exception e) { e.printStackTrace(); form.error( "Recommend use of styles directory at "+e); } } return null; }</code><technical_language>This logic changes a bit due <LINK_0></technical_language>

Target:
protected URLConnection getExternalGraphic(AjaxRequestTarget target, Form<?> form) { onlineResource.processInput(); if (onlineResource.getModelObject() != null) { URL url = null; try { String baseUrl = baseURL(form); String external = onlineResource.getModelObject().toString(); URI uri = new URI( external ); if( uri.isAbsolute() ){ url = uri.toURL(); if( !external.startsWith(baseUrl)){ form.warn( "Recommend use of styles directory at "+baseUrl); } } else { WorkspaceInfo wsInfo = ((StyleInfo)getDefaultModelObject()).getWorkspace(); if (wsInfo != null) { url = new URL( baseUrl + "styles/"+wsInfo.getName()+"/"+external ); } else { url = new URL( baseUrl + "styles/"+external ); } } URLConnection conn = url.openConnection(); if("text/html".equals(conn.getContentType())){ form.error("Unable to access url"); return null; } return conn; } catch (FileNotFoundException notFound ){ form.error( "Unable to access "+url); } catch (Exception e) { e.printStackTrace(); form.error( "Recommend use of styles directory at "+e); } } return null; }
Source:
<code>private void loadButtonAction(ActionEvent e) { progressDialog = new ProgressDialog(list.getParent()); if (dbpath == SELECT_OPTION) { <START> File dir = selectDirectory(); <END> if (dir == null) { return; } } dbload.restart(); }</code><technical_language>If dir is anywhere, do if (selectDirectory() == null)</technical_language>

Target:
private void loadButtonAction(ActionEvent e) { loadDB(); }
Source:
<code>public Single<String> getP18ForItem(String entityId) { return depictsInterface.getLabelForEntity(entityId) .map(response -> { String name; try { JsonObject claims = response.getAsJsonObject("claims").getAsJsonObject(); <START> JsonObject P18 = claims.get("P18").getAsJsonArray().get(0).getAsJsonObject(); <END> JsonObject mainsnak = P18.get("mainsnak").getAsJsonObject(); JsonObject datavalue = mainsnak.get("datavalue").getAsJsonObject(); JsonPrimitive value = datavalue.get("value").getAsJsonPrimitive(); name = value.toString(); name = name.substring(1, name.length() - 1); } catch (Exception e) { name=""; } if (!name.isEmpty()){ return getImageUrl(name); } else return "No Image for Depiction"; }) .singleOrError(); }</code><technical_language>Java convention for a variable p18 lowercase</technical_language>

Target:
public Single<String> getP18ForItem(String entityId) { return depictsInterface.getImageForEntity(entityId) .map(commonsFilename -> { String name; try { JsonObject claims = commonsFilename.getAsJsonObject("claims").getAsJsonObject(); JsonObject p18 = claims.get("P18").getAsJsonArray().get(0).getAsJsonObject(); JsonObject mainsnak = p18.get("mainsnak").getAsJsonObject(); JsonObject datavalue = mainsnak.get("datavalue").getAsJsonObject(); JsonPrimitive value = datavalue.get("value").getAsJsonPrimitive(); name = value.toString(); name = name.substring(1, name.length() - 1); } catch (Exception e) { name=""; } if (!name.isEmpty()){ return getThumbnailUrl(name); } else return NO_DEPICTED_IMAGE; }) .singleOrError(); }
Source:
<code>public String getServerState() { this.officeServer.refreshState(); <START> return contextualLocalizationManager.getTranslationPlain( <END> TRANSLATION_KEY_SERVER_STATE_PREFIX + this.officeServer.getState().name().toLowerCase()); }</code><technical_language>Small detail: missing this.. line replaced for ex</technical_language>

Target:
public String getServerState() { this.officeServer.refreshState(); String normalizedStatusKey = CaseUtils.toCamelCase(this.officeServer.getState().name().toLowerCase(), false, '_'); return this.contextualLocalizationManager .getTranslationPlain(TRANSLATION_KEY_SERVER_STATE_PREFIX + normalizedStatusKey); }
Source:
<code>public void visitToken(DetailAST token) { switch (token.getType()) { <START> case TokenTypes.INTERFACE_DEF: <END> checkServiceInterface(token); break; default: break; } }</code><technical_language>is case here. replace this switch statement if</technical_language>

Target:
public void visitToken(DetailAST token) { if (token.getType() == TokenTypes.INTERFACE_DEF) { checkServiceInterface(token); } }
Source:
<code>public DeCoupleMBusDeviceCommandExecutor() { <START> super(MbusChannelElementsDto.class); <END> }</code><technical_language>class passed super constructor MbusChannelElementsDto. I cleanest pass DecoupleMbusDto.class (and DecoupleMbusDto implement ActionRequestDto)</technical_language>

Target:
public DeCoupleMBusDeviceCommandExecutor() { super(DeCoupleMbusDeviceDto.class); }
Source:
<code>public ServerWebSocketInitializer(final ServerInfo serverInfo) { <START> LOG.info("Currently time out time is not used " + serverInfo.getTimeOut()); <END> this.serverInfo = serverInfo; connectionServer = createServerSocket(); manager = createConnectionManager(getServerInfo()); }</code><technical_language>Colon "used"</technical_language>

Target:
public ServerWebSocketInitializer(final ServerInfo serverInfo) { LOG.info("Currently time out time is not used: " + serverInfo.getTimeOut()); this.serverInfo = serverInfo; connectionServer = createServerSocket(); manager = createConnectionManager(getServerInfo()); }
Source:
<code>public ArrayList<OncoTreeNode> getOncoTree(Version version) throws TopBraidException { <START> ArrayList<OncoTreeNode> list = new ArrayList<OncoTreeNode>(super.query(String.format(query, version.getGraphURI()), new ParameterizedTypeReference<List<OncoTreeNode>>(){})); <END> return list; }</code><technical_language>I guess getOncoTree() returns List<OncoTreeNode> return ArrayList<OncoTreeNode> ? Still, need create a named variable .. do: return new ArrayList<OncoTreeNode>(super.query ...</technical_language>

Target:
public ArrayList<OncoTreeNode> getOncoTree(Version version) throws TopBraidException { return new ArrayList<OncoTreeNode>(super.query(String.format(query, version.getGraphURI()), new ParameterizedTypeReference<List<OncoTreeNode>>(){})); }
Source:
<code>public void doSample() { <START> sendData(pm.isScreenOn()?"on":"off"); <END> }</code><technical_language>@orhan89 while add it, do a API version check isInteractive() if available?<LINK_0></technical_language>

Target:
public void doSample() { boolean isScreenActive; if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.KITKAT_WATCH) { isScreenActive = pm.isInteractive(); } else { isScreenActive = pm.isScreenOn(); } sendData(isScreenActive?"on":"off"); }
Source:
<code><START> public Configuration setDefaults(Configuration defaults) <END> { this.defaults = defaults; return this; }</code><technical_language>I suggest check defaults != this setting</technical_language>

Target:
public Configuration setDefaults(Configuration defaults) { if ( defaults == this ) { throw new IllegalArgumentException( "Can't set self as defaults" ); } this.defaults = defaults; return this; }
Source:
<code>public void refreshMetadata(String username) { if (mNosaraClient == null) { return; } if (!TextUtils.isEmpty(username)) { mUserName = username; if (getAnonID() != null) { <START> mNosaraClient.trackAliasUser(mUserName, getAnonID()); <END> clearAnonID(); } } else { mUserName = null; if (getAnonID() == null) { generateNewAnonID(); } } }</code><technical_language>is a problem :cry: :disappointed: need change library trackaliasUser TracksClient.NosaraUserType.WPCOM (wpcom:user_id) internally. add another trackaliasUser method takes userType parameter...</technical_language>

Target:
public void refreshMetadata(String username) { if (mNosaraClient == null) { return; } if (!TextUtils.isEmpty(username)) { mUserName = username; if (getAnonID() != null) { mNosaraClient.trackAliasUser(mUserName, getAnonID(), TracksClient.NosaraUserType.SIMPLENOTE); clearAnonID(); } } else { mUserName = null; if (getAnonID() == null) { generateNewAnonID(); } } }
Source:
<code>private void removeHiddenInstructors(FeedbackQuestionAttributes question, List<FeedbackResponseAttributes> responses, Map<String, String> recipients, Set<String> hiddenInstructorEmails) { <START> boolean noChangeRequired = hiddenInstructorEmails == null <END> || hiddenInstructorEmails.isEmpty() || question.getRecipientType() != FeedbackParticipantType.INSTRUCTORS; if (noChangeRequired) { return; } for (String instructorEmail : hiddenInstructorEmails) { if (recipients.containsKey(instructorEmail)) { recipients.remove(instructorEmail); } Iterator<FeedbackResponseAttributes> iterResponse = responses.iterator(); while (iterResponse.hasNext()) { FeedbackResponseAttributes response = iterResponse.next(); if (response.recipientEmail.equals(instructorEmail)) { iterResponse.remove(); } } } }</code><technical_language>@unyoungwax, oops missed this, consider prefixing this boolean <code>is...</code></technical_language>

Target:
private void removeHiddenInstructors(FeedbackQuestionAttributes question, List<FeedbackResponseAttributes> responses, Map<String, String> recipients, Set<String> hiddenInstructorEmails) { boolean isNoChangeRequired = hiddenInstructorEmails == null || hiddenInstructorEmails.isEmpty() || question.getRecipientType() != FeedbackParticipantType.INSTRUCTORS; if (isNoChangeRequired) { return; } for (String instructorEmail : hiddenInstructorEmails) { if (recipients.containsKey(instructorEmail)) { recipients.remove(instructorEmail); } Iterator<FeedbackResponseAttributes> iterResponse = responses.iterator(); while (iterResponse.hasNext()) { FeedbackResponseAttributes response = iterResponse.next(); if (response.recipientEmail.equals(instructorEmail)) { iterResponse.remove(); } } } }
Source:
<code>private void cancelUpload(int localMediaId) { if (mCurrentUpload != null && mCurrentUpload.getId() == localMediaId) { cancelCurrentUpload(); } for(Iterator<MediaModel> i = mQueue.iterator(); i.hasNext();) { MediaModel mediaModel = i.next(); if (mediaModel.getId() == localMediaId) { <START> i.remove(); <END> } } }</code><technical_language>nitpicking: nice break loop</technical_language>

Target:
private void cancelUpload(int localMediaId) { if (mCurrentUpload != null && mCurrentUpload.getId() == localMediaId) { cancelCurrentUpload(); } for(Iterator<MediaModel> i = mUploadQueue.iterator(); i.hasNext();) { MediaModel mediaModel = i.next(); if (mediaModel.getId() == localMediaId) { i.remove(); } } }
Source:
<code>MergingUpdater(AbstractTripleStore database) { this.database = database; String property = <START> System.getProperty("outputDumps"); <END> outputDumps = Boolean.TRUE.toString().equals(property); id = UUID.randomUUID().toString().replaceAll("-", ""); }</code><technical_language>configuration injected, read system properties in constructor</technical_language>

Target:
MergingUpdater(AbstractTripleStore database) { this(database, false); }
Source:
<code><START> protected org.spine3.server.storage.EventStorage createStorage(StorageFactory factory) { <END> final RecordStorage<EventId> recordStorage = super.createStorage(factory); final org.spine3.server.storage.EventStorage storage = factory.createEventStorage(recordStorage); return storage; }</code><technical_language>avoid FQNs can</technical_language>

Target:
protected EventRecordStorage createStorage(StorageFactory factory) { final RecordStorage<EventId> recordStorage = super.createStorage(factory); final EventRecordStorage storage = factory.createEventStorage(recordStorage); return storage; }
Source:
<code>public int getLength() { Widget widget = getWidget(); int childCount = 0; if (widget instanceof Composite) { childCount = ((Composite) widget).getChildren().length; if (widget instanceof CTabFolder) { for (CTabItem tabItem : ((CTabFolder) widget).getItems()) { if (tabItem.isDisposed()) { <START> System.err.println("CTabItem was disposed"); <END> break; } else { childCount++; } } } } return childCount; }</code><technical_language>syserr out</technical_language>

Target:
public int getLength() { Widget widget = getWidget(); int childCount = 0; if (widget instanceof Composite) { childCount = ((Composite) widget).getChildren().length; if (widget instanceof CTabFolder) { for (CTabItem tabItem : ((CTabFolder) widget).getItems()) { if (tabItem.isDisposed()) { break; } else { childCount++; } } } } return childCount; }
Source:
<code>static org.ovirt.engine.core.common.businessentities.VM setUpEntityExpectations( org.ovirt.engine.core.common.businessentities.VM entity, VmStatistics statistics, int index) { expect(entity.getId()).andReturn(GUIDS[index]).anyTimes(); expect(entity.getvds_group_id()).andReturn(GUIDS[2]).anyTimes(); expect(entity.getvm_name()).andReturn(NAMES[index]).anyTimes(); expect(entity.getvm_description()).andReturn(DESCRIPTIONS[index]).anyTimes(); expect(entity.getnum_of_cpus()).andReturn(8).anyTimes(); expect(entity.getnum_of_sockets()).andReturn(2).anyTimes(); expect(entity.getusage_mem_percent()).andReturn(Integer.valueOf(20)).anyTimes(); expect(entity.getdisplay_type()).andReturn(DisplayType.vnc).anyTimes(); expect(entity.getdisplay_secure_port()).andReturn(5900).anyTimes(); expect(entity.getnum_of_monitors()).andReturn(2).anyTimes(); expect(entity.getvm_type()).andReturn(VmType.Server).anyTimes(); expect(entity.getrun_on_vds_name()).andReturn(NAMES[NAMES.length - 1]).anyTimes(); Map<String, DiskImage> diskImageMap = new HashMap<String, DiskImage>(); diskImageMap.put("1", new DiskImage()); expect(entity.getDiskMap()).andReturn(diskImageMap).anyTimes(); VmStatic vmStatic = new VmStatic(); vmStatic.setId(GUIDS[index]); vmStatic.setvm_name(NAMES[index]); <START> expect(entity.getStaticData()).andReturn(vmStatic).anyTimes(); <END> setUpStatisticalEntityExpectations(entity, statistics); return entity; }</code><technical_language>this expectations relevant for use-case only, need for tests them, please move method extend expectations for setUpEntityExpectations()</technical_language>

Target:
static org.ovirt.engine.core.common.businessentities.VM setUpEntityExpectations( org.ovirt.engine.core.common.businessentities.VM entity, VmStatistics statistics, int index) { expect(entity.getId()).andReturn(GUIDS[index]).anyTimes(); expect(entity.getvds_group_id()).andReturn(GUIDS[2]).anyTimes(); expect(entity.getvm_name()).andReturn(NAMES[index]).anyTimes(); expect(entity.getvm_description()).andReturn(DESCRIPTIONS[index]).anyTimes(); expect(entity.getnum_of_cpus()).andReturn(8).anyTimes(); expect(entity.getnum_of_sockets()).andReturn(2).anyTimes(); expect(entity.getusage_mem_percent()).andReturn(Integer.valueOf(20)).anyTimes(); expect(entity.getdisplay_type()).andReturn(DisplayType.vnc).anyTimes(); expect(entity.getdisplay_secure_port()).andReturn(5900).anyTimes(); expect(entity.getnum_of_monitors()).andReturn(2).anyTimes(); expect(entity.getvm_type()).andReturn(VmType.Server).anyTimes(); expect(entity.getrun_on_vds_name()).andReturn(NAMES[NAMES.length - 1]).anyTimes(); setUpStatisticalEntityExpectations(entity, statistics); return entity; }
Source:
<code>public List<String> getDirectory() throws OwException { List<String> directory = new ArrayList<String>(); OwserverPacket requestPacket = new OwserverPacket(OwserverMessageType.DIR, "/"); write(requestPacket); OwserverPacket returnPacket = null; do { try { returnPacket = read(false); } catch (OwException e) { <START> logger.info("getDirectory may have returned incomplete result: {}", e.getMessage()); <END> closeOnError(); return directory; } if (returnPacket.hasPayload()) { directory.add(returnPacket.getPayloadString()); } } while ((returnPacket.isPingPacket() || returnPacket.hasPayload())); if (!returnPacket.hasControlFlag(OwserverControlFlag.PERSISTENCE)) { logger.trace("closing connection because persistence was denied"); close(); } connectionErrorCounter = 0; return directory; }</code><technical_language>Is a software issue? do WARN include exception a param</technical_language>

Target:
public List<String> getDirectory() throws OwException { List<String> directory = new ArrayList<String>(); OwserverPacket requestPacket = new OwserverPacket(OwserverMessageType.DIR, "/"); write(requestPacket); OwserverPacket returnPacket = null; do { try { returnPacket = read(false); } catch (OwException e) { logger.debug("getDirectory may have returned incomplete result: {}", e.getMessage()); closeOnError(); return directory; } if (returnPacket.hasPayload()) { directory.add(returnPacket.getPayloadString()); } } while ((returnPacket.isPingPacket() || returnPacket.hasPayload())); if (!returnPacket.hasControlFlag(OwserverControlFlag.PERSISTENCE)) { logger.trace("closing connection because persistence was denied"); close(); } connectionErrorCounter = 0; return directory; }