idx int32 46 1.86M | input stringlengths 321 6.6k | target stringlengths 9 1.24k |
|---|---|---|
1,658,083 | protected void installApkFiles(ApkSource aApkSource) {<NEW_LINE>cleanOldSessions();<NEW_LINE>PackageInstaller.Session session = null;<NEW_LINE>try (ApkSource apkSource = aApkSource) {<NEW_LINE>PackageInstaller.SessionParams sessionParams = new PackageInstaller.SessionParams(PackageInstaller.SessionParams.MODE_FULL_INSTALL);<NEW_LINE>sessionParams.setInstallLocation(PreferencesHelper.getInstance(getContext()).getInstallLocation());<NEW_LINE>if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.O)<NEW_LINE>sessionParams.setInstallReason(PackageManager.INSTALL_REASON_USER);<NEW_LINE>int sessionID = mPackageInstaller.createSession(sessionParams);<NEW_LINE>mSessionsMap.put(sessionID, getOngoingInstallation().getId());<NEW_LINE><MASK><NEW_LINE>int currentApkFile = 0;<NEW_LINE>while (apkSource.nextApk()) {<NEW_LINE>try (InputStream inputStream = apkSource.openApkInputStream();<NEW_LINE>OutputStream outputStream = session.openWrite(String.format("%d.apk", currentApkFile++), 0, apkSource.getApkLength())) {<NEW_LINE>IOUtils.copyStream(inputStream, outputStream);<NEW_LINE>session.fsync(outputStream);<NEW_LINE>}<NEW_LINE>}<NEW_LINE>Intent callbackIntent = new Intent(getContext(), RootlessSAIPIService.class);<NEW_LINE>PendingIntent pendingIntent = PendingIntent.getService(getContext(), 0, callbackIntent, 0);<NEW_LINE>session.commit(pendingIntent.getIntentSender());<NEW_LINE>} catch (Exception e) {<NEW_LINE>Log.w(TAG, e);<NEW_LINE>dispatchCurrentSessionUpdate(InstallationStatus.INSTALLATION_FAILED, getContext().getString(R.string.installer_error_rootless, Utils.throwableToString(e)));<NEW_LINE>installationCompleted();<NEW_LINE>} finally {<NEW_LINE>if (session != null)<NEW_LINE>session.close();<NEW_LINE>}<NEW_LINE>} | session = mPackageInstaller.openSession(sessionID); |
1,187,513 | final DeleteVcenterClientResult executeDeleteVcenterClient(DeleteVcenterClientRequest deleteVcenterClientRequest) {<NEW_LINE>ExecutionContext executionContext = createExecutionContext(deleteVcenterClientRequest);<NEW_LINE>AWSRequestMetrics awsRequestMetrics = executionContext.getAwsRequestMetrics();<NEW_LINE>awsRequestMetrics.startEvent(Field.ClientExecuteTime);<NEW_LINE>Request<DeleteVcenterClientRequest> request = null;<NEW_LINE>Response<DeleteVcenterClientResult> response = null;<NEW_LINE>try {<NEW_LINE>awsRequestMetrics.startEvent(Field.RequestMarshallTime);<NEW_LINE>try {<NEW_LINE>request = new DeleteVcenterClientRequestProtocolMarshaller(protocolFactory).marshall(super.beforeMarshalling(deleteVcenterClientRequest));<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(<MASK><NEW_LINE>request.addHandlerContext(HandlerContextKey.SIGNING_REGION, getSigningRegion());<NEW_LINE>request.addHandlerContext(HandlerContextKey.SERVICE_ID, "mgn");<NEW_LINE>request.addHandlerContext(HandlerContextKey.OPERATION_NAME, "DeleteVcenterClient");<NEW_LINE>request.addHandlerContext(HandlerContextKey.ADVANCED_CONFIG, advancedConfig);<NEW_LINE>} finally {<NEW_LINE>awsRequestMetrics.endEvent(Field.RequestMarshallTime);<NEW_LINE>}<NEW_LINE>HttpResponseHandler<AmazonWebServiceResponse<DeleteVcenterClientResult>> responseHandler = protocolFactory.createResponseHandler(new JsonOperationMetadata().withPayloadJson(true).withHasStreamingSuccessResponse(false), new DeleteVcenterClientResultJsonUnmarshaller());<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>} | HandlerContextKey.ENDPOINT_OVERRIDDEN, isEndpointOverridden()); |
748,131 | // todo use template<NEW_LINE>@Override<NEW_LINE>public void implement() throws Exception {<NEW_LINE>final StringBuilder insertText = new StringBuilder();<NEW_LINE>// NOI18N<NEW_LINE>insertText.append(' ');<NEW_LINE>Iterator<Attribute> i = attrs.iterator();<NEW_LINE>while (i.hasNext()) {<NEW_LINE>Attribute a = i.next();<NEW_LINE>insertText.append(a.getName());<NEW_LINE>// NOI18N<NEW_LINE>insertText.append("=\"\"");<NEW_LINE>if (i.hasNext()) {<NEW_LINE>// NOI18N<NEW_LINE>insertText.append(' ');<NEW_LINE>}<NEW_LINE>}<NEW_LINE>final BaseDocument document = (BaseDocument) snapshot.getSource().getDocument(true);<NEW_LINE>document.runAtomicAsUser(new Runnable() {<NEW_LINE><NEW_LINE>@Override<NEW_LINE>public void run() {<NEW_LINE>try {<NEW_LINE>int insertOffset = openTag.from() + "<".length() + openTag.name().length();<NEW_LINE>int documentInsertOffset = snapshot.getOriginalOffset(insertOffset);<NEW_LINE>document.insertString(documentInsertOffset, <MASK><NEW_LINE>} catch (BadLocationException ex) {<NEW_LINE>Exceptions.printStackTrace(ex);<NEW_LINE>}<NEW_LINE>}<NEW_LINE>});<NEW_LINE>LexerUtils.rebuildTokenHierarchy(document);<NEW_LINE>} | insertText.toString(), null); |
784,984 | public // !! This function must be always called from try-with-resources block, otherwise vault secret may be leaked !!<NEW_LINE>LDAPQuery createGroupQuery(boolean includeMemberAttribute) {<NEW_LINE>LDAPQuery ldapQuery = new LDAPQuery(ldapProvider);<NEW_LINE>// For now, use same search scope, which is configured "globally" and used for user's search.<NEW_LINE>ldapQuery.setSearchScope(ldapProvider.getLdapIdentityStore().getConfig().getSearchScope());<NEW_LINE>String groupsDn = config.getGroupsDn();<NEW_LINE>ldapQuery.setSearchDn(groupsDn);<NEW_LINE>Collection<String> groupObjectClasses = config.getGroupObjectClasses(ldapProvider);<NEW_LINE>ldapQuery.addObjectClasses(groupObjectClasses);<NEW_LINE>String customFilter = config.getCustomLdapFilter();<NEW_LINE>if (customFilter != null && customFilter.trim().length() > 0) {<NEW_LINE>Condition customFilterCondition = new LDAPQueryConditionsBuilder().addCustomLDAPFilter(customFilter);<NEW_LINE>ldapQuery.addWhereCondition(customFilterCondition);<NEW_LINE>}<NEW_LINE>ldapQuery.<MASK><NEW_LINE>// Performance improvement<NEW_LINE>if (includeMemberAttribute) {<NEW_LINE>ldapQuery.addReturningLdapAttribute(config.getMembershipLdapAttribute());<NEW_LINE>}<NEW_LINE>for (String groupAttr : config.getGroupAttributes()) {<NEW_LINE>ldapQuery.addReturningLdapAttribute(groupAttr);<NEW_LINE>}<NEW_LINE>return ldapQuery;<NEW_LINE>} | addReturningLdapAttribute(config.getGroupNameLdapAttribute()); |
1,320,621 | public Request<ListVocabularyFiltersRequest> marshall(ListVocabularyFiltersRequest listVocabularyFiltersRequest) {<NEW_LINE>if (listVocabularyFiltersRequest == null) {<NEW_LINE>throw new AmazonClientException("Invalid argument passed to marshall(ListVocabularyFiltersRequest)");<NEW_LINE>}<NEW_LINE>Request<ListVocabularyFiltersRequest> request = new DefaultRequest<ListVocabularyFiltersRequest>(listVocabularyFiltersRequest, "AmazonTranscribe");<NEW_LINE>String target = "Transcribe.ListVocabularyFilters";<NEW_LINE>request.addHeader("X-Amz-Target", target);<NEW_LINE>request.setHttpMethod(HttpMethodName.POST);<NEW_LINE>String uriResourcePath = "/";<NEW_LINE>request.setResourcePath(uriResourcePath);<NEW_LINE>try {<NEW_LINE>StringWriter stringWriter = new StringWriter();<NEW_LINE>AwsJsonWriter jsonWriter = JsonUtils.getJsonWriter(stringWriter);<NEW_LINE>jsonWriter.beginObject();<NEW_LINE>if (listVocabularyFiltersRequest.getNextToken() != null) {<NEW_LINE>String nextToken = listVocabularyFiltersRequest.getNextToken();<NEW_LINE>jsonWriter.name("NextToken");<NEW_LINE>jsonWriter.value(nextToken);<NEW_LINE>}<NEW_LINE>if (listVocabularyFiltersRequest.getMaxResults() != null) {<NEW_LINE>Integer maxResults = listVocabularyFiltersRequest.getMaxResults();<NEW_LINE>jsonWriter.name("MaxResults");<NEW_LINE>jsonWriter.value(maxResults);<NEW_LINE>}<NEW_LINE>if (listVocabularyFiltersRequest.getNameContains() != null) {<NEW_LINE>String nameContains = listVocabularyFiltersRequest.getNameContains();<NEW_LINE>jsonWriter.name("NameContains");<NEW_LINE>jsonWriter.value(nameContains);<NEW_LINE>}<NEW_LINE>jsonWriter.endObject();<NEW_LINE>jsonWriter.close();<NEW_LINE>String snippet = stringWriter.toString();<NEW_LINE>byte[] content = snippet.getBytes(UTF8);<NEW_LINE>request.setContent(new StringInputStream(snippet));<NEW_LINE>request.addHeader("Content-Length", Integer<MASK><NEW_LINE>} catch (Throwable t) {<NEW_LINE>throw new AmazonClientException("Unable to marshall request to JSON: " + t.getMessage(), t);<NEW_LINE>}<NEW_LINE>if (!request.getHeaders().containsKey("Content-Type")) {<NEW_LINE>request.addHeader("Content-Type", "application/x-amz-json-1.1");<NEW_LINE>}<NEW_LINE>return request;<NEW_LINE>} | .toString(content.length)); |
1,698,368 | public Object postProcessAfterInitialization(Object bean, String beanName) throws BeansException {<NEW_LINE>// Wrap the caching connection factories instead of its target, because it catches<NEW_LINE>// callbacks<NEW_LINE>// such as ExceptionListener. If we don't wrap, cached callbacks like this won't<NEW_LINE>// be traced.<NEW_LINE>if (bean instanceof CachingConnectionFactory) {<NEW_LINE>return new LazyConnectionFactory(this.beanFactory, (CachingConnectionFactory) bean);<NEW_LINE>}<NEW_LINE>if (bean instanceof JmsMessageEndpointManager) {<NEW_LINE>JmsMessageEndpointManager manager = (JmsMessageEndpointManager) bean;<NEW_LINE>MessageListener listener = manager.getMessageListener();<NEW_LINE>if (listener != null) {<NEW_LINE>manager.setMessageListener(new LazyMessageListener(this.beanFactory, listener));<NEW_LINE>}<NEW_LINE>return bean;<NEW_LINE>}<NEW_LINE>if (bean instanceof XAConnectionFactory && bean instanceof ConnectionFactory) {<NEW_LINE>return new LazyConnectionAndXaConnectionFactory(this.beanFactory, (ConnectionFactory) bean, (XAConnectionFactory) bean);<NEW_LINE>} else // We check XA first in case the ConnectionFactory also implements<NEW_LINE>// XAConnectionFactory<NEW_LINE>if (bean instanceof XAConnectionFactory) {<NEW_LINE>return new LazyXAConnectionFactory(this.beanFactory, (XAConnectionFactory) bean);<NEW_LINE>} else if (bean instanceof TopicConnectionFactory) {<NEW_LINE>return new LazyTopicConnectionFactory(this.beanFactory, (TopicConnectionFactory) bean);<NEW_LINE>} else if (bean instanceof ConnectionFactory) {<NEW_LINE>return new LazyConnectionFactory(this<MASK><NEW_LINE>}<NEW_LINE>return bean;<NEW_LINE>} | .beanFactory, (ConnectionFactory) bean); |
1,153,663 | public byte[] download(String reportID, String processState) throws XDocReportException {<NEW_LINE>XDocArchive archive = null;<NEW_LINE>ByteArrayOutputStream out = new ByteArrayOutputStream();<NEW_LINE>IXDocReport report = getXDocReportRegistry().getReport(reportID);<NEW_LINE>if (report == null)<NEW_LINE>throw new XDocReportException("report not found " + reportID);<NEW_LINE>if (ProcessState.ORIGINAL.name().equalsIgnoreCase(processState)) {<NEW_LINE>archive = report.getOriginalDocumentArchive().createCopy();<NEW_LINE>} else if (ProcessState.PREPROCESSED.name().equalsIgnoreCase(processState)) {<NEW_LINE>archive = report<MASK><NEW_LINE>} else {<NEW_LINE>throw new XDocReportException("processState should be " + ProcessState.ORIGINAL + " or " + ProcessState.PREPROCESSED);<NEW_LINE>}<NEW_LINE>try {<NEW_LINE>XDocArchive.writeZip(archive, out);<NEW_LINE>} catch (IOException e) {<NEW_LINE>LOGGER.severe(e.getMessage());<NEW_LINE>throw new XDocReportException(e.getMessage());<NEW_LINE>}<NEW_LINE>return out.toByteArray();<NEW_LINE>} | .getPreprocessedDocumentArchive().createCopy(); |
1,358,212 | private void dumpCategoriesArgsStatistics(PrintStream out) {<NEW_LINE>HashMap<String, Counters> data = new HashMap<>();<NEW_LINE>for (Stat stat : stats.values()) {<NEW_LINE>// NOI18N<NEW_LINE>String id = stat.category + "%" + Arrays.toString(stat.args);<NEW_LINE>Counters counters = data.get(id);<NEW_LINE>if (counters == null) {<NEW_LINE>counters = new Counters();<NEW_LINE>data.put(id, counters);<NEW_LINE>}<NEW_LINE>counters.add(stat);<NEW_LINE>}<NEW_LINE>// NOI18N<NEW_LINE>out.printf("== Arguments statistics start ==\n");<NEW_LINE>// NOI18N<NEW_LINE>out.printf("%20s|%8s|%8s|%10s|%s\n", "Category", "Count", "Time", "~Traffic", "Args");<NEW_LINE>LinkedList<Map.Entry<String, Counters>> dataList = new LinkedList<>(data.entrySet());<NEW_LINE>Collections.sort(dataList, new CategoriesStatComparator());<NEW_LINE>for (Map.Entry<String, Counters> entry : dataList) {<NEW_LINE>String cat = entry.getKey();<NEW_LINE>int <MASK><NEW_LINE>Counters cnts = entry.getValue();<NEW_LINE>// NOI18N<NEW_LINE>out.printf("%20s|%8d|%8d|%10d|%s\n", cat.substring(0, idx), cnts.count.get(), cnts.time.get(), cnts.supposedTraffic.get(), cat.substring(idx + 1));<NEW_LINE>}<NEW_LINE>// NOI18N<NEW_LINE>out.printf("== Arguments statistics end ==\n");<NEW_LINE>} | idx = cat.indexOf('%'); |
670,604 | private void refreshIdentity(NodeAgentContext context, ContainerPath privateKeyFile, ContainerPath certificateFile, ContainerPath identityDocumentFile) {<NEW_LINE>SignedIdentityDocument identityDocument = EntityBindingsMapper.readSignedIdentityDocumentFromFile(identityDocumentFile);<NEW_LINE>KeyPair keyPair = KeyUtils.generateKeypair(KeyAlgorithm.RSA);<NEW_LINE>Pkcs10Csr csr = csrGenerator.generateInstanceCsr(context.identity(), identityDocument.providerUniqueId(), identityDocument.ipAddresses(), keyPair);<NEW_LINE>SSLContext containerIdentitySslContext = new SslContextBuilder().withKeyStore(privateKeyFile, certificateFile).withTrustStore(trustStorePath, KeyStoreType.JKS).build();<NEW_LINE>try {<NEW_LINE>// Set up a hostname verified for zts if this is configured to use the config server (internal zts) apis<NEW_LINE>HostnameVerifier ztsHostNameVerifier = useInternalZts ? new AthenzIdentityVerifier(Set.of(configserverIdentity)) : null;<NEW_LINE>try (ZtsClient ztsClient = new DefaultZtsClient.Builder(ztsEndpoint).withSslContext(containerIdentitySslContext).withHostnameVerifier(ztsHostNameVerifier).build()) {<NEW_LINE>InstanceIdentity instanceIdentity = ztsClient.refreshInstance(configserverIdentity, context.identity(), identityDocument.providerUniqueId().asDottedString(), csr);<NEW_LINE>writePrivateKeyAndCertificate(privateKeyFile, keyPair.getPrivate(), certificateFile, instanceIdentity.certificate());<NEW_LINE>context.log(logger, "Instance successfully refreshed and credentials written to file");<NEW_LINE>} catch (ZtsClientException e) {<NEW_LINE>if (e.getErrorCode() == 403 && e.getDescription().startsWith("Certificate revoked")) {<NEW_LINE>context.log(logger, Level.SEVERE, "Certificate cannot be refreshed as it is revoked by ZTS - re-registering the instance now", e);<NEW_LINE>registerIdentity(<MASK><NEW_LINE>} else {<NEW_LINE>throw e;<NEW_LINE>}<NEW_LINE>}<NEW_LINE>} catch (Exception e) {<NEW_LINE>context.log(logger, Level.SEVERE, "Certificate refresh failed: " + e.getMessage(), e);<NEW_LINE>}<NEW_LINE>} | context, privateKeyFile, certificateFile, identityDocumentFile); |
1,853,901 | public boolean isStatisticsEnabled(ServletEvent evt) {<NEW_LINE>Object evtSrc = evt.getSource();<NEW_LINE>if (evtSrc instanceof IServletWrapper) {<NEW_LINE>IServletConfig sConfig = (IServletConfig) ((IServletWrapper) evtSrc).getServletConfig();<NEW_LINE>if (sConfig == null || sConfig.isStatisticsEnabled()) {<NEW_LINE>if (com.ibm.websphere.ras.TraceComponent.isAnyTracingEnabled() && logger.isLoggable(Level.FINE))<NEW_LINE>logger.logp(Level.FINE, CLASS_NAME, "isStatisticsEnabled", "pmi enabled for the servlet-->[" + evt.getServletName() + "]");<NEW_LINE>return true;<NEW_LINE>} else {<NEW_LINE>if (com.ibm.websphere.ras.TraceComponent.isAnyTracingEnabled() && logger.isLoggable(Level.FINE))<NEW_LINE>logger.logp(Level.FINE, CLASS_NAME, "isStatisticsEnabled", "pmi disabled for the servlet-->[" + <MASK><NEW_LINE>return false;<NEW_LINE>}<NEW_LINE>} else {<NEW_LINE>if (com.ibm.websphere.ras.TraceComponent.isAnyTracingEnabled() && logger.isLoggable(Level.FINE))<NEW_LINE>logger.logp(Level.FINE, CLASS_NAME, "isStatisticsEnabled", "Event Source is not a ServletWrapper, we have to assume statistics enabled is true");<NEW_LINE>return true;<NEW_LINE>}<NEW_LINE>} | evt.getServletName() + "]"); |
1,099,048 | public Product save(Product p) {<NEW_LINE>Long id = p.getId();<NEW_LINE>if (id == null) {<NEW_LINE>id = populate(queryFactory.insert(product), p).executeWithKey(product.id);<NEW_LINE>p.setId(id);<NEW_LINE>} else {<NEW_LINE>populate(queryFactory.update(product), p).where(product.id.eq<MASK><NEW_LINE>// delete l10n rows<NEW_LINE>queryFactory.delete(productL10n).where(productL10n.productId.eq(id)).execute();<NEW_LINE>}<NEW_LINE>SQLInsertClause insert = queryFactory.insert(productL10n);<NEW_LINE>for (ProductL10n l10n : p.getLocalizations()) {<NEW_LINE>insert.set(productL10n.productId, id).set(productL10n.description, l10n.getDescription()).set(productL10n.lang, l10n.getLang()).set(productL10n.name, l10n.getName()).addBatch();<NEW_LINE>}<NEW_LINE>insert.execute();<NEW_LINE>return p;<NEW_LINE>} | (id)).execute(); |
694,445 | public YearMonth plus(long amountToAdd, TemporalUnit unit) {<NEW_LINE>if (unit instanceof ChronoUnit) {<NEW_LINE>switch((ChronoUnit) unit) {<NEW_LINE>case MONTHS:<NEW_LINE>return plusMonths(amountToAdd);<NEW_LINE>case YEARS:<NEW_LINE>return plusYears(amountToAdd);<NEW_LINE>case DECADES:<NEW_LINE>return plusYears(Jdk8Methods<MASK><NEW_LINE>case CENTURIES:<NEW_LINE>return plusYears(Jdk8Methods.safeMultiply(amountToAdd, 100));<NEW_LINE>case MILLENNIA:<NEW_LINE>return plusYears(Jdk8Methods.safeMultiply(amountToAdd, 1000));<NEW_LINE>case ERAS:<NEW_LINE>return with(ERA, Jdk8Methods.safeAdd(getLong(ERA), amountToAdd));<NEW_LINE>}<NEW_LINE>throw new UnsupportedTemporalTypeException("Unsupported unit: " + unit);<NEW_LINE>}<NEW_LINE>return unit.addTo(this, amountToAdd);<NEW_LINE>} | .safeMultiply(amountToAdd, 10)); |
1,783,478 | private boolean isNetworkAddressInCidr(String networkUuid1, String networkUuid2) {<NEW_LINE>L3NetworkVO l3vo1 = Q.New(L3NetworkVO.class).eq(L3NetworkVO_.uuid, networkUuid1).find();<NEW_LINE>L3NetworkVO l3vo2 = Q.New(L3NetworkVO.class).eq(L3NetworkVO_.uuid, networkUuid2).find();<NEW_LINE>List<IpRangeInventory> ipInvs1 = IpRangeHelper.getNormalIpRanges(l3vo1);<NEW_LINE>List<IpRangeInventory> ipInvs2 = IpRangeHelper.getNormalIpRanges(l3vo2);<NEW_LINE>List<IpRangeInventory> ip4Invs1 = ipInvs1.stream().filter(ipr -> ipr.getIpVersion() == IPv6Constants.IPv4).collect(Collectors.toList());<NEW_LINE>List<IpRangeInventory> ip4Invs2 = ipInvs2.stream().filter(ipr -> ipr.getIpVersion() == IPv6Constants.IPv4).collect(Collectors.toList());<NEW_LINE>List<IpRangeInventory> ip6Invs1 = ipInvs1.stream().filter(ipr -> ipr.getIpVersion() == IPv6Constants.IPv6).collect(Collectors.toList());<NEW_LINE>List<IpRangeInventory> ip6Invs2 = ipInvs2.stream().filter(ipr -> ipr.getIpVersion() == IPv6Constants.IPv6).collect(Collectors.toList());<NEW_LINE>return isIpv4RangeInSameCidr(ip4Invs1, ip4Invs2<MASK><NEW_LINE>} | ) || isIpv6RangeInSameCidr(ip6Invs1, ip6Invs2); |
740,804 | private JCTree.JCExpression makeUnaryIncDecCall(JCTree.JCUnary tree, TreeMaker make, Symbol.MethodSymbol operatorMethod, JCExpression operand) {<NEW_LINE>if (operatorMethod == null) {<NEW_LINE>Type unboxedType = _tp.getTypes().unboxedType(operand.type);<NEW_LINE>if (unboxedType != null && !unboxedType.hasTag(NONE)) {<NEW_LINE>operand = unbox(_tp.getTypes(), _tp.getTreeMaker(), Names.instance(JavacPlugin.instance().getContext()), _tp.getContext(), _tp.getCompilationUnit(), operand, unboxedType);<NEW_LINE>}<NEW_LINE>//<NEW_LINE>// the only way operatorMethod can be null is when the inc/dec operand is indexed, but not an array and the indexed elems are primitive<NEW_LINE>JCTree.JCExpression one = make.Literal(1);<NEW_LINE>one.pos = tree.pos;<NEW_LINE>one = make.TypeCast(operand.type, one);<NEW_LINE>one.pos = tree.pos;<NEW_LINE>JCTree.JCBinary binary = make.Binary(tree.getTag() == JCTree.Tag.PREINC || tree.getTag() == JCTree.Tag.POSTINC ? JCTree.Tag.PLUS : JCTree.Tag.MINUS, operand, one);<NEW_LINE>binary.pos = tree.pos;<NEW_LINE>binary.type = operand.type;<NEW_LINE>Env<AttrContext> env = new AttrContextEnv(tree, new AttrContext());<NEW_LINE>env.toplevel = (JCTree.JCCompilationUnit) _tp.getCompilationUnit();<NEW_LINE><MASK><NEW_LINE>binary.operator = resolveMethod(tree.pos(), Names.instance(_tp.getContext()).fromString(binary.getTag() == JCTree.Tag.PLUS ? "+" : "-"), _tp.getSymtab().predefClass.type, List.of(binary.lhs.type, binary.rhs.type));<NEW_LINE>return binary;<NEW_LINE>// maybe unbox here?<NEW_LINE>} else {<NEW_LINE>JCTree.JCMethodInvocation methodCall = make.Apply(List.nil(), make.Select(operand, operatorMethod), List.nil());<NEW_LINE>methodCall.setPos(tree.pos);<NEW_LINE>methodCall.type = operatorMethod.getReturnType();<NEW_LINE>// If methodCall is an extension method, rewrite it accordingly<NEW_LINE>methodCall = maybeReplaceWithExtensionMethod(methodCall);<NEW_LINE>return methodCall;<NEW_LINE>}<NEW_LINE>} | env.enclClass = getEnclosingClass(tree); |
934,764 | protected void createJobEntities(BatchEntity batch, T configuration, String deploymentId, List<String> processIds, int invocationsPerBatchJob) {<NEW_LINE>if (processIds == null || processIds.isEmpty()) {<NEW_LINE>return;<NEW_LINE>}<NEW_LINE>CommandContext commandContext = Context.getCommandContext();<NEW_LINE>ByteArrayManager byteArrayManager = commandContext.getByteArrayManager();<NEW_LINE>JobManager jobManager = commandContext.getJobManager();<NEW_LINE>int createdJobs = 0;<NEW_LINE>while (!processIds.isEmpty()) {<NEW_LINE>int lastIdIndex = Math.min(invocationsPerBatchJob, processIds.size());<NEW_LINE>// view of process instances for this job<NEW_LINE>List<String> idsForJob = processIds.subList(0, lastIdIndex);<NEW_LINE>T jobConfiguration = createJobConfiguration(configuration, idsForJob);<NEW_LINE>jobConfiguration.<MASK><NEW_LINE>ByteArrayEntity configurationEntity = saveConfiguration(byteArrayManager, jobConfiguration);<NEW_LINE>JobEntity job = createBatchJob(batch, configurationEntity);<NEW_LINE>job.setDeploymentId(deploymentId);<NEW_LINE>postProcessJob(configuration, job, jobConfiguration);<NEW_LINE>jobManager.insertAndHintJobExecutor(job);<NEW_LINE>idsForJob.clear();<NEW_LINE>createdJobs++;<NEW_LINE>}<NEW_LINE>// update created jobs for batch<NEW_LINE>batch.setJobsCreated(batch.getJobsCreated() + createdJobs);<NEW_LINE>} | setBatchId(batch.getId()); |
1,021,751 | public void createIfNotExistsCodeSnippets() {<NEW_LINE>// BEGIN: com.azure.storage.file.share.ShareDirectoryClient.createIfNotExists<NEW_LINE>ShareDirectoryClient shareDirectoryClient = createClientWithSASToken();<NEW_LINE>ShareDirectoryInfo shareDirectoryInfo = shareDirectoryClient.createIfNotExists();<NEW_LINE>System.out.printf(<MASK><NEW_LINE>// END: com.azure.storage.file.share.ShareDirectoryClient.createIfNotExists<NEW_LINE>// BEGIN: com.azure.storage.file.share.ShareDirectoryClient.createIfNotExistsWithResponse#ShareDirectoryCreateOptions-Duration-Context<NEW_LINE>ShareDirectoryClient directoryClient = createClientWithSASToken();<NEW_LINE>FileSmbProperties smbProperties = new FileSmbProperties();<NEW_LINE>String filePermission = "filePermission";<NEW_LINE>ShareDirectoryCreateOptions options = new ShareDirectoryCreateOptions().setSmbProperties(smbProperties).setFilePermission(filePermission).setMetadata(Collections.singletonMap("directory", "metadata"));<NEW_LINE>Response<ShareDirectoryInfo> response = directoryClient.createIfNotExistsWithResponse(options, Duration.ofSeconds(1), new Context(key1, value1));<NEW_LINE>if (response.getStatusCode() == 409) {<NEW_LINE>System.out.println("Already existed.");<NEW_LINE>} else {<NEW_LINE>System.out.printf("Create completed with status %d%n", response.getStatusCode());<NEW_LINE>}<NEW_LINE>// END: com.azure.storage.file.share.ShareDirectoryClient.createIfNotExistsWithResponse#ShareDirectoryCreateOptions-Duration-Context<NEW_LINE>} | "Last Modified Time:%s", shareDirectoryInfo.getLastModified()); |
834,816 | private RelativePoint relativePointByQuickSearch(@Nonnull DataContext dataContext) {<NEW_LINE>Rectangle dominantArea = dataContext.getData(PlatformDataKeys.DOMINANT_HINT_AREA_RECTANGLE);<NEW_LINE>if (dominantArea != null) {<NEW_LINE>final Component focusedComponent = getWndManager().getFocusedComponent(myProject);<NEW_LINE>if (focusedComponent != null) {<NEW_LINE>Window window = SwingUtilities.windowForComponent(focusedComponent);<NEW_LINE>JLayeredPane layeredPane;<NEW_LINE>if (window instanceof JFrame) {<NEW_LINE>layeredPane = ((JFrame) window).getLayeredPane();<NEW_LINE>} else if (window instanceof JDialog) {<NEW_LINE>layeredPane = ((JDialog) window).getLayeredPane();<NEW_LINE>} else if (window instanceof JWindow) {<NEW_LINE>layeredPane = ((JWindow) window).getLayeredPane();<NEW_LINE>} else {<NEW_LINE>throw new IllegalStateException("cannot find parent window: project=" + myProject + "; window=" + window);<NEW_LINE>}<NEW_LINE>return relativePointWithDominantRectangle(layeredPane, dominantArea);<NEW_LINE>}<NEW_LINE>}<NEW_LINE>RelativePoint location;<NEW_LINE>Component contextComponent = dataContext.getData(PlatformDataKeys.CONTEXT_COMPONENT);<NEW_LINE>if (contextComponent == myComponent) {<NEW_LINE>location = new RelativePoint(myComponent, new Point());<NEW_LINE>} else {<NEW_LINE>location = JBPopupFactory.getInstance().guessBestPopupLocation(dataContext);<NEW_LINE>}<NEW_LINE>if (myLocateWithinScreen) {<NEW_LINE>Point screenPoint = location.getScreenPoint();<NEW_LINE>Rectangle rectangle = new <MASK><NEW_LINE>Rectangle screen = ScreenUtil.getScreenRectangle(screenPoint);<NEW_LINE>ScreenUtil.moveToFit(rectangle, screen, null);<NEW_LINE>location = new RelativePoint(rectangle.getLocation()).getPointOn(location.getComponent());<NEW_LINE>}<NEW_LINE>return location;<NEW_LINE>} | Rectangle(screenPoint, getSizeForPositioning()); |
42,352 | public DevConsoleTemplateInfoBuildItem collectBeanInfo(ValidationPhaseBuildItem validationPhaseBuildItem, CompletedApplicationClassPredicateBuildItem predicate) {<NEW_LINE>BeanDeploymentValidator.ValidationContext validationContext = validationPhaseBuildItem.getContext();<NEW_LINE>DevBeanInfos beanInfos = new DevBeanInfos();<NEW_LINE>for (BeanInfo bean : validationContext.beans()) {<NEW_LINE>beanInfos.addBean(DevBeanInfo.from(bean, predicate));<NEW_LINE>}<NEW_LINE>for (BeanInfo bean : validationContext.removedBeans()) {<NEW_LINE>beanInfos.addRemovedBean(DevBeanInfo.from(bean, predicate));<NEW_LINE>}<NEW_LINE>for (ObserverInfo observer : validationContext.get(BuildExtension.Key.OBSERVERS)) {<NEW_LINE>beanInfos.addObserver(DevObserverInfo.from(observer, predicate));<NEW_LINE>}<NEW_LINE>for (InterceptorInfo interceptor : validationContext.get(BuildExtension.Key.INTERCEPTORS)) {<NEW_LINE>beanInfos.addInterceptor(DevInterceptorInfo.from(interceptor, predicate));<NEW_LINE>}<NEW_LINE>Collection<InterceptorInfo> removedInterceptors = validationContext.get(BuildExtension.Key.REMOVED_INTERCEPTORS);<NEW_LINE>if (removedInterceptors != null) {<NEW_LINE>for (InterceptorInfo interceptor : removedInterceptors) {<NEW_LINE>beanInfos.addRemovedInterceptor(DevInterceptorInfo.from(interceptor, predicate));<NEW_LINE>}<NEW_LINE>}<NEW_LINE>for (DecoratorInfo decorator : validationContext.get(BuildExtension.Key.DECORATORS)) {<NEW_LINE>beanInfos.addDecorator(DevDecoratorInfo.from(decorator, predicate));<NEW_LINE>}<NEW_LINE>Collection<DecoratorInfo> removedDecorators = validationContext.get(BuildExtension.Key.REMOVED_DECORATORS);<NEW_LINE>if (removedDecorators != null) {<NEW_LINE>for (DecoratorInfo decorator : removedDecorators) {<NEW_LINE>beanInfos.addRemovedDecorator(DevDecoratorInfo<MASK><NEW_LINE>}<NEW_LINE>}<NEW_LINE>beanInfos.sort();<NEW_LINE>return new DevConsoleTemplateInfoBuildItem("devBeanInfos", beanInfos);<NEW_LINE>} | .from(decorator, predicate)); |
1,068,047 | public void onMessage(final ConsumerRecord<K, V> record, @Nullable final Acknowledgment acknowledgment, final Consumer<?, ?> consumer) {<NEW_LINE>RetryState retryState = null;<NEW_LINE>if (this.stateful) {<NEW_LINE>retryState = new DefaultRetryState(record.topic() + "-" + record.partition() + "-" + record.offset());<NEW_LINE>}<NEW_LINE>getRetryTemplate().execute(context -> {<NEW_LINE>context.setAttribute(CONTEXT_RECORD, record);<NEW_LINE>switch(RetryingMessageListenerAdapter.this.delegateType) {<NEW_LINE>case ACKNOWLEDGING_CONSUMER_AWARE:<NEW_LINE>context.setAttribute(CONTEXT_ACKNOWLEDGMENT, acknowledgment);<NEW_LINE><MASK><NEW_LINE>RetryingMessageListenerAdapter.this.delegate.onMessage(record, acknowledgment, consumer);<NEW_LINE>break;<NEW_LINE>case ACKNOWLEDGING:<NEW_LINE>context.setAttribute(CONTEXT_ACKNOWLEDGMENT, acknowledgment);<NEW_LINE>RetryingMessageListenerAdapter.this.delegate.onMessage(record, acknowledgment);<NEW_LINE>break;<NEW_LINE>case CONSUMER_AWARE:<NEW_LINE>context.setAttribute(CONTEXT_CONSUMER, consumer);<NEW_LINE>RetryingMessageListenerAdapter.this.delegate.onMessage(record, consumer);<NEW_LINE>break;<NEW_LINE>case SIMPLE:<NEW_LINE>RetryingMessageListenerAdapter.this.delegate.onMessage(record);<NEW_LINE>}<NEW_LINE>return null;<NEW_LINE>}, getRecoveryCallback(), retryState);<NEW_LINE>} | context.setAttribute(CONTEXT_CONSUMER, consumer); |
1,264,817 | private ServerInterceptor generateAuthorizationInterceptor(AuthConfig config) {<NEW_LINE>checkNotNull(config, "config");<NEW_LINE>final GrpcAuthorizationEngine authEngine = new GrpcAuthorizationEngine(config);<NEW_LINE>return new ServerInterceptor() {<NEW_LINE><NEW_LINE>@Override<NEW_LINE>public <ReqT, RespT> ServerCall.Listener<ReqT> interceptCall(final ServerCall<ReqT, RespT> call, final Metadata headers, ServerCallHandler<ReqT, RespT> next) {<NEW_LINE>AuthDecision authResult = authEngine.evaluate(headers, call);<NEW_LINE>if (logger.isLoggable(Level.FINE)) {<NEW_LINE>logger.log(Level.FINE, "Authorization result for serverCall {0}: {1}, matching policy: {2}.", new Object[] { call, authResult.decision(), authResult.matchingPolicyName() });<NEW_LINE>}<NEW_LINE>if (GrpcAuthorizationEngine.Action.DENY.equals(authResult.decision())) {<NEW_LINE>Status status = Status.PERMISSION_DENIED.withDescription("Access Denied");<NEW_LINE>call.close(status, new Metadata());<NEW_LINE>return new ServerCall.Listener<ReqT>() {<NEW_LINE>};<NEW_LINE>}<NEW_LINE>return <MASK><NEW_LINE>}<NEW_LINE>};<NEW_LINE>} | next.startCall(call, headers); |
1,553,514 | public void takeSnapshot(SnapshotInfo snapshotInfo, AsyncCompletionCallback<CreateCmdResult> callback) {<NEW_LINE>LOGGER.debug("Taking PowerFlex volume snapshot");<NEW_LINE>Preconditions.checkArgument(snapshotInfo != null, "snapshotInfo cannot be null");<NEW_LINE>VolumeInfo volumeInfo = snapshotInfo.getBaseVolume();<NEW_LINE>Preconditions.checkArgument(volumeInfo != null, "volumeInfo cannot be null");<NEW_LINE>VolumeVO volumeVO = volumeDao.findById(volumeInfo.getId());<NEW_LINE>long storagePoolId = volumeVO.getPoolId();<NEW_LINE>Preconditions.checkArgument(storagePoolId > 0, "storagePoolId should be > 0");<NEW_LINE>StoragePoolVO storagePool = storagePoolDao.findById(storagePoolId);<NEW_LINE>Preconditions.checkArgument(storagePool != null && storagePool.getHostAddress() != null, "storagePool and host address should not be null");<NEW_LINE>CreateCmdResult result;<NEW_LINE>try {<NEW_LINE>SnapshotObjectTO snapshotObjectTo = (SnapshotObjectTO) snapshotInfo.getTO();<NEW_LINE>final ScaleIOGatewayClient client = getScaleIOClient(storagePoolId);<NEW_LINE>final String scaleIOVolumeId = ScaleIOUtil.getVolumePath(volumeVO.getPath());<NEW_LINE>String snapshotName = String.format("%s-%s-%s-%s", ScaleIOUtil.SNAPSHOT_PREFIX, snapshotInfo.getId(), storagePool.getUuid().split("-")[0].substring(4), ManagementServerImpl.customCsIdentifier.value());<NEW_LINE>org.apache.cloudstack.storage.datastore.api.Volume scaleIOVolume = null;<NEW_LINE>scaleIOVolume = client.takeSnapshot(scaleIOVolumeId, snapshotName);<NEW_LINE>if (scaleIOVolume == null) {<NEW_LINE>throw new CloudRuntimeException("Failed to take snapshot on PowerFlex cluster");<NEW_LINE>}<NEW_LINE>snapshotObjectTo.setPath(ScaleIOUtil.updatedPathWithVolumeName(scaleIOVolume.getId(), snapshotName));<NEW_LINE><MASK><NEW_LINE>result = new CreateCmdResult(null, createObjectAnswer);<NEW_LINE>result.setResult(null);<NEW_LINE>} catch (Exception e) {<NEW_LINE>String errMsg = "Unable to take PowerFlex volume snapshot for volume: " + volumeInfo.getId() + " due to " + e.getMessage();<NEW_LINE>LOGGER.warn(errMsg);<NEW_LINE>result = new CreateCmdResult(null, new CreateObjectAnswer(e.toString()));<NEW_LINE>result.setResult(e.toString());<NEW_LINE>}<NEW_LINE>callback.complete(result);<NEW_LINE>} | CreateObjectAnswer createObjectAnswer = new CreateObjectAnswer(snapshotObjectTo); |
744,828 | protected void addAllTask(List<AbstractPartitionJob> tasks) {<NEW_LINE>@SuppressWarnings("unchecked")<NEW_LINE>List<Long> existingInodes = (List<Long>) this.get("existingInodes");<NEW_LINE>ReliableTaildirEventReader reader = (ReliableTaildirEventReader) this.get("reader");<NEW_LINE>CopyOfProcessOfLogagent cpy = (CopyOfProcessOfLogagent) this.get("TailLogcomp");<NEW_LINE>for (long inode : existingInodes) {<NEW_LINE>AbstractPartitionJob job = new TailFileTaskJob(logger);<NEW_LINE>TailFile tf = reader.getTailFiles().get(inode);<NEW_LINE>if (logger.isDebugEnable()) {<NEW_LINE>logger.debug("this", <MASK><NEW_LINE>logger.debug("this", "### TailFilesMutiJobs tf needTail: ###" + tf.needTail());<NEW_LINE>}<NEW_LINE>if (tf.needTail()) {<NEW_LINE>job.put("tfevent", tf);<NEW_LINE>job.put("tfref", cpy);<NEW_LINE>// job.put("reader", reader);<NEW_LINE>tasks.add(job);<NEW_LINE>}<NEW_LINE>}<NEW_LINE>} | "### TailFilesMutiJobs tf path:###" + tf.getPath()); |
95,805 | private AccessControl buildAccessControl(DeployState deployState, AbstractConfigProducer ancestor, Element accessControlElem) {<NEW_LINE>AthenzDomain domain = getAccessControlDomain(deployState, accessControlElem);<NEW_LINE>AccessControl.Builder builder = new AccessControl.Builder(domain.value());<NEW_LINE>getContainerCluster(ancestor).ifPresent(builder::setHandlers);<NEW_LINE>XmlHelper.getOptionalAttribute(accessControlElem, "read").ifPresent(readAttr -> builder.readEnabled(Boolean.valueOf(readAttr)));<NEW_LINE>XmlHelper.getOptionalAttribute(accessControlElem, "write").ifPresent(writeAttr -> builder.writeEnabled(Boolean.valueOf(writeAttr)));<NEW_LINE>AccessControl.ClientAuthentication clientAuth = XmlHelper.getOptionalAttribute(accessControlElem, "tls-handshake-client-auth").filter("want"::equals).map(value -> AccessControl.ClientAuthentication.want).orElse(AccessControl.ClientAuthentication.need);<NEW_LINE>if (!deployState.getProperties().allowDisableMtls() && clientAuth == AccessControl.ClientAuthentication.want) {<NEW_LINE>throw new IllegalArgumentException("Overriding 'tls-handshake-client-auth' for application is not allowed.");<NEW_LINE>}<NEW_LINE>builder.clientAuthentication(clientAuth);<NEW_LINE>Element excludeElem = XML.getChild(accessControlElem, "exclude");<NEW_LINE>if (excludeElem != null) {<NEW_LINE>XML.getChildren(excludeElem, "binding").stream().map(xml -> UserBindingPattern.fromPattern(XML.getValue(xml))<MASK><NEW_LINE>}<NEW_LINE>return builder.build();<NEW_LINE>} | ).forEach(builder::excludeBinding); |
1,443,993 | public void onStyleLoaded(@NonNull Style style) {<NEW_LINE>TurfCirclePoiWithinFilterActivity.this.mapboxMap = mapboxMap;<NEW_LINE>hideLayers();<NEW_LINE>initPolygonCircleFillLayer();<NEW_LINE>// Set up the seekbar so that the circle's radius can be adjusted<NEW_LINE>final SeekBar circleRadiusSeekbar = findViewById(R.id.circle_radius_seekbar);<NEW_LINE>circleRadiusSeekbar.setMax(RADIUS_SEEKBAR_MAX);<NEW_LINE>circleRadiusSeekbar.incrementProgressBy(RADIUS_SEEKBAR_DIFFERENCE / 10);<NEW_LINE>circleRadiusSeekbar.setProgress(RADIUS_SEEKBAR_MAX / 2);<NEW_LINE>circleRadiusTextView = <MASK><NEW_LINE>circleRadiusTextView.setText(String.format(getString(R.string.polygon_circle_transformation_circle_radius), String.format(".%s", String.valueOf(RADIUS_SEEKBAR_MAX / 2))));<NEW_LINE>// Draw the initial circle around the starting location<NEW_LINE>drawPolygonCircle(DOWNTOWN_MUNICH_START_LOCATION);<NEW_LINE>circleRadiusSeekbar.setOnSeekBarChangeListener(new SeekBar.OnSeekBarChangeListener() {<NEW_LINE><NEW_LINE>@Override<NEW_LINE>public void onProgressChanged(SeekBar seekBar, int progress, boolean fromUser) {<NEW_LINE>makeNewRadiusAdjustments(seekBar.getProgress());<NEW_LINE>}<NEW_LINE><NEW_LINE>@Override<NEW_LINE>public void onStartTrackingTouch(SeekBar seekBar) {<NEW_LINE>// Not needed in this example.<NEW_LINE>}<NEW_LINE><NEW_LINE>@Override<NEW_LINE>public void onStopTrackingTouch(SeekBar seekBar) {<NEW_LINE>makeNewRadiusAdjustments(seekBar.getProgress());<NEW_LINE>}<NEW_LINE>});<NEW_LINE>mapboxMap.addOnMapClickListener(TurfCirclePoiWithinFilterActivity.this);<NEW_LINE>initDistanceUnitSpinner();<NEW_LINE>Toast.makeText(TurfCirclePoiWithinFilterActivity.this, getString(R.string.polygon_circle_transformation_click_map_instruction), Toast.LENGTH_SHORT).show();<NEW_LINE>} | findViewById(R.id.circle_radius_textview); |
339,986 | public void draw(Canvas canvas) {<NEW_LINE>Rect bounds = getBounds();<NEW_LINE>// Draw bounding box<NEW_LINE>mPaint.setStyle(Paint.Style.STROKE);<NEW_LINE>mPaint.setStrokeWidth(OUTLINE_STROKE_WIDTH_PX);<NEW_LINE>mPaint.setColor(OUTLINE_COLOR);<NEW_LINE>canvas.drawRect(bounds.left, bounds.top, bounds.right, bounds.bottom, mPaint);<NEW_LINE>// Draw overlay<NEW_LINE>mPaint.setStyle(Paint.Style.FILL);<NEW_LINE>mPaint.setColor(mOverlayColor);<NEW_LINE>canvas.drawRect(bounds.left, bounds.top, bounds.right, bounds.bottom, mPaint);<NEW_LINE>// Draw text<NEW_LINE>mPaint.<MASK><NEW_LINE>mPaint.setStrokeWidth(0);<NEW_LINE>mPaint.setColor(TEXT_COLOR);<NEW_LINE>// Reset the test position<NEW_LINE>mCurrentTextXPx = mStartTextXPx;<NEW_LINE>mCurrentTextYPx = mStartTextYPx;<NEW_LINE>if (mImageId != null) {<NEW_LINE>addDebugText(canvas, "IDs", format("%s, %s", mControllerId, mImageId));<NEW_LINE>} else {<NEW_LINE>addDebugText(canvas, "ID", mControllerId);<NEW_LINE>}<NEW_LINE>addDebugText(canvas, "D", format("%dx%d", bounds.width(), bounds.height()));<NEW_LINE>// use text color to indicate dimension differences<NEW_LINE>final int sizeColor = determineSizeHintColor(mWidthPx, mHeightPx, mScaleType);<NEW_LINE>addDebugText(canvas, "I", format("%dx%d", mWidthPx, mHeightPx), sizeColor);<NEW_LINE>addDebugText(canvas, "I", format("%d KiB", (mImageSizeBytes / 1024)));<NEW_LINE>if (mImageFormat != null) {<NEW_LINE>addDebugText(canvas, "i format", mImageFormat);<NEW_LINE>}<NEW_LINE>if (mFrameCount > 0) {<NEW_LINE>addDebugText(canvas, "anim", format("f %d, l %d", mFrameCount, mLoopCount));<NEW_LINE>}<NEW_LINE>if (mScaleType != null) {<NEW_LINE>addDebugText(canvas, "scale", mScaleType);<NEW_LINE>}<NEW_LINE>if (mFinalImageTimeMs >= 0) {<NEW_LINE>addDebugText(canvas, "t", format("%d ms", mFinalImageTimeMs));<NEW_LINE>}<NEW_LINE>if (mOriginText != null) {<NEW_LINE>addDebugText(canvas, "origin", mOriginText, mOriginColor);<NEW_LINE>}<NEW_LINE>for (Map.Entry<String, String> entry : mAdditionalData.entrySet()) {<NEW_LINE>addDebugText(canvas, entry.getKey(), entry.getValue());<NEW_LINE>}<NEW_LINE>} | setStyle(Paint.Style.FILL); |
513,862 | public I_M_Transaction retrieveReversalTransaction(final Object referencedModelReversal, final I_M_Transaction originalTrx) {<NEW_LINE>Check.assumeNotNull(referencedModelReversal, "referencedModelReversal not null");<NEW_LINE>Check.assumeNotNull(originalTrx, "originalTrx not null");<NEW_LINE>final IQueryFilter<I_M_Transaction> referencedModelFilter = createReferencedModelQueryFilter(referencedModelReversal);<NEW_LINE>final ICompositeQueryFilter<I_M_Transaction> filters = Services.get(IQueryBL.class).createCompositeQueryFilter(I_M_Transaction.class);<NEW_LINE>filters.addFilter(referencedModelFilter).addEqualsFilter(I_M_Transaction.COLUMNNAME_M_Product_ID, originalTrx.getM_Product_ID()).addEqualsFilter(I_M_Transaction.COLUMNNAME_M_AttributeSetInstance_ID, originalTrx.getM_AttributeSetInstance_ID()).addEqualsFilter(I_M_Transaction.COLUMNNAME_MovementType, originalTrx.getMovementType()).addEqualsFilter(I_M_Transaction.COLUMNNAME_MovementQty, originalTrx.getMovementQty().negate());<NEW_LINE>final I_M_Transaction reversalTrx = Services.get(IQueryBL.class).createQueryBuilder(I_M_Transaction.class, referencedModelReversal).filter(filters).create().setOnlyActiveRecords(true<MASK><NEW_LINE>if (reversalTrx == null) {<NEW_LINE>throw new AdempiereException("@NotFound@ @Reversal_ID@ @M_Transaction_ID@ (" + "@ReversalLine_ID@: " + referencedModelFilter + ", @M_Transaction_ID@: " + originalTrx + ")");<NEW_LINE>}<NEW_LINE>return reversalTrx;<NEW_LINE>} | ).firstOnly(I_M_Transaction.class); |
1,149,334 | public void updateFirmware(final ThingUID thingUID, final String firmwareVersion, @Nullable final Locale locale) {<NEW_LINE>ParameterChecks.checkNotNull(thingUID, "Thing UID");<NEW_LINE>ParameterChecks.checkNotNullOrEmpty(firmwareVersion, "Firmware version");<NEW_LINE>final FirmwareUpdateHandler firmwareUpdateHandler = getFirmwareUpdateHandler(thingUID);<NEW_LINE>if (firmwareUpdateHandler == null) {<NEW_LINE>throw new IllegalArgumentException(String.format("There is no firmware update handler for thing with UID %s.", thingUID));<NEW_LINE>}<NEW_LINE>final Thing thing = firmwareUpdateHandler.getThing();<NEW_LINE>final Firmware firmware = getFirmware(thing, firmwareVersion);<NEW_LINE>validateFirmwareUpdateConditions(firmwareUpdateHandler, firmware);<NEW_LINE>final Locale currentLocale = locale != null ? locale : localeProvider.getLocale();<NEW_LINE>final ProgressCallbackImpl progressCallback = new ProgressCallbackImpl(firmwareUpdateHandler, eventPublisher, i18nProvider, bundleResolver, thingUID, firmware, currentLocale);<NEW_LINE><MASK><NEW_LINE>logger.debug("Starting firmware update for thing with UID {} and firmware {}", thingUID, firmware);<NEW_LINE>safeCaller.create(firmwareUpdateHandler, FirmwareUpdateHandler.class).withTimeout(timeout).withAsync().onTimeout(() -> {<NEW_LINE>logger.error("Timeout occurred for firmware update of thing with UID {} and firmware {}.", thingUID, firmware);<NEW_LINE>progressCallback.failedInternal("timeout-error");<NEW_LINE>}).onException(e -> {<NEW_LINE>logger.error("Unexpected exception occurred for firmware update of thing with UID {} and firmware {}.", thingUID, firmware, e.getCause());<NEW_LINE>progressCallback.failedInternal("unexpected-handler-error");<NEW_LINE>}).build().updateFirmware(firmware, progressCallback);<NEW_LINE>} | progressCallbackMap.put(thingUID, progressCallback); |
1,361,670 | public void marshall(UpdateNotebookInstanceRequest updateNotebookInstanceRequest, ProtocolMarshaller protocolMarshaller) {<NEW_LINE>if (updateNotebookInstanceRequest == null) {<NEW_LINE>throw new SdkClientException("Invalid argument passed to marshall(...)");<NEW_LINE>}<NEW_LINE>try {<NEW_LINE>protocolMarshaller.marshall(updateNotebookInstanceRequest.getNotebookInstanceName(), NOTEBOOKINSTANCENAME_BINDING);<NEW_LINE>protocolMarshaller.marshall(updateNotebookInstanceRequest.getInstanceType(), INSTANCETYPE_BINDING);<NEW_LINE>protocolMarshaller.marshall(updateNotebookInstanceRequest.getRoleArn(), ROLEARN_BINDING);<NEW_LINE>protocolMarshaller.marshall(updateNotebookInstanceRequest.getLifecycleConfigName(), LIFECYCLECONFIGNAME_BINDING);<NEW_LINE>protocolMarshaller.marshall(updateNotebookInstanceRequest.getDisassociateLifecycleConfig(), DISASSOCIATELIFECYCLECONFIG_BINDING);<NEW_LINE>protocolMarshaller.marshall(updateNotebookInstanceRequest.getVolumeSizeInGB(), VOLUMESIZEINGB_BINDING);<NEW_LINE>protocolMarshaller.marshall(<MASK><NEW_LINE>protocolMarshaller.marshall(updateNotebookInstanceRequest.getAdditionalCodeRepositories(), ADDITIONALCODEREPOSITORIES_BINDING);<NEW_LINE>protocolMarshaller.marshall(updateNotebookInstanceRequest.getAcceleratorTypes(), ACCELERATORTYPES_BINDING);<NEW_LINE>protocolMarshaller.marshall(updateNotebookInstanceRequest.getDisassociateAcceleratorTypes(), DISASSOCIATEACCELERATORTYPES_BINDING);<NEW_LINE>protocolMarshaller.marshall(updateNotebookInstanceRequest.getDisassociateDefaultCodeRepository(), DISASSOCIATEDEFAULTCODEREPOSITORY_BINDING);<NEW_LINE>protocolMarshaller.marshall(updateNotebookInstanceRequest.getDisassociateAdditionalCodeRepositories(), DISASSOCIATEADDITIONALCODEREPOSITORIES_BINDING);<NEW_LINE>protocolMarshaller.marshall(updateNotebookInstanceRequest.getRootAccess(), ROOTACCESS_BINDING);<NEW_LINE>} catch (Exception e) {<NEW_LINE>throw new SdkClientException("Unable to marshall request to JSON: " + e.getMessage(), e);<NEW_LINE>}<NEW_LINE>} | updateNotebookInstanceRequest.getDefaultCodeRepository(), DEFAULTCODEREPOSITORY_BINDING); |
1,322,571 | public static GetInstanceErrorRankResponse unmarshall(GetInstanceErrorRankResponse getInstanceErrorRankResponse, UnmarshallerContext _ctx) {<NEW_LINE>getInstanceErrorRankResponse.setRequestId(_ctx.stringValue("GetInstanceErrorRankResponse.RequestId"));<NEW_LINE>InstanceErrorRank instanceErrorRank = new InstanceErrorRank();<NEW_LINE>instanceErrorRank.setUpdateTime(_ctx.longValue("GetInstanceErrorRankResponse.InstanceErrorRank.UpdateTime"));<NEW_LINE>List<ErrorRankItem> errorRank = new ArrayList<ErrorRankItem>();<NEW_LINE>for (int i = 0; i < _ctx.lengthValue("GetInstanceErrorRankResponse.InstanceErrorRank.ErrorRank.Length"); i++) {<NEW_LINE>ErrorRankItem errorRankItem = new ErrorRankItem();<NEW_LINE>errorRankItem.setOwner(_ctx.stringValue("GetInstanceErrorRankResponse.InstanceErrorRank.ErrorRank[" + i + "].Owner"));<NEW_LINE>errorRankItem.setNodeName(_ctx.stringValue<MASK><NEW_LINE>errorRankItem.setProjectId(_ctx.longValue("GetInstanceErrorRankResponse.InstanceErrorRank.ErrorRank[" + i + "].ProjectId"));<NEW_LINE>errorRankItem.setNodeId(_ctx.longValue("GetInstanceErrorRankResponse.InstanceErrorRank.ErrorRank[" + i + "].NodeId"));<NEW_LINE>errorRankItem.setCount(_ctx.integerValue("GetInstanceErrorRankResponse.InstanceErrorRank.ErrorRank[" + i + "].Count"));<NEW_LINE>errorRankItem.setPrgType(_ctx.integerValue("GetInstanceErrorRankResponse.InstanceErrorRank.ErrorRank[" + i + "].PrgType"));<NEW_LINE>errorRank.add(errorRankItem);<NEW_LINE>}<NEW_LINE>instanceErrorRank.setErrorRank(errorRank);<NEW_LINE>getInstanceErrorRankResponse.setInstanceErrorRank(instanceErrorRank);<NEW_LINE>return getInstanceErrorRankResponse;<NEW_LINE>} | ("GetInstanceErrorRankResponse.InstanceErrorRank.ErrorRank[" + i + "].NodeName")); |
463,963 | private void pringGC(final RoutingContext ctx, boolean before) {<NEW_LINE>if (RoutingContext.SHOW_GC_SIZE && before) {<NEW_LINE>long h1 = RoutingContext.runGCUsedMemory();<NEW_LINE>float mb = (1 << 20);<NEW_LINE>log.warn("Used before routing " + h1 / mb + " actual");<NEW_LINE>} else if (RoutingContext.SHOW_GC_SIZE && !before) {<NEW_LINE>int sz = ctx.global.size;<NEW_LINE>log.warn("Subregion size " + ctx.subregionTiles.size() + " " + " tiles " + ctx.indexedSubregions.size());<NEW_LINE>RoutingContext.runGCUsedMemory();<NEW_LINE><MASK><NEW_LINE>ctx.unloadAllData();<NEW_LINE>RoutingContext.runGCUsedMemory();<NEW_LINE>long h2 = RoutingContext.runGCUsedMemory();<NEW_LINE>float mb = (1 << 20);<NEW_LINE>log.warn("Unload context : estimated " + sz / mb + " ?= " + (h1 - h2) / mb + " actual");<NEW_LINE>}<NEW_LINE>} | long h1 = RoutingContext.runGCUsedMemory(); |
31,562 | private void updateQuota(long quota) {<NEW_LINE>long storedQuota = getDBLong("quotaPoints", 0L);<NEW_LINE>String storedDate = getDBString("quotaDate", "01-01-2000");<NEW_LINE>SimpleDateFormat datefmt = new SimpleDateFormat("dd-MM-yyyy");<NEW_LINE>datefmt.setTimeZone(TimeZone.getTimeZone("America/Los_Angeles"));<NEW_LINE>String currentDate = datefmt<MASK><NEW_LINE>if (!currentDate.equals(storedDate)) {<NEW_LINE>com.gmt2001.Console.debug.println("Date Change Detected: " + storedDate + " -> " + currentDate);<NEW_LINE>com.gmt2001.Console.debug.println("Resetting Quota. New Quota: " + quota);<NEW_LINE>updateDBString("quotaDate", currentDate);<NEW_LINE>updateDBLong("quotaPoints", quota);<NEW_LINE>} else {<NEW_LINE>com.gmt2001.Console.debug.println("Updating Quota. New Quota: " + (quota + storedQuota));<NEW_LINE>updateDBLong("quotaPoints", quota + storedQuota);<NEW_LINE>}<NEW_LINE>} | .format(new Date()); |
1,476,629 | public static ListTagResourcesResponse unmarshall(ListTagResourcesResponse listTagResourcesResponse, UnmarshallerContext _ctx) {<NEW_LINE>listTagResourcesResponse.setRequestId(_ctx.stringValue("ListTagResourcesResponse.RequestId"));<NEW_LINE>listTagResourcesResponse.setSuccess(_ctx.booleanValue("ListTagResourcesResponse.Success"));<NEW_LINE>listTagResourcesResponse.setNextToken(_ctx.stringValue("ListTagResourcesResponse.NextToken"));<NEW_LINE>List<TagResource> tagResources = new ArrayList<TagResource>();<NEW_LINE>for (int i = 0; i < _ctx.lengthValue("ListTagResourcesResponse.TagResources.Length"); i++) {<NEW_LINE>TagResource tagResource = new TagResource();<NEW_LINE>tagResource.setTagKey(_ctx.stringValue("ListTagResourcesResponse.TagResources[" + i + "].TagKey"));<NEW_LINE>tagResource.setTagValue(_ctx.stringValue("ListTagResourcesResponse.TagResources[" + i + "].TagValue"));<NEW_LINE>tagResource.setResourceId(_ctx.stringValue<MASK><NEW_LINE>tagResource.setResourceType(_ctx.stringValue("ListTagResourcesResponse.TagResources[" + i + "].ResourceType"));<NEW_LINE>tagResources.add(tagResource);<NEW_LINE>}<NEW_LINE>listTagResourcesResponse.setTagResources(tagResources);<NEW_LINE>return listTagResourcesResponse;<NEW_LINE>} | ("ListTagResourcesResponse.TagResources[" + i + "].ResourceId")); |
136,376 | default void logContext(Logger log, RelationshipOp operation, Environment environment) {<NEW_LINE>List<?> children = (environment.field.getSelectionSet() != null) ? (List) environment.field.getSelectionSet().getChildren() : new ArrayList<>();<NEW_LINE>List<String> fieldName = new ArrayList<>();<NEW_LINE>if (CollectionUtils.isNotEmpty(children)) {<NEW_LINE>children.stream().forEach(i -> {<NEW_LINE>if (i.getClass().equals(Field.class)) {<NEW_LINE>fieldName.add(((Field<MASK><NEW_LINE>} else if (i.getClass().equals(FragmentSpread.class)) {<NEW_LINE>fieldName.add(((FragmentSpread) i).getName());<NEW_LINE>} else {<NEW_LINE>log.debug("A new type of Selection, other than Field and FragmentSpread was encountered, {}", i.getClass());<NEW_LINE>}<NEW_LINE>});<NEW_LINE>}<NEW_LINE>String requestedFields = environment.field.getName() + fieldName;<NEW_LINE>GraphQLType parent = environment.parentType;<NEW_LINE>if (log.isDebugEnabled()) {<NEW_LINE>String typeName = (parent instanceof GraphQLNamedType) ? ((GraphQLNamedType) parent).getName() : parent.toString();<NEW_LINE>log.debug("{} {} fields with parent {}<{}>", operation, requestedFields, EntityDictionary.getSimpleName(EntityDictionary.getType(parent)), typeName);<NEW_LINE>}<NEW_LINE>} | ) i).getName()); |
1,122,022 | public static SparkSession createSparkSession(final StoreProperties storeProperties) {<NEW_LINE>SparkSession.Builder builder = SparkSession.builder().appName(storeProperties.get(SparkConstants.APP_NAME, SparkConstants.DEFAULT_APP_NAME));<NEW_LINE>if (Boolean.parseBoolean(storeProperties.get(SparkConstants.USE_SPARK_DEFAULT_CONF, "false"))) {<NEW_LINE>final Properties properties = new Properties();<NEW_LINE>final String sparkDefaultConfPath = storeProperties.get(SparkConstants.SPARK_DEFAULT_CONF_PATH, SparkConstants.DEFAULT_SPARK_DEFAULT_CONF_PATH);<NEW_LINE>try {<NEW_LINE>properties.load(Files.newBufferedReader(Paths.get(sparkDefaultConfPath)));<NEW_LINE>} catch (final IOException e) {<NEW_LINE>throw new IllegalArgumentException("Failed to read spark-default conf from " + sparkDefaultConfPath, e);<NEW_LINE>}<NEW_LINE>for (final Map.Entry<Object, Object> entry : properties.entrySet()) {<NEW_LINE>builder.config((String) entry.getKey(), (String) entry.getValue());<NEW_LINE>}<NEW_LINE>final String sparkMaster = storeProperties.get(SparkConstants.MASTER);<NEW_LINE>builder = (sparkMaster == null || sparkMaster.isEmpty()) ? builder : builder.master(sparkMaster);<NEW_LINE>} else {<NEW_LINE>builder.master(storeProperties.get(SparkConstants.MASTER, SparkConstants.MASTER_DEFAULT));<NEW_LINE>}<NEW_LINE>builder.config(SparkConstants.SERIALIZER, storeProperties.get(SparkConstants.SERIALIZER, SparkConstants.DEFAULT_SERIALIZER)).config(SparkConstants.KRYO_REGISTRATOR, storeProperties.get(SparkConstants<MASK><NEW_LINE>return builder.getOrCreate();<NEW_LINE>} | .KRYO_REGISTRATOR, SparkConstants.DEFAULT_KRYO_REGISTRATOR)); |
1,379,167 | protected Query doToQuery(SearchExecutionContext context) throws IOException {<NEW_LINE>Expression compiledExpression = (Expression) Scripting.compile(expr);<NEW_LINE>AggrType aggrType = AggrType.valueOf(aggr.toUpperCase(Locale.getDefault()));<NEW_LINE>AggrType posAggrType = AggrType.valueOf(pos_aggr.toUpperCase(Locale.getDefault()));<NEW_LINE>Analyzer analyzer = null;<NEW_LINE>Set<Term> <MASK><NEW_LINE>for (String field : fields) {<NEW_LINE>// If no analyzer was specified, try grabbing it per field<NEW_LINE>if (analyzerName == null) {<NEW_LINE>analyzer = getAnalyzerForField(context, field);<NEW_LINE>// Otherwise use the requested analyzer<NEW_LINE>} else if (analyzer == null) {<NEW_LINE>analyzer = getAnalyzerByName(context, analyzerName);<NEW_LINE>}<NEW_LINE>if (analyzer == null) {<NEW_LINE>throw new IllegalArgumentException("No analyzer found for [" + analyzerName + "]");<NEW_LINE>}<NEW_LINE>for (String termString : terms) {<NEW_LINE>TokenStream ts = analyzer.tokenStream(field, termString);<NEW_LINE>TermToBytesRefAttribute termAtt = ts.getAttribute(TermToBytesRefAttribute.class);<NEW_LINE>ts.reset();<NEW_LINE>while (ts.incrementToken()) {<NEW_LINE>termSet.add(new Term(field, termAtt.getBytesRef()));<NEW_LINE>}<NEW_LINE>ts.close();<NEW_LINE>}<NEW_LINE>}<NEW_LINE>return new TermStatQuery(compiledExpression, aggrType, posAggrType, termSet);<NEW_LINE>} | termSet = new HashSet<>(); |
1,817,903 | public void build(boolean parallel, List<V> collection, DistanceMetric dm) {<NEW_LINE>// really just checking dm == euclidean<NEW_LINE>setDistanceMetric(dm);<NEW_LINE>this.vecs = new ArrayList<>(collection);<NEW_LINE>this.cache = euclid.getAccelerationCache(vecs, parallel);<NEW_LINE>int d = collection.get(0).length();<NEW_LINE>int n = collection.size();<NEW_LINE>// Init u<NEW_LINE>u = new Vec[m][L];<NEW_LINE>for (int j = 0; j < m; j++) for (int l = 0; l < L; l++) {<NEW_LINE>u[j][l] = DenseVector.random(d);<NEW_LINE>u[j][l].mutableDivide(u[j][l].pNorm(2));<NEW_LINE>}<NEW_LINE>// Init T<NEW_LINE>T = <MASK><NEW_LINE>// TODO, add more complex logic to balance parallelization over m&l loop as well as inner most loop<NEW_LINE>// Insertions<NEW_LINE>for (int j = 0; j < m; j++) {<NEW_LINE>for (int l = 0; l < L; l++) {<NEW_LINE>Vec u_jl = u[j][l];<NEW_LINE>double[] keys = new double[n];<NEW_LINE>int[] vals = new int[n];<NEW_LINE>ParallelUtils.run(parallel, n, (start, end) -> {<NEW_LINE>for (int i = start; i < end; i++) {<NEW_LINE>double p_bar = vecs.get(i).dot(u_jl);<NEW_LINE>keys[i] = p_bar;<NEW_LINE>vals[i] = i;<NEW_LINE>}<NEW_LINE>});<NEW_LINE>T[j][l] = new NearestIterator(keys, vals);<NEW_LINE>}<NEW_LINE>}<NEW_LINE>} | new NearestIterator[m][L]; |
1,450,374 | public void generateRandomPasswordForUsers(List<Long> userIds) {<NEW_LINE>AuthService authService = <MASK><NEW_LINE>LocalDateTime todayDateTime = Beans.get(AppBaseService.class).getTodayDateTime().toLocalDateTime();<NEW_LINE>for (Long userId : userIds) {<NEW_LINE>User user = userRepo.find(userId);<NEW_LINE>String password = this.generateRandomPassword().toString();<NEW_LINE>user.setTransientPassword(password);<NEW_LINE>password = authService.encrypt(password);<NEW_LINE>user.setPassword(password);<NEW_LINE>user.setPasswordUpdatedOn(todayDateTime);<NEW_LINE>userRepo.save(user);<NEW_LINE>}<NEW_LINE>// Update login date in session so that user changing own password doesn't get logged out.<NEW_LINE>if (userIds.contains(getUserId())) {<NEW_LINE>Session session = AuthUtils.getSubject().getSession();<NEW_LINE>session.setAttribute("loginDate", todayDateTime);<NEW_LINE>}<NEW_LINE>} | Beans.get(AuthService.class); |
1,448,331 | private OHashTable.NodeSplitResult splitNode(final OHashTable.BucketPath bucketPath, final OAtomicOperation atomicOperation) throws IOException {<NEW_LINE>final long[] newNode = new long[MAX_LEVEL_SIZE];<NEW_LINE>final int hashMapSize = 1 << (bucketPath.nodeLocalDepth + 1);<NEW_LINE>boolean hashMapItemsAreEqual = true;<NEW_LINE>final boolean allLeftItemsAreEqual;<NEW_LINE>final boolean allRightItemsAreEqual;<NEW_LINE>int mapCounter = 0;<NEW_LINE>long firstPosition = -1;<NEW_LINE>final long[] node = directory.getNode(bucketPath.nodeIndex, atomicOperation);<NEW_LINE>for (int i = MAX_LEVEL_SIZE / 2; i < MAX_LEVEL_SIZE; i++) {<NEW_LINE><MASK><NEW_LINE>if (hashMapItemsAreEqual && mapCounter == 0) {<NEW_LINE>firstPosition = position;<NEW_LINE>}<NEW_LINE>newNode[2 * (i - MAX_LEVEL_SIZE / 2)] = position;<NEW_LINE>newNode[2 * (i - MAX_LEVEL_SIZE / 2) + 1] = position;<NEW_LINE>if (hashMapItemsAreEqual) {<NEW_LINE>hashMapItemsAreEqual = firstPosition == position;<NEW_LINE>mapCounter += 2;<NEW_LINE>if (mapCounter >= hashMapSize) {<NEW_LINE>mapCounter = 0;<NEW_LINE>}<NEW_LINE>}<NEW_LINE>}<NEW_LINE>mapCounter = 0;<NEW_LINE>allRightItemsAreEqual = hashMapItemsAreEqual;<NEW_LINE>hashMapItemsAreEqual = true;<NEW_LINE>final long[] updatedNode = new long[node.length];<NEW_LINE>for (int i = 0; i < MAX_LEVEL_SIZE / 2; i++) {<NEW_LINE>final long position = node[i];<NEW_LINE>if (hashMapItemsAreEqual && mapCounter == 0) {<NEW_LINE>firstPosition = position;<NEW_LINE>}<NEW_LINE>updatedNode[2 * i] = position;<NEW_LINE>updatedNode[2 * i + 1] = position;<NEW_LINE>if (hashMapItemsAreEqual) {<NEW_LINE>hashMapItemsAreEqual = firstPosition == position;<NEW_LINE>mapCounter += 2;<NEW_LINE>if (mapCounter >= hashMapSize) {<NEW_LINE>mapCounter = 0;<NEW_LINE>}<NEW_LINE>}<NEW_LINE>}<NEW_LINE>allLeftItemsAreEqual = hashMapItemsAreEqual;<NEW_LINE>directory.setNode(bucketPath.nodeIndex, updatedNode, atomicOperation);<NEW_LINE>directory.setNodeLocalDepth(bucketPath.nodeIndex, (byte) (directory.getNodeLocalDepth(bucketPath.nodeIndex, atomicOperation) + 1), atomicOperation);<NEW_LINE>return new OHashTable.NodeSplitResult(newNode, allLeftItemsAreEqual, allRightItemsAreEqual);<NEW_LINE>} | final long position = node[i]; |
440,294 | final ListTrackerConsumersResult executeListTrackerConsumers(ListTrackerConsumersRequest listTrackerConsumersRequest) {<NEW_LINE>ExecutionContext executionContext = createExecutionContext(listTrackerConsumersRequest);<NEW_LINE>AWSRequestMetrics awsRequestMetrics = executionContext.getAwsRequestMetrics();<NEW_LINE>awsRequestMetrics.startEvent(Field.ClientExecuteTime);<NEW_LINE>Request<ListTrackerConsumersRequest> request = null;<NEW_LINE>Response<ListTrackerConsumersResult> response = null;<NEW_LINE>try {<NEW_LINE><MASK><NEW_LINE>try {<NEW_LINE>request = new ListTrackerConsumersRequestProtocolMarshaller(protocolFactory).marshall(super.beforeMarshalling(listTrackerConsumersRequest));<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, "Location");<NEW_LINE>request.addHandlerContext(HandlerContextKey.OPERATION_NAME, "ListTrackerConsumers");<NEW_LINE>request.addHandlerContext(HandlerContextKey.ADVANCED_CONFIG, advancedConfig);<NEW_LINE>} finally {<NEW_LINE>awsRequestMetrics.endEvent(Field.RequestMarshallTime);<NEW_LINE>}<NEW_LINE>URI endpointTraitHost = null;<NEW_LINE>if (!clientConfiguration.isDisableHostPrefixInjection()) {<NEW_LINE>String hostPrefix = "tracking.";<NEW_LINE>String resolvedHostPrefix = String.format("tracking.");<NEW_LINE>endpointTraitHost = UriResourcePathUtils.updateUriHost(endpoint, resolvedHostPrefix);<NEW_LINE>}<NEW_LINE>HttpResponseHandler<AmazonWebServiceResponse<ListTrackerConsumersResult>> responseHandler = protocolFactory.createResponseHandler(new JsonOperationMetadata().withPayloadJson(true).withHasStreamingSuccessResponse(false), new ListTrackerConsumersResultJsonUnmarshaller());<NEW_LINE>response = invoke(request, responseHandler, executionContext, null, endpointTraitHost);<NEW_LINE>return response.getAwsResponse();<NEW_LINE>} finally {<NEW_LINE>endClientExecution(awsRequestMetrics, request, response);<NEW_LINE>}<NEW_LINE>} | awsRequestMetrics.startEvent(Field.RequestMarshallTime); |
936,688 | public void testSLLFutureGetNoTimeout() throws Exception {<NEW_LINE>long currentThreadId = 0;<NEW_LINE>ResultsStatelessLocal bean = lookupSLLBean();<NEW_LINE>assertNotNull("Async Stateless Bean created successfully", bean);<NEW_LINE>// call bean asynchronous method using Future<V> object to receive results<NEW_LINE>Future<String> future = bean.test_fireAndReturnResults();<NEW_LINE>// Wait for up to 10 secs<NEW_LINE>svLogger.info("Retrieving results");<NEW_LINE>String results = future.get(<MASK><NEW_LINE>svLogger.info("Asynchronous method work completed: " + results);<NEW_LINE>assertEquals("Async Stateless Bean method completed", "true", results);<NEW_LINE>// get current thread Id for comparison to bean method thread id<NEW_LINE>currentThreadId = Thread.currentThread().getId();<NEW_LINE>svLogger.info("Test threadId = " + currentThreadId);<NEW_LINE>svLogger.info("Bean threadId = " + ResultsStatelessLocalFutureBean.beanThreadId);<NEW_LINE>assertFalse("Async Stateless Bean method completed on separate thread", (ResultsStatelessLocalFutureBean.beanThreadId == currentThreadId));<NEW_LINE>} | ResultsStatelessLocalFutureBean.MAX_ASYNC_WAIT, TimeUnit.MILLISECONDS); |
1,336,748 | public CompletableFuture<R> invoke(Object proxy, Method invokedMethod, Object[] args) {<NEW_LINE>Object command = args[0];<NEW_LINE>if (metaDataExtractors.length != 0) {<NEW_LINE>Map<String, Object> metaDataValues = new HashMap<>();<NEW_LINE>for (MetaDataExtractor extractor : metaDataExtractors) {<NEW_LINE>extractor.addMetaData(args, metaDataValues);<NEW_LINE>}<NEW_LINE>if (!metaDataValues.isEmpty()) {<NEW_LINE>command = asCommandMessage(command).withMetaData(metaDataValues);<NEW_LINE>}<NEW_LINE>}<NEW_LINE>if (forceCallbacks || !commandCallbacks.isEmpty()) {<NEW_LINE>List<CommandCallback<? super C, ? super R>> callbacks = new LinkedList<>();<NEW_LINE>FutureCallback<C, R> future = new FutureCallback<>();<NEW_LINE>callbacks.add(future);<NEW_LINE>for (Object arg : args) {<NEW_LINE>if (arg instanceof CommandCallback) {<NEW_LINE>final CommandCallback<C, R> callback = (CommandCallback<C, R>) arg;<NEW_LINE>callbacks.add(callback);<NEW_LINE>}<NEW_LINE>}<NEW_LINE>callbacks.addAll(commandCallbacks);<NEW_LINE>send(<MASK><NEW_LINE>return future.thenCompose(reply -> {<NEW_LINE>if (reply.isExceptional()) {<NEW_LINE>CompletableFuture<R> r = new CompletableFuture<>();<NEW_LINE>r.completeExceptionally(reply.exceptionResult());<NEW_LINE>return r;<NEW_LINE>}<NEW_LINE>return CompletableFuture.completedFuture(reply.getPayload());<NEW_LINE>});<NEW_LINE>} else {<NEW_LINE>sendAndForget(command);<NEW_LINE>return null;<NEW_LINE>}<NEW_LINE>} | command, new CompositeCallback(callbacks)); |
924,615 | private EntityDef addSecurityGroupEntity() {<NEW_LINE>final String guid = "042d9b5c-677e-477b-811f-1c39bf716759";<NEW_LINE>final String name = "SecurityGroup";<NEW_LINE>final String description = "A collection of users that should be given the same security privileges.";<NEW_LINE>final String descriptionGUID = null;<NEW_LINE>final String superTypeName = "TechnicalControl";<NEW_LINE>EntityDef entityDef = archiveHelper.getDefaultEntityDef(guid, name, this.archiveBuilder.getEntityDef(superTypeName), description, descriptionGUID);<NEW_LINE>List<TypeDefAttribute> <MASK><NEW_LINE>TypeDefAttribute property;<NEW_LINE>final String attribute1Name = "distinguishedName";<NEW_LINE>final String attribute1Description = "The LDAP distinguished name (DN) that gives a unique positional name in the LDAP DIT.";<NEW_LINE>final String attribute1DescriptionGUID = null;<NEW_LINE>property = archiveHelper.getStringTypeDefAttribute(attribute1Name, attribute1Description, attribute1DescriptionGUID);<NEW_LINE>properties.add(property);<NEW_LINE>entityDef.setPropertiesDefinition(properties);<NEW_LINE>return entityDef;<NEW_LINE>} | properties = new ArrayList<>(); |
908,057 | public void doReportStat(SofaTracerSpan sofaTracerSpan) {<NEW_LINE>Map<String, String> tagsWithStr = sofaTracerSpan.getTagsWithStr();<NEW_LINE>StatKey statKey = new StatKey();<NEW_LINE>String appName = tagsWithStr.get(CommonSpanTags.LOCAL_APP);<NEW_LINE>// service name<NEW_LINE>String serviceName = tagsWithStr.get(CommonSpanTags.SERVICE);<NEW_LINE>// method name<NEW_LINE>String methodName = tagsWithStr.get(CommonSpanTags.METHOD);<NEW_LINE>statKey.setKey(buildString(new String[] { appName, serviceName, methodName }));<NEW_LINE>String resultCode = tagsWithStr.get(CommonSpanTags.RESULT_CODE);<NEW_LINE>statKey.setResult(SofaTracerConstant.RESULT_CODE_SUCCESS.equals(resultCode) ? SofaTracerConstant.STAT_FLAG_SUCCESS : SofaTracerConstant.STAT_FLAG_FAILS);<NEW_LINE>statKey.setEnd(buildString(new String[] { TracerUtils.getLoadTestMark(sofaTracerSpan) }));<NEW_LINE>// pressure mark<NEW_LINE>statKey.setLoadTest(TracerUtils.isLoadTest(sofaTracerSpan));<NEW_LINE>// value the count and duration<NEW_LINE>long duration = sofaTracerSpan.getEndTime<MASK><NEW_LINE>long[] values = new long[] { 1, duration };<NEW_LINE>// reserve<NEW_LINE>this.addStat(statKey, values);<NEW_LINE>} | () - sofaTracerSpan.getStartTime(); |
1,299,682 | public UISWTViewEventListener createEventListener(UISWTView view) {<NEW_LINE>boolean isCloneable = isListenerCloneable();<NEW_LINE>UISWTViewEventListener listener = getListener();<NEW_LINE>synchronized (mapViewToListener) {<NEW_LINE>if (!isCloneable) {<NEW_LINE>if (!mapViewToListener.isEmpty()) {<NEW_LINE>UISWTView existingView = mapViewToListener.keySet().iterator().next();<NEW_LINE>if (existingView != null && existingView != view && !existingView.isContentDisposed()) {<NEW_LINE>Debug.out("createEventListener already called for '" + viewID + "' for a different view. Switch from pre-created listener to class reference to safely create multiple views.");<NEW_LINE>}<NEW_LINE>}<NEW_LINE>if (listener != null) {<NEW_LINE>mapViewToListener.put(view, new WeakReference<>(listener));<NEW_LINE>return listener;<NEW_LINE>}<NEW_LINE>} else {<NEW_LINE>// First creation gets the already instantiated listener, the<NEW_LINE>// rest make a clone. DeviceManagerUI.deviceView uses this<NEW_LINE>if (listener != null && mapViewToListener.isEmpty()) {<NEW_LINE>mapViewToListener.put(view, new WeakReference<>(listener));<NEW_LINE>return listener;<NEW_LINE>}<NEW_LINE>}<NEW_LINE>}<NEW_LINE>// We reach here only if cloneable and need to clone<NEW_LINE>try {<NEW_LINE>Class<? extends UISWTViewEventListener> aClass = getListenerClass();<NEW_LINE>UISWTViewEventListener eventListener = null;<NEW_LINE>if (listenerInstantiator != null) {<NEW_LINE>eventListener = listenerInstantiator.createNewInstance(this, view);<NEW_LINE>} else if (aClass != null) {<NEW_LINE>eventListener = aClass.newInstance();<NEW_LINE>} else if (listener instanceof UISWTViewEventListenerEx) {<NEW_LINE>eventListener = ((<MASK><NEW_LINE>}<NEW_LINE>if (eventListener != null) {<NEW_LINE>synchronized (mapViewToListener) {<NEW_LINE>mapViewToListener.put(view, new WeakReference<>(eventListener));<NEW_LINE>}<NEW_LINE>} else {<NEW_LINE>Debug.out("Could not create eventLister for '" + viewID + "'. No way found to instantiate.");<NEW_LINE>}<NEW_LINE>return eventListener;<NEW_LINE>} catch (Exception e) {<NEW_LINE>Debug.out(e);<NEW_LINE>return null;<NEW_LINE>}<NEW_LINE>} | UISWTViewEventListenerEx) listener).getClone(); |
1,187,765 | final StartExperimentResult executeStartExperiment(StartExperimentRequest startExperimentRequest) {<NEW_LINE>ExecutionContext executionContext = createExecutionContext(startExperimentRequest);<NEW_LINE>AWSRequestMetrics awsRequestMetrics = executionContext.getAwsRequestMetrics();<NEW_LINE><MASK><NEW_LINE>Request<StartExperimentRequest> request = null;<NEW_LINE>Response<StartExperimentResult> response = null;<NEW_LINE>try {<NEW_LINE>awsRequestMetrics.startEvent(Field.RequestMarshallTime);<NEW_LINE>try {<NEW_LINE>request = new StartExperimentRequestProtocolMarshaller(protocolFactory).marshall(super.beforeMarshalling(startExperimentRequest));<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, "fis");<NEW_LINE>request.addHandlerContext(HandlerContextKey.OPERATION_NAME, "StartExperiment");<NEW_LINE>request.addHandlerContext(HandlerContextKey.ADVANCED_CONFIG, advancedConfig);<NEW_LINE>} finally {<NEW_LINE>awsRequestMetrics.endEvent(Field.RequestMarshallTime);<NEW_LINE>}<NEW_LINE>HttpResponseHandler<AmazonWebServiceResponse<StartExperimentResult>> responseHandler = protocolFactory.createResponseHandler(new JsonOperationMetadata().withPayloadJson(true).withHasStreamingSuccessResponse(false), new StartExperimentResultJsonUnmarshaller());<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.startEvent(Field.ClientExecuteTime); |
1,501,811 | private Mono<Response<AttestationProviderInner>> updateWithResponseAsync(String resourceGroupName, String providerName, AttestationServicePatchParams updateParams, 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.<MASK><NEW_LINE>}<NEW_LINE>if (providerName == null) {<NEW_LINE>return Mono.error(new IllegalArgumentException("Parameter providerName is required and cannot be null."));<NEW_LINE>}<NEW_LINE>if (updateParams == null) {<NEW_LINE>return Mono.error(new IllegalArgumentException("Parameter updateParams is required and cannot be null."));<NEW_LINE>} else {<NEW_LINE>updateParams.validate();<NEW_LINE>}<NEW_LINE>final String accept = "application/json";<NEW_LINE>context = this.client.mergeContext(context);<NEW_LINE>return service.update(this.client.getEndpoint(), this.client.getSubscriptionId(), resourceGroupName, providerName, this.client.getApiVersion(), updateParams, accept, context);<NEW_LINE>} | error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); |
1,613,692 | public void onMucEditButtonClicked(View v) {<NEW_LINE>if (this.binding.mucEditor.getVisibility() == View.GONE) {<NEW_LINE>final MucOptions mucOptions = mConversation.getMucOptions();<NEW_LINE>this.binding.<MASK><NEW_LINE>this.binding.mucDisplay.setVisibility(View.GONE);<NEW_LINE>this.binding.editMucNameButton.setImageResource(getThemeResource(R.attr.icon_cancel, R.drawable.ic_cancel_black_24dp));<NEW_LINE>final String name = mucOptions.getName();<NEW_LINE>this.binding.mucEditTitle.setText("");<NEW_LINE>final boolean owner = mucOptions.getSelf().getAffiliation().ranks(MucOptions.Affiliation.OWNER);<NEW_LINE>if (owner || printableValue(name)) {<NEW_LINE>this.binding.mucEditTitle.setVisibility(View.VISIBLE);<NEW_LINE>if (name != null) {<NEW_LINE>this.binding.mucEditTitle.append(name);<NEW_LINE>}<NEW_LINE>} else {<NEW_LINE>this.binding.mucEditTitle.setVisibility(View.GONE);<NEW_LINE>}<NEW_LINE>this.binding.mucEditTitle.setEnabled(owner);<NEW_LINE>final String subject = mucOptions.getSubject();<NEW_LINE>this.binding.mucEditSubject.setText("");<NEW_LINE>if (subject != null) {<NEW_LINE>this.binding.mucEditSubject.append(subject);<NEW_LINE>}<NEW_LINE>this.binding.mucEditSubject.setEnabled(mucOptions.canChangeSubject());<NEW_LINE>if (!owner) {<NEW_LINE>this.binding.mucEditSubject.requestFocus();<NEW_LINE>}<NEW_LINE>} else {<NEW_LINE>String subject = this.binding.mucEditSubject.isEnabled() ? this.binding.mucEditSubject.getEditableText().toString().trim() : null;<NEW_LINE>String name = this.binding.mucEditTitle.isEnabled() ? this.binding.mucEditTitle.getEditableText().toString().trim() : null;<NEW_LINE>onMucInfoUpdated(subject, name);<NEW_LINE>SoftKeyboardUtils.hideSoftKeyboard(this);<NEW_LINE>hideEditor();<NEW_LINE>}<NEW_LINE>} | mucEditor.setVisibility(View.VISIBLE); |
1,459,501 | public Request<AssociateKmsKeyRequest> marshall(AssociateKmsKeyRequest associateKmsKeyRequest) {<NEW_LINE>if (associateKmsKeyRequest == null) {<NEW_LINE>throw new AmazonClientException("Invalid argument passed to marshall(AssociateKmsKeyRequest)");<NEW_LINE>}<NEW_LINE>Request<AssociateKmsKeyRequest> request = new DefaultRequest<AssociateKmsKeyRequest>(associateKmsKeyRequest, "AmazonCloudWatchLogs");<NEW_LINE>String target = "Logs_20140328.AssociateKmsKey";<NEW_LINE>request.addHeader("X-Amz-Target", target);<NEW_LINE>request.setHttpMethod(HttpMethodName.POST);<NEW_LINE>String uriResourcePath = "/";<NEW_LINE>request.setResourcePath(uriResourcePath);<NEW_LINE>try {<NEW_LINE>StringWriter stringWriter = new StringWriter();<NEW_LINE>AwsJsonWriter jsonWriter = JsonUtils.getJsonWriter(stringWriter);<NEW_LINE>jsonWriter.beginObject();<NEW_LINE>if (associateKmsKeyRequest.getLogGroupName() != null) {<NEW_LINE>String logGroupName = associateKmsKeyRequest.getLogGroupName();<NEW_LINE>jsonWriter.name("logGroupName");<NEW_LINE>jsonWriter.value(logGroupName);<NEW_LINE>}<NEW_LINE>if (associateKmsKeyRequest.getKmsKeyId() != null) {<NEW_LINE>String kmsKeyId = associateKmsKeyRequest.getKmsKeyId();<NEW_LINE>jsonWriter.name("kmsKeyId");<NEW_LINE>jsonWriter.value(kmsKeyId);<NEW_LINE>}<NEW_LINE>jsonWriter.endObject();<NEW_LINE>jsonWriter.close();<NEW_LINE>String snippet = stringWriter.toString();<NEW_LINE>byte[] content = snippet.getBytes(UTF8);<NEW_LINE>request.setContent(new StringInputStream(snippet));<NEW_LINE>request.addHeader("Content-Length", Integer.toString(content.length));<NEW_LINE>} catch (Throwable t) {<NEW_LINE>throw new AmazonClientException("Unable to marshall request to JSON: " + <MASK><NEW_LINE>}<NEW_LINE>if (!request.getHeaders().containsKey("Content-Type")) {<NEW_LINE>request.addHeader("Content-Type", "application/x-amz-json-1.1");<NEW_LINE>}<NEW_LINE>return request;<NEW_LINE>} | t.getMessage(), t); |
111,291 | public final QualifiedNameContext qualifiedName() throws RecognitionException {<NEW_LINE>QualifiedNameContext _localctx = new QualifiedNameContext(_ctx, getState());<NEW_LINE>enterRule(_localctx, 102, RULE_qualifiedName);<NEW_LINE>try {<NEW_LINE>int _alt;<NEW_LINE>enterOuterAlt(_localctx, 1);<NEW_LINE>{<NEW_LINE>setState(823);<NEW_LINE>_errHandler.sync(this);<NEW_LINE>_alt = getInterpreter().adaptivePredict(_input, 110, _ctx);<NEW_LINE>while (_alt != 2 && _alt != org.antlr.v4.runtime.atn.ATN.INVALID_ALT_NUMBER) {<NEW_LINE>if (_alt == 1) {<NEW_LINE>{<NEW_LINE>{<NEW_LINE>setState(818);<NEW_LINE>identifier();<NEW_LINE>setState(819);<NEW_LINE>match(DOT);<NEW_LINE>}<NEW_LINE>}<NEW_LINE>}<NEW_LINE>setState(825);<NEW_LINE>_errHandler.sync(this);<NEW_LINE>_alt = getInterpreter().adaptivePredict(_input, 110, _ctx);<NEW_LINE>}<NEW_LINE>setState(826);<NEW_LINE>identifier();<NEW_LINE>}<NEW_LINE>} catch (RecognitionException re) {<NEW_LINE>_localctx.exception = re;<NEW_LINE><MASK><NEW_LINE>_errHandler.recover(this, re);<NEW_LINE>} finally {<NEW_LINE>exitRule();<NEW_LINE>}<NEW_LINE>return _localctx;<NEW_LINE>} | _errHandler.reportError(this, re); |
1,177,994 | public List<FileEditor> openEditor(@Nonnull final OpenFileDescriptor descriptor, final boolean focusEditor) {<NEW_LINE>assertDispatchThread();<NEW_LINE>if (descriptor.getFile() instanceof VirtualFileWindow) {<NEW_LINE>VirtualFileWindow delegate = (VirtualFileWindow) descriptor.getFile();<NEW_LINE>int hostOffset = delegate.getDocumentWindow().injectedToHost(descriptor.getOffset());<NEW_LINE>OpenFileDescriptor realDescriptor = new OpenFileDescriptor(descriptor.getProject(), <MASK><NEW_LINE>realDescriptor.setUseCurrentWindow(descriptor.isUseCurrentWindow());<NEW_LINE>return openEditor(realDescriptor, focusEditor);<NEW_LINE>}<NEW_LINE>final List<FileEditor> result = new SmartList<>();<NEW_LINE>CommandProcessor.getInstance().executeCommand(myProject, () -> {<NEW_LINE>VirtualFile file = descriptor.getFile();<NEW_LINE>final FileEditor[] editors = openFile(file, focusEditor, !descriptor.isUseCurrentWindow());<NEW_LINE>ContainerUtil.addAll(result, editors);<NEW_LINE>boolean navigated = false;<NEW_LINE>for (final FileEditor editor : editors) {<NEW_LINE>if (editor instanceof NavigatableFileEditor && getSelectedEditor(descriptor.getFile()) == editor) {<NEW_LINE>// try to navigate opened editor<NEW_LINE>navigated = navigateAndSelectEditor((NavigatableFileEditor) editor, descriptor);<NEW_LINE>if (navigated)<NEW_LINE>break;<NEW_LINE>}<NEW_LINE>}<NEW_LINE>if (!navigated) {<NEW_LINE>for (final FileEditor editor : editors) {<NEW_LINE>if (editor instanceof NavigatableFileEditor && getSelectedEditor(descriptor.getFile()) != editor) {<NEW_LINE>// try other editors<NEW_LINE>if (navigateAndSelectEditor((NavigatableFileEditor) editor, descriptor)) {<NEW_LINE>break;<NEW_LINE>}<NEW_LINE>}<NEW_LINE>}<NEW_LINE>}<NEW_LINE>}, "", null);<NEW_LINE>return result;<NEW_LINE>} | delegate.getDelegate(), hostOffset); |
590,034 | public void createPartControl(Composite parent) {<NEW_LINE>comp = new Composite(parent, SWT.NONE);<NEW_LINE>table = new Table(comp, SWT.BORDER | SWT.WRAP | SWT.FULL_SELECTION | <MASK><NEW_LINE>table.setHeaderVisible(true);<NEW_LINE>table.setLinesVisible(true);<NEW_LINE>comp.setLayout(tableColumnLayout);<NEW_LINE>table.addKeyListener(new KeyListener() {<NEW_LINE><NEW_LINE>public void keyReleased(KeyEvent e) {<NEW_LINE>}<NEW_LINE><NEW_LINE>public void keyPressed(KeyEvent e) {<NEW_LINE>if (e.keyCode == SWT.F5) {<NEW_LINE>if (GeneralTableView.this.action != null) {<NEW_LINE>GeneralTableView.this.action.run();<NEW_LINE>}<NEW_LINE>}<NEW_LINE>}<NEW_LINE>});<NEW_LINE>IToolBarManager man = getViewSite().getActionBars().getToolBarManager();<NEW_LINE>Action action = new Action("Reload", ImageUtil.getImageDescriptor(Images.refresh)) {<NEW_LINE><NEW_LINE>public void run() {<NEW_LINE>if (GeneralTableView.this.action != null) {<NEW_LINE>GeneralTableView.this.action.run();<NEW_LINE>}<NEW_LINE>}<NEW_LINE>};<NEW_LINE>man.add(action);<NEW_LINE>actAutoRefresh = new Action("Auto Refresh in 5 sec.", IAction.AS_CHECK_BOX) {<NEW_LINE><NEW_LINE>public void run() {<NEW_LINE>if (actAutoRefresh.isChecked()) {<NEW_LINE>if (GeneralTableView.this.action != null) {<NEW_LINE>GeneralTableView.this.action.run();<NEW_LINE>}<NEW_LINE>}<NEW_LINE>}<NEW_LINE>};<NEW_LINE>actAutoRefresh.setImageDescriptor(ImageUtil.getImageDescriptor(Images.refresh_auto));<NEW_LINE>man.add(actAutoRefresh);<NEW_LINE>if (thread == null) {<NEW_LINE>thread = new RefreshThread(this, 5000);<NEW_LINE>thread.start();<NEW_LINE>}<NEW_LINE>} | SWT.V_SCROLL | SWT.H_SCROLL); |
1,817,077 | public boolean handleLicenses() {<NEW_LINE>if (acceptLicense) {<NEW_LINE>return true;<NEW_LINE>}<NEW_LINE>InstallKernelInteractive installKernel = InstallKernelFactory.getInteractiveInstance();<NEW_LINE>try {<NEW_LINE>installKernel.resolve(this.features, false);<NEW_LINE>featureLicenses = installKernel.<MASK><NEW_LINE>Set<InstallLicense> licenseToAccept = InstallUtils.getLicenseToAccept(featureLicenses);<NEW_LINE>if (!acceptLicense) {<NEW_LINE>if (!licenseToAccept.isEmpty()) {<NEW_LINE>showFeaturesForLicenseAcceptance(licenseToAccept);<NEW_LINE>}<NEW_LINE>for (InstallLicense license : licenseToAccept) {<NEW_LINE>if (!!!handleLicenseAcceptance(license)) {<NEW_LINE>return false;<NEW_LINE>}<NEW_LINE>}<NEW_LINE>}<NEW_LINE>} catch (ProductInfoParseException e) {<NEW_LINE>System.out.println(e.getMessage());<NEW_LINE>return false;<NEW_LINE>} catch (DuplicateProductInfoException e) {<NEW_LINE>System.out.println(e.getMessage());<NEW_LINE>return false;<NEW_LINE>} catch (ProductInfoReplaceException e) {<NEW_LINE>System.out.println(e.getMessage());<NEW_LINE>return false;<NEW_LINE>} catch (InstallException e) {<NEW_LINE>e.printStackTrace();<NEW_LINE>return false;<NEW_LINE>}<NEW_LINE>return true;<NEW_LINE>} | getFeatureLicense(Locale.getDefault()); |
731,375 | static Stream<String> splitNameservers(String ns) {<NEW_LINE>Matcher matcher = FORMAT_BRACKETS.matcher(ns);<NEW_LINE>if (!matcher.matches()) {<NEW_LINE>checkArgument(!ns.contains("[") && !ns.contains("]"), "Could not parse square brackets in %s", ns);<NEW_LINE>return ImmutableList.of(ns).stream();<NEW_LINE>}<NEW_LINE>ImmutableList.Builder<String> nameservers = <MASK><NEW_LINE>int start = parseInt(matcher.group(2));<NEW_LINE>int end = parseInt(matcher.group(3));<NEW_LINE>checkArgument(start <= end, "Number range [%s-%s] is invalid", start, end);<NEW_LINE>for (int i = start; i <= end; i++) {<NEW_LINE>nameservers.add(String.format("%s%d%s", matcher.group(1), i, matcher.group(4)));<NEW_LINE>}<NEW_LINE>return nameservers.build().stream();<NEW_LINE>} | new ImmutableList.Builder<>(); |
1,683,822 | protected void masterOperation(Task task, final ResumeFollowAction.Request request, ClusterState state, final ActionListener<AcknowledgedResponse> listener) throws Exception {<NEW_LINE>if (ccrLicenseChecker.isCcrAllowed() == false) {<NEW_LINE>listener.onFailure(LicenseUtils.newComplianceException("ccr"));<NEW_LINE>return;<NEW_LINE>}<NEW_LINE>final IndexMetadata followerIndexMetadata = state.getMetadata().index(request.getFollowerIndex());<NEW_LINE>if (followerIndexMetadata == null) {<NEW_LINE>listener.onFailure(new IndexNotFoundException(request.getFollowerIndex()));<NEW_LINE>return;<NEW_LINE>}<NEW_LINE>final Map<String, String> ccrMetadata = followerIndexMetadata.getCustomData(Ccr.CCR_CUSTOM_METADATA_KEY);<NEW_LINE>if (ccrMetadata == null) {<NEW_LINE>throw new IllegalArgumentException("follow index [" + request.getFollowerIndex() + "] does not have ccr metadata");<NEW_LINE>}<NEW_LINE>final String leaderCluster = ccrMetadata.get(Ccr.CCR_CUSTOM_METADATA_REMOTE_CLUSTER_NAME_KEY);<NEW_LINE>// Validates whether the leader cluster has been configured properly:<NEW_LINE>client.getRemoteClusterClient(leaderCluster);<NEW_LINE>final String leaderIndex = <MASK><NEW_LINE>ccrLicenseChecker.checkRemoteClusterLicenseAndFetchLeaderIndexMetadataAndHistoryUUIDs(client, leaderCluster, leaderIndex, listener::onFailure, (leaderHistoryUUID, leaderIndexMetadata) -> {<NEW_LINE>try {<NEW_LINE>start(request, leaderCluster, leaderIndexMetadata.v1(), followerIndexMetadata, leaderHistoryUUID, listener);<NEW_LINE>} catch (final IOException e) {<NEW_LINE>listener.onFailure(e);<NEW_LINE>}<NEW_LINE>});<NEW_LINE>} | ccrMetadata.get(Ccr.CCR_CUSTOM_METADATA_LEADER_INDEX_NAME_KEY); |
640,391 | protected Map<Object, Object> convertToParameters(Object... iArgs) {<NEW_LINE><MASK><NEW_LINE>if (iArgs.length == 1 && iArgs[0] instanceof Map) {<NEW_LINE>params = (Map<Object, Object>) iArgs[0];<NEW_LINE>} else {<NEW_LINE>if (iArgs.length == 1 && iArgs[0] != null && iArgs[0].getClass().isArray() && iArgs[0] instanceof Object[])<NEW_LINE>iArgs = (Object[]) iArgs[0];<NEW_LINE>params = new HashMap<Object, Object>(iArgs.length);<NEW_LINE>for (int i = 0; i < iArgs.length; ++i) {<NEW_LINE>Object par = iArgs[i];<NEW_LINE>if (par instanceof OIdentifiable && ((OIdentifiable) par).getIdentity().isValid())<NEW_LINE>// USE THE RID ONLY<NEW_LINE>par = ((OIdentifiable) par).getIdentity();<NEW_LINE>params.put(i, par);<NEW_LINE>}<NEW_LINE>}<NEW_LINE>return params;<NEW_LINE>} | final Map<Object, Object> params; |
212,146 | protected CompilationParticipantResult[] notifyParticipants(SourceFile[] unitsAboutToCompile) {<NEW_LINE>CompilationParticipantResult[] results = new CompilationParticipantResult[unitsAboutToCompile.length];<NEW_LINE>for (int i = unitsAboutToCompile.length; --i >= 0; ) results[i] = new CompilationParticipantResult(unitsAboutToCompile[i], this.compilationGroup == CompilationGroup.TEST);<NEW_LINE>// TODO (kent) do we expect to have more than one participant?<NEW_LINE>// and if so should we pass the generated files from the each processor to the others to process?<NEW_LINE>// and what happens if some participants do not expect to be called with only a few files, after seeing 'all' the files?<NEW_LINE>for (int i = 0, l = this.javaBuilder.participants.length; i < l; i++) this.javaBuilder.participants[i].<MASK><NEW_LINE>SimpleSet uniqueFiles = null;<NEW_LINE>CompilationParticipantResult[] toAdd = null;<NEW_LINE>int added = 0;<NEW_LINE>for (int i = results.length; --i >= 0; ) {<NEW_LINE>CompilationParticipantResult result = results[i];<NEW_LINE>if (result == null)<NEW_LINE>continue;<NEW_LINE>IFile[] deletedGeneratedFiles = result.deletedFiles;<NEW_LINE>if (deletedGeneratedFiles != null)<NEW_LINE>deleteGeneratedFiles(deletedGeneratedFiles);<NEW_LINE>IFile[] addedGeneratedFiles = result.addedFiles;<NEW_LINE>if (addedGeneratedFiles != null) {<NEW_LINE>for (int j = addedGeneratedFiles.length; --j >= 0; ) {<NEW_LINE>SourceFile sourceFile = findSourceFile(addedGeneratedFiles[j], true);<NEW_LINE>if (sourceFile == null)<NEW_LINE>continue;<NEW_LINE>if (uniqueFiles == null) {<NEW_LINE>uniqueFiles = new SimpleSet(unitsAboutToCompile.length + 3);<NEW_LINE>for (int f = unitsAboutToCompile.length; --f >= 0; ) uniqueFiles.add(unitsAboutToCompile[f]);<NEW_LINE>}<NEW_LINE>if (uniqueFiles.addIfNotIncluded(sourceFile) == sourceFile) {<NEW_LINE>CompilationParticipantResult newResult = new CompilationParticipantResult(sourceFile, this.compilationGroup == CompilationGroup.TEST);<NEW_LINE>// is there enough room to add all the addedGeneratedFiles.length ?<NEW_LINE>if (toAdd == null) {<NEW_LINE>toAdd = new CompilationParticipantResult[addedGeneratedFiles.length];<NEW_LINE>} else {<NEW_LINE>int length = toAdd.length;<NEW_LINE>if (added == length)<NEW_LINE>System.arraycopy(toAdd, 0, toAdd = new CompilationParticipantResult[length + addedGeneratedFiles.length], 0, length);<NEW_LINE>}<NEW_LINE>toAdd[added++] = newResult;<NEW_LINE>this.workQueue.add(sourceFile);<NEW_LINE>}<NEW_LINE>}<NEW_LINE>}<NEW_LINE>}<NEW_LINE>if (added > 0) {<NEW_LINE>int length = results.length;<NEW_LINE>System.arraycopy(results, 0, results = new CompilationParticipantResult[length + added], 0, length);<NEW_LINE>System.arraycopy(toAdd, 0, results, length, added);<NEW_LINE>}<NEW_LINE>return results;<NEW_LINE>} | buildStarting(results, this instanceof BatchImageBuilder); |
454,939 | public <T> TypeAdapter<T> create(Gson gson, TypeToken<T> type) {<NEW_LINE>if (!Pet.class.isAssignableFrom(type.getRawType())) {<NEW_LINE>// this class only serializes 'Pet' and its subtypes<NEW_LINE>return null;<NEW_LINE>}<NEW_LINE>final TypeAdapter<JsonElement> elementAdapter = gson.getAdapter(JsonElement.class);<NEW_LINE>final TypeAdapter<Pet> thisAdapter = gson.getDelegateAdapter(this, TypeToken.get(Pet.class));<NEW_LINE>return (TypeAdapter<T>) new TypeAdapter<Pet>() {<NEW_LINE><NEW_LINE>@Override<NEW_LINE>public void write(JsonWriter out, Pet value) throws IOException {<NEW_LINE>JsonObject obj = thisAdapter.<MASK><NEW_LINE>elementAdapter.write(out, obj);<NEW_LINE>}<NEW_LINE><NEW_LINE>@Override<NEW_LINE>public Pet read(JsonReader in) throws IOException {<NEW_LINE>JsonObject jsonObj = elementAdapter.read(in).getAsJsonObject();<NEW_LINE>validateJsonObject(jsonObj);<NEW_LINE>return thisAdapter.fromJsonTree(jsonObj);<NEW_LINE>}<NEW_LINE>}.nullSafe();<NEW_LINE>} | toJsonTree(value).getAsJsonObject(); |
456,400 | public boolean init(String[] args) throws ParseException {<NEW_LINE>CommandLine cliParser = new GnuParser().parse(jstormClientContext.opts, args);<NEW_LINE>if (cliParser.hasOption(JOYConstants.HELP)) {<NEW_LINE>printUsage();<NEW_LINE>return false;<NEW_LINE>}<NEW_LINE>jstormClientContext.appName = cliParser.getOptionValue(JOYConstants.APP_NAME_KEY, JOYConstants.CLIIENT_CLASS);<NEW_LINE>jstormClientContext.amPriority = Integer.parseInt(cliParser.getOptionValue(JOYConstants.PRIORITY, JOYConstants.DEFAULT_PRIORITY));<NEW_LINE>jstormClientContext.amQueue = cliParser.getOptionValue(JOYConstants.QUEUE, JOYConstants.QUEUE_NAME);<NEW_LINE>jstormClientContext.amMemory = Integer.parseInt(cliParser.getOptionValue(JOYConstants.MASTER_MEMORY, JOYConstants.DEFAULT_MASTER_MEMORY));<NEW_LINE>jstormClientContext.amVCores = Integer.parseInt(cliParser.getOptionValue(JOYConstants.MASTER_VCORES, JOYConstants.DEFAULT_MASTER_VCORES));<NEW_LINE>jstormClientContext.appMasterJar = cliParser.getOptionValue(JOYConstants.JAR);<NEW_LINE>jstormClientContext.libJars = cliParser.getOptionValue(JOYConstants.LIB_JAR);<NEW_LINE>jstormClientContext.homeDir = cliParser.getOptionValue(JOYConstants.HOME_DIR);<NEW_LINE>jstormClientContext.confFile = cliParser.getOptionValue(JOYConstants.CONF_FILE);<NEW_LINE>jstormClientContext.rmHost = cliParser.getOptionValue(JOYConstants.RM_ADDRESS, JOYConstants.EMPTY);<NEW_LINE>jstormClientContext.nameNodeHost = cliParser.getOptionValue(JOYConstants.NN_ADDRESS, JOYConstants.EMPTY);<NEW_LINE>jstormClientContext.deployPath = cliParser.getOptionValue(JOYConstants.DEPLOY_PATH, JOYConstants.EMPTY);<NEW_LINE>jstormClientContext.hadoopConfDir = cliParser.getOptionValue(JOYConstants.HADOOP_CONF_DIR, JOYConstants.EMPTY);<NEW_LINE>jstormClientContext.instanceName = cliParser.getOptionValue(<MASK><NEW_LINE>JstormYarnUtils.checkAndSetOptions(cliParser, jstormClientContext);<NEW_LINE>return true;<NEW_LINE>} | JOYConstants.INSTANCE_NAME, JOYConstants.EMPTY); |
355,073 | private BraceContext findContextBackwards() throws BadLocationException {<NEW_LINE>((AbstractDocument) context.getDocument()).readLock();<NEW_LINE>try {<NEW_LINE>BaseDocument doc = <MASK><NEW_LINE>TokenSequence<? extends PHPTokenId> ts = LexUtilities.getPHPTokenSequence(doc, matchingOffset);<NEW_LINE>if (ts == null) {<NEW_LINE>return null;<NEW_LINE>}<NEW_LINE>ts.move(matchingOffset);<NEW_LINE>if (!ts.moveNext()) {<NEW_LINE>return null;<NEW_LINE>}<NEW_LINE>List<PHPTokenId> lookfor = // terminator<NEW_LINE>Arrays.// terminator<NEW_LINE>asList(PHPTokenId.PHP_CURLY_CLOSE, PHPTokenId.PHP_CLASS, PHPTokenId.PHP_INTERFACE, PHPTokenId.PHP_TRAIT, PHPTokenId.PHP_FUNCTION, PHPTokenId.PHP_FOR, PHPTokenId.PHP_FOREACH, PHPTokenId.PHP_DO, PHPTokenId.PHP_WHILE, PHPTokenId.PHP_TRY, PHPTokenId.PHP_CATCH, PHPTokenId.PHP_FINALLY, PHPTokenId.PHP_IF, PHPTokenId.PHP_ELSE, PHPTokenId.PHP_ELSEIF, PHPTokenId.PHP_SWITCH, PHPTokenId.PHP_USE, PHPTokenId.PHP_MATCH);<NEW_LINE>Token<? extends PHPTokenId> previousToken = LexUtilities.findPreviousToken(ts, lookfor);<NEW_LINE>if (previousToken == null || previousToken.id() == PHPTokenId.PHP_CURLY_CLOSE) {<NEW_LINE>return null;<NEW_LINE>}<NEW_LINE>PHPTokenId id = previousToken.id();<NEW_LINE>switch(id) {<NEW_LINE>case PHP_ELSE:<NEW_LINE>return getBraceContextForIfStatement(ts);<NEW_LINE>default:<NEW_LINE>return getBraceContext(ts.offset());<NEW_LINE>}<NEW_LINE>} finally {<NEW_LINE>((AbstractDocument) context.getDocument()).readUnlock();<NEW_LINE>}<NEW_LINE>} | (BaseDocument) context.getDocument(); |
1,830,535 | public void mouseClicked(MouseEvent e) {<NEW_LINE>if (callback == null) {<NEW_LINE>return;<NEW_LINE>}<NEW_LINE>data.setComponent(this);<NEW_LINE>data.setCard(this.getGameCard());<NEW_LINE>data.setGameId(this.gameId);<NEW_LINE>// popup menu processing<NEW_LINE>if (e.isPopupTrigger() || SwingUtilities.isRightMouseButton(e)) {<NEW_LINE><MASK><NEW_LINE>return;<NEW_LINE>}<NEW_LINE>// double clicks processing, see https://stackoverflow.com/questions/4051659/identifying-double-click-in-java<NEW_LINE>// logic: run timer to reset clicks counter<NEW_LINE>mouseClicksCount = e.getClickCount();<NEW_LINE>if (mouseClicksCount > 1) {<NEW_LINE>// forced to double click<NEW_LINE>if (mouseResetTimer != null) {<NEW_LINE>mouseResetTimer.cancel();<NEW_LINE>}<NEW_LINE>callback.mouseClicked(e, data, true);<NEW_LINE>} else {<NEW_LINE>// can be single or double click, start the reset timer<NEW_LINE>if (mouseResetTimer != null) {<NEW_LINE>mouseResetTimer.cancel();<NEW_LINE>}<NEW_LINE>mouseResetTimer = new java.util.Timer("mouseResetTimer", false);<NEW_LINE>mouseResetTimer.schedule(new TimerTask() {<NEW_LINE><NEW_LINE>@Override<NEW_LINE>public void run() {<NEW_LINE>if (callback != null) {<NEW_LINE>if (mouseClicksCount == 1) {<NEW_LINE>callback.mouseClicked(e, data, false);<NEW_LINE>} else if (mouseClicksCount > 1) {<NEW_LINE>callback.mouseClicked(e, data, true);<NEW_LINE>}<NEW_LINE>}<NEW_LINE>mouseClicksCount = 0;<NEW_LINE>}<NEW_LINE>}, MOUSE_DOUBLE_CLICK_RESET_MS);<NEW_LINE>}<NEW_LINE>} | callback.popupMenuCard(e, data); |
904,903 | public static IRubyObject warn(ThreadContext context, IRubyObject recv, IRubyObject[] args) {<NEW_LINE>boolean kwargs = false;<NEW_LINE>int uplevel = 0;<NEW_LINE>int argMessagesLen = args.length;<NEW_LINE>if (argMessagesLen > 0) {<NEW_LINE>IRubyObject opts = TypeConverter.checkHashType(context.runtime, args[argMessagesLen - 1]);<NEW_LINE>if (opts != context.nil) {<NEW_LINE>argMessagesLen--;<NEW_LINE>IRubyObject ret = ArgsUtil.extractKeywordArg(context<MASK><NEW_LINE>if (// as if options Hash wasn't passed<NEW_LINE>ret == null)<NEW_LINE>// as if options Hash wasn't passed<NEW_LINE>kwargs = false;<NEW_LINE>else {<NEW_LINE>kwargs = true;<NEW_LINE>if ((uplevel = RubyNumeric.num2int(ret)) < 0) {<NEW_LINE>throw context.runtime.newArgumentError("negative level (" + uplevel + ")");<NEW_LINE>}<NEW_LINE>}<NEW_LINE>}<NEW_LINE>}<NEW_LINE>int i = 0;<NEW_LINE>if (!context.runtime.getVerbose().isNil() && argMessagesLen > 0) {<NEW_LINE>if (kwargs && argMessagesLen > 0) {<NEW_LINE>// warn(uplevel: X) does nothing<NEW_LINE>warnStr(context, recv, buildWarnMessage(context, uplevel, args[0]));<NEW_LINE>i = 1;<NEW_LINE>}<NEW_LINE>for (; i < argMessagesLen; i++) {<NEW_LINE>warnObj(context, recv, args[i]);<NEW_LINE>}<NEW_LINE>}<NEW_LINE>return context.nil;<NEW_LINE>} | , (RubyHash) opts, "uplevel"); |
1,718,040 | public boolean matches(final IStorageRecord storageRecord) {<NEW_LINE>if (storageRecord == null) {<NEW_LINE>return false;<NEW_LINE>}<NEW_LINE>//<NEW_LINE>// Check if Product matches<NEW_LINE>final Set<ProductId> queryProductIds = getProductIds();<NEW_LINE>if (!queryProductIds.isEmpty()) {<NEW_LINE>final ProductId recordProductId = storageRecord.getProductId();<NEW_LINE>if (!queryProductIds.contains(recordProductId)) {<NEW_LINE>return false;<NEW_LINE>}<NEW_LINE>}<NEW_LINE>//<NEW_LINE>// Make sure we are not dealing with an After-Picking locator (08123)<NEW_LINE>final I_M_Locator recordLocator = InterfaceWrapperHelper.create(storageRecord.getLocator(), I_M_Locator.class);<NEW_LINE>if (recordLocator.isAfterPickingLocator()) {<NEW_LINE>return false;<NEW_LINE>}<NEW_LINE>//<NEW_LINE>// Check if Warehouse/Locator matches<NEW_LINE>final Set<Integer> queryWarehouseIds = getWarehouseIds();<NEW_LINE>if (!queryWarehouseIds.isEmpty()) {<NEW_LINE>final int recordWarehouseId = recordLocator.getM_Warehouse_ID();<NEW_LINE>if (!queryWarehouseIds.contains(recordWarehouseId)) {<NEW_LINE>return false;<NEW_LINE>}<NEW_LINE>}<NEW_LINE>//<NEW_LINE>// Check if BPartner matches<NEW_LINE>final Set<MASK><NEW_LINE>if (!queryBPartnerIds.isEmpty()) {<NEW_LINE>final I_C_BPartner bpartner = storageRecord.getC_BPartner();<NEW_LINE>Integer bpartnerRepoId = bpartner == null ? null : bpartner.getC_BPartner_ID();<NEW_LINE>// make sure if is <=0 then to use NULL which means ANY<NEW_LINE>bpartnerRepoId = bpartnerRepoId != null && bpartnerRepoId <= 0 ? null : bpartnerRepoId;<NEW_LINE>final BPartnerId bPartnerId = BPartnerId.ofRepoIdOrNull(bpartnerRepoId);<NEW_LINE>if (!queryBPartnerIds.contains(bPartnerId)) {<NEW_LINE>return false;<NEW_LINE>}<NEW_LINE>}<NEW_LINE>//<NEW_LINE>// Check if required attributes are matching<NEW_LINE>final IAttributeSet recordAttributes = storageRecord.getAttributes();<NEW_LINE>return huQueryBuilder.matches(recordAttributes);<NEW_LINE>} | <BPartnerId> queryBPartnerIds = getBPartnerIds(); |
1,250,243 | public void paintOverlay(Graphics2D g, Token aToken, Rectangle bounds) {<NEW_LINE>double hc = (double) bounds.width / 2;<NEW_LINE>double vc = (double) bounds.height / 2;<NEW_LINE>Color tempColor = g.getColor();<NEW_LINE>g.setColor(getColor());<NEW_LINE>Stroke tempStroke = g.getStroke();<NEW_LINE>g.setStroke(getStroke());<NEW_LINE>Composite tempComposite = g.getComposite();<NEW_LINE>if (getOpacity() != 100)<NEW_LINE>g.setComposite(AlphaComposite.getInstance(AlphaComposite.SRC_OVER, (float) getOpacity() / 100));<NEW_LINE>g.draw(new Line2D.Double(0<MASK><NEW_LINE>g.draw(new Line2D.Double(hc, 0, bounds.width, vc));<NEW_LINE>g.draw(new Line2D.Double(bounds.width, vc, hc, bounds.height));<NEW_LINE>g.draw(new Line2D.Double(hc, bounds.height, 0, vc));<NEW_LINE>g.setColor(tempColor);<NEW_LINE>g.setStroke(tempStroke);<NEW_LINE>g.setComposite(tempComposite);<NEW_LINE>} | , vc, hc, 0)); |
61,950 | public Element saveToXml() {<NEW_LINE>Element root = new Element("FORMAT");<NEW_LINE>for (int i = 0; i < rows.size(); i++) {<NEW_LINE>Element rowElem = new Element("ROW");<NEW_LINE>Row row = rows.get(i);<NEW_LINE>FieldFactory[] rowFactorys = row.getFactorys();<NEW_LINE>for (FieldFactory ff : rowFactorys) {<NEW_LINE>Element colElem = new Element("FIELD");<NEW_LINE>if (ff instanceof SpacerFieldFactory) {<NEW_LINE>SpacerFieldFactory sff = (SpacerFieldFactory) ff;<NEW_LINE>String text = sff.getText();<NEW_LINE>// has no name!<NEW_LINE>if (text != null) {<NEW_LINE>colElem.setAttribute("TEXT", text);<NEW_LINE>}<NEW_LINE>} else {<NEW_LINE>colElem.setAttribute("NAME", ff.getFieldName());<NEW_LINE>}<NEW_LINE>colElem.setAttribute("WIDTH", <MASK><NEW_LINE>colElem.setAttribute("ENABLED", "" + ff.isEnabled());<NEW_LINE>rowElem.addContent(colElem);<NEW_LINE>}<NEW_LINE>root.addContent(rowElem);<NEW_LINE>}<NEW_LINE>return root;<NEW_LINE>} | "" + ff.getWidth()); |
62,838 | private void loadNode1061() {<NEW_LINE>PropertyTypeNode node = new PropertyTypeNode(this.context, Identifiers.NamespacesType_NamespaceIdentifier_Placeholder_IsNamespaceSubset, new QualifiedName(0, "IsNamespaceSubset"), new LocalizedText("en", "IsNamespaceSubset"), LocalizedText.NULL_VALUE, UInteger.valueOf(0), UInteger.valueOf(0), new DataValue(Variant.NULL_VALUE), Identifiers.Boolean, -1, new UInteger[] {}, UByte.valueOf(1), UByte.valueOf(1), 0.0, false);<NEW_LINE>node.addReference(new Reference(Identifiers.NamespacesType_NamespaceIdentifier_Placeholder_IsNamespaceSubset, Identifiers.HasTypeDefinition, Identifiers.PropertyType.expanded(), true));<NEW_LINE>node.addReference(new Reference(Identifiers.NamespacesType_NamespaceIdentifier_Placeholder_IsNamespaceSubset, Identifiers.HasModellingRule, Identifiers.ModellingRule_Mandatory<MASK><NEW_LINE>node.addReference(new Reference(Identifiers.NamespacesType_NamespaceIdentifier_Placeholder_IsNamespaceSubset, Identifiers.HasProperty, Identifiers.NamespacesType_NamespaceIdentifier_Placeholder.expanded(), false));<NEW_LINE>this.nodeManager.addNode(node);<NEW_LINE>} | .expanded(), true)); |
330,020 | static public int showDownloadSysImageDialog(Frame editor, boolean wear) {<NEW_LINE>String title = wear ? AndroidMode.getTextString("android_sdk.dialog.download_watch_image_title") : AndroidMode.getTextString("android_sdk.dialog.download_phone_image_title");<NEW_LINE>String msg = wear ? AndroidMode.getTextString("android_sdk.dialog.download_watch_image_body") : AndroidMode.getTextString("android_sdk.dialog.download_phone_image_body");<NEW_LINE>String htmlString = "<html> " + "<head> <style type=\"text/css\">" + "p { font: " + FONT_SIZE + "pt \"Lucida Grande\"; " + "margin: " + TEXT_MARGIN + "px; " + "width: " + TEXT_WIDTH + "px }" + "</style> </head>" + "<body> <p>" + msg + "</p> </body> </html>";<NEW_LINE>JEditorPane pane = new JEditorPane("text/html", htmlString);<NEW_LINE>pane.addHyperlinkListener(new HyperlinkListener() {<NEW_LINE><NEW_LINE>@Override<NEW_LINE>public void hyperlinkUpdate(HyperlinkEvent e) {<NEW_LINE>if (e.getEventType().equals(HyperlinkEvent.EventType.ACTIVATED)) {<NEW_LINE>Platform.openURL(e.<MASK><NEW_LINE>}<NEW_LINE>}<NEW_LINE>});<NEW_LINE>pane.setEditable(false);<NEW_LINE>JLabel label = new JLabel();<NEW_LINE>pane.setBackground(label.getBackground());<NEW_LINE>String[] options = new String[] { Language.text("prompt.yes"), Language.text("prompt.no") };<NEW_LINE>int result = JOptionPane.showOptionDialog(null, pane, title, JOptionPane.DEFAULT_OPTION, JOptionPane.QUESTION_MESSAGE, null, options, options[0]);<NEW_LINE>if (result == JOptionPane.YES_OPTION) {<NEW_LINE>return JOptionPane.YES_OPTION;<NEW_LINE>} else if (result == JOptionPane.NO_OPTION) {<NEW_LINE>return JOptionPane.NO_OPTION;<NEW_LINE>} else {<NEW_LINE>return JOptionPane.CLOSED_OPTION;<NEW_LINE>}<NEW_LINE>} | getURL().toString()); |
1,578,042 | // Responds to an HTTP request using data from the request body parsed according to the<NEW_LINE>// "content-type" header.<NEW_LINE>@Override<NEW_LINE>public void service(HttpRequest request, HttpResponse response) throws IOException {<NEW_LINE>String name = null;<NEW_LINE>// Default values avoid null issues (with switch/case) and exceptions from get() (optionals)<NEW_LINE>String contentType = request.getContentType().orElse("");<NEW_LINE>switch(contentType) {<NEW_LINE>case "application/json":<NEW_LINE>// '{"name":"John"}'<NEW_LINE>JsonObject body = gson.fromJson(request.getReader(), JsonObject.class);<NEW_LINE>if (body.has("name")) {<NEW_LINE>name = body.get("name").getAsString();<NEW_LINE>}<NEW_LINE>break;<NEW_LINE>case "application/octet-stream":<NEW_LINE>// 'John', stored in a Buffer<NEW_LINE>name = new String(Base64.getDecoder().decode(request.getInputStream().readAllBytes<MASK><NEW_LINE>break;<NEW_LINE>case "text/plain":<NEW_LINE>// 'John'<NEW_LINE>name = request.getReader().readLine();<NEW_LINE>break;<NEW_LINE>case "application/x-www-form-urlencoded":<NEW_LINE>// 'name=John' in the body of a POST request (not the URL)<NEW_LINE>Optional<String> nameParam = request.getFirstQueryParameter("name");<NEW_LINE>if (nameParam.isPresent()) {<NEW_LINE>name = nameParam.get();<NEW_LINE>}<NEW_LINE>break;<NEW_LINE>default:<NEW_LINE>// Invalid or missing "Content-Type" header<NEW_LINE>response.setStatusCode(HttpURLConnection.HTTP_UNSUPPORTED_TYPE);<NEW_LINE>return;<NEW_LINE>}<NEW_LINE>// Verify that a name was provided<NEW_LINE>if (name == null) {<NEW_LINE>response.setStatusCode(HttpURLConnection.HTTP_BAD_REQUEST);<NEW_LINE>}<NEW_LINE>// Respond with a name<NEW_LINE>var writer = new PrintWriter(response.getWriter());<NEW_LINE>writer.printf("Hello %s!", name);<NEW_LINE>} | ()), StandardCharsets.UTF_8); |
139,128 | protected final void buildMetadata(NetworkTable metaTable) {<NEW_LINE>if (!m_metadataDirty) {<NEW_LINE>return;<NEW_LINE>}<NEW_LINE>// Component type<NEW_LINE>if (getType() == null) {<NEW_LINE>metaTable.getEntry("PreferredComponent").delete();<NEW_LINE>} else {<NEW_LINE>metaTable.getEntry("PreferredComponent").forceSetString(getType());<NEW_LINE>}<NEW_LINE>// Tile size<NEW_LINE>if (m_width <= 0 || m_height <= 0) {<NEW_LINE>metaTable.getEntry("Size").delete();<NEW_LINE>} else {<NEW_LINE>metaTable.getEntry("Size").setDoubleArray(new double<MASK><NEW_LINE>}<NEW_LINE>// Tile position<NEW_LINE>if (m_column < 0 || m_row < 0) {<NEW_LINE>metaTable.getEntry("Position").delete();<NEW_LINE>} else {<NEW_LINE>metaTable.getEntry("Position").setDoubleArray(new double[] { m_column, m_row });<NEW_LINE>}<NEW_LINE>// Custom properties<NEW_LINE>if (getProperties() != null) {<NEW_LINE>NetworkTable propTable = metaTable.getSubTable("Properties");<NEW_LINE>getProperties().forEach((name, value) -> propTable.getEntry(name).setValue(value));<NEW_LINE>}<NEW_LINE>m_metadataDirty = false;<NEW_LINE>} | [] { m_width, m_height }); |
954,143 | public static int[] hsvToRgb(double hue, double saturation, double value) {<NEW_LINE>if (hue < 0 || hue > 360) {<NEW_LINE>throw new IllegalArgumentException("hue should be between 0 and 360");<NEW_LINE>}<NEW_LINE>if (saturation < 0 || saturation > 1) {<NEW_LINE>throw new IllegalArgumentException("saturation should be between 0 and 1");<NEW_LINE>}<NEW_LINE>if (value < 0 || value > 1) {<NEW_LINE>throw new IllegalArgumentException("value should be between 0 and 1");<NEW_LINE>}<NEW_LINE>double chroma = value * saturation;<NEW_LINE>double hueSection = hue / 60;<NEW_LINE>double secondLargestComponent = chroma * (1 - Math.abs<MASK><NEW_LINE>double matchValue = value - chroma;<NEW_LINE>return getRgbBySection(hueSection, chroma, matchValue, secondLargestComponent);<NEW_LINE>} | (hueSection % 2 - 1)); |
176,144 | public static GameView prepareGameView(Game game, UUID playerId, UUID userId) {<NEW_LINE>Player player = game.getPlayer(playerId);<NEW_LINE>GameView gameView = new GameView(game.getState(), game, playerId, null);<NEW_LINE>gameView.setHand(new CardsView(game, player.getHand().getCards(game)));<NEW_LINE>if (gameView.getPriorityPlayerName().equals(player.getName())) {<NEW_LINE>gameView.setCanPlayObjects(player.getPlayableObjects(game, Zone.ALL));<NEW_LINE>}<NEW_LINE><MASK><NEW_LINE>processWatchedHands(game, userId, gameView);<NEW_LINE>// TODO: should player who controls another player's turn be able to look at all these cards?<NEW_LINE>List<LookedAtView> list = new ArrayList<>();<NEW_LINE>for (Entry<String, Cards> entry : game.getState().getLookedAt(playerId).entrySet()) {<NEW_LINE>list.add(new LookedAtView(entry.getKey(), entry.getValue(), game));<NEW_LINE>}<NEW_LINE>gameView.setLookedAt(list);<NEW_LINE>return gameView;<NEW_LINE>} | processControlledPlayers(game, player, gameView); |
151,974 | protected void drawGuiContainerForegroundLayer(PoseStack transform, int mouseX, int mouseY, float partialTick) {<NEW_LINE>this.font.draw(transform, new TranslatableComponent(Lib.GUI_CONFIG + "redstone_color_sending").getString(), guiLeft, guiTop, DyeColor.WHITE.getTextColor());<NEW_LINE>this.font.draw(transform, new TranslatableComponent(Lib.GUI_CONFIG + "redstone_color_receiving").getString(), guiLeft + 116, guiTop, DyeColor.WHITE.getTextColor());<NEW_LINE>ArrayList<Component> tooltip = new ArrayList<>();<NEW_LINE>for (int i = 0; i < colorButtonsSend.length; i++) if (colorButtonsSend[i].isHovered() || colorButtonsReceive[i].isHovered()) {<NEW_LINE>tooltip.add(new TranslatableComponent(Lib.GUI_CONFIG + "redstone_color"));<NEW_LINE>tooltip.add(TextUtils.applyFormat(new TranslatableComponent("color.minecraft." + DyeColor.byId(i).getName()), ChatFormatting.GRAY));<NEW_LINE>}<NEW_LINE>if (!tooltip.isEmpty())<NEW_LINE>GuiUtils.drawHoveringText(transform, tooltip, mouseX, mouseY, width<MASK><NEW_LINE>} | , height, -1, font); |
1,618,310 | public void beforeRequest(Request<?> request) {<NEW_LINE>AmazonWebServiceRequest original = request.getOriginalRequest();<NEW_LINE>if (original instanceof DescribeSpotFleetRequestHistoryRequest) {<NEW_LINE>Map<String, List<String>> params = request.getParameters();<NEW_LINE>List<String> startTime = params.get(START_TIME);<NEW_LINE>if (startTime != null && !startTime.isEmpty()) {<NEW_LINE>params.put(START_TIME, Arrays.asList(sanitize(startTime.get(0))));<NEW_LINE>}<NEW_LINE>} else if (original instanceof RequestSpotFleetRequest) {<NEW_LINE>Map<String, List<String>> params = request.getParameters();<NEW_LINE>List<String> validFrom = params.get(VALID_FROM);<NEW_LINE>List<String> <MASK><NEW_LINE>if (validFrom != null && !validFrom.isEmpty()) {<NEW_LINE>params.put(VALID_FROM, Arrays.asList(sanitize(validFrom.get(0))));<NEW_LINE>}<NEW_LINE>if (validUntil != null && !validUntil.isEmpty()) {<NEW_LINE>params.put(VALID_UNTIL, Arrays.asList(sanitize(validUntil.get(0))));<NEW_LINE>}<NEW_LINE>}<NEW_LINE>} | validUntil = params.get(VALID_UNTIL); |
393,562 | private Recording startRecordingAudioOnly(Session session, Recording recording, RecordingProperties properties) throws OpenViduException {<NEW_LINE>log.info("Starting composed (audio-only) recording {} of session {}", recording.getId(<MASK><NEW_LINE>CompositeWrapper compositeWrapper = new CompositeWrapper((KurentoSession) session, "file://" + this.openviduConfig.getOpenViduRecordingPath() + recording.getId() + "/" + properties.name() + ".webm");<NEW_LINE>this.composites.put(session.getSessionId(), compositeWrapper);<NEW_LINE>for (Participant p : session.getParticipants()) {<NEW_LINE>if (p.isStreaming()) {<NEW_LINE>try {<NEW_LINE>this.joinPublisherEndpointToComposite(session, recording.getId(), p);<NEW_LINE>} catch (OpenViduException e) {<NEW_LINE>log.error("Error waiting for RecorderEndpooint of Composite to start in session {}", session.getSessionId());<NEW_LINE>throw this.failStartRecording(session, recording, e.getMessage());<NEW_LINE>}<NEW_LINE>}<NEW_LINE>}<NEW_LINE>this.generateRecordingMetadataFile(recording);<NEW_LINE>return recording;<NEW_LINE>} | ), recording.getSessionId()); |
1,328,523 | private IProject createNewProject() {<NEW_LINE>if (newProject != null) {<NEW_LINE>return newProject;<NEW_LINE>}<NEW_LINE>// get a project handle<NEW_LINE>final IProject newProjectHandle = mainPage.getProjectHandle();<NEW_LINE>// get a project descriptor<NEW_LINE>URI location = null;<NEW_LINE>if (!mainPage.useDefaults()) {<NEW_LINE>location = mainPage.getLocationURI();<NEW_LINE>}<NEW_LINE>IProjectDescription description = ResourceUtil.getProjectDescription(mainPage.getLocationPath(), sample.getNatures(), ArrayUtil.NO_STRINGS);<NEW_LINE>description.setName(newProjectHandle.getName());<NEW_LINE>description.setLocationURI(location);<NEW_LINE>try {<NEW_LINE>if (sample.isRemote()) {<NEW_LINE>cloneFromGit(sample.getLocation(), newProjectHandle, description);<NEW_LINE>} else {<NEW_LINE>ProjectData projectData = mainPage.getProjectData();<NEW_LINE>// Initialize the basic project data<NEW_LINE>projectData.project = newProjectHandle;<NEW_LINE>projectData.directory = mainPage.getLocationURI().getRawPath();<NEW_LINE>// TODO: not used here. //$NON-NLS-1$<NEW_LINE>projectData.appURL = "http://";<NEW_LINE>doBasicCreateProject(<MASK><NEW_LINE>doPostProjectCreation(newProjectHandle);<NEW_LINE>}<NEW_LINE>} catch (CoreException e) {<NEW_LINE>IdeLog.logError(SamplesUIPlugin.getDefault(), e);<NEW_LINE>return null;<NEW_LINE>}<NEW_LINE>newProject = newProjectHandle;<NEW_LINE>return newProject;<NEW_LINE>} | newProjectHandle, description, sample, projectData); |
4,971 | 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 <MASK><NEW_LINE>Vec3d[] hitVecs = new Vec3d[sides.length];<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>} | distanceSqPosVec = eyesPos.squaredDistanceTo(posVec); |
1,007,156 | public RecordDataSchema schema() {<NEW_LINE>synchronized (this) {<NEW_LINE>// Don't use double-checked locking because _schema isn't volatile<NEW_LINE>if (_schema == null) {<NEW_LINE>final StringBuilder errorMessageBuilder = new StringBuilder(10);<NEW_LINE>final Name elementSchemaName = new Name(_valueClass.getSimpleName(), errorMessageBuilder);<NEW_LINE>final MapDataSchema resultsSchema = new MapDataSchema(new RecordDataSchema(elementSchemaName, RecordDataSchema.RecordType.RECORD));<NEW_LINE>final RecordDataSchema.Field resultsField = new RecordDataSchema.Field(resultsSchema);<NEW_LINE>resultsField.setName(RESULTS, errorMessageBuilder);<NEW_LINE>final MapDataSchema errorsSchema = new MapDataSchema(DataTemplateUtil.getSchema(ErrorResponse.class));<NEW_LINE>final RecordDataSchema.Field errorsField = new RecordDataSchema.Field(errorsSchema);<NEW_LINE><MASK><NEW_LINE>final Name name = new Name(BATCH_KV_RESPONSE_CLASSNAME, errorMessageBuilder);<NEW_LINE>_schema = new RecordDataSchema(name, RecordDataSchema.RecordType.RECORD);<NEW_LINE>_schema.setFields(Arrays.asList(resultsField, errorsField), errorMessageBuilder);<NEW_LINE>}<NEW_LINE>}<NEW_LINE>return _schema;<NEW_LINE>} | errorsField.setName(ERRORS, errorMessageBuilder); |
1,715,316 | public static DescribeDnsGtmAccessStrategyResponse unmarshall(DescribeDnsGtmAccessStrategyResponse describeDnsGtmAccessStrategyResponse, UnmarshallerContext _ctx) {<NEW_LINE>describeDnsGtmAccessStrategyResponse.setRequestId(_ctx.stringValue("DescribeDnsGtmAccessStrategyResponse.RequestId"));<NEW_LINE>describeDnsGtmAccessStrategyResponse.setStrategyId(_ctx.stringValue("DescribeDnsGtmAccessStrategyResponse.StrategyId"));<NEW_LINE>describeDnsGtmAccessStrategyResponse.setStrategyName(_ctx.stringValue("DescribeDnsGtmAccessStrategyResponse.StrategyName"));<NEW_LINE>describeDnsGtmAccessStrategyResponse.setStrategyMode(_ctx.stringValue("DescribeDnsGtmAccessStrategyResponse.StrategyMode"));<NEW_LINE>describeDnsGtmAccessStrategyResponse.setInstanceId(_ctx.stringValue("DescribeDnsGtmAccessStrategyResponse.InstanceId"));<NEW_LINE>describeDnsGtmAccessStrategyResponse.setDefaultAddrPoolType(_ctx.stringValue("DescribeDnsGtmAccessStrategyResponse.DefaultAddrPoolType"));<NEW_LINE>describeDnsGtmAccessStrategyResponse.setDefaultLbaStrategy(_ctx.stringValue("DescribeDnsGtmAccessStrategyResponse.DefaultLbaStrategy"));<NEW_LINE>describeDnsGtmAccessStrategyResponse.setDefaultMinAvailableAddrNum<MASK><NEW_LINE>describeDnsGtmAccessStrategyResponse.setDefaultMaxReturnAddrNum(_ctx.integerValue("DescribeDnsGtmAccessStrategyResponse.DefaultMaxReturnAddrNum"));<NEW_LINE>describeDnsGtmAccessStrategyResponse.setDefaultLatencyOptimization(_ctx.stringValue("DescribeDnsGtmAccessStrategyResponse.DefaultLatencyOptimization"));<NEW_LINE>describeDnsGtmAccessStrategyResponse.setDefaultAddrPoolGroupStatus(_ctx.stringValue("DescribeDnsGtmAccessStrategyResponse.DefaultAddrPoolGroupStatus"));<NEW_LINE>describeDnsGtmAccessStrategyResponse.setFailoverAddrPoolType(_ctx.stringValue("DescribeDnsGtmAccessStrategyResponse.FailoverAddrPoolType"));<NEW_LINE>describeDnsGtmAccessStrategyResponse.setFailoverLbaStrategy(_ctx.stringValue("DescribeDnsGtmAccessStrategyResponse.FailoverLbaStrategy"));<NEW_LINE>describeDnsGtmAccessStrategyResponse.setFailoverMinAvailableAddrNum(_ctx.integerValue("DescribeDnsGtmAccessStrategyResponse.FailoverMinAvailableAddrNum"));<NEW_LINE>describeDnsGtmAccessStrategyResponse.setFailoverMaxReturnAddrNum(_ctx.integerValue("DescribeDnsGtmAccessStrategyResponse.FailoverMaxReturnAddrNum"));<NEW_LINE>describeDnsGtmAccessStrategyResponse.setFailoverLatencyOptimization(_ctx.stringValue("DescribeDnsGtmAccessStrategyResponse.FailoverLatencyOptimization"));<NEW_LINE>describeDnsGtmAccessStrategyResponse.setFailoverAddrPoolGroupStatus(_ctx.stringValue("DescribeDnsGtmAccessStrategyResponse.FailoverAddrPoolGroupStatus"));<NEW_LINE>describeDnsGtmAccessStrategyResponse.setAccessMode(_ctx.stringValue("DescribeDnsGtmAccessStrategyResponse.AccessMode"));<NEW_LINE>describeDnsGtmAccessStrategyResponse.setEffectiveAddrPoolGroupType(_ctx.stringValue("DescribeDnsGtmAccessStrategyResponse.EffectiveAddrPoolGroupType"));<NEW_LINE>describeDnsGtmAccessStrategyResponse.setCreateTime(_ctx.stringValue("DescribeDnsGtmAccessStrategyResponse.CreateTime"));<NEW_LINE>describeDnsGtmAccessStrategyResponse.setCreateTimestamp(_ctx.longValue("DescribeDnsGtmAccessStrategyResponse.CreateTimestamp"));<NEW_LINE>describeDnsGtmAccessStrategyResponse.setDefaultAvailableAddrNum(_ctx.integerValue("DescribeDnsGtmAccessStrategyResponse.DefaultAvailableAddrNum"));<NEW_LINE>describeDnsGtmAccessStrategyResponse.setFailoverAvailableAddrNum(_ctx.integerValue("DescribeDnsGtmAccessStrategyResponse.FailoverAvailableAddrNum"));<NEW_LINE>List<Line> lines = new ArrayList<Line>();<NEW_LINE>for (int i = 0; i < _ctx.lengthValue("DescribeDnsGtmAccessStrategyResponse.Lines.Length"); i++) {<NEW_LINE>Line line = new Line();<NEW_LINE>line.setLineCode(_ctx.stringValue("DescribeDnsGtmAccessStrategyResponse.Lines[" + i + "].LineCode"));<NEW_LINE>line.setLineName(_ctx.stringValue("DescribeDnsGtmAccessStrategyResponse.Lines[" + i + "].LineName"));<NEW_LINE>line.setGroupCode(_ctx.stringValue("DescribeDnsGtmAccessStrategyResponse.Lines[" + i + "].GroupCode"));<NEW_LINE>line.setGroupName(_ctx.stringValue("DescribeDnsGtmAccessStrategyResponse.Lines[" + i + "].GroupName"));<NEW_LINE>lines.add(line);<NEW_LINE>}<NEW_LINE>describeDnsGtmAccessStrategyResponse.setLines(lines);<NEW_LINE>List<DefaultAddrPool> defaultAddrPools = new ArrayList<DefaultAddrPool>();<NEW_LINE>for (int i = 0; i < _ctx.lengthValue("DescribeDnsGtmAccessStrategyResponse.DefaultAddrPools.Length"); i++) {<NEW_LINE>DefaultAddrPool defaultAddrPool = new DefaultAddrPool();<NEW_LINE>defaultAddrPool.setId(_ctx.stringValue("DescribeDnsGtmAccessStrategyResponse.DefaultAddrPools[" + i + "].Id"));<NEW_LINE>defaultAddrPool.setName(_ctx.stringValue("DescribeDnsGtmAccessStrategyResponse.DefaultAddrPools[" + i + "].Name"));<NEW_LINE>defaultAddrPool.setAddrCount(_ctx.integerValue("DescribeDnsGtmAccessStrategyResponse.DefaultAddrPools[" + i + "].AddrCount"));<NEW_LINE>defaultAddrPool.setLbaWeight(_ctx.integerValue("DescribeDnsGtmAccessStrategyResponse.DefaultAddrPools[" + i + "].LbaWeight"));<NEW_LINE>defaultAddrPools.add(defaultAddrPool);<NEW_LINE>}<NEW_LINE>describeDnsGtmAccessStrategyResponse.setDefaultAddrPools(defaultAddrPools);<NEW_LINE>List<FailoverAddrPool> failoverAddrPools = new ArrayList<FailoverAddrPool>();<NEW_LINE>for (int i = 0; i < _ctx.lengthValue("DescribeDnsGtmAccessStrategyResponse.FailoverAddrPools.Length"); i++) {<NEW_LINE>FailoverAddrPool failoverAddrPool = new FailoverAddrPool();<NEW_LINE>failoverAddrPool.setId(_ctx.stringValue("DescribeDnsGtmAccessStrategyResponse.FailoverAddrPools[" + i + "].Id"));<NEW_LINE>failoverAddrPool.setName(_ctx.stringValue("DescribeDnsGtmAccessStrategyResponse.FailoverAddrPools[" + i + "].Name"));<NEW_LINE>failoverAddrPool.setAddrCount(_ctx.integerValue("DescribeDnsGtmAccessStrategyResponse.FailoverAddrPools[" + i + "].AddrCount"));<NEW_LINE>failoverAddrPool.setLbaWeight(_ctx.integerValue("DescribeDnsGtmAccessStrategyResponse.FailoverAddrPools[" + i + "].LbaWeight"));<NEW_LINE>failoverAddrPools.add(failoverAddrPool);<NEW_LINE>}<NEW_LINE>describeDnsGtmAccessStrategyResponse.setFailoverAddrPools(failoverAddrPools);<NEW_LINE>return describeDnsGtmAccessStrategyResponse;<NEW_LINE>} | (_ctx.integerValue("DescribeDnsGtmAccessStrategyResponse.DefaultMinAvailableAddrNum")); |
1,331,738 | private static String renderDocumentType(DocumentType docType) {<NEW_LINE>String publicId = docType.getPublicId();<NEW_LINE>String systemId = docType.getSystemId();<NEW_LINE>String nodeName;<NEW_LINE>if (null != docType.getOwnerDocument() && null != docType.getOwnerDocument().getDocumentElement() && null != docType.getOwnerDocument().getDocumentElement().getNodeName()) {<NEW_LINE>nodeName = docType.getOwnerDocument().getDocumentElement().getNodeName();<NEW_LINE>} else {<NEW_LINE>return null;<NEW_LINE>}<NEW_LINE>if (!DoctypeMaker.isHtml(nodeName, publicId, systemId)) {<NEW_LINE>return null;<NEW_LINE>}<NEW_LINE>StringBuilder sb = new StringBuilder();<NEW_LINE>sb.append("<!DOCTYPE ").append(nodeName);<NEW_LINE>// The Name in the document type declaration must match the element type<NEW_LINE>// of the root element.<NEW_LINE>if (null != publicId && publicId.length() > 0) {<NEW_LINE>sb.append(" PUBLIC ").append('"').append(publicId.replaceAll("\"", <MASK><NEW_LINE>}<NEW_LINE>if (null != systemId && systemId.length() > 0) {<NEW_LINE>// Sanity check - system urls should parse as an absolute uris<NEW_LINE>try {<NEW_LINE>URI u = new URI(systemId);<NEW_LINE>if (u.isAbsolute() && ("http".equals(u.getScheme()) || "https".equals(u.getScheme()))) {<NEW_LINE>sb.append(" ").append('"').append(systemId.replaceAll("\"", "%22")).append('"');<NEW_LINE>}<NEW_LINE>} catch (URISyntaxException e) {<NEW_LINE>return null;<NEW_LINE>}<NEW_LINE>}<NEW_LINE>sb.append(">");<NEW_LINE>return sb.toString();<NEW_LINE>} | "%22")).append('"'); |
1,232,723 | public void persist(final BlockHeader blockHeader) {<NEW_LINE>final WorldStateStorage.Updater stateUpdater = worldStateStorage.updater();<NEW_LINE>// Store updated code<NEW_LINE>for (final Bytes code : updatedAccountCode.values()) {<NEW_LINE>stateUpdater.putCode(null, code);<NEW_LINE>}<NEW_LINE>// Commit account storage tries<NEW_LINE>for (final MerklePatriciaTrie<Bytes32, Bytes> updatedStorage : updatedStorageTries.values()) {<NEW_LINE>updatedStorage.commit((location, hash, value) -> stateUpdater.putAccountStorageTrieNode(null, location, hash, value));<NEW_LINE>}<NEW_LINE>// Commit account updates<NEW_LINE><MASK><NEW_LINE>// Persist preimages<NEW_LINE>final WorldStatePreimageStorage.Updater preimageUpdater = preimageStorage.updater();<NEW_LINE>newStorageKeyPreimages.forEach(preimageUpdater::putStorageTrieKeyPreimage);<NEW_LINE>newAccountKeyPreimages.forEach(preimageUpdater::putAccountTrieKeyPreimage);<NEW_LINE>// Clear pending changes that we just flushed<NEW_LINE>updatedStorageTries.clear();<NEW_LINE>updatedAccountCode.clear();<NEW_LINE>newStorageKeyPreimages.clear();<NEW_LINE>// Push changes to underlying storage<NEW_LINE>preimageUpdater.commit();<NEW_LINE>stateUpdater.commit();<NEW_LINE>} | accountStateTrie.commit(stateUpdater::putAccountStateTrieNode); |
1,559,680 | private void bindValues(SQLiteStatement stmt, JobHolder jobHolder) {<NEW_LINE>if (jobHolder.getInsertionOrder() != null) {<NEW_LINE>stmt.bindLong(DbOpenHelper.INSERTION_ORDER_COLUMN.columnIndex + 1, jobHolder.getInsertionOrder());<NEW_LINE>}<NEW_LINE>stmt.bindString(DbOpenHelper.ID_COLUMN.columnIndex + 1, jobHolder.getId());<NEW_LINE>stmt.bindLong(DbOpenHelper.PRIORITY_COLUMN.columnIndex + 1, jobHolder.getPriority());<NEW_LINE>if (jobHolder.getGroupId() != null) {<NEW_LINE>stmt.bindString(DbOpenHelper.GROUP_ID_COLUMN.columnIndex + 1, jobHolder.getGroupId());<NEW_LINE>}<NEW_LINE>stmt.bindLong(DbOpenHelper.RUN_COUNT_COLUMN.columnIndex + 1, jobHolder.getRunCount());<NEW_LINE>stmt.bindLong(DbOpenHelper.CREATED_NS_COLUMN.columnIndex + 1, jobHolder.getCreatedNs());<NEW_LINE>stmt.bindLong(DbOpenHelper.DELAY_UNTIL_NS_COLUMN.columnIndex + 1, jobHolder.getDelayUntilNs());<NEW_LINE>stmt.bindLong(DbOpenHelper.RUNNING_SESSION_ID_COLUMN.columnIndex + 1, jobHolder.getRunningSessionId());<NEW_LINE>stmt.bindLong(DbOpenHelper.REQUIRED_NETWORK_TYPE_COLUMN.columnIndex + 1, jobHolder.getRequiredNetworkType());<NEW_LINE>stmt.bindLong(DbOpenHelper.DEADLINE_COLUMN.columnIndex + 1, jobHolder.getDeadlineNs());<NEW_LINE>stmt.bindLong(DbOpenHelper.CANCEL_ON_DEADLINE_COLUMN.columnIndex + 1, jobHolder.shouldCancelOnDeadline() ? 1 : 0);<NEW_LINE>stmt.bindLong(DbOpenHelper.CANCELLED_COLUMN.columnIndex + 1, jobHolder.<MASK><NEW_LINE>} | isCancelled() ? 1 : 0); |
1,700,082 | private static void checkProxyProperty(String propertyName, final URL url, final URLConnection[] conn, URI[] connectedVia, final CountDownLatch connected, final List<Exception> errs, StringBuffer msgs) {<NEW_LINE>String httpProxy = System.getenv(propertyName);<NEW_LINE>msgs.append("\n[" + propertyName + "] set to " + httpProxy);<NEW_LINE>if (httpProxy != null) {<NEW_LINE>try {<NEW_LINE>URI uri = new URI(httpProxy);<NEW_LINE>InetSocketAddress address = InetSocketAddress.createUnresolved(uri.getHost(), uri.getPort());<NEW_LINE>Proxy proxy = new Proxy(Proxy.Type.HTTP, address);<NEW_LINE>URLConnection <MASK><NEW_LINE>test.connect();<NEW_LINE>msgs.append("\n[" + propertyName + "] connected");<NEW_LINE>conn[0] = test;<NEW_LINE>if (connectedVia != null) {<NEW_LINE>connectedVia[0] = uri;<NEW_LINE>}<NEW_LINE>connected.countDown();<NEW_LINE>msgs.append("\n[" + propertyName + "] countDown");<NEW_LINE>} catch (IOException | URISyntaxException ex) {<NEW_LINE>errs.add(ex);<NEW_LINE>msgs.append("\n[" + propertyName + "] exception " + ex.getMessage());<NEW_LINE>}<NEW_LINE>}<NEW_LINE>} | test = url.openConnection(proxy); |
657,921 | public boolean connectPhysicalDisksViaVmSpec(VirtualMachineTO vmSpec) {<NEW_LINE>boolean result = false;<NEW_LINE>final <MASK><NEW_LINE>List<DiskTO> disks = Arrays.asList(vmSpec.getDisks());<NEW_LINE>for (DiskTO disk : disks) {<NEW_LINE>if (disk.getType() == Volume.Type.ISO) {<NEW_LINE>result = true;<NEW_LINE>continue;<NEW_LINE>}<NEW_LINE>VolumeObjectTO vol = (VolumeObjectTO) disk.getData();<NEW_LINE>PrimaryDataStoreTO store = (PrimaryDataStoreTO) vol.getDataStore();<NEW_LINE>if (!store.isManaged() && VirtualMachine.State.Migrating.equals(vmSpec.getState())) {<NEW_LINE>result = true;<NEW_LINE>continue;<NEW_LINE>}<NEW_LINE>KVMStoragePool pool = getStoragePool(store.getPoolType(), store.getUuid());<NEW_LINE>StorageAdaptor adaptor = getStorageAdaptor(pool.getType());<NEW_LINE>result = adaptor.connectPhysicalDisk(vol.getPath(), pool, disk.getDetails());<NEW_LINE>if (!result) {<NEW_LINE>s_logger.error("Failed to connect disks via vm spec for vm: " + vmName + " volume:" + vol.toString());<NEW_LINE>return result;<NEW_LINE>}<NEW_LINE>}<NEW_LINE>return result;<NEW_LINE>} | String vmName = vmSpec.getName(); |
234,854 | public MetaData.Builder addVirtualIndexMappings(final MetaData metaData) {<NEW_LINE>MetaData.Builder metaDataBuilder = new MetaData.Builder(metaData);<NEW_LINE>for (ObjectCursor<IndexMetaData> cursor : metaData.indices().values()) {<NEW_LINE>IndexMetaData virtualIndex = metaDataBuilder.get(cursor.value.virtualIndex());<NEW_LINE>if (virtualIndex != null && !cursor.value.isVirtual()) {<NEW_LINE>if (!virtualIndex.getMappings().isEmpty()) {<NEW_LINE>IndexMetaData.Builder indexMetaDataBuilder = IndexMetaData.builder(cursor.value);<NEW_LINE>for (ObjectCursor<MappingMetaData> mappingCursor : virtualIndex.getMappings().values()) {<NEW_LINE>logger.debug("add mapping=[{}] from virtual index=[{}] to index=[{}]", mappingCursor.value.type(), virtualIndex.getIndex(), cursor.value.getIndex());<NEW_LINE>indexMetaDataBuilder.putMapping(mappingCursor.value);<NEW_LINE>}<NEW_LINE>metaDataBuilder.put(indexMetaDataBuilder, false);<NEW_LINE>} else {<NEW_LINE>logger.warn("virtual index=[{}] has no mapping in metadata.version={}", virtualIndex.getIndex(), metaData.x2());<NEW_LINE>}<NEW_LINE>} else {<NEW_LINE>logger.trace("index=[{}] mapping={}", cursor.value.getIndex(), <MASK><NEW_LINE>}<NEW_LINE>}<NEW_LINE>return metaDataBuilder;<NEW_LINE>} | cursor.value.getMappings()); |
1,203,819 | private Mono<Response<Flux<ByteBuffer>>> exportRequestRateByIntervalWithResponseAsync(String location, RequestRateByIntervalInput parameters, Context context) {<NEW_LINE>if (this.client.getEndpoint() == null) {<NEW_LINE>return Mono.error(new IllegalArgumentException("Parameter this.client.getEndpoint() is required and cannot be null."));<NEW_LINE>}<NEW_LINE>if (location == null) {<NEW_LINE>return Mono.error(new IllegalArgumentException("Parameter location 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 (parameters == null) {<NEW_LINE>return Mono.error(new IllegalArgumentException("Parameter parameters is required and cannot be null."));<NEW_LINE>} else {<NEW_LINE>parameters.validate();<NEW_LINE>}<NEW_LINE>final String apiVersion = "2020-06-01";<NEW_LINE>final String accept = "application/json";<NEW_LINE>context = <MASK><NEW_LINE>return service.exportRequestRateByInterval(this.client.getEndpoint(), location, apiVersion, this.client.getSubscriptionId(), parameters, accept, context);<NEW_LINE>} | this.client.mergeContext(context); |
1,542,040 | public void generateMovementFromEmptiesInout(@NonNull final I_M_InOut emptiesInOut) {<NEW_LINE>//<NEW_LINE>// Fetch shipment/receipt lines and convert them to packing material line candidates.<NEW_LINE>final List<HUPackingMaterialDocumentLineCandidate> lines = Services.get(IInOutDAO.class).retrieveLines(emptiesInOut, I_M_InOutLine.class).stream().map(line -> HUPackingMaterialDocumentLineCandidate.of(loadOutOfTrx(line.getM_Locator_ID(), I_M_Locator.class), loadOutOfTrx(line.getM_Product_ID(), I_M_Product.class), line.getMovementQty().intValueExact())).<MASK><NEW_LINE>//<NEW_LINE>// Generate the empties movement<NEW_LINE>newEmptiesMovementProducer().setEmptiesMovementDirection(emptiesInOut.isSOTrx() ? EmptiesMovementDirection.ToEmptiesWarehouse : EmptiesMovementDirection.FromEmptiesWarehouse).setReferencedInOutId(emptiesInOut.getM_InOut_ID()).addCandidates(lines).createMovements();<NEW_LINE>} | collect(GuavaCollectors.toImmutableList()); |
552,687 | public Status scan(String table, String startkey, int recordcount, Set<String> fields, Vector<HashMap<String, ByteIterator>> result) {<NEW_LINE>try {<NEW_LINE>KuduScanner.KuduScannerBuilder scannerBuilder = client.newScannerBuilder(kuduTable);<NEW_LINE>List<String> querySchema;<NEW_LINE>if (fields == null) {<NEW_LINE>querySchema = COLUMN_NAMES;<NEW_LINE>// No need to set the projected columns with the whole schema.<NEW_LINE>} else {<NEW_LINE>querySchema = new ArrayList<>(fields);<NEW_LINE>scannerBuilder.setProjectedColumnNames(querySchema);<NEW_LINE>}<NEW_LINE>ColumnSchema column = schema.getColumnByIndex(0);<NEW_LINE>KuduPredicate.ComparisonOp predicateOp = recordcount == 1 ? EQUAL : GREATER_EQUAL;<NEW_LINE>KuduPredicate predicate = KuduPredicate.newComparisonPredicate(column, predicateOp, startkey);<NEW_LINE>scannerBuilder.addPredicate(predicate);<NEW_LINE>// currently noop<NEW_LINE>scannerBuilder.limit(recordcount);<NEW_LINE>KuduScanner scanner = scannerBuilder.build();<NEW_LINE>while (scanner.hasMoreRows()) {<NEW_LINE>RowResultIterator data = scanner.nextRows();<NEW_LINE>addAllRowsToResult(data, recordcount, querySchema, result);<NEW_LINE>if (recordcount == result.size()) {<NEW_LINE>break;<NEW_LINE>}<NEW_LINE>}<NEW_LINE><MASK><NEW_LINE>addAllRowsToResult(closer, recordcount, querySchema, result);<NEW_LINE>} catch (TimeoutException te) {<NEW_LINE>LOG.info("Waited too long for a scan operation with start key={}", startkey);<NEW_LINE>return TIMEOUT;<NEW_LINE>} catch (Exception e) {<NEW_LINE>LOG.warn("Unexpected exception", e);<NEW_LINE>return Status.ERROR;<NEW_LINE>}<NEW_LINE>return Status.OK;<NEW_LINE>} | RowResultIterator closer = scanner.close(); |
1,381,453 | public void update() {<NEW_LINE>if (externalMetricsSupplier != null) {<NEW_LINE>Set<CompactionExecutorId> <MASK><NEW_LINE>synchronized (exCeMetricsMap) {<NEW_LINE>externalMetricsSupplier.get().forEach(ecm -> {<NEW_LINE>seenIds.add(ecm.ceid);<NEW_LINE>ExMetrics exm = exCeMetricsMap.computeIfAbsent(ecm.ceid, id -> {<NEW_LINE>ExMetrics m = new ExMetrics();<NEW_LINE>if (registry != null) {<NEW_LINE>m.queued = registry.gauge(METRICS_MAJC_QUEUED, Tags.of("id", ecm.ceid.canonical()), new AtomicInteger(0));<NEW_LINE>m.running = registry.gauge(METRICS_MAJC_RUNNING, Tags.of("id", ecm.ceid.canonical()), new AtomicInteger(0));<NEW_LINE>}<NEW_LINE>return m;<NEW_LINE>});<NEW_LINE>exm.queued.set(ecm.queued);<NEW_LINE>exm.running.set(ecm.running);<NEW_LINE>});<NEW_LINE>Sets.difference(exCeMetricsMap.keySet(), seenIds).forEach(unusedId -> {<NEW_LINE>ExMetrics exm = exCeMetricsMap.get(unusedId);<NEW_LINE>exm.queued.set(0);<NEW_LINE>exm.running.set(0);<NEW_LINE>});<NEW_LINE>}<NEW_LINE>}<NEW_LINE>ceMetricsList.forEach(cem -> {<NEW_LINE>cem.running.set(cem.runningSupplier.getAsInt());<NEW_LINE>cem.queued.set(cem.queuedSupplier.getAsInt());<NEW_LINE>});<NEW_LINE>} | seenIds = new HashSet<>(); |
33,758 | public static boolean isIPAuthenticated(SipServletMessage message) {<NEW_LINE>if (s_instance.m_hasCheck) {<NEW_LINE>SipServletMessageImpl msg = (SipServletMessageImpl) message;<NEW_LINE>HeaderIterator viaHeaders = msg.getMessage().getViaHeaders();<NEW_LINE>if (viaHeaders != null) {<NEW_LINE>for (int i = 0; i < 2; i++) {<NEW_LINE>if (viaHeaders.hasNext()) {<NEW_LINE>try {<NEW_LINE>ViaHeader via = (ViaHeader) viaHeaders.next();<NEW_LINE>String host = (String) via.getHost();<NEW_LINE>boolean checkVia = checkIp(host);<NEW_LINE>if (checkVia) {<NEW_LINE>return true;<NEW_LINE>}<NEW_LINE>} catch (HeaderParseException e) {<NEW_LINE>if (c_logger.isErrorEnabled()) {<NEW_LINE>c_logger.error("error.ip.header.parse", Situation.SITUATION_START, null, e);<NEW_LINE>}<NEW_LINE>} catch (NoSuchElementException e) {<NEW_LINE>if (c_logger.isErrorEnabled()) {<NEW_LINE>c_logger.error("error.ip.header.exception", <MASK><NEW_LINE>}<NEW_LINE>}<NEW_LINE>}<NEW_LINE>}<NEW_LINE>}<NEW_LINE>}<NEW_LINE>return false;<NEW_LINE>} | Situation.SITUATION_START, null, e); |
982,263 | public void run() {<NEW_LINE>if (!SoapUI.usingGraphicalEnvironment()) {<NEW_LINE>// Don't use animation if we're not in the SoapUI GUI.<NEW_LINE>return;<NEW_LINE>}<NEW_LINE>String oldThreadName = Thread.currentThread().getName();<NEW_LINE>if (future != null) {<NEW_LINE>if (System.getProperty("soapui.enablenamedthreads") != null) {<NEW_LINE>Thread.currentThread().setName("IconAnimator for " + target.getName());<NEW_LINE>}<NEW_LINE>}<NEW_LINE>try {<NEW_LINE>while (!stopped) {<NEW_LINE>try {<NEW_LINE>if (stopped) {<NEW_LINE>break;<NEW_LINE>}<NEW_LINE>index = index >= animateIcons.length - 1 ? 0 : index + 1;<NEW_LINE>SwingUtilities.invokeLater(new Runnable() {<NEW_LINE><NEW_LINE>public void run() {<NEW_LINE><MASK><NEW_LINE>}<NEW_LINE>});<NEW_LINE>Thread.sleep(500);<NEW_LINE>} catch (InterruptedException e) {<NEW_LINE>// SoapUI.log( "Mock Service Force Stopped!" );<NEW_LINE>stopped = true;<NEW_LINE>}<NEW_LINE>}<NEW_LINE>target.setIcon(getIcon());<NEW_LINE>future = null;<NEW_LINE>notify();<NEW_LINE>// iconAnimationThread = null;<NEW_LINE>} finally {<NEW_LINE>if (System.getProperty("soapui.enablenamedthreads") != null) {<NEW_LINE>Thread.currentThread().setName(oldThreadName);<NEW_LINE>}<NEW_LINE>}<NEW_LINE>} | target.setIcon(getIcon()); |
1,418,031 | public // array<double,2>^ dst, int arrayOffset, bool bForward)<NEW_LINE>void readRange(int streamOffset, int count, double[][] dst, int arrayOffset, boolean bForward) {<NEW_LINE>if (streamOffset < 0 || count < 0 || arrayOffset < 0 || count > NumberUtils.intMax() || size() < count + streamOffset)<NEW_LINE>throw new IllegalArgumentException();<NEW_LINE>if (dst.length * 2 < (int) ((arrayOffset << 1) + count))<NEW_LINE>throw new IllegalArgumentException();<NEW_LINE>if (count == 0)<NEW_LINE>return;<NEW_LINE>int j = streamOffset;<NEW_LINE>if (!bForward)<NEW_LINE>j += count - 1;<NEW_LINE>final int dj = bForward ? 2 : -2;<NEW_LINE>int end = arrayOffset + (count >> 1);<NEW_LINE>for (int i = arrayOffset; i < end; i++) {<NEW_LINE>dst[i]<MASK><NEW_LINE>dst[i][1] = m_buffer[j + 1];<NEW_LINE>j += dj;<NEW_LINE>}<NEW_LINE>} | [0] = m_buffer[j]; |
1,216,574 | final CreateFargateProfileResult executeCreateFargateProfile(CreateFargateProfileRequest createFargateProfileRequest) {<NEW_LINE>ExecutionContext executionContext = createExecutionContext(createFargateProfileRequest);<NEW_LINE>AWSRequestMetrics awsRequestMetrics = executionContext.getAwsRequestMetrics();<NEW_LINE>awsRequestMetrics.startEvent(Field.ClientExecuteTime);<NEW_LINE>Request<CreateFargateProfileRequest> request = null;<NEW_LINE>Response<CreateFargateProfileResult> response = null;<NEW_LINE>try {<NEW_LINE>awsRequestMetrics.startEvent(Field.RequestMarshallTime);<NEW_LINE>try {<NEW_LINE>request = new CreateFargateProfileRequestProtocolMarshaller(protocolFactory).marshall(super.beforeMarshalling(createFargateProfileRequest));<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, "EKS");<NEW_LINE>request.addHandlerContext(HandlerContextKey.OPERATION_NAME, "CreateFargateProfile");<NEW_LINE>request.addHandlerContext(HandlerContextKey.ADVANCED_CONFIG, advancedConfig);<NEW_LINE>} finally {<NEW_LINE><MASK><NEW_LINE>}<NEW_LINE>HttpResponseHandler<AmazonWebServiceResponse<CreateFargateProfileResult>> responseHandler = protocolFactory.createResponseHandler(new JsonOperationMetadata().withPayloadJson(true).withHasStreamingSuccessResponse(false), new CreateFargateProfileResultJsonUnmarshaller());<NEW_LINE>response = invoke(request, responseHandler, executionContext);<NEW_LINE>return response.getAwsResponse();<NEW_LINE>} finally {<NEW_LINE>endClientExecution(awsRequestMetrics, request, response);<NEW_LINE>}<NEW_LINE>} | awsRequestMetrics.endEvent(Field.RequestMarshallTime); |
143,833 | public List<Endpoint> findEndpoint(String keyword, String serviceId, int limit) throws IOException {<NEW_LINE>StringBuilder sql = new StringBuilder();<NEW_LINE>List<Object> condition = new ArrayList<>(5);<NEW_LINE>sql.append("select * from ").append(EndpointTraffic.INDEX_NAME).append(" where ");<NEW_LINE>sql.append(EndpointTraffic<MASK><NEW_LINE>condition.add(serviceId);<NEW_LINE>if (!Strings.isNullOrEmpty(keyword)) {<NEW_LINE>sql.append(" and ").append(EndpointTraffic.NAME).append(" like concat('%',?,'%') ");<NEW_LINE>condition.add(keyword);<NEW_LINE>}<NEW_LINE>sql.append(" limit ").append(limit);<NEW_LINE>List<Endpoint> endpoints = new ArrayList<>();<NEW_LINE>try (Connection connection = h2Client.getConnection()) {<NEW_LINE>try (ResultSet resultSet = h2Client.executeQuery(connection, sql.toString(), condition.toArray(new Object[0]))) {<NEW_LINE>while (resultSet.next()) {<NEW_LINE>Endpoint endpoint = new Endpoint();<NEW_LINE>endpoint.setId(resultSet.getString(H2TableInstaller.ID_COLUMN));<NEW_LINE>endpoint.setName(resultSet.getString(EndpointTraffic.NAME));<NEW_LINE>endpoints.add(endpoint);<NEW_LINE>}<NEW_LINE>}<NEW_LINE>} catch (SQLException e) {<NEW_LINE>throw new IOException(e);<NEW_LINE>}<NEW_LINE>return endpoints;<NEW_LINE>} | .SERVICE_ID).append("=?"); |
969,371 | private void customizeEditor(JEditorPane editor) {<NEW_LINE>EditorKit kit = editor.getEditorKit();<NEW_LINE>StyledDocument doc;<NEW_LINE>Document document = editor.getDocument();<NEW_LINE>try {<NEW_LINE>doc = (StyledDocument) editor.getDocument();<NEW_LINE>} catch (ClassCastException e) {<NEW_LINE>doc = new DefaultStyledDocument();<NEW_LINE>try {<NEW_LINE>doc.insertString(0, document.getText(0, document<MASK><NEW_LINE>} catch (BadLocationException ble) {<NEW_LINE>// leaving the document empty<NEW_LINE>}<NEW_LINE>editor.setDocument(doc);<NEW_LINE>}<NEW_LINE>// int lastOffset = doc.getEndPosition().getOffset();<NEW_LINE>// int numLines = org.openide.text.NbDocument.findLineNumber(doc, lastOffset);<NEW_LINE>// int numLength = Integer.toString(numLines).length();<NEW_LINE>// textLines.setForeground(numForegroundColor);<NEW_LINE>// textLines.setBackground(numBackgroundColor);<NEW_LINE>// joinScrollBars();<NEW_LINE>} | .getLength()), null); |
819,509 | private ArrayList<TorrentFile> parseJsonFileListing(JSONObject response, Torrent torrent) throws JSONException {<NEW_LINE>// Parse response<NEW_LINE>ArrayList<TorrentFile> files = new ArrayList<>();<NEW_LINE>JSONArray objects = response.getJSONArray(RPC_DETAILS);<NEW_LINE>JSONArray progress = response.getJSONArray(RPC_FILEPROGRESS);<NEW_LINE>JSONArray <MASK><NEW_LINE>if (objects != null) {<NEW_LINE>for (int j = 0; j < objects.length(); j++) {<NEW_LINE>JSONObject file = objects.getJSONObject(j);<NEW_LINE>// Add the parsed torrent to the list<NEW_LINE>// @formatter:off<NEW_LINE>files.add(new TorrentFile("" + file.getInt(RPC_INDEX), file.getString(RPC_PATH), file.getString(RPC_PATH), torrent.getLocationDir() + file.getString(RPC_PATH), file.getLong(RPC_SIZE), (long) (progress.getDouble(j) * file.getLong(RPC_SIZE)), DelugeCommon.convertDelugePriority(priorities.getInt(j), version)));<NEW_LINE>// @formatter:on<NEW_LINE>}<NEW_LINE>}<NEW_LINE>// Return the list<NEW_LINE>return files;<NEW_LINE>} | priorities = response.getJSONArray(RPC_FILEPRIORITIES); |
877,155 | private static DirEntry findOrCreateNextDirEntry(DirEntry lastEntry, String name, int prevIndex, int nameEnd, int nameHash) {<NEW_LINE>DirEntry nextEntry = null;<NEW_LINE>// volatile read<NEW_LINE>DirEntry[] directories = lastEntry.childrenDirectories;<NEW_LINE>if (directories != null) {<NEW_LINE>// noinspection ForLoopReplaceableByForEach<NEW_LINE>for (int index = 0, len = directories.length; index < len; ++index) {<NEW_LINE>DirEntry previouslyScannedDir = directories[index];<NEW_LINE>if (previouslyScannedDir.nameHash == nameHash && previouslyScannedDir.name.regionMatches(0, name, prevIndex, nameEnd - prevIndex)) {<NEW_LINE>nextEntry = previouslyScannedDir;<NEW_LINE>break;<NEW_LINE>}<NEW_LINE>}<NEW_LINE>}<NEW_LINE>if (nextEntry == null) {<NEW_LINE>nextEntry = new DirEntry(nameHash, name<MASK><NEW_LINE>DirEntry[] newChildrenDirectories;<NEW_LINE>if (directories != null) {<NEW_LINE>newChildrenDirectories = new DirEntry[directories.length + 1];<NEW_LINE>System.arraycopy(directories, 0, newChildrenDirectories, 0, directories.length);<NEW_LINE>newChildrenDirectories[directories.length] = nextEntry;<NEW_LINE>} else {<NEW_LINE>newChildrenDirectories = new DirEntry[] { nextEntry };<NEW_LINE>}<NEW_LINE>// volatile write with new copy of data<NEW_LINE>lastEntry.childrenDirectories = newChildrenDirectories;<NEW_LINE>}<NEW_LINE>lastEntry = nextEntry;<NEW_LINE>return lastEntry;<NEW_LINE>} | .substring(prevIndex, nameEnd)); |
1,712,632 | public void updateWatchStatus(Watch watch) throws IOException {<NEW_LINE>// at the moment we store the status together with the watch,<NEW_LINE>// so we just need to update the watch itself<NEW_LINE>// we do not want to update the status.state field, as it might have been deactivated in-between<NEW_LINE>Map<String, String> parameters = Map.of(Watch.INCLUDE_STATUS_KEY, <MASK><NEW_LINE>ToXContent.MapParams params = new ToXContent.MapParams(parameters);<NEW_LINE>XContentBuilder source = JsonXContent.contentBuilder().startObject().field(WatchField.STATUS.getPreferredName(), watch.status(), params).endObject();<NEW_LINE>UpdateRequest updateRequest = new UpdateRequest(Watch.INDEX, watch.id());<NEW_LINE>updateRequest.doc(source);<NEW_LINE>updateRequest.setIfSeqNo(watch.getSourceSeqNo());<NEW_LINE>updateRequest.setIfPrimaryTerm(watch.getSourcePrimaryTerm());<NEW_LINE>try (ThreadContext.StoredContext ignore = client.threadPool().getThreadContext().stashWithOrigin(WATCHER_ORIGIN)) {<NEW_LINE>client.update(updateRequest).actionGet(indexDefaultTimeout);<NEW_LINE>} catch (DocumentMissingException e) {<NEW_LINE>// do not rethrow this exception, otherwise the watch history will contain an exception<NEW_LINE>// even though the execution might have been fine<NEW_LINE>// TODO should we really just drop this exception on the floor?<NEW_LINE>}<NEW_LINE>} | "true", WatchStatus.INCLUDE_STATE, "false"); |
942,141 | public BackupDetails unmarshall(JsonUnmarshallerContext context) throws Exception {<NEW_LINE><MASK><NEW_LINE>if (!reader.isContainer()) {<NEW_LINE>reader.skipValue();<NEW_LINE>return null;<NEW_LINE>}<NEW_LINE>BackupDetails backupDetails = new BackupDetails();<NEW_LINE>reader.beginObject();<NEW_LINE>while (reader.hasNext()) {<NEW_LINE>String name = reader.nextName();<NEW_LINE>if (name.equals("BackupArn")) {<NEW_LINE>backupDetails.setBackupArn(StringJsonUnmarshaller.getInstance().unmarshall(context));<NEW_LINE>} else if (name.equals("BackupName")) {<NEW_LINE>backupDetails.setBackupName(StringJsonUnmarshaller.getInstance().unmarshall(context));<NEW_LINE>} else if (name.equals("BackupSizeBytes")) {<NEW_LINE>backupDetails.setBackupSizeBytes(LongJsonUnmarshaller.getInstance().unmarshall(context));<NEW_LINE>} else if (name.equals("BackupStatus")) {<NEW_LINE>backupDetails.setBackupStatus(StringJsonUnmarshaller.getInstance().unmarshall(context));<NEW_LINE>} else if (name.equals("BackupType")) {<NEW_LINE>backupDetails.setBackupType(StringJsonUnmarshaller.getInstance().unmarshall(context));<NEW_LINE>} else if (name.equals("BackupCreationDateTime")) {<NEW_LINE>backupDetails.setBackupCreationDateTime(DateJsonUnmarshaller.getInstance().unmarshall(context));<NEW_LINE>} else if (name.equals("BackupExpiryDateTime")) {<NEW_LINE>backupDetails.setBackupExpiryDateTime(DateJsonUnmarshaller.getInstance().unmarshall(context));<NEW_LINE>} else {<NEW_LINE>reader.skipValue();<NEW_LINE>}<NEW_LINE>}<NEW_LINE>reader.endObject();<NEW_LINE>return backupDetails;<NEW_LINE>} | AwsJsonReader reader = context.getReader(); |
134,592 | public ModelAndView validateCode(Model model, @RequestParam("code") String code, @ModelAttribute("uaaMfaCredentials") UserGoogleMfaCredentials credentials, HttpServletRequest request, SessionStatus sessionStatus) throws UaaPrincipalIsNotInSession {<NEW_LINE>UaaAuthentication uaaAuth = getUaaAuthentication();<NEW_LINE>UaaPrincipal uaaPrincipal = getSessionAuthPrincipal();<NEW_LINE>if (!this.mfaPolicy.isAllowed(uaaPrincipal.getId()).isAllowed()) {<NEW_LINE>throw new AuthenticationPolicyRejectionException("Your account has been locked because of too many failed attempts to login.");<NEW_LINE>}<NEW_LINE>try {<NEW_LINE>Integer codeValue = Integer.valueOf(code);<NEW_LINE>if (mfaCredentialsProvisioning.isValidCode(credentials, codeValue)) {<NEW_LINE>if (mfaCredentialsProvisioning.getUserGoogleMfaCredentials(uaaPrincipal.getId()) == null) {<NEW_LINE>mfaCredentialsProvisioning.saveUserCredentials(credentials);<NEW_LINE>}<NEW_LINE>Set<String> authMethods = new HashSet<>(uaaAuth.getAuthenticationMethods());<NEW_LINE>authMethods.addAll(Arrays.asList("otp", "mfa"));<NEW_LINE>uaaAuth.setAuthenticationMethods(authMethods);<NEW_LINE>publish(new MfaAuthenticationSuccessEvent(getUaaUser(uaaPrincipal), uaaAuth, getMfaProvider().getType().toValue(), IdentityZoneHolder.getCurrentZoneId()));<NEW_LINE>sessionStatus.setComplete();<NEW_LINE>SessionUtils.setSecurityContext(request.getSession(), SecurityContextHolder.getContext());<NEW_LINE>return new ModelAndView(new RedirectView(mfaCompleteUrl, true));<NEW_LINE>}<NEW_LINE>logger.debug("Code authorization failed for user: " + uaaPrincipal.getId());<NEW_LINE>publish(new MfaAuthenticationFailureEvent(getUaaUser(uaaPrincipal), uaaAuth, getMfaProvider().getType().toValue(), IdentityZoneHolder.getCurrentZoneId()));<NEW_LINE>model.addAttribute("error", "Incorrect code, please try again.");<NEW_LINE>} catch (NumberFormatException | GoogleAuthenticatorException e) {<NEW_LINE>logger.debug("Error validating the code for user: " + uaaPrincipal.getId() + ". Error: " + e.getMessage());<NEW_LINE>publish(new MfaAuthenticationFailureEvent(getUaaUser(uaaPrincipal), uaaAuth, getMfaProvider().getType().toValue(), IdentityZoneHolder.getCurrentZoneId()));<NEW_LINE><MASK><NEW_LINE>}<NEW_LINE>return renderEnterCodePage(model, uaaPrincipal);<NEW_LINE>} | model.addAttribute("error", "Incorrect code, please try again."); |
706,200 | final NotifyApplicationStateResult executeNotifyApplicationState(NotifyApplicationStateRequest notifyApplicationStateRequest) {<NEW_LINE>ExecutionContext executionContext = createExecutionContext(notifyApplicationStateRequest);<NEW_LINE>AWSRequestMetrics awsRequestMetrics = executionContext.getAwsRequestMetrics();<NEW_LINE>awsRequestMetrics.startEvent(Field.ClientExecuteTime);<NEW_LINE>Request<NotifyApplicationStateRequest> request = null;<NEW_LINE>Response<NotifyApplicationStateResult> response = null;<NEW_LINE>try {<NEW_LINE>awsRequestMetrics.startEvent(Field.RequestMarshallTime);<NEW_LINE>try {<NEW_LINE>request = new NotifyApplicationStateRequestProtocolMarshaller(protocolFactory).marshall(super.beforeMarshalling(notifyApplicationStateRequest));<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, "Migration Hub");<NEW_LINE>request.addHandlerContext(HandlerContextKey.OPERATION_NAME, "NotifyApplicationState");<NEW_LINE>request.addHandlerContext(HandlerContextKey.ADVANCED_CONFIG, advancedConfig);<NEW_LINE>} finally {<NEW_LINE>awsRequestMetrics.endEvent(Field.RequestMarshallTime);<NEW_LINE>}<NEW_LINE>HttpResponseHandler<AmazonWebServiceResponse<NotifyApplicationStateResult>> responseHandler = protocolFactory.createResponseHandler(new JsonOperationMetadata().withPayloadJson(true).withHasStreamingSuccessResponse(false), new NotifyApplicationStateResultJsonUnmarshaller());<NEW_LINE>response = invoke(request, responseHandler, executionContext);<NEW_LINE>return response.getAwsResponse();<NEW_LINE>} finally {<NEW_LINE><MASK><NEW_LINE>}<NEW_LINE>} | endClientExecution(awsRequestMetrics, request, response); |
109,266 | final DescribeScalableTargetsResult executeDescribeScalableTargets(DescribeScalableTargetsRequest describeScalableTargetsRequest) {<NEW_LINE>ExecutionContext executionContext = createExecutionContext(describeScalableTargetsRequest);<NEW_LINE>AWSRequestMetrics awsRequestMetrics = executionContext.getAwsRequestMetrics();<NEW_LINE>awsRequestMetrics.startEvent(Field.ClientExecuteTime);<NEW_LINE>Request<DescribeScalableTargetsRequest> request = null;<NEW_LINE>Response<DescribeScalableTargetsResult> response = null;<NEW_LINE>try {<NEW_LINE>awsRequestMetrics.startEvent(Field.RequestMarshallTime);<NEW_LINE>try {<NEW_LINE>request = new DescribeScalableTargetsRequestProtocolMarshaller(protocolFactory).marshall(super.beforeMarshalling(describeScalableTargetsRequest));<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, "Application Auto Scaling");<NEW_LINE>request.addHandlerContext(HandlerContextKey.OPERATION_NAME, "DescribeScalableTargets");<NEW_LINE>request.addHandlerContext(HandlerContextKey.ADVANCED_CONFIG, advancedConfig);<NEW_LINE>} finally {<NEW_LINE>awsRequestMetrics.endEvent(Field.RequestMarshallTime);<NEW_LINE>}<NEW_LINE>HttpResponseHandler<AmazonWebServiceResponse<DescribeScalableTargetsResult>> responseHandler = protocolFactory.createResponseHandler(new JsonOperationMetadata().withPayloadJson(true).withHasStreamingSuccessResponse(false), new DescribeScalableTargetsResultJsonUnmarshaller());<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); |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.