auphong2707/dl4se-code-review-dataset huggingface dataset:
Source:
<code>protected CommandStatus monitorJob() { int exitValue = -1; while (exitValue != 0) { try { exitValue = job.exitValue(); } catch (IllegalThreadStateException e) { try { commandConfig.getStdErr().write(getClass().getName() + "IllegalThreadStateException!: " + e); } catch (IOException e1) { <START> e1.printStackTrace(); <END> } } try { job.waitFor(1000, TimeUnit.MILLISECONDS); exitValue = job.exitValue(); } catch (InterruptedException e) { try { commandConfig.getStdErr().write(getClass().getName() + " InterruptedException!: " + e); } catch (IOException e1) { e1.printStackTrace(); } } if (!job.isAlive()) { logger.info("Job is no longer alive, done monitoring"); break; } } try { commandConfig.getStdOut().write("INFO: Command::monitorJob Message: Exit value = " + exitValue + "\n"); } catch (IOException e) { e.printStackTrace(); } logger.info("Finished monitoring job with exit value: " + exitValue); if (exitValue == 0) return CommandStatus.SUCCESS; else return CommandStatus.FAILED; }</code><technical_language>logged handled</technical_language>

Target:
protected CommandStatus monitorJob() { while (exitValue != 0) { try { exitValue = job.exitValue(); } catch (IllegalThreadStateException e) { try { logger.warn("IllegalThreadStateException, still going to keep monitoring the job..."); commandConfig.getStdErr().write(getClass().getName() + "IllegalThreadStateException!: " + e); } catch (IOException e1) { logger.error("Couldn't write to stderr file! Returning failed.", e1); return CommandStatus.FAILED; } } try { job.waitFor(1000, TimeUnit.MILLISECONDS); exitValue = job.exitValue(); } catch (InterruptedException e) { try { logger.error("Couldn't wait for the job to finish..."); commandConfig.getStdErr().write(getClass().getName() + " InterruptedException!: " + e); } catch (IOException e1) { logger.error("Couldn't write exception to error file! Returning failed.", e1); return CommandStatus.FAILED; } } if (!job.isAlive()) { logger.info("Job is no longer alive, done monitoring"); break; } } try { commandConfig.getStdOut().write("INFO: Command::monitorJob Message: Exit value = " + exitValue + "\n"); } catch (IOException e) { logger.error("Couldn't write final command exit value to the std out file. Returning failed. Exit value = " + exitValue, e); return CommandStatus.FAILED; } logger.info("Finished monitoring job with exit value: " + exitValue); if (exitValue != 0) return CommandStatus.FAILED; return CommandStatus.SUCCESS; }
Source:
<code><START> private boolean patternShouldBeRequested(){ <END> if ((System.currentTimeMillis() - timeStamp) > PATTERN_TIMEOUT && visibleAcctivitiesCounter <= 0 ){ return patternIsEnabled(); } return false; }</code><technical_language>Please move this method patternIsEnabled end of class, similar PassCodeManager class</technical_language>

Target:
private boolean patternShouldBeRequested() { if ((System.currentTimeMillis() - timeStamp) > PATTERN_TIMEOUT && mVisibleActivitiesCounter <= 0 ) { return patternIsEnabled(); } return false; }
Source:
<code>private Report generateFailedReport(IStatus status) { String reason = "AUT is terminated"; Report report = TestSuiteUtils.generateFailedReport((ITestCase) getActualElement(), reason); Node root = report.getRoot(); ReportFactory reportFactory = new ReportFactoryImpl(); <START> ReportBuilderStore store = reportFactory.createReportBuilderStore(); <END> store.setReport(report); store.setCurrentNode(root); ReportBuilder reportBuilder = ReportBuilder.load(store); INodeBuilder nodeBuilder = reportBuilder.getCurrent(); nodeBuilder.appendLog(LoggingCategory.NORMAL, testListener.getLog()); root.setEndTime(root.getStartTime() + getTime()); return reportBuilder.getReportCopy(); }</code><technical_language>ReportBuilderStore is for persistence. update Report object if needed</technical_language>

Target:
private Report generateFailedReport(IStatus status) { String reason = "AUT is terminated"; Report report = TestSuiteUtils.generateFailedReport((ITestCase) getActualElement(), reason); Node root = report.getRoot(); root.setEndTime(root.getStartTime() + getTime()); ReportHelper.appendLog(root, LoggingCategory.NORMAL, testListener.getLog()); return report; }
Source:
<code>protected void reportWalkEnd( WalkerContext context, String fromPath ) throws WalkerException { if ( context.isStopped() ) { if ( context.getStopCause() == null ) { if ( getLogger().isDebugEnabled() ) { getLogger().debug( "Walker was stopped programatically, not because of error." ); } } else if ( context.getStopCause() instanceof TaskInterruptedException ) { getLogger().info( "Canceled walking on repository from path \"{}\", cause: {}", new Object[] { RepositoryStringUtils.getHumanizedNameString( context.getRepository() ), fromPath, context.getStopCause().getMessage() } ); } else { if ( context.getStopCause() instanceof ItemNotFoundException ) { getLogger().debug( "Aborted walking on repository from path \"{}\", cause: {}", new Object[] { RepositoryStringUtils.getHumanizedNameString( context.getRepository() ), fromPath, context.getStopCause().getMessage() } ); } else { getLogger().debug( "Aborted walking on repository from path \"{}\", cause: {}", new Object[] { RepositoryStringUtils.getHumanizedNameString( context.getRepository() ), fromPath, context.getStopCause().getMessage() } ); } <START> <END> throw new WalkerException( context, "Aborted walking on repository ID='" + context.getRepository().getId() + "' from path='" + fromPath + "'." ); } } else { if ( getLogger().isDebugEnabled() ) { getLogger().debug( "Finished walking on ResourceStore '" + context.getRepository().getId() + "' from path '" + context.getContext().get( WALKER_WALKED_FROM_PATH ) + "'." ); } } }</code><technical_language>I this branch instanceof ItemNotFoundException is needed... logs same</technical_language>

Target:
protected void reportWalkEnd( WalkerContext context, String fromPath ) throws WalkerException { if ( context.isStopped() ) { if ( context.getStopCause() == null ) { if ( getLogger().isDebugEnabled() ) { getLogger().debug( "Walker was stopped programatically, not because of error." ); } } else if ( context.getStopCause() instanceof TaskInterruptedException ) { getLogger().info( "Canceled walking on repository from path \"{}\", cause: {}", new Object[] { RepositoryStringUtils.getHumanizedNameString( context.getRepository() ), fromPath, context.getStopCause().getMessage() } ); } else { if ( context.getStopCause() instanceof ItemNotFoundException ) { getLogger().debug( "Aborted walking on repository from path \"{}\", cause: {}", new Object[] { RepositoryStringUtils.getHumanizedNameString( context.getRepository() ), fromPath, context.getStopCause().getMessage() } ); } else { getLogger().info( "Aborted walking on repository from path \"{}\", cause: {}", new Object[] { RepositoryStringUtils.getHumanizedNameString( context.getRepository() ), fromPath, context.getStopCause().getMessage() } ); } throw new WalkerException( context, "Aborted walking on repository ID='" + context.getRepository().getId() + "' from path='" + fromPath + "'." ); } } else { if ( getLogger().isDebugEnabled() ) { getLogger().debug( "Finished walking on ResourceStore '" + context.getRepository().getId() + "' from path '" + context.getContext().get( WALKER_WALKED_FROM_PATH ) + "'." ); } } }
Source:
<code>public void validate() throws Exception { String command = getText(); <START> Set<String> allowedText = new TreeSet<>(Arrays.asList("get-repo-type")); <END> if (command == null) { throw new Exception("The message text must contain one of '" + allowedText.toString() + "'"); } if (!allowedText.contains(command)) { throw new Exception("The message text must contain one of '" + allowedText.toString() + "'"); } if (getTags().size() == 0) { throw new Exception("All repository messages must have at least one tag"); } super.validate(); }</code><technical_language>allowedTexts</technical_language>

Target:
public void validate() throws Exception { String command = getText(); Set<String> allowedTexts = new TreeSet<>(Arrays.asList("get-repo-type")); if (command == null) { throw new Exception("The message text must contain one of '" + allowedTexts.toString() + "'"); } if (!allowedTexts.contains(command)) { throw new Exception("The message text must contain one of '" + allowedTexts.toString() + "'"); } if (getTags().size() == 0) { throw new Exception("All repository messages must have at least one tag"); } super.validate(); }
Source:
<code>public StreamCaseMerge execute( IOperator operator ) { operator.setUDFBolt(this.getUDFBolt()); String[] sourceList = new String[sources.length]; for( int i=0; i < sources.length; i++ ) { sourceList[i] = sources[i].getNodeId(); <START> } <END> this.multipleOperators.addOperatorProcessingDescription( new OperatorProcessingDescription( operator, sourceList )); return casemerge; }</code><technical_language>Creating this list is implemented position in code. reuced implementation</technical_language>

Target:
public StreamCaseMerge execute(IOperator operator) { operator.setUDFBolt(getUDFBolt()); multipleOperators.addOperatorProcessingDescription(new OperatorProcessingDescription(operator, getSources() )); return casemerge; }
Source:
<code>public void handleMessage(Message<?> message) { Assert.notNull(message, "Message must not be null"); Assert.notNull(message.getPayload(), "Message payload must not be null"); if (this.loggingEnabled && this.logger.isDebugEnabled()) { this.logger.debug(this + " received message: " + message); } MetricsContext start = null; boolean countsEnabled = this.countsEnabled; AbstractMessageHandlerMetrics handlerMetrics = this.handlerMetrics; Object sample = null; if (countsEnabled && this.metricsCaptor != null) { sample = this.metricsCaptor.start(); <START> } <END> try { if (this.shouldTrack) { message = MessageHistory.write(message, this, getMessageBuilderFactory()); } if (countsEnabled) { start = handlerMetrics.beforeHandle(); handleMessageInternal(message); if (sample != null) { sendTimer().stop(sample); } handlerMetrics.afterHandle(start, true); } else { handleMessageInternal(message); } } catch (Exception e) { if (sample != null) { buildSendTimer(false, e.getClass().getSimpleName()).stop(sample); } if (countsEnabled) { handlerMetrics.afterHandle(start, false); } if (e instanceof MessagingException) { throw (MessagingException) e; } throw new MessageHandlingException(message, "error occurred in message handler [" + this + "]", e); } }</code><technical_language>This API is is consistent Timer.start(this.meterRegistry). do similar TimerFacade.start(this.metricsCaptor)? narrowing generic arg scope</technical_language>

Target:
public void handleMessage(Message<?> message) { Assert.notNull(message, "Message must not be null"); Assert.notNull(message.getPayload(), "Message payload must not be null"); if (this.loggingEnabled && this.logger.isDebugEnabled()) { this.logger.debug(this + " received message: " + message); } MetricsContext start = null; boolean countsEnabled = this.countsEnabled; AbstractMessageHandlerMetrics handlerMetrics = this.handlerMetrics; SampleFacade sample = null; if (countsEnabled && this.metricsCaptor != null) { sample = this.metricsCaptor.start(); } try { if (this.shouldTrack) { message = MessageHistory.write(message, this, getMessageBuilderFactory()); } if (countsEnabled) { start = handlerMetrics.beforeHandle(); handleMessageInternal(message); if (sample != null) { sample.stop(sendTimer()); } handlerMetrics.afterHandle(start, true); } else { handleMessageInternal(message); } } catch (Exception e) { if (sample != null) { sample.stop(buildSendTimer(false, e.getClass().getSimpleName())); } if (countsEnabled) { handlerMetrics.afterHandle(start, false); } throw IntegrationUtils.wrapInHandlingExceptionIfNecessary(message, () -> "error occurred in message handler [" + this + "]", e); } }
Source:
<code>public String getUserId() { <START> if (authenticationName == null) <END> return "N/A"; return authenticationName; }</code><technical_language>God kills a kitty time a developer writes "if" braces</technical_language>

Target:
public String getUserId() { if (authenticationName == null) { return "N/A"; } return authenticationName; }
Source:
<code>static public ResultHolder getPsiElementType(PsiElement element, @Nullable PsiElement resolveContext) { if (element == resolveContext) return SpecificTypeReference.getInvalid(element).createHolder(); if (element instanceof HaxeReferenceExpression) { PsiElement targetElement = ((HaxeReferenceExpression)element).resolve(); if (targetElement instanceof HaxePsiField) { return getTypeFromFieldDeclaration((HaxePsiField)targetElement, element); } } else if (element instanceof HaxeArrayLiteral) { HaxeArrayLiteral arrayLiteral = (HaxeArrayLiteral)element; if (arrayLiteral.getExpressionList() != null) { final List<HaxeExpression> expressions = arrayLiteral.getExpressionList().getExpressionList(); if (!expressions.isEmpty()) { ResultHolder arrayElementType = getPsiElementType(expressions.get(0), arrayLiteral.getContext()); <START> return SpecificTypeReference.createArray(arrayElementType).createHolder(); <END> } } PsiElement context = element.getContext(); if (context instanceof HaxeVarInit) { HaxePsiField field = PsiTreeUtil.getParentOfType(context, HaxePsiField.class); if (field != null) { SpecificHaxeClassReference fieldType = getTypeFromTypeTag(field.getTypeTag(), element).getClassType(); if (fieldType != null && fieldType.isArray()) { return SpecificTypeReference.createArray(fieldType.getArrayElementType()).createHolder(); } } } } return getPsiElementType(element, (AnnotationHolder)null).result; }</code><technical_language>this work Arrays of "Dynamic?" this array type element in case. And, if expressionList _is_ empty, assume "Dynamic?"</technical_language>

Target:
static public ResultHolder getPsiElementType(PsiElement element, @Nullable PsiElement resolveContext) { if (element == resolveContext) return SpecificTypeReference.getInvalid(element).createHolder(); if (element instanceof HaxeReferenceExpression) { PsiElement targetElement = ((HaxeReferenceExpression)element).resolve(); if (targetElement instanceof HaxePsiField) { return getTypeFromFieldDeclaration((HaxePsiField)targetElement, element); } } return getPsiElementType(element, (AnnotationHolder)null).result; }
Source:
<code><START> protected int getNbPendingBackgroundRequests() { <END> int nbBackgroundRequests = 0; synchronized (fLock) { for (ITmfEventRequest request : fPendingCoalescedRequests) { if (request.getExecType().equals(ExecutionType.BACKGROUND)) { nbBackgroundRequests++; } } } return nbBackgroundRequests; }</code><technical_language>this need protected, private? "number of background requests" is is specific internal implementation (just notion of foreground background, another story ;) )</technical_language>

Target:
private int getNbPendingBackgroundRequests() { int nbBackgroundRequests = 0; synchronized (fLock) { for (ITmfEventRequest request : fPendingCoalescedRequests) { if (request.getExecType().equals(ExecutionType.BACKGROUND)) { nbBackgroundRequests++; } } } return nbBackgroundRequests; }
Source:
<code>public void testParsingUncommonTimeZoneAbbreviations() { String fmt = "yyyy-MM-dd HH:mm:ss.SSS z"; String date = "2010-12-23 12:44:57.0 CET"; assertEquals(1293104697000L, parseDate(Locale.UK, fmt, date).getTimeInMillis()); try { parseDate(Locale.US, fmt, date); fail(); <START> } catch (junit.framework.AssertionFailedError expected) { <END> } }</code><technical_language>eh ? this</technical_language>

Target:
public void testParsingUncommonTimeZoneAbbreviations() { String fmt = "yyyy-MM-dd HH:mm:ss.SSS z"; String date = "2010-12-23 12:44:57.0 CET"; assertEquals(1293104697000L, parseDate(Locale.UK, fmt, date).getTimeInMillis()); assertCannotParse(Locale.US, fmt, date); }
Source:
<code>protected String generateHandlerBeanName(String originalBeanName, Method method, Class<? extends Annotation> annotationType) { return super.generateHandlerBeanName(originalBeanName, method, annotationType) <START> .replaceFirst(IntegrationConfigUtils.HANDLER_ALIAS_SUFFIX, ".source"); <END> }</code><technical_language>Needs be... return super.generateHandlerBeanName(originalBeanName, method, annotationType).replaceFirst( IntegrationConfigUtils.HANDLER_ALIAS_SUFFIX + "$", ".source"); in case method is called handler. $ forces match end of string</technical_language>

Target:
protected String generateHandlerBeanName(String originalBeanName, Method method, Class<? extends Annotation> annotationType) { return super.generateHandlerBeanName(originalBeanName, method, annotationType) .replaceFirst(IntegrationConfigUtils.HANDLER_ALIAS_SUFFIX + "$", ".source"); }
Source:
<code>public String getBackupIdentifier() { <START> return Const.SystemParams.BACKUP_LOG_MSG + GET_BACKUP_NAME + "::" + courseId; <END> }</code><technical_language>in multiple places</technical_language>

Target:
public String getBackupIdentifier() { return Const.SystemParams.BACKUP_LOG_MSG + ATTRIBUTE_NAME + "::" + feedbackResponseId; }
Source:
<code>private String createIndexIndexStatementForIndex(String indexName, List<String> columns) { String tableName = IndexManager.tableNameForIndex(indexName); String sqlIndexName = tableName.concat("_index"); Joiner joiner = Joiner.on(",").skipNulls(); String cols = joiner.join(columns); <START> return String.format("CREATE INDEX \"%s\" ON \"%s\" ( %s )", sqlIndexName, tableName, cols); <END> }</code><technical_language>This a specific Locale for String.format() default. affect in this case, safer explicitly a Locale</technical_language>

Target:
private String createIndexIndexStatementForIndex(String indexName, List<String> columns) { String tableName = IndexManager.tableNameForIndex(indexName); String sqlIndexName = tableName.concat("_index"); Joiner joiner = Joiner.on(",").skipNulls(); String cols = joiner.join(columns); return String.format(Locale.ENGLISH, "CREATE INDEX \"%s\" ON \"%s\" ( %s )", sqlIndexName, tableName, cols); }
Source:
<code>public void writeOutput(DataPipe cr) { try { for (Map.Entry<String, String> entry : cr.getDataMap().entrySet()) { <START> csvFile.write(entry.getValue()); <END> csvFile.write(","); } csvFile.write("\n"); } catch (IOException e) { System.out.println("ERROR! Failed to write to csv file"); } }</code><technical_language>opencvs similar for this piece ? Reason is if data a comma need quote, if a quotation a comma need escape. Instead of this headache, a library for us. <LINK_1> <LINK_0> Apache's license, ok use</technical_language>

Target:
public void writeOutput(DataPipe cr) { String[] nextLine = new String[cr.getDataMap().entrySet().size()]; int count = 0; for (Map.Entry<String, String> entry : cr.getDataMap().entrySet()) { nextLine[count] = entry.getValue(); count++; } csvFile.writeNext(nextLine); }
Source:
<code>protected void doUpdateItem(Widget widget, E element, boolean fullMap) { boolean oldBusy = isBusy(); setBusy(true); try { if (widget instanceof Item) { final Item item = (Item) widget; if (fullMap) { associate(element, item); } else { <START> E data = (E) item.getData(); <END> if (data != null) { unmapElement(data, item); } item.setData(element); mapElement(element, item); } int columnCount = doGetColumnCount(); if (columnCount == 0) columnCount = 1; ViewerRow<E> viewerRowFromItem = getViewerRowFromItem(item); boolean isVirtual = (getControl().getStyle() & SWT.VIRTUAL) != 0; if (isVirtual) { viewerRowFromItem = (ViewerRow<E>) viewerRowFromItem.clone(); } for (int column = 0; column < columnCount || column == 0; column++) { ViewerColumn<E,I> columnViewer = getViewerColumn(column); ViewerCell<E> cellToUpdate = updateCell(viewerRowFromItem, column, element); if (isVirtual) { cellToUpdate = new ViewerCell<E>(cellToUpdate.getViewerRow(), cellToUpdate.getColumnIndex(), element); } columnViewer.refresh(cellToUpdate); updateCell(null, 0, null); if (item.isDisposed()) { unmapElement(element, item); return; } } } } finally { setBusy(oldBusy); } }</code><technical_language>this need a @SuppressWarnings("unchecked")</technical_language>

Target:
protected void doUpdateItem(Widget widget, E element, boolean fullMap) { boolean oldBusy = isBusy(); setBusy(true); try { if (widget instanceof Item) { final Item item = (Item) widget; if (fullMap) { associate(element, item); } else { @SuppressWarnings("unchecked") E data = (E) item.getData(); if (data != null) { unmapElement(data, item); } item.setData(element); mapElement(element, item); } int columnCount = doGetColumnCount(); if (columnCount == 0) columnCount = 1; ViewerRow<E> viewerRowFromItem = getViewerRowFromItem(item); boolean isVirtual = (getControl().getStyle() & SWT.VIRTUAL) != 0; if (isVirtual) { @SuppressWarnings("unchecked") ViewerRow<E> viewerRowFromItemClone = (ViewerRow<E>) viewerRowFromItem.clone(); viewerRowFromItem = viewerRowFromItemClone; } for (int column = 0; column < columnCount || column == 0; column++) { ViewerColumn<E,I> columnViewer = getViewerColumn(column); ViewerCell<E> cellToUpdate = updateCell(viewerRowFromItem, column, element); if (isVirtual) { cellToUpdate = new ViewerCell<E>(cellToUpdate.getViewerRow(), cellToUpdate.getColumnIndex(), element); } columnViewer.refresh(cellToUpdate); updateCell(null, 0, null); if (item.isDisposed()) { unmapElement(element, item); return; } } } } finally { setBusy(oldBusy); } }
Source:
<code><START> protected void deleteFile(String fileName) throws IOException <END> { Path dataFilePath = new Path(bucketRoot + PATH_SEPARATOR + fileName); FileSystem fs = FileSystem.newInstance(dataFilePath.toUri(), configuration); try { if (fs.exists(dataFilePath)) { logger.debug("start delete {}", fileName); fs.delete(dataFilePath, true); logger.debug("end delete {}", fileName); } } finally { fs.close(); } }</code><technical_language>is this change needed? I this overwritten other class. Is this for a future change</technical_language>

Target:
protected void deleteFile(String fileName) throws IOException { Path dataFilePath = new Path(bucketRoot + PATH_SEPARATOR + fileName); try (FileSystem fs = FileSystem.newInstance(dataFilePath.toUri(), configuration)) { if (fs.exists(dataFilePath)) { logger.debug("start delete {}", fileName); fs.delete(dataFilePath, true); logger.debug("end delete {}", fileName); } } }
Source:
<code>private List<String> getConsumerTopics(Properties props, String group) { List<String> ret = new ArrayList<>(); AdminClient client = AdminClient.create(props); Map<TopicPartition, Object> response = JavaConversions.mapAsJavaMap(client.listGroupOffsets(group)); for (TopicPartition tp : response.keySet()) { ret.add(tp.topic()); } <START> return ret; <END> }</code><technical_language>return JavaConversions.mapAsJavaMap(client.listGroupOffsets(group)).keySet().stream().map(TopicPartition::topic).collect(Collectors.toList()</technical_language>

Target:
private List<String> getConsumerTopics(Properties props, String group) { AdminClient client = AdminClient.create(props); return JavaConversions.mapAsJavaMap(client.listGroupOffsets(group)) .keySet() .stream() .map(TopicPartition::topic) .collect(Collectors.toList()); }
Source:
<code>public Stands stands() { try { return new RestStands( URI.create( <START> new JdkRequest(UriBuilder.fromUri(this.home).build()) <END> .header(HttpHeaders.ACCEPT, MediaType.APPLICATION_XML) .header(HttpHeaders.AUTHORIZATION, this.token) .method(Request.GET) .fetch() .as(RestResponse.class) .assertStatus(HttpURLConnection.HTTP_OK) .as(XmlResponse.class) .assertXPath("/page/links/link[@rel='stands']") .xml() .xpath("/page/links/link[@rel='stands']/@href") .get(0) ), this.token ); } catch (IOException ex) { throw new IllegalStateException(ex); } }</code><technical_language>need UriBuilder</technical_language>

Target:
public Stands stands() { try { return new RestStands( URI.create( new JdkRequest(this.home) .header(HttpHeaders.ACCEPT, MediaType.APPLICATION_XML) .header(HttpHeaders.AUTHORIZATION, this.token) .fetch() .as(RestResponse.class) .assertStatus(HttpURLConnection.HTTP_OK) .as(XmlResponse.class) .assertXPath("/page/links/link[@rel='stands']") .xml() .xpath("/page/links/link[@rel='stands']/@href") .get(0) ), this.token ); } catch (IOException ex) { throw new IllegalStateException(ex); } }
Source:
<code>public AccountServiceConfig(VerifiableProperties verifiableProperties) { containerIdStartNumber = <START> verifiableProperties.getShortInRange(CONTAINER_ID_START_NUMBER, (short) 0, (short) 0, Short.MAX_VALUE); <END> }</code><technical_language>default start 1 (matching at-default above)? this is coming previous PR</technical_language>

Target:
public AccountServiceConfig(VerifiableProperties verifiableProperties) { containerIdStartNumber = verifiableProperties.getShortInRange(CONTAINER_ID_START_NUMBER, (short) 1, (short) 0, Short.MAX_VALUE); }
Source:
<code>protected Object getGreaterValue(Object value) { byte[] address = ((Slice) value).getBytes(); checkState(++address[address.length - 1] != 0, "Last byte of address is 0xff"); try { <START> return InetAddresses.toAddrString(InetAddress.getByAddress(address)); <END> } catch (UnknownHostException e) { throwIfUnchecked(e); throw new AssertionError(e); } }</code><technical_language>This is wrong. getNonNullValueForType is supposed return a non-null represented in native container type. native container type of IpAddressType is binary representation in Slice</technical_language>

Target:
protected Object getGreaterValue(Object value) { byte[] address = ((Slice) value).getBytes(); checkState(++address[address.length - 1] != 0, "Last byte of address is 0xff"); return Slices.wrappedBuffer(address); }
Source:
<code><START> public PagedFlux<DigitalTwinModelData> createModels(List<String> models) { <END> return new PagedFlux<>( () -> withContext(context -> createModelsSinglePageAsync(models, context)), nextLink -> withContext(context -> Mono.empty())); }</code><technical_language>call this ModelData in .NET client, call well</technical_language>

Target:
public PagedFlux<ModelData> createModels(List<String> models) { return new PagedFlux<>( () -> withContext(context -> createModelsSinglePageAsync(models, context)), nextLink -> withContext(context -> Mono.empty())); }
Source:
<code>public void showWait() { <START> setCenter(waitPanel); <END> }</code><technical_language>I call closeDetailsView too</technical_language>

Target:
public void showWait() { closeDetailsView(); setCenter(waitPanel); }
Source:
<code>private long calculateRemainingEntriesToSend(long ackedTimestamp) { long maxReplicatedStreamTail = getMaxReplicatedStreamsTail(); if (maxReplicatedStreamTail == Address.NON_ADDRESS) { return NO_REPLICATION_REMAINING_ENTRIES; } if (ackedTimestamp == Address.NON_ADDRESS && <START> lastSyncType == LogReplicationMetadata.ReplicationStatusVal.SyncType.SNAPSHOT) { <END> return maxReplicatedStreamTail; } if (lastSyncType == LogReplicationMetadata.ReplicationStatusVal.SyncType.LOG_ENTRY) { long remainingEntriesToSend = 0; for (String stream : config.getStreamsToReplicate()) { UUID streamId = CorfuRuntime.getStreamID(stream); StreamAddressRange range = new StreamAddressRange(streamId, maxReplicatedStreamTail, ackedTimestamp); StreamAddressSpace addressSpace = runtime.getSequencerView().getStreamAddressSpace(range); remainingEntriesToSend += addressSpace.getAddressMap().getLongCardinality(); return remainingEntriesToSend; } } return (baseSnapshotTimestamp - ackedTimestamp) + (maxReplicatedStreamTail - baseSnapshotTimestamp); }</code><technical_language>add like: exact number of entries inferred data checkpointed, send max stream tail</technical_language>

Target:
private long calculateRemainingEntriesToSend(long ackedTimestamp) { long maxReplicatedStreamTail = getMaxReplicatedStreamsTail(); if (maxReplicatedStreamTail == Address.NON_ADDRESS) { return NO_REPLICATION_REMAINING_ENTRIES; } if (ackedTimestamp == Address.NON_ADDRESS && lastSyncType == LogReplicationMetadata.ReplicationStatusVal.SyncType.SNAPSHOT) { ackedTimestamp = 0; } if (lastSyncType == LogReplicationMetadata.ReplicationStatusVal.SyncType.LOG_ENTRY) { return calculateRemainingEntriesForLogEntrySync(maxReplicatedStreamTail, ackedTimestamp); } return ((baseSnapshotTimestamp - ackedTimestamp) + calculateRemainingEntriesForLogEntrySync(maxReplicatedStreamTail, baseSnapshotTimestamp)); }
Source:
<code>private double getOutputSizeForSymbol(SymbolStatsEstimate symbolStatistics, Type type) <START> { <END> double averageRowSize = symbolStatistics.getAverageRowSize(); double numberOfNonNullRows = outputRowCount * (1.0 - firstNonNaN(symbolStatistics.getNullsFraction(), 0d)); if (isNaN(averageRowSize)) { if (type instanceof FixedWidthType) { averageRowSize = ((FixedWidthType) type).getFixedSize(); } else { averageRowSize = DEFAULT_DATA_SIZE_PER_COLUMN; } } return numberOfNonNullRows * averageRowSize; }</code><technical_language>validate type null (especially is a map, null silently)</technical_language>

Target:
private double getOutputSizeForSymbol(SymbolStatsEstimate symbolStatistics, Type type) { checkArgument(type != null, "type is null"); double averageRowSize = symbolStatistics.getAverageRowSize(); double nullsFraction = firstNonNaN(symbolStatistics.getNullsFraction(), 0d); double numberOfNonNullRows = outputRowCount * (1.0 - nullsFraction); if (isNaN(averageRowSize)) { if (type instanceof FixedWidthType) { averageRowSize = ((FixedWidthType) type).getFixedSize(); } else { averageRowSize = DEFAULT_DATA_SIZE_PER_COLUMN; } } double outputSize = numberOfNonNullRows * averageRowSize; outputSize += outputRowCount * Byte.BYTES; if (type instanceof VariableWidthType) { outputSize += outputRowCount * Integer.BYTES; } return outputSize; }
Source:
<code>public static AcidStats parseAcidStats(Reader reader) { if (reader.hasMetadataValue(ACID_STATS)) { String statsSerialized; try { <START> ByteBuffer val = <END> reader.getMetadataValue(ACID_STATS) .duplicate(); statsSerialized = utf8Decoder.decode(val).toString(); } catch (CharacterCodingException e) { throw new IllegalArgumentException("Bad string encoding for " + ACID_STATS, e); } return new AcidStats(statsSerialized); } else { return null; } }</code><technical_language>nit: bad alignment</technical_language>

Target:
public static AcidStats parseAcidStats(Reader reader) { if (reader.hasMetadataValue(ACID_STATS)) { try { ByteBuffer val = reader.getMetadataValue(ACID_STATS).duplicate(); return new AcidStats(utf8Decoder.decode(val).toString()); } catch (CharacterCodingException e) { throw new IllegalArgumentException("Bad string encoding for " + ACID_STATS, e); } } else { return null; } }
Source:
<code>public RegisterTemplateModel() { <START> super(); <END> this.externalVnicProfilesPerTargetCluster = new HashMap<>(); }</code><technical_language>redundant. 'super()' is called if call other ctor explicitly</technical_language>

Target:
public RegisterTemplateModel() { this.externalVnicProfilesPerTargetCluster = new HashMap<>(); }
Source:
<code>public Map<TaskDataDto, Map<String, TestInfoDto>> getTestInfoByTaskDataDto(Collection<TaskDataDto> taskDataDtos) throws RuntimeException { if (taskDataDtos.isEmpty()) { return Collections.emptyMap(); } long temp = System.currentTimeMillis(); Set<Long> taskDataIds = new HashSet<Long>(); for (TaskDataDto taskDataDto : taskDataDtos) { taskDataIds.addAll(taskDataDto.getIds()); } <START> Map<Long,Map<String,TestInfoDto>> preliminaryResult = fetchUtil.getTestInfoByTaskIds(taskDataIds); <END> Map<TaskDataDto, Map<String, TestInfoDto>> resultMap = new HashMap<TaskDataDto, Map<String, TestInfoDto>>(taskDataDtos.size()); for (Map.Entry<Long,Map<String,TestInfoDto>> entry : preliminaryResult.entrySet()) { for (TaskDataDto td : taskDataDtos) { if (td.getIds().contains(entry.getKey())) { if (!resultMap.containsKey(td)) { resultMap.put(td, new HashMap<String, TestInfoDto>()); } resultMap.get(td).putAll(entry.getValue()); break; } } } log.debug("Time spent for testInfo fetching for taskDataDtos : {}ms", new Object[]{taskDataDtos.size(), System.currentTimeMillis() - temp}); return resultMap; }</code><technical_language>direct call this function DatabaseService interface</technical_language>

Target:
public Map<TaskDataDto, Map<String, TestInfoDto>> getTestInfoByTaskDataDto(Collection<TaskDataDto> taskDataDtos) throws RuntimeException { if (taskDataDtos.isEmpty()) { return Collections.emptyMap(); } long temp = System.currentTimeMillis(); Set<Long> taskDataIds = new HashSet<Long>(); for (TaskDataDto taskDataDto : taskDataDtos) { taskDataIds.addAll(taskDataDto.getIds()); } Map<Long,Map<String,TestInfoDto>> preliminaryResult = getTestInfoByTaskIds(taskDataIds); Map<TaskDataDto, Map<String, TestInfoDto>> resultMap = new HashMap<TaskDataDto, Map<String, TestInfoDto>>(taskDataDtos.size()); for (Map.Entry<Long,Map<String,TestInfoDto>> entry : preliminaryResult.entrySet()) { for (TaskDataDto td : taskDataDtos) { if (td.getIds().contains(entry.getKey())) { if (!resultMap.containsKey(td)) { resultMap.put(td, new HashMap<String, TestInfoDto>()); } resultMap.get(td).putAll(entry.getValue()); break; } } } log.debug("Time spent for testInfo fetching for taskDataDtos : {}ms", new Object[]{taskDataDtos.size(), System.currentTimeMillis() - temp}); return resultMap; }
Source:
<code>private static File getReportsDirectoryFromDeprecatedProperty(Settings settings, FileSystem fs, PathResolver pathResolver) { if(settings.hasKey(SUREFIRE_REPORTS_PATH_PROPERTY)) { <START> LOGGER.info(String.format("Property '%s' is deprecated. Use property '%s' instead.", <END> SUREFIRE_REPORTS_PATH_PROPERTY, SUREFIRE_REPORT_PATHS_PROPERTY)); String path = settings.getString(SUREFIRE_REPORTS_PATH_PROPERTY); if (path != null) { return getFileFromPath(fs, pathResolver, path); } } return null; }</code><technical_language>need for String.format</technical_language>

Target:
private static File getReportsDirectoryFromDeprecatedProperty(Settings settings, FileSystem fs, PathResolver pathResolver) { if(settings.hasKey(SUREFIRE_REPORTS_PATH_PROPERTY)) { LOGGER.info("Property '{}' is deprecated. Use property '{}' instead.", SUREFIRE_REPORTS_PATH_PROPERTY, SUREFIRE_REPORT_PATHS_PROPERTY); String path = settings.getString(SUREFIRE_REPORTS_PATH_PROPERTY); if (path != null) { return getFileFromPath(fs, pathResolver, path); } } return null; }
Source:
<code>public void onViewStateRestored(Bundle savedInstanceState) { super.onViewStateRestored(savedInstanceState); if (savedInstanceState != null) { FormFieldsWrapper formFieldsWrapper = (FormFieldsWrapper) savedInstanceState.getSerializable(ApplicationConstants.BundleKeys.FORM_FIELDS_BUNDLE); inputFields = formFieldsWrapper.getInputFields(); for(InputField field:inputFields){ DiscreteSeekBar sb = (DiscreteSeekBar) getActivity().findViewById(field.getId()); <START> if(sb != null) { <END> sb.setProgress(field.getValue().intValue()); } if(field.isRed()){ RangeEditText ed = (RangeEditText) getActivity().findViewById(field.getId()); ed.setTextColor(ContextCompat.getColor(OpenMRS.getInstance(), R.color.red)); } } selectOneFields = formFieldsWrapper.getSelectOneFields(); } }</code><technical_language>@Rimjhim28 check if InputField is of type DiscreteSeekBar? more readable correct</technical_language>

Target:
public void onViewStateRestored(Bundle savedInstanceState) { super.onViewStateRestored(savedInstanceState); if (savedInstanceState != null) { FormFieldsWrapper formFieldsWrapper = (FormFieldsWrapper) savedInstanceState.getSerializable(ApplicationConstants.BundleKeys.FORM_FIELDS_BUNDLE); inputFields = formFieldsWrapper.getInputFields(); for(InputField field:inputFields){ View v = getActivity().findViewById(field.getId()); if(v != null && v instanceof DiscreteSeekBar) { DiscreteSeekBar sb = (DiscreteSeekBar) v; sb.setProgress(field.getValue().intValue()); } if(field.isRed()){ RangeEditText ed = (RangeEditText) getActivity().findViewById(field.getId()); ed.setTextColor(ContextCompat.getColor(OpenMRS.getInstance(), R.color.red)); } } selectOneFields = formFieldsWrapper.getSelectOneFields(); } }
Source:
<code>void disableRecovery() { if (lraRecoveryModule != null) { Implementations.uninstall(); RecoveryManager.manager().removeModule(lraRecoveryModule, false); lraRecoveryModule = null; <START> if (LRALogger.logger.isDebugEnabled()) { <END> LRALogger.logger.debugf("LRAServicve.disableRecovery%n"); } } }</code><technical_language>I note this is currently a no-op I if a separate JBTM removing RecordTypeManager reverse install</technical_language>

Target:
void disableRecovery() { if (lraRecoveryModule != null) { RecoveryManager.manager().removeModule(lraRecoveryModule, false); Implementations.uninstall(); lraRecoveryModule = null; if (LRALogger.logger.isDebugEnabled()) { LRALogger.logger.debugf("LRAServicve.disableRecovery"); } } }
Source:
<code>public Map<String, List<DatastreamTask>> getTasksToCleanUp(List<DatastreamGroup> datastreamGroups, Map<String, Set<DatastreamTask>> currentAssignment) { Set<String> datastreamGroupsSet = datastreamGroups.stream().map(DatastreamGroup::getTaskPrefix).collect(Collectors.toSet()); Map<String, List<DatastreamTask>> tasksToCleanUp = new HashMap<>(); Map<String, DatastreamTask> assignmentsMap = currentAssignment.values() .stream() .flatMap(Collection::stream) .collect(Collectors.toMap(DatastreamTask::getDatastreamTaskName, Function.identity())); for (String instance : currentAssignment.keySet()) { <START> List<DatastreamTask> tasksPerInstance = currentAssignment.get(instance) <END> .stream() .filter(t -> datastreamGroupsSet.contains(t.getTaskPrefix())) .map(task -> ((DatastreamTaskImpl) task).getDependencies()) .flatMap(Collection::stream) .map(assignmentsMap::get) .filter(Objects::nonNull) .collect(Collectors.toList()); if (!tasksPerInstance.isEmpty()) { tasksToCleanUp.put(instance, tasksPerInstance); } } return tasksToCleanUp; }</code><technical_language>nit: rename tasksPerInstance dependencyTasksPerInstance (since this is actual filtering logic, final list consists of dependency tasks left in assignment)</technical_language>

Target:
public Map<String, List<DatastreamTask>> getTasksToCleanUp(List<DatastreamGroup> datastreamGroups, Map<String, Set<DatastreamTask>> currentAssignment) { Set<String> datastreamGroupsSet = datastreamGroups.stream().map(DatastreamGroup::getTaskPrefix).collect(Collectors.toSet()); Map<String, List<DatastreamTask>> tasksToCleanUp = new HashMap<>(); Map<String, DatastreamTask> assignmentsMap = currentAssignment.values() .stream() .flatMap(Collection::stream) .collect(Collectors.toMap(DatastreamTask::getDatastreamTaskName, Function.identity())); for (String instance : currentAssignment.keySet()) { List<DatastreamTask> dependencyTasksPerInstance = currentAssignment.get(instance) .stream() .filter(t -> datastreamGroupsSet.contains(t.getTaskPrefix())) .map(task -> ((DatastreamTaskImpl) task).getDependencies()) .flatMap(Collection::stream) .map(assignmentsMap::get) .filter(Objects::nonNull) .collect(Collectors.toList()); if (!dependencyTasksPerInstance.isEmpty()) { tasksToCleanUp.put(instance, dependencyTasksPerInstance); } } return tasksToCleanUp; }
Source:
<code>public void testMultipleCookies() throws IOException { String requestURI = OAuthClient.AUTH_SERVER_ROOT + "/realms/foo/account"; Calendar calendar = Calendar.getInstance(); calendar.add(Calendar.DAY_OF_YEAR, 1); BasicClientCookie wrongCookie = new BasicClientCookie(AuthenticationSessionManager.AUTH_SESSION_ID, AUTH_SESSION_VALUE); wrongCookie.setDomain("localhost"); wrongCookie.setPath(OLD_COOKIE_PATH); wrongCookie.setExpiryDate(calendar.getTime()); CookieStore cookieStore = getCorrectCookies(requestURI); cookieStore.addCookie(wrongCookie); Assert.assertThat(cookieStore.getCookies(), Matchers.hasSize(3)); login(requestURI, cookieStore); <START> Assert.assertThat(cookieStore.getCookies().stream().map(c -> c.getName()).collect(Collectors.toList()), <END> Matchers.containsInAnyOrder("AUTH_SESSION_ID", "KEYCLOAK_IDENTITY", "KEYCLOAK_SESSION")); cookieStore.getCookies().stream().map(c -> c.getPath()).forEach(path ->Assert.assertThat(path, Matchers.endsWith("/"))); String authSessionId = cookieStore.getCookies().stream().filter(c -> "AUTH_SESSION_ID".equals(c.getName())).findFirst().get().getValue(); String KCSessionId = cookieStore.getCookies().stream().filter(c -> "KEYCLOAK_SESSION".equals(c.getName())).findFirst().get().getValue(); String KCSessionSuffix = KCSessionId.split("/")[2]; Assert.assertThat(authSessionId, Matchers.containsString(KCSessionSuffix)); }</code><technical_language>Nit: prefer method reference a lambda for performance reasons (smaller memory footprint) suggestion Assert.assertThat(cookieStore.getCookies().stream().map(Cookie::getName).collect(Collectors.toList()),</technical_language>

Target:
public void testMultipleCookies() throws IOException { String requestURI = OAuthClient.AUTH_SERVER_ROOT + "/realms/foo/account"; Calendar calendar = Calendar.getInstance(); calendar.add(Calendar.DAY_OF_YEAR, 1); BasicClientCookie wrongCookie = new BasicClientCookie(AuthenticationSessionManager.AUTH_SESSION_ID, AUTH_SESSION_VALUE); wrongCookie.setDomain("localhost"); wrongCookie.setPath(OLD_COOKIE_PATH); wrongCookie.setExpiryDate(calendar.getTime()); CookieStore cookieStore = getCorrectCookies(requestURI); cookieStore.addCookie(wrongCookie); Assert.assertThat(cookieStore.getCookies(), Matchers.hasSize(3)); login(requestURI, cookieStore); Assert.assertThat(cookieStore.getCookies().stream().map(org.apache.http.cookie.Cookie::getName).collect(Collectors.toList()), Matchers.containsInAnyOrder("AUTH_SESSION_ID", "KEYCLOAK_IDENTITY", "KEYCLOAK_SESSION")); cookieStore.getCookies().stream().map(org.apache.http.cookie.Cookie::getPath).forEach(path ->Assert.assertThat(path, Matchers.endsWith("/"))); String authSessionId = cookieStore.getCookies().stream().filter(c -> "AUTH_SESSION_ID".equals(c.getName())).findFirst().get().getValue(); String KCSessionId = cookieStore.getCookies().stream().filter(c -> "KEYCLOAK_SESSION".equals(c.getName())).findFirst().get().getValue(); String KCSessionSuffix = KCSessionId.split("/")[2]; Assert.assertThat(authSessionId, Matchers.containsString(KCSessionSuffix)); }
Source:
<code>public void setData(@Nullable ISegmentStoreProvider provider) { fSegmentProvider = provider; if (provider == null) { updateModel(null); return; } SegmentStoreTableDataProvider tableProvider = null; <START> if(fTrace != <END> null) { tableProvider = SegmentStoreTableDataProvider.getOrCreate(fTrace, provider); } fDataProvider = tableProvider; createColumns(); ISegmentStore<ISegment> segStore = provider.getSegmentStore(); if (segStore != null && tableProvider != null) { updateModel(tableProvider); return; } updateModel(null); SegmentStoreProviderProgressListener listener = fListener; if (listener != null) { provider.addListener(listener); } if (provider instanceof IAnalysisModule) { ((IAnalysisModule) provider).schedule(); } }</code><technical_language>extract a local valuable</technical_language>

Target:
public void setData(@Nullable ISegmentStoreProvider provider) { fSegmentProvider = provider; if (provider == null) { updateModel(null); return; } SegmentStoreTableDataProvider tableProvider = null; ITmfTrace trace = fTrace; if(trace != null) { tableProvider = SegmentStoreTableDataProvider.getOrCreate(trace, provider); } fDataProvider = tableProvider; createColumns(); ISegmentStore<ISegment> segStore = provider.getSegmentStore(); if (segStore != null && tableProvider != null) { updateModel(tableProvider); return; } updateModel(null); SegmentStoreProviderProgressListener listener = fListener; if (listener != null) { provider.addListener(listener); } if (provider instanceof IAnalysisModule) { ((IAnalysisModule) provider).schedule(); } }
Source:
<code>protected void persistNonRDFSource(final ResourceOperation operation, final OCFLObjectSession objectSession, final String rootIdentifier) throws PersistentStorageException { final var resourceId = operation.getResourceId(); final var fedoraSubpath = relativizeSubpath(rootIdentifier, resourceId); final var subpath = resolveOCFLSubpath(rootIdentifier, fedoraSubpath); log.debug("persisting ({}) to {}", resourceId, subpath); final var nonRdfSourceOperation = (NonRdfSourceOperation) operation; final FileWriteOutcome outcome; if (forExternalBinary(nonRdfSourceOperation)) { outcome = null; } else { final var transmissionDigestAlg = objectSession.getObjectDigestAlgorithm(); final var providedDigests = nonRdfSourceOperation.getContentDigests(); final var multiDigestWrapper = new MultiDigestInputStreamWrapper( nonRdfSourceOperation.getContentStream(), providedDigests, <START> Arrays.asList(transmissionDigestAlg)); <END> final var contentStream = multiDigestWrapper.getInputStream(); outcome = (FileWriteOutcome) objectSession.write(subpath, contentStream); if (!CollectionUtils.isEmpty(providedDigests)) { multiDigestWrapper.checkFixity(); } outcome.setDigests(multiDigestWrapper.getDigests()); objectSession.registerTransmissionDigest(subpath, multiDigestWrapper.getDigest(transmissionDigestAlg)); } final var headers = populateHeaders(objectSession, subpath, nonRdfSourceOperation, outcome, fedoraSubpath.isEmpty()); writeHeaders(objectSession, headers, subpath); }</code><technical_language>need change, this constructed List.of()</technical_language>

Target:
protected void persistNonRDFSource(final ResourceOperation operation, final OCFLObjectSession objectSession, final String rootIdentifier) throws PersistentStorageException { final var resourceId = operation.getResourceId(); final var fedoraSubpath = relativizeSubpath(rootIdentifier, resourceId); final var subpath = resolveOCFLSubpath(rootIdentifier, fedoraSubpath); log.debug("persisting ({}) to {}", resourceId, subpath); final var nonRdfSourceOperation = (NonRdfSourceOperation) operation; final FileWriteOutcome outcome; if (forExternalBinary(nonRdfSourceOperation)) { outcome = null; } else { final var transmissionDigestAlg = objectSession.getObjectDigestAlgorithm(); final var providedDigests = nonRdfSourceOperation.getContentDigests(); final var multiDigestWrapper = new MultiDigestInputStreamWrapper( nonRdfSourceOperation.getContentStream(), providedDigests, List.of(transmissionDigestAlg)); final var contentStream = multiDigestWrapper.getInputStream(); outcome = (FileWriteOutcome) objectSession.write(subpath, contentStream); if (!CollectionUtils.isEmpty(providedDigests)) { multiDigestWrapper.checkFixity(); } outcome.setDigests(multiDigestWrapper.getDigests()); objectSession.registerTransmissionDigest(subpath, multiDigestWrapper.getDigest(transmissionDigestAlg)); } final var headers = populateHeaders(objectSession, subpath, nonRdfSourceOperation, outcome, fedoraSubpath.isEmpty()); writeHeaders(objectSession, headers, subpath); }