idx int32 46 1.86M | input stringlengths 321 6.6k | target stringlengths 9 1.24k |
|---|---|---|
385,848 | public void migrateWithStorage(final String vmUuid, final long srcHostId, final long destHostId, final Map<Long, Long> volumeToPool) throws ResourceUnavailableException, ConcurrentOperationException {<NEW_LINE>final AsyncJobExecutionContext jobContext = AsyncJobExecutionContext.getCurrentExecutionContext();<NEW_LINE>if (jobContext.isJobDispatchedBy(VmWorkConstants.VM_WORK_JOB_DISPATCHER)) {<NEW_LINE>final VirtualMachine <MASK><NEW_LINE>VmWorkJobVO placeHolder = createPlaceHolderWork(vm.getId());<NEW_LINE>try {<NEW_LINE>orchestrateMigrateWithStorage(vmUuid, srcHostId, destHostId, volumeToPool);<NEW_LINE>} finally {<NEW_LINE>if (placeHolder != null) {<NEW_LINE>_workJobDao.expunge(placeHolder.getId());<NEW_LINE>}<NEW_LINE>}<NEW_LINE>} else {<NEW_LINE>final Outcome<VirtualMachine> outcome = migrateVmWithStorageThroughJobQueue(vmUuid, srcHostId, destHostId, volumeToPool);<NEW_LINE>retrieveVmFromJobOutcome(outcome, vmUuid, "migrateVmWithStorage");<NEW_LINE>try {<NEW_LINE>retrieveResultFromJobOutcomeAndThrowExceptionIfNeeded(outcome);<NEW_LINE>} catch (InsufficientCapacityException ex) {<NEW_LINE>throw new RuntimeException("Unexpected exception", ex);<NEW_LINE>}<NEW_LINE>}<NEW_LINE>} | vm = _vmDao.findByUuid(vmUuid); |
1,712,731 | private AggregationBuilder addHavingClause(Expression havingExpression, AggregationBuilder aggregationBuilder, EntityMetadata entityMetadata) {<NEW_LINE>if (havingExpression instanceof ComparisonExpression) {<NEW_LINE>Expression expression = ((ComparisonExpression) havingExpression).getLeftExpression();<NEW_LINE>if (!isAggregationExpression(expression)) {<NEW_LINE>logger.error("Having clause conditions over non metric aggregated are not supported.");<NEW_LINE>throw new UnsupportedOperationException("Currently, Having clause without Metric aggregations are not supported.");<NEW_LINE>}<NEW_LINE>return checkIfKeyExists(expression.toParsedText()) ? aggregationBuilder.subAggregation(getMetricsAggregation(expression, entityMetadata)) : aggregationBuilder;<NEW_LINE>} else if (havingExpression instanceof AndExpression) {<NEW_LINE>AndExpression andExpression = (AndExpression) havingExpression;<NEW_LINE>addHavingClause(andExpression.getLeftExpression(), aggregationBuilder, entityMetadata);<NEW_LINE>addHavingClause(andExpression.getRightExpression(), aggregationBuilder, entityMetadata);<NEW_LINE>return aggregationBuilder;<NEW_LINE>} else if (havingExpression instanceof OrExpression) {<NEW_LINE>OrExpression orExpression = (OrExpression) havingExpression;<NEW_LINE>addHavingClause(orExpression.<MASK><NEW_LINE>addHavingClause(orExpression.getRightExpression(), aggregationBuilder, entityMetadata);<NEW_LINE>return aggregationBuilder;<NEW_LINE>} else {<NEW_LINE>logger.error(havingExpression + "not supported in having clause.");<NEW_LINE>throw new UnsupportedOperationException(havingExpression + "not supported in having clause.");<NEW_LINE>}<NEW_LINE>} | getLeftExpression(), aggregationBuilder, entityMetadata); |
1,219,516 | /*<NEW_LINE>* (non-Javadoc)<NEW_LINE>*<NEW_LINE>* @see com.impetus.kundera.client.Client#findAll(java.lang.Class,<NEW_LINE>* java.lang.Object[])<NEW_LINE>*/<NEW_LINE>@Override<NEW_LINE>public <E> List<E> findAll(Class<E> entityClass, String[] columnsToSelect, Object... rowIds) {<NEW_LINE>EntityMetadata entityMetadata = KunderaMetadataManager.getEntityMetadata(kunderaMetadata, entityClass);<NEW_LINE>if (rowIds == null) {<NEW_LINE>return null;<NEW_LINE>}<NEW_LINE>List<E> results = new ArrayList<E>();<NEW_LINE>MetamodelImpl metaModel = (MetamodelImpl) kunderaMetadata.getApplicationMetadata().getMetamodel(entityMetadata.getPersistenceUnit());<NEW_LINE>EntityType entityType = metaModel.entity(entityClass);<NEW_LINE>List<AbstractManagedType> subManagedType = ((AbstractManagedType) entityType).getSubManagedType();<NEW_LINE>try {<NEW_LINE>if (!subManagedType.isEmpty()) {<NEW_LINE>for (AbstractManagedType subEntity : subManagedType) {<NEW_LINE>EntityMetadata subEntityMetadata = KunderaMetadataManager.getEntityMetadata(kunderaMetadata, subEntity.getJavaType());<NEW_LINE>results = handler.readAll(subEntityMetadata.getSchema(), subEntityMetadata.getEntityClazz(), subEntityMetadata, Arrays.asList(rowIds), subEntityMetadata.getRelationNames());<NEW_LINE>if (!results.isEmpty()) {<NEW_LINE>break;<NEW_LINE>}<NEW_LINE>}<NEW_LINE>} else {<NEW_LINE>results = handler.readAll(entityMetadata.getSchema(), entityMetadata.getEntityClazz(), entityMetadata, Arrays.asList(rowIds), entityMetadata.getRelationNames());<NEW_LINE>}<NEW_LINE>} catch (IOException ioex) {<NEW_LINE>log.error("Error during find All , Caused by: .", ioex);<NEW_LINE><MASK><NEW_LINE>}<NEW_LINE>return results;<NEW_LINE>} | throw new KunderaException("Error during find All , Caused by: .", ioex); |
1,621,869 | public void announce() throws AnnounceException {<NEW_LINE>Gitter gitter = context.getModel()<MASK><NEW_LINE>String message = "";<NEW_LINE>if (isNotBlank(gitter.getMessage())) {<NEW_LINE>message = gitter.getResolvedMessage(context);<NEW_LINE>} else {<NEW_LINE>Map<String, Object> props = new LinkedHashMap<>();<NEW_LINE>props.put(Constants.KEY_CHANGELOG, MustacheUtils.passThrough(context.getChangelog()));<NEW_LINE>context.getModel().getRelease().getGitService().fillProps(props, context.getModel());<NEW_LINE>message = gitter.getResolvedMessageTemplate(context, props);<NEW_LINE>}<NEW_LINE>context.getLogger().info("message: {}", message);<NEW_LINE>if (!context.isDryrun()) {<NEW_LINE>ClientUtils.webhook(context.getLogger(), gitter.getResolvedWebhook(), gitter.getConnectTimeout(), gitter.getReadTimeout(), Message.of(message));<NEW_LINE>}<NEW_LINE>} | .getAnnounce().getGitter(); |
1,062,016 | private void storeData(Job key, TileBitmap bitmap) {<NEW_LINE>OutputStream outputStream = null;<NEW_LINE>try {<NEW_LINE>File file = getOutputFile(key);<NEW_LINE>if (file == null) {<NEW_LINE>// if the file cannot be written, silently return<NEW_LINE>return;<NEW_LINE>}<NEW_LINE>outputStream = new FileOutputStream(file);<NEW_LINE>bitmap.compress(outputStream);<NEW_LINE>try {<NEW_LINE>lock.writeLock().lock();<NEW_LINE>if (this.lruCache.put(key.getKey(), file) != null) {<NEW_LINE>LOGGER.warning("overwriting cached entry: " + key.getKey());<NEW_LINE>}<NEW_LINE>} finally {<NEW_LINE>lock<MASK><NEW_LINE>}<NEW_LINE>} catch (Exception e) {<NEW_LINE>// we are catching now any exception and then disable the file cache<NEW_LINE>// this should ensure that no exception in the storage thread will<NEW_LINE>// ever crash the main app. If there is a runtime exception, the thread<NEW_LINE>// will exit (via destroy).<NEW_LINE>LOGGER.log(Level.SEVERE, "Disabling filesystem cache", e);<NEW_LINE>// most likely cause is that the disk is full, just disable the<NEW_LINE>// cache otherwise<NEW_LINE>// more and more exceptions will be thrown.<NEW_LINE>this.destroy();<NEW_LINE>try {<NEW_LINE>lock.writeLock().lock();<NEW_LINE>this.lruCache = new FileWorkingSetCache<String>(0);<NEW_LINE>} finally {<NEW_LINE>lock.writeLock().unlock();<NEW_LINE>}<NEW_LINE>} finally {<NEW_LINE>IOUtils.closeQuietly(outputStream);<NEW_LINE>}<NEW_LINE>} | .writeLock().unlock(); |
489,607 | final UpdateJobResult executeUpdateJob(UpdateJobRequest updateJobRequest) {<NEW_LINE>ExecutionContext executionContext = createExecutionContext(updateJobRequest);<NEW_LINE>AWSRequestMetrics awsRequestMetrics = executionContext.getAwsRequestMetrics();<NEW_LINE>awsRequestMetrics.startEvent(Field.ClientExecuteTime);<NEW_LINE>Request<UpdateJobRequest> request = null;<NEW_LINE>Response<UpdateJobResult> response = null;<NEW_LINE>try {<NEW_LINE>awsRequestMetrics.startEvent(Field.RequestMarshallTime);<NEW_LINE>try {<NEW_LINE>request = new UpdateJobRequestProtocolMarshaller(protocolFactory).marshall(super.beforeMarshalling(updateJobRequest));<NEW_LINE>// Binds the request metrics to the current request.<NEW_LINE>request.setAWSRequestMetrics(awsRequestMetrics);<NEW_LINE>request.addHandlerContext(HandlerContextKey.CLIENT_ENDPOINT, endpoint);<NEW_LINE>request.addHandlerContext(HandlerContextKey.ENDPOINT_OVERRIDDEN, isEndpointOverridden());<NEW_LINE>request.addHandlerContext(HandlerContextKey.SIGNING_REGION, getSigningRegion());<NEW_LINE>request.addHandlerContext(HandlerContextKey.SERVICE_ID, "IoT");<NEW_LINE>request.addHandlerContext(HandlerContextKey.OPERATION_NAME, "UpdateJob");<NEW_LINE>request.addHandlerContext(HandlerContextKey.ADVANCED_CONFIG, advancedConfig);<NEW_LINE>} finally {<NEW_LINE>awsRequestMetrics.endEvent(Field.RequestMarshallTime);<NEW_LINE>}<NEW_LINE>HttpResponseHandler<AmazonWebServiceResponse<UpdateJobResult>> responseHandler = protocolFactory.createResponseHandler(new JsonOperationMetadata().withPayloadJson(true).withHasStreamingSuccessResponse(false), new UpdateJobResultJsonUnmarshaller());<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); |
785,238 | private static void printTables(final DragstrParams params, final PrintWriter printWriter) {<NEW_LINE>final StringBuilder lineBuilder = new StringBuilder(LINE_BUILDER_BUFFER_SIZE);<NEW_LINE>lineBuilder.append(String.format("%5s", "1"));<NEW_LINE>for (int i = 2; i <= params.maximumRepeats(); i++) {<NEW_LINE>lineBuilder.append(" ");<NEW_LINE>lineBuilder.append(String.format("%5s", i));<NEW_LINE>}<NEW_LINE>printWriter.<MASK><NEW_LINE>printTable(printWriter, lineBuilder, GOP_TABLE_NAME, params.maximumPeriod(), params.maximumRepeats(), params::gop);<NEW_LINE>printTable(printWriter, lineBuilder, GCP_TABLE_NAME, params.maximumPeriod(), params.maximumRepeats(), params::gcp);<NEW_LINE>printTable(printWriter, lineBuilder, API_TABLE_NAME, params.maximumPeriod(), params.maximumRepeats(), params::api);<NEW_LINE>} | println(lineBuilder.toString()); |
372,296 | public void marshall(CreateInstancesRequest createInstancesRequest, ProtocolMarshaller protocolMarshaller) {<NEW_LINE>if (createInstancesRequest == null) {<NEW_LINE>throw new SdkClientException("Invalid argument passed to marshall(...)");<NEW_LINE>}<NEW_LINE>try {<NEW_LINE>protocolMarshaller.marshall(<MASK><NEW_LINE>protocolMarshaller.marshall(createInstancesRequest.getAvailabilityZone(), AVAILABILITYZONE_BINDING);<NEW_LINE>protocolMarshaller.marshall(createInstancesRequest.getCustomImageName(), CUSTOMIMAGENAME_BINDING);<NEW_LINE>protocolMarshaller.marshall(createInstancesRequest.getBlueprintId(), BLUEPRINTID_BINDING);<NEW_LINE>protocolMarshaller.marshall(createInstancesRequest.getBundleId(), BUNDLEID_BINDING);<NEW_LINE>protocolMarshaller.marshall(createInstancesRequest.getUserData(), USERDATA_BINDING);<NEW_LINE>protocolMarshaller.marshall(createInstancesRequest.getKeyPairName(), KEYPAIRNAME_BINDING);<NEW_LINE>protocolMarshaller.marshall(createInstancesRequest.getTags(), TAGS_BINDING);<NEW_LINE>protocolMarshaller.marshall(createInstancesRequest.getAddOns(), ADDONS_BINDING);<NEW_LINE>protocolMarshaller.marshall(createInstancesRequest.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>} | createInstancesRequest.getInstanceNames(), INSTANCENAMES_BINDING); |
532,599 | private int adjust(boolean use_outer_taps) {<NEW_LINE>int p1 = minus128(this.p1);<NEW_LINE>int <MASK><NEW_LINE>int q0 = minus128(this.q0);<NEW_LINE>int q1 = minus128(this.q1);<NEW_LINE>short a = CommonUtils.byteClamp((short) ((use_outer_taps ? CommonUtils.byteClamp((short) (p1 - q1)) : 0) + 3 * (q0 - p0)));<NEW_LINE>short b = (short) ((CommonUtils.byteClamp((short) (a + 3)) >> 3));<NEW_LINE>a = (short) (CommonUtils.byteClamp((short) (a + 4)) >> 3);<NEW_LINE>this.q0 = clipPlus128((short) (q0 - a));<NEW_LINE>this.p0 = clipPlus128((short) (p0 + b));<NEW_LINE>return a;<NEW_LINE>} | p0 = minus128(this.p0); |
402,618 | public void enable() {<NEW_LINE>logger.debug("{} enable called on RemoteSwitchB", LoggerConstants.TFINIT);<NEW_LINE>minValue = BigDecimal.ZERO;<NEW_LINE>maxValue = new BigDecimal("15");<NEW_LINE>if (tfConfig != null) {<NEW_LINE>if (tfConfig.eIsSet(tfConfig.eClass().getEStructuralFeature("address"))) {<NEW_LINE>setAddress(tfConfig.getAddress());<NEW_LINE>} else {<NEW_LINE>logger.error("{} address not configured for subid {}", LoggerConstants.TFINITSUB, getSubId());<NEW_LINE>throw new RuntimeException("address not configured for subid " + getSubId());<NEW_LINE>}<NEW_LINE>if (tfConfig.eIsSet(tfConfig.eClass().getEStructuralFeature("unit"))) {<NEW_LINE><MASK><NEW_LINE>} else {<NEW_LINE>logger.error("{} unit not configured for subid {}", LoggerConstants.TFINITSUB, getSubId());<NEW_LINE>throw new RuntimeException("unit not configured for subid " + getSubId());<NEW_LINE>}<NEW_LINE>if (tfConfig.eIsSet(tfConfig.eClass().getEStructuralFeature("repeats"))) {<NEW_LINE>setRepeats(tfConfig.getRepeats());<NEW_LINE>}<NEW_LINE>}<NEW_LINE>tinkerforgeDevice = getMbrick().getTinkerforgeDevice();<NEW_LINE>if (getRepeats() != null) {<NEW_LINE>try {<NEW_LINE>tinkerforgeDevice.setRepeats(getRepeats());<NEW_LINE>} catch (TimeoutException e) {<NEW_LINE>TinkerforgeErrorHandler.handleError(this, TinkerforgeErrorHandler.TF_TIMEOUT_EXCEPTION, e);<NEW_LINE>} catch (NotConnectedException e) {<NEW_LINE>TinkerforgeErrorHandler.handleError(this, TinkerforgeErrorHandler.TF_NOT_CONNECTION_EXCEPTION, e);<NEW_LINE>}<NEW_LINE>}<NEW_LINE>} | setUnit(tfConfig.getUnit()); |
129,942 | public static DescribeRdsPerformanceSummaryResponse unmarshall(DescribeRdsPerformanceSummaryResponse describeRdsPerformanceSummaryResponse, UnmarshallerContext _ctx) {<NEW_LINE>describeRdsPerformanceSummaryResponse.setRequestId(_ctx.stringValue("DescribeRdsPerformanceSummaryResponse.RequestId"));<NEW_LINE>describeRdsPerformanceSummaryResponse.setSuccess(_ctx.booleanValue("DescribeRdsPerformanceSummaryResponse.Success"));<NEW_LINE>List<RdsPerformanceInfo> rdsPerformanceInfos = new ArrayList<RdsPerformanceInfo>();<NEW_LINE>for (int i = 0; i < _ctx.lengthValue("DescribeRdsPerformanceSummaryResponse.RdsPerformanceInfos.Length"); i++) {<NEW_LINE>RdsPerformanceInfo rdsPerformanceInfo = new RdsPerformanceInfo();<NEW_LINE>rdsPerformanceInfo.setRdsId(_ctx.stringValue("DescribeRdsPerformanceSummaryResponse.RdsPerformanceInfos[" + i + "].RdsId"));<NEW_LINE>rdsPerformanceInfo.setCpu(_ctx.floatValue("DescribeRdsPerformanceSummaryResponse.RdsPerformanceInfos[" + i + "].Cpu"));<NEW_LINE>rdsPerformanceInfo.setIops(_ctx.floatValue<MASK><NEW_LINE>rdsPerformanceInfo.setActiveSessions(_ctx.integerValue("DescribeRdsPerformanceSummaryResponse.RdsPerformanceInfos[" + i + "].ActiveSessions"));<NEW_LINE>rdsPerformanceInfo.setTotalSessions(_ctx.integerValue("DescribeRdsPerformanceSummaryResponse.RdsPerformanceInfos[" + i + "].TotalSessions"));<NEW_LINE>rdsPerformanceInfo.setSpaceUsage(_ctx.longValue("DescribeRdsPerformanceSummaryResponse.RdsPerformanceInfos[" + i + "].SpaceUsage"));<NEW_LINE>rdsPerformanceInfos.add(rdsPerformanceInfo);<NEW_LINE>}<NEW_LINE>describeRdsPerformanceSummaryResponse.setRdsPerformanceInfos(rdsPerformanceInfos);<NEW_LINE>return describeRdsPerformanceSummaryResponse;<NEW_LINE>} | ("DescribeRdsPerformanceSummaryResponse.RdsPerformanceInfos[" + i + "].Iops")); |
84,165 | public static DAVProperties findStartingProperties(DAVConnection connection, DAVRepository repos, String fullPath) throws SVNException {<NEW_LINE>DAVProperties props = null;<NEW_LINE>String originalPath = fullPath;<NEW_LINE>String loppedPath = "";<NEW_LINE>if ("".equals(fullPath)) {<NEW_LINE>props = getStartingProperties(connection, fullPath, null);<NEW_LINE>if (props != null) {<NEW_LINE>if (props.getPropertyValue(DAVElement.REPOSITORY_UUID) != null && repos != null) {<NEW_LINE>repos.setRepositoryUUID(props.getPropertyValue(DAVElement<MASK><NEW_LINE>}<NEW_LINE>props.setLoppedPath(loppedPath);<NEW_LINE>}<NEW_LINE>return props;<NEW_LINE>}<NEW_LINE>while (!"".equals(fullPath)) {<NEW_LINE>SVNErrorMessage err = null;<NEW_LINE>SVNException nested = null;<NEW_LINE>try {<NEW_LINE>props = getStartingProperties(connection, fullPath, null);<NEW_LINE>} catch (SVNException e) {<NEW_LINE>if (e.getErrorMessage() == null) {<NEW_LINE>throw e;<NEW_LINE>}<NEW_LINE>err = e.getErrorMessage();<NEW_LINE>}<NEW_LINE>if (err == null) {<NEW_LINE>break;<NEW_LINE>}<NEW_LINE>if (err.getErrorCode() != SVNErrorCode.FS_NOT_FOUND) {<NEW_LINE>SVNErrorManager.error(err, SVNLogType.NETWORK);<NEW_LINE>}<NEW_LINE>loppedPath = SVNPathUtil.append(SVNPathUtil.tail(fullPath), loppedPath);<NEW_LINE>int length = fullPath.length();<NEW_LINE>fullPath = SVNPathUtil.removeTail(fullPath);<NEW_LINE>// will return "" for "/dir", hack it here, to make sure we're not missing root.<NEW_LINE>// we assume full path always starts with "/".<NEW_LINE>if (length > 1 && "".equals(fullPath)) {<NEW_LINE>fullPath = "/";<NEW_LINE>}<NEW_LINE>if (length == fullPath.length()) {<NEW_LINE>SVNErrorMessage err2 = SVNErrorMessage.create(err.getErrorCode(), "The path was not part of repository");<NEW_LINE>SVNErrorManager.error(err2, err, nested, SVNLogType.NETWORK);<NEW_LINE>}<NEW_LINE>}<NEW_LINE>if ("".equals(fullPath)) {<NEW_LINE>SVNErrorMessage err = SVNErrorMessage.create(SVNErrorCode.RA_ILLEGAL_URL, "No part of path ''{0}'' was found in repository HEAD", originalPath);<NEW_LINE>SVNErrorManager.error(err, SVNLogType.NETWORK);<NEW_LINE>}<NEW_LINE>if (props != null) {<NEW_LINE>if (props.getPropertyValue(DAVElement.REPOSITORY_UUID) != null && repos != null) {<NEW_LINE>repos.setRepositoryUUID(props.getPropertyValue(DAVElement.REPOSITORY_UUID).getString());<NEW_LINE>}<NEW_LINE>if (props.getPropertyValue(DAVElement.BASELINE_RELATIVE_PATH) != null && repos != null) {<NEW_LINE>String relativePath = props.getPropertyValue(DAVElement.BASELINE_RELATIVE_PATH).getString();<NEW_LINE>relativePath = SVNEncodingUtil.uriEncode(syncRelativePathWithFullPath(fullPath, relativePath));<NEW_LINE>String rootPath = fullPath.substring(0, fullPath.length() - relativePath.length());<NEW_LINE>repos.setRepositoryRoot(repos.getLocation().setPath(rootPath, true));<NEW_LINE>}<NEW_LINE>props.setLoppedPath(loppedPath);<NEW_LINE>}<NEW_LINE>return props;<NEW_LINE>} | .REPOSITORY_UUID).getString()); |
1,484,449 | private void validateSlaPolicy(TaskConfig config, int instanceCount) throws TaskDescriptionException {<NEW_LINE>if (config.isSetSlaPolicy()) {<NEW_LINE>if (!(settings.slaAwareKillNonProd || tierManager.getTier(ITaskConfig.build(config)).isProduction())) {<NEW_LINE>throw new TaskDescriptionException(String.format("Tier '%s' does not support SlaPolicy.", config.getTier()));<NEW_LINE>}<NEW_LINE><MASK><NEW_LINE>if (!slaPolicy.isSetCoordinatorSlaPolicy() && instanceCount < settings.minRequiredInstances) {<NEW_LINE>throw new TaskDescriptionException(String.format("Job with fewer than %d instances cannot have Percentage/Count SlaPolicy.", settings.minRequiredInstances));<NEW_LINE>}<NEW_LINE>if (slaPolicy.isSetCountSlaPolicy()) {<NEW_LINE>validateCountSlaPolicy(instanceCount, slaPolicy.getCountSlaPolicy());<NEW_LINE>}<NEW_LINE>if (slaPolicy.isSetPercentageSlaPolicy()) {<NEW_LINE>validatePercentageSlaPolicy(instanceCount, slaPolicy.getPercentageSlaPolicy());<NEW_LINE>}<NEW_LINE>}<NEW_LINE>} | SlaPolicy slaPolicy = config.getSlaPolicy(); |
1,419,618 | final CreateCaseResult executeCreateCase(CreateCaseRequest createCaseRequest) {<NEW_LINE>ExecutionContext executionContext = createExecutionContext(createCaseRequest);<NEW_LINE>AWSRequestMetrics awsRequestMetrics = executionContext.getAwsRequestMetrics();<NEW_LINE><MASK><NEW_LINE>Request<CreateCaseRequest> request = null;<NEW_LINE>Response<CreateCaseResult> response = null;<NEW_LINE>try {<NEW_LINE>awsRequestMetrics.startEvent(Field.RequestMarshallTime);<NEW_LINE>try {<NEW_LINE>request = new CreateCaseRequestProtocolMarshaller(protocolFactory).marshall(super.beforeMarshalling(createCaseRequest));<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, "Support");<NEW_LINE>request.addHandlerContext(HandlerContextKey.OPERATION_NAME, "CreateCase");<NEW_LINE>request.addHandlerContext(HandlerContextKey.ADVANCED_CONFIG, advancedConfig);<NEW_LINE>} finally {<NEW_LINE>awsRequestMetrics.endEvent(Field.RequestMarshallTime);<NEW_LINE>}<NEW_LINE>HttpResponseHandler<AmazonWebServiceResponse<CreateCaseResult>> responseHandler = protocolFactory.createResponseHandler(new JsonOperationMetadata().withPayloadJson(true).withHasStreamingSuccessResponse(false), new CreateCaseResultJsonUnmarshaller());<NEW_LINE>response = invoke(request, responseHandler, executionContext);<NEW_LINE>return response.getAwsResponse();<NEW_LINE>} finally {<NEW_LINE>endClientExecution(awsRequestMetrics, request, response);<NEW_LINE>}<NEW_LINE>} | awsRequestMetrics.startEvent(Field.ClientExecuteTime); |
1,711,131 | public static <T, R> Future<R> tailRec(T initial, Function<? super T, ? extends Future<? extends Either<T, R>>> fn) {<NEW_LINE>SimpleReact sr = SequentialElasticPools.simpleReact.nextReactor();<NEW_LINE>return Future.of(() -> {<NEW_LINE>Future<? extends Either<T, R>>[] next = new Future[1];<NEW_LINE>next[0] = Future.ofResult(Either.left(initial));<NEW_LINE>boolean cont = true;<NEW_LINE>do {<NEW_LINE>cont = next[0].fold(p -> p.fold(s -> {<NEW_LINE>next[0] = Future.narrowK<MASK><NEW_LINE>return true;<NEW_LINE>}, pr -> false), () -> false);<NEW_LINE>} while (cont);<NEW_LINE>return next[0].map(x -> x.orElse(null));<NEW_LINE>}, sr.getExecutor()).flatMap(i -> i).peek(e -> SequentialElasticPools.simpleReact.populate(sr)).recover(t -> {<NEW_LINE>SequentialElasticPools.simpleReact.populate(sr);<NEW_LINE>throw ExceptionSoftener.throwSoftenedException(t);<NEW_LINE>});<NEW_LINE>} | (fn.apply(s)); |
155,164 | public int findLengthOfShortestSubarray(int[] arr) {<NEW_LINE>int n = arr.length;<NEW_LINE>int left = 0;<NEW_LINE>while (left + 1 < n && arr[left] <= arr[left + 1]) {<NEW_LINE>left++;<NEW_LINE>}<NEW_LINE>if (left == n - 1) {<NEW_LINE>return 0;<NEW_LINE>}<NEW_LINE>int right = n - 1;<NEW_LINE>while (right > 0 && arr[right - 1] <= arr[right]) {<NEW_LINE>right--;<NEW_LINE>}<NEW_LINE>int res = Math.min(n - left - 1, right);<NEW_LINE><MASK><NEW_LINE>while (i <= left && j <= n - 1) {<NEW_LINE>if (arr[i] <= arr[j]) {<NEW_LINE>res = Math.min(res, j - i - 1);<NEW_LINE>i++;<NEW_LINE>} else {<NEW_LINE>j++;<NEW_LINE>}<NEW_LINE>}<NEW_LINE>return res;<NEW_LINE>} | int i = 0, j = right; |
201,059 | List<File> storeContractsAsFiles(String path, String fqn, String outputPath) {<NEW_LINE>try {<NEW_LINE>log.info("Input path [{}]", path);<NEW_LINE>log.info("FQN of the converter [{}]", fqn);<NEW_LINE><MASK><NEW_LINE>Collection<Contract> contracts = collectContractDescriptors(new File(path));<NEW_LINE>log.info("Found [{}] contract definition", contracts.size());<NEW_LINE>Class<?> name = Class.forName(fqn);<NEW_LINE>ContractConverter<Collection> contractConverter = (ContractConverter) name.getDeclaredConstructors()[0].newInstance();<NEW_LINE>Collection converted = contractConverter.convertTo(contracts);<NEW_LINE>log.info("Successfully converted contracts definitions");<NEW_LINE>Map<String, byte[]> stored = contractConverter.store(converted);<NEW_LINE>File outputFolder = new File(outputPath);<NEW_LINE>outputFolder.mkdirs();<NEW_LINE>int i = 1;<NEW_LINE>Set<Map.Entry<String, byte[]>> entries = stored.entrySet();<NEW_LINE>log.info("Will convert [{}] contracts", entries.size());<NEW_LINE>List<File> files = new ArrayList<>();<NEW_LINE>for (Map.Entry<String, byte[]> entry : entries) {<NEW_LINE>File outputFile = new File(outputFolder, entry.getKey());<NEW_LINE>Files.write(outputFile.toPath(), entry.getValue());<NEW_LINE>log.info("[{}/{}] Successfully stored [{}]", i, entries.size(), outputFile.getName());<NEW_LINE>files.add(outputFile);<NEW_LINE>}<NEW_LINE>return files;<NEW_LINE>} catch (Exception ex) {<NEW_LINE>throw new IllegalStateException(ex);<NEW_LINE>}<NEW_LINE>} | log.info("Output path [{}]", outputPath); |
756,383 | public void updateOffset() {<NEW_LINE>float width = getWidth();<NEW_LINE>float height = getHeight();<NEW_LINE>float localX2 = width / 2;<NEW_LINE>float localY2 = height / 2;<NEW_LINE>float localX = -localX2;<NEW_LINE>float localY = -localY2;<NEW_LINE>if (region instanceof AtlasRegion) {<NEW_LINE>AtlasRegion region = (AtlasRegion) this.region;<NEW_LINE>localX += region.offsetX / region.originalWidth * width;<NEW_LINE>localY += region.offsetY / region.originalHeight * height;<NEW_LINE>if (region.degrees == 90) {<NEW_LINE>localX2 -= (region.originalWidth - region.offsetX - region.packedHeight) / region.originalWidth * width;<NEW_LINE>localY2 -= (region.originalHeight - region.offsetY - region.packedWidth) / region.originalHeight * height;<NEW_LINE>} else {<NEW_LINE>localX2 -= (region.originalWidth - region.offsetX - region.packedWidth) / region.originalWidth * width;<NEW_LINE>localY2 -= (region.originalHeight - region.offsetY - region.packedHeight) / region.originalHeight * height;<NEW_LINE>}<NEW_LINE>}<NEW_LINE>float scaleX = getScaleX();<NEW_LINE>float scaleY = getScaleY();<NEW_LINE>localX *= scaleX;<NEW_LINE>localY *= scaleY;<NEW_LINE>localX2 *= scaleX;<NEW_LINE>localY2 *= scaleY;<NEW_LINE>float rotation = getRotation();<NEW_LINE>float cos = (float) Math.cos(degRad * rotation);<NEW_LINE>float sin = (float) Math.sin(degRad * rotation);<NEW_LINE>float x = getX();<NEW_LINE>float y = getY();<NEW_LINE>float localXCos = localX * cos + x;<NEW_LINE>float localXSin = localX * sin;<NEW_LINE>float localYCos = localY * cos + y;<NEW_LINE>float localYSin = localY * sin;<NEW_LINE>float localX2Cos = localX2 * cos + x;<NEW_LINE>float localX2Sin = localX2 * sin;<NEW_LINE>float localY2Cos = localY2 * cos + y;<NEW_LINE>float localY2Sin = localY2 * sin;<NEW_LINE>float[] offset = this.offset;<NEW_LINE>offset[BLX] = localXCos - localYSin;<NEW_LINE>offset[BLY] = localYCos + localXSin;<NEW_LINE>offset[ULX] = localXCos - localY2Sin;<NEW_LINE><MASK><NEW_LINE>offset[URX] = localX2Cos - localY2Sin;<NEW_LINE>offset[URY] = localY2Cos + localX2Sin;<NEW_LINE>offset[BRX] = localX2Cos - localYSin;<NEW_LINE>offset[BRY] = localYCos + localX2Sin;<NEW_LINE>} | offset[ULY] = localY2Cos + localXSin; |
1,819,581 | final UpdateQueueHoursOfOperationResult executeUpdateQueueHoursOfOperation(UpdateQueueHoursOfOperationRequest updateQueueHoursOfOperationRequest) {<NEW_LINE>ExecutionContext executionContext = createExecutionContext(updateQueueHoursOfOperationRequest);<NEW_LINE>AWSRequestMetrics awsRequestMetrics = executionContext.getAwsRequestMetrics();<NEW_LINE>awsRequestMetrics.startEvent(Field.ClientExecuteTime);<NEW_LINE>Request<UpdateQueueHoursOfOperationRequest> request = null;<NEW_LINE>Response<UpdateQueueHoursOfOperationResult> response = null;<NEW_LINE>try {<NEW_LINE>awsRequestMetrics.startEvent(Field.RequestMarshallTime);<NEW_LINE>try {<NEW_LINE>request = new UpdateQueueHoursOfOperationRequestProtocolMarshaller(protocolFactory).marshall(super.beforeMarshalling(updateQueueHoursOfOperationRequest));<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, "Connect");<NEW_LINE>request.addHandlerContext(HandlerContextKey.OPERATION_NAME, "UpdateQueueHoursOfOperation");<NEW_LINE>request.addHandlerContext(HandlerContextKey.ADVANCED_CONFIG, advancedConfig);<NEW_LINE>} finally {<NEW_LINE>awsRequestMetrics.endEvent(Field.RequestMarshallTime);<NEW_LINE>}<NEW_LINE>HttpResponseHandler<AmazonWebServiceResponse<UpdateQueueHoursOfOperationResult>> responseHandler = protocolFactory.createResponseHandler(new JsonOperationMetadata().withPayloadJson(true).withHasStreamingSuccessResponse(false), new UpdateQueueHoursOfOperationResultJsonUnmarshaller());<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()); |
46,609 | public static ListRecordingOfDualTrackResponse unmarshall(ListRecordingOfDualTrackResponse listRecordingOfDualTrackResponse, UnmarshallerContext context) {<NEW_LINE>listRecordingOfDualTrackResponse.setRequestId(context.stringValue("ListRecordingOfDualTrackResponse.RequestId"));<NEW_LINE>listRecordingOfDualTrackResponse.setSuccess(context.booleanValue("ListRecordingOfDualTrackResponse.Success"));<NEW_LINE>listRecordingOfDualTrackResponse.setCode(context.stringValue("ListRecordingOfDualTrackResponse.Code"));<NEW_LINE>listRecordingOfDualTrackResponse.setMessage(context.stringValue("ListRecordingOfDualTrackResponse.Message"));<NEW_LINE>listRecordingOfDualTrackResponse.setHttpStatusCode(context.integerValue("ListRecordingOfDualTrackResponse.HttpStatusCode"));<NEW_LINE>Recordings recordings = new Recordings();<NEW_LINE>recordings.setTotalCount(context.integerValue("ListRecordingOfDualTrackResponse.Recordings.TotalCount"));<NEW_LINE>recordings.setPageNumber(context.integerValue("ListRecordingOfDualTrackResponse.Recordings.PageNumber"));<NEW_LINE>recordings.setPageSize(context.integerValue("ListRecordingOfDualTrackResponse.Recordings.PageSize"));<NEW_LINE>List<Recording> list = new ArrayList<Recording>();<NEW_LINE>for (int i = 0; i < context.lengthValue("ListRecordingOfDualTrackResponse.Recordings.List.Length"); i++) {<NEW_LINE>Recording recording = new Recording();<NEW_LINE>recording.setContactId(context.stringValue("ListRecordingOfDualTrackResponse.Recordings.List[" + i + "].ContactId"));<NEW_LINE>recording.setContactType(context.stringValue("ListRecordingOfDualTrackResponse.Recordings.List[" + i + "].ContactType"));<NEW_LINE>recording.setAgentId(context.stringValue("ListRecordingOfDualTrackResponse.Recordings.List[" + i + "].AgentId"));<NEW_LINE>recording.setAgentName(context.stringValue("ListRecordingOfDualTrackResponse.Recordings.List[" + i + "].AgentName"));<NEW_LINE>recording.setCallingNumber(context.stringValue("ListRecordingOfDualTrackResponse.Recordings.List[" + i + "].CallingNumber"));<NEW_LINE>recording.setCalledNumber(context.stringValue("ListRecordingOfDualTrackResponse.Recordings.List[" + i + "].CalledNumber"));<NEW_LINE>recording.setStartTime(context.longValue("ListRecordingOfDualTrackResponse.Recordings.List[" + i + "].StartTime"));<NEW_LINE>recording.setDuration(context.integerValue("ListRecordingOfDualTrackResponse.Recordings.List[" + i + "].Duration"));<NEW_LINE>recording.setFileName(context.stringValue("ListRecordingOfDualTrackResponse.Recordings.List[" + i + "].FileName"));<NEW_LINE>recording.setFilePath(context.stringValue<MASK><NEW_LINE>recording.setFileDescription(context.stringValue("ListRecordingOfDualTrackResponse.Recordings.List[" + i + "].FileDescription"));<NEW_LINE>recording.setChannel(context.stringValue("ListRecordingOfDualTrackResponse.Recordings.List[" + i + "].Channel"));<NEW_LINE>recording.setInstanceId(context.stringValue("ListRecordingOfDualTrackResponse.Recordings.List[" + i + "].InstanceId"));<NEW_LINE>list.add(recording);<NEW_LINE>}<NEW_LINE>recordings.setList(list);<NEW_LINE>listRecordingOfDualTrackResponse.setRecordings(recordings);<NEW_LINE>return listRecordingOfDualTrackResponse;<NEW_LINE>} | ("ListRecordingOfDualTrackResponse.Recordings.List[" + i + "].FilePath")); |
27,859 | private Mono<Response<Flux<ByteBuffer>>> deleteWithResponseAsync(String resourceGroupName, String policyName, Context context) {<NEW_LINE>if (this.client.getEndpoint() == null) {<NEW_LINE>return Mono.error(new IllegalArgumentException("Parameter this.client.getEndpoint() is required and cannot be null."));<NEW_LINE>}<NEW_LINE>if (resourceGroupName == null) {<NEW_LINE>return Mono.error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null."));<NEW_LINE>}<NEW_LINE>if (policyName == null) {<NEW_LINE>return Mono.error(new IllegalArgumentException("Parameter policyName is required and cannot be null."));<NEW_LINE>}<NEW_LINE>if (this.client.getSubscriptionId() == null) {<NEW_LINE>return Mono.error(new IllegalArgumentException("Parameter this.client.getSubscriptionId() is required and cannot be null."));<NEW_LINE>}<NEW_LINE>final String apiVersion = "2020-11-01";<NEW_LINE>context = this.client.mergeContext(context);<NEW_LINE>return service.delete(this.client.getEndpoint(), resourceGroupName, policyName, this.client.<MASK><NEW_LINE>} | getSubscriptionId(), apiVersion, context); |
1,372,933 | final DeleteJobTaggingResult executeDeleteJobTagging(DeleteJobTaggingRequest deleteJobTaggingRequest) {<NEW_LINE>ExecutionContext executionContext = createExecutionContext(deleteJobTaggingRequest);<NEW_LINE>AWSRequestMetrics awsRequestMetrics = executionContext.getAwsRequestMetrics();<NEW_LINE>awsRequestMetrics.startEvent(Field.ClientExecuteTime);<NEW_LINE>Request<DeleteJobTaggingRequest> request = null;<NEW_LINE>Response<DeleteJobTaggingResult> response = null;<NEW_LINE>try {<NEW_LINE>awsRequestMetrics.startEvent(Field.RequestMarshallTime);<NEW_LINE>try {<NEW_LINE>request = new DeleteJobTaggingRequestMarshaller().marshall(super.beforeMarshalling(deleteJobTaggingRequest));<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.<MASK><NEW_LINE>request.addHandlerContext(HandlerContextKey.OPERATION_NAME, "DeleteJobTagging");<NEW_LINE>request.addHandlerContext(HandlerContextKey.ADVANCED_CONFIG, advancedConfig);<NEW_LINE>} finally {<NEW_LINE>awsRequestMetrics.endEvent(Field.RequestMarshallTime);<NEW_LINE>}<NEW_LINE>URI endpointTraitHost = null;<NEW_LINE>if (!clientConfiguration.isDisableHostPrefixInjection()) {<NEW_LINE>ValidationUtils.assertStringNotEmpty(deleteJobTaggingRequest.getAccountId(), "AccountId");<NEW_LINE>HostnameValidator.validateHostnameCompliant(deleteJobTaggingRequest.getAccountId(), "AccountId", "deleteJobTaggingRequest");<NEW_LINE>String hostPrefix = "{AccountId}.";<NEW_LINE>String resolvedHostPrefix = String.format("%s.", deleteJobTaggingRequest.getAccountId());<NEW_LINE>endpointTraitHost = UriResourcePathUtils.updateUriHost(endpoint, resolvedHostPrefix);<NEW_LINE>}<NEW_LINE>StaxResponseHandler<DeleteJobTaggingResult> responseHandler = new com.amazonaws.services.s3control.internal.S3ControlStaxResponseHandler<DeleteJobTaggingResult>(new DeleteJobTaggingResultStaxUnmarshaller());<NEW_LINE>response = invoke(request, responseHandler, executionContext, null, endpointTraitHost);<NEW_LINE>return response.getAwsResponse();<NEW_LINE>} finally {<NEW_LINE>endClientExecution(awsRequestMetrics, request, response);<NEW_LINE>}<NEW_LINE>} | addHandlerContext(HandlerContextKey.SERVICE_ID, "S3 Control"); |
316,856 | private void recordMovieData(int indexX, int indexY) {<NEW_LINE>Paint paint;<NEW_LINE>int posX = indexY * gridWidth + indexY * gridWidthMargin;<NEW_LINE>int posY = rectBoundsHorizontalOffset + indexX * (gridHeight + gridHeightMargin + titleHeight + titleMargin);<NEW_LINE>// Draw title<NEW_LINE>if (indexY == 0) {<NEW_LINE>String category = categories.get(indexX);<NEW_LINE>// Get text bounds rectangle.<NEW_LINE>Rect textRect = new Rect();<NEW_LINE>Rect textBoundsRect = new Rect();<NEW_LINE>textPaint.getTextBounds(category, 0, category.length(), textRect);<NEW_LINE>textBoundsRect.left = posX;<NEW_LINE>textBoundsRect.right = textBoundsRect.left + textRect.width() + textBoundsVerticalOffset;<NEW_LINE>textBoundsRect.bottom = posY + textBoundsHorizontalOffset;<NEW_LINE>textBoundsRect.top = textBoundsRect.bottom - textRect.height();<NEW_LINE>recordTitleRect(textBoundsRect, textPaint, category);<NEW_LINE>}<NEW_LINE>// Draw Rect<NEW_LINE>Rect rect;<NEW_LINE>if (rectList.size() > indexX && rectList.get(indexX).size() > indexY) {<NEW_LINE>paint = rectList.get(indexX).get(indexY).paint;<NEW_LINE>rect = rectList.get(indexX<MASK><NEW_LINE>} else {<NEW_LINE>paint = new Paint(Paint.ANTI_ALIAS_FLAG);<NEW_LINE>paint.setColor(rectColor);<NEW_LINE>rect = new Rect();<NEW_LINE>rect.left = posX;<NEW_LINE>rect.right = rect.left + gridWidth;<NEW_LINE>rect.top = posY + titleHeight + titleMargin;<NEW_LINE>rect.bottom = rect.top + gridHeight;<NEW_LINE>}<NEW_LINE>recordDrawedRect(rect, paint, indexX, indexY);<NEW_LINE>} | ).get(indexY).rect; |
1,202,941 | public Set<Permission> fetchAllPermissions(String resouceName) throws IOException, GeneralSecurityException {<NEW_LINE>logger.atInfo().log("Fetching all permissions from " + resouceName);<NEW_LINE>QueryTestablePermissionsRequest requestBody = new QueryTestablePermissionsRequest();<NEW_LINE>requestBody.setFullResourceName(resouceName);<NEW_LINE>Iam iamService = IamClient.getIamClient();<NEW_LINE>Iam.Permissions.QueryTestablePermissions request = iamService.permissions().queryTestablePermissions(requestBody);<NEW_LINE>QueryTestablePermissionsResponse response;<NEW_LINE>Set<Permission> permissionSet <MASK><NEW_LINE>do {<NEW_LINE>response = request.execute();<NEW_LINE>if (response.getPermissions() == null) {<NEW_LINE>continue;<NEW_LINE>}<NEW_LINE>for (Permission permission : response.getPermissions()) {<NEW_LINE>permissionSet.add(permission);<NEW_LINE>}<NEW_LINE>requestBody.setPageToken(response.getNextPageToken());<NEW_LINE>} while (response.getNextPageToken() != null);<NEW_LINE>logger.atInfo().log("Total number of permissions at " + resouceName + ":" + permissionSet.size());<NEW_LINE>return permissionSet;<NEW_LINE>} | = new HashSet<Permission>(); |
738,687 | public void update(boolean silent) {<NEW_LINE>// NOI18N<NEW_LINE>LOG.fine("Eclipse resynchronize started (" + silent + ")");<NEW_LINE>WorkspaceFactory.getInstance().resetCache();<NEW_LINE>List<String> importProblems = new ArrayList<String>();<NEW_LINE>List<UpgradableProject> projs = getListOfUpdatableProjects();<NEW_LINE>if (projs.size() == 0 && !silent) {<NEW_LINE>DialogDisplayer.getDefault().notify(new NotifyDescriptor.Message(NbBundle.getMessage(UpdateProjectAction.class, "UpdateProjectAction.nothing-to-synch")));<NEW_LINE>return;<NEW_LINE>}<NEW_LINE>if (!ensureProjectsReachable(projs, silent)) {<NEW_LINE>return;<NEW_LINE>}<NEW_LINE>try {<NEW_LINE>Boolean res = resolveNewRequiredProjects(projs, silent, importProblems, null);<NEW_LINE>if (res == null) {<NEW_LINE>return;<NEW_LINE>}<NEW_LINE>boolean change = updateExistingProjects(projs, importProblems, silent);<NEW_LINE>if (!change && res.equals(Boolean.FALSE) && !silent) {<NEW_LINE>DialogDisplayer.getDefault().notify(new NotifyDescriptor.Message(NbBundle.getMessage(UpdateProjectAction.class, "UpdateProjectAction.already-in-synch")));<NEW_LINE>}<NEW_LINE>} catch (IOException ex) {<NEW_LINE>// NOI18N<NEW_LINE>LOG.log(Level.SEVERE, "synchronization with Eclipse failed", ex);<NEW_LINE>importProblems.add(org.openide.util.NbBundle.getMessage(UpdateAllProjects.class, "MSG_UpdateFailed"<MASK><NEW_LINE>}<NEW_LINE>if (importProblems.size() > 0) {<NEW_LINE>importProblems.add(0, NbBundle.getMessage(UpdateProjectAction.class, "UpdateProjectAction.problems-occurred-2"));<NEW_LINE>}<NEW_LINE>ImportProblemsPanel.showReport(NbBundle.getMessage(UpdateProjectAction.class, "UpdateProjectAction.update-issues"), importProblems);<NEW_LINE>} | , ex.getMessage())); |
799,675 | private boolean consumeMultipart(long fd, HttpRequestProcessor processor, long headerEnd, int read, boolean newRequest, RescheduleContext rescheduleContext) throws PeerDisconnectedException, PeerIsSlowToReadException, ServerDisconnectException {<NEW_LINE>if (newRequest) {<NEW_LINE>processor.onHeadersReady(this);<NEW_LINE>multipartContentParser.of(headerParser.getBoundary());<NEW_LINE>}<NEW_LINE>processor.resumeRecv(this);<NEW_LINE><MASK><NEW_LINE>final long bufferEnd = recvBuffer + read;<NEW_LINE>LOG.debug().$("multipart").$();<NEW_LINE>// read socket into buffer until there is nothing to read<NEW_LINE>long start;<NEW_LINE>long buf;<NEW_LINE>int bufRemaining;<NEW_LINE>if (headerEnd < bufferEnd) {<NEW_LINE>start = headerEnd;<NEW_LINE>buf = bufferEnd;<NEW_LINE>bufRemaining = (int) (recvBufferSize - (bufferEnd - recvBuffer));<NEW_LINE>} else {<NEW_LINE>start = recvBuffer;<NEW_LINE>buf = start + receivedBytes;<NEW_LINE>bufRemaining = recvBufferSize - receivedBytes;<NEW_LINE>receivedBytes = 0;<NEW_LINE>}<NEW_LINE>return continueConsumeMultipart(fd, start, buf, bufRemaining, multipartListener, processor, rescheduleContext);<NEW_LINE>} | final HttpMultipartContentListener multipartListener = (HttpMultipartContentListener) processor; |
636,986 | public IfcModel execute() throws UserException, BimserverDatabaseException, BimserverLockConflictException {<NEW_LINE>DateFormat dateFormat = new SimpleDateFormat("dd-MM-yyyy HH:mm");<NEW_LINE>User user = getUserByUoid(getAuthorization().getUoid());<NEW_LINE>Revision revision = getRevisionByRoid(roid);<NEW_LINE>Project project = revision.getProject();<NEW_LINE>if (user.getHasRightsOn().contains(project)) {<NEW_LINE>for (Checkout checkout : revision.getCheckouts()) {<NEW_LINE>if (checkout.getRevision() == revision && checkout.getUser() == user && checkout.getActive()) {<NEW_LINE>throw new UserException("This revision has already been checked out by you on " + dateFormat.format(checkout.getDate()));<NEW_LINE>}<NEW_LINE>}<NEW_LINE>for (Checkout checkout : project.getCheckouts()) {<NEW_LINE>if (checkout.getUser() == user && checkout.getActive()) {<NEW_LINE>checkout.setActive(false);<NEW_LINE>Checkout newCheckout = getDatabaseSession().create(Checkout.class);<NEW_LINE>newCheckout.setActive(true);<NEW_LINE>newCheckout.setDate(new Date());<NEW_LINE>newCheckout.setUser(user);<NEW_LINE>newCheckout.setProject(project);<NEW_LINE>newCheckout.setRevision(revision);<NEW_LINE>getDatabaseSession().store(checkout);<NEW_LINE>getDatabaseSession().store(newCheckout);<NEW_LINE>getDatabaseSession().store(project);<NEW_LINE>return realCheckout(project, revision, getDatabaseSession(), user);<NEW_LINE>}<NEW_LINE>}<NEW_LINE>Checkout checkout = getDatabaseSession().create(Checkout.class);<NEW_LINE>checkout.setActive(true);<NEW_LINE>checkout.setDate(new Date());<NEW_LINE>checkout.setUser(user);<NEW_LINE>checkout.setProject(project);<NEW_LINE>checkout.setRevision(revision);<NEW_LINE><MASK><NEW_LINE>getDatabaseSession().store(project);<NEW_LINE>return realCheckout(project, revision, getDatabaseSession(), user);<NEW_LINE>} else {<NEW_LINE>throw new UserException("Insufficient rights to checkout this project");<NEW_LINE>}<NEW_LINE>} | getDatabaseSession().store(checkout); |
1,236,018 | private static ChangeBlockEvent.Pre createAndPostChangeBlockEventPre(CauseStackManager.StackFrame frame, ForgeToSpongeEventData eventData) {<NEW_LINE>final BlockEvent.BreakEvent forgeEvent = (BlockEvent.BreakEvent) eventData.getForgeEvent();<NEW_LINE>final net.minecraft.world.World world = forgeEvent.getWorld();<NEW_LINE>if (world.isRemote) {<NEW_LINE>return null;<NEW_LINE>}<NEW_LINE>final BlockPos pos = forgeEvent.getPos();<NEW_LINE>final PhaseContext<?> currentContext = PhaseTracker<MASK><NEW_LINE>EntityPlayer player = forgeEvent.getPlayer();<NEW_LINE>User owner = currentContext.getOwner().orElse((User) player);<NEW_LINE>User notifier = currentContext.getNotifier().orElse((User) player);<NEW_LINE>if (SpongeImplHooks.isFakePlayer(player)) {<NEW_LINE>frame.addContext(EventContextKeys.FAKE_PLAYER, (Player) player);<NEW_LINE>} else {<NEW_LINE>frame.addContext(EventContextKeys.OWNER, owner);<NEW_LINE>frame.addContext(EventContextKeys.NOTIFIER, notifier);<NEW_LINE>}<NEW_LINE>frame.addContext(EventContextKeys.PLAYER_BREAK, (World) world);<NEW_LINE>final ChangeBlockEvent.Pre spongeEvent = SpongeEventFactory.createChangeBlockEventPre(frame.getCurrentCause(), ImmutableList.of(new Location<>((World) world, pos.getX(), pos.getY(), pos.getZ())));<NEW_LINE>eventData.setSpongeEvent(spongeEvent);<NEW_LINE>eventManager.postEvent(eventData);<NEW_LINE>return spongeEvent;<NEW_LINE>} | .getInstance().getCurrentContext(); |
1,412,865 | final ListServiceInstancesResult executeListServiceInstances(ListServiceInstancesRequest listServiceInstancesRequest) {<NEW_LINE>ExecutionContext executionContext = createExecutionContext(listServiceInstancesRequest);<NEW_LINE><MASK><NEW_LINE>awsRequestMetrics.startEvent(Field.ClientExecuteTime);<NEW_LINE>Request<ListServiceInstancesRequest> request = null;<NEW_LINE>Response<ListServiceInstancesResult> response = null;<NEW_LINE>try {<NEW_LINE>awsRequestMetrics.startEvent(Field.RequestMarshallTime);<NEW_LINE>try {<NEW_LINE>request = new ListServiceInstancesRequestProtocolMarshaller(protocolFactory).marshall(super.beforeMarshalling(listServiceInstancesRequest));<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, "Proton");<NEW_LINE>request.addHandlerContext(HandlerContextKey.OPERATION_NAME, "ListServiceInstances");<NEW_LINE>request.addHandlerContext(HandlerContextKey.ADVANCED_CONFIG, advancedConfig);<NEW_LINE>} finally {<NEW_LINE>awsRequestMetrics.endEvent(Field.RequestMarshallTime);<NEW_LINE>}<NEW_LINE>HttpResponseHandler<AmazonWebServiceResponse<ListServiceInstancesResult>> responseHandler = protocolFactory.createResponseHandler(new JsonOperationMetadata().withPayloadJson(true).withHasStreamingSuccessResponse(false), new ListServiceInstancesResultJsonUnmarshaller());<NEW_LINE>response = invoke(request, responseHandler, executionContext);<NEW_LINE>return response.getAwsResponse();<NEW_LINE>} finally {<NEW_LINE>endClientExecution(awsRequestMetrics, request, response);<NEW_LINE>}<NEW_LINE>} | AWSRequestMetrics awsRequestMetrics = executionContext.getAwsRequestMetrics(); |
226,415 | DescriptorProto generateCodingWithFixedCodeSystem(String codeSystemUrl, QualifiedType qualifiedType) {<NEW_LINE>DescriptorProto.Builder codingMessage = DescriptorProto.newBuilder();<NEW_LINE>codingMessage.setName(qualifiedType.getName());<NEW_LINE>codingMessage.getOptionsBuilder().addExtension(Annotations.fhirProfileBase, AnnotationUtils.getStructureDefinitionUrl(Coding.getDescriptor()));<NEW_LINE>List<FieldDescriptorProto> codingFields = new ArrayList<>();<NEW_LINE>// Add in all coding fields that aren't code or system<NEW_LINE>for (FieldDescriptorProto field : Coding.getDescriptor().toProto().getFieldList()) {<NEW_LINE>if (!field.getName().equals("code") && !field.getName().equals("system")) {<NEW_LINE>codingFields.add(field);<NEW_LINE>}<NEW_LINE>}<NEW_LINE>QualifiedType codeType = qualifiedType.childType("FixedCode");<NEW_LINE>codingMessage.addNestedType(generateCodeBoundToCodeSystem(codeSystemUrl, codeType));<NEW_LINE>codingFields.add(FieldDescriptorProto.newBuilder().setType(FieldDescriptorProto.Type.TYPE_MESSAGE).setLabel(FieldDescriptorProto.Label.LABEL_OPTIONAL).setTypeName(codeType.toQualifiedTypeString()).setName("code").setNumber(5).build());<NEW_LINE>codingMessage.addAllField(codingFields.stream().sorted((a, b) -> a.getNumber() - b.getNumber()).collect<MASK><NEW_LINE>return codingMessage.build();<NEW_LINE>} | (Collectors.toList())); |
1,228,754 | protected Object decode(Channel channel, SocketAddress remoteAddress, Object msg) throws Exception {<NEW_LINE>Parser parser = new Parser(PATTERN, (String) msg);<NEW_LINE>if (!parser.matches()) {<NEW_LINE>return null;<NEW_LINE>}<NEW_LINE>DeviceSession deviceSession = getDeviceSession(channel, remoteAddress, parser.next());<NEW_LINE>if (deviceSession == null) {<NEW_LINE>return null;<NEW_LINE>}<NEW_LINE>Position position = new Position(getProtocolName());<NEW_LINE>position.setDeviceId(deviceSession.getDeviceId());<NEW_LINE>position.setTime(parser.nextDateTime(Parser.DateTimeFormat.DMY_HMS));<NEW_LINE>int flags = parser.nextHexInt();<NEW_LINE>position.setValid(BitUtil.check(flags, 3));<NEW_LINE>int hemisphereLatitude = BitUtil.check(flags, 1) ? -1 : 1;<NEW_LINE>int hemisphereLongitude = BitUtil.check(flags, 0) ? -1 : 1;<NEW_LINE>position.setLatitude(parser.nextCoordinate(Parser.CoordinateFormat.DEG_MIN_MIN) * hemisphereLatitude);<NEW_LINE>position.setLongitude(parser.nextCoordinate(Parser.CoordinateFormat.DEG_MIN_MIN) * hemisphereLongitude);<NEW_LINE>position.set(Position.<MASK><NEW_LINE>position.setSpeed(parser.nextHexInt() * 0.01);<NEW_LINE>position.set(Position.KEY_ODOMETER, parser.nextHexInt() * 1852.0 / 16);<NEW_LINE>position.setCourse(parser.nextHexInt());<NEW_LINE>// alarm<NEW_LINE>parser.nextHexInt();<NEW_LINE>return position;<NEW_LINE>} | KEY_STATUS, parser.nextHexLong()); |
16,055 | private List<SectionDescriptor> prepareSections(List<? extends GuardedSection> list) {<NEW_LINE>List<SectionDescriptor> dest = new ArrayList<SectionDescriptor<MASK><NEW_LINE>for (GuardedSection o : list) {<NEW_LINE>if (o instanceof SimpleSection) {<NEW_LINE>SectionDescriptor desc = new SectionDescriptor(GuardTag.LINE, o.getName(), o.getStartPosition().getOffset(), o.getEndPosition().getOffset());<NEW_LINE>dest.add(desc);<NEW_LINE>} else {<NEW_LINE>SectionDescriptor desc = new SectionDescriptor(GuardTag.HEADER, o.getName(), o.getStartPosition().getOffset(), ((InteriorSection) o).getBodyStartPosition().getOffset() - 1);<NEW_LINE>dest.add(desc);<NEW_LINE>desc = new SectionDescriptor(GuardTag.END, o.getName(), ((InteriorSection) o).getBodyEndPosition().getOffset() + 1, o.getEndPosition().getOffset());<NEW_LINE>dest.add(desc);<NEW_LINE>}<NEW_LINE>}<NEW_LINE>return dest;<NEW_LINE>} | >(list.size()); |
1,526,729 | /*<NEW_LINE>* @see com.sitewhere.microservice.api.event.IDeviceEventManagement#<NEW_LINE>* listDeviceCommandResponsesForIndex(com.sitewhere.spi.device.event.<NEW_LINE>* DeviceEventIndex, java.util.List,<NEW_LINE>* com.sitewhere.spi.search.IDateRangeSearchCriteria)<NEW_LINE>*/<NEW_LINE>@Override<NEW_LINE>public ISearchResults<IDeviceCommandResponse> listDeviceCommandResponsesForIndex(DeviceEventIndex index, List<UUID> entityIds, IDateRangeSearchCriteria criteria) throws SiteWhereException {<NEW_LINE>QueryParams queryParams = QueryParams.builder();<NEW_LINE>queryParams.addParameter(Warp10DeviceEvent.PROP_EVENT_TYPE, DeviceEventType.CommandResponse.name());<NEW_LINE>queryParams.addParameter(getFieldForIndex(index), entityIds.stream().map(Object::toString).collect(Collectors.joining("|")));<NEW_LINE>Warp10Persistence.addDateSearchCriteria(queryParams, criteria);<NEW_LINE>List<IDeviceCommandResponse> <MASK><NEW_LINE>List<GTSOutput> fetch = getClient().findGTS(queryParams);<NEW_LINE>for (GTSOutput gtsOutput : fetch) {<NEW_LINE>DeviceCommandResponse deviceCommandResponse = Warp10DeviceCommandResponse.fromGTS(gtsOutput);<NEW_LINE>results.add(deviceCommandResponse);<NEW_LINE>}<NEW_LINE>return new SearchResults<IDeviceCommandResponse>(results);<NEW_LINE>} | results = new ArrayList<>(); |
587,089 | private Mono<Response<Flux<ByteBuffer>>> deleteWithResponseAsync(String resourceGroupName, String privateCloudName, String addonName, Context context) {<NEW_LINE>if (this.client.getEndpoint() == null) {<NEW_LINE>return Mono.error(new IllegalArgumentException("Parameter this.client.getEndpoint() is required and cannot be null."));<NEW_LINE>}<NEW_LINE>if (this.client.getSubscriptionId() == null) {<NEW_LINE>return Mono.<MASK><NEW_LINE>}<NEW_LINE>if (resourceGroupName == null) {<NEW_LINE>return Mono.error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null."));<NEW_LINE>}<NEW_LINE>if (privateCloudName == null) {<NEW_LINE>return Mono.error(new IllegalArgumentException("Parameter privateCloudName is required and cannot be null."));<NEW_LINE>}<NEW_LINE>if (addonName == null) {<NEW_LINE>return Mono.error(new IllegalArgumentException("Parameter addonName is required and cannot be null."));<NEW_LINE>}<NEW_LINE>final String accept = "application/json";<NEW_LINE>context = this.client.mergeContext(context);<NEW_LINE>return service.delete(this.client.getEndpoint(), this.client.getSubscriptionId(), resourceGroupName, privateCloudName, addonName, this.client.getApiVersion(), accept, context);<NEW_LINE>} | error(new IllegalArgumentException("Parameter this.client.getSubscriptionId() is required and cannot be null.")); |
1,119,951 | public BuilderSingularNoAuto build() {<NEW_LINE>java.util.List<String> things;<NEW_LINE>switch(this.things == null ? 0 : this.things.size()) {<NEW_LINE>case 0:<NEW_LINE>things = java<MASK><NEW_LINE>break;<NEW_LINE>case 1:<NEW_LINE>things = java.util.Collections.singletonList(this.things.get(0));<NEW_LINE>break;<NEW_LINE>default:<NEW_LINE>things = java.util.Collections.unmodifiableList(new java.util.ArrayList<String>(this.things));<NEW_LINE>}<NEW_LINE>java.util.List<String> widgets;<NEW_LINE>switch(this.widgets == null ? 0 : this.widgets.size()) {<NEW_LINE>case 0:<NEW_LINE>widgets = java.util.Collections.emptyList();<NEW_LINE>break;<NEW_LINE>case 1:<NEW_LINE>widgets = java.util.Collections.singletonList(this.widgets.get(0));<NEW_LINE>break;<NEW_LINE>default:<NEW_LINE>widgets = java.util.Collections.unmodifiableList(new java.util.ArrayList<String>(this.widgets));<NEW_LINE>}<NEW_LINE>java.util.List<String> items;<NEW_LINE>switch(this.items == null ? 0 : this.items.size()) {<NEW_LINE>case 0:<NEW_LINE>items = java.util.Collections.emptyList();<NEW_LINE>break;<NEW_LINE>case 1:<NEW_LINE>items = java.util.Collections.singletonList(this.items.get(0));<NEW_LINE>break;<NEW_LINE>default:<NEW_LINE>items = java.util.Collections.unmodifiableList(new java.util.ArrayList<String>(this.items));<NEW_LINE>}<NEW_LINE>return new BuilderSingularNoAuto(things, widgets, items);<NEW_LINE>} | .util.Collections.emptyList(); |
1,367,396 | private void updateButtonAvailability() {<NEW_LINE>boolean isConnected = (ooBase != null);<NEW_LINE>boolean isConnectedToDocument = <MASK><NEW_LINE>// For these, we need to watch something<NEW_LINE>// (style != null);<NEW_LINE>boolean hasStyle = true;<NEW_LINE>// !getBaseList().isEmpty();<NEW_LINE>boolean hasDatabase = true;<NEW_LINE>boolean hasSelectedBibEntry = true;<NEW_LINE>selectDocument.setDisable(!(isConnected));<NEW_LINE>pushEntries.setDisable(!(isConnectedToDocument && hasStyle && hasDatabase));<NEW_LINE>boolean canCite = isConnectedToDocument && hasStyle && hasSelectedBibEntry;<NEW_LINE>pushEntriesInt.setDisable(!canCite);<NEW_LINE>pushEntriesEmpty.setDisable(!canCite);<NEW_LINE>pushEntriesAdvanced.setDisable(!canCite);<NEW_LINE>boolean canRefreshDocument = isConnectedToDocument && hasStyle;<NEW_LINE>update.setDisable(!canRefreshDocument);<NEW_LINE>merge.setDisable(!canRefreshDocument);<NEW_LINE>unmerge.setDisable(!canRefreshDocument);<NEW_LINE>manageCitations.setDisable(!canRefreshDocument);<NEW_LINE>exportCitations.setDisable(!(isConnectedToDocument && hasDatabase));<NEW_LINE>} | isConnected && !ooBase.isDocumentConnectionMissing(); |
306,019 | public static Reader createBOMStrippedReader(InputStream stream, String defaultCharset) throws IOException {<NEW_LINE>InputStream in = stream.markSupported() ? stream : new BufferedInputStream(stream);<NEW_LINE>String charset = null;<NEW_LINE>in.mark(3);<NEW_LINE>byte[] head = new byte[3];<NEW_LINE>int br = in.read(head, 0, 3);<NEW_LINE>if (br >= 2 && (head[0] == (byte) 0xFE && head[1] == (byte) 0xFF) || (head[0] == (byte) 0xFF && head[1] == (byte) 0xFE)) {<NEW_LINE>charset <MASK><NEW_LINE>in.reset();<NEW_LINE>} else if (br >= 3 && head[0] == (byte) 0xEF && head[1] == (byte) 0xBB && head[2] == (byte) 0xBF) {<NEW_LINE>// InputStreamReader does not properly discard BOM on UTF8 streams,<NEW_LINE>// so don't reset the stream.<NEW_LINE>charset = StandardCharsets.UTF_8.name();<NEW_LINE>}<NEW_LINE>if (charset == null) {<NEW_LINE>in.reset();<NEW_LINE>charset = defaultCharset;<NEW_LINE>}<NEW_LINE>return new InputStreamReader(in, charset);<NEW_LINE>} | = StandardCharsets.UTF_16.name(); |
1,282,330 | public void testJPA() throws Exception {<NEW_LINE>EntityManagerFactory <MASK><NEW_LINE>EntityManager em = emf.createEntityManager();<NEW_LINE>tx.begin();<NEW_LINE>em.joinTransaction();<NEW_LINE>assertTrue(em.isJoinedToTransaction());<NEW_LINE>Widget w = new Widget();<NEW_LINE>w.id = 4;<NEW_LINE>em.persist(w);<NEW_LINE>tx.commit();<NEW_LINE>tx.begin();<NEW_LINE>em.joinTransaction();<NEW_LINE>Widget w4 = em.find(Widget.class, 4);<NEW_LINE>assertNotNull(w4);<NEW_LINE>assertEquals(4, w4.id);<NEW_LINE>Widget w5 = new Widget();<NEW_LINE>w5.id = 5;<NEW_LINE>em.persist(w5);<NEW_LINE>tx.rollback();<NEW_LINE>tx.begin();<NEW_LINE>em.joinTransaction();<NEW_LINE>Widget rolledBack = em.find(Widget.class, 5);<NEW_LINE>assertNull(rolledBack);<NEW_LINE>tx.commit();<NEW_LINE>} | emf = Persistence.createEntityManagerFactory("test_pu"); |
361,247 | private int readTargetValue(int offset) {<NEW_LINE>int currentOffset = offset;<NEW_LINE>int tag = u1At(currentOffset);<NEW_LINE>currentOffset++;<NEW_LINE>switch(tag) {<NEW_LINE>case 'e':<NEW_LINE>int utf8Offset = this.constantPoolOffsets[u2At(currentOffset)] - this.structOffset;<NEW_LINE>char[] typeName = utf8At(utf8Offset + 3, u2At(utf8Offset + 1));<NEW_LINE>currentOffset += 2;<NEW_LINE>if (typeName.length == 34 && CharOperation.equals(typeName, ConstantPool.JAVA_LANG_ANNOTATION_ELEMENTTYPE)) {<NEW_LINE>utf8Offset = this.constantPoolOffsets[u2At(currentOffset)] - this.structOffset;<NEW_LINE>char[] constName = utf8At(utf8Offset + 3, u2At(utf8Offset + 1));<NEW_LINE>this.standardAnnotationTagBits |= Annotation.getTargetElementType(constName);<NEW_LINE>}<NEW_LINE>currentOffset += 2;<NEW_LINE>break;<NEW_LINE>case 'B':<NEW_LINE>case 'C':<NEW_LINE>case 'D':<NEW_LINE>case 'F':<NEW_LINE>case 'I':<NEW_LINE>case 'J':<NEW_LINE>case 'S':<NEW_LINE>case 'Z':<NEW_LINE>case 's':<NEW_LINE>case 'c':<NEW_LINE>currentOffset += 2;<NEW_LINE>break;<NEW_LINE>case '@':<NEW_LINE>// none of the supported standard annotation are in the nested<NEW_LINE>// level.<NEW_LINE>currentOffset = scanAnnotation(currentOffset, false, false);<NEW_LINE>break;<NEW_LINE>case '[':<NEW_LINE>int numberOfValues = u2At(currentOffset);<NEW_LINE>currentOffset += 2;<NEW_LINE>if (numberOfValues == 0) {<NEW_LINE>this.standardAnnotationTagBits |= TagBits.AnnotationTarget;<NEW_LINE>} else {<NEW_LINE>for (int i = 0; i < numberOfValues; i<MASK><NEW_LINE>}<NEW_LINE>break;<NEW_LINE>default:<NEW_LINE>throw new IllegalStateException();<NEW_LINE>}<NEW_LINE>return currentOffset;<NEW_LINE>} | ++) currentOffset = readTargetValue(currentOffset); |
303,861 | public void save(@NonNull final BPartnerComposite bpartnerComposite, final boolean validatePermissions) {<NEW_LINE>final ImmutableList<ITranslatableString> validateResult = bpartnerComposite.validate();<NEW_LINE>if (!validateResult.isEmpty()) {<NEW_LINE>final String errors = validateResult.stream().map(trl -> trl.translate(Env.getADLanguageOrBaseLanguage())).collect(Collectors.joining("\n"));<NEW_LINE>throw new AdempiereException("Can't save an invalid bpartnerComposite").appendParametersToMessage().setParameter("errors", errors).setParameter("bpartnerComposite", bpartnerComposite);<NEW_LINE>}<NEW_LINE>final <MASK><NEW_LINE>final BPartnerSaveRequest request = BPartnerSaveRequest.builder().bpartner(bpartner).orgId(bpartnerComposite.getOrgId()).validatePermissions(validatePermissions).build();<NEW_LINE>try (final MDCCloseable ignored = TableRecordMDC.putTableRecordReference(I_C_BPartner.Table_Name, bpartner.getId())) {<NEW_LINE>saveBPartner(request);<NEW_LINE>}<NEW_LINE>try (final MDCCloseable ignored = TableRecordMDC.putTableRecordReference(I_C_BPartner.Table_Name, bpartner.getId())) {<NEW_LINE>saveBPartnerLocations(bpartnerComposite, validatePermissions);<NEW_LINE>saveBPartnerContacts(bpartnerComposite, validatePermissions);<NEW_LINE>saveBPartnerBankAccounts(bpartnerComposite, validatePermissions);<NEW_LINE>}<NEW_LINE>} | BPartner bpartner = bpartnerComposite.getBpartner(); |
189,326 | private void createListener(final APICreateLoadBalancerListenerMsg msg, final NoErrorCompletion completion) {<NEW_LINE>final APICreateLoadBalancerListenerEvent evt = new APICreateLoadBalancerListenerEvent(msg.getId());<NEW_LINE>LoadBalancerListenerVO vo = new LoadBalancerListenerVO();<NEW_LINE>vo.setLoadBalancerUuid(self.getUuid());<NEW_LINE>vo.setUuid(msg.getResourceUuid() == null ? Platform.getUuid() : msg.getResourceUuid());<NEW_LINE>vo.setDescription(msg.getDescription());<NEW_LINE>vo.setName(msg.getName());<NEW_LINE>vo.setInstancePort(msg.getInstancePort());<NEW_LINE>vo.setLoadBalancerPort(msg.getLoadBalancerPort());<NEW_LINE>vo.setProtocol(msg.getProtocol());<NEW_LINE>vo.setAccountUuid(msg.<MASK><NEW_LINE>vo.setSecurityPolicyType(msg.getSecurityPolicyType());<NEW_LINE>vo = dbf.persistAndRefresh(vo);<NEW_LINE>if (msg.getCertificateUuid() != null) {<NEW_LINE>LoadBalancerListenerCertificateRefVO ref = new LoadBalancerListenerCertificateRefVO();<NEW_LINE>ref.setListenerUuid(vo.getUuid());<NEW_LINE>ref.setCertificateUuid(msg.getCertificateUuid());<NEW_LINE>dbf.persist(ref);<NEW_LINE>}<NEW_LINE>if (msg.getAclUuids() != null) {<NEW_LINE>final String listenerUuid = vo.getUuid();<NEW_LINE>List<LoadBalancerListenerACLRefVO> refs = msg.getAclUuids().stream().map(aclUuid -> {<NEW_LINE>LoadBalancerListenerACLRefVO ref = new LoadBalancerListenerACLRefVO();<NEW_LINE>ref.setAclUuid(aclUuid);<NEW_LINE>ref.setType(LoadBalancerAclType.valueOf(msg.getAclType()));<NEW_LINE>ref.setListenerUuid(listenerUuid);<NEW_LINE>return ref;<NEW_LINE>}).collect(Collectors.toList());<NEW_LINE>dbf.persistCollection(refs);<NEW_LINE>}<NEW_LINE>tagMgr.createNonInherentSystemTags(msg.getSystemTags(), vo.getUuid(), LoadBalancerListenerVO.class.getSimpleName());<NEW_LINE>vo = dbf.updateAndRefresh(vo);<NEW_LINE>evt.setInventory(LoadBalancerListenerInventory.valueOf(vo));<NEW_LINE>bus.publish(evt);<NEW_LINE>completion.done();<NEW_LINE>} | getSession().getAccountUuid()); |
1,701,924 | boolean applyFilter(RepositoryRevision rev) {<NEW_LINE>boolean visible = true;<NEW_LINE>String filterText = txtFilter.getText().trim().toLowerCase();<NEW_LINE>Object selectedFilterKind = cmbFilterKind.getSelectedItem();<NEW_LINE>if (selectedFilterKind != FilterKind.ALL && !filterText.isEmpty()) {<NEW_LINE>if (selectedFilterKind == FilterKind.MESSAGE) {<NEW_LINE>visible = rev.getLog().getFullMessage().toLowerCase().contains(filterText);<NEW_LINE>} else if (selectedFilterKind == FilterKind.USER) {<NEW_LINE>visible = rev.getLog().getAuthor().toString().<MASK><NEW_LINE>} else if (selectedFilterKind == FilterKind.ID) {<NEW_LINE>visible = rev.getLog().getRevision().contains(filterText) || contains(rev.getBranches(), filterText) || contains(rev.getTags(), filterText);<NEW_LINE>}<NEW_LINE>}<NEW_LINE>Object selectedBranchFilter = currentBranchFilter;<NEW_LINE>if (visible && selectedBranchFilter instanceof GitBranch) {<NEW_LINE>visible = rev.getLog().getBranches().containsKey(((GitBranch) currentBranchFilter).getName());<NEW_LINE>}<NEW_LINE>return visible;<NEW_LINE>} | toLowerCase().contains(filterText); |
261,396 | public static AMQP.BasicProperties copy(AMQP.BasicProperties props) {<NEW_LINE>AMQP.BasicProperties source = props;<NEW_LINE>if (source == null) {<NEW_LINE>source = MessageProperties.MINIMAL_BASIC;<NEW_LINE>}<NEW_LINE>AMQP.BasicProperties.Builder builder = new AMQP.BasicProperties.Builder();<NEW_LINE>builder.contentType(source.getContentType());<NEW_LINE>builder.contentEncoding(source.getContentEncoding());<NEW_LINE>builder.headers(source.getHeaders());<NEW_LINE>builder.<MASK><NEW_LINE>builder.priority(source.getPriority());<NEW_LINE>builder.correlationId(source.getCorrelationId());<NEW_LINE>builder.replyTo(source.getReplyTo());<NEW_LINE>builder.expiration(source.getExpiration());<NEW_LINE>builder.messageId(source.getMessageId());<NEW_LINE>builder.timestamp(source.getTimestamp());<NEW_LINE>builder.type(source.getType());<NEW_LINE>builder.userId(source.getUserId());<NEW_LINE>builder.appId(source.getAppId());<NEW_LINE>builder.clusterId(source.getClusterId());<NEW_LINE>return builder.build();<NEW_LINE>} | deliveryMode(source.getDeliveryMode()); |
1,692,397 | private void commitTx(final long txId) throws RemoteTransactionNotFoundException, RemoteTransactionValidationException {<NEW_LINE>final ConnectOptions opts = new ConnectOptions(mgr.getBaseServiceURL() + "/tx/" <MASK><NEW_LINE>opts.method = "POST";<NEW_LINE>opts.addRequestParam("COMMIT");<NEW_LINE>JettyResponseListener response = null;<NEW_LINE>try {<NEW_LINE>final JettyResponseListener listener = RemoteRepository.checkResponseCode(response = mgr.doConnect(opts));<NEW_LINE>switch(listener.getStatus()) {<NEW_LINE>case 200:<NEW_LINE>return;<NEW_LINE>default:<NEW_LINE>throw new HttpException(listener.getStatus(), "status=" + listener.getStatus() + ", reason" + listener.getReason());<NEW_LINE>}<NEW_LINE>} catch (HttpException ex) {<NEW_LINE>switch(ex.getStatusCode()) {<NEW_LINE>case // GONE<NEW_LINE>404:<NEW_LINE>throw new RemoteTransactionNotFoundException(txId, mgr.getBaseServiceURL());<NEW_LINE>case // CONFLICT<NEW_LINE>409:<NEW_LINE>// Validation failed.<NEW_LINE>throw new RemoteTransactionValidationException(txId, mgr.getBaseServiceURL());<NEW_LINE>default:<NEW_LINE>// Unexpected status code.<NEW_LINE>throw new RuntimeException(ex);<NEW_LINE>}<NEW_LINE>} catch (Exception t) {<NEW_LINE>throw new RuntimeException(t);<NEW_LINE>} finally {<NEW_LINE>if (response != null)<NEW_LINE>response.abort();<NEW_LINE>}<NEW_LINE>} | + Long.toString(txId)); |
962,946 | protected Object doMapFromContext(DirContextOperations ctx) {<NEW_LINE>if (resultFilter != null && !resultFilter.needSelect(ctx.getNameInNamespace())) {<NEW_LINE>return null;<NEW_LINE>}<NEW_LINE>Map<String, Object> result = new HashMap<>();<NEW_LINE>result.put(LdapConstant.LDAP_DN_KEY, ctx.getNameInNamespace());<NEW_LINE>List<Object> <MASK><NEW_LINE>result.put("attributes", list);<NEW_LINE>Attributes attributes = ctx.getAttributes();<NEW_LINE>NamingEnumeration it = attributes.getAll();<NEW_LINE>try {<NEW_LINE>while (it.hasMore()) {<NEW_LINE>list.add(it.next());<NEW_LINE>}<NEW_LINE>} catch (javax.naming.NamingException e) {<NEW_LINE>logger.error("query ldap entry attributes fail", e.getCause());<NEW_LINE>throw new OperationFailureException(operr("query ldap entry fail, %s", e.toString()));<NEW_LINE>}<NEW_LINE>return result;<NEW_LINE>} | list = new ArrayList<>(); |
1,240,092 | protected void migrateRealm(KeycloakSession session, ProtocolMapperModel localeMapper, RealmModel realm) {<NEW_LINE>realm.setOfflineSessionIdleTimeout(Constants.DEFAULT_OFFLINE_SESSION_IDLE_TIMEOUT);<NEW_LINE>if (realm.getRole(Constants.OFFLINE_ACCESS_ROLE) == null) {<NEW_LINE>KeycloakModelUtils.setupOfflineRole(realm);<NEW_LINE>RoleModel role = realm.getRole(Constants.OFFLINE_ACCESS_ROLE);<NEW_LINE>// Bulk grant of offline_access role to all users<NEW_LINE>session.users().grantToAllUsers(realm, role);<NEW_LINE>}<NEW_LINE>ClientModel adminConsoleClient = realm.getClientByClientId(Constants.ADMIN_CONSOLE_CLIENT_ID);<NEW_LINE>if ((adminConsoleClient != null) && !localeMapperAdded(adminConsoleClient)) {<NEW_LINE>adminConsoleClient.addProtocolMapper(localeMapper);<NEW_LINE>}<NEW_LINE>ClientModel client = realm.getMasterAdminClient();<NEW_LINE>if (client.getRole(AdminRoles.CREATE_CLIENT) == null) {<NEW_LINE>RoleModel role = client.addRole(AdminRoles.CREATE_CLIENT);<NEW_LINE>role.setDescription("${role_" + AdminRoles.CREATE_CLIENT + "}");<NEW_LINE>client.getRealm().getRole(AdminRoles.ADMIN).addCompositeRole(role);<NEW_LINE>}<NEW_LINE>if (!realm.getName().equals(Config.getAdminRealm())) {<NEW_LINE>client = realm.getClientByClientId(Constants.REALM_MANAGEMENT_CLIENT_ID);<NEW_LINE>if (client.getRole(AdminRoles.CREATE_CLIENT) == null) {<NEW_LINE>RoleModel role = <MASK><NEW_LINE>role.setDescription("${role_" + AdminRoles.CREATE_CLIENT + "}");<NEW_LINE>client.getRole(AdminRoles.REALM_ADMIN).addCompositeRole(role);<NEW_LINE>}<NEW_LINE>}<NEW_LINE>} | client.addRole(AdminRoles.CREATE_CLIENT); |
1,698,376 | public static BeginContactFlowVersionModificationResponse unmarshall(BeginContactFlowVersionModificationResponse beginContactFlowVersionModificationResponse, UnmarshallerContext context) {<NEW_LINE>beginContactFlowVersionModificationResponse.setRequestId(context.stringValue("BeginContactFlowVersionModificationResponse.RequestId"));<NEW_LINE>beginContactFlowVersionModificationResponse.setSuccess(context.booleanValue("BeginContactFlowVersionModificationResponse.Success"));<NEW_LINE>beginContactFlowVersionModificationResponse.setCode(context.stringValue("BeginContactFlowVersionModificationResponse.Code"));<NEW_LINE>beginContactFlowVersionModificationResponse.setMessage(context.stringValue("BeginContactFlowVersionModificationResponse.Message"));<NEW_LINE>beginContactFlowVersionModificationResponse.setHttpStatusCode(context.integerValue("BeginContactFlowVersionModificationResponse.HttpStatusCode"));<NEW_LINE>ContactFlow contactFlow = new ContactFlow();<NEW_LINE>contactFlow.setContactFlowId(context.stringValue("BeginContactFlowVersionModificationResponse.ContactFlow.ContactFlowId"));<NEW_LINE>contactFlow.setInstanceId(context.stringValue("BeginContactFlowVersionModificationResponse.ContactFlow.InstanceId"));<NEW_LINE>contactFlow.setContactFlowName(context.stringValue("BeginContactFlowVersionModificationResponse.ContactFlow.ContactFlowName"));<NEW_LINE>contactFlow.setContactFlowDescription(context.stringValue("BeginContactFlowVersionModificationResponse.ContactFlow.ContactFlowDescription"));<NEW_LINE>contactFlow.setType(context.stringValue("BeginContactFlowVersionModificationResponse.ContactFlow.Type"));<NEW_LINE>contactFlow.setAppliedVersion(context.stringValue("BeginContactFlowVersionModificationResponse.ContactFlow.AppliedVersion"));<NEW_LINE>List<ContactFlowVersion> versions = new ArrayList<ContactFlowVersion>();<NEW_LINE>for (int i = 0; i < context.lengthValue("BeginContactFlowVersionModificationResponse.ContactFlow.Versions.Length"); i++) {<NEW_LINE>ContactFlowVersion contactFlowVersion = new ContactFlowVersion();<NEW_LINE>contactFlowVersion.setContactFlowVersionId(context.stringValue("BeginContactFlowVersionModificationResponse.ContactFlow.Versions[" + i + "].ContactFlowVersionId"));<NEW_LINE>contactFlowVersion.setVersion(context.stringValue("BeginContactFlowVersionModificationResponse.ContactFlow.Versions[" + i + "].Version"));<NEW_LINE>contactFlowVersion.setContactFlowVersionDescription(context.stringValue("BeginContactFlowVersionModificationResponse.ContactFlow.Versions[" + i + "].ContactFlowVersionDescription"));<NEW_LINE>contactFlowVersion.setCanvas(context.stringValue("BeginContactFlowVersionModificationResponse.ContactFlow.Versions[" + i + "].Canvas"));<NEW_LINE>contactFlowVersion.setContent(context.stringValue("BeginContactFlowVersionModificationResponse.ContactFlow.Versions[" + i + "].Content"));<NEW_LINE>contactFlowVersion.setLastModified(context.stringValue("BeginContactFlowVersionModificationResponse.ContactFlow.Versions[" + i + "].LastModified"));<NEW_LINE>contactFlowVersion.setLastModifiedBy(context.stringValue("BeginContactFlowVersionModificationResponse.ContactFlow.Versions[" + i + "].LastModifiedBy"));<NEW_LINE>contactFlowVersion.setStatus(context.stringValue("BeginContactFlowVersionModificationResponse.ContactFlow.Versions[" + i + "].Status"));<NEW_LINE>versions.add(contactFlowVersion);<NEW_LINE>}<NEW_LINE>contactFlow.setVersions(versions);<NEW_LINE>List<PhoneNumber> phoneNumbers = new ArrayList<PhoneNumber>();<NEW_LINE>for (int i = 0; i < context.lengthValue("BeginContactFlowVersionModificationResponse.ContactFlow.PhoneNumbers.Length"); i++) {<NEW_LINE>PhoneNumber phoneNumber = new PhoneNumber();<NEW_LINE>phoneNumber.setPhoneNumberId(context.stringValue("BeginContactFlowVersionModificationResponse.ContactFlow.PhoneNumbers[" + i + "].PhoneNumberId"));<NEW_LINE>phoneNumber.setInstanceId(context.stringValue("BeginContactFlowVersionModificationResponse.ContactFlow.PhoneNumbers[" + i + "].InstanceId"));<NEW_LINE>phoneNumber.setNumber(context.stringValue("BeginContactFlowVersionModificationResponse.ContactFlow.PhoneNumbers[" + i + "].Number"));<NEW_LINE>phoneNumber.setPhoneNumberDescription(context.stringValue("BeginContactFlowVersionModificationResponse.ContactFlow.PhoneNumbers[" + i + "].PhoneNumberDescription"));<NEW_LINE>phoneNumber.setRemainingTime(context.integerValue<MASK><NEW_LINE>phoneNumber.setTrunks(context.integerValue("BeginContactFlowVersionModificationResponse.ContactFlow.PhoneNumbers[" + i + "].Trunks"));<NEW_LINE>phoneNumbers.add(phoneNumber);<NEW_LINE>}<NEW_LINE>contactFlow.setPhoneNumbers(phoneNumbers);<NEW_LINE>beginContactFlowVersionModificationResponse.setContactFlow(contactFlow);<NEW_LINE>return beginContactFlowVersionModificationResponse;<NEW_LINE>} | ("BeginContactFlowVersionModificationResponse.ContactFlow.PhoneNumbers[" + i + "].RemainingTime")); |
562,138 | public void generateAccountSas() {<NEW_LINE>QueueServiceAsyncClient queueServiceAsyncClient = createAsyncClientWithCredential();<NEW_LINE>// BEGIN: com.azure.storage.queue.QueueServiceAsyncClient.generateAccountSas#AccountSasSignatureValues<NEW_LINE>AccountSasPermission permissions = new AccountSasPermission().setListPermission(true).setReadPermission(true);<NEW_LINE>AccountSasResourceType resourceTypes = new AccountSasResourceType().setContainer(true).setObject(true);<NEW_LINE>AccountSasService services = new AccountSasService().setQueueAccess(true).setFileAccess(true);<NEW_LINE>OffsetDateTime expiryTime = OffsetDateTime.now().plus(Duration.ofDays(2));<NEW_LINE>AccountSasSignatureValues sasValues = new AccountSasSignatureValues(expiryTime, permissions, services, resourceTypes);<NEW_LINE>// Client must be authenticated via StorageSharedKeyCredential<NEW_LINE>String <MASK><NEW_LINE>// END: com.azure.storage.queue.QueueServiceAsyncClient.generateAccountSas#AccountSasSignatureValues<NEW_LINE>} | sas = queueServiceAsyncClient.generateAccountSas(sasValues); |
261,552 | public ProcessStatus restOrgChartData(final PwmRequest pwmRequest) throws IOException, PwmUnrecoverableException, ServletException {<NEW_LINE>final PeopleSearchProfile peopleSearchProfile = peopleSearchProfile(pwmRequest);<NEW_LINE>final PeopleSearchConfiguration peopleSearchConfiguration = new PeopleSearchConfiguration(pwmRequest.getDomainConfig(), peopleSearchProfile);<NEW_LINE>final UserIdentity userIdentity;<NEW_LINE>{<NEW_LINE>final String userKey = pwmRequest.readParameterAsString(PARAM_USERKEY, PwmHttpRequestWrapper.Flag.BypassValidation);<NEW_LINE>if (StringUtil.isEmpty(userKey)) {<NEW_LINE>userIdentity = pwmRequest.getUserInfoIfLoggedIn();<NEW_LINE>if (userIdentity == null) {<NEW_LINE>return ProcessStatus.Halt;<NEW_LINE>}<NEW_LINE>} else {<NEW_LINE>userIdentity = UserIdentity.fromObfuscatedKey(userKey, pwmRequest.getPwmApplication());<NEW_LINE>}<NEW_LINE>}<NEW_LINE>if (!peopleSearchConfiguration.isOrgChartEnabled()) {<NEW_LINE><MASK><NEW_LINE>}<NEW_LINE>final boolean noChildren = pwmRequest.readParameterAsBoolean("noChildren");<NEW_LINE>try {<NEW_LINE>final PeopleSearchDataReader peopleSearchDataReader = new PeopleSearchDataReader(pwmRequest, peopleSearchProfile);<NEW_LINE>final OrgChartDataBean orgChartData = peopleSearchDataReader.makeOrgChartData(userIdentity, noChildren);<NEW_LINE>addExpiresHeadersToResponse(pwmRequest);<NEW_LINE>pwmRequest.outputJsonResult(RestResultBean.withData(orgChartData, OrgChartDataBean.class));<NEW_LINE>StatisticsClient.incrementStat(pwmRequest, Statistic.PEOPLESEARCH_ORGCHART);<NEW_LINE>} catch (final PwmException e) {<NEW_LINE>LOGGER.error(pwmRequest, () -> "error generating user detail object: " + e.getMessage());<NEW_LINE>pwmRequest.respondWithError(e.getErrorInformation());<NEW_LINE>}<NEW_LINE>return ProcessStatus.Halt;<NEW_LINE>} | throw new PwmUnrecoverableException(PwmError.ERROR_SERVICE_NOT_AVAILABLE); |
482,570 | final UpdateDatasetEntriesResult executeUpdateDatasetEntries(UpdateDatasetEntriesRequest updateDatasetEntriesRequest) {<NEW_LINE>ExecutionContext executionContext = createExecutionContext(updateDatasetEntriesRequest);<NEW_LINE>AWSRequestMetrics awsRequestMetrics = executionContext.getAwsRequestMetrics();<NEW_LINE>awsRequestMetrics.startEvent(Field.ClientExecuteTime);<NEW_LINE>Request<UpdateDatasetEntriesRequest> request = null;<NEW_LINE>Response<UpdateDatasetEntriesResult> response = null;<NEW_LINE>try {<NEW_LINE>awsRequestMetrics.startEvent(Field.RequestMarshallTime);<NEW_LINE>try {<NEW_LINE>request = new UpdateDatasetEntriesRequestProtocolMarshaller(protocolFactory).marshall(super.beforeMarshalling(updateDatasetEntriesRequest));<NEW_LINE>// Binds the request metrics to the current request.<NEW_LINE>request.setAWSRequestMetrics(awsRequestMetrics);<NEW_LINE>request.<MASK><NEW_LINE>request.addHandlerContext(HandlerContextKey.ENDPOINT_OVERRIDDEN, isEndpointOverridden());<NEW_LINE>request.addHandlerContext(HandlerContextKey.SIGNING_REGION, getSigningRegion());<NEW_LINE>request.addHandlerContext(HandlerContextKey.SERVICE_ID, "LookoutVision");<NEW_LINE>request.addHandlerContext(HandlerContextKey.OPERATION_NAME, "UpdateDatasetEntries");<NEW_LINE>request.addHandlerContext(HandlerContextKey.ADVANCED_CONFIG, advancedConfig);<NEW_LINE>} finally {<NEW_LINE>awsRequestMetrics.endEvent(Field.RequestMarshallTime);<NEW_LINE>}<NEW_LINE>HttpResponseHandler<AmazonWebServiceResponse<UpdateDatasetEntriesResult>> responseHandler = protocolFactory.createResponseHandler(new JsonOperationMetadata().withPayloadJson(true).withHasStreamingSuccessResponse(false), new UpdateDatasetEntriesResultJsonUnmarshaller());<NEW_LINE>response = invoke(request, responseHandler, executionContext);<NEW_LINE>return response.getAwsResponse();<NEW_LINE>} finally {<NEW_LINE>endClientExecution(awsRequestMetrics, request, response);<NEW_LINE>}<NEW_LINE>} | addHandlerContext(HandlerContextKey.CLIENT_ENDPOINT, endpoint); |
1,801,341 | // ---------------------------------------------------------------- print<NEW_LINE>public void printBeans(final int width) {<NEW_LINE>final Print print = new Print();<NEW_LINE>print.line("Beans", width);<NEW_LINE>final List<BeanDefinition> beanDefinitionList = new ArrayList<>();<NEW_LINE>final String appName = appNameSupplier.get();<NEW_LINE>final String prefix = appName + ".";<NEW_LINE>petiteContainer.forEachBean(beanDefinitionList::add);<NEW_LINE>beanDefinitionList.stream().sorted((bd1, bd2) -> {<NEW_LINE>if (bd1.name().startsWith(prefix)) {<NEW_LINE>if (bd2.name().startsWith(prefix)) {<NEW_LINE>return bd1.name().compareTo(bd2.name());<NEW_LINE>}<NEW_LINE>return 1;<NEW_LINE>}<NEW_LINE>if (bd2.name().startsWith(prefix)) {<NEW_LINE>if (bd1.name().startsWith(prefix)) {<NEW_LINE>return bd1.name().compareTo(bd2.name());<NEW_LINE>}<NEW_LINE>return -1;<NEW_LINE>}<NEW_LINE>return bd1.name().compareTo(bd2.name());<NEW_LINE>}).forEach(beanDefinition -> {<NEW_LINE>print.out(Chalk256.chalk().yellow()<MASK><NEW_LINE>print.space();<NEW_LINE>print.outLeftRightNewLine(Chalk256.chalk().green(), beanDefinition.name(), Chalk256.chalk().blue(), ClassUtil.getShortClassName(beanDefinition.type(), 2), width - 10 - 1);<NEW_LINE>});<NEW_LINE>print.line(width);<NEW_LINE>} | , scopeName(beanDefinition), 10); |
1,776,985 | private boolean pivot() {<NEW_LINE>assert rmark[minr] < 0;<NEW_LINE>for (int j = 0; j < cmark.length; j++) {<NEW_LINE>if (cmark[j] == minr) {<NEW_LINE>assert rsel[minr] >= 0;<NEW_LINE>// Unmark column.<NEW_LINE>cmark[j] = -1;<NEW_LINE>// Mark row.<NEW_LINE>rmark[minr] = minc;<NEW_LINE>// Update rmin, because we removed cmark on j:<NEW_LINE><MASK><NEW_LINE>for (int i = 0; i < rmin.length; i++) {<NEW_LINE>final double c = cost[i][j] - radj[i] - cadjj;<NEW_LINE>if (c < rmin[i]) {<NEW_LINE>rmin[i] = c;<NEW_LINE>rptr[i] = j;<NEW_LINE>}<NEW_LINE>}<NEW_LINE>return true;<NEW_LINE>}<NEW_LINE>}<NEW_LINE>return false;<NEW_LINE>} | final double cadjj = cadj[j]; |
1,821,813 | public ThingGroupIndexingConfiguration unmarshall(JsonUnmarshallerContext context) throws Exception {<NEW_LINE>ThingGroupIndexingConfiguration thingGroupIndexingConfiguration = new ThingGroupIndexingConfiguration();<NEW_LINE>int originalDepth = context.getCurrentDepth();<NEW_LINE>String currentParentElement = context.getCurrentParentElement();<NEW_LINE>int targetDepth = originalDepth + 1;<NEW_LINE>JsonToken token = context.getCurrentToken();<NEW_LINE>if (token == null)<NEW_LINE>token = context.nextToken();<NEW_LINE>if (token == VALUE_NULL) {<NEW_LINE>return null;<NEW_LINE>}<NEW_LINE>while (true) {<NEW_LINE>if (token == null)<NEW_LINE>break;<NEW_LINE>if (token == FIELD_NAME || token == START_OBJECT) {<NEW_LINE>if (context.testExpression("thingGroupIndexingMode", targetDepth)) {<NEW_LINE>context.nextToken();<NEW_LINE>thingGroupIndexingConfiguration.setThingGroupIndexingMode(context.getUnmarshaller(String.<MASK><NEW_LINE>}<NEW_LINE>if (context.testExpression("managedFields", targetDepth)) {<NEW_LINE>context.nextToken();<NEW_LINE>thingGroupIndexingConfiguration.setManagedFields(new ListUnmarshaller<Field>(FieldJsonUnmarshaller.getInstance()).unmarshall(context));<NEW_LINE>}<NEW_LINE>if (context.testExpression("customFields", targetDepth)) {<NEW_LINE>context.nextToken();<NEW_LINE>thingGroupIndexingConfiguration.setCustomFields(new ListUnmarshaller<Field>(FieldJsonUnmarshaller.getInstance()).unmarshall(context));<NEW_LINE>}<NEW_LINE>} else if (token == END_ARRAY || token == END_OBJECT) {<NEW_LINE>if (context.getLastParsedParentElement() == null || context.getLastParsedParentElement().equals(currentParentElement)) {<NEW_LINE>if (context.getCurrentDepth() <= originalDepth)<NEW_LINE>break;<NEW_LINE>}<NEW_LINE>}<NEW_LINE>token = context.nextToken();<NEW_LINE>}<NEW_LINE>return thingGroupIndexingConfiguration;<NEW_LINE>} | class).unmarshall(context)); |
1,260,502 | private void initTable(Rectangle maxBounds) {<NEW_LINE>table.setShowGrid(false);<NEW_LINE>table.setCellSelectionEnabled(true);<NEW_LINE>table.setAutoscrolls(false);<NEW_LINE>// +4 for icon<NEW_LINE>table.setRowHeight(table.getRowHeight() + 4);<NEW_LINE>// Get Graphics resp. FontRenderContext from an off-screen image<NEW_LINE>BufferedImage image = new BufferedImage(4, 4, BufferedImage.TYPE_INT_RGB);<NEW_LINE>Graphics2D g = (Graphics2D) image.getGraphics();<NEW_LINE>Font font = table.getFont();<NEW_LINE>FontMetrics fm = g.getFontMetrics(font);<NEW_LINE>int maxWidth = 1;<NEW_LINE>// Extra two pixels for spaces between lines<NEW_LINE>int maxHeight = fm.getHeight() + 2;<NEW_LINE>for (int i = tableModel.getEntryCount() - 1; i >= 0; i--) {<NEW_LINE>String value = (String) tableModel.getValueAt(i, 0);<NEW_LINE>int stringWidth = fm.stringWidth(value);<NEW_LINE>maxWidth = Math.max(maxWidth, stringWidth);<NEW_LINE>}<NEW_LINE>// Add icon width<NEW_LINE>maxWidth += 25;<NEW_LINE>// Add extra space occupied by cell borders? etc.<NEW_LINE>maxWidth += 12;<NEW_LINE>int columnEntryCount = maxBounds.height / maxHeight;<NEW_LINE>int columnCount = tableModel.setColumnEntryCount(columnEntryCount);<NEW_LINE>table.setTableHeader(null);<NEW_LINE>TableCellRenderer cellRenderer = new BookmarkNodeRenderer(true);<NEW_LINE>// 1 column by default<NEW_LINE><MASK><NEW_LINE>TableColumn column = columnModel.getColumn(0);<NEW_LINE>column.setCellRenderer(cellRenderer);<NEW_LINE>column.setPreferredWidth(maxWidth);<NEW_LINE>while (columnModel.getColumnCount() < columnCount) {<NEW_LINE>column = new TableColumn(columnModel.getColumnCount());<NEW_LINE>column.setPreferredWidth(maxWidth);<NEW_LINE>column.setCellRenderer(cellRenderer);<NEW_LINE>columnModel.addColumn(column);<NEW_LINE>}<NEW_LINE>table.addKeyListener(this);<NEW_LINE>} | TableColumnModel columnModel = table.getColumnModel(); |
446,276 | protected void generateMethodInvoker(MethodVisitor mv, Method method) {<NEW_LINE>int invokeOpcode;<NEW_LINE>if ((method.getModifiers() & STATIC) == 0) {<NEW_LINE>// context object is the instance whose method we want to call<NEW_LINE>mv.visitVarInsn(ALOAD, 1);<NEW_LINE><MASK><NEW_LINE>invokeOpcode = hostIsInterface ? INVOKEINTERFACE : INVOKEVIRTUAL;<NEW_LINE>} else {<NEW_LINE>// fast-class static method invokers don't use the context object<NEW_LINE>invokeOpcode = INVOKESTATIC;<NEW_LINE>}<NEW_LINE>unpackArguments(mv, method.getParameterTypes());<NEW_LINE>mv.visitMethodInsn(invokeOpcode, hostName, method.getName(), Type.getMethodDescriptor(method), hostIsInterface);<NEW_LINE>Class<?> returnType = method.getReturnType();<NEW_LINE>if (returnType == void.class) {<NEW_LINE>mv.visitInsn(ACONST_NULL);<NEW_LINE>} else if (returnType.isPrimitive()) {<NEW_LINE>box(mv, Type.getType(returnType));<NEW_LINE>}<NEW_LINE>} | mv.visitTypeInsn(CHECKCAST, hostName); |
1,533,557 | synchronized protected void downloadAssetBundle(final AssetBundle assetBundle, HttpUrl baseUrl) {<NEW_LINE>Set<AssetBundle.Asset> missingAssets = new HashSet<AssetBundle.Asset>();<NEW_LINE>for (AssetBundle.Asset asset : assetBundle.getOwnAssets()) {<NEW_LINE>// Create containing directories for the asset if necessary<NEW_LINE>File containingDirectory = asset.getFile().getParentFile();<NEW_LINE>if (!containingDirectory.exists()) {<NEW_LINE>if (!containingDirectory.mkdirs()) {<NEW_LINE>didFail(new IOException("Could not create containing directory: " + containingDirectory));<NEW_LINE>return;<NEW_LINE>}<NEW_LINE>}<NEW_LINE>// If we find a cached asset, we copy it<NEW_LINE>AssetBundle<MASK><NEW_LINE>if (cachedAsset != null) {<NEW_LINE>try {<NEW_LINE>resourceApi.copyResource(cachedAsset.getFileUri(), asset.getFileUri());<NEW_LINE>} catch (IOException e) {<NEW_LINE>didFail(e);<NEW_LINE>return;<NEW_LINE>}<NEW_LINE>} else {<NEW_LINE>missingAssets.add(asset);<NEW_LINE>}<NEW_LINE>}<NEW_LINE>// If all assets were cached, there is no need to start a download<NEW_LINE>if (missingAssets.isEmpty()) {<NEW_LINE>didFinishDownloadingAssetBundle(assetBundle);<NEW_LINE>return;<NEW_LINE>}<NEW_LINE>assetBundleDownloader = new AssetBundleDownloader(webAppConfiguration, assetBundle, baseUrl, missingAssets);<NEW_LINE>assetBundleDownloader.setCallback(new AssetBundleDownloader.Callback() {<NEW_LINE><NEW_LINE>@Override<NEW_LINE>public void onFinished() {<NEW_LINE>assetBundleDownloader = null;<NEW_LINE>moveDownloadedAssetBundleIntoPlace(assetBundle);<NEW_LINE>didFinishDownloadingAssetBundle(assetBundle);<NEW_LINE>}<NEW_LINE><NEW_LINE>@Override<NEW_LINE>public void onFailure(Throwable cause) {<NEW_LINE>didFail(cause);<NEW_LINE>}<NEW_LINE>});<NEW_LINE>assetBundleDownloader.resume();<NEW_LINE>} | .Asset cachedAsset = cachedAssetForAsset(asset); |
249,147 | public PeerComponent createBrowserComponent(Object browserComponent) {<NEW_LINE>synchronized (UiApplication.getEventLock()) {<NEW_LINE>BrowserField bff = new BrowserField();<NEW_LINE><MASK><NEW_LINE>bff.addListener(new BrowserFieldListener() {<NEW_LINE><NEW_LINE>public void documentError(BrowserField browserField, Document document) throws Exception {<NEW_LINE>cmp.fireWebEvent("onError", new ActionEvent(document.getDocumentURI()));<NEW_LINE>super.documentError(browserField, document);<NEW_LINE>}<NEW_LINE><NEW_LINE>public void documentCreated(BrowserField browserField, ScriptEngine scriptEngine, Document document) throws Exception {<NEW_LINE>cmp.fireWebEvent("onStart", new ActionEvent(document.getDocumentURI()));<NEW_LINE>super.documentCreated(browserField, scriptEngine, document);<NEW_LINE>}<NEW_LINE><NEW_LINE>public void documentLoaded(BrowserField browserField, Document document) throws Exception {<NEW_LINE>cmp.fireWebEvent("onLoad", new ActionEvent(document.getDocumentURI()));<NEW_LINE>super.documentLoaded(browserField, document);<NEW_LINE>}<NEW_LINE>});<NEW_LINE>return PeerComponent.create(bff);<NEW_LINE>}<NEW_LINE>} | final BrowserComponent cmp = (BrowserComponent) browserComponent; |
1,622,014 | public List<NetworkAddressAlias> loadLastUpdate(long timeBucket) {<NEW_LINE>StringBuilder query = new StringBuilder();<NEW_LINE>query.append("select * from ");<NEW_LINE>IoTDBUtils.addModelPath(client.getStorageGroup(), query, NetworkAddressAlias.INDEX_NAME);<NEW_LINE>IoTDBUtils.addQueryAsterisk(NetworkAddressAlias.INDEX_NAME, query);<NEW_LINE>query.append(" where ").append(NetworkAddressAlias.LAST_UPDATE_TIME_BUCKET).append(" >= ").append(timeBucket).append(IoTDBClient.ALIGN_BY_DEVICE);<NEW_LINE>try {<NEW_LINE>List<? super StorageData> storageDataList = client.filterQuery(NetworkAddressAlias.INDEX_NAME, query.toString(), storageBuilder);<NEW_LINE>List<NetworkAddressAlias> networkAddressAliases = new ArrayList<<MASK><NEW_LINE>storageDataList.forEach(storageData -> networkAddressAliases.add((NetworkAddressAlias) storageData));<NEW_LINE>return networkAddressAliases;<NEW_LINE>} catch (IOException e) {<NEW_LINE>log.error(e.getMessage(), e);<NEW_LINE>}<NEW_LINE>return new ArrayList<>();<NEW_LINE>} | >(storageDataList.size()); |
298,306 | private PlanFragment constructShuffleJoin(AbstractPhysicalJoin<PhysicalPlan, PhysicalPlan> physicalHashJoin, HashJoinNode hashJoinNode, PlanFragment leftFragment, PlanFragment rightFragment, PlanTranslatorContext context) {<NEW_LINE>hashJoinNode.setDistributionMode(HashJoinNode.DistributionMode.PARTITIONED);<NEW_LINE>// TODO should according nereids distribute indicate<NEW_LINE>// first, extract join exprs<NEW_LINE>List<BinaryPredicate> eqJoinConjuncts = hashJoinNode.getEqJoinConjuncts();<NEW_LINE>List<Expr> lhsJoinExprs = Lists.newArrayList();<NEW_LINE>List<Expr> rhsJoinExprs = Lists.newArrayList();<NEW_LINE>for (BinaryPredicate eqJoinPredicate : eqJoinConjuncts) {<NEW_LINE>// no remapping necessary<NEW_LINE>lhsJoinExprs.add(eqJoinPredicate.getChild(<MASK><NEW_LINE>rhsJoinExprs.add(eqJoinPredicate.getChild(1).clone(null));<NEW_LINE>}<NEW_LINE>// create the parent fragment containing the HashJoin node<NEW_LINE>DataPartition lhsJoinPartition = new DataPartition(TPartitionType.HASH_PARTITIONED, Expr.cloneList(lhsJoinExprs, null));<NEW_LINE>DataPartition rhsJoinPartition = new DataPartition(TPartitionType.HASH_PARTITIONED, rhsJoinExprs);<NEW_LINE>PlanFragment joinFragment = new PlanFragment(context.nextFragmentId(), hashJoinNode, lhsJoinPartition);<NEW_LINE>context.addPlanFragment(joinFragment);<NEW_LINE>connectChildFragment(hashJoinNode, 0, joinFragment, leftFragment, context);<NEW_LINE>connectChildFragment(hashJoinNode, 1, joinFragment, rightFragment, context);<NEW_LINE>leftFragment.setOutputPartition(lhsJoinPartition);<NEW_LINE>rightFragment.setOutputPartition(rhsJoinPartition);<NEW_LINE>return joinFragment;<NEW_LINE>} | 0).clone(null)); |
1,514,457 | public void onTraversalStart() {<NEW_LINE>if (VALIDATE_GVCF) {<NEW_LINE>final SAMSequenceDictionary seqDictionary = getBestAvailableSequenceDictionary();<NEW_LINE>if (seqDictionary == null)<NEW_LINE>throw new UserException("Validating a GVCF requires a sequence dictionary but no dictionary was able to be constructed from your input.");<NEW_LINE>genomeLocSortedSet = new GenomeLocSortedSet(new GenomeLocParser(seqDictionary));<NEW_LINE>}<NEW_LINE>validationTypes = calculateValidationTypesToApply(excludeTypes);<NEW_LINE>// warn user if certain requested validations cannot be done due to lack of arguments<NEW_LINE>if (dbsnp.dbsnp == null && (validationTypes.contains(ValidationType.ALL) || validationTypes.contains(ValidationType.IDS))) {<NEW_LINE>logger.warn("IDS validation cannot be done because no DBSNP file was provided");<NEW_LINE>logger.warn("Other possible validations will still be performed");<NEW_LINE>}<NEW_LINE>if (!hasReference() && (validationTypes.contains(ValidationType.ALL) || validationTypes.contains(ValidationType.REF))) {<NEW_LINE>logger.warn("REF validation cannot be done because no reference file was provided");<NEW_LINE>logger.warn("Other possible validations will still be performed");<NEW_LINE>}<NEW_LINE>if (hasReference()) {<NEW_LINE>referenceReader = ReferenceUtils.<MASK><NEW_LINE>}<NEW_LINE>} | createReferenceReader(referenceArguments.getReferenceSpecifier()); |
1,516,013 | public AggregationFunctionForge resolveAggregationFunction(String functionName, ClasspathExtensionAggregationFunction extension) throws ClasspathImportUndefinedException, ClasspathImportException {<NEW_LINE>Class inlined = extension.resolveAggregationFunction(functionName);<NEW_LINE>Class forgeClass;<NEW_LINE>String className;<NEW_LINE>if (inlined != null) {<NEW_LINE>forgeClass = inlined;<NEW_LINE>className = inlined.getName();<NEW_LINE>} else {<NEW_LINE>ConfigurationCompilerPlugInAggregationFunction desc = aggregationFunctions.get(functionName);<NEW_LINE>if (desc == null) {<NEW_LINE>desc = aggregationFunctions.get(functionName.toLowerCase(Locale.ENGLISH));<NEW_LINE>}<NEW_LINE>if (desc == null || desc.getForgeClassName() == null) {<NEW_LINE>throw new ClasspathImportUndefinedException("A function named '" + functionName + "' is not defined");<NEW_LINE>}<NEW_LINE>className = desc.getForgeClassName();<NEW_LINE>try {<NEW_LINE>forgeClass = <MASK><NEW_LINE>} catch (ClassNotFoundException ex) {<NEW_LINE>throw new ClasspathImportException("Could not load aggregation factory class by name '" + className + "'", ex);<NEW_LINE>}<NEW_LINE>}<NEW_LINE>Object object;<NEW_LINE>try {<NEW_LINE>object = forgeClass.newInstance();<NEW_LINE>} catch (InstantiationException e) {<NEW_LINE>throw new ClasspathImportException("Error instantiating aggregation factory class by name '" + className + "'", e);<NEW_LINE>} catch (IllegalAccessException e) {<NEW_LINE>throw new ClasspathImportException("Illegal access instantiating aggregation factory class by name '" + className + "'", e);<NEW_LINE>}<NEW_LINE>if (!(object instanceof AggregationFunctionForge)) {<NEW_LINE>throw new ClasspathImportException("Class by name '" + className + "' does not implement the " + AggregationFunctionForge.class.getSimpleName() + " interface");<NEW_LINE>}<NEW_LINE>return (AggregationFunctionForge) object;<NEW_LINE>} | getClassForNameProvider().classForName(className); |
192,538 | public void validate() {<NEW_LINE>column.getArgumentDefinitions().forEach(arg -> {<NEW_LINE>verifyValues(arg, errorMsgPrefix);<NEW_LINE>verifyDefaultValue(arg, errorMsgPrefix);<NEW_LINE>});<NEW_LINE>List<Reference> references = parser.parse(table, column.getExpression());<NEW_LINE>ReferenceExtractor<LogicalReference> logicalRefExtractor = new ReferenceExtractor<LogicalReference>(LogicalReference.class, metaDataStore, ReferenceExtractor.Mode.SAME_COLUMN);<NEW_LINE>ReferenceExtractor<ColumnArgReference> columnArgRefExtractor = new ReferenceExtractor<ColumnArgReference>(ColumnArgReference.class, metaDataStore, ReferenceExtractor.Mode.SAME_COLUMN);<NEW_LINE>references.stream().map(reference -> reference.accept(columnArgRefExtractor)).flatMap(Set::stream).map(ColumnArgReference::getArgName).forEach(argName -> {<NEW_LINE>if (!column.hasArgumentDefinition(argName) && !hasTemplateFilterArgument(argName)) {<NEW_LINE>throw new IllegalStateException(String.format(errorMsgPrefix + "Argument '%s' is not defined but found '{{$$column.args.%s}}'.", argName, argName));<NEW_LINE>}<NEW_LINE>});<NEW_LINE>references.stream().map(reference -> reference.accept(logicalRefExtractor)).flatMap(Set::stream<MASK><NEW_LINE>} | ).forEach(this::verifyLogicalReference); |
1,713,267 | private void addWaypoint(@Nullable GPXFile gpxFile, @NonNull MapActivity mapActivity) {<NEW_LINE>LatLon latLon = mapActivity.getMapView().getCurrentRotatedTileBox().getCenterLatLon();<NEW_LINE>boolean usePredefinedWaypoint = Boolean.parseBoolean(getParams().get(KEY_USE_PREDEFINED_WPT_APPEARANCE));<NEW_LINE>if (usePredefinedWaypoint) {<NEW_LINE>WptPt wptPt = createWaypoint();<NEW_LINE>wptPt.lat = latLon.getLatitude();<NEW_LINE>wptPt.lon = latLon.getLongitude();<NEW_LINE>wptPt.time = System.currentTimeMillis();<NEW_LINE>String categoryName = <MASK><NEW_LINE>int categoryColor = getColorFromParams(KEY_CATEGORY_COLOR, 0);<NEW_LINE>if (Algorithms.isBlank(wptPt.name) && Algorithms.isBlank(wptPt.getAddress())) {<NEW_LINE>lookupAddress(latLon, mapActivity, foundAddress -> {<NEW_LINE>wptPt.name = foundAddress;<NEW_LINE>mapActivity.getContextMenu().addWptPt(wptPt, categoryName, categoryColor, true, gpxFile);<NEW_LINE>return true;<NEW_LINE>});<NEW_LINE>} else {<NEW_LINE>if (Algorithms.isBlank(wptPt.name)) {<NEW_LINE>wptPt.name = wptPt.getAddress();<NEW_LINE>wptPt.setAddress(null);<NEW_LINE>}<NEW_LINE>mapActivity.getContextMenu().addWptPt(wptPt, categoryName, categoryColor, true, gpxFile);<NEW_LINE>}<NEW_LINE>} else {<NEW_LINE>WptPt wptPt = new WptPt(latLon.getLatitude(), latLon.getLongitude(), System.currentTimeMillis(), Double.NaN, 0, Double.NaN);<NEW_LINE>mapActivity.getContextMenu().addWptPt(wptPt, null, 0, false, gpxFile);<NEW_LINE>}<NEW_LINE>} | getParams().get(KEY_CATEGORY_NAME); |
1,574,540 | boolean planarSimplifyNoCrackingAndCluster(boolean OGCoutput, EditShape shape, int geom, ProgressTracker progress_tracker) {<NEW_LINE>m_bOGCOutput = OGCoutput;<NEW_LINE>m_topo_graph = new TopoGraph();<NEW_LINE>int rule = shape.getFillRule(geom);<NEW_LINE>int gt = shape.getGeometryType(geom);<NEW_LINE>if (rule != Polygon.FillRule.enumFillRuleWinding || gt == GeometryType.MultiPoint)<NEW_LINE>m_topo_graph.setAndSimplifyEditShapeAlternate(shape, geom, progress_tracker);<NEW_LINE>else<NEW_LINE>m_topo_graph.<MASK><NEW_LINE>if (m_topo_graph.dirty_check_failed())<NEW_LINE>return false;<NEW_LINE>m_topo_graph.check_dirty_planesweep(NumberUtils.TheNaN);<NEW_LINE>int ID_a = m_topo_graph.getGeometryID(geom);<NEW_LINE>initMaskLookupArray_((ID_a) + 1);<NEW_LINE>// Works only when there is a single geometry in the edit shape.<NEW_LINE>m_mask_lookup[ID_a] = true;<NEW_LINE>// To make it work when many geometries are present, this need to be modified.<NEW_LINE>if (shape.getGeometryType(geom) == GeometryType.Polygon || (rule == Polygon.FillRule.enumFillRuleWinding && shape.getGeometryType(geom) != GeometryType.MultiPoint)) {<NEW_LINE>// geom can be a polygon or a polyline.<NEW_LINE>// It can be a polyline only when the winding rule is true.<NEW_LINE>shape.setFillRule(geom, Polygon.FillRule.enumFillRuleOddEven);<NEW_LINE>int resGeom = topoOperationPolygonPolygon_(geom, -1, -1);<NEW_LINE>shape.swapGeometry(resGeom, geom);<NEW_LINE>shape.removeGeometry(resGeom);<NEW_LINE>} else if (shape.getGeometryType(geom) == GeometryType.Polyline) {<NEW_LINE>int resGeom = topoOperationPolylinePolylineOrPolygon_(-1);<NEW_LINE>shape.swapGeometry(resGeom, geom);<NEW_LINE>shape.removeGeometry(resGeom);<NEW_LINE>} else if (shape.getGeometryType(geom) == GeometryType.MultiPoint) {<NEW_LINE>int resGeom = topoOperationMultiPoint_();<NEW_LINE>shape.swapGeometry(resGeom, geom);<NEW_LINE>shape.removeGeometry(resGeom);<NEW_LINE>} else {<NEW_LINE>throw new GeometryException("internal error");<NEW_LINE>}<NEW_LINE>return true;<NEW_LINE>} | setAndSimplifyEditShapeWinding(shape, geom, progress_tracker); |
486,312 | private ByteBuf deserialize(ImmutableList<Cookie> sessionCookies) throws Exception {<NEW_LINE>if (sessionCookies.isEmpty()) {<NEW_LINE>return Unpooled.EMPTY_BUFFER;<NEW_LINE>}<NEW_LINE>StringBuilder sessionCookie = new StringBuilder();<NEW_LINE>for (Cookie cookie : sessionCookies) {<NEW_LINE>sessionCookie.append(cookie.value());<NEW_LINE>}<NEW_LINE>String[] parts = sessionCookie.toString().split(SESSION_SEPARATOR);<NEW_LINE>if (parts.length != 2) {<NEW_LINE>return Unpooled.buffer(0, 0);<NEW_LINE>}<NEW_LINE>ByteBuf payload = null;<NEW_LINE>ByteBuf digest = null;<NEW_LINE>ByteBuf expectedDigest = null;<NEW_LINE>ByteBuf decryptedPayload = null;<NEW_LINE>try {<NEW_LINE>payload = fromBase64(bufferAllocator, parts[0]);<NEW_LINE>digest = fromBase64(bufferAllocator, parts[1]);<NEW_LINE>expectedDigest = signer.sign(payload, bufferAllocator);<NEW_LINE>if (ByteBufUtil.equals(digest, expectedDigest)) {<NEW_LINE>decryptedPayload = crypto.decrypt(payload.resetReaderIndex(), bufferAllocator);<NEW_LINE>} else {<NEW_LINE>decryptedPayload = <MASK><NEW_LINE>}<NEW_LINE>} finally {<NEW_LINE>if (payload != null) {<NEW_LINE>payload.touch().release();<NEW_LINE>}<NEW_LINE>if (digest != null) {<NEW_LINE>digest.release();<NEW_LINE>}<NEW_LINE>if (expectedDigest != null) {<NEW_LINE>expectedDigest.release();<NEW_LINE>}<NEW_LINE>}<NEW_LINE>return decryptedPayload.touch();<NEW_LINE>} | Unpooled.buffer(0, 0); |
479,072 | private void handle(APILogInByUserMsg msg) {<NEW_LINE>APILogInReply reply = new APILogInReply();<NEW_LINE>String accountUuid;<NEW_LINE>if (msg.getAccountUuid() != null) {<NEW_LINE>accountUuid = msg.getAccountUuid();<NEW_LINE>} else {<NEW_LINE>SimpleQuery<AccountVO> accountq = dbf.createQuery(AccountVO.class);<NEW_LINE>accountq.select(AccountVO_.uuid);<NEW_LINE>accountq.add(AccountVO_.name, Op.EQ, msg.getAccountName());<NEW_LINE>accountUuid = accountq.findValue();<NEW_LINE>if (accountUuid == null) {<NEW_LINE>reply.setError(err(IdentityErrors.AUTHENTICATION_ERROR, "wrong account or username or password"));<NEW_LINE>bus.reply(msg, reply);<NEW_LINE>return;<NEW_LINE>}<NEW_LINE>}<NEW_LINE>SimpleQuery<UserVO> q = dbf.createQuery(UserVO.class);<NEW_LINE>q.add(UserVO_.accountUuid, Op.EQ, accountUuid);<NEW_LINE>q.add(UserVO_.password, Op.<MASK><NEW_LINE>q.add(UserVO_.name, Op.EQ, msg.getUserName());<NEW_LINE>UserVO user = q.find();<NEW_LINE>if (user == null) {<NEW_LINE>reply.setError(err(IdentityErrors.AUTHENTICATION_ERROR, "wrong account or username or password"));<NEW_LINE>bus.reply(msg, reply);<NEW_LINE>return;<NEW_LINE>}<NEW_LINE>SessionInventory session = getSession(user.getAccountUuid(), user.getUuid());<NEW_LINE>msg.setSession(session);<NEW_LINE>reply.setInventory(session);<NEW_LINE>bus.reply(msg, reply);<NEW_LINE>} | EQ, msg.getPassword()); |
964,968 | public void loadData(FileObject file, FileLock dataLock) throws IOException {<NEW_LINE>try {<NEW_LINE>BufferedInputStream inputStream = new <MASK><NEW_LINE>String encoding = encodingHelper.detectEncoding(inputStream);<NEW_LINE>if (!encodingHelper.getEncoding().equals(encoding)) {<NEW_LINE>showUsingDifferentEncodingMessage(encoding);<NEW_LINE>}<NEW_LINE>Reader reader = new InputStreamReader(inputStream, encodingHelper.getEncoding());<NEW_LINE>long time;<NEW_LINE>StringBuffer sb = new StringBuffer(2048);<NEW_LINE>try {<NEW_LINE>char[] buf = new char[1024];<NEW_LINE>time = file.lastModified().getTime();<NEW_LINE>int i;<NEW_LINE>while ((i = reader.read(buf, 0, 1024)) != -1) {<NEW_LINE>sb.append(buf, 0, i);<NEW_LINE>}<NEW_LINE>} finally {<NEW_LINE>reader.close();<NEW_LINE>}<NEW_LINE>buffer = null;<NEW_LINE>fileTime = time;<NEW_LINE>setData(dataLock, sb.toString(), true);<NEW_LINE>} finally {<NEW_LINE>dataLock.releaseLock();<NEW_LINE>}<NEW_LINE>} | BufferedInputStream(file.getInputStream()); |
1,678,926 | private List<String[]> fetchData(String[][] fieldsData, Query<? extends Model> query, Map<String, String> selectMap, ResourceBundle bundle) {<NEW_LINE>List<String[]> dataList = new ArrayList<>();<NEW_LINE>dataList.add(fieldsData[1]);<NEW_LINE>List<Map> records = query.select(fieldsData[0]).fetch(0, 0);<NEW_LINE>for (Map<String, Object> recordMap : records) {<NEW_LINE>List<String> datas = new ArrayList<>();<NEW_LINE>for (String field : fieldsData[0]) {<NEW_LINE>Object <MASK><NEW_LINE>if (object == null) {<NEW_LINE>datas.add("");<NEW_LINE>continue;<NEW_LINE>}<NEW_LINE>if (selectMap.containsKey(field)) {<NEW_LINE>String selection = selectMap.get(field);<NEW_LINE>Option option = MetaStore.getSelectionItem(selection, object.toString());<NEW_LINE>if (option == null) {<NEW_LINE>datas.add("");<NEW_LINE>continue;<NEW_LINE>}<NEW_LINE>String optionTitle = option.getTitle();<NEW_LINE>optionTitle = bundle.getString(optionTitle);<NEW_LINE>if (optionTitle != null) {<NEW_LINE>datas.add(optionTitle);<NEW_LINE>} else {<NEW_LINE>datas.add(option.getTitle());<NEW_LINE>}<NEW_LINE>} else {<NEW_LINE>datas.add(object.toString());<NEW_LINE>}<NEW_LINE>}<NEW_LINE>dataList.add(datas.toArray(new String[fieldsData[0].length]));<NEW_LINE>}<NEW_LINE>return dataList;<NEW_LINE>} | object = recordMap.get(field); |
946,606 | // GEN-LAST:event_createNewPlatform<NEW_LINE>private void librariesBrowseActionPerformed(java.awt.event.ActionEvent evt) {<NEW_LINE>// GEN-FIRST:event_librariesBrowseActionPerformed<NEW_LINE>if (!isSharable) {<NEW_LINE>boolean result = makeSharable(uiProperties);<NEW_LINE>if (result) {<NEW_LINE>isSharable = true;<NEW_LINE>sharedLibrariesLabel.setEnabled(true);<NEW_LINE>librariesLocation.setEnabled(true);<NEW_LINE>librariesLocation.setText(uiProperties.getProject().getAntProjectHelper().getLibrariesLocation());<NEW_LINE>// NOI18N<NEW_LINE>Mnemonics.setLocalizedText(librariesBrowse, NbBundle.getMessage(CustomizerLibraries.class, "LBL_CustomizerLibraries_Browse_JButton"));<NEW_LINE>updateJars(<MASK><NEW_LINE>updateJars(uiProperties.JAVAC_PROCESSORPATH_MODEL);<NEW_LINE>updateJars(uiProperties.JAVAC_TEST_CLASSPATH_MODEL);<NEW_LINE>updateJars(uiProperties.ENDORSED_CLASSPATH_MODEL);<NEW_LINE>updateJars(uiProperties.RUN_TEST_CLASSPATH_MODEL);<NEW_LINE>switchLibrary();<NEW_LINE>cleanupOldLibraryReferences();<NEW_LINE>}<NEW_LINE>} else {<NEW_LINE>File prjLoc = FileUtil.toFile(uiProperties.getProject().getProjectDirectory());<NEW_LINE>String[] s = splitPath(librariesLocation.getText().trim());<NEW_LINE>String loc = SharableLibrariesUtils.browseForLibraryLocation(s[0], this, prjLoc);<NEW_LINE>if (loc != null) {<NEW_LINE>librariesLocation.setText(s[1] != null ? loc + File.separator + s[1] : loc + File.separator + SharableLibrariesUtils.DEFAULT_LIBRARIES_FILENAME);<NEW_LINE>switchLibrary();<NEW_LINE>}<NEW_LINE>}<NEW_LINE>} | uiProperties.JAVAC_CLASSPATH_MODEL.getDefaultListModel()); |
904,735 | public void addEnvironment(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException, LanguageException, DotSecurityException {<NEW_LINE>try {<NEW_LINE>String identifier = request.getParameter("identifier");<NEW_LINE>if (UtilMethods.isSet(identifier)) {<NEW_LINE>editEnvironment(request, response);<NEW_LINE>return;<NEW_LINE>}<NEW_LINE>String name = request.getParameter("environmentName");<NEW_LINE>Environment existingEnv = APILocator.getEnvironmentAPI().findEnvironmentByName(name);<NEW_LINE>if (existingEnv != null) {<NEW_LINE>Logger.info(getClass(), "Can't save Environment. An Environment with the given name already exists. ");<NEW_LINE>User user = getUser();<NEW_LINE>response.getWriter().println("FAILURE: " + LanguageUtil.get(user, "publisher_Environment_name_exists"));<NEW_LINE>return;<NEW_LINE>}<NEW_LINE>String whoCanUseTmp = request.getParameter("whoCanUse");<NEW_LINE>Environment environment = new Environment();<NEW_LINE>environment.setName(name);<NEW_LINE>environment.setPushToAll("pushToAll".equals(request.getParameter("pushType")));<NEW_LINE>List<String> whoCanUse = Arrays.asList(whoCanUseTmp.split(","));<NEW_LINE>List<Permission> permissions = new ArrayList<Permission>();<NEW_LINE>for (String perm : whoCanUse) {<NEW_LINE>if (!UtilMethods.isSet(perm)) {<NEW_LINE>continue;<NEW_LINE>}<NEW_LINE>Role test = resolveRole(perm);<NEW_LINE>Permission p = new Permission(environment.getId(), test.getId(), PermissionAPI.PERMISSION_USE);<NEW_LINE>boolean exists = false;<NEW_LINE>for (Permission curr : permissions) exists = exists || curr.getRoleId().equals(p.getRoleId());<NEW_LINE>if (!exists)<NEW_LINE>permissions.add(p);<NEW_LINE>}<NEW_LINE>EnvironmentAPI eAPI = APILocator.getEnvironmentAPI();<NEW_LINE><MASK><NEW_LINE>response.getWriter().write(environment.getId());<NEW_LINE>} catch (DotDataException e) {<NEW_LINE>Logger.info(getClass(), e.getMessage());<NEW_LINE>throw new DotRuntimeException(e.getMessage(), e);<NEW_LINE>}<NEW_LINE>} | eAPI.saveEnvironment(environment, permissions); |
721,640 | public void handle(String target, Request baseRequest, HttpServletRequest request, HttpServletResponse response) throws IOException {<NEW_LINE>baseRequest.setHandled(true);<NEW_LINE>response.setContentType(CONTENT_TYPE);<NEW_LINE>final String message;<NEW_LINE>final javax.ws.rs.core.Response.Status status;<NEW_LINE>if (response instanceof Response) {<NEW_LINE>final Response r = (Response) response;<NEW_LINE>status = javax.ws.rs.core.Response.Status.fromStatusCode(r.getStatus());<NEW_LINE>} else {<NEW_LINE>status = javax.ws.rs<MASK><NEW_LINE>}<NEW_LINE>final Throwable cause = (Throwable) request.getAttribute(Dispatcher.ERROR_EXCEPTION);<NEW_LINE>if (cause != null && cause.getMessage() != null) {<NEW_LINE>message = cause.getMessage();<NEW_LINE>} else if (cause instanceof NullPointerException) {<NEW_LINE>message = "NPE";<NEW_LINE>} else {<NEW_LINE>message = status.getReasonPhrase();<NEW_LINE>}<NEW_LINE>final InternalErrorMessage info = new InternalErrorMessage(message, status);<NEW_LINE>response.setStatus(status.getStatusCode());<NEW_LINE>try (final ByteArrayOutputStream output = new ByteArrayOutputStream(4096)) {<NEW_LINE>final OutputStreamWriter writer = new OutputStreamWriter(output, Charsets.UTF_8);<NEW_LINE>mapper.writeValue(writer, info);<NEW_LINE>response.setContentLength(output.size());<NEW_LINE>output.writeTo(response.getOutputStream());<NEW_LINE>}<NEW_LINE>} | .core.Response.Status.INTERNAL_SERVER_ERROR; |
736,721 | public static boolean writeConfiguration(ApdConfiguration apdConfiguration) throws IOException {<NEW_LINE>Common.logger.add(new LogEntry(LogEntry.PB_LOG_DEBUG, "Start"));<NEW_LINE>if (apdConfiguration == null) {<NEW_LINE>Common.logger.add(new LogEntry<MASK><NEW_LINE>return false;<NEW_LINE>}<NEW_LINE>FileWriter apdConfigFileWriter = null;<NEW_LINE>BufferedWriter fileBufferedWriter = null;<NEW_LINE>// Carry out some sanity check on the configuration passed as parameter<NEW_LINE>if ((apdConfiguration.getFormatPath() == null) || (apdConfiguration.getFormatPath().length() == 0))<NEW_LINE>apdConfiguration.setFormatPath(ApdEngine.DEFAULT_FORMAT_PATH);<NEW_LINE>if ((apdConfiguration.getTemplatePath() == null) || (apdConfiguration.getTemplatePath().length() == 0))<NEW_LINE>apdConfiguration.setTemplatePath(ApdEngine.DEFAULT_TEMPLATE_PATH);<NEW_LINE>if ((apdConfiguration.getLabelIdPath() == null) || (apdConfiguration.getLabelIdPath().length() == 0))<NEW_LINE>apdConfiguration.setTemplatePath(ApdEngine.DEFAULT_ID_PATH);<NEW_LINE>File apdConfigFile = new File(APD_CONFIGURATION_FILE);<NEW_LINE>apdConfigFile.delete();<NEW_LINE>apdConfigFileWriter = new FileWriter(apdConfigFile);<NEW_LINE>fileBufferedWriter = new BufferedWriter(apdConfigFileWriter);<NEW_LINE>fileBufferedWriter.write("<apdconfiguration>\r\n");<NEW_LINE>fileBufferedWriter.write("\t<path ");<NEW_LINE>fileBufferedWriter.write("formats=\"" + (apdConfiguration.getFormatPath() == null ? "" : apdConfiguration.getFormatPath()) + "\"\r\n");<NEW_LINE>fileBufferedWriter.write("\t\ttemplates=\"" + (apdConfiguration.getTemplatePath() == null ? "" : apdConfiguration.getTemplatePath()) + "\"\r\n");<NEW_LINE>fileBufferedWriter.write("\t\tidlabels=\"" + (apdConfiguration.getLabelIdPath() == null ? "" : apdConfiguration.getLabelIdPath()) + "\" />\r\n");<NEW_LINE>fileBufferedWriter.write("\t<printer ");<NEW_LINE>fileBufferedWriter.write("bluetooth=\"" + (apdConfiguration.getBtMac() == null ? "" : apdConfiguration.getBtMac()) + "\"\r\n");<NEW_LINE>fileBufferedWriter.write("\tid=\"" + apdConfiguration.getId() + "\"\r\n");<NEW_LINE>fileBufferedWriter.write("\tipaddress=\"" + (apdConfiguration.getIpAddress() == null ? "" : apdConfiguration.getIpAddress()) + "\"\r\n");<NEW_LINE>fileBufferedWriter.write("\tipport=\"" + apdConfiguration.getIpPort() + "\"\r\n");<NEW_LINE>fileBufferedWriter.write(// 65 = ASCII code of 'A'<NEW_LINE>"\tlanguage=\"" + (apdConfiguration.getLanguage() == null ? "" : String.valueOf((char) (apdConfiguration.getLanguage().ordinal() + 65)) + "\"\r\n"));<NEW_LINE>fileBufferedWriter.write("\tmessage=\"" + apdConfiguration.getMessage() + "\"\r\n");<NEW_LINE>fileBufferedWriter.write("\tmodel=\"" + apdConfiguration.getModel() + "\"\r\n");<NEW_LINE>fileBufferedWriter.write("\ttransport=\"" + apdConfiguration.getTransport().ordinal() + "\"/>\r\n");<NEW_LINE>fileBufferedWriter.write("</apdconfiguration>\r\n");<NEW_LINE>fileBufferedWriter.flush();<NEW_LINE>fileBufferedWriter.close();<NEW_LINE>Common.logger.add(new LogEntry(LogEntry.PB_LOG_INFO, "apdconfig.xml written succesfully"));<NEW_LINE>Common.logger.add(new LogEntry(LogEntry.PB_LOG_DEBUG, "End"));<NEW_LINE>return true;<NEW_LINE>} | (LogEntry.PB_LOG_ERROR, "apdConfiguration not valid")); |
587,481 | final BatchGetAggregateResourceConfigResult executeBatchGetAggregateResourceConfig(BatchGetAggregateResourceConfigRequest batchGetAggregateResourceConfigRequest) {<NEW_LINE>ExecutionContext executionContext = createExecutionContext(batchGetAggregateResourceConfigRequest);<NEW_LINE>AWSRequestMetrics awsRequestMetrics = executionContext.getAwsRequestMetrics();<NEW_LINE>awsRequestMetrics.startEvent(Field.ClientExecuteTime);<NEW_LINE>Request<BatchGetAggregateResourceConfigRequest> request = null;<NEW_LINE>Response<BatchGetAggregateResourceConfigResult> response = null;<NEW_LINE>try {<NEW_LINE><MASK><NEW_LINE>try {<NEW_LINE>request = new BatchGetAggregateResourceConfigRequestProtocolMarshaller(protocolFactory).marshall(super.beforeMarshalling(batchGetAggregateResourceConfigRequest));<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, "Config Service");<NEW_LINE>request.addHandlerContext(HandlerContextKey.OPERATION_NAME, "BatchGetAggregateResourceConfig");<NEW_LINE>request.addHandlerContext(HandlerContextKey.ADVANCED_CONFIG, advancedConfig);<NEW_LINE>} finally {<NEW_LINE>awsRequestMetrics.endEvent(Field.RequestMarshallTime);<NEW_LINE>}<NEW_LINE>HttpResponseHandler<AmazonWebServiceResponse<BatchGetAggregateResourceConfigResult>> responseHandler = protocolFactory.createResponseHandler(new JsonOperationMetadata().withPayloadJson(true).withHasStreamingSuccessResponse(false), new BatchGetAggregateResourceConfigResultJsonUnmarshaller());<NEW_LINE>response = invoke(request, responseHandler, executionContext);<NEW_LINE>return response.getAwsResponse();<NEW_LINE>} finally {<NEW_LINE>endClientExecution(awsRequestMetrics, request, response);<NEW_LINE>}<NEW_LINE>} | awsRequestMetrics.startEvent(Field.RequestMarshallTime); |
198,422 | public List<AutoScalingGroup> describeAutoScalingGroups(String... names) {<NEW_LINE>if (names == null || names.length == 0) {<NEW_LINE>LOGGER.info(String.format("Getting all auto-scaling groups in region %s.", region));<NEW_LINE>} else {<NEW_LINE>LOGGER.info(String.format("Getting auto-scaling groups for %d names in region %s."<MASK><NEW_LINE>}<NEW_LINE>List<AutoScalingGroup> asgs = new LinkedList<AutoScalingGroup>();<NEW_LINE>AmazonAutoScalingClient asgClient = asgClient();<NEW_LINE>DescribeAutoScalingGroupsRequest request = new DescribeAutoScalingGroupsRequest();<NEW_LINE>if (names != null) {<NEW_LINE>request.setAutoScalingGroupNames(Arrays.asList(names));<NEW_LINE>}<NEW_LINE>DescribeAutoScalingGroupsResult result = asgClient.describeAutoScalingGroups(request);<NEW_LINE>asgs.addAll(result.getAutoScalingGroups());<NEW_LINE>while (result.getNextToken() != null) {<NEW_LINE>request.setNextToken(result.getNextToken());<NEW_LINE>result = asgClient.describeAutoScalingGroups(request);<NEW_LINE>asgs.addAll(result.getAutoScalingGroups());<NEW_LINE>}<NEW_LINE>LOGGER.info(String.format("Got %d auto-scaling groups in region %s.", asgs.size(), region));<NEW_LINE>return asgs;<NEW_LINE>} | , names.length, region)); |
1,327,962 | public static void motan2XmlCommonClientDemo(CommonHandler client) throws Throwable {<NEW_LINE>System.out.println(client.call("hello", new Object[] { <MASK><NEW_LINE>User user = new User(1, "AAA");<NEW_LINE>System.out.println(user);<NEW_LINE>user = (User) client.call("rename", new Object[] { user, "BBB" }, User.class);<NEW_LINE>System.out.println(user);<NEW_LINE>ResponseFuture future = (ResponseFuture) client.asyncCall("rename", new Object[] { user, "CCC" }, User.class);<NEW_LINE>user = (User) future.getValue();<NEW_LINE>System.out.println(user);<NEW_LINE>ResponseFuture future2 = (ResponseFuture) client.asyncCall("rename", new Object[] { user, "DDD" }, User.class);<NEW_LINE>future2.addListener(new FutureListener() {<NEW_LINE><NEW_LINE>@Override<NEW_LINE>public void operationComplete(Future future) {<NEW_LINE>System.out.println(future.getValue());<NEW_LINE>}<NEW_LINE>});<NEW_LINE>Request request = client.buildRequest("rename", new Object[] { user, "EEE" });<NEW_LINE>request.setAttachment("a", "a");<NEW_LINE>user = (User) client.call(request, User.class);<NEW_LINE>System.out.println(user);<NEW_LINE>// expect throw exception<NEW_LINE>// client.call("rename", new Object[]{null, "FFF"}, void.class);<NEW_LINE>} | "a" }, String.class)); |
400,901 | private <T> T allowStaticAccessToMember(final T member, final boolean staticOnly) {<NEW_LINE>if (member == null)<NEW_LINE>return null;<NEW_LINE>if (!staticOnly)<NEW_LINE>return member;<NEW_LINE>boolean isStatic;<NEW_LINE>if (member instanceof Variable) {<NEW_LINE>Variable v = (Variable) member;<NEW_LINE>isStatic = Modifier.isStatic(v.getModifiers());<NEW_LINE>} else if (member instanceof List) {<NEW_LINE>List<MethodNode> list = (List<MethodNode>) member;<NEW_LINE>if (list.size() == 1) {<NEW_LINE>return (T) Collections.singletonList(allowStaticAccessToMember(list.get(0), staticOnly));<NEW_LINE>}<NEW_LINE>return <MASK><NEW_LINE>} else {<NEW_LINE>MethodNode mn = (MethodNode) member;<NEW_LINE>isStatic = mn.isStatic();<NEW_LINE>}<NEW_LINE>if (staticOnly && !isStatic)<NEW_LINE>return null;<NEW_LINE>return member;<NEW_LINE>} | (T) Collections.emptyList(); |
849,062 | public void readAttributes(String qname, Attributes attributes) throws SAXException {<NEW_LINE>final String METHOD = "readAttributes";<NEW_LINE>if (readData) {<NEW_LINE>try {<NEW_LINE>String id = attributes.getValue("name");<NEW_LINE>if (id != null && id.length() > 0) {<NEW_LINE>if (attributes.getValue("port").startsWith("$")) {<NEW_LINE>// ignore these template entries<NEW_LINE>return;<NEW_LINE>}<NEW_LINE>int port = Integer.parseInt(attributes.getValue("port"));<NEW_LINE>boolean secure = "true".equals(attributes.getValue("security-enabled"));<NEW_LINE>boolean enabled = !"false".equals(attributes.getValue("enabled"));<NEW_LINE>LOGGER.log(Level.INFO, METHOD, "port", new Object[] { Integer.toString(port), Boolean.toString(enabled), Boolean.toString(secure) });<NEW_LINE>if (enabled) {<NEW_LINE>HttpData data = new HttpData(id, port, secure);<NEW_LINE>LOGGER.log(Level.INFO, METHOD, "add", data);<NEW_LINE><MASK><NEW_LINE>}<NEW_LINE>} else {<NEW_LINE>LOGGER.log(Level.INFO, METHOD, "noName");<NEW_LINE>}<NEW_LINE>} catch (NumberFormatException ex) {<NEW_LINE>LOGGER.log(Level.SEVERE, METHOD, "numberFormat", ex);<NEW_LINE>}<NEW_LINE>}<NEW_LINE>} | result.put(id, data); |
150,850 | public List<ResourcePersistentId> resolveResourcePersistentIdsWithCache(RequestPartitionId theRequestPartitionId, List<IIdType> theIds, boolean theOnlyForcedIds) {<NEW_LINE>assert myDontCheckActiveTransactionForUnitTest || TransactionSynchronizationManager.isSynchronizationActive();<NEW_LINE>List<ResourcePersistentId> retVal = new ArrayList<>(theIds.size());<NEW_LINE>for (IIdType id : theIds) {<NEW_LINE>if (!id.hasIdPart()) {<NEW_LINE>throw new InvalidRequestException(Msg.code(1101) + "Parameter value missing in request");<NEW_LINE>}<NEW_LINE>}<NEW_LINE>if (!theIds.isEmpty()) {<NEW_LINE>Set<IIdType> idsToCheck = new HashSet<>(theIds.size());<NEW_LINE>for (IIdType nextId : theIds) {<NEW_LINE>if (myDaoConfig.getResourceClientIdStrategy() != DaoConfig.ClientIdStrategyEnum.ANY) {<NEW_LINE>if (nextId.isIdPartValidLong()) {<NEW_LINE>if (!theOnlyForcedIds) {<NEW_LINE>retVal.add(new ResourcePersistentId(nextId.getIdPartAsLong()).setAssociatedResourceId(nextId));<NEW_LINE>}<NEW_LINE>continue;<NEW_LINE>}<NEW_LINE>}<NEW_LINE>String key = toForcedIdToPidKey(theRequestPartitionId, nextId.getResourceType(), nextId.getIdPart());<NEW_LINE>ResourcePersistentId cachedId = myMemoryCacheService.getIfPresent(<MASK><NEW_LINE>if (cachedId != null) {<NEW_LINE>retVal.add(cachedId);<NEW_LINE>continue;<NEW_LINE>}<NEW_LINE>idsToCheck.add(nextId);<NEW_LINE>}<NEW_LINE>new QueryChunker<IIdType>().chunk(idsToCheck, SearchBuilder.getMaximumPageSize() / 2, ids -> doResolvePersistentIds(theRequestPartitionId, ids, retVal));<NEW_LINE>}<NEW_LINE>return retVal;<NEW_LINE>} | MemoryCacheService.CacheEnum.FORCED_ID_TO_PID, key); |
38,004 | public Problem prepare(final RefactoringElementsBag elementsBag) {<NEW_LINE>this.usages.clearResults();<NEW_LINE>if (isFindOverridingMethods()) {<NEW_LINE>usages.overridingMethods();<NEW_LINE>}<NEW_LINE>if (isFindSubclasses()) {<NEW_LINE>usages.collectSubclasses();<NEW_LINE>} else if (isFindDirectSubclassesOnly()) {<NEW_LINE>usages.collectDirectSubclasses();<NEW_LINE>} else if (isFindUsages()) {<NEW_LINE>Set<FileObject> relevantFiles = usages.getRelevantFiles();<NEW_LINE>fireProgressListenerStart(ProgressEvent.START, relevantFiles.size());<NEW_LINE>for (FileObject fileObject : relevantFiles) {<NEW_LINE>if (fileObject == null) {<NEW_LINE>continue;<NEW_LINE>}<NEW_LINE>if (cancelled) {<NEW_LINE>// Reset cancelled state for repeated search to work.<NEW_LINE>cancelled = false;<NEW_LINE>break;<NEW_LINE>}<NEW_LINE>usages.collectUsages(fileObject);<NEW_LINE>fireProgressListenerStep();<NEW_LINE>}<NEW_LINE>}<NEW_LINE>Results results = usages.getResults();<NEW_LINE>refactorResults(results, <MASK><NEW_LINE>fireProgressListenerStop();<NEW_LINE>return null;<NEW_LINE>} | elementsBag, usages.getDeclarationFileObject()); |
78,020 | public int readLength() {<NEW_LINE><MASK><NEW_LINE>if (type >= BC_INT32_NUM_MIN && type <= BC_INT32_NUM_MAX) {<NEW_LINE>return type;<NEW_LINE>}<NEW_LINE>if (type >= BC_INT32_BYTE_MIN && type <= BC_INT32_BYTE_MAX) {<NEW_LINE>return ((type - BC_INT32_BYTE_ZERO) << 8) + (bytes[offset++] & 0xFF);<NEW_LINE>}<NEW_LINE>if (type >= BC_INT32_SHORT_MIN && type <= BC_INT32_SHORT_MAX) {<NEW_LINE>return ((type - BC_INT32_SHORT_ZERO) << 16) + ((bytes[offset++] & 0xFF) << 8) + (bytes[offset++] & 0xFF);<NEW_LINE>}<NEW_LINE>if (type == BC_INT32) {<NEW_LINE>int len = (bytes[offset++] << 24) + ((bytes[offset++] & 0xFF) << 16) + ((bytes[offset++] & 0xFF) << 8) + (bytes[offset++] & 0xFF);<NEW_LINE>if (len > 1024 * 1024 * 256) {<NEW_LINE>throw new JSONException("input length overflow");<NEW_LINE>}<NEW_LINE>return len;<NEW_LINE>}<NEW_LINE>throw new JSONException("not support length type : " + typeName(type));<NEW_LINE>} | byte type = bytes[offset++]; |
1,210,579 | public SchemaConfig deserialize(final JsonParser jsonParser, final DeserializationContext context) throws JsonMappingException {<NEW_LINE>final JsonNode node;<NEW_LINE>try {<NEW_LINE>node = OBJECT_MAPPER.readTree(jsonParser);<NEW_LINE>} catch (final JsonParseException ex) {<NEW_LINE>throw JsonMappingException.from(jsonParser, "Failed to parse JSON.", ex);<NEW_LINE>} catch (final JsonProcessingException ex) {<NEW_LINE>throw JsonMappingException.from(jsonParser, "Failed to process JSON in parsing.", ex);<NEW_LINE>} catch (final IOException ex) {<NEW_LINE>throw JsonMappingException.from(jsonParser, "Failed to read JSON in parsing.", ex);<NEW_LINE>}<NEW_LINE>if (!node.isArray()) {<NEW_LINE>throw new JsonMappingException(<MASK><NEW_LINE>}<NEW_LINE>final ArrayList<ColumnConfig> columnConfigs = new ArrayList<>();<NEW_LINE>for (final JsonNode columnConfigNode : (ArrayNode) node) {<NEW_LINE>columnConfigs.add(model.readObject(ColumnConfig.class, columnConfigNode.traverse()));<NEW_LINE>}<NEW_LINE>return new SchemaConfig(Collections.unmodifiableList(columnConfigs));<NEW_LINE>} | "Expected array to deserialize SchemaConfig", jsonParser.getCurrentLocation()); |
1,674,402 | public static void validateProtocolConfig(ProtocolConfig config) {<NEW_LINE>if (config != null) {<NEW_LINE>String name = config.getName();<NEW_LINE>checkName("name", name);<NEW_LINE>checkHost(HOST_KEY, config.getHost());<NEW_LINE>checkPathName("contextpath", config.getContextpath());<NEW_LINE>if (DUBBO_PROTOCOL.equals(name)) {<NEW_LINE>checkMultiExtension(config.getScopeModel(), Codec2.class, <MASK><NEW_LINE>checkMultiExtension(config.getScopeModel(), Serialization.class, SERIALIZATION_KEY, config.getSerialization());<NEW_LINE>checkMultiExtension(config.getScopeModel(), Transporter.class, SERVER_KEY, config.getServer());<NEW_LINE>checkMultiExtension(config.getScopeModel(), Transporter.class, CLIENT_KEY, config.getClient());<NEW_LINE>}<NEW_LINE>checkMultiExtension(config.getScopeModel(), TelnetHandler.class, TELNET_KEY, config.getTelnet());<NEW_LINE>checkMultiExtension(config.getScopeModel(), StatusChecker.class, "status", config.getStatus());<NEW_LINE>checkExtension(config.getScopeModel(), Transporter.class, TRANSPORTER_KEY, config.getTransporter());<NEW_LINE>checkExtension(config.getScopeModel(), Exchanger.class, EXCHANGER_KEY, config.getExchanger());<NEW_LINE>checkExtension(config.getScopeModel(), Dispatcher.class, DISPATCHER_KEY, config.getDispatcher());<NEW_LINE>checkExtension(config.getScopeModel(), Dispatcher.class, "dispather", config.getDispather());<NEW_LINE>checkExtension(config.getScopeModel(), ThreadPool.class, THREADPOOL_KEY, config.getThreadpool());<NEW_LINE>}<NEW_LINE>} | CODEC_KEY, config.getCodec()); |
1,108,491 | public void createMenuItems(Bundle savedInstanceState) {<NEW_LINE>items.add(new TitleItem(getString(R.string.gpx_split_interval)));<NEW_LINE>LayoutInflater themedInflater = UiUtilities.getInflater(requireContext(), nightMode);<NEW_LINE>View view = themedInflater.inflate(<MASK><NEW_LINE>sliderContainer = view.findViewById(R.id.slider_container);<NEW_LINE>slider = sliderContainer.findViewById(R.id.split_slider);<NEW_LINE>splitValueMin = view.findViewById(R.id.split_value_min);<NEW_LINE>splitValueMax = view.findViewById(R.id.split_value_max);<NEW_LINE>selectedSplitValue = view.findViewById(R.id.split_value_tv);<NEW_LINE>splitIntervalNoneDescr = view.findViewById(R.id.split_interval_none_descr);<NEW_LINE>UiUtilities.setupSlider(slider, nightMode, null, true);<NEW_LINE>LinearLayout radioGroup = (LinearLayout) view.findViewById(R.id.custom_radio_buttons);<NEW_LINE>setupTypeRadioGroup(radioGroup);<NEW_LINE>SimpleBottomSheetItem titleItem = (SimpleBottomSheetItem) new SimpleBottomSheetItem.Builder().setCustomView(view).create();<NEW_LINE>items.add(titleItem);<NEW_LINE>} | R.layout.track_split_interval, null); |
1,504,118 | private String createManifest() throws IOException {<NEW_LINE>Document doc = new Document();<NEW_LINE>Element root = new Element(ITemplateXMLTags.XML_TEMPLATE_ELEMENT_MANIFEST);<NEW_LINE>doc.setRootElement(root);<NEW_LINE>// Type<NEW_LINE>root.setAttribute(ITemplateXMLTags.XML_TEMPLATE_ATTRIBUTE_TYPE, ArchimateModelTemplate.XML_TEMPLATE_ATTRIBUTE_TYPE_MODEL);<NEW_LINE>// Timestamp<NEW_LINE>root.setAttribute(ITemplateXMLTags.XML_TEMPLATE_ATTRIBUTE_TIMESTAMP, Long.toString(System.currentTimeMillis()));<NEW_LINE>// Name<NEW_LINE>Element elementName <MASK><NEW_LINE>elementName.setText(fTemplateName);<NEW_LINE>root.addContent(elementName);<NEW_LINE>// Description<NEW_LINE>Element elementDescription = new Element(ITemplateXMLTags.XML_TEMPLATE_ELEMENT_DESCRIPTION);<NEW_LINE>elementDescription.setText(fTemplateDescription);<NEW_LINE>root.addContent(elementDescription);<NEW_LINE>// Key thumbnail<NEW_LINE>if (fIncludeThumbnails) {<NEW_LINE>Element elementKeyThumb = new Element(ITemplateXMLTags.XML_TEMPLATE_ELEMENT_KEY_THUMBNAIL);<NEW_LINE>// $NON-NLS-1$<NEW_LINE>elementKeyThumb.setText(TemplateManager.ZIP_ENTRY_THUMBNAILS + "1.png");<NEW_LINE>root.addContent(elementKeyThumb);<NEW_LINE>}<NEW_LINE>return JDOMUtils.write2XMLString(doc);<NEW_LINE>} | = new Element(ITemplateXMLTags.XML_TEMPLATE_ELEMENT_NAME); |
567,401 | protected Iterable<CharSequence> contexts() {<NEW_LINE>Set<CharsRef> <MASK><NEW_LINE>final CharsRefBuilder scratch = new CharsRefBuilder();<NEW_LINE>scratch.grow(1);<NEW_LINE>for (int typeId = 0; typeId < contextMappings.size(); typeId++) {<NEW_LINE>scratch.setCharAt(0, (char) typeId);<NEW_LINE>scratch.setLength(1);<NEW_LINE>ContextMapping<?> mapping = contextMappings.get(typeId);<NEW_LINE>Set<String> contexts = new HashSet<>(mapping.parseContext(document));<NEW_LINE>if (this.contexts.get(mapping.name()) != null) {<NEW_LINE>contexts.addAll(this.contexts.get(mapping.name()));<NEW_LINE>}<NEW_LINE>for (String context : contexts) {<NEW_LINE>scratch.append(context);<NEW_LINE>typedContexts.add(scratch.toCharsRef());<NEW_LINE>scratch.setLength(1);<NEW_LINE>}<NEW_LINE>}<NEW_LINE>if (typedContexts.isEmpty()) {<NEW_LINE>throw new IllegalArgumentException("Contexts are mandatory in context enabled completion field [" + name + "]");<NEW_LINE>}<NEW_LINE>return new ArrayList<CharSequence>(typedContexts);<NEW_LINE>} | typedContexts = new HashSet<>(); |
417,053 | public void writeTo(com.google.protobuf.CodedOutputStream output) throws java.io.IOException {<NEW_LINE>getSerializedSize();<NEW_LINE>if (((bitField0_ & 0x00000001) == 0x00000001)) {<NEW_LINE>output.writeMessage(1, conversation_);<NEW_LINE>}<NEW_LINE>if (((bitField0_ & 0x00000002) == 0x00000002)) {<NEW_LINE>output.writeBytes(2, getFromUserBytes());<NEW_LINE>}<NEW_LINE>if (((bitField0_ & 0x00000004) == 0x00000004)) {<NEW_LINE>output.writeMessage(3, content_);<NEW_LINE>}<NEW_LINE>if (((bitField0_ & 0x00000008) == 0x00000008)) {<NEW_LINE><MASK><NEW_LINE>}<NEW_LINE>if (((bitField0_ & 0x00000010) == 0x00000010)) {<NEW_LINE>output.writeInt64(5, serverTimestamp_);<NEW_LINE>}<NEW_LINE>if (((bitField0_ & 0x00000020) == 0x00000020)) {<NEW_LINE>output.writeBytes(6, getToUserBytes());<NEW_LINE>}<NEW_LINE>for (int i = 0; i < to_.size(); i++) {<NEW_LINE>output.writeBytes(7, to_.getByteString(i));<NEW_LINE>}<NEW_LINE>getUnknownFields().writeTo(output);<NEW_LINE>} | output.writeInt64(4, messageId_); |
414,867 | public void processMessage(WebSocketMessage webSocketData) throws FrameworkException {<NEW_LINE>setDoTransactionNotifications(true);<NEW_LINE>// default: list start | pause | resume | cancel | abort | cancelAllAfter<NEW_LINE>final String mode = webSocketData.getNodeDataStringValue("mode");<NEW_LINE>final Long jobId = webSocketData.getNodeDataLongValue("jobId");<NEW_LINE>final JobQueueManager mgr = JobQueueManager.getInstance();<NEW_LINE>final List<GraphObject> result = new LinkedList<>();<NEW_LINE>switch(mode) {<NEW_LINE>case "start":<NEW_LINE>mgr.startJob(jobId);<NEW_LINE>break;<NEW_LINE>case "pause":<NEW_LINE>mgr.pauseRunningJob(jobId);<NEW_LINE>break;<NEW_LINE>case "resume":<NEW_LINE>mgr.resumePausedJob(jobId);<NEW_LINE>break;<NEW_LINE>case "abort":<NEW_LINE>mgr.abortActiveJob(jobId);<NEW_LINE>break;<NEW_LINE>case "cancel":<NEW_LINE>mgr.cancelQueuedJob(jobId);<NEW_LINE>break;<NEW_LINE>case "cancelAllAfter":<NEW_LINE>mgr.cancelAllQueuedJobsAfter(jobId);<NEW_LINE>break;<NEW_LINE>case "list":<NEW_LINE>default:<NEW_LINE>final GraphObjectMap importsContainer = new GraphObjectMap();<NEW_LINE>importsContainer.put(importJobsProperty, mgr.listJobs());<NEW_LINE>result.add(importsContainer);<NEW_LINE>}<NEW_LINE>webSocketData.setResult(result);<NEW_LINE>webSocketData.setRawResultCount(1);<NEW_LINE>getWebSocket(<MASK><NEW_LINE>} | ).send(webSocketData, true); |
240,750 | protected void doGet(HttpServletRequest req, HttpServletResponse resp) throws ServletException, IOException {<NEW_LINE>removeTimedOutStreams();<NEW_LINE>String requestURI = req.getRequestURI();<NEW_LINE>if (requestURI == null) {<NEW_LINE>resp.sendError(HttpServletResponse.SC_INTERNAL_SERVER_ERROR, "requestURI is null");<NEW_LINE>return;<NEW_LINE>}<NEW_LINE>final String streamId = substringBefore(substringAfterLast(requestURI, "/"), ".");<NEW_LINE>try (final InputStream stream = prepareInputStream(streamId, resp)) {<NEW_LINE>if (stream == null) {<NEW_LINE>logger.debug("Received request for invalid stream id at {}", requestURI);<NEW_LINE>resp.sendError(HttpServletResponse.SC_NOT_FOUND);<NEW_LINE>} else {<NEW_LINE>stream.<MASK><NEW_LINE>resp.flushBuffer();<NEW_LINE>}<NEW_LINE>} catch (final AudioException ex) {<NEW_LINE>resp.sendError(HttpServletResponse.SC_INTERNAL_SERVER_ERROR, ex.getMessage());<NEW_LINE>}<NEW_LINE>} | transferTo(resp.getOutputStream()); |
1,141,520 | private void updatePinViewHolder(PinViewHolder holder, Pin pin) {<NEW_LINE>CharSequence text = pin.loadable.title;<NEW_LINE>if (pin.archived) {<NEW_LINE>text = TextUtils.concat(PostHelper.addIcon(PostHelper.archivedIcon, sp(14 + 2)), text);<NEW_LINE>}<NEW_LINE>holder.textView.setText(text);<NEW_LINE>holder.image.setUrl(pin.thumbnailUrl, dp(40), dp(40));<NEW_LINE>if (ChanSettings.watchEnabled.get()) {<NEW_LINE>String count = PinHelper.getShortUnreadCount(pin.getNewPostCount());<NEW_LINE>holder.watchCountText.setVisibility(View.VISIBLE);<NEW_LINE>holder.watchCountText.setText(count);<NEW_LINE>if (!pin.watching) {<NEW_LINE>// TODO material colors<NEW_LINE><MASK><NEW_LINE>} else if (pin.getNewQuoteCount() > 0) {<NEW_LINE>holder.watchCountText.setTextColor(0xffFF4444);<NEW_LINE>} else {<NEW_LINE>holder.watchCountText.setTextColor(0xff33B5E5);<NEW_LINE>}<NEW_LINE>// The 16dp padding now belongs to the counter, for a bigger touch area<NEW_LINE>holder.textView.setPadding(holder.textView.getPaddingLeft(), holder.textView.getPaddingTop(), 0, holder.textView.getPaddingBottom());<NEW_LINE>holder.watchCountText.setPadding(dp(16), holder.watchCountText.getPaddingTop(), holder.watchCountText.getPaddingRight(), holder.watchCountText.getPaddingBottom());<NEW_LINE>} else {<NEW_LINE>// The 16dp padding now belongs to the textview, for better ellipsize<NEW_LINE>holder.watchCountText.setVisibility(View.GONE);<NEW_LINE>holder.textView.setPadding(holder.textView.getPaddingLeft(), holder.textView.getPaddingTop(), dp(16), holder.textView.getPaddingBottom());<NEW_LINE>}<NEW_LINE>boolean highlighted = pin == this.highlighted;<NEW_LINE>if (highlighted && !holder.highlighted) {<NEW_LINE>holder.itemView.setBackgroundColor(0x22000000);<NEW_LINE>holder.highlighted = true;<NEW_LINE>} else if (!highlighted && holder.highlighted) {<NEW_LINE>// noinspection deprecation<NEW_LINE>holder.itemView.setBackgroundDrawable(AndroidUtils.getAttrDrawable(holder.itemView.getContext(), android.R.attr.selectableItemBackground));<NEW_LINE>holder.highlighted = false;<NEW_LINE>}<NEW_LINE>} | holder.watchCountText.setTextColor(0xff898989); |
357,480 | public static DescribeLoadBalancerAttributeResponse unmarshall(DescribeLoadBalancerAttributeResponse describeLoadBalancerAttributeResponse, UnmarshallerContext _ctx) {<NEW_LINE>describeLoadBalancerAttributeResponse.setRequestId(_ctx.stringValue("DescribeLoadBalancerAttributeResponse.RequestId"));<NEW_LINE>describeLoadBalancerAttributeResponse.setLoadBalancerId(_ctx.stringValue("DescribeLoadBalancerAttributeResponse.LoadBalancerId"));<NEW_LINE>describeLoadBalancerAttributeResponse.setLoadBalancerName(_ctx.stringValue("DescribeLoadBalancerAttributeResponse.LoadBalancerName"));<NEW_LINE>describeLoadBalancerAttributeResponse.setLoadBalancerStatus(_ctx.stringValue("DescribeLoadBalancerAttributeResponse.LoadBalancerStatus"));<NEW_LINE>describeLoadBalancerAttributeResponse.setEnsRegionId(_ctx.stringValue("DescribeLoadBalancerAttributeResponse.EnsRegionId"));<NEW_LINE>describeLoadBalancerAttributeResponse.setAddress(_ctx.stringValue("DescribeLoadBalancerAttributeResponse.Address"));<NEW_LINE>describeLoadBalancerAttributeResponse.setNetworkId(_ctx.stringValue("DescribeLoadBalancerAttributeResponse.NetworkId"));<NEW_LINE>describeLoadBalancerAttributeResponse.setVSwitchId(_ctx.stringValue("DescribeLoadBalancerAttributeResponse.VSwitchId"));<NEW_LINE>describeLoadBalancerAttributeResponse.setBandwidth(_ctx.integerValue("DescribeLoadBalancerAttributeResponse.Bandwidth"));<NEW_LINE>describeLoadBalancerAttributeResponse.setLoadBalancerSpec(_ctx.stringValue("DescribeLoadBalancerAttributeResponse.LoadBalancerSpec"));<NEW_LINE>describeLoadBalancerAttributeResponse.setCreateTime(_ctx.stringValue("DescribeLoadBalancerAttributeResponse.CreateTime"));<NEW_LINE>describeLoadBalancerAttributeResponse.setEndTime(_ctx.stringValue("DescribeLoadBalancerAttributeResponse.EndTime"));<NEW_LINE>describeLoadBalancerAttributeResponse.setAddressIPVersion(_ctx.stringValue("DescribeLoadBalancerAttributeResponse.AddressIPVersion"));<NEW_LINE>describeLoadBalancerAttributeResponse.setPayType(_ctx.stringValue("DescribeLoadBalancerAttributeResponse.PayType"));<NEW_LINE>List<String> listenerPorts = new ArrayList<String>();<NEW_LINE>for (int i = 0; i < _ctx.lengthValue("DescribeLoadBalancerAttributeResponse.ListenerPorts.Length"); i++) {<NEW_LINE>listenerPorts.add(_ctx.stringValue("DescribeLoadBalancerAttributeResponse.ListenerPorts[" + i + "]"));<NEW_LINE>}<NEW_LINE>describeLoadBalancerAttributeResponse.setListenerPorts(listenerPorts);<NEW_LINE>List<Rs> backendServers = new ArrayList<Rs>();<NEW_LINE>for (int i = 0; i < _ctx.lengthValue("DescribeLoadBalancerAttributeResponse.BackendServers.Length"); i++) {<NEW_LINE>Rs rs = new Rs();<NEW_LINE>rs.setServerId(_ctx.stringValue("DescribeLoadBalancerAttributeResponse.BackendServers[" + i + "].ServerId"));<NEW_LINE>rs.setIp(_ctx.stringValue("DescribeLoadBalancerAttributeResponse.BackendServers[" + i + "].Ip"));<NEW_LINE>rs.setPort(_ctx.stringValue("DescribeLoadBalancerAttributeResponse.BackendServers[" + i + "].Port"));<NEW_LINE>rs.setType(_ctx.stringValue("DescribeLoadBalancerAttributeResponse.BackendServers[" + i + "].Type"));<NEW_LINE>rs.setWeight(_ctx.integerValue("DescribeLoadBalancerAttributeResponse.BackendServers[" + i + "].Weight"));<NEW_LINE>backendServers.add(rs);<NEW_LINE>}<NEW_LINE>describeLoadBalancerAttributeResponse.setBackendServers(backendServers);<NEW_LINE>List<Listener> listenerPortsAndProtocols = new ArrayList<Listener>();<NEW_LINE>for (int i = 0; i < _ctx.lengthValue("DescribeLoadBalancerAttributeResponse.ListenerPortsAndProtocols.Length"); i++) {<NEW_LINE>Listener listener = new Listener();<NEW_LINE>listener.setListenerPort(_ctx.integerValue("DescribeLoadBalancerAttributeResponse.ListenerPortsAndProtocols[" + i + "].ListenerPort"));<NEW_LINE>listener.setListenerProtocol(_ctx.stringValue("DescribeLoadBalancerAttributeResponse.ListenerPortsAndProtocols[" + i + "].ListenerProtocol"));<NEW_LINE>listener.setDescription(_ctx.stringValue<MASK><NEW_LINE>listener.setListenerForward(_ctx.stringValue("DescribeLoadBalancerAttributeResponse.ListenerPortsAndProtocols[" + i + "].ListenerForward"));<NEW_LINE>listener.setForwardPort(_ctx.integerValue("DescribeLoadBalancerAttributeResponse.ListenerPortsAndProtocols[" + i + "].ForwardPort"));<NEW_LINE>listenerPortsAndProtocols.add(listener);<NEW_LINE>}<NEW_LINE>describeLoadBalancerAttributeResponse.setListenerPortsAndProtocols(listenerPortsAndProtocols);<NEW_LINE>return describeLoadBalancerAttributeResponse;<NEW_LINE>} | ("DescribeLoadBalancerAttributeResponse.ListenerPortsAndProtocols[" + i + "].Description")); |
1,401,097 | public void decorate(World world, Random random, Chunk source) {<NEW_LINE>int sourceX = (source.getX() << 4) + random.nextInt(16);<NEW_LINE>int sourceZ = (source.getZ() << 4) + random.nextInt(16);<NEW_LINE>int sourceY = random.nextInt(world.getHighestBlockYAt(sourceX, sourceZ) << 1);<NEW_LINE>while (world.getBlockAt(sourceX, sourceY - 1, sourceZ).getType() == Material.AIR && sourceY > 0) {<NEW_LINE>sourceY--;<NEW_LINE>}<NEW_LINE>for (int j = 0; j < 10; j++) {<NEW_LINE>int x = sourceX + random.nextInt(8<MASK><NEW_LINE>int z = sourceZ + random.nextInt(8) - random.nextInt(8);<NEW_LINE>int y = sourceY + random.nextInt(4) - random.nextInt(4);<NEW_LINE>if (y >= 0 && y <= 255 && world.getBlockAt(x, y, z).getType() == Material.AIR && world.getBlockAt(x, y - 1, z).getType() == Material.WATER) {<NEW_LINE>BlockState state = world.getBlockAt(x, y, z).getState();<NEW_LINE>state.setType(Material.LILY_PAD);<NEW_LINE>state.setData(new MaterialData(Material.LILY_PAD));<NEW_LINE>state.update(true);<NEW_LINE>}<NEW_LINE>}<NEW_LINE>} | ) - random.nextInt(8); |
408,331 | private static synchronized List<PermutationWorkerFactory> createAll(TreeLogger logger) throws UnableToCompleteException {<NEW_LINE>// NB: This is the much-derided FactoryFactory pattern<NEW_LINE>logger = logger.branch(TreeLogger.TRACE, "Creating PermutationWorkerFactory instances");<NEW_LINE>List<PermutationWorkerFactory> mutableFactories <MASK><NEW_LINE>String classes = System.getProperty(FACTORY_IMPL_PROPERTY, ThreadedPermutationWorkerFactory.class.getName() + "," + ExternalPermutationWorkerFactory.class.getName());<NEW_LINE>if (logger.isLoggable(TreeLogger.SPAM)) {<NEW_LINE>logger.log(TreeLogger.SPAM, "Factory impl property is " + classes);<NEW_LINE>}<NEW_LINE>String[] classParts = classes.split(",");<NEW_LINE>for (String className : classParts) {<NEW_LINE>try {<NEW_LINE>Class<? extends PermutationWorkerFactory> clazz = Class.forName(className).asSubclass(PermutationWorkerFactory.class);<NEW_LINE>PermutationWorkerFactory factory = clazz.newInstance();<NEW_LINE>mutableFactories.add(factory);<NEW_LINE>if (logger.isLoggable(TreeLogger.SPAM)) {<NEW_LINE>logger.log(TreeLogger.SPAM, "Added PermutationWorkerFactory " + clazz.getName());<NEW_LINE>}<NEW_LINE>} catch (ClassCastException e) {<NEW_LINE>logger.log(TreeLogger.ERROR, className + " is not a " + PermutationWorkerFactory.class.getName());<NEW_LINE>} catch (ClassNotFoundException e) {<NEW_LINE>logger.log(TreeLogger.ERROR, "Unable to find PermutationWorkerFactory named " + className);<NEW_LINE>} catch (InstantiationException e) {<NEW_LINE>logger.log(TreeLogger.ERROR, "Unable to instantiate PermutationWorkerFactory " + className, e);<NEW_LINE>} catch (IllegalAccessException e) {<NEW_LINE>logger.log(TreeLogger.ERROR, "Unable to instantiate PermutationWorkerFactory " + className, e);<NEW_LINE>}<NEW_LINE>}<NEW_LINE>if (mutableFactories.size() == 0) {<NEW_LINE>logger.log(TreeLogger.ERROR, "No usable PermutationWorkerFactories available");<NEW_LINE>throw new UnableToCompleteException();<NEW_LINE>}<NEW_LINE>return Collections.unmodifiableList(mutableFactories);<NEW_LINE>} | = new ArrayList<PermutationWorkerFactory>(); |
262,492 | // create a TermDeposit trade<NEW_LINE>private static Trade createTrade2() {<NEW_LINE>TermDeposit td = TermDeposit.builder().buySell(BuySell.BUY).startDate(LocalDate.of(2014, 12, 12)).endDate(LocalDate.of(2015, 12, 12)).businessDayAdjustment(BusinessDayAdjustment.of(FOLLOWING, HolidayCalendarIds.GBLO)).currency(Currency.USD).notional(5_000_000).dayCount(DayCounts.THIRTY_360_ISDA).rate(0.0038).build();<NEW_LINE>return TermDepositTrade.builder().product(td).info(TradeInfo.builder().id(StandardId.of("example", "2")).addAttribute(AttributeType.DESCRIPTION, "Deposit 5M at 3.8%").counterparty(StandardId.of("example", "A")).settlementDate(LocalDate.of(2015, 12, 16)).<MASK><NEW_LINE>} | build()).build(); |
1,779,837 | public void serializeImpl(ByteBuffer buffer) {<NEW_LINE>buffer.put((byte) <MASK><NEW_LINE>// distinguish the plan from that of old versions<NEW_LINE>buffer.putInt(PLAN_SINCE_0_14);<NEW_LINE>byte[] bytes = prefixPath.getFullPath().getBytes();<NEW_LINE>buffer.putInt(bytes.length);<NEW_LINE>buffer.put(bytes);<NEW_LINE>ReadWriteIOUtils.write(measurements.size(), buffer);<NEW_LINE>for (String measurement : measurements) {<NEW_LINE>ReadWriteIOUtils.write(measurement, buffer);<NEW_LINE>}<NEW_LINE>for (TSDataType dataType : dataTypes) {<NEW_LINE>buffer.put((byte) dataType.ordinal());<NEW_LINE>}<NEW_LINE>for (TSEncoding encoding : encodings) {<NEW_LINE>buffer.put((byte) encoding.ordinal());<NEW_LINE>}<NEW_LINE>for (CompressionType compressor : compressors) {<NEW_LINE>buffer.put((byte) compressor.ordinal());<NEW_LINE>}<NEW_LINE>for (Long tagOffset : tagOffsets) {<NEW_LINE>buffer.putLong(tagOffset);<NEW_LINE>}<NEW_LINE>// alias<NEW_LINE>if (aliasList != null && !aliasList.isEmpty()) {<NEW_LINE>buffer.put((byte) 1);<NEW_LINE>for (String alias : aliasList) {<NEW_LINE>ReadWriteIOUtils.write(alias, buffer);<NEW_LINE>}<NEW_LINE>} else {<NEW_LINE>buffer.put((byte) 0);<NEW_LINE>}<NEW_LINE>// tags<NEW_LINE>if (tagsList != null && !tagsList.isEmpty()) {<NEW_LINE>buffer.put((byte) 1);<NEW_LINE>for (Map<String, String> tags : tagsList) {<NEW_LINE>ReadWriteIOUtils.write(tags, buffer);<NEW_LINE>}<NEW_LINE>} else {<NEW_LINE>buffer.put((byte) 0);<NEW_LINE>}<NEW_LINE>// attributes<NEW_LINE>if (attributesList != null && !attributesList.isEmpty()) {<NEW_LINE>buffer.put((byte) 1);<NEW_LINE>for (Map<String, String> attributes : attributesList) {<NEW_LINE>ReadWriteIOUtils.write(attributes, buffer);<NEW_LINE>}<NEW_LINE>} else {<NEW_LINE>buffer.put((byte) 0);<NEW_LINE>}<NEW_LINE>buffer.putLong(index);<NEW_LINE>} | PhysicalPlanType.CREATE_ALIGNED_TIMESERIES.ordinal()); |
1,308,037 | private ArrayList<Permission> _getSelectedPermissions(ActionRequest req, Contentlet con) {<NEW_LINE>ArrayList<Permission> pers = new ArrayList<Permission>();<NEW_LINE>String[] readPermissions = req.getParameterValues("read");<NEW_LINE>if (readPermissions != null) {<NEW_LINE>for (int k = 0; k < readPermissions.length; k++) {<NEW_LINE>pers.add(new Permission(con.getInode(), readPermissions[k], PermissionAPI.PERMISSION_READ));<NEW_LINE>}<NEW_LINE>}<NEW_LINE>String[] <MASK><NEW_LINE>if (writePermissions != null) {<NEW_LINE>for (int k = 0; k < writePermissions.length; k++) {<NEW_LINE>pers.add(new Permission(con.getInode(), writePermissions[k], PermissionAPI.PERMISSION_WRITE));<NEW_LINE>}<NEW_LINE>}<NEW_LINE>String[] publishPermissions = req.getParameterValues("publish");<NEW_LINE>if (publishPermissions != null) {<NEW_LINE>for (int k = 0; k < publishPermissions.length; k++) {<NEW_LINE>pers.add(new Permission(con.getInode(), publishPermissions[k], PermissionAPI.PERMISSION_PUBLISH));<NEW_LINE>}<NEW_LINE>}<NEW_LINE>return pers;<NEW_LINE>} | writePermissions = req.getParameterValues("write"); |
42,132 | public boolean mineBlock() {<NEW_LINE>// if miner server was stopped for some reason, we don't mine.<NEW_LINE>if (stop) {<NEW_LINE>return false;<NEW_LINE>}<NEW_LINE>MinerWork work = minerServer.getWork();<NEW_LINE>co.rsk.bitcoinj.core.NetworkParameters bitcoinNetworkParameters = co.rsk.bitcoinj.params.RegTestParams.get();<NEW_LINE>co.rsk.bitcoinj.core.BtcTransaction bitcoinMergedMiningCoinbaseTransaction = MinerUtils.getBitcoinMergedMiningCoinbaseTransaction(bitcoinNetworkParameters, work);<NEW_LINE>co.rsk.bitcoinj.core.BtcBlock bitcoinMergedMiningBlock = MinerUtils.getBitcoinMergedMiningBlock(bitcoinNetworkParameters, bitcoinMergedMiningCoinbaseTransaction);<NEW_LINE>BigInteger target = new BigInteger(1, TypeConverter.stringHexToByteArray(work.getTarget()));<NEW_LINE>findNonce(bitcoinMergedMiningBlock, target);<NEW_LINE>logger.info("Mined block: {}", work.getBlockHashForMergedMining());<NEW_LINE>minerServer.submitBitcoinBlock(<MASK><NEW_LINE>return true;<NEW_LINE>} | work.getBlockHashForMergedMining(), bitcoinMergedMiningBlock); |
318,112 | public UpdateResolverDnssecConfigResult unmarshall(JsonUnmarshallerContext context) throws Exception {<NEW_LINE>UpdateResolverDnssecConfigResult updateResolverDnssecConfigResult = new UpdateResolverDnssecConfigResult();<NEW_LINE><MASK><NEW_LINE>String currentParentElement = context.getCurrentParentElement();<NEW_LINE>int targetDepth = originalDepth + 1;<NEW_LINE>JsonToken token = context.getCurrentToken();<NEW_LINE>if (token == null)<NEW_LINE>token = context.nextToken();<NEW_LINE>if (token == VALUE_NULL) {<NEW_LINE>return updateResolverDnssecConfigResult;<NEW_LINE>}<NEW_LINE>while (true) {<NEW_LINE>if (token == null)<NEW_LINE>break;<NEW_LINE>if (token == FIELD_NAME || token == START_OBJECT) {<NEW_LINE>if (context.testExpression("ResolverDNSSECConfig", targetDepth)) {<NEW_LINE>context.nextToken();<NEW_LINE>updateResolverDnssecConfigResult.setResolverDNSSECConfig(ResolverDnssecConfigJsonUnmarshaller.getInstance().unmarshall(context));<NEW_LINE>}<NEW_LINE>} else if (token == END_ARRAY || token == END_OBJECT) {<NEW_LINE>if (context.getLastParsedParentElement() == null || context.getLastParsedParentElement().equals(currentParentElement)) {<NEW_LINE>if (context.getCurrentDepth() <= originalDepth)<NEW_LINE>break;<NEW_LINE>}<NEW_LINE>}<NEW_LINE>token = context.nextToken();<NEW_LINE>}<NEW_LINE>return updateResolverDnssecConfigResult;<NEW_LINE>} | int originalDepth = context.getCurrentDepth(); |
217,337 | private Mono<Response<DomainAvailabilityInner>> checkDomainAvailabilityWithResponseAsync(CheckDomainAvailabilityParameter parameters) {<NEW_LINE>if (this.client.getEndpoint() == null) {<NEW_LINE>return Mono.<MASK><NEW_LINE>}<NEW_LINE>if (this.client.getSubscriptionId() == null) {<NEW_LINE>return Mono.error(new IllegalArgumentException("Parameter this.client.getSubscriptionId() is required and cannot be null."));<NEW_LINE>}<NEW_LINE>if (parameters == null) {<NEW_LINE>return Mono.error(new IllegalArgumentException("Parameter parameters is required and cannot be null."));<NEW_LINE>} else {<NEW_LINE>parameters.validate();<NEW_LINE>}<NEW_LINE>final String accept = "application/json";<NEW_LINE>return FluxUtil.withContext(context -> service.checkDomainAvailability(this.client.getEndpoint(), this.client.getSubscriptionId(), this.client.getApiVersion(), parameters, accept, context)).contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly()));<NEW_LINE>} | error(new IllegalArgumentException("Parameter this.client.getEndpoint() is required and cannot be null.")); |
1,850,998 | private boolean isClassOf(Element e, Class providerClass) {<NEW_LINE>switch(e.getKind()) {<NEW_LINE>case CLASS:<NEW_LINE>{<NEW_LINE>TypeElement te = (TypeElement) e;<NEW_LINE>TypeMirror superType = te.getSuperclass();<NEW_LINE>if (superType.getKind().equals(TypeKind.NONE)) {<NEW_LINE>return false;<NEW_LINE>} else {<NEW_LINE>e = ((DeclaredType) superType).asElement();<NEW_LINE>String clazz = processingEnv.getElementUtils().getBinaryName((TypeElement) e).toString();<NEW_LINE>if (clazz.equals(providerClass.getName())) {<NEW_LINE>return true;<NEW_LINE>} else {<NEW_LINE>return isClassOf(e, providerClass);<NEW_LINE>}<NEW_LINE>}<NEW_LINE>}<NEW_LINE>case METHOD:<NEW_LINE>{<NEW_LINE>TypeMirror retType = ((ExecutableElement) e).getReturnType();<NEW_LINE>if (retType.getKind().equals(TypeKind.NONE)) {<NEW_LINE>return false;<NEW_LINE>} else {<NEW_LINE>e = ((DeclaredType) retType).asElement();<NEW_LINE>String clazz = processingEnv.getElementUtils().getBinaryName((<MASK><NEW_LINE>if (clazz.equals(providerClass.getName())) {<NEW_LINE>return true;<NEW_LINE>} else {<NEW_LINE>return isClassOf(e, providerClass);<NEW_LINE>}<NEW_LINE>}<NEW_LINE>}<NEW_LINE>default:<NEW_LINE>throw new IllegalArgumentException("Annotated element is not loadable as an instance: " + e);<NEW_LINE>}<NEW_LINE>} | TypeElement) e).toString(); |
1,009,767 | public void invoke(Request request, Response response) throws IOException, ServletException {<NEW_LINE>Exception ex = null;<NEW_LINE>Span handleReceive = httpServerHandler().handleReceive(HttpServletRequestWrapper.create(request.getRequest()));<NEW_LINE>if (log.isDebugEnabled()) {<NEW_LINE>log.debug("Created a server receive span [" + handleReceive + "]");<NEW_LINE>}<NEW_LINE>request.setAttribute(SpanCustomizer.class.getName(), handleReceive);<NEW_LINE>request.setAttribute(TraceContext.class.getName(), handleReceive.context());<NEW_LINE>request.setAttribute(Span.class.getName(), handleReceive);<NEW_LINE>try (CurrentTraceContext.Scope ws = currentTraceContext().maybeScope(handleReceive.context())) {<NEW_LINE>Valve next = getNext();<NEW_LINE>if (null == next) {<NEW_LINE>// no next valve<NEW_LINE>return;<NEW_LINE>}<NEW_LINE>next.invoke(request, response);<NEW_LINE>} catch (Exception exception) {<NEW_LINE>ex = exception;<NEW_LINE>throw exception;<NEW_LINE>} finally {<NEW_LINE>httpServerHandler().handleSend(HttpServletResponseWrapper.create(request.getRequest(), response.getResponse(), ex), handleReceive);<NEW_LINE>if (log.isDebugEnabled()) {<NEW_LINE>log.<MASK><NEW_LINE>}<NEW_LINE>}<NEW_LINE>} | debug("Handled send of span [" + handleReceive + "]"); |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.