idx int32 46 1.86M | input stringlengths 321 6.6k | target stringlengths 9 1.24k |
|---|---|---|
1,089,781 | private long insertOrUpdateGroupContactInDb(ChatGroup group) {<NEW_LINE>// Insert a record in contacts table<NEW_LINE>ContentValues values = new ContentValues(4);<NEW_LINE>values.put(Imps.Contacts.USERNAME, group.getAddress().getAddress());<NEW_LINE>values.put(Imps.Contacts.NICKNAME, group.getName());<NEW_LINE>values.put(Imps.Contacts.CONTACTLIST, ContactListManagerAdapter.LOCAL_GROUP_LIST_ID);<NEW_LINE>values.put(Imps.Contacts.TYPE, Imps.Contacts.TYPE_GROUP);<NEW_LINE>Uri contactUri = ContentUris.withAppendedId(ContentUris.withAppendedId(Imps.Contacts.CONTENT_URI, mConnection.mProviderId), mConnection.mAccountId);<NEW_LINE>ContactListManagerAdapter listManager = (ContactListManagerAdapter) mConnection.getContactListManager();<NEW_LINE>long <MASK><NEW_LINE>if (id == -1) {<NEW_LINE>id = ContentUris.parseId(mContentResolver.insert(contactUri, values));<NEW_LINE>ArrayList<ContentValues> memberValues = new ArrayList<ContentValues>();<NEW_LINE>Contact self = mConnection.getLoginUser();<NEW_LINE>for (Contact member : group.getMembers()) {<NEW_LINE>if (!member.equals(self)) {<NEW_LINE>// avoid to insert the user himself<NEW_LINE>ContentValues memberValue = new ContentValues(2);<NEW_LINE>memberValue.put(Imps.GroupMembers.USERNAME, member.getAddress().getAddress());<NEW_LINE>memberValue.put(Imps.GroupMembers.NICKNAME, member.getName());<NEW_LINE>memberValues.add(memberValue);<NEW_LINE>}<NEW_LINE>}<NEW_LINE>if (!memberValues.isEmpty()) {<NEW_LINE>ContentValues[] result = new ContentValues[memberValues.size()];<NEW_LINE>memberValues.toArray(result);<NEW_LINE>Uri memberUri = ContentUris.withAppendedId(Imps.GroupMembers.CONTENT_URI, id);<NEW_LINE>mContentResolver.bulkInsert(memberUri, result);<NEW_LINE>}<NEW_LINE>}<NEW_LINE>return id;<NEW_LINE>} | id = listManager.queryGroup(group); |
1,425,001 | public void add(final CommittedChangesFilterKey key, final JComponent comp) {<NEW_LINE>final int idx = myInnerSplitterContents.size();<NEW_LINE><MASK><NEW_LINE>if (idx == 0) {<NEW_LINE>myParentSplitter.setFirstComponent(myInnerSplitter);<NEW_LINE>if (myParentSplitter.getProportion() < 0.05f) {<NEW_LINE>myParentSplitter.setProportion(0.25f);<NEW_LINE>}<NEW_LINE>myInnerSplitter.setFirstComponent(comp);<NEW_LINE>myInnerSplitter.setFirstSize((int) (myParentSplitter.getSize().getWidth() * myParentSplitter.getProportion()));<NEW_LINE>} else if (idx == 1) {<NEW_LINE>final Dimension dimension = myInnerSplitter.getSize();<NEW_LINE>final double width = dimension.getWidth() / 2;<NEW_LINE>myInnerSplitter.setInnerComponent(comp);<NEW_LINE>myInnerSplitter.setFirstSize((int) width);<NEW_LINE>} else {<NEW_LINE>final Dimension dimension = myInnerSplitter.getSize();<NEW_LINE>final double width = dimension.getWidth() / 3;<NEW_LINE>myInnerSplitter.setLastComponent(comp);<NEW_LINE>myInnerSplitter.setFirstSize((int) width);<NEW_LINE>myInnerSplitter.setLastSize((int) width);<NEW_LINE>}<NEW_LINE>updateBorders();<NEW_LINE>myRefresher.run();<NEW_LINE>} | myInnerSplitterContents.put(key, idx); |
624,585 | public void read(org.apache.thrift.protocol.TProtocol prot, setNamespaceProperty_args struct) throws org.apache.thrift.TException {<NEW_LINE>org.apache.thrift.protocol.TTupleProtocol iprot = (org.apache.thrift.protocol.TTupleProtocol) prot;<NEW_LINE>java.util.BitSet incoming = iprot.readBitSet(5);<NEW_LINE>if (incoming.get(0)) {<NEW_LINE>struct.tinfo = new org.apache.accumulo.core.trace.thrift.TInfo();<NEW_LINE>struct.tinfo.read(iprot);<NEW_LINE>struct.setTinfoIsSet(true);<NEW_LINE>}<NEW_LINE>if (incoming.get(1)) {<NEW_LINE>struct.credentials = new org.apache.accumulo.core.securityImpl.thrift.TCredentials();<NEW_LINE>struct.credentials.read(iprot);<NEW_LINE>struct.setCredentialsIsSet(true);<NEW_LINE>}<NEW_LINE>if (incoming.get(2)) {<NEW_LINE>struct<MASK><NEW_LINE>struct.setNsIsSet(true);<NEW_LINE>}<NEW_LINE>if (incoming.get(3)) {<NEW_LINE>struct.property = iprot.readString();<NEW_LINE>struct.setPropertyIsSet(true);<NEW_LINE>}<NEW_LINE>if (incoming.get(4)) {<NEW_LINE>struct.value = iprot.readString();<NEW_LINE>struct.setValueIsSet(true);<NEW_LINE>}<NEW_LINE>} | .ns = iprot.readString(); |
1,512,121 | public void marshall(LambdaFunctionRecommendation lambdaFunctionRecommendation, ProtocolMarshaller protocolMarshaller) {<NEW_LINE>if (lambdaFunctionRecommendation == null) {<NEW_LINE>throw new SdkClientException("Invalid argument passed to marshall(...)");<NEW_LINE>}<NEW_LINE>try {<NEW_LINE>protocolMarshaller.marshall(lambdaFunctionRecommendation.getFunctionArn(), FUNCTIONARN_BINDING);<NEW_LINE>protocolMarshaller.marshall(lambdaFunctionRecommendation.getFunctionVersion(), FUNCTIONVERSION_BINDING);<NEW_LINE>protocolMarshaller.marshall(lambdaFunctionRecommendation.getAccountId(), ACCOUNTID_BINDING);<NEW_LINE>protocolMarshaller.marshall(lambdaFunctionRecommendation.getCurrentMemorySize(), CURRENTMEMORYSIZE_BINDING);<NEW_LINE>protocolMarshaller.marshall(lambdaFunctionRecommendation.getNumberOfInvocations(), NUMBEROFINVOCATIONS_BINDING);<NEW_LINE>protocolMarshaller.marshall(lambdaFunctionRecommendation.getUtilizationMetrics(), UTILIZATIONMETRICS_BINDING);<NEW_LINE>protocolMarshaller.marshall(lambdaFunctionRecommendation.getLookbackPeriodInDays(), LOOKBACKPERIODINDAYS_BINDING);<NEW_LINE>protocolMarshaller.marshall(lambdaFunctionRecommendation.getLastRefreshTimestamp(), LASTREFRESHTIMESTAMP_BINDING);<NEW_LINE>protocolMarshaller.marshall(lambdaFunctionRecommendation.getFinding(), FINDING_BINDING);<NEW_LINE>protocolMarshaller.marshall(lambdaFunctionRecommendation.getFindingReasonCodes(), FINDINGREASONCODES_BINDING);<NEW_LINE>protocolMarshaller.marshall(lambdaFunctionRecommendation.getMemorySizeRecommendationOptions(), MEMORYSIZERECOMMENDATIONOPTIONS_BINDING);<NEW_LINE>protocolMarshaller.marshall(<MASK><NEW_LINE>} catch (Exception e) {<NEW_LINE>throw new SdkClientException("Unable to marshall request to JSON: " + e.getMessage(), e);<NEW_LINE>}<NEW_LINE>} | lambdaFunctionRecommendation.getCurrentPerformanceRisk(), CURRENTPERFORMANCERISK_BINDING); |
485,106 | protected void validateUsingQuery(String query, String prevTableSnapshot, String newTableSnapshot, SQLContext sqlContext) {<NEW_LINE>String queryWithPrevSnapshot = query.replaceAll(HoodiePreCommitValidatorConfig.VALIDATOR_TABLE_VARIABLE, prevTableSnapshot);<NEW_LINE>String queryWithNewSnapshot = query.replaceAll(HoodiePreCommitValidatorConfig.VALIDATOR_TABLE_VARIABLE, newTableSnapshot);<NEW_LINE>LOG.info("Running query on previous state: " + queryWithPrevSnapshot);<NEW_LINE>Dataset<Row> prevRows = sqlContext.sql(queryWithPrevSnapshot);<NEW_LINE>LOG.info("Running query on new state: " + queryWithNewSnapshot);<NEW_LINE>Dataset<Row> newRows = sqlContext.sql(queryWithNewSnapshot);<NEW_LINE>printAllRowsIfDebugEnabled(prevRows);<NEW_LINE>printAllRowsIfDebugEnabled(newRows);<NEW_LINE>boolean areDatasetsEqual = prevRows.intersect(newRows).count() == prevRows.count();<NEW_LINE>LOG.info("Completed Equality Validation, datasets equal? " + areDatasetsEqual);<NEW_LINE>if (!areDatasetsEqual) {<NEW_LINE>LOG.error("query validation failed. See stdout for sample query results. Query: " + query);<NEW_LINE><MASK><NEW_LINE>prevRows.show();<NEW_LINE>System.out.println("Actual result (sample records only):");<NEW_LINE>newRows.show();<NEW_LINE>throw new HoodieValidationException("Query validation failed for '" + query + "'. See stdout for expected vs actual records");<NEW_LINE>}<NEW_LINE>} | System.out.println("Expected result (sample records only):"); |
956,243 | final DisassociateLensesResult executeDisassociateLenses(DisassociateLensesRequest disassociateLensesRequest) {<NEW_LINE>ExecutionContext executionContext = createExecutionContext(disassociateLensesRequest);<NEW_LINE>AWSRequestMetrics awsRequestMetrics = executionContext.getAwsRequestMetrics();<NEW_LINE>awsRequestMetrics.startEvent(Field.ClientExecuteTime);<NEW_LINE>Request<DisassociateLensesRequest> request = null;<NEW_LINE>Response<DisassociateLensesResult> response = null;<NEW_LINE>try {<NEW_LINE>awsRequestMetrics.startEvent(Field.RequestMarshallTime);<NEW_LINE>try {<NEW_LINE>request = new DisassociateLensesRequestProtocolMarshaller(protocolFactory).marshall(super.beforeMarshalling(disassociateLensesRequest));<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, "WellArchitected");<NEW_LINE>request.addHandlerContext(HandlerContextKey.OPERATION_NAME, "DisassociateLenses");<NEW_LINE>request.addHandlerContext(HandlerContextKey.ADVANCED_CONFIG, advancedConfig);<NEW_LINE>} finally {<NEW_LINE>awsRequestMetrics.endEvent(Field.RequestMarshallTime);<NEW_LINE>}<NEW_LINE>HttpResponseHandler<AmazonWebServiceResponse<DisassociateLensesResult>> responseHandler = protocolFactory.createResponseHandler(new JsonOperationMetadata().withPayloadJson(true).withHasStreamingSuccessResponse(false), new DisassociateLensesResultJsonUnmarshaller());<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); |
1,488,947 | protected void drawInternalU(UGraphic ug, Area area) {<NEW_LINE>final StringBounder stringBounder = ug.getStringBounder();<NEW_LINE>final int textHeight = (int) getTextHeight(stringBounder);<NEW_LINE>int x2 = (int) getTextWidth(stringBounder);<NEW_LINE>final double diffX = area.getDimensionToUse().getWidth() - getPreferredWidth(stringBounder);<NEW_LINE>if (diffX < 0) {<NEW_LINE>throw new IllegalArgumentException();<NEW_LINE>}<NEW_LINE>if (area.getDimensionToUse().getWidth() > getPreferredWidth(stringBounder)) {<NEW_LINE>x2 = (int) (area.getDimensionToUse().getWidth() - 2 * getPaddingX());<NEW_LINE>}<NEW_LINE>final UPolygon polygon = new UPolygon();<NEW_LINE>polygon.addPoint(cornersize, 0);<NEW_LINE>polygon.addPoint(x2 - cornersize, 0);<NEW_LINE>polygon.addPoint(x2, textHeight / 2);<NEW_LINE>polygon.addPoint(x2 - cornersize, textHeight);<NEW_LINE>polygon.addPoint(cornersize, textHeight);<NEW_LINE>polygon.addPoint(0, textHeight / 2);<NEW_LINE><MASK><NEW_LINE>ug = symbolContext.apply(ug);<NEW_LINE>polygon.setDeltaShadow(symbolContext.getDeltaShadow());<NEW_LINE>ug.draw(polygon);<NEW_LINE>ug = ug.apply(new UStroke());<NEW_LINE>getTextBlock().drawU(ug.apply(new UTranslate(getMarginX1() + diffX / 2, getMarginY())));<NEW_LINE>} | polygon.addPoint(cornersize, 0); |
368,575 | private Statement buildMoreCompletionEnclosingContext(Statement statement) {<NEW_LINE>IfStatement ifStatement = null;<NEW_LINE>int index = -1;<NEW_LINE>int blockIndex = lastIndexOfElement(K_BLOCK_DELIMITER);<NEW_LINE>int controlIndex = lastIndexOfElement(K_CONTROL_STATEMENT_DELIMITER);<NEW_LINE>int instanceOfIndex = lastIndexOfElement(K_BETWEEN_INSTANCEOF_AND_RPAREN);<NEW_LINE>if (instanceOfIndex != -1 && instanceOfIndex > controlIndex) {<NEW_LINE>index = instanceOfIndex;<NEW_LINE>} else if (controlIndex == -1) {<NEW_LINE>index = blockIndex;<NEW_LINE>} else {<NEW_LINE>index = blockIndex != -1 && controlIndex < blockIndex ? blockIndex : controlIndex;<NEW_LINE>}<NEW_LINE>while (index >= 0) {<NEW_LINE>// Try to find an enclosing if statement even if one is not found immediately preceding the completion node.<NEW_LINE>if (index != -1 && this.elementInfoStack[index] == IF && this.elementObjectInfoStack[index] != null) {<NEW_LINE>Expression condition = (<MASK><NEW_LINE>// If currentElement is a RecoveredLocalVariable then it can be contained in the if statement<NEW_LINE>if (this.currentElement instanceof RecoveredLocalVariable && this.currentElement.parent instanceof RecoveredBlock) {<NEW_LINE>RecoveredLocalVariable recoveredLocalVariable = (RecoveredLocalVariable) this.currentElement;<NEW_LINE>if (recoveredLocalVariable.localDeclaration.initialization == null && statement instanceof Expression && condition.sourceStart < recoveredLocalVariable.localDeclaration.sourceStart) {<NEW_LINE>this.currentElement.add(statement, 0);<NEW_LINE>statement = recoveredLocalVariable.updatedStatement(0, new HashSet<TypeDeclaration>());<NEW_LINE>// RecoveredLocalVariable must be removed from its parent because the IfStatement will be added instead<NEW_LINE>RecoveredBlock recoveredBlock = (RecoveredBlock) recoveredLocalVariable.parent;<NEW_LINE>recoveredBlock.statements[--recoveredBlock.statementCount] = null;<NEW_LINE>this.currentElement = recoveredBlock;<NEW_LINE>}<NEW_LINE>}<NEW_LINE>if (statement instanceof AND_AND_Expression && this.assistNode instanceof Statement) {<NEW_LINE>statement = (Statement) this.assistNode;<NEW_LINE>}<NEW_LINE>ifStatement = new IfStatement(condition, statement, condition.sourceStart, statement.sourceEnd);<NEW_LINE>index--;<NEW_LINE>break;<NEW_LINE>}<NEW_LINE>index--;<NEW_LINE>}<NEW_LINE>if (ifStatement == null) {<NEW_LINE>return statement;<NEW_LINE>}<NEW_LINE>// collect all if statements with instanceof expressions that enclose the completion node<NEW_LINE>// https://bugs.eclipse.org/bugs/show_bug.cgi?id=304006<NEW_LINE>while (index >= 0) {<NEW_LINE>if (this.elementInfoStack[index] == IF && this.elementObjectInfoStack[index] instanceof InstanceOfExpression) {<NEW_LINE>InstanceOfExpression condition = (InstanceOfExpression) this.elementObjectInfoStack[index];<NEW_LINE>ifStatement = new IfStatement(condition, ifStatement, condition.sourceStart, ifStatement.sourceEnd);<NEW_LINE>}<NEW_LINE>index--;<NEW_LINE>}<NEW_LINE>this.enclosingNode = ifStatement;<NEW_LINE>return ifStatement;<NEW_LINE>} | Expression) this.elementObjectInfoStack[index]; |
228,449 | public static HashMap<Integer, Long> createFileTypeToLongMap(final long listings, final long thumbnails, final long images) {<NEW_LINE>final HashMap<Integer, Long> maxAgeMap = new HashMap<>(10);<NEW_LINE>maxAgeMap.put(Constants.FileType.POST_LIST, listings);<NEW_LINE>maxAgeMap.put(Constants.FileType.COMMENT_LIST, listings);<NEW_LINE>maxAgeMap.put(Constants.FileType.SUBREDDIT_LIST, listings);<NEW_LINE>maxAgeMap.put(Constants.FileType.SUBREDDIT_ABOUT, listings);<NEW_LINE>maxAgeMap.put(Constants.FileType.USER_ABOUT, listings);<NEW_LINE>maxAgeMap.put(<MASK><NEW_LINE>maxAgeMap.put(Constants.FileType.THUMBNAIL, thumbnails);<NEW_LINE>maxAgeMap.put(Constants.FileType.IMAGE, images);<NEW_LINE>maxAgeMap.put(Constants.FileType.IMAGE_INFO, images);<NEW_LINE>maxAgeMap.put(Constants.FileType.CAPTCHA, images);<NEW_LINE>maxAgeMap.put(Constants.FileType.INLINE_IMAGE_PREVIEW, images);<NEW_LINE>return maxAgeMap;<NEW_LINE>} | Constants.FileType.INBOX_LIST, listings); |
1,251,966 | public void doFilter(ServletRequest request, ServletResponse response, FilterChain chain) throws IOException, ServletException {<NEW_LINE>HttpServletRequest servletReq = (HttpServletRequest) request;<NEW_LINE>HttpServletResponse servletResp = (HttpServletResponse) response;<NEW_LINE>// Accept timeOffset as argument to enforce timeouts<NEW_LINE>String <MASK><NEW_LINE>String resetDeploymentParam = request.getParameter(RESET_DEPLOYMENT_PARAM);<NEW_LINE>if (timeOffsetParam != null && !timeOffsetParam.isEmpty()) {<NEW_LINE>int timeOffset = Integer.parseInt(timeOffsetParam);<NEW_LINE>log.infof("Time offset updated to %d for application %s", timeOffset, servletReq.getRequestURI());<NEW_LINE>Time.setOffset(timeOffset);<NEW_LINE>writeResponse(servletResp, "Offset set successfully");<NEW_LINE>} else if (resetDeploymentParam != null && !resetDeploymentParam.isEmpty()) {<NEW_LINE>AdapterDeploymentContext deploymentContext = (AdapterDeploymentContext) request.getServletContext().getAttribute(AdapterDeploymentContext.class.getName());<NEW_LINE>Field field = Reflections.findDeclaredField(AdapterDeploymentContext.class, "deployment");<NEW_LINE>Reflections.setAccessible(field);<NEW_LINE>KeycloakDeployment deployment = (KeycloakDeployment) Reflections.getFieldValue(field, deploymentContext);<NEW_LINE>Time.setOffset(0);<NEW_LINE>deployment.setNotBefore(0);<NEW_LINE>if (deployment.getPublicKeyLocator() instanceof JWKPublicKeyLocator) {<NEW_LINE>deployment.setPublicKeyLocator(new JWKPublicKeyLocator());<NEW_LINE>}<NEW_LINE>log.infof("Restarted PublicKeyLocator, notBefore and timeOffset for application %s", servletReq.getRequestURI());<NEW_LINE>writeResponse(servletResp, "Restarted PublicKeyLocator, notBefore and timeOffset successfully");<NEW_LINE>} else {<NEW_LINE>// Continue request<NEW_LINE>chain.doFilter(request, response);<NEW_LINE>}<NEW_LINE>} | timeOffsetParam = request.getParameter(TIME_OFFSET_PARAM); |
1,071,281 | public void initiateOpenIdLogin(String issuer, String redirectUri, String language, Boolean test) throws ApiException {<NEW_LINE>Object localVarPostBody = null;<NEW_LINE>// verify the required parameter 'issuer' is set<NEW_LINE>if (issuer == null) {<NEW_LINE>throw new ApiException(400, "Missing the required parameter 'issuer' when calling initiateOpenIdLogin");<NEW_LINE>}<NEW_LINE>// verify the required parameter 'redirectUri' is set<NEW_LINE>if (redirectUri == null) {<NEW_LINE>throw new ApiException(400, "Missing the required parameter 'redirectUri' when calling initiateOpenIdLogin");<NEW_LINE>}<NEW_LINE>// verify the required parameter 'language' is set<NEW_LINE>if (language == null) {<NEW_LINE>throw new ApiException(400, "Missing the required parameter 'language' when calling initiateOpenIdLogin");<NEW_LINE>}<NEW_LINE>// verify the required parameter 'test' is set<NEW_LINE>if (test == null) {<NEW_LINE>throw new ApiException(400, "Missing the required parameter 'test' when calling initiateOpenIdLogin");<NEW_LINE>}<NEW_LINE>// create path and map variables<NEW_LINE>String localVarPath = "/v4/auth/openid/login";<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("", "issuer", issuer));<NEW_LINE>localVarQueryParams.addAll(apiClient.parameterToPairs("", "redirect_uri", redirectUri));<NEW_LINE>localVarQueryParams.addAll(apiClient.parameterToPairs<MASK><NEW_LINE>localVarQueryParams.addAll(apiClient.parameterToPairs("", "test", test));<NEW_LINE>final String[] localVarAccepts = { "application/json" };<NEW_LINE>final String localVarAccept = apiClient.selectHeaderAccept(localVarAccepts);<NEW_LINE>final String[] localVarContentTypes = {};<NEW_LINE>final String localVarContentType = apiClient.selectHeaderContentType(localVarContentTypes);<NEW_LINE>String[] localVarAuthNames = new String[] {};<NEW_LINE>apiClient.invokeAPI(localVarPath, "GET", localVarQueryParams, localVarPostBody, localVarHeaderParams, localVarFormParams, localVarAccept, localVarContentType, localVarAuthNames, null);<NEW_LINE>} | ("", "language", language)); |
1,464,481 | public void onError(java.lang.Exception e) {<NEW_LINE>byte msgType = org.apache.thrift.protocol.TMessageType.REPLY;<NEW_LINE>org.apache.thrift.TSerializable msg;<NEW_LINE>startGetSummaries_result result = new startGetSummaries_result();<NEW_LINE>if (e instanceof org.apache.accumulo.core.clientImpl.thrift.ThriftSecurityException) {<NEW_LINE>result.sec = (org.apache.accumulo.core.clientImpl.thrift.ThriftSecurityException) e;<NEW_LINE>result.setSecIsSet(true);<NEW_LINE>msg = result;<NEW_LINE>} else if (e instanceof org.apache.accumulo.core.clientImpl.thrift.ThriftTableOperationException) {<NEW_LINE>result.tope = (org.apache.accumulo.core.clientImpl.thrift.ThriftTableOperationException) e;<NEW_LINE>result.setTopeIsSet(true);<NEW_LINE>msg = result;<NEW_LINE>} else if (e instanceof org.apache.thrift.transport.TTransportException) {<NEW_LINE>_LOGGER.error("TTransportException inside handler", e);<NEW_LINE>fb.close();<NEW_LINE>return;<NEW_LINE>} else if (e instanceof org.apache.thrift.TApplicationException) {<NEW_LINE>_LOGGER.error("TApplicationException inside handler", e);<NEW_LINE>msgType = org.apache.thrift.protocol.TMessageType.EXCEPTION;<NEW_LINE>msg = (org<MASK><NEW_LINE>} else {<NEW_LINE>_LOGGER.error("Exception inside handler", e);<NEW_LINE>msgType = org.apache.thrift.protocol.TMessageType.EXCEPTION;<NEW_LINE>msg = new org.apache.thrift.TApplicationException(org.apache.thrift.TApplicationException.INTERNAL_ERROR, e.getMessage());<NEW_LINE>}<NEW_LINE>try {<NEW_LINE>fcall.sendResponse(fb, msg, msgType, seqid);<NEW_LINE>} catch (java.lang.Exception ex) {<NEW_LINE>_LOGGER.error("Exception writing to internal frame buffer", ex);<NEW_LINE>fb.close();<NEW_LINE>}<NEW_LINE>} | .apache.thrift.TApplicationException) e; |
371,243 | private static Hashtable parseQueryString(String query) {<NEW_LINE>Hashtable<String, String[]> ht = new Hashtable<String, String[]>();<NEW_LINE>if (query == null)<NEW_LINE>return ht;<NEW_LINE>StringTokenizer st = new StringTokenizer(query, "&");<NEW_LINE>while (st.hasMoreTokens()) {<NEW_LINE>String pair = st.nextToken();<NEW_LINE>int eq = pair.indexOf('=');<NEW_LINE>if (eq >= 0) {<NEW_LINE>String key = percentDecode(pair.substring(0, eq));<NEW_LINE>String value = percentDecode(pair.substring(eq + 1));<NEW_LINE>if (ht.containsKey(key)) {<NEW_LINE>// This implementation is quite inefficient, but<NEW_LINE>// this won't bother us in any real-world use.<NEW_LINE>String[] oldvalues = (String[]) ht.get(key);<NEW_LINE>String[] values = new <MASK><NEW_LINE>System.arraycopy(oldvalues, 0, values, 0, oldvalues.length);<NEW_LINE>values[oldvalues.length] = value;<NEW_LINE>ht.put(key, values);<NEW_LINE>} else {<NEW_LINE>String[] values = new String[1];<NEW_LINE>values[0] = value;<NEW_LINE>ht.put(key, values);<NEW_LINE>}<NEW_LINE>}<NEW_LINE>}<NEW_LINE>return ht;<NEW_LINE>} | String[oldvalues.length + 1]; |
1,266,203 | public InstanceStorageInfo unmarshall(StaxUnmarshallerContext context) throws Exception {<NEW_LINE>InstanceStorageInfo instanceStorageInfo = new InstanceStorageInfo();<NEW_LINE>int originalDepth = context.getCurrentDepth();<NEW_LINE>int targetDepth = originalDepth + 1;<NEW_LINE>if (context.isStartOfDocument())<NEW_LINE>targetDepth += 1;<NEW_LINE>while (true) {<NEW_LINE>XMLEvent xmlEvent = context.nextEvent();<NEW_LINE>if (xmlEvent.isEndDocument())<NEW_LINE>return instanceStorageInfo;<NEW_LINE>if (xmlEvent.isAttribute() || xmlEvent.isStartElement()) {<NEW_LINE>if (context.testExpression("totalSizeInGB", targetDepth)) {<NEW_LINE>instanceStorageInfo.setTotalSizeInGB(LongStaxUnmarshaller.getInstance<MASK><NEW_LINE>continue;<NEW_LINE>}<NEW_LINE>if (context.testExpression("disks", targetDepth)) {<NEW_LINE>instanceStorageInfo.withDisks(new ArrayList<DiskInfo>());<NEW_LINE>continue;<NEW_LINE>}<NEW_LINE>if (context.testExpression("disks/item", targetDepth)) {<NEW_LINE>instanceStorageInfo.withDisks(DiskInfoStaxUnmarshaller.getInstance().unmarshall(context));<NEW_LINE>continue;<NEW_LINE>}<NEW_LINE>if (context.testExpression("nvmeSupport", targetDepth)) {<NEW_LINE>instanceStorageInfo.setNvmeSupport(StringStaxUnmarshaller.getInstance().unmarshall(context));<NEW_LINE>continue;<NEW_LINE>}<NEW_LINE>if (context.testExpression("encryptionSupport", targetDepth)) {<NEW_LINE>instanceStorageInfo.setEncryptionSupport(StringStaxUnmarshaller.getInstance().unmarshall(context));<NEW_LINE>continue;<NEW_LINE>}<NEW_LINE>} else if (xmlEvent.isEndElement()) {<NEW_LINE>if (context.getCurrentDepth() < originalDepth) {<NEW_LINE>return instanceStorageInfo;<NEW_LINE>}<NEW_LINE>}<NEW_LINE>}<NEW_LINE>} | ().unmarshall(context)); |
488,528 | private static JsonAlbertaPatient patientToPatientBPartner(@NonNull final Patient patient) {<NEW_LINE>final JsonAlbertaPatient albertaPatient = new JsonAlbertaPatient();<NEW_LINE>albertaPatient.setIsTransferPatient(patient.isChangeInSupplier());<NEW_LINE>albertaPatient.setIVTherapy(patient.isIvTherapy());<NEW_LINE>// deactivation<NEW_LINE>final String deactivationReason;<NEW_LINE>final BigDecimal reasonNumber = patient.getDeactivationReason();<NEW_LINE>if (reasonNumber != null) {<NEW_LINE>final boolean reasonNumberAboveFour = new BigDecimal("4").compareTo(reasonNumber) < 0;<NEW_LINE>if (reasonNumberAboveFour) {<NEW_LINE>// FIXME this is a quick workaround<NEW_LINE>deactivationReason = "4";<NEW_LINE>} else {<NEW_LINE>deactivationReason = reasonNumber.toString();<NEW_LINE>}<NEW_LINE>} else {<NEW_LINE>deactivationReason = null;<NEW_LINE>}<NEW_LINE>albertaPatient.setDeactivationReason(deactivationReason);<NEW_LINE>albertaPatient.<MASK><NEW_LINE>albertaPatient.setDeactivationDate(asJavaLocalDate(patient.getDeactivationDate()));<NEW_LINE>albertaPatient.setCreatedAt(asInstant(patient.getCreatedAt()));<NEW_LINE>albertaPatient.setUpdatedAt(asInstant(patient.getUpdatedAt()));<NEW_LINE>albertaPatient.setCreatedByIdentifier(formatExternalId(patient.getCreatedBy()));<NEW_LINE>albertaPatient.setUpdateByIdentifier(formatExternalId(patient.getUpdatedBy()));<NEW_LINE>albertaPatient.setClassification(patient.getClassification());<NEW_LINE>albertaPatient.setCareDegree(patient.getCareDegree());<NEW_LINE>if (patient.getHospital() != null && patient.getHospital().getHospitalId() != null) {<NEW_LINE>albertaPatient.setHospitalIdentifier(formatExternalId(patient.getHospital().getHospitalId()));<NEW_LINE>albertaPatient.setDischargeDate(asJavaLocalDate(patient.getHospital().getDischargeDate()));<NEW_LINE>}<NEW_LINE>if (patient.getPayer() != null && patient.getPayer().getPayerId() != null) {<NEW_LINE>albertaPatient.setPayerIdentifier(formatExternalId(patient.getPayer().getPayerId()));<NEW_LINE>albertaPatient.setPayerType(patient.getPayer().getPayerType());<NEW_LINE>albertaPatient.setNumberOfInsured(patient.getPayer().getNumberOfInsured());<NEW_LINE>albertaPatient.setCopaymentFrom(asJavaLocalDate(patient.getPayer().getCopaymentFromDate()));<NEW_LINE>albertaPatient.setCopaymentTo(asJavaLocalDate(patient.getPayer().getCopaymentToDate()));<NEW_LINE>}<NEW_LINE>return albertaPatient;<NEW_LINE>} | setDeactivationComment(patient.getDeactivationComment()); |
597,944 | public boolean apply(Game game, Ability source) {<NEW_LINE>Player controller = game.<MASK><NEW_LINE>Permanent creature = game.getPermanent(getTargetPointer().getFirst(game, source));<NEW_LINE>if (controller != null && creature != null) {<NEW_LINE>for (CombatGroup combatGroup : game.getCombat().getGroups()) {<NEW_LINE>if (combatGroup.getAttackers().contains(creature.getId())) {<NEW_LINE>for (UUID blockerId : combatGroup.getBlockers()) {<NEW_LINE>Permanent blocker = game.getPermanent(blockerId);<NEW_LINE>if (blocker != null) {<NEW_LINE>blocker.tap(source, game);<NEW_LINE>PreventionEffect effect = new PreventDamageByTargetEffect(Duration.EndOfTurn, true);<NEW_LINE>effect.setTargetPointer(new FixedTarget(blocker.getId(), game));<NEW_LINE>game.addEffect(effect, source);<NEW_LINE>}<NEW_LINE>}<NEW_LINE>}<NEW_LINE>}<NEW_LINE>return true;<NEW_LINE>}<NEW_LINE>return false;<NEW_LINE>} | getPlayer(source.getControllerId()); |
1,804,016 | public ActionResult<List<Wo>> execute(EffectivePerson effectivePerson) throws Exception {<NEW_LINE>ActionResult<List<Wo>> <MASK><NEW_LINE>try (EntityManagerContainer emc = EntityManagerContainerFactory.instance().create()) {<NEW_LINE>Business business = new Business(emc);<NEW_LINE>if (business.isManager(effectivePerson)) {<NEW_LINE>List<DingdingQywxSyncRecord> list = business.dingdingAttendanceFactory().findAllSyncRecordWithType(DingdingQywxSyncRecord.syncType_qywx);<NEW_LINE>if (list != null && !list.isEmpty()) {<NEW_LINE>List<Wo> wos = list.stream().map(record -> {<NEW_LINE>Wo wo = new Wo();<NEW_LINE>try {<NEW_LINE>wo = Wo.copier.copy(record, wo);<NEW_LINE>wo.formatDate();<NEW_LINE>} catch (Exception e) {<NEW_LINE>logger.error(e);<NEW_LINE>}<NEW_LINE>return wo;<NEW_LINE>}).collect(Collectors.toList());<NEW_LINE>result.setData(wos);<NEW_LINE>}<NEW_LINE>} else {<NEW_LINE>throw new ExceptionNotManager();<NEW_LINE>}<NEW_LINE>}<NEW_LINE>return result;<NEW_LINE>} | result = new ActionResult<>(); |
914,373 | public static void writeActionsFromString(OFFlowMod.Builder fmb, String inst) {<NEW_LINE>if (fmb.getVersion().compareTo(OFVersion.OF_11) < 0) {<NEW_LINE>log.error("Write Actions Instruction not supported in OpenFlow 1.0");<NEW_LINE>return;<NEW_LINE>}<NEW_LINE>// ActionUtils.fromString() will use setActions(), which should not be used for OF1.3; use temp to avoid overwriting any applyActions data<NEW_LINE>OFFlowMod.Builder tmpFmb = OFFactories.getFactory(fmb.getVersion()).buildFlowModify();<NEW_LINE>OFInstructionWriteActions.Builder ib = OFFactories.getFactory(fmb.getVersion())<MASK><NEW_LINE>ActionUtils.fromString(tmpFmb, inst);<NEW_LINE>ib.setActions(tmpFmb.getActions());<NEW_LINE>log.debug("Appending WriteActions instruction: {}", ib.build());<NEW_LINE>appendInstruction(fmb, ib.build());<NEW_LINE>log.debug("All instructions after append: {}", fmb.getInstructions());<NEW_LINE>} | .instructions().buildWriteActions(); |
30,738 | public static void extractSuperClassGenerics(ClassNode type, ClassNode target, Map<String, ClassNode> spec) {<NEW_LINE>// TODO: this method is very similar to StaticTypesCheckingSupport#extractGenericsConnections,<NEW_LINE>// but operates on ClassNodes instead of GenericsType<NEW_LINE>if (target == null || type == target)<NEW_LINE>return;<NEW_LINE>if (type.isArray() && target.isArray()) {<NEW_LINE>extractSuperClassGenerics(type.getComponentType(), <MASK><NEW_LINE>} else if (type.isArray() && JAVA_LANG_OBJECT.equals(target.getName())) {<NEW_LINE>// Object is superclass of arrays but no generics involved<NEW_LINE>} else if (target.isGenericsPlaceHolder() || type.equals(target) || !implementsInterfaceOrIsSubclassOf(type, target)) {<NEW_LINE>// structural match route<NEW_LINE>if (target.isGenericsPlaceHolder()) {<NEW_LINE>spec.put(target.getGenericsTypes()[0].getName(), type);<NEW_LINE>} else {<NEW_LINE>extractSuperClassGenerics(type.getGenericsTypes(), target.getGenericsTypes(), spec);<NEW_LINE>}<NEW_LINE>} else {<NEW_LINE>// have first to find matching super class or interface<NEW_LINE>ClassNode superClass = getSuperClass(type, target);<NEW_LINE>if (superClass != null) {<NEW_LINE>ClassNode corrected = getCorrectedClassNode(type, superClass, false);<NEW_LINE>extractSuperClassGenerics(corrected, target, spec);<NEW_LINE>} else {<NEW_LINE>// if we reach here, we have an unhandled case<NEW_LINE>throw new GroovyBugError("The type " + type + " seems not to normally extend " + target + ". Sorry, I cannot handle this.");<NEW_LINE>}<NEW_LINE>}<NEW_LINE>} | target.getComponentType(), spec); |
1,124,390 | public Set<UUID> possibleTargets(UUID sourceControllerId, Ability source, Game game) {<NEW_LINE>Set<UUID> possibleTargets = super.possibleTargets(sourceControllerId, source, game);<NEW_LINE>if (this.getTargets().size() == 1) {<NEW_LINE>Card card = game.getCard(this.getTargets().get(0));<NEW_LINE>possibleTargets.removeIf(uuid -> !game.getCard(uuid).getColor(game).shares(card.getColor(game)));<NEW_LINE>return possibleTargets;<NEW_LINE>}<NEW_LINE>if (possibleTargets.size() < 2) {<NEW_LINE>possibleTargets.clear();<NEW_LINE>return possibleTargets;<NEW_LINE>}<NEW_LINE>Set<Card> allTargets = possibleTargets.stream().map(game::getCard).collect(Collectors.toSet());<NEW_LINE>possibleTargets.clear();<NEW_LINE>for (ObjectColor color : ObjectColor.getAllColors()) {<NEW_LINE>Set<Card> inColor = allTargets.stream().filter(card -> card.getColor(game).shares(color)).collect(Collectors.toSet());<NEW_LINE>if (inColor.size() > 1) {<NEW_LINE>inColor.stream().map(MageItem::getId<MASK><NEW_LINE>}<NEW_LINE>if (possibleTargets.size() == allTargets.size()) {<NEW_LINE>break;<NEW_LINE>}<NEW_LINE>}<NEW_LINE>return possibleTargets;<NEW_LINE>} | ).forEach(possibleTargets::add); |
1,470,330 | public void start(Stage primaryStage) {<NEW_LINE>StyleClassedTextArea textArea = new StyleClassedTextArea();<NEW_LINE>textArea.setWrapText(true);<NEW_LINE>Subscription cleanupWhenFinished = textArea.multiPlainChanges().successionEnds(Duration.ofMillis(500)).subscribe(change -> {<NEW_LINE>textArea.setStyleSpans(0, computeHighlighting(textArea.getText()));<NEW_LINE>});<NEW_LINE>// call when no longer need it: `cleanupWhenFinished.unsubscribe();`<NEW_LINE>// load the dictionary<NEW_LINE>try (InputStream input = getClass().getResourceAsStream("spellchecking.dict");<NEW_LINE>BufferedReader br = new BufferedReader(new InputStreamReader(input))) {<NEW_LINE>String line;<NEW_LINE>while ((line = br.readLine()) != null) {<NEW_LINE>dictionary.add(line);<NEW_LINE>}<NEW_LINE>} catch (IOException e) {<NEW_LINE>e.printStackTrace();<NEW_LINE>}<NEW_LINE>// load the sample document<NEW_LINE>InputStream input2 = getClass().getResourceAsStream("spellchecking.txt");<NEW_LINE>try (java.util.Scanner s = new java.util.Scanner(input2)) {<NEW_LINE>String document = s.useDelimiter("\\A").hasNext() ? s.next() : "";<NEW_LINE>textArea.replaceText(0, 0, document);<NEW_LINE>}<NEW_LINE>Scene scene = new Scene(new StackPane(new VirtualizedScrollPane<>(textArea)), 600, 400);<NEW_LINE>scene.getStylesheets().add(getClass().getResource<MASK><NEW_LINE>primaryStage.setScene(scene);<NEW_LINE>primaryStage.setTitle("Spell Checking Demo");<NEW_LINE>primaryStage.show();<NEW_LINE>} | ("spellchecking.css").toExternalForm()); |
620,907 | private ReduceByKey<InputT, KeyT, ValueT, AccT, OutputT> createOperator() {<NEW_LINE>if (valueExtractor == null) {<NEW_LINE>valueExtractor = identity();<NEW_LINE>}<NEW_LINE>if (reducer != null) {<NEW_LINE>return new ReduceByKey<>(name, keyExtractor, keyType, valueExtractor, valueType, reducer, valueComparator, windowBuilder.getWindow().orElse(null), TypeDescriptors.kvs(TypeAwareness.orObjects(Optional.ofNullable(keyType)), TypeAwareness.orObjects(Optional<MASK><NEW_LINE>}<NEW_LINE>return new ReduceByKey<>(name, keyExtractor, keyType, valueExtractor, valueType, accumulatorFactory, accumulate, mergeAccumulators, outputFn, accumulatorTypeDescriptor, valueComparator, windowBuilder.getWindow().orElse(null), TypeDescriptors.kvs(TypeAwareness.orObjects(Optional.ofNullable(keyType)), TypeAwareness.orObjects(Optional.ofNullable(outputType))));<NEW_LINE>} | .ofNullable(outputType)))); |
1,560,647 | Object execute(Object[] arguments, @Cached HPyAsContextNode asContextNode, @Cached PCallHPyFunction callHelperFunctionNode, @Cached HPyCreateTypeFromSpecNode createTypeFromSpecNode, @Cached HPyAsHandleNode asHandleNode, @Cached HPyTransformExceptionToNativeNode transformExceptionToNativeNode, @Exclusive @Cached GilNode gil) throws ArityException {<NEW_LINE><MASK><NEW_LINE>try {<NEW_LINE>checkArity(arguments, 3);<NEW_LINE>GraalHPyContext context = asContextNode.execute(arguments[0]);<NEW_LINE>Object typeSpec = callHelperFunctionNode.call(context, GRAAL_HPY_FROM_HPY_TYPE_SPEC, arguments[1]);<NEW_LINE>Object typeSpecParamArray = callHelperFunctionNode.call(context, GRAAL_HPY_FROM_HPY_TYPE_SPEC_PARAM_ARRAY, arguments[2]);<NEW_LINE>try {<NEW_LINE>Object newType = createTypeFromSpecNode.execute(context, typeSpec, typeSpecParamArray);<NEW_LINE>assert PGuards.isClass(newType, InteropLibrary.getUncached()) : "Object created from type spec is not a type";<NEW_LINE>return asHandleNode.execute(context, newType);<NEW_LINE>} catch (PException e) {<NEW_LINE>transformExceptionToNativeNode.execute(context, e);<NEW_LINE>return GraalHPyHandle.NULL_HANDLE;<NEW_LINE>}<NEW_LINE>} finally {<NEW_LINE>gil.release(mustRelease);<NEW_LINE>}<NEW_LINE>} | boolean mustRelease = gil.acquire(); |
1,474,258 | public Collection<Segment> cutSegmentIfNeed(Collection<Segment> allDelays) {<NEW_LINE>final List<Segment> sortedDelay = new ArrayList<>(allDelays);<NEW_LINE>Collections.sort(sortedDelay, new SortPos1());<NEW_LINE>final List<Segment> result2 = new ArrayList<>();<NEW_LINE>double pendingStart = pos1;<NEW_LINE>for (Segment pause : sortedDelay) {<NEW_LINE>if (pause.pos1 == pendingStart) {<NEW_LINE>pendingStart = pause.pos2;<NEW_LINE>continue;<NEW_LINE>}<NEW_LINE>if (pause.pos1 < pendingStart) {<NEW_LINE>continue;<NEW_LINE>}<NEW_LINE>if (pause.pos1 > this.pos2) {<NEW_LINE>if (pendingStart < this.pos2)<NEW_LINE>result2.add(new Segment<MASK><NEW_LINE>return Collections.unmodifiableCollection(result2);<NEW_LINE>}<NEW_LINE>if (this.contains(pause)) {<NEW_LINE>assert pendingStart < pause.pos1;<NEW_LINE>result2.add(new Segment(pendingStart, pause.pos1));<NEW_LINE>pendingStart = pause.pos2;<NEW_LINE>}<NEW_LINE>}<NEW_LINE>if (pendingStart < this.pos2)<NEW_LINE>result2.add(new Segment(pendingStart, this.pos2));<NEW_LINE>return Collections.unmodifiableCollection(result2);<NEW_LINE>} | (pendingStart, this.pos2)); |
1,307,613 | private void loadNode502() throws IOException, SAXException {<NEW_LINE>PropertyTypeNode node = new PropertyTypeNode(this.context, Identifiers.ServerConfiguration_CertificateGroups_DefaultUserTokenGroup_TrustList_Read_OutputArguments, new QualifiedName(0, "OutputArguments"), new LocalizedText("en", "OutputArguments"), LocalizedText.NULL_VALUE, UInteger.valueOf(0), UInteger.valueOf(0), new DataValue(Variant.NULL_VALUE), Identifiers.Argument, 1, new UInteger[] { org.eclipse.milo.opcua.stack.core.types.builtin.unsigned.UInteger.valueOf(0) }, UByte.valueOf(1), UByte.valueOf(1), 0.0, false);<NEW_LINE>node.addReference(new Reference(Identifiers.ServerConfiguration_CertificateGroups_DefaultUserTokenGroup_TrustList_Read_OutputArguments, Identifiers.HasTypeDefinition, Identifiers.PropertyType.expanded(), true));<NEW_LINE>node.addReference(new Reference(Identifiers.ServerConfiguration_CertificateGroups_DefaultUserTokenGroup_TrustList_Read_OutputArguments, Identifiers.HasProperty, Identifiers.ServerConfiguration_CertificateGroups_DefaultUserTokenGroup_TrustList_Read.expanded(), false));<NEW_LINE>StringBuilder sb = new StringBuilder();<NEW_LINE>sb.append("<ListOfExtensionObject xmlns=\"http://opcfoundation.org/UA/2008/02/Types.xsd\"><ExtensionObject><TypeId><Identifier>i=297</Identifier> </TypeId><Body><Argument><Name>Data</Name><DataType><Identifier>i=15</Identifier> </DataType><ValueRank>-1</ValueRank><ArrayDimensions/> </Argument> </Body> </ExtensionObject> </ListOfExtensionObject>");<NEW_LINE><MASK><NEW_LINE>OpcUaXmlStreamDecoder decoder = new OpcUaXmlStreamDecoder(context.getServer().getSerializationContext()).setInput(new StringReader(xml));<NEW_LINE>Object o = decoder.readVariantValue();<NEW_LINE>DataValue value = new DataValue(new Variant(o));<NEW_LINE>node.setValue(value);<NEW_LINE>this.nodeManager.addNode(node);<NEW_LINE>} | String xml = sb.toString(); |
268,370 | private void addDict(String dict, boolean expandMidDot) {<NEW_LINE>String content = IOUtils.slurpFileNoExceptions(dict, "utf-8");<NEW_LINE>String[] lines = content.split("\n");<NEW_LINE>logger.info(" " + dict + <MASK><NEW_LINE>for (String line : lines) {<NEW_LINE>line = line.trim();<NEW_LINE>// normalize any midDot<NEW_LINE>if (expandMidDot) {<NEW_LINE>// normalize down middot chars<NEW_LINE>line = line.replaceAll(ChineseUtils.MID_DOT_REGEX_STR, "\u00B7");<NEW_LINE>}<NEW_LINE>addOneDict(line);<NEW_LINE>if (DEBUG)<NEW_LINE>EncodingPrintWriter.err.println("ORIG: " + line, "UTF-8");<NEW_LINE>if (expandMidDot && midDot.matcher(line).find()) {<NEW_LINE>line = line.replaceAll(ChineseUtils.MID_DOT_REGEX_STR, "");<NEW_LINE>if (DEBUG)<NEW_LINE>EncodingPrintWriter.err.println("ALSO: " + line, "UTF-8");<NEW_LINE>addOneDict(line);<NEW_LINE>}<NEW_LINE>}<NEW_LINE>} | ": " + lines.length + " entries"); |
9,307 | public void publishApi(String designId, NewApiPublication info, String dereference) throws ServerError, NotFoundException {<NEW_LINE>LinkedAccountType type = info.getType();<NEW_LINE>try {<NEW_LINE>// First step - publish the content to the soruce control system<NEW_LINE>ISourceConnector connector = this.sourceConnectorFactory.createConnector(type);<NEW_LINE>String resourceUrl = toResourceUrl(info);<NEW_LINE>String formattedContent = getApiContent(designId, info.getFormat(), "true".equalsIgnoreCase(dereference));<NEW_LINE>try {<NEW_LINE>ResourceContent content = connector.getResourceContent(resourceUrl);<NEW_LINE>content.setContent(formattedContent);<NEW_LINE>connector.updateResourceContent(resourceUrl, info.getCommitMessage(), null, content);<NEW_LINE>} catch (NotFoundException nfe) {<NEW_LINE>connector.createResourceContent(resourceUrl, info.getCommitMessage(), formattedContent);<NEW_LINE>}<NEW_LINE>// Followup step - store a row in the api_content table<NEW_LINE>try {<NEW_LINE>String user = this.security.getCurrentUser().getLogin();<NEW_LINE>String publicationData = createPublicationData(info);<NEW_LINE>storage.addContent(user, <MASK><NEW_LINE>} catch (Exception e) {<NEW_LINE>logger.error("Failed to record API publication in database.", e);<NEW_LINE>}<NEW_LINE>} catch (SourceConnectorException e) {<NEW_LINE>throw new ServerError(e);<NEW_LINE>}<NEW_LINE>} | designId, ApiContentType.Publish, publicationData); |
1,650 | private static ECKey extractKeyFromASN1(byte[] asn1privkey) {<NEW_LINE>// To understand this code, see the definition of the ASN.1 format for EC private keys in the OpenSSL source<NEW_LINE>// code in ec_asn1.c:<NEW_LINE>//<NEW_LINE>// ASN1_SEQUENCE(EC_PRIVATEKEY) = {<NEW_LINE>// ASN1_SIMPLE(EC_PRIVATEKEY, version, LONG),<NEW_LINE>// ASN1_SIMPLE(EC_PRIVATEKEY, privateKey, ASN1_OCTET_STRING),<NEW_LINE>// ASN1_EXP_OPT(EC_PRIVATEKEY, parameters, ECPKPARAMETERS, 0),<NEW_LINE>// ASN1_EXP_OPT(EC_PRIVATEKEY, publicKey, ASN1_BIT_STRING, 1)<NEW_LINE>// } ASN1_SEQUENCE_END(EC_PRIVATEKEY)<NEW_LINE>//<NEW_LINE>try {<NEW_LINE>ASN1InputStream decoder = new ASN1InputStream(asn1privkey);<NEW_LINE>DLSequence seq = (DLSequence) decoder.readObject();<NEW_LINE>checkArgument(decoder.readObject() == null, "Input contains extra bytes");<NEW_LINE>decoder.close();<NEW_LINE>checkArgument(seq.<MASK><NEW_LINE>checkArgument(((ASN1Integer) seq.getObjectAt(0)).getValue().equals(BigInteger.ONE), "Input is of wrong version");<NEW_LINE>byte[] privbits = ((ASN1OctetString) seq.getObjectAt(1)).getOctets();<NEW_LINE>BigInteger privkey = Utils.bytesToBigInteger(privbits);<NEW_LINE>ASN1TaggedObject pubkey = (ASN1TaggedObject) seq.getObjectAt(3);<NEW_LINE>checkArgument(pubkey.getTagNo() == 1, "Input has 'publicKey' with bad tag number");<NEW_LINE>byte[] pubbits = ((DERBitString) pubkey.getObject()).getBytes();<NEW_LINE>checkArgument(pubbits.length == 33 || pubbits.length == 65, "Input has 'publicKey' with invalid length");<NEW_LINE>int encoding = pubbits[0] & 0xFF;<NEW_LINE>// Only allow compressed(2,3) and uncompressed(4), not infinity(0) or hybrid(6,7)<NEW_LINE>checkArgument(encoding >= 2 && encoding <= 4, "Input has 'publicKey' with invalid encoding");<NEW_LINE>// Now sanity check to ensure the pubkey bytes match the privkey.<NEW_LINE>ECKey key = ECKey.fromPrivate(privkey, isPubKeyCompressed(pubbits));<NEW_LINE>if (!Arrays.equals(key.getPubKey(), pubbits))<NEW_LINE>throw new IllegalArgumentException("Public key in ASN.1 structure does not match private key.");<NEW_LINE>return key;<NEW_LINE>} catch (IOException e) {<NEW_LINE>// Cannot happen, reading from memory stream.<NEW_LINE>throw new RuntimeException(e);<NEW_LINE>}<NEW_LINE>} | size() == 4, "Input does not appear to be an ASN.1 OpenSSL EC private key"); |
890,995 | private BeanDeploymentArchive createNewBdaAndMakeWiring(Class<?> beanClass) {<NEW_LINE>try {<NEW_LINE>OnDemandArchive onDemandArchive = new OnDemandArchive(cdiRuntime, application, beanClass);<NEW_LINE>WebSphereBeanDeploymentArchive newBda = BDAFactory.createBDA(this, onDemandArchive, cdiRuntime);<NEW_LINE><MASK><NEW_LINE>// need to make this bda to be accessible to other bdas according to classloader hierarchy<NEW_LINE>for (WebSphereBeanDeploymentArchive wbda : getWebSphereBeanDeploymentArchives()) {<NEW_LINE>ClassLoader thisBDACL = wbda.getClassLoader();<NEW_LINE>// If the current archive is an extension bda, let's add this newly created bda accessible to it<NEW_LINE>if (wbda.getType() == ArchiveType.RUNTIME_EXTENSION) {<NEW_LINE>newBda.addBeanDeploymentArchive(wbda);<NEW_LINE>} else {<NEW_LINE>// let's check to see whether the wbda needs to be accessible to this new bda<NEW_LINE>// The current bda should be accessible to the newly created bda if the newly created bda's classloader<NEW_LINE>// is the same or the child classloader of the current bda<NEW_LINE>makeWiring(newBda, wbda, thisBDACL, beanClassCL);<NEW_LINE>}<NEW_LINE>if ((wbda.getType() == ArchiveType.RUNTIME_EXTENSION) && wbda.extensionCanSeeApplicationBDAs()) {<NEW_LINE>wbda.addBeanDeploymentArchive(newBda);<NEW_LINE>} else {<NEW_LINE>// Let's check whether the wbda's classloader is the descendant classloader of the new bda<NEW_LINE>makeWiring(wbda, newBda, beanClassCL, thisBDACL);<NEW_LINE>}<NEW_LINE>}<NEW_LINE>// Add this new bda to the deployment graph<NEW_LINE>addBeanDeploymentArchive(newBda);<NEW_LINE>return newBda;<NEW_LINE>} catch (CDIException e) {<NEW_LINE>throw new IllegalStateException(e);<NEW_LINE>}<NEW_LINE>} | ClassLoader beanClassCL = onDemandArchive.getClassLoader(); |
277,554 | final CreateScheduledQueryResult executeCreateScheduledQuery(CreateScheduledQueryRequest createScheduledQueryRequest) {<NEW_LINE>ExecutionContext executionContext = createExecutionContext(createScheduledQueryRequest);<NEW_LINE><MASK><NEW_LINE>awsRequestMetrics.startEvent(Field.ClientExecuteTime);<NEW_LINE>Request<CreateScheduledQueryRequest> request = null;<NEW_LINE>Response<CreateScheduledQueryResult> response = null;<NEW_LINE>try {<NEW_LINE>awsRequestMetrics.startEvent(Field.RequestMarshallTime);<NEW_LINE>try {<NEW_LINE>request = new CreateScheduledQueryRequestProtocolMarshaller(protocolFactory).marshall(super.beforeMarshalling(createScheduledQueryRequest));<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, "Timestream Query");<NEW_LINE>request.addHandlerContext(HandlerContextKey.OPERATION_NAME, "CreateScheduledQuery");<NEW_LINE>request.addHandlerContext(HandlerContextKey.ADVANCED_CONFIG, advancedConfig);<NEW_LINE>} finally {<NEW_LINE>awsRequestMetrics.endEvent(Field.RequestMarshallTime);<NEW_LINE>}<NEW_LINE>URI cachedEndpoint = null;<NEW_LINE>if (endpointDiscoveryEnabled) {<NEW_LINE>DescribeEndpointsRequest discoveryRequest = new DescribeEndpointsRequest();<NEW_LINE>cachedEndpoint = cache.get(awsCredentialsProvider.getCredentials().getAWSAccessKeyId(), discoveryRequest, true, endpoint);<NEW_LINE>}<NEW_LINE>HttpResponseHandler<AmazonWebServiceResponse<CreateScheduledQueryResult>> responseHandler = protocolFactory.createResponseHandler(new JsonOperationMetadata().withPayloadJson(true).withHasStreamingSuccessResponse(false), new CreateScheduledQueryResultJsonUnmarshaller());<NEW_LINE>response = invoke(request, responseHandler, executionContext, cachedEndpoint, null);<NEW_LINE>return response.getAwsResponse();<NEW_LINE>} finally {<NEW_LINE>endClientExecution(awsRequestMetrics, request, response);<NEW_LINE>}<NEW_LINE>} | AWSRequestMetrics awsRequestMetrics = executionContext.getAwsRequestMetrics(); |
239,987 | protected String buildString() {<NEW_LINE>StringBuilder sb = new StringBuilder();<NEW_LINE>String ls = System.getProperty("line.separator");<NEW_LINE>sb.append("[IPv4 Header (").append(length()).append(" bytes)]").append(ls);<NEW_LINE>sb.append(" Version: ").append(version).append(ls);<NEW_LINE>sb.append(" IHL: ").append(ihl).append(" (").append(ihl * 4).append(" [bytes])").append(ls);<NEW_LINE>sb.append(" TOS: ").append(tos).append(ls);<NEW_LINE>sb.append(" Total length: ").append(getTotalLengthAsInt()).append(" [bytes]").append(ls);<NEW_LINE>sb.append(" Identification: ").append(getIdentificationAsInt()).append(ls);<NEW_LINE>sb.append(" Flags: (Reserved, Don't Fragment, More Fragment) = (").append(getReservedFlag()).append(", ").append(getDontFragmentFlag()).append(", ").append(getMoreFragmentFlag()).append(")").append(ls);<NEW_LINE>sb.append(" Fragment offset: ").append(fragmentOffset).append(" (").append(fragmentOffset * 8).append(" [bytes])").append(ls);<NEW_LINE>sb.append(" TTL: ").append(getTtlAsInt()).append(ls);<NEW_LINE>sb.append(" Protocol: ").append(protocol).append(ls);<NEW_LINE>sb.append(" Header checksum: 0x").append(ByteArrays.toHexString(headerChecksum, "")).append(ls);<NEW_LINE>sb.append(" Source address: ").append(srcAddr).append(ls);<NEW_LINE>sb.append(" Destination address: ").append<MASK><NEW_LINE>for (IpV4Option opt : options) {<NEW_LINE>sb.append(" Option: ").append(opt).append(ls);<NEW_LINE>}<NEW_LINE>if (padding.length != 0) {<NEW_LINE>sb.append(" Padding: 0x").append(ByteArrays.toHexString(padding, " ")).append(ls);<NEW_LINE>}<NEW_LINE>return sb.toString();<NEW_LINE>} | (dstAddr).append(ls); |
593,419 | public int[] kWeakestRows(int[][] mat, int k) {<NEW_LINE>List<int[]> <MASK><NEW_LINE>for (int i = 0; i < mat.length; i++) {<NEW_LINE>int soldiers = 0;<NEW_LINE>for (int j = 0; j < mat[0].length; j++) {<NEW_LINE>if (mat[i][j] == 1) {<NEW_LINE>soldiers++;<NEW_LINE>} else {<NEW_LINE>break;<NEW_LINE>}<NEW_LINE>}<NEW_LINE>list.add(new int[] { i, soldiers });<NEW_LINE>}<NEW_LINE>Collections.sort(list, (a, b) -> a[1] == b[1] ? a[0] - b[0] : a[1] - b[1]);<NEW_LINE>int[] result = new int[k];<NEW_LINE>int i = 0;<NEW_LINE>while (i < k) {<NEW_LINE>result[i] = list.get(i++)[0];<NEW_LINE>}<NEW_LINE>return result;<NEW_LINE>} | list = new ArrayList<>(); |
140,986 | final DeregisterTaskDefinitionResult executeDeregisterTaskDefinition(DeregisterTaskDefinitionRequest deregisterTaskDefinitionRequest) {<NEW_LINE>ExecutionContext executionContext = createExecutionContext(deregisterTaskDefinitionRequest);<NEW_LINE>AWSRequestMetrics awsRequestMetrics = executionContext.getAwsRequestMetrics();<NEW_LINE>awsRequestMetrics.startEvent(Field.ClientExecuteTime);<NEW_LINE>Request<DeregisterTaskDefinitionRequest> request = null;<NEW_LINE>Response<DeregisterTaskDefinitionResult> response = null;<NEW_LINE>try {<NEW_LINE>awsRequestMetrics.startEvent(Field.RequestMarshallTime);<NEW_LINE>try {<NEW_LINE>request = new DeregisterTaskDefinitionRequestProtocolMarshaller(protocolFactory).marshall(super.beforeMarshalling(deregisterTaskDefinitionRequest));<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, "DeregisterTaskDefinition");<NEW_LINE>request.addHandlerContext(HandlerContextKey.ADVANCED_CONFIG, advancedConfig);<NEW_LINE>} finally {<NEW_LINE>awsRequestMetrics.endEvent(Field.RequestMarshallTime);<NEW_LINE>}<NEW_LINE>HttpResponseHandler<AmazonWebServiceResponse<DeregisterTaskDefinitionResult>> responseHandler = protocolFactory.createResponseHandler(new JsonOperationMetadata().withPayloadJson(true).withHasStreamingSuccessResponse(false), new DeregisterTaskDefinitionResultJsonUnmarshaller());<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); |
548,996 | public Operation.OperationResult executeFixedCostOperation(final MessageFrame frame, final EVM evm) {<NEW_LINE>final Bytes value0 = frame.popStackItem();<NEW_LINE>final Bytes value1 = frame.popStackItem();<NEW_LINE>if (value1.isZero()) {<NEW_LINE>frame.pushStackItem(UInt256.ZERO);<NEW_LINE>} else {<NEW_LINE>final BigInteger b1 = value0.size() < 32 ? new BigInteger(1, value0.toArrayUnsafe()) : new BigInteger(value0.toArrayUnsafe());<NEW_LINE>final BigInteger b2 = value1.size() < 32 ? new BigInteger(1, value1.toArrayUnsafe()) : new BigInteger(value1.toArrayUnsafe());<NEW_LINE>BigInteger result = b1.abs().mod(b2.abs());<NEW_LINE>if (b1.signum() < 0) {<NEW_LINE>result = result.negate();<NEW_LINE>}<NEW_LINE>Bytes resultBytes = Bytes.wrap(result.toByteArray());<NEW_LINE>if (resultBytes.size() > 32) {<NEW_LINE>resultBytes = resultBytes.slice(resultBytes.<MASK><NEW_LINE>}<NEW_LINE>final byte[] padding = new byte[32 - resultBytes.size()];<NEW_LINE>Arrays.fill(padding, result.signum() < 0 ? (byte) 0xFF : 0x00);<NEW_LINE>frame.pushStackItem(Bytes.concatenate(Bytes.wrap(padding), resultBytes));<NEW_LINE>}<NEW_LINE>return successResponse;<NEW_LINE>} | size() - 32, 32); |
1,649,270 | public V1Span read(ReadBuffer buffer) {<NEW_LINE>if (builder == null) {<NEW_LINE>builder = V1Span.newBuilder();<NEW_LINE>} else {<NEW_LINE>builder.clear();<NEW_LINE>}<NEW_LINE>ThriftField thriftField;<NEW_LINE>while (true) {<NEW_LINE>thriftField = ThriftField.read(buffer);<NEW_LINE>if (thriftField.type == TYPE_STOP)<NEW_LINE>break;<NEW_LINE>if (thriftField.isEqualTo(TRACE_ID_HIGH)) {<NEW_LINE>builder.traceIdHigh(buffer.readLong());<NEW_LINE>} else if (thriftField.isEqualTo(TRACE_ID)) {<NEW_LINE>builder.traceId(buffer.readLong());<NEW_LINE>} else if (thriftField.isEqualTo(NAME)) {<NEW_LINE>builder.name(buffer.readUtf8(buffer.readInt()));<NEW_LINE>} else if (thriftField.isEqualTo(ID)) {<NEW_LINE>builder.id(buffer.readLong());<NEW_LINE>} else if (thriftField.isEqualTo(PARENT_ID)) {<NEW_LINE>builder.parentId(buffer.readLong());<NEW_LINE>} else if (thriftField.isEqualTo(ANNOTATIONS)) {<NEW_LINE>int length = readListLength(buffer);<NEW_LINE>for (int i = 0; i < length; i++) {<NEW_LINE>AnnotationReader.read(buffer, builder);<NEW_LINE>}<NEW_LINE>} else if (thriftField.isEqualTo(BINARY_ANNOTATIONS)) {<NEW_LINE>int length = readListLength(buffer);<NEW_LINE>for (int i = 0; i < length; i++) {<NEW_LINE>BinaryAnnotationReader.read(buffer, builder);<NEW_LINE>}<NEW_LINE>} else if (thriftField.isEqualTo(DEBUG)) {<NEW_LINE>builder.debug(<MASK><NEW_LINE>} else if (thriftField.isEqualTo(TIMESTAMP)) {<NEW_LINE>builder.timestamp(buffer.readLong());<NEW_LINE>} else if (thriftField.isEqualTo(DURATION)) {<NEW_LINE>builder.duration(buffer.readLong());<NEW_LINE>} else {<NEW_LINE>skip(buffer, thriftField.type);<NEW_LINE>}<NEW_LINE>}<NEW_LINE>return builder.build();<NEW_LINE>} | buffer.readByte() == 1); |
1,132,203 | private static void registerAESPlugins(InvocationPlugins plugins, GraalHotSpotVMConfig config, Replacements replacements) {<NEW_LINE>Registration r = new Registration(plugins, "com.sun.crypto.provider.AESCrypt", replacements);<NEW_LINE>r.registerConditional(config.useAESIntrinsics && config.aescryptEncryptBlockStub != 0L, new AESCryptPlugin(ENCRYPT));<NEW_LINE>r.registerConditional(config.useAESIntrinsics && config.aescryptDecryptBlockStub != 0L, new AESCryptPlugin(DECRYPT));<NEW_LINE>r = new Registration(plugins, "com.sun.crypto.provider.CipherBlockChaining", replacements);<NEW_LINE>r.registerConditional(config.useAESIntrinsics && config.cipherBlockChainingEncryptAESCryptStub != 0L, new CipherBlockChainingCryptPlugin(ENCRYPT));<NEW_LINE>r.registerConditional(config.useAESIntrinsics && config.cipherBlockChainingDecryptAESCryptStub != 0L, new CipherBlockChainingCryptPlugin(DECRYPT));<NEW_LINE>r = new Registration(plugins, "com.sun.crypto.provider.ElectronicCodeBook", replacements);<NEW_LINE>r.registerConditional(config.electronicCodeBookEncrypt != <MASK><NEW_LINE>r.registerConditional(config.electronicCodeBookDecrypt != 0L, new ElectronicCodeBookCryptPlugin(DECRYPT));<NEW_LINE>r = new Registration(plugins, "com.sun.crypto.provider.CounterMode", replacements);<NEW_LINE>r.registerConditional(config.useAESCTRIntrinsics(), new CounterModeCryptPlugin());<NEW_LINE>} | 0L, new ElectronicCodeBookCryptPlugin(ENCRYPT)); |
1,679,447 | public Map<String, Object> toJsonCompatibleSnapshot(RemoteVerboseResult<?> verboseResult, Version backwardCompatibilityVersion) throws IOException {<NEW_LINE>Map<String, Object> result = new HashMap<>();<NEW_LINE>result.put("version", v_7_0_0.getNumber());<NEW_LINE>result.<MASK><NEW_LINE>SerializationHandle<Object> valueHandle = SerializationHandles.CORE_HANDLES.getHandleByTypeId(verboseResult.resultTypeId);<NEW_LINE>Map<String, Object> valueSnapshot = valueHandle.toJsonCompatibleSnapshot(verboseResult.value, backwardCompatibilityVersion);<NEW_LINE>valueSnapshot.put("type", valueHandle.getTypeName());<NEW_LINE>result.put("result", valueSnapshot);<NEW_LINE>Map<String, Object> stateSnapshot = RemoteBucketState.SERIALIZATION_HANDLE.toJsonCompatibleSnapshot(verboseResult.state, backwardCompatibilityVersion);<NEW_LINE>result.put("remoteState", stateSnapshot);<NEW_LINE>return result;<NEW_LINE>} | put("operationTimeNanos", verboseResult.operationTimeNanos); |
1,038,431 | private void refreshPoiFiltersOrder(@NonNull ApplicationMode appMode, List<PoiUIFilter> filters) {<NEW_LINE>Map<String, Integer> orders = getPoiFiltersOrder(appMode);<NEW_LINE>List<PoiUIFilter> existedFilters = new ArrayList<>();<NEW_LINE>List<PoiUIFilter> newFilters = new ArrayList<>();<NEW_LINE>if (orders != null) {<NEW_LINE>// set up orders from settings<NEW_LINE>for (PoiUIFilter filter : filters) {<NEW_LINE>Integer order = orders.get(filter.getFilterId());<NEW_LINE>if (order != null) {<NEW_LINE>filter.setOrder(order);<NEW_LINE>existedFilters.add(filter);<NEW_LINE>} else {<NEW_LINE>newFilters.add(filter);<NEW_LINE>}<NEW_LINE>}<NEW_LINE>// make order values without spaces<NEW_LINE>Collections.sort(existedFilters);<NEW_LINE>for (int i = 0; i < existedFilters.size(); i++) {<NEW_LINE>existedFilters.get<MASK><NEW_LINE>}<NEW_LINE>// set up maximum orders for new poi filters<NEW_LINE>Collections.sort(newFilters);<NEW_LINE>for (PoiUIFilter filter : newFilters) {<NEW_LINE>filter.setOrder(existedFilters.size());<NEW_LINE>existedFilters.add(filter);<NEW_LINE>}<NEW_LINE>} else {<NEW_LINE>for (PoiUIFilter filter : filters) {<NEW_LINE>filter.setOrder(PoiUIFilter.INVALID_ORDER);<NEW_LINE>}<NEW_LINE>}<NEW_LINE>} | (i).setOrder(i); |
1,825,688 | public void invoke(Request request, Response response) throws IOException, ServletException {<NEW_LINE>if (getNext() == null) {<NEW_LINE>return;<NEW_LINE>}<NEW_LINE>// check if we already filtered/processed this request<NEW_LINE>if (request.getNote(ALREADY_FILTERED_NOTE) == null) {<NEW_LINE>request.<MASK><NEW_LINE>try {<NEW_LINE>if (request.getContext() != null) {<NEW_LINE>HttpSession session = request.getSession(false);<NEW_LINE>if (session != null) {<NEW_LINE>RedissonSession s = (RedissonSession) request.getContext().getManager().findSession(session.getId());<NEW_LINE>if (s != null) {<NEW_LINE>s.startUsage();<NEW_LINE>}<NEW_LINE>}<NEW_LINE>}<NEW_LINE>getNext().invoke(request, response);<NEW_LINE>} finally {<NEW_LINE>request.removeNote(ALREADY_FILTERED_NOTE);<NEW_LINE>if (request.getContext() != null) {<NEW_LINE>HttpSession session = request.getSession(false);<NEW_LINE>if (session != null) {<NEW_LINE>RedissonSession s = (RedissonSession) request.getContext().getManager().findSession(session.getId());<NEW_LINE>if (s != null) {<NEW_LINE>s.endUsage();<NEW_LINE>}<NEW_LINE>}<NEW_LINE>}<NEW_LINE>}<NEW_LINE>} else {<NEW_LINE>getNext().invoke(request, response);<NEW_LINE>}<NEW_LINE>} | setNote(ALREADY_FILTERED_NOTE, Boolean.TRUE); |
1,533,816 | public String generate(TreeLogger logger, GeneratorContext context, String typeName) throws UnableToCompleteException {<NEW_LINE>this.context = context;<NEW_LINE>this.logger = logger;<NEW_LINE>TypeOracle oracle = context.getTypeOracle();<NEW_LINE>assert (oracle != null);<NEW_LINE>JClassType jType = oracle.findType(typeName);<NEW_LINE>if (jType == null) {<NEW_LINE>logger.log(ERROR, "Couldn't find type '" + typeName + "'");<NEW_LINE>throw new UnableToCompleteException();<NEW_LINE>}<NEW_LINE>if (jType.isInterface() == null) {<NEW_LINE>logger.log(ERROR, "Type '" + typeName + "' must be an interface");<NEW_LINE>throw new UnableToCompleteException();<NEW_LINE>}<NEW_LINE>TypeOracle typeOracle = context.getTypeOracle();<NEW_LINE>JPackage[] packages = typeOracle.getPackages();<NEW_LINE>List<JType> types = new ArrayList<>();<NEW_LINE>// gather all types from wanted packages<NEW_LINE>for (JPackage p : packages) {<NEW_LINE>for (JClassType t : p.getTypes()) {<NEW_LINE>gatherTypes(t.getErasedType(), types);<NEW_LINE>}<NEW_LINE>}<NEW_LINE>// gather all types from explicitly requested packages<NEW_LINE>try {<NEW_LINE>ConfigurationProperty prop = context.<MASK><NEW_LINE>for (String s : prop.getValues()) {<NEW_LINE>JClassType type = typeOracle.findType(s);<NEW_LINE>if (type != null)<NEW_LINE>gatherTypes(type.getErasedType(), types);<NEW_LINE>}<NEW_LINE>} catch (BadPropertyValueException e) {<NEW_LINE>}<NEW_LINE>gatherTypes(typeOracle.findType("java.util.List").getErasedType(), types);<NEW_LINE>gatherTypes(typeOracle.findType("java.util.ArrayList").getErasedType(), types);<NEW_LINE>gatherTypes(typeOracle.findType("java.util.HashMap").getErasedType(), types);<NEW_LINE>gatherTypes(typeOracle.findType("java.util.Map").getErasedType(), types);<NEW_LINE>gatherTypes(typeOracle.findType("java.lang.String").getErasedType(), types);<NEW_LINE>gatherTypes(typeOracle.findType("java.lang.Boolean").getErasedType(), types);<NEW_LINE>gatherTypes(typeOracle.findType("java.lang.Byte").getErasedType(), types);<NEW_LINE>gatherTypes(typeOracle.findType("java.lang.Long").getErasedType(), types);<NEW_LINE>gatherTypes(typeOracle.findType("java.lang.Character").getErasedType(), types);<NEW_LINE>gatherTypes(typeOracle.findType("java.lang.Short").getErasedType(), types);<NEW_LINE>gatherTypes(typeOracle.findType("java.lang.Integer").getErasedType(), types);<NEW_LINE>gatherTypes(typeOracle.findType("java.lang.Float").getErasedType(), types);<NEW_LINE>gatherTypes(typeOracle.findType("java.lang.CharSequence").getErasedType(), types);<NEW_LINE>gatherTypes(typeOracle.findType("java.lang.Double").getErasedType(), types);<NEW_LINE>gatherTypes(typeOracle.findType("java.lang.Object").getErasedType(), types);<NEW_LINE>// sort the types so the generated output will be stable between runs<NEW_LINE>Collections.sort(types, new Comparator<JType>() {<NEW_LINE><NEW_LINE>public int compare(JType o1, JType o2) {<NEW_LINE>return o1.getQualifiedSourceName().compareTo(o2.getQualifiedSourceName());<NEW_LINE>}<NEW_LINE>});<NEW_LINE>List<JType> split;<NEW_LINE>if (typeName.contains("IReflectionCache2")) {<NEW_LINE>split = types.subList(types.size() / 2, types.size());<NEW_LINE>} else {<NEW_LINE>split = types.subList(0, types.size() / 2);<NEW_LINE>}<NEW_LINE>ReflectionCacheSourceCreator source = new ReflectionCacheSourceCreator(logger, context, jType, split);<NEW_LINE>return source.create();<NEW_LINE>} | getPropertyOracle().getConfigurationProperty("gdx.reflect.include"); |
344,638 | public net.osmand.binary.VectorTile.Tile.Layer buildPartial() {<NEW_LINE>net.osmand.binary.VectorTile.Tile.Layer result = new net.osmand.binary.VectorTile.Tile.Layer(this);<NEW_LINE>int from_bitField0_ = bitField0_;<NEW_LINE>int to_bitField0_ = 0;<NEW_LINE>if (((from_bitField0_ & 0x00000001) == 0x00000001)) {<NEW_LINE>to_bitField0_ |= 0x00000001;<NEW_LINE>}<NEW_LINE>result.version_ = version_;<NEW_LINE>if (((from_bitField0_ & 0x00000002) == 0x00000002)) {<NEW_LINE>to_bitField0_ |= 0x00000002;<NEW_LINE>}<NEW_LINE>result.name_ = name_;<NEW_LINE>if (featuresBuilder_ == null) {<NEW_LINE>if (((bitField0_ & 0x00000004) == 0x00000004)) {<NEW_LINE>features_ = java.util.Collections.unmodifiableList(features_);<NEW_LINE>bitField0_ = (bitField0_ & ~0x00000004);<NEW_LINE>}<NEW_LINE>result.features_ = features_;<NEW_LINE>} else {<NEW_LINE>result<MASK><NEW_LINE>}<NEW_LINE>if (((bitField0_ & 0x00000008) == 0x00000008)) {<NEW_LINE>keys_ = new com.google.protobuf.UnmodifiableLazyStringList(keys_);<NEW_LINE>bitField0_ = (bitField0_ & ~0x00000008);<NEW_LINE>}<NEW_LINE>result.keys_ = keys_;<NEW_LINE>if (valuesBuilder_ == null) {<NEW_LINE>if (((bitField0_ & 0x00000010) == 0x00000010)) {<NEW_LINE>values_ = java.util.Collections.unmodifiableList(values_);<NEW_LINE>bitField0_ = (bitField0_ & ~0x00000010);<NEW_LINE>}<NEW_LINE>result.values_ = values_;<NEW_LINE>} else {<NEW_LINE>result.values_ = valuesBuilder_.build();<NEW_LINE>}<NEW_LINE>if (((from_bitField0_ & 0x00000020) == 0x00000020)) {<NEW_LINE>to_bitField0_ |= 0x00000004;<NEW_LINE>}<NEW_LINE>result.extent_ = extent_;<NEW_LINE>result.bitField0_ = to_bitField0_;<NEW_LINE>onBuilt();<NEW_LINE>return result;<NEW_LINE>} | .features_ = featuresBuilder_.build(); |
1,236,457 | private void addParametersToEachOperation(PathItem pathItem) {<NEW_LINE>if (settings.addParametersToEachOperation()) {<NEW_LINE>List<Parameter> parameters = pathItem.getParameters();<NEW_LINE>if (parameters != null) {<NEW_LINE>// add parameters to each operation<NEW_LINE>List<Operation<MASK><NEW_LINE>if (operations != null) {<NEW_LINE>for (Operation operation : operations) {<NEW_LINE>List<Parameter> parametersToAdd = new ArrayList<>();<NEW_LINE>List<Parameter> existingParameters = operation.getParameters();<NEW_LINE>for (Parameter parameterToAdd : parameters) {<NEW_LINE>boolean matched = false;<NEW_LINE>for (Parameter existingParameter : existingParameters) {<NEW_LINE>if (parameterToAdd.getIn() != null && parameterToAdd.getIn().equals(existingParameter.getIn()) && parameterToAdd.getName().equals(existingParameter.getName())) {<NEW_LINE>matched = true;<NEW_LINE>}<NEW_LINE>}<NEW_LINE>if (!matched) {<NEW_LINE>parametersToAdd.add(parameterToAdd);<NEW_LINE>}<NEW_LINE>}<NEW_LINE>if (parametersToAdd.size() > 0) {<NEW_LINE>operation.getParameters().addAll(0, parametersToAdd);<NEW_LINE>}<NEW_LINE>}<NEW_LINE>}<NEW_LINE>}<NEW_LINE>// remove the shared parameters<NEW_LINE>pathItem.setParameters(null);<NEW_LINE>}<NEW_LINE>} | > operations = pathItem.readOperations(); |
1,242,118 | private static void remountHostToRootIfNeeded(ExtensionState<TransitionsExtensionState> extensionState, int index, MountItem mountItem) {<NEW_LINE>final Host rootHost = getMountTarget(extensionState).getRootItem().getHost();<NEW_LINE>final Host originalHost = mountItem.getHost();<NEW_LINE>if (originalHost == null) {<NEW_LINE>throw new IllegalStateException("Disappearing item host should never be null. Index: " + index);<NEW_LINE>}<NEW_LINE>if (rootHost == originalHost) {<NEW_LINE>// Already mounted to the root<NEW_LINE>return;<NEW_LINE>}<NEW_LINE>final Object content = mountItem.getContent();<NEW_LINE>if (content == null) {<NEW_LINE>throw new IllegalStateException("Disappearing item content should never be null. Index: " + index);<NEW_LINE>}<NEW_LINE>// Before unmounting item get its position inside the root<NEW_LINE>int left = 0;<NEW_LINE>int top = 0;<NEW_LINE>int right;<NEW_LINE>int bottom;<NEW_LINE>// Get left/top position of the item's host first<NEW_LINE>Host host = originalHost;<NEW_LINE>while (host != rootHost) {<NEW_LINE>left += host.getLeft();<NEW_LINE>top += host.getTop();<NEW_LINE>host = <MASK><NEW_LINE>}<NEW_LINE>if (content instanceof View) {<NEW_LINE>final View view = (View) content;<NEW_LINE>left += view.getLeft();<NEW_LINE>top += view.getTop();<NEW_LINE>right = left + view.getWidth();<NEW_LINE>bottom = top + view.getHeight();<NEW_LINE>} else {<NEW_LINE>final Rect bounds = ((Drawable) content).getBounds();<NEW_LINE>left += bounds.left;<NEW_LINE>right = left + bounds.width();<NEW_LINE>top += bounds.top;<NEW_LINE>bottom = top + bounds.height();<NEW_LINE>}<NEW_LINE>// Unmount from the current host<NEW_LINE>originalHost.unmount(mountItem);<NEW_LINE>// Apply new bounds to the content as it will be mounted in the root now<NEW_LINE>BoundsUtils.applyBoundsToMountContent(left, top, right, bottom, null, content, false);<NEW_LINE>// Mount to the root<NEW_LINE>rootHost.mount(index, mountItem);<NEW_LINE>// Set new host to the MountItem<NEW_LINE>mountItem.setHost(rootHost);<NEW_LINE>} | (Host) host.getParent(); |
274,373 | public void marshall(CreateStreamingSessionRequest createStreamingSessionRequest, ProtocolMarshaller protocolMarshaller) {<NEW_LINE>if (createStreamingSessionRequest == null) {<NEW_LINE>throw new SdkClientException("Invalid argument passed to marshall(...)");<NEW_LINE>}<NEW_LINE>try {<NEW_LINE>protocolMarshaller.marshall(createStreamingSessionRequest.getClientToken(), CLIENTTOKEN_BINDING);<NEW_LINE>protocolMarshaller.marshall(createStreamingSessionRequest.getEc2InstanceType(), EC2INSTANCETYPE_BINDING);<NEW_LINE>protocolMarshaller.marshall(createStreamingSessionRequest.getLaunchProfileId(), LAUNCHPROFILEID_BINDING);<NEW_LINE>protocolMarshaller.marshall(createStreamingSessionRequest.getOwnedBy(), OWNEDBY_BINDING);<NEW_LINE>protocolMarshaller.marshall(createStreamingSessionRequest.getStreamingImageId(), STREAMINGIMAGEID_BINDING);<NEW_LINE>protocolMarshaller.marshall(createStreamingSessionRequest.getStudioId(), STUDIOID_BINDING);<NEW_LINE>protocolMarshaller.marshall(<MASK><NEW_LINE>} catch (Exception e) {<NEW_LINE>throw new SdkClientException("Unable to marshall request to JSON: " + e.getMessage(), e);<NEW_LINE>}<NEW_LINE>} | createStreamingSessionRequest.getTags(), TAGS_BINDING); |
958,822 | protected WorkflowEventLogEntity buildEventLog(WorkflowContext context) {<NEW_LINE>WorkflowProcessEntity workflowProcessEntity = context.getProcessEntity();<NEW_LINE>Element currentElement = context.getCurrentElement();<NEW_LINE>WorkflowEventLogEntity logEntity = new WorkflowEventLogEntity();<NEW_LINE>logEntity.setProcessId(workflowProcessEntity.getId());<NEW_LINE>logEntity.setProcessName(workflowProcessEntity.getName());<NEW_LINE>logEntity.<MASK><NEW_LINE>logEntity.setInlongGroupId(context.getProcessForm().getInlongGroupId());<NEW_LINE>logEntity.setElementName(currentElement.getName());<NEW_LINE>logEntity.setElementDisplayName(currentElement.getDisplayName());<NEW_LINE>logEntity.setEventType(event().getClass().getSimpleName());<NEW_LINE>logEntity.setEvent(event().name());<NEW_LINE>logEntity.setListener(eventListener.name());<NEW_LINE>logEntity.setStatus(EventStatus.EXECUTING.getStatus());<NEW_LINE>logEntity.setAsync(0);<NEW_LINE>logEntity.setIp(NetworkUtils.getLocalIp());<NEW_LINE>logEntity.setStartTime(new Date());<NEW_LINE>return logEntity;<NEW_LINE>} | setProcessDisplayName(workflowProcessEntity.getDisplayName()); |
348,640 | private String format(JSError error, boolean warning) {<NEW_LINE>SourceExcerptProvider source = getSource();<NEW_LINE>String sourceName = error.getSourceName();<NEW_LINE>int lineNumber = error.getLineNumber();<NEW_LINE>int charno = error.getCharno();<NEW_LINE>// Format the non-reverse-mapped position.<NEW_LINE>StringBuilder b = new StringBuilder();<NEW_LINE>StringBuilder boldLine = new StringBuilder();<NEW_LINE>OriginalMapping mapping = source == null ? null : source.getSourceMapping(error.getSourceName(), error.getLineNumber(), error.getCharno());<NEW_LINE>// Check if we can reverse-map the source.<NEW_LINE>if (includeLocation) {<NEW_LINE>if (mapping != null) {<NEW_LINE>appendPosition(b, sourceName, lineNumber, charno);<NEW_LINE>sourceName = mapping.getOriginalFile();<NEW_LINE>lineNumber = mapping.getLineNumber();<NEW_LINE>charno = mapping.getColumnPosition();<NEW_LINE>b.append("\nOriginally at:\n");<NEW_LINE>}<NEW_LINE>appendPosition(boldLine, sourceName, lineNumber, charno);<NEW_LINE>}<NEW_LINE>if (includeLevel) {<NEW_LINE>boldLine.append(getLevelName(warning ? CheckLevel.WARNING : CheckLevel.ERROR));<NEW_LINE>boldLine.append(" - [");<NEW_LINE>boldLine.append(error.getType().key);<NEW_LINE>boldLine.append("] ");<NEW_LINE>}<NEW_LINE>boldLine.append(error.getDescription());<NEW_LINE>b.append(maybeEmbolden<MASK><NEW_LINE>b.append('\n');<NEW_LINE>// For reverse-mapped sources, fall back to a single line excerpt because the excerpt length<NEW_LINE>// cannot be reliably mapped.<NEW_LINE>String sourceExcerptWithPosition = getExcerptWithPosition(error, sourceName, lineNumber, charno, mapping != null ? LINE : defaultFormat);<NEW_LINE>if (sourceExcerptWithPosition != null) {<NEW_LINE>b.append(sourceExcerptWithPosition);<NEW_LINE>}<NEW_LINE>return b.toString();<NEW_LINE>} | (boldLine.toString())); |
1,625,621 | public synchronized Optional<VersionSet> insertAndGetVersionSet(final String versionSetMd5Hex, final String versionSetJsonString) throws ImageMgmtException {<NEW_LINE>final SQLTransaction<Integer> insertVersionSet = transOperator -> {<NEW_LINE>final VersionSetHandler versionSetHandler = new VersionSetHandler();<NEW_LINE>// Check if the versionSet already exists for versionSetMd5Hex<NEW_LINE>final List<VersionSet> versionSets = transOperator.query(SELECT_VSET_FROM_MD5, versionSetHandler, versionSetMd5Hex);<NEW_LINE>if (versionSets.size() > 1) {<NEW_LINE><MASK><NEW_LINE>}<NEW_LINE>// Insert if it doesn't<NEW_LINE>if (versionSets.isEmpty()) {<NEW_LINE>transOperator.update(INSERT_VSET, versionSetMd5Hex, versionSetJsonString);<NEW_LINE>return (int) transOperator.getLastInsertId();<NEW_LINE>}<NEW_LINE>return versionSets.get(0).getVersionSetId();<NEW_LINE>};<NEW_LINE>try {<NEW_LINE>final Integer versionSetId = this.dbOperator.transaction(insertVersionSet);<NEW_LINE>final VersionSet versionSet = new VersionSet(versionSetJsonString, versionSetMd5Hex, versionSetId);<NEW_LINE>this.md5ToVersionSet.put(versionSetMd5Hex, versionSet);<NEW_LINE>this.idToVersionSet.put(versionSetId, versionSet);<NEW_LINE>return Optional.of(versionSet);<NEW_LINE>} catch (final SQLException e) {<NEW_LINE>logger.error("Exception occurred while inserting version set and getting version id", e);<NEW_LINE>throw new ImageMgmtException("Unable to insert and get versionSetId", e);<NEW_LINE>}<NEW_LINE>} | throw new SQLException("Expected only one VersionSet for versionSetMd5Hex " + versionSetMd5Hex); |
1,203,594 | protected void internalTransform(Body b, String phaseName, Map<String, String> options) {<NEW_LINE>int weight = soot.jbco.Main.getWeight(phaseName, b.getMethod().getSignature());<NEW_LINE>if (weight == 0) {<NEW_LINE>return;<NEW_LINE>}<NEW_LINE>int i = 0;<NEW_LINE>Unit handler = null;<NEW_LINE>Chain<Trap> traps = b.getTraps();<NEW_LINE>PatchingChain<Unit> units = b.getUnits();<NEW_LINE>Iterator<Unit> it = units.snapshotIterator();<NEW_LINE>while (it.hasNext()) {<NEW_LINE>Unit u = <MASK><NEW_LINE>if (u instanceof TableSwitchInst) {<NEW_LINE>TableSwitchInst twi = (TableSwitchInst) u;<NEW_LINE>if (!BodyBuilder.isExceptionCaughtAt(units, twi, traps.iterator()) && Rand.getInt(10) <= weight) {<NEW_LINE>if (handler == null) {<NEW_LINE>Iterator<Unit> uit = units.snapshotIterator();<NEW_LINE>while (uit.hasNext()) {<NEW_LINE>Unit uthrow = (Unit) uit.next();<NEW_LINE>if (uthrow instanceof ThrowInst && !BodyBuilder.isExceptionCaughtAt(units, uthrow, traps.iterator())) {<NEW_LINE>handler = uthrow;<NEW_LINE>break;<NEW_LINE>}<NEW_LINE>}<NEW_LINE>if (handler == null) {<NEW_LINE>handler = Baf.v().newThrowInst();<NEW_LINE>units.add(handler);<NEW_LINE>}<NEW_LINE>}<NEW_LINE>int size = 4;<NEW_LINE>Unit succ = (Unit) units.getSuccOf(twi);<NEW_LINE>while (!BodyBuilder.isExceptionCaughtAt(units, succ, traps.iterator()) && size-- > 0) {<NEW_LINE>Object o = units.getSuccOf(succ);<NEW_LINE>if (o != null) {<NEW_LINE>succ = (Unit) o;<NEW_LINE>} else {<NEW_LINE>break;<NEW_LINE>}<NEW_LINE>}<NEW_LINE>traps.add(Baf.v().newTrap(ThrowSet.getRandomThrowable(), twi, succ, handler));<NEW_LINE>i++;<NEW_LINE>}<NEW_LINE>}<NEW_LINE>}<NEW_LINE>totaltraps += i;<NEW_LINE>if (i > 0 && debug) {<NEW_LINE>StackTypeHeightCalculator.calculateStackHeights(b);<NEW_LINE>}<NEW_LINE>} | (Unit) it.next(); |
1,590,981 | private void loadNode106() throws IOException, SAXException {<NEW_LINE>PropertyTypeNode node = new PropertyTypeNode(this.context, Identifiers.ServerType_SetSubscriptionDurable_InputArguments, new QualifiedName(0, "InputArguments"), new LocalizedText("en", "InputArguments"), LocalizedText.NULL_VALUE, UInteger.valueOf(0), UInteger.valueOf(0), new DataValue(Variant.NULL_VALUE), Identifiers.Argument, 1, new UInteger[] { org.eclipse.milo.opcua.stack.core.types.builtin.unsigned.UInteger.valueOf(0) }, UByte.valueOf(1), UByte.valueOf(1), 0.0, false);<NEW_LINE>node.addReference(new Reference(Identifiers.ServerType_SetSubscriptionDurable_InputArguments, Identifiers.HasTypeDefinition, Identifiers.PropertyType.expanded(), true));<NEW_LINE>node.addReference(new Reference(Identifiers.ServerType_SetSubscriptionDurable_InputArguments, Identifiers.HasModellingRule, Identifiers.ModellingRule_Mandatory.expanded(), true));<NEW_LINE>node.addReference(new Reference(Identifiers.ServerType_SetSubscriptionDurable_InputArguments, Identifiers.HasProperty, Identifiers.ServerType_SetSubscriptionDurable.expanded(), false));<NEW_LINE>StringBuilder sb = new StringBuilder();<NEW_LINE>sb.append("<ListOfExtensionObject xmlns=\"http://opcfoundation.org/UA/2008/02/Types.xsd\"><ExtensionObject><TypeId><Identifier>i=297</Identifier> </TypeId><Body><Argument><Name>SubscriptionId</Name><DataType><Identifier>i=7</Identifier> </DataType><ValueRank>-1</ValueRank><ArrayDimensions/> </Argument> </Body> </ExtensionObject><ExtensionObject><TypeId><Identifier>i=297</Identifier> </TypeId><Body><Argument><Name>LifetimeInHours</Name><DataType><Identifier>i=7</Identifier> </DataType><ValueRank>-1</ValueRank><ArrayDimensions/> </Argument> </Body> </ExtensionObject> </ListOfExtensionObject>");<NEW_LINE><MASK><NEW_LINE>OpcUaXmlStreamDecoder decoder = new OpcUaXmlStreamDecoder(context.getServer().getSerializationContext()).setInput(new StringReader(xml));<NEW_LINE>Object o = decoder.readVariantValue();<NEW_LINE>DataValue value = new DataValue(new Variant(o));<NEW_LINE>node.setValue(value);<NEW_LINE>this.nodeManager.addNode(node);<NEW_LINE>} | String xml = sb.toString(); |
1,255,742 | public void createControl(Composite parent) {<NEW_LINE>Composite composite = new Composite(parent, SWT.NULL);<NEW_LINE>initializeDialogUnits(parent);<NEW_LINE>PlatformUI.getWorkbench().getHelpSystem().setHelp(composite, IIDEHelpContextIds.NEW_PROJECT_WIZARD_PAGE);<NEW_LINE>composite.setLayout(new GridLayout());<NEW_LINE>composite.setLayoutData(new GridData(GridData.FILL_BOTH));<NEW_LINE>createProjectNameGroup(composite);<NEW_LINE>locationArea = new <MASK><NEW_LINE>if (initialProjectFieldValue != null) {<NEW_LINE>locationArea.updateProjectName(initialProjectFieldValue);<NEW_LINE>}<NEW_LINE>// Scale the button based on the rest of the dialog<NEW_LINE>setButtonLayoutData(locationArea.getBrowseButton());<NEW_LINE>setPageComplete(validatePage());<NEW_LINE>// Show description on opening<NEW_LINE>setErrorMessage(null);<NEW_LINE>setMessage(null);<NEW_LINE>setControl(composite);<NEW_LINE>Dialog.applyDialogFont(composite);<NEW_LINE>} | ProjectContentsLocationArea(getErrorReporter(), composite); |
1,652,558 | public void annotate(Annotation annotation) {<NEW_LINE>if (verbose) {<NEW_LINE>log.info("Adding RegexNER annotations ... ");<NEW_LINE>}<NEW_LINE>if (!annotation.containsKey(CoreAnnotations.SentencesAnnotation.class))<NEW_LINE>throw new RuntimeException("Unable to find sentences in " + annotation);<NEW_LINE>List<CoreMap> sentences = annotation.get(CoreAnnotations.SentencesAnnotation.class);<NEW_LINE>for (CoreMap sentence : sentences) {<NEW_LINE>List<CoreLabel> tokens = sentence.get(CoreAnnotations.TokensAnnotation.class);<NEW_LINE>classifier.classify(tokens);<NEW_LINE>for (CoreLabel token : tokens) {<NEW_LINE>if (token.get(CoreAnnotations.NamedEntityTagAnnotation.class) == null)<NEW_LINE>token.set(CoreAnnotations.NamedEntityTagAnnotation.class, classifier.flags.backgroundSymbol);<NEW_LINE>}<NEW_LINE>for (int start = 0; start < tokens.size(); start++) {<NEW_LINE>CoreLabel token = tokens.get(start);<NEW_LINE>String answerType = token.<MASK><NEW_LINE>if (answerType == null)<NEW_LINE>continue;<NEW_LINE>String NERType = token.get(CoreAnnotations.NamedEntityTagAnnotation.class);<NEW_LINE>int answerEnd = findEndOfAnswerAnnotation(tokens, start);<NEW_LINE>int NERStart = findStartOfNERAnnotation(tokens, start);<NEW_LINE>int NEREnd = findEndOfNERAnnotation(tokens, start);<NEW_LINE>// check that the spans are the same, specially handling the case of<NEW_LINE>// tokens with background named entity tags ("other")<NEW_LINE>if ((NERStart == start || NERType.equals(classifier.flags.backgroundSymbol)) && (answerEnd == NEREnd || (NERType.equals(classifier.flags.backgroundSymbol) && NEREnd >= answerEnd))) {<NEW_LINE>// annotate each token in the span<NEW_LINE>for (int i = start; i < answerEnd; i++) tokens.get(i).set(CoreAnnotations.NamedEntityTagAnnotation.class, answerType);<NEW_LINE>}<NEW_LINE>start = answerEnd - 1;<NEW_LINE>}<NEW_LINE>}<NEW_LINE>if (verbose)<NEW_LINE>log.info("done.");<NEW_LINE>} | get(CoreAnnotations.AnswerAnnotation.class); |
1,726,733 | private static void signImpl(DOMSignContext dsc, String digestMethod, String signatureMethod, String referenceURI, String keyName, PublicKey publicKey, X509Certificate x509Certificate, String canonicalizationMethodType) throws GeneralSecurityException, MarshalException, XMLSignatureException {<NEW_LINE>dsc.setDefaultNamespacePrefix("dsig");<NEW_LINE>DigestMethod digestMethodObj = fac.newDigestMethod(digestMethod, null);<NEW_LINE>Transform transform1 = fac.newTransform(Transform.ENVELOPED, (TransformParameterSpec) null);<NEW_LINE>Transform transform2 = fac.newTransform<MASK><NEW_LINE>List<Transform> transformList = new ArrayList<>();<NEW_LINE>transformList.add(transform1);<NEW_LINE>transformList.add(transform2);<NEW_LINE>Reference ref = fac.newReference(referenceURI, digestMethodObj, transformList, null, null);<NEW_LINE>CanonicalizationMethod canonicalizationMethod = fac.newCanonicalizationMethod(canonicalizationMethodType, (C14NMethodParameterSpec) null);<NEW_LINE>List<Reference> referenceList = Collections.singletonList(ref);<NEW_LINE>SignatureMethod signatureMethodObj = fac.newSignatureMethod(signatureMethod, null);<NEW_LINE>SignedInfo si = fac.newSignedInfo(canonicalizationMethod, signatureMethodObj, referenceList);<NEW_LINE>KeyInfo ki;<NEW_LINE>if (includeKeyInfoInSignature) {<NEW_LINE>ki = createKeyInfo(keyName, publicKey, x509Certificate);<NEW_LINE>} else {<NEW_LINE>ki = createKeyInfo(keyName, null, null);<NEW_LINE>}<NEW_LINE>XMLSignature signature = fac.newXMLSignature(si, ki);<NEW_LINE>signature.sign(dsc);<NEW_LINE>} | ("http://www.w3.org/2001/10/xml-exc-c14n#", (TransformParameterSpec) null); |
1,268,742 | static Constructor<? extends Logger> resolveLoggerConstructor(final String className, final Class<?> paramType, boolean allowNoSuchMethod) {<NEW_LINE>Constructor<? extends Logger> loggerCtor;<NEW_LINE>final Object param = paramType == String.class ? LoggerFactory.class.getSimpleName() : LoggerFactory.class;<NEW_LINE>try {<NEW_LINE>@SuppressWarnings("unchecked")<NEW_LINE>Class<? extends Logger> klass = (Class<? extends Logger>) Class.forName(className);<NEW_LINE>loggerCtor = klass.getDeclaredConstructor(paramType);<NEW_LINE>// check its working<NEW_LINE>loggerCtor.newInstance(param);<NEW_LINE>} catch (Exception ex) {<NEW_LINE>if (allowNoSuchMethod && ex instanceof NoSuchMethodException) {<NEW_LINE>return null;<NEW_LINE>}<NEW_LINE>try {<NEW_LINE>@SuppressWarnings("unchecked")<NEW_LINE>Class<? extends Logger> klass = (Class<? extends Logger>) Class.forName(BACKUP_LOGGER_CLASS);<NEW_LINE>loggerCtor = klass.getDeclaredConstructor(paramType);<NEW_LINE>Logger <MASK><NEW_LINE>// log failure to load passeed -Djruby.logger.class :<NEW_LINE>log.info("failed to create logger \"" + className + "\", using \"" + BACKUP_LOGGER_CLASS + "\"");<NEW_LINE>} catch (Exception e2) {<NEW_LINE>throw new IllegalStateException("unable to instantiate any logger", ex);<NEW_LINE>}<NEW_LINE>}<NEW_LINE>return loggerCtor;<NEW_LINE>} | log = loggerCtor.newInstance(param); |
1,773,736 | private void updateSubscribed() {<NEW_LINE>User user = currentUser;<NEW_LINE>subscribed.setToolTipText("");<NEW_LINE>if (user.getSubMonths() > 0) {<NEW_LINE>subscribed.setText(new String[] { String.format("Subscribed: %d %s", user.getSubMonths(), StringUtil.plural("month", user.getSubMonths())), String.format("Sub: %d mo.", <MASK><NEW_LINE>if (user.getTwitchBadges() != null) {<NEW_LINE>String info = "";<NEW_LINE>for (Map.Entry<String, String> badge : user.getTwitchBadges().entrySet()) {<NEW_LINE>switch(badge.getKey()) {<NEW_LINE>case "founder":<NEW_LINE>info = "Founder";<NEW_LINE>break;<NEW_LINE>case "subscriber":<NEW_LINE>info = BadgeManager.makeSubscriberTitle(badge.getValue());<NEW_LINE>break;<NEW_LINE>}<NEW_LINE>}<NEW_LINE>subscribed.setToolTipText(String.format("<html>%s Badge, %d total months<br /><br />(All subscriber info depends on the sub badge attached to a chat message.)", info, user.getSubMonths()));<NEW_LINE>}<NEW_LINE>} else {<NEW_LINE>subscribed.setText("");<NEW_LINE>}<NEW_LINE>} | user.getSubMonths()) }); |
1,604,753 | final EnableEbsEncryptionByDefaultResult executeEnableEbsEncryptionByDefault(EnableEbsEncryptionByDefaultRequest enableEbsEncryptionByDefaultRequest) {<NEW_LINE>ExecutionContext executionContext = createExecutionContext(enableEbsEncryptionByDefaultRequest);<NEW_LINE>AWSRequestMetrics awsRequestMetrics = executionContext.getAwsRequestMetrics();<NEW_LINE>awsRequestMetrics.startEvent(Field.ClientExecuteTime);<NEW_LINE>Request<EnableEbsEncryptionByDefaultRequest> request = null;<NEW_LINE>Response<EnableEbsEncryptionByDefaultResult> response = null;<NEW_LINE>try {<NEW_LINE>awsRequestMetrics.startEvent(Field.RequestMarshallTime);<NEW_LINE>try {<NEW_LINE>request = new EnableEbsEncryptionByDefaultRequestMarshaller().marshall(super.beforeMarshalling(enableEbsEncryptionByDefaultRequest));<NEW_LINE>// Binds the request metrics to the current request.<NEW_LINE>request.setAWSRequestMetrics(awsRequestMetrics);<NEW_LINE>request.addHandlerContext(HandlerContextKey.CLIENT_ENDPOINT, endpoint);<NEW_LINE>request.addHandlerContext(HandlerContextKey.ENDPOINT_OVERRIDDEN, isEndpointOverridden());<NEW_LINE>request.addHandlerContext(HandlerContextKey.SIGNING_REGION, getSigningRegion());<NEW_LINE>request.addHandlerContext(HandlerContextKey.SERVICE_ID, "EC2");<NEW_LINE>request.addHandlerContext(HandlerContextKey.OPERATION_NAME, "EnableEbsEncryptionByDefault");<NEW_LINE>request.addHandlerContext(HandlerContextKey.ADVANCED_CONFIG, advancedConfig);<NEW_LINE>} finally {<NEW_LINE>awsRequestMetrics.endEvent(Field.RequestMarshallTime);<NEW_LINE>}<NEW_LINE>StaxResponseHandler<EnableEbsEncryptionByDefaultResult> responseHandler = new StaxResponseHandler<<MASK><NEW_LINE>response = invoke(request, responseHandler, executionContext);<NEW_LINE>return response.getAwsResponse();<NEW_LINE>} finally {<NEW_LINE>endClientExecution(awsRequestMetrics, request, response);<NEW_LINE>}<NEW_LINE>} | EnableEbsEncryptionByDefaultResult>(new EnableEbsEncryptionByDefaultResultStaxUnmarshaller()); |
817,315 | public static byte[] toByteArray(TbMsg msg) {<NEW_LINE>MsgProtos.TbMsgProto.Builder builder = MsgProtos.TbMsgProto.newBuilder();<NEW_LINE>builder.setId(msg.getId().toString());<NEW_LINE>builder.setTs(msg.getTs());<NEW_LINE>builder.setType(msg.getType());<NEW_LINE>builder.setEntityType(msg.getOriginator().getEntityType().name());<NEW_LINE>builder.setEntityIdMSB(msg.getOriginator().<MASK><NEW_LINE>builder.setEntityIdLSB(msg.getOriginator().getId().getLeastSignificantBits());<NEW_LINE>if (msg.getCustomerId() != null) {<NEW_LINE>builder.setCustomerIdMSB(msg.getCustomerId().getId().getMostSignificantBits());<NEW_LINE>builder.setCustomerIdLSB(msg.getCustomerId().getId().getLeastSignificantBits());<NEW_LINE>}<NEW_LINE>if (msg.getRuleChainId() != null) {<NEW_LINE>builder.setRuleChainIdMSB(msg.getRuleChainId().getId().getMostSignificantBits());<NEW_LINE>builder.setRuleChainIdLSB(msg.getRuleChainId().getId().getLeastSignificantBits());<NEW_LINE>}<NEW_LINE>if (msg.getRuleNodeId() != null) {<NEW_LINE>builder.setRuleNodeIdMSB(msg.getRuleNodeId().getId().getMostSignificantBits());<NEW_LINE>builder.setRuleNodeIdLSB(msg.getRuleNodeId().getId().getLeastSignificantBits());<NEW_LINE>}<NEW_LINE>if (msg.getMetaData() != null) {<NEW_LINE>builder.setMetaData(MsgProtos.TbMsgMetaDataProto.newBuilder().putAllData(msg.getMetaData().getData()).build());<NEW_LINE>}<NEW_LINE>builder.setDataType(msg.getDataType().ordinal());<NEW_LINE>builder.setData(msg.getData());<NEW_LINE>builder.setCtx(msg.ctx.toProto());<NEW_LINE>return builder.build().toByteArray();<NEW_LINE>} | getId().getMostSignificantBits()); |
1,347,855 | private Type push_immediate(EObject value, Type stack_type) {<NEW_LINE>if (value == ERT.NIL) {<NEW_LINE>mv.visitFieldInsn(GETSTATIC, ERT_NAME, "NIL", ENIL_TYPE.getDescriptor());<NEW_LINE>return ENIL_TYPE;<NEW_LINE>}<NEW_LINE>if (value == ERT.TRUE) {<NEW_LINE>mv.visitFieldInsn(GETSTATIC, ERT_NAME, "TRUE", EATOM_DESC);<NEW_LINE>return EATOM_TYPE;<NEW_LINE>}<NEW_LINE>if (value == ERT.FALSE) {<NEW_LINE>mv.visitFieldInsn(GETSTATIC, ERT_NAME, "FALSE", EATOM_DESC);<NEW_LINE>return EATOM_TYPE;<NEW_LINE>}<NEW_LINE>// Handle conversions to primitive Java types:<NEW_LINE>if (stack_type.getSort() != Type.OBJECT) {<NEW_LINE>if (value instanceof ESmall) {<NEW_LINE>mv.visitLdcInsn(new Integer(value.asInt()));<NEW_LINE>return Type.INT_TYPE;<NEW_LINE>} else if (value instanceof EBig && stack_type.getSort() == Type.DOUBLE) {<NEW_LINE>push_immediate(value, EBIG_TYPE);<NEW_LINE>mv.visitMethodInsn(INVOKEVIRTUAL, EBIG_NAME, "doubleValue", "()D");<NEW_LINE>return Type.DOUBLE_TYPE;<NEW_LINE>} else if (value instanceof EDouble) {<NEW_LINE>mv.visitLdcInsn(new Double(((EDouble) value).value));<NEW_LINE>return Type.DOUBLE_TYPE;<NEW_LINE>} else if (value == TRUE_ATOM) {<NEW_LINE>mv.visitInsn(ICONST_1);<NEW_LINE>return Type.BOOLEAN_TYPE;<NEW_LINE>} else if (value == FALSE_ATOM) {<NEW_LINE>mv.visitInsn(ICONST_0);<NEW_LINE>return Type.BOOLEAN_TYPE;<NEW_LINE>}<NEW_LINE>if (value instanceof ETuple2) {<NEW_LINE>ETuple2 t2 = (ETuple2) value;<NEW_LINE>if (t2.elm(1) == ATOM_field_flags) {<NEW_LINE>push_int(t2.elem2.asInt());<NEW_LINE>return Type.INT_TYPE;<NEW_LINE>}<NEW_LINE>}<NEW_LINE>throw new Error("cannot convert " + value + " as " + stack_type);<NEW_LINE>}<NEW_LINE>String known = constants.get(value);<NEW_LINE>Type type = getConstantType(value);<NEW_LINE>if (known == null) {<NEW_LINE>String cn = getConstantName(value, constants.size());<NEW_LINE>constants.put(value, known = cn);<NEW_LINE>cv.visitField(ACC_STATIC, known, type.<MASK><NEW_LINE>// System.err.println(constants);<NEW_LINE>}<NEW_LINE>if (known != null) {<NEW_LINE>mv.visitFieldInsn(GETSTATIC, self_type.getInternalName(), known, type.getDescriptor());<NEW_LINE>return type;<NEW_LINE>}<NEW_LINE>throw new Error("cannot push " + value + " as " + stack_type);<NEW_LINE>// return Type.getType(value.getClass());<NEW_LINE>} | getDescriptor(), null, null); |
519,911 | private static void ensureInjectMessageHandler(Object thread) {<NEW_LINE>try {<NEW_LINE>Field f = thread.getClass().getDeclaredField("mH");<NEW_LINE>f.setAccessible(true);<NEW_LINE>Handler ah = (Handler) f.get(thread);<NEW_LINE>f = Handler.class.getDeclaredField("mCallback");<NEW_LINE>f.setAccessible(true);<NEW_LINE>boolean needsInject = false;<NEW_LINE>if (sActivityThreadHandlerCallback == null) {<NEW_LINE>needsInject = true;<NEW_LINE>} else {<NEW_LINE>Object callback = f.get(ah);<NEW_LINE>if (callback != sActivityThreadHandlerCallback) {<NEW_LINE>needsInject = true;<NEW_LINE>}<NEW_LINE>}<NEW_LINE>if (needsInject) {<NEW_LINE>// Inject message handler<NEW_LINE>sActivityThreadHandlerCallback = new ActivityThreadHandlerCallback();<NEW_LINE><MASK><NEW_LINE>}<NEW_LINE>} catch (Exception e) {<NEW_LINE>throw new RuntimeException("Failed to replace message handler for thread: " + thread);<NEW_LINE>}<NEW_LINE>} | f.set(ah, sActivityThreadHandlerCallback); |
1,220,848 | private static String resolveRelativePath(IContributor contributor, String libPathAsString) {<NEW_LINE>String bundleName = contributor.getName();<NEW_LINE>Bundle bundle = Platform.getBundle(bundleName);<NEW_LINE>if (bundle == null) {<NEW_LINE>return null;<NEW_LINE>}<NEW_LINE>File bundleFile;<NEW_LINE>try {<NEW_LINE>bundleFile = FileLocator.getBundleFile(bundle);<NEW_LINE>} catch (IOException e) {<NEW_LINE>FindbugsPlugin.getDefault().logException(e, "Failed to resolve detector library for " + bundle.getSymbolicName());<NEW_LINE>return null;<NEW_LINE>}<NEW_LINE>boolean runningInDebugger = Boolean.getBoolean("eclipse.pde.launch");<NEW_LINE>if (!DEFAULT_USE_PLUGIN_JAR.equals(libPathAsString)) {<NEW_LINE>return new Path(bundleFile.getAbsolutePath()).append(libPathAsString).toOSString();<NEW_LINE>}<NEW_LINE>if (!bundleFile.isDirectory()) {<NEW_LINE>return bundleFile.getAbsolutePath();<NEW_LINE>}<NEW_LINE>if (runningInDebugger) {<NEW_LINE>// in case we are inside debugger & see bundle as directory<NEW_LINE>return resolvePluginClassesDir(bundleName, bundleFile);<NEW_LINE>}<NEW_LINE>// it's a directory, and we are in the production environment.<NEW_LINE>IllegalArgumentException e = new IllegalArgumentException("Failed to resolve detector library for " + bundle.getSymbolicName());<NEW_LINE>String message = "Failed to resolve detector library. '" + bundleFile + "' is a directory and can't be used as FindBugs detector package." + " Please specify '" + LIBRARY_PATH + "' argument as a relative path to the detectors jar file.";<NEW_LINE>FindbugsPlugin.getDefault(<MASK><NEW_LINE>return null;<NEW_LINE>} | ).logException(e, message); |
1,683,247 | public static MarkedString computeJavadoc(IJavaElement element) throws CoreException {<NEW_LINE>IMember member = null;<NEW_LINE>String result = null;<NEW_LINE>if (element instanceof ITypeParameter) {<NEW_LINE>member = ((ITypeParameter) element).getDeclaringMember();<NEW_LINE>} else if (element instanceof IMember) {<NEW_LINE>member = (IMember) element;<NEW_LINE>} else if (element instanceof IPackageFragment) {<NEW_LINE>Reader r = JavadocContentAccess2.getMarkdownContentReader(element);<NEW_LINE>if (r != null) {<NEW_LINE>result = getString(r);<NEW_LINE>}<NEW_LINE>}<NEW_LINE>if (member != null) {<NEW_LINE>Reader r = JavadocContentAccess2.getMarkdownContentReader(member);<NEW_LINE>if (r != null) {<NEW_LINE>result = getString(r);<NEW_LINE>}<NEW_LINE>if (member instanceof IMethod) {<NEW_LINE>String defaultValue = getDefaultValue((IMethod) member);<NEW_LINE>if (defaultValue != null) {<NEW_LINE>if (JavaLanguageServerPlugin.getPreferencesManager().getClientPreferences().isSupportsCompletionDocumentationMarkdown()) {<NEW_LINE>result = (result == null ? CompletionResolveHandler.EMPTY_STRING : result) + "\n" + CompletionResolveHandler.DEFAULT + defaultValue;<NEW_LINE>} else {<NEW_LINE>result = (result == null ? CompletionResolveHandler.EMPTY_STRING : <MASK><NEW_LINE>}<NEW_LINE>}<NEW_LINE>}<NEW_LINE>}<NEW_LINE>return result != null ? new MarkedString(LANGUAGE_ID, result) : null;<NEW_LINE>} | result) + CompletionResolveHandler.DEFAULT + defaultValue; |
895,744 | public static Money computeBalance(String accountUID, List<Split> splitList) {<NEW_LINE><MASK><NEW_LINE>AccountType accountType = accountsDbAdapter.getAccountType(accountUID);<NEW_LINE>String accountCurrencyCode = accountsDbAdapter.getAccountCurrencyCode(accountUID);<NEW_LINE>boolean isDebitAccount = accountType.hasDebitNormalBalance();<NEW_LINE>Money balance = Money.createZeroInstance(accountCurrencyCode);<NEW_LINE>for (Split split : splitList) {<NEW_LINE>if (!split.getAccountUID().equals(accountUID))<NEW_LINE>continue;<NEW_LINE>Money amount;<NEW_LINE>if (split.getValue().getCommodity().getCurrencyCode().equals(accountCurrencyCode)) {<NEW_LINE>amount = split.getValue();<NEW_LINE>} else {<NEW_LINE>// if this split belongs to the account, then either its value or quantity is in the account currency<NEW_LINE>amount = split.getQuantity();<NEW_LINE>}<NEW_LINE>boolean isDebitSplit = split.getType() == TransactionType.DEBIT;<NEW_LINE>if (isDebitAccount) {<NEW_LINE>if (isDebitSplit) {<NEW_LINE>balance = balance.add(amount);<NEW_LINE>} else {<NEW_LINE>balance = balance.subtract(amount);<NEW_LINE>}<NEW_LINE>} else {<NEW_LINE>if (isDebitSplit) {<NEW_LINE>balance = balance.subtract(amount);<NEW_LINE>} else {<NEW_LINE>balance = balance.add(amount);<NEW_LINE>}<NEW_LINE>}<NEW_LINE>}<NEW_LINE>return balance;<NEW_LINE>} | AccountsDbAdapter accountsDbAdapter = AccountsDbAdapter.getInstance(); |
1,219,100 | private AttributedString formatTransfers(String projectId) {<NEW_LINE>Collection<TransferEvent> transfers = this.transfers.getOrDefault(projectId, Collections.emptyMap()).values();<NEW_LINE>if (transfers.isEmpty()) {<NEW_LINE>return null;<NEW_LINE>}<NEW_LINE>TransferEvent event = transfers.iterator().next();<NEW_LINE>String action = event.getRequestType() == TransferEvent.PUT ? "Uploading" : "Downloading";<NEW_LINE>if (transfers.size() == 1) {<NEW_LINE>String direction = event.getRequestType() == TransferEvent.PUT ? "to" : "from";<NEW_LINE>long cur = event.getTransferredBytes();<NEW_LINE>long max = event.getContentLength();<NEW_LINE>AttributedStringBuilder asb = new AttributedStringBuilder();<NEW_LINE>asb.append(action);<NEW_LINE>asb.append(' ');<NEW_LINE>asb.style(AttributedStyle.BOLD);<NEW_LINE>asb.append(pathToMaven(event.getResourceName()));<NEW_LINE>asb.style(AttributedStyle.DEFAULT);<NEW_LINE>asb.append(' ');<NEW_LINE>asb.append(direction);<NEW_LINE>asb.append(' ');<NEW_LINE>asb.<MASK><NEW_LINE>if (cur > 0 && cur < max) {<NEW_LINE>asb.append(' ');<NEW_LINE>asb.append(OsUtils.bytesTohumanReadable(cur));<NEW_LINE>asb.append('/');<NEW_LINE>asb.append(OsUtils.bytesTohumanReadable(max));<NEW_LINE>}<NEW_LINE>return asb.toAttributedString();<NEW_LINE>} else {<NEW_LINE>return new AttributedString(action + " " + transfers.size() + " files...");<NEW_LINE>}<NEW_LINE>} | append(event.getRepositoryId()); |
1,736,167 | public static void main(String[] args) throws Exception {<NEW_LINE>Properties properties = <MASK><NEW_LINE>final String eventMeshIp = properties.getProperty(ExampleConstants.EVENTMESH_IP);<NEW_LINE>final int eventMeshTcpPort = Integer.parseInt(properties.getProperty(ExampleConstants.EVENTMESH_TCP_PORT));<NEW_LINE>UserAgent userAgent = EventMeshTestUtils.generateClient2();<NEW_LINE>EventMeshTCPClientConfig eventMeshTcpClientConfig = EventMeshTCPClientConfig.builder().host(eventMeshIp).port(eventMeshTcpPort).userAgent(userAgent).build();<NEW_LINE>try (EventMeshTCPClient<EventMeshMessage> client = EventMeshTCPClientFactory.createEventMeshTCPClient(eventMeshTcpClientConfig, EventMeshMessage.class)) {<NEW_LINE>client.init();<NEW_LINE>client.subscribe(ExampleConstants.EVENTMESH_TCP_BROADCAST_TEST_TOPIC, SubscriptionMode.BROADCASTING, SubscriptionType.ASYNC);<NEW_LINE>client.registerSubBusiHandler(handler);<NEW_LINE>client.listen();<NEW_LINE>} catch (Exception e) {<NEW_LINE>log.warn("AsyncSubscribeBroadcast failed", e);<NEW_LINE>}<NEW_LINE>} | Utils.readPropertiesFile(ExampleConstants.CONFIG_FILE_NAME); |
915,161 | public void openLibrary(Song song, int type) {<NEW_LINE>Intent intent = new Intent(this, LibraryActivity.class);<NEW_LINE>intent.addFlags(Intent.FLAG_ACTIVITY_CLEAR_TOP);<NEW_LINE>if (song != null) {<NEW_LINE>long id = -1;<NEW_LINE>String folder = null;<NEW_LINE>switch(type) {<NEW_LINE>case MediaUtils.TYPE_ARTIST:<NEW_LINE>id = song.artistId;<NEW_LINE>break;<NEW_LINE>case MediaUtils.TYPE_ALBUM:<NEW_LINE>id = song.albumId;<NEW_LINE>break;<NEW_LINE>case MediaUtils.TYPE_GENRE:<NEW_LINE>id = MediaUtils.<MASK><NEW_LINE>break;<NEW_LINE>case MediaUtils.TYPE_FILE:<NEW_LINE>File file = new File(song.path);<NEW_LINE>folder = file.getParent();<NEW_LINE>break;<NEW_LINE>default:<NEW_LINE>throw new IllegalArgumentException("Invalid media type " + type);<NEW_LINE>}<NEW_LINE>intent.putExtra("type", type);<NEW_LINE>intent.putExtra("id", id);<NEW_LINE>intent.putExtra("folder", folder);<NEW_LINE>}<NEW_LINE>startActivity(intent);<NEW_LINE>} | queryGenreForSong(this, song.id); |
1,014,925 | private void animate(final Widget from, final Widget to, boolean rightToLeft, final HasHistory fromFocus, final HasHistory toFocus, final boolean focus) {<NEW_LINE>assert from != to;<NEW_LINE>if (focus)<NEW_LINE>toFocus.getFocusTarget().addClassName(styles_.inboundFocus());<NEW_LINE>setVisible(to, toFocus.getFocusTarget(), true);<NEW_LINE>int width = getOffsetWidth();<NEW_LINE>mainPanel_.setWidgetLeftWidth(from, 0, Unit.<MASK><NEW_LINE>mainPanel_.setWidgetLeftWidth(to, rightToLeft ? width : -width, Unit.PX, width, Unit.PX);<NEW_LINE>mainPanel_.forceLayout();<NEW_LINE>mainPanel_.setWidgetLeftWidth(from, rightToLeft ? -width : width, Unit.PX, width, Unit.PX);<NEW_LINE>mainPanel_.setWidgetLeftWidth(to, 0, Unit.PX, width, Unit.PX);<NEW_LINE>mainPanel_.animate(300, new AnimationCallback() {<NEW_LINE><NEW_LINE>public void onAnimationComplete() {<NEW_LINE>setVisible(from, fromFocus.getFocusTarget(), false);<NEW_LINE>mainPanel_.setWidgetLeftRight(to, 0, Unit.PX, 0, Unit.PX);<NEW_LINE>mainPanel_.forceLayout();<NEW_LINE>if (focus) {<NEW_LINE>DomUtils.setActive(toFocus.getFocusTarget());<NEW_LINE>toFocus.getFocusTarget().removeClassName(styles_.inboundFocus());<NEW_LINE>}<NEW_LINE>}<NEW_LINE><NEW_LINE>public void onLayout(Layer layer, double progress) {<NEW_LINE>}<NEW_LINE>});<NEW_LINE>} | PX, width, Unit.PX); |
123,993 | private static void pushValue(final V8 v8, final V8Array result, final Object value, final Map<Object, V8Value> cache) {<NEW_LINE>if (value == null) {<NEW_LINE>result.pushUndefined();<NEW_LINE>} else if (value instanceof Integer) {<NEW_LINE>result.push(value);<NEW_LINE>} else if (value instanceof Long) {<NEW_LINE>result.push(new Double((Long) value));<NEW_LINE>} else if (value instanceof Double) {<NEW_LINE>result.push(value);<NEW_LINE>} else if (value instanceof Float) {<NEW_LINE>result.push(value);<NEW_LINE>} else if (value instanceof String) {<NEW_LINE>result.push((String) value);<NEW_LINE>} else if (value instanceof Boolean) {<NEW_LINE>result.push(value);<NEW_LINE>} else if (value instanceof TypedArray) {<NEW_LINE>V8TypedArray v8TypedArray = toV8TypedArray(v8<MASK><NEW_LINE>result.push(v8TypedArray);<NEW_LINE>} else if (value instanceof ArrayBuffer) {<NEW_LINE>V8ArrayBuffer v8ArrayBuffer = toV8ArrayBuffer(v8, (ArrayBuffer) value, cache);<NEW_LINE>result.push(v8ArrayBuffer);<NEW_LINE>} else if (value instanceof V8Value) {<NEW_LINE>result.push((V8Value) value);<NEW_LINE>} else if (value instanceof Map) {<NEW_LINE>V8Object object = toV8Object(v8, (Map) value, cache);<NEW_LINE>result.push(object);<NEW_LINE>} else if (value instanceof List) {<NEW_LINE>V8Array array = toV8Array(v8, (List) value, cache);<NEW_LINE>result.push(array);<NEW_LINE>} else {<NEW_LINE>throw new IllegalStateException("Unsupported Object of type: " + value.getClass());<NEW_LINE>}<NEW_LINE>} | , (TypedArray) value, cache); |
956,991 | private static List<RelationshipInfo> reduceNodeTypes(final List<RelationshipInfo> sourceList, Map<String, TypeInfo> typeInfos) {<NEW_LINE>final List<RelationshipInfo> reducedList = new ArrayList<>();<NEW_LINE>final Set<String> startNodeTypes = new LinkedHashSet<>();<NEW_LINE>final Set<String> endNodeTypes = new LinkedHashSet<>();<NEW_LINE>String relType = null;<NEW_LINE>for (final RelationshipInfo info : sourceList) {<NEW_LINE>startNodeTypes.add(info.getStartNodeType());<NEW_LINE>endNodeTypes.<MASK><NEW_LINE>// set relType on first hit (should all be the same!)<NEW_LINE>if (relType == null) {<NEW_LINE>relType = info.getRelType();<NEW_LINE>}<NEW_LINE>}<NEW_LINE>int startTypeCount = startNodeTypes.size();<NEW_LINE>int endTypeCount = endNodeTypes.size();<NEW_LINE>String commonStartType = null;<NEW_LINE>String commonEndType = null;<NEW_LINE>if (startTypeCount == 1) {<NEW_LINE>commonStartType = startNodeTypes.iterator().next();<NEW_LINE>} else {<NEW_LINE>commonStartType = reduceTypeToCommonSupertype(startNodeTypes, typeInfos);<NEW_LINE>}<NEW_LINE>if (endTypeCount == 1) {<NEW_LINE>commonEndType = endNodeTypes.iterator().next();<NEW_LINE>} else {<NEW_LINE>commonEndType = reduceTypeToCommonSupertype(endNodeTypes, typeInfos);<NEW_LINE>}<NEW_LINE>if (commonStartType != null && commonEndType != null) {<NEW_LINE>reducedList.add(new RelationshipInfo(commonStartType, commonEndType, relType));<NEW_LINE>}<NEW_LINE>return reducedList;<NEW_LINE>} | add(info.getEndNodeType()); |
1,195,440 | public static void vertical9(Kernel1D_S32 kernel, GrayU8 src, GrayI8 dst, int divisor, @Nullable GrowArray<DogArray_I32> workspaces) {<NEW_LINE>final byte[] dataSrc = src.data;<NEW_LINE>final byte[] dataDst = dst.data;<NEW_LINE>final int k1 = kernel.data[0];<NEW_LINE>final int k2 = kernel.data[1];<NEW_LINE>final int k3 = kernel.data[2];<NEW_LINE>final int k4 = kernel.data[3];<NEW_LINE>final int k5 = kernel.data[4];<NEW_LINE>final int k6 = kernel.data[5];<NEW_LINE>final int k7 = kernel.data[6];<NEW_LINE>final int k8 = kernel.data[7];<NEW_LINE>final int k9 = kernel.data[8];<NEW_LINE>final int radius = kernel.getRadius();<NEW_LINE>final int imgWidth = dst.getWidth();<NEW_LINE>final int imgHeight = dst.getHeight();<NEW_LINE>final int halfDivisor = divisor / 2;<NEW_LINE>final int yEnd = imgHeight - radius;<NEW_LINE>// CONCURRENT_BELOW BoofConcurrency.loopFor(radius, yEnd, y -> {<NEW_LINE>for (int y = radius; y < yEnd; y++) {<NEW_LINE>int indexDst = dst.startIndex + y * dst.stride;<NEW_LINE>int i = src.startIndex + (y - radius) * src.stride;<NEW_LINE>final int iEnd = i + imgWidth;<NEW_LINE>for (; i < iEnd; i++) {<NEW_LINE>int indexSrc = i;<NEW_LINE>int total = (dataSrc[indexSrc] & 0xFF) * k1;<NEW_LINE>indexSrc += src.stride;<NEW_LINE>total += (dataSrc[indexSrc] & 0xFF) * k2;<NEW_LINE>indexSrc += src.stride;<NEW_LINE>total += (dataSrc[indexSrc] & 0xFF) * k3;<NEW_LINE>indexSrc += src.stride;<NEW_LINE>total += (dataSrc[indexSrc] & 0xFF) * k4;<NEW_LINE>indexSrc += src.stride;<NEW_LINE>total += (dataSrc<MASK><NEW_LINE>indexSrc += src.stride;<NEW_LINE>total += (dataSrc[indexSrc] & 0xFF) * k6;<NEW_LINE>indexSrc += src.stride;<NEW_LINE>total += (dataSrc[indexSrc] & 0xFF) * k7;<NEW_LINE>indexSrc += src.stride;<NEW_LINE>total += (dataSrc[indexSrc] & 0xFF) * k8;<NEW_LINE>indexSrc += src.stride;<NEW_LINE>total += (dataSrc[indexSrc] & 0xFF) * k9;<NEW_LINE>dataDst[indexDst++] = (byte) ((total + halfDivisor) / divisor);<NEW_LINE>}<NEW_LINE>}<NEW_LINE>// CONCURRENT_ABOVE });<NEW_LINE>} | [indexSrc] & 0xFF) * k5; |
1,058,612 | private Map<String, String> queryConfigParam(long apiId, String version) {<NEW_LINE>String key = String.join("-", apiId + "", version);<NEW_LINE>Map<String, String> collect = configParamCache.getIfPresent(key);<NEW_LINE>if (collect == null) {<NEW_LINE>synchronized (this) {<NEW_LINE>collect = configParamCache.getIfPresent(key);<NEW_LINE>if (collect == null) {<NEW_LINE>List<ApiVersionVo> <MASK><NEW_LINE>ApiVersionVo apiVersionVo = apiVersionVoList.stream().filter(apiVersionVoTmp -> apiVersionVoTmp.getVersion().equals(version)).findFirst().orElse(null);<NEW_LINE>collect = apiServiceParamDao.queryByVersionId(apiVersionVo.getId()).stream().collect(toMap(ParamVo::getName, ParamVo::getType));<NEW_LINE>configParamCache.put(key, collect);<NEW_LINE>}<NEW_LINE>}<NEW_LINE>}<NEW_LINE>return collect;<NEW_LINE>} | apiVersionVoList = apiServiceVersionDao.queryApiVersionByApiServiceId(apiId); |
1,055,921 | public void init(GraphHopperConfig ghConfig) {<NEW_LINE>// throw explicit error for deprecated configs<NEW_LINE>if (ghConfig.has("prepare.lm.weightings")) {<NEW_LINE>throw new IllegalStateException("Use profiles_lm instead of prepare.lm.weightings, see #1922 and docs/core/profiles.md");<NEW_LINE>}<NEW_LINE>setPreparationThreads(ghConfig.getInt(Parameters.Landmark.PREPARE + "threads", getPreparationThreads()));<NEW_LINE>setLMProfiles(ghConfig.getLMProfiles());<NEW_LINE>landmarkCount = ghConfig.getInt(Parameters.Landmark.COUNT, landmarkCount);<NEW_LINE>logDetails = ghConfig.getBool(Landmark.PREPARE + "log_details", false);<NEW_LINE>minNodes = ghConfig.getInt(Landmark.PREPARE + "min_network_size", -1);<NEW_LINE>for (String loc : ghConfig.getString(Landmark.PREPARE + "suggestions_location", "").split(",")) {<NEW_LINE>if (!loc.trim().isEmpty())<NEW_LINE>lmSuggestionsLocations.add(loc.trim());<NEW_LINE>}<NEW_LINE>if (!isEnabled())<NEW_LINE>return;<NEW_LINE>String splitAreaLocation = ghConfig.getString(Landmark.PREPARE + "split_area_location", "");<NEW_LINE>JsonFeatureCollection landmarkSplittingFeatureCollection = loadLandmarkSplittingFeatureCollection(splitAreaLocation);<NEW_LINE>if (landmarkSplittingFeatureCollection != null && !landmarkSplittingFeatureCollection.getFeatures().isEmpty()) {<NEW_LINE>List<SplitArea> splitAreas = landmarkSplittingFeatureCollection.getFeatures().stream().map(SplitArea::fromJsonFeature).<MASK><NEW_LINE>areaIndex = new AreaIndex<>(splitAreas);<NEW_LINE>}<NEW_LINE>} | collect(Collectors.toList()); |
1,347,061 | public AsyncFuture<Void> run(final ShellIO io, TaskParameters base) throws Exception {<NEW_LINE>final Parameters params = (Parameters) base;<NEW_LINE>final SuggestBackend s = suggest.useOptionalGroup(params.group);<NEW_LINE>final ObjectMapper mapper = new ObjectMapper(new YAMLFactory());<NEW_LINE>final List<Callable<TestResult>> <MASK><NEW_LINE>final DateRange range = DateRange.now(clock);<NEW_LINE>try (final InputStream input = open(io, params.file)) {<NEW_LINE>final TestSuite suite = mapper.readValue(input, TestSuite.class);<NEW_LINE>for (final TestCase c : suite.getTests()) {<NEW_LINE>final Filter filter = parser.parseFilter(c.getContext());<NEW_LINE>for (final int concurrency : suite.getConcurrency()) {<NEW_LINE>tests.add(setupTest(io.out(), c.getContext(), concurrency, filter, range, params.getLimit(), c, s));<NEW_LINE>}<NEW_LINE>}<NEW_LINE>}<NEW_LINE>final ObjectMapper m = new ObjectMapper();<NEW_LINE>for (final Callable<TestResult> test : tests) {<NEW_LINE>final TestResult result = test.call();<NEW_LINE>final TestOutput output = new TestOutput(result.getContext(), result.getConcurrency(), result.getErrors(), result.getMismatches(), result.getMatches(), result.getCount(), result.getTimes());<NEW_LINE>io.out().println(m.writeValueAsString(output));<NEW_LINE>io.out().flush();<NEW_LINE>}<NEW_LINE>return async.resolved();<NEW_LINE>} | tests = new ArrayList<>(); |
75,558 | public static void derivX_F32(GrayF32 orig, GrayF32 derivX) {<NEW_LINE>final float[] data = orig.data;<NEW_LINE>final <MASK><NEW_LINE>final int width = orig.getWidth();<NEW_LINE>final int height = orig.getHeight();<NEW_LINE>for (int y = 0; y < height; y++) {<NEW_LINE>int index = width * y + 1;<NEW_LINE>int endX = index + width - 2;<NEW_LINE>int endXAlt = endX - (width - 2) % 3;<NEW_LINE>float x0 = data[index - 1];<NEW_LINE>float x1 = data[index];<NEW_LINE>for (; index < endXAlt; ) {<NEW_LINE>float x2 = data[index + 1];<NEW_LINE>imgX[index++] = (x2 - x0) * 0.5f;<NEW_LINE>x0 = data[index + 1];<NEW_LINE>imgX[index++] = (x0 - x1) * 0.5f;<NEW_LINE>x1 = data[index + 1];<NEW_LINE>imgX[index++] = (x1 - x2) * 0.5f;<NEW_LINE>}<NEW_LINE>for (; index < endX; index++) {<NEW_LINE>imgX[index] = (data[index + 1] - data[index - 1]) * 0.5f;<NEW_LINE>}<NEW_LINE>}<NEW_LINE>} | float[] imgX = derivX.data; |
982,414 | private void queryTable(DataSource ds) throws Exception {<NEW_LINE>Connection con = ds.getConnection(DB_USER, DB_PWD);<NEW_LINE>System.out.println("queryTable: " + schemaName);<NEW_LINE>try {<NEW_LINE>Statement stmt = con.createStatement();<NEW_LINE><MASK><NEW_LINE>ResultSet rs = stmt.executeQuery(query);<NEW_LINE>// System.out.println("Id Name Job");<NEW_LINE>while (rs.next()) {<NEW_LINE>System.out.println("db entry : " + rs.getString("COMPONENTID") + " " + rs.getString("CLIENTID") + " " + rs.getString("CLIENTSECRET") + " " + rs.getString("DISPLAYNAME") + " " + rs.getString("REDIRECTURI") + " " + rs.getInt("Enabled") + " " + rs.getString(7));<NEW_LINE>}<NEW_LINE>} catch (Throwable x) {<NEW_LINE>System.out.println("queryTable unexpected exception" + x.getMessage());<NEW_LINE>} finally {<NEW_LINE>System.out.println("queryTable - time to close");<NEW_LINE>con.close();<NEW_LINE>}<NEW_LINE>} | String query = "select * from " + schemaName + ".OAUTH20CLIENTCONFIG"; |
1,149,228 | public Chunk read(ByteBuf input, ClientWorld world) throws Exception {<NEW_LINE>int chunkX = input.readInt();<NEW_LINE>int chunkZ = input.readInt();<NEW_LINE>boolean fullChunk = input.readBoolean();<NEW_LINE>int primaryBitmask = Type.VAR_INT.readPrimitive(input);<NEW_LINE>Type.VAR_INT.readPrimitive(input);<NEW_LINE>// Read sections<NEW_LINE>ChunkSection[] sections = new ChunkSection[16];<NEW_LINE>for (int i = 0; i < 16; i++) {<NEW_LINE>// Section not set<NEW_LINE>if ((primaryBitmask & (1 << i)) == 0)<NEW_LINE>continue;<NEW_LINE>ChunkSection section = Types1_9.CHUNK_SECTION.read(input);<NEW_LINE>sections[i] = section;<NEW_LINE>section.<MASK><NEW_LINE>if (world.getEnvironment() == Environment.NORMAL) {<NEW_LINE>section.getLight().readSkyLight(input);<NEW_LINE>}<NEW_LINE>}<NEW_LINE>int[] biomeData = fullChunk ? new int[256] : null;<NEW_LINE>if (fullChunk) {<NEW_LINE>for (int i = 0; i < 256; i++) {<NEW_LINE>biomeData[i] = input.readByte() & 0xFF;<NEW_LINE>}<NEW_LINE>}<NEW_LINE>List<CompoundTag> nbtData = new ArrayList<>(Arrays.asList(Type.NBT_ARRAY.read(input)));<NEW_LINE>// Read all the remaining bytes (workaround for #681)<NEW_LINE>if (input.readableBytes() > 0) {<NEW_LINE>byte[] array = Type.REMAINING_BYTES.read(input);<NEW_LINE>if (Via.getManager().isDebug()) {<NEW_LINE>Via.getPlatform().getLogger().warning("Found " + array.length + " more bytes than expected while reading the chunk: " + chunkX + "/" + chunkZ);<NEW_LINE>}<NEW_LINE>}<NEW_LINE>return new BaseChunk(chunkX, chunkZ, fullChunk, false, primaryBitmask, sections, biomeData, nbtData);<NEW_LINE>} | getLight().readBlockLight(input); |
29,862 | /*<NEW_LINE>* Displays a confirmation box asking if you want to delete the note type and then deletes it if confirmed<NEW_LINE>*/<NEW_LINE>private void deleteModelDialog() {<NEW_LINE>if (mModelIds.size() > 1) {<NEW_LINE>Runnable confirm = () -> {<NEW_LINE>mCol.modSchemaNoCheck();<NEW_LINE>deleteModel();<NEW_LINE>dismissContextMenu();<NEW_LINE>};<NEW_LINE>Runnable cancel = this::dismissContextMenu;<NEW_LINE>try {<NEW_LINE>mCol.modSchema();<NEW_LINE>ConfirmationDialog d = new ConfirmationDialog();<NEW_LINE>d.setArgs(getResources().getString(R.string.model_delete_warning));<NEW_LINE>d.setConfirm(confirm);<NEW_LINE>d.setCancel(cancel);<NEW_LINE>ModelBrowser.this.showDialogFragment(d);<NEW_LINE>} catch (ConfirmModSchemaException e) {<NEW_LINE>e.log();<NEW_LINE>ConfirmationDialog c = new ConfirmationDialog();<NEW_LINE>c.setArgs(getResources().getString(R.string.full_sync_confirmation));<NEW_LINE>c.setConfirm(confirm);<NEW_LINE>c.setCancel(cancel);<NEW_LINE>showDialogFragment(c);<NEW_LINE>}<NEW_LINE>} else // Prevent users from deleting last model<NEW_LINE>{<NEW_LINE>showToast(getString<MASK><NEW_LINE>}<NEW_LINE>} | (R.string.toast_last_model)); |
865,286 | public Object executeFunction() {<NEW_LINE>ReferenceConstant symb_str_buffer = this.getSymbReceiver();<NEW_LINE>StringBuffer conc_str_buffer = (StringBuffer) this.getConcReceiver();<NEW_LINE>StringValue leftExpr = this.env.heap.getField(Types.JAVA_LANG_STRING_BUFFER, SymbolicHeap.$STRING_BUFFER_CONTENTS, conc_str_buffer, symb_str_buffer, stringValBeforeExecution);<NEW_LINE>ReferenceExpression symb_str = this.getSymbArgument(0);<NEW_LINE>String conc_str = (<MASK><NEW_LINE>StringValue symb_str_value;<NEW_LINE>if (conc_str == null) {<NEW_LINE>symb_str_value = ExpressionFactory.buildNewStringConstant(NULL_STRING);<NEW_LINE>} else {<NEW_LINE>ReferenceConstant symb_non_null_str = (ReferenceConstant) symb_str;<NEW_LINE>symb_str_value = env.heap.getField(Types.JAVA_LANG_STRING, SymbolicHeap.$STRING_VALUE, conc_str, symb_non_null_str, conc_str);<NEW_LINE>}<NEW_LINE>// append string expression<NEW_LINE>String conc_value = conc_str_buffer.toString();<NEW_LINE>StringValue append_expr = new StringBinaryExpression(leftExpr, Operator.APPEND_STRING, symb_str_value, conc_value);<NEW_LINE>// store to symbolic heap<NEW_LINE>env.heap.putField(Types.JAVA_LANG_STRING_BUFFER, SymbolicHeap.$STRING_BUFFER_CONTENTS, conc_str_buffer, symb_str_buffer, append_expr);<NEW_LINE>// append returns the StringBuffer<NEW_LINE>return symb_str_buffer;<NEW_LINE>} | String) this.getConcArgument(0); |
1,552,452 | private int tcp_reply_data(byte[] ib, int start, int len) throws Pausable {<NEW_LINE>if (log.isLoggable(Level.FINER))<NEW_LINE><MASK><NEW_LINE>ByteBuffer out = ByteBuffer.wrap(ib, start, len);<NEW_LINE>Packet.get_body(htype, out);<NEW_LINE>start = out.position();<NEW_LINE>int bodylen = out.remaining();<NEW_LINE>scanbit8(out);<NEW_LINE>out = out.slice();<NEW_LINE>out.position(out.limit());<NEW_LINE>int code;<NEW_LINE>if (deliver == INET_DELIVER_PORT) {<NEW_LINE>code = inet_port_data(out);<NEW_LINE>} else if ((code = Packet.parse(htype, ib, start, len, http_state, packet_callbacks, this)) == 0) {<NEW_LINE>if (active == ActiveType.PASSIVE) {<NEW_LINE>return inet_async_data(0, out);<NEW_LINE>} else {<NEW_LINE>code = tcp_message(out);<NEW_LINE>}<NEW_LINE>}<NEW_LINE>if (code < 0)<NEW_LINE>return code;<NEW_LINE>if (active == ActiveType.ACTIVE_ONCE) {<NEW_LINE>active = ActiveType.PASSIVE;<NEW_LINE>}<NEW_LINE>return code;<NEW_LINE>} | log.finer("tcp_reply_data len=" + len); |
49,533 | private static void generatePyramid(int height, Position3D startPos, GameArea<Tile, Block<Tile>> gameArea) {<NEW_LINE>double percent = 1.0 / (height + 1);<NEW_LINE>Tile wall = Tile.newBuilder().withCharacter(Symbols.BLOCK_SOLID).build();<NEW_LINE>AtomicInteger currLevel = new AtomicInteger(startPos.getZ());<NEW_LINE>final ColorInterpolator <MASK><NEW_LINE>for (int currSize = 0; currSize < height; currSize++) {<NEW_LINE>final double currPercent = (currSize + 1) * percent;<NEW_LINE>Position levelOffset = startPos.to2DPosition().withRelativeX(-currSize).withRelativeY(-currSize);<NEW_LINE>Size levelSize = Size.create(1 + currSize * 2, 1 + currSize * 2);<NEW_LINE>levelSize.fetchPositions().forEach(position -> {<NEW_LINE>Position3D pos = position.plus(levelOffset).toPosition3D(currLevel.get());<NEW_LINE>Tile top = wall.withForegroundColor(interpolator.getColorAtRatio(currPercent));<NEW_LINE>Tile front = top.withForegroundColor(top.getForegroundColor().darkenByPercent(.1));<NEW_LINE>gameArea.setBlockAt(pos, Block.newBuilder().withTop(top).withFront(front).withEmptyTile(Tile.empty()).build());<NEW_LINE>});<NEW_LINE>currLevel.decrementAndGet();<NEW_LINE>}<NEW_LINE>} | interpolator = PYRAMID_TOP_COLOR.interpolateTo(PYRAMID_BOTTOM_COLOR); |
85,468 | public Object call(Properties bindings, Object[] args) {<NEW_LINE>if (args.length == 1) {<NEW_LINE>Object v = args[0];<NEW_LINE>if (v != null) {<NEW_LINE>if (v.getClass().isArray()) {<NEW_LINE>Object[] a = (Object[]) v;<NEW_LINE>return a.length;<NEW_LINE>} else if (v instanceof Collection<?>) {<NEW_LINE>return ((Collection<?>) v).size();<NEW_LINE>} else if (v instanceof HasFieldsList) {<NEW_LINE>return ((HasFieldsList) v).length();<NEW_LINE>} else if (v instanceof ArrayNode) {<NEW_LINE>return ((ArrayNode) v).size();<NEW_LINE>} else {<NEW_LINE>String s = (v instanceof String ? (String) <MASK><NEW_LINE>return s.length();<NEW_LINE>}<NEW_LINE>}<NEW_LINE>}<NEW_LINE>return new EvalError(ControlFunctionRegistry.getFunctionName(this) + " expects an array or a string");<NEW_LINE>} | v : v.toString()); |
767,780 | public static void horizontal(Kernel1D_S32 kernel, GrayS32 src, GrayS32 dst) {<NEW_LINE>final int[] dataSrc = src.data;<NEW_LINE>final int[] dataDst = dst.data;<NEW_LINE>final int[] dataKer = kernel.data;<NEW_LINE>final int offset = kernel.getOffset();<NEW_LINE>final int kernelWidth = kernel.getWidth();<NEW_LINE>final int width = src.getWidth();<NEW_LINE>// CONCURRENT_BELOW BoofConcurrency.loopFor(0, src.height, i -> {<NEW_LINE>for (int i = 0; i < src.height; i++) {<NEW_LINE>int indexDst = dst.startIndex + i * dst.stride + offset;<NEW_LINE>int j = src.startIndex + i * src.stride;<NEW_LINE>final int jEnd = j <MASK><NEW_LINE>for (; j < jEnd; j++) {<NEW_LINE>int total = 0;<NEW_LINE>int indexSrc = j;<NEW_LINE>for (int k = 0; k < kernelWidth; k++) {<NEW_LINE>total += (dataSrc[indexSrc++]) * dataKer[k];<NEW_LINE>}<NEW_LINE>dataDst[indexDst++] = total;<NEW_LINE>}<NEW_LINE>}<NEW_LINE>// CONCURRENT_ABOVE });<NEW_LINE>} | + width - (kernelWidth - 1); |
819,953 | public void marshall(LoadBalancer loadBalancer, ProtocolMarshaller protocolMarshaller) {<NEW_LINE>if (loadBalancer == null) {<NEW_LINE>throw new SdkClientException("Invalid argument passed to marshall(...)");<NEW_LINE>}<NEW_LINE>try {<NEW_LINE>protocolMarshaller.marshall(loadBalancer.getName(), NAME_BINDING);<NEW_LINE>protocolMarshaller.marshall(loadBalancer.getArn(), ARN_BINDING);<NEW_LINE>protocolMarshaller.marshall(loadBalancer.getSupportCode(), SUPPORTCODE_BINDING);<NEW_LINE>protocolMarshaller.marshall(loadBalancer.getCreatedAt(), CREATEDAT_BINDING);<NEW_LINE>protocolMarshaller.marshall(loadBalancer.getLocation(), LOCATION_BINDING);<NEW_LINE>protocolMarshaller.marshall(loadBalancer.getResourceType(), RESOURCETYPE_BINDING);<NEW_LINE>protocolMarshaller.marshall(loadBalancer.getTags(), TAGS_BINDING);<NEW_LINE>protocolMarshaller.marshall(<MASK><NEW_LINE>protocolMarshaller.marshall(loadBalancer.getState(), STATE_BINDING);<NEW_LINE>protocolMarshaller.marshall(loadBalancer.getProtocol(), PROTOCOL_BINDING);<NEW_LINE>protocolMarshaller.marshall(loadBalancer.getPublicPorts(), PUBLICPORTS_BINDING);<NEW_LINE>protocolMarshaller.marshall(loadBalancer.getHealthCheckPath(), HEALTHCHECKPATH_BINDING);<NEW_LINE>protocolMarshaller.marshall(loadBalancer.getInstancePort(), INSTANCEPORT_BINDING);<NEW_LINE>protocolMarshaller.marshall(loadBalancer.getInstanceHealthSummary(), INSTANCEHEALTHSUMMARY_BINDING);<NEW_LINE>protocolMarshaller.marshall(loadBalancer.getTlsCertificateSummaries(), TLSCERTIFICATESUMMARIES_BINDING);<NEW_LINE>protocolMarshaller.marshall(loadBalancer.getConfigurationOptions(), CONFIGURATIONOPTIONS_BINDING);<NEW_LINE>protocolMarshaller.marshall(loadBalancer.getIpAddressType(), IPADDRESSTYPE_BINDING);<NEW_LINE>} catch (Exception e) {<NEW_LINE>throw new SdkClientException("Unable to marshall request to JSON: " + e.getMessage(), e);<NEW_LINE>}<NEW_LINE>} | loadBalancer.getDnsName(), DNSNAME_BINDING); |
756,434 | private Iterator<FormattedText> applyPrintSettings(List<ArgumentMatcher> matchers, PrintSettings printSettings) {<NEW_LINE>List<FormattedText> out = new LinkedList<>();<NEW_LINE>int i = 0;<NEW_LINE>for (final ArgumentMatcher matcher : matchers) {<NEW_LINE>if (matcher instanceof ContainsExtraTypeInfo) {<NEW_LINE>ContainsExtraTypeInfo typeInfoMatcher = (ContainsExtraTypeInfo) matcher;<NEW_LINE>Object wanted = typeInfoMatcher.getWanted();<NEW_LINE>String simpleNameOfArgument = wanted != null ? wanted.getClass().getSimpleName() : "";<NEW_LINE>String fullyQualifiedClassName = wanted != null ? wanted.getClass().getCanonicalName() : "";<NEW_LINE>if (printSettings.extraTypeInfoFor(i)) {<NEW_LINE>out.add(new FormattedText(typeInfoMatcher.toStringWithType(simpleNameOfArgument)));<NEW_LINE>} else if (printSettings.fullyQualifiedNameFor(simpleNameOfArgument)) {<NEW_LINE>out.add(new FormattedText(typeInfoMatcher.toStringWithType(fullyQualifiedClassName)));<NEW_LINE>} else {<NEW_LINE>out.add(new FormattedText(MatcherToString.toString(matcher)));<NEW_LINE>}<NEW_LINE>} else {<NEW_LINE>out.add(new FormattedText(<MASK><NEW_LINE>}<NEW_LINE>i++;<NEW_LINE>}<NEW_LINE>return out.iterator();<NEW_LINE>} | MatcherToString.toString(matcher))); |
1,145,282 | protected Validator createClassicValidator() throws javax.servlet.jsp.JspException {<NEW_LINE><MASK><NEW_LINE>ELContext elContext = facesContext.getELContext();<NEW_LINE>if (null != _binding) {<NEW_LINE>Object validator;<NEW_LINE>try {<NEW_LINE>validator = _binding.getValue(elContext);<NEW_LINE>} catch (Exception e) {<NEW_LINE>throw new JspException("Error while creating the Validator", e);<NEW_LINE>}<NEW_LINE>if (validator instanceof Validator) {<NEW_LINE>return (Validator) validator;<NEW_LINE>}<NEW_LINE>}<NEW_LINE>Application application = facesContext.getApplication();<NEW_LINE>Validator validator = null;<NEW_LINE>try {<NEW_LINE>// first check if an ValidatorId was set by a method<NEW_LINE>if (null != _validatorIdString) {<NEW_LINE>validator = application.createValidator(_validatorIdString);<NEW_LINE>} else if (null != _validatorId) {<NEW_LINE>String validatorId = (String) _validatorId.getValue(elContext);<NEW_LINE>validator = application.createValidator(validatorId);<NEW_LINE>}<NEW_LINE>} catch (Exception e) {<NEW_LINE>throw new JspException("Error while creating the Validator", e);<NEW_LINE>}<NEW_LINE>if (null != validator) {<NEW_LINE>if (null != _binding) {<NEW_LINE>_binding.setValue(elContext, validator);<NEW_LINE>}<NEW_LINE>return validator;<NEW_LINE>}<NEW_LINE>throw new JspException("validatorId and/or binding must be specified");<NEW_LINE>} | FacesContext facesContext = FacesContext.getCurrentInstance(); |
183,860 | final RemoveTagsFromCertificateResult executeRemoveTagsFromCertificate(RemoveTagsFromCertificateRequest removeTagsFromCertificateRequest) {<NEW_LINE>ExecutionContext executionContext = createExecutionContext(removeTagsFromCertificateRequest);<NEW_LINE>AWSRequestMetrics awsRequestMetrics = executionContext.getAwsRequestMetrics();<NEW_LINE>awsRequestMetrics.startEvent(Field.ClientExecuteTime);<NEW_LINE>Request<RemoveTagsFromCertificateRequest> request = null;<NEW_LINE>Response<RemoveTagsFromCertificateResult> response = null;<NEW_LINE>try {<NEW_LINE>awsRequestMetrics.startEvent(Field.RequestMarshallTime);<NEW_LINE>try {<NEW_LINE>request = new RemoveTagsFromCertificateRequestProtocolMarshaller(protocolFactory).marshall(super.beforeMarshalling(removeTagsFromCertificateRequest));<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, "ACM");<NEW_LINE>request.addHandlerContext(HandlerContextKey.OPERATION_NAME, "RemoveTagsFromCertificate");<NEW_LINE>request.addHandlerContext(HandlerContextKey.ADVANCED_CONFIG, advancedConfig);<NEW_LINE>} finally {<NEW_LINE>awsRequestMetrics.endEvent(Field.RequestMarshallTime);<NEW_LINE>}<NEW_LINE>HttpResponseHandler<AmazonWebServiceResponse<RemoveTagsFromCertificateResult>> responseHandler = protocolFactory.createResponseHandler(new JsonOperationMetadata().withPayloadJson(true).withHasStreamingSuccessResponse(false), new RemoveTagsFromCertificateResultJsonUnmarshaller());<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,460,992 | private boolean checkWillPublish(@NotNull final ChannelHandlerContext ctx, @NotNull final CONNECT msg) {<NEW_LINE>if (msg.getWillPublish() != null) {<NEW_LINE>if (Topics.containsWildcard(msg.getWillPublish().getTopic())) {<NEW_LINE>mqttConnacker.connackError(ctx.channel(), "A client (IP: {}) sent a CONNECT with a wildcard character in the Will Topic (# or +). This is not allowed.", "Sent CONNECT with wildcard character in the Will Topic (#/+)", <MASK><NEW_LINE>return false;<NEW_LINE>}<NEW_LINE>final int willQos = msg.getWillPublish().getQos().getQosNumber();<NEW_LINE>final int maxQos = configurationService.mqttConfiguration().maximumQos().getQosNumber();<NEW_LINE>if (willQos > maxQos) {<NEW_LINE>mqttConnacker.connackError(ctx.channel(), "A client (IP: {}) sent a CONNECT with a Will QoS higher than the maximum configured QoS. This is not allowed.", "Sent CONNECT with Will QoS (" + willQos + ") higher than the allowed maximum (" + maxQos + ")", Mqtt5ConnAckReasonCode.QOS_NOT_SUPPORTED, String.format(ReasonStrings.CONNACK_QOS_NOT_SUPPORTED_WILL, willQos, maxQos));<NEW_LINE>return false;<NEW_LINE>}<NEW_LINE>final int maxTopicLength = configurationService.restrictionsConfiguration().maxTopicLength();<NEW_LINE>if (msg.getWillPublish().getTopic().length() > maxTopicLength) {<NEW_LINE>mqttConnacker.connackError(ctx.channel(), "A client (IP: {}) sent a CONNECT with a Will Topic exceeding the max length. This is not allowed.", "Sent CONNECT with Will topic that exceeds maximum topic length", Mqtt5ConnAckReasonCode.TOPIC_NAME_INVALID, ReasonStrings.CONNACK_NOT_AUTHORIZED_MAX_TOPIC_LENGTH_EXCEEDED);<NEW_LINE>return false;<NEW_LINE>}<NEW_LINE>}<NEW_LINE>return true;<NEW_LINE>} | Mqtt5ConnAckReasonCode.TOPIC_NAME_INVALID, ReasonStrings.CONNACK_NOT_AUTHORIZED_WILL_WILDCARD); |
1,044,820 | static <B extends ParsedBucket> B parseTermsBucketXContent(final XContentParser parser, final Supplier<B> bucketSupplier, final CheckedBiConsumer<XContentParser, B, IOException> keyConsumer) throws IOException {<NEW_LINE>final B bucket = bucketSupplier.get();<NEW_LINE>final List<Aggregation> <MASK><NEW_LINE>XContentParser.Token token;<NEW_LINE>String currentFieldName = parser.currentName();<NEW_LINE>while ((token = parser.nextToken()) != XContentParser.Token.END_OBJECT) {<NEW_LINE>if (token == XContentParser.Token.FIELD_NAME) {<NEW_LINE>currentFieldName = parser.currentName();<NEW_LINE>} else if (token.isValue()) {<NEW_LINE>if (CommonFields.KEY_AS_STRING.getPreferredName().equals(currentFieldName)) {<NEW_LINE>bucket.setKeyAsString(parser.text());<NEW_LINE>} else if (CommonFields.KEY.getPreferredName().equals(currentFieldName)) {<NEW_LINE>keyConsumer.accept(parser, bucket);<NEW_LINE>} else if (CommonFields.DOC_COUNT.getPreferredName().equals(currentFieldName)) {<NEW_LINE>bucket.setDocCount(parser.longValue());<NEW_LINE>} else if (DOC_COUNT_ERROR_UPPER_BOUND_FIELD_NAME.getPreferredName().equals(currentFieldName)) {<NEW_LINE>bucket.docCountError = parser.longValue();<NEW_LINE>bucket.showDocCountError = true;<NEW_LINE>}<NEW_LINE>} else if (token == XContentParser.Token.START_OBJECT) {<NEW_LINE>XContentParserUtils.parseTypedKeysObject(parser, Aggregation.TYPED_KEYS_DELIMITER, Aggregation.class, aggregations::add);<NEW_LINE>}<NEW_LINE>}<NEW_LINE>bucket.setAggregations(new Aggregations(aggregations));<NEW_LINE>return bucket;<NEW_LINE>} | aggregations = new ArrayList<>(); |
1,432,655 | protected Proxy validateProxyConfigFields() {<NEW_LINE>boolean isConfigValid = true;<NEW_LINE>int proxyTypeId = ((RadioGroup) mProxyConfigDialog.findViewById(R.id.proxy_type)).getCheckedRadioButtonId();<NEW_LINE>if (proxyTypeId == -1) {<NEW_LINE>isConfigValid = false;<NEW_LINE>appendStatusMessage(R.string.proxy_type_invalid);<NEW_LINE>mProxyConfigDialog.findViewById(R.id.proxy_type_http).requestFocus();<NEW_LINE>}<NEW_LINE>String proxyHost = ((EditText) mProxyConfigDialog.findViewById(R.id.proxy_host)).getText().toString();<NEW_LINE>if (proxyHost.isEmpty()) {<NEW_LINE>isConfigValid = false;<NEW_LINE><MASK><NEW_LINE>}<NEW_LINE>String proxyPortString = ((EditText) mProxyConfigDialog.findViewById(R.id.proxy_port)).getText().toString();<NEW_LINE>int proxyPort = proxyPortString.isEmpty() ? 0 : Integer.parseInt(proxyPortString);<NEW_LINE>if (proxyPort <= 0) {<NEW_LINE>isConfigValid = false;<NEW_LINE>appendStatusMessage(R.string.proxy_port_invalid);<NEW_LINE>}<NEW_LINE>if (!isConfigValid) {<NEW_LINE>return null;<NEW_LINE>}<NEW_LINE>Proxy.Type proxyType = proxyTypeId == R.id.proxy_type_http ? Proxy.Type.HTTP : Proxy.Type.SOCKS;<NEW_LINE>return new Proxy(proxyType, InetSocketAddress.createUnresolved(proxyHost, proxyPort));<NEW_LINE>} | appendStatusMessage(R.string.proxy_host_invalid); |
351,122 | // Handle failover<NEW_LINE>private void checkFailover(String failedNodeID, JsonObject theHAInfo) {<NEW_LINE>try {<NEW_LINE>JsonArray deployments = theHAInfo.getJsonArray("verticles");<NEW_LINE>String <MASK><NEW_LINE>String chosen = chooseHashedNode(group, failedNodeID.hashCode());<NEW_LINE>if (chosen != null && chosen.equals(this.nodeID)) {<NEW_LINE>if (deployments != null && deployments.size() != 0) {<NEW_LINE>log.info("node" + nodeID + " says: Node " + failedNodeID + " has failed. This node will deploy " + deployments.size() + " deploymentIDs from that node.");<NEW_LINE>for (Object obj : deployments) {<NEW_LINE>JsonObject app = (JsonObject) obj;<NEW_LINE>processFailover(app);<NEW_LINE>}<NEW_LINE>}<NEW_LINE>// Failover is complete! We can now remove the failed node from the cluster map<NEW_LINE>clusterMap.remove(failedNodeID);<NEW_LINE>runOnContextAndWait(() -> {<NEW_LINE>if (failoverCompleteHandler != null) {<NEW_LINE>failoverCompleteHandler.handle(failedNodeID, theHAInfo, true);<NEW_LINE>}<NEW_LINE>});<NEW_LINE>}<NEW_LINE>} catch (Throwable t) {<NEW_LINE>log.error("Failed to handle failover", t);<NEW_LINE>runOnContextAndWait(() -> {<NEW_LINE>if (failoverCompleteHandler != null) {<NEW_LINE>failoverCompleteHandler.handle(failedNodeID, theHAInfo, false);<NEW_LINE>}<NEW_LINE>});<NEW_LINE>}<NEW_LINE>} | group = theHAInfo.getString("group"); |
193,266 | final DescribeVolumesResult executeDescribeVolumes(DescribeVolumesRequest describeVolumesRequest) {<NEW_LINE>ExecutionContext executionContext = createExecutionContext(describeVolumesRequest);<NEW_LINE>AWSRequestMetrics awsRequestMetrics = executionContext.getAwsRequestMetrics();<NEW_LINE>awsRequestMetrics.startEvent(Field.ClientExecuteTime);<NEW_LINE>Request<DescribeVolumesRequest> request = null;<NEW_LINE>Response<DescribeVolumesResult> response = null;<NEW_LINE>try {<NEW_LINE>awsRequestMetrics.startEvent(Field.RequestMarshallTime);<NEW_LINE>try {<NEW_LINE>request = new DescribeVolumesRequestMarshaller().marshall(super.beforeMarshalling(describeVolumesRequest));<NEW_LINE>// Binds the request metrics to the current request.<NEW_LINE>request.setAWSRequestMetrics(awsRequestMetrics);<NEW_LINE>request.addHandlerContext(HandlerContextKey.CLIENT_ENDPOINT, endpoint);<NEW_LINE>request.addHandlerContext(<MASK><NEW_LINE>request.addHandlerContext(HandlerContextKey.SIGNING_REGION, getSigningRegion());<NEW_LINE>request.addHandlerContext(HandlerContextKey.SERVICE_ID, "EC2");<NEW_LINE>request.addHandlerContext(HandlerContextKey.OPERATION_NAME, "DescribeVolumes");<NEW_LINE>request.addHandlerContext(HandlerContextKey.ADVANCED_CONFIG, advancedConfig);<NEW_LINE>} finally {<NEW_LINE>awsRequestMetrics.endEvent(Field.RequestMarshallTime);<NEW_LINE>}<NEW_LINE>StaxResponseHandler<DescribeVolumesResult> responseHandler = new StaxResponseHandler<DescribeVolumesResult>(new DescribeVolumesResultStaxUnmarshaller());<NEW_LINE>response = invoke(request, responseHandler, executionContext);<NEW_LINE>return response.getAwsResponse();<NEW_LINE>} finally {<NEW_LINE>endClientExecution(awsRequestMetrics, request, response);<NEW_LINE>}<NEW_LINE>} | HandlerContextKey.ENDPOINT_OVERRIDDEN, isEndpointOverridden()); |
1,009,645 | private static void executePst(Sequence srcSeries, PreparedStatement pst, Expression[] params, byte[] types, Context ctx, DBSession dbs, String dbCharset, boolean tranSQL, int dbType, String name) {<NEW_LINE>if (srcSeries == null)<NEW_LINE>return;<NEW_LINE>int paramCount = params == null ? 0 : params.length;<NEW_LINE>int len = srcSeries.length();<NEW_LINE>Object[][] valueGroup = new Object[len][paramCount];<NEW_LINE>ComputeStack stack = ctx.getComputeStack();<NEW_LINE>Sequence.Current current = srcSeries.new Current();<NEW_LINE>stack.push(current);<NEW_LINE>try {<NEW_LINE>for (int i = 1; i <= len; ++i) {<NEW_LINE>current.setCurrent(i);<NEW_LINE>Object[] paramValues = new Object[paramCount];<NEW_LINE>valueGroup[i - 1] = paramValues;<NEW_LINE>for (int p = 0; p < paramCount; ++p) {<NEW_LINE>if (params[p] != null)<NEW_LINE>paramValues[p] = params<MASK><NEW_LINE>}<NEW_LINE>}<NEW_LINE>} finally {<NEW_LINE>stack.pop();<NEW_LINE>}<NEW_LINE>executeBatch(pst, valueGroup, types, dbs, dbCharset, tranSQL, dbType, name, true);<NEW_LINE>} | [p].calculate(ctx); |
1,478,850 | public boolean expandGroup(int groupPos, boolean animate) {<NEW_LINE>ExpandableListPosition elGroupPos = ExpandableListPosition.obtain(ExpandableListPosition.GROUP, groupPos, -1, -1);<NEW_LINE>PositionMetadata <MASK><NEW_LINE>elGroupPos.recycle();<NEW_LINE>boolean retValue = mConnector.expandGroup(pm);<NEW_LINE>if (mOnGroupExpandListener != null) {<NEW_LINE>mOnGroupExpandListener.onGroupExpand(groupPos);<NEW_LINE>}<NEW_LINE>// TODO Make it works on Eclair<NEW_LINE>if (animate && VERSION.SDK_INT >= VERSION_CODES.FROYO) {<NEW_LINE>final int groupFlatPos = pm.position.flatListPos;<NEW_LINE>final int shiftedGroupPosition = groupFlatPos + getHeaderViewsCount();<NEW_LINE>smoothScrollToPosition(shiftedGroupPosition + mAdapter.getChildrenCount(groupPos), shiftedGroupPosition);<NEW_LINE>}<NEW_LINE>pm.recycle();<NEW_LINE>return retValue;<NEW_LINE>} | pm = mConnector.getFlattenedPos(elGroupPos); |
1,757,217 | protected JComponent createCenterPanel() {<NEW_LINE>JPanel panel = new JPanel(new GridBagLayout());<NEW_LINE>JLabel nameLabel = new JLabel(IdeBundle.message("label.todo.filter.name"));<NEW_LINE>panel.add(nameLabel, new GridBagConstraints(0, 0, 1, 1, 0, 0, GridBagConstraints.WEST, GridBagConstraints.NONE, new Insets(0, 0, 5, 10), 0, 0));<NEW_LINE>panel.add(myNameField, new GridBagConstraints(1, 0, 1, 1, 1, 0, GridBagConstraints.CENTER, GridBagConstraints.HORIZONTAL, new Insets(0, 0, 5, 0), 0, 0));<NEW_LINE>JPanel patternsPanel = new JPanel(new GridBagLayout());<NEW_LINE>Border border = IdeBorderFactory.createTitledBorder(IdeBundle<MASK><NEW_LINE>patternsPanel.setBorder(border);<NEW_LINE>myTable.getSelectionModel().setSelectionMode(ListSelectionModel.SINGLE_SELECTION);<NEW_LINE>JScrollPane scrollPane = ScrollPaneFactory.createScrollPane(myTable);<NEW_LINE>scrollPane.setPreferredSize(new Dimension(550, myTable.getRowHeight() * 10));<NEW_LINE>patternsPanel.add(scrollPane, new GridBagConstraints(0, 0, 1, 1, 1, 1, GridBagConstraints.CENTER, GridBagConstraints.BOTH, new Insets(0, 0, 0, 0), 0, 0));<NEW_LINE>// Column "Available"<NEW_LINE>int width = new JCheckBox().getPreferredSize().width;<NEW_LINE>TableColumn availableColumn = myTable.getColumnModel().getColumn(0);<NEW_LINE>availableColumn.setPreferredWidth(width);<NEW_LINE>availableColumn.setMaxWidth(width);<NEW_LINE>availableColumn.setMinWidth(width);<NEW_LINE>//<NEW_LINE>panel.add(patternsPanel, new GridBagConstraints(0, 1, 2, 1, 1, 1, GridBagConstraints.CENTER, GridBagConstraints.BOTH, new Insets(0, 0, 0, 0), 0, 0));<NEW_LINE>return panel;<NEW_LINE>} | .message("group.todo.filter.patterns"), false); |
1,523,505 | EvaluationResult evaluate(ConfigElement config, RegistryEntry registryEntry, String flatPrefix, boolean ignoreWarnings) throws ConfigEvaluatorException {<NEW_LINE>Map<String, ExtendedAttributeDefinition> attributeMap;<NEW_LINE>List<AttributeDefinition> requiredAttributes;<NEW_LINE>if (registryEntry != null) {<NEW_LINE>if (registryEntry.getExtends() != null) {<NEW_LINE>// extended type, get the hierarchy complete attributes<NEW_LINE>// HOPEFULLLY TEMPORARY<NEW_LINE>String pid = registryEntry.getPid();<NEW_LINE><MASK><NEW_LINE>requiredAttributes = metatypeRegistry.getRequiredAttributesForHierarchy(pid);<NEW_LINE>} else {<NEW_LINE>attributeMap = registryEntry.getAttributeMap();<NEW_LINE>requiredAttributes = registryEntry.getObjectClassDefinition().getRequiredAttributes();<NEW_LINE>}<NEW_LINE>} else {<NEW_LINE>attributeMap = null;<NEW_LINE>requiredAttributes = Collections.emptyList();<NEW_LINE>}<NEW_LINE>return evaluate(config, registryEntry, attributeMap, requiredAttributes, flatPrefix, ignoreWarnings);<NEW_LINE>} | attributeMap = metatypeRegistry.getHierarchyCompleteAttributeMap(pid); |
289,075 | protected boolean lt(final Object o1, final Object o2) {<NEW_LINE>if (o1 == null && o2 != null) {<NEW_LINE>return true;<NEW_LINE>}<NEW_LINE>if ((o1 != null && o2 == null) || (o1 == null && o2 == null)) {<NEW_LINE>return false;<NEW_LINE>}<NEW_LINE>if (o1 instanceof Number && o2 instanceof Number) {<NEW_LINE>return compareNumberNumber(o1, o2) < 0;<NEW_LINE>} else if (o1 instanceof String && o2 instanceof String) {<NEW_LINE>return compareStringString(o1, o2) < 0;<NEW_LINE>} else if (o1 instanceof Date && o2 instanceof Date) {<NEW_LINE>return compareDateDate(o1, o2) < 0;<NEW_LINE>} else if (o1 instanceof Date && o2 instanceof String) {<NEW_LINE>return <MASK><NEW_LINE>} else if (o1 instanceof String && o2 instanceof Date) {<NEW_LINE>return compareStringDate(o1, o2) < 0;<NEW_LINE>} else if (o1 instanceof Boolean && o2 instanceof String) {<NEW_LINE>return compareBooleanString((Boolean) o1, (String) o2) < 0;<NEW_LINE>} else if (o1 instanceof String && o2 instanceof Boolean) {<NEW_LINE>return compareStringBoolean((String) o1, (Boolean) o2) < 0;<NEW_LINE>} else if (o1 instanceof Number && o2 instanceof String) {<NEW_LINE>return compareNumberString((Number) o1, (String) o2) < 0;<NEW_LINE>} else if (o1 instanceof String && o2 instanceof Number) {<NEW_LINE>return compareStringNumber((String) o1, (Number) o2) < 0;<NEW_LINE>} else {<NEW_LINE>return compareStringString(o1.toString(), o2.toString()) < 0;<NEW_LINE>}<NEW_LINE>} | compareDateString(o1, o2) < 0; |
509,099 | public CompareFacesResult unmarshall(JsonUnmarshallerContext context) throws Exception {<NEW_LINE>CompareFacesResult compareFacesResult = new CompareFacesResult();<NEW_LINE>AwsJsonReader reader = context.getReader();<NEW_LINE>reader.beginObject();<NEW_LINE>while (reader.hasNext()) {<NEW_LINE>String name = reader.nextName();<NEW_LINE>if (name.equals("SourceImageFace")) {<NEW_LINE>compareFacesResult.setSourceImageFace(ComparedSourceImageFaceJsonUnmarshaller.getInstance().unmarshall(context));<NEW_LINE>} else if (name.equals("FaceMatches")) {<NEW_LINE>compareFacesResult.setFaceMatches(new ListUnmarshaller<CompareFacesMatch>(CompareFacesMatchJsonUnmarshaller.getInstance()).unmarshall(context));<NEW_LINE>} else if (name.equals("UnmatchedFaces")) {<NEW_LINE>compareFacesResult.setUnmatchedFaces(new ListUnmarshaller<ComparedFace>(ComparedFaceJsonUnmarshaller.getInstance()).unmarshall(context));<NEW_LINE>} else if (name.equals("SourceImageOrientationCorrection")) {<NEW_LINE>compareFacesResult.setSourceImageOrientationCorrection(StringJsonUnmarshaller.getInstance<MASK><NEW_LINE>} else if (name.equals("TargetImageOrientationCorrection")) {<NEW_LINE>compareFacesResult.setTargetImageOrientationCorrection(StringJsonUnmarshaller.getInstance().unmarshall(context));<NEW_LINE>} else {<NEW_LINE>reader.skipValue();<NEW_LINE>}<NEW_LINE>}<NEW_LINE>reader.endObject();<NEW_LINE>return compareFacesResult;<NEW_LINE>} | ().unmarshall(context)); |
1,105,107 | public PutEventStreamResult putEventStream(PutEventStreamRequest putEventStreamRequest) throws AmazonServiceException, AmazonClientException {<NEW_LINE>ExecutionContext executionContext = createExecutionContext(putEventStreamRequest);<NEW_LINE><MASK><NEW_LINE>awsRequestMetrics.startEvent(Field.ClientExecuteTime);<NEW_LINE>Request<PutEventStreamRequest> request = null;<NEW_LINE>Response<PutEventStreamResult> response = null;<NEW_LINE>try {<NEW_LINE>awsRequestMetrics.startEvent(Field.RequestMarshallTime);<NEW_LINE>try {<NEW_LINE>request = new PutEventStreamRequestMarshaller().marshall(putEventStreamRequest);<NEW_LINE>// Binds the request metrics to the current request.<NEW_LINE>request.setAWSRequestMetrics(awsRequestMetrics);<NEW_LINE>} finally {<NEW_LINE>awsRequestMetrics.endEvent(Field.RequestMarshallTime);<NEW_LINE>}<NEW_LINE>Unmarshaller<PutEventStreamResult, JsonUnmarshallerContext> unmarshaller = new PutEventStreamResultJsonUnmarshaller();<NEW_LINE>JsonResponseHandler<PutEventStreamResult> responseHandler = new JsonResponseHandler<PutEventStreamResult>(unmarshaller);<NEW_LINE>response = invoke(request, responseHandler, executionContext);<NEW_LINE>return response.getAwsResponse();<NEW_LINE>} finally {<NEW_LINE>awsRequestMetrics.endEvent(Field.ClientExecuteTime);<NEW_LINE>endClientExecution(awsRequestMetrics, request, response, LOGGING_AWS_REQUEST_METRIC);<NEW_LINE>}<NEW_LINE>} | AWSRequestMetrics awsRequestMetrics = executionContext.getAwsRequestMetrics(); |
1,401,235 | public static void waitForStatefulSetLabelsChange(String namespaceName, String statefulSetName, Map<String, String> labels) {<NEW_LINE>for (Map.Entry<String, String> entry : labels.entrySet()) {<NEW_LINE>boolean isK8sTag = entry.getKey().equals("controller-revision-hash") || entry.getKey().equals("statefulset.kubernetes.io/pod-name");<NEW_LINE>boolean isStrimziTag = entry.getKey(<MASK><NEW_LINE>// ignoring strimzi.io and k8s labels<NEW_LINE>if (!(isStrimziTag || isK8sTag)) {<NEW_LINE>LOGGER.info("Waiting for Stateful set label change {} -> {}", entry.getKey(), entry.getValue());<NEW_LINE>TestUtils.waitFor("Waits for StatefulSet label change " + entry.getKey() + " -> " + entry.getValue(), Constants.POLL_INTERVAL_FOR_RESOURCE_READINESS, Constants.GLOBAL_TIMEOUT, () -> kubeClient(namespaceName).getStatefulSet(namespaceName, statefulSetName).getMetadata().getLabels().get(entry.getKey()).equals(entry.getValue()));<NEW_LINE>}<NEW_LINE>}<NEW_LINE>} | ).startsWith(Labels.STRIMZI_DOMAIN); |
100,120 | private static void convertHeaders(HttpHeaders headers, MimeHeaders cHeaders) {<NEW_LINE>if (headers.isEmpty()) {<NEW_LINE>return;<NEW_LINE>}<NEW_LINE>for (Entry<AsciiString, String> e : headers) {<NEW_LINE>final <MASK><NEW_LINE>final String v = e.getValue();<NEW_LINE>if (k.isEmpty()) {<NEW_LINE>continue;<NEW_LINE>}<NEW_LINE>if (k.byteAt(0) != ':') {<NEW_LINE>final byte[] valueBytes = v.getBytes(StandardCharsets.US_ASCII);<NEW_LINE>cHeaders.addValue(k.array(), k.arrayOffset(), k.length()).setBytes(valueBytes, 0, valueBytes.length);<NEW_LINE>} else if (HttpHeaderNames.AUTHORITY.equals(k) && !headers.contains(HttpHeaderNames.HOST)) {<NEW_LINE>// Convert `:authority` to `host`.<NEW_LINE>final byte[] valueBytes = v.getBytes(StandardCharsets.US_ASCII);<NEW_LINE>cHeaders.addValue(HOST_BYTES, 0, HOST_BYTES.length).setBytes(valueBytes, 0, valueBytes.length);<NEW_LINE>}<NEW_LINE>}<NEW_LINE>} | AsciiString k = e.getKey(); |
1,772,772 | public void tag(int tagType2, boolean longTag3, byte[] contents2) throws IOException {<NEW_LINE>byte[] contents = contents2;<NEW_LINE>int length = (contents != null) ? contents.length : 0;<NEW_LINE>boolean longTag2 = (length > 62) || longTag3;<NEW_LINE>int hdr = (tagType2 << 6) <MASK><NEW_LINE>out.writeUI16(hdr);<NEW_LINE>if (longTag2) {<NEW_LINE>out.writeUI32(length);<NEW_LINE>}<NEW_LINE>if (contents != null) {<NEW_LINE>out.write(contents);<NEW_LINE>}<NEW_LINE>if (tagType2 == SWFConstants.TAG_SHOWFRAME) {<NEW_LINE>frameCount++;<NEW_LINE>}<NEW_LINE>if (tagType2 == SWFConstants.TAG_END) {<NEW_LINE>out.flush();<NEW_LINE>contents = bytes.toByteArray();<NEW_LINE>out = null;<NEW_LINE>bytes = null;<NEW_LINE>byte[] fc = OutStream.uintTo2Bytes(frameCount);<NEW_LINE>contents[2] = fc[0];<NEW_LINE>contents[3] = fc[1];<NEW_LINE>tags.tag(tagType, longTag, contents);<NEW_LINE>}<NEW_LINE>} | + (longTag2 ? 0x3f : length); |
909,566 | private void createButtonsPanel(JFileChooser fc) {<NEW_LINE>buttonPanel = new JPanel();<NEW_LINE>buttonPanel.setLayout(new BoxLayout(buttonPanel, BoxLayout.Y_AXIS));<NEW_LINE>approveButton = new JButton(getApproveButtonText(fc)) {<NEW_LINE><NEW_LINE>@Override<NEW_LINE>public Dimension getMaximumSize() {<NEW_LINE>return approveButton.getPreferredSize().width > cancelButton.getPreferredSize().width ? approveButton.getPreferredSize() : cancelButton.getPreferredSize();<NEW_LINE>}<NEW_LINE>};<NEW_LINE>// #107791: No mnemonics desirable on Mac<NEW_LINE>if (!Utilities.isMac()) {<NEW_LINE>approveButton.setMnemonic(getApproveButtonMnemonic(fc));<NEW_LINE>}<NEW_LINE>approveButton.addActionListener(getApproveSelectionAction());<NEW_LINE>approveButton.setToolTipText(getApproveButtonToolTipText(fc));<NEW_LINE>buttonPanel.add(Box.createRigidArea(verticalStrut1));<NEW_LINE>buttonPanel.add(approveButton);<NEW_LINE>buttonPanel.add<MASK><NEW_LINE>cancelButton = new JButton(cancelButtonText) {<NEW_LINE><NEW_LINE>@Override<NEW_LINE>public Dimension getMaximumSize() {<NEW_LINE>return approveButton.getPreferredSize().width > cancelButton.getPreferredSize().width ? approveButton.getPreferredSize() : cancelButton.getPreferredSize();<NEW_LINE>}<NEW_LINE>};<NEW_LINE>// #107791: No mnemonics desirable on Mac<NEW_LINE>if (!Utilities.isMac()) {<NEW_LINE>cancelButton.setMnemonic(cancelButtonMnemonic);<NEW_LINE>}<NEW_LINE>cancelButton.setToolTipText(cancelButtonToolTipText);<NEW_LINE>cancelButton.addActionListener(getCancelSelectionAction());<NEW_LINE>buttonPanel.add(cancelButton);<NEW_LINE>// TODO initial approve button disabled code started<NEW_LINE>if (customDirectoryProvider != null) {<NEW_LINE>approveButton.setEnabled(false);<NEW_LINE>}<NEW_LINE>// TODO initial approve button disabled code ended<NEW_LINE>} | (Box.createRigidArea(verticalStrut2)); |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.