auphong2707/dl4se-code-review-dataset huggingface dataset:
Source:
<code>public double getHeight(double lat, double lon) { double deltaLat = Math.abs(lat - minLat); double deltaLon = Math.abs(lon - minLon); if (deltaLat > latHigherBound || deltaLat < lowerBound) throw new IllegalStateException("latitude not in boundary of this file:" + lat + "," + lon + ", this:" + this.toString()); if (deltaLon > lonHigherBound || deltaLon < lowerBound) throw new IllegalStateException("longitude not in boundary of this file:" + lat + "," + lon + ", this:" + this.toString()); double elevation; if (interpolate) { double x = (width - 1) * deltaLon / horizontalDegree; double y = (height - 1) * (1 - deltaLat / verticalDegree); int left = (int) x; int top = (int) y; int right = left + 1; int bottom = top + 1; double w00 = getHeightSample(left, top); double w01 = getHeightSample(left, bottom); double w10 = getHeightSample(right, top); double w11 = getHeightSample(right, bottom); double topEle = linearInterpolate(w00, w10, x - left); double bottomEle = linearInterpolate(w01, w11, x - left); elevation = linearInterpolate(topEle, bottomEle, y - top); } else { int x = (int) (width / horizontalDegree * deltaLon); if (x >= width) x = width - 1; int y = height - 1 - (int) (height / verticalDegree * deltaLat); if (y < 0) y = 0; elevation = getHeightSample(x, y); } <START> return elevation < MIN_ELEVATION ? Double.NaN : elevation; <END> }</code><technical_language>Instead of returning NaN throw exception? NaN trouble else</technical_language>

Target:
public double getHeight(double lat, double lon) { double deltaLat = Math.abs(lat - minLat); double deltaLon = Math.abs(lon - minLon); if (deltaLat > latHigherBound || deltaLat < lowerBound) throw new IllegalStateException("latitude not in boundary of this file:" + lat + "," + lon + ", this:" + this.toString()); if (deltaLon > lonHigherBound || deltaLon < lowerBound) throw new IllegalStateException("longitude not in boundary of this file:" + lat + "," + lon + ", this:" + this.toString()); double elevation; if (interpolate) { double x = (width - 1) * deltaLon / horizontalDegree; double y = (height - 1) * (1 - deltaLat / verticalDegree); int left = (int) x; int top = (int) y; int right = left + 1; int bottom = top + 1; double w00 = getHeightSample(left, top); double w01 = getHeightSample(left, bottom); double w10 = getHeightSample(right, top); double w11 = getHeightSample(right, bottom); double topEle = linearInterpolate(w00, w10, x - left); double bottomEle = linearInterpolate(w01, w11, x - left); elevation = linearInterpolate(topEle, bottomEle, y - top); } else { int x = (int) (width / horizontalDegree * deltaLon); if (x >= width) x = width - 1; int y = height - 1 - (int) (height / verticalDegree * deltaLat); if (y < 0) y = 0; elevation = getHeightSample(x, y); } return isValidElevation(elevation) ? elevation : Double.NaN; }
Source:
<code>public void testCleanStateAfterInit() throws NoWorkTreeException, GitAPIException { Git parentGit = Git.wrap(parentRepository.getRepository()); Status status = parentGit .status() .setWorkingTreeIt( new AdaptableFileTreeIterator(parentRepository .getRepository(), parentFile.getWorkspace() <START> .getRoot())).call(); <END> assertTrue(status.isClean()); }</code><technical_language>extract creation of iterator method below? care of this ugly wrapping</technical_language>

Target:
public void testCleanStateAfterInit() throws NoWorkTreeException, GitAPIException { Git parentGit = Git.wrap(parentRepository.getRepository()); Status status = parentGit.status().setWorkingTreeIt(treeIt).call(); assertTrue(status.isClean()); }
Source:
<code>public void testListDeployment() throws Exception { final DeploymentApi deploymentApi = api.getDeploymentApi(resourceGroup); server.enqueue(jsonResponse("/listdeployments.json")); List<Deployment> deployments = deploymentApi.list(); <START> assertTrue(deployments.size() > 0); <END> }</code><technical_language>Verify recorded request</technical_language>

Target:
public void testListDeployment() throws Exception { final DeploymentApi deploymentApi = api.getDeploymentApi(resourceGroup); server.enqueue(jsonResponse("/listdeployments.json")); List<Deployment> deployments = deploymentApi.list(); assertTrue(deployments.size() > 0); assertSent(server, "GET", "/subscriptions/" + subscriptionId + "/resourcegroups/" + resourceGroup + "/providers/microsoft.resources/deployments?api-version=2016-02-01"); }
Source:
<code>protected String readFile(String fileLocation) throws APIManagerIntegrationTestException { try { <START> BufferedReader bufferedReader = new BufferedReader(new FileReader(new File(fileLocation))); <END> String line; StringBuilder stringBuilder = new StringBuilder(); while ((line = bufferedReader.readLine()) != null) { stringBuilder.append(line); } return stringBuilder.toString(); } catch (IOException ioE) { throw new APIManagerIntegrationTestException("IOException when reading the file from:" + fileLocation, ioE); } }</code><technical_language>close stream in finally block</technical_language>

Target:
protected String readFile(String fileLocation) throws APIManagerIntegrationTestException { BufferedReader bufferedReader = null; try { bufferedReader = new BufferedReader(new FileReader(new File(fileLocation))); String line; StringBuilder stringBuilder = new StringBuilder(); while ((line = bufferedReader.readLine()) != null) { stringBuilder.append(line); } return stringBuilder.toString(); } catch (IOException ioE) { throw new APIManagerIntegrationTestException("IOException when reading the file from:" + fileLocation, ioE); } finally { if (bufferedReader != null) { try { bufferedReader.close(); } catch (IOException e) { log.warn("Error when closing the buffer reade which used to reed the file:" + fileLocation + ". Error:" + e.getMessage()); } } } }
Source:
<code>public boolean onOptionsItemSelected(MenuItem item) { switch (item.getItemId()) { case R.id.homeAsUp: return true; case R.id.menu_page_save: app.getFunnelManager().getSavedPagesFunnel(model.getTitle().getSite()).logSaveNew(); if (model.getCurEntry().getSource() == HistoryEntry.SOURCE_SAVED_PAGE) { refreshPage(true); } else { savePage(); } return true; case R.id.menu_page_share: <START> contextMenuListener.onShareLink(model.getTitle()); <END> return true; case R.id.menu_page_other_languages: Intent langIntent = new Intent(); langIntent.setClass(getActivity(), LangLinksActivity.class); langIntent.setAction(LangLinksActivity.ACTION_LANGLINKS_FOR_TITLE); langIntent.putExtra(LangLinksActivity.EXTRA_PAGETITLE, model.getTitle()); getActivity().startActivityForResult(langIntent, PageActivity.ACTIVITY_REQUEST_LANGLINKS); return true; case R.id.menu_page_find_in_page: showFindInPage(); return true; case R.id.menu_page_font_and_theme: getPageActivity().showThemeChooser(); return true; case R.id.menu_page_show_tabs: tabsProvider.enterTabMode(); return true; default: return super.onOptionsItemSelected(item); } }</code><technical_language>I this listener is meant for handling long presses. Consider overloading ShareUtils.shareText(); a PageTitle variant calling instead PageActivityLongPressHandler.onShareLink()</technical_language>

Target:
public boolean onOptionsItemSelected(MenuItem item) { switch (item.getItemId()) { case R.id.homeAsUp: return true; case R.id.menu_page_save: app.getFunnelManager().getSavedPagesFunnel(model.getTitle().getSite()).logSaveNew(); if (model.getCurEntry().getSource() == HistoryEntry.SOURCE_SAVED_PAGE) { refreshPage(true); } else { savePage(); } return true; case R.id.menu_page_share: ShareUtils.shareText(getActivity(), model.getTitle()); return true; case R.id.menu_page_other_languages: Intent langIntent = new Intent(); langIntent.setClass(getActivity(), LangLinksActivity.class); langIntent.setAction(LangLinksActivity.ACTION_LANGLINKS_FOR_TITLE); langIntent.putExtra(LangLinksActivity.EXTRA_PAGETITLE, model.getTitle()); getActivity().startActivityForResult(langIntent, PageActivity.ACTIVITY_REQUEST_LANGLINKS); return true; case R.id.menu_page_find_in_page: showFindInPage(); return true; case R.id.menu_page_font_and_theme: getPageActivity().showThemeChooser(); return true; case R.id.menu_page_show_tabs: tabsProvider.enterTabMode(); return true; default: return super.onOptionsItemSelected(item); } }
Source:
<code>void shutdown() throws InterruptedException { <START> LOG.info("Synchronous shutdown requested"); <END> if (!statusRef.compareAndSet(RUNNING, PREPARING_TO_SHUTDOWN)) { shutdownLatch.await(); } else { doStopServices(); } }</code><technical_language>cleanup,</technical_language>

Target:
void shutdown() throws InterruptedException { LOG.debug("Synchronous shutdown requested"); if (!statusRef.compareAndSet(RUNNING, PREPARING_TO_SHUTDOWN)) { shutdownLatch.await(); } else { doStopServices(); } }
Source:
<code><START> public Integer getDownloadingVideosCountForSection(String enrollmentId, String chapter, <END> String section, final DataCallback<Integer> callback) { DbOperationGetCount op = new DbOperationGetCount(false, DbStructure.Table.DOWNLOADS, new String[]{DbStructure.Column.DM_ID}, DbStructure.Column.DOWNLOADED + "=? AND " + DbStructure.Column.EID + "=? AND " + DbStructure.Column.CHAPTER + "=? AND " + DbStructure.Column.SECTION + "=? AND " + DbStructure.Column.USERNAME + "=?", new String[]{String.valueOf(DownloadedState.DOWNLOADING.ordinal()), enrollmentId, chapter, section, username()}, null); op.setCallback(callback); return enqueue(op); }</code><technical_language>return primitives in methods, is point in returning objects. methods need changed though, if work leave for I guess</technical_language>

Target:
public int getDownloadingVideosCountForSection(String enrollmentId, String chapter, String section, final DataCallback<Integer> callback) { DbOperationGetCount op = new DbOperationGetCount(false, DbStructure.Table.DOWNLOADS, new String[]{DbStructure.Column.DM_ID}, DbStructure.Column.DOWNLOADED + "=? AND " + DbStructure.Column.EID + "=? AND " + DbStructure.Column.CHAPTER + "=? AND " + DbStructure.Column.SECTION + "=? AND " + DbStructure.Column.USERNAME + "=?", new String[]{String.valueOf(DownloadedState.DOWNLOADING.ordinal()), enrollmentId, chapter, section, username()}, null); op.setCallback(callback); return enqueue(op); }
Source:
<code>public void onActivityCreated(Bundle savedInstanceState) { super.onActivityCreated(savedInstanceState); setHasOptionsMenu(true); releaseYoutubePlayer(); <START> addOrRemoveYoutubePlayerFragment(VideoUtil.isAPIYoutubeSupported(getContext())); <END> attempts = 0; }</code><technical_language>I is need create method named addOrRemoveYoutubePlayerFragment replace this method call actual replace code. if(VideoUtil.isAPIYoutubeSupported(getContext())) { youTubePlayerFragment = new YouTubePlayerSupportFragment(); getChildFragmentManager().beginTransaction().replace(R.id.player_container, youTubePlayerFragment, "player").commit(); }</technical_language>

Target:
public void onActivityCreated(Bundle savedInstanceState) { super.onActivityCreated(savedInstanceState); setHasOptionsMenu(true); releaseYoutubePlayer(); if (VideoUtil.isYoutubeAPISupported(getContext())) { youTubePlayerFragment = new YouTubePlayerSupportFragment(); getChildFragmentManager().beginTransaction().replace(R.id.player_container, youTubePlayerFragment, "player").commit(); } attempts = 0; }
Source:
<code><START> void setUp() { <END> bibtex = new BibDatabaseContext(); bibtex.setMode(BibDatabaseMode.BIBTEX); biblatex = new BibDatabaseContext(); biblatex.setMode(BibDatabaseMode.BIBLATEX); checker = new EditionChecker(bibtex, true); checkerb = new EditionChecker(biblatex, true); entry = new BibEntry(); }</code><technical_language>Here, @BeforeEach is OK, is more happening creating objects</technical_language>

Target:
void setUp() { bibtex = new BibDatabaseContext(); bibtex.setMode(BibDatabaseMode.BIBTEX); biblatex = new BibDatabaseContext(); biblatex.setMode(BibDatabaseMode.BIBLATEX); checker = new EditionChecker(bibtex, true); checkerb = new EditionChecker(biblatex, true); }
Source:
<code>public boolean requiresWorkspaceForPolling() { final AccurevMode accurevMode = AccurevMode.findMode(this); final boolean needSlaveForPolling = !DESCRIPTOR.isPollOnMaster() || accurevMode.isRequiresWorkspace(); if(!needSlaveForPolling) { return needSlaveForPolling; } skipNextPoll = false; if (AccuRevSCMPollListener.getLastProject() != null) { <START> AbstractProject<?, ?> project = AccuRevSCMPollListener.getLastProject(); <END> AccuRevSCMPollListener.clearLastProject(); if(project.isBuilding()) { skipNextPoll = true; return false; } } return needSlaveForPolling; }</code><technical_language>@itavero AbstractProject<?, ?> project instance variable</technical_language>

Target:
public boolean requiresWorkspaceForPolling() { if (!DESCRIPTOR.isPollOnMaster() || (AccurevMode.findMode(this).isRequiresWorkspace()) || (activeProject != null && activeProject.isBuilding())) { return false; } activeProject = null; return true; }
Source:
<code>public void findAllSortedAsync_listOnSubObjectField() { Realm realm = looperThread.realm; String[] fieldNames = new String[2]; fieldNames[0] = AllTypes.FIELD_REALMOBJECT + "." + Dog.FIELD_AGE; fieldNames[1] = AllTypes.FIELD_REALMOBJECT + "." + Dog.FIELD_AGE; Sort[] sorts = new Sort[2]; sorts[0] = Sort.ASCENDING; sorts[1] = Sort.ASCENDING; populateTestRealm(realm, TEST_DATA_SIZE); RealmResults<AllTypes> results = realm.where(AllTypes.class) .findAllSorted(fieldNames, sorts); looperThread.keepStrongReference.add(results); <START> results.addChangeListener(new RealmChangeListener<RealmResults<AllTypes>>() { <END> @Override public void onChange(RealmResults<AllTypes> results) { assertEquals(0, results.get(0).getColumnRealmObject().getAge()); assertEquals(TEST_DATA_SIZE - 1, results.get(TEST_DATA_SIZE - 1).getColumnRealmObject().getAge()); looperThread.testComplete(); } }); }</code><technical_language>ditto - this is triggered</technical_language>

Target:
public void findAllSortedAsync_listOnSubObjectField() { Realm realm = looperThread.realm; String[] fieldNames = new String[2]; fieldNames[0] = AllTypes.FIELD_REALMOBJECT + "." + Dog.FIELD_AGE; fieldNames[1] = AllTypes.FIELD_REALMOBJECT + "." + Dog.FIELD_AGE; Sort[] sorts = new Sort[2]; sorts[0] = Sort.ASCENDING; sorts[1] = Sort.ASCENDING; populateTestRealm(realm, TEST_DATA_SIZE); RealmResults<AllTypes> results = realm.where(AllTypes.class) .findAllSortedAsync(fieldNames, sorts); looperThread.keepStrongReference.add(results); results.addChangeListener(new RealmChangeListener<RealmResults<AllTypes>>() { @Override public void onChange(RealmResults<AllTypes> results) { assertEquals(0, results.get(0).getColumnRealmObject().getAge()); assertEquals(TEST_DATA_SIZE - 1, results.get(TEST_DATA_SIZE - 1).getColumnRealmObject().getAge()); looperThread.testComplete(); } }); }
Source:
<code>protected void initContainersTable() { containersTable = new EntityModelCellTable<>(false, true); AbstractTextColumn<GuestContainer> idColumn = new AbstractTextColumn<GuestContainer>() { @Override public String getValue(GuestContainer row) { <START> return row.getId().toString(); <END> } }; AbstractTextColumn<GuestContainer> namesColumn = new AbstractTextColumn<GuestContainer>() { @Override public String getValue(GuestContainer row) { return StringUtils.join(row.getNames(), ", "); } }; AbstractTextColumn<GuestContainer> imageColumn = new AbstractTextColumn<GuestContainer>() { @Override public String getValue(GuestContainer row) { return row.getImage(); } }; AbstractTextColumn<GuestContainer> commandColumn = new AbstractTextColumn<GuestContainer>() { @Override public String getValue(GuestContainer row) { return row.getCommand(); } }; AbstractTextColumn<GuestContainer> statusColumn = new AbstractTextColumn<GuestContainer>() { @Override public String getValue(GuestContainer row) { return row.getStatus(); } }; containersTable.addColumn(idColumn, constants.idContainer()); containersTable.addColumn(namesColumn, constants.namesContainer()); containersTable.addColumn(imageColumn, constants.imageContainer()); containersTable.addColumn(commandColumn, constants.commandContainer()); containersTable.addColumn(statusColumn, constants.statusContainer()); containersTable.setRowData(new ArrayList<EntityModel>()); containersTable.setWidth("100%", true); containersTable.setSelectionModel(new NoSelectionModel()); }</code><technical_language>in VmGuestContainerListModelTable. null checks for column/field. If necessary please add here. if of fields null remove VmGuestContainerListModelTable</technical_language>

Target:
protected void initContainersTable() { containersTable = new EntityModelCellTable<>(false, true); containersTable.addColumn(new AbstractTextColumn<GuestContainer>() { @Override public String getValue(GuestContainer row) { return row.getId().toString(); } }, constants.idContainer()); containersTable.addColumn(new AbstractTextColumn<GuestContainer>() { @Override public String getValue(GuestContainer row) { return StringUtils.join(row.getNames(), ", "); } }, constants.namesContainer()); containersTable.addColumn(new AbstractTextColumn<GuestContainer>() { @Override public String getValue(GuestContainer row) { return row.getImage(); } }, constants.imageContainer()); containersTable.addColumn(new AbstractTextColumn<GuestContainer>() { @Override public String getValue(GuestContainer row) { return row.getCommand(); } }, constants.commandContainer()); containersTable.addColumn(new AbstractTextColumn<GuestContainer>() { @Override public String getValue(GuestContainer row) { return row.getStatus(); } }, constants.statusContainer()); containersTable.setRowData(new ArrayList<EntityModel>()); containersTable.setWidth("100%", true); containersTable.setSelectionModel(new NoSelectionModel()); }
Source:
<code>public void canDoActionFailsOnCompat() { cmd = spy(createTestCommand(volumeId1)); prepareMocks(cmd); doReturn(UNSUPPORTED_VERSION).when(vdsGroup).getCompatibilityVersion(); <START> assertFalse(cmd.canDoAction()); <END> }</code><technical_language>Please verify returned can-do-action message is VdcBllMessages.GLUSTER_TASKS_NOT_SUPPORTED_FOR_CLUSTER_LEVEL</technical_language>

Target:
public void canDoActionFailsOnCompat() { cmd = spy(createTestCommand(volumeId1)); prepareMocks(cmd); doReturn(UNSUPPORTED_VERSION).when(vdsGroup).getCompatibilityVersion(); assertFalse(cmd.canDoAction()); assertTrue(cmd.getReturnValue() .getCanDoActionMessages() .contains(VdcBllMessages.GLUSTER_TASKS_NOT_SUPPORTED_FOR_CLUSTER_LEVEL.toString())); }
Source:
<code>public List<QueryResult<CohortAclEntry>> getAcls(String studyStr, List<String> cohortList, boolean silent, String sessionId) throws CatalogException { MyResourceIds resource = getIds(cohortList, studyStr, sessionId); List<QueryResult<CohortAclEntry>> cohortAclList = new ArrayList<>(resource.getResourceIds().size()); for (Long cohortId : resource.getResourceIds()) { try { QueryResult<CohortAclEntry> allCohortAcls = authorizationManager.getAllCohortAcls(resource.getStudyId(), cohortId, resource.getUser()); allCohortAcls.setId(String.valueOf(cohortId)); cohortAclList.add(allCohortAcls); } catch (CatalogException e) { if (silent) { <START> cohortAclList.add(new QueryResult<>(studyStr, 0, 0, 0, "", e.toString(), new ArrayList<>(0))); <END> } else { throw e; } } } return cohortAclList; }</code><technical_language>id of queryResult studyStr element cohortList</technical_language>

Target:
public List<QueryResult<CohortAclEntry>> getAcls(String studyStr, List<String> cohortList, boolean silent, String sessionId) throws CatalogException { MyResourceIds resource = getIds(cohortList, studyStr, sessionId); List<QueryResult<CohortAclEntry>> cohortAclList = new ArrayList<>(resource.getResourceIds().size()); List<Long> resourceIds = resource.getResourceIds(); for (int i = 0; i < resourceIds.size(); i++) { Long cohortId = resourceIds.get(i); try { QueryResult<CohortAclEntry> allCohortAcls = authorizationManager.getAllCohortAcls(resource.getStudyId(), cohortId, resource.getUser()); allCohortAcls.setId(String.valueOf(cohortId)); cohortAclList.add(allCohortAcls); } catch (CatalogException e) { if (silent) { cohortAclList.add(new QueryResult<>(cohortList.get(i), 0, 0, 0, "", e.toString(), new ArrayList<>(0))); } else { throw e; } } } return cohortAclList; }
Source:
<code>private void fireNewSessionEvents() { final String sessionId = Long.toHexString(getSessionId()); for (final IZkStateListener stateListener : _stateListener) { <START> _eventThread.send(new ZkEvent("New session event sent to " + stateListener, sessionId) { <END> @Override public void run() throws Exception { stateListener.handleNewSession(sessionId); } }); } }</code><technical_language>longer required pass session Id event</technical_language>

Target:
private void fireNewSessionEvents() { for (final IZkStateListener stateListener : _stateListener) { _eventThread.send(new ZkEvent("New session event sent to " + stateListener) { @Override public void run() throws Exception { stateListener.handleNewSession(null); } }); } }
Source:
<code>public void close() throws IOException { <START> mScanner.close(); <END> mCloser.close(); }</code><technical_language>add mScanner Closer initialized. potentially NPE</technical_language>

Target:
public void close() throws IOException { closeScanner(mScanner); }
Source:
<code>public FileSinkCommittableSerializer( SimpleVersionedSerializer<InProgressFileWriter.PendingFileRecoverable> pendingFileSerializer, SimpleVersionedSerializer<InProgressFileWriter.InProgressFileRecoverable> inProgressFileSerializer) { <START> this.pendingFileSerializer = pendingFileSerializer; <END> this.inProgressFileSerializer = inProgressFileSerializer; }</code><technical_language>I add null checks here</technical_language>

Target:
public FileSinkCommittableSerializer( SimpleVersionedSerializer<InProgressFileWriter.PendingFileRecoverable> pendingFileSerializer, SimpleVersionedSerializer<InProgressFileWriter.InProgressFileRecoverable> inProgressFileSerializer) { this.pendingFileSerializer = checkNotNull(pendingFileSerializer); this.inProgressFileSerializer = checkNotNull(inProgressFileSerializer); }
Source:
<code><START> public synchronized int getCapacity() { <END> return capacity; }</code><technical_language>this method synchronized, considering capacity is final</technical_language>

Target:
public int getCapacity() { return capacity; }
Source:
<code>public void limit_withSortAndDistinct() { realm.executeTransaction(r -> { for (int i = 0; i < 5; i++) { r.createObject(AllTypes.class).setColumnLong(i % 5); } }); RealmResults<AllTypes> results = realm.where(AllTypes.class) .sort(AllTypes.FIELD_LONG, Sort.DESCENDING) .distinct(AllTypes.FIELD_LONG) .limit(2) .findAll(); assertEquals(2, results.size()); assertEquals(4, results.first().getColumnLong()); assertEquals(3, results.last().getColumnLong()); results = realm.where(AllTypes.class) <START> .limit(2) END> .distinct(AllTypes.FIELD_LONG) .sort(AllTypes.FIELD_LONG, Sort.DESCENDING) .findAll(); assertEquals(2, results.size()); assertEquals(1, results.first().getColumnLong()); assertEquals(0, results.last().getColumnLong()); results = realm.where(AllTypes.class) .distinct(AllTypes.FIELD_LONG) .limit(2) .sort(AllTypes.FIELD_LONG, Sort.DESCENDING) .findAll(); assertEquals(2, results.size()); assertEquals(1, results.first().getColumnLong()); assertEquals(0, results.last().getColumnLong()); }</code><technical_language>guarantees ascending order return [0, 1]</technical_language>

Target:
public void limit_withSortAndDistinct() { realm.beginTransaction(); RealmList<AllJavaTypes> list = realm.createObject(AllJavaTypes.class, -1).getFieldList(); for (int i = 0; i < 5; i++) { AllJavaTypes obj = realm.createObject(AllJavaTypes.class, i); obj.setFieldLong(i); list.add(obj); } realm.commitTransaction(); RealmResults<AllJavaTypes> results = list.where() .sort(AllJavaTypes.FIELD_LONG, Sort.DESCENDING) .distinct(AllJavaTypes.FIELD_LONG) .limit(2) .findAll(); assertEquals(2, results.size()); assertEquals(4, results.first().getFieldLong()); assertEquals(3, results.last().getFieldLong()); results = list.where() .limit(2) .distinct(AllJavaTypes.FIELD_LONG) .sort(AllJavaTypes.FIELD_LONG, Sort.DESCENDING) .findAll(); assertEquals(2, results.size()); assertEquals(1, results.first().getFieldLong()); assertEquals(0, results.last().getFieldLong()); results = list.where() .distinct(AllJavaTypes.FIELD_LONG) .limit(2) .sort(AllJavaTypes.FIELD_LONG, Sort.DESCENDING) .findAll(); assertEquals(2, results.size()); assertEquals(1, results.first().getFieldLong()); assertEquals(0, results.last().getFieldLong()); }
Source:
<code>public void close() { if (receiver == null) return; try { receiver.close().whenCompleteAsync((voidargs, error) -> { try { if (error != null) { logger.error("Exception during receiver close phase: " + error.toString()); } ehClient.closeSync(); } catch (Exception e) { logger.error("Exception during ehclient close phase: " + e.toString()); } }).get(); } catch (InterruptedException | ExecutionException e) { logger.warn("Exception occured during close phase: " + e.toString()); } <START> executorService.shutdown(); <END> logger.info("closed eventhub receiver: partitionId=" + partitionId); ehClient = null; receiver = null; executorService = null; }</code><technical_language>client executorservice, consider shutdownNow instead, shutdown execute entire queue of submitted tasks shutting down. consider adding awaitTermination close return service is properly closed</technical_language>

Target:
public void close() { try { if (receiver != null) { receiver.closeSync(); } } catch (EventHubException e) { logger.warn("Exception occurred while closing PartitionReceiver: " + e.toString()); } try { if (ehClient != null) { ehClient.closeSync(); } } catch (EventHubException e) { logger.warn("Exception occurred while closing EventHubClient: " + e.toString()); } executorService.shutdown(); try { executorService.awaitTermination(2, TimeUnit.SECONDS); } catch (InterruptedException e) { logger.warn("Exception occurred while terminating ExecutorService: " + e.toString()); } logger.info("closed eventhub receiver: partitionId=" + partitionId); ehClient = null; receiver = null; executorService = null; }
Source:
<code>public void createBucket(String bucketName) throws IOException { <START> logger.atFine().log("%s.create(%s)", delegateClassName, bucketName); <END> delegate.createBucket(bucketName); }</code><technical_language>update logging string well? possibly else</technical_language>

Target:
public void createBucket(String bucketName) throws IOException { logger.atFine().log("%s.createBucket(%s)", delegateClassName, bucketName); delegate.createBucket(bucketName); }
Source:
<code>protected void configure() { super.configure(); bind(new TypeLiteral<ComputeServiceAdapter<VMDeployment, VMHardware, VMImage, Location>>() { }).to(AzureComputeServiceAdapter.class); <START> bind(new TypeLiteral<Function<VMImage, org.jclouds.compute.domain.Image>>() { <END> }).to(VMImageToImage.class); bind(new TypeLiteral<Function<VMHardware, Hardware>>() { }).to(VMHardwareToHardware.class); bind(new TypeLiteral<Function<VMDeployment, NodeMetadata>>() { }).to(DeploymentToNodeMetadata.class); bind(new TypeLiteral<Function<Location, org.jclouds.domain.Location>>() { }).to(LocationToLocation.class); install(new LocationsFromComputeServiceAdapterModule<VMDeployment, VMHardware, VMImage, Location>() { }); bind(CreateNodesInGroupThenAddToSet.class).to(CreateResourceGroupThenCreateNodes.class); }</code><technical_language>added AzureComputeService need bind in ContextModule bind(ComputeService.class).to(AzureComputeService.class);</technical_language>

Target:
protected void configure() { super.configure(); bind(new TypeLiteral<ComputeServiceAdapter<VMDeployment, VMHardware, VMImage, Location>>() { }).to(AzureComputeServiceAdapter.class); bind(new TypeLiteral<Function<VMImage, org.jclouds.compute.domain.Image>>() { }).to(VMImageToImage.class); bind(new TypeLiteral<Function<VMHardware, Hardware>>() { }).to(VMHardwareToHardware.class); bind(new TypeLiteral<Function<VMDeployment, NodeMetadata>>() { }).to(DeploymentToNodeMetadata.class); bind(new TypeLiteral<Function<Location, org.jclouds.domain.Location>>() { }).to(LocationToLocation.class); bind(ComputeService.class).to(AzureComputeService.class); install(new LocationsFromComputeServiceAdapterModule<VMDeployment, VMHardware, VMImage, Location>() { }); bind(CreateNodesInGroupThenAddToSet.class).to(CreateResourceGroupThenCreateNodes.class); }
Source:
<code>private boolean checkNativeType( Value value, NativeType nativeType ) { <START> if ( nativeType == NativeType.ANY ) { <END> return true; } else if ( nativeType == NativeType.DOUBLE ) { return value.isDouble() || value.isInt(); } else if ( nativeType == NativeType.LONG ) { return value.isInt() || value.isLong(); } else if ( nativeType == NativeType.BOOL ) { return value.isBool(); } else if ( nativeType == NativeType.INT ) { return value.isInt(); } else if ( nativeType == NativeType.STRING ) { return value.isString(); } else if ( nativeType == NativeType.VOID ) { return value.valueObject() == null; } else if ( nativeType == NativeType.RAW ) { return value.isByteArray(); } return false; }</code><technical_language>This method reverted (the switch version is correct)</technical_language>

Target:
private boolean checkNativeType( Value value, NativeType nativeType ) { switch( nativeType ) { case ANY: return true; case DOUBLE: return value.isDouble() || value.isInt(); case LONG: return value.isLong() || value.isInt(); case BOOL: return value.isBool(); case INT: return value.isInt(); case STRING: return value.isString(); case VOID: return value.valueObject() == null; case RAW: return value.isByteArray(); } return false; }
Source:
<code>public void returnsCorrectInputWithUrl() throws Exception { <START> final Path file = BodyUrlTest.createTempFile(); <END> try { final byte[] bytes = new Utf8String("URL returnsCorrectInput!").asBytes(); try (InputStream input = new InputOf(bytes).stream()) { Files.copy(input, file, StandardCopyOption.REPLACE_EXISTING); } final Body.Url input = new Body.Url(file.toUri().toURL()); MatcherAssert.assertThat( "Body content of Body.Url doesn't provide the correct bytes", new BytesOf(input).asBytes(), new IsEqual<>(bytes) ); } finally { Files.deleteIfExists(file); } }</code><technical_language>@Serranya Please, Cactoos' TempFile instead of this method</technical_language>

Target:
public void returnsCorrectInputWithUrl() throws Exception { try (TempFile file = new TempFile()) { final Bytes body = new Utf8String("URL returnsCorrectInput!"); try (OutputStream outStream = new OutputTo(file.value()).stream()) { new LengthOf( new TeeInput(body, new OutputTo(outStream)) ).intValue(); } final Body.Url input = new Body.Url(file.value().toUri().toURL()); MatcherAssert.assertThat( "Body content of Body.Url doesn't provide the correct bytes", new BytesOf(input).asBytes(), new IsEqual<>(body.asBytes()) ); } }
Source:
<code>public void close() throws Exception { if (scopeCleaner.close()) { LOGGER.info("closing PreDestroyMonitor..."); synchronized(cleanupActions) { <START> List<Map.Entry<Object, UnscopedCleanupAction>> actions = new ArrayList<>(cleanupActions.entrySet()); <END> Collections.sort(actions, (a,b)->Long.compare(b.getValue().ordinal, a.getValue().ordinal)); for (Map.Entry<Object, UnscopedCleanupAction> action : actions) { action.getValue().call(action.getKey()); } if (actions.size() > 0) { LOGGER.warn("predestroy action invoked for unscoped instances", actions.size()); Map<Object, Long> actionsBySource = actions.stream().map(Map.Entry::getValue).collect( Collectors.groupingBy(UnscopedCleanupAction::getContext, Collectors.counting())); for (Map.Entry<Object, Long> entry : actionsBySource.entrySet()) { LOGGER.warn(" including objects from source '{}'", entry.getValue(), entry.getKey()); } } actions.clear(); cleanupActions.clear(); } scopeBindings.clear(); scopeBindings = Collections.emptyMap(); } else { LOGGER.warn("PreDestroyMonitor.close() invoked but instance is not running"); } }</code><technical_language>UnscopedCleanupAction implements Comparable. simplify this code streams, actions.entrySet() .stream() .sorted(Map.Entry.comparingByValue()) .forEach( action -> action.getValue().call(action.getKey()) );</technical_language>

Target:
public void close() throws Exception { if (scopeCleaner.close()) { LOGGER.info("closing PreDestroyMonitor..."); List<Map.Entry<Object, UnscopedCleanupAction>> actions = new ArrayList<>(cleanupActions.entrySet()); if (actions.size() > 0) { LOGGER.warn("invoking predestroy action for unscoped instances", actions.size()); actions.stream().map(Map.Entry::getValue).collect( Collectors.groupingBy(UnscopedCleanupAction::getContext, Collectors.counting())).forEach((source, count)->{ LOGGER.warn(" including objects from source '{}'", count, source); }); } actions.stream().sorted(Map.Entry.comparingByValue()).forEach(action->{ Optional.ofNullable(action.getKey()).ifPresent(obj->action.getValue().call(obj)); }); actions.clear(); cleanupActions.clear(); scopeBindings.clear(); scopeBindings = Collections.emptyMap(); } else { LOGGER.warn("PreDestroyMonitor.close() invoked but instance is not running"); } }
Source:
<code><START> public ObjectId <END> insert(int type, byte[] data, int off, int len, boolean createDuplicate) throws IOException { ObjectId id = idFor(type, data, off, len); if (!createDuplicate && db.has(id)) { return id; } else { File tmp = toTemp(type, data, off, len); return insertOneObject(tmp, id, createDuplicate); } }</code><technical_language>this need public? I caller is in package</technical_language>

Target:
ObjectId insert(int type, byte[] data, int off, int len, boolean createDuplicate) throws IOException { ObjectId id = idFor(type, data, off, len); if (!createDuplicate && db.has(id)) { return id; } else { File tmp = toTemp(type, data, off, len); return insertOneObject(tmp, id, createDuplicate); } }
Source:
<code><START> public boolean useNullForMissingParameters() { <END> return false; }</code><technical_language>protected, extended</technical_language>

Target:
protected boolean useNullForMissingParameters() { return false; }
Source:
<code>protected void handleDownload(Request req) throws IOException { <START> String[] arch = (String[]) req.getParams().get("arch"); <END> String archSuffix = ""; if (arch != null && arch.length > 0 && !arch[0].equals("amd64")) { archSuffix = "-" + arch[0]; } log.debug("Client is requesting item [{}]", req.getClient(), req.getItemName() + archSuffix); ConfigItem item = itemRegistry.getConfigItem(req.getItemName() + archSuffix); if (item == null) { log.debug("Item does not exist", req.getItemName() + archSuffix); item = itemRegistry.getConfigItem(req.getItemName()); if (item != null) { log.debug("Item exists", req.getItemName()); } } if (item == null) { log.info("Client requested unknown item [{}]", req.getClient(), req.getItemName()); req.setResponseCode(Request.NOT_FOUND); return; } if (!versionManager.isAssigned(req.getClient(), req.getItemName())) { if (item.isDynamicallyApplied()) { ConfigUpdateRequest updateRequest = new ConfigUpdateRequest(req.getClient()).withDeferredTrigger(true); updateRequest.addItem(req.getItemName()); versionManager.updateConfig(updateRequest); } else { log.error("Client requesting non-assigned item [{}]", req.getClient(), req.getItemName()); req.setResponseCode(Request.NOT_FOUND); return; } } log.info("Processing for client [{}]", req.getItemName(), req.getClient()); item.handleRequest(req); }</code><technical_language>this helper for this io.github.ibuildthecloud.gdapi.util.RequestUtils.makeSingularStringIfCan(Object)</technical_language>

Target:
protected void handleDownload(Request req) throws IOException { ConfigItem item = retrieveItem(req); if (item == null) { log.info("Client requested unknown item [{}]", req.getClient(), req.getItemName()); req.setResponseCode(Request.NOT_FOUND); return; } if (!versionManager.isAssigned(req.getClient(), req.getItemName())) { if (item.isDynamicallyApplied()) { ConfigUpdateRequest updateRequest = new ConfigUpdateRequest(req.getClient()).withDeferredTrigger(true); updateRequest.addItem(req.getItemName()); versionManager.updateConfig(updateRequest); } else { log.error("Client requesting non-assigned item [{}]", req.getClient(), req.getItemName()); req.setResponseCode(Request.NOT_FOUND); return; } } log.info("Processing for client [{}]", req.getItemName(), req.getClient()); item.handleRequest(req); }
Source:
<code>public String getRunningFlowIds() { Set<Runnable> inProgressTasks = executorService.getInProgressTasks(); List<Integer> runningFlowIds = new ArrayList<Integer>(inProgressTasks.size()); for (Runnable task : inProgressTasks) { <START> Integer execId = submittedFlows.get(task); <END> if (execId != null) { runningFlowIds.add(execId); } else { logger.warn("getRunningFlowIds: got null execId for task: " + task); } } Collections.sort(runningFlowIds); return runningFlowIds.toString(); }</code><technical_language>wondering this works -- able a in a Map<Future<?>, Integer> passing a Runnable key, Runnable Future in hierarchy</technical_language>

Target:
public String getRunningFlowIds() { Set<Runnable> inProgressTasks = executorService.getInProgressTasks(); List<Integer> runningFlowIds = new ArrayList<Integer>(inProgressTasks.size()); for (Runnable task : inProgressTasks) { Integer execId = submittedFlows.get((Future<?>) task); if (execId != null) { runningFlowIds.add(execId); } else { logger.warn("getRunningFlowIds: got null execId for task: " + task); } } Collections.sort(runningFlowIds); return runningFlowIds.toString(); }
Source:
<code><START> public String removeSuffix(String loaderFileName, char suffixTerm) { <END> return loaderFileName.substring(0, loaderFileName.lastIndexOf(suffixTerm)); }</code><technical_language>this need public</technical_language>

Target:
private String removeSuffix(String loaderFileName, char suffixTerm) { return loaderFileName.substring(0, loaderFileName.lastIndexOf(suffixTerm)); }
Source:
<code>private AuditLogable auditEventIpv4GatewayOutOfRange(NetworkAttachment attachment, IPv4Address address) { AuditLogable event = new AuditLogableImpl(); <START> event.setClusterId(getCluster().getId()); <END> event.setClusterName(getCluster().getName()); event.setVdsName(getVdsName()); event.addCustomValue("Interface", attachment.getNicName()); event.addCustomValue("Gateway", address.getGateway()); return event; }</code><technical_language>event.setVdsId(getVdsId()); I unsure, if is useful include clusterId, vdsId is required</technical_language>

Target:
private AuditLogable auditEventIpv4GatewayOutOfRange(NetworkAttachment attachment, IPv4Address address) { AuditLogable event = new AuditLogableImpl(); event.setVdsId(getVdsId()); event.setClusterName(getCluster().getName()); event.setVdsName(getVdsName()); event.addCustomValue("Interface", attachment.getNicName()); event.addCustomValue("Gateway", address.getGateway()); return event; }
Source:
<code>public void testCookieAuthWithoutRetry() throws IOException { if(IGNORE_AUTH_HEADERS){ System.err.println("Ignore cookie filters"); return; } <START> CookieFilter filter = new CookieFilter(System.getProperty("test.couch.username"),System.getProperty("test.couch.password")); <END> CouchConfig config = getCouchConfig("cookie_test"); HttpConnection conn = new HttpConnection("POST", config.getRootUri().toURL(), "application/json"); conn.responseFilters.add(filter); conn.requestFilters.add(filter); ByteArrayInputStream bis = new ByteArrayInputStream(data.getBytes()); Assert.assertEquals(bis.available(), data.getBytes().length); conn.setRequestBody(bis); conn.execute(); Assert.assertEquals(bis.available(), 0); Assert.assertEquals(2, conn.getResponseCode() / 100); JSONHelper helper = new JSONHelper(); Map<String,Object> jsonRes = helper.fromJson(new InputStreamReader(conn.getConnection() .getInputStream())); Assert.assertTrue(jsonRes.containsKey("ok")); Assert.assertTrue((Boolean)jsonRes.get("ok")); Assert.assertTrue(jsonRes.containsKey("id")); Assert.assertTrue(jsonRes.containsKey("rev")); }</code><technical_language>line length</technical_language>

Target:
public void testCookieAuthWithoutRetry() throws IOException { Assume.assumeFalse(IGNORE_AUTH_HEADERS); CookieFilter filter = new CookieFilter(System.getProperty("test.couch.username"), System.getProperty("test.couch.password")); CouchConfig config = getCouchConfig("cookie_test"); HttpConnection conn = new HttpConnection("POST", config.getRootUri().toURL(), "application/json"); conn.responseFilters.add(filter); conn.requestFilters.add(filter); ByteArrayInputStream bis = new ByteArrayInputStream(data.getBytes()); Assert.assertEquals(bis.available(), data.getBytes().length); conn.setRequestBody(bis); conn.execute(); Assert.assertEquals(bis.available(), 0); Assert.assertEquals(2, conn.getConnection().getResponseCode() / 100); JSONHelper helper = new JSONHelper(); Map<String,Object> jsonRes = helper.fromJson(new InputStreamReader(conn.getConnection() .getInputStream())); Assert.assertTrue(jsonRes.containsKey("ok")); Assert.assertTrue((Boolean)jsonRes.get("ok")); Assert.assertTrue(jsonRes.containsKey("id")); Assert.assertTrue(jsonRes.containsKey("rev")); }
Source:
<code>void validateAuthority(final URL authorizationEndpoint) throws AuthenticationException { verifyAuthorityValidInstance(authorizationEndpoint); if (AuthorityValidationMetadataCache.containsAuthorityHost(authorizationEndpoint)) { return; } final String authorityHost = authorizationEndpoint.getHost().toLowerCase(Locale.US); final String trustedHost; if (AAD_WHITELIST_HOSTS.contains(authorizationEndpoint.getHost().toLowerCase(Locale.US))) { trustedHost = authorityHost; } else { trustedHost = TRUSTED_QUERY_INSTANCE; } try { sLock = getLock(); sLock.lock(); <START> performInstanceDiscovery(authorizationEndpoint, trustedHost); <END> } finally { sLock.unlock(); } }</code><technical_language>this is dangerous. a lock a network request, request blocks for 10 minutes (like previously). block other validateAuthority request. is downside of making multiple discovery requests</technical_language>

Target:
void validateAuthority(final URL authorizationEndpoint) throws AuthenticationException { verifyAuthorityValidInstance(authorizationEndpoint); if (AuthorityValidationMetadataCache.containsAuthorityHost(authorizationEndpoint)) { return; } final String authorityHost = authorizationEndpoint.getHost().toLowerCase(Locale.US); final String trustedHost; if (AAD_WHITELISTED_HOSTS.contains(authorizationEndpoint.getHost().toLowerCase(Locale.US))) { trustedHost = authorityHost; } else { trustedHost = TRUSTED_QUERY_INSTANCE; } try { sLock = getLock(); sLock.lock(); performInstanceDiscovery(authorizationEndpoint, trustedHost); } finally { sLock.unlock(); } }
Source:
<code>private Logger configureLevels() { final Logger root = loggerContext.getLogger(org.slf4j.Logger.ROOT_LOGGER_NAME); <START> root.getLoggerContext().reset(); <END> final LevelChangePropagator propagator = new LevelChangePropagator(); propagator.setContext(root.getLoggerContext()); propagator.setResetJUL(true); root.getLoggerContext().addListener(propagator); root.setLevel(level); for (Map.Entry<String, Level> entry : loggers.entrySet()) { loggerContext.getLogger(entry.getKey()).setLevel(entry.getValue()); } return root; }</code><technical_language>replace calls root.getLoggerContext() loggerContext, if context a field</technical_language>

Target:
private Logger configureLevels() { final Logger root = loggerContext.getLogger(org.slf4j.Logger.ROOT_LOGGER_NAME); loggerContext.reset(); final LevelChangePropagator propagator = new LevelChangePropagator(); propagator.setContext(loggerContext); propagator.setResetJUL(true); loggerContext.addListener(propagator); root.setLevel(level); for (Map.Entry<String, Level> entry : loggers.entrySet()) { loggerContext.getLogger(entry.getKey()).setLevel(entry.getValue()); } return root; }
Source:
<code>private static JsonNode extractAuthJson(final Path configPath) throws IOException { <START> final ObjectMapper mapper = new ObjectMapper(); <END> final JsonNode config = mapper.readTree(configPath.toFile()); if (config.has("auths")) { return config.get("auths"); } return config; }</code><technical_language>this stored a field; ObjectMapper instance is threadsafe constructed</technical_language>

Target:
private static JsonNode extractAuthJson(final Path configPath) throws IOException { final JsonNode config = MAPPER.readTree(configPath.toFile()); if (config.has("auths")) { return config.get("auths"); } return config; }
Source:
<code>private void updateAutoSendStatus() { <START> LiveData<List<WorkInfo>> statuses = WorkManager.getInstance().getWorkInfosForUniqueWorkLiveData("AutoSendWorker"); <END> statuses.observe(this, workStatuses -> { if (workStatuses != null) { for (WorkInfo status : workStatuses) { if (status.getState().equals(WorkInfo.State.RUNNING)) { autoSendOngoing = true; return; } } autoSendOngoing = false; } }); }</code><technical_language>AUTO_SEND_TAG</technical_language>

Target:
private void updateAutoSendStatus() { LiveData<List<WorkInfo>> statuses = WorkManager.getInstance().getWorkInfosForUniqueWorkLiveData(SchedulerFormUpdateAndSubmitManager.AUTO_SEND_TAG); statuses.observe(this, workStatuses -> { if (workStatuses != null) { for (WorkInfo status : workStatuses) { if (status.getState().equals(WorkInfo.State.RUNNING)) { autoSendOngoing = true; return; } } autoSendOngoing = false; } }); }
Source:
<code>static ModelNode execute(final ManagementClient managementClient, final ModelNode op) throws IOException { ModelNode response = managementClient.getControllerClient().execute(op); assertTrue(response.isDefined()); ModelNode outcome = response.get(ModelDescriptionConstants.OUTCOME); assertTrue(outcome.isDefined()); if (!ModelDescriptionConstants.SUCCESS.equals(outcome.asString())) { <START> System.err.println(response); <END> } assertEquals(ModelDescriptionConstants.SUCCESS, outcome.asString()); return response.get(ModelDescriptionConstants.RESULT); }</code><technical_language>some reason, System.err is instead of Logger</technical_language>

Target:
static ModelNode execute(final ManagementClient managementClient, final ModelNode op) throws IOException { ModelNode response = managementClient.getControllerClient().execute(op); assertTrue(response.isDefined()); if (!Operations.isSuccessfulOutcome(response)) { Assert.fail(Operations.getFailureDescription(response).asString()); } return response.get(ModelDescriptionConstants.RESULT); }
Source:
<code>public Set<T> getModifiableItems(MethodLocation newItemsLocation) { return new AbstractSet<T>() { @Nonnull @Override public Iterator<T> iterator() { final Iterator<T> it = getImmutableItems().iterator(); return new Iterator<T>() { private @Nullable T currentItem = null; @Override public boolean hasNext() { return it.hasNext(); } @Override public T next() { currentItem = it.next(); return currentItem; } @Override public void remove() { if (currentItem != null) { currentItem.setLocation(null); } it.remove(); } }; } @Override public int size() { return getImmutableItems().size(); } @Override public boolean add(@Nonnull T item) { if (item.isPlaced()) { <START> throw new IllegalArgumentException(addLocatedItemError()); <END> } item.setLocation(newItemsLocation); getMutableItems().add(item); return true; } }; }</code><technical_language>getAddLocatedItemError()? "addLocatedItemError" implies method is adding error something</technical_language>

Target:
public Set<T> getModifiableItems(MethodLocation newItemsLocation) { return new AbstractSet<T>() { @Nonnull @Override public Iterator<T> iterator() { final Iterator<T> it = getItems().iterator(); return new Iterator<T>() { private @Nullable T currentItem = null; @Override public boolean hasNext() { return it.hasNext(); } @Override public T next() { currentItem = it.next(); return currentItem; } @Override public void remove() { if (currentItem != null) { currentItem.setLocation(null); } it.remove(); } }; } @Override public int size() { return getItems().size(); } @Override public boolean add(@Nonnull T item) { if (item.isPlaced()) { throw new IllegalArgumentException(getAddLocatedItemError()); } item.setLocation(newItemsLocation); addItem(item); return true; } }; }
Source:
<code>private void updateMetrics(Instant arrivalTime, Instant outputTime) { messagesCounter.inc(); <START> processingTimeHistogram.update(Duration.between(arrivalTime, outputTime).toMillis()); <END> }</code><technical_language>a metric smaller millis considering for jobs projection trivial processing</technical_language>

Target:
private void updateMetrics(Instant arrivalTime, Instant outputTime) { numEvents.inc(); processingTime.update(Duration.between(arrivalTime, outputTime).toNanos() / 1000L); }