idx int32 46 1.86M | input stringlengths 321 6.6k | target stringlengths 9 1.24k |
|---|---|---|
445,391 | @ResponseBody<NEW_LINE>public PersistableProductReview createProductReview(@PathVariable final String store, @Valid @RequestBody PersistableProductReview review, HttpServletRequest request, HttpServletResponse response) throws Exception {<NEW_LINE>try {<NEW_LINE>MerchantStore merchantStore = (MerchantStore) request.getAttribute(Constants.MERCHANT_STORE);<NEW_LINE>if (merchantStore != null) {<NEW_LINE>if (!merchantStore.getCode().equals(store)) {<NEW_LINE>merchantStore = null;<NEW_LINE>}<NEW_LINE>}<NEW_LINE>if (merchantStore == null) {<NEW_LINE>merchantStore = merchantStoreService.getByCode(store);<NEW_LINE>}<NEW_LINE>if (merchantStore == null) {<NEW_LINE>LOGGER.error("Merchant store is null for code " + store);<NEW_LINE>response.<MASK><NEW_LINE>return null;<NEW_LINE>}<NEW_LINE>// rating already exist<NEW_LINE>ProductReview prodReview = productReviewService.getByProductAndCustomer(review.getProductId(), review.getCustomerId());<NEW_LINE>if (prodReview != null) {<NEW_LINE>response.sendError(500, "A review already exist for this customer and product");<NEW_LINE>return null;<NEW_LINE>}<NEW_LINE>// rating maximum 5<NEW_LINE>if (review.getRating() > Constants.MAX_REVIEW_RATING_SCORE) {<NEW_LINE>response.sendError(503, "Maximum rating score is " + Constants.MAX_REVIEW_RATING_SCORE);<NEW_LINE>return null;<NEW_LINE>}<NEW_LINE>PersistableProductReviewPopulator populator = new PersistableProductReviewPopulator();<NEW_LINE>populator.setLanguageService(languageService);<NEW_LINE>populator.setCustomerService(customerService);<NEW_LINE>populator.setProductService(productService);<NEW_LINE>com.salesmanager.core.model.catalog.product.review.ProductReview rev = new com.salesmanager.core.model.catalog.product.review.ProductReview();<NEW_LINE>populator.populate(review, rev, merchantStore, merchantStore.getDefaultLanguage());<NEW_LINE>productReviewService.create(rev);<NEW_LINE>review.setId(rev.getId());<NEW_LINE>return review;<NEW_LINE>} catch (Exception e) {<NEW_LINE>LOGGER.error("Error while saving product review", e);<NEW_LINE>try {<NEW_LINE>response.sendError(503, "Error while saving product review" + e.getMessage());<NEW_LINE>} catch (Exception ignore) {<NEW_LINE>}<NEW_LINE>return null;<NEW_LINE>}<NEW_LINE>} | sendError(500, "Merchant store is null for code " + store); |
225,337 | final GetRateBasedRuleResult executeGetRateBasedRule(GetRateBasedRuleRequest getRateBasedRuleRequest) {<NEW_LINE>ExecutionContext executionContext = createExecutionContext(getRateBasedRuleRequest);<NEW_LINE><MASK><NEW_LINE>awsRequestMetrics.startEvent(Field.ClientExecuteTime);<NEW_LINE>Request<GetRateBasedRuleRequest> request = null;<NEW_LINE>Response<GetRateBasedRuleResult> response = null;<NEW_LINE>try {<NEW_LINE>awsRequestMetrics.startEvent(Field.RequestMarshallTime);<NEW_LINE>try {<NEW_LINE>request = new GetRateBasedRuleRequestProtocolMarshaller(protocolFactory).marshall(super.beforeMarshalling(getRateBasedRuleRequest));<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, "WAF Regional");<NEW_LINE>request.addHandlerContext(HandlerContextKey.OPERATION_NAME, "GetRateBasedRule");<NEW_LINE>request.addHandlerContext(HandlerContextKey.ADVANCED_CONFIG, advancedConfig);<NEW_LINE>} finally {<NEW_LINE>awsRequestMetrics.endEvent(Field.RequestMarshallTime);<NEW_LINE>}<NEW_LINE>HttpResponseHandler<AmazonWebServiceResponse<GetRateBasedRuleResult>> responseHandler = protocolFactory.createResponseHandler(new JsonOperationMetadata().withPayloadJson(true).withHasStreamingSuccessResponse(false), new GetRateBasedRuleResultJsonUnmarshaller());<NEW_LINE>response = invoke(request, responseHandler, executionContext);<NEW_LINE>return response.getAwsResponse();<NEW_LINE>} finally {<NEW_LINE>endClientExecution(awsRequestMetrics, request, response);<NEW_LINE>}<NEW_LINE>} | AWSRequestMetrics awsRequestMetrics = executionContext.getAwsRequestMetrics(); |
1,488,438 | public void testReadWrite500Contacts() throws Exception {<NEW_LINE>final List<Person> contacts = TestDataGenerator.genPersonList(500);<NEW_LINE>Paper.init(getTargetContext());<NEW_LINE>Paper<MASK><NEW_LINE>long paperTime = runTest(new PaperReadWriteContactsTest(), contacts, REPEAT_COUNT);<NEW_LINE>Hawk.init(getTargetContext());<NEW_LINE>Hawk.clear();<NEW_LINE>long hawkTime = runTest(new HawkReadWriteContactsTest(), contacts, REPEAT_COUNT);<NEW_LINE>final List<PersonArg> contactsArg = TestDataGenerator.genPersonArgList(500);<NEW_LINE>Paper.init(getTargetContext());<NEW_LINE>Paper.book().destroy();<NEW_LINE>long paperArg = runTest(new PaperReadWriteContactsArgTest(), contactsArg, REPEAT_COUNT);<NEW_LINE>printResults("Read/write 500 contacts", paperTime, hawkTime, paperArg);<NEW_LINE>} | .book().destroy(); |
1,002,650 | private static void processSingleIndexUpdate(final OIndex index, final Set<String> dirtyFields, final ODocument iRecord, List<IndexChange> changes) {<NEW_LINE>final OIndexDefinition indexDefinition = index.getDefinition();<NEW_LINE>final List<String> indexFields = indexDefinition.getFields();<NEW_LINE>if (indexFields.isEmpty())<NEW_LINE>return;<NEW_LINE>final String indexField = indexFields.get(0);<NEW_LINE>if (!dirtyFields.contains(indexField))<NEW_LINE>return;<NEW_LINE>final OMultiValueChangeTimeLine<?, ?> multiValueChangeTimeLine = iRecord.getCollectionTimeLine(indexField);<NEW_LINE>if (multiValueChangeTimeLine != null) {<NEW_LINE><MASK><NEW_LINE>final Map<Object, Integer> keysToAdd = new HashMap<>();<NEW_LINE>final Map<Object, Integer> keysToRemove = new HashMap<>();<NEW_LINE>for (OMultiValueChangeEvent<?, ?> changeEvent : multiValueChangeTimeLine.getMultiValueChangeEvents()) {<NEW_LINE>indexDefinitionMultiValue.processChangeEvent(changeEvent, keysToAdd, keysToRemove);<NEW_LINE>}<NEW_LINE>for (final Object keyToRemove : keysToRemove.keySet()) addRemove(changes, index, keyToRemove, iRecord);<NEW_LINE>for (final Object keyToAdd : keysToAdd.keySet()) addPut(changes, index, keyToAdd, iRecord.getIdentity());<NEW_LINE>} else {<NEW_LINE>final Object origValue = indexDefinition.createValue(iRecord.getOriginalValue(indexField));<NEW_LINE>final Object newValue = indexDefinition.getDocumentValueToIndex(iRecord);<NEW_LINE>processIndexUpdateFieldAssignment(index, iRecord, origValue, newValue, changes);<NEW_LINE>}<NEW_LINE>} | final OIndexDefinitionMultiValue indexDefinitionMultiValue = (OIndexDefinitionMultiValue) indexDefinition; |
1,183,603 | public void onClick(View view) {<NEW_LINE>Context context = getContext();<NEW_LINE>int id = view.getId();<NEW_LINE>if (id == R.id.btn_by_email) {<NEW_LINE>Intent sendIntent = new Intent(Intent.ACTION_SEND);<NEW_LINE>sendIntent.putExtra(Intent.EXTRA_EMAIL, new String[] { context.getString(R.string.my_email) });<NEW_LINE>sendIntent.setType("message/rfc822");<NEW_LINE>Intent chooserIntent = Intent.createChooser(sendIntent, context.getString<MASK><NEW_LINE>context.startActivity(chooserIntent);<NEW_LINE>} else if (id == R.id.btn_by_gh4a) {<NEW_LINE>Intent intent = IssueListActivity.makeIntent(context, context.getString(R.string.my_username), context.getString(R.string.my_repo));<NEW_LINE>context.startActivity(intent);<NEW_LINE>} else if (id == R.id.btn_gh4a) {<NEW_LINE>Intent intent = RepositoryActivity.makeIntent(context, context.getString(R.string.my_username), context.getString(R.string.my_repo));<NEW_LINE>context.startActivity(intent);<NEW_LINE>}<NEW_LINE>} | (R.string.send_email_title)); |
1,266,907 | private DomainSecurity processDomainSecurity(File configDir) throws IOException, RepositoryException {<NEW_LINE>String user = (String) domainConfig.get(DomainConfig.K_USER);<NEW_LINE>String password = (String) domainConfig.get(DomainConfig.K_PASSWORD);<NEW_LINE>String[] adminUserGroups = ((String) domainConfig.get(DomainConfig.<MASK><NEW_LINE>String masterPassword = (String) domainConfig.get(DomainConfig.K_MASTER_PASSWORD);<NEW_LINE>Boolean saveMasterPassword = (Boolean) domainConfig.get(DomainConfig.K_SAVE_MASTER_PASSWORD);<NEW_LINE>// Process domain security.<NEW_LINE>DomainSecurity domainSecurity = new DomainSecurity();<NEW_LINE>domainSecurity.processAdminKeyFile(new File(configDir, DomainConstants.ADMIN_KEY_FILE), user, password, adminUserGroups);<NEW_LINE>try {<NEW_LINE>domainSecurity.createSSLCertificateDatabase(configDir, domainConfig, masterPassword);<NEW_LINE>} catch (Exception e) {<NEW_LINE>LOGGER.log(Level.SEVERE, STRINGS.getString("SomeProblemWithKeytool", e.getMessage()));<NEW_LINE>FileOutputStream fos = null;<NEW_LINE>try {<NEW_LINE>File keystoreFile = new File(configDir, DomainConstants.KEYSTORE_FILE);<NEW_LINE>fos = new FileOutputStream(keystoreFile);<NEW_LINE>fos.write(keystoreBytes);<NEW_LINE>} catch (Exception ex) {<NEW_LINE>getLogger().log(Level.SEVERE, UNHANDLED_EXCEPTION, ex);<NEW_LINE>} finally {<NEW_LINE>if (fos != null) {<NEW_LINE>fos.close();<NEW_LINE>}<NEW_LINE>}<NEW_LINE>}<NEW_LINE>domainSecurity.changeMasterPasswordInMasterPasswordFile(new File(configDir, DomainConstants.MASTERPASSWORD_FILE), masterPassword, saveMasterPassword);<NEW_LINE>domainSecurity.createPasswordAliasKeystore(new File(configDir, DomainConstants.DOMAIN_PASSWORD_FILE), masterPassword);<NEW_LINE>return domainSecurity;<NEW_LINE>} | K_INITIAL_ADMIN_USER_GROUPS)).split(","); |
1,037,248 | private PipelineFactory createConsumeSideExchangeFactory(ExecutorFactory parentFactory, PipelineFragment pipelineFragment, LocalExchange localExchange, ExecutorFactory childFactory, PipelineFragment childFragment, List<DataType> columnMetaList, boolean isBuffer) {<NEW_LINE>OutputBufferMemoryManager localBufferManager = createLocalMemoryManager();<NEW_LINE>if (isBuffer) {<NEW_LINE>LocalBufferExecutorFactory localBufferExecutorFactory = new LocalBufferExecutorFactory(localBufferManager, columnMetaList, pipelineFragment.getParallelism());<NEW_LINE><MASK><NEW_LINE>// generate local-buffer consume pipelineFactory<NEW_LINE>LocalExchangeConsumerFactory consumerFactory = new LocalExchangeConsumerFactory(localBufferExecutorFactory, localBufferManager, localExchange);<NEW_LINE>PipelineFactory consumerPipeFactory = new PipelineFactory(childFactory, consumerFactory, childFragment.setPipelineId(pipelineIdGen++));<NEW_LINE>pipelineFactorys.add(consumerPipeFactory);<NEW_LINE>// generate local-buffer produce pipelineFactory<NEW_LINE>LocalBufferNode localBufferNode = LocalBufferNode.create(childFragment.getRoot());<NEW_LINE>PipelineFragment produceFragment = new PipelineFragment(pipelineFragment.getParallelism(), localBufferNode, childFragment.getDependency());<NEW_LINE>produceFragment.addChild(childFragment);<NEW_LINE>PipelineFactory producePipelineFactory = new PipelineFactory(localBufferExecutorFactory, localConsumerFactory, produceFragment.setPipelineId(pipelineIdGen++));<NEW_LINE>pipelineFactorys.add(producePipelineFactory);<NEW_LINE>pipelineFragment.addDependency(consumerPipeFactory.getPipelineId());<NEW_LINE>pipelineFragment.addDependency(producePipelineFactory.getPipelineId());<NEW_LINE>pipelineFragment.addBufferNodeChild(localBufferNode.getInput().getRelatedId(), produceFragment);<NEW_LINE>return producePipelineFactory;<NEW_LINE>} else {<NEW_LINE>// generate child's pipelineFactory<NEW_LINE>LocalExchangeConsumerFactory consumerFactory = new LocalExchangeConsumerFactory(parentFactory, localBufferManager, localExchange);<NEW_LINE>PipelineFactory childPipelineFactory = new PipelineFactory(childFactory, consumerFactory, childFragment.setPipelineId(pipelineIdGen++));<NEW_LINE>pipelineFactorys.add(childPipelineFactory);<NEW_LINE>childFragment.setBuildDepOnAllConsumers(true);<NEW_LINE>pipelineFragment.addDependency(childPipelineFactory.getPipelineId());<NEW_LINE>pipelineFragment.addChild(childFragment);<NEW_LINE>return childPipelineFactory;<NEW_LINE>}<NEW_LINE>} | LocalBufferConsumerFactory localConsumerFactory = new LocalBufferConsumerFactory(parentFactory); |
1,452,035 | void init(IClientConfig config, boolean registerMonitor) {<NEW_LINE>HttpParams params = getParams();<NEW_LINE>HttpProtocolParams.setContentCharset(params, "UTF-8");<NEW_LINE>params.setParameter(ClientPNames.CONNECTION_MANAGER_FACTORY_CLASS_NAME, ThreadSafeClientConnManager.class.getName());<NEW_LINE>HttpClientParams.setRedirecting(params, config.get(CommonClientConfigKey.FollowRedirects, true));<NEW_LINE>// set up default headers<NEW_LINE>List<Header> defaultHeaders = new ArrayList<Header>();<NEW_LINE>defaultHeaders.add(new BasicHeader("Netflix.NFHttpClient.Version", "1.0"));<NEW_LINE>defaultHeaders.add(new BasicHeader("X-netflix-httpclientname", name));<NEW_LINE>params.<MASK><NEW_LINE>connPoolCleaner = new ConnectionPoolCleaner(name, this.getConnectionManager(), connectionPoolCleanUpScheduler);<NEW_LINE>this.retriesProperty = config.getGlobalProperty(RETRIES.format(name));<NEW_LINE>this.sleepTimeFactorMsProperty = config.getGlobalProperty(SLEEP_TIME_FACTOR_MS.format(name));<NEW_LINE>setHttpRequestRetryHandler(new NFHttpMethodRetryHandler(this.name, this.retriesProperty.getOrDefault(), false, this.sleepTimeFactorMsProperty.getOrDefault()));<NEW_LINE>tracer = Monitors.newTimer(EXECUTE_TRACER + "-" + name, TimeUnit.MILLISECONDS);<NEW_LINE>if (registerMonitor) {<NEW_LINE>Monitors.registerObject(name, this);<NEW_LINE>}<NEW_LINE>maxTotalConnectionProperty = config.getDynamicProperty(CommonClientConfigKey.MaxTotalHttpConnections);<NEW_LINE>maxTotalConnectionProperty.onChange(newValue -> ((ThreadSafeClientConnManager) getConnectionManager()).setMaxTotal(newValue));<NEW_LINE>maxConnectionPerHostProperty = config.getDynamicProperty(CommonClientConfigKey.MaxHttpConnectionsPerHost);<NEW_LINE>maxConnectionPerHostProperty.onChange(newValue -> ((ThreadSafeClientConnManager) getConnectionManager()).setDefaultMaxPerRoute(newValue));<NEW_LINE>connIdleEvictTimeMilliSeconds = config.getGlobalProperty(CONN_IDLE_EVICT_TIME_MILLIS.format(name));<NEW_LINE>} | setParameter(ClientPNames.DEFAULT_HEADERS, defaultHeaders); |
503,472 | private void drawBaconHistogram(double[] histogram, int INFINITY_ID, double maxFrequency) {<NEW_LINE>StdDraw.setCanvasSize(1024, 512);<NEW_LINE>double minX = -3;<NEW_LINE>double maxX = histogram.length + 2;<NEW_LINE>double middleX = minX + (maxX - minX) / 2;<NEW_LINE>double minY = -7000;<NEW_LINE>double maxY = maxFrequency + 6000;<NEW_LINE>double middleY = minY + (maxY - minY) / 2;<NEW_LINE><MASK><NEW_LINE>StdDraw.setYscale(minY, maxY);<NEW_LINE>// Labels<NEW_LINE>String fontName = "Verdana";<NEW_LINE>Font titlesFont = new Font(fontName, Font.PLAIN, 14);<NEW_LINE>StdDraw.setFont(titlesFont);<NEW_LINE>StdDraw.text(middleX, maxFrequency + 3000, "Bacon Histogram");<NEW_LINE>StdDraw.text(-2, middleY, "Frequency", 90);<NEW_LINE>StdDraw.text(middleX, -5000, "Kevin Bacon Number");<NEW_LINE>Font graphLabelsFont = new Font(fontName, Font.PLAIN, 10);<NEW_LINE>StdDraw.setFont(graphLabelsFont);<NEW_LINE>// Y labels<NEW_LINE>for (int y = 0; y <= maxFrequency; y += 2000) {<NEW_LINE>StdDraw.text(-0.8, y, String.valueOf(y));<NEW_LINE>}<NEW_LINE>// X labels<NEW_LINE>for (int x = 0; x < histogram.length; x++) {<NEW_LINE>String label;<NEW_LINE>if (x != INFINITY_ID) {<NEW_LINE>label = String.valueOf(x);<NEW_LINE>} else {<NEW_LINE>label = "Infinite";<NEW_LINE>}<NEW_LINE>StdDraw.text(x, -2000, label);<NEW_LINE>}<NEW_LINE>StatsUtil.plotBars(histogram, 0.25);<NEW_LINE>} | StdDraw.setXscale(minX, maxX); |
382,032 | public void marshall(CreateSessionRequest createSessionRequest, ProtocolMarshaller protocolMarshaller) {<NEW_LINE>if (createSessionRequest == null) {<NEW_LINE>throw new SdkClientException("Invalid argument passed to marshall(...)");<NEW_LINE>}<NEW_LINE>try {<NEW_LINE>protocolMarshaller.marshall(createSessionRequest.getId(), ID_BINDING);<NEW_LINE>protocolMarshaller.marshall(createSessionRequest.getDescription(), DESCRIPTION_BINDING);<NEW_LINE>protocolMarshaller.marshall(createSessionRequest.getRole(), ROLE_BINDING);<NEW_LINE>protocolMarshaller.marshall(createSessionRequest.getCommand(), COMMAND_BINDING);<NEW_LINE>protocolMarshaller.marshall(createSessionRequest.getTimeout(), TIMEOUT_BINDING);<NEW_LINE>protocolMarshaller.marshall(createSessionRequest.getIdleTimeout(), IDLETIMEOUT_BINDING);<NEW_LINE>protocolMarshaller.marshall(createSessionRequest.getDefaultArguments(), DEFAULTARGUMENTS_BINDING);<NEW_LINE>protocolMarshaller.marshall(createSessionRequest.getConnections(), CONNECTIONS_BINDING);<NEW_LINE>protocolMarshaller.marshall(createSessionRequest.getMaxCapacity(), MAXCAPACITY_BINDING);<NEW_LINE>protocolMarshaller.marshall(<MASK><NEW_LINE>protocolMarshaller.marshall(createSessionRequest.getWorkerType(), WORKERTYPE_BINDING);<NEW_LINE>protocolMarshaller.marshall(createSessionRequest.getSecurityConfiguration(), SECURITYCONFIGURATION_BINDING);<NEW_LINE>protocolMarshaller.marshall(createSessionRequest.getGlueVersion(), GLUEVERSION_BINDING);<NEW_LINE>protocolMarshaller.marshall(createSessionRequest.getTags(), TAGS_BINDING);<NEW_LINE>protocolMarshaller.marshall(createSessionRequest.getRequestOrigin(), REQUESTORIGIN_BINDING);<NEW_LINE>} catch (Exception e) {<NEW_LINE>throw new SdkClientException("Unable to marshall request to JSON: " + e.getMessage(), e);<NEW_LINE>}<NEW_LINE>} | createSessionRequest.getNumberOfWorkers(), NUMBEROFWORKERS_BINDING); |
705,081 | ActionResult<WrapOutId> execute(String appDictFlag, String appInfoFlag, String path0, String path1) throws Exception {<NEW_LINE>try (EntityManagerContainer emc = EntityManagerContainerFactory.instance().create()) {<NEW_LINE>ActionResult<WrapOutId> result = new ActionResult<>();<NEW_LINE>Business business = new Business(emc);<NEW_LINE>AppInfo appInfo = business.<MASK><NEW_LINE>if (null == appInfo) {<NEW_LINE>throw new ExceptionAppInfoNotExist(appInfoFlag);<NEW_LINE>}<NEW_LINE>String id = business.getAppDictFactory().getWithAppInfoWithUniqueName(appInfo.getId(), appDictFlag);<NEW_LINE>if (StringUtils.isEmpty(id)) {<NEW_LINE>throw new ExceptionAppDictNotExist(appInfoFlag);<NEW_LINE>}<NEW_LINE>AppDict dict = emc.find(id, AppDict.class);<NEW_LINE>this.delete(business, dict, path0, path1);<NEW_LINE>emc.commit();<NEW_LINE>WrapOutId wrap = new WrapOutId(dict.getId());<NEW_LINE>result.setData(wrap);<NEW_LINE>return result;<NEW_LINE>}<NEW_LINE>} | getAppInfoFactory().pick(appInfoFlag); |
269,835 | private static void expandAllNodes(BeanTreeView btv, Node node, ExplorerManager mgr, ServerInstance servInst) {<NEW_LINE>Children ch = node.getChildren();<NEW_LINE>// preselect node for the specified server instance<NEW_LINE>if (servInst != null && ch == Children.LEAF && node instanceof ServerNode) {<NEW_LINE>try {<NEW_LINE>if (((ServerNode) node).getServerInstance() == servInst) {<NEW_LINE>mgr.setSelectedNodes(new Node[] { node });<NEW_LINE>}<NEW_LINE>} catch (PropertyVetoException e) {<NEW_LINE>// Ignore it<NEW_LINE>LOGGER.log(Level.FINE, null, e);<NEW_LINE>}<NEW_LINE>}<NEW_LINE>// preselect first server<NEW_LINE>if (servInst == null && ch == Children.LEAF && mgr.getSelectedNodes().length == 0) {<NEW_LINE>try {<NEW_LINE>mgr.setSelectedNodes(new Node[] { node });<NEW_LINE>} catch (PropertyVetoException e) {<NEW_LINE>// Ignore it<NEW_LINE>LOGGER.log(<MASK><NEW_LINE>}<NEW_LINE>}<NEW_LINE>Node[] nodes = ch.getNodes(true);<NEW_LINE>for (int i = 0; i < nodes.length; i++) {<NEW_LINE>expandAllNodes(btv, nodes[i], mgr, servInst);<NEW_LINE>}<NEW_LINE>} | Level.FINE, null, e); |
646,760 | private List<AccessLogItemLocation> matchAccessLogItem(String rawPattern) {<NEW_LINE>List<AccessLogItemLocation> locationList = new ArrayList<>();<NEW_LINE>int cursor = 0;<NEW_LINE>while (cursor < rawPattern.length()) {<NEW_LINE>AccessLogItemLocation candidate = null;<NEW_LINE>for (VertxRestAccessLogItemMeta meta : metaList) {<NEW_LINE>if (null != candidate && null == meta.getSuffix()) {<NEW_LINE>// TODO:<NEW_LINE>// if user define item("%{","}ab") and item("%{_","}abc") and the pattern is "%{_var}ab}abc"<NEW_LINE>// currently the result is item("%{","_var","}ab"), plaintext("}abc")<NEW_LINE>// is this acceptable?<NEW_LINE>// We've gotten an AccessLogItem with suffix, so there is no need to match those without suffix,<NEW_LINE>// just break this match loop<NEW_LINE>cursor = candidate.tail;<NEW_LINE>break;<NEW_LINE>}<NEW_LINE>if (rawPattern.startsWith(meta.getPrefix(), cursor)) {<NEW_LINE>if (null == meta.getSuffix()) {<NEW_LINE>// for simple type AccessLogItem, there is no need to try to match the next item.<NEW_LINE>candidate = new AccessLogItemLocation(cursor, meta);<NEW_LINE>cursor = candidate.tail;<NEW_LINE>break;<NEW_LINE>}<NEW_LINE>// for configurable type, like %{...}i, more check is needed<NEW_LINE>// e.g. "%{varName1}o ${varName2}i" should be divided into<NEW_LINE>// ResponseHeaderItem with varName="varName1" and RequestHeaderItem with varName="varName2"<NEW_LINE>// INSTEAD OF RequestHeaderItem with varName="varName1}o ${varName2"<NEW_LINE>int rear = rawPattern.indexOf(meta.getSuffix(), cursor);<NEW_LINE>if (rear < 0) {<NEW_LINE>continue;<NEW_LINE>}<NEW_LINE>if (null == candidate || rear < candidate.suffixIndex) {<NEW_LINE>candidate = new <MASK><NEW_LINE>}<NEW_LINE>// There is a matched item which is in front of this item, so this item is ignored.<NEW_LINE>}<NEW_LINE>}<NEW_LINE>if (candidate == null) {<NEW_LINE>++cursor;<NEW_LINE>continue;<NEW_LINE>}<NEW_LINE>locationList.add(candidate);<NEW_LINE>}<NEW_LINE>return locationList;<NEW_LINE>} | AccessLogItemLocation(cursor, rear, meta); |
114,484 | private void measureVertical(int widthMeasureSpec, int heightMeasureSpec) {<NEW_LINE>int hSize = MeasureSpec.getSize(heightMeasureSpec) - (<MASK><NEW_LINE>int count = getChildCount();<NEW_LINE>int columnHeight = 0;<NEW_LINE>int totalWidth = 0, maxColumnHeight = 0;<NEW_LINE>int columnMaxWidth = 0;<NEW_LINE>int childWidth;<NEW_LINE>int childHeight;<NEW_LINE>// Scrollview case<NEW_LINE>if (MeasureSpec.getMode(heightMeasureSpec) == MeasureSpec.UNSPECIFIED)<NEW_LINE>hSize = Integer.MAX_VALUE;<NEW_LINE>for (int i = 0; i < count; i++) {<NEW_LINE>final View child = getChildAt(i);<NEW_LINE>if (child.getVisibility() != GONE) {<NEW_LINE>measureChildWithMargins(child, widthMeasureSpec, 0, heightMeasureSpec, 0);<NEW_LINE>final LayoutParams lp = (LayoutParams) child.getLayoutParams();<NEW_LINE>childWidth = child.getMeasuredWidth() + lp.leftMargin + lp.rightMargin;<NEW_LINE>childHeight = child.getMeasuredHeight() + lp.topMargin + lp.bottomMargin;<NEW_LINE>// keep max width value stored<NEW_LINE>columnMaxWidth = Math.max(columnMaxWidth, childWidth);<NEW_LINE>// exceed max height start new column and update total width<NEW_LINE>if (childHeight + columnHeight > hSize) {<NEW_LINE>totalWidth += columnMaxWidth;<NEW_LINE>maxColumnHeight = Math.max(maxColumnHeight, columnHeight);<NEW_LINE>columnHeight = childHeight;<NEW_LINE>columnMaxWidth = childWidth;<NEW_LINE>} else {<NEW_LINE>columnHeight += childHeight;<NEW_LINE>}<NEW_LINE>}<NEW_LINE>}<NEW_LINE>// plus last child width<NEW_LINE>if (columnHeight != 0) {<NEW_LINE>maxColumnHeight = Math.max(maxColumnHeight, columnHeight);<NEW_LINE>totalWidth += columnMaxWidth;<NEW_LINE>}<NEW_LINE>// set height to max value<NEW_LINE>if (MeasureSpec.getMode(heightMeasureSpec) == MeasureSpec.UNSPECIFIED)<NEW_LINE>hSize = maxColumnHeight + (getPaddingTop() + getPaddingBottom());<NEW_LINE>setMeasuredDimension(resolveSize(totalWidth + getPaddingRight() + getPaddingLeft(), widthMeasureSpec), resolveSize(hSize, heightMeasureSpec));<NEW_LINE>} | getPaddingTop() + getPaddingBottom()); |
1,129,934 | public void serveUDP(InetAddress addr, int port) {<NEW_LINE>try (DatagramSocket sock = new DatagramSocket(port, addr)) {<NEW_LINE>final short udpLength = 512;<NEW_LINE>byte[] in = new byte[udpLength];<NEW_LINE>DatagramPacket indp = new DatagramPacket(in, in.length);<NEW_LINE>DatagramPacket outdp = null;<NEW_LINE>while (true) {<NEW_LINE>indp.setLength(in.length);<NEW_LINE>try {<NEW_LINE>sock.receive(indp);<NEW_LINE>} catch (InterruptedIOException e) {<NEW_LINE>continue;<NEW_LINE>}<NEW_LINE>Message query;<NEW_LINE>byte[] response;<NEW_LINE>try {<NEW_LINE>query = new Message(in);<NEW_LINE>response = generateReply(query, in, null);<NEW_LINE>if (response == null) {<NEW_LINE>continue;<NEW_LINE>}<NEW_LINE>} catch (IOException e) {<NEW_LINE>response = formerrMessage(in);<NEW_LINE>}<NEW_LINE>if (outdp == null) {<NEW_LINE>outdp = new DatagramPacket(response, response.length, indp.getAddress(), indp.getPort());<NEW_LINE>} else {<NEW_LINE>outdp.setData(response);<NEW_LINE>outdp.setLength(response.length);<NEW_LINE>outdp.<MASK><NEW_LINE>outdp.setPort(indp.getPort());<NEW_LINE>}<NEW_LINE>sock.send(outdp);<NEW_LINE>}<NEW_LINE>} catch (IOException e) {<NEW_LINE>System.out.println("serveUDP(" + addrport(addr, port) + "): " + e);<NEW_LINE>}<NEW_LINE>} | setAddress(indp.getAddress()); |
1,031,586 | @Consumes(MediaType.APPLICATION_FORM_URLENCODED)<NEW_LINE>@Produces(MediaType.TEXT_PLAIN)<NEW_LINE>@ApiOperation(value = "Login with OpenID Connect", notes = "Upon a successful login, a JSON Web Token will be returned in the response body. This functionality requires authentication to be enabled.", response = String.class)<NEW_LINE>@ApiResponses(value = { @ApiResponse(code = 204, message = "No Content"), @ApiResponse(code = 401, message = "Unauthorized"), @ApiResponse(code = 403, message = "Forbidden") })<NEW_LINE>@AuthenticationNotRequired<NEW_LINE>public Response validateOidcAccessToken(@ApiParam(value = "An OAuth2 access token", required = true) @FormParam("idToken") final String idToken, @FormParam("accessToken") final String accessToken) {<NEW_LINE>final OidcAuthenticationService authService = new OidcAuthenticationService(idToken, accessToken);<NEW_LINE>if (!authService.isSpecified()) {<NEW_LINE>super.logSecurityEvent(LOGGER, SecurityMarkers.SECURITY_AUDIT, "An OpenID Connect login attempt was made, but OIDC is disabled or not properly configured");<NEW_LINE>return Response.status(Response.Status.NO_CONTENT).build();<NEW_LINE>}<NEW_LINE>try (final QueryManager qm = new QueryManager()) {<NEW_LINE>final Principal principal = authService.authenticate();<NEW_LINE>super.logSecurityEvent(LOGGER, SecurityMarkers.SECURITY_SUCCESS, "Successful OpenID Connect login / username: " + principal.getName());<NEW_LINE>final List<Permission> permissions = qm.getEffectivePermissions((UserPrincipal) principal);<NEW_LINE>final KeyManager km = KeyManager.getInstance();<NEW_LINE>final JsonWebToken jwt = new JsonWebToken(km.getSecretKey());<NEW_LINE>final String token = jwt.createToken(principal, permissions);<NEW_LINE>return Response.<MASK><NEW_LINE>} catch (AlpineAuthenticationException e) {<NEW_LINE>super.logSecurityEvent(LOGGER, SecurityMarkers.SECURITY_FAILURE, "Unauthorized OpenID Connect login attempt");<NEW_LINE>if (AlpineAuthenticationException.CauseType.SUSPENDED == e.getCauseType() || AlpineAuthenticationException.CauseType.UNMAPPED_ACCOUNT == e.getCauseType()) {<NEW_LINE>return Response.status(Response.Status.FORBIDDEN).entity(e.getCauseType().name()).build();<NEW_LINE>} else {<NEW_LINE>return Response.status(Response.Status.UNAUTHORIZED).entity(e.getCauseType().name()).build();<NEW_LINE>}<NEW_LINE>}<NEW_LINE>} | ok(token).build(); |
1,720,620 | public DesiredWeightAndCapacity unmarshall(JsonUnmarshallerContext context) throws Exception {<NEW_LINE>DesiredWeightAndCapacity desiredWeightAndCapacity = new DesiredWeightAndCapacity();<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>if (context.testExpression("VariantName", targetDepth)) {<NEW_LINE>context.nextToken();<NEW_LINE>desiredWeightAndCapacity.setVariantName(context.getUnmarshaller(String.<MASK><NEW_LINE>}<NEW_LINE>if (context.testExpression("DesiredWeight", targetDepth)) {<NEW_LINE>context.nextToken();<NEW_LINE>desiredWeightAndCapacity.setDesiredWeight(context.getUnmarshaller(Float.class).unmarshall(context));<NEW_LINE>}<NEW_LINE>if (context.testExpression("DesiredInstanceCount", targetDepth)) {<NEW_LINE>context.nextToken();<NEW_LINE>desiredWeightAndCapacity.setDesiredInstanceCount(context.getUnmarshaller(Integer.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 desiredWeightAndCapacity;<NEW_LINE>} | class).unmarshall(context)); |
252,149 | public void loadFromInternalMap(Map<?, ?> map) {<NEW_LINE>timestamp = MapUtils.getMapLong(map, "timestamp", 0);<NEW_LINE>if (timestamp == 0) {<NEW_LINE>timestamp = SystemTime.getCurrentTime();<NEW_LINE>}<NEW_LINE>setAssetHash(MapUtils.getMapString(map, "assetHash", null));<NEW_LINE>setIconIDRaw(MapUtils.getMapString(map, "icon", null));<NEW_LINE>setTypeID(MapUtils.getMapString(map, "typeID", null), true);<NEW_LINE>setShowThumb(MapUtils.getMapLong(map, "showThumb", 1) == 1);<NEW_LINE>setAssetImageURL(MapUtils.getMapString<MASK><NEW_LINE>setImageBytes(MapUtils.getMapByteArray(map, "imageBytes", null));<NEW_LINE>setReadOn(MapUtils.getMapLong(map, "readOn", SystemTime.getCurrentTime()));<NEW_LINE>setActions(MapUtils.getMapStringArray(map, "actions", null));<NEW_LINE>callback_class = MapUtils.getMapString(map, "cb_class", null);<NEW_LINE>callback_data = (Map<String, String>) BDecoder.decodeStrings((Map) map.get("cb_data"));<NEW_LINE>viewed = MapUtils.getMapBoolean(map, "viewed", false);<NEW_LINE>loadCommonFromMap(map);<NEW_LINE>} | (map, "assetImageURL", null)); |
346,485 | public FirewallMetadata unmarshall(JsonUnmarshallerContext context) throws Exception {<NEW_LINE>FirewallMetadata firewallMetadata = new FirewallMetadata();<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>if (context.testExpression("FirewallName", targetDepth)) {<NEW_LINE>context.nextToken();<NEW_LINE>firewallMetadata.setFirewallName(context.getUnmarshaller(String.class).unmarshall(context));<NEW_LINE>}<NEW_LINE>if (context.testExpression("FirewallArn", targetDepth)) {<NEW_LINE>context.nextToken();<NEW_LINE>firewallMetadata.setFirewallArn(context.getUnmarshaller(String.<MASK><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 firewallMetadata;<NEW_LINE>} | class).unmarshall(context)); |
1,209,048 | private boolean processUnrecoverableException(final HttpServletRequest req, final HttpServletResponse resp, final PwmDomain pwmDomain, final PwmRequest pwmRequest, final PwmUnrecoverableException e) throws IOException {<NEW_LINE>switch(e.getError()) {<NEW_LINE>case ERROR_DIRECTORY_UNAVAILABLE:<NEW_LINE>LOGGER.fatal(pwmRequest.getLabel(), () -> e.getErrorInformation().toDebugStr());<NEW_LINE>StatisticsClient.incrementStat(pwmRequest, Statistic.LDAP_UNAVAILABLE_COUNT);<NEW_LINE>break;<NEW_LINE>case ERROR_PASSWORD_REQUIRED:<NEW_LINE>LOGGER.warn(() -> "attempt to access functionality requiring password authentication, but password not yet supplied by actor, forwarding to password Login page");<NEW_LINE>// store the original requested url<NEW_LINE>try {<NEW_LINE>LOGGER.debug(pwmRequest, () -> "user is authenticated without a password, redirecting to login page");<NEW_LINE>LoginServlet.redirectToLoginServlet(PwmRequest.forRequest(req, resp));<NEW_LINE>return true;<NEW_LINE>} catch (final Throwable e1) {<NEW_LINE>LOGGER.error(() -> "error while marking pre-login url:" + e1.getMessage());<NEW_LINE>}<NEW_LINE>break;<NEW_LINE>case ERROR_INTERNAL:<NEW_LINE>default:<NEW_LINE>final Supplier<CharSequence> msg = () -> "unexpected error: " + e.getErrorInformation().toDebugStr();<NEW_LINE>final PwmLogLevel level = e.getError().isTrivial() ? PwmLogLevel.TRACE : PwmLogLevel.ERROR;<NEW_LINE>LOGGER.log(level, pwmRequest.getLabel(), msg);<NEW_LINE>StatisticsClient.<MASK><NEW_LINE>}<NEW_LINE>return false;<NEW_LINE>} | incrementStat(pwmRequest, Statistic.PWM_UNKNOWN_ERRORS); |
424,628 | protected Object readProperty(String path, RedisData source, RedisPersistentProperty persistentProperty) {<NEW_LINE>String currentPath = !path.isEmpty() ? path + "." + persistentProperty.getName() : persistentProperty.getName();<NEW_LINE>TypeInformation<?> typeInformation = persistentProperty.getTypeInformation();<NEW_LINE>if (persistentProperty.isMap()) {<NEW_LINE>Class<?> mapValueType = persistentProperty.getMapValueType();<NEW_LINE>if (mapValueType == null) {<NEW_LINE>throw new IllegalArgumentException("Unable to retrieve MapValueType!");<NEW_LINE>}<NEW_LINE>if (conversionService.canConvert(byte[].class, mapValueType)) {<NEW_LINE>return readMapOfSimpleTypes(currentPath, typeInformation.getType(), typeInformation.getRequiredComponentType().getType(), mapValueType, source);<NEW_LINE>}<NEW_LINE>return readMapOfComplexTypes(currentPath, typeInformation.getType(), typeInformation.getRequiredComponentType().getType(), mapValueType, source);<NEW_LINE>}<NEW_LINE>if (typeInformation.isCollectionLike()) {<NEW_LINE>if (!isByteArray(typeInformation)) {<NEW_LINE>return readCollectionOrArray(currentPath, typeInformation.getType(), typeInformation.getRequiredComponentType().getType(), source.getBucket());<NEW_LINE>}<NEW_LINE>if (!source.getBucket().hasValue(currentPath) && isByteArray(typeInformation)) {<NEW_LINE>return readCollectionOrArray(currentPath, typeInformation.getType(), typeInformation.getRequiredComponentType().getType(), source.getBucket());<NEW_LINE>}<NEW_LINE>}<NEW_LINE>if (persistentProperty.isEntity() && !conversionService.canConvert(byte[].class, typeInformation.getRequiredActualType().getType())) {<NEW_LINE>Bucket bucket = source.getBucket().extract(currentPath + ".");<NEW_LINE><MASK><NEW_LINE>TypeInformation<?> typeToRead = typeMapper.readType(bucket.getPropertyPath(currentPath), typeInformation);<NEW_LINE>return readInternal(currentPath, typeToRead.getType(), newBucket);<NEW_LINE>}<NEW_LINE>byte[] sourceBytes = source.getBucket().get(currentPath);<NEW_LINE>if (typeInformation.getType().isPrimitive() && sourceBytes == null) {<NEW_LINE>return null;<NEW_LINE>}<NEW_LINE>if (persistentProperty.isIdProperty() && ObjectUtils.isEmpty(path.isEmpty())) {<NEW_LINE>return sourceBytes != null ? fromBytes(sourceBytes, typeInformation.getType()) : source.getId();<NEW_LINE>}<NEW_LINE>if (sourceBytes == null) {<NEW_LINE>return null;<NEW_LINE>}<NEW_LINE>Class<?> typeToUse = getTypeHint(currentPath, source.getBucket(), persistentProperty.getType());<NEW_LINE>return fromBytes(sourceBytes, typeToUse);<NEW_LINE>} | RedisData newBucket = new RedisData(bucket); |
1,124,732 | static Scalar baz(ParameterExpression context_, ParameterExpression outputValues_, BlockStatement block) {<NEW_LINE>final List<MemberDeclaration> declarations = new ArrayList<>();<NEW_LINE>// public void execute(Context, Object[] outputValues)<NEW_LINE>declarations.add(Expressions.methodDecl(Modifier.PUBLIC, void.class, BuiltInMethod.SCALAR_EXECUTE2.method.getName(), ImmutableList.of(context_, outputValues_), block));<NEW_LINE>// public Object execute(Context)<NEW_LINE>final BlockBuilder builder = new BlockBuilder();<NEW_LINE>final Expression values_ = builder.append("values", Expressions.newArrayBounds(Object.class, 1, Expressions.constant(1)));<NEW_LINE>builder.add(Expressions.statement(Expressions.call(Expressions.parameter(Scalar.class, "this"), BuiltInMethod.SCALAR_EXECUTE2.method, context_, values_)));<NEW_LINE>builder.add(Expressions.return_(null, Expressions.arrayIndex(values_, Expressions<MASK><NEW_LINE>declarations.add(Expressions.methodDecl(Modifier.PUBLIC, Object.class, BuiltInMethod.SCALAR_EXECUTE1.method.getName(), ImmutableList.of(context_), builder.toBlock()));<NEW_LINE>final ClassDeclaration classDeclaration = Expressions.classDecl(Modifier.PUBLIC, "Buzz", null, ImmutableList.of(Scalar.class), declarations);<NEW_LINE>String s = Expressions.toString(declarations, "\n", false);<NEW_LINE>if (CalciteSystemProperty.DEBUG.value()) {<NEW_LINE>Util.debugCode(System.out, s);<NEW_LINE>}<NEW_LINE>try {<NEW_LINE>return getScalar(classDeclaration, s);<NEW_LINE>} catch (CompileException | IOException e) {<NEW_LINE>throw new RuntimeException(e);<NEW_LINE>}<NEW_LINE>} | .constant(0)))); |
727,990 | // must called after tupleDescriptor is computed<NEW_LINE>public void complete() throws UserException {<NEW_LINE><MASK><NEW_LINE>tSink.setTableId(dstTable.getId());<NEW_LINE>tSink.setTupleId(tupleDescriptor.getId().asInt());<NEW_LINE>int numReplicas = 1;<NEW_LINE>for (Partition partition : dstTable.getPartitions()) {<NEW_LINE>numReplicas = dstTable.getPartitionInfo().getReplicaAllocation(partition.getId()).getTotalReplicaNum();<NEW_LINE>break;<NEW_LINE>}<NEW_LINE>tSink.setNumReplicas(numReplicas);<NEW_LINE>tSink.setNeedGenRollup(dstTable.shouldLoadToNewRollup());<NEW_LINE>tSink.setSchema(createSchema(tSink.getDbId(), dstTable));<NEW_LINE>tSink.setPartition(createPartition(tSink.getDbId(), dstTable));<NEW_LINE>tSink.setLocation(createLocation(dstTable));<NEW_LINE>tSink.setNodesInfo(createPaloNodesInfo());<NEW_LINE>} | TOlapTableSink tSink = tDataSink.getOlapTableSink(); |
391,685 | public LoadedCredentials loadCredentials(ResourcesEndpointProvider endpoint) {<NEW_LINE>try {<NEW_LINE>String credentialsResponse = HttpResourcesUtils.instance().readResource(endpoint);<NEW_LINE>Map<String, JsonNode> node = SENSITIVE_PARSER.parse(credentialsResponse).asObject();<NEW_LINE>JsonNode accessKey = node.get("AccessKeyId");<NEW_LINE>JsonNode secretKey = node.get("SecretAccessKey");<NEW_LINE>JsonNode token = node.get("Token");<NEW_LINE>JsonNode <MASK><NEW_LINE>Validate.notNull(accessKey, "Failed to load access key from metadata service.");<NEW_LINE>Validate.notNull(secretKey, "Failed to load secret key from metadata service.");<NEW_LINE>return new LoadedCredentials(accessKey.text(), secretKey.text(), token != null ? token.text() : null, expiration != null ? expiration.text() : null);<NEW_LINE>} catch (SdkClientException e) {<NEW_LINE>throw e;<NEW_LINE>} catch (RuntimeException | IOException e) {<NEW_LINE>throw SdkClientException.builder().message("Failed to load credentials from metadata service.").cause(e).build();<NEW_LINE>}<NEW_LINE>} | expiration = node.get("Expiration"); |
1,609,137 | public void downloadPodcastEpisode(HttpServletRequest request, HttpServletResponse response) throws Exception {<NEW_LINE>request = wrapRequest(request);<NEW_LINE>org.airsonic.player.domain.User user = securityService.getCurrentUser(request);<NEW_LINE>if (!user.isPodcastRole()) {<NEW_LINE>error(request, response, ErrorCode.NOT_AUTHORIZED, user.getUsername() + " is not authorized to administrate podcasts.");<NEW_LINE>return;<NEW_LINE>}<NEW_LINE>int <MASK><NEW_LINE>org.airsonic.player.domain.PodcastEpisode episode = podcastService.getEpisode(id, true);<NEW_LINE>if (episode == null) {<NEW_LINE>error(request, response, ErrorCode.NOT_FOUND, "Podcast episode " + id + " not found.");<NEW_LINE>return;<NEW_LINE>}<NEW_LINE>podcastService.downloadEpisode(episode);<NEW_LINE>writeEmptyResponse(request, response);<NEW_LINE>} | id = getRequiredIntParameter(request, "id"); |
183,898 | private static GeneralDataset<String, String> generateFeatureVectors(Properties props) throws Exception {<NEW_LINE>GeneralDataset<String, String> dataset = new Dataset<>();<NEW_LINE>Dictionaries dict = new Dictionaries(props);<NEW_LINE>MentionExtractor mentionExtractor = new CoNLLMentionExtractor(dict, props, new Semantics(dict));<NEW_LINE>Document document;<NEW_LINE>while ((document = mentionExtractor.nextDoc()) != null) {<NEW_LINE>setTokenIndices(document);<NEW_LINE>document.extractGoldCorefClusters();<NEW_LINE>Map<Integer<MASK><NEW_LINE>// Generate features for coreferent mentions with class label 1<NEW_LINE>for (CorefCluster entity : entities.values()) {<NEW_LINE>for (Mention mention : entity.getCorefMentions()) {<NEW_LINE>// Ignore verbal mentions<NEW_LINE>if (mention.headWord.tag().startsWith("V"))<NEW_LINE>continue;<NEW_LINE>IndexedWord head = mention.dependency.getNodeByIndexSafe(mention.headWord.index());<NEW_LINE>if (head == null)<NEW_LINE>continue;<NEW_LINE>ArrayList<String> feats = mention.getSingletonFeatures(dict);<NEW_LINE>dataset.add(new BasicDatum<>(feats, "1"));<NEW_LINE>}<NEW_LINE>}<NEW_LINE>// Generate features for singletons with class label 0<NEW_LINE>ArrayList<CoreLabel> gold_heads = new ArrayList<>();<NEW_LINE>for (Mention gold_men : document.allGoldMentions.values()) {<NEW_LINE>gold_heads.add(gold_men.headWord);<NEW_LINE>}<NEW_LINE>for (Mention predicted_men : document.allPredictedMentions.values()) {<NEW_LINE>SemanticGraph dep = predicted_men.dependency;<NEW_LINE>IndexedWord head = dep.getNodeByIndexSafe(predicted_men.headWord.index());<NEW_LINE>if (head == null)<NEW_LINE>continue;<NEW_LINE>// Ignore verbal mentions<NEW_LINE>if (predicted_men.headWord.tag().startsWith("V"))<NEW_LINE>continue;<NEW_LINE>// If the mention is in the gold set, it is not a singleton and thus ignore<NEW_LINE>if (gold_heads.contains(predicted_men.headWord))<NEW_LINE>continue;<NEW_LINE>dataset.add(new BasicDatum<>(predicted_men.getSingletonFeatures(dict), "0"));<NEW_LINE>}<NEW_LINE>}<NEW_LINE>dataset.summaryStatistics();<NEW_LINE>return dataset;<NEW_LINE>} | , CorefCluster> entities = document.goldCorefClusters; |
336,498 | private void loadColumnsStrategies() {<NEW_LINE>JPanel strategiesPanel = new JPanel();<NEW_LINE>strategiesPanel.<MASK><NEW_LINE>if (duplicateGroups != null && duplicateGroups.size() > 0) {<NEW_LINE>strategiesPanel.add(new JLabel(NbBundle.getMessage(MergeNodeDuplicatesUI.class, "MergeNodeDuplicatesUI.duplicateGroupsNumber", duplicateGroups.size())), "wrap 15px");<NEW_LINE>// Use first group of duplicated nodes to set strategies for all of them<NEW_LINE>List<Node> // Use first group of duplicated nodes to set strategies for all of them<NEW_LINE>nodes = duplicateGroups.get(0);<NEW_LINE>// Prepare node rows:<NEW_LINE>rows = new Element[nodes.size()];<NEW_LINE>for (int i = 0; i < nodes.size(); i++) {<NEW_LINE>rows[i] = nodes.get(i);<NEW_LINE>}<NEW_LINE>strategiesConfigurationButtons = new StrategyConfigurationButton[columns.length];<NEW_LINE>strategiesComboBoxes = new StrategyComboBox[columns.length];<NEW_LINE>for (int i = 0; i < columns.length; i++) {<NEW_LINE>// Strategy information label:<NEW_LINE>StrategyInfoLabel infoLabel = new StrategyInfoLabel(i);<NEW_LINE>// Strategy configuration button:<NEW_LINE>strategiesConfigurationButtons[i] = new StrategyConfigurationButton(i);<NEW_LINE>// Strategy selection:<NEW_LINE>StrategyComboBox strategyComboBox = new StrategyComboBox(strategiesConfigurationButtons[i], infoLabel);<NEW_LINE>strategiesComboBoxes[i] = strategyComboBox;<NEW_LINE>for (AttributeRowsMergeStrategy strategy : getColumnAvailableStrategies(columns[i])) {<NEW_LINE>strategyComboBox.addItem(new StrategyWrapper(strategy));<NEW_LINE>}<NEW_LINE>strategyComboBox.refresh();<NEW_LINE>strategiesPanel.add(new JLabel(columns[i].getTitle() + ": "), "wrap");<NEW_LINE>strategiesPanel.add(infoLabel, "split 3");<NEW_LINE>strategiesPanel.add(strategiesConfigurationButtons[i]);<NEW_LINE>strategiesPanel.add(strategyComboBox, "growx, wrap 15px");<NEW_LINE>}<NEW_LINE>dialogControls.setOkButtonEnabled(true);<NEW_LINE>} else {<NEW_LINE>strategiesPanel.add(new JLabel(getMessage("MergeNodeDuplicatesUI.noDuplicatesText")));<NEW_LINE>dialogControls.setOkButtonEnabled(false);<NEW_LINE>}<NEW_LINE>scrollStrategies.setViewportView(strategiesPanel);<NEW_LINE>} | setLayout(new MigLayout("fillx")); |
231,047 | public Mono<Response<Flux<ByteBuffer>>> deleteWithResponseAsync(String resourceGroupName, String networkProfileName) {<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 (resourceGroupName == null) {<NEW_LINE>return Mono.error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null."));<NEW_LINE>}<NEW_LINE>if (networkProfileName == null) {<NEW_LINE>return Mono.error(new IllegalArgumentException("Parameter networkProfileName is required and cannot be null."));<NEW_LINE>}<NEW_LINE>if (this.client.getSubscriptionId() == null) {<NEW_LINE>return Mono.<MASK><NEW_LINE>}<NEW_LINE>final String apiVersion = "2018-11-01";<NEW_LINE>return FluxUtil.withContext(context -> service.delete(this.client.getEndpoint(), resourceGroupName, networkProfileName, apiVersion, this.client.getSubscriptionId(), context)).contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly()));<NEW_LINE>} | error(new IllegalArgumentException("Parameter this.client.getSubscriptionId() is required and cannot be null.")); |
1,612,726 | public Mono<Void> upgrade(ServerWebExchange exchange, WebSocketHandler handler, @Nullable String subProtocol, Supplier<HandshakeInfo> handshakeInfoFactory) {<NEW_LINE>HttpServerExchange httpExchange = ServerHttpRequestDecorator.getNativeRequest(exchange.getRequest());<NEW_LINE>Set<String> protocols = (subProtocol != null ? Collections.singleton(subProtocol) : Collections.emptySet());<NEW_LINE>Hybi13Handshake handshake = new Hybi13Handshake(protocols, false);<NEW_LINE>List<Handshake> handshakes = Collections.singletonList(handshake);<NEW_LINE>HandshakeInfo handshakeInfo = handshakeInfoFactory.get();<NEW_LINE>DataBufferFactory bufferFactory = exchange<MASK><NEW_LINE>// Trigger WebFlux preCommit actions and upgrade<NEW_LINE>return exchange.getResponse().setComplete().then(Mono.deferContextual(contextView -> {<NEW_LINE>DefaultCallback callback = new DefaultCallback(handshakeInfo, ContextWebSocketHandler.decorate(handler, contextView), bufferFactory);<NEW_LINE>try {<NEW_LINE>new WebSocketProtocolHandshakeHandler(handshakes, callback).handleRequest(httpExchange);<NEW_LINE>} catch (Exception ex) {<NEW_LINE>return Mono.error(ex);<NEW_LINE>}<NEW_LINE>return Mono.empty();<NEW_LINE>}));<NEW_LINE>} | .getResponse().bufferFactory(); |
702,148 | public void fromBuiltInKeywords(String accessKey, String modelPath, ReadableArray keywords, ReadableArray sensitivities, Promise promise) {<NEW_LINE>// convert from ReadableArrays to Java types<NEW_LINE>Porcupine.BuiltInKeyword[] keywordsJava = new Porcupine.BuiltInKeyword[keywords.size()];<NEW_LINE>for (int i = 0; i < keywords.size(); i++) {<NEW_LINE>try {<NEW_LINE>String keyword = keywords.getString(i);<NEW_LINE>if (keyword == null) {<NEW_LINE>promise.reject(PorcupineInvalidArgumentException.class.getSimpleName(), "keyword must be a valid string");<NEW_LINE>return;<NEW_LINE>}<NEW_LINE>keyword = keyword.replace(' ', '_');<NEW_LINE>keywordsJava[i] = Porcupine.BuiltInKeyword.valueOf(keyword.toUpperCase());<NEW_LINE>} catch (IllegalArgumentException e) {<NEW_LINE>promise.reject(PorcupineInvalidArgumentException.class.getSimpleName(), String.format("'%s' is not a built-in keyword", keywords.getString(i)));<NEW_LINE>return;<NEW_LINE>}<NEW_LINE>}<NEW_LINE>float[] sensitivitiesJava = new float[sensitivities.size()];<NEW_LINE>for (int i = 0; i < sensitivities.size(); i++) {<NEW_LINE>sensitivitiesJava[i] = (float) sensitivities.getDouble(i);<NEW_LINE>}<NEW_LINE>try {<NEW_LINE>Porcupine porcupine = new Porcupine.Builder().setAccessKey(accessKey).setModelPath(modelPath.isEmpty() ? null : modelPath).setKeywords(keywordsJava.length == 0 ? null : keywordsJava).setSensitivities(sensitivitiesJava.length == 0 ? null : sensitivitiesJava).build(reactContext);<NEW_LINE>porcupinePool.put(String.valueOf(System.identityHashCode(porcupine)), porcupine);<NEW_LINE>WritableMap paramMap = Arguments.createMap();<NEW_LINE>paramMap.putString("handle", String.valueOf(System.identityHashCode(porcupine)));<NEW_LINE>paramMap.putInt("frameLength", porcupine.getFrameLength());<NEW_LINE>paramMap.putInt("sampleRate", porcupine.getSampleRate());<NEW_LINE>paramMap.putString("version", porcupine.getVersion());<NEW_LINE>promise.resolve(paramMap);<NEW_LINE>} catch (PorcupineException e) {<NEW_LINE>promise.reject(e.getClass().getSimpleName(<MASK><NEW_LINE>}<NEW_LINE>} | ), e.getMessage()); |
990,110 | ActionResult<List<Wo>> execute(EffectivePerson effectivePerson, String id, Integer count, JsonElement jsonElement) throws Exception {<NEW_LINE>try (EntityManagerContainer emc = EntityManagerContainerFactory.instance().create()) {<NEW_LINE>Wi wi = this.<MASK><NEW_LINE>Business business = new Business(emc);<NEW_LINE>EntityManager em = emc.get(Read.class);<NEW_LINE>CriteriaBuilder cb = em.getCriteriaBuilder();<NEW_LINE>CriteriaQuery<Tuple> cq = cb.createQuery(Tuple.class);<NEW_LINE>Root<Read> root = cq.from(Read.class);<NEW_LINE>Predicate p = cb.equal(root.get(Read_.creatorPerson), effectivePerson.getDistinguishedName());<NEW_LINE>p = cb.and(p, this.toFilterPredicate(effectivePerson, business, wi));<NEW_LINE>ActionResult<List<Wo>> result = this.standardListNext(Wo.copier, id, count, JpaObject.sequence_FIELDNAME, DESC, p);<NEW_LINE>this.relate(business, result.getData(), wi);<NEW_LINE>return result;<NEW_LINE>}<NEW_LINE>} | convertToWrapIn(jsonElement, Wi.class); |
1,284,901 | public long longBitsAt(long bitPos, int bitLength) {<NEW_LINE>if (bitPos + bitLength > this.bitSize()) {<NEW_LINE>throw new IllegalArgumentException("reading beyond end of BitString");<NEW_LINE>}<NEW_LINE>if (bitLength < 0 || bitLength > 64)<NEW_LINE>throw new IllegalArgumentException("this method can only get 64 bits");<NEW_LINE>long res = 0;<NEW_LINE>bitPos += byteOffset() * 8;<NEW_LINE>// first, get the right-most bits from data[bitPos/8]<NEW_LINE>if ((bitPos & 0x07) != 0) {<NEW_LINE>// how many bits from this byte?<NEW_LINE>int len = 8 - (int) (bitPos & 0x07);<NEW_LINE>// the byte<NEW_LINE>int val = 0x0ff & (int) data[(int) (bitPos >> 3)];<NEW_LINE>res = val & ((1 << len) - 1);<NEW_LINE>// are we looking for less that len bits?<NEW_LINE>if (bitLength < len) {<NEW_LINE>res >>>= (len - bitLength);<NEW_LINE>return res;<NEW_LINE>}<NEW_LINE>bitLength -= len;<NEW_LINE>bitPos += len;<NEW_LINE>}<NEW_LINE>assert ((bitPos & 0x07) == 0);<NEW_LINE>// we're getting bytes<NEW_LINE>int pos = (int) (bitPos >> 3);<NEW_LINE>while (bitLength > 7) {<NEW_LINE>res <<= 8;<NEW_LINE>res |= 0x0ff & (int) data[pos++];<NEW_LINE>bitPos += 8;<NEW_LINE>bitLength -= 8;<NEW_LINE>}<NEW_LINE>assert (bitLength < 8);<NEW_LINE>assert ((bitPos & 0x07) == 0);<NEW_LINE>// finally, get the left-most bits from data[bitPos/8]<NEW_LINE>if (bitLength != 0) {<NEW_LINE>// how many bits from this byte?<NEW_LINE>int len = bitLength;<NEW_LINE>// the byte<NEW_LINE>int val = 0x0ff & (int) data[(int<MASK><NEW_LINE>res <<= bitLength;<NEW_LINE>res |= val >> (8 - len);<NEW_LINE>bitLength -= len;<NEW_LINE>bitPos += len;<NEW_LINE>}<NEW_LINE>assert (bitLength == 0);<NEW_LINE>return res;<NEW_LINE>} | ) (bitPos >> 3)]; |
1,801,227 | public WebIntentBuilder build() {<NEW_LINE>if (webpage == null) {<NEW_LINE>throw new RuntimeException("URL cannot be null.");<NEW_LINE>}<NEW_LINE>if (forceExternal || shouldAlwaysForceExternal(webpage) || settings.browserSelection.equals("external")) {<NEW_LINE>// request the external browser<NEW_LINE>intent = new Intent(Intent.ACTION_VIEW, Uri.parse(webpage));<NEW_LINE>intent.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK);<NEW_LINE>} else if (settings.browserSelection.equals("article")) {<NEW_LINE>articleIntent = new ArticleIntent.Builder(context, APIKeys.ARTICLE_API_KEY).build();<NEW_LINE>} else if (settings.browserSelection.equals("custom_tab")) {<NEW_LINE>// add the share action<NEW_LINE>Intent shareIntent <MASK><NEW_LINE>String extraText = webpage;<NEW_LINE>shareIntent.putExtra(Intent.EXTRA_TEXT, extraText);<NEW_LINE>shareIntent.setType("text/plain");<NEW_LINE>Random random = new Random();<NEW_LINE>PendingIntent pendingIntent = PendingIntent.getActivity(context, random.nextInt(Integer.MAX_VALUE), shareIntent, 0);<NEW_LINE>customTab = new CustomTabsIntent.Builder(null).setShowTitle(true).setActionButton(((BitmapDrawable) context.getResources().getDrawable(R.drawable.ic_action_share_light)).getBitmap(), "Share", pendingIntent).build();<NEW_LINE>} else {<NEW_LINE>// fallback to in app browser<NEW_LINE>intent = new Intent(context, BrowserActivity.class);<NEW_LINE>intent.putExtra("url", webpage);<NEW_LINE>intent.setFlags(0);<NEW_LINE>}<NEW_LINE>return this;<NEW_LINE>} | = new Intent(Intent.ACTION_SEND); |
1,704,538 | public BackendEntry writeEdgeLabel(EdgeLabel edgeLabel) {<NEW_LINE>TextBackendEntry entry = newBackendEntry(edgeLabel);<NEW_LINE>entry.column(HugeKeys.NAME, JsonUtil.toJson(edgeLabel.name()));<NEW_LINE>entry.column(HugeKeys.SOURCE_LABEL, writeId(edgeLabel.sourceLabel()));<NEW_LINE>entry.column(HugeKeys.TARGET_LABEL, writeId(edgeLabel.targetLabel()));<NEW_LINE>entry.column(HugeKeys.FREQUENCY, JsonUtil.toJson(edgeLabel.frequency()));<NEW_LINE>entry.column(HugeKeys.PROPERTIES, writeIds<MASK><NEW_LINE>entry.column(HugeKeys.SORT_KEYS, writeIds(edgeLabel.sortKeys()));<NEW_LINE>entry.column(HugeKeys.NULLABLE_KEYS, writeIds(edgeLabel.nullableKeys()));<NEW_LINE>entry.column(HugeKeys.INDEX_LABELS, writeIds(edgeLabel.indexLabels()));<NEW_LINE>entry.column(HugeKeys.ENABLE_LABEL_INDEX, JsonUtil.toJson(edgeLabel.enableLabelIndex()));<NEW_LINE>writeUserdata(edgeLabel, entry);<NEW_LINE>entry.column(HugeKeys.STATUS, JsonUtil.toJson(edgeLabel.status()));<NEW_LINE>entry.column(HugeKeys.TTL, JsonUtil.toJson(edgeLabel.ttl()));<NEW_LINE>entry.column(HugeKeys.TTL_START_TIME, writeId(edgeLabel.ttlStartTime()));<NEW_LINE>return entry;<NEW_LINE>} | (edgeLabel.properties())); |
994,322 | public void draw(Graphics g1, Component c) {<NEW_LINE>int w = c.getWidth();<NEW_LINE>int h = c.getHeight();<NEW_LINE>float scale = w / mPortWidth;<NEW_LINE>scale = Math.min(h / mPortHeight, scale);<NEW_LINE>if (mChildren == null) {<NEW_LINE>logger.log(Level.FINE, "no pathes");<NEW_LINE>return;<NEW_LINE>}<NEW_LINE>Graphics2D g = (Graphics2D) g1.create();<NEW_LINE>((Graphics2D) g).scale(scale, scale);<NEW_LINE>Rectangle bounds = null;<NEW_LINE>for (int i = 0; i < mChildren.size(); i++) {<NEW_LINE>// TODO: do things differently when it is a path or group!!<NEW_LINE>VDPath path = (VDPath) mChildren.get(i);<NEW_LINE>logger.log(Level.FINE, "mCurrentPaths[" + i + "]=" + path.getName() + Integer.toHexString(path.mFillColor));<NEW_LINE>if (mChildren.get(i) != null) {<NEW_LINE>Rectangle r = drawPath(path, g, w, h, scale);<NEW_LINE>if (bounds == null) {<NEW_LINE>bounds = r;<NEW_LINE>} else {<NEW_LINE>bounds.add(r);<NEW_LINE>}<NEW_LINE>}<NEW_LINE>}<NEW_LINE>g.dispose();<NEW_LINE>logger.log(Level.FINE, "Rectangle " + bounds);<NEW_LINE>logger.log(Level.FINE, "Port " + mPortWidth + "," + mPortHeight);<NEW_LINE>double right <MASK><NEW_LINE>double bot = mPortHeight - bounds.getMaxY();<NEW_LINE>logger.log(Level.FINE, "x " + bounds.getMinX() + ", " + right);<NEW_LINE>logger.log(Level.FINE, "y " + bounds.getMinY() + ", " + bot);<NEW_LINE>} | = mPortWidth - bounds.getMaxX(); |
1,367,003 | final BatchCreateAttendeeResult executeBatchCreateAttendee(BatchCreateAttendeeRequest batchCreateAttendeeRequest) {<NEW_LINE>ExecutionContext executionContext = createExecutionContext(batchCreateAttendeeRequest);<NEW_LINE>AWSRequestMetrics awsRequestMetrics = executionContext.getAwsRequestMetrics();<NEW_LINE>awsRequestMetrics.startEvent(Field.ClientExecuteTime);<NEW_LINE>Request<BatchCreateAttendeeRequest> request = null;<NEW_LINE>Response<BatchCreateAttendeeResult> response = null;<NEW_LINE>try {<NEW_LINE>awsRequestMetrics.startEvent(Field.RequestMarshallTime);<NEW_LINE>try {<NEW_LINE>request = new BatchCreateAttendeeRequestProtocolMarshaller(protocolFactory).marshall(super.beforeMarshalling(batchCreateAttendeeRequest));<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, "Chime SDK Meetings");<NEW_LINE>request.addHandlerContext(HandlerContextKey.OPERATION_NAME, "BatchCreateAttendee");<NEW_LINE>request.addHandlerContext(HandlerContextKey.ADVANCED_CONFIG, advancedConfig);<NEW_LINE>} finally {<NEW_LINE>awsRequestMetrics.endEvent(Field.RequestMarshallTime);<NEW_LINE>}<NEW_LINE>HttpResponseHandler<AmazonWebServiceResponse<BatchCreateAttendeeResult>> responseHandler = protocolFactory.createResponseHandler(new JsonOperationMetadata().withPayloadJson(true).withHasStreamingSuccessResponse(false), new BatchCreateAttendeeResultJsonUnmarshaller());<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,162,787 | private static void registerLanguage(String name, String iso639_1, String iso639_2, String altIso639_2) {<NEW_LINE>String[] names = name.split("\\s*;\\s*");<NEW_LINE>if (names.length == 0) {<NEW_LINE>throw new IllegalArgumentException("name cannot be blank");<NEW_LINE>}<NEW_LINE>String[] keys = new String[names.length];<NEW_LINE>for (int i = 0; i < names.length; i++) {<NEW_LINE>keys[i] = names[i].replaceAll("\\s*\\([^\\)]*\\)\\s*", ""<MASK><NEW_LINE>}<NEW_LINE>Iso639Entry entry = new Iso639Entry(names, iso639_1, iso639_2, altIso639_2);<NEW_LINE>for (int i = 0; i < keys.length; i++) {<NEW_LINE>links.put(keys[i], entry);<NEW_LINE>}<NEW_LINE>} | ).toLowerCase(Locale.ROOT); |
1,205,173 | public MutableHttpResponse<JsonError> processResponse(@NonNull ErrorContext errorContext, @NonNull MutableHttpResponse<?> response) {<NEW_LINE>if (errorContext.getRequest().getMethod() == HttpMethod.HEAD) {<NEW_LINE>return (MutableHttpResponse<JsonError>) response;<NEW_LINE>}<NEW_LINE>JsonError error;<NEW_LINE>if (!errorContext.hasErrors()) {<NEW_LINE>error = new JsonError(response.getStatus().getReason());<NEW_LINE>} else if (errorContext.getErrors().size() == 1 && !alwaysSerializeErrorsAsList) {<NEW_LINE>Error jsonError = errorContext.<MASK><NEW_LINE>error = new JsonError(jsonError.getMessage());<NEW_LINE>jsonError.getPath().ifPresent(error::path);<NEW_LINE>} else {<NEW_LINE>error = new JsonError(response.getStatus().getReason());<NEW_LINE>List<Resource> errors = new ArrayList<>();<NEW_LINE>for (Error jsonError : errorContext.getErrors()) {<NEW_LINE>errors.add(new JsonError(jsonError.getMessage()).path(jsonError.getPath().orElse(null)));<NEW_LINE>}<NEW_LINE>error.embedded("errors", errors);<NEW_LINE>}<NEW_LINE>error.link(Link.SELF, Link.of(errorContext.getRequest().getUri()));<NEW_LINE>return response.body(error).contentType(MediaType.APPLICATION_JSON_TYPE);<NEW_LINE>} | getErrors().get(0); |
1,463,399 | public void activateDeferred() {<NEW_LINE>if (cannotLaunch())<NEW_LINE>return;<NEW_LINE>Direction facing = getFacing();<NEW_LINE>List<Entity> entities = level.getEntitiesOfClass(Entity.class, new AABB(worldPosition).inflate(-1 / 16f, 0, -1 / 16f));<NEW_LINE>// Launch Items<NEW_LINE>boolean doLogic = !level.isClientSide || isVirtual();<NEW_LINE>if (doLogic)<NEW_LINE>launchItems();<NEW_LINE>// Launch Entities<NEW_LINE>for (Entity entity : entities) {<NEW_LINE>boolean isPlayerEntity = entity instanceof Player;<NEW_LINE>if (!entity.isAlive())<NEW_LINE>continue;<NEW_LINE>if (entity instanceof ItemEntity)<NEW_LINE>continue;<NEW_LINE>if (entity.getPistonPushReaction() == PushReaction.IGNORE)<NEW_LINE>continue;<NEW_LINE>entity.setOnGround(false);<NEW_LINE>if (isPlayerEntity != level.isClientSide)<NEW_LINE>continue;<NEW_LINE>entity.setPos(worldPosition.getX() + .5f, worldPosition.getY() + 1, worldPosition.getZ() + .5f);<NEW_LINE>launcher.applyMotion(entity, facing);<NEW_LINE>if (!isPlayerEntity)<NEW_LINE>continue;<NEW_LINE>Player playerEntity = (Player) entity;<NEW_LINE>if (!(playerEntity.getItemBySlot(EquipmentSlot.CHEST).getItem() instanceof ElytraItem))<NEW_LINE>continue;<NEW_LINE>playerEntity.setXRot(-35);<NEW_LINE>playerEntity.setYRot(facing.toYRot());<NEW_LINE>playerEntity.setDeltaMovement(playerEntity.getDeltaMovement().scale(.75f));<NEW_LINE>deployElytra(playerEntity);<NEW_LINE>AllPackets.channel.sendToServer(new EjectorElytraPacket(worldPosition));<NEW_LINE>}<NEW_LINE>if (doLogic) {<NEW_LINE>lidProgress.chase(1, .8f, Chaser.EXP);<NEW_LINE>state = State.LAUNCHING;<NEW_LINE>if (!level.isClientSide) {<NEW_LINE>level.playSound(null, worldPosition, SoundEvents.WOODEN_TRAPDOOR_CLOSE, SoundSource.BLOCKS, .35f, 1f);<NEW_LINE>level.playSound(null, worldPosition, SoundEvents.CHEST_OPEN, <MASK><NEW_LINE>}<NEW_LINE>}<NEW_LINE>} | SoundSource.BLOCKS, .1f, 1.4f); |
718,641 | public void testJsonb() throws Exception {<NEW_LINE>// Convert Java Object --> JSON<NEW_LINE>Team zombies = new Team();<NEW_LINE>zombies.name = "Zombies";<NEW_LINE>zombies.size = 9;<NEW_LINE>zombies.winLossRatio = 0.85f;<NEW_LINE>Jsonb jsonb = JsonbProvider.provider().create().build();<NEW_LINE>String teamJson = jsonb.toJson(zombies);<NEW_LINE>System.out.println("POJO --> JSON: " + teamJson);<NEW_LINE>assertTrue(teamJson.contains("\"name\":\"Zombies\""));<NEW_LINE>assertTrue<MASK><NEW_LINE>assertTrue(teamJson.contains("\"winLossRatio\":0.8"));<NEW_LINE>// Convert JSON --> Java Object<NEW_LINE>Team rangers = jsonb.fromJson("{\"name\":\"Rangers\",\"size\":7,\"winLossRatio\":0.6}", Team.class);<NEW_LINE>System.out.println("JSON --> POJO: " + rangers.name);<NEW_LINE>assertEquals("Rangers", rangers.name);<NEW_LINE>assertEquals(7, rangers.size);<NEW_LINE>assertEquals(0.6f, rangers.winLossRatio, 0.01f);<NEW_LINE>} | (teamJson.contains("\"size\":9")); |
586,376 | public void appendServerInfo(final Range range, final NodeList source, final LinkDataDuplexMap linkDataDuplexMap, final long timeoutMillis) {<NEW_LINE>if (source == null) {<NEW_LINE>return;<NEW_LINE>}<NEW_LINE>Collection<Node> nodes = source.getNodeList();<NEW_LINE>if (CollectionUtils.isEmpty(nodes)) {<NEW_LINE>return;<NEW_LINE>}<NEW_LINE>final AtomicBoolean stopSign = new AtomicBoolean();<NEW_LINE>final CompletableFuture[] futures = getServerInstanceListFutures(range, nodes, linkDataDuplexMap, stopSign);<NEW_LINE>if (-1 == timeoutMillis) {<NEW_LINE>// Returns the result value when complete<NEW_LINE>CompletableFuture.allOf(futures).join();<NEW_LINE>} else {<NEW_LINE>try {<NEW_LINE>CompletableFuture.allOf(futures).get(timeoutMillis, TimeUnit.MILLISECONDS);<NEW_LINE>} catch (Exception e) {<NEW_LINE>// InterruptedException, ExecutionException, TimeoutException<NEW_LINE>stopSign.set(Boolean.TRUE);<NEW_LINE>String cause = "an error occurred while adding server info";<NEW_LINE>if (e instanceof TimeoutException) {<NEW_LINE>cause += " build timed out. timeout=" + timeoutMillis + "ms";<NEW_LINE>}<NEW_LINE><MASK><NEW_LINE>}<NEW_LINE>}<NEW_LINE>} | throw new RuntimeException(cause, e); |
1,585,982 | final CreateRepositoryResult executeCreateRepository(CreateRepositoryRequest createRepositoryRequest) {<NEW_LINE>ExecutionContext executionContext = createExecutionContext(createRepositoryRequest);<NEW_LINE>AWSRequestMetrics awsRequestMetrics = executionContext.getAwsRequestMetrics();<NEW_LINE>awsRequestMetrics.startEvent(Field.ClientExecuteTime);<NEW_LINE>Request<CreateRepositoryRequest> request = null;<NEW_LINE>Response<CreateRepositoryResult> response = null;<NEW_LINE>try {<NEW_LINE>awsRequestMetrics.startEvent(Field.RequestMarshallTime);<NEW_LINE>try {<NEW_LINE>request = new CreateRepositoryRequestProtocolMarshaller(protocolFactory).marshall(super.beforeMarshalling(createRepositoryRequest));<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, "Proton");<NEW_LINE>request.addHandlerContext(HandlerContextKey.OPERATION_NAME, "CreateRepository");<NEW_LINE>request.addHandlerContext(HandlerContextKey.ADVANCED_CONFIG, advancedConfig);<NEW_LINE>} finally {<NEW_LINE>awsRequestMetrics.endEvent(Field.RequestMarshallTime);<NEW_LINE>}<NEW_LINE>HttpResponseHandler<AmazonWebServiceResponse<CreateRepositoryResult>> responseHandler = protocolFactory.createResponseHandler(new JsonOperationMetadata().withPayloadJson(true).withHasStreamingSuccessResponse(<MASK><NEW_LINE>response = invoke(request, responseHandler, executionContext);<NEW_LINE>return response.getAwsResponse();<NEW_LINE>} finally {<NEW_LINE>endClientExecution(awsRequestMetrics, request, response);<NEW_LINE>}<NEW_LINE>} | false), new CreateRepositoryResultJsonUnmarshaller()); |
104,542 | public void paintIcon(final Component c, final Graphics g, final int x, int y) {<NEW_LINE>final Color color = c == null ? Color.GRAY : c.getBackground();<NEW_LINE>// In a compound sort, make each succesive triangle 20%<NEW_LINE>// smaller than the previous one.<NEW_LINE>final int dx = (int) ((size / 2) * Math.pow(0.8, priority));<NEW_LINE>final int dy = descending ? dx : -dx;<NEW_LINE>// Align icon (roughly) with font baseline.<NEW_LINE>y = y + ((5 * size) / 6) + (descending ? -dy : 0);<NEW_LINE>final int shift = descending ? 1 : -1;<NEW_LINE>g.translate(x, y);<NEW_LINE>// Right diagonal.<NEW_LINE>g.setColor(color.darker());<NEW_LINE>g.drawLine(dx / 2, dy, 0, 0);<NEW_LINE>g.drawLine(dx / 2, dy + shift, 0, shift);<NEW_LINE>// Left diagonal.<NEW_LINE>g.setColor(color.brighter());<NEW_LINE>g.drawLine(dx / 2, dy, dx, 0);<NEW_LINE>g.drawLine(dx / 2, dy + shift, dx, shift);<NEW_LINE>// Horizontal line.<NEW_LINE>if (descending) {<NEW_LINE>g.setColor(color.<MASK><NEW_LINE>} else {<NEW_LINE>g.setColor(color.brighter().brighter());<NEW_LINE>}<NEW_LINE>g.drawLine(dx, 0, 0, 0);<NEW_LINE>g.setColor(color);<NEW_LINE>g.translate(-x, -y);<NEW_LINE>} | darker().darker()); |
361,176 | /* (non-Javadoc)<NEW_LINE>* @see org.mitre.oauth2.assertion.AssertionOAuth2RequestFactory#createOAuth2Request(org.springframework.security.oauth2.provider.ClientDetails, org.springframework.security.oauth2.provider.TokenRequest, com.nimbusds.jwt.JWT)<NEW_LINE>*/<NEW_LINE>@Override<NEW_LINE>public OAuth2Request createOAuth2Request(ClientDetails client, TokenRequest tokenRequest, JWT assertion) {<NEW_LINE>try {<NEW_LINE>JWTClaimsSet claims = assertion.getJWTClaimsSet();<NEW_LINE>Set<String> scope = OAuth2Utils.parseParameterList(claims.getStringClaim("scope"));<NEW_LINE>Set<String> resources = Sets.newHashSet(claims.getAudience());<NEW_LINE>return new OAuth2Request(tokenRequest.getRequestParameters(), client.getClientId(), client.getAuthorities(), true, scope, <MASK><NEW_LINE>} catch (ParseException e) {<NEW_LINE>return null;<NEW_LINE>}<NEW_LINE>} | resources, null, null, null); |
488,343 | private static void runAssertionUpdateIStreamSetMapProps(RegressionEnvironment env, EventRepresentationChoice eventRepresentationEnum) {<NEW_LINE>// test update-istream with map<NEW_LINE>RegressionPath path = new RegressionPath();<NEW_LINE>String eplType = eventRepresentationEnum.getAnnotationTextWJsonProvided(MyLocalJsonProvidedMapProp.class) + " @name('type') @public @buseventtype create schema MyInfraTypeWithMapProp(simple String, myarray int[], mymap java.util.Map)";<NEW_LINE>env.compileDeploy(eplType, path);<NEW_LINE>env.compileDeploy("@name('update') update istream MyInfraTypeWithMapProp set simple='A', mymap('abc') = 1, myarray[2] = 10", path).addListener("update");<NEW_LINE>if (eventRepresentationEnum.isObjectArrayEvent()) {<NEW_LINE>env.sendEventObjectArray(new Object[] { null, new int[10], new HashMap<String, Object>() }, "MyInfraTypeWithMapProp");<NEW_LINE>} else if (eventRepresentationEnum.isMapEvent()) {<NEW_LINE>env.sendEventMap(makeMapEvent(new HashMap<>(), new int[10]), "MyInfraTypeWithMapProp");<NEW_LINE>} else if (eventRepresentationEnum.isAvroEvent()) {<NEW_LINE>Schema schema = env.runtimeAvroSchemaByDeployment("type", "MyInfraTypeWithMapProp");<NEW_LINE>GenericData.Record event = new GenericData.Record(schema);<NEW_LINE>event.put("myarray", Arrays.asList(0, 0, 0, 0, 0));<NEW_LINE>event.put("mymap", new HashMap());<NEW_LINE>event.put("simple", "");<NEW_LINE>env.sendEventAvro(event, "MyInfraTypeWithMapProp");<NEW_LINE>} else if (eventRepresentationEnum.isJsonEvent() || eventRepresentationEnum.isJsonProvidedClassEvent()) {<NEW_LINE>JsonArray myarray = new JsonArray().add(0).add(0).add(0).add<MASK><NEW_LINE>JsonObject mymap = new JsonObject();<NEW_LINE>JsonObject event = new JsonObject().add("myarray", myarray).add("mymap", mymap);<NEW_LINE>env.sendEventJson(event.toString(), "MyInfraTypeWithMapProp");<NEW_LINE>} else {<NEW_LINE>fail();<NEW_LINE>}<NEW_LINE>String simpleExpected = eventRepresentationEnum.isAvroEvent() ? "" : null;<NEW_LINE>env.assertPropsIRPair("update", "simple,mymap('abc'),myarray[2]".split(","), new Object[] { "A", 1, 10 }, new Object[] { simpleExpected, null, 0 });<NEW_LINE>env.undeployAll();<NEW_LINE>} | (0).add(0); |
863,563 | public void resolve(Type t, Type declaredType, Type sigType, SootMethodRef callee, SootMethod container, ChunkedQueue<SootMethod> targets, boolean appOnly) {<NEW_LINE>if (declaredType instanceof ArrayType) {<NEW_LINE>declaredType = RefType.v("java.lang.Object");<NEW_LINE>}<NEW_LINE>if (sigType instanceof ArrayType) {<NEW_LINE>sigType = RefType.v("java.lang.Object");<NEW_LINE>}<NEW_LINE>if (t instanceof ArrayType) {<NEW_LINE>t = RefType.v("java.lang.Object");<NEW_LINE>}<NEW_LINE>FastHierarchy fastHierachy = Scene.v().getOrMakeFastHierarchy();<NEW_LINE>if (declaredType != null && !fastHierachy.canStoreType(t, declaredType)) {<NEW_LINE>return;<NEW_LINE>} else if (sigType != null && !fastHierachy.canStoreType(t, sigType)) {<NEW_LINE>return;<NEW_LINE>} else if (t instanceof RefType) {<NEW_LINE>SootMethod target = resolveNonSpecial((RefType) t, callee, appOnly);<NEW_LINE>if (target != null) {<NEW_LINE>targets.add(target);<NEW_LINE>}<NEW_LINE>} else if (t instanceof AnySubType) {<NEW_LINE>RefType base = ((AnySubType) t).getBase();<NEW_LINE>if (options.library() == CGOptions.library_signature_resolution && base.getSootClass().isInterface()) {<NEW_LINE>LOGGER.warn("Deprecated library dispatch is conducted. The results might be unsound...");<NEW_LINE>resolveLibrarySignature(declaredType, sigType, callee, <MASK><NEW_LINE>} else {<NEW_LINE>for (SootMethod dispatch : Scene.v().getOrMakeFastHierarchy().resolveAbstractDispatch(base.getSootClass(), callee)) {<NEW_LINE>targets.add(dispatch);<NEW_LINE>}<NEW_LINE>}<NEW_LINE>} else if (t instanceof NullType) {<NEW_LINE>return;<NEW_LINE>} else {<NEW_LINE>throw new RuntimeException("oops " + t);<NEW_LINE>}<NEW_LINE>} | container, targets, appOnly, base); |
228,490 | public static ListPrintTemplatesResponse unmarshall(ListPrintTemplatesResponse listPrintTemplatesResponse, UnmarshallerContext _ctx) {<NEW_LINE>listPrintTemplatesResponse.setRequestId(_ctx.stringValue("ListPrintTemplatesResponse.RequestId"));<NEW_LINE>listPrintTemplatesResponse.setSuccess<MASK><NEW_LINE>List<PrintTemplateModel> printTemplates = new ArrayList<PrintTemplateModel>();<NEW_LINE>for (int i = 0; i < _ctx.lengthValue("ListPrintTemplatesResponse.PrintTemplates.Length"); i++) {<NEW_LINE>PrintTemplateModel printTemplateModel = new PrintTemplateModel();<NEW_LINE>printTemplateModel.setTemplateId(_ctx.stringValue("ListPrintTemplatesResponse.PrintTemplates[" + i + "].TemplateId"));<NEW_LINE>printTemplateModel.setTemplateName(_ctx.stringValue("ListPrintTemplatesResponse.PrintTemplates[" + i + "].TemplateName"));<NEW_LINE>printTemplates.add(printTemplateModel);<NEW_LINE>}<NEW_LINE>listPrintTemplatesResponse.setPrintTemplates(printTemplates);<NEW_LINE>return listPrintTemplatesResponse;<NEW_LINE>} | (_ctx.booleanValue("ListPrintTemplatesResponse.Success")); |
527,939 | protected GenotypesContext calculateGLsForThisEvent(final AlleleLikelihoods<GATKRead, Allele> readLikelihoods, final VariantContext mergedVC, final List<Allele> noCallAlleles, final byte[] paddedReference, final int offsetForRefIntoEvent, final DragstrReferenceAnalyzer dragstrs) {<NEW_LINE>Utils.nonNull(readLikelihoods, "readLikelihoods");<NEW_LINE><MASK><NEW_LINE>final List<Allele> vcAlleles = mergedVC.getAlleles();<NEW_LINE>final AlleleList<Allele> alleleList = readLikelihoods.numberOfAlleles() == vcAlleles.size() ? readLikelihoods : new IndexedAlleleList<>(vcAlleles);<NEW_LINE>final GenotypingLikelihoods<Allele> likelihoods = genotypingModel.calculateLikelihoods(alleleList, new GenotypingData<>(ploidyModel, readLikelihoods), paddedReference, offsetForRefIntoEvent, dragstrs);<NEW_LINE>final int sampleCount = samples.numberOfSamples();<NEW_LINE>final GenotypesContext result = GenotypesContext.create(sampleCount);<NEW_LINE>for (int s = 0; s < sampleCount; s++) {<NEW_LINE>result.add(new GenotypeBuilder(samples.getSample(s)).alleles(noCallAlleles).PL(likelihoods.sampleLikelihoods(s).getAsPLs()).make());<NEW_LINE>}<NEW_LINE>return result;<NEW_LINE>} | Utils.nonNull(mergedVC, "mergedVC"); |
1,080,703 | final void executeRequestCancelWorkflowExecution(RequestCancelWorkflowExecutionRequest requestCancelWorkflowExecutionRequest) {<NEW_LINE>ExecutionContext executionContext = createExecutionContext(requestCancelWorkflowExecutionRequest);<NEW_LINE>AWSRequestMetrics awsRequestMetrics = executionContext.getAwsRequestMetrics();<NEW_LINE>awsRequestMetrics.startEvent(Field.ClientExecuteTime);<NEW_LINE>Request<RequestCancelWorkflowExecutionRequest> request = null;<NEW_LINE>Response<Void> response = null;<NEW_LINE>try {<NEW_LINE>awsRequestMetrics.startEvent(Field.RequestMarshallTime);<NEW_LINE>try {<NEW_LINE>request = new RequestCancelWorkflowExecutionRequestProtocolMarshaller(protocolFactory).marshall(super.beforeMarshalling(requestCancelWorkflowExecutionRequest));<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(<MASK><NEW_LINE>request.addHandlerContext(HandlerContextKey.SERVICE_ID, "SWF");<NEW_LINE>request.addHandlerContext(HandlerContextKey.OPERATION_NAME, "RequestCancelWorkflowExecution");<NEW_LINE>request.addHandlerContext(HandlerContextKey.ADVANCED_CONFIG, advancedConfig);<NEW_LINE>} finally {<NEW_LINE>awsRequestMetrics.endEvent(Field.RequestMarshallTime);<NEW_LINE>}<NEW_LINE>HttpResponseHandler<AmazonWebServiceResponse<Void>> responseHandler = protocolFactory.createResponseHandler(new JsonOperationMetadata().withPayloadJson(true).withHasStreamingSuccessResponse(false), null);<NEW_LINE>invoke(request, responseHandler, executionContext);<NEW_LINE>} finally {<NEW_LINE>endClientExecution(awsRequestMetrics, request, response);<NEW_LINE>}<NEW_LINE>} | HandlerContextKey.SIGNING_REGION, getSigningRegion()); |
1,493,533 | final GetNetworkInsightsAccessScopeContentResult executeGetNetworkInsightsAccessScopeContent(GetNetworkInsightsAccessScopeContentRequest getNetworkInsightsAccessScopeContentRequest) {<NEW_LINE>ExecutionContext executionContext = createExecutionContext(getNetworkInsightsAccessScopeContentRequest);<NEW_LINE>AWSRequestMetrics awsRequestMetrics = executionContext.getAwsRequestMetrics();<NEW_LINE>awsRequestMetrics.startEvent(Field.ClientExecuteTime);<NEW_LINE>Request<GetNetworkInsightsAccessScopeContentRequest> request = null;<NEW_LINE>Response<GetNetworkInsightsAccessScopeContentResult> response = null;<NEW_LINE>try {<NEW_LINE>awsRequestMetrics.startEvent(Field.RequestMarshallTime);<NEW_LINE>try {<NEW_LINE>request = new GetNetworkInsightsAccessScopeContentRequestMarshaller().marshall(super.beforeMarshalling(getNetworkInsightsAccessScopeContentRequest));<NEW_LINE>// Binds the request metrics to the current request.<NEW_LINE>request.setAWSRequestMetrics(awsRequestMetrics);<NEW_LINE>request.<MASK><NEW_LINE>request.addHandlerContext(HandlerContextKey.ENDPOINT_OVERRIDDEN, isEndpointOverridden());<NEW_LINE>request.addHandlerContext(HandlerContextKey.SIGNING_REGION, getSigningRegion());<NEW_LINE>request.addHandlerContext(HandlerContextKey.SERVICE_ID, "EC2");<NEW_LINE>request.addHandlerContext(HandlerContextKey.OPERATION_NAME, "GetNetworkInsightsAccessScopeContent");<NEW_LINE>request.addHandlerContext(HandlerContextKey.ADVANCED_CONFIG, advancedConfig);<NEW_LINE>} finally {<NEW_LINE>awsRequestMetrics.endEvent(Field.RequestMarshallTime);<NEW_LINE>}<NEW_LINE>StaxResponseHandler<GetNetworkInsightsAccessScopeContentResult> responseHandler = new StaxResponseHandler<GetNetworkInsightsAccessScopeContentResult>(new GetNetworkInsightsAccessScopeContentResultStaxUnmarshaller());<NEW_LINE>response = invoke(request, responseHandler, executionContext);<NEW_LINE>return response.getAwsResponse();<NEW_LINE>} finally {<NEW_LINE>endClientExecution(awsRequestMetrics, request, response);<NEW_LINE>}<NEW_LINE>} | addHandlerContext(HandlerContextKey.CLIENT_ENDPOINT, endpoint); |
503,374 | protected ObjectArrayBackedEventBean createRowIntoTable(Object groupKeys) {<NEW_LINE>EventType eventType = table<MASK><NEW_LINE>AggregationRow aggregationRow = table.getAggregationRowFactory().make();<NEW_LINE>Object[] data = new Object[eventType.getPropertyDescriptors().length];<NEW_LINE>data[0] = aggregationRow;<NEW_LINE>int[] groupKeyColNums = table.getMetaData().getKeyColNums();<NEW_LINE>if (groupKeyColNums.length == 1) {<NEW_LINE>if (groupKeys instanceof MultiKeyArrayWrap) {<NEW_LINE>data[groupKeyColNums[0]] = ((MultiKeyArrayWrap) groupKeys).getArray();<NEW_LINE>} else {<NEW_LINE>data[groupKeyColNums[0]] = groupKeys;<NEW_LINE>}<NEW_LINE>} else {<NEW_LINE>MultiKey mk = (MultiKey) groupKeys;<NEW_LINE>for (int i = 0; i < groupKeyColNums.length; i++) {<NEW_LINE>data[groupKeyColNums[i]] = mk.getKey(i);<NEW_LINE>}<NEW_LINE>}<NEW_LINE>ObjectArrayBackedEventBean row = agentInstanceContext.getEventBeanTypedEventFactory().adapterForTypedObjectArray(data, eventType);<NEW_LINE>addEvent(row);<NEW_LINE>return row;<NEW_LINE>} | .getMetaData().getInternalEventType(); |
797,977 | private static void printFocusInformation() {<NEW_LINE>DockingWindowManager winMgr = DockingWindowManager.getActiveInstance();<NEW_LINE>ComponentPlaceholder info = winMgr.getFocusedComponent();<NEW_LINE>DockableComponent dockableComp = null;<NEW_LINE>if (info != null) {<NEW_LINE>dockableComp = info.getComponent();<NEW_LINE>}<NEW_LINE>log.info("====================================");<NEW_LINE>log.info("Active Docking Window Manager: " + winMgr.getRootFrame().getTitle() + ": " + System.identityHashCode(winMgr.getRootFrame()));<NEW_LINE>if (info != null) {<NEW_LINE>log.info("Focused Docking Window: " + info.getTitle() + ": " + System.identityHashCode(dockableComp));<NEW_LINE>} else {<NEW_LINE>log.info("Focused Docking Window: null");<NEW_LINE>}<NEW_LINE>log.info("");<NEW_LINE>KeyboardFocusManager kfm = KeyboardFocusManager.getCurrentKeyboardFocusManager();<NEW_LINE>log.info("Active Java Window: " + printComp(kfm.getActiveWindow()));<NEW_LINE>log.info("Focused Java Window: " + printComp(kfm.getFocusedWindow()));<NEW_LINE>log.info("Focused Java Component: " + printComp(kfm.getFocusOwner()));<NEW_LINE>Object mouseOverObject = DockingWindowManager.getMouseOverObject();<NEW_LINE>if (mouseOverObject instanceof Component) {<NEW_LINE>log.info("Mouse-over Object: " + <MASK><NEW_LINE>}<NEW_LINE>log.info("");<NEW_LINE>} | printComp((Component) mouseOverObject)); |
687,328 | private HttpPipeline createHttpPipeline() {<NEW_LINE>Configuration buildConfiguration = (configuration == null) ? Configuration.getGlobalConfiguration() : configuration;<NEW_LINE>if (httpLogOptions == null) {<NEW_LINE>httpLogOptions = new HttpLogOptions();<NEW_LINE>}<NEW_LINE>if (clientOptions == null) {<NEW_LINE>clientOptions = new ClientOptions();<NEW_LINE>}<NEW_LINE>List<HttpPipelinePolicy> policies = new ArrayList<>();<NEW_LINE>String clientName = properties.getOrDefault(SDK_NAME, "UnknownName");<NEW_LINE>String clientVersion = properties.getOrDefault(SDK_VERSION, "UnknownVersion");<NEW_LINE>String applicationId = <MASK><NEW_LINE>policies.add(new UserAgentPolicy(applicationId, clientName, clientVersion, buildConfiguration));<NEW_LINE>HttpHeaders headers = new HttpHeaders();<NEW_LINE>clientOptions.getHeaders().forEach(header -> headers.set(header.getName(), header.getValue()));<NEW_LINE>if (headers.getSize() > 0) {<NEW_LINE>policies.add(new AddHeadersPolicy(headers));<NEW_LINE>}<NEW_LINE>HttpPolicyProviders.addBeforeRetryPolicies(policies);<NEW_LINE>policies.add(retryPolicy == null ? new RetryPolicy() : retryPolicy);<NEW_LINE>policies.add(new CookiePolicy());<NEW_LINE>if (tokenCredential != null) {<NEW_LINE>policies.add(new BearerTokenAuthenticationPolicy(tokenCredential, DEFAULT_SCOPES));<NEW_LINE>}<NEW_LINE>policies.addAll(this.pipelinePolicies);<NEW_LINE>HttpPolicyProviders.addAfterRetryPolicies(policies);<NEW_LINE>policies.add(new HttpLoggingPolicy(httpLogOptions));<NEW_LINE>HttpPipeline httpPipeline = new HttpPipelineBuilder().policies(policies.toArray(new HttpPipelinePolicy[0])).httpClient(httpClient).build();<NEW_LINE>return httpPipeline;<NEW_LINE>} | CoreUtils.getApplicationId(clientOptions, httpLogOptions); |
932,684 | public static String genSortTextByAssignability(BallerinaCompletionContext context, LSCompletionItem completionItem, TypeSymbol typeSymbol) {<NEW_LINE>if (isCompletionItemAssignable(completionItem, typeSymbol)) {<NEW_LINE>return genSortText(1) + genSortText(toRank(context, completionItem));<NEW_LINE>} else if (typeSymbol.typeKind() == TypeDescKind.FUNCTION) {<NEW_LINE>CompletionItemKind completionItemKind = completionItem.getCompletionItem().getKind();<NEW_LINE>if (completionItem.getType() == SYMBOL && completionItemKind == CompletionItemKind.Function) {<NEW_LINE>return genSortText(2) + genSortText(toRank(context, completionItem));<NEW_LINE>} else if (completionItem.getType() == SNIPPET) {<NEW_LINE>if (((SnippetCompletionItem) completionItem).id().equals(ItemResolverConstants.ANON_FUNCTION)) {<NEW_LINE>return genSortText(3) + genSortText<MASK><NEW_LINE>} else if (((SnippetCompletionItem) completionItem).id().equals(Snippet.KW_FUNCTION.name())) {<NEW_LINE>return genSortText(4) + genSortText(toRank(context, completionItem));<NEW_LINE>}<NEW_LINE>}<NEW_LINE>}<NEW_LINE>return genSortText(toRank(context, completionItem, 4));<NEW_LINE>} | (toRank(context, completionItem)); |
1,794,219 | public void handle(Element element) {<NEW_LINE>handleCommonBeanAttributes(element, builder, parserContext);<NEW_LINE>NamedNodeMap attributes = element.getAttributes();<NEW_LINE>String uri = null;<NEW_LINE>String instanceRef = null;<NEW_LINE>if (attributes != null) {<NEW_LINE>Node instanceRefNode = attributes.getNamedItem("instance-ref");<NEW_LINE>if (instanceRefNode != null) {<NEW_LINE>instanceRef = getTextContent(instanceRefNode);<NEW_LINE>}<NEW_LINE>Node uriNode = attributes.getNamedItem("uri");<NEW_LINE>if (uriNode != null) {<NEW_LINE>uri = getTextContent(uriNode);<NEW_LINE>}<NEW_LINE>}<NEW_LINE>Properties properties = new Properties();<NEW_LINE>for (Node n : childElements(element)) {<NEW_LINE>String nodeName = cleanNodeName(n);<NEW_LINE>if ("properties".equals(nodeName)) {<NEW_LINE>for (Node propNode : childElements(n)) {<NEW_LINE>String name = cleanNodeName(propNode);<NEW_LINE>String propertyName;<NEW_LINE>if (!"property".equals(name)) {<NEW_LINE>continue;<NEW_LINE>}<NEW_LINE>propertyName = getTextContent(propNode.getAttributes().getNamedItem<MASK><NEW_LINE>String value = getTextContent(propNode);<NEW_LINE>properties.setProperty(propertyName, value);<NEW_LINE>}<NEW_LINE>}<NEW_LINE>}<NEW_LINE>if (instanceRef != null) {<NEW_LINE>builder.addConstructorArgReference(instanceRef);<NEW_LINE>}<NEW_LINE>builder.addConstructorArgValue(uri);<NEW_LINE>builder.addConstructorArgValue(properties);<NEW_LINE>builder.setFactoryMethod("getCacheManager");<NEW_LINE>} | ("name")).trim(); |
1,172,529 | private void moveProperty(JsObject newParent, JsObject property) {<NEW_LINE>JsObject newProperty = newParent.getProperty(property.getName());<NEW_LINE>if (property.getParent() != null) {<NEW_LINE>property.getParent().getProperties().remove(property.getName());<NEW_LINE>}<NEW_LINE>if (newProperty == null) {<NEW_LINE>((JsObjectImpl) property).setParent(newParent);<NEW_LINE>newParent.addProperty(property.getName(), property);<NEW_LINE>} else {<NEW_LINE>if (property.isDeclared() && !newProperty.isDeclared()) {<NEW_LINE>JsObject tmpProperty = newProperty;<NEW_LINE>newParent.addProperty(property.getName(), property);<NEW_LINE>((JsObjectImpl) property).setParent(newParent);<NEW_LINE>newProperty = property;<NEW_LINE>property = tmpProperty;<NEW_LINE>}<NEW_LINE>JsObjectImpl.moveOccurrenceOfProperties((JsObjectImpl) newProperty, property);<NEW_LINE>for (Occurrence occurrence : property.getOccurrences()) {<NEW_LINE>newProperty.addOccurrence(occurrence.getOffsetRange());<NEW_LINE>}<NEW_LINE>List<JsObject> propertiesToMove = new ArrayList<>(property.getProperties().values());<NEW_LINE>for (JsObject propOfProperty : propertiesToMove) {<NEW_LINE>moveProperty(newProperty, propOfProperty);<NEW_LINE>}<NEW_LINE>// the property needs to be resolved again to handle right occurrences<NEW_LINE>resolveLocalTypes(newProperty<MASK><NEW_LINE>}<NEW_LINE>} | , JsDocumentationSupport.getDocumentationHolder(parserResult)); |
1,256,181 | public WapitiCRFModel loadModel(InputStream is) throws Exception {<NEW_LINE>BufferedReader br = IOUtil.getReader(is, IOUtil.UTF8);<NEW_LINE>long start = System.currentTimeMillis();<NEW_LINE>logger.info("load wapiti model begin!");<NEW_LINE>String temp = br.readLine();<NEW_LINE>// #mdl#2#123<NEW_LINE>logger.info(temp);<NEW_LINE>Map<String, Integer> featureIndex = loadConfig(br);<NEW_LINE>StringBuilder sb = new StringBuilder();<NEW_LINE>for (int[] t1 : config.getTemplate()) {<NEW_LINE>sb.append(Arrays.toString(t1) + " ");<NEW_LINE>}<NEW_LINE>logger.info("featureIndex is " + featureIndex);<NEW_LINE>logger.info("load template ok template : " + sb);<NEW_LINE>int[] statusCoven = loadTagCoven(br);<NEW_LINE>List<Pair<String, String>> loadFeatureName = loadFeatureName(featureIndex, br);<NEW_LINE>logger.info("load feature ok feature size : " + loadFeatureName.size());<NEW_LINE>featureTree = new SmartForest<float[]>();<NEW_LINE>loadFeatureWeight(br, statusCoven, loadFeatureName);<NEW_LINE>logger.info("load wapiti model ok ! use time :" + (System<MASK><NEW_LINE>return this;<NEW_LINE>} | .currentTimeMillis() - start)); |
1,220,831 | protected boolean readResponse(InputStream in, HttpURLConnection hconn) {<NEW_LINE>boolean readResult;<NEW_LINE>manifest = new Manifest();<NEW_LINE>try {<NEW_LINE>Logger.log(Level.FINEST, "Reading response from {0}:{1}", new Object[] { server.getHost(), Integer.toString(server.getAdminPort()) });<NEW_LINE>manifest.read(in);<NEW_LINE>} catch (IOException ioe) {<NEW_LINE>throw new <MASK><NEW_LINE>}<NEW_LINE>if (successExitCode(manifest)) {<NEW_LINE>readResult = true;<NEW_LINE>} else {<NEW_LINE>readResult = false;<NEW_LINE>String message = getMessage(manifest);<NEW_LINE>if (message != null) {<NEW_LINE>if (message.contains("please wait")) {<NEW_LINE>retry = true;<NEW_LINE>} else if (message.contains("javax.security.auth.login.LoginException")) {<NEW_LINE>auth = false;<NEW_LINE>}<NEW_LINE>}<NEW_LINE>}<NEW_LINE>return readResult;<NEW_LINE>} | CommandException(CommandException.HTTP_RESP_IO_EXCEPTION, ioe); |
701,131 | private void refreshDashboardLeaderTreeCache() {<NEW_LINE>closeDeprecatedDashboardLeaderTreeCache();<NEW_LINE>Iterator<Entry<String, ZkCluster>> iterator = zkClusterMap.entrySet().iterator();<NEW_LINE>while (iterator.hasNext()) {<NEW_LINE>Entry<String, ZkCluster> next = iterator.next();<NEW_LINE>String zkClusterKey = next.getKey();<NEW_LINE>ZkCluster zkCluster = next.getValue();<NEW_LINE>if (needToRefreshDashboardTreeCache(zkCluster, zkClusterKey)) {<NEW_LINE>DashboardLeaderHandler dashboardLeaderHandler = null;<NEW_LINE>try {<NEW_LINE>dashboardLeaderHandler = new DashboardLeaderHandler(zkCluster.getZkAlias(), zkCluster.getCuratorFrameworkOp().getCuratorFramework());<NEW_LINE>dashboardLeaderHandler.start();<NEW_LINE>dashboardLeaderTreeCacheMap.put(zkClusterKey, dashboardLeaderHandler);<NEW_LINE>} catch (Exception e) {<NEW_LINE>log.error(<MASK><NEW_LINE>if (dashboardLeaderHandler != null) {<NEW_LINE>dashboardLeaderHandler.shutdown();<NEW_LINE>}<NEW_LINE>}<NEW_LINE>}<NEW_LINE>}<NEW_LINE>} | e.getMessage(), e); |
1,059,698 | public void marshall(UpdateImagePipelineRequest updateImagePipelineRequest, ProtocolMarshaller protocolMarshaller) {<NEW_LINE>if (updateImagePipelineRequest == null) {<NEW_LINE>throw new SdkClientException("Invalid argument passed to marshall(...)");<NEW_LINE>}<NEW_LINE>try {<NEW_LINE>protocolMarshaller.marshall(updateImagePipelineRequest.getImagePipelineArn(), IMAGEPIPELINEARN_BINDING);<NEW_LINE>protocolMarshaller.marshall(updateImagePipelineRequest.getDescription(), DESCRIPTION_BINDING);<NEW_LINE>protocolMarshaller.marshall(updateImagePipelineRequest.getImageRecipeArn(), IMAGERECIPEARN_BINDING);<NEW_LINE>protocolMarshaller.marshall(updateImagePipelineRequest.getContainerRecipeArn(), CONTAINERRECIPEARN_BINDING);<NEW_LINE>protocolMarshaller.marshall(updateImagePipelineRequest.getInfrastructureConfigurationArn(), INFRASTRUCTURECONFIGURATIONARN_BINDING);<NEW_LINE>protocolMarshaller.marshall(updateImagePipelineRequest.getDistributionConfigurationArn(), DISTRIBUTIONCONFIGURATIONARN_BINDING);<NEW_LINE>protocolMarshaller.marshall(<MASK><NEW_LINE>protocolMarshaller.marshall(updateImagePipelineRequest.getEnhancedImageMetadataEnabled(), ENHANCEDIMAGEMETADATAENABLED_BINDING);<NEW_LINE>protocolMarshaller.marshall(updateImagePipelineRequest.getSchedule(), SCHEDULE_BINDING);<NEW_LINE>protocolMarshaller.marshall(updateImagePipelineRequest.getStatus(), STATUS_BINDING);<NEW_LINE>protocolMarshaller.marshall(updateImagePipelineRequest.getClientToken(), CLIENTTOKEN_BINDING);<NEW_LINE>} catch (Exception e) {<NEW_LINE>throw new SdkClientException("Unable to marshall request to JSON: " + e.getMessage(), e);<NEW_LINE>}<NEW_LINE>} | updateImagePipelineRequest.getImageTestsConfiguration(), IMAGETESTSCONFIGURATION_BINDING); |
305,959 | private void computeGCRootsFor(TagBounds tagBounds, Collection<GCRoot> roots) {<NEW_LINE>if (tagBounds != null) {<NEW_LINE>int rootTag = tagBounds.tag;<NEW_LINE>long[] offset = new <MASK><NEW_LINE>while (offset[0] < tagBounds.endOffset) {<NEW_LINE>long start = offset[0];<NEW_LINE>if (heap.readDumpTag(offset) == rootTag) {<NEW_LINE>HprofGCRoot root;<NEW_LINE>if (rootTag == HprofHeap.ROOT_THREAD_OBJECT) {<NEW_LINE>root = new ThreadObjectHprofGCRoot(this, start);<NEW_LINE>} else if (rootTag == HprofHeap.ROOT_JAVA_FRAME) {<NEW_LINE>root = new JavaFrameHprofGCRoot(this, start);<NEW_LINE>} else {<NEW_LINE>root = new HprofGCRoot(this, start);<NEW_LINE>}<NEW_LINE>roots.add(root);<NEW_LINE>}<NEW_LINE>}<NEW_LINE>}<NEW_LINE>} | long[] { tagBounds.startOffset }; |
1,300,799 | private void doProfileClient(CaptureContext context, String clientRequestURL, String appid) {<NEW_LINE>Profile p = ProfileFactory.instance().getProfile(appid);<NEW_LINE>if (p != null) {<NEW_LINE>ProfileContext pc = new StandardProfileContext();<NEW_LINE>String action = (String) context.get(CaptureConstants.INFO_CLIENT_REQUEST_ACTION);<NEW_LINE>Integer rc = (Integer) context.get(CaptureConstants.INFO_CLIENT_RESPONSECODE);<NEW_LINE>String rs = (String) context.get(CaptureConstants.INFO_CLIENT_RESPONSESTATE);<NEW_LINE>String type = (String) context.get(CaptureConstants.INFO_CLIENT_TYPE);<NEW_LINE>String server = (String) context.get(CaptureConstants.INFO_CLIENT_TARGETSERVER);<NEW_LINE>pc.put(ProfileConstants.PC_ARG_CLIENT_URL, clientRequestURL);<NEW_LINE>pc.put(ProfileConstants.PC_ARG_CLIENT_ACTION, action);<NEW_LINE>pc.put(ProfileConstants.PC_ARG_CLIENT_RC, rc);<NEW_LINE>pc.put(ProfileConstants.PC_ARG_CLIENT_RS, rs);<NEW_LINE>pc.put(ProfileConstants.PC_ARG_CLIENT_TYPE, type);<NEW_LINE>pc.<MASK><NEW_LINE>pc.addPE(ProfileConstants.PROELEM_CLIENT);<NEW_LINE>p.doProfiling(pc);<NEW_LINE>}<NEW_LINE>} | put(ProfileConstants.PC_ARG_CLIENT_TARGETSERVER, server); |
816,227 | public boolean match(Object value) {<NEW_LINE>if (longValue != 0) {<NEW_LINE>long result = ((Number) value).longValue() & longValue;<NEW_LINE>switch(operator) {<NEW_LINE>case EQUAL:<NEW_LINE>return result == longValue;<NEW_LINE>case NOT_EQUAL:<NEW_LINE>return result != longValue;<NEW_LINE>case GREATER:<NEW_LINE>return result > longValue;<NEW_LINE>case GREATER_EQUAL:<NEW_LINE>return result >= longValue;<NEW_LINE>case LESS:<NEW_LINE>return result < longValue;<NEW_LINE>default:<NEW_LINE>// LESS_EQUAL:<NEW_LINE>return result <= longValue;<NEW_LINE>}<NEW_LINE>} else {<NEW_LINE>Number val = Variant.and((Number) value, andValue);<NEW_LINE>switch(operator) {<NEW_LINE>case EQUAL:<NEW_LINE>return Variant.isEquals(val, rightValue);<NEW_LINE>case GREATER:<NEW_LINE>return Variant.compare(val, rightValue, true) > 0;<NEW_LINE>case GREATER_EQUAL:<NEW_LINE>return Variant.compare(val, rightValue, true) >= 0;<NEW_LINE>case LESS:<NEW_LINE>return Variant.compare(<MASK><NEW_LINE>case LESS_EQUAL:<NEW_LINE>return Variant.compare(val, rightValue, true) <= 0;<NEW_LINE>default:<NEW_LINE>// NOT_EQUAL:<NEW_LINE>return !Variant.isEquals(val, rightValue);<NEW_LINE>}<NEW_LINE>}<NEW_LINE>} | val, rightValue, true) < 0; |
859,967 | public void doValidation(Object input) throws LinkisClientRuntimeException {<NEW_LINE>if (!(input instanceof LinkisManageJob)) {<NEW_LINE>throw new ValidateException("VLD0007", ErrorLevel.ERROR, CommonErrMsg.ValidationErr, "Input of LinkisSubmitValidator is not instance of LinkisManageJob. Type: " + input.getClass().getCanonicalName());<NEW_LINE>}<NEW_LINE>boolean ok = true;<NEW_LINE>StringBuilder reasonSb = new StringBuilder();<NEW_LINE>LinkisJobManDesc desc = ((LinkisManageJob) input).getJobDesc();<NEW_LINE>if (StringUtils.isBlank(desc.getJobID())) {<NEW_LINE>reasonSb.append("jobId cannot be empty or blank").append(System.lineSeparator());<NEW_LINE>ok = false;<NEW_LINE>}<NEW_LINE>if (StringUtils.isBlank(desc.getUser())) {<NEW_LINE>reasonSb.append("user cannot be empty or blank").append(System.lineSeparator());<NEW_LINE>ok = false;<NEW_LINE>}<NEW_LINE>if (!ok) {<NEW_LINE>throw new ValidateException("VLD0008", ErrorLevel.ERROR, CommonErrMsg.ValidationErr, <MASK><NEW_LINE>}<NEW_LINE>} | "LinkisJobMan validation failed. Reason: " + reasonSb.toString()); |
1,343,581 | public void write(org.apache.thrift.protocol.TProtocol oprot, partition_configuration struct) throws org.apache.thrift.TException {<NEW_LINE>struct.validate();<NEW_LINE>oprot.writeStructBegin(STRUCT_DESC);<NEW_LINE>if (struct.pid != null) {<NEW_LINE>oprot.writeFieldBegin(PID_FIELD_DESC);<NEW_LINE>struct.pid.write(oprot);<NEW_LINE>oprot.writeFieldEnd();<NEW_LINE>}<NEW_LINE>oprot.writeFieldBegin(BALLOT_FIELD_DESC);<NEW_LINE>oprot.writeI64(struct.ballot);<NEW_LINE>oprot.writeFieldEnd();<NEW_LINE>oprot.writeFieldBegin(MAX_REPLICA_COUNT_FIELD_DESC);<NEW_LINE>oprot.writeI32(struct.max_replica_count);<NEW_LINE>oprot.writeFieldEnd();<NEW_LINE>if (struct.primary != null) {<NEW_LINE>oprot.writeFieldBegin(PRIMARY_FIELD_DESC);<NEW_LINE><MASK><NEW_LINE>oprot.writeFieldEnd();<NEW_LINE>}<NEW_LINE>if (struct.secondaries != null) {<NEW_LINE>oprot.writeFieldBegin(SECONDARIES_FIELD_DESC);<NEW_LINE>{<NEW_LINE>oprot.writeListBegin(new org.apache.thrift.protocol.TList(org.apache.thrift.protocol.TType.STRUCT, struct.secondaries.size()));<NEW_LINE>for (rpc_address _iter6 : struct.secondaries) {<NEW_LINE>_iter6.write(oprot);<NEW_LINE>}<NEW_LINE>oprot.writeListEnd();<NEW_LINE>}<NEW_LINE>oprot.writeFieldEnd();<NEW_LINE>}<NEW_LINE>if (struct.last_drops != null) {<NEW_LINE>oprot.writeFieldBegin(LAST_DROPS_FIELD_DESC);<NEW_LINE>{<NEW_LINE>oprot.writeListBegin(new org.apache.thrift.protocol.TList(org.apache.thrift.protocol.TType.STRUCT, struct.last_drops.size()));<NEW_LINE>for (rpc_address _iter7 : struct.last_drops) {<NEW_LINE>_iter7.write(oprot);<NEW_LINE>}<NEW_LINE>oprot.writeListEnd();<NEW_LINE>}<NEW_LINE>oprot.writeFieldEnd();<NEW_LINE>}<NEW_LINE>oprot.writeFieldBegin(LAST_COMMITTED_DECREE_FIELD_DESC);<NEW_LINE>oprot.writeI64(struct.last_committed_decree);<NEW_LINE>oprot.writeFieldEnd();<NEW_LINE>oprot.writeFieldStop();<NEW_LINE>oprot.writeStructEnd();<NEW_LINE>} | struct.primary.write(oprot); |
785,079 | private void updateProviderInfo() {<NEW_LINE>provider = getContext(this).getProviderFromEmail(emailInput.getText().toString());<NEW_LINE>if (provider != null) {<NEW_LINE>Resources res = getResources();<NEW_LINE>providerHint.setText(provider.getBeforeLoginHint());<NEW_LINE>switch(provider.getStatus()) {<NEW_LINE>case DcProvider.DC_PROVIDER_STATUS_PREPARATION:<NEW_LINE>providerHint.setTextColor(res.getColor(R.color.provider_prep_fg));<NEW_LINE>providerLink.setTextColor(res.getColor<MASK><NEW_LINE>providerLayout.setBackgroundColor(res.getColor(R.color.provider_prep_bg));<NEW_LINE>providerLayout.setVisibility(View.VISIBLE);<NEW_LINE>break;<NEW_LINE>case DcProvider.DC_PROVIDER_STATUS_BROKEN:<NEW_LINE>providerHint.setTextColor(res.getColor(R.color.provider_broken_fg));<NEW_LINE>providerLink.setTextColor(res.getColor(R.color.provider_broken_fg));<NEW_LINE>providerLayout.setBackgroundColor(getResources().getColor(R.color.provider_broken_bg));<NEW_LINE>providerLayout.setVisibility(View.VISIBLE);<NEW_LINE>break;<NEW_LINE>default:<NEW_LINE>providerLayout.setVisibility(View.GONE);<NEW_LINE>break;<NEW_LINE>}<NEW_LINE>} else {<NEW_LINE>providerLayout.setVisibility(View.GONE);<NEW_LINE>}<NEW_LINE>} | (R.color.provider_prep_fg)); |
1,158,475 | private void addQuarkusDevModeDeps(GradleDevModeLauncher.Builder builder) {<NEW_LINE>final String pomPropsPath = "META-INF/maven/io.quarkus/quarkus-core-deployment/pom.properties";<NEW_LINE>final InputStream devModePomPropsIs = DevModeMain.class.getClassLoader().getResourceAsStream(pomPropsPath);<NEW_LINE>if (devModePomPropsIs == null) {<NEW_LINE>throw new GradleException("Failed to locate " + pomPropsPath + " on the classpath");<NEW_LINE>}<NEW_LINE>final Properties devModeProps = new Properties();<NEW_LINE>try (InputStream is = devModePomPropsIs) {<NEW_LINE>devModeProps.load(is);<NEW_LINE>} catch (IOException e) {<NEW_LINE>throw new GradleException("Failed to load " + pomPropsPath + " from the classpath", e);<NEW_LINE>}<NEW_LINE>final String <MASK><NEW_LINE>if (devModeGroupId == null) {<NEW_LINE>throw new GradleException("Classpath resource " + pomPropsPath + " is missing groupId");<NEW_LINE>}<NEW_LINE>final String devModeArtifactId = devModeProps.getProperty("artifactId");<NEW_LINE>if (devModeArtifactId == null) {<NEW_LINE>throw new GradleException("Classpath resource " + pomPropsPath + " is missing artifactId");<NEW_LINE>}<NEW_LINE>final String devModeVersion = devModeProps.getProperty("version");<NEW_LINE>if (devModeVersion == null) {<NEW_LINE>throw new GradleException("Classpath resource " + pomPropsPath + " is missing version");<NEW_LINE>}<NEW_LINE>Dependency devModeDependency = getProject().getDependencies().create(String.format("%s:%s:%s", devModeGroupId, devModeArtifactId, devModeVersion));<NEW_LINE>final Configuration devModeDependencyConfiguration = getProject().getConfigurations().detachedConfiguration(devModeDependency);<NEW_LINE>for (ResolvedArtifact appDep : devModeDependencyConfiguration.getResolvedConfiguration().getResolvedArtifacts()) {<NEW_LINE>ModuleVersionIdentifier artifactId = appDep.getModuleVersion().getId();<NEW_LINE>// we only use the launcher for launching from the IDE, we need to exclude it<NEW_LINE>if (!(artifactId.getGroup().equals("io.quarkus") && artifactId.getName().equals("quarkus-ide-launcher"))) {<NEW_LINE>if (artifactId.getGroup().equals("io.quarkus") && artifactId.getName().equals("quarkus-class-change-agent")) {<NEW_LINE>builder.jvmArgs("-javaagent:" + appDep.getFile().getAbsolutePath());<NEW_LINE>} else {<NEW_LINE>builder.classpathEntry(appDep.getFile());<NEW_LINE>}<NEW_LINE>}<NEW_LINE>}<NEW_LINE>} | devModeGroupId = devModeProps.getProperty("groupId"); |
760,022 | final DeleteWebACLResult executeDeleteWebACL(DeleteWebACLRequest deleteWebACLRequest) {<NEW_LINE>ExecutionContext executionContext = createExecutionContext(deleteWebACLRequest);<NEW_LINE>AWSRequestMetrics awsRequestMetrics = executionContext.getAwsRequestMetrics();<NEW_LINE>awsRequestMetrics.startEvent(Field.ClientExecuteTime);<NEW_LINE>Request<DeleteWebACLRequest> request = null;<NEW_LINE>Response<DeleteWebACLResult> response = null;<NEW_LINE>try {<NEW_LINE>awsRequestMetrics.startEvent(Field.RequestMarshallTime);<NEW_LINE>try {<NEW_LINE>request = new DeleteWebACLRequestProtocolMarshaller(protocolFactory).marshall(super.beforeMarshalling(deleteWebACLRequest));<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, "WAFV2");<NEW_LINE>request.addHandlerContext(HandlerContextKey.OPERATION_NAME, "DeleteWebACL");<NEW_LINE>request.addHandlerContext(HandlerContextKey.ADVANCED_CONFIG, advancedConfig);<NEW_LINE>} finally {<NEW_LINE><MASK><NEW_LINE>}<NEW_LINE>HttpResponseHandler<AmazonWebServiceResponse<DeleteWebACLResult>> responseHandler = protocolFactory.createResponseHandler(new JsonOperationMetadata().withPayloadJson(true).withHasStreamingSuccessResponse(false), new DeleteWebACLResultJsonUnmarshaller());<NEW_LINE>response = invoke(request, responseHandler, executionContext);<NEW_LINE>return response.getAwsResponse();<NEW_LINE>} finally {<NEW_LINE>endClientExecution(awsRequestMetrics, request, response);<NEW_LINE>}<NEW_LINE>} | awsRequestMetrics.endEvent(Field.RequestMarshallTime); |
1,490,260 | protected void processDeviceStateEvent(ProcessedEventPayload payload) throws SiteWhereException {<NEW_LINE>// Only process events that affect state.<NEW_LINE>IDeviceEvent event = payload.getEvent();<NEW_LINE>IDeviceEventContext context = payload.getEventContext();<NEW_LINE>// IDeviceState original = getDeviceStateManagement()<NEW_LINE>// .getDeviceStateByDeviceAssignmentId(event.getDeviceAssignmentId());<NEW_LINE>IDeviceState original = null;<NEW_LINE>switch(event.getEventType()) {<NEW_LINE>case Alert:<NEW_LINE>case Location:<NEW_LINE>case Measurement:<NEW_LINE>{<NEW_LINE>break;<NEW_LINE>}<NEW_LINE>default:<NEW_LINE>{<NEW_LINE>// Allow other events to trigger presence detected.<NEW_LINE>if ((original == null) || (original.getPresenceMissingDate() == null)) {<NEW_LINE>return;<NEW_LINE>}<NEW_LINE>}<NEW_LINE>}<NEW_LINE>DeviceStateCreateRequest request = new DeviceStateCreateRequest();<NEW_LINE>request.setDeviceId(event.getDeviceId());<NEW_LINE>request.setDeviceTypeId(context.getDeviceTypeId());<NEW_LINE>request.setDeviceAssignmentId(event.getDeviceAssignmentId());<NEW_LINE>request.setCustomerId(event.getCustomerId());<NEW_LINE>request.setAreaId(event.getAreaId());<NEW_LINE>request.setAssetId(event.getAssetId());<NEW_LINE>request.setLastInteractionDate(new Date());<NEW_LINE>request.setPresenceMissingDate(null);<NEW_LINE>// Create or update device state.<NEW_LINE>if (original != null) {<NEW_LINE>getDeviceStateManagement().updateDeviceState(<MASK><NEW_LINE>} else {<NEW_LINE>getDeviceStateManagement().createDeviceState(request);<NEW_LINE>}<NEW_LINE>} | original.getId(), request); |
139,323 | public static ListSnapshotResponse unmarshall(ListSnapshotResponse listSnapshotResponse, UnmarshallerContext _ctx) {<NEW_LINE>listSnapshotResponse.setRequestId(_ctx.stringValue("ListSnapshotResponse.RequestId"));<NEW_LINE>listSnapshotResponse.setTotalCount(_ctx.integerValue("ListSnapshotResponse.TotalCount"));<NEW_LINE>listSnapshotResponse.setPageNumber(_ctx.integerValue("ListSnapshotResponse.PageNumber"));<NEW_LINE>listSnapshotResponse.setPageSize(_ctx.integerValue("ListSnapshotResponse.PageSize"));<NEW_LINE>List<SnapshotsItem> snapshots = new ArrayList<SnapshotsItem>();<NEW_LINE>for (int i = 0; i < _ctx.lengthValue("ListSnapshotResponse.Snapshots.Length"); i++) {<NEW_LINE>SnapshotsItem snapshotsItem = new SnapshotsItem();<NEW_LINE>snapshotsItem.setCategory(_ctx.stringValue("ListSnapshotResponse.Snapshots[" + i + "].Category"));<NEW_LINE>snapshotsItem.setCreationTime(_ctx.stringValue("ListSnapshotResponse.Snapshots[" + i + "].CreationTime"));<NEW_LINE>snapshotsItem.setDescription(_ctx.stringValue("ListSnapshotResponse.Snapshots[" + i + "].Description"));<NEW_LINE>snapshotsItem.setLastModifiedTime(_ctx.stringValue("ListSnapshotResponse.Snapshots[" + i + "].LastModifiedTime"));<NEW_LINE>snapshotsItem.setProgress(_ctx.stringValue("ListSnapshotResponse.Snapshots[" + i + "].Progress"));<NEW_LINE>snapshotsItem.setRemainTime(_ctx.integerValue<MASK><NEW_LINE>snapshotsItem.setRetentionDays(_ctx.integerValue("ListSnapshotResponse.Snapshots[" + i + "].RetentionDays"));<NEW_LINE>snapshotsItem.setSnapshotId(_ctx.stringValue("ListSnapshotResponse.Snapshots[" + i + "].SnapshotId"));<NEW_LINE>snapshotsItem.setSnapshotName(_ctx.stringValue("ListSnapshotResponse.Snapshots[" + i + "].SnapshotName"));<NEW_LINE>snapshotsItem.setSnapshotType(_ctx.stringValue("ListSnapshotResponse.Snapshots[" + i + "].SnapshotType"));<NEW_LINE>snapshotsItem.setStatus(_ctx.stringValue("ListSnapshotResponse.Snapshots[" + i + "].Status"));<NEW_LINE>snapshotsItem.setSourceFsId(_ctx.stringValue("ListSnapshotResponse.Snapshots[" + i + "].SourceFsId"));<NEW_LINE>snapshotsItem.setSourceFsSize(_ctx.integerValue("ListSnapshotResponse.Snapshots[" + i + "].SourceFsSize"));<NEW_LINE>snapshots.add(snapshotsItem);<NEW_LINE>}<NEW_LINE>listSnapshotResponse.setSnapshots(snapshots);<NEW_LINE>return listSnapshotResponse;<NEW_LINE>} | ("ListSnapshotResponse.Snapshots[" + i + "].RemainTime")); |
376,220 | public static void zoom(int AD_Table_ID, int Record_ID) {<NEW_LINE>String TableName = null;<NEW_LINE>int AD_Window_ID = 0;<NEW_LINE>int PO_Window_ID = 0;<NEW_LINE>String sql = "SELECT TableName, AD_Window_ID, PO_Window_ID FROM AD_Table WHERE AD_Table_ID=?";<NEW_LINE>try {<NEW_LINE>PreparedStatement pstmt = DB.prepareStatement(sql, null);<NEW_LINE>pstmt.setInt(1, AD_Table_ID);<NEW_LINE>ResultSet rs = pstmt.executeQuery();<NEW_LINE>if (rs.next()) {<NEW_LINE>TableName = rs.getString(1);<NEW_LINE>AD_Window_ID = rs.getInt(2);<NEW_LINE>PO_Window_ID = rs.getInt(3);<NEW_LINE>}<NEW_LINE>rs.close();<NEW_LINE>pstmt.close();<NEW_LINE>} catch (SQLException e) {<NEW_LINE>log.log(Level.SEVERE, sql, e);<NEW_LINE>}<NEW_LINE>// Nothing to Zoom to<NEW_LINE>if (TableName == null || AD_Window_ID == 0)<NEW_LINE>return;<NEW_LINE>// PO Zoom ?<NEW_LINE>boolean isSOTrx = true;<NEW_LINE>if (PO_Window_ID != 0) {<NEW_LINE>String whereClause = TableName + "_ID=" + Record_ID;<NEW_LINE>isSOTrx = DB.isSOTrx(TableName, whereClause);<NEW_LINE>if (!isSOTrx)<NEW_LINE>AD_Window_ID = PO_Window_ID;<NEW_LINE>}<NEW_LINE>log.config(TableName + " - Record_ID=" + Record_ID + " (IsSOTrx=" + isSOTrx + ")");<NEW_LINE>zoom(AD_Window_ID, MQuery.getEqualQuery<MASK><NEW_LINE>} | (TableName + "_ID", Record_ID)); |
1,817,128 | private boolean completeWithFuture(ListenableFuture<? extends V> future, Object expected) {<NEW_LINE>Object valueToSet;<NEW_LINE>if (future instanceof TrustedFuture) {<NEW_LINE>// Break encapsulation for TrustedFuture instances since we know that subclasses cannot<NEW_LINE>// override .get() (since it is final) and therefore this is equivalent to calling .get()<NEW_LINE>// and unpacking the exceptions like we do below (just much faster because it is a single<NEW_LINE>// field read instead of a read, several branches and possibly creating exceptions).<NEW_LINE>valueToSet = ((AbstractFuture<?>) future).value;<NEW_LINE>} else {<NEW_LINE>// Otherwise calculate valueToSet by calling .get()<NEW_LINE>try {<NEW_LINE>V v = Uninterruptibles.getUninterruptibly(future);<NEW_LINE>valueToSet = v == null ? NULL : v;<NEW_LINE>} catch (ExecutionException exception) {<NEW_LINE>valueToSet = new Failure(exception.getCause());<NEW_LINE>} catch (CancellationException cancellation) {<NEW_LINE>valueToSet <MASK><NEW_LINE>} catch (Throwable t) {<NEW_LINE>valueToSet = new Failure(t);<NEW_LINE>}<NEW_LINE>}<NEW_LINE>// The only way this can fail is if we raced with another thread calling cancel(). If we lost<NEW_LINE>// that race then there is nothing to do.<NEW_LINE>if (ATOMIC_HELPER.casValue(AbstractFuture.this, expected, valueToSet)) {<NEW_LINE>complete();<NEW_LINE>return true;<NEW_LINE>}<NEW_LINE>return false;<NEW_LINE>} | = new Cancellation(false, cancellation); |
601,030 | public com.amazonaws.services.ssmincidents.model.ConflictException unmarshallFromContext(JsonUnmarshallerContext context) throws Exception {<NEW_LINE>com.amazonaws.services.ssmincidents.model.ConflictException conflictException = new com.amazonaws.services.ssmincidents.model.ConflictException(null);<NEW_LINE>int originalDepth = context.getCurrentDepth();<NEW_LINE>String currentParentElement = context.getCurrentParentElement();<NEW_LINE>int targetDepth = originalDepth + 1;<NEW_LINE><MASK><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("resourceIdentifier", targetDepth)) {<NEW_LINE>context.nextToken();<NEW_LINE>conflictException.setResourceIdentifier(context.getUnmarshaller(String.class).unmarshall(context));<NEW_LINE>}<NEW_LINE>if (context.testExpression("resourceType", targetDepth)) {<NEW_LINE>context.nextToken();<NEW_LINE>conflictException.setResourceType(context.getUnmarshaller(String.class).unmarshall(context));<NEW_LINE>}<NEW_LINE>if (context.testExpression("retryAfter", targetDepth)) {<NEW_LINE>context.nextToken();<NEW_LINE>conflictException.setRetryAfter(DateJsonUnmarshallerFactory.getInstance("unixTimestamp").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 conflictException;<NEW_LINE>} | JsonToken token = context.getCurrentToken(); |
860,706 | public void initAutomaticRecordingStopThread(final Session session) {<NEW_LINE>final String recordingId = this.sessionsRecordings.get(session.getSessionId()).getId();<NEW_LINE>this.automaticRecordingStopThreads.computeIfAbsent(session.getSessionId(), f -> {<NEW_LINE>ScheduledFuture<?> future = this.automaticRecordingStopExecutor.schedule(() -> {<NEW_LINE>log.info("Stopping recording {} after {} seconds wait (no publisher published before timeout)", recordingId, this.openviduConfig.getOpenviduRecordingAutostopTimeout());<NEW_LINE>if (this.automaticRecordingStopThreads.remove(session.getSessionId()) != null) {<NEW_LINE>boolean alreadyUnlocked = false;<NEW_LINE>try {<NEW_LINE>if (session.closingLock.writeLock().tryLock(15, TimeUnit.SECONDS)) {<NEW_LINE>try {<NEW_LINE>if (session.isClosed()) {<NEW_LINE>return;<NEW_LINE>}<NEW_LINE>if (session.getParticipants().size() == 0 || session.onlyRecorderParticipant()) {<NEW_LINE>// Close session if there are no participants connected (RECORDER does not<NEW_LINE>// count) and publishing<NEW_LINE>log.info("Closing session {} after automatic stop of recording {}", session.getSessionId(), recordingId);<NEW_LINE>sessionManager.closeSessionAndEmptyCollections(<MASK><NEW_LINE>} else {<NEW_LINE>// There are users connected, but no one is publishing<NEW_LINE>// We don't need the lock if session is not closing<NEW_LINE>session.closingLock.writeLock().unlock();<NEW_LINE>alreadyUnlocked = true;<NEW_LINE>log.info("Automatic stopping recording {}. There are users connected to session {}, but no one is publishing", recordingId, session.getSessionId());<NEW_LINE>this.stopRecording(session, recordingId, EndReason.automaticStop);<NEW_LINE>}<NEW_LINE>} finally {<NEW_LINE>if (!alreadyUnlocked) {<NEW_LINE>session.closingLock.writeLock().unlock();<NEW_LINE>}<NEW_LINE>}<NEW_LINE>} else {<NEW_LINE>log.error("Timeout waiting for Session {} closing lock to be available for automatic recording stop thred", session.getSessionId());<NEW_LINE>}<NEW_LINE>} catch (InterruptedException e) {<NEW_LINE>log.error("InterruptedException while waiting for Session {} closing lock to be available for automatic recording stop thred", session.getSessionId());<NEW_LINE>}<NEW_LINE>} else {<NEW_LINE>// This code shouldn't be reachable<NEW_LINE>log.warn("Recording {} was already automatically stopped by a previous thread", recordingId);<NEW_LINE>}<NEW_LINE>}, this.openviduConfig.getOpenviduRecordingAutostopTimeout(), TimeUnit.SECONDS);<NEW_LINE>return future;<NEW_LINE>});<NEW_LINE>} | session, EndReason.automaticStop, true); |
1,580,999 | private Dimensions generateDimensions(NodeAgentContext context) {<NEW_LINE><MASK><NEW_LINE>Dimensions.Builder dimensionsBuilder = new Dimensions.Builder().add("host", node.hostname()).add("flavor", node.flavor()).add("state", node.state().toString()).add("zone", context.zone().getId().value());<NEW_LINE>node.owner().ifPresent(owner -> dimensionsBuilder.add("tenantName", owner.tenant().value()).add("applicationName", owner.application().value()).add("instanceName", owner.instance().value()).add("app", String.join(".", owner.application().value(), owner.instance().value())).add("applicationId", owner.toFullString()));<NEW_LINE>node.membership().ifPresent(membership -> dimensionsBuilder.add("clustertype", membership.type().value()).add("clusterid", membership.clusterId()));<NEW_LINE>node.parentHostname().ifPresent(parent -> dimensionsBuilder.add("parentHostname", parent));<NEW_LINE>dimensionsBuilder.add("orchestratorState", node.orchestratorStatus().asString());<NEW_LINE>node.currentVespaVersion().ifPresent(vespaVersion -> dimensionsBuilder.add("vespaVersion", vespaVersion.toFullString()));<NEW_LINE>return dimensionsBuilder.build();<NEW_LINE>} | NodeSpec node = context.node(); |
1,550,641 | private static ModelType<?> determineManagedPropertyType(StructBindingExtractionContext<?> extractionContext, String propertyName, Multimap<PropertyAccessorType, StructMethodBinding> accessorBindings) {<NEW_LINE>Set<ModelType<?>> potentialPropertyTypes = Sets.newLinkedHashSet();<NEW_LINE>for (StructMethodBinding binding : accessorBindings.values()) {<NEW_LINE>if (binding.getAccessorType() == SETTER) {<NEW_LINE>continue;<NEW_LINE>}<NEW_LINE>ManagedPropertyMethodBinding propertyBinding = (ManagedPropertyMethodBinding) binding;<NEW_LINE>potentialPropertyTypes.add(propertyBinding.getDeclaredPropertyType());<NEW_LINE>}<NEW_LINE>Collection<ModelType<?>> convergingPropertyTypes = findConvergingTypes(potentialPropertyTypes);<NEW_LINE>if (convergingPropertyTypes.size() != 1) {<NEW_LINE>extractionContext.add(propertyName, String.format("it must have a consistent type, but it's defined as %s", Joiner.on(", ").join(ModelTypes.getDisplayNames(convergingPropertyTypes))));<NEW_LINE>return convergingPropertyTypes<MASK><NEW_LINE>}<NEW_LINE>ModelType<?> propertyType = Iterables.getOnlyElement(convergingPropertyTypes);<NEW_LINE>for (StructMethodBinding setterBinding : accessorBindings.get(SETTER)) {<NEW_LINE>ManagedPropertyMethodBinding propertySetterBinding = (ManagedPropertyMethodBinding) setterBinding;<NEW_LINE>ModelType<?> declaredSetterType = propertySetterBinding.getDeclaredPropertyType();<NEW_LINE>if (!declaredSetterType.equals(propertyType)) {<NEW_LINE>extractionContext.add(setterBinding.getViewMethod(), String.format("it should take parameter with type '%s'", propertyType.getDisplayName()));<NEW_LINE>}<NEW_LINE>}<NEW_LINE>return propertyType;<NEW_LINE>} | .iterator().next(); |
1,802,163 | public boolean apply(Game game, Ability source, Ability abilityToModify) {<NEW_LINE>Player controller = game.getPlayer(abilityToModify.getControllerId());<NEW_LINE>if (controller != null) {<NEW_LINE>Mana mana = abilityToModify.getManaCostsToPay().getMana();<NEW_LINE>int reduceMax = mana.getGeneric();<NEW_LINE>if (reduceMax > 2) {<NEW_LINE>reduceMax = 2;<NEW_LINE>}<NEW_LINE>if (reduceMax > 0) {<NEW_LINE>int reduce;<NEW_LINE>if (game.inCheckPlayableState() || controller.isComputer()) {<NEW_LINE>reduce = reduceMax;<NEW_LINE>} else {<NEW_LINE>ChoiceImpl choice = new ChoiceImpl(true);<NEW_LINE>Set<String> set = new LinkedHashSet<>();<NEW_LINE>for (int i = 0; i <= reduceMax; i++) {<NEW_LINE>set.add(String.valueOf(i));<NEW_LINE>}<NEW_LINE>choice.setChoices(set);<NEW_LINE>choice.setMessage("Reduce cycling cost");<NEW_LINE>if (controller.choose(Outcome.Benefit, choice, game)) {<NEW_LINE>reduce = Integer.<MASK><NEW_LINE>} else {<NEW_LINE>return false;<NEW_LINE>}<NEW_LINE>}<NEW_LINE>CardUtil.reduceCost(abilityToModify, reduce);<NEW_LINE>}<NEW_LINE>return true;<NEW_LINE>}<NEW_LINE>return false;<NEW_LINE>} | parseInt(choice.getChoice()); |
1,698,073 | private EncryptConfigEntry requestPubKey(String pubKeyUrl, String userName, boolean needGet) {<NEW_LINE>if (Utils.isBlank(userName)) {<NEW_LINE>LOGGER.error("Queried userName is null!");<NEW_LINE>return null;<NEW_LINE>}<NEW_LINE>List<BasicNameValuePair> params = new ArrayList<BasicNameValuePair>();<NEW_LINE>params.add(new BasicNameValuePair("operation", "query"));<NEW_LINE>params.add(new BasicNameValuePair("username", userName));<NEW_LINE>String returnStr = requestConfiguration(pubKeyUrl, params);<NEW_LINE>if (Utils.isBlank(returnStr)) {<NEW_LINE>LOGGER.info("No public key information returned from manager");<NEW_LINE>return null;<NEW_LINE>}<NEW_LINE>JsonObject pubKeyConf = jsonParser.parse(returnStr).getAsJsonObject();<NEW_LINE>if (pubKeyConf == null) {<NEW_LINE>LOGGER.info("No public key information returned from manager");<NEW_LINE>return null;<NEW_LINE>}<NEW_LINE>if (!pubKeyConf.has("resultCode")) {<NEW_LINE>LOGGER.info("Parse pubKeyConf failure: No resultCode key information returned from manager");<NEW_LINE>return null;<NEW_LINE>}<NEW_LINE>int resultCode = pubKeyConf.get("resultCode").getAsInt();<NEW_LINE>if (resultCode != 0) {<NEW_LINE>LOGGER.info("query pubKeyConf failure, error code is " + resultCode + ", errInfo is " + pubKeyConf.get<MASK><NEW_LINE>return null;<NEW_LINE>}<NEW_LINE>if (!pubKeyConf.has("resultData")) {<NEW_LINE>LOGGER.info("Parse pubKeyConf failure: No resultData key information returned from manager");<NEW_LINE>return null;<NEW_LINE>}<NEW_LINE>JsonObject resultData = pubKeyConf.get("resultData").getAsJsonObject();<NEW_LINE>if (resultData != null) {<NEW_LINE>String publicKey = resultData.get("publicKey").getAsString();<NEW_LINE>if (Utils.isBlank(publicKey)) {<NEW_LINE>return null;<NEW_LINE>}<NEW_LINE>String username = resultData.get("username").getAsString();<NEW_LINE>if (Utils.isBlank(username)) {<NEW_LINE>return null;<NEW_LINE>}<NEW_LINE>String versionStr = resultData.get("version").getAsString();<NEW_LINE>if (Utils.isBlank(versionStr)) {<NEW_LINE>return null;<NEW_LINE>}<NEW_LINE>return new EncryptConfigEntry(username, versionStr, publicKey);<NEW_LINE>}<NEW_LINE>return null;<NEW_LINE>} | ("message").getAsString()); |
1,511,886 | protected RelDataType deriveRowType() {<NEW_LINE>final RelDataTypeFactory typeFactory = getCluster().getTypeFactory();<NEW_LINE>List<RelDataTypeFieldImpl> columns = new LinkedList<>();<NEW_LINE>columns.add(new RelDataTypeFieldImpl("NO.", 0, typeFactory.createSqlType(SqlTypeName.BIGINT)));<NEW_LINE>columns.add(new RelDataTypeFieldImpl("TRIGGER_NAME", 1, typeFactory.createSqlType(SqlTypeName.VARCHAR)));<NEW_LINE>columns.add(new RelDataTypeFieldImpl("CCL_RULE_COUNT", 2, typeFactory.createSqlType(SqlTypeName.BIGINT)));<NEW_LINE>columns.add(new RelDataTypeFieldImpl("DATABASE", 3, typeFactory.createSqlType(SqlTypeName.VARCHAR)));<NEW_LINE>columns.add(new RelDataTypeFieldImpl("CONDITIONS", 4, typeFactory.createSqlType(SqlTypeName.VARCHAR)));<NEW_LINE>columns.add(new RelDataTypeFieldImpl("RULE_CONFIG", 5, typeFactory.<MASK><NEW_LINE>columns.add(new RelDataTypeFieldImpl("QUERY_RULE_UPGRADE", 6, typeFactory.createSqlType(SqlTypeName.BIGINT)));<NEW_LINE>columns.add(new RelDataTypeFieldImpl("MAX_CCL_RULE", 7, typeFactory.createSqlType(SqlTypeName.BIGINT)));<NEW_LINE>columns.add(new RelDataTypeFieldImpl("MAX_SQL_SIZE", 8, typeFactory.createSqlType(SqlTypeName.BIGINT)));<NEW_LINE>columns.add(new RelDataTypeFieldImpl("CREATED_TIME", 9, typeFactory.createSqlType(SqlTypeName.DATETIME)));<NEW_LINE>return typeFactory.createStructType(columns);<NEW_LINE>} | createSqlType(SqlTypeName.VARCHAR))); |
1,555,553 | // execution ////////////////////////////////////////////////////////////////////<NEW_LINE>@Override<NEW_LINE>public void execute() throws BuildException {<NEW_LINE>try {<NEW_LINE>final FileInputStream in = new FileInputStream(file);<NEW_LINE>String contents = Utils.read(in).toString();<NEW_LINE>in.close();<NEW_LINE>contents = contents.replace("/", "");<NEW_LINE>contents = contents.replace("\\", "");<NEW_LINE>contents = contents.replace("\n", "");<NEW_LINE>contents = <MASK><NEW_LINE>final Matcher matcher = PATTERN.matcher(contents);<NEW_LINE>if (matcher.find()) {<NEW_LINE>final // NOMAGI<NEW_LINE>String // NOMAGI<NEW_LINE>milestoneNumber = matcher.group(2);<NEW_LINE>final String buildNumber = FORMAT_OUT.format(// NOMAGI<NEW_LINE>FORMAT_IN.// NOMAGI<NEW_LINE>parse(matcher.group(3)));<NEW_LINE>getProject().setProperty(prefix + MILESTONE_NUMBER_SUFFIX, milestoneNumber);<NEW_LINE>getProject().setProperty(prefix + BUILD_NUMBER_SUFFIX, buildNumber);<NEW_LINE>} else {<NEW_LINE>throw new // NOI18N<NEW_LINE>BuildException("Cannot find build number");<NEW_LINE>}<NEW_LINE>} catch (IOException e) {<NEW_LINE>throw new BuildException(e);<NEW_LINE>} catch (ParseException e) {<NEW_LINE>throw new BuildException(e);<NEW_LINE>}<NEW_LINE>} | contents.replace("\r", ""); |
681,139 | public static AnswerCallResponse unmarshall(AnswerCallResponse answerCallResponse, UnmarshallerContext _ctx) {<NEW_LINE>answerCallResponse.setRequestId(_ctx.stringValue("AnswerCallResponse.RequestId"));<NEW_LINE>answerCallResponse.setCode(_ctx.stringValue("AnswerCallResponse.Code"));<NEW_LINE>answerCallResponse.setHttpStatusCode(_ctx.integerValue("AnswerCallResponse.HttpStatusCode"));<NEW_LINE>answerCallResponse.setMessage(_ctx.stringValue("AnswerCallResponse.Message"));<NEW_LINE>List<String> params = new ArrayList<String>();<NEW_LINE>for (int i = 0; i < _ctx.lengthValue("AnswerCallResponse.Params.Length"); i++) {<NEW_LINE>params.add(_ctx.stringValue("AnswerCallResponse.Params[" + i + "]"));<NEW_LINE>}<NEW_LINE>answerCallResponse.setParams(params);<NEW_LINE>Data data = new Data();<NEW_LINE>data.setContextId(_ctx.longValue("AnswerCallResponse.Data.ContextId"));<NEW_LINE>CallContext callContext = new CallContext();<NEW_LINE>callContext.setJobId(_ctx.stringValue("AnswerCallResponse.Data.CallContext.JobId"));<NEW_LINE>callContext.setInstanceId(_ctx.stringValue("AnswerCallResponse.Data.CallContext.InstanceId"));<NEW_LINE>callContext.setCallType(_ctx.stringValue("AnswerCallResponse.Data.CallContext.CallType"));<NEW_LINE>List<ChannelContext> channelContexts = new ArrayList<ChannelContext>();<NEW_LINE>for (int i = 0; i < _ctx.lengthValue("AnswerCallResponse.Data.CallContext.ChannelContexts.Length"); i++) {<NEW_LINE>ChannelContext channelContext = new ChannelContext();<NEW_LINE>channelContext.setReleaseInitiator(_ctx.stringValue("AnswerCallResponse.Data.CallContext.ChannelContexts[" + i + "].ReleaseInitiator"));<NEW_LINE>channelContext.setChannelState(_ctx.stringValue("AnswerCallResponse.Data.CallContext.ChannelContexts[" + i + "].ChannelState"));<NEW_LINE>channelContext.setDestination(_ctx.stringValue("AnswerCallResponse.Data.CallContext.ChannelContexts[" + i + "].Destination"));<NEW_LINE>channelContext.setUserId(_ctx.stringValue("AnswerCallResponse.Data.CallContext.ChannelContexts[" + i + "].UserId"));<NEW_LINE>channelContext.setSkillGroupId(_ctx.stringValue("AnswerCallResponse.Data.CallContext.ChannelContexts[" + i + "].SkillGroupId"));<NEW_LINE>channelContext.setTimestamp(_ctx.longValue<MASK><NEW_LINE>channelContext.setAssociatedData(_ctx.mapValue("AnswerCallResponse.Data.CallContext.ChannelContexts[" + i + "].AssociatedData"));<NEW_LINE>channelContext.setReleaseReason(_ctx.stringValue("AnswerCallResponse.Data.CallContext.ChannelContexts[" + i + "].ReleaseReason"));<NEW_LINE>channelContext.setCallType(_ctx.stringValue("AnswerCallResponse.Data.CallContext.ChannelContexts[" + i + "].CallType"));<NEW_LINE>channelContext.setJobId(_ctx.stringValue("AnswerCallResponse.Data.CallContext.ChannelContexts[" + i + "].JobId"));<NEW_LINE>channelContext.setChannelId(_ctx.stringValue("AnswerCallResponse.Data.CallContext.ChannelContexts[" + i + "].ChannelId"));<NEW_LINE>channelContext.setOriginator(_ctx.stringValue("AnswerCallResponse.Data.CallContext.ChannelContexts[" + i + "].Originator"));<NEW_LINE>channelContext.setUserExtension(_ctx.stringValue("AnswerCallResponse.Data.CallContext.ChannelContexts[" + i + "].UserExtension"));<NEW_LINE>channelContexts.add(channelContext);<NEW_LINE>}<NEW_LINE>callContext.setChannelContexts(channelContexts);<NEW_LINE>data.setCallContext(callContext);<NEW_LINE>UserContext userContext = new UserContext();<NEW_LINE>userContext.setExtension(_ctx.stringValue("AnswerCallResponse.Data.UserContext.Extension"));<NEW_LINE>userContext.setHeartbeat(_ctx.longValue("AnswerCallResponse.Data.UserContext.Heartbeat"));<NEW_LINE>userContext.setWorkMode(_ctx.stringValue("AnswerCallResponse.Data.UserContext.WorkMode"));<NEW_LINE>userContext.setDeviceId(_ctx.stringValue("AnswerCallResponse.Data.UserContext.DeviceId"));<NEW_LINE>userContext.setUserId(_ctx.stringValue("AnswerCallResponse.Data.UserContext.UserId"));<NEW_LINE>userContext.setReserved(_ctx.longValue("AnswerCallResponse.Data.UserContext.Reserved"));<NEW_LINE>userContext.setBreakCode(_ctx.stringValue("AnswerCallResponse.Data.UserContext.BreakCode"));<NEW_LINE>userContext.setInstanceId(_ctx.stringValue("AnswerCallResponse.Data.UserContext.InstanceId"));<NEW_LINE>userContext.setOutboundScenario(_ctx.booleanValue("AnswerCallResponse.Data.UserContext.OutboundScenario"));<NEW_LINE>userContext.setMobile(_ctx.stringValue("AnswerCallResponse.Data.UserContext.Mobile"));<NEW_LINE>userContext.setJobId(_ctx.stringValue("AnswerCallResponse.Data.UserContext.JobId"));<NEW_LINE>userContext.setUserState(_ctx.stringValue("AnswerCallResponse.Data.UserContext.UserState"));<NEW_LINE>List<String> signedSkillGroupIdList = new ArrayList<String>();<NEW_LINE>for (int i = 0; i < _ctx.lengthValue("AnswerCallResponse.Data.UserContext.SignedSkillGroupIdList.Length"); i++) {<NEW_LINE>signedSkillGroupIdList.add(_ctx.stringValue("AnswerCallResponse.Data.UserContext.SignedSkillGroupIdList[" + i + "]"));<NEW_LINE>}<NEW_LINE>userContext.setSignedSkillGroupIdList(signedSkillGroupIdList);<NEW_LINE>data.setUserContext(userContext);<NEW_LINE>answerCallResponse.setData(data);<NEW_LINE>return answerCallResponse;<NEW_LINE>} | ("AnswerCallResponse.Data.CallContext.ChannelContexts[" + i + "].Timestamp")); |
153,784 | @ApiOperation(httpMethod = "GET", value = "Get permissions by group", notes = "", produces = MediaType.APPLICATION_JSON_VALUE, response = List.class)<NEW_LINE>public List<ReadablePermission> listPermissions(@PathVariable String group) {<NEW_LINE>Group g = null;<NEW_LINE>try {<NEW_LINE>g = groupService.findByName(group);<NEW_LINE>if (g == null) {<NEW_LINE>throw new ResourceNotFoundException("Group [" + group + "] does not exist");<NEW_LINE>}<NEW_LINE>} catch (Exception e) {<NEW_LINE>LOGGER.error(<MASK><NEW_LINE>throw new ServiceRuntimeException("An error occured while getting group [" + group + "]");<NEW_LINE>}<NEW_LINE>Set<Permission> permissions = g.getPermissions();<NEW_LINE>List<ReadablePermission> readablePermissions = new ArrayList<ReadablePermission>();<NEW_LINE>for (Permission permission : permissions) {<NEW_LINE>ReadablePermission readablePermission = new ReadablePermission();<NEW_LINE>readablePermission.setName(permission.getPermissionName());<NEW_LINE>readablePermission.setId(permission.getId());<NEW_LINE>readablePermissions.add(readablePermission);<NEW_LINE>}<NEW_LINE>return readablePermissions;<NEW_LINE>} | "An error occured while getting group [" + group + "]", e); |
1,249,213 | public boolean order(Buffer b) {<NEW_LINE>if (b instanceof java.nio.ByteBuffer)<NEW_LINE>return ((java.nio.ByteBuffer) b).order() == ByteOrder.LITTLE_ENDIAN;<NEW_LINE>if (b instanceof java.nio.ShortBuffer)<NEW_LINE>return ((java.nio.ShortBuffer) b).order() == ByteOrder.LITTLE_ENDIAN;<NEW_LINE>if (b instanceof java.nio.CharBuffer)<NEW_LINE>return ((java.nio.CharBuffer) b).order() == ByteOrder.LITTLE_ENDIAN;<NEW_LINE>if (b instanceof java.nio.IntBuffer)<NEW_LINE>return ((java.nio.IntBuffer) b).order() == ByteOrder.LITTLE_ENDIAN;<NEW_LINE>if (b instanceof java.nio.LongBuffer)<NEW_LINE>return ((java.nio.LongBuffer) b).order() == ByteOrder.LITTLE_ENDIAN;<NEW_LINE>if (b instanceof java.nio.FloatBuffer)<NEW_LINE>return ((java.nio.FloatBuffer) b).order() == ByteOrder.LITTLE_ENDIAN;<NEW_LINE>if (b instanceof java.nio.DoubleBuffer)<NEW_LINE>return ((java.nio.DoubleBuffer) b)<MASK><NEW_LINE>return true;<NEW_LINE>} | .order() == ByteOrder.LITTLE_ENDIAN; |
1,423,464 | private void writeTo(Device device, AuditLogger auditLogger, JsonWriter writer) {<NEW_LINE>writer.writeStartObject();<NEW_LINE>writer.writeNotNullOrDef("cn", auditLogger.getCommonName(), null);<NEW_LINE>writer.writeNotNullOrDef("dcmAuditRecordRepositoryDeviceName", auditLogger.getAuditRecordRepositoryDeviceNameNotNull(), null);<NEW_LINE>writer.writeConnRefs(device.listConnections(<MASK><NEW_LINE>writer.writeNotNull("dicomInstalled", auditLogger.getInstalled());<NEW_LINE>writer.writeNotNullOrDef("dcmAuditSourceID", auditLogger.getAuditSourceID(), null);<NEW_LINE>writer.writeNotNullOrDef("dcmAuditEnterpriseSiteID", auditLogger.getAuditEnterpriseSiteID(), null);<NEW_LINE>writer.writeNotEmpty("dcmAuditSourceTypeCode", auditLogger.getAuditSourceTypeCodes());<NEW_LINE>writer.writeNotNullOrDef("dcmAuditFacility", auditLogger.getFacility(), AuditLogger.Facility.authpriv);<NEW_LINE>writer.writeNotNullOrDef("dcmAuditSuccessSeverity", auditLogger.getSuccessSeverity(), AuditLogger.Severity.notice);<NEW_LINE>writer.writeNotNullOrDef("dcmAuditMinorFailureSeverity", auditLogger.getMinorFailureSeverity(), AuditLogger.Severity.warning);<NEW_LINE>writer.writeNotNullOrDef("dcmAuditSeriousFailureSeverity", auditLogger.getSeriousFailureSeverity(), AuditLogger.Severity.err);<NEW_LINE>writer.writeNotNullOrDef("dcmAuditMajorFailureSeverity", auditLogger.getMajorFailureSeverity(), AuditLogger.Severity.crit);<NEW_LINE>writer.writeNotNullOrDef("dcmAuditApplicationName", auditLogger.getApplicationName(), null);<NEW_LINE>writer.writeNotNullOrDef("dcmAuditMessageID", auditLogger.getMessageID(), AuditLogger.MESSAGE_ID);<NEW_LINE>writer.writeNotNullOrDef("dcmAuditMessageEncoding", auditLogger.getEncoding(), "UTF-8");<NEW_LINE>writer.writeNotDef("dcmAuditMessageBOM", auditLogger.isIncludeBOM(), true);<NEW_LINE>writer.writeNotDef("dcmAuditTimestampInUTC", auditLogger.isTimestampInUTC(), false);<NEW_LINE>writer.writeNotDef("dcmAuditMessageFormatXML", auditLogger.isFormatXML(), false);<NEW_LINE>writer.writeNotNullOrDef("dcmAuditMessageSchemaURI", auditLogger.getSchemaURI(), AuditMessages.SCHEMA_URI);<NEW_LINE>writer.writeNotDef("dcmAuditIncludeInstanceUID", auditLogger.isIncludeInstanceUID(), false);<NEW_LINE>writer.writeNotNullOrDef("dcmAuditLoggerSpoolDirectoryURI", auditLogger.getSpoolDirectoryURI(), null);<NEW_LINE>writer.writeNotDef("dcmAuditLoggerRetryInterval", auditLogger.getRetryInterval(), 0);<NEW_LINE>writeAuditSuppressCriteriaList(writer, auditLogger.getAuditSuppressCriteriaList());<NEW_LINE>writer.writeEnd();<NEW_LINE>} | ), auditLogger.getConnections()); |
1,190,732 | protected void addComputedTypeAnnotations(Tree tree, AnnotatedTypeMirror type, boolean iUseFlow) {<NEW_LINE>if (root == null && ajavaTypes.isParsing()) {<NEW_LINE>return;<NEW_LINE>}<NEW_LINE>assert root != null : "GenericAnnotatedTypeFactory.addComputedTypeAnnotations: " + " root needs to be set when used on trees; factory: " + this.getClass();<NEW_LINE>String thisClass = null;<NEW_LINE>String treeString = null;<NEW_LINE>if (debug) {<NEW_LINE>thisClass = this.getClass().getSimpleName();<NEW_LINE>if (thisClass.endsWith("AnnotatedTypeFactory")) {<NEW_LINE>thisClass = thisClass.substring(0, thisClass.length() - "AnnotatedTypeFactory".length());<NEW_LINE>}<NEW_LINE>treeString = TreeUtils.toStringTruncated(tree, 60);<NEW_LINE>}<NEW_LINE>log("%s GATF.addComputedTypeAnnotations#1(%s, %s, %s)%n", thisClass, treeString, type, iUseFlow);<NEW_LINE>if (!TreeUtils.isExpressionTree(tree)) {<NEW_LINE>// Don't apply defaults to expressions. Their types may be computed from subexpressions<NEW_LINE>// in treeAnnotator.<NEW_LINE>addAnnotationsFromDefaultForType(TreeUtils.elementFromTree(tree), type);<NEW_LINE>log("%s GATF.addComputedTypeAnnotations#2(%s, %s)%n", thisClass, treeString, type);<NEW_LINE>}<NEW_LINE>applyQualifierParameterDefaults(tree, type);<NEW_LINE>log("%s GATF.addComputedTypeAnnotations#3(%s, %s)%n", thisClass, treeString, type);<NEW_LINE>treeAnnotator.visit(tree, type);<NEW_LINE>log("%s GATF.addComputedTypeAnnotations#4(%s, %s)%n", thisClass, treeString, type);<NEW_LINE>if (TreeUtils.isExpressionTree(tree)) {<NEW_LINE>// If a tree annotator, did not add a type, add the DefaultForUse default.<NEW_LINE>addAnnotationsFromDefaultForType(TreeUtils.elementFromTree(tree), type);<NEW_LINE>log("%s GATF.addComputedTypeAnnotations#5(%s, %s)%n", thisClass, treeString, type);<NEW_LINE>}<NEW_LINE>typeAnnotator.visit(type, null);<NEW_LINE>log("%s GATF.addComputedTypeAnnotations#6(%s, %s)%n", thisClass, treeString, type);<NEW_LINE><MASK><NEW_LINE>log("%s GATF.addComputedTypeAnnotations#7(%s, %s)%n", thisClass, treeString, type);<NEW_LINE>if (iUseFlow) {<NEW_LINE>Value as = getInferredValueFor(tree);<NEW_LINE>if (as != null) {<NEW_LINE>applyInferredAnnotations(type, as);<NEW_LINE>log("%s GATF.addComputedTypeAnnotations#8(%s, %s), as=%s%n", thisClass, treeString, type, as);<NEW_LINE>}<NEW_LINE>}<NEW_LINE>log("%s GATF.addComputedTypeAnnotations#9(%s, %s, %s) done%n", thisClass, treeString, type, iUseFlow);<NEW_LINE>} | defaults.annotate(tree, type); |
667,852 | public static void addChangeSenderTypeProposals(IInvocationContext context, Expression nodeToCast, ITypeBinding castTypeBinding, boolean isAssignedNode, int relevance, Collection<ChangeCorrectionProposal> proposals) throws JavaModelException {<NEW_LINE>IBinding callerBinding = Bindings.resolveExpressionBinding(nodeToCast, false);<NEW_LINE>ICompilationUnit cu = context.getCompilationUnit();<NEW_LINE>CompilationUnit astRoot = context.getASTRoot();<NEW_LINE>ICompilationUnit targetCu = null;<NEW_LINE>ITypeBinding declaringType = null;<NEW_LINE>IBinding callerBindingDecl = callerBinding;<NEW_LINE>if (callerBinding instanceof IVariableBinding) {<NEW_LINE>IVariableBinding variableBinding = (IVariableBinding) callerBinding;<NEW_LINE>if (variableBinding.isEnumConstant()) {<NEW_LINE>return;<NEW_LINE>}<NEW_LINE>if (!variableBinding.isField()) {<NEW_LINE>targetCu = cu;<NEW_LINE>} else {<NEW_LINE>callerBindingDecl = variableBinding.getVariableDeclaration();<NEW_LINE>ITypeBinding declaringClass = variableBinding.getDeclaringClass();<NEW_LINE>if (declaringClass == null) {<NEW_LINE>// array length<NEW_LINE>return;<NEW_LINE>}<NEW_LINE>declaringType = declaringClass.getTypeDeclaration();<NEW_LINE>}<NEW_LINE>} else if (callerBinding instanceof IMethodBinding) {<NEW_LINE>IMethodBinding methodBinding = (IMethodBinding) callerBinding;<NEW_LINE>if (!methodBinding.isConstructor()) {<NEW_LINE>declaringType = methodBinding.getDeclaringClass().getTypeDeclaration();<NEW_LINE>callerBindingDecl = methodBinding.getMethodDeclaration();<NEW_LINE>}<NEW_LINE>} else if (callerBinding instanceof ITypeBinding && nodeToCast.getLocationInParent() == SingleMemberAnnotation.TYPE_NAME_PROPERTY) {<NEW_LINE>declaringType = (ITypeBinding) callerBinding;<NEW_LINE>// $NON-NLS-1$<NEW_LINE>callerBindingDecl = Bindings.findMethodInType(declaringType, "value", (String[]) null);<NEW_LINE>if (callerBindingDecl == null) {<NEW_LINE>return;<NEW_LINE>}<NEW_LINE>}<NEW_LINE>if (declaringType != null && declaringType.isFromSource()) {<NEW_LINE>targetCu = ASTResolving.<MASK><NEW_LINE>}<NEW_LINE>if (targetCu != null && ASTResolving.isUseableTypeInContext(castTypeBinding, callerBindingDecl, false)) {<NEW_LINE>proposals.add(new TypeChangeCorrectionProposal(targetCu, callerBindingDecl, astRoot, castTypeBinding, isAssignedNode, relevance));<NEW_LINE>}<NEW_LINE>// add interface to resulting type<NEW_LINE>if (!isAssignedNode) {<NEW_LINE>ITypeBinding nodeType = nodeToCast.resolveTypeBinding();<NEW_LINE>if (castTypeBinding.isInterface() && nodeType != null && nodeType.isClass() && !nodeType.isAnonymous() && nodeType.isFromSource()) {<NEW_LINE>ITypeBinding typeDecl = nodeType.getTypeDeclaration();<NEW_LINE>ICompilationUnit nodeCu = ASTResolving.findCompilationUnitForBinding(cu, astRoot, typeDecl);<NEW_LINE>if (nodeCu != null && ASTResolving.isUseableTypeInContext(castTypeBinding, typeDecl, true)) {<NEW_LINE>proposals.add(new ImplementInterfaceProposal(nodeCu, typeDecl, astRoot, castTypeBinding, relevance - 1));<NEW_LINE>}<NEW_LINE>}<NEW_LINE>}<NEW_LINE>} | findCompilationUnitForBinding(cu, astRoot, declaringType); |
148,061 | protected ShapeImpl applyTransition(ShapeImpl shape, Transition transition, boolean append) {<NEW_LINE>if (transition instanceof AddPropertyTransition) {<NEW_LINE>Property property = ((AddPropertyTransition) transition).getProperty();<NEW_LINE>ShapeImpl newShape;<NEW_LINE>if (append) {<NEW_LINE>Property newProperty = property.relocate(shape.allocator().moveLocation(property.getLocation()));<NEW_LINE>newShape = addProperty(shape, newProperty, true);<NEW_LINE>} else {<NEW_LINE>newShape = addProperty(shape, property, false);<NEW_LINE>}<NEW_LINE>return newShape;<NEW_LINE>} else if (transition instanceof ObjectTypeTransition) {<NEW_LINE>return shape.setDynamicType(((ObjectTypeTransition<MASK><NEW_LINE>} else if (transition instanceof ObjectFlagsTransition) {<NEW_LINE>return shape.setFlags(((ObjectFlagsTransition) transition).getObjectFlags());<NEW_LINE>} else if (transition instanceof DirectReplacePropertyTransition) {<NEW_LINE>Property oldProperty = ((DirectReplacePropertyTransition) transition).getPropertyBefore();<NEW_LINE>Property newProperty = ((DirectReplacePropertyTransition) transition).getPropertyAfter();<NEW_LINE>if (append) {<NEW_LINE>boolean sameLocation = oldProperty.getLocation().equals(newProperty.getLocation());<NEW_LINE>oldProperty = shape.getProperty(oldProperty.getKey());<NEW_LINE>Location newLocation;<NEW_LINE>if (sameLocation) {<NEW_LINE>newLocation = oldProperty.getLocation();<NEW_LINE>} else {<NEW_LINE>newLocation = shape.allocator().moveLocation(newProperty.getLocation());<NEW_LINE>}<NEW_LINE>newProperty = newProperty.relocate(newLocation);<NEW_LINE>}<NEW_LINE>return directReplaceProperty(shape, oldProperty, newProperty, append);<NEW_LINE>} else {<NEW_LINE>throw new UnsupportedOperationException(transition.getClass().getName());<NEW_LINE>}<NEW_LINE>} | ) transition).getObjectType()); |
1,150,669 | public void buildStyleSheet(StyleSheet styleSheet) {<NEW_LINE>int baseSize = editorPane.getFont().getSize();<NEW_LINE>String rule = String.format("body { font-size: %dpt; padding: %dpx; }", Math.round((double) baseSize * 7 / 6), Math.round((double<MASK><NEW_LINE>styleSheet.addRule(rule);<NEW_LINE>rule = String.format("h1 { font-size: %dpx; }", baseSize * 2);<NEW_LINE>styleSheet.addRule(rule);<NEW_LINE>rule = String.format("h2 { font-size: %dpx; }", Math.round(baseSize * 1.5));<NEW_LINE>styleSheet.addRule(rule);<NEW_LINE>rule = String.format("h3 { font-size: %dpx; }", Math.round(baseSize * 1.17));<NEW_LINE>styleSheet.addRule(rule);<NEW_LINE>rule = String.format("pre, tt { font-size: %dpt; }", baseSize);<NEW_LINE>styleSheet.addRule(rule);<NEW_LINE>rule = String.format("dd { margin-bottom: %dpx; }", Math.round((double) baseSize * 10 / 6));<NEW_LINE>styleSheet.addRule(rule);<NEW_LINE>} | ) baseSize * 5 / 6)); |
1,619,114 | private static Map<ThreadObjectGCRoot, Map<Integer, List<GCRoot>>> computeJavaFrameMap(Collection<GCRoot> roots) {<NEW_LINE>Map<ThreadObjectGCRoot, Map<Integer, List<GCRoot>>> javaFrameMap = new HashMap();<NEW_LINE>for (GCRoot root : roots) {<NEW_LINE>ThreadObjectGCRoot threadObj;<NEW_LINE>Integer frameNo;<NEW_LINE>if (GCRoot.JAVA_FRAME.equals(root.getKind())) {<NEW_LINE>JavaFrameGCRoot frameGCroot = (JavaFrameGCRoot) root;<NEW_LINE>threadObj = frameGCroot.getThreadGCRoot();<NEW_LINE>frameNo = frameGCroot.getFrameNumber();<NEW_LINE>} else if (GCRoot.JNI_LOCAL.equals(root.getKind())) {<NEW_LINE>JniLocalGCRoot jniGCroot = (JniLocalGCRoot) root;<NEW_LINE>threadObj = jniGCroot.getThreadGCRoot();<NEW_LINE>frameNo = jniGCroot.getFrameNumber();<NEW_LINE>} else {<NEW_LINE>continue;<NEW_LINE>}<NEW_LINE>Map<Integer, List<GCRoot>> <MASK><NEW_LINE>List<GCRoot> locals;<NEW_LINE>if (stackMap == null) {<NEW_LINE>stackMap = new HashMap();<NEW_LINE>javaFrameMap.put(threadObj, stackMap);<NEW_LINE>}<NEW_LINE>locals = stackMap.get(frameNo);<NEW_LINE>if (locals == null) {<NEW_LINE>locals = new ArrayList(2);<NEW_LINE>stackMap.put(frameNo, locals);<NEW_LINE>}<NEW_LINE>locals.add(root);<NEW_LINE>}<NEW_LINE>return javaFrameMap;<NEW_LINE>} | stackMap = javaFrameMap.get(threadObj); |
407,379 | public Map<Integer, Long> queryGroupOffsetInfo(String group, String topic, Set<Integer> partitionIds) {<NEW_LINE>StringBuilder strBuff = new StringBuilder(512);<NEW_LINE>String basePath = strBuff.append(this.consumerZkDir).append("/").append(group).append("/offsets/").append(topic).append("/").append(brokerId).append(TokenConstants.HYPHEN).toString();<NEW_LINE>strBuff.delete(0, strBuff.length());<NEW_LINE>String offsetZkInfo;<NEW_LINE>Map<Integer, Long> offsetMap = new HashMap<>(partitionIds.size());<NEW_LINE>for (Integer partitionId : partitionIds) {<NEW_LINE>String offsetNode = strBuff.append(basePath).append(partitionId).toString();<NEW_LINE>strBuff.delete(0, strBuff.length());<NEW_LINE>try {<NEW_LINE>offsetZkInfo = ZKUtil.<MASK><NEW_LINE>if (offsetZkInfo == null) {<NEW_LINE>offsetMap.put(partitionId, null);<NEW_LINE>} else {<NEW_LINE>String[] offsetInfoStrs = offsetZkInfo.split(TokenConstants.HYPHEN);<NEW_LINE>offsetMap.put(partitionId, Long.parseLong(offsetInfoStrs[1]));<NEW_LINE>}<NEW_LINE>} catch (Throwable e) {<NEW_LINE>BrokerSrvStatsHolder.incZKExcCnt();<NEW_LINE>offsetMap.put(partitionId, null);<NEW_LINE>}<NEW_LINE>}<NEW_LINE>return offsetMap;<NEW_LINE>} | readDataMaybeNull(this.zkw, offsetNode); |
1,066,850 | public static void configClientLtpaHandler(ClientRequestContext crc) {<NEW_LINE>if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled()) {<NEW_LINE>Tr.debug(tc, "configClientLtpaHandler - About to get a LTPA authentication token");<NEW_LINE>}<NEW_LINE>// retrieve a ltpa cookie from the Subject in current thread<NEW_LINE>try {<NEW_LINE>// this interceptor must depend on the appSecurity feature to use WebSecurityHelper.getSSOCookieFromSSOToken()<NEW_LINE>Cookie ssoCookie = WebSecurityHelper.getSSOCookieFromSSOToken();<NEW_LINE>if (ssoCookie == null) {<NEW_LINE>return;<NEW_LINE>}<NEW_LINE>String cookieName = ssoCookie.getName();<NEW_LINE>String cookieValue = ssoCookie.getValue();<NEW_LINE>if (cookieValue != null && !cookieValue.isEmpty() && cookieName != null) {<NEW_LINE>if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled()) {<NEW_LINE>Tr.debug(tc, "Retrieved a LTPA authentication token. About to set a request cookie: " + cookieName + "=" + cookieValue);<NEW_LINE>}<NEW_LINE>crc.getHeaders().putSingle("Cookie", ssoCookie.getName() + "=" + ssoCookie.getValue());<NEW_LINE>} else {<NEW_LINE>// no user credential available<NEW_LINE>if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled()) {<NEW_LINE><MASK><NEW_LINE>}<NEW_LINE>// Because this is a client configuration property, we won't throws exception if it doesn't work, please analyze trace for detail<NEW_LINE>// throw new ProcessingException("Cannot find a ltpa authentication token off of the thread");<NEW_LINE>}<NEW_LINE>} catch (NoClassDefFoundError ncdfe) {<NEW_LINE>// expected if app security is not enabled<NEW_LINE>if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled()) {<NEW_LINE>Tr.debug(tc, "configClientLtpaHandler - caught NCDFE - expected if app security feature not enabled", ncdfe);<NEW_LINE>}<NEW_LINE>} catch (Exception e) {<NEW_LINE>throw new ProcessingException(e);<NEW_LINE>}<NEW_LINE>} | Tr.debug(tc, "Cannot find a ltpa authentication token off of the thread, you may need enable feature appSecurity-2.0 or ssl-1.0"); |
622,464 | public Authentication authenticate(Authentication authentication) throws AuthenticationException {<NEW_LINE>OAuth2ClientAuthenticationToken clientAuthentication = (OAuth2ClientAuthenticationToken) authentication;<NEW_LINE>if (!ClientAuthenticationMethod.CLIENT_SECRET_BASIC.equals(clientAuthentication.getClientAuthenticationMethod()) && !ClientAuthenticationMethod.CLIENT_SECRET_POST.equals(clientAuthentication.getClientAuthenticationMethod())) {<NEW_LINE>return null;<NEW_LINE>}<NEW_LINE>String clientId = clientAuthentication.getPrincipal().toString();<NEW_LINE>RegisteredClient registeredClient = <MASK><NEW_LINE>if (registeredClient == null) {<NEW_LINE>throwInvalidClient(OAuth2ParameterNames.CLIENT_ID);<NEW_LINE>}<NEW_LINE>if (!registeredClient.getClientAuthenticationMethods().contains(clientAuthentication.getClientAuthenticationMethod())) {<NEW_LINE>throwInvalidClient("authentication_method");<NEW_LINE>}<NEW_LINE>if (clientAuthentication.getCredentials() == null) {<NEW_LINE>throwInvalidClient("credentials");<NEW_LINE>}<NEW_LINE>String clientSecret = clientAuthentication.getCredentials().toString();<NEW_LINE>if (!this.passwordEncoder.matches(clientSecret, registeredClient.getClientSecret())) {<NEW_LINE>throwInvalidClient(OAuth2ParameterNames.CLIENT_SECRET);<NEW_LINE>}<NEW_LINE>// Validate the "code_verifier" parameter for the confidential client, if available<NEW_LINE>this.codeVerifierAuthenticator.authenticateIfAvailable(clientAuthentication, registeredClient);<NEW_LINE>return new OAuth2ClientAuthenticationToken(registeredClient, clientAuthentication.getClientAuthenticationMethod(), clientAuthentication.getCredentials());<NEW_LINE>} | this.registeredClientRepository.findByClientId(clientId); |
183,327 | public Request<GetParametersForImportRequest> marshall(GetParametersForImportRequest getParametersForImportRequest) {<NEW_LINE>if (getParametersForImportRequest == null) {<NEW_LINE>throw new AmazonClientException("Invalid argument passed to marshall(GetParametersForImportRequest)");<NEW_LINE>}<NEW_LINE>Request<GetParametersForImportRequest> request = new DefaultRequest<GetParametersForImportRequest>(getParametersForImportRequest, "AWSKMS");<NEW_LINE>String target = "TrentService.GetParametersForImport";<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 (getParametersForImportRequest.getKeyId() != null) {<NEW_LINE>String keyId = getParametersForImportRequest.getKeyId();<NEW_LINE>jsonWriter.name("KeyId");<NEW_LINE>jsonWriter.value(keyId);<NEW_LINE>}<NEW_LINE>if (getParametersForImportRequest.getWrappingAlgorithm() != null) {<NEW_LINE>String wrappingAlgorithm = getParametersForImportRequest.getWrappingAlgorithm();<NEW_LINE>jsonWriter.name("WrappingAlgorithm");<NEW_LINE>jsonWriter.value(wrappingAlgorithm);<NEW_LINE>}<NEW_LINE>if (getParametersForImportRequest.getWrappingKeySpec() != null) {<NEW_LINE>String wrappingKeySpec = getParametersForImportRequest.getWrappingKeySpec();<NEW_LINE>jsonWriter.name("WrappingKeySpec");<NEW_LINE>jsonWriter.value(wrappingKeySpec);<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: " + <MASK><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>} | t.getMessage(), t); |
869,246 | final ApplySecurityGroupsToClientVpnTargetNetworkResult executeApplySecurityGroupsToClientVpnTargetNetwork(ApplySecurityGroupsToClientVpnTargetNetworkRequest applySecurityGroupsToClientVpnTargetNetworkRequest) {<NEW_LINE>ExecutionContext executionContext = createExecutionContext(applySecurityGroupsToClientVpnTargetNetworkRequest);<NEW_LINE>AWSRequestMetrics awsRequestMetrics = executionContext.getAwsRequestMetrics();<NEW_LINE>awsRequestMetrics.startEvent(Field.ClientExecuteTime);<NEW_LINE>Request<ApplySecurityGroupsToClientVpnTargetNetworkRequest> request = null;<NEW_LINE>Response<ApplySecurityGroupsToClientVpnTargetNetworkResult> response = null;<NEW_LINE>try {<NEW_LINE>awsRequestMetrics.startEvent(Field.RequestMarshallTime);<NEW_LINE>try {<NEW_LINE>request = new ApplySecurityGroupsToClientVpnTargetNetworkRequestMarshaller().marshall(super.beforeMarshalling(applySecurityGroupsToClientVpnTargetNetworkRequest));<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, "EC2");<NEW_LINE>request.addHandlerContext(HandlerContextKey.OPERATION_NAME, "ApplySecurityGroupsToClientVpnTargetNetwork");<NEW_LINE>request.addHandlerContext(HandlerContextKey.ADVANCED_CONFIG, advancedConfig);<NEW_LINE>} finally {<NEW_LINE>awsRequestMetrics.endEvent(Field.RequestMarshallTime);<NEW_LINE>}<NEW_LINE>StaxResponseHandler<ApplySecurityGroupsToClientVpnTargetNetworkResult> responseHandler = new StaxResponseHandler<<MASK><NEW_LINE>response = invoke(request, responseHandler, executionContext);<NEW_LINE>return response.getAwsResponse();<NEW_LINE>} finally {<NEW_LINE>endClientExecution(awsRequestMetrics, request, response);<NEW_LINE>}<NEW_LINE>} | ApplySecurityGroupsToClientVpnTargetNetworkResult>(new ApplySecurityGroupsToClientVpnTargetNetworkResultStaxUnmarshaller()); |
1,625,418 | public void process(JCas jcas) throws AnalysisEngineProcessException {<NEW_LINE>FocusPair fp = null;<NEW_LINE>if (LATByQuantity.answerIsNumber(jcas.getDocumentText())) {<NEW_LINE>logger.debug(".. No focus generated in all-number answer: " + jcas.getDocumentText());<NEW_LINE>return;<NEW_LINE>}<NEW_LINE>if (fp == null)<NEW_LINE>fp = fpDepRoot(jcas);<NEW_LINE>if (fp == null)<NEW_LINE>fp = fpByPos(jcas);<NEW_LINE>if (fp == null) {<NEW_LINE>addFocusFeature(jcas, AF.AnswerFocusNone);<NEW_LINE>logger.info("?. No focus in: " + jcas.getDocumentText());<NEW_LINE>return;<NEW_LINE>} else {<NEW_LINE>if (fp.getFocus().getCoveredText().equals(jcas.getDocumentText()))<NEW_LINE>addFocusFeature(jcas, AF.AnswerFocusWhole);<NEW_LINE>logger.debug(".. Focus '{}' in: {}", fp.getFocus().getCoveredText(), jcas.getDocumentText());<NEW_LINE>}<NEW_LINE>Focus f = new Focus(jcas);<NEW_LINE>f.setBegin(fp.<MASK><NEW_LINE>f.setEnd(fp.getFocus().getEnd());<NEW_LINE>f.setBase(fp.getFocus());<NEW_LINE>f.setToken(fp.getFocusTok());<NEW_LINE>f.addToIndexes();<NEW_LINE>} | getFocus().getBegin()); |
617,048 | private // loaded container (don't call repeatedly)<NEW_LINE>void loadLayout(String containerId, NodeList layoutNodeList) throws java.io.IOException {<NEW_LINE>layoutContainer = layoutModel.getLayoutComponent(containerId);<NEW_LINE>if (layoutContainer == null) {<NEW_LINE>layoutContainer = new LayoutComponent(containerId, true);<NEW_LINE>layoutModel.addRootComponent(layoutContainer);<NEW_LINE>}<NEW_LINE>for (int i = 0; i < layoutNodeList.getLength(); i++) {<NEW_LINE>Node dimLayoutNode = layoutNodeList.item(i);<NEW_LINE>if (!(dimLayoutNode instanceof Element) || !dimLayoutNode.getNodeName().equals(XML_DIMENSION_LAYOUT)) {<NEW_LINE>continue;<NEW_LINE>}<NEW_LINE>Node dimAttrNode = dimLayoutNode.<MASK><NEW_LINE>dimension = integerFromNode(dimAttrNode);<NEW_LINE>rootIndex = 0;<NEW_LINE>LayoutInterval layoutRoot = layoutContainer.getLayoutRoot(0, dimension);<NEW_LINE>NodeList subNodes = dimLayoutNode.getChildNodes();<NEW_LINE>for (int j = 0; j < subNodes.getLength(); j++) {<NEW_LINE>Node node = subNodes.item(j);<NEW_LINE>if (node instanceof Element) {<NEW_LINE>loadGroup(layoutRoot, node);<NEW_LINE>// just one root is loaded<NEW_LINE>break;<NEW_LINE>}<NEW_LINE>}<NEW_LINE>}<NEW_LINE>// recover from missing component name if needed<NEW_LINE>correctMissingName();<NEW_LINE>// check if the container layout is valid - all components having intervals in both dimensions<NEW_LINE>checkMissingComponentsInDimension();<NEW_LINE>} | getAttributes().getNamedItem(ATTR_DIMENSION_DIM); |
276,811 | public boolean isSegmentBalanced(String segmentType) {<NEW_LINE>if (segmentType.equals(MAcctSchemaElement.ELEMENTTYPE_Organization)) {<NEW_LINE>HashMap<Integer, BigDecimal> map = new HashMap<Integer, BigDecimal>();<NEW_LINE>// Add up values by key<NEW_LINE>for (int i = 0; i < m_lines.size(); i++) {<NEW_LINE>FactLine line = (FactLine) m_lines.get(i);<NEW_LINE>Integer key = new Integer(line.getAD_Org_ID());<NEW_LINE>BigDecimal bal = line.getSourceBalance();<NEW_LINE>BigDecimal oldBal = (<MASK><NEW_LINE>if (oldBal != null)<NEW_LINE>bal = bal.add(oldBal);<NEW_LINE>map.put(key, bal);<NEW_LINE>// System.out.println("Add Key=" + key + ", Bal=" + bal + " <- " + line);<NEW_LINE>}<NEW_LINE>// check if all keys are zero<NEW_LINE>Iterator<BigDecimal> values = map.values().iterator();<NEW_LINE>while (values.hasNext()) {<NEW_LINE>BigDecimal bal = values.next();<NEW_LINE>if (bal.signum() != 0) {<NEW_LINE>map.clear();<NEW_LINE>log.warning("(" + segmentType + ") NO - " + toString() + ", Balance=" + bal);<NEW_LINE>return false;<NEW_LINE>}<NEW_LINE>}<NEW_LINE>map.clear();<NEW_LINE>log.finer("(" + segmentType + ") - " + toString());<NEW_LINE>return true;<NEW_LINE>}<NEW_LINE>log.finer("(" + segmentType + ") (not checked) - " + toString());<NEW_LINE>return true;<NEW_LINE>} | BigDecimal) map.get(key); |
692,131 | public synchronized SubstrateMethod createMethod(ResolvedJavaMethod original) {<NEW_LINE>assert !(original instanceof SubstrateMethod) : original;<NEW_LINE>AnalysisMethod aMethod;<NEW_LINE>if (original instanceof AnalysisMethod) {<NEW_LINE>aMethod = (AnalysisMethod) original;<NEW_LINE>} else if (original instanceof HostedMethod) {<NEW_LINE>aMethod = ((HostedMethod) original).wrapped;<NEW_LINE>} else {<NEW_LINE>aMethod = aUniverse.lookup(original);<NEW_LINE>}<NEW_LINE>SubstrateMethod sMethod = methods.get(aMethod);<NEW_LINE>if (sMethod == null) {<NEW_LINE>assert <MASK><NEW_LINE>sMethod = new SubstrateMethod(aMethod, stringTable);<NEW_LINE>methods.put(aMethod, sMethod);<NEW_LINE>sMethod.setLinks(createSignature(aMethod.getSignature()), createType(aMethod.getDeclaringClass()));<NEW_LINE>setAnnotationsEncoding(aMethod, sMethod, null);<NEW_LINE>}<NEW_LINE>return sMethod;<NEW_LINE>} | !(original instanceof HostedMethod) : "too late to create new method"; |
929,302 | private void addTable(DatabaseMetaData md, String catalog, String schema) throws Exception {<NEW_LINE>// globalqss 2005-10-25<NEW_LINE>// ResultSet rs = md.getTables(catalog, schema, null, null);<NEW_LINE>ResultSet rs;<NEW_LINE>if (DB.isPostgreSQL()) {<NEW_LINE>rs = md.getTables(catalog, schema, null, new String[] { "TABLE", "VIEW" });<NEW_LINE>} else {<NEW_LINE>rs = md.getTables(catalog, schema, null, null);<NEW_LINE>}<NEW_LINE>// end globalqss 2005-10-25<NEW_LINE>while (rs.next()) {<NEW_LINE>String tableName = rs.getString("TABLE_NAME");<NEW_LINE>String tableType = rs.getString("TABLE_TYPE");<NEW_LINE>// Try to find<NEW_LINE>MTable table = MTable.<MASK><NEW_LINE>// Create new ?<NEW_LINE>if (table == null) {<NEW_LINE>String tn = tableName.toUpperCase();<NEW_LINE>if (// temp table<NEW_LINE>// print trl views<NEW_LINE>tn.startsWith("T_SELECTION") || // views<NEW_LINE>tn.endsWith("_VT") || // views<NEW_LINE>tn.endsWith("_V") || // asset tables not yet<NEW_LINE>tn.endsWith("_V1") || // asset tables not yet<NEW_LINE>tn.startsWith("A_A") || // oracle system tables<NEW_LINE>tn.startsWith("A_D") || // explain plan<NEW_LINE>tn.indexOf('$') != -1 || tn.indexOf("EXPLAIN") != -1) {<NEW_LINE>log.debug("Ignored: " + tableName + " - " + tableType);<NEW_LINE>continue;<NEW_LINE>}<NEW_LINE>//<NEW_LINE>log.info(tableName + " - " + tableType);<NEW_LINE>// Create New<NEW_LINE>table = new MTable(getCtx(), 0, get_TrxName());<NEW_LINE>table.setEntityType(p_EntityType);<NEW_LINE>table.setName(tableName);<NEW_LINE>table.setTableName(tableName);<NEW_LINE>table.setIsView("VIEW".equals(tableType));<NEW_LINE>if (!table.save()) {<NEW_LINE>continue;<NEW_LINE>}<NEW_LINE>}<NEW_LINE>// Check Columns<NEW_LINE>// globalqss 2005-10-24<NEW_LINE>if (DB.isPostgreSQL()) {<NEW_LINE>tableName = tableName.toLowerCase();<NEW_LINE>}<NEW_LINE>// end globalqss 2005-10-24<NEW_LINE>ResultSet rsC = md.getColumns(catalog, schema, tableName, null);<NEW_LINE>addTableColumn(rsC, table);<NEW_LINE>}<NEW_LINE>} | get(getCtx(), tableName); |
111,770 | public boolean is_used(Padstack p_padstack, app.freerouting.board.BasicBoard p_board) {<NEW_LINE>java.util.Iterator<app.freerouting.datastructures.UndoableObjects.UndoableObjectNode> it <MASK><NEW_LINE>for (; ; ) {<NEW_LINE>app.freerouting.datastructures.UndoableObjects.Storable curr_item = p_board.item_list.read_object(it);<NEW_LINE>if (curr_item == null) {<NEW_LINE>break;<NEW_LINE>}<NEW_LINE>if (curr_item instanceof app.freerouting.board.DrillItem) {<NEW_LINE>if (((app.freerouting.board.DrillItem) curr_item).get_padstack() == p_padstack) {<NEW_LINE>return true;<NEW_LINE>}<NEW_LINE>}<NEW_LINE>}<NEW_LINE>for (int i = 1; i <= this.packages.count(); ++i) {<NEW_LINE>Package curr_package = this.packages.get(i);<NEW_LINE>for (int j = 0; j < curr_package.pin_count(); ++j) {<NEW_LINE>if (curr_package.get_pin(j).padstack_no == p_padstack.no) {<NEW_LINE>return true;<NEW_LINE>}<NEW_LINE>}<NEW_LINE>}<NEW_LINE>return false;<NEW_LINE>} | = p_board.item_list.start_read_object(); |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.