auphong2707/dl4se-code-review-dataset huggingface dataset:
Source:
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 ) { 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 ); return resourceIterator( files.iterator(), new MultiResource( resources ) ); }

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:
public static Collection<Object[]> data() { Object[][] data = new Object[][] { {SYNC, (BiFunction<Transaction, AtomicInteger, Transaction>) (transaction, counter) -> transaction, (BiFunction<KeyValueService, AtomicInteger, KeyValueService>) (keyValueService, counter) -> keyValueService}, {ASYNC, (BiFunction<Transaction, AtomicInteger, Transaction>) GetAsyncDelegate::new, (BiFunction<KeyValueService, AtomicInteger, KeyValueService>) VerifyingDelegate::new} }; return Arrays.asList(data); }

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:
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); return getUsersManagerBl().getRichUserExtSources(sess, user); }

Target:
public List<RichUserExtSource> getRichUserExtSources(PerunSession sess, User user) throws InternalErrorException, UserNotExistsException, PrivilegeException { return getRichUserExtSources(sess, user, null); }
Source:
public String toString() { return "LockRequestForNewSegment{" + "lockGranularity=" + lockGranularity + ", lockType=" + lockType + ", groupId='" + groupId + '\'' + ", dataSource='" + dataSource + '\'' + ", interval=" + interval + ", shardSpecFactory=" + partialShardSpec + ", priority=" + priority + ", sequenceName='" + sequenceName + '\'' + ", previsousSegmentId='" + previsousSegmentId + '\'' + ", skipSegmentLineageCheck=" + skipSegmentLineageCheck + '}'; }

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:
private void setStyle() { inboundAverageEditor.setContentWidgetStyleName(style.valueWidth()); 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()); }

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:
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 meanSingleValue = mean.evaluate(result.allSingularValues); 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); }

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:
public ZookeeperClient connect(URL url) { ZookeeperClientData clientData; List<String> addressList = getURLBackupAddress(url); if ((clientData = fetchAndUpdateZookeeperClientCache(url, addressList)) != null) { 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; }

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:
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) && checkCanBeMoveInVm() && checkIfNeedToBeOverride() && acquireLockInternal(); }

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:
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()); }

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:
private MdbContainer getMdbContainer(final String containerId) { final ContainerSystem containerSystem = SystemInstance.get().getComponent(ContainerSystem.class); if (containerSystem == null) { 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; }

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:
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; if (!getOuterType().equals(other.getOuterType())) return false; if (address == null) { if (other.address != null) return false; } else if (!address.equals(other.address)) return false; return true; }

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:
public void stop() { _logger.info("{} stopping", _taskName); _shutdown = true; if (_latestBrokerOffsetsFetcher != null) { _latestBrokerOffsetsFetcher.shutdown(); } if (_consumer != null) { _consumer.wakeup(); } _consumerMetrics.deregisterMetrics(); }

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:
public static String getApplicationDataDirectory() { String filepath = null; 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; }

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:
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"); nextAnnouncementTime.set(System.nanoTime()); }

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:
public void isLeader() { isLeader = true; leaderStore.poll(); leaderStore.offer(lockIdentity); assertThat(leaderStore.size(), is(1)); }

Target:
public void isLeader() { isLeader = true; leaderQueue.offer(lockIdentity); sharedQueue.offer(lockIdentity); }
Source:
public int getOutputVersion() { return 2; }

Target:
public int getOutputVersion() { return DataVersions.Potion.POTION_V2; }
Source:
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()); assertEquals(false, acc.getTransfersEnabled()); 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()); }

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:
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 does provide a detailMessage.", e); } field.setAccessible(true); try { field.set(throwable, newDetailMessage); } catch (IllegalAccessException e) { throw new IllegalStateException(e); } }

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:
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.iterator().next()); }

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:
public void validateDuringFlow(EnvironmentDto environmentDto, NetworkDto networkDto, ValidationResult.ValidationResultBuilder resultBuilder) { if (environmentDto == null || networkDto == null) { LOGGER.warn("EnvironmentDto or NetworkDto. Neither them can be null!"); resultBuilder.error("Internal validation error"); return; } checkSubnetsProvidedWhenExistingNetwork(resultBuilder, networkDto, networkDto.getGcp(), cloudNetworkService.retrieveSubnetMetadata(environmentDto, networkDto)); }

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:
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) { 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.toString().getBytes(), -1); } return true; }

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:
private static List<Geocache> importCachesFromJSON(final HttpResponse response) { if (response != null) { try { final String data = Network.getResponseDataAlways(response); if (data == null || StringUtils.isBlank(data) || StringUtils.equals(data, "[]")) { 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(); }

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:
private static void printNetworkInterfaces(NetworkIF[] networkIFs) { StringBuilder sb = new StringBuilder(); if (networkIFs.length == 0) { sb.append("Unknown"); } for (NetworkIF net : networkIFs) { sb.append("\n").append(net.toString()); } oshi.add(sb.toString()); }

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:
public <K, V> RemoteCache<K, V> getCache(String cacheName) { RemoteCache<K,V> cache = hotrodClient.getCache( cacheName, TransactionMode.NONE ); if ( cache == null ) { throw log.expectedCachesNotDefined( Collections.singleton( cacheName ) ); } return cache; }

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:
public Chart(String id, IModel<ChartType> typeModel, IModel<ChartOptions> optionModel, IModel<DataTable> dataModel) { this(id); this.typeModel = typeModel; this.setDefaultModel(optionModel); setDataModel(dataModel); }

Target:
public Chart(String id, IModel<ChartType> typeModel, IModel<ChartOptions> optionModel, IModel<DataTable> dataModel) { this(id, typeModel, optionModel, dataModel, null); }
Source:
public void finishInitialization() { if(executor == null) { if(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; } } else { throw new CliException("Failed to create default executor: " + CliConstants.DEFAULT_EXECUTOR_CLASS); } } finishInitialization(shellEnvHandler); finishInitialization(executorEnvHandler); }

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:
void createTable(String tableName, String... columnFamilies) throws IOException; List<String> scanTable(String tableName) throws IOException; void putData(String tableName, String rowKey, String columnFamily, String key, String value) throws IOException; static HBaseResource get() { return FactoryUtils.loadAndInvokeFactory( HBaseResourceFactory.class, HBaseResourceFactory::create, LocalStandaloneHBaseResourceFactory::new); }

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:
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) { logError("Drag-n-Drop error. Check '" + DNDDataTypesHandler.class.getSimpleName() + "'."); } }

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:
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)) { return; } 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); }

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:
private synchronized Session createSession(final EmailConfiguration emailConfiguration) { if (session == null) { session = Session.getDefaultInstance(createSessionProperties(emailConfiguration), getSessionAuthenticator(emailConfiguration)); } return session; }

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

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:
public void onDestroy() { MetaData metadata = new MetaData((mActivityWeakReference.get())); metadata.setCategory("mediation_adapter"); metadata.set(uuid, "destory"); 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; }

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:
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); RecordInfo previousRecord = getContentForType(typeName).putIfAbsent(uid, record); 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; }

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:
public BindManifestToJsonPayload(Json jsonBinder) { this.jsonBinder = checkNotNull(jsonBinder, "jsonBinder"); }

Target:
BindManifestToJsonPayload(Json jsonBinder) { this.jsonBinder = jsonBinder; }
Source:
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) { 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; } else { retries = 0; tryPersistMonthlyUsage(); scheduleStorageUsageMonthlyBaseFetcher(); } }

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(); } }
Source:
public ActionResponseDto executeBundleAction(final DlmsConnectionHolder conn, final DlmsDevice device, final ActionRequestDto actionRequestDto) throws ProtocolAdapterException, FunctionalException { this.checkActionRequestType(actionRequestDto); LOGGER.info("Keys to set on the device {}: {}", device.getDeviceIdentification(), actionRequestDto); DlmsDevice devicePostSave = this.execute(conn, device, ReplaceKeyCommandExecutor.wrap(((SetKeysRequestDto) actionRequestDto).getAuthenticationKey(), KeyId.AUTHENTICATION_KEY, SecurityKeyType.E_METER_AUTHENTICATION)); devicePostSave = this.execute(conn, devicePostSave, ReplaceKeyCommandExecutor.wrap(((SetKeysRequestDto) actionRequestDto).getEncryptionKey(), KeyId.GLOBAL_UNICAST_ENCRYPTION_KEY, SecurityKeyType.E_METER_ENCRYPTION)); return new ActionResponseDto(REPLACE_KEYS + device.getDeviceIdentification() + WAS_SUCCESFULL); }

Target:
public ActionResponseDto executeBundleAction(final DlmsConnectionHolder conn, final DlmsDevice device, final ActionRequestDto actionRequestDto) throws ProtocolAdapterException, FunctionalException { this.checkActionRequestType(actionRequestDto); LOGGER.info("Keys set on device :{}", device.getDeviceIdentification()); DlmsDevice devicePostSave = this.execute(conn, device, ReplaceKeyCommandExecutor.wrap(((SetKeysRequestDto) actionRequestDto).getAuthenticationKey(), KeyId.AUTHENTICATION_KEY, SecurityKeyType.E_METER_AUTHENTICATION)); devicePostSave = this.execute(conn, devicePostSave, ReplaceKeyCommandExecutor.wrap(((SetKeysRequestDto) actionRequestDto).getEncryptionKey(), KeyId.GLOBAL_UNICAST_ENCRYPTION_KEY, SecurityKeyType.E_METER_ENCRYPTION)); return new ActionResponseDto(REPLACE_KEYS + device.getDeviceIdentification() + WAS_SUCCESFULL); }
Source:
public List<IDescriptionLinkResolver> getDescriptionConverterLinkResolvers() { List<IDescriptionLinkResolver> linkResolvers = new ArrayList<>(); linkResolvers.add(new PropertyValidationRuleLinkResolver()); List<IItemDescriptor<IDescriptionLinkResolver>> itemDescriptors = this.descriptionConverterLinkResolverRegistry.getItemDescriptors(); for (IItemDescriptor<IDescriptionLinkResolver> itemDescriptor : itemDescriptors) { IDescriptionLinkResolver linkResolver = itemDescriptor.getItem(); linkResolvers.add(linkResolver); } return linkResolvers; }

Target:
public List<IDescriptionLinkResolver> getDescriptionConverterLinkResolvers() { if (!this.hasReadDescriptionConverterLinkResolverRegistry) { this.descriptionConverterLinkResolverListener.readRegistry(Platform.getExtensionRegistry()); this.hasReadDescriptionConverterLinkResolverRegistry = true; } List<IDescriptionLinkResolver> linkResolvers = new ArrayList<>(); linkResolvers.add(new PropertyValidationRuleLinkResolver()); List<IItemDescriptor<IDescriptionLinkResolver>> itemDescriptors = this.descriptionConverterLinkResolverRegistry.getItemDescriptors(); itemDescriptors.stream().map(IItemDescriptor::getItem).map(linkResolvers::add); return linkResolvers; }
Source:
private Map configPropertiesAsMap(TaskConfig taskConfig) { HashMap properties = new HashMap(); for (Property property : taskConfig.list()) { final HashMap propertyValue = new HashMap(); propertyValue.put("value", property.getValue()); propertyValue.put("secure", property.getOption(Property.SECURE)); propertyValue.put("required", property.getOption(Property.REQUIRED)); propertyValue.put("display-name", property.getOption(Property.DISPLAY_NAME)); propertyValue.put("display-order", property.getOption(Property.DISPLAY_ORDER).toString()); properties.put(property.getKey(), propertyValue); } return properties; }

Target:
private Map configPropertiesAsMap(TaskConfig taskConfig) { HashMap properties = new HashMap(); for (Property property : taskConfig.list()) { final HashMap propertyValue = new HashMap(); propertyValue.put("value", property.getValue()); propertyValue.put("secure", property.getOption(Property.SECURE)); propertyValue.put("required", property.getOption(Property.REQUIRED)); properties.put(property.getKey(), propertyValue); } return properties; }
Source:
protected void doExecute() { try { ModelSet modelSet = ServiceUtilsForEObject.getInstance().getModelSet(targetOwner); IModel notationModel = modelSet.getModelFor(newElement); if (notationModel instanceof IEMFModel) { Resource notationResource = ((IEMFModel) notationModel).getResource(); EList<EObject> contents = notationResource.getContents(); int location = contents.indexOf(objectLocation); if (location != -1) { contents.move(location, newElement); } notationResource.setModified(true); } } catch (ServiceException e) { } }

Target:
protected void doExecute() { Resource notationResource = newElement.eResource(); if (notationResource != null) { EList<EObject> contents = notationResource.getContents(); int location = contents.indexOf(objectLocation); if (location != -1) { contents.move(location, newElement); notationResource.setModified(true); } } }