auphong2707/dl4se-code-review-dataset huggingface dataset:
Source:
<code>public Guid persistAsyncTaskPlaceHolder(VdcActionType parentCommand) { Guid retValue = Guid.Empty; try { AsyncTasks task = createAsyncTask(new AsyncTaskCreationInfo(), parentCommand); retValue = task.getTaskId(); <START> AsyncTaskUtils.addOrUpdateTaskInDB(task, null, EMPTY_GUID_ARRAY); <END> } catch (RuntimeException ex) { log.errorFormat("Error during createAsyncTask for command: {0}. Exception {1}", this.getClass().getName(), ex); } return retValue; }</code><technical_language>need modify this, provide a pass map of entityId -> VdcObjectType (later = next patches in patchset deal fixing task - entity association)</technical_language>

Target:
public Guid persistAsyncTaskPlaceHolder(VdcActionType parentCommand) { Guid retValue = Guid.Empty; try { AsyncTasks task = createAsyncTask(new AsyncTaskCreationInfo(), parentCommand); retValue = task.getTaskId(); AsyncTaskUtils.addOrUpdateTaskInDB(task, null, EMPTY_GUID_ARRAY); } catch (RuntimeException ex) { log.errorFormat("Error during persistAsyncTaskPlaceHolder for command: {0}. Exception {1}", this.getClass().getName(), ex); } return retValue; }
Source:
<code>public void testRoundTrip() { SigningKeyPair kp = new SigningKeyPair(SIGN_PRIVATE, HEX); String signature = kp.getSigningKey().sign(SIGN_MESSAGE, HEX); <START> assertTrue(kp.getVerifyKey().verify(SIGN_MESSAGE, signature, HEX)); <END> }</code><technical_language>adding abstraction, ugly getter</technical_language>

Target:
public void testRoundTrip() { SigningKeyPair kp = new SigningKeyPair(SIGN_KEY_SEED, HEX); String signature = kp.getSigningKey().sign(SIGN_MESSAGE, HEX); assertTrue(kp.getVerifyKey().verify(SIGN_MESSAGE, signature, HEX)); }
Source:
<code>private ASTNode transformJavaBackendSpecificTerm(Term term) { <START> return new org.kframework.kil.BackendTerm(Sort.of(term.sort().name()), term.toString()); <END> }</code><technical_language>org.kframework.kil.Sort#toBackend org.kframework.backend.java.kil.Sort#toFrontend</technical_language>

Target:
private ASTNode transformJavaBackendSpecificTerm(Term term) { return new org.kframework.kil.BackendTerm(term.sort().toFrontEnd(), term.toString()); }
Source:
<code>private void uploadPartitionOverride(Map<String, Map<String, String>> partitionOverrideInfos) { Properties storeProps = new Properties(); <START> storeProps.setProperty("helix.property.store.root.path", "/" + this.clusterName); <END> HelixPropertyStoreConfig propertyStoreConfig = new HelixPropertyStoreConfig(new VerifiableProperties(storeProps)); info("Setting partition override for all datacenters."); for (Map.Entry<String, ClusterMapUtils.DcZkInfo> entry : dataCenterToZkAddress.entrySet()) { HelixPropertyStore<ZNRecord> helixPropertyStore = ClusterMapUtils.createHelixPropertyStore(entry.getValue().getZkConnectStr(), propertyStoreConfig, null); ZNRecord znRecord = new ZNRecord(ZNRECORD_NAME); znRecord.setMapFields(partitionOverrideInfos); String path = "/" + this.clusterName + PROPERTYSTORE_PATH + "/" + ZNRECORD_NAME; if (!helixPropertyStore.set(path, znRecord, AccessOption.PERSISTENT)) { info("Failed to upload partition override for datacenter {}", entry.getKey()); } } }</code><technical_language>minor: this required</technical_language>

Target:
private void uploadPartitionOverride(Map<String, Map<String, String>> partitionOverrideInfos) { Properties storeProps = new Properties(); storeProps.setProperty("helix.property.store.root.path", "/" + clusterName); HelixPropertyStoreConfig propertyStoreConfig = new HelixPropertyStoreConfig(new VerifiableProperties(storeProps)); info("Setting partition override for all datacenters."); for (Map.Entry<String, ClusterMapUtils.DcZkInfo> entry : dataCenterToZkAddress.entrySet()) { HelixPropertyStore<ZNRecord> helixPropertyStore = CommonUtils.createHelixPropertyStore(entry.getValue().getZkConnectStr(), propertyStoreConfig, null); ZNRecord znRecord = new ZNRecord(ClusterMapUtils.ZNODE_NAME); znRecord.setMapFields(partitionOverrideInfos); String path = ClusterMapUtils.PROPERTYSTORE_ZNODE_PATH; if (!helixPropertyStore.set(path, znRecord, AccessOption.PERSISTENT)) { info("Failed to upload partition override for datacenter {}", entry.getKey()); } } }
Source:
<code><START> public void setWhitelistedValuesExpression(String expression){ <END> this.validateWhitelistedValuesExpression(expression); this.whitelistingValueExpression = expression; }</code><technical_language>Please getter setter closer</technical_language>

Target:
public void setWhitelistedValuesExpression(String expression){ this.whitelistingValueExpression = expression; getConfig().setProperty(SCAN_VALUE_WHITELISTING_EXPRESSION, this.whitelistingValueExpression); whitelistingValueFilter = new ScannerParamValueFilterRule(this.whitelistingValueExpression); }
Source:
<code><START> public ContentRetrieverContext(String contentRetrieverClassName, int connectionTimeout, int readTimeout, int maxPageContentLength, int numberOfEmittedFiles, int numberOfPartitionsForCrawling) throws InstantiationException, IllegalAccessException, IllegalArgumentException, InvocationTargetException, NoSuchMethodException, SecurityException, ClassNotFoundException { <END> @SuppressWarnings("unchecked") Class<ContentRetriever> clazz = (Class<ContentRetriever>) Class.forName(contentRetrieverClassName); this.contentRetriever = clazz.getConstructor().newInstance(); this.connectionTimeout = connectionTimeout; this.readTimeout = readTimeout; this.maxPageContentLength = maxPageContentLength; this.numberOfEmittedFiles = numberOfEmittedFiles; this.numberOfPartitionsForCrawling = numberOfPartitionsForCrawling; }</code><technical_language>throws Exception instead of 7 exceptions in throws</technical_language>

Target:
public ContentRetrieverContext(String contentRetrieverClassName, int connectionTimeout, int readTimeout, int maxPageContentLength, int numberOfEmittedFiles, int numberOfPartitionsForCrawling) throws Exception { @SuppressWarnings("unchecked") Class<ContentRetriever> clazz = (Class<ContentRetriever>) Class.forName(contentRetrieverClassName); this.contentRetriever = clazz.getConstructor().newInstance(); this.connectionTimeout = connectionTimeout; this.readTimeout = readTimeout; this.maxPageContentLength = maxPageContentLength; this.numberOfEmittedFiles = numberOfEmittedFiles; this.numberOfPartitionsForCrawling = numberOfPartitionsForCrawling; }
Source:
<code>public long getLong() throws CTFReaderException { <START> return getLong(BIT_LONG, true); END> }</code><technical_language>signedness matter for 64-bits</technical_language>

Target:
public long getLong() throws CTFReaderException { return get(BIT_LONG, true); }
Source:
<code>public void toolAsWorkflow() { File cwlFile = new File(ResourceHelpers.resourceFilePath("dir6.cwl")); File cwlJSON = new File(ResourceHelpers.resourceFilePath("dir6.cwl.json")); ArrayList<String> args = new ArrayList<String>() {{ add("workflow"); add("launch"); add("--local-entry"); add(cwlFile.getAbsolutePath()); add("--json"); add(cwlJSON.getAbsolutePath()); }}; exit.expectSystemExit(); runClientCommand(args, false); <START> assertTrue("Out should suggest to run as tool instead", systemOutRule.getLog().contains("Expected a workflow but the")); <END> }</code><technical_language>FYI, @k-cao discovered assertTrue in this work, "checkAssertionAfterwards" instead <LINK_0></technical_language>

Target:
public void toolAsWorkflow() { File cwlFile = new File(ResourceHelpers.resourceFilePath("dir6.cwl")); File cwlJSON = new File(ResourceHelpers.resourceFilePath("dir6.cwl.json")); ArrayList<String> args = new ArrayList<String>() {{ add("workflow"); add("launch"); add("--local-entry"); add(cwlFile.getAbsolutePath()); add("--json"); add(cwlJSON.getAbsolutePath()); }}; exit.expectSystemExit(); exit.checkAssertionAfterwards( () -> assertTrue("Out should suggest to run as workflow instead", systemErrRule.getLog().contains("Expected a workflow but the"))); runClientCommand(args, false); }
Source:
<code>public void onApplicationEvent(ApplicationPreparedEvent event) { if (this.decryptor == null) { return; } ConfigurableApplicationContext applicationContext = event <START> .getApplicationContext(); <END> if (!applicationContext.containsBean(DECRYPTOR_BEAN_NAME)) { applicationContext.getBeanFactory().registerSingleton (DECRYPTOR_BEAN_NAME, decryptor); } ConfigurableEnvironment environment = applicationContext.getEnvironment(); MutablePropertySources propertySources = environment.getPropertySources(); Map<String, Object> map = decrypt(propertySources); if (!map.isEmpty()) { insert(propertySources, new MapPropertySource(DECRYPTED_PROPERTY_SOURCE_NAME, map)); } }</code><technical_language>Needs ApplicationContextAware check event is for this bean's context</technical_language>

Target:
public void onApplicationEvent(ApplicationPreparedEvent event) { if (this.decryptor == null) { return; } ConfigurableApplicationContext applicationContext = event .getApplicationContext(); if (!applicationContext.equals(this.applicationContext)){ return; } if (!applicationContext.containsBean(DECRYPTOR_BEAN_NAME)) { applicationContext.getBeanFactory().registerSingleton (DECRYPTOR_BEAN_NAME, decryptor); } ConfigurableEnvironment environment = applicationContext.getEnvironment(); MutablePropertySources propertySources = environment.getPropertySources(); Map<String, Object> map = decrypt(propertySources); if (!map.isEmpty()) { insert(propertySources, new MapPropertySource(DECRYPTED_PROPERTY_SOURCE_NAME, map)); } }
Source:
<code>protected void migrateRealm(RealmModel realm) { for (ClientModel client : realm.getClients()) { MigrationUtils.updateProtocolMappers(client); } <START> for (ClientScopeModel clientTemplate : realm.getClientScopes()) { <END> MigrationUtils.updateProtocolMappers(clientTemplate); } }</code><technical_language>clientScope</technical_language>

Target:
protected void migrateRealm(RealmModel realm) { for (ClientModel client : realm.getClients()) { MigrationUtils.updateProtocolMappers(client); } for (ClientScopeModel clientScope : realm.getClientScopes()) { MigrationUtils.updateProtocolMappers(clientScope); } }
Source:
<code>public int hashCode() { int result = _domainUuid != null ? _domainUuid.hashCode() : 0; result = 31 * result + (_domainName != null ? _domainName.hashCode() : 0); result = 31 * result + (_domainPath != null ? _domainPath.hashCode() : 0); result = 31 * result + (_toAdd ? 1 : 0); result = 31 * result + (_toRemove ? 1 : 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 + (_domainUuid != null ? _domainUuid.hashCode() : 0); result = 31 * result + (_domainName != null ? _domainName.hashCode() : 0); result = 31 * result + (_domainPath != null ? _domainPath.hashCode() : 0); result = 31 * result + (_toAdd ? 1 : 0); result = 31 * result + (_toRemove ? 1 : 0); return result; }
Source:
<code>default MergeFunction andThen(final MergeFunction that) { <START> MergeFunction self = this; <END> return new MergeFunction() { @Override public <C extends ValueContainer<?>> C merge(C original, C replacement) { return that.merge(self.merge(original, replacement), replacement); } }; }</code><technical_language>why? I declare final for a reason</technical_language>

Target:
default MergeFunction andThen(final MergeFunction that) { final MergeFunction self = this; return new MergeFunction() { @Override public <C extends ValueContainer<?>> C merge(C original, C replacement) { return that.merge(self.merge(original, replacement), replacement); } }; }
Source:
<code>static void initIronSourceSDK(Activity activity, String appKey, IronSource.AD_UNIT adUnit) { if (!isIronSourceInitialized(adUnit)) { IronSource.setMediationType(MEDIATION_NAME); IronSource.initISDemandOnly(activity, appKey, adUnit); mInitialized.add(adUnit); <START> } else { <END> Log.d(IronSourceAdapterUtils.TAG, adUnit.toString() + " has already been initialized."); } }</code><technical_language>Flip if/else statement positive case is first</technical_language>

Target:
static void initIronSourceSDK(Activity activity, String appKey, IronSource.AD_UNIT adUnit) { if (isIronSourceInitialized(adUnit)) { Log.d(IronSourceAdapterUtils.TAG, adUnit.toString() + " has already been initialized."); } else { IronSource.setMediationType(MEDIATION_NAME); IronSource.initISDemandOnly(activity, appKey, adUnit); mInitialized.add(adUnit); } }
Source:
<code><START> public void addUserToGroup() throws NotFoundException, org.jtalks.common.service.exceptions.NotFoundException { <END> JCUser jcUser = createUserWithGroups(4l, 5l, 6l); Group group = new Group(); when(userService.get(anyLong())).thenReturn(jcUser); when(groupService.get(anyLong())).thenReturn(group); JsonResponse jsonResponse = userController.addUserToGroup(1l, 2l); assertThat(jsonResponse.getStatus(), is(JsonResponseStatus.SUCCESS)); assertThat(group.getUsers().contains(jcUser), is(true)); assertThat(jcUser.getGroups().contains(group), is(true)); }</code><technical_language>simply put throws Exception</technical_language>

Target:
public void addUserToGroup() throws Exception { long userID = 1l; long groupID = 2l; Component component = createDefaultComponent(); when(componentService.getComponentOfForum()).thenReturn(component); userController.addUserToGroup(userID, groupID); verify(userService).addUserToGroup(component.getId(), userID, groupID); }
Source:
<code>private void resolveReference(IJSONSchemaProperty node) { String reference = node.getReference(); if (reference != null) { String ref = <START> reference.substring("#/definitions/".length()); <END> IJSONSchemaProperty property = definitions.get(ref); if (property != null) { for (IJSONSchemaProperty p:property.getProperties().values()) { node.addProperty(p); } } Collection<IJSONSchemaProperty> props = property.getProperties().values(); for (IJSONSchemaProperty p:props) { resolveReference(p); } } Collection<IJSONSchemaProperty> props = node.getProperties().values(); for (IJSONSchemaProperty p:props) { resolveReference(p); } List<String> references = node.getReferences(); for (String ref:references) { String r = ref.substring("#/definitions/".length()); IJSONSchemaProperty property = definitions.get(r); if (property != null) { for (IJSONSchemaProperty p:property.getProperties().values()) { node.addProperty(p); } } } }</code><technical_language>extract a constant</technical_language>

Target:
private void resolveReference(IJSONSchemaProperty node) { String reference = node.getReference(); if (reference != null) { String ref = reference.substring(DEFINITIONS.length()); IJSONSchemaProperty property = definitions.get(ref); if (property != null) { for (IJSONSchemaProperty p : property.getProperties().values()) { node.addProperty(p); } Collection<IJSONSchemaProperty> props = property.getProperties().values(); for (IJSONSchemaProperty p : props) { resolveReference(p); } } } Collection<IJSONSchemaProperty> props = node.getProperties().values(); for (IJSONSchemaProperty p:props) { resolveReference(p); } List<String> references = node.getReferences(); for (String ref:references) { String r = ref.substring(DEFINITIONS.length()); IJSONSchemaProperty property = definitions.get(r); if (property != null) { for (IJSONSchemaProperty p:property.getProperties().values()) { node.addProperty(p); } } } }
Source:
<code>public void openingAFormToEdit_andChangingAValue_andClickingSaveAndExit_andRotating_remainsOnPrompt() { new MainMenuPage(rule) .startBlankForm("Track Changes Reason") .inputText("Nothing much...") .swipeToNextQuestion() .clickSaveAndExit() .clickEditSavedForm() .clickOnForm("Track Changes Reason") .clickGoToStart() .inputText("Nothing much!") .swipeToNextQuestion() .clickSaveAndExitWithChangesReasonPrompt() .enterReason("Something") .rotateToLandscape(new ChangesReasonPromptPage("Track Changes Reason", rule)) .assertText("Something") <START> .rotateToPortrait(new ChangesReasonPromptPage("Track Changes Reason", rule)) <END> .clickSave(); }</code><technical_language>I this closeSoftkeyboard() instead checking full "rotated" flow</technical_language>

Target:
public void openingAFormToEdit_andChangingAValue_andClickingSaveAndExit_andRotating_remainsOnPrompt() { new MainMenuPage(rule) .startBlankForm("Track Changes Reason") .inputText("Nothing much...") .swipeToNextQuestion() .clickSaveAndExit() .clickEditSavedForm() .clickOnForm("Track Changes Reason") .clickGoToStart() .inputText("Nothing much!") .swipeToNextQuestion() .clickSaveAndExitWithChangesReasonPrompt() .enterReason("Something") .rotateToLandscape(new ChangesReasonPromptPage("Track Changes Reason", rule)) .assertText("Something") .closeSoftKeyboard() .clickSave(); }
Source:
<code>public void testVmMigrationSubscription() { EventSubscriber subscriber = mock(EventSubscriber.class); when(subscriber.getSubscriptionId()).thenReturn("*|*|VM_migration_status|*"); SubscriptionHolder holder = new SubscriptionHolder(subscriber, new AtomicInteger()); EventSubscriber subscriber2 = mock(EventSubscriber.class); <START> when(subscriber2.getSubscriptionId()).thenReturn("*|*|VM_status|*"); <END> SubscriptionHolder holder2 = new SubscriptionHolder(subscriber2, new AtomicInteger()); SubscriptionMatcher matcher = new SubscriptionMatcher(); matcher.add(holder); matcher.add(holder2); JsonRpcEvent event = mock(JsonRpcEvent.class); when(event.getMethod()).thenReturn("10.35.18.138|virt|VM_status|d4b04c1d-c2bc-41e3-add7-bcad2ab782d4"); JsonRpcEvent event2 = mock(JsonRpcEvent.class); when(event2.getMethod()).thenReturn("10.35.0.96|virt|VM_migration_status|d4b04c1d-c2bc-41e3-add7-bcad2ab782d4"); Set<SubscriptionHolder> holders = matcher.match(event); assertEquals(1, holders.size()); Set<SubscriptionHolder> holders2 = matcher.match(event2); assertEquals(1, holders2.size()); }</code><technical_language>I doubt change identical post-copy migration scenario, this changed to: 10.35.18.138|*|VM_status|*</technical_language>

Target:
public void testVmMigrationSubscription() { EventSubscriber subscriber = mock(EventSubscriber.class); when(subscriber.getSubscriptionId()).thenReturn("*|*|VM_migration_status|*"); SubscriptionHolder holder = new SubscriptionHolder(subscriber, new AtomicInteger()); EventSubscriber subscriber2 = mock(EventSubscriber.class); when(subscriber2.getSubscriptionId()).thenReturn("10.35.18.138|*|VM_status|*"); SubscriptionHolder holder2 = new SubscriptionHolder(subscriber2, new AtomicInteger()); SubscriptionMatcher matcher = new SubscriptionMatcher(); matcher.add(holder); matcher.add(holder2); JsonRpcEvent event = mock(JsonRpcEvent.class); when(event.getMethod()).thenReturn("10.35.18.138|virt|VM_status|d4b04c1d-c2bc-41e3-add7-bcad2ab782d4"); JsonRpcEvent event2 = mock(JsonRpcEvent.class); when(event2.getMethod()).thenReturn("10.35.0.96|virt|VM_migration_status|d4b04c1d-c2bc-41e3-add7-bcad2ab782d4"); Set<SubscriptionHolder> holders = matcher.match(event); assertEquals(1, holders.size()); Set<SubscriptionHolder> holders2 = matcher.match(event2); assertEquals(1, holders2.size()); }
Source:
<code>public List<Scope> getAllSharedScopes(String tenantDomain) throws APIManagementException { if (log.isDebugEnabled()) { log.debug("Retrieving all the shared scopes for tenant: " + tenantDomain); } List<Scope> allSharedScopes = ApiMgtDAO.getInstance().getAllSharedScopes(tenantDomain); List<Scope> allScopes = scopesDAO.getScopes(APIUtil.getTenantIdFromTenantDomain(tenantDomain)); for (Scope scope : allSharedScopes) { for (Scope tempScope : allScopes) { if (scope.getKey().equals(tempScope.getKey())) { <START> scope.setDescription(tempScope.getDescription()); <END> scope.setRoles(tempScope.getRoles()); break; } } } return allSharedScopes; }</code><technical_language>shouldnt set name (display name)</technical_language>

Target:
public List<Scope> getAllSharedScopes(String tenantDomain) throws APIManagementException { if (log.isDebugEnabled()) { log.debug("Retrieving all the shared scopes for tenant: " + tenantDomain); } List<Scope> allSharedScopes = ApiMgtDAO.getInstance().getAllSharedScopes(tenantDomain); List<Scope> allScopes = scopesDAO.getScopes(APIUtil.getTenantIdFromTenantDomain(tenantDomain)); for (Scope scope : allSharedScopes) { for (Scope tempScope : allScopes) { if (scope.getKey().equals(tempScope.getKey())) { scope.setName(tempScope.getName()); scope.setDescription(tempScope.getDescription()); scope.setRoles(tempScope.getRoles()); break; } } } return allSharedScopes; }
Source:
<code>public static void main(String[] args) throws Exception { for (Handler h : logger.getHandlers()) { logger.removeHandler(h); } for (Handler h : LoggerJMX.getHandlers()) { LoggerJMX.removeHandler(h); } for (Handler h : Logger.getLogger("").getHandlers()) { Logger.getLogger("").removeHandler(h); } SimpleFormatter fmt = new DumbFormatter(); StreamHandler sh = new StreamHandler(System.out, fmt); Set<String> argss = new HashSet<String>(args.length); argss.addAll(Arrays.asList(args)); <START> if (argss.contains("--time_jmx_call")) { <END> LoggerJMX.setLevel(Level.ALL); LoggerJMX.addHandler(sh); argss.remove("--time_jmx_call"); args = argss.toArray(new String[argss.size()]); } else { logger.addHandler(sh); } List<ObjectName> objectNames = new ArrayList<ObjectName>(1); objectNames.add(null); if (args.length >= 3) { new JmxScraper(args[0], args[1], args[2], false, objectNames, new LinkedList<ObjectName>(), new JMXLogWriter()).doScrape(); } else if (args.length > 0) { new JmxScraper(args[0], "", "", false, objectNames, new LinkedList<ObjectName>(), new JMXLogWriter()).doScrape(); } else { new JmxScraper("", "", "", false, objectNames, new LinkedList<ObjectName>(), new JMXLogWriter()).doScrape(); } }</code><technical_language>hardcode on, this is a debug/development method</technical_language>

Target:
public static void main(String[] args) throws Exception { List<ObjectName> objectNames = new LinkedList<ObjectName>(); objectNames.add(null); if (args.length >= 3){ new JmxScraper(args[0], args[1], args[2], false, objectNames, new LinkedList<ObjectName>(), new StdoutWriter()).doScrape(); } else if (args.length > 0){ new JmxScraper(args[0], "", "", false, objectNames, new LinkedList<ObjectName>(), new StdoutWriter()).doScrape(); } else { new JmxScraper("", "", "", false, objectNames, new LinkedList<ObjectName>(), new StdoutWriter()).doScrape(); } }
Source:
<code>public void initialize(Context context) { context.registerSyntaxNodeConsumer(Tree.Kind.SET_LITERAL, ctx -> { SetLiteral setLiteral = (SetLiteral) ctx.syntaxNode(); Set<Integer> issueIndexes = new HashSet<>(); <START> if (setLiteral.elements().size() > 100) { <END> return; } for (int i = 0; i < setLiteral.elements().size(); i++) { if (issueIndexes.contains(i)) { continue; } Expression key = setLiteral.elements().get(i); List<Tree> duplicateKeys = findIdenticalKeys(i, setLiteral.elements(), issueIndexes); if (!duplicateKeys.isEmpty()) { PreciseIssue issue = ctx.addIssue(key, "Change or remove duplicates of this key."); duplicateKeys.forEach(d -> issue.secondary(d, "Duplicate key")); } } }); }</code><technical_language>_minor_ I add this a constant a name indicative of introduced</technical_language>

Target:
public void initialize(Context context) { context.registerSyntaxNodeConsumer(Tree.Kind.SET_LITERAL, ctx -> { SetLiteral setLiteral = (SetLiteral) ctx.syntaxNode(); Set<Integer> issueIndexes = new HashSet<>(); if (setLiteral.elements().size() > SIZE_THRESHOLD) { return; } for (int i = 0; i < setLiteral.elements().size(); i++) { if (issueIndexes.contains(i)) { continue; } Expression key = setLiteral.elements().get(i); List<Tree> duplicateKeys = findIdenticalKeys(i, setLiteral.elements(), issueIndexes); if (!duplicateKeys.isEmpty()) { PreciseIssue issue = ctx.addIssue(key, "Change or remove duplicates of this key."); duplicateKeys.forEach(d -> issue.secondary(d, "Duplicate key")); } } }); }
Source:
<code>private static void performWarmup() { connectionStartupExecutor.execute(new Runnable() { @Override public void run() { <START> if (isAlpnConfigured()) { <END> try { createSslContext(); } catch (SSLException e) { LOG.warn("Could not asynchronously create the ssl context", e); } } } }); connectionStartupExecutor.execute(new Runnable() { @Override public void run() { try { CredentialFactory.getHttpTransport(); } catch (IOException | GeneralSecurityException e) { LOG.warn("Could not asynchronously initialze httpTransport", e); } } }); for (final String host : Arrays.asList(BigtableOptions.BIGTABLE_DATA_HOST_DEFAULT, BigtableOptions.BIGTABLE_CLUSTER_ADMIN_HOST_DEFAULT, BigtableOptions.BIGTABLE_CLUSTER_ADMIN_HOST_DEFAULT)) { connectionStartupExecutor.execute(new Runnable() { @Override public void run() { try { InetAddress.getByName(host); } catch (UnknownHostException e) { LOG.warn("Could not asynchronously initialze host: " + host, e); } } }); } connectionStartupExecutor.shutdown(); }</code><technical_language>happened here? For OpenSsl, do warmup</technical_language>

Target:
private static void performWarmup() { connectionStartupExecutor.execute(new Runnable() { @Override public void run() { if (isAlpnProviderEnabled()) { try { createSslContext(); } catch (SSLException e) { LOG.warn("Could not asynchronously create the ssl context", e); } } } }); connectionStartupExecutor.execute(new Runnable() { @Override public void run() { try { CredentialFactory.getHttpTransport(); } catch (IOException | GeneralSecurityException e) { LOG.warn("Could not asynchronously initialze httpTransport", e); } } }); for (final String host : Arrays.asList(BigtableOptions.BIGTABLE_DATA_HOST_DEFAULT, BigtableOptions.BIGTABLE_CLUSTER_ADMIN_HOST_DEFAULT, BigtableOptions.BIGTABLE_CLUSTER_ADMIN_HOST_DEFAULT)) { connectionStartupExecutor.execute(new Runnable() { @Override public void run() { try { InetAddress.getByName(host); } catch (UnknownHostException e) { LOG.warn("Could not asynchronously initialze host: " + host, e); } } }); } connectionStartupExecutor.shutdown(); }
Source:
<code>public Map<Errors, Integer> errorCounts() { Map<Errors, Integer> errorCounts = new HashMap<>(); <START> for (DescribedGroup describedGroup : data.groups()) { <END> updateErrorCounts(errorCounts, Errors.forCode(describedGroup.errorCode())); } return errorCounts; }</code><technical_language>previous approach is more concise clear</technical_language>

Target:
public Map<Errors, Integer> errorCounts() { Map<Errors, Integer> errorCounts = new HashMap<>(); data.groups().forEach(describedGroup -> { updateErrorCounts(errorCounts, Errors.forCode(describedGroup.errorCode())); }); return errorCounts; }
Source:
<code>public void testGet() { VdsNetworkInterface result = dao.get(existingVdsInterface.getId()); <START> assertEquals(existingVdsInterface, result); <END> }</code><technical_language>This test checks "get" "get" I redundant check this way, test another method get expected entity (say getAll pick there)</technical_language>

Target:
public void testGet() { newVdsInterface.setVdsId(VDS_ID); dao.saveInterfaceForVds(newVdsInterface); dao.saveStatisticsForVds(newVdsInterface.getStatistics()); VdsNetworkInterface result = dao.get(newVdsInterface.getId()); assertEquals(newVdsInterface, result); }
Source:
<code>protected BufferedDataTable[] execute(BufferedDataTable[] inData, ExecutionContext exec) throws Exception { final AtomicBoolean encounteredExceptions = new AtomicBoolean(false); int imgIdx = getPathColIdx(inData[0].getDataTableSpec()); ReadImgTableFunction<T> rifp = createImgTableFunction(exec, inData[0].getDataTableSpec(), Long.valueOf(inData[0].size()).intValue()); BufferedDataContainer bdc = exec.createDataContainer(getOutspec(inData[0].getDataTableSpec(), imgIdx)); Iterator<DataRow> iterator = inData[0].iterator(); while (iterator.hasNext()) { rifp.apply(iterator.next()).forEachOrdered(dataRow -> { if (dataRow.getSecond().isPresent()) { encounteredExceptions.set(true); <START> LOGGER.warn("Encountered exception while reading image " + dataRow.getFirst().getKey() <END> + "! Caught Exception: " + dataRow.getSecond().get()); } bdc.addRowToTable(dataRow.getFirst()); }); exec.checkCanceled(); } rifp.close(); bdc.close(); m_data = bdc.getTable(); if (encounteredExceptions.get()) { setWarningMessage("Encountered errors during execution!"); } return new BufferedDataTable[] { bdc.getTable() }; }</code><technical_language>set debug purpose. want get spammed warnings. log if want more information</technical_language>

Target:
protected BufferedDataTable[] execute(BufferedDataTable[] inData, ExecutionContext exec) throws Exception { final AtomicBoolean encounteredExceptions = new AtomicBoolean(false); int imgIdx = getPathColIdx(inData[0].getDataTableSpec()); ReadImgTableFunction<T> rifp = createImgTableFunction(exec, inData[0].getDataTableSpec(), Long.valueOf(inData[0].size()).intValue()); BufferedDataContainer bdc = exec.createDataContainer(getOutspec(inData[0].getDataTableSpec(), imgIdx)); Iterator<DataRow> iterator = inData[0].iterator(); while (iterator.hasNext()) { rifp.apply(iterator.next()).forEachOrdered(dataRow -> { if (dataRow.getSecond().isPresent()) { encounteredExceptions.set(true); LOGGER.warn("Encountered exception while reading image: " + dataRow.getFirst().getKey() + "! view log for more info."); LOGGER.debug("Encountered exception while reading image:", dataRow.getSecond().get()); } bdc.addRowToTable(dataRow.getFirst()); }); exec.checkCanceled(); } rifp.close(); bdc.close(); m_data = bdc.getTable(); if (encounteredExceptions.get()) { setWarningMessage("Encountered errors during execution!"); } return new BufferedDataTable[] { bdc.getTable() }; }
Source:
<code>public int andCardinality(final BitmapContainer value2) { int newCardinality = 0; for (int k = 0; k < this.bitmap.length; ++k) { newCardinality += Long.bitCount(this.bitmap[k] & value2.bitmap[k]); } <START> if (newCardinality > ArrayContainer.DEFAULT_MAX_SIZE) { <END> final BitmapContainer answer = new BitmapContainer(); for (int k = 0; k < answer.bitmap.length; ++k) { answer.bitmap[k] = this.bitmap[k] & value2.bitmap[k]; } return newCardinality; } else { return newCardinality; } }</code><technical_language>I return newCardinality here</technical_language>

Target:
public int andCardinality(final BitmapContainer value2) { int newCardinality = 0; for (int k = 0; k < this.bitmap.length; ++k) { newCardinality += Long.bitCount(this.bitmap[k] & value2.bitmap[k]); } return newCardinality; }
Source:
<code>public synchronized BigtableClusterName getClusterName() throws IOException { <START> if (options.getClusterName() == null) { <END> try (BigtableClusterUtilities util = BigtableClusterUtilities.forInstance(options.getProjectId(), options.getInstanceId())) { final ListClustersResponse clusters = util.getClusters(); Preconditions.checkState(clusters.getClustersCount() == 0, "Project '%s' / Instance '%s' has %d clusters. There must be exactly 1 for this operation to work.", options.getProjectId(), options.getInstanceId(), clusters.getClustersCount()); String clusterName = util.getSingleCluster().getName(); String clusterId = BigtableClusterName.parse(clusterName).getClusterId(); options = options.toBuilder().setClusterId(clusterId).build(); } catch (GeneralSecurityException e) { throw new IOException("Could not get cluster Id.", e); } } return options.getClusterName(); }</code><technical_language>This is a public method; give example used? I thought need done in constructor is: if (instance ID provided) { cluster ID = get single cluster ID instance ID. check cluster ID is input cluster ID if provided, set cluster ID in options. } else { instance ID = get single instance ID cluster ID. set instance ID in options. }</technical_language>

Target:
public synchronized BigtableClusterName getClusterName() throws IOException { if (this.clusterName == null) { try (BigtableClusterUtilities util = BigtableClusterUtilities.forInstance(options.getProjectId(), options.getInstanceId())) { ListClustersResponse clusters = util.getClusters(); Preconditions.checkState(clusters.getClustersCount() == 1, String.format( "Project '%s' / Instance '%s' has %d clusters. There must be exactly 1 for this operation to work.", options.getProjectId(), options.getInstanceId(), clusters.getClustersCount())); clusterName = new BigtableClusterName(clusters.getClusters(0).getName()); } catch (GeneralSecurityException e) { throw new IOException("Could not get cluster Id.", e); } } return clusterName; }
Source:
<code>public Map<String, List<String>> getRoutingData() throws InvalidRoutingDataException { Map<String, List<String>> result = new HashMap<>(); if (!_zkClient.exists(ROUTING_DATA_PATH)) { throw new InvalidRoutingDataException("Routing data directory node " + ROUTING_DATA_PATH + " does not exist. Routing ZooKeeper address: " + _zkAddress); <START> } <END> List<String> children = _zkClient.getChildren(ROUTING_DATA_PATH); if (children.isEmpty()) { throw new InvalidRoutingDataException("Routing data directory node " + ROUTING_DATA_PATH + " does not have any child node. Routing ZooKeeper address: " + _zkAddress); } for (String child : children) { ZNRecord record = _zkClient.readData(ROUTING_DATA_PATH + "/" + child); List<String> shardingKeys = record.getListField(ZNRECORD_LIST_FIELD_KEY); if (shardingKeys == null || shardingKeys.isEmpty()) { throw new InvalidRoutingDataException("Realm address node " + ROUTING_DATA_PATH + "/" + child + " does not have a value for key " + ZNRECORD_LIST_FIELD_KEY + ". Routing ZooKeeper address: " + _zkAddress); } result.put(child, shardingKeys); } return result; }</code><technical_language>exits check this path add more unnecessary read request ZK. getChildren give ZkNoNodeException if path exit. catch ZkNoNodeException save READ request ZK</technical_language>

Target:
public Map<String, List<String>> getRoutingData() throws InvalidRoutingDataException { Map<String, List<String>> routingData = new HashMap<>(); List<String> children; try { children = _zkClient.getChildren(ROUTING_DATA_PATH); } catch (ZkNoNodeException e) { throw new InvalidRoutingDataException("Routing data directory ZNode " + ROUTING_DATA_PATH + " does not exist. Routing ZooKeeper address: " + _zkAddress); } if (children == null || children.isEmpty()) { throw new InvalidRoutingDataException( "There are no metadata store realms defined. Routing ZooKeeper address: " + _zkAddress); } for (String child : children) { ZNRecord record = _zkClient.readData(ROUTING_DATA_PATH + "/" + child); List<String> shardingKeys = record.getListField(ZNRECORD_LIST_FIELD_KEY); if (shardingKeys == null || shardingKeys.isEmpty()) { throw new InvalidRoutingDataException("Realm address ZNode " + ROUTING_DATA_PATH + "/" + child + " does not have a value for key " + ZNRECORD_LIST_FIELD_KEY + ". Routing ZooKeeper address: " + _zkAddress); } routingData.put(child, shardingKeys); } return routingData; }
Source:
<code>public static boolean shouldVoteFor( MemberId candidate, long contextTerm, long requestTerm, long contextLastLogTerm, long requestLastLogTerm, long contextLastAppended, long requestLastLogIndex, MemberId votedFor, Log log ) { if ( requestTerm < contextTerm ) { <START> log.debug( "Will note vote for %s as vote request term %s was earlier than my term %s", candidate, requestTerm, contextTerm ); <END> return false; } boolean requestLogEndsAtHigherTerm = requestLastLogTerm > contextLastLogTerm; boolean logsEndAtSameTerm = requestLastLogTerm == contextLastLogTerm; boolean requestLogAtLeastAsLongAsMyLog = requestLastLogIndex >= contextLastAppended; boolean requesterLogUpToDate = requestLogEndsAtHigherTerm || (logsEndAtSameTerm && requestLogAtLeastAsLongAsMyLog); boolean votedForOtherInSameTerm = requestTerm == contextTerm && votedFor != null && !votedFor.equals( candidate ); boolean shouldVoteFor = requesterLogUpToDate && !votedForOtherInSameTerm; log.debug( "Should vote for raft candidate %s: " + "requester log up to date: %s (request last log term: %s, context last log term: %s, request last log index: %s, context last append: %s) " + "voted for other in same term: %s (request term: %s, context term: %s, votedFor: %s)", shouldVoteFor, requesterLogUpToDate, requestLastLogTerm, contextLastLogTerm, requestLastLogIndex, contextLastAppended, votedForOtherInSameTerm, requestTerm, contextTerm, votedFor ); return shouldVoteFor; }</code><technical_language>note -></technical_language>

Target:
public static boolean shouldVoteFor( MemberId candidate, long contextTerm, long requestTerm, long contextLastLogTerm, long requestLastLogTerm, long contextLastAppended, long requestLastLogIndex, MemberId votedFor, Log log ) { if ( requestTerm < contextTerm ) { log.debug( "Will not vote for %s as vote request term %s was earlier than my term %s", candidate, requestTerm, contextTerm ); return false; } boolean requestLogEndsAtHigherTerm = requestLastLogTerm > contextLastLogTerm; boolean logsEndAtSameTerm = requestLastLogTerm == contextLastLogTerm; boolean requestLogAtLeastAsLongAsMyLog = requestLastLogIndex >= contextLastAppended; boolean requesterLogUpToDate = requestLogEndsAtHigherTerm || (logsEndAtSameTerm && requestLogAtLeastAsLongAsMyLog); boolean votedForOtherInSameTerm = requestTerm == contextTerm && votedFor != null && !votedFor.equals( candidate ); boolean shouldVoteFor = requesterLogUpToDate && !votedForOtherInSameTerm; log.debug( "Should vote for raft candidate %s: " + "requester log up to date: %s (request last log term: %s, context last log term: %s, request last log index: %s, context last append: %s) " + "voted for other in same term: %s (request term: %s, context term: %s, votedFor: %s)", shouldVoteFor, requesterLogUpToDate, requestLastLogTerm, contextLastLogTerm, requestLastLogIndex, contextLastAppended, votedForOtherInSameTerm, requestTerm, contextTerm, votedFor ); return shouldVoteFor; }
Source:
<code>private void addQueryParams(final Request request) { if (to != null) { request.addQueryParam("To", to.toString()); } if (from != null) { request.addQueryParam("From", from.toString()); } if (parentCallSid != null) { request.addQueryParam("ParentCallSid", parentCallSid); } if (status != null) { request.addQueryParam("Status", status.toString()); } if (startTime != null || endTime != null) { <START> request.addQueryDateTimeRange("Range", startTime, endTime); <END> } if (getPageSize() != null) { request.addQueryParam("PageSize", Integer.toString(getPageSize())); } }</code><technical_language>"Range" is correct. is this coming from</technical_language>

Target:
private void addQueryParams(final Request request) { if (to != null) { request.addQueryParam("To", to.toString()); } if (from != null) { request.addQueryParam("From", from.toString()); } if (parentCallSid != null) { request.addQueryParam("ParentCallSid", parentCallSid); } if (status != null) { request.addQueryParam("Status", status.toString()); } if (startTime != null) { request.addQueryParam("StartTime", startTime.format(DateTimeFormatter.ofPattern(Request.QUERY_STRING_DATE_TIME_FORMAT))); } else if (startTimeAfter != null || startTimeBefore != null) { request.addQueryDateTimeRange("StartTime", startTimeAfter, startTimeBefore); } if (endTime != null) { request.addQueryParam("EndTime", endTime.format(DateTimeFormatter.ofPattern(Request.QUERY_STRING_DATE_TIME_FORMAT))); } else if (endTimeAfter != null || endTimeBefore != null) { request.addQueryDateTimeRange("EndTime", endTimeAfter, endTimeBefore); } if (getPageSize() != null) { request.addQueryParam("PageSize", Integer.toString(getPageSize())); } }
Source:
<code>public AlgoAllDiffACFast(IntVar[] variables, ICause cause) { this.vars = variables; aCause = cause; n = vars.length; matching = new int[n]; <START> for (int i = 0; i < n; i++) { <END> matching[i] = -1; } map = new TIntIntHashMap(); IntVar v; int ub; int idx = n; for (int i = 0; i < n; i++) { v = vars[i]; ub = v.getUB(); for (int j = v.getLB(); j <= ub; j = v.nextValue(j)) { if (!map.containsKey(j)) { map.put(j, idx); idx++; } } } n2 = idx; digraph = new DirectedGraph(n2, SetType.BITSET, false); free = new BitSet(n2); distinction = new BitSet(n2); SCCfinder = new StrongConnectivityFinder(digraph); father = new int[n2]; fifo = new int[n2]; in = new BitSet(n2); }</code><technical_language>Arrays.fill(matching, -1);</technical_language>

Target:
public AlgoAllDiffACFast(IntVar[] variables, ICause cause) { this.vars = variables; aCause = cause; n = vars.length; matching = new int[n]; Arrays.fill(matching, -1); map = new TIntIntHashMap(); IntVar v; int ub; int idx = n; for (int i = 0; i < n; i++) { v = vars[i]; ub = v.getUB(); for (int j = v.getLB(); j <= ub; j = v.nextValue(j)) { if (!map.containsKey(j)) { map.put(j, idx); idx++; } } } n2 = idx; digraph = new DirectedGraph(n2, SetType.BITSET, false); free = new BitSet(n2); distinction = new BitSet(n2); SCCfinder = new StrongConnectivityFinder(digraph); father = new int[n2]; fifo = new int[n2]; in = new BitSet(n2); }
Source:
<code>private boolean checkForAuthorization(HttpServletRequest request) { <START> M_log.debug("checkLdapForAuthorization(): called"); <END> String remoteUser = request.getRemoteUser(); String testUser = request.getParameter(TEST_USER); String ltiTestUser = request.getParameter(CANVAS_ID); boolean isAuthorized = false; String user=null; String testUserInSession = (String)request.getSession().getAttribute(TEST_USER); String sessionId = request.getSession().getId(); if( isTestUrlEnabled && ltiTestUser != null ) { user=ltiTestUser; request.getSession().setAttribute(TEST_USER, ltiTestUser); } else if ( isTestUrlEnabled && testUserInSession != null ){ user=testUserInSession; } if ( isTestUrlEnabled && testUser != null ) { user=testUser; request.getSession().setAttribute(TEST_USER, testUser); } else if ( isTestUrlEnabled && testUserInSession != null ){ user=testUserInSession; } if ( !isAuthorized && remoteUser != null ) { user=remoteUser; M_log.info(String.format("The session id \"%s\" of Service Desk Person with uniqname \"%s\" issuing the request" ,sessionId,remoteUser)); } isAuthorized=ldapAuthorizationVerification(user); return isAuthorized; }</code><technical_language>Fix unneeded space</technical_language>

Target:
private boolean checkForAuthorization(HttpServletRequest request) { M_log.debug("checkLdapForAuthorization(): called"); String remoteUser = request.getRemoteUser(); String testUser = request.getParameter(TEST_USER); boolean isAuthorized = false; String user=null; String testUserInSession = (String)request.getSession().getAttribute(TEST_USER); String sessionId = request.getSession().getId(); if ( isTestUrlEnabled && testUser != null ) { user=testUser; request.getSession().setAttribute(TEST_USER, testUser); } else if ( isTestUrlEnabled && testUserInSession != null ){ user=testUserInSession; } if ( !isAuthorized && remoteUser != null ) { user=remoteUser; M_log.info(String.format("The session id \"%s\" of Service Desk Person with uniqname \"%s\" issuing the request" ,sessionId,remoteUser)); } isAuthorized=ldapAuthorizationVerification(user); return isAuthorized; }
Source:
<code>private FactorComparator(String factorName, int weight, Comparator<T> comparator){ this.factorName = factorName; this.weight = weight; this.comparator = comparator; <START> logger.info("comparator created for " + this.factorName); <END> }</code><technical_language>is this necessary</technical_language>

Target:
private FactorComparator(String factorName, int weight, Comparator<T> comparator){ this.factorName = factorName; this.weight = weight; this.comparator = comparator; }
Source:
<code>private void send(String message){ <START> ReactorClient client = JsonRpcServer.getReactorClient(); <END> try { client.sendMessage(message.getBytes()); log.debug("sending events message {}", message); }catch (ClientConnectionException e) { log.error("Failure in sending response", e); } }</code><technical_language>if client is null</technical_language>

Target:
private void send(String message){ ReactorClient client = JsonRpcServer.getReactorClient(); if (client == null){ log.error("cannot initialize client, null pointer"); return; } try { client.sendMessage(message.getBytes()); log.debug("sending events message {}", message); }catch (ClientConnectionException e) { log.error("Failure in sending response", e); } }
Source:
<code>public Builder addMessageSource(String messageSourceId, StreamableMessageSource<TrackedEventMessage<?>> messageSource) { <START> BuilderUtils.assertThat(messageSourceId, sourceName -> !messageSourceMap.containsKey(sourceName), <END> "the messageSource name must be unique"); messageSourceMap.put(messageSourceId, messageSource); return this; }</code><technical_language>Consistency-Nit: I do static imports for _any_ usage of BuilderUtils in other classes</technical_language>

Target:
public Builder addMessageSource(String messageSourceId, StreamableMessageSource<TrackedEventMessage<?>> messageSource) { assertThat(messageSourceId, sourceName -> !messageSourceMap.containsKey(sourceName), "the messageSource name must be unique"); messageSourceMap.put(messageSourceId, messageSource); return this; }
Source:
<code><START> public static void waitForStaleTransactions() throws Exception { <END> SpliceWatcher methodWatcher = new SpliceWatcher(null); boolean failOnError = false; waitForStaleTransactions(methodWatcher, "Test", 5, failOnError); methodWatcher.closeAll(); }</code><technical_language>This adds 5 seconds class, 311 25 more minutes of runtime. disable this default enable if VacuumIT is failing debug</technical_language>

Target:
public static void waitForStaleTransactions() { SpliceWatcher methodWatcher = new SpliceWatcher(null); boolean failOnError = false; waitForStaleTransactions(methodWatcher, "Test", 5, failOnError); methodWatcher.closeAll(); }
Source:
<code>private void hideLevelButton() { <START> levelButtonsShowing = false; <END> AlphaAnimation animation = new AlphaAnimation(1.0f, 0.0f); animation.setDuration(500); levelButtons.startAnimation(animation); levelButtons.setVisibility(View.GONE); }</code><technical_language>This boolean state actual visibility of levelButtons right? this a bit redundant</technical_language>

Target:
private void hideLevelButton() { AlphaAnimation animation = new AlphaAnimation(1.0f, 0.0f); animation.setDuration(500); levelButtons.startAnimation(animation); levelButtons.setVisibility(View.GONE); }
Source:
<code>public HttpPanelSyntaxHighlightTextArea() { ((RSyntaxDocument) getDocument()).setTokenMakerFactory(getTokenMakerFactory()); setSyntaxEditingStyle(SyntaxConstants.SYNTAX_STYLE_NONE); syntaxStyles = new Vector<>(); addSyntaxStyle(PLAIN_SYNTAX_LABEL, SyntaxConstants.SYNTAX_STYLE_NONE); if (syntaxMenu == null) { initActions(); } setPopupMenu(null); this.message = null; setHyperlinksEnabled(false); setAntiAliasingEnabled(true); setLineWrap(true); setHighlightCurrentLine(false); setFadeCurrentLineHighlight(false); setWhitespaceVisible(false); setEOLMarkersVisible(false); setMarkOccurrences(false); setBracketMatchingEnabled(false); setAnimateBracketMatching(false); setAutoIndentEnabled(false); setCloseCurlyBraces(false); setCloseMarkupTags(false); setClearWhitespaceLinesEnabled(false); this.setFont( FontUtils.getFontWithFallback(FontType.workPanels, this.getFont().getFontName())); if (DisplayUtils.isDarkLookAndFeel()) { try { Theme theme = Theme.load( getClass() .getResourceAsStream( "/org/fife/ui/rsyntaxtextarea/themes/dark.xml")); theme.apply(this); <START> } catch (IOException e) { <END> log.error("Failed to set RSyntaxTextArea dark theme", e); } } initHighlighter(); }</code><technical_language>Agreed, if (DisplayUtils.isDarkLookAndFeel()) try block, attempt apply read</technical_language>

Target:
public HttpPanelSyntaxHighlightTextArea() { ((RSyntaxDocument) getDocument()).setTokenMakerFactory(getTokenMakerFactory()); setSyntaxEditingStyle(SyntaxConstants.SYNTAX_STYLE_NONE); syntaxStyles = new Vector<>(); addSyntaxStyle(PLAIN_SYNTAX_LABEL, SyntaxConstants.SYNTAX_STYLE_NONE); if (syntaxMenu == null) { initActions(); } setPopupMenu(null); this.message = null; setHyperlinksEnabled(false); setAntiAliasingEnabled(true); setLineWrap(true); setHighlightCurrentLine(false); setFadeCurrentLineHighlight(false); setWhitespaceVisible(false); setEOLMarkersVisible(false); setMarkOccurrences(false); setBracketMatchingEnabled(false); setAnimateBracketMatching(false); setAutoIndentEnabled(false); setCloseCurlyBraces(false); setCloseMarkupTags(false); setClearWhitespaceLinesEnabled(false); this.setFont( FontUtils.getFontWithFallback(FontType.workPanels, this.getFont().getFontName())); if (DisplayUtils.isDarkLookAndFeel()) { try { Theme theme = Theme.load( HttpPanelSyntaxHighlightTextArea.class.getResourceAsStream( "/org/fife/ui/rsyntaxtextarea/themes/dark.xml")); theme.apply(this); } catch (IOException e) { log.error("Failed to set RSyntaxTextArea dark theme", e); } } initHighlighter(); }