auphong2707/dl4se-code-review-dataset huggingface dataset:
Source:
<code>Mono<EncryptResult> encrypt(EncryptOptions encryptOptions, Context context) { Objects.requireNonNull(encryptOptions, "'encryptOptions' cannot be null."); Objects.requireNonNull(encryptOptions.getAlgorithm(), "Encryption algorithm cannot be null."); <START> Objects.requireNonNull(encryptOptions.getPlainText(), "Plain text content to be encrypted cannot be null."); <END> EncryptionAlgorithm algorithm = encryptOptions.getAlgorithm(); byte[] iv = encryptOptions.getIv(); byte[] authenticatedData = encryptOptions.getAdditionalAuthenticatedData(); KeyOperationParameters parameters = new KeyOperationParameters() .setAlgorithm(algorithm) .setValue(encryptOptions.getPlainText()) .setIv(iv) .setAdditionalAuthenticatedData(authenticatedData); context = context == null ? Context.NONE : context; return service.encrypt(vaultUrl, keyName, version, apiVersion, ACCEPT_LANGUAGE, parameters, CONTENT_TYPE_HEADER_VALUE, context.addData(AZ_TRACING_NAMESPACE_KEY, KEYVAULT_TRACING_NAMESPACE_VALUE)) .doOnRequest(ignored -> logger.info("Encrypting content with algorithm - {}", algorithm.toString())) .doOnSuccess(response -> logger.info("Retrieved encrypted content with algorithm- {}", algorithm.toString())) .doOnError(error -> logger.warning("Failed to encrypt content with algorithm - {}", algorithm.toString(), error)) .flatMap(keyOperationResultResponse -> Mono.just(new EncryptResult(keyOperationResultResponse.getValue().getResult(), algorithm, keyId))); }</code><technical_language>Nit: "plaintext" in crypto-speak</technical_language>

Target:
Mono<EncryptResult> encrypt(EncryptOptions encryptOptions, Context context) { Objects.requireNonNull(encryptOptions, "'encryptOptions' cannot be null."); EncryptionAlgorithm algorithm = encryptOptions.getAlgorithm(); byte[] iv = encryptOptions.getIv(); byte[] authenticatedData = encryptOptions.getAdditionalAuthenticatedData(); KeyOperationParameters parameters = new KeyOperationParameters() .setAlgorithm(algorithm) .setValue(encryptOptions.getPlaintext()) .setIv(iv) .setAdditionalAuthenticatedData(authenticatedData); context = context == null ? Context.NONE : context; return service.encrypt(vaultUrl, keyName, version, apiVersion, ACCEPT_LANGUAGE, parameters, CONTENT_TYPE_HEADER_VALUE, context.addData(AZ_TRACING_NAMESPACE_KEY, KEYVAULT_TRACING_NAMESPACE_VALUE)) .doOnRequest(ignored -> logger.info("Encrypting content with algorithm - {}", algorithm.toString())) .doOnSuccess(response -> logger.info("Retrieved encrypted content with algorithm- {}", algorithm.toString())) .doOnError(error -> logger.warning("Failed to encrypt content with algorithm - {}", algorithm.toString(), error)) .flatMap(keyOperationResultResponse -> Mono.just(new EncryptResult(keyOperationResultResponse.getValue().getResult(), algorithm, keyId))); }
Source:
<code>public void should_buildQueryExpressionModel_return_QueryExpressionModel_from_bom() throws Exception { final QueryExpressionModel model = queryExpressionProvider.buildQueryExpressionModel(); assertThat(model).isNotNull(); assertThat(model.getBusinessObjects()).hasSize(1); final BusinessObjectExpressionQuery businessObjectExpressionQuery = model.getBusinessObjects().get(0); assertThat(businessObjectExpressionQuery.getQualifiedName()).isEqualTo("org.bonita.Employee"); <START> assertThat(businessObjectExpressionQuery.getQueryExpressions()).extracting("name").contains("Employee.find", "Employee.findByEmployeeId", <END> "Employee.findByPersistenceId"); for (final Expression exp : businessObjectExpressionQuery.getQueryExpressions()) { ExpressionAssert.assertThat(exp).hasType(queryExpressionProvider.getExpressionType()); assertThat(exp.getName()).isNotEmpty(); assertThat(exp.getContent()).isNotEmpty(); assertThat(exp.getType()).isNotEmpty(); assertThat(exp.getReferencedElements()).isNotEmpty(); } }</code><technical_language>previously, checked 4 elements checking for 3 names. Shoudln't check for 4 (or 5 if I understood a new request added) put 4( or5) names a containsExactly</technical_language>

Target:
public void should_buildQueryExpressionModel_return_QueryExpressionModel_from_bom() throws Exception { final QueryExpressionModel model = queryExpressionProvider.buildQueryExpressionModel(); assertThat(model).isNotNull(); assertThat(model.getBusinessObjects()).hasSize(1); final BusinessObjectExpressionQuery businessObjectExpressionQuery = model.getBusinessObjects().get(0); assertThat(businessObjectExpressionQuery.getQualifiedName()).isEqualTo("org.bonita.Employee"); assertThat(businessObjectExpressionQuery.getQueryExpressions()).extracting("name").containsOnly("Employee.find", "Employee.findByEmployeeId", "Employee.findByPersistenceId"); for (final Expression exp : businessObjectExpressionQuery.getQueryExpressions()) { ExpressionAssert.assertThat(exp).hasType(queryExpressionProvider.getExpressionType()); assertThat(exp.getName()).isNotEmpty(); assertThat(exp.getContent()).isNotEmpty(); assertThat(exp.getType()).isNotEmpty(); assertThat(exp.getReferencedElements()).isNotEmpty(); } }
Source:
<code>@Override public void run() { List<String> listOptions = listActionConfig.listType; if (listOptions == null) { try { printing.printAllSanitizedSecrets(keywhizClient.allSecrets()); } catch (IOException e) { throw Throwables.propagate(e); } return; } List<String> options = Arrays.asList(listOptions.get(0).split(",")); String firstOption = options.get(0).toLowerCase().trim(); try { switch (firstOption) { case "groups": printing.printAllGroups(keywhizClient.allGroups()); break; case "clients": printing.printAllClients(keywhizClient.allClients()); break; case "secrets": if (listActionConfig.idx == null && listActionConfig.num == null) { printing.printAllSanitizedSecrets(keywhizClient.allSecrets()); } else if (listActionConfig.idx != null && listActionConfig.num != null) { <START> if (listActionConfig.idx < 0 || listActionConfig.num < 0) { <END> throw new AssertionError("Both idx and num must be positive for batched secret queries"); } printing.printAllSanitizedSecrets(keywhizClient.allSecretsBatched(listActionConfig.idx, listActionConfig.num)); } else { throw new AssertionError("Both idx and num must be provided for batched secret queries"); } break; default: throw new AssertionError("Invalid list option: " + firstOption); } } catch(IOException e) { throw Throwables.propagate(e); } }</code><technical_language>checkArgument(listActionConfig.idx >= 0) is more succinct/readable</technical_language>

Target:
@Override public void run() { List<String> listOptions = listActionConfig.listType; if (listOptions == null) { try { printing.printAllSanitizedSecrets(keywhizClient.allSecrets()); } catch (IOException e) { throw Throwables.propagate(e); } return; } List<String> options = Arrays.asList(listOptions.get(0).split(",")); String firstOption = options.get(0).toLowerCase().trim(); try { switch (firstOption) { case "groups": printing.printAllGroups(keywhizClient.allGroups()); break; case "clients": printing.printAllClients(keywhizClient.allClients()); break; case "secrets": if (listActionConfig.idx == null && listActionConfig.num == null) { printing.printAllSanitizedSecrets(keywhizClient.allSecrets()); } else if (listActionConfig.idx != null && listActionConfig.num != null) { checkArgument(listActionConfig.idx >= 0); checkArgument(listActionConfig.num >= 0); if (listActionConfig.newestFirst == null) { printing.printAllSanitizedSecrets(keywhizClient.allSecretsBatched(listActionConfig.idx, listActionConfig.num, true)); } else { printing.printAllSanitizedSecrets(keywhizClient.allSecretsBatched(listActionConfig.idx, listActionConfig.num, listActionConfig.newestFirst)); } } else { throw new AssertionError("Both idx and num must be provided for batched secret queries"); } break; default: throw new AssertionError("Invalid list option: " + firstOption); } } catch(IOException e) { throw Throwables.propagate(e); } }
Source:
<code>public void prunePacked() throws IOException { ObjectDirectory objdb = repo.getObjectDatabase(); Collection<PackFile> packs = objdb.getPacks(); File objects = repo.getObjectsDirectory(); String[] fanout = objects.list(); if (fanout != null && fanout.length > 0) { pm.beginTask(JGitText.get().pruneLoosePackedObjects, fanout.length); try { for (String d : fanout) { pm.update(1); if (d.length() != 2) continue; String[] entries = new File(objects, d).list(); if (entries == null) continue; for (String e : entries) { <START> boolean found = false; <END> if (e.length() != Constants.OBJECT_ID_STRING_LENGTH - 2) continue; ObjectId id; try { id = ObjectId.fromString(d + e); } catch (IllegalArgumentException notAnObject) { continue; } for (PackFile p : packs) if (p.hasObject(id)) { found = true; break; } if (found) FileUtils.delete(objdb.fileFor(id), FileUtils.RETRY | FileUtils.SKIP_MISSING | FileUtils.IGNORE_ERRORS); } } } finally { pm.endTask(); } } }</code><technical_language>minor style nit: this declared line 227 right for loop</technical_language>

Target:
public void prunePacked() throws IOException { ObjectDirectory objdb = repo.getObjectDatabase(); Collection<PackFile> packs = objdb.getPacks(); File objects = repo.getObjectsDirectory(); String[] fanout = objects.list(); if (fanout != null && fanout.length > 0) { pm.beginTask(JGitText.get().pruneLoosePackedObjects, fanout.length); try { for (String d : fanout) { pm.update(1); if (d.length() != 2) continue; String[] entries = new File(objects, d).list(); if (entries == null) continue; for (String e : entries) { if (e.length() != Constants.OBJECT_ID_STRING_LENGTH - 2) continue; ObjectId id; try { id = ObjectId.fromString(d + e); } catch (IllegalArgumentException notAnObject) { continue; } boolean found = false; for (PackFile p : packs) if (p.hasObject(id)) { found = true; break; } if (found) FileUtils.delete(objdb.fileFor(id), FileUtils.RETRY | FileUtils.SKIP_MISSING | FileUtils.IGNORE_ERRORS); } } } finally { pm.endTask(); } } }
Source:
<code>private AdminSearchPageData extractDataFromFeedbackSeesion(FeedbackSessionAttributes fsa, AdminSearchPageData data, StudentAttributes student){ String submitUrl = new Url(Config.APP_URL + Const.ActionURIs.STUDENT_FEEDBACK_SUBMISSION_EDIT_PAGE) .withCourseId(student.course) .withSessionName(fsa.feedbackSessionName) .withRegistrationKey(StringHelper.encrypt(student.key)) .withStudentEmail(student.email) .toString(); if(fsa.isOpened() == false){ if (data.studentNoneOpenFeedbackSessionLinksMap.get(student.getIdentificationString()) == null){ List<String> submitUrlList = new ArrayList<String>(); submitUrlList.add(submitUrl); data.studentNoneOpenFeedbackSessionLinksMap.put(student.getIdentificationString(), submitUrlList); } else { <START> data.studentNoneOpenFeedbackSessionLinksMap.get(student.getIdentificationString()).add(submitUrl); <END> } data.feedbackSeesionLinkToNameMap.put(submitUrl, fsa.feedbackSessionName + " (Currently Not Open)"); } else { if (data.studentOpenFeedbackSessionLinksMap.get(student.getIdentificationString()) == null){ List<String> submitUrlList = new ArrayList<String>(); submitUrlList.add(submitUrl); data.studentOpenFeedbackSessionLinksMap.put(student.getIdentificationString(), submitUrlList); } else { data.studentOpenFeedbackSessionLinksMap.get(student.getIdentificationString()).add(submitUrl); } data.feedbackSeesionLinkToNameMap.put(submitUrl, fsa.feedbackSessionName); } return data; }</code><technical_language>..NonOpen...</technical_language>

Target:
private AdminSearchPageData extractDataFromFeedbackSeesion(FeedbackSessionAttributes fsa, AdminSearchPageData data, StudentAttributes student){ String submitUrl = new Url(Config.APP_URL + Const.ActionURIs.STUDENT_FEEDBACK_SUBMISSION_EDIT_PAGE) .withCourseId(student.course) .withSessionName(fsa.feedbackSessionName) .withRegistrationKey(StringHelper.encrypt(student.key)) .withStudentEmail(student.email) .toString(); if(fsa.isOpened() == false){ if (data.studentUnOpenedFeedbackSessionLinksMap.get(student.getIdentificationString()) == null){ List<String> submitUrlList = new ArrayList<String>(); submitUrlList.add(submitUrl); data.studentUnOpenedFeedbackSessionLinksMap.put(student.getIdentificationString(), submitUrlList); } else { data.studentUnOpenedFeedbackSessionLinksMap.get(student.getIdentificationString()).add(submitUrl); } data.feedbackSeesionLinkToNameMap.put(submitUrl, fsa.feedbackSessionName + " (Currently Not Open)"); } else { if (data.studentOpenFeedbackSessionLinksMap.get(student.getIdentificationString()) == null){ List<String> submitUrlList = new ArrayList<String>(); submitUrlList.add(submitUrl); data.studentOpenFeedbackSessionLinksMap.put(student.getIdentificationString(), submitUrlList); } else { data.studentOpenFeedbackSessionLinksMap.get(student.getIdentificationString()).add(submitUrl); } data.feedbackSeesionLinkToNameMap.put(submitUrl, fsa.feedbackSessionName); } return data; }
Source:
<code>private TreeNode getMatchingTreeNode(TreeNode parent, MediaUnit mediaUnit) { TreeNode matchingTreeNode = null; for (TreeNode treeNode : parent.getChildren()) { if (Objects.nonNull(treeNode.getData()) && treeNode.getData() instanceof StructureTreeNode) { StructureTreeNode structureTreeNode = (StructureTreeNode) treeNode.getData(); <START> if (Objects.nonNull(structureTreeNode.getDataObject()) && structureTreeNode.getDataObject() instanceof MediaUnit) { <END> MediaUnit currentMediaUnit = (MediaUnit) structureTreeNode.getDataObject(); if (Objects.nonNull(currentMediaUnit.getDivId()) && Objects.nonNull(mediaUnit.getDivId()) && currentMediaUnit.getDivId().equals(mediaUnit.getDivId())) { matchingTreeNode = treeNode; break; } else { matchingTreeNode = getMatchingTreeNode(treeNode, mediaUnit); if (Objects.nonNull(matchingTreeNode)) { break; } } } } } return matchingTreeNode; }</code><technical_language>suggestion if (structureTreeNode.getDataObject() instanceof MediaUnit) { instanceof returns false for null, checks done in statement</technical_language>

Target:
private TreeNode getMatchingTreeNode(TreeNode parent, MediaUnit mediaUnit) { TreeNode matchingTreeNode = null; for (TreeNode treeNode : parent.getChildren()) { if (Objects.nonNull(treeNode) && treeNode.getData() instanceof StructureTreeNode) { StructureTreeNode structureTreeNode = (StructureTreeNode) treeNode.getData(); if (structureTreeNode.getDataObject() instanceof MediaUnit) { MediaUnit currentMediaUnit = (MediaUnit) structureTreeNode.getDataObject(); if (Objects.nonNull(currentMediaUnit.getDivId()) && currentMediaUnit.getDivId().equals(mediaUnit.getDivId())) { matchingTreeNode = treeNode; break; } else { matchingTreeNode = getMatchingTreeNode(treeNode, mediaUnit); if (Objects.nonNull(matchingTreeNode)) { break; } } } } } return matchingTreeNode; }
Source:
<code>public TimestampCodecTest() { <START> TimeZone.setDefault(TimeZone.getTimeZone(UTC)); <END> codec = TypeCodecs.TIMESTAMP; }</code><technical_language>Mmm I spoke fast, fails command line..</technical_language>

Target:
public TimestampCodecTest() { codec = new TimestampCodec(ZoneOffset.UTC); }
Source:
<code>private String getHostString(InetSocketAddress addr) { String hostString; InetAddress ia = addr.getAddress(); <START> if ( ia != null ) { <END> if (ia.toString().startsWith("/")) { hostString = ia.getHostAddress(); } else { hostString = addr.getHostName(); } } else { String addrString = addr.toString(); hostString = addrString.substring(0, addrString.indexOf( ':' )); } return hostString; }</code><technical_language>Silly nit: space expression</technical_language>

Target:
private String getHostString(InetSocketAddress addr) { String hostString = ""; if (addr == null) { return hostString; } if (!addr.isUnresolved()) { InetAddress ia = addr.getAddress(); if (ia.toString().startsWith("/")) { hostString = ia.getHostAddress(); } else { hostString = addr.getHostName(); } } else { String addrString = addr.toString(); hostString = addrString.substring(0, addrString.lastIndexOf(':')); } return hostString; }
Source:
<code>private void setPasswordInPropertiesFile() { String etcDir = properties.getProperty(KARAF_ETC); String systemPropertyFilename = etcDir + File.separator + SYSTEM_PROPERTIES_FILE; File systemPropertiesFile = new File(systemPropertyFilename); AccessController.doPrivileged( (PrivilegedAction<Void>) <START> () -> { <END> try { Properties systemDotProperties = new Properties(systemPropertiesFile); systemDotProperties.setProperty( SOLR_PASSWORD_PROPERTY_NAME, newPasswordWrappedEncrypted); systemDotProperties.save(); LOGGER.info( "Updated encrypted Solr password in properties file {}.", systemPropertyFilename); } catch (IOException e) { LOGGER.error( "Exception while writing to {}. Solr password was changed, but new password was not saved.", systemPropertyFilename); } return null; }); }</code><technical_language>Time for a private method method reference</technical_language>

Target:
private void setPasswordInPropertiesFile() { AccessController.doPrivileged((PrivilegedAction<Void>) this::updatePropertiesFile); }
Source:
<code>public StateItem(Map<String, Object> style) { Map<String, Object> styleMap = new HashMap<>(); styleMap.putAll(style); fStyleMap = StylePropertiesUtils.updateEventStyleProperties(styleMap); fOriginalStyleMap = <START> ImmutableMap.copyOf(StylePropertiesUtils.updateEventStyleProperties(styleMap)); <END> }</code><technical_language>fStyleMap</technical_language>

Target:
public StateItem(Map<String, Object> style) { Map<String, Object> styleMap = new HashMap<>(); styleMap.putAll(style); fStyleMap = StylePropertiesUtils.updateEventStyleProperties(styleMap); fOriginalStyleMap = ImmutableMap.copyOf(fStyleMap); }
Source:
<code>public MapColor shade(MapShade newShading) { <START> if (cachedShadings.containsKey(newShading)) { <END> return cachedShadings.get(newShading); } else { MapColor shaded = new SpongeMapColor(this, newShading); cachedShadings.put(newShading, shaded); return shaded; } }</code><technical_language>Reduce map lookup a single lookup simply calling get() check for nulls, if a null, put in</technical_language>

Target:
public MapColor shade(MapShade newShading) { MapColor shaded = cachedShadings.get(newShading); if (shaded == null) { shaded = new SpongeMapColor((net.minecraft.block.material.MapColor) (Object) this, (SpongeMapShade) newShading); cachedShadings.put(newShading, shaded); } return shaded; }
Source:
<code>public void setEmptyExceptionSpecification() { assertNotFrozen(); typeIds = IASTTypeId.EMPTY_TYPEID_ARRAY; <START> setNoexceptExpression(new CPPASTLiteralExpression(IASTLiteralExpression.lk_true, "true".toCharArray())); END> }</code><technical_language>I need invent AST node, do evaluation level. add ICPPASTFunctionDeclarator.getNoexceptEvaluation(), implementation does: if (getNoexceptionExpression() != null) { return getNoexceptionExpression().getEvaluation(); } if (getExceptionSpecification() == IASTTypeId.EMPTY_TYPEID_ARRAY) { return /* EvalFixed for "true" */; } return null; getNoexceptionEvaluation() instead of getNoexceptExpression().getEvaluation() creating function types</technical_language>

Target:
public void setEmptyExceptionSpecification() { assertNotFrozen(); typeIds = IASTTypeId.EMPTY_TYPEID_ARRAY; }
Source:
<code>public List<Workflow> userServices(@ApiParam(hidden = true) @Auth User user, @ApiParam(value = "User ID", required = true) @PathParam("userId") Long userId) { checkUser(user, userId); <START> final User authUser = this.userDAO.findById(userId); <END> List<Workflow> services = getServices(authUser); EntryVersionHelper.stripContent(services, this.userDAO); return services; }</code><technical_language>I find more intuitive if @Auth User user is @Auth User authUser this is final User user 2nd user if is admin</technical_language>

Target:
public List<Workflow> userServices(@ApiParam(hidden = true) @Auth User user, @ApiParam(value = "User ID", required = true) @PathParam("userId") Long userId) { checkUser(user, userId); final User fetchedUser = this.userDAO.findById(userId); if (fetchedUser == null) { throw new CustomWebApplicationException("The given user does not exist.", HttpStatus.SC_NOT_FOUND); } List<Workflow> services = getServices(fetchedUser); EntryVersionHelper.stripContent(services, this.userDAO); return services; }
Source:
<code>@Test public void annotationQueryTrimsSpaces() { assertThat(queryBuilder.parseAnnotationQuery("fo and o and bar and http.path = /a ").annotationQuery) .containsOnly(entry("fo", ""), entry("o", ""), entry("bar", ""), entry("http.path", "/a")); assertThat(queryBuilder.parseAnnotationQuery(" http.path = /a and fo and o and bar").annotationQuery) .containsOnly(entry("fo", ""), entry("o", ""), entry("bar", ""), entry("http.path", "/a")); assertThat(queryBuilder.parseAnnotationQuery("L O L").annotationQuery) .containsOnly(entry("L O L", "")); assertThat(queryBuilder.parseAnnotationQuery("L O L and http.path = /a").annotationQuery) .containsOnly(entry("L O L", ""), entry("http.path", "/a")); assertThat(queryBuilder.parseAnnotationQuery("bar =123 and L O L and http.path = /a and A B C").annotationQuery) .containsOnly(entry("L O L", ""), entry("http.path", "/a"), entry("bar", "123"), entry("A B C", "")); <START> assertThat(queryBuilder.parseAnnotationQuery("L O L=123 and L O L and http.path = /a").annotationQuery) <END> .containsOnly(entry("L O L", ""), entry("http.path", "/a")); }</code><technical_language>backend do a redundant query. Technically, specific win based query rules</technical_language>

Target:
@Test public void annotationQueryTrimsSpaces() { assertThat(queryBuilder.parseAnnotationQuery("fo and o and bar and http.path = /a ").annotationQuery) .containsOnly(entry("fo", ""), entry("o", ""), entry("bar", ""), entry("http.path", "/a")); assertThat(queryBuilder.parseAnnotationQuery(" http.path = /a and fo and o and bar").annotationQuery) .containsOnly(entry("fo", ""), entry("o", ""), entry("bar", ""), entry("http.path", "/a")); assertThat(queryBuilder.parseAnnotationQuery("L O L").annotationQuery) .containsOnly(entry("L O L", "")); assertThat(queryBuilder.parseAnnotationQuery("L O L and http.path = /a").annotationQuery) .containsOnly(entry("L O L", ""), entry("http.path", "/a")); assertThat(queryBuilder.parseAnnotationQuery("bar =123 and L O L and http.path = /a and A B C").annotationQuery) .containsOnly(entry("L O L", ""), entry("http.path", "/a"), entry("bar", "123"), entry("A B C", "")); }
Source:
<code>public static void main(String[] args) throws Exception { SiteConfiguration siteConfig = SiteConfiguration.getInstance(); Configuration conf = new Configuration(); FileSystem hadoopFs = FileSystem.get(conf); FileSystem localFs = FileSystem.getLocal(conf); Path path = new Path(args[0]); FileSystem fs; if (args[0].contains(":")) fs = path.getFileSystem(conf); else fs = hadoopFs.exists(path) ? hadoopFs : localFs; <START> printMetaBlockInfo(siteConfig, conf, fs, path); <END> }</code><technical_language>create some sort of "offline context" is specialized for cases server-side offline tools access offline system resources, site configuration</technical_language>

Target:
public static void main(String[] args) throws Exception { SiteConfiguration siteConfig = SiteConfiguration.create(); Configuration conf = new Configuration(); FileSystem hadoopFs = FileSystem.get(conf); FileSystem localFs = FileSystem.getLocal(conf); Path path = new Path(args[0]); FileSystem fs; if (args[0].contains(":")) fs = path.getFileSystem(conf); else fs = hadoopFs.exists(path) ? hadoopFs : localFs; printMetaBlockInfo(siteConfig, conf, fs, path); }
Source:
<code>public void setITestResultobj(ITestResult iTestResult) { logger.entering(iTestResult); this.iTestResult = iTestResult; this.durationTaken = iTestResult.getEndMillis() - iTestResult.getStartMillis(); this.iStatus = iTestResult.getStatus(); ITestNGMethod singleMethod = iTestResult.getMethod(); StringBuilder sMethodName = new StringBuilder(this.iTestResult.getName()); Object[] metParamArray = this.iTestResult.getParameters(); if (metParamArray.length > 0) { for (int i = 0; i < metParamArray.length; i++) { sMethodName.append(" [").append(metParamArray[i]).append("]"); } } this.setMethodName(sMethodName.toString()); this.setClassName(singleMethod.getTestClass().getName()); this.setTestDesc(singleMethod.getDescription()); if (singleMethod.getGroups().length == 0) { this.getGroup().add(NA); this.setGroup(this.getGroup()); } else { this.setGroup(Arrays.asList(singleMethod.getGroups())); } this.sSSMsg = makeContentForLinksColumn(iTestResult); if (iStatus == ITestResult.FAILURE) { <START> String stacktrace = StringUtils.defaultString(StringUtils.substringBetween( <END> ExceptionUtils.getStackTrace(iTestResult.getThrowable()), newLine, "\tat sun.reflect"), ExceptionUtils.getStackTrace(iTestResult.getThrowable())); lstError.add(iTestResult.getThrowable().toString() + newLine + stacktrace.replace("\t", "\t\t")); String defectMsg = TestCaseErrors.getInstance().debugError(iTestResult.getThrowable()); lstDefectMsg.add(defectMsg == null ? "Assert Failed or Script error" : defectMsg); } logger.exiting(); }</code><technical_language>I suggest please break this individual calls. difficult read difficult debug well</technical_language>

Target:
public void setITestResultobj(ITestResult iTestResult) { logger.entering(iTestResult); this.iTestResult = iTestResult; this.durationTaken = iTestResult.getEndMillis() - iTestResult.getStartMillis(); this.iStatus = iTestResult.getStatus(); ITestNGMethod singleMethod = iTestResult.getMethod(); StringBuilder sMethodName = new StringBuilder(this.iTestResult.getName()); Object[] metParamArray = this.iTestResult.getParameters(); if (metParamArray.length > 0) { for (int i = 0; i < metParamArray.length; i++) { sMethodName.append(" [").append(metParamArray[i]).append("]"); } } this.setMethodName(sMethodName.toString()); this.setClassName(singleMethod.getTestClass().getName()); this.setTestDesc(singleMethod.getDescription()); if (singleMethod.getGroups().length == 0) { this.getGroup().add(NA); this.setGroup(this.getGroup()); } else { this.setGroup(Arrays.asList(singleMethod.getGroups())); } this.sSSMsg = makeContentForLinksColumn(iTestResult); if (iStatus == ITestResult.FAILURE) { String stacktrace = StringUtils.substringBetween(ExceptionUtils.getStackTrace(iTestResult.getThrowable()), NEWLINE, "\tat sun.reflect"); stacktrace = StringUtils .defaultString(stacktrace, ExceptionUtils.getStackTrace(iTestResult.getThrowable())); lstError.add(iTestResult.getThrowable().toString() + NEWLINE + stacktrace.replace("\t", "\t\t")); String defectMsg = TestCaseErrors.getInstance().debugError(iTestResult.getThrowable()); lstDefectMsg.add(defectMsg == null ? "Assert Failed or Script error" : defectMsg); } logger.exiting(); }
Source:
<code>public void setPublication(String id, String title, String type, String nameType, String authors, String date, String doi, String vipApplication) { if (title != null) { idPub = Long.valueOf(id); this.newPublication = false; WidgetUtil.resetIButton(saveButton, "Update", CoreConstants.ICON_EDIT); this.titleField.setValue(title); this.publicationType.setValue(type); this.publicationTypeName.setValue(nameType); this.publicationDate.setValue(date); this.doiField.setValue(doi); this.authorsField.setValue(authors); this.vipApplication.setValue(vipApplication); } else { this.newPublication = true; WidgetUtil.resetIButton(saveButton, "Add", CoreConstants.ICON_ADD); this.titleField.setValue(""); this.publicationType.setValue(""); this.publicationTypeName.setValue(""); this.publicationDate.setValue(""); this.doiField.setValue(""); this.authorsField.setValue(""); <START> this.vipApplication.setValue(vipApplication); <END> } }</code><technical_language>Is .setValue("") ? I fear if is "", try save in database results in key violation. I missed something</technical_language>

Target:
public void setPublication(String id, String title, String type, String nameType, String authors, String date, String doi, String vipApplication) { if (title != null) { idPub = Long.valueOf(id); this.newPublication = false; WidgetUtil.resetIButton(saveButton, "Update", CoreConstants.ICON_EDIT); this.titleField.setValue(title); this.publicationType.setValue(type); this.publicationTypeName.setValue(nameType); this.publicationDate.setValue(date); this.doiField.setValue(doi); this.authorsField.setValue(authors); this.vipApplication.setValue(vipApplication); } else { this.newPublication = true; WidgetUtil.resetIButton(saveButton, "Add", CoreConstants.ICON_ADD); this.titleField.setValue(""); this.publicationType.setValue(""); this.publicationTypeName.setValue(""); this.publicationDate.setValue(""); this.doiField.setValue(""); this.authorsField.setValue(""); this.vipApplication.setValue(""); } }
Source:
<code>private static void sendAndCleanupConnection(ChannelHandlerContext ctx, FullHttpResponse response, boolean keepAlive) { HttpUtil.setContentLength(response, response.content().readableBytes()); if (!keepAlive) { response.headers().set(HttpHeaderNames.CONNECTION, HttpHeaderValues.CLOSE); } ctx.write(response); <START> ChannelFuture lastWrite = ctx.writeAndFlush(LastHttpContent.EMPTY_LAST_CONTENT); <END> if (!keepAlive) { lastWrite.addListener(ChannelFutureListener.CLOSE); } }</code><technical_language>@kachayev this is correct write a FullHttpResonse write extra LastHttpContent</technical_language>

Target:
private static void sendAndCleanupConnection(ChannelHandlerContext ctx, FullHttpResponse response, boolean keepAlive) { HttpUtil.setContentLength(response, response.content().readableBytes()); if (!keepAlive) { response.headers().set(HttpHeaderNames.CONNECTION, HttpHeaderValues.CLOSE); } ChannelFuture flushPromise = ctx.writeAndFlush(response); if (!keepAlive) { flushPromise.addListener(ChannelFutureListener.CLOSE); } }
Source:
<code>private boolean matchesValues(Map<String, Object> data) { for (Map.Entry<String, String> entry : includeColumnValues.entrySet()) { String column = entry.getKey(); if (data.containsKey(column)) { String columnValue = entry.getValue(); Object value = data.get(column); <START> if (value == null) return false; <END> String valueString = value.toString(); if (!columnValue.equals(valueString)) return false; } } return true; }</code><technical_language>I in including NULL columns; special case (if user passes in C=null, matches NULL "null". kinda odd non-ideal hey ok for government work)</technical_language>

Target:
private boolean matchesValues(Map<String, Object> data) { for (Map.Entry<String, String> entry : includeColumnValues.entrySet()) { String column = entry.getKey(); if (data.containsKey(column)) { String expectedColumnValue = entry.getValue(); Object value = data.get(column); if ("NULL".equals(expectedColumnValue)) { if (value != null && !"null".equals(value) && !"NULL".equals(value)) { return false; } } else { if (value == null || !expectedColumnValue.equals(value.toString())) { return false; } } } } return true; }
Source:
<code>private JButton getBtnOpen() { if (btnOpen == null) { btnOpen = new JButton(); <START> btnOpen.setEnabled(Desktop.getDesktop().isSupported(Desktop.Action.OPEN)); <END> btnOpen.setText(Constant.messages.getString("support.open.button")); btnOpen.setToolTipText(Constant.messages.getString("support.open.button.tooltip")); btnOpen.addActionListener(new java.awt.event.ActionListener() { @Override public void actionPerformed(java.awt.event.ActionEvent e) { try { Desktop.getDesktop().open(new File(Constant.getZapHome())); } catch (IOException e1) { LOGGER.error("An exception occurred while trying to have the OS open ZAP's Home Directory.", e1); } } }); } return btnOpen; }</code><technical_language>check Desktop.isDesktopSupported()</technical_language>

Target:
private JButton getBtnOpen() { if (btnOpen == null) { btnOpen = new JButton(); if (Desktop.isDesktopSupported()) { btnOpen.setEnabled(Desktop.getDesktop().isSupported(Desktop.Action.OPEN)); } else { btnOpen.setEnabled(false); } btnOpen.setText(Constant.messages.getString("support.open.button")); btnOpen.setToolTipText(Constant.messages.getString("support.open.button.tooltip")); btnOpen.addActionListener(new java.awt.event.ActionListener() { @Override public void actionPerformed(java.awt.event.ActionEvent e) { try { Desktop.getDesktop().open(new File(Constant.getZapHome())); } catch (IOException e1) { LOGGER.error("An exception occurred while trying to have the OS open ZAP's Home Directory.", e1); } } }); } return btnOpen; }
Source:
<code>public String volumeSearch(HttpServletRequest request, Model model, @SiteParam Site site, @RequestParam MultiValueMap<String, String> params) throws IOException { CommonParams commonParams = new CommonParams(siteSet, site); commonParams.parseParams(params); commonParams.addToModel(model, request); addOptionsToModel(model); int volume; try { volume = Integer.parseInt(params.getFirst("volume")); } catch (NumberFormatException nfe) { return renderEmptyResults(null, "volume:" + params.getFirst("volume"), model, site); } <START> String volumeFilter = String.format("volume:%d", volume); <END> ArticleSearchQuery.Builder query = ArticleSearchQuery.builder() .setFilterQueries(ImmutableList.of(volumeFilter)); commonParams.fill(query); Map<?, ?> searchResults = solrSearchService.search(query.build()); model.addAttribute("searchResults", solrSearchService.addArticleLinks(searchResults, request, site, siteSet)); model.addAttribute("otherQuery", volumeFilter); model.addAttribute("searchFilters", searchFilterService.getVolumeSearchFilters(volume, commonParams.journalKeys, commonParams.articleTypes, commonParams.dateRange)); return site.getKey() + "/ftl/search/searchResults"; }</code><technical_language>Is move this solr specific logic solrSearchService</technical_language>

Target:
public String volumeSearch(HttpServletRequest request, Model model, @SiteParam Site site, @RequestParam MultiValueMap<String, String> params) throws IOException { CommonParams commonParams = new CommonParams(siteSet, site); commonParams.parseParams(params); commonParams.addToModel(model, request); addOptionsToModel(model); int volume; try { volume = Integer.parseInt(params.getFirst("volume")); } catch (NumberFormatException nfe) { return renderEmptyResults(null, "volume:" + params.getFirst("volume"), model, site); } ArticleSearchQuery query = commonParams.fill(ArticleSearchQuery.builder()).build(); Map<?, ?> searchResults = solrSearchService.searchVolume(query, volume); model.addAttribute("searchResults", solrSearchService.addArticleLinks(searchResults, request, site, siteSet)); model.addAttribute("otherQuery", String.format("volume:%d", volume)); model.addAttribute("searchFilters", searchFilterService.getVolumeSearchFilters(volume, commonParams.journalKeys, commonParams.articleTypes, commonParams.dateRange)); return site.getKey() + "/ftl/search/searchResults"; }
Source:
<code><START> public DimensionsSpec getDimensionsSpec() <END> { return dimensionsSpec; }</code><technical_language>Similar suggestion getTimestampSpec()</technical_language>

Target:
public DimensionsSpec getDimensionsSpec() { if (dimensionsSpec == null) { dimensionsSpec = computeDimensionsSpec( getTimestampSpec(), Preconditions.checkNotNull(getParser(), "inputRowParser").getParseSpec().getDimensionsSpec(), aggregators ); } return dimensionsSpec; }
Source:
<code>public void triggerNow() { if (updateTimerJob != null) { try { updateTimerJob.cancel(true); } catch (Throwable t) { <START> log.debug("Exception cancelling existing job: {}", ExceptionUtils.getRootCauseMessage(t)); <END> } } updateTimerJob = schedulerService.scheduleWithFixedDelay(this::ovfUpdate, 0, Config.<Integer> getValue(ConfigValues.OvfUpdateIntervalInMinutes), TimeUnit.MINUTES); }</code><technical_language>if alright in this case task running simultaneously threads</technical_language>

Target:
public void triggerNow() { if (updateTimerJob != null) { try { updateTimerJob.cancel(false); } catch (Throwable t) { log.debug("Exception cancelling existing job: {}", ExceptionUtils.getRootCauseMessage(t)); } } updateTimerJob = schedulerService.scheduleWithFixedDelay(this::ovfUpdate, 0, Config.<Integer> getValue(ConfigValues.OvfUpdateIntervalInMinutes), TimeUnit.MINUTES); }
Source:
<code>public HttpResponse doDisable(StaplerRequest req) throws IOException { LOGGER.finest("Trying to disable all jobs in " + item.getName()); for (Job job : getPossibleJobs()) { try { ((AbstractProject) job).disable(); LOGGER.finest("Set " + job.getName() + " as not buildable"); } catch (ClassCastException e) { <START> LOGGER.info("Cannot disable " + job.getName()); <END> LOGGER.fine(e.getMessage()); } } return HttpResponses.redirectViaContextPath(item.getParent().getUrl() + item.getShortUrl()); }</code><technical_language>CCE is a user cares about, means API for this is weird. This handled internally, displayed user "The disabled"</technical_language>

Target:
public HttpResponse doDisable(StaplerRequest req) throws IOException { LOGGER.finest("Trying to disable all jobs in " + item.getName()); Collection<Job> missed = Lists.newArrayList(); for (Job job : getPossibleJobs()) { try { ((AbstractProject) job).disable(); LOGGER.finest("Set " + job.getName() + " as not buildable"); missed.add(job); } catch (ClassCastException e) { LOGGER.info("Cannot disable " + job.getName()); LOGGER.info(e.getMessage()); } } if (!missed.isEmpty()) { return HttpResponses.forwardToView(this, "error").with("missed", missed); } return HttpResponses.redirectViaContextPath(item.getParent().getUrl() + item.getShortUrl()); }
Source:
<code>public void checkForHashes (HttpMessage msg, int id, String haystacks) { String hashType = null; Iterator<Pattern> patternIterator = hashPatterns.keySet().iterator(); int minimumConfidence = Alert.CONFIDENCE_LOW; switch (this.getAlertThreshold()) { case HIGH: minimumConfidence = Alert.CONFIDENCE_HIGH; break; case MEDIUM: minimumConfidence = Alert.CONFIDENCE_MEDIUM; break; } while (patternIterator.hasNext()) { Pattern hashPattern = patternIterator.next(); HashAlert hashalert = hashPatterns.get(hashPattern); <START> if (hashalert.getReliability() < minimumConfidence) <END> continue; hashType = hashalert.getDescription(); if (log.isDebugEnabled()) log.debug("Trying Hash Pattern: " + hashPattern + " for hash type " + hashType); for (String haystack: haystacks) { Matcher matcher = hashPattern.matcher(haystack); while (matcher.find()) { String evidence = matcher.group(); if (log.isDebugEnabled()) log.debug("Found a match for hash type " + hashType + ":" + evidence); if (evidence != null && evidence.length() > 0) { Alert alert = new Alert(getPluginId(), hashalert.getRisk(), hashalert.getReliability(), getName() + " - "+ hashType ); alert.setDetail( getDescription() + " - " + hashType, msg.getRequestHeader().getURI().toString(), "", "", getExtraInfo(msg, evidence), getSolution(), getReference(), evidence, 200, 13, msg); parent.raiseAlert(id, alert); } } } } }</code><technical_language>This is syntactically correct, maintaining curly braces consistent more clear/explicit</technical_language>

Target:
public void checkForHashes(HttpMessage msg, int id, String haystacks) { String hashType = null; Iterator<Pattern> patternIterator = hashPatterns.keySet().iterator(); int minimumConfidence = Alert.CONFIDENCE_LOW; switch (this.getAlertThreshold()) { case HIGH: minimumConfidence = Alert.CONFIDENCE_HIGH; break; case MEDIUM: minimumConfidence = Alert.CONFIDENCE_MEDIUM; break; } while (patternIterator.hasNext()) { Pattern hashPattern = patternIterator.next(); HashAlert hashalert = hashPatterns.get(hashPattern); if (hashalert.getReliability() < minimumConfidence) { continue; } hashType = hashalert.getDescription(); if (log.isDebugEnabled()) log.debug("Trying Hash Pattern: " + hashPattern + " for hash type " + hashType); for (String haystack: haystacks) { Matcher matcher = hashPattern.matcher(haystack); while (matcher.find()) { String evidence = matcher.group(); if (log.isDebugEnabled()) log.debug("Found a match for hash type " + hashType + ":" + evidence); if (evidence != null && evidence.length() > 0) { Alert alert = new Alert(getPluginId(), hashalert.getRisk(), hashalert.getReliability(), getName() + " - " + hashType); alert.setDetail( getDescription() + " - " + hashType, msg.getRequestHeader().getURI().toString(), "", "", getExtraInfo(msg, evidence), getSolution(), getReference(), evidence, 200, 13, msg); parent.raiseAlert(id, alert); } } } } }
Source:
<code>public long getToDate() { if (this.q == null || !this.q.isToDateInQuery) { return TimeHelper.now(0.0).getTimeInMillis(); } else { <START> return this.q.toDateValue; <END> } }</code><technical_language>no-else-return: this block shortened to: java if (condition) { return ...; } return ...;</technical_language>

Target:
public long getToDate() { if (this.q == null || !this.q.isToDateInQuery) { return TimeHelper.now(0.0).getTimeInMillis(); } return this.q.toDateValue; }
Source:
<code>private static void appendToFile(String fileName, String fileContent) { try { File file = new File(fileName); if (!file.exists()) { file.createNewFile(); } <START> FileWriter fw = new FileWriter(file.getAbsoluteFile(), true); <END> try (BufferedWriter bw = new BufferedWriter(fw)) { bw.write(fileContent); } } catch (IOException e) { e.printStackTrace(); } }</code><technical_language>This part of try-with-resources block</technical_language>

Target:
private static void appendToFile(String fileName, String fileContent) { try { File file = new File(fileName); if (!file.exists()) { file.createNewFile(); } try (BufferedWriter bw = new BufferedWriter(new FileWriter(file.getAbsoluteFile(), true))) { bw.write(fileContent); } } catch (IOException e) { e.printStackTrace(); } }
Source:
<code>public void onStart() { super.onStart(); if (handled || connection == null) { return; } handled = true; Intent intent = getActivity().getIntent(); String pluginUrl; switch (intent.getAction()) { case Intent.ACTION_SEND: String extraText = intent.getStringExtra(Intent.EXTRA_TEXT); pluginUrl = YOUTUBE_APP.urlFrom(extraText); pluginUrl = pluginUrl != null ? pluginUrl : TWITCH_APP.urlFrom(extraText); break; case Intent.ACTION_VIEW: pluginUrl = GENERIC.urlFrom(intent.getDataString()); break; default: return; } if (pluginUrl == null) { say(R.string.error_share_video); return; } final Handler h = new Handler(); final String file = pluginUrl; isPlayingVideo(h).start(new OnFinish<Boolean>() { @Override public void got(Boolean isPlaying) { if (isPlaying) { new Seq<>(enqueue(h, file)) .then(hostNotify(h, getString(R.string.shared_video_added))) .start(refreshPlaylist()); } else { new Seq<>(clearPlaylist(h)) .then(enqueue(h, file)) <START> .then(play(h)) <END> .start(refreshPlaylist()); } } }); }</code><technical_language>Thanks for explaining. However, a hard time manually reproducing flow. I understand this pattern is a combination of builder chain pattern</technical_language>

Target:
public void onStart() { super.onStart(); Intent intent = getActivity().getIntent(); String action = intent.getAction(); if (handled || connection == null || action == null) { return; } handled = true; String pluginUrl; switch (action) { case Intent.ACTION_SEND: pluginUrl = urlFrom(intent.getStringExtra(Intent.EXTRA_TEXT)); break; case Intent.ACTION_VIEW: pluginUrl = urlFrom(intent.getDataString()); break; default: return; } if (pluginUrl == null) { say(R.string.error_share_video); return; } final Handler handler = new Handler(); final String file = pluginUrl; isPlayingVideo(handler).start(new Task.OnFinish<Boolean>() { @Override public void got(Boolean isPlaying) { if (isPlaying) { new Task.Sequence<>(enqueue(handler, file)) .then(hostNotify(handler, getString(R.string.shared_video_added))) .start(refreshPlaylist()); } else { new Task.Sequence<>(clearPlaylist(handler)) .then(enqueue(handler, file)) .then(play(handler)) .start(refreshPlaylist()); } } }); }
Source:
<code>private void getStreams(ReceiveResponse receiveResponse, Writer out, Writer err) { List<StreamType> streams = receiveResponse.getStream(); for (StreamType s : streams) { byte[] value = s.getValue(); <START> if (value == null) continue; <END> if (out != null && "stdout".equals(s.getName())) { try { if (value.length > 0) { out.write(new String(value)); } if (Boolean.TRUE.equals(s.isEnd())) { out.close(); } } catch (IOException e) { throw new IllegalStateException(e); } } if (err != null && "stderr".equals(s.getName())) { try { if (value.length > 0) { err.write(new String(value)); } if (Boolean.TRUE.equals(s.isEnd())) { err.close(); } } catch (IOException e) { throw new IllegalStateException(e); } } } }</code><technical_language>get a null s.isEnd()? instead delete this line, change if statements if (value != null && value.length > 0) {</technical_language>

Target:
private void getStreams(ReceiveResponse receiveResponse, Writer out, Writer err) { List<StreamType> streams = receiveResponse.getStream(); for (StreamType s : streams) { byte[] value = s.getValue(); if (value == null) continue; if (out != null && "stdout".equals(s.getName())) { try { if (value.length > 0) { out.write(new String(value)); } if (Boolean.TRUE.equals(s.isEnd())) { out.close(); } } catch (IOException e) { throw new IllegalStateException(e); } } if (err != null && "stderr".equals(s.getName())) { try { if (value.length > 0) { err.write(new String(value)); } if (Boolean.TRUE.equals(s.isEnd())) { err.close(); } } catch (IOException e) { throw new IllegalStateException(e); } } } try { out.close(); err.close(); } catch (IOException e) { throw new IllegalStateException(e); } }
Source:
<code>protected HttpAction redirectToOriginallyRequestedUrl(final C context, final String defaultUrl) { <START> final String requestedUrl = (String) context.getSessionStore().get(context, Pac4jConstants.REQUESTED_URL).get(); <END> String redirectUrl = defaultUrl; if (isNotBlank(requestedUrl)) { context.getSessionStore().set(context, Pac4jConstants.REQUESTED_URL, null); redirectUrl = requestedUrl; } logger.debug("redirectUrl: {}", redirectUrl); return HttpAction.redirect(context, redirectUrl); }</code><technical_language>get()</technical_language>

Target:
protected HttpAction redirectToOriginallyRequestedUrl(final C context, final String defaultUrl) { final Optional<String> requestedUrlOpt = context.getSessionStore().get(context, Pac4jConstants.REQUESTED_URL); String redirectUrl = requestedUrlOpt.filter(url -> isNotBlank(url)).orElse(defaultUrl); if (!defaultUrl.equals(redirectUrl)) { context.getSessionStore().set(context, Pac4jConstants.REQUESTED_URL, null); } logger.debug("redirectUrl: {}", redirectUrl); return HttpAction.redirect(context, redirectUrl); }
Source:
<code>public ConfigDiff buildConfigDiff(PluginTask task, Schema schema, int taskCount, List<TaskReport> taskReports) { ConfigDiff configDiff = super.buildConfigDiff(task, schema, taskCount, taskReports); if (task.getQueryBy().isPresent() && task.getQueryBy().get() == QueryBy.DATE_RANGE && task.getIncremental()) { DateTime earliest = new DateTime(task.getEarliestUpdatedAt().get()); DateTime latest = new DateTime(task.getLatestUpdatedAt().get()); Duration d = new Duration(earliest, latest); DateTime nextEarliestUpdatedAt = latest.plusSeconds(1); configDiff.set("earliest_updated_at", nextEarliestUpdatedAt.toString(DATE_FORMATER)); if (task.getReportDuration().isPresent()) { <START> configDiff.set("report_duration", task.getReportDuration()); <END> } else { configDiff.set("report_duration", Optional.of(d.getMillis())); } } return configDiff; }</code><technical_language>Optional class method executed if optional is presented: <LINK_0>, instead of if else</technical_language>

Target:
public ConfigDiff buildConfigDiff(PluginTask task, Schema schema, int taskCount, List<TaskReport> taskReports) { ConfigDiff configDiff = super.buildConfigDiff(task, schema, taskCount, taskReports); if (task.getQueryBy().isPresent() && task.getQueryBy().get() == QueryBy.DATE_RANGE && task.getIncremental()) { DateTime earliest = new DateTime(task.getEarliestUpdatedAt().get()); DateTime latest = new DateTime(task.getLatestUpdatedAt().get()); Duration d = new Duration(earliest, latest); DateTime nextEarliestUpdatedAt = latest.plusSeconds(1); configDiff.set("earliest_updated_at", nextEarliestUpdatedAt.toString(DATE_FORMATTER)); configDiff.set("report_duration", task.getReportDuration().or(d.getMillis())); } return configDiff; }
Source:
<code>private static Collection<String> getErrorParserContexts(String id) { Set<String> contexts = fErrorParserContexts.get(id); if (contexts == null) { <START> return Collections.singleton(ErrorParserManager.BUILD_CONTEXT); <END> } return contexts; }</code><technical_language>Better: singletonSet</technical_language>

Target:
private static Collection<String> getErrorParserContexts(String id) { Set<String> contexts = fErrorParserContexts.get(id); if (contexts == null) { return Collections.singletonList(ErrorParserManager.BUILD_CONTEXT); } return contexts; }