auphong2707/dl4se-code-review-dataset huggingface dataset:
Source:
<code>public void testConfigProviderConfigurationWithConfigParams() { Properties providers = new Properties(); providers.put("config.providers", "vault"); <START> providers.put("config.providers.vault.class", "org.apache.kafka.common.config.provider.MockVaultConfigProvider"); <END> providers.put("config.providers.vault.param.key", "randomKey"); providers.put("config.providers.vault.param.location", "/usr/vault"); Properties props = new Properties(); props.put("sasl.truststore.location", "${vault:/usr/truststore:truststoreKey}"); props.put("sasl.truststore.password", "${vault:/usr/truststore:truststorePassword}"); props.put("sasl.truststore.location", "${vault:/usr/truststore:truststoreLocation}"); TestIndirectConfigResolution config = new TestIndirectConfigResolution(props, convertPropertiesToMap(providers)); assertEquals(config.originals().get("sasl.truststore.location"), "/usr/vault"); }</code><technical_language>MockVaultConfigProvider.class.getName() instead of hard-coding class name changes reflected automatically</technical_language>

Target:
public void testConfigProviderConfigurationWithConfigParams() { Properties providers = new Properties(); providers.put("config.providers", "vault"); providers.put("config.providers.vault.class", MockVaultConfigProvider.class.getName()); providers.put("config.providers.vault.param.key", "randomKey"); providers.put("config.providers.vault.param.location", "/usr/vault"); Properties props = new Properties(); props.put("sasl.truststore.location", "${vault:/usr/truststore:truststoreKey}"); props.put("sasl.truststore.password", "${vault:/usr/truststore:truststorePassword}"); props.put("sasl.truststore.location", "${vault:/usr/truststore:truststoreLocation}"); TestIndirectConfigResolution config = new TestIndirectConfigResolution(props, convertPropertiesToMap(providers)); assertEquals(config.originals().get("sasl.truststore.location"), "/usr/vault"); }
Source:
<code>public boolean equals(Object o) { if (this == o) return true; if (o == null || getClass() != o.getClass()) return false; Opt121 opt121 = (Opt121) o; <START> if (rtDstSubnet != null ? !rtDstSubnet.equals(opt121.rtDstSubnet) : opt121.rtDstSubnet != null) return false; <END> return gateway != null ? gateway.equals(opt121.gateway) : opt121.gateway == null; }</code><technical_language>Guava's Objects for cleanliness? return Objects.equal(rtDstSubnet, o.rtDstSubnet) && Objects.equal(gateway, other.gateway)</technical_language>

Target:
public boolean equals(Object o) { if (this == o) return true; if (o == null || getClass() != o.getClass()) return false; Opt121 other = (Opt121)o; return Objects.equals(rtDstSubnet, other.rtDstSubnet) && Objects.equals(gateway, other.gateway); }
Source:
<code>public int hashCode() { final int prime = 31; int result = super.hashCode(); result = prime * result + ((fField == null) ? 0 : fField.hashCode()); result = prime * result + (fIgnoreCase ? 1231 : 1237); result = prime * result + (fNot ? 1231 : 1237); result = prime * result + ((fValue == null) ? 0 : fValue.hashCode()); <START> result = prime * result + ((fValueUpperCase == null) ? 0 : fValueUpperCase.hashCode()); <END> return result; }</code><technical_language>fValueUpperCase is derived fValue need considered for hashCode() equals()</technical_language>

Target:
public int hashCode() { final int prime = 31; int result = super.hashCode(); result = prime * result + ((fField == null) ? 0 : fField.hashCode()); result = prime * result + (fIgnoreCase ? 1231 : 1237); result = prime * result + (fNot ? 1231 : 1237); result = prime * result + ((fValue == null) ? 0 : fValue.hashCode()); return result; }
Source:
<code>SamzaContainer createSamzaContainer(String processorId, JobModel jobModel) { <START> Optional<Tuple2<DiagnosticsManager, MetricsSnapshotReporter>> diagnosticsManagerReporterPair = DiagnosticsUtil.buildDiagnosticsManager(new ApplicationConfig(config).getAppName(), new ApplicationConfig(config).getAppId(), processorId, Optional.empty(), config); <END> Option<DiagnosticsManager> diagnosticsManager = Option.empty(); if (diagnosticsManagerReporterPair.isPresent()) { diagnosticsManager = Option.apply(diagnosticsManagerReporterPair.get()._1()); this.customMetricsReporter.put(MetricsConfig.METRICS_SNAPSHOT_REPORTER_NAME_FOR_DIAGNOSTICS(), diagnosticsManagerReporterPair.get()._2()); } return SamzaContainer.apply(processorId, jobModel, ScalaJavaUtil.toScalaMap(this.customMetricsReporter), this.taskFactory, JobContextImpl.fromConfigWithDefaults(this.config), Option.apply(this.applicationDefinedContainerContextFactoryOptional.orElse(null)), Option.apply(this.applicationDefinedTaskContextFactoryOptional.orElse(null)), Option.apply(this.externalContextOptional.orElse(null)), null, null, diagnosticsManager); }</code><technical_language>is this appName other jobName? Nitpick: extract fields</technical_language>

Target:
SamzaContainer createSamzaContainer(String processorId, JobModel jobModel) { String jobName = new JobConfig(config).getName().get(); String jobId = new JobConfig(config).getJobId(); Optional<Pair<DiagnosticsManager, MetricsSnapshotReporter>> diagnosticsManagerReporterPair = DiagnosticsUtil.buildDiagnosticsManager(jobName, jobId, processorId, Optional.empty(), config); Option<DiagnosticsManager> diagnosticsManager = Option.empty(); if (diagnosticsManagerReporterPair.isPresent()) { diagnosticsManager = Option.apply(diagnosticsManagerReporterPair.get().getKey()); this.customMetricsReporter.put(MetricsConfig.METRICS_SNAPSHOT_REPORTER_NAME_FOR_DIAGNOSTICS(), diagnosticsManagerReporterPair.get().getValue()); } return SamzaContainer.apply(processorId, jobModel, ScalaJavaUtil.toScalaMap(this.customMetricsReporter), this.taskFactory, JobContextImpl.fromConfigWithDefaults(this.config), Option.apply(this.applicationDefinedContainerContextFactoryOptional.orElse(null)), Option.apply(this.applicationDefinedTaskContextFactoryOptional.orElse(null)), Option.apply(this.externalContextOptional.orElse(null)), null, null, diagnosticsManager); }
Source:
<code>protected IPapyrusMarker getMarkerA() { <START> if (markerA == null) { <END> markerA = new NodeAMarker(getView()); } return markerA; }</code><technical_language>'null' operande</technical_language>

Target:
protected IPapyrusMarker getMarkerA() { if (null == markerA) { markerA = new NodeAMarker(getView()); } return markerA; }
Source:
<code>protected boolean acquireLockInternal() { final boolean acquireLock = super.acquireLockInternal(); <START> if (!acquireLock && getVm().isAutoStartup()) { <END> AutoStartVmsRunner.getInstance().addVmToRun(getParameters().getVmId()); } return acquireLock; }</code><technical_language>add a null check please</technical_language>

Target:
protected boolean acquireLockInternal() { final boolean acquireLock = super.acquireLockInternal(); if (!acquireLock && getVm() != null && getVm().isAutoStartup()) { AutoStartVmsRunner.getInstance().addVmToRun(getParameters().getVmId()); } return acquireLock; }
Source:
<code>public synchronized boolean setFolderSyncMode(FolderMode syncMode) { FolderMode oldSyncMode = folderSyncMode; folderSyncMode = syncMode; if (syncMode == FolderMode.NONE && oldSyncMode != FolderMode.NONE) { return true; } <START> return syncMode != FolderMode.NONE && oldSyncMode == FolderMode.NONE; <END> }</code><technical_language>If combine return statements one. However, I code easier read/understand</technical_language>

Target:
public synchronized boolean setFolderSyncMode(FolderMode syncMode) { FolderMode oldSyncMode = folderSyncMode; folderSyncMode = syncMode; if (syncMode == FolderMode.NONE && oldSyncMode != FolderMode.NONE) { return true; } if (syncMode != FolderMode.NONE && oldSyncMode == FolderMode.NONE) { return true; } return false; }
Source:
<code><START> public Map<String, JsonElement> allFlags(LDUser user) { <END> if (isOffline()) { return null; } if (!initialized()) { return null; } Map<String, FeatureFlag> flags = this.config.featureStore.all(); Map<String, JsonElement> result = new HashMap<>(); for (String key : flags.keySet()) { result.put(key, evaluate(key, user, null)); } return result; }</code><technical_language>Hmm. I retain a helper fetches boolean flags. common case for this method, inconvenient transform map filter out boolean flags. do square this typed languages API footprint. untyped languages similarly consistent. sync a separate Quip doc that</technical_language>

Target:
public Map<String, Boolean> allFlags(LDUser user) { if (isOffline()) { return null; } if (!initialized()) { return null; } Map<String, FeatureFlag> flags = this.config.featureStore.all(); Map<String, Boolean> result = new HashMap<>(); for (String key : flags.keySet()) { JsonElement evalResult = evaluate(key, user, null); if (evalResult.isJsonPrimitive() && evalResult.getAsJsonPrimitive().isBoolean()) { result.put(key, evalResult.getAsBoolean()); } } return result; }
Source:
<code>private DCPanel contentBottom() { String showDataCloudDialog = _userPreferences.getAdditionalProperties() .getOrDefault(SHOW_DATACLOUD_DIALOG_USER_PREFERENCE, "false"); Boolean showDataCloudDialogBool = Boolean.parseBoolean(showDataCloudDialog); final JButton closeButton = WidgetFactory.createDefaultButton("Close", IconUtils.ACTION_CLOSE_DARK); <START> dontShowAgainCheckBox = new JCheckBox("Don't show after start again.", !showDataCloudDialogBool); <END> dontShowAgainCheckBox.setOpaque(false); final DCPanel result = new DCPanel(WidgetUtils.COLOR_DEFAULT_BACKGROUND); final BorderLayout borderLayout = new BorderLayout(); result.setLayout(borderLayout); result.add(dontShowAgainCheckBox, BorderLayout.WEST); result.add(closeButton, BorderLayout.EAST); closeButton.addActionListener(e -> { saveDontShowFlag(); close(); }); return result; }</code><technical_language>I I more previous sentence</technical_language>

Target:
private DCPanel contentBottom() { String showDataCloudDialog = _userPreferences.getAdditionalProperties() .getOrDefault(SHOW_DATACLOUD_DIALOG_USER_PREFERENCE, "false"); Boolean showDataCloudDialogBool = Boolean.parseBoolean(showDataCloudDialog); final JButton closeButton = WidgetFactory.createDefaultButton("Close", IconUtils.ACTION_CLOSE_DARK); dontShowAgainCheckBox = new JCheckBox("Don't show again.", !showDataCloudDialogBool); dontShowAgainCheckBox.setOpaque(false); final DCPanel result = new DCPanel(WidgetUtils.COLOR_DEFAULT_BACKGROUND); final BorderLayout borderLayout = new BorderLayout(); result.setLayout(borderLayout); result.add(dontShowAgainCheckBox, BorderLayout.WEST); result.add(closeButton, BorderLayout.EAST); closeButton.addActionListener(e -> { saveDontShowFlag(); close(); }); return result; }
Source:
<code>public boolean consumeRetry() { <START> return --remainingRetries >= 0; <END> }</code><technical_language>previous code pretty bad readability. new is better, much. a more expressive --remainingRetries >=0</technical_language>

Target:
boolean consumeRetry() { return --remainingRetries >= 0; }
Source:
<code>public Object[][] inputSequences() <START> { <END> return new Object[][] { {true}, {false}, {true, true, true}, {false, false, false}, {true, false, true, false}, }; }</code><technical_language>add {},</technical_language>

Target:
public Object[][] inputSequences() { return new Object[][] { {true}, {false}, {true, false}, {true, true, true}, {false, false, false}, {true, false, true, false}, }; }
Source:
<code>private synchronized void writeWatchdogDevice(String value) { File f = null; FileWriter bw = null; <START> try { <END> f = new File(this.watchdogDevice); bw = new FileWriter(f); bw.write(value); logger.debug("write on watchdog device", value); } catch (IOException e) { logger.error("IOException on disable watchdog", e); } finally { try { if (bw != null) { bw.close(); } } catch (IOException e) { logger.error("IOException on closing watchdog file", e); } } }</code><technical_language>try-with-resources statement avoid finally clause</technical_language>

Target:
private synchronized void writeWatchdogDevice(String value) { File f = new File(this.watchdogDevice); try (FileWriter bw = new FileWriter(f);) { bw.write(value); logger.debug("write on watchdog device", value); } catch (IOException e) { logger.error("IOException on disable watchdog", e); } }
Source:
<code>protected Optional<Boolean> getVal(Entity dataHolder) { <START> return Optional.of(dataHolder.isGlowing()); <END> }</code><technical_language>OptBool.of(dataHolder.isGlowing())</technical_language>

Target:
protected Optional<Boolean> getVal(Entity dataHolder) { return OptBool.of(dataHolder.isGlowing()); }
Source:
<code>public void add(TopicPartition topicPartition, PartitionData data) { <START> if (sessionPartitions.containsKey(topicPartition)) { <END> altered.add(topicPartition); } else { added.add(topicPartition); } next.put(topicPartition, data); sessionPartitions.put(topicPartition, data); }</code><technical_language>I able .put added PartitionData sessionPartitions front, capture returned .put, return previous value. If previous null, add added, if null add altered. This save additional containsKey check</technical_language>

Target:
public void add(TopicPartition topicPartition, PartitionData data) { if (sessionPartitions.put(topicPartition, data) != null) { altered.add(topicPartition); } else { added.add(topicPartition); } next.put(topicPartition, data); }
Source:
<code><START> public Optional getRequestAttribute(final String name) { <END> return Optional.ofNullable(this.request.getAttribute(name)); }</code><technical_language>add type parameter if object</technical_language>

Target:
public Optional<Object> getRequestAttribute(final String name) { return Optional.ofNullable(this.request.getAttribute(name)); }
Source:
<code>private void init() { <START> if (platformChecker == null) { <END> setPlatformChecker(); } }</code><technical_language>style nit: braces single line blocks</technical_language>

Target:
private void init() { if (platformChecker == null) setPlatformChecker(); }
Source:
<code>public synchronized void listen(@SuppressWarnings("unused") BibDatabaseContextChangedEvent event) { if (!(event instanceof FieldChangedEvent)) { eventBus.post(event); } else { FieldChangedEvent fieldChange = (FieldChangedEvent) event; boolean isEditOnNewField = lastFieldChanged == null || !lastFieldChanged.equals(fieldChange.getField()); boolean isMajorChange = fieldChange.getDelta() >= 1; if (isEditOnNewField) { <START> lastFieldChanged = fieldChange.getField(); <END> eventBus.post(event); } } }</code><technical_language>eventBus.post method, eventBus post method is reposinsible for firing event</technical_language>

Target:
public synchronized void listen(@SuppressWarnings("unused") BibDatabaseContextChangedEvent event) { Runnable eventPost = () -> { totalDelta = 0; eventBus.post(event); }; if (!(event instanceof FieldChangedEvent)) { eventPost.run(); } else { FieldChangedEvent fieldChange = (FieldChangedEvent) event; totalDelta += fieldChange.getDelta(); boolean isNewEdit = lastFieldChanged.isEmpty(); boolean isEditOnOtherField = !lastFieldChanged.get().equals(fieldChange.getField()); boolean isMajorChange = totalDelta >= 100; if ((isEditOnOtherField && !isNewEdit) || isMajorChange) { eventPost.run(); } else { delayPost.schedule(eventPost); } lastFieldChanged = Optional.of(fieldChange.getField()); } }
Source:
<code>public boolean validate(Process process) { <START> PrefsInterface prefsInterface = serviceManager.getRulesetService().getPreferences(process.getRuleset()); <END> FileformatInterface gdzfile; try { gdzfile = serviceManager.getProcessService().readMetadataFile(process); } catch (Exception e) { Helper.setFehlerMeldung(Helper.getTranslation("MetadataReadError") + process.getTitle(), e.getMessage()); return false; } return validate(gdzfile, prefsInterface, process); }</code><technical_language>Interface appended name of variable</technical_language>

Target:
public boolean validate(Process process) { PrefsInterface prefs = serviceManager.getRulesetService().getPreferences(process.getRuleset()); FileformatInterface gdzfile; try { gdzfile = serviceManager.getProcessService().readMetadataFile(process); } catch (Exception e) { Helper.setFehlerMeldung(Helper.getTranslation("MetadataReadError") + process.getTitle(), e.getMessage()); return false; } return validate(gdzfile, prefs, process); }
Source:
<code>public void testSearchByProjectNameBehindAFolder() throws Exception { final String projectName = "testSearchByProjectName"; j.createFreeStyleProject(projectName); j.createFolder("my-folder-1").createProject(FreeStyleProject.class, "my-job-1"); <START> Page result = j.createWebClient().goTo("job/my-folder-1/search?q="+ projectName); <END> assertNotNull(result); j.assertGoodStatus(result); String contents = result.getWebResponse().getContentAsString(); assertTrue(contents.contains(String.format("<title>%s [Jenkins]</title>", projectName))); }</code><technical_language>BTW store MockFolder a local var getUrl() method</technical_language>

Target:
public void testSearchByProjectNameBehindAFolder() throws Exception { FreeStyleProject myFreeStyleProject = j.createFreeStyleProject("testSearchByProjectName"); MockFolder myMockFolder = j.createFolder("my-folder-1"); Page result = j.createWebClient().goTo(myMockFolder.getUrl() + "search?q="+ myFreeStyleProject.getName()); assertNotNull(result); j.assertGoodStatus(result); URL resultUrl = result.getWebResponse().getUrl(); assertTrue(resultUrl.toString().equals(j.getInstance().getRootUrl() + myFreeStyleProject.getUrl())); }
Source:
<code>private static ImageResource getPoolVmImageResource(VmType vmType, boolean nextRunConfigurationExists) { switch (vmType) { case Desktop: return nextRunConfigurationExists ? resources.manyDesktopsChangesImage() : resources.manyDesktopsImage(); case Server: return nextRunConfigurationExists ? resources.manyServersChangesImage() : resources.manyServersImage(); default: <START> log.severe("Invalid VmType."); <END> return null; } }</code><technical_language>Please add NON-NLS :-)</technical_language>

Target:
private static ImageResource getPoolVmImageResource(VmType vmType, boolean nextRunConfigurationExists) { switch (vmType) { case Server: return nextRunConfigurationExists ? resources.manyServersChangesImage() : resources.manyServersImage(); case Desktop: default: return nextRunConfigurationExists ? resources.manyDesktopsChangesImage() : resources.manyDesktopsImage(); } }
Source:
<code>private synchronized void tryConnect() { if ( disposed ) { return; } else if ( fChannel != null && !fChannel.isDone() ) { return; } fChannel = bootstrap.connect( destination.socketAddress() ); channel = fChannel.channel(); fChannel.addListener( ( ChannelFuture f ) -> { if ( !f.isSuccess() ) { long millis = connectionBackoff.getMillis(); <START> log.warn( "Failed to connect to: %s. Retrying in %d ms", destination.socketAddress(), millis ); <END> f.channel().eventLoop().schedule( this::tryConnect, millis, MILLISECONDS ); connectionBackoff.increment(); } else { log.info( "Connected: " + f.channel() ); f.channel().closeFuture().addListener( closed -> { log.warn( String.format( "Lost connection to: %s (%s)", destination, channel.remoteAddress() ) ); connectionBackoff = connectionBackoffStrategy.newTimeout(); f.channel().eventLoop().schedule( this::tryConnect, 0, MILLISECONDS ); } ); } } ); }</code><technical_language>This spam crazy. Consider a CappedLogger interval of 10 seconds</technical_language>

Target:
private synchronized void tryConnect() { if ( disposed ) { return; } else if ( fChannel != null && !fChannel.isDone() ) { return; } fChannel = bootstrap.connect( destination.socketAddress() ); channel = fChannel.channel(); fChannel.addListener( ( ChannelFuture f ) -> { if ( !f.isSuccess() ) { long millis = connectionBackoff.getMillis(); cappedLogger.warn( "Failed to connect to: " + destination.socketAddress() + ". Retrying in " + millis + " ms" ); f.channel().eventLoop().schedule( this::tryConnect, millis, MILLISECONDS ); connectionBackoff.increment(); } else { log.info( "Connected: " + f.channel() ); f.channel().closeFuture().addListener( closed -> { log.warn( String.format( "Lost connection to: %s (%s)", destination, channel.remoteAddress() ) ); connectionBackoff = connectionBackoffStrategy.newTimeout(); f.channel().eventLoop().schedule( this::tryConnect, 0, MILLISECONDS ); } ); } } ); }
Source:
<code>private void assertMCA(MultiCurrencyAmount actual, CurrencyAmount... expected) { assertEquals(actual.size(), expected.length); assertEquals(actual.getAmounts().size(), expected.length); assertEquals(actual.getAmounts(), ImmutableSet.copyOf(expected)); Set<Currency> currencies = new HashSet<>(); for (CurrencyAmount expectedAmount : expected) { currencies.add(expectedAmount.getCurrency()); assertEquals(actual.contains(expectedAmount.getCurrency()), true); assertEquals(actual.getAmount(expectedAmount.getCurrency()), expectedAmount); } assertEquals(actual.getCurrencies(), currencies); <START> assertEquals(actual.contains(Currency.FRF), false); <END> assertThrows(() -> actual.getAmount(Currency.FRF), IllegalArgumentException.class); }</code><technical_language>Is FRF for code coverage (or used)? Worth a note</technical_language>

Target:
private void assertMCA(MultiCurrencyAmount actual, CurrencyAmount... expected) { assertEquals(actual.size(), expected.length); assertEquals(actual.getAmounts().size(), expected.length); assertEquals(actual.getAmounts(), ImmutableSet.copyOf(expected)); Set<Currency> currencies = new HashSet<>(); for (CurrencyAmount expectedAmount : expected) { currencies.add(expectedAmount.getCurrency()); assertEquals(actual.contains(expectedAmount.getCurrency()), true); assertEquals(actual.getAmount(expectedAmount.getCurrency()), expectedAmount); } assertEquals(actual.getCurrencies(), currencies); Currency nonExisting = Currency.of("FRZ"); assertEquals(actual.contains(nonExisting), false); assertThrows(() -> actual.getAmount(nonExisting), IllegalArgumentException.class); }
Source:
<code>VelocityContext createEnvironmentContext(Stack sharedStackResults, EnvironmentDescriptor environment) { VelocityContext context = new VelocityContext(); String stack = config.getProperty(PROPERTY_KEY_STACK); context.put(STACK, stack); context.put(INSTANCE, config.getProperty(PROPERTY_KEY_INSTANCE)); context.put(VPC_SUBNET_COLOR, config.getProperty(PROPERTY_KEY_VPC_SUBNET_COLOR)); context.put(VPC_EXPORT_PREFIX, Constants.createVpcExportPrefix(stack)); context.put(SHARED_EXPORT_PREFIX, createSharedExportPrefix()); context.put(REPO_BEANSTALK_NUMBER, config.getIntegerProperty(PROPERTY_KEY_BEANSTALK_NUMBER + EnvironmentType.REPOSITORY_SERVICES.getShortName())); context.put(DB_ENDPOINT_SUFFIX, extractDatabaseSuffix(sharedStackResults)); context.put(ENVIRONMENT, environment); context.put(STACK_CMK_ALIAS, secretBuilder.getCMKAlias()); ElasticBeanstalkEncryptedPlatformInfo elasticBeanstalkEncryptedPlatformInfo = elasticBeanstalkDefaultAMIEncrypter.getEncryptedElasticBeanstalkAMI( <START> config.getProperty(PROPERTY_KEY_ELASTICBEANSTALK_IMAGE_VERSION + "java"), <END> config.getProperty(PROPERTY_KEY_ELASTICBEANSTALK_IMAGE_VERSION + "tomcat"), config.getProperty(PROPERTY_KEY_ELASTICBEANSTALK_IMAGE_VERSION + "amazonlinux")); context.put(SOLUTION_STACK_NAME, elasticBeanstalkEncryptedPlatformInfo.getSolutionStackName()); context.put(ENCRYPTED_AMI_IMAGE_ID, elasticBeanstalkEncryptedPlatformInfo.getEncryptedAmiId()); return context; }</code><technical_language>move config encrypter</technical_language>

Target:
VelocityContext createEnvironmentContext(Stack sharedStackResults, EnvironmentDescriptor environment) { VelocityContext context = new VelocityContext(); String stack = config.getProperty(PROPERTY_KEY_STACK); context.put(STACK, stack); context.put(INSTANCE, config.getProperty(PROPERTY_KEY_INSTANCE)); context.put(VPC_SUBNET_COLOR, config.getProperty(PROPERTY_KEY_VPC_SUBNET_COLOR)); context.put(VPC_EXPORT_PREFIX, Constants.createVpcExportPrefix(stack)); context.put(SHARED_EXPORT_PREFIX, createSharedExportPrefix()); context.put(REPO_BEANSTALK_NUMBER, config.getIntegerProperty(PROPERTY_KEY_BEANSTALK_NUMBER + EnvironmentType.REPOSITORY_SERVICES.getShortName())); context.put(DB_ENDPOINT_SUFFIX, extractDatabaseSuffix(sharedStackResults)); context.put(ENVIRONMENT, environment); context.put(STACK_CMK_ALIAS, secretBuilder.getCMKAlias()); ElasticBeanstalkEncryptedPlatformInfo elasticBeanstalkEncryptedPlatformInfo = elasticBeanstalkDefaultAMIEncrypter.getEncryptedElasticBeanstalkAMI(); context.put(SOLUTION_STACK_NAME, elasticBeanstalkEncryptedPlatformInfo.getSolutionStackName()); context.put(ENCRYPTED_AMI_IMAGE_ID, elasticBeanstalkEncryptedPlatformInfo.getEncryptedAmiId()); return context; }
Source:
<code>private void doCriticalMemoryHitTest(boolean createPR, final boolean disabledQueryMonitorForLowMem, final int queryTimeout, final boolean hitCriticalThreshold) { final VM server = VM.getVM(0); final VM client = VM.getVM(1); final int numObjects = 200; try { final int port = AvailablePortHelper.getRandomAvailableTCPPort(); startCacheServer(server, port, disabledQueryMonitorForLowMem, queryTimeout, createPR); startClient(client, port); populateData(server); doTestCriticalHeapAndQueryTimeout(server, client, disabledQueryMonitorForLowMem, queryTimeout, hitCriticalThreshold); if (hitCriticalThreshold) { vmRecoversFromCriticalHeap(server); await().until(() -> vmCheckCritcalHeap(server) == EVICTION_DISABLED); } client.invoke("Executing query when system is 'Normal'", () -> { try { QueryService qs = getCache().getQueryService(); Query query = qs.newQuery("Select * From /" + "portfolios"); SelectResults results = (SelectResults) query.execute(); assertThat(results.size()).isEqualTo(numObjects); <START> } catch (QueryInvocationTargetException | FunctionDomainException | TypeMismatchException <END> | NameResolutionException e) { fail(""); } }); doTestCriticalHeapAndQueryTimeout(server, client, disabledQueryMonitorForLowMem, queryTimeout, hitCriticalThreshold); if (hitCriticalThreshold) { vmRecoversFromCriticalHeap(server); await().until(() -> vmCheckCritcalHeap(server) == EVICTION_DISABLED); } } finally { stopServer(server); } }</code><technical_language>Another catch-block delete</technical_language>

Target:
private void doCriticalMemoryHitTest(boolean createPR, final boolean disabledQueryMonitorForLowMem, final int queryTimeout, final boolean hitCriticalThreshold) throws InterruptedException { final VM server = VM.getVM(0); final VM client = VM.getVM(1); final int numObjects = 200; try { final int port = AvailablePortHelper.getRandomAvailableTCPPort(); startCacheServer(server, port, disabledQueryMonitorForLowMem, queryTimeout, createPR); startClient(client, port); populateData(server); doTestCriticalHeapAndQueryTimeout(server, client, disabledQueryMonitorForLowMem, queryTimeout, hitCriticalThreshold); if (hitCriticalThreshold) { vmRecoversFromCriticalHeap(server); await().until(() -> vmCheckCritcalHeap(server) == EVICTION_DISABLED); } client.invoke("Executing query when system is 'Normal'", () -> { QueryService qs = getCache().getQueryService(); Query query = qs.newQuery("Select * From /" + "portfolios"); SelectResults results = (SelectResults) query.execute(); assertThat(results.size()).isEqualTo(numObjects); }); doTestCriticalHeapAndQueryTimeout(server, client, disabledQueryMonitorForLowMem, queryTimeout, hitCriticalThreshold); if (hitCriticalThreshold) { vmRecoversFromCriticalHeap(server); await().until(() -> vmCheckCritcalHeap(server) == EVICTION_DISABLED); } } finally { stopServer(server); } }
Source:
<code>private Properties getCredential() throws IOException { Properties properties = new Properties(); try { properties.load(new FileReader( <START> new File(getClass().getClassLoader().getResource("sdk_config.properties").getFile()))); <END> } catch (FileNotFoundException e) { return null; } return properties; }</code><technical_language>Please extract constant string</technical_language>

Target:
public static ClientCredentials getCredential() { ClientCredentials credentials = new ClientCredentials(); Properties configFileProperties = getConfigFileProperties(); mergeProperties(configFileProperties, configurationMap); credentials.setClientID(configurationMap.get(Constants.CLIENT_ID)); credentials.setClientSecret(configurationMap.get(Constants.CLIENT_SECRET)); return credentials; }
Source:
<code>private ProducerRecord<byte[], byte[]> convertToProducerRecord(String topicName, DatastreamProducerRecord record, Object event) throws DatastreamException { Optional<Integer> partition = record.getPartition(); byte[] keyValue = new byte[0]; byte[] payloadValue = new byte[0]; if (event instanceof BrooklinEnvelope) { BrooklinEnvelope envelope = (BrooklinEnvelope) event; if (envelope.key().isPresent() && envelope.key().get() instanceof byte[]) { keyValue = (byte[]) envelope.key().get(); } if (envelope.value().isPresent() && envelope.value().get() instanceof byte[]) { payloadValue = (byte[]) envelope.value().get(); } } else if (event instanceof byte[]) { payloadValue = (byte[]) event; } if (partition.isPresent() && partition.get() >= 0) { return new ProducerRecord<>(topicName, partition.get(), keyValue, payloadValue); } else { <START> ProducerRecord<byte[], byte[]> producerRecord = new ProducerRecord<>(topicName, payloadValue); <END> if (record.getPartitionKey().isPresent()) { keyValue = record.getPartitionKey().get().getBytes(); producerRecord = new ProducerRecord<>(topicName, keyValue, payloadValue); } return producerRecord; } }</code><technical_language>simplify change, modify original code. Old: keyValue = record.getPartitionKey().isPresent() ? record.getPartitionKey().get().getBytes() : keyValue; New: keyValue = record.getPartitionKey().isPresent() ? record.getPartitionKey().get().getBytes() : null; set byte[] keyValue = null line 100</technical_language>

Target:
private ProducerRecord<byte[], byte[]> convertToProducerRecord(String topicName, DatastreamProducerRecord record, Object event) { Optional<Integer> partition = record.getPartition(); byte[] keyValue = new byte[0]; byte[] payloadValue = new byte[0]; if (event instanceof BrooklinEnvelope) { BrooklinEnvelope envelope = (BrooklinEnvelope) event; if (envelope.key().isPresent() && envelope.key().get() instanceof byte[]) { keyValue = (byte[]) envelope.key().get(); } if (envelope.value().isPresent() && envelope.value().get() instanceof byte[]) { payloadValue = (byte[]) envelope.value().get(); } } else if (event instanceof byte[]) { payloadValue = (byte[]) event; } if (partition.isPresent() && partition.get() >= 0) { return new ProducerRecord<>(topicName, partition.get(), keyValue, payloadValue); } else { keyValue = record.getPartitionKey().isPresent() ? record.getPartitionKey().get().getBytes(StandardCharsets.UTF_8) : null; return new ProducerRecord<>(topicName, keyValue, payloadValue); } }
Source:
<code>public void init() throws IOException, ProcedureException { <START> String[] properties = config.get( LoadableBloomFulltextConfig.bloom_indexed_properties ).toArray( new String[0] ); <END> Analyzer analyzer; try { Class configuredAnalayzer = Class.forName( config.get( LoadableBloomFulltextConfig.bloom_analyzer ) ); analyzer = (Analyzer) configuredAnalayzer.newInstance(); } catch ( Exception e ) { throw new RuntimeException( "Could not create the configured analyzer", e ); } FulltextProvider provider = FulltextProvider.instance( db ); FulltextFactory fulltextFactory = new FulltextFactory( fileSystemAbstraction, storeDir, analyzer ); String bloomNodes = "bloomNodes"; fulltextFactory.createFulltextIndex( bloomNodes, FulltextProvider.FULLTEXT_INDEX_TYPE.NODES, properties, provider ); String bloomRelationships = "bloomRelationships"; fulltextFactory.createFulltextIndex( bloomRelationships, FulltextProvider.FULLTEXT_INDEX_TYPE.RELATIONSHIPS, properties, provider ); procedures.register( new BloomProcedure( FulltextProvider.FULLTEXT_INDEX_TYPE.NODES, bloomNodes, provider ) ); procedures.register( new BloomProcedure( FulltextProvider.FULLTEXT_INDEX_TYPE.RELATIONSHIPS, bloomRelationships, provider ) ); }</code><technical_language>convert list of properties array. soon passed LuceneFulltext converted list</technical_language>

Target:
public void init() throws IOException, KernelException { List<String> properties = config.get( LoadableBloomFulltextConfig.bloom_indexed_properties ); Analyzer analyzer = getAnalyzer(); provider = new FulltextProvider( db, logService.getInternalLog( FulltextProvider.class ) ); FulltextFactory fulltextFactory = new FulltextFactory( fileSystemAbstraction, storeDir, analyzer ); fulltextFactory.createFulltextIndex( BLOOM_NODES, FulltextProvider.FulltextIndexType.NODES, properties, provider ); fulltextFactory.createFulltextIndex( BLOOM_RELATIONSHIPS, FulltextProvider.FulltextIndexType.RELATIONSHIPS, properties, provider ); procedures.registerComponent( FulltextProvider.class, context -> provider, true ); procedures.registerProcedure( BloomProcedures.class ); }
Source:
<code>public List<VmNumaNode> getVmNumaNodes(VM vm) { int onlineCpus = vm.getNumOfCpus(); int vcpus = FeatureSupported.supportedInConfig(ConfigValues.HotPlugCpuSupported, vm.getCompatibilityVersion(), vm.getClusterArch()) ? VmCpuCountHelper.calcMaxVCpu(vm, vm.getClusterCompatibilityVersion()) : onlineCpus; int offlineCpus = vcpus - onlineCpus; List<VmNumaNode> vmNumaNodes = vmNumaNodeDao.getAllVmNumaNodeByVmId(vm.getId()); if (!vmNumaNodes.isEmpty()) { <START> int numaCount = vmNumaNodes.size(); <END> int index = 0; for (VmNumaNode vmNode : vmNumaNodes) { index += vmNode.getCpuIds().size(); } if (onlineCpus != index) { offlineCpus = vcpus - index; } if (offlineCpus > 0) { numaCount = vmNumaNodes.size(); for (VmNumaNode vmNode : vmNumaNodes) { if (numaCount <= 0) { break; } for (int i = vmNode.getCpuIds().size(); i < vcpus / numaCount; i++) { vmNode.getCpuIds().add(index++); } vcpus -= vcpus / numaCount; --numaCount; } } return vmNumaNodes; } if (offlineCpus > 0) { VmNumaNode vmNode = new VmNumaNode(); vmNode.setIndex(0); vmNode.setMemTotal(vm.getMemSizeMb()); for (int i = 0; i < vcpus; i++) { vmNode.getCpuIds().add(i); } return Collections.singletonList(vmNode); } return Collections.emptyList(); }</code><technical_language>This line is needed, variable 'numaCount' is line 1203</technical_language>

Target:
public List<VmNumaNode> getVmNumaNodes(VM vm) { int onlineCpus = vm.getNumOfCpus(); int vcpus = FeatureSupported.supportedInConfig(ConfigValues.HotPlugCpuSupported, vm.getCompatibilityVersion(), vm.getClusterArch()) ? VmCpuCountHelper.calcMaxVCpu(vm, vm.getClusterCompatibilityVersion()) : onlineCpus; int offlineCpus = vcpus - onlineCpus; List<VmNumaNode> vmNumaNodes = vmNumaNodeDao.getAllVmNumaNodeByVmId(vm.getId()); if (!vmNumaNodes.isEmpty()) { int index = 0; for (VmNumaNode vmNode : vmNumaNodes) { index += vmNode.getCpuIds().size(); } if (onlineCpus != index) { offlineCpus = vcpus - index; } if (offlineCpus > 0) { int numaCount = vmNumaNodes.size(); for (VmNumaNode vmNode : vmNumaNodes) { if (numaCount <= 0) { break; } for (int i = vmNode.getCpuIds().size(); i < vcpus / numaCount; i++) { vmNode.getCpuIds().add(index++); } vcpus -= vcpus / numaCount; --numaCount; } } return vmNumaNodes; } if (offlineCpus > 0) { VmNumaNode vmNode = new VmNumaNode(); vmNode.setIndex(0); vmNode.setMemTotal(vm.getMemSizeMb()); for (int i = 0; i < vcpus; i++) { vmNode.getCpuIds().add(i); } return Collections.singletonList(vmNode); } return Collections.emptyList(); }
Source:
<code>public Boolean call(String[] tokens) throws Exception { try { Boolean keep = true; for (Integer index : indices) { <START> if (index >= tokens.length || MLConstants.EMPTY.equals(tokens[index]) || <END> MLConstants.NA.equals(tokens[index]) || MLConstants.QUESTION.equals(tokens[index])) { keep = false; break; } } MLConstants.SUPERVISED_ALGORITHM.values(); return keep; } catch (Exception e) { throw new MLModelBuilderException("An error occurred while removing discarded rows: " + e.getMessage(), e); } }</code><technical_language>introduce enum <LINK_0> validate</technical_language>

Target:
public Boolean call(String[] tokens) throws Exception { try { Boolean keep = true; for (Integer index : indices) { if (index >= tokens.length || MLConstants.MISSING_VALUES.contains(tokens[index])) { keep = false; break; } } MLConstants.SUPERVISED_ALGORITHM.values(); return keep; } catch (Exception e) { throw new MLModelBuilderException("An error occurred while removing discarded rows: " + e.getMessage(), e); } }
Source:
<code>public void run(Blob blob) throws OperationException, IOException { if (blob == null) { throw new OperationException("there is no file content available"); } <START> final DownloadService downloads = Framework.getService(DownloadService.class); <END> String key = downloads.store(Collections.singletonList(blob)); String url = BaseURL.getBaseURL() + "/" + downloads.getDownloadUrl(key); ExternalContext externalContext = FacesContext.getCurrentInstance().getExternalContext(); HttpServletRequest request = (HttpServletRequest) externalContext.getRequest(); HttpServletResponse response = (HttpServletResponse) externalContext.getResponse(); try { request.setAttribute(NXAuthConstants.DISABLE_REDIRECT_REQUEST_KEY, new Boolean(true)); externalContext.redirect(url); response.flushBuffer(); FacesContext.getCurrentInstance().responseComplete(); ctx.getVars().put("Outcome", null); } catch (IOException e) { log.error("Error while redirecting for big blob downloader", e); } }</code><technical_language>need for final. Please call variable downloadService</technical_language>

Target:
public void run(Blob blob) throws OperationException, IOException { if (blob == null) { throw new OperationException("there is no file content available"); } DownloadService downloadService = Framework.getService(DownloadService.class); String key = downloadService.storeBlobs(Collections.singletonList(blob)); String url = BaseURL.getBaseURL() + "/" + downloadService.getDownloadUrl(key); ExternalContext externalContext = FacesContext.getCurrentInstance().getExternalContext(); HttpServletRequest request = (HttpServletRequest) externalContext.getRequest(); HttpServletResponse response = (HttpServletResponse) externalContext.getResponse(); try { request.setAttribute(NXAuthConstants.DISABLE_REDIRECT_REQUEST_KEY, new Boolean(true)); externalContext.redirect(url); response.flushBuffer(); FacesContext.getCurrentInstance().responseComplete(); ctx.getVars().put("Outcome", null); } catch (IOException e) { log.error("Error while redirecting for big blob downloader", e); } }
Source:
<code>public List<AdditionalCredentials> getAdditionalCredentials() { <START> return(additionalCredentials); <END> }</code><technical_language>FindBugs grumble exposing external implementation. @Restricted for Jelly wrap unmodifyableList</technical_language>

Target:
public List<AdditionalCredentials> getAdditionalCredentials() { if(additionalCredentials==null) { return Collections.emptyList(); } return Collections.unmodifiableList(additionalCredentials); }
Source:
<code>public void apply(Project project) { project.getTasks().withType(JavaCompile.class).configureEach(t -> { <START> t.getOptions().setEncoding("UTF-8"); <END> }); }</code><technical_language>nit: prefer rename t -> compileJavaTask</technical_language>

Target:
public void apply(Project project) { project.getTasks().withType(JavaCompile.class).configureEach(javaCompileTask -> { javaCompileTask.getOptions().setEncoding("UTF-8"); }); }
Source:
<code>public OAuth2AccessToken readAccessToken(String accessToken) { if (isApiKey(accessToken)) { <START> return remoteTokenServices.readAccessToken(accessToken); <END> } return jwtTokenService.readAccessToken(accessToken); }</code><technical_language>include retry template do return retryTemplate.execute(x -> remoteTokenServices.readAccessToken(accessToken));</technical_language>

Target:
public OAuth2AccessToken readAccessToken(String accessToken) { if (isApiKey(accessToken)) { return retryTemplate.execute(x ->remoteTokenServices.readAccessToken(accessToken)); } return jwtTokenService.readAccessToken(accessToken); }
Source:
<code>private void configureTimeouts(DefaultHttpClient httpClient) { int socketTimeOut = Config.<Integer> getValue(ConfigValues.ExternalNetworkProviderTimeout) * 1000; <START> int connectionTimeOut = Config.<Integer> getValue(ConfigValues.ExternalNetworkProviderConnectionTimeout) * 1000; <END> HttpParams params = httpClient.getParams(); HttpConnectionParams.setConnectionTimeout(params, connectionTimeOut); HttpConnectionParams.setSoTimeout(params, socketTimeOut); }</code><technical_language>line long. TimeUnit convert time units</technical_language>

Target:
private void configureTimeouts(DefaultHttpClient httpClient) { long socketTimeOut = TimeUnit.SECONDS.toMillis( Config.<Integer> getValue(ConfigValues.ExternalNetworkProviderTimeout)); long connectionTimeOut = TimeUnit.SECONDS.toMillis( Config.<Integer> getValue(ConfigValues.ExternalNetworkProviderConnectionTimeout)); HttpParams params = httpClient.getParams(); HttpConnectionParams.setConnectionTimeout(params, toIntExact(connectionTimeOut)); HttpConnectionParams.setSoTimeout(params, toIntExact(socketTimeOut)); }
Source:
<code>public void closeOperationShouldWaitUntilAllCurrentOperationsWillBeFinished() throws Exception { final String message1 = "Message 1"; final String message2 = "Message 2"; WaitingAnswer<Void> waitingAnswer1 = waitOnWrite(lineConsumer2, message1); WaitingAnswer<Void> waitingAnswer2 = waitOnWrite(lineConsumer2, message2); executor.execute(concurrentCompositeLineConsumer::close); waitingAnswer1.completeAnswer(); <START> waitingAnswer2.completeAnswer(); <END> awaitFinalization(); assertFalse(concurrentCompositeLineConsumer.isOpen()); for (LineConsumer consumer : subConsumers) { verify(consumer).writeLine(eq(message1)); verify(consumer).writeLine(eq(message2)); } }</code><technical_language>Please ensure close methods called writes finished</technical_language>

Target:
public void closeOperationShouldWaitUntilAllCurrentOperationsWillBeFinished() throws Exception { final String message1 = "Message 1"; final String message2 = "Message 2"; WaitingAnswer<Void> waitingAnswer1 = waitOnWrite(lineConsumer2, message1); WaitingAnswer<Void> waitingAnswer2 = waitOnWrite(lineConsumer2, message2); executor.execute(concurrentCompositeLineConsumer::close); waitingAnswer1.completeAnswer(); waitingAnswer2.completeAnswer(); awaitFinalization(); assertFalse(concurrentCompositeLineConsumer.isOpen()); for (LineConsumer consumer : subConsumers) { verify(consumer).writeLine(eq(message1)); verify(consumer).writeLine(eq(message2)); verify(consumer, last()).close(); } }
Source:
<code>private static void parseJson( HttpMessage message, Value value, boolean strictEncoding, String charset ) throws IOException { try { <START> JsUtils.parseJsonIntoValue( new InputStreamReader( new ByteArrayInputStream( message.content() ), charset ), value, strictEncoding ); <END> } catch ( IOException e ) { value.setValue( new String( message.content() )); } }</code><technical_language>this throw a fault? This get a string message programmer expecting in type, raising unexpected TypeMismatch fault</technical_language>

Target:
private static void parseJson( HttpMessage message, Value value, boolean strictEncoding, String charset ) throws IOException { JsUtils.parseJsonIntoValue( new InputStreamReader( new ByteArrayInputStream( message.content() ), charset ), value, strictEncoding ); }
Source:
<code>public void authenticate(Request request) throws RequestAuthenticationException { if (clientCredentials != null && clientCredentials.getCredentials() != null) { OAuth2AccessToken oAuth2AccessToken = clientCredentials.getCredentials(); if (oAuth2AccessToken != null) { if (oAuth2AccessToken.hasExpired()) { log.debug("OAuth2 access token expiry detected. Will fetch a new token from Authorization server"); try { OAuth2ClientCredentials oAuth2ClientCredentials = (OAuth2ClientCredentials) clientCredentials; oAuth2ClientCredentials.reset(); oAuth2AccessToken = oAuth2ClientCredentials.getAccessTokenRetrieverService().getOAuth2AccessToken(); oAuth2ClientCredentials.setCredentials(oAuth2AccessToken); } catch (IOException | InvalidKeyException e) { log.error("Exception occurred", e); <START> throw new RuntimeException(e); <END> } } request.getHeaders() .set(AUTHORIZATION_HEADER, "Bearer " + oAuth2AccessToken.getAccessToken()); } } }</code><technical_language>throw a RuntimeException here. Throw a RequestAuthenticationException, is is defined in method signature</technical_language>

Target:
public void authenticate(Request request) throws RequestAuthenticationException { OAuth2AccessToken oAuth2AccessToken = clientCredentials.getCredentials(); if (oAuth2AccessToken.hasExpired()) { log.debug("OAuth2 access token expiry detected. Will fetch a new token from Authorization server"); synchronized (this) { if (oAuth2AccessToken.hasExpired()) { try { OAuth2ClientCredentials oAuth2ClientCredentials = (OAuth2ClientCredentials) clientCredentials; oAuth2AccessToken = oAuth2ClientCredentials.getAccessTokenRetrieverService().getOAuth2AccessToken(); oAuth2ClientCredentials.setCredentials(oAuth2AccessToken); } catch (IOException | InvalidKeyException e) { throw new OAuth2TokenRetrieverException("Failed to renew expired OAuth2 access token", e); } } } } request.getHeaders().set(AUTHORIZATION_HEADER, "Bearer " + oAuth2AccessToken.getAccessToken()); }
Source:
<code>public void modifyTable(TableName tableName, TableDescriptor tableDescriptor) throws IOException { <START> if(isTableAvailable(tableName)) { <END> modifyFamilies(tableName,tableDescriptor); deleteFamilies(tableName,tableDescriptor); }else { throw new TableNotFoundException(tableName); } }</code><technical_language>Please get current descriptor here. that, need create array of modifications need occur. modifications need in a single RPC. a method in AbstractBigtableAdmin: protected void modifyColumn(TableName tableName, String columnName, String modificationType, Modification... modifications) Please this method array of modifications. send a single RPC</technical_language>

Target:
public void modifyTable(TableName tableName, TableDescriptor tableDescriptor) throws IOException { if (isTableAvailable(tableName)) { TableDescriptor currentTableDescriptor = getTableDescriptor(tableName); List<Modification> modifications = new ArrayList<>(); List<HColumnDescriptor> columnDescriptors = tableAdapter2x.toHColumnDescriptors(tableDescriptor); List<HColumnDescriptor> currentColumnDescriptors = tableAdapter2x.toHColumnDescriptors(currentTableDescriptor); modifications.addAll(tableModificationAdapter.buildModifications(columnDescriptors, currentColumnDescriptors)); modifyColumn(tableName, "modifyTable", "update", (Modification[]) modifications.toArray()); } else { throw new TableNotFoundException(tableName); } }
Source:
<code>void withDisabledEnrichment() { final Event event = createEvent(toMessage(newUuid())); <START> final EventEnvelope notEnrichableEvent = EventEnvelope.of( <END> event.toBuilder() .setContext(event.getContext() .toBuilder() .setEnrichment(event.getContext() .getEnrichment() .toBuilder() .setDoNotEnrich(true))) .build() ); assertFalse(enricher.canBeEnriched(notEnrichableEvent)); }</code><technical_language>Please extract some bits variables</technical_language>

Target:
void withDisabledEnrichment() { final Event event = createEvent(toMessage(newUuid())); final Enrichment.Builder enrichment = event.getContext() .getEnrichment() .toBuilder() .setDoNotEnrich(true); final EventContext.Builder context = event.getContext() .toBuilder() .setEnrichment(enrichment); final EventEnvelope notEnrichableEvent = EventEnvelope.of( event.toBuilder() .setContext(context) .build() ); assertFalse(enricher.canBeEnriched(notEnrichableEvent)); }
Source:
<code>public static String sortOrderSpeaker() { switch (SharedPreferencesUtil.getInt(ConstantStrings.PREF_SORT_SPEAKER, 0)) { case SORT_TYPE_FIRST: return Speaker.Companion.getNAME(); case SORT_TYPE_SECOND: return Speaker.Companion.getORGANISATION(); case SORT_TYPE_THIRD: return Speaker.Companion.getCOUNTRY(); default: <START> return Speaker.Companion.getNAME(); <END> } }</code><technical_language>If is @JvmStatic, need Companion reference</technical_language>

Target:
public static String sortOrderSpeaker() { switch (SharedPreferencesUtil.getInt(ConstantStrings.PREF_SORT_SPEAKER, 0)) { case SORT_TYPE_FIRST: return Speaker.NAME; case SORT_TYPE_SECOND: return Speaker.ORGANISATION; case SORT_TYPE_THIRD: return Speaker.COUNTRY; default: return Speaker.NAME; } }