auphong2707/dl4se-code-review-dataset huggingface dataset:
Source:
<code>private void testRemindAllAction() { <START> ______TS("Typical case: remind all"); <END> resultsPage.clickRemindAllButton(); resultsPage.cancelRemindAllForm(); resultsPage.clickRemindAllButton(); resultsPage.waitForAjaxLoaderGifToDisappear(); resultsPage.deselectUsersInRemindAllForm(); resultsPage.clickRemindButtonInModal(); resultsPage.waitForAjaxLoaderGifToDisappear(); resultsPage.verifyStatus(Const.StatusMessages.FEEDBACK_SESSION_REMINDERSEMPTYRECIPIENT); resultsPage.clickRemindAllButton(); resultsPage.waitForAjaxLoaderGifToDisappear(); resultsPage.clickRemindButtonInModal(); resultsPage.waitForAjaxLoaderGifToDisappear(); resultsPage.verifyStatus(Const.StatusMessages.FEEDBACK_SESSION_REMINDERSSENT); }</code><technical_language>need 3 TS calls for of 3 cases tested here</technical_language>

Target:
private void testRemindAllAction() { ______TS("Typical case: remind all: click on cancel"); resultsPage.clickRemindAllButtonAndWaitForFormToLoad(); resultsPage.cancelRemindAllForm(); ______TS("Typical case: remind all: click on remind with no students selected"); resultsPage.clickRemindAllButtonAndWaitForFormToLoad(); resultsPage.deselectUsersInRemindAllForm(); resultsPage.clickRemindButtonInModal(); resultsPage.waitForAjaxLoaderGifToDisappear(); resultsPage.verifyStatus(Const.StatusMessages.FEEDBACK_SESSION_REMINDERSEMPTYRECIPIENT); ______TS("Typical case: remind all: click on remind with students selected"); resultsPage.clickRemindAllButtonAndWaitForFormToLoad(); resultsPage.clickRemindButtonInModal(); resultsPage.waitForAjaxLoaderGifToDisappear(); resultsPage.verifyStatus(Const.StatusMessages.FEEDBACK_SESSION_REMINDERSSENT); }
Source:
<code>private String getTaskNameList(boolean showTags){ <START> StringBuffer buf = new StringBuffer(); <END> ArrayList<InternalTask> tasks = job.getITasks(); if(tasks.size() > 0){ buf.append(tasks.get(0).getName()); for(int i = 1; i < tasks.size(); i++){ InternalTask currentTask = tasks.get(i); buf.append(", "); buf.append(currentTask.getName()); if(showTags){ if(currentTask.getTag() != null){ buf.append("("); buf.append(currentTask.getTag()); buf.append(")"); } } } } return buf.toString(); }</code><technical_language>getTaskNameList executed in parallel. If is case, _StringBuilder_ is enough</technical_language>

Target:
private String getTaskNameList(boolean showTags){ StringBuilder builder = new StringBuilder(); ArrayList<InternalTask> tasks = job.getITasks(); if(tasks.size() > 0){ builder.append(tasks.get(0).getName()); for(int i = 1; i < tasks.size(); i++){ InternalTask currentTask = tasks.get(i); builder.append(", "); builder.append(currentTask.getName()); if(showTags){ if(currentTask.getTag() != null){ builder.append("("); builder.append(currentTask.getTag()); builder.append(")"); } } } } return builder.toString(); }
Source:
<code>public Response setTxComment(long branchUuid, int txId, String comment) { TransactionReadable tx = getTxByBranchAndId(branchUuid, txId); boolean modified = false; if (Compare.isDifferent(tx.getComment(), comment)) { <START> <END> activityLog.createEntry(BRANCH_OPERATION_TYPEID, ActivityLog.INITIAL_STATUS, String.format( "Branch Operation Set Tx Comment {branchUUID: %s prevComment: %s newComment: %s accountId: %s serverId: %s clientId: %s}", branchUuid, tx.getComment(), comment, accountId, serverId, clientId)); TransactionFactory txFactory = newTxFactory(); txFactory.setTransactionComment(tx, comment); modified = true; } return asResponse(modified); }</code><technical_language>try/catch (same for rest below)</technical_language>

Target:
public Response setTxComment(long branchUuid, int txId, String comment) { TransactionReadable tx = getTxByBranchAndId(branchUuid, txId); boolean modified = false; if (Compare.isDifferent(tx.getComment(), comment)) { try { activityLog.createEntry(BRANCH_OPERATION_TYPEID, ActivityLog.INITIAL_STATUS, String.format( "Branch Operation Set Tx Comment {branchUUID: %s prevComment: %s newComment: %s accountId: %s serverId: %s clientId: %s}", branchUuid, tx.getComment(), comment, RestUtil.getAccountId(httpHeaders), RestUtil.getServerId(httpHeaders), RestUtil.getClientId(httpHeaders))); } catch (OseeCoreException ex) { OseeLog.log(ActivityLog.class, OseeLevel.SEVERE_POPUP, ex); } TransactionFactory txFactory = newTxFactory(); txFactory.setTransactionComment(tx, comment); modified = true; } return asResponse(modified); }
Source:
<code>public void testWriteAndRecovery() throws Exception { WriteHandle lh = result(bkc.newCreateLedgerOp() .withEnsembleSize(1) .withWriteQuorumSize(1) .withAckQuorumSize(1) .withWriteFlags(WriteFlag.DEFERRED_SYNC) .withDigestType(org.apache.bookkeeper.client.api.DigestType.CRC32C) <START> .withPassword(new byte[0]) <END> .execute()); int n = 10; long ledgerId = lh.getId(); for (int i = 0; i < n; i++) { lh.append(("entry-" + i).getBytes()); } restartBookies(); try (ReadHandle readLh = result(bkc.newOpenLedgerOp() .withLedgerId(ledgerId) .withRecovery(true) .withPassword(new byte[0]) .execute());) { try (LedgerEntries entries = readLh.read(0, n - 1)) { for (int i = 0; i < n; i++) { org.apache.bookkeeper.client.api.LedgerEntry entry = entries.getEntry(i); assertEquals("entry-" + i, new String(entry.getEntryBytes())); } } } }</code><technical_language>@Cleanup in a try block</technical_language>

Target:
public void testWriteAndRecovery() throws Exception { WriteHandle lh = result(bkc.newCreateLedgerOp() .withEnsembleSize(1) .withWriteQuorumSize(1) .withAckQuorumSize(1) .withWriteFlags(WriteFlag.DEFERRED_SYNC) .withDigestType(DigestType.CRC32C) .withPassword(new byte[0]) .execute()); int n = 10; long ledgerId = lh.getId(); for (int i = 0; i < n; i++) { lh.append(("entry-" + i).getBytes(UTF_8)); } try (ReadHandle readLh = result(bkc.newOpenLedgerOp() .withLedgerId(ledgerId) .withRecovery(true) .withPassword(new byte[0]) .execute());) { try (LedgerEntries entries = readLh.read(0, n - 1)) { for (int i = 0; i < n; i++) { org.apache.bookkeeper.client.api.LedgerEntry entry = entries.getEntry(i); assertEquals("entry-" + i, new String(entry.getEntryBytes())); } } } }
Source:
<code>void setup(final ExecutableFlow flow) { File execDir = null; try { final ProjectVersion projectVersion = getProjectVersion(flow); <START> synchronized (projectVersion) { <END> setupProject(projectVersion); execDir = createExecDir(flow); copyCreateHardlinkDirectory(projectVersion.getInstalledDir(), execDir); } log.info(String.format("Flow Preparation complete. [execid: %d, path: %s]", flow.getExecutionId(), execDir.getPath())); } catch (final Exception e) { log.error("Error in setting up project directory: " + this.projectsDir + ", Exception: " + e); cleanup(execDir); throw new RuntimeException(e); } }</code><technical_language>intention of synchronizing projectVersion here</technical_language>

Target:
void setup(final ExecutableFlow flow) { File execDir = null; try { final ProjectVersion projectVersion = getProjectVersion(flow); synchronized (projectVersion) { setupProject(projectVersion); execDir = createExecDir(flow); copyCreateHardlinkDirectory(projectVersion.getInstalledDir(), execDir); log.info(String.format("Flow Preparation complete. [execid: %d, path: %s]", flow.getExecutionId(), execDir.getPath())); } } catch (final Exception e) { log.error("Error in setting up project directory: " + this.projectsDir + ", Exception: " + e); cleanup(execDir); throw new RuntimeException(e); } }
Source:
<code>public SAMLSSOReqValidationResponseDTO validateSPInitSSORequest(String samlReq, String queryString, String sessionId, String rpSessionId, String authnMode, boolean isPost) throws IdentityException { XMLObject request; if (isPost) { request = SAMLSSOUtil.unmarshall(SAMLSSOUtil.decodeForPost(samlReq)); } else { request = SAMLSSOUtil.unmarshall(SAMLSSOUtil.decode(samlReq)); } if (request instanceof AuthnRequest) { SPInitSSOAuthnRequestValidator authnRequestValidator = new SPInitSSOAuthnRequestValidator( (AuthnRequest) request); SAMLSSOReqValidationResponseDTO validationResp = authnRequestValidator.validate(); validationResp.setRequestMessageString(samlReq); validationResp.setQueryString(queryString); validationResp.setRpSessionId(rpSessionId); validationResp.setIdPInitSSO(false); <START> Integer index = ((AuthnRequest) request).getAttributeConsumingServiceIndex(); <END> if (index != null && index != 0) { validationResp.setAttributeConsumingServiceIndex(index.toString()); } return validationResp; } else if (request instanceof LogoutRequest) { SPInitLogoutRequestProcessor logoutReqProcessor = new SPInitLogoutRequestProcessor(); SAMLSSOReqValidationResponseDTO validationResponseDTO = logoutReqProcessor.process((LogoutRequest) request, sessionId, queryString); return validationResponseDTO; } return null; }</code><technical_language>primitive int here. get auto unboxed. this ? logic is in SPInitSSOAuthnRequestValidator creates SAMLSSOReqValidationResponseDTO returns. This get overwritten right</technical_language>

Target:
public SAMLSSOReqValidationResponseDTO validateSPInitSSORequest(String samlReq, String queryString, String sessionId, String rpSessionId, String authnMode, boolean isPost) throws IdentityException { XMLObject request; if (isPost) { request = SAMLSSOUtil.unmarshall(SAMLSSOUtil.decodeForPost(samlReq)); } else { request = SAMLSSOUtil.unmarshall(SAMLSSOUtil.decode(samlReq)); } if (request instanceof AuthnRequest) { SPInitSSOAuthnRequestValidator authnRequestValidator = new SPInitSSOAuthnRequestValidator( (AuthnRequest) request); SAMLSSOReqValidationResponseDTO validationResp = authnRequestValidator.validate(); validationResp.setRequestMessageString(samlReq); validationResp.setQueryString(queryString); validationResp.setRpSessionId(rpSessionId); validationResp.setIdPInitSSO(false); return validationResp; } else if (request instanceof LogoutRequest) { SPInitLogoutRequestProcessor logoutReqProcessor = new SPInitLogoutRequestProcessor(); SAMLSSOReqValidationResponseDTO validationResponseDTO = logoutReqProcessor.process((LogoutRequest) request, sessionId, queryString); return validationResponseDTO; } return null; }
Source:
<code>private static double sortableLongToDouble(long value) { <START> value = value ^ (value >> 63) & Long.MAX_VALUE; <END> return Double.longBitsToDouble(value); }</code><technical_language>here. Add clarifying parenthesis</technical_language>

Target:
private static double sortableLongToDouble(long value) { value = value ^ ((value >> 63) & Long.MAX_VALUE); return Double.longBitsToDouble(value); }
Source:
<code><START> public boolean rangeCheck( ItemStack itm, final Entity player ) <END> { ILocatable obj = null; try { final long encKey = Long.parseLong( this.getEncryptionKey( itm ) ); obj = AEApi.instance().registries().locatable().getLocatableBy( encKey ); } catch( final NumberFormatException err ) { } IGrid grid = null; IMEMonitor<IAEItemStack> inv = null; if( obj instanceof IGridHost ) { final IGridNode n = ( (IGridHost) obj ).getGridNode( ForgeDirection.UNKNOWN ); if( n != null ) { grid = n.getGrid(); if( grid != null ) { IStorageGrid sg = grid.getCache( IStorageGrid.class ); if( sg != null ) { inv = sg.getItemInventory(); } } } } if( grid != null && inv != null ) { final IMachineSet tw = grid.getMachines( TileWireless.class ); for( final IGridNode n : tw ) { final IWirelessAccessPoint wap = (IWirelessAccessPoint) n.getMachine(); if( this.testWap( wap, player ) ) { return true; } } } return false; }</code><technical_language>![MAJOR](<LINK_0> Cyclomatic Complexity of this method "rangeCheck" is 11 is greater 10 authorized. [![rule](<LINK_1>](<LINK_2></technical_language>

Target:
public boolean rangeCheck( ItemStack itm, final Entity player ) { ILocatable obj = null; try { final long encKey = Long.parseLong( this.getEncryptionKey( itm ) ); obj = AEApi.instance().registries().locatable().getLocatableBy( encKey ); } catch( final NumberFormatException err ) { } IGrid grid = null; IMEMonitor<IAEItemStack> inv = null; if( obj instanceof IGridHost ) { final IGridNode n = ( (IGridHost) obj ).getGridNode( ForgeDirection.UNKNOWN ); if( n != null ) { grid = n.getGrid(); if( grid != null ) { final IStorageGrid sg = grid.getCache( IStorageGrid.class ); if( sg != null ) { inv = sg.getItemInventory(); } } } } if( grid != null && inv != null ) { final IMachineSet tw = grid.getMachines( TileWireless.class ); for( final IGridNode n : tw ) { final IWirelessAccessPoint wap = (IWirelessAccessPoint) n.getMachine(); if( this.testWap( wap, player ) ) { return true; } } } return false; }
Source:
<code>public ResponseEntity<Problem> handleFeatureNotAvailable( final FeatureNotAvailableException ex, final NativeWebRequest request) { LOG.debug(ex.getMessage(), ex); <START> return Responses.create(Problem.valueOf(NOT_IMPLEMENTED, "Feature is disabled"), request); <END> }</code><technical_language>ex.getMessage() "Feature is disabled"</technical_language>

Target:
public ResponseEntity<Problem> handleFeatureNotAvailable( final FeatureNotAvailableException ex, final NativeWebRequest request) { LOG.debug(ex.getMessage(), ex); return Responses.create(Problem.valueOf(NOT_IMPLEMENTED, ex.getMessage()), request); }
Source:
<code>public boolean addBlobStore(ReplicaId replica) { <START> CloudBlobStore cloudStore = partitionToStore.getOrDefault(replica.getPartitionId(), null); <END> if (cloudStore == null) { cloudStore = new CloudBlobStore(properties, replica.getPartitionId(), cloudDestination, clusterMap, vcrMetrics); partitionToStore.put(replica.getPartitionId(), cloudStore); } return startBlobStore(replica.getPartitionId()); }</code><technical_language>partitionToStore.computeIfAbsent here</technical_language>

Target:
public boolean addBlobStore(ReplicaId replica) { CloudBlobStore cloudBlobStore = partitionToStore.computeIfAbsent(replica.getPartitionId(), store -> new CloudBlobStore(properties, replica.getPartitionId(), cloudDestination, clusterMap, vcrMetrics)); return startBlobStore(replica.getPartitionId()); }
Source:
<code>public void onCalloutResult(String result, Intent intent) { boolean resultSet = false; if (result != null) { setSearchText(result); resultSet = true; } Callout callout = shortSelect.getCallout(); for (String key : callout.getResponses()) { result = intent.getExtras().getString(key); if (result != null && !resultSet) { <START> resultSet = true; <END> setSearchText(result); break; } } }</code><technical_language>Unused variable assignment</technical_language>

Target:
public void onCalloutResult(String result, Intent intent) { boolean resultSet = false; if (result != null) { setSearchText(result); resultSet = true; } for (String key : shortSelect.getCallout().getResponses()) { result = intent.getExtras().getString(key); if (result != null && !resultSet) { resultSet = true; setSearchText(result); break; } } }
Source:
<code>public static OrganizationType findOrganizationTypeBy(List<OrganizationType> organizations, String hcid) { if (CollectionUtils.isEmpty(organizations)) { return null; } <START> if (StringUtils.isBlank(hcid)) { <END> return organizations.get(0); } for (OrganizationType organization : organizations) { if (equalsIgnoreCaseForHCID(hcid, organization.getHcid())) { return organization; } } return null; }</code><technical_language>Please elaborate returning organization hcid is blank</technical_language>

Target:
public static OrganizationType findOrganizationTypeBy(List<OrganizationType> organizations, String hcid) { if (CollectionUtils.isEmpty(organizations)) { return null; } if (StringUtils.isBlank(hcid)) { return null; } for (OrganizationType organization : organizations) { if (equalsIgnoreCaseForHCID(hcid, organization.getHcid())) { return organization; } } return null; }
Source:
<code>protected DetailedModuleDefinitionResource instantiateResource(ModuleDefinition entity) { DetailedModuleDefinitionResource result = new DetailedModuleDefinitionResource(entity.getName(), <START> entity.getResource().getDescription(), <END> entity.getType().name()); ModuleOptions moduleOptions = entity.getModuleOptions(); if (moduleOptions.iterator() != null) { for (ModuleOption option : moduleOptions) { Object defaultValue = option.getDefaultValue(); Class<?> type = option.getType(); result.addOption(new DetailedModuleDefinitionResource.Option(option.getName(), type == null ? null : type.getSimpleName(), option.getDescription(), defaultValue == null ? null : defaultValue.toString())); } } return result; }</code><technical_language>entity.getResource().getDescription() is "definition" in sense expected this constructor arg (that is currently for "definition" a composed module provides a non-composed module not)</technical_language>

Target:
protected DetailedModuleDefinitionResource instantiateResource(ModuleDefinition entity) { DetailedModuleDefinitionResource result = new DetailedModuleDefinitionResource(entity.getName(), entity.getType().name()); ModuleOptionsMetadata moduleOptionsMetadata = entity.getModuleOptions(); if (moduleOptionsMetadata != null) { for (ModuleOption option : moduleOptionsMetadata) { Object defaultValue = option.getDefaultValue(); Class<?> type = option.getType(); result.addOption(new DetailedModuleDefinitionResource.Option(option.getName(), type == null ? null : type.getSimpleName(), option.getDescription(), defaultValue == null ? null : defaultValue.toString())); } } return result; }
Source:
<code>public List<String> getIgnorePostProcessors() { String list = props.getProperty("ignorePostProcessors"); if (list == null) return Collections.emptyList(); <START> else if (list.isEmpty()) return Collections.emptyList(); <END> return Arrays.asList(list.split(",")); }</code><technical_language>suggestion if (list == null || list.isEmpty()) return Collections.emptyList();</technical_language>

Target:
public Set<String> getIgnorePostProcessors() { String list = props.getProperty("ignorePostProcessors"); if (list == null || list.isEmpty()) return Collections.EMPTY_SET; return Collections.unmodifiableSet(new HashSet<String>(Arrays.asList(list.split(",")))); }
Source:
<code>public final Response send( final Request req, final String home, final String method, final Collection<Map.Entry<String, String>> headers, final InputStream content, final int connect, final int read ) throws IOException { final Response rsp; <START> boolean requestHasCmch = false; <END> for (final Map.Entry<String, String> header : headers) { if (header.getKey().equals(this.cmch)) { requestHasCmch = true; break; } } if (method.equals(Request.GET) && !requestHasCmch) { rsp = this.consultCache( req, home, method, headers, content, connect, read ); } else { rsp = this.origin.send( req, home, method, headers, content, connect, read ); } return rsp; }</code><technical_language>bother calculating this a GET request this is expensive</technical_language>

Target:
public final Response send( final Request req, final String home, final String method, final Collection<Map.Entry<String, String>> headers, final InputStream content, final int connect, final int read ) throws IOException { final Response rsp; if (method.equals(Request.GET) && !this.requestHasCmcHeader(headers)) { rsp = this.consultCache( req, home, method, headers, content, connect, read ); } else { rsp = this.origin.send( req, home, method, headers, content, connect, read ); } return rsp; }
Source:
<code>public DistStageAck executeOnSlave() { if (expectedLevel == null) { return errorResponse("No expected level set", null); } else if (!expectedLevel.equalsIgnoreCase(REPEATABLE_READ) && !expectedLevel.equalsIgnoreCase(READ_COMMITTED)) { return errorResponse("Expected level should be one of " + READ_COMMITTED + " and " + REPEATABLE_READ, null); } BasicOperations.Cache<Object, Object> cache = basicOperations.getCache(null); try { cache.put(ISOLATION_CHECK_KEY, new Long(0)); } catch (Exception e) { return errorResponse("Failed to insert first value", e); } List<ClientThread> threads = new ArrayList<ClientThread>(); for (int i = 0; i < writers; ++i) { ClientThread t = new WriterThread(); t.setName("Writer-" + i); t.start(); threads.add(t); } for (int i = 0; i < readers; ++i) { ClientThread t = new ReaderThread(); t.setName("Reader-" + i); t.start(); threads.add(t); } try { Thread.sleep(duration); } catch (InterruptedException e) { <START> log.error("Thread has been interrupted", e); <END> } finished = true; DistStageAck error = checkThreads(threads); if (error != null) return error; return new ChangeAck(slaveState, valueChangeDetected); }</code><technical_language>restore interrupt status well</technical_language>

Target:
public DistStageAck executeOnSlave() { if (expectedLevel == null) { return errorResponse("No expected level set", null); } else if (!expectedLevel.equalsIgnoreCase(REPEATABLE_READ) && !expectedLevel.equalsIgnoreCase(READ_COMMITTED)) { return errorResponse("Expected level should be one of " + READ_COMMITTED + " and " + REPEATABLE_READ, null); } BasicOperations.Cache<Object, Object> cache = basicOperations.getCache(null); try { cache.put(ISOLATION_CHECK_KEY, new Long(0)); } catch (Exception e) { return errorResponse("Failed to insert first value", e); } List<ClientThread> threads = new ArrayList<ClientThread>(); for (int i = 0; i < writers; ++i) { ClientThread t = new WriterThread(); t.setName("Writer-" + i); t.start(); threads.add(t); } for (int i = 0; i < readers; ++i) { ClientThread t = new ReaderThread(); t.setName("Reader-" + i); t.start(); threads.add(t); } try { Thread.sleep(duration); } catch (InterruptedException e) { log.error("Thread has been interrupted", e); Thread.currentThread().interrupt(); } finished = true; DistStageAck error = checkThreads(threads); if (error != null) return error; return new ChangeAck(slaveState, valueChangeDetected); }
Source:
<code>protected void ProceedProxyReturnValue() { VdcBllErrors returnStatus = GetReturnValueFromStatus(getReturnStatus()); switch (returnStatus) { case Done: case StoragePoolMasterNotFound: case StoragePoolTooManyMasters: case StoragePoolWrongMaster: super.ProceedProxyReturnValue(); break; case ReleaseLockFailure: case AcquireHostIdFailure: case ReleaseHostIdFailure: VDSExceptionBase outEx = new VDSErrorException(String.format("Failed in vdscommand to %1$s, error = %2$s", <START> getCommandName(), getReturnStatus().mMessage)); <END> InitializeVdsError(returnStatus); getVDSReturnValue().setSucceeded(false); throw outEx; default: getVDSReturnValue().setSucceeded(false); InitializeVdsError(returnStatus); break; } }</code><technical_language>in ConnectStoragePoolVDSCommand, is getCommandName() necessary? also, remove "to" - "Failed in VdsCommand %1, error = %2$s"</technical_language>

Target:
protected void ProceedProxyReturnValue() { VdcBllErrors returnStatus = GetReturnValueFromStatus(getReturnStatus()); switch (returnStatus) { case Done: case StoragePoolMasterNotFound: case StoragePoolTooManyMasters: case StoragePoolWrongMaster: super.ProceedProxyReturnValue(); break; case ReleaseLockFailure: case AcquireHostIdFailure: case ReleaseHostIdFailure: VDSExceptionBase outEx = new VDSErrorException(String.format("Failed in vdscommand %1$s, error = %2$s", getCommandName(), getReturnStatus().mMessage)); InitializeVdsError(returnStatus); getVDSReturnValue().setSucceeded(false); throw outEx; default: getVDSReturnValue().setSucceeded(false); InitializeVdsError(returnStatus); break; } }
Source:
<code>private String updateConfigScript(final String host, final String server, <START> final int sport) { <END> final ConcurrentHashMap<String, String> values = new ConcurrentHashMap<String, String>(); values.put("host", host); values.put("server", server); values.put("sport", new Integer(sport).toString()); values.put("binary", this.binary); values.put("config", this.config); values.put( "LoadBalancerDir", Manifests.read("Thindeck-LoadBalancer-Directory") ); final String template = Joiner.on(';').join( "cd ${LoadBalancerDir}", "if [ -f ${host}.hosts.conf ]", Joiner.on(' ').join( "then if [[ $(grep '${server}:${sport}'", "${host}.hosts.conf) != *${server}:${sport}* ]]" ), Joiner.on(' ').join( "then sed -i.bak -r 's/}/ server", "${server}:${sport};\\n}/' ${host}.hosts.conf" ), "fi", "rm ${host}.hosts.conf.bak", Joiner.on("\\n").join( "else printf 'upstream ${host}_servers {", " server ${server}:${sport};", "} > ${host}.hosts.conf" ), "if ! grep -q '${host}.hosts.conf' ${config}", Joiner.on(' ').join( "then sed -i.bak -r 's/http \\{/http \\{\\n ", "include ${host}.hosts.conf;/' ${config}" ), "rm ${config}.bak", "fi", "fi", "pkill -HUP -f ${binary}" ); final StrSubstitutor sub = new StrSubstitutor(values); return sub.replace(template); }</code><technical_language>Again, spaces</technical_language>

Target:
private String updateConfigScript(final String host, final String server, final int sport) { final ConcurrentHashMap<String, String> values = new ConcurrentHashMap<String, String>(); values.put("host", host); values.put("server", server); values.put("sport", Integer.toString(sport)); values.put("binary", this.binary); values.put("config", this.config); values.put( "LoadBalancerDir", Manifests.read("Thindeck-LoadBalancer-Directory") ); final String template = Joiner.on(';').join( "cd ${LoadBalancerDir}", "if [ -f ${host}.hosts.conf ]", Joiner.on(' ').join( "then if [[ $(grep '${server}:${sport}'", "${host}.hosts.conf) != *${server}:${sport}* ]]" ), Joiner.on(' ').join( "then sed -i.bak -r 's/}/ server", "${server}:${sport};\\n}/' ${host}.hosts.conf" ), "fi", "rm ${host}.hosts.conf.bak", Joiner.on("\\n").join( "else printf 'upstream ${host}_servers {", " server ${server}:${sport};", "} > ${host}.hosts.conf" ), "if ! grep -q '${host}.hosts.conf' ${config}", Joiner.on(' ').join( "then sed -i.bak -r 's/http \\{/http \\{\\n ", "include ${host}.hosts.conf;/' ${config}" ), "rm ${config}.bak", "fi", "fi", "pkill -HUP -f ${binary}" ); return new StrSubstitutor(values).replace(template); }
Source:
<code><START> public int getMaxCapacity() { <END> return maxCapacity; }</code><technical_language>Restore visibility of this other methods in this class unit tests moved jaggr-core</technical_language>

Target:
int getMaxCapacity() { return maxCapacity; }
Source:
<code>public File getHeliumPackageBundleCache(String pkgName) { <START> return new File(heliumBundleDirectory, pkgName + "/" + HELIUM_BUNDLE_CACHE); <END> }</code><technical_language>this changes private</technical_language>

Target:
private File getHeliumPackageBundleCache(String pkgName) { return new File(heliumBundleDirectory, pkgName + "/" + HELIUM_BUNDLE_CACHE); }
Source:
<code>public void configurePipeline(PipelineConfigurer pipelineConfigurer) { FailureCollector collector = pipelineConfigurer.getStageConfigurer().getFailureCollector(); config.validate(collector); collector.getOrThrowException(); if (config.containsMacro(NAME_FORMAT)) { for (FileFormat f: FileFormat.values()) { <START> pipelineConfigurer.usePlugin(ValidatingOutputFormat.PLUGIN_TYPE, f.name().toLowerCase(), f.name().toLowerCase(), <END> config.getRawProperties()); } return; } FileFormat format = config.getFormat(); ValidatingOutputFormat validatingOutputFormat = pipelineConfigurer.usePlugin(ValidatingOutputFormat.PLUGIN_TYPE, format.name().toLowerCase(), format.name().toLowerCase(), config.getRawProperties()); FormatContext context = new FormatContext(collector, pipelineConfigurer.getStageConfigurer().getInputSchema()); validateOutputFormatProvider(context, format, validatingOutputFormat); }</code><technical_language>format properties required some formats optional for others? If so, this run errors</technical_language>

Target:
public void configurePipeline(PipelineConfigurer pipelineConfigurer) { FailureCollector collector = pipelineConfigurer.getStageConfigurer().getFailureCollector(); config.validate(collector); collector.getOrThrowException(); if (config.containsMacro(NAME_FORMAT)) { for (FileFormat f: FileFormat.values()) { try { pipelineConfigurer.usePlugin(ValidatingOutputFormat.PLUGIN_TYPE, f.name().toLowerCase(), f.name().toLowerCase(), config.getRawProperties()); } catch (InvalidPluginConfigException e) { LOG.warn("Failed to register format '{}', which means it cannot be used when the pipeline is run. " + "Missing properties: {}, invalid properties: {}", f.name(), e.getMissingProperties(), e.getInvalidProperties().stream().map(InvalidPluginProperty::getName).collect(Collectors.toList())); } } return; } FileFormat format = config.getFormat(); ValidatingOutputFormat validatingOutputFormat = pipelineConfigurer.usePlugin(ValidatingOutputFormat.PLUGIN_TYPE, format.name().toLowerCase(), format.name().toLowerCase(), config.getRawProperties()); FormatContext context = new FormatContext(collector, pipelineConfigurer.getStageConfigurer().getInputSchema()); validateOutputFormatProvider(context, format, validatingOutputFormat); }
Source:
<code>public String getTopCommitAuthor() { loader.waitOnClosed(); return seleniumWebDriverHelper .waitVisibility(revertPanel, ELEMENT_TIMEOUT_SEC) .getText() <START> .split("\n")[3]; <END> }</code><technical_language>complex procedure of revision number. IMHO usage of regex more obvious</technical_language>

Target:
public String getTopCommitAuthor() { loader.waitOnClosed(); int numberOfTopAuthorCell = 3; return getRevertCommitTableContent().split("\n")[numberOfTopAuthorCell]; }
Source:
<code>public List<Account> getAwsAccountsByUser(final String userId) { Preconditions.checkArgument(StringUtils.hasText(userId), "userId must not be blank"); final ResponseEntity<List<Account>> typeAws = restOperations.exchange( get(URI.create(baseUrl + "/api/accounts/aws?member=" + userId)).build(), userTeamListType); Preconditions.checkState(typeAws.getStatusCode().is2xxSuccessful(), "getAwsAccountsByUser for type AWS failed: %s", typeAws); final ResponseEntity<List<Account>> typeK8s = restOperations.exchange( get(URI.create(baseUrl + "/api/accounts/kubernetes?role=PowerUser&member=" + userId)).build(), userTeamListType); Preconditions.checkState(typeAws.getStatusCode().is2xxSuccessful(), "getAwsAccountsByUser for type Kubernetes failed: %s", typeK8s); <START> final List<Account> allAccounts = typeAws.getBody(); <END> allAccounts.addAll(typeK8s.getBody()); return allAccounts; }</code><technical_language>if list returned .getBody() is mutable. create a completely new list add members both</technical_language>

Target:
public List<Account> getAwsAccountsByUser(final String userId) { Preconditions.checkArgument(StringUtils.hasText(userId), "userId must not be blank"); final ResponseEntity<List<Account>> typeAws = restOperations.exchange( get(URI.create(baseUrl + "/api/accounts/aws?member=" + userId)).build(), userTeamListType); Preconditions.checkState(typeAws.getStatusCode().is2xxSuccessful(), "getAwsAccountsByUser for type AWS failed: %s", typeAws); final ResponseEntity<List<Account>> typeK8s = restOperations.exchange( get(URI.create(baseUrl + "/api/accounts/kubernetes?role=PowerUser&member=" + userId)).build(), userTeamListType); Preconditions.checkState(typeK8s.getStatusCode().is2xxSuccessful(), "getAwsAccountsByUser for type Kubernetes failed: %s", typeK8s); return Streams.concat(typeAws.getBody().stream(), typeK8s.getBody().stream()) .collect(Collectors.toList()); }
Source:
<code>public void testFailures() throws IOException { CanaryTool.RegionStdOutSink regionStdOutSink = new CanaryTool.RegionStdOutSink(); ServerName serverName1 = ServerName.valueOf("staging-st04.server:22600", 1584180761635L); TableName fakeTableName1 = TableName.valueOf("fakeTableName1"); RegionInfo regionInfo1 = RegionInfoBuilder.newBuilder(fakeTableName1).build(); ServerName serverName2 = ServerName.valueOf("staging-st05.server:22600", 1584180761636L); TableName fakeTableName2 = TableName.valueOf("fakeTableName2"); RegionInfo regionInfo2 = RegionInfoBuilder.newBuilder(fakeTableName2).build(); regionStdOutSink.publishReadFailure(serverName1, regionInfo1, new IOException()); regionStdOutSink.publishWriteFailure(serverName2, regionInfo2, new IOException()); CanaryStatusTmpl tmpl = new CanaryStatusTmpl(); <START> tmpl.render(new StringWriter(), regionStdOutSink); <END> }</code><technical_language>assertions all? Is verify rendered template output</technical_language>

Target:
public void testFailures() throws IOException { CanaryTool.RegionStdOutSink regionStdOutSink = new CanaryTool.RegionStdOutSink(); ServerName serverName1 = ServerName.valueOf("staging-st04.server:22600", 1584180761635L); TableName fakeTableName1 = TableName.valueOf("fakeTableName1"); RegionInfo regionInfo1 = RegionInfoBuilder.newBuilder(fakeTableName1).build(); ServerName serverName2 = ServerName.valueOf("staging-st05.server:22600", 1584180761636L); TableName fakeTableName2 = TableName.valueOf("fakeTableName2"); RegionInfo regionInfo2 = RegionInfoBuilder.newBuilder(fakeTableName2).build(); regionStdOutSink.publishReadFailure(serverName1, regionInfo1, new IOException()); regionStdOutSink.publishWriteFailure(serverName2, regionInfo2, new IOException()); CanaryStatusTmpl tmpl = new CanaryStatusTmpl(); StringWriter renderResultWriter = new StringWriter(); tmpl.render(renderResultWriter, regionStdOutSink); String renderResult = renderResultWriter.toString(); Assert.assertTrue(renderResult.contains("staging-st04.server,22600")); Assert.assertTrue(renderResult.contains("fakeTableName1")); Assert.assertTrue(renderResult.contains("staging-st05.server,22600")); Assert.assertTrue(renderResult.contains("fakeTableName2")); }
Source:
<code>protected void initializeReportTitleAndFileName(ConcurStandardAccountingExtractBatchReportData reportData) { String concurFileName = reportData.getConcurFileName(); if (StringUtils.isEmpty(concurFileName)) { <START> concurFileName = "UNKNOWN_SAE_FILENAME"; <END> } getReportWriterService().setFileNamePrefix((getFileNamePrefixFirstPart() + concurFileName + getFileNamePrefixSecondPart())); getReportWriterService().setTitle(getReportTitle()); getReportWriterService().initialize(); getReportWriterService().writeNewLines(2); getReportWriterService().writeFormattedMessageLine(getReportConcurFileNameLabel() + concurFileName); getReportWriterService().writeNewLines(2); }</code><technical_language>a good idea create constants for some of literals (and in this file practical)</technical_language>

Target:
protected void initializeReportTitleAndFileName(ConcurStandardAccountingExtractBatchReportData reportData) { String concurFileName = reportData.getConcurFileName(); if (StringUtils.isEmpty(concurFileName)) { concurFileName = ConcurConstants.StandardAccountingExtractReport.UNKNOWN_SAE_FILENAME; } getReportWriterService().setFileNamePrefix((getFileNamePrefixFirstPart() + concurFileName + getFileNamePrefixSecondPart())); getReportWriterService().setTitle(getReportTitle()); getReportWriterService().initialize(); getReportWriterService().writeNewLines(2); getReportWriterService().writeFormattedMessageLine(getReportConcurFileNameLabel() + concurFileName); getReportWriterService().writeNewLines(2); }
Source:
<code><START> public UpstreamTransformerChain<K, V> addUpstreamTransformer(IgniteFunction<Stream<UpstreamEntry<K, V>>, <END> Stream<UpstreamEntry<K, V>>> transformer) { return addUpstreamTransformer(new SimpleUpstreamTransformer<>(transformer)); }</code><technical_language>avoid signatures IgniteFunction<Stream<UpstreamEntry<K, V>>, Stream<UpstreamEntry<K, V>>>, right</technical_language>

Target:
public UpstreamTransformerChain<K, V> addUpstreamTransformer(IgniteFunction<Stream<UpstreamEntry<K, V>>, Stream<UpstreamEntry<K, V>>> transformer) { return addUpstreamTransformer((rnd, upstream) -> transformer.apply(upstream)); }
Source:
<code>public RetrieveDocumentSetResponseType sendToAdapter(InboundDocRetrieveOrchestratable message) { RetrieveDocumentSetResponseType adapterResponse = proxy.retrieveDocumentSet(message.getRequest(), message.getAssertion()); try { DocRetrieveFileUtils.getInstance().convertFileLocationToDataIfEnabled(adapterResponse); } catch (Exception e) { <START> LOG.error("Failed to retrieve data from the file uri in the payload.", e); <END> adapterResponse = MessageGenerator.getInstance().createRegistryResponseError( "Adapter Document Retrieve Processing"); } return adapterResponse; }</code><technical_language>I this wrote, long in this class topic, fix this exception is logged</technical_language>

Target:
public RetrieveDocumentSetResponseType sendToAdapter(InboundDocRetrieveOrchestratable message) { RetrieveDocumentSetResponseType adapterResponse = proxy.retrieveDocumentSet(message.getRequest(), message.getAssertion()); try { DocRetrieveFileUtils.getInstance().convertFileLocationToDataIfEnabled(adapterResponse); } catch (Exception e) { LOG.error("Failed to retrieve data from the file uri in the payload." + e.getLocalizedMessage(), e); adapterResponse = MessageGenerator.getInstance().createRegistryResponseError( "Adapter Document Retrieve Processing"); } return adapterResponse; }
Source:
<code>public SuggestedQuantity getSuggestedQuantity(Pool p, Consumer c, Date date) { JsonJsContext args = new JsonJsContext(mapper); Stream<EntitlementDTO> entStream = c.getEntitlements() == null ? Stream.empty() : c.getEntitlements().stream() .filter(ent -> ent.isValidOnDate(date)) .map(this.translator.getStreamMapper(Entitlement.class, EntitlementDTO.class)); Stream<GuestIdDTO> guestIdStream = c.getGuestIds() == null ? Stream.empty() : c.getGuestIds().stream() .map(this.translator.getStreamMapper(GuestId.class, GuestIdDTO.class)); args.put("consumer", this.translator.translate(c, ConsumerDTO.class)); args.put("pool", this.translator.translate(p, PoolDTO.class)); args.put("validEntitlements", entStream.collect(Collectors.toSet())); args.put("log", log, false); <START> args.put("guestIds", guestIdStream.collect(Collectors.toList())); <END> String json = jsRules.runJsFunction(String.class, "get_suggested_quantity", args); SuggestedQuantity dto = mapper.toObject(json, SuggestedQuantity.class); return dto; }</code><technical_language>Stream</technical_language>

Target:
public SuggestedQuantity getSuggestedQuantity(Pool p, Consumer c, Date date) { JsonJsContext args = new JsonJsContext(mapper); Stream<EntitlementDTO> entStream = c.getEntitlements() == null ? Stream.empty() : c.getEntitlements().stream() .filter(ent -> ent.isValidOnDate(date)) .map(this.translator.getStreamMapper(Entitlement.class, EntitlementDTO.class)); Stream<GuestIdDTO> guestIdStream = c.getGuestIds() == null ? Stream.empty() : c.getGuestIds().stream() .map(this.translator.getStreamMapper(GuestId.class, GuestIdDTO.class)); args.put("consumer", this.translator.translate(c, ConsumerDTO.class)); args.put("pool", this.translator.translate(p, PoolDTO.class)); args.put("validEntitlements", entStream); args.put("log", log, false); args.put("guestIds", guestIdStream); String json = jsRules.runJsFunction(String.class, "get_suggested_quantity", args); SuggestedQuantity dto = mapper.toObject(json, SuggestedQuantity.class); return dto; }
Source:
<code>void showWorkingDirectoryFileDiff(final FileDiff d) { final String p = d.getPath(); final RevCommit commit = d.getCommit(); final ObjectId[] blobs = d.getBlobs(); IFile file = ResourceUtil.getFileForLocation(getRepository(), p); try { if (file != null && commit != null) { if (!CompareUtils.canDirectlyOpenInCompare(file)) { GitModelSynchronize.synchronizeModelWithWorkspace(file, getRepository(), commit.getName()); } else { CompareUtils.compareWorkspaceWithRef(getRepository(), file, commit.getName(), null); } <START> } else { <END> ITypedElement base = new LocalNonWorkspaceTypedElement( new Path(getRepository().getWorkTree() .getAbsolutePath()).append(p)); final ITypedElement right; if (d.getChange().equals(ChangeType.DELETE)) right = new GitCompareFileRevisionEditorInput.EmptyTypedElement( ""); else right = CompareUtils.getFileRevisionTypedElement(p, commit, getRepository(), blobs[blobs.length - 1]); final ITypedElement commonAncestor; if (commit != null) { final ObjectId headCommitId = getRepository().resolve( Constants.HEAD); commonAncestor = CompareUtils .getFileRevisionTypedElementForCommonAncestor(p, headCommitId, commit, getRepository()); } else { commonAncestor = null; } GitCompareFileRevisionEditorInput in = new GitCompareFileRevisionEditorInput( base, right, commonAncestor, null); CompareUtils.openInCompare(site.getWorkbenchWindow() .getActivePage(), in); } } catch (IOException e) { Activator.logError(UIText.GitHistoryPage_openFailed, e); Activator.showError(UIText.GitHistoryPage_openFailed, null); } }</code><technical_language>I if work CompareUtils.compareWorkspaceWithRef(getRepository(), file, commit.getName(), null); file instance of java.io.file</technical_language>

Target:
void showWorkingDirectoryFileDiff(final FileDiff d) { final String p = d.getPath(); final RevCommit commit = d.getCommit(); if (commit == null) { Activator.showError(UIText.GitHistoryPage_openFailed, null); return; } IWorkbenchPage activePage = site.getWorkbenchWindow().getActivePage(); IFile file = ResourceUtil.getFileForLocation(getRepository(), p); try { if (file != null) { if (!CompareUtils.canDirectlyOpenInCompare(file)) { GitModelSynchronize.synchronizeModelWithWorkspace(file, getRepository(), commit.getName()); } else { CompareUtils.compareWorkspaceWithRef(getRepository(), file, commit.getName(), null); } } else { IPath path = new Path(getRepository().getWorkTree() .getAbsolutePath()).append(p); File ioFile = path.toFile(); if (ioFile.exists()) { CompareUtils.compareLocalWithRef(getRepository(), ioFile, commit.getName(), activePage); } } } catch (IOException e) { Activator.logError(UIText.GitHistoryPage_openFailed, e); Activator.showError(UIText.GitHistoryPage_openFailed, null); } }
Source:
<code>public void testTrimLongSuffix() throws Exception { <START> String longValue = "12345"; <END> assertThat(LiteralUtils.trimLongSuffix(longValue)).isEqualTo(longValue); assertThat(LiteralUtils.trimLongSuffix(longValue + "l")).isEqualTo(longValue); assertThat(LiteralUtils.trimLongSuffix(longValue + "L")).isEqualTo(longValue); }</code><technical_language>If I give empty string input of method</technical_language>

Target:
public void testTrimLongSuffix() throws Exception { assertThat(LiteralUtils.trimLongSuffix(null)).isEqualTo(null); assertThat(LiteralUtils.trimLongSuffix("")).isEqualTo(""); String longValue = "12345"; assertThat(LiteralUtils.trimLongSuffix(longValue)).isEqualTo(longValue); assertThat(LiteralUtils.trimLongSuffix(longValue + "l")).isEqualTo(longValue); assertThat(LiteralUtils.trimLongSuffix(longValue + "L")).isEqualTo(longValue); }
Source:
<code>private void processClazz(Analyzer analyzer, Clazz c, Map<Annotation, Clazz> consumerTypes, Map<Annotation, Clazz> providerTypes) { c.annotations(SERVICE_CONSUMERS) .flatMap(a -> Arrays.stream((Object[]) a.get("value"))) .map(Annotation.class::cast) .forEach(a -> consumerTypes.put(a, c)); c.annotations(SERVICE_CONSUMER) .forEach(a -> consumerTypes.put(a, c)); <START> c.methods() <END> .flatMap(m -> m.annotations(SERVICE_CONSUMERS)) .flatMap(a -> Arrays.stream((Object[]) a.get("value"))) .map(Annotation.class::cast) .forEach(a -> consumerTypes.put(a, c)); c.methods() .flatMap(m -> m.annotations(SERVICE_CONSUMER)) .forEach(a -> consumerTypes.put(a, c)); c.annotations(SERVICE_PROVIDERS) .flatMap(a -> Arrays.stream((Object[]) a.get("value"))) .map(Annotation.class::cast) .forEach(a -> providerTypes.put(a, c)); c.annotations(SERVICE_PROVIDER) .forEach(a -> providerTypes.put(a, c)); }</code><technical_language>delete calls Clazz.methods() longer allow annotation methods</technical_language>

Target:
private void processClazz(Analyzer analyzer, Clazz c, Map<Annotation, Clazz> consumerTypes, Map<Annotation, Clazz> providerTypes) { c.annotations(SERVICE_CONSUMERS) .flatMap(a -> Arrays.stream((Object[]) a.get("value"))) .map(Annotation.class::cast) .forEach(a -> consumerTypes.put(a, c)); c.annotations(SERVICE_CONSUMER) .forEach(a -> consumerTypes.put(a, c)); c.annotations(SERVICE_PROVIDERS) .flatMap(a -> Arrays.stream((Object[]) a.get("value"))) .map(Annotation.class::cast) .forEach(a -> providerTypes.put(a, c)); c.annotations(SERVICE_PROVIDER) .forEach(a -> providerTypes.put(a, c)); }
Source:
<code><START> public synchronized String nextToken() { <END> if (pos >= path.length) { return null; } StringBuilder tokenBuilder = new StringBuilder(path.length - pos); boolean inSingleQuote = false; boolean escaped = false; while (pos < path.length) { final char c = path[pos]; pos++; if (escaped) { tokenBuilder.append(c); escaped = false; } else { if (c == '\\') { escaped = true; } else if (c == '\'') { inSingleQuote = !inSingleQuote; } else if (c == '.' && !inSingleQuote) { break; } else { tokenBuilder.append(c); } } } final String token = tokenBuilder.toString(); if (token.length() > 0) { return token; } else { return null; } }</code><technical_language>needs synchronization? If not, tokenBuilder object created once. iteration needs reset calling setLength(0)</technical_language>

Target:
public synchronized String nextToken() { if (pos >= path.length) { return null; } tokenBuilder.setLength(0); boolean inSingleQuote = false; boolean escaped = false; while (pos < path.length) { final char c = path[pos]; pos++; if (escaped) { tokenBuilder.append(c); escaped = false; } else { if (c == '\\') { escaped = true; } else if (c == '\'') { inSingleQuote = !inSingleQuote; } else if (c == '.' && !inSingleQuote) { break; } else { tokenBuilder.append(c); } } } if (tokenBuilder.length() > 0) { return tokenBuilder.toString(); } else { return null; } }
Source:
<code>public BinaryData getBody() { final AmqpBodyType type = amqpAnnotatedMessage.getBody().getBodyType(); switch (type) { case DATA: <START> return BinaryData.fromBytes(((AmqpDataBody) amqpAnnotatedMessage.getBody()) <END> .getData().stream().findFirst().get()); case SEQUENCE: case VALUE: throw logger.logExceptionAsError(new UnsupportedOperationException("Not supported AmqpBodyType: " + type.toString())); default: throw logger.logExceptionAsError(new IllegalArgumentException("Unknown AmqpBodyType: " + type.toString())); } }</code><technical_language>This returns optional. check if in findFirst()</technical_language>

Target:
public BinaryData getBody() { final AmqpBodyType type = amqpAnnotatedMessage.getBody().getBodyType(); switch (type) { case DATA: Optional<byte[]> byteArrayData = ((AmqpDataBody) amqpAnnotatedMessage.getBody()).getData().stream() .findFirst(); final byte[] bytes; if (byteArrayData.isPresent()) { bytes = byteArrayData.get(); } else { logger.warning("Data not present."); bytes = new byte[0]; } return BinaryData.fromBytes(bytes); case SEQUENCE: case VALUE: throw logger.logExceptionAsError(new UnsupportedOperationException("Not supported AmqpBodyType: " + type.toString())); default: throw logger.logExceptionAsError(new IllegalArgumentException("Unknown AmqpBodyType: " + type.toString())); } }
Source:
<code>public Map<String, Object> destroy(@RequestParam String token) { if (StringUtils.isNotEmpty(token) && StringUtils.equals(token, getConfiguredToken())) { String siteName = SiteContext.getCurrent().getSiteName(); contextManager.destroyContext(siteName); return createResponseMessage("Site context for '" + siteName + "' destroyed. Will be recreated on next " + "request"); } else { <START> throw new InvalidMonitoringTokenException("Monitoring authorization failed, invalid token."); <END> } }</code><technical_language>ManagementToken Monitoring..</technical_language>

Target:
public Map<String, Object> destroy(@RequestParam String token) throws InvalidManagementTokenException { if (StringUtils.isNotEmpty(token) && StringUtils.equals(token, getConfiguredToken())) { String siteName = SiteContext.getCurrent().getSiteName(); contextManager.destroyContext(siteName); return createResponseMessage("Site context for '" + siteName + "' destroyed. Will be recreated on next " + "request"); } else { throw new InvalidManagementTokenException("Monitoring authorization failed, invalid token."); } }