auphong2707/dl4se-code-review-dataset huggingface dataset:
Source:
protected void doWrite(List<? extends Variant> variants) { numVariantsWritten += variants.size(); if(numVariantsWritten % 1000 == 0) { logger.info("Num variants written " + numVariantsWritten); } for (Variant variant : variants) { variant.setAnnotation(null); String id = variantConverter.buildStorageId(variant); for (VariantSourceEntry variantSourceEntry : variant.getSourceEntries().values()) { if (!variantSourceEntry.getFileId().equals(fileId)) { continue; } BasicDBObject query = new BasicDBObject("_id", id) .append(DBObjectToVariantConverter.CHROMOSOME_FIELD, variant.getChromosome()) .append(DBObjectToVariantConverter.START_FIELD, variant.getStart()); BasicDBObject addToSet = new BasicDBObject() .append(DBObjectToVariantConverter.FILES_FIELD, sourceEntryConverter.convertToStorageType(variantSourceEntry)); if (includeStats) { List<DBObject> sourceEntryStats = statsConverter.convertCohortsToStorageType(variantSourceEntry.getCohortStats(), variantSourceEntry.getStudyId(), variantSourceEntry.getFileId()); addToSet.put(DBObjectToVariantConverter.STATS_FIELD, new BasicDBObject("$each", sourceEntryStats)); } if (variant.getIds() != null && !variant.getIds().isEmpty()) { addToSet.put(DBObjectToVariantConverter.IDS_FIELD, new BasicDBObject("$each", variant.getIds())); } BasicDBObject update = new BasicDBObject() .append("$addToSet", addToSet) .append("$setOnInsert", variantConverter.convertToStorageType(variant)); bulk.find(query).upsert().updateOne(update); currentBulkSize++; } if (currentBulkSize >= bulkSize) { executeBulk(); } } if(currentBulkSize<bulkSize){ executeBulk(); } }

Target:
protected void doWrite(List<? extends Variant> variants) { for (Variant variant : variants) { String id = MongoDBHelper.buildStorageId(variant.getChromosome(), variant.getStart(), variant.getReference(), variant.getAlternate()); BasicDBObject query = new BasicDBObject("_id", id) .append(DBObjectToVariantConverter.CHROMOSOME_FIELD, variant.getChromosome()) .append(DBObjectToVariantConverter.START_FIELD, variant.getStart()); DBObject update = variantToMongoDbObjectConverter.convert(variant); bulk.find(query).upsert().updateOne(update); currentBulkSize++; } executeBulk(); }
Source:
public static Set<Concept> conceptSetHelper(String descriptor) { Set<Concept> ret = new HashSet<>(conceptListHelper(descriptor)); return ret; }

Target:
public static Set<Concept> conceptSetHelper(String descriptor) { Set<Concept> ret = new HashSet<>(); if (descriptor == null || descriptor.length() == 0) { return ret; } ConceptService cs = Context.getConceptService(); for (StringTokenizer st = new StringTokenizer(descriptor, "|"); st.hasMoreTokens();) { String s = st.nextToken().trim(); boolean isSet = s.startsWith("set:"); if (isSet) { s = s.substring(4).trim(); } Concept c = null; if (s.startsWith("name:")) { String name = s.substring(5).trim(); c = cs.getConceptByName(name); } else { try { c = cs.getConcept(Integer.valueOf(s.trim())); } catch (Exception ex) } if (c != null) { if (isSet) { List<Concept> inSet = cs.getConceptsByConceptSet(c); ret.addAll(inSet); } else { ret.add(c); } } } return ret; }
Source:
public Result apply(AggregationNode parent, Captures captures, Context context) { if (!parent.hasDefaultOutput() || parent.getOutputSymbols().size() != 1) { return Result.empty(); } Map<Symbol, AggregationNode.Aggregation> assignments = parent.getAggregations(); for (Map.Entry<Symbol, AggregationNode.Aggregation> entry : assignments.entrySet()) { AggregationNode.Aggregation aggregation = entry.getValue(); requireNonNull(aggregation, "aggregation is null"); if (!"count".equals(functionManager.getFunctionMetadata(aggregation.getFunctionHandle()).getName()) || !aggregation.getArguments().isEmpty()) { return Result.empty(); } } if (!assignments.isEmpty() && isScalar(parent.getSource(), context.getLookup())) { return Result.ofPlanNode(new ValuesNode( parent.getId(), parent.getOutputSymbols(), ImmutableList.of(ImmutableList.of(constant(1L, BIGINT))))); } return Result.empty(); }

Target:
public Result apply(AggregationNode parent, Captures captures, Context context) { if (!parent.hasDefaultOutput() || parent.getOutputVariables().size() != 1) { return Result.empty(); } Map<VariableReferenceExpression, AggregationNode.Aggregation> assignments = parent.getAggregations(); for (Map.Entry<VariableReferenceExpression, AggregationNode.Aggregation> entry : assignments.entrySet()) { AggregationNode.Aggregation aggregation = entry.getValue(); requireNonNull(aggregation, "aggregation is null"); if (!functionResolution.isCountFunction(aggregation.getFunctionHandle()) || !aggregation.getArguments().isEmpty()) { return Result.empty(); } } if (!assignments.isEmpty() && isScalar(parent.getSource(), context.getLookup())) { return Result.ofPlanNode(new ValuesNode( parent.getId(), parent.getOutputVariables(), ImmutableList.of(ImmutableList.of(constant(1L, BIGINT))))); } return Result.empty(); }
Source:
public ValidationResult validate(Object value) { ValidationResult result = new ValidationResult(); if (value != null && ((value instanceof String && !((String) value).equals("")) || value instanceof Long)) { Long longValue = value instanceof String ? LongCompat.tryParse((String) value) : (Long) value; String msg = ""; String prefixMsg = ConstantsManager.getInstance().getConstants().thisFieldMustContainNumberInvalidReason(); if (longValue == null) { result.setSuccess(false); msg = ConstantsManager.getInstance() .getMessages() .longValidationNumberBetweenInvalidReason(prefixMsg, getMinimum(), getMaximum()); result.getReasons().add(msg); } else if (longValue < getMinimum() || longValue > getMaximum()) { if (getMinimum() != Long.MIN_VALUE && getMaximum() != Long.MAX_VALUE) { msg = ConstantsManager.getInstance() .getMessages() .longValidationNumberBetweenInvalidReason(prefixMsg, getMinimum(), getMaximum()); } else if (getMinimum() != Long.MIN_VALUE) { msg = ConstantsManager.getInstance() .getMessages() .longValidationNumberGreaterInvalidReason(prefixMsg, getMinimum()); } else if (getMaximum() != Long.MAX_VALUE) { msg = ConstantsManager.getInstance() .getMessages() .longValidationNumberLessInvalidReason(prefixMsg, getMaximum()); } result.setSuccess(false); result.getReasons().add(msg); } } return result; }

Target:
public ValidationResult validate(Object value) { ValidationResult result = new ValidationResult(); if (value != null && ((value instanceof String && !"".equals(value)) || value instanceof Long)) { Long longValue = value instanceof String ? LongCompat.tryParse((String) value) : (Long) value; String msg = ""; String prefixMsg = ConstantsManager.getInstance().getConstants().thisFieldMustContainNumberInvalidReason(); if (longValue == null) { result.setSuccess(false); msg = ConstantsManager.getInstance() .getMessages() .longValidationNumberBetweenInvalidReason(prefixMsg, getMinimum(), getMaximum()); result.getReasons().add(msg); } else if (longValue < getMinimum() || longValue > getMaximum()) { if (getMinimum() != Long.MIN_VALUE && getMaximum() != Long.MAX_VALUE) { msg = ConstantsManager.getInstance() .getMessages() .longValidationNumberBetweenInvalidReason(prefixMsg, getMinimum(), getMaximum()); } else if (getMinimum() != Long.MIN_VALUE) { msg = ConstantsManager.getInstance() .getMessages() .longValidationNumberGreaterInvalidReason(prefixMsg, getMinimum()); } else if (getMaximum() != Long.MAX_VALUE) { msg = ConstantsManager.getInstance() .getMessages() .longValidationNumberLessInvalidReason(prefixMsg, getMaximum()); } result.setSuccess(false); result.getReasons().add(msg); } } return result; }
Source:
public WriteAttributesRequest(int objectId, int objectInstanceId, int resourceId, ObserveSpec observeSpec) { this(new LwM2mPath(objectId, objectInstanceId, resourceId), new AttributeSet(observeSpec.toQueryParams())); }

Target:
public WriteAttributesRequest(int objectId, int objectInstanceId, int resourceId, ObserveSpec observeSpec) throws InvalidRequestException { this(new LwM2mPath(objectId, objectInstanceId, resourceId), new AttributeSet(observeSpec.toQueryParams())); }
Source:
public byte[] serialize(RowData rowData) { try { genericRowData.setField(0, rowData); genericRowData.setField(1, rowKind2String(rowData.getRowKind())); return jsonSerializer.serialize(genericRowData); } catch (Throwable t) { throw new RuntimeException(format("Could not serialize row '%s'.", rowData), t); } }

Target:
public byte[] serialize(RowData rowData) { try { switch (rowData.getRowKind()) { case INSERT: case UPDATE_AFTER: genericRowData.setField(0, null); genericRowData.setField(1, rowData); genericRowData.setField(2, OP_INSERT); return jsonSerializer.serialize(genericRowData); case UPDATE_BEFORE: case DELETE: genericRowData.setField(0, rowData); genericRowData.setField(1, null); genericRowData.setField(2, OP_DELETE); return jsonSerializer.serialize(genericRowData); default: throw new UnsupportedOperationException(format("Unsupported operation '%s' for row kind.", rowData.getRowKind())); } } catch (Throwable t) { throw new RuntimeException(format("Could not serialize row '%s'.", rowData), t); } }
Source:
public void eachNonZeroInColumn(int j, MatrixProcedure procedure) { int k = columnPointers[j], i = rowIndices[k]; while (i < columnPointers[j+1]) { procedure.apply(rowIndices[i],j,values[i]); i++; } }

Target:
public void eachNonZeroInColumn(int j, MatrixProcedure procedure) { for (int i = columnPointers[j]; i < columnPointers[j + 1]; i++) { procedure.apply(rowIndices[i], j, values[i]); } }
Source:
public PointSensitivityBuilder rateSensitivity( PricingEnvironment env, OvernightAveragedRateObservation observation, LocalDate startDate, LocalDate endDate) { throw new UnsupportedOperationException(); }

Target:
public PointSensitivityBuilder rateSensitivity( PricingEnvironment env, OvernightAveragedRateObservation observation, LocalDate startDate, LocalDate endDate) { throw new UnsupportedOperationException("Rate sensitivity for OvernightIndex not currently supported"); }
Source:
void scanForClassesInSpringBootPackageIsAbleToLoadClassesCorrectly() throws Exception { File jarFile = createFakeSpringBootJar(ClasspathScannerTests.class); ClassLoader springBootClassLoader = new ClassLoader() { @Override public Enumeration<URL> getResources(final String name) throws IOException { final Vector<URL> resources = new Vector<>(); resources.add(new URL("jar:file://" + jarFile.getAbsolutePath() + "!/BOOT-INF/classes!/org/junit/platform/commons")); return resources.elements(); } }; Predicate<String> classNameFilter = name -> ClasspathScannerTests.class.getName().equals(name); ClasspathScanner localClasspathScanner = new ClasspathScanner(() -> springBootClassLoader, trackingClassLoader); localClasspathScanner.scanForClassesInPackage("org.junit.platform.commons", clazz -> true, classNameFilter); assertThat(loadedClasses).containsExactly(ClasspathScannerTests.class); }

Target:
void scanForClassesInSpringBootPackageIsAbleToLoadClassesCorrectly() throws Exception { File jarFile = createFakeSpringBootJar(ClasspathScannerTests.class); Predicate<String> classNameFilter = name -> ClasspathScannerTests.class.getName().equals(name); ClasspathScanner localClasspathScanner = new ClasspathScanner(() -> createClassLoaderReferencingJar(jarFile), trackingClassLoader); localClasspathScanner.scanForClassesInPackage("org.junit.platform.commons", clazz -> true, classNameFilter); assertThat(loadedClasses).containsExactly(ClasspathScannerTests.class); }
Source:
private static boolean isRestApiScope(HttpServletRequest request) { boolean isRestApiScope; try { isRestApiScope = SsoUtils.getSsoSession(request).isRestApiScope(); } catch (OAuthException ex) { isRestApiScope = false; } return isRestApiScope || isRestApiScope(SsoUtils.scopeAsList(SsoUtils.getScopeRequestParameter(request, ""))); }

Target:
private static boolean isRestApiScope(HttpServletRequest request) { boolean restApiScope; try { restApiScope = SsoUtils.getSsoSession(request).isRestApiScope(); } catch (OAuthException ex) { restApiScope = false; } return restApiScope || isRestApiScope(SsoUtils.scopeAsList(SsoUtils.getScopeRequestParameter(request, ""))); }
Source:
public void onNameDeleted(String name, int amount, String listName) { listInfo = new DataSource(getContext()).getListInfo(listName); settings.setListSize(listInfo.getNumNames()); settingsDialog.refreshSetting(); }

Target:
public void onNameDeleted(String name, int amount, String listName) { listInfo.removeNames(name, amount); settings.setNameListSize(listInfo.getNumInstances()); settingsDialog.refreshSetting(); }
Source:
public RealMatrix getLogNormalizedPInverseCounts() { return file.readMatrixAndCheckDimensions(LOG_NORMALIZED_PINV_PATH, getPanelSampleNames().size(), getPanelTargetNames().size()); }

Target:
public RealMatrix getLogNormalizedPInverseCounts() { return readMatrixAndCheckDimensions(LOG_NORMALIZED_PINV_PATH, getPanelSampleNames().size(), getPanelTargetNames().size()); }
Source:
protected void addMyAllVideosData() { if (myCoursesAdaptor == null) { return; } myCoursesAdaptor.clear(); getAllDownloadedVideosTask = new GetAllDownloadedVideosTask(getActivity()) { @Override protected void onSuccess(List<EnrolledCoursesResponse> enrolledCoursesResponses) throws Exception { super.onSuccess(enrolledCoursesResponses); if (enrolledCoursesResponses != null) { for (EnrolledCoursesResponse m : enrolledCoursesResponses) { if (m.isIs_active()) { myCoursesAdaptor.add(m); } } } } }; getAllDownloadedVideosTask.execute(); }

Target:
protected void addMyAllVideosData() { if (myCoursesAdaptor == null) { return; } if (getAllDownloadedVideosTask != null) { getAllDownloadedVideosTask.cancel(true); } getAllDownloadedVideosTask = new GetAllDownloadedVideosTask(getActivity()) { @Override protected void onSuccess(List<EnrolledCoursesResponse> enrolledCoursesResponses) throws Exception { super.onSuccess(enrolledCoursesResponses); myCoursesAdaptor.clear(); if (enrolledCoursesResponses != null) { for (EnrolledCoursesResponse m : enrolledCoursesResponses) { if (m.isIs_active()) { myCoursesAdaptor.add(m); } } } } }; getAllDownloadedVideosTask.execute(); }
Source:
public void playerSell() { QueueProvider.offer(player.getName() + "'s items:\t" + npc.getName() + "'s gold:" + npc.getGold() + "\n"); QueueProvider.offer(player.getStorage().displayWithValue(player.getLuck(), player.getIntelligence())); QueueProvider.offer("You have " + player.getGold() + " gold coins.\nWhat do you want to sell?"); String itemName = QueueProvider.take(); if ("exit".equals(itemName) || "back".equals(itemName)) { return; } Item item = tradeItem(player, npc, itemName); if (item != null) { if (item != itemRepo.getItem("empty")) { QueueProvider.offer("You have sold a " + item.getName() + " for " + (int)((0.5+0.02*(player.getIntelligence()+player.getLuck()))*item.getProperties().get("value")) + " gold coins."); QueueProvider.offer("You now have " + player.getGold() + " gold coins remaining."); } else { QueueProvider.offer(npc.getName() + " does not have enough money!"); } } else { QueueProvider.offer("Either this item doesn't exist or this character does not own that item"); } }

Target:
public void playerSell() { QueueProvider.offer(player.getName() + "'s items:\t" + npc.getName() + "'s gold:" + npc.getGold() + "\n"); QueueProvider.offer(player.getStorage().displayWithValue(player.getLuck(), player.getIntelligence())); QueueProvider.offer("You have " + player.getGold() + " gold coins.\nWhat do you want to sell?"); String itemName = QueueProvider.take(); if ("exit".equals(itemName) || "back".equals(itemName)) { return; } int goldBefore = player.getGold(); Item item = tradeItem(player, npc, itemName); if (item != null) { if (item != itemRepo.getItem("empty")) { QueueProvider.offer("You have sold a " + item.getName() + " for " + (player.getGold() - goldBefore) + " gold coins."); QueueProvider.offer("You now have " + player.getGold() + " gold coins remaining."); } else { QueueProvider.offer(npc.getName() + " does not have enough money!"); } } else { QueueProvider.offer("Either this item doesn't exist or this character does not own that item"); } }
Source:
private InitStep loadInitStep(File jar) { try { ClassLoader pluginLoader = new URLClassLoader(new URL[] {jar.toURI().toURL()}, InitPluginStepsLoader.class.getClassLoader()); JarFile jarFile = new JarFile(jar); Attributes jarFileAttributes = jarFile.getManifest().getMainAttributes(); String initClassName = jarFileAttributes.getValue("Gerrit-InitStep"); if (initClassName == null) { return null; } @SuppressWarnings("unchecked") Class<? extends InitStep> initStepClass = (Class<? extends InitStep>) pluginLoader.loadClass(initClassName); return getPluginInjector(jar).getInstance(initStepClass); } catch (ClassCastException e) { log.warn("InitStep from plugin " + jar.getName() + " does not implement " + InitStep.class.getName(), e); return null; } catch (Exception e) { log.error("Cannot load and get plugin init step for " + jar, e); return null; } }

Target:
private InitStep loadInitStep(File jar) { try { ClassLoader pluginLoader = new URLClassLoader(new URL[] {jar.toURI().toURL()}, InitPluginStepsLoader.class.getClassLoader()); JarFile jarFile = new JarFile(jar); Attributes jarFileAttributes = jarFile.getManifest().getMainAttributes(); String initClassName = jarFileAttributes.getValue("Gerrit-InitStep"); if (initClassName == null) { return null; } @SuppressWarnings("unchecked") Class<? extends InitStep> initStepClass = (Class<? extends InitStep>) pluginLoader.loadClass(initClassName); return getPluginInjector(jar).getInstance(initStepClass); } catch (ClassCastException e) { ui.message( "WARN: InitStep from plugin %s does not implement %s (Exception: %s)", jar.getName(), InitStep.class.getName(), e.getMessage()); return null; } catch (Exception e) { ui.message( "WARN: Cannot load and get plugin init step for %s (Exception: %s)", jar, e.getMessage()); return null; } }
Source:
public void save(Patient patient) { try { XWikiDocument doc = (XWikiDocument) this.documentAccessBridge.getDocument(patient.getDocument()); if (doc == null) { throw new NullPointerException(ERROR_MESSAGE_NO_PATIENT_CLASS); } PatientData<Map<String, String>> genes = patient.getData(getName()); if (!genes.isIndexed()) { return; } XWikiContext context = (XWikiContext) this.execution.getContext().getProperty("xwikicontext"); Iterator<Map<String, String>> iterator = genes.iterator(); while (iterator.hasNext()) { Map<String, String> gene = iterator.next(); BaseObject xwikiObject = doc.newXObject(GENE_CLASS_REFERENCE, context); for (String property : this.getProperties()) { String value = gene.get(property); if (value != null) { xwikiObject.set(property, value, context); } } xwikiObject.set("type", "molecular", context); } context.getWiki().saveDocument(doc, "Updated genes from JSON", true, context); } catch (Exception e) { this.logger.error("Failed to save genes: [{}]", e.getMessage()); } }

Target:
public void save(Patient patient) { try { XWikiDocument doc = (XWikiDocument) this.documentAccessBridge.getDocument(patient.getDocument()); if (doc == null) { throw new NullPointerException(ERROR_MESSAGE_NO_PATIENT_CLASS); } PatientData<Map<String, String>> genes = patient.getData(this.getName()); if (!genes.isIndexed()) { return; } XWikiContext context = (XWikiContext) this.execution.getContext().getProperty("xwikicontext"); Iterator<Map<String, String>> iterator = genes.iterator(); while (iterator.hasNext()) { try { Map<String, String> gene = iterator.next(); BaseObject xwikiObject = doc.newXObject(GENE_CLASS_REFERENCE, context); for (String property : this.getProperties()) { String value = gene.get(property); if (value != null) { xwikiObject.set(property, value, context); } } xwikiObject.set("type", "molecular", context); } catch (Exception e) { this.logger.error("Failed to save a specific gene: [{}]", e.getMessage()); } } context.getWiki().saveDocument(doc, "Updated genes from JSON", true, context); } catch (Exception e) { this.logger.error("Failed to save genes: [{}]", e.getMessage()); } }
Source:
private void addInstallers(EnvironmentImpl envConfig, DockerEnvironment internalEnv) throws InfrastructureException { for (Map.Entry<String, MachineConfigImpl> machineConfigEntry : envConfig.getMachines().entrySet()) { String machineName = machineConfigEntry.getKey(); MachineConfigImpl machineConfig = machineConfigEntry.getValue(); DockerContainerConfig containerConfig = internalEnv.getContainers().get(machineName); for (String installer : machineConfig.getInstallers()) { switch (installer) { case "org.eclipse.che.terminal": containerConfig.getVolumes().add(terminalVolumeProvider.get()); break; case "org.eclipse.che.exec": containerConfig.getVolumes().add(execVolumeProvider.get()); break; case "org.eclipse.che.ws-agent": containerConfig.getVolumes().add(wsAgentVolumeProvider.get()); String extConfVolume = dockerExtConfBindingProvider.get(); if (extConfVolume != null) { containerConfig.getVolumes().add(extConfVolume); } containerConfig.getEnvironment().put(CheBootstrap.CHE_LOCAL_CONF_DIR, DockerExtConfBindingProvider.EXT_CHE_LOCAL_CONF_DIR); break; default: } } } try { installerConfigApplier.apply(envConfig, internalEnv); } catch (InstallerException e) { throw new InfrastructureException(e.getLocalizedMessage(), e); } }

Target:
private void addInstallers(EnvironmentImpl envConfig, DockerEnvironment internalEnv) throws InfrastructureException { for (Map.Entry<String, MachineConfigImpl> machineConfigEntry : envConfig.getMachines().entrySet()) { String machineName = machineConfigEntry.getKey(); MachineConfigImpl machineConfig = machineConfigEntry.getValue(); DockerContainerConfig containerConfig = internalEnv.getContainers().get(machineName); List<String> installers = machineConfig.getInstallers(); if (installers.contains("org.eclipse.che.terminal")) { containerConfig.getVolumes().add(terminalVolumeProvider.get()); } if (installers.contains("org.eclipse.che.exec")) { containerConfig.getVolumes().add(execVolumeProvider.get()); } if (installers.contains("org.eclipse.che.ws-agent")) { containerConfig.getVolumes().add(wsAgentVolumeProvider.get()); String extConfVolume = dockerExtConfBindingProvider.get(); if (extConfVolume != null) { containerConfig.getVolumes().add(extConfVolume); } containerConfig.getEnvironment().put(CheBootstrap.CHE_LOCAL_CONF_DIR, DockerExtConfBindingProvider.EXT_CHE_LOCAL_CONF_DIR); } } try { installerConfigApplier.apply(envConfig, internalEnv); } catch (InstallerException e) { throw new InfrastructureException(e.getLocalizedMessage(), e); } }
Source:
void noNullElementsWithCollection() { Assert.noNullElements(asList("foo", "bar"), "enigma"); }

Target:
void noNullElementsWithCollection() { assertThatCode(() -> Assert.noNullElements(asList("foo", "bar"), "enigma")) .doesNotThrowAnyException(); }
Source:
protected void onSearchBarcodeProduct() { Utils.hideKeyboard(getActivity()); if (mBarCodeText.getText().toString().isEmpty()) { displayToast(getResources().getString(R.string.txtBarcodeRequire)); } else { String barcodeText = mBarCodeText.getText().toString(); if (barcodeText.length() <= 2) { displayToast(getResources().getString(R.string.txtBarcodeNotValid)); } else { if (ProductUtils.isBareCodeValid(barcodeText)) { api.getProduct(mBarCodeText.getText().toString(), getActivity()); } else { displayToast(getResources().getString(R.string.txtBarcodeNotValid)); } } } }

Target:
protected void onSearchBarcodeProduct() { Utils.hideKeyboard(getActivity()); if (mBarCodeText.getText().toString().isEmpty()) { displayToast(getResources().getString(R.string.txtBarcodeRequire)); } else { String barcodeText = mBarCodeText.getText().toString(); if (barcodeText.length() <= 2) { displayToast(getResources().getString(R.string.txtBarcodeNotValid)); } else { if (ProductUtils.isBarcodeValid(barcodeText)) { api.getProduct(mBarCodeText.getText().toString(), getActivity()); } else { displayToast(getResources().getString(R.string.txtBarcodeNotValid)); } } } }
Source:
protected void executeCommand() { VDSReturnValue returnValue = runVdsCommand(manageActionDetailsMap.get(getParameters().getActionType()).getVdsCmdType(), new GlusterServiceVDSParameters(serverService.getServerId(), getParameters().getActionType(), serverService.getServiceName())); setSucceeded(returnValue.getSucceeded()); if (getSucceeded()) { serverService.setStatus(manageActionDetailsMap.get(getParameters().getActionType()).getStatus()); getGlusterServerServiceDao().update(serverService); } else { handleVdsError(manageActionDetailsMap.get(getParameters().getActionType()).getActionFailedActionLog(), returnValue.getVdsError().getMessage()); } }

Target:
protected void executeCommand() { if (!(Guid.isNullOrEmpty(clusterId))) { performActionForServicesOfCluster(); } else if (!(Guid.isNullOrEmpty(serverId))) { performActionForServicesOfServer(); } }
Source:
public DependenciesItemPresenter setup(final EnhancedDependency enhancedDependency, final WhiteList whiteList, final DependenciesPresenter dependenciesPresenter) { this.enhancedDependency = enhancedDependency; this.parentPresenter = dependenciesPresenter; final Dependency dependency = enhancedDependency.getDependency(); view.init(this); view.setGroupId(dependency.getGroupId()); view.setArtifactId(dependency.getArtifactId()); view.setVersion(dependency.getVersion()); view.setPackagesWhiteListedState(WhiteListedPackagesState.from(whiteList, enhancedDependency.getPackages())); view.setTransitiveDependency(enhancedDependency instanceof TransitiveEnhancedDependency); view.setElementRequired("groupId",true); view.setElementRequired("artifactId",true); view.setElementRequired("version",true); view.setElementOnchange("groupId",new Element.OnchangeCallbackFn() { @Override public Object onInvoke(Event p0) { enhancedDependency.getDependency().setGroupId(view.getGroupId()); parentPresenter.fireChangeEvent(); return p0; } }); view.setElementOnchange("artifactId",new Element.OnchangeCallbackFn() { @Override public Object onInvoke(Event p0) { enhancedDependency.getDependency().setArtifactId(view.getArtifactId()); parentPresenter.fireChangeEvent(); return p0; } }); view.setElementOnchange("version",new Element.OnchangeCallbackFn() { @Override public Object onInvoke(Event p0) { enhancedDependency.getDependency().setVersion(view.getVersion()); parentPresenter.fireChangeEvent(); return p0; } }); return this; }

Target:
public DependenciesItemPresenter setup(final EnhancedDependency enhancedDependency, final WhiteList whiteList, final DependenciesPresenter dependenciesPresenter) { this.enhancedDependency = enhancedDependency; this.parentPresenter = dependenciesPresenter; final Dependency dependency = enhancedDependency.getDependency(); validator = new DependencyValidator(dependency); view.init(this); view.setGroupId(dependency.getGroupId()); view.setArtifactId(dependency.getArtifactId()); view.setVersion(dependency.getVersion()); view.setPackagesWhiteListedState(WhiteListedPackagesState.from(whiteList, enhancedDependency.getPackages())); view.setTransitiveDependency(enhancedDependency instanceof TransitiveEnhancedDependency); return this; }
Source:
public ContentType find(final String inodeOrVar) throws DotSecurityException, DotDataException { if(!UtilMethods.isSet(inodeOrVar))return null; final ContentType type = this.contentTypeFactory.find(inodeOrVar); if (perms.doesUserHavePermission(type, PermissionAPI.PERMISSION_READ, user)) { return type; } throw new DotSecurityException("User " + user + " does not have READ permissions on ContentType " + type); }

Target:
public ContentType find(final String inodeOrVar) throws DotSecurityException, DotDataException { if(!UtilMethods.isSet(inodeOrVar)) { return null; } final ContentType type = this.contentTypeFactory.find(inodeOrVar); if (perms.doesUserHavePermission(type, PermissionAPI.PERMISSION_READ, user)) { return type; } throw new DotSecurityException("User " + user + " does not have READ permissions on ContentType " + type); }
Source:
protected void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException { String queryString = request.getQueryString(); if (StringUtils.isNotEmpty(queryString)) { if (url.indexOf("?") == -1) { url += "?"; } else { url += "&"; } url += queryString; } response.sendRedirect(url); }

Target:
protected void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException { String redirectUrl = url; String queryString = request.getQueryString(); if (StringUtils.isNotEmpty(queryString)) { if (redirectUrl.indexOf("?") == -1) { redirectUrl += "?"; } else { redirectUrl += "&"; } redirectUrl += queryString; } response.sendRedirect(redirectUrl); }
Source:
protected void updateData(long start, long end, int nb, @Nullable IProgressMonitor monitor) { double x[] = getXAxis(start, end, nb); setXAxis(x); final double y[] = new double[nb]; final long yLong[] = new long[nb]; Arrays.fill(y, 0.0); for (ITmfTrace trace : TmfTraceManager.getTraceSet(getTrace())) { final TmfStatisticsModule statsMod = TmfTraceUtils.getAnalysisModuleOfClass(trace, TmfStatisticsModule.class, TmfStatisticsModule.ID); if (statsMod == null) { continue; } statsMod.waitForInitialization(); final ITmfStatistics stats = statsMod.getStatistics(); if (stats == null) { throw new IllegalStateException(); } List<Long> values = stats.histogramQuery(start, end, nb); for (int i = 0; i < nb; i++) { yLong[i] += values.get(i); } } for (int i = 0; i < nb; i++) { y[i] += yLong[i]; } setSeries("Number of events", y); updateDisplay(); }

Target:
protected void updateData(long start, long end, int nb, @Nullable IProgressMonitor monitor) { double x[] = getXAxis(start, end, nb); setXAxis(x); final double y[] = new double[nb]; final long yLong[] = new long[nb]; Arrays.fill(y, 0.0); for (ITmfTrace trace : TmfTraceManager.getTraceSet(getTrace())) { final TmfStatisticsModule statsMod = TmfTraceUtils.getAnalysisModuleOfClass(trace, TmfStatisticsModule.class, TmfStatisticsModule.ID); if (statsMod == null) { continue; } statsMod.waitForInitialization(); final ITmfStatistics stats = statsMod.getStatistics(); Objects.requireNonNull(stats); List<Long> values = stats.histogramQuery(start, end, nb); for (int i = 0; i < nb; i++) { yLong[i] += values.get(i); } } for (int i = 0; i < nb; i++) { y[i] += yLong[i]; } setSeries("Number of events", y); updateDisplay(); }
Source:
private void executeFirstChunkedQuery() throws SQLException { StringBuilder firstQuery = new StringBuilder(); firstQuery.append("SELECT * FROM ("); firstQuery.append(_sourceQuery); firstQuery.append(")"); firstQuery.append("WHERE ORA_HASH("); if (_numChunkingKeys > 1) { firstQuery.append("CONCAT(" + _chunkingKeysString + ")"); } else { firstQuery.append(_chunkingKeysString); } firstQuery.append(" , " + _maxChunkIndex + " ) = " + _chunkIndex + " "); firstQuery.append("AND ROWNUM <= " + _chunkSize); _firstStmt = _connection.prepareStatement(firstQuery.toString()); _firstStmt.setFetchSize(_fetchSize); _firstStmt.setQueryTimeout(_queryTimeoutSecs); _queryResultSet = _firstStmt.executeQuery(); }

Target:
private void executeFirstChunkedQuery() throws SQLException { String firstQuery = _chunkedQueryManager.generateFirstQuery(_sourceQuery, new ArrayList<>(_chunkingKeys.keySet()), _chunkSize, _maxChunkIndex, _chunkIndex); _firstStmt = _connection.prepareStatement(firstQuery); _firstStmt.setFetchSize(_fetchSize); _firstStmt.setQueryTimeout(_queryTimeoutSecs); _queryResultSet = _firstStmt.executeQuery(); }
Source:
public BoundedIntValuesWriter(int bound, int initialCapacity, int pageSize, ByteBufferAllocator allocator) { if (bound == 0) { throw new ParquetEncodingException("Value bound cannot be 0. Use DevNullColumnWriter instead."); } this.allocator = allocator; this.bitWriter = new BitWriter(initialCapacity, pageSize, this.allocator); bitsPerValue = (int)Math.ceil(Math.log(bound + 1)/Math.log(2)); shouldRepeatThreshold = (bitsPerValue + 9)/(1 + bitsPerValue); if (Log.DEBUG) LOG.debug("init column with bit width of " + bitsPerValue + " and repeat threshold of " + shouldRepeatThreshold); }

Target:
public BoundedIntValuesWriter(int bound, int initialCapacity, int pageSize, ByteBufferAllocator allocator) { if (bound == 0) { throw new ParquetEncodingException("Value bound cannot be 0. Use DevNullColumnWriter instead."); } this.bitWriter = new BitWriter(initialCapacity, pageSize, allocator); bitsPerValue = (int)Math.ceil(Math.log(bound + 1)/Math.log(2)); shouldRepeatThreshold = (bitsPerValue + 9)/(1 + bitsPerValue); if (Log.DEBUG) LOG.debug("init column with bit width of " + bitsPerValue + " and repeat threshold of " + shouldRepeatThreshold); }
Source:
public void shouldValidateExpiresInstantAtWithLeeway() throws Exception { Clock clock = mock(Clock.class); when(clock.getNow()).thenReturn(Instant.ofEpochMilli(DATE_TOKEN_MS_VALUE + 1000)); String token = "eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJleHAiOjE0Nzc1OTJ9.isvT0Pqx0yjnZk53mUFSeYFJLDs-Ls9IsNAm86gIdZo"; JWTVerifier.BaseVerification verification = (JWTVerifier.BaseVerification) JWTVerifier.init(Algorithm.HMAC256("secret")) .acceptExpiresAt(2); DecodedJWT jwt = verification .build(clock) .verify(token); assertThat(jwt, is(notNullValue())); }

Target:
public void shouldValidateExpiresInstantAtWithLeeway() { Clock clock = mock(Clock.class); when(clock.getNow()).thenReturn(Instant.ofEpochMilli(DATE_TOKEN_MS_VALUE + 1000)); String token = "eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJleHAiOjE0Nzc1OTJ9.isvT0Pqx0yjnZk53mUFSeYFJLDs-Ls9IsNAm86gIdZo"; JWTVerifier.BaseVerification verification = (JWTVerifier.BaseVerification) JWTVerifier.init(Algorithm.HMAC256("secret")) .acceptExpiresAt(2); DecodedJWT jwt = verification .build(clock) .verify(token); assertThat(jwt, is(notNullValue())); }
Source:
public ResearchRecipe(@Nonnull ItemStack result, TriPredicate<InventoryCrafting, EntityPlayer, World> matcher, Object... recipe) { super(new ResourceLocation(Constants.EI_MODID, "shaped_research"), result, recipe); this.matcher = matcher; }

Target:
public ResearchRecipe(@Nonnull ItemStack result, TriPredicate<InventoryCrafting, EntityPlayer, World> matcher, Object... recipe) { super(new ResourceLocation(Constants.API_MODID, "shaped_research"), result, recipe); this.matcher = matcher; }
Source:
private List<MergedAnomalyResultDTO> runSLACheck(MetricEntity me, Interval window) { List<MergedAnomalyResultDTO> anomalies = new ArrayList<>(); long startTime = window.getStart().getMillis(); long endTime = window.getEnd().getMillis(); MetricSlice metricSlice = MetricSlice.from(me.getId(), startTime, endTime, ArrayListMultimap.<String, String>create()); InputData data = this.dataFetcher.fetchData(new InputDataSpec() .withTimeseriesSlices(Collections.singletonList(metricSlice)) .withMetricIdsForDataset(Collections.singletonList(me.getId())) .withMetricIds(Collections.singletonList(me.getId()))); DatasetConfigDTO datasetConfig = data.getDatasetForMetricId().get(me.getId()); try { long datasetLastRefreshTime = datasetConfig.getLastRefreshTime(); if (datasetLastRefreshTime <= 0) { datasetLastRefreshTime = startTime - 1; } MetricSlice slice = MetricSlice.from(me.getId(), datasetLastRefreshTime + 1, endTime); if (isMissingData(datasetLastRefreshTime, startTime)) { DataFrame dataFrame = data.getTimeseries().get(metricSlice); if (dataFrame == null || dataFrame.isEmpty()) { if (hasMissedSLA(datasetLastRefreshTime, endTime)) { anomalies.add(createDataSLAAnomaly(slice, datasetConfig)); } } else { datasetLastRefreshTime = dataFrame.getDoubles("timestamp").max().longValue(); if (isPartialData(datasetLastRefreshTime, endTime, datasetConfig)) { if (hasMissedSLA(datasetLastRefreshTime, endTime)) { slice = MetricSlice.from(me.getId(), datasetLastRefreshTime + 1, endTime); anomalies.add(createDataSLAAnomaly(slice, datasetConfig)); } } } } else if (isPartialData(datasetLastRefreshTime, endTime, datasetConfig)) { if (hasMissedSLA(datasetLastRefreshTime, endTime)) { anomalies.add(createDataSLAAnomaly(slice, datasetConfig)); } } } catch (Exception e) { LOG.error(String.format("Failed to run sla check on metric URN %s", me.getUrn()), e); } return anomalies; }

Target:
private List<MergedAnomalyResultDTO> runSLACheck(MetricEntity me, Interval window) { List<MergedAnomalyResultDTO> anomalies = new ArrayList<>(); long expectedDatasetRefreshTime = window.getEnd().getMillis(); InputData data = this.dataFetcher.fetchData(new InputDataSpec() .withMetricIdsForDataset(Collections.singletonList(me.getId())) .withMetricIds(Collections.singletonList(me.getId()))); DatasetConfigDTO datasetConfig = data.getDatasetForMetricId().get(me.getId()); try { long datasetLastRefreshTime = fetchLatestDatasetRefreshTime(data, me, window); MetricSlice slice = MetricSlice.from(me.getId(), datasetLastRefreshTime + 1, expectedDatasetRefreshTime); if (isSLAViolated(datasetLastRefreshTime, expectedDatasetRefreshTime)) { anomalies.add(createDataSLAAnomaly(slice, datasetConfig)); } } catch (Exception e) { LOG.error(String.format("Failed to run sla check on metric URN %s", me.getUrn()), e); } return anomalies; }
Source:
private Query fieldQuery(IndexPredicate<ChangeData> p) throws QueryParseException { if (p.getType() == FieldType.INTEGER) { return intQuery(p); } else if (p.getType() == FieldType.TIMESTAMP) { return timestampQuery(p); } else if (p.getType() == FieldType.EXACT) { return exactQuery(p); } else if (p instanceof SortKeyPredicate) { return sortKeyQuery((SortKeyPredicate) p); } else { throw badFieldType(p.getType()); } }

Target:
private Query fieldQuery(IndexPredicate<ChangeData> p) throws QueryParseException { if (p.getType() == FieldType.INTEGER) { return intQuery(p); } else if (p.getType() == FieldType.TIMESTAMP) { return timestampQuery(p); } else if (p.getType() == FieldType.EXACT) { return exactQuery(p); } else if (p.getType() == FieldType.PREFIX) { return prefixQuery(p); } else if (p instanceof SortKeyPredicate) { return sortKeyQuery((SortKeyPredicate) p); } else { throw badFieldType(p.getType()); } }
Source:
public StatusUI(AddOn.Status status, String stringRepresentation) { if (status == null) { this.status = status = AddOn.Status.unknown; } else { this.status = status; } if (stringRepresentation == null || stringRepresentation.isEmpty()) { this.stringRepresentation = status.toString(); } else { this.stringRepresentation = stringRepresentation; } }

Target:
public StatusUI(AddOn.Status status, String stringRepresentation) { if (status == null) { this.status = AddOn.Status.unknown; } else { this.status = status; } if (stringRepresentation == null || stringRepresentation.isEmpty()) { this.stringRepresentation = this.status.toString(); } else { this.stringRepresentation = stringRepresentation; } }
Source:
private void writeForm(MultiValueMap<String, Object> formData, @Nullable MediaType contentType, HttpOutputMessage outputMessage) throws IOException { contentType = getMediaType(contentType); Charset charset = contentType.getCharset(); Assert.notNull(charset, "No charset"); final byte[] bytes = serializeForm(formData, charset).getBytes(charset); outputMessage.getHeaders().setContentLength(bytes.length); if (outputMessage instanceof StreamingHttpOutputMessage) { StreamingHttpOutputMessage streamingOutputMessage = (StreamingHttpOutputMessage) outputMessage; streamingOutputMessage.setBody(outputStream -> StreamUtils.copy(bytes, outputStream)); } else { StreamUtils.copy(bytes, outputMessage.getBody()); } if (MediaType.APPLICATION_FORM_URLENCODED.includes(contentType) && charset.equals(DEFAULT_APPLICATION_FORM_URLENCODED_CHARSET) ) { contentType = (MediaType.APPLICATION_FORM_URLENCODED; } outputMessage.getHeaders().setContentType(contentType); }

Target:
private void writeForm(MultiValueMap<String, Object> formData, @Nullable MediaType contentType, HttpOutputMessage outputMessage) throws IOException { contentType = getMediaType(contentType); Charset charset = contentType.getCharset(); Assert.notNull(charset, "No charset"); if (MediaType.APPLICATION_FORM_URLENCODED.equalsTypeAndSubtype(contentType) && charset.equals(DEFAULT_APPLICATION_FORM_URLENCODED_CHARSET) ) { outputMessage.getHeaders().setContentType(MediaType.APPLICATION_FORM_URLENCODED); } else { outputMessage.getHeaders().setContentType(contentType); } final byte[] bytes = serializeForm(formData, charset).getBytes(charset); outputMessage.getHeaders().setContentLength(bytes.length); if (outputMessage instanceof StreamingHttpOutputMessage) { StreamingHttpOutputMessage streamingOutputMessage = (StreamingHttpOutputMessage) outputMessage; streamingOutputMessage.setBody(outputStream -> StreamUtils.copy(bytes, outputStream)); } else { StreamUtils.copy(bytes, outputMessage.getBody()); } }
Source:
public void broadcastContinuationOnSameChannelOutOfOrder() throws Exception { Broadcast firstBroadcast = getFutureBroadcast(444L, 1, 2); Broadcast secondBroadcast = getFutureBroadcast(444L, 3, 5); secondBroadcast.setContinuation(true); Set<ResolvedBroadcast> resolvedBroadcasts = broadcastAggregator.aggregateBroadcasts( ImmutableSet.of(secondBroadcast, firstBroadcast), Optional.empty(), ImmutableList.of() ); assertThat(resolvedBroadcasts.size(), is(1)); Broadcast broadcast = Iterables.getFirst(resolvedBroadcasts, null).getBroadcast(); assertThat(broadcast.getTransmissionTime(), is(firstBroadcast.getTransmissionTime())); assertThat(broadcast.getTransmissionEndTime(), is(secondBroadcast.getTransmissionEndTime())); }

Target:
public void broadcastContinuationOnSameChannelOutOfOrder() throws Exception { Broadcast firstBroadcast = getFutureBroadcast(444L, 1, 2); Broadcast secondBroadcast = getFutureBroadcast(444L, 3, 5); secondBroadcast.setContinuation(true); Set<ResolvedBroadcast> resolvedBroadcasts = broadcastAggregator.aggregateBroadcasts( new LinkedHashSet<>(Arrays.asList(secondBroadcast, firstBroadcast)), Optional.empty(), ImmutableList.of() ); assertThat(resolvedBroadcasts.size(), is(1)); Broadcast broadcast = Iterables.getFirst(resolvedBroadcasts, null).getBroadcast(); assertThat(broadcast.getTransmissionTime(), is(firstBroadcast.getTransmissionTime())); assertThat(broadcast.getTransmissionEndTime(), is(secondBroadcast.getTransmissionEndTime())); }
Source:
default Status getStatus() { if (getTotal() == 0 || getDown() == getTotal()) { return Status.UNAVAILABLE; } if (getDown() == 0 && getUnknown() == 0) { return Status.AVAILABLE; } return Status.PARTIALLY_AVAILABLE; }

Target:
default Status getStatus() { int up = getUp(); int down = getDown() + getUnknown(); if (up == 0) { return Status.UNAVAILABLE; } if (down == 0) { return Status.AVAILABLE; } return Status.PARTIALLY_AVAILABLE; }
Source:
public void process(Message<?> message) { Double increment = this.config.getIncrementExpression().getValue(message, Double.class); String counterName = this.config.getComputedNameExpression().getValue(message, CharSequence.class).toString(); if (this.config.getTimeField() == null) { this.aggregateCounterRepository.increment(counterName, increment.longValue()); } else { String timeStampValue = this.config.getTimeField().getValue(message, String.class); if (dateTimeFormatter == null) { dateTimeFormatter = this.config.getDateFormatter(); } this.aggregateCounterRepository.increment(counterName, increment.longValue(), this.dateTimeFormatter.parseDateTime(timeStampValue)); } }

Target:
public void process(Message<?> message) { Long increment = this.config.getIncrementExpression().getValue(message, Long.class); String counterName = this.config.getComputedNameExpression().getValue(message, String.class); if (this.config.getTimeField() == null) { this.aggregateCounterRepository.increment(counterName, increment, DateTime.now()); } else { String timeStampValue = this.config.getTimeField().getValue(message, String.class); this.aggregateCounterRepository.increment(counterName, increment, this.config.getDateFormatter().parseDateTime(timeStampValue)); } }
Source:
public void onModuleLoad() { UserAgent.assertNotInIFrame(); KeyUtil.setEncoderImpl(new KeyUtil.Encoder() { @Override public String encode(String e) { e = URL.encodeQueryString(e); e = fixPathImpl(e); e = fixColonImpl(e); e = fixDoubleQuote(e); return e; } @Override public String decode(final String e) { return URL.decodeQueryString(e); } private native String fixPathImpl(String path) ; private native String fixColonImpl(String path) ; private native String fixDoubleQuote(String path) ; }); initHostname(); Window.setTitle(M.windowTitle1(myHost)); final HostPageDataService hpd = GWT.create(HostPageDataService.class); hpd.load(new GerritCallback<HostPageData>() { @Override public void onSuccess(final HostPageData result) { Document.get().getElementById("gerrit_hostpagedata").removeFromParent(); myConfig = result.config; myTheme = result.theme; if (result.account != null) { myAccount = result.account; xGerritAuth = result.xGerritAuth; } if (result.accountDiffPref != null) { myAccountDiffPref = result.accountDiffPref; applyUserPreferences(); } onModuleLoad2(result); } }); UiExtensionsApi.topMenu(new GerritCallback<TopMenuExtensionList>() { public void onSuccess(TopMenuExtensionList result) { topMenuExtensions = Natives.asList(result); refreshMenuBar(); }; }); }

Target:
public void onModuleLoad() { UserAgent.assertNotInIFrame(); KeyUtil.setEncoderImpl(new KeyUtil.Encoder() { @Override public String encode(String e) { e = URL.encodeQueryString(e); e = fixPathImpl(e); e = fixColonImpl(e); e = fixDoubleQuote(e); return e; } @Override public String decode(final String e) { return URL.decodeQueryString(e); } private native String fixPathImpl(String path) ; private native String fixColonImpl(String path) ; private native String fixDoubleQuote(String path) ; }); initHostname(); Window.setTitle(M.windowTitle1(myHost)); final HostPageDataService hpd = GWT.create(HostPageDataService.class); hpd.load(new GerritCallback<HostPageData>() { @Override public void onSuccess(final HostPageData result) { Document.get().getElementById("gerrit_hostpagedata").removeFromParent(); myConfig = result.config; myTheme = result.theme; if (result.account != null) { myAccount = result.account; xGerritAuth = result.xGerritAuth; } if (result.accountDiffPref != null) { myAccountDiffPref = result.accountDiffPref; applyUserPreferences(); } onModuleLoad2(result); } }); ConfigServerApi.topMenus(new GerritCallback<TopMenuList>() { public void onSuccess(TopMenuList result) { topMenuExtensions = Natives.asList(result); refreshMenuBar(); }; }); }
Source:
public void registerOperations(ManagementResourceRegistration hostDefinition) { super.registerOperations(hostDefinition); hostDefinition.registerOperationHandler(HostAddHandler.DEFINITION, new HostAddHandler(environment, ignoredDomainResourceRegistry, hostModelRegistrar, modelControllerResource)); }

Target:
public void registerOperations(ManagementResourceRegistration hostDefinition) { super.registerOperations(hostDefinition); hostDefinition.registerOperationHandler(HostAddHandler.DEFINITION, new HostAddHandler(this)); }
Source:
protected DocumentModel createNuxeoUser(String nuxeoLogin) { DocumentModel userDoc; try { userDoc = Framework.doPrivileged(() -> { UserManager userManager = Framework.getService(UserManager.class); DocumentModel user = userManager.getBareUserModel(); user.setPropertyValue(userManager.getUserIdField(), nuxeoLogin); return userManager.createUser(user); }); } catch (NuxeoException e) { log.error("Error while creating user " + nuxeoLogin + "in UserManager", e); return null; } return userDoc; }

Target:
protected DocumentModel createNuxeoUser(String nuxeoLogin) { DocumentModel userDoc; UserManager userManager = Framework.getService(UserManager.class); DocumentModel user = userManager.getBareUserModel(); user.setPropertyValue(userManager.getUserIdField(), nuxeoLogin); try { userDoc = Framework.doPrivileged(() -> { return userManager.createUser(user); }); } catch (NuxeoException e) { log.error("Error while creating user " + nuxeoLogin + "in UserManager", e); return null; } return userDoc; }
Source:
public VDSInfoReturn getCapabilities(BrokerCommandCallback callback) { JsonRpcRequest request = new RequestBuilder("Host.getCapabilities").build(); Map<String, Object> response = new FutureMap(this.client, request, callback) .withResponseKey("info"); return new VDSInfoReturn(response, true); }

Target:
public void getCapabilities(BrokerCommandCallback callback) { JsonRpcRequest request = new RequestBuilder("Host.getCapabilities").build(); try { client.call(request, callback); } catch (ClientConnectionException e) { throw new TransportRunTimeException("Connection issues during send request", e); } }