auphong2707/dl4se-code-review-dataset huggingface dataset:
Source:
public LogReplicationSourceManager(LogReplicationRuntimeParameters params, LogReplicationClient client, LogReplicationMetadataManager metadataManager) { this.runtime = CorfuRuntime.fromParameters(CorfuRuntimeParameters.builder() .trustStore(params.getTrustStore()) .tsPasswordFile(params.getTsPasswordFile()) .keyStore(params.getKeyStore()) .ksPasswordFile(params.getKsPasswordFile()) .tlsEnabled(params.isTlsEnabled()).build()); runtime.parseConfigurationString(params.getLocalCorfuEndpoint()).connect(); this.parameters = params; this.config = parameters.getReplicationConfig(); if (config.getStreamsToReplicate() == null || config.getStreamsToReplicate().isEmpty()) { throw new IllegalArgumentException("Invalid Log Replication: Streams to replicate is EMPTY"); } DataSender dataSender = new CorfuDataSender(client); ExecutorService logReplicationFSMWorkers = Executors.newFixedThreadPool(DEFAULT_FSM_WORKER_THREADS, new ThreadFactoryBuilder().setNameFormat("state-machine-worker").build()); ReadProcessor readProcessor = new DefaultReadProcessor(runtime); this.logReplicationFSM = new LogReplicationFSM(this.runtime, config, params.getRemoteClusterDescriptor(), dataSender, readProcessor, logReplicationFSMWorkers); this.logReplicationFSM.setTopologyConfigId(params.getTopologyConfigId()); this.metadataManager = metadataManager; lastAckedTsPoller.scheduleWithFixedDelay(new TsPollingTask(), 0, 15, TimeUnit.SECONDS); }

Target:
public LogReplicationSourceManager(LogReplicationRuntimeParameters params, LogReplicationClient client, LogReplicationMetadataManager metadataManager) { this(params, metadataManager, new CorfuDataSender(client)); }
Source:
public static void disableLinks(Browser browser) { if (browser != null && !browser.isDisposed()) { String disableHrefScript = (PlatformUtil.isWindows()) ? "'#'" : "'javascript: void(0);'"; String disablerScript = "var anchors = document.getElementsByTagName('a');" + "for (var i = 0; i < anchors.length; i++) {" + "if (anchors[i].href.indexOf('#') == -1) {" + "anchors[i].href = " + disableHrefScript + ";" + "anchors[i].target = '';" + "}" + "};"; browser.execute("(setTimeout(function() { " + disablerScript + "}, 10))();"); disableDynamic(browser, disablerScript); } }

Target:
public static void disableLinks(Browser browser) { if (browser != null && !browser.isDisposed()) { String disableHrefScript = (PlatformUtil.isWindows()) ? "'#'" : "'javascript: void(0);'"; String disablerScript = "var anchors = document.getElementsByTagName('a');" + "for (var i = 0; i < anchors.length; i++) {" + "if (anchors[i].href.indexOf('#') == -1 || anchors[i].href.indexOf('://localhost:') == -1) {" + "anchors[i].href = " + disableHrefScript + ";" + "anchors[i].target = '';" + "}" + "};"; browser.execute("(setTimeout(function() { " + disablerScript + "}, 10))();"); disableDynamic(browser, disablerScript); } }
Source:
public void testGetAllForVdsGroupWithPermissionsForUnpriviligedUser() { List<VDS> result = dao.getAllForVdsGroup(existingVds.getvds_group_id(), UNPRIVILEGED_USER_ID, true); assertNotNull(result); assertTrue(result.size() == 0); }

Target:
public void testGetAllForVdsGroupWithPermissionsForUnpriviligedUser() { List<VDS> result = dao.getAllForVdsGroup(existingVds.getvds_group_id(), UNPRIVILEGED_USER_ID, true); assertNotNull(result); assertTrue(result.isEmpty()); }
Source:
private void dismissPreparingDialog() { PrepareDialogFragment fragment = (PrepareDialogFragment) getSupportFragmentManager().findFragmentByTag(getString(R.string.prepare_dialog)); if (fragment != null && fragment.isAdded()) { fragment.dismiss(); } }

Target:
private void dismissPreparingDialog() { PrepareDialogFragment fragment = (PrepareDialogFragment) getSupportFragmentManager().findFragmentByTag("prepare_dialog"); if (fragment != null && fragment.isAdded()) { fragment.dismiss(); } }
Source:
static List<HostSpecStatus> getCandidateHosts(HostSpec[] hostSpecs, HostRequirement targetServerType, long hostRecheckMillis) { List<HostSpecStatus> candidates = new ArrayList<HostSpecStatus>(hostSpecs.length); long latestAllowedUpdate = currentTimeMillis() - hostRecheckMillis; synchronized (hostStatusMap) { for (HostSpec hostSpec : hostSpecs) { HostSpecStatus hostInfo = hostStatusMap.get(hostSpec); if (hostInfo == null) { hostInfo = new HostSpecStatus(hostSpec, null, Long.MAX_VALUE); } if (hostInfo.status == null || hostInfo.lastUpdated < latestAllowedUpdate || targetServerType.allowConnectingTo(hostInfo.status)) { candidates.add(hostInfo); } } } return candidates; }

Target:
static List<HostSpec> getCandidateHosts(HostSpec[] hostSpecs, HostRequirement targetServerType, long hostRecheckMillis) { List<HostSpec> candidates = new ArrayList<HostSpec>(hostSpecs.length); long latestAllowedUpdate = currentTimeMillis() - hostRecheckMillis; synchronized (hostStatusMap) { for (HostSpec hostSpec : hostSpecs) { HostSpecStatus hostInfo = hostStatusMap.get(hostSpec); if (hostInfo == null || hostInfo.lastUpdated < latestAllowedUpdate || targetServerType.allowConnectingTo(hostInfo.status)) { candidates.add(hostSpec); } } } return candidates; }
Source:
public static Lyrics parse(Song song, String data) { Lyrics lyrics = new SynchronizedLyricsLRC(song, data); if (lyrics.isValid()) { return lyrics.parse(false); } else { return new Lyrics(song, data).parse(false); } }

Target:
public static Lyrics parse(Song song, String data) { for (Class<? extends Lyrics> format : Lyrics.FORMATS) { try { Lyrics lyrics = format.newInstance().setData(song, data); if (lyrics.isValid()) return lyrics.parse(false); } catch (Exception e) { e.printStackTrace(); } } return new Lyrics().setData(song, data).parse(false); }
Source:
private boolean tryAssignTask(final Task task, final RemoteTaskRunnerWorkItem taskRunnerWorkItem) throws Exception { Preconditions.checkNotNull(task, "task"); Preconditions.checkNotNull(taskRunnerWorkItem, "taskRunnerWorkItem"); Preconditions.checkArgument(task.getId().equals(taskRunnerWorkItem.getTaskId()), "task id != workItem id"); if (runningTasks.containsKey(task.getId()) || findWorkerRunningTask(task.getId()) != null) { log.info("Task[%s] already running.", task.getId()); return true; } else { Optional<ZkWorker> zkWorker = strategy.findWorkerForTask(zkWorkers, task); if (zkWorker.isPresent()) { announceTask(task, zkWorker.get(), taskRunnerWorkItem); return true; } else { return false; } } }

Target:
private boolean tryAssignTask(final Task task, final RemoteTaskRunnerWorkItem taskRunnerWorkItem) throws Exception { Preconditions.checkNotNull(task, "task"); Preconditions.checkNotNull(taskRunnerWorkItem, "taskRunnerWorkItem"); Preconditions.checkArgument(task.getId().equals(taskRunnerWorkItem.getTaskId()), "task id != workItem id"); if (runningTasks.containsKey(task.getId()) || findWorkerRunningTask(task.getId()) != null) { log.info("Task[%s] already running.", task.getId()); return true; } else { final Optional<ImmutableZkWorker> immutableZkWorker = strategy.findWorkerForTask( ImmutableMap.copyOf( Maps.transformEntries( zkWorkers, new Maps.EntryTransformer<String, ZkWorker, ImmutableZkWorker>() { @Override public ImmutableZkWorker transformEntry( String key, ZkWorker value ) { return value.toImmutable(); } } ) ), task ); if (immutableZkWorker.isPresent()) { final ZkWorker zkWorker = zkWorkers.get(immutableZkWorker.get().getWorker().getHost()); announceTask(task, zkWorker, taskRunnerWorkItem); return true; } else { log.debug("Worker nodes %s do not have capacity to run any more tasks!", zkWorkers.values()); return false; } } }
Source:
public String toString() { return "BackupMultiKeyWriteRpcCommand{" + "commandInvocationId=" + commandInvocationId + ", map=" + map + ", metadata=" + metadata + ", flags=" + EnumUtil.prettyPrintBitSet(flags, Flag.class) + ", topologyId=" + topologyId + ", sequence=" + sequence + '}'; }

Target:
public String toString() { return "BackupMultiKeyWriteRpcCommand{" + "operation=" + operation + ", commandInvocationId=" + commandInvocationId + ", entries=" + entries + ", metadata=" + metadata + ", flags=" + EnumUtil.prettyPrintBitSet(flags, Flag.class) + ", topologyId=" + topologyId + ", sequence=" + sequence + ", function=" + function + ", params=" + params + ", keyDataConversion=" + keyDataConversion + ", valueDataConversion=" + valueDataConversion + ", cacheName=" + cacheName + '}'; }
Source:
public void uninstall() { CommCareApplication._().logout(); CommCareApplication._().initializeAppResources(new CommCareApp(appRecord)); CommCareApp app = CommCareApplication._().getCurrentApp(); app.teardownSandbox(); SqlStorage<UserKeyRecord> userDatabase = CommCareApplication._().getAppStorage(UserKeyRecord.class); for (UserKeyRecord user : userDatabase) { this.getDatabasePath(CommCareUserOpenHelper.getDbName(user.getUuid())).delete(); } this.getDatabasePath(DatabaseAppOpenHelper.getDbName(app.getAppRecord().getApplicationId())).delete(); CommCareApplication._().getGlobalStorage(ApplicationRecord.class).remove(appRecord.getID()); CommCareApplication._().setAppResourceState(CommCareApplication.STATE_UNINSTALLED); rebootCommCare(); }

Target:
private void uninstall() { CommCareApplication._().expireUserSession(); CommCareApplication._().uninstall(appRecord); rebootCommCare(); }
Source:
protected MistDataEvent generateEvent(final I input) { if (extractTimestampFunc == null) { return new MistDataEvent(input, TimestampGenerator.getCurrentTimestamp()); } else { Tuple<V, Long> extractionResult = extractTimestampFunc.apply(input); if (extractionResult.getKey() == null || extractionResult.getValue() == null) { throw new IllegalArgumentException("Timestamp extraction from input data is failed. Data is " + extractionResult.getKey().toString() + ", timestamp is " + extractionResult.getValue().toString()); } return new MistDataEvent(extractionResult.getKey(), extractionResult.getValue()); } }

Target:
protected MistDataEvent generateEvent(final I input) { if (extractTimestampFunc == null) { return new MistDataEvent(input, getCurrentTimestamp()); } else { Tuple<V, Long> extractionResult = extractTimestampFunc.apply(input); if (extractionResult.getKey() == null || extractionResult.getValue() == null) { throw new IllegalArgumentException("Timestamp extraction from input data is failed. Data is " + extractionResult.getKey().toString() + ", timestamp is " + extractionResult.getValue().toString()); } return new MistDataEvent(extractionResult.getKey(), extractionResult.getValue()); } }
Source:
public String getRequestor(final AllocatedEvaluator allocatedEvaluator) { final String evaluatorId = allocatedEvaluator.getId(); if (!idMap.containsKey(evaluatorId)) { final Map.Entry<String, EventHandler<ActiveContext>> value = requestQueue.poll(); if (value == null) { LOG.severe("Failed to find a requestor for " + allocatedEvaluator.toString()); return null; } else { final String requestorId = value.getKey(); final EventHandler<ActiveContext> handler = value.getValue(); idMap.put(evaluatorId, requestorId); resourceRequestCallbackRouter.register(evaluatorId, handler); return requestorId; } } else { return idMap.get(evaluatorId); } }

Target:
public String getRequestor(final AllocatedEvaluator allocatedEvaluator) { final String evaluatorId = allocatedEvaluator.getId(); if (!idMap.containsKey(evaluatorId)) { final Map.Entry<String, EventHandler<ActiveContext>> value = requestQueue.poll(); if (value == null) { LOG.severe("Failed to find a requestor for " + allocatedEvaluator.toString()); return null; } else { final String requestorId = value.getKey(); final EventHandler<ActiveContext> handler = value.getValue(); idMap.put(evaluatorId, requestorId); handlerMap.put(evaluatorId, handler); return requestorId; } } else { return idMap.get(evaluatorId); } }
Source:
private void restartRmAndCheckFinalState(boolean nodesShouldBeRecreated) throws Exception { rmHelper = new RMTHelper(); startRmWithConfig(RESTART_CONFIG); Assert.assertFalse("Nodes preservation should not be activated on RM restart for the test", PAResourceManagerProperties.RM_PRESERVE_NODES_ON_EXIT.getValueAsBoolean()); assertThat(rmHelper.isRMStarted()).isTrue(); RMMonitorEventReceiver resourceManagerMonitor = (RMMonitorEventReceiver) resourceManager; ArrayList<RMNodeSourceEvent> nodeSourceEvent = resourceManagerMonitor.getInitialState().getNodeSource(); assertThat(nodeSourceEvent.size()).isEqualTo(1); assertThat(nodeSourceEvent.get(0).getSourceName()).isEqualTo(NODE_SOURCE_NAME); if (nodesShouldBeRecreated) { rmHelper.waitForAnyMultipleNodeEvent(RMEventType.NODE_STATE_CHANGED, TestSSHInfrastructureV2.NB_NODES); } Set<String> allNodes = resourceManagerMonitor.getState().getAllNodes(); assertThat(allNodes.size()).isEqualTo(TestSSHInfrastructureV2.NB_NODES); Set<String> nodeSourceNames = new HashSet<>(); nodeSourceNames.add(NODE_SOURCE_NAME); Set<String> aliveNodeUrls = resourceManager.listAliveNodeUrls(nodeSourceNames); assertThat(aliveNodeUrls.size()).isEqualTo(TestSSHInfrastructureV2.NB_NODES); BooleanWrapper lockSucceeded = resourceManager.lockNodes(allNodes); assertThat(lockSucceeded).isEqualTo(new BooleanWrapper(true)); BooleanWrapper unlockSucceeded = resourceManager.unlockNodes(allNodes); assertThat(unlockSucceeded).isEqualTo(new BooleanWrapper(true)); }

Target:
private void restartRmAndCheckFinalState(boolean nodesShouldBeRecreated) throws Exception { rmHelper = new RMTHelper(); startRmWithConfig(RESTART_CONFIG); assertThat(PAResourceManagerProperties.RM_PRESERVE_NODES_ON_EXIT.getValueAsBoolean()).isFalse(); assertThat(rmHelper.isRMStarted()).isTrue(); RMMonitorEventReceiver resourceManagerMonitor = (RMMonitorEventReceiver) resourceManager; ArrayList<RMNodeSourceEvent> nodeSourceEvent = resourceManagerMonitor.getInitialState().getNodeSource(); assertThat(nodeSourceEvent.size()).isEqualTo(1); assertThat(nodeSourceEvent.get(0).getSourceName()).isEqualTo(NODE_SOURCE_NAME); if (nodesShouldBeRecreated) { rmHelper.waitForAnyMultipleNodeEvent(RMEventType.NODE_STATE_CHANGED, TestSSHInfrastructureV2.NB_NODES); } Set<String> allNodes = resourceManagerMonitor.getState().getAllNodes(); assertThat(allNodes.size()).isEqualTo(TestSSHInfrastructureV2.NB_NODES); Set<String> nodeSourceNames = new HashSet<>(); nodeSourceNames.add(NODE_SOURCE_NAME); Set<String> aliveNodeUrls = resourceManager.listAliveNodeUrls(nodeSourceNames); assertThat(aliveNodeUrls.size()).isEqualTo(TestSSHInfrastructureV2.NB_NODES); BooleanWrapper lockSucceeded = resourceManager.lockNodes(allNodes); assertThat(lockSucceeded).isEqualTo(new BooleanWrapper(true)); BooleanWrapper unlockSucceeded = resourceManager.unlockNodes(allNodes); assertThat(unlockSucceeded).isEqualTo(new BooleanWrapper(true)); }
Source:
public void createEnhancementTest() throws Exception { mvFile = moveDir.newFile(fileName + ".PNG"); mvFile.deleteOnExit(); processor.process(exchange); assertTrue(mvFile.exists()); }

Target:
public void createEnhancementTest() throws Exception { mvFile = new File(finalDir.getAbsolutePath() + "/"+ fileName + ".PNG"); processor.process(exchange); assertTrue(mvFile.exists()); }
Source:
public FunctionRequirements requirements( SwaptionTrade trade, Set<Measure> measures, CalculationParameters parameters, ReferenceData refData) { Swaption product = trade.getProduct(); IborIndex index = product.getIndex(); SwaptionMarketLookup swaptionLookup = parameters.getParameter(SwaptionMarketLookup.class); FunctionRequirements swaptionReqs = swaptionLookup.requirements(ImmutableSet.of(index)); ImmutableSet<MarketDataKey<?>> valueReqs = ImmutableSet.<MarketDataKey<?>>builder() .add(DiscountCurveKey.of(product.getCurrency())) .add(IborIndexCurveKey.of(index)) .addAll(swaptionReqs.getSingleValueRequirements()) .build(); return FunctionRequirements.builder() .singleValueRequirements(valueReqs) .timeSeriesRequirements(IndexRateKey.of(index)) .outputCurrencies(product.getCurrency()) .build(); }

Target:
public FunctionRequirements requirements( SwaptionTrade trade, Set<Measure> measures, CalculationParameters parameters, ReferenceData refData) { Swaption product = trade.getProduct(); IborIndex index = product.getIndex(); SwaptionMarketDataLookup swaptionLookup = parameters.getParameter(SwaptionMarketDataLookup.class); FunctionRequirements swaptionReqs = swaptionLookup.requirements(index); ImmutableSet<MarketDataKey<?>> valueReqs = ImmutableSet.<MarketDataKey<?>>builder() .add(DiscountCurveKey.of(product.getCurrency())) .add(IborIndexCurveKey.of(index)) .addAll(swaptionReqs.getSingleValueRequirements()) .build(); return FunctionRequirements.builder() .singleValueRequirements(valueReqs) .timeSeriesRequirements(IndexRateKey.of(index)) .outputCurrencies(product.getCurrency()) .build(); }
Source:
private boolean readNeedsLock(InvocationContext ctx, FlagAffectedCommand command) { return ctx.isInTxScope() && ctx.isOriginLocal() && command.hasAnyFlag(FlagBitSets.FORCE_WRITE_LOCK) && !hasSkipLocking(command); }

Target:
private boolean readNeedsLock(InvocationContext ctx, FlagAffectedCommand command) { if (ctx.isInTxScope() && ctx.isOriginLocal()) { boolean forceWriteLock = command.hasAnyFlag(FlagBitSets.FORCE_WRITE_LOCK); if (forceWriteLock && hasSkipLocking(command)) { throw log.invalidForceWriteLockAndSkipLockingFlags(); } return forceWriteLock; } else { return false; } }
Source:
public EmbeddedDatabaseInfo getEmbeddedDatabaseInfo(Stack stack) { if (stack.getCluster().getEmbeddedDatabaseOnAttachedDisk()) { int volumeCount = calculateVolumeCountOnGatewayGroup(stack); return new EmbeddedDatabaseInfo(volumeCount > 0, volumeCount); } else { return new EmbeddedDatabaseInfo(false, 0); } }

Target:
public EmbeddedDatabaseInfo getEmbeddedDatabaseInfo(Stack stack) { if (stack.getCluster().getEmbeddedDatabaseOnAttachedDisk()) { int volumeCount = calculateVolumeCountOnGatewayGroup(stack); return new EmbeddedDatabaseInfo(volumeCount); } else { return new EmbeddedDatabaseInfo(0); } }
Source:
public static String typeNameFor(final Type type) { String typeName = typeNameLookup.get(type); if (typeName == null) { Class<?> clazz = (Class<?>) type; if ("java.time.LocalDate".equals(clazz.getName())) { typeName = "date"; } else if ("java.time.LocalDateTime".equals(clazz.getName())) { typeName = "date-time"; } } return typeName; }

Target:
public static String typeNameFor(final Type type) { return typeNameLookup.get(type); }
Source:
public VariableDeclarator setType(final Type type) { assertNotNull(type); notifyPropertyChange(ObservableProperty.TYPE, this.type, type); if (this.getParentNode().isPresent() && this.getParentNode().get() instanceof NodeWithVariables) { NodeWithVariables nodeWithVariables = (NodeWithVariables)this.getParentNode().get(); Type currentMaxCommonType = nodeWithVariables.getMaximumCommonType(); List<Type> types = new LinkedList<>(); int index = nodeWithVariables.getVariables().indexOf(this); for (int i=0;i<nodeWithVariables.getVariables().size();i++) { if (i == index) { types.add(type); } else { types.add(nodeWithVariables.getVariable(i).getType()); } } Type newMaxCommonType = NodeWithVariables.maximumCommonType(types); ((Node)nodeWithVariables).notifyPropertyChange(ObservableProperty.MAXIMUM_COMMON_TYPE, currentMaxCommonType, newMaxCommonType); } if (this.type != null) { this.type.setParentNode(null); } this.type = type; setAsParentNodeOf(type); return this; }

Target:
public VariableDeclarator setType(final Type type) { assertNotNull(type); notifyPropertyChange(ObservableProperty.TYPE, this.type, type); if (this.type != null) this.type.setParentNode(null); this.type = type; setAsParentNodeOf(type); return this; }
Source:
public Map<String, Object> getDeliveryAnnotations() { if (deliveryAnnotations == null) { this.deliveryAnnotations = new HashMap<>(); } return deliveryAnnotations; }

Target:
public Map<String, Object> getDeliveryAnnotations() { return deliveryAnnotations; }
Source:
static void addMptrToDiv(LinkedMetsResource link, DivType div) { div.setORDER(link.getOrder()); Mptr mptr = new Mptr(); if (ALLOWED_LOCTYPE_VALUES.contains(link.getLoctype())) { mptr.setLOCTYPE(link.getLoctype()); } else { mptr.setLOCTYPE(OTHER); mptr.setOTHERLOCTYPE(Objects.toString(link.getLoctype())); } mptr.setHref(link.getUri().toASCIIString()); div.getMptr().add(mptr); }

Target:
static void addMptrToDiv(LinkedMetsResource link, DivType div) { div.setORDER(link.getOrder()); Mptr mptr = new Mptr(); if (AllowedLoctypeValues.contains(link.getLoctype())) { mptr.setLOCTYPE(link.getLoctype()); } else { mptr.setLOCTYPE(AllowedLoctypeValues.OTHER.toString()); mptr.setOTHERLOCTYPE(Objects.toString(link.getLoctype())); } mptr.setHref(link.getUri().toASCIIString()); div.getMptr().add(mptr); }
Source:
protected Pair<Boolean, EngineFault> runConnectionStorageToDomain(StorageDomain storageDomain, Guid vdsId, int type) { Guid poolId = Guid.Empty; if (storageDomain.getStoragePoolId() != null) { poolId = storageDomain.getStoragePoolId(); } return runConnectionStorageToDomain(storageDomain, vdsId, type, null, poolId); }

Target:
protected Pair<Boolean, EngineFault> runConnectionStorageToDomain(StorageDomain storageDomain, Guid vdsId, int type) { return runConnectionStorageToDomain(storageDomain, vdsId, type, null, storageDomain.getStoragePoolId()); }
Source:
private static String removeNonDefault(String key, Map<String, String> options, Map<String, String> defaults) { String defaultValue = defaults.get(key); if (options.containsKey(key)) { String value = options.remove(key); if (!defaultValue.equals(value)) { return value; } } return null; }

Target:
private static String removeNonDefault(String key, Map<String, String> options, Map<String, String> defaults) { String defaultValue = defaults.get(key); if (options.containsKey(key)) { String value = options.remove(key); if (defaultValue == null || !defaultValue.equals(value)) { return value; } } return null; }
Source:
private JobAttempt newJob(AlluxioURI filePath, int replication) { final ClientContext clientContext = ClientContext.create(mFsContext.getPathConf(filePath)); if (mClient == null) { mClient = JobMasterClient.Factory.create( JobMasterClientContext.newBuilder(clientContext).build()); } JobAttempt jobAttempt = new JobAttempt(new LoadConfig(filePath.getPath(), replication), new CountingRetry(3)); jobAttempt.run(); return jobAttempt; }

Target:
private JobAttempt newJob(AlluxioURI filePath, int replication) { JobAttempt jobAttempt = new JobAttempt(new LoadConfig(filePath.getPath(), replication), new CountingRetry(3)); jobAttempt.run(); return jobAttempt; }
Source:
@Test public void testFilterRedundant() { assertModel(MODEL) .query( "select * from zips where state > 'CA' and state < 'PZ' and state = 'OK'") .runs() .queryContains( mongoChecker( "{\n" + " \"$match\": {\n" + " \"state\": \"OK\"\n" + " }\n" + "}", "{$project: {CITY: '$city', LONGITUDE: '$loc[0]', LATITUDE: '$loc[1]', POP: '$pop', STATE: '$state', ID: '$_id'}}")); }

Target:
@Test public void testFilterRedundant() { assertModel(MODEL) .query( "select * from zips where state > 'CA' and state < 'AZ' and state = 'OK'") .runs() .queryContains(mongoChecker()); }
Source:
public Double evaluate(final Double x) { final CapFloorIbor capStrike = _capStandard.withStrike(x); return presentValueStandard(capStrike, _curves).getAmount(_capStandard.getCurrency()); }

Target:
public Double evaluate(final Double x) { return presentValueStandard(_forward, x, _expiry, _capStandard.isCap(), _df, _capStandard.getNotional(), _capStandard.getPaymentYearFraction()); }
Source:
private int getIndexOfTableForColumn(QueryModel model, CharSequence column, int dot, int position) throws SqlException { column = Chars.toLowerCase(column); ObjList<QueryModel> joinModels = model.getJoinModels(); int index = -1; if (dot == -1) { for (int i = 0, n = joinModels.size(); i < n; i++) { if (joinModels.getQuick(i).getAliasToColumnMap().excludes(column)) { continue; } if (index != -1) { throw SqlException.ambiguousColumn(position); } index = i; } if (index == -1) { throw SqlException.invalidColumn(position, column); } } else { index = model.getAliasIndex(column, 0, dot); if (index == -1) { throw SqlException.$(position, "Invalid table name or alias"); } if (joinModels.getQuick(index).getAliasToColumnMap().excludes(column, dot + 1, column.length())) { throw SqlException.invalidColumn(position, column); } } return index; }

Target:
private int getIndexOfTableForColumn(QueryModel model, CharSequence column, int dot, int position) throws SqlException { ObjList<QueryModel> joinModels = model.getJoinModels(); int index = -1; if (dot == -1) { for (int i = 0, n = joinModels.size(); i < n; i++) { if (joinModels.getQuick(i).getAliasToColumnMap().excludes(column)) { continue; } if (index != -1) { throw SqlException.ambiguousColumn(position); } index = i; } if (index == -1) { throw SqlException.invalidColumn(position, column); } } else { index = model.getAliasIndex(column, 0, dot); if (index == -1) { throw SqlException.$(position, "Invalid table name or alias"); } if (joinModels.getQuick(index).getAliasToColumnMap().excludes(column, dot + 1, column.length())) { throw SqlException.invalidColumn(position, column); } } return index; }
Source:
public ThrowableProblem getCause() { final Throwable cause = super.getCause(); if (cause == null) { return null; } checkState(cause instanceof ThrowableProblem, "Expected throwable problem cause, but got %s", cause); return (ThrowableProblem) cause; }

Target:
public ThrowableProblem getCause() { return (ThrowableProblem) super.getCause(); }
Source:
private void printAdditionalContext(Context additionalContext, String adminConsoleURL, String webContextRoot) { if ("/".equals(webContextRoot)) { webContextRoot = ""; } if (additionalContext != null && !"".equals(additionalContext.getContextName()) && !"null".equals(additionalContext.getContextName())) { int index = adminConsoleURL.lastIndexOf("carbon"); String defContextUrl = adminConsoleURL.substring(0, index); if (!"".equals(webContextRoot)) { defContextUrl = defContextUrl.replace(webContextRoot, ""); } defContextUrl += additionalContext.getContextName(); if (additionalContext.getDescription() != null) { if (additionalContext.getProtocol() != null && "http".equals(additionalContext.getProtocol())) { log.info(additionalContext.getDescription() + " : " + CarbonUIUtil.https2httpURL(defContextUrl)); } else { log.info(additionalContext.getDescription() + " : " + defContextUrl); } } else { log.info("Default Context : " + defContextUrl); } } }

Target:
private void printAdditionalContext(Context additionalContext, String adminConsoleURL, String webContextRoot) { if (webContextRoot == null || webContextRoot.isEmpty()) { log.error("WebContextRoot can't be null or empty. It should be either '/' or '/<some value>'"); return; } if ("/".equals(webContextRoot)) { webContextRoot = ""; } if (additionalContext != null && !"".equals(additionalContext.getContextName()) && !"null".equals(additionalContext.getContextName())) { int index = adminConsoleURL.lastIndexOf("carbon"); String defContextUrl = adminConsoleURL.substring(0, index); if (!"".equals(webContextRoot)) { defContextUrl = defContextUrl.replace(webContextRoot, ""); } defContextUrl += additionalContext.getContextName(); if (additionalContext.getDescription() != null) { if (additionalContext.getProtocol() != null && "http".equals(additionalContext.getProtocol())) { log.info(additionalContext.getDescription() + " : " + CarbonUIUtil.https2httpURL(defContextUrl)); } else { log.info(additionalContext.getDescription() + " : " + defContextUrl); } } else { log.info("Default Context : " + defContextUrl); } } }
Source:
public void generate(Model model, Resource report) { Resource entry = model.createResource(); entry.addProperty(RDF.type, SHACLM.ValidationResult); report.addProperty(SHACLM.result, entry); Function<Node, RDFNode> rdfNode = (gn)->ModelUtils.convertGraphNodeToRDFNode(gn, entry.getModel()); Function<String, RDFNode> str = (s)->entry.getModel().createLiteral(s); Objects.requireNonNull(focusNode,"focus node"); Objects.requireNonNull(severity,"severity"); Objects.requireNonNull(sourceConstraintComponent, "sourceConstraintComponent"); entry.addProperty(SHACLM.focusNode, rdfNode.apply(focusNode)); entry.addProperty(SHACLM.resultSeverity, rdfNode.apply(severity.level())); entry.addProperty(SHACLM.sourceConstraintComponent, rdfNode.apply(sourceConstraintComponent)); if ( messages != null ) { for ( Node msg : messages ) entry.addProperty(SHACLM.resultMessage, rdfNode.apply(msg)); } if ( sourceConstraint != null ) entry.addProperty(SHACLM.sourceConstraint, rdfNode.apply(sourceConstraint)); if ( source != null ) entry.addProperty(SHACLM.sourceShape, rdfNode.apply(source)); if ( resultPath != null ) { Node pn = ShaclPaths.pathToRDF(model.getGraph()::add, resultPath); entry.addProperty(SHACLM.resultPath, rdfNode.apply(pn)); } if ( value != null ) entry.addProperty(SHACLM.value, rdfNode.apply(value)); }

Target:
public void generate(Model model, Resource report) { Resource entry = model.createResource(); entry.addProperty(RDF.type, SHACLM.ValidationResult); report.addProperty(SHACLM.result, entry); Function<Node, RDFNode> rdfNode = (gn)->ModelUtils.convertGraphNodeToRDFNode(gn, entry.getModel()); Function<String, RDFNode> str = (s)->entry.getModel().createLiteral(s); Objects.requireNonNull(focusNode,"focus node"); Objects.requireNonNull(severity,"severity"); Objects.requireNonNull(sourceConstraintComponent, "sourceConstraintComponent"); entry.addProperty(SHACLM.focusNode, rdfNode.apply(focusNode)); entry.addProperty(SHACLM.resultSeverity, rdfNode.apply(severity.level())); entry.addProperty(SHACLM.sourceConstraintComponent, rdfNode.apply(sourceConstraintComponent)); for ( Node msg : messages ) entry.addProperty(SHACLM.resultMessage, rdfNode.apply(msg)); if ( sourceConstraint != null ) entry.addProperty(SHACLM.sourceConstraint, rdfNode.apply(sourceConstraint)); if ( source != null ) entry.addProperty(SHACLM.sourceShape, rdfNode.apply(source)); if ( resultPath != null ) { Node pn = ShaclPaths.pathToRDF(model.getGraph()::add, resultPath); entry.addProperty(SHACLM.resultPath, rdfNode.apply(pn)); } if ( value != null ) entry.addProperty(SHACLM.value, rdfNode.apply(value)); }
Source:
protected Function<String, Comparator<DigitalExchangeComponent>> getComparators() { return sort -> { switch (sort) { case LAST_UPDATE: return (a, b) -> ObjectUtils.compare(a.getLastUpdate(), b.getLastUpdate()); case VERSION: return (a, b) -> StringUtils.compare(a.getVersion(), b.getVersion()); case TYPE: return (a, b) -> StringUtils.compareIgnoreCase(a.getType(), b.getType()); case RATING: return (a, b) -> Double.compare(a.getRating(), b.getRating()); case INSTALLED: return (a, b) -> Boolean.compare(a.isInstalled(), b.isInstalled()); case NAME: default: return (a, b) -> StringUtils.compareIgnoreCase(a.getName(), b.getName()); } }; }

Target:
protected Function<String, Comparator<DigitalExchangeComponent>> getComparators() { return sort -> { switch (sort) { case LAST_UPDATE: return (a, b) -> ObjectUtils.compare(a.getLastUpdate(), b.getLastUpdate()); case VERSION: return (a, b) -> StringUtils.compareIgnoreCase(a.getVersion(), b.getVersion()); case TYPE: return (a, b) -> StringUtils.compareIgnoreCase(a.getType(), b.getType()); case RATING: return (a, b) -> Double.compare(a.getRating(), b.getRating()); case INSTALLED: return (a, b) -> Boolean.compare(a.isInstalled(), b.isInstalled()); case NAME: default: return (a, b) -> StringUtils.compareIgnoreCase(a.getName(), b.getName()); } }; }
Source:
public void init(BeaconState state, byte[]... pubKeys) { assert pubKeys.length > 0; this.validatorIndices = new HashSet<>(); for (byte[] pubKey : pubKeys) { Validator validator = state.getValidatorSet().getByPubKey(pubKey); if (validator != null) { this.validatorIndices.add(validator.getIndex()); this.pubKeysMap.put(validator.getIndex(), validator.getPubKey()); } else { logger.error("Failed to start proposer for {}: validator does not exist", HashUtil.shortHash(pubKey)); return; } this.validatorIndices.add(validator.getIndex()); } this.proposerThread = Executors.newSingleThreadScheduledExecutor((r) -> { Thread t = Executors.defaultThreadFactory().newThread(r); t.setName("beacon-proposer-thread"); t.setDaemon(true); return t; }); this.lastStateRecalc = state.getCrystallizedState().getLastStateRecalc(); submitIfAssigned(state.getCommittees()); publisher.subscribe(BeaconBlockImported.class, (data) -> { if (data.isBest() && data.getState().getCrystallizedState().getLastStateRecalc() > lastStateRecalc) { this.lastStateRecalc = data.getState().getCrystallizedState().getLastStateRecalc(); this.submitIfAssigned(data.getState().getCommittees()); } }); }

Target:
public void init(BeaconState state, byte[]... pubKeys) { assert pubKeys.length > 0; for (byte[] pubKey : pubKeys) { Validator validator = state.getValidatorSet().getByPubKey(pubKey); if (validator != null) { this.pubKeysMap.put(validator.getIndex(), validator.getPubKey()); } else { logger.error("Failed to start proposer for {}: validator does not exist", HashUtil.shortHash(pubKey)); throw new RuntimeException(HashUtil.shortHash(pubKey) + " validator does not exist"); } } this.proposerThread = Executors.newSingleThreadScheduledExecutor((r) -> { Thread t = Executors.defaultThreadFactory().newThread(r); t.setName("beacon-proposer-thread"); t.setDaemon(true); return t; }); this.lastStateRecalc = state.getCrystallizedState().getLastStateRecalc(); submitIfAssigned(state.getCommittees()); publisher.subscribe(BeaconBlockImported.class, (data) -> { if (data.isBest() && data.getState().getCrystallizedState().getLastStateRecalc() > lastStateRecalc) { this.lastStateRecalc = data.getState().getCrystallizedState().getLastStateRecalc(); this.submitIfAssigned(data.getState().getCommittees()); } }); }
Source:
public void callRandomTickEvent(World world, BlockPos pos, IBlockState state, Random rand, CallbackInfo ci) { BlockRandomTickEvent event = SpongeEventFactory.createBlockRandomTick(Sponge.getGame(), null, new Location((Extent)world, VecHelper.toVector(pos))); Sponge.getGame().getEventManager().post(event); if(event.isCancelled()) { ci.cancel(); } }

Target:
public void callRandomTickEvent(World world, BlockPos pos, IBlockState state, Random rand, CallbackInfo ci) { final BlockRandomTickEvent event = SpongeEventFactory.createBlockRandomTick(Sponge.getGame(), null, new Location((Extent)world, VecHelper.toVector(pos))); Sponge.getGame().getEventManager().post(event); if(event.isCancelled()) { ci.cancel(); } }
Source:
public Constraint vehicleCapacity(ConstraintFactory factory) { return factory.from(Customer.class) .groupBy(Customer::getVehicle, sum(Customer::getDemand)) .filter((vehicle, demand) -> demand > vehicle.getCapacity()) .penalizeLong("vehicleCapacity", HardSoftLongScore.ONE_HARD, (vehicle, demand) -> demand - vehicle.getCapacity()); }

Target:
protected Constraint vehicleCapacity(ConstraintFactory factory) { return factory.from(Customer.class) .groupBy(Customer::getVehicle, sum(Customer::getDemand)) .filter((vehicle, demand) -> demand > vehicle.getCapacity()) .penalizeLong("vehicleCapacity", HardSoftLongScore.ONE_HARD, (vehicle, demand) -> demand - vehicle.getCapacity()); }
Source:
protected int calculateActualMaximumSize(LocalSearchSolverPhaseScope scope) { return this.calculateFadingTabuSize(scope) + this.calculateRegularTabuSize(scope); }

Target:
protected int calculateActualMaximumSize(LocalSearchSolverPhaseScope scope) { return calculateFadingTabuSize(scope) + calculateRegularTabuSize(scope); }
Source:
public void hasObjMapRefsNoIndexObjects() throws IOException { ArrayList<Ref> refs = new ArrayList<>(); refs.add(ref(MASTER, 1)); ReftableConfig cfg = new ReftableConfig(); cfg.setIndexObjects(false); byte[] table = write(refs, cfg); ReftableReader t = read(table); assertFalse(t.hasObjectMap()); }

Target:
public void hasObjMapRefsNoIndexObjects() throws IOException { ArrayList<Ref> refs = new ArrayList<>(); ReftableConfig cfg = new ReftableConfig(); cfg.setIndexObjects(false); cfg.setRefBlockSize(256); cfg.setAlignBlocks(true); int N = 256 * 5 / 25; for (int i= 0; i < N; i++) { refs.add(ref(String.format("%02d/xxxxxxxxxx", i), i)); } byte[] table = write(refs, cfg); ReftableReader t = read(table); assertFalse(t.hasObjectMap()); }
Source:
private Set<URI> fetchInstances(final URI type) throws QueryEvaluationException { final Set<URI> instances = new HashSet<>(); CloseableIteration<Statement, QueryEvaluationException> iter = RyaDAOHelper.query( ryaDAO, null, RDF.TYPE, type, conf); try { while (iter.hasNext()) { final Statement st = iter.next(); if (st.getSubject() instanceof URI) { instances.add((URI) st.getSubject()); } } } finally { if (iter != null) { iter.close(); } } return instances; }

Target:
private Set<URI> fetchInstances(final URI type) throws QueryEvaluationException { final Set<URI> instances = new HashSet<>(); ryaDaoQueryWrapper.queryAll(null, RDF.TYPE, type, new RDFHandlerBase() { @Override public void handleStatement(final Statement st) throws RDFHandlerException { if (st.getSubject() instanceof URI) { instances.add((URI) st.getSubject()); } } }); return instances; }
Source:
public String getName() { return "BOOTSTRAP_LOAD"; }

Target:
public String getName() { return "REPL_BOOTSTRAP_LOAD"; }
Source:
public static Media from(MwQueryPage page) { ImageInfo imageInfo = page.imageInfo(); if(imageInfo == null) { return null; } ExtMetadata metadata = imageInfo.getMetadata(); if (metadata == null) { return new Media(null, imageInfo.getOriginalUrl(), page.title(), "", 0, null, null, null); } Media media = new Media(null, imageInfo.getOriginalUrl(), page.title(), "", 0, DateUtils.getDateFromString(metadata.dateTimeOriginal().value()), DateUtils.getDateFromString(metadata.dateTime().value()), StringUtils.getParsedStringFromHtml(metadata.artist().value()) ); media.setDescriptions(Collections.singletonMap("default", metadata.imageDescription().value())); media.setCategories(MediaDataExtractorUtil.extractCategoriesFromList(metadata.categories().value())); String latitude = metadata.gpsLatitude().value(); String longitude = metadata.gpsLongitude().value(); if(!StringUtils.isNullOrWhiteSpace(latitude) && !StringUtils.isNullOrWhiteSpace(longitude)) { LatLng latLng = new LatLng(Double.parseDouble(latitude), Double.parseDouble(longitude), 0); media.setCoordinates(latLng); } media.setLicense(metadata.licenseShortName().value()); return media; }

Target:
public static Media from(MwQueryPage page) { ImageInfo imageInfo = page.imageInfo(); if(imageInfo == null) { return null; } ExtMetadata metadata = imageInfo.getMetadata(); if (metadata == null) { return new Media(null, imageInfo.getOriginalUrl(), page.title(), "", 0, null, null, null); } Media media = new Media(null, imageInfo.getOriginalUrl(), page.title(), "", 0, DateUtils.getDateFromString(metadata.dateTimeOriginal().value()), DateUtils.getDateFromString(metadata.dateTime().value()), StringUtils.getParsedStringFromHtml(metadata.artist().value()) ); String language = Locale.getDefault().getLanguage(); if (StringUtils.isNullOrWhiteSpace(language)) { language = "default"; } media.setDescriptions(Collections.singletonMap(language, metadata.imageDescription().value())); media.setCategories(MediaDataExtractorUtil.extractCategoriesFromList(metadata.categories().value())); String latitude = metadata.gpsLatitude().value(); String longitude = metadata.gpsLongitude().value(); if(!StringUtils.isNullOrWhiteSpace(latitude) && !StringUtils.isNullOrWhiteSpace(longitude)) { LatLng latLng = new LatLng(Double.parseDouble(latitude), Double.parseDouble(longitude), 0); media.setCoordinates(latLng); } media.setLicenseInformation(metadata.licenseShortName().value(), metadata.licenseUrl().value()); return media; }
Source:
AuthFileCredential(String filepath, IdentityClientOptions identityClientOptions) { Objects.requireNonNull(filepath, "'filepath' cannot be null."); Objects.requireNonNull(identityClientOptions, "'identityClientOptions' cannot be null."); this.filepath = filepath; this.identityClientOptions = identityClientOptions; ensureCredential(); }

Target:
AuthFileCredential(String filepath, IdentityClientOptions identityClientOptions) { Objects.requireNonNull(filepath, "'filepath' cannot be null."); Objects.requireNonNull(identityClientOptions, "'identityClientOptions' cannot be null."); this.filepath = filepath; this.identityClientOptions = identityClientOptions; }
Source:
public void testList() throws IOException { if (skipTest()) return; final File a = new File(root, "a"); final File b = new File(root, "b"); final File d = new File(root, "d"); write(a, "a"); access.symlink(b, "a"); assertTrue("created " + d, d.mkdir()); DirEnt[] ent = access.list(root); assertEquals(4, ent.length); Arrays.sort(ent, new Comparator<DirEnt>() { public int compare(DirEnt a, DirEnt b) { return a.getName().compareTo(b.getName()); } }); DirEnt ent_git = ent[0]; DirEnt ent_a = ent[1]; DirEnt ent_b = ent[2]; DirEnt ent_d = ent[3]; assertEquals(".git", ent_git.getName()); assertEquals("a", ent_a.getName()); assertEquals("b", ent_b.getName()); assertEquals("d", ent_d.getName()); assertEquals(DirEnt.TYPE_DIRECTORY, ent_git.getType()); assertEquals(DirEnt.TYPE_FILE, ent_a.getType()); assertEquals(DirEnt.TYPE_SYMLINK, ent_b.getType()); assertEquals(DirEnt.TYPE_DIRECTORY, ent_d.getType()); }

Target:
public void testList() throws IOException { if (skipTest()) return; final File a = new File(root, "a€"); final File b = new File(root, "b€"); final File d = new File(root, "d€"); write(a, "a€"); access.symlink(b, "a€"); assertTrue("created " + d, d.mkdir()); for (int i = 0; i < 116; i++) { final String name = fileName(i); final File f = new File(root, name); write(f, name); } DirEnt[] ent = access.list(root); assertEquals(120, ent.length); Arrays.sort(ent, new Comparator<DirEnt>() { public int compare(DirEnt d1, DirEnt d2) { return d1.getName().compareTo(d2.getName()); } }); DirEnt ent_git = ent[0]; DirEnt ent_a = ent[1]; DirEnt ent_b = ent[2]; DirEnt ent_d = ent[3]; assertEquals(".git", ent_git.getName()); assertEquals("a€", ent_a.getName()); assertEquals("b€", ent_b.getName()); assertEquals("d€", ent_d.getName()); assertEquals(DirEnt.TYPE_DIRECTORY, ent_git.getType()); assertEquals(DirEnt.TYPE_FILE, ent_a.getType()); assertEquals(DirEnt.TYPE_SYMLINK, ent_b.getType()); assertEquals(DirEnt.TYPE_DIRECTORY, ent_d.getType()); for (int i = 4; i < 120; i++) { DirEnt e = ent[i]; assertEquals(fileName(i - 4), e.getName()); assertEquals(DirEnt.TYPE_FILE, e.getType()); } }
Source:
PRED_commit_delta_4(Term a1, Term a2, Term a3, Term a4, Operation n) { arg1 = a1; arg2 = a2; arg3 = a3; arg4 = a4; cont = n; }

Target:
public PRED_commit_delta_4(Term a1, Term a2, Term a3, Term a4, Operation n) { arg1 = a1; arg2 = a2; arg3 = a3; arg4 = a4; cont = n; }
Source:
public void verifyPinDataWasChanged(String pinName, String pinDesc) { waitForElementVisibleByElement(mapFrame); driver.switchTo().frame(mapFrame); waitForElementVisibleByElement(popUpContent); scrollToElement(popUpContent); waitForElementVisibleByElement(pinTitle); waitForElementVisibleByElement(pinDescription); String actualTitle = pinTitle.getText(); String actualDesc = pinDescription.getText(); Assertion.assertNotEquals(pinName, actualTitle); Assertion.assertNotEquals(pinDesc, actualDesc); }

Target:
public void verifyPinDataWasChanged(String pinName, String pinDesc) { waitForElementVisibleByElement(mapFrame); driver.switchTo().frame(mapFrame); waitForElementVisibleByElement(popUpContent); scrollToElement(popUpContent); waitForElementVisibleByElement(pinTitle); waitForElementVisibleByElement(pinDescription); Assertion.assertNotEquals(pinName, pinTitle.getText()); Assertion.assertNotEquals(pinDesc, pinDescription.getText()); }
Source:
public void testStr() throws Exception { checkStr("''", "", false, false, false, false); checkStr("'s'", "s", false, false, false, false); checkStr("b''", "", true, false, false, false); checkStr("b's'", "s", true, false, false, false); checkStr("f''", "", false, true, false, false); checkStr("f's'", "s", false, true, false, false); }

Target:
public void testStr() throws Exception { checkStr("''", "", false, false, false, false); checkStr("'s'", "s", false, false, false, false); checkStr("r''", "", false, false, false, true); checkStr("r's'", "s", false, false, false, true); checkStr("b''", "", true, false, false, false); checkStr("b's'", "s", true, false, false, false); checkStr("br''", "", true, false, false, true); checkStr("br's'", "s", true, false, false, true); checkStr("rb''", "", true, false, false, true); checkStr("rb's'", "s", true, false, false, true); checkStr("f''", "", false, true, false, false); checkStr("f's'", "s", false, true, false, false); checkStr("fr''", "", false, true, false, true); checkStr("fr's'", "s", false, true, false, true); checkStr("rf''", "", false, true, false, true); checkStr("rf's'", "s", false, true, false, true); }
Source:
private static IRemoteConnection getConnection(Map<?,?> parameters) { Object remoteServicesId = parameters.get(PARAMETER_REMOTE_SERVICES_ID); Object connectionName = parameters.get(PARAMETER_CONNECTION_NAME); if ((remoteServicesId != null) && (connectionName != null)) { return RemoteSystemProxy.getRemoteConnection( NonNullUtils.checkNotNull(remoteServicesId.toString()), NonNullUtils.checkNotNull(connectionName.toString())); } final INewConnectionDialog dialog = TraceControlDialogFactory.getInstance().getNewConnectionDialog(); if (dialog.open() == Window.OK) { return dialog.getConnection(); } return null; }

Target:
private static IRemoteConnection getConnection(Map<?,?> parameters) { Object remoteServicesId = parameters.get(PARAMETER_REMOTE_SERVICES_ID); Object connectionName = parameters.get(PARAMETER_CONNECTION_NAME); if ((remoteServicesId != null) && (connectionName != null)) { return RemoteSystemProxy.getRemoteConnection( checkNotNull(remoteServicesId.toString()), checkNotNull(connectionName.toString())); } final INewConnectionDialog dialog = TraceControlDialogFactory.getInstance().getNewConnectionDialog(); if (dialog.open() == Window.OK) { return dialog.getConnection(); } return null; }
Source:
public String run(@Nonnull EnvVars launchEnv, @Nonnull String image, @CheckForNull String args, @CheckForNull String workdir, @Nonnull Map<String, String> volumes, @Nonnull EnvVars containerEnv, @Nonnull String user, @CheckForNull String... command) throws IOException, InterruptedException { ArgumentListBuilder argb = new ArgumentListBuilder(); argb.add("run", "-t", "-d", "-u", user); argb.addTokenized(args); if (workdir != null) { argb.add("-w", workdir); } for (Map.Entry<String, String> volume : volumes.entrySet()) { argb.add("-v", volume.getKey() + ":" + volume.getValue() + ":rw"); } for (Map.Entry<String, String> variable : containerEnv.entrySet()) { argb.add("-e"); argb.addMasked(variable.getKey()+"="+variable.getValue()); } if (command != null) { argb.add(image).add(command); } LaunchResult result = launch(launchEnv, false, null, argb); if (result.getStatus() == 0) { return result.getOut(); } else { throw new IOException(String.format("Failed to run image '%s'. Error: %s", image, result.getErr())); } }

Target:
public String run(@Nonnull EnvVars launchEnv, @Nonnull String image, @CheckForNull String args, @CheckForNull String workdir, @Nonnull Map<String, String> volumes, @Nonnull EnvVars containerEnv, @Nonnull String user, @CheckForNull String... command) throws IOException, InterruptedException { ArgumentListBuilder argb = new ArgumentListBuilder(); argb.add("run", "-t", "-d", "-u", user); if (args != null) { argb.addTokenized(args); } if (workdir != null) { argb.add("-w", workdir); } for (Map.Entry<String, String> volume : volumes.entrySet()) { argb.add("-v", volume.getKey() + ":" + volume.getValue() + ":rw"); } for (Map.Entry<String, String> variable : containerEnv.entrySet()) { argb.add("-e"); argb.addMasked(variable.getKey()+"="+variable.getValue()); } if (command != null) { argb.add(image).add(command); } LaunchResult result = launch(launchEnv, false, null, argb); if (result.getStatus() == 0) { return result.getOut(); } else { throw new IOException(String.format("Failed to run image '%s'. Error: %s", image, result.getErr())); } }