auphong2707/dl4se-code-review-dataset huggingface dataset:
Source:
<code>public boolean process(Set<? extends TypeElement> annotations, RoundEnvironment roundEnv) { List<Element> elements = new LinkedList<Element>(); for (Element element : roundEnv.getElementsAnnotatedWith(AutoValue.class)) { AutoValueExtension.Context context = new LimitedContext(processingEnv, (TypeElement) element); if (extension.applicable(context)) { elements.add(element); } } if (!elements.isEmpty()) { Set<? extends Element> adaptorFactories = roundEnv.getElementsAnnotatedWith(MoshiAdapterFactory.class); if (adaptorFactories.isEmpty()) { error(elements.get(0), "Missing MoshiAdapterFactory class. In order to generate the class, you need to create an abstract class with the @MoshiAdapterFactory annotation that implements JsonAdapter.Factory."); } else { for (Element element : adaptorFactories) { if (!element.getModifiers().contains(ABSTRACT)) { error(element, "Must be abstract!"); } <START> TypeElement type = (TypeElement) element; END> List<? extends TypeMirror> interfaces = type.getInterfaces(); if (interfaces.isEmpty() || !containsJsonAdapterFactoryMirror(interfaces)) { error(element, "Must implement JsonAdapter.Factory!"); } String adapterName = classNameOf(type); String packageName = packageNameOf(type); TypeSpec jsonAdapterFactory = createJsonAdapterFactory(elements, packageName, adapterName); JavaFile file = JavaFile.builder(packageName, jsonAdapterFactory).build(); try { file.writeTo(processingEnv.getFiler()); } catch (IOException e) { processingEnv.getMessager().printMessage(ERROR, "Failed to write TypeAdapterFactory: " + e.getLocalizedMessage()); } } } } return false; }</code><technical_language>typo: Safe _cast_</technical_language>

Target:
public boolean process(Set<? extends TypeElement> annotations, RoundEnvironment roundEnv) { List<Element> elements = new LinkedList<Element>(); for (Element element : roundEnv.getElementsAnnotatedWith(AutoValue.class)) { AutoValueExtension.Context context = new LimitedContext(processingEnv, (TypeElement) element); if (extension.applicable(context)) { elements.add(element); } } if (!elements.isEmpty()) { Set<? extends Element> adaptorFactories = roundEnv.getElementsAnnotatedWith(MoshiAdapterFactory.class); for (Element element : adaptorFactories) { if (!element.getModifiers().contains(ABSTRACT)) { error(element, "Must be abstract!"); } TypeElement type = (TypeElement) element; if (!implementsJsonAdapterFactory(type)) { error(element, "Must implement JsonAdapter.Factory!"); } String adapterName = classNameOf(type); String packageName = packageNameOf(type); TypeSpec jsonAdapterFactory = createJsonAdapterFactory(elements, packageName, adapterName); JavaFile file = JavaFile.builder(packageName, jsonAdapterFactory).build(); try { file.writeTo(processingEnv.getFiler()); } catch (IOException e) { processingEnv.getMessager().printMessage(ERROR, "Failed to write TypeAdapterFactory: " + e.getLocalizedMessage()); } } } return false; }
Source:
<code>public OpaqueTokenSpec introspectionClientCredentials(String clientId, String clientSecret) { Assert.hasText(clientId, "clientId cannot be empty"); Assert.notNull(clientSecret, "clientSecret cannot be null"); this.webClient = WebClient.builder() <START> .defaultHeader(HttpHeaders.AUTHORIZATION, basicHeaderValue(clientId, clientSecret)) <END> .build(); return this; }</code><technical_language>I easier this instead: .defaultHeaders(h -> h.setBasicAuth(clientId, clientSecret)) remove basicHeaderValue</technical_language>

Target:
public OpaqueTokenSpec introspectionClientCredentials(String clientId, String clientSecret) { Assert.hasText(clientId, "clientId cannot be empty"); Assert.notNull(clientSecret, "clientSecret cannot be null"); this.clientId = clientId; this.clientSecret = clientSecret; this.introspectionClient = () -> new NimbusReactiveOAuth2TokenIntrospectionClient( this.introspectionUri, this.clientId, this.clientSecret); return this; }
Source:
<code>protected String createHttpRequestURL() { String bugUrl = getUrlSuffix(); <START> if (bugUrl.length() > 0 && authenticationRequired) { <END> RepositoryLocation location = getClient().getLocation(); if (location.getBooleanPropery(IBugzillaRestConstants.REPOSITORY_USE_API_KEY)) { bugUrl += MessageFormat.format("{1}Bugzilla_api_key={0}", new Object[] { location.getProperty(IBugzillaRestConstants.REPOSITORY_API_KEY), bugUrl.endsWith("?") ? "" : "&" }); } else { if (!bugUrl.endsWith("?")) { bugUrl += "&"; } UserCredentials credentials = location.getCredentials(AuthenticationType.REPOSITORY); if (credentials == null) { throw new IllegalStateException("Authentication requested without valid credentials"); } bugUrl += MessageFormat.format("Bugzilla_login={0}&Bugzilla_password={1}", new Object[] { credentials.getUserName(), credentials.getPassword() }); } } return baseUrl() + bugUrl; }</code><technical_language>kind of weird ways decide ? & in URL, need in cases of if/else, set in blocks</technical_language>

Target:
protected String createHttpRequestURL() { String urlSuffix = getUrlSuffix(); if (urlSuffix.length() > 0 && authenticationRequired) { if (!urlSuffix.endsWith("?")) { urlSuffix += "&"; } RepositoryLocation location = getClient().getLocation(); if (location.getBooleanPropery(IBugzillaRestConstants.REPOSITORY_USE_API_KEY)) { urlSuffix += MessageFormat.format("Bugzilla_api_key={0}", location.getProperty(IBugzillaRestConstants.REPOSITORY_API_KEY)); } else { UserCredentials credentials = getCredentials(); urlSuffix += MessageFormat.format("Bugzilla_login={0}&Bugzilla_password={1}", credentials.getUserName(), credentials.getPassword()); } } return baseUrl() + urlSuffix; }
Source:
<code>public void deleteBucket(int bucketIdx) throws IOException { Map<Long, Long> offsetMap = bucketPositions[bucketIdx]; if (offsetMap != null) { for (Long window : offsetMap.keySet()) { Collection<Integer> indices = windowToBuckets.get(window); synchronized (indices) { boolean elementRemoved = indices.remove(bucketIdx); if (indices.isEmpty() && elementRemoved) { <START> deleteFile(window+""); <END> windowToBuckets.removeAll(window); windowToTimestamp.remove(window); } } } } bucketPositions[bucketIdx] = null; }</code><technical_language>Incorrect style concatenation empty? LongToString(...)</technical_language>

Target:
public void deleteBucket(int bucketIdx) throws IOException { Map<Long, Long> offsetMap = bucketPositions[bucketIdx]; if (offsetMap != null) { for (Long window : offsetMap.keySet()) { Collection<Integer> indices = windowToBuckets.get(window); synchronized (indices) { boolean elementRemoved = indices.remove(bucketIdx); if (indices.isEmpty() && elementRemoved) { deleteFile(window.toString()); windowToBuckets.removeAll(window); windowToTimestamp.remove(window); } } } } bucketPositions[bucketIdx] = null; }
Source:
<code>public void testConvertToDataModelTypeWithFiles() { variant.addSourceEntry(variantSourceEntry); BasicDBObject mongoFile = new BasicDBObject(DBObjectToVariantSourceEntryConverter.FILEID_FIELD, variantSourceEntry.getFileId()) .append(DBObjectToVariantSourceEntryConverter.STUDYID_FIELD, variantSourceEntry.getStudyId()); mongoFile.append(DBObjectToVariantSourceEntryConverter.ATTRIBUTES_FIELD, new BasicDBObject("QUAL", "0.01").append("AN", "2")); mongoFile.append(DBObjectToVariantSourceEntryConverter.FORMAT_FIELD, variantSourceEntry.getFormat()); BasicDBObject genotypeCodes = new BasicDBObject(); genotypeCodes.append("def", "0/0"); genotypeCodes.append("0/1", Arrays.asList(1)); mongoFile.append(DBObjectToVariantSourceEntryConverter.SAMPLES_FIELD, genotypeCodes); BasicDBList files = new BasicDBList(); files.add(mongoFile); mongoVariant.append("files", files); <START> List<String> sampleNames = Lists.newArrayList("NA001", "NA002"); <END> MongoDBObjectToVariantEntityConverter mongoDBObjectToVariantConverter = new MongoDBObjectToVariantEntityConverter(); Variant converted = mongoDBObjectToVariantConverter.convert(mongoVariant); assertEquals(variant, converted); }</code><technical_language>this for something</technical_language>

Target:
public void testConvertToDataModelTypeWithFiles() { variant.addSourceEntry(variantSourceEntry); BasicDBObject mongoFile = new BasicDBObject(DBObjectToVariantSourceEntryConverter.FILEID_FIELD, variantSourceEntry.getFileId()) .append(DBObjectToVariantSourceEntryConverter.STUDYID_FIELD, variantSourceEntry.getStudyId()); mongoFile.append(DBObjectToVariantSourceEntryConverter.ATTRIBUTES_FIELD, new BasicDBObject("QUAL", "0.01").append("AN", "2")); mongoFile.append(DBObjectToVariantSourceEntryConverter.FORMAT_FIELD, variantSourceEntry.getFormat()); BasicDBObject genotypeCodes = new BasicDBObject(); genotypeCodes.append("def", "0/0"); genotypeCodes.append("0/1", Arrays.asList(1)); mongoFile.append(DBObjectToVariantSourceEntryConverter.SAMPLES_FIELD, genotypeCodes); BasicDBList files = new BasicDBList(); files.add(mongoFile); mongoVariant.append("files", files); MongoDBObjectToVariantEntityConverter mongoDBObjectToVariantConverter = new MongoDBObjectToVariantEntityConverter(); Variant converted = mongoDBObjectToVariantConverter.convert(mongoVariant); assertEquals(variant, converted); }
Source:
<code><START> public void userAuthDevIdPermission() throws DeviceAccessAuthorizationException, UserStoreException, PermissionManagementException { <END> PrivilegedCarbonContext.startTenantFlow(); PrivilegedCarbonContext.getThreadLocalCarbonContext().setTenantId(MultitenantConstants.SUPER_TENANT_ID, true); PrivilegedCarbonContext.getThreadLocalCarbonContext().setUsername(NON_ADMIN_ALLOWED_USER); Assert.assertTrue(deviceAccessAuthorizationService.isUserAuthorized(deviceIds.get(0), new String[]{NON_ADMIN_PERMISSION}), "Non admin user with permissions attempt to access failed"); PrivilegedCarbonContext.endTenantFlow(); }</code><technical_language>120 character limit violated</technical_language>

Target:
public void userAuthDevIdPermission() throws DeviceAccessAuthorizationException, UserStoreException, PermissionManagementException { PrivilegedCarbonContext.getThreadLocalCarbonContext().setUsername(NON_ADMIN_ALLOWED_USER); Assert.assertTrue(deviceAccessAuthorizationService.isUserAuthorized(deviceIds.get(0), new String[]{NON_ADMIN_PERMISSION}), "Non admin user with permissions attempt to access failed"); }
Source:
<code><START> public static EventApplierMethod forEventMessage(Class<? extends Aggregate> cls, <END> Message eventMessage) { final EventApplierMethod method = MethodRegistry.getInstance() .get(cls, eventMessage.getClass(), factory()); if (method == null) { throw missingEventApplier(cls, eventMessage.getClass()); } return method; }</code><technical_language>ensure cls eventMessage is null</technical_language>

Target:
public static EventApplierMethod forEventMessage(Class<? extends Aggregate> cls, Message eventMessage) { checkNotNull(cls); checkNotNull(eventMessage); final EventApplierMethod method = MethodRegistry.getInstance() .get(cls, eventMessage.getClass(), factory()); if (method == null) { throw missingEventApplier(cls, eventMessage.getClass()); } return method; }
Source:
<code>public void sendUserListMessage(UserList userlist){ UserListMessage ulm = new UserListMessage(userlist); broadcastMessageToFans(ulm); <START> Log.i("Messaging Service", "User List Message Sent"); <END> }</code><technical_language>Lets a TAG variable</technical_language>

Target:
public void sendUserListMessage(UserList userlist){ UserListMessage ulm = new UserListMessage(userlist); broadcastMessageToFans(ulm); }
Source:
<code>private <T, O extends AbstractOptions<O>> Call getMetadataCall(MetadataOperationContext<T, O> context, Supplier<List<Call>> nextCalls) { return new Call("metadata", context.deadline(), new LeastLoadedNodeProvider()) { @Override MetadataRequest.Builder createRequest(int timeoutMs) { return new MetadataRequest.Builder(new MetadataRequestData() .setTopics(convertToMetadataRequestTopic(context.topics())) .setAllowAutoTopicCreation(false)); } @Override void handleResponse(AbstractResponse abstractResponse) { MetadataResponse response = (MetadataResponse) abstractResponse; if (MetadataOperationContext.shouldRefreshMetadata(response)) { <START> rescheduleMetadataTask(context, nextCalls); <END> return; } context.setResponse(Optional.of(response)); for (Call call : nextCalls.get()) { runnable.call(call, time.milliseconds()); } } @Override void handleFailure(Throwable throwable) { for (KafkaFutureImpl<T> future : context.futures().values()) { future.completeExceptionally(throwable); } } }; }</code><technical_language>This is a bit subtle, I want raise InvalidMetadataException constructing a new Call. problem is lose retry bookkeeping means retries respect backoff. throwing exception, retry logic in Call.fail kick in. This consistent logic in getFindCoordinatorCall</technical_language>

Target:
private <T, O extends AbstractOptions<O>> Call getMetadataCall(MetadataOperationContext<T, O> context, Supplier<List<Call>> nextCalls) { return new Call("metadata", context.deadline(), new LeastLoadedNodeProvider()) { @Override MetadataRequest.Builder createRequest(int timeoutMs) { return new MetadataRequest.Builder(new MetadataRequestData() .setTopics(convertToMetadataRequestTopic(context.topics())) .setAllowAutoTopicCreation(false)); } @Override void handleResponse(AbstractResponse abstractResponse) { MetadataResponse response = (MetadataResponse) abstractResponse; MetadataOperationContext.handleMetadataErrors(response); context.setResponse(Optional.of(response)); for (Call call : nextCalls.get()) { runnable.call(call, time.milliseconds()); } } @Override void handleFailure(Throwable throwable) { for (KafkaFutureImpl<T> future : context.futures().values()) { future.completeExceptionally(throwable); } } }; }
Source:
<code>public void testCollectWithDeadTserver() throws IOException, InterruptedException { Instance i = new MockInstance(); <START> File walDir = new File(System.getProperty("java.io.tmpdir") + File.separator + GCWAL_DEAD_DIR); <END> File walFileDir = new File(walDir + File.separator + GCWAL_DEAD_TSERVER + "+" + GCWAL_DEAD_TSERVER_PORT); File walFile = new File(walFileDir + File.separator + GCWAL_DEAD_TSERVER_COLLECT_FILE); if (!walFileDir.exists()) { walFileDir.mkdirs(); new FileOutputStream(walFile).close(); } try { VolumeManager vm = VolumeManagerImpl.getLocal(walDir.toString()); GarbageCollectWriteAheadLogs gcwal2 = new GCWALDeadTserverCollectMock(i, vm, false); GCStatus status = new GCStatus(new GcCycleStats(), new GcCycleStats(), new GcCycleStats(), new GcCycleStats()); gcwal2.collect(status); assertTrue("File should not be deleted", walFile.exists()); assertEquals("Should have one candidate", 1, status.lastLog.getCandidates()); assertEquals("Should not have deleted that file", 0, status.lastLog.getDeleted()); sleep(2000); gcwal2.collect(status); assertFalse("File should be gone", walFile.exists()); assertEquals("Should have one candidate", 1, status.lastLog.getCandidates()); assertEquals("Should have deleted that file", 1, status.lastLog.getDeleted()); } finally { if (walDir.exists()) { FileUtils.deleteDirectory(walDir); } } }</code><technical_language>Accumulo test create files put in target. this do that. System.getProperty("user.dir") + "/target/"+GCWAL_DEAD_DIR. prop user.dir is CWD. Maven sets CWD dir pom is. nice test write target jenkins environments that. jenkins sets java.io.tmpdir reasonable</technical_language>

Target:
public void testCollectWithDeadTserver() throws IOException, InterruptedException { Instance i = new MockInstance(); File walDir = new File(System.getProperty("user.dir") + File.separator + "target" + File.separator + GCWAL_DEAD_DIR); File walFileDir = new File(walDir + File.separator + GCWAL_DEAD_TSERVER + "+" + GCWAL_DEAD_TSERVER_PORT); File walFile = new File(walFileDir + File.separator + GCWAL_DEAD_TSERVER_COLLECT_FILE); if (!walFileDir.exists()) { walFileDir.mkdirs(); new FileOutputStream(walFile).close(); } try { VolumeManager vm = VolumeManagerImpl.getLocal(walDir.toString()); GarbageCollectWriteAheadLogs gcwal2 = new GCWALDeadTserverCollectMock(i, vm, false); GCStatus status = new GCStatus(new GcCycleStats(), new GcCycleStats(), new GcCycleStats(), new GcCycleStats()); gcwal2.collect(status); assertTrue("File should not be deleted", walFile.exists()); assertEquals("Should have one candidate", 1, status.lastLog.getCandidates()); assertEquals("Should not have deleted that file", 0, status.lastLog.getDeleted()); sleep(2000); gcwal2.collect(status); assertFalse("File should be gone", walFile.exists()); assertEquals("Should have one candidate", 1, status.lastLog.getCandidates()); assertEquals("Should have deleted that file", 1, status.lastLog.getDeleted()); } finally { if (walDir.exists()) { FileUtils.deleteDirectory(walDir); } } }
Source:
<code>public void listDirectory(OCFile directory ) { FileDataStorageManager storageManager = mContainerActivity.getStorageManager(); if (storageManager != null) { if (directory == null) { if (mFile != null) { directory = mFile; } else { directory = storageManager.getFileByPath("/"); if (directory == null) { return; } } } if (!directory.isFolder()) { Log_OC.w(TAG, "You see, that is not a directory -> " + directory.toString()); directory = storageManager.getFileById(directory.getParentId()); } if(!directory.isAvailableOffline() && isShowingOnlyAvailableOffline()){ <START> directory = storageManager.getFileByPath("/"); <END> } mFileListAdapter.swapDirectory(directory, storageManager ); if (mFile == null || !mFile.equals(directory)) { mCurrentListView.setSelection(0); } mFile = directory; updateLayout(); } }</code><technical_language>ROOT_PATH instead of "/" OCFile.java, in <LINK_0></technical_language>

Target:
public void listDirectory(OCFile directory) { FileDataStorageManager storageManager = mContainerActivity.getStorageManager(); if (storageManager != null) { if (directory == null) { if (mFile != null) { directory = mFile; } else { directory = storageManager.getFileByPath(OCFile.ROOT_PATH); if (directory == null) { return; } } } if (!directory.isFolder()) { Log_OC.w(TAG, "You see, that is not a directory -> " + directory.toString()); directory = storageManager.getFileById(directory.getParentId()); } if(!directory.isAvailableOffline() && isShowingOnlyAvailableOffline()){ directory = storageManager.getFileByPath(OCFile.ROOT_PATH); } mFileListAdapter.swapDirectory(directory, storageManager); if (mFile == null || !mFile.equals(directory)) { mCurrentListView.setSelection(0); } mFile = directory; updateLayout(); } }
Source:
<code>public static boolean isServerSideMaskingEnabled(PhoenixConnection phoenixConnection) { String isServerSideMaskingSet = phoenixConnection.getClientInfo( QueryServices.PHOENIX_TTL_SERVER_SIDE_MASKING_ENABLED); <START> boolean isServerSideMaskingEnabled = phoenixConnection.getQueryServices() <END> .getConfiguration().getBoolean( QueryServices.PHOENIX_TTL_SERVER_SIDE_MASKING_ENABLED, QueryServicesOptions.DEFAULT_SERVER_SIDE_MASKING_ENABLED) || ((isServerSideMaskingSet != null) && (Boolean.parseBoolean(isServerSideMaskingSet))); return isServerSideMaskingEnabled; }</code><technical_language>nit: return here. Variable required</technical_language>

Target:
public static boolean isServerSideMaskingEnabled(PhoenixConnection phoenixConnection) { String isServerSideMaskingSet = phoenixConnection.getClientInfo( QueryServices.PHOENIX_TTL_SERVER_SIDE_MASKING_ENABLED); return (phoenixConnection.getQueryServices() .getConfiguration().getBoolean( QueryServices.PHOENIX_TTL_SERVER_SIDE_MASKING_ENABLED, QueryServicesOptions.DEFAULT_SERVER_SIDE_MASKING_ENABLED) || ((isServerSideMaskingSet != null) && (Boolean.parseBoolean(isServerSideMaskingSet)))); }
Source:
<code>private void createTreeViewer(FormToolkit toolkit, Composite activityComposite) { TreeViewer viewer = new TreeViewer(toolkit.createTree(activityComposite, SWT.MULTI | SWT.H_SCROLL | SWT.V_SCROLL | SWT.FULL_SELECTION)); <START> GridDataFactory.fillDefaults().hint(SWT.DEFAULT, SWT.DEFAULT).grab(true, true).applyTo(viewer.getControl()); <END> viewer.setContentProvider(new ActivityRecordContentProvider()); viewer.setLabelProvider(new DecoratingStyledCellLabelProvider(new ActivityRecordLabelProvider(), null, null)); IActivityStream stream = new ActivityManager().getStream(new TaskActivityScope(getModel().getTask())); viewer.setInput(stream); }</code><technical_language>table large size hints. removed</technical_language>

Target:
private void createTreeViewer(FormToolkit toolkit, Composite activityComposite) { TreeViewer viewer = new TreeViewer(toolkit.createTree(activityComposite, SWT.MULTI | SWT.H_SCROLL | SWT.V_SCROLL | SWT.FULL_SELECTION)); GridDataFactory.fillDefaults().hint(500, 100).grab(true, true).applyTo(viewer.getControl()); viewer.setContentProvider(new ActivityRecordContentProvider()); viewer.setLabelProvider(new DecoratingStyledCellLabelProvider(new ActivityRecordLabelProvider(), null, null)); IActivityStream stream = new ActivityManager().getStream(new TaskActivityScope(getModel().getTask())); viewer.setInput(stream); }
Source:
<code>public void switchBoard() { if (prefs.getLastOpenBoard().isPresent() && prefs.getAllBoards().size() > 1) { <START> List<String> boardNames = new ArrayList<>(prefs.getAllBoards().keySet()); <END> int index = boardNames.indexOf(prefs.getLastOpenBoard().get()); if (index == boardNames.size() - 1) { index = 0; } else { index++; } onBoardOpen(boardNames.get(index), prefs.getBoardPanels(boardNames.get(index))); } }</code><technical_language>This is backed a HashMap, guarantee key ordering: boards cycled in a order [over time](<LINK_0> want change a LinkedHashMap</technical_language>

Target:
public void switchBoard() { Optional<String> name = prefs.switchBoard(); if (name.isPresent()) { onBoardOpen(name.get(), prefs.getBoardPanels(name.get())); } }
Source:
<code>public ContentValuesAssert contains(ContentValuesEntry... entries) { isNotEmptyOrNull(entries); Set<ContentValuesEntry> notFound = new LinkedHashSet<ContentValuesEntry>(); for (ContentValuesEntry entry : entries) { if (!containsEntry(actual, entry)) { notFound.add(entry); } } if (notFound.isEmpty()) { return this; } <START> throw Failures.instance().failure(new WritableAssertionInfo(), shouldContain(actual, entries, notFound)); <END> }</code><technical_language>Logic reversed java if (!nf.isEmpty()) { throw; } return this;</technical_language>

Target:
public ContentValuesAssert contains(ContentValuesEntry... entries) { isNotEmptyOrNull(entries); Set<ContentValuesEntry> notFound = new LinkedHashSet<ContentValuesEntry>(); for (ContentValuesEntry entry : entries) { if (!containsEntry(actual, entry)) { notFound.add(entry); } } if (!notFound.isEmpty()) { throw Failures.instance().failure(new WritableAssertionInfo(), shouldContain(actual, entries, notFound)); } return this; }
Source:
<code>private ArrayList<LunModel> getLuns(boolean selectedLuns, boolean includedLuns) { <START> ArrayList<LunModel> <END> luns = new ArrayList<>(); if (getItems() != null) { if (getIsGrouppedByTarget()) { List<SanTargetModel> items = (List<SanTargetModel>) getItems(); for (SanTargetModel item : items) { aggregateAddedLuns(item.getLuns(), selectedLuns, includedLuns, luns); } } else { List<LunModel> items = (List<LunModel>) getItems(); aggregateAddedLuns(items, selectedLuns, includedLuns, luns ); } } return luns; }</code><technical_language>solution work, Linq.firstOrNull work a bigger list iteration. Again, ok, consider alternative: Declare luns a Set, leave getAddedLuns add result set added ArrayList before. end return set's items. a nicer solution, consider :)</technical_language>

Target:
private ArrayList<LunModel> getLuns(boolean selectedLuns, boolean includedLuns) { Set<LunModel> luns = new HashSet<>(); if (getItems() != null) { if (getIsGrouppedByTarget()) { List<SanTargetModel> items = (List<SanTargetModel>) getItems(); for (SanTargetModel item : items) { luns.addAll(aggregateAddedLuns(item.getLuns(), selectedLuns, includedLuns)); } } else { List<LunModel> items = (List<LunModel>) getItems(); luns.addAll(aggregateAddedLuns(items, selectedLuns, includedLuns)); } } return new ArrayList<>(luns); }
Source:
<code>private List<String> getTumorNamesBySpecialTumorType(String cancerType){ List<String> tumorTypes = new ArrayList<>(); String url = "<LINK_0>"; RestTemplate restTemplate = new RestTemplate(); ResponseEntity<String> response = restTemplate.getForEntity(url, String.class); JSONParser parser = new JSONParser(); try{ JSONArray typesArray = (JSONArray) parser.parse(response.getBody()); TumorType[] mainTypes = new TumorType[typesArray.size()]; for (int i = 0; i < typesArray.size(); i++){ JSONObject type = (JSONObject)typesArray.get(i); mainTypes[i] = new TumorType(); mainTypes[i].setName((String)type.get("name")); mainTypes[i].setTumorForm((String)type.get("tumorForm")); if (mainTypes[i].getTumorForm() != null && mainTypes[i].getTumorForm().equals(TumorFormMap.get(cancerType))){ tumorTypes.add(mainTypes[i].getName().split(",")[0]); } } } <START> catch(ParseException e){ <END> } return tumorTypes; }</code><technical_language>do anything</technical_language>

Target:
private Set<String> getTumorNamesBySpecialTumorType(String cancerType){ Set<String> tumorTypes = new HashSet<>(); List<TumorType> allOncoTreeTypes = TumorTypeUtils.getAllOncoTreeTypes(); for (TumorType type: allOncoTreeTypes){ if (type.getMainType() != null && type.getMainType().getTumorForm() != null && TumorFormMap.get(cancerType).equalsIgnoreCase(type.getMainType().getTumorForm().toString())){ String name = TumorTypeUtils.getTumorTypeName(type); if (name.length()>0) tumorTypes.add(name); } } return tumorTypes; }
Source:
<code>public boolean onOptionsItemSelected(MenuItem item) { switch (item.getItemId()) { case R.id.menu_gallery_deselect_selected: this.onResume(); return true; case R.id.menu_gallery_load_more: if (turnsNeeded > 1) { turnsNeeded -= 1; turnsDone += 1; localImagesPerTurn += PER_TURN; resumeLocalPhoto(); } else { localImagesPerTurn += loadLeft; turnsNeeded -= 1; turnsDone += 1; resumeLocalPhoto(); galleryMenu.findItem(R.id.menu_gallery_load_more).setVisible(false); } return true; case R.id.menu_gallery_delete_selected: AlertDialog.Builder deleteAlert = new AlertDialog.Builder(ctx); deleteAlert.setMessage(R.string.delete_images) .setPositiveButton(R.string.yes, new DialogInterface.OnClickListener() { public void onClick(DialogInterface dialog, int id) { deleteCheckedImages(); } }) .setNegativeButton(R.string.no, new DialogInterface.OnClickListener() { public void onClick(DialogInterface dialog, int id) { dialog.dismiss(); } }); deleteAlert.create().show(); case R.id.menu_gallery_select_all: photosAdapter.selectAllImages(); int imgCount = localImageList.size(); String newTitle; if (imgCount > 0) { <START> newTitle = imgCount + " images" + " selected"; <END> } else { newTitle = getResources().getString(R.string.application_title); } getActivity().setTitle(newTitle); getActivity().invalidateOptionsMenu(); return true; default: return super.onOptionsItemSelected(item); } }</code><technical_language>**images** in case of image</technical_language>

Target:
public boolean onOptionsItemSelected(MenuItem item) { switch (item.getItemId()) { case R.id.menu_gallery_deselect_selected: this.onResume(); return true; case R.id.menu_gallery_load_more: if (turnsNeeded > 1) { turnsNeeded -= 1; turnsDone += 1; localImagesPerTurn += PER_TURN; resumeLocalPhoto(); } else { localImagesPerTurn += loadLeft; turnsNeeded -= 1; turnsDone += 1; resumeLocalPhoto(); galleryMenu.findItem(R.id.menu_gallery_load_more).setVisible(false); } return true; case R.id.menu_gallery_delete_selected: AlertDialog.Builder deleteAlert = new AlertDialog.Builder(ctx); deleteAlert.setMessage(R.string.delete_images) .setPositiveButton(R.string.yes, new DialogInterface.OnClickListener() { public void onClick(DialogInterface dialog, int id) { deleteCheckedImages(); } }) .setNegativeButton(R.string.no, new DialogInterface.OnClickListener() { public void onClick(DialogInterface dialog, int id) { dialog.dismiss(); } }); deleteAlert.create().show(); case R.id.menu_gallery_select_all: photosAdapter.selectAllImages(); int imgCount = localImageList.size(); String newTitle; if (imgCount > 0) { newTitle = imgCount == 1 ? getResources().getString(R.string.single_image_selected) : String.format(getString(R.string.images_selected), imgCount); } else { newTitle = getResources().getString(R.string.application_title); } getActivity().setTitle(newTitle); getActivity().invalidateOptionsMenu(); return true; default: return super.onOptionsItemSelected(item); } }
Source:
<code>private void onDiscordReady(DiscordUser discordUser) { <START> log.info("Discord is ready, with user: ''{}''", discordUser.username); <END> }</code><technical_language>Omit , :</technical_language>

Target:
private void onDiscordReady(DiscordUser discordUser) { log.info("Discord is ready with user '{}'", discordUser.username); }
Source:
<code>public void sourceMappingChangesHelper(boolean withBackend) throws Throwable { doMappingAndLaunch(EXEC_AC_NAME, withBackend); MapEntrySourceContainer incorrectMapEntry = new MapEntrySourceContainer(BUILD_ABSPATH + "/incorrectsubpath", new Path(SOURCE_ABSPATH)); if (withBackend) { assertSourceFound(); } else { assertSourceFoundByDirectorOnly(); } ISourceContainer[][] containers = new ISourceContainer[1][]; <START> MappingSourceContainer[] mappingSourceContainer = new MappingSourceContainer[1]; <END> updateSourceDirector(director -> { containers[0] = director.getSourceContainers(); mappingSourceContainer[0] = (MappingSourceContainer) containers[0][1]; mappingSourceContainer[0].removeMapEntry(fMapEntrySourceContainerC); mappingSourceContainer[0].addMapEntry(incorrectMapEntry); director.setSourceContainers(containers[0]); }); if (withBackend) { doCdToBinDir(); } assertSourceNotFound(); updateSourceDirector(director -> { containers[0] = director.getSourceContainers(); mappingSourceContainer[0] = (MappingSourceContainer) containers[0][1]; mappingSourceContainer[0].removeMapEntry(incorrectMapEntry); mappingSourceContainer[0].addMapEntry(fMapEntrySourceContainerC); director.setSourceContainers(containers[0]); }); if (withBackend) { assertSourceFound(); } else { assertSourceFoundByDirectorOnly(); } }</code><technical_language>'final' clearer array? is exposed lamdas yet</technical_language>

Target:
public void sourceMappingChangesHelper(boolean withBackend) throws Throwable { doMappingAndLaunch(EXEC_AC_NAME, withBackend); MapEntrySourceContainer incorrectMapEntry = new MapEntrySourceContainer(BUILD_ABSPATH + "/incorrectsubpath", new Path(SOURCE_ABSPATH)); if (withBackend) { assertSourceFound(); } else { assertSourceFoundByDirectorOnly(); } final ISourceContainer[][] containers = new ISourceContainer[1][]; final MappingSourceContainer[] mappingSourceContainer = new MappingSourceContainer[1]; updateSourceDirector(director -> { containers[0] = director.getSourceContainers(); mappingSourceContainer[0] = (MappingSourceContainer) containers[0][1]; mappingSourceContainer[0].removeMapEntry(fMapEntrySourceContainerC); mappingSourceContainer[0].addMapEntry(incorrectMapEntry); director.setSourceContainers(containers[0]); }); if (withBackend) { doCdToBinDir(); } assertSourceNotFound(); updateSourceDirector(director -> { containers[0] = director.getSourceContainers(); mappingSourceContainer[0] = (MappingSourceContainer) containers[0][1]; mappingSourceContainer[0].removeMapEntry(incorrectMapEntry); mappingSourceContainer[0].addMapEntry(fMapEntrySourceContainerC); director.setSourceContainers(containers[0]); }); if (withBackend) { assertSourceFound(); } else { assertSourceFoundByDirectorOnly(); } }
Source:
<code>public void postProcessAdminWithOptionsSuccess() throws Exception { LinkedList<DSpaceCommandLineParameter> parameters = new LinkedList<>(); parameters.add(new DSpaceCommandLineParameter("-r", "test")); parameters.add(new DSpaceCommandLineParameter("-i", null)); List<ParameterValueRest> list = parameters.stream() .map(dSpaceCommandLineParameter -> dSpaceRunnableParameterConverter .convert(dSpaceCommandLineParameter, Projection.DEFAULT)) .collect(Collectors.toList()); String token = getAuthToken(admin.getEmail(), password); List<ProcessStatus> acceptableProcessStatuses = new LinkedList<>(); acceptableProcessStatuses.addAll(Arrays.asList(ProcessStatus.SCHEDULED, ProcessStatus.RUNNING, ProcessStatus.COMPLETED)); MvcResult mvcResult = getClient(token) .perform(post("/api/system/scripts/mock-script/processes").contentType("multipart/form-data") .param("properties", new Gson().toJson(list))) .andExpect(status().isAccepted()) .andExpect(jsonPath("$", is( ProcessMatcher.matchProcess("mock-script", String.valueOf(admin.getID()), parameters, acceptableProcessStatuses)))).andReturn(); ObjectMapper mapper = new ObjectMapper(); String content = mvcResult.getResponse().getContentAsString(); Map<String, Object> map = mapper.readValue(content, Map.class); Integer processId = Integer.valueOf(String.valueOf(map.get("processId"))); <START> getClient(token).perform(delete("/api/system/processes/" + processId)); <END> }</code><technical_language>here, please refactor this cleanup POST above</technical_language>

Target:
public void postProcessAdminWithOptionsSuccess() throws Exception { LinkedList<DSpaceCommandLineParameter> parameters = new LinkedList<>(); parameters.add(new DSpaceCommandLineParameter("-r", "test")); parameters.add(new DSpaceCommandLineParameter("-i", null)); List<ParameterValueRest> list = parameters.stream() .map(dSpaceCommandLineParameter -> dSpaceRunnableParameterConverter .convert(dSpaceCommandLineParameter, Projection.DEFAULT)) .collect(Collectors.toList()); String token = getAuthToken(admin.getEmail(), password); List<ProcessStatus> acceptableProcessStatuses = new LinkedList<>(); acceptableProcessStatuses.addAll(Arrays.asList(ProcessStatus.SCHEDULED, ProcessStatus.RUNNING, ProcessStatus.COMPLETED)); AtomicReference<Integer> idRef = new AtomicReference<>(); try { getClient(token) .perform(post("/api/system/scripts/mock-script/processes").contentType("multipart/form-data") .param("properties", new Gson().toJson(list))) .andExpect(status().isAccepted()) .andExpect(jsonPath("$", is( ProcessMatcher.matchProcess("mock-script", String.valueOf(admin.getID()), parameters, acceptableProcessStatuses)))) .andDo(result -> idRef .set(read(result.getResponse().getContentAsString(), "$.processId"))); } finally { ProcessBuilder.deleteProcess(idRef.get()); } }
Source:
<code>public Response getRunningTasksByDataSource(@PathParam("dataSource") String dataSource, @Context HttpServletRequest request) { List<TaskRunnerWorkItem> taskRunnerWorkItemList = new ArrayList<>(); Optional<TaskRunner> ts = taskMaster.getTaskRunner(); if (ts.isPresent()) { Collection<? extends TaskRunnerWorkItem> runningTasks = ts.get().getRunningTasks(); if (runningTasks == null || runningTasks.isEmpty()) { <START> return Response.ok("No running tasks found").build(); <END> } for (TaskRunnerWorkItem taskRunnerWorkItem : runningTasks) { if (taskRunnerWorkItem.getDataSource().equals(dataSource)) { taskRunnerWorkItemList.add(taskRunnerWorkItem); } } } return Response.ok(taskRunnerWorkItemList).build(); }</code><technical_language>this odd. 404</technical_language>

Target:
public Response getRunningTasksByDataSource(@PathParam("dataSource") String dataSource, @Context HttpServletRequest request) { Optional<TaskRunner> ts = taskMaster.getTaskRunner(); if (!ts.isPresent()) { return Response.status(Response.Status.NOT_FOUND).entity("No tasks are running").build(); } Collection<? extends TaskRunnerWorkItem> runningTasks = ts.get().getRunningTasks(); if (runningTasks == null || runningTasks.isEmpty()) { return Response.status(Response.Status.NOT_FOUND) .entity("No running tasks found for the datasource : " + dataSource).build(); } List<TaskRunnerWorkItem> taskRunnerWorkItemList = runningTasks.stream() .filter(task -> dataSource.equals(task.getDataSource())).collect(Collectors.toList()); return Response.ok(taskRunnerWorkItemList).build(); }
Source:
<code>public OneUuidReturnForXmlRpc glusterSnapshotCreate(String volumeName, String snapshotName, String description, boolean force) { JsonRpcRequest request = <START> new RequestBuilder("GlusterSnapshot.create").withOptionalParameter("volumeName", volumeName) <END> .withParameter("snapName", snapshotName) .withParameter("description", description) .withParameter("force", force) .build(); Map<String, Object> response = new FutureMap(this.client, request).withIgnoreResponseKey(); return new OneUuidReturnForXmlRpc(response); }</code><technical_language>is volumeName optional parameter</technical_language>

Target:
public OneUuidReturnForXmlRpc glusterSnapshotCreate(String volumeName, String snapshotName, String description, boolean force) { JsonRpcRequest request = new RequestBuilder("GlusterSnapshot.create").withParameter("volumeName", volumeName) .withParameter("snapName", snapshotName) .withOptionalParameter("description", description) .withParameter("force", force) .build(); Map<String, Object> response = new FutureMap(this.client, request).withIgnoreResponseKey(); return new OneUuidReturnForXmlRpc(response); }
Source:
<code>public void migratePrimaryKeyTableIfNeeded_first() throws IOException { configFactory.copyRealmFromAssets(context, "080_annotationtypes.realm", "default.realm"); sharedRealm = SharedRealm.getInstance(config); sharedRealm.beginTransaction(); assertTrue(Table.migratePrimaryKeyTableIfNeeded(sharedRealm)); sharedRealm.commitTransaction(); Table t = sharedRealm.getTable("class_AnnotationTypes"); assertEquals(t.getColumnIndex("id"), t.getPrimaryKey()); <START> assertTrue(t.hasPrimaryKey()); <END> assertEquals(RealmFieldType.STRING, sharedRealm.getTable("pk").getColumnType(0)); }</code><technical_language>minor: this assert is above</technical_language>

Target:
public void migratePrimaryKeyTableIfNeeded_first() throws IOException { configFactory.copyRealmFromAssets(context, "080_annotationtypes.realm", "default.realm"); sharedRealm = SharedRealm.getInstance(config); sharedRealm.beginTransaction(); assertTrue(Table.migratePrimaryKeyTableIfNeeded(sharedRealm)); sharedRealm.commitTransaction(); Table t = sharedRealm.getTable("class_AnnotationTypes"); assertTrue(t.hasPrimaryKey()); assertEquals(t.getColumnIndex("id"), t.getPrimaryKey()); assertEquals(RealmFieldType.STRING, sharedRealm.getTable("pk").getColumnType(0)); }
Source:
<code>public static void onUpgrade(Context context, SQLiteDatabase db, int oldVersion, int newVersion) { if (newVersion <= 2) { db.execSQL(QUERY_TABLE_DROP); onCreate(context, db); } else if (newVersion >= 3) { final String ALTER_TBL = "ALTER TABLE " + TABLENAME + " ADD COLUMN " + COLUMN_IS_PAID_ACCOUNT + " integer default 0;"; <START> db.execSQL(ALTER_TBL); <END> } }</code><technical_language>In this case alter table for new version. newVersion == 3 && oldVersion <= 2</technical_language>

Target:
public static void onUpgrade(Context context, SQLiteDatabase db, int oldVersion, int newVersion) { if (oldVersion <= 2) { final String ALTER_TBL = "ALTER TABLE " + TABLENAME + " ADD COLUMN " + COLUMN_IS_PAID_ACCOUNT + " integer default 0;"; db.execSQL(ALTER_TBL); } }
Source:
<code>public CommandCallback getCallback() { if (getParameters().isUseCinderCommandCallback()) { return new ConcurrentChildCommandsExecutionCallback(); } <START> return new SerialChildCommandsExecutionCallback(); <END> }</code><technical_language>return getParameters().isUseCinderCommandCallback() ? new ConcurrentChildCommandsExecutionCallback() : new SerialChildCommandsExecutionCallback();</technical_language>

Target:
public CommandCallback getCallback() { return getParameters().isUseCinderCommandCallback() ? new ConcurrentChildCommandsExecutionCallback() : new SerialChildCommandsExecutionCallback(); }
Source:
<code>private void stopWithSavepointStreamTaskTestHelper(final boolean withMaxWatermark) throws Exception { final long syncSavepointId = 34L; final StreamTaskTestHarness<Long> srcTaskTestHarness = getSourceStreamTaskTestHarness(); final Thread executionThread = srcTaskTestHarness.invoke(); final StreamTask<Long, ?> srcTask = srcTaskTestHarness.getTask(); <START> waitForLatchSetByTask(ready, srcTaskTestHarness); <END> emitAndVerifyWatermarkAndElement(srcTaskTestHarness, 1L); emitAndVerifyWatermarkAndElement(srcTaskTestHarness, 2L); srcTask.triggerCheckpointAsync( new CheckpointMetaData(31L, 900), CheckpointOptions.forCheckpointWithDefaultLocation(), false) .get(); verifyCheckpointBarrier(srcTaskTestHarness.getOutput(), 31L); emitAndVerifyWatermarkAndElement(srcTaskTestHarness, 3L); srcTask.triggerCheckpointAsync( new CheckpointMetaData(syncSavepointId, 900), new CheckpointOptions(CheckpointType.SYNC_SAVEPOINT, CheckpointStorageLocationReference.getDefault()), withMaxWatermark) .get(); if (withMaxWatermark) { verifyWatermark(srcTaskTestHarness.getOutput(), Watermark.MAX_WATERMARK); } verifyCheckpointBarrier(srcTaskTestHarness.getOutput(), syncSavepointId); waitForSynchronousSavepointIdToBeSet(srcTask); assertTrue(srcTask.getSynchronousSavepointId().isPresent()); srcTask.notifyCheckpointCompleteAsync(syncSavepointId).get(); assertFalse(srcTask.getSynchronousSavepointId().isPresent()); executionThread.join(); }</code><technical_language>I get point need this change unrelated this PR. If motivation is for avoiding stuck long time await(), timeoutPerTest for test timeout. If want refactor some previous tests, a hotfix commit if minor give some descriptions in commit message for understanding motivation</technical_language>

Target:
private void stopWithSavepointStreamTaskTestHelper(final boolean withMaxWatermark) throws Exception { final long syncSavepointId = 34L; final StreamTaskTestHarness<Long> srcTaskTestHarness = getSourceStreamTaskTestHarness(); final Thread executionThread = srcTaskTestHarness.invoke(); final StreamTask<Long, ?> srcTask = srcTaskTestHarness.getTask(); ready.await(); emitAndVerifyWatermarkAndElement(srcTaskTestHarness, 1L); emitAndVerifyWatermarkAndElement(srcTaskTestHarness, 2L); srcTask.triggerCheckpointAsync( new CheckpointMetaData(31L, 900), CheckpointOptions.forCheckpointWithDefaultLocation(), false) .get(); verifyCheckpointBarrier(srcTaskTestHarness.getOutput(), 31L); emitAndVerifyWatermarkAndElement(srcTaskTestHarness, 3L); srcTask.triggerCheckpointAsync( new CheckpointMetaData(syncSavepointId, 900), new CheckpointOptions(CheckpointType.SYNC_SAVEPOINT, CheckpointStorageLocationReference.getDefault()), withMaxWatermark) .get(); if (withMaxWatermark) { verifyWatermark(srcTaskTestHarness.getOutput(), Watermark.MAX_WATERMARK); } verifyCheckpointBarrier(srcTaskTestHarness.getOutput(), syncSavepointId); waitForSynchronousSavepointIdToBeSet(srcTask); assertTrue(srcTask.getSynchronousSavepointId().isPresent()); srcTask.notifyCheckpointCompleteAsync(syncSavepointId).get(); assertFalse(srcTask.getSynchronousSavepointId().isPresent()); executionThread.join(); }
Source:
<code>public void writeInfoRefs() throws IOException { final StringWriter w = new StringWriter(); final char[] tmp = new char[Constants.OBJECT_ID_STRING_LENGTH]; for (final Ref r : refs) { if (Constants.HEAD.equals(r.getName())) { continue; } ObjectId objectId = r.getObjectId(); <START> if (objectId == null) { throw new TransportException(MessageFormat .format(JGitText.get().cannotRead, r.getName())); } <END> objectId.copyTo(tmp, w); w.write('\t'); w.write(r.getName()); w.write('\n'); ObjectId peeledObjectId = r.getPeeledObjectId(); if (peeledObjectId != null) { peeledObjectId.copyTo(tmp, w); w.write('\t'); w.write(r.getName()); w.write("^{}\n"); } } writeFile(Constants.INFO_REFS, Constants.encode(w.toString())); }</code><technical_language>Interesting. This means build info/refs if a symref-to-unborn-branch other HEAD fail. For comparison, C git skips GIT_REF_PARANOIA is set 1 true. This step actual push occurred safer skip symref C git does: if (objectId == null) { // Symrefs unborn branches advertised in info/refs file. continue; }</technical_language>

Target:
public void writeInfoRefs() throws IOException { final StringWriter w = new StringWriter(); final char[] tmp = new char[Constants.OBJECT_ID_STRING_LENGTH]; for (final Ref r : refs) { if (Constants.HEAD.equals(r.getName())) { continue; } ObjectId objectId = r.getObjectId(); if (objectId == null) { continue; } objectId.copyTo(tmp, w); w.write('\t'); w.write(r.getName()); w.write('\n'); ObjectId peeledObjectId = r.getPeeledObjectId(); if (peeledObjectId != null) { peeledObjectId.copyTo(tmp, w); w.write('\t'); w.write(r.getName()); w.write("^{}\n"); } } writeFile(Constants.INFO_REFS, Constants.encode(w.toString())); }
Source:
<code>public ProjectileSource getShooter() { if (this.shootingEntity instanceof ProjectileSource) { return (ProjectileSource) this.shootingEntity; } if (this.projectileSource != null) { <START> return projectileSource; <END> } return ProjectileSource.UNKNOWN; }</code><technical_language>this</technical_language>

Target:
public ProjectileSource getShooter() { if (this.shootingEntity instanceof ProjectileSource) { return (ProjectileSource) this.shootingEntity; } if (this.projectileSource != null) { return this.projectileSource; } return ProjectileSource.UNKNOWN; }
Source:
<code>public void repairInstances(String accountId, RepairInstancesRequest request) { Stack stack = stackService.getByEnvironmentCrnAndAccountIdWithLists(request.getEnvironmentCrn(), accountId); MDCBuilder.buildMdcContext(stack); Map<String, InstanceMetaData> allInstancesByInstanceId = getAllInstancesFromStack(stack); Map<String, InstanceMetaData> instancesToRepair = getInstancesToRepair(allInstancesByInstanceId, accountId, request); <START> if (instancesToRepair.keySet().size() > 0) { <END> Operation operation = operationService.startOperation(accountId, OperationType.DOWNSCALE, Set.of(stack.getEnvironmentCrn()), Collections.emptySet()); flowManager.notify(DOWNSCALE_EVENT.event(), new DownscaleEvent(DOWNSCALE_EVENT.event(), stack.getId(), instancesToRepair.keySet().stream().collect(Collectors.toList()), operation.getOperationId())); } else { throw new NotFoundException("No unhealthy instances to repair. Maybe use the force option."); } }</code><technical_language>isEmpty instead of > 0</technical_language>

Target:
public OperationStatus repairInstances(String accountId, RepairInstancesRequest request) { Stack stack = stackService.getByEnvironmentCrnAndAccountIdWithLists(request.getEnvironmentCrn(), accountId); MDCBuilder.buildMdcContext(stack); if (request.isForceRepair() && CollectionUtils.isEmpty(request.getInstanceIds())) { throw new UnsupportedOperationException("Force repair requires the instance IDs to be provided."); } Map<String, InstanceStatus> healthMap = request.isForceRepair() ? Collections.emptyMap() : getInstanceHealthMap(accountId, request.getEnvironmentCrn()); Map<String, InstanceMetaData> allInstancesByInstanceId = getAllInstancesFromStack(stack); Map<String, InstanceMetaData> instancesToRepair = getInstancesToRepair(healthMap, allInstancesByInstanceId, request.getInstanceIds(), request.isForceRepair(), false); if (instancesToRepair.keySet().isEmpty()) { throw new NotFoundException("No unhealthy instances to repair. Maybe use the force option."); } Set<InstanceMetaData> remainingInstances = allInstancesByInstanceId.values().stream() .filter(instanceMetaData -> !instancesToRepair.containsKey(instanceMetaData.getInstanceId())) .filter(instanceMetaData -> { if (request.isForceRepair()) { return !INVALID_REPAIR_STATUSES.contains(instanceMetaData.getInstanceStatus()); } else { return healthMap.containsKey(instanceMetaData.getInstanceId()) && healthMap.get(instanceMetaData.getInstanceId()).isAvailable(); } }) .collect(Collectors.toSet()); if (remainingInstances.isEmpty()) { throw new BadRequestException("At least one instance must remain running during a repair."); } Operation operation = operationService.startOperation(accountId, OperationType.REPAIR, Set.of(stack.getEnvironmentCrn()), Collections.emptySet()); flowManager.notify(DOWNSCALE_EVENT.event(), new DownscaleEvent(DOWNSCALE_EVENT.event(), stack.getId(), instancesToRepair.keySet().stream().collect(Collectors.toList()), operation.getOperationId())); return operationToOperationStatusConverter.convert(operation); }