idx int32 46 1.86M | input stringlengths 321 6.6k | target stringlengths 9 1.24k |
|---|---|---|
523,798 | public IDocument createCounterDocument(final IDocument document) {<NEW_LINE>final I_C_Order order = InterfaceWrapperHelper.create(document, I_C_Order.class);<NEW_LINE>final MOrder orderPO = LegacyAdapters.convertToPO(order);<NEW_LINE>final I_C_DocType counterDocType = retrieveCounterDocTypeOrNull(document);<NEW_LINE>final I_AD_Org counterOrg = retrieveCounterOrgOrNull(document);<NEW_LINE>final de.metas.adempiere.model.I_C_Order counterOrder = InterfaceWrapperHelper.newInstance(de.metas.adempiere.model.I_C_Order.class, document.getCtx());<NEW_LINE>final MOrder counterOrderPO = LegacyAdapters.convertToPO(counterOrder);<NEW_LINE>// 09700<NEW_LINE>counterOrder.setAD_Org_ID(counterOrg.getAD_Org_ID());<NEW_LINE>//<NEW_LINE>orderBL.setDocTypeTargetIdAndUpdateDescription(counterOrder, DocTypeId.ofRepoId(counterDocType.getC_DocType_ID()));<NEW_LINE>counterOrder.setIsSOTrx(counterDocType.isSOTrx());<NEW_LINE>// the new order needs to figure out the pricing by itself<NEW_LINE>counterOrder.setM_PricingSystem_ID(-1);<NEW_LINE>counterOrder.setM_PriceList_ID(-1);<NEW_LINE>counterOrder.setDateOrdered(order.getDateOrdered());<NEW_LINE>counterOrder.<MASK><NEW_LINE>counterOrder.setDatePromised(order.getDatePromised());<NEW_LINE>counterOrder.setRef_Order_ID(order.getC_Order_ID());<NEW_LINE>final I_C_BPartner counterBP = retrieveCounterPartnerOrNull(document);<NEW_LINE>counterOrderPO.setBPartner(counterBP);<NEW_LINE>final WarehouseId counterWarehouseId = Services.get(IWarehouseAdvisor.class).evaluateOrderWarehouse(counterOrder);<NEW_LINE>counterOrder.setM_Warehouse_ID(counterWarehouseId.getRepoId());<NEW_LINE>// References (should not be required)<NEW_LINE>counterOrder.setSalesRep_ID(order.getSalesRep_ID());<NEW_LINE>InterfaceWrapperHelper.save(counterOrder);<NEW_LINE>order.setRef_Order_ID(counterOrder.getC_Order_ID());<NEW_LINE>InterfaceWrapperHelper.save(order);<NEW_LINE>// copy the order lines<NEW_LINE>final boolean counter = true;<NEW_LINE>final boolean copyASI = true;<NEW_LINE>counterOrderPO.copyLinesFrom(orderPO, counter, copyASI);<NEW_LINE>// Update copied lines<NEW_LINE>final List<MOrderLine> counterLines = counterOrderPO.getLinesRequery();<NEW_LINE>for (final MOrderLine counterLine : counterLines) {<NEW_LINE>// copies header values (BP, etc.)<NEW_LINE>Services.get(IOrderLineBL.class).setOrder(counterLine, counterOrderPO);<NEW_LINE>counterLine.setPrice();<NEW_LINE>counterLine.setTax();<NEW_LINE>InterfaceWrapperHelper.save(counterLine);<NEW_LINE>}<NEW_LINE>logger.debug(counterOrder.toString());<NEW_LINE>// Document Action<NEW_LINE>final MDocTypeCounter counterDT = MDocTypeCounter.getCounterDocType(document.getCtx(), order.getC_DocType_ID());<NEW_LINE>if (counterDT != null) {<NEW_LINE>if (counterDT.getDocAction() != null) {<NEW_LINE>counterOrder.setDocAction(counterDT.getDocAction());<NEW_LINE>// not expecting a particular docStatus (e.g. for prepay orders, it might be "waiting to payment")<NEW_LINE>Services.get(IDocumentBL.class).// not expecting a particular docStatus (e.g. for prepay orders, it might be "waiting to payment")<NEW_LINE>processEx(// not expecting a particular docStatus (e.g. for prepay orders, it might be "waiting to payment")<NEW_LINE>counterOrder, // not expecting a particular docStatus (e.g. for prepay orders, it might be "waiting to payment")<NEW_LINE>counterDT.getDocAction(), null);<NEW_LINE>}<NEW_LINE>}<NEW_LINE>return counterOrderPO;<NEW_LINE>} | setDateAcct(order.getDateAcct()); |
198,393 | public void pushAndSend(String streamId, List<Object> tuple, Integer outTaskId, Collection<Tuple> anchors, Object messageId, Long rootId, ICollectorCallback callback) {<NEW_LINE>if (outTaskId != null) {<NEW_LINE>synchronized (directBatches) {<NEW_LINE>List<MsgInfo> batchTobeFlushed = addToBatches(outTaskId.toString() + "-" + streamId, directBatches, streamId, tuple, outTaskId, <MASK><NEW_LINE>if (batchTobeFlushed != null && batchTobeFlushed.size() > 0) {<NEW_LINE>timeIntervalGauge.incrementAndGet();<NEW_LINE>sendBatch(streamId, (outTaskId.toString()), batchTobeFlushed);<NEW_LINE>}<NEW_LINE>}<NEW_LINE>} else {<NEW_LINE>synchronized (streamToBatches) {<NEW_LINE>List<MsgInfo> batchTobeFlushed = addToBatches(streamId, streamToBatches, streamId, tuple, outTaskId, messageId, rootId, batchSize, callback);<NEW_LINE>if (batchTobeFlushed != null && batchTobeFlushed.size() > 0) {<NEW_LINE>timeIntervalGauge.incrementAndGet();<NEW_LINE>sendBatch(streamId, null, batchTobeFlushed);<NEW_LINE>}<NEW_LINE>}<NEW_LINE>}<NEW_LINE>} | messageId, rootId, batchSize, callback); |
644,186 | private AclRule createRule(final String type, final int index, final ACLPolicyDoc.TypeRule typeRule, final AclRuleBuilder prototype) {<NEW_LINE>AclRuleBuilder ruleBuilder = AclRuleBuilder.builder(prototype);<NEW_LINE><MASK><NEW_LINE>Object deny = typeRule.getDeny();<NEW_LINE>final Set<String> allowActions = null != typeRule.getAllow() ? typeRule.getAllowActions() : new HashSet<>();<NEW_LINE>final Set<String> denyActions = null != typeRule.getDeny() ? typeRule.getDenyActions() : new HashSet<>();<NEW_LINE>// add resource match sections<NEW_LINE>ruleBuilder.sourceIdentityAppend("[rule: " + index + "]").allowActions(allowActions).denyActions(denyActions).regexResource(typeRule.getMatch()).containsResource(typeRule.getContains()).subsetResource(typeRule.getSubset()).equalsResource(typeRule.getEquals());<NEW_LINE>return ruleBuilder.build();<NEW_LINE>} | Object allow = typeRule.getAllow(); |
462,545 | private boolean isInsidePath(final PsiElement psiElement, PathExpression pathExpression) {<NEW_LINE>if (psiElement == null) {<NEW_LINE>return false;<NEW_LINE>}<NEW_LINE>final PsiNamedElement nextNamedParent = getNextNamedParent(psiElement);<NEW_LINE>final String unescapedTargetKeyName = <MASK><NEW_LINE>if (pathExpression.isAnyKey()) {<NEW_LINE>return isInsidePath(getNextNamedParent(nextNamedParent.getParent()), pathExpression.beforeLast());<NEW_LINE>}<NEW_LINE>if (pathExpression.isAnyKeys()) {<NEW_LINE>return isInsidePath(goUpToElementWithParentName(psiElement, pathExpression.secondLast()), pathExpression.beforeLast());<NEW_LINE>}<NEW_LINE>if (unescapedTargetKeyName.equals(ROOT_PATH)) {<NEW_LINE>return nextNamedParent instanceof PsiFile;<NEW_LINE>}<NEW_LINE>return unescapedTargetKeyName.equals(nextNamedParent.getName()) && (pathExpression.hasOnePath() || isInsidePath(nextNamedParent.getParent(), pathExpression.beforeLast()));<NEW_LINE>} | unescape(pathExpression.last()); |
1,140,428 | public Request<SetIdentityDkimEnabledRequest> marshall(SetIdentityDkimEnabledRequest setIdentityDkimEnabledRequest) {<NEW_LINE>if (setIdentityDkimEnabledRequest == null) {<NEW_LINE>throw new AmazonClientException("Invalid argument passed to marshall(SetIdentityDkimEnabledRequest)");<NEW_LINE>}<NEW_LINE>Request<SetIdentityDkimEnabledRequest> request = new DefaultRequest<SetIdentityDkimEnabledRequest>(setIdentityDkimEnabledRequest, "AmazonSimpleEmailService");<NEW_LINE><MASK><NEW_LINE>request.addParameter("Version", "2010-12-01");<NEW_LINE>String prefix;<NEW_LINE>if (setIdentityDkimEnabledRequest.getIdentity() != null) {<NEW_LINE>prefix = "Identity";<NEW_LINE>String identity = setIdentityDkimEnabledRequest.getIdentity();<NEW_LINE>request.addParameter(prefix, StringUtils.fromString(identity));<NEW_LINE>}<NEW_LINE>if (setIdentityDkimEnabledRequest.getDkimEnabled() != null) {<NEW_LINE>prefix = "DkimEnabled";<NEW_LINE>Boolean dkimEnabled = setIdentityDkimEnabledRequest.getDkimEnabled();<NEW_LINE>request.addParameter(prefix, StringUtils.fromBoolean(dkimEnabled));<NEW_LINE>}<NEW_LINE>return request;<NEW_LINE>} | request.addParameter("Action", "SetIdentityDkimEnabled"); |
1,026,967 | private int leaderReplay(final long nowNs) {<NEW_LINE>int workCount = 0;<NEW_LINE>if (null == logReplay) {<NEW_LINE>if (logPosition < appendPosition) {<NEW_LINE>logReplay = consensusModuleAgent.newLogReplay(logPosition, appendPosition);<NEW_LINE>} else {<NEW_LINE>state(LEADER_INIT, nowNs);<NEW_LINE>}<NEW_LINE>workCount++;<NEW_LINE>isLeaderStartup = isNodeStartup;<NEW_LINE>ClusterMember.resetLogPositions(clusterMembers, NULL_POSITION);<NEW_LINE>thisMember.leadershipTermId(leadershipTermId).logPosition(appendPosition);<NEW_LINE>} else {<NEW_LINE>workCount += logReplay.doWork();<NEW_LINE>if (logReplay.isDone()) {<NEW_LINE>cleanupReplay();<NEW_LINE>logPosition = appendPosition;<NEW_LINE>state(LEADER_INIT, nowNs);<NEW_LINE>}<NEW_LINE>}<NEW_LINE>workCount += publishNewLeadershipTermOnInterval(nowNs);<NEW_LINE>workCount += publishCommitPositionOnInterval(<MASK><NEW_LINE>return workCount;<NEW_LINE>} | consensusModuleAgent.quorumPosition(), nowNs); |
1,815,852 | public ListIdentityResolutionJobsResult unmarshall(JsonUnmarshallerContext context) throws Exception {<NEW_LINE>ListIdentityResolutionJobsResult listIdentityResolutionJobsResult = new ListIdentityResolutionJobsResult();<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 listIdentityResolutionJobsResult;<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("IdentityResolutionJobsList", targetDepth)) {<NEW_LINE>context.nextToken();<NEW_LINE>listIdentityResolutionJobsResult.setIdentityResolutionJobsList(new ListUnmarshaller<IdentityResolutionJob>(IdentityResolutionJobJsonUnmarshaller.getInstance()).unmarshall(context));<NEW_LINE>}<NEW_LINE>if (context.testExpression("NextToken", targetDepth)) {<NEW_LINE>context.nextToken();<NEW_LINE>listIdentityResolutionJobsResult.setNextToken(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 listIdentityResolutionJobsResult;<NEW_LINE>} | class).unmarshall(context)); |
445,412 | public BigInteger parseLiteral(Object input) {<NEW_LINE>if (input instanceof StringValue) {<NEW_LINE>try {<NEW_LINE>return new BigDecimal(((StringValue) input).<MASK><NEW_LINE>} catch (NumberFormatException | ArithmeticException e) {<NEW_LINE>throw new CoercingParseLiteralException("Unable to turn input into a 'BigInteger'");<NEW_LINE>}<NEW_LINE>} else if (input instanceof IntValue) {<NEW_LINE>return ((IntValue) input).getValue();<NEW_LINE>} else if (input instanceof FloatValue) {<NEW_LINE>try {<NEW_LINE>return ((FloatValue) input).getValue().toBigIntegerExact();<NEW_LINE>} catch (ArithmeticException e) {<NEW_LINE>throw new CoercingParseLiteralException("Unable to turn input into a 'BigInteger'");<NEW_LINE>}<NEW_LINE>}<NEW_LINE>throw new CoercingParseLiteralException("Expected type 'Int', 'String' or 'Float' but was '" + GraphQLSchemaUtil.getValueTypeName(input) + "'.");<NEW_LINE>} | getValue()).toBigIntegerExact(); |
994,797 | public static List<EntityDetail> findEntitiesByType(OMRSAPIHelper oMRSAPIHelper, String serverName, String userId, String type, String searchCriteria, Date asOfTime, Integer offset, Integer pageSize, SequencingOrder sequencingOrder, String sequencingProperty, String methodName) throws UserNotAuthorizedException, FunctionNotSupportedException, InvalidParameterException, RepositoryErrorException, PropertyErrorException, TypeErrorException, PagingErrorException {<NEW_LINE>// if offset or pagesize were not supplied then default them, so they can be converted to primitives.<NEW_LINE>if (offset == null) {<NEW_LINE>offset = new Integer(0);<NEW_LINE>}<NEW_LINE>if (pageSize == null) {<NEW_LINE>pageSize = new Integer(0);<NEW_LINE>}<NEW_LINE>if (sequencingProperty != null) {<NEW_LINE>try {<NEW_LINE>sequencingProperty = URLDecoder.decode(sequencingProperty, "UTF-8");<NEW_LINE>} catch (UnsupportedEncodingException e) {<NEW_LINE>// TODO error<NEW_LINE>}<NEW_LINE>}<NEW_LINE>if (searchCriteria != null) {<NEW_LINE>try {<NEW_LINE>searchCriteria = URLDecoder.decode(searchCriteria, "UTF-8");<NEW_LINE>} catch (UnsupportedEncodingException e) {<NEW_LINE>// TODO error<NEW_LINE>}<NEW_LINE>}<NEW_LINE>OpenMetadataTypesArchiveAccessor archiveAccessor = OpenMetadataTypesArchiveAccessor.getInstance();<NEW_LINE>TypeDef typeDef = archiveAccessor.getEntityDefByName(type);<NEW_LINE><MASK><NEW_LINE>return // TODO limit by status ?<NEW_LINE>oMRSAPIHelper.// TODO limit by status ?<NEW_LINE>callFindEntitiesByPropertyValue(// TODO limit by status ?<NEW_LINE>userId, // TODO limit by status ?<NEW_LINE>entityTypeGUID, // TODO limit by status ?<NEW_LINE>searchCriteria, // TODO limit by status ?<NEW_LINE>offset.intValue(), // TODO limit by classification ?<NEW_LINE>null, null, asOfTime, sequencingProperty, sequencingOrder, pageSize);<NEW_LINE>} | String entityTypeGUID = typeDef.getGUID(); |
528,831 | private static Object v1(final Environment environment, final String prefix, final boolean handlePlaceholder) {<NEW_LINE>Class<?> resolverClass = Class.forName("org.springframework.boot.bind.RelaxedPropertyResolver");<NEW_LINE>Constructor<?> resolverConstructor = resolverClass.getDeclaredConstructor(PropertyResolver.class);<NEW_LINE>Method getSubPropertiesMethod = resolverClass.getDeclaredMethod("getSubProperties", String.class);<NEW_LINE>Object resolverObject = resolverConstructor.newInstance(environment);<NEW_LINE>String prefixParam = prefix.endsWith(<MASK><NEW_LINE>Method getPropertyMethod = resolverClass.getDeclaredMethod("getProperty", String.class);<NEW_LINE>Map<String, Object> dataSourceProps = (Map<String, Object>) getSubPropertiesMethod.invoke(resolverObject, prefixParam);<NEW_LINE>Map<String, Object> result = new HashMap<>(dataSourceProps.size(), 1);<NEW_LINE>for (Entry<String, Object> entry : dataSourceProps.entrySet()) {<NEW_LINE>String key = entry.getKey();<NEW_LINE>Object value = entry.getValue();<NEW_LINE>if (handlePlaceholder && value instanceof String && ((String) value).contains(PlaceholderConfigurerSupport.DEFAULT_PLACEHOLDER_PREFIX)) {<NEW_LINE>String resolvedValue = (String) getPropertyMethod.invoke(resolverObject, prefixParam + key);<NEW_LINE>result.put(key, resolvedValue);<NEW_LINE>} else {<NEW_LINE>result.put(key, value);<NEW_LINE>}<NEW_LINE>}<NEW_LINE>return result;<NEW_LINE>} | ".") ? prefix : prefix + "."; |
1,009,530 | final ListLicenseConfigurationsResult executeListLicenseConfigurations(ListLicenseConfigurationsRequest listLicenseConfigurationsRequest) {<NEW_LINE>ExecutionContext executionContext = createExecutionContext(listLicenseConfigurationsRequest);<NEW_LINE>AWSRequestMetrics awsRequestMetrics = executionContext.getAwsRequestMetrics();<NEW_LINE>awsRequestMetrics.startEvent(Field.ClientExecuteTime);<NEW_LINE>Request<ListLicenseConfigurationsRequest> request = null;<NEW_LINE>Response<ListLicenseConfigurationsResult> response = null;<NEW_LINE>try {<NEW_LINE>awsRequestMetrics.startEvent(Field.RequestMarshallTime);<NEW_LINE>try {<NEW_LINE>request = new ListLicenseConfigurationsRequestProtocolMarshaller(protocolFactory).marshall(super.beforeMarshalling(listLicenseConfigurationsRequest));<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, "License Manager");<NEW_LINE>request.addHandlerContext(HandlerContextKey.OPERATION_NAME, "ListLicenseConfigurations");<NEW_LINE>request.addHandlerContext(HandlerContextKey.ADVANCED_CONFIG, advancedConfig);<NEW_LINE>} finally {<NEW_LINE>awsRequestMetrics.endEvent(Field.RequestMarshallTime);<NEW_LINE>}<NEW_LINE>HttpResponseHandler<AmazonWebServiceResponse<ListLicenseConfigurationsResult>> 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 ListLicenseConfigurationsResultJsonUnmarshaller()); |
637,509 | public void onRun() throws MigrationPendingException, RetryLaterException {<NEW_LINE>Optional<IncomingTextMessage> message = assembleMessageFragments(pdus, subscriptionId);<NEW_LINE>if (SignalStore.account().getE164() == null) {<NEW_LINE>Log.i(TAG, "Received an SMS before we're registered...");<NEW_LINE>if (message.isPresent()) {<NEW_LINE>Optional<String> token = VerificationCodeParser.parse(message.get().getMessageBody());<NEW_LINE>if (token.isPresent()) {<NEW_LINE>Log.i(TAG, "Received something that looks like a registration SMS. Posting a notification and broadcast.");<NEW_LINE>NotificationManager manager = ServiceUtil.getNotificationManager(context);<NEW_LINE>Notification notification = buildPreRegistrationNotification(context, message.get());<NEW_LINE>manager.notify(NotificationIds.PRE_REGISTRATION_SMS, notification);<NEW_LINE>Intent smsRetrieverIntent = buildSmsRetrieverIntent(message.get());<NEW_LINE>context.sendBroadcast(smsRetrieverIntent);<NEW_LINE>return;<NEW_LINE>} else {<NEW_LINE>Log.w(TAG, "Received an SMS before registration is complete. We'll try again later.");<NEW_LINE>throw new RetryLaterException();<NEW_LINE>}<NEW_LINE>} else {<NEW_LINE>Log.w(TAG, "Received an SMS before registration is complete, but couldn't assemble the message anyway. Ignoring.");<NEW_LINE>return;<NEW_LINE>}<NEW_LINE>}<NEW_LINE>if (message.isPresent() && SignalStore.account().getE164() != null && message.get().getSender().equals(Recipient.self().getId())) {<NEW_LINE><MASK><NEW_LINE>} else if (message.isPresent() && !isBlocked(message.get())) {<NEW_LINE>Optional<InsertResult> insertResult = storeMessage(message.get());<NEW_LINE>if (insertResult.isPresent()) {<NEW_LINE>ApplicationDependencies.getMessageNotifier().updateNotification(context, insertResult.get().getThreadId());<NEW_LINE>}<NEW_LINE>} else if (message.isPresent()) {<NEW_LINE>Log.w(TAG, "Received an SMS from a blocked user. Ignoring.");<NEW_LINE>} else {<NEW_LINE>Log.w(TAG, "Failed to assemble message fragments!");<NEW_LINE>}<NEW_LINE>} | Log.w(TAG, "Received an SMS from ourselves! Ignoring."); |
1,421,993 | public static void markRegionBorders(GrayS32 labeled, GrayU8 output) {<NEW_LINE>InputSanityCheck.checkSameShape(labeled, output);<NEW_LINE><MASK><NEW_LINE>for (int y = 0; y < output.height - 1; y++) {<NEW_LINE>int indexLabeled = labeled.startIndex + y * labeled.stride;<NEW_LINE>int indexOutput = output.startIndex + y * output.stride;<NEW_LINE>for (int x = 0; x < output.width - 1; x++, indexLabeled++, indexOutput++) {<NEW_LINE>int region0 = labeled.data[indexLabeled];<NEW_LINE>int region1 = labeled.data[indexLabeled + 1];<NEW_LINE>int region2 = labeled.data[indexLabeled + labeled.stride];<NEW_LINE>if (region0 != region1) {<NEW_LINE>output.data[indexOutput] = 1;<NEW_LINE>output.data[indexOutput + 1] = 1;<NEW_LINE>}<NEW_LINE>if (region0 != region2) {<NEW_LINE>output.data[indexOutput] = 1;<NEW_LINE>output.data[indexOutput + output.stride] = 1;<NEW_LINE>}<NEW_LINE>}<NEW_LINE>}<NEW_LINE>for (int y = 0; y < output.height - 1; y++) {<NEW_LINE>int indexLabeled = labeled.startIndex + y * labeled.stride + output.width - 1;<NEW_LINE>int indexOutput = output.startIndex + y * output.stride + output.width - 1;<NEW_LINE>int region0 = labeled.data[indexLabeled];<NEW_LINE>int region2 = labeled.data[indexLabeled + labeled.stride];<NEW_LINE>if (region0 != region2) {<NEW_LINE>output.data[indexOutput] = 1;<NEW_LINE>output.data[indexOutput + output.stride] = 1;<NEW_LINE>}<NEW_LINE>}<NEW_LINE>int y = output.height - 1;<NEW_LINE>int indexLabeled = labeled.startIndex + y * labeled.stride;<NEW_LINE>int indexOutput = output.startIndex + y * output.stride;<NEW_LINE>for (int x = 0; x < output.width - 1; x++, indexLabeled++, indexOutput++) {<NEW_LINE>int region0 = labeled.data[indexLabeled];<NEW_LINE>int region1 = labeled.data[indexLabeled + 1];<NEW_LINE>if (region0 != region1) {<NEW_LINE>output.data[indexOutput] = 1;<NEW_LINE>output.data[indexOutput + 1] = 1;<NEW_LINE>}<NEW_LINE>}<NEW_LINE>} | ImageMiscOps.fill(output, 0); |
1,338,931 | public void start() throws BundleException {<NEW_LINE>// Setup properties used by Stargate framework<NEW_LINE>try {<NEW_LINE>if (!nodetool) {<NEW_LINE>setStargateProperties();<NEW_LINE>}<NEW_LINE>} catch (Exception e) {<NEW_LINE>System.err.println(e.getMessage());<NEW_LINE>System.exit(2);<NEW_LINE>}<NEW_LINE>// Initialize Apache Felix Framework<NEW_LINE>framework = new Felix(felixConfig());<NEW_LINE>framework.init();<NEW_LINE>System.err.println("JAR DIR: " + JAR_DIRECTORY);<NEW_LINE>// Install bundles<NEW_LINE>context = framework.getBundleContext();<NEW_LINE>context.addFrameworkListener(new BundleFailureListener());<NEW_LINE>File[] files = new File(JAR_DIRECTORY).listFiles();<NEW_LINE>List<File> jars = pickBundles(files);<NEW_LINE>framework.start();<NEW_LINE>bundleList = new ArrayList<>();<NEW_LINE>// Install bundle JAR files and remember the bundle objects.<NEW_LINE>for (File jar : jars) {<NEW_LINE>System.out.println("Installing bundle " + jar.getName());<NEW_LINE>Bundle b = context.installBundle(jar.toURI().toString());<NEW_LINE>bundleList.add(b);<NEW_LINE>}<NEW_LINE>if (nodetool) {<NEW_LINE>// expect the persistence bundle to be first in the list<NEW_LINE>Bundle bundle = bundleList.get(0);<NEW_LINE>try {<NEW_LINE>Class<?> tool = bundle.loadClass("org.apache.cassandra.tools.NodeTool");<NEW_LINE>System.out.println("Running NodeTool from " + bundle.getSymbolicName());<NEW_LINE>Method main = tool.getMethod("main", String[].class);<NEW_LINE>main.invoke(null, (Object) toolArgs.toArray<MASK><NEW_LINE>// exit just in case, NodeTool is expected to call System.exit() when done.<NEW_LINE>System.exit(5);<NEW_LINE>} catch (Exception e) {<NEW_LINE>throw new RuntimeException(e);<NEW_LINE>}<NEW_LINE>}<NEW_LINE>// Start all installed bundles.<NEW_LINE>for (Bundle bundle : bundleList) {<NEW_LINE>System.out.println("Starting bundle " + bundle.getSymbolicName());<NEW_LINE>bundle.start();<NEW_LINE>}<NEW_LINE>if (startError.get()) {<NEW_LINE>System.out.println("Terminating due to previous service startup errors.");<NEW_LINE>System.exit(1);<NEW_LINE>}<NEW_LINE>System.out.println(STARTED_MESSAGE);<NEW_LINE>if (watchBundles && !disableBundlesWatch) {<NEW_LINE>watchJarDirectory(JAR_DIRECTORY);<NEW_LINE>}<NEW_LINE>} | (new String[0])); |
560,510 | protected Message createMessage(Object objectToConvert, MessageProperties messageProperties, @Nullable Type genericType) throws MessageConversionException {<NEW_LINE>byte[] bytes;<NEW_LINE>try {<NEW_LINE>if (this.charsetIsUtf8 && this.supportedCTCharset == null) {<NEW_LINE>bytes = this.objectMapper.writeValueAsBytes(objectToConvert);<NEW_LINE>} else {<NEW_LINE>String jsonString = this.objectMapper.writeValueAsString(objectToConvert);<NEW_LINE>String encoding = this.supportedCTCharset != null ? this.supportedCTCharset : getDefaultCharset();<NEW_LINE>bytes = jsonString.getBytes(encoding);<NEW_LINE>}<NEW_LINE>} catch (IOException e) {<NEW_LINE>throw new MessageConversionException("Failed to convert Message content", e);<NEW_LINE>}<NEW_LINE>messageProperties.setContentType(this.supportedContentType.toString());<NEW_LINE>if (this.supportedCTCharset == null) {<NEW_LINE><MASK><NEW_LINE>}<NEW_LINE>messageProperties.setContentLength(bytes.length);<NEW_LINE>if (getClassMapper() == null) {<NEW_LINE>JavaType type = this.objectMapper.constructType(genericType == null ? objectToConvert.getClass() : genericType);<NEW_LINE>if (genericType != null && !type.isContainerType() && Modifier.isAbstract(type.getRawClass().getModifiers())) {<NEW_LINE>type = this.objectMapper.constructType(objectToConvert.getClass());<NEW_LINE>}<NEW_LINE>getJavaTypeMapper().fromJavaType(type, messageProperties);<NEW_LINE>} else {<NEW_LINE>// NOSONAR never null<NEW_LINE>getClassMapper().fromClass(objectToConvert.getClass(), messageProperties);<NEW_LINE>}<NEW_LINE>return new Message(bytes, messageProperties);<NEW_LINE>} | messageProperties.setContentEncoding(getDefaultCharset()); |
1,070,474 | public static String[] split(String regex, CharSequence input) {<NEW_LINE>int index = 0;<NEW_LINE>ArrayList<String> <MASK><NEW_LINE>Matcher m = Pattern.compile(regex).matcher(input);<NEW_LINE>// Add segments before each match found<NEW_LINE>while (m.find()) {<NEW_LINE>matchList.add(input.subSequence(index, m.start()).toString());<NEW_LINE>matchList.add(input.subSequence(m.start(), m.end()).toString());<NEW_LINE>index = m.end();<NEW_LINE>}<NEW_LINE>// If no match was found, return this<NEW_LINE>if (index == 0)<NEW_LINE>return new String[] { input.toString() };<NEW_LINE>// Add remaining segment<NEW_LINE>matchList.add(input.subSequence(index, input.length()).toString());<NEW_LINE>// Construct result<NEW_LINE>Iterator<String> it = matchList.iterator();<NEW_LINE>while (it.hasNext()) {<NEW_LINE>if ("".equals(it.next())) {<NEW_LINE>it.remove();<NEW_LINE>}<NEW_LINE>}<NEW_LINE>String[] result = new String[matchList.size()];<NEW_LINE>return matchList.toArray(result);<NEW_LINE>} | matchList = new ArrayList<>(); |
150,844 | private void buildOutputContainer() {<NEW_LINE>// Populate the list of statistics which will be output in the schema<NEW_LINE>for (VectorWrapper<?> vw : incoming) {<NEW_LINE>for (String outputStatName : functions.keySet()) {<NEW_LINE>if (functions.get(outputStatName).equals(vw.getField().getName())) {<NEW_LINE>mergedStatisticList.add(MergedStatisticFactory.getMergedStatistic(outputStatName, functions.get(outputStatName), samplePercent));<NEW_LINE>}<NEW_LINE>}<NEW_LINE>}<NEW_LINE>// Configure settings/dependencies for statistics, if needed<NEW_LINE>for (MergedStatistic statistic : mergedStatisticList) {<NEW_LINE>if (statistic.getName().equals(Statistic.AVG_WIDTH)) {<NEW_LINE>((AvgWidthMergedStatistic) statistic).configure(mergedStatisticList);<NEW_LINE>} else if (statistic.getName().equals(Statistic.NDV)) {<NEW_LINE>NDVMergedStatistic.NDVConfiguration config = new NDVMergedStatistic.NDVConfiguration(context.getOptions(), mergedStatisticList);<NEW_LINE>((NDVMergedStatistic) statistic).configure(config);<NEW_LINE>} else if (statistic.getName().equals(Statistic.SUM_DUPS)) {<NEW_LINE>((CntDupsMergedStatistic) statistic).configure(mergedStatisticList);<NEW_LINE>} else if (statistic.getName().equals(Statistic.HLL_MERGE)) {<NEW_LINE>((HLLMergedStatistic) statistic).configure(context.getOptions());<NEW_LINE>} else if (statistic.getName().equals(Statistic.TDIGEST_MERGE)) {<NEW_LINE>((TDigestMergedStatistic) statistic).configure(context.getOptions());<NEW_LINE>}<NEW_LINE>}<NEW_LINE>// Create the schema number and time when computed in the outgoing vector<NEW_LINE>createKeyColumn(Statistic.SCHEMA, <MASK><NEW_LINE>GregorianCalendar calendar = new GregorianCalendar(TimeZone.getTimeZone("UTC"));<NEW_LINE>calendar.setTimeInMillis(System.currentTimeMillis());<NEW_LINE>createKeyColumn(Statistic.COMPUTED, ValueExpressions.getDate(calendar));<NEW_LINE>// Create output map vectors corresponding to each statistic (e.g. rowcount)<NEW_LINE>for (MergedStatistic statistic : mergedStatisticList) {<NEW_LINE>String targetTypeStatistic = statistic.getInput();<NEW_LINE>for (VectorWrapper<?> vw : incoming) {<NEW_LINE>if (targetTypeStatistic.equals(vw.getField().getName())) {<NEW_LINE>addVectorToOutgoingContainer(statistic.getName(), vw);<NEW_LINE>}<NEW_LINE>}<NEW_LINE>}<NEW_LINE>container.setEmpty();<NEW_LINE>container.buildSchema(incoming.getSchema().getSelectionVectorMode());<NEW_LINE>} | ValueExpressions.getBigInt(schema++)); |
1,274,626 | public GithubClient createClient(ProjectAlmSettingDto projectAlmSettingDto, AlmSettingDto almSettingDto) {<NEW_LINE>String apiUrl = Optional.ofNullable(almSettingDto.getUrl()).orElseThrow(() -> new InvalidConfigurationException(InvalidConfigurationException.Scope.GLOBAL, "No URL has been set for Github connections"));<NEW_LINE>String apiPrivateKey = Optional.ofNullable(almSettingDto.getDecryptedPrivateKey(settings.getEncryption())).orElseThrow(() -> new InvalidConfigurationException(InvalidConfigurationException.Scope.GLOBAL, "No private key has been set for Github connections"));<NEW_LINE>String projectPath = Optional.ofNullable(projectAlmSettingDto.getAlmRepo()).orElseThrow(() -> new InvalidConfigurationException(InvalidConfigurationException.Scope.PROJECT, "No repository name has been set for Github connections"));<NEW_LINE>String appId = Optional.ofNullable(almSettingDto.getAppId()).orElseThrow(() -> new InvalidConfigurationException(InvalidConfigurationException.Scope.GLOBAL, "No App ID has been set for Github connections"));<NEW_LINE>try {<NEW_LINE>RepositoryAuthenticationToken repositoryAuthenticationToken = githubApplicationAuthenticationProvider.getInstallationToken(apiUrl, appId, apiPrivateKey, projectPath);<NEW_LINE>return new GraphqlGithubClient(repositoryAuthenticationToken, server);<NEW_LINE>} catch (IOException ex) {<NEW_LINE>throw new InvalidConfigurationException(InvalidConfigurationException.Scope.PROJECT, "Could not create Github client - " + <MASK><NEW_LINE>}<NEW_LINE>} | ex.getMessage(), ex); |
391,141 | public String visitValues(ValuesRelation node, Void scope) {<NEW_LINE>StringBuilder sqlBuilder = new StringBuilder();<NEW_LINE>if (node.isNullValues()) {<NEW_LINE>return null;<NEW_LINE>}<NEW_LINE>sqlBuilder.append("(VALUES");<NEW_LINE>List<String> values = new ArrayList<>();<NEW_LINE>for (int i = 0; i < node.getRows().size(); ++i) {<NEW_LINE>StringBuilder rowBuilder = new StringBuilder();<NEW_LINE>rowBuilder.append("(");<NEW_LINE>List<String> rowStrings = node.getRows().get(i).stream().map(this::visit).collect(Collectors.toList());<NEW_LINE>rowBuilder.append(Joiner.on(", ").join(rowStrings));<NEW_LINE>rowBuilder.append(")");<NEW_LINE>values.add(rowBuilder.toString());<NEW_LINE>}<NEW_LINE>sqlBuilder.append(Joiner.on(", ").join(values));<NEW_LINE>sqlBuilder.append(") ").<MASK><NEW_LINE>return sqlBuilder.toString();<NEW_LINE>} | append(node.getAlias()); |
67,014 | protected Map<UUID, FilterEntity> copyFilters(User fromUser, User toUser) {<NEW_LINE>Map<UUID, FilterEntity> filtersMap = new HashMap<>();<NEW_LINE>try (Transaction tx = persistence.createTransaction()) {<NEW_LINE>MetaClass effectiveMetaClass = metadata.getExtendedEntities().getEffectiveMetaClass(FilterEntity.class);<NEW_LINE>EntityManager em = persistence.getEntityManager();<NEW_LINE>try {<NEW_LINE>em.setSoftDeletion(false);<NEW_LINE>Query deleteFiltersQuery = em.createQuery(String.format("delete from %s f where f.user.id = ?1", effectiveMetaClass.getName()));<NEW_LINE>deleteFiltersQuery.setParameter(1, toUser.getId());<NEW_LINE>deleteFiltersQuery.executeUpdate();<NEW_LINE>} finally {<NEW_LINE>em.setSoftDeletion(true);<NEW_LINE>}<NEW_LINE>TypedQuery<FilterEntity> q = em.createQuery(String.format("select f from %s f where f.user.id = ?1", effectiveMetaClass.getName()), FilterEntity.class);<NEW_LINE>q.setParameter(1, fromUser.getId());<NEW_LINE>List<FilterEntity> fromUserFilters = q.getResultList();<NEW_LINE>for (FilterEntity filter : fromUserFilters) {<NEW_LINE>FilterEntity newFilter = metadata.create(FilterEntity.class);<NEW_LINE>newFilter.setUser(toUser);<NEW_LINE>newFilter.setCode(filter.getCode());<NEW_LINE>newFilter.<MASK><NEW_LINE>newFilter.setComponentId(filter.getComponentId());<NEW_LINE>newFilter.setXml(filter.getXml());<NEW_LINE>filtersMap.put(filter.getId(), newFilter);<NEW_LINE>em.persist(newFilter);<NEW_LINE>}<NEW_LINE>tx.commit();<NEW_LINE>return filtersMap;<NEW_LINE>}<NEW_LINE>} | setName(filter.getName()); |
416,455 | public ResponseEntity<Void> testBodyWithFileSchemaWithHttpInfo(FileSchemaTestClass body) throws RestClientException {<NEW_LINE>Object localVarPostBody = body;<NEW_LINE>// verify the required parameter 'body' is set<NEW_LINE>if (body == null) {<NEW_LINE>throw new HttpClientErrorException(HttpStatus.BAD_REQUEST, "Missing the required parameter 'body' when calling testBodyWithFileSchema");<NEW_LINE>}<NEW_LINE>final MultiValueMap<String, String> localVarQueryParams = new LinkedMultiValueMap<String, String>();<NEW_LINE>final HttpHeaders localVarHeaderParams = new HttpHeaders();<NEW_LINE>final MultiValueMap<String, String> localVarCookieParams = new LinkedMultiValueMap<String, String>();<NEW_LINE>final MultiValueMap<String, Object> localVarFormParams = new LinkedMultiValueMap<String, Object>();<NEW_LINE>final String[] localVarAccepts = {};<NEW_LINE>final List<MediaType> <MASK><NEW_LINE>final String[] localVarContentTypes = { "application/json" };<NEW_LINE>final MediaType localVarContentType = apiClient.selectHeaderContentType(localVarContentTypes);<NEW_LINE>String[] localVarAuthNames = new String[] {};<NEW_LINE>ParameterizedTypeReference<Void> localReturnType = new ParameterizedTypeReference<Void>() {<NEW_LINE>};<NEW_LINE>return apiClient.invokeAPI("/fake/body-with-file-schema", HttpMethod.PUT, Collections.<String, Object>emptyMap(), localVarQueryParams, localVarPostBody, localVarHeaderParams, localVarCookieParams, localVarFormParams, localVarAccept, localVarContentType, localVarAuthNames, localReturnType);<NEW_LINE>} | localVarAccept = apiClient.selectHeaderAccept(localVarAccepts); |
507,615 | public <K, V> void assertContainsExactly(AssertionInfo info, Map<K, V> actual, Entry<? extends K, ? extends V>[] entries) {<NEW_LINE>doCommonContainsCheck(info, actual, entries);<NEW_LINE>if (actual.isEmpty() && entries.length == 0)<NEW_LINE>return;<NEW_LINE><MASK><NEW_LINE>assertHasSameSizeAs(info, actual, entries);<NEW_LINE>Set<Entry<? extends K, ? extends V>> notFound = new LinkedHashSet<>();<NEW_LINE>Set<Entry<? extends K, ? extends V>> notExpected = new LinkedHashSet<>();<NEW_LINE>compareActualMapAndExpectedEntries(actual, entries, notExpected, notFound);<NEW_LINE>if (notExpected.isEmpty() && notFound.isEmpty()) {<NEW_LINE>// check entries order<NEW_LINE>int index = 0;<NEW_LINE>for (K keyFromActual : actual.keySet()) {<NEW_LINE>if (!deepEquals(keyFromActual, entries[index].getKey())) {<NEW_LINE>Entry<K, V> actualEntry = entry(keyFromActual, actual.get(keyFromActual));<NEW_LINE>throw failures.failure(info, elementsDifferAtIndex(actualEntry, entries[index], index));<NEW_LINE>}<NEW_LINE>index++;<NEW_LINE>}<NEW_LINE>// all entries are in the same order.<NEW_LINE>return;<NEW_LINE>}<NEW_LINE>throw failures.failure(info, shouldContainExactly(actual, asList(entries), notFound, notExpected));<NEW_LINE>} | failIfEntriesIsEmptySinceActualIsNotEmpty(info, actual, entries); |
1,525,375 | private static Class<?> toBoxedType(Class<?> type) {<NEW_LINE>assert type.isPrimitive();<NEW_LINE>// void cannot be used as a constructor argument in Java<NEW_LINE>assert type != void.class;<NEW_LINE>if (type == boolean.class) {<NEW_LINE>return Boolean.class;<NEW_LINE>} else if (type == byte.class) {<NEW_LINE>return Byte.class;<NEW_LINE>} else if (type == char.class) {<NEW_LINE>return Character.class;<NEW_LINE>} else if (type == double.class) {<NEW_LINE>return Double.class;<NEW_LINE>} else if (type == float.class) {<NEW_LINE>return Float.class;<NEW_LINE>} else if (type == int.class) {<NEW_LINE>return Integer.class;<NEW_LINE>} else if (type == long.class) {<NEW_LINE>return Long.class;<NEW_LINE>} else if (type == short.class) {<NEW_LINE>return Short.class;<NEW_LINE>} else {<NEW_LINE>// should never happen ;-)<NEW_LINE>throw new IllegalArgumentException(<MASK><NEW_LINE>}<NEW_LINE>} | "Unknown primitive type " + type.getName()); |
1,628,429 | public static void initLocked(final ClassLoader classLoader) {<NEW_LINE>//<NEW_LINE>final String IPC = "com.qihoo360.replugin.base.IPC";<NEW_LINE>getCurrentProcessName = new MethodInvoker(classLoader, IPC, "getCurrentProcessName", new Class<?>[] {});<NEW_LINE>getCurrentProcessId = new MethodInvoker(classLoader, IPC, "getCurrentProcessId", new Class<?>[] {});<NEW_LINE>getPersistentProcessName = new MethodInvoker(classLoader, IPC, "getPersistentProcessName", new Class<?>[] {});<NEW_LINE>getPluginHostProcessName = new MethodInvoker(classLoader, IPC, "getPluginHostProcessName", new Class<?>[] {});<NEW_LINE>isPluginHostProcess = new MethodInvoker(classLoader, IPC, "isPluginHostProcess", new Class<?>[] {});<NEW_LINE>isUIProcess = new MethodInvoker(classLoader, IPC, "isUIProcess", new Class<?>[] {});<NEW_LINE>isPersistentProcess = new MethodInvoker(classLoader, IPC, "isPersistentProcess", new Class<?>[] {});<NEW_LINE>isPersistentEnable = new MethodInvoker(classLoader, IPC, "isPersistentEnable", new Class<?>[] {});<NEW_LINE>getPidByProcessName = new MethodInvoker(classLoader, IPC, "getPidByProcessName", new Class<?><MASK><NEW_LINE>getProcessNameByPid = new MethodInvoker(classLoader, IPC, "getProcessNameByPid", new Class<?>[] { int.class });<NEW_LINE>getPackageName = new MethodInvoker(classLoader, IPC, "getPackageName", new Class<?>[] {});<NEW_LINE>sendLocalBroadcast2Plugin = new MethodInvoker(classLoader, IPC, "sendLocalBroadcast2Plugin", new Class<?>[] { Context.class, String.class, Intent.class });<NEW_LINE>sendLocalBroadcast2Process = new MethodInvoker(classLoader, IPC, "sendLocalBroadcast2Process", new Class<?>[] { Context.class, String.class, Intent.class });<NEW_LINE>sendLocalBroadcast2All = new MethodInvoker(classLoader, IPC, "sendLocalBroadcast2All", new Class<?>[] { Context.class, Intent.class });<NEW_LINE>sendLocalBroadcast2PluginSync = new MethodInvoker(classLoader, IPC, "sendLocalBroadcast2PluginSync", new Class<?>[] { Context.class, String.class, Intent.class });<NEW_LINE>sendLocalBroadcast2ProcessSync = new MethodInvoker(classLoader, IPC, "sendLocalBroadcast2ProcessSync", new Class<?>[] { Context.class, String.class, Intent.class });<NEW_LINE>sendLocalBroadcast2AllSync = new MethodInvoker(classLoader, IPC, "sendLocalBroadcast2AllSync", new Class<?>[] { Context.class, Intent.class });<NEW_LINE>} | [] { String.class }); |
1,215,160 | public static void clearCustomMetricDescriptors(MetricServiceSettings settings, String projectId) {<NEW_LINE>try {<NEW_LINE>MetricServiceClient client = MetricServiceClient.create(settings);<NEW_LINE>Iterable<MetricServiceClient.ListMetricDescriptorsPage> listMetricDescriptorsPages = client.listMetricDescriptors(ListMetricDescriptorsRequest.newBuilder().setName("projects/" + projectId).setFilter("metric.type = starts_with(\"custom.googleapis.com/\")").build()).iteratePages();<NEW_LINE>int deleted = 0;<NEW_LINE>for (MetricServiceClient.ListMetricDescriptorsPage page : listMetricDescriptorsPages) {<NEW_LINE>for (MetricDescriptor metricDescriptor : page.getValues()) {<NEW_LINE>System.out.println(<MASK><NEW_LINE>client.deleteMetricDescriptor(metricDescriptor.getName());<NEW_LINE>deleted++;<NEW_LINE>}<NEW_LINE>}<NEW_LINE>System.out.println("Deleted " + deleted + " custom metric descriptors");<NEW_LINE>} catch (IOException e) {<NEW_LINE>throw new UncheckedIOException(e);<NEW_LINE>}<NEW_LINE>} | "deleting " + metricDescriptor.getName()); |
511,767 | protected void consumeEnterAnonymousClassBody(boolean qualified) {<NEW_LINE>// EnterAnonymousClassBody ::= $empty<NEW_LINE>TypeReference typeReference = getTypeReference(0);<NEW_LINE>TypeDeclaration anonymousType = new TypeDeclaration(this.compilationUnit.compilationResult);<NEW_LINE>anonymousType.name = CharOperation.NO_CHAR;<NEW_LINE>anonymousType.bits |= (ASTNode.IsAnonymousType | ASTNode.IsLocalType);<NEW_LINE>anonymousType.bits |= (typeReference.bits & ASTNode.HasTypeAnnotations);<NEW_LINE>QualifiedAllocationExpression alloc = new QualifiedAllocationExpression(anonymousType);<NEW_LINE>markEnclosingMemberWithLocalType();<NEW_LINE>pushOnAstStack(anonymousType);<NEW_LINE>// the position has been stored explicitly<NEW_LINE>alloc.sourceEnd = this.rParenPos;<NEW_LINE>int argumentLength;<NEW_LINE>if ((argumentLength = this.expressionLengthStack[this.expressionLengthPtr--]) != 0) {<NEW_LINE>this.expressionPtr -= argumentLength;<NEW_LINE>System.arraycopy(this.expressionStack, this.expressionPtr + 1, alloc.arguments = new Expression[argumentLength], 0, argumentLength);<NEW_LINE>}<NEW_LINE>if (qualified) {<NEW_LINE>this.expressionLengthPtr--;<NEW_LINE>alloc.enclosingInstance = this.expressionStack[this.expressionPtr--];<NEW_LINE>}<NEW_LINE>alloc.type = typeReference;<NEW_LINE>anonymousType.sourceEnd = alloc.sourceEnd;<NEW_LINE>// position at the type while it impacts the anonymous declaration<NEW_LINE>anonymousType.sourceStart = anonymousType<MASK><NEW_LINE>alloc.sourceStart = this.intStack[this.intPtr--];<NEW_LINE>pushOnExpressionStack(alloc);<NEW_LINE>anonymousType.bodyStart = this.scanner.currentPosition;<NEW_LINE>// will be updated when reading super-interfaces<NEW_LINE>this.listLength = 0;<NEW_LINE>// flush the comments related to the anonymous<NEW_LINE>this.scanner.commentPtr = -1;<NEW_LINE>// recovery<NEW_LINE>if (this.currentElement != null) {<NEW_LINE>this.lastCheckPoint = anonymousType.bodyStart;<NEW_LINE>this.currentElement = this.currentElement.add(anonymousType, 0);<NEW_LINE>if (!(this.currentElement instanceof RecoveredAnnotation)) {<NEW_LINE>if (isIndirectlyInsideLambdaExpression())<NEW_LINE>this.ignoreNextOpeningBrace = true;<NEW_LINE>else<NEW_LINE>// opening brace already taken into account<NEW_LINE>this.currentToken = 0;<NEW_LINE>} else {<NEW_LINE>this.ignoreNextOpeningBrace = true;<NEW_LINE>this.currentElement.bracketBalance++;<NEW_LINE>}<NEW_LINE>this.lastIgnoredToken = -1;<NEW_LINE>}<NEW_LINE>checkForDiamond(typeReference);<NEW_LINE>} | .declarationSourceStart = alloc.type.sourceStart; |
1,125,317 | public GetDelegationsResult unmarshall(JsonUnmarshallerContext context) throws Exception {<NEW_LINE>GetDelegationsResult getDelegationsResult = new GetDelegationsResult();<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 getDelegationsResult;<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("delegations", targetDepth)) {<NEW_LINE>context.nextToken();<NEW_LINE>getDelegationsResult.setDelegations(new ListUnmarshaller<DelegationMetadata>(DelegationMetadataJsonUnmarshaller.getInstance()).unmarshall(context));<NEW_LINE>}<NEW_LINE>if (context.testExpression("nextToken", targetDepth)) {<NEW_LINE>context.nextToken();<NEW_LINE>getDelegationsResult.setNextToken(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 getDelegationsResult;<NEW_LINE>} | class).unmarshall(context)); |
1,620,344 | public ByteBuf encrypt(ByteBuf message, ByteBufAllocator allocator) throws InvalidKeyException, NoSuchPaddingException, NoSuchAlgorithmException, BadPaddingException, ShortBufferException, IllegalBlockSizeException {<NEW_LINE>Cipher cipher = Cipher.getInstance(algorithm);<NEW_LINE>cipher.init(Cipher.ENCRYPT_MODE, secretKeySpec);<NEW_LINE><MASK><NEW_LINE>int messageLength = message.readableBytes();<NEW_LINE>int encMessageLength = cipher.getOutputSize(messageLength);<NEW_LINE>ByteBuf paddedMessage = null;<NEW_LINE>if (!hasPadding && messageLength == encMessageLength && (encMessageLength % blockSize) != 0) {<NEW_LINE>int paddedMessageSize = messageLength + blockSize - (messageLength % blockSize);<NEW_LINE>paddedMessage = allocator.buffer(paddedMessageSize);<NEW_LINE>paddedMessage.setZero(0, paddedMessageSize);<NEW_LINE>paddedMessage.setBytes(0, message, messageLength);<NEW_LINE>paddedMessage.writerIndex(paddedMessageSize);<NEW_LINE>encMessageLength = cipher.getOutputSize(paddedMessageSize);<NEW_LINE>}<NEW_LINE>ByteBuf encMessage = allocator.buffer(encMessageLength);<NEW_LINE>ByteBuffer nioBuffer = encMessage.nioBuffer(0, encMessageLength);<NEW_LINE>cipher.doFinal(paddedMessage == null ? message.nioBuffer() : paddedMessage.nioBuffer(), nioBuffer);<NEW_LINE>encMessage.writerIndex(encMessageLength);<NEW_LINE>if (paddedMessage != null) {<NEW_LINE>paddedMessage.release();<NEW_LINE>}<NEW_LINE>if (isInitializationVectorRequired) {<NEW_LINE>byte[] ivBytes = cipher.getIV();<NEW_LINE>ByteBuf iv = allocator.buffer(1 + ivBytes.length);<NEW_LINE>iv.writeByte(ivBytes.length).writeBytes(ivBytes);<NEW_LINE>return Unpooled.wrappedBuffer(2, iv, encMessage);<NEW_LINE>} else {<NEW_LINE>return encMessage;<NEW_LINE>}<NEW_LINE>} | int blockSize = cipher.getBlockSize(); |
152,332 | public void notifyBlacklistedConnection(ConnectionDescriptor conn) {<NEW_LINE>int uid = conn.uid;<NEW_LINE>AppDescriptor app = appsResolver.get(conn.uid, 0);<NEW_LINE>assert app != null;<NEW_LINE>FilterDescriptor filter = new FilterDescriptor();<NEW_LINE>filter.onlyBlacklisted = true;<NEW_LINE>Intent intent = new Intent(this, ConnectionsActivity.class).putExtra(ConnectionsFragment.FILTER_EXTRA, filter).putExtra(ConnectionsFragment.QUERY_EXTRA, app.getPackageName());<NEW_LINE>PendingIntent pi = PendingIntent.getActivity(this, 0, intent, Utils<MASK><NEW_LINE>String rule_label;<NEW_LINE>if (conn.isBlacklistedHost())<NEW_LINE>rule_label = MatchList.getRuleLabel(this, MatchList.RuleType.HOST, conn.info);<NEW_LINE>else<NEW_LINE>rule_label = MatchList.getRuleLabel(this, MatchList.RuleType.IP, conn.dst_ip);<NEW_LINE>mBlacklistedBuilder.setContentIntent(pi).setWhen(System.currentTimeMillis()).setContentTitle(String.format(getResources().getString(R.string.malicious_connection_app), app.getName())).setContentText(rule_label);<NEW_LINE>Notification notification = mBlacklistedBuilder.build();<NEW_LINE>// Use the UID as the notification ID to group alerts from the same app<NEW_LINE>mHandler.post(() -> NotificationManagerCompat.from(this).notify(uid, notification));<NEW_LINE>} | .getIntentFlags(PendingIntent.FLAG_UPDATE_CURRENT)); |
1,317,467 | private static <T> T wrap(final Object model, final Class<T> modelClass, final Boolean useOldValues) {<NEW_LINE>if (model == null) {<NEW_LINE>return null;<NEW_LINE>}<NEW_LINE>if (modelClass.isInstance(model) && (useOldValues == null || useOldValues == Boolean.FALSE)) {<NEW_LINE>@SuppressWarnings("unchecked")<NEW_LINE>final T modelCasted = (T) model;<NEW_LINE>return modelCasted;<NEW_LINE>}<NEW_LINE>Document document = null;<NEW_LINE>Boolean useOldValuesDefault = null;<NEW_LINE>if (model instanceof Document) {<NEW_LINE>document = (Document) model;<NEW_LINE>useOldValuesDefault = false;<NEW_LINE>} else if (model instanceof IDocumentAware) {<NEW_LINE>document = ((IDocumentAware) model).getDocument();<NEW_LINE>useOldValuesDefault = false;<NEW_LINE>}<NEW_LINE>if (document == null) {<NEW_LINE>final DocumentInterfaceWrapper wrapper = getWrapper(model);<NEW_LINE>if (wrapper != null) {<NEW_LINE>document = wrapper.getDocument();<NEW_LINE>// by default, preserve it<NEW_LINE>useOldValuesDefault = wrapper.isOldValues();<NEW_LINE>}<NEW_LINE>}<NEW_LINE>if (document == null) {<NEW_LINE>throw new AdempiereException("Cannot wrap " + model + " (class:" + model.getClass());<NEW_LINE>}<NEW_LINE>// NOTE: if document is not null then "useOldValuesDefault" shall not be null<NEW_LINE>//<NEW_LINE>// Shall we use old values?<NEW_LINE>final boolean useOldValuesEffective = useOldValues == null ? useOldValuesDefault : useOldValues;<NEW_LINE>//<NEW_LINE>// Check if given interface is compatible with document, i.e.<NEW_LINE>// * interface does not define a Table_Name field<NEW_LINE>// * interface has a Table_Name static field, which is equal with document's Table_Name<NEW_LINE>final String <MASK><NEW_LINE>if (interfaceTableName != null) {<NEW_LINE>final String documentTableName = document.getEntityDescriptor().getTableName();<NEW_LINE>if (!interfaceTableName.equals(documentTableName)) {<NEW_LINE>throw new AdempiereException("Interface " + modelClass + " (tableName=" + interfaceTableName + ") is not compatible with " + document + " (tableName=" + documentTableName + ")");<NEW_LINE>}<NEW_LINE>}<NEW_LINE>@SuppressWarnings("unchecked")<NEW_LINE>final T result = (T) Proxy.newProxyInstance(modelClass.getClassLoader(), new Class<?>[] { modelClass }, new DocumentInterfaceWrapper(document, useOldValuesEffective));<NEW_LINE>return result;<NEW_LINE>} | interfaceTableName = InterfaceWrapperHelper.getTableNameOrNull(modelClass); |
986,879 | static String generateAttributeForMember(Class<?> enclosingClass, Member member) {<NEW_LINE>try {<NEW_LINE>MemberType memberType = getMemberType(member);<NEW_LINE>if (getType(member).isPrimitive()) {<NEW_LINE>return generateSimpleAttribute(enclosingClass.getSimpleName(), PRIMITIVES_TO_WRAPPERS.get(getType(member)).getSimpleName(), member.getName(), memberType);<NEW_LINE>} else if (Iterable.class.isAssignableFrom(getType(member))) {<NEW_LINE>ParameterizedType parameterizedType = getGenericType(member);<NEW_LINE>if (parameterizedType.getActualTypeArguments().length != 1) {<NEW_LINE>throw new UnsupportedOperationException();<NEW_LINE>}<NEW_LINE>Class<?> genericType = (Class<?>) parameterizedType.getActualTypeArguments()[0];<NEW_LINE>return generateMultiValueNullableAttributeForIterable(enclosingClass.getSimpleName(), genericType.getSimpleName(), member.getName(), memberType);<NEW_LINE>} else if (getType(member).isArray()) {<NEW_LINE>if (getType(member).getComponentType().isPrimitive()) {<NEW_LINE>return generateMultiValueNullableAttributeForPrimitiveArray(enclosingClass.getSimpleName(), PRIMITIVES_TO_WRAPPERS.get(getType(member).getComponentType()).getSimpleName(), getType(member).getComponentType().getSimpleName(), member.getName(), memberType);<NEW_LINE>} else {<NEW_LINE>return generateMultiValueNullableAttributeForObjectArray(enclosingClass.getSimpleName(), getType(member).getComponentType().getSimpleName(), <MASK><NEW_LINE>}<NEW_LINE>} else {<NEW_LINE>return generateSimpleNullableAttribute(enclosingClass.getSimpleName(), getType(member).getSimpleName(), member.getName(), memberType);<NEW_LINE>}<NEW_LINE>} catch (Exception e) {<NEW_LINE>return " // *** Note: Could not generate CQEngine attribute automatically for member: " + enclosingClass.getSimpleName() + "." + member.getName() + " ***";<NEW_LINE>}<NEW_LINE>} | member.getName(), memberType); |
249,147 | public PeerComponent createBrowserComponent(Object browserComponent) {<NEW_LINE>synchronized (UiApplication.getEventLock()) {<NEW_LINE>BrowserField bff = new BrowserField();<NEW_LINE>final BrowserComponent cmp = (BrowserComponent) browserComponent;<NEW_LINE>bff.addListener(new BrowserFieldListener() {<NEW_LINE><NEW_LINE>public void documentError(BrowserField browserField, Document document) throws Exception {<NEW_LINE>cmp.fireWebEvent("onError", new ActionEvent(document.getDocumentURI()));<NEW_LINE>super.documentError(browserField, document);<NEW_LINE>}<NEW_LINE><NEW_LINE>public void documentCreated(BrowserField browserField, ScriptEngine scriptEngine, Document document) throws Exception {<NEW_LINE>cmp.fireWebEvent("onStart", new ActionEvent(document.getDocumentURI()));<NEW_LINE>super.<MASK><NEW_LINE>}<NEW_LINE><NEW_LINE>public void documentLoaded(BrowserField browserField, Document document) throws Exception {<NEW_LINE>cmp.fireWebEvent("onLoad", new ActionEvent(document.getDocumentURI()));<NEW_LINE>super.documentLoaded(browserField, document);<NEW_LINE>}<NEW_LINE>});<NEW_LINE>return PeerComponent.create(bff);<NEW_LINE>}<NEW_LINE>} | documentCreated(browserField, scriptEngine, document); |
44,391 | public void restore(BackupInput reader) {<NEW_LINE>listeners = reader.readObject();<NEW_LINE>preparedKeys = reader.readObject();<NEW_LINE>Map<K, MapEntryValue> map = reader.readObject();<NEW_LINE>this.map = createMap();<NEW_LINE>this.map.putAll(map);<NEW_LINE>activeTransactions = reader.readObject();<NEW_LINE>currentVersion = reader.readLong();<NEW_LINE>entryIterators = reader.readObject();<NEW_LINE>// Attempt to read the locks. If a BufferUnderflowException is thrown, that indicates the snapshot is from<NEW_LINE>// a version that did not support locks. Just initialize the locks to an empty map.<NEW_LINE>try {<NEW_LINE>locks = reader.readObject();<NEW_LINE>} catch (BufferUnderflowException e) {<NEW_LINE>locks = Maps.newHashMap();<NEW_LINE>}<NEW_LINE>map.forEach((key, value) -> {<NEW_LINE>if (value.ttl() > 0) {<NEW_LINE>value.timer = getScheduler().schedule(Duration.ofMillis(value.ttl() - (getWallClock().getTime().unixTimestamp() - value.created())), () -> {<NEW_LINE>entries().remove(key, value);<NEW_LINE>publish(new AtomicMapEvent<>(AtomicMapEvent.Type.REMOVE, key, <MASK><NEW_LINE>});<NEW_LINE>}<NEW_LINE>});<NEW_LINE>locks.forEach((key, lock) -> {<NEW_LINE>lock.timers.values().forEach(Scheduled::cancel);<NEW_LINE>lock.timers.clear();<NEW_LINE>for (LockHolder holder : lock.queue) {<NEW_LINE>if (holder.expire > 0) {<NEW_LINE>lock.timers.put(holder.index, getScheduler().schedule(Duration.ofMillis(holder.expire - getWallClock().getTime().unixTimestamp()), () -> {<NEW_LINE>lock.timers.remove(holder.index);<NEW_LINE>lock.queue.remove(holder);<NEW_LINE>Session session = getSession(holder.session);<NEW_LINE>if (session != null && session.getState().active()) {<NEW_LINE>getSession(holder.session).accept(service -> service.failed(key, holder.id));<NEW_LINE>}<NEW_LINE>}));<NEW_LINE>}<NEW_LINE>}<NEW_LINE>});<NEW_LINE>} | null, toVersioned(value))); |
1,007,085 | public GetUserSettingsResponse convertSettings(String smtpAddress, List<UserSettingName> requestedSettings) {<NEW_LINE>GetUserSettingsResponse response = new GetUserSettingsResponse();<NEW_LINE>response.setSmtpAddress(smtpAddress);<NEW_LINE>if (this.getError() != null) {<NEW_LINE>response.setErrorCode(AutodiscoverErrorCode.InternalServerError);<NEW_LINE>response.setErrorMessage(this.getError().getMessage());<NEW_LINE>} else {<NEW_LINE>switch(this.getResponseType()) {<NEW_LINE>case Success:<NEW_LINE>response.setErrorCode(AutodiscoverErrorCode.NoError);<NEW_LINE>response.setErrorMessage("");<NEW_LINE>this.user.convertToUserSettings(requestedSettings, response);<NEW_LINE>this.<MASK><NEW_LINE>this.reportUnsupportedSettings(requestedSettings, response);<NEW_LINE>break;<NEW_LINE>case Error:<NEW_LINE>response.setErrorCode(AutodiscoverErrorCode.InternalServerError);<NEW_LINE>response.setErrorMessage("The Autodiscover service response was invalid.");<NEW_LINE>break;<NEW_LINE>case RedirectAddress:<NEW_LINE>response.setErrorCode(AutodiscoverErrorCode.RedirectAddress);<NEW_LINE>response.setErrorMessage("");<NEW_LINE>response.setRedirectTarget(this.getRedirectTarget());<NEW_LINE>break;<NEW_LINE>case RedirectUrl:<NEW_LINE>response.setErrorCode(AutodiscoverErrorCode.RedirectUrl);<NEW_LINE>response.setErrorMessage("");<NEW_LINE>response.setRedirectTarget(this.getRedirectTarget());<NEW_LINE>break;<NEW_LINE>default:<NEW_LINE>EwsUtilities.ewsAssert(false, "OutlookConfigurationSettings.ConvertSettings", "An unexpected error has occured. " + "This code path should never be reached.");<NEW_LINE>break;<NEW_LINE>}<NEW_LINE>}<NEW_LINE>return response;<NEW_LINE>} | account.convertToUserSettings(requestedSettings, response); |
1,512,118 | public boolean apply(Game game, Ability source) {<NEW_LINE>// Exile enchanted creature and all Auras attached to it.<NEW_LINE>Permanent enchantment = game.getPermanent(source.getSourceId());<NEW_LINE>if (enchantment == null) {<NEW_LINE>enchantment = (Permanent) game.getLastKnownInformation(source.getSourceId(), Zone.BATTLEFIELD);<NEW_LINE>}<NEW_LINE>if (enchantment != null && enchantment.getAttachedTo() != null) {<NEW_LINE>Permanent enchantedCreature = game.getPermanent(enchantment.getAttachedTo());<NEW_LINE>if (enchantedCreature != null) {<NEW_LINE>UUID exileZoneId = UUID.randomUUID();<NEW_LINE>enchantedCreature.moveToExile(exileZoneId, enchantment.getName(), source, game);<NEW_LINE>for (UUID attachementId : enchantedCreature.getAttachments()) {<NEW_LINE>Permanent attachment = game.getPermanent(attachementId);<NEW_LINE>if (attachment != null && filter.match(attachment, game)) {<NEW_LINE>attachment.moveToExile(exileZoneId, enchantment.getName(), source, game);<NEW_LINE>}<NEW_LINE>}<NEW_LINE>if (!(enchantedCreature instanceof Token)) {<NEW_LINE>// At the beginning of the next end step, return that card to the battlefield under its owner's control.<NEW_LINE>// If you do, return the other cards exiled this way to the battlefield under their owners' control attached to that creature<NEW_LINE>AtTheBeginOfNextEndStepDelayedTriggeredAbility delayedAbility = new AtTheBeginOfNextEndStepDelayedTriggeredAbility(new FlickerformReturnEffect(enchantedCreature.getId(), exileZoneId));<NEW_LINE><MASK><NEW_LINE>}<NEW_LINE>return true;<NEW_LINE>}<NEW_LINE>}<NEW_LINE>return false;<NEW_LINE>} | game.addDelayedTriggeredAbility(delayedAbility, source); |
1,831,203 | public static List400PicLinkResponse unmarshall(List400PicLinkResponse list400PicLinkResponse, UnmarshallerContext context) {<NEW_LINE>list400PicLinkResponse.setRequestId(context.stringValue("List400PicLinkResponse.RequestId"));<NEW_LINE>list400PicLinkResponse.setSuccess(context.booleanValue("List400PicLinkResponse.Success"));<NEW_LINE>list400PicLinkResponse.setCode(context.stringValue("List400PicLinkResponse.Code"));<NEW_LINE>list400PicLinkResponse.setMessage(context.stringValue("List400PicLinkResponse.Message"));<NEW_LINE>list400PicLinkResponse.setHttpStatusCode(context.integerValue("List400PicLinkResponse.HttpStatusCode"));<NEW_LINE>List<CorpIdentifyPicDomain> data = new ArrayList<CorpIdentifyPicDomain>();<NEW_LINE>for (int i = 0; i < context.lengthValue("List400PicLinkResponse.Data.Length"); i++) {<NEW_LINE>CorpIdentifyPicDomain corpIdentifyPicDomain = new CorpIdentifyPicDomain();<NEW_LINE>corpIdentifyPicDomain.setPic(context.stringValue<MASK><NEW_LINE>corpIdentifyPicDomain.setLink(context.stringValue("List400PicLinkResponse.Data[" + i + "].Link"));<NEW_LINE>data.add(corpIdentifyPicDomain);<NEW_LINE>}<NEW_LINE>list400PicLinkResponse.setData(data);<NEW_LINE>return list400PicLinkResponse;<NEW_LINE>} | ("List400PicLinkResponse.Data[" + i + "].Pic")); |
1,529,703 | public void globalMutableStateLock() {<NEW_LINE>throwExceptionIfClosed();<NEW_LINE>try {<NEW_LINE>GLOBAL_MUTABLE_STATE_LOCK_ACQUISITION_STRATEGY.acquire(GLOBAL_MUTABLE_STATE_LOCK_TRY_ACQUIRE_OPERATION, GLOBAL_MUTABLE_STATE_LOCKING_STRATEGY, nativeAccess(), null, globalMutableStateAddress() + GLOBAL_MUTABLE_STATE_LOCK_OFFSET);<NEW_LINE>} catch (IllegalStateException ise) {<NEW_LINE>// Todo: This is to provide more info for solving https://github.com/OpenHFT/Chronicle-Map/issues/376<NEW_LINE>final int val = nativeAccess().readInt(null, globalMutableStateAddress() + GLOBAL_MUTABLE_STATE_LOCK_OFFSET);<NEW_LINE>System.err.println("Unable to acquire lock!");<NEW_LINE>System.err.println("Lock value was = " + val);<NEW_LINE>System.err.format("BS address: %xd NTZ: %d%n", bsAddress(), Long.numberOfTrailingZeros(bsAddress()));<NEW_LINE>System.err.format("Lock Address: %xd NTZ: %d%n", globalMutableStateAddress() + GLOBAL_MUTABLE_STATE_LOCK_OFFSET, Long.numberOfTrailingZeros<MASK><NEW_LINE>System.err.println("ByteStore:");<NEW_LINE>System.err.println(bs.bytesForRead().toHexString());<NEW_LINE>System.err.println(bs.toDebugString());<NEW_LINE>final Wire text = new TextWire(Bytes.elasticByteBuffer());<NEW_LINE>writeMarshallable(text);<NEW_LINE>System.err.println(text);<NEW_LINE>throw ise;<NEW_LINE>}<NEW_LINE>} | (globalMutableStateAddress() + GLOBAL_MUTABLE_STATE_LOCK_OFFSET)); |
751,174 | public void run(RegressionEnvironment env) {<NEW_LINE>// test when-then with condition triggered by output events<NEW_LINE>sendTimeEvent(env, 2, <MASK><NEW_LINE>String eplToDeploy = "create variable boolean varOutputTriggered = false\n;" + "@Audit @Name('s0') select * from SupportBean#lastevent output snapshot when (count_insert > 1 and varOutputTriggered = false) then set varOutputTriggered = true;";<NEW_LINE>env.compileDeploy(eplToDeploy).addListener("s0");<NEW_LINE>env.sendEventBean(new SupportBean("E1", 1));<NEW_LINE>env.assertListenerNotInvoked("s0");<NEW_LINE>env.sendEventBean(new SupportBean("E2", 2));<NEW_LINE>env.assertEqualsNew("s0", "theString", "E2");<NEW_LINE>env.sendEventBean(new SupportBean("E3", 3));<NEW_LINE>env.sendEventBean(new SupportBean("E4", 4));<NEW_LINE>env.assertListenerNotInvoked("s0");<NEW_LINE>// turns true right away as triggering output<NEW_LINE>env.runtimeSetVariable("s0", "varOutputTriggered", false);<NEW_LINE>env.sendEventBean(new SupportBean("E5", 5));<NEW_LINE>sendTimeEvent(env, 2, 8, 0, 1, 0);<NEW_LINE>env.assertEqualsNew("s0", "theString", "E5");<NEW_LINE>env.sendEventBean(new SupportBean("E6", 6));<NEW_LINE>env.assertListenerNotInvoked("s0");<NEW_LINE>env.undeployAll();<NEW_LINE>} | 8, 0, 0, 0); |
573,314 | final ListRemoteAccessSessionsResult executeListRemoteAccessSessions(ListRemoteAccessSessionsRequest listRemoteAccessSessionsRequest) {<NEW_LINE>ExecutionContext executionContext = createExecutionContext(listRemoteAccessSessionsRequest);<NEW_LINE><MASK><NEW_LINE>awsRequestMetrics.startEvent(Field.ClientExecuteTime);<NEW_LINE>Request<ListRemoteAccessSessionsRequest> request = null;<NEW_LINE>Response<ListRemoteAccessSessionsResult> response = null;<NEW_LINE>try {<NEW_LINE>awsRequestMetrics.startEvent(Field.RequestMarshallTime);<NEW_LINE>try {<NEW_LINE>request = new ListRemoteAccessSessionsRequestProtocolMarshaller(protocolFactory).marshall(super.beforeMarshalling(listRemoteAccessSessionsRequest));<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, "Device Farm");<NEW_LINE>request.addHandlerContext(HandlerContextKey.OPERATION_NAME, "ListRemoteAccessSessions");<NEW_LINE>request.addHandlerContext(HandlerContextKey.ADVANCED_CONFIG, advancedConfig);<NEW_LINE>} finally {<NEW_LINE>awsRequestMetrics.endEvent(Field.RequestMarshallTime);<NEW_LINE>}<NEW_LINE>HttpResponseHandler<AmazonWebServiceResponse<ListRemoteAccessSessionsResult>> responseHandler = protocolFactory.createResponseHandler(new JsonOperationMetadata().withPayloadJson(true).withHasStreamingSuccessResponse(false), new ListRemoteAccessSessionsResultJsonUnmarshaller());<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,734,567 | public static void main(String[] args) throws Exception {<NEW_LINE>System.setOut(new PrintStream(System.out, true, "UTF-8"));<NEW_LINE>System.setErr(new PrintStream(System.err, true, "UTF-8"));<NEW_LINE>Properties config = StringUtils.argsToProperties(args);<NEW_LINE>checkArgs(config);<NEW_LINE><MASK><NEW_LINE>String trainFiles = config.getProperty(TRAIN_FILE_PROPERTY);<NEW_LINE>String testFiles = config.getProperty(TEST_FILE_PROPERTY);<NEW_LINE>List<TaggedFileRecord> files = TaggedFileRecord.createRecords(config, trainFiles);<NEW_LINE>for (TaggedFileRecord file : files) {<NEW_LINE>cct.countTrainingTags(file);<NEW_LINE>}<NEW_LINE>if (testFiles != null) {<NEW_LINE>files = TaggedFileRecord.createRecords(config, testFiles);<NEW_LINE>for (TaggedFileRecord file : files) {<NEW_LINE>cct.countTestTags(file);<NEW_LINE>}<NEW_LINE>}<NEW_LINE>cct.report();<NEW_LINE>} | CountClosedTags cct = new CountClosedTags(config); |
1,813,318 | ComponentInfo configureProcess() throws IOException {<NEW_LINE>input.existingFiles().setVerifyJars(verifyJars);<NEW_LINE>Version min = input.getLocalRegistry().getGraalVersion();<NEW_LINE>String s = input.peekParameter();<NEW_LINE>Version v = min;<NEW_LINE>Version.Match filter = min.match(allowDistUpgrades() ? Version.Match.Type.MOSTRECENT : Version.Match.Type.COMPATIBLE);<NEW_LINE>if (s != null) {<NEW_LINE>try {<NEW_LINE>Version.Match.Type mt = Version.Match.Type.COMPATIBLE;<NEW_LINE>if (s.startsWith("=")) {<NEW_LINE>mt <MASK><NEW_LINE>s = s.substring(1);<NEW_LINE>} else if (s.startsWith("+")) {<NEW_LINE>mt = Version.Match.Type.INSTALLABLE;<NEW_LINE>s = s.substring(1);<NEW_LINE>}<NEW_LINE>v = Version.fromUserString(s);<NEW_LINE>// cannot just compare user vs. graal, must match the user to the list of Graals to<NEW_LINE>// resolve the<NEW_LINE>// uncertaint parts (-x and possible suffix)<NEW_LINE>filter = v.match(mt);<NEW_LINE>if (min.compareTo(v) > 0) {<NEW_LINE>throw feedback.failure("UPGRADE_CannotDowngrade", null, v.displayString());<NEW_LINE>}<NEW_LINE>input.nextParameter();<NEW_LINE>input.existingFiles().matchVersion(filter);<NEW_LINE>} catch (IllegalArgumentException ex) {<NEW_LINE>// not a version, continue with component upgrade<NEW_LINE>}<NEW_LINE>}<NEW_LINE>// allow dist upgrade when searching for components<NEW_LINE>for (ComponentParam p : input.existingFiles()) {<NEW_LINE>helper.addComponent(p);<NEW_LINE>}<NEW_LINE>ComponentInfo info = helper.findGraalVersion(filter);<NEW_LINE>return info;<NEW_LINE>} | = Version.Match.Type.EXACT; |
1,526,090 | public static GetResult extractGetResult(final UpdateRequest request, String concreteIndex, long seqNo, long primaryTerm, long version, final Map<String, Object> source, XContentType sourceContentType, @Nullable final BytesReference sourceAsBytes) {<NEW_LINE>if (request.fetchSource() == null || request.fetchSource().fetchSource() == false) {<NEW_LINE>return null;<NEW_LINE>}<NEW_LINE>BytesReference sourceFilteredAsBytes = sourceAsBytes;<NEW_LINE>if (request.fetchSource().includes().length > 0 || request.fetchSource().excludes().length > 0) {<NEW_LINE>SourceLookup sourceLookup = new SourceLookup();<NEW_LINE>sourceLookup.setSource(source);<NEW_LINE>Object value = sourceLookup.filter(request.fetchSource());<NEW_LINE>try {<NEW_LINE>final int initialCapacity = Math.min(<MASK><NEW_LINE>BytesStreamOutput streamOutput = new BytesStreamOutput(initialCapacity);<NEW_LINE>try (XContentBuilder builder = new XContentBuilder(sourceContentType.xContent(), streamOutput)) {<NEW_LINE>builder.value(value);<NEW_LINE>sourceFilteredAsBytes = BytesReference.bytes(builder);<NEW_LINE>}<NEW_LINE>} catch (IOException e) {<NEW_LINE>throw new OpenSearchException("Error filtering source", e);<NEW_LINE>}<NEW_LINE>}<NEW_LINE>// TODO when using delete/none, we can still return the source as bytes by generating it (using the sourceContentType)<NEW_LINE>return new GetResult(concreteIndex, request.id(), seqNo, primaryTerm, version, true, sourceFilteredAsBytes, Collections.emptyMap(), Collections.emptyMap());<NEW_LINE>} | 1024, sourceAsBytes.length()); |
44,587 | private Mono<PagedResponse<NotebookWorkspaceInner>> listByDatabaseAccountSinglePageAsync(String resourceGroupName, String accountName, Context context) {<NEW_LINE>if (this.client.getEndpoint() == null) {<NEW_LINE>return Mono.error(new IllegalArgumentException("Parameter this.client.getEndpoint() is required and cannot be null."));<NEW_LINE>}<NEW_LINE>if (this.client.getSubscriptionId() == null) {<NEW_LINE>return Mono.error(new IllegalArgumentException("Parameter this.client.getSubscriptionId() is required and cannot be null."));<NEW_LINE>}<NEW_LINE>if (resourceGroupName == null) {<NEW_LINE>return Mono.error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null."));<NEW_LINE>}<NEW_LINE>if (accountName == null) {<NEW_LINE>return Mono.error(new IllegalArgumentException("Parameter accountName is required and cannot be null."));<NEW_LINE>}<NEW_LINE>final String accept = "application/json";<NEW_LINE>context = <MASK><NEW_LINE>return service.listByDatabaseAccount(this.client.getEndpoint(), this.client.getSubscriptionId(), resourceGroupName, this.client.getApiVersion(), accountName, accept, context).map(res -> new PagedResponseBase<>(res.getRequest(), res.getStatusCode(), res.getHeaders(), res.getValue().value(), null, null));<NEW_LINE>} | this.client.mergeContext(context); |
288,457 | Bag<LinkSite> create(ComponentType ct) {<NEW_LINE>Class<?<MASK><NEW_LINE>Field[] fields = ClassReflection.getDeclaredFields(type);<NEW_LINE>links.clear();<NEW_LINE>for (int i = 0; fields.length > i; i++) {<NEW_LINE>Field f = fields[i];<NEW_LINE>int referenceTypeId = getReferenceTypeId(f);<NEW_LINE>if (referenceTypeId != NULL_REFERENCE && (SKIP != getPolicy(f))) {<NEW_LINE>if (SINGLE_REFERENCE == referenceTypeId) {<NEW_LINE>UniLinkSite ls = new UniLinkSite(world, ct, f);<NEW_LINE>if (!configureMutator(ls))<NEW_LINE>reflexiveMutators.withMutator(ls);<NEW_LINE>links.add(ls);<NEW_LINE>} else if (MULTI_REFERENCE == referenceTypeId) {<NEW_LINE>MultiLinkSite ls = new MultiLinkSite(world, ct, f);<NEW_LINE>if (!configureMutator(ls))<NEW_LINE>reflexiveMutators.withMutator(ls);<NEW_LINE>links.add(ls);<NEW_LINE>}<NEW_LINE>}<NEW_LINE>}<NEW_LINE>return links;<NEW_LINE>} | > type = ct.getType(); |
1,494,019 | public boolean doIWantToQuit(MissionInit missionInit) {<NEW_LINE>this.quitCode = "";<NEW_LINE>List<Entity> caughtEntities = RewardForCatchingMobImplementation.getCaughtEntities();<NEW_LINE>for (Entity ent : caughtEntities) {<NEW_LINE>// Do we care about this entity?<NEW_LINE>for (MobWithDescription mob : this.qcmparams.getMob()) {<NEW_LINE>for (EntityTypes et : mob.getType()) {<NEW_LINE>if (et.value().equals(ent.getName())) {<NEW_LINE>if (!mob.isGlobal()) {<NEW_LINE>// If global flag is false, our player needs to be adjacent to the mob in order to claim the reward.<NEW_LINE>BlockPos entityPos = new BlockPos(ent.posX, ent.posY, ent.posZ);<NEW_LINE>EntityPlayerSP player = Minecraft.getMinecraft().player;<NEW_LINE>BlockPos playerPos = new BlockPos(player.posX, player.posY, player.posZ);<NEW_LINE>if (Math.abs(entityPos.getX() - playerPos.getX()) + Math.abs(entityPos.getZ() - playerPos.getZ()) > 1)<NEW_LINE>continue;<NEW_LINE>}<NEW_LINE>this<MASK><NEW_LINE>return true;<NEW_LINE>}<NEW_LINE>}<NEW_LINE>}<NEW_LINE>}<NEW_LINE>return false;<NEW_LINE>} | .quitCode = mob.getDescription(); |
1,217,521 | public void loadDynamicClasses() {<NEW_LINE>final ArrayList<SootClass> dynamicClasses = new ArrayList<>();<NEW_LINE>final Options opts = Options.v();<NEW_LINE>final Map<String, List<String>> temp = new HashMap<>();<NEW_LINE>temp.put(<MASK><NEW_LINE>final ModulePathSourceLocator msloc = ModulePathSourceLocator.v();<NEW_LINE>for (String path : opts.dynamic_dir()) {<NEW_LINE>temp.putAll(msloc.getClassUnderModulePath(path));<NEW_LINE>}<NEW_LINE>final SourceLocator sloc = SourceLocator.v();<NEW_LINE>for (String pkg : opts.dynamic_package()) {<NEW_LINE>temp.get(null).addAll(sloc.classesInDynamicPackage(pkg));<NEW_LINE>}<NEW_LINE>for (Map.Entry<String, List<String>> entry : temp.entrySet()) {<NEW_LINE>for (String className : entry.getValue()) {<NEW_LINE>dynamicClasses.add(loadClassAndSupport(className, Optional.fromNullable(entry.getKey())));<NEW_LINE>}<NEW_LINE>}<NEW_LINE>// remove non-concrete classes that may accidentally have been loaded<NEW_LINE>for (Iterator<SootClass> iterator = dynamicClasses.iterator(); iterator.hasNext(); ) {<NEW_LINE>SootClass c = iterator.next();<NEW_LINE>if (!c.isConcrete()) {<NEW_LINE>if (opts.verbose()) {<NEW_LINE>logger.warn("dynamic class " + c.getName() + " is abstract or an interface, and it will not be considered.");<NEW_LINE>}<NEW_LINE>iterator.remove();<NEW_LINE>}<NEW_LINE>}<NEW_LINE>this.dynamicClasses = dynamicClasses;<NEW_LINE>} | null, opts.dynamic_class()); |
1,167,368 | public static DescribeDcdnUserResourcePackageResponse unmarshall(DescribeDcdnUserResourcePackageResponse describeDcdnUserResourcePackageResponse, UnmarshallerContext _ctx) {<NEW_LINE>describeDcdnUserResourcePackageResponse.setRequestId(_ctx.stringValue("DescribeDcdnUserResourcePackageResponse.RequestId"));<NEW_LINE>List<ResourcePackageInfo> resourcePackageInfos <MASK><NEW_LINE>for (int i = 0; i < _ctx.lengthValue("DescribeDcdnUserResourcePackageResponse.ResourcePackageInfos.Length"); i++) {<NEW_LINE>ResourcePackageInfo resourcePackageInfo = new ResourcePackageInfo();<NEW_LINE>resourcePackageInfo.setCurrCapacity(_ctx.stringValue("DescribeDcdnUserResourcePackageResponse.ResourcePackageInfos[" + i + "].CurrCapacity"));<NEW_LINE>resourcePackageInfo.setInitCapacity(_ctx.stringValue("DescribeDcdnUserResourcePackageResponse.ResourcePackageInfos[" + i + "].InitCapacity"));<NEW_LINE>resourcePackageInfo.setCommodityCode(_ctx.stringValue("DescribeDcdnUserResourcePackageResponse.ResourcePackageInfos[" + i + "].CommodityCode"));<NEW_LINE>resourcePackageInfo.setDisplayName(_ctx.stringValue("DescribeDcdnUserResourcePackageResponse.ResourcePackageInfos[" + i + "].DisplayName"));<NEW_LINE>resourcePackageInfo.setTemplateName(_ctx.stringValue("DescribeDcdnUserResourcePackageResponse.ResourcePackageInfos[" + i + "].TemplateName"));<NEW_LINE>resourcePackageInfo.setInstanceId(_ctx.stringValue("DescribeDcdnUserResourcePackageResponse.ResourcePackageInfos[" + i + "].InstanceId"));<NEW_LINE>resourcePackageInfo.setStatus(_ctx.stringValue("DescribeDcdnUserResourcePackageResponse.ResourcePackageInfos[" + i + "].Status"));<NEW_LINE>resourcePackageInfo.setStartTime(_ctx.stringValue("DescribeDcdnUserResourcePackageResponse.ResourcePackageInfos[" + i + "].StartTime"));<NEW_LINE>resourcePackageInfo.setEndTime(_ctx.stringValue("DescribeDcdnUserResourcePackageResponse.ResourcePackageInfos[" + i + "].EndTime"));<NEW_LINE>resourcePackageInfos.add(resourcePackageInfo);<NEW_LINE>}<NEW_LINE>describeDcdnUserResourcePackageResponse.setResourcePackageInfos(resourcePackageInfos);<NEW_LINE>return describeDcdnUserResourcePackageResponse;<NEW_LINE>} | = new ArrayList<ResourcePackageInfo>(); |
119,494 | public boolean apply(Game game, Ability source) {<NEW_LINE>List<UUID> attackers = game.getCombat().getAttackers();<NEW_LINE>for (UUID attackerId : attackers) {<NEW_LINE>Permanent creature = game.getPermanent(attackerId);<NEW_LINE>if (creature != null) {<NEW_LINE>creature.removeFromCombat(game);<NEW_LINE>creature.untap(game);<NEW_LINE>}<NEW_LINE>}<NEW_LINE>if (!attackers.isEmpty()) {<NEW_LINE>Phase phase = game.getTurn().getPhase();<NEW_LINE>game.getState().getTurnMods().add(new TurnMod(game.getActivePlayerId(), TurnPhase<MASK><NEW_LINE>ContinuousEffect effect = new IllusionistsGambitRequirementEffect(attackers, phase);<NEW_LINE>game.addEffect(effect, source);<NEW_LINE>effect = new IllusionistsGambitRestrictionEffect(attackers, phase);<NEW_LINE>game.addEffect(effect, source);<NEW_LINE>}<NEW_LINE>return true;<NEW_LINE>} | .COMBAT, null, false)); |
52,146 | public final ResultList<Location> listPrefixesAfter(Fields fields, String fqn, int limitParam, String after) throws IOException {<NEW_LINE>String service = EntityUtil.splitFQN(fqn)[0];<NEW_LINE>// forward scrolling, if after == null then first page is being asked<NEW_LINE>List<String> jsons = daoCollection.locationDAO().listPrefixesAfter(daoCollection.locationDAO().getTableName(), daoCollection.locationDAO().getNameColumn(), fqn, service, limitParam + 1, after == null ? "" : RestUtil.decodeCursor(after));<NEW_LINE>List<Location> entities = new ArrayList<>();<NEW_LINE>for (String json : jsons) {<NEW_LINE>entities.add(setFields(JsonUtils.readValue(json, Location.class), fields));<NEW_LINE>}<NEW_LINE>int total = daoCollection.locationDAO().listPrefixesCount(daoCollection.locationDAO().getTableName(), daoCollection.locationDAO().<MASK><NEW_LINE>String beforeCursor;<NEW_LINE>String afterCursor = null;<NEW_LINE>beforeCursor = after == null ? null : getFullyQualifiedName(entities.get(0));<NEW_LINE>if (entities.size() > limitParam) {<NEW_LINE>// If extra result exists, then next page exists - return after cursor<NEW_LINE>entities.remove(limitParam);<NEW_LINE>afterCursor = getFullyQualifiedName(entities.get(limitParam - 1));<NEW_LINE>}<NEW_LINE>return getResultList(entities, beforeCursor, afterCursor, total);<NEW_LINE>} | getNameColumn(), fqn, service); |
731,056 | public void onChapterLoadSuccess(List<Chapter> list) {<NEW_LINE>hideProgressBar();<NEW_LINE>if (mPresenter.getComic().getTitle() != null && mPresenter.getComic().getCover() != null) {<NEW_LINE>mDetailAdapter.clear();<NEW_LINE>mDetailAdapter.addAll(list);<NEW_LINE>mDetailAdapter.notifyDataSetChanged();<NEW_LINE>}<NEW_LINE>if (App.getPreferenceManager().getBoolean(PreferenceManager.PREF_OTHER_FIREBASE_EVENT, true)) {<NEW_LINE>Bundle bundle = new Bundle();<NEW_LINE>bundle.putString(FirebaseAnalytics.Param.CONTENT, mPresenter.getComic().getTitle());<NEW_LINE>bundle.putString(FirebaseAnalytics.Param.CONTENT_TYPE, "Title");<NEW_LINE>bundle.putInt(FirebaseAnalytics.Param.SOURCE, mPresenter.getComic().getSource());<NEW_LINE>bundle.putBoolean(FirebaseAnalytics.Param.SUCCESS, true);<NEW_LINE>FirebaseAnalytics mFirebaseAnalytics = FirebaseAnalytics.getInstance(this);<NEW_LINE>mFirebaseAnalytics.logEvent(<MASK><NEW_LINE>}<NEW_LINE>} | FirebaseAnalytics.Event.VIEW_ITEM, bundle); |
1,134,323 | private void refresh() {<NEW_LINE>if (requestProcessor == null)<NEW_LINE>requestProcessor = new RequestProcessor("SelectedNodesScheduler");<NEW_LINE>requestProcessor.post(new Runnable() {<NEW_LINE><NEW_LINE>public void run() {<NEW_LINE>final Node[] nodes = TopComponent.getRegistry().getActivatedNodes();<NEW_LINE>if (nodes.length == 1) {<NEW_LINE>final DataObject dataObject = nodes[0].getLookup().lookup(DataObject.class);<NEW_LINE>if (dataObject != null && dataObject.isValid()) {<NEW_LINE>final <MASK><NEW_LINE>if (fileObject.isValid() && ParserManager.canBeParsed(fileObject.getMIMEType())) {<NEW_LINE>final Source source = Source.create(fileObject);<NEW_LINE>if (source != null) {<NEW_LINE>schedule(source, new SchedulerEvent(SelectedNodesScheduler.this) {<NEW_LINE>});<NEW_LINE>return;<NEW_LINE>}<NEW_LINE>}<NEW_LINE>}<NEW_LINE>}<NEW_LINE>schedule(null, null);<NEW_LINE>}<NEW_LINE>});<NEW_LINE>} | FileObject fileObject = dataObject.getPrimaryFile(); |
651,767 | protected void addPatchEntry(int index, java.util.function.Consumer<Value> cb) {<NEW_LINE>assert (index > 0);<NEW_LINE>//<NEW_LINE>// Check if we have already unmarshalled the instance. If that's the case,<NEW_LINE>// just invoke the callback and we're done.<NEW_LINE>//<NEW_LINE>Value <MASK><NEW_LINE>if (obj != null) {<NEW_LINE>cb.accept(obj);<NEW_LINE>return;<NEW_LINE>}<NEW_LINE>if (// Lazy initialization<NEW_LINE>_patchMap == null) {<NEW_LINE>_patchMap = new java.util.TreeMap<>();<NEW_LINE>}<NEW_LINE>//<NEW_LINE>// Add patch entry if the instance isn't unmarshaled yet,<NEW_LINE>// the callback will be called when the instance is<NEW_LINE>// unmarshaled.<NEW_LINE>//<NEW_LINE>java.util.LinkedList<java.util.function.Consumer<Value>> l = _patchMap.get(index);<NEW_LINE>if (l == null) {<NEW_LINE>//<NEW_LINE>// We have no outstanding instances to be patched for this<NEW_LINE>// index, so make a new entry in the patch map.<NEW_LINE>//<NEW_LINE>l = new java.util.LinkedList<>();<NEW_LINE>_patchMap.put(index, l);<NEW_LINE>}<NEW_LINE>//<NEW_LINE>// Append a patch entry for this instance.<NEW_LINE>//<NEW_LINE>l.add(cb);<NEW_LINE>} | obj = _unmarshaledMap.get(index); |
680,501 | public void handle(UpgradeHttpMessage message) {<NEW_LINE>HttpMessage httpMsg = (HttpMessage) message.getObjectParam("message");<NEW_LINE>// Package downloading is time-consuming task, so use 1+n queue to execute it.<NEW_LINE>I1NQueueWorker queueWorker = this.get1NQueueWorkerMgr().getQueueWorker(this.feature, UpgradeConstants.UPGRADE_1N_QUEUE_NAME);<NEW_LINE>if (queueWorker == null) {<NEW_LINE>if (log.isTraceEnable()) {<NEW_LINE>log.warn(this, "Download 1N queue does not exit, so ignore this download request");<NEW_LINE>}<NEW_LINE>httpMsg.putResponseBodyInString("Internal error: 1N queue worker doese not exist", 500, "UTF-8");<NEW_LINE>return;<NEW_LINE>}<NEW_LINE>String baseDir = this.getConfigManager().getFeatureConfiguration(feature, "download.dir");<NEW_LINE>String target = <MASK><NEW_LINE>String software = httpMsg.getParameter(UpgradeConstants.DOWNLOAD_TARGET_SOFTWARE);<NEW_LINE>if ("list".equalsIgnoreCase(target)) {<NEW_LINE>// get the list of upgrade package<NEW_LINE>handleListFileRequest(baseDir, software, httpMsg);<NEW_LINE>return;<NEW_LINE>} else if ("listdir".equalsIgnoreCase(target)) {<NEW_LINE>handleListDirRequest(baseDir, httpMsg);<NEW_LINE>return;<NEW_LINE>}<NEW_LINE>int downloadThreshold = DataConvertHelper.toInt(this.getConfigManager().getFeatureConfiguration(this.feature, "download.threshold"), 10);<NEW_LINE>synchronized (this) {<NEW_LINE>if (log.isTraceEnable()) {<NEW_LINE>log.info(this, "Current download 1+N worker has " + queueWorker.getActiveCount() + " working tasks");<NEW_LINE>}<NEW_LINE>if (queueWorker.getActiveCount() >= downloadThreshold) {<NEW_LINE>httpMsg.putResponseBodyInString("Too Many Requests", UpgradeConstants.HTTP_CODE_TOO_MANY_REQUESTS, "UTF-8");<NEW_LINE>return;<NEW_LINE>}<NEW_LINE>Abstract1NTask task = new UpgradeDownloadTask(cName, feature, httpMsg);<NEW_LINE>queueWorker.put(task);<NEW_LINE>}<NEW_LINE>} | httpMsg.getParameter(UpgradeConstants.DOWNLOAD_REQUEST_PARAM_KEY); |
811,895 | public void execute() throws ResourceUnavailableException, InsufficientCapacityException, ServerApiException, ConcurrentOperationException, ResourceAllocationException, NetworkRuleConflictException {<NEW_LINE>if (getAccountType() == null && getRoleId() == null) {<NEW_LINE>throw new ServerApiException(ApiErrorCode.PARAM_ERROR, "Both account type and role ID are not provided");<NEW_LINE>}<NEW_LINE>List<LdapUser> users;<NEW_LINE>try {<NEW_LINE>if (StringUtils.isNotBlank(groupName)) {<NEW_LINE>users = _ldapManager.getUsersInGroup(groupName, domainId);<NEW_LINE>} else {<NEW_LINE><MASK><NEW_LINE>}<NEW_LINE>} catch (NoLdapUserMatchingQueryException ex) {<NEW_LINE>users = new ArrayList<LdapUser>();<NEW_LINE>s_logger.info("No Ldap user matching query. " + " ::: " + ex.getMessage());<NEW_LINE>}<NEW_LINE>List<LdapUser> addedUsers = new ArrayList<LdapUser>();<NEW_LINE>for (LdapUser user : users) {<NEW_LINE>Domain domain = getDomain(user);<NEW_LINE>try {<NEW_LINE>createCloudstackUserAccount(user, getAccountName(user), domain);<NEW_LINE>addedUsers.add(user);<NEW_LINE>} catch (InvalidParameterValueException ex) {<NEW_LINE>s_logger.error("Failed to create user with username: " + user.getUsername() + " ::: " + ex.getMessage());<NEW_LINE>}<NEW_LINE>}<NEW_LINE>ListResponse<LdapUserResponse> response = new ListResponse<LdapUserResponse>();<NEW_LINE>response.setResponses(createLdapUserResponse(addedUsers));<NEW_LINE>response.setResponseName(getCommandName());<NEW_LINE>setResponseObject(response);<NEW_LINE>} | users = _ldapManager.getUsers(domainId); |
1,779,519 | public static <ReturnType> ReturnType dispatchWithExceptionHandling(@Nullable final Account account, final String pluginNames, final Callable<PluginDispatcherReturnType<ReturnType>> callable, final PluginDispatcher<ReturnType> pluginDispatcher) throws PaymentApiException {<NEW_LINE>final UUID accountId = account != null ? account.getId() : null;<NEW_LINE>final String accountExternalKey = account != null ? account.getExternalKey() : "";<NEW_LINE>try {<NEW_LINE>log.debug("Calling plugin(s) {}", pluginNames);<NEW_LINE>final ReturnType result = pluginDispatcher.dispatchWithTimeout(callable);<NEW_LINE>log.debug("Successful plugin(s) call of {} for account {} with result {}", pluginNames, accountExternalKey, result);<NEW_LINE>return result;<NEW_LINE>} catch (final TimeoutException e) {<NEW_LINE>final String errorMessage = String.format("Call TIMEOUT for accountId='%s' accountExternalKey='%s' plugin='%s'", accountId, accountExternalKey, pluginNames);<NEW_LINE>log.warn(errorMessage);<NEW_LINE>throw new PaymentApiException(ErrorCode.PAYMENT_PLUGIN_TIMEOUT, accountId, errorMessage);<NEW_LINE>} catch (final InterruptedException e) {<NEW_LINE>Thread.currentThread().interrupt();<NEW_LINE>final String errorMessage = String.format("Call was interrupted for accountId='%s' accountExternalKey='%s' plugin='%s'", accountId, accountExternalKey, pluginNames);<NEW_LINE>log.warn(errorMessage, e);<NEW_LINE>throw new PaymentApiException(ErrorCode.PAYMENT_INTERNAL_ERROR, MoreObjects.firstNonNull(e.getMessage(), errorMessage));<NEW_LINE>} catch (final ExecutionException e) {<NEW_LINE>if (e.getCause() instanceof PaymentApiException) {<NEW_LINE>throw (PaymentApiException) e.getCause();<NEW_LINE>} else if (e.getCause() instanceof LockFailedException) {<NEW_LINE>final String format = String.format("Failed to lock accountExternalKey='%s'", accountExternalKey);<NEW_LINE>log.warn(format);<NEW_LINE>throw new <MASK><NEW_LINE>} else {<NEW_LINE>// Unwraps the ExecutionException (e.getCause()), since it's a dispatch implementation detail<NEW_LINE>throw new PaymentApiException(e.getCause(), ErrorCode.PAYMENT_INTERNAL_ERROR, MoreObjects.firstNonNull(e.getMessage(), ""));<NEW_LINE>}<NEW_LINE>}<NEW_LINE>} | PaymentApiException(ErrorCode.PAYMENT_INTERNAL_ERROR, format); |
555,300 | public String decryptItem(JSONObject encryptedItem, KeyStore.SecretKeyEntry secretKeyEntry) throws GeneralSecurityException, JSONException {<NEW_LINE>String ciphertext = encryptedItem.getString(CIPHERTEXT_PROPERTY);<NEW_LINE>String ivString = encryptedItem.getString(IV_PROPERTY);<NEW_LINE>int authenticationTagLength = encryptedItem.getInt(GCM_AUTHENTICATION_TAG_LENGTH_PROPERTY);<NEW_LINE>byte[] ciphertextBytes = Base64.decode(ciphertext, Base64.DEFAULT);<NEW_LINE>byte[] ivBytes = Base64.decode(ivString, Base64.DEFAULT);<NEW_LINE>GCMParameterSpec gcmSpec = new GCMParameterSpec(authenticationTagLength, ivBytes);<NEW_LINE>Cipher <MASK><NEW_LINE>cipher.init(Cipher.DECRYPT_MODE, secretKeyEntry.getSecretKey(), gcmSpec);<NEW_LINE>byte[] plaintextBytes = cipher.doFinal(ciphertextBytes);<NEW_LINE>return new String(plaintextBytes, StandardCharsets.UTF_8);<NEW_LINE>} | cipher = Cipher.getInstance(AES_CIPHER); |
389,797 | private static URL extractURL(HttpServletRequest request) {<NEW_LINE>String urlString;<NEW_LINE>String <MASK><NEW_LINE>if (refererHeader != null) {<NEW_LINE>if (OpenAPIUtils.isEventEnabled(tc)) {<NEW_LINE>Tr.event(tc, "Using referer header to generate servers: " + refererHeader);<NEW_LINE>}<NEW_LINE>refererHeader = refererHeader.endsWith("/") ? refererHeader.substring(0, refererHeader.length() - 1) : refererHeader;<NEW_LINE>if (!refererHeader.endsWith("/ui") && !refererHeader.endsWith("/openapi")) {<NEW_LINE>refererHeader = null;<NEW_LINE>}<NEW_LINE>if (refererHeader != null) {<NEW_LINE>urlString = refererHeader;<NEW_LINE>} else {<NEW_LINE>// fall back to using request url<NEW_LINE>urlString = request.getRequestURL().toString();<NEW_LINE>}<NEW_LINE>} else {<NEW_LINE>urlString = request.getRequestURL().toString();<NEW_LINE>if (OpenAPIUtils.isEventEnabled(tc)) {<NEW_LINE>Tr.event(tc, "Using request url to generate servers: " + urlString);<NEW_LINE>}<NEW_LINE>}<NEW_LINE>URL url = null;<NEW_LINE>try {<NEW_LINE>url = new URL(urlString);<NEW_LINE>} catch (MalformedURLException e) {<NEW_LINE>if (OpenAPIUtils.isEventEnabled(tc)) {<NEW_LINE>Tr.event(tc, "Failed to create URL for " + urlString + ": " + e.getMessage());<NEW_LINE>}<NEW_LINE>}<NEW_LINE>return url;<NEW_LINE>} | refererHeader = request.getHeader(HTTP_HEADER_REFERER); |
722,238 | public static void convertBgp(BgpProcess bgpProcess, Configuration c, Warnings w) {<NEW_LINE>long as = bgpProcess.getAsEffective();<NEW_LINE>if (as == 0L) {<NEW_LINE>// this is the standard way to disable BGP in FortiOS<NEW_LINE>return;<NEW_LINE>} else if (as == 65535L || as == 4294967295L) {<NEW_LINE>w.redFlag(String.format("Ignoring BGP process: AS %s is proscribed by RFC 7300", as));<NEW_LINE>return;<NEW_LINE>}<NEW_LINE>// TODO Infer router-id if not explicitly configured<NEW_LINE>Ip routerId = bgpProcess.getRouterId();<NEW_LINE>if (routerId == null) {<NEW_LINE>w.redFlag("Ignoring BGP process: No router ID configured");<NEW_LINE>return;<NEW_LINE>}<NEW_LINE>List<PrefixSpace> originatedSpaces = generateCommonBgpExportPolicyAndGetOriginatedSpaces(bgpProcess, c);<NEW_LINE>Map<Ip, Interface> updateSources = new HashMap<>();<NEW_LINE>Map<String, Set<Ip>> neighborsByVrf = new HashMap<>();<NEW_LINE>for (BgpNeighbor neighbor : bgpProcess.getNeighbors().values()) {<NEW_LINE>Optional<Interface> updateSource = <MASK><NEW_LINE>if (!updateSource.isPresent()) {<NEW_LINE>w.redFlag(String.format("Ignoring BGP neighbor %s: Unable to infer its update source", neighbor.getIp()));<NEW_LINE>continue;<NEW_LINE>}<NEW_LINE>updateSources.put(neighbor.getIp(), updateSource.get());<NEW_LINE>neighborsByVrf.computeIfAbsent(updateSource.get().getVrfName(), k -> new HashSet<>()).add(neighbor.getIp());<NEW_LINE>}<NEW_LINE>for (Map.Entry<String, Set<Ip>> e : neighborsByVrf.entrySet()) {<NEW_LINE>convertBgpProcessForVrf(bgpProcess, routerId, e.getKey(), e.getValue(), updateSources, originatedSpaces, c, w);<NEW_LINE>}<NEW_LINE>} | getUpdateSource(neighbor, c, w); |
1,146,977 | private void placeBlockSimple(BlockPos pos) {<NEW_LINE>Direction side = null;<NEW_LINE>Direction[] sides = Direction.values();<NEW_LINE>Vec3d eyesPos = RotationUtils.getEyesPos();<NEW_LINE>Vec3d posVec = Vec3d.ofCenter(pos);<NEW_LINE>double distanceSqPosVec = eyesPos.squaredDistanceTo(posVec);<NEW_LINE>Vec3d[] hitVecs <MASK><NEW_LINE>for (int i = 0; i < sides.length; i++) hitVecs[i] = posVec.add(Vec3d.of(sides[i].getVector()).multiply(0.5));<NEW_LINE>for (int i = 0; i < sides.length; i++) {<NEW_LINE>// check if neighbor can be right clicked<NEW_LINE>BlockPos neighbor = pos.offset(sides[i]);<NEW_LINE>if (!BlockUtils.canBeClicked(neighbor))<NEW_LINE>continue;<NEW_LINE>// check line of sight<NEW_LINE>BlockState neighborState = BlockUtils.getState(neighbor);<NEW_LINE>VoxelShape neighborShape = neighborState.getOutlineShape(MC.world, neighbor);<NEW_LINE>if (MC.world.raycastBlock(eyesPos, hitVecs[i], neighbor, neighborShape, neighborState) != null)<NEW_LINE>continue;<NEW_LINE>side = sides[i];<NEW_LINE>break;<NEW_LINE>}<NEW_LINE>if (side == null)<NEW_LINE>for (int i = 0; i < sides.length; i++) {<NEW_LINE>// check if neighbor can be right clicked<NEW_LINE>if (!BlockUtils.canBeClicked(pos.offset(sides[i])))<NEW_LINE>continue;<NEW_LINE>// check if side is facing away from player<NEW_LINE>if (distanceSqPosVec > eyesPos.squaredDistanceTo(hitVecs[i]))<NEW_LINE>continue;<NEW_LINE>side = sides[i];<NEW_LINE>break;<NEW_LINE>}<NEW_LINE>if (side == null)<NEW_LINE>return;<NEW_LINE>Vec3d hitVec = hitVecs[side.ordinal()];<NEW_LINE>// face block<NEW_LINE>// WURST.getRotationFaker().faceVectorPacket(hitVec);<NEW_LINE>// if(RotationUtils.getAngleToLastReportedLookVec(hitVec) > 1)<NEW_LINE>// return;<NEW_LINE>// check timer<NEW_LINE>// if(IMC.getItemUseCooldown() > 0)<NEW_LINE>// return;<NEW_LINE>// place block<NEW_LINE>IMC.getInteractionManager().rightClickBlock(pos.offset(side), side.getOpposite(), hitVec);<NEW_LINE>// swing arm<NEW_LINE>MC.player.networkHandler.sendPacket(new HandSwingC2SPacket(Hand.MAIN_HAND));<NEW_LINE>// reset timer<NEW_LINE>IMC.setItemUseCooldown(4);<NEW_LINE>} | = new Vec3d[sides.length]; |
1,848,397 | private int doSerialTasksWithRate() throws Exception {<NEW_LINE>initTasksArray();<NEW_LINE>long delayStep = (perMin ? 60000 : 1000) / rate;<NEW_LINE>long nextStartTime = System.currentTimeMillis();<NEW_LINE>int count = 0;<NEW_LINE>final long t0 = System.currentTimeMillis();<NEW_LINE>for (int k = 0; (repetitions == REPEAT_EXHAUST && !exhausted) || k < repetitions; k++) {<NEW_LINE>if (stopNow) {<NEW_LINE>break;<NEW_LINE>}<NEW_LINE>for (int l = 0; l < tasksArray.length; l++) {<NEW_LINE>final PerfTask task = tasksArray[l];<NEW_LINE>while (!stopNow) {<NEW_LINE>long waitMore = nextStartTime - System.currentTimeMillis();<NEW_LINE>if (waitMore > 0) {<NEW_LINE>// TODO: better to use condition to notify<NEW_LINE>Thread.sleep(1);<NEW_LINE>} else {<NEW_LINE>break;<NEW_LINE>}<NEW_LINE>}<NEW_LINE>if (stopNow) {<NEW_LINE>break;<NEW_LINE>}<NEW_LINE>// this aims at avarage rate.<NEW_LINE>nextStartTime += delayStep;<NEW_LINE>try {<NEW_LINE>final int inc = task.runAndMaybeStats(letChildReport);<NEW_LINE>count += inc;<NEW_LINE>if (countsByTime != null) {<NEW_LINE>final int slot = (int) ((System.currentTimeMillis() - t0) / logByTimeMsec);<NEW_LINE>if (slot >= countsByTime.length) {<NEW_LINE>countsByTime = ArrayUtil.<MASK><NEW_LINE>}<NEW_LINE>countsByTime[slot] += inc;<NEW_LINE>}<NEW_LINE>if (anyExhaustibleTasks)<NEW_LINE>updateExhausted(task);<NEW_LINE>} catch (@SuppressWarnings("unused") NoMoreDataException e) {<NEW_LINE>exhausted = true;<NEW_LINE>}<NEW_LINE>}<NEW_LINE>}<NEW_LINE>stopNow = false;<NEW_LINE>return count;<NEW_LINE>} | grow(countsByTime, 1 + slot); |
1,481,111 | protected void onNewIntent(Intent intent) {<NEW_LINE>super.onNewIntent(intent);<NEW_LINE>Log_OC.d(TAG, "onNewIntent()");<NEW_LINE>if (intent.getBooleanExtra(FirstRunActivity.EXTRA_EXIT, false)) {<NEW_LINE>super.finish();<NEW_LINE>}<NEW_LINE>onlyAdd = intent.getBooleanExtra(KEY_ONLY_ADD, false) || checkIfViaSSO(intent);<NEW_LINE>// Passcode<NEW_LINE>passCodeManager.onActivityStarted(this);<NEW_LINE>Uri data = intent.getData();<NEW_LINE>if (data != null && data.toString().startsWith(getString(R.string.login_data_own_scheme))) {<NEW_LINE>if (!getResources().getBoolean(R.bool.multiaccount_support) && accountManager.getAccounts().length == 1) {<NEW_LINE>Toast.makeText(this, R.string.no_mutliple_accounts_allowed, Toast.LENGTH_LONG).show();<NEW_LINE>finish();<NEW_LINE>return;<NEW_LINE>} else {<NEW_LINE><MASK><NEW_LINE>}<NEW_LINE>}<NEW_LINE>if (intent.getBooleanExtra(EXTRA_USE_PROVIDER_AS_WEBLOGIN, false)) {<NEW_LINE>accountSetupWebviewBinding = AccountSetupWebviewBinding.inflate(getLayoutInflater());<NEW_LINE>setContentView(accountSetupWebviewBinding.getRoot());<NEW_LINE>initWebViewLogin(getString(R.string.provider_registration_server), true);<NEW_LINE>}<NEW_LINE>} | parseAndLoginFromWebView(data.toString()); |
1,593,139 | static void writeUnraisable(VirtualFrame frame, PBaseException exception, String message, Object object, @Cached PyObjectLookupAttr lookup, @Cached CallNode callNode, @Cached GetClassNode getClassNode, @Cached PythonObjectFactory factory, @Cached GetExceptionTracebackNode getExceptionTracebackNode) {<NEW_LINE>PythonContext context = PythonContext.get(getClassNode);<NEW_LINE>try {<NEW_LINE>PythonModule sysModule = context.lookupBuiltinModule("sys");<NEW_LINE>Object unraisablehook = lookup.execute(frame, sysModule, BuiltinNames.UNRAISABLEHOOK);<NEW_LINE>Object <MASK><NEW_LINE>Object traceback = getExceptionTracebackNode.execute(exception);<NEW_LINE>Object messageObj = PNone.NONE;<NEW_LINE>if (message != null) {<NEW_LINE>messageObj = formatMessage(message);<NEW_LINE>}<NEW_LINE>Object hookArguments = factory.createStructSeq(SysModuleBuiltins.UNRAISABLEHOOK_ARGS_DESC, exceptionType, exception, traceback, messageObj, object != null ? object : PNone.NONE);<NEW_LINE>callNode.execute(frame, unraisablehook, hookArguments);<NEW_LINE>} catch (PException e) {<NEW_LINE>ignoreException(context, message);<NEW_LINE>}<NEW_LINE>} | exceptionType = getClassNode.execute(exception); |
1,566,755 | public void run() {<NEW_LINE>try {<NEW_LINE>NamingMetadataManager metadataManager = <MASK><NEW_LINE>Optional<ServiceMetadata> serviceMetadata = metadataManager.getServiceMetadata(service);<NEW_LINE>if (!serviceMetadata.isPresent()) {<NEW_LINE>return;<NEW_LINE>}<NEW_LINE>ServiceManager serviceManager = ApplicationUtils.getBean(ServiceManager.class);<NEW_LINE>com.alibaba.nacos.naming.core.Service serviceV1 = newServiceForV1(serviceManager, serviceMetadata.get());<NEW_LINE>serviceManager.addOrReplaceService(serviceV1);<NEW_LINE>} catch (Exception e) {<NEW_LINE>if (Loggers.SRV_LOG.isDebugEnabled()) {<NEW_LINE>Loggers.SRV_LOG.debug("Double write task for {} metadata from 2 to 1 failed", service, e);<NEW_LINE>}<NEW_LINE>ServiceChangeV2Task retryTask = new ServiceChangeV2Task(service, DoubleWriteContent.METADATA);<NEW_LINE>retryTask.setTaskInterval(INTERVAL);<NEW_LINE>String taskKey = ServiceChangeV2Task.getKey(service);<NEW_LINE>ApplicationUtils.getBean(DoubleWriteDelayTaskEngine.class).addTask(taskKey, retryTask);<NEW_LINE>}<NEW_LINE>} | ApplicationUtils.getBean(NamingMetadataManager.class); |
555,313 | public InstanceTagNotificationAttribute unmarshall(StaxUnmarshallerContext context) throws Exception {<NEW_LINE>InstanceTagNotificationAttribute instanceTagNotificationAttribute = new InstanceTagNotificationAttribute();<NEW_LINE>int originalDepth = context.getCurrentDepth();<NEW_LINE>int targetDepth = originalDepth + 1;<NEW_LINE>if (context.isStartOfDocument())<NEW_LINE>targetDepth += 1;<NEW_LINE>while (true) {<NEW_LINE>XMLEvent xmlEvent = context.nextEvent();<NEW_LINE>if (xmlEvent.isEndDocument())<NEW_LINE>return instanceTagNotificationAttribute;<NEW_LINE>if (xmlEvent.isAttribute() || xmlEvent.isStartElement()) {<NEW_LINE>if (context.testExpression("instanceTagKeySet", targetDepth)) {<NEW_LINE>instanceTagNotificationAttribute.withInstanceTagKeys(<MASK><NEW_LINE>continue;<NEW_LINE>}<NEW_LINE>if (context.testExpression("instanceTagKeySet/item", targetDepth)) {<NEW_LINE>instanceTagNotificationAttribute.withInstanceTagKeys(StringStaxUnmarshaller.getInstance().unmarshall(context));<NEW_LINE>continue;<NEW_LINE>}<NEW_LINE>if (context.testExpression("includeAllTagsOfInstance", targetDepth)) {<NEW_LINE>instanceTagNotificationAttribute.setIncludeAllTagsOfInstance(BooleanStaxUnmarshaller.getInstance().unmarshall(context));<NEW_LINE>continue;<NEW_LINE>}<NEW_LINE>} else if (xmlEvent.isEndElement()) {<NEW_LINE>if (context.getCurrentDepth() < originalDepth) {<NEW_LINE>return instanceTagNotificationAttribute;<NEW_LINE>}<NEW_LINE>}<NEW_LINE>}<NEW_LINE>} | new ArrayList<String>()); |
438,215 | public void fixupVariables(java.util.Vector vars, int globalsSize) {<NEW_LINE>m_fixUpWasCalled = true;<NEW_LINE>int sz = vars.size();<NEW_LINE>for (int i = vars.size() - 1; i >= 0; i--) {<NEW_LINE>QName qn = (<MASK><NEW_LINE>// System.out.println("qn: "+qn);<NEW_LINE>if (qn.equals(m_qname)) {<NEW_LINE>if (i < globalsSize) {<NEW_LINE>m_isGlobal = true;<NEW_LINE>m_index = i;<NEW_LINE>} else {<NEW_LINE>m_index = i - globalsSize;<NEW_LINE>}<NEW_LINE>return;<NEW_LINE>}<NEW_LINE>}<NEW_LINE>java.lang.String msg = XSLMessages.createXPATHMessage(XPATHErrorResources.ER_COULD_NOT_FIND_VAR, new Object[] { m_qname.toString() });<NEW_LINE>TransformerException te = new TransformerException(msg, this);<NEW_LINE>throw new org.apache.xml.utils.WrappedRuntimeException(te);<NEW_LINE>} | QName) vars.elementAt(i); |
538,327 | public final Object invoke(Object proxy, Method method, Object[] args) throws Throwable {<NEW_LINE>String name = method.getName();<NEW_LINE>Class<?>[] params = method.getParameterTypes();<NEW_LINE>if ("equals".equals(name) && params.length == 1 && params[0] == Object.class) {<NEW_LINE>Object o = args[0];<NEW_LINE>if (o == null || (o instanceof DebugProxy) == false) {<NEW_LINE>return Boolean.FALSE;<NEW_LINE>}<NEW_LINE>InvocationHandler ih = Proxy.getInvocationHandler(o);<NEW_LINE>return (ih instanceof DebuggingInvoker && target.equals(((DebuggingInvoker) ih).target));<NEW_LINE>} else if ("hashCode".equals(name) && params.length == 0) {<NEW_LINE>return System.identityHashCode(proxy);<NEW_LINE>} else if ("toString".equals(name) && params.length == 0) {<NEW_LINE>return "Debug proxy for " + target;<NEW_LINE>}<NEW_LINE>try {<NEW_LINE>Object result = method.invoke(target, args);<NEW_LINE>log.<MASK><NEW_LINE>return result == null || result instanceof DebugProxy ? result : postProcess(result, proxy);<NEW_LINE>} catch (InvocationTargetException ex) {<NEW_LINE>log.logException(method, args, ex.getCause());<NEW_LINE>throw ex.getCause();<NEW_LINE>} catch (Exception ex) {<NEW_LINE>// should not occur<NEW_LINE>log.logException(method, args, ex);<NEW_LINE>throw new JdbcSQLException(ex, "Debugging failed for [" + method + "]");<NEW_LINE>}<NEW_LINE>} | logResult(method, args, result); |
1,236,558 | private static synchronized List<byte[]> splitBytes(byte[] bytes, int size) {<NEW_LINE>List<byte[]> byteList = new ArrayList<>();<NEW_LINE>double splitLength = Double.parseDouble(WeIdConstant.MAX_AUTHORITY_ISSUER_NAME_LENGTH + "");<NEW_LINE>int arrayLength = (int) Math.ceil(bytes.length / splitLength);<NEW_LINE>byte[] result = new byte[arrayLength];<NEW_LINE>int from = 0;<NEW_LINE>int to = 0;<NEW_LINE>for (int i = 0; i < arrayLength; i++) {<NEW_LINE>from = <MASK><NEW_LINE>to = (int) (from + splitLength);<NEW_LINE>if (to > bytes.length) {<NEW_LINE>to = bytes.length;<NEW_LINE>}<NEW_LINE>result = Arrays.copyOfRange(bytes, from, to);<NEW_LINE>if (result.length < size) {<NEW_LINE>byte[] newBytes = new byte[32];<NEW_LINE>System.arraycopy(result, 0, newBytes, 0, result.length);<NEW_LINE>byteList.add(newBytes);<NEW_LINE>} else {<NEW_LINE>byteList.add(result);<NEW_LINE>}<NEW_LINE>}<NEW_LINE>return byteList;<NEW_LINE>} | (int) (i * splitLength); |
921,964 | public void trainModel(String[] lingFactors, String featuresFile, int numFeatures, double percentToTrain, SoP sop) throws Exception {<NEW_LINE>// desired size of the solution<NEW_LINE>int d = solutionSize;<NEW_LINE>// maximum deviation allowed with respect to d<NEW_LINE>int D = 0;<NEW_LINE>int cols = lingFactors.length;<NEW_LINE>// the last column is the independent variable<NEW_LINE>int indVariable = cols;<NEW_LINE>int rows = numFeatures;<NEW_LINE>int rowIniTrain = 0;<NEW_LINE>int percentVal = (int) (Math.floor((numFeatures * percentToTrain)));<NEW_LINE>int rowEndTrain = percentVal - 1;<NEW_LINE>int rowIniTest = percentVal;<NEW_LINE>int rowEndTest = percentVal + (numFeatures - percentVal - 1) - 1;<NEW_LINE>System.out.println("Number of points: " + rows + "\nNumber of points used for training from " + rowIniTrain + " to " + rowEndTrain + "(Total train=" + (rowEndTrain - rowIniTrain) + ")\nNumber of points used for testing from " + rowIniTest + " to " + rowEndTest + "(Total test=" + (rowEndTest - rowIniTest) + ")");<NEW_LINE>System.out.println("Number of linguistic factors: " + cols);<NEW_LINE>System.out.println("Max number of selected features in SFFS: " + (d + D));<NEW_LINE>if (interceptTerm)<NEW_LINE>System.out.println("Using intercept Term for regression");<NEW_LINE>else<NEW_LINE>System.out.println("No intercept Term for regression");<NEW_LINE>if (logSolution)<NEW_LINE>System.out.println("Using log(val) as independent variable" + "\n");<NEW_LINE>else<NEW_LINE>System.out.println("Using independent variable without log()" + "\n");<NEW_LINE>// copy indexes of column features<NEW_LINE>int[] Y = new int[lingFactors.length];<NEW_LINE>int[] X = {};<NEW_LINE>for (int j = 0; j < lingFactors.length; j++) Y[j] = j;<NEW_LINE>// we need to remove from Y the column features that have mean 0.0<NEW_LINE>System.out.println("Checking and removing columns with mean=0.0");<NEW_LINE>Y = checkMeanColumns(featuresFile, Y, lingFactors);<NEW_LINE>int[] selectedCols = sequentialForwardFloatingSelection(featuresFile, indVariable, lingFactors, X, Y, d, D, rowIniTrain, rowEndTrain, sop);<NEW_LINE>sop.printCoefficients();<NEW_LINE>System.out.println("Correlation original val / predicted val = " + sop.getCorrelation() + "\nRMSE (root mean square error) = " + sop.getRMSE());<NEW_LINE>Regression reg = new Regression();<NEW_LINE>reg.setCoeffs(sop.getCoeffs());<NEW_LINE>System.out.println("\nNumber points used for training=" + (rowEndTrain - rowIniTrain));<NEW_LINE>reg.predictValues(featuresFile, cols, selectedCols, interceptTerm, rowIniTrain, rowEndTrain);<NEW_LINE>System.out.println(<MASK><NEW_LINE>reg.predictValues(featuresFile, cols, selectedCols, interceptTerm, rowIniTest, rowEndTest);<NEW_LINE>} | "\nNumber points used for testing=" + (rowEndTest - rowIniTest)); |
645,325 | public void beforeIndexRemoved(IndexService indexService, IndexRemovalReason reason) {<NEW_LINE>if (shouldEvictCacheFiles(reason)) {<NEW_LINE>if (indexService.getMetadata().isSearchableSnapshot()) {<NEW_LINE>final IndexSettings indexSettings = indexService.getIndexSettings();<NEW_LINE>for (IndexShard indexShard : indexService) {<NEW_LINE>final ShardId shardId = indexShard.shardId();<NEW_LINE>logger.debug("{} marking shard as evicted in searchable snapshots cache (reason: {})", shardId, reason);<NEW_LINE>if (cacheService != null) {<NEW_LINE>cacheService.markShardAsEvictedInCache(SNAPSHOT_SNAPSHOT_ID_SETTING.get(indexSettings.getSettings()), SNAPSHOT_INDEX_NAME_SETTING.get(indexSettings<MASK><NEW_LINE>}<NEW_LINE>if (frozenCacheService != null) {<NEW_LINE>frozenCacheService.markShardAsEvictedInCache(SNAPSHOT_SNAPSHOT_ID_SETTING.get(indexSettings.getSettings()), SNAPSHOT_INDEX_NAME_SETTING.get(indexSettings.getSettings()), shardId);<NEW_LINE>}<NEW_LINE>}<NEW_LINE>}<NEW_LINE>}<NEW_LINE>} | .getSettings()), shardId); |
1,005,271 | public CharSequence toLocalizedString(@NonNull Context context) {<NEW_LINE>StringBuilder sb = new StringBuilder();<NEW_LINE>if (mSize != -1) {<NEW_LINE>sb.append(Formatter.formatFileSize(context, mSize)).append(", ");<NEW_LINE>}<NEW_LINE>switch(mArch) {<NEW_LINE>case ARCH_32BIT:<NEW_LINE>sb.append(context.getString(R.string.binary_32_bit)).append(", ");<NEW_LINE>break;<NEW_LINE>case ARCH_64BIT:<NEW_LINE>sb.append(context.getString(R.string.binary_64_bit)).append(", ");<NEW_LINE>break;<NEW_LINE>case ARCH_NONE:<NEW_LINE>break;<NEW_LINE>}<NEW_LINE>switch(mEndianness) {<NEW_LINE>case ENDIANNESS_BIG_ENDIAN:<NEW_LINE>sb.append(context.getString(R.string.endianness_big_endian)).append(", ");<NEW_LINE>break;<NEW_LINE>case ENDIANNESS_LITTLE_ENDIAN:<NEW_LINE>sb.append(context.getString(R.string.endianness_little_endian)).append(", ");<NEW_LINE>break;<NEW_LINE>case ENDIANNESS_NONE:<NEW_LINE>break;<NEW_LINE>}<NEW_LINE>switch(mType) {<NEW_LINE>case TYPE_NONE:<NEW_LINE>case TYPE_CORE:<NEW_LINE>case TYPE_REL:<NEW_LINE>// Not available in Android<NEW_LINE>break;<NEW_LINE>case TYPE_DYN:<NEW_LINE>sb.append(context.getString(R.string.<MASK><NEW_LINE>break;<NEW_LINE>case TYPE_EXEC:<NEW_LINE>sb.append(context.getString(R.string.so_type_executable)).append(", ");<NEW_LINE>break;<NEW_LINE>}<NEW_LINE>sb.append(getIsaString()).append("\n").append(mPath);<NEW_LINE>return sb;<NEW_LINE>} | so_type_shared_library)).append(", "); |
700,732 | private void startPlay(String linkStreamId) {<NEW_LINE>String userId = String.valueOf(new Random().nextInt(10000));<NEW_LINE>String playURL = URLUtils.generatePlayUrl(linkStreamId, userId, 0);<NEW_LINE>if (mLivePlayer == null) {<NEW_LINE>mLivePlayer = new V2TXLivePlayerImpl(LivePKAnchorActivity.this);<NEW_LINE>mLivePlayer.setRenderView(mPlayRenderView);<NEW_LINE>mLivePlayer.setObserver(new V2TXLivePlayerObserver() {<NEW_LINE><NEW_LINE>@Override<NEW_LINE>public void onError(V2TXLivePlayer player, int code, String msg, Bundle extraInfo) {<NEW_LINE>Log.e(TAG, "[Player] onError: player-" + player + " code-" + code + " msg-" + msg + " info-" + extraInfo);<NEW_LINE>}<NEW_LINE><NEW_LINE>@Override<NEW_LINE>public void onVideoLoading(V2TXLivePlayer player, Bundle extraInfo) {<NEW_LINE>Log.i(TAG, "[Player] onVideoLoading: player-" + player + ", extraInfo-" + extraInfo);<NEW_LINE>}<NEW_LINE><NEW_LINE>@Override<NEW_LINE>public void onVideoPlaying(V2TXLivePlayer player, boolean firstPlay, Bundle extraInfo) {<NEW_LINE>Log.i(TAG, "[Player] onVideoPlaying: player-" + player + " firstPlay-" + firstPlay + " info-" + extraInfo);<NEW_LINE>}<NEW_LINE><NEW_LINE>@Override<NEW_LINE>public void onVideoResolutionChanged(V2TXLivePlayer player, int width, int height) {<NEW_LINE>Log.i(TAG, "[Player] onVideoResolutionChanged: player-" + player + " width-" + width + " height-" + height);<NEW_LINE>}<NEW_LINE>});<NEW_LINE>}<NEW_LINE>int result = mLivePlayer.startPlay(playURL);<NEW_LINE>Log.<MASK><NEW_LINE>} | d(TAG, "startPlay : " + result); |
983,318 | public XContentBuilder doXContentBody(XContentBuilder builder, Params params) throws IOException {<NEW_LINE>if (keyed) {<NEW_LINE>builder.startObject("values");<NEW_LINE>for (double percent : percents) {<NEW_LINE>double value = percentile(percent);<NEW_LINE>boolean hasValue = !(Double.isInfinite(value) <MASK><NEW_LINE>String key = String.valueOf(percent);<NEW_LINE>builder.field(key, hasValue ? value : null);<NEW_LINE>if (hasValue && format != DocValueFormat.RAW) {<NEW_LINE>builder.field(key + "_as_string", percentileAsString(percent));<NEW_LINE>}<NEW_LINE>}<NEW_LINE>builder.endObject();<NEW_LINE>} else {<NEW_LINE>builder.startArray("values");<NEW_LINE>for (double percent : percents) {<NEW_LINE>double value = percentile(percent);<NEW_LINE>boolean hasValue = !(Double.isInfinite(value) || Double.isNaN(value));<NEW_LINE>builder.startObject();<NEW_LINE>builder.field("key", percent);<NEW_LINE>builder.field("value", hasValue ? value : null);<NEW_LINE>if (hasValue && format != DocValueFormat.RAW) {<NEW_LINE>builder.field(String.valueOf(percent) + "_as_string", percentileAsString(percent));<NEW_LINE>}<NEW_LINE>builder.endObject();<NEW_LINE>}<NEW_LINE>builder.endArray();<NEW_LINE>}<NEW_LINE>return builder;<NEW_LINE>} | || Double.isNaN(value)); |
1,774,743 | private static void updateCommentsData(CodeArea codeArea, Consumer<List<ICodeComment>> updater) {<NEW_LINE>try {<NEW_LINE><MASK><NEW_LINE>JadxCodeData codeData = project.getCodeData();<NEW_LINE>if (codeData == null) {<NEW_LINE>codeData = new JadxCodeData();<NEW_LINE>}<NEW_LINE>List<ICodeComment> list = new ArrayList<>(codeData.getComments());<NEW_LINE>updater.accept(list);<NEW_LINE>Collections.sort(list);<NEW_LINE>codeData.setComments(list);<NEW_LINE>project.setCodeData(codeData);<NEW_LINE>codeArea.getMainWindow().getWrapper().getDecompiler().reloadCodeData();<NEW_LINE>} catch (Exception e) {<NEW_LINE>LOG.error("Comment action failed", e);<NEW_LINE>}<NEW_LINE>try {<NEW_LINE>// refresh code<NEW_LINE>codeArea.refreshClass();<NEW_LINE>} catch (Exception e) {<NEW_LINE>LOG.error("Failed to reload code", e);<NEW_LINE>}<NEW_LINE>} | JadxProject project = codeArea.getProject(); |
1,525,873 | public void exitRo_redistribute_connected(Ro_redistribute_connectedContext ctx) {<NEW_LINE>OspfProcess proc = _currentOspfProcess;<NEW_LINE>RedistributionSourceProtocol sourceProtocol = RedistributionSourceProtocol.CONNECTED;<NEW_LINE>OspfRedistributionPolicy r = new OspfRedistributionPolicy(sourceProtocol);<NEW_LINE>proc.getRedistributionPolicies().put(sourceProtocol, r);<NEW_LINE>if (ctx.metric != null) {<NEW_LINE>int metric = toInteger(ctx.metric);<NEW_LINE>r.setMetric(metric);<NEW_LINE>}<NEW_LINE>if (ctx.map != null) {<NEW_LINE>String map = ctx.map.getText();<NEW_LINE>r.setRouteMap(map);<NEW_LINE>_configuration.referenceStructure(ROUTE_MAP, map, OSPF_REDISTRIBUTE_CONNECTED_MAP, <MASK><NEW_LINE>}<NEW_LINE>if (ctx.type != null) {<NEW_LINE>int typeInt = toInteger(ctx.type);<NEW_LINE>OspfMetricType type = OspfMetricType.fromInteger(typeInt);<NEW_LINE>r.setOspfMetricType(type);<NEW_LINE>} else {<NEW_LINE>r.setOspfMetricType(OspfRedistributionPolicy.DEFAULT_METRIC_TYPE);<NEW_LINE>}<NEW_LINE>if (ctx.tag != null) {<NEW_LINE>long tag = toLong(ctx.tag);<NEW_LINE>r.setTag(tag);<NEW_LINE>}<NEW_LINE>} | ctx.map.getLine()); |
1,168,283 | @UiThread<NEW_LINE>private static Constructor<? extends Unbinder> findBindingConstructorForClass(Class<?> cls) {<NEW_LINE>Constructor<? extends Unbinder> bindingCtor = BINDINGS.get(cls);<NEW_LINE>if (bindingCtor != null || BINDINGS.containsKey(cls)) {<NEW_LINE>if (debug)<NEW_LINE>Log.d(TAG, "HIT: Cached in binding map.");<NEW_LINE>return bindingCtor;<NEW_LINE>}<NEW_LINE>String clsName = cls.getName();<NEW_LINE>if (clsName.startsWith("android.") || clsName.startsWith("java.") || clsName.startsWith("androidx.")) {<NEW_LINE>if (debug)<NEW_LINE>Log.d(TAG, "MISS: Reached framework class. Abandoning search.");<NEW_LINE>return null;<NEW_LINE>}<NEW_LINE>try {<NEW_LINE>Class<?> bindingClass = cls.getClassLoader().loadClass(clsName + "_ViewBinding");<NEW_LINE>// noinspection unchecked<NEW_LINE>bindingCtor = (Constructor<? extends Unbinder>) bindingClass.getConstructor(cls, View.class);<NEW_LINE>if (debug)<NEW_LINE><MASK><NEW_LINE>} catch (ClassNotFoundException e) {<NEW_LINE>if (debug)<NEW_LINE>Log.d(TAG, "Not found. Trying superclass " + cls.getSuperclass().getName());<NEW_LINE>bindingCtor = findBindingConstructorForClass(cls.getSuperclass());<NEW_LINE>} catch (NoSuchMethodException e) {<NEW_LINE>throw new RuntimeException("Unable to find binding constructor for " + clsName, e);<NEW_LINE>}<NEW_LINE>BINDINGS.put(cls, bindingCtor);<NEW_LINE>return bindingCtor;<NEW_LINE>} | Log.d(TAG, "HIT: Loaded binding class and constructor."); |
246,186 | private AndroidManifest parse(File androidManifestFile, boolean libraryProject) throws AndroidManifestNotFoundException {<NEW_LINE>DocumentBuilderFactory docBuilderFactory = DocumentBuilderFactory.newInstance();<NEW_LINE>Document doc;<NEW_LINE>try {<NEW_LINE>DocumentBuilder docBuilder = docBuilderFactory.newDocumentBuilder();<NEW_LINE>doc = docBuilder.parse(androidManifestFile);<NEW_LINE>} catch (Exception e) {<NEW_LINE>LOGGER.error("Could not parse the AndroidManifest.xml file at path {}", androidManifestFile, e);<NEW_LINE>throw new AndroidManifestNotFoundException("Could not parse the AndroidManifest.xml file at path {}" + androidManifestFile, e);<NEW_LINE>}<NEW_LINE>Element documentElement = doc.getDocumentElement();<NEW_LINE>documentElement.normalize();<NEW_LINE>String applicationPackage = documentElement.getAttribute("package");<NEW_LINE>int minSdkVersion = -1;<NEW_LINE>int maxSdkVersion = -1;<NEW_LINE>int targetSdkVersion = -1;<NEW_LINE>NodeList sdkNodes = documentElement.getElementsByTagName("uses-sdk");<NEW_LINE>if (sdkNodes.getLength() > 0) {<NEW_LINE>Node sdkNode = sdkNodes.item(0);<NEW_LINE>minSdkVersion = extractAttributeIntValue(sdkNode, "android:minSdkVersion", -1);<NEW_LINE>maxSdkVersion = extractAttributeIntValue(sdkNode, "android:maxSdkVersion", -1);<NEW_LINE>targetSdkVersion = extractAttributeIntValue(sdkNode, "android:targetSdkVersion", -1);<NEW_LINE>}<NEW_LINE>if (libraryProject) {<NEW_LINE>return AndroidManifest.createLibraryManifest(applicationPackage, minSdkVersion, maxSdkVersion, targetSdkVersion);<NEW_LINE>}<NEW_LINE>NodeList applicationNodes = documentElement.getElementsByTagName("application");<NEW_LINE>String applicationClassQualifiedName = null;<NEW_LINE>boolean applicationDebuggableMode = false;<NEW_LINE>if (applicationNodes.getLength() > 0) {<NEW_LINE>Node applicationNode = applicationNodes.item(0);<NEW_LINE>Node nameAttribute = applicationNode.getAttributes().getNamedItem("android:name");<NEW_LINE>applicationClassQualifiedName = manifestNameToValidQualifiedName(applicationPackage, nameAttribute);<NEW_LINE>if (applicationClassQualifiedName == null) {<NEW_LINE>if (nameAttribute != null) {<NEW_LINE>LOGGER.warn("The class application declared in the AndroidManifest.xml cannot be found in the compile path: [{}]", nameAttribute.getNodeValue());<NEW_LINE>}<NEW_LINE>}<NEW_LINE>Node debuggableAttribute = applicationNode.<MASK><NEW_LINE>if (debuggableAttribute != null) {<NEW_LINE>applicationDebuggableMode = debuggableAttribute.getNodeValue().equalsIgnoreCase("true");<NEW_LINE>}<NEW_LINE>}<NEW_LINE>NodeList activityNodes = documentElement.getElementsByTagName("activity");<NEW_LINE>List<String> activityQualifiedNames = extractComponentNames(applicationPackage, activityNodes);<NEW_LINE>NodeList serviceNodes = documentElement.getElementsByTagName("service");<NEW_LINE>List<String> serviceQualifiedNames = extractComponentNames(applicationPackage, serviceNodes);<NEW_LINE>NodeList receiverNodes = documentElement.getElementsByTagName("receiver");<NEW_LINE>List<String> receiverQualifiedNames = extractComponentNames(applicationPackage, receiverNodes);<NEW_LINE>NodeList providerNodes = documentElement.getElementsByTagName("provider");<NEW_LINE>List<String> providerQualifiedNames = extractComponentNames(applicationPackage, providerNodes);<NEW_LINE>List<String> componentQualifiedNames = new ArrayList<>();<NEW_LINE>componentQualifiedNames.addAll(activityQualifiedNames);<NEW_LINE>componentQualifiedNames.addAll(serviceQualifiedNames);<NEW_LINE>componentQualifiedNames.addAll(receiverQualifiedNames);<NEW_LINE>componentQualifiedNames.addAll(providerQualifiedNames);<NEW_LINE>NodeList metaDataNodes = documentElement.getElementsByTagName("meta-data");<NEW_LINE>Map<String, AndroidManifest.MetaDataInfo> metaDataQualifiedNames = extractMetaDataQualifiedNames(metaDataNodes);<NEW_LINE>NodeList usesPermissionNodes = documentElement.getElementsByTagName("uses-permission");<NEW_LINE>List<String> usesPermissionQualifiedNames = extractUsesPermissionNames(usesPermissionNodes);<NEW_LINE>List<String> permissionQualifiedNames = new ArrayList<>();<NEW_LINE>permissionQualifiedNames.addAll(usesPermissionQualifiedNames);<NEW_LINE>return AndroidManifest.createManifest(applicationPackage, applicationClassQualifiedName, componentQualifiedNames, metaDataQualifiedNames, permissionQualifiedNames, minSdkVersion, maxSdkVersion, targetSdkVersion, applicationDebuggableMode);<NEW_LINE>} | getAttributes().getNamedItem("android:debuggable"); |
1,202,292 | private void runDocumentActionExclusively(Action<DocumentAccess> action) throws IOException {<NEW_LINE>if (readAccess != null) {<NEW_LINE>throw new IllegalStateException("Already in read access.");<NEW_LINE>}<NEW_LINE>if (writeAccess) {<NEW_LINE>throw new IllegalStateException("Reentrant write access not supported");<NEW_LINE>}<NEW_LINE>writeAccess = true;<NEW_LINE>try {<NEW_LINE>for (File currentFile : file2Controller.keySet()) {<NEW_LINE>Map<File, SpringBeanSource> beanSources = computeSpringBeanSources(currentFile);<NEW_LINE>SpringConfigFileModelController <MASK><NEW_LINE>LockedDocument lockedDoc = controller.getLockedDocument();<NEW_LINE>if (lockedDoc != null) {<NEW_LINE>lockedDoc.lock();<NEW_LINE>try {<NEW_LINE>beanSources.put(currentFile, lockedDoc.getBeanSource());<NEW_LINE>ConfigModelSpringBeans springBeans = new ConfigModelSpringBeans(beanSources);<NEW_LINE>DocumentAccess docAccess = SpringConfigModelAccessor.getDefault().createDocumentAccess(springBeans, currentFile, lockedDoc);<NEW_LINE>action.run(docAccess);<NEW_LINE>} finally {<NEW_LINE>lockedDoc.unlock();<NEW_LINE>}<NEW_LINE>}<NEW_LINE>}<NEW_LINE>} finally {<NEW_LINE>writeAccess = false;<NEW_LINE>}<NEW_LINE>} | controller = file2Controller.get(currentFile); |
127,494 | private void createDatasets(int max, boolean sameFloor) throws Exception {<NEW_LINE>this.dataset = new ArrayList<>();<NEW_LINE>// sum sources<NEW_LINE>for (int i = 1; i < source.length; i++) {<NEW_LINE>source[i] += source[i - 1];<NEW_LINE>}<NEW_LINE>// sum probabilities<NEW_LINE>for (int i = 0; i < probabilities.length; i++) {<NEW_LINE>for (int j = 1; j < probabilities[0].length; j++) {<NEW_LINE>probabilities[i][j] += probabilities[i][j - 1];<NEW_LINE>}<NEW_LINE>}<NEW_LINE>CleanBuilding building = new CleanBuilding(DataConnector.BUILDING_ID, false);<NEW_LINE>AlgorithmSrcDest algo = new BFSSrcDest(1, building.getVertices());<NEW_LINE>for (int i = 0; i < max; i++) {<NEW_LINE>int index = getSourceIndex();<NEW_LINE>int start = getStartPoint(index);<NEW_LINE>int destIndex = getDestinationIndex(index);<NEW_LINE>int stop = getDestinationPoint(start, destIndex);<NEW_LINE>if (sameFloor) {<NEW_LINE>String startfloor = building.getVertices()[start].getFloor();<NEW_LINE>String stopfloor = building.getVertices()[stop].getFloor();<NEW_LINE>while (!startfloor.equals(stopfloor)) {<NEW_LINE>destIndex = getDestinationIndex(index);<NEW_LINE>stop = getDestinationPoint(start, destIndex);<NEW_LINE>stopfloor = building.getVertices(<MASK><NEW_LINE>}<NEW_LINE>}<NEW_LINE>ArrayList<Integer> result = algo.run(start, stop);<NEW_LINE>if (result.size() == 1) {<NEW_LINE>System.err.println(start + " " + stop);<NEW_LINE>}<NEW_LINE>dataset.add(result);<NEW_LINE>}<NEW_LINE>} | )[stop].getFloor(); |
180,684 | private <E extends Entity> E reloadIfNeeded(E entity, CollectionContainer<E> container, EditorBuilder<E> builder) {<NEW_LINE>if (container == null || builder.getTransformation() != null) {<NEW_LINE>return entity;<NEW_LINE>}<NEW_LINE>boolean needDynamicAttributes = false;<NEW_LINE>boolean dynamicAttributesAreLoaded = true;<NEW_LINE>if (entity instanceof BaseGenericIdEntity) {<NEW_LINE>BaseGenericIdEntity e = (BaseGenericIdEntity) entity;<NEW_LINE>dynamicAttributesAreLoaded = e.getDynamicAttributes() != null;<NEW_LINE>if (container instanceof HasLoader) {<NEW_LINE>DataLoader loader = ((HasLoader) container).getLoader();<NEW_LINE>if (loader instanceof CollectionLoader) {<NEW_LINE>needDynamicAttributes = ((<MASK><NEW_LINE>}<NEW_LINE>}<NEW_LINE>}<NEW_LINE>View view = container.getView();<NEW_LINE>if (view == null) {<NEW_LINE>view = viewRepository.getView(entity.getClass(), View.LOCAL);<NEW_LINE>}<NEW_LINE>if (!entityStates.isLoadedWithView(entity, view)) {<NEW_LINE>entity = dataManager.reload(entity, view, null, needDynamicAttributes);<NEW_LINE>} else if (needDynamicAttributes && !dynamicAttributesAreLoaded) {<NEW_LINE>dynamicAttributesGuiTools.reloadDynamicAttributes((BaseGenericIdEntity) entity);<NEW_LINE>}<NEW_LINE>return entity;<NEW_LINE>} | CollectionLoader) loader).isLoadDynamicAttributes(); |
501,554 | public Executable configure(PrintStream out, PrintStream err, String... args) {<NEW_LINE>return () -> {<NEW_LINE>int longest = // two space padding either side<NEW_LINE>commands.stream().filter(CliCommand::isShown).map(CliCommand::getName).max(Comparator.comparingInt(String::length)).map(String::length).orElse(0) + 2;<NEW_LINE>PrintWriter outWriter = new WrappedPrintWriter(out, 72, 0);<NEW_LINE>outWriter.append(getName()).append("\n\n");<NEW_LINE>outWriter.append(getDescription()).append("\n").append("\n");<NEW_LINE>int indent = Math.min(longest + 2, 25);<NEW_LINE><MASK><NEW_LINE>PrintWriter indented = new WrappedPrintWriter(out, 72, indent);<NEW_LINE>commands.stream().filter(CliCommand::isShown).forEach(cmd -> indented.format(format, cmd.getName()).append(cmd.getDescription()).append("\n"));<NEW_LINE>outWriter.write("\nFor each command, run with `--help` for command-specific help\n");<NEW_LINE>outWriter.write("\nUse the `--ext` flag before the command name to specify an additional " + "classpath to use with the server (for example, to provide additional " + "commands, or to provide additional driver implementations). For example:\n");<NEW_LINE>outWriter.write(String.format("%n java -jar selenium.jar --ext example.jar%sdir standalone --port 1234", File.pathSeparator));<NEW_LINE>out.println("\n");<NEW_LINE>};<NEW_LINE>} | String format = " %-" + longest + "s"; |
930,492 | public static String parseETagValue(String value) {<NEW_LINE>String eTagVersion;<NEW_LINE>value = value.trim();<NEW_LINE>if (value.length() > 1) {<NEW_LINE>if (value.charAt(value.length() - 1) == '"') {<NEW_LINE>if (value.charAt(0) == '"') {<NEW_LINE>eTagVersion = value.substring(1, value.length() - 1);<NEW_LINE>} else if (value.length() > 3 && value.charAt(0) == 'W' && value.charAt(1) == '/' && value.charAt(2) == '"') {<NEW_LINE>eTagVersion = value.substring(3, <MASK><NEW_LINE>} else {<NEW_LINE>eTagVersion = value;<NEW_LINE>}<NEW_LINE>} else {<NEW_LINE>eTagVersion = value;<NEW_LINE>}<NEW_LINE>} else {<NEW_LINE>eTagVersion = value;<NEW_LINE>}<NEW_LINE>return eTagVersion;<NEW_LINE>} | value.length() - 1); |
1,075,221 | final DescribeAffectedEntitiesForOrganizationResult executeDescribeAffectedEntitiesForOrganization(DescribeAffectedEntitiesForOrganizationRequest describeAffectedEntitiesForOrganizationRequest) {<NEW_LINE>ExecutionContext executionContext = createExecutionContext(describeAffectedEntitiesForOrganizationRequest);<NEW_LINE>AWSRequestMetrics awsRequestMetrics = executionContext.getAwsRequestMetrics();<NEW_LINE>awsRequestMetrics.startEvent(Field.ClientExecuteTime);<NEW_LINE>Request<DescribeAffectedEntitiesForOrganizationRequest> request = null;<NEW_LINE>Response<DescribeAffectedEntitiesForOrganizationResult> response = null;<NEW_LINE>try {<NEW_LINE>awsRequestMetrics.startEvent(Field.RequestMarshallTime);<NEW_LINE>try {<NEW_LINE>request = new DescribeAffectedEntitiesForOrganizationRequestProtocolMarshaller(protocolFactory).marshall(super.beforeMarshalling(describeAffectedEntitiesForOrganizationRequest));<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, "Health");<NEW_LINE>request.addHandlerContext(HandlerContextKey.OPERATION_NAME, "DescribeAffectedEntitiesForOrganization");<NEW_LINE>request.addHandlerContext(HandlerContextKey.ADVANCED_CONFIG, advancedConfig);<NEW_LINE>} finally {<NEW_LINE>awsRequestMetrics.endEvent(Field.RequestMarshallTime);<NEW_LINE>}<NEW_LINE>HttpResponseHandler<AmazonWebServiceResponse<DescribeAffectedEntitiesForOrganizationResult>> responseHandler = protocolFactory.createResponseHandler(new JsonOperationMetadata().withPayloadJson(true).withHasStreamingSuccessResponse(false), new DescribeAffectedEntitiesForOrganizationResultJsonUnmarshaller());<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,267,865 | public static void testSendPushWithCustomConfig() {<NEW_LINE>ClientConfig config = ClientConfig.getInstance();<NEW_LINE>// Setup the custom hostname<NEW_LINE>config.setPushHostName("https://api.jpush.cn");<NEW_LINE>JPushClient jpushClient = new JPushClient(MASTER_SECRET, APP_KEY, null, config);<NEW_LINE>// For push, all you need do is to build PushPayload object.<NEW_LINE>PushPayload payload = buildPushObject_all_all_alert();<NEW_LINE>try {<NEW_LINE>PushResult result = jpushClient.sendPush(payload);<NEW_LINE>LOG.info("Got result - " + result);<NEW_LINE>} catch (APIConnectionException e) {<NEW_LINE>LOG.error("Connection error. Should retry later. ", e);<NEW_LINE>} catch (APIRequestException e) {<NEW_LINE>LOG.error("Error response from JPush server. Should review and fix it. ", e);<NEW_LINE>LOG.info("HTTP Status: " + e.getStatus());<NEW_LINE>LOG.info("Error Code: " + e.getErrorCode());<NEW_LINE>LOG.info(<MASK><NEW_LINE>LOG.info("Msg ID: " + e.getMsgId());<NEW_LINE>}<NEW_LINE>} | "Error Message: " + e.getErrorMessage()); |
972,625 | public void execute(String label, IArgConsumer args) throws CommandException {<NEW_LINE>final BetterBlockPos playerPos = baritone.getPlayerContext().playerFeet();<NEW_LINE>final int surfaceLevel = baritone.getPlayerContext().world().getSeaLevel();<NEW_LINE>final int worldHeight = baritone.getPlayerContext()<MASK><NEW_LINE>// Ensure this command will not run if you are above the surface level and the block above you is air<NEW_LINE>// As this would imply that your are already on the open surface<NEW_LINE>if (playerPos.getY() > surfaceLevel && mc.world.getBlockState(playerPos.up()).getBlock() instanceof BlockAir) {<NEW_LINE>logDirect("Already at surface");<NEW_LINE>return;<NEW_LINE>}<NEW_LINE>final int startingYPos = Math.max(playerPos.getY(), surfaceLevel);<NEW_LINE>for (int currentIteratedY = startingYPos; currentIteratedY < worldHeight; currentIteratedY++) {<NEW_LINE>final BetterBlockPos newPos = new BetterBlockPos(playerPos.getX(), currentIteratedY, playerPos.getZ());<NEW_LINE>if (!(mc.world.getBlockState(newPos).getBlock() instanceof BlockAir) && newPos.getY() > playerPos.getY()) {<NEW_LINE>Goal goal = new GoalBlock(newPos.up());<NEW_LINE>logDirect(String.format("Going to: %s", goal.toString()));<NEW_LINE>baritone.getCustomGoalProcess().setGoalAndPath(goal);<NEW_LINE>return;<NEW_LINE>}<NEW_LINE>}<NEW_LINE>logDirect("No higher location found");<NEW_LINE>} | .world().getActualHeight(); |
908,195 | public static void doAdd(File repository, List<File> addFiles, OutputLogger logger) throws HgException {<NEW_LINE>if (repository == null)<NEW_LINE>return;<NEW_LINE>if (addFiles.isEmpty())<NEW_LINE>return;<NEW_LINE>List<String> basicCommand = new ArrayList<String>();<NEW_LINE><MASK><NEW_LINE>basicCommand.add(HG_ADD_CMD);<NEW_LINE>basicCommand.add(HG_OPT_REPOSITORY);<NEW_LINE>basicCommand.add(repository.getAbsolutePath());<NEW_LINE>List<List<String>> attributeGroups = splitAttributes(repository, basicCommand, addFiles, false);<NEW_LINE>for (List<String> attributes : attributeGroups) {<NEW_LINE>List<String> command = new ArrayList<String>(basicCommand);<NEW_LINE>command.addAll(attributes);<NEW_LINE>List<String> list = exec(command);<NEW_LINE>if (!list.isEmpty() && !isErrorAlreadyTracked(list.get(0)) && !isAddingLine(list.get(0))) {<NEW_LINE>if (getFilesWithPerformanceWarning(list).isEmpty()) {<NEW_LINE>// XXX we could notify the user about the performance warning and abort the command<NEW_LINE>handleError(command, list, list.get(0), logger);<NEW_LINE>}<NEW_LINE>}<NEW_LINE>}<NEW_LINE>} | basicCommand.add(getHgCommand()); |
1,484,101 | private void fillEdges(SPTEntry currEdge, PriorityQueue<SPTEntry> prioQueue, IntObjectMap<SPTEntry> bestWeightMap, boolean reverse) {<NEW_LINE>EdgeIterator iter = edgeExplorer.setBaseNode(currEdge.adjNode);<NEW_LINE>while (iter.next()) {<NEW_LINE>if (!accept(iter, currEdge.edge))<NEW_LINE>continue;<NEW_LINE>final double weight = calcWeight(iter, currEdge, reverse);<NEW_LINE>if (Double.isInfinite(weight)) {<NEW_LINE>continue;<NEW_LINE>}<NEW_LINE>final int traversalId = traversalMode.createTraversalId(iter, reverse);<NEW_LINE>SPTEntry <MASK><NEW_LINE>if (entry == null) {<NEW_LINE>entry = createEntry(iter, weight, currEdge, reverse);<NEW_LINE>bestWeightMap.put(traversalId, entry);<NEW_LINE>prioQueue.add(entry);<NEW_LINE>} else if (entry.getWeightOfVisitedPath() > weight) {<NEW_LINE>prioQueue.remove(entry);<NEW_LINE>updateEntry(entry, iter, weight, currEdge, reverse);<NEW_LINE>prioQueue.add(entry);<NEW_LINE>} else<NEW_LINE>continue;<NEW_LINE>if (updateBestPath) {<NEW_LINE>// only needed for edge-based -> skip the calculation and use dummy value otherwise<NEW_LINE>double edgeWeight = traversalMode.isEdgeBased() ? weighting.calcEdgeWeight(iter, reverse) : Double.POSITIVE_INFINITY;<NEW_LINE>// todo: performance - if bestWeightMapOther.get(traversalId) == null, updateBestPath will exit early and we might<NEW_LINE>// have calculated the edgeWeight unnecessarily<NEW_LINE>updateBestPath(edgeWeight, entry, EdgeIterator.NO_EDGE, traversalId, reverse);<NEW_LINE>}<NEW_LINE>}<NEW_LINE>} | entry = bestWeightMap.get(traversalId); |
1,381,795 | private static void tryAssertion13_14(RegressionEnvironment env, String stmtText, String outputLimit, AtomicInteger milestone) {<NEW_LINE>sendTimer(env, 0);<NEW_LINE>env.compileDeploy(stmtText).addListener("s0");<NEW_LINE>String[] fields = new String[] { "symbol", "volume", "price" };<NEW_LINE>ResultAssertTestResult expected = new <MASK><NEW_LINE>expected.addResultInsert(1200, 0, new Object[][] { { "MSFT", 5000L, 9d } });<NEW_LINE>expected.addResultInsert(2200, 0, new Object[][] { { "IBM", 155L, 26d } });<NEW_LINE>expected.addResultInsRem(3200, 0, null, null);<NEW_LINE>expected.addResultInsert(4200, 0, new Object[][] { { "YAH", 11000L, 2d } });<NEW_LINE>expected.addResultInsert(5200, 0, new Object[][] { { "YAH", 11500L, 3d } });<NEW_LINE>expected.addResultInsRem(6200, 0, new Object[][] { { "YAH", 10500L, 1d } }, new Object[][] { { "IBM", 100L, 25d } });<NEW_LINE>expected.addResultRemove(7200, 0, new Object[][] { { "YAH", 10000L, 1d } });<NEW_LINE>ResultAssertExecution execution = new ResultAssertExecution(stmtText, env, expected);<NEW_LINE>execution.execute(false, milestone);<NEW_LINE>} | ResultAssertTestResult(CATEGORY, outputLimit, fields); |
968,655 | private static void extractFrontAndRearInsertions(final SimpleInterval refSegment, final int segmentIdx, final List<String> altArrangement, final Allele anchorBaseRefAlleleFront, final Allele anchorBaseRefAlleleRear, final List<VariantContextBuilder> result) {<NEW_LINE>final List<Integer> segmentLen = Collections.singletonList(refSegment.size());<NEW_LINE>final SimpleInterval frontInsPos = SVUtils.makeOneBpInterval(refSegment.getContig(), refSegment.getStart() - 1);<NEW_LINE>final VariantContextBuilder frontIns = getInsFromOneEnd(true, segmentIdx, frontInsPos, anchorBaseRefAlleleFront, segmentLen, altArrangement, true);<NEW_LINE>if (frontIns != null)<NEW_LINE>result.add(frontIns);<NEW_LINE>final SimpleInterval rearInsPos = SVUtils.makeOneBpInterval(refSegment.getContig(<MASK><NEW_LINE>final VariantContextBuilder rearIns = getInsFromOneEnd(false, segmentIdx, rearInsPos, anchorBaseRefAlleleRear, segmentLen, altArrangement, true);<NEW_LINE>if (rearIns != null)<NEW_LINE>result.add(rearIns);<NEW_LINE>} | ), refSegment.getEnd()); |
1,513,778 | public void logInfo() {<NEW_LINE>getProject().getLogger().warn(getName() + " is experimental, its options and output might change in future versions");<NEW_LINE>final QuarkusProject quarkusProject = getQuarkusProject(false);<NEW_LINE>final Map<String, Object> params = new HashMap<>();<NEW_LINE>params.put(UpdateCommandHandler.APP_MODEL, extension().getApplicationModel());<NEW_LINE>params.put(UpdateCommandHandler.LOG_STATE_PER_MODULE, perModule);<NEW_LINE>final QuarkusCommandInvocation invocation = new QuarkusCommandInvocation(quarkusProject, params);<NEW_LINE>final QuarkusCommandOutcome outcome;<NEW_LINE>try {<NEW_LINE>outcome = new InfoCommandHandler().execute(invocation);<NEW_LINE>} catch (Exception e) {<NEW_LINE><MASK><NEW_LINE>}<NEW_LINE>if (outcome.getValue(InfoCommandHandler.RECOMMENDATIONS_AVAILABLE, false)) {<NEW_LINE>this.getProject().getLogger().warn("Non-recommended Quarkus platform BOM and/or extension versions were found. For more details, please, execute 'gradle quarkusUpdate --rectify'");<NEW_LINE>}<NEW_LINE>} | throw new GradleException("Failed to collect Quarkus project information", e); |
819,238 | private void commandLods(Instruction instruction, int flags) {<NEW_LINE>int addressSize;<NEW_LINE>int rSI, rCX;<NEW_LINE>switch(instruction.getOp1Kind()) {<NEW_LINE>case OpKind.MEMORY_SEG_SI:<NEW_LINE>addressSize = CodeSize.CODE16;<NEW_LINE>rSI = Register.SI;<NEW_LINE>rCX = Register.CX;<NEW_LINE>break;<NEW_LINE>case OpKind.MEMORY_SEG_ESI:<NEW_LINE>addressSize = CodeSize.CODE32;<NEW_LINE>rSI = Register.ESI;<NEW_LINE>rCX = Register.ECX;<NEW_LINE>break;<NEW_LINE>default:<NEW_LINE>addressSize = CodeSize.CODE64;<NEW_LINE>rSI = Register.RSI;<NEW_LINE>rCX = Register.RCX;<NEW_LINE>break;<NEW_LINE>}<NEW_LINE>if (instruction.getRepePrefix() || instruction.getRepnePrefix()) {<NEW_LINE>info.opAccesses[0] = (byte) OpAccess.COND_WRITE;<NEW_LINE>info.opAccesses[1] = (byte) OpAccess.COND_READ;<NEW_LINE>if ((flags & Flags.NO_MEMORY_USAGE) == 0)<NEW_LINE>addMemory(instruction.getMemorySegment(), rSI, Register.NONE, 1, 0, MemorySize.UNKNOWN, OpAccess.COND_READ, addressSize, 0);<NEW_LINE>if ((flags & Flags.NO_REGISTER_USAGE) == 0) {<NEW_LINE>assert info.usedRegisters.size() == 1 <MASK><NEW_LINE>info.usedRegisters.set(0, new UsedRegister(info.usedRegisters.get(0).getRegister(), OpAccess.COND_WRITE));<NEW_LINE>addRegister(flags, rCX, OpAccess.READ_COND_WRITE);<NEW_LINE>addMemorySegmentRegister(flags, instruction.getMemorySegment(), OpAccess.COND_READ);<NEW_LINE>addRegister(flags, rSI, OpAccess.COND_READ);<NEW_LINE>addRegister(flags, rSI, OpAccess.COND_WRITE);<NEW_LINE>}<NEW_LINE>} else {<NEW_LINE>if ((flags & Flags.NO_MEMORY_USAGE) == 0)<NEW_LINE>addMemory(instruction.getMemorySegment(), rSI, Register.NONE, 1, 0, instruction.getMemorySize(), OpAccess.READ, addressSize, 0);<NEW_LINE>if ((flags & Flags.NO_REGISTER_USAGE) == 0) {<NEW_LINE>addMemorySegmentRegister(flags, instruction.getMemorySegment(), OpAccess.READ);<NEW_LINE>addRegister(flags, rSI, OpAccess.READ_WRITE);<NEW_LINE>}<NEW_LINE>}<NEW_LINE>} | : info.usedRegisters.size(); |
882,039 | public int readI32() throws TException {<NEW_LINE>readCurrentContext();<NEW_LINE>final Class<?> fieldClass = getCurrentFieldClassIfIs(TEnum.class);<NEW_LINE>if (fieldClass != null) {<NEW_LINE>// Enum fields may be set by string, even though they represent integers.<NEW_LINE>final JsonNode elem = getCurrentContext().getCurrentChild();<NEW_LINE>if (elem.isInt() || Ints.tryParse(elem.asText()) != null) {<NEW_LINE>return <MASK><NEW_LINE>} else if (elem.isTextual()) {<NEW_LINE>// All TEnum are enums<NEW_LINE>@SuppressWarnings({ "unchecked", "rawtypes" })<NEW_LINE>final TEnum tEnum = (TEnum) Enum.valueOf((Class<Enum>) fieldClass, TypedParser.STRING.readFromJsonElement(elem));<NEW_LINE>return tEnum.getValue();<NEW_LINE>} else {<NEW_LINE>throw new TTransportException("invalid value type for enum field: " + elem.getNodeType() + " (" + elem + ')');<NEW_LINE>}<NEW_LINE>} else {<NEW_LINE>return readNameOrValue(TypedParser.INTEGER);<NEW_LINE>}<NEW_LINE>} | TypedParser.INTEGER.readFromJsonElement(elem); |
613,592 | static Set<String> prepareSystemProperties(@NonNull final Context context, @NonNull final Map<String, Object> properties, final boolean test) {<NEW_LINE>String prefix = test <MASK><NEW_LINE>Map<String, String> evaluated = context.getPropertyEvaluator().getProperties();<NEW_LINE>if (evaluated == null) {<NEW_LINE>return null;<NEW_LINE>}<NEW_LINE>for (Map.Entry<String, String> e : evaluated.entrySet()) {<NEW_LINE>if (e.getKey().startsWith(prefix) && e.getValue() != null) {<NEW_LINE>putMultiValue(properties, JavaRunner.PROP_RUN_JVMARGS, "-D" + e.getKey().substring(prefix.length()) + "=" + e.getValue());<NEW_LINE>}<NEW_LINE>}<NEW_LINE>collectStartupExtenderArgs(context, (k, v) -> {<NEW_LINE>properties.put(k, v);<NEW_LINE>return null;<NEW_LINE>});<NEW_LINE>return context.copyAdditionalProperties(properties);<NEW_LINE>} | ? ProjectProperties.SYSTEM_PROPERTIES_TEST_PREFIX : ProjectProperties.SYSTEM_PROPERTIES_RUN_PREFIX; |
1,273,262 | public static void wrapScalarBlock(TensorType type, List<String> dimensionOrder, String mappedDimensionLabel, List<ExpressionNode> nodes, Map<TensorAddress, ScalarFunction<Reference>> receivingMap) {<NEW_LINE>TensorType denseSubtype = new TensorType(type.valueType(), type.dimensions().stream().filter(d -> d.isIndexed()).collect(Collectors.toList()));<NEW_LINE>List<String> denseDimensionOrder = new ArrayList<>(dimensionOrder);<NEW_LINE>denseDimensionOrder.<MASK><NEW_LINE>IndexedTensor.Indexes indexes = IndexedTensor.Indexes.of(denseSubtype, denseDimensionOrder);<NEW_LINE>if (indexes.size() != nodes.size())<NEW_LINE>throw new IllegalArgumentException("At '" + mappedDimensionLabel + "': Need " + indexes.size() + " values to fill a dense subspace of " + type + " but got " + nodes.size());<NEW_LINE>for (ExpressionNode node : nodes) {<NEW_LINE>indexes.next();<NEW_LINE>// Insert the mapped dimension into the dense subspace address of indexes<NEW_LINE>String[] labels = new String[type.rank()];<NEW_LINE>int indexedDimensionsIndex = 0;<NEW_LINE>int allDimensionsIndex = 0;<NEW_LINE>for (TensorType.Dimension dimension : type.dimensions()) {<NEW_LINE>if (dimension.isIndexed())<NEW_LINE>labels[allDimensionsIndex++] = String.valueOf(indexes.indexesForReading()[indexedDimensionsIndex++]);<NEW_LINE>else<NEW_LINE>labels[allDimensionsIndex++] = mappedDimensionLabel;<NEW_LINE>}<NEW_LINE>receivingMap.put(TensorAddress.of(labels), wrapScalar(node));<NEW_LINE>}<NEW_LINE>} | retainAll(denseSubtype.dimensionNames()); |
1,055,940 | public String addNzb(byte[] fileContent, String title, String category) throws DownloaderException {<NEW_LINE>// Using OKHTTP here because RestTemplate wouldn't work<NEW_LINE>logger.debug("Uploading NZB {} to sabnzbd", title);<NEW_LINE>UriComponentsBuilder urlBuilder = getBaseUrl();<NEW_LINE>title = suffixNzbToTitle(title);<NEW_LINE>urlBuilder.queryParam("mode", "addfile").queryParam("nzbname", title).queryParam("priority", getPriority());<NEW_LINE>if (!Strings.isNullOrEmpty(category)) {<NEW_LINE>urlBuilder.queryParam("cat", category);<NEW_LINE>}<NEW_LINE>RequestBody formBody = new MultipartBody.Builder().addFormDataPart("name", title, RequestBody.create(MediaType.parse(org.springframework.http.MediaType.APPLICATION_XML_VALUE), fileContent)).build();<NEW_LINE>Request request = new Request.Builder().url(urlBuilder.toUriString()).post(formBody).build();<NEW_LINE>OkHttpClient client = requestFactory.getOkHttpClientBuilder(urlBuilder.build().encode().toUri()).build();<NEW_LINE>try (Response response = client.newCall(request).execute();<NEW_LINE>ResponseBody body = response.body()) {<NEW_LINE>if (!response.isSuccessful()) {<NEW_LINE>throw new DownloaderException("Downloader returned status code " + response.code() + " and message " + response.message());<NEW_LINE>}<NEW_LINE>final <MASK><NEW_LINE>AddNzbResponse addNzbResponse = Jackson.JSON_MAPPER.readValue(bodyContent, AddNzbResponse.class);<NEW_LINE>if (addNzbResponse.getNzoIds().isEmpty()) {<NEW_LINE>// We'll assume this is a duplicate, the documentation doesn't say anything about it<NEW_LINE>logger.warn("Tried to add NZB \"{}\" but sabNZBd reports it as a duplicate", title);<NEW_LINE>throw new DuplicateNzbException("Duplicate: " + title);<NEW_LINE>}<NEW_LINE>String nzoId = addNzbResponse.getNzoIds().get(0);<NEW_LINE>logger.info("Successfully added NZB \"{}\" to sabnzbd queue with ID {}", title, nzoId);<NEW_LINE>return nzoId;<NEW_LINE>} catch (IOException e) {<NEW_LINE>throw new DownloaderException("Error while communicating with downloader: " + e.getMessage());<NEW_LINE>}<NEW_LINE>} | String bodyContent = body.string(); |
713,636 | public void specialOkResponse(AbstractService service) {<NEW_LINE>ShardingService shardingService = session.getShardingService();<NEW_LINE>lock.lock();<NEW_LINE>try {<NEW_LINE>errorNodeCount++;<NEW_LINE>decrementToZero((MySQLResponseService) service);<NEW_LINE>if (unResponseRrns.size() != 0 || dnSet.size() > errorNodeCount) {<NEW_LINE>if (LOGGER.isDebugEnabled()) {<NEW_LINE>LOGGER.debug("errorCount " + errorCount + " warningSize = " + LoadDataBatch.getInstance().getWarnings().size());<NEW_LINE>}<NEW_LINE>return;<NEW_LINE>}<NEW_LINE>if (rrs.isGlobalTable()) {<NEW_LINE>affectedRows = affectedRows / LoadDataBatch.getInstance().getCurrentNodeSize();<NEW_LINE>}<NEW_LINE>shardingService.getLoadDataInfileHandler().clearFile(LoadDataBatch.getInstance().getSuccessFileNames());<NEW_LINE>if (isFail()) {<NEW_LINE>ErrorPacket errorPacket = createErrPkg(this.error, err.getErrNo());<NEW_LINE>handleEndPacket(<MASK><NEW_LINE>return;<NEW_LINE>}<NEW_LINE>packet.setMessage(("Records: " + affectedRows + " Deleted: 0 Skipped: 0 Warnings:" + errorCount + "\r\n" + toStringForWarning(LoadDataBatch.getInstance().getWarnings())).getBytes());<NEW_LINE>session.setRowCount(affectedRows);<NEW_LINE>shardingService.setLastInsertId(packet.getInsertId());<NEW_LINE>handleEndPacket(packet, AutoTxOperation.ROLLBACK, true);<NEW_LINE>} finally {<NEW_LINE>lock.unlock();<NEW_LINE>}<NEW_LINE>} | errorPacket, AutoTxOperation.ROLLBACK, false); |
1,100,515 | public boolean updateClusterPassword(final UpdateHostPasswordCmd command) {<NEW_LINE>final boolean shouldUpdateHostPasswd = command.getUpdatePasswdOnHost();<NEW_LINE>// get agents for the cluster<NEW_LINE>final List<HostVO> hosts = listAllHostsInCluster(command.getClusterId());<NEW_LINE>for (final HostVO host : hosts) {<NEW_LINE>try {<NEW_LINE>final Boolean result = propagateResourceEvent(host.getId(), ResourceState.Event.UpdatePassword);<NEW_LINE>if (result != null) {<NEW_LINE>return result;<NEW_LINE>}<NEW_LINE>} catch (final AgentUnavailableException e) {<NEW_LINE>s_logger.error("Agent is not available!", e);<NEW_LINE>}<NEW_LINE>if (shouldUpdateHostPasswd) {<NEW_LINE>final boolean isUpdated = <MASK><NEW_LINE>if (!isUpdated) {<NEW_LINE>throw new CloudRuntimeException(String.format("CloudStack failed to update the password of %s. Please make sure you are still able to connect to your hosts.", host));<NEW_LINE>}<NEW_LINE>}<NEW_LINE>}<NEW_LINE>return true;<NEW_LINE>} | doUpdateHostPassword(host.getId()); |
1,798,194 | final RestoreImageFromRecycleBinResult executeRestoreImageFromRecycleBin(RestoreImageFromRecycleBinRequest restoreImageFromRecycleBinRequest) {<NEW_LINE>ExecutionContext executionContext = createExecutionContext(restoreImageFromRecycleBinRequest);<NEW_LINE>AWSRequestMetrics awsRequestMetrics = executionContext.getAwsRequestMetrics();<NEW_LINE>awsRequestMetrics.startEvent(Field.ClientExecuteTime);<NEW_LINE>Request<RestoreImageFromRecycleBinRequest> request = null;<NEW_LINE>Response<RestoreImageFromRecycleBinResult> response = null;<NEW_LINE>try {<NEW_LINE>awsRequestMetrics.startEvent(Field.RequestMarshallTime);<NEW_LINE>try {<NEW_LINE>request = new RestoreImageFromRecycleBinRequestMarshaller().marshall(super.beforeMarshalling(restoreImageFromRecycleBinRequest));<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.<MASK><NEW_LINE>request.addHandlerContext(HandlerContextKey.ADVANCED_CONFIG, advancedConfig);<NEW_LINE>} finally {<NEW_LINE>awsRequestMetrics.endEvent(Field.RequestMarshallTime);<NEW_LINE>}<NEW_LINE>StaxResponseHandler<RestoreImageFromRecycleBinResult> responseHandler = new StaxResponseHandler<RestoreImageFromRecycleBinResult>(new RestoreImageFromRecycleBinResultStaxUnmarshaller());<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.OPERATION_NAME, "RestoreImageFromRecycleBin"); |
1,090,928 | public com.amazonaws.services.cloudwatchevidently.model.ServiceUnavailableException unmarshallFromContext(JsonUnmarshallerContext context) throws Exception {<NEW_LINE>com.amazonaws.services.cloudwatchevidently.model.ServiceUnavailableException serviceUnavailableException = new com.amazonaws.services.cloudwatchevidently.model.ServiceUnavailableException(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>} 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 serviceUnavailableException;<NEW_LINE>} | JsonToken token = context.getCurrentToken(); |
265,740 | public I_S_Resource findPlantFromOrNull(final I_DD_OrderLine ddOrderLine) {<NEW_LINE>Check.assumeNotNull(ddOrderLine, LiberoException.class, "ddOrderLine not null");<NEW_LINE>//<NEW_LINE>// First, if we were asked to keep the target plant, let's do it<NEW_LINE>if (ddOrderLine.isKeepTargetPlant()) {<NEW_LINE>final I_S_Resource plantTo = ddOrderLine.getDD_Order().getPP_Plant();<NEW_LINE>final I_S_Resource plantFrom = plantTo;<NEW_LINE>return plantFrom;<NEW_LINE>}<NEW_LINE>//<NEW_LINE>// Search for Warehouse's Plant<NEW_LINE>final int adOrgId = ddOrderLine.getAD_Org_ID();<NEW_LINE>final int fromLocatorRepoId = ddOrderLine.getM_Locator_ID();<NEW_LINE>final I_M_Warehouse warehouseFrom = warehouseDAO.<MASK><NEW_LINE>Check.assumeNotNull(warehouseFrom, "warehouseFrom not null");<NEW_LINE>try {<NEW_LINE>return productPlanningDAO.findPlant(adOrgId, warehouseFrom, ddOrderLine.getM_Product_ID(), ddOrderLine.getM_AttributeSetInstance_ID());<NEW_LINE>} catch (final NoPlantForWarehouseException e) {<NEW_LINE>// just ignore it<NEW_LINE>// NOTE: we are logging as FINE because it's a common case if u are not doing manufacturing to get this error<NEW_LINE>logger.debug("No plant was found. Returning null.", e);<NEW_LINE>}<NEW_LINE>//<NEW_LINE>// No Plant found => return null<NEW_LINE>return null;<NEW_LINE>} | getWarehouseByLocatorRepoId(ddOrderLine.getM_Locator_ID()); |
705,245 | public static GetHeatMapDataResponse unmarshall(GetHeatMapDataResponse getHeatMapDataResponse, UnmarshallerContext _ctx) {<NEW_LINE>getHeatMapDataResponse.setEMapName(_ctx.stringValue("GetHeatMapDataResponse.EMapName"));<NEW_LINE>getHeatMapDataResponse.setWidth(_ctx.floatValue("GetHeatMapDataResponse.Width"));<NEW_LINE>getHeatMapDataResponse.setEMapUrl(_ctx.stringValue("GetHeatMapDataResponse.EMapUrl"));<NEW_LINE>getHeatMapDataResponse.setStoreId(_ctx.longValue("GetHeatMapDataResponse.StoreId"));<NEW_LINE>getHeatMapDataResponse.setHeight(_ctx.floatValue("GetHeatMapDataResponse.Height"));<NEW_LINE>List<HeatMapItem> heatMapItems <MASK><NEW_LINE>for (int i = 0; i < _ctx.lengthValue("GetHeatMapDataResponse.HeatMapItems.Length"); i++) {<NEW_LINE>HeatMapItem heatMapItem = new HeatMapItem();<NEW_LINE>heatMapItem.setY(_ctx.floatValue("GetHeatMapDataResponse.HeatMapItems[" + i + "].Y"));<NEW_LINE>heatMapItem.setWeight(_ctx.floatValue("GetHeatMapDataResponse.HeatMapItems[" + i + "].Weight"));<NEW_LINE>heatMapItem.setX(_ctx.floatValue("GetHeatMapDataResponse.HeatMapItems[" + i + "].X"));<NEW_LINE>heatMapItems.add(heatMapItem);<NEW_LINE>}<NEW_LINE>getHeatMapDataResponse.setHeatMapItems(heatMapItems);<NEW_LINE>return getHeatMapDataResponse;<NEW_LINE>} | = new ArrayList<HeatMapItem>(); |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.