auphong2707/dl4se-code-review-dataset huggingface dataset:
Source:
<code>private void addViewerToSelectionProvider() { IWorkbenchPart part = getCompareConfiguration().getContainer().getWorkbenchPart(); ISelectionProvider selectionProvider = part.getSite().getSelectionProvider(); if (selectionProvider instanceof EMFCompareEditorSelectionProviderWrapper) { Viewer leftViewer = getSelectionViewer(fLeft); Viewer rightViewer = getSelectionViewer(fRight); <START> Viewer ancestorViewer = getSelectionViewer(fAncestor); <END> if (leftViewer != null && rightViewer != null && ancestorViewer != null) { EMFCompareEditorSelectionProviderWrapper compareSelectionProvider = (EMFCompareEditorSelectionProviderWrapper)selectionProvider; compareSelectionProvider .addViewers(Lists.newArrayList(leftViewer, rightViewer, ancestorViewer), leftViewer); } } }</code><technical_language>I this behaves two-way comparisons? ancestorViewer null in this case..</technical_language>

Target:
private void addViewerToSelectionProvider() { IWorkbenchPart part = getCompareConfiguration().getContainer().getWorkbenchPart(); ISelectionProvider selectionProvider = part.getSite().getSelectionProvider(); if (selectionProvider instanceof EMFCompareEditorSelectionProviderWrapper) { Viewer leftViewer = getSelectionViewer(fLeft); Viewer rightViewer = getSelectionViewer(fRight); Viewer ancestorViewer = getSelectionViewer(fAncestor); List<Viewer> selectionViewers = Lists.newArrayList(leftViewer, rightViewer, ancestorViewer); Iterables.removeIf(selectionViewers, isNull()); if (!selectionViewers.isEmpty()) { EMFCompareEditorSelectionProviderWrapper compareSelectionProvider = (EMFCompareEditorSelectionProviderWrapper)selectionProvider; compareSelectionProvider.addViewers(selectionViewers, selectionViewers.get(0)); } } }
Source:
<code>public void shouldCompileKotlinCodeWithBackticks() { <START> ProcessResult buildResult = workspace.runBuckCommand("build", " END> buildResult.assertSuccess("Build should have succeeded."); }</code><technical_language>general pattern is do workspace.runBuckBuild("//com/example/backticks:example").assertSuccess();</technical_language>

Target:
public void shouldCompileKotlinCodeWithBackticks() { workspace.runBuckBuild(" }
Source:
<code><START> public void release() <END> { if ( labelStatesMap != null ) { labelStatesMap.close(); } if ( createdLabelTokens != null ) { createdLabelTokens.close(); } if ( createdRelationshipTypeTokens != null ) { createdRelationshipTypeTokens.close(); } if ( nodeStatesMap != null ) { nodeStatesMap.close(); } if ( relationshipStatesMap != null ) { relationshipStatesMap.close(); } if ( propertyChangesForNodes != null ) { propertyChangesForNodes.release(); } if ( nodes != null && nodes.removedFromAdded != null ) { nodes.removedFromAdded.close(); } if ( relationships != null && relationships.removedFromAdded != null ) { relationships.removedFromAdded.close(); } }</code><technical_language>invoking combinations of close releases strange</technical_language>

Target:
public void release() { if ( !collectionsFactory.collectionsMustBeReleased() ) { return; } if ( labelStatesMap != null ) { labelStatesMap.close(); } if ( createdLabelTokens != null ) { createdLabelTokens.close(); } if ( createdRelationshipTypeTokens != null ) { createdRelationshipTypeTokens.close(); } if ( nodeStatesMap != null ) { nodeStatesMap.close(); } if ( relationshipStatesMap != null ) { relationshipStatesMap.close(); } if ( propertyChangesForNodes != null ) { propertyChangesForNodes.release(); } if ( nodes != null && nodes.removedFromAdded != null ) { nodes.removedFromAdded.close(); } if ( relationships != null && relationships.removedFromAdded != null ) { relationships.removedFromAdded.close(); } }
Source:
<code>public CompletableFuture<Void> anoint() { if (role.role() == RaftServer.Role.LEADER) { return CompletableFuture.completedFuture(null); } CompletableFuture<Void> future = new CompletableFuture<>(); threadContext.execute(() -> { Consumer<RaftMember> electionListener = new Consumer<RaftMember>() { @Override public void accept(RaftMember member) { if (member.memberId().equals(cluster.getMember().memberId())) { future.complete(null); } else { future.completeExceptionally(new RaftException.ProtocolException("Failed to transfer leadership")); } removeLeaderElectionListener(this); } }; addLeaderElectionListener(electionListener); RaftMember member = getCluster().getMember(); RaftMember leader = getLeader(); if (leader != null) { protocol.transfer(leader.memberId(), TransferRequest.newBuilder() .withMember(member.memberId()) .build()).whenComplete((response, error) -> { if (error != null) { future.completeExceptionally(error); <START> } else if (response.status() != RaftResponse.Status.ERROR) { <END> future.completeExceptionally(response.error().createException()); } else { transition(RaftServer.Role.CANDIDATE); } }); } else { transition(RaftServer.Role.CANDIDATE); } }); return future; }</code><technical_language>this be: if status() == ERROR</technical_language>

Target:
public CompletableFuture<Void> anoint() { if (role.role() == RaftServer.Role.LEADER) { return CompletableFuture.completedFuture(null); } CompletableFuture<Void> future = new CompletableFuture<>(); threadContext.execute(() -> { Consumer<RaftMember> electionListener = new Consumer<RaftMember>() { @Override public void accept(RaftMember member) { if (member.memberId().equals(cluster.getMember().memberId())) { future.complete(null); } else { future.completeExceptionally(new RaftException.ProtocolException("Failed to transfer leadership")); } removeLeaderElectionListener(this); } }; addLeaderElectionListener(electionListener); RaftMember member = getCluster().getMember(); RaftMember leader = getLeader(); if (leader != null) { protocol.transfer(leader.memberId(), TransferRequest.newBuilder() .withMember(member.memberId()) .build()).whenCompleteAsync((response, error) -> { if (error != null) { future.completeExceptionally(error); } else if (response.status() == RaftResponse.Status.ERROR) { future.completeExceptionally(response.error().createException()); } else { transition(RaftServer.Role.CANDIDATE); } }, threadContext); } else { transition(RaftServer.Role.CANDIDATE); } }); return future; }
Source:
<code>public boolean execute(ExecutionContext context) { CoreSession session = getCoreSession(context); if (session == null) { log.error("Could not open CoreSession"); return false; } AutomationService as = Framework.getService(AutomationService.class); try (OperationContext automationCtx = new OperationContext(session)) { automationCtx.putAll(context); ExecutionContext initialContext = context.getInitialContext(); String parentPath = (String) initialContext.get(PARENT_PATH_KEY); DocumentModel mailFolder = session.getDocument(new PathRef(parentPath)); automationCtx.put("mailFolder", mailFolder); automationCtx.put("executionContext", initialContext); String subject = (String) context.get(SUBJECT_KEY); automationCtx.put("mailDocumentName", generateMailName(subject)); @SuppressWarnings("unchecked") List<FileBlob> attachments = (List<FileBlob>) context.get(ATTACHMENTS_KEY); if (attachments == null) { automationCtx.put(ATTACHMENTS_KEY, Collections.EMPTY_LIST); } try { as.run(automationCtx, getChainName()); } catch (OperationException e) { throw new NuxeoException(e); } <START> } catch (Exception cause) { <END> throw new NuxeoException(cause); } return true; }</code><technical_language>> e call ExceptionUtils.checkInterrupt(e) immediately catch (Exception ...)</technical_language>

Target:
public boolean execute(ExecutionContext context) { CoreSession session = getCoreSession(context); if (session == null) { log.error("Could not open CoreSession"); return false; } AutomationService as = Framework.getService(AutomationService.class); try (OperationContext automationCtx = new OperationContext(session)) { automationCtx.putAll(context); ExecutionContext initialContext = context.getInitialContext(); String parentPath = (String) initialContext.get(PARENT_PATH_KEY); DocumentModel mailFolder = session.getDocument(new PathRef(parentPath)); automationCtx.put("mailFolder", mailFolder); automationCtx.put("executionContext", initialContext); String subject = (String) context.get(SUBJECT_KEY); automationCtx.put("mailDocumentName", generateMailName(subject)); @SuppressWarnings("unchecked") List<FileBlob> attachments = (List<FileBlob>) context.get(ATTACHMENTS_KEY); if (attachments == null) { automationCtx.put(ATTACHMENTS_KEY, Collections.EMPTY_LIST); } try { as.run(automationCtx, getChainName()); } catch (OperationException e) { throw new NuxeoException(e); } } catch (Exception e) { ExceptionUtils.checkInterrupt(e); } return true; }
Source:
<code>public NoActionsAvailableAction() { <START> setText("No Actions Avaliable"); <END> setEnabled(false); }</code><technical_language>Externalize string, in other actions</technical_language>

Target:
public NoActionsAvailableAction() { setText(UiMessages.Action_NoActionsAvailable_Text); setEnabled(false); }
Source:
<code><START> private String getDocumentValueFromEntry(Entry entry) throws IOException { <END> ObjectMapper mapper = Jackson.newObjectMapper(); StringBuilder builder = new StringBuilder(); Map<String, Object> doc = new HashMap<>(); JsonNode jsonNode = dockstoreEntryToElasticSearchObject(entry); doc.put("doc", jsonNode); doc.put("doc_as_upsert", true); try { builder.append(mapper.writeValueAsString(doc)); } catch (JsonProcessingException e) { e.printStackTrace(); } return builder.toString(); }</code><technical_language>this throw a IOException try...catch below</technical_language>

Target:
private String getDocumentValueFromEntry(Entry entry) { ObjectMapper mapper = Jackson.newObjectMapper(); StringBuilder builder = new StringBuilder(); Map<String, Object> doc = new HashMap<>(); try { JsonNode jsonNode = dockstoreEntryToElasticSearchObject(entry); doc.put("doc", jsonNode); doc.put("doc_as_upsert", true); builder.append(mapper.writeValueAsString(doc)); } catch (IOException e) { throw new CustomWebApplicationException(MAPPER_ERROR, HttpStatus.SC_INTERNAL_SERVER_ERROR); } return builder.toString(); }
Source:
<code>private String[] getPath(String key) { String property = propertyKeys.get(key); <START> if (property == null) { <END> property = new String[] { key }; } return property; }</code><technical_language>@adietish consider throwing here/providing indication path doesnt exist. If path doesnt exist for a property needs added map IMO</technical_language>

Target:
private String[] getPath(String key) { String property = propertyKeys.get(key); if (property == null) { throw new IllegalArgumentException(String.format("key %s is not known to the resource %s", key, getName().isEmpty()? getClass().getSimpleName() : getName())); } return property; }
Source:
<code>public void shouldExpandEnvAndBuildVars() throws Exception { MessageExpander expander = new MessageExpander(new ExpandableMessage( format(MSG_FORMAT, asVar(ENV_VAR_JOB_NAME), asVar(CUSTOM_BUILD_PARAM), asTokenVar(ENV_VAR_JOB_NAME) ) )); FreeStyleProject job = jRule.createFreeStyleProject(); ParameterDefinition paramDef = new StringParameterDefinition(CUSTOM_BUILD_PARAM, "", ""); ParametersDefinitionProperty paramsDef = new ParametersDefinitionProperty(paramDef); <START> job.addProperty(paramsDef); <END> job.getBuildersList().add(expander); job.scheduleBuild2(0, new ParametersAction(new StringParameterValue(CUSTOM_BUILD_PARAM, CUSTOM_PARAM_VAL))) .get(5, TimeUnit.SECONDS); assertThat("job name - var param - template", expander.getResult(), startsWith(format(MSG_FORMAT, job.getFullName(), CUSTOM_PARAM_VAL, job.getFullName()))); }</code><technical_language>this trick do</technical_language>

Target:
public void shouldExpandEnvAndBuildVars() throws Exception { MessageExpander expander = new MessageExpander(new ExpandableMessage( format(MSG_FORMAT, asVar(ENV_VAR_JOB_NAME), asVar(CUSTOM_BUILD_PARAM), asTokenVar(ENV_VAR_JOB_NAME) ) )); FreeStyleProject job = jRule.createFreeStyleProject(); handleSecurity170(job); job.getBuildersList().add(expander); job.scheduleBuild2(0, new ParametersAction(new StringParameterValue(CUSTOM_BUILD_PARAM, CUSTOM_PARAM_VAL))) .get(5, TimeUnit.SECONDS); assertThat("job name - var param - template", expander.getResult(), startsWith(format(MSG_FORMAT, job.getFullName(), CUSTOM_PARAM_VAL, job.getFullName()))); }
Source:
<code>private ByteBuffer parsePacketSPB(ByteBuffer pcapPacketHeader, int blockLength) throws IOException, BadPcapFileException { ByteBuffer pcapPacketData; int packetLen = pcapPacketHeader.getInt(); <START> long includedPacketLength = ConversionHelper.unsignedIntToLong(packetLen); <END> SeekableByteChannel fFileChannel = getFileChannel(); if (fFileChannel.size() - fFileChannel.position() < includedPacketLength) { throw new BadPcapFileException(String.format("%04x", includedPacketLength) + " is causing buffer overrun."); } if (packetLen > Integer.MAX_VALUE) { throw new BadPcapFileException(String.format("%04x", packetLen) + " is bigger than 2^31-1 bytes are not supported."); } pcapPacketData = ByteBuffer.allocate((int) includedPacketLength - 12); pcapPacketData.clear(); ByteOrder byteOrder = getByteOrder(); pcapPacketHeader.order(byteOrder); fFileChannel.read(pcapPacketData); pcapPacketData.flip(); return pcapPacketData; }</code><technical_language>is Original Packet Length. spec, included packet length is minimum this SnapLen (for Interface ID = 0)</technical_language>

Target:
private ByteBuffer parsePacketSPB(ByteBuffer pcapPacketHeader, int blockLength) throws IOException, BadPcapFileException { ByteBuffer pcapPacketData; int packetLen = pcapPacketHeader.getInt(); long includedPacketLength = ConversionHelper.unsignedIntToLong(packetLen); SeekableByteChannel fileChannel = getFileChannel(); if (fileChannel.size() - fileChannel.position() < includedPacketLength) { throw new BadPcapFileException(String.format("%04x", includedPacketLength) + " is causing buffer overrun."); } if (packetLen > Integer.MAX_VALUE) { throw new BadPcapFileException(String.format("%04x", packetLen) + " is bigger than 2^31-1 bytes are not supported."); } pcapPacketData = ByteBuffer.allocate((int) includedPacketLength - 12); pcapPacketData.clear(); ByteOrder byteOrder = getByteOrder(); pcapPacketHeader.order(byteOrder); fileChannel.read(pcapPacketData); pcapPacketData.flip(); return pcapPacketData; }
Source:
<code><START> public JobDeadline(Date absoluteDeadline) { <END> this.absoluteDeadline = absoluteDeadline; this.relativeDeadline = null; Duration s; }</code><technical_language>I a builder more naturally instead of 2 public contructors</technical_language>

Target:
public JobDeadline(Date absoluteDeadline) { this.absoluteDeadline = absoluteDeadline; this.relativeDeadline = null; }
Source:
<code>public void tearDown() throws Exception { mJobScheduler.cancel(CONNECTIVITY_JOB_ID); if (mInitialRestrictBackground) { SystemUtil.runShellCommand(getInstrumentation(), RESTRICT_BACKGROUND_ON_CMD); } <START> if(!mHasWifi) { return; } END> if (mWifiManager.isWifiEnabled() == mInitialWiFiState) { return; } NetworkInfo.State expectedState = mInitialWiFiState ? NetworkInfo.State.CONNECTED : NetworkInfo.State.DISCONNECTED; ConnectivityActionReceiver receiver = new ConnectivityActionReceiver(ConnectivityManager.TYPE_WIFI, expectedState); IntentFilter filter = new IntentFilter(); filter.addAction(ConnectivityManager.CONNECTIVITY_ACTION); mContext.registerReceiver(receiver, filter); assertTrue(mWifiManager.setWifiEnabled(mInitialWiFiState)); receiver.waitForStateChange(); assertTrue("Failure to restore previous WiFi state", mWifiManager.isWifiEnabled() == mInitialWiFiState); mContext.unregisterReceiver(receiver); super.tearDown(); }</code><technical_language>This is wrong; returning calling super.tearDown() bottom of function. Express this more directly: if (mHasWifi) { if (mWifiManager.isWifiEnabled() != mInitialWifiState) { // ... rest of wifi-specific teardown ... } } super.tearDown();</technical_language>

Target:
public void tearDown() throws Exception { mJobScheduler.cancel(CONNECTIVITY_JOB_ID); if (mInitialRestrictBackground) { SystemUtil.runShellCommand(getInstrumentation(), RESTRICT_BACKGROUND_ON_CMD); } if (mHasWifi) { if (mWifiManager.isWifiEnabled() == mInitialWiFiState) { return; } NetworkInfo.State expectedState = mInitialWiFiState ? NetworkInfo.State.CONNECTED : NetworkInfo.State.DISCONNECTED; ConnectivityActionReceiver receiver = new ConnectivityActionReceiver(ConnectivityManager.TYPE_WIFI, expectedState); IntentFilter filter = new IntentFilter(); filter.addAction(ConnectivityManager.CONNECTIVITY_ACTION); mContext.registerReceiver(receiver, filter); assertTrue(mWifiManager.setWifiEnabled(mInitialWiFiState)); receiver.waitForStateChange(); assertTrue("Failure to restore previous WiFi state", mWifiManager.isWifiEnabled() == mInitialWiFiState); mContext.unregisterReceiver(receiver); } super.tearDown(); }
Source:
<code>public OtherFormatPane openOtherFormatPane() { WebElement linkPane = getDriver().findElementByLinkText(OTHER_FORMAT_PANE_LINK); linkPane.click(); if (linkPane.getAttribute("class").contains("collapsed")) { linkPane.click(); } By paneContent = By.className(CONTAINER_TREE_CLASS); <START> getDriver().waitUntilElementIsVisible(paneContent); <END> return new OtherFormatPane(); }</code><technical_language>AFAICS pane content is displayed right is some animation some opacity transition. If check class changes from: collapse -> collapsing -> collapse in wait pane content class "collapse in"</technical_language>

Target:
public OtherFormatPane openOtherFormatPane() { getDriver().waitUntilElementIsVisible(By.id(EXPORT_MODAL_ID)); getDriver().findElementByLinkText(OTHER_FORMAT_PANE_LINK).click(); getDriver().waitUntilElementIsVisible(By.cssSelector("#exportModelOtherCollapse.collapse.in")); return new OtherFormatPane(); }
Source:
<code>public void thePlatformBuffersADeviceInstallationGetStatusResponseMessageForDevice(final String deviceIdentification, final Map<String, String> expectedResult) throws Throwable { GetStatusAsyncRequest request = new GetStatusAsyncRequest(); AsyncRequest asyncRequest = new AsyncRequest(); asyncRequest.setDeviceId(deviceIdentification); asyncRequest.setCorrelationUid((String) ScenarioContext.Current().get(Keys.KEY_CORRELATION_UID)); request.setAsyncRequest(asyncRequest); boolean success = false; int count = 0; <START> while (!success) { <END> if (count > configuration.getTimeout()) { Assert.fail("Timeout"); } count++; Thread.sleep(1000); try { GetStatusResponse response = client.getStatusResponse(request); Assert.assertEquals(Enum.valueOf(OsgpResultType.class, expectedResult.get(Keys.KEY_RESULT)), response.getResult()); success = true; } catch(Exception ex) { } } }</code><technical_language>If this is new, moved code, I this is go. This is fourth of checking for a response I in cucumber projects. in sync whats (and eventually implemented catching notification)</technical_language>

Target:
public void thePlatformBuffersADeviceInstallationGetStatusResponseMessageForDevice( final String deviceIdentification, final Map<String, String> expectedResult) throws Throwable { final GetStatusAsyncRequest request = new GetStatusAsyncRequest(); final AsyncRequest asyncRequest = new AsyncRequest(); asyncRequest.setDeviceId(deviceIdentification); asyncRequest.setCorrelationUid((String) ScenarioContext.Current().get(Keys.KEY_CORRELATION_UID)); request.setAsyncRequest(asyncRequest); GetStatusResponse response = null; boolean success = false; int count = 0; while (!success) { if (count > this.configuration.getTimeout()) { Assert.fail("Timeout"); } count++; Thread.sleep(1000); try { response = this.client.getStatusResponse(request); success = true; } catch (final Exception ex) { } } Assert.assertEquals(Enum.valueOf(OsgpResultType.class, expectedResult.get(Keys.KEY_RESULT)), response.getResult()); }
Source:
<code>public void setBackgroundColor(Color bg) { super.setBackgroundColor(bg); if (bg == null) { ((AdvancedRoundedRectangle) top).setBorderColor(getLocalForegroundColor()); middle.setBorderColor(getLocalForegroundColor()); bottom.setBorderColor(getLocalForegroundColor()); } else { <START> ((AdvancedRoundedRectangle) top).setBorderColor(ColorHelper.darker(bg)); <END> middle.setBorderColor(ColorHelper.darker(bg)); bottom.setBorderColor(ColorHelper.darker(bg)); } }</code><technical_language>I nicer call darker once, is critical</technical_language>

Target:
public void setBackgroundColor(Color bg) { super.setBackgroundColor(bg); if (bg == null) { ((AdvancedRoundedRectangle) top).setBorderColor(getLocalForegroundColor()); middle.setBorderColor(getLocalForegroundColor()); bottom.setBorderColor(getLocalForegroundColor()); } else { Color darkerColor = ColorHelper.darker(bg); ((AdvancedRoundedRectangle) top).setBorderColor(darkerColor); middle.setBorderColor(darkerColor); bottom.setBorderColor(darkerColor); } }
Source:
<code>protected void analyzeCivar() { int minimumTemplateSize = 0; boolean expands = false; int starCount = 0; boolean hasEmbeddedCivars = false; boolean hasOptionalElements = false; boolean allElementsAreOptional = true; boolean hasVariation = false; <START> StringBuilder strBuffer = new StringBuilder(100); <END> for (final Element e : elements) { strBuffer.append(e.toString()); if (e.operator() == Operator.EMBEDDED) { hasEmbeddedCivars = true; if (e.embedded.hasVariation()) { hasVariation = true; allElementsAreOptional &= (e.optional || e.embedded.allElementsAreOptional()); hasOptionalElements |= e.optional || e.embedded.hasOptionalVariationElements(); } minimumTemplateSize += e.embedded.minimumTemplateSequenceSize(); if (e.embedded.expands()) { expands = true; starCount += e.embedded.starCount(); } } else { if (e.isVariant()) { hasVariation = true; allElementsAreOptional &= e.optional; hasOptionalElements |= e.optional; } if (e.expands()) { starCount += e.size(); expands = true; continue; } if (e.operator() == Operator.INSERTION) continue; minimumTemplateSize += e.size(); } } this.string = strBuffer.toString(); this.hasVariation = hasVariation; this.allVariationIsOptional = allElementsAreOptional; this.hasOptionalVariation = hasOptionalElements; this.hasEmbeddedCivars = hasEmbeddedCivars; this.starCount = starCount; this.expands = expands; this.minimumTemplateSize = minimumTemplateSize; }</code><technical_language>strBuffer renamed strBuilder</technical_language>

Target:
protected void analyzeCivar() { int minimumTemplateSize = 0; boolean expands = false; int starCount = 0; boolean hasEmbeddedCivars = false; boolean hasOptionalElements = false; boolean allElementsAreOptional = true; boolean hasVariation = false; StringBuilder strBuilder = new StringBuilder(100); for (final Element e : elements) { strBuilder.append(e.toString()); if (e.operator() == Operator.EMBEDDED) { hasEmbeddedCivars = true; if (e.embedded.hasVariation()) { hasVariation = true; allElementsAreOptional &= (e.optional || e.embedded.allElementsAreOptional()); hasOptionalElements |= e.optional || e.embedded.hasOptionalVariationElements(); } minimumTemplateSize += e.embedded.minimumTemplateSequenceSize(); if (e.embedded.expands()) { expands = true; starCount += e.embedded.starCount(); } } else { if (e.isVariant()) { hasVariation = true; allElementsAreOptional &= e.optional; hasOptionalElements |= e.optional; } if (e.expands()) { starCount += e.size(); expands = true; continue; } if (e.operator() == Operator.INSERTION) continue; minimumTemplateSize += e.size(); } } this.string = strBuilder.toString(); this.hasVariation = hasVariation; this.allVariationIsOptional = allElementsAreOptional; this.hasOptionalVariation = hasOptionalElements; this.hasEmbeddedCivars = hasEmbeddedCivars; this.starCount = starCount; this.expands = expands; this.minimumTemplateSize = minimumTemplateSize; }
Source:
<code>Command[] getCommands() { if (root != null) { return root.getCommands(); } else { return commands; <START> } <END> }</code><technical_language>minor ... if block returns, is need for 'else' block, do this: if (root != null) { return root.getCommands(); } return commands; or, yet: return root != null ? root.getCommands() : command;</technical_language>

Target:
Command[] getCommands() { return root != null ? root.getCommands() : commands; }
Source:
<code><START> public static synchronized Long convertTimestampToMillis(String timestamp) { <END> if (timestamp == null || timestamp.length() == 0) return null; timestamp = timestamp.replaceFirst("\\+.*", "Z"); try { return FORMATTER.parse(timestamp).getTime(); } catch (ParseException e) { return 0L; } }</code><technical_language>I remove thread synchronization client code handle it</technical_language>

Target:
public static Long convertTimestampToMillis(String timestamp) { if (timestamp == null || timestamp.length() == 0) return null; timestamp = timestamp.replaceFirst("\\+.*", "Z"); try { return DATE_FORMAT.get().parse(timestamp).getTime(); } catch (ParseException e) { return 0L; } }
Source:
<code>public List<SolrInputDocument> add(List<Metacard> metacards, boolean forceAutoCommit) throws IOException, SolrServerException, MetacardCreationException { if (CollectionUtils.isEmpty(metacards)) { return Collections.emptyList(); } boolean isNrtCommit = false; List<SolrInputDocument> docs = new ArrayList<>(); <START> for (Metacard metacard : metacards) { <END> docs.add(getSolrInputDocument(metacard)); if (commitNrtMetacardType.contains(metacard.getMetacardType().getName())) { isNrtCommit = true; } } if (!forceAutoCommit) { if (isNrtCommit) { client.add(docs, commitNRtCommitWithinMs); } else { client.add(docs); } } else { softCommit(docs); } return docs; }</code><technical_language>if metacard out of requires Nrt commit of done way? split metacards 2 sets</technical_language>

Target:
public List<SolrInputDocument> add(List<Metacard> metacards, boolean forceAutoCommit) throws IOException, SolrServerException, MetacardCreationException { if (CollectionUtils.isEmpty(metacards)) { return Collections.emptyList(); } boolean isNrtCommit = false; List<SolrInputDocument> docs = new ArrayList<>(); for (Metacard metacard : metacards) { docs.add(getSolrInputDocument(metacard)); if (commitNrtMetacardType.contains(metacard.getMetacardType().getName())) { isNrtCommit = true; } } if (!forceAutoCommit) { if (isNrtCommit) { client.add(docs, commitNrtCommitWithinMs); } else { client.add(docs); } } else { softCommit(docs); } return docs; }
Source:
<code>public Object prepare(Object value) { Assert.notNull(value, "Value must not be null!"); Class<? extends T> expressionType = expression.getJavaType(); <START> <END> if (String.class.equals(expressionType)) { switch (type) { case STARTING_WITH: return value + "%"; case ENDING_WITH: return "%" + value; case CONTAINING: case NOT_CONTAINING: return "%" + value + "%"; default: return value; } } return Collection.class.isAssignableFrom(expressionType) ? persistenceProvider.potentiallyConvertEmptyCollection(upperIfIgnoreCase(part, toCollection(value))) : value; }</code><technical_language>Please avoid changes unrelated actual improvement fix</technical_language>

Target:
public Object prepare(Object value) { Assert.notNull(value, "Value must not be null!"); Class<? extends T> expressionType = expression.getJavaType(); if (String.class.equals(expressionType)) { switch (type) { case STARTING_WITH: return String.format("%s%%", value.toString()); case ENDING_WITH: return String.format("%%%s", value.toString()); case CONTAINING: case NOT_CONTAINING: return String.format("%%%s%%", value.toString()); default: return value; } } return Collection.class.isAssignableFrom(expressionType) ? persistenceProvider.potentiallyConvertEmptyCollection(upperIfIgnoreCase(ignoreCase, toCollection(value))) : value; }
Source:
<code>public void testDirectReflection () throws ReflectiveOperationException { ObjectMeta meta = new ObjectMeta(); Foo foo = new Foo(); foo.setMetadata(meta); <START> assertTrue(ReflectUtils.objectMetadata(foo) == meta); <END> }</code><technical_language>nit: simplified assertSame</technical_language>

Target:
public void testDirectReflection () throws ReflectiveOperationException { ObjectMeta meta = new ObjectMeta(); Foo foo = new Foo(); foo.setMetadata(meta); assertSame(meta, ReflectUtils.objectMetadata(foo)); }
Source:
<code>protected void unblockOtherNode(Object waiter, Executor executor) { if (!(waiter instanceof Waiter)) { return; } Object value = resolve(state); if (waiter instanceof AcceptNode) { AcceptNode acceptNode = (AcceptNode) waiter; acceptNode.execute(executor, value); } else if (waiter instanceof ApplyNode) { ApplyNode applyNode = (ApplyNode) waiter; applyNode.execute(executor, value); } else if (waiter instanceof RunNode) { RunNode runNode = (RunNode) waiter; runNode.execute(executor, value); } else if (waiter instanceof AbstractInvocationFuture.WhenCompleteNode) { WhenCompleteNode whenCompleteNode = (WhenCompleteNode) waiter; Throwable t = (value instanceof ExceptionalResult) ? ((ExceptionalResult) value).cause : null; value = (value instanceof ExceptionalResult) ? null : value; whenCompleteNode.execute(executor, value, t); } else if (waiter instanceof HandleNode) { HandleNode handleNode = (HandleNode) waiter; Throwable t = (value instanceof ExceptionalResult) ? ((ExceptionalResult) value).cause : null; value = (value instanceof ExceptionalResult) ? null : value; handleNode.execute(executor, value, t); } else if (waiter instanceof ExceptionallyNode) { ((ExceptionallyNode) waiter).execute(value); } else if (waiter instanceof ComposeNode) { ((ComposeNode) waiter).execute(executor, value); } else if (waiter instanceof AbstractBiNode) { ((AbstractBiNode) waiter).execute(executor, value); <START> } else if (waiter instanceof AbstractEitherNode) { <END> ((AbstractEitherNode) waiter).execute(executor, value); } }</code><technical_language>a perfect place introduce a virtual method for execute(executor, value) pattern, is a reason to</technical_language>

Target:
protected void unblockOtherNode(Object waiter, Executor executor) { if (!(waiter instanceof Waiter)) { return; } Object value = resolve(state); if (waiter instanceof UniWaiter) { ((UniWaiter) waiter).execute(executor, value); } else if (waiter instanceof BiWaiter) { Throwable t = (value instanceof ExceptionalResult) ? ((ExceptionalResult) value).cause : null; value = (value instanceof ExceptionalResult) ? null : value; ((BiWaiter) waiter).execute(executor, value, t); } else if (waiter instanceof ExceptionallyNode) { ((ExceptionallyNode) waiter).execute(value); } }
Source:
<code>public CompletableFuture<String> getsAsync(String row, Column column) { <START> if (asyncReader == null) { <END> asyncReader = new AsyncReader(this); } return asyncReader.gets(row, column); }</code><technical_language>shorten method a method java private AsyncReader getAsyncReader() { if (asyncReader == null) { asyncReader = new AsyncReader(this); } } do java return getAsyncReader().gets(row, column);</technical_language>

Target:
public CompletableFuture<String> getsAsync(String row, Column column) { return getAsyncReader().gets(row, column); }
Source:
<code>public int onCollisionHighScoreIncrement() { <START> return (int) Math.max(element.getSize() + element.getSpeed() - element.getSize(), 0); <END> }</code><technical_language>Size + speed - size = speed</technical_language>

Target:
public int onCollisionHighScoreIncrement() { return (int) Math.max(element.getSize() + element.getSpeed(), 0); }
Source:
<code>private static int readIntFromByteChannel(ReadableByteChannel channel) { ByteBuffer intBuffer = ByteBuffer.allocate(INT_BYTES); int result = -1; try { while (intBuffer.hasRemaining() && (channel.read(intBuffer) >= 0)) { } if (!intBuffer.hasRemaining()) { intBuffer.rewind(); result = intBuffer.asIntBuffer().get(0); } } catch (Exception ignored) { <START> } <END> return result; }</code><technical_language>throw this exception caller catch here</technical_language>

Target:
private static int readIntFromByteChannel(ReadableByteChannel channel) throws IOException { ByteBuffer intBuffer = ByteBuffer.allocate(INT_BYTES); int result = -1; while (intBuffer.hasRemaining() && (channel.read(intBuffer) >= 0)) { } if (!intBuffer.hasRemaining()) { intBuffer.rewind(); result = intBuffer.asIntBuffer().get(0); } return result; }
Source:
<code>public Node getParentNode(long nodeId) { List<Node> nodes = new ArrayList<>(); getParentNodes(null, nodeContainer, nodes, nodeId); if (nodes.size() > 0) { <START> return nodes.get(0); <END> } return null; }</code><technical_language>do right node? :)</technical_language>

Target:
public Node getParentNode(long nodeId) { return getContainerNode(null, nodeContainer, nodeId); }
Source:
<code>public synchronized void stop(final StopContext context) { ServiceName top = deploymentUnit.getParent() != null ? deploymentUnit.getParent().getServiceName() : deploymentUnit.getServiceName(); ServiceController<?> topController = context.getController().getServiceContainer().getService(top); if(topController.getMode() != Mode.REMOVE && topController.getMode() != Mode.NEVER && !context.getController().getServiceContainer().isShutdown()) { ServerLogger.DEPLOYMENT_LOGGER.deploymentRestartDetected(deploymentUnit.getName()); topController.addListener(new AbstractServiceListener<Object>() { @Override public void transition(final ServiceController<?> controller, final ServiceController.Transition transition) { if(transition.getAfter().equals(ServiceController.Substate.DOWN)) { controller.compareAndSetMode(Mode.NEVER, Mode.ACTIVE); controller.removeListener(this); } } }); <START> topController.setMode(Mode.NEVER); <END> } final DeploymentUnit deploymentUnitContext = deploymentUnit; final DeployerChains chains = deployerChainsInjector.getValue(); final List<RegisteredDeploymentUnitProcessor> list = chains.getChain(phase); final ListIterator<RegisteredDeploymentUnitProcessor> iterator = list.listIterator(list.size()); while (iterator.hasPrevious()) { final RegisteredDeploymentUnitProcessor prev = iterator.previous(); safeUndeploy(deploymentUnitContext, phase, prev); } }</code><technical_language>I this needs a CAS race undeploy op. moved if test</technical_language>

Target:
public synchronized void stop(final StopContext context) { ServiceName top = deploymentUnit.getParent() != null ? deploymentUnit.getParent().getServiceName() : deploymentUnit.getServiceName(); ServiceController<?> topController = context.getController().getServiceContainer().getService(top); Mode mode = topController.getMode(); if (mode != Mode.REMOVE && mode != Mode.NEVER && !context.getController().getServiceContainer().isShutdown()) { AbstractServiceListener<Object> serviceListener = new AbstractServiceListener<Object>() { @Override public void transition(final ServiceController<?> controller, final ServiceController.Transition transition) { if (transition.getAfter().equals(ServiceController.Substate.DOWN)) { controller.compareAndSetMode(Mode.NEVER, Mode.ACTIVE); controller.removeListener(this); } } }; topController.addListener(serviceListener); if (topController.compareAndSetMode(mode, Mode.NEVER)) { ServerLogger.DEPLOYMENT_LOGGER.deploymentRestartDetected(deploymentUnit.getName()); } else { topController.removeListener(serviceListener); } } final DeploymentUnit deploymentUnitContext = deploymentUnit; final DeployerChains chains = deployerChainsInjector.getValue(); final List<RegisteredDeploymentUnitProcessor> list = chains.getChain(phase); final ListIterator<RegisteredDeploymentUnitProcessor> iterator = list.listIterator(list.size()); while (iterator.hasPrevious()) { final RegisteredDeploymentUnitProcessor prev = iterator.previous(); safeUndeploy(deploymentUnitContext, phase, prev); } }
Source:
<code>private String getProcessorID(String stepping, String model, String family, String[] flags) { boolean procInfo = false; String marker = "Processor Information"; for (String checkLine : ExecutingCommand.runNative("dmidecode -t system")) { if (!procInfo && checkLine.contains(marker)) { marker = "ID:"; procInfo = true; } else if (procInfo && checkLine.contains(marker)) { return checkLine.split(marker)[1].trim(); } } marker = "eax="; for (String checkLine : ExecutingCommand.runNative("cpuid -1r")) { if (checkLine.contains(marker) && checkLine.trim().startsWith("0x00000001")) { String eax = ""; String edx = ""; for (String register : ParseUtil.whitespace.split(checkLine)) { if (register.startsWith("eax=")) { <START> eax = StringUtils.replace(register, "eax=0x", ""); <END> } else if (register.startsWith("edx=")) { edx = StringUtils.replace(register, "edx=0x", ""); } } return edx + eax; } } return createProcessorID(stepping, model, family, flags); }</code><technical_language>This primary performance improvement, replacing String.replace()'s inefficient regex implementation StringUtils.replace() a StringBuffer. However, faster a StringBuilder implementation. If want efficiency, write instead of introducing new dependency simply "delete this character sequence string"</technical_language>

Target:
private String getProcessorID(String stepping, String model, String family, String[] flags) { boolean procInfo = false; String marker = "Processor Information"; for (String checkLine : ExecutingCommand.runNative("dmidecode -t system")) { if (!procInfo && checkLine.contains(marker)) { marker = "ID:"; procInfo = true; } else if (procInfo && checkLine.contains(marker)) { return checkLine.split(marker)[1].trim(); } } marker = "eax="; for (String checkLine : ExecutingCommand.runNative("cpuid -1r")) { if (checkLine.contains(marker) && checkLine.trim().startsWith("0x00000001")) { String eax = ""; String edx = ""; for (String register : ParseUtil.whitespaces.split(checkLine)) { if (register.startsWith("eax=")) { eax = ParseUtil.removeMatchingString(register, "eax=0x"); } else if (register.startsWith("edx=")) { edx = ParseUtil.removeMatchingString(register, "edx=0x"); } } return edx + eax; } } return createProcessorID(stepping, model, family, flags); }
Source:
<code>public ImmutableCollection<MapView> getLoadedMaps() { <START> ImmutableList.Builder<MapView> builder = ImmutableList.builder(); <END> loadedDataList.forEach(entry -> { if (entry instanceof MapView) { builder.add((MapView) entry); } }); return builder.build(); }</code><technical_language>streams instead</technical_language>

Target:
public ImmutableCollection<MapView> getLoadedMaps() { return loadedDataList.stream().filter(MapView.class::isInstance) .map(MapView.class::cast).collect(ImmutableList.toImmutableList()); }
Source:
<code>public static <T> Option<T> empty() { <START> return new Option<>(null); <END> }</code><technical_language>this a singleton UNSET</technical_language>

Target:
public static <T> Option<T> empty() { @SuppressWarnings("unchecked") Option<T> empty = (Option<T>) EMPTY; return empty; }
Source:
<code>private void writeFeatures() { if (vm.getClusterArch().getFamily() != ArchitectureType.x86) { return; } boolean acpiEnabled = vm.getAcpiEnable(); boolean <START> kaslr = <END> vmInfoBuildUtils.isKASLRDumpEnabled(vm.getVmOsId()); boolean ovmfEnabled = vm.getBiosType().isOvmf(); if (!acpiEnabled && !hypervEnabled && !kaslr && !ovmfEnabled) { return; } writer.writeStartElement("features"); if (acpiEnabled) { writer.writeElement("acpi"); } if (hypervEnabled) { writer.writeStartElement("hyperv"); writer.writeStartElement("relaxed"); writer.writeAttributeString("state", "on"); writer.writeEndElement(); writer.writeStartElement("vapic"); writer.writeAttributeString("state", "on"); writer.writeEndElement(); writer.writeStartElement("spinlocks"); writer.writeAttributeString("state", "on"); writer.writeAttributeString("retries", "8191"); writer.writeEndElement(); writer.writeEndElement(); } if (kaslr) { writer.writeElement("vmcoreinfo"); } if (ovmfEnabled) { writer.writeStartElement("smm"); writer.writeAttributeString("state", "on"); writer.writeEndElement(); } writer.writeEndElement(); }</code><technical_language>if happen rebase this patch, please rename this kaslrEnabled</technical_language>

Target:
private void writeFeatures() { if (vm.getClusterArch().getFamily() != ArchitectureType.x86) { return; } boolean acpiEnabled = vm.getAcpiEnable(); boolean kaslrEnabled = vmInfoBuildUtils.isKASLRDumpEnabled(vm.getVmOsId()); boolean ovmfEnabled = vm.getBiosType().isOvmf(); if (!acpiEnabled && !hypervEnabled && !kaslrEnabled && !ovmfEnabled) { return; } writer.writeStartElement("features"); if (acpiEnabled) { writer.writeElement("acpi"); } if (hypervEnabled) { writer.writeStartElement("hyperv"); writer.writeStartElement("relaxed"); writer.writeAttributeString("state", "on"); writer.writeEndElement(); writer.writeStartElement("vapic"); writer.writeAttributeString("state", "on"); writer.writeEndElement(); writer.writeStartElement("spinlocks"); writer.writeAttributeString("state", "on"); writer.writeAttributeString("retries", "8191"); writer.writeEndElement(); writer.writeEndElement(); } if (kaslrEnabled) { writer.writeElement("vmcoreinfo"); } if (ovmfEnabled) { writer.writeStartElement("smm"); writer.writeAttributeString("state", "on"); writer.writeEndElement(); } writer.writeEndElement(); }
Source:
<code>public int addPartition(String table, String partition) throws IOException, InterruptedException { String queryStr = "ALTER TABLE " + table + " ADD IF NOT EXISTS PARTITION (" + partition + ")"; int commandId = query(queryStr); <START> return waitForCompletion(commandId, MAX_QUBOLE_WAIT_TIME_MS); <END> }</code><technical_language>do return code</technical_language>

Target:
public void addPartition(String table, String partition) throws IOException, InterruptedException { String queryStr = "ALTER TABLE " + table + " ADD IF NOT EXISTS PARTITION (" + partition + ")"; int commandId = query(queryStr); waitForCompletion(commandId, MAX_QUBOLE_WAIT_TIME_MS); }
Source:
<code>private void printCacheHelp() { log(i("The '" + CACHE + " subcommand' is used to get information about and perform actions with caches. The command has the following syntax:")); nl(); log(i(UTILITY_NAME_WITH_COMMON_OPTIONS + " " + CACHE + " [subcommand] <subcommand_parameters>")); nl(); log(i("The subcommands that take " + OP_NODE_ID + " as an argument ('" + LIST + "', '" + CONTENTION + "' and '" + VALIDATE_INDEXES + "') will be executed on the given node or on all server nodes if the option is not specified. Other commands will run on a random server node.")); nl(); nl(); log(i("Subcommands:")); String CACHES = "cacheName1,...,cacheNameN"; usageCache(LIST, "regexPattern", op(or(GROUP, SEQUENCE)), OP_NODE_ID, op(CONFIG), op(OUTPUT_FORMAT, MULTI_LINE)); usageCache(CONTENTION, "minQueueSize", OP_NODE_ID, op("maxPrint")); usageCache(IDLE_VERIFY, op(DUMP), op(SKIP_ZEROS), op(CHECK_CRC), op(EXCLUDE_CACHES, CACHES), <START> op(CACHE_FILTER, or("ALL|USER|SYSTEM|PERSISTENT|NON_PERSISTENT")), op(CACHES)); <END> usageCache(VALIDATE_INDEXES, op(CACHES), OP_NODE_ID, op(or(CHECK_FIRST + " N", CHECK_THROUGH + " K"))); usageCache(DISTRIBUTION, or(NODE_ID, NULL), op(CACHES), op(USER_ATTRIBUTES, "attrName1,...,attrNameN")); usageCache(RESET_LOST_PARTITIONS, CACHES); nl(); }</code><technical_language>Please Enum values instead of strings. Method or() adds | values</technical_language>

Target:
private void printCacheHelp() { log(i("The '" + CACHE + " subcommand' is used to get information about and perform actions with caches. The command has the following syntax:")); nl(); log(i(UTILITY_NAME_WITH_COMMON_OPTIONS + " " + CACHE + " [subcommand] <subcommand_parameters>")); nl(); log(i("The subcommands that take " + OP_NODE_ID + " as an argument ('" + LIST + "', '" + CONTENTION + "' and '" + VALIDATE_INDEXES + "') will be executed on the given node or on all server nodes if the option is not specified. Other commands will run on a random server node.")); nl(); nl(); log(i("Subcommands:")); String CACHES = "cacheName1,...,cacheNameN"; usageCache(LIST, "regexPattern", op(or(GROUP, SEQUENCE)), OP_NODE_ID, op(CONFIG), op(OUTPUT_FORMAT, MULTI_LINE)); usageCache(CONTENTION, "minQueueSize", OP_NODE_ID, op("maxPrint")); usageCache(IDLE_VERIFY, op(DUMP), op(SKIP_ZEROS), op(CHECK_CRC), op(EXCLUDE_CACHES, CACHES), op(CACHE_FILTER, or(ALL, USER, SYSTEM, PERSISTENT, NOT_PERSISTENT)), op(CACHES)); usageCache(VALIDATE_INDEXES, op(CACHES), OP_NODE_ID, op(or(CHECK_FIRST + " N", CHECK_THROUGH + " K"))); usageCache(DISTRIBUTION, or(NODE_ID, NULL), op(CACHES), op(USER_ATTRIBUTES, "attrName1,...,attrNameN")); usageCache(RESET_LOST_PARTITIONS, CACHES); nl(); }
Source:
<code>protected void runAsync(final Runnable runnable) throws Exception { <START> Executors.newSingleThreadExecutor().submit(runnable).get(); <END> }</code><technical_language>AFAIK good shutdown executor needed</technical_language>

Target:
protected void runAsync(final Runnable runnable) throws Exception { final ExecutorService service = Executors.newSingleThreadExecutor(); service.submit(runnable); service.shutdown(); }
Source:
<code>public <T> T insert(String containerName, T objectToSave) { <START> return insert(getContainerName(objectToSave.getClass()), objectToSave, null); <END> }</code><technical_language>containerName instead of getContainerName(objectToSave.getClass())</technical_language>

Target:
public <T> T insert(String containerName, T objectToSave) { return insert(containerName, objectToSave, null); }
Source:
<code>public static <O> ScrollResult<O> emptyResult() { <START> return EMPTY_RESULT; <END> }</code><technical_language>return (<O>) EMPTY_RESULT; I guess</technical_language>

Target:
public static <O> ScrollResult<O> emptyResult() { return (ScrollResult<O>) EMPTY_RESULT; }
Source:
<code>private Object getPropertyViaGetter(Object object, GraphQLOutputType outputType) { boolean isBooleanProperty = isBooleanProperty(outputType); String prefix = isBooleanProperty ? "is" : "get"; try { return getPropertyViaGetterUsingPrefix(object, outputType, prefix); } catch (NoSuchMethodException e) { <START> if (isBooleanProperty){ <END> try { return getPropertyViaGetterUsingPrefix(object, outputType, "get"); } catch (NoSuchMethodException e1) { return getPropertyViaFieldAccess(object, outputType); } }else{ return getPropertyViaFieldAccess(object, outputType); } } }</code><technical_language>java if(isBooleanProperty){ try { return getPropertyViaGetterUsingPrefix(object, outputType, "get"); } catch (NoSuchMethodException e1) { // Empty } } return getPropertyViaFieldAccess(object, outputType);</technical_language>

Target:
private Object getPropertyViaGetter(Object object, GraphQLOutputType outputType) { try { if (isBooleanProperty(outputType)) { try { return getPropertyViaGetterUsingPrefix(object, "is"); } catch (NoSuchMethodException e) { return getPropertyViaGetterUsingPrefix(object, "get"); } } else { return getPropertyViaGetterUsingPrefix(object, "get"); } } catch (NoSuchMethodException e1) { return getPropertyViaFieldAccess(object); } }
Source:
<code>public synchronized ICommandResult executeCommand(List<String> command, IProgressMonitor monitor) throws ExecutionException { Map<String, ICommandResult> commands = fScenarioMap.get(fScenario); <START> String commandLine = toCommandSring(command); <END> String fullCommand = commandLine; Matcher matcher = LTTNG_LIST_SESSION_PATTERN.matcher(commandLine); if (matcher.matches() && !commandLine.matches(LTTNG_LIST_PROVIDER_PATTERN)) { String sessionName = matcher.group(1).trim(); Integer i = fSessionNameMap.get(sessionName); if (i != null) { i++; } else { i = 0; } fSessionNameMap.put(sessionName, i); fullCommand += String.valueOf(i); } if (commands.containsKey(fullCommand)) { return commands.get(fullCommand); } String[] output = new String[1]; output[0] = String.valueOf("Command not found"); CommandResult result = new CommandResult(0, null, null); result.setOutput(output); result.setErrorOutput(output); result.setResult(1); return result; }</code><technical_language>LTTngControlService.toCommandString</technical_language>

Target:
public synchronized ICommandResult executeCommand(List<String> command, IProgressMonitor monitor) throws ExecutionException { Map<String, ICommandResult> commands = fScenarioMap.get(fScenario); String commandLine = LTTngControlService.toCommandString(command); String fullCommand = commandLine; Matcher matcher = LTTNG_LIST_SESSION_PATTERN.matcher(commandLine); if (matcher.matches() && !commandLine.matches(LTTNG_LIST_PROVIDER_PATTERN)) { String sessionName = matcher.group(1).trim(); Integer i = fSessionNameMap.get(sessionName); if (i != null) { i++; } else { i = 0; } fSessionNameMap.put(sessionName, i); fullCommand += String.valueOf(i); } if (commands.containsKey(fullCommand)) { return commands.get(fullCommand); } String[] output = new String[1]; output[0] = String.valueOf("Command not found"); CommandResult result = new CommandResult(0, null, null); result.setOutput(output); result.setErrorOutput(output); result.setResult(1); return result; }