auphong2707/dl4se-code-review-dataset huggingface dataset:
Source:
List<Pair<OspfLinkTopologyEntity, OspfLinkTopologyEntity>> matchOspfLinks(List<OspfLinkTopologyEntity> allLinks){ List<Pair<OspfLinkTopologyEntity, OspfLinkTopologyEntity>> results = new ArrayList<>(); Set<Integer> parsed = new HashSet<Integer>(); Map<CompositeKey, OspfLinkTopologyEntity> targetLinks = new HashMap<>(); for(OspfLinkTopologyEntity targetLink : allLinks){ targetLinks.put(new CompositeKey(targetLink.getOspfIpAddr(), targetLink.getOspfRemIpAddr()) , targetLink); } for(OspfLinkTopologyEntity sourceLink : allLinks) { if (parsed.contains(sourceLink.getId())) { continue; } parsed.add(sourceLink.getId()); if (LOG.isDebugEnabled()) { LOG.debug("getOspfLinks: source: {}", sourceLink.toString()); } OspfLinkTopologyEntity targetLink = targetLinks.get(new CompositeKey(sourceLink.getOspfRemIpAddr() , sourceLink.getOspfIpAddr())); if(targetLink == null) { LOG.debug("getOspfLinks: cannot find target for source: '{}'", sourceLink.getId()); continue; } if (sourceLink.getId().equals(targetLink.getId()) || parsed.contains(targetLink.getId())) { continue; } LOG.debug("getOspfLinks: target: {}", targetLink.toString()); parsed.add(targetLink.getId()); results.add(Pair.of(sourceLink, targetLink)); } return results; }

Target:
List<Pair<OspfLinkTopologyEntity, OspfLinkTopologyEntity>> matchOspfLinks(List<OspfLinkTopologyEntity> allLinks){ List<Pair<OspfLinkTopologyEntity, OspfLinkTopologyEntity>> results = new ArrayList<>(); Set<Integer> parsed = new HashSet<Integer>(); Map<CompositeKey, OspfLinkTopologyEntity> targetLinks = new HashMap<>(); for(OspfLinkTopologyEntity targetLink : allLinks){ targetLinks.put(new CompositeKey(targetLink.getOspfIpAddr(), targetLink.getOspfRemIpAddr()) , targetLink); } for(OspfLinkTopologyEntity sourceLink : allLinks) { if (parsed.contains(sourceLink.getId())) { continue; } parsed.add(sourceLink.getId()); if (LOG.isDebugEnabled()) { LOG.debug("getOspfLinks: source: {}", sourceLink); } OspfLinkTopologyEntity targetLink = targetLinks.get(new CompositeKey(sourceLink.getOspfRemIpAddr() , sourceLink.getOspfIpAddr())); if(targetLink == null) { LOG.debug("getOspfLinks: cannot find target for source: '{}'", sourceLink.getId()); continue; } if (sourceLink.getId().equals(targetLink.getId()) || parsed.contains(targetLink.getId())) { continue; } LOG.debug("getOspfLinks: target: {}", targetLink); parsed.add(targetLink.getId()); results.add(Pair.of(sourceLink, targetLink)); } return results; }
Source:
public void notifyEntryExpired(Cache<K, V> cache, K key, V value) { try { if (!expiredListeners.isEmpty()) { List<CacheEntryEvent<? extends K, ? extends V>> events = createEvent(cache, key, value, EventType.EXPIRED); for (CacheEntryExpiredListener<K, V> listener : expiredListeners) { listener.onExpired(getEntryIterable(events, listenerCfgs.get(listener))); } } } finally { notifySync(cache, key, value); } }

Target:
public void notifyEntryExpired(Cache<K, V> cache, K key, V value) { if (!expiredListeners.isEmpty()) { List<CacheEntryEvent<? extends K, ? extends V>> events = createEvent(cache, key, value, EventType.EXPIRED); for (CacheEntryExpiredListener<K, V> listener : expiredListeners) { listener.onExpired(getEntryIterable(events, listenerCfgs.get(listener))); } } }
Source:
protected void auditResponseMessage(RetrieveDocumentSetResponseType response, String direction, String connectInterface, AssertionType assertion, String requestCommunityID) { gov.hhs.fha.nhinc.common.auditlog.DocRetrieveResponseMessageType message = new gov.hhs.fha.nhinc.common.auditlog.DocRetrieveResponseMessageType(); message.setRetrieveDocumentSetResponse(response); message.setAssertion(assertion); AuditRepositoryLogger auditLogger = new AuditRepositoryLogger(); LogEventRequestType auditLogMsg = auditLogger.logDocRetrieveResult(message, direction, connectInterface, requestCommunityID); if (auditLogMsg != null) { auditMessage(auditLogMsg, assertion); } }

Target:
protected void auditResponseMessage(RetrieveDocumentSetResponseType response, String direction, String connectInterface, AssertionType assertion, String requestCommunityID) { DocRetrieveResponseMessageType message = new DocRetrieveResponseMessageType(); message.setRetrieveDocumentSetResponse(response); message.setAssertion(assertion); AuditRepositoryLogger auditLogger = new AuditRepositoryLogger(); LogEventRequestType auditLogMsg = auditLogger.logDocRetrieveResult(message, direction, connectInterface, requestCommunityID); if (auditLogMsg != null) { auditMessage(auditLogMsg, assertion); } }
Source:
private static void changePolicyActivation(Instrumentation instrumentation, String adminName, String change) throws UiObjectNotFoundException { SettingsUtil.openItem(instrumentation, "Security"); UiDevice device = UiDevice.getInstance(instrumentation); UiScrollable itemList = new UiScrollable( new UiSelector().resourceIdMatches(Res.SETTINGS_LIST_CONTAINER_RES) ); itemList.setAsVerticalList(); itemList.getChildByText( new UiSelector().className("android.widget.TextView"), "Device administrators").clickAndWaitForNewWindow(); device.findObject(new UiSelector().text(adminName)).clickAndWaitForNewWindow(); UiObject scrollView = device.findObject( new UiSelector().className("android.widget.ScrollView")); scrollView.waitForExists(TimeUnit.SECONDS.toMillis(3L)); Rect labelRect = scrollView.getBounds(); device.swipe( labelRect.centerX(), labelRect.centerY(), labelRect.centerX(), labelRect.top, 10); UiObject actionButton = device.findObject( new UiSelector().resourceId("com.android.settings:id/action_button")); actionButton.waitForExists(TimeUnit.SECONDS.toMillis(3L)); Assert.assertTrue(actionButton.getText().contains(change)); if(change.equalsIgnoreCase("Activate")){ actionButton.clickAndWaitForNewWindow(); return; } actionButton.click(); device.findObject(new UiSelector().text("OK")).waitForExists( TimeUnit.SECONDS.toMillis(3L)); device.findObject(new UiSelector().text("OK")).click(); }

Target:
private static void changePolicyActivation(Instrumentation instrumentation, String adminName, String change) throws UiObjectNotFoundException { SettingsUtil.openItem(instrumentation, "Security"); UiDevice device = UiDevice.getInstance(instrumentation); UiScrollable itemList = new UiScrollable( new UiSelector().resourceIdMatches(Res.SETTINGS_LIST_CONTAINER_RES) ); itemList.setAsVerticalList(); itemList.getChildByText( new UiSelector().className("android.widget.TextView"), "Device administrators").clickAndWaitForNewWindow(); device.findObject(new UiSelector().text(adminName)).clickAndWaitForNewWindow(); UiObject scrollView = device.findObject( new UiSelector().className("android.widget.ScrollView")); scrollView.waitForExists(TimeUnit.SECONDS.toMillis(3L)); Rect labelRect = scrollView.getBounds(); device.swipe( labelRect.centerX(), labelRect.centerY(), labelRect.centerX(), labelRect.top, 10); UiObject actionButton = device.findObject( new UiSelector().resourceId("com.android.settings:id/action_button")); actionButton.waitForExists(TimeUnit.SECONDS.toMillis(3L)); Assert.assertTrue(actionButton.getText().contains(change)); if (change.equalsIgnoreCase("Activate")) { actionButton.clickAndWaitForNewWindow(); return; } actionButton.click(); UiObject okButton = device.findObject(new UiSelector().text("OK")); okButton.waitForExists(TimeUnit.SECONDS.toMillis(3L)); okButton.click(); }
Source:
String getStubItemWithGsiTableName() { return stubItemWithGsiTableName; }

Target:
public String getStubItemWithGsiTableName() { return stubItemWithGsiTableName; }
Source:
public void downloadPatientByUuid(@NonNull final String uuid, @NonNull final DownloadPatientCallbackListener callbackListener) { RestApi restApi = RestServiceBuilder.createService(RestApi.class); Call<Patient> call = restApi.getPatientByUUID(uuid, "full"); call.enqueue(new Callback<Patient>() { @Override public void onResponse(Call<Patient> call, Response<Patient> response) { if (response.isSuccessful()) { final Patient newPatient = response.body(); downloadPatientPhotoByUuid(uuid, new DownloadPatientPhotoCallbackListener() { @Override public void onPatientPhotoDownloaded(ResponseBody base64PatientPhoto) { InputStream inputStream = base64PatientPhoto.byteStream(); logger.i("setting image"); Bitmap bitmap = BitmapFactory.decodeStream(inputStream); try { inputStream.close(); } catch (IOException e) { e.printStackTrace(); } if (bitmap != null) { newPatient.getPerson().setPhoto(bitmap); } else logger.i("bitmap = null"); } @Override public void onResponse() { } @Override public void onErrorResponse(String errorMsg) { logger.i(errorMsg); } }); if (newPatient.getPerson().getPhoto() != null) { logger.i("photo set"); } else { logger.i("photo is null"); } callbackListener.onPatientDownloaded(newPatient); } else { callbackListener.onErrorResponse(response.message()); } } @Override public void onFailure(Call<Patient> call, Throwable t) { callbackListener.onErrorResponse(t.getMessage()); } }); }

Target:
public void downloadPatientByUuid(@NonNull final String uuid, @NonNull final DownloadPatientCallbackListener callbackListener) { RestApi restApi = RestServiceBuilder.createService(RestApi.class); Call<Patient> call = restApi.getPatientByUUID(uuid, "full"); call.enqueue(new Callback<Patient>() { @Override public void onResponse(Call<Patient> call, Response<Patient> response) { if (response.isSuccessful()) { final Patient newPatient = response.body(); AndroidDeferredManager dm = new AndroidDeferredManager(); dm.when(downloadPatientPhotoByUuid(newPatient.getUuid())).done(new DoneCallback<Bitmap>() { @Override public void onDone(Bitmap result) { if (result != null) { newPatient.getPerson().setPhoto(result); callbackListener.onPatientPhotoDownloaded(newPatient); } } }); callbackListener.onPatientDownloaded(newPatient); } else { callbackListener.onErrorResponse(response.message()); } } @Override public void onFailure(Call<Patient> call, Throwable t) { callbackListener.onErrorResponse(t.getMessage()); } }); }
Source:
public void readExternal(DataInputStream in, PrototypeFactory pf) throws IOException, DeserializationException { name = (Text)ExtUtil.read(in, new ExtWrapNullable(Text.class)); imageReference = (Text)ExtUtil.read(in, new ExtWrapNullable(Text.class)); audioReference = (Text)ExtUtil.read(in, new ExtWrapNullable(Text.class)); }

Target:
public void readExternal(DataInputStream in, PrototypeFactory pf) throws IOException, DeserializationException { name = (Text)ExtUtil.read(in, Text.class, pf); imageReference = (Text)ExtUtil.read(in, new ExtWrapNullable(Text.class)); audioReference = (Text)ExtUtil.read(in, new ExtWrapNullable(Text.class)); }
Source:
public void testDisabledOutcomeSuccess() throws Exception { service.setSuccess(true); trackerFactory.saveInfluenceParams(disabledInfluenceParams); sessionManager.initSessionFromCache(); controller.sendOutcomeEvent(OUTCOME_NAME); threadAndTaskWait(); new Thread(new Runnable() { @Override public void run() { handler.setOutcomes(repository.getSavedOutcomeEvents()); } }, "OS_GET_SAVED_OUTCOMES_SUCCESS").start(); threadAndTaskWait(); assertEquals(0, outcomeEvents.size()); assertEquals("{}", service.getLastJsonObjectSent()); }

Target:
public void testDisabledOutcomeSuccess() throws Exception { service.setSuccess(true); trackerFactory.saveInfluenceParams(disabledInfluenceParams); sessionManager.initSessionFromCache(); controller.sendOutcomeEvent(OUTCOME_NAME); threadAndTaskWait(); handler.setOutcomes(repository.getSavedOutcomeEvents()); threadAndTaskWait(); assertEquals(0, outcomeEvents.size()); assertEquals("{}", service.getLastJsonObjectSent()); }
Source:
public void testHttpIngestionInvalidPastCollectionTime() throws Exception { String prefix = getPrefix(); long time = System.currentTimeMillis() - 600000 - Configuration.getInstance().getLongProperty( CoreConfig.BEFORE_CURRENT_COLLECTIONTIME_MS ); HttpResponse response = postGenMetric( TID, prefix, postPath, time ); assertEquals( 400, response.getStatusLine().getStatusCode() ); String[] output = getBodyArray( response ); assertTrue( Pattern.matches( JSONMetricsContainerTest.PAST_COLLECTION_TIME_REGEX, output[ 1 ] ) ); assertTrue( Pattern.matches( JSONMetricsContainerTest.PAST_COLLECTION_TIME_REGEX, output[ 2 ] ) ); assertTrue( Pattern.matches( JSONMetricsContainerTest.PAST_COLLECTION_TIME_REGEX, output[ 3 ] ) ); }

Target:
public void testHttpIngestionInvalidPastCollectionTime() throws Exception { String postfix = getPostfix(); long time = System.currentTimeMillis() - TIME_DIFF_MS - Configuration.getInstance().getLongProperty( CoreConfig.BEFORE_CURRENT_COLLECTIONTIME_MS ); HttpResponse response = postGenMetric( TID, postfix, postPath, time ); assertEquals( 400, response.getStatusLine().getStatusCode() ); String[] output = getBodyArray( response ); assertTrue( Pattern.matches( PAST_COLLECTION_TIME_REGEX, output[ 1 ] ) ); assertTrue( Pattern.matches( PAST_COLLECTION_TIME_REGEX, output[ 2 ] ) ); assertTrue( Pattern.matches( PAST_COLLECTION_TIME_REGEX, output[ 3 ] ) ); }
Source:
public void testReadThroughputLatency() throws Exception { ExecutorService executor = Executors.newSingleThreadExecutor( new ThreadFactoryBuilder().setNameFormat("read-throughput-latency-test").build()); Future<Integer> f = executor.submit(() -> { BenchReadThroughputLatency.main(new String[] { "--zookeeper", zkUtil.getZooKeeperConnectString(), "--listen", "10"}); return 0; }); Thread.sleep(2000); byte data[] = new byte[1024]; Arrays.fill(data, (byte)'x'); long lastLedgerId = 0; for (int i = 0; i < 10; i++) { BookKeeper bk = new BookKeeper(zkUtil.getZooKeeperConnectString()); LedgerHandle lh = bk.createLedger(BookKeeper.DigestType.CRC32, "benchPasswd".getBytes()); lastLedgerId = lh.getId(); try { for (int j = 0; j < 100; j++) { lh.addEntry(data); } } finally { lh.close(); bk.close(); } } Assert.assertEquals(Integer.valueOf(0), f.get(30, TimeUnit.SECONDS)); BenchReadThroughputLatency.main(new String[] { "--zookeeper", zkUtil.getZooKeeperConnectString(), "--ledger", String.valueOf(lastLedgerId)}); }

Target:
public void testReadThroughputLatency() throws Exception { final AtomicBoolean threwException = new AtomicBoolean(false); Thread t = new Thread() { public void run() { try { BenchReadThroughputLatency.main(new String[] { "--zookeeper", zkUtil.getZooKeeperConnectString(), "--listen", "10"}); } catch (Throwable t) { LOG.error("Error reading", t); threwException.set(true); } } }; t.start(); Thread.sleep(10000); byte data[] = new byte[1024]; Arrays.fill(data, (byte)'x'); long lastLedgerId = 0; Assert.assertTrue("Thread should be running", t.isAlive()); for (int i = 0; i < 10; i++) { BookKeeper bk = new BookKeeper(zkUtil.getZooKeeperConnectString()); LedgerHandle lh = bk.createLedger(BookKeeper.DigestType.CRC32, "benchPasswd".getBytes()); lastLedgerId = lh.getId(); try { for (int j = 0; j < 100; j++) { lh.addEntry(data); } } finally { lh.close(); bk.close(); } } for (int i = 0; i < 60; i++) { if (!t.isAlive()) { break; } Thread.sleep(100); } Assert.assertFalse("Thread should be finished", t.isAlive()); BenchReadThroughputLatency.main(new String[] { "--zookeeper", zkUtil.getZooKeeperConnectString(), "--ledger", String.valueOf(lastLedgerId)}); }
Source:
public Opt<Identity> enter(final Request request) { final Opt<Identity> retValue; if (this.condition) { retValue = new Opt.Single<Identity>( new Identity.Simple("urn:test:1") ); } else { retValue = new Opt.Empty<Identity>(); } return retValue; }

Target:
public Opt<Identity> enter(final Request request) { final Opt<Identity> user; if (this.condition) { user = new Opt.Single<Identity>( new Identity.Simple("urn:test:1") ); } else { user = new Opt.Empty<Identity>(); } return user; }
Source:
public String getDescription() { return "Make Pubmed ID to be a multiple value field."; }

Target:
public String getDescription() { return "Clean up empty pubmed id entries."; }
Source:
private void setMerged(final Change c, final ChangeMessage msg) throws OrmException { try { db.changes().beginTransaction(c.getId()); CodeReviewCommit commit = commits.get(c.getId()); PatchSet.Id merged = commit.change.currentPatchSetId(); setMergedPatchSet(c.getId(), merged); PatchSetApproval submitter = saveApprovals(c, merged); addMergedMessage(submitter, msg); sendMergedEmail(c, submitter); db.commit(); if (submitter != null) { try { hooks.doChangeMergedHook(c, accountCache.get(submitter.getAccountId()).getAccount(), db.patchSets().get(c.currentPatchSetId()), db); } catch (OrmException ex) { log.error("Cannot run hook for submitted patch set " + c.getId(), ex); } } } finally { db.rollback(); } }

Target:
private void setMerged(final Change c, final ChangeMessage msg) throws OrmException { try { db.changes().beginTransaction(c.getId()); CodeReviewCommit commit = commits.get(c.getId()); PatchSet.Id merged = commit.change.currentPatchSetId(); setMergedPatchSet(c.getId(), merged); PatchSetApproval submitter = saveApprovals(c, merged); addMergedMessage(submitter, msg); db.commit(); sendMergedEmail(c, submitter); if (submitter != null) { try { hooks.doChangeMergedHook(c, accountCache.get(submitter.getAccountId()).getAccount(), db.patchSets().get(c.currentPatchSetId()), db); } catch (OrmException ex) { log.error("Cannot run hook for submitted patch set " + c.getId(), ex); } } } finally { db.rollback(); } }
Source:
public void query(GridCacheQueryType type, String text, long id, long startTime, long duration, boolean success) { FileWriter writer = fileWriter; if (writer == null) return; boolean needWriteStr = !writer.stringCached(text); byte[] strBytes = needWriteStr ? text.getBytes() : null; doWrite(QUERY, () -> { int size = 1 + 1 + 4 + 8 + 8 + 8 + 1; if (needWriteStr) size += 4 + strBytes.length; return size; }, buf -> { buf.put((byte)type.ordinal()); buf.put(needWriteStr ? (byte)1 : 0); buf.putInt(text.hashCode()); if (needWriteStr) { buf.putInt(strBytes.length); buf.put(strBytes); } buf.putLong(id); buf.putLong(startTime); buf.putLong(duration); buf.put(success ? (byte)1 : 0); }); }

Target:
public void query(GridCacheQueryType type, String text, long id, long startTime, long duration, boolean success) { boolean cached = cacheIfPossible(text); doWrite(QUERY, queryRecordSize(cached ? 0 : text.getBytes().length, cached), buf -> { writeString(buf, text, cached); buf.put((byte)type.ordinal()); buf.putLong(id); buf.putLong(startTime); buf.putLong(duration); buf.put(success ? (byte)1 : 0); }); }
Source:
public Map<String, List<ReplicaId>> getPeerLeaderReplicasByPartition() { return Collections.unmodifiableMap(peerLeaderReplicasByPartition); }

Target:
Map<String, List<ReplicaId>> getPeerLeaderReplicasByPartition() { return Collections.unmodifiableMap(peerLeaderReplicasByPartition); }
Source:
public void logsRequestsWithoutSkew() { monitor.runInBackground(); RequestTime requestTime = new RequestTime(1L, 1L, 1L); mockLocalAndRemoteClockSuppliers(requestTime); executorService.tick(1, TimeUnit.NANOSECONDS); RequestTime remoteTime = new RequestTimeBuilder(requestTime) .progressLocalClock(100L) .progressRemoteClock(100L) .build(); mockLocalAndRemoteClockSuppliers(remoteTime); executorService.tick(PAUSE_BETWEEN_REQUESTS.toNanos(), TimeUnit.NANOSECONDS); verify(mockedEvents, times(1)) .requestPace(anyString(), anyLong(), anyLong(), anyLong()); }

Target:
public void logsRequestsWithoutSkew() { monitor.runInBackground(); RequestTime requestTime = new RequestTime(1L, 1L, 1L); mockLocalAndRemoteClockSuppliers(requestTime); executorService.tick(1, TimeUnit.NANOSECONDS); RequestTime remoteTime = new RequestTime.Builder(requestTime) .progressLocalClock(100L) .progressRemoteClock(100L) .build(); mockLocalAndRemoteClockSuppliers(remoteTime); executorService.tick(ClockSkewMonitor.PAUSE_BETWEEN_REQUESTS.toNanos(), TimeUnit.NANOSECONDS); verify(mockedEvents, times(1)) .requestPace(anyString(), anyLong(), anyLong(), anyLong()); }
Source:
private Predicate<RefundHistory> filterForRefundTransaction(RefundTransactionEntity refundTransactionEntity) { return refundHistory -> refundHistory.getReference().equals(refundTransactionEntity.getRefundReference()); }

Target:
private Predicate<RefundHistory> filterForRefundTransaction(RefundTransactionEntity refundTransactionEntity) { return refundHistory -> refundHistory.getExternalId().equals(refundTransactionEntity.getRefundExternalId()); }
Source:
protected Promise<Expression> eval(BranchContext context, MemberOf memberOf) { if (memberOf.getConstraint() instanceof ConceptReference) { final ConceptReference concept = (ConceptReference) memberOf.getConstraint(); return Promise.immediate(referringRefSet(concept.getId())); } else if (memberOf.getConstraint() instanceof Any) { return Promise.immediate(Expressions.exists(REFERRING_REFSETS)); } else { return throwUnsupported(memberOf.getConstraint()); } }

Target:
protected Promise<Expression> eval(BranchContext context, MemberOf memberOf) { if (memberOf.getConstraint() instanceof ConceptReference) { final ConceptReference concept = (ConceptReference) memberOf.getConstraint(); return Promise.immediate( Expressions.builder() .should(referringRefSet(concept.getId())) .should(referringMappingRefSet(concept.getId())) .build() ); } else if (memberOf.getConstraint() instanceof Any) { return Promise.immediate(Expressions.builder() .should(Expressions.exists(REFERRING_REFSETS)) .should(Expressions.exists(REFERRING_MAPPING_REFSETS)) .build()); } else { return throwUnsupported(memberOf.getConstraint()); } }
Source:
public SmartImportJob getImportJob() { final File root = this.projectRootPage.getSelectedRoot(); if (root == null) { return null; } if (root.isDirectory()) { this.directoryToImport = root; } else if (SmartImportWizard.isValidArchive(root)) { this.directoryToImport = getExpandDirectory(root); if (!directoryToImport.isDirectory()) { throw new IllegalArgumentException("Archive wasn't expanded first"); } } else { throw new IllegalArgumentException("Not supported archive type: " + root); } if (this.easymportJob == null || !matchesPage(this.easymportJob, this.projectRootPage)) { this.easymportJob = new SmartImportJob(this.directoryToImport, projectRootPage.getSelectedWorkingSets(), projectRootPage.isConfigureProjects(), projectRootPage.isDetectNestedProject()); } return this.easymportJob; }

Target:
public SmartImportJob getImportJob() { final File root = this.projectRootPage.getSelectedRoot(); if (root == null) { return null; } if (root.isDirectory()) { this.directoryToImport = root; } else if (SmartImportWizard.isValidArchive(root)) { this.directoryToImport = getExpandDirectory(root); if (!directoryToImport.isDirectory()) { throw new IllegalArgumentException("Archive wasn't expanded first"); } } else { return null; } if (this.easymportJob == null || !matchesPage(this.easymportJob, this.projectRootPage)) { this.easymportJob = new SmartImportJob(this.directoryToImport, projectRootPage.getSelectedWorkingSets(), projectRootPage.isConfigureProjects(), projectRootPage.isDetectNestedProject()); } return this.easymportJob; }
Source:
public static String escapeUnderScore(final String customizedValue, final String customizedRelation) { String escapedValue = customizedValue; if (customizedRelation.equalsIgnoreCase("LIKE") || customizedRelation.equalsIgnoreCase("ILIKE")) { String replaceWith = "_"; int pgMajorRelease = Config.<Integer> getValue(ConfigValues.PgMajorRelease); if (pgMajorRelease == SyntaxChecker.PgMajorRelease.PG8.getValue()) { replaceWith = "\\\\_"; } else if (pgMajorRelease == SyntaxChecker.PgMajorRelease.PG9.getValue()) { replaceWith = "\\_"; } escapedValue = customizedValue.replace("_", replaceWith); } return escapedValue; }

Target:
public static String escapeUnderScore(final String customizedValue, final String customizedRelation) { String escapedValue = customizedValue; if (customizedRelation.equalsIgnoreCase("LIKE") || customizedRelation.equalsIgnoreCase("ILIKE")) { escapedValue = customizedValue.replace("_", getEscapedCharacter("_")); } return escapedValue; }
Source:
protected String retrieveProxyGrantingTicket(final String response) { final List<String> values = XmlUtils.getTextForElements(response, "proxyGrantingTicket"); for (final String value : values) { if (value != null) { if (value.startsWith("PGTIOU-")) { return retrieveProxyGrantingTicketFromStorage(value); } else { return retrieveProxyGrantingTicketViaEncryption(value); } } } return null; }

Target:
protected String retrieveProxyGrantingTicket(final String response) { final List<String> values = XmlUtils.getTextForElements(response, PGT_ATTRIBUTE); for (final String value : values) { if (value != null) { if (value.startsWith(PGTIOU_PREFIX)) { return retrieveProxyGrantingTicketFromStorage(value); } else { return retrieveProxyGrantingTicketViaEncryption(value); } } } return null; }
Source:
public int pingEndpoint() { String sName = selectedEndpoint.getName(); int pingResponse = 0; for (ConnectionEndpoint connEndpoint : endpoints) { String eName = connEndpoint.getName(); if (sName.equals(eName)) { return exchangeService.pingService(connEndpoint); } } return pingResponse; }

Target:
public int pingEndpoint() { for (ConnectionEndpoint connEndpoint : endpoints) { if (connEndpoint.getName().equals(selectedEndpoint.getName())) { return exchangeService.pingService(connEndpoint); } } return 0; }
Source:
public DateTime timestamp(Map<String, Object> theMap) { if (!theMap.containsKey(timestampField)) LOG.error("Data tuple doesn't contain timestamp field : " + timestampField); return new DateTime(theMap.get(timestampField), DateTimeZone.UTC); }

Target:
public DateTime timestamp(Map<String, Object> theMap) { Object timeStamp = theMap.get(timestampField); if (Objects.isNull(timeStamp)) LOG.error("Data tuple doesn't contain timestamp field : {}, so using current time as timestamp", timestampField); return new DateTime(timeStamp, DateTimeZone.UTC); }
Source:
public int indexOf(int tag, int fromIndex) { for (int i = fromIndex; i < count; i++) { if (tags[i] == tag) return i; } return -1; }

Target:
public int indexOf(int tag, int fromIndex) { for (; fromIndex < count; fromIndex++) { if (tags[fromIndex] == tag) return fromIndex; } return -1; }
Source:
protected boolean validateFields() { ProxiesParamProxy testProxy = proxyPanel.getProxy(); if (extension.getAdditionalProxy(testProxy.getAddress(), testProxy.getPort()) != null) { JOptionPane.showMessageDialog( this, Constant.messages.getString("options.proxy.dialog.proxy.warning.dup.message"), Constant.messages.getString("options.proxy.dialog.proxy.warning.dup.title"), JOptionPane.ERROR_MESSAGE); return false; } if (this.proxy == null || !(this.proxy.getAddress().equals(testProxy.getAddress()) && this.proxy.getPort() == testProxy.getPort())) { if (!extension.canListenOn(testProxy.getAddress(), testProxy.getPort())) { JOptionPane.showMessageDialog( this, Constant.messages.getString("options.proxy.dialog.proxy.warning.fail.message"), Constant.messages.getString("options.proxy.dialog.proxy.warning.fail.title"), JOptionPane.ERROR_MESSAGE); return false; } } return true; }

Target:
protected boolean validateFields() { ProxiesParamProxy testProxy = proxyPanel.getProxy(); if (extension.getAdditionalProxy(testProxy.getAddress(), testProxy.getPort()) != null) { JOptionPane.showMessageDialog( this, Constant.messages.getString("options.proxy.dialog.proxy.warning.dup.message"), Constant.messages.getString("options.proxy.dialog.proxy.warning.dup.title"), JOptionPane.ERROR_MESSAGE); return false; } if (this.proxy == null || !(this.proxy.getAddress().equals(testProxy.getAddress()) && this.proxy.getPort() == testProxy.getPort())) { if (!extension.canListenOn(testProxy.getAddress(), testProxy.getPort())) { JOptionPane.showMessageDialog( this, Constant.messages.getString("options.proxy.dialog.proxy.warning.fail.message", testProxy.getAddress(), testProxy.getPort()), Constant.messages.getString("options.proxy.dialog.proxy.warning.fail.title"), JOptionPane.ERROR_MESSAGE); return false; } } return true; }
Source:
public ScalarFunctionImplementation specialize(BoundVariables boundVariables, int arity, TypeManager typeManager, FunctionRegistry functionRegistry) { checkArgument(arity == 1, "Expected arity to be 1"); Type type = boundVariables.getTypeVariable("T"); Class<?> indeterminateOperatorClass = generateIndeterminate(type, functionRegistry); MethodHandle methodHandle = methodHandle(indeterminateOperatorClass, "indeterminate", type.getJavaType(), boolean.class); return new ScalarFunctionImplementation( false, ImmutableList.of( valueTypeArgumentProperty(USE_NULL_FLAG)), methodHandle, isDeterministic()); }

Target:
public ScalarFunctionImplementation specialize(BoundVariables boundVariables, int arity, TypeManager typeManager, FunctionRegistry functionRegistry) { checkArgument(arity == 1, "Expected arity to be 1"); Type type = boundVariables.getTypeVariable("T"); Class<?> indeterminateOperatorClass = generateIndeterminate(type, functionRegistry); MethodHandle indeterminateMethod = methodHandle(indeterminateOperatorClass, "indeterminate", type.getJavaType(), boolean.class); return new ScalarFunctionImplementation( false, ImmutableList.of(valueTypeArgumentProperty(USE_NULL_FLAG)), indeterminateMethod, isDeterministic()); }
Source:
public BackupLeaderRole(CoreMasterContext masterContext) { super(masterContext); LOG.info("Creating backup-leader role."); mStateLockManager = masterContext.getStateLockManager(); mStateLockTimeout = ServerConfiguration.getMs(PropertyKey.MASTER_SHELL_BACKUP_STATE_LOCK_TIMEOUT); mBackupAbandonTimeout = ServerConfiguration.getMs(PropertyKey.MASTER_BACKUP_ABANDON_TIMEOUT); }

Target:
public BackupLeaderRole(CoreMasterContext masterContext) { super(masterContext); LOG.info("Creating backup-leader role."); mStateLockManager = masterContext.getStateLockManager(); mBackupAbandonTimeout = ServerConfiguration.getMs(PropertyKey.MASTER_BACKUP_ABANDON_TIMEOUT); }
Source:
private void generateEnumReadMany(EnumType type) { JavaClassName typeName = javaTypes.getInterfaceName(type); javaBuffer.addImport(typeName); javaBuffer.addImport(ArrayList.class); javaBuffer.addImport(List.class); javaBuffer.addImport(NoSuchElementException.class); javaBuffer.addImport(XmlReader.class); javaBuffer.addLine("public static List<%1$s> readMany(XmlReader reader) {", typeName.getSimpleName()); javaBuffer.addLine( "List<%1$s> list = new ArrayList<>();", typeName.getSimpleName()); javaBuffer.addLine( "if (!reader.forward()) {"); javaBuffer.addLine( "return list;"); javaBuffer.addLine( "}"); javaBuffer.addLine( "reader.next();"); javaBuffer.addLine( "while (reader.forward()) {"); javaBuffer.addLine( "String v = reader.readString();"); javaBuffer.addLine( "%1$s next = %1$s.fromValue(v);", typeName.getSimpleName()); javaBuffer.addLine( "if (next == null) {"); javaBuffer.addLine( "throw new NoSuchElementException();"); javaBuffer.addLine( "}"); javaBuffer.addLine( "list.add(next);"); javaBuffer.addLine( "}"); javaBuffer.addLine( "reader.next();"); javaBuffer.addLine( "return list;"); javaBuffer.addLine("}"); javaBuffer.addLine(); }

Target:
private void generateEnumReadMany(EnumType type) { JavaClassName typeName = javaTypes.getInterfaceName(type); javaBuffer.addImport(typeName); javaBuffer.addImport(ArrayList.class); javaBuffer.addImport(List.class); javaBuffer.addImport(NoSuchElementException.class); javaBuffer.addImport(XmlReader.class); javaBuffer.addLine("public static List<%1$s> readMany(XmlReader reader) {", typeName.getSimpleName()); javaBuffer.addLine( "List<%1$s> list = new ArrayList<>();", typeName.getSimpleName()); javaBuffer.addLine( "if (!reader.forward()) {"); javaBuffer.addLine( "return list;"); javaBuffer.addLine( "}"); javaBuffer.addLine( "reader.next();"); javaBuffer.addLine( "while (reader.forward()) {"); javaBuffer.addLine( "String v = reader.readString();"); javaBuffer.addLine( "%1$s next = %1$s.fromValue(v);", typeName.getSimpleName()); javaBuffer.addLine( "if (next == null) {"); javaBuffer.addLine( "break;"); javaBuffer.addLine( "}"); javaBuffer.addLine( "list.add(next);"); javaBuffer.addLine( "}"); javaBuffer.addLine( "reader.next();"); javaBuffer.addLine( "return list;"); javaBuffer.addLine("}"); javaBuffer.addLine(); }
Source:
public void saveDetails(HttpResponse method, HTTPSampleResult res) { if (isCacheable(res)){ String lastModified = getHeader(method ,HTTPConstants.LAST_MODIFIED); String expires = getHeader(method ,HTTPConstants.EXPIRES); String etag = getHeader(method ,HTTPConstants.ETAG); String cacheControl = getHeader(method, HTTPConstants.CACHE_CONTROL); String date = getHeader(method, HTTPConstants.DATE); setCache(lastModified, cacheControl, expires, etag, res.getUrlAsString(), date, getVaryHeader(getHeader(method, HTTPConstants.VARY), res.getRequestHeaders())); } }

Target:
public void saveDetails(HttpResponse method, HTTPSampleResult res) { final String varyHeader = getHeader(method, HTTPConstants.VARY); if (isCacheable(res, varyHeader)){ String lastModified = getHeader(method ,HTTPConstants.LAST_MODIFIED); String expires = getHeader(method ,HTTPConstants.EXPIRES); String etag = getHeader(method ,HTTPConstants.ETAG); String cacheControl = getHeader(method, HTTPConstants.CACHE_CONTROL); String date = getHeader(method, HTTPConstants.DATE); setCache(lastModified, cacheControl, expires, etag, res.getUrlAsString(), date, getVaryHeader(varyHeader, asHeaders(res.getRequestHeaders()))); } }
Source:
private Map<String, UserType> buildUserTypes(KeyspaceMetadata keyspace, List<Row> udtRows, VersionNumber cassandraVersion, Cluster cluster) { Map<String, UserType> userTypes = new LinkedHashMap<String, UserType>(); if (udtRows != null) { if(cassandraVersion.getMajor() >= 3 && udtRows.size() > 1) { UserTypeDependencyGraph graph = new UserTypeDependencyGraph(udtRows, cluster, keyspace.getName()); for (Row udtRow: graph) { UserType type = UserType.build(keyspace, udtRow, cassandraVersion, cluster, userTypes); userTypes.put(type.getTypeName(), type); } } else { for (Row udtRow : udtRows) { UserType type = UserType.build(keyspace, udtRow, cassandraVersion, cluster, userTypes); userTypes.put(type.getTypeName(), type); } } } return userTypes; }

Target:
private Map<String, UserType> buildUserTypes(KeyspaceMetadata keyspace, List<Row> udtRows, VersionNumber cassandraVersion, Cluster cluster) { Map<String, UserType> userTypes = new LinkedHashMap<String, UserType>(); if (udtRows != null) { for (Row udtRow : maybeSortUdts(udtRows, cluster, keyspace.getName())) { UserType type = UserType.build(keyspace, udtRow, cassandraVersion, cluster, userTypes); userTypes.put(type.getTypeName(), type); } } return userTypes; }
Source:
public AWSCredentials getCredentials() { if (profilesConfigFile == null) { synchronized (this) { if (profilesConfigFile == null) { profilesConfigFile = new ProfilesConfigFile(); } } } if (ProfilesConfigFile.DEFAULT_PROFILE_NAME.equals(profileName)) { String profileOverride = System.getenv(ProfilesConfigFile.AWS_PROFILE_ENVIRONMENT_VARIABLE); profileOverride = StringUtils.trim(profileOverride); if (!StringUtils.isNullOrEmpty(profileOverride)) { return profilesConfigFile.getCredentials(profileOverride); } } return profilesConfigFile.getCredentials(profileName); }

Target:
public AWSCredentials getCredentials() { if (profilesConfigFile == null) { synchronized (this) { if (profilesConfigFile == null) { profilesConfigFile = new ProfilesConfigFile(); } } } return profilesConfigFile.getCredentials(profileName); }
Source:
public void init(final RuleModellerPage page) { this.page = page; if (page.plugin() instanceof BRLActionColumnPlugin) { } }

Target:
public void init(final RuleModellerPage page) { this.page = page; }
Source:
public void testCreateTransaction() { final String transactionId = "1"; Declared transactionState = new Declared(); transactionState.setTxnId(Binary.create(ByteBuffer.wrap(transactionId.getBytes()))); TransactionCoordinator transactionCoordinator = new TransactionCoordinator(sendLink, messageSerializer); doReturn(Mono.just(transactionState)).when(sendLink).send(any(byte[].class), anyInt(), anyInt()); AtomicReference<AmqpTransaction> createdTransaction = new AtomicReference<>(); StepVerifier.create(transactionCoordinator.createTransaction() .map(txn -> { createdTransaction.set(txn); return txn; })) .verifyComplete(); Assertions.assertNotNull(createdTransaction.get(), "Should have got transaction id."); Assertions.assertTrue(new String(createdTransaction.get().getTransactionId().array()).equals(transactionId), "Transaction id is not equal."); verify(sendLink, times(1)).send(any(byte[].class), anyInt(), anyInt()); }

Target:
public void testCreateTransaction() { final byte[] transactionId = "1".getBytes(); Declared transactionState = new Declared(); transactionState.setTxnId(Binary.create(ByteBuffer.wrap(transactionId))); TransactionCoordinator transactionCoordinator = new TransactionCoordinator(sendLink, messageSerializer); doReturn(Mono.just(transactionState)).when(sendLink).send(any(byte[].class), anyInt(), eq(DeliveryImpl.DEFAULT_MESSAGE_FORMAT), isNull()); StepVerifier.create(transactionCoordinator.createTransaction()) .assertNext(actual -> { Assertions.assertNotNull(actual); Assertions.assertArrayEquals(transactionId, actual.getTransactionId().array()); }) .verifyComplete(); verify(sendLink).send(any(byte[].class), anyInt(), eq(DeliveryImpl.DEFAULT_MESSAGE_FORMAT), isNull()); }
Source:
public void execute(OperationContext context, ModelNode operation) { final Resource resource = context.readResourceForUpdate(PathAddress.EMPTY_ADDRESS); final ModelNode model = resource.getModel(); if (!context.isBooting()) model.get(ENABLED).set(true); if (context.isBooting()) { context.addStep(new OperationStepHandler() { public void execute(OperationContext context, ModelNode operation) throws OperationFailedException { final ManagementResourceRegistration registration = context.getResourceRegistrationForUpdate(); addServices(context, operation, registration, model, isXa()); context.completeStep(new OperationContext.RollbackHandler() { @Override public void handleRollback(OperationContext context, ModelNode operation) { } }); } }, OperationContext.Stage.RUNTIME); } else { context.reloadRequired(); } }

Target:
public void execute(OperationContext context, ModelNode operation) throws OperationFailedException { if (context.isNormalServer()) { throw ConnectorLogger.ROOT_LOGGER.legacyOperation(); } }
Source:
private final void excludeLinesIfTrue(boolean shouldExclude, Tree tree, Class<? extends JavaCheck>... rules) { BiConsumer<Tree, Class<? extends JavaCheck>> consumer = shouldExclude ? this::excludeLines : this::acceptLines; Arrays.stream(rules).forEach(rule -> consumer.accept(tree, rule)); }

Target:
private final void excludeLinesIfTrue(boolean shouldExclude, Tree tree, Class<? extends JavaCheck>... rules) { for (Class<? extends JavaCheck> rule : rules) { excludeLinesIfTrue(shouldExclude, tree, rule); } }
Source:
private Service getServiceInternal() { for (SplunkServer splunkServer : splunkServers) { Service service = servicePerServer.get( splunkServer ); if ( service != null && !splunkServer.isTestOnBorrow() ) { return service; } if (service!=null && splunkServer.isTestOnBorrow()){ if (pingService( service )){ return service; } else { continue; } } ExecutorService executor = Executors.newSingleThreadExecutor(); Callable<Service> callable = buildServiceCallable( splunkServer ); Future<Service> future = executor.submit( callable ); try { if ( splunkServer.getTimeout() > 0 ) { service = future.get( splunkServer.getTimeout(), TimeUnit.MILLISECONDS ); } else { service = future.get(); } servicePerServer.put( splunkServer, service ); return service; } catch ( Exception e ) { if (LOGGER.isInfoEnabled()) { LOGGER.info( String.format( "could not connect to Splunk Server @ %s:%d - %s, try next one", splunkServer.getHost(), splunkServer.getPort(), e.getMessage() ) ); } } } String message = String.format( "could not connect to any of Splunk Servers %s", this.splunkServers); LOGGER.error( message ); throw new RuntimeException( message ); }

Target:
private Service getServiceInternal() { for (SplunkServer splunkServer : splunkServers) { Service service = servicePerServer.get(splunkServer); if (service != null) { if (!splunkServer.isCheckServiceOnBorrow() || pingService(service)) { return service; } else { continue; } } ExecutorService executor = Executors.newSingleThreadExecutor(); Callable<Service> callable = buildServiceCallable(splunkServer); Future<Service> future = executor.submit(callable); try { if (splunkServer.getTimeout() > 0) { service = future.get(splunkServer.getTimeout(), TimeUnit.MILLISECONDS); } else { service = future.get(); } servicePerServer.put(splunkServer, service); return service; } catch (Exception e) { if (LOGGER.isInfoEnabled()) { LOGGER.info(String.format("could not connect to Splunk Server @ %s:%d - %s, try next one", splunkServer.getHost(), splunkServer.getPort(), e.getMessage())); } } } String message = String.format("could not connect to any of Splunk Servers %s", this.splunkServers); LOGGER.error(message); throw new RuntimeException(message); }
Source:
public void invalidateSession( String subjectName, Function<Map<String, Object>, String> sessionSubjectExtractor) { final Optional<String> sessionIdOptional = idManager .dataStores .stream() .map(AttributeSharingSessionDataStore::getSessionDataMap) .map(Map::entrySet) .flatMap(Collection::stream) .filter( e -> subjectName.equals( sessionSubjectExtractor.apply(e.getValue().getAllAttributes()))) .map(Map.Entry::getKey) .findFirst(); sessionIdOptional.ifPresent(idManager::invalidateSession); }

Target:
public void invalidateSession( String subjectName, Function<Map<String, Object>, String> sessionSubjectExtractor) { final Optional<String> sessionIdOptional; synchronized (idManager.dataStores) { sessionIdOptional = idManager .dataStores .stream() .map(AttributeSharingSessionDataStore::getSessionDataMap) .map(Map::entrySet) .flatMap(Collection::stream) .filter( e -> subjectName.equals( sessionSubjectExtractor.apply(e.getValue().getAllAttributes()))) .map(Map.Entry::getKey) .findFirst(); } sessionIdOptional.ifPresent(idManager::invalidateSession); }
Source:
public void processes(WebContext ctx) { ElasticQuery<Process> query = elastic.select(Process.class).orderDesc(Process.SCHEDULED); UserInfo user = UserContext.getCurrentUser(); if (!user.hasPermission(TenantUserManager.PERMISSION_SYSTEM_TENANT)) { query.eq(Process.TENANT_ID, user.getTenantId()); } if (!user.hasPermission(PERMISSION_MANAGE_PROCESSES)) { query.eq(Process.USER_ID, user.getUserId()); } ElasticPageHelper<Process> ph = ElasticPageHelper.withQuery(query); ph.withContext(ctx); ph.addTermAggregation(Process.STATE, ProcessState.class); ph.addTermAggregation(Process.PROCESS_TYPE, value -> NLS.getIfExists(value, NLS.getCurrentLang()).orElse(value)); ph.addTimeAggregation(Process.SCHEDULED, DateRange.lastFiveMinutes(), DateRange.lastFiveteenMinutes(), DateRange.lastTwoHours(), DateRange.today(), DateRange.yesterday(), DateRange.thisWeek(), DateRange.lastWeek()); ph.withSearchFields(QueryField.contains(ProcessLog.SEARCH_FIELD)); ctx.respondWith().template("templates/process/processes.html.pasta", ph.asPage()); }

Target:
public void processes(WebContext ctx) { ElasticQuery<Process> query = elastic.select(Process.class).orderDesc(Process.STARTED); UserInfo user = UserContext.getCurrentUser(); if (!user.hasPermission(PERMISSION_MANAGE_ALL_PROCESSES)) { query.eq(Process.TENANT_ID, user.getTenantId()); } if (!user.hasPermission(PERMISSION_MANAGE_PROCESSES)) { query.eq(Process.USER_ID, user.getUserId()); } query.where(Elastic.FILTERS.oneInField(Process.REQUIRED_PERMISSION, new ArrayList<>(user.getPermissions())) .orEmpty() .build()); ElasticPageHelper<Process> ph = ElasticPageHelper.withQuery(query); ph.withContext(ctx); ph.addTermAggregation(Process.STATE, ProcessState.class); ph.addTermAggregation(Process.PROCESS_TYPE, value -> NLS.getIfExists(value, null).orElse(value)); ph.addTimeAggregation(Process.STARTED, DateRange.lastFiveMinutes(), DateRange.lastFiveteenMinutes(), DateRange.lastTwoHours(), DateRange.today(), DateRange.yesterday(), DateRange.thisWeek(), DateRange.lastWeek()); ph.withSearchFields(QueryField.contains(ProcessLog.SEARCH_FIELD)); ctx.respondWith().template("templates/process/processes.html.pasta", ph.asPage()); }
Source:
public String addTenant(TenantInfoBean tenantInfoBean) throws Exception { try { CommonUtil.validateEmail(tenantInfoBean.getEmail()); } catch (Exception e) { String msg = "Invalid email is provided."; log.error(msg, e); throw new Exception(msg, e); } String tenantDomain = tenantInfoBean.getTenantDomain(); TenantMgtUtil.validateDomain(tenantDomain); checkIsSuperTenantInvoking(); TenantMgtUtil.setTenantAdminCreationOperation(true); Tenant tenant = TenantMgtUtil.initializeTenant(tenantInfoBean); TenantPersistor persistor = new TenantPersistor(); int tenantId = persistor.persistTenant(tenant, false, tenantInfoBean.getSuccessKey(), tenantInfoBean.getOriginatedService(),false); tenantInfoBean.setTenantId(tenantId); PrivilegedCarbonContext.startTenantFlow(); PrivilegedCarbonContext carbonContext = PrivilegedCarbonContext.getThreadLocalCarbonContext(); carbonContext.setTenantDomain(tenantDomain); carbonContext.setTenantId(tenantId); TenantMgtUtil.addClaimsToUserStoreManager(tenant); TenantMgtUtil.clearTenantAdminCreationOperation(); PrivilegedCarbonContext.endTenantFlow(); notifyTenantAddition(tenantInfoBean); TenantMgtUtil.activateTenantInitially(tenantInfoBean, tenantId); return TenantMgtUtil.prepareStringToShowThemeMgtPage(tenant.getId()); }

Target:
public String addTenant(TenantInfoBean tenantInfoBean) throws Exception { try { CommonUtil.validateEmail(tenantInfoBean.getEmail()); } catch (Exception e) { String msg = "Invalid email is provided."; log.error(msg, e); throw new Exception(msg, e); } String tenantDomain = tenantInfoBean.getTenantDomain(); TenantMgtUtil.validateDomain(tenantDomain); checkIsSuperTenantInvoking(); TenantMgtUtil.setTenantAdminCreationOperation(true); Tenant tenant = TenantMgtUtil.initializeTenant(tenantInfoBean); TenantPersistor persistor = new TenantPersistor(); int tenantId = persistor.persistTenant(tenant, false, tenantInfoBean.getSuccessKey(), tenantInfoBean.getOriginatedService(),false); tenantInfoBean.setTenantId(tenantId); try { PrivilegedCarbonContext.startTenantFlow(); PrivilegedCarbonContext carbonContext = PrivilegedCarbonContext.getThreadLocalCarbonContext(); carbonContext.setTenantDomain(tenantDomain); carbonContext.setTenantId(tenantId); TenantMgtUtil.addClaimsToUserStoreManager(tenant); } finally { TenantMgtUtil.clearTenantAdminCreationOperation(); PrivilegedCarbonContext.endTenantFlow(); } notifyTenantAddition(tenantInfoBean); TenantMgtUtil.activateTenantInitially(tenantInfoBean, tenantId); return TenantMgtUtil.prepareStringToShowThemeMgtPage(tenant.getId()); }
Source:
public void fromCallable() { Completable.fromCallable(new Callable<Object>() { @Override public Object call() throws Exception { return null; } }) .test() .assertResult(); }

Target:
public void fromCallable() { final AtomicInteger atomicInteger = new AtomicInteger(); Completable.fromCallable(new Callable<Object>() { @Override public Object call() throws Exception { atomicInteger.incrementAndGet(); return null; } }) .test() .assertResult(); assertEquals(1, atomicInteger.get()); }
Source:
private List<SubchainInfo> mockSnapshotList(List<DiskImage> snapshots, Version version) { mockCluster(version); configRule.mockConfigValue(ConfigValues.QemuimgCommitSupported, version); List<DiskImage> childSnapshots = createChildSnapshots(snapshots); when(diskImageDao.getAllSnapshotsForParents( snapshots .stream() .map(DiskImage::getImageId) .collect(Collectors.toList()) ) ).thenReturn(childSnapshots); return cmd.getAllDisksSnapshot(snapshots); }

Target:
private List<SubchainInfo> mockSnapshotList(List<DiskImage> snapshots, Version version) { mockCluster(version); configRule.mockConfigValue(ConfigValues.QemuimgCommitSupported, version); List<DiskImage> childSnapshots = createChildSnapshots(snapshots); when(diskImageDao.getAllSnapshotsForParents( snapshots .stream() .map(DiskImage::getImageId) .collect(Collectors.toList()) ) ).thenReturn(new HashSet<>(childSnapshots)); return cmd.getAllDisksSnapshot(snapshots); }
Source:
private void updateEnablement() { remove.setEnabled(editable && !tv.getStructuredSelection().isEmpty()); newValue.setEnabled(editable); }

Target:
private void updateEnablement() { remove.setEnabled(editable && !tv.getSelection().isEmpty()); newValue.setEnabled(editable); }
Source:
public SqlJsonTypeFunction() { super("JSON_TYPE", SqlKind.OTHER_FUNCTION, ReturnTypes.explicit(SqlTypeName.VARCHAR, 20), null, OperandTypes.VARIADIC, SqlFunctionCategory.SYSTEM); }

Target:
public SqlJsonTypeFunction() { super("JSON_TYPE", SqlKind.OTHER_FUNCTION, ReturnTypes.explicit(SqlTypeName.VARCHAR, 20), null, OperandTypes.ANY, SqlFunctionCategory.SYSTEM); }