auphong2707/dl4se-code-review-dataset huggingface dataset:
Source:
<code>public void setEnvironment(String value) { switch (value) { <START> case "LEGACY": <END> this.environment = CompilerOptions.Environment.BROWSER; break; case "CUSTOM": this.environment = CompilerOptions.Environment.CUSTOM; break; default: throw new BuildException( "Unrecognized 'environment' option value (" + value + ")"); } }</code><technical_language>change BROWSER</technical_language>

Target:
public void setEnvironment(String value) { switch (value) { case "BROWSER": this.environment = CompilerOptions.Environment.BROWSER; break; case "CUSTOM": this.environment = CompilerOptions.Environment.CUSTOM; break; default: throw new BuildException( "Unrecognized 'environment' option value (" + value + ")"); } }
Source:
<code>String getLiveness() { String liveness = UP; if (resourceStatePolicy.isHardDown()) { liveness = NODE_DOWN; } else if (resourceStatePolicy.isDown()) { liveness = SOFT_DOWN; } <START> return liveness; <END> }</code><technical_language>simplify line, no? if for readability, eliminate local variable do "return ..." everywhere</technical_language>

Target:
String getLiveness() { return resourceStatePolicy.isHardDown() ? NODE_DOWN : resourceStatePolicy.isDown() ? SOFT_DOWN : UP; }
Source:
<code>public void fetchEapMethods() throws Exception { <START> final List<MethodType> encodings = Lists.newArrayList(EAP_SIM, IDENTITY); <END> final List<String> list = Lists.newArrayList("EAP_SIM", "IDENTITY"); context.checking(new Expectations() {{ oneOf(methodCatalog).findAll(); will(returnValue(encodings)); }}); Reply<?> reply = endpoint.fetchEapMethods(); assertThat(reply, contains(list)); assertThat(reply, isOk()); }</code><technical_language>encodings ?|? name methods</technical_language>

Target:
public void fetchEapMethods() throws Exception { final List<Method> methods = Lists.newArrayList(EAP_SIM, IDENTITY); final List<String> dtos = Lists.newArrayList("EAP_SIM", "IDENTITY"); context.checking(new Expectations() {{ oneOf(methodCatalog).findAll(); will(returnValue(methods)); }}); Reply<?> reply = endpoint.fetchEapMethods(); assertThat(reply, contains(dtos)); assertThat(reply, isOk()); }
Source:
<code>public static UUID boundJobId(@Nullable Symbol jobId, CoordinatorTxnCtx txnCtx, Functions functions, Row parameters, SubQueryResults subQueryResults) { if (jobId != null) { try { return UUID.fromString( DataTypes.STRING.value( SymbolEvaluator.evaluate( txnCtx, functions, jobId, parameters, subQueryResults ))); } catch (Exception e) { <START> throw new IllegalArgumentException("Can not parse job ID", e); <END> } } return null; }</code><technical_language>suggestion throw new IllegalArgumentException("Can parse job ID: " + jobId, e);</technical_language>

Target:
public static UUID boundJobId(@Nullable Symbol jobId, CoordinatorTxnCtx txnCtx, Functions functions, Row parameters, SubQueryResults subQueryResults) { if (jobId != null) { try { return UUID.fromString( DataTypes.STRING.value( SymbolEvaluator.evaluate( txnCtx, functions, jobId, parameters, subQueryResults ))); } catch (Exception e) { throw new IllegalArgumentException("Can not parse job ID: " + jobId, e); } } return null; }
Source:
<code>public String toString() { <START> return "TdchParameters [_mrParams=" + _mrParams + ", _libJars=" + _libJars + ", _tdJdbcClassName=" <END> + _tdJdbcClassName + ", _tdUrl=" + _tdUrl + ", _fileFormat=" + _fileFormat + ", _fieldSeparator=" + _fieldSeparator + ", _jobType=" + _jobType + ", _userName=" + _userName + ", _tdPassword=" + getMaskedPassword() + ", _avroSchemaPath=" + _avroSchemaPath + ", _numMappers=" + _numMappers + ", _tdchType=" + _tdchType + ", _sourceHdfsPath=" + _sourceHdfsPath + ", _targetTdTableName=" + _targetTdTableName + ", _tdInsertMethod=" + _tdInsertMethod + ", _sourceQuery=" + _sourceQuery + ", _sourceTdTableName=" + _sourceTdTableName + ", _tdRetrieveMethod=" + _tdRetrieveMethod + ", _targetHdfsPath=" + _targetHdfsPath + "]"; }</code><technical_language>string.format stringBuilder more readable</technical_language>

Target:
public String toString() { StringBuilder builder = new StringBuilder(); builder.append("TdchParameters [_mrParams=").append(_mrParams) .append(", _libJars=").append(_libJars) .append(", _tdJdbcClassName=").append(_tdJdbcClassName) .append(", _tdUrl=").append(_tdUrl) .append(", _fileFormat=").append(_fileFormat) .append(", _fieldSeparator=").append(_fieldSeparator) .append(", _jobType=").append(_jobType) .append(", _userName=").append(_userName) .append(", _tdPassword=").append(getMaskedPassword()) .append(", _avroSchemaPath=").append(_avroSchemaPath) .append(", _numMappers=").append(_numMappers) .append(", _tdchType=").append(_tdchType) .append(", _sourceHdfsPath=").append(_sourceHdfsPath) .append(", _targetTdTableName=").append(_targetTdTableName) .append(", _tdInsertMethod=").append(_tdInsertMethod) .append(", _sourceQuery=").append(_sourceQuery) .append(", _sourceTdTableName=").append(_sourceTdTableName) .append(", _tdRetrieveMethod=").append(_tdRetrieveMethod) .append(", _targetHdfsPath=").append(_targetHdfsPath) .append("]"); return builder.toString(); }
Source:
<code>protected void nocache(final HttpServletResponse rsp) { <START> rsp.setHeader("Expires", "Fri, 01 Jan 1980 00:00:00 GMT"); <END> rsp.setHeader("Pragma", "no-cache"); rsp.setHeader("Cache-Control", "no-cache, must-revalidate"); }</code><technical_language>epoch is 1970, 1980 - reason for change? Functionally equivalent, of course</technical_language>

Target:
protected void nocache(final HttpServletResponse rsp) { rsp.setHeader("Expires", "Fri, 01 Jan 1980 00:00:00 GMT"); rsp.setHeader("Pragma", "no-cache"); rsp.setHeader("Cache-Control", "no-cache, max-age=0, must-revalidate"); }
Source:
<code>private void execute(final ITmfTrace trace) { if (fFinishedLatch.getCount() == 0) { return; } synchronized (syncObj) { if (fStarted) { return; } fStarted = true; } final Iterable<IAnalysisModule> dependentAnalyses = getDependentAnalyses(); for (IAnalysisModule module : dependentAnalyses) { module.schedule(); } <START> String jobName = NLS.bind(Messages.TmfAbstractAnalysisModule_RunningAnalysis, getName()); <END> fJob = new Job(jobName) { @Override protected @Nullable IStatus run(final @Nullable IProgressMonitor monitor) { IProgressMonitor mon = monitor; if (mon == null) { mon = new NullProgressMonitor(); } try { mon.beginTask("", IProgressMonitor.UNKNOWN); broadcast(new TmfStartAnalysisSignal(TmfAbstractAnalysisModule.this, TmfAbstractAnalysisModule.this)); fAnalysisCancelled = !executeAnalysis(mon); for (IAnalysisModule module : dependentAnalyses) { module.waitForCompletion(mon); } } catch (TmfAnalysisException e) { Activator.logError("Error executing analysis with trace " + trace.getName(), e); } finally { synchronized (syncObj) { mon.done(); setAnalysisCompleted(); } TmfTraceManager.refreshSupplementaryFiles(trace); } if (!fAnalysisCancelled) { return Status.OK_STATUS; } resetAnalysis(); return Status.CANCEL_STATUS; } @Override protected void canceling() { TmfAbstractAnalysisModule.this.canceling(); } }; fJob.schedule(); }</code><technical_language>Missing call checkNotNull extra warning</technical_language>

Target:
private void execute(final ITmfTrace trace) { if (fFinishedLatch.getCount() == 0) { return; } synchronized (syncObj) { if (fStarted) { return; } fStarted = true; } final Iterable<IAnalysisModule> dependentAnalyses = getDependentAnalyses(); for (IAnalysisModule module : dependentAnalyses) { module.schedule(); } String jobName = checkNotNull(NLS.bind(Messages.TmfAbstractAnalysisModule_RunningAnalysis, getName())); fJob = new Job(jobName) { @Override protected @Nullable IStatus run(final @Nullable IProgressMonitor monitor) { IProgressMonitor mon = monitor; if (mon == null) { mon = new NullProgressMonitor(); } try { mon.beginTask("", IProgressMonitor.UNKNOWN); broadcast(new TmfStartAnalysisSignal(TmfAbstractAnalysisModule.this, TmfAbstractAnalysisModule.this)); fAnalysisCancelled = !executeAnalysis(mon); for (IAnalysisModule module : dependentAnalyses) { module.waitForCompletion(mon); } } catch (TmfAnalysisException e) { Activator.logError("Error executing analysis with trace " + trace.getName(), e); } finally { synchronized (syncObj) { mon.done(); setAnalysisCompleted(); } TmfTraceManager.refreshSupplementaryFiles(trace); } if (!fAnalysisCancelled) { return Status.OK_STATUS; } resetAnalysis(); return Status.CANCEL_STATUS; } @Override protected void canceling() { TmfAbstractAnalysisModule.this.canceling(); } }; fJob.schedule(); }
Source:
<code>public static ThreadGroup[] getAllThreadGroups() { final ThreadGroup systemThreadGroup = getSystemThreadGroup(); int estimatedThreadGroupCount = systemThreadGroup.activeGroupCount(); int threadGroupCount = 0; ThreadGroup[] threadGroups; do { estimatedThreadGroupCount *= 2; threadGroups = new ThreadGroup[estimatedThreadGroupCount]; threadGroupCount = systemThreadGroup.enumerate(threadGroups); <START> } while (threadGroupCount == estimatedThreadGroupCount); <END> final ThreadGroup[] allGroups = new ThreadGroup[threadGroupCount+1]; allGroups[0] = systemThreadGroup; System.arraycopy(threadGroups, 0, allGroups, 1, threadGroupCount); return allGroups; }</code><technical_language>this comparison is wrong, shouldnt threadGroupCount > estimatedThreadGroupCount</technical_language>

Target:
public static Collection<ThreadGroup> getAllThreadGroups() { return selectThreadGroups(ALWAYS_TRUE_PREDICATE); }
Source:
<code>private ModuleType verifyModuleOfTypeExists(ModuleDeploymentRequest request, String moduleName, ModuleType type) { ModuleDefinition def = moduleDefinitionRepository.findByNameAndType(moduleName, type); if (def == null || def.getResource() == null) { List<ModuleDefinition> definitions = moduleDefinitionRepository.findByName(moduleName); <START> if (definitions == null || definitions.size() == 0) { <END> throw new NoSuchModuleException(moduleName); } return definitions.get(0).getType(); } return def.getType(); }</code><technical_language>Code smell: clarify contract of repository emptyness</technical_language>

Target:
private ModuleType verifyModuleOfTypeExists(ModuleDeploymentRequest request, String moduleName, ModuleType type) { ModuleDefinition def = moduleDefinitionRepository.findByNameAndType(moduleName, type); if (def == null || def.getResource() == null) { List<ModuleDefinition> definitions = moduleDefinitionRepository.findByName(moduleName); if (definitions.isEmpty()) { throw new NoSuchModuleException(moduleName); } return definitions.get(0).getType(); } return def.getType(); }
Source:
<code><START> public String createEntityType(DataCollection dataCollection) <END> { String entityTypeId = idGenerator.generateId(); EntityType entityType = entityTypeFactory.create(); entityType.setPackage(defaultPackage); entityType.setId(entityTypeId); entityType.setLabel(dataCollection.getName()); entityType.addAttribute(createIdAttribute(), ROLE_ID); dataCollection.getColumns().forEach(column -> entityType.addAttribute(createAttribute(column))); metaDataService.addEntityType(entityType); AtomicInteger rowIndex = new AtomicInteger(0); List<Entity> rows = newArrayList(); while (rowIndex.get() < dataCollection.getNumberOfRows()) { Entity row = entityManager.create(entityType, NO_POPULATE); row.setIdValue(idGenerator.generateId()); final int finalRowIndex = rowIndex.getAndIncrement(); dataCollection.getColumns() .forEach(column -> row.set(column.getName(), column.getDataValues().get(finalRowIndex))); rows.add(row); } dataService.add(entityType.getId(), rows.stream()); return entityTypeId; }</code><technical_language>Type String , service tightly coupled</technical_language>

Target:
public EntityType createEntityType(DataCollection dataCollection) { String entityTypeId = idGenerator.generateId(); EntityType entityType = entityTypeFactory.create(); entityType.setPackage(defaultPackage); entityType.setId(entityTypeId); entityType.setLabel(dataCollection.getName()); entityType.addAttribute(createIdAttribute(), ROLE_ID); dataCollection.getColumns().forEach(column -> { Attribute attribute = createAttribute(column); entityType.addAttribute(attribute); }); metaDataService.addEntityType(entityType); AtomicInteger rowIndex = new AtomicInteger(0); List<Entity> rows = newArrayList(); while (rowIndex.get() < dataCollection.getNumberOfRows()) { Entity row = entityManager.create(entityType, NO_POPULATE); row.setIdValue(idGenerator.generateId()); int index = rowIndex.getAndIncrement(); dataCollection.getColumns().forEach(column -> setRowValueForAttribute(row, index, column)); rows.add(row); } dataService.add(entityType.getId(), rows.stream()); return entityType; }
Source:
<code>public static void tearDown() throws InterruptedException, TimeoutException, IOException, OperationException { operations.removeIfExists(C_HANDLER_ADDRESS); <START> administration.reloadIfRequired(); <END> operations.removeIfExists(C_HANDLER_TB_REMOVED_ADDRESS); administration.reloadIfRequired(); }</code><technical_language>consecutive reloads necessary reload end sufficient</technical_language>

Target:
public static void tearDown() throws InterruptedException, TimeoutException, IOException, OperationException { operations.removeIfExists(C_HANDLER_ADDRESS); operations.removeIfExists(C_HANDLER_TB_REMOVED_ADDRESS); administration.reloadIfRequired(); }
Source:
<code>private void handleIntent(Intent intent) { if (Intent.ACTION_VIEW.equals(intent.getAction()) && intent.getData() != null) { Site site = new Site(intent.getData().getAuthority()); PageTitle title = site.titleForUri(intent.getData()); HistoryEntry historyEntry = new HistoryEntry(title, HistoryEntry.SOURCE_EXTERNAL_LINK); displayPageInForegroundTab(title, historyEntry); } else if (ACTION_PAGE_FOR_TITLE.equals(intent.getAction())) { <START> hideLinkPreview(); <END> PageTitle title = intent.getParcelableExtra(EXTRA_PAGETITLE); HistoryEntry historyEntry = intent.getParcelableExtra(EXTRA_HISTORYENTRY); displayNewPage(title, historyEntry); } else if (Intent.ACTION_SEARCH.equals(intent.getAction())) { String query = intent.getStringExtra(SearchManager.QUERY); PageTitle title = new PageTitle(query, app.getPrimarySite()); HistoryEntry historyEntry = new HistoryEntry(title, HistoryEntry.SOURCE_SEARCH); displayPageInForegroundTab(title, historyEntry); } else if (Intent.ACTION_SEND.equals(intent.getAction()) && PLAIN_TEXT_MIME_TYPE.equals(intent.getType())) { handleShareIntent(intent); } else if (intent.hasExtra(EXTRA_SEARCH_FROM_WIDGET)) { new WidgetsFunnel(app).logSearchWidgetTap(); openSearch(); } else if (intent.hasExtra(EXTRA_FEATURED_ARTICLE_FROM_WIDGET)) { new WidgetsFunnel(app).logFeaturedArticleWidgetTap(); displayMainPageInForegroundTab(); } else { displayMainPageIfNoTabs(); } }</code><technical_language>do this top of displayNewPage() function, capture other cases this possible</technical_language>

Target:
private void handleIntent(Intent intent) { if (Intent.ACTION_VIEW.equals(intent.getAction()) && intent.getData() != null) { Site site = new Site(intent.getData().getAuthority()); PageTitle title = site.titleForUri(intent.getData()); HistoryEntry historyEntry = new HistoryEntry(title, HistoryEntry.SOURCE_EXTERNAL_LINK); displayPageInForegroundTab(title, historyEntry); } else if (ACTION_PAGE_FOR_TITLE.equals(intent.getAction())) { PageTitle title = intent.getParcelableExtra(EXTRA_PAGETITLE); HistoryEntry historyEntry = intent.getParcelableExtra(EXTRA_HISTORYENTRY); displayNewPage(title, historyEntry); } else if (Intent.ACTION_SEARCH.equals(intent.getAction())) { String query = intent.getStringExtra(SearchManager.QUERY); PageTitle title = new PageTitle(query, app.getPrimarySite()); HistoryEntry historyEntry = new HistoryEntry(title, HistoryEntry.SOURCE_SEARCH); displayPageInForegroundTab(title, historyEntry); } else if (Intent.ACTION_SEND.equals(intent.getAction()) && PLAIN_TEXT_MIME_TYPE.equals(intent.getType())) { handleShareIntent(intent); } else if (intent.hasExtra(EXTRA_SEARCH_FROM_WIDGET)) { new WidgetsFunnel(app).logSearchWidgetTap(); openSearch(); } else if (intent.hasExtra(EXTRA_FEATURED_ARTICLE_FROM_WIDGET)) { new WidgetsFunnel(app).logFeaturedArticleWidgetTap(); displayMainPageInForegroundTab(); } else { displayMainPageIfNoTabs(); } }
Source:
<code>private double getWeightValue(Tuple input){ double weight = 1.0; if(StringUtils.isNotBlank(modelConfig.getWeightColumnName())) { for(ColumnConfig columnConfig: columnConfigList) { <START> if(columnConfig.getColumnName().equalsIgnoreCase(modelConfig.getWeightColumnName().trim())) { <END> int columnId = columnConfig.getColumnNum(); try { weight = Double.parseDouble(((DataByteArray) input.get(columnId)).toString()); } catch (ExecException ignore) { } break; } } } return weight; }</code><technical_language>above, bad performance</technical_language>

Target:
private double getWeightValue(Tuple input){ double weight = 1.0; int columnId = getWeightColumnId(); if(columnId != INVALID_INDEX){ try { weight = Double.parseDouble(String.valueOf(input.get(columnId))); } catch (ExecException ignore) { } } return weight; }
Source:
<code>private void loadDefinitions() { PageService contentService = ContentServiceFactory.create(new Site(pageTitle.getSite().getLanguageCode() + WIKTIONARY_DOMAIN)); if (contentService instanceof RbContentService) { ((RbContentService) contentService).define( addUnderscores(selectedText), definitionOnLoadCallback); } else { FeedbackUtil.showMessage(getActivity(), <START> "Wiktionary definitions require mobile content service loading!"); <END> } }</code><technical_language>I thought this require a string resource thought this case happen, right</technical_language>

Target:
private void loadDefinitions() { PageService contentService = ContentServiceFactory.create(new Site(pageTitle.getSite().getLanguageCode() + WIKTIONARY_DOMAIN)); if (contentService instanceof RbContentService) { ((RbContentService) contentService).define( addUnderscores(selectedText), definitionOnLoadCallback); } else { L.e("Wiktionary definitions require mobile content service loading!"); displayNoDefinitionsFound(); } }
Source:
<code>private void sendEquivalentContentChangedMessage(Content content, EquivalenceGraph graph) throws MessagingException { <START> contentUpdatedMessageSender.sendMessage( <END> new EquivalentContentUpdatedMessage( UUID.randomUUID().toString(), Timestamp.of(DateTime.now(DateTimeZone.UTC)), graph.getId().longValue(), content.toRef() ), getPartitionKey(graph.getId()) ); }</code><technical_language>do send content change messages now? changed content..</technical_language>

Target:
private void sendEquivalentContentChangedMessage(Content content, EquivalenceGraph graph) throws MessagingException { equivContentUpdatedMessageSender.sendMessage( new EquivalentContentUpdatedMessage( UUID.randomUUID().toString(), Timestamp.of(DateTime.now(DateTimeZone.UTC)), graph.getId().longValue(), content.toRef() ), getPartitionKey(graph.getId()) ); }
Source:
<code>public TrackStatistics (final long trackId, ContentResolver cr) { this.trackId = trackId; <START> contentResolver = cr; <END> length = 0; maxSpeed = 0; pointCount = 0; timeMoving = 0; update(); }</code><technical_language>Another reason initialise declaring fields I guess, repeat initialisation code there</technical_language>

Target:
public TrackStatistics (final long trackId, ContentResolver cr) { this.trackId = trackId; contentResolver = cr; update(); }
Source:
<code>public boolean isChildPolicyAllowed(SchedulingPolicy childPolicy) throws AllocationConfigurationException { <START> throw new AllocationConfigurationException(getName() + " policy is only for" <END> + " leaf queues. Please choose policies other than " + getName() + " for parent queues."); }</code><technical_language>return false</technical_language>

Target:
public boolean isChildPolicyAllowed(SchedulingPolicy childPolicy) { LOG.error(getName() + " policy is only for leaf queues. Please choose " + DominantResourceFairnessPolicy.NAME + " or " + FairSharePolicy.NAME + " for parent queues."); return false; }
Source:
<code>private TNonblockingTransport getTransport(FrameBuffer frameBuffer) { try { return (TNonblockingTransport) fbTansportField.get(frameBuffer); } catch (IllegalArgumentException | IllegalAccessException e) { <START> throw new RuntimeException(e); <END> } }</code><technical_language>I this is copied Thrift, unnecessary wrap RTE a new RTE</technical_language>

Target:
private TNonblockingTransport getTransport(FrameBuffer frameBuffer) { try { return (TNonblockingTransport) fbTansportField.get(frameBuffer); } catch (IllegalAccessException e) { throw new RuntimeException(e); } }
Source:
<code>public int readToEndOfSegment() throws Exception { <START> int end = (m_totalRead/47 + 1) * 47; <END> boolean done = false; int numRead = 0; for (int i=m_totalRead; i<end && !done; i++) { BBContainer bbC = m_reader.poll(PersistentBinaryDeque.UNSAFE_CONTAINER_FACTORY); if (bbC==null) { done = true; continue; } numRead++; bbC.discard(); } return numRead; }</code><technical_language>whats significance of 47? constant</technical_language>

Target:
public int readToEndOfSegment() throws Exception { int end = (m_totalRead/s_segmentFillCount + 1) * s_segmentFillCount; boolean done = false; int numRead = 0; for (int i=m_totalRead; i<end && !done; i++) { BBContainer bbC = m_reader.poll(PersistentBinaryDeque.UNSAFE_CONTAINER_FACTORY); if (bbC==null) { done = true; continue; } numRead++; bbC.discard(); } return numRead; }
Source:
<code>public CompletionStage<Void> removeRecoveryInformationFromCluster(Collection<Address> where, long internalId) { if (rpcManager != null) { TxCompletionNotificationCommand ftc = commandFactory.buildTxCompletionNotificationCommand(internalId); CompletionStage<Void> stage = sendTxCompletionNotification(where, ftc); <START> return stage.thenRun(() -> removeRecoveryInformation(internalId)); <END> } else { removeRecoveryInformation(internalId); return CompletableFutures.completedNull(); } }</code><technical_language>need wait for tx completion responses removing local info either, removing local info is expensive send command first</technical_language>

Target:
public CompletionStage<Void> removeRecoveryInformationFromCluster(Collection<Address> where, long internalId) { if (rpcManager != null) { TxCompletionNotificationCommand ftc = commandFactory.buildTxCompletionNotificationCommand(internalId); CompletionStage<Void> stage = sendTxCompletionNotification(where, ftc); removeRecoveryInformation(internalId); return stage; } else { removeRecoveryInformation(internalId); return CompletableFutures.completedNull(); } }
Source:
<code>public boolean equals(Object obj) { if (obj instanceof Entry) { Entry<?, ?> other = (Entry<?, ?>) obj; Object k1 = entry.getKey(); @SuppressWarnings("unchecked") Object k2 = (other instanceof CaseInsentiveEntry) ? ((CaseInsentiveEntry<K, V>) other).entry.getKey() : other.getKey(); <START> if (Objects.equals(k1, k2)) { <END> if (Objects.equals(entry.getValue(), other.getValue())) { return true; } } } return false; }</code><technical_language>This simplified Objects.equals && Objects.equals avoid nested if statements</technical_language>

Target:
public boolean equals(Object obj) { if (obj instanceof Entry) { Entry<?, ?> other = (Entry<?, ?>) obj; Object k1 = entry.getKey(); @SuppressWarnings("unchecked") Object k2 = (other instanceof CaseInsentiveEntry) ? ((CaseInsentiveEntry<K, V>) other).entry.getKey() : other.getKey(); return Objects.equals(k1, k2) && Objects.equals(entry.getValue(), other.getValue()); } return false; }
Source:
<code>private static String parameters(ITestResult testResult) { Object[] parameters = testResult.getParameters(); <START> if (parameters != null) { <END> StringBuilder builder = new StringBuilder(); for (Object parameter : parameters) { if (parameter instanceof Method) { builder.append(((Method) parameter).getName()); } } if (builder.length() != 0) { return "[" + builder.toString() + "]"; } } return ""; }</code><technical_language>I quick return helps highlight important code check code: java if (parameters == null) { return ""; } // ..</technical_language>

Target:
private static String parameters(ITestResult testResult) { Object[] parameters = testResult.getParameters(); if (parameters == null) { return ""; } String returnValue = ""; StringBuilder builder = new StringBuilder(); for (Object parameter : parameters) { if (parameter instanceof Method) { builder.append(((Method) parameter).getName()); } } if (builder.length() != 0) { returnValue = "[" + builder.toString() + "]"; } return returnValue; }
Source:
<code>protected void executeCommand() { getStorageDomain().setStorageFormat( VersionStorageFormatUtil.getPreferredForVersion( <START> getStoragePool().getcompatibility_version(), getStoragePool().getStorageType())); <END> super.executeCommand(); if (getSucceeded()) { VdcReturnValueBase returnValue = Backend.getInstance() .runInternalAction( VdcActionType.AttachStorageDomainToPool, new StorageDomainPoolParametersBase(getStorageDomain().getId(), getStoragePool().getId())); if(!returnValue.getSucceeded()) { getReturnValue().setSucceeded(false); getReturnValue().setFault(returnValue.getFault()); } } }</code><technical_language>Currently Tal is working remove storageType checks storage pool level getStoragePool().getStorageType() available. More local storage is limited local data center StorageType.LOCALFS</technical_language>

Target:
protected void executeCommand() { getStorageDomain().setStorageFormat( VersionStorageFormatUtil.getPreferredForVersion( getStoragePool().getcompatibility_version(), getStorageDomain().getStorageType())); super.executeCommand(); if (getSucceeded()) { VdcReturnValueBase returnValue = Backend.getInstance() .runInternalAction( VdcActionType.AttachStorageDomainToPool, new StorageDomainPoolParametersBase(getStorageDomain().getId(), getStoragePool().getId())); if(!returnValue.getSucceeded()) { getReturnValue().setSucceeded(false); getReturnValue().setFault(returnValue.getFault()); } } }
Source:
<code>private LogEntry getLogEntryByRevision(ILogEntry[] entries, String revision) { for (ILogEntry <START> entrie : <END> entries) { if (entrie.getRevision().equals(revision) && entrie instanceof LogEntry) { return (LogEntry) entrie; } } return null; }</code><technical_language>entry</technical_language>

Target:
private LogEntry getLogEntryByRevision(ILogEntry[] entries, String revision) { for (ILogEntry entry : entries) { if (entry.getRevision().equals(revision) && entry instanceof LogEntry) { return (LogEntry) entry; } } return null; }
Source:
<code>private RequestFuture<ListOffsetResult> sendListOffsetRequest(final Node node, final Map<TopicPartition, ListOffsetRequest.PartitionData> timestampsToSearch, boolean requireTimestamp) { ListOffsetRequest.Builder builder = ListOffsetRequest.Builder .forConsumer(requireTimestamp, isolationLevel) .setTargetTimes(timestampsToSearch); <START> log.error("[CHIA] Sending ListOffsetRequest to broker {}", builder, node); <END> return client.send(node, builder) .compose(new RequestFutureAdapter<ClientResponse, ListOffsetResult>() { @Override public void onSuccess(ClientResponse response, RequestFuture<ListOffsetResult> future) { ListOffsetResponse lor = (ListOffsetResponse) response.responseBody(); log.trace("Received ListOffsetResponse from broker {}", lor, node); handleListOffsetResponse(timestampsToSearch, lor, future); } }); }</code><technical_language>Revert</technical_language>

Target:
private RequestFuture<ListOffsetResult> sendListOffsetRequest(final Node node, final Map<TopicPartition, ListOffsetRequest.PartitionData> timestampsToSearch, boolean requireTimestamp) { ListOffsetRequest.Builder builder = ListOffsetRequest.Builder .forConsumer(requireTimestamp, isolationLevel) .setTargetTimes(timestampsToSearch); log.debug("Sending ListOffsetRequest to broker {}", builder, node); return client.send(node, builder) .compose(new RequestFutureAdapter<ClientResponse, ListOffsetResult>() { @Override public void onSuccess(ClientResponse response, RequestFuture<ListOffsetResult> future) { ListOffsetResponse lor = (ListOffsetResponse) response.responseBody(); log.trace("Received ListOffsetResponse from broker {}", lor, node); handleListOffsetResponse(timestampsToSearch, lor, future); } }); }
Source:
<code>public void emit(Bundle bundle) { log.debug("output: {}", bundle); getOutput().send(bundle); outputCountMetric.inc(); processedMeterMetric.mark(); totalEmit.incrementAndGet(); <START> bundleTimeSum.addAndGet(getBundleTime(bundle) >> 8); <END> }</code><technical_language>guard this if statement</technical_language>

Target:
public void emit(Bundle bundle) { log.debug("output: {}", bundle); getOutput().send(bundle); outputCountMetric.inc(); processedMeterMetric.mark(); totalEmit.incrementAndGet(); if (timeField != null) bundleTimeSum.addAndGet(getBundleTime(bundle) >> 8); }
Source:
<code>public List<BlockLocationInfo> getBlockLocations(AlluxioURI alluxioURI) throws IOException { <START> Path path = toPath(alluxioURI); <END> BlockLocation[] fileBlockLocations = fileSystem.getFileBlockLocations(path, 0, path.toString().length()); Arrays.stream(fileBlockLocations).map(this::toBlockLocationInfo).collect(Collectors.toList()); throw new UnsupportedOperationException("GetBlockLocations is not supported."); }</code><technical_language>throw some operations</technical_language>

Target:
public List<BlockLocationInfo> getBlockLocations(AlluxioURI alluxioURI) { throw new UnsupportedOperationException("GetBlockLocations is not supported."); }
Source:
<code>default CurrentTransferSegment createTransferSegment(long start, long end, SegmentState state) { if (state == RESTORED || state == TRANSFERRED) { return CurrentTransferSegment .builder() <START> .status( <END> CurrentTransferSegmentStatus .builder() .totalTransferred(end - start + 1) .segmentState(state) .build() ) .startAddress(start) .endAddress(end) .build(); } else { return CurrentTransferSegment .builder() .status( CurrentTransferSegmentStatus .builder() .totalTransferred(0L) .segmentState(state) .causeOfFailure(Optional.of(new TransferSegmentFailure())) .build() ) .startAddress(start) .endAddress(end) .build(); } }</code><technical_language>Add java doc</technical_language>

Target:
default TransferSegment createTransferSegment(long start, long end, SegmentState state) { if (state == RESTORED || state == TRANSFERRED) { return TransferSegment .builder() .status( builder() .totalTransferred(end - start + 1) .segmentState(state) .build() ) .startAddress(start) .endAddress(end) .build(); } else if(state == NOT_TRANSFERRED){ return TransferSegment .builder() .status( builder() .totalTransferred(0L) .segmentState(state) .build() ) .startAddress(start) .endAddress(end) .build(); } else { return TransferSegment .builder() .status(builder() .totalTransferred(0L) .segmentState(state) .causeOfFailure(Optional.of(new TransferSegmentException())) .build() ) .startAddress(start) .endAddress(end) .build(); } }
Source:
<code>public IItemFilter read(@Nonnull Registry registry, @Nonnull Set<NBTAction> phase, @Nonnull NBTTagCompound nbt, @Nullable Field field, @Nonnull String name, @Nullable IItemFilter object) throws IllegalArgumentException, IllegalAccessException, InstantiationException, NoHandlerFoundException { if (object == null) { if (nbt.hasKey(name)) { object = FilterRegistry.loadFilterFromNbt(nbt.getCompoundTag(name)); <START> } else { <END> return object; } } object.readFromNBT(nbt.getCompoundTag(name)); return object; }</code><technical_language>fallthrough readFromNBT in line 47. Intended</technical_language>

Target:
public IItemFilter read(@Nonnull Registry registry, @Nonnull Set<NBTAction> phase, @Nonnull NBTTagCompound nbt, @Nullable Field field, @Nonnull String name, @Nullable IItemFilter object) throws IllegalArgumentException, IllegalAccessException, InstantiationException, NoHandlerFoundException { if (object == null && !nbt.hasKey(name)) { return object; } object = FilterRegistry.loadFilterFromNbt(nbt.getCompoundTag(name)); return object; }
Source:
<code>public boolean isDeferJavaScriptLoading() { ConfigurationService cs = Framework.getService(ConfigurationService.class); <START> return cs.getBoolean(DEFER_JS_PROP, true); <END> }</code><technical_language>Default false</technical_language>

Target:
public boolean isDeferJavaScriptLoading() { ConfigurationService cs = Framework.getService(ConfigurationService.class); return cs.isBooleanTrue(DEFER_JS_PROP); }
Source:
<code>public void shutdown() { log.warn("Shutdown discovery service"); shutdown = true; <START> <END> if (replicationManager != null) { replicationManager.stop(); } if(clusterManagerAdapter != null) { clusterManagerAdapter.shutdown(); } executorService.shutdownNow(); }</code><technical_language>Do need if (runtime != null) { runtime.shutdown(); }</technical_language>

Target:
public void shutdown() { log.warn("Shutdown discovery service"); shutdown = true; if (replicationManager != null) { replicationManager.stop(); } if(clusterManagerAdapter != null) { clusterManagerAdapter.shutdown(); } if (runtime != null) { runtime.shutdown(); } executorService.shutdownNow(); }
Source:
<code>public synchronized void setPinned(boolean pinned) { if (pinned) { ITmfTrace trace = getTrace(); if (trace == null) { if (fPinAction != null) { fPinAction.setChecked(false); } return; } TmfSignalManager.addIgnoredInboundSignal(this, TmfTraceOpenedSignal.class); TmfSignalManager.addIgnoredInboundSignal(this, TmfTraceSelectedSignal.class); <START> setPartName(String.format("%s - %s", fOriginalTabLabel, trace.getName())); END> } else { TmfSignalManager.removeIgnoredInboundSignal(this, TmfTraceOpenedSignal.class); TmfSignalManager.removeIgnoredInboundSignal(this, TmfTraceSelectedSignal.class); setPartName(fOriginalTabLabel); ITmfTrace trace = TmfTraceManager.getInstance().getActiveTrace(); if (trace != null && !trace.equals(fTrace)) { loadTrace(trace); } else { refresh(); } } if (fPinAction != null) { fPinAction.setChecked(pinned); } }</code><technical_language><%s> ? strong feelings, consistent Variables view</technical_language>

Target:
public synchronized void setPinned(boolean pinned) { if (pinned) { ITmfTrace trace = getTrace(); if (trace == null) { if (fPinAction != null) { fPinAction.setChecked(false); } return; } TmfSignalManager.addIgnoredInboundSignal(this, TmfTraceOpenedSignal.class); TmfSignalManager.addIgnoredInboundSignal(this, TmfTraceSelectedSignal.class); setPartName(String.format("%s <%s>", fOriginalTabLabel, trace.getName())); } else { TmfSignalManager.removeIgnoredInboundSignal(this, TmfTraceOpenedSignal.class); TmfSignalManager.removeIgnoredInboundSignal(this, TmfTraceSelectedSignal.class); setPartName(fOriginalTabLabel); ITmfTrace trace = TmfTraceManager.getInstance().getActiveTrace(); if (trace != null && !trace.equals(fTrace)) { loadTrace(trace); } else { refresh(); } } if (fPinAction != null) { fPinAction.setChecked(pinned); } }
Source:
<code>private static String replace(final String text, String searchString, final String replacement, int max, final boolean ignoreCase) { if (isEmpty(text) || isEmpty(searchString) || replacement == null || max == 0) { return text; } String searchText = text; if (ignoreCase) { searchText = text.toLowerCase(); searchString = searchString.toLowerCase(); } int start = 0; int end = searchText.indexOf(searchString, start); if (end == INDEX_NOT_FOUND) { return text; } final int replLength = searchString.length(); int increase = replacement.length() - replLength; increase = Math.max(increase, 0); <START> increase *= Math.min(max, 0); <END> final StringBuilder buf = new StringBuilder(text.length() + increase); while (end != INDEX_NOT_FOUND) { buf.append(text, start, end).append(replacement); start = end + replLength; if (--max == 0) { break; } end = searchText.indexOf(searchString, start); } buf.append(text, start, text.length()); return buf.toString(); }</code><technical_language>this correct bounds 16 64</technical_language>

Target:
private static String replace(final String text, String searchString, final String replacement, int max, final boolean ignoreCase) { if (isEmpty(text) || isEmpty(searchString) || replacement == null || max == 0) { return text; } String searchText = text; if (ignoreCase) { searchText = text.toLowerCase(); searchString = searchString.toLowerCase(); } int start = 0; int end = searchText.indexOf(searchString, start); if (end == INDEX_NOT_FOUND) { return text; } final int replLength = searchString.length(); int increase = replacement.length() - replLength; increase = Math.max(increase, 0); increase *= max < 0 ? 16 : Math.min(max, 64); final StringBuilder buf = new StringBuilder(text.length() + increase); while (end != INDEX_NOT_FOUND) { buf.append(text, start, end).append(replacement); start = end + replLength; if (--max == 0) { break; } end = searchText.indexOf(searchString, start); } buf.append(text, start, text.length()); return buf.toString(); }
Source:
<code>static synchronized <E extends BaseRealm> E createRealmOrGetFromCache(RealmConfiguration configuration, Class<E> realmClass) { boolean isCacheInMap = true; RealmCache cache = cachesMap.get(configuration.getPath()); if (cache == null) { cache = new RealmCache(configuration); isCacheInMap = false; } else { cache.validateConfiguration(configuration); } RefAndCount refAndCount = cache.refAndCountMap.get(RealmCacheType.valueOf(realmClass)); if (refAndCount.localRealm.get() == null) { BaseRealm realm; if (realmClass == Realm.class) { <START> if (configuration.getDurability() != SharedGroup.Durability.MEM_ONLY) { <END> copyAssetFile(configuration); } realm = Realm.createInstance(configuration, cache.typedColumnIndices); } else if (realmClass == DynamicRealm.class) { realm = DynamicRealm.createInstance(configuration); } else { throw new IllegalArgumentException(WRONG_REALM_CLASS_MESSAGE); } if (!isCacheInMap) { cachesMap.put(configuration.getPath(), cache); } refAndCount.localRealm.set(realm); refAndCount.localCount.set(0); } Integer refCount = refAndCount.localCount.get(); if (refCount == 0) { if (realmClass == Realm.class && refAndCount.globalCount == 0) { cache.typedColumnIndices = refAndCount.localRealm.get().schema.columnIndices; } refAndCount.globalCount++; } refAndCount.localCount.set(refCount + 1); @SuppressWarnings("unchecked") E realm = (E) refAndCount.localRealm.get(); return realm; }</code><technical_language>I move this check inMemory() in builder instead throw exception instead</technical_language>

Target:
static synchronized <E extends BaseRealm> E createRealmOrGetFromCache(RealmConfiguration configuration, Class<E> realmClass) { boolean isCacheInMap = true; RealmCache cache = cachesMap.get(configuration.getPath()); if (cache == null) { cache = new RealmCache(configuration); isCacheInMap = false; copyAssetFileIfNeeded(configuration); } else { cache.validateConfiguration(configuration); } RefAndCount refAndCount = cache.refAndCountMap.get(RealmCacheType.valueOf(realmClass)); if (refAndCount.localRealm.get() == null) { BaseRealm realm; if (realmClass == Realm.class) { realm = Realm.createInstance(configuration, cache.typedColumnIndices); } else if (realmClass == DynamicRealm.class) { realm = DynamicRealm.createInstance(configuration); } else { throw new IllegalArgumentException(WRONG_REALM_CLASS_MESSAGE); } if (!isCacheInMap) { cachesMap.put(configuration.getPath(), cache); } refAndCount.localRealm.set(realm); refAndCount.localCount.set(0); } Integer refCount = refAndCount.localCount.get(); if (refCount == 0) { if (realmClass == Realm.class && refAndCount.globalCount == 0) { cache.typedColumnIndices = refAndCount.localRealm.get().schema.columnIndices; } refAndCount.globalCount++; } refAndCount.localCount.set(refCount + 1); @SuppressWarnings("unchecked") E realm = (E) refAndCount.localRealm.get(); return realm; }
Source:
<code>private static boolean authorized(PerunSession sess, String policyDefinition, List<PerunBean> objects) throws PolicyNotExistsException { if (!sess.getPerunPrincipal().isAuthzInitialized()) { refreshAuthz(sess); } if (sess.getPerunPrincipal().getRoles() == null) { return false; } List<JsonNode> allPolicies = fetchPolicyWithAllIncludedPolicies(policyDefinition); List<JsonNode> policyRoles = new ArrayList<>(); for (JsonNode policy : allPolicies) policyRoles.addAll(fetchPolicyRoles(policy)); List<PerunBean> allReliableObjects = fetchAllReliableObjects(objects); <START> Map <String, List<PerunBean>> mapOfBeans = new HashMap<>(); <END> for (PerunBean object: allReliableObjects) { if (!mapOfBeans.containsKey(object.getBeanName())) { List<PerunBean> listOfbeans = new ArrayList<>(); listOfbeans.add(object); mapOfBeans.put(object.getBeanName(), listOfbeans); } else mapOfBeans.get(object.getBeanName()).add(object); } return resolveAuthorization(sess, policyRoles, mapOfBeans); }</code><technical_language>call this method. do need do in iteration</technical_language>

Target:
public static boolean authorized(PerunSession sess, String policyDefinition, List<PerunBean> objects) throws PolicyNotExistsException { if (!sess.getPerunPrincipal().isAuthzInitialized()) { refreshAuthz(sess); } if (sess.getPerunPrincipal().getRoles() == null) { return false; } List<PerunPolicy> allPolicies = AuthzResolverImpl.fetchPolicyWithAllIncludedPolicies(policyDefinition); List<Map<String, String>> policyRoles = new ArrayList<>(); for (PerunPolicy policy : allPolicies) policyRoles.addAll(policy.getPerunRoles()); Map <String, Set<Integer>> mapOfBeans = fetchAllRelatedObjects(objects); return resolveAuthorization(sess, policyRoles, mapOfBeans); }
Source:
<code>private void runAllParagraphs(NotebookSocket conn, Message fromMessage) throws IOException { final String noteId = (String) fromMessage.get("noteId"); List<Map<String, Object>> paragraphs = gson.fromJson(String.valueOf(fromMessage.data.get("paragraphs")), new TypeToken<List<Map<String, Object>>>() { }.getType()); Note note = notebook().getNote(noteId); try { <START> note.setRunning(true); <END> getNotebookService().runAllParagraphs(noteId, paragraphs, getServiceContext(fromMessage), new WebSocketServiceCallback<Paragraph>(conn)); } finally { note.setRunning(false); } }</code><technical_language>move this operation NotebookService</technical_language>

Target:
private void runAllParagraphs(NotebookSocket conn, Message fromMessage) throws IOException { final String noteId = (String) fromMessage.get("noteId"); List<Map<String, Object>> paragraphs = gson.fromJson(String.valueOf(fromMessage.data.get("paragraphs")), new TypeToken<List<Map<String, Object>>>() { }.getType()); getNotebookService().runAllParagraphs(noteId, paragraphs, getServiceContext(fromMessage), new WebSocketServiceCallback<Paragraph>(conn)); }
Source:
<code>protected void addAllocationColumn() { ArrayList<String> allocationTypes = new ArrayList<>(); allocationTypes.add(constants.thinAllocation()); allocationTypes.add(constants.preallocatedAllocation()); customSelectionCellFormatType = new CustomSelectionCell(allocationTypes); <START> customSelectionCellFormatType.setStyle(""); END> AbstractColumn<DiskImage, String> allocationColumn = new AbstractColumn<DiskImage, String>( customSelectionCellFormatType) { @Override public String getValue(DiskImage disk) { ImportDiskData importData = importModel.getDiskImportData(disk.getId()); if (importData == null) { return ""; } return new EnumRenderer<VolumeType>().render(VolumeType.forValue(importData.getSelectedVolumeType() .getValue())); } @Override public SafeHtml getTooltip(DiskImage object) { return SafeHtmlUtils.fromSafeConstant(constants.importAllocationModifiedCollapse()); } }; allocationColumn.setFieldUpdater(new FieldUpdater<DiskImage, String>() { @Override public void update(int index, DiskImage disk, String value) { VolumeType tempVolumeType = VolumeType.Sparse; if (value.equals(constants.thinAllocation())) { tempVolumeType = VolumeType.Sparse; } else if (value.equals(constants.preallocatedAllocation())) { tempVolumeType = VolumeType.Preallocated; } ImportDiskData importData = importModel.getDiskImportData(disk.getId()); if (importData != null) { importData.setSelectedVolumeType(tempVolumeType); } } }); diskTable.addColumn(allocationColumn, constants.allocationDisk(), "150px"); }</code><technical_language>necessary</technical_language>

Target:
protected void addAllocationColumn() { ArrayList<String> allocationTypes = new ArrayList<>(); allocationTypes.add(constants.thinAllocation()); allocationTypes.add(constants.preallocatedAllocation()); customSelectionCellFormatType = new CustomSelectionCell(allocationTypes); customSelectionCellFormatType.setStyle(EMPTY_STYLE); AbstractColumn<DiskImage, String> allocationColumn = new AbstractColumn<DiskImage, String>( customSelectionCellFormatType) { @Override public String getValue(DiskImage disk) { ImportDiskData importData = importModel.getDiskImportData(disk.getId()); if (importData == null) { return ""; } return new EnumRenderer<VolumeType>().render(VolumeType.forValue(importData.getSelectedVolumeType() .getValue())); } @Override public SafeHtml getTooltip(DiskImage object) { return SafeHtmlUtils.fromSafeConstant(constants.importAllocationModifiedCollapse()); } }; allocationColumn.setFieldUpdater(new FieldUpdater<DiskImage, String>() { @Override public void update(int index, DiskImage disk, String value) { VolumeType tempVolumeType = VolumeType.Sparse; if (value.equals(constants.thinAllocation())) { tempVolumeType = VolumeType.Sparse; } else if (value.equals(constants.preallocatedAllocation())) { tempVolumeType = VolumeType.Preallocated; } ImportDiskData importData = importModel.getDiskImportData(disk.getId()); if (importData != null) { importData.setSelectedVolumeType(tempVolumeType); } } }); diskTable.addColumn(allocationColumn, constants.allocationDisk(), "150px"); }
Source:
<code>public static void refreshBundles(BundleContext bundleContext, Set<Bundle> bundles) { <START> bundleContext.getBundle(0).adapt(FrameworkWiring.class).refreshBundles(bundles); <END> }</code><technical_language>get system bundle location org.osgi.framework.Constants.SYSTEM_BUNDLE_LOCATION constant. This is guarantee get non-null. Equinox regions hide bundle ID 0 you</technical_language>

Target:
public static void refreshBundles(BundleContext bundleContext, Set<Bundle> bundles) { bundleContext.getBundle(SYSTEM_BUNDLE_LOCATION).adapt(FrameworkWiring.class).refreshBundles(bundles); }
Source:
<code>public MetaDataMutationResult dropIndex(List<Mutation> tableMetadata, String tableName) throws SQLException { <START> throw new UnsupportedOperationException(); <END> }</code><technical_language>here, dropTable: return new MetaDataMutationResult(MutationCode.TABLE_ALREADY_EXISTS, 0, null);</technical_language>

Target:
public MetaDataMutationResult dropIndex(List<Mutation> tableMetadata, String tableName) throws SQLException { return new MetaDataMutationResult(MutationCode.TABLE_ALREADY_EXISTS, 0, null); }
Source:
<code>private void onCRUD(Item item, String action) { try { <START> final boolean emitSystemEvents = DatadogUtilities.getDatadogGlobalDescriptor().isEmitSystemEvents(); if (!emitSystemEvents) { return; } <END> logger.fine("Start DatadogItemListener#on" + action); DatadogClient client = DatadogUtilities.getDatadogClient(); Map<String, Set<String>> tags = DatadogUtilities.getDatadogGlobalDescriptor().getGlobalTags(); DatadogEvent event = new ItemCRUDEventImpl(item, action, tags); client.sendEvent(event.createPayload()); String hostname = DatadogUtilities.getHostname("null"); client.incrementCounter("jenkins.item." + action.toLowerCase(), hostname, tags); logger.fine("End DatadogItemListener#on" + action); } catch (Exception e) { logger.warning("Unexpected exception occurred - " + e.getMessage()); } }</code><technical_language>Is a this check in a top-level place avoid this Listener method ? instantiation for example, register listeners</technical_language>

Target:
private void onCRUD(Item item, String action) { try { final boolean emitSystemEvents = DatadogUtilities.getDatadogGlobalDescriptor().isEmitSystemEvents(); if (!emitSystemEvents) { return; } logger.fine("Start DatadogItemListener#on" + action); DatadogClient client = DatadogUtilities.getDatadogClient(); Map<String, Set<String>> tags = DatadogUtilities.getTagsFromGlobalTags(); DatadogEvent event = new ItemCRUDEventImpl(item, action, tags); client.sendEvent(event.createPayload()); String hostname = DatadogUtilities.getHostname("null"); client.incrementCounter("jenkins.item." + action.toLowerCase(), hostname, tags); logger.fine("End DatadogItemListener#on" + action); } catch (Exception e) { logger.warning("Unexpected exception occurred - " + e.getMessage()); } }