auphong2707/dl4se-code-review-dataset huggingface dataset:
Source:
<code>private void setScriptDir(Path path) { scriptDirField.setText(path.toString()); <START> automationConfiguration.setScriptLocation(path); <END> }</code><technical_language>need do this anymore. set field's value</technical_language>

Target:
private void setScriptDir(Path path) { scriptDirField.setText(path.toString()); }
Source:
<code>protected Endpoint createEndpoint(String uri, String remaining, Map<String, Object> parameters) throws Exception { WorkdayConfiguration workdayConfiguration = new WorkdayConfiguration(); <START> setProperties(workdayConfiguration, parameters); <END> this.httpClient = createHttpClient(workdayConfiguration); this.workdayConfiguration = workdayConfiguration; Endpoint endpoint = new WorkdayEndpoint(uri, this); setProperties(endpoint, parameters); return endpoint; }</code><technical_language>This done, need setProperties endpoint, sufficient, a other components</technical_language>

Target:
protected Endpoint createEndpoint(String uri, String remaining, Map<String, Object> parameters) throws Exception { WorkdayEndpoint endpoint = new WorkdayEndpoint(uri, this); setProperties(endpoint, parameters); return endpoint; }
Source:
<code>private static void verifyJvmHeapSize(MemorySize jvmHeapSize) { <START> if (jvmHeapSize.compareTo(JobManagerOptions.MIN_JVM_HEAP_SIZE) < 0) { <END> LOG.warn( "The configured or derived JVM heap memory size ({}) is less than its recommended minimum value ({})", jvmHeapSize.toHumanReadableString(), JobManagerOptions.MIN_JVM_HEAP_SIZE); } }</code><technical_language>is this changed? I zero is ok, meaning jvmHeapSize MIN_JVM_HEAP_SIZE</technical_language>

Target:
private static void verifyJvmHeapSize(MemorySize jvmHeapSize) { if (jvmHeapSize.compareTo(JobManagerOptions.MIN_JVM_HEAP_SIZE) < 0) { LOG.warn( "The configured or derived JVM heap memory size ({}) is less than its recommended minimum value ({})", jvmHeapSize.toHumanReadableString(), JobManagerOptions.MIN_JVM_HEAP_SIZE.toHumanReadableString()); } }
Source:
<code>public void prepareRun(StageSubmitterContext context) throws Exception { FailureCollector failureCollector = context.getFailureCollector(); config.validate(context.getInputSchema(), failureCollector); failureCollector.getOrThrowException(); context.record( <START> TransformLineageRecorderUtils.oneToOneIn(new ArrayList<>(fieldSet), <END> "hash", "Use the digest algorithm to hash the fields.")); }</code><technical_language>This is similar Decryptor</technical_language>

Target:
public void prepareRun(StageSubmitterContext context) throws Exception { FailureCollector failureCollector = context.getFailureCollector(); config.validate(context.getInputSchema(), failureCollector); failureCollector.getOrThrowException(); if (context.getInputSchema() == null || context.getInputSchema().getFields() == null) { return; } List<String> hashedFields = context.getInputSchema().getFields().stream() .filter(field -> config.getFields() .contains(field.getName()) && field.getSchema().getType() == Schema.Type.STRING) .map(Schema.Field::getName).collect(Collectors.toList()); List<String> identityFields = TransformLineageRecorderUtils.getFields(context.getInputSchema()); identityFields.removeAll(hashedFields); List<FieldOperation> output = new ArrayList<>(); output.addAll(TransformLineageRecorderUtils.generateOneToOnes(hashedFields, "hash", "Used the digest algorithm to hash the fields.")); output.addAll(TransformLineageRecorderUtils.generateOneToOnes(identityFields, "identity", TransformLineageRecorderUtils.IDENTITY_TRANSFORM_DESCRIPTION)); context.record(output); }
Source:
<code>public void wildcard_type_tree_have_a_widlcard_type() { CompilationUnitTree cut = treeOf("abstract class A<T> { abstract A<? extends Runnable> foo(); }"); TypeTree returnType = ((MethodTree) ((ClassTree) cut.types().get(0)).members().get(0)).returnType(); <START> assertThat(returnType.is(Tree.Kind.PARAMETERIZED_TYPE)).isTrue(); <END> Tree typeArg = ((ParameterizedTypeTree) returnType).typeArguments().get(0); assertThat(typeArg.is(Tree.Kind.EXTENDS_WILDCARD)).isTrue(); JavaType javaType = (JavaType) ((WildcardTree) typeArg).symbolType(); assertThat(javaType).isInstanceOf(WildCardType.class); WildCardType wildCardType = (WildCardType) javaType; assertThat(wildCardType.isSubtypeOf("java.lang.Runnable")).isTrue(); assertThat(wildCardType.bound.is("java.lang.Runnable")).isTrue(); }</code><technical_language>assert type of bound</technical_language>

Target:
public void wildcard_type_tree_have_a_widlcard_type() { CompilationUnitTree cut = treeOf("abstract class A<T> { abstract A<? extends Runnable> foo(); }"); TypeTree returnType = ((MethodTree) ((ClassTree) cut.types().get(0)).members().get(0)).returnType(); assertThat(returnType.is(Tree.Kind.PARAMETERIZED_TYPE)).isTrue(); Tree typeArg = ((ParameterizedTypeTree) returnType).typeArguments().get(0); assertThat(typeArg.is(Tree.Kind.EXTENDS_WILDCARD)).isTrue(); JavaType javaType = (JavaType) ((WildcardTree) typeArg).symbolType(); assertThat(javaType).isInstanceOf(WildCardType.class); WildCardType wildCardType = (WildCardType) javaType; assertThat(wildCardType.isSubtypeOf("java.lang.Runnable")).isTrue(); assertThat(wildCardType.bound.is("java.lang.Runnable")).isTrue(); assertThat(wildCardType.boundType).isEqualTo(WildCardType.BoundType.EXTENDS); }
Source:
<code>public void onEventMainThread(NotificationEvents.NotificationsRefreshError error) { setProgressVisible(false); <START> ToastUtils.showToast(this, getString(R.string.error_refresh_notification)); <END> }</code><technical_language>close activity if error occurs retrieving notes, current note is null</technical_language>

Target:
public void onEventMainThread(NotificationEvents.NotificationsRefreshError error) { setProgressVisible(false); if (mNoteId == null) { showErrorToastAndFinish(); return; } Note note = NotificationsTable.getNoteById(mNoteId); if (note == null) { showErrorToastAndFinish(); return; } }
Source:
<code>public void testCreate() throws StripeException { Map<String, Object> params = new HashMap<String, Object>(); params.put("quantity", 10); params.put("subscription_item", SUBCRIPTION_ITEM_ID); params.put("timestamp", System.currentTimeMillis() / 1000L); UsageRecord resource = UsageRecord.create(params, null); <START> params.remove("subscription_item"); <END> assertNotNull(resource); verifyRequest( APIResource.RequestMethod.POST, String.format("/v1/subscription_items/%s/usage_records", SUBCRIPTION_ITEM_ID), params ); }</code><technical_language>flagging fix this in next major version move a parameter for id</technical_language>

Target:
public void testCreate() throws StripeException { final Map<String, Object> params = new HashMap<String, Object>(); params.put("quantity", 10); params.put("subscription_item", SUBCRIPTION_ITEM_ID); params.put("timestamp", System.currentTimeMillis() / 1000L); final UsageRecord resource = UsageRecord.create(params, null); params.remove("subscription_item"); assertNotNull(resource); verifyRequest( APIResource.RequestMethod.POST, String.format("/v1/subscription_items/%s/usage_records", SUBCRIPTION_ITEM_ID), params ); }
Source:
<code>default UUID leader() { Optional<UUID> leader = timestampMapping() .values() .stream() .findAny() .map(LockWatchVersion::id); <START> Preconditions.checkState(leader.isPresent(), <END> "Cannot compute timestamp mapping for empty map of timestamps"); Preconditions.checkState( timestampMapping().values().stream().allMatch(version -> version.id().equals(leader.get())), "All versions must be on the same leader"); return leader.get(); }</code><technical_language>empty check twice, a @Value.Check</technical_language>

Target:
default UUID leader() { return timestampMapping() .values() .stream() .map(LockWatchVersion::id) .distinct() .collect(MoreCollectors.onlyElement()); }
Source:
<code>public int incomingCount() { int count; if ( read.hasTxStateWithChanges() && read.txState().nodeIsAddedInThisTx( getOwningNode() ) ) { count = 0; } else if ( isBuffered() ) { count = bufferedGroup.incomingCount; } else { count = count( incomingRawId() ); } return read.hasTxStateWithChanges() ? read.txState().getNodeState( getOwningNode() ) <START> .augmentDegree( Direction.INCOMING, count, getType() ) : count; <END> }</code><technical_language>for outgoing, I this augment include loops</technical_language>

Target:
public int incomingCount() { int count; if ( isBuffered() ) { count = bufferedGroup.incomingCount; } else { count = count( incomingRawId() ); } return read.hasTxStateWithChanges() ? read.txState().getNodeState( getOwningNode() ) .augmentDegree( RelationshipDirection.INCOMING, count, getType() ) : count; }
Source:
<code>public StagingCommitter(Path outputPath, TaskAttemptContext context) throws IOException { super(outputPath, context); this.constructorOutputPath = checkNotNull(getOutputPath(), "output path"); Configuration conf = getConf(); this.uploadPartSize = conf.getLongBytes( MULTIPART_SIZE, DEFAULT_MULTIPART_SIZE); this.uuid = getUploadUUID(conf, context.getJobID()); this.uniqueFilenames = conf.getBoolean( FS_S3A_COMMITTER_STAGING_UNIQUE_FILENAMES, DEFAULT_STAGING_COMMITTER_UNIQUE_FILENAMES); setWorkPath(buildWorkPath(context, uuid)); this.wrappedCommitter = createWrappedCommitter(context, conf); ConflictResolution mode = getConflictResolutionMode(getJobContext()); LOG.debug("Conflict resolution mode: {}", mode); <START> this.finalOutputPath = constructorOutputPath; <END> Preconditions.checkNotNull(finalOutputPath, "Output path cannot be null"); S3AFileSystem fs = getS3AFileSystem(finalOutputPath, context.getConfiguration(), false); s3KeyPrefix = fs.pathToKey(finalOutputPath); LOG.debug("{}: final output path is {}", getRole(), finalOutputPath); setOutputPath(finalOutputPath); }</code><technical_language>able change output directory in a subclass this committer base for batch committers. a big deal for us, continue for a while. But, nice able change output location based table metadata. directory committer, for example, create a new directory for data instead of deleting current path, switch table location new directory. done is a hook this output path</technical_language>

Target:
public StagingCommitter(Path outputPath, TaskAttemptContext context) throws IOException { super(outputPath, context); this.constructorOutputPath = checkNotNull(getOutputPath(), "output path"); Configuration conf = getConf(); this.uploadPartSize = conf.getLongBytes( MULTIPART_SIZE, DEFAULT_MULTIPART_SIZE); this.uuid = getUploadUUID(conf, context.getJobID()); this.uniqueFilenames = conf.getBoolean( FS_S3A_COMMITTER_STAGING_UNIQUE_FILENAMES, DEFAULT_STAGING_COMMITTER_UNIQUE_FILENAMES); setWorkPath(buildWorkPath(context, uuid)); this.wrappedCommitter = createWrappedCommitter(context, conf); setOutputPath(constructorOutputPath); Path finalOutputPath = getOutputPath(); Preconditions.checkNotNull(finalOutputPath, "Output path cannot be null"); S3AFileSystem fs = getS3AFileSystem(finalOutputPath, context.getConfiguration(), false); s3KeyPrefix = fs.pathToKey(finalOutputPath); LOG.debug("{}: final output path is {}", getRole(), finalOutputPath); ConflictResolution mode = getConflictResolutionMode(getJobContext(), fs.getConf()); LOG.debug("Conflict resolution mode: {}", mode); }
Source:
<code>public DelimitedParser(final Optional<String> delimiter, Optional<String> listDelimiter) { this.delimiter = delimiter.isPresent() ? delimiter.get() : DEFAULT_DELIMITER; this.listDelimiter = listDelimiter.isPresent() ? listDelimiter.get() : DEFAULT_LIST_DELIMITER; this.splitter = Splitter.on(this.delimiter); this.listSplitter = Splitter.on(this.listDelimiter); this.valueFunction = new Function<String, Object>() { @Override public Object apply(String input) { <START> if (input.contains(DelimitedParser.this.listDelimiter)) { <END> return Lists.newArrayList( Iterables.transform( listSplitter.split(input), ParserUtils.nullEmptyStringFunction ) ); } else { return ParserUtils.nullEmptyStringFunction.apply(input); } } }; }</code><technical_language>check</technical_language>

Target:
public DelimitedParser(final Optional<String> delimiter, Optional<String> listDelimiter) { this.delimiter = delimiter.isPresent() ? delimiter.get() : DEFAULT_DELIMITER; this.listDelimiter = listDelimiter.isPresent() ? listDelimiter.get() : Parsers.DEFAULT_LIST_DELIMITER; Preconditions.checkState( !this.delimiter.equals(this.listDelimiter), "Cannot have same delimiter and list delimiter of [%s]", this.delimiter ); this.splitter = Splitter.on(this.delimiter); this.listSplitter = Splitter.on(this.listDelimiter); this.valueFunction = new Function<String, Object>() { @Override public Object apply(String input) { if (input.contains(DelimitedParser.this.listDelimiter)) { return Lists.newArrayList( Iterables.transform( listSplitter.split(input), ParserUtils.nullEmptyStringFunction ) ); } else { return ParserUtils.nullEmptyStringFunction.apply(input); } } }; }
Source:
<code>private void _sendRefocusNotification(NotificationContext context, boolean isTriggerActive) { List<String> aspectPaths = context.getNotification().getSubscriptions(); <START> String token = context.getNotification().getCustomText(); <END> requireArgument(StringUtils.isNoneBlank(token), "Token(custom text) cannot be blank."); requireArgument(aspectPaths!=null && !aspectPaths.isEmpty(), "aspect paths (subscriptions) cannot be empty."); for (String aspect : aspectPaths) { sendMessage(aspect, token, isTriggerActive); } }</code><technical_language>this is a good idea, discussed</technical_language>

Target:
private void _sendRefocusNotification(NotificationContext context, boolean isTriggerActive) { List<String> aspectPaths = context.getNotification().getSubscriptions(); requireArgument(aspectPaths!=null && !aspectPaths.isEmpty(), "aspect paths (subscriptions) cannot be empty."); for (String aspect : aspectPaths) { sendMessage(aspect, isTriggerActive); } }
Source:
<code>private String startUserDialog() throws IOException { <START> log.debug("starting user dialog."); <END> BufferedReader br = new BufferedReader(new InputStreamReader(System.in)); System.out.println("Please enter user:"); return br.readLine(); }</code><technical_language>consider this in a loop, user entered input null</technical_language>

Target:
private String startUserDialog() throws IOException { log.debug("starting user dialog."); String user; while (true) { System.out.println("Please enter user:"); user = System.console().readLine(); if (StringUtils.isNotEmpty(user)) { break; } } return user; }
Source:
<code>public String createAndRegisterNewRequestToken() { <START> String newToken = prefix + sequence.getAndIncrement(); <END> this.token.set(newToken); return newToken; }</code><technical_language>sequence.getAndIncrement() rendered in hex</technical_language>

Target:
public String createAndRegisterNewRequestToken() { String newToken = prefix + format("%010x", sequence.getAndIncrement()); this.token.set(newToken); return newToken; }
Source:
<code>public void onBecomeInactiveFromStandby(Message message, NotificationContext context) { <START> String partitionName = message.getPartitionName(); <END> logger.info("Partition in resource is becoming INACTIVE from STANDBY", message.getPartitionName(), partitionName); if (clusterMapConfig.clustermapEnableStateModelListener) { partitionStateChangeListener.onPartitionBecomeInactiveFromStandby(partitionName); } }</code><technical_language>for logger.info, partitionName is message.getPartitionName</technical_language>

Target:
public void onBecomeInactiveFromStandby(Message message, NotificationContext context) { String partitionName = message.getPartitionName(); logger.info("Partition in resource is becoming INACTIVE from STANDBY", partitionName, message.getResourceName()); if (clusterMapConfig.clustermapEnableStateModelListener) { partitionStateChangeListener.onPartitionBecomeInactiveFromStandby(partitionName); } }
Source:
<code>public HookResult doRefUpdateHook(final Project project, final String refname, final Account uploader, final ObjectId oldId, final ObjectId newId) { final List<String> args = new ArrayList<String>(); addArg(args, "--project", project.getName()); addArg(args, "--refname", refname); addArg(args, "--uploader", getDisplayName(uploader)); addArg(args, "--oldrev", oldId.getName()); addArg(args, "--newrev", newId.getName()); <START> HookResult hookResult = null; <END> try { hookResult = runSyncHook(project.getNameKey(), refUpdateHook, args); } catch (TimeoutException e) { hookResult = new HookResult(-1, "Synchronous hook timed out"); } return hookResult; }</code><technical_language>need set null</technical_language>

Target:
public HookResult doRefUpdateHook(final Project project, final String refname, final Account uploader, final ObjectId oldId, final ObjectId newId) { final List<String> args = new ArrayList<String>(); addArg(args, "--project", project.getName()); addArg(args, "--refname", refname); addArg(args, "--uploader", getDisplayName(uploader)); addArg(args, "--oldrev", oldId.getName()); addArg(args, "--newrev", newId.getName()); HookResult hookResult; try { hookResult = runSyncHook(project.getNameKey(), refUpdateHook, args); } catch (TimeoutException e) { hookResult = new HookResult(-1, "Synchronous hook timed out"); } return hookResult; }
Source:
<code>public FlinkPod decorateFlinkPod(FlinkPod flinkPod) { <START> final Container basicMainContainer = decorateMainContainer(flinkPod.getMainContainer()); <END> return new FlinkPod.Builder(flinkPod) .withPod(flinkPod.getPod()) .withMainContainer(basicMainContainer) .build(); }</code><technical_language>suggestion final Container decoratedContainer = new ContainerBuilder(flinkPod.getMainContainer()) .addAllToEnv(getSecretEnvs()) .build();</technical_language>

Target:
public FlinkPod decorateFlinkPod(FlinkPod flinkPod) { final Container basicMainContainer = new ContainerBuilder(flinkPod.getMainContainer()) .addAllToEnv(getSecretEnvs()) .build(); return new FlinkPod.Builder(flinkPod) .withMainContainer(basicMainContainer) .build(); }
Source:
<code><START> public void notifyCameraDeviceClose() { <END> synchronized (mExecutingCaptureConfigCallbacks) { for (CaptureConfigCaptureCallback callback : mExecutingCaptureConfigCallbacks) { callback.onRequestCancelled(); } mExecutingCaptureConfigCallbacks.clear(); } notifySurfaceDetached(); }</code><technical_language>this call StateCallback.onClosed() method? onClosed() method aslo request canceling</technical_language>

Target:
public void notifyCameraDeviceClose() { notifySurfaceDetached(); }
Source:
<code>public int hashCode() { int result = typeVariable.hashCode(); <START> result = 31 * result + (declaredOnType() ? 1 : 0); <END> return result; }</code><technical_language>container</technical_language>

Target:
public int hashCode() { int result = typeVariable.hashCode(); result = 31 * result + container.hashCode(); return result; }
Source:
<code>public ResourcePack fromUriUnchecked(URI uri) { <START> return new SpongeURIResourcePack(Preconditions.checkNotNull(uri, "uri"), Optional.<String>absent()); <END> }</code><technical_language>I weird, conventions for Sponge projects Preconditions calls statically imported</technical_language>

Target:
public ResourcePack fromUriUnchecked(URI uri) { return SpongeResourcePack.create(checkNotNull(uri, "uri"), null); }
Source:
<code>private String getSurveyForPhone(String devicePhoneNumber, String imei) { DeviceSurveyJobQueueDAO dsjqDAO = new DeviceSurveyJobQueueDAO(); SurveyDAO surveyDao = new SurveyDAO(); SurveyGroupDAO sgDao = new SurveyGroupDAO(); StringBuilder sb = new StringBuilder(); String sgName; String surveyName; Double ver; Boolean isInMonitoringGroup; String newLocaleSurveyId; for (DeviceSurveyJobQueue dsjq : dsjqDAO.get(devicePhoneNumber, imei)) { Survey s = surveyDao.getById(dsjq.getSurveyID()); <START> SurveyGroup sg = s != null ? sgDao.getByKey(s.getSurveyGroupId()) : null; <END> if (s != null && sg != null) { ver = s.getVersion(); surveyName = s.getName(); sgName = sg.getCode() != null ? sg.getCode() : "unknown"; isInMonitoringGroup = Boolean.valueOf(sg.getMonitoringGroup() != null ? sg .getMonitoringGroup() : false); newLocaleSurveyId = sg.getNewLocaleSurveyId() != null ? sg.getNewLocaleSurveyId() .toString() : "null"; if (ver == null) { ver = new Double(1.0); } sb.append(devicePhoneNumber + "," + dsjq.getSurveyID() + "," + surveyName + "," + dsjq.getLanguage() + "," + ver + "," + s.getSurveyGroupId() + "," + sgName + "," + isInMonitoringGroup + "," + newLocaleSurveyId + "\n"); } } return sb.toString(); }</code><technical_language>I highly safer check for a null surveyGroupId</technical_language>

Target:
private String getSurveyForPhone(String devicePhoneNumber, String imei) { DeviceSurveyJobQueueDAO dsjqDAO = new DeviceSurveyJobQueueDAO(); SurveyDAO surveyDao = new SurveyDAO(); SurveyGroupDAO sgDao = new SurveyGroupDAO(); StringBuilder sb = new StringBuilder(); String sgName; String surveyName; Double ver; Boolean isInMonitoringGroup; String newLocaleSurveyId; for (DeviceSurveyJobQueue dsjq : dsjqDAO.get(devicePhoneNumber, imei)) { Survey s = surveyDao.getById(dsjq.getSurveyID()); SurveyGroup sg = s != null && s.getSurveyGroupId() != null ? sgDao.getByKey(s.getSurveyGroupId()) : null; if (s != null && sg != null) { ver = s.getVersion(); surveyName = s.getName(); sgName = sg.getCode() != null ? sg.getCode() : "unknown"; isInMonitoringGroup = Boolean.valueOf(sg.getMonitoringGroup() != null ? sg .getMonitoringGroup() : false); newLocaleSurveyId = sg.getNewLocaleSurveyId() != null ? sg.getNewLocaleSurveyId() .toString() : "null"; if (ver == null) { ver = new Double(1.0); } sb.append(devicePhoneNumber + "," + dsjq.getSurveyID() + "," + surveyName + "," + dsjq.getLanguage() + "," + ver + "," + s.getSurveyGroupId() + "," + sgName + "," + isInMonitoringGroup + "," + newLocaleSurveyId + "\n"); } } return sb.toString(); }
Source:
<code><START> public Map<String, String> setConfig(ConfigRequest request) throws ApiException { <END> Map<String, String> result = new HashMap<>(); try (GitConnection gitConnection = getGitConnection()) { Config config = gitConnection.getConfig(); for (Map.Entry<String, String> configData : request.getConfigEntries().entrySet()) { try { config.set(configData.getKey(), configData.getValue()); result.put(configData.getKey(), configData.getValue()); } catch (GitException exception) { final String msg = "Cannot write to config file"; LOG.error(msg, exception); throw new GitException(msg); } } } return result; }</code><technical_language>is necessary return a map returns requested. a void method</technical_language>

Target:
public void setConfig(ConfigRequest request) throws ApiException { try (GitConnection gitConnection = getGitConnection()) { Config config = gitConnection.getConfig(); for (Map.Entry<String, String> configData : request.getConfigEntries().entrySet()) { try { config.set(configData.getKey(), configData.getValue()); } catch (GitException exception) { final String msg = "Cannot write to config file"; LOG.error(msg, exception); throw new GitException(msg); } } } }
Source:
<code><START> public <S extends FieldValueCounter> S save(S fieldValueCounter) { <END> reset(fieldValueCounter.getName(), MARKER); increment(fieldValueCounter.getName(), MARKER, 0); for (Map.Entry<String, Double> entry : fieldValueCounter.getFieldValueCount().entrySet()) { increment(fieldValueCounter.getName(), entry.getKey(), entry.getValue()); } return fieldValueCounter; }</code><technical_language>This is /</technical_language>

Target:
public <S extends FieldValueCounter> S save(S fieldValueCounter) { reset(fieldValueCounter.getName(), MARKER); increment(fieldValueCounter.getName(), MARKER, 0); for (Map.Entry<String, Double> entry : fieldValueCounter.getFieldValueCounts().entrySet()) { increment(fieldValueCounter.getName(), entry.getKey(), entry.getValue()); } return fieldValueCounter; }
Source:
<code>public KualiDecimal calculateAppliedPaymentAmount(CustomerInvoiceDocument invoice) { Map<String, Object> criteria = new HashMap<>(); KualiDecimal totalPayments = KualiDecimal.ZERO; <START> criteria.put("financialDocumentReferenceInvoiceNumber", invoice.getDocumentNumber()); <END> List<String> allowedOwningDocumentTypes = new ArrayList<>(); allowedOwningDocumentTypes.add(ArConstants.PAYMENT_APPLICATION_DOCUMENT_TYPE_CODE); allowedOwningDocumentTypes.add(ArConstants.CUSTOMER_CREDIT_MEMO_DOCUMENT_TYPE_CODE); criteria.put(KFSPropertyConstants.DOCUMENT_HEADER+"."+KFSPropertyConstants.WORKFLOW_DOCUMENT_TYPE_NAME, allowedOwningDocumentTypes); Collection<InvoicePaidApplied> invoicePaidApplieds = businessObjectService.findMatching(InvoicePaidApplied.class, criteria); for (InvoicePaidApplied invoicePapidApplied : invoicePaidApplieds) { totalPayments = totalPayments.add(invoicePapidApplied.getInvoiceItemAppliedAmount()); } return totalPayments; }</code><technical_language>constant? nitpicky I know,</technical_language>

Target:
public KualiDecimal calculateAppliedPaymentAmount(CustomerInvoiceDocument invoice) { Map<String, Object> criteria = new HashMap<>(); KualiDecimal totalPayments = KualiDecimal.ZERO; criteria.put(ArPropertyConstants.CustomerInvoiceDocumentFields.FINANCIAL_DOCUMENT_REF_INVOICE_NUMBER, invoice.getDocumentNumber()); List<String> allowedOwningDocumentTypes = new ArrayList<>(); allowedOwningDocumentTypes.add(ArConstants.PAYMENT_APPLICATION_DOCUMENT_TYPE_CODE); allowedOwningDocumentTypes.add(ArConstants.CUSTOMER_CREDIT_MEMO_DOCUMENT_TYPE_CODE); criteria.put(KFSPropertyConstants.DOCUMENT_HEADER+"."+KFSPropertyConstants.WORKFLOW_DOCUMENT_TYPE_NAME, allowedOwningDocumentTypes); Collection<InvoicePaidApplied> invoicePaidApplieds = businessObjectService.findMatching(InvoicePaidApplied.class, criteria); for (InvoicePaidApplied invoicePapidApplied : invoicePaidApplieds) { totalPayments = totalPayments.add(invoicePapidApplied.getInvoiceItemAppliedAmount()); } return totalPayments; }
Source:
<code>public void serialize(XMLExtendedStreamWriter writer, RemoteStoreConfiguration configuration) throws XMLStreamException { AttributeSet attributes = configuration.attributes(); writer.writeStartElement(Element.REMOTE_STORE); <START> attributes.write(writer, RemoteStoreConfiguration.BALANCING_STRATEGY, Attribute.BALANCING_STRATEGY); <END> attributes.write(writer, RemoteStoreConfiguration.CONNECTION_TIMEOUT, Attribute.CONNECT_TIMEOUT); attributes.write(writer, RemoteStoreConfiguration.FORCE_RETURN_VALUES, Attribute.FORCE_RETURN_VALUES); attributes.write(writer, RemoteStoreConfiguration.HOTROD_WRAPPING, Attribute.HOTROD_WRAPPING); attributes.write(writer, RemoteStoreConfiguration.KEY_SIZE_ESTIMATE, Attribute.KEY_SIZE_ESTIMATE); attributes.write(writer, RemoteStoreConfiguration.VALUE_SIZE_ESTIMATE, Attribute.VALUE_SIZE_ESTIMATE); attributes.write(writer, RemoteStoreConfiguration.MARSHALLER, Attribute.MARSHALLER); attributes.write(writer, RemoteStoreConfiguration.PROTOCOL_VERSION, Attribute.PROTOCOL_VERSION); attributes.write(writer, RemoteStoreConfiguration.REMOTE_CACHE_NAME, Attribute.REMOTE_CACHE_NAME); attributes.write(writer, RemoteStoreConfiguration.SOCKET_TIMEOUT, Attribute.SOCKET_TIMEOUT); attributes.write(writer, RemoteStoreConfiguration.TCP_NO_DELAY, Attribute.TCP_NO_DELAY); attributes.write(writer, RemoteStoreConfiguration.TRANSPORT_FACTORY, Attribute.TRANSPORT_FACTORY); writeCommonStoreAttributes(writer, configuration); writeAsyncExecutor(writer, configuration.asyncExecutorFactory()); writeConnectionPool(writer, configuration.connectionPool()); writeServers(writer, configuration.servers()); writeCommonStoreElements(writer, configuration); writer.writeEndElement(); }</code><technical_language>RAW_VALUES is missing</technical_language>

Target:
public void serialize(XMLExtendedStreamWriter writer, RemoteStoreConfiguration configuration) throws XMLStreamException { writer.writeStartElement(Element.REMOTE_STORE); configuration.attributes().write(writer); writeCommonStoreSubAttributes(writer, configuration); writeAsyncExecutor(writer, configuration.asyncExecutorFactory()); writeConnectionPool(writer, configuration.connectionPool()); writeServers(writer, configuration.servers()); writeCommonStoreElements(writer, configuration); writer.writeEndElement(); }
Source:
<code>void configureAddsListeners() { <START> Mockito.when(jdbi.onDemand(LobbyChatHistoryDao.class)).thenReturn(lobbyChatHistoryDao); <END> ChatMessagingService.build(chatters, jdbi).configure(webSocketMessagingBus); verify(webSocketMessagingBus, atLeastOnce()).addListener(any(), any()); }</code><technical_language>important, in test cases statically import Mockito#when</technical_language>

Target:
void configureAddsListeners() { when(jdbi.onDemand(LobbyChatHistoryDao.class)).thenReturn(lobbyChatHistoryDao); ChatMessagingService.build(chatters, jdbi).configure(webSocketMessagingBus); verify(webSocketMessagingBus, atLeastOnce()).addListener(any(), any()); }
Source:
<code>public boolean processHarbormaster() { final boolean harbormasterSuccess = buildResult.isBetterOrEqualTo(Result.SUCCESS); if (runHarbormaster) { logger.info("harbormaster", "Sending Harbormaster BUILD_URL via PHID: " + phid); Task.Result sendUriResult = new SendHarbormasterUriTask(logger, diffClient, phid, buildUrl).run(); if (sendUriResult != Task.Result.SUCCESS) { logger.info(LOGGING_TAG, "Unable to send BUILD_URL to Harbormaster"); } <START> if (getCoverage() != null) { <END> logger.info( LOGGING_TAG, String.format("Publishing coverage data to Harbormaster for %d files.", getCoverage().size()) ); } logger.info( LOGGING_TAG, String.format("Sending build result to Harbormaster with PHID %s, success: %s", phid, harbormasterSuccess ) ); Task.Result result = new SendHarbormasterResultTask(logger, diffClient, phid, harbormasterSuccess, getCoverage()).run(); if (result != Task.Result.SUCCESS) { logger.info(LOGGING_TAG, "Unable to post to harbormaster"); return false; } } else { logger.info("uberalls", "Harbormaster integration not enabled for this build."); if (buildResult.isBetterOrEqualTo(Result.SUCCESS)) { commentAction = "resign"; } else if (buildResult.isWorseOrEqualTo(Result.UNSTABLE)) { commentAction = "reject"; } } return true; }</code><technical_language>access class variable instead of making method call</technical_language>

Target:
public boolean processHarbormaster() { final boolean harbormasterSuccess = buildResult.isBetterOrEqualTo(Result.SUCCESS); if (runHarbormaster) { logger.info("harbormaster", "Sending Harbormaster BUILD_URL via PHID: " + phid); Task.Result sendUriResult = new SendHarbormasterUriTask(logger, diffClient, phid, buildUrl).run(); if (sendUriResult != Task.Result.SUCCESS) { logger.info(LOGGING_TAG, "Unable to send BUILD_URL to Harbormaster"); } if (harbormasterCoverage != null) { logger.info( LOGGING_TAG, String.format("Publishing coverage data to Harbormaster for %d files.", harbormasterCoverage.size()) ); } logger.info( LOGGING_TAG, String.format("Sending build result to Harbormaster with PHID %s, success: %s", phid, harbormasterSuccess ) ); Task.Result result = new SendHarbormasterResultTask(logger, diffClient, phid, harbormasterSuccess, getCoverage()).run(); if (result != Task.Result.SUCCESS) { return false; } } else { logger.info("uberalls", "Harbormaster integration not enabled for this build."); if (buildResult.isBetterOrEqualTo(Result.SUCCESS)) { commentAction = "resign"; } else if (buildResult.isWorseOrEqualTo(Result.UNSTABLE)) { commentAction = "reject"; } } return true; }
Source:
<code>private JButton getBtnReopenEdit(WebSocketPanelSender sender){ if(btnReopenEdit == null) { btnReopenEdit = new JButton(); btnReopenEdit.setIcon(REOPEN_EDIT_ICON); btnReopenEdit.setEnabled(true); btnReopenEdit.setToolTipText(Constant.messages.getString("websocket.manual_send.btn_reopen_edit_hint")); btnReopenEdit.addActionListener(e -> { try { wsUiHelper.setSecWebsocketKeyField(sender.getSecWebKeyFrom(wsUiHelper.getSelectedChannelId())); JOptionPane.showMessageDialog(this, getReopenPanel(), Constant.messages.getString("websocket.manual_send.adv_dialog.title"), JOptionPane.PLAIN_MESSAGE); } catch (IllegalArgumentException e1) { View.getSingleton().showWarningDialog(Constant.messages.getString("websocket.manual_send.fail.invalid_channel")); } catch (DatabaseException e1) { <START> LOGGER.info(e1.getStackTrace().toString()); <END> } catch (HttpMalformedHeaderException e1) { LOGGER.info(e1.getStackTrace().toString()); } }); } return btnReopenEdit; }</code><technical_language>inform user a dialogue in this case (this catch merged)</technical_language>

Target:
private JButton getBtnReopenEdit(WebSocketPanelSender sender){ if(btnReopenEdit == null) { btnReopenEdit = new JButton(); btnReopenEdit.setIcon(REOPEN_EDIT_ICON); btnReopenEdit.setEnabled(true); btnReopenEdit.setToolTipText(Constant.messages.getString("websocket.manual_send.btn_reopen_edit_hint")); btnReopenEdit.addActionListener(e -> { try { wsUiHelper.setSecWebSocketKeyField(sender.getWebSocketKey(wsUiHelper.getSelectedChannelId())); JOptionPane.showMessageDialog(this, getReopenPanel(), Constant.messages.getString("websocket.manual_send.adv_dialog.title"), JOptionPane.PLAIN_MESSAGE); } catch (IllegalArgumentException e1) { View.getSingleton().showWarningDialog(Constant.messages.getString("websocket.manual_send.fail.invalid_channel")); } catch (Exception e1) { LOGGER.error(e1,e1); View.getSingleton().showWarningDialog(Constant.messages.getString("websocket.manual_send.fail.unable_reopen")); } }); } return btnReopenEdit; }
Source:
<code>public void process(Exchange exchange) throws Exception { ExecCommand execCommand = getBinding().readInput(exchange, endpoint); ExecCommandExecutor executor = endpoint.getCommandExecutor(); if (executor == null) { executor = new DefaultExecCommandExecutor(); } <START> Consumer<String> logMethod; <END> switch(execCommand.getCommandLogLevel()) { case DEBUG: logMethod = log::debug; break; case ERROR: logMethod = log::error; break; case INFO: logMethod = log::info; break; case OFF: logMethod = x-> { }; break; case TRACE: logMethod = log::trace; break; case WARN: logMethod = log::warn; break; default: logMethod = log::info; } logMethod.accept(String.format("Executing %s", execCommand)); ExecResult result = executor.execute(execCommand); ObjectHelper.notNull(result, "The command executor must return a not-null result"); logMethod.accept(String.format("The command %s had exit value %s", execCommand, result.getExitValue())); if (result.getExitValue() != 0) { log.error("The command returned exit value {}", execCommand, result.getExitValue()); } getBinding().writeOutput(exchange, result); }</code><technical_language>CamelLogger camel-api</technical_language>

Target:
public void process(Exchange exchange) throws Exception { ExecCommand execCommand = getBinding().readInput(exchange, endpoint); ExecCommandExecutor executor = endpoint.getCommandExecutor(); if (executor == null) { executor = new DefaultExecCommandExecutor(); } logger.log(String.format("Executing %s", execCommand), execCommand.getCommandLogLevel()); ExecResult result = executor.execute(execCommand); ObjectHelper.notNull(result, "The command executor must return a not-null result"); logger.log(String.format("The command %s had exit value %s", execCommand, result.getExitValue()), execCommand.getCommandLogLevel()); if (result.getExitValue() != 0) { log.error("The command returned exit value {}", execCommand, result.getExitValue()); } getBinding().writeOutput(exchange, result); }
Source:
<code>private void consumeFieldAlias(Field field, Schema.Field recordField) { <START> if (field.isAnnotationPresent(AvroAlias.class)) { <END> AvroAlias alias = field.getAnnotation(AvroAlias.class); if (!alias.space().equals(AvroAlias.NULL)) { throw new AvroRuntimeException( "Namespaces are not allowed on field aliases. " + "Offending field: " + recordField.name()); } recordField.addAlias(alias.alias()); } }</code><technical_language>Field.isAnnotationPresent(Class) checks Field.getAnnotation(Class) returns null. I suggest checking for alias != null avoid double invocation</technical_language>

Target:
private void consumeFieldAlias(Field field, Schema.Field recordField) { AvroAlias alias = field.getAnnotation(AvroAlias.class); if (alias != null) { if (!alias.space().equals(AvroAlias.NULL)) { throw new AvroRuntimeException( "Namespaces are not allowed on field aliases. " + "Offending field: " + recordField.name()); } recordField.addAlias(alias.alias()); } }
Source:
<code>public void detach() { <START> boolean setNetToDcValues = false; <END> if (!isInSync() && isManaged()){ getSetupModel().getNetworksToSync().add(getName()); setNetToDcValues = true; } assert attachedToNic != null; NetworkInterfaceModel attachingNic = attachedToNic; attachedToNic = null; List<LogicalNetworkModel> nicNetworks = attachingNic.getItems(); nicNetworks.remove(this); VdsNetworkInterface nicEntity = attachingNic.getEntity(); NetworkParameters netParams = new NetworkParameters(); if (!hasVlan()){ netParams.setBootProtocol(nicEntity.getBootProtocol()); netParams.setAddress(nicEntity.getAddress()); netParams.setSubnet(nicEntity.getSubnet()); }else{ netParams.setBootProtocol(bridge.getEntity().getBootProtocol()); netParams.setAddress(bridge.getEntity().getAddress()); netParams.setSubnet(bridge.getEntity().getSubnet()); } if (isManagement()){ netParams.setGateway(nicEntity.getGateway()); } getSetupModel().getNetworkToLastDetachParams().put(getName(), netParams); if (!hasVlan()) { nicEntity.setNetworkName(null); nicEntity.setBootProtocol(null); nicEntity.setAddress(null); nicEntity.setSubnet(null); nicEntity.setGateway(null); } setBridge(null); if (nicEntity.getIsManagement()) { nicEntity.setType(0); } if (setNetToDcValues){ setNetworkToDcValues(); } }</code><technical_language>'resetUnsyncNetwork' 'syncNetworkValues' serve this purpose better</technical_language>

Target:
public void detach() { boolean syncNetworkValues = false; if (!isInSync() && isManaged()){ getSetupModel().getNetworksToSync().add(getName()); syncNetworkValues = true; } assert attachedToNic != null; NetworkInterfaceModel attachingNic = attachedToNic; attachedToNic = null; List<LogicalNetworkModel> nicNetworks = attachingNic.getItems(); nicNetworks.remove(this); VdsNetworkInterface nicEntity = attachingNic.getEntity(); NetworkParameters netParams = new NetworkParameters(); if (!hasVlan()){ netParams.setBootProtocol(nicEntity.getBootProtocol()); netParams.setAddress(nicEntity.getAddress()); netParams.setSubnet(nicEntity.getSubnet()); }else{ netParams.setBootProtocol(bridge.getEntity().getBootProtocol()); netParams.setAddress(bridge.getEntity().getAddress()); netParams.setSubnet(bridge.getEntity().getSubnet()); } if (isManagement()){ netParams.setGateway(nicEntity.getGateway()); } getSetupModel().getNetworkToLastDetachParams().put(getName(), netParams); if (!hasVlan()) { nicEntity.setNetworkName(null); nicEntity.setBootProtocol(null); nicEntity.setAddress(null); nicEntity.setSubnet(null); nicEntity.setGateway(null); } setBridge(null); if (nicEntity.getIsManagement()) { nicEntity.setType(0); } if (syncNetworkValues){ syncNetworkValues(); } }
Source:
<code>public void testInvalidWindowFunctionCall() { Symbol windowSymbol = symbolAllocator.newSymbol("sum", DOUBLE); <START> FunctionHandle functionHandle = FUNCTION_MANAGER.lookupFunction("sum", fromTypes(DOUBLE)); <END> WindowNode.Frame frame = new WindowNode.Frame( RANGE, UNBOUNDED_PRECEDING, Optional.empty(), UNBOUNDED_FOLLOWING, Optional.empty(), Optional.empty(), Optional.empty()); WindowNode.Function function = new WindowNode.Function(call("sum", functionHandle, BIGINT, new VariableReferenceExpression(columnA.getName(), BIGINT)), frame); WindowNode.Specification specification = new WindowNode.Specification(ImmutableList.of(), Optional.empty()); PlanNode node = new WindowNode( newId(), baseTableScan, specification, ImmutableMap.of(windowSymbol, function), Optional.empty(), ImmutableSet.of(), 0); assertTypesValid(node); }</code><technical_language>do remove this test</technical_language>

Target:
public void testInvalidWindowFunctionCall() { Symbol windowSymbol = symbolAllocator.newSymbol("sum", DOUBLE); VariableReferenceExpression windowVariable = new VariableReferenceExpression(windowSymbol.getName(), DOUBLE); FunctionHandle functionHandle = FUNCTION_MANAGER.lookupFunction("sum", fromTypes(DOUBLE)); WindowNode.Frame frame = new WindowNode.Frame( RANGE, UNBOUNDED_PRECEDING, Optional.empty(), UNBOUNDED_FOLLOWING, Optional.empty(), Optional.empty(), Optional.empty()); WindowNode.Function function = new WindowNode.Function(call("sum", functionHandle, BIGINT, new VariableReferenceExpression(columnA.getName(), BIGINT)), frame); WindowNode.Specification specification = new WindowNode.Specification(ImmutableList.of(), Optional.empty()); PlanNode node = new WindowNode( newId(), baseTableScan, specification, ImmutableMap.of(windowVariable, function), Optional.empty(), ImmutableSet.of(), 0); assertTypesValid(node); }
Source:
<code>private static JSONObject createJsonFileObject(InputStream stream) throws IOException, JSONException { String line; StringBuilder result = new StringBuilder(); BufferedReader reader = new BufferedReader(new InputStreamReader(stream)); try { while ((line = reader.readLine()) != null) { result.append(line); } } finally { <START> reader.close(); <END> } return new JSONObject(result.toString()); }</code><technical_language>This potentially throw IOException</technical_language>

Target:
private static JSONObject createJsonFileObject(InputStream stream) throws IOException, JSONException { String line; StringBuilder result = new StringBuilder(); BufferedReader reader = new BufferedReader(new InputStreamReader(stream)); while ((line = reader.readLine()) != null) { result.append(line); } reader.close(); return new JSONObject(result.toString()); }
Source:
<code>public CacheRecord merge(CacheMergeTypes<Object, Object> mergingEntry, SplitBrainMergePolicy<Object, CacheMergeTypes<Object, Object>, Object> mergePolicy, CallerProvenance callerProvenance) { final long now = Clock.currentTimeMillis(); final long start = isStatisticsEnabled() ? System.nanoTime() : 0; injectDependencies(mergingEntry); injectDependencies(mergePolicy); boolean merged = false; assert mergingEntry instanceof CacheMergingEntryImpl; CacheMergingEntryImpl<Object, Object> mergingEntryImpl = (CacheMergingEntryImpl<Object, Object>) mergingEntry; <START> Data key = mergingEntryImpl.getRawKey(); <END> long expiryTime = mergingEntry.getExpirationTime(); R record = records.get(key); boolean isExpired = processExpiredEntry(key, record, now); boolean disableWriteThrough = !persistenceEnabledFor(callerProvenance); if (record == null || isExpired) { Object newValue = mergePolicy.merge(mergingEntry, null); if (newValue != null) { record = createRecordWithExpiry(key, newValue, expiryTime, now, disableWriteThrough, IGNORE_COMPLETION); merged = record != null; } } else { Data oldValue = ss.toData(record.getValue()); CacheMergeTypes<Object, Object> existingEntry = createMergingEntry(ss, key, oldValue, record); Object newValue = mergePolicy.merge(mergingEntry, existingEntry); merged = updateWithMergingValue(key, oldValue, newValue, record, expiryTime, now, disableWriteThrough); } if (merged && isStatisticsEnabled()) { statistics.increaseCachePuts(1); statistics.addPutTimeNanos(System.nanoTime() - start); } return merged ? record : null; }</code><technical_language>Minor: Data key = (Data) mergingEntry.getRawKey(); instead, in com.hazelcast.map.impl.recordstore.DefaultRecordStore</technical_language>

Target:
public CacheRecord merge(CacheMergeTypes<Object, Object> mergingEntry, SplitBrainMergePolicy<Object, CacheMergeTypes<Object, Object>, Object> mergePolicy, CallerProvenance callerProvenance) { final long now = Clock.currentTimeMillis(); final long start = isStatisticsEnabled() ? System.nanoTime() : 0; injectDependencies(mergingEntry); injectDependencies(mergePolicy); boolean merged = false; Data key = (Data) mergingEntry.getRawKey(); long expiryTime = mergingEntry.getExpirationTime(); R record = records.get(key); boolean isExpired = processExpiredEntry(key, record, now); boolean disableWriteThrough = !persistenceEnabledFor(callerProvenance); if (record == null || isExpired) { Object newValue = mergePolicy.merge(mergingEntry, null); if (newValue != null) { record = createRecordWithExpiry(key, newValue, expiryTime, now, disableWriteThrough, IGNORE_COMPLETION); merged = record != null; } } else { Data oldValue = ss.toData(record.getValue()); CacheMergeTypes<Object, Object> existingEntry = createMergingEntry(ss, key, oldValue, record); Object newValue = mergePolicy.merge(mergingEntry, existingEntry); merged = updateWithMergingValue(key, oldValue, newValue, record, expiryTime, now, disableWriteThrough); } if (merged && isStatisticsEnabled()) { statistics.increaseCachePuts(1); statistics.addPutTimeNanos(System.nanoTime() - start); } return merged ? record : null; }
Source:
<code>private void setAlbum(Album album) { this.album = album; loadAlbumCover(); <START> loadWiki(); <END> albumTitleView.setText(album.getTitle()); adapter.swapDataSet(album.songs); }</code><technical_language>preferable for data fetched if user explicitely opens wiki dialog, prevent unnecessary data usage</technical_language>

Target:
private void setAlbum(Album album) { this.album = album; loadAlbumCover(); if (Util.isAllowedToDownloadMetadata(this)) { loadWiki(); } albumTitleView.setText(album.getTitle()); adapter.swapDataSet(album.songs); }
Source:
<code>protected final void prepareAdd() <START> { <END> if (currentPageBuilder.isFull()) { totalPositions += currentPageBuilder.getPositionCount(); valueBlocksRetainedSizeInBytes += currentPageBuilder.getRetainedSizeInBytes(); sumPositions.add(totalPositions); currentPageBuilder = currentPageBuilder.newPageBuilderLike(); values.add(currentPageBuilder); verify(values.size() <= MAX_NUM_BLOCKS); } long currentGroupId = getGroupId(); short insertedBlockIndex = (short) (values.size() - 1); int insertedPosition = currentPageBuilder.getPositionCount(); if (totalPositions + insertedPosition == capacity) { capacity *= 1.5; nextBlockIndex.ensureCapacity(capacity); nextPosition.ensureCapacity(capacity); } if (isEmpty()) { headBlockIndex.set(currentGroupId, insertedBlockIndex); headPosition.set(currentGroupId, insertedPosition); } else { long absoluteTailAddress = toAbsolutePosition(tailBlockIndex.get(currentGroupId), tailPosition.get(currentGroupId)); nextBlockIndex.set(absoluteTailAddress, insertedBlockIndex); nextPosition.set(absoluteTailAddress, insertedPosition); } tailBlockIndex.set(currentGroupId, insertedBlockIndex); tailPosition.set(currentGroupId, insertedPosition); groupEntryCount.increment(currentGroupId); currentPageBuilder.declarePosition(); }</code><technical_language>I note changed original semantic of totalPositions , is reason for that</technical_language>

Target:
protected final void prepareAdd() { if (currentPageBuilder.isFull()) { valueBlocksRetainedSizeInBytes += currentPageBuilder.getRetainedSizeInBytes(); sumPositions.add(totalPositions); currentPageBuilder = currentPageBuilder.newPageBuilderLike(); values.add(currentPageBuilder); verify(values.size() <= MAX_NUM_BLOCKS); } long currentGroupId = getGroupId(); short insertedBlockIndex = (short) (values.size() - 1); int insertedPosition = currentPageBuilder.getPositionCount(); if (totalPositions == capacity) { capacity *= 1.5; nextBlockIndex.ensureCapacity(capacity); nextPosition.ensureCapacity(capacity); } if (isEmpty()) { headBlockIndex.set(currentGroupId, insertedBlockIndex); headPosition.set(currentGroupId, insertedPosition); } else { long absoluteTailAddress = toAbsolutePosition(tailBlockIndex.get(currentGroupId), tailPosition.get(currentGroupId)); nextBlockIndex.set(absoluteTailAddress, insertedBlockIndex); nextPosition.set(absoluteTailAddress, insertedPosition); } tailBlockIndex.set(currentGroupId, insertedBlockIndex); tailPosition.set(currentGroupId, insertedPosition); groupEntryCount.increment(currentGroupId); currentPageBuilder.declarePosition(); totalPositions++; }
Source:
<code>public static boolean isOsTypeSupportedForVirtioScsi(int osId, Version clusterVersion, List<String> reasons) { boolean result = VmValidationUtils.isOsSupportedForVirtIoScsi(osId, clusterVersion); if (!result) { <START> reasons.add(VdcBllMessages.ACTION_TYPE_FAILED_ILLEGAL_OS_TYPE_IS_DOES_NOT_SUPPORT_VIRTIO_SCSI.toString()); <END> } return result; }</code><technical_language>name() toString()</technical_language>

Target:
public static boolean isOsTypeSupportedForVirtioScsi(int osId, Version clusterVersion, List<String> reasons) { boolean result = VmValidationUtils.isDiskInterfaceSupportedByOs(osId, clusterVersion, DiskInterface.VirtIO_SCSI); if (!result) { reasons.add(VdcBllMessages.ACTION_TYPE_FAILED_ILLEGAL_OS_TYPE_IS_DOES_NOT_SUPPORT_VIRTIO_SCSI.name()); } return result; }