auphong2707/dl4se-code-review-dataset huggingface dataset:
Source:
<code>public void sendAdvertisedRefs(final RefAdvertiser adv) throws IOException, ServiceMayNotContinueException { if (advertiseError != null) { adv.writeOne("ERR " + advertiseError); return; } try { advertiseRefsHook.advertiseRefs(this); } catch (ServiceMayNotContinueException fail) { if (fail.getMessage() != null) { adv.writeOne("ERR " + fail.getMessage()); fail.setOutput(); } throw fail; } adv.init(db); adv.advertiseCapability(CAPABILITY_SIDE_BAND_64K); adv.advertiseCapability(CAPABILITY_DELETE_REFS); adv.advertiseCapability(CAPABILITY_REPORT_STATUS); if (allowQuiet) adv.advertiseCapability(CAPABILITY_QUIET); String nonce = getPushCertificateParser().getAdvertiseNonce(); if (nonce != null) { adv.advertiseCapability(nonce); } if (db.getRefDatabase().performsAtomicTransactions()) adv.advertiseCapability(CAPABILITY_ATOMIC); if (allowOfsDelta) adv.advertiseCapability(CAPABILITY_OFS_DELTA); if (allowPushOptions) { adv.advertiseCapability(CAPABILITY_PUSH_OPTIONS); <START> if (pushOptions == null) { <END> pushOptions = new ArrayList<>(); } } adv.advertiseCapability(OPTION_AGENT, UserAgent.get()); adv.send(getAdvertisedOrDefaultRefs()); for (ObjectId obj : advertisedHaves) adv.advertiseHave(obj); if (adv.isEmpty()) adv.advertiseId(ObjectId.zeroId(), "capabilities^{}"); adv.end(); }</code><technical_language>this true this point</technical_language>

Target:
public void sendAdvertisedRefs(final RefAdvertiser adv) throws IOException, ServiceMayNotContinueException { if (advertiseError != null) { adv.writeOne("ERR " + advertiseError); return; } try { advertiseRefsHook.advertiseRefs(this); } catch (ServiceMayNotContinueException fail) { if (fail.getMessage() != null) { adv.writeOne("ERR " + fail.getMessage()); fail.setOutput(); } throw fail; } adv.init(db); adv.advertiseCapability(CAPABILITY_SIDE_BAND_64K); adv.advertiseCapability(CAPABILITY_DELETE_REFS); adv.advertiseCapability(CAPABILITY_REPORT_STATUS); if (allowQuiet) adv.advertiseCapability(CAPABILITY_QUIET); String nonce = getPushCertificateParser().getAdvertiseNonce(); if (nonce != null) { adv.advertiseCapability(nonce); } if (db.getRefDatabase().performsAtomicTransactions()) adv.advertiseCapability(CAPABILITY_ATOMIC); if (allowOfsDelta) adv.advertiseCapability(CAPABILITY_OFS_DELTA); if (allowPushOptions) { adv.advertiseCapability(CAPABILITY_PUSH_OPTIONS); pushOptions = new ArrayList<>(); } adv.advertiseCapability(OPTION_AGENT, UserAgent.get()); adv.send(getAdvertisedOrDefaultRefs()); for (ObjectId obj : advertisedHaves) adv.advertiseHave(obj); if (adv.isEmpty()) adv.advertiseId(ObjectId.zeroId(), "capabilities^{}"); adv.end(); }
Source:
<code><START> protected void releaseRecoveryMemory(KeyExtent extent) { <END> if (!extent.isMeta()) { recoveryLock.unlock(); } }</code><technical_language>suggestion void releaseRecoveryMemory(KeyExtent extent) {</technical_language>

Target:
void releaseRecoveryMemory(KeyExtent extent) { if (!extent.isMeta()) { recoveryLock.unlock(); } }
Source:
<code>public static void editDraft(PrivateMessage pmCurrent, PrivateMessage pmNew) throws AssertionFailedError, NoSuchElementException, ValidationException { readDraft(pmCurrent); pmPage.clearPrivateMessageFields(); pmPage.fillPrivateMessageFields(pmNew); if (pmPage.isSaveButtonEnabled()) { <START> info("Clicking Save PM button"); <END> pmPage.clickSaveButton(); } else { throw new PermissionsDeniedException("The save button is disabled. No permissions?"); } assertFormValid(); info("Draft had to be edited and saved"); }</code><technical_language>moved pmPage.clickSaveButton()</technical_language>

Target:
public static void editDraft(PrivateMessage pmCurrent, PrivateMessage pmNew) throws AssertionFailedError, NoSuchElementException, ValidationException { openDraft(pmCurrent); pmPage.clearPrivateMessageFields(); pmPage.fillPrivateMessageFields(pmNew); if (pmPage.isSaveButtonEnabled()) { pmPage.clickSaveButton(); } else { info("The save button is disabled. No permissions?"); throw new PermissionsDeniedException("The save button is disabled. No permissions?"); } assertFormValid(); info("Draft had to be edited and saved"); }
Source:
<code>public List<PermissionSubject> <START> getPermissionCheckSubjects() <END> { return vdsIds.stream() .map(vdsId -> new PermissionSubject(vdsId, VdcObjectType.VDS, getActionType().getActionGroup())) .collect(Collectors.toList()); }</code><technical_language>This return empty list create USER_NOT_AUTHORIZED_TO_PERFORM_ACTION error if hosts in sync. In UI, this happen, in REST-API this happen. if this command is triggered RESt-API a cluster hosts in sync</technical_language>

Target:
public List<PermissionSubject> getPermissionCheckSubjects() { List<PermissionSubject> hostSubjects = vdsIds.stream() .map(vdsId -> new PermissionSubject(vdsId, VdcObjectType.VDS, getActionType().getActionGroup())) .collect(Collectors.toList()); hostSubjects.add(new PermissionSubject(getClusterId(), VdcObjectType.Cluster, ActionGroup.CONFIGURE_HOST_NETWORK)); return hostSubjects; }
Source:
<code>private List<IResource> getTraceResources() { IFolder folder = getResource(); final List<IResource> list = new ArrayList<>(); try { folder.accept(new IResourceProxyVisitor() { @Override public boolean visit(IResourceProxy resource) throws CoreException { if (resource.isLinked()) { list.add(resource.requestResource()); } return true; } }, IResource.NONE); } catch (CoreException e) { } Comparator<IResource> <START> comperator = <END> new Comparator<IResource>() { @Override public int compare(IResource o1, IResource o2) { return o1.getFullPath().toString().compareTo(o2.getFullPath().toString()); } }; Collections.sort(list, comperator); return list; }</code><technical_language>org.eclipse.ui.views.navigator.ResourceComparator instead</technical_language>

Target:
private List<IResource> getTraceResources() { IFolder folder = getResource(); final List<IResource> list = new ArrayList<>(); try { folder.accept(new IResourceProxyVisitor() { @Override public boolean visit(IResourceProxy resource) throws CoreException { if (resource.isLinked()) { list.add(resource.requestResource()); } return true; } }, IResource.NONE); } catch (CoreException e) { } Comparator<IResource> comparator = new Comparator<IResource>() { @Override public int compare(IResource o1, IResource o2) { return o1.getFullPath().toString().compareTo(o2.getFullPath().toString()); } }; Collections.sort(list, comparator); return list; }
Source:
<code>protected AbstractRetryScheduler(Builder builder) { <START> this.retryExecutor = builder.retryExecutor; <END> this.maxRetryCount = builder.maxRetryCount; }</code><technical_language>I missing call builder.validate() here</technical_language>

Target:
protected AbstractRetryScheduler(Builder builder) { builder.validate(); this.retryExecutor = builder.retryExecutor; this.maxRetryCount = builder.maxRetryCount; }
Source:
<code>private void parseInjectExtra(Element fieldElement, Map<TypeElement, InjectionTarget> targetClassMap, Set<TypeMirror> erasedTargetTypes, boolean shouldAddParentInjectionMaps) { TypeElement typeElement = (TypeElement) fieldElement.getEnclosingElement(); if (!isValidUsageOfInjectExtra(InjectExtra.class, fieldElement)) { return; } InjectionTarget injectionTarget = getOrCreateTargetClass(targetClassMap, typeElement); if (shouldAddParentInjectionMaps) { <START> findAllParentsInjectionMap(typeElement, injectionTarget); <END> } addField(fieldElement, injectionTarget); TypeMirror erasedTargetType = typeUtils.erasure(typeElement.asType()); erasedTargetTypes.add(erasedTargetType); }</code><technical_language>This is called for field/target, for ancestors module. for inhering HensonExtraProcessor.process -> enhanceInjectionTargetWithInheritedInjectionExtras</technical_language>

Target:
private void parseInjectExtra(Element fieldElement, Map<TypeElement, InjectionTarget> targetClassMap, Set<TypeMirror> erasedTargetTypes, boolean shouldAddParentInjectionMaps) { TypeElement typeElement = (TypeElement) fieldElement.getEnclosingElement(); if (!isValidUsageOfInjectExtra(InjectExtra.class, fieldElement)) { return; } InjectionTarget injectionTarget = getOrCreateTargetClass(targetClassMap, typeElement); if (shouldAddParentInjectionMaps) { findParentAndInheritInjectionMap(typeElement, injectionTarget); } addField(fieldElement, injectionTarget); TypeMirror erasedTargetType = typeUtils.erasure(typeElement.asType()); erasedTargetTypes.add(erasedTargetType); }
Source:
<code>public static TenorDateParameterMetadata of(LocalDate date, Tenor tenor) { <START> ArgChecker.notNull(tenor, "tenor"); <END> return new TenorDateParameterMetadata(date, tenor, tenor.toString()); }</code><technical_language>I this left in - arg checker is needed, I check</technical_language>

Target:
public static TenorDateParameterMetadata of(LocalDate date, Tenor tenor) { ArgChecker.notNull(date, "date"); ArgChecker.notNull(tenor, "tenor"); return new TenorDateParameterMetadata(date, tenor, tenor.toString()); }
Source:
<code>public String spawnPrefab(@Sender EntityRef sender, @CommandParam("prefabId") String prefabName) { <START> ClientComponent clientComponent = sender.getComponent(ClientComponent.class); <END> LocationComponent characterLocation = clientComponent.character.getComponent(LocationComponent.class); Vector3f spawnPos = characterLocation.getWorldPosition(); Vector3f offset = new Vector3f(characterLocation.getWorldDirection()); offset.scale(2); spawnPos.add(offset); Vector3f dir = new Vector3f(characterLocation.getWorldDirection()); dir.y = 0; if (dir.lengthSquared() > 0.001f) { dir.normalize(); } else { dir.set(Direction.FORWARD.getVector3f()); } return Assets.getPrefab(prefabName).map(prefab -> { LocationComponent loc = prefab.getComponent(LocationComponent.class); if (loc != null) { entityManager.create(prefab, spawnPos); return "Done"; } else { return "Prefab cannot be spawned (no location component)"; } }).orElse("Unknown prefab"); }</code><technical_language>cleanup of method is appreciated, this line removed. Is needed, in spawning prefab</technical_language>

Target:
public String spawnPrefab(@Sender EntityRef sender, @CommandParam("prefabId") String prefabName) { ClientComponent clientComponent = sender.getComponent(ClientComponent.class); LocationComponent characterLocation = clientComponent.character.getComponent(LocationComponent.class); Vector3f spawnPos = characterLocation.getWorldPosition(); Vector3f offset = new Vector3f(characterLocation.getWorldDirection()); offset.scale(2); spawnPos.add(offset); Vector3f dir = new Vector3f(characterLocation.getWorldDirection()); dir.y = 0; if (dir.lengthSquared() > 0.001f) { dir.normalize(); } else { dir.set(Direction.FORWARD.getVector3f()); } Quat4f rotation = Quat4f.shortestArcQuat(Direction.FORWARD.getVector3f(), dir); Optional<Prefab> prefab = Assets.getPrefab(prefabName); if (prefab.isPresent() && prefab.get().getComponent(LocationComponent.class) != null) { entityManager.create(prefab.get(), spawnPos, rotation); return "Done"; } else if (!prefab.isPresent()) { return "Unknown prefab"; } else { return "Prefab cannot be spawned (no location component)"; } }
Source:
<code><START> public Builder setDomain(@Domain int domain) { <END> mDomain = domain; return this; }</code><technical_language>methods @NonNull annotation for return. public @NonNull Builder setDomain(@Domain int domain) {</technical_language>

Target:
public @NonNull Builder setDomain(@Domain int domain) { mDomain = domain; return this; }
Source:
<code>public Set<String> getSupportedRecipes() { <START> return Sets.union(environmentFactories.keySet(), Collections.singleton("no-environment")); <END> }</code><technical_language>I assume no-environment supported some infrastructure. environmentFactories configured in Infrastructure module is ability deny no-environment. Do supported infrastructures? sense provide ability for Infrastructure bind NoEnvEnvFactory implementation. if absent - is supported. WDYT</technical_language>

Target:
public Set<String> getSupportedRecipes() { return environmentFactories.keySet(); }
Source:
<code>void performSubmit(Action action) { if (pausedTags.contains(action.getTag())) { pausedActions.put(action.getTarget(), action); if (action.getPicasso().loggingEnabled) { <START> log(OWNER_DISPATCHER, VERB_IGNORED, action.request.logId(), <END> "because tag '" + action.getTag() + "' is paused"); } return; } BitmapHunter hunter = hunterMap.get(action.getKey()); if (hunter != null) { hunter.attach(action); return; } if (service.isShutdown()) { if (action.getPicasso().loggingEnabled) { log(OWNER_DISPATCHER, VERB_IGNORED, action.request.logId(), "because shut down"); } return; } hunter = forRequest(action.getPicasso(), this, cache, stats, action); hunter.future = service.submit(hunter); hunterMap.put(action.getKey(), hunter); failedActions.remove(action.getTarget()); if (action.getPicasso().loggingEnabled) { log(OWNER_DISPATCHER, VERB_ENQUEUED, action.request.logId()); } }</code><technical_language>I want reuse "Paused" verb here. "Ignored" deferring request</technical_language>

Target:
void performSubmit(Action action) { if (pausedTags.contains(action.getTag())) { pausedActions.put(action.getTarget(), action); if (action.getPicasso().loggingEnabled) { log(OWNER_DISPATCHER, VERB_PAUSED, action.request.logId(), "because tag '" + action.getTag() + "' is paused"); } return; } BitmapHunter hunter = hunterMap.get(action.getKey()); if (hunter != null) { hunter.attach(action); return; } if (service.isShutdown()) { if (action.getPicasso().loggingEnabled) { log(OWNER_DISPATCHER, VERB_IGNORED, action.request.logId(), "because shut down"); } return; } hunter = forRequest(action.getPicasso(), this, cache, stats, action); hunter.future = service.submit(hunter); hunterMap.put(action.getKey(), hunter); failedActions.remove(action.getTarget()); if (action.getPicasso().loggingEnabled) { log(OWNER_DISPATCHER, VERB_ENQUEUED, action.request.logId()); } }
Source:
<code>private void onCacheStarted(GridCacheContext cacheCtx) throws IgniteCheckedException { GridCacheAdapter cache = cacheCtx.cache(); CacheConfiguration cfg = cacheCtx.config(); CacheGroupContext grp = cacheGrps.get(cacheCtx.groupId()); cacheCtx.onStarted(); String dataRegion = cfg.getDataRegionName(); if (dataRegion == null && ctx.config().getDataStorageConfiguration() != null) dataRegion = ctx.config().getDataStorageConfiguration().getDefaultDataRegionConfiguration().getName(); if (log.isInfoEnabled()) { log.info("Started cache [name=" + cfg.getName() + ", id=" + cacheCtx.cacheId() + (cfg.getGroupName() != null ? ", group=" + cfg.getGroupName() : "") + ", dataRegionName=" + dataRegion + ", mode=" + cfg.getCacheMode() + ", atomicity=" + cfg.getAtomicityMode() + ", backups=" + cfg.getBackups() + ", mvcc=" + cacheCtx.mvccEnabled() + ']'); } <START> if (ctx.metric().profilingEnabled()) { <END> ctx.metric().profiling().cacheStart( cacheCtx.cacheId(), System.currentTimeMillis(), cacheCtx.name(), cfg.getGroupName(), cacheCtx.userCache()); } grp.onCacheStarted(cacheCtx); onKernalStart(cache); }</code><technical_language>I need collect performance statistics cache start. a rare operation analyzed log files</technical_language>

Target:
private void onCacheStarted(GridCacheContext cacheCtx) throws IgniteCheckedException { GridCacheAdapter cache = cacheCtx.cache(); CacheConfiguration cfg = cacheCtx.config(); CacheGroupContext grp = cacheGrps.get(cacheCtx.groupId()); cacheCtx.onStarted(); String dataRegion = cfg.getDataRegionName(); if (dataRegion == null && ctx.config().getDataStorageConfiguration() != null) dataRegion = ctx.config().getDataStorageConfiguration().getDefaultDataRegionConfiguration().getName(); if (log.isInfoEnabled()) { log.info("Started cache [name=" + cfg.getName() + ", id=" + cacheCtx.cacheId() + (cfg.getGroupName() != null ? ", group=" + cfg.getGroupName() : "") + ", dataRegionName=" + dataRegion + ", mode=" + cfg.getCacheMode() + ", atomicity=" + cfg.getAtomicityMode() + ", backups=" + cfg.getBackups() + ", mvcc=" + cacheCtx.mvccEnabled() + ']'); } grp.onCacheStarted(cacheCtx); onKernalStart(cache); if (ctx.performanceStatistics().enabled() && U.isLocalNodeCoordinator(ctx.discovery())) ctx.performanceStatistics().cacheStart(cacheCtx.cacheId(), cfg.getName()); }
Source:
<code>private void propagateHeaders(ConsumerRecord<Object, Object> record, Exchange exchange, HeaderFilterStrategy headerFilterStrategy) { StreamSupport.stream(record.headers().spliterator(), false) <START> .filter(header -> !headerFilterStrategy.applyFilterToCamelHeaders(header.key(), header.value(), exchange)) <END> .forEach(header -> exchange.getIn().setHeader(header.key(), header.value())); }</code><technical_language>filter(keepIncludedHeaders)</technical_language>

Target:
private void propagateHeaders(ConsumerRecord<Object, Object> record, Exchange exchange, HeaderFilterStrategy headerFilterStrategy) { StreamSupport.stream(record.headers().spliterator(), false) .filter(header -> shouldBeFiltered(header, exchange, headerFilterStrategy)) .forEach(header -> exchange.getIn().setHeader(header.key(), header.value())); }
Source:
<code>private static void internalAssertEquals( String message, Object expecteds, Object actuals, ComparisonHelper comparisonHelper) { String messagePrefix = message == null ? "" : message + ": "; if (arraysTriviallyEqual(messagePrefix, expecteds, actuals)) { return; } <START> assertElementsEqual(messagePrefix, comparisonHelper); <END> }</code><technical_language>do changing this code if (!arraysTriviallyEqual(messagePrefix, expecteds, actuals)) { assertElementsEqual(messagePrefix, comparisonHelper); }</technical_language>

Target:
private static void internalAssertEquals( String message, Object expecteds, Object actuals, ComparisonHelper comparisonHelper) { String messagePrefix = message == null ? "" : message + ": "; if (!arraysTriviallyEqual(messagePrefix, expecteds, actuals)) { assertElementsEqual(messagePrefix, expecteds, actuals, comparisonHelper); } }
Source:
<code>private Function<Cursor, Result<TopNResultValue>> getMapFn(TopNQuery query, final StorageAdapter adapter) { final Capabilities capabilities = adapter.getCapabilities(); final String dimension = query.getDimensionSpec().getDimension(); final int cardinality = adapter.getDimensionCardinality(dimension); int numBytesPerRecord = 0; for (AggregatorFactory aggregatorFactory : query.getAggregatorSpecs()) { numBytesPerRecord += aggregatorFactory.getMaxIntermediateSize(); } final TopNAlgorithmSelector selector = new TopNAlgorithmSelector(cardinality, numBytesPerRecord); query.initTopNAlgorithmSelector(selector); final TopNAlgorithm topNAlgorithm; if ( selector.isHasExtractionFn() && dimension.equals(Column.TIME_COLUMN_NAME) ) { topNAlgorithm = new TimeExtractionTopNAlgorithm(capabilities, query); } else if (selector.isHasExtractionFn()) { <START> if (canApplyExtractionInPost(query)) { <END> topNAlgorithm = new PooledTopNAlgorithm(capabilities, query, bufferPool); } else { topNAlgorithm = new DimExtractionTopNAlgorithm(capabilities, query); } } else if (selector.isAggregateAllMetrics()) { topNAlgorithm = new PooledTopNAlgorithm(capabilities, query, bufferPool); } else if (selector.isAggregateTopNMetricFirst() || query.getContextValue("doAggregateTopNMetricFirst", false)) { topNAlgorithm = new AggregateTopNMetricFirstAlgorithm(capabilities, query, bufferPool); } else { topNAlgorithm = new PooledTopNAlgorithm(capabilities, query, bufferPool); } return new TopNMapFn(query, topNAlgorithm); }</code><technical_language>here, if rewrite, do need this</technical_language>

Target:
private Function<Cursor, Result<TopNResultValue>> getMapFn(TopNQuery query, final StorageAdapter adapter) { final Capabilities capabilities = adapter.getCapabilities(); final String dimension = query.getDimensionSpec().getDimension(); final int cardinality = adapter.getDimensionCardinality(dimension); int numBytesPerRecord = 0; for (AggregatorFactory aggregatorFactory : query.getAggregatorSpecs()) { numBytesPerRecord += aggregatorFactory.getMaxIntermediateSize(); } final TopNAlgorithmSelector selector = new TopNAlgorithmSelector(cardinality, numBytesPerRecord); query.initTopNAlgorithmSelector(selector); final TopNAlgorithm topNAlgorithm; if ( selector.isHasExtractionFn() && dimension.equals(Column.TIME_COLUMN_NAME) ) { topNAlgorithm = new TimeExtractionTopNAlgorithm(capabilities, query); } else if (selector.isHasExtractionFn()) { topNAlgorithm = new DimExtractionTopNAlgorithm(capabilities, query); } else if (selector.isAggregateAllMetrics()) { topNAlgorithm = new PooledTopNAlgorithm(capabilities, query, bufferPool); } else if (selector.isAggregateTopNMetricFirst() || query.getContextValue("doAggregateTopNMetricFirst", false)) { topNAlgorithm = new AggregateTopNMetricFirstAlgorithm(capabilities, query, bufferPool); } else { topNAlgorithm = new PooledTopNAlgorithm(capabilities, query, bufferPool); } return new TopNMapFn(query, topNAlgorithm); }
Source:
<code>public String getTitleTextWithIndex(int index) { <START> return titles.get(index).getText(); <END> }</code><technical_language>accessing property, wait for element</technical_language>

Target:
public String getTitleTextWithIndex(int index) { WebElement selectedTitle = titles.get(index); wait.forElementVisible(selectedTitle); return selectedTitle.getText(); }
Source:
<code>private void update(Cell cell) { <START> if (isScannedDataRowCount(cell)) { <END> addScannedDataRowCount(getValue(cell)); } else if (isRebuiltIndexRowCount(cell)) { addRebuiltIndexRowCount(getValue(cell)); } else if (isBeforeRebuildValidIndexRowCount(cell)) { addBeforeRebuildValidIndexRowCount(getValue(cell)); } else if (isBeforeRebuildExpiredIndexRowCount(cell)) { addBeforeRebuildExpiredIndexRowCount(getValue(cell)); } else if (isBeforeRebuildMissingIndexRowCount(cell)) { addBeforeRebuildMissingIndexRowCount(getValue(cell)); } else if (isBeforeRebuildInvalidIndexRowCount(cell)) { addBeforeRebuildInvalidIndexRowCount(getValue(cell)); } else if (isAfterRebuildValidIndexRowCount(cell)) { addAfterRebuildValidIndexRowCount(getValue(cell)); } else if (isAfterRebuildExpiredIndexRowCount(cell)) { addAfterRebuildExpiredIndexRowCount(getValue(cell)); } else if (isAfterRebuildMissingIndexRowCount(cell)) { addAfterRebuildMissingIndexRowCount(getValue(cell)); } else if (isAfterRebuildInvalidIndexRowCount(cell)) { addAfterRebuildInvalidIndexRowCount(getValue(cell)); } }</code><technical_language>if this method knew phase in eliminate comparisons, right</technical_language>

Target:
private void update(Cell cell) { if (CellUtil.matchingColumn(cell, RESULT_TABLE_COLUMN_FAMILY, SCANNED_DATA_ROW_COUNT_BYTES)) { addScannedDataRowCount(getValue(cell)); } else if (CellUtil.matchingColumn(cell, RESULT_TABLE_COLUMN_FAMILY, REBUILT_INDEX_ROW_COUNT_BYTES)) { addRebuiltIndexRowCount(getValue(cell)); } else if (CellUtil.matchingColumn(cell, RESULT_TABLE_COLUMN_FAMILY, BEFORE_REBUILD_VALID_INDEX_ROW_COUNT_BYTES)) { addBeforeRebuildValidIndexRowCount(getValue(cell)); } else if (CellUtil.matchingColumn(cell, RESULT_TABLE_COLUMN_FAMILY, BEFORE_REBUILD_EXPIRED_INDEX_ROW_COUNT_BYTES)) { addBeforeRebuildExpiredIndexRowCount(getValue(cell)); } else if (CellUtil.matchingColumn(cell, RESULT_TABLE_COLUMN_FAMILY, BEFORE_REBUILD_MISSING_INDEX_ROW_COUNT_BYTES)) { addBeforeRebuildMissingIndexRowCount(getValue(cell)); } else if (CellUtil.matchingColumn(cell, RESULT_TABLE_COLUMN_FAMILY, BEFORE_REBUILD_INVALID_INDEX_ROW_COUNT_BYTES)) { addBeforeRebuildInvalidIndexRowCount(getValue(cell)); } else if (CellUtil.matchingColumn(cell, RESULT_TABLE_COLUMN_FAMILY, AFTER_REBUILD_VALID_INDEX_ROW_COUNT_BYTES)) { addAfterRebuildValidIndexRowCount(getValue(cell)); } else if (CellUtil.matchingColumn(cell, RESULT_TABLE_COLUMN_FAMILY, AFTER_REBUILD_EXPIRED_INDEX_ROW_COUNT_BYTES)) { addAfterRebuildExpiredIndexRowCount(getValue(cell)); } else if (CellUtil.matchingColumn(cell, RESULT_TABLE_COLUMN_FAMILY, AFTER_REBUILD_MISSING_INDEX_ROW_COUNT_BYTES)) { addAfterRebuildMissingIndexRowCount(getValue(cell)); } else if (CellUtil.matchingColumn(cell, RESULT_TABLE_COLUMN_FAMILY, AFTER_REBUILD_INVALID_INDEX_ROW_COUNT_BYTES)) { addAfterRebuildInvalidIndexRowCount(getValue(cell)); } }
Source:
<code>private void dumpYaml(Map<String, Object> generatedOutstandingRequests, Map<String, Object> generatedHeldLocks, File file) throws IOException { FileWriter writer = new FileWriter(file); <START> Yaml yaml = new Yaml(getRepresenter(), getDumperOptions()); <END> yaml.dump(generatedOutstandingRequests, writer); writer.append("\n\n---\n\n"); yaml.dump(generatedHeldLocks, writer); }</code><technical_language>group Yaml config class pass a file object dump. start move this class responsibility</technical_language>

Target:
private void dumpYaml(Map<String, Object> generatedOutstandingRequests, Map<String, Object> generatedHeldLocks, File file) throws IOException { YamlWriter writer = YamlWriter.create(file); writer.writeToYaml(generatedOutstandingRequests); writer.appendString("\n\n---\n\n"); writer.writeToYaml(generatedHeldLocks); }
Source:
<code>public Optional<P> authenticate(C credentials) throws AuthenticationException { final Timer.Context context = gets.time(); try { return cache.get(credentials); <START> } catch (UncheckedExecutionException|ExecutionException e) { <END> final Throwable cause = e.getCause(); if (cause instanceof InvalidCredentialsException) { return Optional.empty(); } Throwables.propagateIfPossible(cause, AuthenticationException.class); throw new AuthenticationException(Optional.ofNullable(cause).orElse(e)); } finally { context.stop(); } }</code><technical_language>I handle checked unchecked exceptions separately do checked exceptions do unchecked. that: java } catch (ExecutionException e) { final Throwable = e.getCause(); if (cause instanceof InvalidCredentialsException) { return Optional.empty(); } Throwables.propagateIfInstanceOf(cause, AuthenticationException.class); throw new AuthenticationException(cause); } catch (UncheckedExecutionException e) { throw Throwables.propagate(e.getCause()); }</technical_language>

Target:
public Optional<P> authenticate(C credentials) throws AuthenticationException { final Timer.Context context = gets.time(); try { return cache.get(credentials); } catch (ExecutionException e) { final Throwable cause = e.getCause(); if (cause instanceof InvalidCredentialsException) { return Optional.empty(); } Throwables.propagateIfPossible(cause, AuthenticationException.class); throw new AuthenticationException(cause); } catch (UncheckedExecutionException e) { throw Throwables.propagate(e.getCause()); } finally { context.stop(); } }
Source:
<code>public void log(LogRecord logRecord) { final java.util.logging.LogRecord julLogRecord = new java.util.logging.LogRecord( mapSeverity(logRecord.getSeverity()), logRecord.getCursor() != null ? logRecord.getCursor().toString() + ": " + logRecord.getMessage() : logRecord.getMessage()); <START> julLogRecord.setSourceClassName(logRecord.getSourceFileName()); <END> julLogRecord.setSourceMethodName(logRecord.getSourceMethodName()); LOGGER.log(julLogRecord); }</code><technical_language>cursor is captured here. I fixed locally adding julLogRecord.setParameters(new Object[] { logRecord.getCursor() });</technical_language>

Target:
public void log(LogRecord logRecord) { final java.util.logging.LogRecord julLogRecord = new java.util.logging.LogRecord( mapSeverity(logRecord.getSeverity()), logRecord.getCursor() != null ? logRecord.getCursor().toString() + ": " + logRecord.getMessage() : logRecord.getMessage()); julLogRecord.setSourceClassName(logRecord.getSourceFileName()); julLogRecord.setSourceMethodName(logRecord.getSourceMethodName()); julLogRecord.setParameters(new Object[] { logRecord.getCursor() }); LOGGER.log(julLogRecord); }
Source:
<code>private void checkInterceptorBindings() { if (interceptorMetadata.isEligible(org.jboss.weld.interceptor.spi.model.InterceptionType.POST_CONSTRUCT) || interceptorMetadata.isEligible(org.jboss.weld.interceptor.spi.model.InterceptionType.PRE_DESTROY) || interceptorMetadata.isEligible(org.jboss.weld.interceptor.spi.model.InterceptionType.POST_ACTIVATE) || interceptorMetadata.isEligible(org.jboss.weld.interceptor.spi.model.InterceptionType.PRE_PASSIVATE)) { for (Annotation interceptorBindingType : interceptorBindingTypes) { Target target = interceptorBindingType.annotationType().getAnnotation(Target.class); <START> if (target == null || hasInvalidTargetType(target.value())) { <END> throw ReflectionLogger.LOG.lifecycleCallbackInterceptorWithInvalidBindingTarget(this, interceptorBindingType.annotationType().getName(), target != null ? Arrays.toString(target.value()) : "Target meta-annotation is not present"); } } } }</code><technical_language>This is possibly a breaking change. instead log a warning for case missing @Target</technical_language>

Target:
private void checkInterceptorBindings() { if (interceptorMetadata.isEligible(org.jboss.weld.interceptor.spi.model.InterceptionType.POST_CONSTRUCT) || interceptorMetadata.isEligible(org.jboss.weld.interceptor.spi.model.InterceptionType.PRE_DESTROY) || interceptorMetadata.isEligible(org.jboss.weld.interceptor.spi.model.InterceptionType.POST_ACTIVATE) || interceptorMetadata.isEligible(org.jboss.weld.interceptor.spi.model.InterceptionType.PRE_PASSIVATE)) { for (Annotation interceptorBindingType : interceptorBindingTypes) { Target target = interceptorBindingType.annotationType().getAnnotation(Target.class); if (target == null || hasInvalidTargetType(target.value())) { ReflectionLogger.LOG.lifecycleCallbackInterceptorWithInvalidBindingTarget(this, interceptorBindingType.annotationType().getName(), target != null ? Arrays.toString(target.value()) : "Target meta-annotation is not present"); } } } }
Source:
<code>public void testLRUEntriesAreEvicted() { Map<Integer, Integer> map = new LRUMap<>(3); for (int i = 0; i < 3; i++) { map.put(i, i); } map.get(2); map.get(0); map.put(3, 3); Map<Integer, Integer> expectedMap = new HashMap<>(); expectedMap.put(2, 2); expectedMap.put(0, 0); expectedMap.put(3, 3); <START> Assert.assertEquals(expectedMap, map); <END> }</code><technical_language>This verify order. (The iteration order expectedMap is undefined)</technical_language>

Target:
public void testLRUEntriesAreEvicted() { Map<Integer, Integer> map = new LRUMap<>(3, 3); for (int i = 0; i < 3; i++) { map.put(i, i); } map.get(2); map.get(0); map.put(3, 3); Map<Integer, Integer> expectedMap = new LinkedHashMap<>(); expectedMap.put(2, 2); expectedMap.put(0, 0); expectedMap.put(3, 3); Assert.assertThat(map.entrySet(), IsIterableContainingInOrder .contains(expectedMap.entrySet().toArray())); }
Source:
<code>public String toString() { OwnerDTO owner = this.getOwner(); ReleaseDTO release = this.getReleaseVer(); return String.format("ActivationKeyDTO [id: %s, name: %s, description: %s, owner id: %s, " + "releaseVer: %s, serviceLevel: %s, autoAttach: %s, " + <START> "pools: %s, products: %s, contentOverrides: %s]", <END> this.getId(), this.getName(), this.getDescription(), owner != null ? owner.getId() : null, release != null ? release.getReleaseVer() : null, this.getServiceLevel(), this.isAutoAttach(), this.getPools(), this.getProducts(), this.getContentOverrides()); }</code><technical_language>While completeness is appreciated, toString is generally for logging. reduce amount of fields write log statements cleaner</technical_language>

Target:
public String toString() { return String.format("ActivationKeyDTO [id: %s, name: %s, description: %s]", this.getId(), this.getName(), this.getDescription()); }
Source:
<code>public void prepare() throws Exception { URL resource = getClass().getResource(PROJECT_PATH); <START> Path sourceFolder = get(resource.toURI()); <END> write(createFile(sourceFolder.resolve(".project")), format(PROJECT_FILE, PROJECT).getBytes()); write(createFile(sourceFolder.resolve(".classpath")), CLASSPATH_FILE.getBytes()); prjServiceClient.importProject(ws.getId(), sourceFolder, PROJECT, PLAIN_JAVA); cmdClient.createCommand(DEBUG_APP, START_DEBUG, CUSTOM, ws.getId()); ide.open(ws); projectExplorer.waitItem(PROJECT); projectExplorer.quickExpandWithJavaScript(); debugPanel.openDebugPanel(); projectExplorer.openItemByPath(PROJECT + PATH_TO_CLASS); editor.waitActive(); editor.setCursorToLine(18); editor.setBreakpoint(18); menu.runCommand(RUN_MENU, EDIT_DEBUG_CONFIGURATION); debugConfig.createConfig(PROJECT); cmdPalette.openCommandPalette(); cmdPalette.startCommandByDoubleClick(START_DEBUG); menu.runCommandByXpath( TestMenuCommandsConstants.Run.RUN_MENU, TestMenuCommandsConstants.Run.DEBUG, debugConfig.getXpathToІRunDebugCommand(PROJECT)); consoles.waitExpectedTextIntoConsole(TestBuildConstants.LISTENING_AT_ADDRESS_8000); }</code><technical_language>create .project .classpath files TestProjectServiceClient.importProject method in case if project is plain java project</technical_language>

Target:
public void prepare() throws Exception { URL resource = getClass().getResource(PROJECT_PATH); prjServiceClient.importProject(ws.getId(), get(resource.toURI()), PROJECT, PLAIN_JAVA); cmdClient.createCommand(DEBUG_APP, START_DEBUG, CUSTOM, ws.getId()); ide.open(ws); projectExplorer.waitItem(PROJECT); projectExplorer.quickExpandWithJavaScript(); debugPanel.openDebugPanel(); projectExplorer.openItemByPath(PROJECT + PATH_TO_CLASS); editor.waitActive(); editor.setCursorToLine(18); editor.setBreakpoint(18); menu.runCommand(RUN_MENU, EDIT_DEBUG_CONFIGURATION); debugConfig.createConfig(PROJECT); cmdPalette.openCommandPalette(); cmdPalette.startCommandByDoubleClick(START_DEBUG); menu.runCommandByXpath( TestMenuCommandsConstants.Run.RUN_MENU, TestMenuCommandsConstants.Run.DEBUG, debugConfig.getXpathToІRunDebugCommand(PROJECT)); consoles.waitExpectedTextIntoConsole(TestBuildConstants.LISTENING_AT_ADDRESS_8000); }
Source:
<code>public void run() { logger.trace("AsyncRequestWorker started"); AsyncRequestInfo requestInfo = null; try { while (isRunning()) { try { requestInfo = requests.take(); if (requestInfo.restRequest != null) { processRequest(requestInfo); logger.trace("Request was processed successfully", requestInfo.restRequest.getUri()); } else { break; } } catch (Exception e) { metrics.requestProcessingError.inc(); if (requestInfo != null) { onProcessingFailure(requestInfo.restRequest, requestInfo.restResponseChannel, e); } else { logger.error("Unexpected exception while processing requests", e); } } } } catch (Throwable t) { <START> logger.error("AsyncRequestWorker encountered a throwable", t); <END> } finally { running.set(false); discardRequests(); logger.trace("AsyncRequestWorker stopped"); shutdownLatch.countDown(); } }</code><technical_language>want rethrow printing? Also, if log here, this get printed higher up</technical_language>

Target:
public void run() { logger.trace("AsyncRequestWorker started"); AsyncRequestInfo requestInfo = null; try { while (isRunning()) { try { requestInfo = requests.take(); if (requestInfo.restRequest != null) { processRequest(requestInfo); logger.trace("Request was processed successfully", requestInfo.restRequest.getUri()); } else { break; } } catch (Exception e) { metrics.requestProcessingError.inc(); if (requestInfo != null) { onProcessingFailure(requestInfo.restRequest, requestInfo.restResponseChannel, e); } else { logger.error("Unexpected exception while processing requests", e); } } } } finally { running.set(false); discardRequests(); logger.trace("AsyncRequestWorker stopped"); shutdownLatch.countDown(); } }
Source:
<code>public void setData(IComponent component){ if ( !(component instanceof ICourse ) ) return; this.rootComponent = component; mData.clear(); this.sections = new SectionRow[0]; if ( rootComponent != null ) { ICourse course = (ICourse)rootComponent; int sectionsNumber = course.getChapters().size(); sections = new SectionRow[sectionsNumber]; int sectionPosition = 0, listPosition = 0; <START> for (char i=0; i<sectionsNumber; i++) { <END> IChapter chapter = course.getChapters().get(i); SectionRow section = new SectionRow(SectionRow.SECTION, chapter ); section.sectionPosition = sectionPosition; section.listPosition = listPosition++; sections[sectionPosition] = section; mData.add(section); List<ISequential> sequentials = chapter.getSequential(); for (int j=0;j<sequentials.size();j++) { SectionRow item = new SectionRow(SectionRow.ITEM, sequentials.get(j) ); item.sectionPosition = sectionPosition; item.listPosition = listPosition++; mData.add(item); } sectionPosition++; } } notifyDataSetChanged(); }</code><technical_language>looping a char is kind of weird</technical_language>

Target:
public void setData(IComponent component){ if ( !(component instanceof ICourse ) ) return; this.rootComponent = component; mData.clear(); this.sections = new SectionRow[0]; if ( rootComponent != null ) { ICourse course = (ICourse)rootComponent; int sectionsNumber = course.getChapters().size(); sections = new SectionRow[sectionsNumber]; int sectionPosition = 0, listPosition = 0; for (int i=0; i<sectionsNumber; i++) { IChapter chapter = course.getChapters().get(i); SectionRow section = new SectionRow(SectionRow.SECTION, chapter ); section.sectionPosition = sectionPosition; section.listPosition = listPosition++; sections[sectionPosition] = section; mData.add(section); List<ISequential> sequentials = chapter.getSequential(); for (int j=0;j<sequentials.size();j++) { SectionRow item = new SectionRow(SectionRow.ITEM, sequentials.get(j) ); item.sectionPosition = sectionPosition; item.listPosition = listPosition++; mData.add(item); } sectionPosition++; } } notifyDataSetChanged(); }
Source:
<code>private static void makeRequest(final String url, final String method, final JSONObject jsonBody, final ResponseHandler responseHandler, final int timeout, final String cacheKey) { if (method != null && OneSignal.shouldLogUserPrivacyConsentErrorMessageForMethodName(null)) return; <START> if (OSUtils.isThreadRunningOnMainThread()) <END> throw new OneSignalNetworkCallException("Method: " + method + " was called from the Main Thread!"); final Thread[] callbackThread = new Thread[1]; Thread connectionThread = new Thread(new Runnable() { public void run() { callbackThread[0] = startHTTPConnection(url, method, jsonBody, responseHandler, timeout, cacheKey); } }, "OS_HTTPConnection"); connectionThread.start(); try { connectionThread.join(getThreadTimeout(timeout)); if (connectionThread.getState() != Thread.State.TERMINATED) connectionThread.interrupt(); if (callbackThread[0] != null) callbackThread[0].join(); } catch (InterruptedException e) { e.printStackTrace(); } }</code><technical_language>put this privacy consent check. This means fail faster detect issues sooner if this a problem in future</technical_language>

Target:
private static void makeRequest(final String url, final String method, final JSONObject jsonBody, final ResponseHandler responseHandler, final int timeout, final String cacheKey) { if (OSUtils.isRunningOnMainThread()) throw new OneSignalNetworkCallException("Method: " + method + " was called from the Main Thread!"); if (method != null && OneSignal.shouldLogUserPrivacyConsentErrorMessageForMethodName(null)) return; final Thread[] callbackThread = new Thread[1]; Thread connectionThread = new Thread(new Runnable() { public void run() { callbackThread[0] = startHTTPConnection(url, method, jsonBody, responseHandler, timeout, cacheKey); } }, "OS_HTTPConnection"); connectionThread.start(); try { connectionThread.join(getThreadTimeout(timeout)); if (connectionThread.getState() != Thread.State.TERMINATED) connectionThread.interrupt(); if (callbackThread[0] != null) callbackThread[0].join(); } catch (InterruptedException e) { e.printStackTrace(); } }
Source:
<code>public int hashCode() { int result = getHostname().hashCode(); result = 31 * result + getPort(); result = 31 * result + getBatchSize(); result = 31 * result + getFlushPeriod().hashCode(); result = 31 * result + getMaxQueueSize().hashCode(); result = 31 * result + getDruidToGraphiteEventConverter().hashCode(); result = 31 * result + (getAlertEmitters() != null ? getAlertEmitters().hashCode() : 0); <START> result = 31 * result + (getRequestLogEmitters() != null ? getRequestLogEmitters().hashCode() : 0); <END> result = 31 * result + getEmitWaitTime().hashCode(); result = 31 * result + getWaitForEventTime().hashCode(); return result; }</code><technical_language>Objects.hash() in this method</technical_language>

Target:
public int hashCode() { int result = getHostname().hashCode(); result = 31 * result + getPort(); result = 31 * result + getBatchSize(); result = 31 * result + getProtocol().hashCode(); result = 31 * result + getFlushPeriod().hashCode(); result = 31 * result + getMaxQueueSize().hashCode(); result = 31 * result + getDruidToGraphiteEventConverter().hashCode(); result = 31 * result + (getAlertEmitters() != null ? getAlertEmitters().hashCode() : 0); result = 31 * result + (getRequestLogEmitters() != null ? getRequestLogEmitters().hashCode() : 0); result = 31 * result + getEmitWaitTime().hashCode(); result = 31 * result + getWaitForEventTime().hashCode(); return result; }
Source:
<code>public ArrayByteSource withFileName(String fileName) { ArgChecker.notNull(fileName, "fileName"); <START> return new ArrayByteSource(array, Paths.get(fileName).getFileName().toString()); <END> }</code><technical_language>Uhhh I this local default filesystem resolve filename, necessarily want</technical_language>

Target:
public ArrayByteSource withFileName(String fileName) { ArgChecker.notNull(fileName, "fileName"); int lastSlash = fileName.lastIndexOf('/'); return new ArrayByteSource(array, fileName.substring(lastSlash + 1)); }
Source:
<code>public VerificationMethod getVerificationType() { <START> Log.e("TAG", this.getVerificationMethod()); <END> if(this.getVerificationMethod().equals("E")) { return VerificationMethod.EMAIL; } else if (this.getVerificationMethod().equals("M")) { return VerificationMethod.MOBILE; } else { return VerificationMethod.NONE; } }</code><technical_language>Remove</technical_language>

Target:
public VerificationMethod getVerificationType() { if(this.getVerificationMethod().equals("E")) { return VerificationMethod.EMAIL; } else if (this.getVerificationMethod().equals("M")) { return VerificationMethod.MOBILE; } else { return VerificationMethod.NONE; } }
Source:
<code><START> public Collection<? extends GrantedAuthority> getAuthorities(User user) <END> { Set<GrantedAuthority> authorities = new LinkedHashSet<>(); if (user.isSuperuser() != null && user.isSuperuser()) { authorities.add(new SimpleGrantedAuthority(SecurityUtils.AUTHORITY_SU)); } if (user.getUsername().equals(SecurityUtils.ANONYMOUS_USERNAME)) { authorities.add(new SimpleGrantedAuthority(SecurityUtils.AUTHORITY_ANONYMOUS)); } else { authorities.add(new SimpleGrantedAuthority(AUTHORITY_USER)); } dataService.query(GROUP_MEMBERSHIP, GroupMembership.class) .eq(USER, user) .findAll() .filter(GroupMembership::isCurrentlyActive) .map(GroupMembership::getRole) .map(SidUtils::createRoleAuthority) .map(SimpleGrantedAuthority::new) .forEach(authorities::add); return grantedAuthoritiesMapper.mapAuthorities(authorities); }</code><technical_language>![CRITICAL](<LINK_0> 'Severity: CRITICAL') Remove usage of generic wildcard type. [![rule](<LINK_1>](<LINK_2></technical_language>

Target:
public Collection<? extends GrantedAuthority> getAuthorities(User user) { Set<GrantedAuthority> authorities = new LinkedHashSet<>(); if (user.isSuperuser() != null && user.isSuperuser()) { authorities.add(new SimpleGrantedAuthority(SecurityUtils.AUTHORITY_SU)); } if (user.getUsername().equals(SecurityUtils.ANONYMOUS_USERNAME)) { authorities.add(new SimpleGrantedAuthority(SecurityUtils.AUTHORITY_ANONYMOUS)); } else { authorities.add(new SimpleGrantedAuthority(AUTHORITY_USER)); } dataService.query(ROLE_MEMBERSHIP, RoleMembership.class) .eq(USER, user) .findAll() .filter(RoleMembership::isCurrent) .map(RoleMembership::getRole) .map(SidUtils::createRoleAuthority) .map(SimpleGrantedAuthority::new) .forEach(authorities::add); return grantedAuthoritiesMapper.mapAuthorities(authorities); }
Source:
<code><START> private <T> AnySuperTypeMatches(Predicate filter) { <END> this.filter = filter; }</code><technical_language>Generic type used, remove</technical_language>

Target:
private AnySuperTypeMatches(Predicate filter) { this.filter = filter; }
Source:
<code>public void testDefineBoolean() { db.getSharedHandle().setTemplateEngine(new StringTemplateEngine()); assertThat( <START> db.getSharedHandle().createQuery("select <a> from values(:a<if(b)>, :b shouldn't be defined<endif>)") <END> .defineNamedBindings() .bindBean(new DefinedBean()) .mapTo(boolean.class) .findOnly()) .isTrue(); }</code><technical_language>a test conditional is in clause? e.g. <if(b)>WHERE b = :b<endif></technical_language>

Target:
public void testDefineBoolean() { db.getSharedHandle().setTemplateEngine(new StringTemplateEngine()); assertThat( db.getSharedHandle().createQuery("select <a> from values(:a) <if(b)>where false=:b<endif>") .defineNamedBindings() .bindBean(new DefinedBean()) .mapTo(boolean.class) .findOnly()) .isTrue(); }
Source:
<code>private void read(SelectionKey key) throws InterruptedException, IOException { long startTimeInMs = SystemTime.getInstance().milliseconds(); <START> try { <END> SocketChannel socketChannel = (SocketChannel) key.channel(); BoundedByteBufferReceive input = null; if (key.attachment() == null) { input = new BoundedByteBufferReceive(); key.attach(input); } else { input = (BoundedByteBufferReceive) key.attachment(); } long bytesRead = input.readFrom(socketChannel); if (bytesRead == -1) { close(key); return; } logger.trace("bytes read from {}", socketChannel.socket().getRemoteSocketAddress()); if (input.isReadComplete()) { SocketServerRequest req = new SocketServerRequest(id, key, new ByteBufferInputStream(input.getPayload())); channel.sendRequest(req); key.attach(null); key.interestOps(key.interestOps() & (~SelectionKey.OP_READ)); logger.trace("resetting read interest for key for {}", ((SocketChannel) key.channel()).socket().getRemoteSocketAddress()); } else { if (logger.isTraceEnabled()) { logger.trace("Did not finish reading, registering for read again on connection {}", socketChannel.socket().getRemoteSocketAddress()); } key.interestOps(SelectionKey.OP_READ); wakeup(); } } finally { long readTime = SystemTime.getInstance().milliseconds() - startTimeInMs; logger.trace("SocketServer read piece of data from channel time = {}", readTime); } }</code><technical_language>startTimeToReadInMs</technical_language>

Target:
private void read(SelectionKey key) throws InterruptedException, IOException { long startTimeToReadInMs = SystemTime.getInstance().milliseconds(); try { SocketChannel socketChannel = (SocketChannel) key.channel(); BoundedByteBufferReceive input = null; if (key.attachment() == null) { input = new BoundedByteBufferReceive(); key.attach(input); } else { input = (BoundedByteBufferReceive) key.attachment(); } long bytesRead = input.readFrom(socketChannel); if (bytesRead == -1) { close(key); return; } logger.trace("bytes read from {}", socketChannel.socket().getRemoteSocketAddress()); if (input.isReadComplete()) { SocketServerRequest req = new SocketServerRequest(id, key, new ByteBufferInputStream(input.getPayload())); channel.sendRequest(req); key.attach(null); key.interestOps(key.interestOps() & (~SelectionKey.OP_READ)); logger.trace("resetting read interest for key for {}", ((SocketChannel) key.channel()).socket().getRemoteSocketAddress()); } else { if (logger.isTraceEnabled()) { logger.trace("Did not finish reading, registering for read again on connection {}", socketChannel.socket().getRemoteSocketAddress()); } key.interestOps(SelectionKey.OP_READ); wakeup(); } } finally { long readTime = SystemTime.getInstance().milliseconds() - startTimeToReadInMs; logger.trace("SocketServer time spent on read per key = {}", readTime); } }