auphong2707/dl4se-code-review-dataset huggingface dataset:
Source:
private Response getSchema() { ByteArrayOutputStream baos = null; InputStream is = null; byte[] buffer = new byte[4096]; try { baos = new ByteArrayOutputStream(); is = Thread.currentThread().getContextClassLoader().getResourceAsStream(API_SCHEMA); int count; while ((count = is.read(buffer)) != -1) { baos.write(buffer, 0, count); } baos.flush(); return Response.ok(baos.toByteArray(), MediaType.APPLICATION_OCTET_STREAM) .header("content-disposition", "attachment; filename = " + SCHEMA_NAME) .build(); } catch (IOException e) { log.error("Loading api.xsd file failed: {}", e.getMessage()); log.debug("Exception", e); return Response.serverError().build(); } finally { try { if (baos != null) baos.close(); if (is != null) is.close(); } catch (IOException ignored) } }

Target:
private Response getSchema() { ByteArrayOutputStream baos = null; InputStream is = null; byte[] buffer = new byte[4096]; try { baos = new ByteArrayOutputStream(); is = Thread.currentThread().getContextClassLoader().getResourceAsStream(API_SCHEMA); int count; while ((count = is.read(buffer)) != -1) { baos.write(buffer, 0, count); } baos.flush(); return Response.ok(baos.toByteArray(), MediaType.APPLICATION_OCTET_STREAM) .header("content-disposition", "attachment; filename = " + SCHEMA_NAME) .build(); } catch (IOException e) { log.error("Loading api.xsd file failed.", e); return Response.serverError().build(); } finally { try { if (baos != null) baos.close(); if (is != null) is.close(); } catch (IOException ignored) } }
Source:
public void updated(Dictionary<String, ?> config) throws ConfigurationException { if (config != null) { String newPort = (String) config.get("port"); if (StringUtils.isNotBlank(newPort) && !newPort.equals(port)) { String refreshIntervalString = (String) config.get("refresh"); if (StringUtils.isNotBlank(refreshIntervalString)) { refreshInterval = Long.parseLong(refreshIntervalString); } try { openPort(newPort); setProperlyConfigured(true); } catch (InitializationException e) { logger.error(e.getMessage()); setProperlyConfigured(false); } } } }

Target:
public void updated(Dictionary<String, ?> config) throws ConfigurationException { if (config != null) { String refreshIntervalString = (String) config.get("refresh"); if (StringUtils.isNotBlank(refreshIntervalString)) { refreshInterval = Long.parseLong(refreshIntervalString); } String newPort = (String) config.get("port"); if (StringUtils.isNotBlank(newPort) && !newPort.equals(port)) { try { openPort(newPort); setProperlyConfigured(true); } catch (InitializationException e) { logger.error(e.getMessage()); setProperlyConfigured(false); } } } }
Source:
private ExecutorService createExecutor() { int numThreads = Runtime.getRuntime().availableProcessors() + 1; return Executors.newFixedThreadPool(numThreads, new ThreadFactoryBuilder().setNameFormat("SonarJava-parallel-analysis-%d").build()); }

Target:
private ExecutorService createExecutor() { int numThreads = 2; return Executors.newFixedThreadPool(numThreads, new ThreadFactoryBuilder().setNameFormat("SonarJava-parallel-analysis-%d").build()); }
Source:
private ClassLoader getCachedNonBootclasspathSystemLib(String zip, ClassLoader parent, String classLoaderName, List<ClassLoader> sharedLibraries) { if (mSystemLibsPreloadMap == null) { return null; } if (parent != null || classLoaderName != null) { return null; } CachedClassLoader preload = mSystemLibsPreloadMap.get(zip); if (preload == null) { return null; } if (!sharedLibrariesEquals(sharedLibraries, preload.sharedLibraries)) { Log.w(TAG, "Unexpected environment for preloaded library: (" + sharedLibraries + "|" + preload.sharedLibraries + ")"); return null; } Log.d(TAG, "Returning zygote-cached class loader: " + zip); return preload.loader; }

Target:
private ClassLoader getCachedNonBootclasspathSystemLib(String zip, ClassLoader parent, String classLoaderName, List<ClassLoader> sharedLibraries) { if (mSystemLibsCacheMap == null) { return null; } if (parent != null || classLoaderName != null) { return null; } CachedClassLoader cached = mSystemLibsCacheMap.get(zip); if (cached == null) { return null; } if (!sharedLibrariesEquals(sharedLibraries, cached.sharedLibraries)) { Log.w(TAG, "Unexpected environment for cached library: (" + sharedLibraries + "|" + cached.sharedLibraries + ")"); return null; } Log.d(TAG, "Returning zygote-cached class loader: " + zip); return cached.loader; }
Source:
long gtk_configure_event (long widget, long event) { int x = new int [1], y = new int [1]; GTK.gtk_window_get_position (shellHandle, x, y); if (!isVisible ()) { return 0; } if (!moved || oldX != x [0] || oldY != y [0]) { moved = true; oldX = x [0]; oldY = y [0]; sendEvent (SWT.Move); countMove++; if (oldFunction != 0 && ((style & SWT.MAX) != 0) && ((style & SWT.RESIZE) != 0) && countMove == 3) { long window = gtk_widget_get_window (shellHandle); if (((style & SWT.SHELL_TRIM) == SWT.SHELL_TRIM)) { GDK.gdk_window_set_functions(window, GDK.GDK_FUNC_ALL); } else { oldFunction |= GDK.GDK_FUNC_MAXIMIZE; GDK.gdk_window_set_functions(window, oldFunction); } } } return 0; }

Target:
long gtk_configure_event (long widget, long event) { int x = new int [1], y = new int [1]; GTK.gtk_window_get_position (shellHandle, x, y); if (!isVisible ()) { return 0; } if (!moved || oldX != x [0] || oldY != y [0]) { moved = true; oldX = x [0]; oldY = y [0]; sendEvent (SWT.Move); } if (oldFunction != 0 && ((style & SWT.MAX) != 0) && ((style & SWT.RESIZE) != 0) && reenableMax) { long window = gtk_widget_get_window (shellHandle); if (((style & SWT.SHELL_TRIM) == SWT.SHELL_TRIM)) { GDK.gdk_window_set_functions(window, GDK.GDK_FUNC_ALL); } else { oldFunction |= GDK.GDK_FUNC_MAXIMIZE; GDK.gdk_window_set_functions(window, oldFunction); } reenableMax = false; } return 0; }
Source:
protected List<GenericRecord> readOutput(Location location, Schema schema) throws IOException { org.apache.avro.Schema avroSchema = new org.apache.avro.Schema.Parser().parse(schema.toString()); DatumReader<GenericRecord> datumReader = new GenericDatumReader<>(avroSchema); List<GenericRecord> records = Lists.newArrayList(); for (Location file : location.list()) { String locName = file.getName(); if (locName.endsWith(".avro")) { DataFileStream<GenericRecord> fileStream = new DataFileStream<>(file.getInputStream(), datumReader); Iterables.addAll(records, fileStream); fileStream.close(); } if (locName.endsWith(".parquet")) { Path parquetFile = new Path(file.toString()); AvroParquetReader.Builder<GenericRecord> genericRecordBuilder = AvroParquetReader.builder(parquetFile); org.apache.parquet.hadoop.ParquetReader<GenericRecord> reader = genericRecordBuilder.build(); GenericRecord result = reader.read(); while (result != null) { records.add(result); result = reader.read(); } } } return records; }

Target:
protected List<GenericRecord> readOutput(Location location, Schema schema) throws IOException { org.apache.avro.Schema avroSchema = new org.apache.avro.Schema.Parser().parse(schema.toString()); DatumReader<GenericRecord> datumReader = new GenericDatumReader<>(avroSchema); List<GenericRecord> records = Lists.newArrayList(); for (Location file : location.list()) { String locName = file.getName(); if (locName.endsWith(".avro")) { DataFileStream<GenericRecord> fileStream = new DataFileStream<>(file.getInputStream(), datumReader); Iterables.addAll(records, fileStream); fileStream.close(); } if (locName.endsWith(".parquet")) { Path parquetFile = new Path(file.toString()); AvroParquetReader.Builder<GenericRecord> genericRecordBuilder = AvroParquetReader.builder(parquetFile); ParquetReader<GenericRecord> reader = genericRecordBuilder.build(); GenericRecord result = reader.read(); while (result != null) { records.add(result); result = reader.read(); } } } return records; }
Source:
public static void assertValidSubmoduleName(String name) throws SubmoduleValidationException { if (name.contains("/../") || name.contains("\\..\\") || name.startsWith("../") || name.startsWith("..\\") || name.endsWith("/..") || name.endsWith("\\..")) { throw new SubmoduleValidationException(MessageFormat .format(JGitText.get().invalidNameContainsDotDot, name), ObjectChecker.ErrorType.GITMODULES_NAME); } if (name.startsWith("-")) { throw new SubmoduleValidationException( MessageFormat.format( JGitText.get().submoduleNameInvalid, name), ObjectChecker.ErrorType.GITMODULES_NAME); } }

Target:
public static void assertValidSubmoduleName(String name) throws SubmoduleValidationException { if (name.contains("/../") || name.contains("\\..\\") || name.startsWith("../") || name.startsWith("..\\") || name.endsWith("/..") || name.endsWith("\\..")) { throw new SubmoduleValidationException(MessageFormat .format(JGitText.get().invalidNameContainsDotDot, name), GITMODULES_NAME); } if (name.startsWith("-")) { throw new SubmoduleValidationException( MessageFormat.format( JGitText.get().submoduleNameInvalid, name), GITMODULES_NAME); } }
Source:
private void removeTemplateBackup() { AsyncDataProvider.getInstance().getDataCentersByStorageDomain(new AsyncQuery(this, new INewAsyncCallback() { @Override public void onSuccess(Object model, Object returnValue) { TemplateBackupModel templateBackupModel = (TemplateBackupModel) model; ArrayList<StoragePool> pools = (ArrayList<StoragePool>) returnValue; if (pools != null && pools.size() > 0) { StoragePool pool = pools.get(0); ArrayList<VdcActionParametersBase> prms = new ArrayList<VdcActionParametersBase>(); for (Object a : templateBackupModel.getSelectedItems()) { VmTemplate template = (VmTemplate) a; prms.add(new VmTemplateImportExportParameters(template.getId(), getEntity().getId(), pool.getId())); } Frontend.getInstance().runMultipleAction(VdcActionType.RemoveVmTemplateFromImportExport, prms); } } }), getEntity().getId()); setConfirmWindow(null); }

Target:
private void removeTemplateBackup() { AsyncDataProvider.getInstance().getDataCentersByStorageDomain(new AsyncQuery(this, new INewAsyncCallback() { @Override public void onSuccess(Object model, Object returnValue) { TemplateBackupModel templateBackupModel = (TemplateBackupModel) model; ArrayList<StoragePool> pools = (ArrayList<StoragePool>) returnValue; if (pools != null && pools.size() > 0) { StoragePool pool = pools.get(0); ArrayList<VdcActionParametersBase> prms = new ArrayList<VdcActionParametersBase>(); for (Object a : templateBackupModel.getSelectedItems()) { VmTemplate template = (VmTemplate) a; prms.add(new VmTemplateImportExportParameters(template.getId(), getEntity().getId(), pool.getId())); } Frontend.getInstance().runMultipleAction(VdcActionType.RemoveVmTemplateFromImportExport, prms); cancel(); } } }), getEntity().getId()); }
Source:
private List<WebElement> findInnerShadowHosts(final List<WebElement> shadowHosts, final List<String> innerHostSelectors) { List<WebElement> hosts = shadowHosts; List<String> hostSelectors = innerHostSelectors; while (!hostSelectors.isEmpty()) { final List<WebElement> innerHosts = new ArrayList<>(); final String innerHostSelector = innerHostSelectors.get(0); for (final WebElement host : hosts) { innerHosts.addAll(getElementsInsideShadowTree(host, innerHostSelector)); } hosts = innerHosts; hostSelectors = innerHostSelectors.subList(1, innerHostSelectors.size()); } return hosts; }

Target:
private List<WebElement> findInnerShadowHosts(final List<WebElement> shadowHosts, final List<String> innerHostSelectors) { List<WebElement> hosts = shadowHosts; List<String> hostSelectors = innerHostSelectors; while (!hostSelectors.isEmpty()) { final List<WebElement> innerHosts = new ArrayList<>(); final String hostSelector = hostSelectors.get(0); for (final WebElement host : hosts) { innerHosts.addAll(getElementsInsideShadowTree(host, hostSelector)); } hosts = innerHosts; hostSelectors = hostSelectors.subList(1, hostSelectors.size()); } return hosts; }
Source:
protected <U> void update(final T parameterName, final U value) { if (!parameterMap.get(parameterName).getValue().getClass().isInstance(value)) { throw new IllegalArgumentException("Cannot update parameter value with type different from that of current value."); } parameterMap.put(parameterName, new Parameter<>(parameterName, value)); }

Target:
protected <U> void update(final T parameterName, final U value) { Utils.validateArg(parameterMap.get(parameterName).getValue().getClass().isInstance(value), "Cannot update parameter value with type different from that of current value."); parameterMap.put(parameterName, new Parameter<>(parameterName, value)); }
Source:
protected void freeCustomLocks() { if (getCommandStatus() == CommandStatus.ENDED_WITH_FAILURE && !Guid.Empty.equals(getVmId()) && getParameters().isVmLockedOnSelect()) { EngineLock runLock = vmPoolHandler.createLock(getVmId()); lockManager.releaseLock(runLock); log.info("VM lock freed: {}", runLock); getParameters().setVmLockedOnSelect(false); } }

Target:
protected void freeCustomLocks() { if (getCommandStatus() == CommandStatus.ENDED_WITH_FAILURE && !Guid.Empty.equals(getVmId()) && !getParameters().isVmPrestarted()) { EngineLock runLock = vmPoolHandler.createLock(getVmId()); lockManager.releaseLock(runLock); log.info("VM lock freed: {}", runLock); } }
Source:
public void shouldFetch_withAttributeQueryAndMaxPageSize() throws Exception { final StubItem createdItem = dataGenerator.createStubItem(); final String stringProperty = createdItem.getStringProperty(); final StubItem stubItem = new StubItem(); stubItem.setStringProperty(stringProperty); final Query query = new AttributeQuery(STRING_PROPERTY, new Condition(Operators.EQUALS, stringProperty)); final DynamoDbTemplate dynamoDbTemplate = new DynamoDbTemplate(databaseSchemaHolder); dynamoDbTemplate.initialize(amazonDynamoDbClient); final Collection<StubItem> itemResults = dynamoDbTemplate.fetch(query, StubItem.class, 10); assertNotNull(itemResults); assertEquals(1, itemResults.size()); assertEquals(createdItem, itemResults.iterator().next()); }

Target:
public void shouldFetch_withAttributeQueryAndMaxPageSize() throws Exception { final StubItem createdItem = dataGenerator.createStubItem(); final String stringProperty = createdItem.getStringProperty(); final StubItem stubItem = new StubItem(); stubItem.setStringProperty(stringProperty); final Query query = new AttributeQuery(STRING_PROPERTY, new Condition(Operators.EQUALS, stringProperty)); final DynamoDbTemplate dynamoDbTemplate = new DynamoDbTemplate(databaseSchemaHolder); dynamoDbTemplate.initialize(amazonDynamoDbClient); final Collection<StubItem> itemResults = dynamoDbTemplate.fetch(query, StubItem.class, Randoms.randomInt(11)); assertNotNull(itemResults); assertEquals(1, itemResults.size()); assertEquals(createdItem, itemResults.iterator().next()); }
Source:
public static String sanitizeForNextUrl(String url) { if(url == null) return null; return url.replace("&", "${amp}").replace("%2B", "${plus}").replace("%23", "${hash}"); }

Target:
public static String sanitizeForNextUrl(String url) { if (url == null) { return null; } return url.replace("&", "${amp}").replace("%2B", "${plus}").replace("%23", "${hash}"); }
Source:
public void tradePerformed(Order o, double matchPrice) throws StockMarketExpection { double totalPrice = 0; if (containsStock(o.getStockSymbol(), position) != -1){ int i = containsStock(o.getStockSymbol(), position); Order order = position.get(i); int totalStocks = order.getSize(); switch (o.getType()) { case BUY: totalStocks = totalStocks + o.getSize(); totalPrice = matchPrice * o.getSize(); cashInHand = cashInHand - totalPrice; break; case SELL: totalStocks = totalStocks - o.getSize(); totalPrice = matchPrice * o.getSize(); cashInHand = cashInHand + totalPrice; break; } if(totalStocks == 0) { position.remove(i); } else { order.setSize(totalStocks); position.set(i, order); } int location = containsStock(o.getStockSymbol(), ordersPlaced); ordersPlaced.remove(location); } else { position.add(o); int location = containsStock(o.getStockSymbol(), ordersPlaced); ordersPlaced.remove(location); totalPrice = matchPrice * o.getSize(); cashInHand = cashInHand - totalPrice; } }

Target:
public void tradePerformed(Order o, double matchPrice) throws StockMarketExpection { double totalPrice = 0; if (containsStock(o.getStockSymbol(), possession) != -1){ int foundOrder = containsStock(o.getStockSymbol(), possession); Order order = possession.get(foundOrder); int totalStocks = order.getSize(); switch (o.getType()) { case BUY: totalStocks = totalStocks + o.getSize(); totalPrice = matchPrice * o.getSize(); cashInHand = cashInHand - totalPrice; break; case SELL: totalStocks = totalStocks - o.getSize(); totalPrice = matchPrice * o.getSize(); cashInHand = cashInHand + totalPrice; break; } if(totalStocks == 0) { possession.remove(foundOrder); } else { order.setSize(totalStocks); possession.set(foundOrder, order); } int location = containsStock(o.getStockSymbol(), ordersPlaced); ordersPlaced.remove(location); } else { possession.add(o); int location = containsStock(o.getStockSymbol(), ordersPlaced); ordersPlaced.remove(location); totalPrice = matchPrice * o.getSize(); cashInHand = cashInHand - totalPrice; } }
Source:
public void testReplaceFailedAndDiscardState() throws Exception { new Context() {{ runTest( () -> { leaderCallbackGrantLeadership(); final KubernetesStateHandleStore<Long> store = new KubernetesStateHandleStore<>( flinkKubeClient, LEADER_CONFIGMAP_NAME, longStateStorage, filter, LOCK_IDENTITY); final Long newState = 23456L; store.add(key, state); getLeaderCallback().notLeader(); electionEventHandler.waitForRevokeLeader(TIMEOUT); getLeaderConfigMap().getAnnotations().remove(KubernetesLeaderElector.LEADER_ANNOTATION_KEY); final String resourceVersion = store.exists(key); store.replace(key, resourceVersion, newState); assertThat(store.getAll().size(), is(1)); assertThat(store.get(key).retrieveState(), is(state)); assertThat(longStateStorage.getStateHandles().size(), is(2)); assertThat(longStateStorage.getStateHandles().get(0).getNumberOfDiscardCalls(), is(0)); assertThat(longStateStorage.getStateHandles().get(1).getNumberOfDiscardCalls(), is(1)); }); }}; }

Target:
public void testReplaceFailedAndDiscardState() throws Exception { final FlinkRuntimeException updateException = new FlinkRuntimeException("Failed to update"); new Context() {{ runTest( () -> { leaderCallbackGrantLeadership(); final KubernetesStateHandleStore<Long> store = new KubernetesStateHandleStore<>( flinkKubeClient, LEADER_CONFIGMAP_NAME, longStateStorage, filter, LOCK_IDENTITY); store.addAndLock(key, state); final FlinkKubeClient anotherFlinkKubeClient = createFlinkKubeClientBuilder() .setCheckAndUpdateConfigMapFunction((configMapName, function) -> { throw updateException; }).build(); final KubernetesStateHandleStore<Long> anotherStore = new KubernetesStateHandleStore<>( anotherFlinkKubeClient, LEADER_CONFIGMAP_NAME, longStateStorage, filter, LOCK_IDENTITY); final Long newState = 23456L; final StringResourceVersion resourceVersion = anotherStore.exists(key); assertThat(resourceVersion.isExisting(), is(true)); try { anotherStore.replace(key, resourceVersion, newState); fail("We should get an exception when kube client failed to update."); } catch (Exception ex) { assertThat(ex, FlinkMatchers.containsCause(updateException)); } assertThat(anotherStore.getAllAndLock().size(), is(1)); assertThat(anotherStore.getAndLock(key).retrieveState(), is(state)); assertThat(longStateStorage.getStateHandles().size(), is(2)); assertThat(longStateStorage.getStateHandles().get(0).getNumberOfDiscardCalls(), is(0)); assertThat(longStateStorage.getStateHandles().get(1).getNumberOfDiscardCalls(), is(1)); }); }}; }
Source:
private void updateCaret() { if (fSourceViewer == null || fSourceViewer.getTextWidget() == null) return; StyledText styledText= fSourceViewer.getTextWidget(); InsertMode mode= getInsertMode(); styledText.setCaret(null); disposeNonDefaultCaret(); if (getPreferenceStore() == null || !getPreferenceStore().getBoolean(PREFERENCE_USE_CUSTOM_CARETS)) Assert.isTrue(fNonDefaultCaret == null); else if (fIsOverwriting) fNonDefaultCaret= createOverwriteCaret(styledText); else if (SMART_INSERT == mode) fNonDefaultCaret= createInsertCaret(styledText); else if (INSERT == mode) fNonDefaultCaret= createRawInsertModeCaret(styledText); if (fNonDefaultCaret != null) { styledText.setCaret(fNonDefaultCaret); fNonDefaultCaretImage= fNonDefaultCaret.getImage(); } else if (fInitialCaret != styledText.getCaret()) { styledText.setCaret(fInitialCaret); } }

Target:
private void updateCaret() { if (fSourceViewer == null || fSourceViewer.getTextWidget() == null) { return; } StyledText styledText= fSourceViewer.getTextWidget(); InsertMode mode= getInsertMode(); styledText.setCaret(null); disposeNonDefaultCaret(); if (getPreferenceStore() == null || !getPreferenceStore().getBoolean(PREFERENCE_USE_CUSTOM_CARETS)) { Assert.isTrue(fNonDefaultCaret == null); } else if (fIsOverwriting) { fNonDefaultCaret= createOverwriteCaret(styledText); } else if (SMART_INSERT == mode) { fNonDefaultCaret= createInsertCaret(styledText); } else if (INSERT == mode) { fNonDefaultCaret= createRawInsertModeCaret(styledText); } if (fNonDefaultCaret != null) { styledText.setCaret(fNonDefaultCaret); fNonDefaultCaretImage= fNonDefaultCaret.getImage(); } else if (fInitialCaret != styledText.getCaret()) { styledText.setCaret(fInitialCaret); } }
Source:
public void import12BranchHeadTimestampUpdateAfterImporting() { final Branching branches = RepositoryRequests.branching(); final String repositoryId = SnomedDatastoreActivator.REPOSITORY_UUID; final String branchA = "a"; final Branch branchBeforeImport = branches.prepareCreate() .setParent(Branch.MAIN_PATH) .setName(branchA) .build(repositoryId) .execute(getBus()) .getSync(1, TimeUnit.MINUTES); assertEquals("After branch creation timestamps should still be equal", branchBeforeImport.baseTimestamp(), branchBeforeImport.headTimestamp()); importArchive("SnomedCT_Release_INT_20160131_unique_concept.zip", branchBeforeImport.path(), false, Rf2ReleaseType.DELTA.name()); final Branch branchAfterImport = branches.prepareGet(branchBeforeImport.path()) .build(repositoryId) .execute(getBus()) .getSync(1, TimeUnit.MINUTES); IBranchPath path = BranchPathUtils.createPath(branchAfterImport.path()); getComponent(path, SnomedComponentType.CONCEPT, "301795004").statusCode(200); assertThat(branchBeforeImport.baseTimestamp(), not(equalTo(branchAfterImport.headTimestamp()))); }

Target:
public void import12BranchHeadTimestampUpdateAfterImporting() { final Branching branches = RepositoryRequests.branching(); final String repositoryId = SnomedDatastoreActivator.REPOSITORY_UUID; final String branchA = "a"; final Branch branchBeforeImport = branches.prepareCreate() .setParent(Branch.MAIN_PATH) .setName(branchA) .build(repositoryId) .execute(getBus()) .getSync(1, TimeUnit.MINUTES); assertEquals("After branch creation timestamps should still be equal", branchBeforeImport.baseTimestamp(), branchBeforeImport.headTimestamp()); importArchive("SnomedCT_Release_INT_20160131_unique_concept.zip", branchBeforeImport.path(), false, Rf2ReleaseType.DELTA.name()); final Branch branchAfterImport = branches.prepareGet(branchBeforeImport.path()) .build(repositoryId) .execute(getBus()) .getSync(1, TimeUnit.MINUTES); IBranchPath path = BranchPathUtils.createPath(branchAfterImport.path()); getComponent(path, SnomedComponentType.CONCEPT, "301795004").statusCode(200); assertNotEquals(branchBeforeImport.baseTimestamp(), branchAfterImport.headTimestamp()); }
Source:
public void sendMail_template() throws MessagingException { String to = "to@shogun2.de"; String str1 = "The Username"; String str2 = "<LINK_0>"; registrationMailMessageTemplate.setTo(to); registrationMailMessageTemplate.setText( String.format( registrationMailMessageTemplate.getText(), str1, str2 ) ); mailPublisher.sendMail(registrationMailMessageTemplate); assertTrue(greenMail.waitForIncomingEmail(5000, 1)); Message[] messages = greenMail.getReceivedMessages(); assertEquals(1, messages.length); assertEquals(mailPublisher.getDefaultMailSender(), messages[0].getFrom()[0].toString()); assertEquals(to, messages[0].getRecipients( Message.RecipientType.TO)[0].toString()); }

Target:
public void sendMail_template() throws MessagingException { String to = "to@shogun2.de"; String str1 = "The Username"; String str2 = "<LINK_0>"; registrationMailMessageTemplate.setTo(to); registrationMailMessageTemplate.setText( String.format( registrationMailMessageTemplate.getText(), str1, str2 ) ); mailPublisher.sendMail(registrationMailMessageTemplate); assertTrue(greenMail.waitForIncomingEmail(5000, 1)); Message[] messages = greenMail.getReceivedMessages(); assertEquals(1, messages.length); assertEquals(mailPublisher.getDefaultMailSender(), messages[0].getFrom()[0].toString()); assertEquals(to, messages[0].getRecipients( Message.RecipientType.TO)[0].toString()); assertTrue(GreenMailUtil.getBody( messages[0]).contains(str1)); assertTrue(GreenMailUtil.getBody( messages[0]).contains(str2)); }
Source:
public long until(final Temporal endExclusive, final TemporalUnit unit) { InternationalFixedDate end = InternationalFixedDate.from(endExclusive); if (unit instanceof ChronoUnit) { switch ((ChronoUnit) unit) { case DAYS: return daysUntil(end); case WEEKS: return daysUntil(end) / InternationalFixedChronology.DAYS_IN_WEEK; case MONTHS: return monthsUntil(end); case YEARS: return monthsUntil(end) / InternationalFixedChronology.MONTHS_IN_YEAR; case DECADES: return monthsUntil(end) / (InternationalFixedChronology.MONTHS_IN_YEAR * 10); case CENTURIES: return monthsUntil(end) / (InternationalFixedChronology.MONTHS_IN_YEAR * 100); case MILLENNIA: return monthsUntil(end) / (InternationalFixedChronology.MONTHS_IN_YEAR * 1000); case ERAS: return end.getLong(ChronoField.ERA) - getLong(ChronoField.ERA); } throw new UnsupportedTemporalTypeException("Unsupported unit: " + unit); } return unit.between(this, end); }

Target:
public long until(final Temporal endExclusive, final TemporalUnit unit) { return until(InternationalFixedDate.from(endExclusive), unit); }
Source:
public int getInputVersion() { return 1; }

Target:
public int getInputVersion() { return DataVersions.Potion.BROKEN_POTION_ID; }
Source:
public static String simpleDownloadUrlAs(List<String> urls, String user, String password, String saveAs) { if (urls.isEmpty()) throw new IllegalArgumentException("No URLs supplied to download "+saveAs); List<String> commands = new ArrayList<String>(); for (String url : urls) { String command = "curl -f -L "; if (user!=null && password!=null) { command = command + format("-u %s:%s ", user, password); } command = command + format("\"%s\"", url); if (saveAs!=null) { command = command + format(" -o %s", saveAs); } commands.add(command); } return alternatives(commands); }

Target:
public static String simpleDownloadUrlAs(List<String> urls, String user, String password, String saveAs) { if (urls.isEmpty()) throw new IllegalArgumentException("No URLs supplied to download "+saveAs); List<String> commands = new ArrayList<String>(); for (String url : urls) { String command = "curl -f -L -k "; if (user!=null && password!=null) { command = command + format("-u %s:%s ", user, password); } command = command + format("\"%s\"", url); if (saveAs!=null) { command = command + format(" -o %s", saveAs); } commands.add(command); } return alternatives(commands); }
Source:
public void init(IEditorSite site, IEditorInput input) throws PartInitException { super.init(site, input); IEditorInput editorInput = this.getEditorInput(); IFile sessionResourceFile = ((FileEditorInput) editorInput).getFile(); final URI sessionResourceURI = URI.createPlatformResourceURI(sessionResourceFile.getFullPath().toOSString(), true); session = SessionManager.INSTANCE.getSession(sessionResourceURI, new NullProgressMonitor()); if (!session.isOpen()) { session.open(new NullProgressMonitor()); } }

Target:
public void init(IEditorSite site, IEditorInput input) throws PartInitException { super.init(site, input); IEditorInput editorInput = this.getEditorInput(); IFile sessionResourceFile = ((FileEditorInput) editorInput).getFile(); final URI sessionResourceURI = URI.createPlatformResourceURI(sessionResourceFile.getFullPath().toOSString(), true); try { PlatformUI.getWorkbench().getProgressService().busyCursorWhile(new IRunnableWithProgress() { @Override public void run(IProgressMonitor monitor) throws InvocationTargetException, InterruptedException { SubMonitor subMonitor = SubMonitor.convert(monitor, 1); subMonitor.beginTask("Session loading", 1); session = SessionManager.INSTANCE.getSession(sessionResourceURI, subMonitor); if (!session.isOpen()) { session.open(monitor); } subMonitor.worked(1); subMonitor.done(); } }); } catch (InvocationTargetException e) { ErrorDialog.openError(getSite().getShell(), MessageFormat.format(Messages.UI_SessionEditor_session_loading_error_message, new Object[0]), e.getMessage(), Status.CANCEL_STATUS); } catch (InterruptedException e) { ErrorDialog.openError(getSite().getShell(), MessageFormat.format(Messages.UI_SessionEditor_session_loading_error_message, new Object[0]), e.getMessage(), Status.CANCEL_STATUS); } }
Source:
public void canSearchForCodes() throws Exception { final MkGithub github = new MkGithub("jeff"); github.repos().create( Json.createObjectBuilder().add("name", "TestCode").build() ); github.users().self(); MatcherAssert.assertThat( github.search().codes("jeff", "repositories", "desc"), Matchers.not(Matchers.emptyIterable()) ); }

Target:
public void canSearchForCodes() throws Exception { final MkGithub github = new MkGithub("jeff"); github.repos().create( Json.createObjectBuilder().add("name", "TestCode").build() ); MatcherAssert.assertThat( github.search().codes("jeff", "repositories", "desc"), Matchers.not(Matchers.emptyIterable()) ); }
Source:
synchronized boolean sendReport(BluetoothDevice device, int id, byte[] data) { if (DBG) { Log.d(TAG, "sendReport(): device=" + device + " id=" + id + " caller=" + Binder.getCallingUid()); } return checkDevice(device) && checkCallingUid() && mHidDeviceNativeInterface.sendReport(id, data); }

Target:
synchronized boolean sendReport(BluetoothDevice device, int id, byte[] data) { if (DBG) { Log.d(TAG, "sendReport(): device=" + device + " id=" + id); } return checkDevice(device) && checkCallingUid() && mHidDeviceNativeInterface.sendReport(id, data); }
Source:
public InvalidApiKeyException(String apiKey, ErrorCode errorCode) { super(apiKey, errorCode); }

Target:
private InvalidApiKeyException(String apiKey, ErrorCode errorCode) { super(apiKey, errorCode); }
Source:
private void filterNonRequiredNetworks(List<Network> networks, List<Network> selected) { AsyncDataProvider.getInstance().getRequiredNetworksByDataCenterId(new AsyncQuery<>(reqNetworks -> { List<Network> nonRequiredNetworks = networks.stream() .filter(n -> !reqNetworks.contains(n)) .collect(Collectors.toList()); getNetworks().setItems(nonRequiredNetworks); getNetworks().setSelectedItems(selected); }), getStoragePool().getId()); }

Target:
private void filterNonRequiredNetworks(List<Network> networks, List<Network> selected) { AsyncDataProvider.getInstance().getRequiredNetworksByDataCenterId(new AsyncQuery<>(reqNetworks -> { networks.removeAll(reqNetworks); getNetworks().setItems(networks); getNetworks().setSelectedItems(selected); }), getStoragePool().getId()); }
Source:
public void handleClose(final Channel closed, final IOException exception) { if(CLIModelControllerClient.this.state.get() == CLOSED) { return; } if(CLIModelControllerClient.this.state.get() == CONNECTING) { CLIModelControllerClient.this.state.set(LOST_CONNECTION); return; } synchronized(lock) { if (strategy != null) { if(strategy != originalStrategy) { new Exception("Channel close handler " + strategy + " " + originalStrategy).printStackTrace(); } strategy = null; closeHandler.handleClose(); } channelAssociation.handleChannelClosed(closed, exception); lock.notifyAll(); } closed.getConnection().addCloseHandler(new CloseHandler<Connection>(){ @Override public void handleClose(Connection closed, IOException exception) { StreamUtils.safeClose(originalStrategy); }}); }

Target:
public void handleClose(final Channel closed, final IOException exception) { if(CLIModelControllerClient.this.state.get() == CLOSED) { return; } if(CLIModelControllerClient.this.state.compareAndSet(CONNECTING, LOST_CONNECTION)) { return; } synchronized(lock) { if (strategy != null) { if(strategy != originalStrategy) { new Exception("Channel close handler " + strategy + " " + originalStrategy).printStackTrace(); } strategy = null; closeHandler.handleClose(); } channelAssociation.handleChannelClosed(closed, exception); lock.notifyAll(); } closed.getConnection().addCloseHandler(new CloseHandler<Connection>(){ @Override public void handleClose(Connection closed, IOException exception) { StreamUtils.safeClose(originalStrategy); }}); }
Source:
public BlobClientBuilder endpoint(String endpoint) { try { URL url = new URL(endpoint); BlobURLParts parts = URLParser.parse(url); this.endpoint = parts.scheme() + "://" + parts.host(); if (parts.containerName() != null) { this.containerName = parts.containerName(); } if (parts.blobName() != null) { this.blobName = parts.blobName(); } if (parts.snapshot() != null) { this.snapshot = parts.snapshot(); } SASTokenCredential credential = SASTokenCredential.fromQuery(url.getQuery()); if (credential != null) { this.credential(credential); } } catch (MalformedURLException ex) { throw new IllegalArgumentException("The Azure Storage Blob endpoint url is malformed."); } return this; }

Target:
public BlobClientBuilder endpoint(String endpoint) { try { URL url = new URL(endpoint); BlobURLParts parts = URLParser.parse(url); this.endpoint = parts.scheme() + "://" + parts.host(); this.containerName = parts.containerName(); this.blobName = parts.blobName(); this.snapshot = parts.snapshot(); this.sasTokenCredential = SASTokenCredential.fromQueryParameters(parts.sasQueryParameters()); if (this.sasTokenCredential != null) { this.tokenCredential = null; this.sharedKeyCredential = null; } } catch (MalformedURLException ex) { throw new IllegalArgumentException("The Azure Storage Blob endpoint url is malformed."); } return this; }
Source:
protected NetworkClusterDAO getNetworkClusterDAO() { return DbFacade.getInstance().getNetworkClusterDAO(); }

Target:
protected NetworkClusterDAO getNetworkClusterDAO() { return getDbFacade().getNetworkClusterDAO(); }
Source:
public StorageServerNettyFactory(int http2Port, VerifiableProperties verifiableProperties, MetricRegistry metricRegistry, final RestRequestHandler requestHandler, SSLFactory sslFactory, ServerSecurityService serverSecurityService, ServerMetrics serverMetrics) { if (verifiableProperties == null || metricRegistry == null || requestHandler == null || sslFactory == null) { throw new IllegalArgumentException("Null arg(s) received during instantiation of StorageServerNettyFactory"); } nettyConfig = new NettyConfig(verifiableProperties); performanceConfig = new PerformanceConfig(verifiableProperties); nettyMetrics = new NettyMetrics(metricRegistry); Http2ClientConfig http2ClientConfig = new Http2ClientConfig(verifiableProperties); ConnectionStatsHandler connectionStatsHandler = new ConnectionStatsHandler(nettyMetrics); this.serverSecurityChecker = new ServerSecurityChecker(serverSecurityService, serverMetrics); Map<Integer, ChannelInitializer<SocketChannel>> initializers = Collections.singletonMap(http2Port, new StorageServerNettyChannelInitializer(nettyConfig, http2ClientConfig, performanceConfig, nettyMetrics, connectionStatsHandler, requestHandler, sslFactory, metricRegistry, this.serverSecurityChecker)); channelInitializers = Collections.unmodifiableMap(initializers); }

Target:
public StorageServerNettyFactory(int http2Port, VerifiableProperties verifiableProperties, MetricRegistry metricRegistry, final RestRequestHandler requestHandler, SSLFactory sslFactory, ServerSecurityService serverSecurityService, ServerMetrics serverMetrics) { if (verifiableProperties == null || metricRegistry == null || requestHandler == null || sslFactory == null) { throw new IllegalArgumentException("Null arg(s) received during instantiation of StorageServerNettyFactory"); } nettyConfig = new NettyConfig(verifiableProperties); performanceConfig = new PerformanceConfig(verifiableProperties); nettyMetrics = new NettyMetrics(metricRegistry); Http2ClientConfig http2ClientConfig = new Http2ClientConfig(verifiableProperties); ConnectionStatsHandler connectionStatsHandler = new ConnectionStatsHandler(nettyMetrics); this.serverSecurityHandler = new ServerSecurityHandler(serverSecurityService, serverMetrics); Map<Integer, ChannelInitializer<SocketChannel>> initializers = Collections.singletonMap(http2Port, new StorageServerNettyChannelInitializer(nettyConfig, http2ClientConfig, performanceConfig, nettyMetrics, connectionStatsHandler, requestHandler, sslFactory, metricRegistry, serverSecurityHandler)); channelInitializers = Collections.unmodifiableMap(initializers); }
Source:
private DfsBlockCache(final DfsBlockCacheConfig cfg) { tableSize = tableSize(cfg); if (tableSize < 1) throw new IllegalArgumentException(JGitText.get().tSizeMustBeGreaterOrEqual1); table = new AtomicReferenceArray<HashEntry>(tableSize); loadLocks = new Lock[32]; for (int i = 0; i < loadLocks.length; i++) loadLocks[i] = new Lock(); int eb = (int) (tableSize * .1); if (64 < eb) eb = 64; else if (eb < 4) eb = 4; if (tableSize < eb) eb = tableSize; maxBytes = cfg.getBlockLimit(); blockSize = cfg.getBlockSize(); blockSizeShift = Integer.numberOfTrailingZeros(blockSize); clockLock = new ReentrantLock(true ); clockHand = new Ref<Object>(null, -1, 0, null); clockHand.next = clockHand; readAheadLimit = cfg.getReadAheadLimit(); readAheadService = cfg.getReadAheadService(); packCache = new ConcurrentHashMap<DfsPackDescription, DfsPackFile>( 16, 0.75f, 1); packFiles = Collections.unmodifiableCollection(packCache.values()); statHit = new AtomicLong(); statMiss = new AtomicLong(); }

Target:
private DfsBlockCache(final DfsBlockCacheConfig cfg) { tableSize = tableSize(cfg); if (tableSize < 1) throw new IllegalArgumentException(JGitText.get().tSizeMustBeGreaterOrEqual1); table = new AtomicReferenceArray<HashEntry>(tableSize); loadLocks = new ReentrantLock[32]; for (int i = 0; i < loadLocks.length; i++) loadLocks[i] = new ReentrantLock(true ); int eb = (int) (tableSize * .1); if (64 < eb) eb = 64; else if (eb < 4) eb = 4; if (tableSize < eb) eb = tableSize; maxBytes = cfg.getBlockLimit(); blockSize = cfg.getBlockSize(); blockSizeShift = Integer.numberOfTrailingZeros(blockSize); clockLock = new ReentrantLock(true ); clockHand = new Ref<Object>(null, -1, 0, null); clockHand.next = clockHand; readAheadLimit = cfg.getReadAheadLimit(); readAheadService = cfg.getReadAheadService(); packCache = new ConcurrentHashMap<DfsPackDescription, DfsPackFile>( 16, 0.75f, 1); packFiles = Collections.unmodifiableCollection(packCache.values()); statHit = new AtomicLong(); statMiss = new AtomicLong(); }
Source:
public void initialize(URL location, ResourceBundle resources) { xpathExpressionArea.setSyntaxHighlightingEnabled(new XPathSyntaxHighlighter()); initGenerateXPathFromStackTrace(); EventStreams.valuesOf(xpathResultListView.getSelectionModel().selectedItemProperty()) .conditionOn(xpathResultListView.focusedProperty()) .filter(Objects::nonNull) .subscribe(parent::onNodeItemSelected); Platform.runLater(this::bindToParent); xpathExpressionArea.richChanges() .filter(t -> !t.isIdentity()) .successionEnds(XPATH_REFRESH_DELAY) .or(xpathVersionProperty().changes()) .subscribe(tick -> parent.refreshXPathResults()); xpathExpressionArea.richChanges() .subscribe(t -> autoComplete()); }

Target:
public void initialize(URL location, ResourceBundle resources) { xpathExpressionArea.setSyntaxHighlighter(new XPathSyntaxHighlighter()); initGenerateXPathFromStackTrace(); xpathResultListView.setCellFactory(v -> new XpathViolationListCell()); EventStreams.valuesOf(xpathResultListView.getSelectionModel().selectedItemProperty()) .conditionOn(xpathResultListView.focusedProperty()) .filter(Objects::nonNull) .map(TextAwareNodeWrapper::getNode) .subscribe(parent::onNodeItemSelected); Platform.runLater(this::bindToParent); xpathExpressionArea.richChanges() .filter(t -> !t.isIdentity()) .successionEnds(XPATH_REFRESH_DELAY) .or(xpathVersionProperty().changes()) .subscribe(tick -> parent.refreshXPathResults()); EventStream<Integer> changesEventStream = xpathExpressionArea.plainTextChanges() .map(characterChanges -> { if (characterChanges.getRemoved().length() > 0) { return characterChanges.getRemovalEnd() - 1; } return characterChanges.getInsertionEnd(); }); EventStream<Integer> keyCombo = EventStreams.eventsOf(xpathExpressionArea, KeyEvent.KEY_PRESSED) .filter(key -> key.isControlDown() && key.getCode().equals(KeyCode.SPACE)) .map(searchPoint -> xpathExpressionArea.getCaretPosition()); EventStreams.merge(keyCombo, changesEventStream).map(searchPoint -> { int indexOfSlash = xpathExpressionArea.getText().lastIndexOf("/", searchPoint - 1) + 1; String input = xpathExpressionArea.getText(); if (searchPoint > input.length()) { searchPoint = input.length(); } input = input.substring(indexOfSlash, searchPoint); return Tuples.t(indexOfSlash, input); }) .filter(t -> StringUtils.isAlpha(t._2)) .subscribe(s -> autoComplete(s._1, s._2)); xpathExpressionArea.addEventHandler(KeyEvent.KEY_PRESSED, t -> { if (t.getCode() == KeyCode.ESCAPE) { autoCompletePopup.hide(); } }); }
Source:
@Test public void testJoinRowType() { checkResultType( "select * from emp left join dept on emp.deptno = dept.deptno", "RecordType(INTEGER NOT NULL EMPNO," + " VARCHAR(20) NOT NULL ENAME," + " VARCHAR(10) NOT NULL JOB," + " INTEGER MGR," + " TIMESTAMP(0) NOT NULL HIREDATE," + " INTEGER NOT NULL SAL," + " INTEGER NOT NULL COMM," + " INTEGER NOT NULL DEPTNO," + " BOOLEAN NOT NULL SLACKER," + " INTEGER DEPTNO0," + " VARCHAR(10) NAME) NOT NULL"); checkResultType( "select * from emp right join dept on emp.deptno = dept.deptno", "RecordType(INTEGER EMPNO," + " VARCHAR(20) ENAME," + " VARCHAR(10) JOB," + " INTEGER MGR," + " TIMESTAMP(0) HIREDATE," + " INTEGER SAL," + " INTEGER COMM," + " INTEGER DEPTNO," + " BOOLEAN SLACKER," + " INTEGER NOT NULL DEPTNO0," + " VARCHAR(10) NOT NULL NAME) NOT NULL"); checkResultType( "select * from emp full join dept on emp.deptno = dept.deptno", "RecordType(INTEGER EMPNO," + " VARCHAR(20) ENAME," + " VARCHAR(10) JOB," + " INTEGER MGR," + " TIMESTAMP(0) HIREDATE," + " INTEGER SAL," + " INTEGER COMM," + " INTEGER DEPTNO," + " BOOLEAN SLACKER," + " INTEGER DEPTNO0," + " VARCHAR(10) NAME)"); }

Target:
@Test public void testJoinRowType() { checkResultType( "select * from emp left join dept on emp.deptno = dept.deptno", "RecordType(INTEGER NOT NULL EMPNO," + " VARCHAR(20) NOT NULL ENAME," + " VARCHAR(10) NOT NULL JOB," + " INTEGER MGR," + " TIMESTAMP(0) NOT NULL HIREDATE," + " INTEGER NOT NULL SAL," + " INTEGER NOT NULL COMM," + " INTEGER NOT NULL DEPTNO," + " BOOLEAN NOT NULL SLACKER," + " INTEGER DEPTNO0," + " VARCHAR(10) NAME) NOT NULL"); checkResultType( "select * from emp right join dept on emp.deptno = dept.deptno", "RecordType(INTEGER EMPNO," + " VARCHAR(20) ENAME," + " VARCHAR(10) JOB," + " INTEGER MGR," + " TIMESTAMP(0) HIREDATE," + " INTEGER SAL," + " INTEGER COMM," + " INTEGER DEPTNO," + " BOOLEAN SLACKER," + " INTEGER NOT NULL DEPTNO0," + " VARCHAR(10) NOT NULL NAME) NOT NULL"); checkResultType( "select * from emp full join dept on emp.deptno = dept.deptno", "RecordType(INTEGER EMPNO," + " VARCHAR(20) ENAME," + " VARCHAR(10) JOB," + " INTEGER MGR," + " TIMESTAMP(0) HIREDATE," + " INTEGER SAL," + " INTEGER COMM," + " INTEGER DEPTNO," + " BOOLEAN SLACKER," + " INTEGER DEPTNO0," + " VARCHAR(10) NAME) NOT NULL"); }
Source:
public void assignSlots(Topologies topologies, Map<String, Collection<WorkerSlot>> slotsForTopologiesNeedingAssignments) { if (slotsForTopologiesNeedingAssignments.size() == 0) { LOG.debug("assignSlots: no slots passed in, nothing to do"); return; } for (Map.Entry<String, Collection<WorkerSlot>> topologyToSlots : slotsForTopologiesNeedingAssignments.entrySet()) { String topologyId = topologyToSlots.getKey(); for (WorkerSlot slot : topologyToSlots.getValue()) { TopologyDetails details = topologies.getById(topologyId); LOG.debug("assignSlots: topologyId: worker being assigned to slot: with workerCpu: workerMem: {}", topologyId, slot, MesosCommon.topologyWorkerCpu(_conf, details), MesosCommon.topologyWorkerMem(_conf, details)); } } synchronized (_offersLock) { computeLaunchList(topologies, slotsForTopologiesNeedingAssignments); } }

Target:
public void assignSlots(Topologies topologies, Map<String, Collection<WorkerSlot>> slotsForTopologiesNeedingAssignments) { if (slotsForTopologiesNeedingAssignments.isEmpty()) { LOG.debug("assignSlots: no slots passed in, nothing to do"); return; } for (Map.Entry<String, Collection<WorkerSlot>> topologyToSlots : slotsForTopologiesNeedingAssignments.entrySet()) { String topologyId = topologyToSlots.getKey(); for (WorkerSlot slot : topologyToSlots.getValue()) { TopologyDetails details = topologies.getById(topologyId); LOG.debug("assignSlots: topologyId: worker being assigned to slot: with workerCpu: workerMem: {}", topologyId, slot, MesosCommon.topologyWorkerCpu(_conf, details), MesosCommon.topologyWorkerMem(_conf, details)); } } synchronized (_offersLock) { computeLaunchList(topologies, slotsForTopologiesNeedingAssignments); } }
Source:
private ConnectionOptions getConnectionOptions() { if (credentials == null) { throw logger.logExceptionAsError(new IllegalArgumentException("Credentials have not been set. " + "They can be set using: connectionString(String), connectionString(String, String), " + "or credentials(String, String, TokenCredential)" )); } if (proxyOptions != null && proxyOptions.isProxyAddressConfigured() && transport != AmqpTransportType.AMQP_WEB_SOCKETS) { throw logger.logExceptionAsError(new IllegalArgumentException( "Cannot use a proxy when TransportType is not AMQP.")); } if (proxyOptions == null) { proxyOptions = getDefaultProxyConfiguration(configuration); } final CbsAuthorizationType authorizationType = credentials instanceof ServiceBusSharedKeyCredential ? CbsAuthorizationType.SHARED_ACCESS_SIGNATURE : CbsAuthorizationType.JSON_WEB_TOKEN; final ClientOptions options = clientOptions != null ? clientOptions : new ClientOptions(); return new ConnectionOptions(fullyQualifiedNamespace, credentials, authorizationType, transport, retryOptions, proxyOptions, scheduler, options, SslDomain.VerifyMode.VERIFY_PEER_NAME); }

Target:
private ConnectionOptions getConnectionOptions() { configuration = configuration == null ? Configuration.getGlobalConfiguration().clone() : configuration; if (credentials == null) { throw logger.logExceptionAsError(new IllegalArgumentException("Credentials have not been set. " + "They can be set using: connectionString(String), connectionString(String, String), " + "or credentials(String, String, TokenCredential)" )); } if (proxyOptions != null && proxyOptions.isProxyAddressConfigured() && transport != AmqpTransportType.AMQP_WEB_SOCKETS) { throw logger.logExceptionAsError(new IllegalArgumentException( "Cannot use a proxy when TransportType is not AMQP.")); } if (proxyOptions == null) { proxyOptions = getDefaultProxyConfiguration(configuration); } final CbsAuthorizationType authorizationType = credentials instanceof ServiceBusSharedKeyCredential ? CbsAuthorizationType.SHARED_ACCESS_SIGNATURE : CbsAuthorizationType.JSON_WEB_TOKEN; final ClientOptions options = clientOptions != null ? clientOptions : new ClientOptions(); return new ConnectionOptions(fullyQualifiedNamespace, credentials, authorizationType, transport, retryOptions, proxyOptions, scheduler, options, SslDomain.VerifyMode.VERIFY_PEER_NAME); }
Source:
public synchronized DruidNodeDiscovery getForNodeType(String nodeType) { if (stopped) { throw new ISE("Provider has been stopped."); } NodeTypeWatcher nodeTypeWatcher = nodeTypeWatchers.get(nodeType); if (nodeTypeWatcher == null) { log.info("Creating/Starting NodeTypeWatcher for nodeType [%s].", nodeType); nodeTypeWatcher = new NodeTypeWatcher( listenerExecutor, curatorFramework, config.getInternalDiscoveryPath(), jsonMapper, nodeType ); nodeTypeWatcher.start(); nodeTypeWatchers.put(nodeType, nodeTypeWatcher); log.info("Created/Started NodeTypeWatcher for nodeType [%s].", nodeType); } return nodeTypeWatchers.get(nodeType); }

Target:
public DruidNodeDiscovery getForNodeType(String nodeType) { Preconditions.checkState(lifecycleLock.awaitStarted(1, TimeUnit.MILLISECONDS)); return nodeTypeWatchers.compute( nodeType, (k, v) -> { if (v != null) { return v; } log.info("Creating NodeTypeWatcher for nodeType [%s].", nodeType); NodeTypeWatcher nodeTypeWatcher = new NodeTypeWatcher( listenerExecutor, curatorFramework, config.getInternalDiscoveryPath(), jsonMapper, nodeType ); nodeTypeWatcher.start(); log.info("Created NodeTypeWatcher for nodeType [%s].", nodeType); return nodeTypeWatcher; } ); }