auphong2707/dl4se-code-review-dataset huggingface dataset:
Source:
<code>protected void readFromParcel(Parcel in) { super.readFromParcel(in); genericIntField1 = readInteger(in); genericLongField1 = readLong(in); genericStringField1 = readString(in); genericStringField2 = readString(in); <START> genericBooleanField1 = ParcelCompat.readBoolean(in); <END> genericDoubleField1 = readDouble(in); }</code><technical_language>compatible write method. Revert this too</technical_language>

Target:
protected void readFromParcel(Parcel in) { super.readFromParcel(in); genericIntField1 = readInteger(in); genericLongField1 = readLong(in); genericStringField1 = readString(in); genericStringField2 = readString(in); genericBooleanField1 = readBoolean(in); genericDoubleField1 = readDouble(in); }
Source:
<code>private CompletableFuture<Void> visitReadCommand(InvocationContext ctx, FlagAffectedCommand command, Consumer<ConsistentHash> consistentHashUpdater) throws Throwable { if (isLocalOnly(command)) { return ctx.continueInvocation(); } CacheTopology beginTopology = stateTransferManager.getCacheTopology(); consistentHashUpdater.accept(beginTopology.getReadConsistentHash()); updateTopologyId(command); Object returnValue; try { <START> returnValue = ctx.forkInvocationSync(command); <END> } catch (CacheException e) { Throwable ce = e; while (ce instanceof RemoteException) { ce = ce.getCause(); } if (!(ce instanceof OutdatedTopologyException) && !(ce instanceof SuspectException)) throw e; if (trace) log.tracef("Retrying command because of topology change, current topology is %d: %s", currentTopologyId(), command); int newTopologyId = Math.max(currentTopologyId(), command.getTopologyId() + 1); command.setTopologyId(newTopologyId); waitForTopology(newTopologyId); return visitReadCommand(ctx, command, consistentHashUpdater); } return ctx.shortCircuit(returnValue); }</code><technical_language>ctx.shortCircuit(ctx.forkInvocationSync(command)); consistent others thousands :)</technical_language>

Target:
private CompletableFuture<Void> visitReadCommand(InvocationContext ctx, FlagAffectedCommand command, Consumer<ConsistentHash> consistentHashUpdater) throws Throwable { if (isLocalOnly(command)) { return ctx.continueInvocation(); } CacheTopology beginTopology = stateTransferManager.getCacheTopology(); consistentHashUpdater.accept(beginTopology.getReadConsistentHash()); updateTopologyId(command); try { return ctx.shortCircuit(ctx.forkInvocationSync(command)); } catch (CacheException e) { Throwable ce = e; while (ce instanceof RemoteException) { ce = ce.getCause(); } if (!(ce instanceof OutdatedTopologyException) && !(ce instanceof SuspectException)) throw e; if (trace) log.tracef("Retrying command because of topology change, current topology is %d: %s", currentTopologyId(), command); int newTopologyId = Math.max(currentTopologyId(), command.getTopologyId() + 1); command.setTopologyId(newTopologyId); waitForTopology(newTopologyId); return visitReadCommand(ctx, command, consistentHashUpdater); } }
Source:
<code>abstract protected void notifyListener(RunListener each) throws Exception; } public void fireTestRunStarted(final Description description) { <START> loadListeners(); <END> new SafeNotifier() { @Override protected void notifyListener(RunListener each) throws Exception { each.testRunStarted(description); } }.run(); }</code><technical_language>calls fireTestRunStarted() multiple times, in case does, call loadListeners() time fireTestRunStarted() is called</technical_language>

Target:
abstract protected void notifyListener(RunListener each) throws Exception; } public void fireTestRunStarted(final Description description) { new SafeNotifier() { @Override protected void notifyListener(RunListener each) throws Exception { each.testRunStarted(description); } }.run(); }
Source:
<code>private Map<K, V> getAllInternal(Set<? extends K> keys, boolean includeNulls) throws BulkCacheLoadingException { getAllObserver.begin(); statusTransitioner.checkAvailable(); checkNonNullContent(keys); if(keys.isEmpty()) { getAllObserver.end(GetAllOutcome.SUCCESS); return Collections.emptyMap(); } <START> GetAllFunction<K, V> getAllFunction = new GetAllFunction<K, V>(); <END> Map<K, V> result = new HashMap<K, V>(); try { Map<K, Store.ValueHolder<V>> computedMap = store.bulkComputeIfAbsent(keys, getAllFunction); int hits = 0; int keyCount = 0; for (Map.Entry<K, Store.ValueHolder<V>> entry : computedMap.entrySet()) { keyCount++; if (entry.getValue() != null) { result.put(entry.getKey(), entry.getValue().value()); hits++; } else if (includeNulls) { result.put(entry.getKey(), null); } } addBulkMethodEntriesCount(BulkOps.GET_ALL_HITS, hits); addBulkMethodEntriesCount(BulkOps.GET_ALL_MISS, keyCount - hits); getAllObserver.end(GetAllOutcome.SUCCESS); return result; } catch (StoreAccessException e) { try { return resilienceStrategy.getAllFailure(keys, e); } finally { getAllObserver.end(GetAllOutcome.FAILURE); } } }</code><technical_language>I bother a variable, pass new GetAllFunction<K, V>() bulkComputeIfAbsent. code tad cleaner</technical_language>

Target:
private Map<K, V> getAllInternal(Set<? extends K> keys, boolean includeNulls) throws BulkCacheLoadingException { getAllObserver.begin(); statusTransitioner.checkAvailable(); checkNonNullContent(keys); if(keys.isEmpty()) { getAllObserver.end(GetAllOutcome.SUCCESS); return Collections.emptyMap(); } Map<K, V> result = new HashMap<K, V>(); try { Map<K, Store.ValueHolder<V>> computedMap = store.bulkComputeIfAbsent(keys, new GetAllFunction<K, V>()); int hits = 0; int keyCount = 0; for (Map.Entry<K, Store.ValueHolder<V>> entry : computedMap.entrySet()) { keyCount++; if (entry.getValue() != null) { result.put(entry.getKey(), entry.getValue().value()); hits++; } else if (includeNulls) { result.put(entry.getKey(), null); } } addBulkMethodEntriesCount(BulkOps.GET_ALL_HITS, hits); addBulkMethodEntriesCount(BulkOps.GET_ALL_MISS, keyCount - hits); getAllObserver.end(GetAllOutcome.SUCCESS); return result; } catch (StoreAccessException e) { try { return resilienceStrategy.getAllFailure(keys, e); } finally { getAllObserver.end(GetAllOutcome.FAILURE); } } }
Source:
<code><START> public ConfigFormat getSyntax() { <END> return syntax; }</code><technical_language>this ABI change restrict patch a major version bump unclear want break API in case... add a getFormat() getSyntax working long current format is a syntax. put a deprecated annotation get/setSyntax</technical_language>

Target:
public ConfigSyntax getSyntax() { ConfigFormat format = getFormat(); if(format instanceof ConfigSyntax) { return (ConfigSyntax)format; } return null; }
Source:
<code>public void setProgress(float progress, boolean immediate) { <START> if (mFadeDrawable.getDrawable(PROGRESS_BAR_IMAGE_INDEX) != null) { <END> mFadeDrawable.beginBatchMode(); setProgress(progress); if (immediate) { mFadeDrawable.finishTransitionImmediately(); } mFadeDrawable.endBatchMode(); } }</code><technical_language>This is purely a do in setProgress(float) early return if drawable is null surrounding remainder of method in if block</technical_language>

Target:
public void setProgress(float progress, boolean immediate) { if (mFadeDrawable.getDrawable(PROGRESS_BAR_IMAGE_INDEX) == null) { return; } mFadeDrawable.beginBatchMode(); setProgress(progress); if (immediate) { mFadeDrawable.finishTransitionImmediately(); } mFadeDrawable.endBatchMode(); }
Source:
<code>private void updateFeatureGroupSum(ArtifactReadable item, TreeMap<String, FeatureGroupSum> featureSums, double points) { ArtifactReadable featureGroup = item.getRelated(AtsRelationTypes.AgileFeatureToItem_FeatureGroup).getExactlyOne(); FeatureGroupSum feature = featureSums.get(featureGroup.getName()); if (feature == null) { feature = new FeatureGroupSum(featureGroup.getName(), featureGroup.getSoleAttributeAsString(AtsAttributeTypes.Description, "")); <START> feature.addToSum(points); } else { feature.addToSum(points); } <END> featureSums.put(featureGroup.getName(), feature); }</code><technical_language>Suggest this: if (feature == null) { //create feature } feature.addToSum(points); Consolidating addToSum call</technical_language>

Target:
private void updateFeatureGroupSum(ArtifactReadable item, TreeMap<String, FeatureGroupSum> featureSums, double points) { ArtifactReadable featureGroup = item.getRelated(AtsRelationTypes.AgileFeatureToItem_FeatureGroup).getExactlyOne(); FeatureGroupSum feature = featureSums.get(featureGroup.getName()); if (feature == null) { feature = new FeatureGroupSum(featureGroup.getName(), featureGroup.getSoleAttributeAsString(AtsAttributeTypes.Description, "")); } feature.addToSum(points); featureSums.put(featureGroup.getName(), feature); }
Source:
<code><START> public static boolean isNonVmNonVlanNetwork(Network network) { <END> return !network.isVmNetwork() && network.getVlanId() == null; }</code><technical_language>IMO new function "isVlan" called is code verify if network is a Vlan, code check files lines: AttachNetworkToVdsInterfaceCommand (226) OpenstackNetworkProviderProxy (73) NetworkValidator (89)</technical_language>

Target:
public static boolean isNonVmNonVlanNetwork(Network network) { return !network.isVmNetwork() && !isVlan(network); }
Source:
<code><START> private char[] getSigningKeyPassphrase(char[] signingKeyPassphrase) throws AliasServiceException { <END> return (signingKeyPassphrase != null) ? signingKeyPassphrase : cachedSigningKeyPassphrase; }</code><technical_language>longer throws AliasServiceException</technical_language>

Target:
private char[] getSigningKeyPassphrase(char[] signingKeyPassphrase) { return (signingKeyPassphrase != null) ? signingKeyPassphrase : cachedSigningKeyPassphrase; }
Source:
<code>public final boolean shouldTraverse(NodeTraversal nodeTraversal, Node n, Node parent) { if (isDone()) { return false; } if (n.isScript() || n.isModuleBody()) { return true; } int line = n.getLineno(); if (getLastLineOfCurrentComment() > line) { return true; } boolean outputCommentAfterLine = false; while (hasRemainingComments() && !isCommentAdjacentToLine(line)) { if (getLastLineOfCurrentComment() > line) { return true; } if (getFirstLineOfNextComment() - getLastLineOfCurrentComment() > 1) { outputFloatingCommentFromBuffer(n); } addNextCommentToBuffer(); outputCommentAfterLine = true; } if (getLastLineOfCurrentComment() == line) { <START> if (parent.isCall()) { <END> if (n.getNext() == null) { linkCommentBufferToNode(n); } else { int endOfComment = getCurrentComment().location.end.column; int startOfNextNode = n.getNext().getCharno(); if (endOfComment < startOfNextNode) { String lineContents = compiler .getInput(new InputId(n.getSourceFileName())) .getSourceFile() .getLine(line); String interval = lineContents.substring(endOfComment, startOfNextNode); if (interval.contains(",")) { linkCommentBufferToNode(n); } else { linkCommentBufferToNode(n.getNext()); } } else { return true; } } } else if (getCurrentComment().location.end.column < n.getCharno()) { linkCommentBufferToNode(n); } else { return true; } } else if (getLastLineOfCurrentComment() == line - 1) { linkCommentBufferToNode(n); } else if (!hasRemainingComments() && !outputCommentAfterLine) { outputFloatingCommentFromBuffer(n); } if (!outputCommentAfterLine) { addNextCommentToBuffer(); } return true; }</code><technical_language>extract a new method - "linkFunctionArgs"</technical_language>

Target:
public final boolean shouldTraverse(NodeTraversal nodeTraversal, Node n, Node parent) { if (isDone()) { return false; } if (n.isScript() || n.isModuleBody()) { return true; } int line = n.getLineno(); if (getLastLineOfCurrentComment() > line) { return true; } boolean outputCommentAfterLine = false; while (hasRemainingComments() && !isCommentAdjacentToLine(line)) { if (getLastLineOfCurrentComment() > line) { return true; } if (getFirstLineOfNextComment() - getLastLineOfCurrentComment() > 1) { outputFloatingCommentFromBuffer(n); } addNextCommentToBuffer(); outputCommentAfterLine = true; } if (getLastLineOfCurrentComment() == line) { if (parent.isCall()) { if (linkFunctionArgs(n, line)) return true; } else if (getCurrentComment().location.end.column < n.getCharno()) { linkCommentBufferToNode(n); } else { return true; } } else if (getLastLineOfCurrentComment() == line - 1) { linkCommentBufferToNode(n); } else if (!hasRemainingComments() && !outputCommentAfterLine) { outputFloatingCommentFromBuffer(n); } if (!outputCommentAfterLine) { addNextCommentToBuffer(); } return true; }
Source:
<code>public void newInstanceBis() throws IllegalAccessException, InstantiationException { try { if (constructor == null) { this.setDynaBeanClass(); } return ((DynaBean) constructor.newInstance(constructorValues)); } catch (final InvocationTargetException e) { throw new InstantiationException (e.getTargetException().getMessage()); } <START> } <END></code><technical_language>This test case overcomplicated. is necessary removed : (generics, try catch, etc)</technical_language>

Target:
public void newInstanceBis() throws IllegalAccessException, InstantiationException { if (constructor == null) { this.setDynaBeanClass(); } return ((DynaBean) constructor.newInstance(constructorValues)); }
Source:
<code>private void updateDetailMetric(final CollectArraysVariantCallingMetrics.ArraysVariantCallingDetailMetrics metric, final Genotype genotype, final VariantContext vc, final boolean hasSingletonSample) { <START> if (!vc.getCommonInfo().getFilters().contains(InfiniumVcfFields.ZEROED_OUT_ASSAY)) { <END> metric.TOTAL_ASSAYS++; if (genotype.isCalled()) { metric.NUM_CALLS++; String gtA = (String) genotype.getExtendedAttribute(InfiniumVcfFields.GTA, genotype.getGenotypeString()); if (!gtA.equals(VCFConstants.EMPTY_GENOTYPE)) { metric.NUM_AUTOCALL_CALLS++; } } else { metric.NUM_NO_CALLS++; } if (hasSingletonSample) { ++metric.NUM_SINGLETONS; } if (vc.isSNP()) { final boolean isInDbSnp = dbsnp.snps.isDbSnpSite(vc.getContig(), vc.getStart()); metric.TOTAL_SNPS++; if (isInDbSnp) { metric.NUM_IN_DB_SNP++; } } else if (vc.isIndel()) { metric.TOTAL_INDELS++; } } if (vc.isFiltered()) { metric.FILTERED_SNPS++; } if (genotype != null && !vc.isFiltered()) { if (genotype.isHet()) { metric.numHets++; } else if (genotype.isHomVar()) { metric.numHomVar++; } } }</code><technical_language>keeping track of number of zeroed-out / unusable sites in arrays a metric</technical_language>

Target:
private void updateDetailMetric(final CollectArraysVariantCallingMetrics.ArraysVariantCallingDetailMetrics metric, final Genotype genotype, final VariantContext vc, final boolean hasSingletonSample) { metric.NUM_ASSAYS++; if (!vc.isFiltered() || vc.getCommonInfo().getFilters().contains(InfiniumVcfFields.DUPE)) { metric.NUM_NON_FILTERED_ASSAYS++; if (genotype.isCalled()) { metric.NUM_CALLS++; String gtA = (String) genotype.getExtendedAttribute(InfiniumVcfFields.GTA, genotype.getGenotypeString()); if (!gtA.equals(VCFConstants.EMPTY_GENOTYPE)) { metric.NUM_AUTOCALL_CALLS++; } } else { metric.NUM_NO_CALLS++; } if (vc.isSNP()) { final boolean isInDbSnp = dbsnp.snps.isDbSnpSite(vc.getContig(), vc.getStart()); metric.NUM_SNPS++; if (isInDbSnp) { metric.NUM_IN_DB_SNP++; } } else if (vc.isIndel()) { metric.NUM_INDELS++; } if (hasSingletonSample) { metric.NUM_SINGLETONS++; } if (genotype.isHet()) { metric.numHets++; } else if (genotype.isHomVar()) { metric.numHomVar++; } } else { metric.NUM_FILTERED_ASSAYS++; if (vc.getCommonInfo().getFilters().contains(InfiniumVcfFields.ZEROED_OUT_ASSAY)) { metric.NUM_ZEROED_OUT_ASSAYS++; } } }
Source:
<code>public void testCardinalityNullArray() { <START> String projection = "cardinality(merge_hll(ARRAY[null, null, null]))"; <END> assertFunction(projection, BIGINT, null); }</code><technical_language>inline Strings function for readability</technical_language>

Target:
public void testCardinalityNullArray() { assertFunction("cardinality(merge_hll(null))", BIGINT, null); }
Source:
<code>public static Date parse(String value) throws ParseException { if(StringUtils.isEmpty(value)) { <START> throw new ParseException("Unparseable date: \"" + value + "\"", 0); <END> } String modValue = value.substring(0, value.length()-1) + "GMT-00:00"; SimpleDateFormat parser = new SimpleDateFormat("yyyy-MM-dd'T'HH:mm:ssz"); return parser.parse(modValue); }</code><technical_language>explicitly date provided. If empty, is significant add in exception</technical_language>

Target:
public static Date parse(String value) throws ParseException { if(StringUtils.isEmpty(value)) { throw new ParseException("Date is not provided", 0); } String modValue = value.substring(0, value.length()-1) + "GMT-00:00"; SimpleDateFormat parser = new SimpleDateFormat("yyyy-MM-dd'T'HH:mm:ssz"); return parser.parse(modValue); }
Source:
<code>public Map<String, String> getGiverEmailToGiverNameMap() { Map<String, String> giverEmailToGiverNameMap = new HashMap<String, String>(); for (String giverEmail : comments.keySet()) { InstructorAttributes instructor = roster.getInstructorForEmail(giverEmail); <START> String giverDisplay = giverEmail; <END> if (giverEmail.equals(InstructorCommentsPageData.COMMENT_GIVER_NAME_THAT_COMES_FIRST)) { giverDisplay = "You"; } else if (instructor != null) { String title = instructor.displayedName; giverDisplay = title + " " + instructor.name; } giverEmailToGiverNameMap.put(giverEmail, giverDisplay); } return giverEmailToGiverNameMap; }</code><technical_language>This method called if refer giverEmailToGiverNameMap frontend, returning storing in variable in constructor rendered pointless. want set variable a separate method instead this purely for (for frontend)</technical_language>

Target:
private Map<String, String> getGiverEmailToGiverNameMap() { Map<String, String> giverEmailToGiverNameMap = new HashMap<String, String>(); for (String giverEmail : comments.keySet()) { InstructorAttributes instructor = roster.getInstructorForEmail(giverEmail); String giverDisplay = giverEmail; if (giverEmail.equals(InstructorCommentsPageData.COMMENT_GIVER_NAME_THAT_COMES_FIRST)) { giverDisplay = "You"; } else if (instructor != null) { String title = instructor.displayedName; giverDisplay = title + " " + instructor.name; } giverEmailToGiverNameMap.put(giverEmail, giverDisplay); } return giverEmailToGiverNameMap; }
Source:
<code>public PerfConfig(VerifiableProperties verifiableProperties) { perfBlobSize = verifiableProperties.getLong("perf.blob.size", 10485760); perfUserMetadataSize = verifiableProperties.getIntInRange("perf.user.metadata.size", 1024, 0, 81920); perfNioServerChunkSize = verifiableProperties.getIntInRange("perf.nio.server.chunk.size", 8192, 1, 10485760); <START> perfNioServerConcurrency = verifiableProperties.getInt("perf.nio.server.concurrency", 1); <END> perfRequestRestMethod = RestMethod .valueOf(verifiableProperties.getString("perf.request.rest.method", RestMethod.GET.toString()).toUpperCase()); perfRouterChunkSize = verifiableProperties.getIntInRange("perf.router.chunk.size", 1048576, 1, 10485760); }</code><technical_language>A range necessary for concurrency</technical_language>

Target:
public PerfConfig(VerifiableProperties verifiableProperties) { perfBlobSize = verifiableProperties.getLong("perf.blob.size", 10485760); perfUserMetadataSize = verifiableProperties.getIntInRange("perf.user.metadata.size", 1024, 0, 81920); perfNioServerChunkSize = verifiableProperties.getIntInRange("perf.nio.server.chunk.size", 8192, 1, 10485760); perfNioServerConcurrency = verifiableProperties.getIntInRange("perf.nio.server.concurrency", 1, 1, Integer.MAX_VALUE); perfRequestRestMethod = RestMethod .valueOf(verifiableProperties.getString("perf.request.rest.method", RestMethod.GET.toString()).toUpperCase()); perfRouterChunkSize = verifiableProperties.getIntInRange("perf.router.chunk.size", 1048576, 1, 10485760); }
Source:
<code>private InputPortInfo createInternalServiceInputPort(String serviceName, List< InterfaceDefinition > interfaceList) throws ParserException { OLSyntaxNode protocolConfiguration = new NullProcessStatement( getContext() ); InputPortInfo iport = null; try { iport = new InputPortInfo( getContext(), serviceName + "InputPort", new URI( Constants.LOCAL_LOCATION_KEYWORD ), null, protocolConfiguration, new InputPortInfo.AggregationItemInfo[] {}, <START> new HashMap<String, String>() ); <END> for( InterfaceDefinition i : interfaceList ) { i.copyTo(iport); } } catch (URISyntaxException e) { throwException( e ); } return iport; }</code><technical_language>Collections.emptyMap()</technical_language>

Target:
private InputPortInfo createInternalServiceInputPort( String serviceName, List< InterfaceDefinition> interfaceList ) throws ParserException { OLSyntaxNode protocolConfiguration = new NullProcessStatement( getContext() ); InputPortInfo iport = null; try { iport = new InputPortInfo( getContext(), serviceName + "InputPort", new URI( Constants.LOCAL_LOCATION_KEYWORD ), null, protocolConfiguration, new InputPortInfo.AggregationItemInfo[]{}, Collections.<String, String>emptyMap() ); for( InterfaceDefinition i : interfaceList ) { i.copyTo( iport ); } } catch( URISyntaxException e ) { throwException( e ); } return iport; }
Source:
<code>public void clickWikiaLogo() { PageObjectLogging.logInfo("Click Wikia logo"); <START> wait.forElementVisible(logo); <END> logo.click(); }</code><technical_language>wait.forelementClickable</technical_language>

Target:
public void clickWikiaLogo() { PageObjectLogging.logInfo("Click Wikia logo"); wait.forElementClickable(logo); logo.click(); }
Source:
<code>private List<Patient> findPatients(String query, boolean includeVoided) { query = LuceneQuery.escapeQuery(query); LuceneQuery<PatientIdentifier> luceneQuery = getPatientIdentifierLuceneQuery(query, includeVoided); List<PatientIdentifier> patientIdentifiers = luceneQuery.list(); LuceneQuery<PersonName> luceneQuery2 = getPersonNameLuceneQuery(query, includeVoided); luceneQuery2.skipSame(luceneQuery.listProjection("patient.personId"), "person.personId"); List<PersonName> personNames = luceneQuery2.list(); LuceneQuery<PersonAttribute> luceneQuery3 = getPersonAttributeLuceneQuery(query, includeVoided); <START> luceneQuery3.skipSame(luceneQuery.listProjection("patient.personId"), "person.personId"); <END> luceneQuery3.skipSame(luceneQuery2.listProjection("person.personId"), "person.personId"); List<PersonAttribute> personAttributes = luceneQuery3.list(); List<Patient> personList = new LinkedList<>(); patientIdentifiers.forEach(patientIdentifier -> personList.add(patientIdentifier.getPatient())); personNames.forEach(personName -> personList.add(Context.getPatientService().getPatient(personName.getPerson().getId()))); personAttributes.forEach(personAttribute -> personList.add(Context.getPatientService().getPatient(personAttribute.getPerson().getId()))); return personList; }</code><technical_language>I turned out. Is luceneQuery.listProjection cached? If please do call twice, store results</technical_language>

Target:
private List<Patient> findPatients(String query, boolean includeVoided) { return findPatients(query, includeVoided, null, null); }
Source:
<code>public void onPageLoadComplete() { showToCButton(); refreshView.setEnabled(true); editHandler.setPage(model.getPage()); initPageScrollFunnel(); checkAndShowSelectTextOnboarding(); updateNavDrawerSelection(); <START> if (getMainActivity().pageLoadCallbacks() != null) { <END> getMainActivity().pageLoadCallbacks().onLoadComplete(); } }</code><technical_language>good check getMainActivity() return null this method appears complete asynchronously</technical_language>

Target:
public void onPageLoadComplete() { showToCButton(); refreshView.setEnabled(true); editHandler.setPage(model.getPage()); initPageScrollFunnel(); checkAndShowSelectTextOnboarding(); updateNavDrawerSelection(); if (getMainActivity() != null && getMainActivity().pageLoadCallbacks() != null) { getMainActivity().pageLoadCallbacks().onLoadComplete(); } }
Source:
<code>public String getDocumentId() { <START> return (documentId == null) ? URI : documentId; <END> }</code><technical_language>"URI" lowercase</technical_language>

Target:
public String getDocumentId() { return (documentId == null) ? uri : documentId; }
Source:
<code>public Operation<K> decode(final ByteBuffer buffer) { OperationCode opCode = OperationCode.valueOf(buffer.get()); validateOperation(opCode); int keySize = buffer.getInt(); buffer.limit(buffer.position() + keySize); ByteBuffer keyBlob = buffer.slice(); buffer.position(buffer.limit()); buffer.limit(buffer.capacity()); int valueSize = buffer.getInt(); buffer.limit(buffer.position() + valueSize); ByteBuffer valueBlob = buffer.slice(); try { return newOperation(keySerializer.read(keyBlob), valueSerializer.read(valueBlob)); } catch (ClassNotFoundException e) { <START> throw new SerializerException(e); <END> } }</code><technical_language>SerializerException is completely unrelated operation codecs - throw else</technical_language>

Target:
public Operation<K> decode(final ByteBuffer buffer) { OperationCode opCode = OperationCode.valueOf(buffer.get()); validateOperation(opCode); int keySize = buffer.getInt(); buffer.limit(buffer.position() + keySize); ByteBuffer keyBlob = buffer.slice(); buffer.position(buffer.limit()); buffer.limit(buffer.capacity()); int valueSize = buffer.getInt(); buffer.limit(buffer.position() + valueSize); ByteBuffer valueBlob = buffer.slice(); try { return newOperation(keySerializer.read(keyBlob), valueSerializer.read(valueBlob)); } catch (ClassNotFoundException e) { throw new CodecException(e); } }
Source:
<code><START> private AttributeDescriptor buildAttributeDescriptor(String name, AttributeType type) { <END> AttributeDescriptor attributeDescriptor = mock(AttributeDescriptor.class); when(attributeDescriptor.getName()).thenReturn(name); when(attributeDescriptor.getType()).thenReturn(type); return attributeDescriptor; }</code><technical_language>mock a simple object AttributeDescriptor. I create AttributeDescriptorImpl</technical_language>

Target:
private static AttributeDescriptor buildAttributeDescriptor(String name, AttributeType type) { return new AttributeDescriptorImpl(name, true, true, true, true, type); }
Source:
<code>public void putMetrics(List<Metric> metrics) { requireNotDisposed(); requireArgument(TSDB_DATAPOINTS_WRITE_MAX_SIZE > 0, "Max Chunk size can not be less than 1"); requireArgument(metrics != null, "Metrics can not be null"); String endpoint; synchronized (_roundRobinIterator) { endpoint = _roundRobinIterator.next(); <START> } <END> _logger.debug("Pushing metrics to TSDB using endpoint {}.", metrics.size(), endpoint); List<Metric> fracturedList = new ArrayList<>(); for (Metric metric : metrics) { if (metric.getDatapoints().size() <= TSDB_DATAPOINTS_WRITE_MAX_SIZE) { fracturedList.add(metric); } else { fracturedList.addAll(fractureMetric(metric)); } } try { put(fracturedList, endpoint + "/api/put", HttpMethod.POST); } catch(IOException ex) { _logger.warn("IOException while trying to push metrics", ex); _retry(fracturedList, _roundRobinIterator); } }</code><technical_language>@colbyguan _roundRobinIterator is accessed unprotected below. Do protection is needed ? If cycle endpoints, a approach AtomicInteger access array of endpoints, reset 0 position endpoints</technical_language>

Target:
public void putMetrics(List<Metric> metrics) { requireNotDisposed(); requireArgument(TSDB_DATAPOINTS_WRITE_MAX_SIZE > 0, "Max Chunk size can not be less than 1"); requireArgument(metrics != null, "Metrics can not be null"); String endpoint = _roundRobinIterator.next(); _logger.debug("Pushing metrics to TSDB using endpoint {}.", metrics.size(), endpoint); List<Metric> fracturedList = new ArrayList<>(); for (Metric metric : metrics) { if (metric.getDatapoints().size() <= TSDB_DATAPOINTS_WRITE_MAX_SIZE) { fracturedList.add(metric); } else { fracturedList.addAll(fractureMetric(metric)); } } try { put(fracturedList, endpoint + "/api/put", HttpMethod.POST); } catch(IOException ex) { _logger.warn("IOException while trying to push metrics", ex); _retry(fracturedList, _roundRobinIterator); } }
Source:
<code><START> default PrimitiveIterator.OfLong getRowIndexes() { <END> throw new NotInPageFilteringModeException("Row indexes are not available"); }</code><technical_language>of code fastutil instead of Java 8 primitive iterators. everywhere. Feel free open issue move Java 8 eliminate fastutil, I mix them</technical_language>

Target:
default Optional<PrimitiveIterator.OfLong> getRowIndexes() { return Optional.empty(); }
Source:
<code>private void assertStudentDataMatches(StudentData studentData, StudentAttributes student, boolean isRequestFromInstructor) { assertEquals(student.getEmail(), studentData.getEmail()); assertEquals(student.getCourse(), studentData.getCourseId()); assertEquals(student.getName(), studentData.getName()); if (student.getLastName() == null) { <START> String[] name = student.name.split(" "); <END> assertEquals(name[name.length - 1], studentData.getLastName()); } else { assertEquals(student.getLastName(), studentData.getLastName()); } assertEquals(student.getTeam(), studentData.getTeamName()); assertEquals(student.getSection(), studentData.getSectionName()); if (isRequestFromInstructor) { assertEquals(student.getComments(), studentData.getComments()); if (student.isRegistered()) { assertTrue(studentData.getJoinState().equals(JoinState.JOINED)); } else { assertTrue(studentData.getJoinState().equals(JoinState.NOT_JOINED)); } } else { assertNull(studentData.getComments()); assertNull(studentData.getJoinState()); } }</code><technical_language>StringHelper.splitName :P</technical_language>

Target:
private void assertStudentDataMatches(StudentData studentData, StudentAttributes student, boolean isRequestFromInstructor) { assertEquals(student.getEmail(), studentData.getEmail()); assertEquals(student.getCourse(), studentData.getCourseId()); assertEquals(student.getName(), studentData.getName()); if (student.getLastName() == null) { String[] name = StringHelper.splitName(student.name); assertEquals(name[1], studentData.getLastName()); } else { assertEquals(student.getLastName(), studentData.getLastName()); } assertEquals(student.getTeam(), studentData.getTeamName()); assertEquals(student.getSection(), studentData.getSectionName()); if (isRequestFromInstructor) { assertEquals(student.getComments(), studentData.getComments()); if (student.isRegistered()) { assertTrue(studentData.getJoinState().equals(JoinState.JOINED)); } else { assertTrue(studentData.getJoinState().equals(JoinState.NOT_JOINED)); } } else { assertNull(studentData.getComments()); assertNull(studentData.getJoinState()); } }
Source:
<code>public StatementExecution toStatementExecution() throws SQLException { StatementExecution cs; if (isFunction()) { <START> cs = environment.createFunctionStatementExecution(this.environment.getConnection().prepareCall(toSqlString()), true); <END> } else { cs = environment.createStatementExecution(this.environment.getConnection().prepareCall(toSqlString()), true); } bindParametersTo(cs); return cs; }</code><technical_language>wondering if do simplify long expressions</technical_language>

Target:
public StatementExecution toStatementExecution() throws SQLException { String sql = toSqlString(); PreparedStatement ps = environment.getConnection().prepareCall(sql); StatementExecution cs; if (isFunction()) { cs = environment.createFunctionStatementExecution(ps, true); } else { cs = environment.createStatementExecution(ps, true); } bindParametersTo(cs); return cs; }
Source:
<code>private Object interpretMultipleItemsUserList(List<Object> userListValues) { List<String> userListStringValues = new ArrayList<>(); boolean whiteSpaceNeeded = false; for (Object listValue : userListValues) { if (listValue instanceof Double) { Double doubleValueOfListItem = (Double) listValue; userListStringValues.add(stringWithoutTrailingZero(String.valueOf(doubleValueOfListItem.intValue()))); } else if (listValue instanceof String) { String stringValueOfListItem = (String) listValue; userListStringValues.add(stringWithoutTrailingZero(stringValueOfListItem)); } } StringBuilder stringBuilder = new StringBuilder(userListStringValues.size()); <START> for (String userListStringValue : userListStringValues) { <END> if (userListStringValue.length() > 1) { whiteSpaceNeeded = true; break; } } for (String userListStringValue : userListStringValues) { stringBuilder.append(stringWithoutTrailingZero(userListStringValue)); if (whiteSpaceNeeded) { stringBuilder.append(' '); } } return stringBuilder.toString().trim(); }</code><technical_language>this a bit easier read - if youd move this for loop in a method is called "listConsistsOfSingleCharacters" similar, instead of boolean flag "whiteSpaceNeeded" add a new variable named "seperator" concatinting list set separator "" " " based return of method</technical_language>

Target:
private Object interpretMultipleItemsUserList(List<Object> userListValues) { List<String> userListStringValues = new ArrayList<>(); for (Object listValue : userListValues) { if (listValue instanceof Double) { Double doubleValueOfListItem = (Double) listValue; userListStringValues.add(stringWithoutTrailingZero(String.valueOf(doubleValueOfListItem.intValue()))); } else if (listValue instanceof String) { String stringValueOfListItem = (String) listValue; userListStringValues.add(stringWithoutTrailingZero(stringValueOfListItem)); } } StringBuilder stringBuilder = new StringBuilder(userListStringValues.size()); String separator = listConsistsOfSingleCharacters(userListStringValues) ? "" : " "; for (String userListStringValue : userListStringValues) { stringBuilder.append(stringWithoutTrailingZero(userListStringValue)); stringBuilder.append(separator); } return stringBuilder.toString().trim(); }
Source:
<code>private ArrayList<MediaModel> filterOutRecentlyDeletedMedia(Set<MediaModel> failedMedia) { <START> ArrayList<MediaModel> mediaToRetry = new ArrayList<>(failedMedia); <END> ListIterator<MediaModel> iterator = mediaToRetry.listIterator(); while (iterator.hasNext()) { String mediaIdToCompare = String.valueOf(iterator.next().getId()); if (mUserDeletedMediaItemIds.contains(mediaIdToCompare)) { iterator.remove(); } } return mediaToRetry; }</code><technical_language>Creating a new empty Set adding correct media ids feels more natural removing stuff a copied array :). a big deal this implementation</technical_language>

Target:
private List<MediaModel> filterOutRecentlyDeletedMedia(Set<MediaModel> failedMedia) { List<MediaModel> mediaToRetry = new ArrayList<>(); for (MediaModel mediaModel : failedMedia) { String mediaIdToCompare = String.valueOf(mediaModel.getId()); if (!mUserDeletedMediaItemIds.contains(mediaIdToCompare)) { mediaToRetry.add(mediaModel); } } return mediaToRetry; }
Source:
<code>public static void enlargeTableLayoutButtonText(TableLayout tableLayout) { if (modifier == 1.0f) { return; } Context context = CatroidApplication.getAppContext(); WindowManager wm = (WindowManager) context.getSystemService(Context.WINDOW_SERVICE); Display display = wm.getDefaultDisplay(); DisplayMetrics metrics = new DisplayMetrics(); display.getMetrics(metrics); if ((metrics.widthPixels / metrics.xdpi) > widthForIncreasedTextSizeInInches) { <START> modifier += modifierIncreaseDelta; <END> } for (int i = 0; i < tableLayout.getChildCount(); i++) { if (tableLayout.getChildAt(i) instanceof TableRow) { TableRow tableRow = (TableRow) tableLayout.getChildAt(i); for (int j = 0; j < tableRow.getChildCount(); j++) { if (tableRow.getChildAt(j) instanceof Button) { Button button = (Button) tableRow.getChildAt(j); enlargeButtonText(button); } } } } if ((metrics.heightPixels / metrics.ydpi) > 6.0f) { modifier -= modifierIncreaseDelta; } }</code><technical_language>modifier is a member variable i potential issues modifying here. this affects other methods in class</technical_language>

Target:
public static void enlargeTableLayoutButtonText(TableLayout tableLayout) { if (modifier == 1.0f) { return; } if (largeFormulaEditorTextSize) { modifier += modifierIncreaseDelta; } for (int i = 0; i < tableLayout.getChildCount(); i++) { if (tableLayout.getChildAt(i) instanceof TableRow) { TableRow tableRow = (TableRow) tableLayout.getChildAt(i); for (int j = 0; j < tableRow.getChildCount(); j++) { if (tableRow.getChildAt(j) instanceof Button) { Button button = (Button) tableRow.getChildAt(j); enlargeButtonText(button); } } } } if (largeFormulaEditorTextSize) { modifier -= modifierIncreaseDelta; } }
Source:
<code>public static String[] getStringValuesFromDatabaseForInternalRoles(Connection dbConnection, String sqlStmt, Object... params) throws UserStoreException { String[] values = new String[0]; try(PreparedStatement prepStmt = dbConnection.prepareStatement(sqlStmt) ) { if (params != null && params.length > 0) { for (int i = 0; i < params.length; i++) { Object param = params[i]; if (param == null) { throw new UserStoreException("Null data provided."); } else if (param instanceof String) { prepStmt.setString(i + 1, (String) param); } else if (param instanceof Integer) { prepStmt.setInt(i + 1, (Integer) param); } } } try (ResultSet rs = prepStmt.executeQuery()) { List<String> lst = new ArrayList<String>(); while (rs.next()) { String name = rs.getString(1); String domain = rs.getString(2); if (domain != null) { name = UserCoreUtil.addDomainToName(name, domain); } lst.add(name); } if (lst.size() > 0) { values = lst.toArray(new String[lst.size()]); } return values; } } catch (SQLException e) { String errorMessage = "Using sql : " + sqlStmt + " " + e.getMessage(); if (log.isDebugEnabled()) { log.debug(errorMessage, e); } throw new UserStoreException(errorMessage, e); }finally { <START> close(dbConnection); <END> } }</code><technical_language>connection passed a parameter this method, close connection this method. Need close connection in original place originally (create )close dbConnection</technical_language>

Target:
public static String[] getStringValuesFromDatabaseForInternalRoles(Connection dbConnection, String sqlStmt, Object... params) throws UserStoreException { String[] values = new String[0]; try(PreparedStatement prepStmt = dbConnection.prepareStatement(sqlStmt) ) { if (params != null && params.length > 0) { for (int i = 0; i < params.length; i++) { Object param = params[i]; if (param == null) { throw new UserStoreException("Null data provided."); } else if (param instanceof String) { prepStmt.setString(i + 1, (String) param); } else if (param instanceof Integer) { prepStmt.setInt(i + 1, (Integer) param); } } } try (ResultSet rs = prepStmt.executeQuery()) { List<String> lst = new ArrayList<String>(); while (rs.next()) { String name = rs.getString(1); String domain = rs.getString(2); if (domain != null) { name = UserCoreUtil.addDomainToName(name, domain); } lst.add(name); } if (lst.size() > 0) { values = lst.toArray(new String[lst.size()]); } return values; } } catch (SQLException e) { String errorMessage = "Using sql : " + sqlStmt + " " + e.getMessage(); if (log.isDebugEnabled()) { log.debug(errorMessage, e); } throw new UserStoreException(errorMessage, e); } }
Source:
<code>public void theDeviceSendsARegisterDeviceRequestToThePlatform(final String protocol, final Map<String, String> settings) throws IOException, DeviceSimulatorException { <START> try{ <END> final OslpEnvelope request = this .createEnvelopeBuilder( getString(settings, Keys.KEY_DEVICE_UID, com.alliander.osgp.cucumber.platform.glue.steps.database.adapterprotocoloslp.OslpDeviceSteps.DEFAULT_DEVICE_UID), this.oslpMockServer.getSequenceNumber()) .withPayloadMessage(Message.newBuilder().setRegisterDeviceRequest(Oslp.RegisterDeviceRequest .newBuilder() .setDeviceIdentification(getString(settings, Keys.KEY_DEVICE_IDENTIFICATION, Defaults.DEFAULT_DEVICE_IDENTIFICATION)) .setIpAddress(ByteString.copyFrom(InetAddress .getByName(getString(settings, Keys.IP_ADDRESS, Defaults.LOCALHOST)).getAddress())) .setDeviceType(getEnum(settings, Keys.KEY_DEVICE_TYPE, DeviceType.class, DeviceType.PSLD)) .setHasSchedule(getBoolean(settings, Keys.KEY_HAS_SCHEDULE, Defaults.DEFAULT_HASSCHEDULE)) .setRandomDevice(getInteger(settings, Keys.RANDOM_DEVICE, Defaults.RANDOM_DEVICE))).build()) .build(); this.send(request, settings); }catch(IOException ioe){ ScenarioContext.Current().put("Error", ioe); }catch(IllegalArgumentException iae){ ScenarioContext.Current().put("Error", iae); } }</code><technical_language>indentation is correct</technical_language>

Target:
public void theDeviceSendsARegisterDeviceRequestToThePlatform(final String protocol, final Map<String, String> settings) throws IOException, DeviceSimulatorException { LOGGER.info("IpAddress from feature: [{}]", getString(settings, Keys.IP_ADDRESS, Defaults.LOCALHOST)); final InetAddress address = InetAddress.getByName(getString(settings, Keys.IP_ADDRESS, Defaults.LOCALHOST)); final byte[] ba = address.getAddress(); LOGGER.info("getAddress() from inetAddress: [{}.{}.{}.{}]", ba[0], ba[1], ba[2], ba[3]); LOGGER.info("getHostAddress() from inetAddress: [{}]", address.getHostAddress()); LOGGER.info("getHostName() from inetAddress: [{}]", address.getHostName()); try { final OslpEnvelope request = this .createEnvelopeBuilder( getString(settings, Keys.KEY_DEVICE_UID, com.alliander.osgp.cucumber.platform.glue.steps.database.adapterprotocoloslp.OslpDeviceSteps.DEFAULT_DEVICE_UID), this.oslpMockServer.getSequenceNumber()) .withPayloadMessage(Message.newBuilder().setRegisterDeviceRequest(Oslp.RegisterDeviceRequest .newBuilder() .setDeviceIdentification(getString(settings, Keys.KEY_DEVICE_IDENTIFICATION, Defaults.DEFAULT_DEVICE_IDENTIFICATION)) .setIpAddress(ByteString.copyFrom(InetAddress .getByName(getString(settings, Keys.IP_ADDRESS, Defaults.LOCALHOST)).getAddress())) .setDeviceType(getEnum(settings, Keys.KEY_DEVICE_TYPE, DeviceType.class, DeviceType.PSLD)) .setHasSchedule(getBoolean(settings, Keys.KEY_HAS_SCHEDULE, Defaults.DEFAULT_HASSCHEDULE)) .setRandomDevice(getInteger(settings, Keys.RANDOM_DEVICE, Defaults.RANDOM_DEVICE))).build()) .build(); this.send(request, settings); } catch (final IOException ioe) { ScenarioContext.Current().put("Error", ioe); } catch (final IllegalArgumentException iae) { ScenarioContext.Current().put("Error", iae); } }
Source:
<code>public void handleEvent(EventBundle events) { for (Event event : events) { <START> if (DOCUMENT_REMOVED.equals(event.getName())) { <END> DocumentEventContext context = (DocumentEventContext) event.getContext(); DocumentModel docModel = context.getSourceDocument(); if (DOCUMENT_ROUTE_DOCUMENT_TYPE.equals(docModel.getType())) { deleteOrphanTasks(context.getCoreSession(), docModel.getId()); } } } }</code><technical_language>This test is needed event bundle is filtered events defined trigger listener in descriptor</technical_language>

Target:
public void handleEvent(EventBundle events) { for (Event event : events) { DocumentEventContext context = (DocumentEventContext) event.getContext(); DocumentModel docModel = context.getSourceDocument(); if (DOCUMENT_ROUTE_DOCUMENT_TYPE.equals(docModel.getType())) { deleteOrphanTasks(context.getCoreSession(), docModel.getId()); } } }
Source:
<code>public Optional<SelectionContext<VariableMap>> match(SelectionCriteria criteria) { if (lastRefresh.get() == 0) { throw new PrestoException(CONFIGURATION_UNAVAILABLE, "Selectors cannot be fetched from database"); } <START> if (System.nanoTime() - lastRefresh.get() > maxRefreshInterval.toMillis() * 1_000_000) { <END> throw new PrestoException( CONFIGURATION_UNAVAILABLE, format("Selectors cannot be fetched from database. Current selectors are loaded %s ago", succinctNanos(System.nanoTime() - lastRefresh.get()).toString())); } if (selectors.get().isEmpty()) { throw new PrestoException(CONFIGURATION_INVALID, "No selectors are configured"); } return selectors.get().stream() .map(s -> s.match(criteria)) .filter(Optional::isPresent) .map(Optional::get) .findFirst(); }</code><technical_language>Put blocks a helper maybe</technical_language>

Target:
public Optional<SelectionContext<VariableMap>> match(SelectionCriteria criteria) { checkMaxRefreshInterval(); if (selectors.get().isEmpty()) { throw new PrestoException(CONFIGURATION_INVALID, "No selectors are configured"); } return selectors.get().stream() .map(s -> s.match(criteria)) .filter(Optional::isPresent) .map(Optional::get) .findFirst(); }
Source:
<code>public Result deleteSurvey(String surveyGuid, String createdOnString, String physical) throws Exception { UserSession session = getAuthenticatedSession(DEVELOPER, ADMIN); StudyIdentifier studyId = session.getStudyIdentifier(); long createdOn = DateUtils.convertToMillisFromEpoch(createdOnString); GuidCreatedOnVersionHolder keys = new GuidCreatedOnVersionHolderImpl(surveyGuid, createdOn); <START> Survey survey = surveyService.getSurvey(studyId, keys, false, false); <END> if (survey == null) { throw new EntityNotFoundException(Survey.class); } if ("true".equals(physical) && session.isInRole(ADMIN)) { surveyService.deleteSurveyPermanently(studyId, survey); } else { surveyService.deleteSurvey(studyId, survey); } expireCache(surveyGuid, createdOnString, studyId); return okResult("Survey deleted."); }</code><technical_language>getSurvey() check isInStudy() if pass in studyID. This means admin delete surveys of study</technical_language>

Target:
public Result deleteSurvey(String surveyGuid, String createdOnString, String physical) throws Exception { UserSession session = getAuthenticatedSession(DEVELOPER, ADMIN); StudyIdentifier studyId = session.getStudyIdentifier(); long createdOn = DateUtils.convertToMillisFromEpoch(createdOnString); GuidCreatedOnVersionHolder keys = new GuidCreatedOnVersionHolderImpl(surveyGuid, createdOn); Survey survey = surveyService.getSurvey(session.getParticipant().getRoles(), studyId, keys, false, false); if (survey == null) { throw new EntityNotFoundException(Survey.class); } if ("true".equals(physical) && session.isInRole(ADMIN)) { surveyService.deleteSurveyPermanently(session.getParticipant().getRoles(), studyId, survey); } else { surveyService.deleteSurvey(studyId, survey); } expireCache(surveyGuid, createdOnString, studyId); return okResult("Survey deleted."); }
Source:
<code>public void verifyOnLvsPage() { String url = driver.getCurrentUrl(); String[] urlParts = url.split("/"); <START> Assertion.assertEquals(urlParts[urlParts.length - 2] + '/' +urlParts[urlParts.length - 1], URLsContent.specialLicensedVideoSwap); <END> PageObjectLogging.log("verifyOnLvsPage", "verify that the url is the correct one for LVS page", true); }</code><technical_language>please consider Assertion.assertContains instead of substrings comparing them. is readable</technical_language>

Target:
public void verifyOnLvsPage() { String url = driver.getCurrentUrl(); Assertion.assertTrue(url.contains(URLsContent.specialLicensedVideoSwap)); PageObjectLogging.log("verifyOnLvsPage", "url is the correct one for LVS page", true); }
Source:
<code>private void updateAffinityLabels() { List<Label> selectedLabels = getParameters().getAffinityLabels(); List<Label> previouslySelectedLabels = labelDao.getAllByEntityIds(Collections.singletonList(getVdsId())); <START> Set<Label> labelsToAdd = new HashSet<>(selectedLabels); labelsToAdd.removeAll(previouslySelectedLabels); for (Label label : labelsToAdd) { label.addHost(getVds()); labelDao.update(label); } Set<Label> labelsToRemove = new HashSet<>(previouslySelectedLabels); labelsToRemove.removeAll(selectedLabels); for (Label label : labelsToRemove) { label.removeHost(getVds()); labelDao.update(label); } <END> }</code><technical_language>same.. this needs more efficient database</technical_language>

Target:
private void updateAffinityLabels() { List<Label> affinityLabels = getParameters().getAffinityLabels(); List<Guid> labelIds = affinityLabels.stream() .map(Label::getId) .collect(Collectors.toList()); labelDao.updateLabelsForHost(getVdsId(), labelIds); }
Source:
<code>private void createProgramEnrollmentTestData() { createdPatient = patientService.createPatient(DEFAULT_CONFIG_NAME, preparePatient()); <START> createProgramEnrollment(new DateTime("2010-01-18T00:00:00Z"), null); <END> createProgramEnrollment(new DateTime("2010-01-16T00:00:00Z"), new DateTime("2016-01-16T00:00:00Z")); }</code><technical_language>this done in setUp method</technical_language>

Target:
private void createProgramEnrollmentTestData() { createdPatient = patientService.createPatient(DEFAULT_CONFIG_NAME, preparePatient(MOTECH_ID)); createProgramEnrollment(createdPatient, new DateTime("2010-01-16T00:00:00Z"), null); createProgramEnrollment(createdPatient, new DateTime("2010-01-16T00:00:00Z"), new DateTime("2016-01-16T00:00:00Z")); }