auphong2707/dl4se-code-review-dataset huggingface dataset:
Source:
<code>public JSONObject schemaFor(final Object event) { if (event instanceof String) { return new JSONObject().put("type", "string"); } else if (event instanceof Integer) { return new JSONObject().put("type", "number"); } else if (event instanceof Boolean) { return new JSONObject().put("type", "boolean"); } else if (event == JSONObject.NULL) { return new JSONObject().put("type", "null"); } else if (event instanceof JSONArray) { <START> return schemaFor((JSONArray) event); <END> } else { return schemaFor((JSONObject) event); } }</code><technical_language>this code called</technical_language>

Target:
public JSONObject schemaFor(final Object event) { if (event instanceof String) { return new JSONObject().put("type", "string"); } else if (event instanceof Integer || event instanceof Double) { return new JSONObject().put("type", "number"); } else if (event instanceof Boolean) { return new JSONObject().put("type", "boolean"); } else if (event == JSONObject.NULL) { return new JSONObject().put("type", "null"); } else if (event instanceof JSONArray) { return schemaFor((JSONArray) event); } else { return schemaFor((JSONObject) event); } }
Source:
<code>private void updateSkinOthers() { this.offer(Keys.VANISH, true); <START> Sponge.getScheduler().createTaskBuilder().execute(() -> this.offer(Keys.VANISH, false)).delayTicks(1).submit(SpongeImpl.getPlugin()); <END> }</code><technical_language>If player vanished a plugin</technical_language>

Target:
private void updateSkinOthers() { if (!this.isDead && !this.get(Keys.VANISH).get()) { this.offer(Keys.VANISH, true); this.runDelay(2, () -> this.offer(Keys.VANISH, false)); } }
Source:
<code>private FeatureFlag findFlag(final String flagName) { for (final FeatureFlag flag : featureFlags) { if (flagName.equalsIgnoreCase(flag.getName())) { return flag; } } <START> return null; <END> }</code><technical_language>Optional</technical_language>

Target:
private Optional<FeatureFlag> findFlag(final String flagName) { return featureFlags.stream().filter(f -> flagName.equalsIgnoreCase(f.getName())).findAny(); }
Source:
<code>public void onRegisterItems(final RegistryEvent.Register<Item> event) { <START> registerItem(event, CacheBlocks.WOOD); <END> registerItem(event, CacheBlocks.IRON); registerItem(event, CacheBlocks.GOLD); registerItem(event, CacheBlocks.DIAMOND); registerItem(event, CacheBlocks.NETHER); registerItem(event, CacheBlocks.ENDER); }</code><technical_language>Store registry in a local variable pass registerItem instead</technical_language>

Target:
public void onRegisterItems(final RegistryEvent.Register<Item> event) { final IForgeRegistry<Item> registry = event.getRegistry(); registerItem(registry, CacheBlocks.WOOD); registerItem(registry, CacheBlocks.IRON); registerItem(registry, CacheBlocks.GOLD); registerItem(registry, CacheBlocks.DIAMOND); registerItem(registry, CacheBlocks.NETHER); registerItem(registry, CacheBlocks.ENDER); }
Source:
<code>private Object readResolve() { if (parameters == null) { <START> parameters = Collections.emptyList(); <END> } if (build != null) OldDataMonitor.report(build, "1.283"); if (safeParameters == null) { safeParameters = Collections.emptySet(); } return this; }</code><technical_language>removed final, immutable * Returns empty list (immutable). This list is serializable</technical_language>

Target:
private Object readResolve() { wasInitializedWithNullParameters = parameters == null; if (parameters == null) { parameters = Collections.emptyList(); } if (build != null) OldDataMonitor.report(build, "1.283"); if (safeParameters == null) { safeParameters = Collections.emptySet(); } return this; }
Source:
<code>protected void startMonitoring() { if (fThread == null) { fThread = new Thread(() -> read(), DebugCoreMessages.OutputStreamMonitor_label); fThread.setDaemon(true); fThread.setPriority(Thread.MIN_PRIORITY); fThread.start(); <START> boolean reading = checkReading(MAX_WAIT_TIME_FOR_START_READING); <END> if (!reading && DebugOptions.DEBUG) { DebugOptions.trace("OutputStreamMonitor::startMonitoring() was unable to start reading stream after " + MAX_WAIT_TIME_FOR_START_READING + " ms."); } } }</code><technical_language>I feel this a VM parameter default some seconds (e.g. 10)? For tests a good idea a high value, for production good idea</technical_language>

Target:
protected void startMonitoring() { if (fThread == null) { fThread = new Thread((Runnable) () -> read(), DebugCoreMessages.OutputStreamMonitor_label); fThread.setDaemon(true); fThread.setPriority(Thread.MIN_PRIORITY); fThread.start(); } }
Source:
<code>void reset(boolean isShutdown) { <START> logger.info("Resetting CallbackHandler: " + this.toString()); <END> try { _ready = false; synchronized (this) { if (_batchCallbackProcessor != null) { if (isShutdown) { _batchCallbackProcessor.shutdown(); _batchCallbackProcessor = null; } else { _batchCallbackProcessor.resetEventQueue(); } } } NotificationContext changeContext = new NotificationContext(_manager); changeContext.setType(NotificationContext.Type.FINALIZE); changeContext.setChangeType(_changeType); invoke(changeContext); } catch (Exception e) { String msg = "Exception while resetting the listener:" + _listener; ZKExceptionHandler.getInstance().handle(msg, e); } }</code><technical_language>include isShutdown in log</technical_language>

Target:
void reset(boolean isShutdown) { logger.info("Resetting CallbackHandler: {}. Is resetting for shutdown: {}.", this.toString(), isShutdown); try { _ready = false; synchronized (this) { if (_batchCallbackProcessor != null) { if (isShutdown) { _batchCallbackProcessor.shutdown(); _batchCallbackProcessor = null; } else { _batchCallbackProcessor.resetEventQueue(); } } } NotificationContext changeContext = new NotificationContext(_manager); changeContext.setType(NotificationContext.Type.FINALIZE); changeContext.setChangeType(_changeType); invoke(changeContext); } catch (Exception e) { String msg = "Exception while resetting the listener:" + _listener; ZKExceptionHandler.getInstance().handle(msg, e); } }
Source:
<code>private <START> synchronized Map<Integer, <END> double[]> initSeries(TimeQueryFilter filter) { if (!(filter instanceof SelectionTimeQueryFilter)) { return Collections.emptyMap(); } Map<Integer, double[]> map = new HashMap<>(); int length = filter.getTimesRequested().length; for (Long id : ((SelectionTimeQueryFilter) filter).getSelectedItems()) { Integer quark = fIdToQuark.get(id); if (quark != null) { map.put(quark, new double[length]); } } return map; }</code><technical_language>synchronized a method synchronizes "this" object. synchronized synchronized(fQuarkToString) independent</technical_language>

Target:
private Map<Integer, double[]> initSeries(TimeQueryFilter filter) { if (!(filter instanceof SelectionTimeQueryFilter)) { return Collections.emptyMap(); } fLock.readLock().lock(); try { Map<Integer, double[]> map = new HashMap<>(); int length = filter.getTimesRequested().length; for (Long id : ((SelectionTimeQueryFilter) filter).getSelectedItems()) { Integer quark = fIdToQuark.get(id); if (quark != null) { map.put(quark, new double[length]); } } return map; } finally { fLock.readLock().unlock(); } }
Source:
<code>public void draw(Canvas canvas, CharSequence text, int start, int end, float x, int top, int y, int bottom, Paint paint) { <START> Drawable b = <END> getDrawable(); canvas.save(); int transY = bottom - b.getBounds().bottom; transY -= paint.getFontMetricsInt().descent * lineSpacingMultiplier; canvas.translate(x, transY); b.draw(canvas); canvas.restore(); }</code><technical_language>b stand for here</technical_language>

Target:
public void draw(Canvas canvas, CharSequence text, int start, int end, float x, int top, int y, int bottom, Paint paint) { Drawable drawable = getDrawable(); canvas.save(); int transY = bottom - drawable.getBounds().bottom; transY -= paint.getFontMetricsInt().descent * lineSpacingMultiplier; canvas.translate(x, transY); drawable.draw(canvas); canvas.restore(); }
Source:
<code><START> public void testByteArrayStrippedLockTx() throws InterruptedException, TimeoutException, ExecutionException { <END> doTest(CacheName.STRIPPED_LOCK_TX); }</code><technical_language>Nitpicking: declare Exception</technical_language>

Target:
public void testByteArrayStrippedLockTx() throws Exception { doTest(CacheName.STRIPPED_LOCK_TX); }
Source:
<code><START> public Collection<ConstraintCheckIssue> checkMethod(ExecutableElement currentMethod) { <END> if ( !needToPerformAnyChecks( currentMethod ) ) { return Collections.emptySet(); } TypeElement currentTypeElement = getEnclosingTypeElement( currentMethod ); if ( isJavaLangObjectOrNull( currentTypeElement ) ) { return Collections.emptySet(); } Map<Boolean, List<ExecutableElement>> overriddenMethods = findAllOverriddenElements( currentTypeElement, currentMethod ); if ( overriddenMethods.get( Boolean.TRUE ).isEmpty() && overriddenMethods.get( Boolean.FALSE ).isEmpty() ) { return Collections.emptySet(); } Set<ConstraintCheckIssue> errors = CollectionHelper.newHashSet(); for ( ExecutableElement firstExecutable : overriddenMethods.get( Boolean.TRUE ) ) { if ( !checkOverriddenMethod( currentMethod, firstExecutable ) ) { return CollectionHelper.asSet( ConstraintCheckIssue.error( currentMethod, null, getErrorMessageKey(), getEnclosingTypeElementQualifiedName( firstExecutable ) ) ); } for ( ExecutableElement secondExecutable : overriddenMethods.get( Boolean.TRUE ) ) { if ( firstExecutable.equals( secondExecutable ) ) { continue; } if ( !checkOverriddenMethod( firstExecutable, secondExecutable ) ) { errors.add( ConstraintCheckIssue.error( currentMethod, null, getErrorMessageKey(), getEnclosingTypeElementQualifiedName( secondExecutable ) ) ); } } } if ( !errors.isEmpty() ) { return errors; } for ( ExecutableElement overriddenMethod : overriddenMethods.get( Boolean.FALSE ) ) { if ( !checkOverriddenMethod( currentMethod, overriddenMethod ) ) { return CollectionHelper.asSet( ConstraintCheckIssue.error( currentMethod, null, getErrorMessageKey(), getEnclosingTypeElementQualifiedName( overriddenMethod ) ) ); } } return Collections.emptySet(); }</code><technical_language>this implemented in abstract method. I suspect logic totally parameters return values</technical_language>

Target:
public Collection<ConstraintCheckIssue> checkMethod(ExecutableElement currentMethod) { if ( !needToPerformAnyChecks( currentMethod ) ) { return Collections.emptySet(); } TypeElement currentTypeElement = getEnclosingTypeElement( currentMethod ); if ( isJavaLangObjectOrNull( currentTypeElement ) ) { return Collections.emptySet(); } InheritanceTree overriddenMethodsTree = findAllOverriddenElements( currentTypeElement, currentMethod ); if ( !overriddenMethodsTree.hasOverriddenMethods() ) { return Collections.emptySet(); } return checkMethodInternal( currentMethod, overriddenMethodsTree ); }
Source:
<code>public HandleStatus handle(final MessageReference ref) throws Exception { if (filter != null && !filter.match(ref.getMessage())) { return HandleStatus.NO_MATCH; } synchronized (this) { if (!active || !session.isWritable(this)) { if (logger.isDebugEnabled()) { logger.debug(this + "::Ignoring reference on bridge as it is set to inactive ref=" + ref); } return HandleStatus.BUSY; } if (blockedOnFlowControl) { return HandleStatus.BUSY; } if (deliveringLargeMessage) { return HandleStatus.BUSY; } if (logger.isTraceEnabled()) { logger.trace("Bridge " + this + " is handling reference=" + ref); } ref.handled(); synchronized (refs) { refs.put(ref.getMessage().getMessageID(), ref); } final SimpleString dest; if (forwardingAddress != null) { dest = forwardingAddress; } else { dest = ref.getMessage().getAddressSimpleString(); } final Message message = beforeForward(ref.getMessage(), dest); pendingAcks.countUp(); <START> metrics.incrementEnqueueCount(); <END> try { if (message.isLargeMessage()) { deliveringLargeMessage = true; deliverLargeMessage(dest, ref, (LargeServerMessage) message); return HandleStatus.HANDLED; } else { return deliverStandardMessage(dest, ref, message); } } catch (Exception e) { pendingAcks.countDown(); throw e; } } }</code><technical_language>I chance explain in other PRs related metrics collection: if metrics updated a single thread/writer, instead of AtomicLong::incrementAndGet AtomicLong::lazySet(AtomicLong::get() + delta) pov of metrics collections a lot expensive. visible in tests laptop HW real servers, especially NUMA (and multi socket) configuration. I if case, cost change that, I suggest do right is do it</technical_language>

Target:
public HandleStatus handle(final MessageReference ref) throws Exception { if (filter != null && !filter.match(ref.getMessage())) { return HandleStatus.NO_MATCH; } synchronized (this) { if (!active || !session.isWritable(this)) { if (logger.isDebugEnabled()) { logger.debug(this + "::Ignoring reference on bridge as it is set to inactive ref=" + ref); } return HandleStatus.BUSY; } if (blockedOnFlowControl) { return HandleStatus.BUSY; } if (deliveringLargeMessage) { return HandleStatus.BUSY; } if (logger.isTraceEnabled()) { logger.trace("Bridge " + this + " is handling reference=" + ref); } ref.handled(); synchronized (refs) { refs.put(ref.getMessage().getMessageID(), ref); } final SimpleString dest; if (forwardingAddress != null) { dest = forwardingAddress; } else { dest = ref.getMessage().getAddressSimpleString(); } final Message message = beforeForward(ref.getMessage(), dest); pendingAcks.countUp(); try { final HandleStatus status; if (message.isLargeMessage()) { deliveringLargeMessage = true; deliverLargeMessage(dest, ref, (LargeServerMessage) message); status = HandleStatus.HANDLED; } else { status = deliverStandardMessage(dest, ref, message); } if (status == HandleStatus.HANDLED) { metrics.incrementMessagesPendingAcknowledgement(); } return status; } catch (Exception e) { pendingAcks.countDown(); throw e; } } }
Source:
<code>protected Bitmap doInBackground(File... params) { <START> return rescaleBackgroundImage(loadImageFromPath(params[0])); <END> }</code><technical_language>determine dominant colours, right</technical_language>

Target:
protected Bitmap doInBackground(File... params) { if (files == null || files.isEmpty()) { return null; } else { return rescaleBackgroundImage(loadImageFromPath(params[0])); } }
Source:
<code>protected UnitVmModel createModel(VmModelBehaviorBase behavior) { UnitVmModel model = new UnitVmModel(behavior) { @Override public EntityModel<Boolean> getIsSingleQxlEnabled() { return new EntityModel<Boolean>(true); } VDSGroup cluster = new VDSGroup(); { cluster.setcompatibility_version(new Version(3, 5)); <START> } <END> @Override public VDSGroup getSelectedCluster() { return cluster; } }; model.initialize(null); return model; }</code><technical_language>This anonymous block is redundant. Also, please constants in Version: VDSGroup cluster = new VDSGroup(); setcompatibility_version(Version.3_5);</technical_language>

Target:
protected UnitVmModel createModel(VmModelBehaviorBase behavior) { final VDSGroup cluster = new VDSGroup(); cluster.setcompatibility_version(Version.v3_5); UnitVmModel model = new UnitVmModel(behavior) { @Override public EntityModel<Boolean> getIsSingleQxlEnabled() { return new EntityModel<Boolean>(true); } @Override public VDSGroup getSelectedCluster() { return cluster; } }; model.initialize(null); return model; }
Source:
<code>private LiteralNode literalArray(final MethodBuilder builder) throws ProgramDefinitionError { SourceCoordinate coord = getCoordinate(); List<ExpressionNode> expressions = new ArrayList<ExpressionNode>(); expect(NewLiteralArray, DelimiterOpeningTag.class); while (true) { comments(); switch (sym) { case EndLiteralArray: expect(EndLiteralArray, DelimiterClosingTag.class); return createLiteralArray(expressions, getSource(coord)); <START> case Period: <END> expect(Period, StatementSeparatorTag.class); break; default: expressions.add(expression(builder)); break; } } }</code><technical_language>hmm, I this is correct. This is more like: { DOT* expr* }. This means parses {....3....} is {3}, is surprising, I think. And, parses {3 3 3 3}, is {3. 3. 3. 3}. This supported</technical_language>

Target:
private LiteralNode literalArray(final MethodBuilder builder) throws ProgramDefinitionError { SourceCoordinate coord = getCoordinate(); List<ExpressionNode> expressions = new ArrayList<ExpressionNode>(); expect(NewLiteralArray, DelimiterOpeningTag.class); boolean needsSeparator = false; while (true) { comments(); if (sym == EndLiteralArray) { expect(EndLiteralArray, DelimiterClosingTag.class); return createLiteralArray(expressions, getSource(coord)); } if (needsSeparator) { expect(Period, "Could not parse statement. Expected a '.' but got '" + text + "'", StatementSeparatorTag.class); } expressions.add(expression(builder)); needsSeparator = !accept(Period, StatementSeparatorTag.class); } }
Source:
<code>public void testDeepCloning() { FridgeDTO in = createFridgeDTO(); FridgeDTO out = CloningMapper.INSTANCE.clone( in ); assertThat( out ).isNotNull(); assertThat( out.getShelve() ).isNotNull(); <START> assertThat( out.getShelve() ).isNotEqualTo( in.getShelve() ); <END> assertThat( out.getShelve().getCoolBeer() ).isNotEqualTo( in.getShelve().getCoolBeer() ); assertThat( out.getShelve().getCoolBeer().getBeerCount() ).isEqualTo( "5" ); }</code><technical_language>suggestion assertThat( out.getShelve() ).isNotSameAs( in.getShelve() );</technical_language>

Target:
public void testDeepCloning() { FridgeDTO in = createFridgeDTO(); FridgeDTO out = CloningMapper.INSTANCE.clone( in ); assertThat( out ).isNotNull(); assertThat( out.getShelve() ).isNotNull(); assertThat( out.getShelve() ).isNotSameAs( in.getShelve() ); assertThat( out.getShelve().getCoolBeer() ).isNotSameAs( in.getShelve().getCoolBeer() ); assertThat( out.getShelve().getCoolBeer().getBeerCount() ).isEqualTo( "5" ); }
Source:
<code>private void removeImageFromDB() { final DiskImage diskImage = getDiskImage(); final List<Snapshot> updatedSnapshots; final boolean shouldPerformOpOnVmSnapshots = !diskImage.isShareable(); try { <START> if (shouldPerformOpOnVmSnapshots) { <END> VM vm = getVmForNonShareableDiskImage(diskImage); lockVmSnapshotsWithWait(vm); updatedSnapshots = prepareSnapshotConfigWithoutImage(diskImage.getId()); } else { updatedSnapshots = Collections.emptyList(); } TransactionSupport.executeInScope(TransactionScopeOption.Required, new TransactionMethod<Object>() { @Override public Object runInTransaction() { getDiskImageDynamicDAO().remove(diskImage.getImageId()); Guid imageTemplate = diskImage.getit_guid(); Guid currentGuid = diskImage.getImageId(); while (!currentGuid.equals(imageTemplate) && !currentGuid.equals(Guid.Empty)) { RemoveChildren(currentGuid); DiskImage image = getDiskImageDao().getSnapshotById(currentGuid); if (image != null) { RemoveSnapshot(image); currentGuid = image.getParentId(); } else { currentGuid = Guid.Empty; log.warnFormat( "'image' (snapshot of image '{0}') is null, cannot remove it.", diskImage.getImageId()); } } getBaseDiskDao().remove(diskImage.getId()); getVmDeviceDAO().remove(new VmDeviceId(diskImage.getId(), null)); for (Snapshot s : updatedSnapshots) { getSnapshotDao().update(s); } return null; } }); } finally { if (shouldPerformOpOnVmSnapshots) { freeVmSnapshotsLock(); } } }</code><technical_language>I need variable is a scope of if</technical_language>

Target:
private void removeImageFromDB() { final DiskImage diskImage = getDiskImage(); final List<Snapshot> updatedSnapshots; final boolean shouldPerformOpOnVmSnapshots = !diskImage.isShareable() && getParameters().getParentCommand() != VdcActionType.RemoveVm; try { if (shouldPerformOpOnVmSnapshots) { VM vm = getVmForNonShareableDiskImage(diskImage); lockVmSnapshotsWithWait(vm); updatedSnapshots = prepareSnapshotConfigWithoutImage(diskImage.getId()); } else { updatedSnapshots = Collections.emptyList(); } TransactionSupport.executeInScope(TransactionScopeOption.Required, new TransactionMethod<Object>() { @Override public Object runInTransaction() { getDiskImageDynamicDAO().remove(diskImage.getImageId()); Guid imageTemplate = diskImage.getit_guid(); Guid currentGuid = diskImage.getImageId(); while (!currentGuid.equals(imageTemplate) && !currentGuid.equals(Guid.Empty)) { RemoveChildren(currentGuid); DiskImage image = getDiskImageDao().getSnapshotById(currentGuid); if (image != null) { RemoveSnapshot(image); currentGuid = image.getParentId(); } else { currentGuid = Guid.Empty; log.warnFormat( "'image' (snapshot of image '{0}') is null, cannot remove it.", diskImage.getImageId()); } } getBaseDiskDao().remove(diskImage.getId()); getVmDeviceDAO().remove(new VmDeviceId(diskImage.getId(), null)); for (Snapshot s : updatedSnapshots) { getSnapshotDao().update(s); } return null; } }); } finally { if (snapshotsEngineLock != null) { getLockManager().releaseLock(snapshotsEngineLock); } } }
Source:
<code>public boolean flush(K key, ValueHolder<V> valueHolder, CachingTier<K, V> cachingTier) { int hash = hash(key.hashCode()); <START> return segmentFor(hash).flush(key, hash, (DiskValueHolder<V>) valueHolder, cachingTier); <END> }</code><technical_language>blind cast DiskValueHolder safe a public method</technical_language>

Target:
public boolean flush(K key, ValueHolder<V> valueHolder, CachingTier<K, V> cachingTier) { if (valueHolder instanceof DiskValueHolder) { throw new IllegalArgumentException("Value holder must be of a class coming from the caching tier"); } int hash = hash(key.hashCode()); return segmentFor(hash).flush(key, hash, valueHolder, cachingTier); }
Source:
<code>public InstallPackageDialog( PackageInstallContext installContext, PackageInstallOptions defaultInstallOptions, PackagesServerOperations server, GlobalDisplay globalDisplay, OperationWithInput<PackageInstallRequest> operation) { super("Install Packages", operation); installContext_ = installContext; defaultInstallOptions_ = defaultInstallOptions; server_ = server; globalDisplay_ = globalDisplay; <START> RStudioThemes.disableDarkMenus(); <END> setOkButtonCaption("Install"); }</code><technical_language>For symmetry, this occur in onLoad() call constructor</technical_language>

Target:
public InstallPackageDialog( PackageInstallContext installContext, PackageInstallOptions defaultInstallOptions, PackagesServerOperations server, GlobalDisplay globalDisplay, OperationWithInput<PackageInstallRequest> operation) { super("Install Packages", operation); installContext_ = installContext; defaultInstallOptions_ = defaultInstallOptions; server_ = server; globalDisplay_ = globalDisplay; setOkButtonCaption("Install"); }
Source:
<code>AssignmentConfigs(final Long acceptableRecoveryLag, final Integer maxWarmupReplicas, final Integer numStandbyReplicas, final Long probingRebalanceIntervalMs) { <START> if (maxWarmupReplicas < 1) { throw new IllegalArgumentException("must configure at least one warmup replica"); } this.acceptableRecoveryLag = acceptableRecoveryLag; this.maxWarmupReplicas = maxWarmupReplicas; this.numStandbyReplicas = numStandbyReplicas; this.probingRebalanceIntervalMs = probingRebalanceIntervalMs; <END> }</code><technical_language>add for other configs</technical_language>

Target:
AssignmentConfigs(final Long acceptableRecoveryLag, final Integer maxWarmupReplicas, final Integer numStandbyReplicas, final Long probingRebalanceIntervalMs) { this.acceptableRecoveryLag = validated(StreamsConfig.ACCEPTABLE_RECOVERY_LAG_CONFIG, acceptableRecoveryLag); this.maxWarmupReplicas = validated(StreamsConfig.MAX_WARMUP_REPLICAS_CONFIG, maxWarmupReplicas); this.numStandbyReplicas = validated(StreamsConfig.NUM_STANDBY_REPLICAS_CONFIG, numStandbyReplicas); this.probingRebalanceIntervalMs = validated(StreamsConfig.PROBING_REBALANCE_INTERVAL_MS_CONFIG, probingRebalanceIntervalMs); }
Source:
<code>private List<ExecutionState> evaluateCondition(ExecutionState executionState, ExpressionTree tree) { List<ExecutionState> result = new ArrayList<>(); ExpressionTree expressionTree = removeCastAndParenthesis(tree); if (expressionTree.is(Tree.Kind.CONDITIONAL_AND)) { evaluateConditionConditionalAnd(result, executionState, (BinaryExpressionTree) expressionTree); } else if (expressionTree.is(Tree.Kind.CONDITIONAL_OR)) { evaluateConditionConditionalOr(result, executionState, (BinaryExpressionTree) expressionTree); } else if (expressionTree.is(Tree.Kind.EQUAL_TO)) { evaluateConditionRelationalOperator(result, executionState, (BinaryExpressionTree) expressionTree, SymbolicRelation.EQUAL_TO); } else if (expressionTree.is(Tree.Kind.GREATER_THAN)) { evaluateConditionRelationalOperator(result, executionState, (BinaryExpressionTree) expressionTree, SymbolicRelation.GREATER_THAN); } else if (expressionTree.is(Tree.Kind.GREATER_THAN_OR_EQUAL_TO)) { evaluateConditionRelationalOperator(result, executionState, (BinaryExpressionTree) expressionTree, SymbolicRelation.GREATER_EQUAL); } else if (expressionTree.is(Tree.Kind.LESS_THAN)) { evaluateConditionRelationalOperator(result, executionState, (BinaryExpressionTree) expressionTree, SymbolicRelation.LESS_THAN); } else if (expressionTree.is(Tree.Kind.LESS_THAN_OR_EQUAL_TO)) { evaluateConditionRelationalOperator(result, executionState, (BinaryExpressionTree) expressionTree, SymbolicRelation.LESS_EQUAL); } else if (expressionTree.is(Tree.Kind.NOT_EQUAL_TO)) { evaluateConditionRelationalOperator(result, executionState, (BinaryExpressionTree) expressionTree, SymbolicRelation.NOT_EQUAL); <START> } else if (expressionTree.is(Tree.Kind.IDENTIFIER)) { <END> evaluateConditionIdentifier(result, executionState, ((IdentifierTree) expressionTree).symbol()); } else if (isSuperOrThisMemberSelect(expressionTree)) { evaluateConditionIdentifier(result, executionState, ((MemberSelectExpressionTree) expressionTree).identifier().symbol()); } else { evaluateConditionOther(result, executionState, expressionTree); } return result; }</code><technical_language>@merciesa if values dense, switch enum faster sequence of if-else-if</technical_language>

Target:
private List<ExecutionState> evaluateCondition(ExecutionState executionState, ExpressionTree tree) { List<ExecutionState> result = new ArrayList<>(); ExpressionTree expressionTree = removeCastAndParenthesis(tree); Tree.Kind kind = ((JavaTree) expressionTree).getKind(); SymbolicRelation relation = OPERATOR_TO_RELATION.get(kind); if (relation != null) { evaluateConditionRelationalOperator(result, executionState, (BinaryExpressionTree) expressionTree, relation); } else { switch (kind) { case CONDITIONAL_AND: evaluateConditionConditionalAnd(result, executionState, (BinaryExpressionTree) expressionTree); break; case CONDITIONAL_OR: evaluateConditionConditionalOr(result, executionState, (BinaryExpressionTree) expressionTree); break; case IDENTIFIER: evaluateConditionIdentifier(result, executionState, ((IdentifierTree) expressionTree).symbol()); break; default: evaluateConditionOther(result, executionState, expressionTree); break; } } return result; }
Source:
<code>private void removeDeletedFromWireGraphProperty(final String pid) throws GwtKuraException { final ConfigurationAdmin configAdmin = ServiceLocator.getInstance().getService(ConfigurationAdmin.class); final WireHelperService wireHelperService = ServiceLocator.getInstance().getService(WireHelperService.class); try { final String filter = "(" + KURA_SERVICE_PID + "=" + pid + ")"; ServiceUtil.waitForService(filter, TIMEOUT, SECONDS); final String servicePid = wireHelperService.getServicePid(pid); if (servicePid == null) { return; } Configuration conf = configAdmin.getConfiguration(servicePid); if (conf == null) { return; } Dictionary<String, Object> props = conf.getProperties(); if (props != null) { props.remove(DELETED_WIRE_COMPONENT); conf.update(props); } } catch (final Exception exception) { throw new GwtKuraException(GwtKuraErrorCode.INTERNAL_ERROR, exception); } <START> } <END></code><technical_language>some specific Error Code</technical_language>

Target:
private void removeDeletedFromWireGraphProperty(final String pid) throws GwtKuraException { final ConfigurationAdmin configAdmin = ServiceLocator.getInstance().getService(ConfigurationAdmin.class); final WireHelperService wireHelperService = ServiceLocator.getInstance().getService(WireHelperService.class); try { final String filter = "(" + KURA_SERVICE_PID + "=" + pid + ")"; if (!ServiceUtil.waitForService(filter, TIMEOUT, SECONDS).isPresent()) { return; } final String servicePid = wireHelperService.getServicePid(pid); if (servicePid == null) { return; } Configuration conf = configAdmin.getConfiguration(servicePid); if (conf == null) { return; } Dictionary<String, Object> props = conf.getProperties(); if (props != null) { props.remove(DELETED_WIRE_COMPONENT); conf.update(props); } } catch (final Exception exception) { throw new GwtKuraException(GwtKuraErrorCode.INTERNAL_ERROR, exception); } }
Source:
<code>public static PrePushHook prePush(Repository repo, PrintStream outputStream) { if <START> (LFS.getInstance().isAvailable()) { <END> PrePushHook hook = LFS.getInstance().getPrePushHook(repo, outputStream); if (hook != null) { if (hook.isNativeHookPresent()) { throw new IllegalStateException(MessageFormat .format(JGitText.get().lfsHookConflict, repo)); } return hook; } } return new PrePushHook(repo, outputStream); }</code><technical_language>need check if is enabled load native prepush hook if existing. effectively disallow native prepush hook jgit pgm registers BuiltinLFS</technical_language>

Target:
public static PrePushHook prePush(Repository repo, PrintStream outputStream) { if (LfsFactory.getInstance().isAvailable()) { PrePushHook hook = LfsFactory.getInstance().getPrePushHook(repo, outputStream); if (hook != null) { if (hook.isNativeHookPresent()) { throw new IllegalStateException(MessageFormat .format(JGitText.get().lfsHookConflict, repo)); } return hook; } } return new PrePushHook(repo, outputStream); }
Source:
<code>public void write(@Nonnull IToken token, @Nonnull Object data, @Nonnull CacheOption cacheOption) { ILogData ld; if (data instanceof ILogData) { ld = (ILogData) data; } else { ld = new LogData(DataType.DATA, data); } <START> ld.setPayloadCodecType(Codec.Type.valueOf(runtime.getParameters().getCodecType())); <END> layoutHelper(e -> { Layout l = e.getLayout(); if (token.getEpoch() != l.getEpoch()) { throw new StaleTokenException(l.getEpoch()); } ld.useToken(token); ld.setId(runtime.getParameters().getClientId()); try { l.getReplicationMode(token.getSequence()) .getReplicationProtocol(runtime) .write(e, ld); } catch (OverwriteException ex) { if (ex.getOverWriteCause() == OverwriteCause.SAME_DATA){ validateStateOfWrittenEntry(token.getSequence(), ld); } else { throw ex; } } catch (WriteSizeException | QuotaExceededException ie) { log.warn("write: write failed", ie); throw ie; } catch (RuntimeException re) { log.error("write: Got exception during replication protocol write with token: {}", token, re); validateStateOfWrittenEntry(token.getSequence(), ld); } return null; }, true); if (cacheOption == CacheOption.WRITE_THROUGH) { readCache.put(token.getSequence(), ld); } }</code><technical_language>Compression is leaking AddressSpace. set codec type ILogData creation? CorfuRuntimeParameters a mandatory parameter for ILogData</technical_language>

Target:
public void write(@Nonnull IToken token, @Nonnull Object data, @Nonnull CacheOption cacheOption) { ILogData ld; if (data instanceof ILogData) { ld = (ILogData) data; } else { ld = new LogData(DataType.DATA, data, runtime.getParameters().getCodecType()); } layoutHelper(e -> { Layout l = e.getLayout(); if (token.getEpoch() != l.getEpoch()) { throw new StaleTokenException(l.getEpoch()); } ld.useToken(token); ld.setId(runtime.getParameters().getClientId()); try { l.getReplicationMode(token.getSequence()) .getReplicationProtocol(runtime) .write(e, ld); } catch (OverwriteException ex) { if (ex.getOverWriteCause() == OverwriteCause.SAME_DATA){ validateStateOfWrittenEntry(token.getSequence(), ld); } else { throw ex; } } catch (WriteSizeException | QuotaExceededException ie) { log.warn("write: write failed", ie); throw ie; } catch (RuntimeException re) { log.error("write: Got exception during replication protocol write with token: {}", token, re); validateStateOfWrittenEntry(token.getSequence(), ld); } return null; }, true); if (cacheOption == CacheOption.WRITE_THROUGH) { readCache.put(token.getSequence(), ld); } }
Source:
<code>private static boolean isValidKey(final String s) { if (s == null) { return false; } if (s.equals(WILDCARD_VALUE)) { return true; } int lastIndex = s.length() - 1; <START> if (!isValidKeyStartCharacter(s.charAt(0))) { <END> return false; } for (int i = 1; i < lastIndex; i++) { if (!isValidKeyCharacter(s.charAt(i))) { return false; } } if (lastIndex > 0 && !isValidKeyEndCharacter(s.charAt(lastIndex))) { return false; } return true; }</code><technical_language>This fail if key is empty string</technical_language>

Target:
private static boolean isValidKey(final String s) { if (s == null) { return false; } if (s.equals(WILDCARD_VALUE)) { return true; } int lastIndex = s.length() - 1; if (lastIndex == -1) { return false; } if (!isValidKeyStartCharacter(s.charAt(0))) { return false; } for (int i = 1; i < lastIndex; i++) { if (!isValidKeyCharacter(s.charAt(i))) { return false; } } if (lastIndex > 0 && !isValidKeyEndCharacter(s.charAt(lastIndex))) { return false; } return true; }
Source:
<code>public boolean isColorImage(BufferedImage image, Color color, int accuracy) { int count = image.getHeight() * image.getWidth(); int diffCount = 0; for (int x = 0; x < image.getWidth(); x++) { for (int y = 0; y < image.getHeight(); y++) { <START> Color pixelColor = new Color(image.getRGB(x,y)); <END> if ( !colorsAreSimilar(pixelColor, color) ) { diffCount += 1; } } if (diffCount > ((100 - accuracy) * count) / 100D) { return false; } } return true; }</code><technical_language>LGTM in general. performance/less memory consumption gain declaring Color pixelColor of loops updating it, - is optimization JVM is able do itself. a merge blocker in opinion</technical_language>

Target:
public boolean isColorImage(BufferedImage image, Color color, int accuracy) { int count = image.getHeight() * image.getWidth(); int diffCount = 0; for (int x = 0; x < image.getWidth(); x++) { for (int y = 0; y < image.getHeight(); y++) { Color pixelColor = new Color(image.getRGB(x,y)); if (!areColorsSimilar(pixelColor, color)) { diffCount += 1; } } if (diffCount > ((100 - accuracy) * count) / 100D) { return false; } } return true; }
Source:
<code>public void pullsByDefault() { try ( <START> GenericContainer<?> container = new GenericContainer(new DockerImageName(imageName)) <END> .withStartupCheckStrategy(new OneShotStartupCheckStrategy()) ) { container.start(); } }</code><technical_language>nit: imageName field changed DockerImageName, tests' bodies a bit smaller</technical_language>

Target:
public void pullsByDefault() { try ( GenericContainer<?> container = new GenericContainer<>(imageName) .withStartupCheckStrategy(new OneShotStartupCheckStrategy()) ) { container.start(); } }
Source:
<code>public Campaign(JSONObject jsonCampaign) { try { mId = jsonCampaign.getString("id"); } catch(JSONException e) { e.printStackTrace(); Log.d(TAG, "Couldn't extract id field"); <START> mTitle = null; <END> } try { mTitle = jsonCampaign.getString("title"); } catch (JSONException e) { e.printStackTrace(); Log.d(TAG, "Couldn't extract title field"); mTitle = "<No Title>"; } try { mDesription = jsonCampaign.getString("description"); } catch (JSONException e) { e.printStackTrace(); Log.d(TAG, "Couldn't extract description field"); mDesription = "<No Description>"; } }</code><technical_language>Is this supposed mId = null? mTitle is set in next block</technical_language>

Target:
public Campaign(JSONObject jsonCampaign) { try { mId = jsonCampaign.getString("id"); } catch(JSONException e) { e.printStackTrace(); Log.d(TAG, "Couldn't extract id field"); mId = null; } try { mTitle = jsonCampaign.getString("title"); } catch (JSONException e) { e.printStackTrace(); Log.d(TAG, "Couldn't extract title field"); mTitle = "<No Title>"; } try { mDesription = jsonCampaign.getString("description"); } catch (JSONException e) { e.printStackTrace(); Log.d(TAG, "Couldn't extract description field"); mDesription = "<No Description>"; } }
Source:
<code>private void submitProcessTask(final CacheLoaderTask cacheLoaderTask, final KeyFilter filter, CompletionService ecs, final TaskContext taskContext, final List<Entry> batch, final boolean loadValues, final boolean loadMetadata) { <START> ecs.submit(new Callable<Void>() { <END> @Override public Void call() throws Exception { try { long now = ctx.getTimeService().wallClockTime(); for (Entry pair : batch) { if (taskContext.isStopped()) { break; } Object key = unmarshall(pair.key); if (filter == null || filter.accept(key)) { MarshalledEntry entry = loadValues || loadMetadata ? (MarshalledEntry) unmarshall(pair.value) : null; boolean isExpired = entry != null && entry.getMetadata() != null && entry.getMetadata().isExpired(now); if (!isExpired) { if (!loadValues || !loadMetadata) { entry = ctx.getMarshalledEntryFactory().newMarshalledEntry( key, loadValues ? entry.getValue() : null, loadMetadata ? entry.getMetadata() : null); } cacheLoaderTask.processEntry(entry, taskContext); } } } } catch (Exception e) { log.errorExecutingParallelStoreTask(e); throw e; } return null; } }); }</code><technical_language>a lambda</technical_language>

Target:
private void submitProcessTask(final CacheLoaderTask cacheLoaderTask, final KeyFilter filter, CompletionService ecs, final TaskContext taskContext, final List<Entry> batch, final boolean loadValues, final boolean loadMetadata) { ecs.submit(() -> { try { long now = ctx.getTimeService().wallClockTime(); for (Entry pair : batch) { if (taskContext.isStopped()) { break; } Object key = unmarshall(pair.key); if (filter == null || filter.accept(key)) { MarshalledEntry entry = loadValues || loadMetadata ? (MarshalledEntry) unmarshall(pair.value) : null; boolean isExpired = entry != null && entry.getMetadata() != null && entry.getMetadata().isExpired(now); if (!isExpired) { if (!loadValues || !loadMetadata) { entry = ctx.getMarshalledEntryFactory().newMarshalledEntry( key, loadValues ? entry.getValue() : null, loadMetadata ? entry.getMetadata() : null); } cacheLoaderTask.processEntry(entry, taskContext); } } } return null; } catch (Exception e) { log.errorExecutingParallelStoreTask(e); throw e; } }); }
Source:
<code>public boolean performCancel() { for (String[] <START> element : <END> fAppearanceColorListModel) { String preference = element[1]; PreferenceConverter.setValue(getPreferenceStore(), preference, StringConverter.asRGB(element[2])); } return super.performCancel(); }</code><technical_language>rename colorModel</technical_language>

Target:
public boolean performCancel() { for (String[] colorModel : fAppearanceColorListModel) { String preference = colorModel[1]; PreferenceConverter.setValue(getPreferenceStore(), preference, StringConverter.asRGB(colorModel[2])); } return super.performCancel(); }
Source:
<code>public void before() { <START> Graphene.goTo(HomePage.class); <END> Console.withBrowser(browser).waitUntilLoaded(); Graphene.goTo(DomainDeploymentPage.class); Console.withBrowser(browser).waitUntilLoaded(); Console.withBrowser(browser).maximizeWindow(); }</code><technical_language>Console.withBrowser(browser).refreshAndNavigate method minimize redundancy in &#64;</technical_language>

Target:
public void before() { Console.withBrowser(browser).refreshAndNavigate(DomainDeploymentPage.class); }
Source:
<code>public void testVersion() { final org.apache.log4j.Logger root = LogManager.getRootLogger(); root.setLevel(org.apache.log4j.Level.INFO); final StringAppender app = new StringAppender(); <START> root.addAppender(app); <END> new NamedThreads("test", "desc").newThread( new Runnable() { @Override public void run() { } }); final String message = app.getBuffer(); MatcherAssert.assertThat( message, Matchers.not( Matchers.containsString( "${projectVersion}" ) ) ); MatcherAssert.assertThat( message, Matchers.not( Matchers.containsString( "${buildNumber}" ) ) ); }</code><technical_language>@pecko @pinaf If remove appender, affect other tests. Logger#setLevel(Level)</technical_language>

Target:
public void testVersion() { final org.apache.log4j.Logger root = LogManager.getRootLogger(); final Level level = root.getLevel(); root.setLevel(Level.INFO); final StringWriter writer = new StringWriter(); final WriterAppender appender = new WriterAppender(new SimpleLayout(), writer); root.addAppender(appender); try { new NamedThreads("test", "desc").newThread( new Runnable() { @Override public void run() { } }); final String message = writer.toString(); MatcherAssert.assertThat( message, Matchers.containsString( Version.CURRENT.projectVersion() ) ); MatcherAssert.assertThat( message, Matchers.containsString( Version.CURRENT.buildNumber() ) ); } finally { root.removeAppender(appender); root.setLevel(level); } }
Source:
<code><START> public void doubleClickTimeLineGroup() { <END> WebElement elem = driver.findElement(By.xpath(" + "/descendant::div[contains(@class,'vispanel center')]")); doubleClick(elem); doubleClick(timeLineGroup); }</code><technical_language>page factory</technical_language>

Target:
public void doubleClickTimeLineGroup() { clickRemoveBtn(); doubleClick(timeLineGroup); }
Source:
<code>public void execute(final OperationParams params) { try { final KuduLocal server = options.getServer(); server.start(); if (interactive) { System.out.println("hit any key to shutdown .."); System.in.read(); System.out.println("Shutting down!"); server.stop(); } else { Runtime.getRuntime().addShutdownHook(new Thread() { @Override public void run() { try { server.stop(); } catch (final Exception e) { <START> LOGGER.warn("Unable to shutdown redis", e); <END> System.out.println("Error shutting down redis."); } System.out.println("Shutting down!"); } }); while (true) { Thread.sleep(TimeUnit.MILLISECONDS.convert(Long.MAX_VALUE, TimeUnit.DAYS)); } } } catch (final Exception e) { LOGGER.error("Unable to run embedded Redis server", e); } }</code><technical_language>Replace redis Kudu for this lines</technical_language>

Target:
public void execute(final OperationParams params) { try { final KuduLocal server = options.getServer(); server.start(); if (interactive) { System.out.println("hit any key to shutdown .."); System.in.read(); System.out.println("Shutting down!"); server.stop(); } else { Runtime.getRuntime().addShutdownHook(new Thread() { @Override public void run() { try { server.stop(); } catch (final Exception e) { LOGGER.warn("Unable to shutdown kudu", e); System.out.println("Error shutting down kudu server."); } System.out.println("Shutting down!"); } }); while (true) { Thread.sleep(TimeUnit.MILLISECONDS.convert(Long.MAX_VALUE, TimeUnit.DAYS)); } } } catch (final Exception e) { LOGGER.error("Unable to run embedded kudu server", e); } }
Source:
<code>private void initializeGatewayConfigurationReader() { this.gatewayConfigurationReader = new GatewayServiceConfigurationReader(this.serviceEndpoint, this.globalEndpointManager); <START> DatabaseAccount databaseAccount = this.globalEndpointManager.getLatestDatabaseAccount(); <END> this.useMultipleWriteLocations = this.connectionPolicy.getUsingMultipleWriteLocations() && BridgeInternal.isEnableMultipleWriteLocations(databaseAccount); }</code><technical_language>initialization blocking call now? If global endpoint manager is fully initialized databaseAccount fetch this return null</technical_language>

Target:
private void initializeGatewayConfigurationReader() { this.gatewayConfigurationReader = new GatewayServiceConfigurationReader(this.globalEndpointManager); DatabaseAccount databaseAccount = this.globalEndpointManager.getLatestDatabaseAccount(); assert(databaseAccount != null); this.useMultipleWriteLocations = this.connectionPolicy.getUsingMultipleWriteLocations() && BridgeInternal.isEnableMultipleWriteLocations(databaseAccount); }
Source:
<code>void processMessage(Message message) { String command = message.getCommand(); CommandExecutor executor = this.commandFactory.getCommandExecutor(command); Message response = executor.execute(message); if (Command.CONNECT.toString().equals(command)) { <START> policy.setIdentifier(message.getHeaders().get(HEADER_HOST)); <END> } if (response != null) { this.send(response.build()); } if (Command.DISCONNECT.toString().equals(command)) { try { channel.close(); } catch (IOException ignored) { } } }</code><technical_language>good check header defined first</technical_language>

Target:
void processMessage(Message message) { String command = message.getCommand(); CommandExecutor executor = this.commandFactory.getCommandExecutor(command); Message response = executor.execute(message); if (Command.CONNECT.toString().equals(command)) { if (message.getHeaders().get(HEADER_HOST) != null) { policy.setIdentifier(message.getHeaders().get(HEADER_HOST)); } } if (response != null) { this.send(response.build()); } if (Command.DISCONNECT.toString().equals(command)) { try { channel.close(); } catch (IOException ignored) { } } }
Source:
<code>private InvocationStage checkPendingAndLockKey(TxInvocationContext<?> ctx, VisitableCommand command, Object key, long lockTimeout) { PendingLockPromise pendingLockPromise = pendingLockManager.checkPendingTransactionsForKey(ctx, key, lockTimeout, TimeUnit.MILLISECONDS); if (pendingLockPromise.isReady()) { return lockAndRecord(ctx, command, key, lockTimeout); } <START> return makeStage(pendingLockPromise.toInvocationStage().thenApply(ctx, command, (rCtx, rCommand, rv) -> { <END> long remaining = pendingLockPromise.getRemainingTimeout(); return lockAndRecord(ctx, command, key, remaining); })); }</code><technical_language>thenApplyMakeStage() here</technical_language>

Target:
private InvocationStage checkPendingAndLockKey(TxInvocationContext<?> ctx, VisitableCommand command, Object key, long lockTimeout) { PendingLockPromise pendingLockPromise = pendingLockManager.checkPendingTransactionsForKey(ctx, key, lockTimeout, TimeUnit.MILLISECONDS); if (pendingLockPromise.isReady()) { return lockAndRecord(ctx, command, key, lockTimeout); } return pendingLockPromise.toInvocationStage().thenApplyMakeStage(ctx, command, (rCtx, rCommand, rv) -> { long remaining = pendingLockPromise.getRemainingTimeout(); return lockAndRecord(ctx, command, key, remaining); }); }
Source:
<code>public static void testGetActivitiesWithPaginationForClient() throws MambuApiException { String methodName = new Object() {}.getClass().getEnclosingMethod().getName(); System.out.println(methodName = "\nIn " + methodName); ActivitiesService activitiesService = MambuAPIFactory.getActivitiesService(); Class<Client> mambuEntity = Client.class; Calendar toDate = Calendar.getInstance(); Calendar fromDate = Calendar.getInstance(); fromDate.add(Calendar.DAY_OF_MONTH, -10); String entityId = DemoUtil.getDemoClient().getEncodedKey(); if (entityId == null) { <START> System.out.println("WARNING: No Activities for Client entity to retrieve"); <END> return; } List<JSONActivity> jsonActivities = activitiesService.getActivities(fromDate.getTime(), toDate.getTime(), mambuEntity, entityId, 0, 5); printMambuEntityAndActivitiesDetails(mambuEntity, entityId, jsonActivities, fromDate.getTime(), toDate.getTime()); }</code><technical_language>a more meaningful message here? For instance, I activities for this client encoded key is null client exist all. If message receives, entityId is good, activities in system. this is this message me, a sight. do think</technical_language>

Target:
public static void testGetActivitiesWithPaginationForClient() throws MambuApiException { String methodName = new Object() {}.getClass().getEnclosingMethod().getName(); System.out.println(methodName = "\nIn " + methodName); ActivitiesService activitiesService = MambuAPIFactory.getActivitiesService(); Class<Client> mambuEntity = Client.class; Calendar toDate = Calendar.getInstance(); Calendar fromDate = Calendar.getInstance(); fromDate.add(Calendar.DAY_OF_MONTH, -10); String entityId = DemoUtil.getDemoClient().getEncodedKey(); if (entityId == null) { System.out.println("WARNING: No Activities can be obtained for a client with null encodedKey"); return; } List<JSONActivity> jsonActivities = activitiesService.getActivities(fromDate.getTime(), toDate.getTime(), mambuEntity, entityId, 0, 5); printMambuEntityAndActivitiesDetails(mambuEntity, entityId, jsonActivities, fromDate.getTime(), toDate.getTime()); }
Source:
<code>public int compare(MessageExt lhs, MessageExt rhs) { <START> return lhs.getQueueOffset() < rhs.getQueueOffset() ? -1 : (lhs.getQueueOffset() == rhs.getQueueOffset() ? 0 : 1); <END> }</code><technical_language>suggest Long.compare</technical_language>

Target:
public int compare(MessageExt lhs, MessageExt rhs) { return Long.compare(lhs.getQueueOffset(), lhs.getQueueOffset()); }