auphong2707/dl4se-code-review-dataset huggingface dataset:
Source:
<code><START> public ListViewInitializer<T> withEmptyListView(View emptyView, ViewRenderer<View, D> emptyViewRenderer, D data) { <END> listView.setEmptyView(emptyView); emptyViewRenderer.render(emptyView, data); return this; }</code><technical_language>Templete this method adding a <D> start</technical_language>

Target:
public <D> ListViewInitializer<T> withEmptyListView(View emptyView, ViewRenderer<View, D> emptyViewRenderer, D data) { emptyViewRenderer.render(emptyView, data); return this; }
Source:
<code>public void onContextEstablished(EndpointContext context) { <START> exchange.setSendTimestamp(ClockUtil.nanoRealtime()); <END> exchange.setEndpointContext(context); }</code><technical_language>reason set this onContextEstablished instead of onSent ? (I remember this behave in case of blockwise transfer :thinking:) (should setTimestamp message in case exchange is null (see line 776))</technical_language>

Target:
public void onContextEstablished(EndpointContext context) { exchange.setEndpointContext(context); }
Source:
<code>private void setConfirmResultConverter() { setResultConverter((dialogButton) -> { List<PickerMilestone> finalList = state.getCurrentMilestonesList(); Optional<PickerMilestone> selectedMilestone = PickerMilestone.getSelectedMilestone(finalList); if (selectedMilestone.isPresent()) { <START> return new MilestonePickerDialogResponse(dialogButton, Optional.of(selectedMilestone.get().getId())); <END> } return new MilestonePickerDialogResponse(dialogButton, Optional.empty()); }); }</code><technical_language>selectedMilestone.map(PickerMilestone::getId) here? I get rid of Optional.of()</technical_language>

Target:
private void setConfirmResultConverter() { setResultConverter((dialogButton) -> { List<PickerMilestone> finalList = state.getCurrentMilestonesList(); Optional<PickerMilestone> selectedMilestone = PickerMilestone.getSelectedMilestone(finalList); return new MilestonePickerDialogResponse(dialogButton, selectedMilestone.map(PickerMilestone::getId)); }); }
Source:
<code>public String solveProblemForSingle() { try { serviceManager.getWorkflowService().setSolution(getSolution()); try { setCurrentStep(serviceManager.getWorkflowService().solveProblem(this.currentStep, this.solutionTask)); } catch (DataException e) { <START> logger.error("Problem couldn't be solved: " + e); <END> } saveStep(); this.solution.setMessage(""); this.solutionTask = ""; AktuelleSchritteForm asf = (AktuelleSchritteForm) Helper.getManagedBeanValue("#{AktuelleSchritteForm}"); return asf.filterAll(); } catch (AuthenticationException e) { Helper.setFehlerMeldung(e.getMessage()); return ""; } }</code><technical_language>2 things: 1) If a DataException is thrown is a good idea on? 2) this kind of error logging work casting exception object string message</technical_language>

Target:
public String solveProblemForSingle() { try { serviceManager.getWorkflowService().setSolution(getSolution()); try { setCurrentStep(serviceManager.getWorkflowService().solveProblem(this.currentStep, this.solutionTask)); saveStep(); } catch (DataException e) { logger.error("Problem couldn't be solved: " + e); } this.solution.setMessage(""); this.solutionTask = ""; AktuelleSchritteForm asf = (AktuelleSchritteForm) Helper.getManagedBeanValue("#{AktuelleSchritteForm}"); return asf.filterAll(); } catch (AuthenticationException e) { Helper.setFehlerMeldung(e.getMessage()); return ""; } }
Source:
<code>public int hashCode() { final int prime = 31; int result = 1; <START> IOseeBranch thisbranch = this.getBranch(); <END> result = prime * result + ((thisbranch == null) ? 0 : thisbranch.hashCode()); result = prime * result + this.getTransaction(); return result; }</code><technical_language>thisbranch null? i other methods in this class calling getBranch() check for null</technical_language>

Target:
public int hashCode() { final int prime = 31; int result = 1; IOseeBranch branch = getBranch(); result = prime * result + ((branch == null) ? 0 : branch.hashCode()); result = prime * result + getTransaction(); return result; }
Source:
<code>private LimitQueryDeterminismAnalysis analyzeLimitNoOrderBy(Query newLimitQuery, long limit) { Query rowCountQuery = simpleQuery( new Select(false, ImmutableList.of(new SingleColumn(new FunctionCall(QualifiedName.of("count"), ImmutableList.of(new LongLiteral("1")))))), new TableSubquery(newLimitQuery)); QueryResult<Long> result = callWithQueryStatsConsumer( () -> prestoAction.execute(rowCountQuery, DETERMINISM_ANALYSIS, resultSet -> resultSet.getLong(1)), stats -> verificationContext.setLimitQueryAnalysisQueryId(stats.getQueryId())); long rowCountNoLimit = getOnlyElement(result.getResults()); <START> if (rowCountNoLimit == rowCount) { <END> return DETERMINISTIC; } if (rowCount >= limit && rowCountNoLimit > rowCount) { return NON_DETERMINISTIC; } return FAILED_DATA_CHANGED; }</code><technical_language>nit: perhaps, rename rowCountNoLimit avoid suggesting query limit, a higher limit rowCountHigherLimit</technical_language>

Target:
private LimitQueryDeterminismAnalysis analyzeLimitNoOrderBy(Query newLimitQuery, long limit) { Query rowCountQuery = simpleQuery( new Select(false, ImmutableList.of(new SingleColumn(new FunctionCall(QualifiedName.of("count"), ImmutableList.of(new LongLiteral("1")))))), new TableSubquery(newLimitQuery)); QueryResult<Long> result = callWithQueryStatsConsumer( () -> prestoAction.execute(rowCountQuery, DETERMINISM_ANALYSIS, resultSet -> resultSet.getLong(1)), stats -> verificationContext.setLimitQueryAnalysisQueryId(stats.getQueryId())); long rowCountHigherLimit = getOnlyElement(result.getResults()); if (rowCountHigherLimit == rowCount) { return DETERMINISTIC; } if (rowCount >= limit && rowCountHigherLimit > rowCount) { return NON_DETERMINISTIC; } return FAILED_DATA_CHANGED; }
Source:
<code>protected String readCronTabFile(InputStream cronInputStream) throws IOException { final StringBuilder cronFileBasicInfo = new StringBuilder("#!/bin/bash") .append(NEW_LINE) .append("SHELL=/bin/sh") .append(NEW_LINE) .append("PATH=/usr/local/sbin:/usr/local/bin:/sbin:/bin:/usr/sbin:/usr/bin") .append(NEW_LINE).append("# m h dom mon dow user command") .append(NEW_LINE); if (cronInputStream != null) { try { InputStreamReader isReader = new InputStreamReader( cronInputStream); BufferedReader br = new BufferedReader(isReader); StringBuilder cronBuilder = new StringBuilder(); String textinLine; while (true) { textinLine = br.readLine(); if (textinLine == null) { break; } cronBuilder.append(textinLine); cronBuilder.append(NEW_LINE); } return cronBuilder.toString(); } finally { <START> cronInputStream.close(); <END> } } return cronFileBasicInfo.toString(); }</code><technical_language>close this cronInputStream of this method for visibility of IS</technical_language>

Target:
protected String readCronTabFile(InputStream cronInputStream) throws IOException { final StringBuilder cronFileBasicInfo = new StringBuilder("#!/bin/bash") .append(NEW_LINE) .append("SHELL=/bin/sh") .append(NEW_LINE) .append("PATH=/usr/local/sbin:/usr/local/bin:/sbin:/bin:/usr/sbin:/usr/bin") .append(NEW_LINE).append("# m h dom mon dow user command") .append(NEW_LINE); if (cronInputStream != null) { InputStreamReader isReader = new InputStreamReader( cronInputStream); BufferedReader br = new BufferedReader(isReader); StringBuilder cronBuilder = new StringBuilder(); String textinLine; while (true) { textinLine = br.readLine(); if (textinLine == null) { break; } cronBuilder.append(textinLine); cronBuilder.append(NEW_LINE); } return cronBuilder.toString(); } return cronFileBasicInfo.toString(); }
Source:
<code>public void test_update_with_no_page_nor_url() throws Exception { SFormMapping formMapping = createFormMapping(ID); formMappingService.update(formMapping, null, null); verify(recorder).recordUpdate(updateRecordCaptor.capture(), updateEventCaptor.capture()); <START> assertThat(updateRecordCaptor.getValue().getFields()).contains(entry("pageMapping.url", null), entry("pageMapping.pageId", null), <END> entry("pageMapping.urlAdapter", null)); }</code><technical_language>add a check target is reset</technical_language>

Target:
public void test_update_with_no_page_nor_url() throws Exception { SFormMapping formMapping = createFormMapping(ID); formMappingService.update(formMapping, null, null); verify(recorder).recordUpdate(updateRecordCaptor.capture(), updateEventCaptor.capture()); assertThat(updateRecordCaptor.getValue().getFields()).contains(entry("target", SFormMapping.TARGET_NONE),entry("pageMapping.url", null), entry("pageMapping.pageId", null), entry("pageMapping.urlAdapter", null)); }
Source:
<code>public void testDisplayStepExecution() { final String jobName = generateJobName(); executeJobCreate(jobName, JOB_WITH_PARAMETERS_DESCRIPTOR); checkForJobInList(jobName, JOB_WITH_PARAMETERS_DESCRIPTOR, true); executeJobLaunch(jobName); final Table jobExecutions = listJobExecutions(); final String jobExecutionId = jobExecutions.getRows().get(0).getValue(1); final Table stepExecutions = listStepExecutions(jobExecutionId); String stepExecutionId = stepExecutions.getRows().get(0).getValue(1); final Table stepExecution = getDisplayStepExecution(jobExecutionId, stepExecutionId); final String stepExecutionIdFromTable = stepExecution.getRows().get(0).getValue(2); final String jobExecutionIdFromTable = stepExecution.getRows().get(1).getValue(2); final String stepNameFromTable = stepExecution.getRows().get(2).getValue(2); final String duration = stepExecution.getRows().get(3).getValue(2); assertEquals(stepExecutionId, stepExecutionIdFromTable); assertEquals(jobExecutionId, jobExecutionIdFromTable); assertNotEquals(stepNameFromTable, "N/A"); <START> assertTrue(!duration.isEmpty()); <END> assertNotEquals(duration, "N/A"); }</code><technical_language>Minor suggestion: do this? assertFalse(duration.isEmpty());</technical_language>

Target:
public void testDisplayStepExecution() { final String jobName = generateJobName(); executeJobCreate(jobName, JOB_WITH_PARAMETERS_DESCRIPTOR); checkForJobInList(jobName, JOB_WITH_PARAMETERS_DESCRIPTOR, true); executeJobLaunch(jobName); final Table jobExecutions = listJobExecutions(); final String jobExecutionId = jobExecutions.getRows().get(0).getValue(1); final Table stepExecutions = listStepExecutions(jobExecutionId); String stepExecutionId = stepExecutions.getRows().get(0).getValue(1); final Table stepExecution = getDisplayStepExecution(jobExecutionId, stepExecutionId); final String stepExecutionIdFromTable = stepExecution.getRows().get(0).getValue(2); final String jobExecutionIdFromTable = stepExecution.getRows().get(1).getValue(2); final String stepNameFromTable = stepExecution.getRows().get(2).getValue(2); final String duration = stepExecution.getRows().get(3).getValue(2); assertEquals(stepExecutionId, stepExecutionIdFromTable); assertEquals(jobExecutionId, jobExecutionIdFromTable); assertNotEquals(stepNameFromTable, "N/A"); assertFalse(duration.isEmpty()); assertNotEquals(duration, "N/A"); }
Source:
<code>private static boolean checkAndRequestPermissions(final Activity activity, final Set<Type> types) { <START> final Set<Type> requestTypes = new HashSet<>(); <END> final Set<String> rationalMessages = new HashSet<>(); for (final Type type : types) { if (!hasPermission(activity, type)) { requestTypes.add(type); if (ActivityCompat.shouldShowRequestPermissionRationale(activity, type.getPermission())) { rationalMessages.add(activity.getString(type.getRationalMessageId())); } } } if (requestTypes.size() == 0) { return true; } if (rationalMessages.size() > 0) { showPermissionRationaleAlert(activity, TextUtils.join("\n\n", rationalMessages), requestTypes); } else { requestPermission(activity, requestTypes); } return false; }</code><technical_language>final Set<Type> requestTypes = EnumSet.noneOf(Type.class);</technical_language>

Target:
private static boolean checkAndRequestPermissions(final Activity activity, final Set<Type> types) { final Set<Type> requestTypes = EnumSet.noneOf(Type.class); final Set<String> rationalMessages = new HashSet<>(); for (final Type type : types) { if (!hasPermission(activity, type)) { requestTypes.add(type); if (ActivityCompat.shouldShowRequestPermissionRationale(activity, type.getPermission())) { rationalMessages.add(activity.getString(type.getRationalMessageId())); } } } if (requestTypes.isEmpty()) { return true; } if (rationalMessages.isEmpty()) { requestPermission(activity, requestTypes); } else { showPermissionRationaleAlert(activity, TextUtils.join("\n\n", rationalMessages), requestTypes); } return false; }
Source:
<code>private void determineTotalsAndAverages() { failureCount = 0; <START> boolean environmentModeSet = false; <END> long totalProblemScale = 0L; int problemScaleCount = 0; for (ProblemBenchmarkResult problemBenchmarkResult : unifiedProblemBenchmarkResultList) { Long problemScale = problemBenchmarkResult.getProblemScale(); if (problemScale != null && problemScale >= 0L) { totalProblemScale += problemScale; problemScaleCount++; } failureCount += problemBenchmarkResult.getFailureCount(); } averageProblemScale = problemScaleCount == 0 ? null : totalProblemScale / (long) problemScaleCount; Score totalScore = null; int solverBenchmarkCount = 0; for (SolverBenchmarkResult solverBenchmarkResult : solverBenchmarkResultList) { EnvironmentMode solverEnvironmentMode = solverBenchmarkResult.getEnvironmentMode(); if (!environmentModeSet && solverEnvironmentMode != null) { environmentMode = solverEnvironmentMode; environmentModeSet = true; } else if (environmentModeSet && solverEnvironmentMode != environmentMode) { environmentMode = null; } Score score = solverBenchmarkResult.getAverageScore(); if (score != null) { if (totalScore != null && !totalScore.isCompatibleArithmeticArgument(score)) { totalScore = null; break; } totalScore = (totalScore == null) ? score : totalScore.add(score); solverBenchmarkCount++; } } if (totalScore != null) { averageScore = totalScore.divide(solverBenchmarkCount); } }</code><technical_language>variable Set is expected a java.util.Set. For clarity, want rename it. do a boolean first: boolean = true; for (...) { if (first) { ... = false; } else { ... } ... }</technical_language>

Target:
private void determineTotalsAndAverages() { failureCount = 0; long totalProblemScale = 0L; int problemScaleCount = 0; for (ProblemBenchmarkResult problemBenchmarkResult : unifiedProblemBenchmarkResultList) { Long problemScale = problemBenchmarkResult.getProblemScale(); if (problemScale != null && problemScale >= 0L) { totalProblemScale += problemScale; problemScaleCount++; } failureCount += problemBenchmarkResult.getFailureCount(); } averageProblemScale = problemScaleCount == 0 ? null : totalProblemScale / (long) problemScaleCount; Score totalScore = null; int solverBenchmarkCount = 0; boolean firstSolverBenchmarkResult = true; for (SolverBenchmarkResult solverBenchmarkResult : solverBenchmarkResultList) { EnvironmentMode solverEnvironmentMode = solverBenchmarkResult.getEnvironmentMode(); if (firstSolverBenchmarkResult && solverEnvironmentMode != null) { environmentMode = solverEnvironmentMode; firstSolverBenchmarkResult = false; } else if (!firstSolverBenchmarkResult && solverEnvironmentMode != environmentMode) { environmentMode = null; } Score score = solverBenchmarkResult.getAverageScore(); if (score != null) { if (totalScore != null && !totalScore.isCompatibleArithmeticArgument(score)) { totalScore = null; break; } totalScore = (totalScore == null) ? score : totalScore.add(score); solverBenchmarkCount++; } } if (totalScore != null) { averageScore = totalScore.divide(solverBenchmarkCount); } }
Source:
<code>public static @Nonnull Pattern getAggregateSecretPattern(@Nonnull Collection<String> inputs) { String pattern = inputs.stream() .filter(input -> !input.isEmpty()) <START> .filter(input -> input.length() > MINIMUM_SECRET_MASKING_LENGTH) <END> .flatMap(input -> SecretPatternFactory.all().stream().flatMap(factory -> factory.getEncodedForms(input).stream())) .sorted(BY_LENGTH_DESCENDING) .distinct() .map(Pattern::quote) .collect(Collectors.joining("|")); return Pattern.compile(pattern); }</code><technical_language>This filter replace string length checks</technical_language>

Target:
public static @Nonnull Pattern getAggregateSecretPattern(@Nonnull Collection<String> inputs) { String pattern = inputs.stream() .filter(input -> input.length() > MINIMUM_SECRET_MASKING_LENGTH) .flatMap(input -> SecretPatternFactory.all().stream().flatMap(factory -> factory.getEncodedForms(input).stream())) .sorted(BY_LENGTH_DESCENDING) .distinct() .map(Pattern::quote) .collect(Collectors.joining("|")); return Pattern.compile(pattern); }
Source:
<code>protected IStructuredSelection getSelectionToUse(ExecutionEvent event) { <START> return HandlerUtil.getCurrentStructuredSelection(event); <END> }</code><technical_language>This is a simple replacement, LegacyResourceSupport does. Please remove this change, this change simple replacements</technical_language>

Target:
protected IStructuredSelection getSelectionToUse(ExecutionEvent event) { ISelection selection = HandlerUtil.getCurrentSelection(event); IStructuredSelection selectionToPass = StructuredSelection.EMPTY; if (selection instanceof IStructuredSelection) { selectionToPass = (IStructuredSelection) selection; } else { Class resourceClass = LegacyResourceSupport.getResourceClass(); if (resourceClass != null) { IWorkbenchWindow activeWorkbenchWindow = HandlerUtil.getActiveWorkbenchWindow(event); IWorkbenchPart part = activeWorkbenchWindow.getPartService() .getActivePart(); if (part instanceof IEditorPart) { IEditorInput input = ((IEditorPart) part).getEditorInput(); Object resource = Adapters.adapt(input, resourceClass); if (resource != null) { selectionToPass = new StructuredSelection(resource); } } } } return selectionToPass; }
Source:
<code>public void generateLodEntropies() { float[] entropies = new float[getMaxLod()+1]; for (int i = 0; i <= getMaxLod(); i++){ int curLod = (int) Math.pow(2, i); IndexBuffer idxB = geomap.writeIndexArrayLodDiff(curLod, false, false, false, false, totalSize); Buffer ib; if (idxB.getBuffer() instanceof IntBuffer) <START> ib = idxB.getBuffer(); else ib = idxB.getBuffer(); <END> entropies[i] = EntropyComputeUtil.computeLodEntropy(mesh, ib); } lodEntropy = entropies; }</code><technical_language>This code useless. ib a ByteBuffer a LongBuffer? Specifically wrapper IndexBuffer</technical_language>

Target:
public void generateLodEntropies() { float[] entropies = new float[getMaxLod()+1]; for (int i = 0; i <= getMaxLod(); i++){ int curLod = (int) Math.pow(2, i); IndexBuffer idxB = geomap.writeIndexArrayLodDiff(curLod, false, false, false, false, totalSize); Buffer ib = idxB.getBuffer(); entropies[i] = EntropyComputeUtil.computeLodEntropy(mesh, ib); } lodEntropy = entropies; }
Source:
<code>private static void errorAndExit(Throwable e, String message, boolean report) { if (Utils.isJarRunning() && Utils.getRunningDirectory() != null && Utils.getRunningDirectory().getAbsolutePath().indexOf('!') != -1) ErrorHandler.error( "JARs cannot be run from some paths containing the '!' character. " + "Please rename the file/directories and try again.\n\n" + "Path: " + Utils.getRunningDirectory().getAbsolutePath(), null, false ); else ErrorHandler.error(message, e, report); <START> System.exit(-1); <END> }</code><technical_language>Again, 1 is more conventional here</technical_language>

Target:
private static void errorAndExit(Throwable e, String message, boolean report) { if (Utils.isJarRunning() && Utils.getRunningDirectory() != null && Utils.getRunningDirectory().getAbsolutePath().indexOf('!') != -1) ErrorHandler.error( "JARs cannot be run from some paths containing the '!' character. " + "Please rename the file/directories and try again.\n\n" + "Path: " + Utils.getRunningDirectory().getAbsolutePath(), null, false ); else ErrorHandler.error(message, e, report); System.exit(1); }
Source:
<code><START> public static TopicPartition toTopicPartition(SystemStreamPartition ssp) { <END> return new TopicPartition(ssp.getStream(), ssp.getPartition().getPartitionId()); }</code><technical_language>this need public</technical_language>

Target:
protected static TopicPartition toTopicPartition(SystemStreamPartition ssp) { return new TopicPartition(ssp.getStream(), ssp.getPartition().getPartitionId()); }
Source:
<code>private void rejectedUntrustedHosts(HttpServletRequest request) { String serverName = request.getServerName(); <START> if (this.allowedHostnames != null && !this.allowedHostnames.test(serverName)) { <END> throw new RequestRejectedException("The request was rejected because the domain " + serverName + " is untrusted."); } }</code><technical_language>Sorry, concern this.allowedHostnames null this point, serverName null. of change DummyRequest, for getServerName return null. So, want do: suggestion if (serverName != null && !this.allowedHostnames.test(serverName)) {</technical_language>

Target:
private void rejectedUntrustedHosts(HttpServletRequest request) { String serverName = request.getServerName(); if (serverName != null && !this.allowedHostnames.test(serverName)) { throw new RequestRejectedException("The request was rejected because the domain " + serverName + " is untrusted."); } }
Source:
<code><START> public boolean equals(Object obj) { <END> return obj instanceof ResourceByDefinitionKey && key.hashCode() == obj.hashCode(); }</code><technical_language>This enough guarantee equality. key implement hashCode()==1 this broken. do key.equals(obj.key)</technical_language>

Target:
public boolean equals(Object obj) { return obj instanceof ResourceByDefinitionKey && key.equals(((ResourceByDefinitionKey) obj).key); }
Source:
<code>public void addLink(Context eventContext) { Optional<Object> spanContextOptional = eventContext.getData(SPAN_CONTEXT); Optional<Object> spanOptional = eventContext.getData(OPENTELEMETRY_SPAN_KEY); if (!spanOptional.isPresent()) { logger.warning("Failed to find span to link it."); return; } SpanContext spanContext = (SpanContext) spanContextOptional.get(); Span span = (Span) spanOptional.get(); <START> span.addLink(Link.fromSpanContext(spanContext, PARENT_LINKED_SPAN)); <END> }</code><technical_language>please leave a TODO (or call this method) switch OpenTelemetry, need add links span is starter (and link type - parent - is needed)</technical_language>

Target:
public void addLink(Context eventContext) { final Span span = getSpan(eventContext); if (span == null) { logger.warning("Failed to find span to link it."); return; } final Optional<Object> spanContextOptional = eventContext.getData(SPAN_CONTEXT); if (!spanContextOptional.isPresent()) { logger.warning("Failed to find Span context to link it."); return; } else if (!(spanContextOptional.get() instanceof SpanContext)) { logger.warning("Context in event is not of type SpanContext. Actual: {}", spanContextOptional.get().getClass()); return; } final SpanContext spanContext = (SpanContext) spanContextOptional.get(); span.addLink(Link.fromSpanContext(spanContext, PARENT_LINKED_SPAN)); }
Source:
<code>public boolean isGroupSeen(GroupKey<?> groupKey) { class GroupSeenQueryResultProcessor implements DBAccessQueryCallback { private boolean seen = false; boolean getGroupSeen() { return seen; } @Override public void process(ResultSet resultSet) { try { if (resultSet != null) { while (resultSet.next()) { seen = resultSet.getBoolean("seen"); return; } } } catch (SQLException ex) { <START> LOGGER.log(Level.WARNING, "failed to get hash set names", ex); END> } } } try { String groupSeenQueryStmt = String.format("seen FROM " + GROUPS_TABLENAME + " WHERE value = \'%s\' AND attribute = \'%s\'", groupKey.getValueDisplayName(), groupKey.getAttribute().attrName.toString() ); GroupSeenQueryResultProcessor queryResultProcessor = new GroupSeenQueryResultProcessor(); tskCase.getDBAccessManager().select(groupSeenQueryStmt, queryResultProcessor); return queryResultProcessor.getGroupSeen(); } catch (TskCoreException ex) { String msg = String.format("Failed to get is group seen for group key %s", groupKey.getValueDisplayName()); LOGGER.log(Level.WARNING, msg, ex); } return false; }</code><technical_language>This log message a copy-paste error</technical_language>

Target:
public boolean isGroupSeen(GroupKey<?> groupKey) { class GroupSeenQueryResultProcessor implements CaseDbAccessQueryCallback { private boolean seen = false; boolean getGroupSeen() { return seen; } @Override public void process(ResultSet resultSet) { try { if (resultSet != null) { while (resultSet.next()) { seen = resultSet.getBoolean("seen"); return; } } } catch (SQLException ex) { LOGGER.log(Level.SEVERE, "failed to get group seen", ex); } } } try { String groupSeenQueryStmt = String.format("seen FROM " + GROUPS_TABLENAME + " WHERE value = \'%s\' AND attribute = \'%s\'", groupKey.getValueDisplayName(), groupKey.getAttribute().attrName.toString() ); GroupSeenQueryResultProcessor queryResultProcessor = new GroupSeenQueryResultProcessor(); tskCase.getCaseDbAccessManager().select(groupSeenQueryStmt, queryResultProcessor); return queryResultProcessor.getGroupSeen(); } catch (TskCoreException ex) { String msg = String.format("Failed to get is group seen for group key %s", groupKey.getValueDisplayName()); LOGGER.log(Level.WARNING, msg, ex); } return false; }
Source:
<code>public void obtain_date_in_future_after_specified_number_of_days() { final LocalDate today = LocalDates.inDays(5); <START> final Calendar calendar = Calendar.getInstance(); <END> assertEquals(calendar.get(Calendar.YEAR), today.getYear()); assertEquals(calendar.get(Calendar.MONTH) + 1, today.getMonthValue()); assertEquals(calendar.get(Calendar.DAY_OF_MONTH) + 5, today.getDay()); }</code><technical_language>java.time</technical_language>

Target:
public void obtain_date_in_future_after_specified_number_of_days() { final LocalDate today = LocalDates.plusDays(5); final Calendar calendar = Calendar.getInstance(); assertEquals(calendar.get(Calendar.YEAR), today.getYear()); assertEquals(calendar.get(Calendar.MONTH) + 1, today.getMonthValue()); assertEquals(calendar.get(Calendar.DAY_OF_MONTH) + 5, today.getDay()); }
Source:
<code>public String transform(String JSonPathExpression, String source) throws TransformationException { if (JSonPathExpression == null || source == null) { throw new TransformationException("the given parameters 'JSonPath' and 'source' must not be null"); } logger.debug("about to transform '{}' by the function '{}'", source, JSonPathExpression); try { String transformationResult = JsonPath.read(source, JSonPathExpression); logger.debug("transformation resulted in '{}'", transformationResult); return transformationResult; } catch(InvalidPathException e) { logger.error(e.getMessage()); <START> return null; <END> } }</code><technical_language>throw TransformationException returning "null"</technical_language>

Target:
public String transform(String JSonPathExpression, String source) throws TransformationException { if (JSonPathExpression == null || source == null) { throw new TransformationException("the given parameters 'JSonPath' and 'source' must not be null"); } logger.debug("about to transform '{}' by the function '{}'", source, JSonPathExpression); try { String transformationResult = JsonPath.read(source, JSonPathExpression); logger.debug("transformation resulted in '{}'", transformationResult); return transformationResult; } catch(InvalidPathException e) { throw new TransformationException("An error occured while transforming JSON expression.", e); } }
Source:
<code>private JsonNode deserializeResponseBody(Operation operation, StatusLine statusLine, String responseBody) { JsonNode operationResult; try { operationResult = mapper.readTree(responseBody); } catch (IOException ioe) { String failureDescription = ""; if (statusLine.getStatusCode() == 503) { failureDescription = "Server not available [" + statusAsString(statusLine) + "]"; <START> LOG.info(failureDescription); <END> } else { failureDescription = "Failed to deserialize response to " + operation + " to JsonNode - response status was " + statusAsString(statusLine) + ", and body was [" + responseBody + "]: " + ioe; LOG.error(failureDescription); } operationResult = resultAsJsonNode(FAILURE, failureDescription, ioe, responseBody.contains("rolled-back=true")); } return operationResult; }</code><technical_language>error, operation failed</technical_language>

Target:
private JsonNode deserializeResponseBody(Operation operation, StatusLine statusLine, String responseBody) { JsonNode operationResult; try { operationResult = mapper.readTree(responseBody); } catch (IOException ioe) { String failureDescription = ""; if (statusLine.getStatusCode() == 503) { failureDescription = "Server not available [" + statusAsString(statusLine) + "]"; } else { failureDescription = "Failed to deserialize response to " + operation + " to JsonNode - response status was " + statusAsString(statusLine) + ", and body was [" + responseBody + "]: " + ioe; } LOG.error(failureDescription); operationResult = resultAsJsonNode(FAILURE, failureDescription, ioe, responseBody.contains("rolled-back=true")); } return operationResult; }
Source:
<code><START> public boolean lock(String id) { <END> File file = new File(directory, String.format(".%s.lock", prefix)); try { if (file.createNewFile()) { try (FileBuffer buffer = FileBuffer.allocate(file)) { buffer.writeString(id); } return true; } else { try (FileBuffer buffer = FileBuffer.allocate(file)) { return buffer.readString().equals(id); } } } catch (IOException e) { throw new StorageException("Failed to acquire storage lock"); } }</code><technical_language>release immediately, point address race mentioned</technical_language>

Target:
public boolean lock(String id) { File file = new File(directory, String.format(".%s.lock", prefix)); try { if (file.createNewFile()) { try (FileBuffer buffer = FileBuffer.allocate(file)) { buffer.writeString(id).flush(); } return true; } else { try (FileBuffer buffer = FileBuffer.allocate(file)) { String lock = buffer.readString(); return lock != null && lock.equals(id); } } } catch (IOException e) { throw new StorageException("Failed to acquire storage lock"); } }
Source:
<code>public void testAddUser() throws MiddlewareQueryException { <START> final User user = UserDataManagerImplTest.userTDI.createUser(); <END> this.userDataManager.addUser(user); final User resultUser = this.userDataManager.getUserById(user.getUserid()); Assert.assertEquals("The user ids should be equal.", user.getUserid(), resultUser.getUserid()); Assert.assertEquals("The usernames should be equal.", user.getName(), resultUser.getName()); Assert.assertEquals("The Passwords should be equal.", user.getPassword(), resultUser.getPassword()); Assert.assertEquals("The install ids should be equal.", user.getInstalid(), resultUser.getInstalid()); Assert.assertEquals("The status values should be equal.", user.getStatus(), resultUser.getStatus()); Assert.assertEquals("The access values should be equal.", user.getAccess(), resultUser.getAccess()); Assert.assertEquals("The type values should be equal.", user.getType(), resultUser.getType()); Assert.assertEquals("The assign dates should be equal.", user.getAssignDate(), resultUser.getAssignDate()); Assert.assertEquals("The close dates should be equal.", user.getCloseDate(), resultUser.getCloseDate()); }</code><technical_language>Please do TDI acronym - I is a long name do need full name - please address entire class correct</technical_language>

Target:
public void testAddUser() throws MiddlewareQueryException { final User user = UserDataManagerImplTest.userTestDataInitializer.createUser(); this.userDataManager.addUser(user); final User resultUser = this.userDataManager.getUserById(user.getUserid()); Assert.assertEquals("The user ids should be equal.", user.getUserid(), resultUser.getUserid()); Assert.assertEquals("The usernames should be equal.", user.getName(), resultUser.getName()); Assert.assertEquals("The Passwords should be equal.", user.getPassword(), resultUser.getPassword()); Assert.assertEquals("The install ids should be equal.", user.getInstalid(), resultUser.getInstalid()); Assert.assertEquals("The status values should be equal.", user.getStatus(), resultUser.getStatus()); Assert.assertEquals("The access values should be equal.", user.getAccess(), resultUser.getAccess()); Assert.assertEquals("The type values should be equal.", user.getType(), resultUser.getType()); Assert.assertEquals("The assign dates should be equal.", user.getAssignDate(), resultUser.getAssignDate()); Assert.assertEquals("The close dates should be equal.", user.getCloseDate(), resultUser.getCloseDate()); }
Source:
<code>public Result doWork() { final boolean isRunOnce = getInputData().getBoolean(PARAM_RUN_ONCE, false); Log.d(TAG, "doWork() : isRunOnce = " + isRunOnce); ClientConfig.initialize(getApplicationContext()); if (NetworkUtils.networkAvailable() && NetworkUtils.isFeedRefreshAllowed()) { List<Feed> feeds = new ArrayList<>(); Map<Long, FeedItem> lastItemsMap = new HashMap<>(); for (Feed feed : DBReader.getFeedList()) { FeedPreferences prefs = feed.getPreferences(); if (prefs.getKeepUpdated() && prefs.getShowNotification()) { <START> List<FeedItem> outdatedFeedItems = DBReader.getFeedItemList(feed); <END> if (!outdatedFeedItems.isEmpty()) { FeedItem newestEpisode = outdatedFeedItems.get(0); lastItemsMap.put(feed.getId(), newestEpisode); } feeds.add(feed); } } this.feeds = feeds; this.lastItemsMap = lastItemsMap; EventBus.getDefault().register(this); DBTasks.refreshAllFeeds(getApplicationContext(), false); } else { Log.d(TAG, "Blocking automatic update: no wifi available / no mobile updates allowed"); } if (!isRunOnce && UserPreferences.isAutoUpdateTimeOfDay()) { AutoUpdateManager.restartUpdateAlarm(getApplicationContext()); } return Result.success(); }</code><technical_language>In worst case, this load episodes of feeds. lead out-of-memory errors a big list of feeds. similar done in another location I out this is responsible for a pretty decent number of crashes. some do storing episodes. Do need store episodes new? I "new" flag in database is basically meant for purpose: episode users interacted yet. "new" flag fix this case: > Currently if a notification for 2 episodes another is found, notification updated newly episodes (e.g 1) instead of adding previous episodes</technical_language>

Target:
public Result doWork() { final boolean isRunOnce = getInputData().getBoolean(PARAM_RUN_ONCE, false); Log.d(TAG, "doWork() : isRunOnce = " + isRunOnce); ClientConfig.initialize(getApplicationContext()); if (NetworkUtils.networkAvailable() && NetworkUtils.isFeedRefreshAllowed()) { DBTasks.refreshAllFeeds(getApplicationContext(), false); } else { Log.d(TAG, "Blocking automatic update: no wifi available / no mobile updates allowed"); } if (!isRunOnce && UserPreferences.isAutoUpdateTimeOfDay()) { AutoUpdateManager.restartUpdateAlarm(getApplicationContext()); } return Result.success(); }
Source:
<code>public BlockingQueue<Operation> create() { return new BytesBoundedLinkedQueue<Operation>(maxQueueSize) { @Override public long getBytesSize(Operation operation) { <START> return operation.getBuffer().capacity(); <END> } }; }</code><technical_language>buffer.remaining() more representative of size of in queue, more robust changes in underlying implementation of Operation</technical_language>

Target:
public BlockingQueue<Operation> create() { return new BytesBoundedLinkedQueue<Operation>(maxQueueSize) { @Override public long getBytesSize(Operation operation) { return operation.getBuffer().remaining(); } }; }
Source:
<code>private Jar getJavadoc(Tool tool, Processor context, String path, Map<String, String> options, boolean exports) throws Exception { Jar jar = toJar(context, path); if (path != null && jar == null) { logger.warn( "A javadoc path was set in the -maven-release instuction, but no javadoc could be found in (base path: {}) ", <START> path, context.getBaseURI() <END> .toString()); } if (jar == null) { jar = tool.doJavadoc(options, exports); } jar.ensureManifest(); jar.setName(Archive.JAVADOC_CLASSIFIER); tool.addClose(jar); return jar; }</code><technical_language>I 2nd arg options.context.getBase(). I want a URI here. toString() in case logging happen. Leave toString() call logging code</technical_language>

Target:
private Jar getJavadoc(Tool tool, Processor context, String path, Map<String, String> options, boolean exports) throws Exception { Jar jar = toJar(context, path); if (path != null && jar == null) { logger.warn( "A javadoc path was set in the -maven-release instuction, but no javadoc could be found in (base path: {}) ", path, context.getBase()); } if (jar == null) { jar = tool.doJavadoc(options, exports); } jar.ensureManifest(); jar.setName(Archive.JAVADOC_CLASSIFIER); tool.addClose(jar); return jar; }
Source:
<code>public static InternalCompletableFuture<Object> invokeOnStableClusterSerial(NodeEngine nodeEngine, Supplier<? extends Operation> operationSupplier, int maxRetries) { ClusterService clusterService = nodeEngine.getClusterService(); if (!clusterService.isJoined()) { <START> return newCompletedFuture(true); <END> } RestartingMemberIterator memberIterator = new RestartingMemberIterator(clusterService, maxRetries); InvokeOnMemberFunction invokeOnMemberFunction = new InvokeOnMemberFunction(operationSupplier, nodeEngine, memberIterator); Iterator<InternalCompletableFuture<Object>> invocationIterator = map(memberIterator, invokeOnMemberFunction); return new ChainingFuture(invocationIterator, memberIterator); }</code><technical_language>is this change required for this PR</technical_language>

Target:
public static InternalCompletableFuture<Object> invokeOnStableClusterSerial(NodeEngine nodeEngine, Supplier<? extends Operation> operationSupplier, int maxRetries) { ClusterService clusterService = nodeEngine.getClusterService(); if (!clusterService.isJoined()) { return newCompletedFuture(null); } RestartingMemberIterator memberIterator = new RestartingMemberIterator(clusterService, maxRetries); InvokeOnMemberFunction invokeOnMemberFunction = new InvokeOnMemberFunction(operationSupplier, nodeEngine, memberIterator); Iterator<InternalCompletableFuture<Object>> invocationIterator = map(memberIterator, invokeOnMemberFunction); return new ChainingFuture(invocationIterator, memberIterator); }
Source:
<code>private void extractGetterForColumn(ColumnSchema columnSchema, Field fieldDefinition) { Type columnType = columnSchema.getType(); Class pojoClass = getTuplePayloadClass(); Object getter = null; switch ( columnType ) { case BINARY: getter = PojoUtils.createGetter(pojoClass, fieldDefinition.getName(), ByteBuffer.class); break; case STRING: getter = PojoUtils.createGetter(pojoClass, fieldDefinition.getName(), String.class); break; case BOOL: getter = PojoUtils.createGetterBoolean(pojoClass, fieldDefinition.getName()); break; case DOUBLE: getter = PojoUtils.createGetterDouble(pojoClass, fieldDefinition.getName()); break; case FLOAT: getter = PojoUtils.createGetterFloat(pojoClass, fieldDefinition.getName()); break; case INT8: getter = PojoUtils.createGetterByte(pojoClass, fieldDefinition.getName()); break; case INT16: getter = PojoUtils.createGetterShort(pojoClass, fieldDefinition.getName()); break; case INT32: getter = PojoUtils.createGetterInt(pojoClass, fieldDefinition.getName()); break; case INT64: case UNIXTIME_MICROS: getter = PojoUtils.createGetterLong(pojoClass, fieldDefinition.getName()); break; default: break; } <START> if (getter != null) { <END> kuduColumnBasedGetters.put(columnSchema.getName(),getter); } }</code><technical_language>is this used</technical_language>

Target:
private void extractGetterForColumn(ColumnSchema columnSchema, Field fieldDefinition) { Type columnType = columnSchema.getType(); Class pojoClass = getTuplePayloadClass(); Object getter = null; switch ( columnType ) { case BINARY: getter = PojoUtils.createGetter(pojoClass, fieldDefinition.getName(), ByteBuffer.class); break; case STRING: getter = PojoUtils.createGetter(pojoClass, fieldDefinition.getName(), String.class); break; case BOOL: getter = PojoUtils.createGetterBoolean(pojoClass, fieldDefinition.getName()); break; case DOUBLE: getter = PojoUtils.createGetterDouble(pojoClass, fieldDefinition.getName()); break; case FLOAT: getter = PojoUtils.createGetterFloat(pojoClass, fieldDefinition.getName()); break; case INT8: getter = PojoUtils.createGetterByte(pojoClass, fieldDefinition.getName()); break; case INT16: getter = PojoUtils.createGetterShort(pojoClass, fieldDefinition.getName()); break; case INT32: getter = PojoUtils.createGetterInt(pojoClass, fieldDefinition.getName()); break; case INT64: case UNIXTIME_MICROS: getter = PojoUtils.createGetterLong(pojoClass, fieldDefinition.getName()); break; default: LOG.error(fieldDefinition.getName() + " has a data type that is not yet supported"); throw new UnsupportedOperationException(fieldDefinition.getName() + " does not have a compatible data type"); } if (getter != null) { kuduColumnBasedGetters.put(columnSchema.getName(),getter); } }
Source:
<code><START> @Nullable Map<String, <END> Integer> getIdMap() { return ids; }</code><technical_language>this @NonNull? If ids is @Nullable of legacy JSON, drop @NonNull annotation field</technical_language>

Target:
@NonNull Map<String, Integer> getIdMap() { return ids; }
Source:
<code>public void testParameterException() throws Exception { ModelImpl m = factory.getModel("powerlaw1d", "p1d"); <START> m.getParameter("foo"); <END> }</code><technical_language>powerlaw instead of powerlaw1d. test this line line find model errors a NoSuchElementException</technical_language>

Target:
public void testParameterException() throws Exception { Model m = factory.getModel("powerlaw", "p1d"); try { m.findParameter("foo"); } catch (NoSuchElementException ex) { return; } fail("Should have thrown exception"); }
Source:
<code>public void cleanUp() { <START> rdbi.withHandle(new Callback<Void>() { <END> @Override public Void run(Handle handle) { Set<String> missing = handle.jedis().smembers(cacheMissingKey()); for (String rawKey : missing) { KeyType key = keyTypeSerializationHelper.decode(rawKey); refresh(key); } return null; } }); }</code><technical_language>async load/refresh operation clean missing keys too? i kinda feel should... also, is intent invalidateAll called a regular basis</technical_language>

Target:
public void cleanUp() { Set<KeyType> missing = getMissing(); for (KeyType key : missing) { refresh(key); } }
Source:
<code>public void evaluate_shouldReturnTheFullNameOfAPatient() throws Exception { <START> Person person = new Person(); <END> Patient patient = Context.getPatientService().getPatient(8); Assert.assertNotNull("The patient was not found",patient); MohNamesRule mohNamesRule = new MohNamesRule(); String patientName = mohNamesRule.evaluate(null,patient.getId(),null).toString(); Assert.assertEquals("A different name was returned for the patient","Anet Test Oloo",patientName); }</code><technical_language>this is necessary, is it? remove related imports</technical_language>

Target:
public void evaluate_shouldReturnTheFullNameOfAPatient() throws Exception { Patient patient = Context.getPatientService().getPatient(8); Assert.assertNotNull("The patient was not found",patient); MohNamesRule mohNamesRule = new MohNamesRule(); Result expected =new Result("Anet Test Oloo"); Result actual = mohNamesRule.evaluate(null,patient.getId(),null); Assert.assertNotNull("No name was found for the patient",actual); Assert.assertEquals("A different name was returned for the patient",expected,actual); }
Source:
<code>public DruidSchema( final QueryLifecycleFactory queryLifecycleFactory, final TimelineServerView serverView, final PlannerConfig config, final ViewManager viewManager, final Escalator escalator ) { this.queryLifecycleFactory = Preconditions.checkNotNull(queryLifecycleFactory, "queryLifecycleFactory"); Preconditions.checkNotNull(serverView, "serverView"); this.config = Preconditions.checkNotNull(config, "config"); this.viewManager = Preconditions.checkNotNull(viewManager, "viewManager"); this.cacheExec = ScheduledExecutors.fixed(1, "DruidSchema-Cache-%d"); this.tables = new ConcurrentHashMap<>(); this.escalator = escalator; serverView.registerTimelineCallback( MoreExecutors.sameThreadExecutor(), new TimelineServerView.TimelineCallback() { @Override public ServerView.CallbackAction timelineInitialized() { synchronized (lock) { isServerViewInitialized = true; lock.notifyAll(); } return ServerView.CallbackAction.CONTINUE; } @Override public ServerView.CallbackAction segmentAdded(final DruidServerMetadata server, final DataSegment segment) { addSegment(server, segment); return ServerView.CallbackAction.CONTINUE; } @Override public ServerView.CallbackAction segmentRemoved(final DataSegment segment) { removeSegment(segment); return ServerView.CallbackAction.CONTINUE; } @Override public ServerView.CallbackAction serverSegmentRemoved( final DruidServerMetadata server, final DataSegment segment ) { <START> removeSegment(server, segment); <END> return ServerView.CallbackAction.CONTINUE; } } ); }</code><technical_language>leftover overloaded removeSegment method confusing, rename similar event renamed</technical_language>

Target:
public DruidSchema( final QueryLifecycleFactory queryLifecycleFactory, final TimelineServerView serverView, final PlannerConfig config, final ViewManager viewManager, final Escalator escalator ) { this.queryLifecycleFactory = Preconditions.checkNotNull(queryLifecycleFactory, "queryLifecycleFactory"); Preconditions.checkNotNull(serverView, "serverView"); this.config = Preconditions.checkNotNull(config, "config"); this.viewManager = Preconditions.checkNotNull(viewManager, "viewManager"); this.cacheExec = ScheduledExecutors.fixed(1, "DruidSchema-Cache-%d"); this.tables = new ConcurrentHashMap<>(); this.escalator = escalator; serverView.registerTimelineCallback( MoreExecutors.sameThreadExecutor(), new TimelineServerView.TimelineCallback() { @Override public ServerView.CallbackAction timelineInitialized() { synchronized (lock) { isServerViewInitialized = true; lock.notifyAll(); } return ServerView.CallbackAction.CONTINUE; } @Override public ServerView.CallbackAction segmentAdded(final DruidServerMetadata server, final DataSegment segment) { addSegment(server, segment); return ServerView.CallbackAction.CONTINUE; } @Override public ServerView.CallbackAction segmentRemoved(final DataSegment segment) { removeSegment(segment); return ServerView.CallbackAction.CONTINUE; } @Override public ServerView.CallbackAction serverSegmentRemoved( final DruidServerMetadata server, final DataSegment segment ) { removeServerSegment(server, segment); return ServerView.CallbackAction.CONTINUE; } } ); }
Source:
<code><START> public static Integer getGenotypeInteger(final Genotype g, final String fieldName, final int defaultValue) { <END> final Object genotypeExtendedAttribute = g.getExtendedAttribute(fieldName, VCFConstants.MISSING_VALUE_v4); final String genotypePArtifactAsString = String.valueOf(genotypeExtendedAttribute); if ((genotypePArtifactAsString == null) || (genotypePArtifactAsString.equals(VCFConstants.MISSING_VALUE_v4))) { return defaultValue; } return Integer.parseInt(genotypePArtifactAsString); }</code><technical_language>need a blank line this method</technical_language>

Target:
public static Integer getGenotypeInteger(final Genotype g, final String fieldName, final int defaultValue) { Utils.nonNull(g); final String genotypeFieldAsString = getGenotypeString(g, fieldName); return isVcfGenotypeFieldEmpty(genotypeFieldAsString) ? defaultValue : Integer.parseInt(genotypeFieldAsString); }
Source:
<code>String summaryString(Response response) { try { if (response.getExample() != null) return response.getFormulaAnswer(); if (response.getLines().size() > 0) return response.getLines().get(0); } catch (Exception e) { <START> return null; <END> } return null; }</code><technical_language>return e.toString() something? Silent failures fun track down..</technical_language>

Target:
String summaryString(Response response) { if (response.getExample() != null) return response.getFormulaAnswer(); if (response.getLines().size() > 0) return response.getLines().get(0); return null; }