auphong2707/dl4se-code-review-dataset huggingface dataset:
Source:
public IMarkerResolution[] getResolutions(IMarker marker) { if (!resolutionsLoaded) { readExtensions(); } String id = marker.getAttribute(ICodanProblemMarker.ID, null); if (id == null && conditionalResolutions.get(id) == null) return new IMarkerResolution[0]; Collection<ConditionalResolution> candidates = conditionalResolutions.get(id); ArrayList<IMarkerResolution> resolutions = new ArrayList<IMarkerResolution>(); if (candidates != null) { candidates.stream() .filter(candidate -> candidate.isApplicableFor(marker)) .peek(candidate -> candidate.setMarkerArguments(marker)) .map(ConditionalResolution::getResolution) .forEach(resolution -> { if(resolution instanceof ICodanMarkerResolution2) { ((ICodanMarkerResolution2) resolution).prepareFor(marker); } resolutions.add(resolution); }); } universalResolutions.stream() .map(elem -> instantiateResolution(elem)) .filter(res -> !(res instanceof ICodanMarkerResolution) || ((ICodanMarkerResolution) res).isApplicable(marker)) .forEach(resolution -> { if(resolution instanceof ICodanMarkerResolution2) { ((ICodanMarkerResolution2) resolution).prepareFor(marker); } resolutions.add(resolution); }); return resolutions.stream().toArray(IMarkerResolution[]::new); }

Target:
public IMarkerResolution[] getResolutions(IMarker marker) { if (!resolutionsLoaded) { readExtensions(); } String id = marker.getAttribute(ICodanProblemMarker.ID, null); if (id == null && conditionalResolutions.get(id) == null) return new IMarkerResolution[0]; Collection<ConditionalResolution> candidates = conditionalResolutions.get(id); ArrayList<IMarkerResolution> resolutions = new ArrayList<IMarkerResolution>(); if (candidates != null) { candidates.stream() .filter(candidate -> candidate.isApplicableFor(marker)) .peek(candidate -> candidate.setMarkerArguments(marker)) .map(ConditionalResolution::getResolution) .forEach(resolutions::add); } universalResolutions.stream() .filter(res -> !(res instanceof ICodanMarkerResolution) || ((ICodanMarkerResolution) res).isApplicable(marker)) .forEach(resolutions::add); return resolutions.stream().peek(res -> { if(res instanceof ICodanMarkerResolutionExtension) { ((ICodanMarkerResolutionExtension) res).prepareFor(marker); } }).toArray(IMarkerResolution[]::new); }
Source:
public void setOwner(final Path path, final String owner, final String group) throws AzureBlobFileSystemException { try (AbfsPerfInfo tracker = startTracking("setOwner", "setOwner")) { if (!getIsNamespaceEnabled()) { throw new UnsupportedOperationException( "This operation is only valid for storage accounts with the hierarchical namespace enabled."); } LOG.debug( "setOwner filesystem: path: owner: group: {}", client.getFileSystem(), path.toString(), owner, group); final String transformedOwner = identityTransformer.transformUserOrGroupForSetRequest(owner); final String transformedGroup = identityTransformer.transformUserOrGroupForSetRequest(group); final AbfsRestOperation op = client.setOwner(AbfsHttpConstants.FORWARD_SLASH + getRelativePath(path, true), transformedOwner, transformedGroup); tracker.registerResult(op.getResult()).registerSuccess(true); } }

Target:
public void setOwner(final Path path, final String owner, final String group) throws AzureBlobFileSystemException { if (!getIsNamespaceEnabled()) { throw new UnsupportedOperationException( "This operation is only valid for storage accounts with the hierarchical namespace enabled."); } try (AbfsPerfInfo perfInfo = startTracking("setOwner", "setOwner")) { LOG.debug( "setOwner filesystem: path: owner: group: {}", client.getFileSystem(), path.toString(), owner, group); final String transformedOwner = identityTransformer.transformUserOrGroupForSetRequest(owner); final String transformedGroup = identityTransformer.transformUserOrGroupForSetRequest(group); final AbfsRestOperation op = client.setOwner( AbfsHttpConstants.FORWARD_SLASH + getRelativePath(path, true), transformedOwner, transformedGroup); perfInfo.registerResult(op.getResult()).registerSuccess(true); } }
Source:
public Set<String> getApplicableFilters() { LinkedHashSet<String> filters = new LinkedHashSet<String>(); if (isEnable()) { filters.add(NO_FILTER); filters.addAll(super.getApplicableFilters()); } return filters; }

Target:
public Set<String> getApplicableFilters() { LinkedHashSet<String> filters = new LinkedHashSet<String>(); if (isEnable()) { filters.add(NO_FILTER); } filters.addAll(super.getApplicableFilters()); return filters; }
Source:
private void setSortOrder(SortOrder sortOrder) { boolean keepSorted = UserPreferences.isQueueKeepSorted(); if (keepSorted) { UserPreferences.setQueueKeepSortedOrder(sortOrder); } QueueSorter.sort(sortOrder, true); }

Target:
private void setSortOrder(SortOrder sortOrder) { UserPreferences.setQueueKeepSortedOrder(sortOrder); QueueSorter.sort(sortOrder, true); }
Source:
private boolean canRemoveVmImageDisk() { setVmId(disk.getvm_guid()); boolean validDisktoDelete = true; List<VM> listVms = getVmsForImageGroup(); int vmCount = 0; while (listVms.size() > vmCount && validDisktoDelete) { VM vm = listVms.get(vmCount++); VmDevice vmDevice = getVmDeviceDAO().get(new VmDeviceId(disk.getId(), vm.getId())); validDisktoDelete = validate(new SnapshotsValidator().vmNotDuringSnapshot(getVmId())) && ImagesHandler.PerformImagesChecks(vm, getReturnValue().getCanDoActionMessages(), vm.getstorage_pool_id(), getParameters().getStorageDomainId(), false, true, false, false, vmDevice.getIsPlugged() && disk.isAllowSnapshot(), vmDevice.getIsPlugged(), false, true, Arrays.asList(disk)); } return validDisktoDelete; }

Target:
private boolean canRemoveVmImageDisk() { setVmId(disk.getvm_guid()); boolean validDisktoDelete = true; List<VM> listVms = getVmsForDiskId(); int vmCount = 0; while (listVms.size() > vmCount && validDisktoDelete) { VM vm = listVms.get(vmCount++); VmDevice vmDevice = getVmDeviceDAO().get(new VmDeviceId(disk.getId(), vm.getId())); validDisktoDelete = validate(new SnapshotsValidator().vmNotDuringSnapshot(getVmId())) && ImagesHandler.PerformImagesChecks(vm, getReturnValue().getCanDoActionMessages(), vm.getstorage_pool_id(), getParameters().getStorageDomainId(), false, true, false, false, vmDevice.getIsPlugged() && disk.isAllowSnapshot(), vmDevice.getIsPlugged(), false, true, Arrays.asList(disk)); } return validDisktoDelete; }
Source:
public static ThriftServerType get(String name) { if (StringUtils.isBlank(name)) { return CUSTOM_HS_HA; } return ThriftServerType.valueOf(name.trim().toUpperCase()); }

Target:
public static ThriftServerType get(String name) { if (StringUtils.isBlank(name)) { return getDefault(); } return ThriftServerType.valueOf(name.trim().toUpperCase()); }
Source:
public void initialise() throws InitialisationException { policyInstance = new LazyValue<>(this.initPolicyInstance()); }

Target:
public void initialise() throws InitialisationException { if (policyInstance == null && policyContext == null) { initPolicyContext(); } policyInstance = new LazyValue<>(this::initPolicyInstance); }
Source:
public void sendNotification(String message, String id){ if (message == null){ message = MESSAGE_CONTENT; } message = messageFormatter(message, id); send(message); }

Target:
public void sendNotification(String message, String id){ if (message == null){ log.warn("empty message has arrived, ignore empty messages"); return; } message = messageFormatter(message, id); send(message); }
Source:
protected Application provideApplication() { return new GuiceApplicationBuilder() .overrides(new AbstractModule() { @Override protected void configure() { bind(SphereClient.class).toInstance(sphereClient); bind(CartInSession.class).toInstance(cartInSession); } }).build(); }

Target:
protected Application provideApplication() { return new GuiceApplicationBuilder() .overrides( bind(SphereClient.class).toInstance(sphereClient), bind(CartInSession.class).toInstance(cartInSession) ).build(); }
Source:
public void base64EncodedPasswordWithAlgorithmShouldWork() { UserDetails ldapUser = ldapUserDetailsService.loadUserByUsername("base64withalgorithm-issue-1840"); assertThat(ldapUser).isInstanceOf(LdapUserDetailsImpl.class); LdapUserDetails ldapUserDetails = (LdapUserDetailsImpl) ldapUser; assertThat(ldapUserDetails.getDn()).isEqualTo( "uid=base64withalgorithm-issue-1840,ou=Users,dc=carlspring,dc=com"); assertThat(ldapUserDetails.getUsername()).isEqualTo("base64withalgorithm-issue-1840"); assertThat(ldapUserDetails.getPassword()).isEqualTo( "{bcrypt}$2a$10$lpwlxyjvXKzN1ccCrw2PBuZx.eVesWbfmTbsrCboMU.gsNWVcZWMi"); assertThat(passwordEncoder.matches("password", ldapUserDetails.getPassword())).isEqualTo(true); assertThat(((List<SimpleGrantedAuthority>) ldapUser.getAuthorities())) .contains( new SimpleGrantedAuthority(SystemRole.REPOSITORY_MANAGER.name()), new SimpleGrantedAuthority("USER_ROLE") ); }

Target:
public void base64EncodedPasswordWithAlgorithmShouldWork() { UserDetails ldapUser = ldapUserDetailsService.loadUserByUsername("issue1840-type-2"); assertThat(ldapUser).isInstanceOf(LdapUserDetailsImpl.class); LdapUserDetails ldapUserDetails = (LdapUserDetailsImpl) ldapUser; assertThat(ldapUserDetails.getDn()).isEqualTo( "uid=issue1840-type-2,ou=Users,dc=carlspring,dc=com"); assertThat(ldapUserDetails.getUsername()).isEqualTo("issue1840-type-2"); assertThat(ldapUserDetails.getPassword()).isEqualTo( "{bcrypt}$2a$10$lpwlxyjvXKzN1ccCrw2PBuZx.eVesWbfmTbsrCboMU.gsNWVcZWMi"); assertThat(passwordEncoder.matches("password", ldapUserDetails.getPassword())).isEqualTo(true); assertThat(((List<SimpleGrantedAuthority>) ldapUser.getAuthorities())) .contains(new SimpleGrantedAuthority(SystemRole.REPOSITORY_MANAGER.name()), new SimpleGrantedAuthority("USER_ROLE")); }
Source:
default DataTransactionResult offer(Iterable<H> valueContainers, MergeFunction function) { DataTransactionBuilder builder = DataTransactionBuilder.builder(); for (H valueContainer : valueContainers) { builder.absorbResult(offer(valueContainer, function)); } return builder.build(); }

Target:
default DataTransactionResult offer(Iterable<H> valueContainers, MergeFunction function) { final DataTransactionBuilder builder = DataTransactionBuilder.builder(); for (H valueContainer : valueContainers) { builder.absorbResult(offer(valueContainer, function)); } return builder.build(); }
Source:
public void testTotalCount() throws Exception { String pqlQuery = "SELECT count(*) FROM " + getTableName(); String sqlQuery = "SELECT count(*) FROM " + getTableName(); testQuery(pqlQuery, Collections.singletonList(sqlQuery)); }

Target:
public void testTotalCount() throws Exception { String query = "SELECT count(*) FROM " + getTableName(); testQuery(query, Collections.singletonList(query)); }
Source:
public static boolean openDeleteWizard( IStructuredSelection structuredSelection) { return runCommand(LTK_DELETE_ID, structuredSelection, new HashMap<>()); }

Target:
public static boolean openDeleteWizard( IStructuredSelection structuredSelection) { return runCommand(LTK_DELETE_ID, structuredSelection, Collections.emptyMap()); }
Source:
public Opt<Identity> enter(final Request request) throws IOException { String authorization = ""; String user = ""; String pass = ""; boolean found = false; Opt<Identity> identity = new Opt.Empty<Identity>(); for (final String head : request.head()) { if (head.startsWith(AUTH_HEAD)) { authorization = head.split(AUTH_HEAD)[1].trim(); authorization = new String( DatatypeConverter.parseBase64Binary(authorization) ); user = authorization.split(":")[0]; pass = authorization.substring(user.length() + 1); found = true; break; } } if (found && this.entry.check(user, pass)) { final ConcurrentMap<String, String> props = new ConcurrentHashMap<String, String>(0); identity = new Opt.Single<Identity>( new Identity.Simple( String.format("urn:basic:%s", user), props ) ); } return identity; }

Target:
public Opt<Identity> enter(final Request request) throws IOException { final String decoded = new String( DatatypeConverter.parseBase64Binary( new RqHeaders.Smart( new RqHeaders.Base(request) ).single("authorization").split(AUTH_HEAD)[1] ) ).trim(); final String user = decoded.split(":")[0]; final Opt<Identity> identity = this.entry.enter( user, decoded.substring(user.length() + 1) ); if (!identity.has()) { throw new RsForward( new RsWithHeader( new RsFlash("access denied", Level.WARNING), String.format( "WWW-Authenticate: Basic ream=\"%s\"", this.realm ) ), HttpURLConnection.HTTP_UNAUTHORIZED, new RqHref.Base(request).href() ); } return identity; }
Source:
public static String unshorten(String text) { while (true) { try { Matcher m = emoji_pattern.matcher(text); if (m.find()) { String emoji = m.group(1); text = m.replaceFirst(emoji); continue; } } catch (Throwable e) { DAO.severe(e); break; } try { Matcher m = emoji_pattern_span.matcher(text); if (m.find()) { String emoji = m.group(1); text = m.replaceFirst(emoji); continue; } } catch (Throwable e) { DAO.severe(e); break; } try { Matcher m = hashtag_pattern.matcher(text); if (m.find()) { text = m.replaceFirst(" #" + m.group(1) + " "); continue; } } catch (Throwable e) { DAO.severe(e); break; } try { Matcher m = timeline_link_pattern.matcher(text); if (m.find()) { String expanded = RedirectUnshortener.unShorten(m.group(2)); text = m.replaceFirst(" " + expanded); continue; } } catch (Throwable e) { DAO.severe(e); break; } try { Matcher m = timeline_embed_pattern.matcher(text); if (m.find()) { String shorturl = RedirectUnshortener.unShorten(m.group(2)); text = m.replaceFirst(""); continue; } } catch (Throwable e) { DAO.severe(e); break; } break; } text = cleanup_pattern.matcher(text).replaceAll(""); text = MessageEntry.html2utf8(text); text = doublespace_pattern.matcher(text).replaceAll(" "); text = text.trim(); return text; }

Target:
public static String unshorten(String text) { while (true) { try { Matcher m = emoji_pattern.matcher(text); if (m.find()) { String emoji = m.group(1); text = m.replaceFirst(emoji); continue; } } catch (Throwable e) { DAO.severe(e); break; } try { Matcher m = emoji_pattern_span.matcher(text); if (m.find()) { String emoji = m.group(1); text = m.replaceFirst(emoji); continue; } } catch (Throwable e) { DAO.severe(e); break; } try { Matcher m = hashtag_pattern.matcher(text); if (m.find()) { text = m.replaceFirst(" #" + m.group(1) + " "); continue; } } catch (Throwable e) { DAO.severe(e); break; } try { Matcher m = timeline_link_pattern.matcher(text); if (m.find()) { String expanded = RedirectUnshortener.unShorten(m.group(2)); text = m.replaceFirst(" " + expanded); continue; } } catch (Throwable e) { DAO.severe(e); break; } try { Matcher m = timeline_embed_pattern.matcher(text); if (m.find()) { text = m.replaceFirst(""); continue; } } catch (Throwable e) { DAO.severe(e); break; } break; } text = cleanup_pattern.matcher(text).replaceAll(""); text = MessageEntry.html2utf8(text); text = doublespace_pattern.matcher(text).replaceAll(" "); text = text.trim(); return text; }
Source:
protected Guid removeMemoryImage(List<Guid> guids) { Guid taskId1 = enclosingCommand.persistAsyncTaskPlaceHolder(VmCommand.DELETE_PRIMARY_IMAGE_TASK_KEY); VDSReturnValue vdsRetValue; try { vdsRetValue = Backend.getInstance().getResourceManager().RunVdsCommand( VDSCommandType.DeleteImageGroup, buildDeleteMemoryImageParams(guids)); if (!vdsRetValue.getSucceeded()) { return null; } } catch(VdcBLLException e) { if (e.getErrorCode() == VdcBllErrors.ImageDoesNotExistInDomainError) { return Guid.Empty; } throw e; } Guid guid1 = enclosingCommand.createTask(taskId1, vdsRetValue.getCreationInfo(), enclosingCommand.getActionType(), VdcObjectType.Storage, guids.get(0)); enclosingCommand.getTaskIdList().add(guid1); return guid1; }

Target:
protected Guid removeMemoryImage(List<Guid> guids) { return removeImage( VmCommand.DELETE_PRIMARY_IMAGE_TASK_KEY, buildDeleteMemoryImageParams(guids)); }
Source:
public boolean isAlwaysFalse() { return anyFalseLiteralNonEquiConditions; }

Target:
public boolean isAlwaysFalse() { return isAlwaysFalse; }
Source:
public DayProfile(final Integer dayId, final List<DayProfileAction> dayProfileActionList) { super(); this.dayId = dayId; this.dayProfileActionList = new ArrayList<DayProfileAction>(dayProfileActionList); }

Target:
public DayProfile(final Integer dayId, final List<DayProfileAction> dayProfileActionList) { this.dayId = dayId; this.dayProfileActionList = new ArrayList<DayProfileAction>(dayProfileActionList); }
Source:
public PlanNodeCostEstimate visitUnion(UnionNode node, Void context) { return CostCalculatorUsingExchanges.calculateExchangeCost( numberOfNodes, getStats(node), node.getOutputSymbols(), GATHER, REMOTE, types); }

Target:
public PlanNodeCostEstimate visitUnion(UnionNode node, Void context) { double inputSizeInBytes = getStats(node).getOutputSizeInBytes(node.getOutputSymbols(), types); return calculateRemoteGatherCost(inputSizeInBytes); }
Source:
protected void internalReceiveCommand(String itemName, Command command) { if (gpio != null) { try { if (registryLock.readLock().tryLock(REGISTRYLOCK_TIMEOUT, REGISTRYLOCK_TIMEOUT_UNITS)) { try { GPIOPin gpioPin = (GPIOPin) registry.get(itemName); if (gpioPin != null) { if (command == OnOffType.ON) { gpioPin.setValue(GPIOPin.VALUE_HIGH); logger.debug("Send command 1 to GPIO " + gpioPin.getPinNumber().toString()); } else { gpioPin.setValue(GPIOPin.VALUE_LOW); logger.debug("Send command 0 to GPIO " + gpioPin.getPinNumber().toString()); } } } catch (IOException e) { logger.error("Error occured while changing pin state for item " + itemName + ", exception: " + e.getMessage()); return; } finally { registryLock.readLock().unlock(); } } else { logger.error("Pin state for item " + itemName + " hasn't been changed, timeout expired while waiting for registry lock"); return; } } catch (InterruptedException e) { logger.error("Pin state for item " + itemName + " hasn't been changed, thread was interrupted while waiting for registry lock"); return; } } super.internalReceiveCommand(itemName, command); }

Target:
protected void internalReceiveCommand(String itemName, Command command) { if (gpio != null) { try { if (registryLock.readLock().tryLock(REGISTRYLOCK_TIMEOUT, REGISTRYLOCK_TIMEOUT_UNITS)) { try { GPIOPin gpioPin = (GPIOPin) registry.get(itemName); if (gpioPin != null) { if (command == OnOffType.ON) { gpioPin.setValue(GPIOPin.VALUE_HIGH); logger.debug("Send command 1 to GPIO {}", gpioPin.getPinNumber()); } else { gpioPin.setValue(GPIOPin.VALUE_LOW); logger.debug("Send command 0 to GPIO {}", gpioPin.getPinNumber()); } } } catch (IOException e) { logger.error("Error occured while changing pin state for item " + itemName + ", exception: " + e.getMessage()); return; } finally { registryLock.readLock().unlock(); } } else { logger.error("Pin state for item " + itemName + " hasn't been changed, timeout expired while waiting for registry lock"); return; } } catch (InterruptedException e) { logger.error("Pin state for item " + itemName + " hasn't been changed, thread was interrupted while waiting for registry lock"); return; } } super.internalReceiveCommand(itemName, command); }
Source:
public TreeSet<T> scan(T zero, BiFunction<? super T, ? super T, ? extends T> operation) { Objects.requireNonNull(operation, "operation is null"); return Collections.scanLeft(this, zero, operation, it -> TreeSet.ofAll(comparator(), it)); }

Target:
public TreeSet<T> scan(T zero, BiFunction<? super T, ? super T, ? extends T> operation) { Objects.requireNonNull(operation, "operation is null"); return Collections.scanLeft(this, zero, operation, iter -> TreeSet.ofAll(comparator(), iter)); }
Source:
public AttributeSensorAndConfigKey(Class<ConfigType> configType, Class<SensorType> sensorType, String name, String description, Object defaultValue) { super(sensorType, name, description); ConfigType defaultValueTyped; try { defaultValueTyped = TypeCoercions.coerce(defaultValue, configType); } catch (Exception e) { log.warn("Invalid default value '"+defaultValue+"' for "+name+" (rethrowing: "+e, e); throw Throwables.propagate(e); } configKey = new BasicConfigKey<ConfigType>(configType, name, description, defaultValueTyped); }

Target:
public AttributeSensorAndConfigKey(Class<ConfigType> configType, Class<SensorType> sensorType, String name, String description, Object defaultValue) { super(sensorType, name, description); ConfigType defaultValueTyped; try { defaultValueTyped = TypeCoercions.coerce(defaultValue, configType); } catch (Exception e) { log.warn("Invalid default value '"+defaultValue+"' for "+name+" (rethrowing: "+e, e); throw Exceptions.propagate(e); } configKey = new BasicConfigKey<ConfigType>(configType, name, description, defaultValueTyped); }
Source:
private void showNetworkError() { try { if(player!=null){ if (player.isPlayingLocally() || player.isPlaying() ) { hideNetworkError(); } else { if(!isVideoMessageDisplayed){ unlockOrientation(); hideCCPopUp(); hideSettingsPopUp(); player.hideController(); clearAllErrors(); if (NetworkUtil.isConnected(getActivity())) { showVideoNotAvailable(); } else { View errorView = getView().findViewById(R.id.panel_network_error); errorView.setVisibility(View.VISIBLE); } isNetworkMessageDisplayed = true; isShownWifiSettingsMessage = false; resetClosedCaptioning(); } } }else{ if (NetworkUtil.isConnected(getActivity())) { showVideoNotAvailable(); } else { View errorView = getView().findViewById(R.id.panel_network_error); errorView.setVisibility(View.VISIBLE); } } } catch(Exception ex) { logger.error(ex); } }

Target:
private void showNetworkError() { try { if(player!=null){ if (player.isPlayingLocally() || player.isPlaying() ) { hideNetworkError(); } else { if(!curMessageTypes.contains(VideoNotPlayMessageType.IS_VIDEO_MESSAGE_DISPLAYED)){ unlockOrientation(); hideCCPopUp(); hideSettingsPopUp(); player.hideController(); clearAllErrors(); if (NetworkUtil.isConnected(getActivity())) { showVideoNotAvailable(VideoNotPlayMessageType.IS_VIDEO_MESSAGE_DISPLAYED); } else { View errorView = getView().findViewById(R.id.panel_network_error); errorView.setVisibility(View.VISIBLE); } curMessageTypes.add(VideoNotPlayMessageType.IS_NETWORK_MESSAGE_DISPLAYED); resetClosedCaptioning(); } } }else{ if (NetworkUtil.isConnected(getActivity())) { showVideoNotAvailable(VideoNotPlayMessageType.IS_VIDEO_MESSAGE_DISPLAYED); } else { View errorView = getView().findViewById(R.id.panel_network_error); errorView.setVisibility(View.VISIBLE); } } } catch(Exception ex) { logger.error(ex); } }
Source:
public void testOpenSessionEditorByDoubleClick2() { SWTBotPerspective javaPerspective = bot.perspectiveByLabel("Java"); javaPerspective.activate(); SWTBotView packageExplorerView = bot.viewById("org.eclipse.jdt.ui.PackageExplorer"); packageExplorerView.setFocus(); SWTBot packageExplorerViewBot = packageExplorerView.bot(); SWTBotTreeItem expandedNode = packageExplorerViewBot.tree().expandNode("DesignerTestProject", true); SWTBotTreeItem node = expandedNode.getNode("My.aird"); node.doubleClick(); bot.waitUntil(new DefaultCondition() { @Override public boolean test() throws Exception { return PlatformUI.getWorkbench().getWorkbenchWindows()[0].getActivePage().getActiveEditor() != null; } @Override public String getFailureMessage() { return "Wrong Active editor is : " + PlatformUI.getWorkbench().getWorkbenchWindows()[0].getActivePage().getActiveEditor().getEditorSite().getId(); } }); assertEquals("The session editor has not opened.", "org.eclipse.sirius.ui.editor.session", PlatformUI.getWorkbench().getWorkbenchWindows()[0].getActivePage().getActiveEditor().getEditorSite().getId()); }

Target:
public void testOpenSessionEditorByDoubleClick2() { SWTBotPerspective javaPerspective = bot.perspectiveByLabel("Java"); javaPerspective.activate(); SWTBotView packageExplorerView = bot.viewById("org.eclipse.jdt.ui.PackageExplorer"); packageExplorerView.setFocus(); SWTBot packageExplorerViewBot = packageExplorerView.bot(); assertSessionEditorOpened(packageExplorerViewBot); }
Source:
protected Response beforeInvoke() throws Exception { if (0 <= commandTopologyId && commandTopologyId < handler.stateTransferManager.getFirstTopologyAsMember()) { if (handler.isTraceEnabled()) { handler.getLog().tracef("Ignoring command sent before the local node was a member " + "(command topology id is %d)", commandTopologyId); } return CacheNotFoundResponse.INSTANCE; } topologyMode.await(handler.getStateTransferLock(), waitTopology()); return super.beforeInvoke(); }

Target:
protected Response beforeInvoke() throws Exception { switch (topologyMode) { case WAIT_TOPOLOGY: handler.getStateTransferLock().waitForTopology(waitTopology(), 1, TimeUnit.DAYS); break; case WAIT_TX_DATA: handler.getStateTransferLock().waitForTransactionData(waitTopology(), 1, TimeUnit.DAYS); break; default: break; } if (handler.isCommandSentBeforeFirstTopology(commandTopologyId)) { return CacheNotFoundResponse.INSTANCE; } return super.beforeInvoke(); }
Source:
public CommandResult<CanvasViolation> move( final Element element, final double tx, final double ty ) { final UpdateElementPositionCommand c = canvasCommandFactory .updatePosition( ( Node<View<?>, Edge> ) element, tx, ty ); CommandResult<CanvasViolation> result = canvasCommandManager.allow( canvasHandler, c ); if ( !CommandUtils.isError( result ) ) { result = canvasCommandManager.execute( canvasHandler, c ); } if ( CommandUtils.isError( result ) ) { LOGGER.log( Level.SEVERE, "Update element's position comman failed [result=" + result + "]" ); } return result; }

Target:
public CommandResult<CanvasViolation> move( final Element element, final double tx, final double ty ) { final UpdateElementPositionCommand c = canvasCommandFactory .updatePosition( ( Node<View<?>, Edge> ) element, tx, ty ); CommandResult<CanvasViolation> result = canvasCommandManager.allow( canvasHandler, c ); if ( !CommandUtils.isError( result ) ) { result = canvasCommandManager.execute( canvasHandler, c ); } if ( CommandUtils.isError( result ) ) { LOGGER.log( Level.SEVERE, "Update element's position command failed [result=" + result + "]" ); } return result; }
Source:
private void loadMetadataResources(JobModel jobModel) { CoordinatorStreamStore coordinatorStreamStore = null; try { coordinatorStreamStore = createCoordinatorStreamStore(); coordinatorStreamStore.init(); MetadataResourceUtil metadataResourceUtil = new MetadataResourceUtil(jobModel, metrics.getMetricsRegistry()); metadataResourceUtil.createResources(); CoordinatorStreamValueSerde jsonSerde = new CoordinatorStreamValueSerde(SetConfig.TYPE); NamespaceAwareCoordinatorStreamStore configStore = new NamespaceAwareCoordinatorStreamStore(coordinatorStreamStore, SetConfig.TYPE); for (Map.Entry<String, String> entry : config.entrySet()) { byte[] serializedValue = jsonSerde.toBytes(entry.getValue()); configStore.put(entry.getKey(), serializedValue); } StartpointManager startpointManager = createStartpointManager(coordinatorStreamStore); startpointManager.start(); try { startpointManager.fanOut(jobModel.getTaskToSystemStreamPartitions()); } catch (IOException ex) { throw new SamzaException(String.format("Error calling fan out from StartpointManager."), ex); } finally { startpointManager.stop(); } } finally { if (coordinatorStreamStore != null) { LOG.info("Stopping the coordinator stream metadata store."); coordinatorStreamStore.close(); } } }

Target:
void loadMetadataResources(JobModel jobModel) { CoordinatorStreamStore coordinatorStreamStore = null; try { coordinatorStreamStore = createCoordinatorStreamStore(); coordinatorStreamStore.init(); MetadataResourceUtil metadataResourceUtil = createMetadataResourceUtil(jobModel); metadataResourceUtil.createResources(); CoordinatorStreamValueSerde jsonSerde = new CoordinatorStreamValueSerde(SetConfig.TYPE); NamespaceAwareCoordinatorStreamStore configStore = new NamespaceAwareCoordinatorStreamStore(coordinatorStreamStore, SetConfig.TYPE); for (Map.Entry<String, String> entry : config.entrySet()) { byte[] serializedValue = jsonSerde.toBytes(entry.getValue()); configStore.put(entry.getKey(), serializedValue); } StartpointManager startpointManager = createStartpointManager(coordinatorStreamStore); startpointManager.start(); try { startpointManager.fanOut(JobModelUtil.getTaskToSystemStreamPartitions(jobModel)); } finally { startpointManager.stop(); } } catch (IOException ex) { throw new SamzaException(String.format("IO exception while loading metadata resources."), ex); } finally { if (coordinatorStreamStore != null) { LOG.info("Stopping the coordinator stream metadata store."); coordinatorStreamStore.close(); } } }
Source:
protected Object decode(ChannelHandlerContext ctx, ByteBuf buffer) throws Exception { int curIndex = buffer.readerIndex(); try { ByteBuf frame = (ByteBuf) super.decode(ctx, buffer); if (frame == null) { return null; } Frame theFrame = Frame.create(frame); Message.Response.Type.fromOpcode(theFrame.header.opcode); return theFrame; } catch (CorruptedFrameException e) { throw new DriverInternalError(e); } catch (io.netty.handler.codec.TooLongFrameException e) { int streamId = protocolVersion > 2 ? buffer.getShort(curIndex + 2) : buffer.getByte(curIndex + 2); throw new TooLongFrameException(streamId, e); } }

Target:
protected Object decode(ChannelHandlerContext ctx, ByteBuf buffer) throws Exception { int curIndex = buffer.readerIndex(); try { ByteBuf frame = (ByteBuf) super.decode(ctx, buffer); if (frame == null) { return null; } Frame theFrame = Frame.create(frame); Message.Response.Type.fromOpcode(theFrame.header.opcode); return theFrame; } catch (CorruptedFrameException e) { throw new DriverInternalError(e); } catch (TooLongFrameException e) { int streamId = protocolVersion > 2 ? buffer.getShort(curIndex + 2) : buffer.getByte(curIndex + 2); throw new FrameTooLongException(streamId); } }
Source:
private static boolean isThrowableTypeIn(Throwable e, Class<? extends Throwable>... recognizedExceptionTypes) { for (Class<?> recognizedExceptionType : recognizedExceptionTypes) { if (recognizedExceptionType.isInstance(e)) { return true; } } return false; }

Target:
private static boolean isThrowableTypeIn(Throwable e, Class<? extends Throwable>... recognizedExceptionTypes) { for (Class recognizedExceptionType : recognizedExceptionTypes) { if (recognizedExceptionType.isInstance(e)) { return true; } } return false; }
Source:
public void update() { if (activeEditor != null && activeEditor.getEditorInput() instanceof SessionEditorInput && ((SessionEditorInput) activeEditor.getEditorInput()).getStatus() == null) { super.update(); } }

Target:
public void update() { if (activeEditor != null && activeEditor.getEditorInput() instanceof SessionEditorInput && ((SessionEditorInput) activeEditor.getEditorInput()).getStatus().getSeverity() < IStatus.ERROR) { super.update(); } }
Source:
public boolean isAsyncStarted(ServletRequest request) { boolean isAsyncStarted; try { Method isAsyncStartedMethod = servletRequestClass.getMethod(IS_ASYNC_STARTED_METHOD_NAME); isAsyncStarted = (Boolean) isAsyncStartedMethod.invoke(request); } catch (Exception e) { isAsyncStarted = false; ServletLogger.LOG.warn(e); } return isAsyncStarted; }

Target:
public boolean isAsyncStarted(ServletRequest request) { if (isAsyncStartedMethod != null) { try { return (Boolean) isAsyncStartedMethod.invoke(request); } catch (IllegalAccessException e) { ServletLogger.LOG.error(e); return false; } catch (InvocationTargetException e) { ServletLogger.LOG.error(e); return false; } } else { return false; } }
Source:
protected void onLoad() { super.onLoad(); Util.ACCOUNT_SVC .myProjectWatch(new ScreenLoadCallback<List<AccountProjectWatchInfo>>( this) { public void preDisplay(final List<AccountProjectWatchInfo> result) { watchedProjects = result; watches.display(result); displayUnwatchedProjects(); } }); Util.PROJECT_SVC.visibleProjects(new ScreenLoadCallback<List<Project>>(this) { @Override protected void preDisplay(final List<Project> result) { allProjects = new ArrayList(result); allProjects.remove(0); displayUnwatchedProjects(); } }); }

Target:
protected void onLoad() { super.onLoad(); populateWatches(); }
Source:
protected void processImages() { if (getVm().getOrigin() == OriginType.KVM) { DiskImage disk = getVm().getImages().get(0); if (disk != null) { disk.setBoot(true); } } ArrayList<Guid> diskIds = new ArrayList<>(); for (DiskImage image : getVm().getImages()) { Guid diskId = createDisk(image); diskIds.add(diskId); } getParameters().setDisks(diskIds); setSucceeded(true); }

Target:
protected void processImages() { if (getVm().getOrigin() == OriginType.KVM && !getVm().getImages().isEmpty()) { getVm().getImages().get(0).setBoot(true); } ArrayList<Guid> diskIds = new ArrayList<>(); for (DiskImage image : getVm().getImages()) { Guid diskId = createDisk(image); diskIds.add(diskId); } getParameters().setDisks(diskIds); setSucceeded(true); }
Source:
public boolean longLifeTokenExist(String clientId, String userId, Collection<String> scopes) { Collection<OAuth2AccessToken> existingTokens = orcidTokenStore.findTokensByClientIdAndUserName(clientId, userId); if(existingTokens == null || existingTokens.isEmpty()) { return false; } for(OAuth2AccessToken token : existingTokens) { if (token.getAdditionalInformation().get("persistent") != null && Boolean.valueOf((token.getAdditionalInformation().get("persistent").toString()))){ if(token.getScope().containsAll(scopes) && scopes.containsAll(token.getScope())) { return true; } } } return false; }

Target:
public boolean longLifeTokenExist(String clientId, String userId, Collection<String> scopes) { Collection<OAuth2AccessToken> existingTokens = orcidTokenStore.findTokensByClientIdAndUserName(clientId, userId); if(existingTokens == null || existingTokens.isEmpty()) { return false; } for(OAuth2AccessToken token : existingTokens) { if (token.getAdditionalInformation().get(OrcidOauth2Constants.PERSISTENT) != null && Boolean.valueOf((token.getAdditionalInformation().get("persistent").toString()))){ if(token.getScope().containsAll(scopes) && scopes.containsAll(token.getScope())) { return true; } } } return false; }
Source:
public void run(Server server, User user, String commandLabel, String[] args) throws Exception { boolean acceptingPay = !user.isAcceptingPay(); if (commandLabel.contains("payon")) { acceptingPay = true; } else if (commandLabel.contains("payoff")) { acceptingPay = false; } user.setAcceptingPay(acceptingPay); user.sendMessage(acceptingPay ? tl("payToggleOn") : tl("payToggleOff")); }

Target:
public void run(Server server, User user, String commandLabel, String[] args) throws Exception { if (commandLabel.contains("payon")) { togglePlayer(user.getSource(), user, true); } else if (commandLabel.contains("payoff")) { togglePlayer(user.getSource(), user, false); } else { handleToggleWithArgs(server, user, args); } }
Source:
public void decorate(SSLSocket sslSocket) { if (supportedProtocols == null) { readSupportedProtocols(sslSocket); } sslSocket.setEnabledProtocols(getClientEnabledProtocols()); if (!relaxedTrust) { sslSocket.setEnabledCipherSuites(sslSocket.getSupportedCipherSuites()); } }

Target:
public void decorate(SSLSocket sslSocket) { if (supportedProtocols == null) { readSupportedProtocols(sslSocket); } sslSocket.setEnabledProtocols(getClientEnabledProtocols()); if (relaxedTrust) { sslSocket.setEnabledCipherSuites(sslSocket.getSupportedCipherSuites()); } }
Source:
Optional<ParticipantStatus> getStatus() throws InvalidLRAStateException { if (future == null) { return Optional.empty(); } if (future.isDone()) { try { future.get(); return Optional.of(getExpectedStatus()); } catch (ExecutionException e) { return Optional.of(getFailedStatus()); } catch (InterruptedException e) { return Optional.of(getFailedStatus()); } } else if (future.isCancelled()) { return Optional.of(getExpectedStatus()); } else { return Optional.of(getCurrentStatus()); } }

Target:
Optional<ParticipantStatus> getStatus() throws InvalidLRAStateException { if (future == null) { return Optional.empty(); } if (future.isDone()) { try { future.get(); return Optional.of(getExpectedStatus()); } catch (ExecutionException e) { LRAProxyLogger.i18NLogger.error_participantExceptionOnCompletion(participant.getClass().getName(), e); return Optional.of(getFailedStatus()); } catch (InterruptedException e) { return Optional.of(getFailedStatus()); } } else if (future.isCancelled()) { return Optional.of(getExpectedStatus()); } else { return Optional.of(getCurrentStatus()); } }
Source:
public static TaskId makeTaskId(String str) { String[] strSplitted = str.split("t"); JobId jobId = JobIdImpl.makeJobId(strSplitted[0]); long taskId = Long.parseLong(strSplitted[1]); return new TaskIdImpl(jobId, taskId); }

Target:
public static TaskId makeTaskId(String str) { String[] strSplitted = str.split("t"); if (!str.contains("t") || strSplitted.length != 2) { throw new IllegalArgumentException("A valid task id must be supplied"); } JobId jobId = JobIdImpl.makeJobId(strSplitted[0]); long taskId = Long.parseLong(strSplitted[1]); return new TaskIdImpl(jobId, taskId); }
Source:
public void run(final Server server, final User user, final String commandLabel, final String[] args) throws Exception { if (args.length == 0) { showExp(user, user); } else if (args.length > 1 && args[0].equalsIgnoreCase("set") && user.isAuthorized("essentials.exp.set")) { if (args.length == 3 && user.isAuthorized("essentials.exp.set.others")) { expMatch(server, user, args[1], args[2], false); } else { setExp(user, user, args[1], false); } } else if (args.length > 1 && args[0].equalsIgnoreCase("give") && user.isAuthorized("essentials.exp.give")) { if (args.length == 3 && user.isAuthorized("essentials.exp.give.others")) { expMatch(server, user, args[1], args[2], true); } else { setExp(user, user, args[1], true); } } else if (args.length > 1 && args[0].equalsIgnoreCase("show")) { if (args.length >= 2 && user.isAuthorized("essentials.exp.others")) { String match = args[1].trim(); showMatch(server, user, match); } else { showExp(user, user); } } else { if (args.length >= 1 && Util.isInt(args[0].toLowerCase(Locale.ENGLISH).replace("l", "")) && user.isAuthorized("essentials.exp.give")) { if (args.length >= 2 && user.isAuthorized("essentials.exp.give.others")) { expMatch(server, user, args[1], args[0], true); } else { setExp(user, user, args[0], true); } } else if (args.length >= 1 && user.isAuthorized("essentials.exp.others")) { String match = args[0].trim(); showMatch(server, user, match); } else { showExp(user, user); } } }

Target:
public void run(final Server server, final User user, final String commandLabel, final String[] args) throws Exception { if (args.length == 0) { showExp(user, user); } else if (args.length > 1 && args[0].equalsIgnoreCase("set") && user.isAuthorized("essentials.exp.set")) { if (args.length == 3 && user.isAuthorized("essentials.exp.set.others")) { expMatch(server, user, args[1], args[2], false); } else { setExp(user, user, args[1], false); } } else if (args.length > 1 && args[0].equalsIgnoreCase("give") && user.isAuthorized("essentials.exp.give")) { if (args.length == 3 && user.isAuthorized("essentials.exp.give.others")) { expMatch(server, user, args[1], args[2], true); } else { setExp(user, user, args[1], true); } } else if (args[0].equalsIgnoreCase("show")) { if (args.length >= 2 && user.isAuthorized("essentials.exp.others")) { String match = args[1].trim(); showMatch(server, user, match); } else { showExp(user, user); } } else { if (args.length >= 1 && Util.isInt(args[0].toLowerCase(Locale.ENGLISH).replace("l", "")) && user.isAuthorized("essentials.exp.give")) { if (args.length >= 2 && user.isAuthorized("essentials.exp.give.others")) { expMatch(server, user, args[1], args[0], true); } else { setExp(user, user, args[0], true); } } else if (args.length >= 1 && user.isAuthorized("essentials.exp.others")) { String match = args[0].trim(); showMatch(server, user, match); } else { showExp(user, user); } } }
Source:
protected void interactWithEntitiesInside() { AxisAlignedBB bb = info.getBoundingBox().contract(1).offset(0, 0.5, 0).expand(0, 0.5, 0); List<Entity> entities = getWorld().getEntitiesWithinAABB(Entity.class, bb); for(Entity entity : entities) { if (entity instanceof EntityMob) { EntityLivingBase entityLiving = (EntityLivingBase) entity; entityLiving.setHealth(0F); } } }

Target:
protected void interactWithEntitiesInside() { AxisAlignedBB bb = info.getBoundingBox().contract(1).offset(0, 0.5, 0).expand(0, 0.5, 0); List<EntityLivingBase> entities = getWorld().getEntitiesWithinAABB(EntityLivingBase.class, bb); for(EntityLivingBase entity : entities) { if(entity instanceof EntityMob && entity.isEntityAlive()) { entity.setDead(); } } }
Source:
private void handleGetAll(DataInputStream inputStream, DataOutputStream outputStream, Store<ByteArray, byte[], byte[]> store) throws IOException { long startTimeMs = -1; long startTimeNs = -1; if(logger.isDebugEnabled()) { startTimeMs = System.currentTimeMillis(); startTimeNs = System.nanoTime(); } int numKeys = inputStream.readInt(); List<ByteArray> keys = new ArrayList<ByteArray>(numKeys); for(int i = 0; i < numKeys; i++) keys.add(readKey(inputStream)); Map<ByteArray, byte[]> transforms = null; if(protocolVersion > 2) { if(inputStream.readBoolean()) { int size = inputStream.readInt(); transforms = new HashMap<ByteArray, byte[]>(size); for(int i = 0; i < size; i++) { transforms.put(readKey(inputStream), readTransforms(inputStream)); } } } Map<ByteArray, List<Versioned<byte[]>>> results = null; try { results = store.getAll(keys, transforms); outputStream.writeShort(0); } catch(VoldemortException e) { logger.error(e.getMessage()); writeException(outputStream, e); return; } outputStream.writeInt(results.size()); logger.debug("GETALL start"); for(Map.Entry<ByteArray, List<Versioned<byte[]>>> entry: results.entrySet()) { outputStream.writeInt(entry.getKey().length()); outputStream.write(entry.getKey().get()); writeResults(outputStream, entry.getValue()); if(logger.isDebugEnabled()) { debugLogReturnValue(entry.getKey(), entry.getValue(), startTimeMs, startTimeNs, "GETALL"); } } logger.debug("GETALL end"); }

Target:
private void handleGetAll(DataInputStream inputStream, DataOutputStream outputStream, Store<ByteArray, byte[], byte[]> store) throws IOException { long startTimeMs = -1; long startTimeNs = -1; if(logger.isDebugEnabled()) { startTimeMs = System.currentTimeMillis(); startTimeNs = System.nanoTime(); } int numKeys = inputStream.readInt(); List<ByteArray> keys = new ArrayList<ByteArray>(numKeys); for(int i = 0; i < numKeys; i++) keys.add(readKey(inputStream)); Map<ByteArray, byte[]> transforms = null; if(protocolVersion > 2) { if(inputStream.readBoolean()) { int size = inputStream.readInt(); transforms = new HashMap<ByteArray, byte[]>(size); for(int i = 0; i < size; i++) { transforms.put(readKey(inputStream), readTransforms(inputStream)); } } } Map<ByteArray, List<Versioned<byte[]>>> results = null; try { results = store.getAll(keys, transforms); outputStream.writeShort(0); } catch(VoldemortException e) { logger.error(e.getMessage()); writeException(outputStream, e); return; } outputStream.writeInt(results.size()); if(logger.isDebugEnabled()) logger.debug("GETALL start"); for(Map.Entry<ByteArray, List<Versioned<byte[]>>> entry: results.entrySet()) { outputStream.writeInt(entry.getKey().length()); outputStream.write(entry.getKey().get()); writeResults(outputStream, entry.getValue()); if(logger.isDebugEnabled()) { debugLogReturnValue(entry.getKey(), entry.getValue(), startTimeMs, startTimeNs, "GETALL"); } } if(logger.isDebugEnabled()) logger.debug("GETALL end"); }
Source:
private static void serializeElements(XPathNodeset nodeset, OutputStream output) throws IOException { KXmlSerializer serializer = new KXmlSerializer(); try { serializer.setOutput(output, "UTF-8"); } catch (IOException e) { throw new RuntimeException(e); } DataModelSerializer s = new DataModelSerializer(serializer); DataInstance instance = nodeset.getInstance(); Vector<TreeReference> refs = nodeset.getReferences(); if (refs == null) { return; } for (TreeReference ref : refs) { AbstractTreeElement treeElement = instance.resolveReference(ref); s.serialize(treeElement); } }

Target:
private static void serializeElements(XPathNodeset nodeset, OutputStream output) throws IOException { KXmlSerializer serializer = new KXmlSerializer(); try { serializer.setOutput(output, "UTF-8"); } catch (IOException e) { throw new RuntimeException(e); } DataModelSerializer s = new DataModelSerializer(serializer); DataInstance instance = nodeset.getInstance(); Vector<TreeReference> refs = nodeset.getReferences(); for (TreeReference ref : refs) { AbstractTreeElement treeElement = instance.resolveReference(ref); s.serialize(treeElement); } }
Source:
private int getPluginsLoadTimeout(final Config cfg) { long cfgValue = ConfigUtil.getTimeUnit(cfg, "plugins", null, "jsLoadTimeout", 5000, TimeUnit.MILLISECONDS); if (cfgValue < 0) { return 0; } return (int) cfgValue; }

Target:
private int getPluginsLoadTimeout(final Config cfg) { long cfgValue = ConfigUtil.getTimeUnit(cfg, "plugins", null, "jsLoadTimeout", DEFAULT_JS_LOAD_TIMEOUT, TimeUnit.MILLISECONDS); if (cfgValue < 0) { return 0; } return (int) cfgValue; }
Source:
public static Set<Set<Guid>> getUnifiedPositiveAffinityGroups(List<AffinityGroup> affinityGroups) { Set<Set<Guid>> uag = new HashSet<>(); Map<Guid, Set<Guid>> vmIndex = new HashMap<>(); for(AffinityGroup ag: affinityGroups) { if(ag.getEntityIds() == null) { continue; } for(Guid id : ag.getEntityIds()) { Set<Guid> temp = new HashSet<>(); temp.add(id); uag.add(temp); vmIndex.put(id, temp); } } for(AffinityGroup ag : affinityGroups) { if(ag.isPositive()) { Set<Guid> mergedGroup = new HashSet<>(); if(ag.getEntityIds() == null) { continue; } for(Guid id : ag.getEntityIds()) { Set<Guid> existingGroup = vmIndex.get(id); mergedGroup.addAll(existingGroup); uag.remove(existingGroup); for (Guid vm: existingGroup) { vmIndex.put(vm, mergedGroup); } } uag.add(mergedGroup); } } return uag; }

Target:
public static Set<Set<Guid>> getUnifiedPositiveAffinityGroups(List<AffinityGroup> affinityGroups) { Set<Set<Guid>> uag = new HashSet<>(); Map<Guid, Set<Guid>> vmIndex = new HashMap<>(); for(AffinityGroup ag: affinityGroups) { if(ag.getEntityIds() == null) { affinityGroups.remove(ag); continue; } for(Guid id : ag.getEntityIds()) { Set<Guid> temp = new HashSet<>(); temp.add(id); uag.add(temp); vmIndex.put(id, temp); } } for(AffinityGroup ag : affinityGroups) { if(ag.isPositive()) { Set<Guid> mergedGroup = new HashSet<>(); for(Guid id : ag.getEntityIds()) { Set<Guid> existingGroup = vmIndex.get(id); mergedGroup.addAll(existingGroup); uag.remove(existingGroup); for (Guid vm: existingGroup) { vmIndex.put(vm, mergedGroup); } } uag.add(mergedGroup); } } return uag; }
Source:
private void setIcon(RemoteServerState.State state) { switch (state) { case UNKNOWN: setIcon(ImageManager.get().getImageIcon("images/datacloud/cloudNotUsed.png", IconUtils.ICON_SIZE_SMALL)); break; case NO_CREDIT: setIcon(ImageManager.get().getImageIcon("images/datacloud/cloudNoCredit.png", IconUtils.ICON_SIZE_SMALL)); break; case OK: setIcon(ImageManager.get().getImageIcon("images/datacloud/cloudOk.png", IconUtils.ICON_SIZE_SMALL)); break; case ERROR: setIcon(ImageManager.get().getImageIcon("images/datacloud/cloudError.png", IconUtils.ICON_SIZE_SMALL)); break; } }

Target:
private void setIcon(RemoteServerState.State state) { switch (state) { case NOT_CONNECTED: setIcon(ImageManager.get().getImageIcon(IconUtils.CLOUD_GREY, IconUtils.ICON_SIZE_SMALL)); break; case NO_CREDIT: setIcon(ImageManager.get().getImageIcon(IconUtils.CLOUD_ORANGE, IconUtils.ICON_SIZE_SMALL)); break; case OK: setIcon(ImageManager.get().getImageIcon(IconUtils.CLOUD_GREEN, IconUtils.ICON_SIZE_SMALL)); break; case ERROR: setIcon(ImageManager.get().getImageIcon(IconUtils.CLOUD_RED, IconUtils.ICON_SIZE_SMALL)); break; } }
Source:
public void configRoundtrip() throws Exception { MockSCMController c = MockSCMController.create(); try { c.createRepository("foo"); SingleSCMSource source = new SingleSCMSource("the-id", "the-name", new MockSCM(c, "foo", new MockSCMHead("master"), null)); SCMSourceBuilder builder = new SCMSourceBuilder(source); r.assertEqualDataBoundBeans(builder, r.configRoundtrip(builder)); } finally { c.close(); } }

Target:
public void configRoundtrip() throws Exception { MockSCMController c = MockSCMController.create(); try { c.createRepository("foo"); SingleSCMSource source = new SingleSCMSource( "the-id", "the-name", new MockSCM( c, "foo", new MockSCMHead("master"), null ) ); SCMSourceBuilder builder = new SCMSourceBuilder(source); r.assertEqualDataBoundBeans(new SCMSourceBuilder(new SingleSCMSource( "the-id", "the-name", new MockSCM( c, "foo", new MockSCMHead("master"), null ) )), r.configRoundtrip(builder)); } finally { c.close(); } }