auphong2707/dl4se-code-review-dataset huggingface dataset:
Source:
<code>public void shouldFindAllConstraints() throws Exception { try ( org.neo4j.graphdb.Transaction tx = graphDb.beginTx() ) { graphDb.schema().constraintFor( Label.label( "FOO" ) ).assertPropertyIsUnique( "prop1" ).create(); graphDb.schema().constraintFor( Label.label( "BAR" ) ).assertPropertyIsUnique( "prop2" ).create(); <START> graphDb.schema().constraintFor( Label.label( "BAZ" ) ).assertPropertyIsUnique( "prop3" ).create(); <END> tx.success(); } try ( Transaction tx = session.beginTransaction() ) { List<ConstraintDescriptor> constraints = asList( tx.schemaRead().constraintsGetAll( ) ); assertThat( constraints, hasSize( 3 ) ); } }</code><technical_language>add some existence node key constraints well, is some edition problem</technical_language>

Target:
public void shouldFindAllConstraints() throws Exception { addConstraints( "FOO", "prop1", "BAR", "prop2", "BAZ", "prop3" ); try ( Transaction tx = session.beginTransaction() ) { List<ConstraintDescriptor> constraints = asList( tx.schemaRead().constraintsGetAll() ); assertThat( constraints, hasSize( 3 ) ); } }
Source:
<code><START> public void init(Map<String, String> propertyMap) { <END> }</code><technical_language>throws TaskException is part of interface, remove it</technical_language>

Target:
public void init(Map<String, String> propertyMap) throws TaskException { }
Source:
<code>public void testSubOrganizationRename() { String organizationPath = NEW_PARENT_ORG_NAME + "/" + CHILD_ORG_NAME; <START> String path = NEW_PARENT_ORG_NAME + "/" + NEW_CHILD_ORG_NAME; <END> navigationBar.waitNavigationBar(); navigationBar.clickOnMenu(ORGANIZATIONS); organizationListPage.waitForOrganizationsToolbar(); organizationListPage.waitForOrganizationsList(); organizationListPage.clickOnOrganization(organizationPath); organizationPage.waitOrganizationTitle(organizationPath); organizationPage.setOrganizationName(NEW_CHILD_ORG_NAME); editMode.waitDisplayed(); assertTrue(editMode.isSaveEnabled()); editMode.clickSave(); editMode.waitHidden(); organizationPage.waitOrganizationTitle(path); assertEquals(organizationPage.getOrganizationName(), NEW_CHILD_ORG_NAME); organizationPage.clickBackButton(); organizationPage.waitOrganizationTitle(NEW_PARENT_ORG_NAME); organizationPage.clickSubOrganizationsTab(); organizationListPage.waitForOrganizationsList(); assertTrue(organizationListPage.getValues(NAME).contains(path)); organizationPage.clickBackButton(); organizationListPage.waitForOrganizationsList(); assertTrue(organizationListPage.getValues(NAME).contains(path)); assertTrue(organizationListPage.getValues(NAME).contains(NEW_PARENT_ORG_NAME)); }</code><technical_language><LINK_0></technical_language>

Target:
public void testSubOrganizationRename() { String suborganizationName = NEW_PARENT_ORG_NAME + "/" + CHILD_ORG_NAME; String newSubOrganizationName = NEW_PARENT_ORG_NAME + "/" + NEW_CHILD_ORG_NAME; navigationBar.waitNavigationBar(); navigationBar.clickOnMenu(ORGANIZATIONS); organizationListPage.waitForOrganizationsToolbar(); organizationListPage.waitForOrganizationsList(); organizationListPage.clickOnOrganization(suborganizationName); organizationPage.waitOrganizationTitle(suborganizationName); organizationPage.setOrganizationName(NEW_CHILD_ORG_NAME); editMode.waitDisplayed(); assertTrue(editMode.isSaveEnabled()); editMode.clickSave(); editMode.waitHidden(); organizationPage.waitOrganizationTitle(newSubOrganizationName); assertEquals(organizationPage.getOrganizationName(), NEW_CHILD_ORG_NAME); organizationPage.clickBackButton(); organizationPage.waitOrganizationTitle(NEW_PARENT_ORG_NAME); organizationPage.clickSubOrganizationsTab(); organizationListPage.waitForOrganizationsList(); assertTrue(organizationListPage.getValues(NAME).contains(newSubOrganizationName)); organizationPage.clickBackButton(); organizationListPage.waitForOrganizationsList(); assertTrue(organizationListPage.getValues(NAME).contains(newSubOrganizationName)); assertTrue(organizationListPage.getValues(NAME).contains(NEW_PARENT_ORG_NAME)); }
Source:
<code>public Promise<Collection<WorkItemDefinition>> call(final Metadata input) { return promises.create((success, failure) -> { resourceContentService.list("**/*.wid").then(paths -> { <START> if (paths.length > 0) { <END> String path = paths[0]; DomGlobal.console.log("Loading WIDs from " + path); resourceContentService.get(path).then(value -> { Collection<WorkItemDefinition> wids = parser.parse(value); wids.forEach(registry::register); success.onInvoke(wids); return null; }); } else { DomGlobal.console.log("No WIDs to load"); success.onInvoke(Collections.emptyList()); } return null; }); }); }</code><technical_language>service scope implementation I is kinda cache all, right? I mean, editing a process in VSCode, for example, performing service queries, obtain resource data, parse operations it, again, if work items project changed, right? complaining, fine for now, I understand add / remove work item definitions runtime, right? Anyway, jsut branistorming clarify behavior of implementations...</technical_language>

Target:
public Promise<Collection<WorkItemDefinition>> call(final Metadata input) { registry.clear(); return promises.create((success, failure) -> { resourceContentService.list("**/*.wid").then(paths -> { if (paths.length > 0) { String path = paths[0]; DomGlobal.console.log("Loading WIDs from " + path); resourceContentService.get(path).then(value -> { Collection<WorkItemDefinition> wids = parser.parse(value); wids.forEach(registry::register); success.onInvoke(wids); return null; }); } else { DomGlobal.console.log("No WIDs to load"); success.onInvoke(Collections.emptyList()); } return null; }); }); }
Source:
<code>protected void skipToNextSyncPoint(boolean atFirstRecord) throws IOException { LOG.debug("LzoProtobufBlockRecordReader.skipToNextSyncPoint called with atFirstRecord = " + atFirstRecord); updatePosition = !atFirstRecord; <START> LOG.debug("reset first record offset in skipToNextSyncPoint()"); <END> }</code><technical_language>is a debug message above</technical_language>

Target:
protected void skipToNextSyncPoint(boolean atFirstRecord) throws IOException { LOG.debug("LzoProtobufBlockRecordReader.skipToNextSyncPoint called with atFirstRecord = " + atFirstRecord); updatePosition = !atFirstRecord; }
Source:
<code>public static void setUp() throws IOException, TimeoutException, InterruptedException { operations.add(FORMATTER_ADDRESS, Values.empty().and("pattern", FORMATTER_PATTERN)); <START> administration.reloadIfRequired(); <END> operations.add(FORMATTER_ADDRESS_TO_BE_REMOVED, Values.empty().and("pattern", FORMATTER_PATTERN)); administration.reloadIfRequired(); }</code><technical_language>consecutive reloads necessary reload end sufficient</technical_language>

Target:
public static void setUp() throws IOException, TimeoutException, InterruptedException { operations.add(FORMATTER_ADDRESS, Values.empty().and("pattern", FORMATTER_PATTERN)); operations.add(FORMATTER_ADDRESS_TO_BE_REMOVED, Values.empty().and("pattern", FORMATTER_PATTERN)); administration.reloadIfRequired(); }
Source:
<code>public void run() { if (m_socket != null) { boolean success = false; AtomicReference<String> timeoutRef = new AtomicReference<String>(); try { final InputHandler handler = authenticate(m_socket, timeoutRef); if (handler != null) { m_socket.configureBlocking(false); m_socket.socket().setTcpNoDelay(true); <START> m_socket.socket().setKeepAlive(true); <END> m_network.registerChannel( m_socket, handler, 0, ReverseDNSPolicy.ASYNCHRONOUS); success = true; } } catch (Exception e) { try { m_socket.close(); } catch (IOException e1) { } if (m_running) { if (timeoutRef.get() != null) { hostLog.warn(timeoutRef.get()); } else { hostLog.warn("Exception authenticating and " + "registering user in ClientAcceptor", e); } } } finally { if (!success) { m_numConnections.decrementAndGet(); } } } }</code><technical_language>@luyangco handler is ClientInputHandler in PG branch</technical_language>

Target:
public void run() { if (m_socket != null) { boolean success = false; AtomicReference<String> timeoutRef = new AtomicReference<String>(); try { final ClientInputHandler handler = authenticate(m_socket, timeoutRef); if (handler != null) { m_socket.configureBlocking(false); m_socket.socket().setTcpNoDelay(true); m_socket.socket().setKeepAlive(true); m_network.registerChannel( m_socket, handler, 0, ReverseDNSPolicy.ASYNCHRONOUS); success = true; } } catch (Exception e) { try { m_socket.close(); } catch (IOException e1) { } if (m_running) { if (timeoutRef.get() != null) { hostLog.warn(timeoutRef.get()); } else { hostLog.warn("Exception authenticating and " + "registering user in ClientAcceptor", e); } } } finally { if (!success) { m_numConnections.decrementAndGet(); } } } }
Source:
<code>private boolean validateSourceStorageDomainsAvailability() { for (DiskImage image : new ArrayList<>(getImages())) { boolean storageDomainAvailable = false; for (Guid storageDomainId : image.getStorageIds()) { StorageDomain sd = storageDomainDao.getForStoragePool(storageDomainId, getStoragePool().getId()); ValidationResult result = new StorageDomainValidator(sd).isDomainExistAndActive(); if (result.isValid()) { storageDomainAvailable = true; } else { <START> log.warn("Storage domain '{}' does not exist.", storageDomainId); <END> } } if (!storageDomainAvailable) { if (getParameters().isAllowPartialImport()) { log.warn("No active storage domain that contains the image {}/{} exists. " + "Ignoring since the force flag in on.", image.getId(), image.getImageId()); getImages().remove(image); failedDisksToImportForAuditLog.putIfAbsent(image.getId(), image.getDiskAlias()); } else { return failValidation(EngineMessage.ACTION_TYPE_FAILED_CANNOT_FIND_DISK_IMAGE_IN_ACTIVE_DOMAINS, String.format("$diskImageId %1$s", image.getId()), String.format("$imageId %1$s", image.getImageId())); } } } return true; }</code><technical_language>justify iterating list finding exists break #246 (considering interact database here)</technical_language>

Target:
private boolean validateSourceStorageDomainsAvailability() { for (DiskImage image : new ArrayList<>(getImages())) { boolean storageDomainAvailable = false; Iterator<Guid> iterator = image.getStorageIds().iterator(); while (iterator.hasNext()) { Guid storageDomainId = iterator.next(); StorageDomain sd = storageDomainDao.getForStoragePool(storageDomainId, getStoragePool().getId()); ValidationResult result = new StorageDomainValidator(sd).isDomainExistAndActive(); if (result.isValid()) { storageDomainAvailable = true; } else { log.warn("Storage domain '{}' does not exist.", storageDomainId); iterator.remove(); } } if (!storageDomainAvailable) { if (getParameters().isAllowPartialImport()) { log.warn("No active storage domain that contains the image {}/{} exists. " + "Ignoring since the force flag in on.", image.getId(), image.getImageId()); getImages().remove(image); failedDisksToImportForAuditLog.putIfAbsent(image.getId(), image.getDiskAlias()); } else { return failValidation(EngineMessage.ACTION_TYPE_FAILED_CANNOT_FIND_DISK_IMAGE_IN_ACTIVE_DOMAINS, String.format("$diskImageId %1$s", image.getId()), String.format("$imageId %1$s", image.getImageId())); } } } return true; }
Source:
<code>protected void getDataRightsOverride() { overrideClassification = DataRightsClassification.noOverride; for (DataRightsClassification classification : DataRightsClassification.values()) { <START> if (classification.getDataRightsClassification().equals(publishingOptions.overrideDataRights)) { <END> overrideClassification = classification; } } }</code><technical_language>"break;" out of this for loop</technical_language>

Target:
protected void getDataRightsOverride() { overrideClassification = DataRightsClassification.noOverride; for (DataRightsClassification classification : DataRightsClassification.values()) { if (classification.getDataRightsClassification().equals(publishingOptions.overrideDataRights)) { overrideClassification = classification; break; } } }
Source:
<code>public Mono<Void> run(CancellationToken cancellationToken) { LeaseRenewerImpl self = this; logger.info(String.format("Partition %s: renewer task started.", self.lease.getLeaseToken())); long remainingWork = this.leaseRenewInterval.toMillis(); try { while (!cancellationToken.isCancellationRequested() && remainingWork > 0) { <START> Thread.sleep(100); <END> remainingWork -= 100; } } catch (InterruptedException ex) { logger.info(String.format("Partition %s: renewer task stopped.", self.lease.getLeaseToken())); return Mono.empty(); } return Mono.just(self) .flatMap(value -> self.renew(cancellationToken)) .repeat(() -> { if (cancellationToken.isCancellationRequested()) return false; long remainingWorkInLoop = this.leaseRenewInterval.toMillis(); try { while (!cancellationToken.isCancellationRequested() && remainingWorkInLoop > 0) { Thread.sleep(100); remainingWorkInLoop -= 100; } } catch (InterruptedException ex) { logger.info(String.format("Partition %s: renewer task stopped.", self.lease.getLeaseToken())); return false; } return !cancellationToken.isCancellationRequested(); }) .then() .onErrorResume(throwable -> { logger.error(String.format("Partition %s: renew lease loop failed.", self.lease.getLeaseToken()), throwable); return Mono.error(throwable); }); }</code><technical_language>this is blocking call</technical_language>

Target:
public Mono<Void> run(CancellationToken cancellationToken) { logger.info("Partition {}: renewer task started.", this.lease.getLeaseToken()); return Mono.just(this) .flatMap(value -> { if (cancellationToken.isCancellationRequested()) { return Mono.empty(); } ZonedDateTime stopTimer = ZonedDateTime.now().plus(this.leaseRenewInterval); return Mono.just(value) .delayElement(Duration.ofMillis(100)) .repeat( () -> { ZonedDateTime currentTime = ZonedDateTime.now(); return !cancellationToken.isCancellationRequested() && currentTime.isBefore(stopTimer); }).last(); }) .flatMap(value -> { if (cancellationToken.isCancellationRequested()) { return Mono.empty(); } return this.renew(cancellationToken); }) .repeat(() -> { if (cancellationToken.isCancellationRequested()) { logger.info("Partition {}: renewer task stopped.", this.lease.getLeaseToken()); } return !cancellationToken.isCancellationRequested(); }) .then() .onErrorResume(throwable -> { logger.error("Partition {}: renew lease loop failed.", this.lease.getLeaseToken(), throwable); return Mono.error(throwable); }); }
Source:
<code>private void buildPage() { checkState(outputPage == null); <START> checkState(probe != null); <END> if (pageBuilder.isEmpty()) { return; } outputPage = pageBuilder.build(probe); pageBuilder.reset(); }</code><technical_language>consider verify</technical_language>

Target:
private void buildPage() { verify(outputPage == null); verify(probe != null); if (pageBuilder.isEmpty()) { return; } outputPage = pageBuilder.build(probe); pageBuilder.reset(); }
Source:
<code>public void aggregate(ByteBuffer buf, int position) { int size = card.sizeof(); byte[] bytes = new byte[size]; <START> for (int i = 0; i < size; i++) { <END> bytes[i] = buf.get(position + i); } ICardinality cardinalityCounter = new AdaptiveCounting(bytes); ICardinality valueToAgg = selector.get(); try { cardinalityCounter = cardinalityCounter.merge(valueToAgg); bytes = cardinalityCounter.getBytes(); for (int i = 0; i < size; i++) { buf.put(position + i, bytes[i]); } } catch (CardinalityMergeException e) { throw new RuntimeException("Failed to aggregate: "+e); } catch (IOException e) { throw new RuntimeException("Failed to aggregate: "+e); } }</code><technical_language>java buf.get(bytes, i, bytes.length)</technical_language>

Target:
public void aggregate(ByteBuffer buf, int position) { int size = card.sizeof(); byte[] bytes = new byte[size]; ByteBuffer copy = buf.duplicate(); copy.position(position); copy.get(bytes, 0, size); ICardinality cardinalityCounter = new AdaptiveCounting(bytes); ICardinality valueToAgg = selector.get(); try { cardinalityCounter = cardinalityCounter.merge(valueToAgg); bytes = cardinalityCounter.getBytes(); copy.position(position); copy.put(bytes); } catch (CardinalityMergeException e) { throw new RuntimeException("Failed to aggregate: "+e); } catch (IOException e) { throw new RuntimeException("Failed to aggregate: "+e); } }
Source:
<code>public void compute1(final Polygon input, final DoubleType output) { final List<? extends RealLocalizable> minBB = minimumBoundingBoxFunc.compute1(input).getVertices(); final RealLocalizable p1 = minBB.get(0); final RealLocalizable p2 = minBB.get(1); final RealLocalizable p3 = minBB.get(2); double width = Math.sqrt(Math.pow(p1.getDoublePosition(0) - p2.getDoublePosition(0), 2) + Math.pow(p1.getDoublePosition(1) - p2.getDoublePosition(1), 2)); double length = Math.sqrt(Math.pow(p2.getDoublePosition(0) - p3.getDoublePosition(0), 2) + Math.pow(p2.getDoublePosition(1) - p3.getDoublePosition(1), 2)); if (width > length) { <START> double tmp = width; <END> width = length; length = tmp; } output.set(1d - (width / length)); }</code><technical_language>final</technical_language>

Target:
public void compute1(final Polygon input, final DoubleType output) { final List<? extends RealLocalizable> minBB = minimumBoundingBoxFunc.compute1(input).getVertices(); final RealLocalizable p1 = minBB.get(0); final RealLocalizable p2 = minBB.get(1); final RealLocalizable p3 = minBB.get(2); double width = Math.sqrt(Math.pow(p1.getDoublePosition(0) - p2.getDoublePosition(0), 2) + Math.pow(p1.getDoublePosition(1) - p2.getDoublePosition(1), 2)); double length = Math.sqrt(Math.pow(p2.getDoublePosition(0) - p3.getDoublePosition(0), 2) + Math.pow(p2.getDoublePosition(1) - p3.getDoublePosition(1), 2)); if (width > length) { final double tmp = width; width = length; length = tmp; } output.set(1d - (width / length)); }
Source:
<code>private void initMigrationPolicies() { AsyncQuery aQuery = new AsyncQuery(this, new INewAsyncCallback() { @Override public void onSuccess(Object model, Object returnValue) { migrationPolicies = (List<MigrationPolicy>) returnValue; } }); aQuery.converterCallback = new IAsyncConverter() { @Override public Object convert(Object returnValue, AsyncQuery asyncQuery) { if (returnValue == null) { return new ArrayList<MigrationPolicy>(); } Collections.sort((List<MigrationPolicy>) returnValue, new Comparator<MigrationPolicy>() { @Override public int compare(MigrationPolicy m1, MigrationPolicy m2) { <START> if (m1.getId() == NoMigrationPolicy.ID) { <END> return -1; } return m1.getName().compareTo(m2.getName()); } }); return returnValue; } }; Frontend.getInstance().runQuery(VdcQueryType.GetAllMigrationPolicies, new VdcQueryParametersBase(), aQuery); }</code><technical_language>I noticed this but: id is a Guid, .equals() instead of '=='</technical_language>

Target:
private void initMigrationPolicies() { AsyncQuery aQuery = new AsyncQuery(this, new INewAsyncCallback() { @Override public void onSuccess(Object model, Object returnValue) { migrationPolicies = (List<MigrationPolicy>) returnValue; } }); aQuery.converterCallback = new IAsyncConverter() { @Override public Object convert(Object returnValue, AsyncQuery asyncQuery) { if (returnValue == null) { return new ArrayList<MigrationPolicy>(); } Collections.sort((List<MigrationPolicy>) returnValue, new Comparator<MigrationPolicy>() { @Override public int compare(MigrationPolicy m1, MigrationPolicy m2) { if (NoMigrationPolicy.ID.equals(m1.getId())) { return -1; } return m1.getName().compareTo(m2.getName()); } }); return returnValue; } }; Frontend.getInstance().runQuery(VdcQueryType.GetAllMigrationPolicies, new VdcQueryParametersBase(), aQuery); }
Source:
<code>private TypeMapping fromParquetGroup(GroupType type, String name) { <START> LogicalTypeAnnotation ot = type.getLogicalTypeAnnotation(); <END> if (ot == null) { List<TypeMapping> typeMappings = fromParquet(type.getFields()); Field arrowField = new Field(name, type.isRepetition(OPTIONAL), new Struct(), fields(typeMappings)); return new StructTypeMapping(arrowField, type, typeMappings); } else { return ot.accept(new LogicalTypeAnnotation.LogicalTypeAnnotationVisitor<TypeMapping>() { @Override public Optional<TypeMapping> visit(LogicalTypeAnnotation.ListLogicalTypeAnnotation logicalTypeAnnotation) { List3Levels list3Levels = new List3Levels(type); TypeMapping child = fromParquet(list3Levels.getElement(), null, list3Levels.getElement().getRepetition()); Field arrowField = new Field(name, type.isRepetition(OPTIONAL), new ArrowType.List(), asList(child.getArrowField())); return of(new ListTypeMapping(arrowField, list3Levels, child)); } }).orElseThrow(() -> new UnsupportedOperationException("Unsupported type " + type)); } }</code><technical_language>I this change irrelevant. type change ot OriginalType meaningful. If change it, feel free choose a name is fine for you</technical_language>

Target:
private TypeMapping fromParquetGroup(GroupType type, String name) { LogicalTypeAnnotation logicalType = type.getLogicalTypeAnnotation(); if (logicalType == null) { List<TypeMapping> typeMappings = fromParquet(type.getFields()); Field arrowField = new Field(name, type.isRepetition(OPTIONAL), new Struct(), fields(typeMappings)); return new StructTypeMapping(arrowField, type, typeMappings); } else { return logicalType.accept(new LogicalTypeAnnotation.LogicalTypeAnnotationVisitor<TypeMapping>() { @Override public Optional<TypeMapping> visit(LogicalTypeAnnotation.ListLogicalTypeAnnotation listLogicalType) { List3Levels list3Levels = new List3Levels(type); TypeMapping child = fromParquet(list3Levels.getElement(), null, list3Levels.getElement().getRepetition()); Field arrowField = new Field(name, type.isRepetition(OPTIONAL), new ArrowType.List(), asList(child.getArrowField())); return of(new ListTypeMapping(arrowField, list3Levels, child)); } }).orElseThrow(() -> new UnsupportedOperationException("Unsupported type " + type)); } }
Source:
<code>public String getClientId() { String clientId = (String) get(ConsumerConfig.CLIENT_ID_CONFIG); <START> if (clientId == null) { <END> throw new SamzaException("client Id is not set for consumer for system=" + systemName); } return clientId; }</code><technical_language>StringUtils.isBlank</technical_language>

Target:
public String getClientId() { String clientId = (String) get(ConsumerConfig.CLIENT_ID_CONFIG); if (StringUtils.isBlank(clientId)) { throw new SamzaException("client Id is not set for consumer for system=" + systemName); } return clientId; }
Source:
<code>protected KV<K, V> nextPair() throws IOException, InterruptedException { K key = currentReader.getCurrentKey(); V value = currentReader.getCurrentValue(); if (key instanceof Writable) { key = (K) WritableUtils.clone((Writable) key, conf); } if (value instanceof Writable) { value = (V) WritableUtils.clone((Writable) value, conf); } if (value instanceof BinaryComparable) { final int length = ((BinaryComparable) value).getLength(); <START> final int maxRowSize = conf.getInt("maxRowSize", 10 * 1024 * 1024); <END> if (length >= maxRowSize) { throw new FileParameterException("Row size exceeded maximum allowed size"); } } return KV.of(key, value); }</code><technical_language>maxRowSize is Long eit is int. Is reason</technical_language>

Target:
protected KV<K, V> nextPair() throws IOException, InterruptedException { K key = currentReader.getCurrentKey(); V value = currentReader.getCurrentValue(); if (key instanceof Writable) { key = (K) WritableUtils.clone((Writable) key, conf); } if (value instanceof Writable) { value = (V) WritableUtils.clone((Writable) value, conf); } if (value instanceof BinaryComparable) { final int length = ((BinaryComparable) value).getLength(); final int maxRowSize = conf.getInt("maxRowSize", 10 * 1024 * 1024); if (length >= maxRowSize) { throw new FileParameterException("Row size exceeded maximum allowed size (" + maxRowSize + ")"); } } return KV.of(key, value); }
Source:
<code>protected void executeCommand() { VDSReturnValue vdsReturnValue = extendUnderlyingVolumeSize(getImage()); setSucceeded(vdsReturnValue.getSucceeded()); if (vdsReturnValue.getSucceeded()) { Guid taskId = createTask(getAsyncTaskId(), vdsReturnValue.getCreationInfo(), getParameters().getParentCommand()); getTaskIdList().add(taskId); if (getParameters().getParentNotifiesCallback()) { getReturnValue().getInternalVdsmTaskIdList().add(taskId); List<Guid> vdsmTaskIds = new ArrayList<>(); vdsmTaskIds.add(taskId); getParameters().setVdsmTaskIds(vdsmTaskIds); getReturnValue().getVdsmTaskIdList().add(taskId); persistCommand(getParameters().getParentCommand(), true); } else { <START> getTaskIdList().add(taskId); <END> } if (getParameters().getParentNotifiesCallback()) { getParameters().setVdsmTaskIds(new ArrayList<>(Collections.singletonList(taskId))); getReturnValue().getVdsmTaskIdList().add(taskId); persistCommand(getParameters().getParentCommand(), true); } } else { updateAuditLog(AuditLogType.USER_EXTEND_DISK_SIZE_FAILURE, getParameters().getNewSizeInGB()); } }</code><technical_language>this add taskId twice</technical_language>

Target:
protected void executeCommand() { VDSReturnValue vdsReturnValue = extendUnderlyingVolumeSize(getImage()); setSucceeded(vdsReturnValue.getSucceeded()); if (vdsReturnValue.getSucceeded()) { Guid taskId = createTask(getAsyncTaskId(), vdsReturnValue.getCreationInfo(), getParameters().getParentCommand()); getTaskIdList().add(taskId); if (getParameters().getParentNotifiesCallback()) { getReturnValue().getInternalVdsmTaskIdList().add(taskId); List<Guid> vdsmTaskIds = new ArrayList<>(); vdsmTaskIds.add(taskId); getParameters().setVdsmTaskIds(vdsmTaskIds); getReturnValue().getVdsmTaskIdList().add(taskId); persistCommand(getParameters().getParentCommand(), true); getParameters().setVdsmTaskIds(new ArrayList<>(Collections.singletonList(taskId))); getReturnValue().getVdsmTaskIdList().add(taskId); persistCommand(getParameters().getParentCommand(), true); } } else { updateAuditLog(AuditLogType.USER_EXTEND_DISK_SIZE_FAILURE, getParameters().getNewSizeInGB()); } }
Source:
<code><START> protected static boolean isBatchScan(JobContext context) { <END> return InputConfigurator.isIsolated(CLASS, context.getConfiguration()); }</code><technical_language>JobContext here? public</technical_language>

Target:
public static boolean isBatchScan(JobContext context) { return InputConfigurator.isBatchScan(CLASS, context.getConfiguration()); }
Source:
<code>private boolean isAssertion(MethodInvocationTree mit) { <START> for (MethodInvocationMatcher methodInvocationMatcher : ASSERTION_INVOCATION_MATCHERS) { <END> if (methodInvocationMatcher.matches(mit) && !FEST_AS_METHOD.matches(mit) && !FEST_OVERRIDE_ERROR_METHOD.matches(mit) && !FEST_DESCRIBED_AS_METHOD.matches(mit)) { return true; } } return false; }</code><technical_language>Please a MethodInvocationMatcherCollection suit this need</technical_language>

Target:
private boolean isAssertion(MethodInvocationTree mit) { if (ASSERTION_INVOCATION_MATCHERS.anyMatch(mit) && !FEST_AS_METHOD.matches(mit) && !FEST_OVERRIDE_ERROR_METHOD.matches(mit) && !FEST_DESCRIBED_AS_METHOD.matches(mit)) { return true; } return false; }
Source:
<code>private Map<String, GlusterServiceStatus> updateStatusToUnknown(Collection<GlusterServerService> existingServices) { Map<String, GlusterServiceStatus> serviceStatusMap = new HashMap<String, GlusterServiceStatus>(); <START> List<GlusterServerService> servicesToUpdate = new ArrayList<GlusterServerService>(); <END> for (GlusterServerService existingService : existingServices) { existingService.setStatus(GlusterServiceStatus.UNKNOWN); servicesToUpdate.add(existingService); serviceStatusMap.put(existingService.getServiceName(), existingService.getStatus()); } getGlusterServerServiceDao().updateAll(servicesToUpdate); return serviceStatusMap; }</code><technical_language>Is this list required? existingServices list</technical_language>

Target:
private Map<String, GlusterServiceStatus> updateStatusToUnknown(Collection<GlusterServerService> existingServices) { Map<String, GlusterServiceStatus> serviceStatusMap = new HashMap<String, GlusterServiceStatus>(); for (GlusterServerService existingService : existingServices) { existingService.setStatus(GlusterServiceStatus.UNKNOWN); serviceStatusMap.put(existingService.getServiceName(), existingService.getStatus()); } getGlusterServerServiceDao().updateAll(existingServices); return serviceStatusMap; }
Source:
<code>public CustomRobotDriverElement() throws NoSuchFieldException, IllegalAccessException { try { CustomRobotDriverElement.s = getLibraryInstance(); } catch (javax.script.ScriptException e) { <START> e.printStackTrace(); <END> } Field bmField = SeleniumLibrary.class.getDeclaredField("bm"); bmField.setAccessible(true); b = (BrowserManagement) bmField.get(s); }</code><technical_language>need do return least. Also, log exception some logger? in case stdout able turn logging off. do think</technical_language>

Target:
public CustomRobotDriverElement() throws NoSuchFieldException, IllegalAccessException { try { CustomRobotDriverElement.s = getLibraryInstance(); } catch (ScriptException e) { throw new SeleniumLibraryNonFatalException("Cannot create SeleniumLibrary instance.", e); } Field bmField = SeleniumLibrary.class.getDeclaredField("bm"); bmField.setAccessible(true); b = (BrowserManagement) bmField.get(s); bmField.setAccessible(false); }
Source:
<code>public String getSigningKeystorePath() { <START> return getGatewayKeystoreDir() + "/" + DEFAULT_GATEWAY_KEYSTORE_NAME; <END> }</code><technical_language>Paths.get os specific separator</technical_language>

Target:
public String getSigningKeystorePath() { return getGatewayKeystorePath().resolve(DEFAULT_GATEWAY_KEYSTORE_NAME).toString(); }
Source:
<code>public static ToolTipString fromString(String text) { <START> Objects.requireNonNull(text, "fromString cannot take null"); END> return new ToolTipString(text, toHtmlString(text)); }</code><technical_language>remove requireNonNull due @NNBD. surprised allowed it, explicit null check a compilation error..</technical_language>

Target:
public static ToolTipString fromString(String text) { return new ToolTipString(text, toHtmlString(text)); }
Source:
<code>protected JsonWebToken validateToken(String encodedToken, boolean ignoreAudience) { if (encodedToken == null) { throw new IdentityBrokerException("No token from server."); } JsonWebToken token; try { JWSInput jws = new JWSInput(encodedToken); if (!verify(jws)) { throw new IdentityBrokerException("token signature validation failed"); } token = jws.readJsonContent(JsonWebToken.class); } catch (JWSInputException e) { throw new IdentityBrokerException("Invalid token", e); } String iss = token.getIssuer(); if (!token.isActive(getConfig().getAllowedClockSkew())) { throw new IdentityBrokerException("Token is no longer valid"); } if (!ignoreAudience && !token.hasAudience(getConfig().getClientId())) { throw new IdentityBrokerException("Wrong audience from token."); } <START> if (!ignoreAudience && !getConfig().getClientId().equals(token.getIssuedFor())) { <END> throw new IdentityBrokerException("Token not issued for client [" + getConfig().getClientId() + "]"); } String trustedIssuers = getConfig().getIssuer(); if (trustedIssuers != null && trustedIssuers.length() > 0) { String[] issuers = trustedIssuers.split(","); for (String trustedIssuer : issuers) { if (iss != null && iss.equals(trustedIssuer.trim())) { return token; } } throw new IdentityBrokerException("Wrong issuer from token. Got: " + iss + " expected: " + getConfig().getIssuer()); } return token; }</code><technical_language>azp is optional I imagine some IdPs set it. this check if token.getIssuedFor is empty</technical_language>

Target:
protected JsonWebToken validateToken(String encodedToken, boolean ignoreAudience) { if (encodedToken == null) { throw new IdentityBrokerException("No token from server."); } JsonWebToken token; try { JWSInput jws = new JWSInput(encodedToken); if (!verify(jws)) { throw new IdentityBrokerException("token signature validation failed"); } token = jws.readJsonContent(JsonWebToken.class); } catch (JWSInputException e) { throw new IdentityBrokerException("Invalid token", e); } String iss = token.getIssuer(); if (!token.isActive(getConfig().getAllowedClockSkew())) { throw new IdentityBrokerException("Token is no longer valid"); } if (!ignoreAudience && !token.hasAudience(getConfig().getClientId())) { throw new IdentityBrokerException("Wrong audience from token."); } if (!ignoreAudience && (token.getIssuedFor() != null && !getConfig().getClientId().equals(token.getIssuedFor()))) { throw new IdentityBrokerException("Token issued for does not match client id"); } String trustedIssuers = getConfig().getIssuer(); if (trustedIssuers != null && trustedIssuers.length() > 0) { String[] issuers = trustedIssuers.split(","); for (String trustedIssuer : issuers) { if (iss != null && iss.equals(trustedIssuer.trim())) { return token; } } throw new IdentityBrokerException("Wrong issuer from token. Got: " + iss + " expected: " + getConfig().getIssuer()); } return token; }
Source:
<code>public void checkCurrentPassword(String value, int expertId, List<String> validationFailures) { Expert expert = expertService.getExpertById(expertId); if (!passwordEncoder.matches(value, expert.getPassword())) { <START> validationFailures.add(String.format(FAILURE_INCORRECT_VALUE, PASSWORD_FIELD_NAME)); <END> } }</code><technical_language>this return "Current password incorrect." "Password incorrect." ? (The user interface 3 password fields)</technical_language>

Target:
public void checkCurrentPassword(String value, int expertId, List<String> validationFailures) { Expert expert = expertService.getExpertById(expertId); if (!passwordEncoder.matches(value, expert.getPassword())) { validationFailures.add(String.format(FAILURE_INCORRECT_VALUE, CURRENT_PASSWORD_FIELD_NAME)); } }
Source:
<code>public void add(final Interval interval) { ValidationUtils.validateArg(header.getSequence(interval.getContig()) != null, <START> () -> String.format("Cannot add interval %s, contig not in header", interval.toString())); <END> this.intervals.add(interval); }</code><technical_language>ValidationUtils.nonNull for this</technical_language>

Target:
public void add(final Interval interval) { ValidationUtils.nonNull(header.getSequence(interval.getContig()), () -> String.format("Cannot add interval %s, contig not in header", interval.toString())); this.intervals.add(interval); }
Source:
<code>public CigarElement(final int length, final CigarOperator operator) { <START> if (length < 0) throw new IllegalArgumentException("Cigar element being constructed with negative length: " + length); <END> this.length = length; this.operator = operator; }</code><technical_language>include element type in output message well</technical_language>

Target:
public CigarElement(final int length, final CigarOperator operator) { if (length < 0) throw new IllegalArgumentException(String.format("Cigar element being constructed with negative length: %d and operation: %s" , length, operator.name())); this.length = length; this.operator = operator; }
Source:
<code>public AbstractSquareDecorator getDecorator(AbstractSquare square) { <START> return null; <END> }</code><technical_language>return a lighttraildecorator</technical_language>

Target:
public AbstractSquareDecorator getDecorator(AbstractSquare square) { return new LightTrailDecorator(square); }
Source:
<code>private void testEditCommentsActionAfterAddingComments() throws IOException { ______TS("edit comments on responses and verify added comments action"); submitPage = loginToInstructorFeedbackSubmitPage("IFSubmitUiT.instr", "Open Session"); submitPage.waitForPageToLoad(); <START> submitPage.verifyHtmlMainContent("/instructorFeedbackSubmitPageAddedCommentOnResponses.html"); <END> submitPage.editFeedbackResponseComment("-0-1-6-1", "Edited MCQ Comment 1"); submitPage.editFeedbackResponseComment("-1-1-6-1", "Edited MCQ Comment 2"); submitPage.editFeedbackResponseComment("-2-1-6-1", "Edited MCQ Comment 3"); submitPage.editFeedbackResponseComment("-0-1-9-1", "Edited MCQ Comment 4"); submitPage.editFeedbackResponseComment("-0-1-11-1", "Edited MCQ Comment 5"); submitPage.editFeedbackResponseComment("-0-1-15-1", "Edited MCQ Comment 6"); submitPage.submitWithoutConfirmationEmail(); submitPage.waitForTextsForAllStatusMessagesToUserEquals(Const.StatusMessages.FEEDBACK_RESPONSES_SAVED, Const.StatusMessages.FEEDBACK_UNANSWERED_QUESTIONS + "21, 24."); }</code><technical_language>similar here, verify html content edition, edition appears page</technical_language>

Target:
private void testEditCommentsActionAfterAddingComments() { ______TS("edit comments on responses and verify added comments action"); submitPage = loginToInstructorFeedbackSubmitPage("IFSubmitUiT.instr", "Open Session"); submitPage.waitForPageToLoad(); submitPage.editFeedbackParticipantComment("-6-0", "Edited MCQ Comment 1"); submitPage.editFeedbackParticipantComment("-6-1", "Edited MCQ Comment 2"); submitPage.editFeedbackParticipantComment("-9-0", "Edited MCQ Comment 3"); submitPage.submitWithoutConfirmationEmail(); submitPage.waitForTextsForAllStatusMessagesToUserEquals(Const.StatusMessages.FEEDBACK_RESPONSES_SAVED, Const.StatusMessages.FEEDBACK_UNANSWERED_QUESTIONS + "1, 2, 3, 4, 5, 7, 8, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24."); submitPage = loginToInstructorFeedbackSubmitPage("IFSubmitUiT.instr", "Open Session"); submitPage.waitForPageToLoad(); submitPage.verifyCommentRowContent("-6-0", "Edited MCQ Comment 1"); submitPage.verifyCommentRowContent("-6-1", "Edited MCQ Comment 2"); submitPage.verifyCommentRowContent("-9-0", "Edited MCQ Comment 3"); }
Source:
<code>public void sendNotification(@Identification final String organisationIdentification, final String deviceIdentification, final String result, final String correlationUid, final String message, final NotificationType notificationType) { LOGGER.info("sendNotification called with organisation: {}, correlationUid: {}, type: {}", organisationIdentification, correlationUid, notificationType); final Notification notification = new Notification(); notification.setMessage(message); notification.setResult(result); notification.setDeviceIdentification(deviceIdentification); notification.setCorrelationUid(correlationUid); notification.setNotificationType(notificationType); try { this.sendNotificationServiceClient.sendNotification(organisationIdentification, notification, this.notificationURL); } catch (final WebServiceSecurityException e){ <START> e.printStackTrace(); <END> } }</code><technical_language>replace this line LOGGER.error(e.getMessage(), e);</technical_language>

Target:
public void sendNotification(@Identification final String organisationIdentification, final String deviceIdentification, final String result, final String correlationUid, final String message, final NotificationType notificationType) { LOGGER.info("sendNotification called with organisation: {}, correlationUid: {}, type: {}", organisationIdentification, correlationUid, notificationType); final Notification notification = new Notification(); notification.setMessage(message); notification.setResult(result); notification.setDeviceIdentification(deviceIdentification); notification.setCorrelationUid(correlationUid); notification.setNotificationType(notificationType); try { this.sendNotificationServiceClient.sendNotification(organisationIdentification, notification, this.notificationURL); } catch (final WebServiceSecurityException e){ LOGGER.error(e.getMessage(), e); } }
Source:
<code>public TileRenderRunnable( TileCanvasViewGroup viewGroup, Tile tile) { <START> this.mTileCanvasViewGroup = new WeakReference<>( viewGroup ); <END> this.mTile = new WeakReference<>( tile ); }</code><technical_language>please remove this. this line next</technical_language>

Target:
public TileRenderRunnable( TileCanvasViewGroup viewGroup, Tile tile) { mTileCanvasViewGroup = new WeakReference<>( viewGroup ); mTile = new WeakReference<>( tile ); }
Source:
<code>private String sourceName(Token t) { <START> CharStream input = t.getInputStream(); String srcName = null; if ( input!=null ) { srcName = input.getSourceName(); if ( srcName!=null ) srcName = Misc.getFileName(srcName); } return srcName; <END> }</code><technical_language>I refactoring, especially deduplication! However, I suggest early return braces for if statements: suggestion CharStream input = t.getInputStream(); if ( input==null ) { return null; } String srcName = input.getSourceName(); if ( srcName!=null ) { srcName = Misc.getFileName(srcName); } return srcName;</technical_language>

Target:
private String sourceName(Token t) { CharStream input = t.getInputStream(); if ( input==null ) { return null; } String srcName = input.getSourceName(); if ( srcName!=null ) { srcName = Misc.getFileName(srcName); } return srcName; }
Source:
<code>public void onViewCreated(View view, Bundle savedInstanceState) { super.onViewCreated(view, savedInstanceState); final Bundle arguments = getArguments(); if (arguments != null) { @ScreenDef String screenName = arguments.getString(Router.EXTRA_SCREEN_NAME); if (!TextUtils.isEmpty(screenName)) { <START> switch (screenName) { <END> case Screen.SETTINGS: environment.getRouter().showSettings(getActivity()); break; } } } }</code><technical_language>if is other case, if statement instated of switch</technical_language>

Target:
public void onViewCreated(View view, Bundle savedInstanceState) { super.onViewCreated(view, savedInstanceState); handleIntentBundle(getArguments()); }
Source:
<code>public void apply(final LoadingCache<EncodedKey<K>, Tagged<V>> kvCache) { try { Tagged<V> tagged; V loadedValue; while (true) { <START> tagged = kvCache.get(encodedKey); <END> final int staleness = workerClock.getGlobalMinimumClock() - tagged.getClock(); if (staleness < stalenessBound) { loadedValue = tagged.getValue(); break; } else { kvCache.invalidate(encodedKey); } } synchronized (this) { this.value = loadedValue; notify(); } } catch (final ExecutionException e) { throw new RuntimeException(e); } }</code><technical_language>final Tagged<V> tagged = kvCache.get(encodedKey)</technical_language>

Target:
public void apply(final LoadingCache<EncodedKey<K>, Tagged<V>> kvCache) { try { final V loadedValue; while (true) { final Tagged<V> tagged = kvCache.get(encodedKey); final int staleness = workerClock.getGlobalMinimumClock() - tagged.getClock(); if (staleness <= stalenessBound) { loadedValue = tagged.getValue(); break; } else { kvCache.invalidate(encodedKey); } } synchronized (this) { this.value = loadedValue; notify(); } } catch (final ExecutionException e) { throw new RuntimeException(e); } }
Source:
<code>private static ErlangModuleBuildOrderDescriptor getModuleBuildOrderInner(Module module) throws CyclicDependencyFoundException { ErlangModuleBuildOrderDescriptor buildOrder = new ErlangModuleBuildOrderDescriptor(); ErlangFacet erlangFacet = ErlangFacet.getFacet(module); List<String> globalParseTransforms = erlangFacet != null ? erlangFacet.getConfiguration().getParseTransforms() : ContainerUtil.<String>emptyList(); buildOrder.myModuleName = module.getName(); buildOrder.myOrderedErlangModulePaths = getTopologicallySortedErlangModulePaths(ErlangModulesUtil.getErlangModules(module, false), ErlangModulesUtil.getErlangHeaders(module, false), globalParseTransforms); buildOrder.myOrderedErlangTestModulePaths = getTopologicallySortedErlangModulePaths(ErlangModulesUtil.getErlangModules(module, true), ErlangModulesUtil.getErlangHeaders(module, true), <START> ContainerUtil.<String>emptyList()); <END> return buildOrder; }</code><technical_language>Again, module paths anymore. Please, consistent in naming. severely improves code readability if named properly</technical_language>

Target:
private static ErlangModuleBuildOrderDescriptor getModuleBuildOrderInner(Module module) throws CyclicDependencyFoundException { ErlangModuleBuildOrderDescriptor buildOrder = new ErlangModuleBuildOrderDescriptor(); buildOrder.myModuleName = module.getName(); buildOrder.myOrderedErlangFilePaths = getTopologicallySortedErlangFilesPaths(module, false); buildOrder.myOrderedErlangTestFilePaths = getTopologicallySortedErlangFilesPaths(module, true); return buildOrder; }
Source:
<code>public void add(@Nonnull final SexGenotypeData sexGenotypeData) { sexGenotypeDataList.add(sexGenotypeData); sampleNames.add(sexGenotypeData.getSampleName()); <START> sampleNamesToSexGenotypeDataMap.put(sexGenotypeData.getSampleName(), sexGenotypeData); <END> }</code><technical_language>Do want check new sample name is unique</technical_language>

Target:
public void add(@Nonnull final SexGenotypeData sexGenotypeData) { Utils.validateArg(!sampleNames.contains(sexGenotypeData.getSampleName()), "Sex genotype data " + "for sample \"" + sexGenotypeData.getSampleName() + "\" is already in the collection"); sexGenotypeDataList.add(sexGenotypeData); sampleNames.add(sexGenotypeData.getSampleName()); sampleNamesToSexGenotypeDataMap.put(sexGenotypeData.getSampleName(), sexGenotypeData); }
Source:
<code>public boolean equals(Object o) { <START> return this == o || (o != null && getClass() == o.getClass() && id.equals(((AbstractIdentifier) o).id)); <END> }</code><technical_language>This boolean expression is complex, expand code out more readable</technical_language>

Target:
public final boolean equals(Object o) { return this == o || (o != null && getClass() == o.getClass() && id.equals(((AbstractIdentifier) o).id)); }
Source:
<code>private static SqlManager getSqlManager(Log logger, SupportedDatabase db) { SqlManager instance = null; switch (db) { case oracle: instance = new OracleSqlManager(logger, new OracleSqlDataType()); break; case foxpro: instance = new SqlManagerImpl(logger, new FoxProDataType()); break; case mysql: instance = new MysqlSqlManager(logger, new MySqlDataType()); break; case postgresql: instance = new PostgreSqlManager(logger, new PostgresqlDataType()); break; case h2: instance = new H2SqlManager(logger, new H2DataType()); break; case hsql: instance = new HyperSqlManager(logger, new HyperSqlDataType()); break; <START> default: <END> break; } return instance; }</code><technical_language>fail faster in of this if throw exception here</technical_language>

Target:
private static SqlManager getSqlManager(Log logger, SupportedDatabase db) throws OseeCoreException { SqlManager instance = null; switch (db) { case oracle: instance = new OracleSqlManager(logger, new OracleSqlDataType()); break; case foxpro: instance = new SqlManagerImpl(logger, new FoxProDataType()); break; case mysql: instance = new MysqlSqlManager(logger, new MySqlDataType()); break; case postgresql: instance = new PostgreSqlManager(logger, new PostgresqlDataType()); break; case h2: instance = new H2SqlManager(logger, new H2DataType()); break; case hsql: instance = new HyperSqlManager(logger, new HyperSqlDataType()); break; default: throw new OseeDataStoreException("Unsupported database type [%s] ", db); } return instance; }
Source:
<code>public void accept(FluxSink<T> fluxSink) { <START> FluxSinkRecorderDelegate<T> previousDelegate = this.delegate; <END> synchronized (this) { delegate = new DirectDelegate<>(fluxSink); previousDelegate.accept(fluxSink); } }</code><technical_language>this synchronized well</technical_language>

Target:
public synchronized void accept(FluxSink<T> fluxSink) { FluxSinkRecorderDelegate<T> previousDelegate = this.delegate; delegate = new DirectDelegate<>(fluxSink); previousDelegate.accept(fluxSink); }
Source:
<code>public void run() { while (!isInterrupted()) { try { InputStream in = getInput(); if (in != null) { String data = read(in); if (!data.isEmpty()) { buf.append(data); if (buf.length() > MAX_OUTPUT) { buf.delete(0, buf.length() - MAX_OUTPUT); } extractOutputs(); } } } catch (IOException e) { LOG.error(e.getMessage(), e); } try { <START> sleep(100); <END> } catch (InterruptedException e) { break; } } LOG.debug(getName() + " has been stopped"); }</code><technical_language>sleep a hack</technical_language>

Target:
public void run() { try { InputStream in = getInput(); if (in != null) { String outputData = read(in); if (!outputData.isEmpty()) { outputBuffer.append(outputData); if (outputBuffer.length() > MAX_OUTPUT) { outputBuffer.delete(0, outputBuffer.length() - MAX_OUTPUT); } extractOutputs(); } } } catch (IOException e) { LOG.error(e.getMessage(), e); } }