auphong2707/dl4se-code-review-dataset huggingface dataset:
Source:
public boolean isGetRepositoryCall(PsiElement e) { return isCallTo(e, new Method[] { getInterfaceMethod(e.getProject(), "\\Doctrine\\Common\\Persistence\\ManagerRegistry", "getRepository"), }); }

Target:
public boolean isGetRepositoryCall(PsiElement e) { return isCallTo(e, new Method[] { getInterfaceMethod(e.getProject(), "\\Doctrine\\Common\\Persistence\\ManagerRegistry", "getRepository"), getInterfaceMethod(e.getProject(), "\\Doctrine\\Common\\Persistence\\ObjectManager", "getRepository"), }); }
Source:
public void notify(CarbonServerEvent event) { if (event.getType() == CarbonServerEvent.STARTING) { Path carbonHome = Utils.getCarbonHomeDirectory(); try { Optional<String> carbonProfile = Optional.ofNullable(System.getProperty("carbon.profile")); if (carbonProfile.isPresent()) { DropinsBundleDeployerUtils.executeDropinsCapability(carbonHome.toString(), carbonProfile.get()); } else { DropinsBundleDeployerUtils.getCarbonProfiles().parallelStream().forEach(profileName -> { try { DropinsBundleDeployerUtils.executeDropinsCapability(carbonHome.toString(), profileName); } catch (IOException e) { logger.log(Level.SEVERE, "Failed to update the Carbon Profile : " + carbonProfile, e); } }); } } catch (IOException e) { logger.log(Level.SEVERE, "Failed to update the specified Carbon Profile", e); } } }

Target:
public void notify(CarbonServerEvent event) { if (event.getType() == CarbonServerEvent.STARTING) { Path carbonHome = Utils.getCarbonHomeDirectory(); String profile = Optional.ofNullable(System.getProperty(Constants.PROFILE)). orElse(Constants.DEFAULT_PROFILE); try { DropinsBundleDeployerUtils.executeDropinsCapability(carbonHome.toString(), profile); } catch (IOException e) { logger.log(Level.SEVERE, "Failed to update the OSGi bundle information of Carbon Profile: " + profile, e); } } }
Source:
public boolean rewritePre(Mutable<ILogicalOperator> opRef, IOptimizationContext context) { VXQueryOptimizationContext vxqueryContext = (VXQueryOptimizationContext) context; String[] args = getFunctionalArguments(opRef, VXQueryCommons.collectionFunctions); VXQueryMetadataProvider metadata = (VXQueryMetadataProvider) context.getMetadataProvider(); if (args != null) { String collectionName = args[0]; int collectionId = vxqueryContext.newCollectionId(); String collectionTempName = collectionName; if (collectionName.contains("|")) { collectionTempName = collectionName.substring(0, collectionName.indexOf("|")); } if (metadata.indexExists(collectionTempName)) { VXQueryIndexingDataSource ids = VXQueryIndexingDataSource.create(collectionId, collectionName, SequenceType.create(AnyItemType.INSTANCE, Quantifier.QUANT_STAR), functionCall.getFunctionIdentifier().getName()); if (ids != null) { ids.setTotalDataSources(vxqueryContext.getTotalDataSources()); return setDataSourceScan(ids, opRef); } } VXQueryCollectionDataSource ds = VXQueryCollectionDataSource.create(collectionId, collectionName, SequenceType.create(AnyItemType.INSTANCE, Quantifier.QUANT_STAR)); if (ds != null) { ds.setTotalDataSources(vxqueryContext.getTotalDataSources()); if (args.length == 2) { ds.setTotalDataSources(vxqueryContext.getTotalDataSources()); ds.setTag(args[1]); } return setDataSourceScan(ds, opRef); } } return false; }

Target:
public boolean rewritePre(Mutable<ILogicalOperator> opRef, IOptimizationContext context) { VXQueryOptimizationContext vxqueryContext = (VXQueryOptimizationContext) context; String[] args = getFunctionalArguments(opRef, VXQueryCommons.collectionFunctions); VXQueryMetadataProvider metadata = (VXQueryMetadataProvider) context.getMetadataProvider(); if (args != null) { String collectionName = args[0]; int collectionId = vxqueryContext.newCollectionId(); ArrayList<String> collectionTempName = new ArrayList<String>(); collectionTempName.add(collectionName); if (collectionName.contains("|")) { collectionTempName.remove(0); int index = collectionName.indexOf("|"); int start = 0; while (index >= 0) { collectionTempName.add(collectionName.substring(start, index)); start = index + 1; index = collectionName.indexOf("|", index + 1); if (index == -1) { collectionTempName.add(collectionName.substring(start)); } } } if (metadata.hasIndex(collectionTempName)) { VXQueryIndexingDataSource ids = VXQueryIndexingDataSource.create(collectionId, collectionName, SequenceType.create(AnyItemType.INSTANCE, Quantifier.QUANT_STAR), functionCall.getFunctionIdentifier().getName()); if (ids != null) { ids.setTotalDataSources(vxqueryContext.getTotalDataSources()); return setDataSourceScan(ids, opRef); } } VXQueryCollectionDataSource ds = VXQueryCollectionDataSource.create(collectionId, collectionName, SequenceType.create(AnyItemType.INSTANCE, Quantifier.QUANT_STAR)); if (ds != null) { ds.setTotalDataSources(vxqueryContext.getTotalDataSources()); if (args.length == 2) { ds.setTotalDataSources(vxqueryContext.getTotalDataSources()); ds.setTag(args[1]); } return setDataSourceScan(ds, opRef); } } return false; }
Source:
public void validate(NodeContext baseConfig, StripeAdditionNomadChange change) throws NomadException { LOGGER.info("Validating change: {}", change.getSummary()); if (baseConfig == null) { throw new NomadException("Existing config must not be null"); } try { Cluster updated = change.apply(baseConfig.getCluster()); new ClusterValidator(updated).validate(); } catch (RuntimeException e) { throw new NomadException("Error when trying to apply: '" + change.getSummary() + "': " + e.getMessage(), e); } }

Target:
public void validate(NodeContext baseConfig, StripeAdditionNomadChange change) throws NomadException { LOGGER.info("Validating change: {}", change.getSummary()); if (baseConfig == null) { throw new NomadException("Existing config must not be null"); } try { Cluster updated = change.apply(baseConfig.getCluster()); new ClusterValidator(updated).validate(); topologyService.getLicense().ifPresent(l -> licenseService.validate(l, updated)); } catch (RuntimeException e) { throw new NomadException("Error when trying to apply: '" + change.getSummary() + "': " + e.getMessage(), e); } }
Source:
public void testMput() throws Exception { @SuppressWarnings("unchecked") SessionFactory<TestLsEntry> sessionFactory = mock(SessionFactory.class); @SuppressWarnings("unchecked") Session<TestLsEntry> session = mock(Session.class); RemoteFileTemplate<TestLsEntry> template = new RemoteFileTemplate<TestLsEntry>(sessionFactory); template.setRemoteDirectoryExpression(new LiteralExpression("foo/")); template.setBeanFactory(mock(BeanFactory.class)); template.afterPropertiesSet(); TestRemoteFileOutboundGateway gw = new TestRemoteFileOutboundGateway(template, "mput", null); gw.afterPropertiesSet(); when(sessionFactory.getSession()).thenReturn(session); final AtomicReference<String> written = new AtomicReference<String>(); doAnswer(new Answer<Object>() { @Override public Object answer(InvocationOnMock invocation) throws Throwable { written.set((String) invocation.getArguments()[1]); return null; } }).when(session).write(any(InputStream.class), anyString()); File file1 = tempFolder.newFile("baz.txt"); File file2 = tempFolder.newFile("qux.txt"); Message<File> requestMessage = MessageBuilder.withPayload(tempFolder.getRoot()) .build(); @SuppressWarnings("unchecked") List<String> out = (List<String>) gw.handleRequestMessage(requestMessage); assertEquals(2, out.size()); assertThat(out.get(0), not(equalTo(out.get(1)))); assertThat(out.get(0), anyOf( equalTo("foo/baz.txt"), equalTo("foo/qux.txt"))); assertThat(out.get(1), anyOf( equalTo("foo/baz.txt"), equalTo("foo/qux.txt"))); file1.delete(); file2.delete(); }

Target:
public void testMput() throws Exception { @SuppressWarnings("unchecked") SessionFactory<TestLsEntry> sessionFactory = mock(SessionFactory.class); @SuppressWarnings("unchecked") Session<TestLsEntry> session = mock(Session.class); RemoteFileTemplate<TestLsEntry> template = new RemoteFileTemplate<TestLsEntry>(sessionFactory); template.setRemoteDirectoryExpression(new LiteralExpression("foo/")); template.setBeanFactory(mock(BeanFactory.class)); template.afterPropertiesSet(); TestRemoteFileOutboundGateway gw = new TestRemoteFileOutboundGateway(template, "mput", null); gw.afterPropertiesSet(); when(sessionFactory.getSession()).thenReturn(session); final AtomicReference<String> written = new AtomicReference<String>(); doAnswer(new Answer<Object>() { @Override public Object answer(InvocationOnMock invocation) throws Throwable { written.set((String) invocation.getArguments()[1]); return null; } }).when(session).write(any(InputStream.class), anyString()); File file1 = tempFolder.newFile("baz.txt"); File file2 = tempFolder.newFile("qux.txt"); Message<File> requestMessage = MessageBuilder.withPayload(tempFolder.getRoot()) .build(); @SuppressWarnings("unchecked") List<String> out = (List<String>) gw.handleRequestMessage(requestMessage); assertEquals(2, out.size()); assertThat(out.get(0), not(equalTo(out.get(1)))); assertThat(out.get(0), anyOf( equalTo("foo/baz.txt"), equalTo("foo/qux.txt"))); assertThat(out.get(1), anyOf( equalTo("foo/baz.txt"), equalTo("foo/qux.txt"))); }
Source:
public void handleMessageLog(TelemetryMessageLog messageLog) { for (TelemetryMessageLogEntry message : messageLog.getMessageList()) { handleMessage(message, messageLog).forEach(result -> { final PackageDefinition pkg = getPackageFor(adapterConfig, result.getAgent()); if (pkg == null) { LOG.warn("No matching package found for message: {}. Dropping.", message); return; } final RrdRepository repository = new RrdRepository(); repository.setStep(pkg.getRrd().getStep()); repository.setHeartBeat(repository.getStep() * 2); repository.setRraList(pkg.getRrd().getRras()); repository.setRrdBaseDir(new File(pkg.getRrd().getBaseDir())); final CollectionSet collectionSet = result.getCollectionSet(); LOG.trace("Persisting collection set: for message: {}", collectionSet, message); final Persister persister = persisterFactory.createPersister(EMPTY_SERVICE_PARAMETERS, repository); collectionSet.visit(persister); try { if (isThresholdingEnabled) { ThresholdingSession session = getSessionForAgent(result.getAgent(), repository); session.accept(collectionSet); } } catch (ThresholdInitializationException e) { LOG.warn("Failed Thresholding of CollectionSet: ", e.getMessage()); } }); } }

Target:
public void handleMessageLog(TelemetryMessageLog messageLog) { for (TelemetryMessageLogEntry message : messageLog.getMessageList()) { handleMessage(message, messageLog).forEach(result -> { final PackageDefinition pkg = getPackageFor(adapterConfig, result.getAgent()); if (pkg == null) { LOG.warn("No matching package found for message: {}. Dropping.", message); return; } final RrdRepository repository = new RrdRepository(); repository.setStep(pkg.getRrd().getStep()); repository.setHeartBeat(repository.getStep() * 2); repository.setRraList(pkg.getRrd().getRras()); repository.setRrdBaseDir(new File(pkg.getRrd().getBaseDir())); final CollectionSet collectionSet = result.getCollectionSet(); LOG.trace("Persisting collection set: for message: {}", collectionSet, message); final Persister persister = persisterFactory.createPersister(EMPTY_SERVICE_PARAMETERS, repository); collectionSet.visit(persister); try { if (isThresholdingEnabled.get()) { ThresholdingSession session = getSessionForAgent(result.getAgent(), repository); session.accept(collectionSet); } } catch (ThresholdInitializationException e) { LOG.warn("Failed Thresholding of CollectionSet : for agent: {}", e.getMessage(), result.getAgent()); } }); } }
Source:
private boolean isGerrit() { final String GERRIT_XSSI_MAGIC_STRING = ")]}\'\n"; if (uri.startsWith("https://") || uri.startsWith("http://")) { try { String u = uri; int protocolEnd = uri.indexOf("://") + 3; while (true) { HttpURLConnection httpConnection = (HttpURLConnection) new URL( u + "/config/server/version").openConnection(); httpConnection.setRequestMethod("GET"); int responseCode = httpConnection.getResponseCode(); switch (responseCode) { case HttpURLConnection.HTTP_OK: InputStream in = httpConnection.getInputStream(); String response = readFully(in, "UTF-8"); if (response.startsWith(GERRIT_XSSI_MAGIC_STRING)) { return true; } else { return false; } case HttpURLConnection.HTTP_NOT_FOUND: int slash = u.lastIndexOf('/'); if (slash <= protocolEnd) { return false; } u = u.substring(0, u.lastIndexOf('/')); break; default: return false; } } } catch (Exception e) { e.printStackTrace(); } } return false; }

Target:
private boolean isGerrit() throws MalformedURLException, IOException { final String GERRIT_XSSI_MAGIC_STRING = ")]}\'\n"; if (uri.startsWith("https://") || uri.startsWith("http://")) { String u = uri; int protocolEnd = uri.indexOf("://") + 3; HttpURLConnection httpConnection = null; try { while (true) { InputStream in = null; try { httpConnection = (HttpURLConnection) new URL(u + "/config/server/version").openConnection(); httpConnection.setRequestMethod("GET"); int responseCode = httpConnection.getResponseCode(); switch (responseCode) { case HttpURLConnection.HTTP_OK: in = httpConnection.getInputStream(); String response = readFully(in, "UTF-8"); if (response.startsWith(GERRIT_XSSI_MAGIC_STRING)) { return true; } else { return false; } case HttpURLConnection.HTTP_NOT_FOUND: int slash = u.lastIndexOf('/'); if (slash <= protocolEnd) { return false; } u = u.substring(0, u.lastIndexOf('/')); break; default: return false; } } finally { if (in != null) { in.close(); } } } } finally { if (httpConnection != null) { httpConnection.disconnect(); } } } return false; }
Source:
public void testLFCR() throws IOException { final byte[] input = new byte[] { (byte)1, (byte)'\n', (byte)'\r', (byte)2, (byte)'\n', (byte)'\r', (byte)3}; final byte[] expected = new byte[] { (byte)1, (byte)'\n', (byte)'\r', (byte)2, (byte)'\n', (byte)'\r', (byte)3}; test(input, expected); }

Target:
public void testLFCR() throws IOException { final byte[] bytes = asBytes("1\n\r2\n\r3"); test(bytes, bytes); }
Source:
public Map<AnyObjectId, List<AnyObjectId>> getGrafts() throws IOException { if (isOutdated()) grafts = loadGrafts(); return grafts; }

Target:
public Map<AnyObjectId, List<ObjectId>> getGrafts() throws IOException { if (isOutdated()) grafts = loadGrafts(); return grafts; }
Source:
protected List<Integer> getCriterionInScope() { if (filter == null || filter.getShowJustInScope()) { List<Integer> inScopeChannelIds = new ArrayList<>(); try { for (WebSocketChannelDTO channel : table.getChannelItems()) { if (channel.isInScope()) { inScopeChannelIds.add(channel.id); } } return inScopeChannelIds; } catch (DatabaseException e) { logger.warn(e.getMessage(), e); } } return null; }

Target:
protected List<Integer> getCriterionInScope() { if (filter != null && filter.getShowJustInScope()) { List<Integer> inScopeChannelIds = new ArrayList<>(); try { for (WebSocketChannelDTO channel : table.getChannelItems()) { if (channel.isInScope()) { inScopeChannelIds.add(channel.id); } } return inScopeChannelIds; } catch (DatabaseException e) { logger.warn(e.getMessage(), e); } } return null; }
Source:
public void productWithMultipleBrandNames() { String engProdId = "1000"; String brandedName = "Branded Eng Product"; Owner owner = new Owner("Test Corporation"); Product p = new Product(engProdId, "Eng Product 1000"); p.setAttribute(Product.Attributes.BRANDING_TYPE, "OS"); Set<Product> prods = new HashSet<>(Arrays.asList(p)); Product mktProd = new Product("mkt", "MKT SKU"); Pool pool = TestUtil.createPool(mktProd); Product product = pool.getProduct(); List<Branding> branding = new LinkedList<>(); branding.add(new Branding(engProdId, "OS", brandedName, null)); branding.add(new Branding(engProdId, "OS", "another brand name", null)); branding.add(new Branding(engProdId, "OS", "number 3", null)); product.setBranding(branding); pool.setProduct(product); Set<String> possibleBrandNames = new HashSet<>(); for (Branding b : pool.getProduct().getBranding()) { possibleBrandNames.add(b.getName()); } List<org.candlepin.model.dto.Product> certProds = util.createProducts(mktProd, prods, "", new HashMap<>(), new Consumer(), pool); assertEquals(1, certProds.size()); String resultBrandName = certProds.get(0).getBrandName(); String resultBrandType = certProds.get(0).getBrandType(); assertTrue(possibleBrandNames.contains(resultBrandName)); assertEquals("OS", resultBrandType); }

Target:
public void productWithMultipleBrandNames() { String engProdId = "1000"; String brandedName = "Branded Eng Product"; Owner owner = new Owner("Test Corporation"); Product p = new Product(engProdId, "Eng Product 1000"); p.setAttribute(Product.Attributes.BRANDING_TYPE, "OS"); Set<Product> prods = new HashSet<>(Arrays.asList(p)); Product mktProd = new Product("mkt", "MKT SKU"); Pool pool = TestUtil.createPool(mktProd); Product product = pool.getProduct(); List<Branding> branding = new LinkedList<>(); branding.add(new Branding(null, engProdId, brandedName, "OS")); branding.add(new Branding(null, engProdId, "another brand name", "OS")); branding.add(new Branding(null, engProdId, "number 3", "OS")); product.setBranding(branding); Set<String> possibleBrandNames = new HashSet<>(); for (Branding b : pool.getProduct().getBranding()) { possibleBrandNames.add(b.getName()); } List<org.candlepin.model.dto.Product> certProds = util.createProducts(mktProd, prods, "", new HashMap<>(), new Consumer(), pool); assertEquals(1, certProds.size()); String resultBrandName = certProds.get(0).getBrandName(); String resultBrandType = certProds.get(0).getBrandType(); assertTrue(possibleBrandNames.contains(resultBrandName)); assertEquals("OS", resultBrandType); }
Source:
private static void handleExceptClause(SubscriptionContext ctx, Map<String, Expression> caughtTypes, ExceptClause exceptClause) { Map<String, Expression> caughtInExceptClause = new HashMap<>(); Expression exceptionExpression = exceptClause.exception(); if (exceptionExpression == null) { Expression baseExceptionExpression = caughtTypes.getOrDefault("BaseException", null); if (baseExceptionExpression != null) { ctx.addIssue(exceptClause.exceptKeyword(), "Merge this bare \"except:\" with the \"BaseException\" one.").secondary(baseExceptionExpression, null); } return; } if (exceptionExpression.is(Tree.Kind.TUPLE)) { Tuple tuple = (Tuple) exceptionExpression; for (Expression expression : tuple.elements()) { handleExceptionExpression(ctx, caughtTypes, expression, caughtInExceptClause); } } else { handleExceptionExpression(ctx, caughtTypes, exceptionExpression, caughtInExceptClause); } caughtInExceptClause.forEach(caughtTypes::putIfAbsent); }

Target:
private static void handleExceptClause(SubscriptionContext ctx, Map<String, Expression> caughtTypes, ExceptClause exceptClause) { Map<String, Expression> caughtInExceptClause = new HashMap<>(); Expression exceptionExpression = exceptClause.exception(); if (exceptionExpression == null) { Expression baseExceptionExpression = caughtTypes.get("BaseException"); if (baseExceptionExpression != null) { ctx.addIssue(exceptClause.exceptKeyword(), "Merge this bare \"except:\" with the \"BaseException\" one.").secondary(baseExceptionExpression, null); } return; } if (exceptionExpression.is(Tree.Kind.TUPLE)) { Tuple tuple = (Tuple) exceptionExpression; for (Expression expression : tuple.elements()) { handleExceptionExpression(ctx, caughtTypes, expression, caughtInExceptClause); } } else { handleExceptionExpression(ctx, caughtTypes, exceptionExpression, caughtInExceptClause); } caughtInExceptClause.forEach(caughtTypes::putIfAbsent); }
Source:
public static ControllerStarter startDefault(File webappPath) { final ControllerConf conf = new ControllerConf(); conf.setControllerHost("localhost"); conf.setControllerPort("9000"); conf.setDataDir("/tmp/PinotController"); conf.setZkStr("localhost:2122"); conf.setHelixClusterName("quickstart"); if (webappPath == null) { String path = ControllerStarter.class.getClassLoader().getResource("webapp").getFile(); if (!path.startsWith("file://")) { path = "file://" + path; } conf.setQueryConsolePath(path); } else { conf.setQueryConsolePath("file://" + webappPath.getAbsolutePath()); } conf.setControllerVipHost("localhost"); conf.setControllerVipProtocol(CommonConstants.HTTP_PROTOCOL); conf.setRetentionControllerFrequencyInSeconds(3600 * 6); conf.setOfflineSegmentIntervalCheckerFrequencyInSeconds(3600); conf.setRealtimeSegmentValidationFrequencyInSeconds(3600); conf.setBrokerResourceValidationFrequencyInSeconds(3600); conf.setStatusCheckerFrequencyInSeconds(5 * 60); conf.setSegmentRelocatorFrequencyInSeconds(60*60); conf.setStatusCheckerWaitForPushTimeInSeconds(10 * 60); conf.setTenantIsolationEnabled(true); final ControllerStarter starter = new ControllerStarter(conf); starter.start(); return starter; }

Target:
public static ControllerStarter startDefault(File webappPath) { final ControllerConf conf = new ControllerConf(); conf.setControllerHost("localhost"); conf.setControllerPort("9000"); conf.setDataDir("/tmp/PinotController"); conf.setZkStr("localhost:2122"); conf.setHelixClusterName("quickstart"); if (webappPath == null) { String path = ControllerStarter.class.getClassLoader().getResource("webapp").getFile(); if (!path.startsWith("file://")) { path = "file://" + path; } conf.setQueryConsolePath(path); } else { conf.setQueryConsolePath("file://" + webappPath.getAbsolutePath()); } conf.setControllerVipHost("localhost"); conf.setControllerVipProtocol(CommonConstants.HTTP_PROTOCOL); conf.setRetentionControllerFrequencyInSeconds(3600 * 6); conf.setOfflineSegmentIntervalCheckerFrequencyInSeconds(3600); conf.setRealtimeSegmentValidationFrequencyInSeconds(3600); conf.setBrokerResourceValidationFrequencyInSeconds(3600); conf.setStatusCheckerFrequencyInSeconds(5 * 60); conf.setSegmentRelocatorFrequencyInSeconds(3600); conf.setStatusCheckerWaitForPushTimeInSeconds(10 * 60); conf.setTenantIsolationEnabled(true); final ControllerStarter starter = new ControllerStarter(conf); starter.start(); return starter; }
Source:
private void processStageConfigDetailsResponse(ArrayList<StageConfigDetailsArtifactCleanup> list, List<Map<String, String>> result) { for (Map<String, String> stageDetails : result) { StageConfigDetailsArtifactCleanup stageConfigDetailsArtifactCleanup = new StageConfigDetailsArtifactCleanup(stageDetails.get("stageName"), stageDetails.get("pipelineName")); if (!list.contains(stageConfigDetailsArtifactCleanup)) { list.add(stageConfigDetailsArtifactCleanup); } } }

Target:
private void processStageConfigDetailsResponse(ArrayList<StageConfigDetailsArtifactCleanup> list, List<Map<String, String>> result) { for (Map<String, String> stageDetails : result) { StageConfigDetailsArtifactCleanup stageConfigDetailsArtifactCleanup = new StageConfigDetailsArtifactCleanup(stageDetails.get("stageName"), stageDetails.get("pipelineName")); List<StageConfigDetailsArtifactCleanup> toBeAdded = new ArrayList<StageConfigDetailsArtifactCleanup>(); if (!list.contains(stageConfigDetailsArtifactCleanup)) { toBeAdded.add(stageConfigDetailsArtifactCleanup); } list.addAll(toBeAdded); } }
Source:
public void setUp() throws Exception { page = new WebPage(); }

Target:
public void setUp() throws Exception { page = WebPage.newBuilder().build(); }
Source:
public Map<String, byte[]> getMetadata() { Map<String, byte[]> meta = new HashMap<>(); if (application != null) { meta.put("application", application.getBytes(StandardCharsets.UTF_8)); } if (component != null) { meta.put("component", component.getBytes(StandardCharsets.UTF_8)); } if (customMetadata != null) { for (Map.Entry<String, String> e : customMetadata.entrySet()) { String value = e.getValue(); meta.put(e.getKey(), value == null ? null : value.getBytes(StandardCharsets.UTF_8)); } } return meta; }

Target:
public Map<String, byte[]> getMetadata() { Map<String, byte[]> meta = new HashMap<>(); if (application != null) { meta.put("application", application.getBytes(StandardCharsets.UTF_8)); } if (component != null) { meta.put("component", component.getBytes(StandardCharsets.UTF_8)); } if (customMetadata != null) { for (Map.Entry<String, String> e : customMetadata.entrySet()) { String value = e.getValue(); meta.put(e.getKey(), value.getBytes(StandardCharsets.UTF_8)); } } return meta; }
Source:
public Optional<InfoInsightCards> map(int index, ResultSet r, StatementContext ctx) throws SQLException { try { InsightCard.Category category = InsightCard.Category.fromString(r.getString("category")); return Optional.of(new InfoInsightCards(r.getInt("id"), category, r.getString("title"), r.getString("text"), r.getString("image_url"))); } catch (IllegalArgumentException exception) { LOGGER.debug("Illegal argument found in info_insight_cards", r.getString("category")); } return Optional.absent(); }

Target:
public Optional<InfoInsightCards> map(int index, ResultSet r, StatementContext ctx) throws SQLException { final String categoryString = r.getString("category"); try { InsightCard.Category category = InsightCard.Category.fromString(categoryString); return Optional.of(new InfoInsightCards(r.getInt("id"), category, r.getString("title"), r.getString("text"), r.getString("image_url"))); } catch (IllegalArgumentException exception) { LOGGER.debug("Illegal argument found in info_insight_cards", categoryString); } return Optional.absent(); }
Source:
void shutdownBlobStore(PartitionId id) { BlobStore store = (BlobStore) getStore(id); if (store != null) { try { Thread shutdownThread = Utils.newThread("store-shutdown-" + id, () -> { try { store.shutdown(); } catch (Exception e) { logger.error("Exception while shutting down store on disk {}", id, disk, e); } }, false); shutdownThread.start(); shutdownThread.join(); } catch (Exception e) { logger.error("Could not shut down the store on disk {}", id, disk, e); } } }

Target:
boolean shutdownBlobStore(PartitionId id) { BlobStore store = (BlobStore) getStore(id); if (store == null) { return false; } try { store.shutdown(); } catch (Exception e) { logger.error("Exception while shutting down store on disk {}", id, disk, e); return false; } return true; }
Source:
public boolean isDown() { boolean ret = false; if (hardDown) { ret = true; } else if (failureCount.get() >= failureCountThreshold) { synchronized (this) { if (SystemTime.getInstance().milliseconds() < downUntil) { ret = true; } } } return ret; }

Target:
public boolean isDown() { boolean down = false; if (hardDown) { down = true; } else if (failureCount.get() >= failureCountThreshold) { if (SystemTime.getInstance().milliseconds() < downUntil.get()) { down = true; } } return down; }
Source:
private boolean isImageExist() { if (getImage() == null || getImage().getDiskStorageType() != Disk.DiskStorageType.IMAGE) { addCanDoActionMessage(VdcBllMessages.ACTION_TYPE_FAILED_DISK_NOT_EXIST); return false; } return true; }

Target:
private boolean isImageExist() { if (getImage() == null || getImage().getDiskStorageType() != Disk.DiskStorageType.IMAGE) { return failCanDoAction(VdcBllMessages.ACTION_TYPE_FAILED_DISK_NOT_EXIST); } return true; }
Source:
private Response invokeParticipantMethod(Method method, URI lraId, URI parentId, String type) { Object participant = CDI.current().select(id).get(); Object result = null; switch (method.getParameterCount()) { case 0: result = invokeMethod(type, method, participant); break; case 1: result = invokeMethod(type, method, participant, lraId); break; case 2: result = invokeMethod(type, method, participant, lraId, parentId); break; default: throw new InvalidLRAParticipantDefinitionException( method.toGenericString() + ": invalid number of arguments: " + method.getParameterCount()); } Response.ResponseBuilder builder = Response.status(Response.Status.OK); if (result instanceof CompletionStage) { try { result = ((CompletionStage) result).toCompletableFuture().get(); } catch (InterruptedException | ExecutionException e) { throw new RuntimeException(e); } } if (result == null) { builder.status(Response.Status.NOT_FOUND); } else if (method.getReturnType().equals(Void.TYPE)) { builder.entity(type.equals(COMPLETE) ? ParticipantStatus.Completed.name() : ParticipantStatus.Compensated.name()); } else if (result instanceof ParticipantStatus) { builder.entity(((ParticipantStatus) result).name()); } else if (result instanceof Response) { return (Response) result; } else { throw new InvalidLRAParticipantDefinitionException( method.toGenericString() + ": invalid type of returned object: " + result.getClass()); } return builder.build(); }

Target:
private Response invokeParticipantMethod(Method method, URI lraId, URI parentId, String type) { Object participant = getInstance(); Object result; switch (method.getParameterCount()) { case 0: result = invokeMethod(type, method, participant); break; case 1: result = invokeMethod(type, method, participant, lraId); break; case 2: result = invokeMethod(type, method, participant, lraId, parentId); break; default: throw new IllegalStateException( method.toGenericString() + ": invalid number of arguments: " + method.getParameterCount()); } return processResult(result, lraId, method, type); }
Source:
protected void configureGraphicalViewer() { super.configureGraphicalViewer(); AdvancedScrollingGraphicalViewer viewer = getGraphicalViewer(); ScalableFreeformRootEditPart root = createRootEditPart(); ContextMenuProvider cmp = getContextMenuProvider(viewer, root.getZoomManager()); if (cmp != null) { viewer.setContextMenu(cmp); getSite().registerContextMenu("org.eclipse.fordiac.ide.gef.contextmenu", cmp, viewer); } viewer.setRootEditPart(root); viewer.setEditPartFactory(getEditPartFactory()); AdvancedGraphicalViewerKeyHandler keyHandler = new AdvancedGraphicalViewerKeyHandler(viewer); viewer.setKeyHandler(keyHandler); viewer.setProperty(MouseWheelHandler.KeyGenerator.getKey(SWT.MOD1), MouseWheelZoomHandler.SINGLETON); }

Target:
protected void configureGraphicalViewer() { super.configureGraphicalViewer(); AdvancedScrollingGraphicalViewer viewer = getGraphicalViewer(); ScalableFreeformRootEditPart root = createRootEditPart(); ContextMenuProvider cmp = getContextMenuProvider(viewer, root.getZoomManager()); if (cmp != null) { viewer.setContextMenu(cmp); getSite().registerContextMenu("org.eclipse.fordiac.ide.gef.contextmenu", cmp, viewer); } viewer.setRootEditPart(root); viewer.setEditPartFactory(getEditPartFactory()); AdvancedGraphicalViewerKeyHandler keyHandler = new AdvancedGraphicalViewerKeyHandler(viewer); keyHandler.setParent(getCommonKeyHandler()); viewer.setKeyHandler(keyHandler); viewer.setProperty(MouseWheelHandler.KeyGenerator.getKey(SWT.MOD1), MouseWheelZoomHandler.SINGLETON); }
Source:
public void onOpened() { super.onOpened(); SimpleUri worldGenUri = config.getWorldGeneration().getDefaultGenerator(); Name moduleName = worldGenUri.getModuleName(); try { DependencyResolver resolver = new DependencyResolver(moduleManager.getRegistry()); ResolutionResult result = resolver.resolve(moduleName); if (result.isSuccess()) { environment = moduleManager.loadEnvironment(result.getModules(), false); CoreRegistry.put(WorldGeneratorPluginLibrary.class, new TempWorldGeneratorPluginLibrary(environment)); CoreRegistry.get(AssetManager.class).setEnvironment(environment); worldGenerator = worldGeneratorManager.searchForWorldGenerator(worldGenUri, environment); worldGenerator.setWorldSeed(seed.getText()); previewGen = new FacetLayerPreview(environment, worldGenerator); configureProperties(); triggerUpdate = true; } else { logger.error("Could not resolve modules for: {}", worldGenUri); } } catch (Exception e) { worldGenerator = null; logger.error("Unable to load world generator: " + worldGenUri + " for a 2d preview", e); } }

Target:
public void onOpened() { super.onOpened(); SimpleUri worldGenUri = config.getWorldGeneration().getDefaultGenerator(); Name moduleName = worldGenUri.getModuleName(); try { DependencyResolver resolver = new DependencyResolver(moduleManager.getRegistry()); ResolutionResult result = resolver.resolve(moduleName); if (result.isSuccess()) { environment = moduleManager.loadEnvironment(result.getModules(), false); context.put(WorldGeneratorPluginLibrary.class, new TempWorldGeneratorPluginLibrary(environment, context)); assetManager.setEnvironment(environment); worldGenerator = worldGeneratorManager.searchForWorldGenerator(worldGenUri, environment); worldGenerator.setWorldSeed(seed.getText()); previewGen = new FacetLayerPreview(environment, worldGenerator); configureProperties(); triggerUpdate = true; } else { logger.error("Could not resolve modules for: {}", worldGenUri); } } catch (Exception e) { worldGenerator = null; logger.error("Unable to load world generator: " + worldGenUri + " for a 2d preview", e); } }
Source:
public void send(ThroughputEvent event) { logger.info("send ThroughputEvent : {}", event.toString()); }

Target:
public void send(ThroughputEvent event) { logger.info("send ThroughputEvent : {}", event); }
Source:
public static List<RedDeerLauncherProperties> loadAll(ILaunchConfiguration configuration) throws CoreException{ List<RedDeerLauncherProperties> properties = new ArrayList<RedDeerLauncherProperties>(); for (String key : configuration.getAttributes().keySet()){ if (key.startsWith(RedDeerLauncherProperties.ATTRIBUTE_PREFIX)){ String argName = key.replace(RedDeerLauncherProperties.ATTRIBUTE_PREFIX, ""); try{ RedDeerProperties rdProperty = getByName(argName); RedDeerLauncherProperties property = new RedDeerLauncherProperties(rdProperty); String argValue = configuration.getAttribute(key, property.getProperty().getValue()); property.setCurrentValue(argValue); property.setDoubleDefined(configuration); System.out.println("Found property: " + property.getProperty().getName() + " with value " + property.currentValue); properties.add(property); } catch (RedDeerException re){ } } } return properties; }

Target:
public static List<RedDeerLauncherProperties> loadAll(ILaunchConfiguration configuration) throws CoreException{ List<RedDeerLauncherProperties> properties = new ArrayList<RedDeerLauncherProperties>(); for (String key : configuration.getAttributes().keySet()){ if (key.startsWith(RedDeerLauncherProperties.ATTRIBUTE_PREFIX)){ String argName = key.replace(RedDeerLauncherProperties.ATTRIBUTE_PREFIX, ""); try{ RedDeerProperties rdProperty = getByName(argName); RedDeerLauncherProperties property = new RedDeerLauncherProperties(rdProperty); String argValue = configuration.getAttribute(key, property.getProperty().getValue()); property.setCurrentValue(argValue); property.setDoubleDefined(configuration); properties.add(property); } catch (RedDeerException re){ } } } return properties; }
Source:
public TextTrackScore( Format format, Parameters parameters, int trackFormatSupport, @Nullable String selectedAudioLanguage) { isWithinRendererCapabilities = isSupported(trackFormatSupport, false); int maskedSelectionFlags = format.selectionFlags & ~parameters.disabledTextTrackSelectionFlags; isDefault = (maskedSelectionFlags & C.SELECTION_FLAG_DEFAULT) != 0; boolean isForced = (maskedSelectionFlags & C.SELECTION_FLAG_FORCED) != 0; preferredLanguageScore = getFormatLanguageScore( format, parameters.preferredTextLanguage, parameters.selectUndeterminedTextLanguage); preferredRoleFlagsScore = format.roleFlags & parameters.preferredRoleFlags; hasPreferredIsForcedFlag = (preferredLanguageScore > 0 && !isForced) || (preferredLanguageScore == 0 && isForced); boolean selectedAudioLanguageUndetermined = normalizeUndeterminedLanguageToNull(selectedAudioLanguage) == null; selectedAudioLanguageScore = getFormatLanguageScore(format, selectedAudioLanguage, selectedAudioLanguageUndetermined); isWithinConstraints = (preferredLanguageScore > 0 || (parameters.preferredTextLanguage == null && selectedAudioLanguageScore > 0 && preferredRoleFlagsScore > 0)) || isDefault || (isForced && selectedAudioLanguageScore > 0); }

Target:
public TextTrackScore( Format format, Parameters parameters, int trackFormatSupport, @Nullable String selectedAudioLanguage) { isWithinRendererCapabilities = isSupported(trackFormatSupport, false); int maskedSelectionFlags = format.selectionFlags & ~parameters.disabledTextTrackSelectionFlags; isDefault = (maskedSelectionFlags & C.SELECTION_FLAG_DEFAULT) != 0; boolean isForced = (maskedSelectionFlags & C.SELECTION_FLAG_FORCED) != 0; preferredLanguageScore = getFormatLanguageScore( format, parameters.preferredTextLanguage, parameters.selectUndeterminedTextLanguage); preferredRoleFlagsScore = Integer.bitCount(format.roleFlags & parameters.preferredRoleFlags); hasPreferredIsForcedFlag = (preferredLanguageScore > 0 && !isForced) || (preferredLanguageScore == 0 && isForced); hasPreferredRoleFlags = parameters.preferredRoleFlags > 0; hasCaptionRoleFlags = Integer.bitCount(format.roleFlags & (C.ROLE_FLAG_CAPTION | C.ROLE_FLAG_DESCRIBES_MUSIC_AND_SOUND)); boolean selectedAudioLanguageUndetermined = normalizeUndeterminedLanguageToNull(selectedAudioLanguage) == null; selectedAudioLanguageScore = getFormatLanguageScore(format, selectedAudioLanguage, selectedAudioLanguageUndetermined); isWithinConstraints = (preferredLanguageScore > 0 || (parameters.preferredTextLanguage == null && preferredRoleFlagsScore > 0)) || isDefault || (isForced && selectedAudioLanguageScore > 0); }
Source:
private boolean acceptorAgreesIsLatestRound(PaxosAcceptor acceptor, long round) { try { return round >= acceptor.getLatestSequencePreparedOrAccepted(); } catch (Exception e) { log.debug("latest sequence retrieval failed for acceptor: {}", acceptor, e); throw e; } }

Target:
private boolean acceptorAgreesIsLatestRound(PaxosAcceptor acceptor, long round) { try { return round >= acceptor.getLatestSequencePreparedOrAccepted(); } catch (Exception e) { log.info("latest sequence retrieval failed", e); throw e; } }
Source:
private String getZkPathForKey(byte[] key) { try { return String.format("%s/%s", zkBaseDir, new String(key, "UTF-8")); } catch (UnsupportedEncodingException e) { throw new SamzaException(e); } }

Target:
private String getZkPathForKey(byte[] key) { return String.format("%s/%s", zkBaseDir, new String(key, Charset.forName("UTF-8"))); }
Source:
public void process(Exchange exchange) throws Exception { Message in = exchange.getIn(); String binaryUri = (String) in.getHeader(FCREPO_URI); String binarySubPath = (String) in.getHeader(CdrBinarySubPath); final ExecResult result = (ExecResult) in.getBody(); String derivativePath = new BufferedReader(new InputStreamReader(result.getStdout())) .lines().collect(Collectors.joining("\n")); moveFile(binaryUri, binarySubPath, derivativePath); }

Target:
public void process(Exchange exchange) throws Exception { Message in = exchange.getIn(); String binaryUri = (String) in.getHeader(FCREPO_URI); String binaryId = PIDs.get(binaryUri).getId(); String derivativePath = RepositoryPaths .idToPath(binaryId, HASHED_PATH_DEPTH, HASHED_PATH_SIZE); final ExecResult result = (ExecResult) in.getBody(); String derivativeTmpPath = new BufferedReader(new InputStreamReader(result.getStdout())) .lines().collect(Collectors.joining("\n")); derivativeTmpPath += "." + fileExtension; String derivativeFinalRelative = derivativePath + binaryId + "." + fileExtension; Path derivativeFinalPath = Paths.get(derivativeBasePath, derivativeFinalRelative); moveFile(derivativeTmpPath, derivativeFinalPath); log.info("Adding derivative for from {}", binaryUri, derivativeFinalPath); }
Source:
public AbstractAnnotationsDetail(final AbstractBuild<?, ?> owner, final DetailFactory detailFactory, final Collection<FileAnnotation> annotations, final String defaultEncoding, final String name, final Hierarchy hierarchy) { super(name, hierarchy); this.owner = owner; this.detailFactory = detailFactory; this.defaultEncoding = defaultEncoding; addAnnotations(annotations); }

Target:
public AbstractAnnotationsDetail(final AbstractBuild<?, ?> owner, final DetailFactory detailFactory, final Collection<FileAnnotation> annotations, final String defaultEncoding, final String name, final Hierarchy hierarchy) { this((Run<?, ?>) owner, detailFactory, annotations, defaultEncoding, name, hierarchy); }
Source:
protected void configure() { bind(KeycloakUserRemover.class); bind(RemoveUserListener.class).asEagerSingleton(); }

Target:
protected void configure() { bind(RemoveUserListener.class).asEagerSingleton(); }
Source:
private void updateWidgetOffsets(int fromOffset) { if (document == null) { widgetLines = 0; return; } final int docLines = document.getNumberOfLines(); if (!isFixedWidth()) { widgetLines = docLines; } else { try { final int offset = Math.max(fromOffset, 0); int docLineIndex = Math.max(document.getLineOfOffset(offset), 0); final int docLineOffset = document.getLineOffset(docLineIndex); int widgetLineIndex; if (docLineOffset > 0) { widgetLineIndex = getLineOfOffset(docLineOffset); } else { widgetLineIndex = 0; ensureOffsetsCapacity(widgetLineIndex + 1); widgetLineOffsets[widgetLineIndex] = 0; } for (; docLineIndex < docLines; docLineIndex++) { int lineLength = document.getLineInformation(docLineIndex).getLength(); for (; lineLength > fixedConsoleWidth; lineLength -= fixedConsoleWidth) { widgetLineIndex++; ensureOffsetsCapacity(widgetLineIndex + 1); widgetLineOffsets[widgetLineIndex] = widgetLineOffsets[widgetLineIndex - 1] + fixedConsoleWidth; } final String docLineDelimiter = document.getLineDelimiter(docLineIndex); if (docLineDelimiter != null) { widgetLineIndex++; ensureOffsetsCapacity(widgetLineIndex + 1); widgetLineOffsets[widgetLineIndex] = widgetLineOffsets[widgetLineIndex - 1] + lineLength + docLineDelimiter.length(); } } widgetLines = widgetLineIndex + 1; } catch (BadLocationException e) { log(e); } } }

Target:
private void updateWidgetOffsets(int fromOffset) { if (document == null) { widgetLines = 0; return; } final int docLines = document.getNumberOfLines(); if (!isFixedWidth()) { widgetLines = docLines; } else { try { final int offset = Math.max(fromOffset, 0); int docLineIndex = Math.max(document.getLineOfOffset(offset), 0); final int docLineOffset = document.getLineOffset(docLineIndex); int widgetLineIndex; if (docLineOffset > 0) { widgetLineIndex = getLineOfOffset(docLineOffset); } else { widgetLineIndex = 0; setLookupEntry(widgetLineIndex, 0); } for (; docLineIndex < docLines; docLineIndex++) { int lineLength = document.getLineInformation(docLineIndex).getLength(); for (; lineLength > fixedConsoleWidth; lineLength -= fixedConsoleWidth) { widgetLineIndex++; setLookupEntry(widgetLineIndex, widgetLineOffsets[widgetLineIndex - 1] + fixedConsoleWidth); } final String docLineDelimiter = document.getLineDelimiter(docLineIndex); if (docLineDelimiter != null) { widgetLineIndex++; setLookupEntry(widgetLineIndex, widgetLineOffsets[widgetLineIndex - 1] + lineLength + docLineDelimiter.length()); } } widgetLines = widgetLineIndex + 1; } catch (BadLocationException e) { log(e); } } }
Source:
public MapInfoBean parseSingleMap(String mapName) throws IOException { MapVaultHtmlContentHandler mapVaultHtmlContentHandler = new MapVaultHtmlContentHandler(); URL url = new URL(String.format(environment.getProperty("vault.singleMapUrl"), mapName)); HttpURLConnection urlConnection = (HttpURLConnection) url.openConnection(); try (BufferedReader reader = new BufferedReader(new InputStreamReader(urlConnection.getInputStream()))) { JsonReader jsonReader = new JsonReader(reader); jsonReader.beginObject(); while (jsonReader.hasNext()) { String key = jsonReader.nextName(); if (!"layout".equals(key)) { jsonReader.skipValue(); continue; } String layout = jsonReader.nextString(); List<MapInfoBean> mapInfoBeans = htmlParser.parse(layout, mapVaultHtmlContentHandler); if (!mapInfoBeans.isEmpty()) { for (MapInfoBean mapInfoBean : mapInfoBeans) { if (mapInfoBean.getDisplayName().equalsIgnoreCase(mapName)) { return mapInfoBean; } } } } jsonReader.endObject(); } logger.warn("Map vault could not be read from {}", url); throw new IOException("Map vault could not be read from" + url); }

Target:
public MapInfoBean parseSingleMap(String mapName) throws IOException { MapVaultHtmlContentHandler mapVaultHtmlContentHandler = new MapVaultHtmlContentHandler(); URL url = new URL(String.format(environment.getProperty("vault.singleMapUrl"), mapName)); HttpURLConnection urlConnection = (HttpURLConnection) url.openConnection(); try (BufferedReader reader = new BufferedReader(new InputStreamReader(urlConnection.getInputStream()))) { JsonReader jsonReader = new JsonReader(reader); jsonReader.beginObject(); while (jsonReader.hasNext()) { String key = jsonReader.nextName(); if (!"layout".equals(key)) { jsonReader.skipValue(); continue; } String layout = jsonReader.nextString(); List<MapInfoBean> mapInfoBeans = htmlParser.parse(layout, mapVaultHtmlContentHandler); if (!mapInfoBeans.isEmpty()) { for (MapInfoBean mapInfoBean : mapInfoBeans) { if (mapInfoBean.getTechnicalName().equalsIgnoreCase(mapName)) { return mapInfoBean; } } } } jsonReader.endObject(); } throw new IOException("Map vault could not be read from " + url); }
Source:
public void setUp() { initMocks(this); queryStockLedgerActionService = new QueryStockLedgerActionServiceImpl(stockTransactionService, eventRelay); eventHandler = new QueryStockLedgerEventHandler(queryStockLedgerActionService); request = prepareRequest(); }

Target:
public void setUp() { initMocks(this); eventHandler = new QueryStockLedgerEventHandler(queryStockLedgerActionService); }
Source:
private void checkAndInitSevenZip() { if (Sirius.isFrameworkEnabled(FRAMEWORK_SEVEN_ZIP)) { try { Log.SYSTEM.INFO("Loading 7-ZIP native libraries to support all breeds of archive formats..."); SevenZip.initSevenZipFromPlatformJAR(); sevenZipEnabled = true; } catch (Throwable e) { Exceptions.handle() .to(Log.SYSTEM) .error(e) .withSystemErrorMessage("Failed to inizialize 7-Zip: %s (%s)") .handle(); sevenZipEnabled = false; } } else { sevenZipEnabled = false; } }

Target:
private void checkAndInitSevenZip() { if (Sirius.isFrameworkEnabled(FRAMEWORK_SEVEN_ZIP)) { try { Log.SYSTEM.INFO("Loading 7-ZIP native libraries to support all breeds of archive formats..."); SevenZip.initSevenZipFromPlatformJAR(); sevenZipEnabled = true; } catch (Throwable e) { Exceptions.handle() .to(Log.SYSTEM) .error(e) .withSystemErrorMessage("Failed to initialize 7-Zip: %s (%s)") .handle(); sevenZipEnabled = false; } } else { sevenZipEnabled = false; } }
Source:
public DefaultLeaderRetrievalService(LeaderRetrievalDriverFactory leaderRetrievalDriverFactory) { this.leaderRetrievalDriverFactory = leaderRetrievalDriverFactory; this.lastLeaderAddress = null; this.lastLeaderSessionID = null; running = false; }

Target:
public DefaultLeaderRetrievalService(LeaderRetrievalDriverFactory leaderRetrievalDriverFactory) { this.leaderRetrievalDriverFactory = checkNotNull(leaderRetrievalDriverFactory); this.lastLeaderAddress = null; this.lastLeaderSessionID = null; running = false; }
Source:
private void connector(IProject prj) { try { SyncConfig scfg = SyncConfigManager.getActive(prj); if (scfg == null) return; Logger.log("Connection for project: '" + prj.getName() + "' is '" + scfg.getConnectionName() + "'"); IRemoteConnection irc = scfg.getRemoteConnection(); Logger.log("Connection address is " + irc.getAddress()); ConnectionQueue.push(prj); ITerminalView tvr = (ITerminalView) PlatformUI.getWorkbench() .getActiveWorkbenchWindow().getActivePage() .showView("org.eclipse.tm.terminal.view.TerminalView"); ITerminalConnector[] itcarray = TerminalConnectorExtension .makeTerminalConnectors(); int remoteTools = 0; for (int i = 0; i < itcarray.length; i++) { Logger.log("itcarray is " + itcarray[i].getName()); if("Remote Tools".equals(itcarray[i].getName())) { remoteTools = i; break; } } tvr.newTerminal(itcarray[remoteTools]); } catch (CoreException e1) { Logger.logException(e1); } catch (MissingConnectionException e) { Logger.logException(e); } }

Target:
private void connector(IProject prj) { try { IRemoteConnection irc = Util.getRemoteConnection(prj); if(irc == null) return; Activator.log("Connection for project: '" + prj.getName() + "' is '" + irc + "'"); Activator.log("Connection address is " + irc.getAddress()); final ITerminalView tvr = (ITerminalView) PlatformUI.getWorkbench() .getActiveWorkbenchWindow().getActivePage() .showView("org.eclipse.tm.terminal.view.TerminalView"); ITerminalConnector[] itcarray = TerminalConnectorExtension .makeTerminalConnectors(); int remoteTools = 0; for (int i = 0; i < itcarray.length; i++) { if("Remote Tools".equals(itcarray[i].getName())) { remoteTools = i; break; } } if(itcarray.length==0) { Activator.log("Could not find a terminal connection for "+prj.getName()); return; } final ITerminalConnector inner = itcarray[remoteTools]; Activator.log("inner="+inner.getId()+","+inner.getName()+","+inner.getSettingsSummary()); ITerminalConnector connector = new ConnectorWrapper(inner,prj); tvr.newTerminal(connector); } catch (CoreException e1) { Activator.log(e1); } }