auphong2707/dl4se-code-review-dataset huggingface dataset:
Source:
public void testWithAppPolicy() { Reader input = Streams.reader(new ResourceUtils(this).getResourceFromUrl("test-app-with-policy.yaml")); AssemblyTemplate at = platform.pdp().registerDeploymentPlan(input); try { Assembly assembly = at.getInstantiator().newInstance().instantiate(at, platform); log.info("Test - created " + assembly); final Entity app = brooklynMgmt.getEntityManager().getEntity(assembly.getId()); log.info("App - " + app); Assert.assertEquals(app.getDisplayName(), "test-app-with-policy"); Set<Task<?>> tasks = BrooklynTasks.getTasksInEntityContext(brooklynMgmt.getExecutionManager(), app); log.info("Waiting on " + tasks.size() + " task(s)"); for (Task<?> t : tasks) { t.blockUntilEnded(); } log.info("App started:"); Entities.dumpInfo(app); Assert.assertEquals(app.getPolicies().size(), 1); Policy policy = app.getPolicies().iterator().next(); Assert.assertTrue(policy instanceof TestPolicy); Assert.assertEquals(policy.getConfig(TestPolicy.CONF_NAME), "Name from YAML"); Assert.assertEquals(policy.getConfig(TestPolicy.CONF_FROM_FUNCTION), "$brooklyn: is a fun place"); Map<?, ?> leftoverProperties = ((TestPolicy)policy).getLeftoverProperties(); Assert.assertEquals(leftoverProperties.get("policyLiteralValue1"), "Hello"); Assert.assertEquals(leftoverProperties.get("policyLiteralValue2"), "World"); Assert.assertEquals(leftoverProperties.size(), 2); } catch (Exception e) { log.warn("Unable to instantiate " + at + " (rethrowing): " + e); throw Exceptions.propagate(e); } }

Target:
public void testWithAppPolicy() throws Exception { Entity app = createAndStartApplication("test-app-with-policy.yaml"); waitForApplicationTasks(app); Assert.assertEquals(app.getDisplayName(), "test-app-with-policy"); log.info("App started:"); Entities.dumpInfo(app); Assert.assertEquals(app.getPolicies().size(), 1); Policy policy = app.getPolicies().iterator().next(); Assert.assertTrue(policy instanceof TestPolicy); Assert.assertEquals(policy.getConfig(TestPolicy.CONF_NAME), "Name from YAML"); Assert.assertEquals(policy.getConfig(TestPolicy.CONF_FROM_FUNCTION), "$brooklyn: is a fun place"); Map<?, ?> leftoverProperties = ((TestPolicy) policy).getLeftoverProperties(); Assert.assertEquals(leftoverProperties.get("policyLiteralValue1"), "Hello"); Assert.assertEquals(leftoverProperties.get("policyLiteralValue2"), "World"); Assert.assertEquals(leftoverProperties.size(), 2); }
Source:
public boolean acceptsReleases() { return true; }

Target:
public boolean acceptsReleases() { return acceptReleases; }
Source:
private void installAllure() throws MavenReportException{ try { getLog().info(String.format("Allure installation directory %s", getInstallDirectory())); getLog().info(String.format("Try to finding out allure %s", reportVersion != null ? reportVersion : ALLURE_DEFAULT_VERSION)); AllureCommandline commandline = new AllureCommandline(Paths.get(getInstallDirectory()), reportVersion, null); if (commandline.allureNotExists()) { getLog().info("Downloading allure commandline..."); commandline.download(allureDownloadUrl, ProxyUtils.getProxy(session, decrypter)); getLog().info("Downloading allure commandline complete"); } } catch (Exception e) { getLog().error("Can't install allure", e); throw new MavenReportException("Can't install allure", e); } }

Target:
private void installAllure() throws MavenReportException{ try { getLog().info(String.format("Allure installation directory %s", getInstallDirectory())); getLog().info(String.format("Try to finding out allure %s", reportVersion != null ? reportVersion : ALLURE_DEFAULT_VERSION)); AllureCommandline commandline = new AllureCommandline(Paths.get(getInstallDirectory()), reportVersion); if (commandline.allureNotExists()) { getLog().info("Downloading allure commandline..."); commandline.download(allureDownloadUrl, ProxyUtils.getProxy(session, decrypter)); getLog().info("Downloading allure commandline complete"); } } catch (Exception e) { getLog().error("Can't install allure", e); throw new MavenReportException("Can't install allure", e); } }
Source:
public void delete(String key, int version) { try { lock.writeLock().lock(); FeatureFlag f = features.get(key); if (f != null && f.getVersion() < version) { f.setDeleted(); f.setVersion(version); features.put(key, f); } else if (f == null) { f = new FeatureFlagBuilder(key) .deleted(true) .version(version) .build(); features.put(key, f); } } finally { lock.writeLock().unlock(); } }

Target:
public void delete(String key, int version) { try { lock.writeLock().lock(); FeatureFlag f = features.get(key); if (f != null && f.getVersion() < version) { FeatureFlagBuilder newBuilder = new FeatureFlagBuilder(f); newBuilder.on(false); newBuilder.version(version); features.put(key, newBuilder.build()); } else if (f == null) { f = new FeatureFlagBuilder(key) .deleted(true) .version(version) .build(); features.put(key, f); } } finally { lock.writeLock().unlock(); } }
Source:
public Provider createProviderFromUser(User user){ Provider p = new Provider(); if (user == null || user.getPerson() == null){ throw new APIException("User cannot be null"); } else if (Context.getProviderService().getProvidersByPerson(user.getPerson()).isEmpty()){ p.setPerson(user.getPerson()); return Context.getProviderService().saveProvider(p); } else { log.warn("Provider already exists for user"); return Context.getProviderService().getProvidersByPerson(user.getPerson()).iterator().next(); } }

Target:
public Provider createProviderFromUser(User user){ Provider p = new Provider(); if (user == null || user.getPerson() == null){ throw new APIException("User cannot be null"); } else if (Context.getProviderService().getProvidersByPerson(user.getPerson()).isEmpty()){ p.setPerson(user.getPerson()); return Context.getProviderService().saveProvider(p); } log.warn("Provider already exists for user"); return Context.getProviderService().getProvidersByPerson(user.getPerson()).iterator().next(); }
Source:
public Double getMaxRowCount(Aggregate rel, RelMetadataQuery mq) { if (rel.getGroupSet().isEmpty()) { return 1D; } if (rel.getGroupType() == Aggregate.Group.SIMPLE) { boolean isGroupbyKeysConstant = false; final RelOptPredicateList predicateList = mq.getPulledUpPredicates(rel.getInput()); if (predicateList != null) { isGroupbyKeysConstant = true; for (int key:rel.getGroupSet()) { final RexInputRef ref = rel.getCluster().getRexBuilder().makeInputRef(rel.getInput(), key); if (!predicateList.constantMap.containsKey(ref)) { isGroupbyKeysConstant = false; break; } } if (isGroupbyKeysConstant) { return 1D; } } } final Double rowCount = mq.getMaxRowCount(rel.getInput()); if (rowCount == null) { return null; } return rowCount * rel.getGroupSets().size(); }

Target:
public Double getMaxRowCount(Aggregate rel, RelMetadataQuery mq) { if (rel.getGroupSet().isEmpty()) { return 1D; } if (rel.getGroupType() == Aggregate.Group.SIMPLE) { final RelOptPredicateList predicateList = mq.getPulledUpPredicates(rel.getInput()); if (predicateList != null) { boolean isGroupbyKeysConstant = true; for (int key:rel.getGroupSet()) { final RexInputRef ref = rel.getCluster().getRexBuilder().makeInputRef(rel.getInput(), key); if (!predicateList.constantMap.containsKey(ref)) { isGroupbyKeysConstant = false; break; } } if (isGroupbyKeysConstant) { return 1D; } } } final Double rowCount = mq.getMaxRowCount(rel.getInput()); if (rowCount == null) { return null; } return rowCount * rel.getGroupSets().size(); }
Source:
private String authenticate() throws Exception { HttpResponse httpResponse = httpClient.execute(authHost, buildAuthRequest(consumerCredential, authUriRoot)); int statusCode = httpResponse.getStatusLine().getStatusCode(); if (statusCode == 200) { String jsonContent = IOUtils.toString(httpResponse.getEntity().getContent(), DEFAULT_CHARSET); JsonObject jsonObject = jsonParser.parse(jsonContent).getAsJsonObject(); JsonElement accessToken = jsonObject.get("access_token"); if (accessToken == null) { throw new PatentServiceException("access token is missing: " + jsonContent); } else { return accessToken.getAsString(); } } else { String errMessage = "Authentication failed! HTTP status code when accessing endpoint: " + statusCode + ", full status: " + httpResponse.getStatusLine() + ", server response: " + EntityUtils.toString(httpResponse.getEntity()); throw new PatentServiceException(errMessage); } }

Target:
private String authenticate() throws Exception { HttpResponse httpResponse = httpClient.execute(authHost, buildAuthRequest(consumerCredential, authUriRoot)); int statusCode = httpResponse.getStatusLine().getStatusCode(); if (statusCode == 200) { String jsonContent = IOUtils.toString(httpResponse.getEntity().getContent(), DEFAULT_CHARSET); JsonObject jsonObject = jsonParser.parse(jsonContent).getAsJsonObject(); JsonElement accessToken = jsonObject.get("access_token"); if (accessToken == null) { throw new PatentServiceException("access token is missing: " + jsonContent); } else { return accessToken.getAsString(); } } else { throw new PatentServiceException(String.format( "Authentication failed! HTTP status code when accessing endpoint: %d, full status: %s, server response: %s", statusCode, httpResponse.getStatusLine(), EntityUtils.toString(httpResponse.getEntity()))); } }
Source:
public void testAcceptableTokenIsColon() { final NoWhitespaceBeforeCaseDefaultColonCheck check = new NoWhitespaceBeforeCaseDefaultColonCheck(); final int[] acceptableTokens = check.getAcceptableTokens(); assertTrue(acceptableTokens.length == 1 && acceptableTokens[0] == TokenTypes.COLON, "Acceptable token should be colon"); }

Target:
public void testAcceptableTokenIsColon() { final NoWhitespaceBeforeCaseDefaultColonCheck check = new NoWhitespaceBeforeCaseDefaultColonCheck(); assertArrayEquals(new int[] {TokenTypes.COLON}, check.getAcceptableTokens(), "Acceptable token should be colon"); }
Source:
public void addNode(final @Nonnull Node node) throws IOException { Node oldNode = nodes.get(node.getNodeName()); if (node != oldNode) { Queue.withLock(new Runnable() { @Override public void run() { nodes.put(node.getNodeName(), node); jenkins.updateComputerList(); jenkins.trimLabels(); } }); try { persistNode(node); } catch (IOException e) { Queue.withLock(new Runnable() { @Override public void run() { nodes.compute(node.getNodeName(), (ignoredNodeName, ignoredNode) -> oldNode); jenkins.updateComputerList(); jenkins.trimLabels(); } }); throw e; } NodeListener.fireOnCreated(node); } }

Target:
public void addNode(final @Nonnull Node node) throws IOException { Node oldNode = nodes.get(node.getNodeName()); if (node != oldNode) { Queue.withLock(new Runnable() { @Override public void run() { nodes.put(node.getNodeName(), node); jenkins.updateComputerList(); jenkins.trimLabels(); } }); try { persistNode(node); } catch (IOException | RuntimeException e) { Queue.withLock(new Runnable() { @Override public void run() { nodes.compute(node.getNodeName(), (ignoredNodeName, ignoredNode) -> oldNode); jenkins.updateComputerList(); jenkins.trimLabels(); } }); throw e; } NodeListener.fireOnCreated(node); } }
Source:
void initComboBox() { keyListBoxEditor = new ListModelTypeAheadListBoxEditor<>( new ListModelTypeAheadListBoxEditor.NullSafeSuggestBoxRenderer<GlusterVolumeOptionInfo>() { @Override public String getReplacementStringNullSafe(GlusterVolumeOptionInfo option) { return option.getKey(); } @Override public String getDisplayStringNullSafe(GlusterVolumeOptionInfo data) { return templates .typeAheadNameDescription(data == null ? constants.empty() : data.getKey(), constants.empty()) .asString(); } }); }

Target:
void initComboBox() { keyListBoxEditor = new ListModelTypeAheadChangeableListBoxEditor( new ListModelTypeAheadChangeableListBoxEditor.NullSafeSuggestBoxRenderer() { @Override public String getDisplayStringNullSafe(String data) { return typeAheadNameTemplateNullSafe(data); } }); }
Source:
public static JobQueue.Builder buildJobQueue(String jobQueueName, int delayStart, int failureThreshold, int capacity) { return buildJobQueue(jobQueueName, delayStart, failureThreshold, capacity, false); }

Target:
public static JobQueue.Builder buildJobQueue(String jobQueueName, int delayStart, int failureThreshold, int capacity) { return buildJobQueue(jobQueueName, delayStart, failureThreshold, capacity, true); }
Source:
public ServiceBusMessage(byte[] body) { this.binaryData = Objects.requireNonNull(body, "'body' cannot be null."); this.context = Context.NONE; amqpAnnotatedMessage = new AmqpAnnotatedMessage(new AmqpDataBody(Collections.singletonList( new BinaryData(binaryData)))); }

Target:
public ServiceBusMessage(byte[] body) { this.binaryData = Objects.requireNonNull(body, "'body' cannot be null."); this.context = Context.NONE; this.amqpAnnotatedMessage = new AmqpAnnotatedMessage(new AmqpDataBody(Collections.singletonList( new BinaryData(binaryData)))); }
Source:
protected CacheStore createCacheStore() throws Exception { String hostname = System.getProperty("MONGODB_HOSTNAME"); if(hostname == null || "".equals(hostname)){ hostname = "127.0.0.1"; } int port = 27017; String configurationPort = System.getProperty("MONGODB_PORT"); try { if(configurationPort == null || "".equals(configurationPort)){ port = Integer.parseInt(configurationPort); } } catch(NumberFormatException e){ log.mongoPortIllegalValue(configurationPort); } log.runningTest(hostname, port); MongoDBCacheStoreConfig config = new MongoDBCacheStoreConfig(hostname, port, 2000, "", "", "infinispan_test_database", "infinispan_indexes", -1); config.setPurgeSynchronously(true); cacheStore = new MongoDBCacheStore(); cacheStore.init(config, getCache(), getMarshaller()); cacheStore.start(); return cacheStore; }

Target:
protected CacheStore createCacheStore() throws Exception { String hostname = System.getProperty("MONGODB_HOSTNAME"); if (hostname == null || "".equals(hostname)) { hostname = "127.0.0.1"; } int port = 27017; String configurationPort = System.getProperty("MONGODB_PORT"); try { if (configurationPort != null && !"".equals(configurationPort)) { port = Integer.parseInt(configurationPort); } } catch (NumberFormatException e) { throw log.mongoPortIllegalValue(configurationPort); } log.runningTest(hostname, port); MongoDBCacheStoreConfig config = new MongoDBCacheStoreConfig(hostname, port, 2000, "", "", "infinispan_test_database", "infinispan_indexes", -1); config.setPurgeSynchronously(true); cacheStore = new MongoDBCacheStore(); cacheStore.init(config, getCache(), getMarshaller()); cacheStore.start(); return cacheStore; }
Source:
public void testCreateSSLContext_invalidCustomSSLContextClass() { ZKConfig zkConfig = new ZKConfig(); ClientX509Util clientX509Util = new ClientX509Util(); zkConfig.setProperty(clientX509Util.getSslClientContextProperty(), String.class.getCanonicalName()); try { clientX509Util.createSSLContext(zkConfig); fail("SSLContextException expected."); } catch (X509Exception.SSLContextException e) { assertTrue(e.getMessage().contains(clientX509Util.getSslClientContextProperty())); } }

Target:
public void testCreateSSLContext_invalidCustomSSLContextClass() throws Exception { ZKConfig zkConfig = new ZKConfig(); ClientX509Util clientX509Util = new ClientX509Util(); zkConfig.setProperty(clientX509Util.getSslContextSupplierClassProperty(), String.class.getCanonicalName()); clientX509Util.createSSLContext(zkConfig); }
Source:
public EntityMap<FeedScopedId, Stop> getStops() { return stopsById; }

Target:
public EntityById<FeedScopedId, Stop> getStops() { return stopsById; }
Source:
public void cleanUpSucceeds() throws Exception { final String credentialsId = "zipfile"; File jar = new File(FileItem.class.getProtectionDomain().getCodeSource().getLocation().toURI()); FileItem fi = new FileItemImpl(jar); FileCredentialsImpl fc = new FileCredentialsImpl(CredentialsScope.GLOBAL, credentialsId, "Just a zip file", fi, fi.getName(), null); CredentialsProvider.lookupStores(j.jenkins).iterator().next().addCredentials(Domain.global(), fc); WorkflowJob p = j.jenkins.createProject(WorkflowJob.class, "p"); p.setDefinition(new CpsFlowDefinition("" + "node {\n" + " withCredentials([[$class: 'ZipFileBinding', credentialsId: 'zipfile', variable: 'ziploc']]) {\n" + (Functions.isWindows() ? " bat 'type %ziploc%\\\\META-INF\\\\MANIFEST.MF'\n" : " sh 'cat ${ziploc}/META-INF/MANIFEST.MF'\n" ) + " def manifest = readFile encoding: 'UTF-8', file: \"${env.ziploc}/META-INF/MANIFEST.MF\"\n" + " echo \"manifest contents....\\n${manifest}\"\n" + " if (!manifest.contains('Specification-Title: Apache Commons FileUpload')) {\n" + " error ('incorrect details from zip file')\n" + " }\n" + " }\n" + "}\n" , false )); j.assertBuildStatusSuccess(p.scheduleBuild2(0)); }

Target:
public void cleanUpSucceeds() throws Exception { final String credentialsId = "zipfile"; InputStream zipStream = this.getClass().getResourceAsStream("a.zip"); try { assertThat(zipStream, is(not(nullValue()))); File zip = tmp.newFile("a.zip"); FileUtils.copyInputStreamToFile(zipStream, zip); FileItem fi = new FileItemImpl(zip); FileCredentialsImpl fc = new FileCredentialsImpl(CredentialsScope.GLOBAL, credentialsId, "Just a zip file", fi, fi.getName(), null); CredentialsProvider.lookupStores(j.jenkins).iterator().next().addCredentials(Domain.global(), fc); } finally { IOUtils.closeQuietly(zipStream); zipStream = null; } final String unixFile = "/dir/testfile.txt"; final String winFile = unixFile.replace("/", "\\\\"); final String contents = "Test of ZipFileBinding\n"; WorkflowJob p = j.jenkins.createProject(WorkflowJob.class, "p"); p.setDefinition(new CpsFlowDefinition("" + "node {\n" + " withCredentials([[$class: 'ZipFileBinding', credentialsId: '"+ credentialsId +"', variable: 'ziploc']]) {\n" + (Functions.isWindows() ? " bat 'type %ziploc%"+ winFile + "'\n" : " sh 'cat ${ziploc}" + unixFile + "'\n" ) + " def text = readFile encoding: 'UTF-8', file: \"${env.ziploc}" + unixFile + "\"\n" + " if (!text.equals('''" + contents + "''')) {\n" + " error ('incorrect details from zip file')\n" + " }\n" + " }\n" + "}\n" , true)); WorkflowRun run = p.scheduleBuild2(0).get(); j.assertBuildStatusSuccess(run); j.assertLogContains(contents, run); }
Source:
public void setItemSelected(int position) { if (!mItemsSelected.get(position)) { mItemsSelected.put(position, true); } notifyDataSetChanged(); }

Target:
public void setItemSelected(int position) { if (!mItemsSelected.get(position)) { mItemsSelected.put(position, true); } notifyItemChanged(position); }
Source:
public ValidateScheduler(DiagramEditPart diagramEditPart, long delay) { this.diagramEditPart = diagramEditPart; this.scheduledJobs = new ArrayDeque<ValidateJob>(); }

Target:
public ValidateScheduler(DiagramEditPart diagramEditPart, long delay) { this.diagramEditPart = diagramEditPart; this.scheduledJobs = new ArrayDeque<ValidateJob>(); this.delay = delay; }
Source:
public void addListener(IReporter listener) { if (!m_reporters.values().contains(listener)) { addListener((ITestNGListener) listener); } }

Target:
public void addListener(IReporter listener) { if (!m_reporters.containsValue(listener)) { addListener((ITestNGListener) listener); } }
Source:
public void performFiltering() { CallFilter dummyStart = new CallFilter(); CallFilter dummyComplete = new CallFilter(); for (CallFilter filter : filtersList) { addEdge(dummyStart, filter); } for (CallFilter filter : filtersList) { addEdge(filter, dummyComplete); } addEdge(dummyStart, dummyComplete); filtersQueue.offer(dummyStart); try { while (true) { CallFilter filter = filtersQueue.take(); CompletableFuture<CallFilteringResult> filterFuture = scheduleFilter(filter, filtersQueue); mFutures.put(filter, filterFuture); filterScheduled++; if (filterScheduled == (filtersList.size() + 2 )) { break; } } mResult = mFutures.get(dummyComplete).get(); } catch (InterruptedException | ExecutionException e) { Log.w(this, "Call filters failed due to: " + e.toString()); } mListener.onCallFilteringComplete(mCall, mResult); }

Target:
public void performFiltering() { CallFilteringResult result = new CallFilteringResult.Builder() .setShouldAllowCall(true) .setShouldReject(false) .setShouldSilence(false) .setShouldAddToCallLog(true) .setShouldShowNotification(true) .setCall(mCall) .build(); CallFilter dummyStart = new CallFilter(); CallFilter dummyComplete = new CallFilter(); for (CallFilter filter : mFiltersList) { addEdge(dummyStart, filter); } for (CallFilter filter : mFiltersList) { addEdge(filter, dummyComplete); } addEdge(dummyStart, dummyComplete); mFiltersQueue.offer(dummyStart); try { while (mFilterScheduled < (mFiltersList.size() + 2)) { CallFilter filter = mFiltersQueue .poll(INCOMING_CALL_FILTERS_TIMEOUT, TimeUnit.MILLISECONDS); CompletableFuture<CallFilteringResult> filterFuture = scheduleFilter(filter, mFiltersQueue); mFutures.put(filter, filterFuture); mFilterScheduled++; } result = mFutures.get(dummyComplete) .get(INCOMING_CALL_FILTERS_TIMEOUT, TimeUnit.MILLISECONDS); } catch (InterruptedException | ExecutionException | TimeoutException e) { Log.w(this, "Call filters failed due to: " + e.toString()); } mListener.onCallFilteringComplete(mCall, result); }
Source:
private void start(PhoneNumber number) { if (PhoneNumber.isValid(number)) { mPhoneEditText.setText(number.getPhoneNumber()); mPhoneEditText.setSelection(number.getPhoneNumber().length()); } else { mPhoneInputLayout.setError(getString(R.string.fui_invalid_phone_number)); return; } if (PhoneNumber.isCountryValid(number)) { setCountryCode(number); } onNext(); }

Target:
private void start(PhoneNumber number) { if (!PhoneNumber.isValid(number)) { mPhoneInputLayout.setError(getString(R.string.fui_invalid_phone_number)); return; } mPhoneEditText.setText(number.getPhoneNumber()); mPhoneEditText.setSelection(number.getPhoneNumber().length()); if (PhoneNumber.isCountryValid(number)) { setCountryCode(number); } onNext(); }
Source:
public void edit(StorageModel object) { driver.edit(object); final StorageModel storageModel = object; storageModel.getAvailableStorageDomainTypeItems().getSelectedItemChangedEvent().addListener((ev, sender, args) -> { updateStorageTypesByDomainType(storageModel); }); storageModel.getAvailableStorageTypeItems().getSelectedItemChangedEvent().addListener((ev, sender, args) -> { revealStorageView(storageModel); }); storageModel.getDataCenterAlert().getEntityChangedEvent().addListener((ev, sender, args) -> { datacenterAlertIcon.setVisible(storageModel.getDataCenterAlert().getIsAvailable()); datacenterAlertIcon.setTitle(storageModel.getDataCenterAlert().getEntity()); }); warningLowSpaceIndicatorEditor.addKeyUpHandler(event -> { if (!storageModel.isNewStorage()) { storageModel.getWarningLowSpaceSize().setEntity( ConstantsManager.getInstance().getMessages().bracketsWithGB(getWarningLowSpaceSize(storageModel))); } }); criticalSpaceActionBlockerEditor.addKeyUpHandler(event -> { int storageDomainTotalSize = getStorageDomainTotalSize(storageModel); String validationToolTipText = ConstantsManager .getInstance() .getMessages() .criticalSpaceActionBlockerBiggerThanStorageDomain(storageDomainTotalSize); Integer criticalActionBlockerSpace = criticalSpaceActionBlockerEditor.asValueBox().getValue(); if (criticalActionBlockerSpace == null || criticalActionBlockerSpace > storageDomainTotalSize) { criticalSpaceActionBlockerEditor.markAsInvalid(Arrays.asList(validationToolTipText)); } else { criticalSpaceActionBlockerEditor.markAsValid(); } }); }

Target:
public void edit(StorageModel object) { driver.edit(object); final StorageModel storageModel = object; storageModel.getAvailableStorageDomainTypeItems().getSelectedItemChangedEvent().addListener((ev, sender, args) -> { updateStorageTypesByDomainType(storageModel); }); storageModel.getAvailableStorageTypeItems().getSelectedItemChangedEvent().addListener((ev, sender, args) -> { revealStorageView(storageModel); }); storageModel.getDataCenterAlert().getEntityChangedEvent().addListener((ev, sender, args) -> { datacenterAlertIcon.setVisible(storageModel.getDataCenterAlert().getIsAvailable()); datacenterAlertIcon.setTitle(storageModel.getDataCenterAlert().getEntity()); }); warningLowSpaceIndicatorEditor.addKeyUpHandler(event -> { if (!storageModel.isNewStorage()) { storageModel.getWarningLowSpaceSize().setEntity( ConstantsManager.getInstance().getMessages().bracketsWithGB(getWarningLowSpaceSize(storageModel))); } }); criticalSpaceActionBlockerEditor.addKeyUpHandler(event -> { int storageDomainTotalSize = getStorageDomainTotalSize(storageModel); Integer criticalActionBlockerSpace = criticalSpaceActionBlockerEditor.asValueBox().getValue(); String validationToolTipText = ConstantsManager .getInstance() .getMessages() .criticalSpaceActionBlockerBiggerThanStorageDomain(storageDomainTotalSize); if (criticalActionBlockerSpace == null || criticalActionBlockerSpace > storageDomainTotalSize) { criticalSpaceActionBlockerEditor.markAsInvalid(Arrays.asList(validationToolTipText)); } else { criticalSpaceActionBlockerEditor.markAsValid(); } }); }
Source:
public void testDestroy() { final UberfireDock uberfireDock = mock(UberfireDock.class); dock.setOpened(false); doReturn(uberfireDock).when(dock).getUberfireDock(); dock.destroy(); verify(uberfireDocks).remove(uberfireDock); }

Target:
public void testDestroy() { final UberfireDock uberfireDock = mock(UberfireDock.class); doReturn(uberfireDock).when(dock).getUberfireDock(); dock.destroy(); verify(uberfireDocks).remove(uberfireDock); }
Source:
private static Iterable<ImmutableBitmap> getBitmapIterator( final BitmapIndex bitmapIndex, final LikeDimFilter.LikeMatcher likeMatcher, final Indexed<String> dimValues ) { final String lower = Strings.nullToEmpty(likeMatcher.getPrefix()); final String upper = Strings.nullToEmpty(likeMatcher.getPrefix()) + Character.MAX_VALUE; final int startIndex; final int endIndex; final int lowerFound = bitmapIndex.getIndex(lower); startIndex = lowerFound >= 0 ? lowerFound : -(lowerFound + 1); final int upperFound = bitmapIndex.getIndex(upper); endIndex = upperFound >= 0 ? upperFound + 1 : -(upperFound + 1); return new Iterable<ImmutableBitmap>() { @Override public Iterator<ImmutableBitmap> iterator() { return new Iterator<ImmutableBitmap>() { int currIndex = startIndex; @Override public boolean hasNext() { return currIndex < endIndex; } @Override public ImmutableBitmap next() { while (currIndex < endIndex && !likeMatcher.matchesSuffixOnly(dimValues.get(currIndex))) { currIndex++; } if (currIndex == endIndex) { return bitmapIndex.getBitmapFactory().makeEmptyImmutableBitmap(); } return bitmapIndex.getBitmap(currIndex++); } @Override public void remove() { throw new UnsupportedOperationException(); } }; } }; }

Target:
private static Iterable<ImmutableBitmap> getBitmapIterator( final BitmapIndex bitmapIndex, final LikeDimFilter.LikeMatcher likeMatcher, final Indexed<String> dimValues ) { return Filters.bitmapsFromIndexes(getBitmapIndexIterator(bitmapIndex, likeMatcher, dimValues), bitmapIndex); }
Source:
public Saga to(final Map<String, Object> props) { final Map<String, Object> properties = Maps.newHashMap(props); final Class sagaClass = (Class) properties.remove(X_KASPER_SAGA_CLASS); final Object identifier = properties.remove(X_KASPER_SAGA_IDENTIFIER); final Saga saga = sagaFactory.create(identifier, sagaClass); for (final Entry<String, Object> entry : properties.entrySet()) { try { final Field field = sagaClass.getDeclaredField(entry.getKey()); field.setAccessible(Boolean.TRUE); field.set(saga, entry.getValue()); } catch (final IllegalAccessException | NoSuchFieldException e) { e.printStackTrace(); } } return saga; }

Target:
public Saga to(final Map<String, Object> props) { final Map<String, Object> properties = Maps.newHashMap(props); final Class sagaClass = (Class) properties.remove(X_KASPER_SAGA_CLASS); final Object identifier = properties.remove(X_KASPER_SAGA_IDENTIFIER); final Saga saga = sagaFactory.create(identifier, sagaClass); for (final Entry<String, Object> entry : properties.entrySet()) { try { final Field field = sagaClass.getDeclaredField(entry.getKey()); field.setAccessible(Boolean.TRUE); field.set(saga, entry.getValue()); } catch (final IllegalAccessException | NoSuchFieldException e) { LOGGER.error("Failed to restore property '{}' to a saga instance, <saga={}> <identifier={}> <propertyValue={}>", entry.getKey(), saga.getClass(), identifier, entry.getValue(), e); } } return saga; }
Source:
private MacroManager getMacroManager() { return MacroManager.getDefaultInstance(); }

Target:
public MacroManager getMacroManager() { if (fMacroManager == null) { Activator plugin = Activator.getDefault(); IPath stateLocation = plugin.getStateLocation(); stateLocation.append("macros"); File userHome = new File(System.getProperty("user.home")); File eclipseUserHome = new File(userHome, ".eclipse"); File eclipseUserHomeMacros = new File(eclipseUserHome, "org.eclipse.e4.core.macros"); File eclipseUserHomeMacrosLoadDir = new File(eclipseUserHomeMacros, "macros"); if (!eclipseUserHomeMacrosLoadDir.exists()) { eclipseUserHomeMacrosLoadDir.mkdirs(); } File[] macrosDirectory = { stateLocation.toFile(), eclipseUserHomeMacrosLoadDir }; fMacroManager = new MacroManager(macrosDirectory); } return fMacroManager; }
Source:
public void checkAttributeValue(PerunSessionImpl perunSession, String key, Attribute attribute) throws InternalErrorException, WrongAttributeValueException, WrongReferenceAttributeValueException, WrongAttributeAssignmentException { if(attribute.getValue() == null) return; LinkedHashMap<String, String> map = (LinkedHashMap<String, String>) attribute.getValue(); if(map.isEmpty()) return; if(!KEY.equals(key)) { throw new WrongAttributeValueException(attribute, key, "entityless key for this attribute must be " + KEY); } Set<String> mapKeys = map.keySet(); for(String mapKey : mapKeys) { if(mapKey == null) throw new WrongAttributeValueException(attribute, key, "Key in dnsStateMapping map can not be null."); if(!mapKey.startsWith(".")) throw new WrongAttributeValueException(attribute, key, "Key in dnsStateMapping map must start with dot symbol ('.')."); String value = map.get(mapKey); if(value == null) throw new WrongAttributeValueException(attribute, key, "Value in dnsStateMapping map can not be null."); } }

Target:
public void checkAttributeValue(PerunSessionImpl perunSession, String key, Attribute attribute) throws InternalErrorException, WrongAttributeValueException, WrongReferenceAttributeValueException, WrongAttributeAssignmentException { if(!KEY.equals(key)) { throw new WrongAttributeValueException(attribute, key, "entityless key for this attribute must be " + KEY); } if(attribute.getValue() == null) return; LinkedHashMap<String, String> map = (LinkedHashMap<String, String>) attribute.getValue(); if(map.isEmpty()) return; Set<String> mapKeys = map.keySet(); for(String mapKey : mapKeys) { if(mapKey == null) throw new WrongAttributeValueException(attribute, key, "Key in dnsStateMapping map can not be null."); String value = map.get(mapKey); if(value == null) throw new WrongAttributeValueException(attribute, key, "Value in dnsStateMapping map can not be null."); } }
Source:
protected void followTransitionByOption(CoreSession session, Document doc, Map<String, Serializable> options) { String lifecycleState = doc.getLifeCycleState(); if (APPROVED_STATE.equals(lifecycleState) || OBSOLETE_STATE.equals(lifecycleState)) { doc.followTransition(BACK_TO_PROJECT_TRANSITION); if (session != null) { String sid = session.getSessionId(); DocumentModel docModel = DocumentModelFactory.createDocumentModel(doc, sid, null); DocumentEventContext ctx = new DocumentEventContext(session, session.getPrincipal(), docModel); ctx.setProperty(TRANSTION_EVENT_OPTION_FROM, lifecycleState); ctx.setProperty(TRANSTION_EVENT_OPTION_TO, doc.getLifeCycleState()); ctx.setProperty(TRANSTION_EVENT_OPTION_TRANSITION, BACK_TO_PROJECT_TRANSITION); ctx.setProperty(REPOSITORY_NAME, session.getRepositoryName()); ctx.setProperty(SESSION_ID, sid); ctx.setProperty(DOC_LIFE_CYCLE, BACK_TO_PROJECT_TRANSITION); ctx.setProperty(CATEGORY, DocumentEventCategories.EVENT_LIFE_CYCLE_CATEGORY); ctx.setProperty(COMMENT, options.get(COMMENT)); Framework.getService(EventService.class).fireEvent(ctx.newEvent(TRANSITION_EVENT)); } } }

Target:
protected void followTransitionByOption(CoreSession session, Document doc, Map<String, Serializable> options) { String lifecycleState = doc.getLifeCycleState(); if (APPROVED_STATE.equals(lifecycleState) || OBSOLETE_STATE.equals(lifecycleState)) { doc.followTransition(BACK_TO_PROJECT_TRANSITION); if (session != null) { sendEvent(session, doc, lifecycleState, options); } } }
Source:
private void verifyLifecycleEvent(final Message<?> msg, final LifecycleState lifecycleState) { assertNotNull(msg); assertNotNull(msg.getPayload()); assertTrue(msg.getPayload() instanceof LifecycleEvent); assertEquals(((LifecycleEvent) msg.getPayload()).getState(), lifecycleState); }

Target:
private void verifyLifecycleEvent(final Message<?> msg, final LifecycleState lifecycleState) { assertNotNull(msg); assertNotNull(msg.getPayload()); assertTrue(msg.getPayload() instanceof LifecycleEvent); assertEquals(lifecycleState, ((LifecycleEvent) msg.getPayload()).getState()); }
Source:
protected RequestBuilder applyAuth(RequestBuilder request) throws NexmoClientException { AuthMethod authMethod = getAuthMethod(getAcceptableAuthMethods()); if (isUseBasicAuth()) { return authMethod.applyAsBasicAuth(request); } return authMethod.apply(request); }

Target:
protected RequestBuilder applyAuth(RequestBuilder request) throws NexmoClientException { return getAuthMethod(getAcceptableAuthMethods()).apply(request); }
Source:
public Mono<Void> globalSetupAsync() { return super.globalSetupAsync() .doOnTerminate(() -> { try { cloudFile.upload(TestDataCreationHelper.createRandomInputStream(options.getSize()), options.getSize()); } catch (URISyntaxException | StorageException | IOException e) { throw new RuntimeException(e); } }).then(); }

Target:
public Mono<Void> globalSetupAsync() { return super.globalSetupAsync() .then(Mono.fromCallable(() -> { try { cloudFile.upload(TestDataCreationHelper.createRandomInputStream(options.getSize()), options.getSize()); return 1; } catch (URISyntaxException | StorageException | IOException e) { throw new RuntimeException(e); } })).then(); }
Source:
public void haveTwoFileFiltersIsIncorrect() throws Exception { final Environment env = new Environment.Mock() .withFile( "target/classes/Remote.class", new BytecodeMocker() .withSource("class Remote implements java.rmi.Remote { }") .mock() ) .withDefaultClasspath() .withExcludes( "findbugs-filter", "file.xml,file2.xml" ); new FindBugsValidator().validate(env); }

Target:
public void haveTwoFileFiltersIsIncorrect() throws Exception { final Environment env = new Environment.Mock() .withFile( FindBugsValidatorTest.REMOTE_FILE, new BytecodeMocker() .withSource(FindBugsValidatorTest.REMOTE_SOURCE) .mock() ) .withDefaultClasspath() .withExcludes( FindBugsValidator.EXCLUDE_FILTER, "file.xml,file2.xml" ); new FindBugsValidator().validate(env); }
Source:
private void downloadPlanFeatures() { WordPress.getRestClientUtilsV1_2().get("plans/features/", WordPress.getRestLocaleParams(), null, new RestRequest.Listener() { @Override public void onResponse(JSONObject response) { if (response != null) { AppLog.d(AppLog.T.PLANS, response.toString()); AppPrefs.setGlobalPlansFeatures(response.toString()); downloadAvailablePlansForSite(); } else { AppLog.w(AppLog.T.PLANS, "Unexpected empty response from server when downloading Features"); notifyFailure(); } } }, new RestRequest.ErrorListener() { @Override public void onErrorResponse(VolleyError volleyError) { AppLog.e(AppLog.T.PLANS, "Error Loading Plans/Features", volleyError); notifyFailure(); } }); }

Target:
private void downloadPlanFeatures() { WordPress.getRestClientUtilsV1_2().get("plans/features/", WordPress.getRestLocaleParams(), null, new RestRequest.Listener() { @Override public void onResponse(JSONObject response) { if (response != null) { AppLog.d(AppLog.T.PLANS, response.toString()); AppPrefs.setGlobalPlansFeatures(response.toString()); requestCompleted(); } else { AppLog.w(AppLog.T.PLANS, "Unexpected empty response from server when downloading Features"); requestFailed(); } } }, new RestRequest.ErrorListener() { @Override public void onErrorResponse(VolleyError volleyError) { AppLog.e(AppLog.T.PLANS, "Error Loading Plans/Features", volleyError); requestFailed(); } }); }
Source:
public void fileChosen(String path, Result result) { if (path == null) { controller.getPreferences().putString( Preferences.FILE_CHOOSER_LAST_FOLDER, fileChooser.getSelectedFile().path()); } else { controller.getPreferences().putString( Preferences.FILE_CHOOSER_LAST_FOLDER, path); } if (fileChooserListener != null) { fileChooserListener.fileChosen(path, null); } fileChooser.remove(); }

Target:
public void fileChosen(String path, Result result) { if (path == null) { controller.getPreferences().putString( Preferences.FILE_CHOOSER_LAST_FOLDER, fileChooser.getSelectedFile().path()); } else { controller.getPreferences().putString( Preferences.FILE_CHOOSER_LAST_FOLDER, path); } if (fileChooserListener != null) { fileChooserListener.fileChosen(path, Result.SUCCESS); } fileChooser.remove(); }
Source:
public void mappingFunctionReturnsIterableOfEntriesForEachInputEntry() throws Exception { Store<K, V> kvStore = factory.newStore(factory.newConfiguration(factory.getKeyType(), factory.getValueType(), null, null, null, Expirations.noExpiration())); Set<K> inputKeys = new HashSet<K>(); int nbElements = 10; for (long i = 0; i < nbElements; i++) { K k = factory.createKey(i); V v = factory.createValue(i); inputKeys.add(k); kvStore.put(k, v); } try { kvStore.bulkComputeIfAbsent(inputKeys, new Function<Iterable<? extends K>, Iterable<? extends Map.Entry<? extends K, ? extends V>>>() { @Override public Iterable<? extends Map.Entry<? extends K, ? extends V>> apply(Iterable<? extends K> entries) { assertThat(entries.iterator().hasNext(), is(false)); return new HashMap<K, V>().entrySet(); } } ); } catch (CacheAccessException e) { System.err.println("Warning, an exception is thrown due to the SPI test"); e.printStackTrace(); } }

Target:
public void mappingFunctionReturnsIterableOfEntriesForEachInputEntry() throws Exception { Store<K, V> kvStore = factory.newStore(factory.newConfiguration(factory.getKeyType(), factory.getValueType(), null, null, null)); Set<K> inputKeys = new HashSet<K>(); int nbElements = 10; for (long i = 0; i < nbElements; i++) { K k = factory.createKey(i); V v = factory.createValue(i); inputKeys.add(k); kvStore.put(k, v); } try { kvStore.bulkComputeIfAbsent(inputKeys, new Function<Iterable<? extends K>, Iterable<? extends Map.Entry<? extends K, ? extends V>>>() { @Override public Iterable<? extends Map.Entry<? extends K, ? extends V>> apply(Iterable<? extends K> entries) { assertThat(entries.iterator().hasNext(), is(false)); return new HashMap<K, V>().entrySet(); } } ); } catch (CacheAccessException e) { System.err.println("Warning, an exception is thrown due to the SPI test"); e.printStackTrace(); } }
Source:
protected void launchDialog() { final Bundle extras = new Bundle(); extras.putString(UsernameChangerFullScreenDialogFragment.EXTRA_DISPLAY, mEditTextDisplayName.getText().toString()); extras.putString(UsernameChangerFullScreenDialogFragment.EXTRA_USERNAME, mEditTextUsername.getText().toString()); mDialog = new FullScreenDialogFragment.Builder(getContext()) .setTitle(R.string.username_changer_title) .setAction(R.string.username_changer_action) .setOnConfirmListener(this) .setOnDismissListener(this) .setContent(UsernameChangerFullScreenDialogFragment.class, extras) .build(); mDialog.show(getActivity().getSupportFragmentManager(), FullScreenDialogFragment.TAG); }

Target:
protected void launchDialog() { final Bundle bundle = UsernameChangerFullScreenDialogFragment.newBundle( mEditTextDisplayName.getText().toString(), mEditTextUsername.getText().toString()); mDialog = new FullScreenDialogFragment.Builder(getContext()) .setTitle(R.string.username_changer_title) .setAction(R.string.username_changer_action) .setOnConfirmListener(this) .setOnDismissListener(this) .setContent(UsernameChangerFullScreenDialogFragment.class, bundle) .build(); mDialog.show(getActivity().getSupportFragmentManager(), FullScreenDialogFragment.TAG); }
Source:
private Map<String, Integer> buildIoTune(DiskImage diskImage, Map<Guid, Guid> diskProfileStorageQosMap, Map<Guid, Map<String, Integer>> storageQosIoTuneMap) { Guid diskProfileId = diskImage.getDiskProfileId(); if (diskProfileId == null) { return null; } Guid storageQosId = diskProfileStorageQosMap.get(diskProfileId); if (storageQosId == null) { StorageQos storageQos = DbFacade.getInstance().getStorageQosDao().getQosByDiskProfileId(diskProfileId); if (storageQos == null) { return null; } storageQosId = storageQos.getId(); diskProfileStorageQosMap.put(diskProfileId, storageQosId); storageQosIoTuneMap.put(storageQosId, buildIoTuneMap(storageQos)); } Map<String, Integer> ioTuneMap = storageQosIoTuneMap.get(storageQosId); if (ioTuneMap.isEmpty()) { return ioTuneMap; } return null; }

Target:
private Map<String, Integer> buildIoTune(DiskImage diskImage, Map<Guid, Guid> diskProfileStorageQosMap, Map<Guid, Map<String, Integer>> storageQosIoTuneMap) { Guid diskProfileId = diskImage.getDiskProfileId(); if (diskProfileId == null) { return null; } Guid storageQosId = diskProfileStorageQosMap.get(diskProfileId); if (storageQosId == null) { StorageQos storageQos = DbFacade.getInstance().getStorageQosDao().getQosByDiskProfileId(diskProfileId); if (storageQos == null) { return null; } storageQosId = storageQos.getId(); diskProfileStorageQosMap.put(diskProfileId, storageQosId); storageQosIoTuneMap.put(storageQosId, buildIoTuneMap(storageQos)); } Map<String, Integer> ioTuneMap = storageQosIoTuneMap.get(storageQosId); if (!ioTuneMap.isEmpty()) { return ioTuneMap; } return null; }
Source:
public View onCreateActionView() { View view = View.inflate(parentActivity, R.layout.group_find_in_page, null); findInPageNext = view.findViewById(R.id.find_in_page_next); findInPageNext.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View view) { Utils.hideSoftKeyboard(parentActivity); if (!pageFragmentValid()) { return; } parentActivity.getCurPageFragment().getWebView().findNext(true); } }); findInPagePrev = view.findViewById(R.id.find_in_page_prev); findInPagePrev.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View view) { Utils.hideSoftKeyboard(parentActivity); if (!pageFragmentValid()) { return; } parentActivity.getCurPageFragment().getWebView().findNext(false); } }); findInPageMatch = (TextView) view.findViewById(R.id.find_in_page_match); SearchView searchView = (SearchView) view.findViewById(R.id.find_in_page_input); searchView.setQueryHint(parentActivity.getString(R.string.find_in_page)); searchView.setIconified(false); searchView.setOnQueryTextListener(searchQueryListener); searchView.setOnCloseListener(searchCloseListener); searchView.setIconified(false); searchView.setInputType(EditorInfo.TYPE_CLASS_TEXT); searchView.setImeOptions(EditorInfo.IME_ACTION_DONE); searchView.setSubmitButtonEnabled(false); return view; }

Target:
public View onCreateActionView() { View view = View.inflate(parentActivity, R.layout.group_find_in_page, null); findInPageNext = view.findViewById(R.id.find_in_page_next); findInPageNext.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View view) { Utils.hideSoftKeyboard(parentActivity); if (!pageFragmentValid()) { return; } parentActivity.getCurPageFragment().getWebView().findNext(true); } }); findInPagePrev = view.findViewById(R.id.find_in_page_prev); findInPagePrev.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View view) { Utils.hideSoftKeyboard(parentActivity); if (!pageFragmentValid()) { return; } parentActivity.getCurPageFragment().getWebView().findNext(false); } }); findInPageMatch = (TextView) view.findViewById(R.id.find_in_page_match); SearchView searchView = (SearchView) view.findViewById(R.id.find_in_page_input); searchView.setQueryHint(parentActivity.getString(R.string.find_in_page)); searchView.setFocusable(true); searchView.requestFocusFromTouch(); searchView.setOnQueryTextListener(searchQueryListener); searchView.setOnCloseListener(searchCloseListener); searchView.setIconified(false); searchView.setInputType(EditorInfo.TYPE_CLASS_TEXT); searchView.setImeOptions(EditorInfo.IME_ACTION_DONE); searchView.setSubmitButtonEnabled(false); return view; }
Source:
public Optional<String> getInitParameterAsOptional(String name) { String value = getInitParameter(name, String.class); if (Strings.isNullOrEmpty(value)) { return Optional.empty(); } return Optional.of(value); }

Target:
public Optional<String> getInitParameterAsOptional(String name) { String value = getInitParameter(name); if (Strings.isNullOrEmpty(value)) { return Optional.empty(); } return Optional.of(value); }
Source:
public static synchronized MongoClient getMongoClient(final Configuration conf) throws ConfigurationRuntimeException, MongoException { if (mongoClient == null) { if (conf.getBoolean(MongoDBRdfConfiguration.USE_TEST_MONGO, false)) { try { MongodForTestsFactory testsFactory = MongodForTestsFactory.with(Version.Main.PRODUCTION); mongoClient = testsFactory.newMongo(); } catch (IOException e) { throw new MongoException("While creating a factory for a test/mock MongoDB instance.",e); } } else { final String host = requireNonNull(conf.get(MongoDBRdfConfiguration.MONGO_INSTANCE), "MongoDB host name is required"); final int port = requireNonNullInt(conf.get(MongoDBRdfConfiguration.MONGO_INSTANCE_PORT), "MongoDB Port number is required."); ServerAddress server; try { server = new ServerAddress(host, port); } catch (UnknownHostException e) { throw new MongoException("Connecting MongoDB instance, cannot find host="+host,e); } if (conf.get(MongoDBRdfConfiguration.MONGO_USER) != null) { final String username = conf.get(MongoDBRdfConfiguration.MONGO_USER); final String dbName = requireNonNull(conf.get(MongoDBRdfConfiguration.MONGO_DB_NAME), MongoDBRdfConfiguration.MONGO_DB_NAME + " is null but required configuration if " + MongoDBRdfConfiguration.MONGO_USER + " is configured."); final char[] pswd = requireNonNull(conf.get(MongoDBRdfConfiguration.MONGO_USER_PASSWORD), MongoDBRdfConfiguration.MONGO_USER_PASSWORD + " is null but required configuration if " + MongoDBRdfConfiguration.MONGO_USER + " is configured.").toCharArray(); final MongoCredential cred = MongoCredential.createCredential(username, dbName, pswd); mongoClient = new MongoClient(server, Arrays.asList(cred)); } else { mongoClient = new MongoClient(server); } } } return mongoClient; }

Target:
public static synchronized MongoClient getMongoClient(final Configuration conf) throws ConfigurationRuntimeException, MongoException { if (mongoClient == null) { if (conf.getBoolean(MongoDBRdfConfiguration.USE_TEST_MONGO, false)) { createMongoClientForTests(); } else { createMongoClientForServer(conf); } } return mongoClient; }
Source:
public Status delete(String table, String endpoint) { int responseCode; try { responseCode = httpDelete(urlPrefix + endpoint); } catch (Exception e) { responseCode = handleExceptions(e, urlPrefix + endpoint, HttpMethod.DELETE); } if (logEnabled) { System.out.println(new StringBuilder("DELETE Request: ").append(urlPrefix).append(endpoint) .append(" | Response Code: ").append(responseCode).toString()); } return getStatus(responseCode); }

Target:
public Status delete(String table, String endpoint) { int responseCode; try { responseCode = httpDelete(urlPrefix + endpoint); } catch (Exception e) { responseCode = handleExceptions(e, urlPrefix + endpoint, HttpMethod.DELETE); } if (logEnabled) { System.err.println(new StringBuilder("DELETE Request: ").append(urlPrefix).append(endpoint) .append(" | Response Code: ").append(responseCode).toString()); } return getStatus(responseCode); }