auphong2707/dl4se-code-review-dataset huggingface dataset:
Source:
<code>protected C retrieveCredentials(final WebContext context) throws HttpAction { CommonHelper.assertNotNull("credentialsExtractor", this.credentialsExtractor); CommonHelper.assertNotNull("authenticator", this.authenticator); try { final C credentials = this.credentialsExtractor.extract(context); if (credentials == null) { return null; } this.authenticator.validate(credentials, context); return credentials; } catch (CredentialsException e) { <START> if (logger.isDebugEnabled()) { <END> logger.info("Failed to retrieve or validate credentials", e); } else { logger.info("Failed to retrieve or validate credentials: {}", e.getMessage()); } return null; } catch (TechnicalException e) { logger.error("Error during credentials validation", e); return null; } }</code><technical_language>If debug id enabled, logging info?! is this check necessary</technical_language>

Target:
protected C retrieveCredentials(final WebContext context) throws HttpAction { CommonHelper.assertNotNull("credentialsExtractor", this.credentialsExtractor); CommonHelper.assertNotNull("authenticator", this.authenticator); try { final C credentials = this.credentialsExtractor.extract(context); if (credentials == null) { return null; } this.authenticator.validate(credentials, context); return credentials; } catch (CredentialsException e) { logger.info("Failed to retrieve or validate credentials: {}", e.getMessage()); logger.debug("Failed to retrieve or validate credentials", e); return null; } }
Source:
<code>public void setUp() throws Exception { <START> System.setProperty(IBinaryCapability.OPENSHIFT_BINARY_LOCATION, helper.getOpenShiftLocation()); <END> IClient client = helper.createClientForBasicAuth(); List<IResource> pods = client.list(ResourceKind.POD, "default"); pod = (IPod) pods.stream().filter(p->p.getName().startsWith("docker-registry")).findFirst().orElse(null); assertNotNull("Need a pod to continue the test. Expected to find the registry", pod); }</code><technical_language>shouldnt need this impl depend oc</technical_language>

Target:
public void setUp() throws Exception { IClient client = helper.createClientForBasicAuth(); List<IResource> pods = client.list(ResourceKind.POD, "default"); pod = (IPod) pods.stream().filter(p->p.getName().startsWith("docker-registry")).findFirst().orElse(null); assertNotNull("Need a pod to continue the test. Expected to find the registry", pod); }
Source:
<code>public FeedbackSessionAttributes unpublishFeedbackSession(String feedbackSessionName, String courseId) throws EntityDoesNotExistException, InvalidParametersException { FeedbackSessionAttributes sessionToUnpublish = getFeedbackSession(feedbackSessionName, courseId); <START> if (sessionToUnpublish == null) { <END> throw new EntityDoesNotExistException(ERROR_NON_EXISTENT_FS_UPDATE + sessionToUnpublish.getCourseId() + "/" + sessionToUnpublish.getFeedbackSessionName()); } if (!sessionToUnpublish.isPublished()) { throw new InvalidParametersException(ERROR_FS_ALREADY_UNPUBLISH); } return updateFeedbackSession( FeedbackSessionAttributes .updateOptionsBuilder(sessionToUnpublish.getFeedbackSessionName(), sessionToUnpublish.getCourseId()) .withResultsVisibleFromTime(Const.TIME_REPRESENTS_LATER) .build()); }</code><technical_language>Actually, I find is test case for non-existent session</technical_language>

Target:
public FeedbackSessionAttributes unpublishFeedbackSession(String feedbackSessionName, String courseId) throws EntityDoesNotExistException, InvalidParametersException { FeedbackSessionAttributes sessionToUnpublish = getFeedbackSession(feedbackSessionName, courseId); if (sessionToUnpublish == null) { throw new EntityDoesNotExistException(ERROR_NON_EXISTENT_FS_UPDATE + courseId + "/" + feedbackSessionName); } if (!sessionToUnpublish.isPublished()) { throw new InvalidParametersException(ERROR_FS_ALREADY_UNPUBLISH); } return updateFeedbackSession( FeedbackSessionAttributes .updateOptionsBuilder(sessionToUnpublish.getFeedbackSessionName(), sessionToUnpublish.getCourseId()) .withResultsVisibleFromTime(Const.TIME_REPRESENTS_LATER) .build()); }
Source:
<code><START> public static String readUTF(InputStream stream, long offset) throws IOException { <END> StringBuilder result = new StringBuilder(); skipFully(stream, offset); InputStreamReader reader = null; try { reader = new InputStreamReader(stream, "UTF-8"); char[] buf = new char[4096]; int length = 0; while((length = reader.read(buf)) > 0) { result.append(buf, 0, length); } } finally { Closer.close(reader); } return result.toString(); }</code><technical_language>IMHO want return StringBuilder there... Odds raw string</technical_language>

Target:
public static StringBuilder readUTF(InputStream stream, long offset) throws IOException { StringBuilder result = new StringBuilder(); skipFully(stream, offset); InputStreamReader reader = null; try { reader = new InputStreamReader(stream, "UTF-8"); char[] buf = new char[4096]; int length = 0; while((length = reader.read(buf)) > 0) { result.append(buf, 0, length); } } finally { Closer.close(reader); } return result; }
Source:
<code>protected boolean validate() { ValidationResult vr = ValidationResult.VALID; vr = <START> validationFailed(vr) <END> ? vr : validateHostId(getParameters().getSourceHostId()); vr = validationFailed(vr) ? vr : validateHostId(getParameters().getVdsId()); vr = validationFailed(vr) ? vr : validateHost(getLazySourceHost()); vr = validationFailed(vr) ? vr : validateHost(getLazyDestinationHost()); vr = validationFailed(vr) ? vr : validateClusterId(); vr = validationFailed(vr) ? vr : validateInterfaceCount(); return validate(vr); }</code><technical_language>this nice, is a reason common validateHostId(getParameters().getSourceHostId()) && validateHostId(getParameters().getVdsId()) && ... pattern</technical_language>

Target:
protected boolean validate() { return validateHostId(getSourceHostId()) && validateHostId(getDestinationHostId()) && validateHost(getLazySourceHost()) && validateHost(getLazyDestinationHost()) && validateClusterId() && validateInterfaceCount(); }
Source:
<code><START> @Override public long totalRowCount(IndexingQueryCacheFilter partsFilter) { <END> return 0; }</code><technical_language>confuse me. is happen request for select started affinity node? zero affect query plan</technical_language>

Target:
@Override public long totalRowCount(IndexingQueryCacheFilter partsFilter) { throw unsupported(); }
Source:
<code>protected InputStream inputStream() throws IOException { if (this.pushbackStream == null || super.inputStream() != this.original) { <START> this.pushbackStream = new PushbackInputStream(super.inputStream(), this.pushbackBufferSize); <END> } return this.pushbackStream; }</code><technical_language>chance super.inputStream() **is** PushbackInputStream, so, need wrap all</technical_language>

Target:
protected InputStream inputStream() throws IOException { InputStream wrapped = super.inputStream(); if (this.pushbackStream == null || wrapped != this.wrapped) { this.pushbackStream = new PushbackInputStream(wrapped, this.pushbackBufferSize); this.wrapped = wrapped; } return this.pushbackStream; }
Source:
<code>public final void drawMap() { readMap(); for (int row = 0; row < NUM_ROWS; row++) { for (int col = 0; col < NUM_COLS; col++) { if (map[row][col] == 1) { walls.add(new Wall(col * SPRITE_SIZE, row * SPRITE_SIZE, 0, 0, 0, 0)); } else if (map[row][col] == 2) { monsters.add(new Walker(col * SPRITE_SIZE - 32, row * SPRITE_SIZE - 32, 0, 0, 0, 0, Settings.MONSTER_SPEED, true, levelController)); } else if (map[row][col] == 3) { monsters.add(new Walker(col * SPRITE_SIZE - 32, row * SPRITE_SIZE - 32, 0, 0, 0, 0, Settings.MONSTER_SPEED, false, levelController)); } else if (map[row][col] == 9) { <START> System.out.format("Player found in %d, %d", row, col); <END> players.add(new Player(col * SPRITE_SIZE - 32, row * SPRITE_SIZE - 32, 0, 0, 0, 0, Settings.PLAYER_SPEED, null, levelController)); } } } }</code><technical_language>A newline added this formatted print</technical_language>

Target:
public final void drawMap() { readMap(); for (int row = 0; row < NUM_ROWS; row++) { for (int col = 0; col < NUM_COLS; col++) { if (map[row][col] == 1) { walls.add(new Wall(col * SPRITE_SIZE, row * SPRITE_SIZE, 0, 0, 0, 0)); } else if (map[row][col] == 2) { monsters.add(new Walker(col * SPRITE_SIZE - 32, row * SPRITE_SIZE - 32, 0, 0, 0, 0, Settings.MONSTER_SPEED, true, levelController)); } else if (map[row][col] == 3) { monsters.add(new Walker(col * SPRITE_SIZE - 32, row * SPRITE_SIZE - 32, 0, 0, 0, 0, Settings.MONSTER_SPEED, false, levelController)); } else if (map[row][col] == 9) { System.out.format("Player found in %d, %d\n", row, col); players.add(new Player(col * SPRITE_SIZE - 32, row * SPRITE_SIZE - 32, 0, 0, 0, 0, Settings.PLAYER_SPEED, null, levelController)); } } } }
Source:
<code>private boolean compareAlignments() { if (!compareValues(reader1.getFileHeader().getSortOrder(), reader2.getFileHeader().getSortOrder(), "Sort Order")) { System.out.println("Cannot compare alignments if sort orders differ."); return false; } switch (reader1.getFileHeader().getSortOrder()) { case coordinate: if (sequenceDictionariesDiffer) { System.out.println("Cannot compare coordinate-sorted SAM files because sequence dictionaries differ."); return false; } return compareCoordinateSortedAlignments(); case queryname: return compareQueryNameSortedAlignments(); case duplicate: case unsorted: return compareUnsortedAlignments(); default: <START> return false; <END> } }</code><technical_language>throw assert() if "unreachable"</technical_language>

Target:
private boolean compareAlignments() { if (!compareValues(reader1.getFileHeader().getSortOrder(), reader2.getFileHeader().getSortOrder(), "Sort Order")) { System.out.println("Cannot compare alignments if sort orders differ."); return false; } switch (reader1.getFileHeader().getSortOrder()) { case coordinate: if (sequenceDictionariesDiffer) { System.out.println("Cannot compare coordinate-sorted SAM files because sequence dictionaries differ."); return false; } return compareCoordinateSortedAlignments(); case queryname: return compareQueryNameSortedAlignments(); case duplicate: case unsorted: return compareUnsortedAlignments(); default: throw new PicardException(String.format("Unrecognized sort order (%s) found.", reader1.getFileHeader().getSortOrder())); } }
Source:
<code>private Flux<Instant> renewMessageLock(ServiceBusReceivedMessage[] messagesforRenewLock) { return cbsAuthorizationOnce() .then( channelMono.flatMap(requestResponseChannel -> { <START> UUID[] lockTokens = new UUID[messagesforRenewLock.length]; int index = 0; for (ServiceBusReceivedMessage receivedMessage : messagesforRenewLock ) { lockTokens[index++] = receivedMessage.getLockToken(); } <END> HashMap<String, UUID[]> requestBodyMap = new HashMap<>(); requestBodyMap.put(REQUEST_RESPONSE_LOCKTOKENS, lockTokens); Message requestMessage = createRequestMessageFromValueBody(REQUEST_RESPONSE_RENEWLOCK_OPERATION, requestBodyMap, MessageUtils.adjustServerTimeout(Duration.ofSeconds(60))); return requestResponseChannel.sendWithAck(requestMessage); }) ) .flatMapMany(responseMessage -> { int statusCode = RequestResponseUtils.getResponseStatusCode(responseMessage); List<Instant> expirationsForLocks = null; if (statusCode == REQUEST_RESPONSE_OK_STATUS_CODE) { @SuppressWarnings("unchecked") Map<String, Object> responseBody = (Map<String, Object>) ((AmqpValue) responseMessage .getBody()).getValue(); Object expirationListObj = responseBody.get(REQUEST_RESPONSE_EXPIRATIONS); if (expirationListObj instanceof Date[]){ Date[] expirations = (Date[]) expirationListObj; expirationsForLocks = Arrays.stream(expirations) .map(Date::toInstant) .collect(Collectors.toList()); } } return Flux.fromIterable(expirationsForLocks); }); }</code><technical_language>java UUID[] lockTokens = Arrays.stream(messagesForRenewLock) .map(ServiceBusReceivedMessage::getLockToken) .toArray(UUID[]::new);</technical_language>

Target:
private Flux<Instant> renewMessageLock(ServiceBusReceivedMessage[] messagesforRenewLock) { return isAuthorized(PEEK_OPERATION_VALUE).thenMany(createRequestResponse.flatMap(requestResponseChannel -> { UUID[] lockTokens = Arrays.stream(messagesforRenewLock) .map(ServiceBusReceivedMessage::getLockToken) .toArray(UUID[]::new); Message requestMessage = createRequestMessageFromValueBody(REQUEST_RESPONSE_RENEWLOCK_OPERATION, Collections.singletonMap(REQUEST_RESPONSE_LOCKTOKENS, lockTokens), MessageUtils.adjustServerTimeout(Duration.ofSeconds(60))); return requestResponseChannel.sendWithAck(requestMessage); }).flatMapMany(responseMessage -> { int statusCode = RequestResponseUtils.getResponseStatusCode(responseMessage); List<Instant> expirationsForLocks = new ArrayList<>(); if (statusCode == REQUEST_RESPONSE_OK_STATUS_CODE) { @SuppressWarnings("unchecked") Map<String, Object> responseBody = (Map<String, Object>) ((AmqpValue) responseMessage .getBody()).getValue(); Object expirationListObj = responseBody.get(REQUEST_RESPONSE_EXPIRATIONS); if (expirationListObj instanceof Date[]) { Date[] expirations = (Date[]) expirationListObj; expirationsForLocks = Arrays.stream(expirations) .map(Date::toInstant) .collect(Collectors.toList()); } } return Flux.fromIterable(expirationsForLocks); })); }
Source:
<code>public HaxeClass getUnderlyingClass() { HaxeUnderlyingType underlyingTypePsi = getAbstractClass().getUnderlyingType(); if (underlyingTypePsi == null) return null; final HaxeType underlyingType = underlyingTypePsi.getTypeOrAnonymousList().get(0).getType(); if (underlyingType != null) { final HaxeClassResolveResult result = underlyingType.getReferenceExpression().resolveHaxeClass(); <START> if (result != HaxeClassResolveResult.EMPTY) { <END> return result.getHaxeClass(); } } return null; }</code><technical_language>need check for EMPTY. useful in this situation. EMPTY.getHaxeClass() is a valid call returns null</technical_language>

Target:
public HaxeClass getUnderlyingClass() { HaxeUnderlyingType underlyingTypePsi = getAbstractClass().getUnderlyingType(); if (underlyingTypePsi == null) return null; final HaxeType underlyingType = underlyingTypePsi.getTypeOrAnonymousList().get(0).getType(); if (underlyingType != null) { final HaxeClassResolveResult result = underlyingType.getReferenceExpression().resolveHaxeClass(); return result.getHaxeClass(); } return null; }
Source:
<code>public void testDeleteEPerson() throws SQLException, AuthorizeException { EPerson deleteEperson = ePersonService.findByEmail(context, EMAIL); context.turnOffAuthorisationSystem(); try { ePersonService.delete(context, deleteEperson); } catch (AuthorizeException | IOException ex) { log.error("Cannot delete EPersion, caught " + ex.getClass().getName() + ":", ex); fail("Caught an Exception while deleting an EPerson. " + ex.getClass().getName() + ": " + ex.getMessage()); } context.restoreAuthSystemState(); context.commit(); <START> EPerson fundDeletedEperson = ePersonService.findByEmail(context, EMAIL); <END> assertNull("EPerson has not been deleted correctly!", fundDeletedEperson); }</code><technical_language>is meaning of "fund" in this variable name</technical_language>

Target:
public void testDeleteEPerson() throws SQLException, AuthorizeException { EPerson deleteEperson = ePersonService.findByEmail(context, EMAIL); context.turnOffAuthorisationSystem(); try { ePersonService.delete(context, deleteEperson); } catch (AuthorizeException | IOException ex) { log.error("Cannot delete EPersion, caught " + ex.getClass().getName() + ":", ex); fail("Caught an Exception while deleting an EPerson. " + ex.getClass().getName() + ": " + ex.getMessage()); } context.restoreAuthSystemState(); context.commit(); EPerson findDeletedEperson = ePersonService.findByEmail(context, EMAIL); assertNull("EPerson has not been deleted correctly!", findDeletedEperson); }
Source:
<code>public void end(Context ctx) throws Exception { if (objectsToUpdate != null && handlesToDelete != null) { for (UUID id : objectsToUpdate) { <START> Item iu = itemService.find(ctx, id); <END> String hdl = iu.getHandle(); if (hdl != null && !handlesToDelete.contains(hdl)) { try { indexer.indexContent(ctx, iu, true); log.debug("Indexed " + Constants.typeText[iu.getType()] + ", id=" + String.valueOf(iu.getID()) + ", handle=" + hdl); } catch (Exception e) { log.error("Failed while indexing object: ", e); } } } for (String hdl : handlesToDelete) { try { indexer.unIndexContent(ctx, hdl, true); if (log.isDebugEnabled()) { log.debug("UN-Indexed Item, handle=" + hdl); } } catch (Exception e) { log.error("Failed while UN-indexing object: " + hdl, e); } } } objectsToUpdate = null; handlesToDelete = null; }</code><technical_language>assume UUIDs represent Item objects. If original code, DSpaceObject is indexed. This is Communities Collections *also* indexed in Discovery (so search names/descriptions)</technical_language>

Target:
public void end(Context ctx) throws Exception { if (objectsToUpdate != null && handlesToDelete != null) { for (DSpaceObject o : objectsToUpdate) { DSpaceObject iu = ctx.reloadEntity(o); String hdl = iu.getHandle(); if (hdl != null && !handlesToDelete.contains(hdl)) { try { indexer.indexContent(ctx, iu, true); log.debug("Indexed " + Constants.typeText[iu.getType()] + ", id=" + String.valueOf(iu.getID()) + ", handle=" + hdl); } catch (Exception e) { log.error("Failed while indexing object: ", e); } } } for (String hdl : handlesToDelete) { try { indexer.unIndexContent(ctx, hdl, true); if (log.isDebugEnabled()) { log.debug("UN-Indexed Item, handle=" + hdl); } } catch (Exception e) { log.error("Failed while UN-indexing object: " + hdl, e); } } } objectsToUpdate = null; handlesToDelete = null; }
Source:
<code>public void updated(Dictionary<String, ?> config) throws ConfigurationException { <START> logger.debug("updated()"); <END> if (config != null) { Enumeration<String> keys = config.keys(); while (keys.hasMoreElements()) { String key = (String) keys.nextElement(); String value = (String) config.get(key); logger.debug(String.format("Got configuration %s of value %s", key, value)); if (key.equals("baseUrl")) { mMyOHBaseUrl = value; } else if (key.equals("localPort")) { mLocalPort = Integer.valueOf(value); } } } else { logger.debug("config is null"); } logger.debug("UUID = " + getUUID() + ", secret = " + getSecret()); myOHClient = new MyOHClient(getUUID(), getSecret()); if (mMyOHBaseUrl != null) myOHClient.setMyOHBaseUrl(mMyOHBaseUrl); if (mLocalPort != 8080) myOHClient.setOHBaseUrl("http://localhost:" + String.valueOf(mLocalPort)); myOHClient.setOpenHABVersion(getVersion()); myOHClient.connect(); myOHClient.setListener(this); MyOpenHAB.mMyOpenHABService = this; }</code><technical_language>remove</technical_language>

Target:
public void updated(Dictionary<String, ?> config) throws ConfigurationException { if (config != null) { String baseUrlString = (String) config.get("baseUrl"); if (StringUtils.isNotBlank(baseUrlString)) { mMyOHBaseUrl = baseUrlString; } String localPortString = (String) config.get("localPort"); if (StringUtils.isNotBlank(localPortString)) { mLocalPort = Integer.valueOf(localPortString); } } else { logger.debug("config is null"); } logger.debug("UUID = " + getUUID() + ", secret = " + getSecret()); myOHClient = new MyOHClient(getUUID(), getSecret()); if (mMyOHBaseUrl != null) { myOHClient.setMyOHBaseUrl(mMyOHBaseUrl); } if (mLocalPort != 8080) { myOHClient.setOHBaseUrl("http://localhost:" + String.valueOf(mLocalPort)); } myOHClient.setOpenHABVersion(getVersion()); myOHClient.connect(); myOHClient.setListener(this); MyOpenHAB.mMyOpenHABService = this; }
Source:
<code>public void scan() { try { final HttpMessage originalMsg = getBaseMsg(); String currentHeader = originalMsg.getRequestHeader().getHeader("SOAPAction"); if (currentHeader != null && originalMsg.getRequestBody().length() > 0) { currentHeader = currentHeader.trim(); String[] soapActions = ImportWSDL.getInstance().getSourceSoapActions(originalMsg); boolean endScan = false; if (soapActions == null || soapActions.length == 0 ) { if (log.isDebugEnabled()) { log.debug("Skipping " + getName() + " because no actions were found."); } <START> getParent().pluginSkipped(getId(), Constant.messages.getString("soap.soapactionspoofing.skip.reason")); <END> return; } for (int j = 0; j < soapActions.length && !endScan; j++) { HttpMessage msg = getNewMsg(); if (!currentHeader.equals(soapActions[j])) { HttpRequestHeader header = msg.getRequestHeader(); header.setHeader("SOAPAction", soapActions[j]); msg.setRequestHeader(header); if (this.isStop()) return; sendAndReceive(msg); if (this.isStop()) return; int code = scanResponse(msg, originalMsg); if (code > 0) endScan = true; raiseAlert(msg, code); } else { if (log.isDebugEnabled()) { log.debug("Ignoring matching actions: " + currentHeader + " : " + soapActions[j]); } } if (this.isStop()) return; } } } catch (Exception e) { log.error(e.getMessage(), e); } }</code><technical_language>return? miss actions in other messages if skipped</technical_language>

Target:
public void scan() { try { final HttpMessage originalMsg = getBaseMsg(); String currentHeader = originalMsg.getRequestHeader().getHeader("SOAPAction"); if (currentHeader != null && originalMsg.getRequestBody().length() > 0) { currentHeader = currentHeader.trim(); String[] soapActions = ImportWSDL.getInstance().getSourceSoapActions(originalMsg); boolean endScan = false; if (soapActions == null || soapActions.length == 0 ) { log.info("Skipping " + getName() + " because no actions were found. (URL: " + originalMsg.getRequestHeader().getURI().toString() + ")"); return; } for (int j = 0; j < soapActions.length && !endScan; j++) { HttpMessage msg = getNewMsg(); if (!currentHeader.equals(soapActions[j])) { HttpRequestHeader header = msg.getRequestHeader(); header.setHeader("SOAPAction", soapActions[j]); msg.setRequestHeader(header); if (this.isStop()) return; sendAndReceive(msg); if (this.isStop()) return; int code = scanResponse(msg, originalMsg); if (code > 0) endScan = true; raiseAlert(msg, code); } else { if (log.isDebugEnabled()) { log.debug("Ignoring matching actions: " + currentHeader + " : " + soapActions[j]); } } if (this.isStop()) return; } } } catch (Exception e) { log.error(e.getMessage(), e); } }
Source:
<code>protected RuleBuilder(Rule rule) { <START> this.triggers = rule.getTriggers(); <END> this.conditions = rule.getConditions(); this.actions = rule.getActions(); this.configuration = rule.getConfiguration(); this.configDescriptions = rule.getConfigurationDescriptions(); this.templateUID = rule.getTemplateUID(); this.uid = rule.getUID(); this.name = rule.getName(); this.tags = rule.getTags(); this.visibility = rule.getVisibility(); this.description = rule.getDescription(); }</code><technical_language>this construct a bit strange: I expect a Rule expose triggers, conditions, actions, immutable objects. builders lists set internal lists of a RuleImpl. is a RuleBuilder initialized a RuleImpl all? I expect builder holt building properties internally Rule creation set properties accordingly</technical_language>

Target:
protected RuleBuilder(Rule rule) { this.triggers = new LinkedList<>(rule.getTriggers()); this.conditions = new LinkedList<>(rule.getConditions()); this.actions = new LinkedList<>(rule.getActions()); this.configuration = rule.getConfiguration(); this.configDescriptions = new LinkedList<>(rule.getConfigurationDescriptions()); this.templateUID = rule.getTemplateUID(); this.uid = rule.getUID(); this.name = rule.getName(); this.tags = new HashSet<>(rule.getTags()); this.visibility = rule.getVisibility(); this.description = rule.getDescription(); }
Source:
<code>protected void manageRelatedTextOfTopLevelDocument(CoreSession session, Comment comment) { <START> checkArgument(isNotEmpty(comment.getId()), "Comment id is required"); <END> checkArgument(isNotEmpty(comment.getParentId()), "Comment parent id is required"); DocumentRef topLevelDocRef = getTopLevelCommentAncestor(session, new IdRef(comment.getParentId())); DocumentModel topLevelDoc = session.getDocument(topLevelDocRef); topLevelDoc.addFacet(HAS_RELATED_TEXT); String relatedTextId = String.format( comment instanceof Annotation ? ANNOTATION_RELATED_TEXT_ID : COMMENT_RELATED_TEXT_ID, comment.getId()); @SuppressWarnings("unchecked") List<Map<String, String>> resources = (List<Map<String, String>>) topLevelDoc.getPropertyValue( RELATED_TEXT_RESOURCES); Map<String, String> relatedTextMap = resources.stream() .filter(m -> relatedTextId.contains(m.get(RELATED_TEXT_ID))) .findAny() .orElseGet(() -> new HashMap<>(0)); if (isNotEmpty(comment.getText())) { if (relatedTextMap.isEmpty()) { resources.add(Map.of(RELATED_TEXT_ID, relatedTextId, RELATED_TEXT, comment.getText())); } else { relatedTextMap.put(RELATED_TEXT, comment.getText()); } } else { resources.remove(relatedTextMap); } topLevelDoc.setPropertyValue(RELATED_TEXT_RESOURCES, (Serializable) resources); session.saveDocument(topLevelDoc); }</code><technical_language>requireNonNull()</technical_language>

Target:
protected void manageRelatedTextOfTopLevelDocument(CoreSession session, Comment comment) { requireNonNull(comment.getId(), "Comment id is required"); requireNonNull(comment.getParentId(), "Comment parent id is required"); DocumentRef topLevelDocRef = getTopLevelCommentAncestor(session, new IdRef(comment.getParentId())); DocumentModel topLevelDoc = session.getDocument(topLevelDocRef); topLevelDoc.addFacet(HAS_RELATED_TEXT); String relatedTextId = String.format(COMMENT_RELATED_TEXT_ID, comment.getId()); @SuppressWarnings("unchecked") List<Map<String, String>> resources = (List<Map<String, String>>) topLevelDoc.getPropertyValue( RELATED_TEXT_RESOURCES); Optional<Map<String, String>> optional = resources.stream() .filter(m -> relatedTextId.equals(m.get(RELATED_TEXT_ID))) .findAny(); if (isEmpty(comment.getText())) { optional.ifPresent(resources::remove); } else { optional.ifPresentOrElse( (map) -> map.put(RELATED_TEXT, comment.getText()), () -> resources.add(Map.of(RELATED_TEXT_ID, relatedTextId, RELATED_TEXT, comment.getText()))); } topLevelDoc.setPropertyValue(RELATED_TEXT_RESOURCES, (Serializable) resources); session.saveDocument(topLevelDoc); }
Source:
<code>public boolean onTouchEvent(MotionEvent ev) { <START> if (getAdapter() != null) { <END> return super.onTouchEvent(ev); } else { return true; } }</code><technical_language>getAdapter() mAdapter</technical_language>

Target:
public boolean onTouchEvent(MotionEvent ev) { return mAdapter == null || super.onTouchEvent(ev); }
Source:
<code>public WindowSpec.WindowStartBound buildWindowStartBound(Window_frame_start_boundContext context) { WindowFrameStartBoundType boundType = null; if (checkIfExist(context.UNBOUNDED())) { boundType = WindowFrameStartBoundType.UNBOUNDED_PRECEDING; } else if (checkIfExist(context.PRECEDING())) { boundType = WindowFrameStartBoundType.PRECEDING; } else if (checkIfExist(context.FOLLOWING())) { boundType = WindowFrameStartBoundType.FOLLOWING; } else { <START> boundType = WindowFrameStartBoundType.CURRENT_ROW; <END> } WindowSpec.WindowStartBound bound = new WindowSpec.WindowStartBound(boundType); if (boundType == WindowFrameStartBoundType.PRECEDING || boundType == WindowFrameStartBoundType.FOLLOWING) { bound.setNumber(visitUnsigned_value_specification(context.unsigned_value_specification())); } return bound; }</code><technical_language>In pgsql, default start bound is CURRENT_ROW. Please quote. default framing option is RANGE UNBOUNDED PRECEDING, is RANGE UNBOUNDED PRECEDING CURRENT ROW</technical_language>

Target:
public WindowSpec.WindowBound buildWindowStartBound(Window_frame_start_boundContext context) { WindowFrameBoundType boundType = null; if (checkIfExist(context.UNBOUNDED())) { boundType = WindowFrameBoundType.UNBOUNDED_PRECEDING; } else if (checkIfExist(context.PRECEDING())) { boundType = WindowFrameBoundType.PRECEDING; } else if (checkIfExist(context.FOLLOWING())) { boundType = WindowFrameBoundType.FOLLOWING; } else if (checkIfExist(context.CURRENT())){ boundType = WindowFrameBoundType.CURRENT_ROW; } else { throw new SQLSyntaxError("Window frame - unknown start bound type"); } WindowSpec.WindowBound bound = new WindowSpec.WindowBound(boundType); if (boundType == WindowFrameBoundType.PRECEDING || boundType == WindowFrameBoundType.FOLLOWING) { bound.setNumber(visitUnsigned_value_specification(context.unsigned_value_specification())); } return bound; }
Source:
<code>public Attribute[] getAttributes() { <START> return attributeMap.values().toArray(new Attribute[attributeMap.size()]); <END> }</code><technical_language>return collection ? avoid create array</technical_language>

Target:
public Collection<Attribute> getAttributes() { return attributeMap.values(); }
Source:
<code>public Object execute(OperationRequest request) throws IOException { AsyncRequest req; String content = JsonMarshalling.writeRequest(request); String ctype; Object input = request.getInput(); if (input instanceof OperationInput && ((OperationInput) input).isBinary()) { MultipartInput mpinput = Request.buildMultipartInput(input, content); req = new AsyncRequest(Request.POST, request.getUrl(), mpinput); ctype = mpinput.getContentType(); } else { req = new AsyncRequest(Request.POST, request.getUrl(), content); ctype = CTYPE_REQUEST_NOCHARSET; } for (Map.Entry<String, String> entry : request.getHeaders().entrySet()) { req.put(entry.getKey(), entry.getValue()); } req.put("Accept", REQUEST_ACCEPT_HEADER); <START> req.put("Content-Type", ctype); <END> if (req.get(HEADER_NX_SCHEMAS) == null && session.getDefaultSchemas() != null) { req.put(HEADER_NX_SCHEMAS, session.getDefaultSchemas()); } try { return req.execute().get(); } catch (ExecutionException | InterruptedException e) { if (e.getCause() instanceof RemoteException) { throw (RemoteException) e.getCause(); } throw new IOException(e); } }</code><technical_language>Please constants for header names</technical_language>

Target:
public Object execute(OperationRequest request) throws IOException { AsyncRequest req; String content = JsonMarshalling.writeRequest(request); String ctype; Object input = request.getInput(); if (input instanceof OperationInput && ((OperationInput) input).isBinary()) { MultipartInput mpinput = Request.buildMultipartInput(input, content); req = new AsyncRequest(Request.POST, request.getUrl(), mpinput); ctype = mpinput.getContentType(); } else { req = new AsyncRequest(Request.POST, request.getUrl(), content); ctype = CTYPE_REQUEST_NOCHARSET; } for (Map.Entry<String, String> entry : request.getHeaders().entrySet()) { req.put(entry.getKey(), entry.getValue()); } req.put(HttpHeaders.ACCEPT, REQUEST_ACCEPT_HEADER); req.put(HttpHeaders.CONTENT_TYPE, ctype); if (req.get(HEADER_NX_SCHEMAS) == null && session.getDefaultSchemas() != null) { req.put(HEADER_NX_SCHEMAS, session.getDefaultSchemas()); } try { return req.execute().get(); } catch (ExecutionException e) { if (e.getCause() instanceof RemoteException) { throw (RemoteException) e.getCause(); } throw new IOException(e); } catch (InterruptedException e) { Thread.currentThread().interrupt(); throw new RuntimeException(e); } }
Source:
<code>private static <T> T assertInstanceOf(Class<T> expectedType, Object actualValue, Object messageOrSupplier) { if (!expectedType.isInstance(actualValue)) { <START> String template = actualValue instanceof Throwable ? "Unexpected exception type" : "Unexpected instance type"; <END> if (actualValue == null) template = "Unexpected null value"; String message = buildPrefix(nullSafeGet(messageOrSupplier)) + format(expectedType, actualValue == null ? null : actualValue.getClass(), template); throw new AssertionFailedError(message); } return expectedType.cast(actualValue); }</code><technical_language>Is worth differentiating exception "normal" instances here? "Unexpected type"</technical_language>

Target:
private static <T> T assertInstanceOf(Class<T> expectedType, Object actualValue, Object messageOrSupplier) { if (!expectedType.isInstance(actualValue)) { String template = "Unexpected type"; if (actualValue == null) template = "Unexpected null value"; String message = buildPrefix(nullSafeGet(messageOrSupplier)) + format(expectedType, actualValue == null ? null : actualValue.getClass(), template); throw new AssertionFailedError(message); } return expectedType.cast(actualValue); }
Source:
<code>public void defaultRequests() throws Exception { PodTemplate template = new PodTemplate(); Pod pod = new PodTemplateBuilder(template).build(); ResourceRequirements resources = pod.getSpec().getContainers().get(0).getResources(); assertNotNull(resources); Map<String, Quantity> requests = resources.getRequests(); assertNotNull(requests); <START> assertEquals(PodTemplateBuilder.DEFAULT_JNLP_CONTAINER_CPU_REQUEST, requests.get("cpu")); assertEquals(PodTemplateBuilder.DEFAULT_JNLP_CONTAINER_MEMORY_REQUEST, requests.get("memory")); <END> }</code><technical_language>suggestion PodTemplateUtilsTest.assertQuantity(PodTemplateBuilder.DEFAULT_JNLP_CONTAINER_CPU_REQUEST, requests.get("cpu")); PodTemplateUtilsTest.assertQuantity(PodTemplateBuilder.DEFAULT_JNLP_CONTAINER_MEMORY_REQUEST, requests.get("memory"));</technical_language>

Target:
public void defaultRequests() throws Exception { PodTemplate template = new PodTemplate(); Pod pod = new PodTemplateBuilder(template).build(); ResourceRequirements resources = pod.getSpec().getContainers().get(0).getResources(); assertNotNull(resources); Map<String, Quantity> requests = resources.getRequests(); assertNotNull(requests); PodTemplateUtilsTest.assertQuantity(PodTemplateBuilder.DEFAULT_JNLP_CONTAINER_CPU_REQUEST, requests.get("cpu")); PodTemplateUtilsTest.assertQuantity(PodTemplateBuilder.DEFAULT_JNLP_CONTAINER_MEMORY_REQUEST, requests.get("memory")); }
Source:
<code>public NewMessageWallThreadPageObject openThread(String threadName) { for (WebElement thread:threadList) { if (thread.getText().contains(threadName)){ scrollAndClick(thread); } <START> break; <END> } return new NewMessageWallThreadPageObject(driver); }</code><technical_language>break statement process get of "for" loop round. element of threadList considered..</technical_language>

Target:
public NewMessageWallThreadPageObject openThread(String threadName) { for (WebElement thread:threadList) { if (thread.getText().contains(threadName)){ scrollAndClick(thread); break; } } return new NewMessageWallThreadPageObject(driver); }
Source:
<code>public boolean isMangledName(String docName) { Matcher matcher = TRASHED_PATTERN.matcher(docName); <START> return (matcher.matches()); <END> }</code><technical_language>Unneeded parenthesis. one-line this method :)</technical_language>

Target:
public boolean isMangledName(String docName) { return TRASHED_PATTERN.matcher(docName).matches(); }
Source:
<code>public void setup(Graph graph) { <START> AlertPatchService alertPatchService = new AlertPatchServiceImpl(graph); this.alertPatchService = alertPatchService; <END> SiriFuzzyTripMatcher fuzzyTripMatcher = new SiriFuzzyTripMatcher(new RoutingService(graph)); if (updateHandler == null) { updateHandler = new SiriAlertsUpdateHandler(feedId); } updateHandler.setEarlyStart(earlyStart); updateHandler.setAlertPatchService(alertPatchService); updateHandler.setSiriFuzzyTripMatcher(fuzzyTripMatcher); }</code><technical_language>need a local variable here</technical_language>

Target:
public void setup(Graph graph) { this.alertPatchService = new AlertPatchServiceImpl(graph); SiriFuzzyTripMatcher fuzzyTripMatcher = new SiriFuzzyTripMatcher(new RoutingService(graph)); if (updateHandler == null) { updateHandler = new SiriAlertsUpdateHandler(feedId); } updateHandler.setEarlyStart(earlyStart); updateHandler.setAlertPatchService(alertPatchService); updateHandler.setSiriFuzzyTripMatcher(fuzzyTripMatcher); }
Source:
<code>public String toString() { <START> return timestamp + " " + opId + " " + measurement + " " + value + " " + queryId + "." + subqueryId; <END> }</code><technical_language>StringBuilder, Joiner.on(" ")..</technical_language>

Target:
public String toString() { return Joiner.on(" ").join(timestamp, opId, measurement, value, queryId + "." + subqueryId); }
Source:
<code><START> private void performCopy() { <END> if (clipboard == null) { this.clipboard = new Clipboard(null); } String detailsStr = new CopyActionDetails(awa).getDetailsString(); clipboard.setContents(new Object[] {detailsStr}, new Transfer[] {TextTransfer.getInstance()}); this.clipboard.dispose(); this.clipboard = null; }</code><technical_language>clipboard is in this method. clipboard a local method variable remove check for null</technical_language>

Target:
private void performCopy() { Clipboard clipboard = new Clipboard(null); try { String detailsStr = new CopyActionDetails(awa).getDetailsString(); clipboard.setContents(new Object[] {detailsStr}, new Transfer[] {TextTransfer.getInstance()}); } finally { clipboard.dispose(); } }
Source:
<code>public void testEncoding() throws Exception { MockSchemaRegistry mockSchemaRegistry = new MockSchemaRegistry(); String schemaID = mockSchemaRegistry.registerSchema(MockSchema.COMPLEX_SCHEMA.getName(), MockSchema.COMPLEX_SCHEMA); Datastream stream = OracleConnectorTestUtils.createDatastream("oracle/dbName/tableName", schemaID, "ListBackedTransportProvider"); DatastreamTaskImpl task = OracleConnectorTestUtils.createDatastreamTask(stream); MessageHandler handler = new MessageHandler(_complexSource, MockSchema.COMPLEX_SCHEMA, task); List<OracleChangeEvent> events = OracleConnectorTestUtils.generateComplexMockEvents(2); BrooklinEnvelope envelope = handler.generateBrooklinEnvelope(events.get(1)); byte[] keyByteArray = (byte[]) envelope.getKey(); Assert.assertNotNull(keyByteArray); Assert.assertFalse(keyByteArray.length == 0); Assert.assertFalse(keyByteArray[0] > MAGIC_BYTE); long val = 0L; <START> int var6 = keyByteArray.length; <END> for (int var7 = 0; var7 < var6; ++var7) { byte b = keyByteArray[var7]; val <<= 8; val |= (long) (b & 255); } Assert.assertEquals((long) Long.valueOf(val), 1L); }</code><technical_language>more meaningful variable names</technical_language>

Target:
public void testEncoding() throws Exception { MockSchemaRegistry mockSchemaRegistry = new MockSchemaRegistry(); String schemaID = mockSchemaRegistry.registerSchema(MockSchema.COMPLEX_SCHEMA.getName(), MockSchema.COMPLEX_SCHEMA); Datastream stream = OracleConnectorTestUtils.createDatastream("oracle/dbName/tableName", schemaID, "ListBackedTransportProvider"); DatastreamTaskImpl task = OracleConnectorTestUtils.createDatastreamTask(stream); MessageHandler handler = new MessageHandler(_complexSource, MockSchema.COMPLEX_SCHEMA, task); List<OracleChangeEvent> events = OracleConnectorTestUtils.generateComplexMockEvents(2); BrooklinEnvelope envelope = handler.generateBrooklinEnvelope(events.get(1)); byte[] keyByteArray = (byte[]) envelope.getKey(); Assert.assertNotNull(keyByteArray); Assert.assertFalse(keyByteArray.length == 0); Assert.assertFalse(keyByteArray[0] > MAGIC_BYTE); long val = 0L; int len = keyByteArray.length; for (int index = 0; index < len; ++index) { byte b = keyByteArray[index]; val <<= 8; val |= (long) (b & 255); } Assert.assertEquals((long) Long.valueOf(val), 1L); }
Source:
<code>public GlowLightningStrike(Location location, boolean effect, Random random) { super(location); this.effect = effect; this.ticksToLive = 30; distanceToDamage = 5; distanceToIgnition = 1; <START> burnTicks = 75; <END> this.random = random; }</code><technical_language>I prefix 3 lines this.</technical_language>

Target:
public GlowLightningStrike(Location location, boolean effect, Random random) { super(location); this.effect = effect; this.ticksToLive = 30; this.distanceToDamageSquared = 25; this.distanceToIgnitionSquared = 1; this.burnTicks = 75; this.random = random; }
Source:
<code>public void run() { try { <START> if (notifyListeners() || checkIfListenersHaveDataToSendOnly()) { <END> future = autoFlushExecutor.submit(this); } else { synchronized (this) { if (isMoreDataAvailable) { isMoreDataAvailable = false; future = autoFlushExecutor.submit(this); } else { future = null; } } } } catch (Exception e) { logger.error("{}", DataList.this, e); } }</code><technical_language>combine methods do in pass? is passes nodes if pending data send return checked is same</technical_language>

Target:
public void run() { try { if (addedData() || checkIfListenersHaveDataToSendOnly()) { future = autoFlushExecutor.submit(this); } else { synchronized (this) { if (isMoreDataAvailable) { isMoreDataAvailable = false; future = autoFlushExecutor.submit(this); } else { future = null; } } } } catch (Exception e) { logger.error("{}", DataList.this, e); } }
Source:
<code>public Map<String, Long> getValueAndReset() { <START> Map<String, Long> ret = new ConcurrentHashMap<>(); <END> for (String key : value.keySet()) { ret.put(key, value.get(key).getValueAndReset()); } return ret; }</code><technical_language>ConcurrentHashMap necessary in getValueAndReset(). This function is called X seconds sample current metrics export Heron instance, is called multiple threads</technical_language>

Target:
public Map<String, Long> getValueAndReset() { Map<String, Long> ret = new HashMap<>(); for (String key : value.keySet()) { ret.put(key, value.get(key).getValueAndReset()); } return ret; }
Source:
<code>public Cookie setSameSiteMode(final String mode) { final String m = Cookies.lookupSameSiteMode(mode); if (m != null) { UndertowLogger.REQUEST_LOGGER.tracef("Setting SameSite mode to [%s] for cookie [%s]", m, this.name); this.sameSiteMode = m; this.setSameSite(true); } else { <START> UndertowLogger.REQUEST_LOGGER.warnf(UndertowMessages.MESSAGES.invalidSameSiteMode(mode, Arrays.toString(Cookie.SameSiteMode.values())), "Ignoring specified SameSite mode [%s] for cookie [%s]", mode, this.name); <END> } return this; }</code><technical_language>This called attention now. replacing exception a warn message? before, ie, throw exception</technical_language>

Target:
public Cookie setSameSiteMode(final String mode) { final String m = CookieSameSiteMode.lookupModeString(mode); if (m != null) { UndertowLogger.REQUEST_LOGGER.tracef("Setting SameSite mode to [%s] for cookie [%s]", m, this.name); this.sameSiteMode = m; this.setSameSite(true); } else { UndertowLogger.REQUEST_LOGGER.warnf(UndertowMessages.MESSAGES.invalidSameSiteMode(mode, Arrays.toString(CookieSameSiteMode.values())), "Ignoring specified SameSite mode [%s] for cookie [%s]", mode, this.name); } return this; }
Source:
<code>Future<?> triggerGC(final boolean force, final boolean suspendMajor, final boolean suspendMinor) { return gcExecutor.submit(() -> { try { runWithFlags(force, suspendMajor, suspendMinor); } catch (Exception e) { LOG.warn("Failed to complete gc {}", e.getMessage(), e); } <START> }); <END> }</code><technical_language>reformat code, this changes diff harder review. revert formatting ? soon checkstyle is happy</technical_language>

Target:
Future<?> triggerGC(final boolean force, final boolean suspendMajor, final boolean suspendMinor) { return gcExecutor.submit(() -> { runWithFlags(force, suspendMajor, suspendMinor); }); }
Source:
<code>protected void endSuccessfully() { endCommandActions(); <START> getVmStaticDAO().incrementDbGeneration(getVmTemplate().getId()); <END> }</code><technical_language>this command 'offline' move a vm disk, in case getVmTemplate().getId() NPE</technical_language>

Target:
protected void endSuccessfully() { endCommandActions(); incrementDbGenerationForRelatedEntities(); }
Source:
<code>public static String fromPassword(StringWrapper unencryptedPasswordString) { try { return CryptUtil.encryptPassword(AppConfig.getInstance(), unencryptedPasswordString.value); } catch (Exception e) { android.util.Log.e(TAG, "Error encrypting password", e); <START> return null; <END> } }</code><technical_language>return raw string if encryption fail, done in previous logic</technical_language>

Target:
public static String fromPassword(StringWrapper unencryptedPasswordString) { try { return CryptUtil.encryptPassword(AppConfig.getInstance(), unencryptedPasswordString.value); } catch (Exception e) { android.util.Log.e(TAG, "Error encrypting password", e); return unencryptedPasswordString.value; } }
Source:
<code>public boolean finalizeCommandsOnStart(Commands cmds, VirtualMachineProfile profile) { NicProfile managementNic = null; NicProfile controlNic = null; for (NicProfile nic : profile.getNics()) { if (nic.getTrafficType() == TrafficType.Management) { managementNic = nic; } else if (nic.getTrafficType() == TrafficType.Control && nic.getIp4Address() != null) { controlNic = nic; } } if (controlNic == null) { if (managementNic == null) { s_logger.error("Management network doesn't exist for the console proxy vm " + profile.getVirtualMachine()); return false; } controlNic = managementNic; } if(profile.getHypervisorType() == HypervisorType.Hyperv) { controlNic = managementNic; } CheckSshCommand check = new CheckSshCommand(profile.getInstanceName(), controlNic.getIp4Address(), 3922); cmds.addCommand("checkSsh", check); try { File uiFiles = new File("systemvm/js"); if (!uiFiles.exists()) { uiFiles = new File("/usr/share/cloudstack-common/systemvm/js"); } if (uiFiles.exists() && uiFiles.isDirectory()) { CopyFileInVmCommand copyFile = new CopyFileInVmCommand(uiFiles.getCanonicalPath(), "/usr/local/cloud/systemvm/js", controlNic.getIp4Address()); cmds.addCommand("copyFile", copyFile); } else { s_logger.error("Couldn't locate localization files for console proxy"); return false; } } catch (IOException e) { <START> s_logger.error("Failed to copy localization files for console proxy: " + e.getMessage()); <END> } return true; }</code><technical_language>return false in case of exception</technical_language>

Target:
public boolean finalizeCommandsOnStart(Commands cmds, VirtualMachineProfile profile) { NicProfile managementNic = null; NicProfile controlNic = null; for (NicProfile nic : profile.getNics()) { if (nic.getTrafficType() == TrafficType.Management) { managementNic = nic; } else if (nic.getTrafficType() == TrafficType.Control && nic.getIPv4Address() != null) { controlNic = nic; } } if (controlNic == null) { if (managementNic == null) { s_logger.error("Management network doesn't exist for the console proxy vm " + profile.getVirtualMachine()); return false; } controlNic = managementNic; } if(profile.getHypervisorType() == HypervisorType.Hyperv) { controlNic = managementNic; } CheckSshCommand check = new CheckSshCommand(profile.getInstanceName(), controlNic.getIPv4Address(), 3922); cmds.addCommand("checkSsh", check); try { File uiFiles = new File("systemvm/js"); if (!uiFiles.exists()) { uiFiles = new File("/usr/share/cloudstack-common/systemvm/js"); } if (uiFiles.exists() && uiFiles.isDirectory()) { CopyFileInVmCommand copyFile = new CopyFileInVmCommand(uiFiles.getCanonicalPath(), "/usr/local/cloud/systemvm/js", controlNic.getIPv4Address()); cmds.addCommand("copyFile", copyFile); } else { s_logger.error("Couldn't locate localization files for console proxy"); return false; } } catch (IOException e) { s_logger.error("Failed to copy localization files for console proxy: " + e.getMessage()); } return true; }
Source:
<code>public void shouldRaiseAlertIfRequestParamAppearAsMetaCharsetValue() throws Exception { HttpMessage msg = createMessage(); msg.getRequestHeader().setURI(new URI("<LINK_0>", false)); msg.setResponseBody("<html><META http-equiv=\"Content-Type\" content=\"text/html; charset=utf-8\"></html>"); rule.scanHttpResponseReceive(msg, -1, createSource(msg)); <START> assertThat(alertsRaised.size(), equalTo(1)); <END> }</code><technical_language>Add assert param well</technical_language>

Target:
public void shouldRaiseAlertIfRequestParamAppearAsMetaCharsetValue() throws Exception { HttpMessage msg = createMessage(); msg.getRequestHeader().setURI(new URI("<LINK_0>", false)); msg.setResponseBody("<html><META http-equiv=\"Content-Type\" content=\"text/html; charset=utf-8\"></html>"); rule.scanHttpResponseReceive(msg, -1, createSource(msg)); assertThat(alertsRaised.size(), equalTo(1)); assertThat(alertsRaised.get(0).getParam(), equalTo("cs")); }
Source:
<code>public static Function getFunction(String name) { Supplier<Function> supplier = func.get(name.toLowerCase()); if (supplier == null) { <START> throw new IllegalArgumentException("Invalid function name '" + name + "'"); <END> } return supplier.get(); }</code><technical_language>IAE("Invalid function name '%s'", name)</technical_language>

Target:
public static Function getFunction(String name) { Supplier<Function> supplier = func.get(name.toLowerCase()); if (supplier == null) { throw new IAE("Invalid function name '%s'", name); } return supplier.get(); }