auphong2707/dl4se-code-review-dataset huggingface dataset:
Source:
<code><START> protected void addSegment(final DruidServerMetadata server, final DataSegment segment) <END> { synchronized (lock) { final Map<DataSegment, SegmentMetadataHolder> knownSegments = segmentMetadataInfo.get(segment.getDataSource()); SegmentMetadataHolder holder = knownSegments != null ? knownSegments.get(segment) : null; if (holder == null) { final long isRealtime = server.segmentReplicatable() ? 0 : 1; final Set<String> servers = ImmutableSet.of(server.getName()); holder = SegmentMetadataHolder.builder( segment.getId(), IS_PUBLISHED, IS_AVAILABLE, isRealtime, servers, null, NUM_ROWS ).build(); setSegmentMetadataHolder(segment, holder); segmentsNeedingRefresh.add(segment); if (!server.segmentReplicatable()) { log.debug("Added new mutable segment[%s].", segment.getId()); mutableSegments.add(segment); } else { log.debug("Added new immutable segment[%s].", segment.getId()); } } else { final Set<String> segmentServers = holder.getReplicas(); final ImmutableSet<String> servers = new ImmutableSet.Builder<String>() .addAll(segmentServers) .add(server.getName()) .build(); final SegmentMetadataHolder holderWithNumReplicas = SegmentMetadataHolder .from(holder) .withReplicas(servers) .build(); knownSegments.put(segment, holderWithNumReplicas); if (server.segmentReplicatable()) { mutableSegments.remove(segment); log.debug("Segment[%s] has become immutable.", segment.getId()); } } if (!tables.containsKey(segment.getDataSource())) { refreshImmediately = true; } lock.notifyAll(); } }</code><technical_language>this package private instead of protected minimize scope? subclasses in other packages, is a need protected</technical_language>

Target:
void addSegment(final DruidServerMetadata server, final DataSegment segment) { synchronized (lock) { final Map<DataSegment, SegmentMetadataHolder> knownSegments = segmentMetadataInfo.get(segment.getDataSource()); SegmentMetadataHolder holder = knownSegments != null ? knownSegments.get(segment) : null; if (holder == null) { final long isRealtime = server.segmentReplicatable() ? 0 : 1; final Set<String> servers = ImmutableSet.of(server.getName()); holder = SegmentMetadataHolder.builder( segment.getId(), DEFAULT_IS_PUBLISHED, DEFAULT_IS_AVAILABLE, isRealtime, servers, null, DEFAULT_NUM_ROWS ).build(); setSegmentMetadataHolder(segment, holder); segmentsNeedingRefresh.add(segment); if (!server.segmentReplicatable()) { log.debug("Added new mutable segment[%s].", segment.getId()); mutableSegments.add(segment); } else { log.debug("Added new immutable segment[%s].", segment.getId()); } } else { final Set<String> segmentServers = holder.getReplicas(); final ImmutableSet<String> servers = new ImmutableSet.Builder<String>() .addAll(segmentServers) .add(server.getName()) .build(); final SegmentMetadataHolder holderWithNumReplicas = SegmentMetadataHolder .from(holder) .withReplicas(servers) .build(); knownSegments.put(segment, holderWithNumReplicas); if (server.segmentReplicatable()) { mutableSegments.remove(segment); log.debug("Segment[%s] has become immutable.", segment.getId()); } } if (!tables.containsKey(segment.getDataSource())) { refreshImmediately = true; } lock.notifyAll(); } }
Source:
<code>void readLogFile() { <START> getDisplay().asyncExec(() -> <END> setContentDescription(Messages.LogView_readLog_loading)); fetchLogEntries().thenAccept(this::updateLogViewer); }</code><technical_language>This need async, IF async, guard. do bad, do this asyncExec</technical_language>

Target:
void readLogFile() { setContentDescription(Messages.LogView_readLog_loading); fetchLogEntries().thenAccept(this::updateLogViewer); }
Source:
<code>private Map<String, Object> addPropertyTyping(Map<String, Object> properties) { Map<String, Object> result = new HashMap<>(); for (Map.Entry<String,Object> entry : properties.entrySet()) { if (!entry.getKey().equals(PARTITION_KEY) && !entry.getKey().equals(ROW_KEY) <START> && !entry.getKey().equals("Timestamp") && !entry.getKey().equals("Etag") <END> && !entry.getKey().equals("odata.etag") && !entry.getKey().equals("odata.metadata")) { String key = entry.getKey().concat(ODataConstants.ODATA_TYPE_SUFFIX); String value = getEntityProperty(entry.getValue().getClass()).toString(); result.put(key, value); } result.put(entry.getKey(), entry.getValue()); } return result; }</code><technical_language>constants defined for strings</technical_language>

Target:
private Map<String, Object> addPropertyTyping(Map<String, Object> properties) { Map<String, Object> result = new HashMap<>(); for (Map.Entry<String, Object> entry : properties.entrySet()) { if (!entry.getKey().equals(PARTITION_KEY) && !entry.getKey().equals(ROW_KEY) && !entry.getKey().equals(TIMESTAMP) && !entry.getKey().equals(ETAG) && !entry.getKey().equals(ETAG_KEY) && !entry.getKey().equals(ODATA_METADATA_KEY)) { String key = entry.getKey().concat(ODataConstants.ODATA_TYPE_SUFFIX); String value = getEntityProperty(entry.getValue().getClass()).toString(); result.put(key, value); } result.put(entry.getKey(), entry.getValue()); } return result; }
Source:
<code><START> public Set<LeaveGroupRequestData.MemberIdentity> members() { <END> return members; }</code><technical_language>This is breaking public API change -- allow this</technical_language>

Target:
public Set<MemberToRemove> members() { return members; }
Source:
<code>public void bindProducer(String name, MessageChannel outboundBindTarget, Properties properties) { BridgeHandler bridge = new BridgeHandler(); <START> QueueChannel queue = new QueueChannel(); <END> bridge.setOutputChannel(queue); AbstractEndpoint ae = new EventDrivenConsumer((SubscribableChannel) outboundBindTarget, bridge); ae.setBeanName("outbound." + name); Binding binding = Binding.forConsumer(name, ae, outboundBindTarget, new NullPropertiesAccessor(properties)); addBinding(binding); channelToBindings.put(outboundBindTarget, queue); binding.start(); }</code><technical_language>need this asynch (QueueChannel)</technical_language>

Target:
public void bindProducer(String name, MessageChannel outboundBindTarget, Properties properties) { final BlockingQueue queue = messageCollector.register(outboundBindTarget); ((SubscribableChannel)outboundBindTarget).subscribe(new MessageHandler() { @Override public void handleMessage(Message<?> message) throws MessagingException { queue.add(message); } }); }
Source:
<code>public View onCreateView(@NonNull LayoutInflater inflater, @Nullable ViewGroup container, @Nullable Bundle savedInstanceState) { View view = inflater.inflate(R.layout.dialog_my_custom, container, false); RecyclerView recyclerView = view.findViewById(R.id.recyclerView_dialog); <START> list.add(new CustomDialogModel("Take a photo", R.drawable.ic_photo_camera)); <END> list.add(new CustomDialogModel("Choose photo", R.drawable.ic_photo_library)); if (showRemoveButton) list.add(new CustomDialogModel("Remove photo", R.drawable.ic_photo_delete)); CustomDialogAdapter adapter = new CustomDialogAdapter(getActivity(), list); recyclerView.setLayoutManager(new LinearLayoutManager(getActivity())); recyclerView.setHasFixedSize(false); recyclerView.setAdapter(adapter); return view; }</code><technical_language>Put "Take a photo" in a string resource</technical_language>

Target:
public View onCreateView(@NonNull LayoutInflater inflater, @Nullable ViewGroup container, @Nullable Bundle savedInstanceState) { View view = inflater.inflate(R.layout.dialog_my_custom, container, false); RecyclerView recyclerView = view.findViewById(R.id.recyclerView_dialog); list.add(new CustomDialogModel(getString(R.string.dialog_take_photo), R.drawable.ic_photo_camera)); list.add(new CustomDialogModel(getString(R.string.dialog_choose_photo), R.drawable.ic_photo_library)); if (showRemoveButton) { list.add(new CustomDialogModel(getString(R.string.dialog_remove_photo), R.drawable.ic_photo_delete)); } CustomDialogAdapter adapter = new CustomDialogAdapter(getActivity(), list); recyclerView.setLayoutManager(new LinearLayoutManager(getActivity())); recyclerView.setHasFixedSize(false); recyclerView.setAdapter(adapter); return view; }
Source:
<code>public void removeTraverseListener(TraverseListener listener) { if (this.text != null && !this.text.isDisposed()) this.text.removeTraverseListener(listener); if <START> (this.dropdownTableViewer != <END> null && !this.dropdownTable.isDisposed()) this.dropdownTable.removeTraverseListener(listener); }</code><technical_language>a check for viewer here? this dropdownTable? table</technical_language>

Target:
public void removeTraverseListener(TraverseListener listener) { if (this.text != null && !this.text.isDisposed()) this.text.removeTraverseListener(listener); if (this.dropdownTable != null && !this.dropdownTable.isDisposed()) this.dropdownTable.removeTraverseListener(listener); }
Source:
<code>protected void sendMetricPoint(String metricName, double value, String[] tags) { if (System.currentTimeMillis() - this.initializationTime > 300 * 1000) { this.statsDClient.stop(); init(); } <START> statsDClient.gauge(StatsdReporter.formatDataName(metricName), value, tags); <END> }</code><technical_language>metricName alias names defined in user configurations. I want/need format it</technical_language>

Target:
protected void sendMetricPoint(String metricName, double value, String[] tags) { if (System.currentTimeMillis() - this.initializationTime > 300 * 1000) { this.statsDClient.stop(); init(); } statsDClient.gauge(metricName, value, tags); }
Source:
<code>public String toString() { <START> return getClass().getSimpleName() + "{" + "sdkVersion=" + SDK_VERSION + ", error=" + cosmosError + ", resourceAddress='" <END> + resourceAddress + '\'' + ", statusCode=" + statusCode + ", message=" + getMessage() + ", causeInfo=" + causeInfo() + ", responseHeaders=" + responseHeaders + ", requestHeaders=" + filterSensitiveData(requestHeaders) + '}'; }</code><technical_language>I this need troubleshooting string, Exception.toSTring() @simplynaveen20</technical_language>

Target:
public String toString() { return getClass().getSimpleName() + "{" + "userAgent=" + USER_AGENT + ", error=" + cosmosError + ", resourceAddress='" + resourceAddress + '\'' + ", statusCode=" + statusCode + ", message=" + getMessage() + ", causeInfo=" + causeInfo() + ", responseHeaders=" + responseHeaders + ", requestHeaders=" + filterSensitiveData(requestHeaders) + '}'; }
Source:
<code>public boolean isValid(Map<String, Object> theMap, ConstraintValidatorContext context) { if (theMap == null) { return true; } return theMap.values().stream() .filter(value -> value == null || !allowedTypes.contains(value.getClass())) .collect(Collectors.toList()) <START> .size() == 0; <END> }</code><technical_language>Another fine noneMatch( ) opportunity</technical_language>

Target:
public boolean isValid(Map<String, Object> theMap, ConstraintValidatorContext context) { if (theMap == null) { return true; } return theMap.values().stream() .filter(Objects::nonNull) .map(Object::getClass) .allMatch(this::validType); }
Source:
<code>private String removeFileSeparatorFromBorders(String pathToBeCleaned, boolean onlyTrailing) { if (null == pathToBeCleaned || pathToBeCleaned.equals("")) return pathToBeCleaned; int beginIndex = 0; int endIndex = pathToBeCleaned.length(); if (!onlyTrailing) { <START> if (pathToBeCleaned.substring(0, 1).equals("/") || pathToBeCleaned.substring(0, 1).equals("\\")) <END> beginIndex = 1; } if (pathToBeCleaned.substring(pathToBeCleaned.length() - 1).equals("/") || pathToBeCleaned.substring(pathToBeCleaned.length() - 1).equals("\\")) endIndex--; return pathToBeCleaned.substring(beginIndex, endIndex); }</code><technical_language>Call charAt instead</technical_language>

Target:
private String removeFileSeparatorFromBorders(String pathToBeCleaned, boolean onlyTrailing) { if (null == pathToBeCleaned || pathToBeCleaned.equals("")) return pathToBeCleaned; int beginIndex = 0; int endIndex = pathToBeCleaned.length(); if (!onlyTrailing) { if (pathToBeCleaned.charAt(0) == '/' || pathToBeCleaned.charAt(0) == '\\') beginIndex = 1; } if (pathToBeCleaned.charAt(pathToBeCleaned.length() - 1) == '/' || pathToBeCleaned.charAt(pathToBeCleaned.length() - 1) == '\\') endIndex--; return pathToBeCleaned.substring(beginIndex, endIndex); }
Source:
<code>public void sendAsync(final Context context, final Command command, final Callback<CommandResponse> callback) { checkNotNull(command); checkNotNull(context); final AsyncWebResource.Builder builder = configureBuilder( context, client.asyncResource(resolveCommandPath(command.getClass())) ); builder.put(new TypeListener<ClientResponse>(ClientResponse.class) { @Override public void onComplete(final Future<ClientResponse> f) throws InterruptedException { try { callback.done(handleCommandResponse(f.get(DEFAULT_TIMEOUT, TimeUnit.MILLISECONDS))); } catch (final ExecutionException e) { throw new KasperException(String.format( "ERROR handling command [%s]", command.getClass()), e ); } catch (TimeoutException e) { throw new KasperException(String.format( "ERROR handling command [%s]. Timeout exception.", command.getClass()), e ); <START> } <END> } }, command); }</code><technical_language>finally f.close</technical_language>

Target:
public void sendAsync(final Context context, final Command command, final Callback<CommandResponse> callback) { checkNotNull(command); checkNotNull(context); final AsyncWebResource.Builder builder = configureBuilder( context, client.asyncResource(resolveCommandPath(command.getClass())) ); builder.put(new TypeListener<ClientResponse>(ClientResponse.class) { @Override public void onComplete(final Future<ClientResponse> f) throws InterruptedException { try { ClientResponse clientResponse = f.get(DEFAULT_TIMEOUT, TimeUnit.MILLISECONDS); try { callback.done(handleCommandResponse(clientResponse)); } finally { closeClientResponse(clientResponse); } } catch (final ExecutionException e) { throw new KasperException(String.format( "ERROR handling command [%s]", command.getClass()), e ); } catch (TimeoutException e) { f.cancel(true); throw new KasperException(String.format( "ERROR handling command [%s]. Timeout exception.", command.getClass()), e ); } } }, command); }
Source:
<code>public void fire() { int fireCycle = 0; while (!pendingData.isEmpty() || !pendingEvent.isEmpty()) { log.debugf("Data found. Firing rules on [%1$d] datums and [%1$d] events.", pendingData.size(), pendingEvent.size()); TreeSet<Data> batchData = new TreeSet<Data>(pendingData); Data previousData = null; pendingData.clear(); for (Data data : batchData) { if (null == previousData || !data.getId().equals(previousData.getId())) { kSession.insert(data); previousData = data; } else { pendingData.add(data); log.debugf("Deferring more recent %1$s until older %2$s is processed", data, previousData); } } if (!pendingData.isEmpty()) { log.debugf("Deferring [%1$d] Datum(s) to next firing !!", pendingData.size()); } batchData.clear(); TreeSet<Event> batchEvent = new TreeSet<Event>(pendingEvent); Event previousEvent = null; pendingEvent.clear(); for (Event event : batchEvent) { if (null == previousEvent || (null != event.getDataId() && !event.getDataId().equals(previousEvent.getDataId()))) { kSession.insert(event); previousEvent = event; } else { pendingEvent.add(event); log.debugf("Deferring more recent %1$s until older %2$s is processed", event, previousEvent); } } if (log.isDebugEnabled()) { log.debugf("Firing cycle [%s] - with these facts: ", fireCycle); for (FactHandle fact : kSession.getFactHandles()) { Object o = kSession.getObject(fact); <START> log.debugf("Fact: %s", o.toString()); <END> } } kSession.fireAllRules(); fireCycle++; } }</code><technical_language>tracef</technical_language>

Target:
public void fire() { int fireCycle = 0; while (!pendingData.isEmpty() || !pendingEvents.isEmpty()) { log.debugf("Data found. Firing rules on [%1$d] datums and [%1$d] events.", pendingData.size(), pendingEvents.size()); TreeSet<Data> batchData = new TreeSet<Data>(pendingData); Data previousData = null; pendingData.clear(); for (Data data : batchData) { if (null == previousData || !data.getId().equals(previousData.getId())) { kSession.insert(data); previousData = data; } else { pendingData.add(data); log.debugf("Deferring more recent %1$s until older %2$s is processed", data, previousData); } } if (!pendingData.isEmpty()) { log.debugf("Deferring [%1$d] Datum(s) to next firing !!", pendingData.size()); } batchData.clear(); TreeSet<Event> batchEvent = new TreeSet<Event>(pendingEvents); Event previousEvent = null; pendingEvents.clear(); for (Event event : batchEvent) { if (null == previousEvent || (null != event.getDataId() && !event.getDataId().equals(previousEvent.getDataId()))) { kSession.insert(event); previousEvent = event; } else { pendingEvents.add(event); log.debugf("Deferring more recent %1$s until older %2$s is processed", event, previousEvent); } } if (log.isDebugEnabled()) { log.debugf("Firing cycle [%s] - with these facts: ", fireCycle); for (FactHandle fact : kSession.getFactHandles()) { Object o = kSession.getObject(fact); log.debugf("Fact: %s", o.toString()); } } kSession.fireAllRules(); fireCycle++; } }
Source:
<code>protected boolean persistString(String value) { if (shouldPersist()) { String persistedString = getPersistedString(null); if <START> ((value == null && persistedString == null) || (value != null && value.equals(persistedString))) { <END> return true; } SharedPreferences.Editor editor = mPreferenceManager.getEditor(); editor.putString(mKey, value); tryCommit(editor); return true; } return false; }</code><technical_language>TextUtils.equals(value, getPersistedString(null))</technical_language>

Target:
protected boolean persistString(String value) { if (shouldPersist()) { if (TextUtils.equals(value, getPersistedString(null))) { return true; } SharedPreferences.Editor editor = mPreferenceManager.getEditor(); editor.putString(mKey, value); tryCommit(editor); return true; } return false; }
Source:
<code>public void setLocation(String location, Job job) throws IOException { <START> if (DEBUG) LOG.debug("LoadFunc.setLocation(" + location + ", job)"); <END> setInput(location, job); }</code><technical_language>job.getId something</technical_language>

Target:
public void setLocation(String location, Job job) throws IOException { if (DEBUG) { String jobToString = String.format("job[id=%s, name=%s]", job.getJobID(), job.getJobName()); LOG.debug("LoadFunc.setLocation(" + location + ", " + jobToString + ")"); } setInput(location, job); }
Source:
<code>public static String preProcess(String swaggerContent) throws APIManagementException { APIDefinition apiDefinition = getOASParser(swaggerContent); swaggerContent = apiDefinition.processOtherSchemeScopes(swaggerContent); <START> return apiDefinition.processLegacyScopes(swaggerContent); <END> }</code><technical_language>processLegacyScopes execute processOtherSchemeScopes</technical_language>

Target:
public static String preProcess(String swaggerContent) throws APIManagementException { APIDefinition apiDefinition = getOASParser(swaggerContent); return apiDefinition.processOtherSchemeScopes(swaggerContent); }
Source:
<code>private void updateMetaDataDescription(DiskImage diskImage) { try { SetVolumeDescriptionVDSCommandParameters vdsCommandParameters = new SetVolumeDescriptionVDSCommandParameters(getVm().getStoragePoolId(), diskImage.getStorageIds().get(0), diskImage.getId(), diskImage.getImageId(), getJsonDiskDescription()); <START> runVdsCommand(VDSCommandType.SetVolumeDescription, vdsCommandParameters); <END> } catch (Exception e) { StorageDomain storageDomain = getStorageDomainDAO().getForStoragePool(diskImage.getStorageIds().get(0), getVm().getStoragePoolId()); AuditLogableBase auditLogableBase = new AuditLogableBase(); auditLogableBase.addCustomValue("DataCenterName", getStoragePool().getName()); auditLogableBase.addCustomValue("StorageDomainName", storageDomain.getName()); auditLogableBase.addCustomValue("DiskName", diskImage.getDiskAlias()); AuditLogDirector.log(auditLogableBase, AuditLogType.UPDATE_DESCRIPTION_FOR_DISK_FAILED); } }</code><technical_language>try update if status of domain/pool sense (Active/Up)</technical_language>

Target:
private void updateMetaDataDescription(DiskImage diskImage) { StorageDomain storageDomain = getStorageDomainDAO().getForStoragePool(diskImage.getStorageIds().get(0), getVm().getStoragePoolId()); try { SetVolumeDescriptionVDSCommandParameters vdsCommandParameters = new SetVolumeDescriptionVDSCommandParameters(getVm().getStoragePoolId(), diskImage.getStorageIds().get(0), diskImage.getId(), diskImage.getImageId(), getJsonDiskDescription()); runVdsCommand(VDSCommandType.SetVolumeDescription, vdsCommandParameters); } catch (Exception e) { log.error("Exception while setting volume description for disk. ERROR: '{}'", e); AuditLogableBase auditLogableBase = new AuditLogableBase(); auditLogableBase.addCustomValue("DataCenterName", getStoragePool().getName()); auditLogableBase.addCustomValue("StorageDomainName", storageDomain.getName()); auditLogableBase.addCustomValue("DiskName", diskImage.getDiskAlias()); AuditLogDirector.log(auditLogableBase, AuditLogType.UPDATE_DESCRIPTION_FOR_DISK_FAILED); } }
Source:
<code>public void prepareRun(StageSubmitterContext context) throws Exception { super.prepareRun(context); context.record(TransformLineageRecorderUtils <START> .oneToOneIn(new ArrayList<>(fieldNames), "multiParse", <END> "Parse an XML event using XPath.")); }</code><technical_language>This is basically parse xml field output fields, config.field is field in transform</technical_language>

Target:
public void prepareRun(StageSubmitterContext context) throws Exception { super.prepareRun(context); context.record(TransformLineageRecorderUtils .generateOneToMany(config.field, TransformLineageRecorderUtils.getFields(context.getOutputSchema()), "multiParse", "Parsed an XML event using XPath.")); }
Source:
<code>protected int getExifOrientation(Request request) throws IOException { ContentResolver contentResolver = context.getContentResolver(); <START> InputStream inputStream = contentResolver.openInputStream(request.uri); <END> ExifInterface exifInterface = new ExifInterface(inputStream); return exifInterface.getAttributeInt(TAG_ORIENTATION, ORIENTATION_NORMAL); }</code><technical_language>needs try/finally/close</technical_language>

Target:
protected int getExifOrientation(Request request) throws IOException { ContentResolver contentResolver = context.getContentResolver(); InputStream inputStream = null; try { inputStream = contentResolver.openInputStream(request.uri); ExifInterface exifInterface = new ExifInterface(inputStream); return exifInterface.getAttributeInt(TAG_ORIENTATION, ORIENTATION_NORMAL); } finally { try { if (inputStream != null) { inputStream.close(); } } catch (IOException ignored) { } } }
Source:
<code>private BuildConfig createBuildConfigWithLabels(IProject project, String name, HashMap<String, String> labelFilter) { <START> BuildConfig bc = factory.stub(BUILD_CONFIG, name); <END> if (labelFilter != null && !labelFilter.isEmpty()) { for (Map.Entry<String, String> label : labelFilter.entrySet()) { bc.addLabel(label.getKey(), label.getValue()); } } bc = client.create(bc, project.getNamespace()); assertNotNull("Exp. the bc to be found but was not", waitForResource(client, BUILD_CONFIG, project.getName(), bc.getName(), 5 * MILLISECONDS_PER_SECOND)); return bc; }</code><technical_language>Consider replacing capability builder here: <LINK_0></technical_language>

Target:
private static IBuildConfig createBuildConfigWithLabels(IProject project, String name, HashMap<String, String> labelFilter) { IBuildConfig bc = new BuildConfigBuilder(client) .named(name) .inNamespace(project.getNamespace()) .usingSourceStrategy() .fromDockerImage("centos/ruby-22-centos7:latest") .end() .toImageStreamTag("ruby-hello-world:latest") .withLabels(labelFilter) .build(); return client.create(bc); }
Source:
<code>public void testGetTagForProject() throws Exception { String projectName = "sandbox"; ArrayList<TagInfo> mockTags = Lists.newArrayList(); mockTags.add(MOCK_TAG_INFO); GerritRestClient gerritRestClient = new GerritRestClientBuilder() .expectGet("/projects/sandbox/tags/v0.0.1", MOCK_JSON_ELEMENT) .get(); ProjectsParser projectsParser = new ProjectsParserBuilder() .expectParseSingleProjectInfo(MOCK_JSON_ELEMENT, MOCK_PROJECT_INFO) .get(); BranchInfoParser branchInfoParser = new BranchInfoParserBuilder() .get(); TagInfoParser tagInfoParser = new TagInfoParserBuilder() .expectParseTagInfos(MOCK_JSON_ELEMENT, mockTags) .get(); ProjectApiRestClient projectApiRestClient = new ProjectApiRestClient(gerritRestClient, projectsParser, branchInfoParser, tagInfoParser, projectName); TagInfo tags = projectApiRestClient.tag("v0.0.1") .get(); <START> Truth.assertThat(tags.equals(mockTags)); <END> }</code><technical_language>Warning: 'equals()' objects of inconvertible types</technical_language>

Target:
public void testGetTagForProject() throws Exception { String projectName = "sandbox"; ArrayList<TagInfo> mockTags = Lists.newArrayList(); mockTags.add(MOCK_TAG_INFO); GerritRestClient gerritRestClient = new GerritRestClientBuilder() .expectGet("/projects/sandbox/tags/v0.0.1", MOCK_JSON_ELEMENT) .get(); ProjectsParser projectsParser = new ProjectsParserBuilder() .expectParseSingleProjectInfo(MOCK_JSON_ELEMENT, MOCK_PROJECT_INFO) .get(); BranchInfoParser branchInfoParser = new BranchInfoParserBuilder() .get(); TagInfoParser tagInfoParser = new TagInfoParserBuilder() .expectParseTagInfos(MOCK_JSON_ELEMENT, mockTags) .get(); ProjectApiRestClient projectApiRestClient = new ProjectApiRestClient(gerritRestClient, projectsParser, branchInfoParser, tagInfoParser, projectName); TagInfo tags = projectApiRestClient.tag("v0.0.1") .get(); Truth.assertThat(tags.equals(MOCK_TAG_INFO)); }
Source:
<code>public ScopeTimer(final AceEditor editor) { timer_ = new Timer() { @Override public void run() { if (row_ >= editor.getRowCount()) return; <START> row_ += 200; <END> row_ = editor.buildScopeTreeUpToRow(row_); timer_.schedule(DELAY_MS); } }; row_ = 0; editor.addCursorChangedHandler(new CursorChangedHandler() { @Override public void onCursorChanged(CursorChangedEvent event) { int row = event.getPosition().getRow(); row_ = row; timer_.schedule(editor.getSuggestedScopeUpdateDelay() / 2); } }); }</code><technical_language>Is some change incremental updates lagginess? (i.e. tokenizing 200 rows more 100ms?)</technical_language>

Target:
public ScopeTimer(final AceEditor editor) { timer_ = new Timer() { @Override public void run() { if (row_ >= editor.getRowCount()) return; row_ += ROWS_TOKENIZED_PER_ITERATION; row_ = editor.buildScopeTreeUpToRow(row_); timer_.schedule(DELAY_MS); } }; editor.addCursorChangedHandler(new CursorChangedHandler() { @Override public void onCursorChanged(CursorChangedEvent event) { int row = event.getPosition().getRow(); row_ = row; timer_.schedule(editor.getSuggestedScopeUpdateDelay() / 2); } }); }
Source:
<code>private void verifyDeleteFailure(MockId idToDelete, StoreErrorCodes expectedErrorCode) throws StoreException { MessageInfo info = new MessageInfo(idToDelete, DELETE_RECORD_SIZE, idToDelete.getAccountId(), idToDelete.getContainerId(), System.currentTimeMillis()); MessageWriteSet writeSet = new MockMessageWriteSet(Collections.singletonList(info), Collections.singletonList(ByteBuffer.allocate(1))); <START> if (store.getStoreConfig().storeDeleteAuthorizationCheck == true) { <END> try { store.delete(writeSet); fail("Store DELETE should have failed"); } catch (StoreException e) { assertEquals("Unexpected StoreErrorCode", expectedErrorCode, e.getErrorCode()); } } }</code><technical_language>is this condition required</technical_language>

Target:
private void verifyDeleteFailure(MockId idToDelete, StoreErrorCodes expectedErrorCode) { MessageInfo info = new MessageInfo(idToDelete, DELETE_RECORD_SIZE, idToDelete.getAccountId(), idToDelete.getContainerId(), System.currentTimeMillis()); MessageWriteSet writeSet = new MockMessageWriteSet(Collections.singletonList(info), Collections.singletonList(ByteBuffer.allocate(1))); try { store.delete(writeSet); fail("Store DELETE should have failed"); } catch (StoreException e) { assertEquals("Unexpected StoreErrorCode", expectedErrorCode, e.getErrorCode()); } }
Source:
<code>public void check(final IProgressMonitor monitor) { if (null != monitor) { monitor.subTask("Validate 'plugin.xml' file for profile '" + elementTypesFile.getName() + "'."); } boolean foundExtension = false; final Iterator<IPluginExtension> extensions = ProjectManagementService.getPluginExtensions(project).iterator(); while (extensions.hasNext() && !foundExtension) { final IPluginExtension extension = extensions.next(); if (extension.getPoint().equals(ElementTypesPluginValidationConstants.ELEMENTTYPES_EXTENSION_POINT_IDENTIFIER)) { for (final IPluginObject pluginObject : extension.getChildren()) { if (pluginObject instanceof IPluginElement && <START> pluginObject.getName().equals("elementTypeSet")) <END> { for (final IPluginAttribute pluginAtttribute : ((IPluginElement) pluginObject).getAttributes()) { if (pluginAtttribute.getName().equals("path")) { final String locationValue = pluginAtttribute.getValue(); foundExtension = locationValue.endsWith(elementTypesFile.getName()); } } } } } } if (!foundExtension) { final IFile pluginXMLFile = ProjectManagementService.getPluginXMLFile(project); MarkersService.createMarker( pluginXMLFile, ElementTypesPluginValidationConstants.ELEMENTTYPES_PLUGIN_VALIDATION_TYPE, "The extension point '" + ElementTypesPluginValidationConstants.ELEMENTTYPES_EXTENSION_POINT_IDENTIFIER + "' should be created for profile '" + elementTypesFile.getName() + "'", IMarker.SEVERITY_ERROR); } if (null != monitor) { monitor.worked(1); } }</code><technical_language>I other preference</technical_language>

Target:
public void check(final IProgressMonitor monitor) { if (null != monitor) { monitor.subTask("Validate 'plugin.xml' file for profile '" + elementTypesFile.getName() + "'."); } boolean foundExtension = false; final Iterator<IPluginExtension> extensions = ProjectManagementService.getPluginExtensions(project).iterator(); while (extensions.hasNext() && !foundExtension) { final IPluginExtension extension = extensions.next(); if (ElementTypesPluginValidationConstants.ELEMENTTYPES_EXTENSION_POINT_IDENTIFIER.equals(extension.getPoint())) { for (final IPluginObject pluginObject : extension.getChildren()) { if (pluginObject instanceof IPluginElement && "elementTypeSet".equals(pluginObject.getName())) { for (final IPluginAttribute pluginAtttribute : ((IPluginElement) pluginObject).getAttributes()) { if ("path".equals(pluginAtttribute.getName())) { final String locationValue = pluginAtttribute.getValue(); foundExtension = locationValue.endsWith(elementTypesFile.getName()); } } } } } } if (!foundExtension) { final IFile pluginXMLFile = ProjectManagementService.getPluginXMLFile(project); MarkersService.createMarker( pluginXMLFile, ElementTypesPluginValidationConstants.ELEMENTTYPES_PLUGIN_VALIDATION_TYPE, "The extension point '" + ElementTypesPluginValidationConstants.ELEMENTTYPES_EXTENSION_POINT_IDENTIFIER + "' should be created for profile '" + elementTypesFile.getName() + "'", IMarker.SEVERITY_ERROR); } if (null != monitor) { monitor.worked(1); } }
Source:
<code>public HashMap<ItemStack, ItemStack> getDustingList() { <START> return dustingList; <END> }</code><technical_language>returning original dustingList, please return a copy of list, private for a reason, if NEI other mod for some reason removes form list break stuff</technical_language>

Target:
public HashMap<ItemStack, ItemStack> getDustingList() { return (HashMap<ItemStack, ItemStack>) dustingList.clone(); }
Source:
<code>public void testDeleteFeedbackResponseCommentById() throws Exception { FeedbackResponseCommentAttributes frComment = restoreFrCommentFromDataBundle("comment1FromT1C1ToR1Q1S1C1"); frComment.setId(1L); frComment.feedbackQuestionId = getQuestionIdInDataBundle("qn2InSession1InCourse1"); <START> frComment.feedbackResponseId = getResponseIdInDataBundle("response2ForQ2S1C1", "qn2InSession1InCourse1"); <END> frcLogic.createFeedbackResponseComment(frComment); ______TS("silent fail nothing to delete"); frComment.feedbackResponseId = "invalid responseId"; frcLogic.deleteFeedbackResponseCommentById(frComment.getId()); FeedbackResponseCommentAttributes actualFrComment = frcLogic.getFeedbackResponseCommentForSession( frComment.courseId, frComment.feedbackSessionName).get(1); verifyPresentInDatastore(actualFrComment); ______TS("typical success case"); frcLogic.deleteFeedbackResponseCommentById(actualFrComment.getId()); verifyAbsentInDatastore(actualFrComment); ______TS("typical success case for response"); FeedbackResponseCommentAttributes anotherFrComment = restoreFrCommentFromDataBundle("comment1FromT1C1ToR1Q3S1C1"); verifyPresentInDatastore(anotherFrComment); frcLogic.deleteFeedbackResponseCommentsForResponse(anotherFrComment.feedbackResponseId); verifyAbsentInDatastore(anotherFrComment); }</code><technical_language>I need L270 - L272</technical_language>

Target:
public void testDeleteFeedbackResponseCommentById() throws Exception { ______TS("silent fail nothing to delete"); assertNull(frcLogic.getFeedbackResponseComment(1234567L)); frcLogic.deleteFeedbackResponseCommentById(1234567L); ______TS("typical success case"); FeedbackResponseCommentAttributes frComment = restoreFrCommentFromDataBundle("comment1FromT1C1ToR1Q1S1C1"); FeedbackResponseCommentAttributes actualFrComment = frcLogic.getFeedbackResponseCommentForSession( frComment.courseId, frComment.feedbackSessionName).get(1); frcLogic.deleteFeedbackResponseCommentById(actualFrComment.getId()); verifyAbsentInDatastore(actualFrComment); }
Source:
<code>public boolean canOnlyUseSelf() { <START> return fastEquip; <END> }</code><technical_language>This is supposed a getter for fields. for subclasses define items behavior</technical_language>

Target:
public boolean canOnlyUseSelf() { return false; }
Source:
<code>private static boolean failureCategoryMatches(String category, List<String> slackFailureCauseCategories) { <START> for (int i = 0; i < slackFailureCauseCategories.size(); i++) { <END> if (category.trim().equalsIgnoreCase(slackFailureCauseCategories.get(i).trim())) { return true; } } return false; }</code><technical_language>suggestion for (String slackCategory : slackFailureCauseCategories) {</technical_language>

Target:
private static boolean failureCategoryMatches(String category, List<String> slackFailureCauseCategories) { for (String slackCategory : slackFailureCauseCategories) { if (category.trim().equalsIgnoreCase(slackCategory.trim())) { return true; } } return false; }
Source:
<code>public boolean isEmpty() { int e = isEmpty; if (e == 0) { int s = size; <START> boolean any = s != 0 ? s > 1 : validIndices().findAny().isPresent(); <END> e = any ? 1 : -1; this.isEmpty = e; } return e < 0; }</code><technical_language>I suspect if worried performance, looping double[] calling isValidPoint quicker more weighty stream system. Also, expect size() constructors set isEmpty</technical_language>

Target:
public boolean isEmpty() { int e = isEmpty; if (e == 0) { e = calculateIsEmpty(); } return e < 0; }
Source:
<code>public static String jsonExtract(JsonValueContext input, String... pathSpecs) { try { DocumentContext ctx = JsonPath.parse(input.obj, Configuration .builder() .options(Option.SUPPRESS_EXCEPTIONS) .jsonProvider(JSON_PATH_JSON_PROVIDER) .mappingProvider(JSON_PATH_MAPPING_PROVIDER) .build()); List<Object> arrayList = new ArrayList<Object>(); Object value; for (String pathSpec : pathSpecs) { value = ctx.read(pathSpec); if ((pathSpec != null) && (value != null)) { <START> arrayList.add(value); <END> } } return arrayList.size() > 0 ? pathSpecs.length == 1 ? jsonize(arrayList.get(0)) : jsonize(arrayList) : null; } catch (Exception ex) { throw RESOURCE.invalidInputForJsonExtract( input.toString(), Arrays.toString(pathSpecs)).ex(); } }</code><technical_language>parentheses is necessary in (pathSpec != null) && (value != null)</technical_language>

Target:
public static String jsonExtract(JsonValueContext input, String... pathSpecs) { try { DocumentContext ctx = JsonPath.parse(input.obj, Configuration .builder() .options(Option.SUPPRESS_EXCEPTIONS) .jsonProvider(JSON_PATH_JSON_PROVIDER) .mappingProvider(JSON_PATH_MAPPING_PROVIDER) .build()); List<Object> arrayList = new ArrayList<Object>(); Object value; for (String pathSpec : pathSpecs) { value = ctx.read(pathSpec); if (pathSpec != null && value != null) { arrayList.add(value); } } return arrayList.size() > 0 ? pathSpecs.length == 1 ? jsonize(arrayList.get(0)) : jsonize(arrayList) : null; } catch (Exception ex) { throw RESOURCE.invalidInputForJsonExtract( input.toString(), Arrays.toString(pathSpecs)).ex(); } }
Source:
<code>public double getValue(Object entity) { <START> switch (op) { <END> case "+": return left.getValue(entity) + right.getValue(entity); case "-": return left.getValue(entity) - right.getValue(entity); case "*": return left.getValue(entity) * right.getValue(entity); case "/": return left.getValue(entity) / right.getValue(entity); case "%": return left.getValue(entity) % right.getValue(entity); case "=": return asDouble(left.getValue(entity) == right.getValue(entity)); case ">": return asDouble(left.getValue(entity) > right.getValue(entity)); case "<": return asDouble(left.getValue(entity) < right.getValue(entity)); case "<=": return asDouble(left.getValue(entity) <= right.getValue(entity)); case ">=": return asDouble(left.getValue(entity) >= right.getValue(entity)); case "!=": return asDouble(left.getValue(entity) != right.getValue(entity)); default: throw new IllegalArgumentException("Unknown operator: " + op); } }</code><technical_language>call crazy, supporting bit operations useful here. wanted bit wise operations for eons in wavefront do true flags 0000 0001 0010...etc. I fathom a reason for (unless wanted bit operations determine tag sample a metric...buuuut a thought)</technical_language>

Target:
public double getValue(Object entity) { switch (op) { case "and": return asDouble(isTrue(left.getValue(entity)) && isTrue(right.getValue(entity))); case "or": return asDouble(isTrue(left.getValue(entity)) || isTrue(right.getValue(entity))); case "+": return left.getValue(entity) + right.getValue(entity); case "-": return left.getValue(entity) - right.getValue(entity); case "*": return left.getValue(entity) * right.getValue(entity); case "/": return left.getValue(entity) / right.getValue(entity); case "%": return left.getValue(entity) % right.getValue(entity); case "=": return asDouble(left.getValue(entity) == right.getValue(entity)); case ">": return asDouble(left.getValue(entity) > right.getValue(entity)); case "<": return asDouble(left.getValue(entity) < right.getValue(entity)); case "<=": return asDouble(left.getValue(entity) <= right.getValue(entity)); case ">=": return asDouble(left.getValue(entity) >= right.getValue(entity)); case "!=": return asDouble(left.getValue(entity) != right.getValue(entity)); case "&": return (long) left.getValue(entity) & (long) right.getValue(entity); case "|": return (long) left.getValue(entity) | (long) right.getValue(entity); case "^": return (long) left.getValue(entity) ^ (long) right.getValue(entity); case ">>": return (long) left.getValue(entity) >> (long) right.getValue(entity); case ">>>": return (long) left.getValue(entity) >>> (long) right.getValue(entity); case "<<": case "<<<": return (long) left.getValue(entity) << (long) right.getValue(entity); default: throw new IllegalArgumentException("Unknown operator: " + op); } }
Source:
<code>private Flux<Instant> renewMessageLock(UUID[] renewLockList) { return isAuthorized(PEEK_OPERATION_VALUE).thenMany(createRequestResponse.flatMap(channel -> { UUID[] lockTokens = Arrays.stream(renewLockList) .toArray(UUID[]::new); <START> Message requestMessage = createManagementMessage(REQUEST_RESPONSE_RENEWLOCK_OPERATION, <END> channel.getReceiveLinkName()); requestMessage.setBody(new AmqpValue(Collections.singletonMap(REQUEST_RESPONSE_LOCKTOKENS, lockTokens))); return channel.sendWithAck(requestMessage); }).flatMapMany(responseMessage -> { int statusCode = RequestResponseUtils.getResponseStatusCode(responseMessage); List<Instant> expirationsForLocks = new ArrayList<>(); if (statusCode == REQUEST_RESPONSE_OK_STATUS_CODE) { @SuppressWarnings("unchecked") Map<String, Object> responseBody = (Map<String, Object>) ((AmqpValue) responseMessage .getBody()).getValue(); Object expirationListObj = responseBody.get(REQUEST_RESPONSE_EXPIRATIONS); if (expirationListObj instanceof Date[]) { Date[] expirations = (Date[]) expirationListObj; expirationsForLocks = Arrays.stream(expirations) .map(Date::toInstant) .collect(Collectors.toList()); } } return Flux.fromIterable(expirationsForLocks); })); }</code><technical_language>REQUEST_RESPONSE_RENEWLOCK_OPERATION -> REQUEST_RESPONSE_RENEW_LOCK_OPERATION</technical_language>

Target:
private Flux<Instant> renewMessageLock(UUID[] renewLockList) { return isAuthorized(PEEK_OPERATION_VALUE).thenMany(createRequestResponse.flatMap(channel -> { Message requestMessage = createManagementMessage(RENEW_LOCK_OPERATION, channel.getReceiveLinkName()); requestMessage.setBody(new AmqpValue(Collections.singletonMap(LOCK_TOKENS, renewLockList))); return channel.sendWithAck(requestMessage); }).flatMapMany(responseMessage -> { int statusCode = RequestResponseUtils.getResponseStatusCode(responseMessage); if (statusCode != AmqpResponseCode.OK.getValue()) { return Mono.error(ExceptionUtil.amqpResponseCodeToException(statusCode, "Could not renew the lock.", getErrorContext())); } return Flux.fromIterable(messageSerializer.deserializeList(responseMessage, Instant.class)); })); }
Source:
<code>public void setUnits(String xunit, String yunit) { xunits = xunit; yunits = yunit; plotPreferences.setXlabel(xunit); plotPreferences.setYlabel(yunit); <START> refresh(); <END> }</code><technical_language>iterate of segment layers in map set units, refresh. segment end re-serialized, is super expensive especially for larger segments</technical_language>

Target:
public void setUnits(String xunit, String yunit) { xunits = xunit; yunits = yunit; plotPreferences.setXlabel(xunit); plotPreferences.setYlabel(yunit); for (SegmentLayer seg : segmentPreferences.values()) { try { seg.setXUnits(xunits); seg.setYUnits(yunits); } catch (UnitsException ex) { Logger.getLogger(SedPreferences.class.getName()) .log(Level.SEVERE, null, ex); } } flipYifMag(yunit); }
Source:
<code>public static org.kframework.definition.Definition from(String definitionText) throws IOException { <START> Pattern pattern = Pattern.compile("module ([A-Z_]*)"); <END> Matcher m = pattern.matcher(definitionText); if(!m.find()) { throw new RuntimeException("Could not find any module in the definition"); } String nameOfLastModule = m.group(m.groupCount()); return from(definitionText, nameOfLastModule, Source.apply("generated")); }</code><technical_language>What? parsers for this... This is error prone. This needs fixing</technical_language>

Target:
public static org.kframework.definition.Definition from(String definitionText) { Pattern pattern = Pattern.compile("(?:^|\\s)module ([A-Z][A-Z\\-]*)"); Matcher m = pattern.matcher(definitionText); if(!m.find()) { throw new RuntimeException("Could not find any module in the definition"); } String nameOfLastModule = m.group(m.groupCount()); return from(definitionText, nameOfLastModule, Source.apply("generated")); }
Source:
<code>public boolean hasNext() { <START> return replicaIterator.hasNext() && (inflightCount < parallelism || ( <END> inflightCount < routerConfig.routerAdaptiveTrackerMaxInflightRequests && isOldestRequestPastDue())); }</code><technical_language>more readable break this multiple if statements: java if (replicaIterator.hasNext()) { if (inflightCount < parallelism) { return true; } if (inflightCount < routerConfig.routerAdaptiveTrackerMaxInflightRequests && isOldestRequestPastDue()) { return true; } } return false; personal preference,</technical_language>

Target:
public boolean hasNext() { if (replicaIterator.hasNext()) { if (inflightCount < parallelism) { return true; } if (inflightCount < routerConfig.routerOperationTrackerMaxInflightRequests && isOldestRequestPastDue()) { return true; } } return false; }
Source:
<code>public CallStatus run() { RequestMetrics.Context metricCtx = metrics.startBulkRequest(); LOGGER.debug("bulk request"); Error.reset(); Error.push("rest"); Error.push(getClass().getSimpleName()); try { BulkRequest req; try { req = getJsonTranslator().parse(BulkRequest.class, JsonUtils.json(request)); } catch (Exception e) { metricCtx.markRequestException(e, e.getMessage()); LOGGER.error("bulk:parse failure: {}", e); <START> return new CallStatus(Error.get(RestCrudConstants.ERR_REST_ERROR, "Error parsing request")); <END> } try { for (Request r : req.getEntries()) { validateReq(r, r.getEntityVersion().getEntity(), r.getEntityVersion().getVersion()); addCallerId(r); } } catch (Exception e) { metricCtx.markRequestException(e, e.getMessage()); LOGGER.error("bulk:validate failure: {}", e); return new CallStatus(Error.get(RestCrudConstants.ERR_REST_ERROR, "Request is not valid")); } BulkResponse r = getMediator().bulkRequest(req, metrics); return new CallStatus(r); } catch (Error e) { metricCtx.markRequestException(e, e.getErrorCode()); LOGGER.error("bulk:generic_error failure: {}", e); return new CallStatus(e); } catch (Exception e) { metricCtx.markRequestException(e, e.getMessage()); LOGGER.error("bulk:generic_exception failure: {}", e); return new CallStatus(Error.get(RestCrudConstants.ERR_REST_ERROR, e.toString())); } finally { metricCtx.endRequestMonitoring(); } }</code><technical_language>for I Error type returned Error.get(RestCrudConstants.ERR_REST_ERROR, "Error parsing request")</technical_language>

Target:
public CallStatus run() { RequestMetrics.Context metricCtx = metrics.startBulkRequest(); LOGGER.debug("bulk request"); Error.reset(); Error.push("rest"); Error.push(getClass().getSimpleName()); try { BulkRequest req; try { req = getJsonTranslator().parse(BulkRequest.class, JsonUtils.json(request)); } catch (Exception e) { Error error = Error.get(RestCrudConstants.ERR_REST_ERROR, "Error parsing request"); metricCtx.markRequestException(error); LOGGER.error("bulk:parse failure: {}", e); return new CallStatus(error); } try { for (Request r : req.getEntries()) { validateReq(r, r.getEntityVersion().getEntity(), r.getEntityVersion().getVersion()); addCallerId(r); } } catch (Exception e) { Error error = Error.get(RestCrudConstants.ERR_REST_ERROR, "Request is not valid"); metricCtx.markRequestException(error); LOGGER.error("bulk:validate failure: {}", e); return new CallStatus(error); } BulkResponse r = getMediator().bulkRequest(req, metrics); return new CallStatus(r); } catch (Error e) { metricCtx.markRequestException(e); LOGGER.error("bulk:generic_error failure: {}", e); return new CallStatus(e); } catch (Exception e) { Error error = Error.get(RestCrudConstants.ERR_REST_ERROR, e.toString()); metricCtx.markRequestException(error); LOGGER.error("bulk:generic_exception failure: {}", e); return new CallStatus(error); } finally { metricCtx.endRequestMonitoring(); } }
Source:
<code>public void testConvertMultInstanceSubprocessNode_SlaDueDate() { final String SLA_DUE_DATE = "12/25/1983"; SubProcess subProcess = bpmn2.createSubProcess(); MultiInstanceLoopCharacteristics loopCharacteristics = bpmn2.createMultiInstanceLoopCharacteristics(); subProcess.setLoopCharacteristics(loopCharacteristics); subProcess.setId(UUID.randomUUID().toString()); CustomElement.slaDueDate.setValue(subProcess, SLA_DUE_DATE); Result<BpmnNode> result = tested.convertSubProcess(subProcess); BpmnNode node = result.value(); <START> MultipleInstanceSubprocess miSubProcces = (MultipleInstanceSubprocess) node.value().getContent().getDefinition(); <END> assertNotNull(miSubProcces); assertNotNull(miSubProcces.getExecutionSet()); MultipleInstanceSubprocessTaskExecutionSet executionSet = miSubProcces.getExecutionSet(); SLADueDate slaDueDate = executionSet.getSlaDueDate(); assertNotNull(slaDueDate); assertTrue(slaDueDate.getValue().contains(SLA_DUE_DATE)); }</code><technical_language>suggestion MultipleInstanceSubprocess miSubProcess = (MultipleInstanceSubprocess) node.value().getContent().getDefinition();</technical_language>

Target:
public void testConvertMultInstanceSubprocessNode_SlaDueDate() { SubProcess subProcess = bpmn2.createSubProcess(); subProcess.setLoopCharacteristics(bpmn2.createMultiInstanceLoopCharacteristics()); CustomElement.slaDueDate.setValue(subProcess, SLA_DUE_DATE); Result<BpmnNode> result = tested.convertSubProcess(subProcess); BpmnNode node = result.value(); MultipleInstanceSubprocess miSubProcess = (MultipleInstanceSubprocess) node.value().getContent().getDefinition(); assertNotNull(miSubProcess); assertBaseSubprocessExecutionSet(miSubProcess.getExecutionSet()); }