auphong2707/dl4se-code-review-dataset huggingface dataset:
Source:
<code>public Observable<DataPoint<RatioMap>> findAvailabilityRatioMap( String tenantId, List<String> metrics, long start, long end, int limit, Order order) { checkArgument(isValidTimeRange(start, end), "Invalid time range"); Observable<DataPoint<RatioMap>> result = Observable.from(metrics) .map(id -> new MetricId<>(tenantId, MetricType.AVAILABILITY, id)) .flatMap(this::findMetric) .map(metric -> findDataPoints(metric.getMetricId(), start, end, limit, order)) .compose(o -> buildRatioMapSeries(o, order, AvailabilityType::getText)); if (limit > 0) { <START> result = result.limit(limit); <END> } return result; }</code><technical_language>take(limit) is default in RxJava, limit is alias (but in ReactiveX world, normal term is take, lets that)</technical_language>

Target:
public Observable<DataPoint<RatioMap>> findAvailabilityRatioMap( String tenantId, List<String> metrics, long start, long end, int limit, Order order) { checkArgument(isValidTimeRange(start, end), "Invalid time range"); Observable<DataPoint<RatioMap>> result = Observable.from(metrics) .map(id -> new MetricId<>(tenantId, MetricType.AVAILABILITY, id)) .flatMap(this::findMetric) .map(metric -> findDataPoints(metric.getMetricId(), start, end, limit, order)) .compose(o -> buildRatioMapSeries(o, order, AvailabilityType::getText)); if (limit > 0) { result = result.take(limit); } return result; }
Source:
<code><START> public T remove(String key) { <END> validate(); if (!containsKey(key)) return null; LinkedList<T> entities = litems.get(key); if (entities != null && entities.size() > 1) { throw new SplunkException(SplunkException.AMBIGUOUS, "Key has multiple values, specify a namespace"); } if (entities == null) return null; T entity = entities.get(0); entity.remove(); litems.remove(key); invalidate(); return entity; }</code><technical_language>methods ResourceCollection</technical_language>

Target:
public T remove(String key) { validate(); if (!containsKey(key)) return null; LinkedList<T> entities = linkedListItems.get(key); if (entities != null && entities.size() > 1) { throw new SplunkException(SplunkException.AMBIGUOUS, "Key has multiple values, specify a namespace"); } if (entities == null) return null; T entity = entities.get(0); entity.remove(); invalidate(); return entity; }
Source:
<code>public void select(Map<String, String> idsAndLabels) { LOG.info("Selecting terms with ids and labels in Select2 with id {}...", idsAndLabels, id); for (Map.Entry<String, String> entry : idsAndLabels.entrySet()) { if (entry.getKey().isEmpty() || entry.getValue().isEmpty()) continue; LOG.debug("Click select."); WebElement select2Option = driver.findElement(selectedOptionSelector); select2Option.click(); LOG.debug("Wait for text input box..."); WebElement select2InputText = driver.findElement(By .cssSelector(multi ? "#s2id_" + id + " input" : "#select2-drop input")); LOG.debug("Empty text input box.."); select2InputText.clear(); LOG.debug("Text input box empty. Entering term..."); select2InputText.sendKeys(entry.getKey()); try { LOG.debug("Waiting for match.."); WebElement match = driver.findElement(By .xpath(" + entry.getKey() + "']| + entry.getKey() + "']")); LOG.debug("Click match.."); match.click(); } catch (Exception ex) { LOG.warn("Element was stale when clicking"); <START> } <END> LOG.debug("Waiting for selection to appear in the list of search choices..."); tenSecondWait.until(textToBePresentInElementLocated( multi ? By.xpath(" LOG.debug("Selected '{}'.", entry); } LOG.debug("Selected terms with ids and labels {}. Selected labels are: {}.", idsAndLabels, getSelectedLabels()); }</code><technical_language>is for test continue this exception</technical_language>

Target:
public void select(Map<String, String> idsAndLabels) { LOG.info("Selecting terms with ids and labels in Select2 with id {}...", idsAndLabels, id); for (Map.Entry<String, String> entry : idsAndLabels.entrySet()) { if (entry.getKey().isEmpty() || entry.getValue().isEmpty()) continue; LOG.debug("Click select."); WebElement select2Option = driver.findElement(selectedOptionSelector); select2Option.click(); LOG.debug("Wait for text input box..."); WebElement select2InputText = driver.findElement(By .cssSelector(multi ? "#s2id_" + id + " input" : "#select2-drop input")); LOG.debug("Empty text input box.."); select2InputText.clear(); LOG.debug("Text input box empty. Entering term..."); select2InputText.sendKeys(entry.getKey()); LOG.debug("Waiting for match.."); WebElement match = driver.findElement(By .xpath(" + entry.getKey() + "']| + entry.getKey() + "']")); LOG.debug("Click match.."); match.click(); LOG.debug("Waiting for selection to appear in the list of search choices..."); tenSecondWait.until(textToBePresentInElementLocated( multi ? By.xpath(" LOG.debug("Selected '{}'.", entry); } LOG.debug("Selected terms with ids and labels {}. Selected labels are: {}.", idsAndLabels, getSelectedLabels()); }
Source:
<code>public void cleanRemotelyLoadedFiles(String disconnectedUserMac){ <START> Set<PlaylistEntry> toRemoveForRemoteLoad = new HashSet<PlaylistEntry>(); <END> for(PlaylistEntry entry : remotelyLoaded) { synchronized(entryMutex){ if(!entry.isLoaded() && entry.getMacAddress().equals(disconnectedUserMac)){ toRemoveForRemoteLoad.add(entry); } } } remotelyLoaded.removeAll(toRemoveForRemoteLoad); Set<PlaylistEntry> toRemoveForToLoad = new HashSet<PlaylistEntry>(); for (PlaylistEntry entry : toLoadQueue) { synchronized(entryMutex) { if (entry.getMacAddress().equals(disconnectedUserMac)) { entry.setLoaded(false); toRemoveForToLoad.add(entry); } } } toLoadQueue.removeAll(toRemoveForToLoad); }</code><technical_language>I understand this name means. I feel for fit</technical_language>

Target:
public void cleanRemotelyLoadedFiles(String disconnectedUserMac){ Set<PlaylistEntry> toRemove = new HashSet<PlaylistEntry>(); for(PlaylistEntry entry : remotelyLoaded) { synchronized(entryMutex){ if(!entry.isLoaded() && entry.getMacAddress().equals(disconnectedUserMac)){ toRemove.add(entry); } } } remotelyLoaded.removeAll(toRemove); toRemove = new HashSet<PlaylistEntry>(); for (PlaylistEntry entry : toLoadQueue) { synchronized(entryMutex) { if (entry.getMacAddress().equals(disconnectedUserMac)) { entry.setLoaded(false); toRemove.add(entry); } } } toLoadQueue.removeAll(toRemove); }
Source:
<code>public void testDisallowed() { assertThatThrownBy(() -> dao.disallowed("43")) .isInstanceOf(UnableToCreateStatementException.class) .hasMessageContaining("named parameter"); <START> } <END></code><technical_language>set true explicitly handle instance prove annotation overrides</technical_language>

Target:
public void testDisallowed() { dao.getHandle().getConfig(SqlStatements.class).setUnusedBindingAllowed(true); assertThatThrownBy(() -> dao.disallowed("43")) .isInstanceOf(UnableToCreateStatementException.class) .hasMessageContaining("named parameter"); }
Source:
<code>public Plan optimize(final Map<String, List<EvaluatorParameters>> evalParamsMap, final int availableEvaluators) { if (callsSkipped < callsToSkip) { callsSkipped++; return PlanImpl.newBuilder().build(); } if (callsMade == maxCallsToMake || evalParamsMap.isEmpty()) { return PlanImpl.newBuilder().build(); } final String evaluatorToAdd = "new-" + callsMade; callsMade++; final PlanImpl.Builder planBuilder = PlanImpl.newBuilder(); for (final String namespace : evalParamsMap.keySet()) { planBuilder.addEvaluatorToAdd(namespace, evaluatorToAdd); EvaluatorParameters srcEvaluator = null; for (final EvaluatorParameters evaluator : evalParamsMap.get(namespace)) { <START> if (evaluator.getDataInfo().getNumBlocks() != 0) { <END> srcEvaluator = evaluator; break; } } if (srcEvaluator == null) { LOG.log(Level.WARNING, "Cannot choose source evaluator to move its data to new evaluator in {0}", namespace); continue; } final DataInfo srcDataInfo = srcEvaluator.getDataInfo(); final int numBlocksToMove = srcDataInfo.getNumBlocks() / 2; final TransferStep transferStep = new TransferStepImpl( srcEvaluator.getId(), evaluatorToAdd, new DataInfoImpl(numBlocksToMove)); planBuilder.addTransferStep(namespace, transferStep); } return planBuilder.build(); }</code><technical_language>0 better</technical_language>

Target:
public Plan optimize(final Map<String, List<EvaluatorParameters>> evalParamsMap, final int availableEvaluators) { if (callsSkipped < callsToSkip) { callsSkipped++; return PlanImpl.newBuilder().build(); } if (callsMade == maxCallsToMake || evalParamsMap.isEmpty()) { return PlanImpl.newBuilder().build(); } final String evaluatorToAdd = "new-" + callsMade; callsMade++; final PlanImpl.Builder planBuilder = PlanImpl.newBuilder(); for (final String namespace : evalParamsMap.keySet()) { planBuilder.addEvaluatorToAdd(namespace, evaluatorToAdd); EvaluatorParameters srcEvaluator = null; for (final EvaluatorParameters evaluator : evalParamsMap.get(namespace)) { if (evaluator.getDataInfo().getNumBlocks() > 0) { srcEvaluator = evaluator; break; } } if (srcEvaluator == null) { LOG.log(Level.WARNING, "Cannot choose source evaluator to move its data to new evaluator in {0}", namespace); continue; } final DataInfo srcDataInfo = srcEvaluator.getDataInfo(); final int numBlocksToMove = srcDataInfo.getNumBlocks() / 2; final TransferStep transferStep = new TransferStepImpl( srcEvaluator.getId(), evaluatorToAdd, new DataInfoImpl(numBlocksToMove)); planBuilder.addTransferStep(namespace, transferStep); } return planBuilder.build(); }
Source:
<code>private void parseTree(List<Block> sourceBlocks) { Block matchStartBlock = null; int count = 0; Block mappingCursor = this.mappingTree.getChildren().get(0); Block sourceBlock = sourceBlocks.get(0); while (sourceBlock != null) { while (mappingCursor != null) { if (blockEquals(sourceBlock, mappingCursor)) { if (matchStartBlock == null) { matchStartBlock = sourceBlock; } count++; mappingCursor = mappingCursor.getChildren().get(0); if (mappingCursor instanceof ImageBlock) { for (int i = 0; i < count - 1; i++) { matchStartBlock.getParent().removeBlock(matchStartBlock.getNextSibling()); } sourceBlock = mappingCursor.clone(); matchStartBlock.getParent().replaceChild(sourceBlock, matchStartBlock); mappingCursor = null; matchStartBlock = null; count = 0; } else { break; } } else { mappingCursor = mappingCursor.getNextSibling(); } } List<Block> filteredSourceBlocks = this.filter.filter(sourceBlock.getChildren()); <START> if (!filteredSourceBlocks.size().isEmpty()) { <END> parseTree(filteredSourceBlocks); } else if (mappingCursor == null) { mappingCursor = this.mappingTree.getChildren().get(0); count = 0; matchStartBlock = null; } sourceBlock = this.filter.getNextSibling(sourceBlock); } }</code><technical_language>Please build committing</technical_language>

Target:
private void parseTree(List<Block> sourceBlocks) { Block matchStartBlock = null; int count = 0; Block mappingCursor = this.mappingTree.getChildren().get(0); Block sourceBlock = sourceBlocks.get(0); while (sourceBlock != null) { while (mappingCursor != null) { if (blockEquals(sourceBlock, mappingCursor)) { if (matchStartBlock == null) { matchStartBlock = sourceBlock; } count++; mappingCursor = mappingCursor.getChildren().get(0); if (mappingCursor instanceof ImageBlock) { for (int i = 0; i < count - 1; i++) { matchStartBlock.getParent().removeBlock(matchStartBlock.getNextSibling()); } sourceBlock = mappingCursor.clone(); matchStartBlock.getParent().replaceChild(sourceBlock, matchStartBlock); mappingCursor = null; matchStartBlock = null; count = 0; } else { break; } } else { mappingCursor = mappingCursor.getNextSibling(); } } List<Block> filteredSourceBlocks = this.filter.filter(sourceBlock.getChildren()); if (filteredSourceBlocks.size() > 0) { parseTree(filteredSourceBlocks); } else if (mappingCursor == null) { mappingCursor = this.mappingTree.getChildren().get(0); count = 0; matchStartBlock = null; } sourceBlock = this.filter.getNextSibling(sourceBlock); } }
Source:
<code>public void onEvictNotice(EvictNotice notice) { <START> System.out.println("Evict Notice: " + notice.toJson()); <END> Object key; try { key = gson.fromJson(notice.keyJson, Class.forName(notice.keyClass)); } catch (JsonSyntaxException e) { log.error("Invalid json syntax for key", e); return; } catch (ClassNotFoundException e) { log.error("Could not find key class", e); return; } cacheManager.invalidate(notice.pluginName, notice.cacheName, key); }</code><technical_language>eliminate printlns left</technical_language>

Target:
public void onEvictNotice(EvictNotice notice) { Object key; try { key = gson.fromJson(notice.keyJson, Class.forName(notice.keyClass)); } catch (JsonSyntaxException e) { log.error("Invalid json syntax for key", e); return; } catch (ClassNotFoundException e) { log.error("Could not find key class", e); return; } cacheManager.invalidate(notice.pluginName, notice.cacheName, key); }
Source:
<code>public static String constructHadoopTags(Props props, String[] keys) { String[] keysAndValues = new String[keys.length + 1]; for (int i = 0; i < keys.length; i++) { if (props.containsKey(keys[i])) { keysAndValues[i] = keys[i] + ":" + props.get(keys[i]); } } if (props.containsKey(CommonJobProperties.PROJECT_NAME) && props.containsKey(CommonJobProperties.FLOW_ID)) { String constructedTag = "workflowid:" + props.get(CommonJobProperties.PROJECT_NAME) + HadoopConfigurationInjector.WORKFLOW_ID_SEPERATOR + props.get(CommonJobProperties.FLOW_ID); constructedTag = constructedTag.substring(0, Math.min(constructedTag.length(), APPLICATION_TAG_MAX_LENGTH)); <START> keysAndValues[keys.length] = constructedTag; <END> } Joiner joiner = Joiner.on(',').skipNulls(); return joiner.join(keysAndValues); }</code><technical_language>matter PROJECT_NAME FLOW_ID included in output, individually, keys passed always: CommonJobProperties.EXEC_ID, CommonJobProperties.FLOW_ID, CommonJobProperties.PROJECT_NAME Do repeat this info more time a combined tag</technical_language>

Target:
public static String constructHadoopTags(Props props, String[] keys) { String[] keysAndValues = new String[keys.length]; for (int i = 0; i < keys.length; i++) { if (props.containsKey(keys[i])) { String tag = keys[i] + ":" + props.get(keys[i]); keysAndValues[i] = tag.substring(0, Math.min(tag.length(), HadoopJobUtils.APPLICATION_TAG_MAX_LENGTH)); } } Joiner joiner = Joiner.on(',').skipNulls(); return joiner.join(keysAndValues); }
Source:
<code><START> public void reportLookingSid(long sid) { <END> if (minTimeToWaitForEpoch < 0 || timeStartWaitForEpoch < 0 || !waitingForNewEpoch) { return; } if (voteSet == null || !voteSet.hasSid(sid)) { return; } if (Time.currentElapsedTime() - timeStartWaitForEpoch > minTimeToWaitForEpoch) { quitLeading(); } }</code><technical_language>i this warning. is expected</technical_language>

Target:
public void reportLookingSid(long sid) { if (maxTimeToWaitForEpoch < 0 || timeStartWaitForEpoch < 0 || !waitingForNewEpoch) { return; } if (voteSet == null || !voteSet.hasSid(sid)) { return; } if (Time.currentElapsedTime() - timeStartWaitForEpoch > maxTimeToWaitForEpoch) { quitLeading(); } }
Source:
<code>public Optional<BreakableData> createFrom(DataHolder dataHolder) { <START> return null; <END> }</code><technical_language>this forgot</technical_language>

Target:
public Optional<BreakableData> createFrom(DataHolder dataHolder) { if (dataHolder instanceof ItemStack) { NBTTagCompound tag = ((ItemStack) dataHolder).getTagCompound(); if (tag == null) { return Optional.<BreakableData>of(new SpongeBreakableData()); } NBTTagList blockIds = tag.getTagList(NbtDataUtil.ITEM_BREAKABLE_BLOCKS, NbtDataUtil.TAG_STRING); if (blockIds.hasNoTags()) { return Optional.<BreakableData>of(new SpongeBreakableData()); } Set<BlockType> blockTypes = Sets.newHashSetWithExpectedSize(blockIds.tagCount()); for (int i = 0; i < blockIds.tagCount(); i++) { Optional<BlockType> blockType = Sponge.getGame().getRegistry() .getType(BlockType.class, blockIds.getStringTagAt(i)); if (blockType.isPresent()) { blockTypes.add(blockType.get()); } } return Optional.<BreakableData>of(new SpongeBreakableData(blockTypes)); } return Optional.empty(); }
Source:
<code>public void visitNode(Tree tree) { SwitchStatementTree switchStatementTree = (SwitchStatementTree) tree; List<CaseGroupTree> caseGroupTrees = switchStatementTree.cases(); CFG cfg = CFG.buildCFG(Collections.singletonList(tree), true); CFG.Block entry = cfg.entry(); List<CFG.Block> cfgCases = new ArrayList<>(entry.successors()); if (!hasDefaultClause(switchStatementTree)) { <START> cfgCases.remove(cfgCases.size() - 1); <END> } List<CFG.Block> cases = Lists.reverse(cfgCases); IntStream.range(1, cases.size()) .filter(i -> cases.get(i).predecessors().stream().anyMatch(predecessor -> !tree.equals(predecessor.terminator()))) .filter(i -> !intentionalFallThrough(caseGroupTrees.get(i - 1), caseGroupTrees.get(i))) .mapToObj(i -> caseGroupTrees.get(i - 1).labels()) .map(caseGroupLabels -> caseGroupLabels.get(caseGroupLabels.size() - 1)) .forEach(label -> reportIssue(label, "End this switch case with an unconditional break, return or throw statement.")); }</code><technical_language>CFG.Block.successors returns a Set<Block> I guarantee order of case blocks</technical_language>

Target:
public void visitNode(Tree tree) { SwitchStatementTree switchStatementTree = (SwitchStatementTree) tree; List<CaseGroupTree> caseGroupTrees = switchStatementTree.cases(); CFG cfg = CFG.buildCFG(Collections.singletonList(tree), true); Set<CFG.Block> switchSuccessors = cfg.entry().successors(); Map<CFG.Block, CaseGroupTree> cfgBlockToCaseGroupMap = createMapping(switchSuccessors, caseGroupTrees); switchSuccessors.stream() .filter(cfgBlockToCaseGroupMap.keySet()::contains) .flatMap(cfgBlock -> getForbiddenCaseGroupPredecessors(cfgBlock, cfgBlockToCaseGroupMap)) .map(CaseGroupTree::labels) .map(caseGroupLabels -> caseGroupLabels.get(caseGroupLabels.size() - 1)) .forEach(label -> reportIssue(label, "End this switch case with an unconditional break, return or throw statement.")); }
Source:
<code>public String read() throws IOException { byte[] bytes = null; if (getPath() != null) { StorageReader storageReader = getStorage().getStorageReader(getPath()); bytes = storageReader.read(); } else { StorageReader storageReader = getStorage().getStorageReader(getInputSplit()); <START> if (skipFirst && getInputSplit().getStart() > 0) { <END> byte[] skipBytes = storageReader.read(); if (log.isDebugEnabled()) { log.info("skipping first entry: " + new String(skipBytes)); } skipFirst = false; } bytes = storageReader.read(); } return bytes != null && bytes.length > 0 ? new String(bytes) : null; }</code><technical_language>if concurrent read calls to-be-expected, if so, 'skipFirst' AtomicBoolean compareAndSet()</technical_language>

Target:
public String read() throws IOException { byte[] bytes = null; if (getPath() != null) { StorageReader storageReader = getStorage().getStorageReader(getPath()); bytes = storageReader.read(); } else { StorageReader storageReader = getStorage().getStorageReader(getInputSplit()); if (skipFirst.compareAndSet(true, false) && getInputSplit().getStart() > 0) { byte[] skipBytes = storageReader.read(); if (log.isDebugEnabled()) { log.info("skipping first entry: " + new String(skipBytes)); } } bytes = storageReader.read(); } return bytes != null && bytes.length > 0 ? new String(bytes) : null; }
Source:
<code>private FeatureType buildFeatureType( FeatureTypeInfo info, boolean handleProjectionPolicy, FeatureType ft) throws IOException { if (ft instanceof SimpleFeatureType) { SimpleFeatureType sft = (SimpleFeatureType) ft; SimpleFeatureTypeBuilder tb = new SimpleFeatureTypeBuilder(); tb.setName(info.getName()); tb.setNamespaceURI(info.getNamespace().getURI()); <START> if (ft.getGeometryDescriptor() != null) { <END> tb.setDefaultGeometry(ft.getGeometryDescriptor().getLocalName()); } if (info.getAttributes() == null || info.getAttributes().isEmpty()) { for (PropertyDescriptor pd : ft.getDescriptors()) { if (!(pd instanceof AttributeDescriptor)) { continue; } AttributeDescriptor ad = (AttributeDescriptor) pd; if (handleProjectionPolicy) { ad = handleDescriptor(ad, info); } tb.add(ad); } } else { for (AttributeTypeInfo att : info.getAttributes()) { String attName = att.getName(); PropertyDescriptor pd = ft.getDescriptor(attName); if (pd == null || !(pd instanceof AttributeDescriptor)) { throw new IOException( "the SimpleFeatureType " + info.getPrefixedName() + " does not contains the configured attribute " + attName + ". Check your schema configuration"); } AttributeDescriptor ad = (AttributeDescriptor) pd; ad = handleDescriptor(ad, info); tb.add(ad); } } ft = tb.buildFeatureType(); } return ft; }</code><technical_language>is a [SimpleFeatureTypeBuilder.init( SimpleFeatureType )](<LINK_0> intended duplicating modifying a feature type, avoid kind of problems. I more comfortable this method code is protected changes GeoTools side (such needed copy user data something)</technical_language>

Target:
private FeatureType buildFeatureType( FeatureTypeInfo info, boolean handleProjectionPolicy, FeatureType ft) throws IOException { if (ft instanceof SimpleFeatureType) { SimpleFeatureType sft = (SimpleFeatureType) ft; SimpleFeatureTypeBuilder tb = new SimpleFeatureTypeBuilder(); tb.init(sft); tb.setName(info.getName()); tb.setNamespaceURI(info.getNamespace().getURI()); tb.setAttributes((AttributeDescriptor[]) null); if (info.getAttributes() == null || info.getAttributes().isEmpty()) { for (PropertyDescriptor pd : ft.getDescriptors()) { if (!(pd instanceof AttributeDescriptor)) { continue; } AttributeDescriptor ad = (AttributeDescriptor) pd; if (handleProjectionPolicy) { ad = handleDescriptor(ad, info); } tb.add(ad); } } else { for (AttributeTypeInfo att : info.getAttributes()) { String attName = att.getName(); PropertyDescriptor pd = ft.getDescriptor(attName); if (pd == null || !(pd instanceof AttributeDescriptor)) { throw new IOException( "the SimpleFeatureType " + info.getPrefixedName() + " does not contains the configured attribute " + attName + ". Check your schema configuration"); } AttributeDescriptor ad = (AttributeDescriptor) pd; ad = handleDescriptor(ad, info); tb.add(ad); } } ft = tb.buildFeatureType(); } return ft; }
Source:
<code>public void before() { <START> CONF.put("aws.region", "us-east-1"); <END> mUdbConfiguration = new UdbConfiguration(CONF); mUdbContext = new UdbContext(null, null, "glue", "null", DB_NAME, DB_NAME); }</code><technical_language>create a local map pass UdbConfiguration(conf) next line</technical_language>

Target:
public void before() { Map<String, String> conf = ImmutableMap.of("aws.region", "us-east-1"); mUdbConfiguration = new UdbConfiguration(conf); mUdbContext = new UdbContext(null, null, "glue", "null", DB_NAME, DB_NAME); }
Source:
<code>private void connectionNotEstablishedSend(final ByteBuffer buffer) { LOG.error("Trying to wait on {}. It has not connected yet.", this.getClass().getSimpleName()); if (!queing) { queing = true; failedStarts += 1; LOG.error("attempt out of {}", failedStarts, MAX_FAILED_STARTS); final Thread retryThread = new Thread() { @Override @SuppressWarnings("PMD.CommentRequired") public void run() { try { Thread.sleep(MIN_SLEEP_TIME); queing = false; send(buffer); } catch (InterruptedException e) { LOG.info(LoggingConstants.EXCEPTION_MESSAGE, e); } catch (ConnectionException e) { LOG.info(LoggingConstants.EXCEPTION_MESSAGE, e); } } }; retryThread.start(); } else { <START> LOG.error("Adding a queuedMessage"); <END> queuedMessages.add(buffer); } }</code><technical_language>change info add another log message added LOG.info("queuedMessage size is now: {}", queuedMessages.size());</technical_language>

Target:
private void connectionNotEstablishedSend(final ByteBuffer buffer) { LOG.error("Trying to wait on {}. It has not connected yet.", this.getClass().getSimpleName()); if (!queing) { queing = true; failedStarts += 1; LOG.error("attempt out of {}", failedStarts, MAX_FAILED_STARTS); final Thread retryThread = new Thread() { @Override @SuppressWarnings("PMD.CommentRequired") public void run() { try { Thread.sleep(MIN_SLEEP_TIME); queing = false; send(buffer); } catch (InterruptedException e) { LOG.error(LoggingConstants.EXCEPTION_MESSAGE, e); } catch (ConnectionException e) { LOG.error(LoggingConstants.EXCEPTION_MESSAGE, e); } } }; retryThread.start(); } else { LOG.info("Adding a queuedMessage"); queuedMessages.add(buffer); LOG.info("queuedMessage size is now: {}", queuedMessages.size()); } }
Source:
<code>private <T extends Serializable> T readFromMetastorage(String key) { metaLock.readLock().lock(); try { if (metastorage == null) return null; try { return metastorage.read(key); } <START> catch (IgniteCheckedException e) { <END> log.error("Error read from metastore.", e); return null; } } finally { metaLock.readLock().unlock(); } }</code><technical_language>means data files corrupted. Failure process invoked in case. I done automatically if pass exception next level (but sure)</technical_language>

Target:
private <T extends Serializable> T readFromMetastorage(String key) { if (roMetastorage == null) return null; try { return roMetastorage.read(key); } catch (IgniteCheckedException e) { throw new IgniteException(e); } }
Source:
<code>private void handleStartProvisioningIfNeeded(int type, boolean showProvisioningUi) { if (!isValidDownstreamType(type)) return; if (!mCurrentTethers.contains(type)) mCurrentTethers.add(type); <START> mCallback.onMaybeStartProvisioning(); <END> if (isTetherProvisioningRequired()) { if (mCellularPermitted.size() == 0) { mCellularUpstreamPermitted = false; } if (mUsingCellularAsUpstream) { if (showProvisioningUi) { runUiTetherProvisioning(type); } else { runSilentTetherProvisioning(type); } mNeedReRunProvisioningUi = false; } else { mNeedReRunProvisioningUi |= showProvisioningUi; } } else { mCellularUpstreamPermitted = true; } }</code><technical_language>See, problem is apparent : calling this in cases needed. I suggest this called onStartProvisioning (or onBeforeProvisioning in this case maybe, done provisioning starts ?) called provisioning is started, time this function is called</technical_language>

Target:
private void handleStartProvisioningIfNeeded(int type, boolean showProvisioningUi) { if (!isValidDownstreamType(type)) return; if (!mCurrentTethers.contains(type)) mCurrentTethers.add(type); mCallback.onBeforeProvisioning(); if (isTetherProvisioningRequired()) { if (mCellularPermitted.size() == 0) { mCellularUpstreamPermitted = false; } if (mUsingCellularAsUpstream) { if (showProvisioningUi) { runUiTetherProvisioning(type); } else { runSilentTetherProvisioning(type); } mNeedReRunProvisioningUi = false; } else { mNeedReRunProvisioningUi |= showProvisioningUi; } } else { mCellularUpstreamPermitted = true; } }
Source:
<code>public void g_V_out_in_valuesXnameX_fold_dedupXlocalX_unfold() { final Traversal<Vertex, String> traversal = get_g_V_out_in_valuesXnameX_fold_dedupXlocalX_unfold(); final List<String> names = traversal.toList(); assertEquals(3, names.size()); <START> assertThat(names, containsInAnyOrder("marko", "josh", "peter")); <END> }</code><technical_language>Note checkResults()... e.g. @Test @LoadGraphWith(MODERN) public void g_V_whereXnotXoutXcreatedXXX_name() { final Traversal<Vertex, String> traversal = get_g_V_whereXnotXoutXcreatedXXX_name(); printTraversalForm(traversal); checkResults(Arrays.asList("vadas", "lop", "ripple"), traversal); }</technical_language>

Target:
public void g_V_out_in_valuesXnameX_fold_dedupXlocalX_unfold() { final Traversal<Vertex, String> traversal = get_g_V_out_in_valuesXnameX_fold_dedupXlocalX_unfold(); printTraversalForm(traversal); checkResults(Arrays.asList("marko", "josh", "peter"), traversal); }
Source:
<code>public Response getLabel(@QueryParam("target_date_millis") final Long targetDayTimestamp, @QueryParam("timezone_offset_millis") final Integer timeZoneOffset, @Scope({OAuthScope.SLEEP_LABEL_BASIC}) final AccessToken accessToken){ if(targetDayTimestamp == null || timeZoneOffset == null){ return Response.status(Response.Status.BAD_REQUEST).build(); } final DateTimeZone userLocalTimeZone = DateTimeZone.forOffsetMillis(timeZoneOffset); final DateTime userLocalDateTime = new DateTime(targetDayTimestamp, userLocalTimeZone).withTimeAtStartOfDay(); final DateTime roundedUserLocalTimeInUTC = new DateTime(userLocalDateTime.getMillis(), DateTimeZone.UTC); final Optional<SleepLabel> sleepLabelOptional = sleepLabelDAO.getByAccountAndDate( accessToken.accountId, roundedUserLocalTimeInUTC, timeZoneOffset ); if(sleepLabelOptional.isPresent()){ return Response.ok(sleepLabelOptional.get()).build(); }else{ <START> return Response.status(Response.Status.NO_CONTENT).build(); <END> } }</code><technical_language>want return a 404 if found. :thumbsup:</technical_language>

Target:
public Response getLabel(@QueryParam("target_date_millis") final Long targetDayTimestamp, @QueryParam("timezone_offset_millis") final Integer timeZoneOffset, @Scope({OAuthScope.SLEEP_LABEL_BASIC}) final AccessToken accessToken){ if(targetDayTimestamp == null || timeZoneOffset == null){ return Response.status(Response.Status.BAD_REQUEST).build(); } final DateTimeZone userLocalTimeZone = DateTimeZone.forOffsetMillis(timeZoneOffset); final DateTime userLocalDateTime = new DateTime(targetDayTimestamp, userLocalTimeZone).withTimeAtStartOfDay(); final DateTime roundedUserLocalTimeInUTC = new DateTime(userLocalDateTime.getMillis(), DateTimeZone.UTC); final Optional<SleepLabel> sleepLabelOptional = sleepLabelDAO.getByAccountAndDate( accessToken.accountId, roundedUserLocalTimeInUTC, timeZoneOffset ); if(sleepLabelOptional.isPresent()){ return Response.ok(sleepLabelOptional.get()).build(); }else{ return Response.status(Response.Status.NOT_FOUND).build(); } }
Source:
<code><START> public Region(String chromosome, int start) { <END> this.chromosome = chromosome; this.start = start; this.end = Integer.MAX_VALUE; }</code><technical_language>this constructor changed contructor? e.g.: public Region(){ this(null, 1, Integer.MAX_VALUE); }</technical_language>

Target:
public Region(String chromosome, int start) { this(chromosome, start, Integer.MAX_VALUE); }
Source:
<code>public ITransformedNetwork getTransformedApprovedNetworks(List<INetwork> networkList) throws QuadrigaStorageException { <START> ITransformedNetwork networkJSon = null; <END> List<INetworkNodeInfo> networkTopNodesList = new ArrayList<INetworkNodeInfo>(); for(INetwork curnetwork: networkList){ try { List<INetworkNodeInfo> curTopNodesList = networkManager.getNetworkTopNodes(curnetwork.getNetworkId()); networkTopNodesList.addAll(curTopNodesList) ; } catch (QuadrigaStorageException e) { logger.error("DB Error while getting network top nodes", e); return null; } } networkJSon = transformer.transformNetwork(networkTopNodesList); return networkJSon; }</code><technical_language>declare needed</technical_language>

Target:
public ITransformedNetwork getTransformedApprovedNetworks(List<INetwork> networkList) throws QuadrigaStorageException { List<INetworkNodeInfo> networkTopNodesList = new ArrayList<INetworkNodeInfo>(); for(INetwork curnetwork: networkList){ try { List<INetworkNodeInfo> curTopNodesList = networkManager.getNetworkTopNodes(curnetwork.getNetworkId()); networkTopNodesList.addAll(curTopNodesList) ; } catch (QuadrigaStorageException e) { logger.error("DB Error while getting network top nodes", e); throw e; } } return transformer.transformNetwork(networkTopNodesList); }
Source:
<code>public void dropFunction(QualifiedFunctionName functionName, Optional<List<TypeSignature>> parameterTypes, boolean exists) { Optional<FunctionNamespaceManager<?>> functionNamespaceManager = getServingFunctionNamespaceManager(functionName.getFunctionNamespace()); if (!functionNamespaceManager.isPresent()) { <START> throw new PrestoException(GENERIC_USER_ERROR, format("Cannot drop function in function namespace: %s", functionName.getFunctionNamespace())); <END> } functionNamespaceManager.get().dropFunction(functionName, parameterTypes, exists); }</code><technical_language>error message "cannot find function"? reason drop is do a function manager serve function, means function exist. if exists flag is set, this succeed. a FUNCTION_NOT_FOUND</technical_language>

Target:
public void dropFunction(QualifiedFunctionName functionName, Optional<List<TypeSignature>> parameterTypes, boolean exists) { Optional<FunctionNamespaceManager<?>> functionNamespaceManager = getServingFunctionNamespaceManager(functionName.getFunctionNamespace()); if (functionNamespaceManager.isPresent()) { functionNamespaceManager.get().dropFunction(functionName, parameterTypes, exists); } else if (!exists) { throw new PrestoException(FUNCTION_NOT_FOUND, format("Function not found: %s", functionName.getFunctionNamespace())); } }
Source:
<code><START> public ValidationResult nicNameIsSet() { <END> return ValidationResult.failWith(EngineMessage.HOST_NETWORK_INTERFACE_NOT_EXIST) .when(attachment.getNicName() == null); }</code><technical_language>I this method check case 'b' proper method explain problem. other case covered 'nicActuallyExistsOrReferencesNewBond(..)'</technical_language>

Target:
public ValidationResult nicNameIsSet() { return ValidationResult.failWith(EngineMessage.HOST_NETWORK_INTERFACE_DOES_NOT_HAVE_NAME_SET) .when(attachment.getNicName() == null); }
Source:
<code>public void testTaskFailedUpdate() { AnnotationConfigApplicationContext createContext = new AnnotationConfigApplicationContext(); createContext.register(TestDefaultConfiguration.class, PropertyPlaceholderAutoConfiguration.class); createContext.refresh(); final Appender mockAppender = TestVerifierUtils.getMockAppender(); this.listener = createContext.getBean(TaskLifecycleListener.class); listener.onApplicationEvent(new ApplicationFailedEvent(new SpringApplication(), new String[]{}, createContext, new RuntimeException("This was expected"))); TestVerifierUtils.verifyLogEntryExists(mockAppender, "Updating: TaskExecution{executionId='" + listener.getTaskExecution().getExecutionId()); <START> assertEquals("Update should report that exit code is zero", <END> 1, listener.getTaskExecution().getExitCode()); assertTrue("Stack trace missing from exit message", listener.getTaskExecution().getExitMessage().startsWith("java.lang.RuntimeException: This was expected")); }</code><technical_language>read Update report exit code is</technical_language>

Target:
public void testTaskFailedUpdate() { context.refresh(); final Appender mockAppender = TestVerifierUtils.getMockAppender(); this.listener = context.getBean(TaskLifecycleListener.class); listener.onApplicationEvent(new ApplicationFailedEvent(new SpringApplication(), new String[]{}, context, new RuntimeException("This was expected"))); TestVerifierUtils.verifyLogEntryExists(mockAppender, "Updating: TaskExecution{executionId='" + listener.getTaskExecution().getExecutionId()); assertEquals("Update should report that exit code is one", 1, listener.getTaskExecution().getExitCode()); assertTrue("Stack trace missing from exit message", listener.getTaskExecution().getExitMessage().startsWith("java.lang.RuntimeException: This was expected")); }
Source:
<code>public Subsorts(Module module) { sorts = JavaConversions.asJavaCollection(module.definedSorts()).stream() .map(s -> Sort.of(s.name())) .collect(Collectors.toSet()); this.subsort = ArrayTable.create(sorts, sorts); <START> Set<org.kframework.kore.Sort> kSorts = Sets.newHashSet(Sorts.K(), Sorts.KList(), Sorts.KItem(), Sorts.KLabel(), Sorts.KBott(), Sorts.KVariable(), Sorts.KString()); <END> for (org.kframework.kore.Sort sort1 : Collections.iterable(module.definedSorts())) { for (org.kframework.kore.Sort sort2 : Collections.iterable(module.definedSorts())) { subsort.put( Sort.of(sort1.name()), Sort.of(sort2.name()), module.subsorts().$greater(sort1, sort2)); } } }</code><technical_language>is this used</technical_language>

Target:
public Subsorts(Module module) { sorts = JavaConversions.asJavaCollection(module.definedSorts()).stream() .map(s -> Sort.of(s.name())) .collect(Collectors.toSet()); this.subsort = ArrayTable.create(sorts, sorts); for (org.kframework.kore.Sort sort1 : Collections.iterable(module.definedSorts())) { for (org.kframework.kore.Sort sort2 : Collections.iterable(module.definedSorts())) { subsort.put( Sort.of(sort1.name()), Sort.of(sort2.name()), module.subsorts().$greater(sort1, sort2)); } } }
Source:
<code>public void testEntrySetRemove() { Map<Object, String> values = putValuesInCache(); final Cache<Object, Object> cache = cache(0, CACHE_NAME); cache.getAdvancedCache().addInterceptor(new BaseCustomInterceptor() { @Override public Object visitRemoveCommand(InvocationContext ctx, RemoveCommand command) throws Throwable { assertTrue(command.hasAnyFlag(FlagBitSets.SKIP_CACHE_STORE)); return super.visitRemoveCommand(ctx, command); } }, 0); for (Iterator<Map.Entry<Object, Object>> it = cache(0, CACHE_NAME).getAdvancedCache().withFlags( Flag.SKIP_CACHE_STORE).entrySet().iterator(); it.hasNext();) { Map.Entry<Object, Object> entry = it.next(); Object key = entry.getKey(); assertEquals(values.get(key), entry.getValue()); it.remove(); } <START> for (Iterator<Map.Entry<Object, Object>> it = cache(0, CACHE_NAME).getAdvancedCache().withFlags( <END> Flag.SKIP_CACHE_STORE).entrySet().iterator(); it.hasNext();) { Map.Entry<Object, Object> entry = it.next(); log.tracef("%s", entry); } assertEquals(0, cache.size()); }</code><technical_language>debug code. remove</technical_language>

Target:
public void testEntrySetRemove() { Map<Object, String> values = putValuesInCache(); final Cache<Object, Object> cache = cache(0, CACHE_NAME); cache.getAdvancedCache().addInterceptor(new BaseCustomInterceptor() { @Override public Object visitRemoveCommand(InvocationContext ctx, RemoveCommand command) throws Throwable { assertTrue(command.hasAnyFlag(FlagBitSets.SKIP_CACHE_STORE)); return super.visitRemoveCommand(ctx, command); } }, 0); for (Iterator<Map.Entry<Object, Object>> it = cache(0, CACHE_NAME).getAdvancedCache().withFlags( Flag.SKIP_CACHE_STORE).entrySet().iterator(); it.hasNext();) { Map.Entry<Object, Object> entry = it.next(); Object key = entry.getKey(); assertEquals(values.get(key), entry.getValue()); it.remove(); } assertEquals(0, cache.size()); }
Source:
<code>public void testInvertSortKey() { assertEquals("FFFFFFFFFFFFFFFF", ChangeUtil.invertSortKey( "0000000000000000").toUpperCase()); assertEquals("0000000000000001", ChangeUtil.invertSortKey( "FFFFFFFFFFFFFFFE").toUpperCase()); assertEquals("0001600000000000", ChangeUtil.invertSortKey( <START> "FFFE9FFFFFFFFFFF").toUpperCase()); <END> assertEquals("/", ChangeUtil.invertSortKey("z").toUpperCase()); assertEquals("Z", ChangeUtil.invertSortKey("/").toUpperCase()); }</code><technical_language>toUpperCase in test? case for sort keys, case for inverses. Uppercase sorts in a location in a simple binary tree lowercase does</technical_language>

Target:
public void testInvertSortKey() { assertEquals("FFFFFFFFFFFFFFFF", ChangeUtil.invertSortKey( "0000000000000000").toUpperCase()); assertEquals("0000000000000001", ChangeUtil .invertSortKey("FFFFFFFFFFFFFFFE")); assertEquals("0001600000000000", ChangeUtil .invertSortKey("FFFE9FFFFFFFFFFF")); assertEquals("/", ChangeUtil.invertSortKey("z")); assertEquals("Z", ChangeUtil.invertSortKey("/").toUpperCase()); }
Source:
<code>public void testChangeModeToDisabledAndBack() throws Exception { HaMgmtNode n1 = createMaster(Duration.PRACTICALLY_FOREVER); n1.mgmt.getLocationManager().createLocation(LocationSpec.create(LocalhostMachine.class)); @SuppressWarnings("unused") TestApplication app = createFirstAppAndPersist(n1); HaMgmtNode n2 = createHotStandby(Duration.PRACTICALLY_FOREVER); n1.ha.changeMode(HighAvailabilityMode.DISABLED); n2.ha.changeMode(HighAvailabilityMode.AUTO); assertMaster(n2); assertEquals(n1.ha.getNodeState(), ManagementNodeState.FAILED); Assert.assertTrue(n1.mgmt.getApplications().isEmpty(), "n1 should have had no apps; instead had: "+n1.mgmt.getApplications()); Assert.assertTrue(n1.mgmt.getEntityManager().getEntities().isEmpty(), "n1 should have had no entities; instead had: "+n1.mgmt.getEntityManager().getEntities()); Assert.assertTrue(n1.mgmt.getLocationManager().getLocations().isEmpty(), "n1 should have had no locations; instead had: "+n1.mgmt.getLocationManager().getLocations()); n1.ha.changeMode(HighAvailabilityMode.HOT_STANDBY); assertHotStandby(n1); Assert.assertFalse(n1.mgmt.getApplications().isEmpty(), "n1 should have had apps now"); <START> Assert.assertFalse(n1.mgmt.getApplications().isEmpty(), "n1 should have had locations now"); <END> n2.ha.changeMode(HighAvailabilityMode.DISABLED); n1.ha.changeMode(HighAvailabilityMode.AUTO); assertMaster(n1); assertEquals(n2.ha.getNodeState(), ManagementNodeState.FAILED); }</code><technical_language>n1.mgmt.getLocationManager().getLocations().isEmpty()</technical_language>

Target:
public void testChangeModeToDisabledAndBack() throws Exception { HaMgmtNode n1 = createMaster(Duration.PRACTICALLY_FOREVER); n1.mgmt.getLocationManager().createLocation(LocationSpec.create(LocalhostMachine.class)); @SuppressWarnings("unused") TestApplication app = createFirstAppAndPersist(n1); HaMgmtNode n2 = createHotStandby(Duration.PRACTICALLY_FOREVER); n1.ha.changeMode(HighAvailabilityMode.DISABLED); n2.ha.changeMode(HighAvailabilityMode.AUTO); assertMaster(n2); assertEquals(n1.ha.getNodeState(), ManagementNodeState.FAILED); Assert.assertTrue(n1.mgmt.getApplications().isEmpty(), "n1 should have had no apps; instead had: "+n1.mgmt.getApplications()); Assert.assertTrue(n1.mgmt.getEntityManager().getEntities().isEmpty(), "n1 should have had no entities; instead had: "+n1.mgmt.getEntityManager().getEntities()); Assert.assertTrue(n1.mgmt.getLocationManager().getLocations().isEmpty(), "n1 should have had no locations; instead had: "+n1.mgmt.getLocationManager().getLocations()); n1.ha.changeMode(HighAvailabilityMode.HOT_STANDBY); assertHotStandby(n1); Assert.assertFalse(n1.mgmt.getApplications().isEmpty(), "n1 should have had apps now"); Assert.assertFalse(n1.mgmt.getLocationManager().getLocations().isEmpty(), "n1 should have had locations now"); n2.ha.changeMode(HighAvailabilityMode.DISABLED); n1.ha.changeMode(HighAvailabilityMode.AUTO); assertMaster(n1); assertEquals(n2.ha.getNodeState(), ManagementNodeState.FAILED); }
Source:
<code>public AbstractHttpRequestExecutingMessageHandler(Expression uriExpression) { Assert.notNull(uriExpression, "URI Expression is required"); this.uriExpression = uriExpression; <START> this.uriFactory.setEncodingMode(DefaultUriBuilderFactory.EncodingMode.TEMPLATE_AND_VALUES); <END> }</code><technical_language>is this needed? This is default</technical_language>

Target:
public AbstractHttpRequestExecutingMessageHandler(Expression uriExpression) { Assert.notNull(uriExpression, "URI Expression is required"); this.uriExpression = uriExpression; }
Source:
<code>public void testResetFromWatcher() throws Exception { Timing timing = new Timing(); CuratorFramework client = CuratorFrameworkFactory.newClient(server.getConnectString(), new RetryOneTime(1)); try { client.start(); final WatcherRemovalFacade removerClient = (WatcherRemovalFacade)client.newWatcherRemoveCuratorFramework(); final CountDownLatch latch = new CountDownLatch(1); Watcher watcher = new Watcher() { @Override public void process(WatchedEvent event) { if ( event.getType() == Event.EventType.NodeCreated ) { try { removerClient.checkExists().usingWatcher(this).forPath("/yo"); } catch ( Exception e ) { e.printStackTrace(); } } else if ( event.getType() == Event.EventType.NodeDeleted ) { latch.countDown(); } } }; removerClient.checkExists().usingWatcher(watcher).forPath("/yo"); Assert.assertEquals(removerClient.getRemovalManager().getEntries().size(), 1); removerClient.create().forPath("/yo"); <START> timing.sleepABit(); <END> Assert.assertEquals(removerClient.getRemovalManager().getEntries().size(), 1); removerClient.delete().forPath("/yo"); Assert.assertTrue(timing.awaitLatch(latch)); Assert.assertEquals(removerClient.getRemovalManager().getEntries().size(), 0); } finally { CloseableUtils.closeQuietly(client); } }</code><technical_language>Latch watch fires sets checkExists watch this deterministic</technical_language>

Target:
public void testResetFromWatcher() throws Exception { Timing timing = new Timing(); CuratorFramework client = CuratorFrameworkFactory.newClient(server.getConnectString(), new RetryOneTime(1)); try { client.start(); final WatcherRemovalFacade removerClient = (WatcherRemovalFacade)client.newWatcherRemoveCuratorFramework(); final CountDownLatch createdLatch = new CountDownLatch(1); final CountDownLatch deletedLatch = new CountDownLatch(1); Watcher watcher = new Watcher() { @Override public void process(WatchedEvent event) { if ( event.getType() == Event.EventType.NodeCreated ) { try { removerClient.checkExists().usingWatcher(this).forPath("/yo"); } catch ( Exception e ) { e.printStackTrace(); } createdLatch.countDown(); } else if ( event.getType() == Event.EventType.NodeDeleted ) { deletedLatch.countDown(); } } }; removerClient.checkExists().usingWatcher(watcher).forPath("/yo"); Assert.assertEquals(removerClient.getRemovalManager().getEntries().size(), 1); removerClient.create().forPath("/yo"); Assert.assertTrue(timing.awaitLatch(createdLatch)); Assert.assertEquals(removerClient.getRemovalManager().getEntries().size(), 1); removerClient.delete().forPath("/yo"); Assert.assertTrue(timing.awaitLatch(deletedLatch)); Assert.assertEquals(removerClient.getRemovalManager().getEntries().size(), 0); } finally { CloseableUtils.closeQuietly(client); } }
Source:
<code>public void readsOneChunk() throws IOException { final String data = "1234567890abcdef"; final String length = Integer.toHexString(data.length()); final InputStream stream = new RqChunk( new RqFake( Arrays.asList( "GET /h?a=1", "Host: www.example.com", CHUNKED_HEADER ), Joiner.on(CRLF).join( length, data, <START> END_OF_CHUNK <END> ) ) ).body(); final byte[] buf = new byte[data.length()]; MatcherAssert.assertThat( stream.read(buf), Matchers.equalTo(data.length()) ); MatcherAssert.assertThat(buf, Matchers.equalTo(data.getBytes())); MatcherAssert.assertThat(stream.available(), Matchers.equalTo(0)); }</code><technical_language>@HDouss I need CRLF chunk <LINK_0> #### 3.6.1 Chunked Transfer Coding Chunked-Body = *chunk last-chunk trailer CRLF .... last-chunk = 1*("0") [ chunk-extension ] CRLF</technical_language>

Target:
public void readsOneChunk() throws IOException { final String data = "1234567890abcdef"; final String length = Integer.toHexString(data.length()); final InputStream stream = new RqChunk( new RqFake( Arrays.asList( "GET /h?a=1", "Host: www.example.com", CHUNKED_HEADER ), Joiner.on(CRLF).join( length, data, END_OF_CHUNK, "" ) ) ).body(); final byte[] buf = new byte[data.length()]; MatcherAssert.assertThat( stream.read(buf), Matchers.equalTo(data.length()) ); MatcherAssert.assertThat(buf, Matchers.equalTo(data.getBytes())); MatcherAssert.assertThat(stream.available(), Matchers.equalTo(0)); }
Source:
<code>public String toString() { return "Outcome{" + "nextRole=" + nextRole + ", term=" + term + ", leader=" + leader + ", leaderCommit=" + leaderCommit + ", logCommands=" + logCommands + ", outgoingMessages=" + outgoingMessages + ", commitIndex=" + commitIndex + ", votedFor=" + votedFor + ", renewElectionTimeout=" + renewElectionTimeout + ", needsFreshSnapshot=" + needsFreshSnapshot + ", votesForMe=" + votesForMe + ", preVotesForMe=" + preVotesForMe + ", lastLogIndexBeforeWeBecameLeader=" + lastLogIndexBeforeWeBecameLeader + ", followerStates=" + followerStates + ", shipCommands=" + shipCommands + ", electedLeader=" + electedLeader + <START> ", steppingDown=" + steppingDownInTerm.map( t -> "true, steppingDownInTerm=" + t ).orElse( "false" ) + <END> '}'; }</code><technical_language>want over-complicate toString of Optional perhaps</technical_language>

Target:
public String toString() { return "Outcome{" + "nextRole=" + nextRole + ", term=" + term + ", leader=" + leader + ", leaderCommit=" + leaderCommit + ", logCommands=" + logCommands + ", outgoingMessages=" + outgoingMessages + ", commitIndex=" + commitIndex + ", votedFor=" + votedFor + ", renewElectionTimeout=" + renewElectionTimeout + ", needsFreshSnapshot=" + needsFreshSnapshot + ", votesForMe=" + votesForMe + ", preVotesForMe=" + preVotesForMe + ", lastLogIndexBeforeWeBecameLeader=" + lastLogIndexBeforeWeBecameLeader + ", followerStates=" + followerStates + ", shipCommands=" + shipCommands + ", electedLeader=" + electedLeader + ", steppingDownInTerm=" + steppingDownInTerm + '}'; }