auphong2707/dl4se-code-review-dataset huggingface dataset:
Source:
<code>public void write(final Channel channel, NettyResponseFuture<?> future) { Object msg; if (body instanceof RandomAccessBody && !ChannelManager.isSslHandlerConfigured(channel.pipeline()) && !config.isDisableZeroCopy()) { msg = new BodyFileRegion((RandomAccessBody) body); channel.write(msg, channel.newProgressivePromise()) .addListener(new WriteProgressListener(future, false, getContentLength()) { @Override public void operationComplete(ChannelProgressiveFuture cf) { <START> closeSilently(body); <END> super.operationComplete(cf); } }); } else { msg = new BodyChunkedInput(body); BodyGenerator bg = future.getTargetRequest().getBodyGenerator(); if (bg instanceof FeedableBodyGenerator && !(bg instanceof ReactiveStreamsBodyGenerator)) { final ChunkedWriteHandler chunkedWriteHandler = channel.pipeline().get(ChunkedWriteHandler.class); FeedableBodyGenerator.class.cast(bg).setListener(new FeedListener() { @Override public void onContentAdded() { chunkedWriteHandler.resumeTransfer(); } @Override public void onError(Throwable t) { } }); } channel.write(msg, channel.newProgressivePromise()) .addListener(new WriteProgressListener(future, false, getContentLength()) { @Override public void operationComplete(ChannelProgressiveFuture cf) { closeSilently(body); super.operationComplete(cf); } @Override protected boolean abortOnThrowable(Channel channel, Throwable cause) { if (cause instanceof IOException && StackTraceInspector.recoverOnChunkedUploadFailed(cause)) return false; return super.abortOnThrowable(channel, cause); } }); } channel.writeAndFlush(LastHttpContent.EMPTY_LAST_CONTENT, channel.voidPromise()); }</code><technical_language>do need that? I expect Netty close ChunkedInput</technical_language>

Target:
public void write(final Channel channel, NettyResponseFuture<?> future) { Object msg; if (body instanceof RandomAccessBody && !ChannelManager.isSslHandlerConfigured(channel.pipeline()) && !config.isDisableZeroCopy()) { msg = new BodyFileRegion((RandomAccessBody) body); } else { msg = new BodyChunkedInput(body); BodyGenerator bg = future.getTargetRequest().getBodyGenerator(); if (bg instanceof FeedableBodyGenerator && !(bg instanceof ReactiveStreamsBodyGenerator)) { final ChunkedWriteHandler chunkedWriteHandler = channel.pipeline().get(ChunkedWriteHandler.class); FeedableBodyGenerator.class.cast(bg).setListener(new FeedListener() { @Override public void onContentAdded() { chunkedWriteHandler.resumeTransfer(); } @Override public void onError(Throwable t) { } }); } } channel.write(msg, channel.newProgressivePromise()) .addListener(new WriteProgressListener(future, false, getContentLength()) { @Override public void operationComplete(ChannelProgressiveFuture cf) { closeSilently(body); super.operationComplete(cf); } @Override protected boolean abortOnThrowable(Channel channel, Throwable cause) { return cause instanceof ChannelOutputShutdownException || super.abortOnThrowable(channel, cause); } }); channel.writeAndFlush(LastHttpContent.EMPTY_LAST_CONTENT, channel.voidPromise()); }
Source:
<code>public ResourceManagerThrottlingInfo(HttpHeaders headers) { commonRateLimits = new HashMap<>(); for (String header : COMMON_RATE_LIMIT_HEADERS) { String value = headers.getValue(header); if (value != null && !value.isEmpty()) { commonRateLimits.put(header, value); } } resourceRateLimit = headers.getValue(RESOURCE_RATE_LIMIT_HEADERS); <START> Matcher matcher = Pattern.compile("\\w+\\.\\w+/([^;]+);(\\d+)").matcher(resourceRateLimit); <END> while (matcher.find()) { commonRateLimits.put( String.format("%s-%s", RESOURCE_RATE_LIMIT_HEADERS, matcher.group(1)), matcher.group(2)); } }</code><technical_language>put Pattern.compile("\\w+\\.\\w+/([^;]+);(\\d+)") a static, save runtime cost do time</technical_language>

Target:
public ResourceManagerThrottlingInfo(HttpHeaders headers) { commonRateLimits = new HashMap<>(); for (String header : COMMON_RATE_LIMIT_HEADERS) { String value = headers.getValue(header); if (value != null && !value.isEmpty()) { commonRateLimits.put(header, value); } } resourceRateLimit = headers.getValue(RESOURCE_RATE_LIMIT_HEADER); Matcher matcher = RESOURCE_RATE_LIMIT_HEADER_PATTERN.matcher(resourceRateLimit); while (matcher.find()) { commonRateLimits.put( String.format("%s-%s", RESOURCE_RATE_LIMIT_HEADER, matcher.group(1)), matcher.group(2)); } }
Source:
<code>public static int innerMain(String[] args) { BaseOptions base = new BaseOptions(); JCommander jc = new JCommander(base); jc.setProgramName("ehcache-ops"); jc.addCommand(new ListCacheManagers(base)); jc.addCommand(new CreateCacheManager(base)); jc.addCommand(new UpdateCacheManager(base)); jc.addCommand(new DestroyCacheManager(base)); jc.setParameterDescriptionComparator(REQUIRED_FIRST); for (JCommander jcc : jc.getCommands().values()) { jcc.setParameterDescriptionComparator(REQUIRED_FIRST); } try { jc.parse(args); if (base.isHelp()) { jc.usage(); return 1; } else { int result = 0; for (Object o : jc.getCommands().get(jc.getParsedCommand()).getObjects()) { result |= ((Command) o).execute(); }; return result; } } catch (ParameterException e) { <START> System.out.println(e.getMessage()); <END> jc.usage(); return 1; } }</code><technical_language>In a strictly Unix'y world, this error stream</technical_language>

Target:
public static int innerMain(String[] args) { BaseOptions base = new BaseOptions(); JCommander jc = new JCommander(base); jc.setProgramName("ehcache-ops"); jc.addCommand(new ListCacheManagers(base)); jc.addCommand(new CreateCacheManager(base)); jc.addCommand(new UpdateCacheManager(base)); jc.addCommand(new DestroyCacheManager(base)); jc.setParameterDescriptionComparator(REQUIRED_FIRST); for (JCommander jcc : jc.getCommands().values()) { jcc.setParameterDescriptionComparator(REQUIRED_FIRST); } try { jc.parse(args); if (base.isHelp()) { return usage(jc, new StringBuilder()); } else { int result = 0; for (Object o : jc.getCommands().get(jc.getParsedCommand()).getObjects()) { result |= ((Command) o).execute(); }; return result; } } catch (ParameterException e) { return usage(jc, new StringBuilder(e.getMessage()).append("\n")); } }
Source:
<code>void testSerialiseQuestionlessForm() throws IOException { Survey form1 = new Survey(); form1.setKey(KeyFactory.createKey("Survey", 17L)); form1.setName("This is a form"); form1.setVersion(11.0); QuestionGroup qg = new QuestionGroup(); qg.setKey(KeyFactory.createKey("Survey", 18L)); qg.setSurveyId(17L); qg.setName("This is a group"); qg.setOrder(1); TreeMap<Integer, QuestionGroup> gl = new TreeMap<>(); gl.put(1, qg); form1.setQuestionGroupMap(gl); XmlForm form = new XmlForm(form1, "Name of containing survey"); assertNotEquals(null, form); assertNotEquals(null, form.getQuestionGroup()); List<XmlQuestionGroup> ga = form.getQuestionGroup(); assertEquals(1, ga.size()); assertEquals("This is a group", ga.get(0).getHeading()); assertEquals(1, ga.get(0).getOrder()); assertFalse(ga.get(0).getRepeatable()); <START> String xml = PublishedForm.generate(form); <END> SurveyDto dto = PublishedForm.parse(xml, true).toDto(); assertNotEquals(null, dto); assertEquals(17L, dto.getKeyId()); assertEquals("This is a form", dto.getName()); assertEquals("11.0", dto.getVersion()); assertEquals("This is a form", dto.getName()); }</code><technical_language>compare this XML string validate</technical_language>

Target:
void testSerialiseQuestionlessForm() throws IOException { Survey form1 = new Survey(); form1.setKey(KeyFactory.createKey("Survey", 17L)); form1.setName("This is a form"); form1.setVersion(11.0); QuestionGroup qg = new QuestionGroup(); qg.setKey(KeyFactory.createKey("Survey", 18L)); qg.setSurveyId(17L); qg.setName("This is a group"); qg.setOrder(1); TreeMap<Integer, QuestionGroup> gl = new TreeMap<>(); gl.put(1, qg); form1.setQuestionGroupMap(gl); XmlForm form = new XmlForm(form1, "Name of containing survey"); assertNotEquals(null, form); assertNotEquals(null, form.getQuestionGroup()); List<XmlQuestionGroup> ga = form.getQuestionGroup(); assertEquals(1, ga.size()); assertEquals("This is a group", ga.get(0).getHeading()); assertEquals(1, ga.get(0).getOrder()); assertFalse(ga.get(0).getRepeatable()); String xml = PublishedForm.generate(form); assertEquals(xml, expectedQuestionlessXml); SurveyDto dto = PublishedForm.parse(xml, true).toDto(); assertNotEquals(null, dto); assertEquals(17L, dto.getKeyId()); assertEquals("This is a form", dto.getName()); assertEquals("11.0", dto.getVersion()); assertEquals("This is a form", dto.getName()); }
Source:
<code>public synchronized Collection<ITmfTrace> getActiveTraceSet() { final ITmfTrace trace = fCurrentTrace; if (trace == null) { <START> return Collections.EMPTY_SET; <END> } return getTraceSet(trace); }</code><technical_language>This is a slight change in behaviour. I check if broke</technical_language>

Target:
public synchronized Collection<ITmfTrace> getActiveTraceSet() { final ITmfTrace trace = fCurrentTrace; return getTraceSet(trace); }
Source:
<code><START> public void reopenS3FileByReopener_on_retry_always_throw_exception() <END> throws Exception { { S3Object s3Object = mock(S3Object.class); doReturn(s3Object).when(client).getObject(any(GetObjectRequest.class)); doThrow(new AmazonClientException("This exception is thrown when retrying.")).when(s3Object).getObjectContent(); S3InputStreamReopener opener = new S3InputStreamReopener( client, new GetObjectRequest("my_bucket", "in/aa/a"), "value".length(), retryExecutor() .withInitialRetryWait(0) .withRetryLimit(2)); try (InputStream in = opener.reopen(0, new AmazonClientException("This exception can be ignored"))) { fail("Should throw exception."); } } }</code><technical_language>I assume this test intends verify retry attempts exceed max number, reopen() throw? If so, this method is kind of misleading throws alarm instead, please consider another name, is this exists test reopenS3FileByReopener_on_retry_gave_up_should_throw_original_exception</technical_language>

Target:
public void reopenS3FileByReopener_on_retry_always_throw_exception() throws Exception { doThrow(new AmazonClientException("This exception is thrown when retrying.")).when(client).getObject(any(GetObjectRequest.class)); S3InputStreamReopener opener = new S3InputStreamReopener( client, new GetObjectRequest("my_bucket", "in/aa/a"), "value".length(), retryExecutor() .withInitialRetryWait(0) .withRetryLimit(2)); try (InputStream in = opener.reopen(0, new AmazonClientException("This exception can be ignored"))) { fail("Should throw exception."); } }
Source:
<code>public void newTemplateCreation() { new TemplateEditPage().open("InfoboxBuilderNewTemplateCreation").getTemplateClassification() <START> .changeTemplateType(TemplateTypes.TEMPLATE_TYPE_INFOBOX).clickAddButton(); <END> Assertion.assertTrue(new InfoboxBuilderPage().isInfoboxBuilderPresent()); }</code><technical_language>format command a separate line if is fit in a single one</technical_language>

Target:
public void newTemplateCreation() { new TemplateEditPage().open("InfoboxBuilderNewTemplateCreation") .getTemplateClassification() .changeTemplateType(TemplateTypes.INFOBOX) .clickAddButton(); Assertion.assertTrue(new InfoboxBuilderPage().isInfoboxBuilderPresent()); }
Source:
<code><START> StoreFindToken() { <END> this(Type.Uninitialized, null, null, null, null); }</code><technical_language>Can/Will this constructor rid of Version_0 Version_1 phased out</technical_language>

Target:
StoreFindToken() { this(Type.Uninitialized, null, null, null, null, true); }
Source:
<code>private boolean insertObjectReference(ApiContext context, Reference<?> referee, AnnotatedElement referenceClass, String referenceClassName) { if (referenceClassName == null || referenceClassName.startsWith("java.")) { return false; } if (referenceClassName.startsWith("javax.")) { return false; } if (!context.isApplicationType(referenceClassName)) { return false; } if (referenceClass != null && referenceClass instanceof ExtensibleType) { ExtensibleType referenceClassType = (ExtensibleType) referenceClass; final AnnotationModel schemaAnnotation = AnnotationInfo.valueOf(referenceClassType) .getAnnotation(Schema.class); if (schemaAnnotation != null) { String schemaName = schemaAnnotation.getValue("name", String.class); if (schemaName == null || schemaName.isEmpty()) { schemaName = ModelUtils.getSimpleName(referenceClassName); } referee.setRef(schemaName); org.eclipse.microprofile.openapi.models.media.Schema schema = context.getApi().getComponents().getSchemas().get(schemaName); if (schema == null) { if (context.isAllowedType(referenceClassType)) { visitSchema(schemaAnnotation, referenceClass, context); } else if(referenceClassType instanceof ClassModel) { <START> apiWalker.processAnnotation((ClassModel)referenceClassType, this); <END> } } return true; } } return false; }</code><technical_language>if is else case - is error? log something</technical_language>

Target:
private boolean insertObjectReference(ApiContext context, Reference<?> referee, AnnotatedElement referenceClass, String referenceClassName) { if (referenceClassName == null || referenceClassName.startsWith("java.")) { return false; } if (referenceClassName.startsWith("javax.")) { return false; } if (!context.isApplicationType(referenceClassName)) { return false; } if (referenceClass != null && referenceClass instanceof ExtensibleType) { ExtensibleType referenceClassType = (ExtensibleType) referenceClass; final AnnotationModel schemaAnnotation = AnnotationInfo.valueOf(referenceClassType) .getAnnotation(Schema.class); if (schemaAnnotation != null) { String schemaName = schemaAnnotation.getValue("name", String.class); if (schemaName == null || schemaName.isEmpty()) { schemaName = ModelUtils.getSimpleName(referenceClassName); } referee.setRef(schemaName); org.eclipse.microprofile.openapi.models.media.Schema schema = context.getApi().getComponents().getSchemas().get(schemaName); if (schema == null) { if (context.isAllowedType(referenceClassType)) { visitSchema(schemaAnnotation, referenceClass, context); } else if(referenceClassType instanceof ClassModel) { apiWalker.processAnnotation((ClassModel)referenceClassType, this); } else { LOGGER.log(FINE, "Unrecognised schema {0} class found.", new Object[]{referenceClassName}); } } return true; } } return false; }
Source:
<code>private <START> List<String> getDirectoriesOfSelectedRepositoryNodes( <END> ISelection selection) { List<String> result = new ArrayList<>(); if (selection instanceof StructuredSelection) { Object[] elements = ((StructuredSelection) selection).toArray(); for (Object element : elements) { if (element instanceof RepositoryNode) { result.add(((RepositoryNode) element).getRepository() .getDirectory().toString()); } } } return result; }</code><technical_language>File</technical_language>

Target:
private List<File> getDirectoriesOfSelectedRepositoryNodes( ISelection selection) { List<File> result = new ArrayList<>(); if (selection instanceof StructuredSelection) { Object[] elements = ((StructuredSelection) selection).toArray(); for (Object element : elements) { if (element instanceof RepositoryNode) { result.add(((RepositoryNode) element).getRepository() .getDirectory()); } } } return result; }
Source:
<code>public OrcidOAuth2AP(String clientId, String clientSecret, String userEndpoint) { <START> String s = null; if(userEndpoint != null){ s = userEndpoint.startsWith("https://pub") ? "/authenticate" : "/read-limited"; } scope = Arrays.asList(s); <END> this.clientId = clientId; this.clientSecret = clientSecret; this.baseUserEndpoint = userEndpoint; }</code><technical_language>fine letting JVM optimize it</technical_language>

Target:
public OrcidOAuth2AP(String clientId, String clientSecret, String userEndpoint) { if(userEndpoint != null && userEndpoint.startsWith("https://pub")) { this.scope = Arrays.asList("/authenticate"); } else { this.scope = Arrays.asList("/read-limited"); } this.clientId = clientId; this.clientSecret = clientSecret; this.baseUserEndpoint = userEndpoint; }
Source:
<code>private void showJavaVersionOutdatedWarning(JavaVersion runtimeVersion, JavaVersion requiredVersion) { String message = String.format(JavaVersion.OUTDATED_JAVA_VERSION_MESSAGE, requiredVersion.toString(), runtimeVersion.toString()); DialogMessage.showInformationDialog("Update your Java version", <START> message); <END> }</code><technical_language>Is this line break necessary</technical_language>

Target:
private void showJavaVersionOutdatedWarning(JavaVersion runtimeVersion, JavaVersion requiredVersion) { String message = String.format(WARNING_MSG_OUTDATED_JAVA_VERSION, requiredVersion.toString(), runtimeVersion.toString()); DialogMessage.showInformationDialog("Update your Java version", message); }
Source:
<code>public Response doImport(Action action) { validateParameters(action, "storageDomain.id|name"); ImportRepoImageParameters importParameters = new ImportRepoImageParameters(); importParameters.setSourceRepoImageId(id); importParameters.setSourceStorageDomainId(getStorageDomainId()); importParameters.setStoragePoolId(getDataCenterId(getStorageDomainId(action))); importParameters.setStorageDomainId(getStorageDomainId(action)); if (action.isSetImportAsTemplate()) { if (action.isImportAsTemplate()) { validateParameters(action, "cluster.id|name"); importParameters.setClusterId(getClusterId(action)); if (action.isSetTemplate() && action.getTemplate().isSetName()) { importParameters.setTemplateName(action.getTemplate().getName()); } } importParameters.setImportAsTemplate(action.isImportAsTemplate()); } if (action.isSetDisk() && action.getDisk().isSetAlias()) { importParameters.setDiskAlias(action.getDisk().getAlias()); <START> } <END> return doAction(VdcActionType.ImportRepoImage, importParameters, action); }</code><technical_language>support "alias" "name"? If prefer "name" (that is do in DiskMapper)</technical_language>

Target:
public Response doImport(Action action) { validateParameters(action, "storageDomain.id|name"); ImportRepoImageParameters importParameters = new ImportRepoImageParameters(); importParameters.setSourceRepoImageId(id); importParameters.setSourceStorageDomainId(getStorageDomainId()); importParameters.setStoragePoolId(getDataCenterId(getStorageDomainId(action))); importParameters.setStorageDomainId(getStorageDomainId(action)); if (action.isSetImportAsTemplate()) { if (action.isImportAsTemplate()) { validateParameters(action, "cluster.id|name"); importParameters.setClusterId(getClusterId(action)); if (action.isSetTemplate() && action.getTemplate().isSetName()) { importParameters.setTemplateName(action.getTemplate().getName()); } } importParameters.setImportAsTemplate(action.isImportAsTemplate()); } if (action.isSetDisk()) { if (action.getDisk().isSetAlias()) { importParameters.setDiskAlias(action.getDisk().getAlias()); } if (action.getDisk().isSetName()) { importParameters.setDiskAlias(action.getDisk().getName()); } } return doAction(VdcActionType.ImportRepoImage, importParameters, action); }
Source:
<code>public static ImmutableMap<String, String> getNormalizedObjectNames(final ImmutableList<Path> pipedFiles) { final ImmutableMap.Builder<String, String> map = ImmutableMap.builder(); for (final Path file : pipedFiles) { map.put(normalizeObjectName(file.toString()), file.toString()); } return map.build(); <START> } <END></code><technical_language>Instead of a similar function below, ImmutableList<Path>, create ImmutableList<String>, call getNormalizedObjectNames(ImmutableList<String>) below</technical_language>

Target:
public static ImmutableMap<String, String> getNormalizedObjectNames(final ImmutableList<Path> pipedFiles) { final ImmutableList.Builder<String> fileNames = ImmutableList.builder(); for (final Path file : pipedFiles) { fileNames.add(file.toString()); } return normalizedObjectNames(fileNames.build()); }
Source:
<code>public static String decrypt(String data, String key) { <START> if (key == null || key.isEmpty() || data == null) { <END> return data; } try { byte[] keyBytes = Base64.decode(key, Base64.DEFAULT); byte[] dataBytes = Base64.decode(data, Base64.DEFAULT); byte[] decryptedData = decrypt(dataBytes, 0, dataBytes.length, keyBytes); return new String(decryptedData, 0, decryptedData.length, UTF8); } catch (Exception ex) { Log.w("Encryptor:decrypt", "error during decryption", ex); } return null; }</code><technical_language>TextUtils.isEmpty(key)? Why're this anyway</technical_language>

Target:
public static String decrypt(String data, String key) { if (TextUtils.isEmpty(key) || data == null) { return data; } try { byte[] keyBytes = Base64.decode(key, Base64.DEFAULT); byte[] dataBytes = Base64.decode(data, Base64.DEFAULT); byte[] decryptedData = decrypt(dataBytes, 0, dataBytes.length, keyBytes); return new String(decryptedData, 0, decryptedData.length, UTF8); } catch (Exception ex) { Log.w("Encryptor:decrypt", "error during decryption", ex); } return null; }
Source:
<code>public void convertModelToXML() throws Exception { BpmnModel bpmnModel = readXMLFile(); BpmnModel parsedModel = exportAndReadXMLFile(bpmnModel); validateModel(parsedModel); <START> deployProcess(parsedModel); <END> }</code><technical_language>This line removed. If check content method implementation, nothing</technical_language>

Target:
public void convertModelToXML() throws Exception { BpmnModel bpmnModel = readXMLFile(); BpmnModel parsedModel = exportAndReadXMLFile(bpmnModel); validateModel(parsedModel); }
Source:
<code>public boolean hasIV(){ if(ivSize != null){ return true; } <START> return false; <END> }</code><technical_language>Is a reason replace this method body return ivSize != null;</technical_language>

Target:
public boolean hasIV(){ return ivSize != null; }
Source:
<code>public void copyTo(TemplateOptions to) { super.copyTo(to); if (to instanceof EC2TemplateOptions) { EC2TemplateOptions eTo = EC2TemplateOptions.class.cast(to); if (getGroups().size() > 0) eTo.securityGroups(getGroups()); if (getKeyPair() != null) eTo.keyPair(getKeyPair()); if (getBlockDeviceMappings().size() > 0) eTo.blockDeviceMappings(getBlockDeviceMappings()); if (!shouldAutomaticallyCreateKeyPair()) eTo.noKeyPair(); if (getUserData() != null) eTo.userData(getUserData()); <START> if (getMaxCount() != 0) <END> eTo.maxCount(getMaxCount()); if (getClientToken() != null) eTo.clientToken(getClientToken()); } }</code><technical_language>Do need a > 0 check here</technical_language>

Target:
public void copyTo(TemplateOptions to) { super.copyTo(to); if (to instanceof EC2TemplateOptions) { EC2TemplateOptions eTo = EC2TemplateOptions.class.cast(to); if (getGroups().size() > 0) eTo.securityGroups(getGroups()); if (getKeyPair() != null) eTo.keyPair(getKeyPair()); if (getBlockDeviceMappings().size() > 0) eTo.blockDeviceMappings(getBlockDeviceMappings()); if (!shouldAutomaticallyCreateKeyPair()) eTo.noKeyPair(); if (getUserData() != null) eTo.userData(getUserData()); if (getMaxCount() > 0) eTo.maxCount(getMaxCount()); if (getClientToken() != null) eTo.clientToken(getClientToken()); } }
Source:
<code>public Type getType(int field) { <START> return type; <END> }</code><technical_language>I this in this code. change this throw new UnsupportedOperationException() here, remove setType</technical_language>

Target:
public Type getType(int field) { throw new UnsupportedOperationException(); }
Source:
<code><START> private static void validateRegion(String region) { <END> if (region != null && region.isEmpty()) { throw new IllegalArgumentException("region cannot be empty"); } }</code><technical_language>This method need static</technical_language>

Target:
private void validateRegion(String region) { if (region != null && region.isEmpty()) { throw new IllegalArgumentException("region cannot be empty"); } }
Source:
<code>private void initRevPool(boolean reverse) { if (queue != null) throw new IllegalStateException(); if (revPool != null) revPool.close(); if (reverse) revPool = new ReverseWalk(getRepository()); else revPool = new RevWalk(getRepository()); SEEN = revPool.newFlag("SEEN"); reader = revPool.getObjectReader(); <START> treeWalk = new TreeWalk(getRepository(), reader); <END> treeWalk.setRecursive(true); }</code><technical_language>is this change needed</technical_language>

Target:
private void initRevPool(boolean reverse) { if (queue != null) throw new IllegalStateException(); if (revPool != null) revPool.close(); if (reverse) revPool = new ReverseWalk(getRepository()); else revPool = new RevWalk(getRepository()); SEEN = revPool.newFlag("SEEN"); reader = revPool.getObjectReader(); treeWalk = new TreeWalk(reader); treeWalk.setRecursive(true); }
Source:
<code>public QueryResult<AnnotationSet> getAnnotationSet(String id, @Nullable String studyStr, String annotationSetName, String sessionId) throws CatalogException { <START> if (annotationSetName.isEmpty()) { <END> MyResourceId resource = commonGetAllAnnotationSets(id, studyStr, sessionId); return cohortDBAdaptor.getAnnotationSet(resource, null, StudyAclEntry.StudyPermissions.VIEW_COHORT_ANNOTATIONS.toString()); } else { MyResourceId resource = commonGetAnnotationSet(id, studyStr, annotationSetName, sessionId); return cohortDBAdaptor.getAnnotationSet(resource, annotationSetName, StudyAclEntry.StudyPermissions.VIEW_COHORT_ANNOTATIONS.toString()); } }</code><technical_language>In cases StringUtils.isEmpty() Apache commons lang3. way, check for empty strings nulls</technical_language>

Target:
public QueryResult<AnnotationSet> getAnnotationSet(String id, @Nullable String studyStr, String annotationSetName, String sessionId) throws CatalogException { if (StringUtils.isEmpty(annotationSetName)) { MyResourceId resource = commonGetAllAnnotationSets(id, studyStr, sessionId); return cohortDBAdaptor.getAnnotationSet(resource, null, StudyAclEntry.StudyPermissions.VIEW_COHORT_ANNOTATIONS.toString()); } else { MyResourceId resource = commonGetAnnotationSet(id, studyStr, annotationSetName, sessionId); return cohortDBAdaptor.getAnnotationSet(resource, annotationSetName, StudyAclEntry.StudyPermissions.VIEW_COHORT_ANNOTATIONS.toString()); } }
Source:
<code>public void onNext(final ActiveContext activeContext) { final String evaluatorId = activeContext.getEvaluatorId(); if (!idMap.containsKey(evaluatorId)) { LOG.warning("Failed to find a requestor for " + evaluatorId + ". Ignore " + activeContext.toString()); return; } final String requestorId = idMap.get(evaluatorId); if (requestorId.equals(DataLoader.class.getName())) { if (!groupCommDriver.isConfigured(activeContext)) { final Configuration finalContextConf = getContextConfiguration(); final Configuration finalServiceConf; if (dataLoadingService.isComputeContext(activeContext)) { LOG.log(Level.INFO, "Submitting GroupCommContext for ControllerTask to underlying context"); ctrlTaskContextId = getContextId(finalContextConf); finalServiceConf = getServiceConfiguration(); } else { LOG.log(Level.INFO, "Submitting GroupCommContext for ComputeTask to underlying context"); final Configuration dataParseConf = DataParseService.getServiceConfiguration(userJobInfo.getDataParser()); finalServiceConf = Configurations.merge(getServiceConfiguration(), dataParseConf); } activeContext.submitContextAndService(finalContextConf, finalServiceConf); } else { submitTask(activeContext, 0); } } else if (requestorId.equals(ElasticMemory.class.getName())) { emResouceCallbackManager.onCompleted(activeContext); <START> } <END> }</code><technical_language>Log warning consistent failedEvaluator</technical_language>

Target:
public void onNext(final ActiveContext activeContext) { final String evaluatorId = activeContext.getEvaluatorId(); final String requestorId = evalToRequestorMap.get(evaluatorId); if (requestorId == null) { LOG.warning("Failed to find a requestor for " + evaluatorId + ". Ignore " + activeContext); activeContext.close(); return; } if (requestorId.equals(DataLoader.class.getName())) { if (!groupCommDriver.isConfigured(activeContext)) { final Configuration finalContextConf = getContextConfiguration(); final Configuration finalServiceConf; if (dataLoadingService.isComputeContext(activeContext)) { LOG.log(Level.INFO, "Submitting GroupCommContext for ControllerTask to underlying context"); ctrlTaskContextId = getContextId(finalContextConf); finalServiceConf = getServiceConfiguration(); } else { LOG.log(Level.INFO, "Submitting GroupCommContext for ComputeTask to underlying context"); final Configuration dataParseConf = DataParseService.getServiceConfiguration(userJobInfo.getDataParser()); finalServiceConf = Configurations.merge(getServiceConfiguration(), dataParseConf); } activeContext.submitContextAndService(finalContextConf, finalServiceConf); } else { submitTask(activeContext, 0); } } else if (requestorId.equals(ElasticMemory.class.getName())) { emResourceRequestManager.onCompleted(activeContext); } else { LOG.warning("Unknown evaluator. Ignore " + activeContext); activeContext.close(); } }
Source:
<code>public void authenticate(final AuthenticationFlowContext context) { final HttpRequest httpRequest = context.getHttpRequest(); final HttpHeaders httpHeaders = httpRequest.getHttpHeaders(); final String[] usernameAndPassword = getUsernameAndPassword(httpHeaders); context.attempted(); if (usernameAndPassword != null) { final RealmModel realm = context.getRealm(); final String username = usernameAndPassword[0]; final UserModel user = context.getSession().users().getUserByUsername(username, realm); if (user != null) { final String password = usernameAndPassword[1]; final boolean valid = context.getSession().userCredentialManager().isValid(realm, user, UserCredentialModel.password(password)); if (valid) { if (user.isEnabled()) { context.getClientSession().setAuthenticatedUser(user); context.success(); } else { <START> userDisabledFailure(context, realm, user); <END> } } else { authFailure(context, realm, user); } } else { handleNullUser(context, realm, username); } } }</code><technical_language>Yes, I this in a separate PR. @pedroigor confirm this fail for disabled users is a proper fix</technical_language>

Target:
public void authenticate(final AuthenticationFlowContext context) { final HttpRequest httpRequest = context.getHttpRequest(); final HttpHeaders httpHeaders = httpRequest.getHttpHeaders(); final String[] usernameAndPassword = getUsernameAndPassword(httpHeaders); context.attempted(); if (usernameAndPassword != null) { final RealmModel realm = context.getRealm(); final String username = usernameAndPassword[0]; final UserModel user = context.getSession().users().getUserByUsername(username, realm); if (user != null) { final String password = usernameAndPassword[1]; final boolean valid = context.getSession().userCredentialManager().isValid(realm, user, UserCredentialModel.password(password)); if (valid) { if (user.isEnabled()) { userSuccessAction(context, user); } else { userDisabledAction(context, realm, user); } } else { notValidCredentialsAction(context, realm, user); } } else { nullUserAction(context, realm, username); } } }
Source:
<code>public Block readBlock(BlockEncodingSerde blockEncodingSerde, SliceInput sliceInput) { int positionCount = sliceInput.readInt(); byte[] values = new byte[positionCount]; if (!sliceInput.readBoolean()) { <START> sliceInput.readBytes(wrappedBuffer(values)); <END> return new ByteArrayBlock(0, positionCount, null, values); } boolean[] valueIsNull = new boolean[positionCount]; int nullPositions = decodeNullBits(sliceInput, valueIsNull); int nonNullPositions = positionCount - nullPositions; sliceInput.readBytes(wrappedBuffer(values), nonNullPositions * SIZE_OF_BYTE); int writePosition = values.length - 1; int readPosition = nonNullPositions - 1; while (readPosition >= 0) { values[writePosition] = values[readPosition]; readPosition -= valueIsNull[writePosition] ? 0 : 1; writePosition--; } return new ByteArrayBlock(0, positionCount, valueIsNull, values); }</code><technical_language>is need create a new Slice object wrappedBuffer. is public final void readBytes(byte[] destination) in SliceInput</technical_language>

Target:
public Block readBlock(BlockEncodingSerde blockEncodingSerde, SliceInput sliceInput) { int positionCount = sliceInput.readInt(); byte[] values = new byte[positionCount]; if (!sliceInput.readBoolean()) { sliceInput.readBytes(values); return new ByteArrayBlock(0, positionCount, null, values); } boolean[] valueIsNull = new boolean[positionCount]; int nullPositions = decodeNullBits(sliceInput, valueIsNull); int nonNullPositions = positionCount - nullPositions; sliceInput.readBytes(values, 0, nonNullPositions * SIZE_OF_BYTE); int writePosition = values.length - 1; int readPosition = nonNullPositions - 1; while (readPosition >= 0) { values[writePosition] = values[readPosition]; readPosition -= valueIsNull[writePosition] ? 0 : 1; writePosition--; } return new ByteArrayBlock(0, positionCount, valueIsNull, values); }
Source:
<code>public void testTextIn() { try { fixture.setDirectory(testResourcesDir); assertEquals("# Expected as first line of text.\n# Expected as 2nd line of text.", fixture.textIn(txtFilename)); fixture.textIn("foobar"); } catch (SlimFixtureException sfe) { assertEquals("message:<<Unable to find: " + testResourcesDir + "foobar>>", sfe.getMessage()); } catch (IOException ioe) { <START> assertFalse("Should not happen.", true); <END> } }</code><technical_language>fail() is nicer assertFalse true</technical_language>

Target:
public void testTextIn() { try { fixture.setDirectory(testResourcesDir); assertEquals("# Expected as first line of text.\n# Expected as 2nd line of text.", fixture.textIn(txtFilename)); fixture.textIn("foobar"); } catch (SlimFixtureException sfe) { assertEquals("message:<<Unable to find: " + testResourcesDir + "foobar>>", sfe.getMessage()); } catch (IOException ioe) { fail("Should not happen."); } }
Source:
<code>public Mono<Response<ShareProperties>> getPropertiesWithResponse() { try { <START> return withContext(context -> getPropertiesWithResponse(new ShareGetPropertiesOptions(), context)); <END> } catch (RuntimeException ex) { return monoError(logger, ex); } }</code><technical_language>I this call max public overload internal</technical_language>

Target:
public Mono<Response<ShareProperties>> getPropertiesWithResponse() { try { return getPropertiesWithResponse(new ShareGetPropertiesOptions()); } catch (RuntimeException ex) { return monoError(logger, ex); } }
Source:
<code>public static void main(String[] args) throws NumberFormatException, HyracksException, Exception { GenomixJobConf conf; try { conf = GenomixJobConf.fromArguments(args); <START> String pathToConf = conf.get(GenomixJobConf.CONF_INPUT); <END> if(pathToConf != ""){ for (String singleConf : pathToConf.split(",")) { LOG.info("Read job config from " + singleConf); conf.addResource(new Path(singleConf)); } } } catch (CmdLineException ex) { System.err.println("Usage: bin/genomix [options]\n"); ex.getParser().setUsageWidth(80); ex.getParser().printUsage(System.err); System.err.println("\nExample:"); System.err .println("\tbin/genomix -kmerLength 55 -pipelineOrder BUILD_HYRACKS,MERGE,TIP_REMOVE,MERGE,BUBBLE,MERGE -localInput /path/to/readfiledir/\n"); System.err.println(ex.getMessage()); return; } GenomixDriver driver = new GenomixDriver(); try { driver.runGenomix(conf); } catch (Exception e) { e.printStackTrace(); throw e; } finally { if (Boolean.parseBoolean(conf.get(GenomixJobConf.RUN_LOCAL))) { System.exit(0); } } }</code><technical_language>Do files' values override command line options then? do. careful written in xml file in case</technical_language>

Target:
public static void main(String[] args) throws NumberFormatException, HyracksException, Exception { GenomixJobConf conf; try { conf = GenomixJobConf.fromArguments(args); String pathToExtraConfFiles = conf.get(GenomixJobConf.EXTRA_CONF_FILES); if (pathToExtraConfFiles != "") { for (String extraConf : pathToExtraConfFiles.split(",")) { LOG.info("Read job config from " + extraConf); for (Map.Entry<String, String> entry : new JobConf(extraConf)) { conf.setIfUnset(entry.getKey(), entry.getValue()); } } } } catch (CmdLineException ex) { System.err.println("Usage: bin/genomix [options]\n"); ex.getParser().setUsageWidth(80); ex.getParser().printUsage(System.err); System.err.println("\nExample:"); System.err .println("\tbin/genomix -kmerLength 55 -pipelineOrder BUILD_HYRACKS,MERGE,TIP_REMOVE,MERGE,BUBBLE,MERGE -localInput /path/to/readfiledir/\n"); System.err.println(ex.getMessage()); return; } GenomixDriver driver = new GenomixDriver(); try { driver.runGenomix(conf); } catch (Exception e) { e.printStackTrace(); throw e; } finally { if (Boolean.parseBoolean(conf.get(GenomixJobConf.RUN_LOCAL))) { System.exit(0); } } }
Source:
<code><START> public PartialList<Comment> getComments(CoreSession s, String documentId, Long pageSize, Long currentPageIndex, <END> boolean sortAscending) { DocumentModel documentModel = s.getDocument(new IdRef(documentId)); return CoreInstance.doPrivileged(s, session -> { PageProvider<DocumentModel> pageProvider = getCommentsPageProvide(session, documentModel, pageSize, currentPageIndex, sortAscending); List<DocumentModel> commentList = pageProvider.getCurrentPage(); return commentList.stream() .map(Comments::newComment) .collect(collectingAndThen(toList(), list -> new PartialList<>(list, pageProvider.getResultsCount()))); }); }</code><technical_language>Remove empty line</technical_language>

Target:
public PartialList<Comment> getComments(CoreSession s, String documentId, Long pageSize, Long currentPageIndex, boolean sortAscending) { IdRef docRef = new IdRef(documentId); boolean exists = CoreInstance.doPrivileged(s, session -> { return session.exists(docRef); }); if (!exists) { return new PartialList<>(Collections.emptyList(), 0); } checkReadCommentPermissions(s, new IdRef(documentId)); DocumentModel documentModel = s.getDocument(docRef); return CoreInstance.doPrivileged(s, session -> { PageProvider<DocumentModel> pageProvider = getCommentsPageProvider(session, documentModel, pageSize, currentPageIndex, sortAscending); List<DocumentModel> commentList = pageProvider.getCurrentPage(); return commentList.stream() .map(Comments::newComment) .collect(collectingAndThen(toList(), list -> new PartialList<>(list, pageProvider.getResultsCount()))); }); }
Source:
<code>public void setDigestAlgorithm(String digestMethod) { if (Arrays.stream(VALID_DIGEST_ALGORITHMS.split("\\s*,\\s*")).noneMatch(digestMethod.toUpperCase()::equals)) { <START> throw new SlimFixtureException(false, "Invalid digest method: " + digestMethod.toUpperCase() + ". Valid options: " + Arrays.toString(VALID_DIGEST_ALGORITHMS.split("\\s*,\\s*"))); <END> } signatureDigestAlgorithm = getStringValueFromField(DigestMethod.class, digestMethod.toUpperCase()); }</code><technical_language>suggestion throw new SlimFixtureException(false, "Invalid digest method: " + digestMethod.toUpperCase() + ". Valid options: " + VALID_DIGEST_ALGORITHMS);</technical_language>

Target:
public void setDigestAlgorithm(String digestMethod) { if (Arrays.stream(VALID_DIGEST_ALGORITHMS.split("\\s*,\\s*")).noneMatch(digestMethod.toUpperCase()::equals)) { throw new SlimFixtureException(false, "Invalid digest method: " + digestMethod.toUpperCase() + ". Valid options: " + VALID_DIGEST_ALGORITHMS); } signatureDigestAlgorithm = getStringValueFromField(DigestMethod.class, digestMethod.toUpperCase()); }
Source:
<code>public String toString() { <START> return String.format("short@0x%x=0x%x (%d)", Pointer.nativeValue(getPointer()), getValue(), getValue()); <END> }</code><technical_language>ByteByReference.java</technical_language>

Target:
public String toString() { return String.format("short@0x%1$x=0x%2$x (%2$d)", Pointer.nativeValue(getPointer()), getValue()); }
Source:
<code>public int readFromFile(JDBCSequentialFile file, ByteBuffer bytes) throws SQLException { Object largeObject = null; long oid = getOID(file); try (Connection connection = connectionProvider.getConnection()) { try { connection.setAutoCommit(false); <START> largeObject = largeObjectManager.open(connection, oid, PostgresLargeObjectManager.READ); <END> int readLength = (int) calculateReadLength(largeObjectManager.size(largeObject), bytes.remaining(), file.position()); if (readLength > 0) { if (file.position() > 0) { largeObjectManager.seek(largeObject, (int) file.position()); } byte[] data = largeObjectManager.read(largeObject, readLength); bytes.put(data); } largeObjectManager.close(largeObject); connection.commit(); return readLength; } catch (SQLException e) { connection.rollback(); throw e; } } }</code><technical_language>declare largeObject instead of 4 lines (even if done before)</technical_language>

Target:
public int readFromFile(JDBCSequentialFile file, ByteBuffer bytes) throws SQLException { long oid = getOID(file); try (Connection connection = connectionProvider.getConnection()) { try { connection.setAutoCommit(false); Object largeObject = largeObjectManager.open(connection, oid, PostgresLargeObjectManager.READ); int readLength = (int) calculateReadLength(largeObjectManager.size(largeObject), bytes.remaining(), file.position()); if (readLength > 0) { if (file.position() > 0) { largeObjectManager.seek(largeObject, (int) file.position()); } byte[] data = largeObjectManager.read(largeObject, readLength); bytes.put(data); } largeObjectManager.close(largeObject); connection.commit(); return readLength; } catch (SQLException e) { connection.rollback(); throw e; } } }
Source:
<code>public RemoteBitrateEstimatorAbsSendTime(RemoteBitrateObserver observer, AbsSendTimeEngine absSendTimeEngine) { super(RTPPacketPredicate.INSTANCE); this.absoluteSendTimeEngine = absSendTimeEngine; this.observer_ = observer; this.interArrival = new InterArrival(90 * kTimestampGroupLengthMs, kTimestampToMs, true); this.estimator = new OveruseEstimator(new OverUseDetectorOptions()); this.detector = new OveruseDetector(new OverUseDetectorOptions()); this.incomingBitrate = new RateStatistics(kBitrateWindowMs, 8000F); this.incomingBitrateInitialized = false; this.totalProbesReceived = 0; this.firstPacketTimeMs = -1; this.lastUpdateMs = -1; <START> logger.info("; RemoteBitrateEstimatorAbsSendTime: Calling."); <END> }</code><technical_language>change debug level please (with if(logger.isDebugEnabled()) check)</technical_language>

Target:
public RemoteBitrateEstimatorAbsSendTime(RemoteBitrateObserver observer, AbsSendTimeEngine absSendTimeEngine) { super(RTPPacketPredicate.INSTANCE); this.absoluteSendTimeEngine = absSendTimeEngine; this.observer_ = observer; this.interArrival = new InterArrival(90 * kTimestampGroupLengthMs, kTimestampToMs, true); this.estimator = new OveruseEstimator(new OverUseDetectorOptions()); this.detector = new OveruseDetector(new OverUseDetectorOptions()); this.incomingBitrate = new RateStatistics(kBitrateWindowMs, 8000F); this.incomingBitrateInitialized = false; this.totalProbesReceived = 0; this.firstPacketTimeMs = -1; this.lastUpdateMs = -1; if (logger.isDebugEnabled()) { logger.debug("RemoteBitrateEstimatorAbsSendTime: Active."); } }
Source:
<code>public void enterWrongBlurryWord() { String word = getTimeStamp(); blurryWordField.sendKeys(word); <START> } <END></code><technical_language>add PageObjectLogging log method (without screenshot)</technical_language>

Target:
public void enterWrongBlurryWord(){ String word = getTimeStamp(); blurryWordField.sendKeys(word); PageObjectLogging.log("enterWrongBlurryWord ", "Blurry word field populated incorrectly", true); }
Source:
<code>public ObjectMapperContextResolver() { mapper = new ObjectMapper(); SimpleModule module = new SimpleModule(); module.addDeserializer(Instant.class, new InstantDeserializer()); <START> module.addSerializer(new InstantSerializer()); <END> mapper.registerModule(module); mapper.configure(SerializationFeature.WRITE_DATES_AS_TIMESTAMPS, false); }</code><technical_language>reason standard Jackson implementation for java time? <LINK_0></technical_language>

Target:
public ObjectMapperContextResolver() { mapper = new ObjectMapper(); mapper.registerModule(new JavaTimeModule()); mapper.configure(SerializationFeature.WRITE_DATES_AS_TIMESTAMPS, false); }
Source:
<code>private String getCheckYear(PaymentGroup paymentGroup) { String checkYear = KFSConstants.getDashSubAccountNumber(); try { CheckReconciliation checkReconciliation = checkReconciliationDao.findByCheckNumber(paymentGroup.getDisbursementNbr().toString()); Calendar calendar = Calendar.getInstance(); <START> if (ObjectUtils.isNotNull(checkReconciliation) && ObjectUtils.isNotNull(checkReconciliation.getCheckDate())) { <END> calendar.setTime(checkReconciliation.getCheckDate()); checkYear = Integer.toString(calendar.get(Calendar.YEAR)); } } catch(Exception ex) { LOG.error("getCheckYear", ex); } return StringUtils.isBlank(checkYear) ? KFSConstants.getDashSubAccountNumber() : checkYear; }</code><technical_language>part of this if statement StringUtils.isNotEmpty? else note error condition</technical_language>

Target:
private String getCheckYear(PaymentGroup paymentGroup) { String checkYear = KFSConstants.getDashSubAccountNumber(); try { CheckReconciliation checkReconciliation = checkReconciliationDao.findByCheckNumber(paymentGroup.getDisbursementNbr().toString()); Calendar calendar = Calendar.getInstance(); if (ObjectUtils.isNotNull(checkReconciliation) && ObjectUtils.isNotNull(checkReconciliation.getCheckDate())) { calendar.setTime(checkReconciliation.getCheckDate()); checkYear = Integer.toString(calendar.get(Calendar.YEAR)); } else { LOG.error("getCheckYear", "Failed getting year check was issued, defaulting clearing subaccount to dashes."); } } catch(Exception ex) { LOG.error("getCheckYear", ex); } return checkYear; }
Source:
<code>public Set<Object> merge(Set<?>... items) { if (ArrayUtils.isEmpty(items)) { <START> return new HashSet<Object>(); <END> } Set<Object> result = new HashSet<Object>(); for (Set<?> item : items) { if (item != null) { result.addAll(item); } } return result; }</code><technical_language>pls. Collections.emptySet()</technical_language>

Target:
public Set<Object> merge(Set<?>... items) { if (ArrayUtils.isEmpty(items)) { return Collections.emptySet(); } Set<Object> result = new HashSet<Object>(); for (Set<?> item : items) { if (item != null) { result.addAll(item); } } return result; }