auphong2707/dl4se-code-review-dataset huggingface dataset:
Source:
<code>public ValidationResult validate(Object value) { ValidationResult result = new ValidationResult(); if (value != null && ((value instanceof String && <START> !((String) value).equals("")) <END> || 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; }</code><technical_language>I guess this is redundant</technical_language>

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:
<code><START> public WriteAttributesRequest(int objectId, int objectInstanceId, int resourceId, ObserveSpec observeSpec) { <END> this(new LwM2mPath(objectId, objectInstanceId, resourceId), new AttributeSet(observeSpec.toQueryParams())); }</code><technical_language>I remove this. in another PR/commit. Do remove throws InvalidRequestException</technical_language>

Target:
public WriteAttributesRequest(int objectId, int objectInstanceId, int resourceId, ObserveSpec observeSpec) throws InvalidRequestException { this(new LwM2mPath(objectId, objectInstanceId, resourceId), new AttributeSet(observeSpec.toQueryParams())); }
Source:
<code>public byte[] serialize(RowData rowData) { try { <START> genericRowData.setField(0, rowData); <END> genericRowData.setField(1, rowKind2String(rowData.getRowKind())); return jsonSerializer.serialize(genericRowData); } catch (Throwable t) { throw new RuntimeException(format("Could not serialize row '%s'.", rowData), t); } }</code><technical_language>This is wrong. Debezium serialize insert data in "after", delete data in "before"</technical_language>

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:
<code><START> public void eachNonZeroInColumn(int j, MatrixProcedure procedure) { <END> int k = columnPointers[j], i = rowIndices[k]; while (i < columnPointers[j+1]) { procedure.apply(rowIndices[i],j,values[i]); i++; } }</code><technical_language>a simple for loop here. Like: java for (int i = columnPointers[k]; i < columnPointers[j + 1]; i++) { procedure.apply(rowIndices[i], j, values[i]); } is wrong code. First, i = rowIndicies[k]. row rowIndicies[i]. This is strange. I guarantee fail tests</technical_language>

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:
<code>public PointSensitivityBuilder rateSensitivity( PricingEnvironment env, OvernightAveragedRateObservation observation, LocalDate startDate, LocalDate endDate) { <START> throw new UnsupportedOperationException(); <END> }</code><technical_language>is this unsupported? If operation sense error message</technical_language>

Target:
public PointSensitivityBuilder rateSensitivity( PricingEnvironment env, OvernightAveragedRateObservation observation, LocalDate startDate, LocalDate endDate) { throw new UnsupportedOperationException("Rate sensitivity for OvernightIndex not currently supported"); }
Source:
<code>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")); <START> return resources.elements(); <END> } }; 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); }</code><technical_language>This shorted java URL url = ...; return Collections.enumeration(Collections.singleton(url)); critical. :)</technical_language>

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:
<code>private static boolean isRestApiScope(HttpServletRequest request) { boolean <START> isRestApiScope; <END> try { isRestApiScope = SsoUtils.getSsoSession(request).isRestApiScope(); } catch (OAuthException ex) { isRestApiScope = false; } return isRestApiScope || isRestApiScope(SsoUtils.scopeAsList(SsoUtils.getScopeRequestParameter(request, ""))); }</code><technical_language>java naming convention 'isXXX' designed a name of a boolean method. This local variable named 'restApiScope'</technical_language>

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:
<code>public void onNameDeleted(String name, int amount, String listName) { <START> listInfo = new DataSource(getContext()).getListInfo(listName); <END> settings.setListSize(listInfo.getNumNames()); settingsDialog.refreshSetting(); }</code><technical_language>Instead of fetching DataSource, do NameAdapter (check out code) mutate ListInfo have. This save a DB read, is pricey</technical_language>

Target:
public void onNameDeleted(String name, int amount, String listName) { listInfo.removeNames(name, amount); settings.setNameListSize(listInfo.getNumInstances()); settingsDialog.refreshSetting(); }
Source:
<code>public RealMatrix getLogNormalizedPInverseCounts() { return file.readMatrixAndCheckDimensions(LOG_NORMALIZED_PINV_PATH, getPanelSampleNames().size(), <START> getPanelTargetNames().size()); <END> }</code><technical_language>transpose here</technical_language>

Target:
public RealMatrix getLogNormalizedPInverseCounts() { return readMatrixAndCheckDimensions(LOG_NORMALIZED_PINV_PATH, getPanelSampleNames().size(), getPanelTargetNames().size()); }
Source:
<code>protected void addMyAllVideosData() { if (myCoursesAdaptor == null) { return; } <START> myCoursesAdaptor.clear(); <END> 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(); }</code><technical_language>I task cancelling. remove else</technical_language>

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:
<code>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")) { <START> QueueProvider.offer("You have sold a " + item.getName() + " for " + (int)((0.5+0.02*(player.getIntelligence()+player.getLuck()))*item.getProperties().get("value")) + " gold coins."); <END> 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"); } }</code><technical_language>I this get player's gold tradeItem(...) player's gold tradeItem(...) display difference. if formula changes, require remembering places is calculated in</technical_language>

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:
<code>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) { <START> log.warn("InitStep from plugin " + jar.getName() + " does not implement " <END> + InitStep.class.getName(), e); return null; } catch (Exception e) { log.error("Cannot load and get plugin init step for " + jar, e); return null; } }</code><technical_language>ConsoleUI log</technical_language>

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:
<code>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()) { <START> Map<String, String> gene = iterator.next(); <END> 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()); } }</code><technical_language>previous struggles items in a list show, add a try-catch while(), catch omit individual mis-formatted/broken-in-any-way genes individually, failing entire gene import? Genes a complicated entity, fail import of amn individual gene if other genes ok</technical_language>

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:
<code>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) { <START> case "org.eclipse.che.terminal": <END> 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); } }</code><technical_language>a places installer identifiers string literals, if create constants for them</technical_language>

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:
<code>void noNullElementsWithCollection() { <START> Assert.noNullElements(asList("foo", "bar"), "enigma"); <END> }</code><technical_language>For assertions expected throw exception, please rework AssertJ construct, is code in question. java assertThatCode(() -> {}).doesNotThrowAnyException();</technical_language>

Target:
void noNullElementsWithCollection() { assertThatCode(() -> Assert.noNullElements(asList("foo", "bar"), "enigma")) .doesNotThrowAnyException(); }
Source:
<code>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 { <START> if (ProductUtils.isBareCodeValid(barcodeText)) { <END> api.getProduct(mBarCodeText.getText().toString(), getActivity()); } else { displayToast(getResources().getString(R.string.txtBarcodeNotValid)); } } } }</code><technical_language>is a BareCode ? :-P</technical_language>

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:
<code>protected void executeCommand() { VDSReturnValue returnValue = runVdsCommand(manageActionDetailsMap.get(getParameters().getActionType()).getVdsCmdType(), <START> new GlusterServiceVDSParameters(serverService.getServerId(), getParameters().getActionType(), serverService.getServiceName())); <END> 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()); } }</code><technical_language>initialize ManageActionDetail class in constructor, instead of in map time</technical_language>

Target:
protected void executeCommand() { if (!(Guid.isNullOrEmpty(clusterId))) { performActionForServicesOfCluster(); } else if (!(Guid.isNullOrEmpty(serverId))) { performActionForServicesOfServer(); } }
Source:
<code>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); <START> view.setElementRequired("groupId",true); <END> 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; }</code><technical_language>Set required view itself</technical_language>

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:
<code>public ContentType find(final String inodeOrVar) throws DotSecurityException, DotDataException { <START> if(!UtilMethods.isSet(inodeOrVar))return null; <END> 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); }</code><technical_language>![MINOR](<LINK_2> 'Severity: MINOR') Missing curly brace. [![rule](<LINK_1>](<LINK_0> ![MINOR](<LINK_2> 'Severity: MINOR') statement is allowed line, 2 statements this line. [![rule](<LINK_1>](<LINK_3></technical_language>

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:
<code>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 += "&"; } <START> url += queryString; <END> } response.sendRedirect(url); }</code><technical_language>this code, requests coming this servlet permanently modify servlet's "url" field (if requests carry query part) - is this want? simply create local variable modify one, instead of modifying servlet's "url" field</technical_language>

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:
<code>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(); <START> final ITmfStatistics stats = statsMod.getStatistics(); if (stats == null) { throw new IllegalStateException(); } <END> 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(); }</code><technical_language>Objects.requireNotNull</technical_language>

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:
<code>private void executeFirstChunkedQuery() throws SQLException { <START> StringBuilder firstQuery = new StringBuilder(); <END> 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(); }</code><technical_language>move common code getChunkyQuery() a single method</technical_language>

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:
<code>public BoundedIntValuesWriter(int bound, int initialCapacity, int pageSize, ByteBufferAllocator allocator) { if (bound == 0) { throw new ParquetEncodingException("Value bound cannot be 0. Use DevNullColumnWriter instead."); } <START> this.allocator = allocator; <END> 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); }</code><technical_language>allocator field is unused</technical_language>

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:
<code>public void shouldValidateExpiresInstantAtWithLeeway() throws Exception { <START> Clock clock = mock(Clock.class); <END> 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())); }</code><technical_language>Again, if this tests legacy behavior good is. changes this this file</technical_language>

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:
<code>public ResearchRecipe(@Nonnull ItemStack result, TriPredicate<InventoryCrafting, EntityPlayer, World> matcher, Object... recipe) { <START> super(new ResourceLocation(Constants.EI_MODID, "shaped_research"), result, recipe); <END> this.matcher = matcher; }</code><technical_language>This API mod ID this is API feature</technical_language>

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:
<code>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); <START> 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); } <END> return anomalies; }</code><technical_language>logic is complicated? compare data time expected refresh time</technical_language>

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:
<code>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); <START> } else if (p instanceof SortKeyPredicate) { <END> return sortKeyQuery((SortKeyPredicate) p); } else { throw badFieldType(p.getType()); } }</code><technical_language>Sigh, fact do this means FieldType working...it nice if FieldType.LONG implied predicate of a subclass supported getMinValue()/getMaxValue(). scope of this change, fine this now</technical_language>

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:
<code>public StatusUI(AddOn.Status status, String stringRepresentation) { if (status == null) { <START> this.status = status = AddOn.Status.unknown; <END> } else { this.status = status; } if (stringRepresentation == null || stringRepresentation.isEmpty()) { this.stringRepresentation = status.toString(); } else { this.stringRepresentation = stringRepresentation; } }</code><technical_language>changed this.status instead</technical_language>

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:
<code>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) ) { <START> contentType = (MediaType.APPLICATION_FORM_URLENCODED; <END> } outputMessage.getHeaders().setContentType(contentType); }</code><technical_language>this line compile</technical_language>

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:
<code><START> public void broadcastContinuationOnSameChannelOutOfOrder() throws Exception { <END> 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())); }</code><technical_language>This test identical ln:110</technical_language>

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:
<code>default Status getStatus() { if (getTotal() == 0 || getDown() == getTotal()) { return Status.UNAVAILABLE; } if (getDown() == 0 && getUnknown() == 0) { <START> return Status.AVAILABLE; <END> } return Status.PARTIALLY_AVAILABLE; }</code><technical_language>if/when Cassandra decides expose API interrogate node states low-impact do add a new protocol message triggers server send UP/DOWN event for node. driver send initial node list refresh (before more complicated, a simple STARTUP option unfortunately)</technical_language>

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:
<code>public void process(Message<?> message) { <START> Double increment = this.config.getIncrementExpression().getValue(message, Double.class); <END> 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)); } }</code><technical_language>Double if gonna long line 57</technical_language>

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:
<code>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); } }); <START> UiExtensionsApi.topMenu(new GerritCallback<TopMenuExtensionList>() { <END> public void onSuccess(TopMenuExtensionList result) { topMenuExtensions = Natives.asList(result); refreshMenuBar(); }; }); }</code><technical_language>Extend ConfigServerApi instead ConfigServerApi.topMenus()</technical_language>

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:
<code>public void registerOperations(ManagementResourceRegistration hostDefinition) { super.registerOperations(hostDefinition); <START> hostDefinition.registerOperationHandler(HostAddHandler.DEFINITION, new HostAddHandler(environment, ignoredDomainResourceRegistry, hostModelRegistrar, modelControllerResource)); <END> }</code><technical_language>Parameters.setAddHandler(...) in constructor, need override this method store in instance fields</technical_language>

Target:
public void registerOperations(ManagementResourceRegistration hostDefinition) { super.registerOperations(hostDefinition); hostDefinition.registerOperationHandler(HostAddHandler.DEFINITION, new HostAddHandler(this)); }
Source:
<code>protected DocumentModel createNuxeoUser(String nuxeoLogin) { DocumentModel userDoc; try { userDoc = Framework.doPrivileged(() -> { UserManager userManager = Framework.getService(UserManager.class); DocumentModel user = userManager.getBareUserModel(); <START> user.setPropertyValue(userManager.getUserIdField(), nuxeoLogin); <END> return userManager.createUser(user); }); } catch (NuxeoException e) { log.error("Error while creating user " + nuxeoLogin + "in UserManager", e); return null; } return userDoc; }</code><technical_language>try limit scope of a doPrivileged block, for auditability. I this line needs privileged block</technical_language>

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; }