auphong2707/dl4se-code-review-dataset huggingface dataset:
Source:
<code>public ResourceIterator<StoreFileMetadata> build() throws IOException { List<StoreFileMetadata> files = new ArrayList<>(); List<Resource> resources = new ArrayList<>(); if ( !excludeNonRecordStoreFiles ) { gatherNonRecordStores( files, !excludeLogFiles ); } if ( !excludeNeoStoreFiles ) { gatherNeoStoreFiles( files ); } if ( !excludeLabelScanStoreFiles ) { resources.add( neoStoreFileIndexListing.gatherLabelScanStoreFiles( files ) ); } if ( !excludeSchemaIndexStoreFiles ) { <START> resources.add( neoStoreFileIndexListing.gatherSchemaIndexFiles( files ) ); <END> } if ( !excludeExplicitIndexStoreFiles ) { resources.add( neoStoreFileIndexListing.gatherExplicitIndexFiles( files ) ); } if ( !excludeAdditionalProviders ) { for ( StoreFileProvider additionalProvider : additionalProviders ) { resources.add( additionalProvider.addFilesTo( files ) ); } } placeMetaDataStoreLast( files ); return resourceIterator( files.iterator(), new MultiResource( resources ) ); }</code><technical_language>identical MultiResource classes. embedded in this class, copied for indexes. Please remove one</technical_language>

Target:
public ResourceIterator<StoreFileMetadata> build() throws IOException { List<StoreFileMetadata> files = new ArrayList<>(); List<Resource> resources = new ArrayList<>(); try { if ( !excludeNonRecordStoreFiles ) { gatherNonRecordStores( files, !excludeLogFiles ); } if ( !excludeNeoStoreFiles ) { gatherNeoStoreFiles( files ); } if ( !excludeLabelScanStoreFiles ) { resources.add( neoStoreFileIndexListing.gatherLabelScanStoreFiles( files ) ); } if ( !excludeSchemaIndexStoreFiles ) { resources.add( neoStoreFileIndexListing.gatherSchemaIndexFiles( files ) ); } if ( !excludeExplicitIndexStoreFiles ) { resources.add( neoStoreFileIndexListing.gatherExplicitIndexFiles( files ) ); } if ( !excludeAdditionalProviders ) { for ( StoreFileProvider additionalProvider : additionalProviders ) { resources.add( additionalProvider.addFilesTo( files ) ); } } placeMetaDataStoreLast( files ); } catch ( IOException e ) { try { IOUtils.closeAll( resources ); } catch ( IOException e1 ) { e = Exceptions.chain( e, e1 ); } throw e; } return resourceIterator( files.iterator(), new MultiResource( resources ) ); }
Source:
<code>public static Collection<Object[]> data() { Object[][] data = new Object[][] { {SYNC, <START> (BiFunction<Transaction, AtomicInteger, Transaction>) (transaction, counter) -> transaction, <END> (BiFunction<KeyValueService, AtomicInteger, KeyValueService>) (keyValueService, counter) -> keyValueService}, {ASYNC, (BiFunction<Transaction, AtomicInteger, Transaction>) GetAsyncDelegate::new, (BiFunction<KeyValueService, AtomicInteger, KeyValueService>) VerifyingDelegate::new} }; return Arrays.asList(data); }</code><technical_language>introduce interface, type parameters in way: java interface WrapperWithCounter<T> { T apply(T toWrap, AtomicInteger counter); }</technical_language>

Target:
public static Collection<Object[]> data() { Object[][] data = new Object[][] { { SYNC, WrapperWithTracker.TRANSACTION_NO_OP, WrapperWithTracker.KEY_VALUE_SERVICE_NO_OP }, { ASYNC, (WrapperWithTracker<Transaction>) GetAsyncDelegate::new, (WrapperWithTracker<KeyValueService>) VerifyingKeyValueServiceDelegate::new } }; return Arrays.asList(data); }
Source:
<code>public List<RichUserExtSource> getRichUserExtSources(PerunSession sess, User user) throws InternalErrorException, UserNotExistsException, PrivilegeException { Utils.checkPerunSession(sess); if(!AuthzResolver.isAuthorized(sess, Role.VOADMIN) && !AuthzResolver.isAuthorized(sess, Role.VOOBSERVER) && !AuthzResolver.isAuthorized(sess, Role.GROUPADMIN) && !AuthzResolver.isAuthorized(sess, Role.ENGINE) && !AuthzResolver.isAuthorized(sess, Role.RPC) && !AuthzResolver.isAuthorized(sess, Role.SELF, user) && !AuthzResolver.isAuthorized(sess, Role.PERUNOBSERVER)) { throw new PrivilegeException(sess, "getRichUserExtSources"); } getUsersManagerBl().checkUserExists(sess, user); <START> return getUsersManagerBl().getRichUserExtSources(sess, user); <END> }</code><technical_language>implement filterOnlyAllowedAttributes() method perform authorization check list of RichUserExtSource for groups members. part of Bl layers called here. Also, I if authorization check ues attributes. I believe, right accessible perun admin, need configure instance deployment</technical_language>

Target:
public List<RichUserExtSource> getRichUserExtSources(PerunSession sess, User user) throws InternalErrorException, UserNotExistsException, PrivilegeException { return getRichUserExtSources(sess, user, null); }
Source:
<code>public String toString() { return "LockRequestForNewSegment{" + "lockGranularity=" + lockGranularity + ", lockType=" + lockType + ", groupId='" + groupId + '\'' + ", dataSource='" + dataSource + '\'' + ", interval=" + interval + <START> ", shardSpecFactory=" + partialShardSpec + <END> ", priority=" + priority + ", sequenceName='" + sequenceName + '\'' + ", previsousSegmentId='" + previsousSegmentId + '\'' + ", skipSegmentLineageCheck=" + skipSegmentLineageCheck + '}'; }</code><technical_language>shardSpecFactory -> partialShardSpec. Lombok nice hide of this :)</technical_language>

Target:
public String toString() { return "LockRequestForNewSegment{" + "lockGranularity=" + lockGranularity + ", lockType=" + lockType + ", groupId='" + groupId + '\'' + ", dataSource='" + dataSource + '\'' + ", interval=" + interval + ", partialShardSpec=" + partialShardSpec + ", priority=" + priority + ", sequenceName='" + sequenceName + '\'' + ", previsousSegmentId='" + previsousSegmentId + '\'' + ", skipSegmentLineageCheck=" + skipSegmentLineageCheck + '}'; }
Source:
<code>private void setStyle() { <START> inboundAverageEditor.setContentWidgetStyleName(style.valueWidth()); <END> inboundAverageEditor.setLabelStyleName(style.hideLabelStyle()); inboundPeakEditor.setContentWidgetStyleName(style.valueWidth()); inboundPeakEditor.setLabelStyleName(style.hideLabelStyle()); inboundBurstEditor.setContentWidgetStyleName(style.valueWidth()); inboundBurstEditor.setLabelStyleName(style.hideLabelStyle()); outboundAverageEditor.setContentWidgetStyleName(style.valueWidth()); outboundAverageEditor.setLabelStyleName(style.hideLabelStyle()); outboundPeakEditor.setContentWidgetStyleName(style.valueWidth()); outboundPeakEditor.setLabelStyleName(style.hideLabelStyle()); outboundBurstEditor.setContentWidgetStyleName(style.valueWidth()); outboundBurstEditor.setLabelStyleName(style.hideLabelStyle()); }</code><technical_language>disappointing, if widget displayed in EntityModelTextBoxOnlyEditor is text box, I expected able set style easily. If feel extra-responsible today override setStyle() method set style of content widget :)</technical_language>

Target:
private void setStyle() { inboundAverageEditor.setContentWidgetStyleName(style.valueWidth()); inboundPeakEditor.setContentWidgetStyleName(style.valueWidth()); inboundBurstEditor.setContentWidgetStyleName(style.valueWidth()); outboundAverageEditor.setContentWidgetStyleName(style.valueWidth()); outboundPeakEditor.setContentWidgetStyleName(style.valueWidth()); outboundBurstEditor.setContentWidgetStyleName(style.valueWidth()); }
Source:
<code>public void testCalculateReducedPanelAndPInversesUsingJollifesRule(final ReadCountCollection readCounts) { final CreatePanelOfNormals.ReductionResult result = CreatePanelOfNormals.calculateReducedPanelAndPInverses(readCounts, OptionalInt.empty(), NULL_LOGGER); final RealMatrix counts = readCounts.counts(); Assert.assertNotNull(result); Assert.assertNotNull(result.pseudoInverse); Assert.assertNotNull(result.reduced); Assert.assertNotNull(result.reducedInverse); Assert.assertNotNull(result.allSingularValues); Assert.assertEquals(counts.getColumnDimension(), result.allSingularValues.length); Assert.assertEquals(result.reduced.getRowDimension(), counts.getRowDimension()); final int eigenSamples = result.reduced.getColumnDimension(); final Mean mean = new Mean(); <START> final double meanSingleValue = mean.evaluate(result.allSingularValues); <END> final double threshold = CreatePanelOfNormals.JOLLIFES_RULE_MEAN_FACTOR * meanSingleValue; final int expectedEigenSamples = (int) DoubleStream.of(result.allSingularValues).filter(d -> d >= threshold).count(); Assert.assertTrue(eigenSamples <= counts.getColumnDimension()); Assert.assertEquals(eigenSamples, expectedEigenSamples); assertPseudoInverse(counts, result.pseudoInverse); assertPseudoInverse(result.reduced, result.reducedInverse); }</code><technical_language>meanSingularValue</technical_language>

Target:
public void testCalculateReducedPanelAndPInversesUsingJollifesRule(final ReadCountCollection readCounts) { final CreatePanelOfNormals.ReductionResult result = CreatePanelOfNormals.calculateReducedPanelAndPInverses(readCounts, OptionalInt.empty(), NULL_LOGGER); final RealMatrix counts = readCounts.counts(); Assert.assertNotNull(result); Assert.assertNotNull(result.pseudoInverse); Assert.assertNotNull(result.reduced); Assert.assertNotNull(result.reducedInverse); Assert.assertNotNull(result.allSingularValues); Assert.assertEquals(counts.getColumnDimension(), result.allSingularValues.length); Assert.assertEquals(result.reduced.getRowDimension(), counts.getRowDimension()); final int eigenSamples = result.reduced.getColumnDimension(); final Mean mean = new Mean(); final double meanSingularValue = mean.evaluate(result.allSingularValues); final double threshold = CreatePanelOfNormals.JOLLIFES_RULE_MEAN_FACTOR * meanSingularValue; final int expectedEigenSamples = (int) DoubleStream.of(result.allSingularValues).filter(d -> d >= threshold).count(); Assert.assertTrue(eigenSamples <= counts.getColumnDimension()); Assert.assertEquals(eigenSamples, expectedEigenSamples); assertPseudoInverse(counts, result.pseudoInverse); assertPseudoInverse(result.reduced, result.reducedInverse); }
Source:
<code>public ZookeeperClient connect(URL url) { ZookeeperClientData clientData; List<String> addressList = getURLBackupAddress(url); <START> if ((clientData = fetchAndUpdateZookeeperClientCache(url, addressList)) != null) { <END> logger.info("ZookeeperTransporter.connnect result from map:" + clientData); return clientData.getZookeeperClient(); } ZookeeperClient zookeeperClient = null; synchronized (zookeeperClientMap) { if ((clientData = fetchAndUpdateZookeeperClientCache(url, addressList)) != null) { logger.info("ZookeeperTransporter.connnect result from map2:" + clientData); return clientData.getZookeeperClient(); } Set<URL> originalURLs = new HashSet<>(2); originalURLs.add(url); zookeeperClient = createZookeeperClient(createServerURL(url), originalURLs); ZookeeperClientData zookeeperClientData = new ZookeeperClientData(zookeeperClient, originalURLs); logger.info("ZookeeperTransporter.connnect result from new connection. " + clientData); writeToClientMap(addressList, zookeeperClientData); } return zookeeperClient; }</code><technical_language>is method **fetchAndUpdateZookeeperClientCache** is thread safe. In defintion of method **fetchAndUpdateZookeeperClientCache** global cache **zookeeperClientMap** if multiple client calls constructor concurrency issue come. do say</technical_language>

Target:
public ZookeeperClient connect(URL url) { ZookeeperClient zookeeperClient; List<String> addressList = getURLBackupAddress(url); if ((zookeeperClient = fetchAndUpdateZookeeperClientCache(addressList)) != null && zookeeperClient.isConnected()) { logger.info("Get result from map for the first time when invoking zookeeperTransporter.connnect ."); return zookeeperClient; } synchronized (zookeeperClientMap) { if ((zookeeperClient = fetchAndUpdateZookeeperClientCache(addressList)) != null && zookeeperClient.isConnected()) { logger.info("Get result from map for the second time when invoking zookeeperTransporter.connnect ."); return zookeeperClient; } zookeeperClient = createZookeeperClient(createServerURL(url)); logger.info("Get result by creating new connection when invoking zookeeperTransporter.connnect ."); writeToClientMap(addressList, zookeeperClient); } return zookeeperClient; }
Source:
<code>protected boolean canDoAction() { ArrayList<String> canDoActionMessages = getReturnValue().getCanDoActionMessages(); return isImageExist() && checkOperationIsCorrect() && canFindVmOrTemplate() && isImageIsNotLocked() && isSourceAndDestTheSame() && validateSourceStorageDomain(canDoActionMessages) && validateDestStorage(canDoActionMessages) && checkTemplateInDestStorageDomain() && validateSpaceRequirements() && ImagesHandler.CheckImageConfiguration(getStorageDomain().getStorageStaticData(), getImage(), canDoActionMessages) <START> && checkCanBeMoveInVm() && checkIfNeedToBeOverride() <END> && acquireLockInternal(); }</code><technical_language>wrong place for lock</technical_language>

Target:
protected boolean canDoAction() { ArrayList<String> canDoActionMessages = getReturnValue().getCanDoActionMessages(); return isImageExist() && checkOperationIsCorrect() && canFindVmOrTemplate() && acquireLockInternal() && isImageIsNotLocked() && isSourceAndDestTheSame() && validateSourceStorageDomain(canDoActionMessages) && validateDestStorage(canDoActionMessages) && checkTemplateInDestStorageDomain() && validateSpaceRequirements() && ImagesHandler.CheckImageConfiguration(getStorageDomain().getStorageStaticData(), getImage(), canDoActionMessages) && checkCanBeMoveInVm() && checkIfNeedToBeOverride(); }
Source:
<code>public void setUserActivationKey_shouldCreateUserActivationKey() throws MessageException { User u = new User(); u.setPerson(new Person()); u.addName(new PersonName("Benjamin", "A", "Wolfe")); u.setUsername("bwolfe"); u.getPerson().setGender("M"); Context.getAdministrationService().setGlobalProperty(OpenmrsConstants.GP_HOST_URL, "http://localhost:8080/openmrs/admin/users/changePassword.form/{activationKey}"); User createdUser = userService.createUser(u, "Openmr5xy"); assertNull(dao.getLoginCredential(createdUser).getActivationKey()); expectedException.expect(MessageException.class); assertNotNull(dao.getLoginCredential(createdUser).getActivationKey()); <START> } <END></code><technical_language>compiled notice test passed? check line 1394</technical_language>

Target:
public void setUserActivationKey_shouldCreateUserActivationKey() throws Exception { User u = new User(); u.setPerson(new Person()); u.addName(new PersonName("Benjamin", "A", "Wolfe")); u.setUsername("bwolfe"); u.getPerson().setGender("M"); Context.getAdministrationService().setGlobalProperty(OpenmrsConstants.GP_HOST_URL, "http://localhost:8080/openmrs/admin/users/changePassword.form/{activationKey}"); User createdUser = userService.createUser(u, "Openmr5xy"); assertNull(dao.getLoginCredential(createdUser).getActivationKey()); expectedException.expect(MessageException.class); assertEquals(createdUser, userService.setUserActivationKey(createdUser)); assertNotNull(dao.getLoginCredential(createdUser).getActivationKey()); }
Source:
<code>private MdbContainer getMdbContainer(final String containerId) { final ContainerSystem containerSystem = SystemInstance.get().getComponent(ContainerSystem.class); <START> if (containerSystem == null) { <END> return null; } if (containerId == null || containerId.length() == 0) { final Container[] containers = containerSystem.containers(); for (Container container : containers) { if (MdbContainer.class.isInstance(container)) { return MdbContainer.class.cast(container); } } return null; } final Container container = containerSystem.getContainer(containerId); if (MdbContainer.class.isInstance(container)) { return MdbContainer.class.cast(container); } return null; }</code><technical_language>needed, happen (don't trust IDE this ;))</technical_language>

Target:
private MdbContainer getMdbContainer(final String containerId) { final ContainerSystem containerSystem = SystemInstance.get().getComponent(ContainerSystem.class); if (containerId == null || containerId.length() == 0) { final Container[] containers = containerSystem.containers(); for (Container container : containers) { if (MdbContainer.class.isInstance(container)) { return MdbContainer.class.cast(container); } } return null; } final Container container = containerSystem.getContainer(containerId); if (MdbContainer.class.isInstance(container)) { return MdbContainer.class.cast(container); } return null; }
Source:
<code>public boolean equals(Object obj) { if (this == obj) return true; if (obj == null) return false; if (getClass() != obj.getClass()) return false; Host other = (Host) obj; <START> if (!getOuterType().equals(other.getOuterType())) <END> return false; if (address == null) { if (other.address != null) return false; } else if (!address.equals(other.address)) return false; return true; }</code><technical_language>outerType is needed compare Host instances</technical_language>

Target:
public boolean equals(Object obj) { if (this == obj) return true; if (obj == null) return false; if (!(obj instanceof Host)) return false; Host other = (Host) obj; if (address == null) { if (other.address != null) return false; } else if (!address.equals(other.address)) return false; return true; }
Source:
<code>public void stop() { _logger.info("{} stopping", _taskName); _shutdown = true; if (_latestBrokerOffsetsFetcher != null) { <START> _latestBrokerOffsetsFetcher.shutdown(); <END> } if (_consumer != null) { _consumer.wakeup(); } _consumerMetrics.deregisterMetrics(); }</code><technical_language>nitpick: _latestBrokerOffsetsFetcher = null; // shutdown</technical_language>

Target:
public void stop() { _logger.info("{} stopping", _taskName); _shutdown = true; if (_latestBrokerOffsetsFetcher != null) { _latestBrokerOffsetsFetcher.shutdown(); _latestBrokerOffsetsFetcher = null; } if (_consumer != null) { _logger.info("Waking up the consumer for task {}", _taskName); _consumer.wakeup(); } _consumerMetrics.deregisterMetrics(); }
Source:
<code>public static String getApplicationDataDirectory() { String filepath = null; <START> String openmrsDir = "OpenMRS"; <END> String systemProperty = System.getProperty(OpenmrsConstants.KEY_OPENMRS_APPLICATION_DATA_DIRECTORY); if (StringUtils.isNotBlank(systemProperty)) { filepath = systemProperty; } else { String runtimeProperty = Context.getRuntimeProperties().getProperty( OpenmrsConstants.APPLICATION_DATA_DIRECTORY_RUNTIME_PROPERTY, null); if (StringUtils.isNotBlank(runtimeProperty)) { filepath = runtimeProperty; } } if (filepath == null) { if (OpenmrsConstants.UNIX_BASED_OPERATING_SYSTEM) { filepath = System.getProperty("user.home") + File.separator + "." + openmrsDir; if (!canWrite(new File(filepath))) { log.warn("Unable to write to users home dir, fallback to: " + OpenmrsConstants.APPLICATION_DATA_DIRECTORY_FALLBACK_UNIX); filepath = OpenmrsConstants.APPLICATION_DATA_DIRECTORY_FALLBACK_UNIX + File.separator + openmrsDir; } } else { filepath = System.getProperty("user.home") + File.separator + "Application Data" + File.separator + "OpenMRS"; if (!canWrite(new File(filepath))) { log.warn("Unable to write to users home dir, fallback to: " + OpenmrsConstants.APPLICATION_DATA_DIRECTORY_FALLBACK_WIN); filepath = OpenmrsConstants.APPLICATION_DATA_DIRECTORY_FALLBACK_WIN + File.separator + openmrsDir; } } filepath = filepath + File.separator; } File folder = new File(filepath); if (!folder.exists()) { folder.mkdirs(); } return filepath; }</code><technical_language>final a constant</technical_language>

Target:
public static String getApplicationDataDirectory() { String filepath = null; final String openmrsDir = "OpenMRS"; String systemProperty = System.getProperty(OpenmrsConstants.KEY_OPENMRS_APPLICATION_DATA_DIRECTORY); if (StringUtils.isNotBlank(systemProperty)) { filepath = systemProperty; } else { String runtimeProperty = Context.getRuntimeProperties().getProperty( OpenmrsConstants.APPLICATION_DATA_DIRECTORY_RUNTIME_PROPERTY, null); if (StringUtils.isNotBlank(runtimeProperty)) { filepath = runtimeProperty; } } if (filepath == null) { if (OpenmrsConstants.UNIX_BASED_OPERATING_SYSTEM) { filepath = System.getProperty("user.home") + File.separator + "." + openmrsDir; if (!canWrite(new File(filepath))) { log.warn("Unable to write to users home dir, fallback to: " + OpenmrsConstants.APPLICATION_DATA_DIRECTORY_FALLBACK_UNIX); filepath = OpenmrsConstants.APPLICATION_DATA_DIRECTORY_FALLBACK_UNIX + File.separator + openmrsDir; } } else { filepath = System.getProperty("user.home") + File.separator + "Application Data" + File.separator + "OpenMRS"; if (!canWrite(new File(filepath))) { log.warn("Unable to write to users home dir, fallback to: " + OpenmrsConstants.APPLICATION_DATA_DIRECTORY_FALLBACK_WIN); filepath = OpenmrsConstants.APPLICATION_DATA_DIRECTORY_FALLBACK_WIN + File.separator + openmrsDir; } } filepath = filepath + File.separator; } File folder = new File(filepath); if (!folder.exists()) { folder.mkdirs(); } return filepath; }
Source:
<code>public Announcer(DiscoveryAnnouncementClient announcementClient, Set<ServiceAnnouncement> serviceAnnouncements, HealthExporter healthExporter) { checkNotNull(announcementClient, "client is null"); checkNotNull(serviceAnnouncements, "serviceAnnouncements is null"); this.announcementClient = announcementClient; for (ServiceAnnouncement serviceAnnouncement : serviceAnnouncements) { announcements.put(serviceAnnouncement.getId(), serviceAnnouncement); } executor = new ScheduledThreadPoolExecutor(5, daemonThreadsNamed("Announcer-%s")); this.healthExporter = checkNotNull(healthExporter, "healthExporter is null"); <START> nextAnnouncementTime.set(System.nanoTime()); <END> }</code><technical_language>Sytem.nanoTime harder unit-test, clock</technical_language>

Target:
public Announcer(DiscoveryAnnouncementClient announcementClient, Set<ServiceAnnouncement> serviceAnnouncements, HealthExporter healthExporter) { this.announcementClient = requireNonNull(announcementClient, "client is null"); for (ServiceAnnouncement serviceAnnouncement : requireNonNull(serviceAnnouncements, "serviceAnnouncements is null")) { announcements.put(serviceAnnouncement.getId(), serviceAnnouncement); } executor = new ScheduledThreadPoolExecutor(5, daemonThreadsNamed("Announcer-%s")); this.healthExporter = requireNonNull(healthExporter, "healthExporter is null"); nextAnnouncementTime.set(System.nanoTime()); }
Source:
<code>public void isLeader() { isLeader = true; <START> leaderStore.poll(); leaderStore.offer(lockIdentity); assertThat(leaderStore.size(), is(1)); <END> }</code><technical_language>is this necessary? if store latest leader in leaderStore, right? sense encapsulate this logic in TestingLeaderCallbackHandler.waitForNewLeader so? Providing a leaderStore this class contract leader is stored intuitive. Moreover, if test thread polls latest leader assertThat(leaderStore.size(), is(1)) runs</technical_language>

Target:
public void isLeader() { isLeader = true; leaderQueue.offer(lockIdentity); sharedQueue.offer(lockIdentity); }
Source:
<code>public int getOutputVersion() { <START> return 2; <END> }</code><technical_language>here. DataVersions.Potions.CURRENT_VERSION</technical_language>

Target:
public int getOutputVersion() { return DataVersions.Potion.POTION_V2; }
Source:
<code>public void testDeserialize() throws StripeException { Account acc = APIResource.GSON.fromJson(accountHash, Account.class); assertEquals("acct_1032D82eZvKYlo2C", acc.getId()); assertEquals(false, acc.getChargesEnabled()); assertEquals(false, acc.getDetailsSubmitted()); <START> assertEquals(false, acc.getTransfersEnabled()); <END> List<String> currenciesSupported = new LinkedList<String>(); currenciesSupported.add("usd"); currenciesSupported.add("aud"); assertEquals(currenciesSupported, acc.getCurrenciesSupported()); assertEquals("company", acc.getLegalEntity().getType()); assertEquals("San Francisco", acc.getLegalEntity().getAddress().getCity()); assertEquals("site@stripe.com", acc.getEmail()); assertEquals(null, acc.getStatementDescriptor()); assertEquals("usd", acc.getDefaultCurrency()); assertEquals("US", acc.getCountry()); assertEquals("US/Pacific", acc.getTimezone()); assertEquals("Stripe.com", acc.getDisplayName()); }</code><technical_language>assertFalse (or called)</technical_language>

Target:
public void testDeserialize() throws StripeException, IOException { String json = resource("account.json"); Account acc = APIResource.GSON.fromJson(json, Account.class); Account expected = new Account(); expected.id = "acct_1032D82eZvKYlo2C"; expected.chargesEnabled = false; expected.detailsSubmitted = false; expected.transfersEnabled = false; expected.currenciesSupported = new LinkedList<String>(); expected.currenciesSupported.add("usd"); expected.currenciesSupported.add("aud"); expected.legalEntity = new LegalEntity(); expected.legalEntity.type = "company"; expected.legalEntity.address = new Address(); expected.legalEntity.address.city = "San Francisco"; expected.email = "site@stripe.com"; expected.defaultCurrency = "usd"; expected.country = "US"; expected.timezone = "US/Pacific"; expected.displayName = "Stripe.com"; assertEquals(expected, acc); }
Source:
<code>private static void updateDetailMessageOfThrowable(Throwable throwable, String newDetailMessage) { Field field; try { field = Throwable.class.getDeclaredField("detailMessage"); } catch (NoSuchFieldException e) { <START> throw new IllegalStateException("The JDK Throwable does provide a detailMessage.", e); <END> } field.setAccessible(true); try { field.set(throwable, newDetailMessage); } catch (IllegalAccessException e) { throw new IllegalStateException(e); } }</code><technical_language>suggestion throw new IllegalStateException("The JDK Throwable provide a detailMessage.", e);</technical_language>

Target:
private static void updateDetailMessageOfThrowable(Throwable throwable, String newDetailMessage) { Field field; try { field = Throwable.class.getDeclaredField("detailMessage"); } catch (NoSuchFieldException e) { throw new IllegalStateException("The JDK Throwable contains a detailMessage member. The Throwable class provided on the classpath does not which is why this exception appears.", e); } field.setAccessible(true); try { field.set(throwable, newDetailMessage); } catch (IllegalAccessException e) { throw new IllegalStateException("The JDK Throwable contains a private detailMessage member that should be accessible through reflection. This is not the case for the Throwable class provided on the classpath.", e); } }
Source:
<code>protected Maybe<Bundle> findOne(boolean requireExactlyOne) { if (symbolicName==null && url==null) throw new IllegalStateException(this+" must be given either a symbolic name or a URL"); List<Bundle> result = findAll(); if (result.isEmpty()) return Maybe.absent("No bundle matching "+getConstraintsDescription()); if (requireExactlyOne && result.size()>1) return Maybe.absent("Multiple bundles ("+result.size()+") matching "+getConstraintsDescription()); <START> return Maybe.of(result.iterator().next()); <END> }</code><technical_language>result.get(0)</technical_language>

Target:
protected Maybe<Bundle> findOne(boolean requireExactlyOne) { if (symbolicName==null && url==null) throw new IllegalStateException(this+" must be given either a symbolic name or a URL"); List<Bundle> result = findAll(); if (result.isEmpty()) return Maybe.absent("No bundle matching "+getConstraintsDescription()); if (requireExactlyOne && result.size()>1) return Maybe.absent("Multiple bundles ("+result.size()+") matching "+getConstraintsDescription()); return Maybe.of(result.get(0)); }
Source:
<code>public void validateDuringFlow(EnvironmentDto environmentDto, NetworkDto networkDto, ValidationResult.ValidationResultBuilder resultBuilder) { if (environmentDto == null || networkDto == null) { <START> LOGGER.warn("EnvironmentDto or NetworkDto. Neither them can be null!"); <END> resultBuilder.error("Internal validation error"); return; } checkSubnetsProvidedWhenExistingNetwork(resultBuilder, networkDto, networkDto.getGcp(), cloudNetworkService.retrieveSubnetMetadata(environmentDto, networkDto)); }</code><technical_language>nit: this message improved state of is null, "Either EnvironmentDto NetworkDto is null. null."</technical_language>

Target:
public void validateDuringFlow(EnvironmentDto environmentDto, NetworkDto networkDto, ValidationResult.ValidationResultBuilder resultBuilder) { if (environmentDto == null || networkDto == null) { LOGGER.warn("Either EnvironmentDto or NetworkDto is null. Neither them can be null."); resultBuilder.error("Internal validation error"); return; } checkSubnetsProvidedWhenExistingNetwork(resultBuilder, networkDto, networkDto.getGcp(), cloudNetworkService.retrieveSubnetMetadata(environmentDto, networkDto)); }
Source:
<code>public static boolean delQuota(ZooKeeper zk, String path, StatsTrack quota) throws KeeperException, InterruptedException, MalformedPathException { String parentPath = Quotas.quotaPath(path); String quotaPath = Quotas.limitPath(path); if (zk.exists(quotaPath, false) == null) { System.out.println("Quota does not exist for " + path); return true; } byte[] data = null; try { data = zk.getData(quotaPath, false, new Stat()); } catch (IllegalArgumentException ex) { throw new MalformedPathException(ex.getMessage()); } catch (KeeperException.NoNodeException ne) { throw new KeeperException.NoNodeException(ne.getMessage()); } StatsTrack strack = new StatsTrack(new String(data)); if (quota == null) { <START> List<String> children = zk.getChildren(parentPath, false); <END> for (String child : children) { zk.delete(parentPath + "/" + child, -1); } trimProcQuotas(zk, parentPath); } else { if (quota.getCount() > 0) { strack.setCount(-1); } if (quota.getBytes() > 0) { strack.setBytes(-1L); } if (quota.getCountHardLimit() > 0) { strack.setCountHardLimit(-1); } if (quota.getByteHardLimit() > 0) { strack.setByteHardLimit(-1L); } zk.setData(quotaPath, strack.toString().getBytes(), -1); } return true; }</code><technical_language>This assumes [the "platform's default charset"](<LINK_1> is ASCII-compatible. I suggest explicit [US-ASCII](<LINK_0> here: java import static java.nio.charset.StandardCharsets.US_ASCII; [...] new String(data, US_ASCII) Also: a instances of new StatsTrack(new String(data)) in this patch; add a constructor takes a byte[]</technical_language>

Target:
public static boolean delQuota(ZooKeeper zk, String path, StatsTrack quota) throws KeeperException, InterruptedException, MalformedPathException { String parentPath = Quotas.quotaPath(path); String quotaPath = Quotas.limitPath(path); if (zk.exists(quotaPath, false) == null) { System.out.println("Quota does not exist for " + path); return true; } byte[] data = null; try { data = zk.getData(quotaPath, false, new Stat()); } catch (IllegalArgumentException ex) { throw new MalformedPathException(ex.getMessage()); } catch (KeeperException.NoNodeException ne) { throw new KeeperException.NoNodeException(ne.getMessage()); } StatsTrack strack = new StatsTrack(data); if (quota == null) { List<String> children = zk.getChildren(parentPath, false); for (String child : children) { zk.delete(parentPath + "/" + child, -1); } trimProcQuotas(zk, parentPath); } else { if (quota.getCount() > 0) { strack.setCount(-1); } if (quota.getBytes() > 0) { strack.setBytes(-1L); } if (quota.getCountHardLimit() > 0) { strack.setCountHardLimit(-1); } if (quota.getByteHardLimit() > 0) { strack.setByteHardLimit(-1L); } zk.setData(quotaPath, strack.getStatsBytes(), -1); } return true; }
Source:
<code>private static List<Geocache> importCachesFromJSON(final HttpResponse response) { if (response != null) { try { final String data = Network.getResponseDataAlways(response); <START> if (data == null || StringUtils.isBlank(data) || StringUtils.equals(data, "[]")) { <END> return Collections.emptyList(); } final JSONArray json = new JSONArray(data); final List<Geocache> caches = new ArrayList<Geocache>(json.length()); for (int i = 0; i < json.length(); i++) { final Geocache cache = parseCache(json.getJSONObject(i)); caches.add(cache); } return caches; } catch (final JSONException e) { Log.w("JSONResult", e); } } return Collections.emptyList(); }</code><technical_language>If data is null StringUtils.isBlank(data) return true, null test is needed</technical_language>

Target:
private static List<Geocache> importCachesFromJSON(final HttpResponse response) { if (response != null) { try { final String data = Network.getResponseDataAlways(response); if (StringUtils.isBlank(data) || StringUtils.equals(data, "[]")) { return Collections.emptyList(); } final JSONArray json = new JSONArray(data); final int len = json.length(); final List<Geocache> caches = new ArrayList<Geocache>(len); for (int i = 0; i < len; i++) { final Geocache cache = parseCache(json.getJSONObject(i)); if (cache != null) { caches.add(cache); } } return caches; } catch (final JSONException e) { Log.w("JSONResult", e); } } return Collections.emptyList(); }
Source:
<code>private static void printNetworkInterfaces(NetworkIF[] networkIFs) { <START> StringBuilder sb = new StringBuilder(); <END> if (networkIFs.length == 0) { sb.append("Unknown"); } for (NetworkIF net : networkIFs) { sb.append("\n").append(net.toString()); } oshi.add(sb.toString()); }</code><technical_language>need start "Network Interfaces:" header here</technical_language>

Target:
private static void printNetworkInterfaces(NetworkIF[] networkIFs) { StringBuilder sb = new StringBuilder("Network Interfaces:"); if (networkIFs.length == 0) { sb.append(" Unknown"); } for (NetworkIF net : networkIFs) { sb.append("\n").append(net.toString()); } oshi.add(sb.toString()); }
Source:
<code>public <K, V> RemoteCache<K, V> getCache(String cacheName) { <START> RemoteCache<K,V> cache = hotrodClient.getCache( cacheName, TransactionMode.NONE ); <END> if ( cache == null ) { throw log.expectedCachesNotDefined( Collections.singleton( cacheName ) ); } return cache; }</code><technical_language>this a property</technical_language>

Target:
public <K, V> RemoteCache<K, V> getCache(String cacheName) { RemoteCache<K,V> cache = hotrodClient.getCache( cacheName ); if ( cache == null ) { throw log.expectedCachesNotDefined( Collections.singleton( cacheName ) ); } return cache; }
Source:
<code>public Chart(String id, IModel<ChartType> typeModel, IModel<ChartOptions> optionModel, IModel<DataTable> dataModel) { <START> this(id); <END> this.typeModel = typeModel; this.setDefaultModel(optionModel); setDataModel(dataModel); }</code><technical_language>This chain next (more complete) constructor instead</technical_language>

Target:
public Chart(String id, IModel<ChartType> typeModel, IModel<ChartOptions> optionModel, IModel<DataTable> dataModel) { this(id, typeModel, optionModel, dataModel, null); }
Source:
<code>public void finishInitialization() { if(executor == null) { <START> if(createShellExecutor(CliConstants.DEFAULT_EXECUTOR_CLASS)) { <END> activeExecutorClassName = CliConstants.DEFAULT_EXECUTOR_CLASS; executorEnvHandler = executor.getEnvironmentVariableHandler(); if(delayedExecutorVars != null) { for (Map.Entry<String, String> entry : delayedExecutorVars.entrySet()) { setEnvironmentVariable(entry.getKey(), entry.getValue()); } delayedExecutorVars = null; } } else { throw new CliException("Failed to create default executor: " + CliConstants.DEFAULT_EXECUTOR_CLASS); } } finishInitialization(shellEnvHandler); finishInitialization(executorEnvHandler); }</code><technical_language>method return boolean do is a good idea exception thrown logged below</technical_language>

Target:
public void finishInitialization() { if(executor == null) { try { createShellExecutor(CliConstants.DEFAULT_EXECUTOR_CLASS); activeExecutorClassName = CliConstants.DEFAULT_EXECUTOR_CLASS; executorEnvHandler = executor.getEnvironmentVariableHandler(); if (delayedExecutorVars != null) { for (Map.Entry<String, String> entry : delayedExecutorVars.entrySet()) { setEnvironmentVariable(entry.getKey(), entry.getValue()); } delayedExecutorVars = null; } } catch (ExecutorException e) { throw new CliException(e); } } finishInitialization(shellEnvHandler); finishInitialization(executorEnvHandler); }
Source:
<code>void createTable(String tableName, String... columnFamilies) throws IOException; List<String> scanTable(String tableName) throws IOException; <START> void putData(String tableName, String rowKey, String columnFamily, String key, String value) throws IOException; <END> static HBaseResource get() { return FactoryUtils.loadAndInvokeFactory( HBaseResourceFactory.class, HBaseResourceFactory::create, LocalStandaloneHBaseResourceFactory::new); }</code><technical_language>String key -> String columnQualifier, update subclass</technical_language>

Target:
void createTable(String tableName, String... columnFamilies) throws IOException; List<String> scanTable(String tableName) throws IOException; void putData(String tableName, String rowKey, String columnFamily, String columnQualifier, String value) throws IOException; static HBaseResource get() { return FactoryUtils.loadAndInvokeFactory( HBaseResourceFactory.class, HBaseResourceFactory::create, LocalStandaloneHBaseResourceFactory::new); }
Source:
<code>public void onDropDataType(final Element currentElement, final Element hoverElement) { try { final DNDContext dndContext = makeDndContext(currentElement, hoverElement); final Optional<DataType> current = dndContext.getCurrentDataType(); final Optional<DataType> reference = dndContext.getReference(); if (current.isPresent() && reference.isPresent()) { shiftCurrentByReference(current.get(), reference.get(), dndContext.getStrategy()); } } catch (final Exception e) { <START> logError("Drag-n-Drop error. Check '" + DNDDataTypesHandler.class.getSimpleName() + "'."); <END> } }</code><technical_language>I some exception message useful here</technical_language>

Target:
public void onDropDataType(final Element currentElement, final Element hoverElement) { try { final DNDDataTypesHandlerContext dndContext = makeDndContext(currentElement, hoverElement); final Optional<DataType> current = dndContext.getCurrentDataType(); final Optional<DataType> reference = dndContext.getReference(); if (current.isPresent() && reference.isPresent()) { shiftCurrentByReference(current.get(), reference.get(), dndContext.getStrategy()); } } catch (final Exception e) { logError("Drag-n-Drop error (" + e.getMessage() + "). Check '" + DNDDataTypesHandler.class.getSimpleName() + "'."); } }
Source:
<code>public void apply(OnlineCommandContext ctx) throws Exception { Operations ops = new Operations(ctx.client); Address address = Address.subsystem("transactions"); Batch batch = new Batch(); if (ctx.version.lessThanOrEqualTo(ServerVersion.VERSION_3_0_0)) { <START> return; <END> } if (useJdbcStore != null) { batch.writeAttribute(address, "use-jdbc-store", useJdbcStore); } if (storeDatasource != null) { batch.writeAttribute(address, "jdbc-store-datasource", storeDatasource); } if (actionStoreDropTable != null) { batch.writeAttribute(address, "jdbc-action-store-drop-table", actionStoreDropTable); } if (actionStoreTablePrefix != null) { batch.writeAttribute(address, "jdbc-action-store-table-prefix", actionStoreTablePrefix); } if (communicationStoreDropTable != null) { batch.writeAttribute(address, "jdbc-communication-store-drop-table", communicationStoreDropTable); } if (communicationStoreTablePrefix != null) { batch.writeAttribute(address, "jdbc-communication-store-table-prefix", communicationStoreTablePrefix); } if (stateStoreDropTable != null) { batch.writeAttribute(address, "jdbc-state-store-drop-table", stateStoreDropTable); } if (actionStoreTablePrefix != null) { batch.writeAttribute(address, "jdbc-state-store-table-prefix", stateStoreTablePrefix); } ops.batch(batch); }</code><technical_language>above. do this _first_ in method</technical_language>

Target:
public void apply(OnlineCommandContext ctx) throws Exception { ctx.version.assertAtLeast(ServerVersion.VERSION_2_0_0, "JDBC options are available only for WildFly 8 and higher"); Batch batch = new Batch(); Operations ops = new Operations(ctx.client); Address address = Address.subsystem("transactions"); if (useJdbcStore != null) { batch.writeAttribute(address, "use-jdbc-store", useJdbcStore); } if (storeDatasource != null) { batch.writeAttribute(address, "jdbc-store-datasource", storeDatasource); } if (actionStoreDropTable != null) { batch.writeAttribute(address, "jdbc-action-store-drop-table", actionStoreDropTable); } if (actionStoreTablePrefix != null) { batch.writeAttribute(address, "jdbc-action-store-table-prefix", actionStoreTablePrefix); } if (communicationStoreDropTable != null) { batch.writeAttribute(address, "jdbc-communication-store-drop-table", communicationStoreDropTable); } if (communicationStoreTablePrefix != null) { batch.writeAttribute(address, "jdbc-communication-store-table-prefix", communicationStoreTablePrefix); } if (stateStoreDropTable != null) { batch.writeAttribute(address, "jdbc-state-store-drop-table", stateStoreDropTable); } if (actionStoreTablePrefix != null) { batch.writeAttribute(address, "jdbc-state-store-table-prefix", stateStoreTablePrefix); } ops.batch(batch); }
Source:
<code>private synchronized Session createSession(final EmailConfiguration emailConfiguration) { <START> if (session == null) { <END> session = Session.getDefaultInstance(createSessionProperties(emailConfiguration), getSessionAuthenticator(emailConfiguration)); } return session; }</code><technical_language>Constant left</technical_language>

Target:
private synchronized Session createSession(final EmailConfiguration emailConfiguration) { if (null == session) { session = Session.getDefaultInstance(createSessionProperties(emailConfiguration), getSessionAuthenticator(emailConfiguration)); } return session; }
Source:
<code>public static Type fromJoinNodeType(JoinNode.Type joinNodeType) { switch (joinNodeType) { case INNER: return Type.INNER; case LEFT: return Type.LEFT; default: <START> throw new UnsupportedOperationException("Unsupported spatial join type: " + joinNodeType); <END> } }</code><technical_language>IllegalArgumentException</technical_language>

Target:
public static Type fromJoinNodeType(JoinNode.Type joinNodeType) { switch (joinNodeType) { case INNER: return Type.INNER; case LEFT: return Type.LEFT; default: throw new IllegalArgumentException("Unsupported spatial join type: " + joinNodeType); } }
Source:
<code>public void onDestroy() { MetaData metadata = new MetaData((mActivityWeakReference.get())); metadata.setCategory("mediation_adapter"); <START> metadata.set(uuid, "destory"); <END> metadata.set(uuid, null); metadata.commit(); if(mBannerView != null) { mBannerView.destroy(); } mBannerView = null; UnityAds.removeListener(mUnityAdapterDelegate); UnitySingleton.getInstance().mPlacementsInUse.remove(mPlacementId); mUnityAdapterDelegate = null; mUnityBannerListener = null; mMediationInterstitialListener = null; mMediationBannerListener = null; }</code><technical_language>this is hardcoded, this destroy ? Is effect UnityAds side if categories/metadata mispelled/incorrect</technical_language>

Target:
public void onDestroy() { MetaData metadata = new MetaData((mActivityWeakReference.get())); metadata.setCategory("mediation_adapter"); metadata.set(uuid, "destroy"); metadata.set(uuid, null); metadata.commit(); if (mBannerView != null) { mBannerView.destroy(); } mBannerView = null; mUnityBannerListener = null; mMediationInterstitialListener = null; mMediationBannerListener = null; }
Source:
<code>public boolean write_committed(Uid uid, String typeName, OutputObjectState txData) throws ObjectStoreException { try { OutputBuffer outputBuffer = new OutputBuffer(); UidHelper.packInto(uid, outputBuffer); outputBuffer.packString(typeName); outputBuffer.packBytes(txData.buffer()); long id = getId(uid, typeName); byte[] data = outputBuffer.buffer(); RecordInfo record = new RecordInfo(id, RECORD_TYPE, data, false, (short)0); <START> RecordInfo previousRecord = getContentForType(typeName).putIfAbsent(uid, record); <END> if(previousRecord != null) { journal.appendUpdateRecord(id, RECORD_TYPE, data, syncWrites); } else { journal.appendAddRecord(id, RECORD_TYPE, data, syncWrites); } } catch(Exception e) { throw new ObjectStoreException(e); } return true; }</code><technical_language>need remove this if append failed, happy - added existing exception handler (line 195)</technical_language>

Target:
public boolean write_committed(Uid uid, String typeName, OutputObjectState txData) throws ObjectStoreException { RecordInfo previousRecord = null; try { OutputBuffer outputBuffer = new OutputBuffer(); UidHelper.packInto(uid, outputBuffer); outputBuffer.packString(typeName); outputBuffer.packBytes(txData.buffer()); byte[] data = outputBuffer.buffer(); RecordInfo record = new RecordInfo(getId(uid, typeName), RECORD_TYPE, data, false, (short)0); previousRecord = getContentForType(typeName).putIfAbsent(uid, record); if(previousRecord != null) { journal.appendUpdateRecord(previousRecord.id, RECORD_TYPE, data, syncWrites); } else { journal.appendAddRecord(record.id, RECORD_TYPE, data, syncWrites); } } catch(Exception e) { if (previousRecord == null) { getContentForType(typeName).remove(uid); } throw new ObjectStoreException(e); } return true; }
Source:
<code><START> public BindManifestToJsonPayload(Json jsonBinder) { <END> this.jsonBinder = checkNotNull(jsonBinder, "jsonBinder"); }</code><technical_language>this package private remove redundant null check</technical_language>

Target:
BindManifestToJsonPayload(Json jsonBinder) { this.jsonBinder = jsonBinder; }
Source:
<code>private void fetchMonthlyStorageUsageAndMaybeRetry() { boolean shouldRetry = false; try { String monthValue = accountStatsMySqlStore.queryRecordedMonth(clusterMapConfig.clusterMapClusterName); if (monthValue.equals(currentMonth)) { Map<String, Map<String, Long>> base = accountStatsMySqlStore.queryMonthlyAggregatedStats(clusterMapConfig.clusterMapClusterName); containerStorageUsageMonthlyBase = base; } else { shouldRetry = true; } } catch (Exception e) { logger.error("Failed to refresh monthly storage usage", e); shouldRetry = true; } if (shouldRetry) { <START> if (retries >= config.mysqlStoreRetryMax) { logger.error("Failed to refresh monthly storage usage after " + retries + " retries, will skip for month: " + currentMonth); retries = 0; } retries++; if (config.mysqlStoreRetryBackoffMs != 0) { scheduler.schedule(this::fetchMonthlyStorageUsageAndMaybeRetry, config.mysqlStoreRetryBackoffMs, TimeUnit.MILLISECONDS); } return; <END> } else { retries = 0; tryPersistMonthlyUsage(); scheduleStorageUsageMonthlyBaseFetcher(); } }</code><technical_language>explain logic here? if retries exceeds max count, resets retries , increments schedule another of retry</technical_language>

Target:
private void fetchMonthlyStorageUsageAndMaybeRetry() { boolean shouldRetry = false; try { String monthValue = accountStatsMySqlStore.queryRecordedMonth(clusterMapConfig.clusterMapClusterName); if (monthValue.equals(currentMonth)) { containerStorageUsageMonthlyBase = accountStatsMySqlStore.queryMonthlyAggregatedStats(clusterMapConfig.clusterMapClusterName); } else { shouldRetry = true; } } catch (Exception e) { logger.error("Failed to refresh monthly storage usage", e); shouldRetry = true; } if (shouldRetry) { if (retries >= config.mysqlStoreRetryMaxCount) { logger.error("Failed to refresh monthly storage usage after " + retries + " retries, will skip for month: " + currentMonth); retries = 0; scheduleStorageUsageMonthlyBaseFetcher(); return; } retries++; if (config.mysqlStoreRetryBackoffMs != 0) { scheduler.schedule(this::fetchMonthlyStorageUsageAndMaybeRetry, config.mysqlStoreRetryBackoffMs, TimeUnit.MILLISECONDS); } } else { retries = 0; tryPersistMonthlyUsage(); scheduleStorageUsageMonthlyBaseFetcher(); } }