auphong2707/dl4se-code-review-dataset huggingface dataset:
Source:
<code>private double protectionFull( ResolvedCds cds, CreditDiscountFactors discountFactors, LegalEntitySurvivalProbabilities survivalProbabilities, LocalDate referenceDate, LocalDate effectiveStartDate) { DoubleArray integrationSchedule = DoublesScheduleGenerator.getIntegrationsPoints( discountFactors.relativeYearFraction(effectiveStartDate), discountFactors.relativeYearFraction(cds.getProtectionEndDate()), discountFactors.getParameterKeys(), survivalProbabilities.getParameterKeys()); double pv = 0d; double ht0 = survivalProbabilities.zeroRate(integrationSchedule.get(0)) * integrationSchedule.get(0); double rt0 = discountFactors.zeroRate(integrationSchedule.get(0)) * integrationSchedule.get(0); double b0 = Math.exp(-ht0 - rt0); int n = integrationSchedule.size(); for (int i = 1; i < n; ++i) { double ht1 = survivalProbabilities.zeroRate(integrationSchedule.get(i)) * integrationSchedule.get(i); double rt1 = discountFactors.zeroRate(integrationSchedule.get(i)) * integrationSchedule.get(i); double b1 = Math.exp(-ht1 - rt1); double dht = ht1 - ht0; double drt = rt1 - rt0; double dhrt = dht + drt; double dPV = 0d; if (Math.abs(dhrt) < 1e-5) { dPV = dht * b0 * epsilon(-dhrt); } else { dPV = (b0 - b1) * dht / dhrt; } pv += dPV; ht0 = ht1; rt0 = rt1; b0 = b1; } double df = discountFactors.discountFactor(referenceDate); pv /= df; <START> return pv; <END> }</code><technical_language>Simpler return pv / df;</technical_language>

Target:
private double protectionFull( ResolvedCds cds, CreditDiscountFactors discountFactors, LegalEntitySurvivalProbabilities survivalProbabilities, LocalDate referenceDate, LocalDate effectiveStartDate) { DoubleArray integrationSchedule = DoublesScheduleGenerator.getIntegrationsPoints( discountFactors.relativeYearFraction(effectiveStartDate), discountFactors.relativeYearFraction(cds.getProtectionEndDate()), discountFactors.getParameterKeys(), survivalProbabilities.getParameterKeys()); double pv = 0d; double ht0 = survivalProbabilities.zeroRate(integrationSchedule.get(0)) * integrationSchedule.get(0); double rt0 = discountFactors.zeroRate(integrationSchedule.get(0)) * integrationSchedule.get(0); double b0 = Math.exp(-ht0 - rt0); int n = integrationSchedule.size(); for (int i = 1; i < n; ++i) { double ht1 = survivalProbabilities.zeroRate(integrationSchedule.get(i)) * integrationSchedule.get(i); double rt1 = discountFactors.zeroRate(integrationSchedule.get(i)) * integrationSchedule.get(i); double b1 = Math.exp(-ht1 - rt1); double dht = ht1 - ht0; double drt = rt1 - rt0; double dhrt = dht + drt; double dPV = 0d; if (Math.abs(dhrt) < SMALL) { dPV = dht * b0 * epsilon(-dhrt); } else { dPV = (b0 - b1) * dht / dhrt; } pv += dPV; ht0 = ht1; rt0 = rt1; b0 = b1; } double df = discountFactors.discountFactor(referenceDate); return pv / df; }
Source:
<code>public static HashMap<String, Object> getMetaFieldsAndValues(Externalizable e) throws RecordTooLargeException{ ByteArrayOutputStream bos = new ByteArrayOutputStream(); <START> OutputStream out = bos; <END> try { e.writeExternal(new DataOutputStream(out)); out.close(); } catch (IOException e1) { e1.printStackTrace(); throw new RuntimeException("Failed to serialize externalizable for content values"); } byte[] blob = bos.toByteArray(); HashMap<String, Object> values = new HashMap<String, Object>(); if(e instanceof IMetaData) { IMetaData m = (IMetaData)e; for(String key : m.getMetaDataFields()) { Object o = m.getMetaData(key); if(o == null ) { continue;} String value = o.toString(); values.put(TableBuilder.scrubName(key), value); } } if(blob.length > 1000000){ throw new RecordTooLargeException(blob.length / 1000000); } values.put(DATA_COL, blob); return values; }</code><technical_language>out is redundant, able bos in place</technical_language>

Target:
public static HashMap<String, Object> getMetaFieldsAndValues(Externalizable e) throws RecordTooLargeException{ byte[] blob = TableBuilder.toBlob(e); HashMap<String, Object> values = new HashMap<String, Object>(); if(e instanceof IMetaData) { IMetaData m = (IMetaData)e; for(String key : m.getMetaDataFields()) { Object o = m.getMetaData(key); if(o == null ) { continue;} String value = o.toString(); values.put(TableBuilder.scrubName(key), value); } } if(blob.length > 1000000){ throw new RecordTooLargeException(blob.length / 1000000); } values.put(DATA_COL, blob); return values; }
Source:
<code>public CharSequence toXML(XmlEnvironment xmlEnvironment) { XmlStringBuilder xml = new XmlStringBuilder(this); <START> parseInfos(xml); <END> parsePointers(xml); closeElement(xml); return xml; }</code><technical_language>Need pass xmlEnvironment argument XmlStringBuilder</technical_language>

Target:
public XmlStringBuilder toXML(XmlEnvironment xmlEnvironment) { XmlStringBuilder xml = new XmlStringBuilder(this, xmlEnvironment); appendInfoElements(xml); appendPointerElements(xml); closeElement(xml); return xml; }
Source:
<code>public Boolean visitPrimitive_Primitive( AnnotatedPrimitiveType subtype, AnnotatedPrimitiveType supertype, Void p) { boolean superResult = super.visitPrimitive_Primitive(subtype, supertype, p); if (superResult) { return true; } PrimitiveType subPrimitive = subtype.getUnderlyingType(); PrimitiveType superPrimitive = supertype.getUnderlyingType(); if (isNarrowerIntegral(subPrimitive, superPrimitive)) { AnnotationMirror superAnno = supertype.getAnnotationInHierarchy(UNKNOWN_SIGNEDNESS); <START> if (!superAnno.equals(SIGNEDNESS_BOTTOM)) { <END> return true; } } return false; }</code><technical_language>This !AnnotationUtils.areSameByName(superAnno, SIGNEDNESS_BOTTOM)</technical_language>

Target:
public Boolean visitPrimitive_Primitive( AnnotatedPrimitiveType subtype, AnnotatedPrimitiveType supertype, Void p) { boolean superResult = super.visitPrimitive_Primitive(subtype, supertype, p); if (superResult) { return true; } PrimitiveType subPrimitive = subtype.getUnderlyingType(); PrimitiveType superPrimitive = supertype.getUnderlyingType(); if (isNarrowerIntegral(subPrimitive, superPrimitive)) { AnnotationMirror superAnno = supertype.getAnnotationInHierarchy(UNKNOWN_SIGNEDNESS); if (!AnnotationUtils.areSameByName(superAnno, SIGNEDNESS_BOTTOM)) { return true; } } return false; }
Source:
<code>void someMethod(Root root) { <START> root.getFoo(); <END> }</code><technical_language>add more call getFoo() crash a invocation? base original bug report</technical_language>

Target:
void someMethod(Root root) { root.getFoo().getBar(); }
Source:
<code>public void readExternal(ObjectInput in) throws IOException, ClassNotFoundException { hash = in.readInt(); ncols = in.readInt(); column = new DataValueDescriptor[ncols]; for (int i = 0; i < ncols; i++) { column[i] = (DataValueDescriptor) in.readObject(); } <START> StructType structType = (StructType)in.readObject(); <END> schema = structType.length() > 0 ? Optional.of(structType) : Optional.empty(); }</code><technical_language>I feel serializing schema for single ValueRow is overhead, is this needed</technical_language>

Target:
public void readExternal(ObjectInput in) throws IOException, ClassNotFoundException { hash = in.readInt(); ncols = in.readInt(); column = new DataValueDescriptor[ncols]; for (int i = 0; i < ncols; i++) { column[i] = (DataValueDescriptor) in.readObject(); } }
Source:
<code>public int compare(final SAMRecord samRecord1, final SAMRecord samRecord2) { int cmp; if (null == samRecord1.getHeader() || null == samRecord2.getHeader()) { <START> throw new IllegalArgumentException("Record must have non-null SAMFileHeaders to be comapred"); <END> } int samRecord1Value, samRecord2Value; cmp = fileOrderCompare(samRecord1, samRecord2); if (cmp == 0) { cmp = DuplicateScoringStrategy.compare(samRecord1, samRecord2, this.scoringStrategy, true); } if (cmp == 0) { cmp = samRecord1.getReadName().compareTo(samRecord2.getReadName()); } if (cmp == 0) { if (samRecord1.getReadPairedFlag() && samRecord2.getReadPairedFlag()) { samRecord1Value = samRecord1.getFirstOfPairFlag() ? 0 : 1; samRecord2Value = samRecord2.getFirstOfPairFlag() ? 0 : 1; cmp = samRecord1Value - samRecord2Value; } } return cmp; }</code><technical_language>Record -> Records comapred -> compared</technical_language>

Target:
public int compare(final SAMRecord samRecord1, final SAMRecord samRecord2) { populateTransientAttributes(samRecord1, samRecord2); int cmp; int samRecord1Value, samRecord2Value; cmp = fileOrderCompare(samRecord1, samRecord2); if (cmp == 0) { cmp = DuplicateScoringStrategy.compare(samRecord1, samRecord2, this.scoringStrategy, true); } if (cmp == 0) { cmp = samRecord1.getReadName().compareTo(samRecord2.getReadName()); } if (cmp == 0) { if (samRecord1.getReadPairedFlag() && samRecord2.getReadPairedFlag()) { samRecord1Value = samRecord1.getFirstOfPairFlag() ? 0 : 1; samRecord2Value = samRecord2.getFirstOfPairFlag() ? 0 : 1; cmp = samRecord1Value - samRecord2Value; } } return cmp; }
Source:
<code>public void verifyLastEditHistorySummary(String targetText) { Assertion.assertStringContains(targetText, getLastHistorySummary()); <START> PageObjectLogging.log("verifyLastEditHistorySummary", <END> "verifying the last edit summary shows " + targetText, true); }</code><technical_language>wrong formatting - parameter in new line</technical_language>

Target:
public void verifyLastEditHistorySummary(String targetText) { Assertion.assertStringContains(targetText, getLastHistorySummary()); PageObjectLogging.log( "verifyLastEditHistorySummary", "The last edit summary shows " + targetText, true ); }
Source:
<code>public int getBaseTime() { if (campaign.getCampaignOptions().useAeroSystemHits()) { Entity e = unit.getEntity(); if (isSalvaging()) { if (e.hasETypeFlag(Entity.ETYPE_DROPSHIP) || e.hasETypeFlag(Entity.ETYPE_JUMPSHIP)) { if (e.hasNavalC3()) { <START> return 8640; <END> } return 4320; } else { return 1080; } } if (hits == 1) { if (e.hasETypeFlag(Entity.ETYPE_DROPSHIP) || e.hasETypeFlag(Entity.ETYPE_JUMPSHIP)) { if (e.hasNavalC3()) { return 480; } return 240; } else { return 120; } } if (hits == 2) { if (e.hasETypeFlag(Entity.ETYPE_DROPSHIP) || e.hasETypeFlag(Entity.ETYPE_JUMPSHIP)) { if (e.hasNavalC3()) { return 960; } return 480; } else { return 240; } } } if(isSalvaging()) { return 4320; } return 120; }</code><technical_language>Instead of a fixed number, base a multiplier for Naval C3</technical_language>

Target:
public int getBaseTime() { int time = 0; if (campaign.getCampaignOptions().useAeroSystemHits()) { Entity e = unit.getEntity(); if (e.hasETypeFlag(Entity.ETYPE_DROPSHIP) || e.hasETypeFlag(Entity.ETYPE_JUMPSHIP)) { time = 120; if (e.hasNavalC3()) { time *= 2; } } else { time = 60; } if (isSalvaging()) { time *= 10; } if (hits == 1) { time *= 1; } if (hits == 2) { time *= 2; } return time; } if(isSalvaging()) { time = 4320; } else { time = 120; } return time; }
Source:
<code><START> public void setRow(int row, double... values) { <END> if (values.length != SIZE) { throw new IllegalArgumentException("Call setRow received an array of length " + values.length + ". " + "The dimensions of the matrix is 2 by 2."); } if (row == 0) { m00 = values[0]; m01 = values[1]; } else if (row == 1) { m10 = values[2]; m11 = values[3]; } else { throw new IllegalArgumentException("Specified element is out of bounds: (" + row + " , 0)"); } }</code><technical_language>Lots of new methods, tested</technical_language>

Target:
public void setRow(int row, double... values) { if (values.length != SIZE) { throw new IllegalArgumentException("Call setRow received an array of length " + values.length + ". " + "The dimensions of the matrix is 2 by 2."); } if (row == 0) { m00 = values[0]; m01 = values[1]; } else if (row == 1) { m10 = values[0]; m11 = values[1]; } else { throw new IllegalArgumentException("Specified element is out of bounds: (" + row + " , 0)"); } }
Source:
<code>public static String hmacDigest(String msg, String keyString, String algo) { String digest = null; try { SecretKeySpec key = new SecretKeySpec((keyString).getBytes("UTF-8"), algo); Mac mac = Mac.getInstance(algo); mac.init(key); byte[] bytes = mac.doFinal(msg.getBytes("ASCII")); StringBuffer hash = new StringBuffer(); for (int i = 0; i < bytes.length; i++) { String hex = Integer.toHexString(0xFF & bytes[i]); if (hex.length() == 1) { hash.append('0'); } hash.append(hex); } digest = hash.toString(); <START> } catch (UnsupportedEncodingException e) { <END> } catch (InvalidKeyException e) { } catch (NoSuchAlgorithmException e) { } return digest; }</code><technical_language>**Never** swallow Exceptions! a try/multi-catch throw a unchecked exception, e.g. InvalidStateException in this case. In cases exception ignored, log a FINE/FINER/FINEST level</technical_language>

Target:
public static String hmacDigest(String msg, String keyString, String algo) { String digest = null; try { SecretKeySpec key = new SecretKeySpec((keyString).getBytes("UTF-8"), algo); String algorithm; if (!algo.toLowerCase().startsWith("hmac")) { algorithm = "hmac" + algo.toLowerCase(); } else { algorithm = algo.toLowerCase(); } Mac mac = Mac.getInstance(algorithm); mac.init(key); byte[] bytes = mac.doFinal(msg.getBytes("ASCII")); StringBuffer hash = new StringBuffer(); for (int i = 0; i < bytes.length; i++) { String hex = Integer.toHexString(0xFF & bytes[i]); if (hex.length() == 1) { hash.append('0'); } hash.append(hex); } digest = hash.toString(); } catch (UnsupportedEncodingException | InvalidKeyException | NoSuchAlgorithmException e) { throw new IllegalStateException("HMAC digest could not be obtained correctly.", e); } return digest; }
Source:
<code><START> default <T> SearchPage<T> queryForPage(Query query, Class<T> clazz, IndexCoordinates index) { <END> return SearchHitSupport.searchPageFor(queryForList(query, clazz, index), query.getPageable()); }</code><technical_language>is difference queryForPage queryForList</technical_language>

Target:
default <T> AggregatedPage<T> queryForPage(Query query, Class<T> clazz, IndexCoordinates index) { return (AggregatedPage<T>) SearchHitSupport.unwrapSearchHits(searchForPage(query, clazz, index)); }
Source:
<code>public static void trace(String option, String message, Throwable throwable) { String systemPrintableMessage = message; while (systemPrintableMessage.length() > 100) { String partial = systemPrintableMessage.substring(0, 100); systemPrintableMessage = systemPrintableMessage.substring(100); System.out.println(partial + "\\"); <START> } <END> if(fgDebugTrace != null) { fgDebugTrace.trace(option, message, throwable); } }</code><technical_language>Missing System.out.print(systemPrintableMessage); while loop, deal part of string is <= 100</technical_language>

Target:
public static void trace(String option, String message, Throwable throwable) { String systemPrintableMessage = message; while (systemPrintableMessage.length() > 100) { String partial = systemPrintableMessage.substring(0, 100); systemPrintableMessage = systemPrintableMessage.substring(100); System.out.println(partial + "\\"); } System.out.println(systemPrintableMessage); if(fgDebugTrace != null) { fgDebugTrace.trace(option, message, throwable); } }
Source:
<code>public void shouldFailWhenMovingDocumentBlobAlreadyInColdStorage() { DocumentModel documentModel = createDocument(true); documentModel = moveContentToColdStorage(session, documentModel.getRef()); <START> documentModel = session.getDocument(documentModel.getRef()); <END> try { moveContentToColdStorage(session, documentModel.getRef()); fail("Should fail because the content is already in cold storage"); } catch (NuxeoException ne) { assertEquals(SC_CONFLICT, ne.getStatusCode()); assertEquals( String.format("The main content of documentModel: %s is already in cold storage.", documentModel), ne.getMessage()); } }</code><technical_language>useless</technical_language>

Target:
public void shouldFailWhenMovingDocumentBlobAlreadyInColdStorage() { DocumentModel documentModel = createDocument(true); documentModel = moveContentToColdStorage(session, documentModel.getRef()); try { moveContentToColdStorage(session, documentModel.getRef()); fail("Should fail because the content is already in cold storage"); } catch (NuxeoException ne) { assertEquals(SC_CONFLICT, ne.getStatusCode()); assertEquals(String.format("The main content for document: %s is already in cold storage.", documentModel), ne.getMessage()); } }
Source:
<code>public void run() { final List<HealthCheckResult> healthChecks = zookeeperClients.stream() .map(this::doHealthCheck) .collect(Collectors.toList()); <START> if (!modeService.isReadOnlyEnabled() && healthChecks.contains(HealthCheckResult.UNHEALTHY)) { <END> modeService.setMode(ModeService.ManagementMode.READ_ONLY); } else if (modeService.isReadOnlyEnabled() && !healthChecks.contains(HealthCheckResult.UNHEALTHY)) { modeService.setMode(ModeService.ManagementMode.READ_WRITE); } }</code><technical_language>Is necessary check previous state</technical_language>

Target:
public void run() { final List<HealthCheckResult> healthCheckResults = zookeeperClients.stream() .map(this::doHealthCheck) .collect(Collectors.toList()); updateMode(healthCheckResults); }
Source:
<code>private Event createCommandEvent(String topic, String payload, String source) { String itemName = getItemName(topic); ItemEventPayloadBean bean = deserializePayload(payload, ItemEventPayloadBean.class); Command command = null; try { <START> command = (Command) parse(bean.getType() + TYPE_POSTFIX, bean.getValue()); <END> } catch (Exception e) { throw new IllegalArgumentException("Parsing of item command event failed.", e); } return new ItemCommandEvent(topic, payload, itemName, command, source); }</code><technical_language>Wait, add postfix here, internal implementation of parse requires in order able pass change parameter typeName simpleClassName? signature is deal parse method</technical_language>

Target:
private Event createCommandEvent(String topic, String payload, String source) { String itemName = getItemName(topic); ItemEventPayloadBean bean = deserializePayload(payload, ItemEventPayloadBean.class); Command command = parseType(bean.getType(), bean.getValue(), Command.class); return new ItemCommandEvent(topic, payload, itemName, command, source); }
Source:
<code>private void encodePropertiesByType( PropertyType parentType, PropertyDescriptor descriptor, List<Property> properties) { List<Feature> chainedFeatures = getChainedFeatures(properties); if (chainedFeatures == null || chainedFeatures.isEmpty() || descriptor.getMaxOccurs() == 1) { List<Map<NameImpl, String>> linkedFeatures = getLinkedFeatures(properties); if (!linkedFeatures.isEmpty()) { encodeLinkedFeatures(descriptor, linkedFeatures); } else { String attributeName = descriptor.getName().getLocalPart(); if (properties.size() > 1 && properties .stream() .allMatch( prop -> <START> Objects.equals( <END> attributeName, prop.getName().getLocalPart()))) { jsonWriter.key(attributeName).array(); properties.forEach( prop -> encodeProperty( INSIDE_ARRAY_ATTRIBUTE, prop, getAttributes(prop))); jsonWriter.endArray(); } else { properties.forEach(this::encodeProperty); } } } else { encodeChainedFeatures(descriptor.getName().getLocalPart(), chainedFeatures); } }</code><technical_language>Is this else needed waht's here</technical_language>

Target:
private void encodePropertiesByType( PropertyType parentType, PropertyDescriptor descriptor, List<Property> properties) { List<Feature> chainedFeatures = getChainedFeatures(properties); if (chainedFeatures == null || chainedFeatures.isEmpty() || descriptor.getMaxOccurs() == 1) { List<Map<NameImpl, String>> linkedFeatures = getLinkedFeatures(properties); if (!linkedFeatures.isEmpty()) { encodeLinkedFeatures(descriptor, linkedFeatures); } else { encodeProperties(descriptor, properties); } } else { encodeChainedFeatures(descriptor.getName().getLocalPart(), chainedFeatures); } }
Source:
<code>public void handleArtifactEvent(ArtifactEvent artifactEvent, Sender sender) { boolean refreshWorkflow = false; if (artifactEvent == null) { return; <START> } <END> for (EventBasicGuidArtifact event : artifactEvent.getArtifacts()) { if (event.is(EventModType.Modified)) { refreshWorkflow = true; break; } } if (refreshWorkflow) { Displays.ensureInDisplayThread(new Runnable() { @Override public void run() { redrawComposite(); } }); } }</code><technical_language>want check if THIS teamWf modified. This refresh for teamWf change</technical_language>

Target:
public void handleArtifactEvent(ArtifactEvent artifactEvent, Sender sender) { if (artifactEvent.isModified(getTeamArt())) { Displays.ensureInDisplayThread(new Runnable() { @Override public void run() { loadTable(); } }); } }
Source:
<code>public void initializedWithPopulatedChangeLog() throws Exception { final QueryChangeLog changeLog = new InMemoryQueryChangeLog(); final QueryRepository queries = new InMemoryQueryRepository( changeLog, SCHEDULE ); try { queries.startAndWait(); final Set<StreamsQuery> expected = new HashSet<>(); expected.add( queries.add("query 1", true) ); final UUID deletedMeId = queries.add("query 2", false).getQueryId(); expected.add( queries.add("query 3", true) ); queries.delete( deletedMeId ); final QueryRepository initializedQueries = new InMemoryQueryRepository( changeLog, SCHEDULE ); try { final Set<StreamsQuery> stored = initializedQueries.list(); assertEquals(expected, stored); } finally { <START> queries.stop(); <END> } } finally { queries.stop(); } }</code><technical_language>This redundant outer try-finally block calling stop(). intent is test handling 2 consecutive calls stop(). try-finally removed</technical_language>

Target:
public void initializedWithPopulatedChangeLog() throws Exception { final QueryChangeLog changeLog = new InMemoryQueryChangeLog(); final QueryRepository queries = new InMemoryQueryRepository( changeLog, SCHEDULE ); try { queries.startAndWait(); final Set<StreamsQuery> expected = new HashSet<>(); expected.add( queries.add("query 1", true) ); final UUID deletedMeId = queries.add("query 2", false).getQueryId(); expected.add( queries.add("query 3", true) ); queries.delete( deletedMeId ); final QueryRepository initializedQueries = new InMemoryQueryRepository( changeLog, SCHEDULE ); final Set<StreamsQuery> stored = initializedQueries.list(); assertEquals(expected, stored); } finally { queries.stop(); } }
Source:
<code>public ManagementResourceRegistration register(ManagementResourceRegistration parent) { ManagementResourceRegistration registration = parent.registerSubModel(this); parent.registerAlias(LEGACY_PATH, new SimpleAliasEntry(registration)); Capability dependentCapability = new BinaryRequirementCapability(InfinispanCacheRequirement.CACHE, BinaryCapabilityNameResolver.GRANDPARENT_PARENT); ResourceDescriptor descriptor = new ResourceDescriptor(this.getResourceDescriptionResolver()) .addAttributes(Attribute.class) .addResourceCapabilityReference(new TransactionResourceCapabilityReference(dependentCapability, TransactionRequirement.TRANSACTION_MANAGER, EnumSet.of(TransactionMode.NONE, TransactionMode.BATCH))) <START> .addResourceCapabilityReference(new TransactionResourceCapabilityReference(dependentCapability, TransactionRequirement.XA_RESOURCE_RECOVERY_REGISTRY, EnumSet.complementOf(EnumSet.of(TransactionMode.NON_XA)))); <END> ResourceServiceHandler handler = new SimpleResourceServiceHandler(TransactionServiceConfigurator::new); new SimpleResourceRegistration(descriptor, handler).register(registration); if (registration.isRuntimeOnlyRegistrationValid()) { new MetricHandler<>(new TransactionMetricExecutor(), TransactionMetric.class).register(registration); } return registration; }</code><technical_language>For XAResourceRecovery capability, excludedModes be: EnumSet.complementOf(EnumSet.of(TransactionMode.FULL_XA)), right</technical_language>

Target:
public ManagementResourceRegistration register(ManagementResourceRegistration parent) { ManagementResourceRegistration registration = parent.registerSubModel(this); parent.registerAlias(LEGACY_PATH, new SimpleAliasEntry(registration)); Capability dependentCapability = new BinaryRequirementCapability(InfinispanCacheRequirement.CACHE, BinaryCapabilityNameResolver.GRANDPARENT_PARENT); ResourceDescriptor descriptor = new ResourceDescriptor(this.getResourceDescriptionResolver()) .addAttributes(Attribute.class) .addResourceCapabilityReference(new TransactionResourceCapabilityReference(dependentCapability, TransactionRequirement.LOCAL_TRANSACTION_PROVIDER, EnumSet.of(TransactionMode.NONE, TransactionMode.BATCH))) .addResourceCapabilityReference(new TransactionResourceCapabilityReference(dependentCapability, TransactionRequirement.XA_RESOURCE_RECOVERY_REGISTRY, EnumSet.complementOf(EnumSet.of(TransactionMode.FULL_XA)))); ResourceServiceHandler handler = new SimpleResourceServiceHandler(TransactionServiceConfigurator::new); new SimpleResourceRegistration(descriptor, handler).register(registration); if (registration.isRuntimeOnlyRegistrationValid()) { new MetricHandler<>(new TransactionMetricExecutor(), TransactionMetric.class).register(registration); } return registration; }
Source:
<code>public LogMetadata() { this.globalTail = Address.NON_ADDRESS; this.streamTails = new HashMap(); <START> this.streamsAddressSpaceMap = new HashMap(); <END> }</code><technical_language>this.streamsAddressSpaceMap = new HashMap<>();</technical_language>

Target:
public LogMetadata() { this.globalTail = Address.NON_ADDRESS; this.streamTails = new HashMap(); this.streamsAddressSpaceMap = new HashMap<>(); }
Source:
<code><START> IndexValue findKey(StoreKey key, FileSpan fileSpan) throws StoreException { <END> return findKey(key, fileSpan, null); }</code><technical_language>overloads is a bit I feel. I omit this method</technical_language>

Target:
IndexValue findKey(StoreKey key, FileSpan fileSpan) throws StoreException { return findKey(key, fileSpan, IndexEntryType.ANY); }
Source:
<code>public String run() throws IOException { Process process = new ProcessBuilder(mCommand).redirectErrorStream(true).start(); BufferedReader inReader = new BufferedReader(new InputStreamReader(process.getInputStream(), Charset.defaultCharset())); try { StringBuilder output = new StringBuilder(); String line = inReader.readLine(); while (line != null) { output.append(line); output.append("\n"); line = inReader.readLine(); } int exitCode = process.waitFor(); if (exitCode != 0) { throw new ShellUtils.ExitCodeException(exitCode, output.toString()); } return output.toString(); } catch (InterruptedException e) { Thread.currentThread().interrupt(); throw new IOException(e); } finally { try { InputStream stdout = process.getInputStream(); synchronized (stdout) { inReader.close(); } } catch (IOException e) { <START> LOG.warn("Error while closing the input stream", e); <END> } process.destroy(); } }</code><technical_language>add a bit more info this message, Error closing input stream of process: %s</technical_language>

Target:
public String run() throws IOException { Process process = new ProcessBuilder(mCommand).redirectErrorStream(true).start(); BufferedReader inReader = new BufferedReader(new InputStreamReader(process.getInputStream(), Charset.defaultCharset())); try { StringBuilder output = new StringBuilder(); String line = inReader.readLine(); while (line != null) { output.append(line); output.append("\n"); line = inReader.readLine(); } int exitCode = process.waitFor(); if (exitCode != 0) { throw new ShellUtils.ExitCodeException(exitCode, output.toString()); } return output.toString(); } catch (InterruptedException e) { Thread.currentThread().interrupt(); throw new IOException(e); } finally { try { InputStream stdout = process.getInputStream(); synchronized (stdout) { inReader.close(); } } catch (IOException e) { LOG.warn(String.format("Error while closing the input stream of process %s: %s", process, e.getMessage())); } process.destroy(); } }
Source:
<code><START> public void syncSearch(VdcQueryType vdcQueryType, VdcQueryParametersBase vdcQueryParametersBase) { <END> AsyncQuery _asyncQuery = new AsyncQuery(); _asyncQuery.setModel(this); _asyncQuery.asyncCallback = new INewAsyncCallback() { @Override public void onSuccess(Object model, Object ReturnValue) { setItems((Collection<T>) ((VdcQueryReturnValue) ReturnValue).getReturnValue()); } }; vdcQueryParametersBase.setRefresh(getIsQueryFirstTime()); Frontend.getInstance().runQuery(vdcQueryType, vdcQueryParametersBase, _asyncQuery); setIsQueryFirstTime(false); }</code><technical_language>this protected in master patch</technical_language>

Target:
protected void syncSearch(VdcQueryType vdcQueryType, VdcQueryParametersBase vdcQueryParametersBase) { AsyncQuery _asyncQuery = new AsyncQuery(); _asyncQuery.setModel(this); _asyncQuery.asyncCallback = new INewAsyncCallback() { @Override public void onSuccess(Object model, Object ReturnValue) { setItems((Collection<T>) ((VdcQueryReturnValue) ReturnValue).getReturnValue()); } }; vdcQueryParametersBase.setRefresh(getIsQueryFirstTime()); Frontend.getInstance().runQuery(vdcQueryType, vdcQueryParametersBase, _asyncQuery); setIsQueryFirstTime(false); }
Source:
<code>private void maybeCheckLocalBitcoinNode(Runnable nextStep) { BaseCurrencyNetwork baseCurrencyNetwork = config.baseCurrencyNetwork; var shouldIgnoreLocalNode = config.ignoreLocalBtcNode || baseCurrencyNetwork.isDaoRegTest() || baseCurrencyNetwork.isDaoTestNet(); if (shouldIgnoreLocalNode) { nextStep.run(); return; } localBitcoinNode.checkUsable(); <START> var detectedButMisconfigured = localBitcoinNode.isDetectedButMisconfigured().get(); <END> if (detectedButMisconfigured) { displayLocalNodeMisconfigurationHandler.accept(nextStep); return; } nextStep.run(); }</code><technical_language>localBitcoinNode.isDetectedButMisconfigured() is optional prudent check present here. for null characteristics of optional is able handle null state</technical_language>

Target:
private void maybeCheckLocalBitcoinNode(Runnable nextStep) { if (localBitcoinNode.shouldBeIgnored()) { nextStep.run(); return; } if (localBitcoinNode.isDetectedButMisconfigured()) { if (displayLocalNodeMisconfigurationHandler != null) { displayLocalNodeMisconfigurationHandler.accept(nextStep); return; } else { log.error("displayLocalNodeMisconfigurationHandler undefined", new RuntimeException()); } } nextStep.run(); }
Source:
<code>public void transitionToWaiting() { if (state == State.WAITING) { <START> return; <END> } state = State.WAITING; mainView.setClickable(false); editText.setActive(false); suggestionDropdown.setVisibility(View.GONE); }</code><technical_language>I avoid changing this public. onSearch in MainActivity...</technical_language>

Target:
private void transitionToWaiting() { if (state == State.WAITING) { return; } state = State.WAITING; mainView.setClickable(false); editText.setActive(false); suggestionDropdown.setVisibility(View.GONE); }
Source:
<code>protected void findMoreStuff() { IInventoryComposite chests = cache.getAdjacentInventories(); for (IInvSlot slot : InventoryIterator.getVanilla(craftMatrix)) { ItemStack stack = slot.getStack(); if (!InvTools.isEmpty(stack) && stack.isStackable() && sizeOf(stack) == 1) { ItemStack request = InvTools.removeOneItem(chests, StackFilters.of(stack)); <START> if (request != null) { <END> inc(stack); break; } if (sizeOf(stack) > 1) break; } } }</code><technical_language>Null check</technical_language>

Target:
protected void findMoreStuff() { IInventoryComposite chests = cache.getAdjacentInventories(); for (IInvSlot slot : InventoryIterator.getVanilla(craftMatrix)) { ItemStack stack = slot.getStack(); if (!InvTools.isEmpty(stack) && stack.isStackable() && sizeOf(stack) == 1) { ItemStack request = InvTools.removeOneItem(chests, StackFilters.of(stack)); if (!isEmpty(request)) { inc(stack); break; } if (sizeOf(stack) > 1) break; } } }
Source:
<code>public void cancelDelayedAction(CancelDelayedActionEvent event, EntityRef entity) { DelayedActionComponent delayedComponent = entity.getComponent(DelayedActionComponent.class); <START> delayedOperationsSortedByTime.remove(delayedComponent.getWorldTime(), new DelayedOperation(entity, delayedComponent.getActionId())); <END> entity.removeComponent(DelayedActionComponent.class); }</code><technical_language>I recommend moving this line a BeforeDeactivatedComponent event handler (or if one, is unnecessary)</technical_language>

Target:
public void cancelDelayedAction(CancelDelayedActionEvent event, EntityRef entity) { entity.removeComponent(DelayedActionComponent.class); }
Source:
<code>public void testCatchErrorOnEmbeddedSubprocessWithEmptyErrorCode() { try { testCatchErrorOnEmbeddedSubprocess(); } catch (ActivitiException re) { } <START> } <END></code><technical_language>this test initial @Deployment annotation here, process definition before</technical_language>

Target:
public void testCatchErrorOnEmbeddedSubprocessWithEmptyErrorCode() { Throwable throwable = catchThrowable(() -> repositoryService .createDeployment() .addClasspathResource("org/activiti/engine/test/bpmn/event/error/BoundaryErrorEventTest.testCatchErrorOnEmbeddedSubprocessWithEmptyErrorCode.bpmn20.xml") .deploy()); assertThat(throwable).isInstanceOf(ActivitiException.class) .hasMessageContaining("activiti-error-missing-error-code"); }
Source:
<code>private void editPipeline() throws Exception { CvPipeline pipeline = partSettings.getPipeline(); Camera camera = Configuration.get().getMachine().getDefaultHead().getDefaultCamera(); pipeline.setProperty("camera", camera); pipeline.setProperty("part", part); pipeline.setProperty("package", part.getPackage()); pipeline.setProperty("footprint", part.getPackage().getFootprint()); CvPipelineEditor editor = new CvPipelineEditor(pipeline); JDialog dialog = new CvPipelineEditorDialog(MainFrame.get(), "Fiducial Locator Pipeline", editor); dialog.setVisible(true); <START> editor.initializeFocus(); <END> }</code><technical_language>this line removed</technical_language>

Target:
private void editPipeline() throws Exception { CvPipeline pipeline = partSettings.getPipeline(); Camera camera = Configuration.get().getMachine().getDefaultHead().getDefaultCamera(); pipeline.setProperty("camera", camera); pipeline.setProperty("part", part); pipeline.setProperty("package", part.getPackage()); pipeline.setProperty("footprint", part.getPackage().getFootprint()); CvPipelineEditor editor = new CvPipelineEditor(pipeline); JDialog dialog = new CvPipelineEditorDialog(MainFrame.get(), "Fiducial Locator Pipeline", editor); dialog.setVisible(true); }
Source:
<code>public Response<Set<String>> apply(ChangeResource req, Input input) throws AuthException, OrmException, IOException, BadRequestException { if (input == null || Strings.isNullOrEmpty(input.hashtags)) { throw new BadRequestException("Hashtags are required"); } ChangeControl control = req.getControl(); if (!control.canEditHashtags()) { throw new AuthException("Editing hashtags not permitted"); } ChangeUpdate update = updateFactory.create(control); ChangeNotes notes = control.getNotes().load(); Set<String> existingHashtags = notes.getHashtags(); <START> Set<String> updatedHashtags = new HashSet<String>(); Set<String> added = new HashSet<String>(); <END> ArrayList<String> toAdd = Lists.newArrayList(Splitter.on(CharMatcher.anyOf(",;")) .trimResults().split(input.hashtags)); if (existingHashtags != null) { updatedHashtags.addAll(existingHashtags); for (String hashtag: toAdd) { if (!existingHashtags.contains(hashtag)) { added.add(hashtag); } } } if (added.size() > 0) { updatedHashtags.addAll(added); update.setHashtags(updatedHashtags); update.commit(); IdentifiedUser currentUser = ((IdentifiedUser) control.getCurrentUser()); hooks.doHashtagsEditedHook( req.getChange(), currentUser.getAccount(), added, null, updatedHashtags, dbProvider.get()); } return Response.ok(updatedHashtags); }</code><technical_language>s/new HashSet<String>()/new HashSet<>()</technical_language>

Target:
public Response<Set<String>> apply(ChangeResource req, Input input) throws AuthException, OrmException, IOException, BadRequestException { if (input == null || Strings.isNullOrEmpty(input.hashtags)) { throw new BadRequestException("Hashtags are required"); } ChangeControl control = req.getControl(); if (!control.canEditHashtags()) { throw new AuthException("Editing hashtags not permitted"); } ChangeUpdate update = updateFactory.create(control); ChangeNotes notes = control.getNotes().load(); Set<String> existingHashtags = notes.getHashtags(); Set<String> updatedHashtags = new HashSet<String>(); Set<String> added = new HashSet<String>(); ArrayList<String> toAdd = Lists.newArrayList(Splitter.on(CharMatcher.anyOf(",;")) .trimResults().split(input.hashtags)); if (existingHashtags != null) { updatedHashtags.addAll(existingHashtags); for (String hashtag: toAdd) { if (!existingHashtags.contains(hashtag)) { added.add(hashtag); } } } if (added.size() > 0) { updatedHashtags.addAll(added); update.setHashtags(updatedHashtags); update.commit(); indexer.index(dbProvider.get(), update.getChange()); IdentifiedUser currentUser = ((IdentifiedUser) control.getCurrentUser()); hooks.doHashtagsEditedHook( req.getChange(), currentUser.getAccount(), added, null, updatedHashtags, dbProvider.get()); } return Response.ok(updatedHashtags); }
Source:
<code>public void actionPerformed(ActionEvent event) { final String METHOD_NAME = "actionPerformed(ActionEvent)"; if(event.getActionCommand().equals(GM_TOOL_DICE)) { performDiceRoll(); } if(event.getActionCommand().equals(RAT_ROLLER_TOOL)) { lastRolledUnit = performRollRat(); } if(event.getActionCommand().equals(RAT_ADDER_TOOL)) { if (lastRolledUnit == null) { lastRolledUnit = performRollRat(); } <START> Entity e; <END> try { e = new MechFileParser(lastRolledUnit.getSourceFile(), lastRolledUnit.getEntryName()).getEntity(); Unit u = gui.getCampaign().addUnit(e, false, 0); if (person != null) { u.addPilotOrSoldier(person); person.setOriginalUnit(u); setVisible(false); } lastRolledUnit = null; } catch (EntityLoadingException e1) { MekHQ.getLogger().log(getClass(), METHOD_NAME, LogLevel.ERROR, "Failed to load entity " + lastRolledUnit.getName() + " from " + lastRolledUnit.getSourceFile().toString()); MekHQ.getLogger().error(getClass(), METHOD_NAME, e1); unitPicked.setText("Failed to load entity " + lastRolledUnit.getName()); } } }</code><technical_language>null check is performRollRat() return null</technical_language>

Target:
public void actionPerformed(ActionEvent event) { final String METHOD_NAME = "actionPerformed(ActionEvent)"; if(event.getActionCommand().equals(GM_TOOL_DICE)) { performDiceRoll(); } if(event.getActionCommand().equals(RAT_ROLLER_TOOL)) { lastRolledUnit = performRollRat(); } if(event.getActionCommand().equals(RAT_ADDER_TOOL)) { if (lastRolledUnit == null) { lastRolledUnit = performRollRat(); } if (lastRolledUnit != null) { Entity e; try { e = new MechFileParser(lastRolledUnit.getSourceFile(), lastRolledUnit.getEntryName()).getEntity(); Unit u = gui.getCampaign().addUnit(e, false, 0); if (person != null) { u.addPilotOrSoldier(person); person.setOriginalUnit(u); setVisible(false); } lastRolledUnit = null; } catch (EntityLoadingException e1) { MekHQ.getLogger().log(getClass(), METHOD_NAME, LogLevel.ERROR, "Failed to load entity " + lastRolledUnit.getName() + " from " + lastRolledUnit.getSourceFile().toString()); MekHQ.getLogger().error(getClass(), METHOD_NAME, e1); unitPicked.setText("Failed to load entity " + lastRolledUnit.getName()); } } } }
Source:
<code>public void testAddPartition() throws Exception { String topic = "test"; int partition = 0; TopicPartition topicPart = new TopicPartition(topic, partition); Set<TopicPartition> assignment = new HashSet<>(); assignment.add(topicPart); HdfsWriter hdfsWriter = new HdfsWriter(connectorConfig, assignment); hdfsWriter.recover(topicPart); String key = "key"; org.apache.kafka.copycat.data.Schema schema = createSchema(); Struct record = createRecord(schema); for (long offset = 0; offset < 7; offset++) { SinkRecord sinkRecord = new SinkRecord(topic, partition, org.apache.kafka.copycat.data.Schema.STRING_SCHEMA, key, schema, record, offset); hdfsWriter.writeRecord(topicPart, sinkRecord); } hdfsWriter.close(); fs.delete(new Path(FileUtils.logFileName(url, topicsDir, topicPart)), false); Schema avroSchema = AvroData.fromCopycatSchema(createSchema()); HiveExec hiveExec = new HiveExec(conf, connectorConfig); runHive(hiveExec, "DROP TABLE " + topic); hiveExec.createAvroTable(topic, avroSchema); hiveExec.addPartition(topic, 0); hiveExec.setPartitionLoc(topic, 0); <START> String[] expectedResult = {"true", "12", "12", "12.2", "12.2", "0"}; <END> String result = runHive(hiveExec, "SELECT * from " + topic); String[] rows = result.split("\n"); assertEquals(7, rows.length); for (String row: rows) { String[] parts = row.replace(" ", "").split("\t"); for (int j = 0; j < expectedResult.length; ++j) { assertEquals(expectedResult[j], parts[j]); } } }</code><technical_language>is "0" end from? 5 columns</technical_language>

Target:
public void testAddPartition() throws Exception { prepareData(TOPIC, PARTITION); Schema avroSchema = avroData.fromCopycatSchema(createSchema()); HiveExec hiveExec = new HiveExec(conf, connectorConfig); runHive(hiveExec, "DROP TABLE " + TOPIC); hiveExec.createAvroTable(TOPIC, avroSchema); hiveExec.addPartition(TOPIC, PARTITION); hiveExec.setPartitionLoc(TOPIC, PARTITION); String[] expectedResult = {"true", "12", "12", "12.2", "12.2", "12"}; String result = runHive(hiveExec, "SELECT * from " + TOPIC); String[] rows = result.split("\n"); assertEquals(7, rows.length); for (String row: rows) { String[] parts = parseOutput(row); for (int j = 0; j < expectedResult.length; ++j) { assertEquals(expectedResult[j], parts[j]); } } }
Source:
<code><START> public List<String> getUserStoresPrefixList() throws JSONException { <END> UserAccount userAccount = getUserAccountManager().getCurrentUser(); String communityId = userAccount!=null?userAccount.getCommunityId():null; List<String> userDBName = DBOpenHelper.getUserDatabasePrefixList(context,getUserAccountManager().getCurrentUser(),communityId); return userDBName; }</code><technical_language>call method getUserStoreNames() instead</technical_language>

Target:
public List<String> getUserStoresPrefixList() { UserAccount userAccount = getUserAccountManager().getCurrentUser(); String communityId = userAccount!=null?userAccount.getCommunityId():null; List<String> userDBName = DBOpenHelper.getUserDatabasePrefixList(context,getUserAccountManager().getCurrentUser(),communityId); return userDBName; }
Source:
<code>public List<String> getNodeIpsAndPorts(MesosUnicastHostsProvider mesosUnicastHostsProvider) { <START> String taskHostName = "_" + Configuration.TASK_NAME + "._tcp." + Configuration.FRAMEWORK_NAME + ".mesos"; <END> final ArrayList<String> nodes = Lists.newArrayList(); Attributes attrs; NamingEnumeration<?> enumeration; try { attrs = ctx.getAttributes(taskHostName, new String[]{"SRV"}); final Attribute srvRecords = attrs.get("SRV"); if (srvRecords != null && srvRecords.size() > 0) { enumeration = srvRecords.getAll(); while (enumeration.hasMore()) { SrvRecord record = new SrvRecord((String) enumeration.next()); nodes.add(record.getHostAndPort()); } } } catch (NamingException e) { throw new RuntimeException("Failed to resolve hostname", e); } return nodes; }</code><technical_language>Technically, domain mesos configurable</technical_language>

Target:
public List<String> getNodeIpsAndPorts(MesosUnicastHostsProvider mesosUnicastHostsProvider) { String taskHostName = "_" + Configuration.TASK_NAME + "._tcp." + Configuration.FRAMEWORK_NAME + "." + Configuration.DOMAIN; final ArrayList<String> nodes = Lists.newArrayList(); Attributes attrs; NamingEnumeration<?> enumeration; try { attrs = ctx.getAttributes(taskHostName, new String[]{"SRV"}); final Attribute srvRecords = attrs.get("SRV"); if (srvRecords != null && srvRecords.size() > 0) { enumeration = srvRecords.getAll(); while (enumeration.hasMore()) { SrvRecord record = new SrvRecord((String) enumeration.next()); nodes.add(record.getHostAndPort()); } } } catch (NamingException e) { throw new RuntimeException("Failed to resolve hostname", e); } return nodes; }
Source:
<code>public void testUseMetaAfterCreate() throws IOException { DataFileWriter<?> w = new DataFileWriter<>(new GenericDatumWriter<>()); w.create(Schema.create(Type.NULL), new ByteArrayOutputStream()); w.setMeta("foo", "bar"); <START> w.close(); <END> }</code><technical_language>a try-with-resource pattern here</technical_language>

Target:
public void testUseMetaAfterCreate() throws IOException { try (DataFileWriter<?> w = new DataFileWriter<>(new GenericDatumWriter<>())) { w.create(Schema.create(Type.NULL), new ByteArrayOutputStream()); w.setMeta("foo", "bar"); } }
Source:
<code>public DocumentTypeDescriptor merge(DocumentTypeDescriptor other) { if (schemas == null) { schemas = other.schemas; } else { if (other.schemas != null) { List<SchemaDescriptor> mergedSchemas = new ArrayList<SchemaDescriptor>(Arrays.asList(schemas)); mergedSchemas.addAll(Arrays.asList(other.schemas)); schemas = mergedSchemas.toArray(new SchemaDescriptor[mergedSchemas.size()]); } } if (facets == null) { facets = other.facets; } else { if (other.facets != null) { List<String> mergedFacets = new ArrayList<String>(Arrays.asList(facets)); mergedFacets.addAll(Arrays.asList(other.facets)); facets = mergedFacets.toArray(new String[mergedFacets.size()]); } } if (prefetch == null) { prefetch = other.prefetch; } else { if (other.prefetch != null) { prefetch = prefetch + " " + other.prefetch; } } if (subtypes == null) { subtypes = other.subtypes; } else if (other.subtypes != null) { <START> List<String> mergedTypes = new ArrayList<String>(Arrays.asList(subtypes)); <END> mergedTypes.addAll(Arrays.asList(other.subtypes)); subtypes = mergedTypes.toArray(new String[mergedTypes.size()]); } if (blacklistedSubtypes == null) { blacklistedSubtypes = other.blacklistedSubtypes; } else if (other.blacklistedSubtypes != null) { List<String> mergedTypes = new ArrayList<String>(Arrays.asList(blacklistedSubtypes)); mergedTypes.addAll(Arrays.asList(other.blacklistedSubtypes)); blacklistedSubtypes = mergedTypes.toArray(new String[mergedTypes.size()]); } return this; }</code><technical_language>new ArrayList<>(...)</technical_language>

Target:
public DocumentTypeDescriptor merge(DocumentTypeDescriptor other) { if (schemas == null) { schemas = other.schemas; } else { if (other.schemas != null) { List<SchemaDescriptor> mergedSchemas = new ArrayList<SchemaDescriptor>(Arrays.asList(schemas)); mergedSchemas.addAll(Arrays.asList(other.schemas)); schemas = mergedSchemas.toArray(new SchemaDescriptor[mergedSchemas.size()]); } } if (facets == null) { facets = other.facets; } else { if (other.facets != null) { List<String> mergedFacets = new ArrayList<String>(Arrays.asList(facets)); mergedFacets.addAll(Arrays.asList(other.facets)); facets = mergedFacets.toArray(new String[mergedFacets.size()]); } } if (prefetch == null) { prefetch = other.prefetch; } else { if (other.prefetch != null) { prefetch = prefetch + " " + other.prefetch; } } if (subtypes == null) { subtypes = other.subtypes; } else if (other.subtypes != null) { List<String> mergedTypes = new ArrayList<>(Arrays.asList(subtypes)); mergedTypes.addAll(Arrays.asList(other.subtypes)); subtypes = mergedTypes.toArray(new String[mergedTypes.size()]); } if (forbiddenSubtypes == null) { forbiddenSubtypes = other.forbiddenSubtypes; } else if (other.forbiddenSubtypes != null) { List<String> mergedTypes = new ArrayList<>(Arrays.asList(forbiddenSubtypes)); mergedTypes.addAll(Arrays.asList(other.forbiddenSubtypes)); forbiddenSubtypes = mergedTypes.toArray(new String[mergedTypes.size()]); } return this; }
Source:
<code>public int hdel(List<ByteArrayWrapper> subList) { AtomicLong numDeleted = new AtomicLong(); region().computeIfPresent(key, (_unused_, oldHash) -> { HashMap<ByteArrayWrapper, ByteArrayWrapper> newHash = new HashMap<>(oldHash); for (ByteArrayWrapper fieldToRemove : subList) { Object oldValue = newHash.remove(fieldToRemove); if (oldValue != null) { numDeleted.incrementAndGet(); } } return newHash; }); return numDeleted.intValue(); <START> } <END></code><technical_language>set methods modifying in place, I safe return result of region.get() here, compute copying</technical_language>

Target:
public int hdel(List<ByteArrayWrapper> subList) { AtomicLong numDeleted = new AtomicLong(); region().computeIfPresent(key, (_unused_, oldHash) -> { HashMap<ByteArrayWrapper, ByteArrayWrapper> newHash = new HashMap<>(oldHash); for (ByteArrayWrapper fieldToRemove : subList) { newHash.remove(fieldToRemove); } numDeleted.set(oldHash.size() - newHash.size()); return newHash; }); return numDeleted.intValue(); }