idx int32 46 1.86M | input stringlengths 321 6.6k | target stringlengths 9 1.24k |
|---|---|---|
223,123 | private void loadNode566() {<NEW_LINE>PropertyTypeNode node = new PropertyTypeNode(this.context, Identifiers.AuditCreateSessionEventType_ClientCertificate, new QualifiedName(0, "ClientCertificate"), new LocalizedText("en", "ClientCertificate"), LocalizedText.NULL_VALUE, UInteger.valueOf(0), UInteger.valueOf(0), new DataValue(Variant.NULL_VALUE), Identifiers.ByteString, -1, new UInteger[] {}, UByte.valueOf(1), UByte.valueOf<MASK><NEW_LINE>node.addReference(new Reference(Identifiers.AuditCreateSessionEventType_ClientCertificate, Identifiers.HasTypeDefinition, Identifiers.PropertyType.expanded(), true));<NEW_LINE>node.addReference(new Reference(Identifiers.AuditCreateSessionEventType_ClientCertificate, Identifiers.HasModellingRule, Identifiers.ModellingRule_Mandatory.expanded(), true));<NEW_LINE>node.addReference(new Reference(Identifiers.AuditCreateSessionEventType_ClientCertificate, Identifiers.HasProperty, Identifiers.AuditCreateSessionEventType.expanded(), false));<NEW_LINE>this.nodeManager.addNode(node);<NEW_LINE>} | (1), 0.0, false); |
884,011 | public void transformClass(ClassHolder cls, ClassHolderTransformerContext context) {<NEW_LINE>int suffix = 0;<NEW_LINE>for (MethodHolder method : cls.getMethods()) {<NEW_LINE>if (method.hasModifier(ElementModifier.NATIVE) && method.getAnnotations().get(Async.class.getName()) != null && method.getAnnotations().get(GeneratedBy.class.getName()) == null) {<NEW_LINE>ValueType[] signature = new ValueType[method.parameterCount() + 2];<NEW_LINE>for (int i = 0; i < method.parameterCount(); ++i) {<NEW_LINE>signature[i<MASK><NEW_LINE>}<NEW_LINE>signature[method.parameterCount()] = ValueType.parse(AsyncCallback.class);<NEW_LINE>signature[method.parameterCount() + 1] = ValueType.VOID;<NEW_LINE>MethodDescriptor asyncDesc = new MethodDescriptor(method.getName(), signature);<NEW_LINE>MethodHolder asyncMethod = cls.getMethod(asyncDesc);<NEW_LINE>if (asyncMethod != null) {<NEW_LINE>if (asyncMethod.hasModifier(ElementModifier.STATIC) != method.hasModifier(ElementModifier.STATIC)) {<NEW_LINE>context.getDiagnostics().error(new CallLocation(method.getReference()), "Methods {{m0}} and {{m1}} must both be either static or non-static", method.getReference(), asyncMethod.getReference());<NEW_LINE>}<NEW_LINE>}<NEW_LINE>if (lowLevel) {<NEW_LINE>generateLowLevelCall(method, suffix++);<NEW_LINE>}<NEW_LINE>}<NEW_LINE>}<NEW_LINE>} | ] = method.parameterType(i); |
787,250 | public static DescribeRulesResponse unmarshall(DescribeRulesResponse describeRulesResponse, UnmarshallerContext _ctx) {<NEW_LINE>describeRulesResponse.setRequestId(_ctx.stringValue("DescribeRulesResponse.RequestId"));<NEW_LINE>List<Rule> rules = new ArrayList<Rule>();<NEW_LINE>for (int i = 0; i < _ctx.lengthValue("DescribeRulesResponse.Rules.Length"); i++) {<NEW_LINE>Rule rule = new Rule();<NEW_LINE>rule.setHealthCheckHttpCode(_ctx.stringValue("DescribeRulesResponse.Rules[" + i + "].HealthCheckHttpCode"));<NEW_LINE>rule.setVServerGroupId(_ctx.stringValue("DescribeRulesResponse.Rules[" + i + "].VServerGroupId"));<NEW_LINE>rule.setDomain(_ctx.stringValue<MASK><NEW_LINE>rule.setCookie(_ctx.stringValue("DescribeRulesResponse.Rules[" + i + "].Cookie"));<NEW_LINE>rule.setHealthCheckInterval(_ctx.integerValue("DescribeRulesResponse.Rules[" + i + "].HealthCheckInterval"));<NEW_LINE>rule.setUrl(_ctx.stringValue("DescribeRulesResponse.Rules[" + i + "].Url"));<NEW_LINE>rule.setHealthCheckURI(_ctx.stringValue("DescribeRulesResponse.Rules[" + i + "].HealthCheckURI"));<NEW_LINE>rule.setStickySessionType(_ctx.stringValue("DescribeRulesResponse.Rules[" + i + "].StickySessionType"));<NEW_LINE>rule.setRuleName(_ctx.stringValue("DescribeRulesResponse.Rules[" + i + "].RuleName"));<NEW_LINE>rule.setRuleId(_ctx.stringValue("DescribeRulesResponse.Rules[" + i + "].RuleId"));<NEW_LINE>rule.setServiceManagedMode(_ctx.stringValue("DescribeRulesResponse.Rules[" + i + "].ServiceManagedMode"));<NEW_LINE>rule.setHealthCheckConnectPort(_ctx.integerValue("DescribeRulesResponse.Rules[" + i + "].HealthCheckConnectPort"));<NEW_LINE>rule.setScheduler(_ctx.stringValue("DescribeRulesResponse.Rules[" + i + "].Scheduler"));<NEW_LINE>rule.setHealthCheckTimeout(_ctx.integerValue("DescribeRulesResponse.Rules[" + i + "].HealthCheckTimeout"));<NEW_LINE>rule.setListenerSync(_ctx.stringValue("DescribeRulesResponse.Rules[" + i + "].ListenerSync"));<NEW_LINE>rule.setHealthyThreshold(_ctx.integerValue("DescribeRulesResponse.Rules[" + i + "].HealthyThreshold"));<NEW_LINE>rule.setCookieTimeout(_ctx.integerValue("DescribeRulesResponse.Rules[" + i + "].CookieTimeout"));<NEW_LINE>rule.setHealthCheckDomain(_ctx.stringValue("DescribeRulesResponse.Rules[" + i + "].HealthCheckDomain"));<NEW_LINE>rule.setUnhealthyThreshold(_ctx.integerValue("DescribeRulesResponse.Rules[" + i + "].UnhealthyThreshold"));<NEW_LINE>rule.setStickySession(_ctx.stringValue("DescribeRulesResponse.Rules[" + i + "].StickySession"));<NEW_LINE>rule.setHealthCheck(_ctx.stringValue("DescribeRulesResponse.Rules[" + i + "].HealthCheck"));<NEW_LINE>rules.add(rule);<NEW_LINE>}<NEW_LINE>describeRulesResponse.setRules(rules);<NEW_LINE>return describeRulesResponse;<NEW_LINE>} | ("DescribeRulesResponse.Rules[" + i + "].Domain")); |
1,128,762 | private JSONObject evaluateOnCallFrame(String frameId, String expression) {<NEW_LINE>Utils.logVerbose("Evaluating expression \"" + expression + "\" on frame: " + frameId);<NEW_LINE>JSONObject response = new JSONObject();<NEW_LINE>try {<NEW_LINE>Value value = getContextManager().getEvaluationManager().evaluateOnCallFrame(frameId, expression);<NEW_LINE>RemoteObjectDescription description = new RemoteObjectDescription(getContextManager().getRemoteObjectManager(), value);<NEW_LINE>JSONObject result = description.getSerializedObject();<NEW_LINE>response.put("result", result);<NEW_LINE>response.put("wasThrown", false);<NEW_LINE>} catch (Exception ex) {<NEW_LINE>Utils.logException("Failed to evaluate " + expression + " on frameId " + frameId, ex);<NEW_LINE>JSONObject result = new JSONObject();<NEW_LINE>result.put("type", "string");<NEW_LINE>result.put("subtype", "error");<NEW_LINE>result.put(<MASK><NEW_LINE>StringWriter sw = new StringWriter();<NEW_LINE>ex.printStackTrace(new PrintWriter(sw));<NEW_LINE>result.put("exceptionDetails", sw.toString());<NEW_LINE>response.put("result", result);<NEW_LINE>response.put("wasThrown", true);<NEW_LINE>}<NEW_LINE>return response;<NEW_LINE>} | "value", ex.toString()); |
1,155,425 | public byte[] doInTransform(Instrumentor instrumentor, ClassLoader loader, String className, Class<?> classBeingRedefined, ProtectionDomain protectionDomain, byte[] classfileBuffer) throws InstrumentException {<NEW_LINE>InstrumentClass target = instrumentor.getInstrumentClass(loader, className, classfileBuffer);<NEW_LINE>if (!target.isInterceptable()) {<NEW_LINE>return null;<NEW_LINE>}<NEW_LINE><MASK><NEW_LINE>InstrumentMethod connect = InstrumentUtils.findMethod(target, "getCollection", "java.lang.String", "java.lang.Class");<NEW_LINE>connect.addScopedInterceptor(MongoDriverGetCollectionInterceptor.class, MONGO_SCOPE, ExecutionPolicy.BOUNDARY);<NEW_LINE>InstrumentMethod getReadPreference = InstrumentUtils.findMethod(target, "withReadPreference", "com.mongodb.ReadPreference");<NEW_LINE>getReadPreference.addScopedInterceptor(MongoReadPreferenceInterceptor.class, MONGO_SCOPE, ExecutionPolicy.BOUNDARY);<NEW_LINE>InstrumentMethod getWriteConcern = InstrumentUtils.findMethod(target, "withWriteConcern", "com.mongodb.WriteConcern");<NEW_LINE>getWriteConcern.addScopedInterceptor(MongoWriteConcernInterceptor.class, MONGO_SCOPE, ExecutionPolicy.BOUNDARY);<NEW_LINE>return target.toBytecode();<NEW_LINE>} | target.addField(DatabaseInfoAccessor.class); |
602,360 | private void verifyHostname(X509Certificate cert) throws CertificateParsingException {<NEW_LINE>try {<NEW_LINE>Collection sans = cert.getSubjectAlternativeNames();<NEW_LINE>if (sans == null) {<NEW_LINE>String dn = cert.getSubjectX500Principal().getName();<NEW_LINE>LdapName ln = new LdapName(dn);<NEW_LINE>for (Rdn rdn : ln.getRdns()) {<NEW_LINE>if (rdn.getType().equalsIgnoreCase("CN")) {<NEW_LINE>String peer = client.getServerName().toLowerCase();<NEW_LINE>if (peer.equals(((String) rdn.getValue()).toLowerCase()))<NEW_LINE>return;<NEW_LINE>}<NEW_LINE>}<NEW_LINE>} else {<NEW_LINE><MASK><NEW_LINE>while (i.hasNext()) {<NEW_LINE>List nxt = (List) i.next();<NEW_LINE>if (((Integer) nxt.get(0)).intValue() == 2) {<NEW_LINE>String peer = client.getServerName().toLowerCase();<NEW_LINE>if (peer.equals(((String) nxt.get(1)).toLowerCase()))<NEW_LINE>return;<NEW_LINE>} else if (((Integer) nxt.get(0)).intValue() == 7) {<NEW_LINE>String peer = ((CConn) client).getSocket().getPeerAddress();<NEW_LINE>if (peer.equals(((String) nxt.get(1)).toLowerCase()))<NEW_LINE>return;<NEW_LINE>}<NEW_LINE>}<NEW_LINE>}<NEW_LINE>Object[] answer = { "YES", "NO" };<NEW_LINE>int ret = JOptionPane.showOptionDialog(null, "Hostname (" + client.getServerName() + ") does not match the" + " server certificate, do you want to continue?", "Certificate hostname mismatch", JOptionPane.YES_NO_OPTION, JOptionPane.WARNING_MESSAGE, null, answer, answer[0]);<NEW_LINE>if (ret != JOptionPane.YES_OPTION)<NEW_LINE>throw new WarningException("Certificate hostname mismatch.");<NEW_LINE>} catch (CertificateParsingException e) {<NEW_LINE>throw new SystemException(e.getMessage());<NEW_LINE>} catch (InvalidNameException e) {<NEW_LINE>throw new SystemException(e.getMessage());<NEW_LINE>}<NEW_LINE>} | Iterator i = sans.iterator(); |
1,818,583 | public void show(String title) {<NEW_LINE>dialog = new Shell(Display.getDefault(), SWT.APPLICATION_MODAL | SWT.DIALOG_TRIM | SWT.RESIZE);<NEW_LINE>dialog.setText(title);<NEW_LINE>dialog.setLayout(new GridLayout(1, true));<NEW_LINE>tabFolder = new TabFolder(dialog, SWT.BORDER);<NEW_LINE>tabFolder.setLayoutData(new GridData(SWT.FILL, SWT.FILL, true, true));<NEW_LINE>serviceTab = new TabItem(tabFolder, SWT.NULL);<NEW_LINE>serviceTab.setText("Service");<NEW_LINE>serviceTab<MASK><NEW_LINE>sqlTab = new TabItem(tabFolder, SWT.NULL);<NEW_LINE>sqlTab.setText("SQL");<NEW_LINE>sqlTab.setControl(getSqlControl(tabFolder));<NEW_LINE>apicallTab = new TabItem(tabFolder, SWT.NULL);<NEW_LINE>apicallTab.setText("API Call");<NEW_LINE>apicallTab.setControl(getApicallControl(tabFolder));<NEW_LINE>ipTab = new TabItem(tabFolder, SWT.NULL);<NEW_LINE>ipTab.setText("IP");<NEW_LINE>ipTab.setControl(getIpControl(tabFolder));<NEW_LINE>userAgentTab = new TabItem(tabFolder, SWT.NULL);<NEW_LINE>userAgentTab.setText("User-Agent");<NEW_LINE>userAgentTab.setControl(getUaControl(tabFolder));<NEW_LINE>errorTab = new TabItem(tabFolder, SWT.NULL);<NEW_LINE>errorTab.setText("Exception");<NEW_LINE>errorTab.setControl(getErrorControl(tabFolder));<NEW_LINE>alertTab = new TabItem(tabFolder, SWT.NULL);<NEW_LINE>alertTab.setText("Alert");<NEW_LINE>alertTab.setControl(getAlertControl(tabFolder));<NEW_LINE>Button closeBtn = new Button(dialog, SWT.PUSH);<NEW_LINE>GridData gr = new GridData(SWT.RIGHT, SWT.FILL, false, false);<NEW_LINE>gr.widthHint = 100;<NEW_LINE>closeBtn.setLayoutData(gr);<NEW_LINE>closeBtn.setText("&Close");<NEW_LINE>closeBtn.addSelectionListener(new SelectionAdapter() {<NEW_LINE><NEW_LINE>public void widgetSelected(SelectionEvent e) {<NEW_LINE>dialog.close();<NEW_LINE>}<NEW_LINE>});<NEW_LINE>dialog.pack();<NEW_LINE>dialog.open();<NEW_LINE>} | .setControl(getServiceControl(tabFolder)); |
1,767,098 | final DescribeApplicationResult executeDescribeApplication(DescribeApplicationRequest describeApplicationRequest) {<NEW_LINE>ExecutionContext executionContext = createExecutionContext(describeApplicationRequest);<NEW_LINE>AWSRequestMetrics awsRequestMetrics = executionContext.getAwsRequestMetrics();<NEW_LINE>awsRequestMetrics.startEvent(Field.ClientExecuteTime);<NEW_LINE>Request<DescribeApplicationRequest> request = null;<NEW_LINE>Response<DescribeApplicationResult> response = null;<NEW_LINE>try {<NEW_LINE>awsRequestMetrics.startEvent(Field.RequestMarshallTime);<NEW_LINE>try {<NEW_LINE>request = new DescribeApplicationRequestProtocolMarshaller(protocolFactory).marshall<MASK><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, "IoTFleetHub");<NEW_LINE>request.addHandlerContext(HandlerContextKey.OPERATION_NAME, "DescribeApplication");<NEW_LINE>request.addHandlerContext(HandlerContextKey.ADVANCED_CONFIG, advancedConfig);<NEW_LINE>} finally {<NEW_LINE>awsRequestMetrics.endEvent(Field.RequestMarshallTime);<NEW_LINE>}<NEW_LINE>HttpResponseHandler<AmazonWebServiceResponse<DescribeApplicationResult>> responseHandler = protocolFactory.createResponseHandler(new JsonOperationMetadata().withPayloadJson(true).withHasStreamingSuccessResponse(false), new DescribeApplicationResultJsonUnmarshaller());<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>} | (super.beforeMarshalling(describeApplicationRequest)); |
994,649 | public UpdateDataRepositoryAssociationResult unmarshall(JsonUnmarshallerContext context) throws Exception {<NEW_LINE>UpdateDataRepositoryAssociationResult updateDataRepositoryAssociationResult = new UpdateDataRepositoryAssociationResult();<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 updateDataRepositoryAssociationResult;<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("Association", targetDepth)) {<NEW_LINE>context.nextToken();<NEW_LINE>updateDataRepositoryAssociationResult.setAssociation(DataRepositoryAssociationJsonUnmarshaller.getInstance().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 updateDataRepositoryAssociationResult;<NEW_LINE>} | JsonToken token = context.getCurrentToken(); |
1,439,410 | final ModifyVpcTenancyResult executeModifyVpcTenancy(ModifyVpcTenancyRequest modifyVpcTenancyRequest) {<NEW_LINE>ExecutionContext executionContext = createExecutionContext(modifyVpcTenancyRequest);<NEW_LINE>AWSRequestMetrics awsRequestMetrics = executionContext.getAwsRequestMetrics();<NEW_LINE>awsRequestMetrics.startEvent(Field.ClientExecuteTime);<NEW_LINE>Request<ModifyVpcTenancyRequest> request = null;<NEW_LINE>Response<ModifyVpcTenancyResult> response = null;<NEW_LINE>try {<NEW_LINE>awsRequestMetrics.startEvent(Field.RequestMarshallTime);<NEW_LINE>try {<NEW_LINE>request = new ModifyVpcTenancyRequestMarshaller().marshall(super.beforeMarshalling(modifyVpcTenancyRequest));<NEW_LINE>// Binds the request metrics to the current request.<NEW_LINE>request.setAWSRequestMetrics(awsRequestMetrics);<NEW_LINE>request.addHandlerContext(HandlerContextKey.CLIENT_ENDPOINT, endpoint);<NEW_LINE>request.addHandlerContext(HandlerContextKey.ENDPOINT_OVERRIDDEN, isEndpointOverridden());<NEW_LINE>request.addHandlerContext(HandlerContextKey.SIGNING_REGION, getSigningRegion());<NEW_LINE>request.addHandlerContext(HandlerContextKey.SERVICE_ID, "EC2");<NEW_LINE>request.<MASK><NEW_LINE>request.addHandlerContext(HandlerContextKey.ADVANCED_CONFIG, advancedConfig);<NEW_LINE>} finally {<NEW_LINE>awsRequestMetrics.endEvent(Field.RequestMarshallTime);<NEW_LINE>}<NEW_LINE>StaxResponseHandler<ModifyVpcTenancyResult> responseHandler = new StaxResponseHandler<ModifyVpcTenancyResult>(new ModifyVpcTenancyResultStaxUnmarshaller());<NEW_LINE>response = invoke(request, responseHandler, executionContext);<NEW_LINE>return response.getAwsResponse();<NEW_LINE>} finally {<NEW_LINE>endClientExecution(awsRequestMetrics, request, response);<NEW_LINE>}<NEW_LINE>} | addHandlerContext(HandlerContextKey.OPERATION_NAME, "ModifyVpcTenancy"); |
658,691 | public void run(RegressionEnvironment env) {<NEW_LINE>String[] fields = "c0,c1,c2".split(",");<NEW_LINE>String epl = "@name('s0') select " + "value < all (select sum(intPrimitive) from SupportBean#keepall group by theString) as c0, " + "value < any (select sum(intPrimitive) from SupportBean#keepall group by theString) as c1, " + "value < some (select sum(intPrimitive) from SupportBean#keepall group by theString) as c2 " + "from SupportValueEvent";<NEW_LINE><MASK><NEW_LINE>sendVEAndAssert(env, fields, 10, new Object[] { true, false, false });<NEW_LINE>env.sendEventBean(new SupportBean("E1", 19));<NEW_LINE>env.sendEventBean(new SupportBean("E2", 11));<NEW_LINE>sendVEAndAssert(env, fields, 10, new Object[] { true, true, true });<NEW_LINE>env.sendEventBean(new SupportBean("E3", 9));<NEW_LINE>sendVEAndAssert(env, fields, 10, new Object[] { false, true, true });<NEW_LINE>env.undeployAll();<NEW_LINE>} | env.compileDeployAddListenerMileZero(epl, "s0"); |
1,086,364 | public void error(Exception e) {<NEW_LINE>String id = StringTools.uniqueToken();<NEW_LINE>String formattedMessage = this.message(id, e);<NEW_LINE>if (internalLogger.isErrorEnabled()) {<NEW_LINE>internalLogger.error(formattedMessage, e);<NEW_LINE>}<NEW_LINE>new Thread(() -> {<NEW_LINE>try {<NEW_LINE>Map<String, Object> parameters = new HashMap<>();<NEW_LINE>parameters.put(PARAMETER_ID, id);<NEW_LINE>parameters.put(PARAMETER_VERSION, Config.version());<NEW_LINE>parameters.put(PARAMETER_OCCURTIME, DateTools.now());<NEW_LINE>parameters.put(PARAMETER_LOGGERNAME, this.getName());<NEW_LINE>parameters.put(PARAMETER_EXCEPTIONCLASS, e.getClass().getName());<NEW_LINE>parameters.put(<MASK><NEW_LINE>parameters.put(PARAMETER_STACKTRACE, ExceptionUtils.getStackTrace(e));<NEW_LINE>if (e instanceof PromptException) {<NEW_LINE>String url = Config.url_x_program_center_jaxrs("prompterrorlog");<NEW_LINE>CipherConnectionAction.post(false, url, parameters);<NEW_LINE>} else {<NEW_LINE>String url = Config.url_x_program_center_jaxrs("unexpectederrorlog");<NEW_LINE>CipherConnectionAction.post(false, url, parameters);<NEW_LINE>}<NEW_LINE>} catch (Exception ex) {<NEW_LINE>ex.printStackTrace();<NEW_LINE>}<NEW_LINE>}, Logger.class.getName() + "-error").start();<NEW_LINE>} | PARAMETER_MESSAGE, e.getMessage()); |
652,757 | public Object pushObject(final String groupName, final String path, final ObjectWriterDelegate writerDelegate, final Serializable object, final Map<String, Serializable> extraMeta) throws DotDataException {<NEW_LINE>if (!this.existsGroup(groupName)) {<NEW_LINE>throw new IllegalArgumentException(String<MASK><NEW_LINE>}<NEW_LINE>final File groupDir = groups.get(groupName.toLowerCase());<NEW_LINE>if (groupDir.canWrite()) {<NEW_LINE>try {<NEW_LINE>final File destBucketFile = Paths.get(groupDir.getCanonicalPath(), path.toLowerCase()).toFile();<NEW_LINE>this.prepareParent(destBucketFile);<NEW_LINE>final String compressor = Config.getStringProperty("CONTENT_METADATA_COMPRESSOR", "none");<NEW_LINE>try (OutputStream outputStream = FileUtil.createOutputStream(destBucketFile.toPath(), compressor)) {<NEW_LINE>writerDelegate.write(outputStream, object);<NEW_LINE>outputStream.flush();<NEW_LINE>}<NEW_LINE>} catch (IOException e) {<NEW_LINE>Logger.error(FileSystemStoragePersistenceAPIImpl.class, e.getMessage(), e);<NEW_LINE>throw new DotDataException(e.getMessage(), e);<NEW_LINE>}<NEW_LINE>} else {<NEW_LINE>throw new IllegalArgumentException("The bucket: " + groupName + " could not write");<NEW_LINE>}<NEW_LINE>return true;<NEW_LINE>} | .format(THE_BUCKET_NAME_S_DOES_NOT_HAVE_ANY_FILE_MAPPED, groupName)); |
1,507,341 | public static Pack triggerThreadList() {<NEW_LINE>PrintWriter out = null;<NEW_LINE>MapPack pack = new MapPack();<NEW_LINE>try {<NEW_LINE>File file = DumpUtil.getDumpFile("scouter.threads");<NEW_LINE>out = new PrintWriter(new FileWriter(file));<NEW_LINE>MapPack mpack = ThreadUtil.getThreadList();<NEW_LINE>ListValue ids = mpack.getList("id");<NEW_LINE>ListValue name = mpack.getList("name");<NEW_LINE>ListValue stat = mpack.getList("stat");<NEW_LINE>ListValue cpu = mpack.getList("cpu");<NEW_LINE>for (int i = 0; i < ids.size(); i++) {<NEW_LINE>long tid = CastUtil.clong(ids.get(i));<NEW_LINE>out.print(i + ":");<NEW_LINE>out.print(tid + ":");<NEW_LINE>out.print(name.get(i) + ":");<NEW_LINE>out.print(stat.get(i) + ":");<NEW_LINE>out.print("cpu " + cpu.get(i));<NEW_LINE>TraceContext ctx = TraceContextManager.getContextByThreadId(tid);<NEW_LINE>if (ctx != null) {<NEW_LINE>out.print(":service " + Hexa32.toString32<MASK><NEW_LINE>out.print(ctx.serviceName + ":");<NEW_LINE>long etime = System.currentTimeMillis() - ctx.startTime;<NEW_LINE>out.print(etime + " ms");<NEW_LINE>}<NEW_LINE>out.println("");<NEW_LINE>printStack(out, tid);<NEW_LINE>out.println("");<NEW_LINE>pack.put("name", file.getName());<NEW_LINE>}<NEW_LINE>} catch (Throwable e) {<NEW_LINE>e.printStackTrace();<NEW_LINE>} finally {<NEW_LINE>FileUtil.close(out);<NEW_LINE>}<NEW_LINE>return pack;<NEW_LINE>} | (ctx.txid) + ":"); |
232,250 | public T newInstance() {<NEW_LINE>T instance;<NEW_LINE>try {<NEW_LINE>InvocationHandlerImpl<T> handler = new InvocationHandlerImpl<T>(this);<NEW_LINE>if (dynamic) {<NEW_LINE>instance = cls.newInstance();<NEW_LINE>((DynamicObject) instance).delegate((DynamicObjectDelegate) handler);<NEW_LINE>} else {<NEW_LINE>instance = ctor.newInstance(new Object[] { handler });<NEW_LINE>handler.setProxy(instance);<NEW_LINE>}<NEW_LINE>return instance;<NEW_LINE>} catch (InstantiationException ex) {<NEW_LINE>throw new ClusterJException(local.message("ERR_Create_Instance", cls.getName()), ex);<NEW_LINE>} catch (IllegalAccessException ex) {<NEW_LINE>throw new ClusterJException(local.message("ERR_Create_Instance", cls<MASK><NEW_LINE>} catch (IllegalArgumentException ex) {<NEW_LINE>throw new ClusterJException(local.message("ERR_Create_Instance", cls.getName()), ex);<NEW_LINE>} catch (InvocationTargetException ex) {<NEW_LINE>throw new ClusterJException(local.message("ERR_Create_Instance", cls.getName()), ex);<NEW_LINE>} catch (SecurityException ex) {<NEW_LINE>throw new ClusterJException(local.message("ERR_Create_Instance", cls.getName()), ex);<NEW_LINE>}<NEW_LINE>} | .getName()), ex); |
116,306 | ParsingStage afterAtSign(int i) {<NEW_LINE>if (i == connectionUri.length()) {<NEW_LINE>throw new VertxException("Empty net location", true);<NEW_LINE>}<NEW_LINE>int j = <MASK><NEW_LINE>if (j >= i) {<NEW_LINE>return new Protocol(connectionUri, i, j, configuration);<NEW_LINE>}<NEW_LINE>if (connectionUri.charAt(i) == '(') {<NEW_LINE>throw new VertxException("TNS URL Format is not supported", true);<NEW_LINE>}<NEW_LINE>if (configuration.containsKey("user")) {<NEW_LINE>return hostOrIpV6(i);<NEW_LINE>}<NEW_LINE>j = connectionUri.lastIndexOf('?');<NEW_LINE>if (j < i)<NEW_LINE>j = connectionUri.length();<NEW_LINE>boolean invalidChar = false;<NEW_LINE>for (int k = i; k < j; k++) {<NEW_LINE>char c = connectionUri.charAt(k);<NEW_LINE>if (c == ',' || c == '/' || c == ':') {<NEW_LINE>invalidChar = true;<NEW_LINE>break;<NEW_LINE>}<NEW_LINE>}<NEW_LINE>if (!invalidChar) {<NEW_LINE>return new TnsAlias(connectionUri, i, j, configuration);<NEW_LINE>}<NEW_LINE>return hostOrIpV6(i);<NEW_LINE>} | connectionUri.indexOf("://", i); |
167,007 | public Object postProcessAfterInitialization(Object bean, String beanName) throws BeansException {<NEW_LINE>if (bean instanceof DynamicThreadPoolExecutor) {<NEW_LINE>DynamicThreadPool dynamicThreadPool;<NEW_LINE>try {<NEW_LINE>dynamicThreadPool = ApplicationContextHolder.findAnnotationOnBean(beanName, DynamicThreadPool.class);<NEW_LINE>if (Objects.isNull(dynamicThreadPool)) {<NEW_LINE>// Adapt to lower versions of SpringBoot.<NEW_LINE>dynamicThreadPool = DynamicThreadPoolAnnotationUtil.findAnnotationOnBean(beanName, DynamicThreadPool.class);<NEW_LINE>if (Objects.isNull(dynamicThreadPool)) {<NEW_LINE>return bean;<NEW_LINE>}<NEW_LINE>}<NEW_LINE>} catch (Exception ex) {<NEW_LINE><MASK><NEW_LINE>return bean;<NEW_LINE>}<NEW_LINE>DynamicThreadPoolExecutor dynamicExecutor = (DynamicThreadPoolExecutor) bean;<NEW_LINE>DynamicThreadPoolWrapper wrap = new DynamicThreadPoolWrapper(dynamicExecutor.getThreadPoolId(), dynamicExecutor);<NEW_LINE>ThreadPoolExecutor remoteExecutor = fillPoolAndRegister(wrap);<NEW_LINE>return remoteExecutor;<NEW_LINE>}<NEW_LINE>if (bean instanceof DynamicThreadPoolWrapper) {<NEW_LINE>DynamicThreadPoolWrapper wrap = (DynamicThreadPoolWrapper) bean;<NEW_LINE>registerAndSubscribe(wrap);<NEW_LINE>}<NEW_LINE>return bean;<NEW_LINE>} | log.error("Failed to create dynamic thread pool in annotation mode.", ex); |
1,242,352 | public static void loadJVMS() {<NEW_LINE>try {<NEW_LINE>Path path = Paths.get(new File(JVMS_HTML_FILENAME).toURI());<NEW_LINE>String html = new String(Files.readAllBytes(path), StandardCharsets.UTF_8);<NEW_LINE>int htmlLength = html.length();<NEW_LINE>String descStart = "<div class=\"section-execution\"";<NEW_LINE>int startPos = html.indexOf(descStart);<NEW_LINE>while (startPos != -1 && startPos < htmlLength) {<NEW_LINE>int endPos = html.indexOf(descStart, startPos + descStart.length());<NEW_LINE>if (endPos != -1) {<NEW_LINE>String desc = <MASK><NEW_LINE>storeBytecodeDescription(desc);<NEW_LINE>startPos = endPos;<NEW_LINE>} else if (startPos != -1) {<NEW_LINE>String desc = html.substring(startPos);<NEW_LINE>storeBytecodeDescription(desc);<NEW_LINE>break;<NEW_LINE>} else {<NEW_LINE>break;<NEW_LINE>}<NEW_LINE>}<NEW_LINE>} catch (IOException ioe) {<NEW_LINE>logger.error("", ioe);<NEW_LINE>}<NEW_LINE>} | html.substring(startPos, endPos); |
1,357,963 | private static InetSocketAddress parseHttpProxyAddress(String s) {<NEW_LINE>int <MASK><NEW_LINE>if (p < 0)<NEW_LINE>throw new IllegalArgumentException("Invalid http proxy option (missing port) - " + s);<NEW_LINE>String host = s.substring(0, p);<NEW_LINE>int port = -1;<NEW_LINE>try {<NEW_LINE>port = Integer.parseInt(s.substring(p + 1));<NEW_LINE>} catch (NumberFormatException e) {<NEW_LINE>throw new IllegalArgumentException("Invalid http proxy option (invalid port) - " + s);<NEW_LINE>}<NEW_LINE>if (port < 0 || port > 65535)<NEW_LINE>throw new IllegalArgumentException("Invalid http proxy option (invalid port range) - " + s);<NEW_LINE>InetAddress addr = null;<NEW_LINE>try {<NEW_LINE>addr = InetAddress.getByName(host);<NEW_LINE>} catch (Throwable t) {<NEW_LINE>throw new IllegalArgumentException("Invalid http proxy option (invalid host - " + t.getMessage() + ") - " + s);<NEW_LINE>}<NEW_LINE>return new InetSocketAddress(addr, port);<NEW_LINE>} | p = s.indexOf(':'); |
787,464 | public boolean delete(final Object model) {<NEW_LINE>if (model == null) {<NEW_LINE>throw new IllegalArgumentException("model is null");<NEW_LINE>}<NEW_LINE>final POJOWrapper wrapper = POJOWrapper.getWrapper(model);<NEW_LINE>if (wrapper == null) {<NEW_LINE>throw new IllegalArgumentException("model '" + model + "' is not wrapped from " + POJOWrapper.class);<NEW_LINE>}<NEW_LINE>//<NEW_LINE>// Check if deleting is allowed<NEW_LINE>if (InterfaceWrapperHelper.isSaveDeleteDisabled(model)) {<NEW_LINE>throw new AdempiereException("Save/Delete is disabled for " + model);<NEW_LINE>}<NEW_LINE>final int id = wrapper.getId();<NEW_LINE>if (id < 0) {<NEW_LINE>// not saved, nothing to delete<NEW_LINE>return false;<NEW_LINE>}<NEW_LINE>final String tableName = wrapper.getTableName();<NEW_LINE>final Map<Integer, Object> tableCachedObjects = cachedObjects.get(tableName);<NEW_LINE>if (tableCachedObjects == null) {<NEW_LINE>// not exists<NEW_LINE>return false;<NEW_LINE>}<NEW_LINE>final String trxName = wrapper.getTrxName();<NEW_LINE>final IMutable<Boolean> deleted = new Mutable<>(false);<NEW_LINE>runInTrx(trxName, new TrxRunnable2() {<NEW_LINE><NEW_LINE>@Override<NEW_LINE>public void run(String localTrxName) {<NEW_LINE>wrapper.setTrxName(localTrxName);<NEW_LINE>fireModelChanged(model, ModelChangeType.BEFORE_DELETE);<NEW_LINE>final Object removedObject = tableCachedObjects.remove(id);<NEW_LINE>deleted.setValue(removedObject != null);<NEW_LINE>boolean fireModelChangedSucceed = false;<NEW_LINE>try {<NEW_LINE><MASK><NEW_LINE>fireModelChangedSucceed = true;<NEW_LINE>} finally {<NEW_LINE>if (!fireModelChangedSucceed) {<NEW_LINE>tableCachedObjects.put(id, removedObject);<NEW_LINE>}<NEW_LINE>}<NEW_LINE>//<NEW_LINE>// Reset cache<NEW_LINE>CacheMgt.get().reset(tableName, id);<NEW_LINE>}<NEW_LINE><NEW_LINE>@Override<NEW_LINE>public boolean doCatch(Throwable e) throws Throwable {<NEW_LINE>throw e;<NEW_LINE>}<NEW_LINE><NEW_LINE>@Override<NEW_LINE>public void doFinally() {<NEW_LINE>wrapper.setTrxName(trxName);<NEW_LINE>}<NEW_LINE>});<NEW_LINE>return Boolean.TRUE.equals(deleted.getValue());<NEW_LINE>} | fireModelChanged(model, ModelChangeType.AFTER_DELETE); |
979,165 | private <I extends ComponentInfo> List<ResolveInfo> queryComponentsInManifest(Intent intent, Function<PackageInfo, I[]> componentsInPackage, SortedMap<ComponentName, List<IntentFilter>> filters, BiConsumer<ResolveInfo, I> componentSetter) {<NEW_LINE>synchronized (lock) {<NEW_LINE>if (isExplicitIntent(intent)) {<NEW_LINE>ComponentName component = getComponentForIntent(intent);<NEW_LINE>PackageInfo appPackage = packageInfos.get(component.getPackageName());<NEW_LINE>if (appPackage == null) {<NEW_LINE>return Collections.emptyList();<NEW_LINE>}<NEW_LINE>I componentInfo = findMatchingComponent(component, componentsInPackage.apply(appPackage));<NEW_LINE>if (componentInfo != null) {<NEW_LINE>ResolveInfo resolveInfo = buildResolveInfo(componentInfo);<NEW_LINE>componentSetter.accept(resolveInfo, componentInfo);<NEW_LINE>return new ArrayList<><MASK><NEW_LINE>}<NEW_LINE>return Collections.emptyList();<NEW_LINE>} else {<NEW_LINE>List<ResolveInfo> resolveInfoList = new ArrayList<>();<NEW_LINE>Map<ComponentName, List<IntentFilter>> filtersForPackage = mapForPackage(filters, intent.getPackage());<NEW_LINE>components: for (Map.Entry<ComponentName, List<IntentFilter>> componentEntry : filtersForPackage.entrySet()) {<NEW_LINE>ComponentName componentName = componentEntry.getKey();<NEW_LINE>for (IntentFilter filter : componentEntry.getValue()) {<NEW_LINE>int match = matchIntentFilter(intent, filter);<NEW_LINE>if (match > 0) {<NEW_LINE>PackageInfo packageInfo = packageInfos.get(componentName.getPackageName());<NEW_LINE>I[] componentInfoArray = componentsInPackage.apply(packageInfo);<NEW_LINE>for (I componentInfo : componentInfoArray) {<NEW_LINE>if (!componentInfo.name.equals(componentName.getClassName())) {<NEW_LINE>continue;<NEW_LINE>}<NEW_LINE>ResolveInfo resolveInfo = buildResolveInfo(componentInfo, filter);<NEW_LINE>resolveInfo.match = match;<NEW_LINE>componentSetter.accept(resolveInfo, componentInfo);<NEW_LINE>resolveInfoList.add(resolveInfo);<NEW_LINE>continue components;<NEW_LINE>}<NEW_LINE>}<NEW_LINE>}<NEW_LINE>}<NEW_LINE>return resolveInfoList;<NEW_LINE>}<NEW_LINE>}<NEW_LINE>} | (Collections.singletonList(resolveInfo)); |
1,365,920 | public WorldBorderMessage decode(ByteBuf buffer) throws IOException {<NEW_LINE>int actionId = ByteBufUtils.readVarInt(buffer);<NEW_LINE>Action action = Action.getAction(actionId);<NEW_LINE>switch(action) {<NEW_LINE>case SET_SIZE:<NEW_LINE>double radius = buffer.readDouble();<NEW_LINE>return new WorldBorderMessage(action, radius);<NEW_LINE>case LERP_SIZE:<NEW_LINE>double oldRadius = buffer.readDouble();<NEW_LINE>double newRadius = buffer.readDouble();<NEW_LINE>long speed = ByteBufUtils.readVarLong(buffer);<NEW_LINE>return new WorldBorderMessage(action, oldRadius, newRadius, speed);<NEW_LINE>case SET_CENTER:<NEW_LINE>double x = buffer.readDouble();<NEW_LINE>double z = buffer.readDouble();<NEW_LINE>return new WorldBorderMessage(action, x, z);<NEW_LINE>case INITIALIZE:<NEW_LINE>x = buffer.readDouble();<NEW_LINE>z = buffer.readDouble();<NEW_LINE>oldRadius = buffer.readDouble();<NEW_LINE>newRadius = buffer.readDouble();<NEW_LINE><MASK><NEW_LINE>int portalTeleportBoundary = ByteBufUtils.readVarInt(buffer);<NEW_LINE>int warningTime = ByteBufUtils.readVarInt(buffer);<NEW_LINE>int warningBlocks = ByteBufUtils.readVarInt(buffer);<NEW_LINE>return new WorldBorderMessage(action, x, z, oldRadius, newRadius, speed, portalTeleportBoundary, warningTime, warningBlocks);<NEW_LINE>case SET_WARNING_TIME:<NEW_LINE>case SET_WARNING_BLOCKS:<NEW_LINE>warningTime = ByteBufUtils.readVarInt(buffer);<NEW_LINE>return new WorldBorderMessage(action, warningTime);<NEW_LINE>default:<NEW_LINE>throw new DecoderException("Invalid WorldBorderMessage action " + actionId + "/" + action);<NEW_LINE>}<NEW_LINE>} | speed = ByteBufUtils.readVarLong(buffer); |
86,412 | private void updateTableColumnSizes() {<NEW_LINE>ETable table = notificationTable;<NEW_LINE>Font font = notificationScroll.getFont();<NEW_LINE>FontMetrics fm = notificationScroll.getFontMetrics(font.deriveFont(Font.BOLD));<NEW_LINE>// NOI18N<NEW_LINE>int maxCharWidth = fm.charWidth('A');<NEW_LINE>int inset = 10;<NEW_LINE>TableColumnModel columnModel = table.getColumnModel();<NEW_LINE>TableColumn priorityColumn = columnModel.getColumn(0);<NEW_LINE>String priorName = priorityColumn.getHeaderValue().toString();<NEW_LINE>priorityColumn.setPreferredWidth(fm.stringWidth(priorName) + inset);<NEW_LINE>TableColumn dateColumn = columnModel.getColumn(2);<NEW_LINE>dateColumn.setPreferredWidth(15 * maxCharWidth + inset);<NEW_LINE>TableColumn categoryColumn = columnModel.getColumn(3);<NEW_LINE>categoryColumn.setPreferredWidth(7 * maxCharWidth + inset);<NEW_LINE>TableColumn messageColumn = columnModel.getColumn(1);<NEW_LINE>Border border = notificationScroll.getBorder();<NEW_LINE>Insets insets;<NEW_LINE>if (border != null) {<NEW_LINE>insets = border.getBorderInsets(notificationScroll);<NEW_LINE>} else {<NEW_LINE>insets = new Insets(<MASK><NEW_LINE>}<NEW_LINE>int remainingWidth = notificationScroll.getParent().getWidth() - insets.left - insets.right;<NEW_LINE>remainingWidth -= 3 * columnModel.getColumnMargin();<NEW_LINE>remainingWidth -= priorityColumn.getPreferredWidth();<NEW_LINE>remainingWidth -= dateColumn.getPreferredWidth();<NEW_LINE>remainingWidth -= categoryColumn.getPreferredWidth();<NEW_LINE>messageColumn.setPreferredWidth(remainingWidth);<NEW_LINE>} | 0, 0, 0, 0); |
87,410 | public void reverseReturn(final de.metas.handlingunits.model.I_M_InOut returnInOut) {<NEW_LINE>if (!(returnsServiceFacade.isVendorReturn(returnInOut) || returnsServiceFacade.isCustomerReturn(returnInOut))) {<NEW_LINE>// nothing to do<NEW_LINE>return;<NEW_LINE>}<NEW_LINE>final String snapshotId = returnInOut.getSnapshot_UUID();<NEW_LINE>if (Check.isEmpty(snapshotId, true)) {<NEW_LINE>throw new HUException("@NotFound@ @Snapshot_UUID@ (" + returnInOut + ")");<NEW_LINE>}<NEW_LINE>final List<I_M_HU> <MASK><NEW_LINE>if (hus.isEmpty()) {<NEW_LINE>// nothing to do.<NEW_LINE>return;<NEW_LINE>}<NEW_LINE>if (returnsServiceFacade.isCustomerReturn(returnInOut)) {<NEW_LINE>huMovementBL.moveHUsToWarehouse(hus, WarehouseId.ofRepoId(returnInOut.getM_Warehouse_ID()));<NEW_LINE>}<NEW_LINE>final IContextAware context = InterfaceWrapperHelper.getContextAware(returnInOut);<NEW_LINE>snapshotDAO.restoreHUs().setContext(context).setSnapshotId(snapshotId).setDateTrx(returnInOut.getMovementDate()).setReferencedModel(returnInOut).addModels(hus).restoreFromSnapshot();<NEW_LINE>} | hus = huAssignmentDAO.retrieveTopLevelHUsForModel(returnInOut); |
216,947 | protected void showTextFieldPanel() {<NEW_LINE>final JLayeredPane layeredPane = getLayeredPane();<NEW_LINE>final Dimension preferredTextFieldPanelSize = myTextFieldPanel.getPreferredSize();<NEW_LINE>final int x = (layeredPane.getWidth() - preferredTextFieldPanelSize.width) / 2;<NEW_LINE>final int paneHeight = layeredPane.getHeight();<NEW_LINE>final int y = paneHeight / 3 - preferredTextFieldPanelSize.height / 2;<NEW_LINE>ComponentPopupBuilder builder = JBPopupFactory.getInstance(<MASK><NEW_LINE>builder.setLocateWithinScreenBounds(false);<NEW_LINE>builder.setKeyEventHandler(event -> {<NEW_LINE>if (myTextPopup == null || !AbstractPopup.isCloseRequest(event) || !myTextPopup.isCancelKeyEnabled()) {<NEW_LINE>return false;<NEW_LINE>}<NEW_LINE>IdeFocusManager focusManager = IdeFocusManager.getInstance(myProject);<NEW_LINE>if (isDescendingFromTemporarilyFocusableToolWindow(focusManager.getFocusOwner())) {<NEW_LINE>focusManager.requestFocus(myTextField, true);<NEW_LINE>return false;<NEW_LINE>} else {<NEW_LINE>myTextPopup.cancel(event);<NEW_LINE>return true;<NEW_LINE>}<NEW_LINE>}).setCancelCallback(() -> {<NEW_LINE>myTextPopup = null;<NEW_LINE>close(false);<NEW_LINE>return Boolean.TRUE;<NEW_LINE>}).setFocusable(true).setRequestFocus(true).setModalContext(false).setCancelOnClickOutside(false);<NEW_LINE>Point point = new Point(x, y);<NEW_LINE>SwingUtilities.convertPointToScreen(point, layeredPane);<NEW_LINE>Rectangle bounds = new Rectangle(point, new Dimension(preferredTextFieldPanelSize.width + 20, preferredTextFieldPanelSize.height));<NEW_LINE>myTextPopup = builder.createPopup();<NEW_LINE>myTextPopup.setSize(bounds.getSize());<NEW_LINE>myTextPopup.setLocation(bounds.getLocation());<NEW_LINE>MnemonicHelper.init(myTextFieldPanel);<NEW_LINE>if (myProject != null && !myProject.isDefault()) {<NEW_LINE>DaemonCodeAnalyzer.getInstance(myProject).disableUpdateByTimer(myTextPopup);<NEW_LINE>}<NEW_LINE>Disposer.register(myTextPopup, () -> cancelListUpdater());<NEW_LINE>IdeEventQueue.getInstance().getPopupManager().closeAllPopups(false);<NEW_LINE>myTextPopup.show(layeredPane);<NEW_LINE>} | ).createComponentPopupBuilder(myTextFieldPanel, myTextField); |
1,059,701 | public static LongFloatVector mergeSparseFloatVector(LongIndexGetParam param, List<PartitionGetResult> partResults) {<NEW_LINE>long dim = PSAgentContext.get().getMatrixMetaManager().getMatrixMeta(param.getMatrixId()).getColNum();<NEW_LINE>LongFloatVector vector = VFactory.sparseLongKeyFloatVector(dim, param.size());<NEW_LINE>for (PartitionGetResult part : partResults) {<NEW_LINE>PartitionKey partKey = ((IndexPartGetResult) part).getPartKey();<NEW_LINE>long[] indexes = param.<MASK><NEW_LINE>float[] values = ((IndexPartGetFloatResult) part).getValues();<NEW_LINE>for (int i = 0; i < indexes.length; i++) {<NEW_LINE>vector.set(indexes[i], values[i]);<NEW_LINE>}<NEW_LINE>}<NEW_LINE>vector.setMatrixId(param.getMatrixId());<NEW_LINE>vector.setRowId(param.getRowId());<NEW_LINE>return vector;<NEW_LINE>} | getPartKeyToIndexesMap().get(partKey); |
321,026 | String index(Request request, Response response) throws IOException {<NEW_LINE>String pluginType = request.queryParams("type");<NEW_LINE>RolesConfig roles = roleConfigService.getRoles().ofType(pluginType);<NEW_LINE>RolesViewModel rolesViewModel = new RolesViewModel().setRolesConfig(roles);<NEW_LINE>List<String> envNames = environmentConfigService.getEnvironmentNames();<NEW_LINE>List<String> configRepoNames = configRepoService.getConfigRepos().stream().map(ConfigRepoConfig::getId).collect(toList());<NEW_LINE>List<String> clusterProfileIds = clusterProfilesService.getPluginProfiles().stream().map(ClusterProfile::getId).collect(toList());<NEW_LINE>List<String> elasticAgentProfileIds = elasticProfileService.getPluginProfiles().stream().map(ElasticProfile::getId).collect(toList());<NEW_LINE>rolesViewModel.getAutoSuggestions().put("environment", envNames);<NEW_LINE>rolesViewModel.getAutoSuggestions().put("config_repo", configRepoNames);<NEW_LINE>rolesViewModel.getAutoSuggestions().put("cluster_profile", clusterProfileIds);<NEW_LINE>rolesViewModel.getAutoSuggestions().put("elastic_agent_profile", elasticAgentProfileIds);<NEW_LINE>return writerForTopLevelObject(request, response, (outputWriter) -> RolesViewModelRepresenter<MASK><NEW_LINE>} | .toJSON(outputWriter, rolesViewModel)); |
667,025 | public DotTempFile createEmptyTempFile(final String incomingFileName, final HttpServletRequest request) throws DotSecurityException {<NEW_LINE>final String anon = Try.of(() -> APILocator.getUserAPI().getAnonymousUser().getUserId<MASK><NEW_LINE>final User user = PortalUtil.getUser(request);<NEW_LINE>final String sessionId = (request.getSession(false) != null) ? request.getSession().getId() : null;<NEW_LINE>final String requestFingerprint = this.getRequestFingerprint(request);<NEW_LINE>final List<String> allowList = new ArrayList<>();<NEW_LINE>if (user != null && user.getUserId() != null && !user.getUserId().equals(anon)) {<NEW_LINE>allowList.add(user.getUserId());<NEW_LINE>}<NEW_LINE>if (sessionId != null) {<NEW_LINE>allowList.add(sessionId);<NEW_LINE>}<NEW_LINE>if (requestFingerprint != null) {<NEW_LINE>allowList.add(requestFingerprint);<NEW_LINE>}<NEW_LINE>if (incomingFileName == null) {<NEW_LINE>throw new DotRuntimeException("Unable to create temp file without a name");<NEW_LINE>}<NEW_LINE>final String tempFileId = TEMP_RESOURCE_PREFIX + UUIDGenerator.shorty();<NEW_LINE>final String tempFileUri = File.separator + tempFileId + File.separator + incomingFileName;<NEW_LINE>final File tempFile = new File(APILocator.getFileAssetAPI().getRealAssetPathTmpBinary() + tempFileUri);<NEW_LINE>final File tempFolder = tempFile.getParentFile();<NEW_LINE>if (!tempFolder.mkdirs()) {<NEW_LINE>throw new DotRuntimeException("Unable to create temp directory:" + tempFolder);<NEW_LINE>}<NEW_LINE>final String absFilePath = FileUtil.getAbsolutlePath(tempFile.getPath());<NEW_LINE>final String absTmpPath = FileUtil.getAbsolutlePath(APILocator.getFileAssetAPI().getRealAssetPathTmpBinary());<NEW_LINE>if (!absFilePath.startsWith(absTmpPath)) {<NEW_LINE>SecurityLogger.logInfo(this.getClass(), () -> "Attempted file upload outside of temp folder: " + absFilePath);<NEW_LINE>throw new DotRuntimeException("Invalid file upload");<NEW_LINE>}<NEW_LINE>createTempPermissionFile(tempFolder, allowList);<NEW_LINE>SecurityLogger.logInfo(this.getClass(), "Temp File Created with id: " + tempFileId + ", uploaded by userId: " + user.getUserId());<NEW_LINE>return new DotTempFile(tempFileId, tempFile);<NEW_LINE>} | ()).getOrElse("anonymous"); |
1,852,490 | public void mergeTo(IntLongVector mergedRow) {<NEW_LINE>StorageMethod method = VectorStorageUtils.getStorageMethod(vector);<NEW_LINE>switch(method) {<NEW_LINE>case DENSE:<NEW_LINE>{<NEW_LINE>long[] values = getVector()<MASK><NEW_LINE>for (int i = 0; i < values.length; i++) {<NEW_LINE>mergedRow.set(i + (int) indexOffset, values[i]);<NEW_LINE>}<NEW_LINE>break;<NEW_LINE>}<NEW_LINE>case SPARSE:<NEW_LINE>{<NEW_LINE>ObjectIterator<Entry> iter = getVector().getStorage().entryIterator();<NEW_LINE>Entry entry;<NEW_LINE>while (iter.hasNext()) {<NEW_LINE>entry = iter.next();<NEW_LINE>mergedRow.set(entry.getIntKey() + (int) indexOffset, entry.getLongValue());<NEW_LINE>}<NEW_LINE>break;<NEW_LINE>}<NEW_LINE>case SORTED:<NEW_LINE>{<NEW_LINE>int[] indices = getVector().getStorage().getIndices();<NEW_LINE>long[] values = getVector().getStorage().getValues();<NEW_LINE>for (int i = 0; i < indices.length; i++) {<NEW_LINE>mergedRow.set(indices[i] + (int) indexOffset, values[i]);<NEW_LINE>}<NEW_LINE>break;<NEW_LINE>}<NEW_LINE>default:<NEW_LINE>throw new UnsupportedOperationException("Unsupport storage method " + method);<NEW_LINE>}<NEW_LINE>} | .getStorage().getValues(); |
98,560 | public List<CandidateCellForSweeping> next() {<NEW_LINE>Preconditions.checkState(hasNext());<NEW_LINE>List<CellTsPairInfo> cellTsBatch = cellTsIterator.next();<NEW_LINE>List<CandidateCellForSweeping> candidates = new ArrayList<>();<NEW_LINE>for (CellTsPairInfo cellTs : cellTsBatch) {<NEW_LINE>checkCurrentCellAndUpdateIfNecessary(cellTs<MASK><NEW_LINE>if (currentCellTimestamps.size() > 0) {<NEW_LINE>// We expect the timestamps in ascending order. This check costs us a few CPU cycles<NEW_LINE>// but it's worth it for paranoia reasons - mistaking a cell with data for an empty one<NEW_LINE>// can cause data corruption.<NEW_LINE>Preconditions.checkArgument(cellTs.ts > currentCellTimestamps.get(currentCellTimestamps.size() - 1), "Timestamps for each cell must be fed in strictly increasing order");<NEW_LINE>}<NEW_LINE>updateStateAfterSingleCellTsPairProcessed(cellTs);<NEW_LINE>}<NEW_LINE>if (!cellTsIterator.hasNext()) {<NEW_LINE>getCurrentCandidate().ifPresent(candidates::add);<NEW_LINE>}<NEW_LINE>return candidates;<NEW_LINE>} | ).ifPresent(candidates::add); |
588,137 | public static String[] splitOnToken(String receiver, String token, int limit) {<NEW_LINE>// Check if it's even possible to perform a split<NEW_LINE>if (receiver == null || receiver.length() == 0 || token == null || token.length() == 0 || receiver.length() < token.length()) {<NEW_LINE>return new String[] { receiver };<NEW_LINE>}<NEW_LINE>// List of string segments we have found<NEW_LINE>ArrayList<String> result = new ArrayList<String>();<NEW_LINE>// Keep track of where we are in the string<NEW_LINE>// indexOf(tok, startPos) is faster than creating a new search context ever loop with substring(start, end)<NEW_LINE>int pos = 0;<NEW_LINE>// Loop until we hit the limit or forever if we are passed in less than one (signifying no limit)<NEW_LINE>// If Integer.MIN_VALUE is passed in, it will still continue to loop down to 1 from MAX_VALUE<NEW_LINE>// This edge case should be fine as we are limited by receiver length (Integer.MAX_VALUE) even if we split at every char<NEW_LINE>for (; limit != 1; limit--) {<NEW_LINE>// Find the next occurrence of token after current pos<NEW_LINE>int idx = <MASK><NEW_LINE>// Reached the end of the string without another match<NEW_LINE>if (idx == -1) {<NEW_LINE>break;<NEW_LINE>}<NEW_LINE>// Add the found segment to the result list<NEW_LINE>result.add(receiver.substring(pos, idx));<NEW_LINE>// Move our search position to the next possible location<NEW_LINE>pos = idx + token.length();<NEW_LINE>}<NEW_LINE>// Add the remaining string to the result list<NEW_LINE>result.add(receiver.substring(pos));<NEW_LINE>// O(N) or faster depending on implementation<NEW_LINE>return result.toArray(new String[0]);<NEW_LINE>} | receiver.indexOf(token, pos); |
60,247 | final GetResolverConfigResult executeGetResolverConfig(GetResolverConfigRequest getResolverConfigRequest) {<NEW_LINE>ExecutionContext executionContext = createExecutionContext(getResolverConfigRequest);<NEW_LINE>AWSRequestMetrics awsRequestMetrics = executionContext.getAwsRequestMetrics();<NEW_LINE>awsRequestMetrics.startEvent(Field.ClientExecuteTime);<NEW_LINE>Request<GetResolverConfigRequest> request = null;<NEW_LINE>Response<GetResolverConfigResult> response = null;<NEW_LINE>try {<NEW_LINE><MASK><NEW_LINE>try {<NEW_LINE>request = new GetResolverConfigRequestProtocolMarshaller(protocolFactory).marshall(super.beforeMarshalling(getResolverConfigRequest));<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, "Route53Resolver");<NEW_LINE>request.addHandlerContext(HandlerContextKey.OPERATION_NAME, "GetResolverConfig");<NEW_LINE>request.addHandlerContext(HandlerContextKey.ADVANCED_CONFIG, advancedConfig);<NEW_LINE>} finally {<NEW_LINE>awsRequestMetrics.endEvent(Field.RequestMarshallTime);<NEW_LINE>}<NEW_LINE>HttpResponseHandler<AmazonWebServiceResponse<GetResolverConfigResult>> responseHandler = protocolFactory.createResponseHandler(new JsonOperationMetadata().withPayloadJson(true).withHasStreamingSuccessResponse(false), new GetResolverConfigResultJsonUnmarshaller());<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,117,341 | final DescribeAlertResult executeDescribeAlert(DescribeAlertRequest describeAlertRequest) {<NEW_LINE>ExecutionContext executionContext = createExecutionContext(describeAlertRequest);<NEW_LINE>AWSRequestMetrics awsRequestMetrics = executionContext.getAwsRequestMetrics();<NEW_LINE>awsRequestMetrics.startEvent(Field.ClientExecuteTime);<NEW_LINE>Request<DescribeAlertRequest> request = null;<NEW_LINE>Response<DescribeAlertResult> response = null;<NEW_LINE>try {<NEW_LINE>awsRequestMetrics.startEvent(Field.RequestMarshallTime);<NEW_LINE>try {<NEW_LINE>request = new DescribeAlertRequestProtocolMarshaller(protocolFactory).marshall(super.beforeMarshalling(describeAlertRequest));<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, "LookoutMetrics");<NEW_LINE>request.addHandlerContext(HandlerContextKey.OPERATION_NAME, "DescribeAlert");<NEW_LINE>request.addHandlerContext(HandlerContextKey.ADVANCED_CONFIG, advancedConfig);<NEW_LINE>} finally {<NEW_LINE>awsRequestMetrics.endEvent(Field.RequestMarshallTime);<NEW_LINE>}<NEW_LINE>HttpResponseHandler<AmazonWebServiceResponse<DescribeAlertResult>> responseHandler = protocolFactory.createResponseHandler(new JsonOperationMetadata().withPayloadJson(true).withHasStreamingSuccessResponse(false), new DescribeAlertResultJsonUnmarshaller());<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); |
1,737,200 | private void verify(final Mac mac) throws IOException {<NEW_LINE>final <MASK><NEW_LINE>final DataOutputStream data = new DataOutputStream(out);<NEW_LINE>// name of algorithm<NEW_LINE>String keyType = this.getType().toString();<NEW_LINE>data.writeInt(keyType.length());<NEW_LINE>data.writeBytes(keyType);<NEW_LINE>data.writeInt(headers.get("Encryption").length());<NEW_LINE>data.writeBytes(headers.get("Encryption"));<NEW_LINE>data.writeInt(headers.get("Comment").length());<NEW_LINE>data.writeBytes(headers.get("Comment"));<NEW_LINE>data.writeInt(publicKey.length);<NEW_LINE>data.write(publicKey);<NEW_LINE>data.writeInt(privateKey.length);<NEW_LINE>data.write(privateKey);<NEW_LINE>final String encoded = Hex.toHexString(mac.doFinal(out.toByteArray()));<NEW_LINE>final String reference = headers.get("Private-MAC");<NEW_LINE>if (!encoded.equals(reference)) {<NEW_LINE>throw new IOException("Invalid passphrase");<NEW_LINE>}<NEW_LINE>} | ByteArrayOutputStream out = new ByteArrayOutputStream(256); |
1,067,858 | public void fillForeignKeys(EntityType item, String... columnNames) {<NEW_LINE>HashSet<String> columnNameSet = new HashSet<String>(asList(columnNames));<NEW_LINE>boolean fillAll = columnNameSet.isEmpty();<NEW_LINE>FieldSpec<ColumnAnn>[] columnSpecs = ClassSpecRegistry.getTableColumnSpecs(cls);<NEW_LINE>for (FieldSpec<ColumnAnn> spec : columnSpecs) {<NEW_LINE>if (fillAll || columnNameSet.contains(spec.ann.name)) {<NEW_LINE>Class<?> fieldType = spec.field.getType();<NEW_LINE>if (isEntity(fieldType)) {<NEW_LINE>Entity foreignEntity = getFieldVal(item, spec.field);<NEW_LINE>if (foreignEntity != null) {<NEW_LINE>EntityManager<Entity> manager = subManager(spec.field.getType());<NEW_LINE>Object obj = manager.read(foreignEntity._id);<NEW_LINE>setFieldVal(item, spec.field, obj);<NEW_LINE>}<NEW_LINE>} else if ((isArray(fieldType) || isCollection(fieldType)) && isEntity(spec.genericArg1)) {<NEW_LINE>EntityManager<Entity> manager = subManager(spec.genericArg1);<NEW_LINE>if (isArray(fieldType)) {<NEW_LINE>Entity[] arr = getFieldVal(item, spec.field);<NEW_LINE>if (arr != null) {<NEW_LINE>for (int i = 0; i < arr.length; i++) {<NEW_LINE>Entity ent = arr[i];<NEW_LINE>if (ent != null) {<NEW_LINE>arr[i] = manager.read(ent._id);<NEW_LINE>}<NEW_LINE>}<NEW_LINE>}<NEW_LINE>} else {<NEW_LINE>Collection<Entity> coll = <MASK><NEW_LINE>if (coll != null) {<NEW_LINE>ArrayList<Entity> entities = new ArrayList<Entity>(coll.size());<NEW_LINE>for (Entity ent : coll) {<NEW_LINE>if (ent != null) {<NEW_LINE>entities.add(manager.read(ent._id));<NEW_LINE>}<NEW_LINE>}<NEW_LINE>coll.clear();<NEW_LINE>coll.addAll(entities);<NEW_LINE>}<NEW_LINE>}<NEW_LINE>}<NEW_LINE>}<NEW_LINE>}<NEW_LINE>} | getFieldVal(item, spec.field); |
1,794,195 | public ListMFADeviceTagsResult unmarshall(StaxUnmarshallerContext context) throws Exception {<NEW_LINE>ListMFADeviceTagsResult listMFADeviceTagsResult = new ListMFADeviceTagsResult();<NEW_LINE>int originalDepth = context.getCurrentDepth();<NEW_LINE>int targetDepth = originalDepth + 1;<NEW_LINE>if (context.isStartOfDocument())<NEW_LINE>targetDepth += 2;<NEW_LINE>while (true) {<NEW_LINE>XMLEvent xmlEvent = context.nextEvent();<NEW_LINE>if (xmlEvent.isEndDocument())<NEW_LINE>return listMFADeviceTagsResult;<NEW_LINE>if (xmlEvent.isAttribute() || xmlEvent.isStartElement()) {<NEW_LINE>if (context.testExpression("Tags", targetDepth)) {<NEW_LINE>listMFADeviceTagsResult.withTags(new ArrayList<Tag>());<NEW_LINE>continue;<NEW_LINE>}<NEW_LINE>if (context.testExpression("Tags/member", targetDepth)) {<NEW_LINE>listMFADeviceTagsResult.withTags(TagStaxUnmarshaller.getInstance().unmarshall(context));<NEW_LINE>continue;<NEW_LINE>}<NEW_LINE>if (context.testExpression("IsTruncated", targetDepth)) {<NEW_LINE>listMFADeviceTagsResult.setIsTruncated(BooleanStaxUnmarshaller.getInstance<MASK><NEW_LINE>continue;<NEW_LINE>}<NEW_LINE>if (context.testExpression("Marker", targetDepth)) {<NEW_LINE>listMFADeviceTagsResult.setMarker(StringStaxUnmarshaller.getInstance().unmarshall(context));<NEW_LINE>continue;<NEW_LINE>}<NEW_LINE>} else if (xmlEvent.isEndElement()) {<NEW_LINE>if (context.getCurrentDepth() < originalDepth) {<NEW_LINE>return listMFADeviceTagsResult;<NEW_LINE>}<NEW_LINE>}<NEW_LINE>}<NEW_LINE>} | ().unmarshall(context)); |
1,221,164 | private void updateDeviceSessionConfiguration(DeviceProfile deviceProfile) {<NEW_LINE>DeviceProfileTransportConfiguration transportConfiguration = deviceProfile<MASK><NEW_LINE>if (transportConfiguration.getType().equals(DeviceTransportType.MQTT) && transportConfiguration instanceof MqttDeviceProfileTransportConfiguration) {<NEW_LINE>MqttDeviceProfileTransportConfiguration mqttConfig = (MqttDeviceProfileTransportConfiguration) transportConfiguration;<NEW_LINE>TransportPayloadTypeConfiguration transportPayloadTypeConfiguration = mqttConfig.getTransportPayloadTypeConfiguration();<NEW_LINE>payloadType = transportPayloadTypeConfiguration.getTransportPayloadType();<NEW_LINE>telemetryTopicFilter = MqttTopicFilterFactory.toFilter(mqttConfig.getDeviceTelemetryTopic());<NEW_LINE>attributesTopicFilter = MqttTopicFilterFactory.toFilter(mqttConfig.getDeviceAttributesTopic());<NEW_LINE>if (TransportPayloadType.PROTOBUF.equals(payloadType)) {<NEW_LINE>ProtoTransportPayloadConfiguration protoTransportPayloadConfig = (ProtoTransportPayloadConfiguration) transportPayloadTypeConfiguration;<NEW_LINE>updateDynamicMessageDescriptors(protoTransportPayloadConfig);<NEW_LINE>jsonPayloadFormatCompatibilityEnabled = protoTransportPayloadConfig.isEnableCompatibilityWithJsonPayloadFormat();<NEW_LINE>useJsonPayloadFormatForDefaultDownlinkTopics = jsonPayloadFormatCompatibilityEnabled && protoTransportPayloadConfig.isUseJsonPayloadFormatForDefaultDownlinkTopics();<NEW_LINE>}<NEW_LINE>} else {<NEW_LINE>telemetryTopicFilter = MqttTopicFilterFactory.getDefaultTelemetryFilter();<NEW_LINE>attributesTopicFilter = MqttTopicFilterFactory.getDefaultAttributesFilter();<NEW_LINE>payloadType = TransportPayloadType.JSON;<NEW_LINE>}<NEW_LINE>updateAdaptor();<NEW_LINE>} | .getProfileData().getTransportConfiguration(); |
1,165,765 | private Mono<PagedResponse<VpnGatewayInner>> listByResourceGroupSinglePageAsync(String resourceGroupName, Context context) {<NEW_LINE>if (this.client.getEndpoint() == null) {<NEW_LINE>return Mono.error(new IllegalArgumentException("Parameter this.client.getEndpoint() is required and cannot be null."));<NEW_LINE>}<NEW_LINE>if (this.client.getSubscriptionId() == null) {<NEW_LINE>return Mono.error(new IllegalArgumentException("Parameter this.client.getSubscriptionId() is required and cannot be null."));<NEW_LINE>}<NEW_LINE>if (resourceGroupName == null) {<NEW_LINE>return Mono.error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null."));<NEW_LINE>}<NEW_LINE>final String apiVersion = "2018-11-01";<NEW_LINE>final String accept = "application/json";<NEW_LINE>context = this.client.mergeContext(context);<NEW_LINE>return service.listByResourceGroup(this.client.getEndpoint(), this.client.getSubscriptionId(), resourceGroupName, apiVersion, accept, context).map(res -> new PagedResponseBase<>(res.getRequest(), res.getStatusCode(), res.getHeaders(), res.getValue().value(), res.getValue()<MASK><NEW_LINE>} | .nextLink(), null)); |
797,006 | public static MethodType fromMethodDescriptorString(String methodDescriptor, ClassLoader loader) {<NEW_LINE>ClassLoader classLoader = loader;<NEW_LINE>if (classLoader == null) {<NEW_LINE>classLoader = ClassLoader.getSystemClassLoader();<NEW_LINE>}<NEW_LINE>// Check cache<NEW_LINE>Map<String, MethodType> classLoaderMethodTypeCache = VM.getVMLangAccess().getMethodTypeCache(classLoader);<NEW_LINE>MethodType mt = classLoaderMethodTypeCache != null ? classLoaderMethodTypeCache.get(methodDescriptor) : null;<NEW_LINE>// MethodDescriptorString is not in cache<NEW_LINE>if (null == mt) {<NEW_LINE>// ensure '.' is not included in the descriptor<NEW_LINE>if (methodDescriptor.indexOf((int) '.') != -1) {<NEW_LINE>throw new IllegalArgumentException(methodDescriptor);<NEW_LINE>}<NEW_LINE>// split descriptor into classes - last one is the return type<NEW_LINE>ArrayList<Class<?>> <MASK><NEW_LINE>if (classes.size() == 0) {<NEW_LINE>throw new IllegalArgumentException(methodDescriptor);<NEW_LINE>}<NEW_LINE>Class<?> returnType = classes.remove(classes.size() - 1);<NEW_LINE>mt = methodType(returnType, classes);<NEW_LINE>if (classLoaderMethodTypeCache != null) {<NEW_LINE>classLoaderMethodTypeCache.put(mt.methodDescriptor, mt);<NEW_LINE>}<NEW_LINE>}<NEW_LINE>return mt;<NEW_LINE>} | classes = parseIntoClasses(methodDescriptor, classLoader); |
1,743,372 | public Outcome<VirtualMachine> startVmThroughJobQueue(final String vmUuid, final Map<VirtualMachineProfile.Param, Object> params, final DeploymentPlan planToDeploy, final DeploymentPlanner planner) {<NEW_LINE>String commandName = VmWorkStart.class.getName();<NEW_LINE>Pair<VmWorkJobVO, Long> pendingWorkJob = retrievePendingWorkJob(vmUuid, commandName);<NEW_LINE>VmWorkJobVO workJob = pendingWorkJob.first();<NEW_LINE><MASK><NEW_LINE>if (workJob == null) {<NEW_LINE>Pair<VmWorkJobVO, VmWork> newVmWorkJobAndInfo = createWorkJobAndWorkInfo(commandName, VmWorkJobVO.Step.Starting, vmId);<NEW_LINE>workJob = newVmWorkJobAndInfo.first();<NEW_LINE>VmWorkStart workInfo = new VmWorkStart(newVmWorkJobAndInfo.second());<NEW_LINE>workInfo.setPlan(planToDeploy);<NEW_LINE>workInfo.setParams(params);<NEW_LINE>if (planner != null) {<NEW_LINE>workInfo.setDeploymentPlanner(planner.getName());<NEW_LINE>}<NEW_LINE>setCmdInfoAndSubmitAsyncJob(workJob, workInfo, vmId);<NEW_LINE>}<NEW_LINE>AsyncJobExecutionContext.getCurrentExecutionContext().joinJob(workJob.getId());<NEW_LINE>return new VmStateSyncOutcome(workJob, VirtualMachine.PowerState.PowerOn, vmId, null);<NEW_LINE>} | Long vmId = pendingWorkJob.second(); |
87,150 | private List<GenomicsDBImportConfiguration.Partition> generatePartitionListFromIntervals() {<NEW_LINE>return intervals.stream().map(interval -> {<NEW_LINE>Coordinates.ContigPosition.Builder contigPositionBuilder = Coordinates.ContigPosition.newBuilder();<NEW_LINE>contigPositionBuilder.<MASK><NEW_LINE>Coordinates.GenomicsDBColumn.Builder beginBuilder = Coordinates.GenomicsDBColumn.newBuilder();<NEW_LINE>Coordinates.GenomicsDBColumn.Builder endBuilder = Coordinates.GenomicsDBColumn.newBuilder();<NEW_LINE>// begin<NEW_LINE>contigPositionBuilder.setPosition(interval.getStart());<NEW_LINE>beginBuilder.setContigPosition(contigPositionBuilder.build());<NEW_LINE>// end<NEW_LINE>contigPositionBuilder.setPosition(interval.getEnd());<NEW_LINE>endBuilder.setContigPosition(contigPositionBuilder.build());<NEW_LINE>return createPartitionWithBeginAndEnd(beginBuilder.build(), endBuilder.build());<NEW_LINE>}).collect(Collectors.toList());<NEW_LINE>} | setContig(interval.getContig()); |
1,395,329 | public GetRepositoryTriggersResult unmarshall(JsonUnmarshallerContext context) throws Exception {<NEW_LINE>GetRepositoryTriggersResult getRepositoryTriggersResult = new GetRepositoryTriggersResult();<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 getRepositoryTriggersResult;<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("configurationId", targetDepth)) {<NEW_LINE>context.nextToken();<NEW_LINE>getRepositoryTriggersResult.setConfigurationId(context.getUnmarshaller(String.class).unmarshall(context));<NEW_LINE>}<NEW_LINE>if (context.testExpression("triggers", targetDepth)) {<NEW_LINE>context.nextToken();<NEW_LINE>getRepositoryTriggersResult.setTriggers(new ListUnmarshaller<RepositoryTrigger>(RepositoryTriggerJsonUnmarshaller.getInstance()).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 getRepositoryTriggersResult;<NEW_LINE>} | int originalDepth = context.getCurrentDepth(); |
713,965 | private boolean isRecoveryAuthnCodeInputValid(AuthenticationFlowContext authnFlowContext) {<NEW_LINE>boolean result = false;<NEW_LINE>MultivaluedMap<String, String> formParamsMap = authnFlowContext.getHttpRequest().getDecodedFormParameters();<NEW_LINE>String recoveryAuthnCodeUserInput = formParamsMap.getFirst(RecoveryAuthnCodesUtils.FIELD_RECOVERY_CODE_IN_BROWSER_FLOW);<NEW_LINE>if (ObjectUtil.isBlank(recoveryAuthnCodeUserInput)) {<NEW_LINE>authnFlowContext.forceChallenge(createLoginForm(authnFlowContext, true, RecoveryAuthnCodesUtils.RECOVERY_AUTHN_CODES_INPUT_DEFAULT_ERROR_MESSAGE, RecoveryAuthnCodesUtils.FIELD_RECOVERY_CODE_IN_BROWSER_FLOW));<NEW_LINE>return result;<NEW_LINE>}<NEW_LINE>RealmModel targetRealm = authnFlowContext.getRealm();<NEW_LINE>UserModel authenticatedUser = authnFlowContext.getUser();<NEW_LINE>if (!isDisabledByBruteForce(authnFlowContext, authenticatedUser)) {<NEW_LINE>boolean isValid = this.userCredentialManager.isValid(targetRealm, authenticatedUser, UserCredentialModel.buildFromBackupAuthnCode(recoveryAuthnCodeUserInput.replace("-", "")));<NEW_LINE>if (!isValid) {<NEW_LINE>Response responseChallenge = createLoginForm(authnFlowContext, true, <MASK><NEW_LINE>authnFlowContext.failureChallenge(AuthenticationFlowError.INVALID_CREDENTIALS, responseChallenge);<NEW_LINE>} else {<NEW_LINE>result = true;<NEW_LINE>Optional<CredentialModel> optUserCredentialFound = this.userCredentialManager.getStoredCredentialsByTypeStream(targetRealm, authenticatedUser, RecoveryAuthnCodesCredentialModel.TYPE).findFirst();<NEW_LINE>RecoveryAuthnCodesCredentialModel recoveryCodeCredentialModel = null;<NEW_LINE>if (optUserCredentialFound.isPresent()) {<NEW_LINE>recoveryCodeCredentialModel = RecoveryAuthnCodesCredentialModel.createFromCredentialModel(optUserCredentialFound.get());<NEW_LINE>if (recoveryCodeCredentialModel.allCodesUsed()) {<NEW_LINE>this.userCredentialManager.removeStoredCredential(targetRealm, authenticatedUser, recoveryCodeCredentialModel.getId());<NEW_LINE>}<NEW_LINE>}<NEW_LINE>if (recoveryCodeCredentialModel == null || recoveryCodeCredentialModel.allCodesUsed()) {<NEW_LINE>authenticatedUser.addRequiredAction(UserModel.RequiredAction.CONFIGURE_RECOVERY_AUTHN_CODES);<NEW_LINE>}<NEW_LINE>}<NEW_LINE>}<NEW_LINE>return result;<NEW_LINE>} | RecoveryAuthnCodesUtils.RECOVERY_AUTHN_CODES_INPUT_DEFAULT_ERROR_MESSAGE, RecoveryAuthnCodesUtils.FIELD_RECOVERY_CODE_IN_BROWSER_FLOW); |
74,429 | private Mono<Response<Flux<ByteBuffer>>> createOrUpdateWithResponseAsync(String resourceUri, String linkerName, LinkerResourceInner parameters, Context context) {<NEW_LINE>if (this.client.getEndpoint() == null) {<NEW_LINE>return Mono.error(new IllegalArgumentException("Parameter this.client.getEndpoint() is required and cannot be null."));<NEW_LINE>}<NEW_LINE>if (resourceUri == null) {<NEW_LINE>return Mono.error(new IllegalArgumentException("Parameter resourceUri is required and cannot be null."));<NEW_LINE>}<NEW_LINE>if (linkerName == null) {<NEW_LINE>return Mono.error(new IllegalArgumentException("Parameter linkerName is required and cannot be null."));<NEW_LINE>}<NEW_LINE>if (parameters == null) {<NEW_LINE>return Mono.error(new IllegalArgumentException("Parameter parameters is required and cannot be null."));<NEW_LINE>} else {<NEW_LINE>parameters.validate();<NEW_LINE>}<NEW_LINE>final String accept = "application/json";<NEW_LINE>context = <MASK><NEW_LINE>return service.createOrUpdate(this.client.getEndpoint(), resourceUri, this.client.getApiVersion(), linkerName, parameters, accept, context);<NEW_LINE>} | this.client.mergeContext(context); |
105,189 | protected void showCurrentFormat(LatLon l) {<NEW_LINE>final EditText latEdit = view.findViewById(R.id.LatitudeEdit);<NEW_LINE>final EditText lonEdit = view.findViewById(R.id.LongitudeEdit);<NEW_LINE>switch(currentFormat) {<NEW_LINE>case PointDescription.UTM_FORMAT:<NEW_LINE>{<NEW_LINE>view.findViewById(R.id.easting_row).setVisibility(View.VISIBLE);<NEW_LINE>view.findViewById(R.id.northing_row<MASK><NEW_LINE>view.findViewById(R.id.zone_row).setVisibility(View.VISIBLE);<NEW_LINE>view.findViewById(R.id.lat_row).setVisibility(View.GONE);<NEW_LINE>view.findViewById(R.id.lon_row).setVisibility(View.GONE);<NEW_LINE>view.findViewById(R.id.mgrs_row).setVisibility(View.GONE);<NEW_LINE>final EditText northingEdit = view.findViewById(R.id.NorthingEdit);<NEW_LINE>final EditText eastingEdit = view.findViewById(R.id.EastingEdit);<NEW_LINE>final EditText zoneEdit = view.findViewById(R.id.ZoneEdit);<NEW_LINE>UTMPoint pnt = new UTMPoint(new LatLonPoint(l.getLatitude(), l.getLongitude()));<NEW_LINE>zoneEdit.setText(pnt.zone_number + "" + pnt.zone_letter);<NEW_LINE>northingEdit.setText(((long) pnt.northing) + "");<NEW_LINE>eastingEdit.setText(((long) pnt.easting) + "");<NEW_LINE>break;<NEW_LINE>}<NEW_LINE>case PointDescription.MGRS_FORMAT:<NEW_LINE>{<NEW_LINE>view.findViewById(R.id.easting_row).setVisibility(View.GONE);<NEW_LINE>view.findViewById(R.id.northing_row).setVisibility(View.GONE);<NEW_LINE>view.findViewById(R.id.zone_row).setVisibility(View.GONE);<NEW_LINE>view.findViewById(R.id.lat_row).setVisibility(View.GONE);<NEW_LINE>view.findViewById(R.id.lon_row).setVisibility(View.GONE);<NEW_LINE>view.findViewById(R.id.mgrs_row).setVisibility(View.VISIBLE);<NEW_LINE>final EditText mgrsEdit = ((EditText) view.findViewById(R.id.MGRSEdit));<NEW_LINE>MGRSPoint pnt = new MGRSPoint(new LatLonPoint(l.getLatitude(), l.getLongitude()));<NEW_LINE>mgrsEdit.setText(pnt.toFlavoredString(5));<NEW_LINE>break;<NEW_LINE>}<NEW_LINE>default:<NEW_LINE>{<NEW_LINE>view.findViewById(R.id.easting_row).setVisibility(View.GONE);<NEW_LINE>view.findViewById(R.id.northing_row).setVisibility(View.GONE);<NEW_LINE>view.findViewById(R.id.zone_row).setVisibility(View.GONE);<NEW_LINE>view.findViewById(R.id.lat_row).setVisibility(View.VISIBLE);<NEW_LINE>view.findViewById(R.id.lon_row).setVisibility(View.VISIBLE);<NEW_LINE>view.findViewById(R.id.mgrs_row).setVisibility(View.GONE);<NEW_LINE>latEdit.setText(LocationConvert.convert(MapUtils.checkLatitude(l.getLatitude()), currentFormat));<NEW_LINE>lonEdit.setText(LocationConvert.convert(MapUtils.checkLongitude(l.getLongitude()), currentFormat));<NEW_LINE>}<NEW_LINE>}<NEW_LINE>} | ).setVisibility(View.VISIBLE); |
523,275 | public ApiResponse<RecentGroupedContents> filesGetRecentGroupesWithHttpInfo(Integer pageIndex, Integer pageSize, Integer filter, Integer groupBy, String sortExpression, Boolean reversed) throws ApiException {<NEW_LINE>Object localVarPostBody = null;<NEW_LINE>// verify the required parameter 'pageIndex' is set<NEW_LINE>if (pageIndex == null) {<NEW_LINE>throw new ApiException(400, "Missing the required parameter 'pageIndex' when calling filesGetRecentGroupes");<NEW_LINE>}<NEW_LINE>// verify the required parameter 'pageSize' is set<NEW_LINE>if (pageSize == null) {<NEW_LINE>throw new ApiException(400, "Missing the required parameter 'pageSize' when calling filesGetRecentGroupes");<NEW_LINE>}<NEW_LINE>// verify the required parameter 'filter' is set<NEW_LINE>if (filter == null) {<NEW_LINE>throw new ApiException(400, "Missing the required parameter 'filter' when calling filesGetRecentGroupes");<NEW_LINE>}<NEW_LINE>// verify the required parameter 'groupBy' is set<NEW_LINE>if (groupBy == null) {<NEW_LINE>throw new ApiException(400, "Missing the required parameter 'groupBy' when calling filesGetRecentGroupes");<NEW_LINE>}<NEW_LINE>// create path and map variables<NEW_LINE>String localVarPath = "/v4/files/recent/groups";<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>localVarQueryParams.addAll(apiClient.parameterToPairs("", "pageIndex", pageIndex));<NEW_LINE>localVarQueryParams.addAll(apiClient.parameterToPairs("", "pageSize", pageSize));<NEW_LINE>localVarQueryParams.addAll(apiClient.parameterToPairs("", "filter", filter));<NEW_LINE>localVarQueryParams.addAll(apiClient.parameterToPairs("", "groupBy", groupBy));<NEW_LINE>localVarQueryParams.addAll(apiClient.parameterToPairs("", "sortExpression", sortExpression));<NEW_LINE>localVarQueryParams.addAll(apiClient.parameterToPairs("", "reversed", reversed));<NEW_LINE>final String[] localVarAccepts = { "application/json", "text/json" };<NEW_LINE>final String localVarAccept = apiClient.selectHeaderAccept(localVarAccepts);<NEW_LINE>final String[] localVarContentTypes = {};<NEW_LINE>final String localVarContentType = apiClient.selectHeaderContentType(localVarContentTypes);<NEW_LINE>String[] localVarAuthNames <MASK><NEW_LINE>GenericType<RecentGroupedContents> localVarReturnType = new GenericType<RecentGroupedContents>() {<NEW_LINE>};<NEW_LINE>return apiClient.invokeAPI(localVarPath, "GET", localVarQueryParams, localVarPostBody, localVarHeaderParams, localVarFormParams, localVarAccept, localVarContentType, localVarAuthNames, localVarReturnType);<NEW_LINE>} | = new String[] { "oauth2" }; |
1,718,481 | static long calculateInfluencerRequirementBytes(AnalysisConfig analysisConfig, Map<String, Long> maxBucketCardinality) {<NEW_LINE>// Influencers that are also by/over/partition fields do not consume extra memory by being influencers<NEW_LINE>Set<String> pureInfluencers = new HashSet<<MASK><NEW_LINE>for (Detector detector : analysisConfig.getDetectors()) {<NEW_LINE>pureInfluencers.removeAll(detector.extractAnalysisFields());<NEW_LINE>}<NEW_LINE>long totalInfluencerCardinality = pureInfluencers.stream().map(influencer -> cardinalityEstimate(AnalysisConfig.INFLUENCERS.getPreferredName(), influencer, maxBucketCardinality, false)).reduce(0L, TransportEstimateModelMemoryAction::addNonNegativeLongsWithMaxValueCap);<NEW_LINE>return multiplyNonNegativeLongsWithMaxValueCap(BYTES_PER_INFLUENCER_VALUE, totalInfluencerCardinality);<NEW_LINE>} | >(analysisConfig.getInfluencers()); |
1,399,263 | public void updateAsciiStream(int i, InputStream x, long length) throws SQLException {<NEW_LINE>try {<NEW_LINE>rsetImpl.updateAsciiStream(i, x, length);<NEW_LINE>} catch (SQLException sqlX) {<NEW_LINE>FFDCFilter.processException(sqlX, getClass().getName() + ".updateAsciiStream", "2981", this);<NEW_LINE>throw WSJdbcUtil.mapException(this, sqlX);<NEW_LINE>} catch (NullPointerException nullX) {<NEW_LINE>// No FFDC code needed; we might be closed.<NEW_LINE>throw runtimeXIfNotClosed(nullX);<NEW_LINE>} catch (AbstractMethodError methError) {<NEW_LINE>// No FFDC code needed; wrong JDBC level.<NEW_LINE>throw AdapterUtil.notSupportedX("ResultSet.updateAsciiStream", methError);<NEW_LINE>} catch (RuntimeException runX) {<NEW_LINE>FFDCFilter.processException(runX, getClass().getName() + ".updateAsciiStream", "3355", this);<NEW_LINE>if (tc.isDebugEnabled())<NEW_LINE>Tr.debug(<MASK><NEW_LINE>throw runX;<NEW_LINE>} catch (Error err) {<NEW_LINE>FFDCFilter.processException(err, getClass().getName() + ".updateAsciiStream", "3362", this);<NEW_LINE>if (tc.isDebugEnabled())<NEW_LINE>Tr.debug(this, tc, "updateAsciiStream", err);<NEW_LINE>throw err;<NEW_LINE>}<NEW_LINE>} | this, tc, "updateAsciiStream", runX); |
778,118 | protected boolean checkDerivedKeys(AbstractTokenWrapper tokenWrapper, boolean hasDerivedKeys, List<WSSecurityEngineResult> signedResults, List<WSSecurityEngineResult> encryptedResults) {<NEW_LINE><MASK><NEW_LINE>boolean isDerivedKeys = token.getDerivedKeys() == DerivedKeys.RequireDerivedKeys;<NEW_LINE>// If derived keys are not required then just return<NEW_LINE>if (!((token instanceof X509Token || token instanceof UsernameToken) && isDerivedKeys)) {<NEW_LINE>// Liberty code change<NEW_LINE>return true;<NEW_LINE>}<NEW_LINE>if (tokenWrapper instanceof EncryptionToken && !hasDerivedKeys && !encryptedResults.isEmpty()) {<NEW_LINE>return false;<NEW_LINE>} else if (tokenWrapper instanceof SignatureToken && !hasDerivedKeys && !signedResults.isEmpty()) {<NEW_LINE>return false;<NEW_LINE>} else if (tokenWrapper instanceof ProtectionToken && !hasDerivedKeys && !(signedResults.isEmpty() && encryptedResults.isEmpty())) {<NEW_LINE>// Liberty code change<NEW_LINE>return false;<NEW_LINE>}<NEW_LINE>return true;<NEW_LINE>} | AbstractToken token = tokenWrapper.getToken(); |
654,854 | private static DataBindings transform(DataBindings parent, XmlElement elem, boolean withTokens) {<NEW_LINE>// Add to parent<NEW_LINE>DataBindings children = new DataBindings();<NEW_LINE>parent.put(elem.getName().getRawText(), withTokens ? makeTokensValue(elem, children) : children);<NEW_LINE>// Attributes<NEW_LINE>for (Map.Entry<String, XmlAttribute> entry : elem.getAttributes().entrySet()) {<NEW_LINE>children.put(entry.getKey(), withTokens ? makeTokensValue(entry.getValue()) : entry.<MASK><NEW_LINE>}<NEW_LINE>// Element text<NEW_LINE>if (elem.getRawContent() != null) {<NEW_LINE>children.put(XML_ELEM_CONTENT, elem.getRawContent().getRawText().trim());<NEW_LINE>}<NEW_LINE>// Child Elements<NEW_LINE>Map<String, List<DataBindings>> map = new LinkedHashMap<>();<NEW_LINE>for (XmlElement child : elem.getChildren()) {<NEW_LINE>map.computeIfAbsent(child.getName().getRawText(), k -> new ArrayList<>()).add(transform(new DataBindings(), child, withTokens));<NEW_LINE>}<NEW_LINE>for (Map.Entry<String, List<DataBindings>> entry : map.entrySet()) {<NEW_LINE>List<DataBindings> list = entry.getValue();<NEW_LINE>if (list.size() == 1) {<NEW_LINE>children.putAll(list.get(0));<NEW_LINE>} else {<NEW_LINE>// Duplicates are put into a list and indirectly exposed through it<NEW_LINE>List<Object> listValues = list.stream().map(e -> e.get(entry.getKey())).collect(Collectors.toList());<NEW_LINE>children.put(entry.getKey(), withTokens ? makeTokensValue(listValues) : listValues);<NEW_LINE>}<NEW_LINE>}<NEW_LINE>return parent;<NEW_LINE>} | getValue().getValue()); |
1,477,188 | // FIXME: speed this up by using a one-dimensional array<NEW_LINE>private double compare_(String s1, String s2) {<NEW_LINE>// before we begin, note the length of the strings<NEW_LINE>int shortlen = Math.min(s1.length(), s2.length());<NEW_LINE>int longlen = Math.max(s1.length(), s2.length());<NEW_LINE>// total length of common substrings<NEW_LINE>int removed = 0;<NEW_LINE>while (true) {<NEW_LINE>// first, we identify the longest common substring<NEW_LINE>int longest = 0;<NEW_LINE>int longesti = 0;<NEW_LINE>int longestj = 0;<NEW_LINE>int[][] matrix = new int[s1.length()][s2.length()];<NEW_LINE>for (int i = 0; i < s1.length(); i++) {<NEW_LINE>for (int j = 0; j < s2.length(); j++) {<NEW_LINE>if (s1.charAt(i) == s2.charAt(j)) {<NEW_LINE>if (i == 0 || j == 0)<NEW_LINE>matrix[i][j] = 1;<NEW_LINE>else<NEW_LINE>matrix[i][j] = matrix[i - 1][j - 1] + 1;<NEW_LINE>if (matrix[i][j] > longest) {<NEW_LINE>longest = matrix[i][j];<NEW_LINE>longesti = i;<NEW_LINE>longestj = j;<NEW_LINE>}<NEW_LINE>} else<NEW_LINE>matrix<MASK><NEW_LINE>}<NEW_LINE>}<NEW_LINE>// this solves an off-by-one problem<NEW_LINE>longesti++;<NEW_LINE>// this solves an off-by-one problem<NEW_LINE>longestj++;<NEW_LINE>// at this point we know the length of the longest common<NEW_LINE>// substring, and also its location, since it ends at indexes<NEW_LINE>// longesti and longestj.<NEW_LINE>if (longest < minlen)<NEW_LINE>// all remaining common substrings are too short, so we stop<NEW_LINE>break;<NEW_LINE>// now we slice away the common substrings<NEW_LINE>s1 = s1.substring(0, longesti - longest) + s1.substring(longesti);<NEW_LINE>s2 = s2.substring(0, longestj - longest) + s2.substring(longestj);<NEW_LINE>removed += longest;<NEW_LINE>}<NEW_LINE>return formula.compute(removed, shortlen, longlen);<NEW_LINE>} | [i][j] = 0; |
567,426 | @JSONP<NEW_LINE>@NoCache<NEW_LINE>@Consumes(MediaType.APPLICATION_JSON)<NEW_LINE>@Produces({ MediaType.APPLICATION_JSON, "application/javascript" })<NEW_LINE>public Response deleteVersion(@Context final HttpServletRequest httpRequest, @Context final HttpServletResponse httpResponse, @PathParam("versionableInode") final String versionableInode) throws DotSecurityException, DotDataException {<NEW_LINE>final InitDataObject initData = new WebResource.InitBuilder(this.webResource).requestAndResponse(httpRequest, httpResponse).rejectWhenNoUser(true).init();<NEW_LINE>final User user = initData.getUser();<NEW_LINE>final PageMode mode = PageMode.get(httpRequest);<NEW_LINE>Logger.debug(this, () -> "Deleting the version by inode: " + versionableInode);<NEW_LINE>final String type = Try.of(() -> InodeUtils.getAssetTypeFromDB(versionableInode)).getOrNull();<NEW_LINE>if (null == type) {<NEW_LINE>throw new DoesNotExistException("The versionable inode: " + versionableInode + " does not exists");<NEW_LINE>}<NEW_LINE>this.versionableHelper.getAssetTypeByVersionableDeleteMap().getOrDefault(type, this.versionableHelper.getDefaultVersionableDeleteStrategy()).deleteVersionByInode(versionableInode, user, mode.respectAnonPerms);<NEW_LINE>return Response.ok(new ResponseEntityView("Version " + versionableInode <MASK><NEW_LINE>} | + " deleted successfully")).build(); |
193,147 | public static RoundChange decode(final Bytes data, final BftExtraDataCodec bftExtraDataCodec) {<NEW_LINE>final RLPInput rlpIn = RLP.input(data);<NEW_LINE>rlpIn.enterList();<NEW_LINE>final SignedData<RoundChangePayload> payload = readPayload(rlpIn, RoundChangePayload::readFrom);<NEW_LINE>final Optional<Block> block;<NEW_LINE>if (rlpIn.nextIsList() && rlpIn.nextSize() == 0) {<NEW_LINE>rlpIn.skipNext();<NEW_LINE>block = Optional.empty();<NEW_LINE>} else {<NEW_LINE>block = Optional.of(Block.readFrom(rlpIn, BftBlockHeaderFunctions.forCommittedSeal(bftExtraDataCodec)));<NEW_LINE>}<NEW_LINE>final List<SignedData<PreparePayload>> prepares = rlpIn.readList(r -> readPayload<MASK><NEW_LINE>rlpIn.leaveList();<NEW_LINE>return new RoundChange(payload, block, prepares);<NEW_LINE>} | (r, PreparePayload::readFrom)); |
1,307,858 | public void init() throws ServletException {<NEW_LINE>super.init();<NEW_LINE>try {<NEW_LINE>tcfBindings = (TopicConnectionFactory) new InitialContext().lookup("java:comp/env/eis/tcf");<NEW_LINE>} catch (NamingException e) {<NEW_LINE>e.printStackTrace();<NEW_LINE>}<NEW_LINE>System.out.println("Topic connection factory 'java:comp/env/eis/tcf':\n" + tcfBindings);<NEW_LINE>try {<NEW_LINE>tcfTCP = (TopicConnectionFactory) new InitialContext().lookup("java:comp/env/eis/tcf1");<NEW_LINE>} catch (NamingException e) {<NEW_LINE>e.printStackTrace();<NEW_LINE>}<NEW_LINE>System.out.println("Topic connection factory 'java:comp/env/eis/tcf1':\n" + tcfTCP);<NEW_LINE>try {<NEW_LINE>topic1 = (Topic) new InitialContext().lookup("eis/topic1");<NEW_LINE>} catch (NamingException e) {<NEW_LINE>e.printStackTrace();<NEW_LINE>}<NEW_LINE>System.<MASK><NEW_LINE>try {<NEW_LINE>topic2 = (Topic) new InitialContext().lookup("eis/topic2");<NEW_LINE>} catch (NamingException e) {<NEW_LINE>e.printStackTrace();<NEW_LINE>}<NEW_LINE>System.out.println("Topic 'eis/topic2':\n" + topic2);<NEW_LINE>if ((tcfBindings == null) || (tcfTCP == null) || (topic1 == null) || (topic2 == null)) {<NEW_LINE>throw new ServletException("Failed JMS initialization");<NEW_LINE>}<NEW_LINE>} | out.println("Topic 'eis/topic1':\n" + topic1); |
1,845,714 | private Mono<Response<B2CTenantResourceInner>> updateWithResponseAsync(String resourceGroupName, String resourceName, B2CTenantUpdateRequest updateTenantRequestBody, Context context) {<NEW_LINE>if (this.client.getEndpoint() == null) {<NEW_LINE>return Mono.<MASK><NEW_LINE>}<NEW_LINE>if (this.client.getSubscriptionId() == null) {<NEW_LINE>return Mono.error(new IllegalArgumentException("Parameter this.client.getSubscriptionId() is required and cannot be null."));<NEW_LINE>}<NEW_LINE>if (resourceGroupName == null) {<NEW_LINE>return Mono.error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null."));<NEW_LINE>}<NEW_LINE>if (resourceName == null) {<NEW_LINE>return Mono.error(new IllegalArgumentException("Parameter resourceName is required and cannot be null."));<NEW_LINE>}<NEW_LINE>if (updateTenantRequestBody != null) {<NEW_LINE>updateTenantRequestBody.validate();<NEW_LINE>}<NEW_LINE>final String accept = "application/json";<NEW_LINE>context = this.client.mergeContext(context);<NEW_LINE>return service.update(this.client.getEndpoint(), this.client.getSubscriptionId(), this.client.getApiVersion(), resourceGroupName, resourceName, updateTenantRequestBody, accept, context);<NEW_LINE>} | error(new IllegalArgumentException("Parameter this.client.getEndpoint() is required and cannot be null.")); |
1,595,211 | protected void configure() {<NEW_LINE>bind(CronPredictor.class).to(CronPredictorImpl.class);<NEW_LINE>bind(CronPredictorImpl.class).in(Singleton.class);<NEW_LINE>bind(CronJobManager.class).to(CronJobManagerImpl.class);<NEW_LINE>bind(CronJobManagerImpl.class).in(Singleton.class);<NEW_LINE>bind(CronScheduler.class).to(CronSchedulerImpl.class);<NEW_LINE>bind(CronSchedulerImpl.class<MASK><NEW_LINE>bind(AuroraCronJobFactory.class).in(Singleton.class);<NEW_LINE>bind(AuroraCronJob.class).in(Singleton.class);<NEW_LINE>bind(AuroraCronJob.Config.class).toInstance(new AuroraCronJob.Config(new BackoffHelper(options.cronStartInitialBackoff, options.cronStartMaxBackoff)));<NEW_LINE>PubsubEventModule.bindSubscriber(binder(), AuroraCronJob.class);<NEW_LINE>bind(CronLifecycle.class).in(Singleton.class);<NEW_LINE>addSchedulerActiveServiceBinding(binder()).to(CronLifecycle.class);<NEW_LINE>bind(new TypeLiteral<Integer>() {<NEW_LINE>}).annotatedWith(AuroraCronJob.CronMaxBatchSize.class).toInstance(options.cronMaxBatchSize);<NEW_LINE>bind(CronBatchWorker.class).in(Singleton.class);<NEW_LINE>addSchedulerActiveServiceBinding(binder()).to(CronBatchWorker.class);<NEW_LINE>} | ).in(Singleton.class); |
340,241 | private boolean isSSLRequired(com.ibm.ws.javaee.dd.web.common.SecurityConstraint archiveConstraint) {<NEW_LINE>boolean sslRequired = false;<NEW_LINE>UserDataConstraint dataConstraint = archiveConstraint.getUserDataConstraint();<NEW_LINE>if (dataConstraint != null) {<NEW_LINE><MASK><NEW_LINE>String webResourceName = archiveConstraint.getWebResourceCollections().get(0).getWebResourceName();<NEW_LINE>Map<String, ConfigItem<String>> userDataConstraintMap = configurator.getConfigItemMap(USER_DATA_CONSTRAINT_KEY);<NEW_LINE>ConfigItem<String> existingUserDataConstraint = userDataConstraintMap.get(webResourceName);<NEW_LINE>if (existingUserDataConstraint == null) {<NEW_LINE>userDataConstraintMap.put(webResourceName, this.configurator.createConfigItem(String.valueOf(transportGuarantee)));<NEW_LINE>if (transportGuarantee != UserDataConstraint.TRANSPORT_GUARANTEE_NONE) {<NEW_LINE>sslRequired = true;<NEW_LINE>}<NEW_LINE>} else {<NEW_LINE>this.configurator.validateDuplicateConfiguration(SECURITY_CONSTRAINT_KEY, USER_DATA_CONSTRAINT_KEY, String.valueOf(transportGuarantee), existingUserDataConstraint);<NEW_LINE>// ignore user-data-constraint specified in web-fragments, since it's already specified in web.xml<NEW_LINE>if (ConfigSource.WEB_FRAGMENT == this.configurator.getConfigSource() && ConfigSource.WEB_XML == existingUserDataConstraint.getSource()) {<NEW_LINE>return false;<NEW_LINE>}<NEW_LINE>}<NEW_LINE>}<NEW_LINE>return sslRequired;<NEW_LINE>} | int transportGuarantee = dataConstraint.getTransportGuarantee(); |
1,734,378 | public static int compare(Object o1, Object o2) {<NEW_LINE>if (o1 == null)<NEW_LINE>return o2 == null ? 0 : -1;<NEW_LINE>if (o2 == null)<NEW_LINE>return 1;<NEW_LINE>if (o1.equals(o2))<NEW_LINE>return 0;<NEW_LINE>if (o1 instanceof Number && o2 instanceof Number) {<NEW_LINE>if (o1 instanceof Double || o2 instanceof Double || o1 instanceof Float || o2 instanceof Float)<NEW_LINE>return Double.compare(((Number) o1).doubleValue(), ((Number<MASK><NEW_LINE>return Long.compare(((Number) o1).longValue(), ((Number) o2).longValue());<NEW_LINE>}<NEW_LINE>if (o1 instanceof Boolean && o2 instanceof Boolean)<NEW_LINE>return ((Boolean) o1) ? 1 : -1;<NEW_LINE>if (o1 instanceof Node && o2 instanceof Node)<NEW_LINE>return Long.compare(((Node) o1).getId(), ((Node) o2).getId());<NEW_LINE>if (o1 instanceof Relationship && o2 instanceof Relationship)<NEW_LINE>return Long.compare(((Relationship) o1).getId(), ((Relationship) o2).getId());<NEW_LINE>return o1.toString().compareTo(o2.toString());<NEW_LINE>} | ) o2).doubleValue()); |
534,838 | public ParentPet read(JsonReader in) throws IOException {<NEW_LINE>JsonObject jsonObj = elementAdapter.read(in).getAsJsonObject();<NEW_LINE>validateJsonObject(jsonObj);<NEW_LINE>// store additional fields in the deserialized instance<NEW_LINE>ParentPet instance = thisAdapter.fromJsonTree(jsonObj);<NEW_LINE>for (Map.Entry<String, JsonElement> entry : jsonObj.entrySet()) {<NEW_LINE>if (!openapiFields.contains(entry.getKey())) {<NEW_LINE>if (entry.getValue().isJsonPrimitive()) {<NEW_LINE>// primitive type<NEW_LINE>if (entry.getValue().getAsJsonPrimitive().isString())<NEW_LINE>instance.putAdditionalProperty(entry.getKey(), entry.getValue().getAsString());<NEW_LINE>else if (entry.getValue().getAsJsonPrimitive().isNumber())<NEW_LINE>instance.putAdditionalProperty(entry.getKey(), entry.getValue().getAsNumber());<NEW_LINE>else if (entry.getValue().getAsJsonPrimitive().isBoolean())<NEW_LINE>instance.putAdditionalProperty(entry.getKey(), entry.getValue().getAsBoolean());<NEW_LINE>else<NEW_LINE>throw new IllegalArgumentException(String.format("The field `%s` has unknown primitive type. Value: %s", entry.getKey(), entry.getValue<MASK><NEW_LINE>} else {<NEW_LINE>// non-primitive type<NEW_LINE>instance.putAdditionalProperty(entry.getKey(), gson.fromJson(entry.getValue(), HashMap.class));<NEW_LINE>}<NEW_LINE>}<NEW_LINE>}<NEW_LINE>return instance;<NEW_LINE>} | ().toString())); |
368,320 | private DefaultLoadControl createLoadControl() {<NEW_LINE>DefaultLoadControl.Builder <MASK><NEW_LINE>// baseBuilder.setAllocator(new DefaultAllocator(true, C.DEFAULT_BUFFER_SEGMENT_SIZE))<NEW_LINE>// .setBufferDurationsMs(2_500,<NEW_LINE>// 5_000,<NEW_LINE>// 1_000,<NEW_LINE>// 2_000)<NEW_LINE>// .setTargetBufferBytes(C.LENGTH_UNSET)<NEW_LINE>// .setPrioritizeTimeOverSizeThresholds(true);<NEW_LINE>if (PlayerController.BUFFER_HIGH == mPlayerData.getVideoBufferType()) {<NEW_LINE>// 30 seconds<NEW_LINE>int minBufferMs = 30000;<NEW_LINE>// technical infinity, recommended here a very high number, the max will be based on setTargetBufferBytes() value<NEW_LINE>int maxBufferMs = 36000000;<NEW_LINE>// half a seconds can be lower as lowe as 250<NEW_LINE>int bufferForPlaybackMs = 500;<NEW_LINE>// 3 seconds<NEW_LINE>int bufferForPlaybackAfterRebufferMs = 3000;<NEW_LINE>baseBuilder.setAllocator(new DefaultAllocator(true, C.DEFAULT_BUFFER_SEGMENT_SIZE)).setBufferDurationsMs(minBufferMs, maxBufferMs, bufferForPlaybackMs, bufferForPlaybackAfterRebufferMs).setTargetBufferBytes(mDeviceRam);<NEW_LINE>} else if (PlayerController.BUFFER_LOW == mPlayerData.getVideoBufferType()) {<NEW_LINE>baseBuilder.setBufferDurationsMs(DefaultLoadControl.DEFAULT_MIN_BUFFER_MS / 3, DefaultLoadControl.DEFAULT_MAX_BUFFER_MS / 3, DefaultLoadControl.DEFAULT_BUFFER_FOR_PLAYBACK_MS / 3, DefaultLoadControl.DEFAULT_BUFFER_FOR_PLAYBACK_AFTER_REBUFFER_MS / 3);<NEW_LINE>}<NEW_LINE>// Normal buffer is a default one<NEW_LINE>return baseBuilder.createDefaultLoadControl();<NEW_LINE>} | baseBuilder = new DefaultLoadControl.Builder(); |
1,170,221 | final CancelJobResult executeCancelJob(CancelJobRequest cancelJobRequest) {<NEW_LINE>ExecutionContext executionContext = createExecutionContext(cancelJobRequest);<NEW_LINE>AWSRequestMetrics awsRequestMetrics = executionContext.getAwsRequestMetrics();<NEW_LINE>awsRequestMetrics.startEvent(Field.ClientExecuteTime);<NEW_LINE>Request<CancelJobRequest> request = null;<NEW_LINE>Response<CancelJobResult> response = null;<NEW_LINE>try {<NEW_LINE><MASK><NEW_LINE>try {<NEW_LINE>request = new CancelJobRequestProtocolMarshaller(protocolFactory).marshall(super.beforeMarshalling(cancelJobRequest));<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, "DataExchange");<NEW_LINE>request.addHandlerContext(HandlerContextKey.OPERATION_NAME, "CancelJob");<NEW_LINE>request.addHandlerContext(HandlerContextKey.ADVANCED_CONFIG, advancedConfig);<NEW_LINE>} finally {<NEW_LINE>awsRequestMetrics.endEvent(Field.RequestMarshallTime);<NEW_LINE>}<NEW_LINE>HttpResponseHandler<AmazonWebServiceResponse<CancelJobResult>> responseHandler = protocolFactory.createResponseHandler(new JsonOperationMetadata().withPayloadJson(true).withHasStreamingSuccessResponse(false), new CancelJobResultJsonUnmarshaller());<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); |
587,696 | public MailDomainGroup parseMailDomainGroup(JsonObject obj) throws JsonParseException {<NEW_LINE>MailDomainGroup grp = new MailDomainGroup();<NEW_LINE>if (obj.containsKey("id")) {<NEW_LINE>grp.setId(obj.getJsonNumber("id").longValue());<NEW_LINE>}<NEW_LINE>grp.setDisplayName<MASK><NEW_LINE>grp.setDescription(obj.getString("description", null));<NEW_LINE>grp.setPersistedGroupAlias(getMandatoryString(obj, "alias"));<NEW_LINE>grp.setIsRegEx(obj.getBoolean("regex", false));<NEW_LINE>if (obj.containsKey("domains")) {<NEW_LINE>List<String> domains = // only validate if this group hasn't regex support enabled<NEW_LINE>Optional.ofNullable(obj.getJsonArray("domains")).orElse(Json.createArrayBuilder().build()).getValuesAs(JsonString.class).stream().map(JsonString::getString).filter(d -> (grp.isRegEx() || DomainValidator.getInstance().isValid(d))).collect(Collectors.toList());<NEW_LINE>if (domains.isEmpty())<NEW_LINE>throw new JsonParseException("Field domains may not be an empty array or contain invalid domains. Enabled regex support?");<NEW_LINE>grp.setEmailDomains(domains);<NEW_LINE>} else {<NEW_LINE>throw new JsonParseException("Field domains is mandatory.");<NEW_LINE>}<NEW_LINE>return grp;<NEW_LINE>} | (getMandatoryString(obj, "name")); |
887,491 | public RetryStatementNode transform(RetryStatementNode retryStatementNode) {<NEW_LINE>Token retryKeyword;<NEW_LINE>if (retryStatementNode.typeParameter().isPresent() || retryStatementNode.arguments().isPresent()) {<NEW_LINE>retryKeyword = formatToken(retryStatementNode.<MASK><NEW_LINE>} else {<NEW_LINE>retryKeyword = formatToken(retryStatementNode.retryKeyword(), 1, 0);<NEW_LINE>}<NEW_LINE>TypeParameterNode typeParameter = formatNode(retryStatementNode.typeParameter().orElse(null), 1, 0);<NEW_LINE>ParenthesizedArgList arguments = formatNode(retryStatementNode.arguments().orElse(null), 1, 0);<NEW_LINE>StatementNode retryBody;<NEW_LINE>if (retryStatementNode.onFailClause().isPresent()) {<NEW_LINE>retryBody = formatNode(retryStatementNode.retryBody(), 1, 0);<NEW_LINE>} else {<NEW_LINE>retryBody = formatNode(retryStatementNode.retryBody(), env.trailingWS, env.trailingNL);<NEW_LINE>}<NEW_LINE>OnFailClauseNode onFailClause = formatNode(retryStatementNode.onFailClause().orElse(null), env.trailingWS, env.trailingNL);<NEW_LINE>return retryStatementNode.modify().withRetryKeyword(retryKeyword).withTypeParameter(typeParameter).withArguments(arguments).withRetryBody(retryBody).withOnFailClause(onFailClause).apply();<NEW_LINE>} | retryKeyword(), 0, 0); |
1,573,052 | public void onResume() {<NEW_LINE>super.onResume();<NEW_LINE>if (media != null) {<NEW_LINE>depictsSearch.setOnKeyListener((v, keyCode, event) -> {<NEW_LINE>if (keyCode == KeyEvent.KEYCODE_BACK) {<NEW_LINE>depictsSearch.clearFocus();<NEW_LINE>presenter.clearPreviousSelection();<NEW_LINE>updateDepicts();<NEW_LINE>goBackToPreviousScreen();<NEW_LINE>return true;<NEW_LINE>}<NEW_LINE>return false;<NEW_LINE>});<NEW_LINE>Objects.requireNonNull(getView<MASK><NEW_LINE>getView().requestFocus();<NEW_LINE>getView().setOnKeyListener((v, keyCode, event) -> {<NEW_LINE>if (event.getAction() == KeyEvent.ACTION_UP && keyCode == KeyEvent.KEYCODE_BACK) {<NEW_LINE>presenter.clearPreviousSelection();<NEW_LINE>updateDepicts();<NEW_LINE>goBackToPreviousScreen();<NEW_LINE>return true;<NEW_LINE>}<NEW_LINE>return false;<NEW_LINE>});<NEW_LINE>Objects.requireNonNull(((AppCompatActivity) Objects.requireNonNull(getActivity())).getSupportActionBar()).hide();<NEW_LINE>if (getParentFragment().getParentFragment().getParentFragment() instanceof ContributionsFragment) {<NEW_LINE>((ContributionsFragment) (getParentFragment().getParentFragment().getParentFragment())).nearbyNotificationCardView.setVisibility(View.GONE);<NEW_LINE>}<NEW_LINE>}<NEW_LINE>} | ()).setFocusableInTouchMode(true); |
144,854 | private ImportConfig createImportConfig(final int batchSize) {<NEW_LINE>final List<GenomicsDBImportConfiguration.Partition> partitions = (intervals == null || intervals.isEmpty()) ? generatePartitionListFromWorkspace() : generatePartitionListFromIntervals();<NEW_LINE>GenomicsDBImportConfiguration.ImportConfiguration.Builder importConfigurationBuilder = GenomicsDBImportConfiguration.ImportConfiguration.newBuilder();<NEW_LINE>importConfigurationBuilder.addAllColumnPartitions(partitions);<NEW_LINE>importConfigurationBuilder.setSizePerColumnPartition(vcfBufferSizePerSample);<NEW_LINE>importConfigurationBuilder.setFailIfUpdating(true && !doIncrementalImport);<NEW_LINE>importConfigurationBuilder.setSegmentSize(segmentSize);<NEW_LINE>importConfigurationBuilder.setConsolidateTiledbArrayAfterLoad(doConsolidation);<NEW_LINE>importConfigurationBuilder.setEnableSharedPosixfsOptimizations(sharedPosixFSOptimizations);<NEW_LINE>ImportConfig importConfig = new ImportConfig(importConfigurationBuilder.build(), validateSampleToReaderMap, true, batchSize, mergedHeaderLines, sampleNameToVcfPath, bypassFeatureReader ? null : this::createSampleToReaderMap, doIncrementalImport);<NEW_LINE>importConfig.setOutputCallsetmapJsonFile(callsetMapJSONFile);<NEW_LINE>importConfig.setOutputVidmapJsonFile(vidMapJSONFile);<NEW_LINE>importConfig.setOutputVcfHeaderFile(vcfHeaderFile);<NEW_LINE>importConfig.setUseSamplesInOrder(true);<NEW_LINE><MASK><NEW_LINE>return importConfig;<NEW_LINE>} | importConfig.setFunctionToCallOnBatchCompletion(this::logMessageOnBatchCompletion); |
1,131,968 | public static Query createQuery(Criteria criteria) {<NEW_LINE>Assert.notNull(criteria, "criteria must not be null");<NEW_LINE>List<Query> shouldQueries = new ArrayList<>();<NEW_LINE>List<Query> mustNotQueries = new ArrayList<>();<NEW_LINE>List<Query> mustQueries = new ArrayList<>();<NEW_LINE>Query firstQuery = null;<NEW_LINE>boolean negateFirstQuery = false;<NEW_LINE>for (Criteria chainedCriteria : criteria.getCriteriaChain()) {<NEW_LINE>Query queryFragment = queryForEntries(chainedCriteria);<NEW_LINE>if (queryFragment != null) {<NEW_LINE>if (firstQuery == null) {<NEW_LINE>firstQuery = queryFragment;<NEW_LINE>negateFirstQuery = chainedCriteria.isNegating();<NEW_LINE>continue;<NEW_LINE>}<NEW_LINE>if (chainedCriteria.isOr()) {<NEW_LINE>shouldQueries.add(queryFragment);<NEW_LINE>} else if (chainedCriteria.isNegating()) {<NEW_LINE>mustNotQueries.add(queryFragment);<NEW_LINE>} else {<NEW_LINE>mustQueries.add(queryFragment);<NEW_LINE>}<NEW_LINE>}<NEW_LINE>}<NEW_LINE>for (Criteria subCriteria : criteria.getSubCriteria()) {<NEW_LINE>Query subQuery = createQuery(subCriteria);<NEW_LINE>if (subQuery != null) {<NEW_LINE>if (criteria.isOr()) {<NEW_LINE>shouldQueries.add(subQuery);<NEW_LINE>} else if (criteria.isNegating()) {<NEW_LINE>mustNotQueries.add(subQuery);<NEW_LINE>} else {<NEW_LINE>mustQueries.add(subQuery);<NEW_LINE>}<NEW_LINE>}<NEW_LINE>}<NEW_LINE>if (firstQuery != null) {<NEW_LINE>if (!shouldQueries.isEmpty() && mustNotQueries.isEmpty() && mustQueries.isEmpty()) {<NEW_LINE><MASK><NEW_LINE>} else {<NEW_LINE>if (negateFirstQuery) {<NEW_LINE>mustNotQueries.add(0, firstQuery);<NEW_LINE>} else {<NEW_LINE>mustQueries.add(0, firstQuery);<NEW_LINE>}<NEW_LINE>}<NEW_LINE>}<NEW_LINE>if (shouldQueries.isEmpty() && mustNotQueries.isEmpty() && mustQueries.isEmpty()) {<NEW_LINE>return null;<NEW_LINE>}<NEW_LINE>Query query = new Query.Builder().bool(boolQueryBuilder -> {<NEW_LINE>if (!shouldQueries.isEmpty()) {<NEW_LINE>boolQueryBuilder.should(shouldQueries);<NEW_LINE>}<NEW_LINE>if (!mustNotQueries.isEmpty()) {<NEW_LINE>boolQueryBuilder.mustNot(mustNotQueries);<NEW_LINE>}<NEW_LINE>if (!mustQueries.isEmpty()) {<NEW_LINE>boolQueryBuilder.must(mustQueries);<NEW_LINE>}<NEW_LINE>return boolQueryBuilder;<NEW_LINE>}).build();<NEW_LINE>return query;<NEW_LINE>} | shouldQueries.add(0, firstQuery); |
1,521,886 | private int nodeSourceStart(Binding field, ASTNode node, int index) {<NEW_LINE>if (node instanceof FieldReference) {<NEW_LINE>FieldReference fieldReference = (FieldReference) node;<NEW_LINE>return (int) <MASK><NEW_LINE>} else if (node instanceof QualifiedNameReference) {<NEW_LINE>QualifiedNameReference ref = (QualifiedNameReference) node;<NEW_LINE>if (ref.binding == field) {<NEW_LINE>if (index == 0) {<NEW_LINE>return (int) (ref.sourcePositions[ref.indexOfFirstFieldBinding - 1] >> 32);<NEW_LINE>} else {<NEW_LINE>return (int) (ref.sourcePositions[index] >> 32);<NEW_LINE>}<NEW_LINE>}<NEW_LINE>FieldBinding[] otherFields = ref.otherBindings;<NEW_LINE>if (otherFields != null) {<NEW_LINE>int offset = ref.indexOfFirstFieldBinding;<NEW_LINE>if (index != 0) {<NEW_LINE>for (int i = 0, length = otherFields.length; i < length; i++) {<NEW_LINE>if ((otherFields[i] == field) && (i + offset == index)) {<NEW_LINE>return (int) (ref.sourcePositions[i + offset] >> 32);<NEW_LINE>}<NEW_LINE>}<NEW_LINE>} else {<NEW_LINE>for (int i = 0, length = otherFields.length; i < length; i++) {<NEW_LINE>if (otherFields[i] == field) {<NEW_LINE>return (int) (ref.sourcePositions[i + offset] >> 32);<NEW_LINE>}<NEW_LINE>}<NEW_LINE>}<NEW_LINE>}<NEW_LINE>} else if (node instanceof ParameterizedQualifiedTypeReference) {<NEW_LINE>ParameterizedQualifiedTypeReference reference = (ParameterizedQualifiedTypeReference) node;<NEW_LINE>return (int) (reference.sourcePositions[0] >>> 32);<NEW_LINE>}<NEW_LINE>return node.sourceStart;<NEW_LINE>} | (fieldReference.nameSourcePosition >> 32); |
1,199,071 | private List<String> createHeaders(String childCounterName) {<NEW_LINE>final List<String> headers = new ArrayList<>();<NEW_LINE>headers.add(getRequestHeader());<NEW_LINE>if (includeGraph) {<NEW_LINE>headers.add(getString("Evolution"));<NEW_LINE>}<NEW_LINE>if (counterRequestAggregation.isTimesDisplayed()) {<NEW_LINE>headers.add(getString("temps_cumule"));<NEW_LINE>headers<MASK><NEW_LINE>headers.add(getString("Temps_moyen"));<NEW_LINE>headers.add(getString("Temps_max"));<NEW_LINE>headers.add(getString("Ecart_type"));<NEW_LINE>} else {<NEW_LINE>headers.add(getString("Hits"));<NEW_LINE>}<NEW_LINE>if (counterRequestAggregation.isCpuTimesDisplayed()) {<NEW_LINE>headers.add(getString("temps_cpu_cumule"));<NEW_LINE>headers.add(getString("Temps_cpu_moyen"));<NEW_LINE>}<NEW_LINE>if (counterRequestAggregation.isAllocatedKBytesDisplayed()) {<NEW_LINE>headers.add(getString("Ko_alloues_moyens"));<NEW_LINE>}<NEW_LINE>if (!isErrorAndNotJobCounter()) {<NEW_LINE>headers.add(getString("erreur_systeme"));<NEW_LINE>}<NEW_LINE>if (counterRequestAggregation.isResponseSizeDisplayed()) {<NEW_LINE>headers.add(getString("Taille_moyenne"));<NEW_LINE>}<NEW_LINE>if (counterRequestAggregation.isChildHitsDisplayed()) {<NEW_LINE>headers.add(getFormattedString("hits_fils_moyens", childCounterName));<NEW_LINE>headers.add(getFormattedString("temps_fils_moyen", childCounterName));<NEW_LINE>}<NEW_LINE>return headers;<NEW_LINE>} | .add(getString("Hits")); |
1,692,111 | public void marshall(DocumentDescription documentDescription, ProtocolMarshaller protocolMarshaller) {<NEW_LINE>if (documentDescription == null) {<NEW_LINE>throw new SdkClientException("Invalid argument passed to marshall(...)");<NEW_LINE>}<NEW_LINE>try {<NEW_LINE>protocolMarshaller.marshall(documentDescription.getSha1(), SHA1_BINDING);<NEW_LINE>protocolMarshaller.marshall(documentDescription.getHash(), HASH_BINDING);<NEW_LINE>protocolMarshaller.marshall(documentDescription.getHashType(), HASHTYPE_BINDING);<NEW_LINE>protocolMarshaller.marshall(documentDescription.getName(), NAME_BINDING);<NEW_LINE>protocolMarshaller.marshall(documentDescription.getDisplayName(), DISPLAYNAME_BINDING);<NEW_LINE>protocolMarshaller.marshall(documentDescription.getVersionName(), VERSIONNAME_BINDING);<NEW_LINE>protocolMarshaller.marshall(documentDescription.getOwner(), OWNER_BINDING);<NEW_LINE>protocolMarshaller.marshall(documentDescription.getCreatedDate(), CREATEDDATE_BINDING);<NEW_LINE>protocolMarshaller.marshall(documentDescription.getStatus(), STATUS_BINDING);<NEW_LINE>protocolMarshaller.marshall(documentDescription.getStatusInformation(), STATUSINFORMATION_BINDING);<NEW_LINE>protocolMarshaller.marshall(documentDescription.getDocumentVersion(), DOCUMENTVERSION_BINDING);<NEW_LINE>protocolMarshaller.marshall(documentDescription.getDescription(), DESCRIPTION_BINDING);<NEW_LINE>protocolMarshaller.marshall(documentDescription.getParameters(), PARAMETERS_BINDING);<NEW_LINE>protocolMarshaller.marshall(documentDescription.getPlatformTypes(), PLATFORMTYPES_BINDING);<NEW_LINE>protocolMarshaller.marshall(documentDescription.getDocumentType(), DOCUMENTTYPE_BINDING);<NEW_LINE>protocolMarshaller.marshall(<MASK><NEW_LINE>protocolMarshaller.marshall(documentDescription.getLatestVersion(), LATESTVERSION_BINDING);<NEW_LINE>protocolMarshaller.marshall(documentDescription.getDefaultVersion(), DEFAULTVERSION_BINDING);<NEW_LINE>protocolMarshaller.marshall(documentDescription.getDocumentFormat(), DOCUMENTFORMAT_BINDING);<NEW_LINE>protocolMarshaller.marshall(documentDescription.getTargetType(), TARGETTYPE_BINDING);<NEW_LINE>protocolMarshaller.marshall(documentDescription.getTags(), TAGS_BINDING);<NEW_LINE>protocolMarshaller.marshall(documentDescription.getAttachmentsInformation(), ATTACHMENTSINFORMATION_BINDING);<NEW_LINE>protocolMarshaller.marshall(documentDescription.getRequires(), REQUIRES_BINDING);<NEW_LINE>protocolMarshaller.marshall(documentDescription.getAuthor(), AUTHOR_BINDING);<NEW_LINE>protocolMarshaller.marshall(documentDescription.getReviewInformation(), REVIEWINFORMATION_BINDING);<NEW_LINE>protocolMarshaller.marshall(documentDescription.getApprovedVersion(), APPROVEDVERSION_BINDING);<NEW_LINE>protocolMarshaller.marshall(documentDescription.getPendingReviewVersion(), PENDINGREVIEWVERSION_BINDING);<NEW_LINE>protocolMarshaller.marshall(documentDescription.getReviewStatus(), REVIEWSTATUS_BINDING);<NEW_LINE>protocolMarshaller.marshall(documentDescription.getCategory(), CATEGORY_BINDING);<NEW_LINE>protocolMarshaller.marshall(documentDescription.getCategoryEnum(), CATEGORYENUM_BINDING);<NEW_LINE>} catch (Exception e) {<NEW_LINE>throw new SdkClientException("Unable to marshall request to JSON: " + e.getMessage(), e);<NEW_LINE>}<NEW_LINE>} | documentDescription.getSchemaVersion(), SCHEMAVERSION_BINDING); |
1,314,285 | public boolean execute(Object object) throws ContractExeException {<NEW_LINE>TransactionResultCapsule ret = (TransactionResultCapsule) object;<NEW_LINE>if (Objects.isNull(ret)) {<NEW_LINE>throw new RuntimeException(ActuatorConstant.TX_RESULT_NULL);<NEW_LINE>}<NEW_LINE>long fee = calcFee();<NEW_LINE>AccountStore accountStore = chainBaseManager.getAccountStore();<NEW_LINE>DynamicPropertiesStore dynamicStore = chainBaseManager.getDynamicPropertiesStore();<NEW_LINE>AssetIssueStore assetIssueStore = chainBaseManager.getAssetIssueStore();<NEW_LINE>AssetIssueV2Store assetIssueV2Store = chainBaseManager.getAssetIssueV2Store();<NEW_LINE>try {<NEW_LINE>final ParticipateAssetIssueContract participateAssetIssueContract = any.unpack(ParticipateAssetIssueContract.class);<NEW_LINE>long cost = participateAssetIssueContract.getAmount();<NEW_LINE>// subtract from owner address<NEW_LINE>byte[] ownerAddress = participateAssetIssueContract.getOwnerAddress().toByteArray();<NEW_LINE>AccountCapsule ownerAccount = accountStore.get(ownerAddress);<NEW_LINE>long balance = Math.subtractExact(ownerAccount.getBalance(), cost);<NEW_LINE>balance = Math.subtractExact(balance, fee);<NEW_LINE>ownerAccount.setBalance(balance);<NEW_LINE>byte[] key = participateAssetIssueContract.getAssetName().toByteArray();<NEW_LINE>// calculate the exchange amount<NEW_LINE>AssetIssueCapsule assetIssueCapsule;<NEW_LINE>assetIssueCapsule = Commons.getAssetIssueStoreFinal(dynamicStore, assetIssueStore, assetIssueV2Store).get(key);<NEW_LINE>long exchangeAmount = Math.multiplyExact(cost, assetIssueCapsule.getNum());<NEW_LINE>exchangeAmount = Math.floorDiv(exchangeAmount, assetIssueCapsule.getTrxNum());<NEW_LINE>ownerAccount.addAssetAmountV2(key, exchangeAmount, dynamicStore, assetIssueStore);<NEW_LINE>// add to to_address<NEW_LINE>byte[] toAddress = participateAssetIssueContract<MASK><NEW_LINE>AccountCapsule toAccount = accountStore.get(toAddress);<NEW_LINE>toAccount.setBalance(Math.addExact(toAccount.getBalance(), cost));<NEW_LINE>if (!toAccount.reduceAssetAmountV2(key, exchangeAmount, dynamicStore, assetIssueStore)) {<NEW_LINE>throw new ContractExeException("reduceAssetAmount failed !");<NEW_LINE>}<NEW_LINE>// write to db<NEW_LINE>accountStore.put(ownerAddress, ownerAccount);<NEW_LINE>accountStore.put(toAddress, toAccount);<NEW_LINE>ret.setStatus(fee, Protocol.Transaction.Result.code.SUCESS);<NEW_LINE>} catch (InvalidProtocolBufferException | ArithmeticException e) {<NEW_LINE>logger.debug(e.getMessage(), e);<NEW_LINE>ret.setStatus(fee, code.FAILED);<NEW_LINE>throw new ContractExeException(e.getMessage());<NEW_LINE>}<NEW_LINE>return true;<NEW_LINE>} | .getToAddress().toByteArray(); |
97,388 | protected void populateComponents() {<NEW_LINE>JPanel panel = new JPanel(new BorderLayout());<NEW_LINE>panel.setBorder(new EmptyBorder(10, 10, 10, 10));<NEW_LINE><MASK><NEW_LINE>dropdown = new JComboBox<>(dropdownModel);<NEW_LINE>topBox.add(dropdown);<NEW_LINE>// Avoid Swing's automatic indentation<NEW_LINE>JPanel inner = new JPanel(new BorderLayout());<NEW_LINE>description = new JLabel(HTML_BOLD_DESCRIPTION + "</html>");<NEW_LINE>description.setBorder(new EmptyBorder(10, 0, 10, 0));<NEW_LINE>inner.add(description);<NEW_LINE>topBox.add(inner);<NEW_LINE>panel.add(topBox, BorderLayout.NORTH);<NEW_LINE>layout = new PairLayout(5, 5);<NEW_LINE>pairPanel = new JPanel(layout);<NEW_LINE>JPanel centering = new JPanel(new FlowLayout(FlowLayout.CENTER));<NEW_LINE>JScrollPane scrolling = new JScrollPane(centering, JScrollPane.VERTICAL_SCROLLBAR_AS_NEEDED, JScrollPane.HORIZONTAL_SCROLLBAR_NEVER);<NEW_LINE>scrolling.setPreferredSize(new Dimension(100, 130));<NEW_LINE>panel.add(scrolling, BorderLayout.CENTER);<NEW_LINE>centering.add(pairPanel);<NEW_LINE>addWorkPanel(panel);<NEW_LINE>connectButton = new JButton();<NEW_LINE>AbstractConnectAction.styleButton(connectButton);<NEW_LINE>addButton(connectButton);<NEW_LINE>addCancelButton();<NEW_LINE>dropdown.addItemListener(this::itemSelected);<NEW_LINE>connectButton.addActionListener(this::connect);<NEW_LINE>} | Box topBox = Box.createVerticalBox(); |
1,465,013 | private void initUI() {<NEW_LINE>setUndecorated(true);<NEW_LINE>try {<NEW_LINE>if (GraphicsEnvironment.getLocalGraphicsEnvironment().getDefaultScreenDevice().isWindowTranslucencySupported(WindowTranslucency.TRANSLUCENT)) {<NEW_LINE>if (!Config.getInstance().isNoTransparency()) {<NEW_LINE>setOpacity(0.85f);<NEW_LINE>}<NEW_LINE>}<NEW_LINE>} catch (Exception e) {<NEW_LINE>Logger.log(e);<NEW_LINE>}<NEW_LINE>setIconImage(ImageResource.getImage("icon.png"));<NEW_LINE>setSize(getScaledInt(<MASK><NEW_LINE>setLocationRelativeTo(null);<NEW_LINE>setAlwaysOnTop(true);<NEW_LINE>getContentPane().setLayout(null);<NEW_LINE>getContentPane().setBackground(ColorResource.getDarkestBgColor());<NEW_LINE>JPanel titlePanel = new TitlePanel(null, this);<NEW_LINE>titlePanel.setOpaque(false);<NEW_LINE>titlePanel.setBounds(0, 0, getScaledInt(400), getScaledInt(50));<NEW_LINE>JButton closeBtn = new CustomButton();<NEW_LINE>closeBtn.setBounds(getScaledInt(365), getScaledInt(5), getScaledInt(30), getScaledInt(30));<NEW_LINE>closeBtn.setBackground(ColorResource.getDarkestBgColor());<NEW_LINE>closeBtn.setBorderPainted(false);<NEW_LINE>closeBtn.setFocusPainted(false);<NEW_LINE>closeBtn.setName("CLOSE");<NEW_LINE>closeBtn.setIcon(ImageResource.getIcon("title_close.png", 20, 20));<NEW_LINE>closeBtn.addActionListener(this);<NEW_LINE>titlePanel.add(closeBtn);<NEW_LINE>JLabel titleLbl = new JLabel(StringResource.get("BROWSER_MONITORING"));<NEW_LINE>titleLbl.setFont(FontResource.getBiggerFont());<NEW_LINE>titleLbl.setForeground(ColorResource.getSelectionColor());<NEW_LINE>titleLbl.setBounds(getScaledInt(25), getScaledInt(15), getScaledInt(200), getScaledInt(30));<NEW_LINE>titlePanel.add(titleLbl);<NEW_LINE>JLabel lineLbl = new JLabel();<NEW_LINE>lineLbl.setBackground(ColorResource.getSelectionColor());<NEW_LINE>lineLbl.setBounds(0, getScaledInt(55), getScaledInt(400), 1);<NEW_LINE>lineLbl.setOpaque(true);<NEW_LINE>add(lineLbl);<NEW_LINE>add(titlePanel);<NEW_LINE>int y = getScaledInt(65);<NEW_LINE>int h = getScaledInt(50);<NEW_LINE>JTextArea lblMonitoringTitle = new JTextArea();<NEW_LINE>lblMonitoringTitle.setOpaque(false);<NEW_LINE>lblMonitoringTitle.setWrapStyleWord(true);<NEW_LINE>lblMonitoringTitle.setLineWrap(true);<NEW_LINE>lblMonitoringTitle.setEditable(false);<NEW_LINE>lblMonitoringTitle.setForeground(Color.WHITE);<NEW_LINE>lblMonitoringTitle.setText(this.desc);<NEW_LINE>lblMonitoringTitle.setFont(FontResource.getNormalFont());<NEW_LINE>lblMonitoringTitle.setBounds(getScaledInt(15), y, getScaledInt(370) - getScaledInt(30), h);<NEW_LINE>add(lblMonitoringTitle);<NEW_LINE>y += h;<NEW_LINE>JButton btViewMonitoring = createButton1("CTX_COPY_URL", getScaledInt(15), y);<NEW_LINE>btViewMonitoring.setName("COPY");<NEW_LINE>add(btViewMonitoring);<NEW_LINE>y += btViewMonitoring.getHeight();<NEW_LINE>} | 400), getScaledInt(300)); |
206,649 | public void filter(final ContainerRequestContext requestContext) {<NEW_LINE>final List<String> profilingHeaderRequests = requestContext.<MASK><NEW_LINE>final String profilingHeaderRequest = (profilingHeaderRequests == null || profilingHeaderRequests.isEmpty()) ? null : profilingHeaderRequests.get(0);<NEW_LINE>if (profilingHeaderRequest != null) {<NEW_LINE>try {<NEW_LINE>Profiling.setPerThreadProfilingData(profilingHeaderRequest);<NEW_LINE>// If we need to profile JAXRS let's do it...<NEW_LINE>final ProfilingData profilingData = Profiling.getPerThreadProfilingData();<NEW_LINE>if (profilingData.getProfileFeature().isProfilingJAXRS()) {<NEW_LINE>profilingData.addStart(ProfilingFeatureType.JAXRS, requestContext.getUriInfo().getPath());<NEW_LINE>}<NEW_LINE>} catch (final IllegalArgumentException e) {<NEW_LINE>log.info("Profiling data output {} is not supported, profiling NOT enabled", profilingHeaderRequest);<NEW_LINE>}<NEW_LINE>}<NEW_LINE>} | getHeaders().get(PROFILING_HEADER_REQ); |
635,202 | private void checkForUpdates(final boolean autoRun) {<NEW_LINE>final Date now = new Date();<NEW_LINE>ResourceController.getResourceController().setProperty(LAST_UPDATE_CHECK_TIME, Long.toString(now.getTime()));<NEW_LINE>final String translatedWebUpdate = <MASK><NEW_LINE>final FreeplaneVersion localVersion = FreeplaneVersion.getVersion();<NEW_LINE>final HttpVersionClient translatedVersionClient = new HttpVersionClient(translatedWebUpdate, localVersion);<NEW_LINE>FreeplaneVersion lastTranslatedVersion = translatedVersionClient.getRemoteVersion();<NEW_LINE>if (lastTranslatedVersion == null) {<NEW_LINE>lastTranslatedVersion = localVersion;<NEW_LINE>}<NEW_LINE>final String history;<NEW_LINE>final FreeplaneVersion lastVersion;<NEW_LINE>final ConnectionStatus connectionStatus;<NEW_LINE>if (!ConnectionStatus.TRANSLATED.language.equals(DEFAULT_LANGUAGE)) {<NEW_LINE>final String defaultWebUpdate = getWebUpdateUrl(DEFAULT_LANGUAGE);<NEW_LINE>final HttpVersionClient defaultVersionClient = new HttpVersionClient(defaultWebUpdate, lastTranslatedVersion);<NEW_LINE>lastVersion = defaultVersionClient.getRemoteVersion();<NEW_LINE>history = defaultVersionClient.getHistory() + translatedVersionClient.getHistory();<NEW_LINE>connectionStatus = translatedVersionClient.isSuccessful() ? ConnectionStatus.TRANSLATED : defaultVersionClient.isSuccessful() ? ConnectionStatus.DEFAULT : ConnectionStatus.FAILURE;<NEW_LINE>} else {<NEW_LINE>lastVersion = lastTranslatedVersion;<NEW_LINE>history = translatedVersionClient.getHistory();<NEW_LINE>connectionStatus = translatedVersionClient.isSuccessful() ? ConnectionStatus.DEFAULT : ConnectionStatus.FAILURE;<NEW_LINE>}<NEW_LINE>if (!autoRun)<NEW_LINE>checkForAddonsUpdates();<NEW_LINE>controller.getViewController().invokeLater(new Runnable() {<NEW_LINE><NEW_LINE>public void run() {<NEW_LINE>if (autoRun) {<NEW_LINE>updateButton(lastVersion);<NEW_LINE>} else {<NEW_LINE>showUpdateDialog(connectionStatus.statusKey, lastVersion, history, connectionStatus.language);<NEW_LINE>updateButton(lastVersion);<NEW_LINE>}<NEW_LINE>setEnabled(true);<NEW_LINE>}<NEW_LINE>});<NEW_LINE>} | getWebUpdateUrl(ConnectionStatus.TRANSLATED.language); |
1,472,425 | final DescribeCustomPluginResult executeDescribeCustomPlugin(DescribeCustomPluginRequest describeCustomPluginRequest) {<NEW_LINE>ExecutionContext executionContext = createExecutionContext(describeCustomPluginRequest);<NEW_LINE>AWSRequestMetrics awsRequestMetrics = executionContext.getAwsRequestMetrics();<NEW_LINE>awsRequestMetrics.startEvent(Field.ClientExecuteTime);<NEW_LINE>Request<DescribeCustomPluginRequest> request = null;<NEW_LINE>Response<DescribeCustomPluginResult> response = null;<NEW_LINE>try {<NEW_LINE>awsRequestMetrics.startEvent(Field.RequestMarshallTime);<NEW_LINE>try {<NEW_LINE>request = new DescribeCustomPluginRequestProtocolMarshaller(protocolFactory).marshall(super.beforeMarshalling(describeCustomPluginRequest));<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, "KafkaConnect");<NEW_LINE>request.addHandlerContext(HandlerContextKey.OPERATION_NAME, "DescribeCustomPlugin");<NEW_LINE>request.addHandlerContext(HandlerContextKey.ADVANCED_CONFIG, advancedConfig);<NEW_LINE>} finally {<NEW_LINE>awsRequestMetrics.endEvent(Field.RequestMarshallTime);<NEW_LINE>}<NEW_LINE>HttpResponseHandler<AmazonWebServiceResponse<DescribeCustomPluginResult>> responseHandler = protocolFactory.createResponseHandler(new JsonOperationMetadata().withPayloadJson(true).withHasStreamingSuccessResponse(false), new DescribeCustomPluginResultJsonUnmarshaller());<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); |
781,533 | public static void main(String[] args) {<NEW_LINE>StanfordCoreNLP pipeline = new StanfordCoreNLP(PropertiesUtils.asProperties("annotators", "tokenize,ssplit,pos,lemma,ner"));<NEW_LINE>Annotation annotation = new Annotation("Casey is 21. Sally Atkinson's age is 30.");<NEW_LINE>pipeline.annotate(annotation);<NEW_LINE>List<CoreMap> sentences = annotation.get(CoreAnnotations.SentencesAnnotation.class);<NEW_LINE>List<TokenSequencePattern> tokenSequencePatterns = new ArrayList<>();<NEW_LINE>String[] patterns = { "(?$who [ ner: PERSON]+ ) /is/ (?$age [ pos: CD ] )", "(?$who [ ner: PERSON]+ ) /'s/ /age/ /is/ (?$age [ pos: CD ] )" };<NEW_LINE>for (String line : patterns) {<NEW_LINE>TokenSequencePattern pattern = TokenSequencePattern.compile(line);<NEW_LINE>tokenSequencePatterns.add(pattern);<NEW_LINE>}<NEW_LINE>MultiPatternMatcher<CoreMap> multiMatcher = TokenSequencePattern.getMultiPatternMatcher(tokenSequencePatterns);<NEW_LINE>int i = 0;<NEW_LINE>for (CoreMap sentence : sentences) {<NEW_LINE>List<CoreLabel> tokens = sentence.get(CoreAnnotations.TokensAnnotation.class);<NEW_LINE>System.out.println("Sentence #" + ++i);<NEW_LINE>System.out.print(" Tokens:");<NEW_LINE>for (CoreLabel token : tokens) {<NEW_LINE>System.out.print(' ');<NEW_LINE>System.out.print(token.toShortString("Text", "PartOfSpeech", "NamedEntityTag"));<NEW_LINE>}<NEW_LINE>System.out.println();<NEW_LINE>List<SequenceMatchResult<CoreMap>> answers = multiMatcher.findNonOverlapping(tokens);<NEW_LINE>int j = 0;<NEW_LINE>for (SequenceMatchResult<CoreMap> matched : answers) {<NEW_LINE>System.out.println(" Match #" + ++j);<NEW_LINE>System.out.println(" match: " + matched.group(0));<NEW_LINE>System.out.println(" who: " <MASK><NEW_LINE>System.out.println(" age: " + matched.group("$age"));<NEW_LINE>}<NEW_LINE>}<NEW_LINE>} | + matched.group("$who")); |
456,901 | public static void removeFieldFinalModifier(final Field field) {<NEW_LINE>// From Apache: FieldUtils.removeFinalModifier()<NEW_LINE>try {<NEW_LINE>if (Modifier.isFinal(field.getModifiers())) {<NEW_LINE>// Do all JREs implement Field with a private ivar called "modifiers"?<NEW_LINE>final Field modifiersField = <MASK><NEW_LINE>final boolean doForceAccess = !modifiersField.isAccessible();<NEW_LINE>if (doForceAccess) {<NEW_LINE>modifiersField.setAccessible(true);<NEW_LINE>}<NEW_LINE>try {<NEW_LINE>modifiersField.setInt(field, field.getModifiers() & ~Modifier.FINAL);<NEW_LINE>} finally {<NEW_LINE>if (doForceAccess) {<NEW_LINE>modifiersField.setAccessible(false);<NEW_LINE>}<NEW_LINE>}<NEW_LINE>}<NEW_LINE>} catch (final NoSuchFieldException ignored) {<NEW_LINE>// The field class contains always a modifiers field<NEW_LINE>} catch (final IllegalAccessException ignored) {<NEW_LINE>// The modifiers field is made accessible<NEW_LINE>}<NEW_LINE>} | Field.class.getDeclaredField("modifiers"); |
171,086 | public void show(View anchor, float anchorOverlap) {<NEW_LINE>updateItems();<NEW_LINE>if (mSystemUiVisibilityHelper != null)<NEW_LINE>mSystemUiVisibilityHelper.copyVisibility(getContentView());<NEW_LINE>// don't steal the focus, this will prevent the keyboard from changing<NEW_LINE>setFocusable(false);<NEW_LINE>// draw over stuff if needed<NEW_LINE>setClippingEnabled(false);<NEW_LINE>final Rect displayFrame = new Rect();<NEW_LINE>anchor.getWindowVisibleDisplayFrame(displayFrame);<NEW_LINE>final int[] anchorPos = new int[2];<NEW_LINE>anchor.getLocationOnScreen(anchorPos);<NEW_LINE>final int distanceToBottom = displayFrame.bottom - (anchorPos[1] + anchor.getHeight());<NEW_LINE>final int distanceToTop = anchorPos[1] - displayFrame.top;<NEW_LINE>LinearLayout linearLayout = getLinearLayout();<NEW_LINE>linearLayout.measure(View.MeasureSpec.makeMeasureSpec(0, View.MeasureSpec.UNSPECIFIED), View.MeasureSpec.makeMeasureSpec(0, View.MeasureSpec.UNSPECIFIED));<NEW_LINE>setWidth(linearLayout.getMeasuredWidth());<NEW_LINE>int xOffset = anchorPos[<MASK><NEW_LINE>if (xOffset + linearLayout.getMeasuredWidth() > displayFrame.right)<NEW_LINE>xOffset = displayFrame.right - linearLayout.getMeasuredWidth();<NEW_LINE>int overlapAmount = (int) (anchor.getHeight() * anchorOverlap);<NEW_LINE>int yOffset;<NEW_LINE>if (distanceToBottom > linearLayout.getMeasuredHeight()) {<NEW_LINE>// show below anchor<NEW_LINE>yOffset = anchorPos[1] + overlapAmount;<NEW_LINE>setAnimationStyle(R.style.PopupAnimationTop);<NEW_LINE>} else if (distanceToTop > distanceToBottom) {<NEW_LINE>// show above anchor<NEW_LINE>yOffset = anchorPos[1] + overlapAmount - linearLayout.getMeasuredHeight();<NEW_LINE>setAnimationStyle(R.style.PopupAnimationBottom);<NEW_LINE>if (distanceToTop < linearLayout.getMeasuredHeight()) {<NEW_LINE>// enable scroll<NEW_LINE>setHeight(distanceToTop + overlapAmount);<NEW_LINE>yOffset += linearLayout.getMeasuredHeight() - distanceToTop - overlapAmount;<NEW_LINE>}<NEW_LINE>} else {<NEW_LINE>// show below anchor with scroll<NEW_LINE>yOffset = anchorPos[1] + overlapAmount;<NEW_LINE>setAnimationStyle(R.style.PopupAnimationTop);<NEW_LINE>setHeight(distanceToBottom + overlapAmount);<NEW_LINE>}<NEW_LINE>showAtLocation(anchor, Gravity.START | Gravity.TOP, xOffset, yOffset);<NEW_LINE>} | 0] + anchor.getPaddingLeft(); |
1,477,061 | public JDBCStatement prepareLookupStatement(@NotNull JDBCSession session, @NotNull PostgreTableContainer container, @Nullable PostgreTableBase object, @Nullable String objectName) throws SQLException {<NEW_LINE>StringBuilder sql = new StringBuilder();<NEW_LINE>sql.append("SELECT c.oid,c.*,d.description");<NEW_LINE>if (getDataSource().isServerVersionAtLeast(10, 0)) {<NEW_LINE>sql.append(",pg_catalog.pg_get_expr(c.relpartbound, c.oid) as partition_expr, pg_catalog.pg_get_partkeydef(c.oid) as partition_key ");<NEW_LINE>}<NEW_LINE>sql.append("\nFROM pg_catalog.pg_class c\n").append("LEFT OUTER JOIN pg_catalog.pg_description d ON d.objoid=c.oid AND d.objsubid=0 AND d.classoid='pg_class'::regclass\n").append("WHERE c.relnamespace=? AND c.relkind not in ('i','I','c')").append(object == null && objectName == null ? "" : " AND relname=?");<NEW_LINE>final JDBCPreparedStatement dbStat = session.<MASK><NEW_LINE>dbStat.setLong(1, getObjectId());<NEW_LINE>if (object != null || objectName != null)<NEW_LINE>dbStat.setString(2, object != null ? object.getName() : objectName);<NEW_LINE>return dbStat;<NEW_LINE>} | prepareStatement(sql.toString()); |
490,280 | private void markupProgramHeaders(TaskMonitor monitor) {<NEW_LINE>int headerCount = elf.getProgramHeaderCount();<NEW_LINE>int size = elf.e_phentsize() * headerCount;<NEW_LINE>if (size == 0) {<NEW_LINE>return;<NEW_LINE>}<NEW_LINE>monitor.setMessage("Markup Program Headers ...");<NEW_LINE>Structure phStructDt = (Structure) elf.getProgramHeaders()[0].toDataType();<NEW_LINE>phStructDt = phStructDt.clone(program.getDataTypeManager());<NEW_LINE>Array arrayDt = new ArrayDataType(phStructDt, headerCount, size);<NEW_LINE>Address headerAddr = findLoadAddress(elf.e_phoff(), size);<NEW_LINE>// Create block for header if failed to locate load<NEW_LINE>try {<NEW_LINE>if (headerAddr == null) {<NEW_LINE>if (!ElfLoaderOptionsFactory.includeOtherBlocks(options)) {<NEW_LINE>return;<NEW_LINE>}<NEW_LINE>headerAddr = <MASK><NEW_LINE>MemoryBlock block = createInitializedBlock(null, true, ELF_PROGRAM_HEADERS_BLOCK_NAME, headerAddr, elf.e_phoff(), arrayDt.getLength(), "Elf Program Headers", false, false, false, monitor);<NEW_LINE>headerAddr = block.getStart();<NEW_LINE>}<NEW_LINE>addElfHeaderReferenceMarkup(elf.getPhoffComponentOrdinal(), headerAddr);<NEW_LINE>Data array = createData(headerAddr, program.getDataTypeManager().resolve(arrayDt, null));<NEW_LINE>if (array == null) {<NEW_LINE>return;<NEW_LINE>}<NEW_LINE>ElfProgramHeader[] programHeaders = elf.getProgramHeaders();<NEW_LINE>monitor.setMaximum(programHeaders.length);<NEW_LINE>// p_vaddr structure element index<NEW_LINE>int vaddrFieldIndex = elf.is64Bit() ? 3 : 2;<NEW_LINE>for (int i = 0; i < programHeaders.length; i++) {<NEW_LINE>monitor.checkCanceled();<NEW_LINE>monitor.incrementProgress(1);<NEW_LINE>Data d = array.getComponent(i);<NEW_LINE>d.setComment(CodeUnit.EOL_COMMENT, programHeaders[i].getComment());<NEW_LINE>if (programHeaders[i].getType() == ElfProgramHeaderConstants.PT_NULL) {<NEW_LINE>continue;<NEW_LINE>}<NEW_LINE>if (programHeaders[i].getOffset() == 0) {<NEW_LINE>// has been stripped<NEW_LINE>continue;<NEW_LINE>}<NEW_LINE>Address segmentAddr = findLoadAddress(programHeaders[i], 0);<NEW_LINE>if (segmentAddr != null) {<NEW_LINE>// add reference to p_vaddr component<NEW_LINE>Data component = d.getComponent(vaddrFieldIndex);<NEW_LINE>component.addOperandReference(0, segmentAddr, RefType.DATA, SourceType.IMPORTED);<NEW_LINE>}<NEW_LINE>}<NEW_LINE>} catch (Exception e) {<NEW_LINE>log("Failed to markup Elf program/segment headers: " + getMessage(e));<NEW_LINE>}<NEW_LINE>} | AddressSpace.OTHER_SPACE.getAddress(0); |
820,284 | public double aggregate(final double current, final BaseObjectColumnValueSelector[] selectorList) {<NEW_LINE>Context cx = Context.getCurrentContext();<NEW_LINE>if (cx == null) {<NEW_LINE>cx = contextFactory.enterContext();<NEW_LINE>// Disable primitive wrapping- we want Java strings and primitives to behave like JS entities.<NEW_LINE>cx.getWrapFactory().setJavaPrimitiveWrap(false);<NEW_LINE>}<NEW_LINE>final int size = selectorList.length;<NEW_LINE>final Object[] args = new Object[size + 1];<NEW_LINE>args[0] = current;<NEW_LINE>for (int i = 0; i < size; i++) {<NEW_LINE>final BaseObjectColumnValueSelector selector = selectorList[i];<NEW_LINE>if (selector != null) {<NEW_LINE>final <MASK><NEW_LINE>if (arg != null && arg.getClass().isArray()) {<NEW_LINE>// Context.javaToJS on an array sort of works, although it returns false for Array.isArray(...) and<NEW_LINE>// may have other issues too. Let's just copy the array and wrap that.<NEW_LINE>args[i + 1] = cx.newArray(scope, arrayToObjectArray(arg));<NEW_LINE>} else if (arg instanceof List) {<NEW_LINE>// Using toArray(Object[]), instead of just toArray(), because Arrays.asList()'s impl and similar List<NEW_LINE>// impls could clone the underlying array in toArray(), that could be not Object[], but e. g. String[].<NEW_LINE>args[i + 1] = cx.newArray(scope, ((List) arg).toArray(ObjectArrays.EMPTY_ARRAY));<NEW_LINE>} else {<NEW_LINE>args[i + 1] = Context.javaToJS(arg, scope);<NEW_LINE>}<NEW_LINE>}<NEW_LINE>}<NEW_LINE>final Object res = fnAggregate.call(cx, scope, scope, args);<NEW_LINE>return Context.toNumber(res);<NEW_LINE>} | Object arg = selector.getObject(); |
64,032 | public RuleClass build(RuleClass.Builder builder, RuleDefinitionEnvironment env) {<NEW_LINE>return // We don't want C++ tests to be dynamically linked by default on Windows,<NEW_LINE>builder.requiresConfigurationFragments(CppConfiguration.class).setImplicitOutputsFunction(CppRuleClasses.CC_BINARY_DEBUG_PACKAGE).// because windows_export_all_symbols is not enabled by default, and it cannot solve<NEW_LINE>// all symbols visibility issues, for example, users still have to use __declspec(dllimport)<NEW_LINE>// to decorate data symbols imported from DLL.<NEW_LINE>override(attr("linkstatic", BOOLEAN).value(OS.getCurrent() == OS.WINDOWS)).override(attr("stamp", TRISTATE).value(TriState.NO)).add(attr(":lcov_merger", LABEL).value(BaseRuleClasses.getCoverageOutputGeneratorLabel())).add(attr("$collect_cc_coverage", LABEL).cfg(ExecutionTransitionFactory.create()).singleArtifact().value(env.getToolsLabel(<MASK><NEW_LINE>} | "//tools/test:collect_cc_coverage"))).build(); |
192,024 | public Type cloneAndAdd(DatabaseSession session, Type input) throws BimserverDatabaseException {<NEW_LINE>if (input instanceof BooleanType) {<NEW_LINE>BooleanType booleanType = session.create(BooleanType.class);<NEW_LINE>booleanType.setValue(((BooleanType) input).isValue());<NEW_LINE>session.store(booleanType);<NEW_LINE>return booleanType;<NEW_LINE>} else if (input instanceof StringType) {<NEW_LINE>StringType stringType = session.create(StringType.class);<NEW_LINE>stringType.setValue(((StringType) input).getValue());<NEW_LINE>session.store(stringType);<NEW_LINE>return stringType;<NEW_LINE>} else if (input instanceof DoubleType) {<NEW_LINE>DoubleType doubleType = <MASK><NEW_LINE>doubleType.setValue(((DoubleType) input).getValue());<NEW_LINE>session.store(doubleType);<NEW_LINE>return doubleType;<NEW_LINE>} else if (input instanceof LongType) {<NEW_LINE>LongType longType = session.create(LongType.class);<NEW_LINE>longType.setValue(((LongType) input).getValue());<NEW_LINE>session.store(longType);<NEW_LINE>return longType;<NEW_LINE>} else if (input instanceof ByteArrayType) {<NEW_LINE>ByteArrayType byteArrayType = session.create(ByteArrayType.class);<NEW_LINE>byteArrayType.setValue(((ByteArrayType) input).getValue());<NEW_LINE>session.store(byteArrayType);<NEW_LINE>return byteArrayType;<NEW_LINE>}<NEW_LINE>return null;<NEW_LINE>} | session.create(DoubleType.class); |
1,721,123 | static boolean isInternal(DebugStackFrame sf) {<NEW_LINE>boolean isInternal = false;<NEW_LINE>try {<NEW_LINE>isInternal = sf.isInternal();<NEW_LINE>} catch (Exception ex) {<NEW_LINE>LangErrors.exception("Frame " + sf.getName() + " .isInternal()", ex);<NEW_LINE>// System.err.println("Is Internal blew up for "+sf+", name = "+sf.getName()+", source = "+DebuggerVisualizer.getSourceLocation(sf.getSourceSection()));<NEW_LINE>// System.err.println(" source section = "+sf.getSourceSection());<NEW_LINE>try {<NEW_LINE>Method findCurrentRootMethod = DebugStackFrame.class.getDeclaredMethod("findCurrentRoot");<NEW_LINE>findCurrentRootMethod.setAccessible(true);<NEW_LINE>RootNode rn = (RootNode) findCurrentRootMethod.invoke(sf);<NEW_LINE>// System.err.println(" root node = "+rn);<NEW_LINE>// System.err.println(" source section = "+rn.getSourceSection());<NEW_LINE>isInternal <MASK><NEW_LINE>} catch (IllegalAccessException | IllegalArgumentException | InvocationTargetException | NoSuchMethodException | SecurityException ex2) {<NEW_LINE>LangErrors.exception("Frame " + sf.getName() + " findCurrentRoot() invocation", ex2);<NEW_LINE>}<NEW_LINE>}<NEW_LINE>return isInternal;<NEW_LINE>} | = rn.getSourceSection() == null; |
1,080,654 | public void cleanup() {<NEW_LINE>if (recording) {<NEW_LINE>pause();<NEW_LINE>}<NEW_LINE>recording = false;<NEW_LINE>if (redirectToAudioBuffer) {<NEW_LINE>MediaManager.releaseAudioBuffer(path);<NEW_LINE>}<NEW_LINE>if (line == null) {<NEW_LINE>return;<NEW_LINE>}<NEW_LINE>line.close();<NEW_LINE>if (!redirectToAudioBuffer && isMP3EncodingSupported() && "audio/mp3".equalsIgnoreCase(fMime)) {<NEW_LINE>final Throwable[] t = new Throwable[1];<NEW_LINE>CN.invokeAndBlock(new Runnable() {<NEW_LINE><NEW_LINE>public void run() {<NEW_LINE>try {<NEW_LINE>FileEncoder.getEncoder("audio/wav", "audio/mp3").encode(<MASK><NEW_LINE>wavFile.delete();<NEW_LINE>} catch (Throwable ex) {<NEW_LINE>com.codename1.io.Log.e(ex);<NEW_LINE>t[0] = ex;<NEW_LINE>fireMediaError(new MediaException(MediaErrorType.Encode, ex));<NEW_LINE>}<NEW_LINE>}<NEW_LINE>});<NEW_LINE>// if (t[0] != null) {<NEW_LINE>// throw new RuntimeException(t[0]);<NEW_LINE>// }<NEW_LINE>}<NEW_LINE>line = null;<NEW_LINE>} | wavFile, outFile, getAudioFormat()); |
794,229 | public void testCompletionStageRxInvoker_getIbmOverridesCbConnectionTimeout(Map<String, String> param, StringBuilder ret) {<NEW_LINE>String target = null;<NEW_LINE>if (isZOS()) {<NEW_LINE>// https://stackoverflow.com/a/904609/6575578<NEW_LINE>target = "http://example.com:81";<NEW_LINE>} else {<NEW_LINE>// Connect to telnet port - which should be disabled on all non-Z test machines - so we should expect a timeout<NEW_LINE>target = "http://localhost:23/blah";<NEW_LINE>}<NEW_LINE>ClientBuilder cb = ClientBuilder.newBuilder();<NEW_LINE>cb.connectTimeout(clientBuilderTimeout, TimeUnit.MILLISECONDS);<NEW_LINE>cb.property("com.ibm.ws.jaxrs.client.connection.timeout", TIMEOUT);<NEW_LINE>Client c = cb.build();<NEW_LINE>WebTarget t = c.target(target);<NEW_LINE>Builder builder = t.request();<NEW_LINE>CompletionStageRxInvoker completionStageRxInvoker = builder.rx();<NEW_LINE>long startTime = System.currentTimeMillis();<NEW_LINE>CompletionStage<Response> completionStage = completionStageRxInvoker.get();<NEW_LINE>long elapsed = System.currentTimeMillis() - startTime;<NEW_LINE>System.out.println("testCompletionStageRxInvoker_getIbmOverridesCbConnectionTimeout with TIMEOUT " + TIMEOUT + " completionStageRxInvoker.get elapsed time " + elapsed);<NEW_LINE>CompletableFuture<Response> completableFuture = completionStage.toCompletableFuture();<NEW_LINE>long startTime2 = System.currentTimeMillis();<NEW_LINE>try {<NEW_LINE>Response response = completableFuture.get();<NEW_LINE>// Did not time out as expected<NEW_LINE>ret.append(response.readEntity(String.class));<NEW_LINE>} catch (InterruptedException e) {<NEW_LINE>ret.append("InterruptedException");<NEW_LINE>e.printStackTrace();<NEW_LINE>} catch (ExecutionException e) {<NEW_LINE>if (e.getCause().toString().contains("ProcessingException")) {<NEW_LINE>ret.append("Timeout as expected");<NEW_LINE>} else {<NEW_LINE>ret.append("ExecutionException");<NEW_LINE>e.printStackTrace();<NEW_LINE>}<NEW_LINE>}<NEW_LINE>long elapsed2 <MASK><NEW_LINE>System.out.println("testCompletionStageRxInvoker_getIbmOverridesCbConnectionTimeout with TIMEOUT " + TIMEOUT + " completableFuture.get() elapsed2 time " + elapsed2);<NEW_LINE>if (elapsed > clientBuilderTimeout) {<NEW_LINE>ret.setLength(0);<NEW_LINE>ret.append("Failure used clientBuilderTimeout ").append(clientBuilderTimeout).append(" instead of IBM timeout ").append(TIMEOUT).append(" as the elapsed time was ").append(elapsed);<NEW_LINE>System.out.println("testCompletionStageRxInvoker_getIbmOverridesCbConnectionTimeout " + ret);<NEW_LINE>}<NEW_LINE>c.close();<NEW_LINE>} | = System.currentTimeMillis() - startTime2; |
600,610 | public static RawTypeInstance loadRawTypeInstance(final SQLProvider provider, final INaviModule module, final Integer typeInstanceId) throws CouldntLoadDataException {<NEW_LINE>Preconditions.checkNotNull(provider, "Error: provider argument can not be null");<NEW_LINE>Preconditions.checkNotNull(module, "Error: module argument can not be null");<NEW_LINE>Preconditions.checkNotNull(typeInstanceId, "Error: typeInstanceId argument can not be null");<NEW_LINE>final String query = " SELECT * FROM load_type_instance(?, ?) ";<NEW_LINE>try {<NEW_LINE>final PreparedStatement statement = provider.getConnection().getConnection().prepareStatement(query, ResultSet.TYPE_SCROLL_INSENSITIVE, ResultSet.CONCUR_READ_ONLY);<NEW_LINE>statement.setInt(1, module.getConfiguration().getId());<NEW_LINE><MASK><NEW_LINE>final ResultSet resultSet = statement.executeQuery();<NEW_LINE>try {<NEW_LINE>while (resultSet.next()) {<NEW_LINE>if (resultSet.first()) {<NEW_LINE>final int moduleId = resultSet.getInt("module_id");<NEW_LINE>final int id = resultSet.getInt("id");<NEW_LINE>final String name = resultSet.getString("name");<NEW_LINE>final int commentId = resultSet.getInt("comment_id");<NEW_LINE>final int typeId = resultSet.getInt("type_id");<NEW_LINE>final int sectionId = resultSet.getInt("section_id");<NEW_LINE>final long sectionOffset = resultSet.getLong("section_offset");<NEW_LINE>return new RawTypeInstance(moduleId, id, name, commentId, typeId, sectionId, sectionOffset);<NEW_LINE>}<NEW_LINE>}<NEW_LINE>} finally {<NEW_LINE>resultSet.close();<NEW_LINE>statement.close();<NEW_LINE>}<NEW_LINE>} catch (final SQLException exception) {<NEW_LINE>throw new CouldntLoadDataException(exception);<NEW_LINE>}<NEW_LINE>throw new CouldntLoadDataException("Error: could not load singe type instance from the database.");<NEW_LINE>} | statement.setInt(2, typeInstanceId); |
647,607 | private boolean extendToSpot(AbstractBeamInter beam, HorizontalSide side, Integer maxDx) {<NEW_LINE>final boolean logging = beam.isVip() || logger.isDebugEnabled();<NEW_LINE>final int dx = (maxDx == null) ? params.maxExtensionToSpot : Math.min(params.maxExtensionToSpot, maxDx);<NEW_LINE>final Area luArea = sideAreaOf("O", beam, side, 0, dx, 0);<NEW_LINE>final List<Glyph> spots = new ArrayList<>(Glyphs.intersectedGlyphs(sortedBeamSpots, luArea));<NEW_LINE>Collections.sort(spots, Glyphs.byAbscissa);<NEW_LINE>if (beam.getGlyph() != null) {<NEW_LINE>// Safer<NEW_LINE>spots.remove(beam.getGlyph());<NEW_LINE>}<NEW_LINE>if (!spots.isEmpty()) {<NEW_LINE>// Pick up the nearest spot<NEW_LINE>Glyph spot = (side == LEFT) ? spots.get(spots.size() - 1) : spots.get(0);<NEW_LINE>if (logging) {<NEW_LINE>logger.info("VIP {} found spot#{} on {}", beam, <MASK><NEW_LINE>}<NEW_LINE>// Try to extend the beam to this spot, inclusive<NEW_LINE>Line2D median = beam.getMedian();<NEW_LINE>Rectangle spotBox = spot.getBounds();<NEW_LINE>int x = (side == LEFT) ? spotBox.x : ((spotBox.x + spotBox.width) - 1);<NEW_LINE>Point2D extPt = LineUtil.intersectionAtX(median, x);<NEW_LINE>return extendToPoint(beam, side, extPt);<NEW_LINE>}<NEW_LINE>return false;<NEW_LINE>} | spot.getId(), side); |
1,658,792 | public static BatchGetDeviceStateResponse unmarshall(BatchGetDeviceStateResponse batchGetDeviceStateResponse, UnmarshallerContext _ctx) {<NEW_LINE>batchGetDeviceStateResponse.setRequestId(_ctx.stringValue("BatchGetDeviceStateResponse.RequestId"));<NEW_LINE>batchGetDeviceStateResponse.setSuccess(_ctx.booleanValue("BatchGetDeviceStateResponse.Success"));<NEW_LINE>batchGetDeviceStateResponse.setCode(_ctx.stringValue("BatchGetDeviceStateResponse.Code"));<NEW_LINE>batchGetDeviceStateResponse.setErrorMessage(_ctx.stringValue("BatchGetDeviceStateResponse.ErrorMessage"));<NEW_LINE>List<DeviceStatus> deviceStatusList = new ArrayList<DeviceStatus>();<NEW_LINE>for (int i = 0; i < _ctx.lengthValue("BatchGetDeviceStateResponse.DeviceStatusList.Length"); i++) {<NEW_LINE>DeviceStatus deviceStatus = new DeviceStatus();<NEW_LINE>deviceStatus.setDeviceId(_ctx.stringValue("BatchGetDeviceStateResponse.DeviceStatusList[" + i + "].DeviceId"));<NEW_LINE>deviceStatus.setDeviceName(_ctx.stringValue("BatchGetDeviceStateResponse.DeviceStatusList[" + i + "].DeviceName"));<NEW_LINE>deviceStatus.setStatus(_ctx.stringValue("BatchGetDeviceStateResponse.DeviceStatusList[" + i + "].Status"));<NEW_LINE>deviceStatus.setAsAddress(_ctx.stringValue("BatchGetDeviceStateResponse.DeviceStatusList[" + i + "].AsAddress"));<NEW_LINE>deviceStatus.setLastOnlineTime(_ctx.stringValue<MASK><NEW_LINE>deviceStatus.setIotId(_ctx.stringValue("BatchGetDeviceStateResponse.DeviceStatusList[" + i + "].IotId"));<NEW_LINE>deviceStatusList.add(deviceStatus);<NEW_LINE>}<NEW_LINE>batchGetDeviceStateResponse.setDeviceStatusList(deviceStatusList);<NEW_LINE>return batchGetDeviceStateResponse;<NEW_LINE>} | ("BatchGetDeviceStateResponse.DeviceStatusList[" + i + "].LastOnlineTime")); |
405,396 | public static void serialize(final LocalDateTime value, final JsonWriter sw) {<NEW_LINE>final int year = value.getYear();<NEW_LINE>if (year < 0) {<NEW_LINE>throw new SerializationException("Negative dates are not supported.");<NEW_LINE>} else if (year > 9999) {<NEW_LINE>sw.writeByte(JsonWriter.QUOTE);<NEW_LINE>sw.writeAscii(value.toString());<NEW_LINE>sw.writeByte(JsonWriter.QUOTE);<NEW_LINE>return;<NEW_LINE>}<NEW_LINE>final byte[] buf = sw.ensureCapacity(32);<NEW_LINE>final int pos = sw.size();<NEW_LINE>buf[pos] = '"';<NEW_LINE>NumberConverter.write4(year, buf, pos + 1);<NEW_LINE>buf[pos + 5] = '-';<NEW_LINE>NumberConverter.write2(value.getMonthValue(), buf, pos + 6);<NEW_LINE>buf[pos + 8] = '-';<NEW_LINE>NumberConverter.write2(value.getDayOfMonth(), buf, pos + 9);<NEW_LINE>buf[pos + 11] = 'T';<NEW_LINE>NumberConverter.write2(value.getHour(), buf, pos + 12);<NEW_LINE><MASK><NEW_LINE>NumberConverter.write2(value.getMinute(), buf, pos + 15);<NEW_LINE>buf[pos + 17] = ':';<NEW_LINE>NumberConverter.write2(value.getSecond(), buf, pos + 18);<NEW_LINE>final int nano = value.getNano();<NEW_LINE>if (nano != 0) {<NEW_LINE>final int end = writeNano(buf, pos + 20, nano);<NEW_LINE>buf[pos + 20 + end] = '"';<NEW_LINE>sw.advance(end + 21);<NEW_LINE>} else {<NEW_LINE>buf[pos + 20] = '"';<NEW_LINE>sw.advance(21);<NEW_LINE>}<NEW_LINE>} | buf[pos + 14] = ':'; |
1,340,257 | private static void insertBlocks(BlockStore blockStore, BlockFactory blockFactory, RLPElement encodedTuples) {<NEW_LINE>RLPList blocksData = RLP.decodeList(encodedTuples.getRLPData());<NEW_LINE>for (int k = 0; k < blocksData.size(); k++) {<NEW_LINE>RLPElement element = blocksData.get(k);<NEW_LINE>RLPList blockData = RLP.decodeList(element.getRLPData());<NEW_LINE>RLPList tuple = RLP.<MASK><NEW_LINE>Block block = blockFactory.decodeBlock(Objects.requireNonNull(tuple.get(0).getRLPData(), "block data is missing"));<NEW_LINE>BlockDifficulty blockDifficulty = new BlockDifficulty(new BigInteger(Objects.requireNonNull(tuple.get(1).getRLPData(), "block difficulty data is missing")));<NEW_LINE>blockStore.saveBlock(block, blockDifficulty, true);<NEW_LINE>}<NEW_LINE>blockStore.flush();<NEW_LINE>} | decodeList(blockData.getRLPData()); |
1,654,052 | public static CodegenExpressionNewAnonymousClass codegenEvaluatorObjectArray(ExprForge[] forges, CodegenMethod method, Class generator, CodegenClassScope classScope) {<NEW_LINE>CodegenExpressionNewAnonymousClass evaluator = newAnonymousClass(method.getBlock(), ExprEvaluator.EPTYPE);<NEW_LINE>CodegenMethod evaluate = CodegenMethod.makeParentNode(EPTypePremade.OBJECT.getEPType(), generator, classScope).addParam(ExprForgeCodegenNames.PARAMS);<NEW_LINE>evaluator.addMethod("evaluate", evaluate);<NEW_LINE>ExprForgeCodegenSymbol exprSymbol = new ExprForgeCodegenSymbol(true, null);<NEW_LINE>CodegenMethod exprMethod = evaluate.makeChildWithScope(EPTypePremade.OBJECT.getEPType(), CodegenLegoMethodExpression.class, exprSymbol, classScope).addParam(ExprForgeCodegenNames.PARAMS);<NEW_LINE>CodegenExpression[] expressions = new CodegenExpression[forges.length];<NEW_LINE>for (int i = 0; i < forges.length; i++) {<NEW_LINE>EPType type = forges[i].getEvaluationType();<NEW_LINE>if (type == null || type == EPTypeNull.INSTANCE) {<NEW_LINE>expressions[i] = constantNull();<NEW_LINE>} else {<NEW_LINE>expressions[i] = forges[i].evaluateCodegen((EPTypeClass) type, exprMethod, exprSymbol, classScope);<NEW_LINE>}<NEW_LINE>}<NEW_LINE>exprSymbol.derivedSymbolsCodegen(evaluate, exprMethod.getBlock(), classScope);<NEW_LINE>exprMethod.getBlock().declareVar(EPTypePremade.OBJECTARRAY.getEPType(), "values", newArrayByLength(EPTypePremade.OBJECT.getEPType(), constant(forges.length)));<NEW_LINE>for (int i = 0; i < forges.length; i++) {<NEW_LINE>CodegenExpression result = expressions[i];<NEW_LINE>exprMethod.getBlock().assignArrayElement("values", constant(i), result);<NEW_LINE>}<NEW_LINE>exprMethod.getBlock().methodReturn(ref("values"));<NEW_LINE>evaluate.getBlock().methodReturn(localMethod(exprMethod<MASK><NEW_LINE>return evaluator;<NEW_LINE>} | , REF_EPS, REF_ISNEWDATA, REF_EXPREVALCONTEXT)); |
1,138,041 | public static ListBaselineConfigsResponse unmarshall(ListBaselineConfigsResponse listBaselineConfigsResponse, UnmarshallerContext _ctx) {<NEW_LINE>listBaselineConfigsResponse.setRequestId(_ctx.stringValue("ListBaselineConfigsResponse.RequestId"));<NEW_LINE>listBaselineConfigsResponse.setHttpStatusCode(_ctx.integerValue("ListBaselineConfigsResponse.HttpStatusCode"));<NEW_LINE>listBaselineConfigsResponse.setErrorMessage(_ctx.stringValue("ListBaselineConfigsResponse.ErrorMessage"));<NEW_LINE>listBaselineConfigsResponse.setErrorCode(_ctx.stringValue("ListBaselineConfigsResponse.ErrorCode"));<NEW_LINE>listBaselineConfigsResponse.setSuccess(_ctx.booleanValue("ListBaselineConfigsResponse.Success"));<NEW_LINE>Data data = new Data();<NEW_LINE>data.setPageNumber(_ctx.integerValue("ListBaselineConfigsResponse.Data.PageNumber"));<NEW_LINE>data.setPageSize(_ctx.integerValue("ListBaselineConfigsResponse.Data.PageSize"));<NEW_LINE>data.setTotalCount(_ctx.integerValue("ListBaselineConfigsResponse.Data.TotalCount"));<NEW_LINE>List<BaselinesItem> baselines = new ArrayList<BaselinesItem>();<NEW_LINE>for (int i = 0; i < _ctx.lengthValue("ListBaselineConfigsResponse.Data.Baselines.Length"); i++) {<NEW_LINE>BaselinesItem baselinesItem = new BaselinesItem();<NEW_LINE>baselinesItem.setHourSlaDetail(_ctx.stringValue("ListBaselineConfigsResponse.Data.Baselines[" + i + "].HourSlaDetail"));<NEW_LINE>baselinesItem.setIsDefault(_ctx.booleanValue("ListBaselineConfigsResponse.Data.Baselines[" + i + "].IsDefault"));<NEW_LINE>baselinesItem.setOwner(_ctx.stringValue("ListBaselineConfigsResponse.Data.Baselines[" + i + "].Owner"));<NEW_LINE>baselinesItem.setProjectId(_ctx.longValue<MASK><NEW_LINE>baselinesItem.setPriority(_ctx.integerValue("ListBaselineConfigsResponse.Data.Baselines[" + i + "].Priority"));<NEW_LINE>baselinesItem.setSlaMinu(_ctx.integerValue("ListBaselineConfigsResponse.Data.Baselines[" + i + "].SlaMinu"));<NEW_LINE>baselinesItem.setSlaHour(_ctx.integerValue("ListBaselineConfigsResponse.Data.Baselines[" + i + "].SlaHour"));<NEW_LINE>baselinesItem.setBaselineId(_ctx.longValue("ListBaselineConfigsResponse.Data.Baselines[" + i + "].BaselineId"));<NEW_LINE>baselinesItem.setBaselineName(_ctx.stringValue("ListBaselineConfigsResponse.Data.Baselines[" + i + "].BaselineName"));<NEW_LINE>baselinesItem.setHourExpDetail(_ctx.stringValue("ListBaselineConfigsResponse.Data.Baselines[" + i + "].HourExpDetail"));<NEW_LINE>baselinesItem.setUseFlag(_ctx.booleanValue("ListBaselineConfigsResponse.Data.Baselines[" + i + "].UseFlag"));<NEW_LINE>baselinesItem.setExpHour(_ctx.integerValue("ListBaselineConfigsResponse.Data.Baselines[" + i + "].ExpHour"));<NEW_LINE>baselinesItem.setBaselineType(_ctx.stringValue("ListBaselineConfigsResponse.Data.Baselines[" + i + "].BaselineType"));<NEW_LINE>baselinesItem.setExpMinu(_ctx.integerValue("ListBaselineConfigsResponse.Data.Baselines[" + i + "].ExpMinu"));<NEW_LINE>baselines.add(baselinesItem);<NEW_LINE>}<NEW_LINE>data.setBaselines(baselines);<NEW_LINE>listBaselineConfigsResponse.setData(data);<NEW_LINE>return listBaselineConfigsResponse;<NEW_LINE>} | ("ListBaselineConfigsResponse.Data.Baselines[" + i + "].ProjectId")); |
1,611,088 | private float drawThirdVerticalLineWithWidth(int leftX, int leftY, int w, int h, int steph) {<NEW_LINE>float levelMaxLineWidth = 0;<NEW_LINE>for (int i = 0; i < node4CalcPos.childrenIdx.length; i++) {<NEW_LINE>TreeModelViz.Node4CalcPos tmp = all[node4CalcPos.childrenIdx[i]];<NEW_LINE>int x2 = tmp.gNode.posCenter - leftX;<NEW_LINE>int y2 <MASK><NEW_LINE>int x1 = x2;<NEW_LINE>int y1 = steph;<NEW_LINE>double linepercent = all[node4CalcPos.childrenIdx[i]].node.getCounter().getWeightSum() / node4CalcPos.node.getCounter().getWeightSum();<NEW_LINE>if (linepercent > 1.0) {<NEW_LINE>linepercent = 0.0;<NEW_LINE>}<NEW_LINE>// if node is not root , multiply node<NEW_LINE>if (node4CalcPos.parentIdx >= 0) {<NEW_LINE>linepercent *= node4CalcPos.gNode.linepercent;<NEW_LINE>}<NEW_LINE>tmp.gNode.linepercent = linepercent;<NEW_LINE>float linewidth = (float) linepercent * this.nd.getEdgeMaxWidth();<NEW_LINE>if (levelMaxLineWidth < linewidth) {<NEW_LINE>levelMaxLineWidth = linewidth;<NEW_LINE>}<NEW_LINE>int secordlinewidth = linewidth < 1.0 ? 1 : (int) linewidth;<NEW_LINE>String showLabel;<NEW_LINE>if (node4CalcPos.node.getCategoricalSplit() == null) {<NEW_LINE>if (i == 0) {<NEW_LINE>showLabel = String.format("%s %s", "<=", String.valueOf(node4CalcPos.node.getContinuousSplit()));<NEW_LINE>} else {<NEW_LINE>showLabel = String.format("%s %s", ">", String.valueOf(node4CalcPos.node.getContinuousSplit()));<NEW_LINE>;<NEW_LINE>}<NEW_LINE>} else {<NEW_LINE>StringBuilder sbd = new StringBuilder();<NEW_LINE>int inSize = 0;<NEW_LINE>for (int j = 0; j < node4CalcPos.node.getCategoricalSplit().length; ++j) {<NEW_LINE>if (node4CalcPos.node.getCategoricalSplit()[j] == i) {<NEW_LINE>if (inSize > 0) {<NEW_LINE>sbd.append(",");<NEW_LINE>}<NEW_LINE>sbd.append(stringIndexerModelData.getToken(model.meta.get(HasFeatureCols.FEATURE_COLS)[node4CalcPos.node.getFeatureIndex()], Long.valueOf(j)));<NEW_LINE>inSize++;<NEW_LINE>}<NEW_LINE>}<NEW_LINE>showLabel = String.format("%s %s", "IN", sbd.toString());<NEW_LINE>}<NEW_LINE>this.drawOneVericalLine(x1, y1, w, h, secordlinewidth, showLabel);<NEW_LINE>}<NEW_LINE>return levelMaxLineWidth;<NEW_LINE>} | = tmp.gNode.posTop - leftY; |
829,209 | private static void replace(@Nonnull StringBuilder text, @Nonnull String replaceFrom, @Nonnull String replaceTo, @Nonnull List<TextRange> readOnlyChanges) {<NEW_LINE>for (int i = text.indexOf(replaceFrom); i >= 0 && i < text.length() - 1; i = text.indexOf(replaceFrom, i + 1)) {<NEW_LINE>int end = i + replaceFrom.length();<NEW_LINE>if (intersects(readOnlyChanges, i, end)) {<NEW_LINE>continue;<NEW_LINE>}<NEW_LINE>if (!"\n".equals(replaceFrom)) {<NEW_LINE>if (end < text.length() && !ALLOWED_LINK_SEPARATORS.contains(text.charAt(end))) {<NEW_LINE>// Consider a situation when we have, say, replacement from text 'PsiType' and encounter a 'PsiTypeParameter' in the text.<NEW_LINE>// We don't want to perform the replacement then.<NEW_LINE>continue;<NEW_LINE>}<NEW_LINE>if (i > 0 && !ALLOWED_LINK_SEPARATORS.contains(text.charAt(i - 1))) {<NEW_LINE>// Similar situation but targets head match: from = 'TextRange', text = 'getTextRange()'.<NEW_LINE>continue;<NEW_LINE>}<NEW_LINE>}<NEW_LINE>text.replace(i, end, replaceTo);<NEW_LINE>int diff = replaceTo.length() - replaceFrom.length();<NEW_LINE>for (int j = 0; j < readOnlyChanges.size(); j++) {<NEW_LINE>TextRange range = readOnlyChanges.get(j);<NEW_LINE>if (range.getStartOffset() >= end) {<NEW_LINE>readOnlyChanges.set(j, range.shiftRight(diff));<NEW_LINE>}<NEW_LINE>}<NEW_LINE>readOnlyChanges.add(new TextRange(i, i <MASK><NEW_LINE>}<NEW_LINE>} | + replaceTo.length())); |
23,436 | public void testSLLocalEnvEntry_Double() throws Exception {<NEW_LINE>SLLa ejb1 = fhome1.create();<NEW_LINE>// The test case looks for a environment variable named "envDouble".<NEW_LINE>Double tempDouble = ejb1.getDoubleEnvVar("envDouble");<NEW_LINE>assertNotNull("Get environment double object returned null.", tempDouble);<NEW_LINE>assertEquals("Test content of environment was not expected value", tempDouble.doubleValue(), 7003.0, DDELTA);<NEW_LINE><MASK><NEW_LINE>assertNotNull("Get environment double object returned null.", tempDouble);<NEW_LINE>assertEquals("Test content of environment was not expected value", tempDouble.doubleValue(), 7003.0, DDELTA);<NEW_LINE>tempDouble = ejb1.getDoubleEnvVar("envDouble3");<NEW_LINE>assertNotNull("Get environment double object returned null.", tempDouble);<NEW_LINE>assertEquals("Test content of environment was not expected value", tempDouble.doubleValue(), 7.0030e3d, DDELTA);<NEW_LINE>} | tempDouble = ejb1.getDoubleEnvVar("envDouble2"); |
1,536,590 | /*<NEW_LINE>* -------------------<NEW_LINE>* PARSE METHODS<NEW_LINE>* -------------------<NEW_LINE>*/<NEW_LINE>public void parseStandalone(final IEngineConfiguration configuration, final String ownerTemplate, final String template, final Set<String> templateSelectors, final ITemplateResource resource, final TemplateMode templateMode, final boolean useDecoupledLogic, final ITemplateHandler handler) {<NEW_LINE>Validate.notNull(configuration, "Engine Configuration cannot be null");<NEW_LINE>// ownerTemplate CAN be null if this is a first-level template<NEW_LINE>Validate.notNull(template, "Template cannot be null");<NEW_LINE>Validate.notNull(resource, "Template Resource cannot be null");<NEW_LINE>Validate.isTrue(templateSelectors == null || templateSelectors.<MASK><NEW_LINE>Validate.notNull(templateMode, "Template Mode cannot be null");<NEW_LINE>Validate.isTrue(templateMode == TemplateMode.RAW, "Template Mode has to be RAW");<NEW_LINE>Validate.isTrue(!useDecoupledLogic, "Cannot use decoupled logic in template mode " + templateMode);<NEW_LINE>Validate.notNull(handler, "Template Handler cannot be null");<NEW_LINE>parse(configuration, ownerTemplate, template, templateSelectors, resource, 0, 0, templateMode, handler);<NEW_LINE>} | isEmpty(), "Template selectors cannot be specified for a template using RAW template mode: template " + "insertion operations must be always performed on whole template files, not fragments"); |
887,576 | public void writeMacros(ConstantPool pool, PrintWriter out) {<NEW_LINE>super.writeMacros(pool, out);<NEW_LINE>String type = fieldType();<NEW_LINE>String cast = ((Alias) primary).cast;<NEW_LINE>String castTo = cast.length() == 0 ? "" : "(" + cast + ")";<NEW_LINE>String macroName = cMacroName();<NEW_LINE>String fieldOffset = "J9VMCONSTANTPOOL_FIELD_OFFSET(J9VMTHREAD_JAVAVM(vmThread), J9VMCONSTANTPOOL_" + macroName + ")";<NEW_LINE>if (type.equals("ADDRESS")) {<NEW_LINE>fieldOffset = "J9VMCONSTANTPOOL_ADDRESS_OFFSET(J9VMTHREAD_JAVAVM(vmThread), J9VMCONSTANTPOOL_" + macroName + ")";<NEW_LINE>}<NEW_LINE>out.println("#define J9VM" + macroName + "_OFFSET(vmThread) " + fieldOffset);<NEW_LINE>out.println("#define J9VM" + macroName + "(vmThread, object) ((void)0, \\");<NEW_LINE>out.println("\t" + castTo + "J9OBJECT_" + <MASK><NEW_LINE>out.println("#define J9VM" + cSetterMacroName() + "(vmThread, object, value) ((void)0, \\");<NEW_LINE>out.println("\tJ9OBJECT_" + type + "_STORE(vmThread, object, J9VM" + macroName + "_OFFSET(vmThread), (value)))"); | type + "_LOAD(vmThread, object, J9VM" + macroName + "_OFFSET(vmThread)))"); |
1,486,044 | public <R> R createAndApply(Function<? super Transaction, ? extends R> mapper) {<NEW_LINE>requireNonNull(mapper);<NEW_LINE>final Thread currentThread = Thread.currentThread();<NEW_LINE>// e.g. obtains a Connection<NEW_LINE>final Object txObject = dataSourceHandler.extractor().apply(dataSource);<NEW_LINE>final Isolation oldIsolation = setAndGetIsolation(txObject, isolation);<NEW_LINE>final Transaction tx = new TransactionImpl(txComponent, txObject, dataSourceHandler);<NEW_LINE>TRANSACTION_LOGGER.debug("Transaction %s created for thread '%s' on tranaction object %s", tx, <MASK><NEW_LINE>txComponent.put(currentThread, txObject);<NEW_LINE>try {<NEW_LINE>// e.g. con.setAutocommit(false)<NEW_LINE>dataSourceHandler.beginner().accept(txObject);<NEW_LINE>return mapper.apply(tx);<NEW_LINE>} catch (Exception e) {<NEW_LINE>// Executed in the finally block : dataSourceHandler.rollbacker().accept(txObject); // Automatically rollback if there is an exception<NEW_LINE>throw new TransactionException("Error while invoking transaction for object :" + txObject, e);<NEW_LINE>} finally {<NEW_LINE>// Always rollback() implicitly and discard uncommitted data<NEW_LINE>dataSourceHandler.rollbacker().accept(txObject);<NEW_LINE>// e.g. con.setAutocommit(true); con.close();<NEW_LINE>dataSourceHandler.closer().accept(txObject);<NEW_LINE>setAndGetIsolation(txObject, oldIsolation);<NEW_LINE>txComponent.remove(currentThread);<NEW_LINE>TRANSACTION_LOGGER.debug("Transaction %s owned by thread '%s' was discarded", tx, currentThread.getName());<NEW_LINE>}<NEW_LINE>} | currentThread.getName(), txObject); |
939,300 | ActionResult<Wo> execute(HttpServletRequest request, EffectivePerson effectivePerson, JsonElement jsonElement) throws Exception {<NEW_LINE>ActionResult<Wo> result = new ActionResult<>();<NEW_LINE>Wi wrapIn = null;<NEW_LINE>Boolean check = true;<NEW_LINE>try {<NEW_LINE>wrapIn = this.convertToWrapIn(jsonElement, Wi.class);<NEW_LINE>} catch (Exception e) {<NEW_LINE>check = false;<NEW_LINE>Exception exception = new ExceptionWrapInConvert(e, jsonElement);<NEW_LINE>result.error(exception);<NEW_LINE>e.printStackTrace();<NEW_LINE>}<NEW_LINE>if (check && wrapIn != null) {<NEW_LINE>try (EntityManagerContainer emc = EntityManagerContainerFactory.instance().create()) {<NEW_LINE>AppInfo appInfo = null;<NEW_LINE>if (wrapIn.getAppId() != null && !wrapIn.getAppId().isEmpty()) {<NEW_LINE>appInfo = emc.find(wrapIn.getAppId(), AppInfo.class);<NEW_LINE>if (appInfo != null) {<NEW_LINE>QueryView queryView = new QueryView();<NEW_LINE>wrapIn.copyTo(queryView);<NEW_LINE>if (wrapIn != null && wrapIn.getId() != null && wrapIn.getId().isEmpty()) {<NEW_LINE>queryView.setId(wrapIn.getId());<NEW_LINE>}<NEW_LINE>queryView.setAppId(appInfo.getId());<NEW_LINE>queryView.<MASK><NEW_LINE>queryView.setCreatorPerson(effectivePerson.getDistinguishedName());<NEW_LINE>queryView.setLastUpdatePerson(effectivePerson.getDistinguishedName());<NEW_LINE>queryView.setLastUpdateTime(new Date());<NEW_LINE>this.transQuery(queryView);<NEW_LINE>emc.beginTransaction(QueryView.class);<NEW_LINE>emc.persist(queryView, CheckPersistType.all);<NEW_LINE>emc.commit();<NEW_LINE>CacheManager.notify(QueryView.class);<NEW_LINE>Wo wo = new Wo();<NEW_LINE>wo.setId(queryView.getId());<NEW_LINE>result.setData(wo);<NEW_LINE>} else {<NEW_LINE>Exception exception = new ExceptionAppInfoNotExists(wrapIn.getAppId());<NEW_LINE>result.error(exception);<NEW_LINE>}<NEW_LINE>} else {<NEW_LINE>Exception exception = new ExceptionQueryViewAppIdEmpty();<NEW_LINE>result.error(exception);<NEW_LINE>}<NEW_LINE>}<NEW_LINE>}<NEW_LINE>return result;<NEW_LINE>} | setAppName(appInfo.getAppName()); |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.