auphong2707/dl4se-code-review-dataset huggingface dataset:
Source:
<code>public void aboutToBeShown() { this.controller.onNewLabel(new IConsumer<String>() { @Override public void apply(String value) { EEFGroupLifecycleManager.this.section.setText(value); } }); this.controller.onValidation(new IConsumer<List<IValidationRuleResult>>() { @Override public void apply(List<IValidationRuleResult> validationRuleResults) { IMessageManager messageManager = page.getForm().getMessageManager(); <START> for (IValidationRuleResult validationRuleResult : validationRuleResults) { if (validationRuleResult instanceof IInvalidValidationRuleResult) { IInvalidValidationRuleResult result = (IInvalidValidationRuleResult) validationRuleResult; messageManager.addMessage(result.getValidationRule(), result.getMessage(), result.getData(), result.getSeverity(), section); } else { messageManager.removeMessage(validationRuleResult.getValidationRule(), section); } } <END> } }); for (ILifecycleManager lifecycleManager : lifecycleManagers) { lifecycleManager.aboutToBeShown(); } }</code><technical_language>code in widget life cycle manager. Is refactor this in place</technical_language>

Target:
public void aboutToBeShown() { super.aboutToBeShown(); this.controller.onNewLabel(new IConsumer<String>() { @Override public void apply(String value) { EEFGroupLifecycleManager.this.section.setText(value); } }); for (ILifecycleManager lifecycleManager : lifecycleManagers) { lifecycleManager.aboutToBeShown(); } }
Source:
<code>public void checkClientTrusted(X509Certificate[] chain, String authType, Socket socket) throws CertificateException { if (hostnameVerificationEnabled && shouldVerifyClientHostname) { performHostVerification(socket.getInetAddress(), chain[0]); } <START> x509ExtendedTrustManager.checkClientTrusted(chain, authType, socket); <END> }</code><technical_language>I do delegated check first. If peer cert is valid (i.e. signed untrusted CA, expired, etc) is point in hostname check. in other methods in this class</technical_language>

Target:
public void checkClientTrusted(X509Certificate[] chain, String authType, Socket socket) throws CertificateException { x509ExtendedTrustManager.checkClientTrusted(chain, authType, socket); if (clientHostnameVerificationEnabled) { performHostVerification(socket.getInetAddress(), chain[0]); } }
Source:
<code>public abstract void executeTask() throws MojoExecutionException, MojoFailureException; protected void resolveDocker() { if(dockerHost == null){ boolean isLinux = SystemUtils.IS_OS_LINUX; if(isLinux){ dockerHost = prompt("Please specify your Docker host URL (either 'tcp://' or 'unix://')", DEFAULT_HOST_LINUX); } else { dockerHost = prompt("Please specify you Docker Machine host URL (format is: 'tcp://{docker-machine url}')",""); } } DockerClientConfig config = DockerClientConfig.createDefaultConfigBuilder() .withDockerHost(dockerHost) <START> .withApiVersion("1.23") <END> .build(); docker = DockerClientBuilder.getInstance(config).build(); }</code><technical_language>test some older version 1.18</technical_language>

Target:
public abstract void executeTask() throws MojoExecutionException, MojoFailureException; protected void resolveDocker() { if(dockerHost == null){ boolean isLinux = SystemUtils.IS_OS_LINUX; if(isLinux){ dockerHost = prompt("Please specify your Docker host URL (either 'tcp://' or 'unix://')", DEFAULT_HOST_LINUX); } else { dockerHost = prompt("Please specify you Docker Machine host URL (format is: 'tcp://{docker-machine url}')",""); } } DockerClientConfig config = DockerClientConfig.createDefaultConfigBuilder() .withDockerHost(dockerHost) .withApiVersion("1.18") .build(); docker = DockerClientBuilder.getInstance(config).build(); }
Source:
<code>void checkSetDataInProcessBeforeRemoval(int start, int end) { <START> if (GTK.GTK4 || GTK.GTK_VERSION < OS.VERSION(3, 22, 0)) { return; } <END> for (int i = start; i < end; i++) { TableItem item = items[i]; if (item != null && item.settingData) { String message = "Cannot remove a table item while its data is being set. " + "At item " + i + " in range [" + start + ", " + end + ")."; throw new SWTException(message); } } }</code><technical_language>I ran snippet multiple compiled GTK3 versions machine issue reproduces of -- ancient GTK3.10. GTK4 Table/Tree behaviour is unchanged advocate removing this guard together</technical_language>

Target:
void checkSetDataInProcessBeforeRemoval(int start, int end) { for (int i = start; i < end; i++) { TableItem item = items[i]; if (item != null && item.settingData) { String message = "Cannot remove a table item while its data is being set. " + "At item " + i + " in range [" + start + ", " + end + ")."; throw new SWTException(message); } } }
Source:
<code>public void testAssign() { classNames = Arrays.asList(OldPartitionAssignor.class.getName(), NewPartitionAssignor.class.getName()); List<ConsumerPartitionAssignor> assignors = getAssignorInstances(classNames, Collections.emptyMap()); ConsumerPartitionAssignor oldAssignor = assignors.get(0); <START> ConsumerPartitionAssignor newAssignor = assignors.get(1); <END> Map<String, Subscription> subscriptions = new HashMap<>(); subscriptions.put("C1", new Subscription(Arrays.asList("topic1"))); subscriptions.put("C2", new Subscription(Arrays.asList("topic1", "topic2"))); subscriptions.put("C3", new Subscription(Arrays.asList("topic2", "topic3"))); GroupSubscription groupSubscription = new GroupSubscription(subscriptions); Map<String, Assignment> oldAssignments = oldAssignor.assign(null, groupSubscription).groupAssignment(); Map<String, Assignment> newAssignments = newAssignor.assign(null, groupSubscription).groupAssignment(); for (Map.Entry<String, Assignment> entry : oldAssignments.entrySet()) { Assignment oldAssignment = entry.getValue(); Assignment newAssignment = newAssignments.get(entry.getKey()); assertEquals(oldAssignment.partitions(), newAssignment.partitions()); assertEquals(oldAssignment.userData(), newAssignment.userData()); } }</code><technical_language>This a slightly obscure test adapting logic. I more straightforward verify a subscription, adapted assignor returns a expected assignment. get rid of NewPartitionAssignor</technical_language>

Target:
public void testAssign() { ConsumerPartitionAssignor adaptedAssignor = new PartitionAssignorAdapter(new OldPartitionAssignor()); Map<String, Subscription> subscriptions = new HashMap<>(); subscriptions.put("C1", new Subscription(Arrays.asList("topic1"))); subscriptions.put("C2", new Subscription(Arrays.asList("topic1", "topic2"))); subscriptions.put("C3", new Subscription(Arrays.asList("topic2", "topic3"))); GroupSubscription groupSubscription = new GroupSubscription(subscriptions); Map<String, Assignment> assignments = adaptedAssignor.assign(null, groupSubscription).groupAssignment(); assertEquals(assignments.get("C1").partitions(), Arrays.asList(new TopicPartition("topic1", 1))); assertEquals(assignments.get("C2").partitions(), Arrays.asList(new TopicPartition("topic1", 1), new TopicPartition("topic2", 1))); assertEquals(assignments.get("C3").partitions(), Arrays.asList(new TopicPartition("topic2", 1), new TopicPartition("topic3", 1))); }
Source:
<code><START> public void testFindByStudyIdOrStudyName() { <END> List<VariantSource> variantSourceMongoList = service.findByStudyIdOrStudyName(FIRST_STUDY_ID, FIRST_STUDY_ID); assertEquals(1, variantSourceMongoList.size()); variantSourceMongoList = service.findByStudyIdOrStudyName(SECOND_STUDY_ID, SECOND_STUDY_ID); assertEquals(2, variantSourceMongoList.size()); }</code><technical_language>Check IDs be</technical_language>

Target:
public void testFindByStudyIdOrStudyName() { List<VariantSource> variantSourceMongoList = service.findByStudyIdOrStudyName(FIRST_STUDY_ID, FIRST_STUDY_ID); assertEquals(1, variantSourceMongoList.size()); assertEquals(FIRST_STUDY_ID, variantSourceMongoList.get(0).getStudyId()); variantSourceMongoList = service.findByStudyIdOrStudyName(SECOND_STUDY_ID, SECOND_STUDY_ID); assertEquals(SECOND_STUDY_ID, variantSourceMongoList.get(0).getStudyId()); assertEquals(2, variantSourceMongoList.size()); }
Source:
<code><START> private void unknownStateType() { assert false : "Unknown state type"; } <END></code><technical_language>I finally get methods doing, I told Andrei: private AssertionError unknownStateType() { return new AssertionError("Unknown state type"); } ... throw unknownStateType();</technical_language>

Target:
private AssertionError unknownStateType() { return new AssertionError("Unknown state type"); }
Source:
<code>public static VariantContext liftVariant(final VariantContext source, final Interval target, final ReferenceSequence refSeq, final boolean writeOriginalPosition, final boolean writeOriginalAlleles){ if (target == null) { return null; } final VariantContextBuilder builder; if (target.isNegativeStrand()) { builder = reverseComplementVariantContext(source, target, refSeq); } else { builder = liftSimpleVariantContext(source, target); } if (builder == null) { return null; } builder.filters(source.getFilters()); builder.log10PError(source.getLog10PError()); builder.attributes(source.getAttributes()); builder.rmAttribute(SWAPPED_ALLELES); if (target.isNegativeStrand()) { builder.attribute(REV_COMPED_ALLELES, true); } else { builder.rmAttribute(REV_COMPED_ALLELES); } builder.id(source.getID()); if (writeOriginalPosition) { builder.attribute(LiftoverVcf.ORIGINAL_CONTIG, source.getContig()); builder.attribute(LiftoverVcf.ORIGINAL_START, source.getStart()); } if (writeOriginalAlleles && !source.getAlleles().equals(builder.getAlleles())) { <START> List<String> alleles = new ArrayList<>(); <END> source.getAlleles().forEach(a -> alleles.add(a.getDisplayString())); builder.attribute(LiftoverVcf.ORIGINAL_ALLELES, alleles); } return builder.make(); }</code><technical_language>a 'final' List</technical_language>

Target:
public static VariantContext liftVariant(final VariantContext source, final Interval target, final ReferenceSequence refSeq, final boolean writeOriginalPosition, final boolean writeOriginalAlleles){ if (target == null) { return null; } final VariantContextBuilder builder; if (target.isNegativeStrand()) { builder = reverseComplementVariantContext(source, target, refSeq); } else { builder = liftSimpleVariantContext(source, target); } if (builder == null) { return null; } builder.filters(source.getFilters()); builder.log10PError(source.getLog10PError()); builder.attributes(source.getAttributes()); builder.rmAttribute(SWAPPED_ALLELES); if (target.isNegativeStrand()) { builder.attribute(REV_COMPED_ALLELES, true); } else { builder.rmAttribute(REV_COMPED_ALLELES); } builder.id(source.getID()); if (writeOriginalPosition) { builder.attribute(LiftoverVcf.ORIGINAL_CONTIG, source.getContig()); builder.attribute(LiftoverVcf.ORIGINAL_START, source.getStart()); } if (writeOriginalAlleles && !source.getAlleles().equals(builder.getAlleles())) { builder.attribute(LiftoverVcf.ORIGINAL_ALLELES, allelesToStringList(source.getAlleles())); } return builder.make(); }
Source:
<code>public RegistrationData findByEmail(Context context, String email) throws SQLException { CriteriaBuilder criteriaBuilder = getCriteriaBuilder(context); CriteriaQuery criteriaQuery = getCriteriaQuery(criteriaBuilder, RegistrationData.class); Root<RegistrationData> registrationDataRoot = criteriaQuery.from(RegistrationData.class); criteriaQuery.select(registrationDataRoot); criteriaQuery.where(criteriaBuilder.equal(registrationDataRoot.get(RegistrationData_.email), email)); <START> return uniqueResult(context, criteriaQuery, true, RegistrationData.class, -1, -1); <END> }</code><technical_language>Original query cacheable. This is. I param false</technical_language>

Target:
public RegistrationData findByEmail(Context context, String email) throws SQLException { CriteriaBuilder criteriaBuilder = getCriteriaBuilder(context); CriteriaQuery criteriaQuery = getCriteriaQuery(criteriaBuilder, RegistrationData.class); Root<RegistrationData> registrationDataRoot = criteriaQuery.from(RegistrationData.class); criteriaQuery.select(registrationDataRoot); criteriaQuery.where(criteriaBuilder.equal(registrationDataRoot.get(RegistrationData_.email), email)); return uniqueResult(context, criteriaQuery, false, RegistrationData.class, -1, -1); }
Source:
<code><START> public List<T> actual() { <END> checkNotNull(actual); return ImmutableList.copyOf(actual); }</code><technical_language>I sure, tend returning values of methods plain Lists eventually wrap ImmutableLists again. if declare ImmutableList a type of returning value, I do so</technical_language>

Target:
public ImmutableList<T> actual() { checkNotNull(actual); return ImmutableList.copyOf(actual); }
Source:
<code>protected void onActivityResult(int requestCode, int resultCode, Intent data) { super.onActivityResult(requestCode, resultCode, data); switch (requestCode) { case SPEECH_REQUEST_CODE: String searchInput = SpeechUtil.processSpeechResults(resultCode, data, this); <START> newListInput.setText(searchInput); <END> break; case IMPORT_FILE_REQUEST_CODE: if (resultCode == RESULT_OK) { String filePath = data.getStringExtra(FilePickerActivity.RESULT_FILE_PATH); if (!filePath.endsWith(".txt")) { UIUtils.showSnackbar(parent, getString(R.string.invalid_file)); } else { Intent intent = new Intent(this, ImportFromTextFileActivity.class); intent.putExtra(ImportFromTextFileActivity.FILE_PATH_KEY, filePath); startActivityForResult(intent, SAVE_IMPORT_REQUEST_CODE); } } break; case SAVE_IMPORT_REQUEST_CODE: if (resultCode == RESULT_OK) { nameListsAdapter.refresh(preferencesManager.getNameLists()); } break; } }</code><technical_language>call setText() if return processSpeechResults is non-null. if user opts-out of speech dialog (just tap of it), text input incorrectly cleared I think</technical_language>

Target:
protected void onActivityResult(int requestCode, int resultCode, Intent data) { super.onActivityResult(requestCode, resultCode, data); switch (requestCode) { case SPEECH_REQUEST_CODE: String searchInput = SpeechUtil.processSpeechResult(resultCode, data, this); if (searchInput != null) { newListInput.setText(searchInput); } break; case IMPORT_FILE_REQUEST_CODE: if (resultCode == RESULT_OK) { String filePath = data.getStringExtra(FilePickerActivity.RESULT_FILE_PATH); if (!filePath.endsWith(".txt")) { UIUtils.showSnackbar(parent, getString(R.string.invalid_file)); } else { Intent intent = new Intent(this, ImportFromTextFileActivity.class); intent.putExtra(ImportFromTextFileActivity.FILE_PATH_KEY, filePath); startActivityForResult(intent, SAVE_IMPORT_REQUEST_CODE); } } break; case SAVE_IMPORT_REQUEST_CODE: if (resultCode == RESULT_OK) { nameListsAdapter.refresh(preferencesManager.getNameLists()); } break; } }
Source:
<code>public void pipeline_02_03() throws Exception { <START> Logger.getRootLogger().setLevel(Level.TRACE); <END> final Configuration conf = new HdfsConfiguration(); conf.setLong(DFSConfigKeys.DFS_HEARTBEAT_INTERVAL_KEY, 1); final MiniDFSCluster cluster = new MiniDFSCluster.Builder(conf).numDataNodes(4).build(); try { cluster.setLeasePeriod(SOFT_LEASE_LIMIT, HARD_LEASE_LIMIT); cluster.waitActive(); final FileSystem fs = cluster.getFileSystem(); final Path p = new Path(DIR, "file1"); final int half = BLOCK_SIZE / 2; { final FSDataOutputStream out = fs.create(p, true, fs.getConf() .getInt(CommonConfigurationKeys.IO_FILE_BUFFER_SIZE_KEY, 4096), (short) 3, BLOCK_SIZE); write(out, 0, half); ((DFSOutputStream) out.getWrappedStream()).hflush(); } checkFile(p, half, conf); AppendTestUtil.LOG.info("leasechecker.interruptAndJoin()"); ((DistributedFileSystem) fs).dfs.getLeaseRenewer().interruptAndJoin(); { Thread.sleep(2 * SOFT_LEASE_LIMIT); final UserGroupInformation current = UserGroupInformation.getCurrentUser(); final UserGroupInformation ugi = UserGroupInformation .createUserForTesting(current.getShortUserName() + "x", new String[]{"supergroup"}); final DistributedFileSystem dfs = ugi.doAs(new PrivilegedExceptionAction<DistributedFileSystem>() { @Override public DistributedFileSystem run() throws Exception { return (DistributedFileSystem) FileSystem.newInstance(conf); } }); final FSDataOutputStream out = append(dfs, p); write(out, 0, half); out.close(); } checkFile(p, 2 * half, conf); } finally { cluster.shutdown(); } }</code><technical_language>Do need this</technical_language>

Target:
public void pipeline_02_03() throws Exception { final Configuration conf = new HdfsConfiguration(); conf.setLong(DFSConfigKeys.DFS_HEARTBEAT_INTERVAL_KEY, 1); final MiniDFSCluster cluster = new MiniDFSCluster.Builder(conf).numDataNodes(4).build(); try { cluster.setLeasePeriod(SOFT_LEASE_LIMIT, HARD_LEASE_LIMIT); cluster.waitActive(); final FileSystem fs = cluster.getFileSystem(); final Path p = new Path(DIR, "file1"); final int half = BLOCK_SIZE / 2; { final FSDataOutputStream out = fs.create(p, true, fs.getConf() .getInt(CommonConfigurationKeys.IO_FILE_BUFFER_SIZE_KEY, 4096), (short) 3, BLOCK_SIZE); write(out, 0, half); ((DFSOutputStream) out.getWrappedStream()).hflush(); } checkFile(p, half, conf); AppendTestUtil.LOG.info("leasechecker.interruptAndJoin()"); ((DistributedFileSystem) fs).dfs.getLeaseRenewer().interruptAndJoin(); { Thread.sleep(2 * SOFT_LEASE_LIMIT); final UserGroupInformation current = UserGroupInformation.getCurrentUser(); final UserGroupInformation ugi = UserGroupInformation .createUserForTesting(current.getShortUserName() + "x", new String[]{"supergroup"}); final DistributedFileSystem dfs = ugi.doAs(new PrivilegedExceptionAction<DistributedFileSystem>() { @Override public DistributedFileSystem run() throws Exception { return (DistributedFileSystem) FileSystem.newInstance(conf); } }); final FSDataOutputStream out = append(dfs, p); write(out, 0, half); out.close(); } checkFile(p, 2 * half, conf); } finally { cluster.shutdown(); } }
Source:
<code>public void testValidateAttachements(){ NetworkAttachment attachement1 = new NetworkAttachment(); attachement1.setNetworkName("network1"); attachement1.setNicName("eth0"); NetworkAttachment attachement2 = new NetworkAttachment(); attachement2.setNetworkName("any2"); attachement2.setNicName("eth1"); List<NetworkAttachment> attachementList = Arrays.asList(attachement1, attachement2); <START> Nic unmgmtNic = new Nic(); <END> unmgmtNic.setName("eth0"); ValidationResult result = validator.validateAttachements(unmgmtNic, attachementList); assertThat(result, failsWith(EngineMessage.ACTION_TYPE_FAILED_HOST_NETWORK_ATTACHEMENT_ON_UNMANAGED_NETWORK, ReplacementUtils.createSetVariableString(NETWORK, "network1"), ReplacementUtils.createSetVariableString(NIC, "eth0"))); unmgmtNic.setName("eth7"); result = validator.validateAttachements(unmgmtNic, attachementList); assertTrue(result.isValid()); }</code><technical_language>'createNic(..);</technical_language>

Target:
public void testValidateAttachements(){ String unmanagedNicName = "eth0"; NetworkAttachment attachement1 = new NetworkAttachment(); attachement1.setNetworkName("network1"); attachement1.setNicName(unmanagedNicName); NetworkAttachment attachement2 = new NetworkAttachment(); attachement2.setNetworkName("any2"); attachement2.setNicName("eth1"); List<NetworkAttachment> attachementList = Arrays.asList(attachement1, attachement2); Nic unmgmtNic = createNicWithNetworkImplementationDetails(unmanagedNicName, false); List<VdsNetworkInterface> existingInterfaces = Arrays.asList(unmgmtNic); Set<String> nicsWithUnmanagedNetworks = validator.filterNicsWithUnmanagedNetworks(existingInterfaces, Collections.emptySet()); assertEquals(1, nicsWithUnmanagedNetworks.size()); String filteredNicName = nicsWithUnmanagedNetworks.iterator().next(); assertEquals(filteredNicName, unmanagedNicName); ValidationResult result = validator.validateAttachements(filteredNicName, attachementList); assertThat(result, failsWith(EngineMessage.ACTION_TYPE_FAILED_HOST_NETWORK_ATTACHEMENT_ON_UNMANAGED_NETWORK, ReplacementUtils.createSetVariableString(NETWORK, "network1"), ReplacementUtils.createSetVariableString(NIC, "eth0"))); result = validator.validateAttachements("eth7", attachementList); assertTrue(result.isValid()); }
Source:
<code>public TypeBinding getCollectionElementType(TypeBinding collectionType) { if (collectionType == null) return null; boolean isTargetJsr14 = this.scope.compilerOptions().targetJDK == ClassFileConstants.JDK1_4; if (collectionType.isCapture()) { TypeBinding upperBound = ((CaptureBinding)collectionType).firstBound; if (upperBound != null && upperBound.isArrayType()) collectionType = upperBound; } if (collectionType.isArrayType()) { return ((ArrayBinding) collectionType).elementsType(); } else if (collectionType instanceof ReferenceBinding) { ReferenceBinding iterableType = ((ReferenceBinding)collectionType).findSuperTypeOriginatingFrom(T_JavaLangIterable, false ); if (iterableType == null && isTargetJsr14) { iterableType = ((ReferenceBinding)collectionType).findSuperTypeOriginatingFrom(T_JavaUtilCollection, false ); <START> } <END> checkIterable: { if (iterableType == null) return null; TypeBinding[] arguments = null; switch (iterableType.kind()) { case Binding.RAW_TYPE : return this.scope.getJavaLangObject(); case Binding.GENERIC_TYPE : arguments = iterableType.typeVariables(); break; case Binding.PARAMETERIZED_TYPE : arguments = ((ParameterizedTypeBinding)iterableType).arguments; break; default: return null; } if (arguments.length != 1) return null; return arguments[0]; } } return null; }</code><technical_language>a warning label is referenced</technical_language>

Target:
private TypeBinding getCollectionElementType(TypeBinding collectionType) { if (collectionType == null) return null; boolean isTargetJsr14 = this.scope.compilerOptions().targetJDK == ClassFileConstants.JDK1_4; if (collectionType.isCapture()) { TypeBinding upperBound = ((CaptureBinding)collectionType).firstBound; if (upperBound != null && upperBound.isArrayType()) collectionType = upperBound; } if (collectionType.isArrayType()) { return ((ArrayBinding) collectionType).elementsType(); } else if (collectionType instanceof ReferenceBinding) { ReferenceBinding iterableType = ((ReferenceBinding)collectionType).findSuperTypeOriginatingFrom(T_JavaLangIterable, false ); if (iterableType == null && isTargetJsr14) { iterableType = ((ReferenceBinding)collectionType).findSuperTypeOriginatingFrom(T_JavaUtilCollection, false ); } checkIterable: { if (iterableType == null) return null; TypeBinding[] arguments = null; switch (iterableType.kind()) { case Binding.RAW_TYPE : return this.scope.getJavaLangObject(); case Binding.GENERIC_TYPE : arguments = iterableType.typeVariables(); break; case Binding.PARAMETERIZED_TYPE : arguments = ((ParameterizedTypeBinding)iterableType).arguments; break; default: return null; } if (arguments.length != 1) return null; return arguments[0]; } } return null; }
Source:
<code><START> public Measurement(String name, double value) { <END> this.name = name; this.value = value; }</code><technical_language>This constructor call more general a default (3 in this case)</technical_language>

Target:
public Measurement(String name, double value) { this(name, value, 3); }
Source:
<code>public boolean checkStatus(T waitObject) { String crn = waitObject.getCrn(); EnvironmentStatus desiredStatus = waitObject.getDesiredStatus(); try { DetailedEnvironmentResponse environment = waitObject.getEndpoint().getByCrn(crn); String name = environment.getName(); EnvironmentStatus status = environment.getEnvironmentStatus(); LOGGER.info("Waiting for the '{}' state of '{}' '{}' environment. Actual state is: '{}'", desiredStatus, name, crn, status); if (environment.getEnvironmentStatus() == DELETE_FAILED) { LOGGER.error("Environment '{}' '{}' termination failed (status:'{}'), waiting is cancelled.", name, crn, status); throw new TestFailException(String.format("Environment '%s' '%s' termination failed. Status: '%s' statusReason: '%s'", name, crn, status, environment.getStatusReason())); } if (!status.equals(ARCHIVED)) { return false; } } catch (Exception e) { <START> if (e instanceof NotFoundException) { <END> LOGGER.warn("No environment found with crn '{}'", crn, e); } else { LOGGER.error("Environment termination failed: {}", e.getMessage(), e); throw new TestFailException(String.format("Environment termination failed: %s", e.getMessage())); } } return true; }</code><technical_language>a dedicated catch block for NotFoundException cleaner</technical_language>

Target:
public boolean checkStatus(T waitObject) { String crn = waitObject.getCrn(); EnvironmentStatus desiredStatus = waitObject.getDesiredStatus(); try { DetailedEnvironmentResponse environment = waitObject.getEndpoint().getByCrn(crn); String name = environment.getName(); EnvironmentStatus status = environment.getEnvironmentStatus(); LOGGER.info("Waiting for the '{}' state of '{}' '{}' environment. Actual state is: '{}'", desiredStatus, name, crn, status); if (environment.getEnvironmentStatus() == DELETE_FAILED) { LOGGER.error("Environment '{}' '{}' termination failed (status:'{}'), waiting is cancelled.", name, crn, status); throw new TestFailException(String.format("Environment '%s' '%s' termination failed. Status: '%s' statusReason: '%s'", name, crn, status, environment.getStatusReason())); } if (!status.equals(ARCHIVED)) { return false; } } catch (NotFoundException e) { LOGGER.warn("No environment found with crn '{}'", crn, e); } catch (Exception e) { LOGGER.error("Environment termination failed: {}", e.getMessage(), e); throw new TestFailException(String.format("Environment termination failed: %s", e.getMessage())); } return true; }
Source:
<code>public boolean onOptionsItemSelected(MenuItem item) { int menuId = item.getItemId(); <START> switch (menuId) { <END> case R.id.about_menu: this.getSupportFragmentManager() .beginTransaction() .replace(R.id.fragment_holder, new About(), FragmentTags.ABOUT) .addToBackStack(FragmentTags.ABOUT) .commit(); return true; case android.R.id.home: this.onBackPressed(); return true; } return super.onOptionsItemSelected(item); }</code><technical_language>Thanks for changing this a switch! I originally added Lite Premium versions of app, I implement this if statement R.id constants declared final</technical_language>

Target:
public boolean onOptionsItemSelected(MenuItem item) { int menuId = item.getItemId(); switch (menuId) { case R.id.about_menu: fragmentManager .beginTransaction() .replace(R.id.fragment_holder, new About(), FragmentTags.ABOUT) .addToBackStack(FragmentTags.ABOUT) .commit(); return true; } return super.onOptionsItemSelected(item); }
Source:
<code>public int hashCode() { int result = _currentApiVersion != null ? _currentApiVersion.hashCode() : 0; result = 31 * result + (_apiRetryCount != null ? _apiRetryCount.hashCode() : 0); result = 31 * result + (_apiRetryInterval != null ? _apiRetryInterval.hashCode() : 0); return result; <START> } <END></code><technical_language>Please implement toString() provide debugging state information for debugging purposes</technical_language>

Target:
public int hashCode() { int result = super.hashCode(); result = 31 * result + (_currentApiVersion != null ? _currentApiVersion.hashCode() : 0); result = 31 * result + (_apiRetryCount != null ? _apiRetryCount.hashCode() : 0); result = 31 * result + (_apiRetryInterval != null ? _apiRetryInterval.hashCode() : 0); return result; }
Source:
<code>public void testAnnotatedMethodOk_annotatedJavascriptScriptMethod() throws Exception { webApp.setCrumbIssuer(new CrumbIssuer() { @Override public String issueCrumb(StaplerRequest request) { return "test"; } @Override public void validateCrumb(StaplerRequest request, String submittedCrumb) { } }); WebRequest settings = new WebRequest(new URL(j.getURL(), "testNewRulesOk/annotatedJavascriptScriptMethod/")); settings.setAdditionalHeader("Content-Type", "application/x-stapler-method-invocation"); settings.setHttpMethod(HttpMethod.POST); <START> settings.setRequestBody(JSONArray.fromObject(Collections.emptyList()).toString()); <END> assertReachableWithSettings(settings); }</code><technical_language>if this is more readable settings.setRequestBody("[]");</technical_language>

Target:
public void testAnnotatedMethodOk_annotatedJavascriptScriptMethod() throws Exception { webApp.setCrumbIssuer(new CrumbIssuer() { @Override public String issueCrumb(StaplerRequest request) { return "test"; } @Override public void validateCrumb(StaplerRequest request, String submittedCrumb) { } }); WebRequest settings = new WebRequest(new URL(j.getURL(), "testNewRulesOk/annotatedJavascriptScriptMethod/")); settings.setAdditionalHeader("Content-Type", "application/x-stapler-method-invocation"); settings.setHttpMethod(HttpMethod.POST); settings.setRequestBody("[]"); assertReachableWithSettings(settings); }
Source:
<code>protected QName getQname(String nameSpaceURI, String localPart) { QName xmlQname = null; <START> xmlQname = new QName(nameSpaceURI, localPart); <END> return xmlQname; }</code><technical_language>This function a single line (inline return)</technical_language>

Target:
protected QName getQname(String nameSpaceURI, String localPart) { return (new QName(nameSpaceURI, localPart)); }
Source:
<code>protected void onActivityResult(int requestCode, int resultCode, Intent data) { super.onActivityResult(requestCode, resultCode, data); if (requestCode == ACTION_SELECT_CONTENT_FROM_APPS && (resultCode == RESULT_OK || resultCode == UploadFilesActivity.RESULT_OK_AND_MOVE)) { <START> if (data.getData() == null && Build.VERSION.SDK_INT >= 16){ <END> for( int i = 0; i < data.getClipData().getItemCount(); i++){ Intent intent = new Intent(); intent.setData(data.getClipData().getItemAt(i).getUri()); requestSimpleUpload(intent, resultCode); } }else { requestSimpleUpload(data, resultCode); } } else if (requestCode == ACTION_SELECT_MULTIPLE_FILES && (resultCode == RESULT_OK || resultCode == UploadFilesActivity.RESULT_OK_AND_MOVE)) { requestMultipleUpload(data, resultCode); } else if (requestCode == ACTION_MOVE_FILES && (resultCode == RESULT_OK || resultCode == MoveActivity.RESULT_OK_AND_MOVE)){ final Intent fData = data; final int fResultCode = resultCode; getHandler().postDelayed( new Runnable() { @Override public void run() { requestMoveOperation(fData, fResultCode); } }, DELAY_TO_REQUEST_OPERATION_ON_ACTIVITY_RESULTS ); } }</code><technical_language>In other occasion, for clarifying, is use: Build.VERSION_CODES.JELLY_BEAN</technical_language>

Target:
protected void onActivityResult(int requestCode, int resultCode, Intent data) { super.onActivityResult(requestCode, resultCode, data); if (requestCode == ACTION_SELECT_CONTENT_FROM_APPS && (resultCode == RESULT_OK || resultCode == UploadFilesActivity.RESULT_OK_AND_MOVE)) { if (data.getData() == null && Build.VERSION.SDK_INT >= Build.VERSION_CODES.JELLY_BEAN){ for( int i = 0; i < data.getClipData().getItemCount(); i++){ Intent intent = new Intent(); intent.setData(data.getClipData().getItemAt(i).getUri()); requestSimpleUpload(intent, resultCode); } }else { requestSimpleUpload(data, resultCode); } } else if (requestCode == ACTION_SELECT_MULTIPLE_FILES && (resultCode == RESULT_OK || resultCode == UploadFilesActivity.RESULT_OK_AND_MOVE)) { requestMultipleUpload(data, resultCode); } else if (requestCode == ACTION_MOVE_FILES && resultCode == RESULT_OK){ final Intent fData = data; final int fResultCode = resultCode; getHandler().postDelayed( new Runnable() { @Override public void run() { requestMoveOperation(fData, fResultCode); } }, DELAY_TO_REQUEST_OPERATION_ON_ACTIVITY_RESULTS ); } }
Source:
<code>public void testClose() throws IOException { initialize(); List<RequestInfo> requestInfoList = new ArrayList<RequestInfo>(); <START> { <END> networkClient.close(); try { networkClient.sendAndPoll(requestInfoList); requestInfoList.clear(); Assert.fail("Polling after close should throw"); } catch (IllegalStateException e) { } } }</code><technical_language>braces needed</technical_language>

Target:
public void testClose() throws IOException { List<RequestInfo> requestInfoList = new ArrayList<RequestInfo>(); networkClient.close(); try { networkClient.sendAndPoll(requestInfoList); Assert.fail("Polling after close should throw"); } catch (IllegalStateException e) { } }
Source:
<code>private void checkCriticalComponents() { if (this.isEnabled) { boolean failure = false; for (CriticalComponentImpl csi : this.criticalServiceList) { if (csi.isTimedOut()) { failure = true; <START> logger.warn("Critical service failed -> SYSTEM REBOOT", csi.getName()); <END> break; } } if (!failure && !this.watchdogToStop) { refreshWatchdog(); } else { try { performWatchdogActions(); } catch (KuraException e) { logger.error("Failed to perform watchdog actions.", e); } } } else { if (this.configEnabled) { refreshWatchdog(); this.isEnabled = true; } } }</code><technical_language>Critical service -> Critical component</technical_language>

Target:
private void checkCriticalComponents() { if (this.enabled) { boolean failure = false; for (CriticalComponentImpl csi : this.criticalComponentList) { if (csi.isTimedOut()) { failure = true; logger.warn("Critical service failed -> SYSTEM REBOOT", csi.getName()); break; } } if (!failure && !this.watchdogToStop) { refreshWatchdog(); } else { try { performWatchdogActions(); } catch (KuraException e) { logger.error("Failed to perform watchdog actions.", e); } } } else { if (this.configEnabled) { refreshWatchdog(); this.enabled = true; } } }
Source:
<code>public void run() { fetchGamesFromLobby() .ifPresent( lobbyGames -> { final Map<String, LobbyGame> knownGames = localGamesFetcher.get(); <START> findNewGames(knownGames.keySet(), lobbyGames) .forEach( gameListing -> lobbyGameBroadcaster.gameUpdated( gameListing.getGameId(), gameListing.getLobbyGame())); findUpdatedGames(knownGames, lobbyGames) .forEach( gameListing -> lobbyGameBroadcaster.gameUpdated( gameListing.getGameId(), gameListing.getLobbyGame())); <END> findRemovedGames(knownGames.keySet(), lobbyGames) .forEach(lobbyGameBroadcaster::gameRemoved); }); }</code><technical_language>missing for methods findNewGames findUpdatedGames treated way, is separation in place</technical_language>

Target:
public void run() { fetchGamesFromLobby() .ifPresent( lobbyGames -> { final Map<String, LobbyGame> knownGames = localGamesFetcher.get(); findNewGames(knownGames.keySet(), lobbyGames) .forEach(lobbyGameBroadcaster::gameUpdated); findUpdatedGames(knownGames, lobbyGames) .forEach(lobbyGameBroadcaster::gameUpdated); findRemovedGames(knownGames.keySet(), lobbyGames) .forEach(lobbyGameBroadcaster::gameRemoved); }); }
Source:
<code>static Properties getKMSProperties(String key, int keySize) { Properties properties = new Properties(); properties.setProperty("kms.default.key", key); <START> properties.setProperty("kms.key.size.in.chars", "" + keySize); <END> properties.setProperty("clustermap.cluster.name", "dev"); properties.setProperty("clustermap.datacenter.name", "DC1"); properties.setProperty("clustermap.host.name", "localhost"); return properties; }</code><technical_language>Integer.toString()</technical_language>

Target:
static Properties getKMSProperties(String key, int keySize) { Properties properties = new Properties(); properties.setProperty("kms.default.container.key", key); properties.setProperty("kms.random.key.size.in.bits", Integer.toString(keySize)); properties.setProperty("clustermap.cluster.name", "dev"); properties.setProperty("clustermap.datacenter.name", "DC1"); properties.setProperty("clustermap.host.name", "localhost"); return properties; }
Source:
<code>void checkCanEdit(QGateWithOrgDto qualityGate) { <START> checkNotBuiltInt(qualityGate); <END> userSession.checkPermission(ADMINISTER_QUALITY_GATES, qualityGate.getOrganizationUuid()); }</code><technical_language>Typo : I checkNotBuiltIn( ) (without t)</technical_language>

Target:
void checkCanEdit(QGateWithOrgDto qualityGate) { checkNotBuiltIn(qualityGate); userSession.checkPermission(ADMINISTER_QUALITY_GATES, qualityGate.getOrganizationUuid()); }
Source:
<code>protected void browseButtonClicked() { DirectoryDialogConfiguration directoryDialogConfiguration = new DirectoryDialogConfiguration.Builder() <START> .withInitialDirectory(initialPath).build(); <END> dialogService.showDirectorySelectionDialog(directoryDialogConfiguration).ifPresent(selectedDirectory -> { texDirectory.set(selectedDirectory.toAbsolutePath().toString()); preferencesService.setWorkingDir(selectedDirectory.toAbsolutePath()); }); }</code><technical_language>withInitialDirectory(initialPath) browse dialog starts in latex folder (or current working directory). Thus, if user selects a folder, recognizes wants a subfolder, click browse start zero again. Thus, I choose getSearchDirectory initial directory</technical_language>

Target:
public void browseButtonClicked() { DirectoryDialogConfiguration directoryDialogConfiguration = new DirectoryDialogConfiguration.Builder() .withInitialDirectory(Paths.get(texDirectory.get())).build(); dialogService.showDirectorySelectionDialog(directoryDialogConfiguration).ifPresent(selectedDirectory -> { texDirectory.set(selectedDirectory.toAbsolutePath().toString()); preferencesService.setWorkingDir(selectedDirectory.toAbsolutePath()); }); }
Source:
<code>public void testWrapUnwrap() { byte[] nullArray = RLP.encodeElement(new byte[] {}); byte[] singleZero = RLP.encodeElement(new byte[] {0}); byte[] singleByte = RLP.encodeElement(new byte[] {1}); byte[] shortItem = RLP.encodeElement(new byte[] {(byte) 0x81}); byte[] longItemData = new byte[57]; new Random().nextBytes(longItemData); byte[] longItem = RLP.encodeElement(longItemData); byte[] shortList = RLP.encodeList(shortItem, shortItem, shortItem); byte[] longList = RLP.encodeList(longItem, longItem, longItem); <START> byte[] encoded = RLP.wrapList(nullArray, singleZero, singleByte, shortItem, longItem, shortList, longList); <END> RLPList decoded = RLP.unwrapList(encoded); assertArrayEquals(nullArray, decoded.get(0).getRLPData()); assertArrayEquals(singleZero, decoded.get(1).getRLPData()); assertArrayEquals(singleByte, decoded.get(2).getRLPData()); assertArrayEquals(shortItem, decoded.get(3).getRLPData()); assertArrayEquals(longItem, decoded.get(4).getRLPData()); assertArrayEquals(shortList, decoded.get(5).getRLPData()); assertArrayEquals(longList, decoded.get(6).getRLPData()); }</code><technical_language>I understand this encodeElement for data piece wrapList prepared encodeElement I put raw data instead</technical_language>

Target:
public void testWrapUnwrap() { byte[] shortItemData = new byte[] {(byte) 0x81}; byte[] longItemData = new byte[57]; new Random().nextBytes(longItemData); byte[] nullArray = RLP.encodeElement(new byte[] {}); byte[] singleZero = RLP.encodeElement(new byte[] {0}); byte[] singleByte = RLP.encodeElement(new byte[] {1}); byte[] shortItem = RLP.encodeElement(shortItemData); byte[] longItem = RLP.encodeElement(longItemData); byte[] shortList = RLP.encodeList(shortItem, shortItem, shortItem); byte[] longList = RLP.encodeList(longItem, longItem, longItem); byte[] encoded = RLP.wrapList(nullArray, singleZero, singleByte, shortItem, longItem, shortList, longList, shortItemData, longItemData); RLPList decoded = RLP.unwrapList(encoded); assertArrayEquals(nullArray, decoded.get(0).getRLPData()); assertArrayEquals(singleZero, decoded.get(1).getRLPData()); assertArrayEquals(singleByte, decoded.get(2).getRLPData()); assertArrayEquals(shortItem, decoded.get(3).getRLPData()); assertArrayEquals(longItem, decoded.get(4).getRLPData()); assertArrayEquals(shortList, decoded.get(5).getRLPData()); assertArrayEquals(longList, decoded.get(6).getRLPData()); assertArrayEquals(shortItemData, decoded.get(7).getRLPData()); assertArrayEquals(longItemData, decoded.get(8).getRLPData()); }
Source:
<code>public <T> T getDeserializedObject(Class<T> objectType) { <START> Objects.requireNonNull(objectSerializer, "No serializer set for deserializing event data payload."); <END> if (deserialized != null) { if (objectType.isInstance(deserialized)) { return objectType.cast(deserialized); }; } T typedDeserializedObject = objectSerializer.deserialize(new ByteArrayInputStream(eventData.getBody()), objectType).block(); deserialized = typedDeserializedObject; return typedDeserializedObject; }</code><technical_language>check objectType for null too</technical_language>

Target:
public <T> Mono<T> getDeserializedObject(Class<T> objectType) { if (this.serializer == null) { return monoError(logger, new NullPointerException("No serializer set for deserializing EventData payload.")); } if (objectType == null) { return monoError(logger, new IllegalArgumentException("objectType cannot be null.")); } return serializer.deserialize(new ByteArrayInputStream(eventData.getBody()), objectType); }
Source:
<code>DropDownMenu updateContextMenu(DropDownMenu dropDownMenu, List<ActionButtonDefinition<T>> actions, boolean removeOldItems) { if (removeOldItems) { ElementTooltipUtils.destroyMenuItemTooltips(dropDownMenu); dropDownMenu.clear(); closeOtherPopups(); } for (final ActionButtonDefinition<T> buttonDef : actions) { if (buttonDef instanceof UiMenuBarButtonDefinition) { UiMenuBarButtonDefinition<T> menuBarDef = (UiMenuBarButtonDefinition<T>) buttonDef; DropDownHeader subMenuHeader = new DropDownHeader(buttonDef.getText()); dropDownMenu.add(new Divider()); subMenuHeader.setVisible(buttonDef.isVisible(getSelectedItems())); dropDownMenu.add(subMenuHeader); updateContextMenu(dropDownMenu, menuBarDef.getSubActions(), false); } else { AnchorListItem item = new AnchorListItem(buttonDef.getText()); item.addClickHandler(e -> <START> { <END> buttonDef.onClick(getSelectedItems()); }); updateMenuItem(item, buttonDef); dropDownMenu.add(item); } } return dropDownMenu; }</code><technical_language>kill braces</technical_language>

Target:
private DropDownMenu updateContextMenu(DropDownMenu dropDownMenu, List<ActionButtonDefinition<T>> actions, boolean removeOldItems) { if (removeOldItems) { ElementTooltipUtils.destroyMenuItemTooltips(dropDownMenu); dropDownMenu.clear(); closeOtherPopups(); } for (final ActionButtonDefinition<T> buttonDef : actions) { if (buttonDef instanceof UiMenuBarButtonDefinition) { UiMenuBarButtonDefinition<T> menuBarDef = (UiMenuBarButtonDefinition<T>) buttonDef; DropDownHeader subMenuHeader = new DropDownHeader(buttonDef.getText()); dropDownMenu.add(new Divider()); subMenuHeader.setVisible(buttonDef.isVisible(getSelectedItems())); dropDownMenu.add(subMenuHeader); updateContextMenu(dropDownMenu, menuBarDef.getSubActions(), false); } else { AnchorListItem item = new AnchorListItem(buttonDef.getText()); item.addClickHandler(e -> buttonDef.onClick(getSelectedItems())); updateMenuItem(item, buttonDef); dropDownMenu.add(item); } } return dropDownMenu; }
Source:
<code><START> public void testParseHeaders1() <END> { HashMap<String, String> map = HttpDigestAuthFilter.parseHeaders(Arrays.asList(new String[]{ "basic toto=tutu", "basic toto=\"tutu\"" })); assertNull(map); }</code><technical_language>Put org.junit.Test annotation method... other Jersey tests</technical_language>

Target:
public void testParseHeaders1() throws Exception { HttpDigestAuthFilter f = new HttpDigestAuthFilter("foo", "bar"); Method method = HttpDigestAuthFilter.class.getDeclaredMethod("parseAuthHeaders", List.class); method.setAccessible(true); DigestScheme ds = (DigestScheme) method.invoke(f, Arrays.asList(new String[]{ "basic toto=tutu", "basic toto=\"tutu\"" })); Assert.assertNull(ds); }
Source:
<code>public STORAGE_PROPERTY_QUERY() { <START> } <END></code><technical_language>leave this empty - add call (implicit) _super()_ this enables setting a breakpoint in constructor</technical_language>

Target:
public STORAGE_PROPERTY_QUERY() { super(); }
Source:
<code><START> public static SecureRandom getSecureRandomInstance() <END> { try { return SecureRandom.getInstance("SHA1PRNG", "SUN"); } catch (NoSuchAlgorithmException | NoSuchProviderException e) { throw CryptoException.gettingRandomInstance(e); } }</code><technical_language>this private add a method int generateRandomNumber(int digits) instead</technical_language>

Target:
static SecureRandom getSecureRandomInstance() { try { return SecureRandom.getInstance("SHA1PRNG", "SUN"); } catch (NoSuchAlgorithmException | NoSuchProviderException e) { throw CryptoException.gettingRandomInstance(e); } }
Source:
<code><START> private boolean isValidateOnly(HttpServletRequest request) { <END> return "true".equals(request.getParameter(JSONValidationInterceptor.VALIDATE_ONLY_PARAM)); }</code><technical_language>this function protected? This allow extensions users</technical_language>

Target:
protected boolean isValidateOnly(HttpServletRequest request) { return "true".equals(request.getParameter(JSONValidationInterceptor.VALIDATE_ONLY_PARAM)); }
Source:
<code>public Number getLineRoundLimit() { <START> if (paint.get("line-round_limit") != null) { <END> return (Number) paint.get("line-round-limit"); } else { return 1.05; } }</code><technical_language>This underscore a dash</technical_language>

Target:
public Number getLineRoundLimit() { if (paint.get("line-round-limit") != null) { return (Number) paint.get("line-round-limit"); } else { return 1.05; } }
Source:
<code>protected List<Menu> findMatches() { Menu popupMenu = UIThreadRunnable.syncExec(new WidgetResult<Menu>() { @Override public Menu run() { Menu menu = control.getMenu(); if(menu == null) { <START> if(control instanceof NatTable) <END> menu = getNatTableMenu(); } if (menu != null) { menu.notifyListeners(SWT.Show, createEvent(menu)); } return menu; } }); if (popupMenu != null) { return Collections.singletonList(popupMenu); } return Collections.<Menu>emptyList(); }</code><technical_language>{} block please</technical_language>

Target:
protected List<Menu> findMatches() { Menu popupMenu = UIThreadRunnable.syncExec(new WidgetResult<Menu>() { @Override public Menu run() { Menu menu = control.getMenu(); if (menu == null) { if (control instanceof NatTable) { menu = getNatTableMenu(); } } if (menu != null) { menu.notifyListeners(SWT.Show, createEvent(menu)); } return menu; } }); if (popupMenu != null) { return Collections.singletonList(popupMenu); } return Collections.<Menu> emptyList(); }
Source:
<code>public WebSocketEventPublisher (ExtensionWebSocket extension) { this.extension = extension; <START> executor = Executors.newSingleThreadExecutor(new ThreadFactory() { <END> @Override public Thread newThread(Runnable runnable) { return new Thread(runnable, "ZAP-WebSocketEventPublisher"); }}); ZAP.getEventBus().registerPublisher( this, new String {EVENT_MESSAGE, EVENT_STATE_CHANGE}); }</code><technical_language>executor shutdown extension is unloaded. - a lambda for ThreadFactory</technical_language>

Target:
public WebSocketEventPublisher (ExtensionWebSocket extension) { this.extension = extension; executor = Executors.newSingleThreadExecutor( r -> { return new Thread(r, "ZAP-WebSocketEventPublisher"); }); ZAP.getEventBus().registerPublisher( this, new String {EVENT_MESSAGE, EVENT_STATE_CHANGE}); }