auphong2707/dl4se-code-review-dataset huggingface dataset:
Source:
<code>protected Object parseValue(CommandSource source, CommandArgs args) throws ArgumentParseException { if (!args.hasNext()) { if (this.returnSource) { return tryReturnSource(source, args); } if (this.returnTarget) { return tryReturnTarget(source, args, this.type == null ? Entity.class : this.type); } } Object state = args.getState(); try { Entity entity = (Entity) super.parseValue(source, args); <START> if (!type.isAssignableFrom(entity.getClass())) { <END> Text name = Sponge.getRegistry().getAllOf(EntityType.class).stream() .filter(t -> t.getEntityClass().equals(this.type)).findFirst() .map(EntityType::getTranslation).<Text>map(Text::of) .orElse(Text.of(this.type.getSimpleName())); throw args.createError(Text.of("The entity is not of the required type! (", name, ")")); } return entity; } catch (ArgumentParseException ex) { if (this.returnSource) { args.setState(state); return tryReturnSource(source, args); } throw ex; } }</code><technical_language>Missing this. potential NPE type</technical_language>

Target:
protected Object parseValue(CommandSource source, CommandArgs args) throws ArgumentParseException { if (!args.hasNext()) { if (this.returnSource) { return tryReturnSource(source, args, true); } if (this.returnTarget) { return tryReturnTarget(source, args); } } Object state = args.getState(); try { Iterable<Entity> entities = (Iterable<Entity>) super.parseValue(source, args); for (Entity entity : entities) { if (!this.checkEntity(entity)) { Text name; if (this.type == null) { name = Sponge.getRegistry().getAllOf(EntityType.class).stream() .filter(t -> t.getEntityClass().equals(this.clazz)).findFirst() .map(EntityType::getTranslation).<Text>map(Text::of) .orElse(Text.of(this.clazz.getSimpleName())); } else { name = Text.of(this.type); } throw args.createError(Text.of("The entity is not of the required type! (", name, ")")); } } return entities; } catch (ArgumentParseException ex) { if (this.returnSource) { args.setState(state); return tryReturnSource(source, args, true); } throw ex; } }
Source:
<code>protected String toJSONPlan(String sql, PlannerType plannerType) { CompiledPlan compiledPlan = (plannerType == PlannerType.CALCITE) ? compileAdHocCalcitePlan(sql, true, true, DeterminismMode.SAFER) : compileAdHocPlan(sql, true, true); <START> assert (compiledPlan.rootPlanGraph != null); <END> PlanNodeTree planTree = new PlanNodeTree(compiledPlan.rootPlanGraph); String planTreeJSON = planTree.toJSONString(); if (compiledPlan.subPlanGraph != null) { PlanNodeTree subPlanTree = new PlanNodeTree(compiledPlan.subPlanGraph); String subPlanTreeJSON = subPlanTree.toJSONString(); planTreeJSON += subPlanTreeJSON; } return planTreeJSON; }</code><technical_language>assertNotNull("Root plan graph is null", compiledPlan.rootPlanGraph);</technical_language>

Target:
protected String toJSONPlan(String sql, PlannerType plannerType) { CompiledPlan compiledPlan = (plannerType == PlannerType.CALCITE) ? compileAdHocCalcitePlan(sql, true, true, DeterminismMode.SAFER) : compileAdHocPlan(sql, true, true); assertNotNull("Root plan graph is null", compiledPlan.rootPlanGraph); PlanNodeTree planTree = new PlanNodeTree(compiledPlan.rootPlanGraph); String planTreeJSON = planTree.toJSONString(); if (compiledPlan.subPlanGraph != null) { PlanNodeTree subPlanTree = new PlanNodeTree(compiledPlan.subPlanGraph); String subPlanTreeJSON = subPlanTree.toJSONString(); planTreeJSON += subPlanTreeJSON; } return planTreeJSON; }
Source:
<code>private List<Permission> getPermission(final List<Integer> permissions) { final List<Permission> permissionList = new ArrayList<>(); for (final Integer permissionId : permissions) { final Permission permission = this.workbenchDataManager.getPermission(permissionId); permissionList.add(permission); } <START> final Collection result = CollectionUtils.collect(permissionList, new Transformer() { <END> @Override public Integer transform(final Object input) { final Permission permission = (Permission) input; return Integer.valueOf(permission.getPermissionId()); } }); for (final Iterator<Permission> it = permissionList.iterator(); it.hasNext();) { final Permission permission = it.next(); if (result.contains(permission.getParent().getPermissionId())) { it.remove(); } } return permissionList; }</code><technical_language>No, I</technical_language>

Target:
private List<Permission> getPermission(final List<Integer> permissions) { final List<Permission> permissionList = this.permissionService.getPermissionsByIds(new HashSet<>(permissions)); for (final Iterator<Permission> it = permissionList.iterator(); it.hasNext(); ) { final Permission permission = it.next(); if (permission.getParent() != null && permissions.contains(permission.getParent().getPermissionId())) { it.remove(); } } return permissionList; }
Source:
<code>public void disconnect(final BaseComponent... reason) { if ( thisState != State.STATUS && thisState != State.PING && thisState != State.HANDSHAKE ) { <START> ch.getHandle().eventLoop().schedule( new Runnable() <END> { @Override public void run() { ch.close( new Kick( ComponentSerializer.toString( reason ) ) ); } }, 250, TimeUnit.MILLISECONDS ); } else { ch.close(); } }</code><technical_language>suggestion // Minecraft client some time switch protocols. // Sending wrong disconnect packet a protocol switch is in progress crash it. // Delay 250ms ensure protocol switch (if any) place. ch.getHandle().eventLoop().schedule( new Runnable()</technical_language>

Target:
public void disconnect(final BaseComponent... reason) { if ( canSendKickMessage() ) { ch.delayedClose( new Kick( ComponentSerializer.toString( reason ) ) ); } else { ch.close(); } }
Source:
<code>void deliver() { int frameSize = protonSession.session.getConnection().getTransport().getOutboundFrameSizeLimit() - 50 - (delivery.getTag() != null ? delivery.getTag().length : 0); DeliveryAnnotations deliveryAnnotationsToEncode; <START> if (reference.getProtocolData() != null && reference.getProtocolData() instanceof DeliveryAnnotations) { deliveryAnnotationsToEncode = (DeliveryAnnotations)reference.getProtocolData(); } else { deliveryAnnotationsToEncode = null; } END> LargeBodyReader context = message.getLargeBodyReader(); try { context.open(); try { context.position(position); long bodySize = context.getSize(); ByteBuffer buf = ByteBuffer.allocate(frameSize); for (; position < bodySize; ) { if (!connection.flowControl(this::resume)) { context.close(); return; } buf.clear(); if (position == 0) { writeHeaderAndAnnotations(context, buf, deliveryAnnotationsToEncode); } int size = context.readInto(buf); sender.send(new ReadableBuffer.ByteBufferReader(buf)); position += size; if (position < bodySize) { connection.instantFlush(); } } } finally { context.close(); } if (preSettle) { try { sessionSPI.ack(null, brokerConsumer, reference.getMessage()); } catch (Exception e) { log.debug(e.getMessage(), e); } delivery.settle(); } else { sender.advance(); } connection.instantFlush(); synchronized (creditsLock) { pending.decrementAndGet(); } finishLargeMessage(); } catch (Exception e) { log.warn(e.getMessage(), e); brokerConsumer.errorProcessing(e, reference); } }</code><technical_language>This doesnt account for older explicitly set delivery annotations in standard message send process does. behave same</technical_language>

Target:
void deliver() { int frameSize = protonSession.session.getConnection().getTransport().getOutboundFrameSizeLimit() - 50 - (delivery.getTag() != null ? delivery.getTag().length : 0); DeliveryAnnotations deliveryAnnotationsToEncode; message.checkReference(reference); if (reference.getProtocolData() != null && reference.getProtocolData() instanceof DeliveryAnnotations) { deliveryAnnotationsToEncode = (DeliveryAnnotations)reference.getProtocolData(); } else { deliveryAnnotationsToEncode = null; } LargeBodyReader context = message.getLargeBodyReader(); try { context.open(); try { context.position(position); long bodySize = context.getSize(); ByteBuffer buf = ByteBuffer.allocate(frameSize); for (; position < bodySize; ) { if (!connection.flowControl(this::resume)) { context.close(); return; } buf.clear(); if (position == 0) { writeHeaderAndAnnotations(context, buf, deliveryAnnotationsToEncode); } int size = context.readInto(buf); sender.send(new ReadableBuffer.ByteBufferReader(buf)); position += size; if (position < bodySize) { connection.instantFlush(); } } } finally { context.close(); } if (preSettle) { try { sessionSPI.ack(null, brokerConsumer, reference.getMessage()); } catch (Exception e) { log.debug(e.getMessage(), e); } delivery.settle(); } else { sender.advance(); } connection.instantFlush(); synchronized (creditsLock) { pending.decrementAndGet(); } finishLargeMessage(); } catch (Exception e) { log.warn(e.getMessage(), e); brokerConsumer.errorProcessing(e, reference); } }
Source:
<code>protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_task_detail); if (getResources().getBoolean(R.bool.has_two_panes)) { Intent taskListIntent = new Intent(this, TaskListActivity.class); taskListIntent.putExtra(TaskListActivity.EXTRA_FORCE_LIST_SELECTION, getIntent().getBooleanExtra(TaskListActivity.EXTRA_FORCE_LIST_SELECTION, false)); taskListIntent.putExtra(TaskListActivity.EXTRA_DISPLAY_TASK, true); taskListIntent.setData(getIntent().getData()); startActivity(taskListIntent); finish(); return; } if (savedInstanceState == null) { <START> ViewTaskFragment fragment = ViewTaskFragment.newInstance(getIntent().getData(), new PrimaryColor(this)); <END> getSupportFragmentManager().beginTransaction().add(R.id.task_detail_container, fragment).commit(); } }</code><technical_language>passing this color activity well? device I primary color briefly opening a task, avoid passing color ViewTaskActivity. tolerate absence of color in case called external app</technical_language>

Target:
protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_task_detail); if (getResources().getBoolean(R.bool.has_two_panes)) { Intent taskListIntent = new Intent(this, TaskListActivity.class); taskListIntent.putExtra(TaskListActivity.EXTRA_FORCE_LIST_SELECTION, getIntent().getBooleanExtra(TaskListActivity.EXTRA_FORCE_LIST_SELECTION, false)); taskListIntent.putExtra(TaskListActivity.EXTRA_DISPLAY_TASK, true); taskListIntent.setData(getIntent().getData()); startActivity(taskListIntent); finish(); return; } if (savedInstanceState == null) { int color = getIntent().getIntExtra(EXTRA_COLOR, 0); ViewTaskFragment fragment = ViewTaskFragment.newInstance( getIntent().getData(), color != 0 ? new ValueColor(color) : new PrimaryColor(this)); getSupportFragmentManager().beginTransaction().add(R.id.task_detail_container, fragment).commit(); } }
Source:
<code>public Image apply(final VMImage image) { <START> FluentIterable.from(locations.get()).firstMatch(LocationPredicates.idEquals(image.location)).orNull(); <END> final ImageBuilder builder = new ImageBuilder() .name(image.offer) .description(image.sku) .status(Image.Status.AVAILABLE) .version(image.sku) .id(encodeFieldsToUniqueId(image)) .providerId(image.publisher) .location(image.globallyAvailable ? null : FluentIterable.from(locations.get()) .firstMatch(LocationPredicates.idEquals(image.location)) .orNull()); final OperatingSystem.Builder osBuilder = osFamily().apply(image); return builder.operatingSystem(osBuilder.build()).build(); }</code><technical_language>Remove this</technical_language>

Target:
public Image apply(final VMImage image) { final ImageBuilder builder = new ImageBuilder() .name(image.offer) .description(image.sku) .status(Image.Status.AVAILABLE) .version(image.sku) .id(encodeFieldsToUniqueId(image)) .providerId(image.publisher) .location(image.globallyAvailable ? null : FluentIterable.from(locations.get()) .firstMatch(LocationPredicates.idEquals(image.location)) .get()); final OperatingSystem.Builder osBuilder = osFamily().apply(image); return builder.operatingSystem(osBuilder.build()).build(); }
Source:
<code><START> public String toString() { <END> return "DeviceMessageMetadata [deviceIdentification=" + this.deviceIdentification + ", organisationIdentification=" + this.organisationIdentification + ", correlationUid=" + this.correlationUid + ", messageType=" + this.messageType + ", messagePriority=" + this.messagePriority + ", scheduleTime=" + this.scheduleTime + "]"; }</code><technical_language>reason include bypassRetry in information toString()</technical_language>

Target:
public String toString() { return "DeviceMessageMetadata [deviceIdentification=" + this.deviceIdentification + ", organisationIdentification=" + this.organisationIdentification + ", correlationUid=" + this.correlationUid + ", messageType=" + this.messageType + ", messagePriority=" + this.messagePriority + ", scheduleTime=" + this.scheduleTime + ", bypassRetry=" + this.bypassRetry + "]"; }
Source:
<code>public static Properties defaultProperties() { Properties properties = BaseHttpApiMetadata.defaultProperties(); properties.put(POLL_INITIAL_PERIOD, 5000); properties.put(POLL_MAX_PERIOD, 20000); properties.put(TIMEOUT_NODE_RUNNING, 300000); properties.put(TIMEOUT_NODE_SUSPENDED, 300000); <START> properties.put(TIMEOUT_NODE_TERMINATED, 300000); <END> return properties; }</code><technical_language>remove defaults if apply this provider</technical_language>

Target:
public static Properties defaultProperties() { Properties properties = BaseHttpApiMetadata.defaultProperties(); return properties; }
Source:
<code>public void updateDebugConfig(IDeploymentConfig deploymentConfig, DebuggingContext debugContext, IProgressMonitor monitor) throws CoreException { monitor.subTask("Updating Deployment Configuration"); if (deploymentConfig == null <START> || deploymentConfig.getEnvironmentVariables() == null) { <END> return; } updateDeploymentConfigValues(deploymentConfig, debugContext); IClient client = getClient(deploymentConfig); DeploymentConfigListenerJob connectionListenerJob = new DeploymentConfigListenerJob(deploymentConfig); connectionListenerJob.addJobChangeListener(new JobChangeAdapter() { public void done(IJobChangeEvent event) { ConnectionsRegistrySingleton.getInstance().removeListener(connectionListenerJob); debugContext.setPod(connectionListenerJob.getPod()); if (event.getResult().isOK() && debugContext.getDebugListener() != null) { try { debugContext.getDebugListener().onPodRestart(debugContext, monitor); } catch (CoreException e) { throw new OpenShiftCoreException(e); } } }; }); ConnectionsRegistrySingleton.getInstance().addListener(connectionListenerJob); connectionListenerJob.schedule(); client.update(deploymentConfig); try { connectionListenerJob.join(DeploymentConfigListenerJob.TIMEOUT, monitor); } catch (OperationCanceledException | InterruptedException e) { e.printStackTrace(); } }</code><technical_language>I dont this return null for ENV vars, worth keeping check. a check empty too</technical_language>

Target:
public void updateDebugConfig(IDeploymentConfig deploymentConfig, DebuggingContext debugContext, IProgressMonitor monitor) throws CoreException { monitor.subTask("Updating Deployment Configuration"); if (deploymentConfig == null || deploymentConfig.getEnvironmentVariables() == null) { return; } updateDeploymentConfigValues(deploymentConfig, debugContext); IClient client = getClient(deploymentConfig); DeploymentConfigListenerJob deploymentListenerJob = new DeploymentConfigListenerJob(deploymentConfig); deploymentListenerJob.addJobChangeListener(new JobChangeAdapter() { public void done(IJobChangeEvent event) { ConnectionsRegistrySingleton.getInstance().removeListener(deploymentListenerJob.getConnectionsRegistryListener()); debugContext.setPod(deploymentListenerJob.getPod()); if (event.getResult().isOK() && debugContext.getDebugListener() != null) { try { debugContext.getDebugListener().onPodRestart(debugContext, monitor); } catch (CoreException e) { throw new OpenShiftCoreException(e); } } }; }); ConnectionsRegistrySingleton.getInstance().addListener(deploymentListenerJob.getConnectionsRegistryListener()); deploymentListenerJob.schedule(); client.update(deploymentConfig); try { deploymentListenerJob.join(DeploymentConfigListenerJob.TIMEOUT, monitor); } catch (OperationCanceledException | InterruptedException e) { e.printStackTrace(); } IStatus result = deploymentListenerJob.getResult(); if (result == null) { throw new CoreException(deploymentListenerJob.getTimeOutStatus()); } else if (!result.isOK()) { throw new CoreException(result); } }
Source:
<code><START> void sync(boolean force) throws IOException { <END> if (force) { for (FileChannel ch : channelsToSync) { ch.force(true); channelsToSync.remove(ch); } } log.trace("Sync'd channels", channelsToSync.size()); }</code><technical_language>try force segments instead of short-circuiting exiting failure</technical_language>

Target:
void sync(boolean force) throws IOException { Optional<IOException> err = Optional.empty(); if (force) { for (FileChannel ch : channelsToSync) { try { ch.force(true); } catch (IOException ex) { log.warn("Error - can't sync a file channel"); err = Optional.of(ex); } finally { channelsToSync.remove(ch); } } } log.trace("Sync'd channels", channelsToSync.size()); if (err.isPresent()) { throw err.get(); } }
Source:
<code>public static String getPlatformInformation() { <START> StringBuilder ret = new StringBuilder(); <END> ret.append(String.format("Java Version: {%s}\n", System.getProperty("java.version"))); ret.append(String.format("Java Vendor: {%s}\n", System.getProperty("java.vendor"))); ret.append(String.format("JVM Version: {%s}\n", System.getProperty("java.vm.version"))); ret.append(String.format("JVM Name: {%s}\n", System.getProperty("java.vm.name"))); ret.append(String.format("OS: {%s}\n", System.getProperty("os.name"))); ret.append(String.format("OS Arch: {%s}\n", System.getProperty("os.arch"))); ret.append(String.format("OS Version: {%s}\n", System.getProperty("os.version"))); return ret.toString(); }</code><technical_language>Missing final</technical_language>

Target:
public static String getPlatformInformation() { return String.format("Java Version: {%s}\n", System.getProperty("java.version")) + String.format("Java Vendor: {%s}\n", System.getProperty("java.vendor")) + String.format("JVM Version: {%s}\n", System.getProperty("java.vm.version")) + String.format("JVM Name: {%s}\n", System.getProperty("java.vm.name")) + String.format("OS: {%s}\n", System.getProperty("os.name")) + String.format("OS Arch: {%s}\n", System.getProperty("os.arch")) + String.format("OS Version: {%s}\n", System.getProperty("os.version")); }
Source:
<code>private Catalog replayFailedCatalogRebuildUnderDebug( VoltCompiler autoGenCompiler, List<VoltCompilerReader> autogenReaderList, InMemoryJarfile autoGenJarOutput) { Catalog autoGenCatalog = autoGenCompiler.compileCatalogInternal(null, null, <START> autogenReaderList, new ArrayList<>(), autoGenJarOutput); <END> return autoGenCatalog; }</code><technical_language>Collections.emptyList() creating a new list</technical_language>

Target:
private Catalog replayFailedCatalogRebuildUnderDebug( VoltCompiler autoGenCompiler, List<VoltCompilerReader> autogenReaderList, InMemoryJarfile autoGenJarOutput) { Catalog autoGenCatalog = autoGenCompiler.compileCatalogInternal(null, null, autogenReaderList, Collections.emptyList(), autoGenJarOutput); return autoGenCatalog; }
Source:
<code>public void assertIsEqualToWithSortedQueryParameters(AssertionInfo info, URL actual, URL expected) { assertNotNull(info, actual); if (expected.getQuery() == null || actual.getQuery() == null) if (expected.getQuery() == null && actual.getQuery() == null) <START> return; <END> else throw failures.failure(info, shouldBeEqualToWithSortedQueryParameters(actual, expected)); String expected_non_query = expected.toString().substring(0, expected.toString().length() - expected.getQuery().length()); String actual_non_query = actual.toString().substring(0, actual.toString().length() - actual.getQuery().length()); if (!expected_non_query.equals(actual_non_query)) throw failures.failure(info, shouldBeEqualToWithSortedQueryParameters(actual, expected)); String[] expected_query_params = expected.getQuery().split("&"); String[] actual_query_params = actual.getQuery().split("&"); java.util.Arrays.sort(expected_query_params); java.util.Arrays.sort(actual_query_params); if (!java.util.Arrays.toString(expected_query_params).equals(Arrays.toString(actual_query_params))) throw failures.failure(info, shouldBeEqualToWithSortedQueryParameters(actual, expected)); }</code><technical_language>execute if block handle case null. execute other if checks if of null throw error nested code remove need for else construct</technical_language>

Target:
public void assertIsEqualToWithSortedQueryParameters(AssertionInfo info, URL actual, URL expected) { assertNotNull(info, actual); if (!extractNonQueryParams(expected).equals(extractNonQueryParams(actual))) throw failures.failure(info, shouldBeEqualToWithSortedQueryParameters(actual, expected)); if (!Objects.deepEquals(extractSortedQueryParams(expected), extractSortedQueryParams(actual))) throw failures.failure(info, shouldBeEqualToWithSortedQueryParameters(actual, expected)); }
Source:
<code>public void setTreatments(List<Treatment> treatments) { if (treatments != null) { for (int i = 0; i < treatments.size(); i++) { treatments.get(i).setDrugs(treatments.get(i).getDrugs()); <START> treatments.get(i).setPriority(i); <END> } this.treatments = new HashSet<>(treatments); } }</code><technical_language>index + 1 set priority value</technical_language>

Target:
public void setTreatments(List<Treatment> treatments) { if (treatments != null) { for (int i = 0; i < treatments.size(); i++) { treatments.get(i).setDrugs(treatments.get(i).getDrugs()); if(treatments.get(i).getPriority() == null) { treatments.get(i).setPriority(i+1); } } this.treatments = new HashSet<>(treatments); } }
Source:
<code>void createSessionReceiverForNonSessionEntity(MessagingEntityType entityType) { String sessionId = "test-session-id"; ServiceBusClientBuilder.ServiceBusSessionReceiverClientBuilder builder = getBuilder(false) .sessionReceiver(); if (entityType == MessagingEntityType.QUEUE) { builder.queueName(getQueueName()); } else if (entityType == MessagingEntityType.SUBSCRIPTION) { <START> builder.topicName(getTopicName()); <END> builder.subscriptionName(getSubscriptionName()); } ServiceBusReceiverAsyncClient invalidReceiver = builder.sessionId(sessionId).buildAsyncClient(); StepVerifier.create(invalidReceiver.receive()) .verifyErrorMatches(error -> error instanceof UnsupportedOperationException); }</code><technical_language>builder pattern: builder.topicName().subscriptionName()</technical_language>

Target:
void createSessionReceiverForNonSessionEntity(MessagingEntityType entityType) { String sessionId = "test-session-id"; ServiceBusClientBuilder.ServiceBusSessionReceiverClientBuilder builder = getBuilder(false) .sessionReceiver(); if (entityType == MessagingEntityType.QUEUE) { builder.queueName(getQueueName()); } else if (entityType == MessagingEntityType.SUBSCRIPTION) { builder.topicName(getTopicName()).subscriptionName(getSubscriptionName()); } ServiceBusReceiverAsyncClient invalidReceiver = builder.sessionId(sessionId).buildAsyncClient(); StepVerifier.create(invalidReceiver.receive()) .verifyErrorMatches(error -> error instanceof UnsupportedOperationException); }
Source:
<code>public void performCancel(IProgressMonitor monitor) throws CoreException { super.performCancel(monitor); <START> trackNewServerEvent(UsageEventType.FAILED_VALUE); <END> }</code><technical_language>constants for values. a method return recompiled pick a change</technical_language>

Target:
public void performCancel(IProgressMonitor monitor) throws CoreException { super.performCancel(monitor); trackNewServerEvent(0); }
Source:
<code>public void testOne() throws Exception { final File fileToProcess = new File( getPath("SuppressionXpathRegressionMissingLeadingAsterisk.java")); final DefaultConfiguration moduleConfig = createModuleConfig(MissingLeadingAsteriskCheck.class); final String[] expectedViolation = { <START> "3:1: " + getCheckMessage(JavadocStyleCheck.class, <END> MissingLeadingAsteriskCheck.MSG_MISSING_ASTERISK), }; final List<String> expectedXpathQueries = Collections.singletonList( "/CLASS_DEF[./IDENT[@text='SuppressionXpathRegressionMissingLeadingAsterisk']]" + "/MODIFIERS/BLOCK_COMMENT_BEGIN"); runVerifications(moduleConfig, fileToProcess, expectedViolation, expectedXpathQueries); }</code><technical_language>I it</technical_language>

Target:
public void testOne() throws Exception { final File fileToProcess = new File( getPath("SuppressionXpathRegressionMissingLeadingAsterisk.java")); final DefaultConfiguration moduleConfig = createModuleConfig(MissingLeadingAsteriskCheck.class); final String[] expectedViolation = { "3:1: " + getCheckMessage(MissingLeadingAsteriskCheck.class, MissingLeadingAsteriskCheck.MSG_MISSING_ASTERISK), }; final List<String> expectedXpathQueries = Collections.singletonList( "/CLASS_DEF[./IDENT[@text='SuppressionXpathRegressionMissingLeadingAsterisk']]" + "/MODIFIERS/BLOCK_COMMENT_BEGIN"); runVerifications(moduleConfig, fileToProcess, expectedViolation, expectedXpathQueries); }
Source:
<code>private static @NonNull Iterable<ITmfEventAspect<?>> getExperimentAspects( final TmfExperiment experiment) { List<ITmfTrace> traces = experiment.getTraces(); <START> ImmutableSet.Builder<ITmfEventAspect<?>> builder = new ImmutableSet.Builder<>(); <END> builder.add(TmfBaseAspects.getTraceNameAspect()); String commonTraceType = getCommonTraceType(experiment); ArrayList<ITmfEventAspect<?>> list = new ArrayList<>(); if (commonTraceType != null) { builder.addAll(traces.get(0).getEventAspects()); list.addAll(builder.build()); } else { builder.addAll(experiment.getEventAspects()); for (ITmfTrace trace : traces) { Iterable<ITmfEventAspect<?>> traceAspects = trace.getEventAspects(); builder.addAll(traceAspects); } list.addAll(builder.build()); if (list.remove(TmfBaseAspects.getContentsAspect())) { list.add(TmfBaseAspects.getContentsAspect()); } } return ImmutableList.copyOf(list); }</code><technical_language>replace a LinkedHashSet</technical_language>

Target:
private static @NonNull Iterable<ITmfEventAspect<?>> getExperimentAspects( final TmfExperiment experiment) { List<ITmfTrace> traces = experiment.getTraces(); HashSet<ITmfEventAspect<?>> builder = new LinkedHashSet<>(); builder.add(TmfBaseAspects.getTraceNameAspect()); String commonTraceType = getCommonTraceType(experiment); if (commonTraceType != null) { traces.get(0).getEventAspects().forEach(builder::add); } else { experiment.getEventAspects().forEach(builder::add); for (ITmfTrace trace : traces) { Iterable<ITmfEventAspect<?>> traceAspects = trace.getEventAspects(); traceAspects.forEach(builder::add); } if (builder.remove(TmfBaseAspects.getContentsAspect())) { builder.add(TmfBaseAspects.getContentsAspect()); } } return ImmutableSet.copyOf(builder); }
Source:
<code>public boolean canBeMember(PerunSession sess, Vo vo, User user, String loa) throws InternalErrorException, VoNotExistsException, PrivilegeException { Utils.checkPerunSession(sess); getPerunBl().getVosManagerBl().checkVoExists(sess, vo); <START> if (!AuthzResolver.isAuthorized(sess, Role.VOADMIN, vo) && !AuthzResolver.isAuthorized(sess, Role.SELF, user) && !AuthzResolver.isAuthorized(sess, Role.PERUNOBSERVER)) { throw new PrivilegeException(sess, "canBeMember"); } <END> return getMembersManagerBl().canBeMember(sess, vo, user, loa); }</code><technical_language>Please add VOOBSERVER</technical_language>

Target:
public boolean canBeMember(PerunSession sess, Vo vo, User user, String loa) throws InternalErrorException, VoNotExistsException, PrivilegeException { Utils.checkPerunSession(sess); getPerunBl().getVosManagerBl().checkVoExists(sess, vo); if (!AuthzResolver.isAuthorized(sess, Role.VOADMIN, vo) && !AuthzResolver.isAuthorized(sess, Role.VOOBSERVER, vo) && !AuthzResolver.isAuthorized(sess, Role.SELF, user) && !AuthzResolver.isAuthorized(sess, Role.PERUNOBSERVER)) { throw new PrivilegeException(sess, "canBeMember"); } return getMembersManagerBl().canBeMember(sess, vo, user, loa); }
Source:
<code>public final void reset() { resetMC(); setpoint = sensor.pidGet(); synchronized (justReset) { justReset = true; <START> } <END> }</code><technical_language>Useless for reasons: synchronizing a field changes do anything, setting of need synchronized (what matters for synchronizing is blocks of code require remain same)</technical_language>

Target:
public final void reset() { resetErrorToZero(); setpoint = sensor.pidGet(); justReset = true; }
Source:
<code>public List<Column> columns() { final Collection<XML> nodes; try { nodes = new JdkRequest( <START> UriBuilder.fromUri(this.home).build() <END> ) .header(HttpHeaders.ACCEPT, MediaType.APPLICATION_XML) .header(HttpHeaders.AUTHORIZATION, this.token) .method(Request.GET) .fetch() .as(RestResponse.class) .assertStatus(HttpURLConnection.HTTP_OK) .as(XmlResponse.class) .xml() .nodes("/page/columns/column"); } catch (IOException ex) { throw new IllegalStateException(ex); } final List<Column> columns = new ArrayList<Column>(nodes.size()); for (final XML node : nodes) { columns.add( new Column.Simple( node.xpath("title/text()").get(0), !node.nodes("links/link[@rel='group']").isEmpty(), !node.nodes("./@sum").isEmpty() ) ); } return columns; }</code><technical_language>need UriBuilder</technical_language>

Target:
public List<Column> columns() { final Collection<XML> nodes; try { nodes = new JdkRequest(this.home) .header(HttpHeaders.ACCEPT, MediaType.APPLICATION_XML) .header(HttpHeaders.AUTHORIZATION, this.token) .fetch() .as(RestResponse.class) .assertStatus(HttpURLConnection.HTTP_OK) .as(XmlResponse.class) .xml() .nodes("/page/columns/column"); } catch (IOException ex) { throw new IllegalStateException(ex); } final List<Column> columns = new ArrayList<Column>(nodes.size()); for (final XML node : nodes) { columns.add( new Column.Simple( node.xpath("title/text()").get(0), !node.nodes("links/link[@rel='group']").isEmpty(), !node.nodes("./@sum").isEmpty() ) ); } return columns; }
Source:
<code>public static void showPushNotification(Context context, Intent messageIntent) { final MPConfig config = MPConfig.getInstance(context); String resourcePackage = config.getResourcePackageName(); if (null == resourcePackage) { resourcePackage = context.getPackageName(); } final ResourceIds drawableIds = new ResourceReader.Drawables(resourcePackage, context); final Context applicationContext = context.getApplicationContext(); MixpanelPushNotification mixpanelPushNotification = new MixpanelPushNotification(applicationContext, drawableIds); Notification notification = mixpanelPushNotification.createNotification(messageIntent); if (null != notification) { final NotificationManager notificationManager = (NotificationManager) context.getSystemService(Context.NOTIFICATION_SERVICE); if (mixpanelPushNotification.tag != null) { <START> notificationManager.notify(mixpanelPushNotification.tag ,0, notification); <END> } else { notificationManager.notify(0, notification); } } }</code><technical_language>remove space .tag add space comma: notificationManager.notify(mixpanelPushNotification.tag, 0, notification);</technical_language>

Target:
public static void showPushNotification(Context context, Intent messageIntent) { final MPConfig config = MPConfig.getInstance(context); String resourcePackage = config.getResourcePackageName(); if (null == resourcePackage) { resourcePackage = context.getPackageName(); } final ResourceIds drawableIds = new ResourceReader.Drawables(resourcePackage, context); final Context applicationContext = context.getApplicationContext(); MixpanelPushNotification mixpanelPushNotification = new MixpanelPushNotification(applicationContext, drawableIds); Notification notification = mixpanelPushNotification.createNotification(messageIntent); if (null != notification) { final NotificationManager notificationManager = (NotificationManager) context.getSystemService(Context.NOTIFICATION_SERVICE); if (mixpanelPushNotification.data.tag != null) { notificationManager.notify(mixpanelPushNotification.data.tag, 0, notification); } else { notificationManager.notify(0, notification); } } }
Source:
<code>void notNull__non_null_argument_returns_argument() { <START> final String value = "testValue"; <END> String actual = ValidationUtils.notNull(value); Assertions.assertEquals(value, actual); }</code><technical_language>final notation for local variables. I this case shortened moving actual assertEquals statement - in method</technical_language>

Target:
void notNull__non_null_argument_returns_argument() { String actual = ValidationUtils.notNull("testValue"); Assertions.assertEquals("testValue", actual); }
Source:
<code>public void startSubscriber() throws FalconException { try { connection = createAndGetConnection(implementation, userName, password, url); connection.setClientID(FALCON_CLIENT_ID); topicSession = (TopicSession) connection.createSession(false, Session.AUTO_ACKNOWLEDGE); Topic destination = topicSession.createTopic(topicName); <START> topicSubscriber = topicSession.createDurableSubscriber(destination, FALCON_CLIENT_ID); <END> topicSubscriber.setMessageListener(this); connection.setExceptionListener(this); connection.start(); } catch (Exception e) { LOG.error("Error starting topicSubscriber of topic: " + this.toString(), e); throw new FalconException(e); } }</code><technical_language>this change</technical_language>

Target:
public void startSubscriber() throws FalconException { try { connection = createAndGetConnection(implementation, userName, password, url); connection.setClientID(FALCON_CLIENT_ID); topicSession = (TopicSession) connection.createSession(false, Session.AUTO_ACKNOWLEDGE); Topic destination = topicSession.createTopic(topicName); topicSubscriber = topicSession.createDurableSubscriber(destination, FALCON_CLIENT_ID, WorkflowNameBuilder.WorkflowName.getJMSFalconSelector(), false); topicSubscriber.setMessageListener(this); connection.setExceptionListener(this); connection.start(); } catch (Exception e) { LOG.error("Error starting topicSubscriber of topic: " + this.toString(), e); throw new FalconException(e); } }
Source:
<code>public void configureResources(Context context) { if (context == null) { return; } <START> <END> mNormalTextColor = ContextExtensionsKt.getColorFromAttribute(context, R.attr.colorOnSurface); mNormalBackgroundColor = ContextExtensionsKt.getColorFromAttribute(context, R.attr.colorSurface); mAgoTextColor = ContextExtensionsKt.getColorFromAttribute(context, R.attr.wpColorOnSurfaceMedium); mUnapprovedTextColor = ContextExtensionsKt.getColorFromAttribute(context, R.attr.wpColorWarningDark); mIndentedLeftPadding = context.getResources().getDimensionPixelSize(R.dimen.margin_extra_large) * 2; }</code><technical_language>I this white line removed</technical_language>

Target:
public void configureResources(Context context) { if (context == null) { return; } mNormalBackgroundColor = ContextExtensionsKt.getColorFromAttribute(context, R.attr.colorSurface); mIndentedLeftPadding = context.getResources().getDimensionPixelSize(R.dimen.margin_extra_large) * 2; }
Source:
<code>public void varDefValidation() { final String mark = "+"; Queue<String> checks = new LinkedList<String>(getUsedVariables()); checks.offer(mark); final Set<String> varWithValue = new HashSet<String>(); int lastvarWithValueCnt = varWithValue.size(); String lastCheck = ""; final Set<String> lasttodocheck = new HashSet<String>(); while (!checks.isEmpty()) { String check = checks.peek(); if (mark.equals(check)) { if (varWithValue.size() < lastvarWithValueCnt ) { <START> throw new ExpressionException("circular reference var"); <END> } else if (varWithValue.size() == lastvarWithValueCnt && lasttodocheck.contains(lastCheck)){ throw new ExpressionException("circular reference var"); } else { lastvarWithValueCnt = varWithValue.size(); if (checks.size() > 1) { checks.add(mark); } } } else { if (!variables.containsKey(check)) { throw new ExpressionException("unknown var : " + check); } lastCheck = check; LazyNumber innerVariable = variables.get(check); String innerExp = innerVariable.getString(); if (isNumber(innerExp)) { varWithValue.add(check); } else { Expression exp = createEmbeddedExpression(innerExp); Set<String> tocheck = new HashSet<String>(exp.getUsedVariables()); tocheck.removeAll(varWithValue); if (tocheck.isEmpty()) { varWithValue.add(check); } else { lasttodocheck.addAll(tocheck); checks.addAll(tocheck); } } } checks.poll(); } }</code><technical_language>If available, include name of variable is causing problem</technical_language>

Target:
public void varDefValidation() { final String mark = "+"; Queue<String> checks = new LinkedList<String>(getUsedVariables()); checks.offer(mark); final Set<String> varWithValue = new HashSet<String>(); int lastvarWithValueCnt = varWithValue.size(); String lastCheckVar = ""; final Set<String> alreadyCheckSet = new HashSet<String>(); final Set<String> lastCheckSet = new HashSet<String>(); while (!checks.isEmpty()) { String check = checks.peek(); if (mark.equals(check)) { lastCheckSet.removeAll(varWithValue); if (varWithValue.size() < lastvarWithValueCnt || (varWithValue.size() == lastvarWithValueCnt && alreadyCheckSet.containsAll(lastCheckSet))) { throw new ExpressionException("circular reference var : " + lastCheckVar); } else { lastvarWithValueCnt = varWithValue.size(); if (checks.size() > 1) { checks.add(mark); } } } else { if (!variables.containsKey(check)) { throw new ExpressionException("unknown var : " + check); } LazyNumber innerVariable = variables.get(check); String innerExp = innerVariable.getString(); if (varWithValue.contains(check) || isNumber(innerExp)) { varWithValue.add(check); } else { Expression exp = createEmbeddedExpression(innerExp); Set<String> tocheck = new HashSet<String>(exp.getUsedVariables()); tocheck.removeAll(varWithValue); if (tocheck.isEmpty()) { varWithValue.add(check); } else { lastCheckVar = check; alreadyCheckSet.add(check); lastCheckSet.addAll(tocheck); checks.addAll(tocheck); } } } checks.poll(); } }
Source:
<code>public void hasNoActiveMemberships_shouldReturnTrueIfNoneExists() throws Exception{ SimpleDateFormat dateFormat = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss"); Date endDateEarlier = dateFormat.parse("2007-02-01 00:00:00"); Date endDateLater = dateFormat.parse("2100-02-01 00:00:00"); <START> <END> Cohort cohort = new Cohort(3); CohortMembership temp = new CohortMembership(7); temp.setVoided(true); temp.setEndDate(endDateLater); cohort.addMembership(temp); temp = new CohortMembership(8); temp.setVoided(true); cohort.addMembership(temp); temp = new CohortMembership(9); temp.setEndDate(endDateEarlier); cohort.addMembership(temp); temp = new CohortMembership(10); temp.setVoided(true); cohort.addMembership(temp); assertTrue(cohort.hasNoActiveMemberships()); }</code><technical_language>this test pass year 2100</technical_language>

Target:
public void hasNoActiveMemberships_shouldReturnTrueIfNoneExists() throws Exception{ Calendar calendar = Calendar.getInstance(); calendar.add(Calendar.DAY_OF_YEAR, 1); Date endDateLater = calendar.getTime(); calendar.add(Calendar.DAY_OF_YEAR, -2); Date endDateEarlier = calendar.getTime(); Cohort cohort = new Cohort(3); CohortMembership temp = new CohortMembership(7); temp.setVoided(true); temp.setEndDate(endDateLater); cohort.addMembership(temp); temp = new CohortMembership(8); temp.setVoided(true); cohort.addMembership(temp); temp = new CohortMembership(9); temp.setEndDate(endDateEarlier); cohort.addMembership(temp); temp = new CohortMembership(10); temp.setVoided(true); cohort.addMembership(temp); assertTrue(cohort.hasNoActiveMemberships()); }
Source:
<code>private void add(String requestDomain, String requestPath, Cookie cookie) { AbstractMap.SimpleEntry<String, Boolean> pair = cookieDomain(cookie.domain(), requestDomain); String keyDomain = pair.getKey(); boolean hostOnly = pair.getValue(); String keyPath = cookiePath(cookie.path(), requestPath); CookieKey key = new CookieKey(cookie.name().toLowerCase(), keyPath); if (hasCookieExpired(cookie, 0)) cookieJar.getOrDefault(keyDomain, Collections.emptyMap()).remove(key); else { <START> cookieJar.putIfAbsent(keyDomain, new ConcurrentHashMap<>()); <END> cookieJar.get(keyDomain).put(key, new StoredCookie(cookie, hostOnly, cookie.maxAge() != Cookie.UNDEFINED_MAX_AGE)); } }</code><technical_language>Please computeIfAbsent instead allocate ConcurrentHashMap existing key</technical_language>

Target:
private void add(String requestDomain, String requestPath, Cookie cookie) { AbstractMap.SimpleEntry<String, Boolean> pair = cookieDomain(cookie.domain(), requestDomain); String keyDomain = pair.getKey(); boolean hostOnly = pair.getValue(); String keyPath = cookiePath(cookie.path(), requestPath); CookieKey key = new CookieKey(cookie.name().toLowerCase(), keyPath); if (hasCookieExpired(cookie, 0)) cookieJar.getOrDefault(keyDomain, Collections.emptyMap()).remove(key); else { final Map<CookieKey, StoredCookie> innerMap = cookieJar.computeIfAbsent(keyDomain, domain -> new ConcurrentHashMap<>()); innerMap.put(key, new StoredCookie(cookie, hostOnly, cookie.maxAge() != Cookie.UNDEFINED_MAX_AGE)); } }
Source:
<code>void cancelScheduleMessage() { long sequenceNumberReturned = 10; when(managementNode.cancelScheduledMessage(eq(sequenceNumberReturned))) .thenReturn(Mono.empty()); StepVerifier.create(sender.cancelScheduledMessage(sequenceNumberReturned)) .verifyComplete(); <START> } <END></code><technical_language>verify management node operation called</technical_language>

Target:
void cancelScheduleMessage() { long sequenceNumberReturned = 10; when(managementNode.cancelScheduledMessage(eq(sequenceNumberReturned))).thenReturn(Mono.empty()); StepVerifier.create(sender.cancelScheduledMessage(sequenceNumberReturned)) .verifyComplete(); verify(managementNode).cancelScheduledMessage(sequenceNumberReturned); }
Source:
<code>public void unlock() { boolean status = leaseBlobManager.releaseLease(leaseId.get()); if (status) { LOG.info("Unlocked successfully."); <START> hasLock.set(false); <END> leaseId.getAndSet(null); } else { LOG.info("Unable to unlock."); } }</code><technical_language>above. getAndSet(boolean)</technical_language>

Target:
public void unlock() { boolean status = leaseBlobManager.releaseLease(leaseId.get()); if (status) { LOG.info("Unlocked successfully."); hasLock.getAndSet(false); leaseId.getAndSet(null); } else { LOG.info("Unable to unlock."); } }
Source:
<code>public int getRankFromBasePair(int base) { <START> Map<String, Object> parameters = new HashMap<>(1); <END> parameters.put("dist", base); return query(e -> (int) e.execute(GET_RANK_FROM_BASEPAIR, parameters).columnAs("rank").next()); }</code><technical_language>Collections.singletonMap("dist", base) is better</technical_language>

Target:
public int getRankFromBasePair(int base) { Map<String, Object> parameters = Collections.singletonMap("dist", base); return query(e -> (int) e.execute(GET_RANK_FROM_BASEPAIR, parameters) .columnAs("rank").next()); }
Source:
<code><START> public static void close(Closeable closeable) <END> { try { Closeables.close(closeable, true); } catch (IOException e) { throw new ISE("WTF?! A swallowedException bubbled up?!"); } }</code><technical_language>more clear reimplement this Closeables... gonna a long function</technical_language>

Target:
public static void close(Closeable closeable) { if (closeable == null) { return; } try { closeable.close(); } catch (IOException e) { log.error(e, "IOException thrown while closing Closeable."); } }
Source:
<code>public Object call() throws Exception { Reader reader = null; try { DefaultHandler handler = null; if (nodesList.size() > 0) { SAXLoopCompositeHandler chd = new SAXLoopCompositeHandler(); for (int i = 0; i < nodesList.size(); i++) { XMLNodes ns = nodesList.get(i); chd.register(new SimpleSAXLoopHandler(ns, multiCache)); } handler = chd; } else { hd = new SimpleSAXLoopHandler(nodes, bcache); handler = hd; } SAXParser saxParser = null; SAXParserFactory spf = SAXParserFactory.newInstance(); spf.setFeature(javax.xml.XMLConstants.FEATURE_SECURE_PROCESSING, Boolean.TRUE); <START> spf.setFeature(DISALLOW_DOCTYPE_DECL, true); <END> if (ignoreDTD) { spf.setFeature("<LINK_0>", false); } saxParser = spf.newSAXParser(); saxParser.setProperty("<LINK_1>", handler); if (fileURL != null) { reader = new UnicodeReader(new java.io.FileInputStream(fileURL), this.charset); org.xml.sax.InputSource inSource = new org.xml.sax.InputSource(reader); saxParser.parse(inSource, handler); } else { reader = new UnicodeReader(is, this.charset); org.xml.sax.InputSource inSource = new org.xml.sax.InputSource(reader); saxParser.parse(inSource, handler); } } finally { try { if (reader != null) { reader.close(); } } finally { if (multiCache != null) { multiCache.notifyErrorOccurred(); } if (bcache != null) { bcache.notifyErrorOccurred(); } } } return null; }</code><technical_language>Move if statement above</technical_language>

Target:
public Object call() throws Exception { Reader reader = null; try { DefaultHandler handler = null; if (nodesList.size() > 0) { SAXLoopCompositeHandler chd = new SAXLoopCompositeHandler(); for (int i = 0; i < nodesList.size(); i++) { XMLNodes ns = nodesList.get(i); chd.register(new SimpleSAXLoopHandler(ns, multiCache)); } handler = chd; } else { hd = new SimpleSAXLoopHandler(nodes, bcache); handler = hd; } SAXParser saxParser = null; SAXParserFactory spf = SAXParserFactory.newInstance(); spf.setFeature(javax.xml.XMLConstants.FEATURE_SECURE_PROCESSING, Boolean.TRUE); if (ignoreDTD) { spf.setFeature(DISALLOW_DOCTYPE_DECL, true); spf.setFeature("<LINK_0>", false); } saxParser = spf.newSAXParser(); saxParser.setProperty("<LINK_1>", handler); if (fileURL != null) { reader = new UnicodeReader(new java.io.FileInputStream(fileURL), this.charset); org.xml.sax.InputSource inSource = new org.xml.sax.InputSource(reader); saxParser.parse(inSource, handler); } else { reader = new UnicodeReader(is, this.charset); org.xml.sax.InputSource inSource = new org.xml.sax.InputSource(reader); saxParser.parse(inSource, handler); } } finally { try { if (reader != null) { reader.close(); } } finally { if (multiCache != null) { multiCache.notifyErrorOccurred(); } if (bcache != null) { bcache.notifyErrorOccurred(); } } } return null; }
Source:
<code>public void configure(Type type, Properties params, Dialect dialect) throws MappingException { params.setProperty( <START> SEGMENT_VALUE_PARAM, PropertiesHelper.getString( <END> SEQUENCE_NAME, params, params.getProperty( TABLE_NAME ) ) ); tableGenerator.configure( type, params, dialect ); }</code><technical_language>OgmTableGenerator.SEGMENT_VALUE_PARAM instead of haveing a duplicated copy in SEGMENT_VALUE_PARAM</technical_language>

Target:
public void configure(Type type, Properties params, Dialect dialect) throws MappingException { Properties newParams = new Properties( params ); for ( Map.Entry<Object, Object> param : params.entrySet() ) { newParams.put( param.getKey(), param.getValue() ); } newParams.setProperty( OgmTableGenerator.SEGMENT_VALUE_PARAM, PropertiesHelper.getString( OgmTableGenerator.SEGMENT_VALUE_PARAM, newParams, newParams.getProperty( PersistentIdentifierGenerator.TABLE ) ) ); tableGenerator.configure( type, newParams, dialect ); }