idx int32 46 1.86M | input stringlengths 321 6.6k | target stringlengths 9 1.24k |
|---|---|---|
691,922 | final ModifyTrafficMirrorFilterRuleResult executeModifyTrafficMirrorFilterRule(ModifyTrafficMirrorFilterRuleRequest modifyTrafficMirrorFilterRuleRequest) {<NEW_LINE>ExecutionContext executionContext = createExecutionContext(modifyTrafficMirrorFilterRuleRequest);<NEW_LINE>AWSRequestMetrics awsRequestMetrics = executionContext.getAwsRequestMetrics();<NEW_LINE>awsRequestMetrics.startEvent(Field.ClientExecuteTime);<NEW_LINE>Request<ModifyTrafficMirrorFilterRuleRequest> request = null;<NEW_LINE>Response<ModifyTrafficMirrorFilterRuleResult> response = null;<NEW_LINE>try {<NEW_LINE>awsRequestMetrics.startEvent(Field.RequestMarshallTime);<NEW_LINE>try {<NEW_LINE>request = new ModifyTrafficMirrorFilterRuleRequestMarshaller().marshall(super.beforeMarshalling(modifyTrafficMirrorFilterRuleRequest));<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, "ModifyTrafficMirrorFilterRule");<NEW_LINE>request.addHandlerContext(HandlerContextKey.ADVANCED_CONFIG, advancedConfig);<NEW_LINE>} finally {<NEW_LINE>awsRequestMetrics.endEvent(Field.RequestMarshallTime);<NEW_LINE>}<NEW_LINE>StaxResponseHandler<ModifyTrafficMirrorFilterRuleResult> responseHandler = new StaxResponseHandler<ModifyTrafficMirrorFilterRuleResult>(new ModifyTrafficMirrorFilterRuleResultStaxUnmarshaller());<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,404,164 | final TestWirelessDeviceResult executeTestWirelessDevice(TestWirelessDeviceRequest testWirelessDeviceRequest) {<NEW_LINE>ExecutionContext executionContext = createExecutionContext(testWirelessDeviceRequest);<NEW_LINE><MASK><NEW_LINE>awsRequestMetrics.startEvent(Field.ClientExecuteTime);<NEW_LINE>Request<TestWirelessDeviceRequest> request = null;<NEW_LINE>Response<TestWirelessDeviceResult> response = null;<NEW_LINE>try {<NEW_LINE>awsRequestMetrics.startEvent(Field.RequestMarshallTime);<NEW_LINE>try {<NEW_LINE>request = new TestWirelessDeviceRequestProtocolMarshaller(protocolFactory).marshall(super.beforeMarshalling(testWirelessDeviceRequest));<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, "IoT Wireless");<NEW_LINE>request.addHandlerContext(HandlerContextKey.OPERATION_NAME, "TestWirelessDevice");<NEW_LINE>request.addHandlerContext(HandlerContextKey.ADVANCED_CONFIG, advancedConfig);<NEW_LINE>} finally {<NEW_LINE>awsRequestMetrics.endEvent(Field.RequestMarshallTime);<NEW_LINE>}<NEW_LINE>HttpResponseHandler<AmazonWebServiceResponse<TestWirelessDeviceResult>> responseHandler = protocolFactory.createResponseHandler(new JsonOperationMetadata().withPayloadJson(true).withHasStreamingSuccessResponse(false), new TestWirelessDeviceResultJsonUnmarshaller());<NEW_LINE>response = invoke(request, responseHandler, executionContext);<NEW_LINE>return response.getAwsResponse();<NEW_LINE>} finally {<NEW_LINE>endClientExecution(awsRequestMetrics, request, response);<NEW_LINE>}<NEW_LINE>} | AWSRequestMetrics awsRequestMetrics = executionContext.getAwsRequestMetrics(); |
697,053 | public static ListPatentContactResponse unmarshall(ListPatentContactResponse listPatentContactResponse, UnmarshallerContext _ctx) {<NEW_LINE>listPatentContactResponse.setRequestId(_ctx.stringValue("ListPatentContactResponse.RequestId"));<NEW_LINE>listPatentContactResponse.setPageNum(_ctx.integerValue("ListPatentContactResponse.PageNum"));<NEW_LINE>listPatentContactResponse.setSuccess(_ctx.booleanValue("ListPatentContactResponse.Success"));<NEW_LINE>listPatentContactResponse.setTotalItemNum(_ctx.integerValue("ListPatentContactResponse.TotalItemNum"));<NEW_LINE>listPatentContactResponse.setPageSize<MASK><NEW_LINE>listPatentContactResponse.setTotalPageNum(_ctx.integerValue("ListPatentContactResponse.TotalPageNum"));<NEW_LINE>List<Produces> data = new ArrayList<Produces>();<NEW_LINE>for (int i = 0; i < _ctx.lengthValue("ListPatentContactResponse.Data.Length"); i++) {<NEW_LINE>Produces produces = new Produces();<NEW_LINE>produces.setEmail(_ctx.stringValue("ListPatentContactResponse.Data[" + i + "].Email"));<NEW_LINE>produces.setName(_ctx.stringValue("ListPatentContactResponse.Data[" + i + "].Name"));<NEW_LINE>produces.setMobile(_ctx.stringValue("ListPatentContactResponse.Data[" + i + "].Mobile"));<NEW_LINE>produces.setId(_ctx.longValue("ListPatentContactResponse.Data[" + i + "].Id"));<NEW_LINE>data.add(produces);<NEW_LINE>}<NEW_LINE>listPatentContactResponse.setData(data);<NEW_LINE>return listPatentContactResponse;<NEW_LINE>} | (_ctx.integerValue("ListPatentContactResponse.PageSize")); |
1,540,082 | private void renderPolygons(Graphics2D g2) {<NEW_LINE>// Create a local copy of the camera so that mouse doesn't need to block on polygons rendering<NEW_LINE>Se3_F64 worldToCamera;<NEW_LINE>synchronized (this.worldToCamera) {<NEW_LINE>worldToCamera = this.worldToCamera.copy();<NEW_LINE>}<NEW_LINE>for (Poly poly : polygons) {<NEW_LINE>SePointOps_F64.transform(worldToCamera, poly.pts[0], p1);<NEW_LINE>GeometryMath_F64.mult(K, p1, x1);<NEW_LINE>// don't render what's behind the camera<NEW_LINE>if (p1.z < 0)<NEW_LINE>continue;<NEW_LINE>g2.setColor(poly.color);<NEW_LINE>boolean skip = false;<NEW_LINE>for (int i = 1; i < poly.pts.length; i++) {<NEW_LINE>SePointOps_F64.transform(worldToCamera, poly<MASK><NEW_LINE>GeometryMath_F64.mult(K, p2, x2);<NEW_LINE>if (p2.z < 0) {<NEW_LINE>skip = true;<NEW_LINE>break;<NEW_LINE>}<NEW_LINE>line.setLine(x1.x, x1.y, x2.x, x2.y);<NEW_LINE>g2.draw(line);<NEW_LINE>Point3D_F64 tempP = p1;<NEW_LINE>Point2D_F64 tempX = x1;<NEW_LINE>p1 = p2;<NEW_LINE>p2 = tempP;<NEW_LINE>x1 = x2;<NEW_LINE>x2 = tempX;<NEW_LINE>}<NEW_LINE>if (!skip) {<NEW_LINE>SePointOps_F64.transform(worldToCamera, poly.pts[0], p2);<NEW_LINE>GeometryMath_F64.mult(K, p2, x2);<NEW_LINE>line.setLine(x1.x, x1.y, x2.x, x2.y);<NEW_LINE>g2.draw(line);<NEW_LINE>}<NEW_LINE>}<NEW_LINE>} | .pts[i], p2); |
972,523 | void fitFSM() {<NEW_LINE>if (fsm != null) {<NEW_LINE>GraphicMinMax gr = new GraphicMinMax();<NEW_LINE>fsm.drawTo(gr);<NEW_LINE>AffineTransform newTrans = new AffineTransform();<NEW_LINE>if (gr.getMin() != null && getWidth() != 0 && getHeight() != 0) {<NEW_LINE>Vector delta = gr.getMax().<MASK><NEW_LINE>double sx = ((double) getWidth()) / (delta.x + Style.NORMAL.getThickness() * 2);<NEW_LINE>double sy = ((double) getHeight()) / (delta.y + Style.NORMAL.getThickness() * 2);<NEW_LINE>double s = Math.min(sx, sy);<NEW_LINE>// set Scaling<NEW_LINE>newTrans.setToScale(s, s);<NEW_LINE>Vector center = gr.getMin().add(gr.getMax()).div(2);<NEW_LINE>// move drawing center to (0,0)<NEW_LINE>newTrans.translate(-center.x, -center.y);<NEW_LINE>Vector dif = new Vector(getWidth(), getHeight()).div(2);<NEW_LINE>// move drawing center to frame center<NEW_LINE>newTrans.translate(dif.x / s, dif.y / s);<NEW_LINE>isManualScale = false;<NEW_LINE>} else {<NEW_LINE>isManualScale = true;<NEW_LINE>}<NEW_LINE>if (!newTrans.equals(transform)) {<NEW_LINE>transform = newTrans;<NEW_LINE>repaint();<NEW_LINE>}<NEW_LINE>}<NEW_LINE>} | sub(gr.getMin()); |
275,103 | // see JCA spec<NEW_LINE>@Override<NEW_LINE>protected boolean engineVerify(byte[] signature) throws SignatureException {<NEW_LINE>ensureInitialized();<NEW_LINE>boolean doCancel = true;<NEW_LINE>if (DEBUG)<NEW_LINE>System.out.print("Verifying signature");<NEW_LINE>try {<NEW_LINE>if (type == T_UPDATE) {<NEW_LINE>if (DEBUG)<NEW_LINE>System.out.println(" by C_VerifyFinal");<NEW_LINE>token.p11.C_VerifyFinal(session.id(), signature);<NEW_LINE>} else {<NEW_LINE>if (md == null) {<NEW_LINE>throw new ProviderException("PSS Parameters required");<NEW_LINE>}<NEW_LINE>byte[] digest = md.digest();<NEW_LINE>if (DEBUG)<NEW_LINE><MASK><NEW_LINE>token.p11.C_Verify(session.id(), digest, signature);<NEW_LINE>}<NEW_LINE>doCancel = false;<NEW_LINE>return true;<NEW_LINE>} catch (PKCS11Exception pe) {<NEW_LINE>doCancel = false;<NEW_LINE>long errorCode = pe.getErrorCode();<NEW_LINE>if (errorCode == CKR_SIGNATURE_INVALID) {<NEW_LINE>return false;<NEW_LINE>}<NEW_LINE>if (errorCode == CKR_SIGNATURE_LEN_RANGE) {<NEW_LINE>// return false rather than throwing an exception<NEW_LINE>return false;<NEW_LINE>}<NEW_LINE>// ECF bug?<NEW_LINE>if (errorCode == CKR_DATA_LEN_RANGE) {<NEW_LINE>return false;<NEW_LINE>}<NEW_LINE>throw new ProviderException(pe);<NEW_LINE>} catch (ProviderException e) {<NEW_LINE>throw e;<NEW_LINE>} finally {<NEW_LINE>reset(doCancel);<NEW_LINE>}<NEW_LINE>} | System.out.println(" by C_Verify"); |
863,355 | private void updateColorItem(TableItem tableItem) {<NEW_LINE>DBVColorOverride co = (DBVColorOverride) tableItem.getData();<NEW_LINE>String text;<NEW_LINE>Object[] values = co.getAttributeValues();<NEW_LINE>if (ArrayUtils.isEmpty(values)) {<NEW_LINE>text = co.getOperator<MASK><NEW_LINE>} else if (values.length == 1) {<NEW_LINE>text = co.getOperator().getExpression() + " " + DBValueFormatting.getDefaultValueDisplayString(values[0], DBDDisplayFormat.UI);<NEW_LINE>} else {<NEW_LINE>if (co.isRange()) {<NEW_LINE>text = "In " + Arrays.toString(values);<NEW_LINE>} else {<NEW_LINE>text = co.getOperator().getExpression() + " " + Arrays.toString(values);<NEW_LINE>}<NEW_LINE>}<NEW_LINE>tableItem.setText(0, text);<NEW_LINE>tableItem.setForeground(getColorTableForeground((DBVColorOverride) tableItem.getData()));<NEW_LINE>tableItem.setBackground(getColorTableBackground((DBVColorOverride) tableItem.getData()));<NEW_LINE>} | ().getExpression() + " ?"; |
1,216,251 | public static DescribeAccountsResponse unmarshall(DescribeAccountsResponse describeAccountsResponse, UnmarshallerContext context) {<NEW_LINE>describeAccountsResponse.setRequestId(context.stringValue("DescribeAccountsResponse.RequestId"));<NEW_LINE>describeAccountsResponse.setInstanceId(context.stringValue("DescribeAccountsResponse.InstanceId"));<NEW_LINE>List<Account> accountList = new ArrayList<Account>();<NEW_LINE>for (int i = 0; i < context.lengthValue("DescribeAccountsResponse.AccountList.Length"); i++) {<NEW_LINE>Account account = new Account();<NEW_LINE>account.setAccountName(context.stringValue("DescribeAccountsResponse.AccountList[" + i + "].AccountName"));<NEW_LINE>account.setAccountStatus(context.stringValue("DescribeAccountsResponse.AccountList[" + i + "].AccountStatus"));<NEW_LINE>account.setAccountDescription(context.stringValue("DescribeAccountsResponse.AccountList[" + i + "].AccountDescription"));<NEW_LINE>account.setAccountType(context.stringValue("DescribeAccountsResponse.AccountList[" + i + "].AccountType"));<NEW_LINE>List<DatabasePrivilege> databasePrivileges <MASK><NEW_LINE>for (int j = 0; j < context.lengthValue("DescribeAccountsResponse.AccountList[" + i + "].DatabasePrivileges.Length"); j++) {<NEW_LINE>DatabasePrivilege databasePrivilege = new DatabasePrivilege();<NEW_LINE>databasePrivilege.setDBName(context.stringValue("DescribeAccountsResponse.AccountList[" + i + "].DatabasePrivileges[" + j + "].DBName"));<NEW_LINE>databasePrivilege.setAccountPrivilege(context.stringValue("DescribeAccountsResponse.AccountList[" + i + "].DatabasePrivileges[" + j + "].AccountPrivilege"));<NEW_LINE>databasePrivilege.setAccountPrivilegeDetail(context.stringValue("DescribeAccountsResponse.AccountList[" + i + "].DatabasePrivileges[" + j + "].AccountPrivilegeDetail"));<NEW_LINE>databasePrivileges.add(databasePrivilege);<NEW_LINE>}<NEW_LINE>account.setDatabasePrivileges(databasePrivileges);<NEW_LINE>accountList.add(account);<NEW_LINE>}<NEW_LINE>describeAccountsResponse.setAccountList(accountList);<NEW_LINE>return describeAccountsResponse;<NEW_LINE>} | = new ArrayList<DatabasePrivilege>(); |
1,175,921 | private void initViews(View root) {<NEW_LINE>mGetDirectLinkContainer = root.findViewById(R.id.get_direct_link_container);<NEW_LINE>View publishCategoryContainer = root.findViewById(R.id.upload_and_publish_container);<NEW_LINE>mPublishCategoryImage = publishCategoryContainer.findViewById(R.id.upload_and_publish_image);<NEW_LINE>mGetDirectLinkImage = mGetDirectLinkContainer.findViewById(R.id.get_direct_link_image);<NEW_LINE>mEditOnWebBtn = root.findViewById(R.id.edit_on_web_btn);<NEW_LINE>mPublishingCompletedStatusContainer = root.findViewById(R.id.publishing_completed_status_container);<NEW_LINE>mGetDirectLinkCompletedStatusContainer = root.<MASK><NEW_LINE>mUploadAndPublishText = root.findViewById(R.id.upload_and_publish_text);<NEW_LINE>mGetDirectLinkText = root.findViewById(R.id.get_direct_link_text);<NEW_LINE>mUpdateGuideDirectLinkBtn = root.findViewById(R.id.direct_link_update_btn);<NEW_LINE>mUpdateGuidePublicAccessBtn = root.findViewById(R.id.upload_and_publish_update_btn);<NEW_LINE>mDirectLinkCreatedText = root.findViewById(R.id.direct_link_created_text);<NEW_LINE>mDirectLinkDescriptionText = root.findViewById(R.id.direct_link_description_text);<NEW_LINE>mShareDirectLinkBtn = mGetDirectLinkCompletedStatusContainer.findViewById(R.id.share_direct_link_btn);<NEW_LINE>mUpdateGuideDirectLinkBtn.setSelected(true);<NEW_LINE>mUpdateGuidePublicAccessBtn.setSelected(true);<NEW_LINE>TextView licenseAgreementText = root.findViewById(R.id.license_agreement_message);<NEW_LINE>String src = getResources().getString(R.string.ugc_routes_user_agreement, Framework.nativeGetPrivacyPolicyLink());<NEW_LINE>Spanned spanned = Html.fromHtml(src);<NEW_LINE>licenseAgreementText.setMovementMethod(LinkMovementMethod.getInstance());<NEW_LINE>licenseAgreementText.setText(spanned);<NEW_LINE>} | findViewById(R.id.get_direct_link_completed_status_container); |
1,779,674 | void canUpdateTagsForResource(final String api, final String id, final String name, final RestDocumentationFilter updateFilter) throws Exception {<NEW_LINE>final String tag1 = UUID.randomUUID().toString();<NEW_LINE>final String tag2 = UUID<MASK><NEW_LINE>final Set<String> tags = Sets.newHashSet(tag1, tag2);<NEW_LINE>RestAssured.given(this.requestSpecification).contentType(MediaType.APPLICATION_JSON_VALUE).body(GenieObjectMapper.getMapper().writeValueAsBytes(tags)).when().port(this.port).post(api, id).then().statusCode(Matchers.is(HttpStatus.NO_CONTENT.value()));<NEW_LINE>final String tag3 = UUID.randomUUID().toString();<NEW_LINE>RestAssured.given(this.requestSpecification).filter(updateFilter).contentType(MediaType.APPLICATION_JSON_VALUE).body(GenieObjectMapper.getMapper().writeValueAsBytes(Sets.newHashSet(tag3))).when().port(this.port).put(api, id).then().statusCode(Matchers.is(HttpStatus.NO_CONTENT.value()));<NEW_LINE>RestAssured.given(this.requestSpecification).when().port(this.port).get(api, id).then().statusCode(Matchers.is(HttpStatus.OK.value())).contentType(Matchers.containsString(MediaType.APPLICATION_JSON_VALUE)).body("$", Matchers.hasSize(3)).body("$", Matchers.hasItem("genie.id:" + id)).body("$", Matchers.hasItem("genie.name:" + name)).body("$", Matchers.hasItem(tag3));<NEW_LINE>} | .randomUUID().toString(); |
389,682 | public static // between the strings str1 and str2 in O(nm)<NEW_LINE>String lcs(char[] A, char[] B) {<NEW_LINE>if (A == null || B == null)<NEW_LINE>return null;<NEW_LINE>final int n = A.length;<NEW_LINE>final int m = B.length;<NEW_LINE>if (n == 0 || m == 0)<NEW_LINE>return null;<NEW_LINE>int[][] dp = new int[n <MASK><NEW_LINE>// Suppose A = a1a2..an-1an and B = b1b2..bn-1bn<NEW_LINE>for (int i = 1; i <= n; i++) {<NEW_LINE>for (int j = 1; j <= m; j++) {<NEW_LINE>// If ends match the LCS(a1a2..an-1an, b1b2..bn-1bn) = LCS(a1a2..an-1, b1b2..bn-1) + 1<NEW_LINE>if (A[i - 1] == B[j - 1])<NEW_LINE>dp[i][j] = dp[i - 1][j - 1] + 1;<NEW_LINE>else<NEW_LINE>// If the ends do not match the LCS of a1a2..an-1an and b1b2..bn-1bn is<NEW_LINE>// max( LCS(a1a2..an-1, b1b2..bn-1bn), LCS(a1a2..an-1an, b1b2..bn-1) )<NEW_LINE>dp[i][j] = Math.max(dp[i - 1][j], dp[i][j - 1]);<NEW_LINE>}<NEW_LINE>}<NEW_LINE>int lcsLen = dp[n][m];<NEW_LINE>char[] lcs = new char[lcsLen];<NEW_LINE>int index = 0;<NEW_LINE>// Backtrack to find a LCS. We search for the cells<NEW_LINE>// where we included an element which are those with<NEW_LINE>// dp[i][j] != dp[i-1][j] and dp[i][j] != dp[i][j-1])<NEW_LINE>int i = n, j = m;<NEW_LINE>while (i >= 1 && j >= 1) {<NEW_LINE>int v = dp[i][j];<NEW_LINE>// The order of these may output different LCSs<NEW_LINE>while (i > 1 && dp[i - 1][j] == v) i--;<NEW_LINE>while (j > 1 && dp[i][j - 1] == v) j--;<NEW_LINE>// Make sure there is a match before adding<NEW_LINE>// or B[j-1];<NEW_LINE>if (v > 0)<NEW_LINE>lcs[lcsLen - index++ - 1] = A[i - 1];<NEW_LINE>i--;<NEW_LINE>j--;<NEW_LINE>}<NEW_LINE>return new String(lcs, 0, lcsLen);<NEW_LINE>} | + 1][m + 1]; |
366,400 | // Package protected to allow test case access<NEW_LINE>boolean filterContentType(SampleResult result) {<NEW_LINE>String includeExp = getContentTypeInclude();<NEW_LINE>String excludeExp = getContentTypeExclude();<NEW_LINE>// If no expressions are specified, we let the sample pass<NEW_LINE>if ((includeExp == null || includeExp.isEmpty()) && (excludeExp == null || excludeExp.isEmpty())) {<NEW_LINE>return true;<NEW_LINE>}<NEW_LINE>// Check that we have a content type<NEW_LINE>String sampleContentType = result.getContentType();<NEW_LINE>if (sampleContentType == null || sampleContentType.isEmpty()) {<NEW_LINE>if (log.isDebugEnabled()) {<NEW_LINE>log.debug("No Content-type found for : {}", result.getUrlAsString());<NEW_LINE>}<NEW_LINE>return true;<NEW_LINE>}<NEW_LINE>if (log.isDebugEnabled()) {<NEW_LINE>log.debug("Content-type to filter : {}", sampleContentType);<NEW_LINE>}<NEW_LINE>// Check if the include pattern is matched<NEW_LINE>boolean matched = testPattern(includeExp, sampleContentType, true);<NEW_LINE>if (!matched) {<NEW_LINE>return false;<NEW_LINE>}<NEW_LINE>// Check if the exclude pattern is matched<NEW_LINE>matched = <MASK><NEW_LINE>if (!matched) {<NEW_LINE>return false;<NEW_LINE>}<NEW_LINE>return true;<NEW_LINE>} | testPattern(excludeExp, sampleContentType, false); |
1,485,911 | void doWrite(Object value) {<NEW_LINE>// common-case - constants or JDK types<NEW_LINE>if (value instanceof String || jsonInput || value instanceof Number || value instanceof Boolean || value == null) {<NEW_LINE>String valueString = (value == null ? "null" : value.toString());<NEW_LINE>if (value instanceof String && !jsonInput) {<NEW_LINE>valueString = StringUtils.toJsonString(valueString);<NEW_LINE>}<NEW_LINE>pool.get().bytes(valueString);<NEW_LINE>} else if (value instanceof Date) {<NEW_LINE>String valueString = (value == null ? "null" : Long.toString(((Date) value).getTime()));<NEW_LINE>pool.get().bytes(valueString);<NEW_LINE>} else if (value instanceof RawJson) {<NEW_LINE>pool.get().bytes(((RawJson) value).json());<NEW_LINE>} else // library specific type - use the value writer (a bit overkill but handles collections/arrays properly)<NEW_LINE>{<NEW_LINE><MASK><NEW_LINE>JacksonJsonGenerator generator = new JacksonJsonGenerator(new FastByteArrayOutputStream(ba));<NEW_LINE>ValueWriter.Result writeResult = valueWriter.write(value, generator);<NEW_LINE>generator.flush();<NEW_LINE>generator.close();<NEW_LINE>if (writeResult.isSuccesful() == false) {<NEW_LINE>throw new RuntimeException("Write failed");<NEW_LINE>}<NEW_LINE>}<NEW_LINE>} | BytesArray ba = pool.get(); |
1,483,585 | private Mono<Response<CheckRestrictionsResultInner>> checkAtResourceGroupScopeWithResponseAsync(String resourceGroupName, CheckRestrictionsRequest parameters, Context context) {<NEW_LINE>if (this.client.getEndpoint() == null) {<NEW_LINE>return Mono.error(new IllegalArgumentException("Parameter this.client.getEndpoint() is required and cannot be null."));<NEW_LINE>}<NEW_LINE>if (this.client.getSubscriptionId() == null) {<NEW_LINE>return Mono.<MASK><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 (parameters == null) {<NEW_LINE>return Mono.error(new IllegalArgumentException("Parameter parameters is required and cannot be null."));<NEW_LINE>} else {<NEW_LINE>parameters.validate();<NEW_LINE>}<NEW_LINE>final String apiVersion = "2020-07-01";<NEW_LINE>final String accept = "application/json";<NEW_LINE>context = this.client.mergeContext(context);<NEW_LINE>return service.checkAtResourceGroupScope(this.client.getEndpoint(), this.client.getSubscriptionId(), resourceGroupName, apiVersion, parameters, accept, context);<NEW_LINE>} | error(new IllegalArgumentException("Parameter this.client.getSubscriptionId() is required and cannot be null.")); |
1,013,393 | public void deleteFoldersId(String folderId, String ifMatch, Boolean recursive) throws ApiException {<NEW_LINE>Object localVarPostBody = null;<NEW_LINE>// verify the required parameter 'folderId' is set<NEW_LINE>if (folderId == null) {<NEW_LINE>throw new ApiException(400, "Missing the required parameter 'folderId' when calling deleteFoldersId");<NEW_LINE>}<NEW_LINE>// create path and map variables<NEW_LINE>String localVarPath = "/folders/{folder_id}".replaceAll("\\{" + "folder_id" + "\\}", apiClient.escapeString(folderId.toString()));<NEW_LINE>// query params<NEW_LINE>List<Pair> localVarQueryParams = new ArrayList<Pair>();<NEW_LINE>Map<String, String> localVarHeaderParams = new HashMap<String, String>();<NEW_LINE>Map<String, Object> localVarFormParams = new HashMap<String, Object>();<NEW_LINE>localVarQueryParams.addAll(apiClient.parameterToPairs("", "recursive", recursive));<NEW_LINE>if (ifMatch != null)<NEW_LINE>localVarHeaderParams.put("if-match", apiClient.parameterToString(ifMatch));<NEW_LINE>final String[] localVarAccepts = { "application/json" };<NEW_LINE>final String <MASK><NEW_LINE>final String[] localVarContentTypes = {};<NEW_LINE>final String localVarContentType = apiClient.selectHeaderContentType(localVarContentTypes);<NEW_LINE>String[] localVarAuthNames = new String[] {};<NEW_LINE>apiClient.invokeAPI(localVarPath, "DELETE", localVarQueryParams, localVarPostBody, localVarHeaderParams, localVarFormParams, localVarAccept, localVarContentType, localVarAuthNames, null);<NEW_LINE>} | localVarAccept = apiClient.selectHeaderAccept(localVarAccepts); |
1,136,785 | private static void addWhitespace(Document targetDoc) {<NEW_LINE>try {<NEW_LINE>XPathExpression xpath = XPathFactory.newInstance().newXPath().compile(XPATH_COMMENT_EXPRESSION);<NEW_LINE>NodeList matchingNodes = (NodeList) xpath.evaluate(targetDoc, XPathConstants.NODESET);<NEW_LINE>Node text1 = targetDoc.createTextNode("\n\n ");<NEW_LINE>for (int idx = 0; idx < matchingNodes.getLength(); idx++) {<NEW_LINE>Node matching = matchingNodes.item(idx);<NEW_LINE>Node parent = matching.getParentNode();<NEW_LINE>Node previousSibling = matching.getPreviousSibling();<NEW_LINE>boolean previousNodeMatches = false;<NEW_LINE>if (previousSibling != null) {<NEW_LINE>previousNodeMatches = previousSibling.isEqualNode(text1);<NEW_LINE>}<NEW_LINE>if (previousNodeMatches) {<NEW_LINE>Node text = text1.cloneNode(false);<NEW_LINE>parent.replaceChild(text, matching);<NEW_LINE><MASK><NEW_LINE>} else {<NEW_LINE>Node text = text1.cloneNode(false);<NEW_LINE>parent.replaceChild(text, matching);<NEW_LINE>parent.insertBefore(matching, text);<NEW_LINE>parent.insertBefore(text.cloneNode(false), matching);<NEW_LINE>}<NEW_LINE>}<NEW_LINE>} catch (XPathExpressionException e) {<NEW_LINE>Log.error(thisClass, "trimWhitespace", e, "Error searching XML document for generated include file comments.");<NEW_LINE>}<NEW_LINE>} | parent.insertBefore(matching, text); |
661,533 | public void addExternalClassSources(ClassSource_Aggregate rootClassSource) throws ClassSource_Exception {<NEW_LINE>// TODO: Need to find a shorter name to use for these.<NEW_LINE>// TODO: Need to make sure the names of these are different<NEW_LINE>// than the module element names.<NEW_LINE>List<MASK><NEW_LINE>if (useAppLibPaths != null) {<NEW_LINE>for (String nextAppLibPath : useAppLibPaths) {<NEW_LINE>@SuppressWarnings("unused")<NEW_LINE>ClassSourceImpl_MappedJar appLibClassSource = addJarClassSource(rootClassSource, nextAppLibPath, nextAppLibPath, ScanPolicy.EXTERNAL);<NEW_LINE>// throws ClassSource_Exception<NEW_LINE>}<NEW_LINE>}<NEW_LINE>List<String> useManifestPaths = getManifestPaths();<NEW_LINE>if (useManifestPaths != null) {<NEW_LINE>for (String nextManifestPath : useManifestPaths) {<NEW_LINE>@SuppressWarnings("unused")<NEW_LINE>ClassSourceImpl_MappedJar manifestClassSource = addJarClassSource(rootClassSource, nextManifestPath, nextManifestPath, ScanPolicy.EXTERNAL);<NEW_LINE>// throws ClassSource_Exception<NEW_LINE>}<NEW_LINE>}<NEW_LINE>} | <String> useAppLibPaths = getAppLibPaths(); |
451,578 | public String toAlluxioPath(String ufsPath) throws IOException {<NEW_LINE>String suffix = ufsPath.endsWith("/") ? "/" : "";<NEW_LINE>AlluxioURI ufsUri = new AlluxioURI(ufsPath);<NEW_LINE>// first look for an exact match<NEW_LINE>if (mPathMap.inverse().containsKey(ufsUri)) {<NEW_LINE>AlluxioURI match = mPathMap.inverse().get(ufsUri);<NEW_LINE>if (match.equals(ufsUri)) {<NEW_LINE>// bypassed UFS path, return as is<NEW_LINE>return ufsPath;<NEW_LINE>}<NEW_LINE>return checkAndAddSchemeAuthority(mPathMap.inverse().get(ufsUri)) + suffix;<NEW_LINE>}<NEW_LINE>// otherwise match by longest prefix<NEW_LINE>BiMap.Entry<MASK><NEW_LINE>int longestPrefixDepth = -1;<NEW_LINE>for (BiMap.Entry<AlluxioURI, AlluxioURI> entry : mPathMap.entrySet()) {<NEW_LINE>try {<NEW_LINE>AlluxioURI valueUri = entry.getValue();<NEW_LINE>if (valueUri.isAncestorOf(ufsUri) && valueUri.getDepth() > longestPrefixDepth) {<NEW_LINE>longestPrefix = entry;<NEW_LINE>longestPrefixDepth = valueUri.getDepth();<NEW_LINE>}<NEW_LINE>} catch (InvalidPathException e) {<NEW_LINE>throw new IOException(e);<NEW_LINE>}<NEW_LINE>}<NEW_LINE>if (longestPrefix == null) {<NEW_LINE>// TODO(yuzhu): instead of throwing an exception, mount the path?<NEW_LINE>throw new IOException(String.format("Failed to translate ufs path (%s). Mapping missing from translator", ufsPath));<NEW_LINE>}<NEW_LINE>if (longestPrefix.getKey().equals(longestPrefix.getValue())) {<NEW_LINE>// return ufsPath if set the key and value to be same when bypass path.<NEW_LINE>return ufsPath;<NEW_LINE>}<NEW_LINE>try {<NEW_LINE>String difference = PathUtils.subtractPaths(ufsUri.getPath(), longestPrefix.getValue().getPath());<NEW_LINE>AlluxioURI mappedUri = longestPrefix.getKey().join(difference);<NEW_LINE>return checkAndAddSchemeAuthority(mappedUri) + suffix;<NEW_LINE>} catch (InvalidPathException e) {<NEW_LINE>throw new IOException(e);<NEW_LINE>}<NEW_LINE>} | <AlluxioURI, AlluxioURI> longestPrefix = null; |
1,487,324 | private static void generateStaticFieldsWithDefaultValues(ClassCreator annotationLiteral, List<MethodInfo> defaultOfClassType) {<NEW_LINE>if (defaultOfClassType.isEmpty()) {<NEW_LINE>return;<NEW_LINE>}<NEW_LINE>MethodCreator staticConstructor = annotationLiteral.getMethodCreator(Methods.CLINIT, void.class);<NEW_LINE>staticConstructor.setModifiers(ACC_STATIC);<NEW_LINE>for (MethodInfo method : defaultOfClassType) {<NEW_LINE>Type returnType = method.returnType();<NEW_LINE>String returnTypeName = returnType.name().toString();<NEW_LINE>AnnotationValue defaultValue = method.defaultValue();<NEW_LINE>FieldCreator fieldCreator = annotationLiteral.getFieldCreator<MASK><NEW_LINE>fieldCreator.setModifiers(ACC_PUBLIC | ACC_STATIC | ACC_FINAL);<NEW_LINE>if (defaultValue.kind() == AnnotationValue.Kind.ARRAY) {<NEW_LINE>Type[] clazzArray = defaultValue.asClassArray();<NEW_LINE>ResultHandle array = staticConstructor.newArray(returnTypeName, clazzArray.length);<NEW_LINE>for (int i = 0; i < clazzArray.length; ++i) {<NEW_LINE>staticConstructor.writeArrayValue(array, staticConstructor.load(i), staticConstructor.loadClass(clazzArray[i].name().toString()));<NEW_LINE>}<NEW_LINE>staticConstructor.writeStaticField(fieldCreator.getFieldDescriptor(), array);<NEW_LINE>} else {<NEW_LINE>staticConstructor.writeStaticField(fieldCreator.getFieldDescriptor(), staticConstructor.loadClass(defaultValue.asClass().name().toString()));<NEW_LINE>}<NEW_LINE>}<NEW_LINE>staticConstructor.returnValue(null);<NEW_LINE>} | (defaultValueStaticFieldName(method), returnTypeName); |
1,173,162 | public void handleRequest(final HttpServerExchange exchange) throws Exception {<NEW_LINE>RateLimitResponse rateLimitResponse = rateLimiter.handleRequest(exchange, config.getKey());<NEW_LINE>if (rateLimitResponse.allow) {<NEW_LINE>Handler.next(exchange, next);<NEW_LINE>} else {<NEW_LINE>exchange.getResponseHeaders().add(new HttpString(Constants.RATELIMIT_LIMIT), rateLimitResponse.getHeaders().get(Constants.RATELIMIT_LIMIT));<NEW_LINE>exchange.getResponseHeaders().add(new HttpString(Constants.RATELIMIT_REMAINING), rateLimitResponse.getHeaders().get(Constants.RATELIMIT_REMAINING));<NEW_LINE>exchange.getResponseHeaders().add(new HttpString(Constants.RATELIMIT_RESET), rateLimitResponse.getHeaders().get(Constants.RATELIMIT_RESET));<NEW_LINE>exchange.getResponseHeaders().add(new HttpString("Content-Type"), "application/json");<NEW_LINE>exchange.setStatusCode(config.getErrorCode() == 0 ? HttpStatus.TOO_MANY_REQUESTS.value(<MASK><NEW_LINE>exchange.getResponseSender().send(mapper.writeValueAsString(rateLimitResponse));<NEW_LINE>}<NEW_LINE>} | ) : config.getErrorCode()); |
903,870 | public Result implement(EnumerableRelImplementor implementor, Prefer pref) {<NEW_LINE>final BlockBuilder builder = new BlockBuilder();<NEW_LINE>final Result leftResult = implementor.visitChild(this, 0, (EnumerableRel) left, pref);<NEW_LINE>Expression leftExpression = builder.append("left", leftResult.block);<NEW_LINE>final BlockBuilder corrBlock = new BlockBuilder();<NEW_LINE>Type corrVarType = leftResult.physType.getJavaRowType();<NEW_LINE>// correlate to be used in inner loop<NEW_LINE>ParameterExpression corrRef;<NEW_LINE>// argument to correlate lambda (must be boxed)<NEW_LINE>ParameterExpression corrArg;<NEW_LINE>if (!Primitive.is(corrVarType)) {<NEW_LINE>corrArg = Expressions.parameter(Modifier.FINAL, corrVarType, getCorrelVariable());<NEW_LINE>corrRef = corrArg;<NEW_LINE>} else {<NEW_LINE>corrArg = Expressions.parameter(Modifier.FINAL, Primitive.box(corrVarType<MASK><NEW_LINE>corrRef = (ParameterExpression) corrBlock.append(getCorrelVariable(), Expressions.unbox(corrArg));<NEW_LINE>}<NEW_LINE>implementor.registerCorrelVariable(getCorrelVariable(), corrRef, corrBlock, leftResult.physType);<NEW_LINE>final Result rightResult = implementor.visitChild(this, 1, (EnumerableRel) right, pref);<NEW_LINE>implementor.clearCorrelVariable(getCorrelVariable());<NEW_LINE>corrBlock.add(rightResult.block);<NEW_LINE>final PhysType physType = PhysTypeImpl.of(implementor.getTypeFactory(), getRowType(), pref.prefer(JavaRowFormat.CUSTOM));<NEW_LINE>Expression selector = EnumUtils.joinSelector(joinType, physType, ImmutableList.of(leftResult.physType, rightResult.physType));<NEW_LINE>builder.append(Expressions.call(leftExpression, BuiltInMethod.CORRELATE_JOIN.method, Expressions.constant(EnumUtils.toLinq4jJoinType(joinType)), Expressions.lambda(corrBlock.toBlock(), corrArg), selector));<NEW_LINE>return implementor.result(physType, builder.toBlock());<NEW_LINE>} | ), "$box" + getCorrelVariable()); |
1,071,177 | private BucketReduceResult mergeConsecutiveBuckets(List<Bucket> reducedBuckets, int mergeInterval, int roundingIdx, RoundingInfo roundingInfo, ReduceContext reduceContext) {<NEW_LINE>List<Bucket> <MASK><NEW_LINE>List<Bucket> sameKeyedBuckets = new ArrayList<>();<NEW_LINE>double key = roundingInfo.rounding.round(reducedBuckets.get(0).key);<NEW_LINE>for (int i = 0; i < reducedBuckets.size(); i++) {<NEW_LINE>Bucket bucket = reducedBuckets.get(i);<NEW_LINE>if (i % mergeInterval == 0 && sameKeyedBuckets.isEmpty() == false) {<NEW_LINE>reduceContext.consumeBucketsAndMaybeBreak(1);<NEW_LINE>mergedBuckets.add(sameKeyedBuckets.get(0).reduce(sameKeyedBuckets, roundingInfo.rounding, reduceContext));<NEW_LINE>sameKeyedBuckets.clear();<NEW_LINE>key = roundingInfo.rounding.round(bucket.key);<NEW_LINE>}<NEW_LINE>reduceContext.consumeBucketsAndMaybeBreak(-countInnerBucket(bucket) - 1);<NEW_LINE>sameKeyedBuckets.add(new Bucket(Math.round(key), bucket.docCount, format, bucket.aggregations));<NEW_LINE>}<NEW_LINE>if (sameKeyedBuckets.isEmpty() == false) {<NEW_LINE>reduceContext.consumeBucketsAndMaybeBreak(1);<NEW_LINE>mergedBuckets.add(sameKeyedBuckets.get(0).reduce(sameKeyedBuckets, roundingInfo.rounding, reduceContext));<NEW_LINE>}<NEW_LINE>return new BucketReduceResult(mergedBuckets, roundingInfo, roundingIdx, mergeInterval);<NEW_LINE>} | mergedBuckets = new ArrayList<>(); |
866,129 | public void handleEvent(Event event) {<NEW_LINE>try {<NEW_LINE>String url_str = feedUrl.getText();<NEW_LINE>URL url = new URL(url_str);<NEW_LINE>Map user_data = new HashMap();<NEW_LINE>user_data.put(SubscriptionManagerUI.SUB_EDIT_MODE_KEY, Boolean.TRUE);<NEW_LINE>boolean anonymous = anonCheck.getSelection();<NEW_LINE>String subs_name = subsName.getText().trim();<NEW_LINE>if (subs_name.length() == 0) {<NEW_LINE>subs_name = url_str;<NEW_LINE>}<NEW_LINE>Subscription subRSS = SubscriptionManagerFactory.getSingleton().createRSS(subs_name, url, SubscriptionHistory.DEFAULT_CHECK_INTERVAL_MINS, anonymous, user_data);<NEW_LINE>if (anonymous) {<NEW_LINE>subRSS.getHistory().setDownloadNetworks(new String[] { AENetworkClassifier.AT_I2P });<NEW_LINE>}<NEW_LINE>if (frequency != 0) {<NEW_LINE>subRSS.getHistory().setCheckFrequencyMins(frequency);<NEW_LINE>}<NEW_LINE>shell.close();<NEW_LINE>final String key = "Subscription_" + ByteFormatter.<MASK><NEW_LINE>MultipleDocumentInterface mdi = UIFunctionsManager.getUIFunctions().getMDI();<NEW_LINE>mdi.showEntryByID(key);<NEW_LINE>} catch (Throwable e) {<NEW_LINE>Utils.reportError(e);<NEW_LINE>}<NEW_LINE>} | encodeString(subRSS.getPublicKey()); |
54,543 | private static NodeEntry parseNode(ConfigurationNode configNode, String keyFieldName) {<NEW_LINE>Map<Object, ? extends ConfigurationNode> children = configNode.getChildrenMap();<NEW_LINE>if (children.isEmpty()) {<NEW_LINE>return null;<NEW_LINE>}<NEW_LINE>// if children.size == 1 and the only entry doesn't have a key called "permission" - assume<NEW_LINE>// the key refers to the name of the permission<NEW_LINE>if (children.size() == 1) {<NEW_LINE>Map.Entry<Object, ? extends ConfigurationNode> entry = Iterables.getFirst(<MASK><NEW_LINE>if (entry != null) {<NEW_LINE>String permission = entry.getKey().toString();<NEW_LINE>ConfigurationNode attributes = entry.getValue();<NEW_LINE>if (!permission.equals(keyFieldName) && !permission.isEmpty()) {<NEW_LINE>return new NodeEntry(permission, attributes);<NEW_LINE>}<NEW_LINE>}<NEW_LINE>}<NEW_LINE>// assume 'configNode' is the actual entry.<NEW_LINE>ConfigurationNode appended = children.get(keyFieldName);<NEW_LINE>if (appended == null) {<NEW_LINE>return null;<NEW_LINE>}<NEW_LINE>String permission = appended.getString("");<NEW_LINE>return new NodeEntry(permission, configNode);<NEW_LINE>} | children.entrySet(), null); |
1,668,094 | public void externalCompactionFailed(ExternalCompactionId ecid) {<NEW_LINE>synchronized (this) {<NEW_LINE>if (closed)<NEW_LINE>return;<NEW_LINE>if (!externalCompactionsCommitting.add(ecid)) {<NEW_LINE>return;<NEW_LINE>}<NEW_LINE>}<NEW_LINE>try {<NEW_LINE>ExternalCompactionInfo ecInfo = externalCompactions.get(ecid);<NEW_LINE>if (ecInfo != null) {<NEW_LINE>tablet.getContext().getAmple().mutateTablet(getExtent()).deleteExternalCompaction(ecid).mutate();<NEW_LINE>completeCompaction(ecInfo.job, ecInfo.meta.getJobFiles(), null);<NEW_LINE>externalCompactions.remove(ecid);<NEW_LINE><MASK><NEW_LINE>} else {<NEW_LINE>log.debug("Ignoring request to fail external compaction that is unknown {}", ecid);<NEW_LINE>}<NEW_LINE>tablet.getContext().getAmple().deleteExternalCompactionFinalStates(List.of(ecid));<NEW_LINE>} finally {<NEW_LINE>synchronized (this) {<NEW_LINE>Preconditions.checkState(externalCompactionsCommitting.remove(ecid));<NEW_LINE>notifyAll();<NEW_LINE>}<NEW_LINE>}<NEW_LINE>} | log.debug("Processed external compaction failure {}", ecid); |
1,116,850 | protected void handlePostAsync(RoutingContext event, MultiMap form) throws Exception {<NEW_LINE>QuarkusBootstrap existing = (QuarkusBootstrap) DevConsoleManager.getQuarkusBootstrap();<NEW_LINE>try (TempSystemProperties properties = new TempSystemProperties()) {<NEW_LINE>for (Map.Entry<String, String> i : config.entrySet()) {<NEW_LINE>properties.set(i.getKey(), i.getValue());<NEW_LINE>}<NEW_LINE>for (Map.Entry<String, String> i : form.entries()) {<NEW_LINE>if (!i.getValue().isEmpty()) {<NEW_LINE>properties.set(i.getKey(), i.getValue());<NEW_LINE>}<NEW_LINE>}<NEW_LINE>QuarkusBootstrap quarkusBootstrap = existing.clonedBuilder().setMode(QuarkusBootstrap.Mode.PROD).setIsolateDeployment(true).build();<NEW_LINE>try (CuratedApplication bootstrap = quarkusBootstrap.bootstrap()) {<NEW_LINE>AugmentResult augmentResult = bootstrap.createAugmentor().createProductionApplication();<NEW_LINE>List<ArtifactResult> containerArtifactResults = augmentResult.resultsMatchingType((s) <MASK><NEW_LINE>if (containerArtifactResults.size() >= 1) {<NEW_LINE>flashMessage(event, "Container-image: " + containerArtifactResults.get(0).getMetadata().get("container-image") + " created.", Duration.ofSeconds(10));<NEW_LINE>}<NEW_LINE>}<NEW_LINE>}<NEW_LINE>;<NEW_LINE>} | -> s.contains("container")); |
1,415,989 | protected static void patchRsa256ForAuth(String deviceId, String publicKeyFilePath, String projectId, String cloudRegion, String registryName) throws GeneralSecurityException, IOException {<NEW_LINE>GoogleCredentials credential = GoogleCredentials.getApplicationDefault().createScoped(CloudIotScopes.all());<NEW_LINE>JsonFactory jsonFactory = JacksonFactory.getDefaultInstance();<NEW_LINE>HttpRequestInitializer init = new HttpCredentialsAdapter(credential);<NEW_LINE>final CloudIot service = new CloudIot.Builder(GoogleNetHttpTransport.newTrustedTransport(), jsonFactory, init).setApplicationName(APP_NAME).build();<NEW_LINE>final String devicePath = String.format("projects/%s/locations/%s/registries/%s/devices/%s", <MASK><NEW_LINE>PublicKeyCredential publicKeyCredential = new PublicKeyCredential();<NEW_LINE>String key = Files.toString(new File(publicKeyFilePath), Charsets.UTF_8);<NEW_LINE>publicKeyCredential.setKey(key);<NEW_LINE>publicKeyCredential.setFormat("RSA_X509_PEM");<NEW_LINE>DeviceCredential devCredential = new DeviceCredential();<NEW_LINE>devCredential.setPublicKey(publicKeyCredential);<NEW_LINE>Device device = new Device();<NEW_LINE>device.setCredentials(Collections.singletonList(devCredential));<NEW_LINE>Device patchedDevice = service.projects().locations().registries().devices().patch(devicePath, device).setUpdateMask("credentials").execute();<NEW_LINE>System.out.println("Patched device is " + patchedDevice.toPrettyString());<NEW_LINE>} | projectId, cloudRegion, registryName, deviceId); |
1,732,945 | public final GitProgressSupport scanStatus(final VCSContext context) {<NEW_LINE>Set<File> repositories = GitUtils.getRepositoryRoots(context);<NEW_LINE>if (repositories.isEmpty()) {<NEW_LINE>return null;<NEW_LINE>} else {<NEW_LINE>final Map<File, Collection<File>> toRefresh = new HashMap<File, Collection<File>>(repositories.size());<NEW_LINE>for (File repository : repositories) {<NEW_LINE>GitUtils.logRemoteRepositoryAccess(repository);<NEW_LINE>toRefresh.put(repository, Arrays.asList(GitUtils.<MASK><NEW_LINE>}<NEW_LINE>GitProgressSupport supp = new GitProgressSupport() {<NEW_LINE><NEW_LINE>@Override<NEW_LINE>protected void perform() {<NEW_LINE>long t = 0;<NEW_LINE>if (Git.STATUS_LOG.isLoggable(Level.FINE)) {<NEW_LINE>t = System.currentTimeMillis();<NEW_LINE>// NOI18N<NEW_LINE>Git.STATUS_LOG.log(Level.FINE, "StatusAction.scanStatus(): started for {0}", toRefresh.keySet());<NEW_LINE>}<NEW_LINE>Git.getInstance().getFileStatusCache().refreshAllRoots(toRefresh, getProgressMonitor());<NEW_LINE>if (Git.STATUS_LOG.isLoggable(Level.FINE)) {<NEW_LINE>// NOI18N<NEW_LINE>Git.STATUS_LOG.log(Level.FINE, "StatusAction.scanStatus(): lasted {0}", System.currentTimeMillis() - t);<NEW_LINE>}<NEW_LINE>}<NEW_LINE>};<NEW_LINE>// NOI18N<NEW_LINE>supp.start(Git.getInstance().getRequestProcessor(), null, NbBundle.getMessage(StatusAction.class, "LBL_ScanningStatuses"));<NEW_LINE>return supp;<NEW_LINE>}<NEW_LINE>} | filterForRepository(context, repository))); |
1,701,760 | public Entry<K, V> firstEntry() {<NEW_LINE>atomicOperationsManager.acquireReadLock(this);<NEW_LINE>try {<NEW_LINE>acquireSharedLock();<NEW_LINE>try {<NEW_LINE>final <MASK><NEW_LINE>BucketPath bucketPath = getBucket(HASH_CODE_MIN_VALUE, atomicOperation);<NEW_LINE>final long bucketPointer = directory.getNodePointer(bucketPath.nodeIndex, bucketPath.itemIndex, atomicOperation);<NEW_LINE>long pageIndex = getPageIndex(bucketPointer);<NEW_LINE>OCacheEntry cacheEntry = loadPageForRead(atomicOperation, fileId, pageIndex, false);<NEW_LINE>try {<NEW_LINE>OHashIndexBucket<K, V> bucket = new OHashIndexBucket<>(cacheEntry, keySerializer, valueSerializer, keyTypes);<NEW_LINE>while (bucket.size() == 0) {<NEW_LINE>bucketPath = nextBucketToFind(bucketPath, bucket.getDepth(), atomicOperation);<NEW_LINE>if (bucketPath == null) {<NEW_LINE>return null;<NEW_LINE>}<NEW_LINE>releasePageFromRead(atomicOperation, cacheEntry);<NEW_LINE>final long nextPointer = directory.getNodePointer(bucketPath.nodeIndex, bucketPath.itemIndex + bucketPath.hashMapOffset, atomicOperation);<NEW_LINE>pageIndex = getPageIndex(nextPointer);<NEW_LINE>cacheEntry = loadPageForRead(atomicOperation, fileId, pageIndex, false);<NEW_LINE>bucket = new OHashIndexBucket<>(cacheEntry, keySerializer, valueSerializer, keyTypes);<NEW_LINE>}<NEW_LINE>return bucket.getEntry(0);<NEW_LINE>} finally {<NEW_LINE>releasePageFromRead(atomicOperation, cacheEntry);<NEW_LINE>}<NEW_LINE>} finally {<NEW_LINE>releaseSharedLock();<NEW_LINE>}<NEW_LINE>} catch (final IOException ioe) {<NEW_LINE>throw OException.wrapException(new OLocalHashTableV3Exception("Exception during data read", this), ioe);<NEW_LINE>} finally {<NEW_LINE>atomicOperationsManager.releaseReadLock(this);<NEW_LINE>}<NEW_LINE>} | OAtomicOperation atomicOperation = atomicOperationsManager.getCurrentOperation(); |
878,215 | public static void writeFilePart(OutputStream output, FilePart filePart, String boundary) throws IOException {<NEW_LINE>IOUtils.write(StringTools.TWO_HYPHENS + boundary, output, StandardCharsets.UTF_8);<NEW_LINE>IOUtils.write(StringTools.CRLF, output, StandardCharsets.UTF_8);<NEW_LINE>IOUtils.write("Content-Disposition: form-data; name=\"" + filePart.getName().getBytes(StandardCharsets.UTF_8) + "\"; filename=\"" + filePart.getFileName().getBytes(StandardCharsets.UTF_8) + "\"", output, StandardCharsets.UTF_8);<NEW_LINE>IOUtils.write(StringTools.<MASK><NEW_LINE>IOUtils.write("Content-Length: " + filePart.getBytes().length, output, StandardCharsets.UTF_8);<NEW_LINE>IOUtils.write(StringTools.CRLF, output, StandardCharsets.UTF_8);<NEW_LINE>IOUtils.write("Content-Type: " + filePart.getContentType(), output, StandardCharsets.UTF_8);<NEW_LINE>IOUtils.write(StringTools.CRLF, output, StandardCharsets.UTF_8);<NEW_LINE>IOUtils.write(String.format("Content-Length: %d", filePart.getBytes().length), output, StandardCharsets.UTF_8);<NEW_LINE>IOUtils.write(StringTools.CRLF, output, StandardCharsets.UTF_8);<NEW_LINE>IOUtils.write(StringTools.CRLF, output, StandardCharsets.UTF_8);<NEW_LINE>IOUtils.write(filePart.getBytes(), output);<NEW_LINE>IOUtils.write(StringTools.CRLF, output, StandardCharsets.UTF_8);<NEW_LINE>} | CRLF, output, StandardCharsets.UTF_8); |
780,302 | public ValidationInfo validate(VALUETYPE newValue) {<NEW_LINE>if (validating) {<NEW_LINE>return new ValidationInfo(true);<NEW_LINE>}<NEW_LINE>ValidationInfo resultValidation = new ValidationInfo(true);<NEW_LINE>try {<NEW_LINE>validating = true;<NEW_LINE>// noinspection rawtypes<NEW_LINE>SwtParameterValidator[] validators = this.validators.toArray(new SwtParameterValidator[0]);<NEW_LINE>// noinspection unchecked<NEW_LINE>for (SwtParameterValidator<PARAMTYPE, VALUETYPE> validator : validators) {<NEW_LINE>ValidationInfo validationInfo = validator.isValidParameterValue(thisTyped, newValue);<NEW_LINE>if (validationInfo == null) {<NEW_LINE>continue;<NEW_LINE>}<NEW_LINE>if (!validationInfo.valid) {<NEW_LINE>resultValidation = validationInfo;<NEW_LINE>break;<NEW_LINE>} else if (validationInfo.info != null) {<NEW_LINE>if (resultValidation.info == null) {<NEW_LINE>resultValidation.info = validationInfo.info;<NEW_LINE>} else {<NEW_LINE>resultValidation<MASK><NEW_LINE>}<NEW_LINE>}<NEW_LINE>}<NEW_LINE>} finally {<NEW_LINE>validating = false;<NEW_LINE>}<NEW_LINE>updateControl(resultValidation);<NEW_LINE>return resultValidation;<NEW_LINE>} | .info += "\n" + validationInfo.info; |
1,342,843 | public static AlignmentInterval clipAlignmentInterval(final AlignmentInterval input, final int clipLengthOnRead, final boolean clipFrom3PrimeEnd) {<NEW_LINE>Utils.nonNull(input);<NEW_LINE>if (clipLengthOnRead < 0) {<NEW_LINE>throw new IllegalArgumentException("requesting negative clip length: " + clipLengthOnRead + " on " + input.toPackedString());<NEW_LINE>}<NEW_LINE>Utils.validateArg(clipLengthOnRead < input.endInAssembledContig - input.startInAssembledContig + 1, "input alignment to be clipped away: " + input.toPackedString() + "\twith clip length: " + clipLengthOnRead);<NEW_LINE>final Tuple2<SimpleInterval, Cigar> newRefSpanAndCigar = computeNewRefSpanAndCigar(input, clipLengthOnRead, clipFrom3PrimeEnd);<NEW_LINE>final Tuple2<Integer, Integer> newContigStartAndEnd = computeNewReadSpan(input.startInAssembledContig, input.endInAssembledContig, newRefSpanAndCigar._2, clipLengthOnRead, clipFrom3PrimeEnd);<NEW_LINE>return new AlignmentInterval(newRefSpanAndCigar._1, newContigStartAndEnd._1, newContigStartAndEnd._2, newRefSpanAndCigar._2, input.forwardStrand, input.mapQual, AlignmentInterval.NO_NM, <MASK><NEW_LINE>} | AlignmentInterval.NO_AS, AlnModType.UNDERGONE_OVERLAP_REMOVAL); |
9,946 | private JPanel initializeInnerFrame(Actor actorToInitializeFieldsWith) {<NEW_LINE>JPanel innerPanel = new JPanel();<NEW_LINE>GridBagLayout gridBagLayout = new GridBagLayout();<NEW_LINE>gridBagLayout.columnWeights = new double[] { 0.0, 1.0 };<NEW_LINE>innerPanel.setLayout(gridBagLayout);<NEW_LINE>JLabel lblActor = new JLabel("Actor Name:");<NEW_LINE>GridBagConstraints gbc_lblActor = new GridBagConstraints();<NEW_LINE>gbc_lblActor.anchor = GridBagConstraints.EAST;<NEW_LINE>gbc_lblActor.insets = new Insets(0, 0, 5, 5);<NEW_LINE>gbc_lblActor.gridx = 0;<NEW_LINE>gbc_lblActor.gridy = 0;<NEW_LINE>innerPanel.add(lblActor, gbc_lblActor);<NEW_LINE>textFieldActor = new JTextField();<NEW_LINE>if (actorToInitializeFieldsWith.getName() != null && actorToInitializeFieldsWith.getName().length() > 0) {<NEW_LINE>textFieldActor.setText(actorToInitializeFieldsWith.getName());<NEW_LINE>}<NEW_LINE>GridBagConstraints gbc_textFieldActor = new GridBagConstraints();<NEW_LINE>gbc_textFieldActor.insets = new Insets(0, 0, 5, 0);<NEW_LINE>gbc_textFieldActor.fill = GridBagConstraints.HORIZONTAL;<NEW_LINE>gbc_textFieldActor.gridx = 1;<NEW_LINE>gbc_textFieldActor.gridy = 0;<NEW_LINE>innerPanel.add(textFieldActor, gbc_textFieldActor);<NEW_LINE>textFieldActor.setColumns(10);<NEW_LINE>JLabel lblActorRole = new JLabel("Actor Role:");<NEW_LINE>GridBagConstraints gbc_lblActorRole = new GridBagConstraints();<NEW_LINE>gbc_lblActorRole.anchor = GridBagConstraints.EAST;<NEW_LINE>gbc_lblActorRole.insets = new Insets(0, 0, 5, 5);<NEW_LINE>gbc_lblActorRole.gridx = 0;<NEW_LINE>gbc_lblActorRole.gridy = 1;<NEW_LINE>innerPanel.add(lblActorRole, gbc_lblActorRole);<NEW_LINE>textFieldActorRole = new JTextField();<NEW_LINE>if (actorToInitializeFieldsWith.getRole() != null && actorToInitializeFieldsWith.getRole().length() > 0) {<NEW_LINE>textFieldActorRole.<MASK><NEW_LINE>}<NEW_LINE>GridBagConstraints gbc_textFieldActorRole = new GridBagConstraints();<NEW_LINE>gbc_textFieldActorRole.insets = new Insets(0, 0, 5, 0);<NEW_LINE>gbc_textFieldActorRole.fill = GridBagConstraints.HORIZONTAL;<NEW_LINE>gbc_textFieldActorRole.gridx = 1;<NEW_LINE>gbc_textFieldActorRole.gridy = 1;<NEW_LINE>innerPanel.add(textFieldActorRole, gbc_textFieldActorRole);<NEW_LINE>textFieldActor.setColumns(10);<NEW_LINE>JLabel lblNewLabel = new JLabel("URL :");<NEW_LINE>GridBagConstraints gbc_lblNewLabel = new GridBagConstraints();<NEW_LINE>gbc_lblNewLabel.anchor = GridBagConstraints.EAST;<NEW_LINE>gbc_lblNewLabel.insets = new Insets(0, 0, 5, 5);<NEW_LINE>gbc_lblNewLabel.gridx = 0;<NEW_LINE>gbc_lblNewLabel.gridy = 2;<NEW_LINE>innerPanel.add(lblNewLabel, gbc_lblNewLabel);<NEW_LINE>textFieldURL = new JTextField();<NEW_LINE>if (actorToInitializeFieldsWith.getThumb() != null && actorToInitializeFieldsWith.getThumb().getThumbURL() != null && actorToInitializeFieldsWith.getThumb().getThumbURL().toString().length() > 0) {<NEW_LINE>textFieldURL.setText(actorToInitializeFieldsWith.getThumb().getThumbURL().toString());<NEW_LINE>}<NEW_LINE>GridBagConstraints gbc_textFieldURL = new GridBagConstraints();<NEW_LINE>gbc_textFieldURL.insets = new Insets(0, 0, 5, 0);<NEW_LINE>gbc_textFieldURL.fill = GridBagConstraints.HORIZONTAL;<NEW_LINE>gbc_textFieldURL.gridx = 1;<NEW_LINE>gbc_textFieldURL.gridy = 2;<NEW_LINE>innerPanel.add(textFieldURL, gbc_textFieldURL);<NEW_LINE>textFieldURL.setColumns(10);<NEW_LINE>return innerPanel;<NEW_LINE>} | setText(actorToInitializeFieldsWith.getRole()); |
1,124,205 | public int compareTo(ExecutableTypeData o2) {<NEW_LINE>ExecutableTypeData o1 = this;<NEW_LINE>ProcessorContext context = ProcessorContext.getInstance();<NEW_LINE>if (canDelegateTo(o2)) {<NEW_LINE>if (!o2.canDelegateTo(this)) {<NEW_LINE>return 1;<NEW_LINE>}<NEW_LINE>} else if (o2.canDelegateTo(this)) {<NEW_LINE>return -1;<NEW_LINE>}<NEW_LINE>int result = Integer.compare(o2.getEvaluatedCount(), o1.getEvaluatedCount());<NEW_LINE>if (result != 0) {<NEW_LINE>return result;<NEW_LINE>}<NEW_LINE>result = Boolean.compare(o1.hasUnexpectedValue(), o2.hasUnexpectedValue());<NEW_LINE>if (result != 0) {<NEW_LINE>return result;<NEW_LINE>}<NEW_LINE>result = compareType(context, o1.getReturnType(), o2.getReturnType());<NEW_LINE>if (result != 0) {<NEW_LINE>return result;<NEW_LINE>}<NEW_LINE>result = compareType(context, o1.getFrameParameter(), o2.getFrameParameter());<NEW_LINE>if (result != 0) {<NEW_LINE>return result;<NEW_LINE>}<NEW_LINE>for (int i = 0; i < o1.getEvaluatedCount(); i++) {<NEW_LINE>result = compareType(context, o1.getEvaluatedParameters().get(i), o2.getEvaluatedParameters().get(i));<NEW_LINE>if (result != 0) {<NEW_LINE>return result;<NEW_LINE>}<NEW_LINE>}<NEW_LINE>result = o1.getUniqueName().compareTo(o2.getUniqueName());<NEW_LINE>if (result != 0) {<NEW_LINE>return result;<NEW_LINE>}<NEW_LINE>if (o1.getMethod() != null && o2.getMethod() != null) {<NEW_LINE>result = ElementUtils.compareMethod(o1.getMethod(<MASK><NEW_LINE>if (result != 0) {<NEW_LINE>return result;<NEW_LINE>}<NEW_LINE>}<NEW_LINE>return 0;<NEW_LINE>} | ), o2.getMethod()); |
1,514,079 | public void onPostLinkableClicked(Post post, PostLinkable linkable) {<NEW_LINE>if (linkable.type == PostLinkable.Type.QUOTE) {<NEW_LINE>Post linked = findPostById((int) linkable.value);<NEW_LINE>if (linked != null) {<NEW_LINE>threadPresenterCallback.showPostsPopup(post, Collections.singletonList(linked));<NEW_LINE>}<NEW_LINE>} else if (linkable.type == PostLinkable.Type.LINK) {<NEW_LINE>threadPresenterCallback.openLink((String) linkable.value);<NEW_LINE>} else if (linkable.type == PostLinkable.Type.THREAD) {<NEW_LINE>PostLinkable.ThreadLink link = (PostLinkable.ThreadLink) linkable.value;<NEW_LINE>Board board = loadable.<MASK><NEW_LINE>if (board != null) {<NEW_LINE>Loadable thread = databaseManager.getDatabaseLoadableManager().get(Loadable.forThread(board.site, board, link.threadId));<NEW_LINE>thread.markedNo = link.postId;<NEW_LINE>threadPresenterCallback.showThread(thread);<NEW_LINE>}<NEW_LINE>}<NEW_LINE>} | site.board(link.board); |
979,087 | // OnLoadedListener implementation.<NEW_LINE>@Override<NEW_LINE>public void onNativeAdLoaded(NativeAd nativeAd) {<NEW_LINE>// If this callback occurs after the activity is destroyed, you must call<NEW_LINE>// destroy and return or you may get a memory leak.<NEW_LINE>boolean isDestroyed = false;<NEW_LINE>refresh.setEnabled(true);<NEW_LINE>if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.JELLY_BEAN_MR1) {<NEW_LINE>isDestroyed = isDestroyed();<NEW_LINE>}<NEW_LINE>if (isDestroyed || isFinishing() || isChangingConfigurations()) {<NEW_LINE>nativeAd.destroy();<NEW_LINE>return;<NEW_LINE>}<NEW_LINE>// You must call destroy on old ads when you are done with them,<NEW_LINE>// otherwise you will have a memory leak.<NEW_LINE>if (MainActivity.this.nativeAd != null) {<NEW_LINE>MainActivity.this.nativeAd.destroy();<NEW_LINE>}<NEW_LINE>MainActivity.this.nativeAd = nativeAd;<NEW_LINE>FrameLayout frameLayout = findViewById(R.id.fl_adplaceholder);<NEW_LINE>NativeAdView adView = (NativeAdView) getLayoutInflater().inflate(<MASK><NEW_LINE>populateNativeAdView(nativeAd, adView);<NEW_LINE>frameLayout.removeAllViews();<NEW_LINE>frameLayout.addView(adView);<NEW_LINE>} | R.layout.ad_unified, null); |
105,387 | final GetAutoTerminationPolicyResult executeGetAutoTerminationPolicy(GetAutoTerminationPolicyRequest getAutoTerminationPolicyRequest) {<NEW_LINE>ExecutionContext executionContext = createExecutionContext(getAutoTerminationPolicyRequest);<NEW_LINE>AWSRequestMetrics awsRequestMetrics = executionContext.getAwsRequestMetrics();<NEW_LINE>awsRequestMetrics.startEvent(Field.ClientExecuteTime);<NEW_LINE>Request<GetAutoTerminationPolicyRequest> request = null;<NEW_LINE>Response<GetAutoTerminationPolicyResult> response = null;<NEW_LINE>try {<NEW_LINE>awsRequestMetrics.startEvent(Field.RequestMarshallTime);<NEW_LINE>try {<NEW_LINE>request = new GetAutoTerminationPolicyRequestProtocolMarshaller(protocolFactory).marshall(super.beforeMarshalling(getAutoTerminationPolicyRequest));<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, "EMR");<NEW_LINE>request.addHandlerContext(HandlerContextKey.OPERATION_NAME, "GetAutoTerminationPolicy");<NEW_LINE>request.addHandlerContext(HandlerContextKey.ADVANCED_CONFIG, advancedConfig);<NEW_LINE>} finally {<NEW_LINE>awsRequestMetrics.endEvent(Field.RequestMarshallTime);<NEW_LINE>}<NEW_LINE>HttpResponseHandler<AmazonWebServiceResponse<GetAutoTerminationPolicyResult>> responseHandler = protocolFactory.createResponseHandler(new JsonOperationMetadata().withPayloadJson(true).withHasStreamingSuccessResponse(false), new GetAutoTerminationPolicyResultJsonUnmarshaller());<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); |
668,643 | public static GetAsrVocabResponse unmarshall(GetAsrVocabResponse getAsrVocabResponse, UnmarshallerContext _ctx) {<NEW_LINE>getAsrVocabResponse.setRequestId(_ctx.stringValue("GetAsrVocabResponse.RequestId"));<NEW_LINE>getAsrVocabResponse.setCode(_ctx.stringValue("GetAsrVocabResponse.Code"));<NEW_LINE>getAsrVocabResponse.setMessage(_ctx.stringValue("GetAsrVocabResponse.Message"));<NEW_LINE>getAsrVocabResponse.setSuccess<MASK><NEW_LINE>Data data = new Data();<NEW_LINE>data.setName(_ctx.stringValue("GetAsrVocabResponse.Data.Name"));<NEW_LINE>List<Word> words = new ArrayList<Word>();<NEW_LINE>for (int i = 0; i < _ctx.lengthValue("GetAsrVocabResponse.Data.Words.Length"); i++) {<NEW_LINE>Word word = new Word();<NEW_LINE>word.setWeight(_ctx.integerValue("GetAsrVocabResponse.Data.Words[" + i + "].Weight"));<NEW_LINE>word.setWord(_ctx.stringValue("GetAsrVocabResponse.Data.Words[" + i + "].Word"));<NEW_LINE>words.add(word);<NEW_LINE>}<NEW_LINE>data.setWords(words);<NEW_LINE>getAsrVocabResponse.setData(data);<NEW_LINE>return getAsrVocabResponse;<NEW_LINE>} | (_ctx.booleanValue("GetAsrVocabResponse.Success")); |
1,483,891 | public void invokePost() {<NEW_LINE>StringEntity stringEntity = new StringEntity(prepareRequest());<NEW_LINE>HttpPost httpPost = new HttpPost("https://reqbin.com/echo/post/json");<NEW_LINE>httpPost.setEntity(stringEntity);<NEW_LINE>httpPost.setHeader("Accept", "application/json");<NEW_LINE>httpPost.setHeader("Content-type", "application/json");<NEW_LINE>try (CloseableHttpClient httpClient = HttpClients.createDefault();<NEW_LINE>CloseableHttpResponse response = httpClient.execute(httpPost)) {<NEW_LINE>// Get HttpResponse Status<NEW_LINE>// HTTP/1.1<NEW_LINE>System.out.println("version " + response.getVersion());<NEW_LINE>// 200<NEW_LINE>System.out.println(response.getCode());<NEW_LINE>// OK<NEW_LINE>System.out.println(response.getReasonPhrase());<NEW_LINE>HttpEntity entity = response.getEntity();<NEW_LINE>if (entity != null) {<NEW_LINE>// return it as a String<NEW_LINE>String <MASK><NEW_LINE>System.out.println(result);<NEW_LINE>}<NEW_LINE>} catch (ParseException | IOException e) {<NEW_LINE>// TODO Auto-generated catch block<NEW_LINE>e.printStackTrace();<NEW_LINE>}<NEW_LINE>} | result = EntityUtils.toString(entity); |
1,330,873 | public static Map<String, Object> merge(Map<String, Object> source, Map<String, Object> defaultMap) {<NEW_LINE>if (source == null) {<NEW_LINE>source = Collections.emptyMap();<NEW_LINE>}<NEW_LINE>if (defaultMap == null) {<NEW_LINE>defaultMap = Collections.emptyMap();<NEW_LINE>}<NEW_LINE>Map<String, Object> result = new HashMap<>(defaultMap);<NEW_LINE>for (String key : source.keySet()) {<NEW_LINE>Object <MASK><NEW_LINE>Object resultValue = result.get(key);<NEW_LINE>if (resultValue instanceof Map || sourceValue instanceof Map) {<NEW_LINE>@SuppressWarnings(value = "unchecked")<NEW_LINE>Map<String, Object> subDefault = (Map<String, Object>) resultValue;<NEW_LINE>@SuppressWarnings(value = "unchecked")<NEW_LINE>Map<String, Object> subSource = (Map<String, Object>) sourceValue;<NEW_LINE>result.put(key, merge(subSource, subDefault));<NEW_LINE>} else {<NEW_LINE>result.put(key, sourceValue);<NEW_LINE>}<NEW_LINE>}<NEW_LINE>return result;<NEW_LINE>} | sourceValue = source.get(key); |
446,238 | private void drawCube(GL2 gl) {<NEW_LINE>// Six faces of cube<NEW_LINE>// Top face<NEW_LINE>gl.glPushMatrix();<NEW_LINE>gl.glRotatef(-90, 1, 0, 0);<NEW_LINE>gl.glRotatef(180, 0, 0, 1);<NEW_LINE>drawFace(gl, size, color, border, "Y+");<NEW_LINE>gl.glPopMatrix();<NEW_LINE>// Front face<NEW_LINE>drawFace(gl, size, color, border, "Z+");<NEW_LINE>// Right face<NEW_LINE>gl.glPushMatrix();<NEW_LINE>gl.glRotatef(90, 0, 1, 0);<NEW_LINE>gl.glPushMatrix();<NEW_LINE>gl.glRotatef(90, 0, 0, 1);<NEW_LINE>drawFace(gl, size, color, border, "X+");<NEW_LINE>gl.glPopMatrix();<NEW_LINE>// Back face<NEW_LINE>gl.glRotatef(90, 0, 1, 0);<NEW_LINE>gl.glPushMatrix();<NEW_LINE>gl.glRotatef(180, 0, 0, 1);<NEW_LINE>drawFace(gl, size, color, border, "Z-");<NEW_LINE>gl.glPopMatrix();<NEW_LINE>// Left face<NEW_LINE>gl.glRotatef(90, 0, 1, 0);<NEW_LINE>gl.glRotatef(-90, 0, 0, 1);<NEW_LINE>drawFace(gl, size, color, border, "X-");<NEW_LINE>gl.glPopMatrix();<NEW_LINE>// Bottom face<NEW_LINE>gl.glPushMatrix();<NEW_LINE>gl.glRotatef(90, 1, 0, 0);<NEW_LINE>drawFace(gl, <MASK><NEW_LINE>gl.glPopMatrix();<NEW_LINE>} | size, color, border, "Y-"); |
1,759,666 | public boolean apply(Game game, Ability source) {<NEW_LINE>Player targetPlayer = game.getPlayer(targetPointer.getFirst(game, source));<NEW_LINE>Player controller = game.getPlayer(source.getControllerId());<NEW_LINE>MageObject sourceObject = game.getObject(source);<NEW_LINE>String cardName = (String) game.getState().getValue(source.getSourceId().<MASK><NEW_LINE>if (targetPlayer != null && controller != null && sourceObject != null && cardName != null) {<NEW_LINE>boolean hasDiscarded = false;<NEW_LINE>for (Card card : targetPlayer.getHand().getCards(game)) {<NEW_LINE>if (CardUtil.haveSameNames(card, cardName, game)) {<NEW_LINE>targetPlayer.discard(card, false, source, game);<NEW_LINE>hasDiscarded = true;<NEW_LINE>break;<NEW_LINE>}<NEW_LINE>}<NEW_LINE>if (!hasDiscarded) {<NEW_LINE>controller.drawCards(1, source, game);<NEW_LINE>}<NEW_LINE>controller.lookAtCards(sourceObject.getName() + " Hand", targetPlayer.getHand(), game);<NEW_LINE>}<NEW_LINE>return true;<NEW_LINE>} | toString() + ChooseACardNameEffect.INFO_KEY); |
353,993 | public boolean isOutputUpToDate(@Nonnull ArtifactPackagingItemOutputState state) {<NEW_LINE>final SmartList<Pair<String, <MASK><NEW_LINE>if (cachedDestinations.size() != myDestinations.size()) {<NEW_LINE>return false;<NEW_LINE>}<NEW_LINE>for (DestinationInfo info : myDestinations) {<NEW_LINE>final VirtualFile outputFile = info.getOutputFile();<NEW_LINE>long timestamp = outputFile != null ? outputFile.getTimeStamp() : -1;<NEW_LINE>final String path = info.getOutputPath();<NEW_LINE>boolean found = false;<NEW_LINE>// todo[nik] use map if list contains many items<NEW_LINE>for (Pair<String, Long> cachedDestination : cachedDestinations) {<NEW_LINE>if (cachedDestination.first.equals(path)) {<NEW_LINE>if (cachedDestination.second != timestamp)<NEW_LINE>return false;<NEW_LINE>found = true;<NEW_LINE>break;<NEW_LINE>}<NEW_LINE>}<NEW_LINE>if (!found)<NEW_LINE>return false;<NEW_LINE>}<NEW_LINE>return true;<NEW_LINE>} | Long>> cachedDestinations = state.myDestinations; |
1,386,893 | public NtpPayload unmarshall(JsonUnmarshallerContext context) throws Exception {<NEW_LINE>NtpPayload ntpPayload = new NtpPayload();<NEW_LINE><MASK><NEW_LINE>String currentParentElement = context.getCurrentParentElement();<NEW_LINE>int targetDepth = originalDepth + 1;<NEW_LINE>JsonToken token = context.getCurrentToken();<NEW_LINE>if (token == null)<NEW_LINE>token = context.nextToken();<NEW_LINE>if (token == VALUE_NULL) {<NEW_LINE>return null;<NEW_LINE>}<NEW_LINE>while (true) {<NEW_LINE>if (token == null)<NEW_LINE>break;<NEW_LINE>if (token == FIELD_NAME || token == START_OBJECT) {<NEW_LINE>if (context.testExpression("NtpServers", targetDepth)) {<NEW_LINE>context.nextToken();<NEW_LINE>ntpPayload.setNtpServers(new ListUnmarshaller<String>(context.getUnmarshaller(String.class)).unmarshall(context));<NEW_LINE>}<NEW_LINE>} else if (token == END_ARRAY || token == END_OBJECT) {<NEW_LINE>if (context.getLastParsedParentElement() == null || context.getLastParsedParentElement().equals(currentParentElement)) {<NEW_LINE>if (context.getCurrentDepth() <= originalDepth)<NEW_LINE>break;<NEW_LINE>}<NEW_LINE>}<NEW_LINE>token = context.nextToken();<NEW_LINE>}<NEW_LINE>return ntpPayload;<NEW_LINE>} | int originalDepth = context.getCurrentDepth(); |
670,221 | public void execute(ActivityExecution execution) {<NEW_LINE>readFields(execution);<NEW_LINE>List<String> argList = new ArrayList<String>();<NEW_LINE>argList.add(commandStr);<NEW_LINE>if (arg1Str != null)<NEW_LINE>argList.add(arg1Str);<NEW_LINE>if (arg2Str != null)<NEW_LINE>argList.add(arg2Str);<NEW_LINE>if (arg3Str != null)<NEW_LINE>argList.add(arg3Str);<NEW_LINE>if (arg4Str != null)<NEW_LINE>argList.add(arg4Str);<NEW_LINE>if (arg5Str != null)<NEW_LINE>argList.add(arg5Str);<NEW_LINE>ProcessBuilder processBuilder = new ProcessBuilder(argList);<NEW_LINE>try {<NEW_LINE>processBuilder.redirectErrorStream(redirectErrorFlag);<NEW_LINE>if (cleanEnvBoolan) {<NEW_LINE>Map<String, String> env = processBuilder.environment();<NEW_LINE>env.clear();<NEW_LINE>}<NEW_LINE>if (directoryStr != null && directoryStr.length() > 0)<NEW_LINE>processBuilder.directory(new File(directoryStr));<NEW_LINE>Process process = processBuilder.start();<NEW_LINE>if (waitFlag) {<NEW_LINE>int errorCode = process.waitFor();<NEW_LINE>if (resultVariableStr != null) {<NEW_LINE>String result = convertStreamToStr(process.getInputStream());<NEW_LINE><MASK><NEW_LINE>}<NEW_LINE>if (errorCodeVariableStr != null) {<NEW_LINE>execution.setVariable(errorCodeVariableStr, Integer.toString(errorCode));<NEW_LINE>}<NEW_LINE>}<NEW_LINE>} catch (Exception e) {<NEW_LINE>throw LOG.shellExecutionException(e);<NEW_LINE>}<NEW_LINE>leave(execution);<NEW_LINE>} | execution.setVariable(resultVariableStr, result); |
1,520,072 | public static DescribeEarlyWarningResponse unmarshall(DescribeEarlyWarningResponse describeEarlyWarningResponse, UnmarshallerContext context) {<NEW_LINE>describeEarlyWarningResponse.setRequestId(context.stringValue("DescribeEarlyWarningResponse.RequestId"));<NEW_LINE>describeEarlyWarningResponse.setHasWarning(context.booleanValue("DescribeEarlyWarningResponse.HasWarning"));<NEW_LINE>describeEarlyWarningResponse.setBizCode(context.stringValue("DescribeEarlyWarningResponse.BizCode"));<NEW_LINE>List<EarlyWarning> earlyWarnings = new ArrayList<EarlyWarning>();<NEW_LINE>for (int i = 0; i < context.lengthValue("DescribeEarlyWarningResponse.EarlyWarnings.Length"); i++) {<NEW_LINE>EarlyWarning earlyWarning = new EarlyWarning();<NEW_LINE>earlyWarning.setWarnOpen(context.booleanValue("DescribeEarlyWarningResponse.EarlyWarnings[" + i + "].WarnOpen"));<NEW_LINE>earlyWarning.setTitle(context.stringValue("DescribeEarlyWarningResponse.EarlyWarnings[" + i + "].Title"));<NEW_LINE>earlyWarning.setContent(context.stringValue("DescribeEarlyWarningResponse.EarlyWarnings[" + i + "].Content"));<NEW_LINE>earlyWarning.setFrequency(context.stringValue<MASK><NEW_LINE>earlyWarning.setTimeOpen(context.booleanValue("DescribeEarlyWarningResponse.EarlyWarnings[" + i + "].TimeOpen"));<NEW_LINE>earlyWarning.setTimeBegin(context.stringValue("DescribeEarlyWarningResponse.EarlyWarnings[" + i + "].TimeBegin"));<NEW_LINE>earlyWarning.setTimeEnd(context.stringValue("DescribeEarlyWarningResponse.EarlyWarnings[" + i + "].TimeEnd"));<NEW_LINE>earlyWarning.setChannel(context.stringValue("DescribeEarlyWarningResponse.EarlyWarnings[" + i + "].Channel"));<NEW_LINE>earlyWarnings.add(earlyWarning);<NEW_LINE>}<NEW_LINE>describeEarlyWarningResponse.setEarlyWarnings(earlyWarnings);<NEW_LINE>return describeEarlyWarningResponse;<NEW_LINE>} | ("DescribeEarlyWarningResponse.EarlyWarnings[" + i + "].Frequency")); |
397,294 | public void renderHTML(PrintWriter writer, Map<String, String> params) {<NEW_LINE>int brokerId = Integer.parseInt(params.get("brokerid"));<NEW_LINE>String clusterName = params.get("cluster");<NEW_LINE>printHeader(writer);<NEW_LINE>writer.print("<div> <p><a href=\"/\">Home</a> > " + "<a href=\"/servlet/clusterinfo?name=" + clusterName + "\"> " + clusterName + "</a> > broker " + brokerId + "</p> </div>");<NEW_LINE>writer.print("<table class=\"table table-hover\"> ");<NEW_LINE>writer.print("<th class=\"active\"> Timestamp </th> ");<NEW_LINE>writer.print("<th class=\"active\"> Stats </th>");<NEW_LINE>writer.print("<tbody>");<NEW_LINE>try {<NEW_LINE><MASK><NEW_LINE>writer.print("</tbody></table>");<NEW_LINE>writer.print("</td> </tr>");<NEW_LINE>writer.print("</tbody> </table>");<NEW_LINE>} catch (Exception e) {<NEW_LINE>LOG.error("Unexpected exception : ", e);<NEW_LINE>e.printStackTrace(writer);<NEW_LINE>}<NEW_LINE>printFooter(writer);<NEW_LINE>} | generateBrokerHtml(writer, clusterName, brokerId); |
1,213,693 | private static void configureFileAnalyzer(String fileSpec, String analyzer) {<NEW_LINE>boolean prefix = false;<NEW_LINE>// removing '.' from file specification<NEW_LINE>// expecting either ".extensionName" or "prefixName."<NEW_LINE>if (fileSpec.endsWith(".")) {<NEW_LINE>fileSpec = fileSpec.substring(0, fileSpec.lastIndexOf('.'));<NEW_LINE>prefix = true;<NEW_LINE>} else {<NEW_LINE>fileSpec = fileSpec.substring(1);<NEW_LINE>}<NEW_LINE>fileSpec = fileSpec.toUpperCase(Locale.ROOT);<NEW_LINE>// Disable analyzer?<NEW_LINE>if (analyzer.equals("-")) {<NEW_LINE>if (prefix) {<NEW_LINE>AnalyzerGuru.addPrefix(fileSpec, null);<NEW_LINE>} else {<NEW_LINE>AnalyzerGuru.addExtension(fileSpec, null);<NEW_LINE>}<NEW_LINE>} else {<NEW_LINE>try {<NEW_LINE>if (prefix) {<NEW_LINE>AnalyzerGuru.addPrefix(fileSpec, AnalyzerGuru.findFactory(analyzer));<NEW_LINE>} else {<NEW_LINE>AnalyzerGuru.addExtension(fileSpec<MASK><NEW_LINE>}<NEW_LINE>} catch (ClassNotFoundException | IllegalAccessException | InstantiationException | NoSuchMethodException | InvocationTargetException e) {<NEW_LINE>LOGGER.log(Level.SEVERE, "Unable to locate FileAnalyzerFactory for {0}", analyzer);<NEW_LINE>LOGGER.log(Level.SEVERE, "Stack: ", e.fillInStackTrace());<NEW_LINE>System.exit(1);<NEW_LINE>}<NEW_LINE>}<NEW_LINE>} | , AnalyzerGuru.findFactory(analyzer)); |
521,803 | public void drawTextFieldCursor(Graphics g, TextArea ta) {<NEW_LINE>Style style = ta.getStyle();<NEW_LINE>Font f = style.getFont();<NEW_LINE>int cursorY;<NEW_LINE>if (ta.isSingleLineTextArea()) {<NEW_LINE>switch(ta.getVerticalAlignment()) {<NEW_LINE>case Component.BOTTOM:<NEW_LINE>cursorY = ta.getY() + ta.getHeight() - f.getHeight();<NEW_LINE>break;<NEW_LINE>case Component.CENTER:<NEW_LINE>cursorY = ta.getY() + ta.getHeight() / 2 - f.getHeight() / 2;<NEW_LINE>break;<NEW_LINE>default:<NEW_LINE>cursorY = ta.getY() + style.getPaddingTop();<NEW_LINE>break;<NEW_LINE>}<NEW_LINE>} else {<NEW_LINE>cursorY = ta.getY() + style.getPaddingTop() + ta.getCursorY() * (ta.getRowsGap() + f.getHeight());<NEW_LINE>}<NEW_LINE>int cursorX = getTextFieldCursorX(ta);<NEW_LINE>int align = reverseAlignForBidi(ta);<NEW_LINE>int x = 0;<NEW_LINE>if (align == Component.RIGHT) {<NEW_LINE>String inputMode = ta.getInputMode();<NEW_LINE>int inputModeWidth = f.stringWidth(inputMode);<NEW_LINE>int baseX = ta.getX() + style.getPaddingLeftNoRTL() + inputModeWidth;<NEW_LINE>if (cursorX < baseX) {<NEW_LINE>x = baseX - cursorX;<NEW_LINE>}<NEW_LINE>}<NEW_LINE>int oldColor = g.getColor();<NEW_LINE>int alpha = g.<MASK><NEW_LINE>if (getTextFieldCursorColor() == 0) {<NEW_LINE>g.setColor(style.getFgColor());<NEW_LINE>} else {<NEW_LINE>g.setColor(getTextFieldCursorColor());<NEW_LINE>}<NEW_LINE>g.drawLine(cursorX + x, cursorY, cursorX + x, cursorY + f.getHeight());<NEW_LINE>g.setColor(oldColor);<NEW_LINE>g.setAlpha(alpha);<NEW_LINE>} | concatenateAlpha(style.getFgAlpha()); |
944,958 | final DescribePatchGroupStateResult executeDescribePatchGroupState(DescribePatchGroupStateRequest describePatchGroupStateRequest) {<NEW_LINE>ExecutionContext executionContext = createExecutionContext(describePatchGroupStateRequest);<NEW_LINE>AWSRequestMetrics awsRequestMetrics = executionContext.getAwsRequestMetrics();<NEW_LINE>awsRequestMetrics.startEvent(Field.ClientExecuteTime);<NEW_LINE>Request<DescribePatchGroupStateRequest> request = null;<NEW_LINE>Response<DescribePatchGroupStateResult> response = null;<NEW_LINE>try {<NEW_LINE>awsRequestMetrics.startEvent(Field.RequestMarshallTime);<NEW_LINE>try {<NEW_LINE>request = new DescribePatchGroupStateRequestProtocolMarshaller(protocolFactory).marshall(super.beforeMarshalling(describePatchGroupStateRequest));<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, "SSM");<NEW_LINE>request.addHandlerContext(HandlerContextKey.OPERATION_NAME, "DescribePatchGroupState");<NEW_LINE>request.addHandlerContext(HandlerContextKey.ADVANCED_CONFIG, advancedConfig);<NEW_LINE>} finally {<NEW_LINE>awsRequestMetrics.endEvent(Field.RequestMarshallTime);<NEW_LINE>}<NEW_LINE>HttpResponseHandler<AmazonWebServiceResponse<DescribePatchGroupStateResult>> responseHandler = protocolFactory.createResponseHandler(new JsonOperationMetadata().withPayloadJson(true).withHasStreamingSuccessResponse(false), new DescribePatchGroupStateResultJsonUnmarshaller());<NEW_LINE>response = <MASK><NEW_LINE>return response.getAwsResponse();<NEW_LINE>} finally {<NEW_LINE>endClientExecution(awsRequestMetrics, request, response);<NEW_LINE>}<NEW_LINE>} | invoke(request, responseHandler, executionContext); |
430,974 | public static CdmTypeAttributeDefinition fromData(final CdmCorpusContext ctx, final JsonNode obj, final String entityName) {<NEW_LINE>if (obj == null) {<NEW_LINE>return null;<NEW_LINE>}<NEW_LINE>final CdmTypeAttributeDefinition typeAttribute = ctx.getCorpus().makeObject(CdmObjectType.TypeAttributeDef, obj.has("name") ? obj.get("name").asText() : null);<NEW_LINE>typeAttribute.setPurpose(PurposeReferencePersistence.fromData(ctx, obj.get("purpose")));<NEW_LINE>typeAttribute.setDataType(DataTypeReferencePersistence.fromData(ctx, obj.get("dataType")));<NEW_LINE>typeAttribute.setCardinality(Utils.cardinalitySettingsFromData(obj.get("cardinality"), typeAttribute));<NEW_LINE>typeAttribute.setAttributeContext(AttributeContextReferencePersistence.fromData(ctx, obj.get("attributeContext")));<NEW_LINE>Utils.addListToCdmCollection(typeAttribute.getAppliedTraits(), Utils.createTraitReferenceList(ctx, obj.get("appliedTraits")));<NEW_LINE>typeAttribute.setResolutionGuidance(AttributeResolutionGuidancePersistence.fromData(ctx, <MASK><NEW_LINE>if (obj.has("isPrimaryKey") && obj.get("isPrimaryKey").asBoolean() && entityName != null) {<NEW_LINE>TraitToPropertyMap t2pMap = new TraitToPropertyMap(typeAttribute);<NEW_LINE>t2pMap.updatePropertyValue(CdmPropertyName.IS_PRIMARY_KEY, entityName + "/(resolvedAttributes)/" + typeAttribute.getName());<NEW_LINE>}<NEW_LINE>typeAttribute.setExplanation(Utils.propertyFromDataToString(obj.get("explanation")));<NEW_LINE>typeAttribute.updateDescription(Utils.propertyFromDataToString(obj.get("description")));<NEW_LINE>typeAttribute.updateIsReadOnly(Utils.propertyFromDataToBoolean(obj.get("isReadOnly")));<NEW_LINE>typeAttribute.updateIsNullable(Utils.propertyFromDataToBoolean(obj.get("isNullable")));<NEW_LINE>typeAttribute.updateSourceName(Utils.propertyFromDataToString(obj.get("sourceName")));<NEW_LINE>typeAttribute.updateSourceOrdering(Utils.propertyFromDataToInt(obj.get("sourceOrdering")));<NEW_LINE>typeAttribute.updateDisplayName(Utils.propertyFromDataToString(obj.get("displayName")));<NEW_LINE>typeAttribute.updateValueConstrainedToList(Utils.propertyFromDataToBoolean(obj.get("valueConstrainedToList")));<NEW_LINE>typeAttribute.updateMaximumLength(Utils.propertyFromDataToInt(obj.get("maximumLength")));<NEW_LINE>typeAttribute.updateMaximumValue(Utils.propertyFromDataToString(obj.get("maximumValue")));<NEW_LINE>typeAttribute.updateMinimumValue(Utils.propertyFromDataToString(obj.get("minimumValue")));<NEW_LINE>typeAttribute.updateDefaultValue(obj.get("defaultValue"));<NEW_LINE>typeAttribute.setProjection(ProjectionPersistence.fromData(ctx, obj.get("projection")));<NEW_LINE>final String dataFormat = obj.has("dataFormat") ? obj.get("dataFormat").asText() : null;<NEW_LINE>if (dataFormat != null) {<NEW_LINE>CdmDataFormat cdmDataFormat = CdmDataFormat.fromString(dataFormat);<NEW_LINE>if (cdmDataFormat != CdmDataFormat.Unknown) {<NEW_LINE>typeAttribute.updateDataFormat(cdmDataFormat);<NEW_LINE>} else {<NEW_LINE>Logger.warning(ctx, TAG, "fromData", null, CdmLogCode.WarnPersistEnumNotFound, dataFormat);<NEW_LINE>}<NEW_LINE>}<NEW_LINE>return typeAttribute;<NEW_LINE>} | obj.get("resolutionGuidance"))); |
1,769,487 | /*<NEW_LINE>* StringToSign = VERB + "\n" + Content-Encoding + "\n" Content-Language +<NEW_LINE>* "\n" Content-Length + "\n" Content-MD5 + "\n" + Content-Type + "\n" +<NEW_LINE>* Date + "\n" + If-Modified-Since + "\n" If-Match + "\n" If-None-Match +<NEW_LINE>* "\n" If-Unmodified-Since + "\n" Range + "\n" CanonicalizedHeaders +<NEW_LINE>* CanonicalizedResource;<NEW_LINE>*/<NEW_LINE>public void sign(ClientRequest cr) {<NEW_LINE>// gather signed material<NEW_LINE>addOptionalDateHeader(cr);<NEW_LINE>// build signed string<NEW_LINE>String stringToSign = cr.getMethod() + "\n" + getHeader(cr, "Content-Encoding") + "\n" + getHeader(cr, "Content-Language") + "\n" + getHeader(cr, "Content-Length") + "\n" + getHeader(cr, "Content-MD5") + "\n" + getHeader(cr, "Content-Type") + "\n" + getHeader(cr, "Date") + "\n" + getHeader(cr, "If-Modified-Since") + "\n" + getHeader(cr, "If-Match") + "\n" + getHeader(cr, "If-None-Match") + "\n" + getHeader(cr, "If-Unmodified-Since") + "\n" + getHeader(cr, "Range") + "\n";<NEW_LINE>stringToSign += getCanonicalizedHeaders(cr);<NEW_LINE>stringToSign += getCanonicalizedResource(cr);<NEW_LINE>if (log.isDebugEnabled()) {<NEW_LINE>log.debug(String<MASK><NEW_LINE>}<NEW_LINE>// System.out.println(String.format("String to sign: \"%s\"",<NEW_LINE>// stringToSign));<NEW_LINE>String signature = this.signer.sign(stringToSign);<NEW_LINE>cr.getHeaders().putSingle("Authorization", "SharedKey " + this.accountName + ":" + signature);<NEW_LINE>} | .format("String to sign: \"%s\"", stringToSign)); |
1,624,288 | void addMenuItems() {<NEW_LINE>assert EventQueue.isDispatchThread();<NEW_LINE>if (tasks == null || tasks.getSimpleTasks() == null) {<NEW_LINE>// build tool cli error?<NEW_LINE>addConfigureToolMenuItem();<NEW_LINE>return;<NEW_LINE>}<NEW_LINE>// ui<NEW_LINE>VerticalGridLayout vgl = new VerticalGridLayout();<NEW_LINE>getPopupMenu().setLayout(vgl);<NEW_LINE>// items<NEW_LINE>List<String> simpleTasks = tasks.getSimpleTasks();<NEW_LINE>assert simpleTasks != null;<NEW_LINE>Set<String> allTasks <MASK><NEW_LINE>// default task<NEW_LINE>final String defaultTaskName = support.getDefaultTaskName();<NEW_LINE>if (defaultTaskName != null) {<NEW_LINE>allTasks.remove(defaultTaskName);<NEW_LINE>addTaskMenuItem(true, defaultTaskName);<NEW_LINE>addSeparator();<NEW_LINE>}<NEW_LINE>// other tasks<NEW_LINE>addAdvancedTasksMenuItems();<NEW_LINE>if (tasks.isShowSimpleTasks()) {<NEW_LINE>addTasksMenuItems(allTasks);<NEW_LINE>}<NEW_LINE>if (!tasks.getAdvancedTasks().isEmpty() || (tasks.isShowSimpleTasks() && !allTasks.isEmpty())) {<NEW_LINE>addSeparator();<NEW_LINE>}<NEW_LINE>// config<NEW_LINE>addManageMenuItems(allTasks);<NEW_LINE>addReloadTasksMenuItem();<NEW_LINE>} | = new LinkedHashSet<>(simpleTasks); |
444,602 | public void generateCode(MethodVisitor mv, CodeFlow cf) {<NEW_LINE>cf.loadEvaluationContext(mv);<NEW_LINE>String leftDesc = getLeftOperand().exitTypeDescriptor;<NEW_LINE>String rightDesc = getRightOperand().exitTypeDescriptor;<NEW_LINE>boolean leftPrim = CodeFlow.isPrimitive(leftDesc);<NEW_LINE>boolean rightPrim = CodeFlow.isPrimitive(rightDesc);<NEW_LINE>cf.enterCompilationScope();<NEW_LINE>getLeftOperand().generateCode(mv, cf);<NEW_LINE>cf.exitCompilationScope();<NEW_LINE>if (leftPrim) {<NEW_LINE>CodeFlow.insertBoxIfNecessary(mv, leftDesc.charAt(0));<NEW_LINE>}<NEW_LINE>cf.enterCompilationScope();<NEW_LINE>getRightOperand().generateCode(mv, cf);<NEW_LINE>cf.exitCompilationScope();<NEW_LINE>if (rightPrim) {<NEW_LINE>CodeFlow.insertBoxIfNecessary(mv, rightDesc.charAt(0));<NEW_LINE>}<NEW_LINE>String operatorClassName = Operator.class.getName().replace('.', '/');<NEW_LINE>String evaluationContextClassName = EvaluationContext.class.getName().replace('.', '/');<NEW_LINE>mv.visitMethodInsn(INVOKESTATIC, operatorClassName, "equalityCheck", "(L" + evaluationContextClassName + ";Ljava/lang/Object;Ljava/lang/Object;)Z", false);<NEW_LINE>// Invert the boolean<NEW_LINE>Label notZero = new Label();<NEW_LINE>Label end = new Label();<NEW_LINE><MASK><NEW_LINE>mv.visitInsn(ICONST_1);<NEW_LINE>mv.visitJumpInsn(GOTO, end);<NEW_LINE>mv.visitLabel(notZero);<NEW_LINE>mv.visitInsn(ICONST_0);<NEW_LINE>mv.visitLabel(end);<NEW_LINE>cf.pushDescriptor("Z");<NEW_LINE>} | mv.visitJumpInsn(IFNE, notZero); |
1,293,988 | protected DataSource buildAndInitMetaDbDataSource(Pair<String, Integer> metaDbAvailableAddr, int xport) {<NEW_LINE>// Note: Xproto is enabled when property in server.properties is enabled.<NEW_LINE>// Global switch.<NEW_LINE>final int defaultXport = XConnectionManager.getInstance().getMetaDbPort();<NEW_LINE>if (defaultXport > 0 || (0 == defaultXport && xport > 0)) {<NEW_LINE>final XDataSource newDs = new XDataSource(metaDbAvailableAddr.getKey(), defaultXport > 0 ? defaultXport : xport, this.metaDbUser, PasswdUtil.decrypt(this.metaDbEncPasswd), this.metaDbName, "metaDbXDataSource");<NEW_LINE>initXDataSourceByJdbcProps(newDs, <MASK><NEW_LINE>return newDs;<NEW_LINE>} else {<NEW_LINE>throw new NotSupportException("jdbc not supported");<NEW_LINE>}<NEW_LINE>} | this.metaDbProp, this.conf); |
958,007 | private <T> List<T> doFind(RedisOperationChain criteria, long offset, int rows, String keyspace, Class<T> type) {<NEW_LINE>if (criteria == null || (CollectionUtils.isEmpty(criteria.getOrSismember()) && CollectionUtils.isEmpty(criteria.getSismember())) && criteria.getNear() == null) {<NEW_LINE>return getAdapter().getAllOf(keyspace, type, offset, rows);<NEW_LINE>}<NEW_LINE>RedisCallback<Map<byte[], Map<byte[], byte[]>>> callback = connection -> {<NEW_LINE>List<byte[]> allKeys = new ArrayList<>();<NEW_LINE>if (!criteria.getSismember().isEmpty()) {<NEW_LINE>allKeys.addAll(connection.sInter(keys(keyspace + ":", criteria.getSismember())));<NEW_LINE>}<NEW_LINE>if (!criteria.getOrSismember().isEmpty()) {<NEW_LINE>allKeys.addAll(connection.sUnion(keys(keyspace + ":", criteria.getOrSismember())));<NEW_LINE>}<NEW_LINE>if (criteria.getNear() != null) {<NEW_LINE>GeoResults<GeoLocation<byte[]>> x = connection.geoRadius(geoKey(keyspace + ":", criteria.getNear()), new Circle(criteria.getNear().getPoint(), criteria.getNear().getDistance()));<NEW_LINE>for (GeoResult<GeoLocation<byte[]>> y : x) {<NEW_LINE>allKeys.add(y.getContent().getName());<NEW_LINE>}<NEW_LINE>}<NEW_LINE>byte[] keyspaceBin = getAdapter().getConverter().getConversionService().convert(keyspace + ":", byte[].class);<NEW_LINE>Map<byte[], Map<byte[], byte[]>> rawData = new LinkedHashMap<>();<NEW_LINE>if (allKeys.isEmpty() || allKeys.size() < offset) {<NEW_LINE>return Collections.emptyMap();<NEW_LINE>}<NEW_LINE>int offsetToUse = Math.max(0, (int) offset);<NEW_LINE>if (rows > 0) {<NEW_LINE>allKeys = allKeys.subList(Math.max(0, offsetToUse), Math.min(offsetToUse + rows, allKeys.size()));<NEW_LINE>}<NEW_LINE>for (byte[] id : allKeys) {<NEW_LINE>byte[] singleKey = ByteUtils.concat(keyspaceBin, id);<NEW_LINE>rawData.put(id, connection.hGetAll(singleKey));<NEW_LINE>}<NEW_LINE>return rawData;<NEW_LINE>};<NEW_LINE>Map<byte[], Map<byte[], byte[]>> raw = this.getAdapter().execute(callback);<NEW_LINE>List<T> result = new ArrayList<>(raw.size());<NEW_LINE>for (Map.Entry<byte[], Map<byte[], byte[]>> entry : raw.entrySet()) {<NEW_LINE>if (CollectionUtils.isEmpty(entry.getValue())) {<NEW_LINE>continue;<NEW_LINE>}<NEW_LINE>RedisData data = new RedisData(entry.getValue());<NEW_LINE>data.setId(getAdapter().getConverter().getConversionService().convert(entry.getKey(), String.class));<NEW_LINE>data.setKeyspace(keyspace);<NEW_LINE>T converted = this.getAdapter().getConverter(<MASK><NEW_LINE>result.add(converted);<NEW_LINE>}<NEW_LINE>return result;<NEW_LINE>} | ).read(type, data); |
763,943 | private void writeRepositoryMethodConfiguration(Class<?> typeToInspect, Class<?> repositoryDomainType, MethodFilter filter) {<NEW_LINE>ReflectionUtils.doWithMethods(typeToInspect, method -> {<NEW_LINE>Set<Class<?>> classes = TypeUtils.resolveTypesInSignature(ResolvableType<MASK><NEW_LINE>classes.stream().filter(it -> !SimpleTypeHolder.DEFAULT.isSimpleType(it)).forEach(it -> {<NEW_LINE>if (it.equals(repositoryDomainType)) {<NEW_LINE>return;<NEW_LINE>}<NEW_LINE>if (TypeUtils.type(it).isPartOf(SPRING_DATA_PACKAGE, JAVA_PACKAGE)) {<NEW_LINE>return;<NEW_LINE>}<NEW_LINE>if (isProjectionInterface(repositoryDomainType, it)) {<NEW_LINE>registry.proxy().add(NativeProxyEntry.ofInterfaces(it, TargetAware.class, SpringProxy.class, DecoratingProxy.class));<NEW_LINE>}<NEW_LINE>writeDomainTypeConfiguration(it);<NEW_LINE>});<NEW_LINE>writeAnnotationConfigurationFor(method);<NEW_LINE>}, filter);<NEW_LINE>} | .forMethodReturnType(method, typeToInspect)); |
443,052 | private String processUpdateAssetGroupDetails(final CreateUpdateAssetGroupDetails updateAssetGroupDetails, final Map<String, Object> assetGroupAlias, String userId) throws PacManException {<NEW_LINE>try {<NEW_LINE>AssetGroupDetails existingAssetGroupDetails = assetGroupRepository.findByGroupName(updateAssetGroupDetails.getGroupName());<NEW_LINE>existingAssetGroupDetails.setDisplayName(updateAssetGroupDetails.getDisplayName());<NEW_LINE>existingAssetGroupDetails.setGroupType(updateAssetGroupDetails.getType());<NEW_LINE>existingAssetGroupDetails.setDescription(updateAssetGroupDetails.getDescription());<NEW_LINE>existingAssetGroupDetails.<MASK><NEW_LINE>existingAssetGroupDetails.setModifiedUser(userId);<NEW_LINE>existingAssetGroupDetails.setModifiedDate(AdminUtils.getFormatedStringDate(DATE_FORMAT, new Date()));<NEW_LINE>existingAssetGroupDetails.setAliasQuery(mapper.writeValueAsString(assetGroupAlias));<NEW_LINE>existingAssetGroupDetails.setIsVisible(updateAssetGroupDetails.isVisible());<NEW_LINE>List<TargetTypesDetails> targetTypesDetails = updateAssetGroupDetails.getTargetTypes();<NEW_LINE>Set<AssetGroupTargetDetails> allTargetTypesDetails = buildTargetTypes(targetTypesDetails, existingAssetGroupDetails.getGroupId());<NEW_LINE>existingAssetGroupDetails.setTargetTypes(allTargetTypesDetails);<NEW_LINE>assetGroupRepository.saveAndFlush(existingAssetGroupDetails);<NEW_LINE>return ASSET_GROUP_UPDATION_SUCCESS;<NEW_LINE>} catch (Exception exception) {<NEW_LINE>log.error(UNEXPECTED_ERROR_OCCURRED, exception);<NEW_LINE>throw new PacManException(UNEXPECTED_ERROR_OCCURRED.concat(": ").concat(exception.getMessage()));<NEW_LINE>}<NEW_LINE>} | setCreatedBy(updateAssetGroupDetails.getCreatedBy()); |
511,588 | private void checkForUniqueNetNames(HDLCircuit hdlCircuit) throws HDLException {<NEW_LINE>ArrayList<HDLNet> nets = hdlCircuit.getNets();<NEW_LINE>// try to resolve duplicate names<NEW_LINE>for (HDLNet n : nets) if (n.isUserNamed())<NEW_LINE>for (HDLNet nn : nets) if (n.getName().equalsIgnoreCase(nn.getName()) && n != nn) {<NEW_LINE>String newName = "s_" + n.getName();<NEW_LINE>int i = 1;<NEW_LINE>while (exits(newName, nets)) newName = "s_" + n.<MASK><NEW_LINE>n.setName(newName);<NEW_LINE>}<NEW_LINE>// throw an exception if there is still a duplicate name<NEW_LINE>for (int i = 0; i < nets.size(); i++) {<NEW_LINE>final HDLNet n1 = nets.get(i);<NEW_LINE>for (int j = i + 1; j < nets.size(); j++) {<NEW_LINE>final HDLNet n2 = nets.get(j);<NEW_LINE>if (n1.getName().equalsIgnoreCase(n2.getName()))<NEW_LINE>throw new HDLException(Lang.get("err_namesAreNotUnique_N", n1.getName() + "==" + n2.getName()), hdlCircuit.getOrigin());<NEW_LINE>}<NEW_LINE>}<NEW_LINE>} | getName() + (i++); |
1,492,373 | public float noise2(float x, float y) {<NEW_LINE>int bx0, bx1, by0, by1, b00, b10, b01, b11;<NEW_LINE>float rx0, rx1, ry0, ry1, q[], sx, sy, a, b, t, u, v;<NEW_LINE>int i, j;<NEW_LINE>if (start) {<NEW_LINE>start = false;<NEW_LINE>init();<NEW_LINE>}<NEW_LINE>t = x + N;<NEW_LINE>bx0 = ((int) t) & BM;<NEW_LINE>bx1 = (bx0 + 1) & BM;<NEW_LINE>rx0 = t - (int) t;<NEW_LINE>rx1 = rx0 - 1.0f;<NEW_LINE>t = y + N;<NEW_LINE>by0 = <MASK><NEW_LINE>by1 = (by0 + 1) & BM;<NEW_LINE>ry0 = t - (int) t;<NEW_LINE>ry1 = ry0 - 1.0f;<NEW_LINE>i = p[bx0];<NEW_LINE>j = p[bx1];<NEW_LINE>b00 = p[i + by0];<NEW_LINE>b10 = p[j + by0];<NEW_LINE>b01 = p[i + by1];<NEW_LINE>b11 = p[j + by1];<NEW_LINE>sx = sCurve(rx0);<NEW_LINE>sy = sCurve(ry0);<NEW_LINE>q = g2[b00];<NEW_LINE>u = rx0 * q[0] + ry0 * q[1];<NEW_LINE>q = g2[b10];<NEW_LINE>v = rx1 * q[0] + ry0 * q[1];<NEW_LINE>a = lerp(sx, u, v);<NEW_LINE>q = g2[b01];<NEW_LINE>u = rx0 * q[0] + ry1 * q[1];<NEW_LINE>q = g2[b11];<NEW_LINE>v = rx1 * q[0] + ry1 * q[1];<NEW_LINE>b = lerp(sx, u, v);<NEW_LINE>return 1.5f * lerp(sy, a, b);<NEW_LINE>} | ((int) t) & BM; |
1,461,229 | public void writeTo(com.google.protobuf.CodedOutputStream output) throws java.io.IOException {<NEW_LINE>if (!getAppidBytes().isEmpty()) {<NEW_LINE>com.google.protobuf.GeneratedMessageV3.writeString(output, 1, appid_);<NEW_LINE>}<NEW_LINE>if (!getDeviceidBytes().isEmpty()) {<NEW_LINE>com.google.protobuf.GeneratedMessageV3.<MASK><NEW_LINE>}<NEW_LINE>if (!getMacBytes().isEmpty()) {<NEW_LINE>com.google.protobuf.GeneratedMessageV3.writeString(output, 3, mac_);<NEW_LINE>}<NEW_LINE>if (!getRydevicetypeBytes().isEmpty()) {<NEW_LINE>com.google.protobuf.GeneratedMessageV3.writeString(output, 4, rydevicetype_);<NEW_LINE>}<NEW_LINE>if (!getClientTzBytes().isEmpty()) {<NEW_LINE>com.google.protobuf.GeneratedMessageV3.writeString(output, 5, clientTz_);<NEW_LINE>}<NEW_LINE>if (!getCurrentCaidBytes().isEmpty()) {<NEW_LINE>com.google.protobuf.GeneratedMessageV3.writeString(output, 6, currentCaid_);<NEW_LINE>}<NEW_LINE>if (!getCachedCaidBytes().isEmpty()) {<NEW_LINE>com.google.protobuf.GeneratedMessageV3.writeString(output, 7, cachedCaid_);<NEW_LINE>}<NEW_LINE>unknownFields.writeTo(output);<NEW_LINE>} | writeString(output, 2, deviceid_); |
1,767,453 | public void handleMapNotifyEvent(XEvent xev) {<NEW_LINE>removeStartupNotification();<NEW_LINE>// See 6480534.<NEW_LINE>isUnhiding |= isWMStateNetHidden();<NEW_LINE>super.handleMapNotifyEvent(xev);<NEW_LINE>if (!ENABLE_REPARENTING_CHECK && delayedModalBlocking) {<NEW_LINE>// case of non-re-parenting WM<NEW_LINE>// (for a re-parenting WM this should have been already done on ReparentNotify processing)<NEW_LINE>addToTransientFors(AWTAccessor.getComponentAccessor().getPeer(modalBlocker));<NEW_LINE>delayedModalBlocking = false;<NEW_LINE>}<NEW_LINE>if (isBeforeFirstMapNotify && !winAttr.initialFocus && shouldSuppressWmTakeFocus()) {<NEW_LINE>// restore the protocol.<NEW_LINE>suppressWmTakeFocus(false);<NEW_LINE>if (!XWM.isKDE2()) {<NEW_LINE>XToolkit.awtLock();<NEW_LINE>try {<NEW_LINE>XlibWrapper.XRaiseWindow(XToolkit.<MASK><NEW_LINE>} finally {<NEW_LINE>XToolkit.awtUnlock();<NEW_LINE>}<NEW_LINE>}<NEW_LINE>}<NEW_LINE>if (shouldFocusOnMapNotify()) {<NEW_LINE>focusLog.fine("Automatically request focus on window");<NEW_LINE>requestInitialFocus();<NEW_LINE>} else {<NEW_LINE>dequeueKeyEvents();<NEW_LINE>}<NEW_LINE>isUnhiding = false;<NEW_LINE>isBeforeFirstMapNotify = false;<NEW_LINE>updateAlwaysOnTop();<NEW_LINE>synchronized (getStateLock()) {<NEW_LINE>if (!isMapped) {<NEW_LINE>isMapped = true;<NEW_LINE>}<NEW_LINE>}<NEW_LINE>} | getDisplay(), getWindow()); |
71,846 | protected Object decode(Channel channel, SocketAddress remoteAddress, Object msg) throws Exception {<NEW_LINE>Parser parser = new Parser(PATTERN, (String) msg);<NEW_LINE>if (!parser.matches()) {<NEW_LINE>return null;<NEW_LINE>}<NEW_LINE>Position position = new Position(getProtocolName());<NEW_LINE>position.set(Position.KEY_INDEX, parser.nextInt(0));<NEW_LINE>DeviceSession deviceSession = getDeviceSession(channel, remoteAddress, parser.next());<NEW_LINE>if (deviceSession == null) {<NEW_LINE>return null;<NEW_LINE>}<NEW_LINE>position.setDeviceId(deviceSession.getDeviceId());<NEW_LINE>position.setValid(true);<NEW_LINE>position.setLongitude(parser.nextCoordinate<MASK><NEW_LINE>position.setLatitude(parser.nextCoordinate(Parser.CoordinateFormat.HEM_DEG_MIN_MIN));<NEW_LINE>position.setTime(parser.nextDateTime(Parser.DateTimeFormat.DMY_HMS));<NEW_LINE>position.setCourse(parser.nextDouble(0));<NEW_LINE>position.setSpeed(UnitsConverter.knotsFromKph(parser.nextDouble(0)));<NEW_LINE>position.set(Position.KEY_BATTERY, parser.nextInt(0));<NEW_LINE>position.set(Position.KEY_CHARGE, parser.nextInt(0) == 1);<NEW_LINE>return position;<NEW_LINE>} | (Parser.CoordinateFormat.HEM_DEG_MIN_MIN)); |
1,209,194 | public DeleteGrantResult unmarshall(JsonUnmarshallerContext context) throws Exception {<NEW_LINE>DeleteGrantResult deleteGrantResult = new DeleteGrantResult();<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 deleteGrantResult;<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("GrantArn", targetDepth)) {<NEW_LINE>context.nextToken();<NEW_LINE>deleteGrantResult.setGrantArn(context.getUnmarshaller(String.class).unmarshall(context));<NEW_LINE>}<NEW_LINE>if (context.testExpression("Status", targetDepth)) {<NEW_LINE>context.nextToken();<NEW_LINE>deleteGrantResult.setStatus(context.getUnmarshaller(String.class).unmarshall(context));<NEW_LINE>}<NEW_LINE>if (context.testExpression("Version", targetDepth)) {<NEW_LINE>context.nextToken();<NEW_LINE>deleteGrantResult.setVersion(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 deleteGrantResult;<NEW_LINE>} | class).unmarshall(context)); |
955,511 | protected Object singleFieldToTuple(FieldDescriptor fieldDescriptor, Object fieldValue) {<NEW_LINE>assert fieldDescriptor.getType() != FieldDescriptor.Type.MESSAGE : "messageToFieldSchema called with field of type " + fieldDescriptor.getType();<NEW_LINE>if (fieldDescriptor.isRepeated()) {<NEW_LINE>// The protobuf contract is that if the field is repeated, then the object returned is actually a List<NEW_LINE>// of the underlying datatype, which in this case is a "primitive" like int, float, String, etc.<NEW_LINE>// We have to make a single-item tuple out of it to put it in the bag.<NEW_LINE>List<Object> fieldValueList = (List<Object>) (fieldValue != null ? fieldValue : Collections.emptyList());<NEW_LINE>DataBag bag = new <MASK><NEW_LINE>for (Object singleFieldValue : fieldValueList) {<NEW_LINE>Object nonEnumFieldValue = coerceToPigTypes(fieldDescriptor, singleFieldValue);<NEW_LINE>Tuple innerTuple = tupleFactory_.newTuple(1);<NEW_LINE>try {<NEW_LINE>innerTuple.set(0, nonEnumFieldValue);<NEW_LINE>} catch (ExecException e) {<NEW_LINE>// not expected<NEW_LINE>throw new RuntimeException(e);<NEW_LINE>}<NEW_LINE>bag.add(innerTuple);<NEW_LINE>}<NEW_LINE>return bag;<NEW_LINE>} else {<NEW_LINE>return coerceToPigTypes(fieldDescriptor, fieldValue);<NEW_LINE>}<NEW_LINE>} | NonSpillableDataBag(fieldValueList.size()); |
68,639 | public void paint(Graphics2D g, int w, int h) {<NEW_LINE>if (!draw_grid) {<NEW_LINE>return;<NEW_LINE>}<NEW_LINE>g.setColor(mGridColor);<NEW_LINE>int draw_width = w - ins_left - ins_right;<NEW_LINE>float e = 0.0001f * (maxx - minx);<NEW_LINE>FontMetrics fm = g.getFontMetrics();<NEW_LINE>int ascent = fm.getAscent();<NEW_LINE>for (float i = minx; i <= maxx + e; i += mTickX) {<NEW_LINE>int ix = (int) (draw_width * (i - minx) / (maxx - minx) + ins_left);<NEW_LINE>g.drawLine(ix, ins_top, ix, h - ins_botom);<NEW_LINE>String str = df.format(i);<NEW_LINE>int sw = fm.stringWidth(str) / 2;<NEW_LINE>g.drawString(str, ix - sw, h - ins_botom + ascent + mTextGap);<NEW_LINE>}<NEW_LINE><MASK><NEW_LINE>e = 0.0001f * (maxy - miny);<NEW_LINE>int hightoff = -fm.getHeight() / 2 + ascent;<NEW_LINE>for (float i = miny; i <= maxy + e; i += mTickY) {<NEW_LINE>int iy = (int) (draw_height * (1 - (i - miny) / (maxy - miny)) + ins_top);<NEW_LINE>g.drawLine(ins_left, iy, w - ins_right, iy);<NEW_LINE>String str = df.format(i);<NEW_LINE>int sw = fm.stringWidth(str);<NEW_LINE>g.drawString(str, ins_left - sw - mTextGap, iy + hightoff);<NEW_LINE>}<NEW_LINE>} | int draw_height = h - ins_top - ins_left; |
750,058 | public InteractionResult useOn(UseOnContext context) {<NEW_LINE>Player player = context.getPlayer();<NEW_LINE>if (player != null) {<NEW_LINE>Level world = context.getLevel();<NEW_LINE>BlockPos pos = context.getClickedPos();<NEW_LINE>BlockEntity tile = WorldUtils.getTileEntity(world, pos);<NEW_LINE>if (tile != null || !player.isShiftKeyDown()) {<NEW_LINE>// If there is a tile at the position or the player is not sneaking<NEW_LINE>// grab the tags of the block and the tile<NEW_LINE>if (!world.isClientSide) {<NEW_LINE>BlockState blockState = world.getBlockState(pos);<NEW_LINE>FluidState fluidState = blockState.getFluidState();<NEW_LINE>Set<ResourceLocation> blockTags = TagUtils.tagNames(blockState.getTags());<NEW_LINE>Set<ResourceLocation> fluidTags = fluidState.isEmpty() ? Collections.emptySet() : TagUtils.tagNames(fluidState.getTags());<NEW_LINE>Set<ResourceLocation> tileTags = tile == null ? Collections.emptySet() : TagUtils.tagNames(ForgeRegistries.BLOCK_ENTITIES, tile.getType());<NEW_LINE>if (blockTags.isEmpty() && fluidTags.isEmpty() && tileTags.isEmpty()) {<NEW_LINE>player.sendMessage(MekanismUtils.logFormat(MekanismLang.DICTIONARY_NO_KEY), Util.NIL_UUID);<NEW_LINE>} else {<NEW_LINE>// Note: We handle checking they are not empty in sendTagsToPlayer, so that we only display one if one is empty<NEW_LINE>sendTagsToPlayer(player, MekanismLang.DICTIONARY_BLOCK_TAGS_FOUND, blockTags);<NEW_LINE>sendTagsToPlayer(player, MekanismLang.DICTIONARY_FLUID_TAGS_FOUND, fluidTags);<NEW_LINE>sendTagsToPlayer(<MASK><NEW_LINE>}<NEW_LINE>}<NEW_LINE>return InteractionResult.sidedSuccess(world.isClientSide);<NEW_LINE>}<NEW_LINE>}<NEW_LINE>return InteractionResult.PASS;<NEW_LINE>} | player, MekanismLang.DICTIONARY_BLOCK_ENTITY_TYPE_TAGS_FOUND, tileTags); |
657,937 | public ListenableFuture<Void> invoke(final ShenyuGrpcCallRequest callParams) {<NEW_LINE>MethodDescriptor.MethodType methodType = callParams.getMethodDescriptor().getType();<NEW_LINE>List<DynamicMessage> requestList = callParams.getRequests();<NEW_LINE>StreamObserver<DynamicMessage> responseObserver = callParams.getResponseObserver();<NEW_LINE>CompleteObserver<DynamicMessage> doneObserver = new CompleteObserver<>();<NEW_LINE>StreamObserver<DynamicMessage> compositeObserver = <MASK><NEW_LINE>StreamObserver<DynamicMessage> requestObserver;<NEW_LINE>switch(methodType) {<NEW_LINE>case UNARY:<NEW_LINE>asyncUnaryCall(createCall(callParams), requestList.get(0), compositeObserver);<NEW_LINE>return doneObserver.getCompletionFuture();<NEW_LINE>case SERVER_STREAMING:<NEW_LINE>asyncServerStreamingCall(createCall(callParams), requestList.get(0), compositeObserver);<NEW_LINE>return doneObserver.getCompletionFuture();<NEW_LINE>case CLIENT_STREAMING:<NEW_LINE>requestObserver = asyncClientStreamingCall(createCall(callParams), compositeObserver);<NEW_LINE>requestList.forEach(requestObserver::onNext);<NEW_LINE>requestObserver.onCompleted();<NEW_LINE>return doneObserver.getCompletionFuture();<NEW_LINE>case BIDI_STREAMING:<NEW_LINE>requestObserver = asyncBidiStreamingCall(createCall(callParams), compositeObserver);<NEW_LINE>requestList.forEach(requestObserver::onNext);<NEW_LINE>requestObserver.onCompleted();<NEW_LINE>return doneObserver.getCompletionFuture();<NEW_LINE>default:<NEW_LINE>LOG.info("Unknown methodType:{}", methodType);<NEW_LINE>return null;<NEW_LINE>}<NEW_LINE>} | CompositeStreamObserver.of(responseObserver, doneObserver); |
1,764,432 | public MMovement createMovement() throws Exception {<NEW_LINE>MProductionLine[] lines = getLines();<NEW_LINE>if (lines.length == 0) {<NEW_LINE>// nothing to create;<NEW_LINE>return null;<NEW_LINE>}<NEW_LINE>MProductionBatch batch = getParent();<NEW_LINE>MMovement move = new MMovement(getCtx(), 0, get_TrxName());<NEW_LINE>MWarehouse wh = (MWarehouse) getM_Locator().getM_Warehouse();<NEW_LINE>boolean allowSameLocator = wh.get_ValueAsBoolean("IsAllowSameLocatorMove");<NEW_LINE>move.setClientOrg(this);<NEW_LINE>move.setDescription(Msg.parseTranslation(getCtx(), "@Created@ @from@ @M_ProductionBatch_ID@ " + batch.getDocumentNo()));<NEW_LINE>//<NEW_LINE>move.set_Value("M_Warehouse_ID", wh.getM_Warehouse_ID());<NEW_LINE>move.set_Value(<MASK><NEW_LINE>// set fields<NEW_LINE>move.set_Value("M_ProductionBatch_ID", batch.getM_ProductionBatch_ID());<NEW_LINE>// Save Movement<NEW_LINE>move.saveEx();<NEW_LINE>//<NEW_LINE>log.fine("Movement Documentno=" + move.getDocumentNo() + " created for Production Batch=" + batch.getDocumentNo());<NEW_LINE>for (MProductionLine line : lines) {<NEW_LINE>if (line.isEndProduct() || line.getM_Product().isBOM() || !line.getM_Product().isStocked()) {<NEW_LINE>log.fine("End Product. No need to move." + line.getM_Product().getValue());<NEW_LINE>continue;<NEW_LINE>} else if (Env.ZERO.compareTo(line.getMovementQty()) == 0) {<NEW_LINE>log.fine("No quantity to to move." + line.getM_Product().getValue());<NEW_LINE>continue;<NEW_LINE>}<NEW_LINE>if (getM_Locator_ID() == line.getM_Product().getM_Locator_ID() && !allowSameLocator) {<NEW_LINE>throw new AdempiereUserError("CannotUseSameLocator");<NEW_LINE>}<NEW_LINE>MMovementLine moveLine = new MMovementLine(move);<NEW_LINE>moveLine.setM_LocatorTo_ID(getM_Locator_ID());<NEW_LINE>moveLine.setM_Locator_ID(line.getM_Product().getM_Locator_ID());<NEW_LINE>moveLine.setM_Product_ID(line.getM_Product_ID());<NEW_LINE>moveLine.setM_AttributeSetInstance_ID(line.getM_AttributeSetInstance_ID());<NEW_LINE>moveLine.setM_AttributeSetInstanceTo_ID(line.getM_AttributeSetInstance_ID());<NEW_LINE>// skip UOM check<NEW_LINE>moveLine.setMovementQty(line.getMovementQty().negate());<NEW_LINE>moveLine.saveEx();<NEW_LINE>}<NEW_LINE>return move;<NEW_LINE>} | "M_Warehouse_To_ID", wh.getM_Warehouse_ID()); |
1,179,221 | public void run() {<NEW_LINE>try {<NEW_LINE>long startTime = System.currentTimeMillis();<NEW_LINE>if (parentObject instanceof ParallelTileObject) {<NEW_LINE>((ParallelTileObject) parentObject).updateStatus(Status.PROCESSING);<NEW_LINE>imageData.getHierarchy().fireObjectClassificationsChangedEvent(this, Collections.singleton(parentObject));<NEW_LINE>}<NEW_LINE>if (checkROI()) {<NEW_LINE>try {<NEW_LINE>pathObjectsDetected = detector.runDetection(imageData, params, roi);<NEW_LINE>} catch (IOException e) {<NEW_LINE>logger.error("Error processing " + roi, e);<NEW_LINE>}<NEW_LINE>result = detector.getLastResultsDescription();<NEW_LINE>long endTime = System.currentTimeMillis();<NEW_LINE>if (result != null)<NEW_LINE>logger.info(result + String.format(" (processing time: %.2f seconds)", (endTime - startTime) / 1000.));<NEW_LINE>else<NEW_LINE>logger.info(parentObject + String.format(" (processing time: %.2f seconds)", (<MASK><NEW_LINE>} else {<NEW_LINE>logger.info("Cannot run detection using ROI {}", roi);<NEW_LINE>}<NEW_LINE>} finally {<NEW_LINE>if (parentObject instanceof ParallelTileObject) {<NEW_LINE>((ParallelTileObject) parentObject).updateStatus(Status.DONE);<NEW_LINE>imageData.getHierarchy().fireObjectClassificationsChangedEvent(this, Collections.singleton(parentObject));<NEW_LINE>}<NEW_LINE>}<NEW_LINE>} | endTime - startTime) / 1000.)); |
1,050,792 | public static void main(String[] args) throws IOException, CertificateException, NoSuchAlgorithmException, InvalidKeySpecException {<NEW_LINE>// Initialize a wallet to hold identities used to access the network.<NEW_LINE>String walletPath = "/opt/test/wallet";<NEW_LINE>Path walletDirectory = Paths.get(walletPath);<NEW_LINE>Wallet wallet = Wallets.newFileSystemWallet(walletDirectory);<NEW_LINE>initWallet(connectProfilePath, wallet);<NEW_LINE>// Path to a common connection profile describing the network.<NEW_LINE>Path <MASK><NEW_LINE>// Configure the gateway connection used to access the network.<NEW_LINE>Gateway.Builder builder = Gateway.createBuilder().identity(wallet, "admin").networkConfig(networkConfigFile);<NEW_LINE>// Create a gateway connection<NEW_LINE>try (Gateway gateway = builder.connect()) {<NEW_LINE>// Obtain a smart contract deployed on the network.<NEW_LINE>Network network = gateway.getNetwork(channelName);<NEW_LINE>Contract contract = network.getContract(chaincodeName);<NEW_LINE>// Submit transactions that store state to the ledger.<NEW_LINE>byte[] createCarResult = contract.createTransaction("invoke").submit("a", "b", "1");<NEW_LINE>System.out.println(new String(createCarResult, StandardCharsets.UTF_8));<NEW_LINE>// Evaluate transactions that query state from the ledger.<NEW_LINE>byte[] queryAllCarsResult = contract.evaluateTransaction("query", "a");<NEW_LINE>System.out.println(new String(queryAllCarsResult, StandardCharsets.UTF_8));<NEW_LINE>} catch (ContractException | TimeoutException | InterruptedException e) {<NEW_LINE>e.printStackTrace();<NEW_LINE>}<NEW_LINE>System.exit(0);<NEW_LINE>} | networkConfigFile = Paths.get(connectProfilePath); |
1,317,943 | private void disassemble(IBootstrapMethodsAttribute bootstrapMethodsAttribute, StringBuffer buffer, String lineSeparator, int tabNumber, IConstantPool constantPool) {<NEW_LINE>writeNewLine(buffer, lineSeparator, tabNumber);<NEW_LINE>buffer.append(Messages.disassembler_bootstrapmethodattributesheader);<NEW_LINE>writeNewLine(buffer, lineSeparator, tabNumber + 1);<NEW_LINE>IBootstrapMethodsEntry[] entries = bootstrapMethodsAttribute.getBootstrapMethods();<NEW_LINE>int length = entries.length;<NEW_LINE>for (int i = 0; i < length; i++) {<NEW_LINE>if (i != 0) {<NEW_LINE>buffer.append(Messages.disassembler_comma);<NEW_LINE>writeNewLine(<MASK><NEW_LINE>}<NEW_LINE>IBootstrapMethodsEntry entry = entries[i];<NEW_LINE>String[] argumentsName = bootstrapArgumentsDescription(entry, constantPool);<NEW_LINE>buffer.append(Messages.bind(Messages.disassembler_bootstrapmethodentry, new String[] { Integer.toString(i), Integer.toString(entry.getBootstrapMethodReference()), bootstrapMethodDescription(entry, constantPool), getArguments(entry.getBootstrapArguments(), argumentsName) }));<NEW_LINE>}<NEW_LINE>} | buffer, lineSeparator, tabNumber + 1); |
640,202 | public void populate(final RubyModule target, final Class clazz) {<NEW_LINE>assert clazz == this.clazz : "populator for " + this.clazz + " used for " + clazz;<NEW_LINE>// fallback on non-pregenerated logic<NEW_LINE>// populate method index; this is done statically in generated code<NEW_LINE>AnnotationHelper.populateMethodIndex(clumper.readGroups, MethodIndex::addMethodReadFieldsPacked);<NEW_LINE>AnnotationHelper.populateMethodIndex(clumper.writeGroups, MethodIndex::addMethodWriteFieldsPacked);<NEW_LINE>final Ruby runtime = target.getRuntime();<NEW_LINE>final MethodFactory methodFactory = MethodFactory.createFactory(runtime.getJRubyClassLoader());<NEW_LINE>for (Map.Entry<String, List<JavaMethodDescriptor>> entry : clumper.getStaticAnnotatedMethods().entrySet()) {<NEW_LINE>final String name = entry.getKey();<NEW_LINE>final List<JavaMethodDescriptor> methods = entry.getValue();<NEW_LINE>target.defineAnnotatedMethod(name, methods, methodFactory);<NEW_LINE>addBoundMethodsUnlessOmitted(runtime, name, methods);<NEW_LINE>}<NEW_LINE>for (Map.Entry<String, List<JavaMethodDescriptor>> entry : clumper.getAnnotatedMethods().entrySet()) {<NEW_LINE>final String name = entry.getKey();<NEW_LINE>final List<JavaMethodDescriptor<MASK><NEW_LINE>target.defineAnnotatedMethod(name, methods, methodFactory);<NEW_LINE>addBoundMethodsUnlessOmitted(runtime, name, methods);<NEW_LINE>}<NEW_LINE>} | > methods = entry.getValue(); |
1,740,071 | protected boolean someToSuccess(HttpExchange exchange) {<NEW_LINE><MASK><NEW_LINE>switch(current) {<NEW_LINE>case COMMIT:<NEW_LINE>case CONTENT:<NEW_LINE>{<NEW_LINE>// Mark atomically the request as completed, with respect<NEW_LINE>// to concurrency between request success and request failure.<NEW_LINE>if (!exchange.requestComplete(null))<NEW_LINE>return false;<NEW_LINE>requestState.set(RequestState.QUEUED);<NEW_LINE>// Reset to be ready for another request.<NEW_LINE>reset();<NEW_LINE>Request request = exchange.getRequest();<NEW_LINE>if (LOG.isDebugEnabled())<NEW_LINE>LOG.debug("Request success {}", request);<NEW_LINE>HttpDestination destination = getHttpChannel().getHttpDestination();<NEW_LINE>destination.getRequestNotifier().notifySuccess(exchange.getRequest());<NEW_LINE>// Mark atomically the request as terminated, with<NEW_LINE>// respect to concurrency between request and response.<NEW_LINE>Result result = exchange.terminateRequest();<NEW_LINE>terminateRequest(exchange, null, result);<NEW_LINE>return true;<NEW_LINE>}<NEW_LINE>default:<NEW_LINE>{<NEW_LINE>return false;<NEW_LINE>}<NEW_LINE>}<NEW_LINE>} | RequestState current = requestState.get(); |
1,216,866 | final UpdateClusterSettingsResult executeUpdateClusterSettings(UpdateClusterSettingsRequest updateClusterSettingsRequest) {<NEW_LINE>ExecutionContext executionContext = createExecutionContext(updateClusterSettingsRequest);<NEW_LINE>AWSRequestMetrics awsRequestMetrics = executionContext.getAwsRequestMetrics();<NEW_LINE>awsRequestMetrics.startEvent(Field.ClientExecuteTime);<NEW_LINE>Request<UpdateClusterSettingsRequest> request = null;<NEW_LINE>Response<UpdateClusterSettingsResult> response = null;<NEW_LINE>try {<NEW_LINE>awsRequestMetrics.startEvent(Field.RequestMarshallTime);<NEW_LINE>try {<NEW_LINE>request = new UpdateClusterSettingsRequestProtocolMarshaller(protocolFactory).marshall<MASK><NEW_LINE>// Binds the request metrics to the current request.<NEW_LINE>request.setAWSRequestMetrics(awsRequestMetrics);<NEW_LINE>request.addHandlerContext(HandlerContextKey.CLIENT_ENDPOINT, endpoint);<NEW_LINE>request.addHandlerContext(HandlerContextKey.ENDPOINT_OVERRIDDEN, isEndpointOverridden());<NEW_LINE>request.addHandlerContext(HandlerContextKey.SIGNING_REGION, getSigningRegion());<NEW_LINE>request.addHandlerContext(HandlerContextKey.SERVICE_ID, "ECS");<NEW_LINE>request.addHandlerContext(HandlerContextKey.OPERATION_NAME, "UpdateClusterSettings");<NEW_LINE>request.addHandlerContext(HandlerContextKey.ADVANCED_CONFIG, advancedConfig);<NEW_LINE>} finally {<NEW_LINE>awsRequestMetrics.endEvent(Field.RequestMarshallTime);<NEW_LINE>}<NEW_LINE>HttpResponseHandler<AmazonWebServiceResponse<UpdateClusterSettingsResult>> responseHandler = protocolFactory.createResponseHandler(new JsonOperationMetadata().withPayloadJson(true).withHasStreamingSuccessResponse(false), new UpdateClusterSettingsResultJsonUnmarshaller());<NEW_LINE>response = invoke(request, responseHandler, executionContext);<NEW_LINE>return response.getAwsResponse();<NEW_LINE>} finally {<NEW_LINE>endClientExecution(awsRequestMetrics, request, response);<NEW_LINE>}<NEW_LINE>} | (super.beforeMarshalling(updateClusterSettingsRequest)); |
296,637 | public static synchronized boolean startup(boolean isClient) {<NEW_LINE>// Already started<NEW_LINE>if (log != null)<NEW_LINE>return true;<NEW_LINE>// Check Version<NEW_LINE>if (isClient && !Login.isJavaOK(isClient))<NEW_LINE>System.exit(1);<NEW_LINE>// init logging in Ini<NEW_LINE>Ini.setClient(isClient);<NEW_LINE>// Init Log<NEW_LINE>log = <MASK><NEW_LINE>// Greeting<NEW_LINE>log.info(getSummaryAscii());<NEW_LINE>// log.info(getAdempiereHome() + " - " + getJavaInfo() + " - " + getOSInfo());<NEW_LINE>// Load System environment<NEW_LINE>// EnvLoader.load(Ini.ENV_PREFIX);<NEW_LINE>// System properties<NEW_LINE>Ini.loadProperties(false);<NEW_LINE>// Set up Log<NEW_LINE>CLogMgt.setLevel(Ini.getProperty(Ini.P_TRACELEVEL));<NEW_LINE>if (isClient && Ini.isPropertyBool(Ini.P_TRACEFILE) && CLogFile.get(false, null, isClient) == null)<NEW_LINE>CLogMgt.addHandler(CLogFile.get(true, Ini.findAdempiereHome(), isClient));<NEW_LINE>// Set UI<NEW_LINE>if (isClient) {<NEW_LINE>if (CLogMgt.isLevelAll())<NEW_LINE>log.log(Level.FINEST, System.getProperties().toString());<NEW_LINE>}<NEW_LINE>// Set Default Database Connection from Ini<NEW_LINE>DB.setDBTarget(CConnection.get(getCodeBaseHost()));<NEW_LINE>if (// don't test connection<NEW_LINE>isClient)<NEW_LINE>// need to call<NEW_LINE>return false;<NEW_LINE>return startupEnvironment(isClient);<NEW_LINE>} | CLogger.getCLogger(Adempiere.class); |
796,201 | public static AlertMessage fromByteArray(final byte[] byteArray) throws HandshakeException {<NEW_LINE>DatagramReader reader = new DatagramReader(byteArray);<NEW_LINE><MASK><NEW_LINE>byte descCode = reader.readNextByte();<NEW_LINE>AlertLevel level = AlertLevel.getLevelByCode(levelCode);<NEW_LINE>AlertDescription description = AlertDescription.getDescriptionByCode(descCode);<NEW_LINE>if (level == null) {<NEW_LINE>throw new HandshakeException(String.format("Unknown alert level code [%d]", levelCode), new AlertMessage(AlertLevel.FATAL, AlertDescription.DECODE_ERROR));<NEW_LINE>} else if (description == null) {<NEW_LINE>throw new HandshakeException(String.format("Unknown alert description code [%d]", descCode), new AlertMessage(AlertLevel.FATAL, AlertDescription.DECODE_ERROR));<NEW_LINE>} else {<NEW_LINE>return new AlertMessage(level, description);<NEW_LINE>}<NEW_LINE>} | byte levelCode = reader.readNextByte(); |
1,537,876 | private void recoverFromTranslogInternal(TranslogRecoveryRunner translogRecoveryRunner, long recoverUpToSeqNo) throws IOException {<NEW_LINE>Translog.<MASK><NEW_LINE>final int opsRecovered = 0;<NEW_LINE>final long translogFileGen = Long.parseLong(lastCommittedSegmentInfos.getUserData().get(Translog.TRANSLOG_GENERATION_KEY));<NEW_LINE>// flush if we recovered something or if we have references to older translogs<NEW_LINE>// note: if opsRecovered == 0 and we have older translogs it means they are corrupted or 0 length.<NEW_LINE>assert pendingTranslogRecovery.get() : "translogRecovery is not pending but should be";<NEW_LINE>// we are good - now we can commit<NEW_LINE>pendingTranslogRecovery.set(false);<NEW_LINE>if (opsRecovered > 0) {<NEW_LINE>logger.trace("flushing post recovery from translog. ops recovered [{}]. committed translog id [{}]. current id [{}]", opsRecovered, translogGeneration == null ? null : translogGeneration.translogFileGeneration, translog.currentFileGeneration());<NEW_LINE>commitIndexWriter(indexWriter, translog, null);<NEW_LINE>refreshLastCommittedSegmentInfos();<NEW_LINE>refresh("translog_recovery");<NEW_LINE>}<NEW_LINE>translog.trimUnreferencedReaders();<NEW_LINE>} | TranslogGeneration translogGeneration = translog.getGeneration(); |
201,819 | private static int shardingNodeCheck(String stmt, int offset) throws SQLSyntaxErrorException {<NEW_LINE>if (stmt.length() > offset + 10) {<NEW_LINE>char c1 = stmt.charAt(++offset);<NEW_LINE>char c2 = stmt.charAt(++offset);<NEW_LINE>char c3 = stmt.charAt(++offset);<NEW_LINE>char c4 = stmt.charAt(++offset);<NEW_LINE>char c5 = stmt.charAt(++offset);<NEW_LINE>char c6 = stmt.charAt(++offset);<NEW_LINE>char c7 = stmt.charAt(++offset);<NEW_LINE>char c8 <MASK><NEW_LINE>char c9 = stmt.charAt(++offset);<NEW_LINE>char c10 = stmt.charAt(++offset);<NEW_LINE>if ((c1 == 'A' || c1 == 'a') && (c2 == 'R' || c2 == 'r') && (c3 == 'D' || c3 == 'd') && (c4 == 'I' || c4 == 'i') && (c5 == 'N' || c5 == 'n') && (c6 == 'G' || c6 == 'g') && (c7 == 'N' || c7 == 'n') && (c8 == 'O' || c8 == 'o') && (c9 == 'D' || c9 == 'd') && (c10 == 'E' || c10 == 'e')) {<NEW_LINE>offset = ParseUtil.skipSpaceUtil(stmt, ++offset, '=');<NEW_LINE>if (offset == -1) {<NEW_LINE>throw new SQLSyntaxErrorException("please following the dble hint syntax: /*!" + Versions.ANNOTATION_NAME + "shardingNode=? */ sql");<NEW_LINE>} else {<NEW_LINE>return (offset << 8) | SHARDING_NODE;<NEW_LINE>}<NEW_LINE>}<NEW_LINE>}<NEW_LINE>throw new SQLSyntaxErrorException("please following the dble hint syntax: /*!" + Versions.ANNOTATION_NAME + "shardingNode=? */ sql");<NEW_LINE>} | = stmt.charAt(++offset); |
1,244,818 | public void generateReversion(ActionRequest request, ActionResponse response) {<NEW_LINE>try {<NEW_LINE>StockMove stockMove = request.getContext().asType(StockMove.class);<NEW_LINE>Optional<StockMove> reversion = Beans.get(StockMoveService.class).generateReversion(Beans.get(StockMoveRepository.class).find(stockMove.getId()));<NEW_LINE>if (reversion.isPresent()) {<NEW_LINE>response.setView(ActionView.define(I18n.get("Stock move")).model(StockMove.class.getName()).add("grid", "stock-move-grid").add("form", "stock-move-form").param("search-filters", "internal-stock-move-filters").param("forceEdit", "true").context("_showRecord", String.valueOf(reversion.get().getId())).map());<NEW_LINE>} else {<NEW_LINE>response.setFlash<MASK><NEW_LINE>}<NEW_LINE>} catch (Exception e) {<NEW_LINE>TraceBackService.trace(response, e);<NEW_LINE>}<NEW_LINE>} | (I18n.get("No reversion generated")); |
96,576 | public void run(RegressionEnvironment env) {<NEW_LINE>String[] fields = new <MASK><NEW_LINE>RegressionPath path = new RegressionPath();<NEW_LINE>// create window<NEW_LINE>String stmtTextCreate = "@public @buseventtype create schema MyEvent(cid string);\n";<NEW_LINE>stmtTextCreate += namedWindow ? "@public create window MyInfra.win:keepall() as MyEvent" : "@public create table MyInfra(cid string primary key)";<NEW_LINE>env.compileDeploy(stmtTextCreate, path);<NEW_LINE>// create insert into<NEW_LINE>String stmtTextInsert = "insert into MyInfra select * from MyEvent";<NEW_LINE>env.compileDeploy(stmtTextInsert, path);<NEW_LINE>// create join<NEW_LINE>String stmtTextJoin = "@name('s0') select ce.cid as c0, sb.intPrimitive as c1 from MyInfra as ce, SupportBean#keepall() as sb" + " where sb.theString = ce.cid";<NEW_LINE>env.compileDeploy(stmtTextJoin, path).addListener("s0");<NEW_LINE>sendMyEvent(env, "C1");<NEW_LINE>sendMyEvent(env, "C2");<NEW_LINE>sendMyEvent(env, "C3");<NEW_LINE>env.milestone(0);<NEW_LINE>env.sendEventBean(new SupportBean("C2", 1));<NEW_LINE>env.assertPropsNew("s0", fields, new Object[] { "C2", 1 });<NEW_LINE>env.sendEventBean(new SupportBean("C1", 4));<NEW_LINE>env.assertPropsNew("s0", fields, new Object[] { "C1", 4 });<NEW_LINE>env.undeployAll();<NEW_LINE>} | String[] { "c0", "c1" }; |
363,281 | public void generateCode(BlockScope currentScope, CodeStream codeStream) {<NEW_LINE>// even if not reachable, variable must be added to visible if allocated (28298)<NEW_LINE>if (this.binding.resolvedPosition != -1) {<NEW_LINE>codeStream.addVisibleLocalVariable(this.binding);<NEW_LINE>}<NEW_LINE>if ((this.bits & IsReachable) == 0) {<NEW_LINE>return;<NEW_LINE>}<NEW_LINE>int pc = codeStream.position;<NEW_LINE>// something to initialize?<NEW_LINE>generateInit: {<NEW_LINE>if (this.initialization == null)<NEW_LINE>break generateInit;<NEW_LINE>// forget initializing unused or final locals set to constant value (final ones are inlined)<NEW_LINE>if (this.binding.resolvedPosition < 0) {<NEW_LINE>if (this.initialization.constant != Constant.NotAConstant)<NEW_LINE>break generateInit;<NEW_LINE>// if binding unused generate then discard the value<NEW_LINE>this.initialization.generateCode(currentScope, codeStream, false);<NEW_LINE>break generateInit;<NEW_LINE>}<NEW_LINE>this.initialization.<MASK><NEW_LINE>// 26903, need extra cast to store null in array local var<NEW_LINE>if (this.binding.type.isArrayType() && (// arrayLoc = (type[])null<NEW_LINE>(this.initialization instanceof CastExpression) && (((CastExpression) this.initialization).innermostCastedExpression().resolvedType == TypeBinding.NULL))) {<NEW_LINE>codeStream.checkcast(this.binding.type);<NEW_LINE>}<NEW_LINE>codeStream.store(this.binding, false);<NEW_LINE>if ((this.bits & ASTNode.FirstAssignmentToLocal) != 0) {<NEW_LINE>this.binding.recordInitializationStartPC(codeStream.position);<NEW_LINE>}<NEW_LINE>}<NEW_LINE>codeStream.recordPositionsFrom(pc, this.sourceStart);<NEW_LINE>} | generateCode(currentScope, codeStream, true); |
1,159,856 | public RestResponse buildResponse(PostStartTrialResponse response, XContentBuilder builder) throws Exception {<NEW_LINE>PostStartTrialResponse.<MASK><NEW_LINE>builder.startObject();<NEW_LINE>builder.field("acknowledged", startTrialRequest.isAcknowledged());<NEW_LINE>if (status.isTrialStarted()) {<NEW_LINE>builder.field("trial_was_started", true);<NEW_LINE>builder.field("type", startTrialRequest.getType());<NEW_LINE>} else {<NEW_LINE>builder.field("trial_was_started", false);<NEW_LINE>builder.field("error_message", status.getErrorMessage());<NEW_LINE>}<NEW_LINE>Map<String, String[]> acknowledgementMessages = response.getAcknowledgementMessages();<NEW_LINE>if (acknowledgementMessages.isEmpty() == false) {<NEW_LINE>builder.startObject("acknowledge");<NEW_LINE>builder.field("message", response.getAcknowledgementMessage());<NEW_LINE>for (Map.Entry<String, String[]> entry : acknowledgementMessages.entrySet()) {<NEW_LINE>builder.startArray(entry.getKey());<NEW_LINE>for (String message : entry.getValue()) {<NEW_LINE>builder.value(message);<NEW_LINE>}<NEW_LINE>builder.endArray();<NEW_LINE>}<NEW_LINE>builder.endObject();<NEW_LINE>}<NEW_LINE>builder.endObject();<NEW_LINE>return new BytesRestResponse(status.getRestStatus(), builder);<NEW_LINE>} | Status status = response.getStatus(); |
325,464 | public void deserialize(ByteBuffer buffer) throws IOException {<NEW_LINE>this.clear();<NEW_LINE>// read meta<NEW_LINE>this.minValue = buffer.getInt();<NEW_LINE>this.maxValue = buffer.getInt();<NEW_LINE>this.runOptimized = buffer.get() == (byte) 1;<NEW_LINE>// read ebm<NEW_LINE>MutableRoaringBitmap ebm = new MutableRoaringBitmap();<NEW_LINE>ebm.deserialize(buffer);<NEW_LINE>this.ebM = ebm;<NEW_LINE>// read ba<NEW_LINE>buffer.position(buffer.position() + ebm.serializedSizeInBytes());<NEW_LINE>int bitDepth = buffer.getInt();<NEW_LINE>MutableRoaringBitmap[<MASK><NEW_LINE>for (int i = 0; i < bitDepth; i++) {<NEW_LINE>MutableRoaringBitmap rb = new MutableRoaringBitmap();<NEW_LINE>rb.deserialize(buffer);<NEW_LINE>ba[i] = rb;<NEW_LINE>buffer.position(buffer.position() + rb.serializedSizeInBytes());<NEW_LINE>}<NEW_LINE>this.bA = ba;<NEW_LINE>} | ] ba = new MutableRoaringBitmap[bitDepth]; |
1,149,408 | // //////////////////////////////////////////////////////////////////////////<NEW_LINE>// Methods //<NEW_LINE>// //////////////////////////////////////////////////////////////////////////<NEW_LINE>Runner newRunner(final PayaraServer srv, final Command cmd, final Class runnerClass) throws CommandException {<NEW_LINE>final String METHOD = "newRunner";<NEW_LINE>Constructor<Runner> con = null;<NEW_LINE>Runner runner = null;<NEW_LINE>try {<NEW_LINE>con = runnerClass.getConstructor(PayaraServer.class, Command.class);<NEW_LINE>} catch (NoSuchMethodException | SecurityException nsme) {<NEW_LINE>throw new CommandException(CommandException.RUNNER_INIT, nsme);<NEW_LINE>}<NEW_LINE>if (con == null) {<NEW_LINE>return runner;<NEW_LINE>}<NEW_LINE>try {<NEW_LINE>runner = con.newInstance(srv, cmd);<NEW_LINE>} catch (InstantiationException | IllegalAccessException ie) {<NEW_LINE>throw new <MASK><NEW_LINE>} catch (InvocationTargetException ite) {<NEW_LINE>LOGGER.log(Level.WARNING, "exceptionMsg", ite.getMessage());<NEW_LINE>Throwable t = ite.getCause();<NEW_LINE>if (t != null) {<NEW_LINE>LOGGER.log(Level.WARNING, "cause", t.getMessage());<NEW_LINE>}<NEW_LINE>throw new CommandException(CommandException.RUNNER_INIT, ite);<NEW_LINE>}<NEW_LINE>return runner;<NEW_LINE>} | CommandException(CommandException.RUNNER_INIT, ie); |
354,390 | @WithSpan<NEW_LINE>public Task<UsageQueryResult> query(@ActionParam(PARAM_RESOURCE) @Nonnull String resource, @ActionParam(PARAM_DURATION) @Nonnull WindowDuration duration, @ActionParam(PARAM_START_TIME) @com.linkedin.restli.server.annotations.Optional Long startTime, @ActionParam(PARAM_END_TIME) @com.linkedin.restli.server.annotations.Optional Long endTime, @ActionParam(PARAM_MAX_BUCKETS) @com.linkedin.restli.server.annotations.Optional Integer maxBuckets) {<NEW_LINE>log.info("Attempting to query usage stats");<NEW_LINE>return RestliUtil.toTask(() -> {<NEW_LINE>// 1. Populate the filter. This is common for all queries.<NEW_LINE>Filter filter = new Filter();<NEW_LINE>ArrayList<Criterion> criteria = new ArrayList<>();<NEW_LINE>Criterion hasUrnCriterion = new Criterion().setField("urn").setCondition(Condition.EQUAL).setValue(resource);<NEW_LINE>criteria.add(hasUrnCriterion);<NEW_LINE>if (startTime != null) {<NEW_LINE>Criterion startTimeCriterion = new Criterion().setField(ES_FIELD_TIMESTAMP).setCondition(Condition.GREATER_THAN_OR_EQUAL_TO).setValue(startTime.toString());<NEW_LINE>criteria.add(startTimeCriterion);<NEW_LINE>}<NEW_LINE>if (endTime != null) {<NEW_LINE>Criterion endTimeCriterion = new Criterion().setField(ES_FIELD_TIMESTAMP).setCondition(Condition.LESS_THAN_OR_EQUAL_TO).<MASK><NEW_LINE>criteria.add(endTimeCriterion);<NEW_LINE>}<NEW_LINE>filter.setOr(new ConjunctiveCriterionArray(new ConjunctiveCriterion().setAnd(new CriterionArray(criteria))));<NEW_LINE>// 2. Get buckets.<NEW_LINE>UsageAggregationArray buckets = getBuckets(filter, resource, duration);<NEW_LINE>// 3. Get aggregations.<NEW_LINE>UsageQueryResultAggregations aggregations = getAggregations(filter);<NEW_LINE>// 4. Compute totalSqlQuery count from the buckets itself.<NEW_LINE>// We want to avoid issuing an additional query with a sum aggregation.<NEW_LINE>Integer totalQueryCount = null;<NEW_LINE>for (UsageAggregation bucket : buckets) {<NEW_LINE>if (bucket.getMetrics().getTotalSqlQueries() != null) {<NEW_LINE>if (totalQueryCount == null) {<NEW_LINE>totalQueryCount = 0;<NEW_LINE>}<NEW_LINE>totalQueryCount += bucket.getMetrics().getTotalSqlQueries();<NEW_LINE>}<NEW_LINE>}<NEW_LINE>if (totalQueryCount != null) {<NEW_LINE>aggregations.setTotalSqlQueries(totalQueryCount);<NEW_LINE>}<NEW_LINE>// 5. Populate and return the result.<NEW_LINE>return new UsageQueryResult().setBuckets(buckets).setAggregations(aggregations);<NEW_LINE>}, MetricRegistry.name(this.getClass(), "query"));<NEW_LINE>} | setValue(endTime.toString()); |
122,143 | public void testTask1BlockedByTask2Canceled(String execSvcJNDIName, PrintWriter out) throws Exception {<NEW_LINE>@SuppressWarnings("unchecked")<NEW_LINE>Future<Integer> future1 = (Future<Integer>) futures.remove("testTask1BlockedByTask2-future1-" + execSvcJNDIName);<NEW_LINE>@SuppressWarnings("unchecked")<NEW_LINE>Future<Integer> future2 = (Future<Integer>) futures.remove("testTask1BlockedByTask2-future2-" + execSvcJNDIName);<NEW_LINE>assertTrue(future1.isDone());<NEW_LINE><MASK><NEW_LINE>assertTrue(future1.isCancelled());<NEW_LINE>assertTrue(future2.isCancelled());<NEW_LINE>try {<NEW_LINE>fail("Task 1 should have been canceled. Instead, result is: " + future1.get(0, TimeUnit.SECONDS));<NEW_LINE>} catch (CancellationException x) {<NEW_LINE>}<NEW_LINE>// pass<NEW_LINE>try {<NEW_LINE>fail("Task 2 should have been canceled. Instead, result is: " + future2.get(0, TimeUnit.SECONDS));<NEW_LINE>} catch (CancellationException x) {<NEW_LINE>}<NEW_LINE>// pass<NEW_LINE>} | assertTrue(future2.isDone()); |
1,426,472 | public void createLines() {<NEW_LINE>for (Vector<Object> line : getData().values()) {<NEW_LINE>int id = (Integer) line.get(5);<NEW_LINE>MWMInOutBoundLine ioBoundLine = new MWMInOutBoundLine(Env.getCtx(), id, null);<NEW_LINE>for (MWMInOutBoundLineMA ioBoundLineMA : getLinesMA(ioBoundLine)) {<NEW_LINE>ioBoundLineMA.deleteEx(true);<NEW_LINE>}<NEW_LINE>}<NEW_LINE>for (Vector<Object> line : getData().values()) {<NEW_LINE>String value = (String) line.get(0);<NEW_LINE>String lotNo = (String) line.get(2);<NEW_LINE>String serNo = (String) line.get(3);<NEW_LINE>Boolean isASI = (lotNo != null && lotNo.length() > 0) || (serNo != null && serNo.length() > 0) ? true : false;<NEW_LINE>BigDecimal qty = (BigDecimal) line.get(4);<NEW_LINE>int id = (Integer) line.get(5);<NEW_LINE>Integer referenceId = (Integer) line.get(6);<NEW_LINE>MWMInOutBoundLine boundLine = null;<NEW_LINE>MAttributeSetInstance asi = null;<NEW_LINE>MProduct product = new Query(Env.getCtx(), I_M_Product.Table_Name, "Value = ? ", null).setClient_ID().setParameters(value).firstOnly();<NEW_LINE>String desc = null;<NEW_LINE>if (referenceId > 0)<NEW_LINE>boundLine = getMWMInOutBoundLine(referenceId, product.get_ID());<NEW_LINE>if (product.getM_AttributeSet_ID() > 0 && isASI) {<NEW_LINE>asi = getASI(product, lotNo, serNo);<NEW_LINE>if (asi == null)<NEW_LINE>asi = getAttributeSetInstance(product, lotNo, serNo, getM_Locater_ID(), null);<NEW_LINE>}<NEW_LINE>MWMInOutBoundLineMA boundLineMA = new MWMInOutBoundLineMA(Env.getCtx(), 0, null);<NEW_LINE>if (asi == null && isASI) {<NEW_LINE>asi = new MAttributeSetInstance(Env.getCtx(), 0, <MASK><NEW_LINE>if (lotNo != null) {<NEW_LINE>asi.setLot(lotNo);<NEW_LINE>desc = lotNo;<NEW_LINE>}<NEW_LINE>if (serNo != null) {<NEW_LINE>asi.setSerNo(serNo);<NEW_LINE>if (desc != null)<NEW_LINE>desc = desc + " - " + serNo;<NEW_LINE>else<NEW_LINE>desc = serNo;<NEW_LINE>}<NEW_LINE>asi.setDescription(desc);<NEW_LINE>asi.saveEx();<NEW_LINE>}<NEW_LINE>boundLineMA.setWM_InOutBoundLine_ID(boundLine.get_ID());<NEW_LINE>boundLineMA.setM_AttributeSetInstance_ID(asi == null ? 0 : asi.getM_AttributeSetInstance_ID());<NEW_LINE>boundLineMA.setMovementQty(qty);<NEW_LINE>boundLineMA.saveEx();<NEW_LINE>boundLine.setMovementQty(boundLine.getMovementQty().add(qty));<NEW_LINE>boundLine.saveEx();<NEW_LINE>}<NEW_LINE>} | product.getM_AttributeSet_ID(), null); |
776,802 | static void encode(EncodeState state, BigInteger i) {<NEW_LINE>// System.out.println("Encoding integral " + i);<NEW_LINE>if (i.equals(BigInteger.ZERO)) {<NEW_LINE>state.add(INT_ZERO_CODE);<NEW_LINE>return;<NEW_LINE>}<NEW_LINE>int n = minimalByteCount(i);<NEW_LINE>if (n > 0xff) {<NEW_LINE>throw new IllegalArgumentException("BigInteger magnitude is too large (more than 255 bytes)");<NEW_LINE>}<NEW_LINE>if (i.compareTo(BigInteger.ZERO) > 0) {<NEW_LINE>byte[<MASK><NEW_LINE>if (n > Long.BYTES) {<NEW_LINE>state.add(POS_INT_END);<NEW_LINE>state.add((byte) n);<NEW_LINE>state.add(bytes, bytes.length - n, n);<NEW_LINE>} else {<NEW_LINE>// System.out.println(" -- integral has 'n' of " + n + " and output bytes of " + bytes.length);<NEW_LINE>state.add((byte) (INT_ZERO_CODE + n));<NEW_LINE>state.add(bytes, bytes.length - n, n);<NEW_LINE>}<NEW_LINE>} else {<NEW_LINE>byte[] bytes = i.subtract(BigInteger.ONE).toByteArray();<NEW_LINE>if (n > Long.BYTES) {<NEW_LINE>state.add(NEG_INT_START);<NEW_LINE>state.add((byte) (n ^ 0xff));<NEW_LINE>if (bytes.length >= n) {<NEW_LINE>state.add(bytes, bytes.length - n, n);<NEW_LINE>} else {<NEW_LINE>for (int x = 0; x < n - bytes.length; x++) {<NEW_LINE>state.add((byte) 0x00);<NEW_LINE>}<NEW_LINE>state.add(bytes, 0, bytes.length);<NEW_LINE>}<NEW_LINE>} else {<NEW_LINE>state.add((byte) (INT_ZERO_CODE - n));<NEW_LINE>if (bytes.length >= n) {<NEW_LINE>state.add(bytes, bytes.length - n, n);<NEW_LINE>} else {<NEW_LINE>for (int x = 0; x < n - bytes.length; x++) {<NEW_LINE>state.add((byte) 0x00);<NEW_LINE>}<NEW_LINE>state.add(bytes, 0, bytes.length);<NEW_LINE>}<NEW_LINE>}<NEW_LINE>}<NEW_LINE>} | ] bytes = i.toByteArray(); |
1,528,681 | protected static Options createNewOptions() {<NEW_LINE>Options options = new Options();<NEW_LINE>Option opHost = Option.builder(HOST_ARGS).longOpt(HOST_NAME).required().argName(HOST_NAME).hasArg().desc("Host Name (required)").build();<NEW_LINE>options.addOption(opHost);<NEW_LINE>Option opPort = Option.builder(PORT_ARGS).longOpt(PORT_NAME).required().argName(PORT_NAME).hasArg().desc("Port (required)").build();<NEW_LINE>options.addOption(opPort);<NEW_LINE>Option opUsername = Option.builder(USERNAME_ARGS).longOpt(USERNAME_NAME).required().argName(USERNAME_NAME).hasArg().desc("Username (required)").build();<NEW_LINE>options.addOption(opUsername);<NEW_LINE>Option opPassword = Option.builder(PASSWORD_ARGS).longOpt(PASSWORD_NAME).optionalArg(true).argName(PASSWORD_NAME).hasArg().<MASK><NEW_LINE>options.addOption(opPassword);<NEW_LINE>return options;<NEW_LINE>} | desc("Password (required)").build(); |
257,371 | public Condition createPredicateResourceId(@Nullable DbColumn theSourceJoinColumn, String theResourceName, List<List<IQueryParameterType>> theValues, SearchFilterParser.CompareOperation theOperation, RequestPartitionId theRequestPartitionId) {<NEW_LINE>Set<ResourcePersistentId> allOrPids = null;<NEW_LINE>SearchFilterParser.CompareOperation defaultOperation = SearchFilterParser.CompareOperation.eq;<NEW_LINE>boolean allIdsAreForcedIds = true;<NEW_LINE>for (List<? extends IQueryParameterType> nextValue : theValues) {<NEW_LINE>Set<ResourcePersistentId> orPids = new HashSet<>();<NEW_LINE>boolean haveValue = false;<NEW_LINE>for (IQueryParameterType next : nextValue) {<NEW_LINE>String value = next.getValueAsQueryToken(getFhirContext());<NEW_LINE>if (value != null && value.startsWith("|")) {<NEW_LINE>value = value.substring(1);<NEW_LINE>}<NEW_LINE>IdType valueAsId = new IdType(value);<NEW_LINE>if (isNotBlank(value)) {<NEW_LINE>if (!myIdHelperService.idRequiresForcedId(valueAsId.getIdPart()) && allIdsAreForcedIds) {<NEW_LINE>allIdsAreForcedIds = false;<NEW_LINE>}<NEW_LINE>haveValue = true;<NEW_LINE>try {<NEW_LINE>ResourcePersistentId pid = myIdHelperService.resolveResourcePersistentIds(theRequestPartitionId, theResourceName, valueAsId.getIdPart());<NEW_LINE>orPids.add(pid);<NEW_LINE>} catch (ResourceNotFoundException e) {<NEW_LINE>// This is not an error in a search, it just results in no matches<NEW_LINE>ourLog.debug("Resource ID {} was requested but does not exist", valueAsId.getIdPart());<NEW_LINE>}<NEW_LINE>}<NEW_LINE>if (next instanceof TokenParam) {<NEW_LINE>if (((TokenParam) next).getModifier() == TokenParamModifier.NOT) {<NEW_LINE>defaultOperation = SearchFilterParser.CompareOperation.ne;<NEW_LINE>}<NEW_LINE>}<NEW_LINE>}<NEW_LINE>if (haveValue) {<NEW_LINE>if (allOrPids == null) {<NEW_LINE>allOrPids = orPids;<NEW_LINE>} else {<NEW_LINE>allOrPids.retainAll(orPids);<NEW_LINE>}<NEW_LINE>}<NEW_LINE>}<NEW_LINE>if (allOrPids != null && allOrPids.isEmpty()) {<NEW_LINE>setMatchNothing();<NEW_LINE>} else if (allOrPids != null) {<NEW_LINE>SearchFilterParser.CompareOperation operation = defaultIfNull(theOperation, defaultOperation);<NEW_LINE>assert operation == SearchFilterParser.CompareOperation.eq <MASK><NEW_LINE>List<Long> resourceIds = ResourcePersistentId.toLongList(allOrPids);<NEW_LINE>if (theSourceJoinColumn == null) {<NEW_LINE>BaseJoiningPredicateBuilder queryRootTable = super.getOrCreateQueryRootTable(!allIdsAreForcedIds);<NEW_LINE>Condition predicate;<NEW_LINE>switch(operation) {<NEW_LINE>default:<NEW_LINE>case eq:<NEW_LINE>predicate = queryRootTable.createPredicateResourceIds(false, resourceIds);<NEW_LINE>return queryRootTable.combineWithRequestPartitionIdPredicate(theRequestPartitionId, predicate);<NEW_LINE>case ne:<NEW_LINE>predicate = queryRootTable.createPredicateResourceIds(true, resourceIds);<NEW_LINE>return queryRootTable.combineWithRequestPartitionIdPredicate(theRequestPartitionId, predicate);<NEW_LINE>}<NEW_LINE>} else {<NEW_LINE>return QueryStack.toEqualToOrInPredicate(theSourceJoinColumn, generatePlaceholders(resourceIds), operation == SearchFilterParser.CompareOperation.ne);<NEW_LINE>}<NEW_LINE>}<NEW_LINE>return null;<NEW_LINE>} | || operation == SearchFilterParser.CompareOperation.ne; |
1,754,732 | public static DescribeTraceInfoNodeListResponse unmarshall(DescribeTraceInfoNodeListResponse describeTraceInfoNodeListResponse, UnmarshallerContext context) {<NEW_LINE>describeTraceInfoNodeListResponse.setRequestId(context.stringValue("DescribeTraceInfoNodeListResponse.RequestId"));<NEW_LINE>NodeListInfo nodeListInfo = new NodeListInfo();<NEW_LINE>List<String> entityTypeList = new ArrayList<String>();<NEW_LINE>for (int i = 0; i < context.lengthValue("DescribeTraceInfoNodeListResponse.NodeListInfo.EntityTypeList.Length"); i++) {<NEW_LINE>entityTypeList.add(context.stringValue("DescribeTraceInfoNodeListResponse.NodeListInfo.EntityTypeList[" + i + "]"));<NEW_LINE>}<NEW_LINE>nodeListInfo.setEntityTypeList(entityTypeList);<NEW_LINE>List<Edge> edgeList = new ArrayList<Edge>();<NEW_LINE>for (int i = 0; i < context.lengthValue("DescribeTraceInfoNodeListResponse.NodeListInfo.EdgeList.Length"); i++) {<NEW_LINE>Edge edge = new Edge();<NEW_LINE>edge.setEndId(context.stringValue("DescribeTraceInfoNodeListResponse.NodeListInfo.EdgeList[" + i + "].EndId"));<NEW_LINE>edge.setStartId(context.stringValue<MASK><NEW_LINE>edge.setTime(context.stringValue("DescribeTraceInfoNodeListResponse.NodeListInfo.EdgeList[" + i + "].Time"));<NEW_LINE>edgeList.add(edge);<NEW_LINE>}<NEW_LINE>nodeListInfo.setEdgeList(edgeList);<NEW_LINE>List<Vertex> vertexList = new ArrayList<Vertex>();<NEW_LINE>for (int i = 0; i < context.lengthValue("DescribeTraceInfoNodeListResponse.NodeListInfo.VertexList.Length"); i++) {<NEW_LINE>Vertex vertex = new Vertex();<NEW_LINE>vertex.setName(context.stringValue("DescribeTraceInfoNodeListResponse.NodeListInfo.VertexList[" + i + "].Name"));<NEW_LINE>vertex.setId(context.stringValue("DescribeTraceInfoNodeListResponse.NodeListInfo.VertexList[" + i + "].Id"));<NEW_LINE>vertex.setTime(context.stringValue("DescribeTraceInfoNodeListResponse.NodeListInfo.VertexList[" + i + "].Time"));<NEW_LINE>List<String> neighborList = new ArrayList<String>();<NEW_LINE>for (int j = 0; j < context.lengthValue("DescribeTraceInfoNodeListResponse.NodeListInfo.VertexList[" + i + "].NeighborList.Length"); j++) {<NEW_LINE>neighborList.add(context.stringValue("DescribeTraceInfoNodeListResponse.NodeListInfo.VertexList[" + i + "].NeighborList[" + j + "]"));<NEW_LINE>}<NEW_LINE>vertex.setNeighborList(neighborList);<NEW_LINE>vertexList.add(vertex);<NEW_LINE>}<NEW_LINE>nodeListInfo.setVertexList(vertexList);<NEW_LINE>describeTraceInfoNodeListResponse.setNodeListInfo(nodeListInfo);<NEW_LINE>return describeTraceInfoNodeListResponse;<NEW_LINE>} | ("DescribeTraceInfoNodeListResponse.NodeListInfo.EdgeList[" + i + "].StartId")); |
1,496,426 | private static final String buildMsg(final DocTypeQuery query) {<NEW_LINE>final IADReferenceDAO adReferenceDAO = Services.get(IADReferenceDAO.class);<NEW_LINE>final String docBaseTypeName = adReferenceDAO.retrieveListNameTrl(Env.getCtx(), X_C_DocType.DOCBASETYPE_AD_Reference_ID, query.getDocBaseType());<NEW_LINE>final StringBuilder sb = new StringBuilder("@NotFound@ @C_DocType_ID@");<NEW_LINE>sb.append(" - @DocBaseType@ : " + docBaseTypeName);<NEW_LINE>sb.append(<MASK><NEW_LINE>sb.append(", @AD_Client_ID@: " + query.getAdClientId());<NEW_LINE>sb.append(", @AD_Org_ID@: " + query.getAdOrgId());<NEW_LINE>if (query.getIsSOTrx() != null) {<NEW_LINE>sb.append(", @IsSOTrx@: " + query.getIsSOTrx());<NEW_LINE>}<NEW_LINE>if (!Check.isEmpty(query.getName(), true)) {<NEW_LINE>sb.append(", @Name@: ").append(query.getName());<NEW_LINE>}<NEW_LINE>return sb.toString();<NEW_LINE>} | ", @DocSubType@: " + query.getDocSubType()); |
1,736,000 | private static void checksumFromLuceneFile(Directory directory, String file, Map<String, StoreFileMetaData> builder, Logger logger, Version version, boolean readFileAsHash) throws IOException {<NEW_LINE>final String checksum;<NEW_LINE><MASK><NEW_LINE>try (IndexInput in = directory.openInput(file, IOContext.READONCE)) {<NEW_LINE>final long length;<NEW_LINE>try {<NEW_LINE>length = in.length();<NEW_LINE>if (length < CodecUtil.footerLength()) {<NEW_LINE>// truncated files trigger IAE if we seek negative... these files are really corrupted though<NEW_LINE>throw new CorruptIndexException("Can't retrieve checksum from file: " + file + " file length must be >= " + CodecUtil.footerLength() + " but was: " + in.length(), in);<NEW_LINE>}<NEW_LINE>if (readFileAsHash) {<NEW_LINE>// additional safety we checksum the entire file we read the hash for...<NEW_LINE>final VerifyingIndexInput verifyingIndexInput = new VerifyingIndexInput(in);<NEW_LINE>hashFile(fileHash, new InputStreamIndexInput(verifyingIndexInput, length), length);<NEW_LINE>checksum = digestToString(verifyingIndexInput.verify());<NEW_LINE>} else {<NEW_LINE>checksum = digestToString(CodecUtil.retrieveChecksum(in));<NEW_LINE>}<NEW_LINE>} catch (Exception ex) {<NEW_LINE>logger.debug(() -> new ParameterizedMessage("Can retrieve checksum from file [{}]", file), ex);<NEW_LINE>throw ex;<NEW_LINE>}<NEW_LINE>builder.put(file, new StoreFileMetaData(file, length, checksum, version, fileHash.get()));<NEW_LINE>}<NEW_LINE>} | final BytesRefBuilder fileHash = new BytesRefBuilder(); |
1,527,680 | public Graph filter(Subgraph[] graphs) {<NEW_LINE>if (graphs.length > 1) {<NEW_LINE>throw new IllegalArgumentException("Filter accepts a single graph in parameter");<NEW_LINE>}<NEW_LINE>Graph graph = graphs[0];<NEW_LINE>Graph mainGraph = graph.getView().getGraphModel().getGraph();<NEW_LINE>List<Edge> <MASK><NEW_LINE>for (Edge e : mainGraph.getEdges()) {<NEW_LINE>boolean source = graph.contains(e.getSource());<NEW_LINE>boolean target = graph.contains(e.getTarget());<NEW_LINE>boolean keep = false;<NEW_LINE>switch(option) {<NEW_LINE>case SOURCE:<NEW_LINE>keep = source;<NEW_LINE>break;<NEW_LINE>case TARGET:<NEW_LINE>keep = target;<NEW_LINE>break;<NEW_LINE>case BOTH:<NEW_LINE>keep = source && target;<NEW_LINE>break;<NEW_LINE>case ANY:<NEW_LINE>keep = source || target;<NEW_LINE>break;<NEW_LINE>}<NEW_LINE>if (keep) {<NEW_LINE>edgesToKeep.add(e);<NEW_LINE>}<NEW_LINE>}<NEW_LINE>graph.clearEdges();<NEW_LINE>for (Node n : mainGraph.getNodes()) {<NEW_LINE>if (!graph.contains(n)) {<NEW_LINE>graph.addNode(n);<NEW_LINE>}<NEW_LINE>}<NEW_LINE>for (Edge e : edgesToKeep) {<NEW_LINE>graph.addEdge(e);<NEW_LINE>}<NEW_LINE>return graph;<NEW_LINE>} | edgesToKeep = new ArrayList<>(); |
1,446,661 | public void performOperation(Random rnd, Genome[] parents, int parentIndex, Genome[] offspring, int offspringIndex) {<NEW_LINE>ArrayGenome mother = (ArrayGenome) parents[parentIndex];<NEW_LINE>ArrayGenome father = (ArrayGenome) parents[parentIndex + 1];<NEW_LINE>ArrayGenome offspring1 = (ArrayGenome) this.owner.getPopulation().getGenomeFactory().factor();<NEW_LINE>ArrayGenome offspring2 = (ArrayGenome) this.owner.getPopulation().getGenomeFactory().factor();<NEW_LINE>offspring[offspringIndex] = offspring1;<NEW_LINE>offspring[offspringIndex + 1] = offspring2;<NEW_LINE>final int geneLength = mother.size();<NEW_LINE>// the chromosome must be cut at two positions, determine them<NEW_LINE>final int cutpoint1 = (int) (rnd.nextInt<MASK><NEW_LINE>final int cutpoint2 = cutpoint1 + this.cutLength;<NEW_LINE>// handle cut section<NEW_LINE>for (int i = 0; i < geneLength; i++) {<NEW_LINE>if (!((i < cutpoint1) || (i > cutpoint2))) {<NEW_LINE>offspring1.copy(father, i, i);<NEW_LINE>offspring2.copy(mother, i, i);<NEW_LINE>}<NEW_LINE>}<NEW_LINE>// handle outer sections<NEW_LINE>for (int i = 0; i < geneLength; i++) {<NEW_LINE>if ((i < cutpoint1) || (i > cutpoint2)) {<NEW_LINE>offspring1.copy(mother, i, i);<NEW_LINE>offspring2.copy(father, i, i);<NEW_LINE>}<NEW_LINE>}<NEW_LINE>} | (geneLength - this.cutLength)); |
250,413 | private // <editor-fold defaultstate="collapsed" desc="Generated Code">//GEN-BEGIN:initComponents<NEW_LINE>void initComponents() {<NEW_LINE>jLabel2 = new javax.swing.JLabel();<NEW_LINE>jLabel1 = new javax.swing.JLabel();<NEW_LINE>// NOI18N<NEW_LINE>org.openide.awt.Mnemonics.setLocalizedText(jLabel2, org.openide.util.NbBundle.getMessage(CordovaNotFound.class, "CordovaNotFound.jLabel2.text"));<NEW_LINE>jLabel2.addMouseListener(new java.awt.event.MouseAdapter() {<NEW_LINE><NEW_LINE>public void mouseClicked(java.awt.event.MouseEvent evt) {<NEW_LINE>jLabel2MouseClicked(evt);<NEW_LINE>}<NEW_LINE>});<NEW_LINE>// NOI18N<NEW_LINE>org.openide.awt.Mnemonics.setLocalizedText(jLabel1, org.openide.util.NbBundle.getMessage(CordovaNotFound.class, "CordovaNotFound.jLabel1.text"));<NEW_LINE>javax.swing.GroupLayout layout = new javax.swing.GroupLayout(this);<NEW_LINE>this.setLayout(layout);<NEW_LINE>layout.setHorizontalGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING).addComponent(jLabel1, javax.swing.GroupLayout.PREFERRED_SIZE, 0, Short.MAX_VALUE).addComponent(jLabel2, javax.swing.GroupLayout.DEFAULT_SIZE<MASK><NEW_LINE>layout.setVerticalGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING).addGroup(layout.createSequentialGroup().addComponent(jLabel1, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE).addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE).addComponent(jLabel2, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE).addContainerGap()));<NEW_LINE>} | , 530, Short.MAX_VALUE)); |
1,092,555 | private void updateImage(BufferedImage image, boolean force) {<NEW_LINE>int width = image.getWidth();<NEW_LINE><MASK><NEW_LINE>Graphics2D g = image.createGraphics();<NEW_LINE>myImageHeight = 0;<NEW_LINE>int min = myMin + myGap;<NEW_LINE>int max = height / myArraySize;<NEW_LINE>if (max < min) {<NEW_LINE>max = height / min;<NEW_LINE>int currentIndex = 0;<NEW_LINE>SingleValue currentValue = new SingleValue();<NEW_LINE>for (int index = 0; index < myArraySize; index++) {<NEW_LINE>Value value = myArray[index];<NEW_LINE>int i = index * max / myArraySize;<NEW_LINE>if (i > currentIndex) {<NEW_LINE>currentValue.paint(g, 0, myImageHeight, width, min, force);<NEW_LINE>myImageHeight += min;<NEW_LINE>currentIndex = i;<NEW_LINE>currentValue.myStripe = value == null ? null : value.get();<NEW_LINE>currentValue.myModified = value != null && value.myModified;<NEW_LINE>} else if (value != null) {<NEW_LINE>ErrorStripe stripe = value.get();<NEW_LINE>if (stripe != null && stripe.compareTo(currentValue.myStripe) < 0) {<NEW_LINE>currentValue.myStripe = stripe;<NEW_LINE>}<NEW_LINE>if (value.myModified) {<NEW_LINE>currentValue.myModified = true;<NEW_LINE>}<NEW_LINE>}<NEW_LINE>if (value != null) {<NEW_LINE>value.myModified = false;<NEW_LINE>}<NEW_LINE>}<NEW_LINE>currentValue.paint(g, 0, myImageHeight, width, min, force);<NEW_LINE>myImageHeight += min;<NEW_LINE>} else {<NEW_LINE>if (max > myMax) {<NEW_LINE>max = Math.max(myMax, min);<NEW_LINE>}<NEW_LINE>for (int index = 0; index < myArraySize; index++) {<NEW_LINE>Value value = myArray[index];<NEW_LINE>if (value != null) {<NEW_LINE>value.paint(g, 0, myImageHeight, width, max, force);<NEW_LINE>value.myModified = false;<NEW_LINE>}<NEW_LINE>myImageHeight += max;<NEW_LINE>}<NEW_LINE>}<NEW_LINE>g.dispose();<NEW_LINE>} | int height = image.getHeight(); |
343,783 | private Mono<Response<Flux<ByteBuffer>>> deleteWithResponseAsync(String resourceGroupName, String restorePointCollectionName, Context context) {<NEW_LINE>if (this.client.getEndpoint() == null) {<NEW_LINE>return Mono.error(new IllegalArgumentException("Parameter this.client.getEndpoint() is required and cannot be null."));<NEW_LINE>}<NEW_LINE>if (this.client.getSubscriptionId() == null) {<NEW_LINE>return Mono.error(new IllegalArgumentException("Parameter this.client.getSubscriptionId() is required and cannot be null."));<NEW_LINE>}<NEW_LINE>if (resourceGroupName == null) {<NEW_LINE>return Mono.error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null."));<NEW_LINE>}<NEW_LINE>if (restorePointCollectionName == null) {<NEW_LINE>return Mono.<MASK><NEW_LINE>}<NEW_LINE>final String apiVersion = "2021-11-01";<NEW_LINE>final String accept = "application/json";<NEW_LINE>context = this.client.mergeContext(context);<NEW_LINE>return service.delete(this.client.getEndpoint(), this.client.getSubscriptionId(), resourceGroupName, restorePointCollectionName, apiVersion, accept, context);<NEW_LINE>} | error(new IllegalArgumentException("Parameter restorePointCollectionName is required and cannot be null.")); |
218,617 | private void wrapUp(@Nullable Throwable throwable) {<NEW_LINE>KafkaUtils.clearConsumerGroupId();<NEW_LINE>if (this.micrometerHolder != null) {<NEW_LINE>this.micrometerHolder.destroy();<NEW_LINE>}<NEW_LINE>publishConsumerStoppingEvent(this.consumer);<NEW_LINE>Collection<TopicPartition> partitions = getAssignedPartitions();<NEW_LINE>if (!this.fatalError) {<NEW_LINE>if (this.kafkaTxManager == null) {<NEW_LINE>commitPendingAcks();<NEW_LINE>try {<NEW_LINE>this.consumer.unsubscribe();<NEW_LINE>} catch (@SuppressWarnings(UNUSED) WakeupException e) {<NEW_LINE>// No-op. Continue process<NEW_LINE>}<NEW_LINE>}<NEW_LINE>} else {<NEW_LINE>if (!(throwable instanceof Error)) {<NEW_LINE>this.logger.error("Fatal consumer exception; stopping container");<NEW_LINE>}<NEW_LINE>KafkaMessageListenerContainer.this.emergencyStop.run();<NEW_LINE>}<NEW_LINE>this.monitorTask.cancel(true);<NEW_LINE>if (!this.taskSchedulerExplicitlySet) {<NEW_LINE>((ThreadPoolTaskScheduler) this.taskScheduler).destroy();<NEW_LINE>}<NEW_LINE>this.consumer.close();<NEW_LINE>getAfterRollbackProcessor().clearThreadState();<NEW_LINE>if (this.commonErrorHandler != null) {<NEW_LINE>this.commonErrorHandler.clearThreadState();<NEW_LINE>}<NEW_LINE>if (this.consumerSeekAwareListener != null) {<NEW_LINE>this.consumerSeekAwareListener.onPartitionsRevoked(partitions);<NEW_LINE>this.consumerSeekAwareListener.unregisterSeekCallback();<NEW_LINE>}<NEW_LINE>this.logger.info((<MASK><NEW_LINE>publishConsumerStoppedEvent(throwable);<NEW_LINE>} | ) -> getGroupId() + ": Consumer stopped"); |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.