auphong2707/dl4se-code-review-dataset huggingface dataset:
Source:
private Diagram getGMFDiagram(Notification notification) { Diagram gmfDiagram = null; DDiagram dDiagram = null; Object notifier = notification.getNotifier(); if (notifier instanceof DDiagram) { dDiagram = (DDiagram) notifier; } else if (notifier instanceof EObject && ((EObject) notifier).eContainer() != null && notifier instanceof DDiagramElement) { dDiagram = ((DDiagramElement) notifier).getParentDiagram(); } else if (notification.getOldValue() instanceof DDiagramElement) { DDiagramElement oldValue = (DDiagramElement) notification.getOldValue(); dDiagram = DDiagramElementSpecOperations.getParentDiagram(oldValue); } if (dDiagram != null) { DiagramCreationUtil diagramCreationUtil = new DiagramCreationUtil(dDiagram); if (diagramCreationUtil.findAssociatedGMFDiagram()) { gmfDiagram = diagramCreationUtil.getAssociatedGMFDiagram(); } else { Resource diagramResource = dDiagram.eResource(); for (final EObject object : diagramResource.getContents()) { if (object instanceof Diagram) { Diagram diagram = (Diagram) object; if (dDiagram.equals(diagram.getElement())) { gmfDiagram = diagram; break; } } } } } return gmfDiagram; }

Target:
private Diagram getGMFDiagram(Notification notification) { Diagram gmfDiagram = null; DDiagram dDiagram = null; Object notifier = notification.getNotifier(); if (notifier instanceof DDiagram) { dDiagram = (DDiagram) notifier; } else if (notifier instanceof DDiagramElement && ((EObject) notifier).eContainer() != null) { dDiagram = ((DDiagramElement) notifier).getParentDiagram(); } else if (notification.getOldValue() instanceof DDiagramElement) { DDiagramElement oldValue = (DDiagramElement) notification.getOldValue(); dDiagram = DDiagramElementSpecOperations.getParentDiagram(oldValue); } if (dDiagram != null) { DiagramCreationUtil diagramCreationUtil = new DiagramCreationUtil(dDiagram); if (diagramCreationUtil.findAssociatedGMFDiagram()) { gmfDiagram = diagramCreationUtil.getAssociatedGMFDiagram(); } else { Resource diagramResource = dDiagram.eResource(); for (final EObject object : diagramResource.getContents()) { if (object instanceof Diagram) { Diagram diagram = (Diagram) object; if (dDiagram.equals(diagram.getElement())) { gmfDiagram = diagram; break; } } } } } return gmfDiagram; }
Source:
public UiContextResponse getContext() throws IOException { User user = userAccountService.getCurrentUser(); String selectedTheme = "/css/bootstrap-4/" + appSettings.getBootstrapTheme(); String themeFingerPrint = themeFingerprintRegistry.getFingerprint(selectedTheme); String themeUri = selectedTheme + "?" + themeFingerPrint; return UiContextResponse.builder() .setMenu(menuReaderService.getMenu().orElse(null)) .setSelectedTheme(themeUri) .setCssHref(appSettings.getCssHref()) .setNavBarLogo(appSettings.getLogoNavBarHref()) .setLogoTop(appSettings.getLogoTopHref()) .setLogoTopMaxHeight(appSettings.getLogoTopMaxHeight()) .setLoginHref(LOGIN_HREF) .setHelpLink(ImmutableMap.of("label", "Help", "href", HELP_HREF)) .setShowCookieWall(cookieWallService.showCookieWall()) .setAuthenticated(currentUserIsAuthenticated()) .setUsername(user.getUsername()) .setEmail(user.getEmail()) .setRoles(getCurrentUserRoles()) .setAdditionalMessage(appSettings.getFooter()) .setVersion(this.molgenisVersion) .setBuildDate(this.molgenisBuildDate) .build(); }

Target:
public UiContextResponse getContext() { User user = userAccountService.getCurrentUser(); return UiContextResponse.builder() .setMenu(menuReaderService.getMenu().orElse(null)) .setSelectedTheme(buildSelectedThemeURL()) .setCssHref(appSettings.getCssHref()) .setNavBarLogo(appSettings.getLogoNavBarHref()) .setLogoTop(appSettings.getLogoTopHref()) .setLogoTopMaxHeight(appSettings.getLogoTopMaxHeight()) .setLoginHref(LOGIN_HREF) .setHelpLink(ImmutableMap.of("label", "Help", "href", HELP_HREF)) .setShowCookieWall(cookieWallService.showCookieWall()) .setAuthenticated(currentUserIsAuthenticated()) .setUsername(user.getUsername()) .setEmail(user.getEmail()) .setRoles(getCurrentUserRoles()) .setAdditionalMessage(appSettings.getFooter()) .setVersion(this.molgenisVersion) .setBuildDate(this.molgenisBuildDate) .build(); }
Source:
public void launch(Instance machine, Agent agent) throws MachineException { final HttpJsonRequest wsAgentPingRequest; try { wsAgentPingRequest = createPingRequest(machine); } catch (ServerException e) { throw new MachineException(e.getServiceError()); } String script = agent.getScript() + "\n" + (Strings.isNullOrEmpty(wsAgentRunCommand) ? DEFAULT_WS_AGENT_RUN_COMMAND : wsAgentRunCommand); final String wsAgentPingUrl = wsAgentPingRequest.getUrl(); try { machineProcessManagerProvider.get().exec(machine.getWorkspaceId(), machine.getId(), new CommandImpl(getAgentName(), script, "Arbitrary"), getWsAgentProcessOutputChannel(machine.getWorkspaceId())); final long pingStartTimestamp = System.currentTimeMillis(); LOG.debug("Starts pinging ws agent. Workspace ID:{}. Url:{}. Timestamp:{}", machine.getWorkspaceId(), wsAgentPingUrl, pingStartTimestamp); while (System.currentTimeMillis() - pingStartTimestamp < wsAgentMaxStartTimeMs) { if (pingWsAgent(wsAgentPingRequest)) { return; } else { Thread.sleep(wsAgentPingDelayMs); } } } catch (BadRequestException | ServerException | NotFoundException wsAgentLaunchingExc) { throw new MachineException(wsAgentLaunchingExc.getLocalizedMessage(), wsAgentLaunchingExc); } catch (InterruptedException e) { Thread.currentThread().interrupt(); throw new MachineException("Ws agent pinging is interrupted"); } LOG.error("Fail pinging ws agent. Workspace ID:{}. Url:{}. Timestamp:{}", machine.getWorkspaceId(), wsAgentPingUrl); throw new MachineException(pingTimedOutErrorMessage); }

Target:
public void launch(Instance machine, Agent agent) throws ServerException { final HttpJsonRequest wsAgentPingRequest; try { wsAgentPingRequest = createPingRequest(machine); } catch (ServerException e) { throw new MachineException(e.getServiceError()); } String script = agent.getScript() + "\n" + firstNonNull(wsAgentRunCommand, DEFAULT_WS_AGENT_RUN_COMMAND); final String wsAgentPingUrl = wsAgentPingRequest.getUrl(); try { CommandImpl command = new CommandImpl(getAgentName(), script, WS_AGENT_PROCESS_NAME); machineProcessManagerProvider.get().exec(machine.getWorkspaceId(), machine.getId(), command, getWsAgentProcessOutputChannel(machine.getWorkspaceId())); final long pingStartTimestamp = System.currentTimeMillis(); LOG.debug("Starts pinging ws agent. Workspace ID:{}. Url:{}. Timestamp:{}", machine.getWorkspaceId(), wsAgentPingUrl, pingStartTimestamp); while (System.currentTimeMillis() - pingStartTimestamp < wsAgentMaxStartTimeMs) { if (pingWsAgent(wsAgentPingRequest)) { return; } else { Thread.sleep(wsAgentPingDelayMs); } } } catch (BadRequestException | ServerException | NotFoundException e) { throw new ServerException(e.getServiceError()); } catch (InterruptedException e) { Thread.currentThread().interrupt(); throw new ServerException("Ws agent pinging is interrupted"); } LOG.error("Fail pinging ws agent. Workspace ID:{}. Url:{}. Timestamp:{}", machine.getWorkspaceId(), wsAgentPingUrl); throw new ServerException(pingTimedOutErrorMessage); }
Source:
public Set<Endpoint> getEndpoints(Resolver.CoordinateDataFilter filter) throws CloudnameException, InterruptedException { Set<Endpoint> endpointsIncluded = new HashSet<Endpoint>(); String cellPath = ZkCoordinatePath.getCloudnameRoot(); try { List<String> cells = zk.getChildren(cellPath, false); for (String cell : cells) { if (! filter.includeCell(cell)) { continue; } String userPath = cellPath + "/" + cell; List<String> users = zk.getChildren(userPath, false); for (String user : users) { if (! filter.includeUser(user)) { continue; } String servicePath = userPath + "/" + user; List<String> services = zk.getChildren(servicePath, false); for (String service : services) { if (! filter.includeService(service)) { continue; } String instancePath = servicePath + "/" + service; List<String> instances = zk.getChildren(instancePath, false); for (String instance : instances) { String statusPath = ZkCoordinatePath.getStatusPath( cell, user, service, Integer.parseInt(instance)); ZkCoordinateData zkCoordinateData = ZkCoordinateData.loadCoordianteData( statusPath, getZooKeeper(), null); Set<Endpoint> endpoints = zkCoordinateData.snapshot().getEndpoints(); for (Endpoint endpoint : endpoints) { if (filter.includeEndpointname(endpoint.getName())) { if (filter.includeServiceState( zkCoordinateData.snapshot().getServiceStatus().getState())) { endpointsIncluded.add(endpoint); } } } } } } } } catch (KeeperException e) { throw new CloudnameException(e); } return endpointsIncluded; }

Target:
public Set<Endpoint> getEndpoints(Resolver.CoordinateDataFilter filter) throws CloudnameException, InterruptedException { final Set<Endpoint> endpointsIncluded = new HashSet<Endpoint>(); String cellPath = ZkCoordinatePath.getCloudnameRoot(); try { List<String> cells = zk.getChildren(cellPath, false); for (String cell : cells) { if (! filter.includeCell(cell)) { continue; } String userPath = cellPath + "/" + cell; List<String> users = zk.getChildren(userPath, false); for (String user : users) { if (! filter.includeUser(user)) { continue; } String servicePath = userPath + "/" + user; List<String> services = zk.getChildren(servicePath, false); for (String service : services) { if (! filter.includeService(service)) { continue; } String instancePath = servicePath + "/" + service; List<String> instances = zk.getChildren(instancePath, false); for (String instance : instances) { String statusPath = ZkCoordinatePath.getStatusPath( cell, user, service, Integer.parseInt(instance)); ZkCoordinateData zkCoordinateData = ZkCoordinateData.loadCoordinateData( statusPath, getZooKeeper(), null); Set<Endpoint> endpoints = zkCoordinateData.snapshot().getEndpoints(); for (Endpoint endpoint : endpoints) { if (filter.includeEndpointname(endpoint.getName())) { if (filter.includeServiceState( zkCoordinateData.snapshot().getServiceStatus().getState())) { endpointsIncluded.add(endpoint); } } } } } } } } catch (KeeperException e) { throw new CloudnameException(e); } return endpointsIncluded; }
Source:
static public void write(InputStream in, OutputStream outStream) throws IOException { try { byte[] byteArray = new byte[BUFFER_SIZE * 2]; while (in.read(byteArray) != -1) { outStream.write(byteArray); } } finally { in.close(); } }

Target:
static public void write(InputStream in, OutputStream outStream) throws IOException { if(in == null || outStream == null) return; try { byte[] byteArray = new byte[BUFFER_SIZE * 2]; int byteCount = 0; while ((byteCount = in.read(byteArray)) != -1) { outStream.write(byteArray, 0, byteCount); } } finally { in.close(); } }
Source:
protected void saveUserProfile(CommonProfile profile, final ActionContext actionContext) { if (isStateless(actionContext)) { actionContext.ctx.args.put(HttpConstants.USER_PROFILE, profile); } else { StorageHelper.saveProfile(actionContext.sessionId, profile); } }

Target:
protected void saveUserProfile(CommonProfile profile, final ActionContext actionContext) { if (isStateless(actionContext)) { actionContext.getCtx().args.put(Pac4jConstants.USER_PROFILE, profile); } else { StorageHelper.saveProfile(actionContext.getSessionId(), profile); } }
Source:
public DatastreamEventProducerImpl(List<DatastreamTask> tasks, TransportProvider transportProvider, CheckpointProvider checkpointProvider, CheckpointPolicy checkpointPolicy, VerifiableProperties config) { Objects.requireNonNull(tasks, "null tasks"); Objects.requireNonNull(transportProvider, "null transport provider"); Objects.requireNonNull(checkpointProvider, "null checkpoint provider"); Objects.requireNonNull(config, "null config"); if (tasks.size() == 0) { throw new IllegalArgumentException("empty task list."); } _destToTaskMap = new HashMap<>(); DatastreamTask task0 = tasks.get(0); for (DatastreamTask task: tasks) { DatastreamVerifier.checkExisting(task.getDatastream()); if (!task.getDatastream().equals(task0.getDatastream())) { throw new IllegalArgumentException("All tasks must belong to the Datastream."); } } _tasks = tasks; _transportProvider = transportProvider; _checkpointProvider = checkpointProvider; _checkpointPolicy = checkpointPolicy; _checkpointHandler = new CheckpointHandler(task0.getDatastream().getMetadata()); if (_checkpointPolicy == CheckpointPolicy.DATASTREAM) { _safeCheckpoints = _checkpointProvider.getCommitted(_tasks); } if (_safeCheckpoints == null) { _safeCheckpoints = new HashMap<>(); } _latestCheckpoints = new HashMap<>(_safeCheckpoints); }

Target:
public DatastreamEventProducerImpl(List<DatastreamTask> tasks, TransportProvider transportProvider, CheckpointProvider checkpointProvider, CheckpointPolicy checkpointPolicy, VerifiableProperties config) { Validate.notNull(tasks, "null tasks"); Validate.notNull(transportProvider, "null transport provider"); Validate.notNull(checkpointProvider, "null checkpoint provider"); Validate.notNull(config, "null config"); Validate.notEmpty(tasks, "empty task list"); DatastreamTask task0 = tasks.get(0); for (DatastreamTask task: tasks) { task.getDatastreamDestination().equals(task0.getDatastreamSource()); } _tasks = tasks; _transportProvider = transportProvider; _checkpointProvider = checkpointProvider; _checkpointPolicy = checkpointPolicy; _checkpointHandler = new CheckpointHandler(config); if (_checkpointPolicy == CheckpointPolicy.DATASTREAM) { _safeCheckpoints = _checkpointProvider.getCommitted(_tasks); } if (_safeCheckpoints == null) { _safeCheckpoints = new HashMap<>(); } _latestCheckpoints = new HashMap<>(); }
Source:
public static void generateLttngTrace(File file) { final int cpus = 25; LttngTraceGenerator gt = new LttngTraceGenerator(134217728, 15625, cpus); gt.writeTrace(file); }

Target:
public static void generateLttngTrace(File file) { final int cpus = 25; LttngTraceGenerator gt = new LttngTraceGenerator(Integer.MAX_VALUE/8L, 250000/16L, cpus); gt.writeTrace(file); }
Source:
protected TraceeMessagePropertiesConverter(TraceeBackend backend, HttpHeaderTransport transportSerialization, String profile) { this.backend = backend; this.transportSerialization = transportSerialization; this.profile = profile; }

Target:
TraceeMessagePropertiesConverter(TraceeBackend backend, HttpHeaderTransport transportSerialization, String profile) { this.backend = backend; this.transportSerialization = transportSerialization; this.profile = profile; }
Source:
public static void updateLabels(Result result){ int teamID = GameController.getGame().getTurnKeeper().getActiveTeamId() - 1; int otherTeamID = (teamID + 1) % GameController.getGame().getTeams().length; if(result == Result.CHECK){ mTeamLabels[otherTeamID].setBackground(Color.RED); mTeamLabels[otherTeamID].setForeground(Color.WHITE); } else { mTeamLabels[(teamID + 1) % GameController.getGame().getTeams().length].setBackground(Color.CYAN); } mTeamLabels[teamID].setBackground(Color.WHITE); mTeamLabels[teamID].setForeground(Color.BLACK); }

Target:
public static void updateLabels(Result result){ int teamID = GameController.getGame().getTurnKeeper().getActiveTeamId(); if(result == Result.CHECK){ mTeamLabels.get(teamID).setBackground(Color.RED); mTeamLabels.get(teamID).setForeground(Color.WHITE); } else { mTeamLabels.get(teamID).setBackground(Color.CYAN); } for(Map.Entry<Integer, JLabel> otherTeamLabel : mTeamLabels.entrySet()) { if(otherTeamLabel.getKey() != teamID) { otherTeamLabel.getValue().setBackground(Color.WHITE); otherTeamLabel.getValue().setForeground(Color.BLACK); } } }
Source:
public void testOpenPortForwardingAndAdvertise() throws Exception { final AttributeSensor<Integer> TARGET_PORT = new BasicAttributeSensor<>(Integer.class, "target.port"); final AttributeSensor<String> PUBLIC_ENDPOINT = new BasicAttributeSensor<>(String.class, "endpoint"); subnetTier = app.createAndManageChild(EntitySpec.create(SubnetTier.class) .configure(SubnetTier.PORT_FORWARDING_MANAGER, portForwardManager) .configure(SubnetTier.PORT_FORWARDER, portForwarder) .configure(SubnetTier.SUBNET_CIDR, Cidr.UNIVERSAL)); app.start(ImmutableList.of(targetMachine)); app.sensors().set(TARGET_PORT, 22); final String privateEndpoint = targetMachine.getAddress().getHostAddress() + ":22"; subnetTier.openPortForwardingAndAdvertise( new EntityAndAttribute<>(app, TARGET_PORT), Optional.<Integer>absent(), Protocol.TCP, Cidr.UNIVERSAL, Optional.of(new EntityAndAttribute<>(app, PUBLIC_ENDPOINT)), Optional.<EntityAndAttribute<String>>absent()); Asserts.succeedsEventually(new Runnable() { public void run() { String publicEndpoint = app.getAttribute(PUBLIC_ENDPOINT); assertEquals(publicEndpoint, privateEndpoint); }}); String publicEndpoint = app.getAttribute(PUBLIC_ENDPOINT); Iterable<String> endpointParts = Splitter.on(":").split(publicEndpoint); assertEquals(Iterables.size(endpointParts), 2, "endpoint="+publicEndpoint); HostAndPort endpointHostAndPort = HostAndPort.fromParts(Iterables.get(endpointParts, 0), Integer.parseInt(Iterables.get(endpointParts, 1))); assertTargetReachableVia(endpointHostAndPort); }

Target:
public void testOpenPortForwardingAndAdvertise() throws Exception { final AttributeSensor<Integer> TARGET_PORT = new BasicAttributeSensor<>(Integer.class, "target.port"); final AttributeSensor<String> PUBLIC_ENDPOINT = new BasicAttributeSensor<>(String.class, "endpoint"); subnetTier = app.createAndManageChild(EntitySpec.create(SubnetTier.class) .configure(SubnetTier.PORT_FORWARDING_MANAGER, portForwardManager) .configure(SubnetTier.PORT_FORWARDER, portForwarder) .configure(SubnetTier.SUBNET_CIDR, Cidr.UNIVERSAL)); app.start(ImmutableList.of(targetMachine)); app.sensors().set(TARGET_PORT, 22); final String privateEndpoint = targetMachine.getAddress().getHostAddress() + ":22"; subnetTier.openPortForwardingAndAdvertise( new EntityAndAttribute<>(app, TARGET_PORT), Optional.<Integer>absent(), Protocol.TCP, Cidr.UNIVERSAL, new EntityAndAttribute<>(app, PUBLIC_ENDPOINT)); Asserts.succeedsEventually(new Runnable() { public void run() { String publicEndpoint = app.getAttribute(PUBLIC_ENDPOINT); assertEquals(publicEndpoint, privateEndpoint); }}); String publicEndpoint = app.getAttribute(PUBLIC_ENDPOINT); Iterable<String> endpointParts = Splitter.on(":").split(publicEndpoint); assertEquals(Iterables.size(endpointParts), 2, "endpoint="+publicEndpoint); HostAndPort endpointHostAndPort = HostAndPort.fromParts(Iterables.get(endpointParts, 0), Integer.parseInt(Iterables.get(endpointParts, 1))); assertTargetReachableVia(endpointHostAndPort); }
Source:
TopologyService(FiringService firingService, PlatformConfiguration platformConfiguration) { topologyService = platformConfiguration.getExtendedConfiguration(org.terracotta.dynamic_config.api.service.TopologyService.class).iterator().next(); this.firingService = Objects.requireNonNull(firingService); this.platformConfiguration = platformConfiguration; this.cluster = Cluster.create(); this.cluster.addStripe(stripe = Stripe.create(topologyService.getRuntimeNodeContext().getStripe().getName())); Collection<DynamicConfigEventService> extendedConfiguration = platformConfiguration.getExtendedConfiguration(DynamicConfigEventService.class); if (!extendedConfiguration.isEmpty()) { extendedConfiguration.iterator().next() .register(new DynamicConfigListener() { @Override public void onNewConfigurationSaved(NodeContext nodeContext, Long version) { for (Node node : nodeContext.getStripe().getNodes()) { stripe.getServerByName(node.getName()).ifPresent(server -> addDynamicConfigAttributes(server, node)); } } }); } }

Target:
TopologyService(FiringService firingService, PlatformConfiguration platformConfiguration) { topologyService = platformConfiguration.getExtendedConfiguration(org.terracotta.dynamic_config.api.service.TopologyService.class).iterator().next(); this.firingService = Objects.requireNonNull(firingService); this.platformConfiguration = platformConfiguration; this.cluster = Cluster.create(); this.cluster.addStripe(stripe = Stripe.create(topologyService.getRuntimeNodeContext().getStripe().getName())); platformConfiguration.getExtendedConfiguration(DynamicConfigEventService.class).iterator().next() .register(new DynamicConfigListener() { @Override public void onNewConfigurationSaved(NodeContext nodeContext, Long version) { for (Node node : nodeContext.getStripe().getNodes()) { stripe.getServerByName(node.getName()).ifPresent(server -> addServerDynamicConfigAttributes(server, node)); } } }); parameterSubstitutor = platformConfiguration.getExtendedConfiguration(IParameterSubstitutor.class).iterator().next(); pathResolver = platformConfiguration.getExtendedConfiguration(PathResolver.class).iterator().next(); }
Source:
protected List<MetricFamilySamples> familySamplesList(Collector.Type type, List<MetricFamilySamples.Sample> samples) { MetricFamilySamples mfs = new MetricFamilySamples(fullname, type, help, samples); List<MetricFamilySamples> mfsList = new ArrayList<MetricFamilySamples>(1); mfsList.add(mfs); return mfsList; }

Target:
List<MetricFamilySamples> familySamplesList(Collector.Type type, List<MetricFamilySamples.Sample> samples) { MetricFamilySamples mfs = new MetricFamilySamples(fullname, type, help, samples); List<MetricFamilySamples> mfsList = new ArrayList<MetricFamilySamples>(1); mfsList.add(mfs); return mfsList; }
Source:
public void getHome(){ driver.get(URL_TABLET); }

Target:
public void getHome(){ driver.get(URL_TABLET_HOME); }
Source:
private Exception createTimeoutException(Thread thread) { StackTraceElement[] stackTrace = thread.getStackTrace(); final Thread stuckThread = getStuckThread (thread); Exception exception = new Exception(String.format( "test timed out after %d %s", fTimeout, fTimeUnit.name().toLowerCase())); if (stuckThread != null) { Exception stuckThreadException = new Exception ("Appears to be stuck in thread " + stuckThread.getName()); StackTraceElement[] threadStack; try { threadStack = stuckThread.getStackTrace(); } catch (SecurityException e) { threadStack = new StackTraceElement[0]; } stuckThreadException.setStackTrace (threadStack); exception = new MultipleFailureException (Arrays.<Throwable>asList (exception, stuckThreadException)); } if (stackTrace != null) { exception.setStackTrace(stackTrace); thread.interrupt(); } return exception; }

Target:
private Exception createTimeoutException(Thread thread) { StackTraceElement[] stackTrace = thread.getStackTrace(); final Thread stuckThread = fLookForStuckThread ? getStuckThread(thread) : null; Exception currThreadException = new Exception(String.format( "test timed out after %d %s", fTimeout, fTimeUnit.name().toLowerCase())); if (stackTrace != null) { currThreadException.setStackTrace(stackTrace); thread.interrupt(); } if (stuckThread != null) { Exception stuckThreadException = new Exception ("Appears to be stuck in thread " + stuckThread.getName()); stuckThreadException.setStackTrace(getStackTrace(stuckThread)); return new MultipleFailureException (Arrays.<Throwable>asList(currThreadException, stuckThreadException)); } else { return currThreadException; } }
Source:
public String handleUserUpdate( @Valid @ModelAttribute(MODEL) UpdateUserCommand command, BindingResult bindingResult) { final RedirectBuilder redirect = new RedirectBuilder() .setPath(CONTROLLER_PATH) .addParameter(REQUEST_PARAMETER_ID, command.getId()); try { if(!bindingResult.hasErrors()){ User user = userService.getUser(command.getId()); command.setUser(user); userService.replaceUser(command.getId(), command.getAsUser()); redirect.addParameter("saveSuccess", true); redirect.setPath(UserViewController.CONTROLLER_PATH); return redirect.build(); } } catch(SCIMDataValidationException e) { LOG.warn("Could not update user.", e); } storeInSession(SESSION_KEY_COMMAND, command); storeBindingResultIntoSession(bindingResult, MODEL); redirect.addParameter(REQUEST_PARAMETER_ERROR, "validation"); return redirect.build(); }

Target:
public String handleUserUpdate( @Valid @ModelAttribute(MODEL) UpdateUserCommand command, BindingResult bindingResult) { final RedirectBuilder redirect = new RedirectBuilder() .setPath(CONTROLLER_PATH) .addParameter(REQUEST_PARAMETER_ID, command.getId()); try { if(!bindingResult.hasErrors()){ User user = userService.getUser(command.getId()); command.setUser(user); userService.replaceUser(command.getId(), command.getAsUser()); redirect.addParameter("saveSuccess", true); redirect.setPath(UserViewController.CONTROLLER_PATH); return redirect.build(); } } catch(SCIMDataValidationException e) { LOG.warn("Validation failed. Unable to update user.", e); } storeInSession(SESSION_KEY_COMMAND, command); storeBindingResultIntoSession(bindingResult, MODEL); redirect.addParameter(REQUEST_PARAMETER_ERROR, "validation"); return redirect.build(); }
Source:
private void updateVmNumaNodeRuntimeInfo() { VmStatistics statistics = vdsmVm.getVmStatistics(); if (!dbVm.getStatus().isRunning()) { dbVm.getStatisticsData().getvNumaNodeStatisticsList().clear(); return; } Map<Integer, VdsNumaNode> vdsNumaNodes = vdsNumaNodesSupplier.get(); Map<Integer, VmNumaNode> vmAllNumaNodesMap = vmNumaNodeDao .getAllVmNumaNodeByVmId(dbVm.getId()).stream() .collect(Collectors.toMap(VmNumaNode::getIndex, Function.identity())); List<VmNumaNode> vmNumaNodesNeedUpdate = new ArrayList<>(); for (VmNumaNode vNode : statistics.getvNumaNodeStatisticsList()) { VmNumaNode dbVmNumaNode = vmAllNumaNodesMap.get(vNode.getIndex()); if (dbVmNumaNode != null) { vNode.setId(dbVmNumaNode.getId()); List<Integer> pinnedNodes = NumaUtils.getPinnedNodeIndexList(dbVmNumaNode.getVdsNumaNodeList()); List<Pair<Guid, Pair<Boolean, Integer>>> runTimePinList = new ArrayList<>(); for (Pair<Guid, Pair<Boolean, Integer>> pair : vNode.getVdsNumaNodeList()) { if (!pinnedNodes.contains(pair.getSecond().getSecond()) && vdsNumaNodes.containsKey(pair.getSecond().getSecond())) { pair.setFirst(vdsNumaNodes.get(pair.getSecond().getSecond()).getId()); pair.getSecond().setFirst(false); runTimePinList.add(pair); } } if (!runTimePinList.isEmpty()) { vNode.setVdsNumaNodeList(runTimePinList); vmNumaNodesNeedUpdate.add(vNode); } } } dbVm.getStatisticsData().getvNumaNodeStatisticsList().addAll(vmNumaNodesNeedUpdate); }

Target:
private void updateVmNumaNodeRuntimeInfo() { VmStatistics statistics = vdsmVm.getVmStatistics(); if (!dbVm.getStatus().isRunning()) { dbVm.getStatisticsData().getvNumaNodeStatisticsList().clear(); return; } Map<Integer, VdsNumaNode> vdsNumaNodes = vdsNumaNodesProvider.get(); Map<Integer, VmNumaNode> vmAllNumaNodesMap = vmNumaNodeDao .getAllVmNumaNodeByVmId(dbVm.getId()).stream() .collect(Collectors.toMap(VmNumaNode::getIndex, Function.identity())); List<VmNumaNode> vmNumaNodesNeedUpdate = new ArrayList<>(); for (VmNumaNode vNode : statistics.getvNumaNodeStatisticsList()) { VmNumaNode dbVmNumaNode = vmAllNumaNodesMap.get(vNode.getIndex()); if (dbVmNumaNode != null) { vNode.setId(dbVmNumaNode.getId()); List<Integer> pinnedNodes = NumaUtils.getPinnedNodeIndexList(dbVmNumaNode.getVdsNumaNodeList()); List<Pair<Guid, Pair<Boolean, Integer>>> runTimePinList = new ArrayList<>(); for (Pair<Guid, Pair<Boolean, Integer>> pair : vNode.getVdsNumaNodeList()) { if (!pinnedNodes.contains(pair.getSecond().getSecond()) && vdsNumaNodes.containsKey(pair.getSecond().getSecond())) { pair.setFirst(vdsNumaNodes.get(pair.getSecond().getSecond()).getId()); pair.getSecond().setFirst(false); runTimePinList.add(pair); } } if (!runTimePinList.isEmpty()) { vNode.setVdsNumaNodeList(runTimePinList); vmNumaNodesNeedUpdate.add(vNode); } } } dbVm.getStatisticsData().getvNumaNodeStatisticsList().addAll(vmNumaNodesNeedUpdate); }
Source:
public static synchronized GitScopeOperationFactory getFactory() { if(instance == null) { instance = new GitScopeOperationFactory(); } return instance; }

Target:
public static synchronized GitScopeOperationFactory getFactory() { if(instance == null) instance = new GitScopeOperationFactory(); return instance; }
Source:
public Iterable<SshKeyCacheEntry> getSshKeyCacheEntries() { return sshKeyIter; }

Target:
Iterable<SshKeyCacheEntry> getSshKeyCacheEntries() { return sshKeyIter; }
Source:
private void loopRunTest( int testRuns ) throws InterruptedException, java.util.concurrent.ExecutionException { List<Throwable> exceptionList = new ArrayList<>(); loopRun( testRuns, exceptionList ); if ( !exceptionList.isEmpty() ) { int additionalRuns = testRuns * 99; loopRun( additionalRuns, exceptionList ); double totalRuns = additionalRuns + testRuns; double failures = exceptionList.size(); double failureRate = failures / totalRuns; if ( failureRate > 0.2 ) { AssertionError error = new AssertionError( "False deadlock failure rate of " + failureRate + " is greater than 2%" ); for ( Throwable th : exceptionList ) { error.addSuppressed( th ); } throw error; } } }

Target:
private void loopRunTest( int testRuns ) throws InterruptedException, java.util.concurrent.ExecutionException { List<Throwable> exceptionList = new ArrayList<>(); loopRun( testRuns, exceptionList ); if ( !exceptionList.isEmpty() ) { int additionalRuns = testRuns * 99; loopRun( additionalRuns, exceptionList ); double totalRuns = additionalRuns + testRuns; double failures = exceptionList.size(); double failureRate = failures / totalRuns; if ( failureRate > 0.02 ) { AssertionError error = new AssertionError( "False deadlock failure rate of " + failureRate + " is greater than 2%" ); for ( Throwable th : exceptionList ) { error.addSuppressed( th ); } throw error; } } }
Source:
protected void performRuntime(OperationContext context, ModelNode operation, Resource resource) throws OperationFailedException { final ModelNode model = resource.getModel(); final String name = context.getCurrentAddressValue(); final String jndiName = ContextServiceResourceDefinition.JNDI_NAME_AD.resolveModelAttribute(context, model).asString(); final boolean useTransactionSetupProvider = ContextServiceResourceDefinition.USE_TRANSACTION_SETUP_PROVIDER_AD.resolveModelAttribute(context, model).asBoolean(); final ServiceName serviceName = ContextServiceResourceDefinition.CAPABILITY.getCapabilityServiceName(name); final ContextServiceService contextServiceService = new ContextServiceService(name, jndiName, new DefaultContextSetupProviderImpl()); final ServiceBuilder<ContextServiceImpl> serviceBuilder = context.getServiceTarget().addService(serviceName, contextServiceService); if (useTransactionSetupProvider) { serviceBuilder.addDependency(ConcurrentServiceNames.TRANSACTION_SETUP_PROVIDER_SERVICE_NAME,TransactionSetupProvider.class,contextServiceService.getTransactionSetupProvider()); } serviceBuilder.install(); }

Target:
protected void performRuntime(OperationContext context, ModelNode operation, Resource resource) throws OperationFailedException { final ModelNode model = resource.getModel(); final String name = context.getCurrentAddressValue(); final String jndiName = ContextServiceResourceDefinition.JNDI_NAME_AD.resolveModelAttribute(context, model).asString(); final boolean useTransactionSetupProvider = ContextServiceResourceDefinition.USE_TRANSACTION_SETUP_PROVIDER_AD.resolveModelAttribute(context, model).asBoolean(); final ContextServiceService contextServiceService = new ContextServiceService(name, jndiName, new DefaultContextSetupProviderImpl()); final CapabilityServiceBuilder serviceBuilder = context.getCapabilityServiceTarget().addCapability(ContextServiceResourceDefinition.CAPABILITY, contextServiceService); if (useTransactionSetupProvider) { serviceBuilder.addDependency(ConcurrentServiceNames.TRANSACTION_SETUP_PROVIDER_SERVICE_NAME,TransactionSetupProvider.class,contextServiceService.getTransactionSetupProvider()); } serviceBuilder.install(); }
Source:
public ValueMatcher makeMatcher(ValueMatcherFactory factory) { return factory.makeValueMatcher( dimension, new DruidCompositePredicate() { @Override public boolean applyLong(long value) { throw new UnsupportedOperationException("Spatial filter is not supported on long columns."); } @Override public boolean apply(Object input) { if (input instanceof String) { final float[] coordinate = SpatialDimensionRowTransformer.decode((String) input); return bound.contains(coordinate); } else { return false; } } } ); }

Target:
public ValueMatcher makeMatcher(ValueMatcherFactory factory) { return factory.makeValueMatcher( dimension, new DruidPredicateFactory() { @Override public Predicate<String> makeStringPredicate() { return new Predicate<String>() { @Override public boolean apply(String input) { if (input == null) { return false; } final float[] coordinate = SpatialDimensionRowTransformer.decode(input); return bound.contains(coordinate); } }; } @Override public DruidLongPredicate makeLongPredicate() { return new DruidLongPredicate() { @Override public boolean applyLong(long input) { return false; } }; } } ); }
Source:
public void lockWatchCreatedWithoutOpenLockGivesNoInformationOnLocks() { UUID leaderId = UUID.randomUUID(); LockWatchStateUpdate update = LockWatchStateUpdate.update(leaderId, 0, ImmutableList.of( LockWatchCreatedEvent.builder(ROW_PREFIX_REQ, UUID.randomUUID()).build(0))); tracker.updateState(update); VersionedLockWatchState state = tracker.currentState(); assertThat(state.version()).isEqualTo(OptionalLong.of(0)); assertThat(state.leaderId()).isEqualTo(leaderId); assertThat(state.lockWatchState(DESCRIPTOR)).isEqualTo(LockWatchInfo.NOT_WATCHED); }

Target:
public void lockWatchCreatedWithoutOpenLockGivesNoInformationOnLocks() { UUID leaderId = UUID.randomUUID(); LockWatchStateUpdate update = LockWatchStateUpdate.update(leaderId, 0, ImmutableList.of( LockWatchCreatedEvent.builder(ROW_PREFIX_REQ, UUID.randomUUID()).build(0))); tracker.updateState(update); VersionedLockWatchState state = tracker.currentState(); assertThat(state.version()).hasValue(0); assertThat(state.leaderId()).isEqualTo(leaderId); assertThat(state.lockWatchState(DESCRIPTOR)).isEqualTo(LockWatchInfo.UNKNOWN); }
Source:
public synchronized SecretKey loadSecretKeyForEncryption() throws IOException, GeneralSecurityException { if (mKey != null && mMacKey != null) return mKey; final byte[] secretKeyData = AuthenticationSettings.INSTANCE.getSecretKeyData(); if(secretKeyData == null && Build.VERSION.SDK_INT < Build.VERSION_CODES.JELLY_BEAN_MR2) { throw new IllegalStateException("Secret key must be provided for API < 18. " + "Use AuthenticationSettings.INSTANCE.setSecretKey()"); } if (secretKeyData != null) { Logger.v(TAG, "Encryption will use user provided secret key."); mKey = getSecretKey(secretKeyData); mMacKey = getMacKey(mKey); mBlobVersion = VERSION_USER_DEFINED; } else { Logger.v(TAG, "Encryption will use keys persisted in AndroidKeyStore."); mKey = getSecretKeyFromAndroidKeyStore(); mMacKey = getMacKey(mKey); mBlobVersion = VERSION_ANDROID_KEY_STORE; } return mKey; }

Target:
synchronized SecretKey loadSecretKeyForEncryption() throws IOException, GeneralSecurityException { if (mKey != null && mHMACKey != null) { return mKey; } final byte[] secretKeyData = AuthenticationSettings.INSTANCE.getSecretKeyData(); if (secretKeyData != null) { mBlobVersion = VERSION_USER_DEFINED; } else { mBlobVersion = VERSION_ANDROID_KEY_STORE; } return getKeyOrCreate(mBlobVersion); }
Source:
public List<Integer> getFailedInvocationNumbers() { return null; }

Target:
public List<Integer> getFailedInvocationNumbers() { return Collections.emptyList(); }
Source:
private static void openWPCOMURL(Activity activity, String url, Theme currentTheme, Blog blog, Boolean isCurrentTheme) { if (activity == null) { AppLog.e(AppLog.T.UTILS, "Context is null"); return; } if (TextUtils.isEmpty(url)) { AppLog.e(AppLog.T.UTILS, "Empty or null URL passed to openUrlByUsingMainWPCOMCredentials"); Toast.makeText(activity, activity.getResources().getText(R.string.invalid_url_message), Toast.LENGTH_SHORT).show(); return; } String authURL = ThemeWebActivity.getBlogLoginUrl(blog); Intent intent = new Intent(activity, ThemeWebActivity.class); intent.putExtra(ThemeWebActivity.AUTHENTICATION_USER, blog.getUsername()); intent.putExtra(ThemeWebActivity.AUTHENTICATION_PASSWD, blog.getPassword()); intent.putExtra(ThemeWebActivity.URL_TO_LOAD, url); intent.putExtra(ThemeWebActivity.AUTHENTICATION_URL, authURL); intent.putExtra(ThemeWebActivity.LOCAL_BLOG_ID, blog.getLocalTableBlogId()); intent.putExtra(IS_PREMIUM_THEME, currentTheme.isPremium()); intent.putExtra(IS_CURRENT_THEME, isCurrentTheme); intent.putExtra(THEME_NAME, currentTheme.getName()); intent.putExtra(ThemeBrowserActivity.THEME_ID, currentTheme.getId()); activity.startActivityForResult(intent, ThemeBrowserActivity.ACTIVATE_THEME); }

Target:
private static void openWPCOMURL(Activity activity, String url, Theme currentTheme, Blog blog, Boolean isCurrentTheme) { if (activity == null) { AppLog.e(AppLog.T.UTILS, "Context is null"); return; } if (TextUtils.isEmpty(url)) { AppLog.e(AppLog.T.UTILS, "Empty or null URL passed to openWPCOMURL"); Toast.makeText(activity, activity.getResources().getText(R.string.invalid_url_message), Toast.LENGTH_SHORT).show(); return; } String authURL = ThemeWebActivity.getBlogLoginUrl(blog); Intent intent = new Intent(activity, ThemeWebActivity.class); intent.putExtra(ThemeWebActivity.AUTHENTICATION_USER, blog.getUsername()); intent.putExtra(ThemeWebActivity.AUTHENTICATION_PASSWD, blog.getPassword()); intent.putExtra(ThemeWebActivity.URL_TO_LOAD, url); intent.putExtra(ThemeWebActivity.AUTHENTICATION_URL, authURL); intent.putExtra(ThemeWebActivity.LOCAL_BLOG_ID, blog.getLocalTableBlogId()); intent.putExtra(IS_PREMIUM_THEME, currentTheme.isPremium()); intent.putExtra(IS_CURRENT_THEME, isCurrentTheme); intent.putExtra(THEME_NAME, currentTheme.getName()); intent.putExtra(ThemeBrowserActivity.THEME_ID, currentTheme.getId()); activity.startActivityForResult(intent, ThemeBrowserActivity.ACTIVATE_THEME); }
Source:
public void setup() { databaseTestHelper = testContext.getDatabaseTestHelper(); defaultTestAccount = DatabaseFixtures .withDatabaseTestHelper(databaseTestHelper) .aTestAccount() .insert(); this.defaultTestCharge = DatabaseFixtures .withDatabaseTestHelper(databaseTestHelper) .aTestCharge() .withTestAccount(defaultTestAccount) .insert(); this.defaultTestToken = DatabaseFixtures .withDatabaseTestHelper(databaseTestHelper) .aTestToken() .withTestToken(defaultTestCharge) .insert(); }

Target:
public void setup() { databaseTestHelper = testContext.getDatabaseTestHelper(); defaultTestAccount = DatabaseFixtures .withDatabaseTestHelper(databaseTestHelper) .aTestAccount() .insert(); defaultTestCharge = DatabaseFixtures .withDatabaseTestHelper(databaseTestHelper) .aTestCharge() .withTestAccount(defaultTestAccount) .insert(); defaultTestToken = DatabaseFixtures .withDatabaseTestHelper(databaseTestHelper) .aTestToken() .withTestToken(defaultTestCharge) .insert(); }
Source:
void setFullscreen(boolean isFullscreen) { if (getView() == null) { return; } mFullscreen = isFullscreen; mControls.setVisibility(isFullscreen ? VISIBLE : View.GONE); AppUtils.toggleWebViewZoom(mWebView.getSettings(), isFullscreen); ViewGroup.LayoutParams params = mWebView.getLayoutParams(); if (isFullscreen) { mScrollView.removeView(mScrollViewContent); mWebView.scrollTo(mScrollView.getScrollX(), mScrollView.getScrollY()); mFullscreenView.addView(mScrollViewContent); params.height = ViewGroup.LayoutParams.MATCH_PARENT; } else { reset(); if (mWebView.getUrl().equals(PDF_LOADER_URL)) { mWebView.setInitialScale(1); } mFullscreenView.removeView(mScrollViewContent); mScrollView.addView(mScrollViewContent); mScrollView.post(() -> mScrollView.scrollTo(mWebView.getScrollX(), mWebView.getScrollY())); params.height = ViewGroup.LayoutParams.WRAP_CONTENT; } mWebView.setLayoutParams(params); }

Target:
void setFullscreen(boolean isFullscreen) { if (getView() == null) { return; } mFullscreen = isFullscreen; mControls.setVisibility(isFullscreen ? VISIBLE : View.GONE); AppUtils.toggleWebViewZoom(mWebView.getSettings(), isFullscreen); ViewGroup.LayoutParams params = mWebView.getLayoutParams(); if (isFullscreen) { mScrollView.removeView(mScrollViewContent); mWebView.scrollTo(mScrollView.getScrollX(), mScrollView.getScrollY()); mFullscreenView.addView(mScrollViewContent); params.height = ViewGroup.LayoutParams.MATCH_PARENT; } else { reset(); int i = 0; while (mWebView.zoomOut() && i < 30) { i++; } mFullscreenView.removeView(mScrollViewContent); mScrollView.addView(mScrollViewContent); mScrollView.post(() -> mScrollView.scrollTo(mWebView.getScrollX(), mWebView.getScrollY())); params.height = ViewGroup.LayoutParams.WRAP_CONTENT; } mWebView.setLayoutParams(params); }
Source:
public Object decode(Response response, Type type) throws IOException, FeignException { if (!(type instanceof ParameterizedType)) { throw new IllegalArgumentException( "StreamDecoder supports only stream: unknown " + type); } ParameterizedType streamType = (ParameterizedType) type; if (!Stream.class.equals(streamType.getRawType())) { throw new IllegalArgumentException( "StreamDecoder supports only stream: unknown " + type); } Iterator<?> iterator = (Iterator) iteratorDecoder.decode(response, new IteratorParameterizedType(streamType)); return StreamSupport.stream( Spliterators.spliteratorUnknownSize(iterator, Spliterator.DISTINCT | Spliterator.NONNULL), false) .onClose(() -> { if (iterator instanceof Closeable) { ensureClosed((Closeable) iterator); } else { ensureClosed(response); } }); }

Target:
public Object decode(Response response, Type type) throws IOException, FeignException { if (!(type instanceof ParameterizedType)) { throw new IllegalArgumentException("StreamDecoder supports only stream: unknown " + type); } ParameterizedType streamType = (ParameterizedType) type; if (!Stream.class.equals(streamType.getRawType())) { throw new IllegalArgumentException("StreamDecoder supports only stream: unknown " + type); } Iterator<?> iterator = (Iterator) iteratorDecoder.decode(response, new IteratorParameterizedType(streamType)); return StreamSupport.stream( Spliterators.spliteratorUnknownSize(iterator, 0), false) .onClose(() -> { if (iterator instanceof Closeable) { ensureClosed((Closeable) iterator); } else { ensureClosed(response); } }); }
Source:
private List<String> getLiveInstanceNames(List<String> nodes) { List<String> liveInstances = new ArrayList<>(); for (String n : nodes) { String hostname = _zkclient.ensureReadData(KeyBuilder.liveInstance(_cluster, n)); if (hostname != null) { liveInstances.add(hostname + "-" + n); } } return liveInstances; }

Target:
private List<String> getLiveInstanceNames(List<String> nodes) { List<String> liveInstances = new ArrayList<>(); for (String n : nodes) { String hostname = _zkclient.ensureReadData(KeyBuilder.liveInstance(_cluster, n)); if (hostname != null) { _log.error("Node is dead. Likely cause it dies after reading list of nodes.", n); liveInstances.add(hostname + "-" + n); } } return liveInstances; }
Source:
private boolean skipJunk() throws IOException { boolean eof = false; int total = 0; while (!validHeader(runningFour)) { if (!readBuffer.hasRemaining()) readMoreData(); if (!readBuffer.hasRemaining()) { eof = true; break; } runningFour <<= 8; runningFour |= readBuffer.get() & 0xff; ++total; } Logger.warn(String.format("[mp3demuxer] Skipped %d byts of junk", total)); return eof; }

Target:
private boolean skipJunk() throws IOException { boolean eof = false; int total = 0; while (!validHeader(runningFour)) { if (!readBuffer.hasRemaining()) readMoreData(); if (!readBuffer.hasRemaining()) { eof = true; break; } runningFour <<= 8; runningFour |= readBuffer.get() & 0xff; ++total; } Logger.warn(String.format("[mp3demuxer] Skipped %d bytes of junk", total)); return eof; }
Source:
private static ActivityResponse call(TestRequest request) { return request .setMediaType(MediaTypes.PROTOBUF) .execute().getInputObject(ActivityResponse.class); }

Target:
private static ActivityResponse call(TestRequest request) { return request.executeProtobuf(ActivityResponse.class); }
Source:
private boolean isQuarriableBlock(int bx, int by, int bz) { boolean cantMine = false; Block block = worldObj.getBlock(bx, by, bz); cantMine = cantMine || !BlockUtil.canChangeBlock(block, worldObj, bx, by, bz); cantMine = cantMine || BuildCraftAPI.isSoftBlock(block, worldObj, bx, by, bz); cantMine = cantMine || (block.getBlockHardness(worldObj, bx, by, bz) > MAX_BREAK_HARDNESS); return !cantMine; }

Target:
private boolean isQuarriableBlock(int bx, int by, int bz) { Block block = worldObj.getBlock(bx, by, bz); return !BlockUtil.canChangeBlock(block, worldObj, bx, by, bz) || BuildCraftAPI.isSoftBlock(block, worldObj, bx, by, bz) || (block.getBlockHardness(worldObj, bx, by, bz) > MAX_BREAK_HARDNESS); }
Source:
protected void setUpData() throws Exception { super.setUpData(); try { dropDataTypesTable(); } catch (SQLException e) { } }

Target:
protected void setUpData() throws Exception { super.setUpData(); try { dropRecreatedTable(); dropDataTypesTable(); } catch (SQLException e) { } }
Source:
public void showCallbackHtml(String htmlOutput, Element parentElement) { initializeOutput(RmdChunkOutputUnit.TYPE_HTML); flushQueuedErrors(); if (StringUtil.isNullOrEmpty(htmlOutput)) return; final ChunkOutputFrame frame = new ChunkOutputFrame("Chunk Feedback"); add(frame); Element body = frame.getDocument().getBody(); Style bodyStyle = body.getStyle(); bodyStyle.setPadding(0, Unit.PX); bodyStyle.setMargin(0, Unit.PX); frame.loadUrlDelayed(htmlOutput, 250, new Command() { @Override public void execute() { DomUtils.fillIFrame(frame.getIFrame(), htmlOutput); DomUtils.forwardWheelEvent(frame.getIFrame().getContentDocument(), parentElement); Document anotherDoc = frame.getWindow().getDocument().getOwnerDocument(); int contentHeight = frame.getWindow().getDocument().getDocumentElement().getOffsetHeight(); frame.getElement().getStyle().setHeight(contentHeight, Unit.PX); frame.getElement().getStyle().setWidth(100, Unit.PCT); onHeightChanged(); Command handler = () -> { frame.getElement().getStyle().setHeight(0, Unit.PX); new Timer() { @Override public void run() { int newHeight = frame.getWindow().getDocument().getDocumentElement().getOffsetHeight(); frame.getElement().getStyle().setHeight(newHeight, Unit.PX); onHeightChanged(); } }.schedule(50); }; MutationObserver.Builder builder = new MutationObserver.Builder(handler); builder.attributes(true); builder.characterData(true); builder.childList(true); builder.subtree(true); MutationObserver observer = builder.get(); observer.observe(frame.getIFrame().getContentDocument().getBody()); } }); }

Target:
public void showCallbackHtml(String htmlOutput, Element parentElement) { initializeOutput(RmdChunkOutputUnit.TYPE_HTML); flushQueuedErrors(); if (StringUtil.isNullOrEmpty(htmlOutput)) return; final ChunkOutputFrame frame = new ChunkOutputFrame("Chunk Feedback"); add(frame); Element body = frame.getDocument().getBody(); Style bodyStyle = body.getStyle(); bodyStyle.setPadding(0, Unit.PX); bodyStyle.setMargin(0, Unit.PX); frame.loadUrlDelayed(htmlOutput, 250, new Command() { @Override public void execute() { DomUtils.fillIFrame(frame.getIFrame(), htmlOutput); DomUtils.forwardWheelEvent(frame.getIFrame().getContentDocument(), parentElement); int contentHeight = frame.getWindow().getDocument().getDocumentElement().getOffsetHeight(); frame.getElement().getStyle().setHeight(contentHeight, Unit.PX); frame.getElement().getStyle().setWidth(100, Unit.PCT); onHeightChanged(); Command handler = () -> { frame.getElement().getStyle().setHeight(0, Unit.PX); new Timer() { @Override public void run() { int newHeight = frame.getWindow().getDocument().getDocumentElement().getOffsetHeight(); frame.getElement().getStyle().setHeight(newHeight, Unit.PX); onHeightChanged(); } }.schedule(50); }; MutationObserver.Builder builder = new MutationObserver.Builder(handler); builder.attributes(true); builder.characterData(true); builder.childList(true); builder.subtree(true); MutationObserver observer = builder.get(); observer.observe(frame.getIFrame().getContentDocument().getBody()); } }); }
Source:
protected void executeCommand() { VmTemplateHandler.lockVmTemplateInTransaction(diskImage.getit_guid(), getCompensationContext()); TransactionSupport.executeInNewTransaction(new TransactionMethod<Void>() { @Override public Void runInTransaction() { VdcReturnValueBase retVal = Backend.getInstance().runInternalAction(VdcActionType .MoveOrCopyImageGroup, createMoveorCopyImageGroupParams()); handleResult(retVal); updateDatabase(); return null; } }); VmTemplateHandler.UnLockVmTemplate(diskImage.getit_guid()); }

Target:
protected void executeCommand() { VmTemplateHandler.lockVmTemplateInTransaction(diskImage.getit_guid(), getCompensationContext()); VdcReturnValueBase retVal = Backend.getInstance().runInternalAction(VdcActionType.MoveOrCopyImageGroup, createMoveorCopyImageGroupParams()); handleResult(retVal); VmTemplateHandler.UnLockVmTemplate(diskImage.getit_guid()); }
Source:
public void onCreate() { this.server = new CoapServer(CoAP_PORT); server.add(new HelloWorldResource()); }

Target:
public void onCreate() { this.server = new CoapServer(); server.add(new HelloWorldResource()); }