auphong2707/dl4se-code-review-dataset huggingface dataset:
Source:
<code>protected void onInit() throws Exception { super.onInit(); if (this.extractPayload) { <START> Assert.notNull(this.serializer, "'serializer' has to be provided where 'expectMessage == true'."); <END> } if (this.taskExecutor == null) { String beanName = this.getComponentName(); this.taskExecutor = new SimpleAsyncTaskExecutor((beanName == null ? "" : beanName + "-") + this.getComponentType()); } if (!(this.taskExecutor instanceof ErrorHandlingTaskExecutor) && this.getBeanFactory() != null) { MessagePublishingErrorHandler errorHandler = new MessagePublishingErrorHandler(new BeanFactoryChannelResolver(this.getBeanFactory())); errorHandler.setDefaultErrorChannel(this.errorChannel); this.taskExecutor = new ErrorHandlingTaskExecutor(this.taskExecutor, errorHandler); } }</code><technical_language>I some confuse names extractPayload expectMessage. mind reworking a proper state</technical_language>

Target:
protected void onInit() throws Exception { super.onInit(); if (this.expectMessage) { Assert.notNull(this.serializer, "'serializer' has to be provided where 'expectMessage == true'."); } if (this.taskExecutor == null) { String beanName = this.getComponentName(); this.taskExecutor = new SimpleAsyncTaskExecutor((beanName == null ? "" : beanName + "-") + this.getComponentType()); } if (!(this.taskExecutor instanceof ErrorHandlingTaskExecutor) && this.getBeanFactory() != null) { MessagePublishingErrorHandler errorHandler = new MessagePublishingErrorHandler(new BeanFactoryChannelResolver(this.getBeanFactory())); errorHandler.setDefaultErrorChannel(this.errorChannel); this.taskExecutor = new ErrorHandlingTaskExecutor(this.taskExecutor, errorHandler); } }
Source:
<code>public void connect() throws DeploymentException { super.connect(); <START> String request = MessageFormat.format(QUERY_FB_TYPES, getNextId()); try { QueryResponseHandler queryResp = sendQUERY("", request); setTypes(queryResp.getQueryResult()); } catch (Exception e) { logger.error(MessageFormat.format(Messages.DTL_QueryFailed, "FB Types")); } <END> }</code><technical_language>this extracted a method</technical_language>

Target:
public void connect() throws DeploymentException { super.connect(); queryFBTypes(); }
Source:
<code>public void run() { try { while (!stop) { out.write(block); out.hflush(); blocksWritten++; } }catch (IOException e){ <START> e.printStackTrace(); <END> } }</code><technical_language>logger</technical_language>

Target:
public void run() { try { while (!stop) { out.write(block); out.hflush(); blocksWritten++; } }catch (IOException e){ LOG.info(e.toString(),e); } }
Source:
<code>protected void executeCommand() { <START> Collection<NetworkCluster> attachments = getParameters().getAttachments(); <END> Collection<NetworkCluster> updates = getParameters().getUpdates(); updates.addAll(updatingDefaultRouteNetwork .whenMovingDefaultRouteRoleCheckIfCurrentNetworkIsAlsoUpdated(updates)); Boolean dbUpdateResult = TransactionSupport.executeInNewTransaction(() -> { final List<NetworkCluster> managementNetworkAttachments = attachments.stream().filter(networkRolePredicates::becomingManagementNetwork).collect(Collectors.toList()); final List<NetworkCluster> nonManagementNetworkAttachments = attachments.stream().filter(becomingManagementNetworkPredicate.negate()).collect(Collectors.toList()); final List<NetworkCluster> managementNetworkUpdates = updates.stream().filter(becomingManagementNetworkPredicate).collect(Collectors.toList()); final List<NetworkCluster> nonManagementNetworkUpdates = updates.stream().filter(becomingManagementNetworkPredicate.negate()).collect(Collectors.toList()); boolean resultStatus = attachNetworks(managementNetworkAttachments); resultStatus = resultStatus && updateNetworkAttachments(managementNetworkUpdates); resultStatus = resultStatus && attachNetworks(nonManagementNetworkAttachments); resultStatus = resultStatus && updateNetworkAttachments(nonManagementNetworkUpdates); resultStatus = resultStatus && detachNetworks(getParameters().getDetachments()); return resultStatus; }); setSucceeded(dbUpdateResult); if (dbUpdateResult) { propagateNetworksChanges(); } }</code><technical_language>This fix (completing missing netwrokCluster loses grants role) is done in 'ManageNetworkClustersCommand' if 'UpdateNetworkOnCluster', 'AttachNetworkToCluster' 'DetachNetworkToCluster' called rest</technical_language>

Target:
protected void executeCommand() { Collection<NetworkCluster> attachments = getParameters().getAttachments(); Collection<NetworkCluster> updates = getParameters().getUpdates(); updates.addAll(updatingDefaultRouteNetwork .whenMovingDefaultRouteRoleCheckIfCurrentNetworkIsAlsoUpdated(updates)); Boolean dbUpdateResult = TransactionSupport.executeInNewTransaction(() -> { List<NetworkCluster> managementNetworkAttachments = becomesManagementNetwork(attachments); List<NetworkCluster> managementNetworkUpdates = becomesManagementNetwork(updates); List<NetworkCluster> nonManagementNetworkAttachments = stopBeingManagementNetwork(attachments); List<NetworkCluster> nonManagementNetworkUpdates = stopBeingManagementNetwork(updates); boolean resultStatus = attachNetworks(managementNetworkAttachments); resultStatus = resultStatus && updateNetworkAttachments(managementNetworkUpdates); resultStatus = resultStatus && attachNetworks(nonManagementNetworkAttachments); resultStatus = resultStatus && updateNetworkAttachments(nonManagementNetworkUpdates); resultStatus = resultStatus && detachNetworks(getParameters().getDetachments()); return resultStatus; }); setSucceeded(dbUpdateResult); if (dbUpdateResult) { propagateNetworksChanges(); } }
Source:
<code>private ApiInfo apiInfo() { <START> Collection<VendorExtension> vendorExtensions = new ArrayList<>(); <END> return new ApiInfo( "Oppijan verkkopalvelukokonaisuus / ePerusteet rajapinta", "", "Spring MVC API based on the swagger 2.0 and 1.2 specification", "<LINK_0>", null, "EUPL 1.1", "<LINK_1>", vendorExtensions); }</code><technical_language>Inline</technical_language>

Target:
private ApiInfo apiInfo() { return new ApiInfo( "Oppijan verkkopalvelukokonaisuus / ePerusteet rajapinta", "", "Spring MVC API based on the swagger 2.0 and 1.2 specification", "<LINK_0>", null, "EUPL 1.1", "<LINK_1>", new ArrayList<>()); }
Source:
<code><START> public int TextAlignment() { <END> return 0; }</code><technical_language>Actually, I this one. if do this? Switch CheckBox fill parent, in case sense able change text alignment. mind running a test of this updating this conversation results</technical_language>

Target:
public int TextAlignment() { return textAlignment; }
Source:
<code>private static Set<FileFormat> getFileFormatsFromDatabase(FileFormatDAO fileFormatDAO, Set<FileFormat> fileFormats) { Set<FileFormat> fileFormatsFromDB = new HashSet<>(); fileFormats.forEach(fileFormat -> { <START> FileFormat fileFormatFromDB = fileFormatDAO.findByLabelValue(fileFormat.getValue()); <END> if (fileFormatFromDB != null) { fileFormatsFromDB.add((fileFormatFromDB)); } else { fileFormatFromDB = new FileFormat(); fileFormatFromDB.setValue(fileFormat.getValue()); String id = fileFormatDAO.create(fileFormatFromDB); fileFormatsFromDB.add(fileFormatDAO.findByLabelValue(id)); } }); return fileFormatsFromDB; }</code><technical_language>label for file formats</technical_language>

Target:
private static Set<FileFormat> getFileFormatsFromDatabase(FileFormatDAO fileFormatDAO, Set<FileFormat> fileFormats) { Set<FileFormat> fileFormatsFromDB = new HashSet<>(); fileFormats.forEach(fileFormat -> { FileFormat fileFormatFromDB = fileFormatDAO.findFileFormatByValue(fileFormat.getValue()); if (fileFormatFromDB != null) { fileFormatsFromDB.add((fileFormatFromDB)); } else { fileFormatFromDB = new FileFormat(); fileFormatFromDB.setValue(fileFormat.getValue()); String id = fileFormatDAO.create(fileFormatFromDB); fileFormatsFromDB.add(fileFormatDAO.findFileFormatByValue(id)); } }); return fileFormatsFromDB; }
Source:
<code>protected Message doReceiveNoWait(final String queueName) { Message message = execute(channel -> { GetResponse response = channel.basicGet(queueName, !isChannelTransacted()); if (response != null) { long deliveryTag = response.getEnvelope().getDeliveryTag(); if (isChannelLocallyTransacted(channel)) { channel.basicAck(deliveryTag, false); channel.txCommit(); } else if (isChannelTransacted()) { ConnectionFactoryUtils.registerDeliveryTag(getConnectionFactory(), channel, deliveryTag); } return RabbitTemplate.this.buildMessageFromResponse(response); } return null; <START> }, obtainTargetConnectionFactory(this.receiveConnectionFactorySelectorExpression, queueName), false); <END> logReceived(message); return message; }</code><technical_language>is false explicit</technical_language>

Target:
protected Message doReceiveNoWait(final String queueName) { Message message = execute(channel -> { GetResponse response = channel.basicGet(queueName, !isChannelTransacted()); if (response != null) { long deliveryTag = response.getEnvelope().getDeliveryTag(); if (isChannelLocallyTransacted(channel)) { channel.basicAck(deliveryTag, false); channel.txCommit(); } else if (isChannelTransacted()) { ConnectionFactoryUtils.registerDeliveryTag(getConnectionFactory(), channel, deliveryTag); } return RabbitTemplate.this.buildMessageFromResponse(response); } return null; }, obtainTargetConnectionFactory(this.receiveConnectionFactorySelectorExpression, queueName)); logReceived(message); return message; }
Source:
<code>public void onLongPress(int position) { <START> beginRemoveLanguageMode(); <END> toggleSelectedLanguage(wikipediaLanguages.get(position)); adapter.notifyDataSetChanged(); }</code><technical_language>if add a logic check actionMode is null prevent resetting state of toggled items? if (actionMode == null) { beginRemoveLanguageMode(); }</technical_language>

Target:
public void onLongPress(int position) { if (actionMode == null) { beginRemoveLanguageMode(); } toggleSelectedLanguage(wikipediaLanguages.get(position)); adapter.notifyDataSetChanged(); }
Source:
<code>public static String filter(String correlationId) { if <START> (correlationId != null && correlationId.length() > 0) { <END> correlationId = correlationId.replaceAll("[^A-Za-z0-9]", ""); if (correlationId.length() > 0) { return correlationId.substring(0, Math.min(correlationId.length(), 32)); } } return null; }</code><technical_language>replaced StringUtils.isNotBlank</technical_language>

Target:
private static String filter(String correlationId) { if (StringUtils.isNotEmpty(correlationId)) { correlationId = correlationId.replaceAll("[^A-Za-z0-9]", ""); if (StringUtils.isNotEmpty(correlationId)) { return correlationId.substring(0, Math.min(correlationId.length(), 32)); } } return null; }
Source:
<code>public void theCoupleGMeterRequestIsReceivedForEMeter(final String gasMeter, final String eMeter) throws WebServiceSecurityException { <START> final CoupleMbusDeviceRequest request = CoupleMbusDeviceRequestFactory.forGatewayMbusDeviceAndChannel(eMeter, <END> gasMeter); final CoupleMbusDeviceAsyncResponse asyncResponse = this.smartMeteringInstallationClient .coupleMbusDevice(request); this.checkAndSaveCorrelationId(asyncResponse.getCorrelationUid()); }</code><technical_language>removal of channel a parameter, I name of factory method forGatewayMbusDeviceAndChannel changed too</technical_language>

Target:
public void theCoupleGMeterRequestIsReceivedForEMeter(final String gasMeter, final String eMeter) throws WebServiceSecurityException { final CoupleMbusDeviceRequest request = CoupleMbusDeviceRequestFactory.forGatewayMbusDevice(eMeter, gasMeter); final CoupleMbusDeviceAsyncResponse asyncResponse = this.smartMeteringInstallationClient .coupleMbusDevice(request); this.checkAndSaveCorrelationId(asyncResponse.getCorrelationUid()); }
Source:
<code>public String sign(String msg) { try { RSAPrivateKey key = getPrivateKey(); Signature sig = Signature.getInstance(SIGNING_ALGORITHM + "with" + key.getAlgorithm()); sig.initSign(key); <START> sig.update(msg.getBytes("UTF8")); <END> return hudson.remoting.Base64.encode(sig.sign()); } catch (GeneralSecurityException e) { throw new SecurityException(e); } catch (UnsupportedEncodingException e) { throw new AssertionError(e); } }</code><technical_language>shoul UTF-8 ensure compatability</technical_language>

Target:
public String sign(String msg) { try { RSAPrivateKey key = getPrivateKey(); Signature sig = Signature.getInstance(SIGNING_ALGORITHM + "with" + key.getAlgorithm()); sig.initSign(key); sig.update(msg.getBytes("UTF-8")); return hudson.remoting.Base64.encode(sig.sign()); } catch (GeneralSecurityException e) { throw new SecurityException(e); } catch (UnsupportedEncodingException e) { throw new AssertionError(e); } }
Source:
<code>public void fetchTestInfo(final Collection<TaskDataDto> taskDataDtos, final boolean enableTree) { TestInfoService.Async.getInstance().getTestInfos(taskDataDtos, new AsyncCallback<Map<TaskDataDto, Map<String, TestInfoDto>>>() { @Override public void onFailure(Throwable caught) { caught.printStackTrace(); new ExceptionPanel(place, caught.getMessage()); if (enableTree) enableControl(); } @Override public void onSuccess(Map<TaskDataDto, Map<String, TestInfoDto>> result) { SessionComparisonPanel scp = summaryPanel.getSessionComparisonPanel(); for (TaskDataDto td : result.keySet()) { scp.addTestInfo(td, result.get(td)); } } }); <START> } <END></code><technical_language>public void fetchTestInfo(final TaskDataDto taskDataDto ... is private case of public void fetchTestInfo(final Collection<TaskDataDto> taskDataDtos i propose call function (more general) avoid duplicating code</technical_language>

Target:
public void fetchTestInfo(final Collection<TaskDataDto> taskDataDtos, final boolean enableTree) { TestInfoService.Async.getInstance().getTestInfos(taskDataDtos, new AsyncCallback<Map<TaskDataDto, Map<String, TestInfoDto>>>() { @Override public void onFailure(Throwable caught) { caught.printStackTrace(); new ExceptionPanel(place, caught.getMessage()); if (enableTree) enableControl(); } @Override public void onSuccess(Map<TaskDataDto, Map<String, TestInfoDto>> result) { SessionComparisonPanel scp = summaryPanel.getSessionComparisonPanel(); for (TaskDataDto td : result.keySet()) { scp.addTestInfo(td, result.get(td)); } if (enableTree) enableControl(); } }); }
Source:
<code>public void unmanage(Entity e) { if (shouldSkipUnmanagement(e)) return; final List<EntityInternal> allEntities = Lists.newArrayList(); final ManagementTransitionInfo info = new ManagementTransitionInfo(managementContext, ManagementTransitionMode.NORMAL); recursively(e, new Predicate<EntityInternal>() { public boolean apply(EntityInternal it) { if (shouldSkipUnmanagement(it)) return false; allEntities.add(it); it.getManagementSupport().onManagementStopping(info); return true; } }); for (EntityInternal it : allEntities) { if (shouldSkipUnmanagement(it)) continue; <START> unmanageNonRecursive(it); <END> it.getManagementSupport().onManagementStopped(info); managementContext.getRebindManager().getChangeListener().onUnmanaged(it); if (managementContext.gc != null) managementContext.gc.onUnmanaged(it); }; }</code><technical_language>I _am_ comfortable this (note previously unmanageNonRecursive returning false visit of entity's children, is longer case here; situations unmanageNonRecursive returns false "should happen" ok.)</technical_language>

Target:
public void unmanage(Entity e) { if (shouldSkipUnmanagement(e)) return; final List<EntityInternal> allEntities = Lists.newArrayList(); final ManagementTransitionInfo info = new ManagementTransitionInfo(managementContext, ManagementTransitionMode.NORMAL); recursively(e, new Predicate<EntityInternal>() { public boolean apply(EntityInternal it) { if (shouldSkipUnmanagement(it)) return false; allEntities.add(it); it.getManagementSupport().onManagementStopping(info); return true; } }); for (EntityInternal it : allEntities) { if (shouldSkipUnmanagement(it)) continue; unmanageNonRecursive(it); it.getManagementSupport().onManagementStopped(info); managementContext.getRebindManager().getChangeListener().onUnmanaged(it); if (managementContext.gc != null) managementContext.gc.onUnmanaged(it); } }
Source:
<code>public void testHiddenTables() throws IOException { String[] typenames = dataStore.getTypeNames(); for (String name:typenames) { <START> System.out.println(name); <END> System.out.println(tname(name)); assertFalse("Name should not end with 'MDXT_'",name.startsWith("MDXT_")); assertFalse("Name should not end with '$_BKTS'",name.endsWith("$_BKTS")); assertFalse("Name should not end with '$'",name.endsWith("$")); } }</code><technical_language>system outs in tests please (yes, some around, leftovers there)</technical_language>

Target:
public void testHiddenTables() throws IOException { String[] typenames = dataStore.getTypeNames(); for (String name:typenames) { assertFalse("Name should not end with 'MDXT_'",name.startsWith("MDXT_")); assertFalse("Name should not end with '$_BKTS'",name.endsWith("$_BKTS")); assertFalse("Name should not end with '$'",name.endsWith("$")); } }
Source:
<code>public void onFileNodeCreated(FileNodeCreatedEvent event) { if (!isUnderGit()) { return; } final String pathName = normalizePath(event.getCreatedNode().getPath()); final String fileName = pathName.substring(pathName.lastIndexOf("/") + 1); ConfirmCallback confirmCallback = new ConfirmCallback() { @Override public void accepted() { Notification successNotification = new StatusNotification(locale.addSuccess(), locale.newFileAddToIndexNotification(fileName), SUCCESS, false, appContext.getCurrentProject().getRootProject(), null); addToIndex(Collections.singletonList(pathName), successNotification); } }; CancelCallback cancelCallback = new CancelCallback() { @Override public void cancelled() { } }; dialogFactory.createConfirmDialog(locale.newFileAddToIndexDialogTitle(), locale.newFileAddToIndexDialogText(fileName), YES_BUTTON, <START> NO_BUTTON, <END> confirmCallback, cancelCallback).show(); }</code><technical_language>move buttons names localization constants</technical_language>

Target:
public void onFileNodeCreated(FileNodeCreatedEvent event) { if (!isUnderGit()) { return; } final String pathName = normalizePath(event.getCreatedNode().getPath()); final String fileName = pathName.substring(pathName.lastIndexOf("/") + 1); ConfirmCallback confirmCallback = new ConfirmCallback() { @Override public void accepted() { Notification successNotification = new StatusNotification(locale.addSuccess(), locale.newFileAddToIndexNotification(fileName), SUCCESS, false, appContext.getCurrentProject().getRootProject(), null); addToIndex(Collections.singletonList(pathName), successNotification); } }; CancelCallback cancelCallback = new CancelCallback() { @Override public void cancelled() { } }; dialogFactory.createConfirmDialog(locale.newFileAddToIndexDialogTitle(), locale.newFileAddToIndexDialogText(fileName), locale.buttonYes(), locale.buttonNo(), confirmCallback, cancelCallback).show(); }
Source:
<code>private void deployAsFile(Archive archive) throws CommandFailedException, IOException, OperationException { <START> File testDeploymentFile = new File(tmp.getRoot(), archive.getName()); <END> TEST_DEPLOYMENT.as(ZipExporter.class).exportTo(testDeploymentFile, true); client.apply(new Deploy.DeployCmdBuilder(testDeploymentFile).build()); assertDeploymentExists(archive.getName(), true); }</code><technical_language>tmp.newFile(archive.getName())</technical_language>

Target:
private void deployAsFile(Archive archive) throws CommandFailedException, IOException, OperationException { File testDeploymentFile = new File(tmp.getRoot(), archive.getName()); TEST_DEPLOYMENT.as(ZipExporter.class).exportTo(testDeploymentFile, true); client.apply(new Deploy.Builder(testDeploymentFile).build()); assertDeploymentExists(archive.getName(), true); }
Source:
<code>public void commit(final Map<TopicPartition, OffsetAndMetadata> offsets) { if (eosEnabled) { <START> maybeBeginTxn(); <END> try { producer.sendOffsetsToTransaction(offsets, applicationId); producer.commitTransaction(); transactionInFlight = false; } catch (final ProducerFencedException error) { throw new TaskMigratedException(taskId, "Producer get fenced trying to commit a transaction", error); } catch (final TimeoutException error) { throw new StreamsException("Timed out while committing transaction via producer for task " + taskId, error); } catch (final KafkaException error) { throw new StreamsException("Error encountered sending offsets and committing transaction " + "via producer for task " + taskId, error); } } else { try { consumer.commitSync(offsets); } catch (final CommitFailedException error) { throw new TaskMigratedException(taskId, "Consumer committing offsets failed, " + "indicating the corresponding thread is no longer part of the group.", error); } catch (final TimeoutException error) { throw new StreamsException("Timed out while committing offsets via consumer for task " + taskId, error); } catch (final KafkaException error) { throw new StreamsException("Error encountered committing offsets via consumer for task " + taskId, error); } } }</code><technical_language>noted above, this move try block below</technical_language>

Target:
public void commit(final Map<TopicPartition, OffsetAndMetadata> offsets) { if (eosEnabled) { try { maybeBeginTxn(); producer.sendOffsetsToTransaction(offsets, applicationId); producer.commitTransaction(); transactionInFlight = false; } catch (final ProducerFencedException error) { throw new TaskMigratedException(taskId, "Producer get fenced trying to commit a transaction", error); } catch (final TimeoutException error) { throw new StreamsException("Timed out while committing transaction via producer for task " + taskId, error); } catch (final KafkaException error) { throw new StreamsException("Error encountered sending offsets and committing transaction " + "via producer for task " + taskId, error); } } else { try { consumer.commitSync(offsets); } catch (final CommitFailedException error) { throw new TaskMigratedException(taskId, "Consumer committing offsets failed, " + "indicating the corresponding thread is no longer part of the group.", error); } catch (final TimeoutException error) { throw new StreamsException("Timed out while committing offsets via consumer for task " + taskId, error); } catch (final KafkaException error) { throw new StreamsException("Error encountered committing offsets via consumer for task " + taskId, error); } } }
Source:
<code>private void checkInvocation(Tree tree, MethodMatcher invocationMatcher) { if (tree.is(Tree.Kind.METHOD_INVOCATION)) { MethodInvocationTree mit = (MethodInvocationTree) tree; if (invocationMatcher.matches(mit)) { onMethodInvocationFound(mit); } } else if (tree.is(Tree.Kind.NEW_CLASS)) { NewClassTree newClassTree = (NewClassTree) tree; if (invocationMatcher.matches(newClassTree)) { onConstructorFound(newClassTree); } } else if (tree.is(Tree.Kind.METHOD_REFERENCE)) { MethodReferenceTree methodReferenceTree = (MethodReferenceTree) tree; <START> if (invocationMatcher.matches(methodReferenceTree.method().symbol())) { <END> onMethodReferenceFound(methodReferenceTree); } } }</code><technical_language>dedicated method in method matchers simplify this</technical_language>

Target:
private void checkInvocation(Tree tree, MethodMatcher invocationMatcher) { if (tree.is(Tree.Kind.METHOD_INVOCATION)) { MethodInvocationTree mit = (MethodInvocationTree) tree; if (invocationMatcher.matches(mit)) { onMethodInvocationFound(mit); } } else if (tree.is(Tree.Kind.NEW_CLASS)) { NewClassTree newClassTree = (NewClassTree) tree; if (invocationMatcher.matches(newClassTree)) { onConstructorFound(newClassTree); } } else if (tree.is(Tree.Kind.METHOD_REFERENCE)) { MethodReferenceTree methodReferenceTree = (MethodReferenceTree) tree; if (invocationMatcher.matches(methodReferenceTree)) { onMethodReferenceFound(methodReferenceTree); } } }
Source:
<code>protected String concatenateMinMaxValueIfAvailable(final MeasurementVariable measurementVariable) { if (measurementVariable.getMinRange() != null && measurementVariable.getMaxRange() != null) { return measurementVariable.getMinRange().toString() + " - " + measurementVariable.getMaxRange().toString(); } else if(measurementVariable.getMinRange() == null && measurementVariable.getMaxRange() == null) { return NO_RANGE; } else if(measurementVariable.getMinRange() != null && measurementVariable.getMaxRange() == null) { return measurementVariable.getMinRange().toString() + MIN_ONLY; } else { return measurementVariable.getMaxRange().toString() + MAX_ONLY; <START> } <END> }</code><technical_language>@vmaletta I group conditions this: java if (measurementVariable.getMinRange() != null && measurementVariable.getMaxRange() != null) { return measurementVariable.getMinRange().toString() + " - " + measurementVariable.getMaxRange().toString(); } else if (measurementVariable.getMaxRange() == null) { if (measurementVariable.getMinRange() == null) { return NO_RANGE; } else { return measurementVariable.getMinRange().toString() + MIN_ONLY; } } else { return measurementVariable.getMaxRange().toString() + MAX_ONLY; }</technical_language>

Target:
protected String concatenateMinMaxValueIfAvailable(final MeasurementVariable measurementVariable) { if (measurementVariable.getMinRange() == null && measurementVariable.getMaxRange() == null) { return NO_RANGE; } else if (measurementVariable.getMaxRange() == null) { return measurementVariable.getMinRange().toString() + MIN_ONLY; } else if (measurementVariable.getMinRange() == null) { return measurementVariable.getMaxRange().toString() + MAX_ONLY; } else { return measurementVariable.getMinRange().toString() + " - " + measurementVariable.getMaxRange().toString(); } }
Source:
<code>private static boolean hasSelfPermission(Context context, String permission) { try { return checkSelfPermission(context, permission) == PackageManager.PERMISSION_GRANTED; <START> } catch (Throwable t) { <END> return false; } }</code><technical_language>restricting RuntimeException</technical_language>

Target:
private static boolean hasSelfPermission(Context context, String permission) { try { return checkSelfPermission(context, permission) == PackageManager.PERMISSION_GRANTED; } catch (RuntimeException t) { return false; } }
Source:
<code>public void changeStatus(String migrationId, String state) { KeyValueStore kv = getKeyValueStore(); migrationIds.add(migrationId); kv.put(migrationId + STEP, state); kv.put(migrationId + START_TIME, String.valueOf(System.currentTimeMillis())); kv.put(migrationId + PING_TIME, String.valueOf(System.currentTimeMillis())); <START> kv.put(migrationId + PROGRESS_MESSAGE, "Set from MigrationFearure"); <END> kv.put(migrationId + PROGRESS_NUM, String.valueOf(0)); kv.put(migrationId + PROGRESS_TOTAL, String.valueOf(0)); }</code><technical_language>Typo in Fearure</technical_language>

Target:
public void changeStatus(String migrationId, String state) { KeyValueStore kv = getKeyValueStore(); migrationIds.add(migrationId); kv.put(migrationId + STEP, state); kv.put(migrationId + START_TIME, String.valueOf(System.currentTimeMillis())); kv.put(migrationId + PING_TIME, String.valueOf(System.currentTimeMillis())); kv.put(migrationId + PROGRESS_MESSAGE, "Set from MigrationFeature"); kv.put(migrationId + PROGRESS_NUM, String.valueOf(0)); kv.put(migrationId + PROGRESS_TOTAL, String.valueOf(0)); }
Source:
<code>public BufferedReader getInput() throws IOException { <START> URL url = new URL(urlString); <END> HttpURLConnection connection = (HttpURLConnection) url.openConnection(); connection.setDoInput(true); connection.setDoOutput(true); connection.setRequestMethod("GET"); BufferedReader reader = new BufferedReader(new InputStreamReader(url.openStream())); return reader; }</code><technical_language>do want do this time get Input is called</technical_language>

Target:
public BufferedReader getInput() throws IOException { URL url = new URL(urlString); URLConnection connection = url.openConnection(); connection.setDoInput(true); return new BufferedReader(new InputStreamReader(url.openStream())); }
Source:
<code>public int hashCode() { int result = mSourceFile.hashCode(); result = 31 * result + mBuildToolsRevision.hashCode(); <START> return result; <END> }</code><technical_language>this replaced Objects.hashcode(mSourceFile, mBuildToolsRevision);</technical_language>

Target:
public int hashCode() { return Objects.hashCode(mSourceFile, mBuildToolsRevision); }
Source:
<code>public boolean removedByPlayer(@Nonnull IBlockState state, @Nonnull World world, @Nonnull BlockPos pos, @Nonnull EntityPlayer entityPlayer, boolean willHarvest) { <START> TileEntity te = world.getTileEntity(pos); <END> ITravelAccessable ta = (ITravelAccessable) te; if (ta.getOwner().equals(UserIdent.create(entityPlayer.getGameProfile())) || (ta.getAccessMode() == ITravelAccessable.AccessMode.PUBLIC)) { return super.removedByPlayer(state, world, pos, entityPlayer, willHarvest); } else { ChatUtil.sendNoSpam(entityPlayer, Lang.GUI_HARVEST_ERROR_PRIVATE.toChatServer(TextFormatting.RED + ta.getOwner().getPlayerName() + TextFormatting.WHITE)); return false; } }</code><technical_language>T te = getTileEntity(world, pos); if (te != null) { Yes, other parts of this block updated</technical_language>

Target:
public boolean removedByPlayer(@Nonnull IBlockState state, @Nonnull World world, @Nonnull BlockPos pos, @Nonnull EntityPlayer entityPlayer, boolean willHarvest) { TileEntity te = getTileEntity(world, pos); if (te != null) { ITravelAccessable ta = (ITravelAccessable) te; if (ta.getOwner().equals(UserIdent.create(entityPlayer.getGameProfile())) || (ta.getAccessMode() == ITravelAccessable.AccessMode.PUBLIC)) { return super.removedByPlayer(state, world, pos, entityPlayer, willHarvest); } else { if (!world.isRemote) { entityPlayer.sendStatusMessage(Lang.GUI_AUTH_ERROR_HARVEST.toChat(ta.getOwner().getPlayerName()), false); } } } return false; }
Source:
<code>public void getAllTimestampsThrows() { assertThatThrownBy(() -> OneNodeDownTestSuite.kvs.getAllTimestamps(OneNodeDownTestSuite.TEST_TABLE, ImmutableSet.of(OneNodeDownTestSuite.CELL_1_1), Long.MAX_VALUE)) .isExactlyInstanceOf(InsufficientConsistencyException.class) <START> .hasMessageContaining("requires ALL Cassandra nodes to be up and available."); <END> }</code><technical_language>insufficient consistency exception messages sufficiently consistent! ("all" "ALL")</technical_language>

Target:
public void getAllTimestampsThrows() { assertThatThrownBy(() -> OneNodeDownTestSuite.kvs.getAllTimestamps(OneNodeDownTestSuite.TEST_TABLE, ImmutableSet.of(OneNodeDownTestSuite.CELL_1_1), Long.MAX_VALUE)) .isExactlyInstanceOf(InsufficientConsistencyException.class) .hasMessageContaining(REQUIRES_ALL_CASSANDRA_NODES); }
Source:
<code>@Override public int getApi() { <START> return com.android.tools.lint.detector.api.ApiKt.CURRENT_API; <END> }</code><technical_language>Import</technical_language>

Target:
@Override public int getApi() { return ApiKt.CURRENT_API; }
Source:
<code>public KontaktExtDialog(Shell shell, Kontakt k, String[] defvalues) { super(shell); this.actKontact = k; <START> logger.info("{} fields are: {}", defvalues.length, defvalues); <END> fieldDefinitions = defvalues; Arrays.sort(fieldDefinitions, new Comparator<String>() { public int compare(String o1, String o2) { return o1.compareTo(o2); } }); for (int i = 0; i < fieldDefinitions.length; i++) { logger.trace("field with id {}: {}", i, fieldDefinitions[i]); } }</code><technical_language>logging this - sensitive information get logs! I reason log this level info</technical_language>

Target:
public KontaktExtDialog(Shell shell, Kontakt k, String[] defvalues) { super(shell); this.actKontact = k; fieldDefinitions = defvalues; Arrays.sort(fieldDefinitions, new Comparator<String>() { public int compare(String o1, String o2) { return o1.compareTo(o2); } }); }
Source:
<code>public void dispose() { mSimRecords.unregisterForRecordsLoaded(this); mSimCard.unregisterForAbsent(this); mCmdIf.unSetOnStkSessionEnd(this); mCmdIf.unSetOnStkProactiveCmd(this); mCmdIf.unSetOnStkEvent(this); mCmdIf.unSetOnStkCallSetUp(this); <START> this.removeCallbacksAndMessages(null); <END> mSimRecords = null; mSimCard = null; }</code><technical_language>this.removeCallbacksAndMessages(null) instead. Done in Patch set 2</technical_language>

Target:
public void dispose() { mSimRecords.unregisterForRecordsLoaded(this); mSimCard.unregisterForAbsent(this); mCmdIf.unSetOnStkSessionEnd(this); mCmdIf.unSetOnStkProactiveCmd(this); mCmdIf.unSetOnStkEvent(this); mCmdIf.unSetOnStkCallSetUp(this); sInstance = null; }
Source:
<code>public void batchUpdate_localRefIsDeletedInLoopOfNativeBatchUpdateQueries() { final Realm realm = looperThread.realm; <START> final int TEST_COUNT = 512; <END> final AtomicBoolean updatesTriggered = new AtomicBoolean(false); final AtomicInteger firstOnChangeCounter = new AtomicInteger(0); final AtomicInteger secondOnChangeCounter = new AtomicInteger(0); final RealmChangeListener<RealmResults<AllTypes>> listener = new RealmChangeListener<RealmResults<AllTypes>>() { @Override public void onChange(RealmResults<AllTypes> element) { if (updatesTriggered.get()) { int count = secondOnChangeCounter.addAndGet(1); if (count == TEST_COUNT) { realm.removeAllChangeListeners(); looperThread.testComplete(); } } else { int count = firstOnChangeCounter.addAndGet(1); if (count == TEST_COUNT) { updatesTriggered.set(true); realm.executeTransactionAsync(new Realm.Transaction() { @Override public void execute(Realm realm) { realm.createObject(AllTypes.class); } }); } else { RealmResults<AllTypes> results = realm.where(AllTypes.class).findAllAsync(); results.addChangeListener(this); looperThread.keepStrongReference.add(results); } } } }; RealmResults<AllTypes> results = realm.where(AllTypes.class).findAllAsync(); results.addChangeListener(listener); looperThread.keepStrongReference.add(results); }</code><technical_language>test bigger size of local ref map</technical_language>

Target:
public void batchUpdate_localRefIsDeletedInLoopOfNativeBatchUpdateQueries() { final Realm realm = looperThread.realm; final int TEST_COUNT = 1024; final AtomicBoolean updatesTriggered = new AtomicBoolean(false); final AtomicInteger firstOnChangeCounter = new AtomicInteger(0); final AtomicInteger secondOnChangeCounter = new AtomicInteger(0); final RealmChangeListener<RealmResults<AllTypes>> listener = new RealmChangeListener<RealmResults<AllTypes>>() { @Override public void onChange(RealmResults<AllTypes> element) { if (updatesTriggered.get()) { int count = secondOnChangeCounter.addAndGet(1); if (count == TEST_COUNT) { realm.removeAllChangeListeners(); looperThread.testComplete(); } } else { int count = firstOnChangeCounter.addAndGet(1); if (count == TEST_COUNT) { updatesTriggered.set(true); realm.executeTransactionAsync(new Realm.Transaction() { @Override public void execute(Realm realm) { realm.createObject(AllTypes.class); } }); } else { RealmResults<AllTypes> results = realm.where(AllTypes.class).findAllAsync(); results.addChangeListener(this); looperThread.keepStrongReference.add(results); } } } }; RealmResults<AllTypes> results = realm.where(AllTypes.class).findAllAsync(); results.addChangeListener(listener); looperThread.keepStrongReference.add(results); }
Source:
<code>public float getPitch() { float pitch = super.getPitch(); <START> if (Math.abs(pitch) > Math.abs(lastPitch) + NavX.MAX_DEGREES_PER_TICK) { <END> return lastPitch; } if (pitch < 0) { lastPitch = 360 + pitch; return 360 + pitch; } else { lastPitch = pitch; return pitch; } }</code><technical_language>change this Math.abs(pitch - lastPitch) well</technical_language>

Target:
public float getPitch() { float pitch = super.getPitch(); if (Math.abs(pitch - lastPitch) > NavX.MAX_DEGREES_PER_TICK) { return lastPitch; } if (pitch < 0) { lastPitch = 360 + pitch; return 360 + pitch; } else { lastPitch = pitch; return pitch; } }
Source:
<code>public ApiKey generateApiKey() { URI uri = buildUri(getBaseUri()).path("_api/v2/api_keys").build(); <START> HttpConnection connection = Http.POST(uri, "application/json"); <END> return client.executeRequest(connection, ApiKey.class); }</code><technical_language>usage of HttpConnection in classes possible. need set interceptors created HttpConnection potentially other parameters (e.g. Proxy). beneficial usages in place. a solution call a post(uri) method (e.g. CouchDatabaseBase)</technical_language>

Target:
public ApiKey generateApiKey() { URI uri = buildUri(getBaseUri()).path("_api/v2/api_keys").build(); InputStream response = client.post(uri, null); return getResponse(response, ApiKey.class, getGson()); }
Source:
<code>public void filter(String URL, byte[] content, DocumentFragment doc, ParseResult parse) { ParseData parseData = parse.get(URL); Metadata metadata = parseData.getMetadata(); <START> if (copyKeyName != null) { <END> String signature = metadata.getFirstValue(key_name); if (signature != null) metadata.setValue(copyKeyName, signature); } byte[] data = null; if (useText) { String text = parseData.getText(); if (StringUtils.isNotBlank(text)) { data = text.getBytes(StandardCharsets.UTF_8); } } else { data = content; } if (data == null) { data = URL.getBytes(StandardCharsets.UTF_8); } String hex = DigestUtils.md5Hex(data); metadata.setValue(key_name, hex); }</code><technical_language>StringUtils.isNotBlank better\: empty String spaces, want key user intended set</technical_language>

Target:
public void filter(String URL, byte[] content, DocumentFragment doc, ParseResult parse) { ParseData parseData = parse.get(URL); Metadata metadata = parseData.getMetadata(); if (copyKeyName != null) { String signature = metadata.getFirstValue(key_name); if (signature != null) { metadata.setValue(copyKeyName, signature); } } byte[] data = null; if (useText) { String text = parseData.getText(); if (StringUtils.isNotBlank(text)) { data = text.getBytes(StandardCharsets.UTF_8); } } else { data = content; } if (data == null) { data = URL.getBytes(StandardCharsets.UTF_8); } String hex = DigestUtils.md5Hex(data); metadata.setValue(key_name, hex); }
Source:
<code>public Builder (List<String> statusClassifications) { statusClassifications.stream() .forEach(classification -> { this.numAnomalies++; <START> if (!classification.equals(NOT_CLASSIFIED)) { <END> this.respondedAnomalies++; switch (classification) { case TRUE_POSITIVE: this.truePos++; break; case FALSE_NEGATIVE: this.falseNeg++; break; case FALSE_POSITIVE: this.falsePos++; break; default: break; } } }); }</code><technical_language>consider (!NOT_CLASSIFIED.equals(classification)) avoid NPE</technical_language>

Target:
public Builder (List<String> statusClassifications) { statusClassifications.stream() .forEach(classification -> { this.numAnomalies++; if (!NOT_CLASSIFIED.equals(classification)) { this.respondedAnomalies++; switch (classification) { case TRUE_POSITIVE: this.truePos++; break; case FALSE_NEGATIVE: this.falseNeg++; break; case FALSE_POSITIVE: this.falsePos++; break; default: break; } } }); }
Source:
<code>public TextButton (String text, TextButtonStyle style) { super(); setStyle(style); this.style = style; LabelStyle labelStyle; if (style.labelStyle == null) { labelStyle = new LabelStyle(style.font, style.fontColor); } else { <START> labelStyle = style.labelStyle.copy(); <END> if (style.font != null) labelStyle.font = style.font; if (style.fontColor != null) labelStyle.fontColor = style.fontColor; } label = labelStyle.createLabel(text); label.setAlignment(Align.center); add(label).expand().fill(); setSize(getPrefWidth(), getPrefHeight()); }</code><technical_language>Copying style want. nice for configuring a specific TextButton affecting others, want style a change style affects buttons. style copying, copying done creating TextButton, giving flexibility of cost of some boilerplate do copy</technical_language>

Target:
public TextButton (String text, TextButtonStyle style) { super(); setStyle(style); this.style = style; LabelStyle labelStyle; if (style.labelStyle == null) { labelStyle = new LabelStyle(style.font, style.fontColor); } else { labelStyle = style.labelStyle; } label = labelStyle.createLabel(text); label.setAlignment(Align.center); add(label).expand().fill(); setSize(getPrefWidth(), getPrefHeight()); }
Source:
<code>private void running() { try { while( getTimerThreadState() == TimerThreadState.RUNNING ) { long timeout = getWaitTimeout(); QueueEntry entry = fQueue.peek(); if ( entry != null ) { long commandTimeout = getTimeoutForCommand( entry.fCommandToken.getCommand() ); if ( GdbDebugOptions.DEBUG_TIMEOUTS ) { String commandText = entry.fCommandToken.getCommand().toString(); if ( commandText.endsWith( "\n" ) ) commandText = commandText.substring( 0, commandText.length() - 1 ); <START> GdbDebugOptions.trace( String.format( "Processing command '%s', command timeout is %d", END> commandText, Long.valueOf( commandTimeout ) ) ); } long currentTime = System.currentTimeMillis(); long elapsedTime = currentTime - entry.fTimestamp; if ( commandTimeout <= elapsedTime ) { processTimedOutCommand( entry.fCommandToken ); fQueue.remove( entry ); QueueEntry nextEntry = fQueue.peek(); if ( nextEntry != null ) { setTimeStamp( currentTime, nextEntry ); } } else { timeout = Math.min( timeout, commandTimeout - elapsedTime ); if ( GdbDebugOptions.DEBUG_TIMEOUTS ) { String commandText = entry.fCommandToken.getCommand().toString(); if ( commandText.endsWith( "\n" ) ) commandText = commandText.substring( 0, commandText.length() - 1 ); GdbDebugOptions.trace( String.format( "Setting timeout %d for command '%s'", Long.valueOf( timeout ), commandText ) ); } } } synchronized( TimerThread.this ) { wait( timeout ); } } } catch( InterruptedException e ) { } }</code><technical_language>GdbDebugOptions here. Instead, printDebugMessage, extra stuff, modify printDebugMessage GdbDebugOptions.trace Do in file</technical_language>

Target:
private void running() { try { while( getTimerThreadState() == TimerThreadState.RUNNING ) { long timeout = getWaitTimeout(); QueueEntry entry = fQueue.peek(); if ( entry != null ) { long commandTimeout = getTimeoutForCommand( entry.fCommandToken.getCommand() ); if ( GdbDebugOptions.DEBUG_COMMAND_TIMEOUTS ) { String commandText = entry.fCommandToken.getCommand().toString(); if ( commandText.endsWith( "\n" ) ) commandText = commandText.substring( 0, commandText.length() - 1 ); printDebugMessage( String.format( "Processing command '%s', command timeout is %d", commandText, Long.valueOf( commandTimeout ) ) ); } long currentTime = System.currentTimeMillis(); long elapsedTime = currentTime - entry.fTimestamp; if ( commandTimeout <= elapsedTime ) { processTimedOutCommand( entry.fCommandToken ); fQueue.remove( entry ); QueueEntry nextEntry = fQueue.peek(); if ( nextEntry != null ) { setTimeStamp( currentTime, nextEntry ); } } else { timeout = Math.min( timeout, commandTimeout - elapsedTime ); if ( GdbDebugOptions.DEBUG_COMMAND_TIMEOUTS ) { String commandText = entry.fCommandToken.getCommand().toString(); if ( commandText.endsWith( "\n" ) ) commandText = commandText.substring( 0, commandText.length() - 1 ); printDebugMessage( String.format( "Setting timeout %d for command '%s'", Long.valueOf( timeout ), commandText ) ); } } } synchronized( TimerThread.this ) { wait( timeout ); } } } catch( InterruptedException e ) { } }
Source:
<code>public List<Member> getGroupMembers(PerunSession sess, Group group) throws InternalErrorException { try { return jdbc.query("select " + MembersManagerImpl.memberMappingSelectQuery + ", groups_members.membership_type as membership_type, " + "groups_members.source_group_id as source_group_id from groups_members join members on members.id=groups_members.member_id " + <START> "where groups_members.group_id=?", MembersManagerImpl.MEMBER_MAPPER, group.getId()); <END> } catch (EmptyResultDataAccessException e) { return new ArrayList<Member>(); } catch (RuntimeException e) { throw new InternalErrorException(e); } }</code><technical_language>Line 291/294 getGroupMembers method, please rename parameter excludeStatusInsteadOfIncludeStatus better</technical_language>

Target:
public List<Member> getGroupMembers(PerunSession sess, Group group) throws InternalErrorException { try { return jdbc.query("select " + MembersManagerImpl.memberMappingSelectQuery + ", groups_members.membership_type as membership_type, " + "groups_members.source_group_id as source_group_id from groups_members join members on members.id=groups_members.member_id " + "where groups_members.group_id=?", MembersManagerImpl.GROUPS_MEMBER_MAPPER, group.getId()); } catch (EmptyResultDataAccessException e) { return new ArrayList<Member>(); } catch (RuntimeException e) { throw new InternalErrorException(e); } }
Source:
<code>private ClassName(String packageName, ClassName enclosingClassName, String simpleName, List<AnnotationSpec> annotations) { super(annotations); <START> this.packageName = (packageName != null) ? packageName : NO_PACKAGE; <END> this.enclosingClassName = enclosingClassName; this.simpleName = simpleName; this.canonicalName = enclosingClassName != null ? (enclosingClassName.canonicalName + '.' + simpleName) : (this.packageName.isEmpty() ? simpleName : packageName + '.' + simpleName); }</code><technical_language>Is this required? want prefer exploding instead suggestion this.packageName = Objects.requireNonNull(packageName, "packageName == null")</technical_language>

Target:
private ClassName(String packageName, ClassName enclosingClassName, String simpleName, List<AnnotationSpec> annotations) { super(annotations); this.packageName = Objects.requireNonNull(packageName, "packageName == null"); this.enclosingClassName = enclosingClassName; this.simpleName = simpleName; this.canonicalName = enclosingClassName != null ? (enclosingClassName.canonicalName + '.' + simpleName) : (this.packageName.isEmpty() ? simpleName : packageName + '.' + simpleName); }
Source:
<code>public void testAppConfigurationInitialisation() { try { setupApplicationRoot(); setupHeadless(); FxToolkit.registerPrimaryStage(); FxToolkit.setupFixture(() -> new AnnotationConfigApplicationContext(AppConfiguration.class)); <START> } catch (TimeoutException | IOException e) { <END> e.printStackTrace(); fail(); } }</code><technical_language>continue exceptions junit</technical_language>

Target:
public void testAppConfigurationInitialisation() { try { FxToolkit.registerPrimaryStage(); FxToolkit.setupFixture(() -> new AnnotationConfigApplicationContext(AppConfiguration.class)); } catch (TimeoutException e) { e.printStackTrace(); fail(); } }
Source:
<code>public CheckpointStreamFactory resolveCheckpointStorageLocation(long checkpointId, CheckpointStorageLocationReference reference) { return cache.computeIfAbsent(checkpointId, id -> { try { return delegate.resolveCheckpointStorageLocation(checkpointId, reference); } catch (IOException e) { <START> throw new WrappingRuntimeException(e); <END> } }); }</code><technical_language>WrappingRuntimeException is for wrapping non-runtime exceptions? I guess this belong runtime exception. Another option wrapping exception is lambda throw IOException explicitly in method resolveCheckpointStorageLocation</technical_language>

Target:
public CheckpointStreamFactory resolveCheckpointStorageLocation(long checkpointId, CheckpointStorageLocationReference reference) { return cache.computeIfAbsent(checkpointId, id -> { try { return delegate.resolveCheckpointStorageLocation(checkpointId, reference); } catch (IOException e) { throw new FlinkRuntimeException(e); } }); }
Source:
<code>public <E extends Throwable> E expectError(Class<E> expected, long timeoutMillis) throws Exception { <START> return expectError(expected, timeoutMillis, env.defaultPollTimeoutMillis); <END> }</code><technical_language>env.defaultPollTimeoutMillis()</technical_language>

Target:
public <E extends Throwable> E expectError(Class<E> expected, long timeoutMillis) throws Exception { return expectError(expected, timeoutMillis, env.defaultPollTimeoutMillis()); }