auphong2707/dl4se-code-review-dataset huggingface dataset:
Source:
public static void patch(String token, final Patch.Key id, final int patchIndex, final PatchSetDetail patchSetDetail, final PatchTable patchTable, final PatchScreen.TopView topView, final String panelType) { final String parametersUrl; if (token.indexOf(DiffPatchScreen.URL_PARAMETER_MARK_START) != -1) { parametersUrl = token.substring(token.indexOf(DiffPatchScreen.URL_PARAMETER_MARK_START)+1); token = token.substring(0, token.indexOf(DiffPatchScreen.URL_PARAMETER_MARK_START)); }else{ parametersUrl=null; } final PatchScreen.TopView top = topView == null ? Gerrit.getPatchScreenTopView() : topView; GWT.runAsync(new AsyncSplit(token) { public void onSuccess() { Gerrit.display(token, select()); } private Screen select() { if (id != null) { String panel = panelType; if (panel == null) { int c = token.lastIndexOf(','); panel = 0 <= c ? token.substring(c + 1) : ""; } if ("".equals(panel)) { return new PatchScreen.SideBySide( id, patchIndex, patchSetDetail, patchTable, top, parametersUrl ); } else if ("unified".equals(panel)) { return new PatchScreen.Unified( id, patchIndex, patchSetDetail, patchTable, top, parametersUrl ); } } return new NotFoundScreen(); } }); }

Target:
public static void patch(String token, final Patch.Key id, final int patchIndex, final PatchSetDetail patchSetDetail, final PatchTable patchTable, final PatchScreen.TopView topView, final String panelType) { final PatchSet.Id baseId; if (token.contains(PatchLink.DIFF_WITH)) { String tailPart = token.substring(token.indexOf(PatchLink.DIFF_WITH) + 2); baseId = new PatchSet.Id(id.getParentKey().getParentKey(), Integer.valueOf( tailPart.substring(0, tailPart.indexOf("/"))).intValue()); } else { baseId = null; } final PatchScreen.TopView top = topView == null ? Gerrit.getPatchScreenTopView() : topView; GWT.runAsync(new AsyncSplit(token) { public void onSuccess() { Gerrit.display(token, select()); } private Screen select() { if (id != null) { String panel = panelType; if (panel == null) { int c = token.lastIndexOf(','); panel = 0 <= c ? token.substring(c + 1) : ""; } if ("".equals(panel)) { return new PatchScreen.SideBySide( id, patchIndex, patchSetDetail, patchTable, top, baseId ); } else if ("unified".equals(panel)) { return new PatchScreen.Unified( id, patchIndex, patchSetDetail, patchTable, top, baseId ); } } return new NotFoundScreen(); } }); }
Source:
protected Disk addLinks(Disk model, Class<? extends BaseResource> suggestedParent, String... subCollectionMembersToExclude) { if (model.isSetQuota() && model.getQuota().isSetId()) { Quota quota = getEntity(Quota.class, QueryType.GetQuotaByQuotaId, new IdQueryParameters(asGuid(model.getQuota().getId())), "quota"); model.getQuota().setDataCenter(new DataCenter()); model.getQuota().getDataCenter().setId(quota.getStoragePoolId().toString()); } Disk disk = super.addLinks(model, suggestedParent, subCollectionMembersToExclude); if (disk.isSetStorageDomains()) { disk.getStorageDomains().getStorageDomains().forEach( storageDomain -> LinkHelper.addLinks(storageDomain, null, false) ); } return disk; }

Target:
protected Disk addLinks(Disk model, Class<? extends BaseResource> suggestedParent, String... subCollectionMembersToExclude) { Disk disk = super.addLinks(model, suggestedParent, subCollectionMembersToExclude); if (disk.isSetStorageDomains()) { disk.getStorageDomains().getStorageDomains().forEach( storageDomain -> LinkHelper.addLinks(storageDomain, null, false) ); } return disk; }
Source:
TimedAverageMetrics(int windowDataSize, long windowTimeSize) { this(windowDataSize, windowTimeSize, System.nanoTime()); }

Target:
TimedAverageMetrics(int windowDataSize, long windowTimeSize) { this(windowDataSize, windowTimeSize, System.nanoTime() - windowTimeSize - 1); }
Source:
public static String getServiceCode(String handlerName) throws InvalidNameException { HashMap<String, String> diagnosticServices = new HashMap<String, String>(); diagnosticServices.put("LaboratoryHandler", "LAB"); diagnosticServices.put("RadiologyHandler", "RAD"); diagnosticServices.put("BloodBankHandler", "BLB"); diagnosticServices.put("CATScanHandler", "CT"); if (diagnosticServices.containsKey(handlerName)) { return diagnosticServices.get(handlerName); } else { throw new InvalidNameException( "<Handler Name should be one of 'Description' value in <LINK_0>> + Handler"); } }

Target:
public static String getServiceCode(String handlerName) throws InvalidNameException { HashMap<String, String> diagnosticServices = new HashMap<String, String>(); diagnosticServices.put("DefaultDiagnosticReportHandler", "DEFAULT"); diagnosticServices.put("LaboratoryHandler", "LAB"); diagnosticServices.put("RadiologyHandler", "RAD"); diagnosticServices.put("BloodBankHandler", "BLB"); diagnosticServices.put("CATScanHandler", "CT"); if (diagnosticServices.containsKey(handlerName)) { return diagnosticServices.get(handlerName); } else { throw new InvalidNameException( "<Handler Name should be one of 'Description' value in <LINK_0>> + Handler"); } }
Source:
private void adjustInputType(String currentText) { if (currentText != null && Pattern.matches("[+]\\d+", currentText)) { searchEditText.setInputType(InputType.TYPE_CLASS_PHONE); } else if (searchEditTextSpellcheck) { searchEditText.setInputType(SPELLCHECK_ENABLED_TYPE); } else { searchEditText.setInputType(InputType.TYPE_CLASS_TEXT); } }

Target:
private void adjustInputType(String currentText) { int currentInputType = searchEditText.getInputType(); int requiredInputType; if (currentText != null && Pattern.matches("[+]\\d+", currentText)) { requiredInputType = InputType.TYPE_CLASS_PHONE; } else if (searchEditTextSpellcheck) { requiredInputType = SPELLCHECK_ENABLED_INPUT_TYPE; } else { requiredInputType = DEFAULT_INPUT_TYPE; } if (currentInputType != requiredInputType) { searchEditText.setInputType(requiredInputType); } }
Source:
public void test_SystemProperties() { Properties originalProperties = System.getProperties(); try { Properties testProperties = new Properties(); testProperties.put("testIncInt", "notInt"); System.setProperties(testProperties); assertNull("returned incorrect default Integer", Integer.getInteger("testIncInt")); assertTrue("returned incorrect default Integer", Integer.getInteger("testIncInt", 4).equals(new Integer(4))); assertTrue("returned incorrect default Integer", Integer.getInteger( "testIncInt", new Integer(4)).equals(new Integer(4))); } finally { System.setProperties(originalProperties); } }

Target:
public void test_SystemProperties() { Properties originalProperties = System.getProperties(); try { Properties testProperties = new Properties(); testProperties.put("testIncInt", "notInt"); System.setProperties(testProperties); assertNull("returned incorrect default Integer", Integer.getInteger("testIncInt")); assertEquals(Integer.getInteger("testIncInt", 4), new Integer(4)); assertEquals(Integer.getInteger("testIncInt", new Integer(4)), new Integer(4)); } finally { System.setProperties(originalProperties); } }
Source:
public void eventThrowsBadException() { PublishSubject<String> stream = PublishSubject.create(); PublishSubject<String> lifecycle = PublishSubject.create(); TestObserver<String> testObserver = stream .compose(RxLifecycle.<String, String>bind(lifecycle, CORRESPONDING_EVENTS)) .test(); lifecycle.onNext("ick"); stream.onNext("1"); testObserver.assertNoValues(); testObserver.assertError(CompositeException.class); }

Target:
public void eventThrowsBadException() { PublishSubject<String> stream = PublishSubject.create(); PublishSubject<String> lifecycle = PublishSubject.create(); TestObserver<String> testObserver = stream .compose(RxLifecycle.<String, String>bind(lifecycle, CORRESPONDING_EVENTS)) .test(); lifecycle.onNext("ick"); stream.onNext("1"); testObserver.assertNoValues(); testObserver.assertError(new Predicate<Throwable>() { @Override public boolean test(Throwable throwable) throws Exception { if (throwable instanceof CompositeException) { CompositeException ce = (CompositeException) throwable; for (Throwable t : ce.getExceptions()) { if (t instanceof IllegalArgumentException) { return true; } } } return false; } }); }
Source:
public void factoryWithDirectUrlWithKeepDirectory() { String repositoryName = testRepo.getName(); testFactoryWithKeepDir.authenticateAndOpen(); theiaIde.switchToIdeFrame(); theiaIde.waitTheiaIde(); theiaIde.waitLoaderInvisibility(); theiaIde.waitNotificationDisappearance("Che Workspace: Finished cloning projects."); theiaIde.waitNotificationDisappearance( "Che Workspace: Finished cloning projects.", UPDATING_PROJECT_TIMEOUT_SEC); theiaProjectTree.waitFilesTab(); theiaProjectTree.clickOnFilesTab(); theiaProjectTree.waitProjectsRootItem(); theiaProjectTree.waitItem(repositoryName); theiaProjectTree.openItem(repositoryName + "/my-lib"); theiaProjectTree.waitItem(repositoryName + "/my-lib/src"); Assert.assertTrue(theiaProjectTree.isItemVisible(repositoryName + "/my-lib/pom.xml")); try { Assert.assertFalse(theiaProjectTree.isItemVisible(repositoryName + "/my-webapp")); } catch (AssertionError ex) { fail("Known permanent failure <LINK_0>"); } }

Target:
public void factoryWithDirectUrlWithKeepDirectory() { String repositoryName = testRepo.getName(); testFactoryWithKeepDir.authenticateAndOpen(); theiaIde.switchToIdeFrame(); theiaIde.waitTheiaIde(); theiaIde.waitLoaderInvisibility(); theiaIde.waitNotificationDisappearance( "Che Workspace: Finished cloning projects.", UPDATING_PROJECT_TIMEOUT_SEC); theiaProjectTree.waitFilesTab(); theiaProjectTree.clickOnFilesTab(); theiaProjectTree.waitProjectsRootItem(); theiaProjectTree.waitItem(repositoryName); theiaProjectTree.openItem(repositoryName + "/my-lib"); theiaProjectTree.waitItem(repositoryName + "/my-lib/src"); Assert.assertTrue(theiaProjectTree.isItemVisible(repositoryName + "/my-lib/pom.xml")); try { Assert.assertFalse(theiaProjectTree.isItemVisible(repositoryName + "/my-webapp")); } catch (AssertionError ex) { fail("Known permanent failure <LINK_0>"); } }
Source:
private void unlinkWebHook(final ReleaseWebHookResource resource) { if (resource == null) { throw new InvalidParameterException("event parameter is null"); } AbstractProject project = validateAndGetJenkinsProject(resource); String webHookNameToUnlink = resource.getWebHookName(); if (webHookNameToUnlink == null || webHookNameToUnlink.isEmpty()) { throw new InvalidParameterException("webhook name is empty"); } ReleaseWebHookAction action = getReleaseWebHookActionFromProject(project); if (action == null) { logger.fine(String.format("Cannot find ReleaseWebHook post build action")); return; } List<ReleaseWebHookName> webHookNames = action.getWebHookNames(); for (ReleaseWebHookName webHookName : webHookNames) { if (webHookName.getWebHookName().equalsIgnoreCase(webHookNameToUnlink)) { logger.fine(String.format("Found webhook %s in project %s. Removing it", webHookNameToUnlink, project.getName())); webHookNames.remove(webHookName); if (webHookNames.isEmpty()) { logger.fine(String.format("ReleaseWebHook post build action is empty, removing the post build action from project")); DescribableList<Publisher, Descriptor<Publisher>> publishersList = project.getPublishersList(); publishersList.remove(action); } saveProject(project); return; } } logger.fine(String.format("Cannnot find webhook with the name %s in project %s", webHookNameToUnlink, project.getName())); }

Target:
private void unlinkWebHook(final ReleaseWebHookResource resource) { if (resource == null) { throw new InvalidParameterException("resource is null"); } AbstractProject project = validateAndGetJenkinsProject(resource); String webHookNameToUnlink = resource.getWebHookName(); if (StringUtils.isBlank(webHookNameToUnlink)) { throw new InvalidParameterException("webhook name is empty"); } ReleaseWebHookAction action = getReleaseWebHookActionFromProject(project); if (action == null) { logger.fine(String.format("Cannot find ReleaseWebHook post build action")); return; } List<ReleaseWebHookReference> webHookReferences = action.getWebHookReferences(); for (ReleaseWebHookReference webHookReference : webHookReferences) { if (webHookReference.getWebHookName().equalsIgnoreCase(webHookNameToUnlink)) { logger.fine(String.format("Found webhook %s in project %s. Removing it", webHookNameToUnlink, project.getName())); webHookReferences.remove(webHookReference); if (webHookReferences.isEmpty()) { logger.fine(String.format("ReleaseWebHook post build action is empty, removing the post build action from project")); DescribableList<Publisher, Descriptor<Publisher>> publishersList = project.getPublishersList(); publishersList.remove(action); } saveProject(project); return; } } logger.fine(String.format("Cannnot find webhook with the name %s in project %s", webHookNameToUnlink, project.getName())); }
Source:
public void testDefaultWithContext() { Context.CancellableContext context = Context.current().withDeadlineAfter(1, TimeUnit.SECONDS, mockExecutor); context.run(new Runnable() { @Override public void run() { CallOptionsFactory factory = new CallOptionsFactory.Default(); Assert.assertEquals( Context.current().getDeadline().timeRemaining(TimeUnit.MILLISECONDS), getDeadlineMs(factory, null), 100.0 ); } }); }

Target:
public void testDefaultWithContext() { final Deadline deadline = DeadlineUtil.deadlineWithFixedTime(1, TimeUnit.SECONDS, NOW); Context.CancellableContext context = Context.current().withDeadline(deadline, mockExecutor); context.run(new Runnable() { @Override public void run() { CallOptionsFactory factory = new CallOptionsFactory.Default(); assertEqualsDeadlines( deadline.timeRemaining(TimeUnit.MILLISECONDS), getDeadlineMs(factory, null) ); } }); }
Source:
public RawPacket reverseTransform(RawPacket pkt) { if (enabled && !closed && pkt != null && pkt.getVersion() == 2) { incomingRawPacketCache.cachePacket(pkt); } return pkt; }

Target:
public RawPacket reverseTransform(RawPacket pkt) { if (enabled && !closed) { incomingRawPacketCache.cachePacket(pkt); } return pkt; }
Source:
public void setRuleParam(String ruleKey, String paramName, String paramValue) { if (!rules.containsKey(ruleKey)) { rules.put(ruleKey, new Rule(true)); } rules.get(ruleKey).params.put(paramName, paramValue); }

Target:
public void setRuleParam(String ruleKey, String paramName, String paramValue) { rules.computeIfAbsent(ruleKey, s -> new Rule(true)); rules.get(ruleKey).params.put(paramName, paramValue); }
Source:
public Set<Map.Entry<Long, Long>> multiGet(StoreNamespace storeNamespace, List<Long> keys) { Preconditions.checkArgument( availableColumnFamilies.containsKey(storeNamespace.uniqueName()), "Store namespace does not exist"); List<byte[]> byteKeys = keys.stream() .map(ValueType.VAR_LONG::convertFromJava) .collect(Collectors.toList()); List<byte[]> byteValues = multiGetValueBytes( availableColumnFamilies.get(storeNamespace.uniqueName()), byteKeys); if (byteValues.isEmpty()) { return ImmutableSet.of(); } return KeyedStream.ofEntries( Streams.zip( keys.stream(), byteValues.stream(), (key, value) -> { if (value == null) { return Maps.immutableEntry(key, null); } return Maps.immutableEntry( key, key + (Long) ValueType.VAR_LONG.convertToJava(value, 0)); })) .collectToMap() .entrySet(); }

Target:
public Map<Long, Long> multiGet(StoreNamespace storeNamespace, List<Long> keys) { checkNamespaceExists(storeNamespace); List<byte[]> byteKeys = keys.stream() .map(ValueType.VAR_LONG::convertFromJava) .collect(Collectors.toList()); List<byte[]> byteValues = multiGetValueBytes( availableColumnFamilies.get(storeNamespace.uniqueName()), byteKeys); if (byteValues.isEmpty()) { return ImmutableMap.of(); } return KeyedStream.ofEntries( Streams.zip( keys.stream(), byteValues.stream(), (key, value) -> Maps.immutableEntry(key, deserializeValue(key, value)))) .filter(Objects::nonNull) .collectToMap(); }
Source:
protected AbstractRemoteFileStreamingMessageSource(RemoteFileTemplate<F> template, Comparator<AbstractFileInfo<F>> comparator) { this.remoteFileTemplate = template; this.comparator = comparator; if (JacksonJsonUtils.isJackson2Present()) { this.objectMapper = JsonObjectMapperProvider.newInstanceBuilder(false).build(); } else { this.objectMapper = null; } }

Target:
protected AbstractRemoteFileStreamingMessageSource(RemoteFileTemplate<F> template, Comparator<AbstractFileInfo<F>> comparator) { this.remoteFileTemplate = template; this.comparator = comparator; }
Source:
private List<DataObject> getSeason(final SeasonProfile seasonProfile) throws IOException { final List<DataObject> seasonElements = new ArrayList<>(); seasonProfile.getSeasonProfileName(); seasonProfile.getSeasonStart(); seasonProfile.getWeekProfile().getWeekProfileName(); final DataObject seasonProfileNameObject = DataObject.newOctetStringData(seasonProfile.getSeasonProfileName() .getBytes(StandardCharsets.UTF_8)); seasonElements.add(seasonProfileNameObject); final DateTime dt = new DateTime(seasonProfile.getSeasonStart()); final DataObject seasonStartObject = this.dlmsHelperService.asDataObject(dt); seasonElements.add(seasonStartObject); final DataObject seasonWeekProfileNameObject = DataObject.newOctetStringData(seasonProfile.getWeekProfile() .getWeekProfileName().getBytes(StandardCharsets.UTF_8)); seasonElements.add(seasonWeekProfileNameObject); return seasonElements; }

Target:
private List<DataObject> getSeason(final SeasonProfile seasonProfile) throws IOException { final List<DataObject> seasonElements = new ArrayList<>(); final DataObject seasonProfileNameObject = DataObject.newOctetStringData(seasonProfile.getSeasonProfileName() .getBytes(StandardCharsets.UTF_8)); seasonElements.add(seasonProfileNameObject); final DateTime dt = new DateTime(seasonProfile.getSeasonStart()); final DataObject seasonStartObject = this.dlmsHelperService.asDataObject(dt); seasonElements.add(seasonStartObject); final DataObject seasonWeekProfileNameObject = DataObject.newOctetStringData(seasonProfile.getWeekProfile() .getWeekProfileName().getBytes(StandardCharsets.UTF_8)); seasonElements.add(seasonWeekProfileNameObject); return seasonElements; }
Source:
public void forArgsGeneratorTest() { List<Double> outputValues = new ArrayList<Double>(); class Output { List<Double> inputValues = new ArrayList<Double>(); int i; Output() { inputValues = Stream .iterate(10.0, last -> last - Double.valueOf(1)) .limit(10) .collect(Collectors.toList()); Collections.sort(inputValues); i = 0; } } final Output output = new Output(); batcher = caller .batcher() .forArgsGenerator(result -> (result == null || output.i<output.inputValues.size()) ? caller.args().param("param1", output.inputValues.get(output.i)) : null) .onCallSuccess(event -> { output.i+= 1; outputValues.add(event.getItem()); }) .onCallFailure((event, throwable) -> throwable.printStackTrace()); batcher.startJob(); batcher.awaitCompletion(); batcher.stopJob(); Collections.sort(outputValues); assertEquals("forArgsGenerator input not equal to output.", outputValues, output.inputValues); }

Target:
public void forArgsGeneratorTest() { List<Double> outputValues = new ArrayList<Double>(); final List<Double> inputValues = Stream .iterate(10.0, last -> last - Double.valueOf(1)) .limit(10) .collect(Collectors.toList()); Collections.sort(inputValues); class Output { int i = 0; } final Output output = new Output(); batcher = caller .batcher() .forArgsGenerator(result -> (result == null || output.i<inputValues.size()) ? caller.args().param("param1", inputValues.get(output.i)) : null) .onCallSuccess(event -> { output.i+= 1; outputValues.add(event.getItem()); }) .onCallFailure((event, throwable) -> throwable.printStackTrace()); batcher.startJob(); batcher.awaitCompletion(); batcher.stopJob(); Collections.sort(outputValues); assertEquals("forArgsGenerator input not equal to output.", outputValues, inputValues); }
Source:
public Abbreviation(String name, String abbreviation) { this(name, abbreviation, StringUtils.EMPTY); }

Target:
public Abbreviation(String name, String abbreviation) { this(name, abbreviation, StringUtil.EMPTY); }
Source:
private void close(final boolean clean) { if (state() == State.CREATED) { transitionTo(State.CLOSING); } else { if (state() == State.RUNNING) { closeTopology(clean); if (clean) { commitState(); stateMgr.checkpoint(checkpointableOffsets()); } else { executeAndMaybeSwallow(false, stateMgr::flush, "state manager flush"); } transitionTo(State.CLOSING); } else if (state() == State.RESTORING) { executeAndMaybeSwallow(clean, () -> { stateMgr.flush(); stateMgr.checkpoint(Collections.emptyMap()); }, "state manager flush and checkpoint"); transitionTo(State.CLOSING); } else if (state() == State.SUSPENDED) { transitionTo(State.CLOSING); } if (state() == State.CLOSING) { if (!clean && !eosDisabled) { StateManagerUtil.wipeStateStores(log, stateMgr); } StateManagerUtil.closeStateManager(log, logPrefix, clean, stateMgr, stateDirectory); executeAndMaybeSwallow(clean, recordCollector::close, "record collector close"); } else { throw new IllegalStateException("Illegal state " + state() + " while closing active task " + id); } } partitionGroup.close(); closeTaskSensor.record(); transitionTo(State.CLOSED); }

Target:
private void close(final boolean clean) { if (state() == State.CREATED) { transitionTo(State.CLOSING); } else { if (state() == State.RUNNING) { closeTopology(clean); if (clean) { commitState(); stateMgr.checkpoint(checkpointableOffsets()); } else { executeAndMaybeSwallow(false, stateMgr::flush, "state manager flush"); } transitionTo(State.CLOSING); } else if (state() == State.RESTORING) { executeAndMaybeSwallow(clean, () -> { stateMgr.flush(); stateMgr.checkpoint(Collections.emptyMap()); }, "state manager flush and checkpoint"); transitionTo(State.CLOSING); } else if (state() == State.SUSPENDED) { transitionTo(State.CLOSING); } if (state() == State.CLOSING) { final boolean wipeStateStore = !clean && !eosDisabled; StateManagerUtil.closeStateManager(log, logPrefix, clean, wipeStateStore, stateMgr, stateDirectory, TaskType.ACTIVE); executeAndMaybeSwallow(clean, recordCollector::close, "record collector close"); } else { throw new IllegalStateException("Illegal state " + state() + " while closing active task " + id); } } partitionGroup.close(); closeTaskSensor.record(); transitionTo(State.CLOSED); }
Source:
private static AtlasDbRuntimeConfigRefreshable createPolling(Supplier<Optional<AtlasDbRuntimeConfig>> config) { DefaultRefreshable<Optional<AtlasDbRuntimeConfig>> refreshable = new DefaultRefreshable<>(call(config)); ScheduledExecutorService executor = PTExecutors.newSingleThreadScheduledExecutor(); executor.scheduleWithFixedDelay( () -> { try { refreshable.update(config.get()); } catch (Throwable e) { log.error("Failed to reload runtime config", e); } }, REFRESH_INTERVAL.toNanos(), REFRESH_INTERVAL.toNanos(), TimeUnit.NANOSECONDS); return new AtlasDbRuntimeConfigRefreshable(refreshable, () -> { if (!MoreExecutors.shutdownAndAwaitTermination( executor, GRACEFUL_SHUTDOWN.toMillis(), TimeUnit.MILLISECONDS)) { log.error("Executor did not terminate within graceful shutdown duration"); } }); }

Target:
private static AtlasDbRuntimeConfigRefreshable createPolling(Supplier<Optional<AtlasDbRuntimeConfig>> config) { DefaultRefreshable<Optional<AtlasDbRuntimeConfig>> refreshable = new DefaultRefreshable<>(call(config)); ScheduledExecutorService executor = PTExecutors.newSingleThreadScheduledExecutor(); executor.scheduleWithFixedDelay( () -> { try { refreshable.update(config.get()); } catch (Throwable e) { log.error("Failed to reload runtime config", e); } }, REFRESH_INTERVAL.toNanos(), REFRESH_INTERVAL.toNanos(), TimeUnit.NANOSECONDS); return new AtlasDbRuntimeConfigRefreshable(refreshable, () -> { if (!MoreExecutors.shutdownAndAwaitTermination( executor, GRACEFUL_SHUTDOWN.toMillis(), TimeUnit.MILLISECONDS)) { log.warn("Executor did not terminate within graceful shutdown duration"); } }); }
Source:
private void setupTestsFiltering(TestNG testNG) { if (!options.getTestGroups().isEmpty()) { System.setProperty(TestNameGroupNameMethodSelector.TEST_GROUPS_TO_RUN_PROPERTY, Joiner.on(',').join(options.getTestGroups())); } if (!options.getExcludeGroups().isEmpty()) { System.setProperty(TestNameGroupNameMethodSelector.TEST_GROUPS_TO_EXCLUDE_PROPERTY, Joiner.on(',').join(options.getExcludeGroups())); } if (!options.getTests().isEmpty()) { System.setProperty(TestNameGroupNameMethodSelector.TEST_NAMES_TO_RUN_PROPERTY, Joiner.on(',').join(options.getTests())); } testNG.addMethodSelector("com.teradata.tempto.internal.listeners.TestNameGroupNameMethodSelector", 20); }

Target:
private void setupTestsFiltering(TestNG testNG) { if (!options.getTestGroups().isEmpty()) { System.setProperty(TEST_GROUPS_TO_RUN_PROPERTY, Joiner.on(',').join(options.getTestGroups())); } if (!options.getExcludeGroups().isEmpty()) { System.setProperty(TEST_GROUPS_TO_EXCLUDE_PROPERTY, Joiner.on(',').join(options.getExcludeGroups())); } if (!options.getTests().isEmpty()) { System.setProperty(TEST_NAMES_TO_RUN_PROPERTY, Joiner.on(',').join(options.getTests())); } testNG.addMethodSelector(METHOD_SELECTOR_CLASS_NAME, METHOD_SELECTOR_PRIORITY); }
Source:
public List<Composition> searchEncounterComposition(String id) { org.openmrs.Encounter omrsEncounter = Context.getEncounterService().getEncounterByUuid(id); List<Composition> encounterList = new ArrayList<Composition>(); if (omrsEncounter != null) { try { encounterList.add(FHIREncounterUtil.generateComposition(omrsEncounter)); } catch (FHIRException e) { String msg = "Error while searching the encounter composition"; log.error(msg, e); } } return encounterList; }

Target:
public List<Composition> searchEncounterComposition(String id) { org.openmrs.Encounter omrsEncounter = Context.getEncounterService().getEncounterByUuid(id); List<Composition> encounterList = new ArrayList<Composition>(); if (omrsEncounter != null) { try { encounterList.add(FHIREncounterUtil.generateComposition(omrsEncounter)); } catch (FHIRException e) { String msg = "Error while searching the encounter composition with id " + id; log.error(msg, e); } } return encounterList; }
Source:
public Session start(String deviceUUID) { checkNotNull(deviceUUID, "deviceUUID parameter must not be null"); checkArgument(!deviceUUID.trim().isEmpty(), "deviceUUID must not be empty"); String url = "/sync/start"; Response response = this.httpClient.request(HttpMethod.POST, url, null, buildHeaders(deviceUUID), null); if (response.getHttpStatus() == 204) { log.info("Received 204 from sync start. Nothing to fetch."); return null; } final Session session = SessionDeserializer.deserialize(JsonDeserializer.deserializeRaw(response.getBody())); if (session != null) { log.info("Started sync process with pending queues: {}", session.getQueues()); } else { log.warn("Sync process will not be started due to missing session data: {}", response); } return session; }

Target:
public Session start(String deviceUUID) { checkNotNull(deviceUUID, "deviceUUID parameter must not be null"); checkArgument(!deviceUUID.trim().isEmpty(), "deviceUUID must not be empty"); String url = "/sync/start"; Response response = this.httpClient.request(HttpMethod.POST, url, null, buildHeaders(deviceUUID), null); if (noConent(response)) { log.info("Received 204 from sync start. Nothing to fetch."); return null; } final Session session = SessionDeserializer.deserialize(JsonDeserializer.deserializeRaw(response.getBody())); if (session != null) { log.info("Started sync process with pending queues: {}", session.getQueues()); } else { log.warn("Sync process will not be started due to missing session data: {}", response); } return session; }
Source:
public synchronized void updateCatalog(CatalogContext catalogContext, HostMessenger messenger) { try { Map<String, ImportConfiguration> newProcessorConfig = loadNewConfigAndBundles(catalogContext); if (VoltDB.instance().getMode() == OperationMode.RUNNING && (m_processorConfig == null || !m_processorConfig.equals(newProcessorConfig))) { close(); startImporters(newProcessorConfig); readyForDataInternal(catalogContext, messenger); } else if (VoltDB.instance().getMode() != OperationMode.RUNNING){ importLog.info("Catalog update is not restarting importers because cluster state is " + VoltDB.instance().getMode()); } } catch (final Exception e) { VoltDB.crashLocalVoltDB("Error updating importers with new DDL and/or deployment.", true, e); } }

Target:
public synchronized void updateCatalog(CatalogContext catalogContext, HostMessenger messenger) { try { Map<String, ImportConfiguration> newProcessorConfig = loadNewConfigAndBundles(catalogContext); if (m_processorConfig == null || !m_processorConfig.equals(newProcessorConfig)) { OperationMode clusterMode = VoltDB.instance().getMode(); if (clusterMode != OperationMode.PAUSED) { close(); startImporters(newProcessorConfig); readyForDataInternal(catalogContext, messenger); } else if (importLog.isDebugEnabled()) { importLog.debug("Catalog update is not restarting importers because cluster state is " + clusterMode); } } } catch (final Exception e) { VoltDB.crashLocalVoltDB("Error updating importers with new DDL and/or deployment.", true, e); } }
Source:
public ProcessInstanceRerunTest() throws IOException { super(); cluster = servers.get(1); clusterFS = cluster.getClusterHelper().getHadoopFS(); }

Target:
public ProcessInstanceRerunTest() throws IOException { super(); cluster = servers.get(1); clusterFS = serverFS.get(1); }
Source:
private Socket tryConnect() throws IOException { final InetAddress inetAddress = InetAddress.getByName(address); int count = 0; while (true) { try { getLog().info( format("Connecting to %s:%s", inetAddress, Integer.valueOf(port))); return new Socket(inetAddress, port); } catch (final IOException e) { if (++count > retryCount) { throw e; } getLog().info(e.getMessage()); try { Thread.sleep(1000); } catch (final InterruptedException ie) { throw new InterruptedIOException(); } } } }

Target:
private Socket tryConnect() throws IOException { final InetAddress inetAddress = InetAddress.getByName(address); int count = 0; while (true) { try { getLog().info( format("Connecting to %s:%s", inetAddress, Integer.valueOf(port))); return new Socket(inetAddress, port); } catch (final IOException e) { if (++count > retryCount) { throw e; } getLog().info(e.getMessage()); sleep(); } } }
Source:
public Date getTimeAfter(Date afterTime) { Date currentStartDate = getStartDate(); if (hasFloatingStartDate()) { try { clearCandidates(); setStartDate(afterTime); } catch (IllegalArgumentException | ParseException e) { logger.error("An exception occurred while setting the start date : '{}'", e.getMessage()); } } if (getCandidates().isEmpty()) { try { setStartDate(afterTime); } catch (ParseException e) { logger.error("An exception occurred while setting the start date : '{}'", e.getMessage()); } } if (!getCandidates().isEmpty()) { if (getCandidates().size() == 1) { return getCandidates().get(0); } else { while (getCandidates().size() > 1) { Collections.sort(getCandidates()); Date newStartDate = null; try { for (Date candidate : getCandidates()) { newStartDate = candidate; if (candidate.after(afterTime)) { setStartDate(currentStartDate); return candidate; } } clearCandidates(); setStartDate(newStartDate); } catch (IllegalArgumentException | ParseException e) { logger.error("An exception occurred while parsing the expression : '{}'", e.getMessage()); } } } } return null; }

Target:
public Date getTimeAfter(Date afterTime) { Date currentStartDate = getStartDate(); if (hasFloatingStartDate()) { try { clearCandidates(); setStartDate(afterTime); } catch (IllegalArgumentException | ParseException e) { logger.error("An exception occurred while setting the start date : '{}'", e.getMessage()); } } else if (getCandidates().isEmpty()) { try { setStartDate(afterTime); } catch (ParseException e) { logger.error("An exception occurred while setting the start date : '{}'", e.getMessage()); } } if (!getCandidates().isEmpty()) { if (getCandidates().size() == 1) { return getCandidates().get(0); } else { while (getCandidates().size() > 1) { Collections.sort(getCandidates()); Date newStartDate = null; try { for (Date candidate : getCandidates()) { newStartDate = candidate; if (candidate.after(afterTime)) { setStartDate(currentStartDate); return candidate; } } clearCandidates(); setStartDate(newStartDate); } catch (IllegalArgumentException | ParseException e) { logger.error("An exception occurred while parsing the expression : '{}'", e.getMessage()); } } } } return null; }
Source:
protected abstract ModelNode buildRequestWithoutHeaders(CommandContext ctx) throws CommandFormatException; protected void addHeaders(CommandContext ctx, ModelNode request) throws CommandFormatException { if(!headers.isPresent(ctx.getParsedCommandLine())) { return; } final ModelNode headersNode = headers.toModelNode(ctx); if (headersNode != null && headersNode.getType() != ModelType.OBJECT) { throw new IllegalArgumentException("--headers option has wrong value '"+headersNode+"'"); } final ModelNode opHeaders = request.get(Util.OPERATION_HEADERS); opHeaders.set(headersNode); }

Target:
protected abstract ModelNode buildRequestWithoutHeaders(CommandContext ctx) throws CommandFormatException; protected void addHeaders(CommandContext ctx, ModelNode request) throws CommandFormatException { if(!headers.isPresent(ctx.getParsedCommandLine())) { return; } final ModelNode headersNode = headers.toModelNode(ctx); if (headersNode != null && headersNode.getType() != ModelType.OBJECT) { throw new CommandFormatException("--headers option has wrong value '"+headersNode+"'"); } final ModelNode opHeaders = request.get(Util.OPERATION_HEADERS); opHeaders.set(headersNode); }
Source:
public void testInvoiceItemMetadata() throws StripeException { Customer customer = Customer.create(defaultCustomerParams); defaultInvoiceItemParams.put("customer", customer.getId()); testMetadata(InvoiceItem.create(defaultInvoiceItemParams)); }

Target:
public void testInvoiceItemMetadata() throws StripeException { testMetadata(InvoiceItem.create(getInvoiceItemParams())); }
Source:
private List<Obs> getObsLeaves(Obs obsParent) { List<Obs> leaves = new ArrayList<>(); if (obsParent.hasGroupMembers()) { for (Obs child : obsParent.getGroupMembers()) { if (!child.getVoided() && !child.isObsGrouping()) { leaves.add(child); } else if (!child.getVoided()){ leaves.addAll(getObsLeaves(child)); } } } else if (!obsParent.getVoided()) { leaves.add(obsParent); } return leaves; }

Target:
private List<Obs> getObsLeaves(Obs obsParent) { List<Obs> leaves = new ArrayList<>(); if (obsParent.hasGroupMembers()) { obsParent.getGroupMembers().forEach((child) -> { if (!child.getVoided() && !child.isObsGrouping()) { leaves.add(child); } else if (!child.getVoided() && child.isObsGrouping()) { leaves.addAll(getObsLeaves(child)); } }); } else if (!obsParent.getVoided()) { leaves.add(obsParent); } return leaves; }
Source:
public CustomFormSubmodel(final Float accuracy, final Map<String, CustomFormModelField> fields, final String formType) { this.accuracy = accuracy; this.fields = fields == null ? null : Collections.unmodifiableMap(new HashMap<>(fields)); this.formType = formType; }

Target:
public CustomFormSubmodel(final Float accuracy, final Map<String, CustomFormModelField> fields, final String formType) { this.accuracy = accuracy; this.fields = fields == null ? null : Collections.unmodifiableMap(fields); this.formType = formType; }
Source:
private static void asMemoryInteger(JsonNode payload, String key, Consumer<Integer> consumer) { as(payload, key, raw -> { if (raw.isNumber()) { return raw.asInt(); } else if (raw.isTextual()) { String text = raw.asText(); if (text.toUpperCase().endsWith("G")) { return Integer.parseInt(text.substring(0, text.length() - 1)) * GIBI; } else if (text.toUpperCase().endsWith("GB")) { return Integer.parseInt(text.substring(0, text.length() - 2)) * GIBI; } else if (text.toUpperCase().endsWith("M")) { return Integer.parseInt(text.substring(0, text.length() - 1)); } else if (text.toUpperCase().endsWith("MB")) { return Integer.parseInt(text.substring(0, text.length() - 2)); } else { return 0; } } else { return 0; } }, consumer); }

Target:
private static void asMemoryInteger(JsonNode payload, String key, Consumer<Integer> consumer) { as(payload, key, raw -> { if (raw.isNumber()) { return raw.asInt(); } else if (raw.isTextual()) { String text = raw.asText().toUpperCase(); if (text.endsWith("G")) { return Integer.parseInt(text.substring(0, text.length() - 1)) * GIBI; } else if (text.endsWith("GB")) { return Integer.parseInt(text.substring(0, text.length() - 2)) * GIBI; } else if (text.endsWith("M")) { return Integer.parseInt(text.substring(0, text.length() - 1)); } else if (text.endsWith("MB")) { return Integer.parseInt(text.substring(0, text.length() - 2)); } else { return 0; } } else { return 0; } }, consumer); }
Source:
private int normalizeAndValidatePageSize(int pageSize) throws WrongRequestParameterException { int currentPageSize = normalizePageSize(pageSize); validate(currentPageSize, (n) -> n<=0, PAGE_SIZE, "should be positive"); validate(currentPageSize, (n) -> n>maxPageSize, PAGE_SIZE, "can't be bigger than "+maxPageSize); validate(currentPageSize, (n) -> n<minPageSize, PAGE_SIZE, "can't be less than "+minPageSize); return currentPageSize; }

Target:
private int normalizeAndValidatePageSize(int pageSize) throws WrongRequestParameterException { int currentPageSize = normalizePageSize(pageSize); validate(currentPageSize, (n) -> n<=0, PAGE_SIZE, "may not be negative"); validate(currentPageSize, (n) -> n>maxPageSize, PAGE_SIZE, "may not be greater than "+maxPageSize); validate(currentPageSize, (n) -> n<minPageSize, PAGE_SIZE, "may not be less than "+minPageSize); return currentPageSize; }
Source:
public static String getDefaultOpencgaHome() { return System.getenv("OPENCGA_HOME") != null ? System.getenv("OPENCGA_HOME") : "./src/main/resources/opencga/"; }

Target:
public static String getDefaultOpencgaHome() { return System.getenv("OPENCGA_HOME") != null ? System.getenv("OPENCGA_HOME") : GenotypedVcfJobTestUtils.class.getResource("/opencga/").getFile(); }
Source:
StubWithGlobalSecondaryIndexItem randomStubWithGlobalSecondaryIndexItem() { final StubWithGlobalSecondaryIndexItem stubItem = new StubWithGlobalSecondaryIndexItem(); stubItem.setId(randomId()); stubItem.setGsi(randomString(10)); stubItem.setGsiSupportingValue(randomInt(100)); stubItem.setVersion((long) randomInt(100)); return stubItem; }

Target:
public StubWithGlobalSecondaryIndexItem randomStubWithGlobalSecondaryIndexItem() { final StubWithGlobalSecondaryIndexItem stubItem = new StubWithGlobalSecondaryIndexItem(); stubItem.setId(randomId()); stubItem.setGsi(randomString(10)); stubItem.setGsiSupportingValue(randomInt(100)); stubItem.setVersion((long) randomInt(100)); return stubItem; }
Source:
public List<QueryError> getWarnings() { return warnings.get(); }

Target:
public List<QueryError> getWarnings() { synchronized (warnings) { return ImmutableList.copyOf(warnings); } }
Source:
private void processTxFromBestChain(Transaction tx, boolean forceAddToPool) throws VerificationException { checkState(lock.isHeldByCurrentThread()); checkState(!pending.containsKey(tx.getHash())); boolean isDeadCoinbase = tx.isCoinBase() && dead.containsKey(tx.getHash()); if (isDeadCoinbase) { log.info(" coinbase tx <-dead: confidence {}", tx.getHashAsString(), tx.getConfidence().getConfidenceType().name()); dead.remove(tx.getHash()); } updateForSpends(tx, true); boolean hasOutputsToMe = tx.getValueSentToMe(this).signum() > 0; if (hasOutputsToMe) { if (tx.isEveryOwnedOutputSpent(this)) { log.info(" tx ->spent (by pending)", tx.getHashAsString()); addWalletTransaction(Pool.SPENT, tx); } else { log.info(" tx ->unspent", tx.getHashAsString()); addWalletTransaction(Pool.UNSPENT, tx); } } else if (tx.getValueSentFromMe(this).signum() > 0) { log.info(" tx ->spent", tx.getHashAsString()); addWalletTransaction(Pool.SPENT, tx); } else if (forceAddToPool) { log.info(" tx ->spent (manually added)", tx.getHashAsString()); addWalletTransaction(Pool.SPENT, tx); } Set<Transaction> doubleSpendTxns = findDoubleSpendsAgainst(tx, pending); if (!doubleSpendTxns.isEmpty()) { killTxns(doubleSpendTxns, tx); for(TransactionInput input : tx.getInputs()) { TransactionOutput output = input.getOutpoint().getConnectedOutput(); if(output != null && !output.isMine(this)) { input.disconnect(); } } } }

Target:
private void processTxFromBestChain(Transaction tx, boolean forceAddToPool) throws VerificationException { checkState(lock.isHeldByCurrentThread()); checkState(!pending.containsKey(tx.getHash())); boolean isDeadCoinbase = tx.isCoinBase() && dead.containsKey(tx.getHash()); if (isDeadCoinbase) { log.info(" coinbase tx <-dead: confidence {}", tx.getHashAsString(), tx.getConfidence().getConfidenceType().name()); dead.remove(tx.getHash()); } updateForSpends(tx, true); boolean hasOutputsToMe = tx.getValueSentToMe(this).signum() > 0; boolean hasOutputsFromMe = false; if (hasOutputsToMe) { if (tx.isEveryOwnedOutputSpent(this)) { log.info(" tx ->spent (by pending)", tx.getHashAsString()); addWalletTransaction(Pool.SPENT, tx); } else { log.info(" tx ->unspent", tx.getHashAsString()); addWalletTransaction(Pool.UNSPENT, tx); } } else if (tx.getValueSentFromMe(this).signum() > 0) { hasOutputsFromMe = true; log.info(" tx ->spent", tx.getHashAsString()); addWalletTransaction(Pool.SPENT, tx); } else if (forceAddToPool) { log.info(" tx ->spent (manually added)", tx.getHashAsString()); addWalletTransaction(Pool.SPENT, tx); } Set<Transaction> doubleSpendTxns = findDoubleSpendsAgainst(tx, pending); if (!doubleSpendTxns.isEmpty()) { killTxns(doubleSpendTxns, tx); } if( !hasOutputsToMe && !hasOutputsFromMe && !forceAddToPool && !findDoubleSpendsAgainst(tx, transactions).isEmpty()) { for (TransactionInput input : tx.getInputs()) { TransactionOutput output = input.getConnectedOutput(); if(output != null && !output.isMineOrWatched(this)) { input.disconnect(); } } } }
Source:
public static void renameStorageConfig() throws IOException { File sourceFile = new File(Utils.getWorkDirectory(), "credentials.xml"); File backUp; if (!sourceFile.exists()) { return; } LOGGER.log(Level.INFO, sourceFile + " exists, rename azure storage credential will start now..."); backUp = backupFile(sourceFile.getCanonicalPath()); Path path = Paths.get(sourceFile.getCanonicalPath()); try (Stream<String> stream = Files.lines(path)) { boolean needRename = stream.anyMatch(s -> s.contains(SOURCE_CONTENT)); if (!needRename) { return; } } try (Stream<String> stream = Files.lines(path)) { List<String> collect = stream .map(s -> s.replace(SOURCE_CONTENT, TARGET_CONTENT)) .collect(Collectors.toList()); Files.write(path, collect); } catch (IOException e) { LOGGER.warning("Fail to rename azure storage credential in credentials.xml file"); recoverFile(backUp.getCanonicalPath()); } removeFile(backUp.getCanonicalPath()); }

Target:
public static void renameStorageConfig() throws IOException { File sourceFile = new File(Utils.getWorkDirectory(), "credentials.xml"); if (!sourceFile.exists()) { return; } Path path = Paths.get(sourceFile.getCanonicalPath()); try (Stream<String> stream = Files.lines(path)) { boolean needRename = stream.anyMatch(s -> s.contains(SOURCE_CONTENT)); if (!needRename) { return; } } LOGGER.log(Level.INFO, sourceFile + " exists, rename azure storage credential will start now..."); File backUp = backupFile(sourceFile.getCanonicalPath()); try (Stream<String> stream = Files.lines(path)) { List<String> collect = stream .map(s -> s.replace(SOURCE_CONTENT, TARGET_CONTENT)) .collect(Collectors.toList()); Files.write(path, collect); } catch (IOException e) { LOGGER.warning("Failed to rename azure storage credential in credentials.xml file"); recoverFile(backUp.getCanonicalPath()); } removeFile(backUp.getCanonicalPath()); }
Source:
public void unpackInteger(IntegerHolder holder) throws IOException { byte b = consume(); if(Code.isFixInt(b)) { holder.setByte(b); return; } switch(b) { case Code.INT8: holder.setByte(readByte()); break; case Code.INT16: holder.setShort(readShort()); break; case Code.INT32: holder.setInt(readInt()); break; case Code.INT64: holder.setLong(readLong()); break; case Code.UINT8: byte u8 = readByte(); if(u8 < 0) { holder.setShort((short) (u8 & 0xFF)); } else { holder.setByte(u8); } break; case Code.UINT16: short u16 = readShort(); if(u16 < 0) { holder.setInt(u16 & 0xFFFF); } else { holder.setShort(u16); } break; case Code.UINT32: int u32 = readInt(); if(u32 < 0) { holder.setLong((long) (u32 & 0x7fffffff) + 0x80000000L); } else { holder.setInt(u32); } break; case Code.UINT64: long u64 = readLong(); if(u64 < 0L) { holder.setBigInteger(BigInteger.valueOf(u64 + Long.MAX_VALUE + 1L).setBit(63)); } else { holder.setLong(u64); } break; default: throw unexpected("Integer", b); } }

Target:
public void unpackInteger(IntegerHolder holder) throws IOException { byte b = consume(); if(Code.isFixInt(b)) { holder.setByte(b); return; } switch(b) { case Code.INT8: holder.setByte(readByte()); break; case Code.INT16: holder.setShort(readShort()); break; case Code.INT32: holder.setInt(readInt()); break; case Code.INT64: holder.setLong(readLong()); break; case Code.UINT8: byte u8 = readByte(); if(u8 < 0) { holder.setShort((short) (u8 & 0xFF)); } else { holder.setByte(u8); } break; case Code.UINT16: short u16 = readShort(); if(u16 < 0) { holder.setInt(u16 & 0xFFFF); } else { holder.setShort(u16); } break; case Code.UINT32: int u32 = readInt(); if(u32 < 0) { holder.setLong(u32 & 0xffffffffL); } else { holder.setInt(u32); } break; case Code.UINT64: long u64 = readLong(); if(u64 < 0L) { holder.setBigInteger(BigInteger.valueOf(u64 + Long.MAX_VALUE + 1L).setBit(63)); } else { holder.setLong(u64); } break; default: throw unexpected("Integer", b); } }
Source:
public void clearValue() { image.setUrl(""); servingUrl = null; attachment.set(new Attachment()); uploadFailed.setVisible(false); downloadButton.setVisible(false); clearButton.setVisible(false); }

Target:
public void clearValue() { uploader.setAttachment(new Attachment()); setState(State.NONE); }
Source:
<T> List<RangeFacetResult<T>> getRangeFacetsForField( Map<String, List<FacetResult>> facets, String expectedField, int expectedCount) { List<FacetResult> facetCollection = getFacetsForField(facets, expectedField, expectedCount); return facetCollection.stream().map(facetResult -> new RangeFacetResult<T>(facetResult.getCount(), (T) facetResult.getDocument().get(FACET_FROM), (T) facetResult.getDocument().get(FACET_TO))) .collect(Collectors.toList()); }

Target:
<T> List<RangeFacetResult<T>> getRangeFacetsForField( Map<String, List<FacetResult>> facets, String expectedField, int expectedCount) { List<FacetResult> facetCollection = getFacetsForField(facets, expectedField, expectedCount); return facetCollection.stream().map(RangeFacetResult<T>::new).collect(Collectors.toList()); }