auphong2707/dl4se-code-review-dataset huggingface dataset:
Source:
<code>protected @Nullable ITmfTreeViewerEntry updateElements(long start, long end, boolean isSelection) { if (isSelection || (start == end)) { return null; } TmfAbstractAnalysisModule analysisModule = getStatisticsAnalysisModule(); if (getTrace() == null || !(analysisModule instanceof AbstractSegmentStatisticsAnalysis)) { return null; } AbstractSegmentStatisticsAnalysis module = (AbstractSegmentStatisticsAnalysis) analysisModule; module.waitForCompletion(); TmfTreeViewerEntry root = new TmfTreeViewerEntry(""); final SegmentStoreStatistics entry = module.getTotalStats(); if (entry != null) { List<ITmfTreeViewerEntry> entryList = root.getChildren(); TmfTreeViewerEntry aggregateEntry = new SegmentStoreStatisticsEntry(getTotalLabel(), entry); entryList.add(aggregateEntry); HiddenTreeViewerEntry category = new HiddenTreeViewerEntry(getHiddenTreeLabel()); aggregateEntry.addChild(category); Map<String, SegmentStoreStatistics> <START> perSyscallStats = <END> module.getPerSegmentTypeStats(); if (perSyscallStats != null) { for (Entry<String, SegmentStoreStatistics> statsEntry : perSyscallStats.entrySet()) { category.addChild(new SegmentStoreStatisticsEntry(statsEntry.getKey(), statsEntry.getValue())); } } } return root; }</code><technical_language>rename this variable</technical_language>

Target:
protected @Nullable ITmfTreeViewerEntry updateElements(long start, long end, boolean isSelection) { if (isSelection || (start == end)) { return null; } TmfAbstractAnalysisModule analysisModule = getStatisticsAnalysisModule(); if (getTrace() == null || !(analysisModule instanceof AbstractSegmentStatisticsAnalysis)) { return null; } AbstractSegmentStatisticsAnalysis module = (AbstractSegmentStatisticsAnalysis) analysisModule; module.waitForCompletion(); TmfTreeViewerEntry root = new TmfTreeViewerEntry(""); final SegmentStoreStatistics entry = module.getTotalStats(); if (entry != null) { List<ITmfTreeViewerEntry> entryList = root.getChildren(); TmfTreeViewerEntry aggregateEntry = new SegmentStoreStatisticsEntry(getTotalLabel(), entry); entryList.add(aggregateEntry); HiddenTreeViewerEntry category = new HiddenTreeViewerEntry(getTypeLabel()); aggregateEntry.addChild(category); Map<String, SegmentStoreStatistics> perSegmentStats = module.getPerSegmentTypeStats(); if (perSegmentStats != null) { for (Entry<String, SegmentStoreStatistics> statsEntry : perSegmentStats.entrySet()) { category.addChild(new SegmentStoreStatisticsEntry(statsEntry.getKey(), statsEntry.getValue())); } } } return root; }
Source:
<code>public static Set<String> getBrokerInstancesForTenant(List<InstanceConfig> instanceConfigs, String tenant) { <START> return getBrokerInstanceConfigsForTenant(instanceConfigs, tenant).stream().map(InstanceConfig::getInstanceName).collect( Collectors.toSet()); <END> }</code><technical_language>suggestion return new HashSet<>(getInstancesWithTag(instanceConfigs, TagNameUtils.getBrokerTagForTenant(tenant)));</technical_language>

Target:
public static Set<String> getBrokerInstancesForTenant(List<InstanceConfig> instanceConfigs, String tenant) { return new HashSet<>(getInstancesWithTag(instanceConfigs, TagNameUtils.getBrokerTagForTenant(tenant))); }
Source:
<code>public void accept(Event<T> structuredEvent) { try { T data = structuredEvent.getData(); CDPOperationDetails operation = data.getOperation(); CDPEventDataExtractor<T> extractor = eventDataExtractorMap.get(operation.getEventType().name().toLowerCase() + "CDPEventDataExtractor"); LOGGER.info("Extract audit event as {}", extractor); AuditEvent event = AuditEvent.builder() .withAccountId(operation.getAccountId()) .withActor(ActorCrn.builder().withActorCrn(operation.getUserCrn()).build()) .withEventData(extractor.eventData(data)) .withEventName(extractor.eventName(data)) .withEventSource(extractor.eventSource(data)) .withSourceIp(extractor.sourceIp(data)) .build(); auditClient.createAuditEvent(event); } catch (UnsupportedOperationException e) { LOGGER.debug("Audit log is unnecessary: {}", e.getMessage()); } catch (Exception e) { <START> LOGGER.error("Cannot perform auditing: {}", e.getMessage(), e); <END> } }</code><technical_language>Warn level enough here, is a warning propagating error audit event send and/or processed</technical_language>

Target:
public void accept(Event<T> structuredEvent) { try { T data = structuredEvent.getData(); CDPOperationDetails operation = data.getOperation(); CDPEventDataExtractor<T> extractor = eventDataExtractorMap.get(operation.getEventType().name().toLowerCase() + "CDPEventDataExtractor"); LOGGER.info("Extract audit event as {}", extractor); AuditEvent event = AuditEvent.builder() .withAccountId(operation.getAccountId()) .withActor(ActorCrn.builder().withActorCrn(operation.getUserCrn()).build()) .withEventData(extractor.eventData(data)) .withEventName(extractor.eventName(data)) .withEventSource(extractor.eventSource(data)) .withSourceIp(extractor.sourceIp(data)) .build(); auditClient.createAuditEvent(event); } catch (UnsupportedOperationException e) { LOGGER.debug("Audit log is unnecessary: {}", e.getMessage()); } catch (Exception e) { LOGGER.warn("Cannot perform auditing: {}", e.getMessage(), e); } }
Source:
<code>public String getSingleSlotValue(String customSlotName, IdentifiableType identifiableType) { if (identifiableType != null) { <START> List<SlotType1> slots = identifiableType.getSlot(); <END> for (SlotType1 s : slots) { if (StringUtils.equalsIgnoreCase(customSlotName, s.getName()) && s.getValueList() != null) { ValueListType vlt = s.getValueList(); if ((vlt.getValue() != null) && (!vlt.getValue().isEmpty())){ return vlt.getValue().get(0); } } } } return null; }</code><technical_language>This line merged enhanced for, instead of a separate declaration. Also, identifiableType.getSlot() null? If so, append a check in if statement above</technical_language>

Target:
public String getSingleSlotValue(String customSlotName, IdentifiableType identifiableType) { if (identifiableType != null && (identifiableType.getSlot() != null)) { for (SlotType1 s : identifiableType.getSlot()) { if (StringUtils.equalsIgnoreCase(customSlotName, s.getName()) && s.getValueList() != null) { ValueListType vlt = s.getValueList(); if (vlt.getValue() != null && !vlt.getValue().isEmpty()){ return vlt.getValue().get(0); } } } } return null; }
Source:
<code>protected void flushBufferedData() { if (buffer.isEmpty()) { return; } logger.debug("Writing buffered data. Buffer size: {}", buffer.size()); for (;;) { Map<String, Deque<DynamoDBItem<?>>> itemsByTable = readBuffer(); for (Entry<String, Deque<DynamoDBItem<?>>> entry : itemsByTable.entrySet()) { String tableName = entry.getKey(); Deque<DynamoDBItem<?>> batch = entry.getValue(); if (dbConfig.isAutoExpirationEnabled()){ for (DynamoDBItem<?> batchItem: batch){ <START> Instant expiration = batchItem.getTime().toInstant().plus(dbConfig.getAutoExpirationDays(), ChronoUnit.DAYS); <END> batchItem.setExpiration(expiration.getEpochSecond()); } } if (!batch.isEmpty()) { flushBatch(getDBMapper(tableName), batch); } } if (buffer.isEmpty()) { break; } } }</code><technical_language>toInstant allowed I believe... This repo is pre-java8? EDIT: build pass... @openhab/maintainers: rely java8 features this repo</technical_language>

Target:
protected void flushBufferedData() { if (buffer.isEmpty()) { return; } logger.debug("Writing buffered data. Buffer size: {}", buffer.size()); for (;;) { Map<String, Deque<DynamoDBItem<?>>> itemsByTable = readBuffer(); for (Entry<String, Deque<DynamoDBItem<?>>> entry : itemsByTable.entrySet()) { String tableName = entry.getKey(); Deque<DynamoDBItem<?>> batch = entry.getValue(); if (dbConfig.isAutoExpirationEnabled()){ for (DynamoDBItem<?> batchItem: batch){ Instant expiration = batchItem.getTime().toInstant().plus(dbConfig.getAutoExpirationDays(), ChronoUnit.DAYS); batchItem.setExpirationDateEpochSeconds(expiration.getEpochSecond()); } } if (!batch.isEmpty()) { flushBatch(getDBMapper(tableName), batch); } } if (buffer.isEmpty()) { break; } } }
Source:
<code>protected void addContent(HttpContent httpContent) throws RestServiceException { if (!getRestMethod().equals(RestMethod.POST) && (!(httpContent instanceof LastHttpContent) || httpContent.content().readableBytes() > 0)) { throw new IllegalStateException("There is no content expected for " + getRestMethod()); } else { contentLock.lock(); try { if (!isOpen()) { <START> nettyMetrics.requestAlreadyClosedError.inc(); <END> throw new RestServiceException("The request has been closed and is not accepting content", RestServiceErrorCode.RequestChannelClosed); } else if (writeChannel != null) { writeContent(writeChannel, callbackWrapper, httpContent); } else { requestContents.add(httpContent); ReferenceCountUtil.retain(httpContent); } } finally { contentLock.unlock(); } } }</code><technical_language>I guess do this check of lock (contentLock)</technical_language>

Target:
protected void addContent(HttpContent httpContent) throws RestServiceException { if (!getRestMethod().equals(RestMethod.POST) && (!(httpContent instanceof LastHttpContent) || httpContent.content().readableBytes() > 0)) { throw new IllegalStateException("There is no content expected for " + getRestMethod()); } else { contentLock.lock(); try { if (!isOpen()) { nettyMetrics.requestAlreadyClosedError.inc(); throw new RestServiceException("The request has been closed and is not accepting content", RestServiceErrorCode.RequestChannelClosed); } else if (writeChannel != null) { writeContent(writeChannel, callbackWrapper, httpContent); } else { requestContents.add(ReferenceCountUtil.retain(httpContent)); } } finally { contentLock.unlock(); } } }
Source:
<code>public void testNoEnforceValidityErrorsOrWarnings() throws Exception { Dictionary<String, Object> markerPluginProps = configureValidationMarkerPlugin( Collections.singletonList(SAMPLE_VALIDATOR), false, false, getAdminConfig()); String warningId = ingestXmlFromResourceAndWait(WARNING_METACARD); String cleanId = ingestXmlFromResourceAndWait(CLEAN_METACARD); String errorId = ingestXmlFromResourceAndWait(ERROR_METACARD); query(cleanId, TRANSFORMER_XML, HttpStatus.SC_OK); query(warningId, TRANSFORMER_XML, HttpStatus.SC_OK); query(errorId, TRANSFORMER_XML, HttpStatus.SC_OK); String warningData = getFileContent(WARNING_METACARD); String errorData = getFileContent(ERROR_METACARD); update(cleanId, warningData, MediaType.APPLICATION_XML, HttpStatus.SC_OK); update(cleanId, errorData, MediaType.APPLICATION_XML, HttpStatus.SC_OK); <START> configureValidationMarkerPlugin(markerPluginProps, getAdminConfig()); <END> }</code><technical_language>is reset if test failed before</technical_language>

Target:
public void testNoEnforceValidityErrorsOrWarnings() throws Exception { Dictionary<String, Object> markerPluginProps = configureValidationMarkerPlugin( Collections.singletonList(SAMPLE_VALIDATOR), false, false, getAdminConfig()); try { String warningId = ingestXmlFromResourceAndWait(WARNING_METACARD); String cleanId = ingestXmlFromResourceAndWait(CLEAN_METACARD); String errorId = ingestXmlFromResourceAndWait(ERROR_METACARD); query(cleanId, TRANSFORMER_XML, HttpStatus.SC_OK); query(warningId, TRANSFORMER_XML, HttpStatus.SC_OK); query(errorId, TRANSFORMER_XML, HttpStatus.SC_OK); String warningData = getFileContent(WARNING_METACARD); String errorData = getFileContent(ERROR_METACARD); update(cleanId, warningData, MediaType.APPLICATION_XML, HttpStatus.SC_OK); update(cleanId, errorData, MediaType.APPLICATION_XML, HttpStatus.SC_OK); } finally { configureValidationMarkerPlugin(markerPluginProps, getAdminConfig()); } }
Source:
<code>public <U> TupleDomain<U> transform(Function<T, U> function) { if (!domains.isPresent()) { return TupleDomain.none(); } <START> LinkedHashMap<U, Domain> result = new LinkedHashMap<>(domains.get().size()); <END> for (Map.Entry<T, Domain> entry : domains.get().entrySet()) { U key = function.apply(entry.getKey()); if (key == null) { continue; } Domain previous = result.put(key, entry.getValue()); if (previous != null) { throw new IllegalArgumentException(String.format("Every argument must have a unique mapping. %s maps to %s and %s", entry.getKey(), entry.getValue(), previous)); } } return TupleDomain.withColumnDomains(result); }</code><technical_language>change declaration</technical_language>

Target:
public <U> TupleDomain<U> transform(Function<T, U> function) { if (!domains.isPresent()) { return TupleDomain.none(); } HashMap<U, Domain> result = new LinkedHashMap<>(domains.get().size()); for (Map.Entry<T, Domain> entry : domains.get().entrySet()) { U key = function.apply(entry.getKey()); if (key == null) { continue; } Domain previous = result.put(key, entry.getValue()); if (previous != null) { throw new IllegalArgumentException(String.format("Every argument must have a unique mapping. %s maps to %s and %s", entry.getKey(), entry.getValue(), previous)); } } return TupleDomain.withColumnDomains(result); }
Source:
<code>private String resolvePath() { String result = getResourcePath(); <START> if (SystemUtils.IS_OS_WINDOWS && result.matches("^/[A-Z]:/dev/.*")) { <END> result = result.replaceFirst("^/[A-Z]:", ""); } else if (SystemUtils.IS_OS_WINDOWS && result.startsWith("/")) { result = result.substring(1); } return result; }</code><technical_language>Actually.... if avoid addFileSystemBind (that [creates a mountable file](<LINK_0> bind API for SHM? This ~~hack~~ adjustment solve problem too, I fixing in wrong place. WDYT</technical_language>

Target:
private String resolvePath() { String result = getResourcePath(); if (SystemUtils.IS_OS_WINDOWS && result.startsWith("/")) { result = result.substring(1); } return result; }
Source:
<code>public boolean isOwnedBy(String username) { return getAuthor().getUsername().compareTo(username) == 0; <START> } <END></code><technical_language>getUsername().isEqual()</technical_language>

Target:
public boolean isOwnedBy(String username) { return getAuthor().getUsername().equals(username); }
Source:
<code>protected void endMoveVmCommand() { <START> incrementDbGeeneration(); <END> endActionOnAllImageGroups(); if (getVm() != null) { VmHandler.UnLockVm(getVm()); VmHandler.updateDisksFromDb(getVm()); } else { setCommandShouldBeLogged(false); log.warn("MoveVmCommand::EndMoveVmCommand: Vm is null - not performing full EndAction"); } setSucceeded(true); }</code><technical_language>Compilation error /s/incrementDbGeeneration/incrementDbGeneration</technical_language>

Target:
protected void endMoveVmCommand() { incrementDbGeneration(); endActionOnAllImageGroups(); if (getVm() != null) { VmHandler.UnLockVm(getVm()); VmHandler.updateDisksFromDb(getVm()); } else { setCommandShouldBeLogged(false); log.warn("MoveVmCommand::EndMoveVmCommand: Vm is null - not performing full EndAction"); } setSucceeded(true); }
Source:
<code>public static void setUp() throws Exception { conf = new HdfsConfiguration(); conf.setBoolean(DFSConfigKeys.DFS_NAMENODE_REPLICATION_CONSIDERLOAD_KEY, false); localFileSys = FileSystem.getLocal(conf); Path workingDir = localFileSys.getWorkingDirectory(); <START> dir = new Path(workingDir, "target/test/data" + "work-dir/decommission"); <END> assertTrue(localFileSys.mkdirs(dir)); excludeFile = new Path(dir, "exclude"); conf.set(DFSConfigKeys.DFS_HOSTS_EXCLUDE, excludeFile.toUri().getPath()); Path includeFile = new Path(dir, "include"); conf.set(DFSConfigKeys.DFS_HOSTS, includeFile.toUri().getPath()); conf.setInt(DFSConfigKeys.DFS_NAMENODE_HEARTBEAT_RECHECK_INTERVAL_KEY, 1000); conf.setInt(DFSConfigKeys.DFS_HEARTBEAT_INTERVAL_KEY, 1); conf.setInt(DFSConfigKeys.DFS_NAMENODE_REPLICATION_PENDING_TIMEOUT_SEC_KEY, 4); conf.setInt(DFSConfigKeys.DFS_NAMENODE_REPLICATION_INTERVAL_KEY, 1000); conf.setInt(DFSConfigKeys.DFS_NAMENODE_DECOMMISSION_INTERVAL_KEY, 1); conf.setLong(DFSConfigKeys.DFS_DATANODE_BALANCE_BANDWIDTHPERSEC_KEY, 1); writeConfigFile(localFileSys, excludeFile, null); writeConfigFile(localFileSys, includeFile, null); cluster = new MiniDFSCluster.Builder(conf).numDataNodes(numDatanodes).build(); cluster.waitActive(); fileSys = cluster.getFileSystem(); cluster.getNamesystem().getBlockManager().getDatanodeManager() .setHeartbeatExpireInterval(3000); Logger.getLogger(DecommissionManager.class).setLevel(Level.DEBUG); }</code><technical_language>thinking string concatenation + is unnecessarily</technical_language>

Target:
public void setUp() throws Exception { conf = new HdfsConfiguration(); conf.setBoolean(DFSConfigKeys.DFS_NAMENODE_REPLICATION_CONSIDERLOAD_KEY, false); localFileSys = FileSystem.getLocal(conf); Path workingDir = localFileSys.getWorkingDirectory(); dir = new Path(workingDir, "build/test/data/work-dir/decommission"); assertTrue(localFileSys.mkdirs(dir)); excludeFile = new Path(dir, "exclude"); conf.set(DFSConfigKeys.DFS_HOSTS_EXCLUDE, excludeFile.toUri().getPath()); Path includeFile = new Path(dir, "include"); conf.set(DFSConfigKeys.DFS_HOSTS, includeFile.toUri().getPath()); conf.setInt(DFSConfigKeys.DFS_NAMENODE_HEARTBEAT_RECHECK_INTERVAL_KEY, 1000); conf.setInt(DFSConfigKeys.DFS_HEARTBEAT_INTERVAL_KEY, 1); conf.setInt(DFSConfigKeys.DFS_NAMENODE_REPLICATION_PENDING_TIMEOUT_SEC_KEY, 4); conf.setInt(DFSConfigKeys.DFS_NAMENODE_REPLICATION_INTERVAL_KEY, 1000); conf.setInt(DFSConfigKeys.DFS_NAMENODE_DECOMMISSION_INTERVAL_KEY, 1); conf.setLong(DFSConfigKeys.DFS_DATANODE_BALANCE_BANDWIDTHPERSEC_KEY, 1); writeConfigFile(localFileSys, excludeFile, null); writeConfigFile(localFileSys, includeFile, null); cluster = new MiniDFSCluster.Builder(conf).numDataNodes(numDatanodes).build(); cluster.waitActive(); fileSys = cluster.getFileSystem(); cluster.getNamesystem().getBlockManager().getDatanodeManager() .setHeartbeatExpireInterval(3000); Logger.getLogger(DecommissionManager.class).setLevel(Level.DEBUG); }
Source:
<code>public final PartitionMethodDesc getPartitionMethod(final String databaseName, final String tableName) <START> throws UndefinedPartitionMethodException, UndefinedTableException { <END> try { final BlockingInterface stub = getStub(); final TableIdentifierProto request = buildTableIdentifier(databaseName, tableName); final GetPartitionMethodResponse response = stub.getPartitionMethodByTableName(null, request); throwsIfThisError(response.getState(), UndefinedPartitionMethodException.class); throwsIfThisError(response.getState(), UndefinedTableException.class); ensureOk(response.getState()); return CatalogUtil.newPartitionMethodDesc(response.getPartition()); } catch (ServiceException e) { throw new RuntimeException(e); } }</code><technical_language>UndefinedDatabaseException occur</technical_language>

Target:
public final PartitionMethodDesc getPartitionMethod(final String databaseName, final String tableName) throws UndefinedPartitionMethodException, UndefinedDatabaseException, UndefinedTableException { try { final BlockingInterface stub = getStub(); final TableIdentifierProto request = buildTableIdentifier(databaseName, tableName); final GetPartitionMethodResponse response = stub.getPartitionMethodByTableName(null, request); throwsIfThisError(response.getState(), UndefinedPartitionMethodException.class); throwsIfThisError(response.getState(), UndefinedDatabaseException.class); throwsIfThisError(response.getState(), UndefinedTableException.class); ensureOk(response.getState()); return CatalogUtil.newPartitionMethodDesc(response.getPartition()); } catch (ServiceException e) { throw new RuntimeException(e); } }
Source:
<code>private void start() { <START> if (!control.isDisposed()) { <END> if (control instanceof Text) { ((Text) control).addVerifyListener(this); } else if (control instanceof Combo) { ((Combo) control).addVerifyListener(this); } } }</code><technical_language>this happen? check for null in stop</technical_language>

Target:
private void start() { if (control != null && !control.isDisposed()) { if (control instanceof Text) { ((Text) control).addVerifyListener(this); } else if (control instanceof Combo) { ((Combo) control).addVerifyListener(this); } } }
Source:
<code><START> public void setVersion(long version) { <END> OsObjectStore.setSchemaVersion(sharedRealm, version); }</code><technical_language>this public feels problematic. classes need call this live in io.realm</technical_language>

Target:
void setVersion(long version) { OsObjectStore.setSchemaVersion(sharedRealm, version); }
Source:
<code>public void processAll() { long timeStart = System.currentTimeMillis(); boolean done = false; while (!done) { done = true; for (int i = 0; i < this.stages.size(); ++i) { GeneratorStage stage = this.stages.get(i); int processed = processStage(stage); totalProcessed += processed; if (processed > 0) { done = false; break; } <START> } <END> } long timeDiff = System.currentTimeMillis() - timeStart; totalTime += timeDiff; this.report(); }</code><technical_language>nice display "generation rounds" previously</technical_language>

Target:
public void processAll() { boolean done = false; while (!done) { done = true; for (int i = 0; i < this.stages.size(); ++i) { GeneratorStage stage = this.stages.get(i); int processed = processStage(stage); if (processed > 0) { done = false; break; } } } this.ticksSinceReport = REPORT_INTERVAL; this.report(); }
Source:
<code>public BackupMetrics(Registry registry){ <START> validDownloads = registry.counter("priam.download.valid"); <END> invalidDownloads = registry.counter("priam.download.invalid"); validUploads = registry.counter("priam.upload.valid"); invalidUploads = registry.counter("priam.upload.invalid"); backupUploadRateKbps = registry.counter("priam.backup.upload.rate.kbps"); awsSlowDownException = registry.counter("priam.aws.slowDown"); }</code><technical_language>METRICS_PERFIX constant instead of priam</technical_language>

Target:
public BackupMetrics(Registry registry) { validDownloads = registry.counter(Metrics.METRIC_PREFIX + "download.valid"); invalidDownloads = registry.counter(Metrics.METRIC_PREFIX + "download.invalid"); validUploads = registry.counter(Metrics.METRIC_PREFIX + "upload.valid"); invalidUploads = registry.counter(Metrics.METRIC_PREFIX + "upload.invalid"); uploadRate = registry.distributionSummary(Metrics.METRIC_PREFIX + "upload.rate"); awsSlowDownException = registry.counter(Metrics.METRIC_PREFIX + "aws.slowDown"); snsNotificationSuccess = registry.counter(Metrics.METRIC_PREFIX + "sns.notification.success"); snsNotificationFailure = registry.counter(Metrics.METRIC_PREFIX + "sns.notification.failure"); }
Source:
<code>private void killSoftly() { try { if (!p.sendCtrlC()) { return; } } catch (WinpException e) { return; } long deadline = System.nanoTime() + softkillWaitSeconds * 1000000000; do { if (!p.isRunning()) { break; } try { Thread.sleep(1000); } <START> catch (InterruptedException e) { <END> } } while (System.nanoTime() < deadline); }</code><technical_language>InterruptedException suppressed</technical_language>

Target:
private void killSoftly() throws InterruptedException { try { if (!p.sendCtrlC()) { return; } } catch (WinpException e) { if (LOGGER.isLoggable(Level.FINE)) { LOGGER.log(Level.FINE, "Failed to send CTRL+C to pid=" + getPid(), e); } return; } long deadline = System.nanoTime() + softKillWaitSeconds * 1000000000; int sleepTime = 10; do { if (!p.isRunning()) { break; } Thread.sleep(sleepTime); sleepTime = Math.min(sleepTime * 2, 1000); } while (System.nanoTime() < deadline); }
Source:
<code>public SWTBotRootMenu contextMenu(final Control control) throws WidgetNotFoundException { waitForEnabled(); <START> rightClick(); <END> Rectangle location = widgetBounds(); return NatTableContextMenuFinder.contextMenu(widget, location.x + (location.width / 2), location.y + (location.height / 2)); }</code><technical_language>In a real application order of events MouseDown, MenuDetect, MouseUp. send MenuDetect in NatTableContextMenuFinder. Since, for now, NatTable requires MouseDown event, call rightClick instead send mouse events NatTableContextMenuFinder</technical_language>

Target:
public SWTBotRootMenu contextMenu(final Control control) throws WidgetNotFoundException { waitForEnabled(); Rectangle location = widgetBounds(); return NatTableContextMenuFinder.contextMenu(widget, location.width / 2, location.height / 2); }
Source:
<code>public void clickFanomVideoCard() { <START> fandomVideoCard.click(); <END> }</code><technical_language>wait.forElementClickable()</technical_language>

Target:
public FandomPageObject clickFanomVideoCard() { wait.forElementClickable(fandomVideoCard); fandomVideoCard.click(); return new FandomPageObject(); }
Source:
<code>public void setup() { <START> this.attachmentsRoot = new File(environment.get("attachments.root.fs.path")); <END> }</code><technical_language>I guess VRaptor @Environment("attachments.root.fs.path")</technical_language>

Target:
public void setup() { this.attachmentsRoot = new File(fsPath); }
Source:
<code><START> public Enum asJavaEnum() { <END> return enumValue; }</code><technical_language>degrading raw type here</technical_language>

Target:
public Enum<?> asJavaEnum() { return enumValue; }
Source:
<code>private Map<Long, ILogData> waitOrHoleFill(RuntimeLayout runtimeLayout, Map<Long, LogData> readResult, boolean waitForWrite) { <START> Map<Long, ILogData> returnResult = new TreeMap<>(readResult); <END> if (!waitForWrite) { readResult.forEach((address, value) -> { if (value.isEmpty()) { holeFill(runtimeLayout, address); returnResult.put(address, peek(runtimeLayout, address)); } }); return returnResult; } boolean wait = true; for (Map.Entry<Long, LogData> entry : readResult.entrySet()) { long address = entry.getKey(); ILogData value = entry.getValue(); if (value.isEmpty()) { if (wait) { value = read(runtimeLayout, address); wait = false; } else { value = peek(runtimeLayout, address); if (value == null) { holeFill(runtimeLayout, address); value = peek(runtimeLayout, address); } } returnResult.put(address, value); } } return returnResult; }</code><technical_language>Is instance need do a multi read, want order addresses? A TreeMap instead of a Map need order</technical_language>

Target:
private Map<Long, ILogData> waitOrHoleFill(RuntimeLayout runtimeLayout, Map<Long, LogData> readResult, boolean waitForWrite) { Map<Long, ILogData> returnResult = new HashMap<>(readResult); if (!waitForWrite) { readResult.forEach((address, value) -> { if (value.isEmpty()) { holeFill(runtimeLayout, address); returnResult.put(address, peek(runtimeLayout, address)); } }); return returnResult; } boolean wait = true; for (Map.Entry<Long, LogData> entry : readResult.entrySet()) { long address = entry.getKey(); ILogData value = entry.getValue(); if (value.isEmpty()) { if (wait) { value = read(runtimeLayout, address); wait = false; } else { value = peek(runtimeLayout, address); if (value == null) { holeFill(runtimeLayout, address); value = peek(runtimeLayout, address); } } returnResult.put(address, value); } } return returnResult; }
Source:
<code>protected String getAppsDirectory() { <START> if (appsDirectory != null && (appsDirectory.equals("apps") || appsDirectory.equals("dropins"))) <END> return appsDirectory; File srcServerXML = getFileFromConfigDirectory("server.xml", configFile); if (srcServerXML != null && srcServerXML.exists()) { if (isAppConfigInSourceServerXml()) { appsDirectory = "apps"; } else { appsDirectory = "dropins"; } } else { appsDirectory = "dropins"; } return appsDirectory; }</code><technical_language>Expected a warning message appsDirectory entry is valid if is set is apps dropins</technical_language>

Target:
protected String getAppsDirectory() { if (appsDirectory != null && !appsDirectory.isEmpty()) { if (appsDirectory.equals("dropins") || appsDirectory.equals("apps")) { return appsDirectory; } else { log.warn(MessageFormat.format(messages.getString("warn.invalid.app.directory"), appsDirectory)); } } appsDirectory = "dropins"; File srcServerXML = getFileFromConfigDirectory("server.xml", configFile); if (srcServerXML != null && srcServerXML.exists()) { if (isAnyAppConfiguredInSourceServerXml()) { appsDirectory = "apps"; } } log.info(MessageFormat.format(messages.getString("info.default.app.directory"), appsDirectory)); return appsDirectory; }
Source:
<code>protected void ExecuteVmCommand() { if (getVm() != null) { VmHandler.checkStatusAndLockVm(getVm().getId(), getCompensationContext()); } AddImageFromScratchParameters parameters = new AddImageFromScratchParameters(Guid.Empty, getParameters().getVmId(), getParameters().getDiskInfo()); parameters.setQuotaId(getParameters().getQuotaId()); parameters.setStorageDomainId(getStorageDomainId().getValue()); parameters.setParentCommand(VdcActionType.AddDisk); parameters.setEntityId(getParameters().getEntityId()); parameters.setStoragePoolId(getStorageDomain().getstorage_pool_id().getValue()); getParameters().getImagesParameters().add(parameters); parameters.setParentParemeters(getParameters()); if (getVm() != null) { parameters.setVmSnapshotId(getSnapshotDao().getId(getVmId(), SnapshotType.ACTIVE)); VmDeviceUtils.addManagedDevice(new VmDeviceId(getParameters().getDiskInfo().getDisk().getId(), getVmId()), <START> VmDeviceType.DISK, VmDeviceType.DISK, null, true, false); <END> } VdcReturnValueBase tmpRetValue = Backend.getInstance().runInternalAction(VdcActionType.AddImageFromScratch, parameters, ExecutionHandler.createDefaultContexForTasks(getExecutionContext())); getReturnValue().getTaskIdList().addAll(tmpRetValue.getInternalTaskIdList()); getReturnValue().setActionReturnValue(tmpRetValue.getActionReturnValue()); getReturnValue().setFault(tmpRetValue.getFault()); setSucceeded(tmpRetValue.getSucceeded()); }</code><technical_language>send null here</technical_language>

Target:
protected void ExecuteVmCommand() { if (getVm() != null) { VmHandler.checkStatusAndLockVm(getVm().getId(), getCompensationContext()); } AddImageFromScratchParameters parameters = new AddImageFromScratchParameters(Guid.Empty, getParameters().getVmId(), getParameters().getDiskInfo()); parameters.setQuotaId(getParameters().getQuotaId()); parameters.setStorageDomainId(getStorageDomainId().getValue()); parameters.setParentCommand(VdcActionType.AddDisk); parameters.setEntityId(getParameters().getEntityId()); parameters.setStoragePoolId(getStorageDomain().getstorage_pool_id().getValue()); getParameters().getImagesParameters().add(parameters); parameters.setParentParemeters(getParameters()); if (getVm() != null) { parameters.setVmSnapshotId(getSnapshotDao().getId(getVmId(), SnapshotType.ACTIVE)); VmDeviceUtils.addManagedDevice(new VmDeviceId(getParameters().getDiskInfo().getId(), getVmId()), VmDeviceType.DISK, VmDeviceType.DISK, null, true, false); } VdcReturnValueBase tmpRetValue = Backend.getInstance().runInternalAction(VdcActionType.AddImageFromScratch, parameters, ExecutionHandler.createDefaultContexForTasks(getExecutionContext())); getReturnValue().getTaskIdList().addAll(tmpRetValue.getInternalTaskIdList()); getReturnValue().setActionReturnValue(tmpRetValue.getActionReturnValue()); getReturnValue().setFault(tmpRetValue.getFault()); setSucceeded(tmpRetValue.getSucceeded()); }
Source:
<code>private void buildMessage(MessageContext synCtx) { try { RelayUtils.buildMessage(((Axis2MessageContext) synCtx).getAxis2MessageContext()); } catch (IOException | XMLStreamException ex) { <START> String msg = "Error while building the message"; <END> handleException(msg, ex); } }</code><technical_language>need this msg variable</technical_language>

Target:
private void buildMessage(MessageContext synCtx) { try { RelayUtils.buildMessage(((Axis2MessageContext) synCtx).getAxis2MessageContext()); } catch (IOException | XMLStreamException ex) { handleException("Error while building the message", ex); } }
Source:
<code>public void merge(MergeOp.Factory mof, Change change) throws MergeException { <START> if (start(change.getDest())) { <END> mergeImpl(mof, change); } }</code><technical_language>Is start check needed? problematic (somehow delay/miss start immediate)</technical_language>

Target:
public boolean merge(MergeOp.Factory mof, Change change) throws MergeException { boolean started = start(change.getDest()); if (started) { mergeImpl(mof, change); } return started; }
Source:
<code><START> public String xpath() { <END> return String.format( "/github/repos/repo[@coords='%s']/milestones[number='%d']", this.coords, this.code ); }</code><technical_language>I a good idea public. for</technical_language>

Target:
private String xpath() { return String.format( "/github/repos/repo[@coords='%s']/milestones[number='%d']", this.coords, this.code ); }
Source:
<code>public String asCanonicalNameString() { <START> return getUnversionedPart() + (versioning == null ? ":" : versioning.getSeparator()) + getVersionPart(); <END> }</code><technical_language>ditto null Versioning.TagVersioning.LATEST</technical_language>

Target:
public String asCanonicalNameString() { return getUnversionedPart() + versioning.getSeparator() + getVersionPart(); }
Source:
<code>protected AuditMessageType getPatientParticipantObjectIdentificationForResponse(PRPAIN201306UV02 response, AuditMessageType auditMsg) { List<II> oII = PRPAIN201306UV02Parser.getPatientIds(response); <START> if (oII != null && oII.size() > 0) { <END> for (II entry : oII) { if (entry != null && entry.getRoot() != null && entry.getExtension() != null && !entry.getRoot().isEmpty() && !entry.getExtension().isEmpty()) { createPatientParticipantObjectIdentification(auditMsg, entry.getRoot(), entry.getExtension()); } } } else { createPatientParticipantObjectIdentification(auditMsg, null, null); } return auditMsg; }</code><technical_language>enhanced for loop, checking .size() in advance gain anything? Edit: kidding, I scrolled "else"</technical_language>

Target:
protected AuditMessageType getPatientParticipantObjectIdentificationForResponse(PRPAIN201306UV02 response, AuditMessageType auditMsg) { List<II> oII = PRPAIN201306UV02Parser.getPatientIds(response); if (oII != null && !oII.isEmpty()) { for (II entry : oII) { if (entry == null) { createPatientParticipantObjectIdentification(auditMsg, null, null); } else { createPatientParticipantObjectIdentification(auditMsg, NullChecker.isNullishIgnoreSpace(entry. getRoot()) ? entry.getRoot().trim() : null, NullChecker.isNullishIgnoreSpace(entry. getRoot()) ? entry.getExtension().trim() : null); } } } else { createPatientParticipantObjectIdentification(auditMsg, null, null); } return auditMsg; }
Source:
<code><START> public TopologyInfo getTopologyInfoByNameWithOpts(String name, GetInfoOptions options) throws NotAliveException, AuthorizationException, <END> TException { return nimbus.getTopologyInfoByNameWithOpts(name, options); }</code><technical_language>NotAliveException, AuthorizationException removed</technical_language>

Target:
public TopologyInfo getTopologyInfoByNameWithOpts(String name, GetInfoOptions options) throws TException { return nimbus.getTopologyInfoByNameWithOpts(name, options); }
Source:
<code>public void runScript(String path) throws Exception { final InputStream resourceAsStream = this.getClass().getClassLoader().getResourceAsStream(path); if(resourceAsStream == null) { log.warn("Given resource with path could not be found", path); <START> return; <END> } try (BufferedReader reader = new BufferedReader(new InputStreamReader(resourceAsStream)); ) { Connection connection = DriverManager.getConnection(url); connection.setAutoCommit(true); String line = null; while ((line = reader.readLine()) != null) { if (!line.trim().isEmpty()) { connection.createStatement().execute(line); log.info(String.format("######## SQL Query: %s ", line)); } } } }</code><technical_language>OK swallow Exception script file is found? behavior changed asking again</technical_language>

Target:
public void runScript(String path) throws Exception { final InputStream resourceAsStream = this.getClass().getClassLoader().getResourceAsStream(path); if(resourceAsStream == null) { log.warn("Given resource with path could not be found", path); throw new RuntimeException("Resource not found for given path "+path); } try (BufferedReader reader = new BufferedReader(new InputStreamReader(resourceAsStream)); ) { Connection connection = DriverManager.getConnection(url); connection.setAutoCommit(true); String line = null; while ((line = reader.readLine()) != null) { if (!line.trim().isEmpty()) { connection.createStatement().execute(line); log.info(String.format("######## SQL Query: %s ", line)); } } } }
Source:
<code>private void dumpCommits() { try { writer.openCommitsMeta( this.repositoryId ); final NodeCommitQuery nodeCommitQuery = NodeCommitQuery.create().build(); <START> this.nodeService.findCommits( nodeCommitQuery ); <END> final NodeCommitEntries nodeCommitEntries = this.nodeService.findCommits( nodeCommitQuery ). getNodeCommitEntries(); nodeCommitEntries.stream(). map( nodeCommitEntry -> CommitDumpEntry.create(). nodeCommitId( nodeCommitEntry.getNodeCommitId() ). message( nodeCommitEntry.getMessage() ). committer( nodeCommitEntry.getCommitter() ). timestamp( nodeCommitEntry.getTimestamp() ). build() ). forEach( this.writer::writeCommitEntry ); } finally { writer.close(); } }</code><technical_language>a leftover next line</technical_language>

Target:
private void dumpCommits() { try { writer.openCommitsMeta( this.repositoryId ); final NodeCommitQuery nodeCommitQuery = NodeCommitQuery.create().build(); final NodeCommitEntries nodeCommitEntries = this.nodeService.findCommits( nodeCommitQuery ). getNodeCommitEntries(); nodeCommitEntries.stream(). map( nodeCommitEntry -> CommitDumpEntry.create(). nodeCommitId( nodeCommitEntry.getNodeCommitId() ). message( nodeCommitEntry.getMessage() ). committer( nodeCommitEntry.getCommitter() ). timestamp( nodeCommitEntry.getTimestamp() ). build() ). forEach( this.writer::writeCommitEntry ); } finally { writer.close(); } }
Source:
<code>protected void setOptionalMultipartUploadRequestParameters( InitiateMultipartUploadRequest req) { <START> if(S3AEncryptionMethods.SSE_KMS.equals(serverSideEncryptionAlgorithm)) { <END> req.setSSEAwsKeyManagementParams(generateSSEAwsKeyParams()); } else if(S3AEncryptionMethods.SSE_C.equals(serverSideEncryptionAlgorithm) && StringUtils.isNotBlank( S3AUtils.getServerSideEncryptionKey(getConf()))) { req.setSSECustomerKey(generateSSECustomerKey()); } }</code><technical_language>case: statements here; readability</technical_language>

Target:
protected void setOptionalMultipartUploadRequestParameters( InitiateMultipartUploadRequest req) { switch (serverSideEncryptionAlgorithm) { case SSE_KMS: req.setSSEAwsKeyManagementParams(generateSSEAwsKeyParams()); break; case SSE_C: if (StringUtils.isNotBlank(getServerSideEncryptionKey(getConf()))) { req.setSSECustomerKey(generateSSECustomerKey()); } break; default: } }
Source:
<code>public static <TSource, TKey> Enumerable<TSource> orderBy( Enumerable<TSource> source, Function1<TSource, TKey> keySelector, Comparator<TKey> comparator, int offset, int fetch) { return new AbstractEnumerable<TSource>() { @Override public Enumerator<TSource> enumerator() { TreeMap<TKey, List<TSource>> map = new TreeMap<>(comparator); long size = 0; long needed = fetch + offset; try (Enumerator<TSource> os = source.enumerator()) { while (os.moveNext()) { TSource o = os.current(); TKey key = keySelector.apply(o); if (needed >= 0 && size >= needed) { if (comparator.compare(key, map.lastKey()) >= 0) { continue; } List<TSource> l = map.get(map.lastKey()); if (l.size() == 1) { map.remove(map.lastKey()); } else { l.remove(l.size() - 1); } size--; } map.compute(key, (k, l) -> { if (l == null) { return Collections.singletonList(o); } if (l.size() == 1) { l = new ArrayList<>(l); } l.add(o); return l; }); size++; } } if (offset > 0) { int skipped = 0; TKey until = null; for (Map.Entry<TKey, List<TSource>> e : map.entrySet()) { skipped += e.getValue().size(); if (skipped > offset) { List<TSource> l = e.getValue(); int toKeep = skipped - offset; if (toKeep < l.size()) { l.subList(0, l.size() - toKeep).clear(); } until = e.getKey(); break; } } if (until == null) { return Linq4j.emptyEnumerator(); <START> } else if (until != null) { <END> map.headMap(until).clear(); } } return new LookupImpl<>(map).valuesEnumerable().enumerator(); } }; }</code><technical_language>this if condition wrong/useless</technical_language>

Target:
public static <TSource, TKey> Enumerable<TSource> orderBy( Enumerable<TSource> source, Function1<TSource, TKey> keySelector, Comparator<TKey> comparator, int offset, int fetch) { return new AbstractEnumerable<TSource>() { @Override public Enumerator<TSource> enumerator() { if (fetch == 0) { return Linq4j.emptyEnumerator(); } TreeMap<TKey, List<TSource>> map = new TreeMap<>(comparator); long size = 0; long needed = fetch + offset; try (Enumerator<TSource> os = source.enumerator()) { while (os.moveNext()) { TSource o = os.current(); TKey key = keySelector.apply(o); if (needed >= 0 && size >= needed) { if (comparator.compare(key, map.lastKey()) >= 0) { continue; } List<TSource> l = map.get(map.lastKey()); if (l.size() == 1) { map.remove(map.lastKey()); } else { l.remove(l.size() - 1); } size--; } map.compute(key, (k, l) -> { if (l == null) { return Collections.singletonList(o); } if (l.size() == 1) { l = new ArrayList<>(l); } l.add(o); return l; }); size++; } } if (offset > 0) { int skipped = 0; TKey until = null; for (Map.Entry<TKey, List<TSource>> e : map.entrySet()) { skipped += e.getValue().size(); if (skipped > offset) { List<TSource> l = e.getValue(); int toKeep = skipped - offset; if (toKeep < l.size()) { l.subList(0, l.size() - toKeep).clear(); } until = e.getKey(); break; } } if (until == null) { return Linq4j.emptyEnumerator(); } map.headMap(until).clear(); } return new LookupImpl<>(map).valuesEnumerable().enumerator(); } }; }
Source:
<code>public void foundDir( URL url, int statusCode, String response, String baseCase, String rawResponse, BaseCase baseCaseObj) { <START> if (getView() != null) { <END> this.getBruteForcePanel() .foundDir(url, statusCode, response, baseCase, rawResponse, baseCaseObj); ; } }</code><technical_language>This removed, panel is anything</technical_language>

Target:
public void foundDir( URL url, int statusCode, String response, String baseCase, String rawResponse, BaseCase baseCaseObj)
Source:
<code>public void testCrash() throws Exception { IRunnableWithProgress operation = new CrashingRunnable(); try{ PlatformUI.getWorkbench().getActiveWorkbenchWindow().run(true, false, operation); fail("Should have an invocation target exception"); } catch (InvocationTargetException e){ } boolean <START> interrupted = <END> Thread.interrupted(); if (interrupted) { fail("Thread was interrupted at end of test"); } }</code><technical_language>inline this variable</technical_language>

Target:
public void testCrash() throws Exception { IRunnableWithProgress operation = new CrashingRunnable(); try{ PlatformUI.getWorkbench().getActiveWorkbenchWindow().run(true, false, operation); fail("Should have an invocation target exception"); } catch (InvocationTargetException e){ } if (Thread.interrupted()) { fail("Thread was interrupted at end of test"); } }
Source:
<code>public void postProcessAfterResolution(ProjectRequest request, InitializrMetadata metadata) { boolean hasSpringCloudStream = hasDependency(request, "cloud-stream"); boolean hasWeb = hasDependency(request, "web"); <START> if (hasSpringCloudStream) { <END> request.getResolvedDependencies().add(STREAM_ADAPTER); } if (hasWeb) { request.getResolvedDependencies().add(WEB_ADAPTER); } }</code><technical_language>This dependency currently [brings spring-cloud-stream](<LINK_1> [spring-cloud-stream-reactive](<LINK_0> effective super-set of Reactive Cloud Stream (with id reactive-cloud-stream). boolean check incorrect I missing something</technical_language>

Target:
public void postProcessAfterResolution(ProjectRequest request, InitializrMetadata metadata) { boolean hasSpringCloudStream = hasDependency(request, "cloud-stream") || hasDependency(request, "reactive-cloud-stream"); boolean hasWeb = hasDependency(request, "web"); if (hasSpringCloudStream) { request.getResolvedDependencies().add(STREAM_ADAPTER); } if (hasWeb) { request.getResolvedDependencies().add(WEB_ADAPTER); } }
Source:
<code>private TypeCompatibility typeCompatibilityForRow(RowType firstType, RowType secondType) { List<Field> firstFields = firstType.getFields(); List<Field> secondFields = secondType.getFields(); if (firstFields.size() != secondFields.size()) { return TypeCompatibility.incompatible(); } ImmutableList.Builder<RowType.Field> fields = ImmutableList.builder(); boolean firstCanCoerceToSecond = true; for (int i = 0; i < firstFields.size(); i++) { Type firstFieldType = firstFields.get(i).getType(); Type secondFieldType = secondFields.get(i).getType(); TypeCompatibility typeCompatibility = compatibility(firstFieldType, secondFieldType); if (!typeCompatibility.isCompatible()) { return TypeCompatibility.incompatible(); } Type commonParameterType = typeCompatibility.getCommonSuperType(); Optional<String> firstParameterName = firstFields.get(i).getName(); Optional<String> secondParameterName = secondFields.get(i).getName(); Optional<String> commonName = firstParameterName.equals(secondParameterName) ? firstParameterName : Optional.empty(); firstCanCoerceToSecond &= typeCompatibility.isFirstCanCoerceToSecond(); fields.add(new RowType.Field(commonName, commonParameterType)); } <START> return TypeCompatibility.explicit(RowType.from(fields.build()), firstCanCoerceToSecond); <END> }</code><technical_language>Oh, I see. "implicit" method leave TypeCompatibility object determine, while "explicit" means caller is making choice. Yeah, names ideal. better</technical_language>

Target:
private TypeCompatibility typeCompatibilityForRow(RowType firstType, RowType secondType) { List<Field> firstFields = firstType.getFields(); List<Field> secondFields = secondType.getFields(); if (firstFields.size() != secondFields.size()) { return TypeCompatibility.incompatible(); } ImmutableList.Builder<RowType.Field> fields = ImmutableList.builder(); boolean coercible = true; for (int i = 0; i < firstFields.size(); i++) { Type firstFieldType = firstFields.get(i).getType(); Type secondFieldType = secondFields.get(i).getType(); TypeCompatibility typeCompatibility = compatibility(firstFieldType, secondFieldType); if (!typeCompatibility.isCompatible()) { return TypeCompatibility.incompatible(); } Type commonParameterType = typeCompatibility.getCommonSuperType(); Optional<String> firstParameterName = firstFields.get(i).getName(); Optional<String> secondParameterName = secondFields.get(i).getName(); Optional<String> commonName = firstParameterName.equals(secondParameterName) ? firstParameterName : Optional.empty(); coercible &= typeCompatibility.isCoercible(); fields.add(new RowType.Field(commonName, commonParameterType)); } return TypeCompatibility.compatible(RowType.from(fields.build()), coercible); }
Source:
<code>private Map<String, String> getJps() throws IOException { Map<String, String> procs = new HashMap<>(); <START> String[] jpsCommand = new String[]{"jps"}; <END> CommandReturn cr = ShellUtils.execCommandWithOutput(jpsCommand); if (cr.getExitCode() != 0) { LOG.warn(cr.getFormattedOutput()); return procs; } LOG.info("JPS succeeded"); int idx = 0; for (String row : cr.getOutput().split("\n")) { String[] parts = row.split(" "); if (parts.length == 0) { LOG.error(String.format("Failed to parse row %s", row)); continue; } else if (parts.length == 1) { LOG.info(String.format("Row %s has no process name", row)); procs.put(parts[0], "unknown" + idx); idx++; } else { LOG.info(String.format("Found JVM %s %s", parts[0], parts[1])); procs.put(parts[0], parts[1]); } } return procs; }</code><technical_language>jps jstack work if Java process is started current user running command super user. Is try running sudo first</technical_language>

Target:
private Map<String, String> getJps() throws IOException { Map<String, String> procs = new HashMap<>(); ShellCommand sudoJpsCommand = new ShellCommand(new String[]{"sudo", "jps"}); ShellCommand jpsCommand = new ShellCommand(new String[]{"jps"}); CommandReturn cr = ShellUtils.execCmdWithBackup(sudoJpsCommand, jpsCommand); if (cr.getExitCode() != 0) { LOG.warn(cr.getFormattedOutput()); return procs; } LOG.info("JPS succeeded"); int idx = 0; for (String row : cr.getOutput().split("\n")) { String[] parts = row.split(" "); if (parts.length == 0) { LOG.error(String.format("Failed to parse row %s", row)); continue; } else if (parts.length == 1) { LOG.info(String.format("Row %s has no process name", row)); procs.put(parts[0], "unknown" + idx); idx++; } else { LOG.info(String.format("Found JVM %s %s", parts[0], parts[1])); procs.put(parts[0], parts[1]); } } return procs; }
Source:
<code>private SoapSigningHelper signingHelper() { <START> return Environment.getInstance().getSoapSigningHelper(); <END> }</code><technical_language>getEnvironment()</technical_language>

Target:
protected SoapSigningHelper signingHelper() { return getEnvironment().getSoapSigningHelper(); }