idx
int32
46
1.86M
input
stringlengths
321
6.6k
target
stringlengths
9
1.24k
940,751
private void test(int substringSearchMethodId) {<NEW_LINE>String text = "abcdrenetestreneabdreneabcdd";<NEW_LINE>String pattern1 = "rene";<NEW_LINE>SubstringSearch substringSearch1 = createSubstringSearch(substringSearchMethodId, pattern1);<NEW_LINE>if (substringSearch1 == null) {<NEW_LINE>return;<NEW_LINE>}<NEW_LINE>StringJoiner offsets1 = new StringJoiner(", ");<NEW_LINE>for (int offset : substringSearch1.findAll(text)) {<NEW_LINE>offsets1.add(String.valueOf(offset));<NEW_LINE>}<NEW_LINE>StdOut.println("Offsets 1: " + offsets1.toString());<NEW_LINE>StdOut.println("Expected: 4, 12, 19\n");<NEW_LINE>String pattern2 = "abcd";<NEW_LINE>SubstringSearch substringSearch2 = createSubstringSearch(substringSearchMethodId, pattern2);<NEW_LINE>StringJoiner offsets2 = new StringJoiner(", ");<NEW_LINE>for (int offset : substringSearch2.findAll(text)) {<NEW_LINE>offsets2.add(String.valueOf(offset));<NEW_LINE>}<NEW_LINE>StdOut.println("Offsets 2: " + offsets2.toString());<NEW_LINE>StdOut.println("Expected: 0, 23\n");<NEW_LINE>String pattern3 = "d";<NEW_LINE>SubstringSearch substringSearch3 = createSubstringSearch(substringSearchMethodId, pattern3);<NEW_LINE>StringJoiner offsets3 = new StringJoiner(", ");<NEW_LINE>for (int offset : substringSearch3.findAll(text)) {<NEW_LINE>offsets3.add<MASK><NEW_LINE>}<NEW_LINE>StdOut.println("Offsets 3: " + offsets3.toString());<NEW_LINE>StdOut.println("Expected: 3, 18, 26, 27\n");<NEW_LINE>String pattern4 = "zzz";<NEW_LINE>SubstringSearch substringSearch4 = createSubstringSearch(substringSearchMethodId, pattern4);<NEW_LINE>StringJoiner offsets4 = new StringJoiner(", ");<NEW_LINE>for (int offset : substringSearch4.findAll(text)) {<NEW_LINE>offsets4.add(String.valueOf(offset));<NEW_LINE>}<NEW_LINE>StdOut.println("Offsets 4: " + offsets4.toString());<NEW_LINE>StdOut.println("Expected: \n");<NEW_LINE>}
(String.valueOf(offset));
269,919
final DescribeCopyJobResult executeDescribeCopyJob(DescribeCopyJobRequest describeCopyJobRequest) {<NEW_LINE>ExecutionContext executionContext = createExecutionContext(describeCopyJobRequest);<NEW_LINE>AWSRequestMetrics awsRequestMetrics = executionContext.getAwsRequestMetrics();<NEW_LINE>awsRequestMetrics.startEvent(Field.ClientExecuteTime);<NEW_LINE>Request<DescribeCopyJobRequest> request = null;<NEW_LINE>Response<DescribeCopyJobResult> response = null;<NEW_LINE>try {<NEW_LINE>awsRequestMetrics.startEvent(Field.RequestMarshallTime);<NEW_LINE>try {<NEW_LINE>request = new DescribeCopyJobRequestProtocolMarshaller(protocolFactory).marshall(super.beforeMarshalling(describeCopyJobRequest));<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, "Backup");<NEW_LINE>request.addHandlerContext(HandlerContextKey.OPERATION_NAME, "DescribeCopyJob");<NEW_LINE>request.addHandlerContext(HandlerContextKey.ADVANCED_CONFIG, advancedConfig);<NEW_LINE>} finally {<NEW_LINE>awsRequestMetrics.endEvent(Field.RequestMarshallTime);<NEW_LINE>}<NEW_LINE>HttpResponseHandler<AmazonWebServiceResponse<DescribeCopyJobResult>> responseHandler = protocolFactory.createResponseHandler(new JsonOperationMetadata().withPayloadJson(true).withHasStreamingSuccessResponse(false), new DescribeCopyJobResultJsonUnmarshaller());<NEW_LINE>response = <MASK><NEW_LINE>return response.getAwsResponse();<NEW_LINE>} finally {<NEW_LINE>endClientExecution(awsRequestMetrics, request, response);<NEW_LINE>}<NEW_LINE>}
invoke(request, responseHandler, executionContext);
1,737,637
private Mono<PagedResponse<DedicatedHostInner>> listByHostGroupNextSinglePageAsync(String nextLink) {<NEW_LINE>if (nextLink == null) {<NEW_LINE>return Mono.error(new IllegalArgumentException("Parameter nextLink is required and cannot be null."));<NEW_LINE>}<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>final String accept = "application/json";<NEW_LINE>return FluxUtil.withContext(context -> service.listByHostGroupNext(nextLink, this.client.getEndpoint(), accept, context)).<PagedResponse<DedicatedHostInner>>map(res -> new PagedResponseBase<>(res.getRequest(), res.getStatusCode(), res.getHeaders(), res.getValue().value(), res.getValue().nextLink(), null)).contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext(<MASK><NEW_LINE>}
)).readOnly()));
948,855
public static Optional<PhotoDataBean> readPhotoDataFromLdap(final DomainConfig domainConfig, final ChaiProvider chaiProvider, final UserIdentity userIdentity) throws PwmUnrecoverableException, PwmOperationalException {<NEW_LINE>final LdapProfile ldapProfile = userIdentity.getLdapProfile(domainConfig.getAppConfig());<NEW_LINE>final String attribute = ldapProfile.readSettingAsString(PwmSetting.LDAP_ATTRIBUTE_PHOTO);<NEW_LINE>if (attribute == null || attribute.isEmpty()) {<NEW_LINE>throw new PwmOperationalException(new ErrorInformation(PwmError.ERROR_SERVICE_NOT_AVAILABLE, "ldap photo attribute is not configured"));<NEW_LINE>}<NEW_LINE>final byte[] photoData;<NEW_LINE>final String mimeType;<NEW_LINE>try {<NEW_LINE>final ChaiUser chaiUser = ChaiEntryFactory.newChaiFactory(chaiProvider).newChaiUser(userIdentity.getUserDN());<NEW_LINE>final byte[][] photoAttributeData = chaiUser.readMultiByteAttribute(attribute);<NEW_LINE>if (photoAttributeData == null || photoAttributeData.length == 0 || photoAttributeData[0].length == 0) {<NEW_LINE>throw new PwmOperationalException(new ErrorInformation(PwmError.ERROR_SERVICE_NOT_AVAILABLE, "user has no photo data stored in LDAP attribute"));<NEW_LINE>}<NEW_LINE>photoData = photoAttributeData[0];<NEW_LINE>mimeType = URLConnection.guessContentTypeFromStream(new ByteArrayInputStream(photoData));<NEW_LINE>} catch (final IOException | ChaiOperationException e) {<NEW_LINE>throw new PwmOperationalException(new ErrorInformation(PwmError.ERROR_INTERNAL, "error reading user photo ldap attribute: " <MASK><NEW_LINE>} catch (final ChaiUnavailableException e) {<NEW_LINE>throw PwmUnrecoverableException.fromChaiException(e);<NEW_LINE>}<NEW_LINE>return Optional.of(new PhotoDataBean(mimeType, ImmutableByteArray.of(photoData)));<NEW_LINE>}
+ e.getMessage()));
1,386,121
public RelNode convert(RelNode rel) {<NEW_LINE>LogicalJoin join = (LogicalJoin) rel;<NEW_LINE>List<RelNode> newInputs = new ArrayList<>();<NEW_LINE>for (RelNode input : join.getInputs()) {<NEW_LINE>if (!(input.getConvention() instanceof EnumerableConvention)) {<NEW_LINE>input = convert(input, input.getTraitSet().replace(EnumerableConvention.INSTANCE));<NEW_LINE>}<NEW_LINE>newInputs.add(input);<NEW_LINE>}<NEW_LINE>final RelOptCluster cluster = join.getCluster();<NEW_LINE>final RelNode left = newInputs.get(0);<NEW_LINE>final RelNode right = newInputs.get(1);<NEW_LINE>final JoinInfo info = join.analyzeCondition();<NEW_LINE>if (!info.isEqui() && join.getJoinType() != JoinRelType.INNER) {<NEW_LINE>RelNode newRel;<NEW_LINE>boolean hasEquiKeys = !info.leftKeys.isEmpty() && !info.rightKeys.isEmpty();<NEW_LINE>if (hasEquiKeys) {<NEW_LINE>newRel = EnumerableHashJoin.create(left, right, join.getCondition(), join.getVariablesSet(<MASK><NEW_LINE>} else {<NEW_LINE>newRel = EnumerableNestedLoopJoin.create(left, right, join.getCondition(), join.getVariablesSet(), join.getJoinType());<NEW_LINE>}<NEW_LINE>return newRel;<NEW_LINE>} else {<NEW_LINE>// TODO:EnumerableHashJoin + Filter should be supported with just a<NEW_LINE>// (new version of) EnumerableHashJoin, which can take the full condition.<NEW_LINE>RelNode newRel;<NEW_LINE>newRel = EnumerableHashJoin.create(left, right, info.getEquiCondition(left, right, cluster.getRexBuilder()), join.getVariablesSet(), join.getJoinType());<NEW_LINE>if (!info.isEqui()) {<NEW_LINE>RexNode nonEqui = RexUtil.composeConjunction(cluster.getRexBuilder(), info.nonEquiConditions);<NEW_LINE>newRel = new EnumerableFilter(cluster, newRel.getTraitSet(), newRel, nonEqui);<NEW_LINE>}<NEW_LINE>return newRel;<NEW_LINE>}<NEW_LINE>}
), join.getJoinType());
746,148
public boolean acceptPatternMatch(TextSearchMatchAccess matchAccess) throws CoreException {<NEW_LINE>int start = matchAccess.getMatchOffset();<NEW_LINE>int length = matchAccess.getMatchLength();<NEW_LINE>// skip embedded FQNs (bug 130764):<NEW_LINE>if (start > 0) {<NEW_LINE>char before = matchAccess.getFileContentChar(start - 1);<NEW_LINE>if (before == '.' || Character.isJavaIdentifierPart(before)) {<NEW_LINE>return true;<NEW_LINE>}<NEW_LINE>}<NEW_LINE>int fileContentLength = matchAccess.getFileContentLength();<NEW_LINE>int end = start + length;<NEW_LINE>if (end < fileContentLength) {<NEW_LINE>char after = matchAccess.getFileContentChar(end);<NEW_LINE>if (Character.isJavaIdentifierPart(after)) {<NEW_LINE>return true;<NEW_LINE>}<NEW_LINE>}<NEW_LINE>IFile file = matchAccess.getFile();<NEW_LINE>synchronized (fResult) {<NEW_LINE>TextChange change = fResult.getChange(file);<NEW_LINE>TextChangeCompatibility.addTextEdit(change, RefactoringCoreMessages.QualifiedNameFinder_update_name, new ReplaceEdit(start<MASK><NEW_LINE>}<NEW_LINE>return true;<NEW_LINE>}
, length, fNewValue), QUALIFIED_NAMES);
193,867
public void prepare(Progress progress) throws IOException {<NEW_LINE>if (prepared) {<NEW_LINE>return;<NEW_LINE>}<NEW_LINE>Artifact artifact = mrl.getDefaultArtifact();<NEW_LINE>mrl.prepare(artifact, progress);<NEW_LINE>Path root = mrl.getRepository().getResourceDirectory(artifact);<NEW_LINE>Path usagePath;<NEW_LINE>switch(usage) {<NEW_LINE>case TRAIN:<NEW_LINE>usagePath = Paths.get("train");<NEW_LINE>break;<NEW_LINE>case TEST:<NEW_LINE><MASK><NEW_LINE>break;<NEW_LINE>case VALIDATION:<NEW_LINE>default:<NEW_LINE>throw new UnsupportedOperationException("Validation data not available.");<NEW_LINE>}<NEW_LINE>usagePath = root.resolve(usagePath);<NEW_LINE>Path indexFile = usagePath.resolve("index.file");<NEW_LINE>try (Reader reader = Files.newBufferedReader(indexFile)) {<NEW_LINE>Type mapType = new TypeToken<Map<String, List<Float>>>() {<NEW_LINE>}.getType();<NEW_LINE>Map<String, List<Float>> metadata = JsonUtils.GSON.fromJson(reader, mapType);<NEW_LINE>for (Map.Entry<String, List<Float>> entry : metadata.entrySet()) {<NEW_LINE>String imgName = entry.getKey();<NEW_LINE>imagePaths.add(usagePath.resolve(imgName));<NEW_LINE>List<Float> label = entry.getValue();<NEW_LINE>long objectClass = label.get(4).longValue();<NEW_LINE>Rectangle objectLocation = new Rectangle(new Point(label.get(5), label.get(6)), label.get(7), label.get(8));<NEW_LINE>labels.add(objectClass, objectLocation);<NEW_LINE>}<NEW_LINE>}<NEW_LINE>prepared = true;<NEW_LINE>}
usagePath = Paths.get("test");
407,231
public CodeHookSpecification unmarshall(JsonUnmarshallerContext context) throws Exception {<NEW_LINE>CodeHookSpecification codeHookSpecification = new CodeHookSpecification();<NEW_LINE>int originalDepth = context.getCurrentDepth();<NEW_LINE><MASK><NEW_LINE>int targetDepth = originalDepth + 1;<NEW_LINE>JsonToken token = context.getCurrentToken();<NEW_LINE>if (token == null)<NEW_LINE>token = context.nextToken();<NEW_LINE>if (token == VALUE_NULL) {<NEW_LINE>return 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("lambdaCodeHook", targetDepth)) {<NEW_LINE>context.nextToken();<NEW_LINE>codeHookSpecification.setLambdaCodeHook(LambdaCodeHookJsonUnmarshaller.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 codeHookSpecification;<NEW_LINE>}
String currentParentElement = context.getCurrentParentElement();
1,048,385
public void updateSaleOrderLines(ProductCategory productCategory) throws AxelorException {<NEW_LINE>List<<MASK><NEW_LINE>impactedProductCategories.add(productCategory);<NEW_LINE>// fetch children<NEW_LINE>saleOrderLineRepository.all().// fetch children<NEW_LINE>filter("self.product.productCategory.id IN :productCategoryIds " + "AND self.saleOrder.statusSelect != :statusCompleted " + "AND self.saleOrder.statusSelect != :statusCanceled").bind("productCategoryIds", impactedProductCategories.stream().map(ProductCategory::getId).collect(Collectors.toList())).bind("statusCompleted", SaleOrderRepository.STATUS_ORDER_COMPLETED).bind("statusCanceled", SaleOrderRepository.STATUS_CANCELED).fetchStream().filter(saleOrderLine -> hasDiscountBecameTooHigh(productCategory, saleOrderLine)).forEach(saleOrderLine -> saleOrderLine.setDiscountsNeedReview(true));<NEW_LINE>}
ProductCategory> impactedProductCategories = fetchImpactedChildrenProductCategories(productCategory);
61,004
public List<IndexableField> createFields(ParseContext context, String name, Range range, boolean indexed, boolean docValued, boolean stored) {<NEW_LINE>assert range != null : "range cannot be null when creating fields";<NEW_LINE>List<IndexableField> <MASK><NEW_LINE>if (indexed) {<NEW_LINE>fields.add(getRangeField(name, range));<NEW_LINE>}<NEW_LINE>if (docValued) {<NEW_LINE>BinaryRangesDocValuesField field = (BinaryRangesDocValuesField) context.doc().getByKey(name);<NEW_LINE>if (field == null) {<NEW_LINE>field = new BinaryRangesDocValuesField(name, range, this);<NEW_LINE>context.doc().addWithKey(name, field);<NEW_LINE>} else {<NEW_LINE>field.add(range);<NEW_LINE>}<NEW_LINE>}<NEW_LINE>if (stored) {<NEW_LINE>fields.add(new StoredField(name, range.toString()));<NEW_LINE>}<NEW_LINE>return fields;<NEW_LINE>}
fields = new ArrayList<>();
268,258
public String createAnalysisIssueSummary(PostAnalysisIssueVisitor.ComponentIssue componentIssue, FormatterFactory formatterFactory) {<NEW_LINE>final PostAnalysisIssueVisitor.LightIssue issue = componentIssue.getIssue();<NEW_LINE>String baseImageUrl = getBaseImageUrl();<NEW_LINE>Long effort = issue.effortInMinutes();<NEW_LINE>Node effortNode = (null == effort ? new Text("") : new Paragraph(new Text(String.format("**Duration (min):** %s", effort))));<NEW_LINE>String resolution = issue.resolution();<NEW_LINE>Node resolutionNode = (StringUtils.isBlank(resolution) ? new Text("") : new Paragraph(new Text(String.format("**Resolution:** %s ", resolution))));<NEW_LINE>Document document = new Document(new Paragraph(new Text(String.format("**Type:** %s ", issue.type().name())), new Image(issue.type().name(), String.format("%s/checks/IssueType/%s.svg?sanitize=true", baseImageUrl, issue.type().name().toLowerCase()))), new Paragraph(new Text(String.format("**Severity:** %s ", issue.severity())), new Image(issue.severity(), String.format("%s/checks/Severity/%s.svg?sanitize=true", baseImageUrl, issue.severity().toLowerCase()))), new Paragraph(new Text(String.format("**Message:** %s", issue.getMessage()))), effortNode, resolutionNode, new Paragraph(new Text(String.format("**Project ID:** %s **Issue ID:** %s", project.getKey(), issue.key()))), new Paragraph(new Link(getIssueUrl(issue), new Text("View in SonarQube"))));<NEW_LINE>return formatterFactory.documentFormatter(<MASK><NEW_LINE>}
).format(document, formatterFactory);
453,083
public ObjectMapper createXmlMapper() {<NEW_LINE>ObjectMapper xmlMapper = initializeMapperBuilder(XmlMapper.builder()).defaultUseWrapper(false).enable(ToXmlGenerator.Feature.WRITE_XML_DECLARATION)./*<NEW_LINE>* In Jackson 2.12 the default value of this feature changed from true to false.<NEW_LINE>* https://github.com/FasterXML/jackson/wiki/Jackson-Release-2.12#xml-module<NEW_LINE>*/<NEW_LINE>enable(FromXmlParser.<MASK><NEW_LINE>if (useReflectionToSetCoercion) {<NEW_LINE>try {<NEW_LINE>Object object = coercionConfigDefaults.invoke(xmlMapper);<NEW_LINE>setCoercion.invoke(object, coercionInputShapeEmptyString, coercionActionAsNull);<NEW_LINE>} catch (Throwable e) {<NEW_LINE>if (e instanceof Error) {<NEW_LINE>throw (Error) e;<NEW_LINE>}<NEW_LINE>LOGGER.verbose("Failed to set coercion actions.", e);<NEW_LINE>}<NEW_LINE>} else {<NEW_LINE>LOGGER.verbose("Didn't set coercion defaults as it wasn't found on the classpath.");<NEW_LINE>}<NEW_LINE>return xmlMapper;<NEW_LINE>}
Feature.EMPTY_ELEMENT_AS_NULL).build();
674,313
private void readTileData(int tileNum, List<AbstractIlluminaPositionFileReader.PositionInfo> locs) {<NEW_LINE>int totalCycleCount = 0;<NEW_LINE>readHeader(tileNum);<NEW_LINE>if (cycleData[totalCycleCount].tileInfo == null) {<NEW_LINE>throw new PicardException("Could not find tile " + tileNum);<NEW_LINE>}<NEW_LINE>for (final int outputLength : outputLengths) {<NEW_LINE>for (int cycle = 0; cycle < outputLength; cycle++) {<NEW_LINE>final CycleData currentCycleData = cycleData[totalCycleCount];<NEW_LINE>try {<NEW_LINE>if (cachedTile[totalCycleCount] == null) {<NEW_LINE>if (!cachedFilter.containsKey(cycleData[totalCycleCount].tileInfo.tileNum)) {<NEW_LINE>cacheFilterAndLocs(cycleData[totalCycleCount].tileInfo, locs);<NEW_LINE>}<NEW_LINE>cacheTile(totalCycleCount, cycleData[totalCycleCount].tileInfo, currentCycleData);<NEW_LINE>}<NEW_LINE>} catch (final IOException e) {<NEW_LINE>// when logging the error, increment cycle by 1, since totalCycleCount is zero-indexed but Illumina directories are 1-indexed.<NEW_LINE>throw new PicardException(String.format("Error while reading from CBCL file for cycle %d. Offending file on disk is %s", (totalCycleCount + 1), this.streamFiles[totalCycleCount]<MASK><NEW_LINE>}<NEW_LINE>totalCycleCount++;<NEW_LINE>}<NEW_LINE>}<NEW_LINE>tileCached = true;<NEW_LINE>close();<NEW_LINE>}
.getAbsolutePath()), e);
485,254
public void refresh() {<NEW_LINE>Map<String, ValidationToolFactory> map = new HashMap<>();<NEW_LINE>String libDir = PathUtils.concatPath(mConf.getString(PropertyKey.HOME), "lib");<NEW_LINE><MASK><NEW_LINE>List<File> files = new ArrayList<>();<NEW_LINE>try (DirectoryStream<Path> stream = Files.newDirectoryStream(Paths.get(libDir), VALIDATION_TOOL_PATTERN)) {<NEW_LINE>for (Path entry : stream) {<NEW_LINE>if (entry.toFile().isFile()) {<NEW_LINE>files.add(entry.toFile());<NEW_LINE>}<NEW_LINE>}<NEW_LINE>} catch (IOException e) {<NEW_LINE>LOG.warn("Failed to load validation tool libs from {}. error: {}", libDir, e.toString());<NEW_LINE>}<NEW_LINE>// Load the validation tool factory from libraries<NEW_LINE>for (File jar : files) {<NEW_LINE>try {<NEW_LINE>URL extensionURL = jar.toURI().toURL();<NEW_LINE>ClassLoader extensionsClassLoader = new ExtensionsClassLoader(new URL[] { extensionURL }, ClassLoader.getSystemClassLoader());<NEW_LINE>for (ValidationToolFactory factory : ServiceLoader.load(ValidationToolFactory.class, extensionsClassLoader)) {<NEW_LINE>ValidationToolFactory existingFactory = map.get(factory.getType());<NEW_LINE>if (existingFactory != null) {<NEW_LINE>LOG.warn("Ignoring duplicate validation tool type '{}' found in {}. Existing factory: {}", factory.getType(), factory.getClass(), existingFactory.getClass());<NEW_LINE>}<NEW_LINE>map.put(factory.getType(), factory);<NEW_LINE>}<NEW_LINE>} catch (Throwable t) {<NEW_LINE>LOG.warn("Failed to load validation tool jar {}", jar, t);<NEW_LINE>}<NEW_LINE>}<NEW_LINE>// Load the validation tools from the default classloader<NEW_LINE>for (ValidationToolFactory factory : ServiceLoader.load(ValidationToolFactory.class, ValidationToolRegistry.class.getClassLoader())) {<NEW_LINE>ValidationToolFactory existingFactory = map.get(factory.getType());<NEW_LINE>if (existingFactory != null) {<NEW_LINE>LOG.warn("Ignoring duplicate validation tool type '{}' found in {}. Existing factory: {}", factory.getType(), factory.getClass(), existingFactory.getClass());<NEW_LINE>}<NEW_LINE>map.put(factory.getType(), factory);<NEW_LINE>}<NEW_LINE>mFactories = map;<NEW_LINE>LOG.info("Registered Factories: " + String.join(",", mFactories.keySet()));<NEW_LINE>}
LOG.info("Loading validation tool jars from {}", libDir);
1,591,465
private void presentAuthUI() {<NEW_LINE><MASK><NEW_LINE>final IdentityManager identityManager = IdentityManager.getDefaultIdentityManager();<NEW_LINE>final boolean canCancel = this.authUIConfiguration.getCanCancel();<NEW_LINE>identityManager.login(this.loginCallingActivity, new DefaultSignInResultHandler() {<NEW_LINE><NEW_LINE>@Override<NEW_LINE>public void onSuccess(Activity activity, IdentityProvider identityProvider) {<NEW_LINE>if (identityProvider != null) {<NEW_LINE>Log.d(LOG_TAG, "Sign-in succeeded. The identity provider name is available here using: " + identityProvider.getDisplayName());<NEW_LINE>startNextActivity(activity, loginNextActivity);<NEW_LINE>}<NEW_LINE>}<NEW_LINE><NEW_LINE>@Override<NEW_LINE>public boolean onCancel(Activity activity) {<NEW_LINE>// Return false to prevent the user from dismissing the sign in screen by pressing back button.<NEW_LINE>// Return true to allow this.<NEW_LINE>return canCancel;<NEW_LINE>}<NEW_LINE>});<NEW_LINE>SignInActivity.startSignInActivity(this.loginCallingActivity, this.authUIConfiguration);<NEW_LINE>}
Log.d(LOG_TAG, "Presenting the SignIn UI.");
1,709,654
public void translate(ProxySession session, ServerSpawnObjectPacket packet) {<NEW_LINE>CachedEntity cachedEntity = session.getEntityCache().getByRemoteId(packet.getEntityId());<NEW_LINE>if (cachedEntity != null) {<NEW_LINE>log.trace("Cached entity already exists, cant spawn a new one");<NEW_LINE>return;<NEW_LINE>}<NEW_LINE>if (packet.getType() == ObjectType.ITEM_FRAME) {<NEW_LINE>return;<NEW_LINE>}<NEW_LINE>BedrockEntityType entityType = EntityTypeTranslator.translateToBedrock(packet.getType());<NEW_LINE>if (entityType == null) {<NEW_LINE>log.warn("Cannot translate object type: " + packet.<MASK><NEW_LINE>return;<NEW_LINE>}<NEW_LINE>if (entityType == BedrockEntityType.ITEM) {<NEW_LINE>cachedEntity = session.getEntityCache().newItemEntity(packet.getEntityId());<NEW_LINE>} else {<NEW_LINE>cachedEntity = session.getEntityCache().newEntity(entityType, packet.getEntityId());<NEW_LINE>}<NEW_LINE>if (packet.getData() instanceof FallingBlockData) {<NEW_LINE>FallingBlockData fallingBlockData = (FallingBlockData) packet.getData();<NEW_LINE>cachedEntity.getMetadata().put(EntityData.VARIANT, BlockTranslator.translateToBedrock(new BlockState(fallingBlockData.getId())));<NEW_LINE>}<NEW_LINE>cachedEntity.setJavaUuid(packet.getUuid());<NEW_LINE>cachedEntity.setPosition(Vector3f.from(packet.getX(), packet.getY(), packet.getZ()));<NEW_LINE>cachedEntity.setMotion(Vector3f.from(packet.getMotionX(), packet.getMotionY(), packet.getMotionZ()));<NEW_LINE>cachedEntity.spawn(session);<NEW_LINE>}
getType().name());
1,457,756
public static void main(String[] args) throws Exception {<NEW_LINE>Options options = null;<NEW_LINE>try {<NEW_LINE>options = Options.parse(args);<NEW_LINE>} catch (IllegalArgumentException e) {<NEW_LINE>System.err.println(e.getMessage());<NEW_LINE>System.exit(2);<NEW_LINE>}<NEW_LINE>// Try to use hardlinks to source segments, if possible.<NEW_LINE>Directory mergedIndex = new HardlinkCopyDirectoryWrapper(FSDirectory.open(Paths.get(options.mergedIndexPath)));<NEW_LINE>Directory[] indexes = new Directory[options.indexPaths.length];<NEW_LINE>for (int i = 0; i < indexes.length; i++) {<NEW_LINE>indexes[i] = FSDirectory.open(Paths.get(<MASK><NEW_LINE>}<NEW_LINE>IndexWriter writer = new IndexWriter(mergedIndex, options.config);<NEW_LINE>System.out.println("Merging...");<NEW_LINE>writer.addIndexes(indexes);<NEW_LINE>if (options.maxSegments > 0) {<NEW_LINE>System.out.println("Force-merging to " + options.maxSegments + "...");<NEW_LINE>writer.forceMerge(options.maxSegments);<NEW_LINE>}<NEW_LINE>writer.close();<NEW_LINE>System.out.println("Done.");<NEW_LINE>}
options.indexPaths[i]));
1,030,352
public static void main(String[] args) {<NEW_LINE>Exercise3 exercise3 = new Exercise3();<NEW_LINE>SeparateChainingHashTableLinkedListWithDeleteK<Integer, Integer> separateChainingHashTableLinkedListWithDeleteK = exercise3.new SeparateChainingHashTableLinkedListWithDeleteK<>(5, 10);<NEW_LINE>separateChainingHashTableLinkedListWithDeleteK.put(1, 1);<NEW_LINE>separateChainingHashTableLinkedListWithDeleteK.put(2, 2);<NEW_LINE>separateChainingHashTableLinkedListWithDeleteK.put(3, 3);<NEW_LINE>separateChainingHashTableLinkedListWithDeleteK.put(4, 4);<NEW_LINE>separateChainingHashTableLinkedListWithDeleteK.put(5, 5);<NEW_LINE>separateChainingHashTableLinkedListWithDeleteK.put(6, 6);<NEW_LINE>separateChainingHashTableLinkedListWithDeleteK.put(7, 7);<NEW_LINE>StdOut.println("Keys");<NEW_LINE>for (Integer key : separateChainingHashTableLinkedListWithDeleteK.keys()) {<NEW_LINE>StdOut.print(key + " ");<NEW_LINE>}<NEW_LINE>int[] kValuesToTest = { 8, 7, 6, <MASK><NEW_LINE>for (int k : kValuesToTest) {<NEW_LINE>StdOut.println("\nDelete K = " + k);<NEW_LINE>separateChainingHashTableLinkedListWithDeleteK.deleteNewestNodes(k);<NEW_LINE>for (Integer key : separateChainingHashTableLinkedListWithDeleteK.keys()) {<NEW_LINE>StdOut.print(key + " ");<NEW_LINE>}<NEW_LINE>StdOut.println("\nSize: " + separateChainingHashTableLinkedListWithDeleteK.size());<NEW_LINE>}<NEW_LINE>}
4, 3, 2, 0 };
748,963
public static ListProjectResponse unmarshall(ListProjectResponse listProjectResponse, UnmarshallerContext _ctx) {<NEW_LINE>listProjectResponse.setRequestId(_ctx.stringValue("ListProjectResponse.RequestId"));<NEW_LINE>listProjectResponse.setPageIndex(_ctx.integerValue("ListProjectResponse.PageIndex"));<NEW_LINE>listProjectResponse.setPageSize(_ctx.integerValue("ListProjectResponse.PageSize"));<NEW_LINE>listProjectResponse.setTotalPage(_ctx.integerValue("ListProjectResponse.TotalPage"));<NEW_LINE>listProjectResponse.setTotalCount(_ctx.longValue("ListProjectResponse.TotalCount"));<NEW_LINE>List<Project> projects = new ArrayList<Project>();<NEW_LINE>for (int i = 0; i < _ctx.lengthValue("ListProjectResponse.Projects.Length"); i++) {<NEW_LINE>Project project = new Project();<NEW_LINE>project.setName(_ctx.stringValue<MASK><NEW_LINE>project.setState(_ctx.stringValue("ListProjectResponse.Projects[" + i + "].State"));<NEW_LINE>project.setCreator(_ctx.stringValue("ListProjectResponse.Projects[" + i + "].Creator"));<NEW_LINE>project.setCreateTime(_ctx.longValue("ListProjectResponse.Projects[" + i + "].CreateTime"));<NEW_LINE>project.setModifier(_ctx.stringValue("ListProjectResponse.Projects[" + i + "].Modifier"));<NEW_LINE>project.setModifyTime(_ctx.longValue("ListProjectResponse.Projects[" + i + "].ModifyTime"));<NEW_LINE>project.setDescription(_ctx.stringValue("ListProjectResponse.Projects[" + i + "].Description"));<NEW_LINE>project.setDeployType(_ctx.stringValue("ListProjectResponse.Projects[" + i + "].DeployType"));<NEW_LINE>project.setClusterId(_ctx.stringValue("ListProjectResponse.Projects[" + i + "].ClusterId"));<NEW_LINE>project.setManagerIds(_ctx.stringValue("ListProjectResponse.Projects[" + i + "].ManagerIds"));<NEW_LINE>project.setRegion(_ctx.stringValue("ListProjectResponse.Projects[" + i + "].Region"));<NEW_LINE>project.setId(_ctx.stringValue("ListProjectResponse.Projects[" + i + "].Id"));<NEW_LINE>projects.add(project);<NEW_LINE>}<NEW_LINE>listProjectResponse.setProjects(projects);<NEW_LINE>return listProjectResponse;<NEW_LINE>}
("ListProjectResponse.Projects[" + i + "].Name"));
778,695
public static void invokeDiscovery(WebConversation wc, TestSettings settings, String action, List<validationData> expectations) throws Exception {<NEW_LINE>WebRequest request = null;<NEW_LINE>WebResponse response = null;<NEW_LINE>String thisMethod = "invokeDiscovery";<NEW_LINE>msgUtils.printMethodName(thisMethod);<NEW_LINE>try {<NEW_LINE>helpers.setMarkToEndOfAllServersLogs();<NEW_LINE>Log.info(thisClass, thisMethod, "Endpoint URL: " + settings.getDiscoveryEndpt());<NEW_LINE>request = new GetMethodWebRequest(settings.getDiscoveryEndpt());<NEW_LINE>Log.info(thisClass, thisMethod, "Making request: " + request.toString());<NEW_LINE>response = wc.getResponse(request);<NEW_LINE>msgUtils.printResponseParts(response, thisMethod, "Invoke with Parms and Headers: ");<NEW_LINE>} catch (HttpException e) {<NEW_LINE>Log.info(thisClass, thisMethod, "Exception message: " + e.getMessage());<NEW_LINE>Log.info(thisClass, thisMethod, "Exception response code: " + e.getResponseCode());<NEW_LINE>Log.info(thisClass, thisMethod, "Exception response message: " + e.getResponseMessage());<NEW_LINE>Log.info(thisClass, thisMethod, "Exception Cause: " + e.getCause());<NEW_LINE>validationTools.validateException(expectations, action, e);<NEW_LINE>} catch (Exception e) {<NEW_LINE>Log.info(thisClass, thisMethod, "Exception message: " + e.getMessage());<NEW_LINE>Log.info(thisClass, thisMethod, "Exception stack: " + e.getStackTrace());<NEW_LINE>Log.info(thisClass, thisMethod, "Exception response message: " + e.getLocalizedMessage());<NEW_LINE>Log.info(thisClass, thisMethod, <MASK><NEW_LINE>validationTools.validateException(expectations, action, e);<NEW_LINE>}<NEW_LINE>validationTools.validateResult(response, action, expectations, settings);<NEW_LINE>}
"Exception cause: " + e.getCause());
99,114
private void createSharedFieldSetter(Field field) {<NEW_LINE>String setterName = "set" + MetaClassHelper.capitalize(field.getName());<NEW_LINE>Parameter[] params = new Parameter[] { new Parameter(field.getAst().getType(), "$spock_value") };<NEW_LINE>MethodNode setter = spec.getAst(<MASK><NEW_LINE>if (setter != null) {<NEW_LINE>errorReporter.error(field.getAst(), "@Shared field '%s' conflicts with method '%s'; please rename either of them", field.getName(), setter.getName());<NEW_LINE>return;<NEW_LINE>}<NEW_LINE>BlockStatement setterBlock = new BlockStatement();<NEW_LINE>setter = new MethodNode(setterName, determineVisibilityForSharedFieldAccessor(field) | Opcodes.ACC_SYNTHETIC, getPlainReference(ClassHelper.VOID_TYPE), params, ClassNode.EMPTY_ARRAY, setterBlock);<NEW_LINE>setterBlock.addStatement(new ExpressionStatement(new BinaryExpression(new // use internal name<NEW_LINE>AttributeExpression(// use internal name<NEW_LINE>getSharedInstance(), new ConstantExpression(field.getAst().getName())), Token.newSymbol(Types.ASSIGN, -1, -1), new VariableExpression("$spock_value"))));<NEW_LINE>setter.setSourcePosition(field.getAst());<NEW_LINE>spec.getAst().addMethod(setter);<NEW_LINE>}
).getMethod(setterName, params);
980,765
private Mono<Response<Flux<ByteBuffer>>> stopWithResponseAsync(String resourceGroupName, String accountName, String streamingEndpointName, Context context) {<NEW_LINE>if (this.client.getEndpoint() == null) {<NEW_LINE>return Mono.error(new IllegalArgumentException("Parameter this.client.getEndpoint() is required and cannot be null."));<NEW_LINE>}<NEW_LINE>if (this.client.getSubscriptionId() == null) {<NEW_LINE>return Mono.error(new IllegalArgumentException("Parameter this.client.getSubscriptionId() is required and cannot be null."));<NEW_LINE>}<NEW_LINE>if (resourceGroupName == null) {<NEW_LINE>return Mono.error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null."));<NEW_LINE>}<NEW_LINE>if (accountName == null) {<NEW_LINE>return Mono.<MASK><NEW_LINE>}<NEW_LINE>if (streamingEndpointName == null) {<NEW_LINE>return Mono.error(new IllegalArgumentException("Parameter streamingEndpointName is required and cannot be null."));<NEW_LINE>}<NEW_LINE>final String apiVersion = "2021-11-01";<NEW_LINE>final String accept = "application/json";<NEW_LINE>context = this.client.mergeContext(context);<NEW_LINE>return service.stop(this.client.getEndpoint(), this.client.getSubscriptionId(), resourceGroupName, accountName, streamingEndpointName, apiVersion, accept, context);<NEW_LINE>}
error(new IllegalArgumentException("Parameter accountName is required and cannot be null."));
900,882
public void enterFileNameWithDotDot() throws IOException {<NEW_LINE>ViewInteraction radioButton = onView(allOf(withId(R.id.radioNewFile), withText("Select new file"), withParent(withId(R.id.radioGroup)), isDisplayed()));<NEW_LINE>radioButton.perform(click());<NEW_LINE>ViewInteraction checkBox = onView(allOf(withId(R.id.checkAllowExistingFile), withText("Allow selection of existing (new) file"), isDisplayed()));<NEW_LINE>checkBox.perform(click());<NEW_LINE>onView(withId(R.id.button_fastscroll)).perform(ViewActions.scrollTo());<NEW_LINE>ViewInteraction button = onView(allOf(withId(R.id.button_fastscroll), withText("Pick With Fast Scroller"), isDisplayed()));<NEW_LINE>button.perform(click());<NEW_LINE>ViewInteraction recyclerView = onView(allOf(withId(android.R.id.list), isDisplayed()));<NEW_LINE>// Refresh view (into dir, and out again)<NEW_LINE>recyclerView.perform(actionOnItemAtPosition(1, click()));<NEW_LINE>recyclerView.perform(actionOnItemAtPosition(0, click()));<NEW_LINE>// Click on test dir<NEW_LINE>recyclerView.perform(actionOnItemAtPosition(1, click()));<NEW_LINE>// Enter path in filename<NEW_LINE>ViewInteraction appCompatEditText = onView(allOf(withId(R.id.nnf_text_filename), withParent(allOf(withId(R.id.nnf_newfile_button_container), withParent(withId(R.id.nnf_buttons_container)))), isDisplayed()));<NEW_LINE>// new file name<NEW_LINE>appCompatEditText.perform(replaceText("../file.txt"));<NEW_LINE>// Click ok<NEW_LINE>ViewInteraction appCompatImageButton = onView(allOf(withId(R.id.nnf_button_ok_newfile), withParent(allOf(withId(R.id.nnf_newfile_button_container), withParent(withId(R.id.nnf_buttons_container)))), isDisplayed()));<NEW_LINE>appCompatImageButton.perform(click());<NEW_LINE>// Should have returned<NEW_LINE>ViewInteraction textView = onView(withId<MASK><NEW_LINE>textView.check(matches(withText("/storage/emulated/0/file.txt")));<NEW_LINE>}
(R.id.text));
873,640
protected Expression transformVariableExpression(VariableExpression ve) {<NEW_LINE>Variable v = ve.getAccessedVariable();<NEW_LINE>if (v instanceof DynamicVariable) {<NEW_LINE>Expression result = <MASK><NEW_LINE>if (result != null) {<NEW_LINE>setSourcePosition(result, ve);<NEW_LINE>if (inAnnotation) {<NEW_LINE>result = transformInlineConstants(result);<NEW_LINE>}<NEW_LINE>return result;<NEW_LINE>}<NEW_LINE>} else if (v instanceof FieldNode) {<NEW_LINE>if (inSpecialConstructorCall) {<NEW_LINE>// GROOVY-8819<NEW_LINE>FieldNode fn = (FieldNode) v;<NEW_LINE>ClassNode declaringClass = fn.getDeclaringClass();<NEW_LINE>if (fn.isStatic() && currentClass.isDerivedFrom(declaringClass)) {<NEW_LINE>Expression result = new PropertyExpression(new ClassExpression(declaringClass), v.getName());<NEW_LINE>setSourcePosition(result, ve);<NEW_LINE>return result;<NEW_LINE>}<NEW_LINE>}<NEW_LINE>}<NEW_LINE>return ve;<NEW_LINE>}
findStaticFieldOrPropertyAccessorImportFromModule(v.getName());
1,350,001
public static void parse(InputStream in, VersionCatalogBuilder builder) throws IOException {<NEW_LINE>StrictVersionParser strictVersionParser = new StrictVersionParser(Interners.newStrongInterner());<NEW_LINE>TomlParseResult result = Toml.parse(in);<NEW_LINE>assertNoParseErrors(result, builder);<NEW_LINE>TomlTable metadataTable = result.getTable(METADATA_KEY);<NEW_LINE>verifyMetadata(builder, metadataTable);<NEW_LINE>TomlTable librariesTable = result.getTable(LIBRARIES_KEY);<NEW_LINE>TomlTable bundlesTable = result.getTable(BUNDLES_KEY);<NEW_LINE>TomlTable versionsTable = result.getTable(VERSIONS_KEY);<NEW_LINE>TomlTable pluginsTable = result.getTable(PLUGINS_KEY);<NEW_LINE>Sets.SetView<String> unknownTle = Sets.difference(result.keySet(), TOP_LEVEL_ELEMENTS);<NEW_LINE>if (!unknownTle.isEmpty()) {<NEW_LINE>throwVersionCatalogProblem(builder, VersionCatalogProblemId.TOML_SYNTAX_ERROR, spec -> spec.withShortDescription(() -> "Unknown top level elements " + unknownTle).happensBecause(() -> "TOML file contains an unexpected top-level element").addSolution(() -> "Make sure the top-level elements of your TOML file is one of " + oxfordListOf(TOP_LEVEL_ELEMENTS, "or")).documented());<NEW_LINE>}<NEW_LINE>parseLibraries(librariesTable, builder, strictVersionParser);<NEW_LINE>parsePlugins(pluginsTable, builder, strictVersionParser);<NEW_LINE>parseBundles(bundlesTable, builder);<NEW_LINE><MASK><NEW_LINE>}
parseVersions(versionsTable, builder, strictVersionParser);
547,751
private void appendValue(StringBuilder builtBody, Object value) {<NEW_LINE>String valueString = value != null ? value.toString() : "-";<NEW_LINE>try {<NEW_LINE>long time = dateFormat.<MASK><NEW_LINE>builtBody.append("<td data-order=\"").append(time).append("\">").append(valueString);<NEW_LINE>} catch (ParseException e) {<NEW_LINE>if (NumberUtils.isParsable(valueString)) {<NEW_LINE>builtBody.append("<td data-order=\"").append(valueString).append("\">").append(valueString);<NEW_LINE>} else {<NEW_LINE>// Removes non numbers from the value<NEW_LINE>String numbersInValue = valueString.replaceAll("\\D", "");<NEW_LINE>if (!numbersInValue.isEmpty()) {<NEW_LINE>builtBody.append("<td data-order=\"").append(numbersInValue).append("\">").append(valueString);<NEW_LINE>} else {<NEW_LINE>builtBody.append("<td>").append(valueString);<NEW_LINE>}<NEW_LINE>}<NEW_LINE>}<NEW_LINE>}
parse(valueString).getTime();
961,200
public static GnuBuildIdValues fromProgram(Program program) {<NEW_LINE>MemoryBlock buildIdSection = program.getMemory().getBlock(BUILD_ID_SECTION_NAME);<NEW_LINE>if (buildIdSection == null) {<NEW_LINE>return null;<NEW_LINE>}<NEW_LINE>try (ByteProvider bp = MemoryByteProvider.createMemoryBlockByteProvider(program.getMemory(), buildIdSection)) {<NEW_LINE>BinaryReader br = new BinaryReader(bp, !program.getMemory().isBigEndian());<NEW_LINE>long nameLen = br.readNextUnsignedInt();<NEW_LINE><MASK><NEW_LINE>int vendorType = br.readNextInt();<NEW_LINE>if (nameLen > MAX_SANE_STR_LENS || descLen > MAX_SANE_STR_LENS) {<NEW_LINE>return null;<NEW_LINE>}<NEW_LINE>String name = br.readNextAsciiString((int) nameLen);<NEW_LINE>byte[] desc = br.readNextByteArray((int) descLen);<NEW_LINE>return new GnuBuildIdValues(name, desc, vendorType);<NEW_LINE>} catch (IOException e) {<NEW_LINE>// fall thru and return null<NEW_LINE>}<NEW_LINE>return null;<NEW_LINE>}
long descLen = br.readNextUnsignedInt();
946,962
public void readImportSection() throws IOException {<NEW_LINE>if (log.isLoggable(Level.FINE))<NEW_LINE>log.fine("readImportSection");<NEW_LINE>int nImports = in.read4BE();<NEW_LINE>if (log.isLoggable(Level.FINE))<NEW_LINE>log.fine("Number of imports: " + nImports);<NEW_LINE>externalFuns = new ExtFun[nImports];<NEW_LINE>for (int i = 0; i < nImports; i++) {<NEW_LINE>int m_atm_no = in.read4BE();<NEW_LINE>int f_atm_no = in.read4BE();<NEW_LINE>int arity = in.read4BE();<NEW_LINE>EAtom mod = atom(m_atm_no), fun = atom(f_atm_no);<NEW_LINE>externalFuns[i] = new ExtFun(mod, fun, arity);<NEW_LINE>if (log.isLoggable(Level.FINE) && atoms != null) {<NEW_LINE>log.fine("- #" + (i + 1) + ": " + mod + <MASK><NEW_LINE>}<NEW_LINE>}<NEW_LINE>}
":" + fun + "/" + arity);
1,061,470
public LoRaWANMulticastGet unmarshall(JsonUnmarshallerContext context) throws Exception {<NEW_LINE>LoRaWANMulticastGet loRaWANMulticastGet = new LoRaWANMulticastGet();<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("RfRegion", targetDepth)) {<NEW_LINE>context.nextToken();<NEW_LINE>loRaWANMulticastGet.setRfRegion(context.getUnmarshaller(String.<MASK><NEW_LINE>}<NEW_LINE>if (context.testExpression("DlClass", targetDepth)) {<NEW_LINE>context.nextToken();<NEW_LINE>loRaWANMulticastGet.setDlClass(context.getUnmarshaller(String.class).unmarshall(context));<NEW_LINE>}<NEW_LINE>if (context.testExpression("NumberOfDevicesRequested", targetDepth)) {<NEW_LINE>context.nextToken();<NEW_LINE>loRaWANMulticastGet.setNumberOfDevicesRequested(context.getUnmarshaller(Integer.class).unmarshall(context));<NEW_LINE>}<NEW_LINE>if (context.testExpression("NumberOfDevicesInGroup", targetDepth)) {<NEW_LINE>context.nextToken();<NEW_LINE>loRaWANMulticastGet.setNumberOfDevicesInGroup(context.getUnmarshaller(Integer.class).unmarshall(context));<NEW_LINE>}<NEW_LINE>} else if (token == END_ARRAY || token == END_OBJECT) {<NEW_LINE>if (context.getLastParsedParentElement() == null || context.getLastParsedParentElement().equals(currentParentElement)) {<NEW_LINE>if (context.getCurrentDepth() <= originalDepth)<NEW_LINE>break;<NEW_LINE>}<NEW_LINE>}<NEW_LINE>token = context.nextToken();<NEW_LINE>}<NEW_LINE>return loRaWANMulticastGet;<NEW_LINE>}
class).unmarshall(context));
1,205,237
private void doSend(String exchange, String routingKey, Message amqpMessage) {<NEW_LINE>if (ConfirmType.SIMPLE.equals(this.confirmType)) {<NEW_LINE>this.template.invoke(temp -> {<NEW_LINE>temp.<MASK><NEW_LINE>if (!temp.waitForConfirms(ACK_TIMEOUT)) {<NEW_LINE>throw new AmqpRejectAndDontRequeueException("Negative ack for DLQ message received");<NEW_LINE>}<NEW_LINE>return null;<NEW_LINE>});<NEW_LINE>} else if (ConfirmType.CORRELATED.equals(this.confirmType)) {<NEW_LINE>CorrelationData corr = new CorrelationData();<NEW_LINE>this.template.send(exchange, routingKey, amqpMessage, corr);<NEW_LINE>try {<NEW_LINE>Confirm confirm = corr.getFuture().get(ACK_TIMEOUT, TimeUnit.MILLISECONDS);<NEW_LINE>if (!confirm.isAck()) {<NEW_LINE>throw new AmqpRejectAndDontRequeueException("Negative ack for DLQ message received");<NEW_LINE>}<NEW_LINE>} catch (InterruptedException e) {<NEW_LINE>Thread.currentThread().interrupt();<NEW_LINE>throw new AmqpRejectAndDontRequeueException(e);<NEW_LINE>} catch (ExecutionException e) {<NEW_LINE>throw new AmqpRejectAndDontRequeueException(e.getCause());<NEW_LINE>} catch (TimeoutException e) {<NEW_LINE>throw new AmqpRejectAndDontRequeueException(e);<NEW_LINE>}<NEW_LINE>if (corr.getReturned() != null) {<NEW_LINE>RabbitMessageChannelBinder.this.logger.error("DLQ message was returned: " + amqpMessage);<NEW_LINE>throw new AmqpRejectAndDontRequeueException("DLQ message was returned");<NEW_LINE>}<NEW_LINE>} else {<NEW_LINE>this.template.send(exchange, routingKey, amqpMessage);<NEW_LINE>}<NEW_LINE>}
send(exchange, routingKey, amqpMessage);
1,805,127
private // replace single existing metadata value<NEW_LINE>void replaceSingleMetadataValue(DSpaceObject dso, DSpaceObjectService dsoService, MetadataField metadataField, MetadataValueRest metadataValue, String index) {<NEW_LINE>try {<NEW_LINE>List<MetadataValue> metadataValues = dsoService.getMetadata(dso, metadataField.getMetadataSchema().getName(), metadataField.getElement(), metadataField.getQualifier(), Item.ANY);<NEW_LINE>int indexInt = Integer.parseInt(index);<NEW_LINE>if (indexInt >= 0 && metadataValues.size() > indexInt && metadataValues.get(indexInt) != null) {<NEW_LINE>// Alter this existing md<NEW_LINE>MetadataValue existingMdv = metadataValues.get(indexInt);<NEW_LINE>existingMdv.setAuthority(metadataValue.getAuthority());<NEW_LINE>existingMdv.setConfidence(metadataValue.getConfidence());<NEW_LINE>existingMdv.<MASK><NEW_LINE>existingMdv.setValue(metadataValue.getValue());<NEW_LINE>dsoService.setMetadataModified(dso);<NEW_LINE>} else {<NEW_LINE>throw new UnprocessableEntityException("There is no metadata of this type at that index");<NEW_LINE>}<NEW_LINE>} catch (NumberFormatException e) {<NEW_LINE>throw new IllegalArgumentException("This index (" + index + ") is not valid number.", e);<NEW_LINE>}<NEW_LINE>}
setLanguage(metadataValue.getLanguage());
916,228
private Mono<Response<RemediationInner>> createOrUpdateAtResourceWithResponseAsync(String resourceId, String remediationName, RemediationInner parameters) {<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 (resourceId == null) {<NEW_LINE>return Mono.error(new IllegalArgumentException("Parameter resourceId is required and cannot be null."));<NEW_LINE>}<NEW_LINE>if (remediationName == null) {<NEW_LINE>return Mono.<MASK><NEW_LINE>}<NEW_LINE>if (parameters == null) {<NEW_LINE>return Mono.error(new IllegalArgumentException("Parameter parameters is required and cannot be null."));<NEW_LINE>} else {<NEW_LINE>parameters.validate();<NEW_LINE>}<NEW_LINE>final String apiVersion = "2021-10-01";<NEW_LINE>final String accept = "application/json";<NEW_LINE>return FluxUtil.withContext(context -> service.createOrUpdateAtResource(this.client.getEndpoint(), resourceId, remediationName, apiVersion, parameters, accept, context)).contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly()));<NEW_LINE>}
error(new IllegalArgumentException("Parameter remediationName is required and cannot be null."));
1,634,463
public static Collection<RegressionExecution> executions() {<NEW_LINE>ArrayList<RegressionExecution> execs = new ArrayList<>();<NEW_LINE>execs.add(new ViewTimeWindowSceneOne());<NEW_LINE>execs.add(new ViewTimeWindowSceneTwo());<NEW_LINE>execs.add(new ViewTimeJustSelectStar());<NEW_LINE>execs.add(new ViewTimeSum());<NEW_LINE>execs.add(new ViewTimeSumGroupBy());<NEW_LINE>execs.add(new ViewTimeSumWFilter());<NEW_LINE>execs.add(new ViewTimeWindowMonthScoped());<NEW_LINE>execs.add(new ViewTimeWindowWPrev());<NEW_LINE>execs.add(new ViewTimeWindowPreparedStmt());<NEW_LINE>execs.add(new ViewTimeWindowVariableStmt());<NEW_LINE>execs.add(new ViewTimeWindowTimePeriod());<NEW_LINE>execs.add(new ViewTimeWindowVariableTimePeriodStmt());<NEW_LINE>execs.add(new ViewTimeWindowTimePeriodParams());<NEW_LINE>execs.add(new ViewTimeWindowFlipTimer(0, "1", 1000));<NEW_LINE>execs.add(new ViewTimeWindowFlipTimer(123456789, "10"<MASK><NEW_LINE>execs.add(new ViewTimeWindowFlipTimer(0, "1 months 10 milliseconds", timePlusMonth(0, 1) + 10));<NEW_LINE>long currentTime = DateTime.parseDefaultMSec("2002-05-1T08:00:01.999");<NEW_LINE>execs.add(new ViewTimeWindowFlipTimer(currentTime, "1 months 50 milliseconds", timePlusMonth(currentTime, 1) + 50));<NEW_LINE>return execs;<NEW_LINE>}
, 123456789 + 10 * 1000));
1,740,837
private static void scheduleJob(final JobBuilder jobBuilder) {<NEW_LINE>try {<NEW_LINE>Scheduler sched = QuartzUtils.getScheduler();<NEW_LINE>Calendar calendar;<NEW_LINE>JobDetail job;<NEW_LINE>CronTrigger trigger;<NEW_LINE>boolean isNew = false;<NEW_LINE>try {<NEW_LINE>if ((job = sched.getJobDetail(jobBuilder.jobName, jobBuilder.jobGroup)) == null) {<NEW_LINE>job = new JobDetail(jobBuilder.jobName, jobBuilder.jobGroup, jobBuilder.jobClass);<NEW_LINE>isNew = true;<NEW_LINE>}<NEW_LINE>} catch (SchedulerException e) {<NEW_LINE>// Try to re-create the job once more<NEW_LINE>sched.deleteJob(jobBuilder.jobName, jobBuilder.jobGroup);<NEW_LINE>job = new JobDetail(jobBuilder.jobName, <MASK><NEW_LINE>isNew = true;<NEW_LINE>}<NEW_LINE>calendar = GregorianCalendar.getInstance();<NEW_LINE>trigger = new CronTrigger(jobBuilder.triggerName, jobBuilder.triggerGroup, jobBuilder.jobName, jobBuilder.jobGroup, calendar.getTime(), null, Config.getStringProperty(jobBuilder.cronExpressionProp, jobBuilder.cronExpressionPropDefault));<NEW_LINE>trigger.setMisfireInstruction(jobBuilder.cronMissfireInstruction);<NEW_LINE>sched.addJob(job, true);<NEW_LINE>if (isNew) {<NEW_LINE>sched.scheduleJob(trigger);<NEW_LINE>} else {<NEW_LINE>sched.rescheduleJob(jobBuilder.triggerName, jobBuilder.triggerGroup, trigger);<NEW_LINE>}<NEW_LINE>} catch (Exception e) {<NEW_LINE>Logger.error(DotInitScheduler.class, "An error occurred when initializing the '" + jobBuilder.jobName + "': " + e.getMessage(), e);<NEW_LINE>}<NEW_LINE>}
jobBuilder.jobGroup, jobBuilder.jobClass);
880,327
private List<BasicData> loadIrisData() {<NEW_LINE>try {<NEW_LINE>final InputStream istream = this.<MASK><NEW_LINE>if (istream == null) {<NEW_LINE>System.out.println("Cannot access data set, make sure the resources are available.");<NEW_LINE>System.exit(1);<NEW_LINE>}<NEW_LINE>final DataSet ds = DataSet.load(istream);<NEW_LINE>// The following ranges are setup for the Iris data set. If you wish to normalize other files you will<NEW_LINE>// need to modify the below function calls other files.<NEW_LINE>ds.normalizeRange(0, 0, 1);<NEW_LINE>ds.normalizeRange(1, 0, 1);<NEW_LINE>ds.normalizeRange(2, 0, 1);<NEW_LINE>ds.normalizeRange(3, 0, 1);<NEW_LINE>final Map<String, Integer> species = ds.encodeNumeric(4);<NEW_LINE>istream.close();<NEW_LINE>int irisVersicolor = species.get("Iris-versicolor");<NEW_LINE>final java.util.List<BasicData> trainingData = ds.extractSupervised(0, 4, 4, 1);<NEW_LINE>for (BasicData aTrainingData : trainingData) {<NEW_LINE>if (aTrainingData.getIdeal()[0] == irisVersicolor) {<NEW_LINE>// True, is versicolor<NEW_LINE>aTrainingData.getIdeal()[0] = 1;<NEW_LINE>} else {<NEW_LINE>// False, is not versicolor<NEW_LINE>aTrainingData.getIdeal()[0] = 0;<NEW_LINE>}<NEW_LINE>}<NEW_LINE>return trainingData;<NEW_LINE>} catch (IOException ex) {<NEW_LINE>ex.printStackTrace();<NEW_LINE>System.exit(0);<NEW_LINE>return null;<NEW_LINE>}<NEW_LINE>}
getClass().getResourceAsStream("/iris.csv");
1,523,938
private void fillSnapshotBlockDb(String sourceDir, String snapshotDir) throws IOException, RocksDBException {<NEW_LINE>logger.info("-- begin to fill latest block and genesis block to snapshot");<NEW_LINE>DBInterface sourceBlockIndexDb = DbTool.getDB(sourceDir, BLOCK_INDEX_DB_NAME);<NEW_LINE>DBInterface sourceBlockDb = DbTool.getDB(sourceDir, BLOCK_DB_NAME);<NEW_LINE>DBInterface destBlockDb = DbTool.getDB(snapshotDir, BLOCK_DB_NAME);<NEW_LINE>DBInterface destBlockIndexDb = DbTool.getDB(snapshotDir, BLOCK_INDEX_DB_NAME);<NEW_LINE>// put genesis block and block-index into snapshot<NEW_LINE>long genesisBlockNum = 0L;<NEW_LINE>byte[] genesisBlockID = sourceBlockIndexDb.get(ByteArray.fromLong(genesisBlockNum));<NEW_LINE>destBlockIndexDb.put(ByteArray.fromLong(genesisBlockNum), genesisBlockID);<NEW_LINE>destBlockDb.put(genesisBlockID, sourceBlockDb.get(genesisBlockID));<NEW_LINE>long latestBlockNum = getLatestBlockHeaderNum(sourceDir);<NEW_LINE>long startIndex = latestBlockNum <MASK><NEW_LINE>// put the recent blocks in snapshot, VM needs recent 256 blocks.<NEW_LINE>LongStream.rangeClosed(startIndex, latestBlockNum).forEach(blockNum -> {<NEW_LINE>byte[] blockId = null;<NEW_LINE>byte[] block = null;<NEW_LINE>try {<NEW_LINE>blockId = getDataFromSourceDB(sourceDir, BLOCK_INDEX_DB_NAME, Longs.toByteArray(blockNum));<NEW_LINE>block = getDataFromSourceDB(sourceDir, BLOCK_DB_NAME, blockId);<NEW_LINE>} catch (IOException | RocksDBException e) {<NEW_LINE>throw new RuntimeException(e.getMessage());<NEW_LINE>}<NEW_LINE>// put recent blocks index into snapshot<NEW_LINE>destBlockIndexDb.put(ByteArray.fromLong(blockNum), blockId);<NEW_LINE>// put latest blocks into snapshot<NEW_LINE>destBlockDb.put(blockId, block);<NEW_LINE>});<NEW_LINE>}
> VM_NEED_RECENT_BLKS ? latestBlockNum - VM_NEED_RECENT_BLKS : 0;
1,571,730
public A newInstance(@Nonnull Callable<T> factoryMethod) throws Exception {<NEW_LINE>UnitOfWork<?> uow = CurrentUnitOfWork.get();<NEW_LINE>AtomicReference<A> aggregateReference = new AtomicReference<>();<NEW_LINE>// a constructor may apply events, and the persistence of an aggregate must take precedence over publishing its events.<NEW_LINE>uow.onPrepareCommit(x -> {<NEW_LINE>A aggregate = aggregateReference.get();<NEW_LINE>// aggregate construction may have failed with an exception. In that case, no action is required on commit<NEW_LINE>if (aggregate != null) {<NEW_LINE>prepareForCommit(aggregate);<NEW_LINE>}<NEW_LINE>});<NEW_LINE>A aggregate = doCreateNew(factoryMethod);<NEW_LINE>aggregateReference.set(aggregate);<NEW_LINE>Assert.isTrue(aggregateModel.entityClass().isAssignableFrom(aggregate.rootType()), () -> "Unsuitable aggregate for this repository: wrong type");<NEW_LINE>Map<String, A> aggregates = managedAggregates(uow);<NEW_LINE>Assert.isTrue(aggregates.putIfAbsent(aggregate.identifierAsString(), aggregate) <MASK><NEW_LINE>uow.onRollback(u -> aggregates.remove(aggregate.identifierAsString()));<NEW_LINE>return aggregate;<NEW_LINE>}
== null, () -> "The Unit of Work already has an Aggregate with the same identifier");
1,674,350
private static boolean hasNetworkEx(boolean checkCell, boolean checkWifi, boolean checkEthernet, boolean checkWimax, boolean checkBluetooth, boolean checkAny) {<NEW_LINE>if (!Capabilities.NETWORK_STATE_ENABLED) {<NEW_LINE>Logger.E(TAG, "HAS_NETWORK: Capability NETWORK_STATE disabled");<NEW_LINE>return false;<NEW_LINE>}<NEW_LINE>Context ctx = RhodesService.getContext();<NEW_LINE>ConnectivityManager conn = (ConnectivityManager) ctx.getSystemService(Context.CONNECTIVITY_SERVICE);<NEW_LINE>if (conn == null) {<NEW_LINE>Logger.E(TAG, "HAS_NETWORK: cannot create ConnectivityManager");<NEW_LINE>return false;<NEW_LINE>}<NEW_LINE>NetworkInfo[] info = conn.getAllNetworkInfo();<NEW_LINE>if (info == null) {<NEW_LINE>Logger.E(TAG, "HAS_NETWORK: cannot issue getAllNetworkInfo");<NEW_LINE>return false;<NEW_LINE>}<NEW_LINE>// {<NEW_LINE>// Utils.platformLog("NETWORK", "$$$$$$$$$$$$$$$$$$$ Networks ; $$$$$$$$$$$$$$$$$$$$$$");<NEW_LINE>// for (int i = 0, lim = info.length; i < lim; ++i)<NEW_LINE>// {<NEW_LINE>// int type = info[i].getType();<NEW_LINE>// String name = info[i].getTypeName();<NEW_LINE>// boolean is_connected = info[i].getState() == NetworkInfo.State.CONNECTED;<NEW_LINE>// Utils.platformLog("NETWORK", " - Name ["+name+"], type ["+String.valueOf(type)+"], connected ["+String.valueOf(is_connected)+"]");<NEW_LINE>// }<NEW_LINE>// }<NEW_LINE>for (int i = 0, lim = info.length; i < lim; ++i) {<NEW_LINE>boolean is_connected = info[i].getState() == NetworkInfo.State.CONNECTED;<NEW_LINE>int type = info[i].getType();<NEW_LINE>if (is_connected) {<NEW_LINE>if ((type == ConnectivityManager.TYPE_MOBILE) && (checkCell))<NEW_LINE>return true;<NEW_LINE>if ((type == ConnectivityManager.TYPE_WIFI) && (checkWifi))<NEW_LINE>return true;<NEW_LINE>if ((type == 6) && (checkWimax))<NEW_LINE>return true;<NEW_LINE>if ((type == 9) && (checkEthernet))<NEW_LINE>return true;<NEW_LINE>if ((type == 7) && (checkBluetooth))<NEW_LINE>return true;<NEW_LINE>if (checkAny)<NEW_LINE>return true;<NEW_LINE>}<NEW_LINE>}<NEW_LINE><MASK><NEW_LINE>return false;<NEW_LINE>}
Logger.I(TAG, "HAS_NETWORK: all networks are disconnected");
75,344
final PutFunctionEventInvokeConfigResult executePutFunctionEventInvokeConfig(PutFunctionEventInvokeConfigRequest putFunctionEventInvokeConfigRequest) {<NEW_LINE>ExecutionContext executionContext = createExecutionContext(putFunctionEventInvokeConfigRequest);<NEW_LINE>AWSRequestMetrics awsRequestMetrics = executionContext.getAwsRequestMetrics();<NEW_LINE>awsRequestMetrics.startEvent(Field.ClientExecuteTime);<NEW_LINE>Request<PutFunctionEventInvokeConfigRequest> request = null;<NEW_LINE>Response<PutFunctionEventInvokeConfigResult> response = null;<NEW_LINE>try {<NEW_LINE>awsRequestMetrics.startEvent(Field.RequestMarshallTime);<NEW_LINE>try {<NEW_LINE>request = new PutFunctionEventInvokeConfigRequestProtocolMarshaller(protocolFactory).marshall(super.beforeMarshalling(putFunctionEventInvokeConfigRequest));<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, "Lambda");<NEW_LINE>request.addHandlerContext(HandlerContextKey.OPERATION_NAME, "PutFunctionEventInvokeConfig");<NEW_LINE>request.addHandlerContext(HandlerContextKey.ADVANCED_CONFIG, advancedConfig);<NEW_LINE>} finally {<NEW_LINE>awsRequestMetrics.endEvent(Field.RequestMarshallTime);<NEW_LINE>}<NEW_LINE>HttpResponseHandler<AmazonWebServiceResponse<PutFunctionEventInvokeConfigResult>> responseHandler = protocolFactory.createResponseHandler(new JsonOperationMetadata().withPayloadJson(true).withHasStreamingSuccessResponse(false), new PutFunctionEventInvokeConfigResultJsonUnmarshaller());<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);
636,410
private void registerHotkeys() {<NEW_LINE>final ActionMap actionMap = ((JTextField) getEditor().getEditorComponent()).getActionMap();<NEW_LINE>final InputMap imap = ((JTextField) getEditor().getEditorComponent()).getInputMap();<NEW_LINE>setActionMap(actionMap);<NEW_LINE>setInputMap(JComponent.WHEN_FOCUSED, imap);<NEW_LINE>imap.put(HotKeys.GRAPH_SEARCH_NEXT_KEY.getKeyStroke(), "NEXT");<NEW_LINE>imap.put(HotKeys.GRAPH_SEARCH_NEXT_ZOOM_KEY.getKeyStroke(), "NEXT_ZOOM");<NEW_LINE>imap.put(HotKeys.GRAPH_SEARCH_PREVIOUS_KEY.getKeyStroke(), "PREVIOUS");<NEW_LINE>imap.put(HotKeys.GRAPH_SEARCH_PREVIOUS_ZOOM_KEY.getKeyStroke(), "PREVIOUS_ZOOM");<NEW_LINE>actionMap.put("NEXT", CActionProxy.proxy(new CActionHotKey("NEXT")));<NEW_LINE>actionMap.put("NEXT_ZOOM", CActionProxy.proxy(new CActionHotKey("NEXT_ZOOM")));<NEW_LINE>actionMap.put("PREVIOUS", CActionProxy.proxy(new CActionHotKey("PREVIOUS")));<NEW_LINE>actionMap.put("PREVIOUS_ZOOM", CActionProxy.proxy<MASK><NEW_LINE>}
(new CActionHotKey("PREVIOUS_ZOOM")));
1,656,562
public Map<String, Object> isPermissionableInheriting(String assetId) throws DotDataException, DotRuntimeException, PortalException, SystemException, DotSecurityException {<NEW_LINE>UserWebAPI userWebAPI = WebAPILocator.getUserWebAPI();<NEW_LINE>WebContext ctx = WebContextFactory.get();<NEW_LINE>HttpServletRequest request = ctx.getHttpServletRequest();<NEW_LINE>Map<String, Object> ret = new HashMap<String, Object>();<NEW_LINE>ret.put("isInheriting", false);<NEW_LINE>// Retrieving the current user<NEW_LINE>User user = userWebAPI.getLoggedInUser(request);<NEW_LINE>boolean respectFrontendRoles = !userWebAPI.isLoggedToBackend(request);<NEW_LINE>HostAPI hostAPI = APILocator.getHostAPI();<NEW_LINE>Permissionable perm = null;<NEW_LINE>// Determining the type<NEW_LINE>// Host?<NEW_LINE>perm = hostAPI.<MASK><NEW_LINE>if (perm == null) {<NEW_LINE>// Content?<NEW_LINE>ContentletAPI contAPI = APILocator.getContentletAPI();<NEW_LINE>try {<NEW_LINE>perm = contAPI.findContentletByIdentifier(assetId, false, APILocator.getLanguageAPI().getDefaultLanguage().getId(), user, respectFrontendRoles);<NEW_LINE>} catch (DotContentletStateException e) {<NEW_LINE>}<NEW_LINE>}<NEW_LINE>if (perm == null) {<NEW_LINE>DotConnect dc = new DotConnect();<NEW_LINE>dc.setSQL("select asset_type as type from identifier where id = ?");<NEW_LINE>dc.addParam(assetId);<NEW_LINE>ArrayList idResults = dc.loadResults();<NEW_LINE>if (idResults.size() > 0) {<NEW_LINE>String assetType = (String) ((Map) idResults.get(0)).get("type");<NEW_LINE>if (Folder.FOLDER_TYPE.equals(assetType)) {<NEW_LINE>perm = APILocator.getFolderAPI().find(assetId, user, respectFrontendRoles);<NEW_LINE>} else {<NEW_LINE>dc.setSQL("select inode, type from inode," + assetType + " asset,identifier where inode.inode = asset.inode and " + "asset.identifier = identifier.id and asset.identifier = ?");<NEW_LINE>dc.addParam(assetId);<NEW_LINE>ArrayList results = dc.loadResults();<NEW_LINE>if (results.size() > 0) {<NEW_LINE>String inode = (String) ((Map) results.get(0)).get("inode");<NEW_LINE>perm = InodeFactory.getInode(inode, Inode.class);<NEW_LINE>}<NEW_LINE>}<NEW_LINE>}<NEW_LINE>}<NEW_LINE>if (perm == null || !UtilMethods.isSet(perm.getPermissionId())) {<NEW_LINE>perm = InodeFactory.getInode(assetId, Inode.class);<NEW_LINE>}<NEW_LINE>if (perm != null && UtilMethods.isSet(perm.getPermissionId())) {<NEW_LINE>boolean isInheriting = APILocator.getPermissionAPI().isInheritingPermissions(perm);<NEW_LINE>if (isInheriting) {<NEW_LINE>ret.put("isInheriting", true);<NEW_LINE>}<NEW_LINE>}<NEW_LINE>return ret;<NEW_LINE>}
find(assetId, user, respectFrontendRoles);
426,942
public void writeResponses(final SessionLabel sessionLabel, final UserIdentity userIdentity, final ChaiUser theUser, final String userGUID, final ResponseInfoBean responseInfoBean) throws PwmUnrecoverableException {<NEW_LINE>if (userGUID == null || userGUID.length() < 1) {<NEW_LINE>throw new PwmUnrecoverableException(new ErrorInformation(PwmError.ERROR_MISSING_GUID, "cannot save responses to remote database, user " + theUser.getEntryDN() + " does not have a guid"));<NEW_LINE>}<NEW_LINE>LOGGER.trace(sessionLabel, () -> "attempting to save responses for " + theUser.getEntryDN() + " in remote database (key=" + userGUID + ")");<NEW_LINE>try {<NEW_LINE>final ChaiResponseSet responseSet = ChaiCrFactory.newChaiResponseSet(responseInfoBean.getCrMap(), responseInfoBean.getHelpdeskCrMap(), responseInfoBean.getLocale(), responseInfoBean.getMinRandoms(), theUser.getChaiProvider().getChaiConfiguration(), responseInfoBean.getCsIdentifier());<NEW_LINE>final DatabaseAccessor databaseAccessor = pwmDomain.getPwmApplication().getDatabaseService().getAccessor();<NEW_LINE>databaseAccessor.put(DatabaseTable.PWM_RESPONSES, <MASK><NEW_LINE>LOGGER.info(sessionLabel, () -> "saved responses for " + theUser.getEntryDN() + " in remote database (key=" + userGUID + ")");<NEW_LINE>} catch (final ChaiException e) {<NEW_LINE>throw PwmUnrecoverableException.fromChaiException(e);<NEW_LINE>} catch (final DatabaseException e) {<NEW_LINE>final ErrorInformation errorInfo = new ErrorInformation(PwmError.ERROR_WRITING_RESPONSES, "unexpected error saving responses for " + theUser.getEntryDN() + " in remote database: " + e.getMessage());<NEW_LINE>LOGGER.error(sessionLabel, errorInfo::toDebugStr);<NEW_LINE>throw new PwmUnrecoverableException(errorInfo, e);<NEW_LINE>}<NEW_LINE>}
userGUID, responseSet.stringValue());
372,348
public static void main(String[] args) throws Exception {<NEW_LINE>Regression reg = new Regression();<NEW_LINE>double[] yvals = { 25.5, 31.2, 25.9, 38.4, 18.4, 26.7, 26.4, 25.9, 32.0, 25.2, 39.7, 35.7, 26.5 };<NEW_LINE>double[][] xvals = { { 1.74, 5.30, 10.8 }, { 6.32, 5.42, 9.4 }, { 6.22, 8.41, 7.2 }, { 10.52, 4.63, 8.5 }, { 1.19, 11.60, 9.4 }, { 1.22, 5.85, 9.9 }, { 4.10, 6.62, 8.0 }, { 6.32, 8.72, 9.1 }, { 4.08, 4.42, 8.7 }, { 4.15, 7.60, 9.2 }, { 10.15, 4.83, 9.4 }, { 1.72, 3.12, 7.6 }, { 1.70, 5.30, 8.2 } };<NEW_LINE>Matrix A = new Matrix(xvals);<NEW_LINE>int row = A.getRowDimension();<NEW_LINE>int col = A.getColumnDimension();<NEW_LINE>A.print(row, 3);<NEW_LINE>Matrix B = new Matrix(row, col + 1);<NEW_LINE>Matrix ones = new Matrix(row, 1);<NEW_LINE>for (int i = 0; i < row; i++) ones.set(i, 0, 1.0);<NEW_LINE>B.setMatrix(0, row - 1, 0, 0, ones);<NEW_LINE>B.setMatrix(0, row - 1, 1, col, A);<NEW_LINE>B.print(row, 3);<NEW_LINE>boolean interceptTerm = true;<NEW_LINE>double[] coeffs = reg.multipleLinearRegression(yvals, xvals, interceptTerm);<NEW_LINE>reg.printCoefficients();<NEW_LINE>Vector<Double> y = new Vector<Double>();<NEW_LINE>Vector<Double> x = new Vector<Double>();<NEW_LINE>Vector<Double> data = new Vector<Double>();<NEW_LINE>double[] array = new double[13 * 4];<NEW_LINE>int cols = 3;<NEW_LINE>int rows = yvals.length;<NEW_LINE>int n = 0;<NEW_LINE>for (int i = 0; i < rows; i++) {<NEW_LINE>y.add(yvals[i]);<NEW_LINE>data.add(yvals[i]);<NEW_LINE>array[n++] = yvals[i];<NEW_LINE>for (int j = 0; j < cols; j++) {<NEW_LINE>x.add(xvals[i][j]);<NEW_LINE>data.add(xvals[i][j]);<NEW_LINE>array[n++] = xvals[i][j];<NEW_LINE>}<NEW_LINE>}<NEW_LINE>System.out.println("Vectors y and x:");<NEW_LINE>coeffs = reg.multipleLinearRegression(y, x, rows, cols, interceptTerm);<NEW_LINE>reg.printCoefficients();<NEW_LINE>// All the data in only one Vector<Double><NEW_LINE>// because includes the dependent variable<NEW_LINE>cols = 4;<NEW_LINE>rows = yvals.length;<NEW_LINE><MASK><NEW_LINE>coeffs = reg.multipleLinearRegression(data, rows, cols, interceptTerm);<NEW_LINE>reg.printCoefficients();<NEW_LINE>// array<NEW_LINE>System.out.println("Vector array [] data:");<NEW_LINE>coeffs = reg.multipleLinearRegression(array, rows, cols, interceptTerm);<NEW_LINE>reg.printCoefficients();<NEW_LINE>}
System.out.println("Vector<> data:");
1,162,000
public Object moduleCreateSyntheticModule(Object moduleName, Object[] exportNames, final long evaluationStepsCallback) {<NEW_LINE>JSFrameDescriptor frameDescBuilder = new JSFrameDescriptor(Undefined.instance);<NEW_LINE>List<Module.ExportEntry> localExportEntries = new ArrayList<>();<NEW_LINE>for (Object exportName : exportNames) {<NEW_LINE>frameDescBuilder.addFrameSlot(exportName);<NEW_LINE>localExportEntries.add(Module.ExportEntry.exportSpecifier((TruffleString) exportName));<NEW_LINE>}<NEW_LINE>FrameDescriptor frameDescriptor = frameDescBuilder.toFrameDescriptor();<NEW_LINE>Module moduleNode = new Module(List.of(), List.of(), localExportEntries, List.of(), List.of(), null, null);<NEW_LINE>Source source = Source.newBuilder(JavaScriptLanguage.ID, "<unavailable>", Strings.toJavaString((TruffleString) moduleName)).build();<NEW_LINE>EngineCacheData engineCacheData = getContextEngineCacheData(mainJSContext);<NEW_LINE>JSFunctionData functionData = engineCacheData.getOrCreateSyntheticModuleData((TruffleString) moduleName, exportNames, (c) -> {<NEW_LINE>JavaScriptRootNode rootNode = new SyntheticModuleRootNode(mainJSContext.getLanguage(), source, frameDescriptor);<NEW_LINE>CallTarget callTarget = rootNode.getCallTarget();<NEW_LINE>return JSFunctionData.create(mainJSContext, callTarget, callTarget, 0, (TruffleString) moduleName, false, false, true, true);<NEW_LINE>});<NEW_LINE>final JSModuleData parsedModule = new JSModuleData(moduleNode, source, functionData, frameDescriptor);<NEW_LINE>return new NativeBackedModuleRecord(<MASK><NEW_LINE>}
parsedModule, getModuleLoader(), evaluationStepsCallback);
1,016,260
public static void queryPhyDbNames(Set<String> schemaNames, Map<String, Set<String>> dbPhyDbNames, Map<String, Set<String>> dbAllPhyDbNames) {<NEW_LINE>Map<String, Set<String>> dbStorageInstIds = new HashMap<>();<NEW_LINE>try (Connection metaDbConn = MetaDbDataSource.getInstance().getConnection()) {<NEW_LINE>GroupDetailInfoAccessor groupDetailInfoAccessor = new GroupDetailInfoAccessor();<NEW_LINE>groupDetailInfoAccessor.setConnection(metaDbConn);<NEW_LINE>List<GroupDetailInfoExRecord> completedGroupInfos = groupDetailInfoAccessor.getCompletedGroupInfosByInstId(InstIdUtil.getInstId());<NEW_LINE>Collections.sort(completedGroupInfos);<NEW_LINE>for (int i = 0; i < completedGroupInfos.size(); i++) {<NEW_LINE>GroupDetailInfoExRecord groupDetailInfoExRecord = completedGroupInfos.get(i);<NEW_LINE>String instId = groupDetailInfoExRecord.storageInstId;<NEW_LINE>String dbName = groupDetailInfoExRecord.dbName;<NEW_LINE>String phyDbName = groupDetailInfoExRecord.phyDbName;<NEW_LINE>if (schemaNames.contains(dbName)) {<NEW_LINE>Set<String> storageInstIds = dbStorageInstIds.computeIfAbsent(dbName.toLowerCase(), x -> new HashSet<>());<NEW_LINE>// add group Name whose storageInstId is first visited<NEW_LINE>if (!storageInstIds.contains(instId)) {<NEW_LINE>storageInstIds.add(instId);<NEW_LINE>Set<String> phyDbNames = dbPhyDbNames.computeIfAbsent(dbName.toLowerCase(), x -> new HashSet<>());<NEW_LINE>phyDbNames.add(phyDbName);<NEW_LINE>}<NEW_LINE>Set<String> phyDbNames = dbAllPhyDbNames.computeIfAbsent(dbName.toLowerCase(), x -> new HashSet<>());<NEW_LINE>phyDbNames.add(phyDbName);<NEW_LINE>}<NEW_LINE>}<NEW_LINE>} catch (Throwable ex) {<NEW_LINE>throw <MASK><NEW_LINE>}<NEW_LINE>}
GeneralUtil.nestedException("Failed to get storage and phy db info", ex);
1,293,875
private void buildThumbnails() {<NEW_LINE>for (PostImageThumbnailView thumbnailView : thumbnailViews) {<NEW_LINE>relativeLayoutContainer.removeView(thumbnailView);<NEW_LINE>}<NEW_LINE>thumbnailViews.clear();<NEW_LINE>// Places the thumbnails below each other.<NEW_LINE>// The placement is done using the RelativeLayout BELOW rule, with generated view ids.<NEW_LINE>if (!post.images.isEmpty() && !ChanSettings.textOnly.get()) {<NEW_LINE>int lastId = 0;<NEW_LINE>int generatedId = 1;<NEW_LINE>boolean first = true;<NEW_LINE>for (PostImage image : post.images) {<NEW_LINE>PostImageThumbnailView v = new PostImageThumbnailView(getContext());<NEW_LINE>// Set the correct id.<NEW_LINE>// The first thumbnail uses thumbnail_view so that the layout can offset to that.<NEW_LINE>final int idToSet = first ? R.id.thumbnail_view : generatedId++;<NEW_LINE>v.setId(idToSet);<NEW_LINE>final int size = getResources().getDimensionPixelSize(R.dimen.cell_post_thumbnail_size);<NEW_LINE>RelativeLayout.LayoutParams p = new <MASK><NEW_LINE>p.alignWithParent = true;<NEW_LINE>if (!first) {<NEW_LINE>p.addRule(RelativeLayout.BELOW, lastId);<NEW_LINE>}<NEW_LINE>p.topMargin = paddingPx;<NEW_LINE>p.leftMargin = paddingPx;<NEW_LINE>p.bottomMargin = paddingPx;<NEW_LINE>v.setPostImage(image, size, size);<NEW_LINE>v.setClickable(true);<NEW_LINE>v.setOnClickListener(v2 -> callback.onThumbnailClicked(post, image, v));<NEW_LINE>v.setRounding(dp(enableHighEndAnimations() ? 8 : 2));<NEW_LINE>relativeLayoutContainer.addView(v, p);<NEW_LINE>thumbnailViews.add(v);<NEW_LINE>lastId = idToSet;<NEW_LINE>first = false;<NEW_LINE>}<NEW_LINE>}<NEW_LINE>}
RelativeLayout.LayoutParams(size, size);
484,988
public Problem prepare(final RefactoringElementsBag refactoringElements) {<NEW_LINE>try {<NEW_LINE>if (cancelled) {<NEW_LINE>return null;<NEW_LINE>}<NEW_LINE>ModificationResult modificationResult = new ModificationResult();<NEW_LINE>Node element = context.getElement();<NEW_LINE>if (element != null) {<NEW_LINE>switch(element.type()) {<NEW_LINE>case cp_variable:<NEW_LINE>refactorElements(modificationResult, context, CPWhereUsedQueryPlugin.findVariables(context), Bundle.rename_variable());<NEW_LINE>break;<NEW_LINE>case cp_mixin_name:<NEW_LINE>refactorElements(modificationResult, context, CPWhereUsedQueryPlugin.findMixins(context), Bundle.rename_mixin());<NEW_LINE>break;<NEW_LINE>}<NEW_LINE>// commit the transaction and add the differences to the result<NEW_LINE>refactoringElements.registerTransaction(new RefactoringCommit(Collections.singletonList(modificationResult)));<NEW_LINE>for (FileObject fo : modificationResult.getModifiedFileObjects()) {<NEW_LINE>for (Difference diff : modificationResult.getDifferences(fo)) {<NEW_LINE>refactoringElements.add(refactoring, DiffElement.create<MASK><NEW_LINE>}<NEW_LINE>}<NEW_LINE>}<NEW_LINE>// no problem<NEW_LINE>return null;<NEW_LINE>} catch (IOException | ParseException ex) {<NEW_LINE>Exceptions.printStackTrace(ex);<NEW_LINE>return new Problem(true, ex.getLocalizedMessage() == null ? ex.toString() : ex.getLocalizedMessage());<NEW_LINE>}<NEW_LINE>}
(diff, fo, modificationResult));
105,253
public ActivityImpl parseIntermediateCatchEvent(Element intermediateEventElement, ScopeImpl scopeElement, ActivityImpl eventBasedGateway) {<NEW_LINE>ActivityImpl nestedActivity = createActivityOnScope(intermediateEventElement, scopeElement);<NEW_LINE>Element timerEventDefinition = intermediateEventElement.element(TIMER_EVENT_DEFINITION);<NEW_LINE>Element <MASK><NEW_LINE>Element messageEventDefinition = intermediateEventElement.element(MESSAGE_EVENT_DEFINITION);<NEW_LINE>Element linkEventDefinitionElement = intermediateEventElement.element(LINK_EVENT_DEFINITION);<NEW_LINE>Element conditionalEventDefinitionElement = intermediateEventElement.element(CONDITIONAL_EVENT_DEFINITION);<NEW_LINE>// shared by all events except for link event<NEW_LINE>IntermediateCatchEventActivityBehavior defaultCatchBehaviour = new IntermediateCatchEventActivityBehavior(eventBasedGateway != null);<NEW_LINE>parseAsynchronousContinuationForActivity(intermediateEventElement, nestedActivity);<NEW_LINE>boolean isEventBaseGatewayPresent = eventBasedGateway != null;<NEW_LINE>if (isEventBaseGatewayPresent) {<NEW_LINE>nestedActivity.setEventScope(eventBasedGateway);<NEW_LINE>nestedActivity.setActivityStartBehavior(ActivityStartBehavior.CANCEL_EVENT_SCOPE);<NEW_LINE>} else {<NEW_LINE>nestedActivity.setEventScope(nestedActivity);<NEW_LINE>nestedActivity.setScope(true);<NEW_LINE>}<NEW_LINE>nestedActivity.setActivityBehavior(defaultCatchBehaviour);<NEW_LINE>if (timerEventDefinition != null) {<NEW_LINE>parseIntermediateTimerEventDefinition(timerEventDefinition, nestedActivity);<NEW_LINE>} else if (signalEventDefinition != null) {<NEW_LINE>parseIntermediateSignalEventDefinition(signalEventDefinition, nestedActivity);<NEW_LINE>} else if (messageEventDefinition != null) {<NEW_LINE>parseIntermediateMessageEventDefinition(messageEventDefinition, nestedActivity);<NEW_LINE>} else if (linkEventDefinitionElement != null) {<NEW_LINE>if (isEventBaseGatewayPresent) {<NEW_LINE>addError("IntermediateCatchLinkEvent is not allowed after an EventBasedGateway.", intermediateEventElement);<NEW_LINE>}<NEW_LINE>nestedActivity.setActivityBehavior(new IntermediateCatchLinkEventActivityBehavior());<NEW_LINE>parseIntermediateLinkEventCatchBehavior(intermediateEventElement, nestedActivity, linkEventDefinitionElement);<NEW_LINE>} else if (conditionalEventDefinitionElement != null) {<NEW_LINE>ConditionalEventDefinition conditionalEvent = parseIntermediateConditionalEventDefinition(conditionalEventDefinitionElement, nestedActivity);<NEW_LINE>nestedActivity.setActivityBehavior(new IntermediateConditionalEventBehavior(conditionalEvent, isEventBaseGatewayPresent));<NEW_LINE>} else {<NEW_LINE>addError("Unsupported intermediate catch event type", intermediateEventElement);<NEW_LINE>}<NEW_LINE>parseExecutionListenersOnScope(intermediateEventElement, nestedActivity);<NEW_LINE>for (BpmnParseListener parseListener : parseListeners) {<NEW_LINE>parseListener.parseIntermediateCatchEvent(intermediateEventElement, scopeElement, nestedActivity);<NEW_LINE>}<NEW_LINE>return nestedActivity;<NEW_LINE>}
signalEventDefinition = intermediateEventElement.element(SIGNAL_EVENT_DEFINITION);
68,680
private byte evaluateFilter(int position, int index, int length) {<NEW_LINE>if (!filter.testLength(length)) {<NEW_LINE>return FILTER_FAILED;<NEW_LINE>}<NEW_LINE>int currentLength = dictionaryOffsetVector[index + 1] - dictionaryOffsetVector[index];<NEW_LINE>if (isCharType && length != currentLength) {<NEW_LINE>System.arraycopy(dictionaryData, dictionaryOffsetVector[index], valueWithPadding, 0, currentLength);<NEW_LINE>Arrays.fill(valueWithPadding, currentLength<MASK><NEW_LINE>if (!filter.testBytes(valueWithPadding, 0, length)) {<NEW_LINE>return FILTER_FAILED;<NEW_LINE>}<NEW_LINE>} else if (!filter.testBytes(dictionaryData, dictionaryOffsetVector[index], length)) {<NEW_LINE>return FILTER_FAILED;<NEW_LINE>}<NEW_LINE>if (outputRequired) {<NEW_LINE>values[outputPositionCount] = index;<NEW_LINE>}<NEW_LINE>outputPositions[outputPositionCount] = position;<NEW_LINE>outputPositionCount++;<NEW_LINE>return FILTER_PASSED;<NEW_LINE>}
, length, (byte) ' ');
1,754,091
private void check(APIRecoverImageMsg msg, Map<String, Quota.QuotaPair> pairs) {<NEW_LINE>String currentAccountUuid = msg<MASK><NEW_LINE>String resourceTargetOwnerAccountUuid = new QuotaUtil().getResourceOwnerAccountUuid(msg.getImageUuid());<NEW_LINE>long imageNumQuota = pairs.get(ImageQuotaConstant.IMAGE_NUM).getValue();<NEW_LINE>long imageSizeQuota = pairs.get(ImageQuotaConstant.IMAGE_SIZE).getValue();<NEW_LINE>long imageNumUsed = new ImageQuotaUtil().getUsedImageNum(resourceTargetOwnerAccountUuid);<NEW_LINE>long imageSizeUsed = new ImageQuotaUtil().getUsedImageSize(resourceTargetOwnerAccountUuid);<NEW_LINE>ImageVO image = dbf.getEntityManager().find(ImageVO.class, msg.getImageUuid());<NEW_LINE>long imageNumAsked = 1;<NEW_LINE>long imageSizeAsked = image.getSize();<NEW_LINE>QuotaUtil.QuotaCompareInfo quotaCompareInfo;<NEW_LINE>{<NEW_LINE>quotaCompareInfo = new QuotaUtil.QuotaCompareInfo();<NEW_LINE>quotaCompareInfo.currentAccountUuid = currentAccountUuid;<NEW_LINE>quotaCompareInfo.resourceTargetOwnerAccountUuid = resourceTargetOwnerAccountUuid;<NEW_LINE>quotaCompareInfo.quotaName = ImageQuotaConstant.IMAGE_NUM;<NEW_LINE>quotaCompareInfo.quotaValue = imageNumQuota;<NEW_LINE>quotaCompareInfo.currentUsed = imageNumUsed;<NEW_LINE>quotaCompareInfo.request = imageNumAsked;<NEW_LINE>new QuotaUtil().CheckQuota(quotaCompareInfo);<NEW_LINE>}<NEW_LINE>{<NEW_LINE>quotaCompareInfo = new QuotaUtil.QuotaCompareInfo();<NEW_LINE>quotaCompareInfo.currentAccountUuid = currentAccountUuid;<NEW_LINE>quotaCompareInfo.resourceTargetOwnerAccountUuid = resourceTargetOwnerAccountUuid;<NEW_LINE>quotaCompareInfo.quotaName = ImageQuotaConstant.IMAGE_SIZE;<NEW_LINE>quotaCompareInfo.quotaValue = imageSizeQuota;<NEW_LINE>quotaCompareInfo.currentUsed = imageSizeUsed;<NEW_LINE>quotaCompareInfo.request = imageSizeAsked;<NEW_LINE>new QuotaUtil().CheckQuota(quotaCompareInfo);<NEW_LINE>}<NEW_LINE>}
.getSession().getAccountUuid();
1,214,345
private GeoBoundingBox resolveGeoBoundingBox() {<NEW_LINE>if (Double.isInfinite(top)) {<NEW_LINE>return null;<NEW_LINE>} else if (Double.isInfinite(posLeft)) {<NEW_LINE>return new GeoBoundingBox(new GeoPoint(top, negLeft), <MASK><NEW_LINE>} else if (Double.isInfinite(negLeft)) {<NEW_LINE>return new GeoBoundingBox(new GeoPoint(top, posLeft), new GeoPoint(bottom, posRight));<NEW_LINE>} else if (wrapLongitude) {<NEW_LINE>double unwrappedWidth = posRight - negLeft;<NEW_LINE>double wrappedWidth = (180 - posLeft) - (-180 - negRight);<NEW_LINE>if (unwrappedWidth <= wrappedWidth) {<NEW_LINE>return new GeoBoundingBox(new GeoPoint(top, negLeft), new GeoPoint(bottom, posRight));<NEW_LINE>} else {<NEW_LINE>return new GeoBoundingBox(new GeoPoint(top, posLeft), new GeoPoint(bottom, negRight));<NEW_LINE>}<NEW_LINE>} else {<NEW_LINE>return new GeoBoundingBox(new GeoPoint(top, negLeft), new GeoPoint(bottom, posRight));<NEW_LINE>}<NEW_LINE>}
new GeoPoint(bottom, negRight));
1,090,838
public static DescribeAntChainTransactionStatisticsV2Response unmarshall(DescribeAntChainTransactionStatisticsV2Response describeAntChainTransactionStatisticsV2Response, UnmarshallerContext _ctx) {<NEW_LINE>describeAntChainTransactionStatisticsV2Response.setRequestId(_ctx.stringValue("DescribeAntChainTransactionStatisticsV2Response.RequestId"));<NEW_LINE>describeAntChainTransactionStatisticsV2Response.setHttpStatusCode(_ctx.stringValue("DescribeAntChainTransactionStatisticsV2Response.HttpStatusCode"));<NEW_LINE>describeAntChainTransactionStatisticsV2Response.setSuccess(_ctx.booleanValue("DescribeAntChainTransactionStatisticsV2Response.Success"));<NEW_LINE>describeAntChainTransactionStatisticsV2Response.setResultMessage(_ctx.stringValue("DescribeAntChainTransactionStatisticsV2Response.ResultMessage"));<NEW_LINE>describeAntChainTransactionStatisticsV2Response.setCode(_ctx.stringValue("DescribeAntChainTransactionStatisticsV2Response.Code"));<NEW_LINE>describeAntChainTransactionStatisticsV2Response.setMessage(_ctx.stringValue("DescribeAntChainTransactionStatisticsV2Response.Message"));<NEW_LINE>describeAntChainTransactionStatisticsV2Response.setResultCode(_ctx.stringValue("DescribeAntChainTransactionStatisticsV2Response.ResultCode"));<NEW_LINE>List<ResultItem> result = new ArrayList<ResultItem>();<NEW_LINE>for (int i = 0; i < _ctx.lengthValue("DescribeAntChainTransactionStatisticsV2Response.Result.Length"); i++) {<NEW_LINE>ResultItem resultItem = new ResultItem();<NEW_LINE>resultItem.setDt(_ctx.longValue("DescribeAntChainTransactionStatisticsV2Response.Result[" + i + "].Dt"));<NEW_LINE>resultItem.setCreatTime(_ctx.longValue<MASK><NEW_LINE>resultItem.setLastSumBlockHeight(_ctx.longValue("DescribeAntChainTransactionStatisticsV2Response.Result[" + i + "].LastSumBlockHeight"));<NEW_LINE>resultItem.setTransCount(_ctx.longValue("DescribeAntChainTransactionStatisticsV2Response.Result[" + i + "].TransCount"));<NEW_LINE>resultItem.setAntChainId(_ctx.stringValue("DescribeAntChainTransactionStatisticsV2Response.Result[" + i + "].AntChainId"));<NEW_LINE>result.add(resultItem);<NEW_LINE>}<NEW_LINE>describeAntChainTransactionStatisticsV2Response.setResult(result);<NEW_LINE>return describeAntChainTransactionStatisticsV2Response;<NEW_LINE>}
("DescribeAntChainTransactionStatisticsV2Response.Result[" + i + "].CreatTime"));
1,401,453
public void read(org.apache.thrift.protocol.TProtocol iprot, contiuneGetSummaries_args struct) throws org.apache.thrift.TException {<NEW_LINE>org.apache.thrift.protocol.TField schemeField;<NEW_LINE>iprot.readStructBegin();<NEW_LINE>while (true) {<NEW_LINE>schemeField = iprot.readFieldBegin();<NEW_LINE>if (schemeField.type == org.apache.thrift.protocol.TType.STOP) {<NEW_LINE>break;<NEW_LINE>}<NEW_LINE>switch(schemeField.id) {<NEW_LINE>case // TINFO<NEW_LINE>1:<NEW_LINE>if (schemeField.type == org.apache.thrift.protocol.TType.STRUCT) {<NEW_LINE>struct.tinfo = new org.apache.accumulo.core.trace.thrift.TInfo();<NEW_LINE>struct.tinfo.read(iprot);<NEW_LINE>struct.setTinfoIsSet(true);<NEW_LINE>} else {<NEW_LINE>org.apache.thrift.protocol.TProtocolUtil.<MASK><NEW_LINE>}<NEW_LINE>break;<NEW_LINE>case // SESSION_ID<NEW_LINE>2:<NEW_LINE>if (schemeField.type == org.apache.thrift.protocol.TType.I64) {<NEW_LINE>struct.sessionId = iprot.readI64();<NEW_LINE>struct.setSessionIdIsSet(true);<NEW_LINE>} else {<NEW_LINE>org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type);<NEW_LINE>}<NEW_LINE>break;<NEW_LINE>default:<NEW_LINE>org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type);<NEW_LINE>}<NEW_LINE>iprot.readFieldEnd();<NEW_LINE>}<NEW_LINE>iprot.readStructEnd();<NEW_LINE>// check for required fields of primitive type, which can't be checked in the validate method<NEW_LINE>struct.validate();<NEW_LINE>}
skip(iprot, schemeField.type);
1,804,972
public void saveExplicitGroup(ActionEvent ae) {<NEW_LINE>ExplicitGroup eg = selectedGroup;<NEW_LINE>if (getSelectedGroupAddRoleAssignees() != null) {<NEW_LINE>try {<NEW_LINE>for (RoleAssignee ra : getSelectedGroupAddRoleAssignees()) {<NEW_LINE>eg.add(ra);<NEW_LINE>}<NEW_LINE>} catch (GroupException ge) {<NEW_LINE>JsfHelper.JH.addMessage(FacesMessage.SEVERITY_ERROR, BundleUtil.getStringFromBundle("dataverse.manageGroups.edit.fail"), ge.getMessage());<NEW_LINE>return;<NEW_LINE>}<NEW_LINE>}<NEW_LINE>try {<NEW_LINE>eg = engineService.submit(new UpdateExplicitGroupCommand(dvRequestService.getDataverseRequest(), eg));<NEW_LINE>List<String> args = Arrays.asList(eg.getDisplayName());<NEW_LINE>JsfHelper.addSuccessMessage(BundleUtil.getStringFromBundle("dataverse.manageGroups.save.success", args));<NEW_LINE>} catch (CommandException ex) {<NEW_LINE>JsfHelper.JH.addMessage(FacesMessage.SEVERITY_ERROR, BundleUtil.getStringFromBundle("dataverse.manageGroups.save.fail"), ex.getMessage());<NEW_LINE>} catch (Exception ex) {<NEW_LINE>JH.addMessage(FacesMessage.SEVERITY_FATAL<MASK><NEW_LINE>logger.log(Level.SEVERE, "Error saving role: " + ex.getMessage(), ex);<NEW_LINE>}<NEW_LINE>showAssignmentMessages();<NEW_LINE>}
, BundleUtil.getStringFromBundle("permission.roleNotSaved"));
523,367
protected void enableButtons() {<NEW_LINE>if (m_PAttributeButton != null) {<NEW_LINE>if (p_table == null)<NEW_LINE>return;<NEW_LINE>int row = p_table.getSelectionModel().getLeadSelectionIndex();<NEW_LINE>int rows = p_table.getRowCount();<NEW_LINE>if (p_table.getShowTotals())<NEW_LINE>rows = rows - 1;<NEW_LINE>if (row < 0 || row > rows) {<NEW_LINE>super.enableButtons();<NEW_LINE>return;<NEW_LINE>}<NEW_LINE>boolean enabled = false;<NEW_LINE>// Check the lead row - if it has no attribute instances, no button<NEW_LINE>try {<NEW_LINE>Object value = p_table.getValueAt(row, INDEX_PATTRIBUTE);<NEW_LINE>enabled = <MASK><NEW_LINE>} catch (Exception e) {<NEW_LINE>enabled = false;<NEW_LINE>}<NEW_LINE>if (enabled && p_table.isMultiSelection()) {<NEW_LINE>// Only enable if a single row is selected. Disable for multiple selections.<NEW_LINE>// Multiple selections can be checked or just high-lighted.<NEW_LINE>int checkedRows = p_table.getSelectedKeys().size();<NEW_LINE>int selectedRows = p_table.getSelectedRowCount();<NEW_LINE>log.fine("Checked Rows: " + checkedRows + " SelectedRows: " + selectedRows);<NEW_LINE>if (checkedRows > 1 || selectedRows > 1)<NEW_LINE>enabled = false;<NEW_LINE>else if (// SelectedRows could be zero so don't care<NEW_LINE>checkedRows == 1) {<NEW_LINE>// Check that the lead selection is checked<NEW_LINE>Object data = p_table.getValueAt(row, p_table.getKeyColumnIndex());<NEW_LINE>if (data instanceof IDColumn) {<NEW_LINE>IDColumn record = (IDColumn) data;<NEW_LINE>if (!record.isSelected()) {<NEW_LINE>enabled = false;<NEW_LINE>log.fine("Lead selection is not checked!");<NEW_LINE>}<NEW_LINE>}<NEW_LINE>}<NEW_LINE>}<NEW_LINE>m_PAttributeButton.setEnabled(enabled);<NEW_LINE>}<NEW_LINE>super.enableButtons();<NEW_LINE>}
Boolean.TRUE.equals(value);
945,633
protected void service(HttpServletRequest servletRequest, HttpServletResponse servletResponse) throws ServletException, IOException {<NEW_LINE>PrintWriter responseWriter = servletResponse.getWriter();<NEW_LINE>responseWriter.println(prependType("Entry"));<NEW_LINE>String operation = servletRequest.getParameter(OPERATION_PARAMETER_NAME);<NEW_LINE>if (operation == null) {<NEW_LINE>responseWriter.println("Error: No operation parameter [ " + OPERATION_PARAMETER_NAME + " ]");<NEW_LINE>servletResponse.setStatus(HttpServletResponse.SC_BAD_REQUEST);<NEW_LINE>return;<NEW_LINE>}<NEW_LINE>if (operation.equals(OPERATION_DECREMENT)) {<NEW_LINE>int finalCount = servletCount.decrement();<NEW_LINE>responseWriter.println("Decrement [ " + Integer.toString(finalCount) + " ]");<NEW_LINE>} else if (operation.equals(OPERATION_INCREMENT)) {<NEW_LINE>int finalCount = servletCount.increment();<NEW_LINE>responseWriter.println("Increment [ " + Integer.toString(finalCount) + " ]");<NEW_LINE>} else if (operation.equals(OPERATION_GET_COUNT)) {<NEW_LINE><MASK><NEW_LINE>responseWriter.println("Count [ " + Integer.toString(count) + " ]");<NEW_LINE>} else if (operation.equals(OPERATION_DISPLAY_LOG)) {<NEW_LINE>displayApplicationLog(responseWriter, servletRequest, servletResponse);<NEW_LINE>} else {<NEW_LINE>responseWriter.println("Error: Unknown operation parameter [ " + OPERATION_PARAMETER_NAME + " ] [ " + operation + " ]");<NEW_LINE>servletResponse.setStatus(HttpServletResponse.SC_BAD_REQUEST);<NEW_LINE>return;<NEW_LINE>}<NEW_LINE>responseWriter.println(prependType("Exit"));<NEW_LINE>}
int count = servletCount.getCount();
817,877
public static void handleFlagUsage(LombokNode<?, ?, ?> node, ConfigurationKey<FlagUsageType> key, String featureName) {<NEW_LINE>FlagUsageType fut = node.<MASK><NEW_LINE>if (fut == null && AllowHelper.isAllowable(key)) {<NEW_LINE>node.addError("Use of " + featureName + " is disabled by default. Please add '" + key.getKeyName() + " = " + FlagUsageType.ALLOW + "' to 'lombok.config' if you want to enable is.");<NEW_LINE>}<NEW_LINE>if (fut != null) {<NEW_LINE>String msg = "Use of " + featureName + " is flagged according to lombok configuration.";<NEW_LINE>if (fut == FlagUsageType.WARNING)<NEW_LINE>node.addWarning(msg);<NEW_LINE>else if (fut == FlagUsageType.ERROR)<NEW_LINE>node.addError(msg);<NEW_LINE>}<NEW_LINE>}
getAst().readConfiguration(key);
429,118
static protected String printTokenOnly(Token t) {<NEW_LINE>String retval = "";<NEW_LINE>for (; cline < t.beginLine; cline++) {<NEW_LINE>retval += "\n";<NEW_LINE>ccol = 1;<NEW_LINE>}<NEW_LINE>for (; ccol < t.beginColumn; ccol++) {<NEW_LINE>retval += " ";<NEW_LINE>}<NEW_LINE>if (t.kind == JavaCCParserConstants.STRING_LITERAL || t.kind == JavaCCParserConstants.CHARACTER_LITERAL)<NEW_LINE>retval += addUnicodeEscapes(t.image);<NEW_LINE>else<NEW_LINE>retval += t.image;<NEW_LINE>cline = t.endLine;<NEW_LINE>ccol = t.endColumn + 1;<NEW_LINE>char last = t.image.charAt(t.<MASK><NEW_LINE>if (last == '\n' || last == '\r') {<NEW_LINE>cline++;<NEW_LINE>ccol = 1;<NEW_LINE>}<NEW_LINE>return retval;<NEW_LINE>}
image.length() - 1);
622,425
public void translateToBedrock(CompoundTagBuilder builder, CompoundTag javaTag, String javaId) {<NEW_LINE>if (!javaId.contains("head") && !javaId.contains("skull"))<NEW_LINE>return;<NEW_LINE>String skullType = javaId.substring(0, javaId.indexOf("[")).replace("minecraft:", "");<NEW_LINE>if (javaId.contains("wall")) {<NEW_LINE>skullType = skullType.replace("_wall_head", "").toUpperCase();<NEW_LINE>builder.byteTag("SkullType", (byte) SkullType.valueOf(skullType).getId());<NEW_LINE>} else {<NEW_LINE>skullType = skullType.replace("_head", "").toUpperCase();<NEW_LINE>float rotation = getRotation(Float.parseFloat(javaId.substring(javaId.indexOf("rotation=") + 9, javaId<MASK><NEW_LINE>builder.byteTag("SkullType", (byte) SkullType.valueOf(skullType).getId());<NEW_LINE>builder.floatTag("Rotation", rotation);<NEW_LINE>}<NEW_LINE>}
.indexOf("]"))));
1,007,039
public MethodVisitor visitMethod(int access, String name, String desc, String signature, String[] exceptions) {<NEW_LINE>// Remove bridge default methods in interfaces; javac generates them again for implementing<NEW_LINE>// classes anyways.<NEW_LINE>if (isInterface && (access & (Opcodes.ACC_BRIDGE | Opcodes.ACC_ABSTRACT | Opcodes.ACC_STATIC)) == Opcodes.ACC_BRIDGE) {<NEW_LINE>return null;<NEW_LINE>}<NEW_LINE>if (isInterface && "$jacocoInit".equals(name) && BitFlags.isSet(access, Opcodes.ACC_SYNTHETIC | Opcodes.ACC_STATIC)) {<NEW_LINE>// Drop static interface method that Jacoco generates--we'll inline it into the static<NEW_LINE>// initializer instead<NEW_LINE>return null;<NEW_LINE>}<NEW_LINE>checkArgument(!isInterface || BitFlags.isSet(access, Opcodes.ACC_ABSTRACT) || "<clinit>".equals(name), "Interface %s defines non-abstract method %s%s, which is not supported", internalName, name, desc);<NEW_LINE>MethodVisitor result = new UpdateBytecodeVersionIfNecessary(super.visitMethod(access, name, desc, signature, exceptions));<NEW_LINE>return (isInterface && "<clinit>".equals(name)) <MASK><NEW_LINE>}
? new InlineJacocoInit(result) : result;
1,781,930
public PCollection<Long> expand(PBegin input) {<NEW_LINE><MASK><NEW_LINE>boolean usesUnboundedFeatures = getTimestampFn() != null || getElementsPerPeriod() > 0 || getMaxReadTime() != null;<NEW_LINE>if (!isRangeUnbounded && !usesUnboundedFeatures) {<NEW_LINE>// This is the only case when we can use the bounded CountingSource.<NEW_LINE>return input.apply(Read.from(CountingSource.createSourceForSubrange(getFrom(), getTo())));<NEW_LINE>}<NEW_LINE>CountingSource.UnboundedCountingSource source = CountingSource.createUnboundedFrom(getFrom());<NEW_LINE>if (getTimestampFn() != null) {<NEW_LINE>source = source.withTimestampFn(getTimestampFn());<NEW_LINE>}<NEW_LINE>if (getElementsPerPeriod() > 0) {<NEW_LINE>source = source.withRate(getElementsPerPeriod(), getPeriod());<NEW_LINE>}<NEW_LINE>Read.Unbounded<Long> readUnbounded = Read.from(source);<NEW_LINE>if (getMaxReadTime() == null) {<NEW_LINE>if (isRangeUnbounded) {<NEW_LINE>return input.apply(readUnbounded);<NEW_LINE>} else {<NEW_LINE>return input.apply(readUnbounded.withMaxNumRecords(getTo() - getFrom()));<NEW_LINE>}<NEW_LINE>} else {<NEW_LINE>BoundedReadFromUnboundedSource<Long> withMaxReadTime = readUnbounded.withMaxReadTime(getMaxReadTime());<NEW_LINE>if (isRangeUnbounded) {<NEW_LINE>return input.apply(withMaxReadTime);<NEW_LINE>} else {<NEW_LINE>return input.apply(withMaxReadTime.withMaxNumRecords(getTo() - getFrom()));<NEW_LINE>}<NEW_LINE>}<NEW_LINE>}
boolean isRangeUnbounded = getTo() < 0;
848,543
public Description matchMemberSelect(MemberSelectTree tree, VisitorState state) {<NEW_LINE>if (!state.isAndroidCompatible()) {<NEW_LINE>return Description.NO_MATCH;<NEW_LINE>}<NEW_LINE>Symbol symbol = ASTHelpers.getSymbol(tree);<NEW_LINE>// Match symbol's owner to android.R.string separately because couldn't get fully qualified<NEW_LINE>// "android.R.string.yes" out of symbol, just "yes"<NEW_LINE>if (symbol == null || symbol.owner == null || symbol.getKind() != ElementKind.FIELD || !symbol.isStatic() || !R_STRING_CLASSNAME.contentEquals(symbol.owner.getQualifiedName())) {<NEW_LINE>return Description.NO_MATCH;<NEW_LINE>}<NEW_LINE>String misleading = symbol.getSimpleName().toString();<NEW_LINE>String preferred = MISLEADING.get(misleading);<NEW_LINE>if (preferred == null) {<NEW_LINE>return Description.NO_MATCH;<NEW_LINE>}<NEW_LINE>return // Keep the way tree refers to android.R.string as it is but replace the identifier<NEW_LINE>buildDescription(tree).setMessage(String.format("%s.%s is not \"%s\" but \"%s\"; prefer %s.%s for clarity", R_STRING_CLASSNAME, misleading, ASSUMED_MEANINGS.get(misleading), ASSUMED_MEANINGS.get(preferred), R_STRING_CLASSNAME, preferred)).addFix(SuggestedFix.replace(tree, state.getSourceForNode(tree.getExpression()) + "." <MASK><NEW_LINE>}
+ preferred)).build();
670,651
final DeleteTransitGatewayConnectResult executeDeleteTransitGatewayConnect(DeleteTransitGatewayConnectRequest deleteTransitGatewayConnectRequest) {<NEW_LINE>ExecutionContext executionContext = createExecutionContext(deleteTransitGatewayConnectRequest);<NEW_LINE>AWSRequestMetrics awsRequestMetrics = executionContext.getAwsRequestMetrics();<NEW_LINE>awsRequestMetrics.startEvent(Field.ClientExecuteTime);<NEW_LINE>Request<DeleteTransitGatewayConnectRequest> request = null;<NEW_LINE>Response<DeleteTransitGatewayConnectResult> response = null;<NEW_LINE>try {<NEW_LINE>awsRequestMetrics.startEvent(Field.RequestMarshallTime);<NEW_LINE>try {<NEW_LINE>request = new DeleteTransitGatewayConnectRequestMarshaller().marshall<MASK><NEW_LINE>// Binds the request metrics to the current request.<NEW_LINE>request.setAWSRequestMetrics(awsRequestMetrics);<NEW_LINE>request.addHandlerContext(HandlerContextKey.CLIENT_ENDPOINT, endpoint);<NEW_LINE>request.addHandlerContext(HandlerContextKey.ENDPOINT_OVERRIDDEN, isEndpointOverridden());<NEW_LINE>request.addHandlerContext(HandlerContextKey.SIGNING_REGION, getSigningRegion());<NEW_LINE>request.addHandlerContext(HandlerContextKey.SERVICE_ID, "EC2");<NEW_LINE>request.addHandlerContext(HandlerContextKey.OPERATION_NAME, "DeleteTransitGatewayConnect");<NEW_LINE>request.addHandlerContext(HandlerContextKey.ADVANCED_CONFIG, advancedConfig);<NEW_LINE>} finally {<NEW_LINE>awsRequestMetrics.endEvent(Field.RequestMarshallTime);<NEW_LINE>}<NEW_LINE>StaxResponseHandler<DeleteTransitGatewayConnectResult> responseHandler = new StaxResponseHandler<DeleteTransitGatewayConnectResult>(new DeleteTransitGatewayConnectResultStaxUnmarshaller());<NEW_LINE>response = invoke(request, responseHandler, executionContext);<NEW_LINE>return response.getAwsResponse();<NEW_LINE>} finally {<NEW_LINE>endClientExecution(awsRequestMetrics, request, response);<NEW_LINE>}<NEW_LINE>}
(super.beforeMarshalling(deleteTransitGatewayConnectRequest));
435,631
public com.amazonaws.services.chimesdkmeetings.model.UnauthorizedException unmarshallFromContext(JsonUnmarshallerContext context) throws Exception {<NEW_LINE>com.amazonaws.services.chimesdkmeetings.model.UnauthorizedException unauthorizedException = new com.amazonaws.services.chimesdkmeetings.model.UnauthorizedException(null);<NEW_LINE><MASK><NEW_LINE>String currentParentElement = context.getCurrentParentElement();<NEW_LINE>int targetDepth = originalDepth + 1;<NEW_LINE>JsonToken token = context.getCurrentToken();<NEW_LINE>if (token == null)<NEW_LINE>token = context.nextToken();<NEW_LINE>if (token == VALUE_NULL) {<NEW_LINE>return null;<NEW_LINE>}<NEW_LINE>while (true) {<NEW_LINE>if (token == null)<NEW_LINE>break;<NEW_LINE>if (token == FIELD_NAME || token == START_OBJECT) {<NEW_LINE>if (context.testExpression("Code", targetDepth)) {<NEW_LINE>context.nextToken();<NEW_LINE>unauthorizedException.setCode(context.getUnmarshaller(String.class).unmarshall(context));<NEW_LINE>}<NEW_LINE>if (context.testExpression("RequestId", targetDepth)) {<NEW_LINE>context.nextToken();<NEW_LINE>unauthorizedException.setRequestId(context.getUnmarshaller(String.class).unmarshall(context));<NEW_LINE>}<NEW_LINE>} else if (token == END_ARRAY || token == END_OBJECT) {<NEW_LINE>if (context.getLastParsedParentElement() == null || context.getLastParsedParentElement().equals(currentParentElement)) {<NEW_LINE>if (context.getCurrentDepth() <= originalDepth)<NEW_LINE>break;<NEW_LINE>}<NEW_LINE>}<NEW_LINE>token = context.nextToken();<NEW_LINE>}<NEW_LINE>return unauthorizedException;<NEW_LINE>}
int originalDepth = context.getCurrentDepth();
1,200,491
public void addOperationToGroup(String tag, String resourcePath, Operation operation, CodegenOperation co, Map<String, List<CodegenOperation>> operations) {<NEW_LINE>if ((SPRING_BOOT.equals(library) && !useTags)) {<NEW_LINE>String basePath = resourcePath;<NEW_LINE>if (basePath.startsWith("/")) {<NEW_LINE>basePath = basePath.substring(1);<NEW_LINE>}<NEW_LINE>final int <MASK><NEW_LINE>if (pos > 0) {<NEW_LINE>basePath = basePath.substring(0, pos);<NEW_LINE>}<NEW_LINE>if (basePath.isEmpty()) {<NEW_LINE>basePath = "default";<NEW_LINE>} else {<NEW_LINE>co.subresourceOperation = !co.path.isEmpty();<NEW_LINE>}<NEW_LINE>final List<CodegenOperation> opList = operations.computeIfAbsent(basePath, k -> new ArrayList<>());<NEW_LINE>opList.add(co);<NEW_LINE>co.baseName = basePath;<NEW_LINE>} else {<NEW_LINE>super.addOperationToGroup(tag, resourcePath, operation, co, operations);<NEW_LINE>}<NEW_LINE>}
pos = basePath.indexOf("/");
956,334
public void writeTo(com.google.protobuf.CodedOutputStream output) throws java.io.IOException {<NEW_LINE>getSerializedSize();<NEW_LINE>if (((bitField0_ & 0x00000001) == 0x00000001)) {<NEW_LINE>output.writeBytes(1, getGroupIdBytes());<NEW_LINE>}<NEW_LINE>if (((bitField0_ & 0x00000002) == 0x00000002)) {<NEW_LINE><MASK><NEW_LINE>}<NEW_LINE>for (int i = 0; i < userId_.size(); i++) {<NEW_LINE>output.writeBytes(3, userId_.getByteString(i));<NEW_LINE>}<NEW_LINE>for (int i = 0; i < toLine_.size(); i++) {<NEW_LINE>output.writeInt32(4, toLine_.get(i));<NEW_LINE>}<NEW_LINE>if (((bitField0_ & 0x00000004) == 0x00000004)) {<NEW_LINE>output.writeMessage(5, notifyContent_);<NEW_LINE>}<NEW_LINE>getUnknownFields().writeTo(output);<NEW_LINE>}
output.writeInt32(2, type_);
1,465,527
public static Object serialize(Object value) {<NEW_LINE>if (Cls.kindOf(value) != TypeKind.UNKNOWN || value instanceof Enum) {<NEW_LINE>return value;<NEW_LINE>} else if (value instanceof Var<?>) {<NEW_LINE>Var<?> var = (Var<?>) value;<NEW_LINE>return serialize(U.map(var.name(), var.get()));<NEW_LINE>} else if (value instanceof Set) {<NEW_LINE>Set<Object> set = U.set();<NEW_LINE>for (Object item : ((Set<?>) value)) {<NEW_LINE>set.add(serialize(item));<NEW_LINE>}<NEW_LINE>return set;<NEW_LINE>} else if (value instanceof List) {<NEW_LINE>List<Object> list = U.list();<NEW_LINE>for (Object item : ((List<?>) value)) {<NEW_LINE>list.add(serialize(item));<NEW_LINE>}<NEW_LINE>return list;<NEW_LINE>} else if (value instanceof Object[]) {<NEW_LINE>Object[] <MASK><NEW_LINE>Object[] arr = new Object[vals.length];<NEW_LINE>for (int i = 0; i < arr.length; i++) {<NEW_LINE>arr[i] = serialize(vals[i]);<NEW_LINE>}<NEW_LINE>return arr;<NEW_LINE>} else if (value instanceof Map) {<NEW_LINE>Map<Object, Object> map = U.map();<NEW_LINE>for (Entry<?, ?> e : ((Map<?, ?>) value).entrySet()) {<NEW_LINE>map.put(serialize(e.getKey()), serialize(e.getValue()));<NEW_LINE>}<NEW_LINE>return map;<NEW_LINE>} else if (value.getClass().isArray()) {<NEW_LINE>// a primitive array<NEW_LINE>return value;<NEW_LINE>} else {<NEW_LINE>return read(value);<NEW_LINE>}<NEW_LINE>}
vals = (Object[]) value;
1,804,302
public FailureInfo unmarshall(JsonUnmarshallerContext context) throws Exception {<NEW_LINE>FailureInfo failureInfo = new FailureInfo();<NEW_LINE>int originalDepth = context.getCurrentDepth();<NEW_LINE>String currentParentElement = context.getCurrentParentElement();<NEW_LINE>int targetDepth = originalDepth + 1;<NEW_LINE><MASK><NEW_LINE>if (token == null)<NEW_LINE>token = context.nextToken();<NEW_LINE>if (token == VALUE_NULL) {<NEW_LINE>return 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("StatusCode", targetDepth)) {<NEW_LINE>context.nextToken();<NEW_LINE>failureInfo.setStatusCode(context.getUnmarshaller(Integer.class).unmarshall(context));<NEW_LINE>}<NEW_LINE>if (context.testExpression("ErrorCode", targetDepth)) {<NEW_LINE>context.nextToken();<NEW_LINE>failureInfo.setErrorCode(context.getUnmarshaller(String.class).unmarshall(context));<NEW_LINE>}<NEW_LINE>if (context.testExpression("ErrorMessage", targetDepth)) {<NEW_LINE>context.nextToken();<NEW_LINE>failureInfo.setErrorMessage(context.getUnmarshaller(String.class).unmarshall(context));<NEW_LINE>}<NEW_LINE>} else if (token == END_ARRAY || token == END_OBJECT) {<NEW_LINE>if (context.getLastParsedParentElement() == null || context.getLastParsedParentElement().equals(currentParentElement)) {<NEW_LINE>if (context.getCurrentDepth() <= originalDepth)<NEW_LINE>break;<NEW_LINE>}<NEW_LINE>}<NEW_LINE>token = context.nextToken();<NEW_LINE>}<NEW_LINE>return failureInfo;<NEW_LINE>}
JsonToken token = context.getCurrentToken();
249,326
public synchronized void publish(LogRecord record) {<NEW_LINE>ThreadKey threadId = new ThreadKey();<NEW_LINE>SessionId sessionId = threadToSessionMap.get(threadId);<NEW_LINE>if (sessionId != null) {<NEW_LINE>List<LogRecord> records = perSessionRecords.get(sessionId);<NEW_LINE>if (records == null) {<NEW_LINE>records = new ArrayList<>();<NEW_LINE>}<NEW_LINE>records.add(record);<NEW_LINE>perSessionRecords.put(sessionId, records);<NEW_LINE>if (records.size() > capacity) {<NEW_LINE>perSessionRecords.put(sessionId<MASK><NEW_LINE>// flush records to file;<NEW_LINE>try {<NEW_LINE>logFileRepository.flushRecordsToLogFile(sessionId, records);<NEW_LINE>// clear in memory session records<NEW_LINE>records.clear();<NEW_LINE>} catch (IOException ex) {<NEW_LINE>ex.printStackTrace();<NEW_LINE>}<NEW_LINE>}<NEW_LINE>} else {<NEW_LINE>perThreadTempRecords.computeIfAbsent(threadId, k -> new ArrayList<>()).add(record);<NEW_LINE>}<NEW_LINE>}
, new ArrayList<>());
26,878
@Consumes(MediaType.APPLICATION_JSON)<NEW_LINE>@Produces(MediaType.APPLICATION_JSON)<NEW_LINE>@ApiOperation(value = "Adds the license to the specified license group.", response = LicenseGroup.class)<NEW_LINE>@ApiResponses(value = { @ApiResponse(code = 304, message = "The license group already has the specified license assigned"), @ApiResponse(code = 401, message = "Unauthorized"), @ApiResponse(code = 404, message = "The license group or license could not be found") })<NEW_LINE>@PermissionRequired(Permissions.Constants.POLICY_MANAGEMENT)<NEW_LINE>public Response addLicenseToLicenseGroup(@ApiParam(value = "A valid license group", required = true) @PathParam("uuid") String uuid, @ApiParam(value = "A valid license", required = true) @PathParam("licenseUuid") String licenseUuid) {<NEW_LINE>try (QueryManager qm = new QueryManager()) {<NEW_LINE>LicenseGroup licenseGroup = qm.getObjectByUuid(LicenseGroup.class, uuid);<NEW_LINE>if (licenseGroup == null) {<NEW_LINE>return Response.status(Response.Status.NOT_FOUND).entity("The license group could not be found.").build();<NEW_LINE>}<NEW_LINE>final License license = qm.<MASK><NEW_LINE>if (license == null) {<NEW_LINE>return Response.status(Response.Status.NOT_FOUND).entity("The license could not be found.").build();<NEW_LINE>}<NEW_LINE>final List<License> licenses = licenseGroup.getLicenses();<NEW_LINE>if (licenses != null && !licenses.contains(license)) {<NEW_LINE>licenses.add(license);<NEW_LINE>licenseGroup.setLicenses(licenses);<NEW_LINE>qm.persist(licenseGroup);<NEW_LINE>return Response.ok(licenseGroup).build();<NEW_LINE>}<NEW_LINE>return Response.status(Response.Status.NOT_MODIFIED).build();<NEW_LINE>}<NEW_LINE>}
getObjectByUuid(License.class, licenseUuid);
468,882
public static String convert(final int n) {<NEW_LINE>// System.out.println("n = " + n);<NEW_LINE>if (n == 0) {<NEW_LINE>return "zero";<NEW_LINE>}<NEW_LINE>if (n < 0) {<NEW_LINE><MASK><NEW_LINE>}<NEW_LINE>if (n < 20) {<NEW_LINE>return units[n];<NEW_LINE>}<NEW_LINE>if (n < 100) {<NEW_LINE>return tens[n / 10] + ((n % 10 != 0) ? " " : "") + units[n % 10];<NEW_LINE>}<NEW_LINE>if (n < 1000) {<NEW_LINE>return units[n / 100] + " hundred" + ((n % 100 != 0) ? " " : "") + convert(n % 100);<NEW_LINE>}<NEW_LINE>if (n < 1000000) {<NEW_LINE>return convert(n / 1000) + " thousand" + ((n % 1000 != 0) ? " " : "") + convert(n % 1000);<NEW_LINE>}<NEW_LINE>if (n < 1000000000) {<NEW_LINE>return convert(n / 1000000) + " million" + ((n % 1000000 != 0) ? " " : "") + convert(n % 1000000);<NEW_LINE>}<NEW_LINE>return convert(n / 1000000000) + " billion" + ((n % 1000000000 != 0) ? " " : "") + convert(n % 1000000000);<NEW_LINE>}
return "minus " + convert(-n);
312,209
public ListNotebookExecutionsResult unmarshall(JsonUnmarshallerContext context) throws Exception {<NEW_LINE>ListNotebookExecutionsResult listNotebookExecutionsResult = new ListNotebookExecutionsResult();<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 listNotebookExecutionsResult;<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("NotebookExecutions", targetDepth)) {<NEW_LINE>context.nextToken();<NEW_LINE>listNotebookExecutionsResult.setNotebookExecutions(new ListUnmarshaller<NotebookExecutionSummary>(NotebookExecutionSummaryJsonUnmarshaller.getInstance()).unmarshall(context));<NEW_LINE>}<NEW_LINE>if (context.testExpression("Marker", targetDepth)) {<NEW_LINE>context.nextToken();<NEW_LINE>listNotebookExecutionsResult.setMarker(context.getUnmarshaller(String.class).unmarshall(context));<NEW_LINE>}<NEW_LINE>} else if (token == END_ARRAY || token == END_OBJECT) {<NEW_LINE>if (context.getLastParsedParentElement() == null || context.getLastParsedParentElement().equals(currentParentElement)) {<NEW_LINE>if (context.getCurrentDepth() <= originalDepth)<NEW_LINE>break;<NEW_LINE>}<NEW_LINE>}<NEW_LINE>token = context.nextToken();<NEW_LINE>}<NEW_LINE>return listNotebookExecutionsResult;<NEW_LINE>}
int originalDepth = context.getCurrentDepth();
46,042
public Stream<CSVResult> csvParams(@Name("urlOrBinary") Object urlOrBinary, @Name("httpHeaders") Map<String, Object> httpHeaders, @Name("payload") String payload, @Name(value = "config", defaultValue = "{}") Map<String, Object> configMap) {<NEW_LINE>LoadCsvConfig config = new LoadCsvConfig(configMap);<NEW_LINE>CountingReader reader = null;<NEW_LINE>try {<NEW_LINE>String url = null;<NEW_LINE>if (urlOrBinary instanceof String) {<NEW_LINE>url = (String) urlOrBinary;<NEW_LINE>httpHeaders = httpHeaders != null ? httpHeaders : new HashMap<>();<NEW_LINE>httpHeaders.putAll(Util<MASK><NEW_LINE>}<NEW_LINE>reader = FileUtils.readerFor(urlOrBinary, httpHeaders, payload, config.getCompressionAlgo());<NEW_LINE>return streamCsv(url, config, reader);<NEW_LINE>} catch (IOException e) {<NEW_LINE>closeReaderSafely(reader);<NEW_LINE>if (!config.isFailOnError())<NEW_LINE>return Stream.of(new CSVResult(new String[0], new String[0], 0, true, Collections.emptyMap(), emptyList(), EnumSet.noneOf(Results.class)));<NEW_LINE>else<NEW_LINE>throw new RuntimeException("Can't read CSV " + (urlOrBinary instanceof String ? "from URL " + cleanUrl((String) urlOrBinary) : "from binary"), e);<NEW_LINE>}<NEW_LINE>}
.extractCredentialsIfNeeded(url, true));
1,417,723
private static void printUsageAndExit() {<NEW_LINE>System.err.println(AfcClient.class.getName() + " [deviceid] <action> ...");<NEW_LINE>System.err.println(" Actions:");<NEW_LINE>System.err.println(" deviceinfo Prints device file system information.");<NEW_LINE>System.err.println(" rm [-f] <path> Deletes <path> from the device. Deletes non-empty dirs if -f is specified.");<NEW_LINE>System.err.println(" ls [-r] <path> Lists the contents of the specified dir.");<NEW_LINE><MASK><NEW_LINE>System.err.println(" mv <from> <to> Moves (renames) the remote path <from> to <to>.");<NEW_LINE>System.err.println(" upload <localpath> <remotedir>\n" + " Uploads the local file or dir at <localpath> to the remote dir <remotedir>.");<NEW_LINE>System.exit(0);<NEW_LINE>}
System.err.println(" mkdir <dir> Creates the <dir> on the device.");
1,516,464
protected void configure() {<NEW_LINE>// Message body providers (both readers & writers)<NEW_LINE>bindSingletonWorker(ByteArrayProvider.class);<NEW_LINE>// bindSingletonWorker(DataSourceProvider.class);<NEW_LINE>bindSingletonWorker(FileProvider.class);<NEW_LINE>bindSingletonWorker(FormMultivaluedMapProvider.class);<NEW_LINE>bindSingletonWorker(FormProvider.class);<NEW_LINE>bindSingletonWorker(InputStreamProvider.class);<NEW_LINE>bindSingletonWorker(BasicTypesMessageProvider.class);<NEW_LINE>bindSingletonWorker(ReaderProvider.class);<NEW_LINE>// bindSingletonWorker(RenderedImageProvider.class); - enabledProvidersBinder<NEW_LINE>bindSingletonWorker(StringMessageProvider.class);<NEW_LINE>bindSingletonWorker(EnumMessageProvider.class);<NEW_LINE>// Message body readers -- enabledProvidersBinder<NEW_LINE>// bind(SourceProvider.StreamSourceReader.class).to(MessageBodyReader.class).in(Singleton.class);<NEW_LINE>// bind(SourceProvider.SaxSourceReader.class).to(MessageBodyReader.class).in(Singleton.class);<NEW_LINE>// bind(SourceProvider.DomSourceReader.class).to(MessageBodyReader.class).in(Singleton.class);<NEW_LINE>// Message body writers<NEW_LINE>bind(StreamingOutputProvider.class).to(MessageBodyWriter.class).in(Singleton.class);<NEW_LINE>// bind(SourceProvider.SourceWriter.class).to(MessageBodyWriter.class).in(Singleton.class); - enabledProvidersBinder<NEW_LINE>final EnabledProvidersBinder enabledProvidersBinder = new EnabledProvidersBinder();<NEW_LINE>if (applicationProperties != null && applicationProperties.get(CommonProperties.PROVIDER_DEFAULT_DISABLE) != null) {<NEW_LINE>enabledProvidersBinder.markDisabled(String.valueOf(applicationProperties.get(CommonProperties.PROVIDER_DEFAULT_DISABLE)));<NEW_LINE>}<NEW_LINE>enabledProvidersBinder.bindToBinder(this);<NEW_LINE>// Header Delegate Providers registered in META-INF.services<NEW_LINE>install(new ServiceFinderBinder<>(HeaderDelegateProvider<MASK><NEW_LINE>}
.class, applicationProperties, runtimeType));
646,885
protected StringBuilder replaceParameter(Map<String, ? extends Object> paramMap, boolean fromEncodedMap, boolean isTemplate, String string, StringBuilder builder, boolean encodeSlash) {<NEW_LINE>if (string.indexOf('{') == -1) {<NEW_LINE>return builder.append(string);<NEW_LINE>}<NEW_LINE>Matcher matcher = createUriParamMatcher(string);<NEW_LINE>int start = 0;<NEW_LINE>while (matcher.find()) {<NEW_LINE>builder.append(string, start, matcher.start());<NEW_LINE>String param = matcher.group(1);<NEW_LINE>boolean containsValueForParam = paramMap.containsKey(param);<NEW_LINE>if (!containsValueForParam) {<NEW_LINE>if (isTemplate) {<NEW_LINE>builder.append(matcher.group());<NEW_LINE>start = matcher.end();<NEW_LINE>continue;<NEW_LINE>}<NEW_LINE>throw new IllegalArgumentException("Path parameter not provided " + param);<NEW_LINE>}<NEW_LINE>Object value = paramMap.get(param);<NEW_LINE>String stringValue = value != null ? value.toString() : null;<NEW_LINE>if (stringValue != null) {<NEW_LINE>if (!fromEncodedMap) {<NEW_LINE>if (encodeSlash)<NEW_LINE>stringValue = Encode.encodePathSegmentAsIs(stringValue);<NEW_LINE>else<NEW_LINE>stringValue = Encode.encodePathAsIs(stringValue);<NEW_LINE>} else {<NEW_LINE>if (encodeSlash)<NEW_LINE>stringValue = Encode.encodePathSegmentSaveEncodings(stringValue);<NEW_LINE>else<NEW_LINE><MASK><NEW_LINE>}<NEW_LINE>builder.append(stringValue);<NEW_LINE>start = matcher.end();<NEW_LINE>} else {<NEW_LINE>throw new IllegalArgumentException("Template parameter null: " + param);<NEW_LINE>}<NEW_LINE>}<NEW_LINE>builder.append(string, start, string.length());<NEW_LINE>return builder;<NEW_LINE>}
stringValue = Encode.encodePathSaveEncodings(stringValue);
1,096,020
static ConfigOrigin mergeOrigins(Collection<? extends ConfigOrigin> stack) {<NEW_LINE>if (stack.isEmpty()) {<NEW_LINE>throw new ConfigException.BugOrBroken("can't merge empty list of origins");<NEW_LINE>} else if (stack.size() == 1) {<NEW_LINE>return stack.iterator().next();<NEW_LINE>} else if (stack.size() == 2) {<NEW_LINE>Iterator<? extends ConfigOrigin> i = stack.iterator();<NEW_LINE>return mergeTwo((SimpleConfigOrigin) i.next(), (SimpleConfigOrigin) i.next());<NEW_LINE>} else {<NEW_LINE>List<SimpleConfigOrigin> remaining = new ArrayList<SimpleConfigOrigin>(stack.size());<NEW_LINE>for (ConfigOrigin o : stack) {<NEW_LINE>remaining.add((SimpleConfigOrigin) o);<NEW_LINE>}<NEW_LINE>while (remaining.size() > 2) {<NEW_LINE>SimpleConfigOrigin c = remaining.get(remaining.size() - 1);<NEW_LINE>remaining.remove(remaining.size() - 1);<NEW_LINE>SimpleConfigOrigin b = remaining.get(<MASK><NEW_LINE>remaining.remove(remaining.size() - 1);<NEW_LINE>SimpleConfigOrigin a = remaining.get(remaining.size() - 1);<NEW_LINE>remaining.remove(remaining.size() - 1);<NEW_LINE>SimpleConfigOrigin merged = mergeThree(a, b, c);<NEW_LINE>remaining.add(merged);<NEW_LINE>}<NEW_LINE>// should be down to either 1 or 2<NEW_LINE>return mergeOrigins(remaining);<NEW_LINE>}<NEW_LINE>}
remaining.size() - 1);
676,856
private void writeInternal(ChannelHandlerContext ctx, Object msg, ChannelPromise promise) throws Exception {<NEW_LINE>if (!ctx.channel().isActive()) {<NEW_LINE>ReferenceCountUtil.release(msg);<NEW_LINE>return;<NEW_LINE>}<NEW_LINE>if (msg instanceof HttpRequestMessage) {<NEW_LINE>promise.addListener((future) -> {<NEW_LINE>if (!future.isSuccess()) {<NEW_LINE>Throwable cause = ctx.channel().attr(SSL_HANDSHAKE_UNSUCCESS_FROM_ORIGIN_THROWABLE).get();<NEW_LINE>if (cause != null) {<NEW_LINE>// Set the specific SSL handshake error if the handlers have already caught them<NEW_LINE>ctx.channel().attr(SSL_HANDSHAKE_UNSUCCESS_FROM_ORIGIN_THROWABLE).set(null);<NEW_LINE>fireWriteError("request headers", cause, ctx);<NEW_LINE>LOG.debug("SSLException is overridden by SSLHandshakeException caught in handler level. Original SSL exception message: ", future.cause());<NEW_LINE>} else {<NEW_LINE>fireWriteError("request headers", future.cause(), ctx);<NEW_LINE>}<NEW_LINE>}<NEW_LINE>});<NEW_LINE>HttpRequestMessage zuulReq = (HttpRequestMessage) msg;<NEW_LINE>preWriteHook(ctx, zuulReq);<NEW_LINE>super.write(ctx, buildOriginHttpRequest(zuulReq), promise);<NEW_LINE>} else if (msg instanceof HttpContent) {<NEW_LINE>promise.addListener((future) -> {<NEW_LINE>if (!future.isSuccess()) {<NEW_LINE>fireWriteError("request content chunk", future.cause(), ctx);<NEW_LINE>}<NEW_LINE>});<NEW_LINE>super.write(ctx, msg, promise);<NEW_LINE>} else {<NEW_LINE>// should never happen<NEW_LINE>ReferenceCountUtil.release(msg);<NEW_LINE><MASK><NEW_LINE>}<NEW_LINE>}
throw new ZuulException("Received invalid message from client", true);
842,046
protected void paintIcon(Component c, Graphics2D g) {<NEW_LINE>if (!ignoreButtonState && c instanceof AbstractButton) {<NEW_LINE>ButtonModel model = ((AbstractButton) c).getModel();<NEW_LINE>if (model.isPressed() || model.isRollover()) {<NEW_LINE>// paint filled circle with cross<NEW_LINE>g.setColor(model.isPressed() ? clearIconPressedColor : clearIconHoverColor);<NEW_LINE>Path2D path = new <MASK><NEW_LINE>path.append(new Ellipse2D.Float(1.75f, 1.75f, 12.5f, 12.5f), false);<NEW_LINE>path.append(FlatUIUtils.createPath(4.5, 5.5, 5.5, 4.5, 8, 7, 10.5, 4.5, 11.5, 5.5, 9, 8, 11.5, 10.5, 10.5, 11.5, 8, 9, 5.5, 11.5, 4.5, 10.5, 7, 8), false);<NEW_LINE>g.fill(path);<NEW_LINE>return;<NEW_LINE>}<NEW_LINE>}<NEW_LINE>// paint cross<NEW_LINE>g.setColor(clearIconColor);<NEW_LINE>Path2D path = new Path2D.Float(Path2D.WIND_EVEN_ODD);<NEW_LINE>path.append(new Line2D.Float(5, 5, 11, 11), false);<NEW_LINE>path.append(new Line2D.Float(5, 11, 11, 5), false);<NEW_LINE>g.draw(path);<NEW_LINE>}
Path2D.Float(Path2D.WIND_EVEN_ODD);
1,394,072
public ImportResult importItem(UUID jobId, IdempotentImportExecutor idempotentExecutor, TokensAndUrlAuthData authData, SocialActivityContainerResource data) throws Exception {<NEW_LINE>Blogger blogger = getOrCreateBloggerService(authData);<NEW_LINE>BlogList blogList = blogger.blogs().listByUser("self").execute();<NEW_LINE>// NB: we are just publishing everything to the first blog, which is a bit of a hack,<NEW_LINE>// but there is no API to create a new blog.<NEW_LINE>String blogId = blogList.getItems().get(0).getId();<NEW_LINE>for (SocialActivityModel activity : data.getActivities()) {<NEW_LINE>if (activity.getType() == SocialActivityType.NOTE || activity.getType() == SocialActivityType.POST) {<NEW_LINE>try {<NEW_LINE>insertActivity(idempotentExecutor, data.getActor(<MASK><NEW_LINE>} catch (IOException | RuntimeException e) {<NEW_LINE>throw new IOException("Couldn't import: " + activity, e);<NEW_LINE>}<NEW_LINE>}<NEW_LINE>}<NEW_LINE>return new ImportResult(ResultType.OK);<NEW_LINE>}
), activity, blogId, authData);
890,935
private static MapVersionInterpreter[] values() {<NEW_LINE>if (values == null) {<NEW_LINE>try (InputStream resource = ResourceController.getResourceController().getResource("/xml/mapVersions.xml").openStream()) {<NEW_LINE>DocumentBuilderFactory domFactory = DocumentBuilderFactory.newInstance();<NEW_LINE><MASK><NEW_LINE>Document dom = documentBuilder.parse(resource);<NEW_LINE>Element root = dom.getDocumentElement();<NEW_LINE>NodeList dialectElements = root.getElementsByTagName("dialect");<NEW_LINE>final int dialectNumber = dialectElements.getLength();<NEW_LINE>values = new MapVersionInterpreter[dialectNumber];<NEW_LINE>for (int i = 0; i < dialectNumber; i++) {<NEW_LINE>Element dialectElement = (Element) dialectElements.item(i);<NEW_LINE>String versionBegin = dialectElement.getAttribute("versionBegin");<NEW_LINE>boolean needsConversion = Boolean.parseBoolean(dialectElement.getAttribute("needsConversion"));<NEW_LINE>boolean anotherDialect = Boolean.parseBoolean(dialectElement.getAttribute("anotherDialect"));<NEW_LINE>String name = dialectElement.getAttribute("name");<NEW_LINE>String appName = dialectElement.getAttribute("appName");<NEW_LINE>String url = dialectElement.getAttribute("url");<NEW_LINE>int version = Integer.parseInt(dialectElement.getAttribute("version"));<NEW_LINE>values[i] = new MapVersionInterpreter(name, version, versionBegin, needsConversion, anotherDialect, appName, url);<NEW_LINE>}<NEW_LINE>} catch (Exception e) {<NEW_LINE>LogUtils.severe(e);<NEW_LINE>values = new MapVersionInterpreter[] {};<NEW_LINE>}<NEW_LINE>}<NEW_LINE>return values;<NEW_LINE>}
DocumentBuilder documentBuilder = domFactory.newDocumentBuilder();
276,532
public void updateGovernanceZone(String userId, String zoneGUID, boolean isMergeUpdate, GovernanceZoneProperties properties) throws InvalidParameterException, UserNotAuthorizedException, PropertyServerException {<NEW_LINE>final String methodName = "updateGovernanceZone";<NEW_LINE>final String guidParameter = "zoneGUID";<NEW_LINE>final String qualifiedNameParameter = "qualifiedName";<NEW_LINE>final String urlTemplate = "/servers/{0}/open-metadata/access-services/governance-program/users/{1}/governance-zones/{2}?isMergeUpdate={3}";<NEW_LINE>invalidParameterHandler.validateUserId(userId, methodName);<NEW_LINE>invalidParameterHandler.validateGUID(zoneGUID, guidParameter, methodName);<NEW_LINE>invalidParameterHandler.validateObject(properties, qualifiedNameParameter, methodName);<NEW_LINE>if (!isMergeUpdate) {<NEW_LINE>invalidParameterHandler.validateName(properties.getQualifiedName(), qualifiedNameParameter, methodName);<NEW_LINE>}<NEW_LINE>restClient.callVoidPostRESTCall(methodName, serverPlatformURLRoot + urlTemplate, properties, <MASK><NEW_LINE>}
serverName, userId, zoneGUID, isMergeUpdate);
942,837
private KeyManagerFactory createAndInitKeyManagerFactory() throws Exception {<NEW_LINE>X509Certificate certHolder = readCertFile(cert);<NEW_LINE>Object keyObject = readPrivateKeyFile(privateKey);<NEW_LINE>char[] passwordCharArray = "".toCharArray();<NEW_LINE>if (!StringUtils.isEmpty(password)) {<NEW_LINE>passwordCharArray = password.toCharArray();<NEW_LINE>}<NEW_LINE>JcaPEMKeyConverter keyConverter = new JcaPEMKeyConverter().setProvider("BC");<NEW_LINE>PrivateKey privateKey;<NEW_LINE>if (keyObject instanceof PEMEncryptedKeyPair) {<NEW_LINE>PEMDecryptorProvider provider = new JcePEMDecryptorProviderBuilder().build(passwordCharArray);<NEW_LINE>KeyPair key = keyConverter.getKeyPair(((PEMEncryptedKeyPair) keyObject).decryptKeyPair(provider));<NEW_LINE>privateKey = key.getPrivate();<NEW_LINE>} else if (keyObject instanceof PEMKeyPair) {<NEW_LINE>KeyPair key = keyConverter.getKeyPair((PEMKeyPair) keyObject);<NEW_LINE>privateKey = key.getPrivate();<NEW_LINE>} else if (keyObject instanceof PrivateKey) {<NEW_LINE>privateKey = (PrivateKey) keyObject;<NEW_LINE>} else {<NEW_LINE>throw new RuntimeException("Unable to get private key from object: " + keyObject.getClass());<NEW_LINE>}<NEW_LINE>KeyStore clientKeyStore = KeyStore.<MASK><NEW_LINE>clientKeyStore.load(null, null);<NEW_LINE>clientKeyStore.setCertificateEntry("cert", certHolder);<NEW_LINE>clientKeyStore.setKeyEntry("private-key", privateKey, passwordCharArray, new Certificate[] { certHolder });<NEW_LINE>KeyManagerFactory keyManagerFactory = KeyManagerFactory.getInstance(KeyManagerFactory.getDefaultAlgorithm());<NEW_LINE>keyManagerFactory.init(clientKeyStore, passwordCharArray);<NEW_LINE>return keyManagerFactory;<NEW_LINE>}
getInstance(KeyStore.getDefaultType());
778,039
final ListReceiptFiltersResult executeListReceiptFilters(ListReceiptFiltersRequest listReceiptFiltersRequest) {<NEW_LINE>ExecutionContext executionContext = createExecutionContext(listReceiptFiltersRequest);<NEW_LINE>AWSRequestMetrics awsRequestMetrics = executionContext.getAwsRequestMetrics();<NEW_LINE>awsRequestMetrics.startEvent(Field.ClientExecuteTime);<NEW_LINE>Request<ListReceiptFiltersRequest> request = null;<NEW_LINE>Response<ListReceiptFiltersResult> response = null;<NEW_LINE>try {<NEW_LINE><MASK><NEW_LINE>try {<NEW_LINE>request = new ListReceiptFiltersRequestMarshaller().marshall(super.beforeMarshalling(listReceiptFiltersRequest));<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, "SES");<NEW_LINE>request.addHandlerContext(HandlerContextKey.OPERATION_NAME, "ListReceiptFilters");<NEW_LINE>request.addHandlerContext(HandlerContextKey.ADVANCED_CONFIG, advancedConfig);<NEW_LINE>} finally {<NEW_LINE>awsRequestMetrics.endEvent(Field.RequestMarshallTime);<NEW_LINE>}<NEW_LINE>StaxResponseHandler<ListReceiptFiltersResult> responseHandler = new StaxResponseHandler<ListReceiptFiltersResult>(new ListReceiptFiltersResultStaxUnmarshaller());<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);
270,155
public void serializeWithType(AWSCredentialsProvider credentialsProvider, JsonGenerator jsonGenerator, SerializerProvider serializers, TypeSerializer typeSerializer) throws IOException {<NEW_LINE>// BEAM-11958 Use deprecated Jackson APIs to be compatible with older versions of jackson<NEW_LINE>typeSerializer.writeTypePrefixForObject(credentialsProvider, jsonGenerator);<NEW_LINE>Class<?> providerClass = credentialsProvider.getClass();<NEW_LINE>if (providerClass.equals(AWSStaticCredentialsProvider.class)) {<NEW_LINE>AWSCredentials credentials = credentialsProvider.getCredentials();<NEW_LINE>if (credentials.getClass().equals(BasicSessionCredentials.class)) {<NEW_LINE>BasicSessionCredentials sessionCredentials = (BasicSessionCredentials) credentials;<NEW_LINE>jsonGenerator.writeStringField(AWS_ACCESS_KEY_ID, sessionCredentials.getAWSAccessKeyId());<NEW_LINE>jsonGenerator.writeStringField(AWS_SECRET_KEY, sessionCredentials.getAWSSecretKey());<NEW_LINE>jsonGenerator.writeStringField(SESSION_TOKEN, sessionCredentials.getSessionToken());<NEW_LINE>} else {<NEW_LINE>jsonGenerator.writeStringField(AWS_ACCESS_KEY_ID, credentials.getAWSAccessKeyId());<NEW_LINE>jsonGenerator.writeStringField(AWS_SECRET_KEY, credentials.getAWSSecretKey());<NEW_LINE>}<NEW_LINE>} else if (providerClass.equals(PropertiesFileCredentialsProvider.class)) {<NEW_LINE>String filePath = (String) readField(credentialsProvider, CREDENTIALS_FILE_PATH);<NEW_LINE>jsonGenerator.writeStringField(CREDENTIALS_FILE_PATH, filePath);<NEW_LINE>} else if (providerClass.equals(ClasspathPropertiesFileCredentialsProvider.class)) {<NEW_LINE>String filePath = (String) readField(credentialsProvider, CREDENTIALS_FILE_PATH);<NEW_LINE>jsonGenerator.writeStringField(CREDENTIALS_FILE_PATH, filePath);<NEW_LINE>} else if (providerClass.equals(STSAssumeRoleSessionCredentialsProvider.class)) {<NEW_LINE>String arn = (String) readField(credentialsProvider, ROLE_ARN);<NEW_LINE>String sessionName = (String) readField(credentialsProvider, ROLE_SESSION_NAME);<NEW_LINE>jsonGenerator.writeStringField(ROLE_ARN, arn);<NEW_LINE><MASK><NEW_LINE>} else if (!SINGLETON_CREDENTIAL_PROVIDERS.contains(providerClass)) {<NEW_LINE>throw new IllegalArgumentException("Unsupported AWS credentials provider type " + providerClass);<NEW_LINE>}<NEW_LINE>// BEAM-11958 Use deprecated Jackson APIs to be compatible with older versions of jackson<NEW_LINE>typeSerializer.writeTypeSuffixForObject(credentialsProvider, jsonGenerator);<NEW_LINE>}
jsonGenerator.writeStringField(ROLE_SESSION_NAME, sessionName);
706,428
/*<NEW_LINE>* @param password The incoming password.<NEW_LINE>* @param encryptedPassword The stored password digest.<NEW_LINE>* @return true if the password matches, false otherwise.<NEW_LINE>* @throws NoSuchAlgorithmException encryption exceptions.<NEW_LINE>* @throws InvalidKeySpecException encryption exceptions.<NEW_LINE>*/<NEW_LINE>public boolean checkPassword(char[] password, String encryptedPassword) throws NoSuchAlgorithmException, InvalidKeySpecException {<NEW_LINE>String storedPassword = new String(fromHex(encryptedPassword));<NEW_LINE>String[] parts = storedPassword.split(":");<NEW_LINE>int iterations = Integer.parseInt(parts[0]);<NEW_LINE>byte[] salt = fromHex(parts[1]);<NEW_LINE>byte[] hash = fromHex(parts[2]);<NEW_LINE>PBEKeySpec spec = new PBEKeySpec(password, salt, iterations, keyLength);<NEW_LINE>SecretKeyFactory skf = SecretKeyFactory.getInstance(keyAlgorythm);<NEW_LINE>byte[] testHash = skf.generateSecret(spec).getEncoded();<NEW_LINE>// This is time independent version of array comparison.<NEW_LINE>// This is done to ensure that time based attacks do not happen.<NEW_LINE>// Read more here for time based attacks in this context.<NEW_LINE>// https://security.stackexchange.com/questions/74547/timing-attack-against-hmac-in-authenticated-encryption<NEW_LINE>int diff = hash.length ^ testHash.length;<NEW_LINE>for (int i = 0; i < hash.length && i < testHash.length; i++) {<NEW_LINE>diff |= hash<MASK><NEW_LINE>}<NEW_LINE>return diff == 0;<NEW_LINE>}
[i] ^ testHash[i];
435,304
public void findDatafeedsByJobIds(Collection<String> jobIds, ActionListener<Map<String, DatafeedConfig.Builder>> listener) {<NEW_LINE>SearchRequest searchRequest = client.prepareSearch(MlConfigIndex.indexName()).setIndicesOptions(IndicesOptions.lenientExpandOpen()).setSource(new SearchSourceBuilder().query(buildDatafeedJobIdsQuery(jobIds)).size(jobIds.size())).request();<NEW_LINE>executeAsyncWithOrigin(client.threadPool().getThreadContext(), ML_ORIGIN, searchRequest, ActionListener.<SearchResponse>wrap(response -> {<NEW_LINE>Map<String, DatafeedConfig.Builder> datafeedsByJobId = new HashMap<>();<NEW_LINE>// There cannot be more than one datafeed per job<NEW_LINE>assert response.getHits().getTotalHits().value <= jobIds.size();<NEW_LINE>SearchHit[] hits = response<MASK><NEW_LINE>for (SearchHit hit : hits) {<NEW_LINE>DatafeedConfig.Builder builder = parseLenientlyFromSource(hit.getSourceRef());<NEW_LINE>datafeedsByJobId.put(builder.getJobId(), builder);<NEW_LINE>}<NEW_LINE>listener.onResponse(datafeedsByJobId);<NEW_LINE>}, listener::onFailure), client::search);<NEW_LINE>}
.getHits().getHits();
442,923
protected static boolean parseObjectOrDocumentTypeProperties(String fieldName, Object fieldNode, ParserContext parserContext, ObjectMapper.Builder builder) {<NEW_LINE>if (fieldName.equals("position")) {<NEW_LINE>builder.position(nodeIntegerValue(fieldNode));<NEW_LINE>return true;<NEW_LINE>} else if (fieldName.equals("dynamic")) {<NEW_LINE>String value = fieldNode.toString();<NEW_LINE>if (value.equalsIgnoreCase("strict")) {<NEW_LINE>builder.dynamic(Dynamic.STRICT);<NEW_LINE>} else {<NEW_LINE>boolean dynamic = nodeBooleanValue(fieldNode, fieldName + ".dynamic");<NEW_LINE>builder.dynamic(dynamic ? <MASK><NEW_LINE>}<NEW_LINE>return true;<NEW_LINE>} else if (fieldName.equals("properties")) {<NEW_LINE>if (fieldNode instanceof Collection && ((Collection) fieldNode).isEmpty()) {<NEW_LINE>// nothing to do here, empty (to support "properties: []" case)<NEW_LINE>} else if (!(fieldNode instanceof Map)) {<NEW_LINE>throw new ElasticsearchParseException("properties must be a map type");<NEW_LINE>} else {<NEW_LINE>parseProperties(builder, (Map<String, Object>) fieldNode, parserContext);<NEW_LINE>}<NEW_LINE>return true;<NEW_LINE>}<NEW_LINE>return false;<NEW_LINE>}
Dynamic.TRUE : Dynamic.FALSE);
790,864
public PointSensitivityBuilder presentValueSensitivityRatesStickyModel(ResolvedSwaption swaption, RatesProvider ratesProvider, SabrSwaptionVolatilities swaptionVolatilities) {<NEW_LINE>validate(swaption, ratesProvider, swaptionVolatilities);<NEW_LINE>ZonedDateTime expiryDateTime = swaption.getExpiry();<NEW_LINE>double expiry = swaptionVolatilities.relativeTime(expiryDateTime);<NEW_LINE>ResolvedSwap underlying = swaption.getUnderlying();<NEW_LINE>ResolvedSwapLeg fixedLeg = fixedLeg(underlying);<NEW_LINE>if (expiry < 0d) {<NEW_LINE>// Option has expired already<NEW_LINE>return PointSensitivityBuilder.none();<NEW_LINE>}<NEW_LINE>double forward = forwardRate(swaption, ratesProvider);<NEW_LINE>double pvbp = getSwapPricer().getLegPricer().pvbp(fixedLeg, ratesProvider);<NEW_LINE>double strike = getSwapPricer().getLegPricer().couponEquivalent(fixedLeg, ratesProvider, pvbp);<NEW_LINE>double tenor = swaptionVolatilities.tenor(fixedLeg.getStartDate(), fixedLeg.getEndDate());<NEW_LINE>double shift = swaptionVolatilities.shift(expiry, tenor);<NEW_LINE>ValueDerivatives volatilityAdj = swaptionVolatilities.volatilityAdjoint(expiry, tenor, strike, forward);<NEW_LINE>boolean isCall = fixedLeg.getPayReceive().isPay();<NEW_LINE>// Payer at strike is exercise when rate > strike, i.e. call on rate<NEW_LINE>// Backward sweep<NEW_LINE>PointSensitivityBuilder pvbpDr = getSwapPricer().getLegPricer().pvbpSensitivity(fixedLeg, ratesProvider);<NEW_LINE>PointSensitivityBuilder forwardDr = getSwapPricer().parRateSensitivity(underlying, ratesProvider);<NEW_LINE>double shiftedForward = forward + shift;<NEW_LINE>double shiftedStrike = strike + shift;<NEW_LINE>double price = BlackFormulaRepository.price(shiftedForward, shiftedStrike, expiry, volatilityAdj.getValue(), isCall);<NEW_LINE>double delta = BlackFormulaRepository.delta(shiftedForward, shiftedStrike, expiry, volatilityAdj.getValue(), isCall);<NEW_LINE>double vega = BlackFormulaRepository.vega(shiftedForward, shiftedStrike, expiry, volatilityAdj.getValue());<NEW_LINE>double sign = swaption<MASK><NEW_LINE>return pvbpDr.multipliedBy(price * sign * Math.signum(pvbp)).combinedWith(forwardDr.multipliedBy((delta + vega * volatilityAdj.getDerivative(0)) * Math.abs(pvbp) * sign));<NEW_LINE>}
.getLongShort().sign();
1,054,081
private Bundle handleForegroundLocationPermissions(Map<String, PermissionsResponse> result) {<NEW_LINE>PermissionsResponse accessFineLocation = result.get(Manifest.permission.ACCESS_FINE_LOCATION);<NEW_LINE>PermissionsResponse accessCoarseLocation = result.<MASK><NEW_LINE>Objects.requireNonNull(accessFineLocation);<NEW_LINE>Objects.requireNonNull(accessCoarseLocation);<NEW_LINE>PermissionsStatus status = PermissionsStatus.UNDETERMINED;<NEW_LINE>String accuracy = "none";<NEW_LINE>boolean canAskAgain = accessCoarseLocation.getCanAskAgain() && accessFineLocation.getCanAskAgain();<NEW_LINE>if (accessFineLocation.getStatus() == PermissionsStatus.GRANTED) {<NEW_LINE>accuracy = "fine";<NEW_LINE>status = PermissionsStatus.GRANTED;<NEW_LINE>} else if (accessCoarseLocation.getStatus() == PermissionsStatus.GRANTED) {<NEW_LINE>accuracy = "coarse";<NEW_LINE>status = PermissionsStatus.GRANTED;<NEW_LINE>} else if (accessFineLocation.getStatus() == PermissionsStatus.DENIED && accessCoarseLocation.getStatus() == PermissionsStatus.DENIED) {<NEW_LINE>status = PermissionsStatus.DENIED;<NEW_LINE>}<NEW_LINE>Bundle resultBundle = new Bundle();<NEW_LINE>resultBundle.putString(PermissionsResponse.STATUS_KEY, status.getStatus());<NEW_LINE>resultBundle.putString(PermissionsResponse.EXPIRES_KEY, PermissionsResponse.PERMISSION_EXPIRES_NEVER);<NEW_LINE>resultBundle.putBoolean(PermissionsResponse.CAN_ASK_AGAIN_KEY, canAskAgain);<NEW_LINE>resultBundle.putBoolean(PermissionsResponse.GRANTED_KEY, status == PermissionsStatus.GRANTED);<NEW_LINE>Bundle androidBundle = new Bundle();<NEW_LINE>// deprecated<NEW_LINE>androidBundle.putString("scoped", accuracy);<NEW_LINE>androidBundle.putString("accuracy", accuracy);<NEW_LINE>resultBundle.putBundle("android", androidBundle);<NEW_LINE>return resultBundle;<NEW_LINE>}
get(Manifest.permission.ACCESS_COARSE_LOCATION);
1,506,384
public AuthenticatedClientSessionEntity readObject(ObjectInput input) throws IOException, ClassNotFoundException {<NEW_LINE>AuthenticatedClientSessionEntity sessionEntity = new AuthenticatedClientSessionEntity(MarshallUtil.unmarshallUUID(input, false));<NEW_LINE>sessionEntity.setRealmId(MarshallUtil.unmarshallString(input));<NEW_LINE>sessionEntity.setAuthMethod<MASK><NEW_LINE>sessionEntity.setRedirectUri(MarshallUtil.unmarshallString(input));<NEW_LINE>sessionEntity.setTimestamp(KeycloakMarshallUtil.unmarshallInteger(input));<NEW_LINE>sessionEntity.setAction(MarshallUtil.unmarshallString(input));<NEW_LINE>Map<String, String> notes = KeycloakMarshallUtil.readMap(input, KeycloakMarshallUtil.STRING_EXT, KeycloakMarshallUtil.STRING_EXT, new KeycloakMarshallUtil.ConcurrentHashMapBuilder<>());<NEW_LINE>sessionEntity.setNotes(notes);<NEW_LINE>sessionEntity.setCurrentRefreshToken(MarshallUtil.unmarshallString(input));<NEW_LINE>sessionEntity.setCurrentRefreshTokenUseCount(KeycloakMarshallUtil.unmarshallInteger(input));<NEW_LINE>return sessionEntity;<NEW_LINE>}
(MarshallUtil.unmarshallString(input));
1,209,869
public void marshall(LoadBalancerTlsCertificate loadBalancerTlsCertificate, ProtocolMarshaller protocolMarshaller) {<NEW_LINE>if (loadBalancerTlsCertificate == null) {<NEW_LINE>throw new SdkClientException("Invalid argument passed to marshall(...)");<NEW_LINE>}<NEW_LINE>try {<NEW_LINE>protocolMarshaller.marshall(loadBalancerTlsCertificate.getName(), NAME_BINDING);<NEW_LINE>protocolMarshaller.marshall(loadBalancerTlsCertificate.getArn(), ARN_BINDING);<NEW_LINE>protocolMarshaller.marshall(loadBalancerTlsCertificate.getSupportCode(), SUPPORTCODE_BINDING);<NEW_LINE>protocolMarshaller.marshall(loadBalancerTlsCertificate.getCreatedAt(), CREATEDAT_BINDING);<NEW_LINE>protocolMarshaller.marshall(loadBalancerTlsCertificate.getLocation(), LOCATION_BINDING);<NEW_LINE>protocolMarshaller.marshall(loadBalancerTlsCertificate.getResourceType(), RESOURCETYPE_BINDING);<NEW_LINE>protocolMarshaller.marshall(loadBalancerTlsCertificate.getTags(), TAGS_BINDING);<NEW_LINE>protocolMarshaller.marshall(loadBalancerTlsCertificate.getLoadBalancerName(), LOADBALANCERNAME_BINDING);<NEW_LINE>protocolMarshaller.marshall(<MASK><NEW_LINE>protocolMarshaller.marshall(loadBalancerTlsCertificate.getStatus(), STATUS_BINDING);<NEW_LINE>protocolMarshaller.marshall(loadBalancerTlsCertificate.getDomainName(), DOMAINNAME_BINDING);<NEW_LINE>protocolMarshaller.marshall(loadBalancerTlsCertificate.getDomainValidationRecords(), DOMAINVALIDATIONRECORDS_BINDING);<NEW_LINE>protocolMarshaller.marshall(loadBalancerTlsCertificate.getFailureReason(), FAILUREREASON_BINDING);<NEW_LINE>protocolMarshaller.marshall(loadBalancerTlsCertificate.getIssuedAt(), ISSUEDAT_BINDING);<NEW_LINE>protocolMarshaller.marshall(loadBalancerTlsCertificate.getIssuer(), ISSUER_BINDING);<NEW_LINE>protocolMarshaller.marshall(loadBalancerTlsCertificate.getKeyAlgorithm(), KEYALGORITHM_BINDING);<NEW_LINE>protocolMarshaller.marshall(loadBalancerTlsCertificate.getNotAfter(), NOTAFTER_BINDING);<NEW_LINE>protocolMarshaller.marshall(loadBalancerTlsCertificate.getNotBefore(), NOTBEFORE_BINDING);<NEW_LINE>protocolMarshaller.marshall(loadBalancerTlsCertificate.getRenewalSummary(), RENEWALSUMMARY_BINDING);<NEW_LINE>protocolMarshaller.marshall(loadBalancerTlsCertificate.getRevocationReason(), REVOCATIONREASON_BINDING);<NEW_LINE>protocolMarshaller.marshall(loadBalancerTlsCertificate.getRevokedAt(), REVOKEDAT_BINDING);<NEW_LINE>protocolMarshaller.marshall(loadBalancerTlsCertificate.getSerial(), SERIAL_BINDING);<NEW_LINE>protocolMarshaller.marshall(loadBalancerTlsCertificate.getSignatureAlgorithm(), SIGNATUREALGORITHM_BINDING);<NEW_LINE>protocolMarshaller.marshall(loadBalancerTlsCertificate.getSubject(), SUBJECT_BINDING);<NEW_LINE>protocolMarshaller.marshall(loadBalancerTlsCertificate.getSubjectAlternativeNames(), SUBJECTALTERNATIVENAMES_BINDING);<NEW_LINE>} catch (Exception e) {<NEW_LINE>throw new SdkClientException("Unable to marshall request to JSON: " + e.getMessage(), e);<NEW_LINE>}<NEW_LINE>}
loadBalancerTlsCertificate.getIsAttached(), ISATTACHED_BINDING);
797,988
public RefactoringStatus checkInitialConditions(IProgressMonitor pm) throws CoreException, OperationCanceledException {<NEW_LINE>try {<NEW_LINE>// $NON-NLS-1$<NEW_LINE>pm.beginTask("", 16);<NEW_LINE>RefactoringStatus result = Checks.validateModifiesFiles(ResourceUtil.getFiles(new ICompilationUnit[] { fCu }<MASK><NEW_LINE>if (result.hasFatalError()) {<NEW_LINE>return result;<NEW_LINE>}<NEW_LINE>if (fCompilationUnitNode == null) {<NEW_LINE>fCompilationUnitNode = RefactoringASTParser.parseWithASTProvider(fCu, true, new SubProgressMonitor(pm, 3));<NEW_LINE>}<NEW_LINE>pm.worked(1);<NEW_LINE>if (fCURewrite == null) {<NEW_LINE>fCURewrite = new CompilationUnitRewrite(fCu, fCompilationUnitNode);<NEW_LINE>fCURewrite.setFormattingOptions(fFormatterOptions);<NEW_LINE>fCURewrite.getASTRewrite().setTargetSourceRangeComputer(new NoCommentSourceRangeComputer());<NEW_LINE>}<NEW_LINE>pm.worked(1);<NEW_LINE>// Check the conditions for extracting an expression to a variable.<NEW_LINE>IExpressionFragment selectedExpression = getSelectedExpression();<NEW_LINE>if (selectedExpression == null) {<NEW_LINE>String message = RefactoringCoreMessages.ExtractTempRefactoring_select_expression;<NEW_LINE>return CodeRefactoringUtil.checkMethodSyntaxErrors(fSelectionStart, fSelectionLength, fCompilationUnitNode, message);<NEW_LINE>}<NEW_LINE>pm.worked(1);<NEW_LINE>if (isUsedInExplicitConstructorCall()) {<NEW_LINE>return RefactoringStatus.createFatalErrorStatus(RefactoringCoreMessages.ExtractTempRefactoring_explicit_constructor);<NEW_LINE>}<NEW_LINE>pm.worked(1);<NEW_LINE>ASTNode associatedNode = selectedExpression.getAssociatedNode();<NEW_LINE>if (getEnclosingBodyNode() == null || ASTNodes.getParent(associatedNode, Annotation.class) != null) {<NEW_LINE>return RefactoringStatus.createFatalErrorStatus(RefactoringCoreMessages.ExtractTempRefactoring_expr_in_method_or_initializer);<NEW_LINE>}<NEW_LINE>pm.worked(1);<NEW_LINE>if (associatedNode instanceof Name && associatedNode.getParent() instanceof ClassInstanceCreation && associatedNode.getLocationInParent() == ClassInstanceCreation.TYPE_PROPERTY) {<NEW_LINE>return RefactoringStatus.createFatalErrorStatus(RefactoringCoreMessages.ExtractTempRefactoring_name_in_new);<NEW_LINE>}<NEW_LINE>pm.worked(1);<NEW_LINE>result.merge(checkExpression());<NEW_LINE>if (result.hasFatalError()) {<NEW_LINE>return result;<NEW_LINE>}<NEW_LINE>pm.worked(1);<NEW_LINE>result.merge(checkExpressionFragmentIsRValue());<NEW_LINE>if (result.hasFatalError()) {<NEW_LINE>return result;<NEW_LINE>}<NEW_LINE>pm.worked(1);<NEW_LINE>Expression associatedExpression = selectedExpression.getAssociatedExpression();<NEW_LINE>if (isUsedInForInitializerOrUpdater(associatedExpression)) {<NEW_LINE>return RefactoringStatus.createFatalErrorStatus(RefactoringCoreMessages.ExtractTempRefactoring_for_initializer_updater);<NEW_LINE>}<NEW_LINE>pm.worked(1);<NEW_LINE>if (isReferringToLocalVariableFromFor(associatedExpression)) {<NEW_LINE>return RefactoringStatus.createFatalErrorStatus(RefactoringCoreMessages.ExtractTempRefactoring_refers_to_for_variable);<NEW_LINE>}<NEW_LINE>pm.worked(1);<NEW_LINE>// Check the conditions for extracting an expression to field.<NEW_LINE>ASTNode declaringType = getEnclosingTypeDeclaration();<NEW_LINE>if (declaringType instanceof TypeDeclaration && ((TypeDeclaration) declaringType).isInterface()) {<NEW_LINE>return RefactoringStatus.createFatalErrorStatus(RefactoringCoreMessages.ExtractFieldRefactoring_interface_methods);<NEW_LINE>}<NEW_LINE>pm.worked(1);<NEW_LINE>result.merge(checkTempTypeForLocalTypeUsage());<NEW_LINE>if (result.hasFatalError()) {<NEW_LINE>return result;<NEW_LINE>}<NEW_LINE>pm.worked(1);<NEW_LINE>checkTempInitializerForLocalTypeUsage();<NEW_LINE>initializeDefaults();<NEW_LINE>pm.worked(1);<NEW_LINE>return result;<NEW_LINE>} finally {<NEW_LINE>pm.done();<NEW_LINE>}<NEW_LINE>}
), getValidationContext(), pm);
1,173,849
public static void main(String[] args) {<NEW_LINE>int n = 10;<NEW_LINE>double[][] matrix = new double[n][n];<NEW_LINE>for (double[] row : matrix) java.util.Arrays.fill(row, 100);<NEW_LINE>// Construct an optimal tour<NEW_LINE>int edgeCost = 5;<NEW_LINE>int[] optimalTour = { 2, 7, 6, 1, 9, 8, 5, 3, 4, 0, 2 };<NEW_LINE>for (int i = 1; i < optimalTour.length; i++) matrix[optimalTour[i - 1]][optimalTour[i]] = edgeCost;<NEW_LINE>int[] bestTour = tsp(matrix);<NEW_LINE>System.out.println(java.util.Arrays.toString(bestTour));<NEW_LINE>double <MASK><NEW_LINE>System.out.println("Tour cost: " + tourCost);<NEW_LINE>}
tourCost = computeTourCost(bestTour, matrix);
234,251
public void defineInterceptors() {<NEW_LINE>InputStream inputStream = getClass().getResourceAsStream("/prometheus/interceptors.yaml");<NEW_LINE>Interceptors interceptors = new Yaml().loadAs(inputStream, Interceptors.class);<NEW_LINE>for (Interceptor each : interceptors.getInterceptors()) {<NEW_LINE>if (null == each.getTarget()) {<NEW_LINE>continue;<NEW_LINE>}<NEW_LINE>Builder builder = defineInterceptor(each.getTarget());<NEW_LINE>if (null != each.getConstructAdvice() && !("".equals(each.getConstructAdvice()))) {<NEW_LINE>builder.onConstructor(ElementMatchers.isConstructor()).implement(each.<MASK><NEW_LINE>log.debug("Init construct: {}", each.getConstructAdvice());<NEW_LINE>}<NEW_LINE>if (null == each.getPoints()) {<NEW_LINE>continue;<NEW_LINE>}<NEW_LINE>String[] instancePoints = each.getPoints().stream().filter(i -> "instance".equals(i.getType())).map(TargetPoint::getName).toArray(String[]::new);<NEW_LINE>String[] staticPoints = each.getPoints().stream().filter(i -> "static".equals(i.getType())).map(TargetPoint::getName).toArray(String[]::new);<NEW_LINE>if (instancePoints.length > 0) {<NEW_LINE>builder.aroundInstanceMethod(ElementMatchers.namedOneOf(instancePoints)).implement(each.getInstanceAdvice()).build();<NEW_LINE>log.debug("Init instance: {}", each.getInstanceAdvice());<NEW_LINE>}<NEW_LINE>if (staticPoints.length > 0) {<NEW_LINE>builder.aroundClassStaticMethod(ElementMatchers.namedOneOf(staticPoints)).implement(each.getStaticAdvice()).build();<NEW_LINE>log.debug("Init static: {}", each.getStaticAdvice());<NEW_LINE>}<NEW_LINE>}<NEW_LINE>}
getConstructAdvice()).build();
1,048,486
public static void main(String[] args) throws IOException {<NEW_LINE>if (args.length != 1) {<NEW_LINE>System.out.println("Usage: " + GermanUppercasePhraseFinder.class.getSimpleName() + " <ngramIndexDir>");<NEW_LINE>System.exit(1);<NEW_LINE>}<NEW_LINE>JLanguageTool lt = new JLanguageTool(Languages.getLanguageForShortCode("de"));<NEW_LINE>FSDirectory fsDir = FSDirectory.open(new File(args[<MASK><NEW_LINE>IndexReader reader = DirectoryReader.open(fsDir);<NEW_LINE>IndexSearcher searcher = new IndexSearcher(reader);<NEW_LINE>Fields fields = MultiFields.getFields(reader);<NEW_LINE>Terms terms = fields.terms("ngram");<NEW_LINE>TermsEnum termsEnum = terms.iterator();<NEW_LINE>int count = 0;<NEW_LINE>BytesRef next;<NEW_LINE>while ((next = termsEnum.next()) != null) {<NEW_LINE>String term = next.utf8ToString();<NEW_LINE>count++;<NEW_LINE>// term = "persischer Golf"; // for testing<NEW_LINE>String[] parts = term.split(" ");<NEW_LINE>boolean useful = true;<NEW_LINE>int lcCount = 0;<NEW_LINE>List<String> ucParts = new ArrayList<>();<NEW_LINE>for (String part : parts) {<NEW_LINE>if (part.length() < MIN_TERM_LEN) {<NEW_LINE>useful = false;<NEW_LINE>break;<NEW_LINE>}<NEW_LINE>String uc = StringTools.uppercaseFirstChar(part);<NEW_LINE>if (!part.equals(uc)) {<NEW_LINE>lcCount++;<NEW_LINE>}<NEW_LINE>ucParts.add(uc);<NEW_LINE>}<NEW_LINE>if (!useful || lcCount == 0 || lcCount == 2) {<NEW_LINE>continue;<NEW_LINE>}<NEW_LINE>String uppercase = String.join(" ", ucParts);<NEW_LINE>if (term.equals(uppercase)) {<NEW_LINE>continue;<NEW_LINE>}<NEW_LINE>long thisCount = getOccurrenceCount(reader, searcher, term);<NEW_LINE>long thisUpperCount = getOccurrenceCount(reader, searcher, uppercase);<NEW_LINE>if (count % 10_000 == 0) {<NEW_LINE>System.err.println(count + " @ " + term);<NEW_LINE>}<NEW_LINE>if (thisCount > LIMIT || thisUpperCount > LIMIT) {<NEW_LINE>if (thisUpperCount > thisCount) {<NEW_LINE>if (isRelevant(lt, term)) {<NEW_LINE>float factor = (float) thisUpperCount / thisCount;<NEW_LINE>System.out.printf("%.2f " + thisUpperCount + " " + uppercase + " " + thisCount + " " + term + "\n", factor);<NEW_LINE>}<NEW_LINE>}<NEW_LINE>}<NEW_LINE>}<NEW_LINE>}
0]).toPath());
1,654,767
public Node searchNode(Object key, EntityMetadata m, GraphDatabaseService graphDb, boolean skipProxy) {<NEW_LINE>Node node = null;<NEW_LINE>String idColumnName = ((AbstractAttribute) m.getIdAttribute()).getJPAColumnName();<NEW_LINE>final MetamodelImpl metaModel = (MetamodelImpl) kunderaMetadata.getApplicationMetadata().getMetamodel(m.getPersistenceUnit());<NEW_LINE>if (metaModel.isEmbeddable(m.getIdAttribute().getBindableJavaType())) {<NEW_LINE>key = serializeIdAttributeValue(m, metaModel, key);<NEW_LINE>}<NEW_LINE>if (indexer.isNodeAutoIndexingEnabled(graphDb)) {<NEW_LINE>// Get the Node auto index<NEW_LINE>ReadableIndex<Node> autoNodeIndex = graphDb.index().getNodeAutoIndexer().getAutoIndex();<NEW_LINE>IndexHits<Node> nodesFound = autoNodeIndex.get(idColumnName, key);<NEW_LINE>node = getMatchingNodeFromIndexHits(nodesFound, skipProxy);<NEW_LINE>} else {<NEW_LINE>// Searching within manually created indexes<NEW_LINE>Index<Node> nodeIndex = graphDb.index().forNodes(m.getIndexName());<NEW_LINE>IndexHits<Node> nodesFound = <MASK><NEW_LINE>node = getMatchingNodeFromIndexHits(nodesFound, skipProxy);<NEW_LINE>}<NEW_LINE>return node;<NEW_LINE>}
nodeIndex.get(idColumnName, key);
1,540,181
private void copyAndroidFiles() {<NEW_LINE>if (sourceNativeDir("android").exists()) {<NEW_LINE>File srcDir = new File(targetAndroidDir(), path<MASK><NEW_LINE>File resDir = new File(targetAndroidDir(), path("src", "main", "resources"));<NEW_LINE>{<NEW_LINE>Copy copy = (Copy) antProject().createTask("copy");<NEW_LINE>copy.setTodir(srcDir);<NEW_LINE>copy.setOverwrite(true);<NEW_LINE>FileSet files = new FileSet();<NEW_LINE>files.setProject(antProject());<NEW_LINE>files.setDir(sourceNativeDir("android"));<NEW_LINE>files.setIncludes("**/*.java, *.java");<NEW_LINE>copy.addFileset(files);<NEW_LINE>copy.execute();<NEW_LINE>}<NEW_LINE>{<NEW_LINE>Copy copy = (Copy) antProject().createTask("copy");<NEW_LINE>copy.setTodir(resDir);<NEW_LINE>copy.setOverwrite(true);<NEW_LINE>FileSet files = new FileSet();<NEW_LINE>files.setProject(antProject());<NEW_LINE>files.setDir(sourceNativeDir("android"));<NEW_LINE>files.setExcludes("**/*.java, *.java");<NEW_LINE>copy.addFileset(files);<NEW_LINE>copy.execute();<NEW_LINE>}<NEW_LINE>}<NEW_LINE>}
("src", "main", "java"));
1,327,472
public void trigger(String type, ReadableMap options) {<NEW_LINE>// Check system settings, if disabled and we're not explicitly ignoring then return immediatly<NEW_LINE>boolean ignoreAndroidSystemSettings = options.getBoolean("ignoreAndroidSystemSettings");<NEW_LINE>int hapticEnabledAndroidSystemSettings = Settings.System.getInt(this.reactContext.getContentResolver(), Settings.System.HAPTIC_FEEDBACK_ENABLED, 0);<NEW_LINE>if (ignoreAndroidSystemSettings == false && hapticEnabledAndroidSystemSettings == 0)<NEW_LINE>return;<NEW_LINE>Vibrator v = (Vibrator) <MASK><NEW_LINE>if (v == null)<NEW_LINE>return;<NEW_LINE>long[] durations = { 0, 20 };<NEW_LINE>int hapticConstant = 0;<NEW_LINE>switch(type) {<NEW_LINE>case "impactLight":<NEW_LINE>durations = new long[] { 0, 20 };<NEW_LINE>break;<NEW_LINE>case "impactMedium":<NEW_LINE>durations = new long[] { 0, 40 };<NEW_LINE>break;<NEW_LINE>case "impactHeavy":<NEW_LINE>durations = new long[] { 0, 60 };<NEW_LINE>break;<NEW_LINE>case "notificationSuccess":<NEW_LINE>durations = new long[] { 0, 40, 60, 20 };<NEW_LINE>break;<NEW_LINE>case "notificationWarning":<NEW_LINE>durations = new long[] { 0, 20, 60, 40 };<NEW_LINE>break;<NEW_LINE>case "notificationError":<NEW_LINE>durations = new long[] { 0, 20, 40, 30, 40, 40 };<NEW_LINE>break;<NEW_LINE>case "clockTick":<NEW_LINE>hapticConstant = HapticFeedbackConstants.CLOCK_TICK;<NEW_LINE>break;<NEW_LINE>case "contextClick":<NEW_LINE>hapticConstant = HapticFeedbackConstants.CONTEXT_CLICK;<NEW_LINE>break;<NEW_LINE>case "keyboardPress":<NEW_LINE>hapticConstant = HapticFeedbackConstants.KEYBOARD_PRESS;<NEW_LINE>break;<NEW_LINE>case "keyboardRelease":<NEW_LINE>hapticConstant = HapticFeedbackConstants.KEYBOARD_RELEASE;<NEW_LINE>break;<NEW_LINE>case "keyboardTap":<NEW_LINE>hapticConstant = HapticFeedbackConstants.KEYBOARD_TAP;<NEW_LINE>break;<NEW_LINE>case "longPress":<NEW_LINE>hapticConstant = HapticFeedbackConstants.LONG_PRESS;<NEW_LINE>break;<NEW_LINE>case "textHandleMove":<NEW_LINE>hapticConstant = HapticFeedbackConstants.TEXT_HANDLE_MOVE;<NEW_LINE>break;<NEW_LINE>case "virtualKey":<NEW_LINE>hapticConstant = HapticFeedbackConstants.VIRTUAL_KEY;<NEW_LINE>break;<NEW_LINE>case "virtualKeyRelease":<NEW_LINE>hapticConstant = HapticFeedbackConstants.VIRTUAL_KEY_RELEASE;<NEW_LINE>break;<NEW_LINE>}<NEW_LINE>if (hapticConstant != 0) {<NEW_LINE>v.vibrate(hapticConstant);<NEW_LINE>} else {<NEW_LINE>v.vibrate(durations, -1);<NEW_LINE>}<NEW_LINE>}
reactContext.getSystemService(Context.VIBRATOR_SERVICE);
243,436
private static Value parse(IndexSetting indexSetting, Object value) {<NEW_LINE>final Class<?> type = indexSetting.getType();<NEW_LINE>try {<NEW_LINE>if (type == Boolean.class) {<NEW_LINE>return parseAsBoolean(value);<NEW_LINE>}<NEW_LINE>if (type == double[].class) {<NEW_LINE>return parseAsDoubleArray(value);<NEW_LINE>}<NEW_LINE>if (type == String.class) {<NEW_LINE>return stringValue(value.toString());<NEW_LINE>}<NEW_LINE>if (type == Integer.class) {<NEW_LINE>return parseAsInteger(value);<NEW_LINE>}<NEW_LINE>} catch (IndexSettingParseException e) {<NEW_LINE>throw new IllegalArgumentException("Invalid value type for '" + indexSetting.getSettingName() + "' setting. " + "Expected a value of type " + type.getName() + ", " + "but got value '" + value + "' of type " + (value == null ? "null" : value.getClass().getName()) + ".", e);<NEW_LINE>}<NEW_LINE>throw new UnsupportedOperationException("Should not happen. Missing parser for type " + type.getSimpleName() + <MASK><NEW_LINE>}
". This type is used by indexSetting " + indexSetting.getSettingName());