auphong2707/dl4se-code-review-dataset huggingface dataset:
Source:
<code>public void recognizeLinkedEntitiesBatchMaxOverload() { List<TextDocumentInput> textDocumentInputs = Arrays.asList( <START> new TextDocumentInput("1", "Old Faithful is a geyser at Yellowstone Park."), <END> new TextDocumentInput("2", "Mount Shasta has lenticular clouds.") ); textAnalyticsClient.recognizeLinkedEntitiesBatch(textDocumentInputs, new TextAnalyticsRequestOptions().setIncludeStatistics(true), Context.NONE).iterableByPage().forEach( response -> { TextDocumentBatchStatistics batchStatistics = response.getStatistics(); System.out.printf( "A batch of documents statistics, transaction count: %s, valid document count: %s.%n", batchStatistics.getTransactionCount(), batchStatistics.getValidDocumentCount()); response.getElements().forEach(recognizeLinkedEntitiesResult -> recognizeLinkedEntitiesResult.getEntities().forEach(linkedEntity -> { System.out.println("Linked Entities:"); System.out.printf("Name: %s, entity ID in data source: %s, URL: %s, data source: %s.%n", linkedEntity.getName(), linkedEntity.getDataSourceEntityId(), linkedEntity.getUrl(), linkedEntity.getDataSource()); linkedEntity.getMatches().forEach(entityMatch -> System.out.printf( "Matched entity: %s, confidence score: %.2f.%n", entityMatch.getText(), entityMatch.getConfidenceScore())); })); }); END: com.azure.ai.textanalytics.TextAnalyticsClient.recognizeLinkedEntitiesBatch#Iterable-TextAnalyticsRequestOptions-Context }</code><technical_language>consider adding a setLanguage</technical_language>

Target:
public void recognizeLinkedEntitiesBatchMaxOverload() { List<TextDocumentInput> textDocumentInputs = Arrays.asList( new TextDocumentInput("1", "Old Faithful is a geyser at Yellowstone Park.").setLanguage("en"), new TextDocumentInput("2", "Mount Shasta has lenticular clouds.").setLanguage("en") ); textAnalyticsClient.recognizeLinkedEntitiesBatch(textDocumentInputs, new TextAnalyticsRequestOptions().setIncludeStatistics(true), Context.NONE).iterableByPage().forEach( response -> { TextDocumentBatchStatistics batchStatistics = response.getStatistics(); System.out.printf( "A batch of documents statistics, transaction count: %s, valid document count: %s.%n", batchStatistics.getTransactionCount(), batchStatistics.getValidDocumentCount()); response.getElements().forEach(recognizeLinkedEntitiesResult -> recognizeLinkedEntitiesResult.getEntities().forEach(linkedEntity -> { System.out.println("Linked Entities:"); System.out.printf("Name: %s, entity ID in data source: %s, URL: %s, data source: %s.%n", linkedEntity.getName(), linkedEntity.getDataSourceEntityId(), linkedEntity.getUrl(), linkedEntity.getDataSource()); linkedEntity.getMatches().forEach(entityMatch -> System.out.printf( "Matched entity: %s, confidence score: %.2f.%n", entityMatch.getText(), entityMatch.getConfidenceScore())); })); }); END: com.azure.ai.textanalytics.TextAnalyticsClient.recognizeLinkedEntitiesBatch#Iterable-TextAnalyticsRequestOptions-Context }
Source:
<code>public void testReloadwithRedirect() throws Exception { CliProcessWrapper cliProc = new CliProcessWrapper() .addCliArgument("--connect") .addCliArgument("--controller=" + TestSuiteEnvironment.getServerAddress() + ":" + TestSuiteEnvironment.getServerPort()); try { cliProc.executeInteractive(); cliProc.clearOutput(); boolean promptFound = cliProc. pushLineAndWaitForResults("/core-service=management/" + "security-realm=ManagementRealm/" + "server-identity=ssl:add(keystore-path=management.keystore," + "keystore-relative-to=jboss.server.config.dir," + "keystore-password=password,alias=server,key-password=password," + "generate-self-signed-certificate-host=localhost)", null); assertTrue("Invalid prompt" + cliProc.getOutput(), promptFound); cliProc.clearOutput(); promptFound = cliProc.pushLineAndWaitForResults("/core-service=management/" + "management-interface=http-interface:" + "write-attribute(name=secure-socket-binding,value=management-https)", null); assertTrue("Invalid prompt" + cliProc.getOutput(), promptFound); cliProc.clearOutput(); promptFound = cliProc.pushLineAndWaitForResults("reload", "Accept certificate"); assertTrue("No certificate prompt " + cliProc.getOutput(), promptFound); } finally { cliProc.ctrlCAndWaitForClose(); <START> cliProc.destroyProcess(); <END> } }</code><technical_language>@pkremens , need call destroyProcess CtrlC sent. ctrlCAndWaitForClose() enough</technical_language>

Target:
public void testReloadwithRedirect() throws Exception { CliProcessWrapper cliProc = new CliProcessWrapper() .addCliArgument("--connect") .addCliArgument("--controller=" + TestSuiteEnvironment.getServerAddress() + ":" + TestSuiteEnvironment.getServerPort()); try { cliProc.executeInteractive(); cliProc.clearOutput(); boolean promptFound = cliProc. pushLineAndWaitForResults("/core-service=management/" + "security-realm=ManagementRealm/" + "server-identity=ssl:add(keystore-path=management.keystore," + "keystore-relative-to=jboss.server.config.dir," + "keystore-password=password,alias=server,key-password=password," + "generate-self-signed-certificate-host=localhost)", null); assertTrue("Invalid prompt" + cliProc.getOutput(), promptFound); cliProc.clearOutput(); promptFound = cliProc.pushLineAndWaitForResults("/core-service=management/" + "management-interface=http-interface:" + "write-attribute(name=secure-socket-binding,value=management-https)", null); assertTrue("Invalid prompt" + cliProc.getOutput(), promptFound); cliProc.clearOutput(); promptFound = cliProc.pushLineAndWaitForResults("reload", "Accept certificate"); assertTrue("No certificate prompt " + cliProc.getOutput(), promptFound); } finally { cliProc.ctrlCAndWaitForClose(); } }
Source:
<code>public void test_restlet_base64_encoding_without_newlines_should_be_equal_jdk_base64_encoding() { String source = "Man is distinguished, not only by his reason, but by this singular passion from " + "other animals, which is a lust of the mind, that by a perseverance of delight " + "in the continued and indefatigable generation of knowledge, exceeds the short " + <START> "vehemence of any carnal pleasure."; <END> String expected = "TWFuIGlzIGRpc3Rpbmd1aXNoZWQsIG5vdCBvbmx5IGJ5IGhpcyByZWFzb24sIGJ1dCBieSB0aGlz" + "IHNpbmd1bGFyIHBhc3Npb24gZnJvbSBvdGhlciBhbmltYWxzLCB3aGljaCBpcyBhIGx1c3Qgb2Yg" + "dGhlIG1pbmQsIHRoYXQgYnkgYSBwZXJzZXZlcmFuY2Ugb2YgZGVsaWdodCBpbiB0aGUgY29udGlu" + "dWVkIGFuZCBpbmRlZmF0aWdhYmxlIGdlbmVyYXRpb24gb2Yga25vd2xlZGdlLCBleGNlZWRzIHRo" + "ZSBzaG9ydCB2ZWhlbWVuY2Ugb2YgYW55IGNhcm5hbCBwbGVhc3VyZS4="; assertEquals(expected, Base64.encode(source.getBytes(), false)); assertEquals(expected, java.util.Base64.getEncoder().encodeToString(source.getBytes())); }</code><technical_language>Extract a variable ? multiple times</technical_language>

Target:
public void test_restlet_base64_encoding_without_newlines_should_be_equal_jdk_base64_encoding() { assertEquals(REFERENCE_TEXT_ENCODED, Base64.encode(REFERENCE_TEXT_AS_BYTES_ARRAY, false)); assertEquals(REFERENCE_TEXT_ENCODED, java.util.Base64.getEncoder().encodeToString(REFERENCE_TEXT_AS_BYTES_ARRAY)); }
Source:
<code>public void prepareDatabaseForTestRun() { cleanRepoAbstractEntity(this.oslpDeviceRepo); cleanRepoAbstractEntity(this.deviceAuthorizationRepo); cleanRepoSerializable(this.smartMeterRepo); cleanRepoSerializable(this.deviceRepo); cleanRepoSerializable(this.deviceModelRepo); cleanRepoSerializable(this.manufacturerRepo); for (final Organisation org : this.organizationRepo.findAll()) { if (!org.getOrganisationIdentification().equals("test-org") <START> && !org.getOrganisationIdentification().equals("Inforstroom") <END> && !org.getOrganisationIdentification().equals("FlexOvlProject") && !org.getOrganisationIdentification().equals("GemeenteArnhem") && !org.getOrganisationIdentification().equals("LianderNetManagement")) { this.organizationRepo.delete(org); } } this.insertDefaultData(); }</code><technical_language>Inforstroom Infostroom I guess</technical_language>

Target:
public void prepareDatabaseForTestRun() { cleanRepoAbstractEntity(this.oslpDeviceRepo); cleanRepoAbstractEntity(this.deviceAuthorizationRepo); cleanRepoSerializable(this.smartMeterRepo); cleanRepoSerializable(this.deviceRepo); cleanRepoSerializable(this.deviceModelRepo); cleanRepoSerializable(this.manufacturerRepo); for (final Organisation org : this.organizationRepo.findAll()) { if (!org.getOrganisationIdentification().equals("test-org") && !org.getOrganisationIdentification().equals("Infostroom") && !org.getOrganisationIdentification().equals("FlexOvlProject") && !org.getOrganisationIdentification().equals("GemeenteArnhem") && !org.getOrganisationIdentification().equals("LianderNetManagement")) { this.organizationRepo.delete(org); } } this.insertDefaultData(); }
Source:
<code>public long getSizeInBytes() { long sizeInBytes = 0; <START> int partitionCount = partitionFunction.getPartitionCount(); <END> for (int i = 0; i < partitionCount; i++) { sizeInBytes += partitionData[i].getSizeInBytes(); } return sizeInBytes; }</code><technical_language>partitionData.length for consistency getRetainedSizeInBytes public long getSizeInBytes() { long sizeInBytes = 0; for (int i = 0; i < partitionData.length; i++) { sizeInBytes += partitionData[i].getSizeInBytes(); } return sizeInBytes; }</technical_language>

Target:
public long getSizeInBytes() { long sizeInBytes = 0; for (int i = 0; i < partitionData.length; i++) { sizeInBytes += partitionData[i].getSizeInBytes(); } return sizeInBytes; }
Source:
<code>private void downloadPatient(Patient patient) { ToastUtil.showShortToast(mContext, ToastUtil.ToastType.NOTICE, R.string.download_started); new PatientDAO().savePatient(patient).subscribe(); <START> new VisitApi().syncVisitsData(patient); <END> new VisitApi().syncLastVitals(patient.getUuid()); ToastUtil.success("Patient with UUID " + patient.getUuid() + " is now available locally"); }</code><technical_language>I this done saving patient</technical_language>

Target:
private void downloadPatient(Patient patient) { ToastUtil.showShortToast(mContext, ToastUtil.ToastType.NOTICE, R.string.download_started); new PatientDAO().savePatient(patient) .observeOn(AndroidSchedulers.mainThread()) .subscribe(id -> { new VisitApi().syncVisitsData(patient); new VisitApi().syncLastVitals(patient.getUuid()); ToastUtil.success("Patient with UUID " + patient.getUuid() + " is now available locally"); }); }
Source:
<code>public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) { final View layout = inflater.inflate(R.layout.fragment_settings, container, false); wifiSwitch = (Switch) layout.findViewById(R.id.wifi_setting); sdCardSwitch = (Switch) layout.findViewById(R.id.download_location_switch); sdCardSettinglayout = (LinearLayout) layout.findViewById(R.id.sd_card_setting_layout); <START> if (Build.VERSION.SDK_INT == Build.VERSION_CODES.KITKAT) { <END> sdCardSettinglayout.setVisibility(View.GONE); } if (!EventBus.getDefault().isRegistered(this)) EventBus.getDefault().registerSticky(this); updateWifiSwitch(); updateSDCardSwitch(); final LinearLayout settingsLayout = (LinearLayout) layout.findViewById(R.id.settings_layout); for (SettingsExtension extension : extensionRegistry.forType(SettingsExtension.class)) { extension.onCreateSettingsView(settingsLayout); } return layout; }</code><technical_language>For safe side if (Build.VERSION.SDK_INT <= Build.VERSION_CODES.KITKAT)</technical_language>

Target:
public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) { final View layout = inflater.inflate(R.layout.fragment_settings, container, false); wifiSwitch = (Switch) layout.findViewById(R.id.wifi_setting); sdCardSwitch = (Switch) layout.findViewById(R.id.download_location_switch); sdCardSettingsLayout = (LinearLayout) layout.findViewById(R.id.sd_card_setting_layout); updateWifiSwitch(); updateSDCardSwitch(); final LinearLayout settingsLayout = (LinearLayout) layout.findViewById(R.id.settings_layout); for (SettingsExtension extension : extensionRegistry.forType(SettingsExtension.class)) { extension.onCreateSettingsView(settingsLayout); } return layout; }
Source:
<code>public ZKHelixAdmin(String zkAddress) { int timeOutInSec = Integer.parseInt(System.getProperty(CONNECTION_TIMEOUT, "30")); RealmAwareZkClient.RealmAwareZkClientConfig clientConfig = new RealmAwareZkClient.RealmAwareZkClientConfig() .setConnectInitTimeout(timeOutInSec * 1000L) .setZkSerializer(new ZNRecordSerializer()); RealmAwareZkClient zkClient; try { zkClient = new FederatedZkClient(clientConfig); } catch (IllegalStateException e) { LOG.warn("Current namespace is not registered to realm-aware ZK." + " Fallback to HelixZkClient for ZK: {}", zkAddress); zkClient = SharedZkClientFactory.getInstance() .buildZkClient(new HelixZkClient.ZkConnectionConfig(zkAddress), <START> clientConfig.createHelixZkClientConfig()); <END> zkClient.waitUntilConnected(timeOutInSec, TimeUnit.SECONDS); } _zkClient = zkClient; _configAccessor = new ConfigAccessor(_zkClient); _usesExternalZkClient = false; }</code><technical_language>I realized I forgot add this logic for ConfigAccessor. open another PR :)</technical_language>

Target:
public ZKHelixAdmin(String zkAddress) { int timeOutInSec = Integer.parseInt(System.getProperty(CONNECTION_TIMEOUT, "30")); RealmAwareZkClient.RealmAwareZkClientConfig clientConfig = new RealmAwareZkClient.RealmAwareZkClientConfig() .setConnectInitTimeout(timeOutInSec * 1000L) .setZkSerializer(new ZNRecordSerializer()); RealmAwareZkClient zkClient; if (Boolean.getBoolean(SystemPropertyKeys.MULTI_ZK_ENABLED)) { try { zkClient = new FederatedZkClient( new RealmAwareZkClient.RealmAwareZkConnectionConfig.Builder().build(), clientConfig); } catch (IllegalStateException | IOException | InvalidRoutingDataException e) { throw new HelixException("Not able to connect on multi-realm mode.", e); } } else { zkClient = SharedZkClientFactory.getInstance() .buildZkClient(new HelixZkClient.ZkConnectionConfig(zkAddress), clientConfig.createHelixZkClientConfig()); zkClient.waitUntilConnected(timeOutInSec, TimeUnit.SECONDS); } _zkClient = zkClient; _configAccessor = new ConfigAccessor(_zkClient); _usesExternalZkClient = false; }
Source:
<code>public void updateRepositoryConfiguration(TaskRepository taskRepository, IProgressMonitor monitor) throws CoreException { <START> monitorMap.put(new RepositoryKey(taskRepository), monitor != null <END> ? OperationUtil.convert(monitor) : new NullOperationMonitor()); configurationCache.refresh(new RepositoryKey(taskRepository)); monitorMap.remove(new RepositoryKey(taskRepository)); }</code><technical_language>replace monitorMap a ThreadLocal</technical_language>

Target:
public void updateRepositoryConfiguration(TaskRepository taskRepository, IProgressMonitor monitor) throws CoreException { context.set(monitor != null ? OperationUtil.convert(monitor) : new NullOperationMonitor()); configurationCache.refresh(new RepositoryKey(taskRepository)); context.remove(); }
Source:
<code>public void close() { <START> closed = true; <END> }</code><technical_language>shutdown executor</technical_language>

Target:
public void close() { closed = true; sessionDeleter.shutdown(); }
Source:
<code>static Date tryParseISO8601Date(String dateString) { if (isEmpty(dateString)) { return null; } try { <START> SimpleDateFormat format = new SimpleDateFormat("yyyy:MM:dd:HH:mm:ss:X", US); <END> return format.parse(dateString); } catch (ParseException e) { try { SimpleDateFormat format = new SimpleDateFormat("yyyy:MM:dd:HH:mm:ss", US); return format.parse(dateString); } catch (ParseException e1) { e1.printStackTrace(); throw new RuntimeException(e); } } }</code><technical_language>"X" work jdk6 jcodec targets</technical_language>

Target:
static Date tryParseISO8601Date(String dateString) { if (isEmpty(dateString)) { return null; } String noTZ = "yyyy:MM:dd:HH:mm:ss"; if (dateString.length() == noTZ.length()) { return date(dateString, noTZ); } else if (dateString.length() == noTZ.length() + 4) { dateString = dateString + "00"; } return date(dateString, "yyyy:MM:dd:HH:mm:ss:Z"); }
Source:
<code>public void performSearch() { BasePanel currentBasePanel = frame.getCurrentBasePanel(); if (currentBasePanel == null) { return; } if (searchField.getText().isEmpty()) { clearSearch(); return; } SearchQuery searchQuery = getSearchQuery(); if (!searchQuery.isValid()) { informUserAboutInvalidSearchQuery(); return; } Globals.stateManager.setSearchQuery(searchQuery); <START> updateResults(Globals.stateManager.searchResultSizeProperty().get(), <END> SearchDescribers.getSearchDescriberFor(searchQuery).getDescription(), searchQuery.isGrammarBasedSearch()); Globals.stateManager.fireSearchQueryHighlightEvent(); }</code><technical_language>Is this working desired? I expected resultSize is updated correctly (for large databases)</technical_language>

Target:
public void performSearch() { BasePanel currentBasePanel = frame.getCurrentBasePanel(); if (currentBasePanel == null) { return; } if (searchField.getText().isEmpty()) { clearSearch(); return; } SearchQuery searchQuery = getSearchQuery(); if (!searchQuery.isValid()) { informUserAboutInvalidSearchQuery(); return; } Globals.stateManager.setSearchQuery(searchQuery); }
Source:
<code>public InstrumentedHandler(MetricRegistry registry, Handler underlying) { <START> this(registry, underlying, underlying.getClass().getName()); <END> }</code><technical_language>This name(underlying.getClass())</technical_language>

Target:
public InstrumentedHandler(MetricRegistry registry, Handler underlying) { this(registry, underlying, name(underlying.getClass())); }
Source:
<code><START> public static String getName(Channel channel, Resources res) { <END> switch (channel) { case SYNC: return res.getString(R.string.sync_title); case GLOBAL_REMINDERS: return res.getString(R.string.widget_minimum_cards_due_notification_ticker_title); case DECK_REMINDERS: return res.getString(R.string.deck_conf_reminders); case GENERAL: default: return res.getString(R.string.app_name); } }</code><technical_language>Is a lot of work this private</technical_language>

Target:
private static String getName(Channel channel, Resources res) { switch (channel) { case SYNC: return res.getString(R.string.sync_title); case GLOBAL_REMINDERS: return res.getString(R.string.widget_minimum_cards_due_notification_ticker_title); case DECK_REMINDERS: return res.getString(R.string.deck_conf_reminders); case GENERAL: default: return res.getString(R.string.app_name); } }
Source:
<code>public void createWithCorrectId() throws Exception { MatcherAssert.assertThat( "Hook json returned wrong id", this.hook.json().getInt("id"), new IsEqual<Integer>( <START> Integer.parseInt(this.xml.xpath("id/text()").get(0)) <END> ) ); }</code><technical_language>@llorllale I test real values here; testing if get id correctly json, albeit this implementation works, I real instead for in xml</technical_language>

Target:
public void createWithCorrectId() throws Exception { final int number = 5; final MkStorage storage = new MkStorage.InFile(); final Coordinates coords = new Coordinates.Simple("user/repo"); storage.apply( this.hookDirs(number, coords) ); MatcherAssert.assertThat( "Hook json returned wrong id", new MkHook(storage, "login", coords, number).json().getString("id"), new IsEqual<String>(String.valueOf(number)) ); }
Source:
<code>public List<? extends Module> getJacksonModules() { return ImmutableList.of( <START> new SimpleModule("DruidCaffeineCache-" + System.identityHashCode(this)) <END> .registerSubtypes(CaffeineCacheProvider.class) ); }</code><technical_language>expecting register multiple of these? here</technical_language>

Target:
public List<? extends Module> getJacksonModules() { return ImmutableList.of( new SimpleModule("DruidCaffeineCache") .registerSubtypes(CaffeineCacheProvider.class) ); }
Source:
<code>protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_main); mMapView = findViewById(R.id.mapView); ArcGISMap map = new ArcGISMap(Basemap.createImagery()); mMapView.setMap(map); List<String> wmsLayerNames = Collections.singletonList(getString(R.string.wms_layer_name_minnesota)); mWmsLayer = new WmsLayer(getString(R.string.wms_layer_url_minnesota), wmsLayerNames); mWmsLayer.loadAsync(); mWmsLayer.addDoneLoadingListener(() -> { if (mWmsLayer.getLoadStatus() == LoadStatus.LOADED) { <START> map.getOperationalLayers().add(mWmsLayer); <END> mMapView.setViewpoint(new Viewpoint(mWmsLayer.getFullExtent())); List<String> styles = mWmsLayer.getSublayers().get(0).getSublayerInfo().getStyles(); ToggleButton toggle = findViewById(R.id.toggleStyleButton); toggle.setOnCheckedChangeListener((buttonView, isChecked) -> { if (isChecked) { mWmsLayer.getSublayers().get(0).setCurrentStyle(styles.get(1)); } else { mWmsLayer.getSublayers().get(0).setCurrentStyle(styles.get(0)); END] } }); } else { String error = "Failed to load WMS layer: " + mWmsLayer.getLoadError().getMessage(); Log.e(TAG, error); Toast.makeText(this, error, Toast.LENGTH_LONG).show(); } }); }</code><technical_language>if move this doneLoading listener, in scope</technical_language>

Target:
protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_main); mMapView = findViewById(R.id.mapView); ArcGISMap map = new ArcGISMap(Basemap.createImagery()); mMapView.setMap(map); List<String> wmsLayerNames = Collections.singletonList(getString(R.string.wms_layer_name_minnesota)); WmsLayer wmsLayer = new WmsLayer(getString(R.string.wms_layer_url_minnesota), wmsLayerNames); map.getOperationalLayers().add(wmsLayer); wmsLayer.addDoneLoadingListener(() -> { if (wmsLayer.getLoadStatus() == LoadStatus.LOADED) { mMapView.setViewpoint(new Viewpoint(wmsLayer.getFullExtent())); List<String> styles = wmsLayer.getSublayers().get(0).getSublayerInfo().getStyles(); ToggleButton toggle = findViewById(R.id.toggleStyleButton); toggle.setOnCheckedChangeListener((buttonView, isChecked) -> { if (isChecked) { wmsLayer.getSublayers().get(0).setCurrentStyle(styles.get(1)); } else { wmsLayer.getSublayers().get(0).setCurrentStyle(styles.get(0)); END] } }); } else { String error = "Failed to load WMS layer: " + wmsLayer.getLoadError().getMessage(); Log.e(TAG, error); Toast.makeText(this, error, Toast.LENGTH_LONG).show(); } }); }
Source:
<code>public List<StartIdentifiedAtlasDbTransactionResponse> startIdentifiedAtlasDbTransactionBatch(int count) { List<StartIdentifiedAtlasDbTransactionResponse> responses = executeOnTimeLock( () -> delegate.startIdentifiedAtlasDbTransactionBatch(count)); <START> lockRefresher.registerLocks(responses <END> .stream() .map(response -> response.immutableTimestamp().getLock()) .collect(Collectors.toList())); return responses; }</code><technical_language>relying this throwing. I fine in this refactoring, need track fixing this, other bug</technical_language>

Target:
public List<StartIdentifiedAtlasDbTransactionResponse> startIdentifiedAtlasDbTransactionBatch(int count) { List<StartIdentifiedAtlasDbTransactionResponse> responses = executeOnTimeLock( () -> delegate.startIdentifiedAtlasDbTransactionBatch(count)); Set<LockToken> immutableTsLocks = responses .stream() .map(response -> response.immutableTimestamp().getLock()) .collect(Collectors.toSet()); try { lockRefresher.registerLocks(immutableTsLocks); } catch (Throwable t) { unlock(immutableTsLocks); throw Throwables.throwUncheckedException(t); } return responses; }
Source:
<code>public void handlePost(ActionParameters params) throws ActionException { params.requireAdminUser(); try { Announcement announcement = AnnouncementsParser.parseAnnouncementParams(params); final JSONObject result = new JSONObject(); int saveId = service.saveAnnouncement(announcement); JSONHelper.putValue(result, "id", saveId); AuditLog.user(params.getClientIp(), params.getUser()) .withParam("id", announcement.getId()) .withParam("title", announcement.getTitle()) .withParam("content", announcement.getContent()) .withParam("beginDate", announcement.getBeginDate()) .withParam("endDate", announcement.getEndDate()) .withParam("active", announcement.getActive()); ResponseHelper.writeResponse(params, result); } catch (Exception e) { <START> LOG.error("Error saving announcement", e); <END> throw new ActionException("Cannot save announcement"); } }</code><technical_language>Remove logging throwing a new exception</technical_language>

Target:
public void handlePost(ActionParameters params) throws ActionException { params.requireAdminUser(); try { Announcement announcement = AnnouncementsParser.parseAnnouncementParams(params); final JSONObject result = new JSONObject(); int saveId = service.saveAnnouncement(announcement); JSONHelper.putValue(result, "id", saveId); AuditLog.user(params.getClientIp(), params.getUser()) .withParam("id", announcement.getId()) .withParam("title", announcement.getTitle()) .withParam("content", announcement.getContent()) .withParam("beginDate", announcement.getBeginDate()) .withParam("endDate", announcement.getEndDate()) .withParam("active", announcement.getActive()); ResponseHelper.writeResponse(params, result); } catch (Exception e) { throw new ActionException("Cannot save announcement", e); } }
Source:
<code>public List<String> generate() { <START> final List<DetailAST> matchingAstElements = getMatchingAstElements(rootAst); <END> final List<String> generated = new ArrayList<>(); for (DetailAST ast : matchingAstElements) { String xpathQuery = getXpathQuery(null, ast); if (!isUniqueAst(ast)) { final DetailAST child = findChildWithIdent(ast); if (child != null) { xpathQuery = xpathQuery + "[." + getXpathQuery(ast, child) + "]"; } } generated.add(xpathQuery); } return generated; }</code><technical_language>getMatchingAstElements static. rootAst, lineNumber, columnNumber parameters</technical_language>

Target:
public List<String> generate() { return getMatchingAstElements(rootAst, lineNumber, columnNumber) .stream() .map(XpathQueryGenerator::generateXpathQuery) .collect(Collectors.toList()); }
Source:
<code>public void execute(final Credentials credentials, final Callback loginCallback) { mAuthenticationManager.login(credentials, new IAuthenticationManager.Callback<UserAccount>() { @Override public void onSuccess(UserAccount userAccount) { <START> if (credentials == null && !credentials.isDemoCredentials()) { <END> logoutAndHardcodedLogin(credentials, loginCallback); } else { loginCallback.onLoginSuccess(); } } @Override public void onError(Throwable throwable) { onErrorCallback(loginCallback, throwable); } }); }</code><technical_language>if credentials is null execute throw IllegalArgumentException, validate null onSuccess is necesary</technical_language>

Target:
public void execute(final Credentials credentials, final Callback loginCallback) { if (credentials == null) { onErrorCallback(loginCallback, new IllegalArgumentException("Credentials could not be null")); } else { mAuthenticationManager.login(credentials, new IAuthenticationManager.Callback<UserAccount>() { @Override public void onSuccess(UserAccount userAccount) { if (!credentials.isDemoCredentials()) { logoutAndHardcodedLogin(credentials, loginCallback); } else { loginCallback.onLoginSuccess(); } } @Override public void onError(Throwable throwable) { onErrorCallback(loginCallback, throwable); } }); } }
Source:
<code><START> private void downloading( String fileURL, OutputStream out ) <END> { InputStream in = null; try { URL url = new URL( fileURL ); in = new BufferedInputStream( url.openStream() ); int count; byte[] buffer = new byte[ 4096 ]; while( ( count = in.read( buffer ) ) > 0 ) { out.write( buffer, 0, count ); } } catch( MalformedURLException e ) { throw new IllegalArgumentException( FILE_DOWNLOAD_ERROR, e ); } catch( IOException e ) { throw new BackendlessException( FILE_DOWNLOAD_ERROR, e.getMessage() ); } finally { if( in != null ) { try { in.close(); } catch( IOException e ) { throw new BackendlessException( FILE_DOWNLOAD_ERROR, e.getMessage() ); } } if( out != null ) { try { out.close(); } catch( IOException e ) { throw new BackendlessException( FILE_DOWNLOAD_ERROR, e.getMessage() ); } } } }</code><technical_language>This method implement logic for graceful download interruption. Threads of ThreadPoolService interrupted/stopped CodeRunner timeout</technical_language>

Target:
private void downloading( String fileURL, OutputStream out ) { try( InputStream in = new BufferedInputStream( new URL( fileURL ).openStream() ) ) { int count; byte[] buffer = new byte[ 4096 ]; while( ( count = in.read( buffer ) ) > 0 ) { if( Thread.currentThread().isInterrupted() ) { break; } out.write( buffer, 0, count ); } } catch( IOException e ) { throw new BackendlessException( FILE_DOWNLOAD_ERROR, e.getMessage() ); } }
Source:
<code>private void checkContextValidity(Context context) { K body = context.body(); new VisitK() { int cntHoles = 0; int cntRewrites = 0; public void check(K k) { apply(k); if (cntHoles < 1) { throw KEMException.compilerError("Contexts must have at least one HOLE.", context); } if (cntRewrites > 1) { throw KEMException.compilerError("Cannot compile a context with multiple rewrites.", context); } } @Override public void apply(KVariable k) { if (k.name().equals("HOLE")) { cntHoles++; } super.apply(k); } @Override public void apply(KRewrite k) { cntRewrites++; if (!isHOLE(k.left())) { throw KEMException.compilerError("Only the HOLE can be rewritten in a context definition", context); } super.apply(k); } private boolean isHOLE(K k) { if (k instanceof KApply) { KApply kapp = (KApply) k; <START> return kapp.klabel().name().startsWith("#SemanticCastTo") && <END> kapp.klist().size() == 1 && isHOLEVar(kapp.klist().items().get(0)); } else { return isHOLEVar(k); } } private boolean isHOLEVar(K k) { return k instanceof KVariable && ((KVariable) k).name().equals("HOLE"); } }.check(body); }</code><technical_language>visitor descend semantic cast, necessary consider in a special</technical_language>

Target:
public static void checkContextValidity(Context context) { K body = context.body(); int cntHoles = new FindK() { @Override public scala.collection.Set<K> apply(KVariable k) { if (k.name().equals("HOLE")) { return org.kframework.Collections.Set(k); } else { return super.apply(k); } } }.apply(body).size(); if (cntHoles < 1) { throw KEMException.compilerError("Contexts must have at least one HOLE.", context); } int cntRewrites = new FindK() { @Override public scala.collection.Set<K> apply(KRewrite k) { return this.merge(org.kframework.Collections.Set(k), super.apply(k)); } }.apply(body).size(); if (cntRewrites > 1) { throw KEMException.compilerError("Cannot compile a context with multiple rewrites.", context); } new VisitK() { @Override public void apply(KRewrite k) { if (!isHOLE(k.left())) { throw KEMException.compilerError("Only the HOLE can be rewritten in a context definition", context); } super.apply(k); } private boolean isHOLE(K k) { if (k instanceof KApply) { KApply kapp = (KApply) k; return kapp.klabel().name().startsWith("#SemanticCastTo") && kapp.klist().size() == 1 && isHOLEVar(kapp.klist().items().get(0)); } else { return isHOLEVar(k); } } private boolean isHOLEVar(K k) { return k instanceof KVariable && ((KVariable) k).name().equals("HOLE"); } }.apply(body); }
Source:
<code>private Map<?, ?> getCollectionIssues(Map<?, ?> articleMetadata, final Site site) { Predicate<Map.Entry<String,Map<String, Object>>> collectionsJournalFilter = new Predicate<Map.Entry<String,Map<String, Object>>>() { public boolean apply(Map.Entry<String,Map<String, Object>> entry) { Map<String, String> parentJournal = ((Map<String, String>) entry.getValue().get("parentJournal")); if (parentJournal != null) { String journalKey = parentJournal.get("journalKey"); if (journalKey != null){ Site publishedSite; try { publishedSite = site.getTheme().resolveForeignJournalKey(siteSet, journalKey); return (boolean) publishedSite.getTheme().getConfigMap("journal").get("isCollection"); <START> } catch (Exception e) { <END> return false; } } } return false; } }; Map<String, Map<String, Object>> articleIssues = (Map<String, Map<String, Object>>)articleMetadata.get("issues"); return Maps.filterEntries(articleIssues, collectionsJournalFilter); }</code><technical_language>Narrow this expected exception type(s). (Is for UnmatchedSiteException?) Catching exceptions obscure bugs swallowing stuff NullPointerException ClassCastException. If handling IOException want redeclare it, throw new RuntimeException(e) instead of returning false</technical_language>

Target:
private Map<?, ?> getCollectionIssues(Map<?, ?> articleMetadata, final Site site) { Map<String, Map<String, Object>> articleIssues = (Map<String, Map<String, Object>>)articleMetadata.get("issues"); for (Iterator<Map.Entry<String, Map<String, Object>>> iter = articleIssues.entrySet().iterator(); iter.hasNext();) { Map.Entry<String, Map<String, Object>> entry = iter.next(); Map<String, String> parentJournal = ((Map<String, String>) entry.getValue().get("parentJournal")); if (parentJournal != null) { String journalKey = parentJournal.get("journalKey"); if (journalKey != null){ Site publishedSite; try { publishedSite = site.getTheme().resolveForeignJournalKey(siteSet, journalKey); if ((boolean) publishedSite.getTheme().getConfigMap("journal").get("isCollection")) { continue; }; } catch (UnmatchedSiteException use) { throw new RuntimeException("Could not resolve collections pub site using journalKey: " + journalKey, use); } catch (Exception e) { throw new RuntimeException(e); } } } iter.remove(); } return articleIssues; }
Source:
<code>SqlBatchImpl(String sqlBlock, Object[] userParams, Context context) throws SqlParseException, PlannerFallbackException { List<String> sqlList = SQLLexer.splitStatements(sqlBlock).getCompletelyParsedStmts(); if (sqlList.size() == 0) { throw new RuntimeException("Failed to plan, no SQL statement provided."); } if (userParams != null && userParams.length > 0 && sqlList.size() != 1) { throw new UnsupportedOperationException(ADHOC_ERROR_RESPONSE); } ImmutableList.Builder<SqlTask> taskBuilder = new ImmutableList.Builder<>(); Boolean isDDLBatch = null; for (final String sql : sqlList) { if (! CALCITE_CHECKS.check(sql)) { throw new PlannerFallbackException(); } SqlTask sqlTask = SqlTask.from(sql); if (isDDLBatch == null) { isDDLBatch = sqlTask.isDDL(); <START> } else if (isDDLBatch ^ sqlTask.isDDL()) { END> throw new UnsupportedOperationException("Mixing DDL with DML/DQL queries is unsupported."); } taskBuilder.add(sqlTask); } m_tasks = taskBuilder.build(); if (userParams != null) { m_userParams = ImmutableList.copyOf(userParams); } else { m_userParams = null; } m_isDDLBatch = isDDLBatch; m_context = context; }</code><technical_language>I prefer isDDLBatch != sqlTask.isDDL()</technical_language>

Target:
SqlBatchImpl(String sqlBlock, Object[] userParams, Context context) throws SqlParseException, PlannerFallbackException { List<String> sqlList = SQLLexer.splitStatements(sqlBlock).getCompletelyParsedStmts(); if (sqlList.size() == 0) { throw new RuntimeException("Failed to plan, no SQL statement provided."); } if (userParams != null && userParams.length > 0 && sqlList.size() != 1) { throw new UnsupportedOperationException(ADHOC_ERROR_RESPONSE); } ImmutableList.Builder<SqlTask> taskBuilder = new ImmutableList.Builder<>(); Boolean isDDLBatch = null; for (final String sql : sqlList) { if (! CALCITE_CHECKS.check(sql)) { throw new PlannerFallbackException(); } SqlTask sqlTask = SqlTask.from(sql); if (isDDLBatch == null) { isDDLBatch = sqlTask.isDDL(); } else if (isDDLBatch != sqlTask.isDDL()) { throw new UnsupportedOperationException("Mixing DDL with DML/DQL queries is unsupported."); } taskBuilder.add(sqlTask); } m_tasks = taskBuilder.build(); if (userParams != null) { m_userParams = ImmutableList.copyOf(userParams); } else { m_userParams = null; } m_isDDLBatch = isDDLBatch; m_context = context; }
Source:
<code><START> private List<String> getListOfIsoFiles(File directory, OVirtNodeInfo info) { <END> List<String> isoFileList = new ArrayList<String>(); File[] filterOvirtFiles = filterOvirtFiles(directory, getIsoPattern(info)); for (File file : filterOvirtFiles) { isoFileList.add(file.getName()); } return isoFileList; }</code><technical_language>removed static well</technical_language>

Target:
private static List<String> getListOfIsoFiles(File directory, OVirtNodeInfo info) { List<String> isoFileList = new ArrayList<String>(); File[] filterOvirtFiles = filterOvirtFiles(directory, getIsoPattern(info)); for (File file : filterOvirtFiles) { isoFileList.add(file.getName()); } return isoFileList; }
Source:
<code>private void handleDisconnected() { removeAllChildren(); setTargetNodeState(TargetNodeState.DISCONNECTED); <START> fService = null; <END> }</code><technical_language>fShell.disconnect() is called (even in previous code). leads hanging executor thread in CommandShell</technical_language>

Target:
private void handleDisconnected() { fService = null; setTargetNodeState(TargetNodeState.DISCONNECTED); removeAllChildren(); }
Source:
<code>public static Request handleRequest(final Request req) { LOG.info("Parsing data request!"); DataRequest dataReq; try { dataReq = DataRequest.parseFrom(req.getOtherData()); final Request.Builder resultReq = Request.newBuilder(req); resultReq.clearOtherData(); final DataResult.Builder builder = DataResult.newBuilder(); try { for (ItemRequest itemReq : dataReq.getItemsList()) { if (itemReq.getQuery() == ItemQuery.EXPERIMENT) { if (!itemReq.hasAdvanceQuery()) { builder.addResults(handleSingleExperiment(itemReq)); } else { builder.addResults(getExperimentsForInstructor(itemReq)); } } } } catch (Exception e) { final Message.ProtoException protoEx = ExceptionUtilities.createProtoException(e); LOG.error(LoggingConstants.EXCEPTION_MESSAGE, e); <START> final Request.Builder build = Request.newBuilder(); <END> build.setRequestType(Request.MessageType.ERROR); build.setResponseText(e.getMessage()); build.setSessionInfo(req.getSessionInfo()); build.setOtherData(protoEx.toByteString()); return build.build(); } resultReq.setOtherData(builder.build().toByteString()); resultReq.setRequestType(MessageType.DATA_REQUEST); return resultReq.build(); } catch (InvalidProtocolBufferException e) { LOG.error(LoggingConstants.EXCEPTION_MESSAGE, e); final Message.ProtoException protoEx = ExceptionUtilities.createProtoException(e); final Request.Builder build = Request.newBuilder(); build.setRequestType(Request.MessageType.ERROR); build.setResponseText(e.getMessage()); build.setSessionInfo(req.getSessionInfo()); build.setOtherData(protoEx.toByteString()); return build.build(); } }</code><technical_language>a function this now. please instead</technical_language>

Target:
public static Request handleRequest(final Request req) { LOG.info("Parsing data request!"); DataRequest dataReq; try { dataReq = DataRequest.parseFrom(req.getOtherData()); final Request.Builder resultReq = Request.newBuilder(req); resultReq.clearOtherData(); final DataResult.Builder builder = DataResult.newBuilder(); try { for (ItemRequest itemReq : dataReq.getItemsList()) { if (itemReq.getQuery() == ItemQuery.EXPERIMENT) { if (!itemReq.hasAdvanceQuery()) { builder.addResults(handleSingleExperiment(itemReq)); } else { builder.addResults(getExperimentsForInstructor(itemReq)); } } } } catch (Exception e) { final Message.ProtoException protoEx = ExceptionUtilities.createProtoException(e); LOG.error(LoggingConstants.EXCEPTION_MESSAGE, e); return ExceptionUtilities.createExceptionRequest(protoEx, req); } resultReq.setOtherData(builder.build().toByteString()); resultReq.setRequestType(MessageType.DATA_REQUEST); return resultReq.build(); } catch (InvalidProtocolBufferException e) { LOG.error(LoggingConstants.EXCEPTION_MESSAGE, e); final Message.ProtoException protoEx = ExceptionUtilities.createProtoException(e); return ExceptionUtilities.createExceptionRequest(protoEx, req); } }
Source:
<code>public ByteRange toResolvedByteRange(long totalSize) { switch (getType()) { case LAST_N_BYTES: if (getLastNBytes() <= totalSize) { return new ByteRange(totalSize - getLastNBytes(), totalSize - 1, ByteRangeType.OFFSET_RANGE); } break; case FROM_START_OFFSET: if (getStartOffset() < totalSize) { return new ByteRange(getStartOffset(), totalSize - 1, ByteRangeType.OFFSET_RANGE); } break; case OFFSET_RANGE: if (getEndOffset() < totalSize) { return new ByteRange(getStartOffset(), getEndOffset(), ByteRangeType.OFFSET_RANGE); } break; } <START> return null; <END> }</code><technical_language>this throw exception instead</technical_language>

Target:
public ByteRange toResolvedByteRange(long totalSize) { switch (getType()) { case LAST_N_BYTES: if (getLastNBytes() <= totalSize) { return new ByteRange(totalSize - getLastNBytes(), totalSize - 1, ByteRangeType.OFFSET_RANGE); } break; case FROM_START_OFFSET: if (getStartOffset() < totalSize) { return new ByteRange(getStartOffset(), totalSize - 1, ByteRangeType.OFFSET_RANGE); } break; case OFFSET_RANGE: if (getEndOffset() < totalSize) { return new ByteRange(getStartOffset(), getEndOffset(), ByteRangeType.OFFSET_RANGE); } break; } throw new IllegalArgumentException("ByteRange " + this + " exceeds the total blob size " + totalSize); }
Source:
<code>public void verifyAddAnotherPinType(){ Assert.assertEquals(sizepinTypeTitleInputs+1, pinTypeTitleInputs.size()); Assert.assertEquals(sizeuploadMarker+1, uploadMarker.size()); <START> Assert.assertEquals(sizeparentCatElements+1, parentCatElements.size()); <END> PageObjectLogging.log("verifyAddAnotherPinType","New line and fields was displayed after clicking Add another pin type", true); }</code><technical_language>Please Assertion class</technical_language>

Target:
public void verifyAddAnotherPinType() { Assertion.assertEquals(amountPinTypeTitleInputs + 1, pinTypeTitleInputs.size()); Assertion.assertEquals(amountUploadMarker + 1, uploadMarker.size()); Assertion.assertEquals(amountParentCatElements + 1, parentCatElements.size()); }
Source:
<code>public Vector3f getSize(Vector3f dest) { <START> return dest.set(maxX - minX, maxY - minY, maxZ - minZ); <END> }</code><technical_language>Is this of performance concerns, lengthX etc? suggestion return dest.set(lengthX(), lengthY(), lengthZ());</technical_language>

Target:
public Vector3f getSize(Vector3f dest) { return dest.set(lengthX(), lengthY(), lengthZ()); }
Source:
<code>public void notB(final Sketch skB) { if (empty_ || (skB == null) || skB.isEmpty()) { return; } checkSeedHashes(seedHash_, skB.getSeedHash()); final long thetaLongB = skB.getThetaLong(); thetaLong_ = Math.min(thetaLong_, thetaLongB); final int countB = skB.getRetainedEntries(true); CompactSketch cskB = null; UpdateSketch uskB = null; final long[] hashTableB; if (skB instanceof CompactSketch) { cskB = (CompactSketch) skB; hashTableB = convertToHashTable(cskB.getCache(), countB, thetaLong_, REBUILD_THRESHOLD); } else { uskB = (UpdateSketch) skB; hashTableB = (thetaLong_ < thetaLongB) <START> ? convertToHashTable(uskB.getCache(), countB, thetaLong_, REBUILD_THRESHOLD) <END> : uskB.getCache(); cskB = uskB.compact(); } final long[] tmpHashArrA = new long[curCount_]; final int lgHTBLen = simpleIntLog2(hashTableB.length); int nonMatches = 0; for (int i = 0; i < curCount_; i++) { final long hash = hashArr_[i]; if ((hash != 0) && (hash < thetaLong_)) { final int index = hashSearch(hashTableB, lgHTBLen, hash); if (index == -1) { tmpHashArrA[nonMatches] = hash; nonMatches++; } } } hashArr_ = Arrays.copyOfRange(tmpHashArrA, 0, nonMatches); curCount_ = nonMatches; empty_ = (nonMatches == 0) && (thetaLong_ == Long.MAX_VALUE); }</code><technical_language>convert hash table another hash table? theta check done in existing</technical_language>

Target:
public void notB(final Sketch skB) { if (empty_ || (skB == null) || skB.isEmpty()) { return; } checkSeedHashes(seedHash_, skB.getSeedHash()); thetaLong_ = Math.min(thetaLong_, skB.getThetaLong()); hashArr_ = getResultHashArr(thetaLong_, curCount_, hashArr_, skB); curCount_ = hashArr_.length; empty_ = (curCount_ == 0) && (thetaLong_ == Long.MAX_VALUE); }
Source:
<code><START> public static boolean isLocationServiceEnabled(@NonNull Context context) { <END> if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.KITKAT) { int locationMode = Settings.Secure.LOCATION_MODE_OFF; try { locationMode = Settings.Secure.getInt(context.getContentResolver(), Settings.Secure.LOCATION_MODE); } catch (Settings.SettingNotFoundException e) { L.d("Location service setting not found.", e); } return locationMode != Settings.Secure.LOCATION_MODE_OFF; } else { String locationProviders = Settings.Secure.getString(context.getContentResolver(), Settings.Secure.LOCATION_PROVIDERS_ALLOWED); return !TextUtils.isEmpty(locationProviders); } }</code><technical_language>This a nice improvement. In a future patch, investigate need check airplane mode suppress prompt for devices location services</technical_language>

Target:
public static boolean isLocationServiceEnabled(@NonNull Context context) { if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.KITKAT) { int locationMode = Settings.Secure.LOCATION_MODE_OFF; try { locationMode = Settings.Secure.getInt(context.getContentResolver(), Settings.Secure.LOCATION_MODE); } catch (Settings.SettingNotFoundException e) { L.d("Location service setting not found.", e); } return locationMode != Settings.Secure.LOCATION_MODE_OFF; } String locationProviders = Settings.Secure.getString(context.getContentResolver(), Settings.Secure.LOCATION_PROVIDERS_ALLOWED); return !TextUtils.isEmpty(locationProviders); }
Source:
<code>public void populate(List<CategoryDTO> categories) { Platform.runLater(() -> { try{ <START> String css = ""; <END> for (CategoryDTO category : categories) { css += "." + category.getName().toLowerCase() + "Button{\n"; css += "-fx-background-image: url('" + category.getIcon() + "');\n"; css += "}\n"; } File temp = new File("tempfile.css"); temp.delete(); temp.createNewFile(); BufferedWriter bw = new BufferedWriter(new FileWriter(temp)); bw.write(css); bw.close(); final String shortName = themeManager.getCurrentTheme().getShortName(); final String url = String.format("/org/phoenicis/javafx/themes/%s/main.css", shortName); final URL style = this.getClass().getResource(url); getTabPane().getScene().getStylesheets().clear(); getTabPane().getScene().getStylesheets().addAll(temp.toURI().toString(), style.toExternalForm()); }catch(Exception e){ e.printStackTrace(); } final List<LeftToggleButton> leftButtonList = new ArrayList<>(); ToggleGroup group = new ToggleGroup(); final LeftToggleButton allCategoryButton = new LeftToggleButton("All"); allCategoryButton.setToggleGroup(group); allCategoryButton.setSelected(true); final String allCategoryButtonIcon = String.format("icons/mainwindow/apps/all.png"); allCategoryButton.setStyle("-fx-background-image: url('" + themeManager.getResourceUrl(allCategoryButtonIcon) + "');"); allCategoryButton.setOnMouseClicked(event -> selectAll(categories)); leftButtonList.add(allCategoryButton); for (CategoryDTO category : categories) { if(category.getType() == CategoryDTO.CategoryType.INSTALLERS) { final LeftToggleButton categoryButton = new LeftToggleButton(category.getName()); categoryButton.setToggleGroup(group); final String themeName = new String(category.getName().toLowerCase() + "Button"); categoryButton.getStyleClass().add(themeName); categoryButton.setOnMouseClicked(event -> selectCategory(category)); leftButtonList.add(categoryButton); } } categoryView.setNodes(leftButtonList); selectAll(categories); }); }</code><technical_language>I a StringBuilder StringBuffer</technical_language>

Target:
public void populate(List<CategoryDTO> categories) { Platform.runLater(() -> { setDefaultCategoryIcons(categories); this.categories.setAll(categories); this.filter.clearAll(); this.categoryView.selectAll(); this.showAvailableApps(); }); }