auphong2707/dl4se-code-review-dataset huggingface dataset:
Source:
<code>private static boolean isBasicValue(ExpressionTree expression) { if (expression.is(Kind.BOOLEAN_LITERAL, Kind.NUMERIC_LITERAL, Kind.STRING_LITERAL, Kind.NULL_LITERAL)) { return BASIC_VALUES.contains(((LiteralTree) expression).value()); } else if (expression.is(Kind.UNARY_MINUS)) { ExpressionTree operand = ((UnaryExpressionTree) expression).expression(); <START> return operand.is(Kind.NUMERIC_LITERAL) && "1".equals(((LiteralTree) operand).value()); <END> } ExpressionTree withoutParenthesis = CheckUtils.removeParenthesis(expression); if (withoutParenthesis.is(Kind.VOID)) { ExpressionTree operand = ((UnaryExpressionTree) withoutParenthesis).expression(); return operand.is(Kind.NUMERIC_LITERAL) && "0".equals(((LiteralTree) operand).value()); } return false; }</code><technical_language>@vilchik-elena refactored this bit avoid magic 1 BASIC_VALUES instead</technical_language>

Target:
private static boolean isBasicValue(ExpressionTree expression) { if (expression.is(Kind.BOOLEAN_LITERAL, Kind.NUMERIC_LITERAL, Kind.STRING_LITERAL, Kind.NULL_LITERAL)) { return BASIC_VALUES.contains(((LiteralTree) expression).value()); } else if (expression.is(Kind.UNARY_MINUS)) { ExpressionTree operand = ((UnaryExpressionTree) expression).expression(); return BASIC_VALUES.contains("-" + ((LiteralTree) operand).value()); } ExpressionTree withoutParenthesis = CheckUtils.removeParenthesis(expression); if (withoutParenthesis.is(Kind.VOID)) { ExpressionTree operand = ((UnaryExpressionTree) withoutParenthesis).expression(); return operand.is(Kind.NUMERIC_LITERAL) && "0".equals(((LiteralTree) operand).value()); } return false; }
Source:
<code>protected boolean canDoAction() { clusterId = getParameters().getClusterId(); serverId = getParameters().getServerId(); serviceType = getParameters().getServiceType(); actionType = getParameters().getActionType(); if (!actionType.equalsIgnoreCase(ManageGlusterServiceCommand.MANAGE_GLUSTER_SERVICE_ACTION_TYPE_START) || !actionType.equalsIgnoreCase(ManageGlusterServiceCommand.MANAGE_GLUSTER_SERVICE_ACTION_TYPE_STOP)) { return failCanDoAction(VdcBllMessages.ACTION_TYPE_FAILED_INVALID_ACTION_TYPE); <START> } <END> if (Guid.isNullOrEmpty(clusterId) && Guid.isNullOrEmpty(serverId)) { return failCanDoAction(VdcBllMessages.ACTION_TYPE_FAILED_CLUSTERID_AND_SERVERID_BOTH_NULL); } return true; }</code><technical_language>this simplified if (!manageActionDetailsMap.keySet().contains(actionType)) { return .. }</technical_language>

Target:
protected boolean canDoAction() { clusterId = getParameters().getClusterId(); serverId = getParameters().getServerId(); serviceType = getParameters().getServiceType(); actionType = getParameters().getActionType(); if (!manageActionDetailsMap.keySet().contains(actionType)) { return failCanDoAction(VdcBllMessages.ACTION_TYPE_FAILED_INVALID_ACTION_TYPE); } if (Guid.isNullOrEmpty(clusterId) && Guid.isNullOrEmpty(serverId)) { return failCanDoAction(VdcBllMessages.ACTION_TYPE_FAILED_CLUSTERID_AND_SERVERID_BOTH_NULL); } if (!(Guid.isNullOrEmpty(clusterId)) && getClusterUtils().getAllUpServers(clusterId).size() == 0) { return failCanDoAction(VdcBllMessages.ACTION_TYPE_FAILED_NO_SERVERS_FOR_CLUSTER); } return true; }
Source:
<code>public void testQueryWithMultipleColumnsInExpression() { Query query1 = new Query().from(table1).select("contributor_id,name"); DataSet set = getDataContext().executeQuery(query1); assertEquals(set.next(), true); <START> assertEquals(set.getRow().toString(), "Row[values=[1, kasper]]"); <END> Query query2 = new Query().from(table1).select("Greatest(1,2,3),max(contributer_id)"); assertEquals(query2.toString(), "SELECT Greatest(1,2,3), MAX(contributer_id) FROM MetaModelSchema.contributor"); Query query3 = new Query().from(table1).select("*,count(*)"); assertEquals(query3.toString(), "SELECT contributor.contributor_id, contributor.name, contributor.country, COUNT(*)" + " FROM MetaModelSchema.contributor"); }</code><technical_language>matters much, I pretty "expected" "actual" parameters switched here. expectation argument</technical_language>

Target:
public void testQueryWithMultipleColumnsInExpression() { Query query1 = new Query().from(table1).select("contributor_id,name"); DataSet set = getDataContext().executeQuery(query1); assertEquals(true,set.next()); assertEquals("Row[values=[1, kasper]]",set.getRow().toString()); Query query2 = new Query().from(table1).select("Greatest(1,2,3),max(contributer_id)"); assertEquals("SELECT Greatest(1,2,3), MAX(contributer_id) FROM MetaModelSchema.contributor",query2.toString()); Query query3 = new Query().from(table1).select("*,count(*)"); assertEquals("SELECT contributor.contributor_id, contributor.name, contributor.country, COUNT(*)" + " FROM MetaModelSchema.contributor",query3.toString()); }
Source:
<code>Project.Id getValueKey() { <START> return new Project.Id(Integer.parseInt(getValue())); <END> }</code><technical_language>Instead of toString parsing, store Project.Id passed in constructor a field this method returns</technical_language>

Target:
Project.Id getValueKey() { return projectId; }
Source:
<code>public SipMessage.Builder<T> withViaHeaders(final List<ViaHeader> vias) { if (vias != null) { this.viaHeaders = ensureList(this.viaHeaders); this.viaHeaders.clear(); for (final ViaHeader via : vias) { this.viaHeaders.add(via); <START> viaHeader = via; <END> } } return this; }</code><technical_language>others, need "remember" via, last</technical_language>

Target:
public SipMessage.Builder<T> withViaHeaders(final List<ViaHeader> vias) { if (vias != null && !vias.isEmpty()) { this.viaHeaders = ensureList(this.viaHeaders); this.viaHeaders.clear(); viaHeader = vias.get(0); this.viaHeaders.addAll(vias); } return this; }
Source:
<code>public void initStorageUsage(Map<String, Map<String, Long>> usage) { <START> logger.info("Initializing storage usage for " + usage.size() + " accounts"); <END> storageUsage = new ConcurrentHashMap<>(); initMap(usage, storageUsage, true); }</code><technical_language>please update class</technical_language>

Target:
public void initStorageUsage(Map<String, Map<String, Long>> usage) { logger.info("Initializing storage usage for accounts", usage.size()); storageUsage = new ConcurrentHashMap<>(); initMap(usage, storageUsage, true); }
Source:
<code>protected void setSeries(String seriesName, double[] seriesValues) { <START> Objects.requireNonNull(seriesName); Objects.requireNonNull(seriesValues); <END> String seriesType = getSeriesType(seriesName); fModelBuilder.addYSeries( new YSeries( seriesType, getSeriesColor(seriesName), getWidth(seriesName), getSeriesStyle(seriesType), seriesName, seriesValues)); }</code><technical_language>exception message please</technical_language>

Target:
protected void setSeries(String seriesName, double[] seriesValues) { Objects.requireNonNull(seriesName, "Series name cannot be null"); Objects.requireNonNull(seriesValues, "Series values cannot be null"); String seriesType = getSeriesType(seriesName); fModelBuilder.addYSeries( new YSeries( seriesType, getSeriesColor(seriesName), getWidth(seriesName), getSeriesStyle(seriesType), seriesName, seriesValues)); }
Source:
<code>public void openGroup(int notificationNumber) { WebElement notifications = <START> getDriver().findElementsByCssSelector(NOTIFICATION_EVENT_SELECTOR).get(notificationNumber); <END> WebElement group = notifications.findElement(cssSelector(GROUP_SELECTOR)); group.click(); }</code><technical_language>if want this page object for a notif dashboard</technical_language>

Target:
public void openGroup(int notificationNumber) { WebElement notifications = findNotifications().get(notificationNumber); WebElement group = notifications.findElement(cssSelector(GROUP_SELECTOR)); group.click(); }
Source:
<code>public void checkAttributeValue(PerunSessionImpl sess, User user, Facility facility, Attribute attribute) throws WrongAttributeValueException, WrongReferenceAttributeValueException, InternalErrorException, WrongAttributeAssignmentException { try { Attribute uidNamespaceAttribute = sess.getPerunBl().getAttributesManagerBl().getAttribute(sess, facility, AttributesManager.NS_FACILITY_ATTR_DEF + ":uid-namespace"); Attribute uidAttribute; if (uidNamespaceAttribute.getValue() != null) { uidAttribute = sess.getPerunBl().getAttributesManagerBl().getAttribute(sess, user, AttributesManager.NS_USER_ATTR_DEF + ":uid-namespace:" + uidNamespaceAttribute.getValue()); uidAttribute.setValue(attribute.getValue()); sess.getPerunBl().getAttributesManagerBl().checkAttributeValue(sess, user, uidAttribute); } else { <START> throw new WrongReferenceAttributeValueException(attribute); <END> } } catch (AttributeNotExistsException e) { throw new ConsistencyErrorException(e); } }</code><technical_language>provide null instead of uidAttribute, remove it. If remove a constructor is called a message is generated</technical_language>

Target:
public void checkAttributeValue(PerunSessionImpl sess, User user, Facility facility, Attribute attribute) throws WrongAttributeValueException, WrongReferenceAttributeValueException, InternalErrorException, WrongAttributeAssignmentException { try { Attribute uidNamespaceAttribute = sess.getPerunBl().getAttributesManagerBl().getAttribute(sess, facility, AttributesManager.NS_FACILITY_ATTR_DEF + ":uid-namespace"); Attribute uidAttribute; if (uidNamespaceAttribute.getValue() != null) { uidAttribute = sess.getPerunBl().getAttributesManagerBl().getAttribute(sess, user, AttributesManager.NS_USER_ATTR_DEF + ":uid-namespace:" + uidNamespaceAttribute.getValue()); uidAttribute.setValue(attribute.getValue()); sess.getPerunBl().getAttributesManagerBl().checkAttributeValue(sess, user, uidAttribute); } else { throw new WrongReferenceAttributeValueException(attribute, (Attribute) null); } } catch (AttributeNotExistsException e) { throw new ConsistencyErrorException(e); } }
Source:
<code>public void setExpiryQueueSize(int expiryQueueSize) { testImmutability("expiryQueueSize"); <START> setProperty(location, "location", properties); <END> this.expiryQueueSize = expiryQueueSize; }</code><technical_language>s/location/expiryQueueSize/</technical_language>

Target:
public void setExpiryQueueSize(int expiryQueueSize) { testImmutability("expiryQueueSize"); setProperty(String.valueOf(expiryQueueSize), "expiryQueueSize", properties); this.expiryQueueSize = expiryQueueSize; }
Source:
<code>public void verifyDeleteViaVideoNotPresent() { addVideoViaAjax(); deleteVideo(); verifyNotificationMessage(); Assertion.assertNotEquals(VideoContent.youtubeVideoURL2name, getNewestVideoTitle()); PageObjectLogging.log("verifyDeleteVideoNotPresent", <START> "verify that video with following title was deleted: " + VideoContent.youtubeVideoURL2name, <END> true); }</code><technical_language>line shorter</technical_language>

Target:
public void verifyDeleteViaVideoNotPresent() { addVideoViaAjax(VideoContent.youtubeVideoURL2); refreshPage(); deleteVideo(); verifyNotificationMessage(); Assertion.assertNotEquals(VideoContent.youtubeVideoURL2name, getNewestVideoTitle()); PageObjectLogging.log("verifyDeleteVideoNotPresent", "verify video " + VideoContent.youtubeVideoURL2name + " was deleted", true); }
Source:
<code>public void activate(final PatchSet.Id patchSetId) { if (indexOf(patchSetId) != -1) { if (!patchSetId.equals(activePatchSetId)) { deactivate(); PatchSetComplexDisclosurePanel patchSetPanel = patchSetPanels.get(patchSetId); patchSetPanel.setOpen(true); patchSetPanel.setActive(true); activePatchSetId = patchSetId; } } else { <START> Gerrit.display("change," + patchSetId.getParentKey().get()); <END> } }</code><technical_language>This a PageLink method generate this URL</technical_language>

Target:
public void activate(final PatchSet.Id patchSetId) { if (indexOf(patchSetId) != -1) { if (!patchSetId.equals(activePatchSetId)) { deactivate(); PatchSetComplexDisclosurePanel patchSetPanel = patchSetPanels.get(patchSetId); patchSetPanel.setOpen(true); patchSetPanel.setActive(true); activePatchSetId = patchSetId; } } else { Gerrit.display(PageLinks.toChange(patchSetId.getParentKey())); } }
Source:
<code>public DataStoreTransaction beginTransaction() { <START> EntityManager entityManager = entityManagerSupplier.get(); <END> return new AggregationDataStoreTransaction(entityManager, queryEngine, aggregationDataStoreTransactionCancel); }</code><technical_language>create entityManager here. transaction create entity manager</technical_language>

Target:
public DataStoreTransaction beginTransaction() { return new AggregationDataStoreTransaction(queryEngine, cache); }
Source:
<code><START> public void process(Message<?> message) { <END> if (message != null) { double value = convertToDouble(message.getPayload()); String metricName = computeMetricName(message); RichGauge gauge = this.richGaugeRepository.findOne(metricName); if (gauge == null) { gauge = new RichGauge(metricName, 0.0D, this.alpha, 0.0D, 0.0D, 0.0D, 0L); } gauge.set(value); this.richGaugeRepository.save(gauge); } }</code><technical_language>this is thread safe</technical_language>

Target:
public void process(Message<?> message) { if (message != null) { double value = convertToDouble(message.getPayload()); this.richGaugeRepository.setValue(computeMetricName(message), value, alpha); } }
Source:
<code>private void processWrite(Request request) throws RequestProcessorException { <START> if (request.commitProcQueueStartTime != -1 && <END> request.commitRecvTime != -1) { long currentTime = Time.currentElapsedTime(); ServerMetrics.getMetrics().WRITE_COMMITPROC_TIME.add(currentTime - request.commitProcQueueStartTime); ServerMetrics.getMetrics().LOCAL_WRITE_COMMITTED_TIME.add(currentTime - request.commitRecvTime); } else if (request.commitRecvTime != -1) { ServerMetrics.getMetrics().SERVER_WRITE_COMMITTED_TIME.add( Time.currentElapsedTime() - request.commitRecvTime); } long timeBeforeFinalProc = Time.currentElapsedTime(); nextProcessor.processRequest(request); ServerMetrics.getMetrics().WRITE_FINAL_PROC_TIME.add( Time.currentElapsedTime() - timeBeforeFinalProc); }</code><technical_language>L474 L486 is exact copy of code in doWork, refactor copied code a common function, alternatively, doWork call processWrite</technical_language>

Target:
private void processWrite(Request request) throws RequestProcessorException { processCommitMetrics(request, true); long timeBeforeFinalProc = Time.currentElapsedTime(); nextProcessor.processRequest(request); ServerMetrics.getMetrics().WRITE_FINAL_PROC_TIME.add( Time.currentElapsedTime() - timeBeforeFinalProc); }
Source:
<code>private Metacard createMetacardForFeature(SimpleFeature feature) throws FeatureIndexingException { Validate.notEmpty(metacardType, GEO_ENTRY_METACARD_TYPE_MISSING_ERROR_MSG); <START> Metacard metacard = new MetacardImpl(metacardType.get(0)); <END> String countryCode = feature.getID(); Object nameObject = feature.getAttribute(NAME_KEY); if (nameObject instanceof String) { metacard.setAttribute(new AttributeImpl(Core.TITLE, (String) nameObject)); metacard.setAttribute(new AttributeImpl(Location.COUNTRY_CODE, countryCode)); String wkt = WKT_WRITER_THREAD_LOCAL.get().write((Geometry) feature.getDefaultGeometry()); metacard.setAttribute(new AttributeImpl(Core.LOCATION, wkt)); List<Serializable> tags = Arrays.asList(GAZETTEER_METACARD_TAG, GeoCodingConstants.COUNTRY_TAG); metacard.setAttribute(new AttributeImpl(Core.METACARD_TAGS, tags)); metacard.setAttribute( new AttributeImpl( GeoEntryAttributes.GAZETTEER_SORT_VALUE, GeoCodingConstants.COUNTRY_GAZETTEER_SORT_VALUE)); if (isCountry(feature)) { metacard.setAttribute( new AttributeImpl( GeoEntryAttributes.FEATURE_CODE_ATTRIBUTE_NAME, GeoCodingConstants.POLITICAL_ENTITY)); } return metacard; } throw new FeatureIndexingException("Malformed feature"); }</code><technical_language>0 magic :trollface:</technical_language>

Target:
private Metacard createMetacardForFeature(SimpleFeature feature) throws FeatureIndexingException { Metacard metacard = new MetacardImpl( metacardTypes .stream() .findFirst() .orElseThrow( () -> new FeatureIndexingException(GEO_ENTRY_METACARD_TYPE_MISSING_ERROR_MSG))); String countryCode = feature.getID(); Object nameObject = feature.getAttribute(NAME_KEY); if (nameObject instanceof String) { metacard.setAttribute(new AttributeImpl(Core.TITLE, (String) nameObject)); metacard.setAttribute(new AttributeImpl(Location.COUNTRY_CODE, countryCode)); String wkt = WKT_WRITER_THREAD_LOCAL.get().write((Geometry) feature.getDefaultGeometry()); metacard.setAttribute(new AttributeImpl(Core.LOCATION, wkt)); List<Serializable> tags = Arrays.asList(GAZETTEER_METACARD_TAG, GeoCodingConstants.COUNTRY_TAG); metacard.setAttribute(new AttributeImpl(Core.METACARD_TAGS, tags)); metacard.setAttribute( new AttributeImpl( GeoEntryAttributes.GAZETTEER_SORT_VALUE, GeoCodingConstants.COUNTRY_GAZETTEER_SORT_VALUE)); if (isCountry(feature)) { metacard.setAttribute( new AttributeImpl( GeoEntryAttributes.FEATURE_CODE_ATTRIBUTE_NAME, GeoCodingConstants.POLITICAL_ENTITY)); } return metacard; } throw new FeatureIndexingException("Malformed feature"); }
Source:
<code>public boolean isSpawnIfNoHome() { <START> return config.getBoolean("spawn-if-no-home", false); <END> }</code><technical_language>This default true preserve previous behaviour</technical_language>

Target:
public boolean isSpawnIfNoHome() { return config.getBoolean("spawn-if-no-home", true); }
Source:
<code>private void orphan() { if (slot == null) { return; } if (!slot.isRemovable()) { <START> throw new IllegalArgumentException("Cannont remove a child from a permanent slot"); <END> } if (parent != null) { internalHide(); parent.children.remove(this); parent = null; } slot = null; }</code><technical_language>typo</technical_language>

Target:
private void orphan() { if (slot == null) { return; } if (!slot.isRemovable()) { throw new IllegalArgumentException("Cannot remove a child from a permanent slot"); } if (parent != null) { internalHide(); parent.children.remove(this); parent = null; } slot = null; }
Source:
<code>public Response add(Event event) { validateParameters(event, "origin", "severity", "customId", "description"); validateEnums(Event.class, event); AddExternalEventParameters parameters; boolean isHostExternalStateDefined = event.isSetHost() && event.getHost().isSetExternalStatus() && event.getHost().getExternalStatus().isSetState(); boolean isStorageDomainExternalStateDefined = event.isSetStorageDomain() && event.getStorageDomain().isSetExternalStatus() && event.getStorageDomain().getExternalStatus().isSetState(); if (isHostExternalStateDefined) { parameters = new AddExternalEventParameters(map(event), ExternalStatusMapper.map(EntityExternalStatus.fromValue( event.getHost().getExternalStatus().getState()), null)); } else if (isStorageDomainExternalStateDefined) { <START> parameters = new AddExternalEventParameters(map(event), <END> ExternalStatusMapper.map(EntityExternalStatus.fromValue( event.getStorageDomain().getExternalStatus().getState()), null)); } else{ parameters = new AddExternalEventParameters(map(event), null); } return performCreate(VdcActionType.AddExternalEvent, parameters, new QueryIdResolver<Long>(VdcQueryType.GetAuditLogById, GetAuditLogByIdParameters.class)); }</code><technical_language>consider extracting code creates parameters object a method, add() method stays short readable</technical_language>

Target:
public Response add(Event event) { validateParameters(event, "origin", "severity", "customId", "description"); validateEnums(Event.class, event); return performCreate(VdcActionType.AddExternalEvent, getParameters(event), new QueryIdResolver<Long>(VdcQueryType.GetAuditLogById, GetAuditLogByIdParameters.class)); }
Source:
<code>private void writeOutUsersDotAttributesFile(File userAttributesFile) { Map<String, Object> json = null; try (InputStream stream = Files.newInputStream(Paths.get(userAttributesFile.toURI()))) { if ((json = MAPPER.parser().parseMap(stream)) == null) { <START> return; <END> } addGuestClaimsProfileAttributes(json); if (json.containsKey(oldHostName)) { json.put(System.getProperty(SystemBaseUrl.HOST), json.remove(oldHostName)); } for (Map.Entry<String, Object> entry : json.entrySet()) { json.put(entry.getKey(), replaceLocalhost(entry.getValue())); } } catch (IOException e) { LOGGER.warn("Unable to read system user attribute file for hostname update.", e); } if (json != null) { try { FileUtils.writeStringToFile(userAttributesFile, Boon.toPrettyJson(json)); } catch (IOException e) { LOGGER.warn("Unable to write user attribute file for system update.", e); } } }</code><technical_language>Add logging statement userAttributesFile valid JSON</technical_language>

Target:
private void writeOutUsersDotAttributesFile(File userAttributesFile) { Map<String, Object> json = null; try (InputStream stream = Files.newInputStream(Paths.get(userAttributesFile.toURI()))) { if ((json = MAPPER.parser().parseMap(stream)) == null) { LOGGER.debug("Json not found"); return; } addGuestClaimsProfileAttributes(json); if (json.containsKey(oldHostName)) { json.put(System.getProperty(SystemBaseUrl.HOST), json.remove(oldHostName)); } for (Map.Entry<String, Object> entry : json.entrySet()) { json.put(entry.getKey(), replaceLocalhost(entry.getValue())); } } catch (IOException e) { LOGGER.warn("Unable to read system user attribute file for hostname update.", e); } if (json != null) { try { FileUtils.writeStringToFile(userAttributesFile, Boon.toPrettyJson(json)); } catch (IOException e) { LOGGER.warn("Unable to write user attribute file for system update.", e); } } }
Source:
<code>private void waitForStatus(final long jobId, final Status status) throws InterruptedException, TimeoutException { CommonUtils.waitFor("Waiting for job status", () -> { try { return mJobMaster.getStatus(jobId).getStatus() == status; } catch (Exception e) { Throwables.propagate(e); } return null; <START> }, WaitForOptions.defaults().setInterval(10).setTimeoutMs(10 * Constants.SECOND_MS)); <END> }</code><technical_language>is this needed</technical_language>

Target:
private void waitForStatus(final long jobId, final Status status) throws InterruptedException, TimeoutException { CommonUtils.waitFor("Waiting for job status", () -> { try { return mJobMaster.getStatus(jobId).getStatus() == status; } catch (Exception e) { Throwables.propagate(e); } return null; }, WaitForOptions.defaults().setTimeoutMs(10 * Constants.SECOND_MS)); }
Source:
<code>private static CharSequence parseBody(String strippedRawBody) { Spanned body = Html.fromHtml(strippedRawBody); int i = body.length()-1; <START> for (; i >= 0 && Character.isWhitespace(body.charAt(i)); --i); <END> return body.subSequence(0, i+1); }</code><technical_language>is happening here?! code readability, is desired here</technical_language>

Target:
static CharSequence parseBody(String strippedRawBody) { CharSequence body = Html.fromHtml(strippedRawBody); final int len = body.length(); if (body.charAt(len-1) == '\n' && body.charAt(len-2) == '\n') { body = body.subSequence(0, len-2); } return body; }
Source:
<code><START> public void checkWhitespaceAroundOperator(OperatorDeclarationContext ctx) { <END> for (int i = 0; i < ctx.getChild(0).getChildCount(); i++) { if (ctx.getChild(0).getChild(i) instanceof OperatorContext) { OperatorContext op = (OperatorContext) ctx.getChild(0).getChild(i); Token before = ((TerminalNodeImpl) ctx.getChild(0).getChild(i - 1)).getSymbol(); Token after = ((TerminalNodeImpl) ctx.getChild(0).getChild(i + 1)).getSymbol(); int leftMargin = op.getStart().getCharPositionInLine() - ListenerUtil.getLastCharPositionInLine(before); if (op.getStart().getLine() == before.getLine() && leftMargin != 2) { printer.error(Messages.OPERATOR + Messages.SPACE_BEFORE, ListenerUtil.getContextStopLocation(op)); } int rightMargin = after.getCharPositionInLine() - ListenerUtil.getLastCharPositionInLine(op.getStart()); if (after.getLine() == op.getStart().getLine() && rightMargin != 2) { printer.error(Messages.OPERATOR + Messages.SPACE_AFTER, ListenerUtil.getContextStopLocation(op)); } } } }</code><technical_language>Remove public access modifier method package-private</technical_language>

Target:
void checkWhitespaceAroundOperator(OperatorDeclarationContext ctx) { for (int i = 0; i < ctx.getChild(0).getChildCount(); i++) { if (ctx.getChild(0).getChild(i) instanceof OperatorContext) { OperatorContext op = (OperatorContext) ctx.getChild(0).getChild(i); Token before = ((TerminalNodeImpl) ctx.getChild(0).getChild(i - 1)).getSymbol(); Token after = ((TerminalNodeImpl) ctx.getChild(0).getChild(i + 1)).getSymbol(); int leftMargin = op.getStart().getCharPositionInLine() - ListenerUtil.getLastCharPositionInLine(before); if (op.getStart().getLine() == before.getLine() && leftMargin != 2) { printer.error(Messages.OPERATOR + Messages.SPACE_BEFORE, ListenerUtil.getContextStopLocation(op)); } int rightMargin = after.getCharPositionInLine() - ListenerUtil.getLastCharPositionInLine(op.getStart()); if (after.getLine() == op.getStart().getLine() && rightMargin != 2) { printer.error(Messages.OPERATOR + Messages.SPACE_AFTER, ListenerUtil.getContextStopLocation(op)); } } } }
Source:
<code>private void hideElementRecursive(MUIElement element) { if (element == null || element.getWidget() == null) return; if (element instanceof MPlaceholder) { MPlaceholder ph = (MPlaceholder) element; element = ph.getRef(); <START> element.setCurSharedRef(null); <END> } if (element instanceof MWindow && element.getWidget() != null) { element.setVisible(false); } if (element instanceof MGenericStack<?>) { MGenericStack<?> container = (MGenericStack<?>) element; MUIElement curSel = container.getSelectedElement(); hideElementRecursive(curSel); } else if (element instanceof MElementContainer<?>) { MElementContainer<?> container = (MElementContainer<?>) element; for (MUIElement childElement : container.getChildren()) { hideElementRecursive(childElement); } if (element instanceof MWindow) { for (MWindow w : ((MWindow) element).getWindows()) { hideElementRecursive(w); } } else if (element instanceof MPerspective) { for (MWindow w : ((MPerspective) element).getWindows()) { hideElementRecursive(w); } } } }</code><technical_language>this check: if(element.getCurSharedRef() == ph) { element.setCurSharedRef(null); }</technical_language>

Target:
private void hideElementRecursive(MUIElement element) { if (element == null || element.getWidget() == null) return; if (element instanceof MPlaceholder) { MPlaceholder ph = (MPlaceholder) element; element = ph.getRef(); if (element.getCurSharedRef() == ph) { element.setCurSharedRef(null); } } if (element instanceof MWindow && element.getWidget() != null) { element.setVisible(false); } if (element instanceof MGenericStack<?>) { MGenericStack<?> container = (MGenericStack<?>) element; MUIElement curSel = container.getSelectedElement(); hideElementRecursive(curSel); } else if (element instanceof MElementContainer<?>) { MElementContainer<?> container = (MElementContainer<?>) element; for (MUIElement childElement : container.getChildren()) { hideElementRecursive(childElement); } if (element instanceof MWindow) { for (MWindow w : ((MWindow) element).getWindows()) { hideElementRecursive(w); } } else if (element instanceof MPerspective) { for (MWindow w : ((MPerspective) element).getWindows()) { hideElementRecursive(w); } } } }
Source:
<code>private void startShutdown() { <START> if (stop == false) { <END> stop = true; logger.info("Shutting down workflow executor loop"); workflowExecutor.noticeRunWhileConditionChange(); } }</code><technical_language>[trivial] write !stop instead</technical_language>

Target:
private void startShutdown() { if (!stop) { stop = true; logger.info("Shutting down workflow executor loop"); workflowExecutor.noticeRunWhileConditionChange(); } }
Source:
<code>public int openTaskDeactivationDialog(List<IEditorReference> dirtyRefs) { Iterable<String> iter = Iterables.transform(dirtyRefs, new Function<IEditorReference, String>() { @Override public String apply(IEditorReference ref) { return ref.getTitle(); } }); <START> Joiner joiner = Joiner.on('\n'); <END> return new MessageDialog(WorkbenchUtil.getShell(), "Task Deactivation", null, "The following editors have unsaved changes. Do you still want to deactivate the task?\n\n" + joiner.join(iter), MessageDialog.QUESTION, new String[] { "Deactivate Task and Save All", "Deactivate and Save Some...", IDialogConstants.CANCEL_LABEL }, 1).open(); }</code><technical_language>Good! simplify a letting String editors = Joiner.on('\n').join(Iterables.transform..</technical_language>

Target:
public int openTaskDeactivationDialog(List<IEditorReference> dirtyRefs) { String editors = Joiner.on('\n').join( Iterables.transform(dirtyRefs, new Function<IEditorReference, String>() { @Override public String apply(IEditorReference ref) { return ref.getTitle(); } })); return new MessageDialog(WorkbenchUtil.getShell(), "Task Deactivation", null, "The following editors have unsaved changes. Do you still want to deactivate the task?\n\n" + editors, MessageDialog.QUESTION, new String[] { "Deactivate Task and Save All", "Deactivate and Save Some...", IDialogConstants.CANCEL_LABEL }, 1).open(); }
Source:
<code><START> protected Item createBroadcast(org.atlasapi.media.entity.simple.Item inputItem) { <END> Item item = new Item(); HashSet<Broadcast> broadcasts = Sets.newHashSet(); for(org.atlasapi.media.entity.simple.Broadcast broadcast : inputItem.getBroadcasts()) { broadcasts.add(broadcastTransformer.transform(broadcast)); } Version version = new Version().copyWithBroadcasts(broadcasts); item.setVersions(ImmutableSet.of(version)); return item; }</code><technical_language>reason heard..</technical_language>

Target:
private Item createBroadcast(org.atlasapi.media.entity.simple.Item inputItem) { Item item = new Item(); HashSet<Broadcast> broadcasts = Sets.newHashSet(); for(org.atlasapi.media.entity.simple.Broadcast broadcast : inputItem.getBroadcasts()) { broadcasts.add(broadcastTransformer.transform(broadcast)); } Version version = new Version().copyWithBroadcasts(broadcasts); item.setVersions(ImmutableSet.of(version)); return item; }
Source:
<code>public void init() throws DBException { Properties props = getProperties(); commitTime = Integer .parseInt(props.getProperty("solr.commit.within.time", DEFAULT_COMMIT_WITHIN_TIME)); batchMode = Boolean.parseBoolean(props.getProperty("solr.batch.mode", DEFAULT_BATCH_MODE)); Boolean cloudMode = Boolean.parseBoolean(props.getProperty("solr.cloud", DEFAULT_CLOUD_MODE)); <START> System.out.println("Solr Cloud Mode = " + cloudMode); <END> if (cloudMode) { System.out.println("Solr Zookeeper Remote Hosts = " + props.getProperty("zookeeper.host.list", DEFAULT_REMOTE_ZOOKEEPER_HOST)); client = new CloudSolrClient( props.getProperty("zookeeper.host.list", DEFAULT_REMOTE_ZOOKEEPER_HOST)); } else { client = new HttpSolrClient(props.getProperty("solr.base.url", DEFAULT_SOLR_BASE_URL)); } }</code><technical_language>This stderr</technical_language>

Target:
public void init() throws DBException { Properties props = getProperties(); commitTime = Integer .parseInt(props.getProperty("solr.commit.within.time", DEFAULT_COMMIT_WITHIN_TIME)); batchMode = Boolean.parseBoolean(props.getProperty("solr.batch.mode", DEFAULT_BATCH_MODE)); Boolean cloudMode = Boolean.parseBoolean(props.getProperty("solr.cloud", DEFAULT_CLOUD_MODE)); System.err.println("Solr Cloud Mode = " + cloudMode); if (cloudMode) { System.err.println("Solr Zookeeper Remote Hosts = " + props.getProperty("solr.zookeeper.hosts", DEFAULT_ZOOKEEPER_HOSTS)); client = new CloudSolrClient( props.getProperty("solr.zookeeper.hosts", DEFAULT_ZOOKEEPER_HOSTS)); } else { client = new HttpSolrClient(props.getProperty("solr.base.url", DEFAULT_SOLR_BASE_URL)); } }
Source:
<code>public Agent agentByUuid(String uuid) { String key = agentCacheKey(uuid); Agent agent = (Agent) cache.get(key); if (agent == null) { synchronized (key) { agent = fetchAgentByUuid(uuid); cache.put(key, agent); } } <START> <END> return agent; }</code><technical_language>Need double checking done</technical_language>

Target:
public Agent agentByUuid(String uuid) { String key = agentCacheKey(uuid); Agent agent = (Agent) cache.get(key); if (agent == null) { synchronized (key) { agent = (Agent) cache.get(key); if (agent != null){ return agent; } agent = fetchAgentByUuid(uuid); cache.put(key, agent); } } return agent; }
Source:
<code>public static void main(String[] args) { SampleCRUDQuickstartAsync p = new SampleCRUDQuickstartAsync(); try { System.out.println("Starting ASYNC main"); p.getStartedDemo(); System.out.println("Demo complete, please hold while resources are released"); } catch (Exception e) { e.printStackTrace(); System.err.println(String.format("Cosmos getStarted failed with %s", e)); } finally { System.out.println("Closing the client"); p.close(); } <START> System.exit(0); <END> }</code><technical_language>reason System.exit(0) do a hang this</technical_language>

Target:
public static void main(String[] args) { SampleCRUDQuickstartAsync p = new SampleCRUDQuickstartAsync(); try { logger.info("Starting ASYNC main"); System.out.println("got here.\n"); p.getStartedDemo(); logger.info("Demo complete, please hold while resources are released"); } catch (Exception e) { e.printStackTrace(); logger.error(String.format("Cosmos getStarted failed with %s", e)); } finally { logger.info("Closing the client"); p.close(); } }
Source:
<code>public void init(HttpSecurity http) throws Exception { ApplicationContext context = http.getSharedObject(ApplicationContext.class); context.getAutowireCapableBeanFactory().autowireBean(this); if (stormpathWebEnabled) { if (loginEnabled) { http .formLogin() .loginPage(loginUri) .defaultSuccessUrl(loginNextUri) .successHandler(successHandler) .usernameParameter("login") .passwordParameter("password") .and().authorizeRequests() <START> .antMatchers(loginUri+"*").permitAll(); <END> } if (logoutEnabled) { http .logout() .invalidateHttpSession(true) .logoutUrl(logoutUri) .logoutSuccessUrl(logoutNextUri) .addLogoutHandler(logoutHandler) .and().authorizeRequests() .antMatchers(logoutUri).permitAll(); } if (!csrfProtectionEnabled) { http.csrf().disable(); } else { http.csrf().csrfTokenRepository(csrfTokenRepository); } if (forgotEnabled) { http.authorizeRequests().antMatchers(forgotUri).permitAll(); } if (changeEnabled) { http.authorizeRequests().antMatchers(changeUri).permitAll(); } if (registerEnabled) { http.authorizeRequests().antMatchers(registerUri).permitAll(); } if (verifyEnabled) { http.authorizeRequests().antMatchers(verifyUri).permitAll(); } if (fullyAuthenticatedEnabled) { http .authorizeRequests() .antMatchers("/assets/**").permitAll() .anyRequest().fullyAuthenticated(); } } }</code><technical_language>need careful - i.e. if configured ends *, add another (because subdirectories accessible intended effect)</technical_language>

Target:
public void init(HttpSecurity http) throws Exception { ApplicationContext context = http.getSharedObject(ApplicationContext.class); context.getAutowireCapableBeanFactory().autowireBean(this); if (stormpathWebEnabled) { if (loginEnabled) { String loginUriMatch = (loginUri.endsWith("*")) ? loginUri : loginUri + "*"; http .formLogin() .loginPage(loginUri) .defaultSuccessUrl(loginNextUri) .successHandler(successHandler) .usernameParameter("login") .passwordParameter("password") .and().authorizeRequests() .antMatchers(loginUriMatch).permitAll(); } if (logoutEnabled) { http .logout() .invalidateHttpSession(true) .logoutUrl(logoutUri) .logoutSuccessUrl(logoutNextUri) .addLogoutHandler(logoutHandler) .and().authorizeRequests() .antMatchers(logoutUri).permitAll(); } if (!csrfProtectionEnabled) { http.csrf().disable(); } else { http.csrf().csrfTokenRepository(csrfTokenRepository); } if (forgotEnabled) { http.authorizeRequests().antMatchers(forgotUri).permitAll(); } if (changeEnabled) { http.authorizeRequests().antMatchers(changeUri).permitAll(); } if (registerEnabled) { http.authorizeRequests().antMatchers(registerUri).permitAll(); } if (verifyEnabled) { http.authorizeRequests().antMatchers(verifyUri).permitAll(); } if (fullyAuthenticatedEnabled) { http.authorizeRequests() .antMatchers("/assets/css/stormpath.css").permitAll() .antMatchers("/assets/css/custom.stormpath.css").permitAll() .anyRequest().fullyAuthenticated(); } } }
Source:
<code><START> private String toColumData(TmfStatisticsTreeNode node, long config) { <END> if (config == TmfStatisticsTreeNode.TOTAL) { if ((node.getParent().getParent() == null) || (fTotalMasterNode == null) || (fTotalMasterNode.getValues().getTotal() == 0)) { return fFormatter.format(node.getValues().getTotal()); } return String.format("%s (%s %s)", fFormatter.format(node.getValues().getTotal()), String.format("%3.1f", (float) (100 * node.getValues().getTotal()) / fTotalMasterNode.getValues().getTotal()), "%"); } else if (config == TmfStatisticsTreeNode.PARTIAL) { if ((node.getParent().getParent() == null) || (fTotalMasterNode == null) || (fTotalMasterNode.getValues().getPartial() == 0)) { return fFormatter.format(node.getValues().getPartial()); } return String.format("%s (%s %s)", fFormatter.format(node.getValues().getPartial()), String.format("%3.1f", (float) (100 * node.getValues().getPartial()) / fTotalMasterNode.getValues().getPartial()), "%"); } return ""; }</code><technical_language>total (both longs) check for invalid data !!! :)</technical_language>

Target:
private String toColumData(TmfStatisticsTreeNode node, long config) { long eventValue = 0; long eventTotal = 0; if (node != null && fTotalMasterNode != null) { if (config == TmfStatisticsTreeNode.TOTAL) { eventValue = node.getValues().getTotal(); eventTotal = fTotalMasterNode.getValues().getTotal(); } else if (config == TmfStatisticsTreeNode.PARTIAL) { eventValue = node.getValues().getPartial(); eventTotal = fTotalMasterNode.getValues().getPartial(); } else { throw new IllegalArgumentException(); } } if ((node == null) || (node.getParent().getParent() == null) || (fTotalMasterNode == null) || (eventTotal == 0)) { return fFormatter.format(eventValue); } return String.format("%s (%s %s)", fFormatter.format(eventValue), String.format("%3.1f", (float) (100 * eventValue) / eventTotal), "%"); }
Source:
<code>public void sequentialPredictOnBatch(PredictOnBatchParams predictParams) throws Exception { try { MultiLayerNetwork model = predictParams.getSequentialModel(); DataSetIterator dataSetIterator = new HDF5MiniBatchDataSetIterator( predictParams.getFeaturesDirectory() ); while(dataSetIterator.hasNext()) { DataSet data = dataSetIterator.next(); <START> model.output(data.getFeatures()); <END> } model.output(dataSetIterator); log.info("model.predict_on_batch() operation complete."); } catch (Throwable e) { log.error("Error while performing model.predict_on_batch()", e); throw e; } }</code><technical_language>results saved anywhere</technical_language>

Target:
public double[][] sequentialPredictOnBatch(PredictOnBatchParams predictParams) throws Exception { try { MultiLayerNetwork model = predictParams.getSequentialModel(); INDArray input = NDArrayHelper.fromFlattened(predictParams.getData()); INDArray ret = model.output(input); log.info("model.predict_on_batch() operation complete."); return NDArrayHelper.toFlattened(ret); } catch (Throwable e) { log.error("Error while performing model.predict_on_batch()", e); throw e; } }
Source:
<code>protected ModelAndView getRadiologyOrderFormWithNewRadiologyOrder() { ModelAndView modelAndView = new ModelAndView("module/radiology/radiologyOrderForm"); if (Context.isAuthenticated()) { RadiologyOrder radiologyOrder = new RadiologyOrder(); radiologyOrder.setStudy(new Study()); modelAndView.addObject("order", new Order()); modelAndView.addObject("isOrderActive", true); modelAndView.addObject("radiologyReport", null); modelAndView.addObject("radiologyOrder", radiologyOrder); <START> modelAndView.addObject("hasCompletedPerformedStatus", false); <END> modelAndView.addObject("reportNeedsToBeCreated", false); } return modelAndView; }</code><technical_language>get radiologyOrder itself</technical_language>

Target:
protected ModelAndView getRadiologyOrderFormWithNewRadiologyOrder() { ModelAndView modelAndView = new ModelAndView("module/radiology/radiologyOrderForm"); if (Context.isAuthenticated()) { RadiologyOrder radiologyOrder = new RadiologyOrder(); radiologyOrder.setStudy(new Study()); modelAndView.addObject("order", new Order()); modelAndView.addObject("isOrderActive", true); modelAndView.addObject("radiologyReport", null); modelAndView.addObject("radiologyOrder", radiologyOrder); } return modelAndView; }
Source:
<code>void handleMemoryPool(String memoryPool, long before, long after) { <START> AtomicLong last = getOrCreate(lastMemoryUsage, memoryPool); <END> long diff1 = before - last.getAndSet(after); long diff2 = after - before; if (diff1 < 0) { diff1 = 0; } if (diff2 < 0) { diff2 = 0; } long increase = diff1 + diff2; if (increase > 0) { AtomicLong bytesAllocated = getOrCreate(bytesAllocatedMap, memoryPool); bytesAllocated.getAndAdd(increase); } }</code><technical_language>is this logic doing</technical_language>

Target:
void handleMemoryPool(String memoryPool, long before, long after) { long last = getAndSet(lastMemoryUsage, memoryPool, after); long diff1 = before - last; long diff2 = after - before; if (diff1 < 0) { diff1 = 0; } if (diff2 < 0) { diff2 = 0; } long increase = diff1 + diff2; if (increase > 0) { counter.labels(memoryPool).inc(increase); } }
Source:
<code>public void setAzureCloudIdentityMapping(String stackCrn, Map<String, String> azureUserMapping, Map<String, String> azureGroupMapping) throws ApiException { ApiClient client = clouderaManagerProxiedClientFactory.getProxiedClouderaManagerClient(stackCrn); String clusterName = getClusterName(client); String rangerUserSyncRoleName = getRangerUserSyncRoleName(client, clusterName); RolesResourceApi rolesResourceApi = clouderaManagerApiFactory.getRolesResourceApi(client); <START> if (!supportsCloudIdMapping(rolesResourceApi, clusterName, rangerUserSyncRoleName)) { LOGGER.info("This version of CM does not support cloud identity mapping. Skipping."); return; } ApiConfigList configList = new ApiConfigList(); configList.addItemsItem(newCloudIdentityConfig(AZURE_USER_MAPPING, azureUserMapping)); configList.addItemsItem(newCloudIdentityConfig(AZURE_GROUP_MAPPING, azureGroupMapping)); rolesResourceApi.updateRoleConfig(clusterName, rangerUserSyncRoleName, RANGER_SERVICE_NAME, "Updating Azure Cloud Identity Mapping through Cloudbreak", configList); triggerRoleRefresh(client, clusterName, RANGER_SERVICE_NAME, rangerUserSyncRoleName); <END> }</code><technical_language>please in middle of method return</technical_language>

Target:
public void setAzureCloudIdentityMapping(String stackCrn, Map<String, String> azureUserMapping, Map<String, String> azureGroupMapping) throws ApiException { ApiClient client = clouderaManagerProxiedClientFactory.getProxiedClouderaManagerClient(stackCrn); String clusterName = getClusterName(client); String rangerUserSyncRoleName = getRangerUserSyncRoleName(client, clusterName); RolesResourceApi rolesResourceApi = clouderaManagerApiFactory.getRolesResourceApi(client); if (!isCloudIdMappingSupported(rolesResourceApi, clusterName, rangerUserSyncRoleName)) { LOGGER.info("This version of CM does not support cloud identity mapping. Skipping."); } else { ApiConfigList configList = new ApiConfigList(); configList.addItemsItem(newCloudIdentityConfig(AZURE_USER_MAPPING, azureUserMapping)); configList.addItemsItem(newCloudIdentityConfig(AZURE_GROUP_MAPPING, azureGroupMapping)); rolesResourceApi.updateRoleConfig(clusterName, rangerUserSyncRoleName, RANGER_SERVICE_NAME, "Updating Azure Cloud Identity Mapping through Cloudbreak", configList); triggerRoleRefresh(client, clusterName, RANGER_SERVICE_NAME, rangerUserSyncRoleName); } }
Source:
<code>public void getReserveTransactionsShouldReturnTheRequest() throws Exception { final AtomicReference<Request> bodyRef = new AtomicReference<>(); <START> final CountDownLatch latch = new CountDownLatch(1); <END> final RestAdapter adapter = new RestAdapter.Builder().setEndpoint(MOCK_URL).setClient(new Client() { @Override public Response execute(Request request) throws IOException { bodyRef.set(request); latch.countDown(); return null; } }).build(); final ReserveService reserveService = adapter.create(ReserveService.class); reserveService.getReserveTransactions("foobar", new RetrofitPromise<List<Transaction>>()); latch.await(); Assert.assertEquals(bodyRef.get().getMethod(), "GET"); Assert.assertEquals(bodyRef.get().getUrl(), String.format("%s/v0/reserve/transactions", MOCK_URL)); Assert.assertTrue(bodyRef.get().getHeaders().contains(new Header("Range", "foobar"))); }</code><technical_language>get rid of CountDownLatch here</technical_language>

Target:
public void getReserveTransactionsShouldReturnTheRequest() throws Exception { final MockRestAdapter<List<Transaction>> adapter = new MockRestAdapter<>(null, null, null); adapter.request(new RepromiseFunction<BitreserveRestAdapter, List<Transaction>>() { @Override public Promise<List<Transaction>> call(BitreserveRestAdapter bitreserveRestAdapter) { ReserveService reserveService = adapter.getRestAdapter().create(ReserveService.class); RetrofitPromise<List<Transaction>> promise = new RetrofitPromise<>(); reserveService.getReserveTransactions("foobar", promise); return promise; } }); Request request = adapter.getRequest(); Assert.assertEquals(request.getMethod(), "GET"); Assert.assertEquals(request.getUrl(), "<LINK_0>"); Assert.assertTrue(request.getHeaders().contains(new Header("Range", "foobar"))); }
Source:
<code>private void processSingleMailboxEntry(Collection<ProtectedMailboxStorageEntry> protectedMailboxStorageEntries) { var decryptedEntries = new ArrayList<>(getDecryptedEntries(protectedMailboxStorageEntries)); <START> checkArgument(decryptedEntries.size() == 1); <END> storeMailboxDataAndNotifyListeners(decryptedEntries.get(0)); }</code><technical_language>a guarantee this 1 here. If message inprotectedMailboxStorageEntries is for us, this fail. intention is here. do checkArgument(protectedMailboxStorageEntries.size() == 1); decryptedEntries.foreach(this::storeMailboxDataAndNotifyListeners);</technical_language>

Target:
private void processSingleMailboxEntry(Collection<ProtectedMailboxStorageEntry> protectedMailboxStorageEntries) { checkArgument(protectedMailboxStorageEntries.size() == 1); var decryptedEntries = new ArrayList<>(getDecryptedEntries(protectedMailboxStorageEntries)); if (decryptedEntries.size() == 1) { storeMailboxDataAndNotifyListeners(decryptedEntries.get(0)); } }
Source:
<code>public void run() { while ( ! stop ) { while ( transferQueue.isEmpty() && ! stop ) { LockSupport.park( consumerBlocker ); } if ( ! transferQueue.isEmpty() ) { <START> List<Changeset> changesets = new ArrayList<>(); <END> transferQueue.drainTo( changesets ); ChangesetList changesetList = new ChangesetList( changesets ); try { LuceneBackendQueueTask luceneBackendQueueTask = new LuceneBackendQueueTask( changesetList.getWork(), resources, null ); luceneBackendQueueTask.run(); } finally { changesetList.markProcessed(); } } } log.stoppingSyncConsumerThread( indexName ); }</code><technical_language>ArrayList size hint is troublesome, if need do "add" operations in a loop. guessing right size require a lock transferQueue, nice either. tempted a custom list de-reference atomically, a LinkedList do trick</technical_language>

Target:
public void run() { while ( ! stop ) { while ( transferQueue.isEmpty() && ! stop ) { LockSupport.park(); } if ( ! transferQueue.isEmpty() ) { List<Changeset> changesets = new LinkedList<>(); transferQueue.drainTo( changesets ); ChangesetList changesetList = new ChangesetList( changesets ); try { LuceneBackendQueueTask luceneBackendQueueTask = new LuceneBackendQueueTask( changesetList.getWork(), resources, null ); luceneBackendQueueTask.run(); } finally { changesetList.markProcessed(); } } } log.stoppingSyncConsumerThread( indexName ); }
Source:
<code>public URI getUri() { return URI.create(String.format(endpointFormat, LOCALHOST, <START> s3Proxy.getPort())); <END> }</code><technical_language>This is wrong for HTTPS. S3Proxy a getPort getSecurePort accessor. create this URI s3Proxy.build()</technical_language>

Target:
public URI getUri() { return endpointUri; }