idx int32 46 1.86M | input stringlengths 321 6.6k | target stringlengths 9 1.24k |
|---|---|---|
186,010 | public ReactionAdapter.ViewHolderReaction onCreateViewHolder(ViewGroup parent, int viewType) {<NEW_LINE>View v = LayoutInflater.from(parent.getContext()).inflate(R.layout.item_reaction, parent, false);<NEW_LINE>ViewHolderReaction holder = new ViewHolderReaction(v);<NEW_LINE>holder.generalLayout = v.findViewById(R.id.general_rl);<NEW_LINE>holder.moreReactionsLayout = v.findViewById(R.id.more_reactions_layout);<NEW_LINE>holder.moreReactionsLayout.setTag(holder);<NEW_LINE>holder.itemReactionLayout = v.findViewById(R.id.item_reaction_layout);<NEW_LINE>holder.itemReactionLayout.setTag(holder);<NEW_LINE>holder.itemNumUsersReaction = v.<MASK><NEW_LINE>holder.itemEmojiReaction = v.findViewById(R.id.item_emoji_reaction);<NEW_LINE>holder.itemEmojiReactionText = v.findViewById(R.id.item_emoji_reaction_text);<NEW_LINE>holder.itemEmojiReactionText.setVisibility(View.GONE);<NEW_LINE>holder.moreReactionsLayout.setOnClickListener(this);<NEW_LINE>holder.itemReactionLayout.setOnClickListener(this);<NEW_LINE>holder.itemReactionLayout.setOnLongClickListener(this);<NEW_LINE>v.setTag(holder);<NEW_LINE>return holder;<NEW_LINE>} | findViewById(R.id.item_number_users_reaction); |
971,817 | private void parserChildTable(SchemaInfo schemaInfo, final RouteResultset rrs, MySqlInsertStatement insertStmt, final ShardingService service, boolean isExplain) throws SQLNonTransientException {<NEW_LINE>final SchemaConfig schema = schemaInfo.getSchemaConfig();<NEW_LINE>String tableName = schemaInfo.getTable();<NEW_LINE>final ChildTableConfig tc = (ChildTableConfig) (schema.getTables().get(tableName));<NEW_LINE>if (isMultiInsert(insertStmt)) {<NEW_LINE>String msg = "ChildTable multi insert not provided";<NEW_LINE>LOGGER.info(msg);<NEW_LINE>throw new SQLNonTransientException(msg);<NEW_LINE>}<NEW_LINE>String joinColumn = tc.getJoinColumn();<NEW_LINE>int joinColumnIndex = getJoinColumnIndex(schemaInfo, insertStmt, joinColumn);<NEW_LINE>final String joinColumnVal = insertStmt.getValues().getValues().<MASK><NEW_LINE>String realVal = StringUtil.removeApostrophe(joinColumnVal);<NEW_LINE>final String sql = RouterUtil.removeSchema(statementToString(insertStmt), schemaInfo.getSchema());<NEW_LINE>rrs.setStatement(sql);<NEW_LINE>// try to route by ER parent partion key<NEW_LINE>RouteResultset theRrs = routeByERParentColumn(rrs, tc, realVal, schemaInfo, service.getCharset().getClient());<NEW_LINE>if (theRrs != null) {<NEW_LINE>rrs.setFinishedRoute(true);<NEW_LINE>} else {<NEW_LINE>rrs.setFinishedExecute(true);<NEW_LINE>fetchChildTableToRoute(tc, joinColumnVal, service, schema, sql, rrs, isExplain, tableName);<NEW_LINE>}<NEW_LINE>} | get(joinColumnIndex).toString(); |
35,941 | private Mono<Response<Flux<ByteBuffer>>> stopWithResponseAsync(String resourceGroupName, String workspaceName, String integrationRuntimeName, 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 (workspaceName == null) {<NEW_LINE>return Mono.error(new IllegalArgumentException("Parameter workspaceName is required and cannot be null."));<NEW_LINE>}<NEW_LINE>if (integrationRuntimeName == null) {<NEW_LINE>return Mono.error(new IllegalArgumentException("Parameter integrationRuntimeName is required and cannot be null."));<NEW_LINE>}<NEW_LINE>final String apiVersion = "2021-06-01-preview";<NEW_LINE>final String accept = "application/json";<NEW_LINE>context = this.client.mergeContext(context);<NEW_LINE>return service.stop(this.client.getEndpoint(), apiVersion, this.client.getSubscriptionId(), resourceGroupName, workspaceName, integrationRuntimeName, accept, context);<NEW_LINE>} | error(new IllegalArgumentException("Parameter this.client.getEndpoint() is required and cannot be null.")); |
246,859 | private void _sendContentletPublishNotification(Contentlet contentlet, HttpServletRequest req) throws Exception, PortalException, SystemException {<NEW_LINE>try {<NEW_LINE>req.setAttribute(com.liferay.portal.util.WebKeys.LAYOUT, req.getSession().getAttribute(com.dotmarketing.util.WebKeys.LAYOUT));<NEW_LINE>req.setAttribute(com.liferay.portal.util.WebKeys.JAVAX_PORTLET_CONFIG, req.getSession().getAttribute(com.dotmarketing.util.WebKeys.JAVAX_PORTLET_CONFIG));<NEW_LINE>User currentUser = com.liferay.portal.util.PortalUtil.getUser(req);<NEW_LINE>Map<String, String[]> params = new HashMap<String, String[]>();<NEW_LINE>params.put("struts_action", new String[] { "/ext/contentlet/edit_contentlet" });<NEW_LINE>params.put("cmd", new String[] { "edit" });<NEW_LINE>params.put("inode", new String[] { String.valueOf(contentlet.getInode()) });<NEW_LINE>String contentURL = PortletURLUtil.getActionURL(req, WindowState.<MASK><NEW_LINE>List<Map<String, Object>> references = conAPI.getContentletReferences(contentlet, currentUser, false);<NEW_LINE>List<Map<String, Object>> validReferences = new ArrayList<Map<String, Object>>();<NEW_LINE>// Avoinding to send the email to the same users<NEW_LINE>for (Map<String, Object> reference : references) {<NEW_LINE>try {<NEW_LINE>IHTMLPage page = (IHTMLPage) reference.get("page");<NEW_LINE>User pageUser = APILocator.getUserAPI().loadUserById(page.getModUser(), APILocator.getUserAPI().getSystemUser(), false);<NEW_LINE>if (!pageUser.getUserId().equals(currentUser.getUserId())) {<NEW_LINE>reference.put("owner", pageUser);<NEW_LINE>validReferences.add(reference);<NEW_LINE>}<NEW_LINE>} catch (Exception ex) {<NEW_LINE>Logger.debug(this, "the reference has a null page");<NEW_LINE>}<NEW_LINE>}<NEW_LINE>} catch (Exception ex) {<NEW_LINE>throw ex;<NEW_LINE>}<NEW_LINE>} | MAXIMIZED.toString(), params); |
1,274,286 | public static Domain map(final EntityResponse entityResponse) {<NEW_LINE><MASK><NEW_LINE>final Urn entityUrn = entityResponse.getUrn();<NEW_LINE>final EnvelopedAspectMap aspects = entityResponse.getAspects();<NEW_LINE>result.setUrn(entityUrn.toString());<NEW_LINE>result.setType(EntityType.DOMAIN);<NEW_LINE>// Domains MUST have key aspect to be rendered.<NEW_LINE>final EnvelopedAspect envelopedDomainKey = aspects.get(Constants.DOMAIN_KEY_ASPECT_NAME);<NEW_LINE>if (envelopedDomainKey != null) {<NEW_LINE>result.setId(new DomainKey(envelopedDomainKey.getValue().data()).getId());<NEW_LINE>} else {<NEW_LINE>return null;<NEW_LINE>}<NEW_LINE>final EnvelopedAspect envelopedDomainProperties = aspects.get(Constants.DOMAIN_PROPERTIES_ASPECT_NAME);<NEW_LINE>if (envelopedDomainProperties != null) {<NEW_LINE>result.setProperties(mapDomainProperties(new DomainProperties(envelopedDomainProperties.getValue().data())));<NEW_LINE>}<NEW_LINE>final EnvelopedAspect envelopedOwnership = aspects.get(Constants.OWNERSHIP_ASPECT_NAME);<NEW_LINE>if (envelopedOwnership != null) {<NEW_LINE>result.setOwnership(OwnershipMapper.map(new Ownership(envelopedOwnership.getValue().data())));<NEW_LINE>}<NEW_LINE>final EnvelopedAspect envelopedInstitutionalMemory = aspects.get(Constants.INSTITUTIONAL_MEMORY_ASPECT_NAME);<NEW_LINE>if (envelopedInstitutionalMemory != null) {<NEW_LINE>result.setInstitutionalMemory(InstitutionalMemoryMapper.map(new InstitutionalMemory(envelopedInstitutionalMemory.getValue().data())));<NEW_LINE>}<NEW_LINE>return result;<NEW_LINE>} | final Domain result = new Domain(); |
329,036 | private void transformMetadataMethod(ClassHolder cls, MethodHolder method, ClassHierarchy hierarchy, int suffix) {<NEW_LINE>FieldHolder field = new FieldHolder("$$metadata$$" + suffix);<NEW_LINE>field.setType(method.getResultType());<NEW_LINE><MASK><NEW_LINE>field.getModifiers().add(ElementModifier.STATIC);<NEW_LINE>field.getAnnotations().add(new AnnotationHolder(NoGcRoot.class.getName()));<NEW_LINE>cls.addField(field);<NEW_LINE>MethodHolder createMethod = new MethodHolder(method.getName() + "$$create", method.getSignature());<NEW_LINE>createMethod.setLevel(AccessLevel.PRIVATE);<NEW_LINE>createMethod.getModifiers().add(ElementModifier.NATIVE);<NEW_LINE>createMethod.getModifiers().add(ElementModifier.STATIC);<NEW_LINE>cls.addMethod(createMethod);<NEW_LINE>AnnotationHolder genAnnot = new AnnotationHolder(GeneratedBy.class.getName());<NEW_LINE>genAnnot.getValues().put("value", new AnnotationValue(ValueType.object(MetadataProviderNativeGenerator.class.getName())));<NEW_LINE>createMethod.getAnnotations().add(genAnnot);<NEW_LINE>ModelUtils.copyAnnotations(method.getAnnotations(), createMethod.getAnnotations());<NEW_LINE>if (createMethod.getAnnotations().get(NoSideEffects.class.getName()) == null) {<NEW_LINE>createMethod.getAnnotations().add(new AnnotationHolder(NoSideEffects.class.getName()));<NEW_LINE>}<NEW_LINE>AnnotationHolder refAnnot = new AnnotationHolder(MetadataProviderRef.class.getName());<NEW_LINE>refAnnot.getValues().put("value", new AnnotationValue(method.getReference().toString()));<NEW_LINE>createMethod.getAnnotations().add(refAnnot);<NEW_LINE>method.getModifiers().remove(ElementModifier.NATIVE);<NEW_LINE>ProgramEmitter pe = ProgramEmitter.create(method, hierarchy);<NEW_LINE>pe.when(pe.getField(field.getReference(), field.getType()).isNull()).thenDo(() -> pe.setField(field.getReference(), pe.invoke(createMethod.getReference().getClassName(), createMethod.getReference().getName(), createMethod.getResultType())));<NEW_LINE>pe.getField(field.getReference(), field.getType()).returnValue();<NEW_LINE>} | field.setLevel(AccessLevel.PRIVATE); |
826,306 | // Create a new asymmetric key for the purpose of signing and verifying data.<NEW_LINE>public void createKeyAsymmetricSign(String projectId, String locationId, String keyRingId, String id) throws IOException {<NEW_LINE>// Initialize client that will be used to send requests. This client only<NEW_LINE>// needs to be created once, and can be reused for multiple requests. After<NEW_LINE>// completing all of your requests, call the "close" method on the client to<NEW_LINE>// safely clean up any remaining background resources.<NEW_LINE>try (KeyManagementServiceClient client = KeyManagementServiceClient.create()) {<NEW_LINE>// Build the parent name from the project, location, and key ring.<NEW_LINE>KeyRingName keyRingName = KeyRingName.of(projectId, locationId, keyRingId);<NEW_LINE>// Build the asymmetric key to create.<NEW_LINE>CryptoKey key = CryptoKey.newBuilder().setPurpose(CryptoKeyPurpose.ASYMMETRIC_SIGN).setVersionTemplate(CryptoKeyVersionTemplate.newBuilder().setAlgorithm(CryptoKeyVersionAlgorithm.RSA_SIGN_PKCS1_2048_SHA256)).build();<NEW_LINE>// Create the key.<NEW_LINE>CryptoKey createdKey = client.createCryptoKey(keyRingName, id, key);<NEW_LINE>System.out.printf(<MASK><NEW_LINE>}<NEW_LINE>} | "Created asymmetric key %s%n", createdKey.getName()); |
243,410 | public void onParameterChanged(final String parameterName) {<NEW_LINE>if (PARAM_AD_ORG_TARGET_ID.equals(parameterName) || PARAM_DATE_ORG_CHANGE.equals(parameterName)) {<NEW_LINE>if (p_orgTargetId == null) {<NEW_LINE>return;<NEW_LINE>}<NEW_LINE>final BPartnerId partnerId = BPartnerId.ofRepoId(getRecord_ID());<NEW_LINE>final Instant orgChangeDate = CoalesceUtil.coalesce(p_startDate, SystemTime.asInstant());<NEW_LINE>final OrgChangeBPartnerComposite orgChangePartnerComposite = <MASK><NEW_LINE>isShowMembershipParameter = orgChangePartnerComposite.hasMembershipSubscriptions() && service.hasAnyMembershipProduct(p_orgTargetId);<NEW_LINE>final GroupCategoryId groupCategoryId = orgChangePartnerComposite.getGroupCategoryId();<NEW_LINE>if (groupCategoryId != null && service.isGroupCategoryContainsProductsInTargetOrg(groupCategoryId, p_orgTargetId)) {<NEW_LINE>p_groupCategoryId = groupCategoryId;<NEW_LINE>}<NEW_LINE>}<NEW_LINE>} | service.getByIdAndOrgChangeDate(partnerId, orgChangeDate); |
1,428,773 | private TrackedEventMessage<?> doConsumeNext() {<NEW_LINE>HashMap<String, TrackedEventMessage<?>> candidateMessagesToReturn = new HashMap<>();<NEW_LINE>peekForMessages(candidateMessagesToReturn);<NEW_LINE>// select message to return from candidates<NEW_LINE>final Optional<Map.Entry<String, TrackedEventMessage<?>>> chosenMessage = candidateMessagesToReturn.entrySet().stream().min(trackedEventComparator);<NEW_LINE>// Ensure the chosen message is actually consumed from the stream<NEW_LINE>return chosenMessage.map(e -> {<NEW_LINE>String streamId = e.getKey();<NEW_LINE>TrackedEventMessage<?> message = e.getValue();<NEW_LINE>try {<NEW_LINE>MultiSourceTrackingToken advancedToken = this.trackingToken.advancedTo(streamId, message.trackingToken());<NEW_LINE>return messageSource(streamId).<MASK><NEW_LINE>} catch (InterruptedException ex) {<NEW_LINE>logger.warn("Thread Interrupted whilst consuming next message", ex);<NEW_LINE>Thread.currentThread().interrupt();<NEW_LINE>}<NEW_LINE>return null;<NEW_LINE>}).orElse(null);<NEW_LINE>} | nextAvailable().withTrackingToken(advancedToken); |
479,368 | final DisassociateBudgetFromResourceResult executeDisassociateBudgetFromResource(DisassociateBudgetFromResourceRequest disassociateBudgetFromResourceRequest) {<NEW_LINE>ExecutionContext executionContext = createExecutionContext(disassociateBudgetFromResourceRequest);<NEW_LINE>AWSRequestMetrics awsRequestMetrics = executionContext.getAwsRequestMetrics();<NEW_LINE>awsRequestMetrics.startEvent(Field.ClientExecuteTime);<NEW_LINE>Request<DisassociateBudgetFromResourceRequest> request = null;<NEW_LINE>Response<DisassociateBudgetFromResourceResult> response = null;<NEW_LINE>try {<NEW_LINE>awsRequestMetrics.startEvent(Field.RequestMarshallTime);<NEW_LINE>try {<NEW_LINE>request = new DisassociateBudgetFromResourceRequestProtocolMarshaller(protocolFactory).marshall(super.beforeMarshalling(disassociateBudgetFromResourceRequest));<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, "Service Catalog");<NEW_LINE>request.addHandlerContext(HandlerContextKey.OPERATION_NAME, "DisassociateBudgetFromResource");<NEW_LINE>request.addHandlerContext(HandlerContextKey.ADVANCED_CONFIG, advancedConfig);<NEW_LINE>} finally {<NEW_LINE><MASK><NEW_LINE>}<NEW_LINE>HttpResponseHandler<AmazonWebServiceResponse<DisassociateBudgetFromResourceResult>> responseHandler = protocolFactory.createResponseHandler(new JsonOperationMetadata().withPayloadJson(true).withHasStreamingSuccessResponse(false), new DisassociateBudgetFromResourceResultJsonUnmarshaller());<NEW_LINE>response = invoke(request, responseHandler, executionContext);<NEW_LINE>return response.getAwsResponse();<NEW_LINE>} finally {<NEW_LINE>endClientExecution(awsRequestMetrics, request, response);<NEW_LINE>}<NEW_LINE>} | awsRequestMetrics.endEvent(Field.RequestMarshallTime); |
920,606 | public String update(HttpServletRequest request) throws Exception {<NEW_LINE>String namespaceId = WebUtils.optional(request, CommonParams.NAMESPACE_ID, Constants.DEFAULT_NAMESPACE_ID);<NEW_LINE>String serviceName = WebUtils.<MASK><NEW_LINE>ServiceMetadata serviceMetadata = new ServiceMetadata();<NEW_LINE>serviceMetadata.setProtectThreshold(NumberUtils.toFloat(WebUtils.required(request, "protectThreshold")));<NEW_LINE>serviceMetadata.setExtendData(UtilsAndCommons.parseMetadata(WebUtils.optional(request, "metadata", StringUtils.EMPTY)));<NEW_LINE>serviceMetadata.setSelector(parseSelector(WebUtils.optional(request, "selector", StringUtils.EMPTY)));<NEW_LINE>com.alibaba.nacos.naming.core.v2.pojo.Service service = com.alibaba.nacos.naming.core.v2.pojo.Service.newService(namespaceId, NamingUtils.getGroupName(serviceName), NamingUtils.getServiceName(serviceName));<NEW_LINE>getServiceOperator().update(service, serviceMetadata);<NEW_LINE>return "ok";<NEW_LINE>} | required(request, CommonParams.SERVICE_NAME); |
1,382,560 | public Dialog onCreateDialog(Bundle savedInstanceState) {<NEW_LINE>int primaryColor = themeColorUtils.primaryColor(getActivity());<NEW_LINE>mParentFolder = <MASK><NEW_LINE>// Inflate the layout for the dialog<NEW_LINE>LayoutInflater inflater = requireActivity().getLayoutInflater();<NEW_LINE>EditBoxDialogBinding binding = EditBoxDialogBinding.inflate(inflater, null, false);<NEW_LINE>View view = binding.getRoot();<NEW_LINE>// Setup layout<NEW_LINE>binding.userInput.setText("");<NEW_LINE>binding.userInput.requestFocus();<NEW_LINE>themeTextInputUtils.colorTextInput(binding.userInputContainer, binding.userInput, primaryColor);<NEW_LINE>// Build the dialog<NEW_LINE>AlertDialog.Builder builder = new AlertDialog.Builder(getActivity());<NEW_LINE>builder.setView(view).setPositiveButton(R.string.folder_confirm_create, this).setNeutralButton(R.string.common_cancel, this).setTitle(R.string.uploader_info_dirname);<NEW_LINE>AlertDialog d = builder.create();<NEW_LINE>Window window = d.getWindow();<NEW_LINE>if (window != null) {<NEW_LINE>window.setSoftInputMode(LayoutParams.SOFT_INPUT_STATE_VISIBLE);<NEW_LINE>}<NEW_LINE>return d;<NEW_LINE>} | getArguments().getParcelable(ARG_PARENT_FOLDER); |
1,304,246 | public void copy4x4(Matrix4x3d src, double[] dest, int off) {<NEW_LINE>dest[off + 0] = src.m00();<NEW_LINE>dest[off + 1] = src.m01();<NEW_LINE>dest[off + 2] = src.m02();<NEW_LINE>dest[off + 3] = 0.0;<NEW_LINE>dest[off + <MASK><NEW_LINE>dest[off + 5] = src.m11();<NEW_LINE>dest[off + 6] = src.m12();<NEW_LINE>dest[off + 7] = 0.0;<NEW_LINE>dest[off + 8] = src.m20();<NEW_LINE>dest[off + 9] = src.m21();<NEW_LINE>dest[off + 10] = src.m22();<NEW_LINE>dest[off + 11] = 0.0;<NEW_LINE>dest[off + 12] = src.m30();<NEW_LINE>dest[off + 13] = src.m31();<NEW_LINE>dest[off + 14] = src.m32();<NEW_LINE>dest[off + 15] = 1.0;<NEW_LINE>} | 4] = src.m10(); |
1,745,079 | private void sendResponse(Address us, int code, String statusString, String uid, byte[] body) {<NEW_LINE>MemorySessionOutputBuffer outBuf = new MemorySessionOutputBuffer();<NEW_LINE>HttpMessageWriter writer = new HttpResponseWriter(outBuf, lineFormatter, params);<NEW_LINE>HttpMessage response = new BasicHttpResponse(new BasicStatusLine(PROTOCOL_VERSION, code, statusString));<NEW_LINE>response.addHeader("Request-Id", uid);<NEW_LINE>try {<NEW_LINE>writer.write(response);<NEW_LINE>outBuf.write(body);<NEW_LINE>outBuf.flush();<NEW_LINE>} catch (IOException e) {<NEW_LINE>throw new RuntimeException(e);<NEW_LINE>} catch (HttpException e) {<NEW_LINE>throw new RuntimeException(e);<NEW_LINE>}<NEW_LINE>byte[] data = outBuf.getOutput();<NEW_LINE>Message message = new Message("");<NEW_LINE>message.setFrom(us);<NEW_LINE>debug(<MASK><NEW_LINE>mChatSession.sendDataAsync(message, true, data);<NEW_LINE>} | "send response " + statusString + " for " + uid); |
1,629,775 | public boolean OnAuthenticate(StringBuilder username, StringBuilder domain, StringBuilder password) {<NEW_LINE>// this is where the return code of our dialog will be stored<NEW_LINE>callbackDialogResult = false;<NEW_LINE>// set text fields<NEW_LINE>((EditText) userCredView.findViewById(R.id.editTextUsername)).setText(username);<NEW_LINE>((EditText) userCredView.findViewById(R.id.<MASK><NEW_LINE>((EditText) userCredView.findViewById(R.id.editTextPassword)).setText(password);<NEW_LINE>// start dialog in UI thread<NEW_LINE>uiHandler.sendMessage(Message.obtain(null, UIHandler.SHOW_DIALOG, dlgUserCredentials));<NEW_LINE>// wait for result<NEW_LINE>try {<NEW_LINE>synchronized (dlgUserCredentials) {<NEW_LINE>dlgUserCredentials.wait();<NEW_LINE>}<NEW_LINE>} catch (InterruptedException e) {<NEW_LINE>}<NEW_LINE>// clear buffers<NEW_LINE>username.setLength(0);<NEW_LINE>domain.setLength(0);<NEW_LINE>password.setLength(0);<NEW_LINE>// read back user credentials<NEW_LINE>username.append(((EditText) userCredView.findViewById(R.id.editTextUsername)).getText().toString());<NEW_LINE>domain.append(((EditText) userCredView.findViewById(R.id.editTextDomain)).getText().toString());<NEW_LINE>password.append(((EditText) userCredView.findViewById(R.id.editTextPassword)).getText().toString());<NEW_LINE>return callbackDialogResult;<NEW_LINE>} | editTextDomain)).setText(domain); |
1,106,750 | public R visit(final CompilationUnit n, final A arg) {<NEW_LINE>R result;<NEW_LINE>{<NEW_LINE>result = n.getImports(<MASK><NEW_LINE>if (result != null)<NEW_LINE>return result;<NEW_LINE>}<NEW_LINE>if (n.getModule().isPresent()) {<NEW_LINE>result = n.getModule().get().accept(this, arg);<NEW_LINE>if (result != null)<NEW_LINE>return result;<NEW_LINE>}<NEW_LINE>if (n.getPackageDeclaration().isPresent()) {<NEW_LINE>result = n.getPackageDeclaration().get().accept(this, arg);<NEW_LINE>if (result != null)<NEW_LINE>return result;<NEW_LINE>}<NEW_LINE>{<NEW_LINE>result = n.getTypes().accept(this, arg);<NEW_LINE>if (result != null)<NEW_LINE>return result;<NEW_LINE>}<NEW_LINE>if (n.getComment().isPresent()) {<NEW_LINE>result = n.getComment().get().accept(this, arg);<NEW_LINE>if (result != null)<NEW_LINE>return result;<NEW_LINE>}<NEW_LINE>return null;<NEW_LINE>} | ).accept(this, arg); |
45,188 | public URL generatePresignedUrl(GeneratePresignedUrlRequest request) throws ClientException {<NEW_LINE>assertParameterNotNull(request, "request");<NEW_LINE>if (request.getBucketName() == null) {<NEW_LINE>throw new IllegalArgumentException(OSS_RESOURCE_MANAGER.getString("MustSetBucketName"));<NEW_LINE>}<NEW_LINE>ensureBucketNameValid(request.getBucketName());<NEW_LINE>if (request.getExpiration() == null) {<NEW_LINE>throw new IllegalArgumentException<MASK><NEW_LINE>}<NEW_LINE>String url;<NEW_LINE>if (serviceClient.getClientConfiguration().getSignatureVersion() != null && serviceClient.getClientConfiguration().getSignatureVersion() == SignVersion.V2) {<NEW_LINE>url = SignV2Utils.buildSignedURL(request, credsProvider.getCredentials(), serviceClient.getClientConfiguration(), endpoint);<NEW_LINE>} else {<NEW_LINE>url = SignUtils.buildSignedURL(request, credsProvider.getCredentials(), serviceClient.getClientConfiguration(), endpoint);<NEW_LINE>}<NEW_LINE>try {<NEW_LINE>return new URL(url);<NEW_LINE>} catch (MalformedURLException e) {<NEW_LINE>throw new ClientException(e);<NEW_LINE>}<NEW_LINE>} | (OSS_RESOURCE_MANAGER.getString("MustSetExpiration")); |
1,300,968 | public Object decodeNumber(KrollDict args) {<NEW_LINE>if (!args.containsKey(TiC.PROPERTY_SOURCE)) {<NEW_LINE>throw new IllegalArgumentException("source was not specified for decodeNumber");<NEW_LINE>}<NEW_LINE>if (!args.containsKey(TiC.PROPERTY_TYPE)) {<NEW_LINE>throw new IllegalArgumentException("type was not specified for decodeNumber");<NEW_LINE>}<NEW_LINE>BufferProxy buffer = (BufferProxy) args.get(TiC.PROPERTY_SOURCE);<NEW_LINE>String type = (String) args.get(TiC.PROPERTY_TYPE);<NEW_LINE>int byteOrder = getByteOrder(args.get(TiC.PROPERTY_BYTE_ORDER));<NEW_LINE>int position = 0;<NEW_LINE>if (args.containsKey(TiC.PROPERTY_POSITION)) {<NEW_LINE>position = TiConvert.toInt(args, TiC.PROPERTY_POSITION);<NEW_LINE>}<NEW_LINE>byte[] src = buffer.getBuffer();<NEW_LINE>if (type.equals(TYPE_BYTE)) {<NEW_LINE>return src[position];<NEW_LINE>} else if (type.equals(TYPE_SHORT)) {<NEW_LINE>short s1 = (short) (src[position] & 0xFF);<NEW_LINE>short s2 = (short) (src[position + 1] & 0xFF);<NEW_LINE>switch(byteOrder) {<NEW_LINE>case BIG_ENDIAN:<NEW_LINE>return (<MASK><NEW_LINE>case LITTLE_ENDIAN:<NEW_LINE>return ((s2 << 8) + s1);<NEW_LINE>}<NEW_LINE>} else if (type.equals(TYPE_INT) || type.equals(TYPE_FLOAT)) {<NEW_LINE>int bits = 0;<NEW_LINE>int shiftBits = byteOrder == BIG_ENDIAN ? 24 : 0;<NEW_LINE>int step = byteOrder == BIG_ENDIAN ? -8 : 8;<NEW_LINE>for (int i = 0; i < 4; i++, shiftBits += step) {<NEW_LINE>int part = (int) (src[position + i] & 0xFF);<NEW_LINE>bits += (part << shiftBits);<NEW_LINE>}<NEW_LINE>if (type.equals(TYPE_FLOAT)) {<NEW_LINE>return Float.intBitsToFloat(bits);<NEW_LINE>}<NEW_LINE>return bits;<NEW_LINE>} else if (type.equals(TYPE_LONG) || type.equals(TYPE_DOUBLE)) {<NEW_LINE>long bits = 0;<NEW_LINE>int shiftBits = byteOrder == BIG_ENDIAN ? 56 : 0;<NEW_LINE>int step = byteOrder == BIG_ENDIAN ? -8 : 8;<NEW_LINE>for (int i = 0; i < 8; i++, shiftBits += step) {<NEW_LINE>long part = (long) (src[position + i] & 0xFF);<NEW_LINE>bits += (part << shiftBits);<NEW_LINE>}<NEW_LINE>if (type.equals(TYPE_DOUBLE)) {<NEW_LINE>return Double.longBitsToDouble(bits);<NEW_LINE>}<NEW_LINE>return bits;<NEW_LINE>}<NEW_LINE>return 0;<NEW_LINE>} | (s1 << 8) + s2); |
555,653 | public static ListApplicationsResponse unmarshall(ListApplicationsResponse listApplicationsResponse, UnmarshallerContext _ctx) {<NEW_LINE>listApplicationsResponse.setRequestId(_ctx.stringValue("ListApplicationsResponse.RequestId"));<NEW_LINE>listApplicationsResponse.setMessage(_ctx.stringValue("ListApplicationsResponse.Message"));<NEW_LINE>listApplicationsResponse.setErrorCode(_ctx.stringValue("ListApplicationsResponse.ErrorCode"));<NEW_LINE>listApplicationsResponse.setCode(_ctx.stringValue("ListApplicationsResponse.Code"));<NEW_LINE>listApplicationsResponse.setSuccess(_ctx.booleanValue("ListApplicationsResponse.Success"));<NEW_LINE>listApplicationsResponse.setCurrentPage(_ctx.integerValue("ListApplicationsResponse.CurrentPage"));<NEW_LINE>listApplicationsResponse.setTotalSize(_ctx.integerValue("ListApplicationsResponse.TotalSize"));<NEW_LINE>listApplicationsResponse.setPageSize(_ctx.integerValue("ListApplicationsResponse.PageSize"));<NEW_LINE>Data data = new Data();<NEW_LINE>data.setCurrentPage(_ctx.integerValue("ListApplicationsResponse.Data.CurrentPage"));<NEW_LINE>data.setTotalSize(_ctx.integerValue("ListApplicationsResponse.Data.TotalSize"));<NEW_LINE>data.setPageSize(_ctx.integerValue("ListApplicationsResponse.Data.PageSize"));<NEW_LINE>List<Application> applications = new ArrayList<Application>();<NEW_LINE>for (int i = 0; i < _ctx.lengthValue("ListApplicationsResponse.Data.Applications.Length"); i++) {<NEW_LINE>Application application = new Application();<NEW_LINE>application.setAppName(_ctx.stringValue("ListApplicationsResponse.Data.Applications[" + i + "].AppName"));<NEW_LINE>application.setNamespaceId(_ctx.stringValue("ListApplicationsResponse.Data.Applications[" + i + "].NamespaceId"));<NEW_LINE>application.setAppDeletingStatus(_ctx.booleanValue("ListApplicationsResponse.Data.Applications[" + i + "].AppDeletingStatus"));<NEW_LINE>application.setAppId(_ctx.stringValue("ListApplicationsResponse.Data.Applications[" + i + "].AppId"));<NEW_LINE>application.setScaleRuleEnabled(_ctx.booleanValue("ListApplicationsResponse.Data.Applications[" + i + "].ScaleRuleEnabled"));<NEW_LINE>application.setScaleRuleType(_ctx.stringValue("ListApplicationsResponse.Data.Applications[" + i + "].ScaleRuleType"));<NEW_LINE>application.setRunningInstances(_ctx.integerValue("ListApplicationsResponse.Data.Applications[" + i + "].RunningInstances"));<NEW_LINE>application.setInstances(_ctx.integerValue<MASK><NEW_LINE>application.setRegionId(_ctx.stringValue("ListApplicationsResponse.Data.Applications[" + i + "].RegionId"));<NEW_LINE>application.setAppDescription(_ctx.stringValue("ListApplicationsResponse.Data.Applications[" + i + "].AppDescription"));<NEW_LINE>List<TagsItem> tags = new ArrayList<TagsItem>();<NEW_LINE>for (int j = 0; j < _ctx.lengthValue("ListApplicationsResponse.Data.Applications[" + i + "].Tags.Length"); j++) {<NEW_LINE>TagsItem tagsItem = new TagsItem();<NEW_LINE>tagsItem.setKey(_ctx.stringValue("ListApplicationsResponse.Data.Applications[" + i + "].Tags[" + j + "].Key"));<NEW_LINE>tagsItem.setValue(_ctx.stringValue("ListApplicationsResponse.Data.Applications[" + i + "].Tags[" + j + "].Value"));<NEW_LINE>tags.add(tagsItem);<NEW_LINE>}<NEW_LINE>application.setTags(tags);<NEW_LINE>applications.add(application);<NEW_LINE>}<NEW_LINE>data.setApplications(applications);<NEW_LINE>listApplicationsResponse.setData(data);<NEW_LINE>return listApplicationsResponse;<NEW_LINE>} | ("ListApplicationsResponse.Data.Applications[" + i + "].Instances")); |
1,524,042 | private void checkPackageIntegrity() throws IOException, UpgradeException {<NEW_LINE>Path packagePath = this.getUpgradePackagePath();<NEW_LINE>if (Files.notExists(packagePath)) {<NEW_LINE>if (this.log.isTraceEnable()) {<NEW_LINE>this.log.warn(this, "Package " + this.getSoftwarePackage() + " does not exist");<NEW_LINE>}<NEW_LINE>throw new UpgradeException("Upgrade package does not exist");<NEW_LINE>}<NEW_LINE>Path md5Path = this.getUpgardePackageMD5FilePath();<NEW_LINE>if (Files.notExists(md5Path)) {<NEW_LINE>if (this.log.isTraceEnable()) {<NEW_LINE>this.log.warn(this, "MD5 file for " + <MASK><NEW_LINE>}<NEW_LINE>throw new UpgradeException("MD5 file does not exist");<NEW_LINE>}<NEW_LINE>String originalMD5 = new String(Files.readAllBytes(md5Path));<NEW_LINE>String newMD5 = generateMD5ForFile(packagePath.toFile());<NEW_LINE>if (this.log.isTraceEnable()) {<NEW_LINE>this.log.info(this, "original md5 is " + originalMD5 + " new md5 is " + newMD5);<NEW_LINE>}<NEW_LINE>if (!originalMD5.trim().equals(newMD5)) {<NEW_LINE>throw new UpgradeException("MD5 dismatched");<NEW_LINE>}<NEW_LINE>if (this.log.isTraceEnable()) {<NEW_LINE>this.log.info(this, "Upgrade package integrity check was successful");<NEW_LINE>}<NEW_LINE>} | this.getSoftwarePackage() + " does not exist"); |
703,295 | public Request<RebalanceSlotsInGlobalReplicationGroupRequest> marshall(RebalanceSlotsInGlobalReplicationGroupRequest rebalanceSlotsInGlobalReplicationGroupRequest) {<NEW_LINE>if (rebalanceSlotsInGlobalReplicationGroupRequest == null) {<NEW_LINE>throw new SdkClientException("Invalid argument passed to marshall(...)");<NEW_LINE>}<NEW_LINE>Request<RebalanceSlotsInGlobalReplicationGroupRequest> request = new DefaultRequest<RebalanceSlotsInGlobalReplicationGroupRequest>(rebalanceSlotsInGlobalReplicationGroupRequest, "AmazonElastiCache");<NEW_LINE>request.addParameter("Action", "RebalanceSlotsInGlobalReplicationGroup");<NEW_LINE>request.addParameter("Version", "2015-02-02");<NEW_LINE>request.setHttpMethod(HttpMethodName.POST);<NEW_LINE>if (rebalanceSlotsInGlobalReplicationGroupRequest.getGlobalReplicationGroupId() != null) {<NEW_LINE>request.addParameter("GlobalReplicationGroupId", StringUtils.fromString<MASK><NEW_LINE>}<NEW_LINE>if (rebalanceSlotsInGlobalReplicationGroupRequest.getApplyImmediately() != null) {<NEW_LINE>request.addParameter("ApplyImmediately", StringUtils.fromBoolean(rebalanceSlotsInGlobalReplicationGroupRequest.getApplyImmediately()));<NEW_LINE>}<NEW_LINE>return request;<NEW_LINE>} | (rebalanceSlotsInGlobalReplicationGroupRequest.getGlobalReplicationGroupId())); |
1,636,463 | public void onActivityResult(int requestCode, int resultCode, @Nullable Intent data) {<NEW_LINE>switch(requestCode) {<NEW_LINE>case ACTIVITY_CHOOSE_FILE1:<NEW_LINE>if (resultCode == RESULT_OK) {<NEW_LINE>String realPath = FilePathUtil.getRealPath(getContext(), data.getData());<NEW_LINE>filePath = realPath;<NEW_LINE>FilePathUtil.saveData(realPath);<NEW_LINE>Intent intent = new Intent(getContext(), DataLoggerActivity.class);<NEW_LINE>intent.putExtra(ProgramModeActivity.PROGRAM_FLAG_KEY, FOCUS_FLAG);<NEW_LINE>startActivity(intent);<NEW_LINE>((Activity) <MASK><NEW_LINE>}<NEW_LINE>break;<NEW_LINE>default:<NEW_LINE>Toast.makeText(getContext(), getResources().getString(R.string.perm_not_granted), Toast.LENGTH_SHORT).show();<NEW_LINE>break;<NEW_LINE>}<NEW_LINE>super.onActivityResult(requestCode, resultCode, data);<NEW_LINE>} | getContext()).finish(); |
445,598 | public void paintComponent(Graphics g) {<NEW_LINE>if (g == null)<NEW_LINE>return;<NEW_LINE>Sketch sketch = editor.getSketch();<NEW_LINE>// possible?<NEW_LINE>if (sketch == null)<NEW_LINE>return;<NEW_LINE>// need to set this each time through<NEW_LINE>g.setFont(font);<NEW_LINE>if (fontAscent == 0) {<NEW_LINE>fontAscent = (int) Toolkit.getAscent(g);<NEW_LINE>}<NEW_LINE>Graphics2D g2 = Toolkit.prepareGraphics(g);<NEW_LINE>g.setColor(tabColor[SELECTED]);<NEW_LINE>// can't be done with lines, b/c retina leaves tiny hairlines<NEW_LINE>g.fillRect(0, 0, getWidth(), Toolkit.zoom(2));<NEW_LINE>g.drawImage(gradient, 0, Toolkit.zoom(2), getWidth(), getHeight(), this);<NEW_LINE>// reset all tab positions<NEW_LINE>for (Tab tab : tabs) {<NEW_LINE>tab.textWidth = (int) font.getStringBounds(tab.title, g2.getFontRenderContext()).getWidth();<NEW_LINE>}<NEW_LINE>// now actually draw the tabs<NEW_LINE><MASK><NEW_LINE>// the number of updates available in the Manager<NEW_LINE>drawUpdates(g2);<NEW_LINE>} | drawTabs(g2, Editor.LEFT_GUTTER); |
263,818 | public boolean initNewCluster() throws Exception {<NEW_LINE>String zkServers = ZKMetadataDriverBase.resolveZkServers(conf);<NEW_LINE>String instanceIdPath = ledgersRootPath + "/" + INSTANCEID;<NEW_LINE>log.info("Initializing ZooKeeper metadata for new cluster, ZKServers: {} ledger root path: {}", zkServers, ledgersRootPath);<NEW_LINE>boolean ledgerRootExists = null != zk.exists(ledgersRootPath, false);<NEW_LINE>if (ledgerRootExists) {<NEW_LINE>log.error("Ledger root path: {} already exists", ledgersRootPath);<NEW_LINE>return false;<NEW_LINE>}<NEW_LINE>List<Op> multiOps = Lists.newArrayListWithExpectedSize(4);<NEW_LINE>// Create ledgers root node<NEW_LINE>multiOps.add(Op.create(ledgersRootPath, EMPTY_BYTE_ARRAY, zkAcls, CreateMode.PERSISTENT));<NEW_LINE>// create available bookies node<NEW_LINE>multiOps.add(Op.create(bookieRegistrationPath, EMPTY_BYTE_ARRAY, zkAcls, CreateMode.PERSISTENT));<NEW_LINE>// create readonly bookies node<NEW_LINE>multiOps.add(Op.create(bookieReadonlyRegistrationPath, EMPTY_BYTE_ARRAY, zkAcls, CreateMode.PERSISTENT));<NEW_LINE>// create INSTANCEID<NEW_LINE>String instanceId = UUID<MASK><NEW_LINE>multiOps.add(Op.create(instanceIdPath, instanceId.getBytes(UTF_8), zkAcls, CreateMode.PERSISTENT));<NEW_LINE>// execute the multi ops<NEW_LINE>zk.multi(multiOps);<NEW_LINE>// creates the new layout and stores in zookeeper<NEW_LINE>AbstractZkLedgerManagerFactory.newLedgerManagerFactory(conf, layoutManager);<NEW_LINE>log.info("Successfully initiated cluster. ZKServers: {} ledger root path: {} instanceId: {}", zkServers, ledgersRootPath, instanceId);<NEW_LINE>return true;<NEW_LINE>} | .randomUUID().toString(); |
1,359,901 | private void generateCastToString(MethodVisitor mv, BType type) {<NEW_LINE>BType <MASK><NEW_LINE>if (TypeTags.isStringTypeTag(sourceType.tag)) {<NEW_LINE>return;<NEW_LINE>} else if (TypeTags.isIntegerTypeTag(sourceType.tag)) {<NEW_LINE>mv.visitMethodInsn(INVOKESTATIC, LONG_VALUE, JVM_TO_STRING_METHOD, LONG_TO_STRING, false);<NEW_LINE>return;<NEW_LINE>}<NEW_LINE>switch(sourceType.tag) {<NEW_LINE>case TypeTags.FLOAT:<NEW_LINE>mv.visitMethodInsn(INVOKESTATIC, DOUBLE_VALUE, JVM_TO_STRING_METHOD, DOUBLE_TO_STRING, false);<NEW_LINE>break;<NEW_LINE>case TypeTags.BOOLEAN:<NEW_LINE>mv.visitMethodInsn(INVOKESTATIC, BOOLEAN_VALUE, JVM_TO_STRING_METHOD, BOOLEAN_TO_STRING, false);<NEW_LINE>break;<NEW_LINE>case TypeTags.ANY:<NEW_LINE>case TypeTags.ANYDATA:<NEW_LINE>case TypeTags.UNION:<NEW_LINE>case TypeTags.JSON:<NEW_LINE>case TypeTags.INTERSECTION:<NEW_LINE>case TypeTags.READONLY:<NEW_LINE>mv.visitTypeInsn(CHECKCAST, B_STRING_VALUE);<NEW_LINE>break;<NEW_LINE>case TypeTags.TYPEREFDESC:<NEW_LINE>generateCastToString(mv, JvmCodeGenUtil.getReferredType(sourceType));<NEW_LINE>break;<NEW_LINE>default:<NEW_LINE>throw new BLangCompilerException("Casting is not supported from '" + sourceType + "' to 'string'");<NEW_LINE>}<NEW_LINE>} | sourceType = JvmCodeGenUtil.getReferredType(type); |
962,595 | private void showOrHideButtons() {<NEW_LINE>if (playQueue == null) {<NEW_LINE>return;<NEW_LINE>}<NEW_LINE>final boolean showPrev = playQueue.getIndex() != 0;<NEW_LINE>final boolean showNext = playQueue.getIndex() + 1 != playQueue.getStreams().size();<NEW_LINE>final boolean showQueue = playQueue.getStreams().size() > 1 && !popupPlayerSelected();<NEW_LINE>true);<NEW_LINE>binding.playPreviousButton.setVisibility(showPrev ? View.VISIBLE : View.INVISIBLE);<NEW_LINE>binding.playPreviousButton.setAlpha(showPrev ? 1.0f : 0.0f);<NEW_LINE>binding.playNextButton.setVisibility(showNext ? View.VISIBLE : View.INVISIBLE);<NEW_LINE>binding.playNextButton.setAlpha(showNext ? 1.0f : 0.0f);<NEW_LINE>binding.queueButton.setVisibility(showQueue ? View.VISIBLE : View.GONE);<NEW_LINE>binding.queueButton.setAlpha(showQueue ? 1.0f : 0.0f);<NEW_LINE>binding.segmentsButton.setVisibility(showSegment ? View.VISIBLE : View.GONE);<NEW_LINE>binding.segmentsButton.<MASK><NEW_LINE>} | setAlpha(showSegment ? 1.0f : 0.0f); |
1,715,348 | public Request<DescribeReservedInstancesRequest> marshall(DescribeReservedInstancesRequest describeReservedInstancesRequest) {<NEW_LINE>if (describeReservedInstancesRequest == null) {<NEW_LINE>throw new AmazonClientException("Invalid argument passed to marshall(...)");<NEW_LINE>}<NEW_LINE>Request<DescribeReservedInstancesRequest> request = new DefaultRequest<DescribeReservedInstancesRequest>(describeReservedInstancesRequest, "AmazonEC2");<NEW_LINE>request.addParameter("Action", "DescribeReservedInstances");<NEW_LINE>request.addParameter("Version", "2015-10-01");<NEW_LINE>java.util.List<String> reservedInstancesIdsList = describeReservedInstancesRequest.getReservedInstancesIds();<NEW_LINE>int reservedInstancesIdsListIndex = 1;<NEW_LINE>for (String reservedInstancesIdsListValue : reservedInstancesIdsList) {<NEW_LINE>if (reservedInstancesIdsListValue != null) {<NEW_LINE>request.addParameter("ReservedInstancesId." + reservedInstancesIdsListIndex<MASK><NEW_LINE>}<NEW_LINE>reservedInstancesIdsListIndex++;<NEW_LINE>}<NEW_LINE>java.util.List<Filter> filtersList = describeReservedInstancesRequest.getFilters();<NEW_LINE>int filtersListIndex = 1;<NEW_LINE>for (Filter filtersListValue : filtersList) {<NEW_LINE>Filter filterMember = filtersListValue;<NEW_LINE>if (filterMember != null) {<NEW_LINE>if (filterMember.getName() != null) {<NEW_LINE>request.addParameter("Filter." + filtersListIndex + ".Name", StringUtils.fromString(filterMember.getName()));<NEW_LINE>}<NEW_LINE>java.util.List<String> valuesList = filterMember.getValues();<NEW_LINE>int valuesListIndex = 1;<NEW_LINE>for (String valuesListValue : valuesList) {<NEW_LINE>if (valuesListValue != null) {<NEW_LINE>request.addParameter("Filter." + filtersListIndex + ".Value." + valuesListIndex, StringUtils.fromString(valuesListValue));<NEW_LINE>}<NEW_LINE>valuesListIndex++;<NEW_LINE>}<NEW_LINE>}<NEW_LINE>filtersListIndex++;<NEW_LINE>}<NEW_LINE>if (describeReservedInstancesRequest.getOfferingType() != null) {<NEW_LINE>request.addParameter("OfferingType", StringUtils.fromString(describeReservedInstancesRequest.getOfferingType()));<NEW_LINE>}<NEW_LINE>return request;<NEW_LINE>} | , StringUtils.fromString(reservedInstancesIdsListValue)); |
472,806 | protected void configurePlot(Plot plot, JRChartPlot jrPlot) {<NEW_LINE>super.configurePlot(plot, jrPlot);<NEW_LINE>if (plot instanceof CategoryPlot) {<NEW_LINE>CategoryPlot categoryPlot = (CategoryPlot) plot;<NEW_LINE>CategoryItemRenderer categoryRenderer = categoryPlot.getRenderer();<NEW_LINE><MASK><NEW_LINE>if (categoryDataset != null) {<NEW_LINE>for (int i = 0; i < categoryDataset.getRowCount(); i++) {<NEW_LINE>categoryRenderer.setSeriesOutlinePaint(i, ChartThemesConstants.TRANSPARENT_PAINT);<NEW_LINE>}<NEW_LINE>}<NEW_LINE>categoryPlot.setRangeGridlinePaint(ChartThemesConstants.GRAY_PAINT_217);<NEW_LINE>categoryPlot.setRangeGridlineStroke(new BasicStroke(0.5f));<NEW_LINE>categoryPlot.setDomainGridlinesVisible(false);<NEW_LINE>categoryPlot.getDomainAxis().setCategoryLabelPositions(CategoryLabelPositions.UP_45);<NEW_LINE>} else if (plot instanceof XYPlot) {<NEW_LINE>XYPlot xyPlot = (XYPlot) plot;<NEW_LINE>XYItemRenderer xyItemRenderer = xyPlot.getRenderer();<NEW_LINE>XYDataset xyDataset = xyPlot.getDataset();<NEW_LINE>if (xyDataset != null) {<NEW_LINE>for (int i = 0; i < xyDataset.getSeriesCount(); i++) {<NEW_LINE>xyItemRenderer.setSeriesOutlinePaint(i, ChartThemesConstants.TRANSPARENT_PAINT);<NEW_LINE>}<NEW_LINE>}<NEW_LINE>xyPlot.setRangeGridlinePaint(ChartThemesConstants.GRAY_PAINT_217);<NEW_LINE>xyPlot.setRangeGridlineStroke(new BasicStroke(0.5f));<NEW_LINE>xyPlot.setDomainGridlinesVisible(false);<NEW_LINE>xyPlot.setRangeZeroBaselineVisible(true);<NEW_LINE>}<NEW_LINE>} | CategoryDataset categoryDataset = categoryPlot.getDataset(); |
1,824,928 | protected void consumeAnnotationTypeDeclarationHeaderName() {<NEW_LINE>// consumeAnnotationTypeDeclarationHeader ::= Modifiers '@' PushModifiers interface Identifier<NEW_LINE>// consumeAnnotationTypeDeclarationHeader ::= '@' PushModifiers interface Identifier<NEW_LINE>TypeDeclaration annotationTypeDeclaration = new TypeDeclaration(this.compilationUnit.compilationResult);<NEW_LINE>if (this.nestedMethod[this.nestedType] == 0) {<NEW_LINE>if (this.nestedType != 0) {<NEW_LINE>annotationTypeDeclaration.bits |= ASTNode.IsMemberType;<NEW_LINE>}<NEW_LINE>} else {<NEW_LINE>// Record that the block has a declaration for local types<NEW_LINE>annotationTypeDeclaration.bits |= ASTNode.IsLocalType;<NEW_LINE>markEnclosingMemberWithLocalType();<NEW_LINE>blockReal();<NEW_LINE>}<NEW_LINE>// highlight the name of the type<NEW_LINE>long pos = this.identifierPositionStack[this.identifierPtr];<NEW_LINE>annotationTypeDeclaration.sourceEnd = (int) pos;<NEW_LINE>annotationTypeDeclaration.sourceStart = (int) (pos >>> 32);<NEW_LINE>annotationTypeDeclaration.name = this.identifierStack[this.identifierPtr--];<NEW_LINE>this.identifierLengthPtr--;<NEW_LINE>// compute the declaration source too<NEW_LINE>// 'interface' push two int positions: the beginning of the class token and its end.<NEW_LINE>// we want to keep the beginning position but get rid of the end position<NEW_LINE>// it is only used for the ClassLiteralAccess positions.<NEW_LINE>// remove the start position of the interface token<NEW_LINE>this.intPtr--;<NEW_LINE>// remove the end position of the interface token<NEW_LINE>this.intPtr--;<NEW_LINE>annotationTypeDeclaration.modifiersSourceStart = this.intStack[this.intPtr--];<NEW_LINE>annotationTypeDeclaration.modifiers = this.intStack[this.intPtr--] | ClassFileConstants.AccAnnotation | ClassFileConstants.AccInterface;<NEW_LINE>if (annotationTypeDeclaration.modifiersSourceStart >= 0) {<NEW_LINE>annotationTypeDeclaration.declarationSourceStart = annotationTypeDeclaration.modifiersSourceStart;<NEW_LINE>// remove the position of the '@' token as we have modifiers<NEW_LINE>this.intPtr--;<NEW_LINE>} else {<NEW_LINE>int atPosition = this.intStack[this.intPtr--];<NEW_LINE>// remove the position of the '@' token as we don't have modifiers<NEW_LINE>annotationTypeDeclaration.declarationSourceStart = atPosition;<NEW_LINE>}<NEW_LINE>// Store secondary info<NEW_LINE>if ((annotationTypeDeclaration.bits & ASTNode.IsMemberType) == 0 && (annotationTypeDeclaration.bits & ASTNode.IsLocalType) == 0) {<NEW_LINE>if (this.compilationUnit != null && !CharOperation.equals(annotationTypeDeclaration.name, this.compilationUnit.getMainTypeName())) {<NEW_LINE>annotationTypeDeclaration.bits |= ASTNode.IsSecondaryType;<NEW_LINE>}<NEW_LINE>}<NEW_LINE>// consume annotations<NEW_LINE>int length;<NEW_LINE>if ((length = this.expressionLengthStack[this.expressionLengthPtr--]) != 0) {<NEW_LINE>System.arraycopy(this.expressionStack, (this.expressionPtr -= length) + 1, annotationTypeDeclaration.annotations = new Annotation[length], 0, length);<NEW_LINE>}<NEW_LINE>annotationTypeDeclaration<MASK><NEW_LINE>// javadoc<NEW_LINE>annotationTypeDeclaration.javadoc = this.javadoc;<NEW_LINE>this.javadoc = null;<NEW_LINE>pushOnAstStack(annotationTypeDeclaration);<NEW_LINE>if (!this.statementRecoveryActivated && this.options.sourceLevel < ClassFileConstants.JDK1_5 && this.lastErrorEndPositionBeforeRecovery < this.scanner.currentPosition) {<NEW_LINE>problemReporter().invalidUsageOfAnnotationDeclarations(annotationTypeDeclaration);<NEW_LINE>}<NEW_LINE>// recovery<NEW_LINE>if (this.currentElement != null) {<NEW_LINE>this.lastCheckPoint = annotationTypeDeclaration.bodyStart;<NEW_LINE>this.currentElement = this.currentElement.add(annotationTypeDeclaration, 0);<NEW_LINE>this.lastIgnoredToken = -1;<NEW_LINE>}<NEW_LINE>} | .bodyStart = annotationTypeDeclaration.sourceEnd + 1; |
1,133,406 | public boolean action(Request request, Response response) {<NEW_LINE>if (request.getNettyRequest() instanceof FullHttpRequest) {<NEW_LINE>InputDismissGroup inputDismissGroup = getRequestBody(request.getNettyRequest(), InputDismissGroup.class);<NEW_LINE>inputDismissGroup.setOperator(robot.getUid());<NEW_LINE>if (inputDismissGroup.isValide()) {<NEW_LINE>sendApiRequest(response, IMTopic.DismissGroupTopic, inputDismissGroup.toProtoGroupRequest().toByteArray(), result -> {<NEW_LINE>ByteBuf byteBuf = Unpooled.buffer();<NEW_LINE>byteBuf.writeBytes(result);<NEW_LINE>ErrorCode errorCode = ErrorCode.<MASK><NEW_LINE>if (errorCode == ErrorCode.ERROR_CODE_SUCCESS) {<NEW_LINE>sendResponse(response, null, null);<NEW_LINE>} else {<NEW_LINE>sendResponse(response, errorCode, null);<NEW_LINE>}<NEW_LINE>});<NEW_LINE>return false;<NEW_LINE>} else {<NEW_LINE>setResponseContent(RestResult.resultOf(ErrorCode.INVALID_PARAMETER), response);<NEW_LINE>}<NEW_LINE>}<NEW_LINE>return true;<NEW_LINE>} | fromCode(byteBuf.readByte()); |
1,559,071 | public boolean isSupported(Context context) {<NEW_LINE>switch(this) {<NEW_LINE>case WORK_MANAGER:<NEW_LINE>return WorkManagerAvailableHelper.isWorkManagerApiSupported();<NEW_LINE>case V_26:<NEW_LINE>return Build.VERSION.SDK_INT >= Build.VERSION_CODES.O && isServiceEnabled(context, PlatformJobService.class);<NEW_LINE>case V_24:<NEW_LINE>return Build.VERSION.SDK_INT >= Build.VERSION_CODES.N && isServiceEnabledAndHasPermission(context, PlatformJobService.class, JOB_SCHEDULER_PERMISSION);<NEW_LINE>case V_21:<NEW_LINE>return Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP && isServiceEnabledAndHasPermission(context, PlatformJobService.class, JOB_SCHEDULER_PERMISSION);<NEW_LINE>case V_19:<NEW_LINE>return Build.VERSION.SDK_INT >= Build.VERSION_CODES.KITKAT && isServiceEnabled(context, PlatformAlarmService.class) && isBroadcastEnabled(context, PlatformAlarmReceiver.class);<NEW_LINE>case V_14:<NEW_LINE>return JobConfig.isForceAllowApi14() || (isServiceEnabled(context, PlatformAlarmService.class) && isServiceEnabled(context, PlatformAlarmServiceExact.class) && isBroadcastEnabled<MASK><NEW_LINE>case GCM:<NEW_LINE>try {<NEW_LINE>// see https://github.com/evernote/android-job/issues/487<NEW_LINE>return GcmAvailableHelper.isGcmApiSupported(context);<NEW_LINE>} catch (Exception e) {<NEW_LINE>return false;<NEW_LINE>}<NEW_LINE>default:<NEW_LINE>throw new IllegalStateException("not implemented");<NEW_LINE>}<NEW_LINE>} | (context, PlatformAlarmReceiver.class)); |
1,106,629 | public static XContentBuilder serialize(GridFSDBFile file) throws IOException {<NEW_LINE>XContentBuilder builder = XContentFactory.jsonBuilder();<NEW_LINE>ByteArrayOutputStream buffer = new ByteArrayOutputStream();<NEW_LINE>int nRead;<NEW_LINE>byte[] data = new byte[1024];<NEW_LINE>try (InputStream stream = file.getInputStream()) {<NEW_LINE>while ((nRead = stream.read(data, 0, data.length)) != -1) {<NEW_LINE>buffer.write(data, 0, nRead);<NEW_LINE>}<NEW_LINE>buffer.flush();<NEW_LINE>}<NEW_LINE>String encodedContent = Base64.<MASK><NEW_LINE>// Probably not necessary...<NEW_LINE>buffer.close();<NEW_LINE>builder.startObject();<NEW_LINE>builder.startObject("content");<NEW_LINE>builder.field("_content_type", file.getContentType());<NEW_LINE>builder.field("_title", file.getFilename());<NEW_LINE>builder.field("_content", encodedContent);<NEW_LINE>builder.endObject();<NEW_LINE>builder.field("filename", file.getFilename());<NEW_LINE>builder.field("contentType", file.getContentType());<NEW_LINE>builder.field("md5", file.getMD5());<NEW_LINE>builder.field("length", file.getLength());<NEW_LINE>builder.field("chunkSize", file.getChunkSize());<NEW_LINE>builder.field("uploadDate", file.getUploadDate());<NEW_LINE>builder.startObject("metadata");<NEW_LINE>DBObject metadata = file.getMetaData();<NEW_LINE>if (metadata != null) {<NEW_LINE>for (String key : metadata.keySet()) {<NEW_LINE>builder.field(key, metadata.get(key));<NEW_LINE>}<NEW_LINE>}<NEW_LINE>builder.endObject();<NEW_LINE>builder.endObject();<NEW_LINE>return builder;<NEW_LINE>} | encodeBytes(buffer.toByteArray()); |
1,514,790 | private void consume(Purchase itemInfo) throws IabException {<NEW_LINE>checkNotDisposed();<NEW_LINE>checkSetupDone("consume");<NEW_LINE>if (!itemInfo.mItemType.equals(ITEM_TYPE_INAPP)) {<NEW_LINE>throw new IabException(IABHELPER_INVALID_CONSUMPTION, "Items of type '" + itemInfo.mItemType + "' can't be consumed.");<NEW_LINE>}<NEW_LINE>try {<NEW_LINE>String token = itemInfo.getToken();<NEW_LINE>String sku = itemInfo.getSku();<NEW_LINE>if (token == null || token.equals("")) {<NEW_LINE>logError("Can't consume " + sku + ". No token.");<NEW_LINE>throw new IabException(IABHELPER_MISSING_TOKEN, "PurchaseInfo is missing token for sku: " + sku + " " + itemInfo);<NEW_LINE>}<NEW_LINE>logDebug("Consuming sku: " + sku + ", token: " + token);<NEW_LINE>int response = mService.consumePurchase(3, <MASK><NEW_LINE>if (response == BILLING_RESPONSE_RESULT_OK) {<NEW_LINE>logDebug("Successfully consumed sku: " + sku);<NEW_LINE>} else {<NEW_LINE>logDebug("Error consuming consuming sku " + sku + ". " + getResponseDesc(response));<NEW_LINE>throw new IabException(response, "Error consuming sku " + sku);<NEW_LINE>}<NEW_LINE>} catch (RemoteException e) {<NEW_LINE>throw new IabException(IABHELPER_REMOTE_EXCEPTION, "Remote exception while consuming. PurchaseInfo: " + itemInfo, e);<NEW_LINE>}<NEW_LINE>} | ApplicationUtils.getPackageName(), token); |
1,297,975 | public static void locateFiles(final DownloadManager[] dms, final DiskManagerFileInfo[][] dm_files, Shell shell) {<NEW_LINE>if (!Utils.isSWTThread()) {<NEW_LINE>Utils.execSWTThread(() -> {<NEW_LINE>locateFiles(dms, dm_files, shell);<NEW_LINE>});<NEW_LINE>return;<NEW_LINE>}<NEW_LINE>boolean all_bad = true;<NEW_LINE>boolean some_bad = false;<NEW_LINE>for (DownloadManager dm : dms) {<NEW_LINE>int dm_state = dm.getState();<NEW_LINE>if (!(dm_state == DownloadManager.STATE_STOPPED || dm_state == DownloadManager.STATE_ERROR)) {<NEW_LINE>some_bad = true;<NEW_LINE>} else {<NEW_LINE>all_bad = false;<NEW_LINE>}<NEW_LINE>}<NEW_LINE>if (all_bad) {<NEW_LINE>MessageBoxShell mb = new MessageBoxShell(MessageText.getString("dlg.finddatafiles.title"), MessageText.getString("dlg.finddatafiles.dms.all.bad"));<NEW_LINE>mb.setButtons(new String[] { MessageText.getString("Button.ok") });<NEW_LINE>mb.setIconResource("error");<NEW_LINE>mb.open((result) -> {<NEW_LINE>});<NEW_LINE>} else if (some_bad) {<NEW_LINE>MessageBoxShell mb = new MessageBoxShell(MessageText.getString("dlg.finddatafiles.title"), MessageText.getString("dlg.finddatafiles.dms.some.bad"));<NEW_LINE>mb.setButtons(0, new String[] { MessageText.getString("Button.yes"), MessageText.getString("Button.no") }, new Integer[] { 0, 1 });<NEW_LINE>mb.setIconResource("warning");<NEW_LINE>mb.open((result) -> {<NEW_LINE>if (result == 0) {<NEW_LINE>locateFilesSupport(dms, dm_files, shell);<NEW_LINE>}<NEW_LINE>});<NEW_LINE>} else {<NEW_LINE><MASK><NEW_LINE>}<NEW_LINE>} | locateFilesSupport(dms, dm_files, shell); |
232,749 | public List<ImageUrl> parseImages(String html, Chapter chapter) {<NEW_LINE>List<ImageUrl> list = new LinkedList<>();<NEW_LINE>String str = StringUtils.match("cp=\"(.*?)\"", html, 1);<NEW_LINE>if (str != null) {<NEW_LINE>try {<NEW_LINE>str = DecryptionUtils.evalDecrypt(DecryptionUtils.base64Decrypt(str));<NEW_LINE>String[] array = str.split(",");<NEW_LINE>for (int i = 0; i != array.length; ++i) {<NEW_LINE>Long comicChapter = chapter.getId();<NEW_LINE>Long id = Long.parseLong(comicChapter + "000" + i);<NEW_LINE>list.add(new ImageUrl(id, comicChapter, i + 1, "http://res.img.youzipi.net/" + <MASK><NEW_LINE>}<NEW_LINE>} catch (Exception e) {<NEW_LINE>e.printStackTrace();<NEW_LINE>}<NEW_LINE>}<NEW_LINE>return list;<NEW_LINE>} | array[i], false)); |
757,974 | public static void gen_JavaCharStream(JavaResourceTemplateLocations locations) {<NEW_LINE>try {<NEW_LINE>final File file = new File(<MASK><NEW_LINE>final OutputFile outputFile = new OutputFile(file, charStreamVersion, new String[] { Options.USEROPTION__STATIC, Options.USEROPTION__SUPPORT_CLASS_VISIBILITY_PUBLIC });<NEW_LINE>if (!outputFile.needToWrite) {<NEW_LINE>return;<NEW_LINE>}<NEW_LINE>final PrintWriter ostr = outputFile.getPrintWriter();<NEW_LINE>if (cu_to_insertion_point_1.size() != 0 && ((Token) cu_to_insertion_point_1.get(0)).kind == PACKAGE) {<NEW_LINE>for (int i = 1; i < cu_to_insertion_point_1.size(); i++) {<NEW_LINE>if (((Token) cu_to_insertion_point_1.get(i)).kind == SEMICOLON) {<NEW_LINE>cline = ((Token) (cu_to_insertion_point_1.get(0))).beginLine;<NEW_LINE>ccol = ((Token) (cu_to_insertion_point_1.get(0))).beginColumn;<NEW_LINE>for (int j = 0; j <= i; j++) {<NEW_LINE>printToken((Token) (cu_to_insertion_point_1.get(j)), ostr);<NEW_LINE>}<NEW_LINE>ostr.println("");<NEW_LINE>ostr.println("");<NEW_LINE>break;<NEW_LINE>}<NEW_LINE>}<NEW_LINE>}<NEW_LINE>String prefix = (Options.getStatic() ? "static " : "");<NEW_LINE>Map options = new HashMap(Options.getOptions());<NEW_LINE>options.put("PREFIX", prefix);<NEW_LINE>OutputFileGenerator generator = new OutputFileGenerator(locations.getJavaCharStreamTemplateResourceUrl(), options);<NEW_LINE>generator.generate(ostr);<NEW_LINE>ostr.close();<NEW_LINE>} catch (IOException e) {<NEW_LINE>System.err.println("Failed to create JavaCharStream " + e);<NEW_LINE>JavaCCErrors.semantic_error("Could not open file JavaCharStream.java for writing.");<NEW_LINE>throw new Error();<NEW_LINE>}<NEW_LINE>} | Options.getOutputDirectory(), "JavaCharStream.java"); |
1,739,471 | public CreateActivityResult unmarshall(JsonUnmarshallerContext context) throws Exception {<NEW_LINE>CreateActivityResult createActivityResult = new CreateActivityResult();<NEW_LINE>int originalDepth = context.getCurrentDepth();<NEW_LINE><MASK><NEW_LINE>int targetDepth = originalDepth + 1;<NEW_LINE>JsonToken token = context.getCurrentToken();<NEW_LINE>if (token == null)<NEW_LINE>token = context.nextToken();<NEW_LINE>if (token == VALUE_NULL) {<NEW_LINE>return createActivityResult;<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("activityArn", targetDepth)) {<NEW_LINE>context.nextToken();<NEW_LINE>createActivityResult.setActivityArn(context.getUnmarshaller(String.class).unmarshall(context));<NEW_LINE>}<NEW_LINE>if (context.testExpression("creationDate", targetDepth)) {<NEW_LINE>context.nextToken();<NEW_LINE>createActivityResult.setCreationDate(DateJsonUnmarshallerFactory.getInstance("unixTimestamp").unmarshall(context));<NEW_LINE>}<NEW_LINE>} else if (token == END_ARRAY || token == END_OBJECT) {<NEW_LINE>if (context.getLastParsedParentElement() == null || context.getLastParsedParentElement().equals(currentParentElement)) {<NEW_LINE>if (context.getCurrentDepth() <= originalDepth)<NEW_LINE>break;<NEW_LINE>}<NEW_LINE>}<NEW_LINE>token = context.nextToken();<NEW_LINE>}<NEW_LINE>return createActivityResult;<NEW_LINE>} | String currentParentElement = context.getCurrentParentElement(); |
760,766 | public static boolean isDeprecated(ASTNode node) {<NEW_LINE>if (node instanceof PropertyNode && ((PropertyNode) node).getField() != null) {<NEW_LINE>// use the associated field because properties are never the declaration<NEW_LINE>node = ((<MASK><NEW_LINE>} else if (node instanceof ClassNode) {<NEW_LINE>node = ((ClassNode) node).redirect();<NEW_LINE>}<NEW_LINE>if (node instanceof JDTNode) {<NEW_LINE>return ((JDTNode) node).isDeprecated();<NEW_LINE>}<NEW_LINE>int flags = 0;<NEW_LINE>if (node instanceof ClassNode) {<NEW_LINE>flags = ((ClassNode) node).getModifiers();<NEW_LINE>} else if (node instanceof FieldNode) {<NEW_LINE>flags = ((FieldNode) node).getModifiers();<NEW_LINE>} else if (node instanceof MethodNode) {<NEW_LINE>flags = ((MethodNode) node).getModifiers();<NEW_LINE>}<NEW_LINE>if (Flags.isDeprecated(flags)) {<NEW_LINE>return true;<NEW_LINE>}<NEW_LINE>if (flags > 0 || node instanceof AnnotatedNode) {<NEW_LINE>return getAnnotations((AnnotatedNode) node, "java.lang.Deprecated").anyMatch(x -> true);<NEW_LINE>}<NEW_LINE>return false;<NEW_LINE>} | PropertyNode) node).getField(); |
558,094 | private void updateUdt(RestDB restDB, Keyspace keyspace, UserDefinedTypeUpdate udtUpdate, UserDefinedType udt) throws ExecutionException, InterruptedException {<NEW_LINE>List<UserDefinedTypeField> addFields = udtUpdate.getAddFields();<NEW_LINE>List<UserDefinedTypeUpdate.RenameUdtField> renameFields = udtUpdate.getRenameFields();<NEW_LINE>if ((addFields == null || addFields.isEmpty()) && (renameFields == null || renameFields.isEmpty())) {<NEW_LINE>throw new IllegalArgumentException("addFields and/or renameFields is required to update an UDT.");<NEW_LINE>}<NEW_LINE>if (addFields != null && !addFields.isEmpty()) {<NEW_LINE>List<Column> columns = getUdtColumns(keyspace, addFields);<NEW_LINE>restDB.queryBuilder().alter().type(keyspace.name(), udt).addColumn(columns).build().execute(<MASK><NEW_LINE>}<NEW_LINE>if (renameFields != null && !renameFields.isEmpty()) {<NEW_LINE>List<Pair<String, String>> columns = renameFields.stream().map(r -> Pair.fromArray(new String[] { r.getFrom(), r.getTo() })).collect(Collectors.toList());<NEW_LINE>restDB.queryBuilder().alter().type(keyspace.name(), udt).renameColumn(columns).build().execute(ConsistencyLevel.LOCAL_QUORUM).get();<NEW_LINE>}<NEW_LINE>} | ConsistencyLevel.LOCAL_QUORUM).get(); |
1,331,452 | public List<PurchaseOrder> generatePo(List<PurchaseRequest> purchaseRequests, Boolean groupBySupplier, Boolean groupByProduct) throws AxelorException {<NEW_LINE>List<PurchaseOrderLine> purchaseOrderLineList = new ArrayList<PurchaseOrderLine>();<NEW_LINE>Map<String, PurchaseOrder> purchaseOrderMap = new HashMap<>();<NEW_LINE>for (PurchaseRequest purchaseRequest : purchaseRequests) {<NEW_LINE>PurchaseOrder purchaseOrder;<NEW_LINE>String key = groupBySupplier ? getPurchaseOrderGroupBySupplierKey(purchaseRequest) : null;<NEW_LINE>if (key != null && purchaseOrderMap.containsKey(key)) {<NEW_LINE>purchaseOrder = purchaseOrderMap.get(key);<NEW_LINE>} else {<NEW_LINE>purchaseOrder = createPurchaseOrder(purchaseRequest);<NEW_LINE>key = key == null ? purchaseRequest.getId().toString() : key;<NEW_LINE>purchaseOrderMap.put(key, purchaseOrder);<NEW_LINE>}<NEW_LINE>if (purchaseOrder == null) {<NEW_LINE>purchaseOrder = createPurchaseOrder(purchaseRequest);<NEW_LINE>}<NEW_LINE>for (PurchaseRequestLine purchaseRequestLine : purchaseRequest.getPurchaseRequestLineList()) {<NEW_LINE>PurchaseOrderLine purchaseOrderLine = new PurchaseOrderLine();<NEW_LINE>Product product = purchaseRequestLine.getProduct();<NEW_LINE>purchaseOrderLine = groupByProduct && purchaseOrder != null ? getPoLineByProduct(product, purchaseOrder) : null;<NEW_LINE>purchaseOrderLine = purchaseOrderLineService.createPurchaseOrderLine(purchaseOrder, product, purchaseRequestLine.getNewProduct() ? purchaseRequestLine.getProductTitle() : null, null, purchaseRequestLine.getQuantity(), purchaseRequestLine.getUnit());<NEW_LINE>purchaseOrder.addPurchaseOrderLineListItem(purchaseOrderLine);<NEW_LINE>purchaseOrderLineList.add(purchaseOrderLine);<NEW_LINE><MASK><NEW_LINE>}<NEW_LINE>purchaseOrder.getPurchaseOrderLineList().addAll(purchaseOrderLineList);<NEW_LINE>purchaseOrderService.computePurchaseOrder(purchaseOrder);<NEW_LINE>purchaseOrderRepo.save(purchaseOrder);<NEW_LINE>purchaseRequest.setPurchaseOrder(purchaseOrder);<NEW_LINE>purchaseRequestRepo.save(purchaseRequest);<NEW_LINE>}<NEW_LINE>List<PurchaseOrder> purchaseOrders = purchaseOrderMap.values().stream().collect(Collectors.toList());<NEW_LINE>return purchaseOrders;<NEW_LINE>} | purchaseOrderLineService.compute(purchaseOrderLine, purchaseOrder); |
1,708,037 | private void createActions() {<NEW_LINE>searchAction = new NavigatableContextAction("Search Memory", getName(), false) {<NEW_LINE><NEW_LINE>@Override<NEW_LINE>public void actionPerformed(NavigatableActionContext context) {<NEW_LINE>setNavigatable(context.getNavigatable());<NEW_LINE>invokeSearchDialog(context);<NEW_LINE>}<NEW_LINE>};<NEW_LINE>searchAction.setHelpLocation(new HelpLocation(HelpTopics.SEARCH, searchAction.getName()));<NEW_LINE>String[] menuPath = new String[] { "&Search", "&Memory..." };<NEW_LINE>searchAction.setMenuBarData(new MenuData(menuPath, "search"));<NEW_LINE>searchAction.setKeyBindingData(new KeyBindingData('S', 0));<NEW_LINE>searchAction.setDescription("Search Memory for byte sequence");<NEW_LINE>searchAction.addToWindowWhen(NavigatableActionContext.class);<NEW_LINE>tool.addAction(searchAction);<NEW_LINE>searchAgainAction = new NavigatableContextAction("Repeat Memory Search", getName(), false) {<NEW_LINE><NEW_LINE>@Override<NEW_LINE>public void actionPerformed(NavigatableActionContext context) {<NEW_LINE>setNavigatable(context.getNavigatable());<NEW_LINE>performSearch(searchInfo);<NEW_LINE>}<NEW_LINE><NEW_LINE>@Override<NEW_LINE>protected boolean isEnabledForContext(NavigatableActionContext context) {<NEW_LINE>return searchInfo != null && super.isEnabledForContext(context);<NEW_LINE>}<NEW_LINE>};<NEW_LINE>searchAgainAction.setHelpLocation(new HelpLocation(HelpTopics.SEARCH, searchAgainAction.getName()));<NEW_LINE>menuPath = new String[] { "&Search", "Repeat Memory Search" };<NEW_LINE>searchAgainAction.setMenuBarData(new MenuData(menuPath, "search"));<NEW_LINE>searchAgainAction.setKeyBindingData(new KeyBindingData(KeyEvent.VK_F3, 0));<NEW_LINE>searchAgainAction.setDescription("Search Memory for byte sequence");<NEW_LINE><MASK><NEW_LINE>tool.addAction(searchAgainAction);<NEW_LINE>} | searchAgainAction.addToWindowWhen(NavigatableActionContext.class); |
86,358 | public static void main(final String[] args) {<NEW_LINE>//<NEW_LINE>// Start ADempiere<NEW_LINE>AdempiereToolsHelper.getInstance().startupMinimal();<NEW_LINE><MASK><NEW_LINE>// metas: don't log migration scripts<NEW_LINE>Ini.setProperty(Ini.P_LOGMIGRATIONSCRIPT, false);<NEW_LINE>final TableAndColumnInfoRepository repository = new TableAndColumnInfoRepository();<NEW_LINE>//<NEW_LINE>// Get AD_Reference_ID parameter<NEW_LINE>if (args.length < 1) {<NEW_LINE>throw new AdempiereException("Provide AD_Reference_ID parameter");<NEW_LINE>}<NEW_LINE>final String adReferenceIdStr = args[0];<NEW_LINE>Check.assumeNotEmpty(adReferenceIdStr, "Valid AD_Reference_ID parameter: {}", adReferenceIdStr);<NEW_LINE>final int adReferenceId = Integer.parseInt(adReferenceIdStr.trim());<NEW_LINE>//<NEW_LINE>// Get the AD_Reference list info<NEW_LINE>final ListInfo listInfo = repository.getListInfo(adReferenceId).orElse(null);<NEW_LINE>if (listInfo == null) {<NEW_LINE>throw new AdempiereException("No list info found for AD_Reference_ID=" + adReferenceId);<NEW_LINE>}<NEW_LINE>//<NEW_LINE>// Generate the Java code<NEW_LINE>final String javacode = ADRefListGenerator.newInstance().setColumnName("MyColumnName").setListInfo(listInfo).generateConstants();<NEW_LINE>//<NEW_LINE>// Output the result<NEW_LINE>System.out.println("Generated Java code:");<NEW_LINE>System.out.println("--------------------------------------------------------------------------------------------");<NEW_LINE>System.out.println(javacode);<NEW_LINE>System.out.println("--------------------------------------------------------------------------------------------");<NEW_LINE>} | LogManager.setLevel(Level.DEBUG); |
581,604 | protected void finished() {<NEW_LINE>Iterator<GenericDetail> allDetails = (Iterator<GenericDetail>) get();<NEW_LINE>if (allDetails == null)<NEW_LINE>return;<NEW_LINE>while (allDetails.hasNext()) {<NEW_LINE>GenericDetail detail = allDetails.next();<NEW_LINE>loadDetail(detail);<NEW_LINE>}<NEW_LINE>boolean isAnyDetailEditable = false;<NEW_LINE>for (Class<? extends GenericDetail> editable : detailToTextField.keySet()) {<NEW_LINE>if (accountInfoOpSet.isDetailClassEditable(editable)) {<NEW_LINE>isAnyDetailEditable = true;<NEW_LINE>if (editable.equals(AboutMeDetail.class))<NEW_LINE>aboutMeArea.setEnabled(true);<NEW_LINE>else if (editable.equals(BirthDateDetail.class))<NEW_LINE>birthDayCalendar.setEnabled(true);<NEW_LINE>else if (editable.equals(ImageDetail.class)) {<NEW_LINE>globalIcon.setEnabled(true);<NEW_LINE>localIcon.setEnabled(true);<NEW_LINE>imageWithMenu.setEnabled(true);<NEW_LINE>} else {<NEW_LINE>JTextField <MASK><NEW_LINE>field.setEnabled(true);<NEW_LINE>}<NEW_LINE>}<NEW_LINE>}<NEW_LINE>if (isAnyDetailEditable)<NEW_LINE>applyButton.setEnabled(true);<NEW_LINE>} | field = detailToTextField.get(editable); |
525,593 | SQLException closeWrapper() {<NEW_LINE>SQLException sqlX = null;<NEW_LINE>// Indicate the statement is closed by setting the parent object's statement to<NEW_LINE>// null. This will allow us to be garbage collected.<NEW_LINE>try // Connection wrapper can close at any time.<NEW_LINE>{<NEW_LINE>parentWrapper.childWrappers.remove(this);<NEW_LINE>} catch (RuntimeException runtimeX) {<NEW_LINE>if (parentWrapper.state != CLOSED)<NEW_LINE>throw runtimeX;<NEW_LINE>}<NEW_LINE>try {<NEW_LINE>// Since we cannot return the statement to the cache, close it instead.<NEW_LINE>pstmtImpl.close();<NEW_LINE>} catch (SQLException closeX) {<NEW_LINE>svLogger.exiting(CLASSNAME, "ERR_CLOSING_OBJECT", new Object<MASK><NEW_LINE>if (sqlX == null)<NEW_LINE>sqlX = closeX;<NEW_LINE>}<NEW_LINE>stmtImpl = null;<NEW_LINE>pstmtImpl = null;<NEW_LINE>parameterList2 = null;<NEW_LINE>return sqlX;<NEW_LINE>} | [] { pstmtImpl, closeX }); |
553,592 | public void bind(@NonNull ReviewCommentModel commentModel) {<NEW_LINE>if (commentModel.getUser() != null) {<NEW_LINE>avatarView.setUrl(commentModel.getUser().getAvatarUrl(), commentModel.getUser().getLogin(), commentModel.getUser().isOrganizationType(), LinkParserHelper.isEnterprise(commentModel.getHtmlUrl()));<NEW_LINE>name.setText(commentModel.getUser().getLogin());<NEW_LINE>if (commentModel.getAuthorAssociation() != null && !"none".equalsIgnoreCase(commentModel.getAuthorAssociation())) {<NEW_LINE>owner.setText(commentModel.getAuthorAssociation().toLowerCase());<NEW_LINE>owner.setVisibility(View.VISIBLE);<NEW_LINE>} else {<NEW_LINE>boolean isRepoOwner = TextUtils.equals(commentModel.getUser().getLogin(), repoOwner);<NEW_LINE>if (isRepoOwner) {<NEW_LINE>owner.setVisibility(View.VISIBLE);<NEW_LINE>owner.setText(R.string.owner);<NEW_LINE>} else {<NEW_LINE>boolean isPoster = TextUtils.equals(commentModel.getUser().getLogin(), poster);<NEW_LINE>if (isPoster) {<NEW_LINE>owner.setVisibility(View.VISIBLE);<NEW_LINE>owner.setText(R.string.original_poster);<NEW_LINE>} else {<NEW_LINE>owner.setText("");<NEW_LINE><MASK><NEW_LINE>}<NEW_LINE>}<NEW_LINE>}<NEW_LINE>}<NEW_LINE>date.setText(ParseDateFormat.getTimeAgo(commentModel.getCreatedAt()));<NEW_LINE>if (!InputHelper.isEmpty(commentModel.getBodyHtml())) {<NEW_LINE>int width = adapter != null ? adapter.getRowWidth() : 0;<NEW_LINE>HtmlHelper.htmlIntoTextView(comment, commentModel.getBodyHtml(), width > 0 ? width : viewGroup.getWidth());<NEW_LINE>} else {<NEW_LINE>comment.setText("");<NEW_LINE>}<NEW_LINE>if (commentModel.getReactions() != null) {<NEW_LINE>ReactionsModel reaction = commentModel.getReactions();<NEW_LINE>appendEmojies(reaction);<NEW_LINE>}<NEW_LINE>if (onToggleView != null)<NEW_LINE>onToggle(onToggleView.isCollapsed(getId()), false);<NEW_LINE>} | owner.setVisibility(View.GONE); |
705,761 | private Sharing parseSharing(final Element element, final Locale locale) {<NEW_LINE>final Element root = getRoot(element);<NEW_LINE>Sharing sharing = null;<NEW_LINE>final Element sharingChild = root.getChild(Sharing.NAME, SSEModule.SSE_NS);<NEW_LINE>if (sharingChild != null) {<NEW_LINE>sharing = new Sharing();<NEW_LINE>sharing.setOrdered(parseBooleanAttr(sharingChild, Sharing.ORDERED_ATTRIBUTE));<NEW_LINE>sharing.setSince(parseDateAttribute(sharingChild, Sharing.SINCE_ATTRIBUTE, locale));<NEW_LINE>sharing.setUntil(parseDateAttribute(sharingChild, Sharing.UNTIL_ATTRIBUTE, locale));<NEW_LINE>sharing.setWindow(parseIntegerAttribute<MASK><NEW_LINE>sharing.setVersion(parseStringAttribute(sharingChild, Sharing.VERSION_ATTRIBUTE));<NEW_LINE>parseRelated(root, sharing, locale);<NEW_LINE>}<NEW_LINE>return sharing;<NEW_LINE>} | (sharingChild, Sharing.WINDOW_ATTRIBUTE)); |
1,153,605 | private void doRehash(int new_table_size) throws IOException, EOFException, FileManagerException, ClassNotFoundException, HashtableOnDiskException {<NEW_LINE>//<NEW_LINE>// Acquire the lock to prevent iteration while doubling<NEW_LINE>//<NEW_LINE>iterationLock.p();<NEW_LINE>//<NEW_LINE>// Step 0:<NEW_LINE>// This should be our only exposure = for a short time we<NEW_LINE>// will have allocated the new table but not stored its location<NEW_LINE>// anywhere. If we crash here we leak that storage permanently.<NEW_LINE>//<NEW_LINE>long new_table = 0;<NEW_LINE>header.setRehashFlag(1);<NEW_LINE>new_table = filemgr.allocateAndClear(new_table_size * DWORDSIZE);<NEW_LINE><MASK><NEW_LINE>PrimitiveArrayPool.PoolEntry longPoolEntry = this.htoddc.longArrayPool.allocate(new_table_size);<NEW_LINE>new_htindex = (long[]) longPoolEntry.getArray();<NEW_LINE>// new_htindex = new long[new_table_size];<NEW_LINE>Rehash rehash = new Rehash(this, new_table, new_table_size);<NEW_LINE>Thread t = new Thread(rehash);<NEW_LINE>t.start();<NEW_LINE>} | header.initNewTable(new_table_size, new_table); |
857,323 | private void initializeExecutor() {<NEW_LINE>int maximumPoolSize = Runtime.getRuntime().availableProcessors();<NEW_LINE>LinkedBlockingQueue<Runnable> executorQueue = new LinkedBlockingQueue<>(maximumPoolSize);<NEW_LINE>BasicThreadFactory threadFactory = new BasicThreadFactory.Builder().namingPattern("worker-" + "-%d").daemon(false).priority(<MASK><NEW_LINE>RejectedExecutionHandler rejectedExecutionHandler = new RejectedExecutionHandler() {<NEW_LINE><NEW_LINE>@Override<NEW_LINE>public void rejectedExecution(Runnable theRunnable, ThreadPoolExecutor theExecutor) {<NEW_LINE>logInfo(ourLog, "Note: Executor queue is full ({} elements), waiting for a slot to become available!", executorQueue.size());<NEW_LINE>StopWatch sw = new StopWatch();<NEW_LINE>try {<NEW_LINE>executorQueue.put(theRunnable);<NEW_LINE>} catch (InterruptedException theE) {<NEW_LINE>throw new RejectedExecutionException(Msg.code(70) + "Task " + theRunnable.toString() + " rejected from " + theE.toString());<NEW_LINE>}<NEW_LINE>logInfo(ourLog, "Slot become available after {}ms", sw.getMillis());<NEW_LINE>}<NEW_LINE>};<NEW_LINE>myExecutor = new ThreadPoolExecutor(1, maximumPoolSize, 0L, TimeUnit.MILLISECONDS, executorQueue, threadFactory, rejectedExecutionHandler);<NEW_LINE>} | Thread.NORM_PRIORITY).build(); |
540,140 | private void saveMaxResources(AssignableVirtualMachine avm) {<NEW_LINE>if (attrNameToGroupMaxResources != null && !attrNameToGroupMaxResources.isEmpty()) {<NEW_LINE>String attrValue = avm.getAttrValue(attrNameToGroupMaxResources);<NEW_LINE>if (attrValue != null) {<NEW_LINE>Map<VMResource, Double<MASK><NEW_LINE>Map<VMResource, Double> savedMaxResources = maxResourcesMap.get(attrValue);<NEW_LINE>if (savedMaxResources == null) {<NEW_LINE>savedMaxResources = new HashMap<>();<NEW_LINE>maxResourcesMap.put(attrValue, savedMaxResources);<NEW_LINE>}<NEW_LINE>for (VMResource r : VMResource.values()) {<NEW_LINE>switch(r) {<NEW_LINE>case CPU:<NEW_LINE>case Disk:<NEW_LINE>case Memory:<NEW_LINE>case Ports:<NEW_LINE>case Network:<NEW_LINE>Double savedVal = savedMaxResources.get(r) == null ? 0.0 : savedMaxResources.get(r);<NEW_LINE>savedMaxResources.put(r, Math.max(savedVal, maxResources.get(r)));<NEW_LINE>}<NEW_LINE>}<NEW_LINE>}<NEW_LINE>}<NEW_LINE>} | > maxResources = avm.getMaxResources(); |
1,392,433 | public static ListDeployGroupResponse unmarshall(ListDeployGroupResponse listDeployGroupResponse, UnmarshallerContext _ctx) {<NEW_LINE>listDeployGroupResponse.setRequestId(_ctx.stringValue("ListDeployGroupResponse.RequestId"));<NEW_LINE>listDeployGroupResponse.setCode(_ctx.integerValue("ListDeployGroupResponse.Code"));<NEW_LINE>listDeployGroupResponse.setMessage(_ctx.stringValue("ListDeployGroupResponse.Message"));<NEW_LINE>List<DeployGroup> deployGroupList = new ArrayList<DeployGroup>();<NEW_LINE>for (int i = 0; i < _ctx.lengthValue("ListDeployGroupResponse.DeployGroupList.Length"); i++) {<NEW_LINE>DeployGroup deployGroup = new DeployGroup();<NEW_LINE>deployGroup.setGroupId(_ctx.stringValue("ListDeployGroupResponse.DeployGroupList[" + i + "].GroupId"));<NEW_LINE>deployGroup.setGroupName(_ctx.stringValue("ListDeployGroupResponse.DeployGroupList[" + i + "].GroupName"));<NEW_LINE>deployGroup.setAppId(_ctx.stringValue("ListDeployGroupResponse.DeployGroupList[" + i + "].AppId"));<NEW_LINE>deployGroup.setPackageVersionId(_ctx.stringValue("ListDeployGroupResponse.DeployGroupList[" + i + "].PackageVersionId"));<NEW_LINE>deployGroup.setAppVersionId(_ctx.stringValue("ListDeployGroupResponse.DeployGroupList[" + i + "].AppVersionId"));<NEW_LINE>deployGroup.setGroupType(_ctx.integerValue("ListDeployGroupResponse.DeployGroupList[" + i + "].GroupType"));<NEW_LINE>deployGroup.setClusterId(_ctx.stringValue("ListDeployGroupResponse.DeployGroupList[" + i + "].ClusterId"));<NEW_LINE>deployGroup.setCreateTime(_ctx.longValue("ListDeployGroupResponse.DeployGroupList[" + i + "].CreateTime"));<NEW_LINE>deployGroup.setUpdateTime(_ctx.longValue("ListDeployGroupResponse.DeployGroupList[" + i + "].UpdateTime"));<NEW_LINE>deployGroup.setNameSpace(_ctx.stringValue("ListDeployGroupResponse.DeployGroupList[" + i + "].NameSpace"));<NEW_LINE>deployGroup.setClusterName(_ctx.stringValue<MASK><NEW_LINE>deployGroup.setLastUpdateTime(_ctx.longValue("ListDeployGroupResponse.DeployGroupList[" + i + "].LastUpdateTime"));<NEW_LINE>deployGroup.setPreStop(_ctx.stringValue("ListDeployGroupResponse.DeployGroupList[" + i + "].PreStop"));<NEW_LINE>deployGroup.setPostStart(_ctx.stringValue("ListDeployGroupResponse.DeployGroupList[" + i + "].PostStart"));<NEW_LINE>deployGroup.setPackageUrl(_ctx.stringValue("ListDeployGroupResponse.DeployGroupList[" + i + "].PackageUrl"));<NEW_LINE>deployGroup.setEnv(_ctx.stringValue("ListDeployGroupResponse.DeployGroupList[" + i + "].Env"));<NEW_LINE>deployGroup.setLabels(_ctx.stringValue("ListDeployGroupResponse.DeployGroupList[" + i + "].Labels"));<NEW_LINE>deployGroup.setSelector(_ctx.stringValue("ListDeployGroupResponse.DeployGroupList[" + i + "].Selector"));<NEW_LINE>deployGroup.setStrategy(_ctx.stringValue("ListDeployGroupResponse.DeployGroupList[" + i + "].Strategy"));<NEW_LINE>deployGroup.setStatus(_ctx.stringValue("ListDeployGroupResponse.DeployGroupList[" + i + "].Status"));<NEW_LINE>deployGroup.setReversion(_ctx.stringValue("ListDeployGroupResponse.DeployGroupList[" + i + "].Reversion"));<NEW_LINE>deployGroup.setCsClusterId(_ctx.stringValue("ListDeployGroupResponse.DeployGroupList[" + i + "].CsClusterId"));<NEW_LINE>deployGroup.setBaseComponentMetaName(_ctx.stringValue("ListDeployGroupResponse.DeployGroupList[" + i + "].BaseComponentMetaName"));<NEW_LINE>deployGroup.setDeploymentName(_ctx.stringValue("ListDeployGroupResponse.DeployGroupList[" + i + "].DeploymentName"));<NEW_LINE>deployGroup.setCpuLimit(_ctx.stringValue("ListDeployGroupResponse.DeployGroupList[" + i + "].CpuLimit"));<NEW_LINE>deployGroup.setMemoryLimit(_ctx.stringValue("ListDeployGroupResponse.DeployGroupList[" + i + "].MemoryLimit"));<NEW_LINE>deployGroup.setPackagePublicUrl(_ctx.stringValue("ListDeployGroupResponse.DeployGroupList[" + i + "].PackagePublicUrl"));<NEW_LINE>deployGroup.setPackageVersion(_ctx.stringValue("ListDeployGroupResponse.DeployGroupList[" + i + "].PackageVersion"));<NEW_LINE>deployGroup.setCpuRequest(_ctx.stringValue("ListDeployGroupResponse.DeployGroupList[" + i + "].CpuRequest"));<NEW_LINE>deployGroup.setMemoryRequest(_ctx.stringValue("ListDeployGroupResponse.DeployGroupList[" + i + "].MemoryRequest"));<NEW_LINE>deployGroup.setVServerGroupId(_ctx.stringValue("ListDeployGroupResponse.DeployGroupList[" + i + "].VServerGroupId"));<NEW_LINE>deployGroup.setVExtServerGroupId(_ctx.stringValue("ListDeployGroupResponse.DeployGroupList[" + i + "].VExtServerGroupId"));<NEW_LINE>deployGroupList.add(deployGroup);<NEW_LINE>}<NEW_LINE>listDeployGroupResponse.setDeployGroupList(deployGroupList);<NEW_LINE>return listDeployGroupResponse;<NEW_LINE>} | ("ListDeployGroupResponse.DeployGroupList[" + i + "].ClusterName")); |
295,290 | public void marshall(CreateIdentityProviderRequest createIdentityProviderRequest, ProtocolMarshaller protocolMarshaller) {<NEW_LINE>if (createIdentityProviderRequest == null) {<NEW_LINE>throw new SdkClientException("Invalid argument passed to marshall(...)");<NEW_LINE>}<NEW_LINE>try {<NEW_LINE>protocolMarshaller.marshall(createIdentityProviderRequest.getUserPoolId(), USERPOOLID_BINDING);<NEW_LINE>protocolMarshaller.marshall(createIdentityProviderRequest.getProviderName(), PROVIDERNAME_BINDING);<NEW_LINE>protocolMarshaller.marshall(createIdentityProviderRequest.getProviderType(), PROVIDERTYPE_BINDING);<NEW_LINE>protocolMarshaller.marshall(createIdentityProviderRequest.getProviderDetails(), PROVIDERDETAILS_BINDING);<NEW_LINE>protocolMarshaller.marshall(createIdentityProviderRequest.getAttributeMapping(), ATTRIBUTEMAPPING_BINDING);<NEW_LINE>protocolMarshaller.marshall(createIdentityProviderRequest.getIdpIdentifiers(), IDPIDENTIFIERS_BINDING);<NEW_LINE>} catch (Exception e) {<NEW_LINE>throw new SdkClientException("Unable to marshall request to JSON: " + <MASK><NEW_LINE>}<NEW_LINE>} | e.getMessage(), e); |
60,770 | private static void loadFromLocalMotorFiles(List<Motor> allMotors, String inputDir) throws IOException {<NEW_LINE>GeneralMotorLoader loader = new GeneralMotorLoader();<NEW_LINE>FileIterator iterator = DirectoryIterator.findDirectory(inputDir, new SimpleFileFilter("", false, loader.getSupportedExtensions()));<NEW_LINE>if (iterator == null) {<NEW_LINE>System.out.println("Can't find " + inputDir + " directory");<NEW_LINE>System.exit(1);<NEW_LINE>} else {<NEW_LINE>while (iterator.hasNext()) {<NEW_LINE>Pair<String, InputStream> f = iterator.next();<NEW_LINE>String fileName = f.getU();<NEW_LINE><MASK><NEW_LINE>List<ThrustCurveMotor.Builder> motors = loader.load(is, fileName);<NEW_LINE>for (ThrustCurveMotor.Builder builder : motors) {<NEW_LINE>allMotors.add(builder.build());<NEW_LINE>}<NEW_LINE>}<NEW_LINE>}<NEW_LINE>} | InputStream is = f.getV(); |
172,129 | public PlanWithProperties visitSemiJoin(SemiJoinNode node, HashComputationSet parentPreference) {<NEW_LINE>Optional<HashComputation> sourceHashComputation = computeHash(ImmutableList.of(node.getSourceJoinVariable()), functionAndTypeManager);<NEW_LINE>PlanWithProperties source = planAndEnforce(node.getSource(), new HashComputationSet(sourceHashComputation), true, new HashComputationSet(sourceHashComputation));<NEW_LINE>VariableReferenceExpression sourceHashVariable = source.<MASK><NEW_LINE>Optional<HashComputation> filterHashComputation = computeHash(ImmutableList.of(node.getFilteringSourceJoinVariable()), functionAndTypeManager);<NEW_LINE>HashComputationSet requiredHashes = new HashComputationSet(filterHashComputation);<NEW_LINE>PlanWithProperties filteringSource = planAndEnforce(node.getFilteringSource(), requiredHashes, true, requiredHashes);<NEW_LINE>VariableReferenceExpression filteringSourceHashVariable = filteringSource.getRequiredHashVariable(filterHashComputation.get());<NEW_LINE>return new PlanWithProperties(new SemiJoinNode(node.getSourceLocation(), node.getId(), source.getNode(), filteringSource.getNode(), node.getSourceJoinVariable(), node.getFilteringSourceJoinVariable(), node.getSemiJoinOutput(), Optional.of(sourceHashVariable), Optional.of(filteringSourceHashVariable), node.getDistributionType(), node.getDynamicFilters()), source.getHashVariables());<NEW_LINE>} | getRequiredHashVariable(sourceHashComputation.get()); |
680,197 | public ProcessStatus handleRestValidateCode(final PwmRequest pwmRequest) throws PwmUnrecoverableException, IOException, ServletException, ChaiUnavailableException {<NEW_LINE>final PwmDomain pwmDomain = pwmRequest.getPwmDomain();<NEW_LINE>final PwmSession pwmSession = pwmRequest.getPwmSession();<NEW_LINE>final OTPUserRecord otpUserRecord = pwmSession.getUserInfo().getOtpUserRecord();<NEW_LINE>final <MASK><NEW_LINE>final String bodyString = pwmRequest.readRequestBodyAsString();<NEW_LINE>final Map<String, String> clientValues = JsonFactory.get().deserializeStringMap(bodyString);<NEW_LINE>final String code = Validator.sanitizeInputValue(pwmRequest.getAppConfig(), clientValues.get("code"), 1024);<NEW_LINE>try {<NEW_LINE>final boolean passed = otpService.validateToken(pwmRequest.getLabel(), pwmSession.getUserInfo().getUserIdentity(), otpUserRecord, code, false);<NEW_LINE>final RestResultBean restResultBean = RestResultBean.withData(passed, Boolean.class);<NEW_LINE>LOGGER.trace(pwmRequest, () -> "returning result for restValidateCode: " + JsonFactory.get().serialize(restResultBean));<NEW_LINE>pwmRequest.outputJsonResult(restResultBean);<NEW_LINE>} catch (final PwmOperationalException e) {<NEW_LINE>final String errorMsg = "error during otp code validation: " + e.getMessage();<NEW_LINE>LOGGER.error(pwmRequest, () -> errorMsg);<NEW_LINE>pwmRequest.outputJsonResult(RestResultBean.fromError(new ErrorInformation(PwmError.ERROR_INTERNAL, errorMsg), pwmRequest));<NEW_LINE>}<NEW_LINE>return ProcessStatus.Continue;<NEW_LINE>} | OtpService otpService = pwmDomain.getOtpService(); |
1,614,898 | protected void doPost(HttpServletRequest request, HttpServletResponse response) {<NEW_LINE>GrpcAPI.Return.Builder returnBuilder = GrpcAPI.Return.newBuilder();<NEW_LINE>EasyTransferResponse.Builder responseBuild = EasyTransferResponse.newBuilder();<NEW_LINE>boolean visible = false;<NEW_LINE>try {<NEW_LINE>String input = request.getReader().lines().collect(Collectors.joining(System.lineSeparator()));<NEW_LINE>visible = Util.getVisiblePost(input);<NEW_LINE>EasyTransferAssetByPrivateMessage.Builder build = EasyTransferAssetByPrivateMessage.newBuilder();<NEW_LINE>JsonFormat.merge(input, build, visible);<NEW_LINE>byte[] privateKey = build.getPrivateKey().toByteArray();<NEW_LINE>SignInterface ecKey = SignUtils.fromPrivate(privateKey, Args.getInstance().isECKeyCryptoEngine());<NEW_LINE>byte[] owner = ecKey.getAddress();<NEW_LINE>TransferAssetContract.Builder builder = TransferAssetContract.newBuilder();<NEW_LINE>builder.setOwnerAddress(ByteString.copyFrom(owner));<NEW_LINE>builder.setToAddress(build.getToAddress());<NEW_LINE>builder.setAssetName(ByteString.copyFrom(build.getAssetId().getBytes()));<NEW_LINE>builder.setAmount(build.getAmount());<NEW_LINE>TransactionCapsule transactionCapsule;<NEW_LINE>transactionCapsule = wallet.createTransactionCapsule(builder.build(), ContractType.TransferAssetContract);<NEW_LINE>transactionCapsule.sign(privateKey);<NEW_LINE>GrpcAPI.Return result = wallet.broadcastTransaction(transactionCapsule.getInstance());<NEW_LINE>responseBuild.<MASK><NEW_LINE>responseBuild.setResult(result);<NEW_LINE>response.getWriter().println(Util.printEasyTransferResponse(responseBuild.build(), visible));<NEW_LINE>} catch (Exception e) {<NEW_LINE>returnBuilder.setResult(false).setCode(response_code.CONTRACT_VALIDATE_ERROR).setMessage(ByteString.copyFromUtf8(e.getMessage()));<NEW_LINE>responseBuild.setResult(returnBuilder.build());<NEW_LINE>try {<NEW_LINE>response.getWriter().println(JsonFormat.printToString(responseBuild.build(), visible));<NEW_LINE>} catch (IOException ioe) {<NEW_LINE>logger.debug("IOException: {}", ioe.getMessage());<NEW_LINE>}<NEW_LINE>}<NEW_LINE>} | setTransaction(transactionCapsule.getInstance()); |
19,497 | public void offer(SendLogRequest log) {<NEW_LINE>// if nodeLogQueues.isEmpty(), then nothing to do.<NEW_LINE>// do serialization here to avoid taking LogManager for too long<NEW_LINE>if (!nodeLogQueues.isEmpty()) {<NEW_LINE>log.serializedLogFuture = serializationService.submit(() -> {<NEW_LINE>ByteBuffer byteBuffer = log.getLog().serialize();<NEW_LINE>log.getLog().setByteSize(<MASK><NEW_LINE>return byteBuffer;<NEW_LINE>});<NEW_LINE>}<NEW_LINE>for (int i = 0; i < nodeLogQueues.size(); i++) {<NEW_LINE>BlockingQueue<SendLogRequest> nodeLogQueue = nodeLogQueues.get(i);<NEW_LINE>try {<NEW_LINE>boolean addSucceeded;<NEW_LINE>if (ClusterDescriptor.getInstance().getConfig().isWaitForSlowNode()) {<NEW_LINE>addSucceeded = nodeLogQueue.offer(log, ClusterDescriptor.getInstance().getConfig().getWriteOperationTimeoutMS(), TimeUnit.MILLISECONDS);<NEW_LINE>} else {<NEW_LINE>addSucceeded = nodeLogQueue.add(log);<NEW_LINE>}<NEW_LINE>if (!addSucceeded) {<NEW_LINE>logger.debug("Log queue[{}] of {} is full, ignore the log to this node", i, member.getName());<NEW_LINE>} else {<NEW_LINE>log.setEnqueueTime(System.nanoTime());<NEW_LINE>}<NEW_LINE>} catch (IllegalStateException e) {<NEW_LINE>logger.debug("Log queue[{}] of {} is full, ignore the log to this node", i, member.getName());<NEW_LINE>} catch (InterruptedException e) {<NEW_LINE>Thread.currentThread().interrupt();<NEW_LINE>}<NEW_LINE>}<NEW_LINE>} | byteBuffer.array().length); |
1,468,095 | public void read(int empId) {<NEW_LINE>OperationResult<ColumnList<String>> result;<NEW_LINE>try {<NEW_LINE>result = keyspace.prepareQuery(EMP_CF).getKey(empId).execute();<NEW_LINE>ColumnList<String> cols = result.getResult();<NEW_LINE>logger.debug("read: isEmpty: " + cols.isEmpty());<NEW_LINE>// process data<NEW_LINE>// a) iterate over columsn<NEW_LINE>logger.debug("emp");<NEW_LINE>for (Iterator<Column<String>> i = cols.iterator(); i.hasNext(); ) {<NEW_LINE>Column<String> c = i.next();<NEW_LINE>Object v = null;<NEW_LINE>if (// type induction hack<NEW_LINE>c.getName().endsWith("id"))<NEW_LINE>v = c.getIntegerValue();<NEW_LINE>else<NEW_LINE>v = c.getStringValue();<NEW_LINE>logger.debug("- col: '" + c.getName() + "': " + v);<NEW_LINE>}<NEW_LINE>// b) get columns by name<NEW_LINE>logger.debug("emp");<NEW_LINE>logger.debug("- emp id: " + cols.getIntegerValue(COL_NAME_EMPID, null));<NEW_LINE>logger.debug("- dept: " + cols.getIntegerValue(COL_NAME_DEPTID, null));<NEW_LINE>logger.debug("- firstName: " + cols.getStringValue(COL_NAME_FIRST_NAME, null));<NEW_LINE>logger.debug("- lastName: " + cols.getStringValue(COL_NAME_LAST_NAME, null));<NEW_LINE>} catch (ConnectionException e) {<NEW_LINE>logger.error("failed to read from C*", e);<NEW_LINE><MASK><NEW_LINE>}<NEW_LINE>} | throw new RuntimeException("failed to read from C*", e); |
1,015,716 | static void edgeType(int u) {<NEW_LINE>status[u] = EXPLORED;<NEW_LINE>for (int v : adjList[u]) if (status[v] == UNVISITED) {<NEW_LINE>System.out.printf("Edge from %d to %d is %s%n", u, v, "tree edge");<NEW_LINE>parent[v] = u;<NEW_LINE>edgeType(v);<NEW_LINE>} else if (// cross edges only occur in directed graph<NEW_LINE>status[v] == VISITED)<NEW_LINE>System.out.printf("Edge from %d to %d is %s%n", u, v, "forwad/cross edge");<NEW_LINE>else if (parent[u] == v)<NEW_LINE>System.out.printf(<MASK><NEW_LINE>else {<NEW_LINE>System.out.printf("Edge from %d to %d is %s%n", u, v, "back edge");<NEW_LINE>System.out.println("Cycle!");<NEW_LINE>}<NEW_LINE>status[u] = VISITED;<NEW_LINE>} | "Edge from %d to %d is %s%n", u, v, "bidirectional edge"); |
637,673 | protected JSModuleRecord loadModuleFromUrl(ScriptOrModule referrer, ModuleRequest moduleRequest, TruffleFile maybeModuleFile, TruffleString maybeCanonicalPath) throws IOException {<NEW_LINE>JSModuleRecord existingModule;<NEW_LINE>TruffleFile moduleFile;<NEW_LINE>TruffleString canonicalPath;<NEW_LINE>if (maybeCanonicalPath == null) {<NEW_LINE>if (!maybeModuleFile.exists()) {<NEW_LINE>// check whether the moduleFile was loaded already (as literal source)<NEW_LINE>// before trying to invoke getCanonicalFile() (which would fail)<NEW_LINE>canonicalPath = Strings.fromJavaString(maybeModuleFile.getPath());<NEW_LINE>existingModule = moduleMap.get(canonicalPath);<NEW_LINE>if (existingModule != null) {<NEW_LINE>return existingModule;<NEW_LINE>}<NEW_LINE>}<NEW_LINE>moduleFile = maybeModuleFile.getCanonicalFile();<NEW_LINE>canonicalPath = Strings.fromJavaString(moduleFile.getPath());<NEW_LINE>} else {<NEW_LINE>moduleFile = maybeModuleFile;<NEW_LINE>canonicalPath = maybeCanonicalPath;<NEW_LINE>}<NEW_LINE>existingModule = moduleMap.get(canonicalPath);<NEW_LINE>if (existingModule != null) {<NEW_LINE>return existingModule;<NEW_LINE>}<NEW_LINE>Source source = Source.newBuilder(JavaScriptLanguage.ID, moduleFile).name(Strings.toJavaString(moduleRequest.getSpecifier())).mimeType(JavaScriptLanguage.MODULE_MIME_TYPE).build();<NEW_LINE>Map<TruffleString, TruffleString> assertions = moduleRequest.getAssertions();<NEW_LINE>int moduleType = getModuleType(moduleFile.getName());<NEW_LINE>TruffleString assertedType = assertions.<MASK><NEW_LINE>if (!doesModuleTypeMatchAssertionType(assertedType, moduleType)) {<NEW_LINE>throw Errors.createTypeError("Invalid module type was asserted");<NEW_LINE>}<NEW_LINE>JSModuleRecord newModule;<NEW_LINE>if (isModuleType(moduleType, JSON_MODULE_TYPE)) {<NEW_LINE>newModule = realm.getContext().getEvaluator().parseJSONModule(realm, source);<NEW_LINE>} else {<NEW_LINE>JSModuleData parsedModule = realm.getContext().getEvaluator().envParseModule(realm, source);<NEW_LINE>newModule = new JSModuleRecord(parsedModule, this);<NEW_LINE>}<NEW_LINE>moduleMap.put(canonicalPath, newModule);<NEW_LINE>if (referrer instanceof JSModuleRecord) {<NEW_LINE>((JSModuleRecord) referrer).getModuleData().rememberImportedModuleSource(moduleRequest.getSpecifier(), source);<NEW_LINE>}<NEW_LINE>return newModule;<NEW_LINE>} | get(JSContext.getTypeImportAssertion()); |
778,513 | public void ready(ReadableMap params, final Callback success, final Callback failure) {<NEW_LINE>TSConfig config = TSConfig.getInstance(getReactApplicationContext());<NEW_LINE>boolean reset = true;<NEW_LINE>if (params.hasKey("reset")) {<NEW_LINE>reset = params.getBoolean("reset");<NEW_LINE>}<NEW_LINE>if (mReady) {<NEW_LINE>if (reset) {<NEW_LINE>TSLog.logger.warn(TSLog.warn("#ready already called. Redirecting to #setConfig"));<NEW_LINE>setConfig(params, success, failure);<NEW_LINE>} else {<NEW_LINE>TSLog.logger.warn(TSLog.warn("#ready already called. Ignored config since reset: false"));<NEW_LINE>success.invoke(getState());<NEW_LINE>}<NEW_LINE>return;<NEW_LINE>}<NEW_LINE>mReady = true;<NEW_LINE>registerEvents();<NEW_LINE>if (config.isFirstBoot()) {<NEW_LINE>config.updateWithJSONObject(mapToJson(setHeadlessJobService(params)));<NEW_LINE>} else {<NEW_LINE>if (reset) {<NEW_LINE>config.reset();<NEW_LINE>config.updateWithJSONObject(mapToJson(setHeadlessJobService(params)));<NEW_LINE>} else if (params.hasKey(TSAuthorization.NAME)) {<NEW_LINE>ReadableMap readableMap = params.getMap(TSAuthorization.NAME);<NEW_LINE>if (readableMap != null) {<NEW_LINE>Map<String, Object> options = readableMap.toHashMap();<NEW_LINE>// Have to be careful with expires: ReadadbleMap#toHashMap converts it to Double.<NEW_LINE>options.put(TSAuthorization.FIELD_EXPIRES, readableMap.getInt(TSAuthorization.FIELD_EXPIRES));<NEW_LINE>config.updateWithBuilder().setAuthorization(new TSAuthorization<MASK><NEW_LINE>}<NEW_LINE>}<NEW_LINE>}<NEW_LINE>getAdapter().ready(new TSCallback() {<NEW_LINE><NEW_LINE>@Override<NEW_LINE>public void onSuccess() {<NEW_LINE>success.invoke(getState());<NEW_LINE>}<NEW_LINE><NEW_LINE>@Override<NEW_LINE>public void onFailure(String error) {<NEW_LINE>failure.invoke(error);<NEW_LINE>}<NEW_LINE>});<NEW_LINE>} | (options)).commit(); |
1,277,307 | public ECPoint twice() {<NEW_LINE>if (this.isInfinity()) {<NEW_LINE>return this;<NEW_LINE>}<NEW_LINE>ECCurve curve = this.getCurve();<NEW_LINE>ECFieldElement X1 = this.x;<NEW_LINE>if (X1.isZero()) {<NEW_LINE>// A point with X == 0 is its own additive inverse<NEW_LINE>return curve.getInfinity();<NEW_LINE>}<NEW_LINE>ECFieldElement L1 = this.y, Z1 = this.zs[0];<NEW_LINE>boolean Z1IsOne = Z1.isOne();<NEW_LINE>ECFieldElement L1Z1 = Z1IsOne ? L1 : L1.multiply(Z1);<NEW_LINE>ECFieldElement Z1Sq = Z1IsOne ? Z1 : Z1.square();<NEW_LINE>ECFieldElement a = curve.getA();<NEW_LINE>ECFieldElement aZ1Sq = Z1IsOne ? <MASK><NEW_LINE>ECFieldElement T = L1.square().add(L1Z1).add(aZ1Sq);<NEW_LINE>if (T.isZero()) {<NEW_LINE>return new SecT113R1Point(curve, T, curve.getB().sqrt());<NEW_LINE>}<NEW_LINE>ECFieldElement X3 = T.square();<NEW_LINE>ECFieldElement Z3 = Z1IsOne ? T : T.multiply(Z1Sq);<NEW_LINE>ECFieldElement X1Z1 = Z1IsOne ? X1 : X1.multiply(Z1);<NEW_LINE>ECFieldElement L3 = X1Z1.squarePlusProduct(T, L1Z1).add(X3).add(Z3);<NEW_LINE>return new SecT113R1Point(curve, X3, L3, new ECFieldElement[] { Z3 });<NEW_LINE>} | a : a.multiply(Z1Sq); |
526,917 | public RestRequest makeRequest(int method, String url, java.util.Map<String, String> params, RestRequest.Listener listener, RestRequest.ErrorListener errorListener) {<NEW_LINE>AppLog.v(T.TESTS, this.getClass() + ": makeRequest(" + url + ")");<NEW_LINE>RestRequest dummyReturnValue = new RestRequest(method, url, params, listener, errorListener);<NEW_LINE>// URL example: https://public-api.wordpress.com/rest/v1/me<NEW_LINE>// Filename: default-public-api-wordpress-com-rest-v1-me.json<NEW_LINE>String filename = mPrefix + "-" + url.replace("https://", "").replace("/", "-").replace(".", "-").replace("?", "-") + ".json";<NEW_LINE>if ("password-invalid".equals(mPrefix) && errorListener != null) {<NEW_LINE>errorListener.onErrorResponse(forgeVolleyErrorFromFilename(filename));<NEW_LINE>return dummyReturnValue;<NEW_LINE>}<NEW_LINE>if ("username-exists".equals(mPrefix) && errorListener != null) {<NEW_LINE>errorListener<MASK><NEW_LINE>return dummyReturnValue;<NEW_LINE>}<NEW_LINE>if ("timeout".equals(mPrefix) && errorListener != null) {<NEW_LINE>errorListener.onErrorResponse(forgeVolleyTimeoutError());<NEW_LINE>return dummyReturnValue;<NEW_LINE>}<NEW_LINE>if ("site-reserved".equals(mPrefix) && errorListener != null) {<NEW_LINE>errorListener.onErrorResponse(forgeVolleyErrorFromFilename(filename));<NEW_LINE>return dummyReturnValue;<NEW_LINE>}<NEW_LINE>String data = fileToString(filename);<NEW_LINE>if (data == null) {<NEW_LINE>AppLog.e(T.TESTS, "Can't read file: " + filename);<NEW_LINE>throw new RuntimeException("Can't read file: " + filename);<NEW_LINE>}<NEW_LINE>try {<NEW_LINE>JSONObject jsonObj = new JSONObject(data);<NEW_LINE>listener.onResponse(jsonObj);<NEW_LINE>} catch (JSONException je) {<NEW_LINE>AppLog.e(T.TESTS, je.toString());<NEW_LINE>}<NEW_LINE>return dummyReturnValue;<NEW_LINE>} | .onErrorResponse(forgeVolleyErrorFromFilename(filename)); |
379,629 | final DescribeDBParameterGroupsResult executeDescribeDBParameterGroups(DescribeDBParameterGroupsRequest describeDBParameterGroupsRequest) {<NEW_LINE>ExecutionContext executionContext = createExecutionContext(describeDBParameterGroupsRequest);<NEW_LINE>AWSRequestMetrics awsRequestMetrics = executionContext.getAwsRequestMetrics();<NEW_LINE>awsRequestMetrics.startEvent(Field.ClientExecuteTime);<NEW_LINE>Request<DescribeDBParameterGroupsRequest> request = null;<NEW_LINE>Response<DescribeDBParameterGroupsResult> response = null;<NEW_LINE>try {<NEW_LINE>awsRequestMetrics.startEvent(Field.RequestMarshallTime);<NEW_LINE>try {<NEW_LINE>request = new DescribeDBParameterGroupsRequestMarshaller().marshall(super.beforeMarshalling(describeDBParameterGroupsRequest));<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, "RDS");<NEW_LINE>request.addHandlerContext(HandlerContextKey.OPERATION_NAME, "DescribeDBParameterGroups");<NEW_LINE>request.addHandlerContext(HandlerContextKey.ADVANCED_CONFIG, advancedConfig);<NEW_LINE>} finally {<NEW_LINE>awsRequestMetrics.endEvent(Field.RequestMarshallTime);<NEW_LINE>}<NEW_LINE>StaxResponseHandler<DescribeDBParameterGroupsResult> responseHandler = new StaxResponseHandler<<MASK><NEW_LINE>response = invoke(request, responseHandler, executionContext);<NEW_LINE>return response.getAwsResponse();<NEW_LINE>} finally {<NEW_LINE>endClientExecution(awsRequestMetrics, request, response);<NEW_LINE>}<NEW_LINE>} | DescribeDBParameterGroupsResult>(new DescribeDBParameterGroupsResultStaxUnmarshaller()); |
1,041,888 | public Map<String, Object> createToken(User loginUser, int userId, String expireTime, String token) {<NEW_LINE>Map<String, Object> result = new HashMap<>();<NEW_LINE>// 1. check permission<NEW_LINE>if (!canOperator(loginUser, userId)) {<NEW_LINE>putMsg(result, Status.USER_NO_OPERATION_PERM);<NEW_LINE>return result;<NEW_LINE>}<NEW_LINE>// 2. check if user is existed<NEW_LINE>if (userId <= 0) {<NEW_LINE>throw new IllegalArgumentException("User id should not less than or equals to 0.");<NEW_LINE>}<NEW_LINE>// 3. generate access token if absent<NEW_LINE>if (StringUtils.isBlank(token)) {<NEW_LINE>token = EncryptionUtils.getMd5(userId + expireTime + System.currentTimeMillis());<NEW_LINE>}<NEW_LINE>// 4. persist to the database<NEW_LINE>AccessToken accessToken = new AccessToken();<NEW_LINE>accessToken.setUserId(userId);<NEW_LINE>accessToken.setExpireTime(DateUtils.stringToDate(expireTime));<NEW_LINE>accessToken.setToken(token);<NEW_LINE>accessToken.setCreateTime(new Date());<NEW_LINE>accessToken.setUpdateTime(new Date());<NEW_LINE>int insert = accessTokenMapper.insert(accessToken);<NEW_LINE>if (insert > 0) {<NEW_LINE>result.<MASK><NEW_LINE>putMsg(result, Status.SUCCESS);<NEW_LINE>} else {<NEW_LINE>putMsg(result, Status.CREATE_ACCESS_TOKEN_ERROR);<NEW_LINE>}<NEW_LINE>return result;<NEW_LINE>} | put(Constants.DATA_LIST, accessToken); |
1,460,113 | private void resolveMethod(@Nullable Context context, @NonNull String name) {<NEW_LINE>while (context != null) {<NEW_LINE>try {<NEW_LINE>if (!context.isRestricted()) {<NEW_LINE>final Method method = context.getClass().getMethod(mMethodName, BootstrapTextButton.class, boolean.class);<NEW_LINE>if (method != null) {<NEW_LINE>mResolvedMethod = method;<NEW_LINE>mResolvedContext = context;<NEW_LINE>return;<NEW_LINE>}<NEW_LINE>}<NEW_LINE>} catch (NoSuchMethodException e) {<NEW_LINE>// Failed to find method, keep searching up the hierarchy.<NEW_LINE>}<NEW_LINE>if (context instanceof ContextWrapper) {<NEW_LINE>context = ((ContextWrapper) context).getBaseContext();<NEW_LINE>} else {<NEW_LINE>// Can't search up the hierarchy, null out and fail.<NEW_LINE>context = null;<NEW_LINE>}<NEW_LINE>}<NEW_LINE>final <MASK><NEW_LINE>final String idText = id == NO_ID ? "" : " with id '" + mHostView.getContext().getResources().getResourceEntryName(id) + "'";<NEW_LINE>throw new IllegalStateException("Could not find method " + mMethodName + "(BootstrapCheckBox, boolean) in a parent or ancestor Context for app:onCheckedChanged " + "attribute defined on view " + mHostView.getClass() + idText);<NEW_LINE>} | int id = mHostView.getId(); |
1,601,309 | public String computeJavaDoc(CompletionProposal proposal) {<NEW_LINE>try {<NEW_LINE>IType type = unit.getJavaProject().findType(SignatureUtil.stripSignatureToFQN(String.valueOf(proposal.getDeclarationSignature())));<NEW_LINE>if (type != null) {<NEW_LINE>if (proposal instanceof InternalCompletionProposal) {<NEW_LINE>Binding binding = ((InternalCompletionProposal) proposal).getBinding();<NEW_LINE>if (binding instanceof MethodBinding) {<NEW_LINE>MethodBinding methodBinding = (MethodBinding) binding;<NEW_LINE>MethodBinding original = methodBinding.original();<NEW_LINE>char[] signature;<NEW_LINE>if (original != binding) {<NEW_LINE>signature = Engine.getSignature(original);<NEW_LINE>} else {<NEW_LINE>signature = Engine.getSignature(methodBinding);<NEW_LINE>}<NEW_LINE>String[] parameters = Signature.getParameterTypes(String.valueOf(fix83600(signature)));<NEW_LINE>for (int i = 0; i < parameters.length; i++) {<NEW_LINE>parameters[i] = getLowerBound(parameters[i]);<NEW_LINE>}<NEW_LINE>IMethod method = JavaModelUtil.findMethod(String.valueOf(proposal.getName()), parameters, proposal.isConstructor(), type);<NEW_LINE>if (method != null && method.exists()) {<NEW_LINE>ICompilationUnit unit = type.getCompilationUnit();<NEW_LINE>if (unit != null) {<NEW_LINE>unit.reconcile(ICompilationUnit.NO_AST, false, null, null);<NEW_LINE>}<NEW_LINE>String javadoc = null;<NEW_LINE>try {<NEW_LINE>javadoc = SimpleTimeLimiter.create(Executors.newCachedThreadPool()).callWithTimeout(() -> {<NEW_LINE>Reader reader = JavadocContentAccess.getPlainTextContentReader(method);<NEW_LINE>return reader == null ? null : CharStreams.toString(reader);<NEW_LINE><MASK><NEW_LINE>} catch (UncheckedTimeoutException tooSlow) {<NEW_LINE>} catch (Exception e) {<NEW_LINE>JavaLanguageServerPlugin.logException("Unable to read documentation", e);<NEW_LINE>}<NEW_LINE>return javadoc;<NEW_LINE>}<NEW_LINE>}<NEW_LINE>}<NEW_LINE>}<NEW_LINE>} catch (JavaModelException e) {<NEW_LINE>JavaLanguageServerPlugin.logException("Unable to resolve signaturehelp javadoc", e);<NEW_LINE>}<NEW_LINE>return null;<NEW_LINE>} | }, 500, TimeUnit.MILLISECONDS); |
150,476 | private void writeClass(SmaliWriter smali, ClassNode cls) {<NEW_LINE>IClassData clsData = cls.getClsData();<NEW_LINE>if (clsData == null) {<NEW_LINE>smali.startLine(String.format("###### Class %s is created by jadx", cls.getFullName()));<NEW_LINE>return;<NEW_LINE>}<NEW_LINE>AttributeStorage attributes = new AttributeStorage();<NEW_LINE>attributes.add(clsData.getAttributes());<NEW_LINE>smali.startLine("Class: " + clsData.getType()).startLine("AccessFlags: " + AccessFlags.format(clsData.getAccessFlags(), AccessFlagsScope.CLASS)).startLine("SuperType: " + clsData.getSuperType()).startLine("Interfaces: " + clsData.getInterfacesTypes()).startLine("SourceFile: " + attributes<MASK><NEW_LINE>AnnotationsAttr annotationsAttr = attributes.get(JadxAttrType.ANNOTATION_LIST);<NEW_LINE>if (annotationsAttr != null) {<NEW_LINE>Collection<IAnnotation> annos = annotationsAttr.getList();<NEW_LINE>if (!annos.isEmpty()) {<NEW_LINE>smali.startLine(String.format("# %d annotations", annos.size()));<NEW_LINE>writeAnnotations(smali, new ArrayList<>(annos));<NEW_LINE>smali.startLine();<NEW_LINE>}<NEW_LINE>}<NEW_LINE>List<RawField> fields = new ArrayList<>();<NEW_LINE>// first is access flag, second is name<NEW_LINE>int[] colWidths = new int[] { 0, 0 };<NEW_LINE>int[] mthIndex = new int[] { 0 };<NEW_LINE>LineInfo line = new LineInfo();<NEW_LINE>clsData.visitFieldsAndMethods(f -> {<NEW_LINE>RawField fld = RawField.make(f);<NEW_LINE>fields.add(fld);<NEW_LINE>if (fld.accessFlag.length() > colWidths[0]) {<NEW_LINE>colWidths[0] = fld.accessFlag.length();<NEW_LINE>}<NEW_LINE>if (fld.name.length() > colWidths[1]) {<NEW_LINE>colWidths[1] = fld.name.length();<NEW_LINE>}<NEW_LINE>}, m -> {<NEW_LINE>if (!fields.isEmpty()) {<NEW_LINE>writeFields(smali, clsData, fields, colWidths);<NEW_LINE>fields.clear();<NEW_LINE>}<NEW_LINE>writeMethod(smali, cls.getMethods().get(mthIndex[0]++), m, line);<NEW_LINE>line.reset();<NEW_LINE>});<NEW_LINE>if (!fields.isEmpty()) {<NEW_LINE>// in case there's no methods.<NEW_LINE>writeFields(smali, clsData, fields, colWidths);<NEW_LINE>}<NEW_LINE>for (ClassNode innerClass : cls.getInnerClasses()) {<NEW_LINE>writeClass(smali, innerClass);<NEW_LINE>}<NEW_LINE>} | .get(JadxAttrType.SOURCE_FILE)); |
1,327,084 | private static ObjectParser<TreeNode.Builder, Void> createParser(boolean lenient) {<NEW_LINE>ObjectParser<TreeNode.Builder, Void> parser = new ObjectParser<>(NAME, lenient, TreeNode.Builder::new);<NEW_LINE>parser.declareDouble(TreeNode.Builder::setThreshold, THRESHOLD);<NEW_LINE>parser.declareField(TreeNode.Builder::setOperator, p -> Operator.fromString(p.text()), DECISION_TYPE, ObjectParser.ValueType.STRING);<NEW_LINE>parser.declareInt(TreeNode.Builder::setLeftChild, LEFT_CHILD);<NEW_LINE>parser.declareInt(TreeNode.Builder::setRightChild, RIGHT_CHILD);<NEW_LINE>parser.declareBoolean(<MASK><NEW_LINE>parser.declareInt(TreeNode.Builder::setSplitFeature, SPLIT_FEATURE);<NEW_LINE>parser.declareInt(TreeNode.Builder::setNodeIndex, NODE_INDEX);<NEW_LINE>parser.declareDouble(TreeNode.Builder::setSplitGain, SPLIT_GAIN);<NEW_LINE>parser.declareDoubleArray(TreeNode.Builder::setLeafValue, LEAF_VALUE);<NEW_LINE>parser.declareLong(TreeNode.Builder::setNumberSamples, NUMBER_SAMPLES);<NEW_LINE>return parser;<NEW_LINE>} | TreeNode.Builder::setDefaultLeft, DEFAULT_LEFT); |
878,822 | public Object evaluate(EditorAdaptor vim, Queue<String> command) {<NEW_LINE>String lhs = command.poll();<NEW_LINE>String rhs = "";<NEW_LINE>while (!command.isEmpty()) {<NEW_LINE>// restore spaces between extra parameters<NEW_LINE>rhs += command.poll() + " ";<NEW_LINE>}<NEW_LINE>if (lhs != null && !"".equals(rhs)) {<NEW_LINE>boolean useRecursive = recursive;<NEW_LINE>// Simple prefix maps are non-recursive, e.g. nmap n nzz - Vim detects this as well.<NEW_LINE>if (recursive && rhs.startsWith(lhs)) {<NEW_LINE>useRecursive = false;<NEW_LINE>vim.getUserInterfaceService().<MASK><NEW_LINE>}<NEW_LINE>String mapLeader = vim.getConfiguration().get(Options.MAPLEADER);<NEW_LINE>List<KeyStroke> leaderKeys = new ArrayList<KeyStroke>();<NEW_LINE>for (KeyStroke keystroke : parseKeyStrokes(mapLeader)) {<NEW_LINE>leaderKeys.add(keystroke);<NEW_LINE>}<NEW_LINE>rhs = rhs.trim();<NEW_LINE>Iterable<KeyStroke> lhsKeyStrokes = replaceLeader(parseKeyStrokes(lhs), leaderKeys);<NEW_LINE>Iterable<KeyStroke> rhsKeyStrokes = replaceLeader(parseKeyStrokes(rhs), leaderKeys);<NEW_LINE>for (String name : keymaps) {<NEW_LINE>KeyMap map = vim.getKeyMapProvider().getKeyMap(name);<NEW_LINE>map.addMapping(lhsKeyStrokes, new SimpleRemapping(rhsKeyStrokes, useRecursive));<NEW_LINE>}<NEW_LINE>}<NEW_LINE>return null;<NEW_LINE>} | setInfoMessage("Changing recursive remap '" + lhs + "' to non-recursive."); |
1,096,029 | public AssumeRoleResult unmarshall(StaxUnmarshallerContext context) throws Exception {<NEW_LINE>AssumeRoleResult assumeRoleResult = new AssumeRoleResult();<NEW_LINE><MASK><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 assumeRoleResult;<NEW_LINE>if (xmlEvent.isAttribute() || xmlEvent.isStartElement()) {<NEW_LINE>if (context.testExpression("Credentials", targetDepth)) {<NEW_LINE>assumeRoleResult.setCredentials(CredentialsStaxUnmarshaller.getInstance().unmarshall(context));<NEW_LINE>continue;<NEW_LINE>}<NEW_LINE>if (context.testExpression("AssumedRoleUser", targetDepth)) {<NEW_LINE>assumeRoleResult.setAssumedRoleUser(AssumedRoleUserStaxUnmarshaller.getInstance().unmarshall(context));<NEW_LINE>continue;<NEW_LINE>}<NEW_LINE>if (context.testExpression("PackedPolicySize", targetDepth)) {<NEW_LINE>assumeRoleResult.setPackedPolicySize(IntegerStaxUnmarshaller.getInstance().unmarshall(context));<NEW_LINE>continue;<NEW_LINE>}<NEW_LINE>if (context.testExpression("SourceIdentity", targetDepth)) {<NEW_LINE>assumeRoleResult.setSourceIdentity(StringStaxUnmarshaller.getInstance().unmarshall(context));<NEW_LINE>continue;<NEW_LINE>}<NEW_LINE>} else if (xmlEvent.isEndElement()) {<NEW_LINE>if (context.getCurrentDepth() < originalDepth) {<NEW_LINE>return assumeRoleResult;<NEW_LINE>}<NEW_LINE>}<NEW_LINE>}<NEW_LINE>} | int originalDepth = context.getCurrentDepth(); |
829,050 | private static void runAssertionIn(RegressionEnvironment env, RegressionPath path) {<NEW_LINE>tryAssertionIn(env, path, "theString in ('E2', 'E3') and intPrimitive in (10, 20)", new Long[] { 200L });<NEW_LINE>tryAssertionIn(env, path, "intPrimitive in (30, 20) and theString in ('E4', 'E1')", new Long[] {});<NEW_LINE>tryAssertionIn(env, path, "intPrimitive in (30, 20) and theString in ('E2', 'E1')", <MASK><NEW_LINE>tryAssertionIn(env, path, "theString in ('E2', 'E3') and intPrimitive in (20, 30)", new Long[] { 200L, 300L });<NEW_LINE>tryAssertionIn(env, path, "theString in ('E2', 'E3') and intPrimitive in (30, 20)", new Long[] { 200L, 300L });<NEW_LINE>tryAssertionIn(env, path, "theString in ('E1', 'E2', 'E3', 'E4') and intPrimitive in (10, 20, 30)", new Long[] { 100L, 200L, 300L });<NEW_LINE>} | new Long[] { 200L }); |
1,216,180 | public Object execute(ODistributedRequestId requestId, OServer iServer, ODistributedServerManager iManager, ODatabaseDocumentInternal database) throws Exception {<NEW_LINE>ODistributedDatabase db = iManager.getMessageService().getDatabase(database.getName());<NEW_LINE>db.checkReverseSync(lastState);<NEW_LINE>List<OTransactionId> missing = db.missingTransactions(lastState);<NEW_LINE>if (!missing.isEmpty()) {<NEW_LINE>Optional<OBackgroundNewDelta> delta = ((OAbstractPaginatedStorage) database.getStorage()).extractTransactionsFromWal(missing);<NEW_LINE>if (delta.isPresent()) {<NEW_LINE>((ODistributedDatabaseImpl) db).setLastValidBackup(delta.get());<NEW_LINE>return new ONewDeltaTaskResponse(new ODistributedDatabaseChunk(delta.get(), CHUNK_MAX_SIZE));<NEW_LINE>} else {<NEW_LINE>return new ONewDeltaTaskResponse(ONewDeltaTaskResponse.ResponseType.FULL_SYNC);<NEW_LINE>}<NEW_LINE>} else {<NEW_LINE>return new <MASK><NEW_LINE>}<NEW_LINE>} | ONewDeltaTaskResponse(ONewDeltaTaskResponse.ResponseType.NO_CHANGES); |
1,646,264 | public void stateMachineJoined(final StateMachine<S, E> stateMachine, final StateMachineContext<S, E> context) {<NEW_LINE>if (log.isDebugEnabled()) {<NEW_LINE>log.debug("Event stateMachineJoined stateMachine=[" + stateMachine + "] context=[" + context + "]");<NEW_LINE>}<NEW_LINE>if (stateMachine != null && stateMachine == DistributedStateMachine.this) {<NEW_LINE>delegate<MASK><NEW_LINE>setStateMachineError(null);<NEW_LINE>if (context != null) {<NEW_LINE>// I'm now successfully joined, so set delegating<NEW_LINE>// sm to current known state by a context.<NEW_LINE>if (log.isDebugEnabled()) {<NEW_LINE>log.debug("Joining with context " + context);<NEW_LINE>}<NEW_LINE>delegate.getStateMachineAccessor().doWithAllRegions(function -> function.resetStateMachineReactively(context).block());<NEW_LINE>}<NEW_LINE>log.info("Requesting to start delegating state machine " + delegate);<NEW_LINE>log.info("Delegating machine id " + delegate.getUuid());<NEW_LINE>delegate.startReactively().block();<NEW_LINE>}<NEW_LINE>} | .stopReactively().block(); |
1,474,434 | final CreateVpcEndpointConnectionNotificationResult executeCreateVpcEndpointConnectionNotification(CreateVpcEndpointConnectionNotificationRequest createVpcEndpointConnectionNotificationRequest) {<NEW_LINE>ExecutionContext executionContext = createExecutionContext(createVpcEndpointConnectionNotificationRequest);<NEW_LINE>AWSRequestMetrics awsRequestMetrics = executionContext.getAwsRequestMetrics();<NEW_LINE>awsRequestMetrics.startEvent(Field.ClientExecuteTime);<NEW_LINE>Request<CreateVpcEndpointConnectionNotificationRequest> request = null;<NEW_LINE>Response<CreateVpcEndpointConnectionNotificationResult> response = null;<NEW_LINE>try {<NEW_LINE>awsRequestMetrics.startEvent(Field.RequestMarshallTime);<NEW_LINE>try {<NEW_LINE>request = new CreateVpcEndpointConnectionNotificationRequestMarshaller().marshall(super.beforeMarshalling(createVpcEndpointConnectionNotificationRequest));<NEW_LINE>// Binds the request metrics to the current request.<NEW_LINE>request.setAWSRequestMetrics(awsRequestMetrics);<NEW_LINE>request.addHandlerContext(HandlerContextKey.CLIENT_ENDPOINT, endpoint);<NEW_LINE>request.addHandlerContext(HandlerContextKey.ENDPOINT_OVERRIDDEN, isEndpointOverridden());<NEW_LINE>request.addHandlerContext(<MASK><NEW_LINE>request.addHandlerContext(HandlerContextKey.SERVICE_ID, "EC2");<NEW_LINE>request.addHandlerContext(HandlerContextKey.OPERATION_NAME, "CreateVpcEndpointConnectionNotification");<NEW_LINE>request.addHandlerContext(HandlerContextKey.ADVANCED_CONFIG, advancedConfig);<NEW_LINE>} finally {<NEW_LINE>awsRequestMetrics.endEvent(Field.RequestMarshallTime);<NEW_LINE>}<NEW_LINE>StaxResponseHandler<CreateVpcEndpointConnectionNotificationResult> responseHandler = new StaxResponseHandler<CreateVpcEndpointConnectionNotificationResult>(new CreateVpcEndpointConnectionNotificationResultStaxUnmarshaller());<NEW_LINE>response = invoke(request, responseHandler, executionContext);<NEW_LINE>return response.getAwsResponse();<NEW_LINE>} finally {<NEW_LINE>endClientExecution(awsRequestMetrics, request, response);<NEW_LINE>}<NEW_LINE>} | HandlerContextKey.SIGNING_REGION, getSigningRegion()); |
1,274,635 | protected void updateZoneInfo() {<NEW_LINE>Map<String, String> result = service.invokeAction(this, "DeviceProperties", "GetZoneInfo", null);<NEW_LINE>Map<String, String> result2 = service.invokeAction(this, "DeviceProperties", "GetZoneAttributes", null);<NEW_LINE>result.putAll(result2);<NEW_LINE>for (String variable : result.keySet()) {<NEW_LINE>this.onValueReceived(variable, result.get(variable), "DeviceProperties");<NEW_LINE>}<NEW_LINE>Map<String, String> properties = editProperties();<NEW_LINE>boolean update = false;<NEW_LINE>if (StringUtils.isNotEmpty(this.stateMap.get("HardwareVersion")) && !this.stateMap.get("HardwareVersion").equals(properties.get(Thing.PROPERTY_HARDWARE_VERSION))) {<NEW_LINE>update = true;<NEW_LINE>properties.put(Thing.PROPERTY_HARDWARE_VERSION, this.stateMap.get("HardwareVersion"));<NEW_LINE>}<NEW_LINE>if (StringUtils.isNotEmpty(this.stateMap.get("DisplaySoftwareVersion")) && !this.stateMap.get("DisplaySoftwareVersion").equals(properties.get(Thing.PROPERTY_FIRMWARE_VERSION))) {<NEW_LINE>update = true;<NEW_LINE>properties.put(Thing.PROPERTY_FIRMWARE_VERSION, this.stateMap.get("DisplaySoftwareVersion"));<NEW_LINE>}<NEW_LINE>if (StringUtils.isNotEmpty(this.stateMap.get("SerialNumber")) && !this.stateMap.get("SerialNumber").equals(properties.get(Thing.PROPERTY_SERIAL_NUMBER))) {<NEW_LINE>update = true;<NEW_LINE>properties.put(Thing.PROPERTY_SERIAL_NUMBER, this<MASK><NEW_LINE>}<NEW_LINE>if (StringUtils.isNotEmpty(this.stateMap.get("MACAddress")) && !this.stateMap.get("MACAddress").equals(properties.get(MAC_ADDRESS))) {<NEW_LINE>update = true;<NEW_LINE>properties.put(MAC_ADDRESS, this.stateMap.get("MACAddress"));<NEW_LINE>}<NEW_LINE>if (StringUtils.isNotEmpty(this.stateMap.get("IPAddress")) && !this.stateMap.get("IPAddress").equals(properties.get(IP_ADDRESS))) {<NEW_LINE>update = true;<NEW_LINE>properties.put(IP_ADDRESS, this.stateMap.get("IPAddress"));<NEW_LINE>}<NEW_LINE>if (update) {<NEW_LINE>updateProperties(properties);<NEW_LINE>}<NEW_LINE>} | .stateMap.get("SerialNumber")); |
1,694,700 | public EncryptedData encrypt(byte[] plainBytes, KeyParameter key) {<NEW_LINE>checkNotNull(plainBytes);<NEW_LINE>checkNotNull(key);<NEW_LINE>try {<NEW_LINE>// Generate iv - each encryption call has a different iv.<NEW_LINE>byte[] iv = new byte[BLOCK_LENGTH];<NEW_LINE>secureRandom.nextBytes(iv);<NEW_LINE>ParametersWithIV keyWithIv = new ParametersWithIV(key, iv);<NEW_LINE>// Encrypt using AES.<NEW_LINE>BufferedBlockCipher cipher = new PaddedBufferedBlockCipher(new CBCBlockCipher(new AESEngine()));<NEW_LINE>cipher.init(true, keyWithIv);<NEW_LINE>byte[] encryptedBytes = new byte[cipher<MASK><NEW_LINE>final int length1 = cipher.processBytes(plainBytes, 0, plainBytes.length, encryptedBytes, 0);<NEW_LINE>final int length2 = cipher.doFinal(encryptedBytes, length1);<NEW_LINE>return new EncryptedData(iv, Arrays.copyOf(encryptedBytes, length1 + length2));<NEW_LINE>} catch (Exception e) {<NEW_LINE>throw new KeyCrypterException("Could not encrypt bytes.", e);<NEW_LINE>}<NEW_LINE>} | .getOutputSize(plainBytes.length)]; |
1,356,131 | final DisableKeyResult executeDisableKey(DisableKeyRequest disableKeyRequest) {<NEW_LINE>ExecutionContext executionContext = createExecutionContext(disableKeyRequest);<NEW_LINE>AWSRequestMetrics awsRequestMetrics = executionContext.getAwsRequestMetrics();<NEW_LINE>awsRequestMetrics.startEvent(Field.ClientExecuteTime);<NEW_LINE>Request<DisableKeyRequest> request = null;<NEW_LINE>Response<DisableKeyResult> response = null;<NEW_LINE>try {<NEW_LINE>awsRequestMetrics.startEvent(Field.RequestMarshallTime);<NEW_LINE>try {<NEW_LINE>request = new DisableKeyRequestProtocolMarshaller(protocolFactory).marshall(super.beforeMarshalling(disableKeyRequest));<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, "KMS");<NEW_LINE>request.addHandlerContext(HandlerContextKey.OPERATION_NAME, "DisableKey");<NEW_LINE>request.addHandlerContext(HandlerContextKey.ADVANCED_CONFIG, advancedConfig);<NEW_LINE>} finally {<NEW_LINE>awsRequestMetrics.endEvent(Field.RequestMarshallTime);<NEW_LINE>}<NEW_LINE>HttpResponseHandler<AmazonWebServiceResponse<DisableKeyResult>> responseHandler = protocolFactory.createResponseHandler(new JsonOperationMetadata().withPayloadJson(true).withHasStreamingSuccessResponse(false), new DisableKeyResultJsonUnmarshaller());<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,060,646 | public byte[] convertValueToWireFormat(ConsumerRecord<byte[], byte[]> record, SchemaRegistryClient registryClient, SchemaRegistryType schemaRegistryType) {<NEW_LINE>byte magicByte = 0x0;<NEW_LINE>if (schemaRegistryType == SchemaRegistryType.TIBCO) {<NEW_LINE>magicByte = (byte) 0x80;<NEW_LINE>}<NEW_LINE>Iterator<Header> contentTypeIter = record.headers().headers("contentType").iterator();<NEW_LINE>byte[] value = record.value();<NEW_LINE>if (contentTypeIter.hasNext() && value.length > 0 && ByteBuffer.wrap(value).get() != magicByte) {<NEW_LINE>String headerValue = new String(contentTypeIter.next().value());<NEW_LINE>Matcher matcher = AVRO_CONTENT_TYPE_PATTERN.matcher(headerValue);<NEW_LINE>if (matcher.matches()) {<NEW_LINE>String subject = matcher.group(1);<NEW_LINE>int version = Integer.parseInt(matcher.group(2));<NEW_LINE>value = prependWireFormatHeader(value, <MASK><NEW_LINE>}<NEW_LINE>}<NEW_LINE>return value;<NEW_LINE>} | registryClient, subject, version, magicByte); |
371,277 | protected boolean supportsViewFor(Application app) {<NEW_LINE>if (!(ApplicationTypeFactory.getApplicationTypeFor(app) instanceof GlassFishApplicationType))<NEW_LINE>return false;<NEW_LINE>final JmxModel model = JmxModelFactory.getJmxModelFor(app);<NEW_LINE>if (model == null) {<NEW_LINE>return false;<NEW_LINE>}<NEW_LINE>DomainRoot dr = AMXUtil.getDomainRoot(model);<NEW_LINE>if (dr == null) {<NEW_LINE>return false;<NEW_LINE>}<NEW_LINE>final Map<String, ServerRootMonitor> serverMonitors = dr<MASK><NEW_LINE>final String serverName = JMXUtil.getServerName(model);<NEW_LINE>if (serverMonitors.get(serverName) == null) {<NEW_LINE>return false;<NEW_LINE>}<NEW_LINE>HTTPServiceMonitor httpMonitor = serverMonitors.get(serverName).getHTTPServiceMonitor();<NEW_LINE>ModuleMonitoringLevelsConfig monitorConfig = AMXUtil.getMonitoringConfig(model);<NEW_LINE>if (!monitorConfig.getHTTPService().equals(ModuleMonitoringLevelValues.OFF)) {<NEW_LINE>return httpMonitor != null;<NEW_LINE>}<NEW_LINE>return false;<NEW_LINE>} | .getMonitoringRoot().getServerRootMonitorMap(); |
218,161 | private void disableFormattingExclusively(int openingTagIndex, int closingTagIndex) {<NEW_LINE>Token openingTag = <MASK><NEW_LINE>int noFormatStart = openingTag.originalEnd + 1;<NEW_LINE>int noFormatEnd = this.ctm.get(closingTagIndex - 1).originalEnd;<NEW_LINE>if (noFormatStart <= noFormatEnd) {<NEW_LINE>Token noFormatToken = new Token(noFormatStart, noFormatEnd, TokenNameCOMMENT_JAVADOC);<NEW_LINE>List<Token> lines = commentToLines(noFormatToken, findCommentLineIndent(openingTagIndex));<NEW_LINE>for (Token line : lines) line.setToEscape(true);<NEW_LINE>fixJavadocTagAlign(openingTag, closingTagIndex);<NEW_LINE>List<Token> tokensToReplace = this.commentStructure.subList(openingTagIndex + 1, closingTagIndex);<NEW_LINE>tokensToReplace.clear();<NEW_LINE>tokensToReplace.addAll(lines);<NEW_LINE>} else {<NEW_LINE>this.commentStructure.subList(openingTagIndex + 1, closingTagIndex).clear();<NEW_LINE>Token closingTag = this.ctm.get(closingTagIndex);<NEW_LINE>if (this.ctm.countLineBreaksBetween(openingTag, closingTag) == 0) {<NEW_LINE>openingTag.clearLineBreaksAfter();<NEW_LINE>closingTag.clearLineBreaksBefore();<NEW_LINE>}<NEW_LINE>}<NEW_LINE>} | this.ctm.get(openingTagIndex); |
416,913 | private void writeSAMfilesForUnknown(final String outputPrefix, final JavaRDD<GATKRead> assemblyRawAlignments, final SAMFileHeader header) {<NEW_LINE>final Map<String, ReasonForAlignmentClassificationFailure> tigNameToReason = unknown.mapToPair(tig -> new Tuple2<>(tig.getContigName(), tig.getReasonForAlignmentClassificationFailure())).collectAsMap();<NEW_LINE>final Set<String> namesOfInterest = new HashSet<>(tigNameToReason.keySet());<NEW_LINE>final List<GATKRead> contigRawAlignments = new ArrayList<>(assemblyRawAlignments.filter(read -> namesOfInterest.contains(read.getName())).collect());<NEW_LINE>contigRawAlignments.sort(Comparator<MASK><NEW_LINE>final SAMFileHeader clone = header.clone();<NEW_LINE>clone.setSortOrder(SAMFileHeader.SortOrder.queryname);<NEW_LINE>final EnumMap<ReasonForAlignmentClassificationFailure, SAMFileWriter> writerForEachCase = new EnumMap<>(ReasonForAlignmentClassificationFailure.class);<NEW_LINE>final SAMFileWriterFactory factory = new SAMFileWriterFactory().setCreateIndex(true);<NEW_LINE>writerForEachCase.put(ReasonForAlignmentClassificationFailure.AMBIGUOUS, factory.makeSAMOrBAMWriter(clone, true, IOUtils.getPath(outputPrefix + ReasonForAlignmentClassificationFailure.AMBIGUOUS.name() + ".bam")));<NEW_LINE>writerForEachCase.put(ReasonForAlignmentClassificationFailure.INCOMPLETE, factory.makeSAMOrBAMWriter(clone, true, IOUtils.getPath(outputPrefix + ReasonForAlignmentClassificationFailure.INCOMPLETE.name() + ".bam")));<NEW_LINE>writerForEachCase.put(ReasonForAlignmentClassificationFailure.UNINFORMATIVE, factory.makeSAMOrBAMWriter(clone, true, IOUtils.getPath(outputPrefix + ReasonForAlignmentClassificationFailure.UNINFORMATIVE.name() + ".bam")));<NEW_LINE>contigRawAlignments.forEach(read -> {<NEW_LINE>final ReasonForAlignmentClassificationFailure reason = tigNameToReason.get(read.getName());<NEW_LINE>writerForEachCase.get(reason).addAlignment(read.convertToSAMRecord(header));<NEW_LINE>});<NEW_LINE>writerForEachCase.values().forEach(SAMFileWriter::close);<NEW_LINE>} | .comparing(GATKRead::getName)); |
1,145,338 | private static com.yahoo.jdisc.Request createDiscRequest(Request request, CurrentContainer currentContainer) {<NEW_LINE>String scheme = getScheme(request.getUri());<NEW_LINE>com.yahoo.jdisc.Request discRequest;<NEW_LINE>if ("http".equals(scheme) || "https".equals(scheme)) {<NEW_LINE>com.yahoo.jdisc.http.HttpRequest httpRequest = com.yahoo.jdisc.http.HttpRequest.newServerRequest(currentContainer, URI.create(request.getUri()), com.yahoo.jdisc.http.HttpRequest.Method.valueOf(request.getMethod().name()));<NEW_LINE>request.getUserPrincipal().ifPresent(httpRequest::setUserPrincipal);<NEW_LINE>discRequest = httpRequest;<NEW_LINE>} else {<NEW_LINE>discRequest = new com.yahoo.jdisc.Request(currentContainer, URI.create(request.getUri()));<NEW_LINE>}<NEW_LINE>for (Map.Entry<String, List<String>> entry : request.getHeaders().entrySet()) {<NEW_LINE>discRequest.headers().add(entry.getKey(<MASK><NEW_LINE>}<NEW_LINE>discRequest.context().putAll(request.getAttributes());<NEW_LINE>return discRequest;<NEW_LINE>} | ), entry.getValue()); |
382,370 | private void doSearchV2(boolean searchByTask, SearchPb.Request req, StreamObserver<WorkflowServicePb.WorkflowSearchResult> response) {<NEW_LINE>final int start = req.getStart();<NEW_LINE>final int size = GRPC_HELPER.optionalOr(req.getSize(), maxSearchSize);<NEW_LINE>final List<String> sort = convertSort(req.getSort());<NEW_LINE>final String freeText = GRPC_HELPER.optionalOr(<MASK><NEW_LINE>final String query = req.getQuery();<NEW_LINE>if (size > maxSearchSize) {<NEW_LINE>response.onError(Status.INVALID_ARGUMENT.withDescription("Cannot return more than " + maxSearchSize + " results").asRuntimeException());<NEW_LINE>return;<NEW_LINE>}<NEW_LINE>SearchResult<Workflow> search;<NEW_LINE>if (searchByTask) {<NEW_LINE>search = workflowService.searchWorkflowsByTasksV2(start, size, sort, freeText, query);<NEW_LINE>} else {<NEW_LINE>search = workflowService.searchWorkflowsV2(start, size, sort, freeText, query);<NEW_LINE>}<NEW_LINE>response.onNext(WorkflowServicePb.WorkflowSearchResult.newBuilder().setTotalHits(search.getTotalHits()).addAllResults(search.getResults().stream().map(PROTO_MAPPER::toProto)::iterator).build());<NEW_LINE>response.onCompleted();<NEW_LINE>} | req.getFreeText(), "*"); |
1,145,340 | private SegmentZKMetadata updateCommittingSegmentZKMetadata(String realtimeTableName, CommittingSegmentDescriptor committingSegmentDescriptor) {<NEW_LINE>String segmentName = committingSegmentDescriptor.getSegmentName();<NEW_LINE>LOGGER.info("Updating segment ZK metadata for committing segment: {}", segmentName);<NEW_LINE>Stat stat = new Stat();<NEW_LINE>SegmentZKMetadata committingSegmentZKMetadata = <MASK><NEW_LINE>Preconditions.checkState(committingSegmentZKMetadata.getStatus() == Status.IN_PROGRESS, "Segment status for segment: %s should be IN_PROGRESS, found: %s", segmentName, committingSegmentZKMetadata.getStatus());<NEW_LINE>SegmentMetadataImpl segmentMetadata = committingSegmentDescriptor.getSegmentMetadata();<NEW_LINE>Preconditions.checkState(segmentMetadata != null, "Failed to find segment metadata from descriptor for segment: %s", segmentName);<NEW_LINE>// TODO Issue 5953 remove the long parsing once metadata is set correctly.<NEW_LINE>committingSegmentZKMetadata.setEndOffset(committingSegmentDescriptor.getNextOffset());<NEW_LINE>committingSegmentZKMetadata.setStatus(Status.DONE);<NEW_LINE>// If the download url set by the server is a peer download url format with peer scheme, put<NEW_LINE>// METADATA_URI_FOR_PEER_DOWNLOAD in zk; otherwise just use the location in the descriptor.<NEW_LINE>committingSegmentZKMetadata.setDownloadUrl(isPeerURL(committingSegmentDescriptor.getSegmentLocation()) ? CommonConstants.Segment.METADATA_URI_FOR_PEER_DOWNLOAD : committingSegmentDescriptor.getSegmentLocation());<NEW_LINE>committingSegmentZKMetadata.setCrc(Long.valueOf(segmentMetadata.getCrc()));<NEW_LINE>if (segmentMetadata.getTotalDocs() > 0) {<NEW_LINE>Preconditions.checkNotNull(segmentMetadata.getTimeInterval(), "start/end time information is not correctly written to the segment for table: " + realtimeTableName);<NEW_LINE>committingSegmentZKMetadata.setStartTime(segmentMetadata.getTimeInterval().getStartMillis());<NEW_LINE>committingSegmentZKMetadata.setEndTime(segmentMetadata.getTimeInterval().getEndMillis());<NEW_LINE>} else {<NEW_LINE>// Set current time as start/end time if total docs is 0<NEW_LINE>long now = System.currentTimeMillis();<NEW_LINE>committingSegmentZKMetadata.setStartTime(now);<NEW_LINE>committingSegmentZKMetadata.setEndTime(now);<NEW_LINE>}<NEW_LINE>committingSegmentZKMetadata.setTimeUnit(TimeUnit.MILLISECONDS);<NEW_LINE>SegmentVersion segmentVersion = segmentMetadata.getVersion();<NEW_LINE>if (segmentVersion != null) {<NEW_LINE>committingSegmentZKMetadata.setIndexVersion(segmentVersion.name());<NEW_LINE>}<NEW_LINE>committingSegmentZKMetadata.setTotalDocs(segmentMetadata.getTotalDocs());<NEW_LINE>// Update the partition group metadata based on the segment metadata<NEW_LINE>// NOTE: When the stream partition changes, or the records are not properly partitioned from the stream, the<NEW_LINE>// partition of the segment (based on the actual consumed records) can be different from the stream partition.<NEW_LINE>committingSegmentZKMetadata.setPartitionMetadata(getPartitionMetadataFromSegmentMetadata(segmentMetadata));<NEW_LINE>persistSegmentZKMetadata(realtimeTableName, committingSegmentZKMetadata, stat.getVersion());<NEW_LINE>return committingSegmentZKMetadata;<NEW_LINE>} | getSegmentZKMetadata(realtimeTableName, segmentName, stat); |
919,078 | void refreshUI(UserPreferences prefs) {<NEW_LINE>IPreferenceStore store = propertyPage.getPreferenceStore();<NEW_LINE>scariestRankCombo.setText(MarkerSeverity.get(store.getString(FindBugsConstants.RANK_SCARIEST_MARKER_SEVERITY)).name());<NEW_LINE>scaryRankCombo.setText(MarkerSeverity.get(store.getString(FindBugsConstants.RANK_SCARY_MARKER_SEVERITY)).name());<NEW_LINE>troublingRankCombo.setText(MarkerSeverity.get(store.getString(FindBugsConstants.RANK_TROUBLING_MARKER_SEVERITY)).name());<NEW_LINE>ofConcernRankCombo.setText(MarkerSeverity.get(store.getString(FindBugsConstants.RANK_OFCONCERN_MARKER_SEVERITY)).name());<NEW_LINE><MASK><NEW_LINE>minRankSlider.setSelection(filterSettings.getMinRank());<NEW_LINE>updateRankValueLabel();<NEW_LINE>minPriorityCombo.setText(filterSettings.getMinPriority());<NEW_LINE>for (Button checkBox : chkEnableBugCategoryList) {<NEW_LINE>checkBox.setSelection(filterSettings.containsCategory((String) checkBox.getData()));<NEW_LINE>}<NEW_LINE>syncSelectedCategories();<NEW_LINE>} | ProjectFilterSettings filterSettings = prefs.getFilterSettings(); |
827,123 | protected synchronized void startOptimisation(EnergyOptimisationAsset optimisationAsset) {<NEW_LINE>LOG.fine("Initialising optimiser for optimisation asset: " + optimisationAsset);<NEW_LINE>double intervalSize = optimisationAsset.getIntervalSize().orElse(0.25d);<NEW_LINE>int financialWeighting = optimisationAsset.getFinancialWeighting().orElse(100);<NEW_LINE>try {<NEW_LINE>EnergyOptimiser optimiser = new EnergyOptimiser(intervalSize, ((double) financialWeighting) / 100);<NEW_LINE>long periodSeconds = (long) (<MASK><NEW_LINE>if (periodSeconds < 300) {<NEW_LINE>throw new IllegalStateException("Optimiser interval size is too small (minimum is 5 mins) for asset: " + optimisationAsset.getId());<NEW_LINE>}<NEW_LINE>long currentMillis = timerService.getCurrentTimeMillis();<NEW_LINE>Instant optimisationStartTime = getOptimisationStartTime(currentMillis, periodSeconds);<NEW_LINE>// Schedule subsequent runs<NEW_LINE>long offsetSeconds = (long) (Math.random() * 30) + periodSeconds;<NEW_LINE>Duration startDuration = Duration.between(Instant.ofEpochMilli(currentMillis), optimisationStartTime.plus(offsetSeconds, ChronoUnit.SECONDS));<NEW_LINE>ScheduledFuture<?> optimisationFuture = scheduleOptimisation(optimisationAsset.getId(), optimiser, startDuration, periodSeconds);<NEW_LINE>assetOptimisationInstanceMap.put(optimisationAsset.getId(), new OptimisationInstance(optimisationAsset, optimiser, optimisationFuture));<NEW_LINE>// Execute first optimisation at the period that started previous to now<NEW_LINE>LOG.finer(getLogPrefix(optimisationAsset.getId()) + "Running first optimisation for time '" + formatter.format(optimisationStartTime));<NEW_LINE>runOptimisation(optimisationAsset.getId(), optimisationStartTime);<NEW_LINE>} catch (Exception e) {<NEW_LINE>LOG.log(Level.SEVERE, "Failed to start energy optimiser for asset: " + optimisationAsset, e);<NEW_LINE>}<NEW_LINE>} | optimiser.intervalSize * 60 * 60); |
318,113 | protected void redrawBar(int x1, int y1, int x2, int y2) {<NEW_LINE>boolean firstDone = x1 < 0 || y1 < 0, secondDone = x2 < 0 || y2 < 0;<NEW_LINE>if (firstDone && secondDone) {<NEW_LINE>return;<NEW_LINE>}<NEW_LINE>for (Element child : children) {<NEW_LINE>boolean first = child.contains(x1, y1);<NEW_LINE>boolean second = child.contains(x2, y2);<NEW_LINE>if (first && second) {<NEW_LINE>child.redrawBar(x1, y1, x2, y2);<NEW_LINE>return;<NEW_LINE>} else if (first) {<NEW_LINE>child.redrawBar(x1, <MASK><NEW_LINE>if (secondDone) {<NEW_LINE>return;<NEW_LINE>}<NEW_LINE>firstDone = true;<NEW_LINE>} else if (second) {<NEW_LINE>child.redrawBar(x2, y2, -1, -1);<NEW_LINE>if (firstDone) {<NEW_LINE>return;<NEW_LINE>}<NEW_LINE>secondDone = true;<NEW_LINE>}<NEW_LINE>}<NEW_LINE>} | y1, -1, -1); |
414,109 | private void doEncrypt(BufferedInputStream inputStream, BufferedOutputStream outputStream, int operationMode) throws GeneralSecurityException, IOException {<NEW_LINE>Cipher cipher = Cipher.getInstance(ALGO_AES);<NEW_LINE>AlgorithmParameterSpec parameterSpec;<NEW_LINE>if (SDK_INT >= KITKAT) {<NEW_LINE>parameterSpec = new GCMParameterSpec(GCM_TAG_LENGTH, IV.getBytes());<NEW_LINE>} else {<NEW_LINE>parameterSpec = new IvParameterSpec(IV.getBytes());<NEW_LINE>}<NEW_LINE>cipher.init(operationMode, SecretKeygen.INSTANCE.getSecretKey(), parameterSpec);<NEW_LINE>byte[] buffer <MASK><NEW_LINE>int count;<NEW_LINE>CipherOutputStream cipherOutputStream = new CipherOutputStream(outputStream, cipher);<NEW_LINE>try {<NEW_LINE>while ((count = inputStream.read(buffer)) != -1) {<NEW_LINE>if (!progressHandler.getCancelled()) {<NEW_LINE>cipherOutputStream.write(buffer, 0, count);<NEW_LINE>ServiceWatcherUtil.position += count;<NEW_LINE>} else<NEW_LINE>break;<NEW_LINE>}<NEW_LINE>} catch (Exception x) {<NEW_LINE>x.printStackTrace();<NEW_LINE>} finally {<NEW_LINE>cipherOutputStream.flush();<NEW_LINE>cipherOutputStream.close();<NEW_LINE>inputStream.close();<NEW_LINE>}<NEW_LINE>} | = new byte[GenericCopyUtil.DEFAULT_BUFFER_SIZE]; |
803,593 | public ErrorCode preAction(String clientID, String fromUser, String topic, Qos1PublishHandler.IMCallback callback, ProtoConstants.RequestSourceType requestSourceType) {<NEW_LINE>LOG.info("imHandler fromUser={}, clientId={}, topic={}", fromUser, clientID, topic);<NEW_LINE>if (requestSourceType == ProtoConstants.RequestSourceType.Request_From_User && !mLimitCounter.isGranted(clientID + fromUser + topic)) {<NEW_LINE>ByteBuf ackPayload = Unpooled.buffer();<NEW_LINE>ackPayload.ensureWritable(1).writeByte(ERROR_CODE_OVER_FREQUENCY.getCode());<NEW_LINE>try {<NEW_LINE>callback.onIMHandled(ERROR_CODE_OVER_FREQUENCY, ackPayload);<NEW_LINE>} catch (Exception e) {<NEW_LINE>e.printStackTrace();<NEW_LINE><MASK><NEW_LINE>}<NEW_LINE>return ErrorCode.ERROR_CODE_OVER_FREQUENCY;<NEW_LINE>}<NEW_LINE>return ErrorCode.ERROR_CODE_SUCCESS;<NEW_LINE>} | Utility.printExecption(LOG, e); |
753,124 | protected void handle(final APIMigrateVmMsg msg) {<NEW_LINE>thdf.chainSubmit(new ChainTask(msg) {<NEW_LINE><NEW_LINE>@Override<NEW_LINE>public String getName() {<NEW_LINE>return String.format("migrate-vm-%s", self.getUuid());<NEW_LINE>}<NEW_LINE><NEW_LINE>@Override<NEW_LINE>public String getSyncSignature() {<NEW_LINE>return syncThreadName;<NEW_LINE>}<NEW_LINE><NEW_LINE>@Override<NEW_LINE>public void run(final SyncTaskChain chain) {<NEW_LINE>reportProgress("0");<NEW_LINE>migrateVm(msg, new Completion(chain) {<NEW_LINE><NEW_LINE>@Override<NEW_LINE>public void success() {<NEW_LINE>APIMigrateVmEvent evt = new APIMigrateVmEvent(msg.getId());<NEW_LINE>evt.setInventory(VmInstanceInventory.valueOf(self));<NEW_LINE>reportProgress("100");<NEW_LINE>bus.publish(evt);<NEW_LINE>chain.next();<NEW_LINE>}<NEW_LINE><NEW_LINE>@Override<NEW_LINE>public void fail(ErrorCode errorCode) {<NEW_LINE>APIMigrateVmEvent evt = new <MASK><NEW_LINE>evt.setError(errorCode);<NEW_LINE>bus.publish(evt);<NEW_LINE>chain.next();<NEW_LINE>}<NEW_LINE>});<NEW_LINE>}<NEW_LINE>});<NEW_LINE>} | APIMigrateVmEvent(msg.getId()); |
625,884 | public IssuerDetails unmarshall(JsonUnmarshallerContext context) throws Exception {<NEW_LINE>IssuerDetails issuerDetails = new IssuerDetails();<NEW_LINE>int originalDepth = context.getCurrentDepth();<NEW_LINE>String currentParentElement = context.getCurrentParentElement();<NEW_LINE>int targetDepth = originalDepth + 1;<NEW_LINE>JsonToken token = context.getCurrentToken();<NEW_LINE>if (token == null)<NEW_LINE>token = context.nextToken();<NEW_LINE>if (token == VALUE_NULL) {<NEW_LINE>return null;<NEW_LINE>}<NEW_LINE>while (true) {<NEW_LINE>if (token == null)<NEW_LINE>break;<NEW_LINE>if (token == FIELD_NAME || token == START_OBJECT) {<NEW_LINE>if (context.testExpression("Name", targetDepth)) {<NEW_LINE>context.nextToken();<NEW_LINE>issuerDetails.setName(context.getUnmarshaller(String.class).unmarshall(context));<NEW_LINE>}<NEW_LINE>if (context.testExpression("SignKey", targetDepth)) {<NEW_LINE>context.nextToken();<NEW_LINE>issuerDetails.setSignKey(context.getUnmarshaller(String.class).unmarshall(context));<NEW_LINE>}<NEW_LINE>if (context.testExpression("KeyFingerprint", targetDepth)) {<NEW_LINE>context.nextToken();<NEW_LINE>issuerDetails.setKeyFingerprint(context.getUnmarshaller(String.<MASK><NEW_LINE>}<NEW_LINE>} else if (token == END_ARRAY || token == END_OBJECT) {<NEW_LINE>if (context.getLastParsedParentElement() == null || context.getLastParsedParentElement().equals(currentParentElement)) {<NEW_LINE>if (context.getCurrentDepth() <= originalDepth)<NEW_LINE>break;<NEW_LINE>}<NEW_LINE>}<NEW_LINE>token = context.nextToken();<NEW_LINE>}<NEW_LINE>return issuerDetails;<NEW_LINE>} | class).unmarshall(context)); |
152,745 | private static double apply(CompLongDoubleVector v1, LongIntVector v2) {<NEW_LINE>double dotValue = 0.0;<NEW_LINE>if (v2.isSparse() && v1.size() > v2.size()) {<NEW_LINE>ObjectIterator<Long2IntMap.Entry> iter = v2.getStorage().entryIterator();<NEW_LINE>while (iter.hasNext()) {<NEW_LINE>Long2IntMap.Entry entry = iter.next();<NEW_LINE>long idx = entry.getLongKey();<NEW_LINE>dotValue += v1.get(idx) * entry.getIntValue();<NEW_LINE>}<NEW_LINE>} else if (v2.isSorted() && v1.size() > v2.size()) {<NEW_LINE>// v2 is sorted<NEW_LINE>long[] v2Indices = v2.getStorage().getIndices();<NEW_LINE>int[] v2Values = v2.getStorage().getValues();<NEW_LINE>for (int i = 0; i < v2Indices.length; i++) {<NEW_LINE>long idx = v2Indices[i];<NEW_LINE>dotValue += v1.get(idx) * v2Values[i];<NEW_LINE>}<NEW_LINE>} else {<NEW_LINE>long base = 0;<NEW_LINE>for (LongDoubleVector part : v1.getPartitions()) {<NEW_LINE>if (part.isDense()) {<NEW_LINE>double[] partValues = part.getStorage().getValues();<NEW_LINE>for (int i = 0; i < partValues.length; i++) {<NEW_LINE>long idx = base + i;<NEW_LINE>dotValue += partValues[i] * v2.get(idx);<NEW_LINE>}<NEW_LINE>} else if (part.isSparse()) {<NEW_LINE>ObjectIterator<Long2DoubleMap.Entry> iter = part.getStorage().entryIterator();<NEW_LINE>while (iter.hasNext()) {<NEW_LINE>Long2DoubleMap.Entry entry = iter.next();<NEW_LINE>long idx = base + entry.getLongKey();<NEW_LINE>dotValue += entry.getDoubleValue() * v2.get(idx);<NEW_LINE>}<NEW_LINE>} else {<NEW_LINE>// isSorted<NEW_LINE>long[] partIndices = part.getStorage().getIndices();<NEW_LINE>double[] partValues = part.getStorage().getValues();<NEW_LINE>for (int i = 0; i < partIndices.length; i++) {<NEW_LINE>long <MASK><NEW_LINE>dotValue += partValues[i] * v2.get(idx);<NEW_LINE>}<NEW_LINE>}<NEW_LINE>base += part.getDim();<NEW_LINE>}<NEW_LINE>}<NEW_LINE>return dotValue;<NEW_LINE>} | idx = base + partIndices[i]; |
1,487,743 | private void handleInvokeExpr(InvokeExpr ie) {<NEW_LINE>if (!uses) {<NEW_LINE>return;<NEW_LINE>}<NEW_LINE>// Handle the parameters<NEW_LINE>SootMethodRef method = ie.getMethodRef();<NEW_LINE>for (int i = 0; i < ie.getArgCount(); i++) {<NEW_LINE>Value arg = ie.getArg(i);<NEW_LINE>if (arg instanceof Local) {<NEW_LINE>Local local = (Local) arg;<NEW_LINE>if (local.getType() instanceof IntegerType) {<NEW_LINE>TypeVariable <MASK><NEW_LINE>localType.addParent(resolver.typeVariable(method.parameterType(i)));<NEW_LINE>}<NEW_LINE>}<NEW_LINE>}<NEW_LINE>if (ie instanceof DynamicInvokeExpr) {<NEW_LINE>DynamicInvokeExpr die = (DynamicInvokeExpr) ie;<NEW_LINE>SootMethodRef bootstrapMethod = die.getBootstrapMethodRef();<NEW_LINE>for (int i = 0; i < die.getBootstrapArgCount(); i++) {<NEW_LINE>Value arg = die.getBootstrapArg(i);<NEW_LINE>if (arg instanceof Local) {<NEW_LINE>Local local = (Local) arg;<NEW_LINE>if (local.getType() instanceof IntegerType) {<NEW_LINE>TypeVariable localType = resolver.typeVariable(local);<NEW_LINE>localType.addParent(resolver.typeVariable(bootstrapMethod.parameterType(i)));<NEW_LINE>}<NEW_LINE>}<NEW_LINE>}<NEW_LINE>}<NEW_LINE>} | localType = resolver.typeVariable(local); |
1,638,975 | public void marshall(DataSourceSyncJob dataSourceSyncJob, ProtocolMarshaller protocolMarshaller) {<NEW_LINE>if (dataSourceSyncJob == null) {<NEW_LINE>throw new SdkClientException("Invalid argument passed to marshall(...)");<NEW_LINE>}<NEW_LINE>try {<NEW_LINE>protocolMarshaller.marshall(<MASK><NEW_LINE>protocolMarshaller.marshall(dataSourceSyncJob.getStartTime(), STARTTIME_BINDING);<NEW_LINE>protocolMarshaller.marshall(dataSourceSyncJob.getEndTime(), ENDTIME_BINDING);<NEW_LINE>protocolMarshaller.marshall(dataSourceSyncJob.getStatus(), STATUS_BINDING);<NEW_LINE>protocolMarshaller.marshall(dataSourceSyncJob.getErrorMessage(), ERRORMESSAGE_BINDING);<NEW_LINE>protocolMarshaller.marshall(dataSourceSyncJob.getErrorCode(), ERRORCODE_BINDING);<NEW_LINE>protocolMarshaller.marshall(dataSourceSyncJob.getDataSourceErrorCode(), DATASOURCEERRORCODE_BINDING);<NEW_LINE>protocolMarshaller.marshall(dataSourceSyncJob.getMetrics(), METRICS_BINDING);<NEW_LINE>} catch (Exception e) {<NEW_LINE>throw new SdkClientException("Unable to marshall request to JSON: " + e.getMessage(), e);<NEW_LINE>}<NEW_LINE>} | dataSourceSyncJob.getExecutionId(), EXECUTIONID_BINDING); |
1,081,369 | public boolean apply(Game game, Ability source) {<NEW_LINE>Player controller = game.getPlayer(source.getControllerId());<NEW_LINE>Card aura = game.getCard(source.getFirstTarget());<NEW_LINE>if (controller == null || aura == null) {<NEW_LINE>return false;<NEW_LINE>}<NEW_LINE>FilterControlledCreaturePermanent FILTER = new FilterControlledCreaturePermanent("Choose a creature you control");<NEW_LINE><MASK><NEW_LINE>target.setNotTarget(true);<NEW_LINE>if (controller.choose(Outcome.PutCardInPlay, target, source, game)) {<NEW_LINE>Permanent permanent = game.getPermanent(target.getFirstTarget());<NEW_LINE>if (permanent != null && !permanent.cantBeAttachedBy(aura, source, game, false)) {<NEW_LINE>game.getState().setValue("attachTo:" + aura.getId(), permanent);<NEW_LINE>controller.moveCards(aura, Zone.BATTLEFIELD, source, game);<NEW_LINE>return permanent.addAttachment(aura.getId(), source, game);<NEW_LINE>}<NEW_LINE>}<NEW_LINE>return false;<NEW_LINE>} | TargetControlledPermanent target = new TargetControlledPermanent(FILTER); |
890,683 | final BatchAcknowledgeAlarmResult executeBatchAcknowledgeAlarm(BatchAcknowledgeAlarmRequest batchAcknowledgeAlarmRequest) {<NEW_LINE>ExecutionContext executionContext = createExecutionContext(batchAcknowledgeAlarmRequest);<NEW_LINE>AWSRequestMetrics awsRequestMetrics = executionContext.getAwsRequestMetrics();<NEW_LINE>awsRequestMetrics.startEvent(Field.ClientExecuteTime);<NEW_LINE>Request<BatchAcknowledgeAlarmRequest> request = null;<NEW_LINE>Response<BatchAcknowledgeAlarmResult> response = null;<NEW_LINE>try {<NEW_LINE>awsRequestMetrics.startEvent(Field.RequestMarshallTime);<NEW_LINE>try {<NEW_LINE>request = new BatchAcknowledgeAlarmRequestProtocolMarshaller(protocolFactory).marshall(super.beforeMarshalling(batchAcknowledgeAlarmRequest));<NEW_LINE>// Binds the request metrics to the current request.<NEW_LINE>request.setAWSRequestMetrics(awsRequestMetrics);<NEW_LINE>request.addHandlerContext(HandlerContextKey.CLIENT_ENDPOINT, endpoint);<NEW_LINE>request.addHandlerContext(<MASK><NEW_LINE>request.addHandlerContext(HandlerContextKey.SIGNING_REGION, getSigningRegion());<NEW_LINE>request.addHandlerContext(HandlerContextKey.SERVICE_ID, "IoT Events Data");<NEW_LINE>request.addHandlerContext(HandlerContextKey.OPERATION_NAME, "BatchAcknowledgeAlarm");<NEW_LINE>request.addHandlerContext(HandlerContextKey.ADVANCED_CONFIG, advancedConfig);<NEW_LINE>} finally {<NEW_LINE>awsRequestMetrics.endEvent(Field.RequestMarshallTime);<NEW_LINE>}<NEW_LINE>HttpResponseHandler<AmazonWebServiceResponse<BatchAcknowledgeAlarmResult>> responseHandler = protocolFactory.createResponseHandler(new JsonOperationMetadata().withPayloadJson(true).withHasStreamingSuccessResponse(false), new BatchAcknowledgeAlarmResultJsonUnmarshaller());<NEW_LINE>response = invoke(request, responseHandler, executionContext);<NEW_LINE>return response.getAwsResponse();<NEW_LINE>} finally {<NEW_LINE>endClientExecution(awsRequestMetrics, request, response);<NEW_LINE>}<NEW_LINE>} | HandlerContextKey.ENDPOINT_OVERRIDDEN, isEndpointOverridden()); |
1,665,303 | private void internalRun(final String[] args) {<NEW_LINE>final SpanCustomizer span = this.tracer.currentSpanCustomizer();<NEW_LINE>log.info("Parsing arguments: {}", Arrays.toString(args));<NEW_LINE>this.exitCode = ExitCode.INVALID_ARGS;<NEW_LINE>// TODO: workaround for https://jira.spring.io/browse/SPR-17416<NEW_LINE>final String[] originalArgs = Util.unmangleBareDoubleDash(args);<NEW_LINE>log.debug("Arguments: {}", Arrays.toString(originalArgs));<NEW_LINE>try {<NEW_LINE><MASK><NEW_LINE>} catch (ParameterException e) {<NEW_LINE>throw new IllegalArgumentException("Failed to parse arguments: " + e.getMessage(), e);<NEW_LINE>}<NEW_LINE>final String commandName = this.argumentParser.getSelectedCommand();<NEW_LINE>final Set<String> availableCommands = this.argumentParser.getCommandNames();<NEW_LINE>final String availableCommandsString = Arrays.toString(availableCommands.toArray());<NEW_LINE>if (commandName == null) {<NEW_LINE>throw new IllegalArgumentException("No command selected -- commands available: " + availableCommandsString);<NEW_LINE>} else if (!availableCommands.contains(commandName)) {<NEW_LINE>throw new IllegalArgumentException("Invalid command -- commands available: " + availableCommandsString);<NEW_LINE>}<NEW_LINE>this.tagAdapter.tag(span, TracingConstants.AGENT_CLI_COMMAND_NAME_TAG, commandName);<NEW_LINE>ConsoleLog.getLogger().info("Preparing agent to execute command: '{}'", commandName);<NEW_LINE>log.info("Initializing command: {}", commandName);<NEW_LINE>this.exitCode = ExitCode.COMMAND_INIT_FAIL;<NEW_LINE>final AgentCommand command = this.commandFactory.get(commandName);<NEW_LINE>this.exitCode = ExitCode.EXEC_FAIL;<NEW_LINE>this.exitCode = command.run();<NEW_LINE>} | this.argumentParser.parse(originalArgs); |
1,789,390 | public void onActivityCreated(Bundle savedInstanceState) {<NEW_LINE>super.onActivityCreated(savedInstanceState);<NEW_LINE>Activity activity = requireActivity();<NEW_LINE>GenericViewModel viewModel = ViewModelProviders.of(this).get(GenericViewModel.class);<NEW_LINE>LiveData<List<UnifiedKeyInfo>> liveData = viewModel.getGenericLiveData(requireContext(), keyRepository::getAllUnifiedKeyInfoWithSecret);<NEW_LINE>liveData.observe(this, certifyKeySpinner::setData);<NEW_LINE>if (savedInstanceState == null) {<NEW_LINE>// preselect certify key id if given<NEW_LINE>long certifyKeyId = activity.getIntent().getLongExtra(CertifyKeyActivity.<MASK><NEW_LINE>if (certifyKeyId != Constants.key.none) {<NEW_LINE>UnifiedKeyInfo unifiedKeyInfo = keyRepository.getUnifiedKeyInfo(certifyKeyId);<NEW_LINE>if (unifiedKeyInfo != null && unifiedKeyInfo.can_certify()) {<NEW_LINE>certifyKeySpinner.setPreSelectedKeyId(certifyKeyId);<NEW_LINE>}<NEW_LINE>}<NEW_LINE>}<NEW_LINE>OperationResult result = activity.getIntent().getParcelableExtra(CertifyKeyActivity.EXTRA_RESULT);<NEW_LINE>if (result != null) {<NEW_LINE>// display result from import<NEW_LINE>result.createNotify(activity).show();<NEW_LINE>}<NEW_LINE>} | EXTRA_CERTIFY_KEY_ID, Constants.key.none); |
653,718 | public Object apply(final ActionContext ctx, final Object caller, final Object[] sources) throws FrameworkException {<NEW_LINE>if (sources == null || sources.length != 2) {<NEW_LINE>logParameterError(caller, sources, ctx.isJavaScriptContext());<NEW_LINE>return usage(ctx.isJavaScriptContext());<NEW_LINE>}<NEW_LINE>try {<NEW_LINE>assertArrayHasLengthAndAllElementsNotNull(sources, 2);<NEW_LINE>final LocalDate fromDate = ((Date) sources[0]).toInstant().atZone(ZoneId.<MASK><NEW_LINE>final LocalDate toDate = ((Date) sources[1]).toInstant().atZone(ZoneId.systemDefault()).toLocalDate();<NEW_LINE>try {<NEW_LINE>final DayOfWeek startWeek = toDate.getDayOfWeek();<NEW_LINE>final DayOfWeek endWeek = toDate.getDayOfWeek();<NEW_LINE>final long days = ChronoUnit.DAYS.between(fromDate, toDate);<NEW_LINE>final long daysWithoutWeekends = days - 2 * ((days + startWeek.getValue()) / 7);<NEW_LINE>// adjust for starting and ending on a Sunday:<NEW_LINE>return daysWithoutWeekends + (startWeek == DayOfWeek.SUNDAY ? 1 : 0) + (endWeek == DayOfWeek.SUNDAY ? 1 : 0);<NEW_LINE>} catch (Exception ex) {<NEW_LINE>logger.warn("{}: Could not calculate week days. Parameters: {}", new Object[] { getReplacement(), caller, getParametersAsString(sources) });<NEW_LINE>}<NEW_LINE>} catch (ArgumentNullException pe) {<NEW_LINE>// silently ignore null arguments<NEW_LINE>return null;<NEW_LINE>} catch (ArgumentCountException pe) {<NEW_LINE>logParameterError(caller, sources, pe.getMessage(), ctx.isJavaScriptContext());<NEW_LINE>return usage(ctx.isJavaScriptContext());<NEW_LINE>}<NEW_LINE>return "";<NEW_LINE>} | systemDefault()).toLocalDate(); |
1,216,649 | public ChangeInfo implement() throws Exception {<NEW_LINE>final FileObject file = handle.getFileObject();<NEW_LINE>final JTextComponent comp = EditorRegistry.lastFocusedComponent();<NEW_LINE>if (file != null && file == getFileObject(comp)) {<NEW_LINE>final int[] pos = new int[] { -1 };<NEW_LINE>JavaSource.forFileObject(file).runUserActionTask(new Task<CompilationController>() {<NEW_LINE><NEW_LINE>@Override<NEW_LINE>public void run(CompilationController info) throws Exception {<NEW_LINE>info.<MASK><NEW_LINE>final TreePath tp = handle.resolve(info);<NEW_LINE>if (tp != null && tp.getLeaf().getKind() == Tree.Kind.VARIABLE) {<NEW_LINE>pos[0] = (int) info.getTrees().getSourcePositions().getEndPosition(tp.getCompilationUnit(), ((VariableTree) tp.getLeaf()).getType()) + 1;<NEW_LINE>}<NEW_LINE>}<NEW_LINE>}, true);<NEW_LINE>invokeRefactoring(comp, pos[0]);<NEW_LINE>}<NEW_LINE>return null;<NEW_LINE>} | toPhase(JavaSource.Phase.PARSED); |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.