auphong2707/dl4se-code-review-dataset huggingface dataset:
Source:
<code>public void stateChanged(TaskStatus taskStatus) { try { if (taskStatus.getState().isDone()) { doneTasks.add(taskStatus.getTaskId()); } updateMemoryUsage(taskStatus); updateCompletedDriverGroups(taskStatus); StageState stageState = getState(); if (stageState.isDone()) { return; } TaskState taskState = taskStatus.getState(); if (taskState == TaskState.FAILED) { RuntimeException failure = taskStatus.getFailures().stream() .findFirst() .map(this::rewriteTransportFailure) .map(ExecutionFailureInfo::toException) <START> .orElse(new PrestoException(StandardErrorCode.GENERIC_INTERNAL_ERROR, "A task failed for an unknown reason")); <END> stateMachine.transitionToFailed(failure); } else if (taskState == TaskState.ABORTED) { stateMachine.transitionToFailed(new PrestoException(StandardErrorCode.GENERIC_INTERNAL_ERROR, "A task is in the ABORTED state but stage is " + stageState)); } else if (taskState == TaskState.FINISHED) { finishedTasks.add(taskStatus.getTaskId()); } if (stageState == StageState.SCHEDULED || stageState == StageState.RUNNING) { if (taskState == TaskState.RUNNING) { stateMachine.transitionToRunning(); } if (finishedTasks.containsAll(allTasks)) { stateMachine.transitionToFinished(); } } } finally { if (stateMachine.getState().isDone() && doneTasks.containsAll(allTasks)) { stateMachine.setAllTasksFinal(); } } }</code><technical_language>Static import</technical_language>

Target:
public void stateChanged(TaskStatus taskStatus) { try { if (taskStatus.getState().isDone()) { doneTasks.add(taskStatus.getTaskId()); } updateMemoryUsage(taskStatus); updateCompletedDriverGroups(taskStatus); StageState stageState = getState(); if (stageState.isDone()) { return; } TaskState taskState = taskStatus.getState(); if (taskState == TaskState.FAILED) { RuntimeException failure = taskStatus.getFailures().stream() .findFirst() .map(this::rewriteTransportFailure) .map(ExecutionFailureInfo::toException) .orElse(new PrestoException(GENERIC_INTERNAL_ERROR, "A task failed for an unknown reason")); stateMachine.transitionToFailed(failure); } else if (taskState == TaskState.ABORTED) { stateMachine.transitionToFailed(new PrestoException(GENERIC_INTERNAL_ERROR, "A task is in the ABORTED state but stage is " + stageState)); } else if (taskState == TaskState.FINISHED) { finishedTasks.add(taskStatus.getTaskId()); } if (stageState == StageState.SCHEDULED || stageState == StageState.RUNNING) { if (taskState == TaskState.RUNNING) { stateMachine.transitionToRunning(); } if (finishedTasks.containsAll(allTasks)) { stateMachine.transitionToFinished(); } } } finally { if (stateMachine.getState().isDone() && doneTasks.containsAll(allTasks)) { stateMachine.setAllTasksFinal(); } } }
Source:
<code>protected IScalarEvaluator createEvaluator(IHyracksTaskContext ctx, IScalarEvaluator[] args) throws AlgebricksException { final ArrayBackedValueStorage abvs = new ArrayBackedValueStorage(); final UTF8StringPointable stringp = (UTF8StringPointable) UTF8StringPointable.FACTORY.createPointable(); final TaggedValuePointable nodep = (TaggedValuePointable) TaggedValuePointable.FACTORY.createPointable(); final ByteBufferInputStream bbis = new ByteBufferInputStream(); final DataInputStream di = new DataInputStream(bbis); final SequenceBuilder sb = new SequenceBuilder(); final ArrayBackedValueStorage abvsFileNode = new ArrayBackedValueStorage(); final int partition = ctx.getTaskAttemptId().getTaskId().getPartition(); final String nodeId = ctx.getJobletContext().getApplicationContext().getNodeId(); final ITreeNodeIdProvider nodeIdProvider = new TreeNodeIdProvider((short) partition); return new AbstractTaggedValueArgumentScalarEvaluator(args) { @Override protected void evaluate(TaggedValuePointable[] args, IPointable result) throws SystemException { IndexUpdater updater = new IndexUpdater(args, result, stringp, bbis, di, sb, abvs, nodeIdProvider, abvsFileNode, nodep, nodeId); try { updater.setup(); updater.deleteAllIndexes(); } catch (IOException | NoSuchAlgorithmException | JAXBException e) { throw new SystemException(ErrorCode.SYSE0001, e); } <START> <END> } }; }</code><technical_language>Add boolean result: XDMConstants.setTrue(result);</technical_language>

Target:
protected IScalarEvaluator createEvaluator(IHyracksTaskContext ctx, IScalarEvaluator[] args) throws AlgebricksException { final ArrayBackedValueStorage abvs = new ArrayBackedValueStorage(); final UTF8StringPointable stringp = (UTF8StringPointable) UTF8StringPointable.FACTORY.createPointable(); final TaggedValuePointable nodep = (TaggedValuePointable) TaggedValuePointable.FACTORY.createPointable(); final ByteBufferInputStream bbis = new ByteBufferInputStream(); final DataInputStream di = new DataInputStream(bbis); final SequenceBuilder sb = new SequenceBuilder(); final ArrayBackedValueStorage abvsFileNode = new ArrayBackedValueStorage(); final int partition = ctx.getTaskAttemptId().getTaskId().getPartition(); final String nodeId = ctx.getJobletContext().getApplicationContext().getNodeId(); final ITreeNodeIdProvider nodeIdProvider = new TreeNodeIdProvider((short) partition); return new AbstractTaggedValueArgumentScalarEvaluator(args) { @Override protected void evaluate(TaggedValuePointable[] args, IPointable result) throws SystemException { IndexUpdater updater = new IndexUpdater(args, result, stringp, bbis, di, sb, abvs, nodeIdProvider, abvsFileNode, nodep, nodeId); try { updater.setup(); updater.deleteAllIndexes(); XDMConstants.setTrue(result); } catch (IOException | NoSuchAlgorithmException | JAXBException e) { throw new SystemException(ErrorCode.SYSE0001, e); } } }; }
Source:
<code>public static String format(Date when) { long age = (System.currentTimeMillis() - when.getTime()) / 1000; if (age < 0) return JGitText.get().inTheFuture; if (age < 90) return MessageFormat.format(JGitText.get().secondsAgo, age); age = (age + 30) / 60; if (age < 90) return MessageFormat.format(JGitText.get().minutesAgo, age); age = (age + 30) / 60; if (age < 36) return MessageFormat.format(JGitText.get().hoursAgo, age); age = (age + 12) / 24; if (age < 14) return MessageFormat.format(JGitText.get().daysAgo, age); if (age < 70) return MessageFormat.format(JGitText.get().weeksAgo, (age + 3) / 7); <START> <END> if (age < 365) return MessageFormat.format(JGitText.get().monthsAgo, (age + 15) / 30); if (age < 1825) { long years = age / 365; String yearLabel = (years > 1) ? JGitText.get().years : JGitText.get().year; long months = (age % 365 + 15) / 30; String monthLabel = (months > 1) ? JGitText.get().months : JGitText.get().month; return MessageFormat.format(JGitText.get().yearsMonthsAgo, new Object[] { years, yearLabel, months, monthLabel }); } return MessageFormat.format(JGitText.get().yearsAgo, (age + 183) / 365); }</code><technical_language>strategy of converting age incrementally seconds minutes, minutes days leads nice read & understand code ... in end slower // convert seconds long age = (System.currentTimeMillis() - when.getTime()) / 1000; if (age < 90) ... else if (age < 90*60...) .</technical_language>

Target:
public static String format(Date when) { long ageMillis = (System.currentTimeMillis() - when.getTime()); if (ageMillis < 0) return JGitText.get().inTheFuture; if (ageMillis < upperLimit(MINUTE_IN_MILLIS)) return MessageFormat.format(JGitText.get().secondsAgo, round(ageMillis, SECOND_IN_MILLIS)); if (ageMillis < upperLimit(HOUR_IN_MILLIS)) return MessageFormat.format(JGitText.get().minutesAgo, round(ageMillis, MINUTE_IN_MILLIS)); if (ageMillis < upperLimit(DAY_IN_MILLIS)) return MessageFormat.format(JGitText.get().hoursAgo, round(ageMillis, HOUR_IN_MILLIS)); if (ageMillis < 14 * DAY_IN_MILLIS) return MessageFormat.format(JGitText.get().daysAgo, round(ageMillis, DAY_IN_MILLIS)); if (ageMillis < 10 * WEEK_IN_MILLIS) return MessageFormat.format(JGitText.get().weeksAgo, round(ageMillis, WEEK_IN_MILLIS)); if (ageMillis < YEAR_IN_MILLIS) return MessageFormat.format(JGitText.get().monthsAgo, round(ageMillis, MONTH_IN_MILLIS)); if (ageMillis < 5 * YEAR_IN_MILLIS) { long years = ageMillis / YEAR_IN_MILLIS; String yearLabel = (years > 1) ? JGitText.get().years : JGitText.get().year; long months = round(ageMillis % YEAR_IN_MILLIS, MONTH_IN_MILLIS); String monthLabel = (months > 1) ? JGitText.get().months : JGitText.get().month; return MessageFormat.format(JGitText.get().yearsMonthsAgo, new Object[] { years, yearLabel, months, monthLabel }); } return MessageFormat.format(JGitText.get().yearsAgo, round(ageMillis, YEAR_IN_MILLIS)); }
Source:
<code>public void trackSent(long timestamp) { <START> if (enabled) sentBuffer.write(new BufferedMessage(timestamp)); <END> }</code><technical_language>coding format change to: if (enabled) { ... }</technical_language>

Target:
public void trackSent(long timestamp) { if (enabled) { sentBuffer.write(new BufferedMessage(timestamp)); } }
Source:
<code>public boolean isTriggerActive(IStatementContainer source, IStatementParameter[] parameters) { <START> final PipeFlowPower flow = (PipeFlowPower) ((IPipeHolder) source.getTile()).getPipe().getFlow(); <END> return flow.getPowerRequested(null) > 0; }</code><technical_language>bit of advice, I forgotten triggers worked :/ suggestion if (!(source instanceof IGate)) { return false; } IPipeFlow f = ((IGate) source).getPipeHolder().getPipe().getFlow(); if (!(f instanceof PipeFlowPower)) { return false; } final PipeFlowPower flow = (PipeFlowPower) f;</technical_language>

Target:
public boolean isTriggerActive(IStatementContainer source, IStatementParameter[] parameters) { if (!(source instanceof IGate)) { return false; } PipeFlow f = ((IGate) source).getPipeHolder().getPipe().getFlow(); if (!(f instanceof PipeFlowPower)) { return false; } final PipeFlowPower flow = (PipeFlowPower) f; return flow.getPowerRequested(null) > 0; }
Source:
<code>public void stopSpooling() { doSpool = false; <START> this.out.flush(); this.out = new LocalizedOutput(System.out); <END> }</code><technical_language>close FileOutputStream, relying finalizers is finicky</technical_language>

Target:
public void stopSpooling() { doSpool = false; this.out.flush(); this.out.close(); this.out = new LocalizedOutput(System.out); }
Source:
<code><START> public String toString() { <END> StringBuilder builder = new StringBuilder(); if (locationName != null && !locationName.isEmpty()) { builder.append(locationName); builder.append("\n"); } if (line1 != null && !line1.isEmpty()) { builder.append(line1); builder.append("\n"); } if (line2 != null && !line2.isEmpty()) { builder.append(line2); builder.append("\n"); } if (line3 != null && !line3.isEmpty()) { builder.append(line3); builder.append("\n"); } if (city != null && !city.isEmpty()) { builder.append(city); builder.append(", "); } if (state != null && !state.isEmpty()) { builder.append(state); builder.append(" "); } if (zip != null && !zip.isEmpty()) { builder.append(zip); } return builder.toString(); }</code><technical_language>Is class for android builds a localized address string inputs? if exists rolling own. If find something, consider if, for example, state zip missing</technical_language>

Target:
public String toString() { StringBuilder builder = new StringBuilder(); if (locationName != null && !locationName.isEmpty()) { builder.append(locationName); builder.append("\n"); } if (line1 != null && !line1.isEmpty()) { builder.append(line1); builder.append("\n"); } if (line2 != null && !line2.isEmpty()) { builder.append(line2); builder.append("\n"); } if (line3 != null && !line3.isEmpty()) { builder.append(line3); builder.append("\n"); } if (city != null && !city.isEmpty()) { builder.append(city); builder.append(", "); } if (state != null && !state.isEmpty()) { builder.append(state); builder.append(" "); } else if (city != null && !city.isEmpty()) { builder.deleteCharAt(builder.length() - 2); } if (zip != null && !zip.isEmpty()) { builder.append(zip); } return builder.toString(); }
Source:
<code>protected CacheQuery<?> makeCacheQuery(IckleParsingResult<Descriptor> ickleParsingResult, Query luceneQuery, IndexedQueryMode queryMode, Map<String, Object> namedParameters) { IndexingMetadata indexingMetadata = ickleParsingResult.getTargetEntityMetadata().getProcessedAnnotation(IndexingMetadata.INDEXED_ANNOTATION); final Set<String> sortableFields = indexingMetadata != null ? indexingMetadata.getSortableFields() : Collections.emptySet(); IndexedTypeMap<CustomTypeMetadata> queryMetadata = IndexedTypeMaps.singletonMapping(ProtobufValueWrapper.INDEXING_TYPE, () -> sortableFields); RemoteQueryDefinition queryDefinition; if (queryMode == IndexedQueryMode.BROADCAST) { queryDefinition = new RemoteQueryDefinition(ickleParsingResult.getQueryString()); } else { queryDefinition = new RemoteQueryDefinition(getSearchFactory().createHSQuery(luceneQuery, queryMetadata)); } queryDefinition.setNamedParameters(namedParameters); <START> SearchManagerImplementor searchManager = getSearchManager().unwrap(SearchManagerImplementor.class); <END> return searchManager.getQuery(queryDefinition, queryMode, queryMetadata); }</code><technical_language>I getSearchManager().unwrap(SearchManagerImplementor.class) called a times. I this point is modify QueryEngine.getSearchManager() return SearchManagerImplementor do unwrapping time is obtained</technical_language>

Target:
protected CacheQuery<?> makeCacheQuery(IckleParsingResult<Descriptor> ickleParsingResult, Query luceneQuery, IndexedQueryMode queryMode, Map<String, Object> namedParameters) { IndexingMetadata indexingMetadata = ickleParsingResult.getTargetEntityMetadata().getProcessedAnnotation(IndexingMetadata.INDEXED_ANNOTATION); final Set<String> sortableFields = indexingMetadata != null ? indexingMetadata.getSortableFields() : Collections.emptySet(); IndexedTypeMap<CustomTypeMetadata> queryMetadata = IndexedTypeMaps.singletonMapping(ProtobufValueWrapper.INDEXING_TYPE, () -> sortableFields); RemoteQueryDefinition queryDefinition; if (queryMode == IndexedQueryMode.BROADCAST) { queryDefinition = new RemoteQueryDefinition(ickleParsingResult.getQueryString()); } else { queryDefinition = new RemoteQueryDefinition(getSearchFactory().createHSQuery(luceneQuery, queryMetadata)); } queryDefinition.setNamedParameters(namedParameters); return getSearchManager().getQuery(queryDefinition, queryMode, queryMetadata); }
Source:
<code>private static void openUrlExternal(Context context, @NonNull String url) { try { <START> ActivityLauncher.disableDeepLinking(context); <END> Intent intent = new Intent(Intent.ACTION_VIEW, Uri.parse(url)); context.startActivity(intent); AppLockManager.getInstance().setExtendedTimeout(); ActivityLauncher.enableDeepLinking(context); } catch (ActivityNotFoundException e) { String readerToastErrorUrlIntent = context.getString(R.string.reader_toast_err_url_intent); ToastUtils.showToast(context, String.format(readerToastErrorUrlIntent, url), ToastUtils.Duration.LONG); } }</code><technical_language>sense try...finally here, putting enableDeepLinking in finally block. deep linking re-enabled if wrong</technical_language>

Target:
private static void openUrlExternal(Context context, @NonNull String url) { try { WPActivityUtils.disableComponent(context, ReaderPostPagerActivity.class); Intent intent = new Intent(Intent.ACTION_VIEW, Uri.parse(url)); context.startActivity(intent); AppLockManager.getInstance().setExtendedTimeout(); } catch (ActivityNotFoundException e) { String readerToastErrorUrlIntent = context.getString(R.string.reader_toast_err_url_intent); ToastUtils.showToast(context, String.format(readerToastErrorUrlIntent, url), ToastUtils.Duration.LONG); } finally { WPActivityUtils.enableComponent(context, ReaderPostPagerActivity.class); } }
Source:
<code>public void singletonInputSingletonOutput() { Dominoes dominoes = new Dominoes(); Domino[] dominoesList = {new Domino(1, 1)}; <START> ArrayList<Domino> dominoesArray = new ArrayList<>(Arrays.asList(dominoesList)); <END> List<Domino> chain = dominoes.formChain(dominoesArray); assertValidChain(dominoesArray, chain); }</code><technical_language>need this ArrayList anymore simplify this code a bit</technical_language>

Target:
public void singletonInputSingletonOutput() throws ChainNotFoundException { Dominoes dominoes = new Dominoes(); Domino[] dominoesArray = {new Domino(1, 1)}; List<Domino> dominoesList = Arrays.asList(dominoesArray); List<Domino> chain = dominoes.formChain(dominoesList); assertValidChain(dominoesList, chain); }
Source:
<code>public boolean apply(ServerPrivateNetworkRef networkRef) { checkNotNull(networkRef, "ServerPrivateNetworkRef"); PrivateNetwork server = api.serverApi().getPrivateNetwork(networkRef.serverId(), networkRef.privateNetworkId()); if (server.state() != Types.GenericState.ACTIVE) { return false; } else { return true; <START> } <END> }</code><technical_language>return server.state() == Types.GenericState.ACTIVE? Apply this other similar conditionals</technical_language>

Target:
public boolean apply(ServerPrivateNetworkRef networkRef) { checkNotNull(networkRef, "ServerPrivateNetworkRef"); PrivateNetwork server = api.serverApi().getPrivateNetwork(networkRef.serverId(), networkRef.privateNetworkId()); return server.state() != Types.GenericState.ACTIVE; }
Source:
<code>public void testRepositoryNotInitialized() throws Exception { Properties properties = new Properties(); properties.put("spring.cloud.task.tablePrefix", "foobarless"); PropertiesPropertySource propertiesSource = new PropertiesPropertySource("test", properties); this.context = new AnnotationConfigApplicationContext(); this.context.getEnvironment().getPropertySources().addLast(propertiesSource); ((AnnotationConfigApplicationContext)context).register(SimpleTaskConfiguration.class); ((AnnotationConfigApplicationContext)context).register(PropertyPlaceholderAutoConfiguration.class); ((AnnotationConfigApplicationContext)context).register(EmbeddedDataSourceConfiguration.class); boolean wasExceptionThrown = false; try { this.context.refresh(); } catch (ApplicationContextException ex) { <START> assertThat(ex.getMessage(), equalTo("Failed to start bean " + <END> "'taskLifecycleListener'; nested exception is " + "org.springframework.dao.DataAccessResourceFailureException: " + "Could not obtain sequence value; nested exception is " + "org.h2.jdbc.JdbcSQLException: Syntax error in SQL statement " + "\"SELECT FOOBARLESSSEQ.NEXTVAL FROM[*] DUAL \"; expected " + "\"identifier\"; SQL statement:\n" + "select foobarlessSEQ.nextval from dual [42001-193]")); wasExceptionThrown = true; } assertTrue("Expected ApplicationContextException to be thrown", wasExceptionThrown); }</code><technical_language>This feels a brittle validate db initialized. a minimum, want assert full text of exception message control exception</technical_language>

Target:
public void testRepositoryNotInitialized() throws Exception { Properties properties = new Properties(); properties.put("spring.cloud.task.tablePrefix", "foobarless"); PropertiesPropertySource propertiesSource = new PropertiesPropertySource("test", properties); this.context = new AnnotationConfigApplicationContext(); this.context.getEnvironment().getPropertySources().addLast(propertiesSource); ((AnnotationConfigApplicationContext)context).register(SimpleTaskConfiguration.class); ((AnnotationConfigApplicationContext)context).register(PropertyPlaceholderAutoConfiguration.class); ((AnnotationConfigApplicationContext)context).register(EmbeddedDataSourceConfiguration.class); boolean wasExceptionThrown = false; try { this.context.refresh(); } catch (ApplicationContextException ex) { wasExceptionThrown = true; } assertTrue("Expected ApplicationContextException to be thrown", wasExceptionThrown); }
Source:
<code>public void testSolibLinkDefault() throws Exception { setUpCcLinkingContextTest(); scratch.file( "foo/BUILD", "load(' "cc_binary(name='bin',", " deps = [':a'],", ")", "crule(name='a',", " dynamic_library = 'a.so',", " interface_library = 'a.ifso',", ")"); ConfiguredTarget a = getConfiguredTarget(" RuleContext ruleContext = getRuleContext(a); CcToolchainProvider toolchain = CppHelper.getToolchain( ruleContext, ruleContext.getPrerequisite("$cc_toolchain", Mode.TARGET)); StructImpl info = ((StructImpl) getMyInfoFromTarget(a).getValue("info")); SkylarkNestedSet librariesToLink = info.getValue("libraries_to_link", SkylarkNestedSet.class); assertThat( librariesToLink.toCollection(LibraryToLink.class).stream() .filter(x -> x.getDynamicLibrary() != null) <START> .map(x -> x.getDynamicLibrary().getRootRelativePath().relativeTo(toolchain.getSolibDirectory()).toString()) <END> .collect(ImmutableList.toImmutableList())) .containsExactly("_U_S_Sfoo_Ca___Ufoo/a.so"); assertThat( librariesToLink.toCollection(LibraryToLink.class).stream() .filter(x -> x.getInterfaceLibrary() != null) .map(x -> x.getInterfaceLibrary().getRootRelativePath().relativeTo(toolchain.getSolibDirectory()).toString()) .collect(ImmutableList.toImmutableList())) .containsExactly("_U_S_Sfoo_Ca___Ufoo/a.ifso"); }</code><technical_language>nit: refactor x.getDynamicLibrary().getRootRelativePath().relativeTo(toolchain.getSolibDirectory()).toString() a helper private static method, this slightly more readable? (the combination of chained calls of stream() this difficult read)</technical_language>

Target:
public void testSolibLinkDefault() throws Exception { setUpCcLinkingContextTest(); scratch.file( "foo/BUILD", "load(' "cc_binary(name='bin',", " deps = [':a'],", ")", "crule(name='a',", " dynamic_library = 'a.so',", " interface_library = 'a.ifso',", ")"); ConfiguredTarget a = getConfiguredTarget(" RuleContext ruleContext = getRuleContext(a); CcToolchainProvider toolchain = CppHelper.getToolchain( ruleContext, ruleContext.getPrerequisite("$cc_toolchain", Mode.TARGET)); StructImpl info = ((StructImpl) getMyInfoFromTarget(a).getValue("info")); SkylarkNestedSet librariesToLink = info.getValue("libraries_to_link", SkylarkNestedSet.class); assertThat( librariesToLink.toCollection(LibraryToLink.class).stream() .filter(x -> x.getDynamicLibrary() != null) .map(x -> getSolibRelativePath(x.getDynamicLibrary(), toolchain)) .collect(ImmutableList.toImmutableList())) .containsExactly("_U_S_Sfoo_Ca___Ufoo/a.so"); assertThat( librariesToLink.toCollection(LibraryToLink.class).stream() .filter(x -> x.getInterfaceLibrary() != null) .map(x -> getSolibRelativePath(x.getInterfaceLibrary(), toolchain)) .collect(ImmutableList.toImmutableList())) .containsExactly("_U_S_Sfoo_Ca___Ufoo/a.ifso"); }
Source:
<code>public Long allocateTimestamp() { <START> synchronized(status) { <END> Preconditions.checkState(status != TrackerStatus.CLOSED, "tracker is closed"); if ((status == TrackerStatus.IDLE) && (node == null)) { Long initialTs = getTimestamp(); if (node == null) { updateZkNode(initialTs); } } Long ts = getTimestamp(); timestamps.add(ts); status = TrackerStatus.BUSY; return ts; } }</code><technical_language>synchronizing object changes in sync blocks is good</technical_language>

Target:
public synchronized long allocateTimestamp() { Preconditions.checkState(status != TrackerStatus.CLOSED, "tracker is closed"); if ((status == TrackerStatus.IDLE) && (node == null)) { long initialTs = getTimestamp(); if (node == null) { updateZkNode(initialTs); } } long ts = getTimestamp(); timestamps.add(ts); status = TrackerStatus.BUSY; return ts; }
Source:
<code>private void processPartitionedJob(Module module, DeploymentMetadata md, MessageBus bus) { if (logger.isDebugEnabled()) { logger.debug("binding job partitioning channels for " + module); } MessageChannel partitionsOut = module.getComponent(JOB_PARTIONER_REQUEST_CHANNEL, MessageChannel.class); Assert.notNull(partitionsOut, "Partitioned jobs must have a " + JOB_PARTIONER_REQUEST_CHANNEL); MessageChannel partitionsIn = module.getComponent(JOB_PARTIONER_REPLY_CHANNEL, MessageChannel.class); Assert.notNull(partitionsIn, "Partitioned jobs must have a " + JOB_PARTIONER_REPLY_CHANNEL); String name = md.getGroup() + "." + md.getIndex(); bus.bindRequestor(name, partitionsOut, partitionsIn); <START> MessageChannel stepExcutionsIn = module.getComponent(JOB_STEP_EXECUTION_REQUEST_CHANNEL, MessageChannel.class); <END> Assert.notNull(stepExcutionsIn, "Partitioned jobs must have a " + JOB_STEP_EXECUTION_REQUEST_CHANNEL); MessageChannel stepExecutionResultsOut = module.getComponent(JOB_STEP_EXECUTION_REPLY_CHANNEL, MessageChannel.class); Assert.notNull(stepExecutionResultsOut, "Partitioned jobs must have a " + JOB_STEP_EXECUTION_REPLY_CHANNEL); bus.bindReplier(name, stepExcutionsIn, stepExecutionResultsOut); }</code><technical_language>typo: Excution</technical_language>

Target:
private void processPartitionedJob(Module module, DeploymentMetadata md, MessageBus bus) { if (logger.isDebugEnabled()) { logger.debug("binding job partitioning channels for " + module); } MessageChannel partitionsOut = module.getComponent(JOB_PARTIONER_REQUEST_CHANNEL, MessageChannel.class); Assert.notNull(partitionsOut, "Partitioned jobs must have a " + JOB_PARTIONER_REQUEST_CHANNEL); MessageChannel partitionsIn = module.getComponent(JOB_PARTIONER_REPLY_CHANNEL, MessageChannel.class); Assert.notNull(partitionsIn, "Partitioned jobs must have a " + JOB_PARTIONER_REPLY_CHANNEL); String name = md.getGroup() + "." + md.getIndex(); bus.bindRequestor(name, partitionsOut, partitionsIn); MessageChannel stepExecutionsIn = module.getComponent(JOB_STEP_EXECUTION_REQUEST_CHANNEL, MessageChannel.class); Assert.notNull(stepExecutionsIn, "Partitioned jobs must have a " + JOB_STEP_EXECUTION_REQUEST_CHANNEL); MessageChannel stepExecutionResultsOut = module.getComponent(JOB_STEP_EXECUTION_REPLY_CHANNEL, MessageChannel.class); Assert.notNull(stepExecutionResultsOut, "Partitioned jobs must have a " + JOB_STEP_EXECUTION_REPLY_CHANNEL); bus.bindReplier(name, stepExecutionsIn, stepExecutionResultsOut); }
Source:
<code>private Ehcache<String, String> getEhcache(final CacheLoaderWriter<String, String> cacheLoaderWriter) { ExecutorService orderedExecutor = Executors.newSingleThreadExecutor(); ExecutorService unorderedExecutor = Executors.newCachedThreadPool(); cacheEventNotificationService = new CacheEventNotificationServiceImpl<String, String>(orderedExecutor, unorderedExecutor); final Ehcache<String, String> ehcache = new Ehcache<String, String>(CACHE_CONFIGURATION, this.store, cacheLoaderWriter,cacheEventNotificationService,null, LoggerFactory.getLogger(Ehcache.class + "-" + "EhcacheBasicPutAllEventsTest")); ehcache.init(); assertThat("cache not initialized", ehcache.getStatus(), is(Status.AVAILABLE)); <START> this.spiedResilienceStrategy = this.setResilienceStrategySpy(ehcache); <END> EhcacheBasicTestUtil.registerCacheEventListener(ehcache, testCacheEventListener); return ehcache; }</code><technical_language>is resilience strategy needed</technical_language>

Target:
private Ehcache<String, String> getEhcache(final CacheLoaderWriter<String, String> cacheLoaderWriter) { ExecutorService orderedExecutor = Executors.newSingleThreadExecutor(); ExecutorService unorderedExecutor = Executors.newCachedThreadPool(); cacheEventNotificationService = new CacheEventNotificationServiceImpl<String, String>(orderedExecutor, unorderedExecutor); final Ehcache<String, String> ehcache = new Ehcache<String, String>(CACHE_CONFIGURATION, this.store, cacheLoaderWriter,cacheEventNotificationService,null, LoggerFactory.getLogger(Ehcache.class + "-" + "EhcacheBasicPutAllEventsTest")); ehcache.init(); assertThat("cache not initialized", ehcache.getStatus(), is(Status.AVAILABLE)); registerCacheEventListener(ehcache, cacheEventListener); return ehcache; }
Source:
<code>private void reportIssueIfNotInExcludedContext(Tree tree, String recommendedType) { Tree current = tree.parent(); boolean foundClass = false; while (!foundClass) { switch (current.kind()) { case LAMBDA_EXPRESSION: case SYNCHRONIZED_STATEMENT: return; case METHOD: if (ModifiersUtils.hasModifier(((MethodTree) current).modifiers(), Modifier.SYNCHRONIZED)) { return; } break; case CLASS: if (((ClassTree) current).simpleName() == null) { <START> return; <END> } foundClass = true; break; } current = current.parent(); } reportIssue(tree, String.format("Use an \"%s\" for this field; its operations are atomic.", recommendedType)); }</code><technical_language>if a corner case, ENUM: java enum A { FOO, BAR; volatile int value; void doSomething() { value++; } } I if is other cases... If hit of ones, a NPE line 122. returning reaching COMPILATION_UNIT, in case missed a case? kind implementing ClassTree</technical_language>

Target:
private void reportIssueIfNotInExcludedContext(Tree tree, String recommendedType) { Tree current = tree.parent(); boolean foundClass = false; while (!foundClass) { switch (current.kind()) { case LAMBDA_EXPRESSION: case SYNCHRONIZED_STATEMENT: case COMPILATION_UNIT: return; case METHOD: if (ModifiersUtils.hasModifier(((MethodTree) current).modifiers(), Modifier.SYNCHRONIZED)) { return; } break; case ENUM: case CLASS: if (((ClassTree) current).simpleName() == null) { return; } foundClass = true; break; } current = current.parent(); } reportIssue(tree, String.format("Use an \"%s\" for this field; its operations are atomic.", recommendedType)); }
Source:
<code><START> private void printJson(HttpServletResponse response, String finalLocation) throws IOException { <END> response.setStatus(HttpServletResponse.SC_OK); response.setContentType("application/json"); response.setHeader("Location", finalLocation); PrintWriter writer = response.getWriter(); writer.write("{\"location\": \""); writer.write(finalLocation); writer.write("\"}"); writer.close(); }</code><technical_language>this function protected? This allow extensions users</technical_language>

Target:
protected void printJson(HttpServletResponse response, String finalLocation) throws IOException { response.setStatus(HttpServletResponse.SC_OK); response.setContentType("application/json"); response.setHeader("Location", finalLocation); PrintWriter writer = response.getWriter(); writer.write("{\"location\": \""); writer.write(finalLocation); writer.write("\"}"); writer.close(); }
Source:
<code>private static void stow(StowRS instance, Attributes metadata, List<String> files) throws Exception { OutputStream out = null; try { URL newUrl = new URL(instance.URL); final HttpURLConnection connection = (HttpURLConnection) newUrl.openConnection(); connection.setDoOutput(true); connection.setDoInput(true); connection.setRequestMethod("POST"); connection.setRequestProperty("Content-Type", "multipart/related; type=" + instance.contentType + "; boundary=" + boundary); connection.setRequestProperty("Accept", instance.accept); logOutgoing(connection); if (instance.user != null) { String basicAuth = basicAuth(instance.user); LOG.info("> Authorization: " + basicAuth); connection.setRequestProperty("Authorization", basicAuth); } out = connection.getOutputStream(); out.write(("\r\n--" + boundary + "\r\n").getBytes()); out.write(("Content-Type: " + instance.contentType + "\r\n").getBytes()); out.write("\r\n".getBytes()); writeData(instance, metadata, files, out); out.write(("\r\n--" + boundary + "--\r\n").getBytes()); out.flush(); logIncoming(connection); connection.disconnect(); LOG.info("STOW successful!"); } catch (Exception e) { <START> LOG.error("Exception : " + e.getMessage()); <END> e.printStackTrace(); } finally { if (out != null) out.close(); } }</code><technical_language>LOG.error("Exception STOW", e); automatically print stack trace do manually</technical_language>

Target:
private static void stow(StowRS instance, Attributes metadata, List<String> files) throws Exception { OutputStream out = null; try { URL newUrl = new URL(instance.URL); final HttpURLConnection connection = (HttpURLConnection) newUrl.openConnection(); connection.setDoOutput(true); connection.setDoInput(true); connection.setRequestMethod("POST"); connection.setRequestProperty("Content-Type", "multipart/related; type=" + instance.contentType + "; boundary=" + boundary); connection.setRequestProperty("Accept", instance.accept); logOutgoing(connection); if (instance.user != null) { String basicAuth = basicAuth(instance.user); LOG.info("> Authorization: " + basicAuth); connection.setRequestProperty("Authorization", basicAuth); } out = connection.getOutputStream(); out.write(("\r\n--" + boundary + "\r\n").getBytes()); out.write(("Content-Type: " + instance.contentType + "\r\n").getBytes()); out.write("\r\n".getBytes()); writeData(instance, metadata, files, out); out.write(("\r\n--" + boundary + "--\r\n").getBytes()); out.flush(); logIncoming(connection); connection.disconnect(); LOG.info("STOW successful!"); } catch (Exception e) { LOG.error("Stow: ", e); } finally { if (out != null) out.close(); } }
Source:
<code>private void unregisterNotification(SensorListener sensorListener) { if (sensorListener.getXdk().isConnected()) { switch (sensorListener.getSensorType()) { <START> case "ACCELERATION_X": <END> unregisterSensorNotification(sensorListener); break; case "ACCELERATION_Y": unregisterSensorNotification(sensorListener); break; case "ACCELERATION_Z": unregisterSensorNotification(sensorListener); break; case "GYROSCOPE_X": unregisterSensorNotification(sensorListener); break; case "GYROSCOPE_Y": unregisterSensorNotification(sensorListener); break; case "GYROSCOPE_Z": unregisterSensorNotification(sensorListener); break; case "LIGHT": unregisterSensorNotification(sensorListener); break; case "PRESSURE": unregisterSensorNotification(sensorListener); break; case "TEMPERATURE": unregisterSensorNotification(sensorListener); break; case "HUMIDITY": unregisterSensorNotification(sensorListener); break; case "SD_CARD_DETECT_STATUS": unregisterSensorNotification(sensorListener); break; case "BUTTON_STATUS": unregisterSensorNotification(sensorListener); break; case "MAGNETIC_X": unregisterSensorNotification(sensorListener); break; case "MAGNETIC_Y": unregisterSensorNotification(sensorListener); break; case "MAGNETIC_Z": unregisterSensorNotification(sensorListener); break; case "MAGNETOMETER_RESISTENCE": unregisterSensorNotification(sensorListener); break; case "LED_STATUS": unregisterSensorNotification(sensorListener); break; case "VOLTAGE_LEM": unregisterSensorNotification(sensorListener); break; default: } } else { logger.info("Listener unregistation failed: TiSensorTag not connected"); } }</code><technical_language>verify if this switch statement is necessary here</technical_language>

Target:
private void unregisterNotification(SensorListener sensorListener) { if (sensorListener.getXdk().isConnected()) { unregisterSensorNotification(sensorListener); } else { logger.info("Listener unregistation failed: TiSensorTag not connected"); } }
Source:
<code>private static String constructorName(TypeTree typeTree) { if (typeTree.is(Tree.Kind.PARAMETERIZED_TYPE)) { return constructorName(((ParameterizedTypeTree) typeTree).type()); } else if (typeTree.is(Tree.Kind.MEMBER_SELECT)) { return ((MemberSelectExpressionTree) typeTree).identifier().name(); } else { <START> return ((IdentifierTree) typeTree).name(); <END> } }</code><technical_language>trade I trade ClassCastException uncovered case (that throw IllegalStateException )</technical_language>

Target:
private static String constructorName(TypeTree typeTree) { switch (typeTree.kind()) { case PARAMETERIZED_TYPE: return constructorName(((ParameterizedTypeTree) typeTree).type()); case MEMBER_SELECT: return ((MemberSelectExpressionTree) typeTree).identifier().name(); case IDENTIFIER: return ((IdentifierTree) typeTree).name(); default: throw new IllegalStateException("Unexpected TypeTree used as constructor."); } }
Source:
<code>private static void modifyCassandraRackdc( @NotNull final Marker taskIdMarker, @NotNull final String version, @NotNull final CassandraServerConfig serverConfig ) throws IOException { LOGGER.info(taskIdMarker, "Building cassandra-rackdc.properties"); final Properties props = new Properties(); <START> RackDc rackDc = serverConfig.getRackDc(); <END> props.put("dc", rackDc.getDc()); props.put("rack", rackDc.getRack()); final File cassandraRackDc = new File("apache-cassandra-" + version + "/conf/cassandra-rackdc.properties"); try (BufferedWriter bw = new BufferedWriter(new FileWriter(cassandraRackDc))) { props.store(bw, "Created by Apache Mesos Cassandra framework"); } }</code><technical_language>Please this final</technical_language>

Target:
private static void modifyCassandraRackdc( @NotNull final Marker taskIdMarker, @NotNull final String version, @NotNull final CassandraServerConfig serverConfig ) throws IOException { LOGGER.info(taskIdMarker, "Building cassandra-rackdc.properties"); final Properties props = new Properties(); final RackDc rackDc = serverConfig.getRackDc(); props.put("dc", rackDc.getDc()); props.put("rack", rackDc.getRack()); final File cassandraRackDc = new File("apache-cassandra-" + version + "/conf/cassandra-rackdc.properties"); try (BufferedWriter bw = new BufferedWriter(new FileWriter(cassandraRackDc))) { props.store(bw, "Created by Apache Mesos Cassandra framework"); } }
Source:
<code>public boolean isSuccessful() { <START> return false; <END> }</code><technical_language>is this unsuccessful</technical_language>

Target:
public boolean isSuccessful() { return true; }
Source:
<code>@Override public void run(JsonNode jsonNode) { IgniteCache<Integer, Integer> cache = ignite.getOrCreateCache(jsonNode.get("cacheName").asText()); int warmup = jsonNode.get("warmup").asInt(); int key = 0; int cnt = 0; long initTime = 0; long maxLatency = -1; boolean record = false; while (!terminated()) { cnt++; long start = System.currentTimeMillis(); cache.put(key++ % 100, key); <START> long latency = System.currentTimeMillis() - start; <END> if (!record && cnt > warmup) { record = true; initTime = System.currentTimeMillis(); markInitialized(); } if (record) { if (maxLatency < latency) maxLatency = latency; } if (cnt % 1000 == 0) log.info("APPLICATION_STREAMED " + cnt + " transactions [max=" + maxLatency + "]"); } recordResult("WORST_LATENCY", maxLatency); recordResult("STREAMED", cnt - warmup); recordResult("MEASURE_DURATION", System.currentTimeMillis() - initTime); markFinished(); }</code><technical_language>I hesitate insist, System.nanoTime() is option</technical_language>

Target:
@Override public void run(JsonNode jsonNode) { IgniteCache<Integer, Integer> cache = ignite.getOrCreateCache(jsonNode.get("cacheName").asText()); int warmup = jsonNode.get("warmup").asInt(); int key = 0; int cnt = 0; long initTime = 0; long maxLatency = -1; boolean record = false; while (!terminated()) { cnt++; long from = System.nanoTime(); cache.put(key++ % 100, key); long latency = System.nanoTime() - from; if (!record && cnt > warmup) { record = true; initTime = System.currentTimeMillis(); markInitialized(); } if (record) { if (maxLatency < latency) maxLatency = latency; } if (cnt % 1000 == 0) log.info("APPLICATION_STREAMED " + cnt + " transactions [max=" + maxLatency + "]"); } recordResult("WORST_LATENCY", Duration.ofNanos(maxLatency).toMillis()); recordResult("STREAMED", cnt - warmup); recordResult("MEASURE_DURATION", System.currentTimeMillis() - initTime); markFinished(); }
Source:
<code><R> R performOperation(Function<S, ? extends R> function, ResultsAccumulator<R> remoteResults, Predicate<? super R> earlyTerminatePredicate) { ConsistentHash ch = dm.getConsistentHash(); TerminalOperation<R> op = new SingleRunOperation<>(intermediateOperations, supplierForSegments(ch, segmentsToFilter, null), function); UUID id = csm.remoteStreamOperation(getParallelDistribution(), parallel, ch, segmentsToFilter, keysToFilter, Collections.emptyMap(), includeLoader, op, remoteResults, earlyTerminatePredicate); try { R localValue = op.performOperation(); remoteResults.onCompletion(null, Collections.emptySet(), localValue); try { if ((earlyTerminatePredicate == null || !earlyTerminatePredicate.test(localValue)) && !csm.awaitCompletion(id, timeout, timeoutUnit)) { <START> new TimeoutException(); <END> } } catch (InterruptedException e) { throw new CacheException(e); } log.tracef("Finished operation for id %s", id); return remoteResults.currentValue; } finally { csm.forgetOperation(id); } }</code><technical_language>thrown</technical_language>

Target:
<R> R performOperation(Function<S, ? extends R> function, ResultsAccumulator<R> remoteResults, Predicate<? super R> earlyTerminatePredicate) { ConsistentHash ch = dm.getConsistentHash(); TerminalOperation<R> op = new SingleRunOperation<>(intermediateOperations, supplierForSegments(ch, segmentsToFilter, null), function); UUID id = csm.remoteStreamOperation(getParallelDistribution(), parallel, ch, segmentsToFilter, keysToFilter, Collections.emptyMap(), includeLoader, op, remoteResults, earlyTerminatePredicate); try { R localValue = op.performOperation(); remoteResults.onCompletion(null, Collections.emptySet(), localValue); try { if ((earlyTerminatePredicate == null || !earlyTerminatePredicate.test(localValue)) && !csm.awaitCompletion(id, timeout, timeoutUnit)) { throw new TimeoutException(); } } catch (InterruptedException e) { throw new CacheException(e); } log.tracef("Finished operation for id %s", id); return remoteResults.currentValue; } finally { csm.forgetOperation(id); } }
Source:
<code>public void refreshLightWeightData() { <START> log.info("Refreshing Gluster Data [lightweight]"); <END> List<VDSGroup> clusters = getClusterDao().getAll(); for (VDSGroup cluster : clusters) { if (cluster.supportsGlusterService()) { log.debugFormat("Refreshing Gluter Data for cluster {0}", cluster.getname()); refreshClusterData(cluster); } } }</code><technical_language>this written 5 sec (by default) i in debug</technical_language>

Target:
public void refreshLightWeightData() { log.debug("Refreshing Gluster Data [lightweight]"); List<VDSGroup> clusters = getClusterDao().getAll(); for (VDSGroup cluster : clusters) { if (cluster.supportsGlusterService()) { log.debugFormat("Refreshing Gluter Data for cluster {0}", cluster.getname()); refreshClusterData(cluster); } } }
Source:
<code>public void removeIfDone() <START> throws IOException { <END> if (isGenAvailableNowForCurrentSearcher()) { if (!isCancelled()) { notDoneNrtFutures.remove(this); set(null); } } }</code><technical_language>Unnecessary? I in body throws IOException</technical_language>

Target:
void removeIfDone() { if (isGenAvailableNowForCurrentSearcher()) { notDoneNrtFutures.remove(this); if (!isCancelled()) { set(null); } } }
Source:
<code>private boolean updateGroupDescription(PerunSession sess, Group groupWithOldDescription, CandidateGroup groupWithNewDescription) throws InternalErrorException { <START> if(groupWithOldDescription.getDescription() != null) { <END> if(!groupWithOldDescription.getDescription().equals(groupWithNewDescription.asGroup().getDescription())){ groupWithOldDescription.setDescription(groupWithNewDescription.asGroup().getDescription()); groupsManagerImpl.updateGroup(sess, groupWithOldDescription); return true; } } else if(groupWithNewDescription.asGroup().getDescription() != null){ groupWithOldDescription.setDescription(groupWithNewDescription.asGroup().getDescription()); groupsManagerImpl.updateGroup(sess, groupWithOldDescription); return true; } return false; }</code><technical_language>IMPL version of method updateGroup, is missing auditer log information this change</technical_language>

Target:
private boolean updateGroupDescription(PerunSession sess, Group groupWithOldDescription, CandidateGroup groupWithNewDescription) throws InternalErrorException { if(groupWithOldDescription.getDescription() != null) { if(!groupWithOldDescription.getDescription().equals(groupWithNewDescription.asGroup().getDescription())){ groupWithOldDescription.setDescription(groupWithNewDescription.asGroup().getDescription()); groupsManagerImpl.updateGroup(sess, groupWithOldDescription); getPerunBl().getAuditer().log(sess, new GroupUpdated(groupWithOldDescription)); return true; } } else if(groupWithNewDescription.asGroup().getDescription() != null){ groupWithOldDescription.setDescription(groupWithNewDescription.asGroup().getDescription()); groupsManagerImpl.updateGroup(sess, groupWithOldDescription); getPerunBl().getAuditer().log(sess, new GroupUpdated(groupWithOldDescription)); return true; } return false; }
Source:
<code>public boolean process(final ZigBeeApi zigbeeApi, final String[] args) { final List<ZigBeeNode> nodes = zigbeeApi.getNodes(); for (int i = 0; i < nodes.size(); i++) { final ZigBeeNode node = nodes.get(i); print("IEEE Address : " + node.getIeeeAddress()); <START> print("Network Address : " + String.format("%04X", node.getNetworkAddress())); <END> ZigBeeNodeDescriptor nodeDescriptor = node.getNodeDescriptor(); if(nodeDescriptor != null) { print("Node Descriptor : Logical Type " + nodeDescriptor.getLogicalType()); print(" : Manufacturer Code " + String.format("%04X", nodeDescriptor.getManufacturerCode())); print(" : Max Buffer Size " + nodeDescriptor.getMaximumBufferSize()); print(" : Max Transfer Size " + nodeDescriptor.getMaximumTransferSize()); } ZigBeeNodePowerDescriptor powerDescriptor = node.getPowerDescriptor(); if(powerDescriptor != null) { print("Power Descriptor : Power Mode " + powerDescriptor.getPowerMode()); print(" : Power Source " + powerDescriptor.getPowerSource()); print(" : Power Level " + powerDescriptor.getPowerLevel()); print(" : Power Available " + powerDescriptor.getPowerSourcesAvailable()); } print("-"); } return true; }</code><technical_language>This displays in hexadecimal else is in decimal. prefer hex, else is decimal I think</technical_language>

Target:
public boolean process(final ZigBeeApi zigbeeApi, final String[] args) { final List<ZigBeeNode> nodes = zigbeeApi.getNodes(); for (int i = 0; i < nodes.size(); i++) { final ZigBeeNode node = nodes.get(i); print("IEEE Address : " + node.getIeeeAddress()); print("Network Address : #" + node.getNetworkAddress()); ZigBeeNodeDescriptor nodeDescriptor = node.getNodeDescriptor(); if(nodeDescriptor != null) { print("Node Descriptor : Logical Type " + nodeDescriptor.getLogicalType()); print(" : Manufacturer Code " + String.format("%04X", nodeDescriptor.getManufacturerCode())); print(" : Max Buffer Size " + nodeDescriptor.getMaximumBufferSize()); print(" : Max Transfer Size " + nodeDescriptor.getMaximumTransferSize()); print(" : MAC Capabilities " + nodeDescriptor.getMacCapabilities()); print(" : Server Mask " + nodeDescriptor.getServerMask()); } ZigBeeNodePowerDescriptor powerDescriptor = node.getPowerDescriptor(); if(powerDescriptor != null) { print("Power Descriptor : Power Mode " + powerDescriptor.getPowerMode()); print(" : Power Source " + powerDescriptor.getPowerSource()); print(" : Power Level " + powerDescriptor.getPowerLevel()); print(" : Power Available " + powerDescriptor.getPowerSourcesAvailable()); } print("-"); } return true; }
Source:
<code>public boolean hasPatchPermission(Authentication authentication, Serializable targetId, String targetType, Patch patch) { if (!hasPermission(authentication, targetId, targetType, "WRITE")) { return false; } List<Operation> operations = patch.getOperations(); for (Operation op: operations) { <START> if (op.getPath().contentEquals(EPersonOperationFactory.OPERATION_PASSWORD_CHANGE)) { <END> return true; } } return false; }</code><technical_language>careful here. This "if of operations is PASSWORD_CHANGED, allow complete patch operation". I think: "if of operations is PASSWORD_CHANGED, refuse complete patch operation"</technical_language>

Target:
public boolean hasPatchPermission(Authentication authentication, Serializable targetId, String targetType, Patch patch) { if (!hasPermission(authentication, targetId, targetType, "WRITE")) { return false; } List<Operation> operations = patch.getOperations(); for (Operation op: operations) { if (!op.getPath().contentEquals(EPersonOperationFactory.OPERATION_PASSWORD_CHANGE)) { return false; } } return true; }