auphong2707/dl4se-code-review-dataset huggingface dataset:
Source:
void addLocationIdValues(final Map<Integer, List<ObservationUnitRow>> observationUnitRowMap, final Map<Integer, StudyInstance> selectedDatasetInstancesMap) { for(final Integer instanceId: observationUnitRowMap.keySet()) { final ObservationUnitData locationIdData = new ObservationUnitData(); locationIdData.setValue(selectedDatasetInstancesMap.get(instanceId).getLocationId().toString()); observationUnitRowMap.get(instanceId).forEach(row -> { row.getVariables().put(LOCATION_ID_VARIABLE_NAME, locationIdData); }); } }

Target:
void addLocationIdValues(final Map<Integer, List<ObservationUnitRow>> observationUnitRowMap, final Map<Integer, StudyInstance> selectedDatasetInstancesMap) { for(final Integer instanceId: observationUnitRowMap.keySet()) { final ObservationUnitData locationIdData = new ObservationUnitData(); locationIdData.setValue(selectedDatasetInstancesMap.get(instanceId).getLocationId().toString()); observationUnitRowMap.get(instanceId).forEach(row -> row.getVariables().put(LOCATION_ID_VARIABLE_NAME, locationIdData)); } }
Source:
public void write(DataOutput out) throws IOException { if (conf == null) { throw new IOException("Hadoop Configuration not set via setConf"); } WritableUtils.writeVInt(out, splits.size()); for (InputSplit split : splits) { Class<? extends InputSplit> clazz = split.getClass(); Text.writeString(out, clazz.getName()); SerializationFactory factory = new SerializationFactory(conf); Serializer serializer = factory.getSerializer(clazz); serializer.open((DataOutputStream)out); serializer.serialize(split); } }

Target:
public void write(DataOutput out) throws IOException { if (conf == null) { throw new IOException("Hadoop Configuration not set via setConf"); } WritableUtils.writeVInt(out, splits.size()); for (InputSplit split : splits) { SplitUtil.serializeInputSplit(conf, (DataOutputStream) out, split); } }
Source:
private void createPageTitle(Record.Page page) { HashMap<String, Object> attributes = new HashMap<>(); attributes.put("label", page.getDescription()); attributes.put("name", page.getDescription()); attributes.put("showLabel", true); attributes.put("type", TEXT.getValue()); attributes.put("dataType", STRING.getValue()); attributes.put("readOnly", true); StringField titlePage = new StringField(attributes, LiferayLocale.getDefaultLocale(), LiferayLocale.getDefaultLocale()); addFieldView(titlePage, 0); }

Target:
private void createPageTitle(Record.Page page) { HashMap<String, Object> attributes = new HashMap<>(); attributes.put("label", page.getDescription()); attributes.put("name", page.getDescription()); attributes.put("showLabel", true); attributes.put("type", Field.EditorType.TEXT.getValue()); attributes.put("dataType", Field.DataType.STRING.getValue()); attributes.put("readOnly", true); StringField titlePage = new StringField(attributes, LiferayLocale.getDefaultLocale(), LiferayLocale.getDefaultLocale()); addFieldView(titlePage, 0); }
Source:
public void cannotPerformTimestampManagementWithoutQuorum() { assertThatThrownBy(() -> getTimestampManagementService(CLIENT).fastForwardTimestamp(1000L)) .satisfies(IsolatedPaxosTimeLockServerIntegrationTest::isRetryableExceptionWhereLeaderCannotBeFound); }

Target:
public void cannotPerformTimestampManagementWithoutQuorum() { assertThatThrownBy(() -> getTimestampManagementService(CLIENT).fastForwardTimestamp(1000L)) .satisfies(this::isRetryableExceptionWhereLeaderCannotBeFound); }
Source:
private boolean confirmClose(BasePanel panel) { String filename = panel.getBibDatabaseContext() .getDatabasePath() .map(Path::toAbsolutePath) .map(Path::toString) .orElse(GUIGlobals.UNTITLED_TITLE); ButtonType saveChanges = new ButtonType(Localization.lang("Save changes"), ButtonBar.ButtonData.YES); ButtonType discardChanges = new ButtonType(Localization.lang("Discard changes"), ButtonBar.ButtonData.NO); ButtonType cancel = new ButtonType(Localization.lang("Return to JabRef"), ButtonBar.ButtonData.CANCEL_CLOSE); Optional<ButtonType> response = dialogService.showCustomButtonDialogAndWait(Alert.AlertType.CONFIRMATION, Localization.lang("Save before closing"), Localization.lang("Library '%0' has changed.", filename), saveChanges, discardChanges, cancel); if (response.isPresent() && response.get().equals(saveChanges)) { try { SaveDatabaseAction saveAction = new SaveDatabaseAction(panel, Globals.prefs); if (saveAction.save()) { return true; } output(Localization.lang("Unable to save library")); } catch (Throwable ex) { LOGGER.error("A problem occurred when saving the file", ex); } } return !response.isPresent() || !response.get().equals(cancel); }

Target:
private boolean confirmClose(BasePanel panel) { String filename = panel.getBibDatabaseContext() .getDatabasePath() .map(Path::toAbsolutePath) .map(Path::toString) .orElse(GUIGlobals.UNTITLED_TITLE); ButtonType saveChanges = new ButtonType(Localization.lang("Save changes"), ButtonBar.ButtonData.YES); ButtonType discardChanges = new ButtonType(Localization.lang("Discard changes"), ButtonBar.ButtonData.NO); ButtonType cancel = new ButtonType(Localization.lang("Return to JabRef"), ButtonBar.ButtonData.CANCEL_CLOSE); Optional<ButtonType> response = dialogService.showCustomButtonDialogAndWait(Alert.AlertType.CONFIRMATION, Localization.lang("Save before closing"), Localization.lang("Library '%0' has changed.", filename), saveChanges, discardChanges, cancel); if (response.isPresent() && response.get().equals(saveChanges)) { try { SaveDatabaseAction saveAction = new SaveDatabaseAction(panel, Globals.prefs); if (saveAction.save()) { return true; } output(Localization.lang("Unable to save library")); } catch (Throwable ex) { LOGGER.error("A problem occurred when trying to save the file", ex); dialogService.showErrorDialogAndWait(Localization.lang("Save library"), Localization.lang("Could not save file."), ex); } return false; } return !response.isPresent() || !response.get().equals(cancel); }
Source:
private void disposeTextures() { for (Scene scene : project.getSceneList()) { List<Sprite> sprites = scene.getSpriteList(); for (Sprite sprite : sprites) { List<LookData> lookDatas = sprite.getLookDataList(); int lookDatasSize = lookDatas.size(); for (int j = 0; j < lookDatasSize; j++) { LookData lookData = lookDatas.get(j); lookData.getPixmap().dispose(); lookData.getTextureRegion().getTexture().dispose(); } } } }

Target:
private void disposeTextures() { for (Scene scene : project.getSceneList()) { for (Sprite sprite : scene.getSpriteList()) { for (LookData lookData : sprite.getLookDataList()) { lookData.getPixmap().dispose(); lookData.getTextureRegion().getTexture().dispose(); } } } }
Source:
public Intent createCaptureIntent(final Context context) { deleteTemporaryFile(); try { outputFile = File.createTempFile( "JPEG_" + new SimpleDateFormat("yyyyMMdd_HHmmss", Locale.US).format(new Date()) + "_", ".jpg", context.getExternalFilesDir(Environment.DIRECTORY_PICTURES) ); } catch (IOException e) { throw new RuntimeException(e); } if (Build.VERSION.SDK_INT >= 24) { outputFileUri = FileProvider.getUriForFile(context, context.getApplicationContext().getPackageName() + ".provider", outputFile); } else { outputFileUri = Uri.fromFile(outputFile); } final Intent intent = new Intent(android.provider.MediaStore.ACTION_IMAGE_CAPTURE); intent.putExtra(MediaStore.EXTRA_OUTPUT, outputFileUri); intent.putExtra("android.intent.extras.CAMERA_FACING", android.hardware.Camera.CameraInfo.CAMERA_FACING_FRONT); intent.putExtra("android.intent.extras.LENS_FACING_FRONT", 1); intent.putExtra("android.intent.extra.USE_FRONT_CAMERA", true); return intent; }

Target:
public Intent createCaptureIntent(final Context context) { deleteTemporaryFile(); try { outputFile = File.createTempFile( "JPEG_" + new SimpleDateFormat("yyyyMMdd_HHmmss", Locale.US).format(new Date()) + "_", ".jpg", context.getExternalFilesDir(Environment.DIRECTORY_PICTURES) ); } catch (IOException e) { throw new RuntimeException(e); } if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.N) { outputFileUri = FileProvider.getUriForFile(context, context.getApplicationContext().getPackageName() + ".provider", outputFile); } else { outputFileUri = Uri.fromFile(outputFile); } final Intent intent = new Intent(android.provider.MediaStore.ACTION_IMAGE_CAPTURE); intent.putExtra(MediaStore.EXTRA_OUTPUT, outputFileUri); intent.putExtra("android.intent.extras.CAMERA_FACING", android.hardware.Camera.CameraInfo.CAMERA_FACING_FRONT); intent.putExtra("android.intent.extras.LENS_FACING_FRONT", 1); intent.putExtra("android.intent.extra.USE_FRONT_CAMERA", true); return intent; }
Source:
private SAMSequenceDictionary getActiveDictionary(final HaplotypeMap haplotypes){ final SAMSequenceDictionary origSequenceDictionary = haplotypes.getHeader().getSequenceDictionary(); final OptionalInt maxSequenceIndex = haplotypes.getAllSnps().stream() .map(Snp::getChrom) .mapToInt(origSequenceDictionary::getSequenceIndex) .max(); if (!maxSequenceIndex.isPresent()) { return origSequenceDictionary; } return new SAMSequenceDictionary(origSequenceDictionary.getSequences().subList(0, maxSequenceIndex.getAsInt() + 1)); }

Target:
private static SAMSequenceDictionary getActiveDictionary(final HaplotypeMap haplotypes) { final SAMSequenceDictionary origSequenceDictionary = haplotypes.getHeader().getSequenceDictionary(); final OptionalInt maxSequenceIndex = haplotypes.getAllSnps().stream() .map(Snp::getChrom) .mapToInt(origSequenceDictionary::getSequenceIndex) .max(); if (!maxSequenceIndex.isPresent()) { return origSequenceDictionary; } return new SAMSequenceDictionary(origSequenceDictionary.getSequences().subList(0, maxSequenceIndex.getAsInt() + 1)); }
Source:
protected void proceedProxyReturnValue() { try { super.proceedProxyReturnValue(); } catch (VDSNetworkException ignored) { } }

Target:
protected void proceedProxyReturnValue() { try { super.proceedProxyReturnValue(); } catch (VDSNetworkException ignored) { log.debug("VDSNetworkException was caught and ignored", ignored); } }
Source:
public ModelAndView resolve(final JEEContext ctx, final ProfileManager manager, final String url) { val prompt = OidcAuthorizationRequestSupport.getOidcPromptFromAuthorizationRequest(url); if (prompt.contains(OidcConstants.PROMPT_NONE)) { val result = manager.get(true); if (result.isPresent()) { LOGGER.trace("Redirecting to URL without prompting for login", url); return new ModelAndView(url); } val originalRedirectUrl = ctx.getRequestParameter(OAuth20Constants.REDIRECT_URI); if (originalRedirectUrl.isEmpty()) { val model = new HashMap<String, String>(); model.put(OAuth20Constants.ERROR, OidcConstants.LOGIN_REQUIRED); return new ModelAndView(new MappingJackson2JsonView(), model); } else { LOGGER.warn("Unable to detect an authenticated user profile for prompt-less login attempts. Redirecting to URL[{}]", originalRedirectUrl.get()); return new ModelAndView(new RedirectView(OidcAuthorizationRequestSupport.getRedirectUrlWithError(originalRedirectUrl.get(), OidcConstants.LOGIN_REQUIRED))); } } if (prompt.contains(OidcConstants.PROMPT_LOGIN)) { LOGGER.trace("Removing login prompt from URL [{}]", url); val newUrl = OidcAuthorizationRequestSupport.removeOidcPromptFromAuthorizationRequest(url, OidcConstants.PROMPT_LOGIN); LOGGER.trace("Redirecting to URL [{}]", newUrl); return new ModelAndView(new RedirectView(newUrl)); } LOGGER.trace("Redirecting to URL [{}]", url); return new ModelAndView(new RedirectView(url)); }

Target:
public ModelAndView resolve(final JEEContext ctx, final ProfileManager manager, final String url) { val prompt = OidcAuthorizationRequestSupport.getOidcPromptFromAuthorizationRequest(url); if (prompt.contains(OidcConstants.PROMPT_NONE)) { val result = manager.get(true); if (result.isPresent()) { LOGGER.trace("Redirecting to URL without prompting for login", url); return new ModelAndView(url); } val originalRedirectUrl = ctx.getRequestParameter(OAuth20Constants.REDIRECT_URI); if (originalRedirectUrl.isEmpty()) { val model = new HashMap<String, String>(); model.put(OAuth20Constants.ERROR, OidcConstants.LOGIN_REQUIRED); return new ModelAndView(new MappingJackson2JsonView(), model); } val redirectUrlWithErrorCode = OidcAuthorizationRequestSupport.getRedirectUrlWithError(originalRedirectUrl.get(), OidcConstants.LOGIN_REQUIRED); LOGGER.warn("Unable to detect an authenticated user profile for prompt-less login attempts. Redirecting to URL [{}]", redirectUrlWithErrorCode); return new ModelAndView(new RedirectView(redirectUrlWithErrorCode)); } if (prompt.contains(OidcConstants.PROMPT_LOGIN)) { LOGGER.trace("Removing login prompt from URL [{}]", url); val newUrl = OidcAuthorizationRequestSupport.removeOidcPromptFromAuthorizationRequest(url, OidcConstants.PROMPT_LOGIN); LOGGER.trace("Redirecting to URL [{}]", newUrl); return new ModelAndView(new RedirectView(newUrl)); } LOGGER.trace("Redirecting to URL [{}]", url); return new ModelAndView(new RedirectView(url)); }
Source:
private void commitDelete(AsyncFileEntry entry, boolean success) { LOGGER.trace("commitDelete({},{}): Starting...", entry.getName(), success); if (success) { entry.getParent().ifPresent(e -> e.removeChild(entry)); entry.destroy(); LOGGER.debug( "{} was removed from {}", entry.getName(), entry.getParent().map(AsyncFileEntry::getName).orElse("parent")); } else { LOGGER.debug("Delete task failed for {}", entry.getName()); } onFinish(entry); }

Target:
private void commitDelete(AsyncFileEntry entry, boolean success) { LOGGER.trace("commitDelete({},{}): Starting...", entry.getName(), success); try { if (success) { entry.getParent().ifPresent(e -> e.removeChild(entry)); entry.destroy(); LOGGER.debug( "{} was removed from {}", entry.getName(), entry.getParent().map(AsyncFileEntry::getName).orElse("parent")); } else { LOGGER.debug("Delete task failed for {}", entry.getName()); } } finally { onFinish(entry); } }
Source:
public void addItem(final ShoppingCartItem item) { ShoppingCartItem existingItemOfSameType = Iterables.find(items, new Predicate<ShoppingCartItem>() { @Override public boolean apply(ShoppingCartItem shoppingCartItem) { return shoppingCartItem.equals(item); } }, null); if (existingItemOfSameType != null) { existingItemOfSameType.addMore(item.getQuantity()); ShoppingCartQuantityChangeEvent.fire(this, existingItemOfSameType, existingItemOfSameType.getQuantity()); } else { items.add(item); ShoppingCartChangedEvent.fire(item, this); } }

Target:
public void addItem(final ShoppingCartItem item) { ShoppingCartItem existingItemOfSameType = Iterables.tryFind(items, new Predicate<ShoppingCartItem>() { @Override public boolean apply(ShoppingCartItem shoppingCartItem) { return shoppingCartItem.equals(item); } }).orNull(); if (existingItemOfSameType != null) { existingItemOfSameType.addMore(item.getQuantity()); ShoppingCartQuantityChangeEvent.fire(this, existingItemOfSameType, existingItemOfSameType.getQuantity()); } else { items.add(item); ShoppingCartChangedEvent.fire(item, this); } }
Source:
public static <T> T createModel(Class<T> model, List<OpenEngSBModelEntry> entries) { checkIfClassIsModel(model); try { T instance = model.newInstance(); for (OpenEngSBModelEntry entry : entries) { if (!tryToSetValueThroughField(entry, instance) && !tryToSetValueThroughSetter(entry, instance)) { ((OpenEngSBModel) instance).addOpenEngSBModelEntry(entry); } } return instance; } catch (InstantiationException e) { LOGGER.error("InstantiationException while creating a new model instance.", e); } catch (IllegalAccessException e) { LOGGER.error("IllegalAccessException while creating a new model instance.", e); } catch (SecurityException e) { LOGGER.error("SecurityException while creating a new model instance.", e); } return null; }

Target:
public static <T> T createModel(Class<T> model, List<OpenEngSBModelEntry> entries) { checkIfClassIsModel(model); try { T instance = model.newInstance(); for (OpenEngSBModelEntry entry : entries) { if (tryToSetValueThroughField(entry, instance)) { continue; } if (tryToSetValueThroughSetter(entry, instance)) { continue; } ((OpenEngSBModel) instance).addOpenEngSBModelEntry(entry); } return instance; } catch (InstantiationException e) { LOGGER.error("InstantiationException while creating a new model instance.", e); } catch (IllegalAccessException e) { LOGGER.error("IllegalAccessException while creating a new model instance.", e); } catch (SecurityException e) { LOGGER.error("SecurityException while creating a new model instance.", e); } return null; }
Source:
public void testScenario_DefiningVariablesThatWillBeAccessibleInExpressions() throws Exception { SpelExpressionParser parser = new SpelExpressionParser(); StandardEvaluationContext ctx = new StandardEvaluationContext(); ctx.setVariable("favouriteColour","blue"); List<Integer> primes = new ArrayList<>(Arrays.asList(2, 3, 5, 7, 11, 13, 17)); ctx.setVariable("primes",primes); Expression expr = parser.parseRaw("#favouriteColour"); Object value = expr.getValue(ctx); assertThat(value).isEqualTo("blue"); expr = parser.parseRaw("#primes.get(1)"); value = expr.getValue(ctx); assertThat(value).isEqualTo(3); expr = parser.parseRaw("#primes.?[#this>10]"); value = expr.getValue(ctx); assertThat(value.toString()).isEqualTo("[11, 13, 17]"); }

Target:
public void testScenario_DefiningVariablesThatWillBeAccessibleInExpressions() throws Exception { SpelExpressionParser parser = new SpelExpressionParser(); StandardEvaluationContext ctx = new StandardEvaluationContext(); ctx.setVariable("favouriteColour","blue"); List<Integer> primes = Arrays.asList(2, 3, 5, 7, 11, 13, 17); ctx.setVariable("primes",primes); Expression expr = parser.parseRaw("#favouriteColour"); Object value = expr.getValue(ctx); assertThat(value).isEqualTo("blue"); expr = parser.parseRaw("#primes.get(1)"); value = expr.getValue(ctx); assertThat(value).isEqualTo(3); expr = parser.parseRaw("#primes.?[#this>10]"); value = expr.getValue(ctx); assertThat(value.toString()).isEqualTo("[11, 13, 17]"); }
Source:
public long findPhysicalNetworkId(long zoneId, String tag, TrafficType trafficType) { List<PhysicalNetworkVO> pNtwks = new ArrayList<PhysicalNetworkVO>(); if (trafficType != null) { pNtwks = _physicalNetworkDao.listByZoneAndTrafficType(zoneId, trafficType); } else { pNtwks = _physicalNetworkDao.listByZone(zoneId); } if (pNtwks.isEmpty()) { throw new InvalidParameterValueException("Unable to find physical network in zone id=" + zoneId); } if (pNtwks.size() > 1) { Long pNtwkId = null; for (PhysicalNetwork pNtwk : pNtwks) { if (pNtwk.getTags().isEmpty() && tag == null) { s_logger.debug("Found physical network id=" + pNtwk.getId() + " with null tag"); if (pNtwkId != null) { throw new CloudRuntimeException("There is more than 1 physical network with empty tag in the zone id=" + zoneId); } pNtwkId = pNtwk.getId(); } if (pNtwk.getTags().contains(tag)) { s_logger.debug("Found physical network id=" + pNtwk.getId() + " based on requested tags " + tag); pNtwkId = pNtwk.getId(); break; } } if (pNtwkId == null) { throw new InvalidParameterValueException("Unable to find physical network which match the tags " + tag); } return pNtwkId; } else { return pNtwks.get(0).getId(); } }

Target:
public long findPhysicalNetworkId(long zoneId, String tag, TrafficType trafficType) { return _networkModel.findPhysicalNetworkId(zoneId, tag, trafficType); }
Source:
protected String getExpectedUsage() { return "logicalpull <setup> [--debug (-d)] [--git-dir gitFolderPath] [--help (-h)] [--show-stack-trace]" + EOL + EOL +" <setup> : Path to the setup file. The setup file is a Oomph" + EOL +" model." + EOL +" --debug (-d) : Launched the provisionned eclipse in debug mode."+ EOL +" --git-dir gitFolderPath : Path to the .git folder of your repository." + EOL +" --help (-h) : Dispays help for this command." + EOL +" --show-stack-trace : Use this option to display java stack trace in" + EOL +" console on error." + EOL +EOL; }

Target:
protected String getExpectedUsage() { return "logicalpull <setup> [--debug (-d)] [--git-dir gitFolderPath] [--help (-h)] [--show-stack-trace]" + EOL + EOL +" <setup> : Path to the setup file. The setup file is a Oomph" + EOL +" model." + EOL +" --debug (-d) : Launches the provisionned eclipse in debug mode."+ EOL +" --git-dir gitFolderPath : Path to the .git folder of your repository." + EOL +" --help (-h) : Dispays help for this command." + EOL +" --show-stack-trace : Use this option to display java stack trace in" + EOL +" console on error." + EOL +EOL; }
Source:
public LimitedSet<Integer> createLimitSet(Integer limit, SearchHit[]... pages){ final LimitedSet<Integer> limitedSet = new LimitedSet<>(new HashSet<>(), limit != null); Stream<SearchHit> stream = Arrays.stream(pages) .map(Arrays::stream) .reduce(Stream.empty(), Stream::concat); if (limit!=null){ stream = stream.limit(limit); } stream.map(Object::hashCode) .forEach(limitedSet.getSet()::add); return limitedSet; }

Target:
public LimitedSet<SearchHit> createLimitSet(Integer limit, SearchHit[]... pages){ Set<SearchHit> set = new HashSet<>(); Stream<SearchHit> stream = Arrays.stream(pages) .map(Arrays::stream) .reduce(Stream.empty(), Stream::concat); if (limit!=null){ stream = stream.limit(limit); } stream.map(Function.identity()) .forEach(set::add); return new LimitedSet<>(set, limit != null); }
Source:
private boolean isValueOfInvocation(AbstractTypedTree abstractTypedTree) { if (!abstractTypedTree.is(Kind.METHOD_INVOCATION)) { return false; } MethodInvocationTreeImpl methodInvocationTreeImpl = (MethodInvocationTreeImpl) abstractTypedTree; AbstractTypedTree firstArgument = (AbstractTypedTree) methodInvocationTreeImpl.arguments().get(0); return "valueOf".equals((methodInvocationTreeImpl).getSymbol().getName()) && firstArgument.getSymbolType().isPrimitive(); }

Target:
private boolean isValueOfInvocation(AbstractTypedTree abstractTypedTree) { if (!abstractTypedTree.is(Kind.METHOD_INVOCATION)) { return false; } Type type = abstractTypedTree.getSymbolType(); MethodInvocationMatcher valueOfMatcher = MethodInvocationMatcher.create() .typeDefinition(type.getSymbol().getFullyQualifiedName()) .name("valueOf") .addParameter(type.primitiveType().getSymbol().getFullyQualifiedName()); return valueOfMatcher.matches((MethodInvocationTree) abstractTypedTree, getSemanticModel()); }
Source:
public final Disposable subscribe(final Action onComplete, final Consumer<? super Throwable> onError) { ObjectHelper.requireNonNull(onError, "onError is null"); ObjectHelper.requireNonNull(onComplete, "onComplete is null"); return subscribe(onComplete, onError, Functions.emptyConsumer()); }

Target:
public final Disposable subscribe(final Action onComplete, final Consumer<? super Throwable> onError) { return subscribe(onComplete, onError, Functions.emptyConsumer()); }
Source:
private UnitedServerListenerManager() { list = new ArrayList<UnitedServerListener>(); new Thread() { public void run() { initializeManager(); } }.start(); }

Target:
private UnitedServerListenerManager() { list = new CopyOnWriteArrayList<UnitedServerListener>(); new Thread() { public void run() { initializeManager(); } }.start(); }
Source:
protected boolean validateTableWithFollowingDescriptors( SqlCallBinding callBinding, int descriptors) { final SqlNode operand0 = callBinding.operand(0); final SqlValidator validator = callBinding.getValidator(); final RelDataType type = validator.getValidatedNodeType(operand0); if (type.getSqlTypeName() != SqlTypeName.ROW) { return false; } for (int i = 1; i < descriptors + 1; i++) { final SqlNode operand = callBinding.operand(i); if (operand.getKind() != SqlKind.DESCRIPTOR) { return false; } validateColumnNames(validator, type.getFieldNames(), ((SqlCall) operand).getOperandList()); } return true; }

Target:
protected static boolean validateTableWithFollowingDescriptors( SqlCallBinding callBinding, int descriptors) { final SqlNode operand0 = callBinding.operand(0); final SqlValidator validator = callBinding.getValidator(); final RelDataType type = validator.getValidatedNodeType(operand0); if (type.getSqlTypeName() != SqlTypeName.ROW) { return false; } for (int i = 1; i < descriptors + 1; i++) { final SqlNode operand = callBinding.operand(i); if (operand.getKind() != SqlKind.DESCRIPTOR) { return false; } validateColumnNames(validator, type.getFieldNames(), ((SqlCall) operand).getOperandList()); } return true; }
Source:
public ConcurTestConnectionApplication() { singletons.add(new ConcurTestConnectionWebServiceImpl()); }

Target:
public ConcurTestConnectionApplication() { singletons.add(new ConcurTestConnectionResource()); }
Source:
public void build(IProgressMonitor monitor, Map<String, Object> argumentsMap) throws Exception { if (needTempAggregator()) { createBuildAggregatorPom(); try { for (ITalendProcessJavaProject project : subjobProjects) { MavenModelManager mavenModelManager = MavenPlugin.getMavenModelManager(); Model projModel = mavenModelManager.readMavenModel(project.getProjectPom()); MavenArtifact artifact = new MavenArtifact(); artifact.setGroupId(projModel.getGroupId()); artifact.setArtifactId(projModel.getArtifactId()); artifact.setVersion(projModel.getVersion()); String artifactPath = PomUtil.getArtifactPath(artifact); final IMaven maven = MavenPlugin.getMaven(); String localRepositoryPath = maven.getLocalRepositoryPath(); if (localRepositoryPath != null) { File moduleFolder = new File(localRepositoryPath, artifactPath); PomUtil.cleanLastUpdatedFile(moduleFolder.getParentFile()); } } String goal = (String) argumentsMap.get(TalendProcessArgumentConstant.ARG_GOAL); MavenPomCommandLauncher mavenLauncher = new MavenPomCommandLauncher(pomFile, goal); mavenLauncher.setArgumentsMap(argumentsMap); mavenLauncher.setIgnoreTestFailure(true); mavenLauncher.execute(monitor); } finally { deleteBuildAggregatorPom(); restoreSubjobPoms(); } } }

Target:
public void build(IProgressMonitor monitor, Map<String, Object> argumentsMap) throws Exception { if (needTempAggregator()) { createBuildAggregatorPom(); try { for (ITalendProcessJavaProject project : subjobProjects) { MavenModelManager mavenModelManager = MavenPlugin.getMavenModelManager(); Model projModel = mavenModelManager.readMavenModel(project.getProjectPom()); MavenArtifact artifact = new MavenArtifact(); artifact.setGroupId(projModel.getGroupId()); artifact.setArtifactId(projModel.getArtifactId()); artifact.setVersion(projModel.getVersion()); String artifactPath = PomUtil.getArtifactPath(artifact); final IMaven maven = MavenPlugin.getMaven(); String localRepositoryPath = maven.getLocalRepositoryPath(); if (localRepositoryPath != null) { File moduleFolder = new File(localRepositoryPath, artifactPath); PomUtil.cleanLastUpdatedFile(moduleFolder.getParentFile()); } } String goal = (String) argumentsMap.get(TalendProcessArgumentConstant.ARG_GOAL); MavenPomCommandLauncher mavenLauncher = new MavenPomCommandLauncher(pomFile, goal); mavenLauncher.setArgumentsMap(argumentsMap); if (isBuildJob()) { mavenLauncher.setIgnoreTestFailure(true); } else { mavenLauncher.setSkipTests(true); } mavenLauncher.execute(monitor); } finally { deleteBuildAggregatorPom(); restoreSubjobPoms(); } } }
Source:
public static void main(String[] args) { try { Map<String, Object> argMap = parseArgs(args); setupLogger(argMap); List<String> others = (List<String>) argMap.get("__other__"); Map<String, ModuleService> moduleServices = loadModules(ModuleService.class); if (argMap.containsKey(ARG_HELP) || others.isEmpty()) { List<String> modules = new ArrayList<>(moduleServices.keySet()); Collections.sort(modules); System.out.println("Modules: " + StringUtils.join(modules, ", ")); return; } String module = others.remove(0); ModuleService moduleService = moduleServices.get(module); if (moduleService == null) { throw new IllegalArgumentException( String.format("No such '%1$s' module exists. To list existing modules use --help argument.", module) ); } if(moduleService.parseArguments(others)) { System.out.println(module + " help"); return; } loadExtensions(moduleService, (String) argMap.get("extensions-dir")); moduleService.run(); } catch (IllegalArgumentException ex) { System.out.println(ex.getMessage()); logger.error(ex.getMessage()); } catch (Throwable t) { System.out.println(t.getMessage()); logger.error(t.getMessage()); logger.debug(t.getMessage(), t); } }

Target:
public static void main(String[] args) { try { Map<String, Object> argMap = parseArgs(args); setupLogger(argMap); List<String> others = (List<String>) argMap.get("__other__"); Map<String, ModuleService> moduleServices = loadModules(ModuleService.class); if (argMap.containsKey(ARG_HELP)) { List<String> modules = new ArrayList<>(moduleServices.keySet()); Collections.sort(modules); System.out.println("Modules: " + StringUtils.join(modules, ", ")); System.exit(0); } if(others.isEmpty()) { throw new IllegalArgumentException("Module must be provided"); } String module = others.remove(0); ModuleService moduleService = moduleServices.get(module); if (moduleService == null) { throw new IllegalArgumentException( String.format("No such '%1$s' module exists. To list existing modules use --help argument.", module) ); } moduleService.parseArguments(others); if(moduleService.isHelp()) { System.out.println(module + " help"); return; } loadExtensions(moduleService, argMap); moduleService.run(); } catch (Throwable t) { String message = t.getMessage() != null ? t.getMessage() : t.getClass().getName(); System.err.println(message); logger.error(message); logger.debug(message, t); System.exit(1); } }
Source:
private Statement withRules(FrameworkMethod method, Object target, Statement statement) { RuleContainer ruleContainer = new RuleContainer() { protected Integer getOrder(FrameworkMember member) { Rule rule = member.getAnnotation(Rule.class); return rule != null ? rule.order() : null; } }; List<TestRule> testRules; List<MethodRule> methodRules; AnnotatedValueListener.CURRENT.set(ruleContainer); try { testRules = getTestRules(target); methodRules = rules(target); } finally { AnnotatedValueListener.CURRENT.remove(); } for (org.junit.rules.MethodRule each : methodRules) { if (!(each instanceof TestRule && testRules.contains(each))) { ruleContainer.add(each); } } for (TestRule each : testRules) { ruleContainer.add(each); } ruleContainer.sort(); return ruleContainer.apply(method, describeChild(method), target, statement); }

Target:
private Statement withRules(FrameworkMethod method, Object target, Statement statement) { RuleContainer ruleContainer = new RuleContainer(); CURRENT_RULE_CONTAINER.set(ruleContainer); try { List<TestRule> testRules = getTestRules(target); for (MethodRule each : rules(target)) { if (!(each instanceof TestRule && testRules.contains(each))) { ruleContainer.add(each); } } for (TestRule rule : testRules) { ruleContainer.add(rule); } } finally { CURRENT_RULE_CONTAINER.remove(); } return ruleContainer.apply(method, describeChild(method), target, statement); }
Source:
public void testBasePathConflictInvalidReplaceId() throws Exception { String serviceId = setupTestService(); while(baragonServiceClient.getRequest(serviceId).get().getLoadBalancerState().equals(BaragonRequestState.WAITING)) { } if(baragonServiceClient.getRequest(serviceId).get().getLoadBalancerState().equals(BaragonRequestState.SUCCESS)) { String serviceId2 = serviceId + "-2"; setupTestService(serviceId2, serviceId2, SERVICE_BASE_PATH, Optional.fromNullable("someotherservice"), Optional.<Map<String, Object>>absent(), Optional.<String>absent()); while(baragonServiceClient.getRequest(serviceId2).get().getLoadBalancerState().equals(BaragonRequestState.WAITING)) { } if(baragonServiceClient.getRequest(serviceId2).get().getLoadBalancerState().equals(BaragonRequestState.INVALID_REQUEST_NOOP)) { } else { BaragonResponse resp = baragonServiceClient.getRequest(serviceId2).get(); throw new Exception("Request did not go as expected: " + resp.getMessage().get().toString() + "\nState: " + resp.getLoadBalancerState()); } removeService(serviceId); } else { BaragonResponse resp = baragonServiceClient.getRequest(serviceId).get(); throw new Exception("Request did not succeed: " + resp.getMessage().get().toString() + "\nState: " + resp.getLoadBalancerState()); } }

Target:
public void testBasePathConflictInvalidReplaceId() throws Exception { String serviceId = setupTestService(); waitForStatus(serviceId, BaragonRequestState.SUCCESS); String serviceId2 = serviceId + "-2"; setupTestService(serviceId2, serviceId2, SERVICE_BASE_PATH, Optional.of("someotherservice"), Optional.<Map<String, Object>>absent(), Optional.<String>absent()); waitForStatus(serviceId2, BaragonRequestState.INVALID_REQUEST_NOOP); }
Source:
void fail(Throwable e) { if (setIf(stateReference, State.failed(e), state -> state.getKind() == INITIAL)) { splitLoader.stop(); queues.finish(); } checkState(stateReference.get().getKind() == FAILED, "Another thread raced to complete this split source before failure info is recorded"); }

Target:
void fail(Throwable e) { if (setIf(stateReference, State.failed(e), state -> state.getKind() == INITIAL)) { splitLoader.stop(); queues.finish(); } }
Source:
public boolean isCheckDigitValid(List<Integer> digits, char checkDigit) { int modResult = ModUtil.calculateLuhnMod10Check( digits ); int checkValue = extractDigit( checkDigit ); return modResult < 10 ? checkValue == modResult : checkValue == 0; }

Target:
public boolean isCheckDigitValid(List<Integer> digits, char checkDigit) { int modResult = ModUtil.calculateLuhnMod10Check( digits ); if ( !Character.isDigit( checkDigit ) ) { return false; } int checkValue = extractDigit( checkDigit ); return checkValue == modResult; }
Source:
public void testCancellationPriorToBeginRuleWontHoldRule() throws Exception { final Semaphore mainThreadSemaphore = new Semaphore(0); final Semaphore lockSemaphore = new Semaphore(0); final PathRule rule = new PathRule("testBeginRuleNoEnd"); IProgressMonitor cancelledMonitor = SubMonitor.convert(null); cancelledMonitor.setCanceled(true); Job job = Job.create("", monitor -> { mainThreadSemaphore.release(); try { lockSemaphore.acquire(); } catch (InterruptedException e) { } }); job.setRule(rule); job.schedule(); mainThreadSemaphore.acquire(); boolean canceledExceptionThrown = false; try { manager.beginRule(rule, cancelledMonitor); } catch (OperationCanceledException e) { canceledExceptionThrown = true; } manager.endRule(rule); lockSemaphore.release(); boolean interrupted = Thread.interrupted(); assertTrue("An OperationCancelledException was thrown", canceledExceptionThrown); assertFalse("The thread was not interrupted", interrupted); }

Target:
public void testCancellationPriorToBeginRuleWontHoldRule() throws Exception { final Semaphore mainThreadSemaphore = new Semaphore(0); final Semaphore lockSemaphore = new Semaphore(0); final PathRule rule = new PathRule("testBeginRuleNoEnd"); IProgressMonitor cancelledMonitor = SubMonitor.convert(null); cancelledMonitor.setCanceled(true); Job job = Job.create("", monitor -> { mainThreadSemaphore.release(); try { lockSemaphore.acquire(); } catch (InterruptedException e) { } }); job.setRule(rule); job.schedule(); mainThreadSemaphore.acquire(); boolean canceledExceptionThrown = false; try { manager.beginRule(rule, cancelledMonitor); } catch (OperationCanceledException e) { canceledExceptionThrown = true; } finally { manager.endRule(rule); } lockSemaphore.release(); boolean interrupted = Thread.interrupted(); assertTrue("An OperationCancelledException should have been thrown", canceledExceptionThrown); assertFalse("The Thread.interrupted() state leaked", interrupted); }
Source:
public List<String> listSchemas() { ImmutableSet.Builder<String> builder = ImmutableSet.builder(); for (SchemaTableName tableName : tableDescriptions.keySet()) { builder.add(tableName.getSchemaName()); } return ImmutableList.copyOf(builder.build()); }

Target:
public List<String> listSchemas() { return tableDescriptions.keySet().stream() .map(SchemaTableName::getSchemaName) .collect(toImmutableList()); }
Source:
public void vmsAreUpdatedByTheOrderOfTheirIds() { createSimpleCommand(); VmStatic vm1 = new VmStatic(); vm1.setId(new Guid("77296e00-0cad-4e5a-9299-008a7b6f4355")); VmStatic vm2 = new VmStatic(); vm2.setId(new Guid("87296e00-0cad-4e5a-9299-008a7b6f4355")); VmStatic vm3 = new VmStatic(); vm3.setId(new Guid("67296e00-0cad-4e5a-9299-008a7b6f4355")); when(vmStaticDao.getAllByCluster(any())).thenReturn(Arrays.asList(vm1, vm2, vm3)); assertEquals(Arrays.asList(vm2, vm3, vm1), cmd.filterVmsInClusterNeedUpdate()); }

Target:
public void vmsAreUpdatedByTheOrderOfTheirIds() { createSimpleCommand(); VmStatic vm1 = new VmStatic(); vm1.setId(VM_ID1); VmStatic vm2 = new VmStatic(); vm2.setId(VM_ID2); VmStatic vm3 = new VmStatic(); vm3.setId(VM_ID3); when(vmStaticDao.getAllByCluster(any())).thenReturn(Arrays.asList(vm1, vm2, vm3)); assertEquals(Arrays.asList(vm2, vm3, vm1), cmd.filterVmsInClusterNeedUpdate()); }
Source:
private void addItemsOnSpinner() { playerSpinner = (Spinner) findViewById(R.id.select_player); List<String> list = new ArrayList<String>(); list.add("OoyalaDefault"); list.add("GoogleIMA"); list.add("Freewheel"); ArrayAdapter<String> dataAdapter = new ArrayAdapter<String>(this, android.R.layout.simple_spinner_item, list); dataAdapter.setDropDownViewResource(android.R.layout.simple_spinner_dropdown_item); playerSpinner.setAdapter(dataAdapter); formatSpinner = (Spinner) findViewById(R.id.selectFormat); list = new ArrayList<String>(); list.add("default"); list.add("dash"); list.add("akamai_hd2_vod_hls"); list.add("mp4"); list.add("m3u8"); list.add("hls"); list.add("akamai_hd2_hls"); dataAdapter = new ArrayAdapter<String>(this, android.R.layout.simple_spinner_item, list); dataAdapter.setDropDownViewResource(android.R.layout.simple_spinner_dropdown_item); formatSpinner.setAdapter(dataAdapter); hevcSpinner = (Spinner) findViewById(R.id.hevc_mode); list = new ArrayList<String>(); list.add("NoHEVCParam"); list.add("HEVCPreferred"); list.add("HEVCNotPreferred"); dataAdapter = new ArrayAdapter<String>(this, android.R.layout.simple_spinner_item, list); dataAdapter.setDropDownViewResource(android.R.layout.simple_spinner_dropdown_item); hevcSpinner.setAdapter(dataAdapter); }

Target:
private void addItemsOnSpinner() { playerSpinner = (Spinner) findViewById(R.id.select_player); List<String> list = new ArrayList<String>(); list.add("OoyalaDefault"); list.add("GoogleIMA"); list.add("Freewheel"); ArrayAdapter<String> dataAdapter = new ArrayAdapter<String>(this, android.R.layout.simple_spinner_item, list); dataAdapter.setDropDownViewResource(android.R.layout.simple_spinner_dropdown_item); playerSpinner.setAdapter(dataAdapter); formatSpinner = (Spinner) findViewById(R.id.selectFormat); list = new ArrayList<String>(); list.add("default"); list.add("dash"); list.add("akamai_hd2_vod_hls"); list.add("mp4"); list.add("m3u8"); list.add("hls"); list.add("akamai_hd2_hls"); dataAdapter = new ArrayAdapter<String>(this, android.R.layout.simple_spinner_item, list); dataAdapter.setDropDownViewResource(android.R.layout.simple_spinner_dropdown_item); formatSpinner.setAdapter(dataAdapter); hevcSpinner = (Spinner) findViewById(R.id.hevc_mode); list = new ArrayList<String>(); list.add("NoPreference"); list.add("HEVCPreferred"); list.add("HEVCNotPreferred"); dataAdapter = new ArrayAdapter<String>(this, android.R.layout.simple_spinner_item, list); dataAdapter.setDropDownViewResource(android.R.layout.simple_spinner_dropdown_item); hevcSpinner.setAdapter(dataAdapter); }
Source:
public String getCreatedTimeDateString() { return TimeHelper.formatDateForInstructorCoursesPage(createdTime, timeZone); }

Target:
public String getCreatedTimeDateString() { return TimeHelper.formatDateForInstructorSessionsPage(createdTime, timeZone); }
Source:
public Map<String, RoutingTableSnapshot> getRoutingTableSnapshots() { Map<String, RoutingTableSnapshot> snapshots = new HashMap<>(); for (String key : _routingTableRef.keySet()) { snapshots.put(key, new RoutingTableSnapshot(_routingTableRef.get(key).get())); } return snapshots; }

Target:
public Map<String, Map<String, RoutingTableSnapshot>> getRoutingTableSnapshots() { Map<String, Map<String, RoutingTableSnapshot>> snapshots = new HashMap<>(); for (String key : _routingTableRefMap.keySet()) { RoutingTable routingTable = _routingTableRefMap.get(key).get(); String propertyTypeName = routingTable.getPropertyType().name(); String customizedStateType = routingTable.getStateType(); if (!snapshots.containsKey(propertyTypeName)) { snapshots.put(propertyTypeName, new HashMap<>()); } snapshots.get(propertyTypeName).put(customizedStateType, new RoutingTableSnapshot(routingTable)); } return snapshots; }
Source:
public void localSslAuthenticationDisabled() throws Exception { server.await(); dbClient = ClientBuilder.url(new URL(server.getUrl())) .setSSLAuthenticationDisabled(true) .build(); dbClient.getAllDbs(); }

Target:
public void localSslAuthenticationDisabled() throws Exception { server.await(); dbClient = CloudantClientHelper.newSimpleHttpServerClient(server) .disableSSLAuthentication() .build(); dbClient.getAllDbs(); }
Source:
@Override public void start() { session.addActivityConsumer(this, Priority.ACTIVE); }

Target:
public void start() { session.addActivityConsumer(this, Priority.ACTIVE); }
Source:
public static GridCellValue<?> extractGridCellValue(final GridCellTuple cellTuple) { final GridCell<?> cell = cellTuple.getGridWidget().getModel().getCell(cellTuple.getRowIndex(), cellTuple.getColumnIndex()); return cell == null ? null : cell.getValue(); }

Target:
public static Optional<GridCellValue<?>> extractGridCellValue(final GridCellTuple cellTuple) { final GridCell<?> cell = cellTuple.getGridWidget().getModel().getCell(cellTuple.getRowIndex(), cellTuple.getColumnIndex()); return Optional.ofNullable(cell == null ? null : cell.getValue()); }
Source:
public void writeTime( long nanosOfDayLocal, int offsetSeconds ) { this.nanosOfDayUTC = nanosOfDayLocal - offsetSeconds * 1_000_000_000L; this.zoneOffsetSeconds = offsetSeconds; }

Target:
public void writeTime( long nanosOfDayLocal, int offsetSeconds ) { this.nanosOfDayUTC = nanosOfDayLocal - offsetSeconds * NANOS_PER_SECOND; this.zoneOffsetSeconds = offsetSeconds; }
Source:
public void testEscape() { byte[] bytes = {0x00, 0x01}; byte[] escaped = ByteUtils.escape(bytes); assertArrayEquals(bytes, ByteUtils.unescape(escaped)); exception.expect(IllegalArgumentException.class); byte[] errorBytes = {0x01}; assertArrayEquals(errorBytes, ByteUtils.unescape(errorBytes)); byte[] notEscaped = {0x02, 0x02, 0x02}; assertArrayEquals(notEscaped, ByteUtils.unescape(notEscaped)); }

Target:
public void testEscape() { byte[] bytes = {0x00, 0x01}; byte[] escaped = ByteUtils.escape(bytes); assertArrayEquals(bytes, ByteUtils.unescape(escaped)); byte[] notEscaped = {0x02, 0x02, 0x02}; assertArrayEquals(notEscaped, ByteUtils.unescape(notEscaped)); }
Source:
protected PutRequest createPutRequest() { return new PutRequest(correlationIdGenerator.incrementAndGet(), putManager.routerConfig.routerHostname, chunkBlobId, blobProperties, ByteBuffer.wrap(userMetadata), new ByteBufferInputStream(buf.duplicate()), buf.remaining(), BlobType.DataBlob); }

Target:
protected PutRequest createPutRequest() { return new PutRequest(NonBlockingRouter.correlationIdGenerator.incrementAndGet(), routerConfig.routerHostname, chunkBlobId, blobProperties, ByteBuffer.wrap(userMetadata), new ByteBufferInputStream(buf.duplicate()), buf.remaining(), BlobType.DataBlob); }
Source:
private void readCommonParameters(Class<?> cls) { Path path = AnnotationUtils.findAnnotation(cls, Path.class); if (path != null) { return; } List<Method> filteredMethods = getFilteredMethods(cls); for (Method method : filteredMethods) { path = AnnotationUtils.findAnnotation(method, Path.class); if (path != null) { return; } String httpMethod = extractOperationMethod(null, method, SwaggerExtensions.chain()); if (httpMethod != null) { return; } } Field[] fields = cls.getDeclaredFields(); for (Field field : fields) { Annotation[] annotations = field.getAnnotations(); if (annotations.length > 0) { List<Parameter> params = getParameters(cls, Arrays.asList(annotations)); for (Parameter param : params) { swagger.addParameter(param.getName(), param); } } } }

Target:
private void readCommonParameters(Class<?> cls) { Path path = AnnotationUtils.findAnnotation(cls, Path.class); if (path != null) { return; } List<Method> filteredMethods = getFilteredMethods(cls); for (Method method : filteredMethods) { path = AnnotationUtils.findAnnotation(method, Path.class); if (path != null) { return; } String httpMethod = extractOperationMethod(null, method, SwaggerExtensions.chain()); if (httpMethod != null) { return; } } Field[] fields = cls.getDeclaredFields(); for (Field field : fields) { Annotation[] annotations = field.getAnnotations(); if (annotations.length > 0) { List<Parameter> params = getParameters(cls, Arrays.asList(annotations)); for (Parameter param : params) { if (hasCommonParameter(param)) { String msg = "[" + cls.getCanonicalName() + "] Redefining common parameter '" + param.getName() + "' already defined elsewhere"; throw new RuntimeException(msg); } swagger.addParameter(param.getName(), param); } } } }
Source:
public static UsersStateDifference fromUmsAndIpaUsersStates(UmsUsersState umsState, UsersState ipaState) { ImmutableSet<FmsUser> usersToAdd = calculateUsersToAdd(umsState, ipaState); LOGGER.info("usersToAdd size = {}", usersToAdd.size()); if (LOGGER.isDebugEnabled()) { LOGGER.debug("adding users {}", usersToAdd.stream().map(FmsUser::getName).collect(Collectors.toSet())); } ImmutableSet<String> usersToRemove = calculateUsersToRemove(umsState, ipaState); LOGGER.info("usersToRemove size = {}", usersToRemove.size()); if (LOGGER.isDebugEnabled()) { LOGGER.debug("removing users {}", usersToRemove.stream().collect(Collectors.toSet())); } ImmutableSet<FmsGroup> groupsToAdd = calculateGroupsToAdd(umsState, ipaState); LOGGER.info("groupsToAdd size = {}", groupsToAdd.size()); if (LOGGER.isDebugEnabled()) { LOGGER.debug("adding groups {}", groupsToAdd.stream().map(FmsGroup::getName).collect(Collectors.toSet())); } ImmutableSet<FmsGroup> groupsToRemove = calculateGroupsToRemove(umsState, ipaState); LOGGER.info("groupsToRemove size = {}", groupsToRemove.size()); if (LOGGER.isDebugEnabled()) { LOGGER.debug("removing groups {}", groupsToRemove.stream().map(FmsGroup::getName).collect(Collectors.toSet())); } ImmutableMultimap<String, String> groupMembershipToAdd = calculateGroupMembershipToAdd(umsState, ipaState); LOGGER.info("groupMembershipToAdd size = {}", groupMembershipToAdd.size()); if (LOGGER.isDebugEnabled()) { LOGGER.debug("adding group memberships {}", groupMembershipToAdd.asMap()); } ImmutableMultimap<String, String> groupMembershipToRemove = calculateGroupMembershipToRemove(umsState, ipaState); LOGGER.info("groupMembershipToRemove size = {}", groupMembershipToRemove.size()); if (LOGGER.isDebugEnabled()) { LOGGER.debug("removing group memberships {}", groupMembershipToRemove.asMap()); } return new UsersStateDifference( groupsToAdd, groupsToRemove, usersToAdd, usersToRemove, groupMembershipToAdd, groupMembershipToRemove); }

Target:
public static UsersStateDifference fromUmsAndIpaUsersStates(UmsUsersState umsState, UsersState ipaState) { return new UsersStateDifference( calculateGroupsToAdd(umsState, ipaState), calculateGroupsToRemove(umsState, ipaState), calculateUsersToAdd(umsState, ipaState), calculateUsersToRemove(umsState, ipaState), calculateGroupMembershipToAdd(umsState, ipaState), calculateGroupMembershipToRemove(umsState, ipaState)); }
Source:
public void setManagedDeviceMap(Map<Guid, VmDevice> map) { mVmStatic.setManagedDeviceMap(map); }

Target:
public void setManagedDeviceMap(Map<Guid, VmDevice> map) { if (mVmStatic == null) { mVmStatic = new VmStatic(); } mVmStatic.setManagedDeviceMap(map); }