auphong2707/dl4se-code-review-dataset huggingface dataset:
Source:
<code>private void updateTaskStatuses( Map<Guid, Map<Guid, AsyncTaskStatus>> poolsAllTasksMap) { for (SPMTask task : _tasks.values()) { if (task.getShouldPoll()) { Map<Guid, AsyncTaskStatus> asyncTasksForPoolMap = poolsAllTasksMap .get(task.getStoragePoolID()); if (asyncTasksForPoolMap != null) { AsyncTaskStatus cachedAsyncTaskStatus = asyncTasksForPoolMap .get(task.getVdsmTaskId()); <START> log.debug("Updating task of command: with id: to status: {}.", <END> task.getParameters().getDbAsyncTask().getActionType(), task.getCommandId(), cachedAsyncTaskStatus); task.updateTask(cachedAsyncTaskStatus); } } else { log.debug("Not updating task of command: with id: and status: {}.", task.getParameters().getDbAsyncTask().getActionType(), task.getCommandId(), task.getLastTaskStatus()); } } }</code><technical_language>need colons, prefer enclosing values apostrophes: log.debug("Updating task of command id '{}' status '{}'."</technical_language>

Target:
private void updateTaskStatuses( Map<Guid, Map<Guid, AsyncTaskStatus>> poolsAllTasksMap) { for (SPMTask task : _tasks.values()) { if (task.getShouldPoll()) { Map<Guid, AsyncTaskStatus> asyncTasksForPoolMap = poolsAllTasksMap .get(task.getStoragePoolID()); if (asyncTasksForPoolMap != null) { AsyncTaskStatus cachedAsyncTaskStatus = asyncTasksForPoolMap .get(task.getVdsmTaskId()); log.debug("Updating task of command with id '{}' to status '{}'.", task.getParameters().getDbAsyncTask().getActionType(), task.getCommandId(), cachedAsyncTaskStatus); task.updateTask(cachedAsyncTaskStatus); } } else { log.debug("Not updating task of command with id '{}' and status '{}'.", task.getParameters().getDbAsyncTask().getActionType(), task.getCommandId(), task.getLastTaskStatus()); } } }
Source:
<code>private String getDisplayValue(String value, String name, Map<String, ListItem> map, String def, XWikiContext context) { ListItem item = map.get(value); String displayValue; if (item == null) { displayValue = def; } else { displayValue = item.getValue(); } if ((context == null) || (context.getWiki() == null)) { return displayValue; } String msgname = getFieldFullName() + "_" + value; String newresult = localizePlain(msgname); String syntax = context.getDoc().getSyntax().toIdString(); if (newresult == null) { msgname = "option_" + name + "_" + value; newresult = localizePlain(msgname); if (newresult == null) { msgname = "option_" + value; newresult = localizePlain(msgname); if (newresult == null) { <START> newresult = context.getDoc().getRenderedInlineContent(displayValue, syntax); <END> } } } else { newresult = context.getDoc().getRenderedInlineContent(newresult, syntax); } return newresult; }</code><technical_language>I understand here, a list wiki content</technical_language>

Target:
private String getDisplayValue(String value, String name, Map<String, ListItem> map, String def, XWikiContext context) { ListItem item = map.get(value); String displayValue; if (item == null) { displayValue = def; } else { displayValue = item.getValue(); } if ((context == null) || (context.getWiki() == null)) { return displayValue; } String msgname = getFieldFullName() + "_" + value; String newresult = localizePlain(msgname); if (newresult == null) { msgname = "option_" + name + "_" + value; newresult = localizePlain(msgname); if (newresult == null) { msgname = "option_" + value; newresult = localizePlain(msgname); if (newresult == null) { newresult = displayValue; } } } return newresult; }
Source:
<code>private EObject getInput(boolean restore) { EObject input = inputRef != null ? inputRef.get() : null; if (input == null) { if <START> (getSession(restore) != <END> null && getSession(restore).isOpen() && getURI().hasFragment()) { input = getSession(restore).getTransactionalEditingDomain().getResourceSet().getEObject(getURI(), false); if (input != null) { inputRef = new WeakReference<EObject>(input); } } } return input; }</code><technical_language>getsession(restore) stored in a local variable</technical_language>

Target:
private EObject getInput(boolean restore) { EObject input = inputRef != null ? inputRef.get() : null; if (input == null) { Session session = getSession(restore); if (session != null && session.isOpen() && getURI().hasFragment()) { input = session.getTransactionalEditingDomain().getResourceSet().getEObject(getURI(), false); if (input != null) { inputRef = new WeakReference<EObject>(input); } } } return input; }
Source:
<code>public String getQuestionAdditionalInfoHtml(int questionNumber, String additionalInfoId) { StringBuilder optionListHtml = new StringBuilder(); String optionFragmentTemplate = FeedbackQuestionFormTemplates.MSQ_ADDITIONAL_INFO_FRAGMENT; StringBuilder additionalInfo = new StringBuilder(); <START> if (this.isDistributeToRecipients()) { <END> additionalInfo.append(this.getQuestionTypeDisplayName()).append("<br>"); } else if (getNumOfConstSumOptions() > 0) { optionListHtml.append("<ul style=\"list-style-type: disc;margin-left: 20px;\" >"); for (int i = 0; i < getNumOfConstSumOptions(); i++) { String optionFragment = FeedbackQuestionFormTemplates.populateTemplate(optionFragmentTemplate, "${msqChoiceValue}", getConstSumOptions().get(i)); optionListHtml.append(optionFragment); } optionListHtml.append("</ul>"); additionalInfo.append(FeedbackQuestionFormTemplates.populateTemplate( FeedbackQuestionFormTemplates.MSQ_ADDITIONAL_INFO, "${questionTypeName}", this.getQuestionTypeDisplayName(), "${msqAdditionalInfoFragments}", optionListHtml.toString())); } additionalInfo.append(isPointsPerOption() ? "Points per " + (isDistributeToRecipients() ? "recipient" : "option") + ": " + getPoints() : "Total points: " + getPoints()); return FeedbackQuestionFormTemplates.populateTemplate( FeedbackQuestionFormTemplates.FEEDBACK_QUESTION_ADDITIONAL_INFO, "${more}", "[more]", "${less}", "[less]", "${questionNumber}", Integer.toString(questionNumber), "${additionalInfoId}", additionalInfoId, "${questionAdditionalInfo}", additionalInfo.toString()); }</code><technical_language>For instance here, scope is ambiguous</technical_language>

Target:
public String getQuestionAdditionalInfoHtml(int questionNumber, String additionalInfoId) { StringBuilder optionListHtml = new StringBuilder(); String optionFragmentTemplate = FeedbackQuestionFormTemplates.MSQ_ADDITIONAL_INFO_FRAGMENT; StringBuilder additionalInfo = new StringBuilder(); if (distributeToRecipients) { additionalInfo.append(getQuestionTypeDisplayName()).append("<br>"); } else if (numOfConstSumOptions > 0) { optionListHtml.append("<ul style=\"list-style-type: disc;margin-left: 20px;\" >"); for (int i = 0; i < numOfConstSumOptions; i++) { String optionFragment = Templates.populateTemplate(optionFragmentTemplate, "${msqChoiceValue}", constSumOptions.get(i)); optionListHtml.append(optionFragment); } optionListHtml.append("</ul>"); additionalInfo.append(Templates.populateTemplate( FeedbackQuestionFormTemplates.MSQ_ADDITIONAL_INFO, "${questionTypeName}", getQuestionTypeDisplayName(), "${msqAdditionalInfoFragments}", optionListHtml.toString())); } additionalInfo.append(pointsPerOption ? "Points per " + (distributeToRecipients ? "recipient" : "option") + ": " + points : "Total points: " + points); return Templates.populateTemplate( FeedbackQuestionFormTemplates.FEEDBACK_QUESTION_ADDITIONAL_INFO, "${more}", "[more]", "${less}", "[less]", "${questionNumber}", Integer.toString(questionNumber), "${additionalInfoId}", additionalInfoId, "${questionAdditionalInfo}", additionalInfo.toString()); }
Source:
<code>public Optional<ResourceID> failAllocation(final AllocationID allocationID, final Exception cause) { componentMainThreadExecutor.assertRunningInMainThread(); <START> final PendingRequest pendingRequest = pendingRequests.getKeyB(allocationID); <END> if (pendingRequest != null) { if (isBatchRequestAndFailureCanBeIgnored(pendingRequest, cause)) { log.debug("Ignoring allocation failure for batch slot request {}.", pendingRequest.getSlotRequestId()); } else { pendingRequests.removeKeyB(allocationID); failPendingRequest(pendingRequest, cause); } return Optional.empty(); } else { return tryFailingAllocatedSlot(allocationID, cause); } }</code><technical_language>this in a separate commit</technical_language>

Target:
public Optional<ResourceID> failAllocation(final AllocationID allocationID, final Exception cause) { componentMainThreadExecutor.assertRunningInMainThread(); final PendingRequest pendingRequest = pendingRequests.getValueByKeyB(allocationID); if (pendingRequest != null) { if (isBatchRequestAndFailureCanBeIgnored(pendingRequest, cause)) { log.debug("Ignoring allocation failure for batch slot request {}.", pendingRequest.getSlotRequestId()); } else { removePendingRequest(pendingRequest.getSlotRequestId()); failPendingRequest(pendingRequest, cause); } return Optional.empty(); } else { return tryFailingAllocatedSlot(allocationID, cause); } }
Source:
<code>public boolean addAccountUpdateConsumer(Consumer<Collection<Account>> accountUpdateConsumer) { <START> checkOpen(); <END> Objects.requireNonNull(accountUpdateConsumer, "accountUpdateConsumer to subscribe cannot be null"); return accountUpdateConsumers.add(accountUpdateConsumer); }</code><technical_language>no-ops? Adding removing sense</technical_language>

Target:
public boolean addAccountUpdateConsumer(Consumer<Collection<Account>> accountUpdateConsumer) { checkOpen(); Objects.requireNonNull(accountUpdateConsumer, "accountUpdateConsumer to subscribe cannot be null"); return true; }
Source:
<code>private void addBuyOrder(Order order) { if (this.buyOrders.containsKey(order.getStockSymbol())){ ArrayList<Order> list =buyOrders.get(order.getStockSymbol()); list.add(order); } else{ <START> ArrayList<Order> list = new ArrayList<Order>(); <END> list.add(order); this.buyOrders.put(order.getStockSymbol(), list); } }</code><technical_language>vague naming</technical_language>

Target:
private void addBuyOrder(Order order) { if (this.buyOrders.containsKey(order.getStockSymbol())){ ArrayList<Order> buyOrderList =buyOrders.get(order.getStockSymbol()); buyOrderList.add(order); } else{ ArrayList<Order> buyOrderList = new ArrayList<Order>(); buyOrderList.add(order); this.buyOrders.put(order.getStockSymbol(), buyOrderList); } }
Source:
<code>@Override public void setAlpha(int alpha) { <START> image.setAlpha(alpha); <END> }</code><technical_language>Yes. flash color fade</technical_language>

Target:
@Override public void setAlpha(int alpha) { if (placeholder != null) { placeholder.setAlpha(alpha); } image.setAlpha(alpha); }
Source:
<code>public ColumnStatistics build() { <START> return new ColumnStatistics(nullsFraction, distinctValuesCount, dataSize, lowValue, highValue); <END> }</code><technical_language>extract some Preconditions class in spi</technical_language>

Target:
public ColumnStatistics build() { return new ColumnStatistics(nullsFraction, distinctValuesCount, dataSize, range); }
Source:
<code>private void setupServer() throws Exception { <START> LOG.info("foobar"); <END> _embeddedZookeeper = new EmbeddedZookeeper(); _embeddedZookeeper.startup(); setupDatastreamServer(); }</code><technical_language>remove logging of "foobar"</technical_language>

Target:
private void setupServer() throws Exception { _embeddedZookeeper = new EmbeddedZookeeper(); _embeddedZookeeper.startup(); setupDatastreamServer(); }
Source:
<code>public int getUnsortedEncodedKeyComponentHashCode(@Nullable Float key) { <START> return Objects.hashCode(DimensionHandlerUtils.nullToZero(key)); <END> }</code><technical_language>Similar above, suggested DimensionHandlerUtils.nullToZero(key).hashCode(). + for Double, Long</technical_language>

Target:
public int getUnsortedEncodedKeyComponentHashCode(@Nullable Float key) { return DimensionHandlerUtils.nullToZero(key).hashCode(); }
Source:
<code>public void setup(OperatorContext context) { <START> ((ExpirableHdfsBucketStore<Object>)bucketManager.getBucketStore()).setConfiguration(context.getId(), <END> context.getValue(DAG.APPLICATION_PATH), partitionKeys, partitionMask); super.setup(context); }</code><technical_language>if this DeduperPOJOImpl work ExpirableHdfsBucketStore expressed in a way? Is this of design limitation in base classes</technical_language>

Target:
public void setup(OperatorContext context) { Preconditions.checkArgument(bucketManager.getBucketStore() instanceof ExpirableHdfsBucketStore); ExpirableHdfsBucketStore<Object> store = (ExpirableHdfsBucketStore<Object>)bucketManager.getBucketStore(); store.setConfiguration(context.getId(), context.getValue(DAG.APPLICATION_PATH), partitionKeys, partitionMask); super.setup(context); }
Source:
<code>public int partition(String topic, Object key, byte[] keyBytes, Object value, byte[] valueBytes, Cluster cluster) { <START> return partition(topic, key, keyBytes, value, valueBytes, cluster, 0); <END> }</code><technical_language>minor: calculate numPartitions in this overload, in other numPartitions passed in blindly one</technical_language>

Target:
public int partition(String topic, Object key, byte[] keyBytes, Object value, byte[] valueBytes, Cluster cluster) { return partition(topic, key, keyBytes, value, valueBytes, cluster, cluster.partitionsForTopic(topic).size()); }
Source:
<code>public void mp4SampleWithProfile5DolbyVision() throws Exception { <START> ExtractorAsserts.assertBehavior(Mp4Extractor::new, "mp4/dvhe_05_09.mp4", simulationConfig); <END> }</code><technical_language>reduce size of test file a (these files more 2 MB large while other MP4 test files generally 200 KB)? Ideally, easier move new MP4 tests a new PR</technical_language>

Target:
public void mp4SampleWithProfile5DolbyVision() throws Exception { ExtractorAsserts.assertBehavior(Mp4Extractor::new, "mp4/dvhe_05_05.mp4", simulationConfig); }
Source:
<code>public Collection<CacheEntry<K, Collection<V>>> performOperationRehashAware( IntermediateCollector<Collection<CacheEntry<K, Collection<V>>>> response) { BaseStream<?, ?> stream = supplier.get().sequential(); List<CacheEntry<K, Collection<V>>> collectedValues = new ArrayList(batchSize); ByRef<List<V>> ref = new ByRef<>(new ArrayList<>()); <START> Object[] currentKey = new Object[1]; <END> stream = ((Stream<Map.Entry<K, ?>>) stream).peek(e -> { List<V> list = ref.get(); if (!list.isEmpty()) { collectedValues.add(new ImmortalCacheEntry((K)currentKey[0], list)); if (collectedValues.size() >= batchSize) { response.sendDataResonse(collectedValues); collectedValues.clear(); list.clear(); } else { ref.set(new ArrayList<V>(list.size())); } } currentKey[0] = e.getKey(); }); for (IntermediateOperation intermediateOperation : intermediateOperations) { stream = intermediateOperation.perform(stream); } Stream<V> convertedStream = ((Stream<V>)stream); convertedStream.forEach(v -> { ref.get().add(v); }); List<V> lastList = ref.get(); if (lastList != null && !lastList.isEmpty()) { collectedValues.add(new ImmortalCacheEntry(currentKey[0], lastList)); } return collectedValues; }</code><technical_language>ByRef here, too</technical_language>

Target:
public Collection<CacheEntry<K, Collection<V>>> performOperationRehashAware( IntermediateCollector<Collection<CacheEntry<K, Collection<V>>>> response) { BaseStream<?, ?> stream = supplier.get().sequential(); List<CacheEntry<K, Collection<V>>> collectedValues = new ArrayList(batchSize); ByRef<List<V>> currentList = new ByRef<>(new ArrayList<>()); ByRef<K> currentKey = new ByRef<>(null); stream = ((Stream<Map.Entry<K, ?>>) stream).peek(e -> { List<V> list = currentList.get(); if (!list.isEmpty()) { collectedValues.add(new ImmortalCacheEntry(currentKey.get(), list)); if (collectedValues.size() >= batchSize) { response.sendDataResonse(collectedValues); collectedValues.clear(); list.clear(); } else { currentList.set(new ArrayList<V>(list.size())); } } currentKey.set(e.getKey()); }); for (IntermediateOperation intermediateOperation : intermediateOperations) { stream = intermediateOperation.perform(stream); } Stream<V> convertedStream = ((Stream<V>)stream); convertedStream.forEach(v -> { currentList.get().add(v); }); List<V> lastList = currentList.get(); if (lastList != null && !lastList.isEmpty()) { collectedValues.add(new ImmortalCacheEntry(currentKey.get(), lastList)); } return collectedValues; }
Source:
<code>private String getClassName(String niceIndexName) throws StandardException { String cName = ""; if(niceIndexName!=null){ cName = "IndexScan["+niceIndexName+"]"; }else{ cName = "TableScan["+getPrettyTableName(); if(pastTxId >= 0){ <START> cName += "timeTravelTx(" + pastTxId + ")"; <END> } cName += "]"; } if(isMultiProbing()) cName = "MultiProbe"+cName; if (isDistinctScan()) cName = "Distinct" + cName; if (specialMaxScan) cName = "LastKey" + cName; return cName; }</code><technical_language>Please add a space timeTravelTx. Also, simply write "as of" instead, echo query, unimportant</technical_language>

Target:
private String getClassName(String niceIndexName) throws StandardException { String cName = ""; if(niceIndexName!=null){ cName = "IndexScan["+niceIndexName; }else{ cName = "TableScan["+getPrettyTableName(); if(pastTxId >= 0){ cName += " timeTravelTx(" + pastTxId + ")"; } cName += "]"; } if(isMultiProbing()) cName = "MultiProbe"+cName; if (isDistinctScan()) cName = "Distinct" + cName; if (specialMaxScan) cName = "LastKey" + cName; return cName; }
Source:
<code>static <T extends Throwable> T assertThrows(Class<T> expectedType, Executable executable, Supplier<String> messageSupplier) { <START> return assertThrows(expectedType, executable, nullSafeGet(messageSupplier)); <END> }</code><technical_language>Message suppliers evaluated lazily. Please consult implementations of other assertions for inspiration</technical_language>

Target:
static <T extends Throwable> T assertThrows(Class<T> expectedType, Executable executable, Supplier<String> messageSupplier) { try { executable.execute(); } catch (Throwable actualException) { if (expectedType.isInstance(actualException)) { return (T) actualException; } else { throw new AssertionFailedError(getFailureWithSuppliedMessage(expectedType, messageSupplier), actualException); } } throw new AssertionFailedError(getFailureWithSuppliedMessage(expectedType, messageSupplier)); }
Source:
<code>FetchRequest(@NonNull Set<ObjectId> wantIds, int depth, @NonNull Set<ObjectId> clientShallowCommits, @NonNull FilterSpec filterSpec, @NonNull Set<String> clientCapabilities, int deepenSince, @NonNull List<String> deepenNotRefs, @Nullable String agent) { this.wantIds = requireNonNull(wantIds); this.depth = depth; this.clientShallowCommits = requireNonNull(clientShallowCommits); <START> this.filterSpec = filterSpec; <END> this.clientCapabilities = requireNonNull(clientCapabilities); this.deepenSince = deepenSince; this.deepenNotRefs = requireNonNull(deepenNotRefs); this.agent = agent; }</code><technical_language>I finding a time. requireNonNull</technical_language>

Target:
FetchRequest(@NonNull Set<ObjectId> wantIds, int depth, @NonNull Set<ObjectId> clientShallowCommits, @NonNull FilterSpec filterSpec, @NonNull Set<String> clientCapabilities, int deepenSince, @NonNull List<String> deepenNotRefs, @Nullable String agent) { this.wantIds = requireNonNull(wantIds); this.depth = depth; this.clientShallowCommits = requireNonNull(clientShallowCommits); this.filterSpec = requireNonNull(filterSpec); this.clientCapabilities = requireNonNull(clientCapabilities); this.deepenSince = deepenSince; this.deepenNotRefs = requireNonNull(deepenNotRefs); this.agent = agent; }
Source:
<code>public synchronized void put(URL schemaUrl, String schema) { <START> sSchemaCache.put(schemaUrl, schema); <END> }</code><technical_language>whitespace</technical_language>

Target:
public synchronized void put(URL schemaUrl, String schema) { mSchemaCache.put(schemaUrl, schema); }
Source:
<code>void unregisterCapability(UnregistrationParams params) { params.getUnregisterations().forEach(reg -> { if ("workspace/didChangeWorkspaceFolders".equals(reg.getMethod())) { <START> supportWorkspaceFoldersCapability = false; <END> } else if ("workspace/executeCommand".equals(reg.getMethod())) { String id = reg.getId(); synchronized (dynamicRegistrations) { Runnable unregistrator = dynamicRegistrations.get(id); if (unregistrator != null) { unregistrator.run(); dynamicRegistrations.remove(id); } } } }); }</code><technical_language>please this a Runnable dynamicRegistration map? If so, this method a definitive implementaiton is independent of registration method String id = reg.getId(); synchronized (dynamicRegistrations) { Runnable unregistrator = dynamicRegistrations.get(id); if (unregistrator != null) { unregistrator.run(); dynamicRegistrations.remove(id); } }</technical_language>

Target:
void unregisterCapability(UnregistrationParams params) { params.getUnregisterations().forEach(reg -> { String id = reg.getId(); Runnable unregistrator; synchronized (dynamicRegistrations) { unregistrator = dynamicRegistrations.get(id); dynamicRegistrations.remove(id); } if (unregistrator != null) { unregistrator.run(); } }); }
Source:
<code>protected void checkTagsInNodeEquals(NodeMetadata node, ImmutableSet<String> tags) { if (view.unwrapApi(EC2Api.class).getTagApi().isPresent()) { super.checkTagsInNodeEquals(node, tags); } else { <START> assertTrue(node.getTags().isEmpty(), "not expecting tags when tag extension isn't present" + node); <END> } }</code><technical_language>Need a space other separator present? a weird me, though...we a method called "checkTagsInNodeEquals" takes a list of tags input potentially complain if actual list of tags is input. Is some set this this check called in case, e.g. abstract "supportsTags" method</technical_language>

Target:
protected void checkTagsInNodeEquals(NodeMetadata node, ImmutableSet<String> tags) { if (view.unwrapApi(EC2Api.class).getTagApi().isPresent()) { super.checkTagsInNodeEquals(node, tags); } else { assertTrue(node.getTags().isEmpty(), "not expecting tags when tag extension isn't present: " + node); } }
Source:
<code>public static <T extends Document> T buildMockDocument(Class<T> documentClass) { PowerMockito.suppress(PowerMockito.constructor(LedgerPostingDocumentBase.class)); T document = null; try { document = PowerMockito.spy(documentClass.newInstance()); } catch (InstantiationException | IllegalAccessException e) { <START> e.printStackTrace(); <END> throw new RuntimeException(e); } performInitializationFromSkippedConstructor(document); return document; }</code><technical_language>this logged instead of printed</technical_language>

Target:
public static <T extends Document> T buildMockDocument(Class<T> documentClass) { PowerMockito.suppress(PowerMockito.constructor(LedgerPostingDocumentBase.class)); T document = null; try { document = PowerMockito.spy(documentClass.newInstance()); } catch (InstantiationException | IllegalAccessException e) { throw new RuntimeException(e); } performInitializationFromSkippedConstructor(document); return document; }
Source:
<code>public static void loadPropertiesFile(){ try { fileProperty = readFileProperties(); if (fileProperty != null) { setFileProperty(fileProperty); } } catch (Exception e) { <START> e.printStackTrace(); <END> } }</code><technical_language>log error</technical_language>

Target:
public void loadPropertiesFile() throws SynapseCommonsException { Properties properties = MiscellaneousUtil.loadProperties(SYNAPSE_PROPERTY_FILE); String filePath = properties.getProperty(FILE_PROPERTY_PATH); String fileName = properties.getProperty(FILE_PROPERTY_FILENAME); if ( null == fileName || fileName.isEmpty()) { throw new SynapseCommonsException(FILE_PROPERTY_FILENAME + "is empty or null"); } if ( null == filePath || filePath.isEmpty()) { throw new SynapseCommonsException(FILE_PROPERTY_PATH + "is empty or null"); } if (("default").equals(filePath)) { filePath = System.getProperty(CONF_LOCATION); } File file = new File(filePath + File.separator + fileName); boolean isFileExists = file.exists(); if (isFileExists) { try (InputStream in = new FileInputStream(filePath + File.separator + fileName)) { Properties rawProps = new Properties(); propertyMap = new HashMap(); rawProps.load(in); for (Map.Entry<Object, Object> propertyEntry : rawProps.entrySet()) { String strValue = (String) propertyEntry.getValue(); propertyMap.put(propertyEntry.getKey(), strValue); } if (LOG.isDebugEnabled()) { LOG.debug("Loaded factory properties from " + fileName + ": " + propertyMap); } } catch (IOException ex) { throw new SynapseCommonsException("Failed to read " + fileName, ex); } } else { throw new SynapseCommonsException(fileName + " file cannot found in " + filePath); } }
Source:
<code>private boolean hasImmutableIndexWithKeyValueColumns(TableRef tableRef) { if (!hasImmutableIndex(tableRef)) { return false; } for (PTable index : tableRef.getTable().getIndexes()) { for (PColumn column : index.getPKColumns()) { <START> if (!IndexUtil.isDataPKColumn(column) && (index.getIndexType() != IndexType.LOCAL || !column.getName().toString().equals(MetaDataUtil.VIEW_INDEX_ID_COLUMN_NAME))) { <END> return true; } } } return false; }</code><technical_language>move check for index a local index of loop (and skip index in case). match based column name</technical_language>

Target:
private boolean hasImmutableIndexWithKeyValueColumns(TableRef tableRef) { if (!hasImmutableIndex(tableRef)) { return false; } for (PTable index : tableRef.getTable().getIndexes()) { for (PColumn column : index.getPKColumns()) { if (!IndexUtil.isDataPKColumn(column)) { return true; } } } return false; }
Source:
<code>public BinaryContent transform(SourceResponse response, Map<String, Serializable> args) throws CatalogTransformerException { try { PrintWriter writer = printWriterProvider.build(Metacard.class); writer.setRawValue("<?xml version=\"1.0\" encoding=\"UTF-8\" standalone=\"yes\"?>\n"); writer.startNode("metacards"); <START> for (Map.Entry<String, String> nsRow : NAMESPACE_MAP.entrySet()) { <END> writer.addAttribute(nsRow.getKey(), nsRow.getValue()); } if (response.getResults() != null && !response.getResults().isEmpty()) { StringWriter metacardContent = fjp.invoke( new MetacardForkTask( ImmutableList.copyOf(response.getResults()), geometryTransformer, threshold, metacardMarshaller)); writer.setRawValue(metacardContent.getBuffer().toString()); } writer.endNode(); ByteArrayInputStream bais = new ByteArrayInputStream(writer.makeString().getBytes(StandardCharsets.UTF_8)); return new BinaryContentImpl(bais, mimeType); } catch (Exception e) { LOGGER.info("Failed Query response transformation", e); throw new CatalogTransformerException("Failed Query response transformation"); } }</code><technical_language>This right. creating a new FJP process computations ctor for recursive task, creating another FJP ignoring caller</technical_language>

Target:
public BinaryContent transform(SourceResponse response, Map<String, Serializable> args) throws CatalogTransformerException { try { PrintWriter writer = printWriterProvider.build(Metacard.class); writer.setRawValue("<?xml version=\"1.0\" encoding=\"UTF-8\" standalone=\"yes\"?>\n"); writer.startNode("metacards"); for (Map.Entry<String, String> nsRow : NAMESPACE_MAP.entrySet()) { writer.addAttribute(nsRow.getKey(), nsRow.getValue()); } if (response.getResults() != null && !response.getResults().isEmpty()) { StringWriter metacardContent = fjp.invoke( new MetacardForkTask( ImmutableList.copyOf(response.getResults()), fjp, geometryTransformer, threshold, metacardMarshaller)); writer.setRawValue(metacardContent.getBuffer().toString()); } writer.endNode(); ByteArrayInputStream bais = new ByteArrayInputStream(writer.makeString().getBytes(StandardCharsets.UTF_8)); return new BinaryContentImpl(bais, mimeType); } catch (Exception e) { LOGGER.info("Failed Query response transformation", e); throw new CatalogTransformerException("Failed Query response transformation"); } }
Source:
<code>EventHubAsyncClient(ConnectionOptions connectionOptions, ReactorProvider provider, ReactorHandlerProvider handlerProvider, TracerProvider tracerProvider) { <START> Objects.requireNonNull(connectionOptions); <END> Objects.requireNonNull(provider); Objects.requireNonNull(handlerProvider); this.connectionOptions = connectionOptions; this.tracerProvider = tracerProvider; this.eventHubName = connectionOptions.eventHubName(); this.connectionId = StringUtil.getRandomString("MF"); this.connectionMono = Mono.fromCallable(() -> { return (EventHubConnection) new ReactorConnection(connectionId, connectionOptions, provider, handlerProvider, new ResponseMapper()); }).doOnSubscribe(c -> hasConnection.set(true)) .cache(); this.defaultProducerOptions = new EventHubProducerOptions() .retry(connectionOptions.retry()); this.defaultConsumerOptions = new EventHubConsumerOptions() .retry(connectionOptions.retry()) .scheduler(connectionOptions.scheduler()); }</code><technical_language>Add messages back</technical_language>

Target:
EventHubAsyncClient(ConnectionOptions connectionOptions, ReactorProvider provider, ReactorHandlerProvider handlerProvider, TracerProvider tracerProvider) { Objects.requireNonNull(connectionOptions, "'connectionOptions' cannot be null."); Objects.requireNonNull(provider, "'provider' cannot be null."); Objects.requireNonNull(handlerProvider, "'handlerProvider' cannot be null."); Objects.requireNonNull(tracerProvider, "'tracerProvider' cannot be null."); this.connectionOptions = connectionOptions; this.tracerProvider = tracerProvider; this.eventHubName = connectionOptions.eventHubName(); this.connectionId = StringUtil.getRandomString("MF"); this.connectionMono = Mono.fromCallable(() -> { return (EventHubConnection) new ReactorConnection(connectionId, connectionOptions, provider, handlerProvider, new ResponseMapper()); }).doOnSubscribe(c -> hasConnection.set(true)) .cache(); this.defaultProducerOptions = new EventHubProducerOptions() .retry(connectionOptions.retry()); this.defaultConsumerOptions = new EventHubConsumerOptions() .retry(connectionOptions.retry()) .scheduler(connectionOptions.scheduler()); }
Source:
<code>public TextAnalyticsClientBuilder credential(TokenCredential tokenCredential) { <START> Objects.requireNonNull(tokenCredential); <END> this.tokenCredential = tokenCredential; this.subscriptionKey = null; return this; }</code><technical_language>For Objects.requireNonNull, a message. Otherwise, is a NullPointerException message</technical_language>

Target:
public TextAnalyticsClientBuilder credential(TokenCredential tokenCredential) { Objects.requireNonNull(tokenCredential, "'tokenCredential' cannot be null."); this.tokenCredential = tokenCredential; return this; }
Source:
<code>public String getQuestionResultStatisticsCsv( List<FeedbackResponseAttributes> responses, FeedbackQuestionAttributes question, FeedbackSessionResultsBundle bundle) { if (responses.size() == 0) { return ""; } StringBuilder csv = new StringBuilder(100); StringBuilder fragments = new StringBuilder(); Map<String, Integer> answerFrequency = new LinkedHashMap<String, Integer>(); for (String option : mcqChoices) { answerFrequency.put(option, 0); } if (otherEnabled) { answerFrequency.put("Other", 0); } for (FeedbackResponseAttributes response : responses) { String answerString = response.getResponseDetails().getAnswerString(); Boolean isOtherOptionAnswer = ((FeedbackMcqResponseDetails) (response.getResponseDetails())).isOtherOptionAnswer(); if (isOtherOptionAnswer) { if (!answerFrequency.containsKey("Other")) { answerFrequency.put("Other", 1); } else { answerFrequency.put("Other", answerFrequency.get("Other") + 1); } } else { if (!answerFrequency.containsKey(answerString)) { answerFrequency.put(answerString, 1); } else { answerFrequency.put(answerString, answerFrequency.get(answerString) + 1); } } } DecimalFormat df = new DecimalFormat("#.##"); for (Entry<String, Integer> entry : answerFrequency.entrySet()) { fragments.append(Sanitizer.sanitizeForCsv(entry.getKey())).append(',') .append(entry.getValue().toString()).append(',') .append(df.format(100 * (double) entry.getValue() / responses.size())).append(Const.EOL); } csv.append("Choice, Response Count, Percentage").append(Const.EOL) .append(fragments.toString()); <START> return csv.toString(); <END> }</code><technical_language>for csv variable here</technical_language>

Target:
public String getQuestionResultStatisticsCsv( List<FeedbackResponseAttributes> responses, FeedbackQuestionAttributes question, FeedbackSessionResultsBundle bundle) { if (responses.isEmpty()) { return ""; } StringBuilder fragments = new StringBuilder(); Map<String, Integer> answerFrequency = new LinkedHashMap<String, Integer>(); for (String option : mcqChoices) { answerFrequency.put(option, 0); } if (otherEnabled) { answerFrequency.put("Other", 0); } for (FeedbackResponseAttributes response : responses) { String answerString = response.getResponseDetails().getAnswerString(); Boolean isOtherOptionAnswer = ((FeedbackMcqResponseDetails) (response.getResponseDetails())).isOtherOptionAnswer(); if (isOtherOptionAnswer) { if (!answerFrequency.containsKey("Other")) { answerFrequency.put("Other", 0); } answerFrequency.put("Other", answerFrequency.get("Other") + 1); } else { if (!answerFrequency.containsKey(answerString)) { answerFrequency.put(answerString, 0); } answerFrequency.put(answerString, answerFrequency.get(answerString) + 1); } } DecimalFormat df = new DecimalFormat("#.##"); for (Entry<String, Integer> entry : answerFrequency.entrySet()) { fragments.append(Sanitizer.sanitizeForCsv(entry.getKey())).append(',') .append(entry.getValue().toString()).append(',') .append(df.format(100 * (double) entry.getValue() / responses.size())).append(Const.EOL); } return "Choice, Response Count, Percentage" + Const.EOL + fragments.toString(); }
Source:
<code>public Set<ContainerModel> group(Set<TaskModel> tasks) { validateTasks(tasks); List<TaskModel> sortedTasks = new ArrayList<>(tasks); Collections.sort(sortedTasks); Map<TaskName, TaskModel>[] taskGroups = new Map[containerCount]; for (int i = 0; i < containerCount; i++) { taskGroups[i] = new HashMap<>(); } for (int i = 0; i < sortedTasks.size(); i++) { TaskModel tm = sortedTasks.get(i); taskGroups[i % containerCount].put(tm.getTaskName(), tm); } Set<ContainerModel> containerModels = new HashSet<>(); for (int i = 0; i < containerCount; i++) { <START> containerModels.add(new ContainerModel(String.valueOf(i), taskGroups[i])); <END> } return Collections.unmodifiableSet(containerModels); }</code><technical_language>This line, I a others, assume container/processor ids a sequence of integers (even type is String). I this patch ensures this code is invoked in legacy case, true. this precondition/assumption is subtle; obvious types. I suggest add a validation a clear exception ensures external strings (e.g. TaskAssignmentManager) parseable integers</technical_language>

Target:
public Set<ContainerModel> group(Set<TaskModel> tasks) { validateTasks(tasks); List<TaskModel> sortedTasks = new ArrayList<>(tasks); Collections.sort(sortedTasks); Map<TaskName, TaskModel>[] taskGroups = new Map[containerCount]; for (int i = 0; i < containerCount; i++) { taskGroups[i] = new HashMap<>(); } for (int i = 0; i < sortedTasks.size(); i++) { TaskModel tm = sortedTasks.get(i); taskGroups[i % containerCount].put(tm.getTaskName(), tm); } Set<ContainerModel> containerModels = new HashSet<>(); for (int i = 0; i < containerCount; i++) { containerModels.add(new ContainerModel(String.valueOf(i), i, taskGroups[i])); } return Collections.unmodifiableSet(containerModels); }
Source:
<code>public EditorTopComponent() { initComponents(); setName(Bundle.CTL_EditorTopComponent()); setDisplayName("welcome.tex"); setToolTipText(Bundle.HINT_EditorTopComponent()); putClientProperty(TopComponent.PROP_CLOSING_DISABLED, Boolean.TRUE); putClientProperty(TopComponent.PROP_UNDOCKING_DISABLED, Boolean.TRUE); <START> fileActions = new FileActions(this); <END> dbxFileAction = new DbxFileActions(this); displayCloudStatus(); }</code><technical_language>This is bad, 1. constructor is finished gave a fully build instance another class 2. construcor do work of a Builder</technical_language>

Target:
public EditorTopComponent() { initComponents(); setName(Bundle.CTL_EditorTopComponent()); setDisplayName("welcome.tex"); setToolTipText(Bundle.HINT_EditorTopComponent()); putClientProperty(TopComponent.PROP_CLOSING_DISABLED, Boolean.TRUE); putClientProperty(TopComponent.PROP_UNDOCKING_DISABLED, Boolean.TRUE); displayCloudStatus(); }
Source:
<code>public void buildCatalog(IScopeContext context) { IConfigurationElement[] allContentTypeCEs = getConfigurationElements(); for (int i = 0; i < allContentTypeCEs.length; i++) if (allContentTypeCEs[i].getName().equals("content-type")) registerContentType(allContentTypeCEs[i]); for (String id : <START> context.getNode(ContentType.PREF_USER_DEFINED) .get(ContentType.PREF_USER_DEFINED, ContentType.EMPTY_STRING) .split(ContentType.PREF_USER_DEFINED__SEPARATOR)) { <END> IEclipsePreferences node = context.getNode(id); catalog.addContentType(ContentType.createContentType(catalog, id, node.get(ContentType.PREF_USER_DEFINED__NAME, ContentType.EMPTY_STRING), (byte) 0, new String[0], new String[0], node.get(ContentType.PREF_USER_DEFINED__BASE_TYPE_ID, null), null, Collections.emptyMap(), null)); } for (int i = 0; i < allContentTypeCEs.length; i++) if (allContentTypeCEs[i].getName().equals("file-association")) registerFileAssociation(allContentTypeCEs[i]); applyPreferences(); }</code><technical_language>This block exists in places. Please move utility function</technical_language>

Target:
public void buildCatalog(IScopeContext context) { IConfigurationElement[] allContentTypeCEs = getConfigurationElements(); for (int i = 0; i < allContentTypeCEs.length; i++) if (allContentTypeCEs[i].getName().equals("content-type")) registerContentType(allContentTypeCEs[i]); for (String id : ContentTypeManager.getUserDefinedContentTypeIds(context)) { IEclipsePreferences node = context.getNode(id); catalog.addContentType(ContentType.createContentType(catalog, id, node.get(ContentType.PREF_USER_DEFINED__NAME, ContentType.EMPTY_STRING), (byte) 0, new String[0], new String[0], node.get(ContentType.PREF_USER_DEFINED__BASE_TYPE_ID, null), null, Collections.emptyMap(), null)); } for (int i = 0; i < allContentTypeCEs.length; i++) if (allContentTypeCEs[i].getName().equals("file-association")) registerFileAssociation(allContentTypeCEs[i]); applyPreferences(); }
Source:
<code>public RulePhase getPhase() { <START> if (isNullOrEmpty(getExecuteAfter()) && isNullOrEmpty(getExecuteAfterIDs()) <END> && isNullOrEmpty(getExecuteBefore()) && isNullOrEmpty(getExecuteBeforeIDs())) { return RulePhase.MIGRATION_RULES; } return RulePhase.IMPLICIT; }</code><technical_language>If IMPLICIT a default, I this happen if executeBefore executeAfter specified. Otherwise, is for rule execute beginning (before real initialization) extreme end (after reporting finalization). I want of scenarios. :)</technical_language>

Target:
public RulePhase getPhase() { return RulePhase.MIGRATION_RULES; }
Source:
<code>public void run( Value inlineValue ) { if ( expression instanceof VariablePath ) { <START> Object myObj = (((VariablePath) expression).getValueOrValueVector()); <END> if ( myObj instanceof Value ) { path.getValue(inlineValue).deepCopyWithLinks((Value) myObj); } if ( myObj instanceof ValueVector ) { path.getValueVector(inlineValue).deepCopyWithLinks((ValueVector) myObj); } } else { path.getValue(inlineValue).deepCopyWithLinks(expression.evaluate()); } }</code><technical_language>remove outermost parentheses ()</technical_language>

Target:
public void run( Value inlineValue ) { if ( expression instanceof VariablePath ) { Object myObj = ((VariablePath) expression).getValueOrValueVector(); if ( myObj instanceof Value ) { path.getValue(inlineValue).deepCopyWithLinks((Value) myObj); } else if ( myObj instanceof ValueVector ) { path.getValueVector(inlineValue).deepCopyWithLinks((ValueVector) myObj); } else { throw new RuntimeException( "incomplete case analysis" ); } } else { path.getValue(inlineValue).deepCopyWithLinks(expression.evaluate()); } }
Source:
<code>public void testAsyncGetFromReaders() throws IOException, ExecutionException, InterruptedException { Slice zero = ManagedStateTestUtils.getSliceFor("0"); long time = System.currentTimeMillis(); <START> DefaultBucket.setDisableBloomFilterByDefault(true); <END> testMeta.managedState.setup(testMeta.operatorContext); Map<Slice, Bucket.BucketedValue> unsavedBucket0 = ManagedStateTestUtils.getTestBucketData(0, time); testMeta.managedState.bucketsFileSystem.writeBucketData(time, 0, unsavedBucket0); ManagedStateTestUtils.validateBucketOnFileSystem(testMeta.managedState.getFileAccess(), 0, unsavedBucket0, 1); Future<Slice> valFuture = testMeta.managedState.getAsync(0, zero); Assert.assertEquals("value of zero", zero, valFuture.get()); testMeta.managedState.teardown(); }</code><technical_language>here, disable</technical_language>

Target:
public void testAsyncGetFromReaders() throws IOException, ExecutionException, InterruptedException { Slice zero = ManagedStateTestUtils.getSliceFor("0"); long time = System.currentTimeMillis(); DefaultBucket.setDisableBloomFilterByDefault(true); testMeta.managedState.setup(testMeta.operatorContext); Map<Slice, Bucket.BucketedValue> unsavedBucket0 = ManagedStateTestUtils.getTestBucketData(0, time); testMeta.managedState.bucketsFileSystem.writeBucketData(time, 0, unsavedBucket0, -1); ManagedStateTestUtils.validateBucketOnFileSystem(testMeta.managedState.getFileAccess(), 0, unsavedBucket0, 1); Future<Slice> valFuture = testMeta.managedState.getAsync(0, zero); Assert.assertEquals("value of zero", zero, valFuture.get()); testMeta.managedState.teardown(); }
Source:
<code>public MobileEditPreviewPageObject clickPreview() { <START> try { <END> wait(500); } catch (InterruptedException e) { e.printStackTrace(); } WebElement editPreviewButton = waitForElementByCss(editPreviewButtonString); waitForElementClickableByElement(editPreviewButton); jQueryClick(editPreviewButton); return new MobileEditPreviewPageObject(driver); }</code><technical_language>Thread.sleep for debugging - remove</technical_language>

Target:
public MobileEditPreviewPageObject clickPreview() { waitForElementByElement(editPreviewButton); waitForElementClickableByElement(editPreviewButton); jQueryClick(editPreviewButton); return new MobileEditPreviewPageObject(driver); }
Source:
<code>private void initViews() { previousButton = (Button) findViewById(R.id.button_previous); nextButton = (Button) findViewById(R.id.button_next); wordTextView = (TextView) findViewById(R.id.word_textview); previousButton.setOnClickListener(new OnClickListener() { @Override public void onClick(View arg0) { if (currentIndex > 0) { currentIndex--; <START> } <END> loadWordAndShow(serverIDs[currentIndex]); } }); nextButton.setOnClickListener(new OnClickListener() { @Override public void onClick(View arg0) { if (currentIndex < serverIDs.length - 1) { currentIndex++; } loadWordAndShow(serverIDs[currentIndex]); } }); }</code><technical_language>disable previousButton word</technical_language>

Target:
private void initViews() { previousButton = (Button) findViewById(R.id.button_previous); nextButton = (Button) findViewById(R.id.button_next); wordTextView = (TextView) findViewById(R.id.textview_word); indexTextView = (TextView) findViewById(R.id.textview_index); updateButtonsEnable(); updateIndexTextView(); previousButton.setOnClickListener(new OnClickListener() { @Override public void onClick(View arg0) { loadWordAndShow(serverIDs[--currentIndex]); updateButtonsEnable(); updateIndexTextView(); } }); nextButton.setOnClickListener(new OnClickListener() { @Override public void onClick(View arg0) { loadWordAndShow(serverIDs[++currentIndex]); updateButtonsEnable(); updateIndexTextView(); } }); }
Source:
<code>public boolean isAvailable() { <START> return ModUtil.isModLoaded(Constants.BCLIB_MOD_ID); <END> }</code><technical_language>give this a version range is inactive next major version</technical_language>

Target:
public boolean isAvailable() { return ModUtil.isModLoaded(Constants.BCLIB_MOD_ID, "[7.99.17,8.0)"); }
Source:
<code>public static LogEntryComposite parseFoldTree(List<LogEntryComponent> logEntryComponents) { LogEntryComposite root = new LogEntryComposite(null); Stack<LogEntryComposite> foldStack = new Stack<>(); foldStack.push(root); for (LogEntryComponent logEntryComponent : logEntryComponents) { if (logEntryComponent instanceof TravisCommandLeaf) { TravisCommandLeaf command = (TravisCommandLeaf) logEntryComponent; if (command.getCommand().equals(TRAVIS_FOLD)) { <START> if (command.getType().equals(START)) { <END> LogEntryComposite logEntryComposite = new LogEntryComposite(command.getName()); foldStack.peek().append(logEntryComposite); foldStack.push(logEntryComposite); } else if (command.getType().equals(END)) { foldStack.pop(); } } } else { foldStack.peek().append(logEntryComponent); } } return root; }</code><technical_language>This is alread a 4th level of nested operators. Try limit max 2 levels of nexted operators splitting in functions</technical_language>

Target:
public static LogEntryComposite parseFoldTree(List<LogEntryComponent> logEntryComponents) { LogEntryComposite root = new LogEntryComposite(null); Stack<LogEntryComposite> foldStack = new Stack<>(); foldStack.push(root); for (LogEntryComponent logEntryComponent : logEntryComponents) { if (logEntryComponent instanceof TravisCommandLeaf) { handleTravisCommand(foldStack, (TravisCommandLeaf) logEntryComponent); } else { foldStack.peek().append(logEntryComponent); } } return root; }
Source:
<code>public void run() { try { for (AsyncTaskWorker taskWorker : taskWorkers) { taskWorker.init(); } long prevNs = clock.nanoTime(); while (!shutdownNow) { if (throwable != null) { log.error("Caught throwable and stopping run loop", throwable); throw new SamzaException(throwable); } long startNs = clock.nanoTime(); IncomingMessageEnvelope envelope = chooseEnvelope(); long chooseNs = clock.nanoTime(); containerMetrics.chooseNs().update(chooseNs - startNs); runTasks(envelope); long blockNs = clock.nanoTime(); <START> blockIfBusy(); <END> long currentNs = clock.nanoTime(); long activeNs = blockNs - chooseNs; long totalNs = currentNs - prevNs; prevNs = currentNs; containerMetrics.blockNs().update(currentNs - blockNs); if (totalNs != 0) { containerMetrics.utilization().set(((double) activeNs) / totalNs); } } } finally { workerTimer.shutdown(); callbackExecutor.shutdown(); if (callbackTimer != null) callbackTimer.shutdown(); } }</code><technical_language>thanks for removing unused param</technical_language>

Target:
public void run() { try { for (AsyncTaskWorker taskWorker : taskWorkers) { taskWorker.init(); } long prevNs = clock.nanoTime(); while (!shutdownNow) { if (throwable != null) { log.error("Caught throwable and stopping run loop", throwable); throw new SamzaException(throwable); } long startNs = clock.nanoTime(); IncomingMessageEnvelope envelope = chooseEnvelope(); long chooseNs = clock.nanoTime(); containerMetrics.chooseNs().update(chooseNs - startNs); runTasks(envelope); long blockNs = clock.nanoTime(); blockIfBusy(envelope); long currentNs = clock.nanoTime(); long activeNs = blockNs - chooseNs; long totalNs = currentNs - prevNs; prevNs = currentNs; containerMetrics.blockNs().update(currentNs - blockNs); if (totalNs != 0) { containerMetrics.utilization().set(((double) activeNs) / totalNs); } } } finally { workerTimer.shutdown(); callbackExecutor.shutdown(); if (callbackTimer != null) callbackTimer.shutdown(); } }