auphong2707/dl4se-code-review-dataset huggingface dataset:
Source:
public Optional<Long> calculateDelta() { if (!initialized) { return Optional.empty(); } try { long[] allThreadIds = threadMXBean.getAllThreadIds(); long[] bytes = (long[]) getThreadAllocatedBytes.invoke(threadMXBean, (Object) allThreadIds); long sum = 0; for (int i = 0; i < allThreadIds.length; i++) { long threadId = allThreadIds[i]; Long previous = previousResults.get(threadId); Long current = bytes[i]; if (previous == null || previous > current) { sum += current; } else if (previous <= current) { sum += current - previous; } this.previousResults.put(threadId, current); } previousResults.keySet().retainAll(Arrays.stream(allThreadIds).boxed().collect(Collectors.toList())); return Optional.of(sum); } catch (ReflectiveOperationException e) { log.error(e, "Cannot calculate delta"); } return Optional.empty(); }

Target:
long calculateDelta() { try { long[] allThreadIds = threadMXBean.getAllThreadIds(); long[] bytes = (long[]) getThreadAllocatedBytes.invoke(threadMXBean, (Object) allThreadIds); long sum = 0; Long2LongMap newResults = new Long2LongOpenHashMap(); newResults.defaultReturnValue(NO_DATA); for (int i = 0; i < allThreadIds.length; i++) { long threadId = allThreadIds[i]; long previous = previousResults.get(threadId); long current = bytes[i]; newResults.put(threadId, current); if (previous == NO_DATA || previous > current) { sum += current; } else { sum += current - previous; } } previousResults = newResults; return sum; } catch (ReflectiveOperationException e) { log.error(e, "Cannot calculate delta"); } return 0; }
Source:
public static <T> T unwrap(Class<T> clazz) { BeanManager manager = CDI.current().getBeanManager(); Set<Bean<?>> beans = manager.getBeans(clazz); if (beans.isEmpty()) { return null; } Bean<T> bean = (Bean<T>) beans.iterator().next(); Context context = manager.getContext(bean.getScope()); T beanInstance = context.get(bean); if (beanInstance != null) { return beanInstance; } CreationalContext<T> cc = manager.createCreationalContext(bean); return context.get(bean, cc); }

Target:
public static <T> T unwrap(Class<T> clazz) { BeanManager manager = CDI.current().getBeanManager(); Set<Bean<?>> beans = manager.getBeans(clazz); Bean<T> bean = (Bean<T>) manager.resolve(beans); if (bean == null) { return null; } Context context = manager.getContext(bean.getScope()); T beanInstance = context.get(bean); if (beanInstance != null) { return beanInstance; } CreationalContext<T> cc = manager.createCreationalContext(bean); return context.get(bean, cc); }
Source:
void throwOnDuplicateCommandDispatchers() { CommandClass commandTypeToIntercept = CommandClass.from(BbRegisterCommandDispatcher.class); BbCommandDispatcher dispatcher = new BbCommandDispatcher(context.eventBus(), commandTypeToIntercept); context.withHandlers(dispatcher); assertThrows(IllegalArgumentException.class, () -> context.withHandlers(dispatcher)); }

Target:
void throwOnDuplicateCommandDispatchers() { CommandClass commandTypeToDispatch = CommandClass.from(BbRegisterCommandDispatcher.class); BbCommandDispatcher dispatcher = new BbCommandDispatcher(context.eventBus(), commandTypeToDispatch); context.withHandlers(dispatcher); BbDuplicateCommandDispatcher duplicateDispatcher = new BbDuplicateCommandDispatcher(context.eventBus(), commandTypeToDispatch); assertThrows(IllegalArgumentException.class, () -> context.withHandlers(duplicateDispatcher)); }
Source:
public void send(Send request) throws IOException { Channel streamChannel; try { streamChannel = http2MultiplexedChannelPool.acquire().get(500, TimeUnit.MILLISECONDS); } catch (InterruptedException | ExecutionException | TimeoutException e) { throw new IOException("Can't acquire stream channel: ", e); } ChannelPipeline p = streamChannel.pipeline(); p.addLast(new Http2StreamFrameToHttpObjectCodec(false)); p.addLast(new HttpObjectAggregator(http2MultiplexedChannelPool.getMaxContentLength())); p.addLast(new SimpleChannelInboundHandler<FullHttpResponse>() { @Override protected void channelRead0(ChannelHandlerContext ctx, FullHttpResponse msg) throws Exception { ctx.channel().attr(RESPONSE_PROMISE).getAndSet(null).setSuccess(msg.content().retainedDuplicate()); ctx.channel() .parent() .attr(Http2MultiplexedChannelPool.HTTP2_MULTIPLEXED_CHANNEL_POOL) .get() .release(ctx.channel()); } }); streamChannel.pipeline().addLast(new AmbrySendToHttp2Adaptor()); responsePromise = streamChannel.eventLoop().newPromise(); streamChannel.attr(RESPONSE_PROMISE).set(responsePromise); streamChannel.writeAndFlush(request).awaitUninterruptibly(3, TimeUnit.SECONDS); }

Target:
public void send(Send request) throws IOException { Channel streamChannel; try { streamChannel = http2MultiplexedChannelPool.acquire() .get(http2ClientConfig.http2BlockingChannelAcquireTimeoutMs, TimeUnit.MILLISECONDS); } catch (Exception e) { throw new IOException("Can't acquire stream channel from " + getRemoteHost() + ":" + getRemotePort(), e); } ChannelPipeline p = streamChannel.pipeline(); p.addLast(new Http2StreamFrameToHttpObjectCodec(false)); p.addLast(new HttpObjectAggregator(http2ClientConfig.http2MaxContentLength)); p.addLast(new SimpleChannelInboundHandler<FullHttpResponse>() { @Override protected void channelRead0(ChannelHandlerContext ctx, FullHttpResponse msg) throws Exception { Promise<ByteBuf> promise = ctx.channel().attr(RESPONSE_PROMISE).get(); if (promise != null) { promise.setSuccess(msg.content().retainedDuplicate()); releaseStreamChannel(ctx); } } @Override public void exceptionCaught(ChannelHandlerContext ctx, Throwable cause) throws Exception { Promise<ByteBuf> promise = ctx.channel().attr(RESPONSE_PROMISE).getAndSet(null); if (promise != null) { promise.setFailure(cause); releaseStreamChannel(ctx); } } private void releaseStreamChannel(ChannelHandlerContext ctx) { ctx.channel() .parent() .attr(Http2MultiplexedChannelPool.HTTP2_MULTIPLEXED_CHANNEL_POOL) .get() .release(ctx.channel()); } }); p.addLast(new AmbrySendToHttp2Adaptor()); responsePromise = streamChannel.eventLoop().newPromise(); streamChannel.attr(RESPONSE_PROMISE).set(responsePromise); streamChannel.writeAndFlush(request) .awaitUninterruptibly(http2ClientConfig.http2BlockingChannelSendTimeoutMs, TimeUnit.MILLISECONDS); }
Source:
private void startDemo(Demo demo) { try { getSupportFragmentManager().beginTransaction().replace(R.id.content, demo.fragment.newInstance()).commit(); } catch (Exception e) { e.printStackTrace(); } ((DrawerLayout) findViewById(R.id.drawer_layout)).closeDrawer(GravityCompat.START); }

Target:
private void startDemo (Demo demo){ getSupportFragmentManager() .beginTransaction() .replace(R.id.content, demo.fragmentFactory.make()) .commit(); ((DrawerLayout) findViewById(R.id.drawer_layout)).closeDrawer(GravityCompat.START); }
Source:
public String getType() { if (isBlank(type)) { return ""; } return type; }

Target:
public String getType() { if (StringUtils.isBlank(type)) { return ""; } return type; }
Source:
private void assignPermissions(String user, File tokenFile, Logger logger) throws IOException { final String changePermissionsCommand = String.format("chmod 460 %s", tokenFile.getAbsolutePath()); int result = executeAsUser.execute(System.getProperty("user.name"), changePermissionsCommand); if (result != 0) { throw new IOException("Unable to modify permissions. User: " + user); } final String changeOwnershipCommand = String.format("chown %s:azkaban %s", user, tokenFile.getAbsolutePath()); result = executeAsUser.execute("root", changeOwnershipCommand); if (result != 0) { throw new IOException("Unable to set ownership. User: " + user); } }

Target:
private void assignPermissions(String user, File tokenFile, Logger logger) throws IOException { final List<String> changePermissionsCommand = Arrays.asList( CHMOD, TOKEN_FILE_PERMISSIONS, tokenFile.getAbsolutePath() ); int result = executeAsUser.execute(System.getProperty("user.name"), changePermissionsCommand); if (result != 0) { throw new IOException("Unable to modify permissions. User: " + user); } final List<String> changeOwnershipCommand = Arrays.asList( CHOWN, user + ":" + GROUP_NAME, tokenFile.getAbsolutePath() ); result = executeAsUser.execute("root", changeOwnershipCommand); if (result != 0) { throw new IOException("Unable to set ownership. User: " + user); } }
Source:
private void refreshLabelAndIcon() { EditPart parent = getParent(); if (parent instanceof IAbstractDiagramNodeEditPart) { IAbstractDiagramNodeEditPart parentDiagramNodeEditPart = (IAbstractDiagramNodeEditPart) parent; SiriusWrapLabel siriusWrapLabel = parentDiagramNodeEditPart.getNodeLabel(); DDiagramElement dDiagramElement = parentDiagramNodeEditPart.resolveDiagramElement(); if (siriusWrapLabel != null && dDiagramElement != null) { DiagramElementEditPartOperation.refreshFont(parentDiagramNodeEditPart, dDiagramElement, siriusWrapLabel); StyleConfiguration styleConfiguration = IStyleConfigurationRegistry.INSTANCE.getStyleConfiguration(dDiagramElement.getDiagramElementMapping(), dDiagramElement.getStyle()); Image labelIcon = new StyleConfigurationQuery(styleConfiguration).getLabelIcon(dDiagramElement, parentDiagramNodeEditPart); siriusWrapLabel.setText(dDiagramElement.getName()); siriusWrapLabel.setIcon(labelIcon); if (dDiagramElement instanceof DNode) { styleConfiguration.adaptNodeLabel((DNode) dDiagramElement, siriusWrapLabel); } } } }

Target:
private void refreshLabelAndIcon() { EditPart parent = getParent(); if (parent instanceof IAbstractDiagramNodeEditPart) { IAbstractDiagramNodeEditPart parentDiagramNodeEditPart = (IAbstractDiagramNodeEditPart) parent; SiriusWrapLabel siriusWrapLabel = parentDiagramNodeEditPart.getNodeLabel(); DDiagramElement dDiagramElement = parentDiagramNodeEditPart.resolveDiagramElement(); DiagramElementEditPartOperation.refreshLabelAndIcon(parentDiagramNodeEditPart, dDiagramElement, siriusWrapLabel); } }
Source:
public LocalCandidate findLocalCandidate(TransportAddress localAddress, LocalCandidate base) { for (LocalCandidate localCnd : localCandidates) { if (localCnd.getTransportAddress().equals(localAddress)) { if (base == null || base.equals(localCnd.getBase())) return localCnd; } } for (LocalCandidate localCnd : localCandidates) { if (localCnd.getTransportAddress().equals(localAddress)) { return localCnd; } } return null; }

Target:
public LocalCandidate findLocalCandidate(TransportAddress localAddress, LocalCandidate base) { for (LocalCandidate localCnd : localCandidates) { if (localCnd.getTransportAddress().equals(localAddress)) { if (base == null || base.equals(localCnd.getBase())) { return localCnd; } } } for (LocalCandidate localCnd : localCandidates) { if (localCnd.getTransportAddress().equals(localAddress)) { logger.warn("Returning a candidate matching the address, " + "while no candidates match both address (" + localAddress + ") and base (" + base +"): " + localCnd + " with base " + localCnd.getBase()); return localCnd; } } return null; }
Source:
public FileVisitResult visitFileFailed(final Path file, final IOException ioe) { if (ioe instanceof FileSystemLoopException) { log.warn("Detected file system cycle visiting while visiting {}. Skipping.", file); return FileVisitResult.SKIP_SUBTREE; } else if (ioe instanceof AccessDeniedException) { log.warn("Access denied for file {}. Skipping", file); return FileVisitResult.SKIP_SUBTREE; } else if (ioe instanceof NoSuchFileException) { log.warn("File or directory disappeared while vising {}. Skipping", file); return FileVisitResult.SKIP_SUBTREE; } else { log.error("Got unknown error while visiting {}. Terminating visitor", ioe.getMessage(), file, ioe); return FileVisitResult.TERMINATE; } }

Target:
public FileVisitResult visitFileFailed(final Path file, final IOException ioe) { if (ioe instanceof FileSystemLoopException) { log.warn("Detected file system cycle visiting while visiting {}. Skipping.", file); return FileVisitResult.SKIP_SUBTREE; } else if (ioe instanceof AccessDeniedException) { log.warn("Access denied for file {}. Skipping", file); return FileVisitResult.SKIP_SUBTREE; } else if (ioe instanceof NoSuchFileException) { log.warn("File or directory disappeared while visiting {}. Skipping", file); return FileVisitResult.SKIP_SUBTREE; } else { log.error("Got unknown error while visiting {}. Terminating visitor", ioe.getMessage(), file, ioe); return FileVisitResult.TERMINATE; } }
Source:
protected void onPostExecute(String result) { if (result != null) { try { JSONObject obj = new JSONObject(result); if (obj.getString("result").equals("success")) { if (startedFromAddRealm) { loginThroughAddRealm(obj); callback.onTaskComplete(result, obj); } else { this.app.setServerURL(serverURL); this.app.setLoggedInApiKey(obj.getString("api_key")); ZulipApp.get().saveServerName(realmName); if (context instanceof LoginActivity) { ((LoginActivity) this.context).openHome(); } else if (context instanceof DevAuthActivity) { ((DevAuthActivity) this.context).openHome(); } } return; } } catch (JSONException e) { ZLog.logException(e); } } Toast.makeText(activity, "Unknown error", Toast.LENGTH_LONG).show(); Log.wtf("login", "We shouldn't have gotten this far."); }

Target:
protected void onPostExecute(String result) { if (result != null) { try { JSONObject obj = new JSONObject(result); if (obj.getString("result").equals("success")) { if (startedFromAddRealm) { loginThroughAddRealm(obj); callback.onTaskComplete(result, obj); } else { this.app.setServerURL(serverURL); this.app.setLoggedInApiKey(obj.getString("api_key")); ZulipApp.get().saveServerName(realmName); loginInterface.openHome(); } return; } } catch (JSONException e) { ZLog.logException(e); } } Toast.makeText(activity, "Unknown error", Toast.LENGTH_LONG).show(); Log.wtf("login", "We shouldn't have gotten this far."); }
Source:
static void addPromptHandlerIfAvailable(LocationHandler handler) { if (handler instanceof LocationAndPromptHandler) { synchronized (promptHandlers) { promptHandlers.add((LocationAndPromptHandler) handler); } } }

Target:
static void addPromptHandlerIfAvailable(LocationHandler handler) { if (handler instanceof LocationPromptCompletionHandler) { synchronized (promptHandlers) { promptHandlers.add((LocationPromptCompletionHandler) handler); } } }
Source:
private static void parseSdkStanza(ClientInfo.Builder builder, String stanza) { String[] sdkComponents = stanza.split("/"); if (sdkComponents.length == 2) { if (!sdkComponents[0].matches(DIGITS_REGEXP)) { builder.withSdkName(parseString(sdkComponents[0])); } builder.withSdkVersion(parseInteger(sdkComponents[1])).build(); } else if (sdkComponents.length == 1) { if (sdkComponents[0].matches(DIGITS_REGEXP)) { builder.withSdkVersion(parseInteger(sdkComponents[0])); } else { builder.withSdkName(parseString(sdkComponents[0])); } } }

Target:
private static void parseSdkStanza(ClientInfo.Builder builder, String stanza) { String[] sdkComponents = stanza.split("/"); if (sdkComponents.length == 2) { if (!sdkComponents[0].matches(DIGITS_REGEXP)) { builder.withSdkName(parseString(sdkComponents[0])); } builder.withSdkVersion(parseInteger(sdkComponents[1])); } else if (sdkComponents.length == 1) { if (sdkComponents[0].matches(DIGITS_REGEXP)) { builder.withSdkVersion(parseInteger(sdkComponents[0])); } else { builder.withSdkName(parseString(sdkComponents[0])); } } }
Source:
private boolean hasSameNodes(List<Node> first, List<Node> second) { if (first.size() != second.size()) { return false; } for (int i = 0; i < first.size(); i++) { if (!first.get(i).toString().equals(second.get(i).toString())) { return false; } } return true; }

Target:
private boolean hasSameNodes(List<Node> first, List<Node> second) { if (first.size() != second.size()) { return false; } for (int i = 0, size = first.size(); i < size; i++) { if (!first.get(i).toString().equals(second.get(i).toString())) { return false; } } return true; }
Source:
public T ADD_ROW() { sql().values.add(new ArrayList<>()); return getSelf(); }

Target:
public T ADD_ROW() { sql().valuesList.add(new ArrayList<>()); return getSelf(); }
Source:
public UserInfo about(String username) throws ActionFailedException { if(username == "[deleted]") throw new ActionFailedException("There is no information associated with the username [deleted]"); JSONObject object = (JSONObject) restClient.get(String.format(ApiEndpointUtils.USER_ABOUT, username), null).getResponseObject(); JSONObject data = (JSONObject) object.get("data"); return data != null ? new UserInfo(data) : null; }

Target:
public UserInfo about(String username) throws ActionFailedException { if(username.equals("[deleted]")) { throw new ActionFailedException("There is no information associated with the username [deleted]"); } JSONObject object = (JSONObject) restClient.get(String.format(ApiEndpointUtils.USER_ABOUT, username), null).getResponseObject(); JSONObject data = (JSONObject) object.get("data"); return data != null ? new UserInfo(data) : null; }
Source:
public int hashCode() { return scope.hashCode() ^ name.hashCode(); }

Target:
public int hashCode() { return scope.hashCode() * (29 + name.hashCode()); }
Source:
void persistTimer() { final ContextTransactionManager transactionManager = ContextTransactionManager.getInstance(); try { transactionManager.begin(); timerPersistence.getValue().persistTimer(timer); transactionManager.commit(); } catch (Exception e) { try { transactionManager.rollback(); } catch (Exception ee) { } EJB3_TIMER_LOGGER.exceptionRunningTimerTask(timer, timer.getTimedObjectId(), e); Date nextExpiration = timer.getNextExpiration(); if( nextExpiration != null ){ int max = 10; String pMax = System.getProperty("jboss.timer.TaskPostPersist.maxRetry"); if( pMax != null ) { try { max = Integer.parseInt(pMax); } catch (NumberFormatException nfe ){ } } if( triesCounter++ < max ) { long nextTryDelay = nextExpiration.getTime() - System.currentTimeMillis() / 5; if (nextTryDelay <= 0 || nextTryDelay > 60000L) nextTryDelay = 5000L; timerInjectedValue.getValue().schedule( new TaskPostPersist(timer, triesCounter), nextTryDelay); } else { EJB3_TIMER_LOGGER.exceptionPersistPostTimerState(timer, e); } } } }

Target:
void persistTimer() { final ContextTransactionManager transactionManager = ContextTransactionManager.getInstance(); try { transactionManager.begin(); timerPersistence.getValue().persistTimer(timer); transactionManager.commit(); } catch (Exception e) { try { transactionManager.rollback(); } catch (Exception ee) { } EJB3_TIMER_LOGGER.exceptionPersistTimerState(timer, e); long nextExpirationDelay; if (nextExpirationPristine > 0 && timer.timerState != TimerState.RETRY_TIMEOUT && (nextExpirationDelay = nextExpirationPristine - System.currentTimeMillis()) > delta) { if (delta == 0L) { delta = nextExpirationDelay / (1L + MAX_RETRY.longValue()); } timerInjectedValue .getValue() .schedule(new TaskPostPersist(timer, delta, nextExpirationPristine), delta); } else { EJB3_TIMER_LOGGER.exceptionPersistPostTimerState(timer, e); } } }
Source:
@Test void testEqualAsMapSansNullability() { final SqlTypeFactoryImpl factory = new SqlTypeFactoryImpl(RelDataTypeSystem.DEFAULT); final RelDataType bigint = factory.createSqlType(SqlTypeName.BIGINT); final RelDataType mapNullable = new MapSqlType(factory.createTypeWithNullability(bigint, true), factory.createTypeWithNullability(bigint, false), false); final RelDataType mapNotNull = new MapSqlType(factory.createTypeWithNullability(bigint, false), factory.createTypeWithNullability(bigint, true), false); assertThat(equalAsMapSansNullability(factory, mapNullable, mapNotNull), is(true)); }

Target:
@Test void testEqualAsMapSansNullability() { assertThat( equalAsMapSansNullability(f.typeFactory, f.mapOfInt, f.mapOfIntNullable), is(true)); }
Source:
private void writeComponent(JsonWriter json, DbSession session, ComponentDto component, OrganizationDto organizationDto, @Nullable SnapshotDto analysis) { json.prop("key", component.getKey()) .prop("organization", organizationDto.getKey()) .prop("id", component.uuid()) .prop("name", component.name()) .prop("description", component.description()) .prop("isFavorite", isFavourite(session, component)); String branch = component.getBranch(); if (branch != null) { json.prop(PARAM_BRANCH, branch); } if (QUALIFIERS_WITH_VISIBILITY.contains(component.qualifier())) { json.prop("visibility", Visibility.getLabel(component.isPrivate())); } List<Page> pages = pageRepository.getComponentPages(false, component.qualifier()); writeExtensions(json, component, pages); if (analysis != null) { json.prop("version", analysis.getProjectVersion()) .prop("analysisDate", formatDateTime(new Date(analysis.getCreatedAt()))); } }

Target:
private void writeComponent(JsonWriter json, DbSession session, ComponentDto component, OrganizationDto organizationDto, @Nullable SnapshotDto analysis) { json.prop("key", component.getKey()) .prop("organization", organizationDto.getKey()) .prop("id", component.uuid()) .prop("name", component.name()) .prop("description", component.description()) .prop("isFavorite", isFavourite(session, component)); String branch = component.getBranch(); if (branch != null) { json.prop("branch", branch); } if (QUALIFIERS_WITH_VISIBILITY.contains(component.qualifier())) { json.prop("visibility", Visibility.getLabel(component.isPrivate())); } List<Page> pages = pageRepository.getComponentPages(false, component.qualifier()); writeExtensions(json, component, pages); if (analysis != null) { json.prop("version", analysis.getProjectVersion()) .prop("analysisDate", formatDateTime(new Date(analysis.getCreatedAt()))); } }
Source:
public void shouldDeleteNetworkToPublicRouter() throws OpenStackException, InfrastructureException { String response = "{\"ports\": [ {\"status\": \"ACTIVE\",\"name\": \"\", \"admin_state_up\": true, \"network_id\": " + "\"6a609412-3f04-485c-b269-b1a9b9ecb6bf\", \"tenant_id\": \"08bed031f6c54c9d9b35b42aa06b51c0\",\"binding:vif_type\": \"ovs\"," + "\"device_owner\": \"network:dhcp\", \"binding:capabilities\": {\"port_filter\": true}, \"mac_address\": \"fa:16:3e:54:1a:40\"," + "\"fixed_ips\": [ {\"subnet_id\": \"601ec829-a166-4b39-9c74-166cc76f251b\", \"ip_address\": \"172.31.0.3\"}]," + "\"id\": \"07fd27d2-9ce1-48f3-be83-c7d2b7041a1a\", \"security_groups\": [], \"device_id\": \"dhcpfa3e6aae-2140-5176-877a-2f67684a3165-6a609412-3f04-485c-b269-b1a9b9ecb6bf\"" + "}]}"; when(openStackUtil.listPorts(any(PaasManagerUser.class), anyString())).thenReturn(response); NetworkInstance net = new NetworkInstance("router", "vdc", "region"); SubNetworkInstance subNet = new SubNetworkInstance("dd", "vdc", "region", "ID"); subNet.setIdSubNet("ID"); net.addSubNet(subNet); when(openStackUtil.deleteInterfaceToPublicRouter(any(PaasManagerUser.class), any(NetworkInstance.class), anyString())).thenReturn(response); openStackNetworkImpl.deleteNetworkToPublicRouter(claudiaData, net, REGION); verify(openStackUtil).deleteInterfaceToPublicRouter(any(PaasManagerUser.class), any(NetworkInstance.class), anyString()); }

Target:
public void shouldDeleteNetworkToPublicRouter() throws OpenStackException, InfrastructureException { String response = "{\"ports\": [ {\"status\": \"ACTIVE\",\"name\": \"\", \"admin_state_up\": true, " + "\"network_id\": \"ID2\", \"tenant_id\": \"08bed031f6c54c9d9b35b42aa06b51c0\"," + "\"device_owner\": \"compute:None\", \"binding:capabilities\": {\"port_filter\": true}, " + "\"fixed_ips\": [ {\"subnet_id\": \"ID2\", \"ip_address\": \"172.31.0.3\"}]," + "\"id\": \"07fd27d2-9ce1-48f3-be83-c7d2b7041a1a\", \"security_groups\": [], \"device_id\":" + " \"dhcpfa3e6aae-2140-5176-877a-2f67684a3165-6a609412-3f04-485c-b269-b1a9b9ecb6bf\"" + "}]}"; when(openStackUtil.listPorts(any(PaasManagerUser.class), anyString())).thenReturn(response); NetworkInstance net = new NetworkInstance("router", "vdc", "region"); SubNetworkInstance subNet = new SubNetworkInstance("dd", "vdc", "region", "ID"); subNet.setIdSubNet("ID"); net.addSubNet(subNet); when(openStackUtil.deleteInterfaceToPublicRouter(any(PaasManagerUser.class), any(NetworkInstance.class), anyString())).thenReturn(response); openStackNetworkImpl.deleteNetworkToPublicRouter(claudiaData, net, REGION); verify(openStackUtil).deleteInterfaceToPublicRouter(any(PaasManagerUser.class), any(NetworkInstance.class), anyString()); }
Source:
public void onStatusChanged(ManagerTypes managerType, ManagerStates state) { if (managerType.equals(ManagerTypes.deviceStatusManager)) { switch (state) { case initialasing: this.updateStatus(ThingStatus.OFFLINE, ThingStatusDetail.CONFIGURATION_PENDING, "Building digitalSTROM model."); break; case running: if (!getThing().getStatus().equals(ThingStatus.ONLINE)) { setStatus(ThingStatus.ONLINE); } break; case stopped: if (!getThing().getStatusInfo().equals(ThingStatusDetail.COMMUNICATION_ERROR) || !getThing().getStatusInfo().equals(ThingStatusDetail.CONFIGURATION_ERROR)) { this.updateStatus(ThingStatus.OFFLINE, ThingStatusDetail.NONE, "Status-Manager is stopped."); } break; default: break; } } if (managerType.equals(ManagerTypes.sceneManager)) { switch (state) { case generatingScenes: generatingScenes = true; break; case scenesGenerated: if (unregisterSceneStatusListeners != null) { for (SceneStatusListener sceneListener : this.unregisterSceneStatusListeners) { sceneMan.registerSceneListener(sceneListener); } } if (sceneListener != null) { for (SceneStatusListener sceneListener : this.sceneListener) { sceneMan.registerSceneListener(sceneListener); } } generatingScenes = false; break; default: break; } } }

Target:
public void onStatusChanged(ManagerTypes managerType, ManagerStates state) { if (managerType.equals(ManagerTypes.DEVICE_STATUS_MANAGER)) { switch (state) { case INITIALIZING: logger.info("Building digitalSTROM model"); break; case RUNNING: if (devListener != null) { for (DeviceStatusListener deviceListener : devListener) { devStatMan.registerDeviceListener(deviceListener); } } setStatus(ThingStatus.ONLINE); break; case STOPPED: if (!getThing().getStatusInfo().equals(ThingStatusDetail.COMMUNICATION_ERROR) || !getThing().getStatusInfo().equals(ThingStatusDetail.CONFIGURATION_ERROR)) { updateStatus(ThingStatus.OFFLINE, ThingStatusDetail.NONE, "DeviceStatusManager is stopped."); } break; default: break; } } if (managerType.equals(ManagerTypes.SCENE_MANAGER)) { switch (state) { case GENERATING_SCENES: generatingScenes = true; break; case RUNNING: if (unregisterSceneStatusListeners != null) { for (SceneStatusListener sceneListener : this.unregisterSceneStatusListeners) { sceneMan.registerSceneListener(sceneListener); } } if (sceneListener != null) { for (SceneStatusListener sceneListener : this.sceneListener) { sceneMan.registerSceneListener(sceneListener); } } generatingScenes = false; break; default: break; } } }
Source:
protected <T extends AppPage> T loginAdminToPage(AppUrl url, Class<T> typeOfPage) { if (!TestProperties.isDevServer()) { return null; } if (browser.isAdminLoggedIn) { browser.driver.get(url.toAbsoluteString()); try { return AppPage.getNewPageInstance(browser, typeOfPage); } catch (Exception e) { ignorePossibleException(); } } logout(); browser.driver.get(url.toAbsoluteString()); String adminUsername = TestProperties.TEST_ADMIN_ACCOUNT; String adminPassword = TestProperties.TEST_ADMIN_PASSWORD; String userId = url.get(Const.ParamsNames.USER_ID); if (userId != null) { adminUsername = userId; } LoginPage loginPage = AppPage.createCorrectLoginPageType(browser); loginPage.loginAsAdmin(adminUsername, adminPassword); return AppPage.getNewPageInstance(browser, typeOfPage); }

Target:
protected <T extends AppPage> T loginAdminToPage(AppUrl url, Class<T> typeOfPage) { if (!TestProperties.isDevServer()) { return AppPage.getNewPageInstance(browser, url, typeOfPage); } if (browser.isAdminLoggedIn) { browser.driver.get(url.toAbsoluteString()); try { return AppPage.getNewPageInstance(browser, typeOfPage); } catch (Exception e) { ignorePossibleException(); } } logout(); browser.driver.get(url.toAbsoluteString()); String adminUsername = TestProperties.TEST_ADMIN_ACCOUNT; String adminPassword = TestProperties.TEST_ADMIN_PASSWORD; String userId = url.get(Const.ParamsNames.USER_ID); if (userId != null) { adminUsername = userId; } LoginPage loginPage = AppPage.getNewPageInstance(browser, DevServerLoginPage.class); loginPage.loginAsAdmin(adminUsername, adminPassword); return AppPage.getNewPageInstance(browser, url, typeOfPage); }
Source:
public boolean equals(Object o) { if (this == o) { return true; } if (o == null || getClass() != o.getClass()) { return false; } KafkaTuningConfig that = (KafkaTuningConfig) o; return maxRowsInMemory == that.maxRowsInMemory && maxRowsPerSegment == that.maxRowsPerSegment && maxPendingPersists == that.maxPendingPersists && reportParseExceptions == that.reportParseExceptions && handoffConditionTimeout == that.handoffConditionTimeout && resetOffsetAutomatically == that.resetOffsetAutomatically && Objects.equals(intermediatePersistPeriod, that.intermediatePersistPeriod) && Objects.equals(basePersistDirectory, that.basePersistDirectory) && Objects.equals(indexSpec, that.indexSpec) && Objects.equals(segmentWriteOutMediumFactory, that.segmentWriteOutMediumFactory) && Objects.equals(intermediateHandoffPeriod, that.intermediateHandoffPeriod) && Objects.equals(logParseExceptions, that.logParseExceptions) && Objects.equals(maxParseExceptions, that.maxParseExceptions) && Objects.equals(maxSavedParseExceptions, that.maxSavedParseExceptions); }

Target:
public boolean equals(Object o) { if (this == o) { return true; } if (o == null || getClass() != o.getClass()) { return false; } KafkaTuningConfig that = (KafkaTuningConfig) o; return maxRowsInMemory == that.maxRowsInMemory && maxRowsPerSegment == that.maxRowsPerSegment && maxPendingPersists == that.maxPendingPersists && reportParseExceptions == that.reportParseExceptions && handoffConditionTimeout == that.handoffConditionTimeout && resetOffsetAutomatically == that.resetOffsetAutomatically && Objects.equals(intermediatePersistPeriod, that.intermediatePersistPeriod) && Objects.equals(basePersistDirectory, that.basePersistDirectory) && Objects.equals(indexSpec, that.indexSpec) && Objects.equals(segmentWriteOutMediumFactory, that.segmentWriteOutMediumFactory) && Objects.equals(intermediateHandoffPeriod, that.intermediateHandoffPeriod) && logParseExceptions == that.logParseExceptions && maxParseExceptions == that.maxParseExceptions && maxSavedParseExceptions == that.maxSavedParseExceptions; }
Source:
private void maybeUseTWCS(Session session, String keyspace) { String cassandraVersion = getCassandraVersion(session); String getCompactionClass; ResultSet resultSet; if (cassandraVersion.startsWith("2")) { getCompactionClass = "SELECT compaction_strategy_class FROM system.schema_columnfamilies WHERE " + "keyspace_name = '" + keyspace + "' AND columnfamily_name = 'data'"; resultSet = session.execute(getCompactionClass); if (resultSet.isExhausted()) { logger.warn("Unable to determine the compaction strategy for the data table due to empty result set"); return; } if (resultSet.one().getString(0).equals(TWCS_CLASS)) { return; } if (resultSet.one().getString(0).equals(TWCS_CLASS)) { return; } } else { getCompactionClass = "SELECT compaction FROM system_schema.tables WHERE keyspace_name = '" + keyspace + "' AND table_name = 'data'"; resultSet = session.execute(getCompactionClass); if (resultSet.isExhausted()) { logger.warn("Unable to determine the compaction strategy for the data table due to empty result set"); return; } Map<String, String> compactionProps = resultSet.one().getMap(0, String.class, String.class); if (compactionProps.get("class").equals(TWCS_CLASS)) { return; } } try { String updateCompaction = "ALTER TABLE " + keyspace + ".data WITH compaction = {'class': '" + TWCS_CLASS + "', 'compaction_window_unit': 'DAYS', 'compaction_window_size': 1}"; session.execute(updateCompaction); logger.infof("The compaction strategy for the data table has been updated to %s", TWCS_CLASS); } catch (Exception e) { logger.warn("Failed to update compaction strategy for the data table", e); } }

Target:
private void maybeUseTWCS(Session session, String keyspace) { String cassandraVersion = getCassandraVersion(session); String getCompactionClass; ResultSet resultSet; if (cassandraVersion.startsWith("2")) { getCompactionClass = "SELECT compaction_strategy_class FROM system.schema_columnfamilies WHERE " + "keyspace_name = '" + keyspace + "' AND columnfamily_name = 'data'"; resultSet = session.execute(getCompactionClass); if (resultSet.isExhausted()) { logger.warn("Unable to determine the compaction strategy for the data table due to empty result set"); return; } if (resultSet.one().getString(0).equals(TWCS_CLASS)) { return; } } else { getCompactionClass = "SELECT compaction FROM system_schema.tables WHERE keyspace_name = '" + keyspace + "' AND table_name = 'data'"; resultSet = session.execute(getCompactionClass); if (resultSet.isExhausted()) { logger.warn("Unable to determine the compaction strategy for the data table due to empty result set"); return; } Map<String, String> compactionProps = resultSet.one().getMap(0, String.class, String.class); if (compactionProps.get("class").equals(TWCS_CLASS)) { return; } } try { String updateCompaction = "ALTER TABLE " + keyspace + ".data WITH compaction = {'class': '" + TWCS_CLASS + "', 'compaction_window_unit': 'DAYS', 'compaction_window_size': 1}"; session.execute(updateCompaction); logger.infof("The compaction strategy for the data table has been updated to %s", TWCS_CLASS); } catch (Exception e) { logger.warn("Failed to update compaction strategy for the data table", e); } }
Source:
protected boolean checkExistence(String uid) { if (templateRegistry != null && templateRegistry.get(uid) != null) { logger.error("Rule Template with UID \"{}\" already exists! Failed to create a second with the same UID!", uid, new IllegalArgumentException()); return true; } return false; }

Target:
protected boolean checkExistence(String uid) { if (templateRegistry != null && templateRegistry.get(uid) != null) { return true; } return false; }
Source:
private static Syntax createEnumField(Field e) { String name = e.getName(); String lead = null; String example = null; Pattern pattern = Pattern.compile(Pattern.quote(e.getName())); SyntaxAnnotation sa = e.getAnnotation(SyntaxAnnotation.class); if (sa != null) { if (!sa.name() .isEmpty()) name = sa.name(); if (!sa.lead() .isEmpty()) lead = sa.lead(); if (!sa.example() .isEmpty()) example = sa.example(); if (!sa.pattern() .isEmpty()) pattern = Pattern.compile(Pattern.quote(sa.pattern())); } return new Syntax(name, lead, example, name, pattern); }

Target:
private static Syntax createEnumField(Field e) { String name = e.getName(); String lead = null; String example = null; Pattern pattern = Pattern.compile(Pattern.quote(e.getName())); SyntaxAnnotation sa = e.getAnnotation(SyntaxAnnotation.class); if (sa != null) { if (!sa.name() .isEmpty()) name = sa.name(); if (!sa.lead() .isEmpty()) lead = sa.lead(); if (!sa.example() .isEmpty()) example = sa.example(); if (!sa.pattern() .isEmpty()) pattern = Pattern.compile(sa.pattern(), Pattern.LITERAL); } return new Syntax(name, lead, example, name, pattern); }
Source:
public DelegatingResourceDescription getRepresentationDescription(Representation rep) { if (rep instanceof DefaultRepresentation) { DelegatingResourceDescription description = new DelegatingResourceDescription(); description.addProperty("display", findMethod("getDisplayString")); description.addProperty("uuid"); description.addProperty("value",findMethod("getValue")); description.addProperty("attributeType", Representation.REF); description.addProperty("voided"); description.addSelfLink(); description.addLink("full", ".?v=" + RestConstants.REPRESENTATION_FULL); return description; } else if (rep instanceof FullRepresentation) { DelegatingResourceDescription description = new DelegatingResourceDescription(); description.addProperty("display", findMethod("getDisplayString")); description.addProperty("uuid"); description.addProperty("value",findMethod("getValue")); description.addProperty("attributeType", Representation.REF); description.addProperty("voided"); description.addProperty("auditInfo", findMethod("getAuditInfo")); description.addSelfLink(); return description; } return null; }

Target:
public DelegatingResourceDescription getRepresentationDescription(Representation rep) { if (rep instanceof DefaultRepresentation) { DelegatingResourceDescription description = new DelegatingResourceDescription(); description.addProperty("display", findMethod("getDisplayString")); description.addProperty("uuid"); description.addProperty("value",findMethod("getValue"),Representation.REF); description.addProperty("attributeType", Representation.REF); description.addProperty("voided"); description.addSelfLink(); description.addLink("full", ".?v=" + RestConstants.REPRESENTATION_FULL); return description; } else if (rep instanceof FullRepresentation) { DelegatingResourceDescription description = new DelegatingResourceDescription(); description.addProperty("display", findMethod("getDisplayString")); description.addProperty("uuid"); description.addProperty("value",findMethod("getValue")); description.addProperty("attributeType", Representation.REF); description.addProperty("voided"); description.addProperty("auditInfo", findMethod("getAuditInfo")); description.addSelfLink(); return description; } return null; }
Source:
public Data readBackupData(Data key) { Record record = getRecord(key); if (record == null) { return null; } else { if (partitionService.isPartitionOwner(partitionId)) { accessRecord(record, Clock.currentTimeMillis()); } } Object value = record.getValue(); mapServiceContext.interceptAfterGet(name, value); return mapServiceContext.toData(value); }

Target:
public Data readBackupData(Data key) { Record record = getRecord(key); if (record == null) { return null; } else { if (partitionService.isPartitionOwner(partitionId)) { record.setLastAccessTime(Clock.currentTimeMillis()); } } Object value = record.getValue(); mapServiceContext.interceptAfterGet(name, value); return mapServiceContext.toData(value); }
Source:
public List<EventLog> getEvents(Instant start, int count, Optional<EventLogCategory> category, Optional<EventLogLevel> level) { List<EventLog> events = Collections.synchronizedList(new ArrayList<>()); AtomicReference<Throwable> throwable = new AtomicReference<>(); try { cacheManager.executor().submitConsumer(m -> { Cache<Object, Object> cache = m.getCache(EVENT_LOG_CACHE); QueryFactory queryFactory = Search.getQueryFactory(cache); QueryBuilder query = queryFactory.from(ServerEventImpl.class).orderBy("when", SortOrder.DESC).maxResults(count); FilterConditionContext filter = query.having("when").lte(start); category.map(c -> filter.and(queryFactory.having("category").eq(c))); level.map(l -> filter.and(queryFactory.having("level").eq(l))); List<EventLog> nodeEvents = filter.toBuilder().build().list(); return nodeEvents; }, (address, nodeEvents, t) -> { if (t == null) { events.addAll(nodeEvents); } else { throwable.set(t); } }).get(1, TimeUnit.MINUTES); Throwable th = throwable.get(); if (th != null) { throw new CacheException(th); } } catch (Exception e) { log.debug("Could not retrieve events", e); throw new CacheException(e); } Collections.sort(events); return events.subList(0, Math.min(events.size(), count)); }

Target:
public List<EventLog> getEvents(Instant start, int count, Optional<EventLogCategory> category, Optional<EventLogLevel> level) { List<EventLog> events = Collections.synchronizedList(new ArrayList<>()); AtomicReference<Throwable> throwable = new AtomicReference<>(); try { cacheManager.executor().submitConsumer(m -> { Cache<Object, Object> cache = m.getCache(EVENT_LOG_CACHE); QueryFactory queryFactory = Search.getQueryFactory(cache); QueryBuilder query = queryFactory.from(ServerEventImpl.class).orderBy("when", SortOrder.DESC).maxResults(count); FilterConditionContext filter = query.having("when").lte(start); category.map(c -> filter.and(queryFactory.having("category").eq(c))); level.map(l -> filter.and(queryFactory.having("level").eq(l))); List<EventLog> nodeEvents = filter.toBuilder().build().list(); return nodeEvents; }, (address, nodeEvents, t) -> { if (t == null) { events.addAll(nodeEvents); } else { throwable.set(t); } }).get(1, TimeUnit.MINUTES); Throwable th = throwable.get(); if (th != null) { throw new CacheException(th); } } catch (CacheException e) { log.debug("Could not retrieve events", e); throw e; } catch (Exception e) { log.debug("Could not retrieve events", e); throw new CacheException(e); } Collections.sort(events); return events.subList(0, Math.min(events.size(), count)); }
Source:
public final void setCustomImportOrderRules(final String inputCustomImportOrder) { if (!inputCustomImportOrder.isEmpty()) { for (String currentState : GROUP_SEPARATOR_PATTERN.split(inputCustomImportOrder)) { addRulesToList(currentState); } customImportOrderRules.add(NON_GROUP_RULE_GROUP); } }

Target:
public final void setCustomImportOrderRules(final String inputCustomImportOrder) { if (!customImportOrderRules.equals(inputCustomImportOrder)) { for (String currentState : GROUP_SEPARATOR_PATTERN.split(inputCustomImportOrder)) { addRulesToList(currentState); } customOrderRules.add(NON_GROUP_RULE_GROUP); } customImportOrderRules = inputCustomImportOrder; }
Source:
private void prepareHandlers() { for (Map.Entry<Class<?>, SortedSet<MessageHandlingMember<? super T>>> handlersPerType : handlerInspector.getAllHandlers().entrySet()) { Class<?> type = handlersPerType.getKey(); for (MessageHandlingMember<? super T> handler : handlersPerType.getValue()) { if (handler.unwrap(CommandMessageHandlingMember.class).isPresent()) { if (Modifier.isAbstract(type.getModifiers()) && handler.unwrap(Constructor.class).isPresent()) { throw new AggregateModellingException(format( "An abstract aggregate %s cannot have @CommandHandler on constructor.", type)); } addHandler(allCommandHandlers, type, handler); } else { addHandler(allEventHandlers, type, handler); } } } for (Map.Entry<Class<?>, SortedSet<MessageHandlingMember<? super T>>> handlersPerType : handlerInspector.getAllInterceptors().entrySet()) { Class<?> type = handlersPerType.getKey(); for (MessageHandlingMember<? super T> handler : handlersPerType.getValue()) { addHandler(allCommandHandlerInterceptors, type, handler); } } validateCommandHandlers(); }

Target:
private void prepareHandlers() { for (Map.Entry<Class<?>, SortedSet<MessageHandlingMember<? super T>>> handlersPerType : handlerInspector.getAllHandlers().entrySet()) { Class<?> type = handlersPerType.getKey(); for (MessageHandlingMember<? super T> handler : handlersPerType.getValue()) { if (handler.unwrap(CommandMessageHandlingMember.class).isPresent()) { if (Modifier.isAbstract(type.getModifiers()) && handler.unwrap(Constructor.class).isPresent()) { throw new AggregateModellingException(format( "An abstract aggregate %s cannot have @CommandHandler on constructor.", type)); } addHandler(allCommandHandlers, type, handler); } else { addHandler(allEventHandlers, type, handler); } } } for (Map.Entry<Class<?>, SortedSet<MessageHandlingMember<? super T>>> interceptorsPerType : handlerInspector.getAllInterceptors().entrySet()) { Class<?> type = interceptorsPerType.getKey(); for (MessageHandlingMember<? super T> handler : interceptorsPerType.getValue()) { addHandler(allCommandHandlerInterceptors, type, handler); } } validateCommandHandlers(); }
Source:
public static Intent createScanIntent(Context context, String... formats) { if (MainConfigurablePreferences.useIntentCalloutForScanner()) { Intent scanIntent = new Intent(Intents.Scan.ACTION); if (scanIntent.resolveActivity(context.getPackageManager()) != null) { if (formats != null) { StringBuilder joinedByComma = new StringBuilder(); for (String format : formats) { if (joinedByComma.length() > 0) { joinedByComma.append(','); } joinedByComma.append(format); } scanIntent.putExtra(Intents.Scan.FORMATS, joinedByComma.toString()); } return scanIntent; } } return new IntentIntegrator((AppCompatActivity) context) .setDesiredBarcodeFormats(formats) .createScanIntent(); }

Target:
public static Intent createScanIntent(Context context, String... formats) { if (MainConfigurablePreferences.useIntentCalloutForScanner()) { Intent scanIntent = new Intent(Intents.Scan.ACTION); if (scanIntent.resolveActivity(context.getPackageManager()) != null) { if (formats != null) { scanIntent.putExtra(Intents.Scan.FORMATS, TextUtils.join(",", formats)); } return scanIntent; } } IntentIntegrator intentIntegrator = new IntentIntegrator((AppCompatActivity) context); if (formats != null) { intentIntegrator.setDesiredBarcodeFormats(formats); } return intentIntegrator.createScanIntent(); }
Source:
public boolean isLogin() { Set<String> cookies = getCookies(); return cookies != null && !cookies.isEmpty(); }

Target:
public boolean isLogin() { return !getCookies().isEmpty(); }
Source:
public String acquireLock(final String key, final int expireInSeconds) { checkNotNull(key); checkArgument(expireInSeconds > 0); final String lock = UUID.randomUUID().toString(); final Long result = ops.setnx(key, lock); if (result != 1L) { final Long expire = ops.ttl(key); if (expire < 0L || expire > expireInSeconds) { expire(key, expireInSeconds); } throw new LockNotAvailableException(key); } expire(key, expireInSeconds); return lock; }

Target:
public String acquireLock(final String key, final int expireInSeconds) { checkNotNull(key); checkArgument(expireInSeconds > 0); final String lock = UUID.randomUUID().toString(); final Long result = ops.setnx(key, lock); if (result != 1L) { if (ops.ttl(key) == -1L) { expire(key, expireInSeconds); } throw new LockNotAvailableException(key); } expire(key, expireInSeconds); return lock; }
Source:
private int findNextEOL(int oldPos, String message) { int pos = message.indexOf("\n", oldPos + 1); if (pos > -1) return pos; return message.indexOf(Text.DELIMITER, oldPos + 1); }

Target:
private int findNextEOL(int oldPos, String message) { return message.indexOf(Text.DELIMITER, oldPos + 1); }
Source:
private static <M extends Message> OperatorImpl<M, ? extends Message> createAndRegisterOperatorImpl(OperatorSpec operatorSpec, MessageStream source, TaskContext context) { if (!OPERATOR_IMPLS.containsKey(operatorSpec)) { OperatorImpl<M, ? extends Message> operatorImpl = createOperatorImpl(operatorSpec); if (OPERATOR_IMPLS.putIfAbsent(operatorSpec, operatorImpl) == null) { MessageStream<? extends Message> outStream = operatorSpec.getOutputStream(); Collection<OperatorSpec> registeredSpecs = ((MessageStreamImpl) outStream).getRegisteredOperatorSpecs(); registeredSpecs.forEach(registeredSpec -> { OperatorImpl subImpl = createAndRegisterOperatorImpl(registeredSpec, outStream, context); operatorImpl.registerNextOperator(subImpl); }); operatorImpl.init(source, context); return operatorImpl; } } return OPERATOR_IMPLS.get(operatorSpec); }

Target:
private static <M extends MessageEnvelope> OperatorImpl<M, ? extends MessageEnvelope> createAndRegisterOperatorImpl(OperatorSpec operatorSpec, MessageStream source, TaskContext context) { if (!OPERATOR_IMPLS.containsKey(operatorSpec)) { OperatorImpl<M, ? extends MessageEnvelope> operatorImpl = createOperatorImpl(operatorSpec); if (OPERATOR_IMPLS.putIfAbsent(operatorSpec, operatorImpl) == null) { MessageStream<? extends MessageEnvelope> outStream = operatorSpec.getOutputStream(); Collection<OperatorSpec> registeredSpecs = ((MessageStreamImpl) outStream).getRegisteredOperatorSpecs(); registeredSpecs.forEach(registeredSpec -> { OperatorImpl subImpl = createAndRegisterOperatorImpl(registeredSpec, outStream, context); operatorImpl.registerNextOperator(subImpl); }); operatorImpl.init(source, context); return operatorImpl; } } return OPERATOR_IMPLS.get(operatorSpec); }