idx int32 46 1.86M | input stringlengths 321 6.6k | target stringlengths 9 1.24k |
|---|---|---|
579,366 | public static HttpCompliance from(String spec) {<NEW_LINE>Set<Violation> sections;<NEW_LINE>String[] elements = spec.split("\\s*,\\s*");<NEW_LINE>switch(elements[0]) {<NEW_LINE>case "0":<NEW_LINE>sections = noneOf(Violation.class);<NEW_LINE>break;<NEW_LINE>case "*":<NEW_LINE>sections = allOf(Violation.class);<NEW_LINE>break;<NEW_LINE>default:<NEW_LINE>{<NEW_LINE>HttpCompliance mode = HttpCompliance.valueOf(elements[0]);<NEW_LINE>sections = (mode == null) ? noneOf(HttpCompliance.Violation.class) : copyOf(mode.getAllowed());<NEW_LINE>}<NEW_LINE>}<NEW_LINE>for (int i = 1; i < elements.length; i++) {<NEW_LINE>String element = elements[i];<NEW_LINE>boolean exclude = element.startsWith("-");<NEW_LINE>if (exclude)<NEW_LINE>element = element.substring(1);<NEW_LINE>Violation section = Violation.valueOf(element);<NEW_LINE>if (exclude)<NEW_LINE>sections.remove(section);<NEW_LINE>else<NEW_LINE>sections.add(section);<NEW_LINE>}<NEW_LINE>return new HttpCompliance("CUSTOM" + <MASK><NEW_LINE>} | __custom.getAndIncrement(), sections); |
293,263 | public Object doQuery(Object[] objs) {<NEW_LINE>try {<NEW_LINE>if (objs.length == 1) {<NEW_LINE>ArrayList<File> rFile = new ArrayList<File>();<NEW_LINE>ArrayList<File> rDir = new ArrayList<File>();<NEW_LINE>List<String> ls = new ArrayList<String>();<NEW_LINE>List<String> filters = ImUtils.getFilter(objs[0]);<NEW_LINE>String rootPath = m_zipfile.getFile().getParentFile().getCanonicalPath();<NEW_LINE>for (String line : filters) {<NEW_LINE>if (!ImUtils.isRootPathFile(line)) {<NEW_LINE>ls.add(rootPath + File.separator + line);<NEW_LINE>} else {<NEW_LINE>ls.add(line);<NEW_LINE>}<NEW_LINE>}<NEW_LINE>ImUtils.getFiles(ls, rFile, rDir, true);<NEW_LINE>ImZipUtil.zip(<MASK><NEW_LINE>} else {<NEW_LINE>MessageManager mm = EngineMessage.get();<NEW_LINE>throw new RQException("zip" + mm.getMessage("zipadd param error"));<NEW_LINE>}<NEW_LINE>} catch (Exception e) {<NEW_LINE>Logger.error(e.getStackTrace());<NEW_LINE>}<NEW_LINE>return true;<NEW_LINE>} | m_zipfile, m_parameters, rFile, rDir); |
844,835 | protected void loadEntities() {<NEW_LINE>log.debug("Loading entities");<NEW_LINE>entitiesManual = new HashMap<>();<NEW_LINE>entitiesAuto = new HashMap<>();<NEW_LINE>Transaction tx = persistence.createTransaction();<NEW_LINE>try {<NEW_LINE><MASK><NEW_LINE>TypedQuery<LoggedEntity> q = em.createQuery("select e from sec$LoggedEntity e where e.auto = true or e.manual = true", LoggedEntity.class);<NEW_LINE>List<LoggedEntity> list = q.getResultList();<NEW_LINE>for (LoggedEntity loggedEntity : list) {<NEW_LINE>if (loggedEntity.getName() == null) {<NEW_LINE>throw new IllegalStateException("Unable to initialize EntityLog: empty LoggedEntity.name");<NEW_LINE>}<NEW_LINE>Set<String> attributes = new HashSet<>();<NEW_LINE>for (LoggedAttribute loggedAttribute : loggedEntity.getAttributes()) {<NEW_LINE>if (loggedAttribute.getName() == null) {<NEW_LINE>throw new IllegalStateException("Unable to initialize EntityLog: empty LoggedAttribute.name");<NEW_LINE>}<NEW_LINE>attributes.add(loggedAttribute.getName());<NEW_LINE>}<NEW_LINE>if (BooleanUtils.isTrue(loggedEntity.getAuto()))<NEW_LINE>entitiesAuto.put(loggedEntity.getName(), attributes);<NEW_LINE>if (BooleanUtils.isTrue(loggedEntity.getManual()))<NEW_LINE>entitiesManual.put(loggedEntity.getName(), attributes);<NEW_LINE>}<NEW_LINE>tx.commit();<NEW_LINE>} finally {<NEW_LINE>tx.end();<NEW_LINE>}<NEW_LINE>log.debug("Loaded: entitiesAuto={}, entitiesManual={}", entitiesAuto.size(), entitiesManual.size());<NEW_LINE>} | EntityManager em = persistence.getEntityManager(); |
326,874 | public byte[] doInTransform(Instrumentor instrumentor, ClassLoader loader, String className, Class<?> classBeingRedefined, ProtectionDomain protectionDomain, byte[] classfileBuffer) throws InstrumentException {<NEW_LINE>ThriftPluginConfig config = new ThriftPluginConfig(instrumentor.getProfilerConfig());<NEW_LINE>final boolean traceServiceArgs = config.traceThriftServiceArgs();<NEW_LINE>final <MASK><NEW_LINE>final InstrumentClass target = instrumentor.getInstrumentClass(loader, className, classfileBuffer);<NEW_LINE>// TServiceClient.sendBase(String, TBase)<NEW_LINE>final InstrumentMethod sendBase = target.getDeclaredMethod("sendBase", "java.lang.String", "org.apache.thrift.TBase");<NEW_LINE>if (sendBase != null) {<NEW_LINE>InterceptorScope thriftClientScope = instrumentor.getInterceptorScope(ThriftScope.THRIFT_CLIENT_SCOPE);<NEW_LINE>sendBase.addScopedInterceptor(TServiceClientSendBaseInterceptor.class, va(traceServiceArgs), thriftClientScope, ExecutionPolicy.BOUNDARY);<NEW_LINE>}<NEW_LINE>// TServiceClient.receiveBase(TBase, String)<NEW_LINE>final InstrumentMethod receiveBase = target.getDeclaredMethod("receiveBase", "org.apache.thrift.TBase", "java.lang.String");<NEW_LINE>if (receiveBase != null) {<NEW_LINE>receiveBase.addInterceptor(TServiceClientReceiveBaseInterceptor.class, va(traceServiceResult));<NEW_LINE>}<NEW_LINE>return target.toBytecode();<NEW_LINE>} | boolean traceServiceResult = config.traceThriftServiceResult(); |
1,734,561 | public static void main(String[] args) {<NEW_LINE>Map<Integer, TypeStat> map = new <MASK><NEW_LINE>init(map);<NEW_LINE>for (int codepoint = 0; codepoint <= 0x110000; codepoint++) {<NEW_LINE>int type = java.lang.Character.getType(codepoint);<NEW_LINE>if (!map.containsKey(type)) {<NEW_LINE>map.put(type, new TypeStat(type));<NEW_LINE>}<NEW_LINE>map.get(type).addCodepoint(codepoint);<NEW_LINE>}<NEW_LINE>int[] codes = new int[map.size()];<NEW_LINE>int numcodes = 0;<NEW_LINE>for (Integer type : map.keySet()) {<NEW_LINE>codes[numcodes++] = type;<NEW_LINE>}<NEW_LINE>Arrays.sort(codes);<NEW_LINE>for (int type : codes) {<NEW_LINE>TypeStat ts = map.get(type);<NEW_LINE>System.out.println("type " + type + " typecode=" + ts.typecode + " name=" + ts.name + " contains " + ts.codepoints.size() + " codepoints");<NEW_LINE>}<NEW_LINE>} | HashMap<Integer, TypeStat>(); |
59,124 | private CharSequence generateStoreValue(final PrimitiveType primitiveType, final String valueSuffix, final String offsetStr, final ByteOrder byteOrder, final String indent) {<NEW_LINE>final String cppTypeName = cppTypeName(primitiveType);<NEW_LINE>final String byteOrderStr = formatByteOrderEncoding(byteOrder, primitiveType);<NEW_LINE>final StringBuilder sb = new StringBuilder();<NEW_LINE>if (primitiveType == PrimitiveType.FLOAT || primitiveType == PrimitiveType.DOUBLE) {<NEW_LINE>final String stackUnion = primitiveType == PrimitiveType.FLOAT ? "union sbe_float_as_uint_u" : "union sbe_double_as_uint_u";<NEW_LINE>new Formatter(sb).format(indent + " %1$s val%2$s;\n" + indent + " val%2$s.fp_value = value%2$s;\n" + indent + " val%2$s.uint_value = %3$s(val%2$s.uint_value);\n" + indent + " std::memcpy(m_buffer + m_offset + %4$s, &val%2$s, sizeof(%5$s));\n", stackUnion, <MASK><NEW_LINE>} else {<NEW_LINE>new Formatter(sb).format(indent + " %1$s val%2$s = %3$s(value%2$s);\n" + indent + " std::memcpy(m_buffer + m_offset + %4$s, &val%2$s, sizeof(%1$s));\n", cppTypeName, valueSuffix, byteOrderStr, offsetStr);<NEW_LINE>}<NEW_LINE>return sb;<NEW_LINE>} | valueSuffix, byteOrderStr, offsetStr, cppTypeName); |
1,517,313 | private // sensitivity to the spread for a payment period with FLAT compounding type<NEW_LINE>double pvbpCompoundedFlat(RatePaymentPeriod paymentPeriod, RatesProvider provider) {<NEW_LINE>int nbCmp = paymentPeriod.getAccrualPeriods().size();<NEW_LINE>double[] rate = paymentPeriod.getAccrualPeriods().stream().mapToDouble(ap -> rawRate(ap, provider)).toArray();<NEW_LINE>double df = provider.discountFactor(paymentPeriod.getCurrency(), paymentPeriod.getPaymentDate());<NEW_LINE>double rBar = 1.0;<NEW_LINE>double[] cpaAccumulatedBar = new double[nbCmp + 1];<NEW_LINE>cpaAccumulatedBar[nbCmp] = paymentPeriod.getNotional() * df * rBar;<NEW_LINE>double spreadBar = 0.0d;<NEW_LINE>for (int j = nbCmp - 1; j >= 0; j--) {<NEW_LINE>cpaAccumulatedBar[j] = (1.0d + paymentPeriod.getAccrualPeriods().get(j).getYearFraction() * rate[j] * paymentPeriod.getAccrualPeriods().get(j).getGearing()) * cpaAccumulatedBar[j + 1];<NEW_LINE>spreadBar += paymentPeriod.getAccrualPeriods().get(j).getYearFraction(<MASK><NEW_LINE>}<NEW_LINE>return spreadBar;<NEW_LINE>} | ) * cpaAccumulatedBar[j + 1]; |
399,372 | Guard anonfun_0(Guard pc_3, EventBuffer effects, EventHandlerReturnReason outcome, NamedTupleVS var_payload) {<NEW_LINE>PrimitiveVS<Machine> var_$tmp0 = new PrimitiveVS<Machine>().restrict(pc_3);<NEW_LINE>PrimitiveVS<Machine> var_$tmp1 = new PrimitiveVS<Machine>().restrict(pc_3);<NEW_LINE>PrimitiveVS<Integer> var_$tmp2 = new PrimitiveVS<Integer>(0).restrict(pc_3);<NEW_LINE>PrimitiveVS<Integer> var_$tmp3 = new PrimitiveVS<Integer>(0).restrict(pc_3);<NEW_LINE>PrimitiveVS<Machine> temp_var_0;<NEW_LINE>temp_var_0 = (PrimitiveVS<Machine>) ((var_payload.restrict(pc_3)).getField("coor"));<NEW_LINE>var_$tmp0 = var_$tmp0.updateUnderGuard(pc_3, temp_var_0);<NEW_LINE>PrimitiveVS<Machine> temp_var_1;<NEW_LINE>temp_var_1 = var_$tmp0.restrict(pc_3);<NEW_LINE>var_$tmp1 = var_$tmp1.updateUnderGuard(pc_3, temp_var_1);<NEW_LINE>PrimitiveVS<Machine> temp_var_2;<NEW_LINE>temp_var_2 = var_$tmp1.restrict(pc_3);<NEW_LINE>var_coordinator = var_coordinator.updateUnderGuard(pc_3, temp_var_2);<NEW_LINE>PrimitiveVS<Integer> temp_var_3;<NEW_LINE>temp_var_3 = (PrimitiveVS<Integer>) ((var_payload.restrict(pc_3)).getField("n"));<NEW_LINE>var_$tmp2 = var_$tmp2.updateUnderGuard(pc_3, temp_var_3);<NEW_LINE>PrimitiveVS<Integer> temp_var_4;<NEW_LINE>temp_var_4 = var_$tmp2.restrict(pc_3);<NEW_LINE>var_$tmp3 = var_$tmp3.updateUnderGuard(pc_3, temp_var_4);<NEW_LINE>PrimitiveVS<Integer> temp_var_5;<NEW_LINE><MASK><NEW_LINE>var_N = var_N.updateUnderGuard(pc_3, temp_var_5);<NEW_LINE>outcome.addGuardedGoto(pc_3, SendWriteTransaction);<NEW_LINE>pc_3 = Guard.constFalse();<NEW_LINE>return pc_3;<NEW_LINE>} | temp_var_5 = var_$tmp3.restrict(pc_3); |
1,731,303 | private void addFileToRequestBundle(IBaseParameters theInputParameters, String theFileName, byte[] theBytes) {<NEW_LINE>byte[] bytes = theBytes;<NEW_LINE>String fileName = theFileName;<NEW_LINE>if (bytes.length > ourTransferSizeLimit) {<NEW_LINE>ourLog.info("File size is greater than {} - Going to use a local file reference instead of a direct HTTP transfer. Note that this will only work when executing this command on the same server as the FHIR server itself.", FileUtil.formatFileSize(ourTransferSizeLimit));<NEW_LINE>String suffix = fileName.substring(fileName.lastIndexOf("."));<NEW_LINE>try {<NEW_LINE>File tempFile = File.createTempFile("hapi-fhir-cli", suffix);<NEW_LINE>tempFile.deleteOnExit();<NEW_LINE>try (OutputStream fileOutputStream = new FileOutputStream(tempFile, false)) {<NEW_LINE>fileOutputStream.write(bytes);<NEW_LINE>bytes = null;<NEW_LINE>fileName = "localfile:" + tempFile.getAbsolutePath();<NEW_LINE>}<NEW_LINE>} catch (IOException e) {<NEW_LINE>throw new CommandFailureException(Msg<MASK><NEW_LINE>}<NEW_LINE>}<NEW_LINE>ICompositeType attachment = AttachmentUtil.newInstance(myFhirCtx);<NEW_LINE>AttachmentUtil.setUrl(myFhirCtx, attachment, fileName);<NEW_LINE>if (bytes != null) {<NEW_LINE>AttachmentUtil.setData(myFhirCtx, attachment, bytes);<NEW_LINE>}<NEW_LINE>ParametersUtil.addParameterToParameters(myFhirCtx, theInputParameters, TerminologyUploaderProvider.PARAM_FILE, attachment);<NEW_LINE>} | .code(1544) + e); |
118,335 | public void onChange(Collection<File> createdFiles, Collection<File> modifiedFiles, Collection<File> deletedFiles) {<NEW_LINE>if (OpenAPIUtils.isDebugEnabled(tc)) {<NEW_LINE>Tr.debug(this, tc, "Received notification from FileMonitor: createdFiles=" + createdFiles + " : modifiedFiles=" + modifiedFiles + " : deletedFiles=" + deletedFiles);<NEW_LINE>}<NEW_LINE>if ((deletedFiles != null && !deletedFiles.isEmpty())) {<NEW_LINE>if (OpenAPIUtils.isEventEnabled(tc)) {<NEW_LINE>Tr.event(this, tc, "Default customization file was deleted : location=" + deletedFiles.iterator().next().toString());<NEW_LINE>}<NEW_LINE>getOASProviderAggregator().setOpenAPICustomization(null);<NEW_LINE>processCustomizationFiles();<NEW_LINE>}<NEW_LINE>if ((createdFiles != null && !createdFiles.isEmpty())) {<NEW_LINE>File file = createdFiles.iterator().next();<NEW_LINE>if (createdFiles.size() > 1) {<NEW_LINE>// multiple files created - monitor only one file and issue a warning<NEW_LINE>Tr.warning(tc, "MULTIPLE_DEFAULT_OPENAPI_FILES", createdFiles.stream().map(f -> f.getAbsolutePath()).collect(Collectors.joining(", ", "{", "}")), file);<NEW_LINE>}<NEW_LINE>monitorFiles(Arrays.asList(file.getAbsolutePath()));<NEW_LINE>setCustomization(file);<NEW_LINE>if (OpenAPIUtils.isEventEnabled(tc)) {<NEW_LINE>Tr.event(this, tc, <MASK><NEW_LINE>}<NEW_LINE>}<NEW_LINE>if ((modifiedFiles != null && !modifiedFiles.isEmpty())) {<NEW_LINE>File file = modifiedFiles.iterator().next();<NEW_LINE>setCustomization(file);<NEW_LINE>if (OpenAPIUtils.isEventEnabled(tc)) {<NEW_LINE>Tr.event(this, tc, "Customization file was modified : location=" + file.toString());<NEW_LINE>}<NEW_LINE>}<NEW_LINE>} | "Customization file was created : location=" + file.toString()); |
1,691,092 | /* (non-Javadoc)<NEW_LINE>* @see org.netbeans.spi.editor.hints.Fix#implement()<NEW_LINE>*/<NEW_LINE>@Override<NEW_LINE>public ChangeInfo implement() throws Exception {<NEW_LINE>FileObject template = <MASK><NEW_LINE>FileObject target;<NEW_LINE>FileObject root = myInfo.getClasspathInfo().getClassPath(PathKind.SOURCE).findOwnerRoot(myInfo.getFileObject());<NEW_LINE>FileObject pakage = FileUtil.createFolder(root, getPackage().replace('.', '/'));<NEW_LINE>DataObject templateDO = DataObject.find(template);<NEW_LINE>DataObject od = templateDO.createFromTemplate(DataFolder.findFolder(pakage), getName());<NEW_LINE>target = od.getPrimaryFile();<NEW_LINE>Project project = FileOwnerQuery.getOwner(myInfo.getFileObject());<NEW_LINE>if (project != null) {<NEW_LINE>CdiUtil logger = project.getLookup().lookup(CdiUtil.class);<NEW_LINE>if (logger != null) {<NEW_LINE>logger.log(getUsageLogMessage(), getClass(), new Object[] { project.getClass().getName() });<NEW_LINE>}<NEW_LINE>}<NEW_LINE>return new ChangeInfo(target, null, null);<NEW_LINE>} | FileUtil.getConfigFile(getTemplate()); |
1,009,314 | public void onCreate(Bundle icicle) {<NEW_LINE>super.onCreate(icicle);<NEW_LINE>locale = (Locale) getArguments().getSerializable(PassphraseRequiredActionBarActivity.LOCALE_EXTRA);<NEW_LINE>archive = getArguments().getBoolean(ARCHIVE, false);<NEW_LINE>DcEventCenter eventCenter = DcHelper.getEventCenter(getActivity());<NEW_LINE>eventCenter.addObserver(DcContext.DC_EVENT_CHAT_MODIFIED, this);<NEW_LINE>eventCenter.<MASK><NEW_LINE>eventCenter.addObserver(DcContext.DC_EVENT_INCOMING_MSG, this);<NEW_LINE>eventCenter.addObserver(DcContext.DC_EVENT_MSGS_CHANGED, this);<NEW_LINE>eventCenter.addObserver(DcContext.DC_EVENT_MSGS_NOTICED, this);<NEW_LINE>eventCenter.addObserver(DcContext.DC_EVENT_MSG_DELIVERED, this);<NEW_LINE>eventCenter.addObserver(DcContext.DC_EVENT_MSG_FAILED, this);<NEW_LINE>eventCenter.addObserver(DcContext.DC_EVENT_MSG_READ, this);<NEW_LINE>eventCenter.addObserver(DcContext.DC_EVENT_CONNECTIVITY_CHANGED, this);<NEW_LINE>eventCenter.addObserver(DcContext.DC_EVENT_SELFAVATAR_CHANGED, this);<NEW_LINE>} | addObserver(DcContext.DC_EVENT_CONTACTS_CHANGED, this); |
1,559,898 | public HttpClient createClientForHttp1(String name) {<NEW_LINE>ExecutorService executor = executorFactory.getExecutorService(name, configFactory.getIntProperty(CONSUMER_HTTP_CLIENT_THREAD_POOL_SIZE)<MASK><NEW_LINE>HttpClient client = sslContextFactoryProvider.provideSslContextFactory().map(sslContextFactory -> new HttpClient(sslContextFactory)).orElseGet(() -> new HttpClient());<NEW_LINE>client.setMaxConnectionsPerDestination(configFactory.getIntProperty(CONSUMER_HTTP_CLIENT_MAX_CONNECTIONS_PER_DESTINATION));<NEW_LINE>client.setMaxRequestsQueuedPerDestination(configFactory.getIntProperty(CONSUMER_HTTP_CLIENT_MAX_REQUESTS_QUEUED_PER_DESTINATION));<NEW_LINE>client.setExecutor(executor);<NEW_LINE>client.setCookieStore(new HttpCookieStore.Empty());<NEW_LINE>client.setIdleTimeout(configFactory.getIntProperty(CONSUMER_HTTP_CLIENT_IDLE_TIMEOUT));<NEW_LINE>client.setFollowRedirects(configFactory.getBooleanProperty(CONSUMER_HTTP_CLIENT_FOLLOW_REDIRECTS));<NEW_LINE>return client;<NEW_LINE>} | , configFactory.getBooleanProperty(CONSUMER_HTTP_CLIENT_THREAD_POOL_MONITORING)); |
896,562 | public Object convert(Object src, Class destClass) {<NEW_LINE>if (java.sql.Time.class.isInstance(src)) {<NEW_LINE>Date date = convertSqlTimeToDate((java.sql.Time) src);<NEW_LINE>if (destClass.equals(java.sql.Date.class)) {<NEW_LINE>Calendar cal = Calendar.getInstance();<NEW_LINE>cal.setTime(date);<NEW_LINE>cal.set(Calendar.HOUR_OF_DAY, 0);<NEW_LINE>cal.set(Calendar.MINUTE, 0);<NEW_LINE>cal.set(Calendar.SECOND, 0);<NEW_LINE>cal.<MASK><NEW_LINE>return new java.sql.Date(cal.getTimeInMillis());<NEW_LINE>}<NEW_LINE>if (destClass.equals(java.sql.Timestamp.class)) {<NEW_LINE>return new java.sql.Timestamp(date.getTime());<NEW_LINE>}<NEW_LINE>}<NEW_LINE>throw new ConvertorException("Unsupported convert: [" + src + "," + destClass.getName() + "]");<NEW_LINE>} | set(Calendar.MILLISECOND, 0); |
1,166,287 | // credit: https://leetcode.com/articles/minimum-ascii-delete-sum-for-two-strings/<NEW_LINE>public int minimumDeleteSum(String s1, String s2) {<NEW_LINE>int[][] dp = new int[s1.length() + 1][s2.length() + 1];<NEW_LINE>for (int i = s1.length() - 1; i >= 0; i--) {<NEW_LINE>dp[i][s2.length()] = dp[i + 1][s2.length()] + s1.codePointAt(i);<NEW_LINE>}<NEW_LINE>for (int j = s2.length() - 1; j >= 0; j--) {<NEW_LINE>dp[s1.length()][j] = dp[s1.length()][j + 1] + s2.codePointAt(j);<NEW_LINE>}<NEW_LINE>for (int i = s1.length() - 1; i >= 0; i--) {<NEW_LINE>for (int j = s2.length() - 1; j >= 0; j--) {<NEW_LINE>if (s1.charAt(i) == s2.charAt(j)) {<NEW_LINE>dp[i][j] = dp[i <MASK><NEW_LINE>} else {<NEW_LINE>dp[i][j] = Math.min(dp[i + 1][j] + s1.codePointAt(i), dp[i][j + 1] + s2.codePointAt(j));<NEW_LINE>}<NEW_LINE>}<NEW_LINE>}<NEW_LINE>return dp[0][0];<NEW_LINE>} | + 1][j + 1]; |
1,290,331 | public ServiceRegistry unmarshall(JsonUnmarshallerContext context) throws Exception {<NEW_LINE>ServiceRegistry serviceRegistry = new ServiceRegistry();<NEW_LINE>int originalDepth = context.getCurrentDepth();<NEW_LINE>String currentParentElement = context.getCurrentParentElement();<NEW_LINE>int targetDepth = originalDepth + 1;<NEW_LINE><MASK><NEW_LINE>if (token == null)<NEW_LINE>token = context.nextToken();<NEW_LINE>if (token == VALUE_NULL) {<NEW_LINE>return null;<NEW_LINE>}<NEW_LINE>while (true) {<NEW_LINE>if (token == null)<NEW_LINE>break;<NEW_LINE>if (token == FIELD_NAME || token == START_OBJECT) {<NEW_LINE>if (context.testExpression("registryArn", targetDepth)) {<NEW_LINE>context.nextToken();<NEW_LINE>serviceRegistry.setRegistryArn(context.getUnmarshaller(String.class).unmarshall(context));<NEW_LINE>}<NEW_LINE>if (context.testExpression("port", targetDepth)) {<NEW_LINE>context.nextToken();<NEW_LINE>serviceRegistry.setPort(context.getUnmarshaller(Integer.class).unmarshall(context));<NEW_LINE>}<NEW_LINE>if (context.testExpression("containerName", targetDepth)) {<NEW_LINE>context.nextToken();<NEW_LINE>serviceRegistry.setContainerName(context.getUnmarshaller(String.class).unmarshall(context));<NEW_LINE>}<NEW_LINE>if (context.testExpression("containerPort", targetDepth)) {<NEW_LINE>context.nextToken();<NEW_LINE>serviceRegistry.setContainerPort(context.getUnmarshaller(Integer.class).unmarshall(context));<NEW_LINE>}<NEW_LINE>} else if (token == END_ARRAY || token == END_OBJECT) {<NEW_LINE>if (context.getLastParsedParentElement() == null || context.getLastParsedParentElement().equals(currentParentElement)) {<NEW_LINE>if (context.getCurrentDepth() <= originalDepth)<NEW_LINE>break;<NEW_LINE>}<NEW_LINE>}<NEW_LINE>token = context.nextToken();<NEW_LINE>}<NEW_LINE>return serviceRegistry;<NEW_LINE>} | JsonToken token = context.getCurrentToken(); |
1,644,100 | private ClassPath createCP(Project prj, HashSet<Project> parents) {<NEW_LINE>parents.add(prj);<NEW_LINE>List<ClassPath> list = new ArrayList<ClassPath>();<NEW_LINE>ProjectSourcesClassPathProvider cpp = prj.getLookup().lookup(ProjectSourcesClassPathProvider.class);<NEW_LINE>ClassPath[] cp = cpp.getProjectClassPaths(ClassPath.EXECUTE);<NEW_LINE>list.addAll(Arrays.asList(cp));<NEW_LINE>// for pom packaging projects subprojects/modules matter<NEW_LINE>// TODO for application project it's DependencyProjectProvider, for pom project (run-ide?) it's containerprojectprovider<NEW_LINE>SubprojectProvider spp = prj.getLookup().lookup(SubprojectProvider.class);<NEW_LINE>if (spp != null) {<NEW_LINE>for (Project sub : spp.getSubprojects()) {<NEW_LINE>if (parents.contains(sub)) {<NEW_LINE>continue;<NEW_LINE>}<NEW_LINE>ClassPath <MASK><NEW_LINE>if (c != null) {<NEW_LINE>list.add(c);<NEW_LINE>}<NEW_LINE>}<NEW_LINE>}<NEW_LINE>if (list.size() > 0) {<NEW_LINE>return ClassPathSupport.createProxyClassPath(list.toArray(new ClassPath[list.size()]));<NEW_LINE>}<NEW_LINE>return null;<NEW_LINE>} | c = createCP(sub, parents); |
894,462 | public String downloadAvatar(Long userId, String uuid) throws ApiException {<NEW_LINE>Object localVarPostBody = null;<NEW_LINE>// verify the required parameter 'userId' is set<NEW_LINE>if (userId == null) {<NEW_LINE>throw new ApiException(400, "Missing the required parameter 'userId' when calling downloadAvatar");<NEW_LINE>}<NEW_LINE>// verify the required parameter 'uuid' is set<NEW_LINE>if (uuid == null) {<NEW_LINE>throw new ApiException(400, "Missing the required parameter 'uuid' when calling downloadAvatar");<NEW_LINE>}<NEW_LINE>// create path and map variables<NEW_LINE>String localVarPath = "/v4/downloads/avatar/{user_id}/{uuid}".replaceAll("\\{" + "user_id" + "\\}", apiClient.escapeString(userId.toString())).replaceAll("\\{" + "uuid" + "\\}", apiClient.escapeString(uuid.toString()));<NEW_LINE>// query params<NEW_LINE>List<Pair> localVarQueryParams = new ArrayList<Pair>();<NEW_LINE>Map<String, String> localVarHeaderParams = new HashMap<String, String>();<NEW_LINE>Map<String, Object> localVarFormParams = new HashMap<String, Object>();<NEW_LINE>final String[] localVarAccepts = { "application/octet-stream" };<NEW_LINE>final String localVarAccept = apiClient.selectHeaderAccept(localVarAccepts);<NEW_LINE><MASK><NEW_LINE>final String localVarContentType = apiClient.selectHeaderContentType(localVarContentTypes);<NEW_LINE>String[] localVarAuthNames = new String[] {};<NEW_LINE>GenericType<String> localVarReturnType = new GenericType<String>() {<NEW_LINE>};<NEW_LINE>return apiClient.invokeAPI(localVarPath, "GET", localVarQueryParams, localVarPostBody, localVarHeaderParams, localVarFormParams, localVarAccept, localVarContentType, localVarAuthNames, localVarReturnType);<NEW_LINE>} | final String[] localVarContentTypes = {}; |
108,543 | public static KafkaConsumer acquireKafkaConsumerForConfig(KafkaStreamLevelStreamConfig kafkaStreamLevelStreamConfig) {<NEW_LINE>final ImmutableTriple<String, String, String> configKey = new ImmutableTriple<>(kafkaStreamLevelStreamConfig.getKafkaTopicName(), kafkaStreamLevelStreamConfig.getGroupId(), kafkaStreamLevelStreamConfig.getBootstrapServers());<NEW_LINE>synchronized (KafkaStreamLevelConsumerManager.class) {<NEW_LINE>// If we have the consumer and it's not already acquired, return it, otherwise error out if it's already acquired<NEW_LINE>if (CONSUMER_FOR_CONFIG_KEY.containsKey(configKey)) {<NEW_LINE>KafkaConsumer kafkaConsumer = CONSUMER_FOR_CONFIG_KEY.get(configKey);<NEW_LINE>if (CONSUMER_RELEASE_TIME.get(kafkaConsumer).equals(IN_USE)) {<NEW_LINE>throw new RuntimeException("Consumer " + kafkaConsumer + " already in use!");<NEW_LINE>} else {<NEW_LINE>LOGGER.info("Reusing kafka consumer with id {}", kafkaConsumer);<NEW_LINE>CONSUMER_RELEASE_TIME.put(kafkaConsumer, IN_USE);<NEW_LINE>return kafkaConsumer;<NEW_LINE>}<NEW_LINE>}<NEW_LINE>LOGGER.info("Creating new kafka consumer and iterator for topic {}", kafkaStreamLevelStreamConfig.getKafkaTopicName());<NEW_LINE>// Create the consumer<NEW_LINE>Properties consumerProp = new Properties();<NEW_LINE>consumerProp.putAll(kafkaStreamLevelStreamConfig.getKafkaConsumerProperties());<NEW_LINE>consumerProp.put(ConsumerConfig.BOOTSTRAP_SERVERS_CONFIG, kafkaStreamLevelStreamConfig.getBootstrapServers());<NEW_LINE>consumerProp.put(ConsumerConfig.KEY_DESERIALIZER_CLASS_CONFIG, <MASK><NEW_LINE>consumerProp.put(ConsumerConfig.VALUE_DESERIALIZER_CLASS_CONFIG, BytesDeserializer.class.getName());<NEW_LINE>if (consumerProp.containsKey(ConsumerConfig.AUTO_OFFSET_RESET_CONFIG) && consumerProp.getProperty(ConsumerConfig.AUTO_OFFSET_RESET_CONFIG).equals("smallest")) {<NEW_LINE>consumerProp.put(ConsumerConfig.AUTO_OFFSET_RESET_CONFIG, "earliest");<NEW_LINE>}<NEW_LINE>KafkaConsumer consumer = new KafkaConsumer<>(consumerProp);<NEW_LINE>consumer.subscribe(Collections.singletonList(kafkaStreamLevelStreamConfig.getKafkaTopicName()));<NEW_LINE>// Mark both the consumer and iterator as acquired<NEW_LINE>CONSUMER_FOR_CONFIG_KEY.put(configKey, consumer);<NEW_LINE>CONSUMER_RELEASE_TIME.put(consumer, IN_USE);<NEW_LINE>LOGGER.info("Created consumer with id {} for topic {}", consumer, kafkaStreamLevelStreamConfig.getKafkaTopicName());<NEW_LINE>return consumer;<NEW_LINE>}<NEW_LINE>} | StringDeserializer.class.getName()); |
1,674,744 | final UntagResourceResult executeUntagResource(UntagResourceRequest untagResourceRequest) {<NEW_LINE>ExecutionContext executionContext = createExecutionContext(untagResourceRequest);<NEW_LINE>AWSRequestMetrics awsRequestMetrics = executionContext.getAwsRequestMetrics();<NEW_LINE>awsRequestMetrics.startEvent(Field.ClientExecuteTime);<NEW_LINE>Request<UntagResourceRequest> request = null;<NEW_LINE>Response<UntagResourceResult> response = null;<NEW_LINE>try {<NEW_LINE>awsRequestMetrics.startEvent(Field.RequestMarshallTime);<NEW_LINE>try {<NEW_LINE>request = new UntagResourceRequestProtocolMarshaller(protocolFactory).marshall(super.beforeMarshalling(untagResourceRequest));<NEW_LINE>// Binds the request metrics to the current request.<NEW_LINE>request.setAWSRequestMetrics(awsRequestMetrics);<NEW_LINE>request.<MASK><NEW_LINE>request.addHandlerContext(HandlerContextKey.ENDPOINT_OVERRIDDEN, isEndpointOverridden());<NEW_LINE>request.addHandlerContext(HandlerContextKey.SIGNING_REGION, getSigningRegion());<NEW_LINE>request.addHandlerContext(HandlerContextKey.SERVICE_ID, "savingsplans");<NEW_LINE>request.addHandlerContext(HandlerContextKey.OPERATION_NAME, "UntagResource");<NEW_LINE>request.addHandlerContext(HandlerContextKey.ADVANCED_CONFIG, advancedConfig);<NEW_LINE>} finally {<NEW_LINE>awsRequestMetrics.endEvent(Field.RequestMarshallTime);<NEW_LINE>}<NEW_LINE>HttpResponseHandler<AmazonWebServiceResponse<UntagResourceResult>> responseHandler = protocolFactory.createResponseHandler(new JsonOperationMetadata().withPayloadJson(true).withHasStreamingSuccessResponse(false), new UntagResourceResultJsonUnmarshaller());<NEW_LINE>response = invoke(request, responseHandler, executionContext);<NEW_LINE>return response.getAwsResponse();<NEW_LINE>} finally {<NEW_LINE>endClientExecution(awsRequestMetrics, request, response);<NEW_LINE>}<NEW_LINE>} | addHandlerContext(HandlerContextKey.CLIENT_ENDPOINT, endpoint); |
371,509 | private void loadNode57() throws IOException, SAXException {<NEW_LINE>PropertyTypeNode node = new PropertyTypeNode(this.context, Identifiers.ServerConfigurationType_UpdateCertificate_OutputArguments, new QualifiedName(0, "OutputArguments"), new LocalizedText("en", "OutputArguments"), LocalizedText.NULL_VALUE, UInteger.valueOf(0), UInteger.valueOf(0), new DataValue(Variant.NULL_VALUE), Identifiers.Argument, 1, new UInteger[] { org.eclipse.milo.opcua.stack.core.types.builtin.unsigned.UInteger.valueOf(0) }, UByte.valueOf(1), UByte.valueOf(1), 0.0, false);<NEW_LINE>node.addReference(new Reference(Identifiers.ServerConfigurationType_UpdateCertificate_OutputArguments, Identifiers.HasTypeDefinition, Identifiers.PropertyType.expanded(), true));<NEW_LINE>node.addReference(new Reference(Identifiers.ServerConfigurationType_UpdateCertificate_OutputArguments, Identifiers.HasModellingRule, Identifiers.ModellingRule_Mandatory.expanded(), true));<NEW_LINE>node.addReference(new Reference(Identifiers.ServerConfigurationType_UpdateCertificate_OutputArguments, Identifiers.HasProperty, Identifiers.ServerConfigurationType_UpdateCertificate.expanded(), false));<NEW_LINE>StringBuilder sb = new StringBuilder();<NEW_LINE>sb.append("<ListOfExtensionObject xmlns=\"http://opcfoundation.org/UA/2008/02/Types.xsd\"><ExtensionObject><TypeId><Identifier>i=297</Identifier> </TypeId><Body><Argument><Name>ApplyChangesRequired</Name><DataType><Identifier>i=1</Identifier> </DataType><ValueRank>-1</ValueRank><ArrayDimensions/> </Argument> </Body> </ExtensionObject> </ListOfExtensionObject>");<NEW_LINE>String xml = sb.toString();<NEW_LINE>OpcUaXmlStreamDecoder decoder = new OpcUaXmlStreamDecoder(context.getServer().getSerializationContext()).<MASK><NEW_LINE>Object o = decoder.readVariantValue();<NEW_LINE>DataValue value = new DataValue(new Variant(o));<NEW_LINE>node.setValue(value);<NEW_LINE>this.nodeManager.addNode(node);<NEW_LINE>} | setInput(new StringReader(xml)); |
606,992 | public CommonAttributeCountSearchResults findMatchesByCount() throws TskCoreException, NoCurrentCaseException, SQLException, CentralRepoException {<NEW_LINE>CorrelationCase correlationCase = this.getCorrelationCaseFromId(this.corrleationCaseId);<NEW_LINE>this.correlationCaseName = correlationCase.getDisplayName();<NEW_LINE>InterCaseSearchResultsProcessor eamDbAttrInst = new InterCaseSearchResultsProcessor(this.corAttrType);<NEW_LINE>Set<String> mimeTypesToFilterOn = new HashSet<>();<NEW_LINE>if (isFilterByMedia()) {<NEW_LINE>mimeTypesToFilterOn.addAll(MEDIA_PICS_VIDEO_MIME_TYPES);<NEW_LINE>}<NEW_LINE>if (isFilterByDoc()) {<NEW_LINE>mimeTypesToFilterOn.addAll(TEXT_FILES_MIME_TYPES);<NEW_LINE>}<NEW_LINE>Map<Integer, CommonAttributeValueList> interCaseCommonFiles = eamDbAttrInst.findSingleInterCaseValuesByCount(Case.<MASK><NEW_LINE>return new CommonAttributeCountSearchResults(interCaseCommonFiles, this.frequencyPercentageThreshold, this.corAttrType);<NEW_LINE>} | getCurrentCase(), mimeTypesToFilterOn, correlationCase); |
1,322,244 | public VertexLabel append() {<NEW_LINE>VertexLabel vertexLabel = <MASK><NEW_LINE>if (vertexLabel == null) {<NEW_LINE>throw new NotFoundException("Can't update vertex label '%s' " + "since it doesn't exist", this.name);<NEW_LINE>}<NEW_LINE>this.checkStableVars();<NEW_LINE>this.checkProperties(Action.APPEND);<NEW_LINE>this.checkNullableKeys(Action.APPEND);<NEW_LINE>Userdata.check(this.userdata, Action.APPEND);<NEW_LINE>for (String key : this.properties) {<NEW_LINE>PropertyKey propertyKey = this.graph().propertyKey(key);<NEW_LINE>vertexLabel.property(propertyKey.id());<NEW_LINE>}<NEW_LINE>for (String key : this.nullableKeys) {<NEW_LINE>PropertyKey propertyKey = this.graph().propertyKey(key);<NEW_LINE>vertexLabel.nullableKey(propertyKey.id());<NEW_LINE>}<NEW_LINE>vertexLabel.userdata(this.userdata);<NEW_LINE>this.graph().addVertexLabel(vertexLabel);<NEW_LINE>return vertexLabel;<NEW_LINE>} | this.vertexLabelOrNull(this.name); |
759,534 | final UpdatePullRequestTitleResult executeUpdatePullRequestTitle(UpdatePullRequestTitleRequest updatePullRequestTitleRequest) {<NEW_LINE>ExecutionContext executionContext = createExecutionContext(updatePullRequestTitleRequest);<NEW_LINE>AWSRequestMetrics awsRequestMetrics = executionContext.getAwsRequestMetrics();<NEW_LINE>awsRequestMetrics.startEvent(Field.ClientExecuteTime);<NEW_LINE>Request<UpdatePullRequestTitleRequest> request = null;<NEW_LINE>Response<UpdatePullRequestTitleResult> response = null;<NEW_LINE>try {<NEW_LINE>awsRequestMetrics.startEvent(Field.RequestMarshallTime);<NEW_LINE>try {<NEW_LINE>request = new UpdatePullRequestTitleRequestProtocolMarshaller(protocolFactory).marshall(super.beforeMarshalling(updatePullRequestTitleRequest));<NEW_LINE>// Binds the request metrics to the current request.<NEW_LINE>request.setAWSRequestMetrics(awsRequestMetrics);<NEW_LINE>request.addHandlerContext(HandlerContextKey.CLIENT_ENDPOINT, endpoint);<NEW_LINE>request.addHandlerContext(HandlerContextKey.ENDPOINT_OVERRIDDEN, isEndpointOverridden());<NEW_LINE>request.addHandlerContext(<MASK><NEW_LINE>request.addHandlerContext(HandlerContextKey.SERVICE_ID, "CodeCommit");<NEW_LINE>request.addHandlerContext(HandlerContextKey.OPERATION_NAME, "UpdatePullRequestTitle");<NEW_LINE>request.addHandlerContext(HandlerContextKey.ADVANCED_CONFIG, advancedConfig);<NEW_LINE>} finally {<NEW_LINE>awsRequestMetrics.endEvent(Field.RequestMarshallTime);<NEW_LINE>}<NEW_LINE>HttpResponseHandler<AmazonWebServiceResponse<UpdatePullRequestTitleResult>> responseHandler = protocolFactory.createResponseHandler(new JsonOperationMetadata().withPayloadJson(true).withHasStreamingSuccessResponse(false), new UpdatePullRequestTitleResultJsonUnmarshaller());<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.SIGNING_REGION, getSigningRegion()); |
1,369,042 | public CreateResourceGroupResult unmarshall(JsonUnmarshallerContext context) throws Exception {<NEW_LINE>CreateResourceGroupResult createResourceGroupResult = new CreateResourceGroupResult();<NEW_LINE>int originalDepth = context.getCurrentDepth();<NEW_LINE>String currentParentElement = context.getCurrentParentElement();<NEW_LINE>int targetDepth = originalDepth + 1;<NEW_LINE><MASK><NEW_LINE>if (token == null)<NEW_LINE>token = context.nextToken();<NEW_LINE>if (token == VALUE_NULL) {<NEW_LINE>return createResourceGroupResult;<NEW_LINE>}<NEW_LINE>while (true) {<NEW_LINE>if (token == null)<NEW_LINE>break;<NEW_LINE>if (token == FIELD_NAME || token == START_OBJECT) {<NEW_LINE>if (context.testExpression("resourceGroupArn", targetDepth)) {<NEW_LINE>context.nextToken();<NEW_LINE>createResourceGroupResult.setResourceGroupArn(context.getUnmarshaller(String.class).unmarshall(context));<NEW_LINE>}<NEW_LINE>} else if (token == END_ARRAY || token == END_OBJECT) {<NEW_LINE>if (context.getLastParsedParentElement() == null || context.getLastParsedParentElement().equals(currentParentElement)) {<NEW_LINE>if (context.getCurrentDepth() <= originalDepth)<NEW_LINE>break;<NEW_LINE>}<NEW_LINE>}<NEW_LINE>token = context.nextToken();<NEW_LINE>}<NEW_LINE>return createResourceGroupResult;<NEW_LINE>} | JsonToken token = context.getCurrentToken(); |
1,011,302 | public void resolvePackageDirectives(CompilationUnitScope cuScope) {<NEW_LINE>if (this.binding == null) {<NEW_LINE>this.ignoreFurtherInvestigation = true;<NEW_LINE>return;<NEW_LINE>}<NEW_LINE>if (this.hasResolvedPackageDirectives)<NEW_LINE>return;<NEW_LINE>this.hasResolvedPackageDirectives = true;<NEW_LINE>Set<PackageBinding> exportedPkgs = new HashSet<>();<NEW_LINE>for (int i = 0; i < this.exportsCount; i++) {<NEW_LINE>ExportsStatement ref = this.exports[i];<NEW_LINE>if (ref != null && ref.resolve(cuScope)) {<NEW_LINE>if (!exportedPkgs.add(ref.resolvedPackage)) {<NEW_LINE>cuScope.problemReporter().invalidPackageReference(IProblem.DuplicateExports, ref);<NEW_LINE>}<NEW_LINE>char[][] targets = null;<NEW_LINE>if (ref.targets != null) {<NEW_LINE>targets = new char[ref.targets.length][];<NEW_LINE>for (int j = 0; j < targets.length; j++) targets[j] = ref.targets[j].moduleName;<NEW_LINE>}<NEW_LINE>this.binding.addResolvedExport(ref.resolvedPackage, targets);<NEW_LINE>}<NEW_LINE>}<NEW_LINE>HashtableOfObject openedPkgs = new HashtableOfObject();<NEW_LINE>for (int i = 0; i < this.opensCount; i++) {<NEW_LINE>OpensStatement <MASK><NEW_LINE>if (isOpen()) {<NEW_LINE>cuScope.problemReporter().invalidOpensStatement(ref, this);<NEW_LINE>} else {<NEW_LINE>if (openedPkgs.containsKey(ref.pkgName)) {<NEW_LINE>cuScope.problemReporter().invalidPackageReference(IProblem.DuplicateOpens, ref);<NEW_LINE>} else {<NEW_LINE>openedPkgs.put(ref.pkgName, ref);<NEW_LINE>ref.resolve(cuScope);<NEW_LINE>}<NEW_LINE>char[][] targets = null;<NEW_LINE>if (ref.targets != null) {<NEW_LINE>targets = new char[ref.targets.length][];<NEW_LINE>for (int j = 0; j < targets.length; j++) targets[j] = ref.targets[j].moduleName;<NEW_LINE>}<NEW_LINE>this.binding.addResolvedOpens(ref.resolvedPackage, targets);<NEW_LINE>}<NEW_LINE>}<NEW_LINE>} | ref = this.opens[i]; |
899,071 | public com.amazonaws.services.migrationhubconfig.model.ServiceUnavailableException unmarshallFromContext(JsonUnmarshallerContext context) throws Exception {<NEW_LINE>com.amazonaws.services.migrationhubconfig.model.ServiceUnavailableException serviceUnavailableException = new com.amazonaws.services.migrationhubconfig.model.ServiceUnavailableException(null);<NEW_LINE>int originalDepth = context.getCurrentDepth();<NEW_LINE><MASK><NEW_LINE>int targetDepth = originalDepth + 1;<NEW_LINE>JsonToken token = context.getCurrentToken();<NEW_LINE>if (token == null)<NEW_LINE>token = context.nextToken();<NEW_LINE>if (token == VALUE_NULL) {<NEW_LINE>return null;<NEW_LINE>}<NEW_LINE>while (true) {<NEW_LINE>if (token == null)<NEW_LINE>break;<NEW_LINE>if (token == FIELD_NAME || token == START_OBJECT) {<NEW_LINE>} else if (token == END_ARRAY || token == END_OBJECT) {<NEW_LINE>if (context.getLastParsedParentElement() == null || context.getLastParsedParentElement().equals(currentParentElement)) {<NEW_LINE>if (context.getCurrentDepth() <= originalDepth)<NEW_LINE>break;<NEW_LINE>}<NEW_LINE>}<NEW_LINE>token = context.nextToken();<NEW_LINE>}<NEW_LINE>return serviceUnavailableException;<NEW_LINE>} | String currentParentElement = context.getCurrentParentElement(); |
654,205 | private void scheduleRecurringTransaction(String transactionUID) {<NEW_LINE>ScheduledActionDbAdapter scheduledActionDbAdapter = ScheduledActionDbAdapter.getInstance();<NEW_LINE>Recurrence recurrence = RecurrenceParser.parse(mEventRecurrence);<NEW_LINE>ScheduledAction scheduledAction = new ScheduledAction(ScheduledAction.ActionType.TRANSACTION);<NEW_LINE>scheduledAction.setRecurrence(recurrence);<NEW_LINE>String scheduledActionUID = getArguments().getString(UxArgument.SCHEDULED_ACTION_UID);<NEW_LINE>if (scheduledActionUID != null) {<NEW_LINE>// if we are editing an existing schedule<NEW_LINE>if (recurrence == null) {<NEW_LINE>scheduledActionDbAdapter.deleteRecord(scheduledActionUID);<NEW_LINE>} else {<NEW_LINE>scheduledAction.setUID(scheduledActionUID);<NEW_LINE>scheduledActionDbAdapter.updateRecurrenceAttributes(scheduledAction);<NEW_LINE>Toast.makeText(getActivity(), R.string.toast_updated_transaction_recurring_schedule, <MASK><NEW_LINE>}<NEW_LINE>} else {<NEW_LINE>if (recurrence != null) {<NEW_LINE>scheduledAction.setActionUID(transactionUID);<NEW_LINE>scheduledActionDbAdapter.addRecord(scheduledAction, DatabaseAdapter.UpdateMethod.replace);<NEW_LINE>Toast.makeText(getActivity(), R.string.toast_scheduled_recurring_transaction, Toast.LENGTH_SHORT).show();<NEW_LINE>}<NEW_LINE>}<NEW_LINE>} | Toast.LENGTH_SHORT).show(); |
699,951 | protected void selectionBoxAction(final Rectangle rect, final boolean shiftMode) {<NEW_LINE>m_graph.getGraph().firePreEvent();<NEW_LINE>final NodeList selectedNodes = new NodeList();<NEW_LINE>for (final NodeCursor node = m_graph.getGraph().nodes(); node.ok(); node.next()) {<NEW_LINE>final NodeType zyNode = m_graph.getNode(node.node());<NEW_LINE>if ((zyNode == null) || (zyNode instanceof ZyProximityNode<?>)) {<NEW_LINE>continue;<NEW_LINE>}<NEW_LINE>if (belongsToSelection(node.node(), rect)) {<NEW_LINE>selectedNodes.add(node.node());<NEW_LINE>}<NEW_LINE>}<NEW_LINE>if (((getLastDragEvent().getModifiersEx() & InputEvent.CTRL_DOWN_MASK) == 0) && ((getLastDragEvent().getModifiersEx() & InputEvent.SHIFT_DOWN_MASK) == 0)) {<NEW_LINE>m_graph<MASK><NEW_LINE>}<NEW_LINE>for (final Object nodeObject : selectedNodes) {<NEW_LINE>final Node node = (Node) nodeObject;<NEW_LINE>m_graph.getGraph().setSelected(node, true);<NEW_LINE>}<NEW_LINE>for (final EdgeCursor ec = m_graph.getGraph().selectedEdges(); ec.ok(); ec.next()) {<NEW_LINE>final Edge e = ec.edge();<NEW_LINE>final Node src = e.source();<NEW_LINE>final Node dst = e.target();<NEW_LINE>if (!m_graph.getGraph().getRealizer(src).isSelected() && !m_graph.getGraph().getRealizer(dst).isSelected()) {<NEW_LINE>m_graph.getGraph().getRealizer(e).setSelected(false);<NEW_LINE>}<NEW_LINE>}<NEW_LINE>m_graph.getGraph().firePostEvent();<NEW_LINE>m_graph.getGraph().updateViews();<NEW_LINE>} | .getGraph().unselectAll(); |
1,781,399 | private GeneratorExpressionLoop generatorExpressionLoop() throws IOException {<NEW_LINE>if (nextToken() != Token.FOR)<NEW_LINE>codeBug();<NEW_LINE>int pos = ts.tokenBeg;<NEW_LINE>int lp = -1, rp = -1, inPos = -1;<NEW_LINE>GeneratorExpressionLoop pn = new GeneratorExpressionLoop(pos);<NEW_LINE>pushScope(pn);<NEW_LINE>try {<NEW_LINE>if (mustMatchToken(Token.LP, "msg.no.paren.for", true)) {<NEW_LINE>lp = ts.tokenBeg - pos;<NEW_LINE>}<NEW_LINE>AstNode iter = null;<NEW_LINE>switch(peekToken()) {<NEW_LINE>case Token.LB:<NEW_LINE>case Token.LC:<NEW_LINE>// handle destructuring assignment<NEW_LINE>iter = destructuringPrimaryExpr();<NEW_LINE>markDestructuring(iter);<NEW_LINE>break;<NEW_LINE>case Token.NAME:<NEW_LINE>consumeToken();<NEW_LINE>iter = createNameNode();<NEW_LINE>break;<NEW_LINE>default:<NEW_LINE>reportError("msg.bad.var");<NEW_LINE>}<NEW_LINE>// Define as a let since we want the scope of the variable to<NEW_LINE>// be restricted to the array comprehension<NEW_LINE>if (iter.getType() == Token.NAME) {<NEW_LINE>defineSymbol(Token.LET, ts.getString(), true);<NEW_LINE>}<NEW_LINE>if (mustMatchToken(Token.IN, "msg.in.after.for.name", true))<NEW_LINE>inPos = ts.tokenBeg - pos;<NEW_LINE>AstNode obj = expr();<NEW_LINE>if (mustMatchToken(Token.RP, "msg.no.paren.for.ctrl", true))<NEW_LINE>rp = ts.tokenBeg - pos;<NEW_LINE>pn.<MASK><NEW_LINE>pn.setIterator(iter);<NEW_LINE>pn.setIteratedObject(obj);<NEW_LINE>pn.setInPosition(inPos);<NEW_LINE>pn.setParens(lp, rp);<NEW_LINE>return pn;<NEW_LINE>} finally {<NEW_LINE>popScope();<NEW_LINE>}<NEW_LINE>} | setLength(ts.tokenEnd - pos); |
1,769,611 | public static void fetchViewers(final SiteModel site, final int offset, final FetchViewersCallback callback) {<NEW_LINE>RestRequest.Listener listener = new RestRequest.Listener() {<NEW_LINE><NEW_LINE>@Override<NEW_LINE>public void onResponse(JSONObject jsonObject) {<NEW_LINE>if (jsonObject != null && callback != null) {<NEW_LINE>try {<NEW_LINE>JSONArray <MASK><NEW_LINE>List<Person> people = peopleListFromJSON(jsonArray, site.getId(), Person.PersonType.VIEWER);<NEW_LINE>int numberOfUsers = jsonObject.optInt("found");<NEW_LINE>boolean isEndOfList = (people.size() + offset) >= numberOfUsers;<NEW_LINE>callback.onSuccess(people, isEndOfList);<NEW_LINE>} catch (JSONException e) {<NEW_LINE>AppLog.e(T.API, "JSON exception occurred while parsing the response for " + "sites/%s/viewers: " + e);<NEW_LINE>callback.onError();<NEW_LINE>}<NEW_LINE>}<NEW_LINE>}<NEW_LINE>};<NEW_LINE>RestRequest.ErrorListener errorListener = new RestRequest.ErrorListener() {<NEW_LINE><NEW_LINE>@Override<NEW_LINE>public void onErrorResponse(VolleyError volleyError) {<NEW_LINE>AppLog.e(T.API, volleyError);<NEW_LINE>if (callback != null) {<NEW_LINE>callback.onError();<NEW_LINE>}<NEW_LINE>}<NEW_LINE>};<NEW_LINE>int page = (offset / FETCH_LIMIT) + 1;<NEW_LINE>Map<String, String> params = new HashMap<>();<NEW_LINE>params.put("number", Integer.toString(FETCH_LIMIT));<NEW_LINE>params.put("page", Integer.toString(page));<NEW_LINE>String path = String.format(Locale.US, "sites/%d/viewers", site.getSiteId());<NEW_LINE>WordPress.getRestClientUtilsV1_1().get(path, params, null, listener, errorListener);<NEW_LINE>} | jsonArray = jsonObject.getJSONArray("viewers"); |
1,699,263 | public void deserialize(ByteBuffer buffer) throws IllegalPathException {<NEW_LINE>this.devicePath = new PartialPath(readString(buffer));<NEW_LINE>int measurementSize = buffer.getInt();<NEW_LINE>this.measurements = new String[measurementSize];<NEW_LINE>for (int i = 0; i < measurementSize; i++) {<NEW_LINE>measurements[i] = readString(buffer);<NEW_LINE>}<NEW_LINE>int dataTypeSize = buffer.getInt();<NEW_LINE>this.dataTypes = new TSDataType[dataTypeSize];<NEW_LINE>for (int i = 0; i < dataTypeSize; i++) {<NEW_LINE>dataTypes[i] = TSDataType.deserialize(buffer.get());<NEW_LINE>}<NEW_LINE><MASK><NEW_LINE>rowCount = rows;<NEW_LINE>this.times = new long[rows];<NEW_LINE>times = QueryDataSetUtils.readTimesFromBuffer(buffer, rows);<NEW_LINE>boolean hasBitMaps = BytesUtils.byteToBool(buffer.get());<NEW_LINE>if (hasBitMaps) {<NEW_LINE>bitMaps = QueryDataSetUtils.readBitMapsFromBuffer(buffer, dataTypeSize, rows);<NEW_LINE>}<NEW_LINE>columns = QueryDataSetUtils.readValuesFromBuffer(buffer, dataTypes, dataTypeSize, rows);<NEW_LINE>this.index = buffer.getLong();<NEW_LINE>this.isAligned = buffer.get() == 1;<NEW_LINE>} | int rows = buffer.getInt(); |
910,752 | private void addAllStaticMemberNames(final Env env) {<NEW_LINE>String prefix = env.getPrefix();<NEW_LINE>if (prefix != null && prefix.length() > 0) {<NEW_LINE>CompilationController controller = env.getController();<NEW_LINE>Set<? extends Element> excludes = env.getExcludes();<NEW_LINE>Set<ElementHandle<Element>> excludeHandles = null;<NEW_LINE>if (excludes != null) {<NEW_LINE>excludeHandles = new HashSet<<MASK><NEW_LINE>for (Element el : excludes) {<NEW_LINE>excludeHandles.add(ElementHandle.create(el));<NEW_LINE>}<NEW_LINE>}<NEW_LINE>ClassIndex.NameKind kind = Utilities.isCaseSensitive() ? ClassIndex.NameKind.PREFIX : ClassIndex.NameKind.CASE_INSENSITIVE_PREFIX;<NEW_LINE>Iterable<Symbols> declaredSymbols = controller.getClasspathInfo().getClassIndex().getDeclaredSymbols(prefix, kind, EnumSet.allOf(ClassIndex.SearchScope.class));<NEW_LINE>for (Symbols symbols : declaredSymbols) {<NEW_LINE>if (Utilities.isExcluded(symbols.getEnclosingType().getQualifiedName()) || excludeHandles != null && excludeHandles.contains(symbols.getEnclosingType()) || isAnnonInner(symbols.getEnclosingType())) {<NEW_LINE>continue;<NEW_LINE>}<NEW_LINE>for (String name : symbols.getSymbols()) {<NEW_LINE>if (!Utilities.isExcludeMethods() || !Utilities.isExcluded(symbols.getEnclosingType().getQualifiedName() + '.' + name)) {<NEW_LINE>results.add(itemFactory.createStaticMemberItem(symbols.getEnclosingType(), name, anchorOffset, env.addSemicolon(), env.getReferencesCount(), controller.getSnapshot().getSource()));<NEW_LINE>}<NEW_LINE>}<NEW_LINE>}<NEW_LINE>}<NEW_LINE>} | >(excludes.size()); |
568,371 | final GenerateCredentialReportResult executeGenerateCredentialReport(GenerateCredentialReportRequest generateCredentialReportRequest) {<NEW_LINE>ExecutionContext executionContext = createExecutionContext(generateCredentialReportRequest);<NEW_LINE>AWSRequestMetrics awsRequestMetrics = executionContext.getAwsRequestMetrics();<NEW_LINE>awsRequestMetrics.startEvent(Field.ClientExecuteTime);<NEW_LINE>Request<GenerateCredentialReportRequest> request = null;<NEW_LINE>Response<GenerateCredentialReportResult> response = null;<NEW_LINE>try {<NEW_LINE>awsRequestMetrics.startEvent(Field.RequestMarshallTime);<NEW_LINE>try {<NEW_LINE>request = new GenerateCredentialReportRequestMarshaller().marshall(super.beforeMarshalling(generateCredentialReportRequest));<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, "IAM");<NEW_LINE>request.addHandlerContext(HandlerContextKey.OPERATION_NAME, "GenerateCredentialReport");<NEW_LINE>request.<MASK><NEW_LINE>} finally {<NEW_LINE>awsRequestMetrics.endEvent(Field.RequestMarshallTime);<NEW_LINE>}<NEW_LINE>StaxResponseHandler<GenerateCredentialReportResult> responseHandler = new StaxResponseHandler<GenerateCredentialReportResult>(new GenerateCredentialReportResultStaxUnmarshaller());<NEW_LINE>response = invoke(request, responseHandler, executionContext);<NEW_LINE>return response.getAwsResponse();<NEW_LINE>} finally {<NEW_LINE>endClientExecution(awsRequestMetrics, request, response);<NEW_LINE>}<NEW_LINE>} | addHandlerContext(HandlerContextKey.ADVANCED_CONFIG, advancedConfig); |
1,532,952 | public ListThingTypesResult listThingTypes(ListThingTypesRequest listThingTypesRequest) throws AmazonServiceException, AmazonClientException {<NEW_LINE>ExecutionContext executionContext = createExecutionContext(listThingTypesRequest);<NEW_LINE>AWSRequestMetrics awsRequestMetrics = executionContext.getAwsRequestMetrics();<NEW_LINE><MASK><NEW_LINE>Request<ListThingTypesRequest> request = null;<NEW_LINE>Response<ListThingTypesResult> response = null;<NEW_LINE>try {<NEW_LINE>awsRequestMetrics.startEvent(Field.RequestMarshallTime);<NEW_LINE>try {<NEW_LINE>request = new ListThingTypesRequestMarshaller().marshall(listThingTypesRequest);<NEW_LINE>// Binds the request metrics to the current request.<NEW_LINE>request.setAWSRequestMetrics(awsRequestMetrics);<NEW_LINE>} finally {<NEW_LINE>awsRequestMetrics.endEvent(Field.RequestMarshallTime);<NEW_LINE>}<NEW_LINE>Unmarshaller<ListThingTypesResult, JsonUnmarshallerContext> unmarshaller = new ListThingTypesResultJsonUnmarshaller();<NEW_LINE>JsonResponseHandler<ListThingTypesResult> responseHandler = new JsonResponseHandler<ListThingTypesResult>(unmarshaller);<NEW_LINE>response = invoke(request, responseHandler, executionContext);<NEW_LINE>return response.getAwsResponse();<NEW_LINE>} finally {<NEW_LINE>awsRequestMetrics.endEvent(Field.ClientExecuteTime);<NEW_LINE>endClientExecution(awsRequestMetrics, request, response, LOGGING_AWS_REQUEST_METRIC);<NEW_LINE>}<NEW_LINE>} | awsRequestMetrics.startEvent(Field.ClientExecuteTime); |
1,346,460 | private void reserveCapacityWithChecking(String hostUuid, long requestCpu, long requestMemory) {<NEW_LINE>HostCapacityUpdater updater = new HostCapacityUpdater(hostUuid);<NEW_LINE>HostVO host = dbf.findByUuid(hostUuid, HostVO.class);<NEW_LINE>HostReservedCapacityExtensionPoint ext = exts.get(host.getHypervisorType());<NEW_LINE>ReservedHostCapacity ret = new ReservedHostCapacity();<NEW_LINE>if (ext != null) {<NEW_LINE>ReservedHostCapacity extHc = ext.getReservedHostCapacity(host.getUuid());<NEW_LINE>ret.setReservedMemoryCapacity(extHc.getReservedMemoryCapacity());<NEW_LINE>ret.<MASK><NEW_LINE>} else {<NEW_LINE>ret.setReservedCpuCapacity(0);<NEW_LINE>ret.setReservedMemoryCapacity(0);<NEW_LINE>}<NEW_LINE>updater.run(cap -> {<NEW_LINE>long availCpu = cap.getAvailableCpu() - requestCpu;<NEW_LINE>if (requestCpu != 0 && availCpu < 0) {<NEW_LINE>throw new UnableToReserveHostCapacityException(String.format("no enough CPU[%s] on the host[uuid:%s]", requestCpu, hostUuid));<NEW_LINE>}<NEW_LINE>cap.setAvailableCpu(availCpu);<NEW_LINE>long availMemory = cap.getAvailableMemory() - ratioMgr.calculateMemoryByRatio(hostUuid, requestMemory);<NEW_LINE>if (requestMemory != 0 && availMemory - ret.getReservedMemoryCapacity() < 0) {<NEW_LINE>throw new UnableToReserveHostCapacityException(String.format("no enough memory[%s] on the host[uuid:%s]", requestMemory, hostUuid));<NEW_LINE>}<NEW_LINE>cap.setAvailableMemory(availMemory);<NEW_LINE>return cap;<NEW_LINE>});<NEW_LINE>} | setReservedCpuCapacity(extHc.getReservedCpuCapacity()); |
495,851 | public static void finalizeOutputMaySortMayRStreamCodegen(CodegenBlock block, CodegenExpressionRef newEvents, CodegenExpressionRef newEventsSortKey, CodegenExpressionRef oldEvents, CodegenExpressionRef oldEventsSortKey, boolean selectRStream, boolean hasOrderBy) {<NEW_LINE>block.declareVar(EventBean.EPTYPEARRAY, "newEventsArr", staticMethod(CollectionUtil.class, METHOD_TOARRAYNULLFOREMPTYEVENTS, newEvents)).declareVar(EventBean.EPTYPEARRAY, "oldEventsArr", selectRStream ? staticMethod(CollectionUtil.class, METHOD_TOARRAYNULLFOREMPTYEVENTS, oldEvents) : constantNull());<NEW_LINE>if (hasOrderBy) {<NEW_LINE>block.declareVar(EPTypePremade.OBJECTARRAY.getEPType(), "sortKeysNew", staticMethod(CollectionUtil.class, METHOD_TOARRAYNULLFOREMPTYOBJECTS, newEventsSortKey)).assignRef("newEventsArr", exprDotMethod(MEMBER_ORDERBYPROCESSOR, "sortWOrderKeys", ref("newEventsArr"), <MASK><NEW_LINE>if (selectRStream) {<NEW_LINE>block.declareVar(EPTypePremade.OBJECTARRAY.getEPType(), "sortKeysOld", staticMethod(CollectionUtil.class, METHOD_TOARRAYNULLFOREMPTYOBJECTS, oldEventsSortKey)).assignRef("oldEventsArr", exprDotMethod(MEMBER_ORDERBYPROCESSOR, "sortWOrderKeys", ref("oldEventsArr"), ref("sortKeysOld"), MEMBER_EXPREVALCONTEXT));<NEW_LINE>}<NEW_LINE>}<NEW_LINE>block.returnMethodOrBlock(staticMethod(ResultSetProcessorUtil.class, METHOD_TOPAIRNULLIFALLNULL, ref("newEventsArr"), ref("oldEventsArr")));<NEW_LINE>} | ref("sortKeysNew"), MEMBER_EXPREVALCONTEXT)); |
377,889 | public static ListInboundOrderSKUTagsResponse unmarshall(ListInboundOrderSKUTagsResponse listInboundOrderSKUTagsResponse, UnmarshallerContext _ctx) {<NEW_LINE>listInboundOrderSKUTagsResponse.setRequestId(_ctx.stringValue("ListInboundOrderSKUTagsResponse.RequestId"));<NEW_LINE>listInboundOrderSKUTagsResponse.setPageSize(_ctx.integerValue("ListInboundOrderSKUTagsResponse.PageSize"));<NEW_LINE>listInboundOrderSKUTagsResponse.setTotalCount(_ctx.integerValue("ListInboundOrderSKUTagsResponse.TotalCount"));<NEW_LINE>listInboundOrderSKUTagsResponse.setPageNumber(_ctx.integerValue("ListInboundOrderSKUTagsResponse.PageNumber"));<NEW_LINE>listInboundOrderSKUTagsResponse.setSuccess(_ctx.booleanValue("ListInboundOrderSKUTagsResponse.Success"));<NEW_LINE>List<InboundOrderSkuTagBiz> skuTags = new ArrayList<InboundOrderSkuTagBiz>();<NEW_LINE>for (int i = 0; i < _ctx.lengthValue("ListInboundOrderSKUTagsResponse.SkuTags.Length"); i++) {<NEW_LINE>InboundOrderSkuTagBiz inboundOrderSkuTagBiz = new InboundOrderSkuTagBiz();<NEW_LINE>inboundOrderSkuTagBiz.setBarcode(_ctx.stringValue("ListInboundOrderSKUTagsResponse.SkuTags[" + i + "].Barcode"));<NEW_LINE>inboundOrderSkuTagBiz.setCaseId(_ctx.stringValue("ListInboundOrderSKUTagsResponse.SkuTags[" + i + "].CaseId"));<NEW_LINE>inboundOrderSkuTagBiz.setTagValue(_ctx.stringValue("ListInboundOrderSKUTagsResponse.SkuTags[" + i + "].TagValue"));<NEW_LINE>inboundOrderSkuTagBiz.setCaseCode(_ctx.stringValue("ListInboundOrderSKUTagsResponse.SkuTags[" + i + "].CaseCode"));<NEW_LINE>inboundOrderSkuTagBiz.setSKUId(_ctx.stringValue<MASK><NEW_LINE>inboundOrderSkuTagBiz.setSKUName(_ctx.stringValue("ListInboundOrderSKUTagsResponse.SkuTags[" + i + "].SKUName"));<NEW_LINE>inboundOrderSkuTagBiz.setStyleId(_ctx.stringValue("ListInboundOrderSKUTagsResponse.SkuTags[" + i + "].StyleId"));<NEW_LINE>inboundOrderSkuTagBiz.setStyleCode(_ctx.stringValue("ListInboundOrderSKUTagsResponse.SkuTags[" + i + "].StyleCode"));<NEW_LINE>inboundOrderSkuTagBiz.setStyleName(_ctx.stringValue("ListInboundOrderSKUTagsResponse.SkuTags[" + i + "].StyleName"));<NEW_LINE>inboundOrderSkuTagBiz.setSizeId(_ctx.stringValue("ListInboundOrderSKUTagsResponse.SkuTags[" + i + "].SizeId"));<NEW_LINE>inboundOrderSkuTagBiz.setSizeCode(_ctx.stringValue("ListInboundOrderSKUTagsResponse.SkuTags[" + i + "].SizeCode"));<NEW_LINE>inboundOrderSkuTagBiz.setSizeName(_ctx.stringValue("ListInboundOrderSKUTagsResponse.SkuTags[" + i + "].SizeName"));<NEW_LINE>inboundOrderSkuTagBiz.setColorId(_ctx.stringValue("ListInboundOrderSKUTagsResponse.SkuTags[" + i + "].ColorId"));<NEW_LINE>inboundOrderSkuTagBiz.setColorCode(_ctx.stringValue("ListInboundOrderSKUTagsResponse.SkuTags[" + i + "].ColorCode"));<NEW_LINE>inboundOrderSkuTagBiz.setColorName(_ctx.stringValue("ListInboundOrderSKUTagsResponse.SkuTags[" + i + "].ColorName"));<NEW_LINE>skuTags.add(inboundOrderSkuTagBiz);<NEW_LINE>}<NEW_LINE>listInboundOrderSKUTagsResponse.setSkuTags(skuTags);<NEW_LINE>return listInboundOrderSKUTagsResponse;<NEW_LINE>} | ("ListInboundOrderSKUTagsResponse.SkuTags[" + i + "].SKUId")); |
146,364 | protected void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {<NEW_LINE>// $NON-NLS-1$<NEW_LINE>logger.debug("Refreshing authentication token.");<NEW_LINE>HttpSession session = request.getSession();<NEW_LINE>StudioConfigAuth auth = (StudioConfigAuth) <MASK><NEW_LINE>if (auth == null) {<NEW_LINE>logger.error("Authentication 'token' is null (not authenticated?)");<NEW_LINE>response.sendError(403);<NEW_LINE>return;<NEW_LINE>}<NEW_LINE>ObjectMapper mapper = new ObjectMapper();<NEW_LINE>// $NON-NLS-1$<NEW_LINE>response.setContentType("application/json");<NEW_LINE>// $NON-NLS-1$<NEW_LINE>response.setDateHeader("Date", System.currentTimeMillis());<NEW_LINE>// $NON-NLS-1$<NEW_LINE>response.setDateHeader("Expires", System.currentTimeMillis() - 86400000L);<NEW_LINE>// $NON-NLS-1$ //$NON-NLS-2$<NEW_LINE>response.setHeader("Pragma", "no-cache");<NEW_LINE>// $NON-NLS-1$ //$NON-NLS-2$<NEW_LINE>response.setHeader("Cache-control", "no-cache, no-store, must-revalidate");<NEW_LINE>mapper.writer().writeValue(response.getOutputStream(), auth);<NEW_LINE>} | session.getAttribute(RequestAttributeKeys.AUTH_KEY); |
698,926 | public Map<String, Object> saveFileAction(String selectedItem, String wfActionAssign, String wfActionId, String wfActionComments, String wfConId, String wfPublishDate, String wfPublishTime, String wfExpireDate, String wfExpireTime, String wfNeverExpire, String whereToSend, String forcePush, String pathToMove) throws DotSecurityException, ServletException {<NEW_LINE>WebContext ctx = WebContextFactory.get();<NEW_LINE>User user = getUser(ctx.getHttpServletRequest());<NEW_LINE>Contentlet contentlet = null;<NEW_LINE>Map<String, Object> result = new HashMap<String, Object>();<NEW_LINE>WorkflowAPI wapi = APILocator.getWorkflowAPI();<NEW_LINE>try {<NEW_LINE>WorkflowAction action = wapi.findAction(wfActionId, user);<NEW_LINE>if (action == null) {<NEW_LINE>throw new ServletException("No such workflow action");<NEW_LINE>}<NEW_LINE>contentlet = APILocator.getContentletAPI().find(wfConId, user, false);<NEW_LINE>contentlet.setStringProperty("wfActionId", action.getId());<NEW_LINE><MASK><NEW_LINE>contentlet.setStringProperty("wfActionAssign", wfActionAssign);<NEW_LINE>contentlet.setStringProperty("wfPublishDate", wfPublishDate);<NEW_LINE>contentlet.setStringProperty("wfPublishTime", wfPublishTime);<NEW_LINE>contentlet.setStringProperty("wfExpireDate", wfExpireDate);<NEW_LINE>contentlet.setStringProperty("wfExpireTime", wfExpireTime);<NEW_LINE>contentlet.setStringProperty("wfNeverExpire", wfNeverExpire);<NEW_LINE>contentlet.setStringProperty("whereToSend", whereToSend);<NEW_LINE>contentlet.setStringProperty("forcePush", forcePush);<NEW_LINE>if (UtilMethods.isSet(pathToMove)) {<NEW_LINE>contentlet.setProperty(Contentlet.PATH_TO_MOVE, pathToMove);<NEW_LINE>}<NEW_LINE>contentlet.setTags();<NEW_LINE>wapi.fireWorkflowNoCheckin(contentlet, user);<NEW_LINE>result.put("status", "success");<NEW_LINE>result.put("message", UtilMethods.escapeSingleQuotes(LanguageUtil.get(user, "Workflow-executed")));<NEW_LINE>} catch (Exception e) {<NEW_LINE>Logger.error(BrowserAjax.class, e.getMessage(), e);<NEW_LINE>result.put("status", "error");<NEW_LINE>try {<NEW_LINE>result.put("message", UtilMethods.escapeSingleQuotes(LanguageUtil.get(user, "Workflow-action-execution-error") + " " + e.getMessage()));<NEW_LINE>} catch (LanguageException le) {<NEW_LINE>Logger.error(BrowserAjax.class, le.getMessage(), le);<NEW_LINE>}<NEW_LINE>}<NEW_LINE>return result;<NEW_LINE>} | contentlet.setStringProperty("wfActionComments", wfActionComments); |
355,943 | private InventoryLineHU syncQtyFromInventoryLineToHU(@NonNull final InventoryLine inventoryLine, @NonNull final InventoryLineHU inventoryLineHU) {<NEW_LINE>final <MASK><NEW_LINE>if (qtyCountMinusBooked.signum() == 0) {<NEW_LINE>return inventoryLineHU;<NEW_LINE>}<NEW_LINE>final ProductId productId = inventoryLine.getProductId();<NEW_LINE>final I_M_InventoryLine inventoryLineRecord = inventoryRepository.getInventoryLineRecordFor(inventoryLine);<NEW_LINE>final IAllocationSource source;<NEW_LINE>final IAllocationDestination destination;<NEW_LINE>final Quantity qtyToTransfer;<NEW_LINE>//<NEW_LINE>// Case: HU has less than counted<NEW_LINE>// => increase HU qty; source=inventoryLine, dest=HU<NEW_LINE>if (qtyCountMinusBooked.signum() > 0) {<NEW_LINE>qtyToTransfer = qtyCountMinusBooked;<NEW_LINE>source = new GenericAllocationSourceDestination(new PlainProductStorage(productId, qtyToTransfer), inventoryLineRecord);<NEW_LINE>if (inventoryLineHU.getHuId() == null) {<NEW_LINE>// TODO handle when inventoryLine.getM_HU_PI_Item_Product_ID() is set<NEW_LINE>destination = HUProducerDestination.ofVirtualPI().setHUStatus(X_M_HU.HUSTATUS_Active).setLocatorId(inventoryLine.getLocatorId());<NEW_LINE>} else {<NEW_LINE>final I_M_HU hu = handlingUnitsDAO.getById(inventoryLineHU.getHuId());<NEW_LINE>destination = HUListAllocationSourceDestination.of(hu, AllocationStrategyType.UNIFORM);<NEW_LINE>}<NEW_LINE>} else //<NEW_LINE>// Case: HU has more than counted<NEW_LINE>// => decrease HU qty; source=HU; dest=inventoryLine<NEW_LINE>// qtyCountNotBooked < 0<NEW_LINE>{<NEW_LINE>qtyToTransfer = qtyCountMinusBooked.negate();<NEW_LINE>if (inventoryLineHU.getHuId() == null) {<NEW_LINE>throw new AdempiereException("HU field shall be set when Qty Count is less than Booked for " + inventoryLine + ", qtyCountMinusBooked=" + qtyCountMinusBooked);<NEW_LINE>} else {<NEW_LINE>final I_M_HU hu = handlingUnitsDAO.getById(inventoryLineHU.getHuId());<NEW_LINE>source = HUListAllocationSourceDestination.of(hu, AllocationStrategyType.UNIFORM).setDestroyEmptyHUs(true);<NEW_LINE>}<NEW_LINE>destination = new GenericAllocationSourceDestination(new PlainProductStorage(productId, qtyToTransfer), inventoryLineRecord);<NEW_LINE>}<NEW_LINE>final IContextAware contextAware = InterfaceWrapperHelper.getContextAware(inventoryLineRecord);<NEW_LINE>final IMutableHUContext huContextwithOrgId = huContextFactory.createMutableHUContext(contextAware);<NEW_LINE>HULoader.of(source, destination).load(AllocationUtils.builder().setHUContext(huContextwithOrgId).setDateAsToday().setProduct(inventoryLine.getProductId()).setQuantity(qtyToTransfer).setFromReferencedModel(inventoryLineRecord).setForceQtyAllocation(true).create());<NEW_LINE>if (inventoryLineHU.getHuId() == null) {<NEW_LINE>final HuId createdHUId = extractSingleCreatedHUId(destination);<NEW_LINE>sourceHUsService.addSourceHUMarkerIfCarringComponents(createdHUId, inventoryLine.getProductId(), inventoryLine.getLocatorId().getWarehouseId());<NEW_LINE>return inventoryLineHU.withHuId(createdHUId);<NEW_LINE>} else {<NEW_LINE>return inventoryLineHU;<NEW_LINE>}<NEW_LINE>} | Quantity qtyCountMinusBooked = inventoryLineHU.getQtyCountMinusBooked(); |
1,572,222 | private void renderWithTemplateEngineOrRaw(Context context, Result result) {<NEW_LINE>// if content type is not yet set in result we copy it over from the<NEW_LINE>// request accept header<NEW_LINE>if (result.getContentType() == null) {<NEW_LINE>if (result.supportedContentTypes().contains(context.getAcceptContentType())) {<NEW_LINE>result.contentType(context.getAcceptContentType());<NEW_LINE>} else if (result.fallbackContentType().isPresent()) {<NEW_LINE>result.contentType(result.fallbackContentType().get());<NEW_LINE>} else {<NEW_LINE>throw new BadRequestException("No idea how to handle incoming request with Accept:" + context.getAcceptContentType() + " at route " + context.getRequestPath());<NEW_LINE>}<NEW_LINE>}<NEW_LINE>// try to get a suitable rendering engine...<NEW_LINE>TemplateEngine templateEngine = templateEngineManager.getTemplateEngineForContentType(result.getContentType());<NEW_LINE>if (templateEngine != null) {<NEW_LINE>templateEngine.invoke(context, result);<NEW_LINE>} else {<NEW_LINE>throw new NinjaException(404, <MASK><NEW_LINE>}<NEW_LINE>} | "No template engine found for result content type " + result.getContentType()); |
27,944 | private View buildView(LayoutInflater inflater) {<NEW_LINE>View view = inflater.inflate(R.layout.track_selection_dialog, null);<NEW_LINE>ViewGroup root = view.findViewById(R.id.root);<NEW_LINE>trackViews = new CheckedTextView[trackGroups.length][];<NEW_LINE>for (int groupIndex = 0; groupIndex < trackGroups.length; groupIndex++) {<NEW_LINE>TrackGroup group = trackGroups.get(groupIndex);<NEW_LINE>boolean groupIsAdaptive = trackGroupsAdaptive[groupIndex];<NEW_LINE>trackViews[groupIndex] = new CheckedTextView[group.length];<NEW_LINE>for (int trackIndex = 0; trackIndex < group.length; trackIndex++) {<NEW_LINE>if (trackIndex == 0) {<NEW_LINE>root.addView(inflater.inflate(R.layout.list_divider, root, false));<NEW_LINE>}<NEW_LINE>int trackViewLayoutId = groupIsAdaptive ? android.R.layout.simple_list_item_multiple_choice <MASK><NEW_LINE>CheckedTextView trackView = (CheckedTextView) inflater.inflate(trackViewLayoutId, root, false);<NEW_LINE>trackView.setText(buildTrackName(group.getFormat(trackIndex)));<NEW_LINE>if (trackInfo.getTrackFormatSupport(rendererIndex, groupIndex, trackIndex) == RendererCapabilities.FORMAT_HANDLED) {<NEW_LINE>trackView.setFocusable(true);<NEW_LINE>trackView.setTag(Pair.create(groupIndex, trackIndex));<NEW_LINE>trackView.setOnClickListener(this);<NEW_LINE>} else {<NEW_LINE>trackView.setFocusable(false);<NEW_LINE>trackView.setEnabled(false);<NEW_LINE>}<NEW_LINE>trackViews[groupIndex][trackIndex] = trackView;<NEW_LINE>root.addView(trackView);<NEW_LINE>}<NEW_LINE>}<NEW_LINE>updateViews();<NEW_LINE>return view;<NEW_LINE>} | : android.R.layout.simple_list_item_single_choice; |
1,484,523 | public PartitionGetResult partitionGet(PartitionGetParam partParam) {<NEW_LINE>PartGetNodeAttrsParam param = (PartGetNodeAttrsParam) partParam;<NEW_LINE>ServerMatrix matrix = psContext.getMatrixStorageManager().<MASK><NEW_LINE>ServerPartition part = matrix.getPartition(partParam.getPartKey().getPartitionId());<NEW_LINE>ServerLongAnyRow row = (ServerLongAnyRow) (((RowBasedPartition) part).getRow(0));<NEW_LINE>long[] nodeIds = param.getNodeIds();<NEW_LINE>float[][] attrs = new float[nodeIds.length][];<NEW_LINE>int count = param.getCount();<NEW_LINE>Random r = new Random();<NEW_LINE>for (int i = 0; i < nodeIds.length; i++) {<NEW_LINE>long nodeId = nodeIds[i];<NEW_LINE>// Get node neighbor number<NEW_LINE>FloatArrayElement element = (FloatArrayElement) (row.get(nodeId));<NEW_LINE>if (element == null) {<NEW_LINE>attrs[i] = null;<NEW_LINE>} else {<NEW_LINE>float[] nodeAttrs = element.getData();<NEW_LINE>if (nodeAttrs == null || nodeAttrs.length == 0) {<NEW_LINE>attrs[i] = null;<NEW_LINE>} else if (count <= 0 || nodeAttrs.length <= count) {<NEW_LINE>attrs[i] = nodeAttrs;<NEW_LINE>} else {<NEW_LINE>attrs[i] = new float[count];<NEW_LINE>// If the neighbor number > count, just copy a range of neighbors to the result array, the copy position is random<NEW_LINE>int startPos = Math.abs(r.nextInt()) % nodeAttrs.length;<NEW_LINE>if (startPos + count <= nodeAttrs.length) {<NEW_LINE>System.arraycopy(nodeAttrs, startPos, attrs[i], 0, count);<NEW_LINE>} else {<NEW_LINE>System.arraycopy(nodeAttrs, startPos, attrs[i], 0, nodeAttrs.length - startPos);<NEW_LINE>System.arraycopy(nodeAttrs, 0, attrs[i], nodeAttrs.length - startPos, count - (nodeAttrs.length - startPos));<NEW_LINE>}<NEW_LINE>}<NEW_LINE>}<NEW_LINE>}<NEW_LINE>return new PartGetNodeAttrsResult(part.getPartitionKey().getPartitionId(), attrs);<NEW_LINE>} | getMatrix(partParam.getMatrixId()); |
338,532 | private void initializeLoggerForPluginId(String pluginId) {<NEW_LINE>if (alreadyInitialized(pluginId)) {<NEW_LINE>return;<NEW_LINE>}<NEW_LINE>synchronized (pluginId.intern()) {<NEW_LINE>if (alreadyInitialized(pluginId)) {<NEW_LINE>return;<NEW_LINE>}<NEW_LINE>synchronized (appenderCreationLock) {<NEW_LINE>FileAppender<ILoggingEvent> pluginAppender = getAppender(pluginId);<NEW_LINE>ch.qos.logback.classic.Logger logger = (ch.qos.logback.classic.Logger) LoggerFactory.getLogger(PLUGIN_LOGGER_PREFIX + "." + pluginId);<NEW_LINE>logger.setAdditive(false);<NEW_LINE>logger.setLevel(systemEnvironment.pluginLoggingLevel(pluginId));<NEW_LINE>logger.addAppender(pluginAppender);<NEW_LINE>if (systemEnvironment.consoleOutToStdout()) {<NEW_LINE>ConsoleAppender<ILoggingEvent> <MASK><NEW_LINE>consoleAppender.setEncoder(LogHelper.encoder("%d{ISO8601} %5p [%t] %c{1}:%L [plugin-" + pluginId + "] - %m%n"));<NEW_LINE>logger.setAdditive(false);<NEW_LINE>logger.setLevel(systemEnvironment.pluginLoggingLevel(pluginId));<NEW_LINE>consoleAppender.start();<NEW_LINE>logger.addAppender(consoleAppender);<NEW_LINE>}<NEW_LINE>loggingServiceLogger.debug("Plugin with ID: " + pluginId + " will log to: " + pluginAppender.rawFileProperty());<NEW_LINE>}<NEW_LINE>}<NEW_LINE>} | consoleAppender = new ConsoleAppender<>(); |
850,761 | private void createGui() {<NEW_LINE>final JPanel topPanel = new JPanel(new BorderLayout());<NEW_LINE>final JPanel innerTopPanel = new JPanel(new BorderLayout());<NEW_LINE>final JPanel debuggerChooserPanel = new JPanel(new BorderLayout());<NEW_LINE>debuggerChooserPanel.setBorder(new TitledBorder("Address Space Debugger"));<NEW_LINE>m_debuggerCombo = new CDebuggerComboBox(new CDebuggerComboModel(m_debuggerContainer));<NEW_LINE>m_debuggerCombo.setSelectedDebugger(m_addressSpace.getConfiguration().getDebuggerTemplate());<NEW_LINE>final JPanel debuggerComboPanel = new JPanel(new BorderLayout());<NEW_LINE>debuggerComboPanel.add(m_debuggerCombo, BorderLayout.CENTER);<NEW_LINE>debuggerChooserPanel.add(debuggerComboPanel, BorderLayout.CENTER);<NEW_LINE>innerTopPanel.add(m_stdEditPanel);<NEW_LINE>innerTopPanel.add(debuggerChooserPanel, BorderLayout.SOUTH);<NEW_LINE>topPanel.add(innerTopPanel);<NEW_LINE>final JPanel buttonPanel = new JPanel(new GridLayout(1, 2));<NEW_LINE>buttonPanel.setBorder(new EmptyBorder(0, 0, 5, 2));<NEW_LINE>buttonPanel.add(new JPanel());<NEW_LINE>buttonPanel.add(m_saveButton);<NEW_LINE>topPanel.add(buttonPanel, BorderLayout.SOUTH);<NEW_LINE>final JPanel bottomPanel = new CTablePanel<INaviModule>(m_table, new CModuleFilterCreator<MASK><NEW_LINE>bottomPanel.setBorder(m_titledBorder);<NEW_LINE>bottomPanel.add(new JScrollPane(m_table));<NEW_LINE>final JSplitPane splitPane = new JSplitPane(JSplitPane.VERTICAL_SPLIT, true, topPanel, bottomPanel);<NEW_LINE>splitPane.setOneTouchExpandable(true);<NEW_LINE>splitPane.setDividerLocation(splitPane.getMinimumDividerLocation());<NEW_LINE>splitPane.setResizeWeight(0.5);<NEW_LINE>setBorder(new EmptyBorder(0, 0, 0, 1));<NEW_LINE>add(splitPane);<NEW_LINE>} | (), new CModuleFilterHelp()); |
1,670,909 | public void run() {<NEW_LINE>try {<NEW_LINE>if (env.exception.get() != null)<NEW_LINE>return;<NEW_LINE>if (splits.size() <= 2) {<NEW_LINE>addSplits(env, <MASK><NEW_LINE>splits.forEach(s -> env.latch.countDown());<NEW_LINE>return;<NEW_LINE>}<NEW_LINE>int mid = splits.size() / 2;<NEW_LINE>// split the middle split point to ensure that child task split<NEW_LINE>// different tablets and can therefore run in parallel<NEW_LINE>addSplits(env, new TreeSet<>(splits.subList(mid, mid + 1)));<NEW_LINE>env.latch.countDown();<NEW_LINE>env.executor.execute(new SplitTask(env, splits.subList(0, mid)));<NEW_LINE>env.executor.execute(new SplitTask(env, splits.subList(mid + 1, splits.size())));<NEW_LINE>} catch (Exception t) {<NEW_LINE>env.exception.compareAndSet(null, t);<NEW_LINE>}<NEW_LINE>} | new TreeSet<>(splits)); |
1,626,591 | /*<NEW_LINE>* (non-Javadoc)<NEW_LINE>*<NEW_LINE>* @see javax.enterprise.context.spi.AlterableContext#destroy(javax.enterprise.context.spi.Contextual)<NEW_LINE>*/<NEW_LINE>@Override<NEW_LINE>public void destroy(Contextual<?> contextual) {<NEW_LINE>if (tc.isEntryEnabled())<NEW_LINE>Tr.entry(tc, "destroy(Contextual)", new Object[] { contextual, this });<NEW_LINE>final Map<String, InstanceAndContext<?>> storage = getStorage(false);<NEW_LINE>if (storage != null) {<NEW_LINE>final String contextId = getContextualId(contextual);<NEW_LINE>InstanceAndContext<?> data = this.getByContextual(storage, contextual);<NEW_LINE>if (data != null) {<NEW_LINE>storage.remove(contextId);<NEW_LINE>destroyItem(contextId, data);<NEW_LINE>}<NEW_LINE>}<NEW_LINE>if (tc.isEntryEnabled())<NEW_LINE><MASK><NEW_LINE>} | Tr.exit(tc, "destroy(Contextual)"); |
686,667 | final ListTriggersResult executeListTriggers(ListTriggersRequest listTriggersRequest) {<NEW_LINE>ExecutionContext executionContext = createExecutionContext(listTriggersRequest);<NEW_LINE>AWSRequestMetrics awsRequestMetrics = executionContext.getAwsRequestMetrics();<NEW_LINE>awsRequestMetrics.startEvent(Field.ClientExecuteTime);<NEW_LINE>Request<ListTriggersRequest> request = null;<NEW_LINE>Response<ListTriggersResult> response = null;<NEW_LINE>try {<NEW_LINE>awsRequestMetrics.startEvent(Field.RequestMarshallTime);<NEW_LINE>try {<NEW_LINE>request = new ListTriggersRequestProtocolMarshaller(protocolFactory).marshall(super.beforeMarshalling(listTriggersRequest));<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, "Glue");<NEW_LINE>request.addHandlerContext(HandlerContextKey.OPERATION_NAME, "ListTriggers");<NEW_LINE>request.addHandlerContext(HandlerContextKey.ADVANCED_CONFIG, advancedConfig);<NEW_LINE>} finally {<NEW_LINE>awsRequestMetrics.endEvent(Field.RequestMarshallTime);<NEW_LINE>}<NEW_LINE>HttpResponseHandler<AmazonWebServiceResponse<ListTriggersResult>> responseHandler = protocolFactory.createResponseHandler(new JsonOperationMetadata().withPayloadJson(true).withHasStreamingSuccessResponse(false), new ListTriggersResultJsonUnmarshaller());<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); |
142,544 | private Optional<Row> constraintsToResult(BDD constraints, RoutingPolicy policy, ConfigAtomicPredicates configAPs) {<NEW_LINE>if (constraints.isZero()) {<NEW_LINE>return Optional.empty();<NEW_LINE>} else {<NEW_LINE>BDD <MASK><NEW_LINE>Bgpv4Route inRoute = satAssignmentToInputRoute(fullModel, configAPs);<NEW_LINE>Row result = TestRoutePoliciesAnswerer.rowResultFor(policy, inRoute, _direction);<NEW_LINE>// sanity check: make sure that the accept/deny status produced by TestRoutePolicies is<NEW_LINE>// the same as what the user was asking for. if this ever fails then either TRP or SRP<NEW_LINE>// is modeling something incorrectly (or both).<NEW_LINE>// TODO: We can also take this validation further by using a variant of<NEW_LINE>// satAssignmentToInputRoute to produce the output route from our fullModel and the final<NEW_LINE>// BDDRoute from the symbolic analysis (as we used to do) and then compare that to the TRP<NEW_LINE>// result.<NEW_LINE>assert result.get(TestRoutePoliciesAnswerer.COL_ACTION, STRING).equals(_action.toString());<NEW_LINE>return Optional.of(result);<NEW_LINE>}<NEW_LINE>} | fullModel = constraintsToModel(constraints, configAPs); |
1,453,575 | public static DescribeBackupPoliciesResponse unmarshall(DescribeBackupPoliciesResponse describeBackupPoliciesResponse, UnmarshallerContext _ctx) {<NEW_LINE>describeBackupPoliciesResponse.setRequestId(_ctx.stringValue("DescribeBackupPoliciesResponse.RequestId"));<NEW_LINE>PageInfo pageInfo = new PageInfo();<NEW_LINE>pageInfo.setCount(_ctx.integerValue("DescribeBackupPoliciesResponse.PageInfo.Count"));<NEW_LINE>pageInfo.setPageSize(_ctx.integerValue("DescribeBackupPoliciesResponse.PageInfo.PageSize"));<NEW_LINE>pageInfo.setTotalCount(_ctx.integerValue("DescribeBackupPoliciesResponse.PageInfo.TotalCount"));<NEW_LINE>pageInfo.setCurrentPage(_ctx.integerValue("DescribeBackupPoliciesResponse.PageInfo.CurrentPage"));<NEW_LINE>describeBackupPoliciesResponse.setPageInfo(pageInfo);<NEW_LINE>List<BackupPolicy> policies = new ArrayList<BackupPolicy>();<NEW_LINE>for (int i = 0; i < _ctx.lengthValue("DescribeBackupPoliciesResponse.Policies.Length"); i++) {<NEW_LINE>BackupPolicy backupPolicy = new BackupPolicy();<NEW_LINE>backupPolicy.setId(_ctx.longValue("DescribeBackupPoliciesResponse.Policies[" + i + "].Id"));<NEW_LINE>backupPolicy.setName(_ctx.stringValue("DescribeBackupPoliciesResponse.Policies[" + i + "].Name"));<NEW_LINE>backupPolicy.setStatus(_ctx.stringValue("DescribeBackupPoliciesResponse.Policies[" + i + "].Status"));<NEW_LINE>backupPolicy.setPolicy(_ctx.stringValue("DescribeBackupPoliciesResponse.Policies[" + i + "].Policy"));<NEW_LINE>backupPolicy.setPolicyVersion(_ctx.stringValue("DescribeBackupPoliciesResponse.Policies[" + i + "].PolicyVersion"));<NEW_LINE>backupPolicy.setPolicyRegionId(_ctx.stringValue("DescribeBackupPoliciesResponse.Policies[" + i + "].PolicyRegionId"));<NEW_LINE>backupPolicy.setClientStatus(_ctx.stringValue("DescribeBackupPoliciesResponse.Policies[" + i + "].ClientStatus"));<NEW_LINE>backupPolicy.setClientErrorCount(_ctx.integerValue("DescribeBackupPoliciesResponse.Policies[" + i + "].ClientErrorCount"));<NEW_LINE>backupPolicy.setServiceErrorCount(_ctx.integerValue("DescribeBackupPoliciesResponse.Policies[" + i + "].ServiceErrorCount"));<NEW_LINE>backupPolicy.setHealthClientCount(_ctx.integerValue("DescribeBackupPoliciesResponse.Policies[" + i + "].HealthClientCount"));<NEW_LINE>List<String> uuidList = new ArrayList<String>();<NEW_LINE>for (int j = 0; j < _ctx.lengthValue("DescribeBackupPoliciesResponse.Policies[" + i + "].UuidList.Length"); j++) {<NEW_LINE>uuidList.add(_ctx.stringValue("DescribeBackupPoliciesResponse.Policies[" + i + "].UuidList[" + j + "]"));<NEW_LINE>}<NEW_LINE>backupPolicy.setUuidList(uuidList);<NEW_LINE>List<String> remarkedUuidList = new ArrayList<String>();<NEW_LINE>for (int j = 0; j < _ctx.lengthValue("DescribeBackupPoliciesResponse.Policies[" + i + "].RemarkedUuidList.Length"); j++) {<NEW_LINE>remarkedUuidList.add(_ctx.stringValue("DescribeBackupPoliciesResponse.Policies[" + i + "].RemarkedUuidList[" + j + "]"));<NEW_LINE>}<NEW_LINE>backupPolicy.setRemarkedUuidList(remarkedUuidList);<NEW_LINE>List<String> clientErrorUuidList = new ArrayList<String>();<NEW_LINE>for (int j = 0; j < _ctx.lengthValue("DescribeBackupPoliciesResponse.Policies[" + i + "].ClientErrorUuidList.Length"); j++) {<NEW_LINE>clientErrorUuidList.add(_ctx.stringValue("DescribeBackupPoliciesResponse.Policies[" + i + "].ClientErrorUuidList[" + j + "]"));<NEW_LINE>}<NEW_LINE>backupPolicy.setClientErrorUuidList(clientErrorUuidList);<NEW_LINE>List<String> serviceErrorUuidList = new ArrayList<String>();<NEW_LINE>for (int j = 0; j < _ctx.lengthValue("DescribeBackupPoliciesResponse.Policies[" + i + "].ServiceErrorUuidList.Length"); j++) {<NEW_LINE>serviceErrorUuidList.add(_ctx.stringValue("DescribeBackupPoliciesResponse.Policies[" + i + "].ServiceErrorUuidList[" + j + "]"));<NEW_LINE>}<NEW_LINE>backupPolicy.setServiceErrorUuidList(serviceErrorUuidList);<NEW_LINE>List<String> healthClientUuidList = new ArrayList<String>();<NEW_LINE>for (int j = 0; j < _ctx.lengthValue("DescribeBackupPoliciesResponse.Policies[" + i + "].HealthClientUuidList.Length"); j++) {<NEW_LINE>healthClientUuidList.add(_ctx.stringValue("DescribeBackupPoliciesResponse.Policies[" + i <MASK><NEW_LINE>}<NEW_LINE>backupPolicy.setHealthClientUuidList(healthClientUuidList);<NEW_LINE>policies.add(backupPolicy);<NEW_LINE>}<NEW_LINE>describeBackupPoliciesResponse.setPolicies(policies);<NEW_LINE>return describeBackupPoliciesResponse;<NEW_LINE>} | + "].HealthClientUuidList[" + j + "]")); |
3,036 | public void onClick(View v) {<NEW_LINE>LayoutInflater l = context.getLayoutInflater();<NEW_LINE>View body = l.inflate(R.layout.album_grid_dialog, null, false);<NEW_LINE>GridView gridview = body.findViewById(R.id.images);<NEW_LINE>gridview.setAdapter(<MASK><NEW_LINE>final AlertDialog.Builder builder = new AlertDialog.Builder(context).setView(body);<NEW_LINE>final Dialog d = builder.create();<NEW_LINE>gridview.setOnItemClickListener(new AdapterView.OnItemClickListener() {<NEW_LINE><NEW_LINE>public void onItemClick(AdapterView<?> parent, View v, int position, long id) {<NEW_LINE>if (context instanceof Album) {<NEW_LINE>((LinearLayoutManager) ((Album) context).album.album.recyclerView.getLayoutManager()).scrollToPositionWithOffset(position + 1, context.findViewById(R.id.toolbar).getHeight());<NEW_LINE>} else {<NEW_LINE>((LinearLayoutManager) ((RecyclerView) context.findViewById(R.id.images)).getLayoutManager()).scrollToPositionWithOffset(position + 1, context.findViewById(R.id.toolbar).getHeight());<NEW_LINE>}<NEW_LINE>d.dismiss();<NEW_LINE>}<NEW_LINE>});<NEW_LINE>d.show();<NEW_LINE>} | new ImageGridAdapter(context, users)); |
111,960 | public void drawTranslate(UGraphic ug, UTranslate translate1, UTranslate translate2) {<NEW_LINE>ug = ug.apply(UTranslate.dx(x));<NEW_LINE>final FtileGeometry geo = getFtile2().calculateDimension(getStringBounder());<NEW_LINE>final Point2D p1 = new Point2D.Double(geo.getLeft(), 0);<NEW_LINE>final Point2D p2 = new Point2D.Double(geo.getLeft(), geo.getInY());<NEW_LINE>Snake snake = Snake.create(skinParam(), <MASK><NEW_LINE>if (Display.isNull(label) == false)<NEW_LINE>snake = snake.withLabel(getTextBlock(label), arrowHorizontalAlignment());<NEW_LINE>final Point2D mp1a = translate1.getTranslated(p1);<NEW_LINE>final Point2D mp2b = translate2.getTranslated(p2);<NEW_LINE>final double middle = mp1a.getY() + 4;<NEW_LINE>snake.addPoint(mp1a);<NEW_LINE>snake.addPoint(mp1a.getX(), middle);<NEW_LINE>snake.addPoint(mp2b.getX(), middle);<NEW_LINE>snake.addPoint(mp2b);<NEW_LINE>ug.draw(snake);<NEW_LINE>} | arrowColor, Arrows.asToDown()); |
1,715,584 | public String webfinger(@RequestParam("resource") String resource, @RequestParam(value = "rel", required = false) String rel, Model model) {<NEW_LINE>if (!Strings.isNullOrEmpty(rel) && !rel.equals("http://openid.net/specs/connect/1.0/issuer")) {<NEW_LINE>logger.warn("Responding to webfinger request for non-OIDC relation: " + rel);<NEW_LINE>}<NEW_LINE>if (!resource.equals(config.getIssuer())) {<NEW_LINE>// it's not the issuer directly, need to check other methods<NEW_LINE>UriComponents resourceUri = WebfingerURLNormalizer.normalizeResource(resource);<NEW_LINE>if (resourceUri != null && resourceUri.getScheme() != null && resourceUri.getScheme().equals("acct")) {<NEW_LINE>// acct: URI (email address format)<NEW_LINE>// check on email addresses first<NEW_LINE>UserInfo user = userService.getByEmailAddress(resourceUri.getUserInfo() + "@" + resourceUri.getHost());<NEW_LINE>if (user == null) {<NEW_LINE>// user wasn't found, see if the local part of the username matches, plus our issuer host<NEW_LINE>// first part is the username<NEW_LINE>user = userService.getByUsername(resourceUri.getUserInfo());<NEW_LINE>if (user != null) {<NEW_LINE>// username matched, check the host component<NEW_LINE>UriComponents issuerComponents = UriComponentsBuilder.fromHttpUrl(config.getIssuer()).build();<NEW_LINE>if (!Strings.nullToEmpty(issuerComponents.getHost()).equals(Strings.nullToEmpty(resourceUri.getHost()))) {<NEW_LINE>logger.info("Host mismatch, expected " + issuerComponents.getHost() + " got " + resourceUri.getHost());<NEW_LINE>model.addAttribute(<MASK><NEW_LINE>return HttpCodeView.VIEWNAME;<NEW_LINE>}<NEW_LINE>} else {<NEW_LINE>// if the user's still null, punt and say we didn't find them<NEW_LINE>logger.info("User not found: " + resource);<NEW_LINE>model.addAttribute(HttpCodeView.CODE, HttpStatus.NOT_FOUND);<NEW_LINE>return HttpCodeView.VIEWNAME;<NEW_LINE>}<NEW_LINE>}<NEW_LINE>} else {<NEW_LINE>logger.info("Unknown URI format: " + resource);<NEW_LINE>model.addAttribute(HttpCodeView.CODE, HttpStatus.NOT_FOUND);<NEW_LINE>return HttpCodeView.VIEWNAME;<NEW_LINE>}<NEW_LINE>}<NEW_LINE>// if we got here, then we're good, return ourselves<NEW_LINE>model.addAttribute("resource", resource);<NEW_LINE>model.addAttribute("issuer", config.getIssuer());<NEW_LINE>return "webfingerView";<NEW_LINE>} | HttpCodeView.CODE, HttpStatus.NOT_FOUND); |
1,115,672 | public List<EndpointDefinition> loadServices(final String serviceName) {<NEW_LINE>if (debug)<NEW_LINE>logger.debug("Loading Service {}", serviceName);<NEW_LINE>final CountDownLatch countDownLatch = new CountDownLatch(1);<NEW_LINE>final AtomicReference<List<EndpointDefinition>> endPointsRef = new AtomicReference<>();<NEW_LINE>final AtomicReference<Throwable> exceptionAtomicReference = new AtomicReference<>();<NEW_LINE>dnsSupport.loadServiceEndpointsByServiceName(CallbackBuilder.newCallbackBuilder().withListCallback(EndpointDefinition.class, endpointDefinitions -> {<NEW_LINE>endPointsRef.set(endpointDefinitions);<NEW_LINE>countDownLatch.countDown();<NEW_LINE>}).withErrorHandler(exceptionAtomicReference::set<MASK><NEW_LINE>try {<NEW_LINE>if (debug)<NEW_LINE>logger.debug("Waiting for load services {} {}", timeout, timeUnit);<NEW_LINE>countDownLatch.await(timeout, timeUnit);<NEW_LINE>} catch (InterruptedException e) {<NEW_LINE>throw new IllegalStateException("DNS Timeout", e);<NEW_LINE>}<NEW_LINE>if (exceptionAtomicReference.get() != null) {<NEW_LINE>logger.error("DnsServiceDiscoveryProvider.loadServices EXCEPTION", exceptionAtomicReference.get());<NEW_LINE>throw new IllegalStateException("Unable to read from DNS", exceptionAtomicReference.get());<NEW_LINE>} else {<NEW_LINE>if (debug)<NEW_LINE>logger.debug("DnsServiceDiscoveryProvider.loadServices SUCCESS");<NEW_LINE>return endPointsRef.get();<NEW_LINE>}<NEW_LINE>} | ).build(), serviceName); |
1,777,199 | public void put(ByteDataArray serializedRepresentation, int ordinal) {<NEW_LINE>if (ordinal < 0 || ordinal > ORDINAL_MASK) {<NEW_LINE>throw new IllegalArgumentException(String.format("The given ordinal %s is out of bounds and not within the closed interval [0, %s]", ordinal, ORDINAL_MASK));<NEW_LINE>}<NEW_LINE>if (size > sizeBeforeGrow) {<NEW_LINE>growKeyArray();<NEW_LINE>}<NEW_LINE>int hash = HashCodes.hashCode(serializedRepresentation);<NEW_LINE>AtomicLongArray pao = pointersAndOrdinals;<NEW_LINE>int modBitmask = pao.length() - 1;<NEW_LINE>int bucket = hash & modBitmask;<NEW_LINE>long key = pao.get(bucket);<NEW_LINE>while (key != EMPTY_BUCKET_VALUE) {<NEW_LINE>bucket = (bucket + 1) & modBitmask;<NEW_LINE>key = pao.get(bucket);<NEW_LINE>}<NEW_LINE>long pointer = byteData.length();<NEW_LINE>VarInt.writeVInt(byteData, (int) serializedRepresentation.length());<NEW_LINE>serializedRepresentation.copyTo(byteData);<NEW_LINE>if (byteData.length() > MAX_BYTE_DATA_LENGTH) {<NEW_LINE>throw new IllegalStateException(String.format("The number of bytes for the serialized representations, %s, is too large and is greater than the maximum of %s bytes", byteData<MASK><NEW_LINE>}<NEW_LINE>key = ((long) ordinal << BITS_PER_POINTER) | pointer;<NEW_LINE>size++;<NEW_LINE>pao.set(bucket, key);<NEW_LINE>} | .length(), MAX_BYTE_DATA_LENGTH)); |
1,439,968 | public void valueChange(ValueChangeEvent evt) {<NEW_LINE>WSearchEditor source = (WSearchEditor) evt.getSource();<NEW_LINE>Object value = evt.getNewValue();<NEW_LINE>log.info("Value=" + value);<NEW_LINE>if (value == null) {<NEW_LINE>return;<NEW_LINE>}<NEW_LINE>if (source.equals(fUser)) {<NEW_LINE>// fUser<NEW_LINE>if (value == null)<NEW_LINE>fTo.setText("");<NEW_LINE>if (value instanceof Integer) {<NEW_LINE>int AD_User_ID = ((Integer) value).intValue();<NEW_LINE>m_user = MUser.get(Env.getCtx(), AD_User_ID);<NEW_LINE>fTo.setValue(m_user.getEMail());<NEW_LINE>}<NEW_LINE>} else {<NEW_LINE>// fCcUser<NEW_LINE>if (value == null)<NEW_LINE>fCc.setText("");<NEW_LINE>if (value instanceof Integer) {<NEW_LINE>int AD_User_ID = ((Integer) value).intValue();<NEW_LINE>m_ccuser = MUser.get(<MASK><NEW_LINE>fCc.setValue(m_ccuser.getEMail());<NEW_LINE>}<NEW_LINE>}<NEW_LINE>return;<NEW_LINE>} | Env.getCtx(), AD_User_ID); |
627,360 | final GetCloudFrontOriginAccessIdentityConfigResult executeGetCloudFrontOriginAccessIdentityConfig(GetCloudFrontOriginAccessIdentityConfigRequest getCloudFrontOriginAccessIdentityConfigRequest) {<NEW_LINE>ExecutionContext executionContext = createExecutionContext(getCloudFrontOriginAccessIdentityConfigRequest);<NEW_LINE>AWSRequestMetrics awsRequestMetrics = executionContext.getAwsRequestMetrics();<NEW_LINE>awsRequestMetrics.startEvent(Field.ClientExecuteTime);<NEW_LINE>Request<GetCloudFrontOriginAccessIdentityConfigRequest> request = null;<NEW_LINE>Response<GetCloudFrontOriginAccessIdentityConfigResult> response = null;<NEW_LINE>try {<NEW_LINE>awsRequestMetrics.startEvent(Field.RequestMarshallTime);<NEW_LINE>try {<NEW_LINE>request = new GetCloudFrontOriginAccessIdentityConfigRequestMarshaller().marshall(super.beforeMarshalling(getCloudFrontOriginAccessIdentityConfigRequest));<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, "CloudFront");<NEW_LINE>request.addHandlerContext(HandlerContextKey.OPERATION_NAME, "GetCloudFrontOriginAccessIdentityConfig");<NEW_LINE>request.<MASK><NEW_LINE>} finally {<NEW_LINE>awsRequestMetrics.endEvent(Field.RequestMarshallTime);<NEW_LINE>}<NEW_LINE>StaxResponseHandler<GetCloudFrontOriginAccessIdentityConfigResult> responseHandler = new StaxResponseHandler<GetCloudFrontOriginAccessIdentityConfigResult>(new GetCloudFrontOriginAccessIdentityConfigResultStaxUnmarshaller());<NEW_LINE>response = invoke(request, responseHandler, executionContext);<NEW_LINE>return response.getAwsResponse();<NEW_LINE>} finally {<NEW_LINE>endClientExecution(awsRequestMetrics, request, response);<NEW_LINE>}<NEW_LINE>} | addHandlerContext(HandlerContextKey.ADVANCED_CONFIG, advancedConfig); |
472,887 | private void plantSymlinkForestWithPartialMainRepository(ImmutableList.Builder<Path> plantedSymlinks, Map<Path, Path> mainRepoLinks) throws IOException, AbruptExitException {<NEW_LINE>if (siblingRepositoryLayout) {<NEW_LINE>execroot.createDirectory();<NEW_LINE>}<NEW_LINE>for (Map.Entry<Path, Path> entry : mainRepoLinks.entrySet()) {<NEW_LINE>Path link = entry.getKey();<NEW_LINE><MASK><NEW_LINE>if (this.notSymlinkedInExecrootDirectories.contains(target.getBaseName())) {<NEW_LINE>throw new AbruptExitException(detailedSymlinkForestExitCode("Directories specified with toplevel_output_directories should be ignored and can" + " not be used as sources.", Code.TOPLEVEL_OUTDIR_USED_AS_SOURCE));<NEW_LINE>}<NEW_LINE>link.createSymbolicLink(target);<NEW_LINE>plantedSymlinks.add(link);<NEW_LINE>}<NEW_LINE>} | Path target = entry.getValue(); |
718,135 | private void handleAsynchTimeOut(SipTransaction transaction) {<NEW_LINE>if (c_logger.isTraceEntryExitEnabled()) {<NEW_LINE>c_logger.traceEntry(this, "handleAsynchTimeOut");<NEW_LINE>}<NEW_LINE>// get the tu from the original request, at this stage it is not found on the response<NEW_LINE>TransactionUserWrapper transactionUser = transaction<MASK><NEW_LINE>String callid = transaction.getOriginalRequest().getCallId();<NEW_LINE>// remove the transaction from the transaction table<NEW_LINE>if ((transaction instanceof ClientTransaction)) {<NEW_LINE>if (c_logger.isTraceDebugEnabled()) {<NEW_LINE>c_logger.traceDebug(this, "handleAsynchTimeOut", "removing transaction from table, call-id: " + callid);<NEW_LINE>}<NEW_LINE>((ClientTransaction) transaction).clearTransaction();<NEW_LINE>// remove the tuWraaper from the thread local, the async thread should not use the<NEW_LINE>// ready to invalidate mechanism<NEW_LINE>ThreadLocalStorage.cleanTuForInvalidate();<NEW_LINE>}<NEW_LINE>AsynchronousWorkTask task = AsynchronousWorkTasksManager.instance().getAsynchronousWorkTask(callid);<NEW_LINE>if (task == null) {<NEW_LINE>if (c_logger.isTraceDebugEnabled()) {<NEW_LINE>c_logger.traceDebug(this, "handleAsynchTimeOut", "Can not find AsynchronousWorkTask for call-id" + callid);<NEW_LINE>}<NEW_LINE>return;<NEW_LINE>}<NEW_LINE>try {<NEW_LINE>task.sendFailedResponse(SipServletResponse.SC_REQUEST_TIMEOUT);<NEW_LINE>} finally {<NEW_LINE>if (c_logger.isTraceDebugEnabled()) {<NEW_LINE>c_logger.traceDebug(this, "handleAsynchTimeOut", "Response is sent. Removing AsynchronousWorkTask for call-id" + callid);<NEW_LINE>}<NEW_LINE>AsynchronousWorkTasksManager.instance().removeAsynchronousWorkTask(callid);<NEW_LINE>// invalidate the Asynch sip TU<NEW_LINE>transactionUser.invalidateTU(true, true);<NEW_LINE>}<NEW_LINE>if (c_logger.isTraceEntryExitEnabled()) {<NEW_LINE>c_logger.traceExit(this, "handleAsynchTimeOut");<NEW_LINE>}<NEW_LINE>} | .getOriginalRequest().getTransactionUser(); |
1,342,311 | void beanCachePutAllDirect(Collection<EntityBean> beans) {<NEW_LINE>Map<Object, Object> natKeys = null;<NEW_LINE>if (naturalKey != null) {<NEW_LINE>natKeys = new LinkedHashMap<>();<NEW_LINE>}<NEW_LINE>Map<Object, Object> map = new LinkedHashMap<>();<NEW_LINE>for (EntityBean bean : beans) {<NEW_LINE>CachedBeanData beanData = beanExtractData(desc, bean);<NEW_LINE>String key = desc.cacheKeyForBean(bean);<NEW_LINE>map.put(key, beanData);<NEW_LINE>if (naturalKey != null) {<NEW_LINE>Object naturalKey = calculateNaturalKey(beanData);<NEW_LINE>if (naturalKey != null) {<NEW_LINE><MASK><NEW_LINE>}<NEW_LINE>}<NEW_LINE>}<NEW_LINE>if (beanLog.isDebugEnabled()) {<NEW_LINE>beanLog.debug(" MPUT {}({})", cacheName, map.keySet());<NEW_LINE>}<NEW_LINE>getBeanCache().putAll(map);<NEW_LINE>if (natKeys != null && !natKeys.isEmpty()) {<NEW_LINE>if (natLog.isDebugEnabled()) {<NEW_LINE>natLog.debug(" MPUT {}({}, {})", cacheName, naturalKey, natKeys.keySet());<NEW_LINE>}<NEW_LINE>naturalKeyCache.putAll(natKeys);<NEW_LINE>}<NEW_LINE>} | natKeys.put(naturalKey, key); |
775,558 | public Destination unmarshall(JsonUnmarshallerContext context) throws Exception {<NEW_LINE>Destination destination = new Destination();<NEW_LINE><MASK><NEW_LINE>String currentParentElement = context.getCurrentParentElement();<NEW_LINE>int targetDepth = originalDepth + 1;<NEW_LINE>JsonToken token = context.getCurrentToken();<NEW_LINE>if (token == null)<NEW_LINE>token = context.nextToken();<NEW_LINE>if (token == VALUE_NULL) {<NEW_LINE>return null;<NEW_LINE>}<NEW_LINE>while (true) {<NEW_LINE>if (token == null)<NEW_LINE>break;<NEW_LINE>if (token == FIELD_NAME || token == START_OBJECT) {<NEW_LINE>if (context.testExpression("bucketName", targetDepth)) {<NEW_LINE>context.nextToken();<NEW_LINE>destination.setBucketName(context.getUnmarshaller(String.class).unmarshall(context));<NEW_LINE>}<NEW_LINE>if (context.testExpression("keyPrefix", targetDepth)) {<NEW_LINE>context.nextToken();<NEW_LINE>destination.setKeyPrefix(context.getUnmarshaller(String.class).unmarshall(context));<NEW_LINE>}<NEW_LINE>if (context.testExpression("kmsKeyArn", targetDepth)) {<NEW_LINE>context.nextToken();<NEW_LINE>destination.setKmsKeyArn(context.getUnmarshaller(String.class).unmarshall(context));<NEW_LINE>}<NEW_LINE>} else if (token == END_ARRAY || token == END_OBJECT) {<NEW_LINE>if (context.getLastParsedParentElement() == null || context.getLastParsedParentElement().equals(currentParentElement)) {<NEW_LINE>if (context.getCurrentDepth() <= originalDepth)<NEW_LINE>break;<NEW_LINE>}<NEW_LINE>}<NEW_LINE>token = context.nextToken();<NEW_LINE>}<NEW_LINE>return destination;<NEW_LINE>} | int originalDepth = context.getCurrentDepth(); |
1,437,342 | private String prepareMessage() {<NEW_LINE>StringBuilder builder = new StringBuilder("<html>");<NEW_LINE>LayoutCodeInfoCollector notifications = myProcessor.getInfoCollector();<NEW_LINE>LOG.assertTrue(notifications != null);<NEW_LINE>if (notifications.isEmpty() && !myNoChangesDetected) {<NEW_LINE>if (myProcessChangesTextOnly) {<NEW_LINE>builder.append("No lines changed: changes since last revision are already properly formatted").append("<br>");<NEW_LINE>} else {<NEW_LINE>builder.append("No lines changed: code is already properly formatted").append("<br>");<NEW_LINE>}<NEW_LINE>} else {<NEW_LINE>if (notifications.hasReformatOrRearrangeNotification()) {<NEW_LINE>String reformatInfo = notifications.getReformatCodeNotification();<NEW_LINE>String rearrangeInfo = notifications.getRearrangeCodeNotification();<NEW_LINE>builder.append(joinWithCommaAndCapitalize(reformatInfo, rearrangeInfo));<NEW_LINE>if (myProcessChangesTextOnly) {<NEW_LINE>builder.append(" in changes since last revision");<NEW_LINE>}<NEW_LINE>builder.append("<br>");<NEW_LINE>} else if (myNoChangesDetected) {<NEW_LINE>builder.append("No lines changed: no changes since last revision").append("<br>");<NEW_LINE>}<NEW_LINE>String optimizeImportsNotification = notifications.getOptimizeImportsNotification();<NEW_LINE>if (optimizeImportsNotification != null) {<NEW_LINE>builder.append(StringUtil.capitalize(<MASK><NEW_LINE>}<NEW_LINE>}<NEW_LINE>String shortcutText = KeymapUtil.getFirstKeyboardShortcutText(ActionManager.getInstance().getAction("ShowReformatFileDialog"));<NEW_LINE>String color = ColorUtil.toHex(JBColor.gray);<NEW_LINE>builder.append("<span style='color:#").append(color).append("'>").append("<a href=''>Show</a> reformat dialog: ").append(shortcutText).append("</span>").append("</html>");<NEW_LINE>return builder.toString();<NEW_LINE>} | optimizeImportsNotification)).append("<br>"); |
89,188 | final PutAttributesResult executePutAttributes(PutAttributesRequest putAttributesRequest) {<NEW_LINE>ExecutionContext executionContext = createExecutionContext(putAttributesRequest);<NEW_LINE>AWSRequestMetrics awsRequestMetrics = executionContext.getAwsRequestMetrics();<NEW_LINE>awsRequestMetrics.startEvent(Field.ClientExecuteTime);<NEW_LINE>Request<PutAttributesRequest> request = null;<NEW_LINE>Response<PutAttributesResult> response = null;<NEW_LINE>try {<NEW_LINE><MASK><NEW_LINE>try {<NEW_LINE>request = new PutAttributesRequestMarshaller().marshall(super.beforeMarshalling(putAttributesRequest));<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, "SimpleDB");<NEW_LINE>request.addHandlerContext(HandlerContextKey.OPERATION_NAME, "PutAttributes");<NEW_LINE>request.addHandlerContext(HandlerContextKey.ADVANCED_CONFIG, advancedConfig);<NEW_LINE>} finally {<NEW_LINE>awsRequestMetrics.endEvent(Field.RequestMarshallTime);<NEW_LINE>}<NEW_LINE>StaxResponseHandler<PutAttributesResult> responseHandler = new com.amazonaws.services.simpledb.internal.SimpleDBStaxResponseHandler<PutAttributesResult>(new PutAttributesResultStaxUnmarshaller());<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.RequestMarshallTime); |
805,774 | public static Boolean isFullyPlayed(final Connection connection, final String title) {<NEW_LINE>boolean trace = LOGGER.isTraceEnabled();<NEW_LINE>Boolean result = true;<NEW_LINE>try {<NEW_LINE>String sql = "SELECT FILES.MOVIEORSHOWNAME " + "FROM FILES " + "LEFT JOIN " + MediaTableFilesStatus.TABLE_NAME + " ON " + "FILES.FILENAME = " + MediaTableFilesStatus.TABLE_NAME + ".FILENAME " + "WHERE " + "FILES.FORMAT_TYPE = 4 AND " + "FILES.MOVIEORSHOWNAME = " + sqlQuote(title) + " AND " + "FILES.ISTVEPISODE AND " + MediaTableFilesStatus.TABLE_NAME + ".ISFULLYPLAYED IS NOT TRUE " + "LIMIT 1";<NEW_LINE>if (trace) {<NEW_LINE>LOGGER.trace(<MASK><NEW_LINE>}<NEW_LINE>try (Statement statement = connection.createStatement();<NEW_LINE>ResultSet resultSet = statement.executeQuery(sql)) {<NEW_LINE>if (resultSet.next()) {<NEW_LINE>result = false;<NEW_LINE>}<NEW_LINE>}<NEW_LINE>} catch (SQLException e) {<NEW_LINE>LOGGER.error(LOG_ERROR_WHILE_IN_FOR, DATABASE_NAME, "looking up TV series status", TABLE_NAME, title, e.getMessage());<NEW_LINE>LOGGER.trace("", e);<NEW_LINE>}<NEW_LINE>return result;<NEW_LINE>} | "Searching " + TABLE_NAME + " with \"{}\"", sql); |
1,676,552 | private synchronized void init() throws IOException {<NEW_LINE>// Need the extra test, to avoid throwing an IOException from the Transcoder<NEW_LINE>if (imageInput == null) {<NEW_LINE>throw new IllegalStateException("input == null");<NEW_LINE>}<NEW_LINE>if (reader == null) {<NEW_LINE>WMFTranscoder transcoder = new WMFTranscoder();<NEW_LINE>ByteArrayOutputStream output = new ByteArrayOutputStream();<NEW_LINE>Writer writer <MASK><NEW_LINE>try {<NEW_LINE>TranscoderInput in = new TranscoderInput(IIOUtil.createStreamAdapter(imageInput));<NEW_LINE>TranscoderOutput out = new TranscoderOutput(writer);<NEW_LINE>// TODO: Transcodinghints?<NEW_LINE>transcoder.transcode(in, out);<NEW_LINE>} catch (TranscoderException e) {<NEW_LINE>throw new IIOException(e.getMessage(), e);<NEW_LINE>}<NEW_LINE>reader = new SVGImageReader(getOriginatingProvider());<NEW_LINE>reader.setInput(ImageIO.createImageInputStream(new ByteArrayInputStream(output.toByteArray())));<NEW_LINE>}<NEW_LINE>} | = new OutputStreamWriter(output, "UTF8"); |
1,769,907 | private Future<ReconcileResult<T>> internalDelete(Reconciliation reconciliation, String name) {<NEW_LINE>R resourceOp = operation().withName(name);<NEW_LINE>Future<ReconcileResult<T>> watchForDeleteFuture = resourceSupport.selfClosingWatch(reconciliation, resourceOp, resourceOp, deleteTimeoutMs(), "observe deletion of " + resourceKind + " " + name, (action, resource) -> {<NEW_LINE>if (action == Watcher.Action.DELETED) {<NEW_LINE>log.debugCr(reconciliation, "{} {} has been deleted", resourceKind, name);<NEW_LINE>return ReconcileResult.deleted();<NEW_LINE>} else {<NEW_LINE>return null;<NEW_LINE>}<NEW_LINE>}, resource -> {<NEW_LINE>if (resource == null) {<NEW_LINE>log.debugCr(reconciliation, "{} {} has been already deleted in pre-check", resourceKind, name);<NEW_LINE>return ReconcileResult.deleted();<NEW_LINE>} else {<NEW_LINE>return null;<NEW_LINE>}<NEW_LINE>});<NEW_LINE>Future<Void> deleteFuture = resourceSupport.deleteAsync(resourceOp);<NEW_LINE>return CompositeFuture.join(watchForDeleteFuture, deleteFuture).<MASK><NEW_LINE>} | map(ReconcileResult.deleted()); |
932,667 | protected void updateUninstallUpgrade() {<NEW_LINE>final int[] selected = myPackagesTable.getSelectedRows();<NEW_LINE>boolean upgradeAvailable = false;<NEW_LINE>boolean canUninstall = selected.length != 0;<NEW_LINE>boolean canInstall = installEnabled();<NEW_LINE>boolean canUpgrade = true;<NEW_LINE>if (myPackageManagementService != null && selected.length != 0) {<NEW_LINE>for (int i = 0; i != selected.length; ++i) {<NEW_LINE>final int index = selected[i];<NEW_LINE>if (index >= myPackagesTable.getRowCount())<NEW_LINE>continue;<NEW_LINE>final Object value = myPackagesTable.getValueAt(index, 0);<NEW_LINE>if (value instanceof InstalledPackage) {<NEW_LINE><MASK><NEW_LINE>if (!canUninstallPackage(pkg)) {<NEW_LINE>canUninstall = false;<NEW_LINE>}<NEW_LINE>canInstall = canInstallPackage(pkg);<NEW_LINE>if (!canUpgradePackage(pkg)) {<NEW_LINE>canUpgrade = false;<NEW_LINE>}<NEW_LINE>final String pyPackageName = pkg.getName();<NEW_LINE>final String availableVersion = (String) myPackagesTable.getValueAt(index, 2);<NEW_LINE>if (!upgradeAvailable) {<NEW_LINE>upgradeAvailable = isUpdateAvailable(pkg.getVersion(), availableVersion) && !myCurrentlyInstalling.contains(pyPackageName);<NEW_LINE>}<NEW_LINE>if (!canUninstall && !canUpgrade)<NEW_LINE>break;<NEW_LINE>}<NEW_LINE>}<NEW_LINE>}<NEW_LINE>myUninstallButton.setEnabled(canUninstall);<NEW_LINE>myInstallButton.setEnabled(canInstall);<NEW_LINE>myUpgradeButton.setEnabled(upgradeAvailable && canUpgrade);<NEW_LINE>} | final InstalledPackage pkg = (InstalledPackage) value; |
41,065 | final CreateTagsResult executeCreateTags(CreateTagsRequest createTagsRequest) {<NEW_LINE>ExecutionContext executionContext = createExecutionContext(createTagsRequest);<NEW_LINE>AWSRequestMetrics awsRequestMetrics = executionContext.getAwsRequestMetrics();<NEW_LINE>awsRequestMetrics.startEvent(Field.ClientExecuteTime);<NEW_LINE>Request<CreateTagsRequest> request = null;<NEW_LINE>Response<CreateTagsResult> response = null;<NEW_LINE>try {<NEW_LINE><MASK><NEW_LINE>try {<NEW_LINE>request = new CreateTagsRequestProtocolMarshaller(protocolFactory).marshall(super.beforeMarshalling(createTagsRequest));<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 Discovery Service");<NEW_LINE>request.addHandlerContext(HandlerContextKey.OPERATION_NAME, "CreateTags");<NEW_LINE>request.addHandlerContext(HandlerContextKey.ADVANCED_CONFIG, advancedConfig);<NEW_LINE>} finally {<NEW_LINE>awsRequestMetrics.endEvent(Field.RequestMarshallTime);<NEW_LINE>}<NEW_LINE>HttpResponseHandler<AmazonWebServiceResponse<CreateTagsResult>> responseHandler = protocolFactory.createResponseHandler(new JsonOperationMetadata().withPayloadJson(true).withHasStreamingSuccessResponse(false), new CreateTagsResultJsonUnmarshaller());<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.RequestMarshallTime); |
1,494,657 | public StringBuffer printExpression(int indent, StringBuffer output) {<NEW_LINE>// $NON-NLS-1$<NEW_LINE>output.append("new ");<NEW_LINE>this.type.print(0, output);<NEW_LINE>for (int i = 0; i < this.dimensions.length; i++) {<NEW_LINE>if (this.annotationsOnDimensions != null && this.annotationsOnDimensions[i] != null) {<NEW_LINE>output.append(' ');<NEW_LINE>printAnnotations(this.annotationsOnDimensions[i], output);<NEW_LINE>output.append(' ');<NEW_LINE>}<NEW_LINE>if (this.dimensions[i] == null)<NEW_LINE>// $NON-NLS-1$<NEW_LINE>output.append("[]");<NEW_LINE>else {<NEW_LINE>output.append('[');<NEW_LINE>this.dimensions[i<MASK><NEW_LINE>output.append(']');<NEW_LINE>}<NEW_LINE>}<NEW_LINE>if (this.initializer != null)<NEW_LINE>this.initializer.printExpression(0, output);<NEW_LINE>return output;<NEW_LINE>} | ].printExpression(0, output); |
184,692 | private Attribute putAttribute(ConceptManager conceptMgr) {<NEW_LINE>assert has().attribute().isa().isPresent() && has().attribute().isa().get().type().label().isPresent() && has().attribute().value().size() == 1 && has().attribute().value().iterator().next().isValueIdentity();<NEW_LINE>Label attributeTypeLabel = isa().type().label().get().properLabel();<NEW_LINE>AttributeType attrType = conceptMgr.getAttributeType(attributeTypeLabel.name());<NEW_LINE>assert attrType != null;<NEW_LINE>ValueConstraint<?> value = has().attribute().value().iterator().next();<NEW_LINE>if (attrType.isDateTime())<NEW_LINE>return attrType.asDateTime().put(value.asDateTime().value(), true);<NEW_LINE>else if (attrType.isBoolean())<NEW_LINE>return attrType.asBoolean().put(value.asBoolean().value(), true);<NEW_LINE>else if (attrType.isDouble())<NEW_LINE>return attrType.asDouble().put(value.asDouble().value(), true);<NEW_LINE>else if (attrType.isLong())<NEW_LINE>return attrType.asLong().put(value.asLong().value(), true);<NEW_LINE>else if (attrType.isString())<NEW_LINE>return attrType.asString().put(value.asString(<MASK><NEW_LINE>else<NEW_LINE>throw TypeDBException.of(ILLEGAL_STATE);<NEW_LINE>} | ).value(), true); |
1,021,608 | private void recoverAppState() {<NEW_LINE>modulesStatus.setDnsCryptState(STOPPED);<NEW_LINE>modulesStatus.setTorState(STOPPED);<NEW_LINE>modulesStatus.setItpdState(STOPPED);<NEW_LINE>if (modulesStatus.getMode() != null && modulesStatus.getMode() != UNDEFINED) {<NEW_LINE>return;<NEW_LINE>}<NEW_LINE>loge("Restoring application state, possibly after the crash.");<NEW_LINE>Utils.startAppExitDetectService(this);<NEW_LINE>SharedPreferences defaultPreferences = defaultSharedPreferences.get();<NEW_LINE>PreferenceRepository preferences = preferenceRepository.get();<NEW_LINE>boolean rootIsAvailable = preferences.getBoolPreference(ROOT_IS_AVAILABLE);<NEW_LINE>boolean runModulesWithRoot = defaultPreferences.getBoolean(RUN_MODULES_WITH_ROOT, false);<NEW_LINE>modulesStatus.setFixTTL(defaultPreferences<MASK><NEW_LINE>String operationMode = preferences.getStringPreference(OPERATION_MODE);<NEW_LINE>if (!operationMode.isEmpty()) {<NEW_LINE>OperationMode mode = OperationMode.valueOf(operationMode);<NEW_LINE>ModulesAux.switchModes(rootIsAvailable, runModulesWithRoot, mode);<NEW_LINE>}<NEW_LINE>boolean savedDNSCryptStateRunning = ModulesAux.isDnsCryptSavedStateRunning();<NEW_LINE>boolean savedTorStateRunning = ModulesAux.isTorSavedStateRunning();<NEW_LINE>boolean savedITPDStateRunning = ModulesAux.isITPDSavedStateRunning();<NEW_LINE>if (savedDNSCryptStateRunning && !runModulesWithRoot) {<NEW_LINE>modulesStatus.setSystemDNSAllowed(true);<NEW_LINE>}<NEW_LINE>if (savedDNSCryptStateRunning) {<NEW_LINE>startDNSCrypt();<NEW_LINE>}<NEW_LINE>if (savedTorStateRunning) {<NEW_LINE>startTor();<NEW_LINE>}<NEW_LINE>if (savedITPDStateRunning) {<NEW_LINE>startITPD();<NEW_LINE>}<NEW_LINE>saveModulesStateRunning(savedDNSCryptStateRunning, savedTorStateRunning, savedITPDStateRunning);<NEW_LINE>} | .getBoolean(FIX_TTL, false)); |
1,249,674 | private void restore() {<NEW_LINE>SessionSettings settings = mState.mSettings;<NEW_LINE>if (settings == null) {<NEW_LINE>settings = new SessionSettings.Builder().withDefaultSettings(mContext).build();<NEW_LINE>} else {<NEW_LINE>updateTrackingProtection();<NEW_LINE>}<NEW_LINE>mState.mSession = createGeckoSession(settings);<NEW_LINE>mSessionChangeListeners.forEach(listener <MASK><NEW_LINE>openSession();<NEW_LINE>if (shouldLoadDefaultPage(mState)) {<NEW_LINE>loadDefaultPage();<NEW_LINE>} else if (mState.mSessionState != null) {<NEW_LINE>mState.mSession.restoreState(mState.mSessionState);<NEW_LINE>if (mState.mUri != null && mState.mUri.contains(".youtube.com")) {<NEW_LINE>mState.mSession.load(new GeckoSession.Loader().uri(mState.mUri).flags(GeckoSession.LOAD_FLAGS_REPLACE_HISTORY));<NEW_LINE>}<NEW_LINE>} else if (mState.mUri != null) {<NEW_LINE>mState.mSession.loadUri(mState.mUri);<NEW_LINE>} else {<NEW_LINE>loadDefaultPage();<NEW_LINE>}<NEW_LINE>dumpAllState();<NEW_LINE>mState.setActive(true);<NEW_LINE>if (!mState.mIsWebExtensionSession) {<NEW_LINE>mRuntime.getWebExtensionController().setTabActive(mState.mSession, true);<NEW_LINE>}<NEW_LINE>} | -> listener.onSessionAdded(this)); |
1,727,431 | public void initialize() throws ContainerInitializationException {<NEW_LINE>Timer.start("SPARK_COLD_START");<NEW_LINE>log.debug("First request, getting new server instance");<NEW_LINE>// trying to call init in case the embedded server had not been initialized.<NEW_LINE>Spark.init();<NEW_LINE>// adding this call to make sure that the framework is fully initialized. This should address a race<NEW_LINE>// condition and solve GitHub issue #71.<NEW_LINE>Spark.awaitInitialization();<NEW_LINE>embeddedServer = lambdaServerFactory.getServerInstance();<NEW_LINE>// manually add the spark filter to the chain. This should the last one and match all uris<NEW_LINE>FilterRegistration.Dynamic sparkRegistration = getServletContext().addFilter(<MASK><NEW_LINE>sparkRegistration.addMappingForUrlPatterns(EnumSet.of(DispatcherType.REQUEST, DispatcherType.ASYNC, DispatcherType.INCLUDE, DispatcherType.FORWARD), true, "/*");<NEW_LINE>Timer.stop("SPARK_COLD_START");<NEW_LINE>} | "SparkFilter", embeddedServer.getSparkFilter()); |
793,412 | public void runScript() throws IOException {<NEW_LINE>String startupScript = mlContext.getProperties(<MASK><NEW_LINE>List<String> args = new ArrayList<>();<NEW_LINE>String pythonVersion = mlContext.getProperties().getOrDefault(MLConstants.PYTHON_VERSION, "");<NEW_LINE>String pythonExec = "python" + pythonVersion;<NEW_LINE>// check if has python2 or python3 environment<NEW_LINE>if (checkPythonEnvironment("which " + pythonExec) != 0) {<NEW_LINE>throw new RuntimeException("No this python environment");<NEW_LINE>}<NEW_LINE>String virtualEnv = mlContext.getProperties().getOrDefault(MLConstants.VIRTUAL_ENV_DIR, "");<NEW_LINE>if (!virtualEnv.isEmpty()) {<NEW_LINE>pythonExec = virtualEnv + "/bin/python";<NEW_LINE>}<NEW_LINE>args.add(pythonExec);<NEW_LINE>if (mlContext.startWithStartup()) {<NEW_LINE>args.add(startupScript);<NEW_LINE>LOG.info("Running {} via {}", mlContext.getScript().getName(), startupScript);<NEW_LINE>} else {<NEW_LINE>args.add(mlContext.getScript().getAbsolutePath());<NEW_LINE>}<NEW_LINE>args.add(String.format("%s:%d", mlContext.getNodeServerIP(), mlContext.getNodeServerPort()));<NEW_LINE>ProcessBuilder builder = new ProcessBuilder(args);<NEW_LINE>String classPath = getClassPath();<NEW_LINE>if (classPath == null) {<NEW_LINE>// can happen in UT<NEW_LINE>LOG.warn("Cannot find proper classpath for the Python process.");<NEW_LINE>} else {<NEW_LINE>mlContext.putEnvProperty(MLConstants.CLASSPATH, classPath);<NEW_LINE>}<NEW_LINE>buildProcessBuilder(builder);<NEW_LINE>LOG.info("{} Python cmd: {}", mlContext.getIdentity(), Joiner.on(" ").join(args));<NEW_LINE>runProcess(builder);<NEW_LINE>} | ).get(MLConstants.STARTUP_SCRIPT_FILE); |
1,195,432 | private void controlChangeListener() {<NEW_LINE>Renderable before = active;<NEW_LINE>// switch (this.jtp.getTabComponentAt(this.jtp.getSelectedIndex()).getName()) {<NEW_LINE>switch(this.jtp.getTitleAt(this.jtp.getSelectedIndex())) {<NEW_LINE>case XYZ_TAB:<NEW_LINE>// TODO: XYZ Renderable<NEW_LINE>active = cornerRenderable;<NEW_LINE>cornerRenderable.updateSpacing(getDouble(xyzXDistanceModel), getDouble(xyzYDistanceModel), getDouble(xyzZDistanceModel), getDouble(xyzXOffsetModel), getDouble(xyzYOffsetModel), getDouble(xyzZOffsetModel));<NEW_LINE>break;<NEW_LINE>case OUTSIDE_TAB:<NEW_LINE>active = cornerRenderable;<NEW_LINE>cornerRenderable.updateSpacing(getDouble(outsideXDistanceModel), getDouble(outsideYDistanceModel), 0, getDouble(outsideXOffsetModel), getDouble(outsideYOffsetModel), 0);<NEW_LINE>break;<NEW_LINE>case Z_TAB:<NEW_LINE>active = zRenderable;<NEW_LINE>zRenderable.updateSpacing(getDouble(zProbeDistance), getDouble(zProbeOffset));<NEW_LINE>break;<NEW_LINE>case SETTINGS_TAB:<NEW_LINE>active = null;<NEW_LINE>break;<NEW_LINE>}<NEW_LINE>if (before != active) {<NEW_LINE>RenderableUtils.removeRenderable(before);<NEW_LINE><MASK><NEW_LINE>}<NEW_LINE>} | RenderableUtils.registerRenderable(this.active); |
773,837 | protected void log(Environment result) {<NEW_LINE>if (logger.isInfoEnabled()) {<NEW_LINE>logger.info(String.format("Located environment: name=%s, profiles=%s, label=%s, version=%s, state=%s", result.getName(), result.getProfiles() == null ? "" : Arrays.asList(result.getProfiles()), result.getLabel(), result.getVersion()<MASK><NEW_LINE>}<NEW_LINE>if (logger.isDebugEnabled()) {<NEW_LINE>List<org.springframework.cloud.config.environment.PropertySource> propertySourceList = result.getPropertySources();<NEW_LINE>if (propertySourceList != null) {<NEW_LINE>int propertyCount = 0;<NEW_LINE>for (org.springframework.cloud.config.environment.PropertySource propertySource : propertySourceList) {<NEW_LINE>propertyCount += propertySource.getSource().size();<NEW_LINE>}<NEW_LINE>logger.debug(String.format("Environment %s has %d property sources with %d properties.", result.getName(), result.getPropertySources().size(), propertyCount));<NEW_LINE>}<NEW_LINE>}<NEW_LINE>} | , result.getState())); |
1,616,175 | // get a field of keyword type in the fields<NEW_LINE>private static void resolveKeywordFields(SearchContext searchContext, JSONObject fieldObject, String colName) {<NEW_LINE>String fieldType = (String) fieldObject.get("type");<NEW_LINE>// string-type field used keyword type to generate predicate<NEW_LINE>// if text field type seen, we should use the `field` keyword type?<NEW_LINE>if ("text".equals(fieldType)) {<NEW_LINE>JSONObject fieldsObject = (<MASK><NEW_LINE>if (fieldsObject != null) {<NEW_LINE>for (Object key : fieldsObject.keySet()) {<NEW_LINE>JSONObject innerTypeObject = (JSONObject) fieldsObject.get((String) key);<NEW_LINE>// just for text type<NEW_LINE>if ("keyword".equals((String) innerTypeObject.get("type"))) {<NEW_LINE>searchContext.fetchFieldsContext().put(colName, colName + "." + key);<NEW_LINE>}<NEW_LINE>}<NEW_LINE>}<NEW_LINE>}<NEW_LINE>} | JSONObject) fieldObject.get("fields"); |
1,356,283 | public Message read() {<NEW_LINE>assert hasNext();<NEW_LINE>mNMessages = (mNMessages + 1) % mCheckMessagesPerSecond;<NEW_LINE>if (mNMessages % mCheckMessagesPerSecond == 0) {<NEW_LINE>RateLimitUtil.acquire(mCheckMessagesPerSecond);<NEW_LINE>}<NEW_LINE><MASK><NEW_LINE>if (message == null) {<NEW_LINE>return null;<NEW_LINE>}<NEW_LINE>TopicPartition topicPartition = new TopicPartition(message.getTopic(), message.getKafkaPartition());<NEW_LINE>updateAccessTime(topicPartition);<NEW_LINE>// Skip already committed messages.<NEW_LINE>long committedOffsetCount = mOffsetTracker.getTrueCommittedOffsetCount(topicPartition);<NEW_LINE>LOG.debug("read message {}", message);<NEW_LINE>if (mNMessages % mCheckMessagesPerSecond == 0) {<NEW_LINE>exportStats();<NEW_LINE>}<NEW_LINE>if (message.getOffset() < committedOffsetCount) {<NEW_LINE>LOG.debug("skipping message {} because its offset precedes committed offset count {}", message, committedOffsetCount);<NEW_LINE>return null;<NEW_LINE>}<NEW_LINE>return message;<NEW_LINE>} | Message message = mKafkaMessageIterator.next(); |
975,738 | public DeckCardLists importDeck(String fileName, StringBuilder errorMessages, boolean saveAutoFixedFile) {<NEW_LINE>File f = new File(fileName);<NEW_LINE>DeckCardLists deckList = new DeckCardLists();<NEW_LINE>if (!f.exists()) {<NEW_LINE>logger.warn("Deckfile " + fileName + " not found.");<NEW_LINE>return deckList;<NEW_LINE>}<NEW_LINE>sbMessage.setLength(0);<NEW_LINE>try {<NEW_LINE>try (FileReader reader = new FileReader(f)) {<NEW_LINE>try {<NEW_LINE>JsonObject json = JsonParser.parseReader(reader).getAsJsonObject();<NEW_LINE>readJson(json, deckList);<NEW_LINE>if (sbMessage.length() > 0) {<NEW_LINE>if (errorMessages != null) {<NEW_LINE>// normal output for user<NEW_LINE>errorMessages.append(sbMessage);<NEW_LINE>} else {<NEW_LINE>// fatal error<NEW_LINE>logger.fatal(sbMessage);<NEW_LINE>}<NEW_LINE>}<NEW_LINE>} catch (JsonParseException ex) {<NEW_LINE>logger.fatal("Can't parse json-deck: " + fileName, ex);<NEW_LINE>}<NEW_LINE>} catch (Exception ex) {<NEW_LINE><MASK><NEW_LINE>}<NEW_LINE>} catch (Exception ex) {<NEW_LINE>logger.fatal(null, ex);<NEW_LINE>}<NEW_LINE>return deckList;<NEW_LINE>} | logger.fatal(null, ex); |
379,452 | public long handle(Emulator<?> emulator) {<NEW_LINE>RegisterContext context = emulator.getContext();<NEW_LINE>UnidbgPointer <MASK><NEW_LINE>UnidbgPointer jfieldID = context.getPointerArg(2);<NEW_LINE>ByteBuffer buffer = ByteBuffer.allocate(16);<NEW_LINE>buffer.order(ByteOrder.LITTLE_ENDIAN);<NEW_LINE>buffer.put(emulator.getBackend().reg_read_vector(Arm64Const.UC_ARM64_REG_Q0));<NEW_LINE>buffer.flip();<NEW_LINE>double value = buffer.getDouble();<NEW_LINE>if (log.isDebugEnabled()) {<NEW_LINE>log.debug("SetStaticDoubleField clazz=" + clazz + ", jfieldID=" + jfieldID + ", value=" + value);<NEW_LINE>}<NEW_LINE>DvmClass dvmClass = classMap.get(clazz.toIntPeer());<NEW_LINE>DvmField dvmField = dvmClass == null ? null : dvmClass.getStaticField(jfieldID.toIntPeer());<NEW_LINE>if (dvmField == null) {<NEW_LINE>throw new BackendException("dvmClass=" + dvmClass);<NEW_LINE>} else {<NEW_LINE>dvmField.setStaticDoubleField(value);<NEW_LINE>if (verbose) {<NEW_LINE>System.out.printf("JNIEnv->SetStaticDoubleField(%s, %s, %s) was called from %s%n", dvmClass, dvmField.fieldName, value, context.getLRPointer());<NEW_LINE>}<NEW_LINE>}<NEW_LINE>return 0;<NEW_LINE>} | clazz = context.getPointerArg(1); |
953,674 | protected void onFragmentCreated(@NonNull View view, @Nullable Bundle savedInstanceState) {<NEW_LINE>stateLayout.setEmptyText(R.string.no_search_results);<NEW_LINE>getLoadMore().initialize(getPresenter().getCurrentPage(), getPresenter().getPreviousTotal());<NEW_LINE>stateLayout.setOnReloadListener(this);<NEW_LINE>refresh.setOnRefreshListener(this);<NEW_LINE>recycler.setEmptyView(stateLayout, refresh);<NEW_LINE>adapter = new UsersAdapter(getPresenter().getUsers());<NEW_LINE><MASK><NEW_LINE>recycler.setAdapter(adapter);<NEW_LINE>recycler.addKeyLineDivider();<NEW_LINE>if (savedInstanceState != null) {<NEW_LINE>if (!InputHelper.isEmpty(searchQuery) && getPresenter().getUsers().isEmpty() && !getPresenter().isApiCalled()) {<NEW_LINE>onRefresh();<NEW_LINE>}<NEW_LINE>}<NEW_LINE>if (InputHelper.isEmpty(searchQuery)) {<NEW_LINE>stateLayout.showEmptyState();<NEW_LINE>}<NEW_LINE>fastScroller.attachRecyclerView(recycler);<NEW_LINE>} | adapter.setListener(getPresenter()); |
1,097,144 | public static DescribeCouponDetailResponse unmarshall(DescribeCouponDetailResponse describeCouponDetailResponse, UnmarshallerContext context) {<NEW_LINE>describeCouponDetailResponse.setRequestId(context.stringValue("DescribeCouponDetailResponse.RequestId"));<NEW_LINE>describeCouponDetailResponse.setCouponTemplateId(context.longValue("DescribeCouponDetailResponse.CouponTemplateId"));<NEW_LINE>describeCouponDetailResponse.setTotalAmount(context.stringValue("DescribeCouponDetailResponse.TotalAmount"));<NEW_LINE>describeCouponDetailResponse.setBalanceAmount(context.stringValue("DescribeCouponDetailResponse.BalanceAmount"));<NEW_LINE>describeCouponDetailResponse.setFrozenAmount(context.stringValue("DescribeCouponDetailResponse.FrozenAmount"));<NEW_LINE>describeCouponDetailResponse.setExpiredAmount(context.stringValue("DescribeCouponDetailResponse.ExpiredAmount"));<NEW_LINE>describeCouponDetailResponse.setDeliveryTime(context.stringValue("DescribeCouponDetailResponse.DeliveryTime"));<NEW_LINE>describeCouponDetailResponse.setExpiredTime<MASK><NEW_LINE>describeCouponDetailResponse.setCouponNumber(context.stringValue("DescribeCouponDetailResponse.CouponNumber"));<NEW_LINE>describeCouponDetailResponse.setStatus(context.stringValue("DescribeCouponDetailResponse.Status"));<NEW_LINE>describeCouponDetailResponse.setDescription(context.stringValue("DescribeCouponDetailResponse.Description"));<NEW_LINE>describeCouponDetailResponse.setCreationTime(context.stringValue("DescribeCouponDetailResponse.CreationTime"));<NEW_LINE>describeCouponDetailResponse.setModificationTime(context.stringValue("DescribeCouponDetailResponse.ModificationTime"));<NEW_LINE>describeCouponDetailResponse.setPriceLimit(context.stringValue("DescribeCouponDetailResponse.PriceLimit"));<NEW_LINE>describeCouponDetailResponse.setApplication(context.stringValue("DescribeCouponDetailResponse.Application"));<NEW_LINE>List<String> productCodes = new ArrayList<String>();<NEW_LINE>for (int i = 0; i < context.lengthValue("DescribeCouponDetailResponse.ProductCodes.Length"); i++) {<NEW_LINE>productCodes.add(context.stringValue("DescribeCouponDetailResponse.ProductCodes[" + i + "]"));<NEW_LINE>}<NEW_LINE>describeCouponDetailResponse.setProductCodes(productCodes);<NEW_LINE>List<String> tradeTypes = new ArrayList<String>();<NEW_LINE>for (int i = 0; i < context.lengthValue("DescribeCouponDetailResponse.TradeTypes.Length"); i++) {<NEW_LINE>tradeTypes.add(context.stringValue("DescribeCouponDetailResponse.TradeTypes[" + i + "]"));<NEW_LINE>}<NEW_LINE>describeCouponDetailResponse.setTradeTypes(tradeTypes);<NEW_LINE>return describeCouponDetailResponse;<NEW_LINE>} | (context.stringValue("DescribeCouponDetailResponse.ExpiredTime")); |
1,493,027 | private static void findSyntacticRelationsFromDependency(List<Mention> orderedMentions) {<NEW_LINE>if (orderedMentions.size() == 0)<NEW_LINE>return;<NEW_LINE>markListMemberRelation(orderedMentions);<NEW_LINE>SemanticGraph dependency = <MASK><NEW_LINE>// apposition<NEW_LINE>Set<Pair<Integer, Integer>> appos = Generics.newHashSet();<NEW_LINE>List<SemanticGraphEdge> appositions = dependency.findAllRelns(UniversalEnglishGrammaticalRelations.APPOSITIONAL_MODIFIER);<NEW_LINE>for (SemanticGraphEdge edge : appositions) {<NEW_LINE>int sIdx = edge.getSource().index() - 1;<NEW_LINE>int tIdx = edge.getTarget().index() - 1;<NEW_LINE>appos.add(Pair.makePair(sIdx, tIdx));<NEW_LINE>}<NEW_LINE>markMentionRelation(orderedMentions, appos, "APPOSITION");<NEW_LINE>// predicate nominatives<NEW_LINE>Set<Pair<Integer, Integer>> preNomi = Generics.newHashSet();<NEW_LINE>List<SemanticGraphEdge> copula = dependency.findAllRelns(UniversalEnglishGrammaticalRelations.COPULA);<NEW_LINE>for (SemanticGraphEdge edge : copula) {<NEW_LINE>IndexedWord source = edge.getSource();<NEW_LINE>IndexedWord target = dependency.getChildWithReln(source, UniversalEnglishGrammaticalRelations.NOMINAL_SUBJECT);<NEW_LINE>if (target == null)<NEW_LINE>target = dependency.getChildWithReln(source, UniversalEnglishGrammaticalRelations.CLAUSAL_SUBJECT);<NEW_LINE>// TODO<NEW_LINE>if (target == null)<NEW_LINE>continue;<NEW_LINE>// to handle relative clause: e.g., Tim who is a student,<NEW_LINE>if (target.tag().startsWith("W")) {<NEW_LINE>IndexedWord parent = dependency.getParent(source);<NEW_LINE>if (parent != null && dependency.reln(parent, source).equals(UniversalEnglishGrammaticalRelations.RELATIVE_CLAUSE_MODIFIER)) {<NEW_LINE>target = parent;<NEW_LINE>}<NEW_LINE>}<NEW_LINE>int sIdx = source.index() - 1;<NEW_LINE>int tIdx = target.index() - 1;<NEW_LINE>preNomi.add(Pair.makePair(tIdx, sIdx));<NEW_LINE>}<NEW_LINE>markMentionRelation(orderedMentions, preNomi, "PREDICATE_NOMINATIVE");<NEW_LINE>// relative pronouns TODO<NEW_LINE>Set<Pair<Integer, Integer>> relativePronounPairs = Generics.newHashSet();<NEW_LINE>markMentionRelation(orderedMentions, relativePronounPairs, "RELATIVE_PRONOUN");<NEW_LINE>} | orderedMentions.get(0).enhancedDependency; |
1,141,046 | private void buildDestinationItem(@NonNull View view, final TargetPoint destination, int[] startTime, final TransportRouteResultSegment segment, double walkSpeed) {<NEW_LINE>OsmandApplication app = requireMyApplication();<NEW_LINE>Typeface typeface = FontCache.getRobotoMedium(app);<NEW_LINE>FrameLayout baseItemView = new FrameLayout(view.getContext());<NEW_LINE>LinearLayout imagesContainer = (LinearLayout) createImagesContainer(view.getContext());<NEW_LINE>baseItemView.addView(imagesContainer);<NEW_LINE>LinearLayout infoContainer = (LinearLayout) createInfoContainer(view.getContext());<NEW_LINE>baseItemView.addView(infoContainer);<NEW_LINE>buildRowDivider(infoContainer, true);<NEW_LINE>double walkDist = (long) getWalkDistance(segment, null, segment.walkDist);<NEW_LINE>int walkTime = (int) getWalkTime(<MASK><NEW_LINE>if (walkTime < 60) {<NEW_LINE>walkTime = 60;<NEW_LINE>}<NEW_LINE>SpannableStringBuilder spannable = new SpannableStringBuilder(getString(R.string.shared_string_walk)).append(" ");<NEW_LINE>spannable.setSpan(new ForegroundColorSpan(getSecondaryColor()), 0, spannable.length(), Spannable.SPAN_EXCLUSIVE_EXCLUSIVE);<NEW_LINE>int startIndex = spannable.length();<NEW_LINE>spannable.append("~").append(OsmAndFormatter.getFormattedDuration(walkTime, app));<NEW_LINE>spannable.setSpan(new CustomTypefaceSpan(typeface), startIndex, spannable.length(), Spannable.SPAN_EXCLUSIVE_EXCLUSIVE);<NEW_LINE>startIndex = spannable.length();<NEW_LINE>spannable.append(", ").append(OsmAndFormatter.getFormattedDistance((float) walkDist, app));<NEW_LINE>spannable.setSpan(new ForegroundColorSpan(getSecondaryColor()), startIndex, spannable.length(), Spannable.SPAN_EXCLUSIVE_EXCLUSIVE);<NEW_LINE>buildWalkRow(infoContainer, spannable, imagesContainer, new OnClickListener() {<NEW_LINE><NEW_LINE>@Override<NEW_LINE>public void onClick(View v) {<NEW_LINE>showWalkingRouteOnMap(segment, null);<NEW_LINE>}<NEW_LINE>});<NEW_LINE>buildRowDivider(infoContainer, true);<NEW_LINE>addWalkRouteIcon(imagesContainer);<NEW_LINE>String timeStr = OsmAndFormatter.getFormattedDurationShortMinutes(startTime[0] + walkTime);<NEW_LINE>String name = getRoutePointDescription(destination.point, destination.getOnlyName());<NEW_LINE>SpannableString title = new SpannableString(name);<NEW_LINE>title.setSpan(new CustomTypefaceSpan(typeface), 0, title.length(), Spannable.SPAN_EXCLUSIVE_EXCLUSIVE);<NEW_LINE>title.setSpan(new ForegroundColorSpan(getActiveColor()), 0, title.length(), Spannable.SPAN_EXCLUSIVE_EXCLUSIVE);<NEW_LINE>SpannableString secondaryText = new SpannableString(getString(R.string.route_descr_destination));<NEW_LINE>secondaryText.setSpan(new CustomTypefaceSpan(typeface), 0, secondaryText.length(), Spannable.SPAN_EXCLUSIVE_EXCLUSIVE);<NEW_LINE>secondaryText.setSpan(new ForegroundColorSpan(getMainFontColor()), 0, secondaryText.length(), Spannable.SPAN_EXCLUSIVE_EXCLUSIVE);<NEW_LINE>buildDestinationRow(infoContainer, timeStr, title, secondaryText, destination.point, imagesContainer, new OnClickListener() {<NEW_LINE><NEW_LINE>@Override<NEW_LINE>public void onClick(View v) {<NEW_LINE>showLocationOnMap(destination.point);<NEW_LINE>}<NEW_LINE>});<NEW_LINE>((ViewGroup) view).addView(baseItemView);<NEW_LINE>} | segment, null, walkDist, walkSpeed); |
1,047,283 | public JsonArray filesTimeSeries(Dataverse d) {<NEW_LINE>Query query = em.createNativeQuery("select distinct date, count(id)\n" + "from (\n" + "select min(to_char(COALESCE(releasetime, createtime), 'YYYY-MM')) as date, filemetadata.id as id\n" + "from datasetversion, filemetadata\n" + "where datasetversion.id=filemetadata.datasetversion_id\n" + "and versionstate='RELEASED' \n" + "and dataset_id in (select dataset.id from dataset, dvobject where dataset.id=dvobject.id\n" + "and dataset.harvestingclient_id IS NULL and publicationdate is not null\n " + ((d == null) ? ")" : "and dvobject.owner_id in (" + getCommaSeparatedIdStringForSubtree(d, <MASK><NEW_LINE>logger.log(Level.FINE, "Metric query: {0}", query);<NEW_LINE>List<Object[]> results = query.getResultList();<NEW_LINE>return MetricsUtil.timeSeriesToJson(results);<NEW_LINE>} | "Dataverse") + "))\n ") + "group by filemetadata.id) as subq group by subq.date order by date;"); |
1,779,917 | public void checkCurrentToken() {<NEW_LINE>HttpSession httpSession = request.getSession(false);<NEW_LINE>if (httpSession == null)<NEW_LINE>return;<NEW_LINE>SerializableKeycloakAccount account = (SerializableKeycloakAccount) httpSession.getAttribute(KeycloakAccount.class.getName());<NEW_LINE>if (account == null) {<NEW_LINE>return;<NEW_LINE>}<NEW_LINE>RefreshableKeycloakSecurityContext session = account.getKeycloakSecurityContext();<NEW_LINE>if (session == null)<NEW_LINE>return;<NEW_LINE>// just in case session got serialized<NEW_LINE>if (session.getDeployment() == null)<NEW_LINE>session.setCurrentRequestInfo(deployment, this);<NEW_LINE>if (session.isActive() && !session.getDeployment().isAlwaysRefreshToken())<NEW_LINE>return;<NEW_LINE>// FYI: A refresh requires same scope, so same roles will be set. Otherwise, refresh will fail and token will<NEW_LINE>// not be updated<NEW_LINE>boolean <MASK><NEW_LINE>if (success && session.isActive())<NEW_LINE>return;<NEW_LINE>// Refresh failed, so user is already logged out from keycloak. Cleanup and expire our session<NEW_LINE>// log.fine("Cleanup and expire session " + httpSession.getId() + " after failed refresh");<NEW_LINE>cleanSession(httpSession);<NEW_LINE>httpSession.invalidate();<NEW_LINE>} | success = session.refreshExpiredToken(false); |
916,058 | public synchronized boolean saveRecentSearch(String query) {<NEW_LINE>// prevent duplicate entries<NEW_LINE>String historyEntry = queryMap.get(query);<NEW_LINE>if (historyEntry != null) {<NEW_LINE>searchHistory.remove(historyEntry);<NEW_LINE>}<NEW_LINE>// add new entry<NEW_LINE>String now = Instant.now().with(ChronoField.NANO_OF_SECOND, 0).toString();<NEW_LINE>String newHistoryEntry = now + " " + query;<NEW_LINE>searchHistory.put(now + " " + query, query);<NEW_LINE>queryMap.put(query, newHistoryEntry);<NEW_LINE>// trim to size<NEW_LINE>if (searchHistory.size() > MAX_HISTORY_SIZE) {<NEW_LINE>while (searchHistory.size() > MAX_HISTORY_SIZE) {<NEW_LINE>// remove oldest entry (= lowest date value, sorted first)<NEW_LINE>String removedQuery = searchHistory.<MASK><NEW_LINE>queryMap.remove(removedQuery);<NEW_LINE>}<NEW_LINE>}<NEW_LINE>// save history<NEW_LINE>Set<String> historySet = new HashSet<>(searchHistory.keySet());<NEW_LINE>PreferenceManager.getDefaultSharedPreferences(context).edit().putStringSet(settingsKey, historySet).apply();<NEW_LINE>return historyEntry == null;<NEW_LINE>} | remove(searchHistory.lastKey()); |
196,841 | public ImmutableMap<ShipmentScheduleId, List<I_M_ShipmentSchedule_QtyPicked>> retrieveOnShipmentLineRecordsByScheduleIds(@NonNull final Set<ShipmentScheduleId> scheduleIds) {<NEW_LINE>final boolean onShipmentLine = true;<NEW_LINE>final List<I_M_ShipmentSchedule_QtyPicked> records = queryBL.createQueryBuilder(I_M_ShipmentSchedule_QtyPicked.class).addOnlyActiveRecordsFilter().filter(createOnShipmentLineFilter(scheduleIds, onShipmentLine))<MASK><NEW_LINE>final HashMap<ShipmentScheduleId, List<I_M_ShipmentSchedule_QtyPicked>> scheduleId2QtyPicked = new HashMap<>();<NEW_LINE>records.forEach(qtyPickedRecord -> {<NEW_LINE>final ShipmentScheduleId shipmentScheduleId = ShipmentScheduleId.ofRepoId(qtyPickedRecord.getM_ShipmentSchedule_ID());<NEW_LINE>final ArrayList<I_M_ShipmentSchedule_QtyPicked> qtyPickedList = new ArrayList<>();<NEW_LINE>qtyPickedList.add(qtyPickedRecord);<NEW_LINE>scheduleId2QtyPicked.merge(shipmentScheduleId, qtyPickedList, (oldList, newList) -> {<NEW_LINE>oldList.addAll(newList);<NEW_LINE>return oldList;<NEW_LINE>});<NEW_LINE>});<NEW_LINE>return ImmutableMap.copyOf(scheduleId2QtyPicked);<NEW_LINE>} | .create().list(); |
850,416 | <T> BindingImpl<T> createProvidedByBinding(Key<T> key, Scoping scoping, ProvidedBy providedBy, Errors errors) throws ErrorsException {<NEW_LINE>final Class<?> rawType = key.getTypeLiteral().getRawType();<NEW_LINE>final Class<? extends Provider<?>> providerType = providedBy.value();<NEW_LINE>// Make sure it's not the same type. TODO: Can we check for deeper loops?<NEW_LINE>if (providerType == rawType) {<NEW_LINE>throw errors.recursiveProviderType().toException();<NEW_LINE>}<NEW_LINE>// Assume the provider provides an appropriate type. We double check at runtime.<NEW_LINE>@SuppressWarnings("unchecked")<NEW_LINE>final Key<? extends Provider<T>> providerKey = (Key<? extends Provider<T>>) Key.get(providerType);<NEW_LINE>final BindingImpl<? extends Provider<?>> providerBinding = getBindingOrThrow(providerKey, errors);<NEW_LINE>InternalFactory<T> internalFactory = new InternalFactory<T>() {<NEW_LINE><NEW_LINE>@Override<NEW_LINE>public T get(Errors errors, InternalContext context, Dependency dependency) throws ErrorsException {<NEW_LINE>errors = errors.withSource(providerKey);<NEW_LINE>Provider<?> provider = providerBinding.getInternalFactory().get(errors, context, dependency);<NEW_LINE>try {<NEW_LINE>Object o = provider.get();<NEW_LINE>if (o != null && !rawType.isInstance(o)) {<NEW_LINE>throw errors.subtypeNotProvided(<MASK><NEW_LINE>}<NEW_LINE>// protected by isInstance() check above<NEW_LINE>@SuppressWarnings("unchecked")<NEW_LINE>T t = (T) o;<NEW_LINE>return t;<NEW_LINE>} catch (RuntimeException e) {<NEW_LINE>throw errors.errorInProvider(e).toException();<NEW_LINE>}<NEW_LINE>}<NEW_LINE>};<NEW_LINE>return new LinkedProviderBindingImpl<>(this, key, rawType, /* source */<NEW_LINE>Scopes.<T>scope(key, this, internalFactory, scoping), scoping, providerKey);<NEW_LINE>} | providerType, rawType).toException(); |
1,641,444 | public void userLogout(final Response.Listener<String> responseListener, final Response.ErrorListener errorListener) {<NEW_LINE>Object postBody = null;<NEW_LINE>// create path and map variables<NEW_LINE>String path = "/user/logout".replaceAll("\\{format\\}", "json");<NEW_LINE>// query params<NEW_LINE>List<Pair> queryParams = new ArrayList<Pair>();<NEW_LINE>// header params<NEW_LINE>Map<String, String> headerParams = new HashMap<String, String>();<NEW_LINE>// form params<NEW_LINE>Map<String, String> formParams = new HashMap<String, String>();<NEW_LINE>String[] contentTypes = { "application/json", "application/x-www-form-urlencoded" };<NEW_LINE>String contentType = contentTypes.length > <MASK><NEW_LINE>if (contentType.startsWith("multipart/form-data")) {<NEW_LINE>// file uploading<NEW_LINE>MultipartEntityBuilder localVarBuilder = MultipartEntityBuilder.create();<NEW_LINE>HttpEntity httpEntity = localVarBuilder.build();<NEW_LINE>postBody = httpEntity;<NEW_LINE>} else {<NEW_LINE>// normal form params<NEW_LINE>}<NEW_LINE>String[] authNames = new String[] {};<NEW_LINE>try {<NEW_LINE>apiInvoker.invokeAPI(basePath, path, "POST", queryParams, postBody, headerParams, formParams, contentType, authNames, new Response.Listener<String>() {<NEW_LINE><NEW_LINE>@Override<NEW_LINE>public void onResponse(String localVarResponse) {<NEW_LINE>responseListener.onResponse(localVarResponse);<NEW_LINE>}<NEW_LINE>}, new Response.ErrorListener() {<NEW_LINE><NEW_LINE>@Override<NEW_LINE>public void onErrorResponse(VolleyError error) {<NEW_LINE>errorListener.onErrorResponse(error);<NEW_LINE>}<NEW_LINE>});<NEW_LINE>} catch (ApiException ex) {<NEW_LINE>errorListener.onErrorResponse(new VolleyError(ex));<NEW_LINE>}<NEW_LINE>} | 0 ? contentTypes[0] : "application/json"; |
1,190,824 | private void propagate_array_constraints() {<NEW_LINE>// find max depth<NEW_LINE>int max = 0;<NEW_LINE>for (TypeVariableBV var : typeVariableList) {<NEW_LINE>int depth = var.depth();<NEW_LINE>if (depth > max) {<NEW_LINE>max = depth;<NEW_LINE>}<NEW_LINE>}<NEW_LINE>if (max > 1) {<NEW_LINE>// hack for J2ME library, reported by Stephen Cheng<NEW_LINE>if (!Options.v().j2me()) {<NEW_LINE>typeVariable(ArrayType.v(RefType.v(<MASK><NEW_LINE>typeVariable(ArrayType.v(RefType.v("java.io.Serializable"), max - 1));<NEW_LINE>}<NEW_LINE>}<NEW_LINE>// create lists for each array depth<NEW_LINE>@SuppressWarnings("unchecked")<NEW_LINE>LinkedList<TypeVariableBV>[] lists = new LinkedList[max + 1];<NEW_LINE>for (int i = 0; i <= max; i++) {<NEW_LINE>lists[i] = new LinkedList<TypeVariableBV>();<NEW_LINE>}<NEW_LINE>for (TypeVariableBV var : typeVariableList) {<NEW_LINE>int depth = var.depth();<NEW_LINE>lists[depth].add(var);<NEW_LINE>}<NEW_LINE>// propagate constraints, starting with highest depth<NEW_LINE>for (int i = max; i >= 0; i--) {<NEW_LINE>for (TypeVariableBV var : typeVariableList) {<NEW_LINE>var.propagate();<NEW_LINE>}<NEW_LINE>}<NEW_LINE>} | "java.lang.Cloneable"), max - 1)); |
1,402,341 | private ProducerRecord<K, V> createProducerRecord(final Message<?> message) {<NEW_LINE>MessageHeaders messageHeaders = message.getHeaders();<NEW_LINE>String topic = this.topicExpression != null ? this.topicExpression.getValue(this.evaluationContext, message, String.class) : messageHeaders.get(KafkaHeaders.TOPIC, String.class);<NEW_LINE>if (topic == null) {<NEW_LINE>topic = this.kafkaTemplate.getDefaultTopic();<NEW_LINE>}<NEW_LINE>if (this.useTemplateConverter) {<NEW_LINE>return (ProducerRecord<K, V>) this.kafkaTemplate.getMessageConverter().fromMessage(message, topic);<NEW_LINE>}<NEW_LINE>Assert.state(StringUtils.hasText(topic), "The 'topic' can not be empty or null");<NEW_LINE>Integer partitionId = this.partitionIdExpression != null ? this.partitionIdExpression.getValue(this.evaluationContext, message, Integer.class) : messageHeaders.get(<MASK><NEW_LINE>Object messageKey = this.messageKeyExpression != null ? this.messageKeyExpression.getValue(this.evaluationContext, message) : messageHeaders.get(KafkaHeaders.MESSAGE_KEY);<NEW_LINE>Long timestamp = this.timestampExpression != null ? this.timestampExpression.getValue(this.evaluationContext, message, Long.class) : messageHeaders.get(KafkaHeaders.TIMESTAMP, Long.class);<NEW_LINE>V payload = (V) message.getPayload();<NEW_LINE>if (payload instanceof KafkaNull) {<NEW_LINE>payload = null;<NEW_LINE>}<NEW_LINE>Headers headers = null;<NEW_LINE>if (this.headerMapper != null) {<NEW_LINE>headers = new RecordHeaders();<NEW_LINE>this.headerMapper.fromHeaders(messageHeaders, headers);<NEW_LINE>}<NEW_LINE>return this.producerRecordCreator.create(message, topic, partitionId, timestamp, (K) messageKey, payload, headers);<NEW_LINE>} | KafkaHeaders.PARTITION_ID, Integer.class); |
687,867 | private void logFlavors(Transferable trans, Level level, boolean content) {<NEW_LINE>if (trans == null) {<NEW_LINE>log.log(level, " no clipboard contents");<NEW_LINE>} else {<NEW_LINE>if (content) {<NEW_LINE>java.awt.datatransfer.DataFlavor[<MASK><NEW_LINE>StringBuilder sb = new StringBuilder();<NEW_LINE>for (int i = 0; i < arr.length; i++) {<NEW_LINE>sb.append(" ").append(i).append(" = ").append(arr[i]);<NEW_LINE>try {<NEW_LINE>sb.append(" contains: ").append(trans.getTransferData(arr[i]));<NEW_LINE>} catch (UnsupportedFlavorException ex) {<NEW_LINE>log.log(level, "Can't convert to " + arr[i], ex);<NEW_LINE>} catch (IOException ex) {<NEW_LINE>log.log(level, "Can't convert to " + arr[i], ex);<NEW_LINE>}<NEW_LINE>sb.append("\n");<NEW_LINE>}<NEW_LINE>log.log(level, sb.toString());<NEW_LINE>} else {<NEW_LINE>log.log(level, " clipboard contains data");<NEW_LINE>}<NEW_LINE>}<NEW_LINE>} | ] arr = trans.getTransferDataFlavors(); |
1,528,787 | public void execute() throws UserException {<NEW_LINE>if (MailSystem.isValidEmailAddress(user.getUsername())) {<NEW_LINE>EmailMessage message = bimServer<MASK><NEW_LINE>String body = null;<NEW_LINE>String subject = null;<NEW_LINE>try {<NEW_LINE>InternetAddress addressFrom = new InternetAddress(bimServer.getServerSettingsCache().getServerSettings().getEmailSenderAddress());<NEW_LINE>message.setFrom(addressFrom);<NEW_LINE>InternetAddress[] addressTo = new InternetAddress[1];<NEW_LINE>addressTo[0] = new InternetAddress(user.getUsername());<NEW_LINE>message.setRecipients(Message.RecipientType.TO, addressTo);<NEW_LINE>Map<String, Object> context = new HashMap<String, Object>();<NEW_LINE>context.put("name", user.getName());<NEW_LINE>context.put("username", user.getUsername());<NEW_LINE>if (includeSiteAddress) {<NEW_LINE>context.put("siteaddress", bimServer.getServerSettingsCache().getServerSettings().getSiteAddress());<NEW_LINE>}<NEW_LINE>context.put("validationlink", resetUrl + "&username=" + user.getUsername() + "&uoid=" + user.getOid() + "&validationtoken=" + token + (includeSiteAddress ? ("&address=" + bimServer.getServerSettingsCache().getServerSettings().getSiteAddress()) : ""));<NEW_LINE>body = bimServer.getTemplateEngine().process(context, TemplateIdentifier.PASSWORD_RESET_EMAIL_BODY);<NEW_LINE>subject = bimServer.getTemplateEngine().process(context, TemplateIdentifier.PASSWORD_RESET_EMAIL_SUBJECT);<NEW_LINE>message.setContent(body, "text/html");<NEW_LINE>message.setSubject(subject.trim());<NEW_LINE>message.send();<NEW_LINE>} catch (Exception e) {<NEW_LINE>LOGGER.error(body);<NEW_LINE>throw new UserException(e.getMessage());<NEW_LINE>}<NEW_LINE>}<NEW_LINE>} | .getMailSystem().createMessage(); |
936,346 | public <T> Flux<T> execute(RedisScript<T> script, List<K> keys, List<?> args, RedisElementWriter<?> argsWriter, RedisElementReader<T> resultReader) {<NEW_LINE>Assert.notNull(script, "RedisScript must not be null!");<NEW_LINE>Assert.notNull(argsWriter, "Argument Writer must not be null!");<NEW_LINE>Assert.notNull(resultReader, "Result Reader must not be null!");<NEW_LINE>Assert.notNull(keys, "Keys must not be null!");<NEW_LINE>Assert.notNull(args, "Args must not be null!");<NEW_LINE>return execute(connection -> {<NEW_LINE>ReturnType returnType = ReturnType.fromJavaType(script.getResultType());<NEW_LINE>ByteBuffer[] keysAndArgs = <MASK><NEW_LINE>int keySize = keys.size();<NEW_LINE>return eval(connection, script, returnType, keySize, keysAndArgs, resultReader);<NEW_LINE>});<NEW_LINE>} | keysAndArgs(argsWriter, keys, args); |
660,036 | protected void validate() {<NEW_LINE>super.validate();<NEW_LINE>Assert.notNull(getClaims().get(OidcProviderMetadataClaimNames.JWKS_URI), "jwksUri cannot be null");<NEW_LINE>Assert.notNull(getClaims().get(OidcProviderMetadataClaimNames.SUBJECT_TYPES_SUPPORTED), "subjectTypes cannot be null");<NEW_LINE>Assert.isInstanceOf(List.class, getClaims().get(OidcProviderMetadataClaimNames.SUBJECT_TYPES_SUPPORTED), "subjectTypes must be of type List");<NEW_LINE>Assert.notEmpty((List<?>) getClaims().get(OidcProviderMetadataClaimNames.SUBJECT_TYPES_SUPPORTED), "subjectTypes cannot be empty");<NEW_LINE>Assert.notNull(getClaims().get(OidcProviderMetadataClaimNames.ID_TOKEN_SIGNING_ALG_VALUES_SUPPORTED), "idTokenSigningAlgorithms cannot be null");<NEW_LINE>Assert.isInstanceOf(List.class, getClaims().get<MASK><NEW_LINE>Assert.notEmpty((List<?>) getClaims().get(OidcProviderMetadataClaimNames.ID_TOKEN_SIGNING_ALG_VALUES_SUPPORTED), "idTokenSigningAlgorithms cannot be empty");<NEW_LINE>if (getClaims().get(OidcProviderMetadataClaimNames.USER_INFO_ENDPOINT) != null) {<NEW_LINE>validateURL(getClaims().get(OidcProviderMetadataClaimNames.USER_INFO_ENDPOINT), "userInfoEndpoint must be a valid URL");<NEW_LINE>}<NEW_LINE>} | (OidcProviderMetadataClaimNames.ID_TOKEN_SIGNING_ALG_VALUES_SUPPORTED), "idTokenSigningAlgorithms must be of type List"); |
1,638,469 | public void openTorrent(String fileName, String save_path) {<NEW_LINE>String uc_filename = fileName.toUpperCase(Locale.US);<NEW_LINE>boolean is_remote = uc_filename.startsWith("HTTP://") || uc_filename.startsWith("HTTPS://") || uc_filename.startsWith("MAGNET:");<NEW_LINE>if (console != null) {<NEW_LINE>// System.out.println("NOT NULL CONSOLE. CAN PASS STRAIGHT TO IT!");<NEW_LINE>if (is_remote) {<NEW_LINE>console.out.println("Downloading torrent from url: " + fileName);<NEW_LINE>if (save_path == null) {<NEW_LINE>console.downloadRemoteTorrent(fileName);<NEW_LINE>} else {<NEW_LINE>console.downloadRemoteTorrent(fileName, save_path);<NEW_LINE>}<NEW_LINE>} else {<NEW_LINE>console.out.println("Open Torrent " + fileName);<NEW_LINE>if (save_path == null) {<NEW_LINE>console.downloadTorrent(fileName);<NEW_LINE>} else {<NEW_LINE>console.downloadTorrent(fileName, save_path);<NEW_LINE>}<NEW_LINE>}<NEW_LINE>return;<NEW_LINE>} else {<NEW_LINE>// System.out.println("NULL CONSOLE");<NEW_LINE>}<NEW_LINE>if (is_remote) {<NEW_LINE>if (console != null) {<NEW_LINE>console.out.println("Downloading torrent from url: " + fileName);<NEW_LINE>}<NEW_LINE>if (save_path == null) {<NEW_LINE>TorrentDownloaderFactory.downloadManaged(fileName);<NEW_LINE>} else {<NEW_LINE>TorrentDownloaderFactory.downloadToLocationManaged(fileName, save_path);<NEW_LINE>}<NEW_LINE>return;<NEW_LINE>}<NEW_LINE>try {<NEW_LINE>if (!TorrentUtils.isTorrentFile(fileName)) {<NEW_LINE>// $NON-NLS-1$<NEW_LINE>System.err.println(fileName + " doesn't seem to be a torrent file. Not added.");<NEW_LINE>return;<NEW_LINE>}<NEW_LINE>} catch (Exception e) {<NEW_LINE>System.err.println("Something is wrong with " + fileName + ". Not added. (Reason: " + e.getMessage() + ")");<NEW_LINE>return;<NEW_LINE>}<NEW_LINE>if (core.getGlobalManager() != null) {<NEW_LINE>try {<NEW_LINE>String downloadDir = save_path != null ? save_path : COConfigurationManager.getDirectoryParameter("Default save path");<NEW_LINE>if (console != null) {<NEW_LINE>console.out.println(<MASK><NEW_LINE>}<NEW_LINE>core.getGlobalManager().addDownloadManager(fileName, downloadDir);<NEW_LINE>} catch (Exception e) {<NEW_LINE>System.err.println("The torrent " + fileName + " could not be added. " + e);<NEW_LINE>}<NEW_LINE>}<NEW_LINE>} | "Adding torrent: " + fileName + " and saving to " + downloadDir); |
1,493,869 | // driver method<NEW_LINE>public static void main(String[] args) {<NEW_LINE>Scanner sc = new Scanner(System.in);<NEW_LINE>System.out.println("Enter the size of the array: ");<NEW_LINE>int size = sc.nextInt();<NEW_LINE><MASK><NEW_LINE>int target = sc.nextInt();<NEW_LINE>int[] nums = new int[size];<NEW_LINE>System.out.println("Enter the elements of array: ");<NEW_LINE>for (int i = 0; i < size; i++) {<NEW_LINE>nums[i] = sc.nextInt();<NEW_LINE>}<NEW_LINE>List<Integer[]> tripletEvaluated = threeSum(nums, target);<NEW_LINE>System.out.println("The triplet values are: ");<NEW_LINE>for (Integer[] triplets : tripletEvaluated) {<NEW_LINE>for (int numb : triplets) {<NEW_LINE>System.out.print(numb + " ");<NEW_LINE>}<NEW_LINE>System.out.println();<NEW_LINE>}<NEW_LINE>} | System.out.println("Enter the target value: "); |
124,923 | protected boolean transform(UseOnContext context, BlockState original, boolean playSound) {<NEW_LINE>if (super.transform(context, original, playSound)) {<NEW_LINE>return true;<NEW_LINE>}<NEW_LINE>// shovel special case: campfires<NEW_LINE>if (original.getBlock() instanceof CampfireBlock && original.getValue(CampfireBlock.LIT)) {<NEW_LINE>Level level = context.getLevel();<NEW_LINE>BlockPos pos = context.getClickedPos();<NEW_LINE>if (!level.isClientSide) {<NEW_LINE>if (playSound) {<NEW_LINE>level.playSound(null, pos, SoundEvents.GENERIC_EXTINGUISH_FIRE, <MASK><NEW_LINE>}<NEW_LINE>CampfireBlock.dowse(context.getPlayer(), level, pos, original);<NEW_LINE>}<NEW_LINE>level.setBlock(pos, original.setValue(CampfireBlock.LIT, false), Block.UPDATE_ALL_IMMEDIATE);<NEW_LINE>return true;<NEW_LINE>}<NEW_LINE>return false;<NEW_LINE>} | SoundSource.BLOCKS, 1.0F, 1.0F); |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.