auphong2707/dl4se-code-review-dataset huggingface dataset:
Source:
public ErlangAppCompletionContributor() { extend(CompletionType.BASIC, psiElement().inFile(instanceOf(ErlangFile.class)), new CompletionProvider<CompletionParameters>() { @Override protected void addCompletions(@NotNull CompletionParameters parameters, ProcessingContext context, @NotNull CompletionResultSet result) { PsiElement position = parameters.getPosition(); PsiFile file = position.getContainingFile(); if (file == null || file.getFileType() != ErlangFileType.APP || PsiTreeUtil.getParentOfType(position, ErlangTupleExpression.class) == null) return; if (PsiTreeUtil.getParentOfType(position, ErlangListExpression.class) == null) { result.addElement(PrioritizedLookupElement.withPriority(LookupElementBuilder.create("application"), ErlangCompletionContributor.KEYWORD_PRIORITY)); } else { for (String keyword : KEYWORDS) { result.addElement(PrioritizedLookupElement.withPriority(LookupElementBuilder.create(keyword), ErlangCompletionContributor.KEYWORD_PRIORITY)); } } } }); }

Target:
public ErlangAppCompletionContributor() { PsiElementPattern.Capture<PsiElement> psiElementInAppFile = psiElement(ErlangTypes.ERL_ATOM_NAME).inFile(instanceOf(ErlangFile.class)) .inVirtualFile(virtualFile().ofType(ErlangFileType.APP)); PsiElementPattern.Capture<PsiElement> placeForAppKeyword = psiElementInAppFile .withParents(ErlangAtom.class, ErlangQAtom.class, ErlangConfigExpression.class, ErlangTupleExpression.class, ErlangFile.class).with(positionInTuple(0)); PsiElementPattern.Capture<PsiElement> placeForParameterKeywords = psiElementInAppFile .withParents(ErlangAtom.class, ErlangQAtom.class, ErlangConfigExpression.class, ErlangTupleExpression.class, ErlangListExpression.class, ErlangTupleExpression.class, ErlangFile.class).with(positionInTuple(0)); extend(CompletionType.BASIC, placeForAppKeyword, getProvider(ContainerUtil.list(APPLICATION_KEYWORD))); extend(CompletionType.BASIC, placeForParameterKeywords, getProvider(KEYWORDS)); }
Source:
public void testBothOwnersSuspected(Method m) throws ExecutionException, InterruptedException { initAndCheck(m); CountDownLatch arrival = new CountDownLatch(2); CountDownLatch release = new CountDownLatch(1); AtomicInteger thrown = new AtomicInteger(); AtomicInteger retried = new AtomicInteger(); cache(0).getAdvancedCache().getAsyncInterceptorChain().addInterceptorAfter(new CheckOTEInterceptor(thrown, retried), StateTransferInterceptor.class); cache(1).getAdvancedCache().getAsyncInterceptorChain().addInterceptor(new DelayingInterceptor(arrival, release), 0); cache(2).getAdvancedCache().getAsyncInterceptorChain().addInterceptor(new DelayingInterceptor(arrival, release), 0); Future<Object> future = fork(() -> cache(0).get(key)); assertTrue(arrival.await(20, TimeUnit.SECONDS)); installNewView(cache(0), cache(0)); assertNull(future.get()); assertEquals(1, thrown.get()); assertEquals(0, retried.get()); release.countDown(); }

Target:
public void testBothOwnersSuspected(Method m) throws ExecutionException, InterruptedException { initAndCheck(m); CountDownLatch arrival = new CountDownLatch(2); CountDownLatch release = new CountDownLatch(1); AtomicInteger thrown = new AtomicInteger(); AtomicInteger retried = new AtomicInteger(); cache(0).getAdvancedCache().getAsyncInterceptorChain().addInterceptorAfter(new CheckOTEInterceptor(thrown, retried), StateTransferInterceptor.class); cache(1).getAdvancedCache().getAsyncInterceptorChain().addInterceptor(new DelayingInterceptor(arrival, release), 0); cache(2).getAdvancedCache().getAsyncInterceptorChain().addInterceptor(new DelayingInterceptor(arrival, release), 0); Future<Object> future = fork(() -> cache(0).get(key)); assertTrue(arrival.await(10, TimeUnit.SECONDS)); installNewView(cache(0), cache(0)); assertNull(future.get()); assertEquals(1, thrown.get()); assertEquals(0, retried.get()); release.countDown(); }
Source:
public TrackingToken createTokenAt(Instant dateTime) { return events.values() .stream() .filter(event -> event.getTimestamp().equals(dateTime) || event.getTimestamp().isAfter(dateTime)) .min(Comparator.comparingLong(e -> ((GlobalSequenceTrackingToken) e.trackingToken()) .getGlobalIndex())) .map(TrackedEventMessage::trackingToken) .map(tt -> (GlobalSequenceTrackingToken) tt) .map(tt -> new GlobalSequenceTrackingToken(tt.getGlobalIndex() - 1)) .map(tt -> (TrackingToken) tt) .orElse(createHeadToken()); }

Target:
public TrackingToken createTokenAt(Instant dateTime) { return events.values() .stream() .filter(event -> event.getTimestamp().equals(dateTime) || event.getTimestamp().isAfter(dateTime)) .min(Comparator.comparingLong(e -> ((GlobalSequenceTrackingToken) e.trackingToken()) .getGlobalIndex())) .map(TrackedEventMessage::trackingToken) .map(tt -> (GlobalSequenceTrackingToken) tt) .map(tt -> new GlobalSequenceTrackingToken(tt.getGlobalIndex() - 1)) .map(tt -> (TrackingToken) tt) .orElseGet(this::createHeadToken); }
Source:
private boolean needParseContainerPrefix(final Container container, final String uniqueId) { String containerIdOrPath = null; if (FileAssetContainerUtil.getInstance().isFileAssetContainer(container)) { final Host host; try { host = APILocator.getHostAPI().findParentHost(container, APILocator.systemUser(), false); containerIdOrPath = this.site.getIdentifier().equals(host.getIdentifier()) ? ((FileAssetContainer) container).getPath() : FileAssetContainerUtil.getInstance().getFullPath((FileAssetContainer) container); } catch (DotDataException | DotSecurityException e) { Logger.debug(PageRenderUtil.class, e.getMessage()); containerIdOrPath = container.getIdentifier(); } } else { containerIdOrPath = container.getIdentifier(); } return !ParseContainer.isParserContainerUUID(uniqueId) && (templateLayout == null || !templateLayout.existsContainer(containerIdOrPath, uniqueId)); }

Target:
private boolean needParseContainerPrefix(final Container container, final String uniqueId) { String containerIdOrPath = null; if (FileAssetContainerUtil.getInstance().isFileAssetContainer(container)) { containerIdOrPath = getRelativePathFromSite((FileAssetContainer) container); } else { containerIdOrPath = container.getIdentifier(); } return !ParseContainer.isParserContainerUUID(uniqueId) && (templateLayout == null || !templateLayout.existsContainer(containerIdOrPath, uniqueId)); }
Source:
public synchronized void serialize( DataTree dt, Map<Long, Integer> sessions, File snapShot, boolean fsync) throws IOException { if (!close) { try (CheckedOutputStream snapOS = SnapStream.getOutputStream(snapShot, fsync)) { OutputArchive oa = BinaryOutputArchive.getArchive(snapOS); FileHeader header = new FileHeader(SNAP_MAGIC, VERSION, dbId); serialize(dt, sessions, oa, header); SnapStream.sealStream(snapOS, oa); if (dt.serializeZxidDigest(oa)) { SnapStream.sealStream(snapOS, oa); } lastSnapshotInfo = new SnapshotInfo( Util.getZxidFromName(snapShot.getName(), SNAPSHOT_FILE_PREFIX), snapShot.lastModified() / 1000); } } else { throw new IllegalStateException("FileSnap has already been closed"); } }

Target:
public synchronized void serialize( DataTree dt, Map<Long, Integer> sessions, File snapShot, boolean fsync) throws IOException { if (!close) { try (CheckedOutputStream snapOS = SnapStream.getOutputStream(snapShot, fsync)) { OutputArchive oa = BinaryOutputArchive.getArchive(snapOS); FileHeader header = new FileHeader(SNAP_MAGIC, VERSION, dbId); serialize(dt, sessions, oa, header); SnapStream.sealStream(snapOS, oa); if (dt.serializeZxidDigest(oa)) { SnapStream.sealStream(snapOS, oa); } lastSnapshotInfo = new SnapshotInfo( Util.getZxidFromName(snapShot.getName(), SNAPSHOT_FILE_PREFIX), snapShot.lastModified() / 1000); } } else { throw new IOException("FileSnap has already been closed"); } }
Source:
public void testCreateSnapshot() throws Exception { IgniteEx ignite = startGridsWithCache(2, dfltCacheCfg, CACHE_KEYS_RANGE); SnapshotMXBean mxBean = getMBean(ignite.name()); mxBean.createSnapshot(SNAPSHOT_NAME); MetricRegistry mreg = ignite.context().metric().registry(SNAPSHOT_METRICS); LongMetric endTime = mreg.findMetric("LastSnapshotEndTime"); assertEquals("Snapshot end time must be undefined on first snapshot operation starts.", 0, endTime.value()); assertTrue("Waiting for snapshot operation failed.", GridTestUtils.waitForCondition(() -> endTime.value() > 0, 10_000)); stopAllGrids(); IgniteEx snp = startGridsFromSnapshot(2, SNAPSHOT_NAME); assertSnapshotCacheKeys(snp.cache(dfltCacheCfg.getName())); }

Target:
public void testCreateSnapshot() throws Exception { IgniteEx ignite = startGridsWithCache(2, dfltCacheCfg, CACHE_KEYS_RANGE); DynamicMBean snpMBean = metricRegistry(ignite.name(), null, SNAPSHOT_METRICS); assertEquals("Snapshot end time must be undefined on first snapshot operation starts.", 0, getLastSnapshotEndTime(snpMBean)); SnapshotMXBean mxBean = getMxBean(ignite.name(), "Snapshot", SnapshotMXBeanImpl.class, SnapshotMXBean.class); mxBean.createSnapshot(SNAPSHOT_NAME); assertTrue("Waiting for snapshot operation failed.", GridTestUtils.waitForCondition(() -> getLastSnapshotEndTime(snpMBean) > 0, 10_000)); stopAllGrids(); IgniteEx snp = startGridsFromSnapshot(2, SNAPSHOT_NAME); assertSnapshotCacheKeys(snp.cache(dfltCacheCfg.getName())); }
Source:
public void stop() { run = false; }

Target:
public void stop() { log.debug("Namespace listener shutting down."); run = false; }
Source:
synchronized void saveSettings() { executableRampMap .getAll() .stream() .filter(ramp -> !ramp.getState().isSynchronized()) .forEach(this::updateExecutableRamp); executableRampExceptionalFlowItemsMap .entrySet() .stream() .forEach(this::updateExecutedRampFlows); rampDataModel.resetFlowCountsAfterSave(); LOGGER.info("Ramp Settings had been successfully saved."); }

Target:
synchronized void saveSettings() { executableRampMap .getAll() .stream() .filter(ramp -> !ramp.getState().isSynchronized()) .forEach(this::updateExecutableRamp); executableRampExceptionalFlowItemsMap .entrySet() .stream() .forEach(this::updateExecutedRampFlows); rampDataModel.resetFlowCountAfterSave(); LOGGER.info("Ramp Settings had been successfully saved."); }
Source:
public ModelAdapter read(JsonDeserializationContext deserializationContext, JsonObject modelContents) { if (!modelContents.has("model")) throw new RuntimeException("ModelLoaderAdapter requires a 'model' key that points to a model file."); String modelLocation = modelContents.get("model").getAsString(); try { IUnbakedModel model = parent.loadModel(new ResourceLocation(modelLocation)); ImmutableMap.Builder<String, String> builder = ImmutableMap.builder(); if (modelContents.has("custom")) { for (Map.Entry<String, JsonElement> e : modelContents.get("custom").getAsJsonObject().entrySet()) { if (e.getValue().isJsonNull()) builder.put(e.getKey(), null); else builder.put(e.getKey(), e.getValue().toString()); } } return new ModelAdapter(model, builder.build()); } catch (Exception e) { throw new RuntimeException("Error loading model from legacy model loader", e); } }

Target:
public ModelAdapter read(JsonDeserializationContext deserializationContext, JsonObject modelContents) { if (!modelContents.has("model")) throw new RuntimeException("ModelLoaderAdapter requires a 'model' key that points to a model file."); String modelLocation = modelContents.get("model").getAsString(); boolean forceLoad = JSONUtils.getBoolean(modelContents,"force", false); try { ResourceLocation loc = new ResourceLocation(modelLocation); if (!forceLoad && !parent.accepts(loc)) throw new IllegalStateException("The loader does not accept the requested model."); IUnbakedModel model = parent.loadModel(loc); ImmutableMap.Builder<String, String> builder = ImmutableMap.builder(); if (modelContents.has("custom")) { for (Map.Entry<String, JsonElement> e : modelContents.get("custom").getAsJsonObject().entrySet()) { if (e.getValue().isJsonNull()) builder.put(e.getKey(), null); else builder.put(e.getKey(), e.getValue().toString()); } } return new ModelAdapter(model, builder.build()); } catch (Exception e) { throw new RuntimeException("Error loading model from legacy model loader", e); } }
Source:
public void displayMatchingAttributeName(JMXAttribute jmxAttribute, int rank, int limit) { LOGGER.debug(" Matching: " + rank + "/" + limit + ". " + jmxAttribute); }

Target:
public void displayMatchingAttributeName(JMXAttribute jmxAttribute, int rank, int limit) { LOGGER.info(" Matching: " + rank + "/" + limit + ". " + jmxAttribute); }
Source:
public void notifyLock(LlapCacheableBuffer buffer) { if (buffer.cacheAttribute == null || buffer.cacheAttribute.getIndex() != IN_LIST || !listLock.tryLock()) { return; } removeFromListAndUnlock(buffer); }

Target:
public void notifyLock(LlapCacheableBuffer buffer) { if (buffer.cacheAttribute.getIndex() != IN_LIST || !listLock.tryLock()) { return; } removeFromListAndUnlock(buffer); }
Source:
public void init() { dataTypeComboBox.init(this, false, dataType, customDataType, false, true, CUSTOM_PROMPT, ENTER_TYPE_PROMPT); processVarComboBox.init(this, false, processVar, constant, true, true, CONSTANT_PROMPT, ENTER_CONSTANT_PROMPT); name.setRegExp("^[a-zA-Z0-9\\-\\_]*$", StunnerFormsClientFieldsConstants.INSTANCE.Removed_invalid_characters_from_name(), StunnerFormsClientFieldsConstants.INSTANCE.Invalid_character_in_name()); customDataType.addKeyDownHandler(new KeyDownHandler() { @Override public void onKeyDown(KeyDownEvent event) { int iChar = event.getNativeKeyCode(); if (iChar == ' ') { event.preventDefault(); } } }); name.addBlurHandler(new BlurHandler() { @Override public void onBlur(BlurEvent event) { if (!allowDuplicateNames) { String value = name.getText(); if (isDuplicateName(value)) { notification.fire(new NotificationEvent(duplicateNameErrorMessage, NotificationEvent.NotificationType.ERROR)); name.setValue(""); ValueChangeEvent.fire(name, ""); } } } }); }

Target:
public void init() { dataTypeComboBox.init(this, false, dataType, customDataType, false, true, CUSTOM_PROMPT, ENTER_TYPE_PROMPT); processVarComboBox.init(this, false, processVar, constant, true, true, CONSTANT_PROMPT, ENTER_CONSTANT_PROMPT); name.setRegExp(StringUtils.ALPHA_NUM_REGEXP, StunnerFormsClientFieldsConstants.INSTANCE.Removed_invalid_characters_from_name(), StunnerFormsClientFieldsConstants.INSTANCE.Invalid_character_in_name()); customDataType.addKeyDownHandler(new KeyDownHandler() { @Override public void onKeyDown(KeyDownEvent event) { int iChar = event.getNativeKeyCode(); if (iChar == ' ') { event.preventDefault(); } } }); name.addBlurHandler(new BlurHandler() { @Override public void onBlur(BlurEvent event) { if (!allowDuplicateNames) { String value = name.getText(); if (isDuplicateName(value)) { notification.fire(new NotificationEvent(duplicateNameErrorMessage, NotificationEvent.NotificationType.ERROR)); name.setValue(""); ValueChangeEvent.fire(name, ""); } } } }); }
Source:
public CallbackHandler(HelixManager manager, RealmAwareZkClient client, PropertyKey propertyKey, Object listener, EventType[] eventTypes, ChangeType changeType, HelixCallbackMonitor monitor, long periodicTriggerInterval) { if (listener == null) { throw new HelixException("listener could not be null"); } if (monitor != null && !monitor.getChangeType().equals(changeType)) { throw new HelixException("The specified callback monitor is for different change type: " + monitor.getChangeType().name()); } _manager = manager; _accessor = manager.getHelixDataAccessor(); _zkClient = client; _propertyKey = propertyKey; _path = propertyKey.getPath(); _listener = listener; _eventTypes = new HashSet<>(Arrays.asList(eventTypes)); _changeType = changeType; _lastNotificationTimeStamp = new AtomicLong(System.nanoTime()); _monitor = monitor; if (_changeType == MESSAGE || _changeType == MESSAGES_CONTROLLER || _changeType == CONTROLLER) { _watchChild = false; } else { _watchChild = true; } parseListenerProperties(); init(); _periodicTriggerInterval = periodicTriggerInterval; if (_periodicTriggerInterval > 0) { initRefreshTask(); } }

Target:
public CallbackHandler(HelixManager manager, RealmAwareZkClient client, PropertyKey propertyKey, Object listener, EventType[] eventTypes, ChangeType changeType, HelixCallbackMonitor monitor, long periodicTriggerInterval) { if (listener == null) { throw new HelixException("listener could not be null"); } if (monitor != null && !monitor.getChangeType().equals(changeType)) { throw new HelixException("The specified callback monitor is for different change type: " + monitor.getChangeType().name()); } _manager = manager; _accessor = manager.getHelixDataAccessor(); _zkClient = client; _propertyKey = propertyKey; _path = propertyKey.getPath(); _listener = listener; _eventTypes = new HashSet<>(Arrays.asList(eventTypes)); _changeType = changeType; _lastNotificationTimeStamp = new AtomicLong(System.nanoTime()); _monitor = monitor; if (_changeType == MESSAGE || _changeType == MESSAGES_CONTROLLER || _changeType == CONTROLLER) { _watchChild = false; } else { _watchChild = true; } _periodicTriggerInterval = periodicTriggerInterval; _periodicTriggerEnabled = _periodicTriggerInterval > 0; parseListenerProperties(); init(); }
Source:
public void testGetValidGuidsAndHrids_valid() { MultipleHridSearchData data = new MultipleHridSearchData("test", AtsEditor.WorldEditor); String guid1 = GUID.create(); String guid2 = GUID.create(); String hrid1 = HumanReadableId.generate(); data.setEnteredIds(String.format("%s, %s,%s, PCR 1234", guid1, guid2, hrid1)); List<String> validGuidsAndHrids = data.getValidGuidsAndHrids(); assertTrue(validGuidsAndHrids.contains(guid1)); assertTrue(validGuidsAndHrids.contains(guid2)); assertTrue(validGuidsAndHrids.contains(hrid1)); }

Target:
public void testGetValidGuidsAndHrids_valid() { MultipleHridSearchData data = new MultipleHridSearchData("test", AtsEditor.WorldEditor); String guid1 = GUID.create(); String guid2 = GUID.create(); String hrid1 = HumanReadableId.generate(); data.setEnteredIds(String.format("%s, %s,%s, PCR 1234", guid1, guid2, hrid1)); List<String> validGuidsAndHrids = data.getValidGuidsAndHrids(); assertEquals(3, validGuidsAndHrids.size()); assertTrue(validGuidsAndHrids.contains(guid1)); assertTrue(validGuidsAndHrids.contains(guid2)); assertTrue(validGuidsAndHrids.contains(hrid1)); }
Source:
public static void toStringBuilder(Object object, StringBuilder builder) { if (object == null) { return; } if (object instanceof Iterable) { toStringBuilder((Iterable) object, builder); } else if (object instanceof Object[]) { toStringBuilder(Arrays.asList((Object[]) object), builder); } else if (object instanceof Map) { toStringBuilder((Map<String, Object>) object, builder); } else { builder.append(object.toString()); } }

Target:
public static void toStringBuilder(Object object, StringBuilder builder) { if (object == null) { return; } if (object instanceof Iterable) { toStringBuilder((Iterable<Object>) object, builder); } else if (object instanceof Object[]) { toStringBuilder(Arrays.asList((Object[]) object), builder); } else if (object instanceof Map) { toStringBuilder((Map<String, Object>) object, builder); } else { builder.append(object.toString()); } }
Source:
public void createStorageAccount(AuthenticatedContext ac, AzureClient client, String resourceGroup, String storageName, String region, CloudStack stack) { StorageAccount storageAccount = client.getStorageAccountByGroup(resourceGroup, storageName); if (storageAccount == null) { try { LOGGER.info("Creating storage account: {}", storageName); armStorage.createStorage(client, storageName, LOCALLY_REDUNDANT, resourceGroup, region, isEncryptionNeeded(stack), stack.getTags()); pollStorageAccountCreation(ac, new StorageAccountCheckerContext(client, resourceGroup, storageName)); LOGGER.info("Creating container: in storage storage account: {}", IMAGES_CONTAINER, storageName); client.createContainerInStorage(resourceGroup, storageName, IMAGES_CONTAINER); } catch (CloudException e) { LOGGER.warn("Error during storage account creation: {}.", storageName, e); } } else { LOGGER.info("Storage account already exist in resource group {}", storageName, resourceGroup); } }

Target:
public void createStorageAccount(AuthenticatedContext ac, AzureClient client, String resourceGroup, String storageName, String region, CloudStack stack) { StorageAccount storageAccount = client.getStorageAccountByGroup(resourceGroup, storageName); if (storageAccount == null) { try { LOGGER.info("Creating storage account: {}", storageName); armStorage.createStorage(client, storageName, LOCALLY_REDUNDANT, resourceGroup, region, isEncryptionNeeded(stack), stack.getTags()); pollStorageAccountCreation(ac, new StorageAccountCheckerContext(client, resourceGroup, storageName)); } catch (CloudException e) { LOGGER.error("Error during storage account creation: {}.", storageName, e); throw new CloudConnectorException("Storage account creation failed.", e); } } else { LOGGER.info("Storage account already exist in resource group {}", storageName, resourceGroup); } }
Source:
public void empty() { for (String cache : cacheManager.getCacheNames()) { if (cacheManager.getCacheConfiguration(cache) != null) { TransactionConfiguration txConfig = cacheManager.getCacheConfiguration(cache).transaction(); boolean needsTx = (txConfig != null && txConfig.transactionMode() == TransactionMode.TRANSACTIONAL && !txConfig.autoCommit()); Cache<Object, Object> c = cacheManager.getCache(cache, false); if (c == null) continue; try { if (needsTx) { c.getAdvancedCache().getTransactionManager().begin(); } c.clear(); if (needsTx) { c.getAdvancedCache().getTransactionManager().commit(); } } catch (Exception e) { throw new RuntimeException("Failed to clear cache " + cache, e); } } } }

Target:
public void empty() { for (String cache : cacheManager.getCacheNames()) { TransactionConfiguration txConfig = cacheManager.getCacheConfiguration(cache).transaction(); boolean needsTx = (txConfig != null && txConfig.transactionMode() == TransactionMode.TRANSACTIONAL && !txConfig.autoCommit()); Cache<Object, Object> c = cacheManager.getCache(cache, false); if (c == null) continue; try { if (needsTx) { c.getAdvancedCache().getTransactionManager().begin(); } c.clear(); if (needsTx) { c.getAdvancedCache().getTransactionManager().commit(); } } catch (Exception e) { throw new RuntimeException("Failed to clear cache " + cache, e); } } }
Source:
public String getCurrentUserId() { if (currentUserId != null) { return currentUserId; } try { currentUserId = this.getSession().getLoggedInUser().getUniqueId(); return currentUserId; } catch (SessionUnavailableException e) { return ""; } }

Target:
public String getCurrentUserId() { try { return this.getSession().getLoggedInUser().getUniqueId(); } catch (SessionUnavailableException e) { return ""; } }
Source:
public SearchResponse search(SearchRequest request) { String[] indices = request.indices(); if (indices == null && indices.length != 1) { throw new IllegalStateException("Search on audit must include index name: " + request); } if (! getESIndexName().equals(indices[0])) { throw new IllegalStateException("Search on audit must be on audit index: " + request); } return esClient.search(request); }

Target:
public SearchResponse search(SearchRequest request) { String[] indices = request.indices(); if (indices == null || indices.length != 1) { throw new IllegalStateException("Search on audit must include index name: " + request); } if (!getESIndexName().equals(indices[0])) { throw new IllegalStateException("Search on audit must be on audit index: " + request); } return esClient.search(request); }
Source:
long gtk_size_allocate (long widget, long allocation) { Point point = getLocation (); int x = point.x; int y = point.y; long screen = OS.gdk_screen_get_default (); OS.gtk_widget_realize (widget); int monitorNumber = OS.gdk_screen_get_monitor_at_point(screen,point.x,point.y)+1; System.out.println("monitor number is "+monitorNumber); GdkRectangle dest = new GdkRectangle (); OS.gdk_screen_get_monitor_geometry (screen, monitorNumber, dest); GtkAllocation widgetAllocation = new GtkAllocation (); OS.gtk_widget_get_allocation (widget, widgetAllocation); int w = widgetAllocation.width; int h = widgetAllocation.height; if (dest.height < y + h) y -= h; if (dest.width < x + w) x -= w; OS.gtk_window_move (widget, x, y); return 0; }

Target:
long gtk_size_allocate (long widget, long allocation) { Point point = getLocation (); int x = point.x; int y = point.y; long screen = OS.gdk_screen_get_default (); OS.gtk_widget_realize (widget); int monitorNumber = OS.gdk_screen_get_monitor_at_point(screen,point.x,point.y); GdkRectangle dest = new GdkRectangle (); OS.gdk_screen_get_monitor_geometry (screen, monitorNumber, dest); GtkAllocation widgetAllocation = new GtkAllocation (); OS.gtk_widget_get_allocation (widget, widgetAllocation); int w = widgetAllocation.width; int h = widgetAllocation.height; if (dest.height < y + h) y -= h; if (dest.width < x + w) x -= w; OS.gtk_window_move (widget, x, y); return 0; }
Source:
private static String getRelativePath(Class<?> service, Class<?> parentService) { PathKey key = new PathKey(service, parentService); if (pathCache.containsKey(key)) { return pathCache.get(key); } else { for (Method method : parentService.getMethods()) { if (method.getName().startsWith("get") && method.getReturnType() == service) { Path pathAnnotation = method.getAnnotation(Path.class); if (pathAnnotation!=null) { pathCache.put(key, pathAnnotation.value()); return pathAnnotation.value(); } } } } log.error("Can't find relative path for class \"" + service.getName() + "\", will return null"); return null; }

Target:
private static String getRelativePath(Class<?> service, Class<?> parentService) { PathKey key = new PathKey(service, parentService); String path = pathCache.get(key); if (path!=null) { return path; } else { for (Method method : parentService.getMethods()) { if (method.getName().startsWith("get") && method.getReturnType() == service) { Path pathAnnotation = method.getAnnotation(Path.class); if (pathAnnotation != null) { pathCache.put(key, pathAnnotation.value()); return pathAnnotation.value(); } } } } log.error("Can't find relative path for class \"" + service.getName() + "\", will return null"); return null; }
Source:
public String nextValue() { if (hasRolledOver && throwExceptionOnRollover) { throw new RuntimeException("The generator has rolled over to the beginning"); } final StringBuilder buffer = new StringBuilder(length); for (int i = 0; i < length; i++) { buffer.append(Character.toChars(characterSet[indices[i]])); } for (int i = length - 1; i >= 0; --i) { if (indices[i] >= characterSet.length - 1) { indices[i] = 0; if (i == 0 || characterSet.length == 1 && lastValue != null) { hasRolledOver = true; } } else { ++indices[i]; break; } } lastValue = buffer.toString(); return lastValue; }

Target:
public String nextValue() { if (hasRolledOver && throwExceptionOnRollover) { throw new NoSuchElementException("The generator has rolled over to the beginning"); } final StringBuilder buffer = new StringBuilder(length); for (int i = 0; i < length; i++) { buffer.append(Character.toChars(characterSet[indices[i]])); } for (int i = length - 1; i >= 0; --i) { if (indices[i] >= characterSet.length - 1) { indices[i] = 0; if (i == 0 || characterSet.length == 1 && lastValue != null) { hasRolledOver = true; } } else { ++indices[i]; break; } } lastValue = buffer.toString(); return lastValue; }
Source:
public void run() { try { InputStreamReader isr = new InputStreamReader(is); BufferedReader br = new BufferedReader(isr); String line = null; long startTime = System.currentTimeMillis(); while ((line = br.readLine()) != null) { if ((System.currentTimeMillis() - startTime) > 5000) { LOGGER.info(line); startTime = System.currentTimeMillis(); } } } catch (IOException ioe) { ioe.printStackTrace(); } }

Target:
public void run() { try { InputStreamReader isr = new InputStreamReader(is); BufferedReader br = new BufferedReader(isr); String line = null; long startTime = System.currentTimeMillis(); while ((line = br.readLine()) != null) { if ((System.currentTimeMillis() - startTime) > 5000) { LOGGER.info(line); startTime = System.currentTimeMillis(); } } } catch (IOException ioe) { LOGGER.warn("Fail to print shell output", ioe); } }
Source:
protected void init() { key = UUID.randomUUID().toString().replaceAll("-", ""); value = UUID.randomUUID().toString().replaceAll("-", ""); }

Target:
protected void init() { key = randomString(); value = randomString(); }
Source:
protected void runAutonomous() throws InterruptedException, AutonomousModeOverException { boolean elevatorAtTop = Elevator.atTop.get(); if (!elevatorAtTop) { Elevator.setTop.event(); } float currentClampHeight = Clamp.heightReadout.get(); if (currentClampHeight < AutoLoader.clampHeightThreshold.get()) { Clamp.mode.set(Clamp.MODE_HEIGHT); Clamp.height.set(AutoLoader.clampHeightThreshold.get()); if (elevatorAtTop) { waitUntil(Clamp.atDesiredHeight); } else { waitUntil(BooleanMixing.andBooleans(Clamp.atDesiredHeight, Elevator.atTop)); } } else { if (!elevatorAtTop) { waitUntil(Elevator.atTop); } } Rollers.direction.set(Rollers.REVERSE); Rollers.running.set(true); Rollers.closed.set(true); waitUntil(AutoLoader.crateInPosition); Rollers.running.set(false); Rollers.closed.set(false); setClampOpen(true); setClampHeight(0.0f); singleSideTurn((long) (containerTurnTime.get() * 1000), true); pickupContainer(nudge.get()); turn(-autoZoneAngle.get(), true); waitForTime(500); DriveCode.octocanumShifting.set(true); drive(autoZoneDistance.get(), autoZoneSpeed.get()); DriveCode.octocanumShifting.set(false); waitForTime(500); depositContainer(containerHeight.get()); setClampHeight(1.0f); }

Target:
protected void runAutonomous() throws InterruptedException, AutonomousModeOverException { collectTote(); setClampOpen(true); setClampHeight(0.0f); singleSideTurn((long) (containerTurnTime.get() * 1000), true); pickupContainer(nudge.get()); turn(-autoZoneAngle.get(), true); waitForTime(500); DriveCode.octocanumShifting.set(true); drive(autoZoneDistance.get(), autoZoneSpeed.get()); DriveCode.octocanumShifting.set(false); waitForTime(500); depositContainer(containerHeight.get()); }
Source:
public static HostAndPort getBrooklynAccessibleAddress(Entity entity, int port) { String host; PortForwardManager pfw = entity.getConfig(PORT_FORWARDING_MANAGER); if (pfw!=null) { Collection<Location> ll = entity.getLocations(); Optional<SupportsPortForwarding> machine = Machines.findUniqueElement(ll, SupportsPortForwarding.class); if (machine.isPresent()) { synchronized (BrooklynAccessUtils.class) { HostAndPort hp = pfw.lookup((MachineLocation)machine.get(), port); if (hp!=null) return hp; Location l = Iterables.getOnlyElement(ll); if (l instanceof SupportsPortForwarding) { Cidr source = entity.getConfig(MANAGEMENT_ACCESS_CIDR); if (source!=null) { log.debug("BrooklynAccessUtils requesting new port-forwarding rule to access "+port+" on "+entity+" (at "+l+", enabled for "+source+")"); hp = ((SupportsPortForwarding) l).getSocketEndpointFor(source, port); if (hp!=null) return hp; } else { log.warn("No "+MANAGEMENT_ACCESS_CIDR.getName()+" configured for "+entity+", so cannot forward port "+port+" " + "even though "+PORT_FORWARDING_MANAGER.getName()+" was supplied"); } } } } } host = entity.getAttribute(Attributes.HOSTNAME); if (host!=null) return HostAndPort.fromParts(host, port); throw new IllegalStateException("Cannot find way to access port "+port+" on "+entity+" from Brooklyn (no host.name)"); }

Target:
public static HostAndPort getBrooklynAccessibleAddress(Entity entity, int port) { String host; PortForwardManager pfw = entity.getConfig(PORT_FORWARDING_MANAGER); if (pfw!=null) { Collection<Location> ll = entity.getLocations(); Optional<SupportsPortForwarding> machine = Machines.findUniqueElement(ll, SupportsPortForwarding.class); if (machine.isPresent()) { synchronized (BrooklynAccessUtils.class) { HostAndPort hp = pfw.lookup((MachineLocation)machine.get(), port); if (hp!=null) return hp; Location l = (Location) machine.get(); if (l instanceof SupportsPortForwarding) { Cidr source = entity.getConfig(MANAGEMENT_ACCESS_CIDR); if (source!=null) { log.debug("BrooklynAccessUtils requesting new port-forwarding rule to access "+port+" on "+entity+" (at "+l+", enabled for "+source+")"); hp = ((SupportsPortForwarding) l).getSocketEndpointFor(source, port); if (hp!=null) return hp; } else { log.warn("No "+MANAGEMENT_ACCESS_CIDR.getName()+" configured for "+entity+", so cannot forward port "+port+" " + "even though "+PORT_FORWARDING_MANAGER.getName()+" was supplied"); } } } } } host = entity.getAttribute(Attributes.HOSTNAME); if (host!=null) return HostAndPort.fromParts(host, port); throw new IllegalStateException("Cannot find way to access port "+port+" on "+entity+" from Brooklyn (no host.name)"); }
Source:
private Map<String, Map<String, String>> getTaskModels(JBPMProcessModel model) { Map<String, Map<String, String>> taskModels = new HashMap<>(); final List<TaskFormModel> taskFormModels = model.getTaskFormModels(); for (TaskFormModel taskFormModel : taskFormModels) { final Map<String, String> taskVariables = taskFormModel.getProperties().stream().collect(Collectors.toMap(ModelProperty::getName, p -> p.getTypeInfo().getClassName())); taskModels.put(taskFormModel.getTaskName(), taskVariables); } return taskModels; }

Target:
private Map<String, Map<String, String>> getTaskModels(JBPMProcessModel model) { return model.getTaskFormModels().stream().collect(Collectors.toMap( TaskFormModel::getTaskName, getTaskVariables() )); }
Source:
protected boolean tryToReadLine( boolean applyFilter ) throws KettleFileException { String[] saGetLine = TextFileInputUtils.getLine( log, isr, data.encodingType, data.fileFormatType, data.lineStringBuilder, meta.getEnclosure(), lineNumberInFile ); String line = saGetLine[0]; lineNumberInFile = Long.parseLong( saGetLine[1] ); if ( line != null ) { if ( applyFilter ) { boolean isFilterLastLine = false; boolean filterOK = checkFilterRow( line, isFilterLastLine ); if ( filterOK ) { data.lineBuffer.add( new TextFileLine( line, lineNumberInFile++, data.file ) ); } else { return false; } } else { if ( !meta.content.noEmptyLines || line.length() != 0 ) { data.lineBuffer.add( new TextFileLine( line, lineNumberInFile++, data.file ) ); } } } else { data.doneReading = true; } return true; }

Target:
protected boolean tryToReadLine( boolean applyFilter ) throws KettleFileException { TextFileLine textFileLine = TextFileInputUtils .getLine( log, isr, data.encodingType, data.fileFormatType, data.lineStringBuilder, meta.getEnclosure(), lineNumberInFile ); String line = textFileLine.line; lineNumberInFile = textFileLine.lineNumber; if ( line != null ) { if ( applyFilter ) { boolean isFilterLastLine = false; boolean filterOK = checkFilterRow( line, isFilterLastLine ); if ( filterOK ) { data.lineBuffer.add( new TextFileLine( line, lineNumberInFile++, data.file ) ); } else { return false; } } else { if ( !meta.content.noEmptyLines || line.length() != 0 ) { data.lineBuffer.add( new TextFileLine( line, lineNumberInFile++, data.file ) ); } } } else { data.doneReading = true; } return true; }
Source:
public Map<String, String> toConfig() { HashMap<String, String> configs = new HashMap<>(super.toConfig()); String streamName; if (getPhysicalName().isPresent()) { streamName = getPhysicalName().get(); } else { streamName = getStreamId(); } String systemName = getSystemName(); consumerAutoOffsetResetOptional.ifPresent(autoOffsetReset -> configs.put(String.format(CONSUMER_AUTO_OFFSET_RESET_CONFIG_KEY, systemName, streamName), autoOffsetReset)); consumerFetchMessageMaxBytesOptional.ifPresent(fetchMessageMaxBytes -> configs.put(String.format(CONSUMER_FETCH_MESSAGE_MAX_BYTES_CONFIG_KEY, systemName, streamName), Long.toString(fetchMessageMaxBytes))); return configs; }

Target:
public Map<String, String> toConfig() { HashMap<String, String> configs = new HashMap<>(super.toConfig()); String streamName = getPhysicalName().orElse(getStreamId()); String systemName = getSystemName(); consumerAutoOffsetResetOptional.ifPresent(autoOffsetReset -> configs.put(String.format(CONSUMER_AUTO_OFFSET_RESET_CONFIG_KEY, systemName, streamName), autoOffsetReset)); consumerFetchMessageMaxBytesOptional.ifPresent(fetchMessageMaxBytes -> configs.put(String.format(CONSUMER_FETCH_MESSAGE_MAX_BYTES_CONFIG_KEY, systemName, streamName), Long.toString(fetchMessageMaxBytes))); return configs; }
Source:
public ExitStatus afterStep(StepExecution stepExecution) { if (exitCode == 0) { return ExitStatus.COMPLETED; } else { return ExitStatus.FAILED; } }

Target:
public ExitStatus afterStep(StepExecution stepExecution) { return systemProcessExitCodeMapper.getExitStatus(exitCode); }
Source:
public void sendSuccessEmail(ExecutableFlow flow) { EmailMessage message = new EmailMessage(mailHost, mailUser, mailPassword); message.setFromAddress(mailSender); message.setTLS(tls); message.setAuth(usesAuth); ExecutionOptions option = flow.getExecutionOptions(); MailCreator mailCreator = DefaultMailCreator.getCreator(option.getMailCreator()); logger.debug("ExecutorMailer using mail creator:" + mailCreator.getClass().getCanonicalName()); boolean mailCreated = mailCreator.createSuccessEmail(flow, message, azkabanName, scheme, clientHostname, clientPortNumber); if (mailCreated && !testMode) { try { message.sendEmail(); } catch (MessagingException e) { logger.error("Email message send failed", e); } } }

Target:
public void sendSuccessEmail(ExecutableFlow flow) { EmailMessage message = new EmailMessage(mailHost, mailUser, mailPassword); message.setFromAddress(mailSender); message.setTLS(tls); message.setAuth(super.hasMailAuth()); ExecutionOptions option = flow.getExecutionOptions(); MailCreator mailCreator = DefaultMailCreator.getCreator(option.getMailCreator()); logger.debug("ExecutorMailer using mail creator:" + mailCreator.getClass().getCanonicalName()); boolean mailCreated = mailCreator.createSuccessEmail(flow, message, azkabanName, scheme, clientHostname, clientPortNumber); if (mailCreated && !testMode) { try { message.sendEmail(); } catch (MessagingException e) { logger.error("Email message send failed", e); } } }
Source:
public void testCreateSchema_DefaultAccess_AnonymousUsers() throws OrmException { db.create(); final SystemConfig config = db.getSystemConfig(); assertDefaultRight(RefRight.REGEX_SYMBOL+"refs/*", config.anonymousGroupId, ApprovalCategory.READ, 1, 1); }

Target:
public void testCreateSchema_DefaultAccess_AnonymousUsers() throws OrmException { db.create(); final SystemConfig config = db.getSystemConfig(); assertDefaultRight("refs/*", config.anonymousGroupId, ApprovalCategory.READ, 1, 1); }
Source:
public void openFile(String filePath, String fileType) throws IOException { Optional<ExternalFileType> type = ExternalFileTypes.getInstance().getExternalFileTypeByExt(fileType); String viewer; if (type.isPresent() && !type.get().getOpenWithApplication().isEmpty()) { viewer = type.get().getOpenWithApplication(); } else { viewer = "xdg-open"; } String[] cmdArray = { viewer, filePath }; Process p; p = Runtime.getRuntime().exec(cmdArray); BufferedReader in = new BufferedReader(new InputStreamReader(p.getErrorStream())); String line; line = in.readLine(); }

Target:
public void openFile(String filePath, String fileType) throws IOException { Optional<ExternalFileType> type = ExternalFileTypes.getInstance().getExternalFileTypeByExt(fileType); String viewer; if (type.isPresent() && !type.get().getOpenWithApplication().isEmpty()) { viewer = type.get().getOpenWithApplication(); } else { viewer = "xdg-open"; } String[] cmdArray = { viewer, filePath }; Process p = Runtime.getRuntime().exec(cmdArray); BufferedReader in = new BufferedReader(new InputStreamReader(p.getErrorStream())); String line; line = in.readLine(); LOGGER.debug("Received output: " + line); }
Source:
private Diff findMasterEquivalence(Diff diff, boolean mergeRightToLeft) { Diff masterDiff = null; final Iterator<Diff> equivalentDiffs = diff.getEquivalence().getDifferences().iterator(); while (masterDiff == null && equivalentDiffs.hasNext()) { final Diff candidate = equivalentDiffs.next(); if (hasRealConflict(candidate)) { masterDiff = candidate; } else if (diff instanceof ReferenceChange && candidate instanceof ReferenceChange) { final ReferenceChange diffRC = (ReferenceChange)diff; final ReferenceChange candidateRC = (ReferenceChange)candidate; if (diffRC.getReference().getEOpposite() == candidateRC.getReference() && candidate.getState() == DifferenceState.UNRESOLVED) { if (isOneToManyAndAdd(diffRC, candidateRC, mergeRightToLeft) || isOneToOneAndSet(diffRC, candidateRC, mergeRightToLeft)) { masterDiff = candidate; } } } } return masterDiff; }

Target:
private Diff findMasterEquivalence(Diff diff, boolean mergeRightToLeft) { final List<Diff> equivalentDiffs = diff.getEquivalence().getDifferences(); final Optional<Diff> firstConflicting = Iterables.tryFind(equivalentDiffs, hasConflict(ConflictKind.REAL)); if (firstConflicting.isPresent()) { return firstConflicting.get(); } Diff masterDiff = null; if (diff instanceof ReferenceChange) { final ReferenceChange diffRC = (ReferenceChange)diff; final Iterator<Diff> eOppositeDiffs = Iterators.filter(equivalentDiffs.iterator(), isDiffOnEOppositeOf(diffRC)); while (masterDiff == null && eOppositeDiffs.hasNext()) { final ReferenceChange candidate = (ReferenceChange)eOppositeDiffs.next(); if (isOneToManyAndAdd(diffRC, candidate, mergeRightToLeft)) { masterDiff = candidate; } else if (!isSet(diffRC, mergeRightToLeft) && isOneToOneAndSet(diffRC, candidate, mergeRightToLeft)) { masterDiff = candidate; } } } return masterDiff; }
Source:
private void printWindowState(Stage mainStage) { StringBuilder bob = new StringBuilder(); bob.append("SCREEN DATA:"); bob.append("JabRefPreferences.WINDOW_MAXIMISED: " + mainStage.isMaximized() + "\n"); bob.append("JabRefPreferences.POS_X: " + mainStage.getX() + "\n"); bob.append("JabRefPreferences.POS_Y: " + mainStage.getY() + "\n"); bob.append("JabRefPreferences.SIZE_X: " + mainStage.getWidth() + "\n"); bob.append("JabRefPreferences.SIZE_Y: " + mainStage.getHeight() + "\n"); LOGGER.debug(bob.toString()); }

Target:
private void printWindowState(Stage mainStage) { StringBuilder bob = new StringBuilder(); bob.append("SCREEN DATA:"); bob.append("mainStage.WINDOW_MAXIMISED: " + mainStage.isMaximized() + "\n"); bob.append("mainStage.POS_X: " + mainStage.getX() + "\n"); bob.append("mainStage.POS_Y: " + mainStage.getY() + "\n"); bob.append("mainStage.SIZE_X: " + mainStage.getWidth() + "\n"); bob.append("mainStages.SIZE_Y: " + mainStage.getHeight() + "\n"); LOGGER.debug(bob.toString()); }
Source:
protected Object internalExecute() throws ServiceLocalException, Exception { HttpWebRequest response = null; try { response = this.validateAndEmitRequest(); return this.readResponse(response); } catch (IOException ex) { throw new ServiceRequestException(String. format(Strings.ServiceRequestFailed, ex.getMessage(), ex)); } catch (Exception e) { if (response != null) { this.getService().processHttpResponseHeaders(TraceFlags. EwsResponseHttpHeaders, response); } throw new ServiceRequestException(String.format(Strings.ServiceRequestFailed, e.getMessage()), e); } finally { try { response.close(); } catch (Exception e2) { response = null; } } }

Target:
protected Object internalExecute() throws ServiceLocalException, Exception { HttpWebRequest response = null; try { response = this.validateAndEmitRequest(); return this.readResponse(response); } catch (IOException ex) { throw new ServiceRequestException(String. format(Strings.ServiceRequestFailed, ex.getMessage(), ex)); } catch (Exception e) { if (response != null) { this.getService().processHttpResponseHeaders(TraceFlags. EwsResponseHttpHeaders, response); } throw new ServiceRequestException(String.format(Strings.ServiceRequestFailed, e.getMessage()), e); } finally { try { if (response != null) { response.close(); } } catch (Exception e2) { response = null; } } }
Source:
private void assertMinimumTimestampIsAtLeast(String sstableMetadata, long expectedMinimum) { Pattern pattern = Pattern.compile("Minimum timestamp: ([0-9]*)"); Matcher timestampMatcher = pattern.matcher(sstableMetadata); assertThat(timestampMatcher.find()).isTrue(); assertThat(Long.parseLong(timestampMatcher.group(1))).isGreaterThanOrEqualTo(expectedMinimum); }

Target:
private void assertMinimumTimestampIsAtLeast(String sstableMetadata, long expectedMinimum) { assertThat(parseMinimumTimestamp(sstableMetadata)).isGreaterThanOrEqualTo(expectedMinimum); }
Source:
public void releaseAllResources() { if (isReleased.compareAndSet(false, true)) { checkState(parent instanceof PipelinedApproximateSubpartition); ((PipelinedApproximateSubpartition) parent).releaseView(); } }

Target:
public void releaseAllResources() { isReleased.compareAndSet(false, true); }
Source:
private void loginToAdminAccountsManagementPage() { accountsPageUrl = createUrl(Const.ActionURIs.ADMIN_ACCOUNT_MANAGEMENT_PAGE + "?all=true"); accountsPage = loginAdminToPageForAdminUiTests(browser, accountsPageUrl, AdminAccountManagementPage.class); boolean isDevEnvironment = Boolean.parseBoolean(System.getProperty("isDevEnvironment")); if (!isDevEnvironment) { accountsPage.waitForPageToFinishLoadingOnNonDevEnvironment(); } accountsPage.verifyIsCorrectPage(); }

Target:
private void loginToAdminAccountsManagementPage() { accountsPageUrl = createUrl(Const.ActionURIs.ADMIN_ACCOUNT_MANAGEMENT_PAGE + "?all=true"); accountsPage = loginAdminToPageForAdminUiTests(browser, accountsPageUrl, AdminAccountManagementPage.class); accountsPage.waitForAdminAccountsManagementPageToFinishLoading(); accountsPage.verifyIsCorrectPage(); }
Source:
private void onLightAddedInternal(FullLight light) { ThingUID thingUID = getThingUID(light); ThingTypeUID thingTypeUID = getThingTypeUID(light); String modelId = light.getModelID(); if (thingUID != null && thingTypeUID != null) { ThingUID bridgeUID = hueBridgeHandler.getThing().getUID(); Map<String, Object> properties = new HashMap<>(); properties.put(LIGHT_ID, light.getId()); if (modelId != null) { properties.put(Thing.PROPERTY_MODEL_ID, modelId.replaceAll(NORMALIZE_ID_REGEX, "_")); } String uniqueID = light.getUniqueID(); if (uniqueID != null) { properties.put(UNIQUE_ID, uniqueID); } DiscoveryResult discoveryResult = DiscoveryResultBuilder.create(thingUID).withThingType(thingTypeUID) .withProperties(properties).withBridge(bridgeUID).withRepresentationProperty(UNIQUE_ID) .withLabel(light.getName()).build(); thingDiscovered(discoveryResult); } else { logger.debug("discovered unsupported light of type '{}' and model '{}' with id {}", light.getType(), modelId, light.getId()); } }

Target:
private void onLightAddedInternal(FullLight light) { ThingUID thingUID = getThingUID(light); ThingTypeUID thingTypeUID = getThingTypeUID(light); String modelId = light.getNormalizedModelID(); if (thingUID != null && thingTypeUID != null) { ThingUID bridgeUID = hueBridgeHandler.getThing().getUID(); Map<String, Object> properties = new HashMap<>(); properties.put(LIGHT_ID, light.getId()); if (modelId != null) { properties.put(Thing.PROPERTY_MODEL_ID, modelId); } String uniqueID = light.getUniqueID(); if (uniqueID != null) { properties.put(UNIQUE_ID, uniqueID); } DiscoveryResult discoveryResult = DiscoveryResultBuilder.create(thingUID).withThingType(thingTypeUID) .withProperties(properties).withBridge(bridgeUID).withRepresentationProperty(UNIQUE_ID) .withLabel(light.getName()).build(); thingDiscovered(discoveryResult); } else { logger.debug("discovered unsupported light of type '{}' and model '{}' with id {}", light.getType(), modelId, light.getId()); } }
Source:
public final BackPressureReason emit(CoreEvent event) { onEventConsumer.accept(event); long remainingCapacity = fluxSink.requestedFromDownstream(); if (remainingCapacity == 0) { return EVENTS_ACCUMULATED; } else if (remainingCapacity > (bufferSize > CORES * 2 ? CORES : 0)) { fluxSink.next(intoSink(event)); return null; } else { synchronized (fluxSink) { if (remainingCapacity > 0) { fluxSink.next(intoSink(event)); return null; } else { return EVENTS_ACCUMULATED; } } } }

Target:
public final BackPressureReason emit(CoreEvent event) { onEventConsumer.accept(event); long remainingCapacity = fluxSink.requestedFromDownstream(); if (remainingCapacity == 0) { return EVENTS_ACCUMULATED; } else if (remainingCapacity > (bufferSize > CORES * 4 ? CORES : 0)) { fluxSink.next(intoSink(event)); return null; } else { synchronized (fluxSink) { if (remainingCapacity > 0) { fluxSink.next(intoSink(event)); return null; } else { return EVENTS_ACCUMULATED; } } } }