idx int32 46 1.86M | input stringlengths 321 6.6k | target stringlengths 9 1.24k |
|---|---|---|
1,196,206 | protected Iterator<Map.Entry<Cell, byte[]>> computeNext() {<NEW_LINE>try {<NEW_LINE>if (lastBatchReached) {<NEW_LINE>return endOfData();<NEW_LINE>}<NEW_LINE>BatchSizeIncreasingIterator.BatchResult<Map.Entry<Cell, Value>> batchResult = batchIterator.getBatch();<NEW_LINE>Map<Cell, Value> raw = ImmutableMap.copyOf(batchResult.batch());<NEW_LINE>if (firstBatchReturned) {<NEW_LINE>batchValidationStep.run();<NEW_LINE>}<NEW_LINE>if (batchResult.isLastBatch()) {<NEW_LINE>lastBatchReached = true;<NEW_LINE>}<NEW_LINE>if (raw.isEmpty()) {<NEW_LINE>return Collections.emptyIterator();<NEW_LINE>}<NEW_LINE>SortedMap<Cell, byte[]> postFiltered = ImmutableSortedMap.copyOf(postFilterer.postFilter(raw));<NEW_LINE>batchIterator.markNumResultsNotDeleted(postFiltered.size());<NEW_LINE>return postFiltered<MASK><NEW_LINE>} finally {<NEW_LINE>firstBatchReturned = true;<NEW_LINE>}<NEW_LINE>} | .entrySet().iterator(); |
1,503,194 | private void recover(StartRecoveryRequest request, ActionListener<RecoveryResponse> listener) {<NEW_LINE>final IndexService indexService = indicesService.indexServiceSafe(request.shardId().getIndex());<NEW_LINE>final IndexShard shard = indexService.getShard(request.shardId().id());<NEW_LINE>final ShardRouting routingEntry = shard.routingEntry();<NEW_LINE>if (routingEntry.primary() == false || routingEntry.active() == false) {<NEW_LINE>throw new DelayRecoveryException("source shard [" + routingEntry + "] is not an active primary");<NEW_LINE>}<NEW_LINE>if (request.isPrimaryRelocation() && (routingEntry.relocating() == false || routingEntry.relocatingNodeId().equals(request.targetNode().getId()) == false)) {<NEW_LINE>logger.debug("delaying recovery of {} as source shard is not marked yet as relocating to {}", request.shardId(), request.targetNode());<NEW_LINE>throw new DelayRecoveryException("source shard is not marked yet as relocating to [" + <MASK><NEW_LINE>}<NEW_LINE>RecoverySourceHandler handler = ongoingRecoveries.addNewRecovery(request, shard);<NEW_LINE>logger.trace("[{}][{}] starting recovery to {}", request.shardId().getIndex().getName(), request.shardId().id(), request.targetNode());<NEW_LINE>handler.recoverToTarget(ActionListener.runAfter(listener, () -> ongoingRecoveries.remove(shard, handler)));<NEW_LINE>} | request.targetNode() + "]"); |
1,738,989 | public List<FileSystemAction> determineFileSystemActions(MemoryDatabase winnersDatabase, boolean cleanupOccurred, List<PartialFileHistory> localFileHistoriesWithLastVersion) throws Exception {<NEW_LINE>this.assembler = new Assembler(config, localDatabase, winnersDatabase);<NEW_LINE>List<FileSystemAction> fileSystemActions = new ArrayList<FileSystemAction>();<NEW_LINE>// Load file history cache<NEW_LINE>logger.<MASK><NEW_LINE>Map<FileHistoryId, FileVersion> localFileHistoryIdCache = fillFileHistoryIdCache(localFileHistoriesWithLastVersion);<NEW_LINE>logger.log(Level.INFO, "- Determine filesystem actions ...");<NEW_LINE>for (PartialFileHistory winningFileHistory : winnersDatabase.getFileHistories()) {<NEW_LINE>// Get remote file version and content<NEW_LINE>FileVersion winningLastVersion = winningFileHistory.getLastVersion();<NEW_LINE>File winningLastFile = new File(config.getLocalDir(), winningLastVersion.getPath());<NEW_LINE>// Get local file version and content<NEW_LINE>FileVersion localLastVersion = localFileHistoryIdCache.get(winningFileHistory.getFileHistoryId());<NEW_LINE>File localLastFile = (localLastVersion != null) ? new File(config.getLocalDir(), localLastVersion.getPath()) : null;<NEW_LINE>logger.log(Level.INFO, " + Comparing local version: " + localLastVersion);<NEW_LINE>logger.log(Level.INFO, " with winning version : " + winningLastVersion);<NEW_LINE>// Sync algorithm ////<NEW_LINE>// No local file version in local database<NEW_LINE>if (localLastVersion == null) {<NEW_LINE>determineActionNoLocalLastVersion(winningLastVersion, winningLastFile, winnersDatabase, fileSystemActions);<NEW_LINE>} else // Local version found in local database<NEW_LINE>{<NEW_LINE>FileVersionComparison localFileToVersionComparison = fileVersionComparator.compare(localLastVersion, localLastFile, true);<NEW_LINE>// Local file on disk as expected<NEW_LINE>if (localFileToVersionComparison.areEqual()) {<NEW_LINE>determineActionWithLocalVersionAndLocalFileAsExpected(winningLastVersion, winningLastFile, localLastVersion, localLastFile, winnersDatabase, fileSystemActions);<NEW_LINE>} else // Local file NOT what was expected<NEW_LINE>{<NEW_LINE>determineActionWithLocalVersionAndLocalFileDiffers(winningLastVersion, winningLastFile, localLastVersion, localLastFile, winnersDatabase, fileSystemActions, localFileToVersionComparison);<NEW_LINE>}<NEW_LINE>}<NEW_LINE>}<NEW_LINE>// Find file histories that are in the local database and not in the<NEW_LINE>// winner's database. They will be assumed to be deleted.<NEW_LINE>if (cleanupOccurred) {<NEW_LINE>logger.log(Level.INFO, "- Determine filesystem actions (for deleted histories in winner's branch)...");<NEW_LINE>Map<FileHistoryId, FileVersion> winnerFileHistoryIdCache = fillFileHistoryIdCache(winnersDatabase.getFileHistories());<NEW_LINE>for (PartialFileHistory localFileHistoryWithLastVersion : localFileHistoriesWithLastVersion) {<NEW_LINE>boolean localFileHistoryInWinnersDatabase = winnerFileHistoryIdCache.get(localFileHistoryWithLastVersion.getFileHistoryId()) != null;<NEW_LINE>// If the file history is also present in the winner's database, it<NEW_LINE>// has already been processed above. So we'll ignore it here.<NEW_LINE>if (!localFileHistoryInWinnersDatabase) {<NEW_LINE>FileVersion localLastVersion = localFileHistoryWithLastVersion.getLastVersion();<NEW_LINE>File localLastFile = (localLastVersion != null) ? new File(config.getLocalDir(), localLastVersion.getPath()) : null;<NEW_LINE>determineActionFileHistoryNotInWinnerBranch(localLastVersion, localLastFile, fileSystemActions);<NEW_LINE>}<NEW_LINE>}<NEW_LINE>}<NEW_LINE>return fileSystemActions;<NEW_LINE>} | log(Level.INFO, "- Loading current file tree..."); |
1,405,803 | public static void cancelNotification(Context context, String channelId, String rootId, Integer notificationId, Boolean isCRTEnabled) {<NEW_LINE>if (!android.text.TextUtils.isEmpty(channelId)) {<NEW_LINE>final String notificationIdStr = notificationId.toString();<NEW_LINE>final Boolean isThreadNotification = isCRTEnabled && !android.text.TextUtils.isEmpty(rootId);<NEW_LINE>final String groupId = isThreadNotification ? rootId : channelId;<NEW_LINE>Map<String, Map<String, JSONObject>> notificationsInChannel = loadNotificationsMap(context);<NEW_LINE>Map<String, JSONObject> notifications = notificationsInChannel.get(groupId);<NEW_LINE>if (notifications == null) {<NEW_LINE>return;<NEW_LINE>}<NEW_LINE>final NotificationManager notificationManager = context.getSystemService(NotificationManager.class);<NEW_LINE>notificationManager.cancel(notificationId);<NEW_LINE>notifications.remove(notificationIdStr);<NEW_LINE>final StatusBarNotification[<MASK><NEW_LINE>boolean hasMore = false;<NEW_LINE>for (final StatusBarNotification status : statusNotifications) {<NEW_LINE>Bundle bundle = status.getNotification().extras;<NEW_LINE>if (isThreadNotification) {<NEW_LINE>hasMore = bundle.getString("root_id").equals(rootId);<NEW_LINE>} else if (isCRTEnabled) {<NEW_LINE>hasMore = !bundle.getString("root_id").equals(rootId);<NEW_LINE>} else {<NEW_LINE>hasMore = bundle.getString("channel_id").equals(channelId);<NEW_LINE>}<NEW_LINE>if (hasMore) {<NEW_LINE>break;<NEW_LINE>}<NEW_LINE>}<NEW_LINE>if (!hasMore) {<NEW_LINE>notificationsInChannel.remove(groupId);<NEW_LINE>} else {<NEW_LINE>notificationsInChannel.put(groupId, notifications);<NEW_LINE>}<NEW_LINE>saveNotificationsMap(context, notificationsInChannel);<NEW_LINE>}<NEW_LINE>} | ] statusNotifications = notificationManager.getActiveNotifications(); |
1,806,499 | public void createCopyOnStack(Game game, Ability source, UUID newControllerId, boolean chooseNewTargets, int amount, StackObjectCopyApplier applier) {<NEW_LINE>GameEvent gameEvent = new CopyStackObjectEvent(source, this, newControllerId, amount);<NEW_LINE>if (game.replaceEvent(gameEvent)) {<NEW_LINE>return;<NEW_LINE>}<NEW_LINE>Iterator<MageObjectReferencePredicate> newTargetTypeIterator = new NewTargetTypeIterator(game, newControllerId, <MASK><NEW_LINE>for (int i = 0; i < gameEvent.getAmount(); i++) {<NEW_LINE>createSingleCopy(newControllerId, applier, newTargetTypeIterator.next(), game, source, chooseNewTargets);<NEW_LINE>}<NEW_LINE>Player player = game.getPlayer(newControllerId);<NEW_LINE>if (player == null) {<NEW_LINE>return;<NEW_LINE>}<NEW_LINE>game.informPlayers(player.getName() + " created " + CardUtil.numberToText(gameEvent.getAmount(), "a") + " cop" + (gameEvent.getAmount() == 1 ? "y" : "ies") + " of " + getIdName());<NEW_LINE>} | gameEvent.getAmount(), applier); |
1,553,892 | public void associateSoftwareToken(final String sessionToken, final RegisterMfaHandler callback) {<NEW_LINE>if (callback == null) {<NEW_LINE>throw new CognitoParameterInvalidException("callback is null");<NEW_LINE>}<NEW_LINE>final CognitoUser user = this;<NEW_LINE>boolean useSessionToken;<NEW_LINE>try {<NEW_LINE>final CognitoUserSession cognitoTokens = user.getCachedSession();<NEW_LINE>AssociateSoftwareTokenResult result;<NEW_LINE>if (!StringUtils.isBlank(sessionToken)) {<NEW_LINE>result = associateTotpMfaInternalWithSession(sessionToken);<NEW_LINE>useSessionToken = true;<NEW_LINE>} else {<NEW_LINE>result = associateTotpMfaInternalWithTokens(cognitoTokens);<NEW_LINE>useSessionToken = false;<NEW_LINE>}<NEW_LINE>final String nextSessionToken = result.getSession();<NEW_LINE>final Map<String, String> parameters = new <MASK><NEW_LINE>parameters.put("type", CognitoServiceConstants.CHLG_TYPE_SOFTWARE_TOKEN_MFA);<NEW_LINE>parameters.put("secretKey", result.getSecretCode());<NEW_LINE>callback.onVerify(new VerifyMfaContinuation(context, clientId, user, callback, parameters, useSessionToken, nextSessionToken, VerifyMfaContinuation.RUN_IN_CURRENT));<NEW_LINE>} catch (Exception e) {<NEW_LINE>callback.onFailure(e);<NEW_LINE>}<NEW_LINE>} | HashMap<String, String>(); |
267,044 | private static void solve() {<NEW_LINE>int base = 10;<NEW_LINE>Solver solver = new Solver("SendMoreMoney");<NEW_LINE>IntVar s = solver.makeIntVar(0, base - 1, "s");<NEW_LINE>IntVar e = solver.makeIntVar(0, base - 1, "e");<NEW_LINE>IntVar n = solver.makeIntVar(<MASK><NEW_LINE>IntVar d = solver.makeIntVar(0, base - 1, "d");<NEW_LINE>IntVar m = solver.makeIntVar(0, base - 1, "m");<NEW_LINE>IntVar o = solver.makeIntVar(0, base - 1, "o");<NEW_LINE>IntVar r = solver.makeIntVar(0, base - 1, "r");<NEW_LINE>IntVar y = solver.makeIntVar(0, base - 1, "y");<NEW_LINE>IntVar[] x = { s, e, n, d, m, o, r, y };<NEW_LINE>IntVar[] eq = { s, e, n, d, m, o, r, e, m, o, n, e, y };<NEW_LINE>int[] coeffs = { // S E N D +<NEW_LINE>1000, // S E N D +<NEW_LINE>100, // S E N D +<NEW_LINE>10, // M O R E<NEW_LINE>1, // M O R E<NEW_LINE>1000, // M O R E<NEW_LINE>100, // M O R E<NEW_LINE>10, // == M O N E Y<NEW_LINE>1, // == M O N E Y<NEW_LINE>-10000, // == M O N E Y<NEW_LINE>-1000, // == M O N E Y<NEW_LINE>-100, // == M O N E Y<NEW_LINE>-10, -1 };<NEW_LINE>solver.addConstraint(solver.makeScalProdEquality(eq, coeffs, 0));<NEW_LINE>// alternative:<NEW_LINE>solver.addConstraint(solver.makeScalProdEquality(new IntVar[] { s, e, n, d, m, o, r, e, m, o, n, e, y }, coeffs, 0));<NEW_LINE>// s > 0<NEW_LINE>solver.addConstraint(solver.makeGreater(s, 0));<NEW_LINE>// m > 0<NEW_LINE>solver.addConstraint(solver.makeGreater(m, 0));<NEW_LINE>solver.addConstraint(solver.makeAllDifferent(x));<NEW_LINE>DecisionBuilder db = solver.makePhase(x, solver.INT_VAR_DEFAULT, solver.INT_VALUE_DEFAULT);<NEW_LINE>solver.newSearch(db);<NEW_LINE>while (solver.nextSolution()) {<NEW_LINE>for (int i = 0; i < 8; i++) {<NEW_LINE>System.out.print(x[i].toString() + " ");<NEW_LINE>}<NEW_LINE>System.out.println();<NEW_LINE>}<NEW_LINE>solver.endSearch();<NEW_LINE>// Statistics<NEW_LINE>System.out.println();<NEW_LINE>System.out.println("Solutions: " + solver.solutions());<NEW_LINE>System.out.println("Failures: " + solver.failures());<NEW_LINE>System.out.println("Branches: " + solver.branches());<NEW_LINE>System.out.println("Wall time: " + solver.wallTime() + "ms");<NEW_LINE>} | 0, base - 1, "n"); |
1,423,857 | protected static OneResponse chmod(Client client, String method, int id, String octet) {<NEW_LINE>int owner_u = (Integer.parseInt(octet.substring(0, 1)) & 4) != 0 ? 1 : 0;<NEW_LINE>int owner_m = (Integer.parseInt(octet.substring(0, 1)) & 2) != 0 ? 1 : 0;<NEW_LINE>int owner_a = (Integer.parseInt(octet.substring(0, 1)) & <MASK><NEW_LINE>int group_u = (Integer.parseInt(octet.substring(1, 2)) & 4) != 0 ? 1 : 0;<NEW_LINE>int group_m = (Integer.parseInt(octet.substring(1, 2)) & 2) != 0 ? 1 : 0;<NEW_LINE>int group_a = (Integer.parseInt(octet.substring(1, 2)) & 1) != 0 ? 1 : 0;<NEW_LINE>int other_u = (Integer.parseInt(octet.substring(2, 3)) & 4) != 0 ? 1 : 0;<NEW_LINE>int other_m = (Integer.parseInt(octet.substring(2, 3)) & 2) != 0 ? 1 : 0;<NEW_LINE>int other_a = (Integer.parseInt(octet.substring(2, 3)) & 1) != 0 ? 1 : 0;<NEW_LINE>return chmod(client, method, id, owner_u, owner_m, owner_a, group_u, group_m, group_a, other_u, other_m, other_a);<NEW_LINE>} | 1) != 0 ? 1 : 0; |
803,064 | private int generateModulePackagesAttribute(char[][] packageNames) {<NEW_LINE>int localContentsOffset = this.contentsOffset;<NEW_LINE>int maxSize = 6 + 2 * packageNames.length;<NEW_LINE>if (localContentsOffset + maxSize >= this.contents.length) {<NEW_LINE>resizeContents(maxSize);<NEW_LINE>}<NEW_LINE>int moduleAttributeNameIndex = this.constantPool.literalIndex(AttributeNamesConstants.ModulePackages);<NEW_LINE>this.contents[localContentsOffset++] = (byte) (moduleAttributeNameIndex >> 8);<NEW_LINE>this.contents[localContentsOffset++] = (byte) moduleAttributeNameIndex;<NEW_LINE>int attrLengthOffset = localContentsOffset;<NEW_LINE>localContentsOffset += 4;<NEW_LINE>int packageCountOffset = localContentsOffset;<NEW_LINE>localContentsOffset += 2;<NEW_LINE>int packagesCount = 0;<NEW_LINE>for (char[] packageName : packageNames) {<NEW_LINE>if (packageName == null || packageName.length == 0)<NEW_LINE>continue;<NEW_LINE>int packageNameIndex = this.constantPool.literalIndexForPackage(packageName);<NEW_LINE>this.contents[localContentsOffset++] = (byte) (packageNameIndex >> 8);<NEW_LINE>this.contents[localContentsOffset++] = (byte) packageNameIndex;<NEW_LINE>packagesCount++;<NEW_LINE>}<NEW_LINE>this.contents[packageCountOffset++] = (<MASK><NEW_LINE>this.contents[packageCountOffset++] = (byte) packagesCount;<NEW_LINE>int attrLength = 2 + 2 * packagesCount;<NEW_LINE>this.contents[attrLengthOffset++] = (byte) (attrLength >> 24);<NEW_LINE>this.contents[attrLengthOffset++] = (byte) (attrLength >> 16);<NEW_LINE>this.contents[attrLengthOffset++] = (byte) (attrLength >> 8);<NEW_LINE>this.contents[attrLengthOffset++] = (byte) attrLength;<NEW_LINE>this.contentsOffset = localContentsOffset;<NEW_LINE>return 1;<NEW_LINE>} | byte) (packagesCount >> 8); |
394,514 | public synchronized void removeWorkersToMirrorMaker(InstanceTopicPartitionHolder controller, String pipeline, int routeId, int numWorkersToRemove) throws Exception {<NEW_LINE>LOGGER.info("Trying to remove {} workers in route: {}@{}", numWorkersToRemove, pipeline, routeId);<NEW_LINE>_lock.lock();<NEW_LINE>try {<NEW_LINE>List<String> instancesToRemove = new ArrayList<>();<NEW_LINE>Iterator<String> currWorkerIter = controller<MASK><NEW_LINE>int count = 0;<NEW_LINE>while (count < numWorkersToRemove && currWorkerIter.hasNext()) {<NEW_LINE>instancesToRemove.add(currWorkerIter.next());<NEW_LINE>count++;<NEW_LINE>}<NEW_LINE>LOGGER.info("Remove {} instance int route {}: {}", instancesToRemove.size(), pipeline + SEPARATOR + routeId, instancesToRemove);<NEW_LINE>_helixAdmin.setResourceIdealState(_helixClusterName, pipeline, IdealStateBuilder.shrinkInstanceCustomIdealStateFor(_helixAdmin.getResourceIdealState(_helixClusterName, pipeline), pipeline, String.valueOf(routeId), instancesToRemove, _conf.getMaxNumWorkersPerRoute()));<NEW_LINE>TopicPartition route = new TopicPartition(pipeline, routeId);<NEW_LINE>_routeToInstanceMap.putIfAbsent(route, new ArrayList<>());<NEW_LINE>_routeToInstanceMap.get(route).removeAll(instancesToRemove);<NEW_LINE>_availableWorkerList.addAll(instancesToRemove);<NEW_LINE>controller.removeWorkers(instancesToRemove);<NEW_LINE>} finally {<NEW_LINE>_lock.unlock();<NEW_LINE>}<NEW_LINE>} | .getWorkerSet().iterator(); |
945,311 | public void run(RegressionEnvironment env) {<NEW_LINE>RegressionPath path = new RegressionPath();<NEW_LINE>String createEpl = "@public create window MyWindow#keepall as select * from SupportBean";<NEW_LINE>if (indexShare) {<NEW_LINE>createEpl = "@Hint('enable_window_subquery_indexshare') " + createEpl;<NEW_LINE>}<NEW_LINE>env.compileDeploy(createEpl, path);<NEW_LINE>if (buildIndex) {<NEW_LINE>env.compileDeploy("create index idx1 on MyWindow(theString hash, intPrimitive btree)", path);<NEW_LINE>}<NEW_LINE>env.compileDeploy("insert into MyWindow select * from SupportBean", path);<NEW_LINE>// preload<NEW_LINE>for (int i = 0; i < 10000; i++) {<NEW_LINE>String theString = i < 5000 ? "A" : "B";<NEW_LINE>env.sendEventBean(new SupportBean(theString, i));<NEW_LINE>}<NEW_LINE>String[] fields = "cols.mini,cols.maxi".split(",");<NEW_LINE>String queryEpl = "@name('s0') select (select min(intPrimitive) as mini, max(intPrimitive) as maxi from MyWindow where theString = sbr.key and intPrimitive between sbr.rangeStart and sbr.rangeEnd) as cols from SupportBeanRange sbr";<NEW_LINE>env.compileDeploy(queryEpl, path).addListener("s0");<NEW_LINE>long startTime = System.currentTimeMillis();<NEW_LINE>for (int i = 0; i < 1000; i++) {<NEW_LINE>env.sendEventBean(new SupportBeanRange("R1"<MASK><NEW_LINE>env.assertPropsNew("s0", fields, new Object[] { 300, 312 });<NEW_LINE>}<NEW_LINE>long delta = System.currentTimeMillis() - startTime;<NEW_LINE>assertTrue("delta=" + delta, delta < 500);<NEW_LINE>env.undeployAll();<NEW_LINE>} | , "A", 300, 312)); |
988,572 | protected void onCreate(final Bundle savedInstanceState) {<NEW_LINE>super.onCreate(savedInstanceState);<NEW_LINE>setContentView(R.layout.street_view_panorama_options_demo);<NEW_LINE>streetNameCheckbox = findViewById(R.id.streetnames);<NEW_LINE>navigationCheckbox = findViewById(R.id.navigation);<NEW_LINE>zoomCheckbox = findViewById(R.id.zoom);<NEW_LINE>panningCheckbox = findViewById(R.id.panning);<NEW_LINE>outdoorCheckbox = findViewById(R.id.outdoor);<NEW_LINE>SupportStreetViewPanoramaFragment streetViewPanoramaFragment = (SupportStreetViewPanoramaFragment) getSupportFragmentManager().findFragmentById(R.id.streetviewpanorama);<NEW_LINE>streetViewPanoramaFragment.getStreetViewPanoramaAsync(panorama -> {<NEW_LINE>streetViewPanorama = panorama;<NEW_LINE>panorama.<MASK><NEW_LINE>panorama.setUserNavigationEnabled(navigationCheckbox.isChecked());<NEW_LINE>panorama.setZoomGesturesEnabled(zoomCheckbox.isChecked());<NEW_LINE>panorama.setPanningGesturesEnabled(panningCheckbox.isChecked());<NEW_LINE>// Only set the panorama to SAN_FRAN on startup (when no panoramas have been<NEW_LINE>// loaded which is when the savedInstanceState is null).<NEW_LINE>if (savedInstanceState == null) {<NEW_LINE>setPosition();<NEW_LINE>}<NEW_LINE>});<NEW_LINE>} | setStreetNamesEnabled(streetNameCheckbox.isChecked()); |
810,687 | protected void onPreExecute() {<NEW_LINE>super.onPreExecute();<NEW_LINE>mDrawerList = mainActivity.findViewById(R.id.drawer_nav_list);<NEW_LINE>LayoutInflater inflater = (LayoutInflater) mainActivity.getSystemService(Activity.LAYOUT_INFLATER_SERVICE);<NEW_LINE>settingsView = mainActivity.findViewById(R.id.settings_view);<NEW_LINE>// Settings view when categories are available<NEW_LINE>mDrawerCategoriesList = mainActivity.findViewById(R.id.drawer_tag_list);<NEW_LINE>if (mDrawerCategoriesList.getAdapter() == null && mDrawerCategoriesList.getFooterViewsCount() == 0) {<NEW_LINE>settingsViewCat = inflater.inflate(<MASK><NEW_LINE>mDrawerCategoriesList.addFooterView(settingsViewCat);<NEW_LINE>} else {<NEW_LINE>settingsViewCat = mDrawerCategoriesList.getChildAt(mDrawerCategoriesList.getChildCount() - 1);<NEW_LINE>}<NEW_LINE>} | R.layout.drawer_category_list_footer, null); |
873,637 | public void onClick(View v) {<NEW_LINE>// All spinner have to be initialised already<NEW_LINE>if (serverSpinner.getSelectedItem() == null) {<NEW_LINE>return;<NEW_LINE>}<NEW_LINE>if (filterSpinner.getSelectedItem() == null) {<NEW_LINE>return;<NEW_LINE>}<NEW_LINE>if (sortSpinner.getSelectedItem() == null) {<NEW_LINE>return;<NEW_LINE>}<NEW_LINE>// Store these user preferences<NEW_LINE>int server = ((ServerSetting) serverSpinner.getSelectedItem()).getOrder();<NEW_LINE>StatusType statusType = ((StatusTypeFilter) filterSpinner.getSelectedItem()).getStatusType();<NEW_LINE>TorrentsSortBy sortBy = ((SortByListItem) sortSpinner.getSelectedItem()).getSortBy();<NEW_LINE>boolean reverseSort = reverseorderCheckBox.isChecked();<NEW_LINE>boolean showstatus = showstatusCheckBox.isChecked();<NEW_LINE>boolean useDarkTheme = darkthemeCheckBox.isChecked();<NEW_LINE>ListWidgetConfig config = new ListWidgetConfig(server, statusType, sortBy, reverseSort, showstatus, useDarkTheme);<NEW_LINE>applicationSettings.setWidgetConfig(appWidgetId, config);<NEW_LINE>// Return the widget configuration result<NEW_LINE>AppWidgetManager manager = <MASK><NEW_LINE>manager.updateAppWidget(appWidgetId, ListWidgetProvider.buildRemoteViews(getApplicationContext(), appWidgetId, config));<NEW_LINE>manager.notifyAppWidgetViewDataChanged(appWidgetId, R.id.torrents_list);<NEW_LINE>setResult(RESULT_OK, new Intent().putExtra(AppWidgetManager.EXTRA_APPWIDGET_ID, appWidgetId));<NEW_LINE>finish();<NEW_LINE>} | AppWidgetManager.getInstance(ListWidgetConfigActivity.this); |
322,660 | private Section buildBasicProperties(OsAccount account) {<NEW_LINE>Section section = new Section(Bundle.OsAccountDataPanel_basic_title());<NEW_LINE>SectionData data = new SectionData();<NEW_LINE>Optional<String<MASK><NEW_LINE>data.addData(Bundle.OsAccountDataPanel_basic_login(), optional.isPresent() ? optional.get() : "");<NEW_LINE>optional = account.getFullName();<NEW_LINE>data.addData(Bundle.OsAccountDataPanel_basic_fullname(), optional.isPresent() ? optional.get() : "");<NEW_LINE>data.addData(Bundle.OsAccountDataPanel_basic_address(), account.getName() == null || account.getName().isEmpty() ? "" : account.getName());<NEW_LINE>data.addData(Bundle.OsAccountDataPanel_basic_type(), account.getOsAccountType().isPresent() ? account.getOsAccountType().get().getName() : "");<NEW_LINE>Optional<Long> crTime = account.getCreationTime();<NEW_LINE>data.addData(Bundle.OsAccountDataPanel_basic_creationDate(), crTime.isPresent() ? TimeZoneUtils.getFormattedTime(crTime.get()) : "");<NEW_LINE>data.addData(Bundle.OsAccountDataPanel_basic_objId(), Long.toString(account.getId()));<NEW_LINE>section.addSectionData(data);<NEW_LINE>return section;<NEW_LINE>} | > optional = account.getLoginName(); |
1,281,595 | public boolean performOk() {<NEW_LINE>DBPPreferenceStore store = DBWorkbench.getPlatform().getPreferenceStore();<NEW_LINE>store.setValue(NavigatorPreferences.NAVIGATOR_EXPAND_ON_CONNECT, expandOnConnectCheck.getSelection());<NEW_LINE>store.setValue(NavigatorPreferences.NAVIGATOR_RESTORE_FILTER, restoreFilterCheck.getSelection());<NEW_LINE>store.setValue(NavigatorPreferences.NAVIGATOR_RESTORE_STATE_DEPTH, restoreStateDepthText.getText());<NEW_LINE>store.setValue(NavigatorPreferences.<MASK><NEW_LINE>store.setValue(NavigatorPreferences.NAVIGATOR_SHOW_TOOLTIPS, showToolTipsCheck.getSelection());<NEW_LINE>store.setValue(NavigatorPreferences.NAVIGATOR_SHOW_CONTENTS_IN_TOOLTIP, showContentsInToolTipsContents.getSelection());<NEW_LINE>store.setValue(ModelPreferences.NAVIGATOR_SORT_ALPHABETICALLY, sortCaseInsensitiveCheck.getSelection());<NEW_LINE>store.setValue(ModelPreferences.NAVIGATOR_SORT_FOLDERS_FIRST, sortFoldersFirstCheck.getSelection());<NEW_LINE>store.setValue(NavigatorPreferences.NAVIGATOR_SHOW_CONNECTION_HOST_NAME, showConnectionHostCheck.getSelection());<NEW_LINE>store.setValue(NavigatorPreferences.NAVIGATOR_SHOW_OBJECTS_DESCRIPTION, showObjectsDescriptionCheck.getSelection());<NEW_LINE>store.setValue(NavigatorPreferences.NAVIGATOR_SHOW_STATISTICS_INFO, showStatisticsCheck.getSelection());<NEW_LINE>store.setValue(NavigatorPreferences.NAVIGATOR_SHOW_NODE_ACTIONS, showNodeActionsCheck.getSelection());<NEW_LINE>store.setValue(NavigatorPreferences.NAVIGATOR_COLOR_ALL_NODES, colorAllNodesCheck.getSelection());<NEW_LINE>store.setValue(ModelPreferences.NAVIGATOR_SHOW_FOLDER_PLACEHOLDERS, showResourceFolderPlaceholdersCheck.getSelection());<NEW_LINE>store.setValue(NavigatorPreferences.NAVIGATOR_GROUP_BY_DRIVER, groupByDriverCheck.getSelection());<NEW_LINE>store.setValue(NavigatorPreferences.NAVIGATOR_LONG_LIST_FETCH_SIZE, longListFetchSizeText.getText());<NEW_LINE>NavigatorPreferences.DoubleClickBehavior objDCB = NavigatorPreferences.DoubleClickBehavior.EXPAND;<NEW_LINE>if (objDoubleClickBehavior.getSelectionIndex() == 0) {<NEW_LINE>objDCB = NavigatorPreferences.DoubleClickBehavior.EDIT;<NEW_LINE>}<NEW_LINE>store.setValue(NavigatorPreferences.NAVIGATOR_OBJECT_DOUBLE_CLICK, objDCB.name());<NEW_LINE>store.setValue(NavigatorPreferences.NAVIGATOR_CONNECTION_DOUBLE_CLICK, CommonUtils.fromOrdinal(NavigatorPreferences.DoubleClickBehavior.class, dsDoubleClickBehavior.getSelectionIndex()).name());<NEW_LINE>List<EntityEditorDescriptor> entityEditors = getAvailableEditorPages();<NEW_LINE>int defEditorIndex = defaultEditorPageCombo.getSelectionIndex();<NEW_LINE>store.setValue(NavigatorPreferences.NAVIGATOR_DEFAULT_EDITOR_PAGE, defEditorIndex <= 0 ? "" : entityEditors.get(defEditorIndex - 1).getId());<NEW_LINE>PrefUtils.savePreferenceStore(store);<NEW_LINE>return true;<NEW_LINE>} | NAVIGATOR_SHOW_OBJECT_TIPS, showObjectTipsCheck.getSelection()); |
309,885 | public StartDeploymentResponse startDeployment(@NonNull final StartDeploymentRequest request) throws ResourceNotFoundException, InternalServiceException {<NEW_LINE>try {<NEW_LINE>final EnvironmentId environmentId = apiModelMapper.toModelEnvironmentId(request.getEnvironmentId());<NEW_LINE>final Environment environment = environmentRepository.getEnvironment(environmentId);<NEW_LINE>final EnvironmentRevision environmentRevision = environmentRepository.getEnvironmentRevision(environmentId, request.getEnvironmentRevisionId());<NEW_LINE>environment.setActiveEnvironmentRevisionId(environmentRevision.getEnvironmentRevisionId());<NEW_LINE>environmentRepository.updateEnvironment(environment);<NEW_LINE>// TODO: Create a new deployment<NEW_LINE>final String deploymentId = UUID.randomUUID().toString();<NEW_LINE>return StartDeploymentResponse.builder().environmentId(request.getEnvironmentId()).environmentRevisionId(request.getEnvironmentRevisionId()).deploymentId(deploymentId).build();<NEW_LINE>} catch (final ResourceNotFoundException | InternalServiceException e) {<NEW_LINE>log.error(e.getMessage(), e);<NEW_LINE>throw e;<NEW_LINE>} catch (final Exception e) {<NEW_LINE>log.error(e.getMessage(), e);<NEW_LINE>throw new InternalServiceException(<MASK><NEW_LINE>}<NEW_LINE>} | e.getMessage(), e); |
516,468 | void execute(@Nonnull AnActionEvent e, @Nonnull ExecutionEnvironment environment) {<NEW_LINE>MyRunProfile profile = getRunProfile(environment);<NEW_LINE>if (profile == null) {<NEW_LINE>return;<NEW_LINE>}<NEW_LINE>final ExecutionEnvironmentBuilder environmentBuilder = new ExecutionEnvironmentBuilder<MASK><NEW_LINE>final InputEvent event = e.getInputEvent();<NEW_LINE>if (!(event instanceof MouseEvent) || !event.isShiftDown()) {<NEW_LINE>performAction(environmentBuilder);<NEW_LINE>return;<NEW_LINE>}<NEW_LINE>final LinkedHashMap<Executor, ProgramRunner> availableRunners = new LinkedHashMap<Executor, ProgramRunner>();<NEW_LINE>for (Executor ex : new Executor[] { DefaultRunExecutor.getRunExecutorInstance(), DefaultDebugExecutor.getDebugExecutorInstance() }) {<NEW_LINE>final ProgramRunner runner = RunnerRegistry.getInstance().getRunner(ex.getId(), profile);<NEW_LINE>if (runner != null) {<NEW_LINE>availableRunners.put(ex, runner);<NEW_LINE>}<NEW_LINE>}<NEW_LINE>if (availableRunners.isEmpty()) {<NEW_LINE>LOG.error(environment.getExecutor().getActionName() + " is not available now");<NEW_LINE>} else if (availableRunners.size() == 1) {<NEW_LINE>// noinspection ConstantConditions<NEW_LINE>performAction(environmentBuilder.runner(availableRunners.get(environment.getExecutor())));<NEW_LINE>} else {<NEW_LINE>final JBList<Executor> list = new JBList<>(availableRunners.keySet());<NEW_LINE>list.setSelectionMode(ListSelectionModel.SINGLE_SELECTION);<NEW_LINE>list.setSelectedValue(environment.getExecutor(), true);<NEW_LINE>list.setCellRenderer(new ColoredListCellRenderer<Executor>() {<NEW_LINE><NEW_LINE>@Override<NEW_LINE>protected void customizeCellRenderer(@Nonnull JList<? extends Executor> list, Executor value, int index, boolean selected, boolean hasFocus) {<NEW_LINE>append(UIUtil.removeMnemonic(value.getStartActionText()));<NEW_LINE>setIcon(value.getIcon());<NEW_LINE>}<NEW_LINE>});<NEW_LINE>// noinspection ConstantConditions<NEW_LINE>JBPopupFactory.getInstance().createListPopupBuilder(list).setTitle("Restart Failed Tests").setMovable(false).setResizable(false).setRequestFocus(true).setItemChoosenCallback(new Runnable() {<NEW_LINE><NEW_LINE>@Override<NEW_LINE>public void run() {<NEW_LINE>final Object value = list.getSelectedValue();<NEW_LINE>if (value instanceof Executor) {<NEW_LINE>// noinspection ConstantConditions<NEW_LINE>performAction(environmentBuilder.runner(availableRunners.get(value)).executor((Executor) value));<NEW_LINE>}<NEW_LINE>}<NEW_LINE>}).createPopup().showUnderneathOf(event.getComponent());<NEW_LINE>}<NEW_LINE>} | (environment).runProfile(profile); |
726,837 | private QueryProfileType extendOrCreateQueryProfileType(String name, QueryProfileTypeRegistry registry) {<NEW_LINE>QueryProfileType type = null;<NEW_LINE>FieldDescription fieldDescription = getField(name);<NEW_LINE>if (fieldDescription != null) {<NEW_LINE>if (!(fieldDescription.getType() instanceof QueryProfileFieldType))<NEW_LINE>throw new IllegalArgumentException("Cannot use name '" + name + "' as a prefix because it is " + "already a " + fieldDescription.getType());<NEW_LINE>QueryProfileFieldType fieldType = (QueryProfileFieldType) fieldDescription.getType();<NEW_LINE>type = fieldType.getQueryProfileType();<NEW_LINE>}<NEW_LINE>if (type == null) {<NEW_LINE>type = registry.getComponent(name);<NEW_LINE>}<NEW_LINE>// found in registry but not already added in *this* type (getField also checks parents): extend it<NEW_LINE>if (type != null && !fields.containsKey(name)) {<NEW_LINE>type = new QueryProfileType(registry.createAnonymousId(type.getIdString()), new HashMap<>(), List.of(type));<NEW_LINE>}<NEW_LINE>if (type == null) {<NEW_LINE>// create it<NEW_LINE>type = new QueryProfileType<MASK><NEW_LINE>}<NEW_LINE>if (fieldDescription == null) {<NEW_LINE>fieldDescription = new FieldDescription(name, new QueryProfileFieldType(type));<NEW_LINE>} else {<NEW_LINE>fieldDescription = fieldDescription.withType(new QueryProfileFieldType(type));<NEW_LINE>}<NEW_LINE>registry.register(type);<NEW_LINE>fields.put(name, fieldDescription);<NEW_LINE>return type;<NEW_LINE>} | (registry.createAnonymousId(name)); |
944,552 | private void load() {<NEW_LINE>ExUtil.asyncRun(new Runnable() {<NEW_LINE><NEW_LINE>public void run() {<NEW_LINE>TcpProxy tcpProxy = TcpProxy.getTcpProxy(serverId);<NEW_LINE>try {<NEW_LINE>MapPack param = new MapPack();<NEW_LINE>param.put("objHash", objHash);<NEW_LINE>MapPack pack = (MapPack) tcpProxy.getSingle(RequestCmd.HOST_TOP, param);<NEW_LINE>if (pack == null)<NEW_LINE>return;<NEW_LINE>String error = pack.getText("error");<NEW_LINE>if (error != null) {<NEW_LINE>ConsoleProxy.errorSafe(error);<NEW_LINE>}<NEW_LINE>ListValue pidLv = pack.getList("PID");<NEW_LINE>ListValue userLv = pack.getList("USER");<NEW_LINE>ListValue cpuLv = pack.getList("CPU");<NEW_LINE>ListValue <MASK><NEW_LINE>ListValue timeLv = pack.getList("TIME");<NEW_LINE>ListValue nameLv = pack.getList("NAME");<NEW_LINE>procList = new ProcessObject[pidLv.size()];<NEW_LINE>for (int i = 0; i < pidLv.size(); i++) {<NEW_LINE>procList[i] = new ProcessObject();<NEW_LINE>procList[i].pid = (int) pidLv.getLong(i);<NEW_LINE>procList[i].user = userLv.getString(i);<NEW_LINE>procList[i].cpu = (float) cpuLv.getDouble(i);<NEW_LINE>procList[i].mem = memLv.getLong(i);<NEW_LINE>procList[i].time = timeLv.getLong(i);<NEW_LINE>procList[i].name = nameLv.getString(i);<NEW_LINE>}<NEW_LINE>ExUtil.exec(viewer.getTable(), new Runnable() {<NEW_LINE><NEW_LINE>public void run() {<NEW_LINE>viewer.setInput(procList);<NEW_LINE>}<NEW_LINE>});<NEW_LINE>} catch (Throwable th) {<NEW_LINE>th.printStackTrace();<NEW_LINE>} finally {<NEW_LINE>TcpProxy.putTcpProxy(tcpProxy);<NEW_LINE>}<NEW_LINE>}<NEW_LINE>});<NEW_LINE>} | memLv = pack.getList("MEM"); |
920,070 | public com.amazonaws.services.clouddirectory.model.DirectoryAlreadyExistsException unmarshallFromContext(JsonUnmarshallerContext context) throws Exception {<NEW_LINE>com.amazonaws.services.clouddirectory.model.DirectoryAlreadyExistsException directoryAlreadyExistsException = new com.amazonaws.services.<MASK><NEW_LINE>int originalDepth = context.getCurrentDepth();<NEW_LINE>String currentParentElement = context.getCurrentParentElement();<NEW_LINE>int targetDepth = originalDepth + 1;<NEW_LINE>JsonToken token = context.getCurrentToken();<NEW_LINE>if (token == null)<NEW_LINE>token = context.nextToken();<NEW_LINE>if (token == VALUE_NULL) {<NEW_LINE>return null;<NEW_LINE>}<NEW_LINE>while (true) {<NEW_LINE>if (token == null)<NEW_LINE>break;<NEW_LINE>if (token == FIELD_NAME || token == START_OBJECT) {<NEW_LINE>} else if (token == END_ARRAY || token == END_OBJECT) {<NEW_LINE>if (context.getLastParsedParentElement() == null || context.getLastParsedParentElement().equals(currentParentElement)) {<NEW_LINE>if (context.getCurrentDepth() <= originalDepth)<NEW_LINE>break;<NEW_LINE>}<NEW_LINE>}<NEW_LINE>token = context.nextToken();<NEW_LINE>}<NEW_LINE>return directoryAlreadyExistsException;<NEW_LINE>} | clouddirectory.model.DirectoryAlreadyExistsException(null); |
737,776 | public T await() {<NEW_LINE>final boolean[<MASK><NEW_LINE>final Object[] out = new Object[1];<NEW_LINE>final Throwable[] ex = new Throwable[1];<NEW_LINE>this.onSuccess(new SuccessCallback<T>() {<NEW_LINE><NEW_LINE>public void onSucess(T res) {<NEW_LINE>synchronized (complete) {<NEW_LINE>out[0] = res;<NEW_LINE>complete[0] = true;<NEW_LINE>complete.notifyAll();<NEW_LINE>}<NEW_LINE>}<NEW_LINE>}).onFail(new SuccessCallback() {<NEW_LINE><NEW_LINE>public void onSucess(Object res) {<NEW_LINE>synchronized (complete) {<NEW_LINE>ex[0] = (Throwable) res;<NEW_LINE>complete[0] = true;<NEW_LINE>complete.notifyAll();<NEW_LINE>}<NEW_LINE>}<NEW_LINE>});<NEW_LINE>while (!complete[0]) {<NEW_LINE>invokeAndBlock(new Runnable() {<NEW_LINE><NEW_LINE>public void run() {<NEW_LINE>synchronized (complete) {<NEW_LINE>Util.wait(complete, 500);<NEW_LINE>}<NEW_LINE>}<NEW_LINE>});<NEW_LINE>}<NEW_LINE>if (ex[0] != null) {<NEW_LINE>throw new AsyncResource.AsyncExecutionException((Throwable) ex[0]);<NEW_LINE>}<NEW_LINE>return (T) out[0];<NEW_LINE>} | ] complete = new boolean[1]; |
298,209 | private UpdateAspectResult ingestAspectToLocalDBNoTransaction(@Nonnull final Urn urn, @Nonnull final String aspectName, @Nonnull final Function<Optional<RecordTemplate>, RecordTemplate> updateLambda, @Nonnull final AuditStamp auditStamp, @Nonnull final SystemMetadata providedSystemMetadata, @Nullable final EbeanAspectV2 latest, @Nonnull final Long nextVersion) {<NEW_LINE>// 2. Compare the latest existing and new.<NEW_LINE>final RecordTemplate oldValue = latest == null ? null : toAspectRecord(urn, aspectName, latest.getMetadata(), getEntityRegistry());<NEW_LINE>final RecordTemplate newValue = updateLambda.apply(Optional.ofNullable(oldValue));<NEW_LINE>// 3. If there is no difference between existing and new, we just update<NEW_LINE>// the lastObserved in system metadata. RunId should stay as the original runId<NEW_LINE>if (oldValue != null && DataTemplateUtil.areEqual(oldValue, newValue)) {<NEW_LINE>SystemMetadata latestSystemMetadata = EbeanUtils.parseSystemMetadata(latest.getSystemMetadata());<NEW_LINE>latestSystemMetadata.setLastObserved(providedSystemMetadata.getLastObserved());<NEW_LINE>latest.setSystemMetadata(RecordUtils.toJsonString(latestSystemMetadata));<NEW_LINE>_entityDao.saveAspect(latest, false);<NEW_LINE>return new UpdateAspectResult(urn, oldValue, oldValue, EbeanUtils.parseSystemMetadata(latest.getSystemMetadata()), latestSystemMetadata, MetadataAuditOperation.UPDATE, 0);<NEW_LINE>}<NEW_LINE>// 4. Save the newValue as the latest version<NEW_LINE>log.debug("Ingesting aspect with name {}, urn {}", aspectName, urn);<NEW_LINE>long versionOfOld = _entityDao.saveLatestAspect(urn.toString(), aspectName, latest == null ? null : toJsonAspect(oldValue), latest == null ? null : latest.getCreatedBy(), latest == null ? null : latest.getCreatedFor(), latest == null ? null : latest.getCreatedOn(), latest == null ? null : latest.getSystemMetadata(), toJsonAspect(newValue), auditStamp.getActor().toString(), auditStamp.hasImpersonator() ? auditStamp.getImpersonator().toString() : null, new Timestamp(auditStamp.getTime())<MASK><NEW_LINE>return new UpdateAspectResult(urn, oldValue, newValue, latest == null ? null : EbeanUtils.parseSystemMetadata(latest.getSystemMetadata()), providedSystemMetadata, MetadataAuditOperation.UPDATE, versionOfOld);<NEW_LINE>} | , toJsonAspect(providedSystemMetadata), nextVersion); |
1,151,520 | protected void layoutChildren(final double x, final double y, final double w, final double h) {<NEW_LINE>final double height = getSkinnable().getHeight();<NEW_LINE>final Node leadingGraphic = ((JFXTextField) getSkinnable()).getLeadingGraphic();<NEW_LINE>final Node trailingGraphic = ((JFXTextField) getSkinnable()).getTrailingGraphic();<NEW_LINE>final double leadingW = leadingGraphic == null ? 0.0 : snapSize(leadingGraphic.prefWidth(height));<NEW_LINE>final double trailingW = trailingGraphic == null ? 0.0 : snapSize(trailingGraphic.prefWidth(height));<NEW_LINE>final double textX = snapPosition(x) + leadingW;<NEW_LINE>final double textW = w - snapSize(leadingW) - snapSize(trailingW);<NEW_LINE>super.layoutChildren(textX, y, textW, h);<NEW_LINE>linesWrapper.layoutLines(x, y, w, h, height, Math.floor(h));<NEW_LINE>linesWrapper.layoutPrompt(textX, y, textW, h);<NEW_LINE>errorContainer.layoutPane(x, height + linesWrapper.focusedLine.getHeight(), w, h);<NEW_LINE>// draw leading/trailing graphics<NEW_LINE>if (leadingGraphic != null) {<NEW_LINE>leadingGraphic.resizeRelocate(snappedLeftInset(<MASK><NEW_LINE>}<NEW_LINE>if (trailingGraphic != null) {<NEW_LINE>trailingGraphic.resizeRelocate(w - trailingW + snappedLeftInset(), 0, trailingW, height);<NEW_LINE>}<NEW_LINE>if (getSkinnable().getWidth() > 0) {<NEW_LINE>updateTextPos();<NEW_LINE>}<NEW_LINE>linesWrapper.updateLabelFloatLayout();<NEW_LINE>if (invalid) {<NEW_LINE>invalid = false;<NEW_LINE>// update validation container<NEW_LINE>errorContainer.invalid(w);<NEW_LINE>// focus<NEW_LINE>linesWrapper.invalid();<NEW_LINE>}<NEW_LINE>} | ), 0, leadingW, height); |
657,290 | protected void initInstallMethods(FrameOwner frameOwner, ScreenIntrospectionData screenIntrospectionData) {<NEW_LINE>List<AnnotatedMethod<Install>> installMethods = screenIntrospectionData.getInstallMethods();<NEW_LINE>for (AnnotatedMethod<Install> annotatedMethod : installMethods) {<NEW_LINE>Install annotation = annotatedMethod.getAnnotation();<NEW_LINE>Frame frame = UiControllerUtils.getFrame(frameOwner);<NEW_LINE>Object targetInstance = getInstallTargetInstance(frameOwner, annotation, frame);<NEW_LINE>if (targetInstance == null) {<NEW_LINE>if (annotation.required()) {<NEW_LINE>throw new DevelopmentException(String.format("Unable to find @Install target for method %s in %s", annotatedMethod.getMethod(), frameOwner.getClass()));<NEW_LINE>}<NEW_LINE>log.trace("Skip @Install method {} of {} : it is not required and target not found", annotatedMethod.getMethod().getName(), frameOwner.getClass());<NEW_LINE>continue;<NEW_LINE>}<NEW_LINE>Class<?> instanceClass = targetInstance.getClass();<NEW_LINE>Method installMethod = annotatedMethod.getMethod();<NEW_LINE>MethodHandle targetSetterMethod = getInstallTargetSetterMethod(annotation, frame, instanceClass, installMethod);<NEW_LINE>Class<?> targetParameterType = targetSetterMethod.type().parameterList().get(1);<NEW_LINE>Object handler = null;<NEW_LINE>if (targetInstance instanceof InstallTargetHandler) {<NEW_LINE>handler = ((InstallTargetHandler) targetInstance).createInstallHandler(targetParameterType, frameOwner, installMethod);<NEW_LINE>}<NEW_LINE>if (handler == null) {<NEW_LINE>handler = createInstallHandler(frameOwner, installMethod, targetParameterType);<NEW_LINE>}<NEW_LINE>try {<NEW_LINE>targetSetterMethod.invoke(targetInstance, handler);<NEW_LINE>} catch (Error e) {<NEW_LINE>throw e;<NEW_LINE>} catch (Throwable e) {<NEW_LINE>throw new <MASK><NEW_LINE>}<NEW_LINE>}<NEW_LINE>} | RuntimeException("Unable to set declarative @Install handler for " + installMethod, e); |
44,285 | public static // ugh these *Api types do not help one bit<NEW_LINE>DataBindingV2Provider // ugh these *Api types do not help one bit<NEW_LINE>createProvider(// ugh these *Api types do not help one bit<NEW_LINE>Artifact setterStoreFile, // ugh these *Api types do not help one bit<NEW_LINE>Artifact classInfoFile, // ugh these *Api types do not help one bit<NEW_LINE>Artifact brFile, // ugh these *Api types do not help one bit<NEW_LINE>String label, // ugh these *Api types do not help one bit<NEW_LINE>String javaPackage, Iterable<? extends DataBindingV2ProviderApi<Artifact>> databindingV2ProvidersInDeps, Iterable<? extends DataBindingV2ProviderApi<Artifact>> databindingV2ProvidersInExports) {<NEW_LINE>NestedSetBuilder<Artifact> setterStoreFiles = NestedSetBuilder.stableOrder();<NEW_LINE>if (setterStoreFile != null) {<NEW_LINE>setterStoreFiles.add(setterStoreFile);<NEW_LINE>}<NEW_LINE>NestedSetBuilder<Artifact> classInfoFiles = NestedSetBuilder.stableOrder();<NEW_LINE>if (classInfoFile != null) {<NEW_LINE>classInfoFiles.add(classInfoFile);<NEW_LINE>}<NEW_LINE>NestedSetBuilder<Artifact> brFiles = NestedSetBuilder.stableOrder();<NEW_LINE>if (brFile != null) {<NEW_LINE>brFiles.add(brFile);<NEW_LINE>}<NEW_LINE>NestedSetBuilder<LabelJavaPackagePair> transitiveLabelAndJavaPackages = NestedSetBuilder.stableOrder();<NEW_LINE>ImmutableList.Builder<LabelJavaPackagePair> labelAndJavaPackages = ImmutableList.builder();<NEW_LINE>if (label != null && javaPackage != null) {<NEW_LINE>LabelJavaPackagePair labelAndJavaPackage = new LabelJavaPackagePair(label, javaPackage);<NEW_LINE>labelAndJavaPackages.add(labelAndJavaPackage);<NEW_LINE>transitiveLabelAndJavaPackages.add(labelAndJavaPackage);<NEW_LINE>}<NEW_LINE>if (databindingV2ProvidersInDeps != null) {<NEW_LINE>for (DataBindingV2ProviderApi<Artifact> p : databindingV2ProvidersInDeps) {<NEW_LINE>DataBindingV2Provider provider = (DataBindingV2Provider) p;<NEW_LINE>brFiles.addTransitive(provider.getTransitiveBRFiles());<NEW_LINE>transitiveLabelAndJavaPackages.addTransitive(provider.getTransitiveLabelAndJavaPackages());<NEW_LINE>}<NEW_LINE>}<NEW_LINE>if (databindingV2ProvidersInExports != null) {<NEW_LINE>// Add all of the information from providers from exported targets, so that targets which<NEW_LINE>// depend on this target appear to depend on the exported targets.<NEW_LINE>for (DataBindingV2ProviderApi<Artifact> p : databindingV2ProvidersInExports) {<NEW_LINE>DataBindingV2Provider provider = (DataBindingV2Provider) p;<NEW_LINE>setterStoreFiles.addTransitive(provider.getSetterStores());<NEW_LINE>classInfoFiles.addTransitive(provider.getClassInfos());<NEW_LINE>brFiles.addTransitive(provider.getTransitiveBRFiles());<NEW_LINE>labelAndJavaPackages.<MASK><NEW_LINE>transitiveLabelAndJavaPackages.addTransitive(provider.getTransitiveLabelAndJavaPackages());<NEW_LINE>}<NEW_LINE>}<NEW_LINE>return new DataBindingV2Provider(classInfoFiles.build(), setterStoreFiles.build(), brFiles.build(), labelAndJavaPackages.build(), transitiveLabelAndJavaPackages.build());<NEW_LINE>} | addAll(provider.getLabelAndJavaPackages()); |
929,426 | Description unwrapArguments(String formatString, MethodInvocationTree tree, List<? extends ExpressionTree> arguments, VisitorState state) {<NEW_LINE>SuggestedFix.<MASK><NEW_LINE>int start = 0;<NEW_LINE>java.util.regex.Matcher matcher = PRINTF_TERM_CAPTURE_PATTERN.matcher(formatString);<NEW_LINE>StringBuilder sb = new StringBuilder();<NEW_LINE>int idx = 0;<NEW_LINE>boolean fixed = false;<NEW_LINE>// NOTE: Not only must we find() a next term, the match must start at our current position<NEW_LINE>// otherwise we can unexpectedly match things like "%%s" (by skipping the first '%').<NEW_LINE>while (matcher.find() && matcher.start() == start) {<NEW_LINE>String term = matcher.group(1);<NEW_LINE>// Validate the term (minus the leading '%').<NEW_LINE>if (!PRINTF_TERM_VALIDATION_PATTERN.matcher(term.substring(1)).matches()) {<NEW_LINE>return NO_MATCH;<NEW_LINE>}<NEW_LINE>if (term.equals("%n")) {<NEW_LINE>// Replace "%n" with "\n" everywhere (Flogger does not recognize %n and it's<NEW_LINE>// potentially confusing if people mistake it for a placeholder).<NEW_LINE>term = "\\n";<NEW_LINE>} else {<NEW_LINE>// Only unwrap existing printf parameters if the placeholder has no additional formatting.<NEW_LINE>if (term.length() == 2) {<NEW_LINE>ExpressionTree argument = arguments.get(idx);<NEW_LINE>char placeholder = term.charAt(1);<NEW_LINE>Parameter unwrapped = unwrap(argument, placeholder, state);<NEW_LINE>if (unwrapped != null) {<NEW_LINE>fix.replace(argument, unwrapped.source.get(state));<NEW_LINE>placeholder = firstNonNull(unwrapped.placeholder, 's');<NEW_LINE>if (placeholder == STRING_FORMAT) {<NEW_LINE>placeholder = inferFormatSpecifier(unwrapped.type, state);<NEW_LINE>}<NEW_LINE>term = "%" + placeholder;<NEW_LINE>fixed = true;<NEW_LINE>}<NEW_LINE>}<NEW_LINE>idx++;<NEW_LINE>}<NEW_LINE>sb.append(formatString, start, matcher.start(1)).append(term);<NEW_LINE>start = matcher.end(1);<NEW_LINE>}<NEW_LINE>sb.append(formatString, start, formatString.length());<NEW_LINE>if (!fixed) {<NEW_LINE>return NO_MATCH;<NEW_LINE>}<NEW_LINE>fix.replace(tree.getArguments().get(0), state.getConstantExpression(sb.toString()));<NEW_LINE>return describeMatch(tree, fix.build());<NEW_LINE>} | Builder fix = SuggestedFix.builder(); |
1,397,111 | public void run() {<NEW_LINE>mMotionLayout.setProgress(0);<NEW_LINE>updateItems();<NEW_LINE>mAdapter.onNewItem(mIndex);<NEW_LINE><MASK><NEW_LINE>if (mTouchUpMode == TOUCH_UP_CARRY_ON && velocity > mVelocityThreshold && mIndex < mAdapter.count() - 1) {<NEW_LINE>final float v = velocity * mDampening;<NEW_LINE>if (mIndex == 0 && mPreviousIndex > mIndex) {<NEW_LINE>// don't touch animate when reaching the first item<NEW_LINE>return;<NEW_LINE>}<NEW_LINE>if (mIndex == mAdapter.count() - 1 && mPreviousIndex < mIndex) {<NEW_LINE>// don't touch animate when reaching the last item<NEW_LINE>return;<NEW_LINE>}<NEW_LINE>mMotionLayout.post(new Runnable() {<NEW_LINE><NEW_LINE>@Override<NEW_LINE>public void run() {<NEW_LINE>mMotionLayout.touchAnimateTo(MotionLayout.TOUCH_UP_DECELERATE_AND_COMPLETE, 1, v);<NEW_LINE>}<NEW_LINE>});<NEW_LINE>}<NEW_LINE>} | float velocity = mMotionLayout.getVelocity(); |
168,078 | private static ByteBuf serializeProtobuf(MessageLite msg, ByteBufAllocator allocator) {<NEW_LINE>int size = msg.getSerializedSize();<NEW_LINE>// Protobuf serialization is the last step of the netty pipeline. We used to allocate<NEW_LINE>// a heap buffer while serializing and pass it down to netty library.<NEW_LINE>// In AbstractChannel#filterOutboundMessage(), netty copies that data to a direct buffer if<NEW_LINE>// it is currently in heap (otherwise skips it and uses it directly).<NEW_LINE>// Allocating a direct buffer reducing unncessary CPU cycles for buffer copies in BK client<NEW_LINE>// and also helps alleviate pressure off the GC, since there is less memory churn.<NEW_LINE>// Bookies aren't usually CPU bound. This change improves READ_ENTRY code paths by a small factor as well.<NEW_LINE>ByteBuf buf = <MASK><NEW_LINE>try {<NEW_LINE>msg.writeTo(CodedOutputStream.newInstance(buf.nioBuffer(buf.readerIndex(), size)));<NEW_LINE>} catch (IOException e) {<NEW_LINE>// This is in-memory serialization, should not fail<NEW_LINE>throw new RuntimeException(e);<NEW_LINE>}<NEW_LINE>// Advance writer idx<NEW_LINE>buf.writerIndex(buf.capacity());<NEW_LINE>return buf;<NEW_LINE>} | allocator.directBuffer(size, size); |
1,737,327 | public void run(ApplicationArguments applicationArguments) throws Exception {<NEW_LINE>String[] templates = { "Up and running with %s", "%s Basics", "%s for Beginners", "%s for Neckbeards", "Under the hood: %s", "Discovering %s", "A short guide to %s", "%s with Baeldung" };<NEW_LINE>String[] buzzWords = { "Spring REST Data", "Java 9", "Scala", "Groovy", "Hibernate", "Spring HATEOS", "The HAL Browser", "Spring webflux" };<NEW_LINE>String[] authorFirstName = { "John %s", "Steve %s", "Samantha %s", "Gale %s", "Tom %s" };<NEW_LINE>String[] authorLastName = { "Giles", "Gill", "Smith", "Armstrong" };<NEW_LINE>String[] blurbs = { "It was getting dark when the %s %s", "Scott was nearly there when he heard that a %s %s", "Diana was a lovable Java coder until the %s %s", "The gripping story of a small %s and the day it %s" };<NEW_LINE>String[] blublMiddles = { "distaster", "dog", "cat", "turtle", "hurricane" };<NEW_LINE>String[] end = { "hit the school", "memorised pi to 100 decimal places!", "became a world champion armwrestler", "became a Java REST master!!" };<NEW_LINE>Random random = new Random();<NEW_LINE>IntStream.range(0, 100).forEach(i -> {<NEW_LINE>String template = templates[i % templates.length];<NEW_LINE>String buzzword = buzzWords[i % buzzWords.length];<NEW_LINE>String blurbStart = blurbs[i % blurbs.length];<NEW_LINE>String middle = blublMiddles[i % blublMiddles.length];<NEW_LINE>String ending = end[i % end.length];<NEW_LINE>String blurb = String.<MASK><NEW_LINE>String firstName = authorFirstName[i % authorFirstName.length];<NEW_LINE>String lastname = authorLastName[i % authorLastName.length];<NEW_LINE>Book book = new Book(String.format(template, buzzword), String.format(firstName, lastname), blurb, random.nextInt(1000 - 200) + 200);<NEW_LINE>bookRepository.save(book);<NEW_LINE>System.out.println(book);<NEW_LINE>});<NEW_LINE>} | format(blurbStart, middle, ending); |
1,400,940 | private void initOptions(DefaultCodeFormatterOptions defaultCodeFormatterOptions, Map<String, String> options) {<NEW_LINE>if (options != null) {<NEW_LINE>this.originalOptions = new DefaultCodeFormatterOptions(options);<NEW_LINE>this.workingOptions = new DefaultCodeFormatterOptions(options);<NEW_LINE>this.oldCommentFormatOption = getOldCommentFormatOption(options);<NEW_LINE>String compilerSource = options.get(CompilerOptions.OPTION_Source);<NEW_LINE>this.sourceLevel = compilerSource != null ? compilerSource : CompilerOptions.getLatestVersion();<NEW_LINE>this.previewEnabled = JavaCore.ENABLED.equals(options.get(JavaCore.COMPILER_PB_ENABLE_PREVIEW_FEATURES));<NEW_LINE>} else {<NEW_LINE>Map<String, String> settings = DefaultCodeFormatterConstants.getJavaConventionsSettings();<NEW_LINE>this.originalOptions = new DefaultCodeFormatterOptions(settings);<NEW_LINE>this.workingOptions = new DefaultCodeFormatterOptions(settings);<NEW_LINE>this.oldCommentFormatOption = DefaultCodeFormatterConstants.TRUE;<NEW_LINE>this<MASK><NEW_LINE>}<NEW_LINE>if (defaultCodeFormatterOptions != null) {<NEW_LINE>this.originalOptions.set(defaultCodeFormatterOptions.getMap());<NEW_LINE>this.workingOptions.set(defaultCodeFormatterOptions.getMap());<NEW_LINE>}<NEW_LINE>} | .sourceLevel = CompilerOptions.getLatestVersion(); |
1,213,396 | public ThirdPartyFirewallPolicy unmarshall(JsonUnmarshallerContext context) throws Exception {<NEW_LINE>ThirdPartyFirewallPolicy thirdPartyFirewallPolicy = new ThirdPartyFirewallPolicy();<NEW_LINE><MASK><NEW_LINE>String currentParentElement = context.getCurrentParentElement();<NEW_LINE>int targetDepth = originalDepth + 1;<NEW_LINE>JsonToken token = context.getCurrentToken();<NEW_LINE>if (token == null)<NEW_LINE>token = context.nextToken();<NEW_LINE>if (token == VALUE_NULL) {<NEW_LINE>return null;<NEW_LINE>}<NEW_LINE>while (true) {<NEW_LINE>if (token == null)<NEW_LINE>break;<NEW_LINE>if (token == FIELD_NAME || token == START_OBJECT) {<NEW_LINE>if (context.testExpression("FirewallDeploymentModel", targetDepth)) {<NEW_LINE>context.nextToken();<NEW_LINE>thirdPartyFirewallPolicy.setFirewallDeploymentModel(context.getUnmarshaller(String.class).unmarshall(context));<NEW_LINE>}<NEW_LINE>} else if (token == END_ARRAY || token == END_OBJECT) {<NEW_LINE>if (context.getLastParsedParentElement() == null || context.getLastParsedParentElement().equals(currentParentElement)) {<NEW_LINE>if (context.getCurrentDepth() <= originalDepth)<NEW_LINE>break;<NEW_LINE>}<NEW_LINE>}<NEW_LINE>token = context.nextToken();<NEW_LINE>}<NEW_LINE>return thirdPartyFirewallPolicy;<NEW_LINE>} | int originalDepth = context.getCurrentDepth(); |
134,188 | public void initSubDevices() {<NEW_LINE>ModelFactory factory = ModelFactory.eINSTANCE;<NEW_LINE>ColorColor color = factory.createColorColor();<NEW_LINE>color.setUid(getUid());<NEW_LINE>String subIdColor = "color";<NEW_LINE>color.setSubId(subIdColor);<NEW_LINE>logger.debug("{} addSubDevice {}", LoggerConstants.TFINIT, subIdColor);<NEW_LINE>color.init();<NEW_LINE>color.setMbrick(this);<NEW_LINE>ColorColorTemperature temperature = factory.createColorColorTemperature();<NEW_LINE>temperature.setUid(getUid());<NEW_LINE>String subIdTemperature = "temperature";<NEW_LINE>temperature.setSubId(subIdTemperature);<NEW_LINE>logger.debug("{} addSubDevice {}", LoggerConstants.TFINIT, subIdTemperature);<NEW_LINE>temperature.init();<NEW_LINE>temperature.setMbrick(this);<NEW_LINE><MASK><NEW_LINE>illuminance.setUid(getUid());<NEW_LINE>String subIdIlluminance = "illuminance";<NEW_LINE>illuminance.setSubId(subIdIlluminance);<NEW_LINE>logger.debug("{} addSubDevice {}", LoggerConstants.TFINIT, subIdIlluminance);<NEW_LINE>illuminance.init();<NEW_LINE>illuminance.setMbrick(this);<NEW_LINE>ColorLed led = factory.createColorLed();<NEW_LINE>led.setUid(getUid());<NEW_LINE>String subIdLed = "led";<NEW_LINE>led.setSubId(subIdLed);<NEW_LINE>logger.debug("{} addSubDevice {}", LoggerConstants.TFINIT, subIdLed);<NEW_LINE>led.init();<NEW_LINE>led.setMbrick(this);<NEW_LINE>} | ColorIlluminance illuminance = factory.createColorIlluminance(); |
955,137 | public boolean isResponseForUnauthorizedRequest(HttpMessage message) {<NEW_LINE>// NOTE: In case nothing is configured, we default to "not match" when composition is "OR"<NEW_LINE>// and<NEW_LINE>// "matches" when composition is "AND" so not configuring<NEW_LINE>boolean statusCodeMatch = message.getResponseHeader().getStatusCode() == statusCode;<NEW_LINE>boolean headerMatch = headerPattern != null ? headerPattern.matcher(message.getResponseHeader().toString(<MASK><NEW_LINE>boolean bodyMatch = bodyPattern != null ? bodyPattern.matcher(message.getResponseBody().toString()).find() : false;<NEW_LINE>switch(logicalOperator) {<NEW_LINE>case AND:<NEW_LINE>// If nothing is set, we default to false so we get the expected behavior<NEW_LINE>if (statusCode == NO_STATUS_CODE && headerPattern == null && bodyPattern == null)<NEW_LINE>return false;<NEW_LINE>// All of them must match or not be set<NEW_LINE>return (statusCodeMatch || statusCode == NO_STATUS_CODE) && (headerPattern == null || headerMatch) && (bodyPattern == null || bodyMatch);<NEW_LINE>case OR:<NEW_LINE>// At least one of them must match<NEW_LINE>return statusCodeMatch || headerMatch || bodyMatch;<NEW_LINE>default:<NEW_LINE>return false;<NEW_LINE>}<NEW_LINE>} | )).find() : false; |
1,569,328 | // Initialize the list of Artifacts<NEW_LINE>@SuppressWarnings("deprecation")<NEW_LINE>private void initArtifactTypes() {<NEW_LINE>// only try to load existing artifact types if we are displaying case<NEW_LINE>// specific data, otherwise there may not be a case open.<NEW_LINE>if (!useCaseSpecificData) {<NEW_LINE>return;<NEW_LINE>}<NEW_LINE>try {<NEW_LINE>Case openCase = Case.getCurrentCaseThrows();<NEW_LINE>ArrayList<BlackboardArtifact.Type> doNotReport = new ArrayList<>();<NEW_LINE>doNotReport.add(new BlackboardArtifact.Type(BlackboardArtifact.ARTIFACT_TYPE.TSK_GEN_INFO));<NEW_LINE>// output is too unstructured for table review<NEW_LINE>doNotReport.add(new BlackboardArtifact.Type(BlackboardArtifact.ARTIFACT_TYPE.TSK_TOOL_OUTPUT));<NEW_LINE>doNotReport.add(new BlackboardArtifact.Type(BlackboardArtifact.ARTIFACT_TYPE.TSK_ASSOCIATED_OBJECT));<NEW_LINE>doNotReport.add(new BlackboardArtifact.Type<MASK><NEW_LINE>// get artifact types that exist in the current case<NEW_LINE>artifacts = openCase.getSleuthkitCase().getArtifactTypesInUse();<NEW_LINE>artifacts.removeAll(doNotReport);<NEW_LINE>artifactStates = new HashMap<>();<NEW_LINE>for (BlackboardArtifact.Type type : artifacts) {<NEW_LINE>artifactStates.put(type, Boolean.TRUE);<NEW_LINE>}<NEW_LINE>} catch (TskCoreException | NoCurrentCaseException ex) {<NEW_LINE>// NON-NLS<NEW_LINE>Logger.getLogger(ReportVisualPanel2.class.getName()).log(Level.SEVERE, "Error getting list of artifacts in use: " + ex.getLocalizedMessage(), ex);<NEW_LINE>}<NEW_LINE>} | (BlackboardArtifact.ARTIFACT_TYPE.TSK_TL_EVENT)); |
1,804,450 | protected void printBanner(boolean showResponderUrl) {<NEW_LINE>Set<String> uris <MASK><NEW_LINE>uris.add(caContainer.getAcmeDirectoryURI(false));<NEW_LINE>uris.add(caContainer.getAcmeDirectoryURI(true));<NEW_LINE>StringBuffer banner = new StringBuffer();<NEW_LINE>banner.append("\n\n\n");<NEW_LINE>banner.append("***********************************************************************\n");<NEW_LINE>banner.append("*\n");<NEW_LINE>banner.append("*\n");<NEW_LINE>banner.append("* ACME CA Server Directory URI(s):\n");<NEW_LINE>for (String uri : uris) {<NEW_LINE>banner.append("* " + uri + "\n");<NEW_LINE>}<NEW_LINE>if (showResponderUrl) {<NEW_LINE>banner.append("* ACME CA Server Ocsp Responder URI (for revocation checking): " + caContainer.getOcspResponderUrl() + "\n");<NEW_LINE>}<NEW_LINE>banner.append("* HTTP port: " + caContainer.getHttpPort() + "\n");<NEW_LINE>banner.append("*\n");<NEW_LINE>banner.append("*\n");<NEW_LINE>banner.append("***********************************************************************\n");<NEW_LINE>banner.append("\n\n\n");<NEW_LINE>banner.append("Use 'ctrl-c' to terminate execution...");<NEW_LINE>System.out.println(banner.toString());<NEW_LINE>System.out.flush();<NEW_LINE>} | = new HashSet<String>(); |
129,454 | private Map<String, List<BlackboardArtifact>> buildMap() throws TskCoreException, SQLException {<NEW_LINE>Map<String, List<BlackboardArtifact>> acctMap = new HashMap<>();<NEW_LINE>List<BlackboardArtifact> contactList = Case.getCurrentCase().getSleuthkitCase().<MASK><NEW_LINE>for (BlackboardArtifact contactArtifact : contactList) {<NEW_LINE>List<BlackboardAttribute> contactAttributes = contactArtifact.getAttributes();<NEW_LINE>for (BlackboardAttribute attribute : contactAttributes) {<NEW_LINE>String typeName = attribute.getAttributeType().getTypeName();<NEW_LINE>if (typeName.startsWith("TSK_EMAIL") || typeName.startsWith("TSK_PHONE") || typeName.startsWith("TSK_NAME") || typeName.startsWith("TSK_ID")) {<NEW_LINE>String accountID = attribute.getValueString();<NEW_LINE>List<BlackboardArtifact> artifactList = acctMap.get(accountID);<NEW_LINE>if (artifactList == null) {<NEW_LINE>artifactList = new ArrayList<>();<NEW_LINE>acctMap.put(accountID, artifactList);<NEW_LINE>}<NEW_LINE>if (!artifactList.contains(contactArtifact)) {<NEW_LINE>artifactList.add(contactArtifact);<NEW_LINE>}<NEW_LINE>}<NEW_LINE>}<NEW_LINE>}<NEW_LINE>return acctMap;<NEW_LINE>} | getBlackboardArtifacts(BlackboardArtifact.ARTIFACT_TYPE.TSK_CONTACT); |
376,870 | private int doRead(SegmentHandle handle, long offset, byte[] buffer, int bufferOffset, int length) throws IOException {<NEW_LINE>long traceId = LoggerHelpers.traceEnter(log, "read", handle.getSegmentName(), offset, bufferOffset, length);<NEW_LINE>Timer timer = new Timer();<NEW_LINE>Path path = getPath(handle.getSegmentName());<NEW_LINE>long fileSize = getFileSize(path);<NEW_LINE>if (fileSize < offset) {<NEW_LINE>throw new IllegalArgumentException(String.format("Reading at offset (%d) which is beyond the " + "current size of segment (%d).", offset, fileSize));<NEW_LINE>}<NEW_LINE>try (FileChannel channel = getFileChannel(path, StandardOpenOption.READ)) {<NEW_LINE>int totalBytesRead = 0;<NEW_LINE>long readOffset = offset;<NEW_LINE>do {<NEW_LINE>ByteBuffer readBuffer = ByteBuffer.<MASK><NEW_LINE>int bytesRead = channel.read(readBuffer, readOffset);<NEW_LINE>bufferOffset += bytesRead;<NEW_LINE>totalBytesRead += bytesRead;<NEW_LINE>length -= bytesRead;<NEW_LINE>readOffset += bytesRead;<NEW_LINE>} while (length != 0);<NEW_LINE>FileSystemMetrics.READ_LATENCY.reportSuccessEvent(timer.getElapsed());<NEW_LINE>FileSystemMetrics.READ_BYTES.add(totalBytesRead);<NEW_LINE>LoggerHelpers.traceLeave(log, "read", traceId, totalBytesRead);<NEW_LINE>return totalBytesRead;<NEW_LINE>}<NEW_LINE>} | wrap(buffer, bufferOffset, length); |
1,359,856 | private boolean sendWithRetries(final byte[] buffer, final int length, final int eventCount, boolean withTimeout) {<NEW_LINE>long deadLineMillis = System.<MASK><NEW_LINE>try {<NEW_LINE>RetryUtils.retry(new RetryUtils.Task<Object>() {<NEW_LINE><NEW_LINE>@Override<NEW_LINE>public Void perform() throws Exception {<NEW_LINE>send(buffer, length);<NEW_LINE>return null;<NEW_LINE>}<NEW_LINE>}, new Predicate<Throwable>() {<NEW_LINE><NEW_LINE>@Override<NEW_LINE>public boolean apply(Throwable e) {<NEW_LINE>if (withTimeout && deadLineMillis - System.currentTimeMillis() <= 0) {<NEW_LINE>// overflow-aware<NEW_LINE>return false;<NEW_LINE>}<NEW_LINE>if (e == timeoutLessThanMinimumException) {<NEW_LINE>// Doesn't make sense to retry, because the result will be the same.<NEW_LINE>return false;<NEW_LINE>}<NEW_LINE>return !(e instanceof InterruptedException);<NEW_LINE>}<NEW_LINE>}, MAX_SEND_RETRIES);<NEW_LINE>totalEmittedEvents.addAndGet(eventCount);<NEW_LINE>return true;<NEW_LINE>} catch (InterruptedException e) {<NEW_LINE>return false;<NEW_LINE>} catch (Exception e) {<NEW_LINE>if (e == timeoutLessThanMinimumException) {<NEW_LINE>log.debug(e, "Failed to send events to url[%s] with timeout less than minimum", config.getRecipientBaseUrl());<NEW_LINE>} else {<NEW_LINE>log.error(e, "Failed to send events to url[%s]", config.getRecipientBaseUrl());<NEW_LINE>}<NEW_LINE>return false;<NEW_LINE>}<NEW_LINE>} | currentTimeMillis() + computeTimeoutForSendRequestInMillis(lastBatchFillTimeMillis); |
323,039 | public int calculate(Game game, Ability sourceAbility, Effect effect) {<NEW_LINE>Player controller = game.getPlayer(sourceAbility.getControllerId());<NEW_LINE>if (controller == null) {<NEW_LINE>return 0;<NEW_LINE>}<NEW_LINE>Collection<ExileZone> exileZones = game.getState().getExile().getExileZones();<NEW_LINE>Cards cardsForetoldInExileZones = new CardsImpl();<NEW_LINE>FilterCard filter = new FilterCard();<NEW_LINE>filter.add(new OwnerIdPredicate<MASK><NEW_LINE>for (ExileZone exile : exileZones) {<NEW_LINE>for (Card card : exile.getCards(filter, game)) {<NEW_LINE>// verify that the card is actually Foretold<NEW_LINE>UUID exileId = CardUtil.getExileZoneId(card.getId().toString() + "foretellAbility", game);<NEW_LINE>if (exileId != null) {<NEW_LINE>if (game.getState().getExile().getExileZone(exileId) != null) {<NEW_LINE>cardsForetoldInExileZones.add(card);<NEW_LINE>}<NEW_LINE>}<NEW_LINE>}<NEW_LINE>}<NEW_LINE>return amount * cardsForetoldInExileZones.size();<NEW_LINE>} | (controller.getId())); |
163,994 | private void loadWindow() throws IOException {<NEW_LINE>List<MWindow> windowList = new Query(getCtx(), I_AD_Window.Table_Name, null, get_TrxName()).setOnlyActiveRecords(true).setClient_ID().list();<NEW_LINE>// Get Result<NEW_LINE>if (windowList == null || windowList.size() == 0) {<NEW_LINE>return;<NEW_LINE>}<NEW_LINE>String folderName = getDirectory() + File.separator + FunctionalDocsForWindow.FOLDER_NAME;<NEW_LINE>String fileName = textConverter.getIndexFileName();<NEW_LINE>if (!Util.isEmpty(fileName)) {<NEW_LINE>indexConverter.addHeaderIndexName(FunctionalDocsForWindow.FOLDER_NAME);<NEW_LINE>indexConverter.newLine();<NEW_LINE>indexConverter.addSection("Windows");<NEW_LINE>indexConverter.newLine();<NEW_LINE>((IIndex) indexConverter).addTreeDefinition(1, true);<NEW_LINE>((IIndex) indexConverter).addGroup(<MASK><NEW_LINE>}<NEW_LINE>//<NEW_LINE>for (MWindow window : windowList) {<NEW_LINE>// For Window<NEW_LINE>documentForWindow(window, folderName);<NEW_LINE>textConverter.clear();<NEW_LINE>}<NEW_LINE>if (!Util.isEmpty(fileName)) {<NEW_LINE>writeFile(folderName, fileName, indexConverter.toString());<NEW_LINE>}<NEW_LINE>// Clear<NEW_LINE>indexConverter.clear();<NEW_LINE>} | "Window", FunctionalDocsForProcess.FOLDER_NAME, 2); |
1,628,311 | private void initFunctionConsumerOrSupplierFromCatalog(Object targetContext) {<NEW_LINE>String name = resolveName(Function.class, targetContext);<NEW_LINE>this.function = this.catalog.<MASK><NEW_LINE>if (this.function != null) {<NEW_LINE>return;<NEW_LINE>}<NEW_LINE>name = resolveName(Consumer.class, targetContext);<NEW_LINE>this.consumer = this.catalog.lookup(Consumer.class, name);<NEW_LINE>if (this.consumer != null) {<NEW_LINE>return;<NEW_LINE>}<NEW_LINE>name = resolveName(Supplier.class, targetContext);<NEW_LINE>this.supplier = this.catalog.lookup(Supplier.class, name);<NEW_LINE>if (this.supplier != null) {<NEW_LINE>return;<NEW_LINE>}<NEW_LINE>if (this.catalog.size() >= 1 && this.catalog.size() <= 2) {<NEW_LINE>// we may have RoutingFunction function<NEW_LINE>String functionName = this.catalog.getNames(Function.class).stream().filter(n -> !n.equals(RoutingFunction.FUNCTION_NAME)).findFirst().orElseGet(() -> null);<NEW_LINE>if (functionName != null) {<NEW_LINE>this.function = this.catalog.lookup(Function.class, functionName);<NEW_LINE>return;<NEW_LINE>}<NEW_LINE>functionName = this.catalog.getNames(Supplier.class).stream().findFirst().orElseGet(() -> null);<NEW_LINE>if (functionName != null) {<NEW_LINE>this.supplier = this.catalog.lookup(Supplier.class, functionName);<NEW_LINE>return;<NEW_LINE>}<NEW_LINE>functionName = this.catalog.getNames(Consumer.class).stream().findFirst().orElseGet(() -> null);<NEW_LINE>if (functionName != null) {<NEW_LINE>this.consumer = this.catalog.lookup(Consumer.class, functionName);<NEW_LINE>return;<NEW_LINE>}<NEW_LINE>} else {<NEW_LINE>name = this.doResolveName(targetContext);<NEW_LINE>this.function = this.catalog.lookup(Function.class, name);<NEW_LINE>if (this.function != null) {<NEW_LINE>return;<NEW_LINE>}<NEW_LINE>this.consumer = this.catalog.lookup(Consumer.class, name);<NEW_LINE>if (this.consumer != null) {<NEW_LINE>return;<NEW_LINE>}<NEW_LINE>this.supplier = this.catalog.lookup(Supplier.class, name);<NEW_LINE>if (this.supplier != null) {<NEW_LINE>return;<NEW_LINE>}<NEW_LINE>}<NEW_LINE>} | lookup(Function.class, name); |
658,886 | private void loadWebInfMap(String webInfPath, List loadedLocations) {<NEW_LINE>// No need to search META-INF resources<NEW_LINE>if (ctxt != null) {<NEW_LINE>Set libSet = <MASK><NEW_LINE>if (libSet != null) {<NEW_LINE>Iterator it = libSet.iterator();<NEW_LINE>while (it.hasNext()) {<NEW_LINE>String resourcePath = (String) it.next();<NEW_LINE>loadWebInfMapHelper(resourcePath, loadedLocations);<NEW_LINE>}<NEW_LINE>}<NEW_LINE>} else {<NEW_LINE>boolean directory = false;<NEW_LINE>com.ibm.wsspi.adaptable.module.Entry entry = container.getEntry(webInfPath);<NEW_LINE>if (entry != null) {<NEW_LINE>Container subEntryContainer;<NEW_LINE>try {<NEW_LINE>subEntryContainer = entry.adapt(Container.class);<NEW_LINE>} catch (UnableToAdaptException e1) {<NEW_LINE>// TODO Auto-generated catch block<NEW_LINE>// Do you need FFDC here? Remember FFDC instrumentation and @FFDCIgnore<NEW_LINE>// https://websphere.pok.ibm.com/~liberty/secure/docs/dev/API/com.ibm.ws.ras/com/ibm/ws/ffdc/annotation/FFDCIgnore.html<NEW_LINE>return;<NEW_LINE>}<NEW_LINE>// Process if it's a directory. If webInfPath is a jar, it was already processed by loadTldsFromJar<NEW_LINE>if (subEntryContainer != null && entry.getSize() == 0 && !webInfPath.endsWith(".jar")) {<NEW_LINE>// PI83486<NEW_LINE>directory = true;<NEW_LINE>for (com.ibm.wsspi.adaptable.module.Entry subEntry : subEntryContainer) {<NEW_LINE>loadWebInfMap(subEntry.getPath(), loadedLocations);<NEW_LINE>}<NEW_LINE>}<NEW_LINE>if (!directory) {<NEW_LINE>String resourcePath = entry.getPath();<NEW_LINE>loadWebInfMapHelper(resourcePath, loadedLocations);<NEW_LINE>}<NEW_LINE>}<NEW_LINE>}<NEW_LINE>} | ctxt.getResourcePaths(webInfPath, false); |
215,844 | public Request<DeleteUserRequest> marshall(DeleteUserRequest deleteUserRequest) {<NEW_LINE>if (deleteUserRequest == null) {<NEW_LINE>throw new AmazonClientException("Invalid argument passed to marshall(DeleteUserRequest)");<NEW_LINE>}<NEW_LINE>Request<DeleteUserRequest> request = new DefaultRequest<MASK><NEW_LINE>String target = "AWSCognitoIdentityProviderService.DeleteUser";<NEW_LINE>request.addHeader("X-Amz-Target", target);<NEW_LINE>request.setHttpMethod(HttpMethodName.POST);<NEW_LINE>String uriResourcePath = "/";<NEW_LINE>request.setResourcePath(uriResourcePath);<NEW_LINE>try {<NEW_LINE>StringWriter stringWriter = new StringWriter();<NEW_LINE>AwsJsonWriter jsonWriter = JsonUtils.getJsonWriter(stringWriter);<NEW_LINE>jsonWriter.beginObject();<NEW_LINE>if (deleteUserRequest.getAccessToken() != null) {<NEW_LINE>String accessToken = deleteUserRequest.getAccessToken();<NEW_LINE>jsonWriter.name("AccessToken");<NEW_LINE>jsonWriter.value(accessToken);<NEW_LINE>}<NEW_LINE>jsonWriter.endObject();<NEW_LINE>jsonWriter.close();<NEW_LINE>String snippet = stringWriter.toString();<NEW_LINE>byte[] content = snippet.getBytes(UTF8);<NEW_LINE>request.setContent(new StringInputStream(snippet));<NEW_LINE>request.addHeader("Content-Length", Integer.toString(content.length));<NEW_LINE>} catch (Throwable t) {<NEW_LINE>throw new AmazonClientException("Unable to marshall request to JSON: " + t.getMessage(), t);<NEW_LINE>}<NEW_LINE>if (!request.getHeaders().containsKey("Content-Type")) {<NEW_LINE>request.addHeader("Content-Type", "application/x-amz-json-1.1");<NEW_LINE>}<NEW_LINE>return request;<NEW_LINE>} | <DeleteUserRequest>(deleteUserRequest, "AmazonCognitoIdentityProvider"); |
188,371 | public void testRollbackLocalTransaction_B(HttpServletRequest request, HttpServletResponse response) throws Exception {<NEW_LINE>boolean testFailed = false;<NEW_LINE>try {<NEW_LINE>JMSContext jmsContextQCFBindings = qcfBindings.createContext(Session.SESSION_TRANSACTED);<NEW_LINE>emptyQueue(qcfBindings, queue);<NEW_LINE>Message message = jmsContextQCFBindings.createTextMessage("Hello World");<NEW_LINE>JMSProducer jmsProducerQCFBindings = jmsContextQCFBindings.createProducer();<NEW_LINE>jmsProducerQCFBindings.send(queue, message);<NEW_LINE>jmsContextQCFBindings.commit();<NEW_LINE>QueueBrowser qb = jmsContextQCFBindings.createBrowser(queue);<NEW_LINE>Enumeration<?> e = qb.getEnumeration();<NEW_LINE>int numMsgs = 0;<NEW_LINE>while (e.hasMoreElements()) {<NEW_LINE>TextMessage message1 = (TextMessage) e.nextElement();<NEW_LINE>numMsgs++;<NEW_LINE>}<NEW_LINE>JMSConsumer jmsConsumerQCFBindings = jmsContextQCFBindings.createConsumer(queue);<NEW_LINE>TextMessage rmsg = (TextMessage) jmsConsumerQCFBindings.receive(30000);<NEW_LINE>QueueBrowser qb1 = jmsContextQCFBindings.createBrowser(queue);<NEW_LINE>Enumeration<?> e1 = qb1.getEnumeration();<NEW_LINE>int numMsgs1 = 0;<NEW_LINE>while (e1.hasMoreElements()) {<NEW_LINE>TextMessage message1 = <MASK><NEW_LINE>numMsgs1++;<NEW_LINE>}<NEW_LINE>jmsContextQCFBindings.rollback();<NEW_LINE>QueueBrowser qb2 = jmsContextQCFBindings.createBrowser(queue);<NEW_LINE>Enumeration<?> e2 = qb2.getEnumeration();<NEW_LINE>int numMsgs2 = 0;<NEW_LINE>while (e2.hasMoreElements()) {<NEW_LINE>TextMessage message1 = (TextMessage) e2.nextElement();<NEW_LINE>numMsgs2++;<NEW_LINE>}<NEW_LINE>jmsConsumerQCFBindings.close();<NEW_LINE>jmsContextQCFBindings.close();<NEW_LINE>} catch (Exception e) {<NEW_LINE>e.printStackTrace();<NEW_LINE>testFailed = true;<NEW_LINE>}<NEW_LINE>if (testFailed) {<NEW_LINE>throw new Exception("testRollbackLocalTransaction_B failed");<NEW_LINE>}<NEW_LINE>} | (TextMessage) e1.nextElement(); |
1,380,316 | // From Main Presentation Part<NEW_LINE>public static List<Style> generateWordStylesFromPresentationPart(CTTextListStyle textStyles, String suffix, FontScheme fontScheme) {<NEW_LINE>List<Style> styles = new ArrayList<Style>();<NEW_LINE>if (textStyles == null)<NEW_LINE>return styles;<NEW_LINE>styles.add(TextStyles.convertToWordStyle(textStyles.getLvl1PPr(), "Lvl1" + suffix, "Lvl1" + suffix, "DocDefaults", fontScheme));<NEW_LINE>styles.add(TextStyles.convertToWordStyle(textStyles.getLvl2PPr(), "Lvl2" + suffix, "Lvl2" + suffix, "DocDefaults", fontScheme));<NEW_LINE>styles.add(TextStyles.convertToWordStyle(textStyles.getLvl3PPr(), "Lvl3" + suffix, "Lvl3" + suffix, "DocDefaults", fontScheme));<NEW_LINE>styles.add(TextStyles.convertToWordStyle(textStyles.getLvl4PPr(), "Lvl4" + suffix, "Lvl4" <MASK><NEW_LINE>styles.add(TextStyles.convertToWordStyle(textStyles.getLvl5PPr(), "Lvl5" + suffix, "Lvl5" + suffix, "DocDefaults", fontScheme));<NEW_LINE>styles.add(TextStyles.convertToWordStyle(textStyles.getLvl6PPr(), "Lvl6" + suffix, "Lvl6" + suffix, "DocDefaults", fontScheme));<NEW_LINE>styles.add(TextStyles.convertToWordStyle(textStyles.getLvl7PPr(), "Lvl7" + suffix, "Lvl7" + suffix, "DocDefaults", fontScheme));<NEW_LINE>styles.add(TextStyles.convertToWordStyle(textStyles.getLvl8PPr(), "Lvl8" + suffix, "Lvl8" + suffix, "DocDefaults", fontScheme));<NEW_LINE>styles.add(TextStyles.convertToWordStyle(textStyles.getLvl9PPr(), "Lvl9" + suffix, "Lvl9" + suffix, "DocDefaults", fontScheme));<NEW_LINE>return styles;<NEW_LINE>} | + suffix, "DocDefaults", fontScheme)); |
237,299 | private void promoteSystemProperties() throws TransactionFailure {<NEW_LINE>ConfigSupport.apply(new SingleConfigCode<JavaConfig>() {<NEW_LINE><NEW_LINE>@Override<NEW_LINE>public Object run(JavaConfig param) throws PropertyVetoException, TransactionFailure {<NEW_LINE>final List<String> props = new ArrayList<String>(param.getJvmRawOptions());<NEW_LINE>final Iterator<String<MASK><NEW_LINE>while (iterator.hasNext()) {<NEW_LINE>String prop = new MiniXmlParser.JvmOption(iterator.next()).option;<NEW_LINE>if (prop.startsWith("-D")) {<NEW_LINE>final String[] parts = prop.split("=");<NEW_LINE>String name = parts[0].substring(2);<NEW_LINE>if (SSL_CONFIGURATION_WANTAUTH.equals(name) || SSL_CONFIGURATION_SSLIMPL.equals(name)) {<NEW_LINE>iterator.remove();<NEW_LINE>updateSsl(name, parts[1]);<NEW_LINE>}<NEW_LINE>if ("com.sun.grizzly.maxTransactionTimeout".equals(name)) {<NEW_LINE>iterator.remove();<NEW_LINE>updateHttp(parts[1]);<NEW_LINE>}<NEW_LINE>}<NEW_LINE>}<NEW_LINE>param.setJvmOptions(props);<NEW_LINE>return param;<NEW_LINE>}<NEW_LINE>}, habitat.<JavaConfig>getService(JavaConfig.class));<NEW_LINE>} | > iterator = props.iterator(); |
1,377,202 | public static ValidationResult validate(@Nullable MethodSymbol formatMethodSymbol, Collection<? extends ExpressionTree> arguments, VisitorState state) {<NEW_LINE>Preconditions.checkArgument(!arguments.<MASK><NEW_LINE>Deque<ExpressionTree> args = new ArrayDeque<>(arguments);<NEW_LINE>Stream<String> formatStrings = constValues(args.removeFirst());<NEW_LINE>if (formatStrings == null) {<NEW_LINE>return null;<NEW_LINE>}<NEW_LINE>// If the only argument is an Object[], it's an explicit varargs call.<NEW_LINE>// Bail out, since we don't know what the actual argument types are.<NEW_LINE>if (args.size() == 1 && (formatMethodSymbol == null || formatMethodSymbol.isVarArgs())) {<NEW_LINE>Type type = ASTHelpers.getType(Iterables.getOnlyElement(args));<NEW_LINE>if (type instanceof Type.ArrayType && ASTHelpers.isSameType(((Type.ArrayType) type).elemtype, state.getSymtab().objectType, state)) {<NEW_LINE>return null;<NEW_LINE>}<NEW_LINE>}<NEW_LINE>Object[] instances = args.stream().map((ExpressionTree input) -> {<NEW_LINE>try {<NEW_LINE>return getInstance(input, state);<NEW_LINE>} catch (RuntimeException t) {<NEW_LINE>// ignore symbol completion failures<NEW_LINE>return null;<NEW_LINE>}<NEW_LINE>}).toArray();<NEW_LINE>return formatStrings.map(formatString -> validate(formatString, instances)).filter(x -> x != null).findFirst().orElse(null);<NEW_LINE>} | isEmpty(), "A format method should have one or more arguments, but method (%s) has zero arguments.", formatMethodSymbol); |
1,209,322 | private static ErrorCode isCredentialProofValid(Map<String, String> proof) {<NEW_LINE>if (proof == null) {<NEW_LINE>return ErrorCode.ILLEGAL_INPUT;<NEW_LINE>}<NEW_LINE>String type = proof.get(ParamKeyConstant.PROOF_TYPE);<NEW_LINE>if (!isCredentialProofTypeValid(type)) {<NEW_LINE>return ErrorCode.CREDENTIAL_SIGNATURE_TYPE_ILLEGAL;<NEW_LINE>}<NEW_LINE>// Created is not obligatory<NEW_LINE>Long created = Long.valueOf(proof.get(ParamKeyConstant.PROOF_CREATED));<NEW_LINE>if (created.longValue() <= 0) {<NEW_LINE>return ErrorCode.CREDENTIAL_ISSUANCE_DATE_ILLEGAL;<NEW_LINE>}<NEW_LINE>// Creator is not obligatory either<NEW_LINE>String creator = <MASK><NEW_LINE>if (!StringUtils.isEmpty(creator) && !WeIdUtils.isWeIdValid(creator)) {<NEW_LINE>return ErrorCode.CREDENTIAL_ISSUER_INVALID;<NEW_LINE>}<NEW_LINE>// If the Proof type is ECDSA or other signature based scheme, check signature<NEW_LINE>if (type.equalsIgnoreCase(CredentialProofType.ECDSA.getTypeName())) {<NEW_LINE>String signature = proof.get(ParamKeyConstant.CREDENTIAL_SIGNATURE);<NEW_LINE>if (StringUtils.isEmpty(signature) || !DataToolUtils.isValidBase64String(signature)) {<NEW_LINE>return ErrorCode.CREDENTIAL_SIGNATURE_BROKEN;<NEW_LINE>}<NEW_LINE>}<NEW_LINE>return ErrorCode.SUCCESS;<NEW_LINE>} | proof.get(ParamKeyConstant.PROOF_CREATOR); |
1,141,692 | public void newStreamWithData() throws Exception {<NEW_LINE>HTTP2Client http2Client = new HTTP2Client();<NEW_LINE>http2Client.start();<NEW_LINE>// tag::newStreamWithData[]<NEW_LINE>SocketAddress serverAddress <MASK><NEW_LINE>CompletableFuture<Session> sessionCF = http2Client.connect(serverAddress, new Session.Listener.Adapter());<NEW_LINE>Session session = sessionCF.get();<NEW_LINE>// Configure the request headers.<NEW_LINE>HttpFields requestHeaders = HttpFields.build().put(HttpHeader.CONTENT_TYPE, "application/json");<NEW_LINE>// The request metadata with method, URI and headers.<NEW_LINE>MetaData.Request request = new MetaData.Request("POST", HttpURI.from("http://localhost:8080/path"), HttpVersion.HTTP_2, requestHeaders);<NEW_LINE>// The HTTP/2 HEADERS frame, with endStream=false to<NEW_LINE>// signal that there will be more frames in this stream.<NEW_LINE>HeadersFrame headersFrame = new HeadersFrame(request, null, false);<NEW_LINE>// Open a Stream by sending the HEADERS frame.<NEW_LINE>CompletableFuture<Stream> streamCF = session.newStream(headersFrame, new Stream.Listener.Adapter());<NEW_LINE>// Block to obtain the Stream.<NEW_LINE>// Alternatively you can use the CompletableFuture APIs to avoid blocking.<NEW_LINE>Stream stream = streamCF.get();<NEW_LINE>// The request content, in two chunks.<NEW_LINE>String content1 = "{\"greet\": \"hello world\"}";<NEW_LINE>ByteBuffer buffer1 = StandardCharsets.UTF_8.encode(content1);<NEW_LINE>String content2 = "{\"user\": \"jetty\"}";<NEW_LINE>ByteBuffer buffer2 = StandardCharsets.UTF_8.encode(content2);<NEW_LINE>// Send the first DATA frame on the stream, with endStream=false<NEW_LINE>// to signal that there are more frames in this stream.<NEW_LINE>CompletableFuture<Stream> dataCF1 = stream.data(new DataFrame(stream.getId(), buffer1, false));<NEW_LINE>// Only when the first chunk has been sent we can send the second,<NEW_LINE>// with endStream=true to signal that there are no more frames.<NEW_LINE>dataCF1.thenCompose(s -> s.data(new DataFrame(s.getId(), buffer2, true)));<NEW_LINE>// end::newStreamWithData[]<NEW_LINE>} | = new InetSocketAddress("localhost", 8080); |
368,516 | private Polygon bufferConvexPath_(MultiPath src, int ipath) {<NEW_LINE>generateCircleTemplate_();<NEW_LINE>Polygon resultPolygon = new Polygon(src.getDescription());<NEW_LINE>MultiPathImpl result_mp = (MultiPathImpl) resultPolygon._getImpl();<NEW_LINE>// resultPolygon.reserve((m_circle_template.size() / 10 + 4) *<NEW_LINE>// src.getPathSize(ipath));<NEW_LINE>Point2D pt_1_tmp = new Point2D(), pt_1 = new Point2D();<NEW_LINE>Point2D pt_2_tmp = new Point2D(), pt_2 = new Point2D();<NEW_LINE>Point2D pt_3_tmp = new Point2D(), pt_3 = new Point2D();<NEW_LINE>Point2D v_1 = new Point2D();<NEW_LINE>Point2D v_2 = new Point2D();<NEW_LINE>MultiPathImpl src_mp = <MASK><NEW_LINE>int path_size = src.getPathSize(ipath);<NEW_LINE>int path_start = src.getPathStart(ipath);<NEW_LINE>for (int i = 0, n = src.getPathSize(ipath); i < n; i++) {<NEW_LINE>src_mp.getXY(path_start + i, pt_1);<NEW_LINE>src_mp.getXY(path_start + (i + 1) % path_size, pt_2);<NEW_LINE>src_mp.getXY(path_start + (i + 2) % path_size, pt_3);<NEW_LINE>v_1.sub(pt_2, pt_1);<NEW_LINE>if (v_1.length() == 0)<NEW_LINE>throw GeometryException.GeometryInternalError();<NEW_LINE>v_1.leftPerpendicular();<NEW_LINE>v_1.normalize();<NEW_LINE>v_1.scale(m_abs_distance);<NEW_LINE>pt_1_tmp.add(v_1, pt_1);<NEW_LINE>pt_2_tmp.add(v_1, pt_2);<NEW_LINE>if (i == 0)<NEW_LINE>result_mp.startPath(pt_1_tmp);<NEW_LINE>else {<NEW_LINE>result_mp.lineTo(pt_1_tmp);<NEW_LINE>}<NEW_LINE>result_mp.lineTo(pt_2_tmp);<NEW_LINE>v_2.sub(pt_3, pt_2);<NEW_LINE>if (v_2.length() == 0)<NEW_LINE>throw GeometryException.GeometryInternalError();<NEW_LINE>v_2.leftPerpendicular();<NEW_LINE>v_2.normalize();<NEW_LINE>v_2.scale(m_abs_distance);<NEW_LINE>pt_3_tmp.add(v_2, pt_2);<NEW_LINE>addJoin_(result_mp, pt_2, pt_2_tmp, pt_3_tmp, false, false);<NEW_LINE>}<NEW_LINE>return setWeakSimple_(resultPolygon);<NEW_LINE>} | (MultiPathImpl) src._getImpl(); |
1,015,308 | public void closeElement(String element, HashMap<String, String> attributes, String content, WarningSet warnings) throws SAXException {<NEW_LINE>super.closeElement(element, attributes, content, warnings);<NEW_LINE>try {<NEW_LINE>if (RocksimCommonConstants.OD.equals(element)) {<NEW_LINE>bodyTube.setOuterRadius(Double.parseDouble<MASK><NEW_LINE>}<NEW_LINE>if (RocksimCommonConstants.ID.equals(element)) {<NEW_LINE>final double r = Double.parseDouble(content) / RocksimCommonConstants.ROCKSIM_TO_OPENROCKET_RADIUS;<NEW_LINE>bodyTube.setInnerRadius(r);<NEW_LINE>}<NEW_LINE>if (RocksimCommonConstants.LEN.equals(element)) {<NEW_LINE>bodyTube.setLength(Double.parseDouble(content) / RocksimCommonConstants.ROCKSIM_TO_OPENROCKET_LENGTH);<NEW_LINE>}<NEW_LINE>if (RocksimCommonConstants.FINISH_CODE.equals(element)) {<NEW_LINE>bodyTube.setFinish(RocksimFinishCode.fromCode(Integer.parseInt(content)).asOpenRocket());<NEW_LINE>}<NEW_LINE>if (RocksimCommonConstants.IS_MOTOR_MOUNT.equals(element)) {<NEW_LINE>bodyTube.setMotorMount("1".equals(content));<NEW_LINE>}<NEW_LINE>if (RocksimCommonConstants.ENGINE_OVERHANG.equals(element)) {<NEW_LINE>bodyTube.setMotorOverhang(Double.parseDouble(content) / RocksimCommonConstants.ROCKSIM_TO_OPENROCKET_LENGTH);<NEW_LINE>}<NEW_LINE>if (RocksimCommonConstants.MATERIAL.equals(element)) {<NEW_LINE>setMaterialName(content);<NEW_LINE>}<NEW_LINE>} catch (NumberFormatException nfe) {<NEW_LINE>warnings.add("Could not convert " + element + " value of " + content + ". It is expected to be a number.");<NEW_LINE>}<NEW_LINE>} | (content) / RocksimCommonConstants.ROCKSIM_TO_OPENROCKET_RADIUS); |
291,057 | protected <N extends Number> NumericRangeQuery<?> numericRange(Class<N> clazz, String field, @Nullable N min, @Nullable N max, boolean minInc, boolean maxInc) {<NEW_LINE>if (clazz.equals(Integer.class)) {<NEW_LINE>return NumericRangeQuery.newIntRange(field, (Integer) min, (Integer) max, minInc, maxInc);<NEW_LINE>} else if (clazz.equals(Double.class)) {<NEW_LINE>return NumericRangeQuery.newDoubleRange(field, (Double) min, (Double) max, minInc, minInc);<NEW_LINE>} else if (clazz.equals(Float.class)) {<NEW_LINE>return NumericRangeQuery.newFloatRange(field, (Float) min, (Float) max, minInc, minInc);<NEW_LINE>} else if (clazz.equals(Long.class)) {<NEW_LINE>return NumericRangeQuery.newLongRange(field, (Long) min, (Long) max, minInc, minInc);<NEW_LINE>} else if (clazz.equals(Byte.class) || clazz.equals(Short.class)) {<NEW_LINE>return NumericRangeQuery.newIntRange(field, min != null ? min.intValue() : null, max != null ? max.intValue(<MASK><NEW_LINE>} else {<NEW_LINE>throw new IllegalArgumentException("Unsupported numeric type " + clazz.getName());<NEW_LINE>}<NEW_LINE>} | ) : null, minInc, maxInc); |
98,963 | public void run() {<NEW_LINE>try {<NEW_LINE>configureLogging(true);<NEW_LINE>// Set the goquorum compatibility mode based on the genesis file<NEW_LINE>if (genesisFile != null) {<NEW_LINE>genesisConfigOptions = readGenesisConfigOptions();<NEW_LINE>if (genesisConfigOptions.isQuorum()) {<NEW_LINE>enableGoQuorumCompatibilityMode();<NEW_LINE>}<NEW_LINE>}<NEW_LINE>instantiateSignatureAlgorithmFactory();<NEW_LINE>configureNativeLibs();<NEW_LINE>logger.info("Starting Besu version: {}", BesuInfo.nodeName(identityString));<NEW_LINE>// Need to create vertx after cmdline has been parsed, such that metricsSystem is configurable<NEW_LINE>vertx = createVertx(createVertxOptions(metricsSystem.get()));<NEW_LINE>validateOptions();<NEW_LINE>configure();<NEW_LINE>initController();<NEW_LINE>besuPluginContext.beforeExternalServices();<NEW_LINE>var runner = buildRunner();<NEW_LINE>runner.startExternalServices();<NEW_LINE>startPlugins();<NEW_LINE>validatePluginOptions();<NEW_LINE>preSynchronization();<NEW_LINE>runner.startEthereumMainLoop();<NEW_LINE>runner.awaitStop();<NEW_LINE>} catch (final Exception e) {<NEW_LINE>throw new ParameterException(this.commandLine, <MASK><NEW_LINE>}<NEW_LINE>} | e.getMessage(), e); |
1,560,693 | public static boolean runSample(AzureResourceManager azureResourceManager) {<NEW_LINE>final Region region = Region.US_WEST_CENTRAL;<NEW_LINE>// =================================================================<NEW_LINE>// List all virtual machine extension image publishers and<NEW_LINE>// list all virtual machine extension images<NEW_LINE>// published by Microsoft.OSTCExtensions and Microsoft.Azure.Extensions<NEW_LINE>// by browsing through extension image publishers, types, and versions<NEW_LINE>PagedIterable<VirtualMachinePublisher> publishers = azureResourceManager.virtualMachineImages().publishers().listByRegion(region);<NEW_LINE>VirtualMachinePublisher chosenPublisher;<NEW_LINE>System.out.println("US East data center: printing list of \n" + "a) Publishers and\n" + "b) virtual machine extension images published by Microsoft.OSTCExtensions and Microsoft.Azure.Extensions");<NEW_LINE>System.out.println("=======================================================");<NEW_LINE>System.out.println("\n");<NEW_LINE>for (VirtualMachinePublisher publisher : publishers) {<NEW_LINE>System.out.println("Publisher - " + publisher.name());<NEW_LINE>if (publisher.name().equalsIgnoreCase("Microsoft.OSTCExtensions") || publisher.name().equalsIgnoreCase("Microsoft.Azure.Extensions")) {<NEW_LINE>chosenPublisher = publisher;<NEW_LINE><MASK><NEW_LINE>System.out.println("=======================================================");<NEW_LINE>System.out.println("Located " + chosenPublisher.name());<NEW_LINE>System.out.println("=======================================================");<NEW_LINE>System.out.println("Printing entries as publisher/type/version");<NEW_LINE>for (VirtualMachineExtensionImageType imageType : chosenPublisher.extensionTypes().list()) {<NEW_LINE>for (VirtualMachineExtensionImageVersion version : imageType.versions().list()) {<NEW_LINE>VirtualMachineExtensionImage image = version.getImage();<NEW_LINE>System.out.println("Image - " + chosenPublisher.name() + "/" + image.typeName() + "/" + image.versionName());<NEW_LINE>}<NEW_LINE>}<NEW_LINE>System.out.print("\n\n");<NEW_LINE>}<NEW_LINE>}<NEW_LINE>return true;<NEW_LINE>} | System.out.print("\n\n"); |
948,756 | protected void initChannel(Channel ch) {<NEW_LINE>ChannelPipeline pipeline = ch.pipeline();<NEW_LINE>pipeline.addLast(new LoggingHandler());<NEW_LINE>pipeline.addLast("http-client-codec", new HttpClientCodec());<NEW_LINE>if (gzipEnabled) {<NEW_LINE>pipeline.addLast(encoderEventLoopGroup, "gzip-encoder", new GzipEncoder(registry));<NEW_LINE>}<NEW_LINE>pipeline.addLast(<MASK><NEW_LINE>pipeline.addLast("write-timeout-handler", new WriteTimeoutHandler(writeTimeoutSeconds));<NEW_LINE>pipeline.addLast("mantis-event-aggregator", new MantisEventAggregator(registry, Clock.systemUTC(), gzipEnabled, flushIntervalMs, flushIntervalBytes));<NEW_LINE>pipeline.addLast("idle-channel-handler", new IdleStateHandler(0, idleTimeoutSeconds, 0));<NEW_LINE>pipeline.addLast("event-channel-handler", new HttpEventChannelHandler(registry));<NEW_LINE>LOG.debug("initializing channel with pipeline: {}", pipeline.toMap());<NEW_LINE>} | "http-object-aggregator", new HttpObjectAggregator(httpChunkSize)); |
282,741 | public static double squaredDistance(float[] x, float[] y) {<NEW_LINE>if (x.length != y.length) {<NEW_LINE>throw new IllegalArgumentException("Input vector sizes are different.");<NEW_LINE>}<NEW_LINE>switch(x.length) {<NEW_LINE>case 2:<NEW_LINE>{<NEW_LINE>double d0 = (double) x[0] - (double) y[0];<NEW_LINE>double d1 = (double) x[1] - (double) y[1];<NEW_LINE>return d0 * d0 + d1 * d1;<NEW_LINE>}<NEW_LINE>case 3:<NEW_LINE>{<NEW_LINE>double d0 = (double) x[0] - (double) y[0];<NEW_LINE>double d1 = (double) x[1] - (double) y[1];<NEW_LINE>double d2 = (double) x[2] - (double) y[2];<NEW_LINE>return d0 * d0 + d1 * d1 + d2 * d2;<NEW_LINE>}<NEW_LINE>case 4:<NEW_LINE>{<NEW_LINE>double d0 = (double) x[0] - (double) y[0];<NEW_LINE>double d1 = (double) x[1] - (double) y[1];<NEW_LINE>double d2 = (double) x[2] - (double) y[2];<NEW_LINE>double d3 = (double) x[3] - (double) y[3];<NEW_LINE>return d0 * d0 + d1 * d1 <MASK><NEW_LINE>}<NEW_LINE>}<NEW_LINE>double sum = 0.0;<NEW_LINE>for (int i = 0; i < x.length; i++) {<NEW_LINE>// covert x and y for better precision<NEW_LINE>double d = (double) x[i] - (double) y[i];<NEW_LINE>sum += d * d;<NEW_LINE>}<NEW_LINE>return sum;<NEW_LINE>} | + d2 * d2 + d3 * d3; |
1,035,647 | public final BitWiseExpressionContext bitWiseExpression() throws RecognitionException {<NEW_LINE>BitWiseExpressionContext _localctx = new BitWiseExpressionContext(_ctx, getState());<NEW_LINE>enterRule(_localctx, 310, RULE_bitWiseExpression);<NEW_LINE>int _la;<NEW_LINE>try {<NEW_LINE>enterOuterAlt(_localctx, 1);<NEW_LINE>{<NEW_LINE>setState(2116);<NEW_LINE>negatedExpression();<NEW_LINE>setState(2121);<NEW_LINE>_errHandler.sync(this);<NEW_LINE>_la = _input.LA(1);<NEW_LINE>while (((((_la - 173)) & ~0x3f) == 0 && ((1L << (_la - 173)) & ((1L << (BXOR - 173)) | (1L << (BOR - 173)) | (1L << (BAND - 173)))) != 0)) {<NEW_LINE>{<NEW_LINE>{<NEW_LINE>setState(2117);<NEW_LINE>_la = _input.LA(1);<NEW_LINE>if (!(((((_la - 173)) & ~0x3f) == 0 && ((1L << (_la - 173)) & ((1L << (BXOR - 173)) | (1L << (BOR - 173)) | (1L << (BAND - 173)))) != 0))) {<NEW_LINE>_errHandler.recoverInline(this);<NEW_LINE>} else {<NEW_LINE>if (_input.LA(1) == Token.EOF)<NEW_LINE>matchedEOF = true;<NEW_LINE>_errHandler.reportMatch(this);<NEW_LINE>consume();<NEW_LINE>}<NEW_LINE>setState(2118);<NEW_LINE>negatedExpression();<NEW_LINE>}<NEW_LINE>}<NEW_LINE>setState(2123);<NEW_LINE>_errHandler.sync(this);<NEW_LINE>_la = _input.LA(1);<NEW_LINE>}<NEW_LINE>}<NEW_LINE>} catch (RecognitionException re) {<NEW_LINE>_localctx.exception = re;<NEW_LINE>_errHandler.reportError(this, re);<NEW_LINE><MASK><NEW_LINE>} finally {<NEW_LINE>exitRule();<NEW_LINE>}<NEW_LINE>return _localctx;<NEW_LINE>} | _errHandler.recover(this, re); |
462,406 | public void run(RegressionEnvironment env) {<NEW_LINE>String stmtText = "@name('s0') select (select p10 from SupportBean_S1#length(100000) where id = s0.id) as value from SupportBean_S0 as s0";<NEW_LINE><MASK><NEW_LINE>// preload with 10k events<NEW_LINE>for (int i = 0; i < 10000; i++) {<NEW_LINE>env.sendEventBean(new SupportBean_S1(i, Integer.toString(i)));<NEW_LINE>}<NEW_LINE>long startTime = System.currentTimeMillis();<NEW_LINE>for (int i = 0; i < 10000; i++) {<NEW_LINE>int index = 5000 + i % 1000;<NEW_LINE>env.sendEventBean(new SupportBean_S0(index, Integer.toString(index)));<NEW_LINE>env.assertEqualsNew("s0", "value", Integer.toString(index));<NEW_LINE>}<NEW_LINE>long endTime = System.currentTimeMillis();<NEW_LINE>long delta = endTime - startTime;<NEW_LINE>assertTrue("Failed perf test, delta=" + delta, delta < 1000);<NEW_LINE>env.undeployAll();<NEW_LINE>} | env.compileDeployAddListenerMileZero(stmtText, "s0"); |
905,555 | public Producer buildProducerProperties() {<NEW_LINE>PropertyMapper propertyMapper = PropertyMapper.get().alwaysApplyingWhenNonNull();<NEW_LINE>Producer properties = new Producer();<NEW_LINE>AzurePropertiesUtils.mergeAzureCommonProperties(this, this.producer, properties);<NEW_LINE>propertyMapper.from(this.getDomainName()<MASK><NEW_LINE>propertyMapper.from(this.getNamespace()).to(properties::setNamespace);<NEW_LINE>propertyMapper.from(this.getConnectionString()).to(properties::setConnectionString);<NEW_LINE>propertyMapper.from(this.getEntityName()).to(properties::setEntityName);<NEW_LINE>propertyMapper.from(this.getEntityType()).to(properties::setEntityType);<NEW_LINE>propertyMapper.from(this.producer.getDomainName()).to(properties::setDomainName);<NEW_LINE>propertyMapper.from(this.producer.getNamespace()).to(properties::setNamespace);<NEW_LINE>propertyMapper.from(this.producer.getConnectionString()).to(properties::setConnectionString);<NEW_LINE>propertyMapper.from(this.producer.getEntityType()).to(properties::setEntityType);<NEW_LINE>propertyMapper.from(this.producer.getEntityName()).to(properties::setEntityName);<NEW_LINE>return properties;<NEW_LINE>} | ).to(properties::setDomainName); |
1,528,790 | private void writeMetadata(final Contentlet contentlet, final StringWriter stringWriter, final Map<String, Object> mapLowered) throws IOException, DotDataException {<NEW_LINE>if (Config.getBooleanProperty(WRITE_METADATA_ON_REINDEX, true)) {<NEW_LINE>final ContentletMetadata metadata = fileMetadataAPI.generateContentletMetadata(contentlet);<NEW_LINE>final Map<String, Metadata> fullMetadataMap = metadata.getFullMetadataMap();<NEW_LINE>// Full metadata map is expected to have one single entry with everything<NEW_LINE>fullMetadataMap.forEach((field, metadataValues) -> {<NEW_LINE>if (null != metadataValues) {<NEW_LINE>final Set<String> dotRawInclude = Arrays.stream(Config.getStringArrayProperty(INCLUDE_DOTRAW_METADATA_FIELDS, defaultIncludedDotRawMetadataFields)).map(String::toLowerCase).collect(Collectors.toSet());<NEW_LINE>metadataValues.getFieldsMeta().forEach((metadataKey, metadataValue) -> {<NEW_LINE>final String contentData = metadataValue != null ? metadataValue.toString() : BLANK;<NEW_LINE>final String compositeKey = FileAssetAPI.META_DATA_FIELD.toLowerCase() + PERIOD + metadataKey.toLowerCase();<NEW_LINE>final Object value = preProcessMetadataValue(compositeKey, metadataValue);<NEW_LINE><MASK><NEW_LINE>if (Config.getBooleanProperty(INDEX_DOTRAW_METADATA_FIELDS, true) && dotRawInclude.contains(metadataKey.toLowerCase())) {<NEW_LINE>mapLowered.put(compositeKey + DOTRAW, value);<NEW_LINE>}<NEW_LINE>if (metadataKey.contains(FileAssetAPI.CONTENT_FIELD)) {<NEW_LINE>stringWriter.append(contentData).append(' ');<NEW_LINE>}<NEW_LINE>});<NEW_LINE>}<NEW_LINE>});<NEW_LINE>}<NEW_LINE>} | mapLowered.put(compositeKey, value); |
125,610 | final SuggestResult executeSuggest(SuggestRequest suggestRequest) {<NEW_LINE>ExecutionContext executionContext = createExecutionContext(suggestRequest);<NEW_LINE>AWSRequestMetrics awsRequestMetrics = executionContext.getAwsRequestMetrics();<NEW_LINE>awsRequestMetrics.startEvent(Field.ClientExecuteTime);<NEW_LINE>Request<SuggestRequest> request = null;<NEW_LINE>Response<SuggestResult> response = null;<NEW_LINE>try {<NEW_LINE>awsRequestMetrics.startEvent(Field.RequestMarshallTime);<NEW_LINE>try {<NEW_LINE>request = new SuggestRequestProtocolMarshaller(protocolFactory).marshall(super.beforeMarshalling(suggestRequest));<NEW_LINE>// Binds the request metrics to the current request.<NEW_LINE>request.setAWSRequestMetrics(awsRequestMetrics);<NEW_LINE>request.addHandlerContext(HandlerContextKey.CLIENT_ENDPOINT, endpoint);<NEW_LINE>request.addHandlerContext(HandlerContextKey.ENDPOINT_OVERRIDDEN, isEndpointOverridden());<NEW_LINE>request.addHandlerContext(HandlerContextKey.SIGNING_REGION, getSigningRegion());<NEW_LINE>request.addHandlerContext(HandlerContextKey.SERVICE_ID, "CloudSearch Domain");<NEW_LINE>request.addHandlerContext(HandlerContextKey.OPERATION_NAME, "Suggest");<NEW_LINE>request.addHandlerContext(HandlerContextKey.ADVANCED_CONFIG, advancedConfig);<NEW_LINE>} finally {<NEW_LINE>awsRequestMetrics.endEvent(Field.RequestMarshallTime);<NEW_LINE>}<NEW_LINE>HttpResponseHandler<AmazonWebServiceResponse<SuggestResult>> responseHandler = protocolFactory.createResponseHandler(new JsonOperationMetadata().withPayloadJson(true).withHasStreamingSuccessResponse(false), new SuggestResultJsonUnmarshaller());<NEW_LINE>response = <MASK><NEW_LINE>return response.getAwsResponse();<NEW_LINE>} finally {<NEW_LINE>endClientExecution(awsRequestMetrics, request, response);<NEW_LINE>}<NEW_LINE>} | invoke(request, responseHandler, executionContext); |
1,755,107 | public void postConfig() {<NEW_LINE>super.postConfig();<NEW_LINE>Locale locale;<NEW_LINE>if ((localeLanguage == null) && (localeCountry == null)) {<NEW_LINE>locale = Locale.getDefault(Locale.Category.FORMAT);<NEW_LINE>} else if (localeLanguage == null) {<NEW_LINE>throw new PropertyException("", "localeLanguage", "Must supply both localeLanguage and localeCountry when setting the locale.");<NEW_LINE>} else if (localeCountry == null) {<NEW_LINE>throw new PropertyException("", "localeCountry", "Must supply both localeLanguage and localeCountry when setting the locale.");<NEW_LINE>} else {<NEW_LINE>locale = new Locale(localeLanguage, localeCountry);<NEW_LINE>}<NEW_LINE>if (dateTimeFormat != null) {<NEW_LINE>try {<NEW_LINE>formatter = <MASK><NEW_LINE>} catch (IllegalArgumentException e) {<NEW_LINE>throw new PropertyException(e, "", "dateTimeFormat", "dateTimeFormat could not be parsed by DateTimeFormatter");<NEW_LINE>}<NEW_LINE>} else {<NEW_LINE>throw new PropertyException("", "dateTimeFormat", "Invalid Date/Time format string supplied");<NEW_LINE>}<NEW_LINE>} | DateTimeFormatter.ofPattern(dateTimeFormat, locale); |
388,007 | @DB<NEW_LINE>public Project activateProject(final long projectId) {<NEW_LINE>Account caller = CallContext.current().getCallingAccount();<NEW_LINE>// check that the project exists<NEW_LINE>final ProjectVO project = getProject(projectId);<NEW_LINE>if (project == null) {<NEW_LINE>InvalidParameterValueException ex = new InvalidParameterValueException("Unable to find project with specified id");<NEW_LINE>ex.addProxyObject(String.valueOf(projectId), "projectId");<NEW_LINE>throw ex;<NEW_LINE>}<NEW_LINE>CallContext.current().setProject(project);<NEW_LINE>// verify permissions<NEW_LINE>_accountMgr.checkAccess(caller, AccessType.ModifyProject, true, _accountMgr.getAccount(project.getProjectAccountId()));<NEW_LINE>// allow project activation only when it's in Suspended state<NEW_LINE>Project.State currentState = project.getState();<NEW_LINE>if (currentState == State.Active) {<NEW_LINE>s_logger.debug("The project id=" + projectId + " is already active, no need to activate it again");<NEW_LINE>return project;<NEW_LINE>}<NEW_LINE>if (currentState != State.Suspended) {<NEW_LINE>throw new <MASK><NEW_LINE>}<NEW_LINE>Transaction.execute(new TransactionCallbackNoReturn() {<NEW_LINE><NEW_LINE>@Override<NEW_LINE>public void doInTransactionWithoutResult(TransactionStatus status) {<NEW_LINE>project.setState(Project.State.Active);<NEW_LINE>_projectDao.update(projectId, project);<NEW_LINE>_accountMgr.enableAccount(project.getProjectAccountId());<NEW_LINE>}<NEW_LINE>});<NEW_LINE>return _projectDao.findById(projectId);<NEW_LINE>} | InvalidParameterValueException("Can't activate the project in " + currentState + " state"); |
1,836,735 | public void run() {<NEW_LINE>DocumentUtilities.setTypingModification(doc, true);<NEW_LINE>try {<NEW_LINE><MASK><NEW_LINE>Action cutAction;<NEW_LINE>if (actionMap != null && (cutAction = actionMap.get(DefaultEditorKit.cutAction)) != null) {<NEW_LINE>Caret caret = target.getCaret();<NEW_LINE>int caretOffset = caret.getDot();<NEW_LINE>boolean toLineEnd = BaseKit.cutToLineEndAction.equals(getValue(Action.NAME));<NEW_LINE>int boundOffset = toLineEnd ? Utilities.getRowEnd(target, caretOffset) : Utilities.getRowStart(target, caretOffset);<NEW_LINE>// Check whether there is only whitespace from caret position<NEW_LINE>// till end of line<NEW_LINE>if (toLineEnd) {<NEW_LINE>String text = target.getText(caretOffset, boundOffset - caretOffset);<NEW_LINE>if (boundOffset < doc.getLength() && text != null && text.matches("^[\\s]*$")) {<NEW_LINE>// NOI18N<NEW_LINE>// Include line separator<NEW_LINE>boundOffset += 1;<NEW_LINE>}<NEW_LINE>}<NEW_LINE>caret.moveDot(boundOffset);<NEW_LINE>// Call the cut action to cut out the selection<NEW_LINE>cutAction.actionPerformed(evt);<NEW_LINE>}<NEW_LINE>} catch (BadLocationException ex) {<NEW_LINE>ex.printStackTrace();<NEW_LINE>} finally {<NEW_LINE>DocumentUtilities.setTypingModification(doc, false);<NEW_LINE>}<NEW_LINE>} | ActionMap actionMap = target.getActionMap(); |
515,295 | public static void editStoryForResult(Activity activity, SiteModel site, LocalId localPostId, int storyIndex, boolean allStorySlidesAreEditable, boolean launchedFromGutenberg, String storyBlockId) {<NEW_LINE>if (site == null) {<NEW_LINE>return;<NEW_LINE>}<NEW_LINE>Intent intent = new Intent(activity, StoryComposerActivity.class);<NEW_LINE>intent.putExtra(WordPress.SITE, site);<NEW_LINE>intent.putExtra(<MASK><NEW_LINE>intent.putExtra(KEY_STORY_INDEX, storyIndex);<NEW_LINE>intent.putExtra(KEY_LAUNCHED_FROM_GUTENBERG, launchedFromGutenberg);<NEW_LINE>intent.putExtra(KEY_ALL_UNFLATTENED_LOADED_SLIDES, allStorySlidesAreEditable);<NEW_LINE>intent.putExtra(ARG_STORY_BLOCK_ID, storyBlockId);<NEW_LINE>activity.startActivityForResult(intent, RequestCodes.EDIT_STORY);<NEW_LINE>} | KEY_POST_LOCAL_ID, localPostId.getValue()); |
1,660,089 | private void validateTargetSpec(TargetNodeSpec spec, String arg, Cell owningCell) {<NEW_LINE>CanonicalCellName cellName = spec.getBuildFileSpec().getCellRelativeBaseName().getCellName();<NEW_LINE>ForwardRelativePath basePath = spec.getBuildFileSpec().getCellRelativeBaseName().getPath();<NEW_LINE>Path basePathPath = basePath.toPath(owningCell.getFilesystem().getFileSystem());<NEW_LINE>Cell realCell = owningCell.getCellProvider().getCellByCanonicalCellName(cellName);<NEW_LINE>if (!realCell.getFilesystem().exists(basePathPath)) {<NEW_LINE>// If someone passes in bar:baz while in subdir foo, and foo/bar does not exist, BUT <root<NEW_LINE>// cell>/bar does, tell the user to fix their usage. We do not want to support too many<NEW_LINE>// extraneous build target patterns, so hard error, but at least try to help users along.<NEW_LINE>if (!rootRelativePackage.isEmpty() && owningCell.equals(realCell) && !arg.contains("//")) {<NEW_LINE>Path rootRelativePackagePath = Paths.get(rootRelativePackage);<NEW_LINE>if (basePathPath.startsWith(rootRelativePackagePath) && owningCell.getFilesystem().exists(rootRelativePackagePath.relativize(basePathPath))) {<NEW_LINE>Path rootBasePath = rootRelativePackagePath.relativize(basePathPath);<NEW_LINE>String str = "%s references a non-existent directory %s when run from %s\n" + "However, %s exists in your repository root (%s).\n" + "Non-absolute build targets are relative to your working directory.\n" + "Try either re-running your command the repository root, or re-running your " + " command with //%s instead of %s";<NEW_LINE>throw new HumanReadableException(str, arg, basePath, rootRelativePackage, rootBasePath, owningCell.getRoot(), arg, arg);<NEW_LINE>}<NEW_LINE>}<NEW_LINE>throw new <MASK><NEW_LINE>}<NEW_LINE>} | HumanReadableException("%s references non-existent directory %s", arg, basePath); |
1,844,747 | private void initComponents() {<NEW_LINE>setLayout(new BorderLayout());<NEW_LINE>contentComponent = new javax.swing.JPanel(new BorderLayout());<NEW_LINE>// NOI18N<NEW_LINE>add(contentComponent, BorderLayout.CENTER);<NEW_LINE>JToolBar toolBar = new JToolBar(JToolBar.VERTICAL);<NEW_LINE>toolBar.setFloatable(false);<NEW_LINE>toolBar.setRollover(true);<NEW_LINE>toolBar.setBorderPainted(true);<NEW_LINE>if ("Aqua".equals(UIManager.getLookAndFeel().getID())) {<NEW_LINE>// NOI18N<NEW_LINE>// NOI18N<NEW_LINE>toolBar.setBackground(UIManager.getColor("NbExplorerView.background"));<NEW_LINE>}<NEW_LINE>toolBar.setBorder(javax.swing.BorderFactory.createCompoundBorder(javax.swing.BorderFactory.createMatteBorder(0, 0, 0, 1, javax.swing.UIManager.getDefaults().getColor("Separator.background")), javax.swing.BorderFactory.createMatteBorder(0, 0, 0, 1, javax.swing.UIManager.getDefaults()<MASK><NEW_LINE>add(toolBar, BorderLayout.WEST);<NEW_LINE>JComponent buttonsPane = toolBar;<NEW_LINE>viewModelListener = new ViewModelListener(name, contentComponent, buttonsPane, propertiesHelpID, ImageUtilities.loadImage(icon));<NEW_LINE>} | .getColor("Separator.foreground")))); |
1,450,994 | protected void recalculate() {<NEW_LINE>if (this.list_scroll_pane != null) {<NEW_LINE>main_panel.remove(this.list_scroll_pane);<NEW_LINE>}<NEW_LINE>main_panel.remove(this.list_empty_message);<NEW_LINE>// Create display list<NEW_LINE>this.list_model = new javax.swing.DefaultListModel<>();<NEW_LINE>this.list = new javax.swing.JList<Object>(this.list_model);<NEW_LINE>this.list.setBorder(javax.swing.BorderFactory.createEmptyBorder(10<MASK><NEW_LINE>this.fill_list();<NEW_LINE>if (this.list.getVisibleRowCount() > 0) {<NEW_LINE>list_scroll_pane = new javax.swing.JScrollPane(this.list);<NEW_LINE>main_panel.add(list_scroll_pane, java.awt.BorderLayout.CENTER);<NEW_LINE>} else {<NEW_LINE>main_panel.add(list_empty_message, java.awt.BorderLayout.CENTER);<NEW_LINE>}<NEW_LINE>this.pack();<NEW_LINE>this.list.addMouseListener(new java.awt.event.MouseAdapter() {<NEW_LINE><NEW_LINE>public void mouseClicked(java.awt.event.MouseEvent evt) {<NEW_LINE>if (evt.getClickCount() > 1) {<NEW_LINE>select_instances();<NEW_LINE>}<NEW_LINE>}<NEW_LINE>});<NEW_LINE>} | , 10, 10, 10)); |
1,712,787 | public boolean isThumbnailAvailable(FileMetadata fileMetadata) {<NEW_LINE>// new and optimized logic:<NEW_LINE>// - check download permission here (should be cached - so it's free!)<NEW_LINE>// - only then check if the thumbnail is available/exists.<NEW_LINE>// then cache the results!<NEW_LINE>Long dataFileId = fileMetadata.getDataFile().getId();<NEW_LINE>if (datafileThumbnailsMap.containsKey(dataFileId)) {<NEW_LINE>return !"".equals(datafileThumbnailsMap.get(dataFileId));<NEW_LINE>}<NEW_LINE>if (!FileUtil.isThumbnailSupported(fileMetadata.getDataFile())) {<NEW_LINE>datafileThumbnailsMap.put(dataFileId, "");<NEW_LINE>return false;<NEW_LINE>}<NEW_LINE>if (!this.fileDownloadHelper.canDownloadFile(fileMetadata)) {<NEW_LINE><MASK><NEW_LINE>return false;<NEW_LINE>}<NEW_LINE>String thumbnailAsBase64 = ImageThumbConverter.getImageThumbnailAsBase64(fileMetadata.getDataFile(), ImageThumbConverter.DEFAULT_THUMBNAIL_SIZE);<NEW_LINE>// if (datafileService.isThumbnailAvailable(fileMetadata.getDataFile())) {<NEW_LINE>if (!StringUtil.isEmpty(thumbnailAsBase64)) {<NEW_LINE>datafileThumbnailsMap.put(dataFileId, thumbnailAsBase64);<NEW_LINE>return true;<NEW_LINE>}<NEW_LINE>datafileThumbnailsMap.put(dataFileId, "");<NEW_LINE>return false;<NEW_LINE>} | datafileThumbnailsMap.put(dataFileId, ""); |
295,974 | public Purchases deserialize(JsonElement json, Type typeOfT, JsonDeserializationContext context) throws JsonParseException {<NEW_LINE>JsonObject object = json.getAsJsonObject();<NEW_LINE>RealmList<OwnedCustomization> customizations = new RealmList<>();<NEW_LINE>Purchases purchases = new Purchases();<NEW_LINE>for (String type : Arrays.asList("background", "shirt", "skin")) {<NEW_LINE>if (!object.has(type)) {<NEW_LINE>continue;<NEW_LINE>}<NEW_LINE>for (Map.Entry<String, JsonElement> entry : object.get(type).getAsJsonObject().entrySet()) {<NEW_LINE>customizations.add(this.parseCustomization(type, null, entry.getKey(), entry.getValue().getAsBoolean()));<NEW_LINE>}<NEW_LINE>}<NEW_LINE>if (object.has("hair")) {<NEW_LINE>for (Map.Entry<String, JsonElement> categoryEntry : object.get("hair").getAsJsonObject().entrySet()) {<NEW_LINE>for (Map.Entry<String, JsonElement> entry : categoryEntry.getValue().getAsJsonObject().entrySet()) {<NEW_LINE>customizations.add(this.parseCustomization("hair", categoryEntry.getKey(), entry.getKey(), entry.getValue().getAsBoolean()));<NEW_LINE>}<NEW_LINE>}<NEW_LINE>}<NEW_LINE>purchases.customizations = customizations;<NEW_LINE>purchases.setPlan(context.deserialize(object.get(<MASK><NEW_LINE>return purchases;<NEW_LINE>} | "plan"), SubscriptionPlan.class)); |
1,692,740 | protected void addCompletions(@NotNull CompletionParameters completionParameters, ProcessingContext processingContext, @NotNull CompletionResultSet completionResultSet) {<NEW_LINE>PsiElement psiElement = completionParameters.getOriginalPosition();<NEW_LINE>if (!Symfony2ProjectComponent.isEnabled(psiElement)) {<NEW_LINE>return;<NEW_LINE>}<NEW_LINE>MethodReference <MASK><NEW_LINE>if (methodReference == null) {<NEW_LINE>return;<NEW_LINE>}<NEW_LINE>if (!(PhpElementsUtil.isMethodReferenceInstanceOf(methodReference, "Doctrine\\Common\\Persistence\\ObjectManager", "getRepository") || PhpElementsUtil.isMethodReferenceInstanceOf(methodReference, "Doctrine\\Common\\Persistence\\ManagerRegistry", "getRepository") || PhpElementsUtil.isMethodReferenceInstanceOf(methodReference, "Doctrine\\Persistence\\ObjectManager", "getRepository") || PhpElementsUtil.isMethodReferenceInstanceOf(methodReference, "Doctrine\\Persistence\\ManagerRegistry", "getRepository"))) {<NEW_LINE>return;<NEW_LINE>}<NEW_LINE>Collection<DoctrineModel> modelClasses = EntityHelper.getModelClasses(psiElement.getProject());<NEW_LINE>for (DoctrineModel doctrineModel : modelClasses) {<NEW_LINE>PhpClass phpClass = doctrineModel.getPhpClass();<NEW_LINE>if (phpClass.isAbstract() || phpClass.isInterface()) {<NEW_LINE>continue;<NEW_LINE>}<NEW_LINE>LookupElement elementBuilder = new Foo(phpClass);<NEW_LINE>// does this have an effect really?<NEW_LINE>completionResultSet.addElement(PrioritizedLookupElement.withExplicitProximity(PrioritizedLookupElement.withPriority(elementBuilder, 1000), 1000));<NEW_LINE>}<NEW_LINE>} | methodReference = PhpElementsUtil.findMethodReferenceOnClassConstant(psiElement); |
1,509,946 | public boolean onTouchEvent(MotionEvent event) {<NEW_LINE>assertMainThread();<NEW_LINE>boolean handled = false;<NEW_LINE>if (isEnabled()) {<NEW_LINE>// Iterate drawable from last to first to respect drawing order.<NEW_LINE>for (int i = ((mDrawableMountItems == null) ? 0 : mDrawableMountItems.size()) - 1; i >= 0; i--) {<NEW_LINE>final MountItem <MASK><NEW_LINE>if (item.getContent() instanceof Touchable && !isTouchableDisabled(getLayoutOutput(item).getFlags())) {<NEW_LINE>final Touchable t = (Touchable) item.getContent();<NEW_LINE>if (t.shouldHandleTouchEvent(event) && t.onTouchEvent(event, this)) {<NEW_LINE>handled = true;<NEW_LINE>break;<NEW_LINE>}<NEW_LINE>}<NEW_LINE>}<NEW_LINE>}<NEW_LINE>if (!handled) {<NEW_LINE>handled = super.onTouchEvent(event);<NEW_LINE>}<NEW_LINE>return handled;<NEW_LINE>} | item = mDrawableMountItems.valueAt(i); |
662,918 | private boolean sendAckTuple(Tuple input) {<NEW_LINE>boolean ret = false;<NEW_LINE>Integer pendingCount;<NEW_LINE>synchronized (pendingTuples) {<NEW_LINE>pendingCount = pendingTuples.get(input);<NEW_LINE>}<NEW_LINE>if (pendingCount == null || pendingCount <= 0) {<NEW_LINE>long ack_val = 0L;<NEW_LINE>Object <MASK><NEW_LINE>if (pend_val != null) {<NEW_LINE>ack_val = (Long) (pend_val);<NEW_LINE>}<NEW_LINE>MessageId messageId = input.getMessageId();<NEW_LINE>if (messageId != null) {<NEW_LINE>for (Map.Entry<Long, Long> e : messageId.getAnchorsToIds().entrySet()) {<NEW_LINE>List<Object> ackTuple = JStormUtils.mk_list((Object) e.getKey(), JStormUtils.bit_xor(e.getValue(), ack_val));<NEW_LINE>sendBoltMsg(Acker.ACKER_ACK_STREAM_ID, null, ackTuple, null, null);<NEW_LINE>}<NEW_LINE>}<NEW_LINE>ret = true;<NEW_LINE>}<NEW_LINE>return ret;<NEW_LINE>} | pend_val = pendingAcks.remove(input); |
1,809,700 | public void actionPerformed(AnActionEvent e) {<NEW_LINE>DataContext dataContext = e.getDataContext();<NEW_LINE>final Project project = dataContext.getData(CommonDataKeys.PROJECT);<NEW_LINE>if (project == null)<NEW_LINE>return;<NEW_LINE>PsiDocumentManager.getInstance(project).commitAllDocuments();<NEW_LINE>Editor editor = <MASK><NEW_LINE>UsageTarget[] usageTargets = dataContext.getData(UsageView.USAGE_TARGETS_KEY);<NEW_LINE>if (usageTargets != null) {<NEW_LINE>FileEditor fileEditor = dataContext.getData(PlatformDataKeys.FILE_EDITOR);<NEW_LINE>if (fileEditor != null) {<NEW_LINE>usageTargets[0].findUsagesInEditor(fileEditor);<NEW_LINE>}<NEW_LINE>} else if (editor == null) {<NEW_LINE>Messages.showMessageDialog(project, FindBundle.message("find.no.usages.at.cursor.error"), CommonBundle.getErrorTitle(), Messages.getErrorIcon());<NEW_LINE>} else {<NEW_LINE>HintManager.getInstance().showErrorHint(editor, FindBundle.message("find.no.usages.at.cursor.error"));<NEW_LINE>}<NEW_LINE>} | dataContext.getData(PlatformDataKeys.EDITOR); |
343,965 | public static void main(String[] args) throws Exception {<NEW_LINE>String fileName = args[0];<NEW_LINE>boolean useJExtract = false;<NEW_LINE>if (args.length > 1) {<NEW_LINE>if (args[1].toLowerCase().trim().equals("jextract")) {<NEW_LINE>useJExtract = true;<NEW_LINE>}<NEW_LINE>}<NEW_LINE>ImageFactory factory = null;<NEW_LINE>if (useJExtract) {<NEW_LINE>try {<NEW_LINE>Class<?> jxfactoryclass = Class.forName("com.ibm.dtfj.image.j9.ImageFactory");<NEW_LINE>factory = (ImageFactory) jxfactoryclass.newInstance();<NEW_LINE>} catch (Exception e) {<NEW_LINE>System.out.println("Could not create a jextract based implementation of ImageFactory");<NEW_LINE>e.printStackTrace();<NEW_LINE>System.exit(1);<NEW_LINE>}<NEW_LINE>} else {<NEW_LINE>factory = new J9DDRImageFactory();<NEW_LINE>}<NEW_LINE>Image img = factory.getImage(new File(fileName));<NEW_LINE>Iterator<?> addressSpaceIt = img.getAddressSpaces();<NEW_LINE>while (addressSpaceIt.hasNext()) {<NEW_LINE>Object addressSpaceObj = addressSpaceIt.next();<NEW_LINE>if (addressSpaceObj instanceof ImageAddressSpace) {<NEW_LINE>ImageAddressSpace as = (ImageAddressSpace) addressSpaceObj;<NEW_LINE>System.err.println("Address space " + as);<NEW_LINE>List<ImageSection> imageSections = new LinkedList<ImageSection>();<NEW_LINE>Iterator<?> isIt = as.getImageSections();<NEW_LINE>while (isIt.hasNext()) {<NEW_LINE>Object isObj = isIt.next();<NEW_LINE>if (isObj instanceof ImageSection) {<NEW_LINE>ImageSection thisIs = (ImageSection) isObj;<NEW_LINE>imageSections.add(thisIs);<NEW_LINE>} else {<NEW_LINE>System.err.println("Weird image section object: " + isObj + ", class = " + isObj.<MASK><NEW_LINE>}<NEW_LINE>}<NEW_LINE>Collections.sort(imageSections, new Comparator<ImageSection>() {<NEW_LINE><NEW_LINE>public int compare(ImageSection object1, ImageSection object2) {<NEW_LINE>int baseResult = Long.signum(object1.getBaseAddress().getAddress() - object2.getBaseAddress().getAddress());<NEW_LINE>if (baseResult == 0) {<NEW_LINE>return Long.signum(object1.getSize() - object2.getSize());<NEW_LINE>} else {<NEW_LINE>return baseResult;<NEW_LINE>}<NEW_LINE>}<NEW_LINE>});<NEW_LINE>for (ImageSection thisIs : imageSections) {<NEW_LINE>System.err.println("0x" + Long.toHexString(thisIs.getBaseAddress().getAddress()) + " - " + "0x" + Long.toHexString(thisIs.getBaseAddress().getAddress() + thisIs.getSize() - 1));<NEW_LINE>}<NEW_LINE>} else {<NEW_LINE>System.err.println("Weird address space object: " + addressSpaceObj + " class = " + addressSpaceObj.getClass().getName());<NEW_LINE>}<NEW_LINE>}<NEW_LINE>} | getClass().getName()); |
1,546,252 | private Mono<Response<Flux<ByteBuffer>>> batchUpdateWithResponseAsync(String resourceGroupName, String serverName, ConfigurationListForBatchUpdate parameters, Context context) {<NEW_LINE>if (this.client.getEndpoint() == null) {<NEW_LINE>return Mono.error(new IllegalArgumentException("Parameter this.client.getEndpoint() is required and cannot be null."));<NEW_LINE>}<NEW_LINE>if (this.client.getSubscriptionId() == null) {<NEW_LINE>return Mono.error(new IllegalArgumentException("Parameter this.client.getSubscriptionId() is required and cannot be null."));<NEW_LINE>}<NEW_LINE>if (resourceGroupName == null) {<NEW_LINE>return Mono.error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null."));<NEW_LINE>}<NEW_LINE>if (serverName == null) {<NEW_LINE>return Mono.error(new IllegalArgumentException("Parameter serverName is required and cannot be null."));<NEW_LINE>}<NEW_LINE>if (parameters == null) {<NEW_LINE>return Mono.<MASK><NEW_LINE>} else {<NEW_LINE>parameters.validate();<NEW_LINE>}<NEW_LINE>final String accept = "application/json";<NEW_LINE>context = this.client.mergeContext(context);<NEW_LINE>return service.batchUpdate(this.client.getEndpoint(), this.client.getApiVersion(), this.client.getSubscriptionId(), resourceGroupName, serverName, parameters, accept, context);<NEW_LINE>} | error(new IllegalArgumentException("Parameter parameters is required and cannot be null.")); |
1,465,082 | /*<NEW_LINE>* (non-Javadoc)<NEW_LINE>*<NEW_LINE>* @see<NEW_LINE>* com.ibm.jbatch.container.services.impl.AbstractPersistenceManagerImpl<NEW_LINE>* #init(com.ibm.jbatch.container.IBatchConfig)<NEW_LINE>*/<NEW_LINE>@Override<NEW_LINE>public void init(IBatchConfig batchConfig) throws BatchContainerServiceException {<NEW_LINE>logger.log(Level.CONFIG, "Entering CLASSNAME.init(), batchConfig ={0}", batchConfig);<NEW_LINE>this.batchConfig = batchConfig;<NEW_LINE>schema = batchConfig.getDatabaseConfigurationBean().getSchema();<NEW_LINE>jndiName = batchConfig.getDatabaseConfigurationBean().getJndiName();<NEW_LINE>prefix = batchConfig.getConfigProperties().getProperty(PAYARA_TABLE_PREFIX_PROPERTY, "");<NEW_LINE>suffix = batchConfig.getConfigProperties().getProperty(PAYARA_TABLE_SUFFIX_PROPERTY, "");<NEW_LINE>logger.log(Level.CONFIG, "JNDI name = {0}", jndiName);<NEW_LINE>if (jndiName == null || jndiName.equals("")) {<NEW_LINE>throw new BatchContainerServiceException("JNDI name is not defined.");<NEW_LINE>}<NEW_LINE>try {<NEW_LINE>dataSource = (DataSource) new InitialContext().lookup(jndiName);<NEW_LINE>} catch (NamingException e) {<NEW_LINE>logger.severe("Lookup failed for JNDI name: " + jndiName + ". " + " One cause of this could be that the batch runtime is incorrectly configured to EE mode when it should be in SE mode.");<NEW_LINE>throw new BatchContainerServiceException(e);<NEW_LINE>}<NEW_LINE>// Load the table names and queries shared between different database types<NEW_LINE>tableNames = getSharedTableMap();<NEW_LINE>try {<NEW_LINE>queryStrings = getSharedQueryMap(batchConfig);<NEW_LINE>} catch (SQLException e1) {<NEW_LINE>throw new BatchContainerServiceException(e1);<NEW_LINE>}<NEW_LINE>try {<NEW_LINE>if (!isSchemaValid()) {<NEW_LINE>setDefaultSchema();<NEW_LINE>}<NEW_LINE>checkTables();<NEW_LINE>} catch (SQLException e) {<NEW_LINE>logger.severe(e.getLocalizedMessage());<NEW_LINE>throw new BatchContainerServiceException(e);<NEW_LINE>}<NEW_LINE>try {<NEW_LINE>requestTracing = getDefaultHabitat().getService(RequestTracingService.class);<NEW_LINE>} catch (NullPointerException ex) {<NEW_LINE>logger.<MASK><NEW_LINE>}<NEW_LINE>logger.config("Exiting CLASSNAME.init()");<NEW_LINE>} | log(INFO, "Error retrieving Request Tracing service " + "during initialisation of JBatchJDBCPersistenceManager - NullPointerException"); |
1,587,344 | public static void drawChessboard(Graphics2D g2, WorldToCameraToPixel fiducialToPixel, int numRows, int numCols, double squareWidth) {<NEW_LINE>Point3D_F64 fidPt = new Point3D_F64();<NEW_LINE>Point2D_F64 pixel0 = new Point2D_F64();<NEW_LINE>Point2D_F64 pixel1 = new Point2D_F64();<NEW_LINE>Point2D_F64 pixel2 = new Point2D_F64();<NEW_LINE>Point2D_F64 pixel3 = new Point2D_F64();<NEW_LINE>Line2D.Double l = new Line2D.Double();<NEW_LINE>int[] polyX = new int[4];<NEW_LINE>int[] polyY = new int[4];<NEW_LINE>int alpha = 100;<NEW_LINE>Color red = new Color(255, 0, 0, alpha);<NEW_LINE>Color black = new Color(0, 0, 0, alpha);<NEW_LINE>for (int row = 0; row < numRows; row++) {<NEW_LINE>double y0 = -numRows * squareWidth / 2 + row * squareWidth;<NEW_LINE>for (int col = row % 2; col < numCols; col += 2) {<NEW_LINE>double x0 = -numCols * squareWidth / 2 + col * squareWidth;<NEW_LINE>fidPt.setTo(x0, y0, 0);<NEW_LINE>fiducialToPixel.transform(fidPt, pixel0);<NEW_LINE>fidPt.setTo(x0 + squareWidth, y0, 0);<NEW_LINE>fiducialToPixel.transform(fidPt, pixel1);<NEW_LINE>fidPt.setTo(x0 + squareWidth, y0 + squareWidth, 0);<NEW_LINE>fiducialToPixel.transform(fidPt, pixel2);<NEW_LINE>fidPt.setTo(x0, y0 + squareWidth, 0);<NEW_LINE>fiducialToPixel.transform(fidPt, pixel3);<NEW_LINE>polyX[0] = (int) (pixel0.x + 0.5);<NEW_LINE>polyX[1] = (int) (pixel1.x + 0.5);<NEW_LINE>polyX[2] = (int) (pixel2.x + 0.5);<NEW_LINE>polyX[3] = (int) (pixel3.x + 0.5);<NEW_LINE>polyY[0] = (int) (pixel0.y + 0.5);<NEW_LINE>polyY[1] = (int) (pixel1.y + 0.5);<NEW_LINE>polyY[2] = (int) (pixel2.y + 0.5);<NEW_LINE>polyY[3] = (int<MASK><NEW_LINE>g2.setColor(black);<NEW_LINE>g2.fillPolygon(polyX, polyY, 4);<NEW_LINE>g2.setColor(red);<NEW_LINE>drawLine(g2, l, pixel0.x, pixel0.y, pixel1.x, pixel1.y);<NEW_LINE>drawLine(g2, l, pixel1.x, pixel1.y, pixel2.x, pixel2.y);<NEW_LINE>drawLine(g2, l, pixel2.x, pixel2.y, pixel3.x, pixel3.y);<NEW_LINE>drawLine(g2, l, pixel3.x, pixel3.y, pixel0.x, pixel0.y);<NEW_LINE>}<NEW_LINE>}<NEW_LINE>} | ) (pixel3.y + 0.5); |
1,233,938 | protected void generateKeyStore(File keyStore, String keyStoreAlias, String keyStorePassword, String keyPassword, String distinguishedName) throws MojoExecutionException, MojoFailureException {<NEW_LINE>getLog().info("Generating keystore in: " + keyStore);<NEW_LINE>try {<NEW_LINE>// generated folder if it does not exist<NEW_LINE>Files.createDirectories(keyStore.getParentFile().toPath());<NEW_LINE>List<String> command = new ArrayList<>();<NEW_LINE>command.add(getEnvironmentRelativeExecutablePath() + "keytool");<NEW_LINE>command.add("-genkeypair");<NEW_LINE>command.add("-keystore");<NEW_LINE>command.add(keyStore.getPath());<NEW_LINE>command.add("-alias");<NEW_LINE>command.add(keyStoreAlias);<NEW_LINE>command.add("-storepass");<NEW_LINE>command.add(keyStorePassword);<NEW_LINE>command.add("-keypass");<NEW_LINE>command.add(keyPassword);<NEW_LINE>command.add("-dname");<NEW_LINE>command.add(distinguishedName);<NEW_LINE>command.add("-sigalg");<NEW_LINE>command.add("SHA256withRSA");<NEW_LINE>command.add("-validity");<NEW_LINE>command.add("100");<NEW_LINE>command.add("-keyalg");<NEW_LINE>command.add("RSA");<NEW_LINE>command.add("-keysize");<NEW_LINE>command.add("2048");<NEW_LINE>Optional.ofNullable(additionalKeytoolParameters).ifPresent(additionalParameters -> {<NEW_LINE>command.addAll(additionalParameters);<NEW_LINE>});<NEW_LINE>if (verbose) {<NEW_LINE>command.add("-v");<NEW_LINE>}<NEW_LINE>ProcessBuilder pb = new ProcessBuilder().inheritIO().command(command);<NEW_LINE><MASK><NEW_LINE>p.waitFor();<NEW_LINE>} catch (IOException | InterruptedException ex) {<NEW_LINE>throw new MojoExecutionException("There was an exception while generating keystore.", ex);<NEW_LINE>}<NEW_LINE>} | Process p = pb.start(); |
1,398,103 | protected void extract(CrawlURI curi, CharSequence cs) {<NEW_LINE>Source source = new Source(cs);<NEW_LINE>List<Element> elements = <MASK><NEW_LINE>for (Element element : elements) {<NEW_LINE>String elementName = element.getName();<NEW_LINE>Attributes attributes;<NEW_LINE>if (elementName.equals(HTMLElementName.META)) {<NEW_LINE>if (processMeta(curi, element)) {<NEW_LINE>// meta tag included NOFOLLOW; abort processing<NEW_LINE>break;<NEW_LINE>}<NEW_LINE>} else if (elementName.equals(HTMLElementName.SCRIPT)) {<NEW_LINE>processScript(curi, element);<NEW_LINE>} else if (elementName.equals(HTMLElementName.STYLE)) {<NEW_LINE>processStyle(curi, element);<NEW_LINE>} else if (elementName.equals(HTMLElementName.FORM)) {<NEW_LINE>processForm(curi, element);<NEW_LINE>} else if (!(attributes = element.getAttributes()).isEmpty()) {<NEW_LINE>processGeneralTag(curi, element, attributes);<NEW_LINE>}<NEW_LINE>}<NEW_LINE>} | source.findAllElements(StartTagType.NORMAL); |
725,627 | private void createOtherMenuItem(final Menu menu) {<NEW_LINE>final IFileStore file = getFileResource();<NEW_LINE>if (file == null) {<NEW_LINE>return;<NEW_LINE>}<NEW_LINE>new MenuItem(menu, SWT.SEPARATOR);<NEW_LINE>final MenuItem menuItem = new MenuItem(menu, SWT.PUSH);<NEW_LINE>menuItem.setText(IDEWorkbenchMessages.OpenWithMenu_Other);<NEW_LINE>Listener listener = new Listener() {<NEW_LINE><NEW_LINE>public void handleEvent(Event event) {<NEW_LINE>switch(event.type) {<NEW_LINE>case SWT.Selection:<NEW_LINE>EditorSelectionDialog dialog = new EditorSelectionDialog(menu.getShell());<NEW_LINE>dialog.setMessage(NLS.bind(IDEWorkbenchMessages.OpenWithMenu_OtherDialogDescription, file.getName()));<NEW_LINE>if (dialog.open() == Window.OK) {<NEW_LINE><MASK><NEW_LINE>if (editor != null) {<NEW_LINE>openEditor(editor, editor.isOpenExternal());<NEW_LINE>}<NEW_LINE>}<NEW_LINE>break;<NEW_LINE>}<NEW_LINE>}<NEW_LINE>};<NEW_LINE>menuItem.addListener(SWT.Selection, listener);<NEW_LINE>} | IEditorDescriptor editor = dialog.getSelectedEditor(); |
1,497,548 | private void checkReactionsInMessage(int positionInAdapter, ViewHolderMessageChat holder, long chatId, AndroidMegaChatMessage megaMessage) {<NEW_LINE>if (holder == null) {<NEW_LINE>holder = (ViewHolderMessageChat) listFragment.findViewHolderForAdapterPosition(positionInAdapter);<NEW_LINE>if (holder == null) {<NEW_LINE>notifyItemChanged(positionInAdapter);<NEW_LINE>return;<NEW_LINE>}<NEW_LINE>}<NEW_LINE>MegaStringList listReactions = megaChatApi.getMessageReactions(chatId, megaMessage.<MASK><NEW_LINE>if (noReactions(listReactions, megaMessage.getMessage(), holder)) {<NEW_LINE>holder.ownMessageReactionsLayout.setVisibility(View.GONE);<NEW_LINE>holder.contactMessageReactionsLayout.setVisibility(View.GONE);<NEW_LINE>return;<NEW_LINE>}<NEW_LINE>if (isMyMessage(megaMessage.getMessage())) {<NEW_LINE>holder.ownMessageReactionsLayout.setVisibility(View.VISIBLE);<NEW_LINE>if (holder.ownReactionsAdapter != null && holder.ownReactionsAdapter.isSameAdapter(chatId, megaMessage.getMessage().getMsgId())) {<NEW_LINE>ArrayList<String> list = getReactionsList(listReactions, true);<NEW_LINE>int maxSize = getMaxWidthItem(chatId, megaMessage.getMessage().getMsgId(), list, outMetrics);<NEW_LINE>holder.ownMessageReactionsRecycler.columnWidth(maxSize);<NEW_LINE>holder.ownReactionsAdapter.setReactions(list, chatId, megaMessage.getMessage().getMsgId());<NEW_LINE>} else {<NEW_LINE>createReactionsAdapter(listReactions, true, chatId, megaMessage, holder);<NEW_LINE>}<NEW_LINE>} else {<NEW_LINE>holder.contactMessageReactionsLayout.setVisibility(View.VISIBLE);<NEW_LINE>if (holder.contactReactionsAdapter != null && holder.contactReactionsAdapter.isSameAdapter(chatId, megaMessage.getMessage().getMsgId())) {<NEW_LINE>ArrayList<String> list = getReactionsList(listReactions, true);<NEW_LINE>int maxSize = getMaxWidthItem(chatId, megaMessage.getMessage().getMsgId(), list, outMetrics);<NEW_LINE>holder.contactMessageReactionsRecycler.columnWidth(maxSize);<NEW_LINE>holder.contactReactionsAdapter.setReactions(list, chatId, megaMessage.getMessage().getMsgId());<NEW_LINE>} else {<NEW_LINE>createReactionsAdapter(listReactions, false, chatId, megaMessage, holder);<NEW_LINE>}<NEW_LINE>}<NEW_LINE>} | getMessage().getMsgId()); |
1,850,665 | public XContentBuilder toXContent(XContentBuilder builder, Params params) throws IOException {<NEW_LINE>builder.startObject();<NEW_LINE>builder.field("_index", index);<NEW_LINE>if (type != null) {<NEW_LINE>builder.field("_type", type);<NEW_LINE>}<NEW_LINE>if (id != null)<NEW_LINE>builder.field("_id", id);<NEW_LINE>if (fields != null)<NEW_LINE>builder.field("fields", fields);<NEW_LINE>// set values only when different from defaults<NEW_LINE>if (requestPositions == false)<NEW_LINE>builder.field("positions", false);<NEW_LINE>if (requestPayloads == false)<NEW_LINE>builder.field("payloads", false);<NEW_LINE>if (requestOffsets == false)<NEW_LINE>builder.field("offsets", false);<NEW_LINE>if (requestFieldStatistics == false)<NEW_LINE>builder.field("field_statistics", false);<NEW_LINE>if (requestTermStatistics)<NEW_LINE>builder.field("term_statistics", true);<NEW_LINE>if (perFieldAnalyzer != null)<NEW_LINE>builder.field("per_field_analyzer", perFieldAnalyzer);<NEW_LINE>if (docBuilder != null) {<NEW_LINE>BytesReference doc = BytesReference.bytes(docBuilder);<NEW_LINE>try (InputStream stream = doc.streamInput()) {<NEW_LINE>builder.rawField("doc", stream, docBuilder.contentType());<NEW_LINE>}<NEW_LINE>}<NEW_LINE>if (filterSettings != null) {<NEW_LINE>builder.startObject("filter");<NEW_LINE>String[] filterSettingNames = { "max_num_terms", "min_term_freq", "max_term_freq", <MASK><NEW_LINE>for (String settingName : filterSettingNames) {<NEW_LINE>if (filterSettings.containsKey(settingName))<NEW_LINE>builder.field(settingName, filterSettings.get(settingName));<NEW_LINE>}<NEW_LINE>builder.endObject();<NEW_LINE>}<NEW_LINE>builder.endObject();<NEW_LINE>return builder;<NEW_LINE>} | "min_doc_freq", "max_doc_freq", "min_word_length", "max_word_length" }; |
988,656 | private static void generateFieldMetaAttributeFunction(final StringBuilder sb, final Token token, final String containingStructName, final String outermostStruct) {<NEW_LINE>final Encoding encoding = token.encoding();<NEW_LINE>final String epoch = encoding.epoch() == null <MASK><NEW_LINE>final String timeUnit = encoding.timeUnit() == null ? "" : encoding.timeUnit();<NEW_LINE>final String semanticType = encoding.semanticType() == null ? "" : encoding.semanticType();<NEW_LINE>sb.append(String.format("\n" + "SBE_ONE_DEF const char *%6$s_%s_meta_attribute(\n" + " const enum %7$s_meta_attribute attribute)\n" + "{\n" + " switch (attribute)\n" + " {\n" + " case %7$s_meta_attribute_EPOCH: return \"%s\";\n" + " case %7$s_meta_attribute_TIME_UNIT: return \"%s\";\n" + " case %7$s_meta_attribute_SEMANTIC_TYPE: return \"%s\";\n" + " case %7$s_meta_attribute_PRESENCE: return \"%s\";\n" + " }\n\n" + " return \"\";\n" + "}\n", token.name(), epoch, timeUnit, semanticType, encoding.presence().toString().toLowerCase(), containingStructName, outermostStruct));<NEW_LINE>} | ? "" : encoding.epoch(); |
992,416 | public void readFields(DataInput in) throws IOException {<NEW_LINE>if (!isTypeRead) {<NEW_LINE>type = TableType.valueOf(Text.readString(in));<NEW_LINE>isTypeRead = true;<NEW_LINE>}<NEW_LINE>super.readFields(in);<NEW_LINE>this.id = in.readLong();<NEW_LINE>this.name = Text.readString(in);<NEW_LINE>List<Column> keys = Lists.newArrayList();<NEW_LINE>// base schema<NEW_LINE><MASK><NEW_LINE>for (int i = 0; i < columnCount; i++) {<NEW_LINE>Column column = Column.read(in);<NEW_LINE>if (column.isKey()) {<NEW_LINE>keys.add(column);<NEW_LINE>}<NEW_LINE>this.fullSchema.add(column);<NEW_LINE>this.nameToColumn.put(column.getName(), column);<NEW_LINE>}<NEW_LINE>if (keys.size() > 1) {<NEW_LINE>keys.forEach(key -> key.setCompoundKey(true));<NEW_LINE>hasCompoundKey = true;<NEW_LINE>}<NEW_LINE>comment = Text.readString(in);<NEW_LINE>// read create time<NEW_LINE>this.createTime = in.readLong();<NEW_LINE>} | int columnCount = in.readInt(); |
371,093 | public static List<String> uniquePathSubstrings(List<String> paths) {<NEW_LINE>List<Stack<String>> stackList = new ArrayList<>(paths.size());<NEW_LINE>// prepare data structures<NEW_LINE>for (String path : paths) {<NEW_LINE>List<String> directories = Arrays.asList(path.split(Pattern.<MASK><NEW_LINE>Stack<String> stack = new Stack<>();<NEW_LINE>stack.addAll(directories);<NEW_LINE>stackList.add(stack);<NEW_LINE>}<NEW_LINE>List<String> pathSubstrings = new ArrayList<>(Collections.nCopies(paths.size(), ""));<NEW_LINE>// compute shortest folder substrings<NEW_LINE>while (!stackList.stream().allMatch(Vector::isEmpty)) {<NEW_LINE>for (int i = 0; i < stackList.size(); i++) {<NEW_LINE>String tempString = pathSubstrings.get(i);<NEW_LINE>if (tempString.isEmpty() && !stackList.get(i).isEmpty()) {<NEW_LINE>pathSubstrings.set(i, stackList.get(i).pop());<NEW_LINE>} else if (!stackList.get(i).isEmpty()) {<NEW_LINE>pathSubstrings.set(i, stackList.get(i).pop() + File.separator + tempString);<NEW_LINE>}<NEW_LINE>}<NEW_LINE>for (int i = 0; i < stackList.size(); i++) {<NEW_LINE>String tempString = pathSubstrings.get(i);<NEW_LINE>if (Collections.frequency(pathSubstrings, tempString) == 1) {<NEW_LINE>stackList.get(i).clear();<NEW_LINE>}<NEW_LINE>}<NEW_LINE>}<NEW_LINE>return pathSubstrings;<NEW_LINE>} | quote(File.separator))); |
1,369,658 | public static Node fromObject(final Object obj) {<NEW_LINE>final Map<String, Object> mapObj = (Map<String, Object>) obj;<NEW_LINE>final String id = (String) mapObj.get("id");<NEW_LINE>final Node node = new Node(id);<NEW_LINE>final String jobSource = (String) mapObj.get("jobSource");<NEW_LINE>final String propSource = (String) mapObj.get("propSource");<NEW_LINE>final String jobType = (<MASK><NEW_LINE>final String embeddedFlowId = (String) mapObj.get("embeddedFlowId");<NEW_LINE>final String condition = (String) mapObj.get("condition");<NEW_LINE>final ConditionOnJobStatus conditionOnJobStatus = ConditionOnJobStatus.fromString((String) mapObj.get("conditionOnJobStatus"));<NEW_LINE>node.setJobSource(jobSource);<NEW_LINE>node.setPropsSource(propSource);<NEW_LINE>node.setType(jobType);<NEW_LINE>node.setEmbeddedFlowId(embeddedFlowId);<NEW_LINE>node.setCondition(condition);<NEW_LINE>node.setConditionOnJobStatus(conditionOnJobStatus);<NEW_LINE>final Integer expectedRuntime = (Integer) mapObj.get("expectedRuntime");<NEW_LINE>if (expectedRuntime != null) {<NEW_LINE>node.setExpectedRuntimeSec(expectedRuntime);<NEW_LINE>}<NEW_LINE>final Map<String, Object> layoutInfo = (Map<String, Object>) mapObj.get("layout");<NEW_LINE>if (layoutInfo != null) {<NEW_LINE>Double x = null;<NEW_LINE>Double y = null;<NEW_LINE>Integer level = null;<NEW_LINE>try {<NEW_LINE>x = Utils.convertToDouble(layoutInfo.get("x"));<NEW_LINE>y = Utils.convertToDouble(layoutInfo.get("y"));<NEW_LINE>level = (Integer) layoutInfo.get("level");<NEW_LINE>} catch (final ClassCastException e) {<NEW_LINE>throw new RuntimeException("Error creating node " + id, e);<NEW_LINE>}<NEW_LINE>if (x != null && y != null) {<NEW_LINE>node.setPosition(new Point2D.Double(x, y));<NEW_LINE>}<NEW_LINE>if (level != null) {<NEW_LINE>node.setLevel(level);<NEW_LINE>}<NEW_LINE>}<NEW_LINE>return node;<NEW_LINE>} | String) mapObj.get("jobType"); |
753,715 | ESeq info() {<NEW_LINE>ESeq rep = ERT.NIL;<NEW_LINE>ETable table = this;<NEW_LINE>rep = rep.cons(new ETuple2(Native.am_owner, table.owner_pid()));<NEW_LINE>rep = rep.cons(new ETuple2(Native.am_named_table, ERT.box(table.is_named)));<NEW_LINE>rep = rep.cons(new ETuple2(Native<MASK><NEW_LINE>if (table.heirPID != null)<NEW_LINE>rep = rep.cons(new ETuple2(Native.am_heir, table.heirPID));<NEW_LINE>else<NEW_LINE>rep = rep.cons(new ETuple2(Native.am_heir, Native.am_none));<NEW_LINE>rep = rep.cons(new ETuple2(Native.am_size, ERT.box(table.size())));<NEW_LINE>rep = rep.cons(new ETuple2(Native.am_node, ERT.getLocalNode().node()));<NEW_LINE>rep = rep.cons(new ETuple2(Native.am_type, table.type));<NEW_LINE>rep = rep.cons(new ETuple2(Native.am_keypos, ERT.box(table.keypos1)));<NEW_LINE>rep = rep.cons(new ETuple2(Native.am_protection, table.access));<NEW_LINE>rep = rep.cons(new ETuple2(Native.am_fixed, ERT.box(is_fixed)));<NEW_LINE>return rep;<NEW_LINE>} | .am_name, table.aname)); |
356,401 | public Predicate<T> predicate(BinaryExpression expression) {<NEW_LINE>switch(expression.operator) {<NEW_LINE>case and:<NEW_LINE>return predicate(expression.left).and(predicate(expression.right));<NEW_LINE>case or:<NEW_LINE>return predicate(expression.left).or(predicate(expression.right));<NEW_LINE>case equalTo:<NEW_LINE>return new PropertyEqualToRule<>(property(expression));<NEW_LINE>case notEqualTo:<NEW_LINE>return new PropertyEqualToRule<T>(property(expression)).negate();<NEW_LINE>case in:<NEW_LINE>return new PropertyInRule<MASK><NEW_LINE>case notIn:<NEW_LINE>return new PropertyInRule<T>(properties(expression)).negate();<NEW_LINE>case greaterThan:<NEW_LINE>return new PropertyGreaterThanRule<>(property(expression));<NEW_LINE>case greaterThanEqual:<NEW_LINE>return new PropertyGreaterThanRule<>(property(expression), true);<NEW_LINE>case lessThan:<NEW_LINE>return new PropertyLessThanRule<>(property(expression));<NEW_LINE>case lessThanEqual:<NEW_LINE>return new PropertyLessThanRule<>(property(expression), true);<NEW_LINE>case between:<NEW_LINE>List<Comparable<Property>> properties = properties(expression);<NEW_LINE>return new PropertyInRangeRule<>(properties.get(0), properties.get(1), true);<NEW_LINE>case contains:<NEW_LINE>return new PropertyContainsRule<>(property(expression), literal(expression));<NEW_LINE>case matches:<NEW_LINE>return new PropertyMatchesRule<>(property(expression), literal(expression));<NEW_LINE>}<NEW_LINE>throw new IllegalArgumentException("Not a valid filter");<NEW_LINE>} | <>(properties(expression)); |
217,875 | protected Object createNode(JSContext context, JSBuiltin builtin, boolean construct, boolean newTarget, Reflect builtinEnum) {<NEW_LINE>assert context.getEcmaScriptVersion() >= 6;<NEW_LINE>switch(builtinEnum) {<NEW_LINE>case apply:<NEW_LINE>return ReflectApplyNodeGen.create(context, builtin, args().fixedArgs(3).createArgumentNodes(context));<NEW_LINE>case construct:<NEW_LINE>return ReflectConstructNodeGen.create(context, builtin, args().fixedArgs(2).varArgs().createArgumentNodes(context));<NEW_LINE>case defineProperty:<NEW_LINE>return ReflectDefinePropertyNodeGen.create(context, builtin, args().fixedArgs(<MASK><NEW_LINE>case deleteProperty:<NEW_LINE>return ReflectDeletePropertyNodeGen.create(context, builtin, args().fixedArgs(2).createArgumentNodes(context));<NEW_LINE>case get:<NEW_LINE>return ReflectGetNodeGen.create(context, builtin, args().fixedArgs(2).varArgs().createArgumentNodes(context));<NEW_LINE>case getOwnPropertyDescriptor:<NEW_LINE>return ReflectGetOwnPropertyDescriptorNodeGen.create(context, builtin, args().fixedArgs(2).createArgumentNodes(context));<NEW_LINE>case getPrototypeOf:<NEW_LINE>return ReflectGetPrototypeOfNodeGen.create(context, builtin, args().fixedArgs(1).createArgumentNodes(context));<NEW_LINE>case has:<NEW_LINE>return ReflectHasNodeGen.create(context, builtin, args().fixedArgs(2).createArgumentNodes(context));<NEW_LINE>case isExtensible:<NEW_LINE>return ReflectIsExtensibleNodeGen.create(context, builtin, args().fixedArgs(1).createArgumentNodes(context));<NEW_LINE>case ownKeys:<NEW_LINE>return ReflectOwnKeysNodeGen.create(context, builtin, args().fixedArgs(1).createArgumentNodes(context));<NEW_LINE>case preventExtensions:<NEW_LINE>return ReflectPreventExtensionsNodeGen.create(context, builtin, args().fixedArgs(1).createArgumentNodes(context));<NEW_LINE>case set:<NEW_LINE>return ReflectSetNodeGen.create(context, builtin, args().fixedArgs(3).varArgs().createArgumentNodes(context));<NEW_LINE>case setPrototypeOf:<NEW_LINE>return ReflectSetPrototypeOfNodeGen.create(context, builtin, args().fixedArgs(2).createArgumentNodes(context));<NEW_LINE>}<NEW_LINE>return null;<NEW_LINE>} | 3).createArgumentNodes(context)); |
39,977 | public void removeFavorite(Long nodeId, String xSdsAuthToken) throws ApiException {<NEW_LINE>Object localVarPostBody = null;<NEW_LINE>// verify the required parameter 'nodeId' is set<NEW_LINE>if (nodeId == null) {<NEW_LINE>throw new ApiException(400, "Missing the required parameter 'nodeId' when calling removeFavorite");<NEW_LINE>}<NEW_LINE>// create path and map variables<NEW_LINE>String localVarPath = "/v4/nodes/{node_id}/favorite".replaceAll("\\{" + "node_id" + "\\}", apiClient.escapeString(nodeId.toString()));<NEW_LINE>// query params<NEW_LINE>List<Pair> localVarQueryParams = new ArrayList<Pair>();<NEW_LINE>Map<String, String> localVarHeaderParams = new HashMap<String, String>();<NEW_LINE>Map<String, Object> localVarFormParams = new HashMap<String, Object>();<NEW_LINE>if (xSdsAuthToken != null)<NEW_LINE>localVarHeaderParams.put("X-Sds-Auth-Token", apiClient.parameterToString(xSdsAuthToken));<NEW_LINE>final String[] localVarAccepts = { "application/json" };<NEW_LINE>final String localVarAccept = apiClient.selectHeaderAccept(localVarAccepts);<NEW_LINE>final String[] localVarContentTypes = {};<NEW_LINE>final String localVarContentType = apiClient.selectHeaderContentType(localVarContentTypes);<NEW_LINE>String[] localVarAuthNames = new String[] { "oauth2" };<NEW_LINE>apiClient.invokeAPI(localVarPath, "DELETE", localVarQueryParams, localVarPostBody, localVarHeaderParams, localVarFormParams, <MASK><NEW_LINE>} | localVarAccept, localVarContentType, localVarAuthNames, null); |
143,663 | protected void doCommit(TableMetadata base, TableMetadata metadata) {<NEW_LINE>String newMetadataLocation = writeNewMetadata(metadata, currentVersion() + 1);<NEW_LINE>if (base == null) {<NEW_LINE>// create a new table, the metadataKey should be absent<NEW_LINE>if (!catalog.putNewProperties(tableObject, buildProperties(newMetadataLocation))) {<NEW_LINE>throw new CommitFailedException("Table is existing when create table %s", tableName());<NEW_LINE>}<NEW_LINE>} else {<NEW_LINE>String cachedETag = eTag;<NEW_LINE><MASK><NEW_LINE>// replace to a new version, the E-Tag should be present and matched<NEW_LINE>boolean result = catalog.updatePropertiesObject(tableObject, cachedETag, buildProperties(newMetadataLocation));<NEW_LINE>if (!result) {<NEW_LINE>throw new CommitFailedException("Replace failed, E-Tag %s mismatch for table %s", cachedETag, tableName());<NEW_LINE>}<NEW_LINE>}<NEW_LINE>} | Preconditions.checkNotNull(cachedETag, "E-Tag must be not null when update table"); |
67,270 | private ExecutorService buildExecutor(int numberOfTasks) {<NEW_LINE>int threadCount = Math.min(numberOfTasks, myThreadCount);<NEW_LINE>assert (threadCount > 0);<NEW_LINE>ourLog.info(myProcessName + " with {} threads", threadCount);<NEW_LINE>LinkedBlockingQueue<Runnable> executorQueue <MASK><NEW_LINE>BasicThreadFactory threadFactory = new BasicThreadFactory.Builder().namingPattern(myThreadPrefix + "-%d").daemon(false).priority(Thread.NORM_PRIORITY).build();<NEW_LINE>RejectedExecutionHandler rejectedExecutionHandler = (theRunnable, theExecutor) -> {<NEW_LINE>ourLog.info("Note: " + myThreadPrefix + " executor queue is full ({} elements), waiting for a slot to become available!", executorQueue.size());<NEW_LINE>StopWatch sw = new StopWatch();<NEW_LINE>try {<NEW_LINE>executorQueue.put(theRunnable);<NEW_LINE>} catch (InterruptedException e) {<NEW_LINE>throw new RejectedExecutionException(Msg.code(1086) + "Task " + theRunnable.toString() + " rejected from " + e);<NEW_LINE>}<NEW_LINE>ourLog.info("Slot become available after {}ms", sw.getMillis());<NEW_LINE>};<NEW_LINE>return new ThreadPoolExecutor(threadCount, MAX_POOL_SIZE, 0L, TimeUnit.MILLISECONDS, executorQueue, threadFactory, rejectedExecutionHandler);<NEW_LINE>} | = new LinkedBlockingQueue<>(MAX_POOL_SIZE); |
1,679,405 | private void preinitJavaInfrastructure() throws IOException {<NEW_LINE>if (needClassPathInit) {<NEW_LINE>try {<NEW_LINE>ClasspathInfo cpInfo = mappings.runReadActionWhenReady(new MetadataModelAction<EntityMappingsMetadata, ClasspathInfo>() {<NEW_LINE><NEW_LINE>@Override<NEW_LINE>public ClasspathInfo run(EntityMappingsMetadata metadata) {<NEW_LINE>return metadata.createJavaSource().getClasspathInfo();<NEW_LINE>}<NEW_LINE>}).get();<NEW_LINE>GlobalPathRegistry.getDefault().register(ClassPath.BOOT, new ClassPath[] { cpInfo.getClassPath(PathKind.BOOT) });<NEW_LINE>GlobalPathRegistry.getDefault().register(ClassPath.COMPILE, new ClassPath[] { cpInfo.getClassPath(PathKind.COMPILE) });<NEW_LINE>GlobalPathRegistry.getDefault().register(ClassPath.SOURCE, new ClassPath[] { cpInfo.<MASK><NEW_LINE>} catch (InterruptedException ex) {<NEW_LINE>Logger.getLogger(getClass().getName()).log(Level.INFO, ex.getMessage(), ex);<NEW_LINE>} catch (ExecutionException ex) {<NEW_LINE>Logger.getLogger(getClass().getName()).log(Level.INFO, ex.getMessage(), ex);<NEW_LINE>} catch (MetadataModelException ex) {<NEW_LINE>Logger.getLogger(getClass().getName()).log(Level.INFO, ex.getMessage(), ex);<NEW_LINE>}<NEW_LINE>}<NEW_LINE>} | getClassPath(PathKind.SOURCE) }); |
318,786 | public PatchOperation unmarshall(JsonUnmarshallerContext context) throws Exception {<NEW_LINE>PatchOperation patchOperation = new PatchOperation();<NEW_LINE>int originalDepth = context.getCurrentDepth();<NEW_LINE><MASK><NEW_LINE>int targetDepth = originalDepth + 1;<NEW_LINE>JsonToken token = context.getCurrentToken();<NEW_LINE>if (token == null)<NEW_LINE>token = context.nextToken();<NEW_LINE>if (token == VALUE_NULL) {<NEW_LINE>return null;<NEW_LINE>}<NEW_LINE>while (true) {<NEW_LINE>if (token == null)<NEW_LINE>break;<NEW_LINE>if (token == FIELD_NAME || token == START_OBJECT) {<NEW_LINE>if (context.testExpression("op", targetDepth)) {<NEW_LINE>context.nextToken();<NEW_LINE>patchOperation.setOp(context.getUnmarshaller(String.class).unmarshall(context));<NEW_LINE>}<NEW_LINE>if (context.testExpression("path", targetDepth)) {<NEW_LINE>context.nextToken();<NEW_LINE>patchOperation.setPath(context.getUnmarshaller(String.class).unmarshall(context));<NEW_LINE>}<NEW_LINE>if (context.testExpression("value", targetDepth)) {<NEW_LINE>context.nextToken();<NEW_LINE>patchOperation.setValue(context.getUnmarshaller(String.class).unmarshall(context));<NEW_LINE>}<NEW_LINE>if (context.testExpression("from", targetDepth)) {<NEW_LINE>context.nextToken();<NEW_LINE>patchOperation.setFrom(context.getUnmarshaller(String.class).unmarshall(context));<NEW_LINE>}<NEW_LINE>} else if (token == END_ARRAY || token == END_OBJECT) {<NEW_LINE>if (context.getLastParsedParentElement() == null || context.getLastParsedParentElement().equals(currentParentElement)) {<NEW_LINE>if (context.getCurrentDepth() <= originalDepth)<NEW_LINE>break;<NEW_LINE>}<NEW_LINE>}<NEW_LINE>token = context.nextToken();<NEW_LINE>}<NEW_LINE>return patchOperation;<NEW_LINE>} | String currentParentElement = context.getCurrentParentElement(); |
1,228,568 | protected void encodeDefaultContent(FacesContext context, Chip chip) throws IOException {<NEW_LINE><MASK><NEW_LINE>if (chip.getImage() != null) {<NEW_LINE>writer.startElement("img", null);<NEW_LINE>writer.writeAttribute("src", chip.getImage(), null);<NEW_LINE>writer.endElement("img");<NEW_LINE>} else if (chip.getIcon() != null) {<NEW_LINE>String iconStyleClass = getStyleClassBuilder(context).add(Chip.ICON_CLASS).add(chip.getIcon()).build();<NEW_LINE>writer.startElement("span", chip);<NEW_LINE>writer.writeAttribute("class", iconStyleClass, null);<NEW_LINE>writer.endElement("span");<NEW_LINE>}<NEW_LINE>if (chip.getLabel() != null) {<NEW_LINE>writer.startElement("div", chip);<NEW_LINE>writer.writeAttribute("class", Chip.TEXT_CLASS, null);<NEW_LINE>writer.writeText(chip.getLabel(), "label");<NEW_LINE>writer.endElement("div");<NEW_LINE>}<NEW_LINE>if (chip.getRemovable()) {<NEW_LINE>String removeIconStyleClass = getStyleClassBuilder(context).add(Chip.REMOVE_ICON_CLASS).add(chip.getRemoveIcon()).build();<NEW_LINE>writer.startElement("span", chip);<NEW_LINE>writer.writeAttribute("tabindex", "0", null);<NEW_LINE>writer.writeAttribute("class", removeIconStyleClass, null);<NEW_LINE>writer.endElement("span");<NEW_LINE>}<NEW_LINE>} | ResponseWriter writer = context.getResponseWriter(); |
1,677,501 | protected int initialAssignToNearestCluster() {<NEW_LINE>assert k == means.length;<NEW_LINE>for (DBIDIter it = relation.iterDBIDs(); it.valid(); it.advance()) {<NEW_LINE>NumberVector fv = relation.get(it);<NEW_LINE>double[] us = usim.get(it);<NEW_LINE>// Check all (other) means:<NEW_LINE>double best = us[0] = similarity(fv, means[0]);<NEW_LINE>int maxIndex = 0;<NEW_LINE>for (int j = 1; j < k; j++) {<NEW_LINE>double sim = us[j] = similarity(fv, means[j]);<NEW_LINE>if (sim > best) {<NEW_LINE>maxIndex = j;<NEW_LINE>best = sim;<NEW_LINE>}<NEW_LINE>}<NEW_LINE>// Assign to nearest cluster.<NEW_LINE>clusters.get<MASK><NEW_LINE>assignment.putInt(it, maxIndex);<NEW_LINE>plusEquals(sums[maxIndex], fv);<NEW_LINE>lsim.putDouble(it, best);<NEW_LINE>}<NEW_LINE>return relation.size();<NEW_LINE>} | (maxIndex).add(it); |
1,198,634 | public Object apply(final ActionContext ctx, final Object caller, final Object[] sources) throws FrameworkException {<NEW_LINE>try {<NEW_LINE>assertArrayHasMinLengthAndTypes(sources, 4, String.class, String.class, String.class, String.class, Map.class);<NEW_LINE>final Map<String, Object> <MASK><NEW_LINE>final String url = sources[0].toString();<NEW_LINE>final String username = sources[1].toString();<NEW_LINE>final String password = sources[2].toString();<NEW_LINE>final String query = sources[3].toString();<NEW_LINE>// parameters?<NEW_LINE>if (sources.length > 4 && sources[4] != null && sources[4] instanceof Map) {<NEW_LINE>params.putAll((Map) sources[4]);<NEW_LINE>}<NEW_LINE>final Driver driver = getDriver(url, username, password);<NEW_LINE>if (driver != null) {<NEW_LINE>try (final Session session = driver.session()) {<NEW_LINE>final Result result = session.run(query, params);<NEW_LINE>final List<Map<String, Object>> list = result.list(r -> {<NEW_LINE>return r.asMap();<NEW_LINE>});<NEW_LINE>return extractRows(ctx.getSecurityContext(), list);<NEW_LINE>}<NEW_LINE>}<NEW_LINE>return null;<NEW_LINE>} catch (ArgumentNullException pe) {<NEW_LINE>// silently ignore null arguments<NEW_LINE>return null;<NEW_LINE>} catch (ArgumentCountException pe) {<NEW_LINE>logParameterError(caller, sources, pe.getMessage(), ctx.isJavaScriptContext());<NEW_LINE>return usage(ctx.isJavaScriptContext());<NEW_LINE>}<NEW_LINE>} | params = new LinkedHashMap<>(); |
1,229,677 | private void browseButtonActionPerformed(ActionEvent evt) {<NEW_LINE>if (file == null) {<NEW_LINE>// Panel has not initialised fully yet.<NEW_LINE>return;<NEW_LINE>}<NEW_LINE>ResourceHolder rh = i18nString.getSupport().getResourceHolder();<NEW_LINE>DataObject template;<NEW_LINE>try {<NEW_LINE>Class resourceClass = <MASK><NEW_LINE>template = rh.getTemplate(resourceClass);<NEW_LINE>if (template == null) {<NEW_LINE>// #175881<NEW_LINE>throw new NullPointerException(// NOI18N<NEW_LINE>"A template is not created for the class " + resourceClass + "\nPlease, check an implementation of " + "the createTemplate(Class) method " + "for the following resource holder:\n" + rh.toString());<NEW_LINE>}<NEW_LINE>} catch (IOException ex) {<NEW_LINE>ErrorManager.getDefault().notify(ex);<NEW_LINE>return;<NEW_LINE>} catch (NullPointerException ex) {<NEW_LINE>ErrorManager.getDefault().notify(ex);<NEW_LINE>return;<NEW_LINE>}<NEW_LINE>DataObject resource = SelectorUtils.selectOrCreateBundle(file, template, i18nString.getSupport().getResourceHolder().getResource());<NEW_LINE>// DataObject resource = SelectorUtils.selectBundle(this.project, file);<NEW_LINE>if (resource != null) {<NEW_LINE>changeResource(resource);<NEW_LINE>// NOI18N<NEW_LINE>warningLabel.setText("");<NEW_LINE>}<NEW_LINE>} | rh.getResourceClasses()[0]; |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.