idx int32 46 1.86M | input stringlengths 321 6.6k | target stringlengths 9 1.24k |
|---|---|---|
1,821,232 | protected void onMeasure(int widthMeasureSpec, int heightMeasureSpec) {<NEW_LINE>int childrenTextTotalHeight = calcTotalTextChildrenHeight(widthMeasureSpec, heightMeasureSpec);<NEW_LINE>final int defHeight = getDefaultSize(getSuggestedMinimumHeight(), heightMeasureSpec);<NEW_LINE>MarginLayoutParams imgParams = (MarginLayoutParams) mImage.getLayoutParams();<NEW_LINE>int potentialHeight = defHeight - getPaddingBottom() - getPaddingTop() - childrenTextTotalHeight <MASK><NEW_LINE>int imgSpaceRaw = Math.min(potentialHeight, mImgMaxHeight);<NEW_LINE>imgParams.height = imgSpaceRaw;<NEW_LINE>imgParams.width = imgSpaceRaw;<NEW_LINE>measureChildWithMargins(mImage, widthMeasureSpec, 0, heightMeasureSpec, 0);<NEW_LINE>boolean isImageSpaceAllowed = imgSpaceRaw > mImgMinHeight;<NEW_LINE>int childrenTotalHeight = childrenTextTotalHeight;<NEW_LINE>if (isImageSpaceAllowed)<NEW_LINE>childrenTotalHeight += calcHeightWithMargins(mImage);<NEW_LINE>UiUtils.showIf(isImageSpaceAllowed, mImage);<NEW_LINE>final int height = childrenTotalHeight + getPaddingTop() + getPaddingBottom();<NEW_LINE>final int width = getDefaultSize(getSuggestedMinimumWidth(), widthMeasureSpec);<NEW_LINE>setMeasuredDimension(width, height);<NEW_LINE>} | - imgParams.bottomMargin - imgParams.topMargin; |
511,067 | private Response initiateMultipartUpload(final FileSystem fs, final String bucket, final String object) {<NEW_LINE>return S3RestUtils.call(bucket, () -> {<NEW_LINE>String bucketPath = S3RestUtils.parsePath(AlluxioURI.SEPARATOR + bucket);<NEW_LINE>S3RestUtils.checkPathIsAlluxioDirectory(fs, bucketPath);<NEW_LINE>String objectPath = bucketPath + AlluxioURI.SEPARATOR + object;<NEW_LINE>AlluxioURI multipartTemporaryDir = new AlluxioURI(S3RestUtils.getMultipartTemporaryDirForObject(bucketPath, object));<NEW_LINE>// remove exist object<NEW_LINE>deleteExistObject(fs, new AlluxioURI(objectPath));<NEW_LINE>// remove exist multipartTemporaryDir<NEW_LINE>deleteExistObject(fs, multipartTemporaryDir, true);<NEW_LINE>CreateDirectoryPOptions options = CreateDirectoryPOptions.newBuilder().setRecursive(true).setWriteType(S3RestUtils.getS3WriteType()).build();<NEW_LINE>try {<NEW_LINE>if (fs.exists(multipartTemporaryDir)) {<NEW_LINE>if (MultipartUploadCleaner.apply(fs, bucket, object)) {<NEW_LINE>throw new S3Exception(multipartTemporaryDir.getPath(), S3ErrorCode.UPLOAD_ALREADY_EXISTS);<NEW_LINE>}<NEW_LINE>}<NEW_LINE>fs.createDirectory(multipartTemporaryDir, options);<NEW_LINE>// Use the file ID of multipartTemporaryDir as the upload ID.<NEW_LINE>long uploadId = fs.getStatus(multipartTemporaryDir).getFileId();<NEW_LINE>MultipartUploadCleaner.apply(fs, bucket, object, uploadId);<NEW_LINE>return new InitiateMultipartUploadResult(bucket, object<MASK><NEW_LINE>} catch (Exception e) {<NEW_LINE>throw S3RestUtils.toObjectS3Exception(e, objectPath);<NEW_LINE>}<NEW_LINE>});<NEW_LINE>} | , Long.toString(uploadId)); |
1,231,866 | final RejectCertificateTransferResult executeRejectCertificateTransfer(RejectCertificateTransferRequest rejectCertificateTransferRequest) {<NEW_LINE>ExecutionContext executionContext = createExecutionContext(rejectCertificateTransferRequest);<NEW_LINE>AWSRequestMetrics awsRequestMetrics = executionContext.getAwsRequestMetrics();<NEW_LINE>awsRequestMetrics.startEvent(Field.ClientExecuteTime);<NEW_LINE>Request<RejectCertificateTransferRequest> request = null;<NEW_LINE>Response<RejectCertificateTransferResult> response = null;<NEW_LINE>try {<NEW_LINE>awsRequestMetrics.startEvent(Field.RequestMarshallTime);<NEW_LINE>try {<NEW_LINE>request = new RejectCertificateTransferRequestProtocolMarshaller(protocolFactory).marshall(super.beforeMarshalling(rejectCertificateTransferRequest));<NEW_LINE>// Binds the request metrics to the current request.<NEW_LINE>request.setAWSRequestMetrics(awsRequestMetrics);<NEW_LINE>request.addHandlerContext(HandlerContextKey.CLIENT_ENDPOINT, endpoint);<NEW_LINE>request.addHandlerContext(HandlerContextKey.ENDPOINT_OVERRIDDEN, isEndpointOverridden());<NEW_LINE>request.addHandlerContext(<MASK><NEW_LINE>request.addHandlerContext(HandlerContextKey.SERVICE_ID, "IoT");<NEW_LINE>request.addHandlerContext(HandlerContextKey.OPERATION_NAME, "RejectCertificateTransfer");<NEW_LINE>request.addHandlerContext(HandlerContextKey.ADVANCED_CONFIG, advancedConfig);<NEW_LINE>} finally {<NEW_LINE>awsRequestMetrics.endEvent(Field.RequestMarshallTime);<NEW_LINE>}<NEW_LINE>HttpResponseHandler<AmazonWebServiceResponse<RejectCertificateTransferResult>> responseHandler = protocolFactory.createResponseHandler(new JsonOperationMetadata().withPayloadJson(true).withHasStreamingSuccessResponse(false), new RejectCertificateTransferResultJsonUnmarshaller());<NEW_LINE>response = invoke(request, responseHandler, executionContext);<NEW_LINE>return response.getAwsResponse();<NEW_LINE>} finally {<NEW_LINE>endClientExecution(awsRequestMetrics, request, response);<NEW_LINE>}<NEW_LINE>} | HandlerContextKey.SIGNING_REGION, getSigningRegion()); |
1,053,721 | public ExternallyReferencedCandidate createInvoiceCandidate(@NonNull final NewManualInvoiceCandidate newIC) {<NEW_LINE>final ExternallyReferencedCandidateBuilder candidate = ExternallyReferencedCandidate.createBuilder(newIC);<NEW_LINE>final ICountryDAO countryDAO = Services.get(ICountryDAO.class);<NEW_LINE>final BPartnerComposite bpartnerComp = bPartnerCompositeRepository.getById(newIC.getBillPartnerInfo().getBpartnerId());<NEW_LINE>final BPartnerLocation location = bpartnerComp.extractLocation(newIC.getBillPartnerInfo().getBpartnerLocationId()).get();<NEW_LINE>final CountryId countryId = countryDAO.getCountryIdByCountryCode(location.getCountryCode());<NEW_LINE>final IPricingBL pricingBL = Services.get(IPricingBL.class);<NEW_LINE>final IEditablePricingContext pricingContext = pricingBL.createInitialContext(newIC.getOrgId(), newIC.getProductId(), newIC.getBillPartnerInfo().getBpartnerId(), newIC.getQtyOrdered().getStockQty(), newIC.getSoTrx()).setCountryId(countryId).setPriceDate(newIC.getDateOrdered()).setFailIfNotCalculated();<NEW_LINE>final IPricingResult pricingResult = pricingBL.calculatePrice(pricingContext);<NEW_LINE>candidate.pricingSystemId(pricingResult.getPricingSystemId());<NEW_LINE>candidate.<MASK><NEW_LINE>final ProductPrice priceEntered = ProductPrice.builder().money(Money.of(pricingResult.getPriceStd(), pricingResult.getCurrencyId())).productId(pricingResult.getProductId()).uomId(pricingResult.getPriceUomId()).build();<NEW_LINE>candidate.priceEntered(priceEntered);<NEW_LINE>candidate.discount(pricingResult.getDiscount());<NEW_LINE>final BigDecimal priceActualBD = pricingResult.getDiscount().subtractFromBase(pricingResult.getPriceStd(), pricingResult.getPrecision().toInt());<NEW_LINE>final ProductPrice priceActual = ProductPrice.builder().money(Money.of(priceActualBD, pricingResult.getCurrencyId())).productId(pricingResult.getProductId()).uomId(pricingResult.getPriceUomId()).build();<NEW_LINE>candidate.priceActual(priceActual);<NEW_LINE>final ZoneId timeZone = orgDAO.getTimeZone(newIC.getOrgId());<NEW_LINE>final TaxId taxId = // shipDate<NEW_LINE>Services.get(ITaxBL.class).// shipDate<NEW_LINE>getTaxNotNull(// shipDate<NEW_LINE>newIC, // shipDate<NEW_LINE>pricingResult.getTaxCategoryId(), // shipDate<NEW_LINE>newIC.getProductId().getRepoId(), // ship location id<NEW_LINE>TimeUtil.asTimestamp(newIC.getDateOrdered(), timeZone), // ship location id<NEW_LINE>newIC.getOrgId(), // ship location id<NEW_LINE>newIC.getSoTrx().isSales() ? orgDAO.getOrgWarehouseId(newIC.getOrgId()) : orgDAO.getOrgPOWarehouseId(newIC.getOrgId()), newIC.getBillPartnerInfo().toBPartnerLocationAndCaptureId(), newIC.getSoTrx());<NEW_LINE>candidate.taxId(taxId);<NEW_LINE>final BPartner bpartner = bpartnerComp.getBpartner();<NEW_LINE>final InvoiceRule partnerInvoiceRule = newIC.getSoTrx().isSales() ? bpartner.getCustomerInvoiceRule() : bpartner.getVendorInvoiceRule();<NEW_LINE>final InvoiceRule invoiceRule = coalesce(partnerInvoiceRule, InvoiceRule.Immediate);<NEW_LINE>candidate.invoiceRule(invoiceRule);<NEW_LINE>return candidate.build();<NEW_LINE>} | priceListVersionId(pricingResult.getPriceListVersionId()); |
856,610 | public Msg makeMsg(InsteonDevice d) {<NEW_LINE>Msg m = null;<NEW_LINE>int cmd1 = getIntParameter("cmd1", 0);<NEW_LINE>int cmd2 = getIntParameter("cmd2", 0);<NEW_LINE>int ext = getIntParameter("ext", -1);<NEW_LINE>try {<NEW_LINE>if (ext == 1 || ext == 2) {<NEW_LINE>int d1 = getIntParameter("d1", 0);<NEW_LINE>int d2 = getIntParameter("d2", 0);<NEW_LINE>int d3 = getIntParameter("d3", 0);<NEW_LINE>m = d.makeExtendedMessage((byte) 0x0f, (byte) cmd1, (byte) cmd2, new byte[] { (byte) d1, (byte) d2, (byte) d3 });<NEW_LINE>if (ext == 1) {<NEW_LINE>m.setCRC();<NEW_LINE>} else if (ext == 2) {<NEW_LINE>m.setCRC2();<NEW_LINE>}<NEW_LINE>} else {<NEW_LINE>m = d.makeStandardMessage((byte) 0x0f, (byte<MASK><NEW_LINE>}<NEW_LINE>m.setQuietTime(500L);<NEW_LINE>} catch (FieldException e) {<NEW_LINE>logger.warn("error setting field in msg: ", e);<NEW_LINE>} catch (IOException e) {<NEW_LINE>logger.error("poll failed with exception ", e);<NEW_LINE>}<NEW_LINE>return m;<NEW_LINE>} | ) cmd1, (byte) cmd2); |
1,579,918 | public void exportDiagram(EntityDiagram diagram, IFigure diagramFigure, DiagramPart diagramPart, File targetFile) throws DBException {<NEW_LINE>checkWriterRegister();<NEW_LINE>try {<NEW_LINE>IFigure figure = diagramPart.getFigure();<NEW_LINE>Rectangle contentBounds = figure instanceof FreeformLayeredPane ? ((FreeformLayeredPane) figure).getFreeformExtent() : figure.getBounds();<NEW_LINE>String svgNS = "http://www.w3.org/2000/svg";<NEW_LINE>// domImpl.createDocument(svgNS, "svg", null);<NEW_LINE>Document document = XMLUtils.createDocument();<NEW_LINE>document.createAttributeNS(svgNS, "svg");<NEW_LINE>SVGGraphics2D svgGenerator = new SVGGraphics2D(document);<NEW_LINE>svgGenerator.setSVGCanvasSize(new Dimension(contentBounds.width, contentBounds.height));<NEW_LINE>// We need a converter from draw2dl.Graphics (.gef3) to awt.Graphics2D (Batik)<NEW_LINE>Graphics graphics = new GraphicsToGraphics2DAdaptor(svgGenerator);<NEW_LINE>// Reset origin to make it the top/left most part of the diagram<NEW_LINE>graphics.translate(contentBounds.x * -1<MASK><NEW_LINE>paintDiagram(graphics, figure);<NEW_LINE>LayerManager layerManager = (LayerManager) diagramPart.getViewer().getEditPartRegistry().get(LayerManager.ID);<NEW_LINE>IFigure connectionLayer = layerManager.getLayer("Connection Layer");<NEW_LINE>if (connectionLayer != null) {<NEW_LINE>paintDiagram(graphics, connectionLayer);<NEW_LINE>}<NEW_LINE>String filePath = targetFile.getAbsolutePath();<NEW_LINE>svgGenerator.stream(filePath);<NEW_LINE>ShellUtils.launchProgram(filePath);<NEW_LINE>} catch (Exception e) {<NEW_LINE>DBWorkbench.getPlatformUI().showError("Save ERD as SVG", null, e);<NEW_LINE>}<NEW_LINE>} | , contentBounds.y * -1); |
589,895 | public void visit(WasmConditional expression) {<NEW_LINE>expression.getCondition().acceptVisitor(this);<NEW_LINE>writer.writeByte(0x04);<NEW_LINE><MASK><NEW_LINE>++depth;<NEW_LINE>blockDepths.put(expression.getThenBlock(), depth);<NEW_LINE>for (WasmExpression part : expression.getThenBlock().getBody()) {<NEW_LINE>part.acceptVisitor(this);<NEW_LINE>}<NEW_LINE>blockDepths.remove(expression.getThenBlock());<NEW_LINE>if (!expression.getElseBlock().getBody().isEmpty()) {<NEW_LINE>writer.writeByte(0x05);<NEW_LINE>blockDepths.put(expression.getElseBlock(), depth);<NEW_LINE>for (WasmExpression part : expression.getElseBlock().getBody()) {<NEW_LINE>part.acceptVisitor(this);<NEW_LINE>}<NEW_LINE>blockDepths.remove(expression.getElseBlock());<NEW_LINE>}<NEW_LINE>--depth;<NEW_LINE>writer.writeByte(0x0B);<NEW_LINE>} | writeBlockType(expression.getType()); |
909,578 | public <K> MapKeyResult<URI, K> mapKeysV2(URI serviceUri, Iterable<K> keys) throws ServiceUnavailableException {<NEW_LINE>// distribute keys to rings for partitions<NEW_LINE>// Note that we assume the keys are partitioning keys<NEW_LINE>MapKeyResult<Ring<URI>, K> keyToPartitionResult = _ringProvider.getRings(serviceUri, keys);<NEW_LINE>Map<Ring<URI>, Collection<K>> ringToKeys = keyToPartitionResult.getMapResult();<NEW_LINE>Map<URI, Collection<K>> result = new HashMap<>();<NEW_LINE>Collection<MapKeyResult.UnmappedKey<K>> unmappedKeys = new ArrayList<>();<NEW_LINE>// first collect unmappedkeys in ditributing keys to partitions<NEW_LINE>unmappedKeys.addAll(keyToPartitionResult.getUnmappedKeys());<NEW_LINE>// for each partition, distribute keys to different server uris<NEW_LINE>for (Map.Entry<Ring<URI>, Collection<K>> entry : ringToKeys.entrySet()) {<NEW_LINE>MapKeyResult<URI, K> keyToHostResult = doMapKeys(entry.getKey(), entry.getValue());<NEW_LINE>// collect map key to host result<NEW_LINE>Map<URI, Collection<K>> hostToKeys = keyToHostResult.getMapResult();<NEW_LINE>for (Map.Entry<URI, Collection<K>> hostEntry : hostToKeys.entrySet()) {<NEW_LINE>URI uri = hostEntry.getKey();<NEW_LINE>Collection<K> collection = result.get(uri);<NEW_LINE>if (collection == null) {<NEW_LINE>collection = new ArrayList<>();<NEW_LINE><MASK><NEW_LINE>}<NEW_LINE>collection.addAll(hostEntry.getValue());<NEW_LINE>}<NEW_LINE>// collect unmapped keys<NEW_LINE>unmappedKeys.addAll(keyToHostResult.getUnmappedKeys());<NEW_LINE>}<NEW_LINE>return new MapKeyResult<>(result, unmappedKeys);<NEW_LINE>} | result.put(uri, collection); |
1,209,227 | public void printState(PrintStream out) {<NEW_LINE>out.println("#doc source pos typeindex type topic");<NEW_LINE>out.print("#alpha : ");<NEW_LINE>for (int topic = 0; topic < numTopics; topic++) {<NEW_LINE>out.print(alpha[topic] + " ");<NEW_LINE>}<NEW_LINE>out.println();<NEW_LINE>out.println("#beta : " + beta);<NEW_LINE>for (int doc = 0; doc < data.size(); doc++) {<NEW_LINE>FeatureSequence tokenSequence = (FeatureSequence) data.get(<MASK><NEW_LINE>LabelSequence topicSequence = (LabelSequence) data.get(doc).topicSequence;<NEW_LINE>@Var<NEW_LINE>String source = "NA";<NEW_LINE>if (data.get(doc).instance.getSource() != null) {<NEW_LINE>source = data.get(doc).instance.getSource().toString();<NEW_LINE>}<NEW_LINE>Formatter output = new Formatter(new StringBuilder(), Locale.US);<NEW_LINE>for (int pi = 0; pi < topicSequence.getLength(); pi++) {<NEW_LINE>int type = tokenSequence.getIndexAtPosition(pi);<NEW_LINE>int topic = topicSequence.getIndexAtPosition(pi);<NEW_LINE>output.format("%d %s %d %d %s %d\n", doc, source, pi, type, alphabet.lookupObject(type), topic);<NEW_LINE>}<NEW_LINE>out.print(output);<NEW_LINE>}<NEW_LINE>} | doc).instance.getData(); |
1,660,806 | private TransferPoint mapTransferPoint(org.onebusaway.gtfs.model.Stop rhsStopOrStation, org.onebusaway.gtfs.model.Route rhsRoute, Trip trip, boolean boardTrip) {<NEW_LINE>Route route = routeMapper.map(rhsRoute);<NEW_LINE>Station station = null;<NEW_LINE>Stop stop = null;<NEW_LINE>// A transfer is specified using Stops and/or Station, according to the GTFS specification:<NEW_LINE>//<NEW_LINE>// If the stop ID refers to a station that contains multiple stops, this transfer rule<NEW_LINE>// applies to all stops in that station.<NEW_LINE>//<NEW_LINE>// Source: https://developers.google.com/transit/gtfs/reference/transfers-file<NEW_LINE>if (rhsStopOrStation.getLocationType() == 0) {<NEW_LINE>stop = stopMapper.map(rhsStopOrStation);<NEW_LINE>} else {<NEW_LINE>station = stationMapper.map(rhsStopOrStation);<NEW_LINE>}<NEW_LINE>if (trip != null) {<NEW_LINE>// A trip may visit the same stop twice, but we ignore that and only add the first stop<NEW_LINE>// we find. Pattern that start and end at the same stop is supported.<NEW_LINE>int stopPositionInPattern = stopPosition(trip, stop, station, boardTrip);<NEW_LINE>return stopPositionInPattern < 0 ? null <MASK><NEW_LINE>} else if (route != null) {<NEW_LINE>if (stop != null) {<NEW_LINE>return new RouteStopTransferPoint(route, stop);<NEW_LINE>} else if (station != null) {<NEW_LINE>return new RouteStationTransferPoint(route, station);<NEW_LINE>}<NEW_LINE>} else if (stop != null) {<NEW_LINE>return new StopTransferPoint(stop);<NEW_LINE>} else if (station != null) {<NEW_LINE>return new StationTransferPoint(station);<NEW_LINE>}<NEW_LINE>throw new IllegalStateException("Should not get here!");<NEW_LINE>} | : new TripTransferPoint(trip, stopPositionInPattern); |
1,622,769 | public final void treeParserSpec(String doc) throws RecognitionException, TokenStreamException {<NEW_LINE>Token a = null;<NEW_LINE>Token idTok;<NEW_LINE>String sup = null;<NEW_LINE>match(LITERAL_class);<NEW_LINE>idTok = id();<NEW_LINE>match(LITERAL_extends);<NEW_LINE>match(LITERAL_TreeParser);<NEW_LINE>{<NEW_LINE>switch(LA(1)) {<NEW_LINE>case LPAREN:<NEW_LINE>{<NEW_LINE>sup = superClass();<NEW_LINE>break;<NEW_LINE>}<NEW_LINE>case SEMI:<NEW_LINE>{<NEW_LINE>break;<NEW_LINE>}<NEW_LINE>default:<NEW_LINE>{<NEW_LINE>throw new NoViableAltException(LT(1), getFilename());<NEW_LINE>}<NEW_LINE>}<NEW_LINE>}<NEW_LINE>if (inputState.guessing == 0) {<NEW_LINE>behavior.startTreeWalker(getFilename(), idTok, sup, doc);<NEW_LINE>}<NEW_LINE>match(SEMI);<NEW_LINE>{<NEW_LINE>switch(LA(1)) {<NEW_LINE>case OPTIONS:<NEW_LINE>{<NEW_LINE>treeParserOptionsSpec();<NEW_LINE>break;<NEW_LINE>}<NEW_LINE>case ACTION:<NEW_LINE>case DOC_COMMENT:<NEW_LINE>case TOKENS:<NEW_LINE>case TOKEN_REF:<NEW_LINE>case LITERAL_protected:<NEW_LINE>case LITERAL_public:<NEW_LINE>case LITERAL_private:<NEW_LINE>case RULE_REF:<NEW_LINE>{<NEW_LINE>break;<NEW_LINE>}<NEW_LINE>default:<NEW_LINE>{<NEW_LINE>throw new NoViableAltException(LT(1), getFilename());<NEW_LINE>}<NEW_LINE>}<NEW_LINE>}<NEW_LINE>if (inputState.guessing == 0) {<NEW_LINE>behavior.endOptions();<NEW_LINE>}<NEW_LINE>{<NEW_LINE>switch(LA(1)) {<NEW_LINE>case TOKENS:<NEW_LINE>{<NEW_LINE>tokensSpec();<NEW_LINE>break;<NEW_LINE>}<NEW_LINE>case ACTION:<NEW_LINE>case DOC_COMMENT:<NEW_LINE>case TOKEN_REF:<NEW_LINE>case LITERAL_protected:<NEW_LINE>case LITERAL_public:<NEW_LINE>case LITERAL_private:<NEW_LINE>case RULE_REF:<NEW_LINE>{<NEW_LINE>break;<NEW_LINE>}<NEW_LINE>default:<NEW_LINE>{<NEW_LINE>throw new NoViableAltException(LT(1), getFilename());<NEW_LINE>}<NEW_LINE>}<NEW_LINE>}<NEW_LINE>{<NEW_LINE>switch(LA(1)) {<NEW_LINE>case ACTION:<NEW_LINE>{<NEW_LINE>a = LT(1);<NEW_LINE>match(ACTION);<NEW_LINE>if (inputState.guessing == 0) {<NEW_LINE>behavior.refMemberAction(a);<NEW_LINE>}<NEW_LINE>break;<NEW_LINE>}<NEW_LINE>case DOC_COMMENT:<NEW_LINE>case TOKEN_REF:<NEW_LINE>case LITERAL_protected:<NEW_LINE>case LITERAL_public:<NEW_LINE>case LITERAL_private:<NEW_LINE>case RULE_REF:<NEW_LINE>{<NEW_LINE>break;<NEW_LINE>}<NEW_LINE>default:<NEW_LINE>{<NEW_LINE>throw new NoViableAltException(LT<MASK><NEW_LINE>}<NEW_LINE>}<NEW_LINE>}<NEW_LINE>} | (1), getFilename()); |
1,419,961 | private void ajaxFetchTrigger(final int projectId, final String flowId, final Session session, final HashMap<String, Object> ret) {<NEW_LINE>final ScheduledFlowTrigger res = this.scheduler.getScheduledFlowTriggerJobs().stream().filter(scheduledFlowTrigger -> scheduledFlowTrigger.getFlowId().equals(flowId) && scheduledFlowTrigger.getProjectId() == projectId).findFirst().orElse(null);<NEW_LINE>if (res != null) {<NEW_LINE>final Map<String, Object> jsonObj = new HashMap<>();<NEW_LINE>final FlowTrigger flowTrigger = res.getFlowTrigger();<NEW_LINE>final CronSchedule schedule = flowTrigger.getSchedule();<NEW_LINE>jsonObj.put("cronExpression", schedule.getCronExpression());<NEW_LINE>jsonObj.put("submitUser", res.getSubmitUser());<NEW_LINE>jsonObj.put("firstSchedTime", TimeUtils.formatDateTime(res.getQuartzTrigger().getStartTime().getTime()));<NEW_LINE>jsonObj.put("nextExecTime", TimeUtils.formatDateTime(res.getQuartzTrigger().getNextFireTime().getTime()));<NEW_LINE>Long maxWaitMin = null;<NEW_LINE>if (flowTrigger.getMaxWaitDuration().isPresent()) {<NEW_LINE>maxWaitMin = flowTrigger.getMaxWaitDuration().get().toMinutes();<NEW_LINE>}<NEW_LINE>jsonObj.put("maxWaitMin", maxWaitMin);<NEW_LINE>if (!flowTrigger.getDependencies().isEmpty()) {<NEW_LINE>jsonObj.put(<MASK><NEW_LINE>}<NEW_LINE>ret.put("flowTrigger", jsonObj);<NEW_LINE>}<NEW_LINE>} | "dependencies", res.getDependencyListJson()); |
1,430,206 | public static void jerseyServletCallInitialized(CtClass ctClass, ClassPool classPool) throws NotFoundException, CannotCompileException {<NEW_LINE>CtMethod init = ctClass.getDeclaredMethod("init", new CtClass[] { classPool.get("org.glassfish.jersey.servlet.WebConfig") });<NEW_LINE>init.insertBefore(PluginManagerInvoker.buildInitializePlugin(Jersey2Plugin.class));<NEW_LINE>LOGGER.info("org.glassfish.jersey.servlet.ServletContainer enhanced with plugin initialization.");<NEW_LINE>String registerThis = PluginManagerInvoker.buildCallPluginMethod(Jersey2Plugin.class, "registerJerseyContainer", <MASK><NEW_LINE>init.insertAfter(registerThis);<NEW_LINE>// Workaround a Jersey issue where ServletContainer cannot be reloaded since it is in an immutable state<NEW_LINE>CtMethod reload = ctClass.getDeclaredMethod("reload", new CtClass[] { classPool.get("org.glassfish.jersey.server.ResourceConfig") });<NEW_LINE>reload.insertBefore("$1 = new org.glassfish.jersey.server.ResourceConfig($1);");<NEW_LINE>} | "this", "java.lang.Object", "getConfiguration()", "java.lang.Object"); |
1,131,832 | public ExecuteStatementResult unmarshall(JsonUnmarshallerContext context) throws Exception {<NEW_LINE>ExecuteStatementResult executeStatementResult = new ExecuteStatementResult();<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("FirstPage", targetDepth)) {<NEW_LINE>context.nextToken();<NEW_LINE>executeStatementResult.setFirstPage(PageJsonUnmarshaller.getInstance<MASK><NEW_LINE>}<NEW_LINE>if (context.testExpression("TimingInformation", targetDepth)) {<NEW_LINE>context.nextToken();<NEW_LINE>executeStatementResult.setTimingInformation(TimingInformationJsonUnmarshaller.getInstance().unmarshall(context));<NEW_LINE>}<NEW_LINE>if (context.testExpression("ConsumedIOs", targetDepth)) {<NEW_LINE>context.nextToken();<NEW_LINE>executeStatementResult.setConsumedIOs(IOUsageJsonUnmarshaller.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 executeStatementResult;<NEW_LINE>} | ().unmarshall(context)); |
1,486,311 | public void handle(PacketWrapper wrapper) throws Exception {<NEW_LINE>Item item = wrapper.passthrough(Type.FLAT_VAR_INT_ITEM);<NEW_LINE>protocol.<MASK><NEW_LINE>if (item == null)<NEW_LINE>return;<NEW_LINE>CompoundTag tag = item.tag();<NEW_LINE>if (tag == null)<NEW_LINE>return;<NEW_LINE>Tag pages = tag.get("pages");<NEW_LINE>// Fix for https://github.com/ViaVersion/ViaVersion/issues/2660<NEW_LINE>if (pages == null) {<NEW_LINE>tag.put("pages", new ListTag(Collections.singletonList(new StringTag())));<NEW_LINE>}<NEW_LINE>// Client limit when editing a book was upped from 50 to 100 in 1.14, but some anti-exploit plugins ban with a size higher than the old client limit<NEW_LINE>if (Via.getConfig().isTruncate1_14Books() && pages instanceof ListTag) {<NEW_LINE>ListTag listTag = (ListTag) pages;<NEW_LINE>if (listTag.size() > 50) {<NEW_LINE>listTag.setValue(listTag.getValue().subList(0, 50));<NEW_LINE>}<NEW_LINE>}<NEW_LINE>} | getItemRewriter().handleItemToServer(item); |
1,265,819 | final WriteRecordsResult executeWriteRecords(WriteRecordsRequest writeRecordsRequest) {<NEW_LINE>ExecutionContext executionContext = createExecutionContext(writeRecordsRequest);<NEW_LINE>AWSRequestMetrics awsRequestMetrics = executionContext.getAwsRequestMetrics();<NEW_LINE>awsRequestMetrics.startEvent(Field.ClientExecuteTime);<NEW_LINE>Request<WriteRecordsRequest> request = null;<NEW_LINE>Response<WriteRecordsResult> response = null;<NEW_LINE>try {<NEW_LINE>awsRequestMetrics.startEvent(Field.RequestMarshallTime);<NEW_LINE>try {<NEW_LINE>request = new WriteRecordsRequestProtocolMarshaller(protocolFactory).marshall(super.beforeMarshalling(writeRecordsRequest));<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, "Timestream Write");<NEW_LINE>request.addHandlerContext(HandlerContextKey.OPERATION_NAME, "WriteRecords");<NEW_LINE>request.addHandlerContext(HandlerContextKey.ADVANCED_CONFIG, advancedConfig);<NEW_LINE>} finally {<NEW_LINE>awsRequestMetrics.endEvent(Field.RequestMarshallTime);<NEW_LINE>}<NEW_LINE>URI cachedEndpoint = null;<NEW_LINE>if (endpointDiscoveryEnabled) {<NEW_LINE>DescribeEndpointsRequest discoveryRequest = new DescribeEndpointsRequest();<NEW_LINE>cachedEndpoint = cache.get(awsCredentialsProvider.getCredentials().getAWSAccessKeyId(), discoveryRequest, true, endpoint);<NEW_LINE>}<NEW_LINE>HttpResponseHandler<AmazonWebServiceResponse<WriteRecordsResult>> responseHandler = protocolFactory.createResponseHandler(new JsonOperationMetadata().withPayloadJson(true).withHasStreamingSuccessResponse(false), new WriteRecordsResultJsonUnmarshaller());<NEW_LINE>response = invoke(request, responseHandler, executionContext, cachedEndpoint, null);<NEW_LINE>return response.getAwsResponse();<NEW_LINE>} finally {<NEW_LINE>endClientExecution(awsRequestMetrics, request, response);<NEW_LINE>}<NEW_LINE>} | addHandlerContext(HandlerContextKey.CLIENT_ENDPOINT, endpoint); |
860,481 | public static void registerHotKeys(final JFrame parent, final CGraphPanel panel, final IFrontEndDebuggerProvider debuggerProvider, final CGraphSearchField searchField, final CGotoAddressField addressField) {<NEW_LINE>Preconditions.checkNotNull(parent, "IE01606: Parent argument can not be null");<NEW_LINE>Preconditions.checkNotNull(panel, "IE01607: Panel argument can not be null");<NEW_LINE>Preconditions.checkNotNull(searchField, "IE01608: Search field argument can not be null");<NEW_LINE>Preconditions.checkNotNull(addressField, "IE01609: Address field argument can not be null");<NEW_LINE>final InputMap inputMap = panel.getInputMap(JComponent.WHEN_IN_FOCUSED_WINDOW);<NEW_LINE>final ActionMap actionMap = panel.getActionMap();<NEW_LINE>inputMap.put(HotKeys.<MASK><NEW_LINE>actionMap.put("GOTO_ADDRESS_FIELD", new AbstractAction() {<NEW_LINE><NEW_LINE>private static final long serialVersionUID = -8994014581850287793L;<NEW_LINE><NEW_LINE>@Override<NEW_LINE>public void actionPerformed(final ActionEvent event) {<NEW_LINE>addressField.requestFocusInWindow();<NEW_LINE>}<NEW_LINE>});<NEW_LINE>inputMap.put(HotKeys.GRAPH_SHOW_HOTKEYS_ACCELERATOR_KEY.getKeyStroke(), "SHOW_HOTKEYS");<NEW_LINE>actionMap.put("SHOW_HOTKEYS", new CShowHotkeysAction(parent));<NEW_LINE>registerSearchKeys(panel.getModel().getGraph().getView(), searchField, inputMap, actionMap);<NEW_LINE>registerDebuggerKeys(panel.getModel().getParent(), panel.getModel().getGraph(), debuggerProvider, inputMap, actionMap);<NEW_LINE>} | GRAPH_GOTO_ADDRESS_FIELD_KEY.getKeyStroke(), "GOTO_ADDRESS_FIELD"); |
158,904 | public void registerPeerConnection(NetworkConnectionBase connection, boolean upload) {<NEW_LINE>if (connection.isClosed()) {<NEW_LINE>Debug.out("Connection is closed");<NEW_LINE>return;<NEW_LINE>}<NEW_LINE><MASK><NEW_LINE>try {<NEW_LINE>connections_mon.enter();<NEW_LINE>LimitedRateGroup[] groups = connection.getRateLimiters(upload);<NEW_LINE>// do group registration<NEW_LINE>GroupData[] group_datas = new GroupData[groups.length];<NEW_LINE>for (int i = 0; i < groups.length; i++) {<NEW_LINE>LimitedRateGroup group = groups[i];<NEW_LINE>// boolean log = group.getName().contains("parg");<NEW_LINE>GroupData group_data = (GroupData) group_buckets.get(group);<NEW_LINE>if (group_data == null) {<NEW_LINE>int limit = NetworkManagerUtilities.getGroupRateLimit(group);<NEW_LINE>group_data = new GroupData(createBucket(limit));<NEW_LINE>group_buckets.put(group, group_data);<NEW_LINE>}<NEW_LINE>group_data.group_size++;<NEW_LINE>group_datas[i] = group_data;<NEW_LINE>}<NEW_LINE>conn_data.groups = groups;<NEW_LINE>conn_data.group_datas = group_datas;<NEW_LINE>conn_data.state = ConnectionData.STATE_NORMAL;<NEW_LINE>connections.put(connection, conn_data);<NEW_LINE>} finally {<NEW_LINE>connections_mon.exit();<NEW_LINE>}<NEW_LINE>main_controller.registerPeerConnection(connection);<NEW_LINE>} | final ConnectionData conn_data = new ConnectionData(); |
1,260,516 | public void actionPerformed(ActionEvent e) {<NEW_LINE>RP.post(new Runnable() {<NEW_LINE><NEW_LINE>@Override<NEW_LINE>public void run() {<NEW_LINE>if (node instanceof TestsuiteNode) {<NEW_LINE>UIJavaUtils.openTestsuite((TestsuiteNode) node, projectType, testingFramework);<NEW_LINE>} else if (node instanceof CallstackFrameNode) {<NEW_LINE>UIJavaUtils.openCallstackFrame(node, callstackFrameInfo, projectType, testingFramework);<NEW_LINE>} else if (node instanceof TestMethodNode) {<NEW_LINE>if (((TestMethodNode) node).getTestcase().getTrouble() != null) {<NEW_LINE>// method failed, find failing line within the testMethod using the stacktrace<NEW_LINE>UIJavaUtils.openCallstackFrame(<MASK><NEW_LINE>} else {<NEW_LINE>UIJavaUtils.openTestMethod((TestMethodNode) node, projectType, testingFramework);<NEW_LINE>}<NEW_LINE>}<NEW_LINE>}<NEW_LINE>});<NEW_LINE>} | node, "", projectType, testingFramework); |
473,921 | public void run(RegressionEnvironment env) {<NEW_LINE>SupportGraphSource.getAndResetLifecycle();<NEW_LINE>env.compileDeploy("@name('flow') create dataflow MyDataFlow MyLineFeedSource -> outstream {} SupportOperator(outstream) {propOne:'abc'}");<NEW_LINE>assertEquals(0, SupportOperator.getAndResetLifecycle().size());<NEW_LINE>// instantiate<NEW_LINE>MyLineFeedSource src = new MyLineFeedSource(Arrays.asList("abc", "def").iterator());<NEW_LINE>EPDataFlowInstantiationOptions options = new EPDataFlowInstantiationOptions().operatorProvider(new DefaultSupportGraphOpProvider(src));<NEW_LINE>EPDataFlowInstance df = env.runtime().getDataFlowService().instantiate(env.deploymentId<MASK><NEW_LINE>List<Object> events = SupportOperator.getAndResetLifecycle();<NEW_LINE>assertEquals(1, events.size());<NEW_LINE>// instantiated<NEW_LINE>assertEquals("instantiated", events.get(0));<NEW_LINE>// run<NEW_LINE>df.run();<NEW_LINE>events = SupportOperator.getAndResetLifecycle();<NEW_LINE>assertEquals(4, events.size());<NEW_LINE>// called open (GraphSource only)<NEW_LINE>assertTrue(events.get(0) instanceof DataFlowOpOpenContext);<NEW_LINE>assertEquals("abc", ((Object[]) events.get(1))[0]);<NEW_LINE>assertEquals("def", ((Object[]) events.get(2))[0]);<NEW_LINE>// called close (GraphSource only)<NEW_LINE>assertTrue(events.get(3) instanceof DataFlowOpCloseContext);<NEW_LINE>env.undeployAll();<NEW_LINE>} | ("flow"), "MyDataFlow", options); |
909,658 | private boolean fillUnknownWithStaticImages(AddressSet unknown) {<NEW_LINE>boolean result = false;<NEW_LINE>// TODO: Expand to block? DON'T OVERWRITE KNOWN!<NEW_LINE>DebuggerStaticMappingService mappingService = tool.getService(DebuggerStaticMappingService.class);<NEW_LINE>byte[] data = new byte[4096];<NEW_LINE>for (Entry<Program, Collection<MappedAddressRange>> ent : mappingService.getOpenMappedViews(trace, unknown, snap).entrySet()) {<NEW_LINE>Program program = ent.getKey();<NEW_LINE>Memory memory = program.getMemory();<NEW_LINE>AddressSetView initialized = memory.getLoadedAndInitializedAddressSet();<NEW_LINE>Collection<MappedAddressRange> mappedSet = ent.getValue();<NEW_LINE>for (MappedAddressRange mappedRng : mappedSet) {<NEW_LINE>AddressRange srng = mappedRng.getSourceAddressRange();<NEW_LINE>long shift = mappedRng.getShift();<NEW_LINE>for (AddressRange subsrng : initialized.intersectRange(srng.getMinAddress(), srng.getMaxAddress())) {<NEW_LINE>Msg.debug(this, "Filling in unknown trace memory in emulator using mapped image: " + program + ": " + subsrng);<NEW_LINE>long lower = subsrng<MASK><NEW_LINE>long fullLen = subsrng.getLength();<NEW_LINE>while (fullLen > 0) {<NEW_LINE>int len = MathUtilities.unsignedMin(data.length, fullLen);<NEW_LINE>try {<NEW_LINE>int read = memory.getBytes(space.getAddress(lower), data, 0, len);<NEW_LINE>if (read < len) {<NEW_LINE>Msg.warn(this, " Partial read of " + subsrng + ". Got " + read + " bytes");<NEW_LINE>}<NEW_LINE>// write(lower - shift, data, 0 ,read);<NEW_LINE>cache.putData(lower - shift, data, 0, read);<NEW_LINE>} catch (MemoryAccessException | AddressOutOfBoundsException e) {<NEW_LINE>throw new AssertionError(e);<NEW_LINE>}<NEW_LINE>lower += len;<NEW_LINE>fullLen -= len;<NEW_LINE>}<NEW_LINE>result = true;<NEW_LINE>}<NEW_LINE>}<NEW_LINE>}<NEW_LINE>return result;<NEW_LINE>} | .getMinAddress().getOffset(); |
1,558,776 | public void onEvent(MappingChangedEvent event) {<NEW_LINE>Set<String> apps = event.getApps();<NEW_LINE>if (CollectionUtils.isEmpty(apps)) {<NEW_LINE>return;<NEW_LINE>}<NEW_LINE>for (String serviceName : apps) {<NEW_LINE>ServiceInstancesChangedListener serviceInstancesChangedListener = serviceListeners.get(serviceName);<NEW_LINE>if (serviceInstancesChangedListener == null) {<NEW_LINE>synchronized (this) {<NEW_LINE>serviceInstancesChangedListener = serviceListeners.get(serviceName);<NEW_LINE>if (serviceInstancesChangedListener == null) {<NEW_LINE>AddressChangeListener addressChangeListener = new DefaultAddressChangeListener(serviceName, instanceRegistryCache);<NEW_LINE>serviceInstancesChangedListener = new AdminServiceInstancesChangedListener(Sets.newHashSet(serviceName), serviceDiscovery, addressChangeListener);<NEW_LINE>serviceInstancesChangedListener.setUrl(CONSUMER_URL);<NEW_LINE>List<ServiceInstance> serviceInstances = serviceDiscovery.getInstances(serviceName);<NEW_LINE>if (CollectionUtils.isNotEmpty(serviceInstances)) {<NEW_LINE>serviceInstancesChangedListener.onEvent(new ServiceInstancesChangedEvent(serviceName, serviceInstances));<NEW_LINE>}<NEW_LINE><MASK><NEW_LINE>serviceInstancesChangedListener.setUrl(CONSUMER_URL);<NEW_LINE>serviceDiscovery.addServiceInstancesChangedListener(serviceInstancesChangedListener);<NEW_LINE>}<NEW_LINE>}<NEW_LINE>}<NEW_LINE>}<NEW_LINE>} | serviceListeners.put(serviceName, serviceInstancesChangedListener); |
1,523,098 | void recordResults(int numMeasurements, HttpResponse res) {<NEW_LINE>if (res.status() == 200) {<NEW_LINE>measurementsSent.increment(numMeasurements);<NEW_LINE>} else if (res.status() < 500) {<NEW_LINE>// For validation:<NEW_LINE>// 202 - partial failure<NEW_LINE>// 400 - all failed, could also be some other sort of failure<NEW_LINE>try {<NEW_LINE>ValidationResponse vres = jsonMapper.readValue(res.entity(), ValidationResponse.class);<NEW_LINE>measurementsDroppedInvalid.increment(vres.getErrorCount());<NEW_LINE>measurementsSent.increment(<MASK><NEW_LINE>logger.warn("{} measurement(s) dropped due to validation errors: {}", vres.getErrorCount(), vres.errorSummary());<NEW_LINE>} catch (Exception e) {<NEW_LINE>// Likely some other 400 error. Log at trace level in case the cause is really needed.<NEW_LINE>logger.trace("failed to parse response", e);<NEW_LINE>logger.warn("{} measurement(s) dropped. Http status: {}", numMeasurements, res.status());<NEW_LINE>measurementsDroppedOther.increment(numMeasurements);<NEW_LINE>}<NEW_LINE>} else {<NEW_LINE>// Some sort of server side failure<NEW_LINE>measurementsDroppedHttp.increment(numMeasurements);<NEW_LINE>}<NEW_LINE>} | numMeasurements - vres.getErrorCount()); |
753,804 | private JavaScriptNode desugarForInOrOfBody(ForNode forNode, JavaScriptNode iterator, JumpTargetCloseable<ContinueTarget> jumpTarget) {<NEW_LINE>assert forNode.isForInOrOf();<NEW_LINE>VarRef iteratorVar = environment.createTempVar();<NEW_LINE>JavaScriptNode iteratorInit = iteratorVar.createWriteNode(iterator);<NEW_LINE>VarRef nextResultVar = environment.createTempVar();<NEW_LINE>JavaScriptNode iteratorNext = factory.createIteratorNext(iteratorVar.createReadNode());<NEW_LINE>// nextResult = IteratorNext(iterator)<NEW_LINE>// while(!(done = IteratorComplete(nextResult)))<NEW_LINE>JavaScriptNode condition = factory.createDual(context, factory.createIteratorSetDone(iteratorVar.createReadNode(), factory.createConstantBoolean(true)), factory.createUnary(UnaryOperation.NOT, factory.createIteratorComplete(context, nextResultVar.createWriteNode(iteratorNext))));<NEW_LINE>JavaScriptNode wrappedBody;<NEW_LINE>try (EnvironmentCloseable blockEnv = new EnvironmentCloseable(needsPerIterationScope(forNode) ? newPerIterationEnvironment(lc.getCurrentBlock().getScope()) : environment)) {<NEW_LINE>// var nextValue = IteratorValue(nextResult);<NEW_LINE>VarRef nextResultVar2 = environment.findTempVar(nextResultVar.getFrameSlot());<NEW_LINE>VarRef nextValueVar = environment.createTempVar();<NEW_LINE>VarRef iteratorVar2 = environment.findTempVar(iteratorVar.getFrameSlot());<NEW_LINE>JavaScriptNode nextResult = nextResultVar2.createReadNode();<NEW_LINE>JavaScriptNode nextValue = factory.createIteratorValue(context, nextResult);<NEW_LINE>JavaScriptNode writeNextValue = nextValueVar.createWriteNode(nextValue);<NEW_LINE>JavaScriptNode writeNext = tagStatement(desugarForHeadAssignment(forNode, nextValueVar.createReadNode()), forNode);<NEW_LINE>JavaScriptNode body = transform(forNode.getBody());<NEW_LINE>wrappedBody = blockEnv.wrapBlockScope(createBlock(writeNextValue, factory.createIteratorSetDone(iteratorVar2.createReadNode(), factory.createConstantBoolean(false)), writeNext, body));<NEW_LINE>}<NEW_LINE>wrappedBody = jumpTarget.wrapContinueTargetNode(wrappedBody);<NEW_LINE>RepeatingNode repeatingNode = factory.createWhileDoRepeatingNode(condition, wrappedBody);<NEW_LINE>LoopNode loopNode = factory.createLoopNode(repeatingNode);<NEW_LINE>JavaScriptNode whileNode = forNode.isForOf() ? factory.createDesugaredForOf(loopNode) : factory.createDesugaredForIn(loopNode);<NEW_LINE>JavaScriptNode wrappedWhile = factory.createIteratorCloseIfNotDone(context, jumpTarget.wrapBreakTargetNode(whileNode), iteratorVar.createReadNode());<NEW_LINE>JavaScriptNode resetIterator = iteratorVar.createWriteNode(factory.createConstant(JSFrameUtil.DEFAULT_VALUE));<NEW_LINE>wrappedWhile = <MASK><NEW_LINE>ensureHasSourceSection(whileNode, forNode);<NEW_LINE>return createBlock(iteratorInit, wrappedWhile);<NEW_LINE>} | factory.createTryFinally(wrappedWhile, resetIterator); |
170,639 | public void delete(ClientModel client) {<NEW_LINE>String id = client.getId();<NEW_LINE>ResourceServerEntity entity = entityManager.find(ResourceServerEntity.class, id);<NEW_LINE>if (entity == null)<NEW_LINE>return;<NEW_LINE>// This didn't work, had to loop through and remove each policy individually<NEW_LINE>// entityManager.createNamedQuery("deletePolicyByResourceServer")<NEW_LINE>// .setParameter("serverId", id).executeUpdate();<NEW_LINE>{<NEW_LINE>TypedQuery<String> query = entityManager.createNamedQuery("findPolicyIdByServerId", String.class);<NEW_LINE>query.setParameter("serverId", id);<NEW_LINE>List<String> result = query.getResultList();<NEW_LINE>for (String policyId : result) {<NEW_LINE>entityManager.remove(entityManager.getReference(PolicyEntity.class, policyId));<NEW_LINE>}<NEW_LINE>}<NEW_LINE>{<NEW_LINE>TypedQuery<String> query = entityManager.createNamedQuery("findPermissionTicketIdByServerId", String.class);<NEW_LINE><MASK><NEW_LINE>List<String> result = query.getResultList();<NEW_LINE>for (String permissionId : result) {<NEW_LINE>entityManager.remove(entityManager.getReference(PermissionTicketEntity.class, permissionId));<NEW_LINE>}<NEW_LINE>}<NEW_LINE>// entityManager.createNamedQuery("deleteResourceByResourceServer")<NEW_LINE>// .setParameter("serverId", id).executeUpdate();<NEW_LINE>{<NEW_LINE>TypedQuery<String> query = entityManager.createNamedQuery("findResourceIdByServerId", String.class);<NEW_LINE>query.setParameter("serverId", id);<NEW_LINE>List<String> result = query.getResultList();<NEW_LINE>for (String resourceId : result) {<NEW_LINE>entityManager.remove(entityManager.getReference(ResourceEntity.class, resourceId));<NEW_LINE>}<NEW_LINE>}<NEW_LINE>// entityManager.createNamedQuery("deleteScopeByResourceServer")<NEW_LINE>// .setParameter("serverId", id).executeUpdate();<NEW_LINE>{<NEW_LINE>TypedQuery<String> query = entityManager.createNamedQuery("findScopeIdByResourceServer", String.class);<NEW_LINE>query.setParameter("serverId", id);<NEW_LINE>List<String> result = query.getResultList();<NEW_LINE>for (String scopeId : result) {<NEW_LINE>entityManager.remove(entityManager.getReference(ScopeEntity.class, scopeId));<NEW_LINE>}<NEW_LINE>}<NEW_LINE>this.entityManager.remove(entity);<NEW_LINE>entityManager.flush();<NEW_LINE>entityManager.detach(entity);<NEW_LINE>} | query.setParameter("serverId", id); |
1,167,391 | public CodegenExpression makeNoCopy(CodegenMethodScope scope, CodegenClassScope classScope) {<NEW_LINE>CodegenMethod method = scope.makeChild(EventBeanUpdateHelperNoCopy.EPTYPE, this.getClass(), classScope);<NEW_LINE>CodegenMethod updateInternal = makeUpdateInternal(method, classScope);<NEW_LINE>CodegenExpressionNewAnonymousClass clazz = newAnonymousClass(method.getBlock(), EventBeanUpdateHelperNoCopy.EPTYPE);<NEW_LINE>CodegenMethod updateNoCopy = CodegenMethod.makeParentNode(EPTypePremade.VOID.getEPType(), this.getClass(), classScope).addParam(EventBean.EPTYPE, "matchingEvent").addParam(EventBean.EPTYPEARRAY, NAME_EPS).<MASK><NEW_LINE>clazz.addMethod("updateNoCopy", updateNoCopy);<NEW_LINE>updateNoCopy.getBlock().apply(instblock(classScope, "qInfraUpdate", ref("matchingEvent"), REF_EPS, constant(updateItems.length), constantFalse())).localMethod(updateInternal, REF_EPS, REF_EXPREVALCONTEXT, ref("matchingEvent")).apply(instblock(classScope, "aInfraUpdate", ref("matchingEvent")));<NEW_LINE>CodegenMethod getUpdatedProperties = CodegenMethod.makeParentNode(EPTypePremade.STRINGARRAY.getEPType(), this.getClass(), classScope);<NEW_LINE>clazz.addMethod("getUpdatedProperties", getUpdatedProperties);<NEW_LINE>getUpdatedProperties.getBlock().methodReturn(constant(getUpdateItemsPropertyNames()));<NEW_LINE>CodegenMethod isRequiresStream2InitialValueEvent = CodegenMethod.makeParentNode(EPTypePremade.BOOLEANPRIMITIVE.getEPType(), this.getClass(), classScope);<NEW_LINE>clazz.addMethod("isRequiresStream2InitialValueEvent", isRequiresStream2InitialValueEvent);<NEW_LINE>isRequiresStream2InitialValueEvent.getBlock().methodReturn(constant(isRequiresStream2InitialValueEvent()));<NEW_LINE>method.getBlock().methodReturn(clazz);<NEW_LINE>return localMethod(method);<NEW_LINE>} | addParam(ExprEvaluatorContext.EPTYPE, NAME_EXPREVALCONTEXT); |
204,266 | public EueWriteFeature.Chunk call() throws BackgroundException {<NEW_LINE>overall.validate();<NEW_LINE>final Map<String, String> parameters = new HashMap<>();<NEW_LINE>parameters.<MASK><NEW_LINE>final TransferStatus status = new TransferStatus().segment(true).withOffset(offset).withLength(length).withParameters(parameters);<NEW_LINE>status.setPart(partNumber);<NEW_LINE>status.setHeader(overall.getHeader());<NEW_LINE>status.setChecksum(writer.checksum(file, status).compute(local.getInputStream(), status));<NEW_LINE>status.setUrl(url);<NEW_LINE>final EueWriteFeature.Chunk chunk = EueLargeUploadService.this.upload(file, local, throttle, listener, status, overall, status, callback);<NEW_LINE>if (log.isInfoEnabled()) {<NEW_LINE>log.info(String.format("Received response %s for part %d", chunk, partNumber));<NEW_LINE>}<NEW_LINE>return chunk;<NEW_LINE>} | put(EueWriteFeature.RESOURCE_ID, resourceId); |
1,712,510 | public static boolean registryValueExists(HKEY root, String key, String value, int samDesiredExtra) {<NEW_LINE>HKEYByReference phkKey = new HKEYByReference();<NEW_LINE>int rc = Advapi32.INSTANCE.RegOpenKeyEx(root, key, 0, <MASK><NEW_LINE>switch(rc) {<NEW_LINE>case W32Errors.ERROR_SUCCESS:<NEW_LINE>break;<NEW_LINE>case W32Errors.ERROR_FILE_NOT_FOUND:<NEW_LINE>return false;<NEW_LINE>default:<NEW_LINE>throw new Win32Exception(rc);<NEW_LINE>}<NEW_LINE>try {<NEW_LINE>IntByReference lpcbData = new IntByReference();<NEW_LINE>IntByReference lpType = new IntByReference();<NEW_LINE>rc = Advapi32.INSTANCE.RegQueryValueEx(phkKey.getValue(), value, 0, lpType, (Pointer) null, lpcbData);<NEW_LINE>switch(rc) {<NEW_LINE>case W32Errors.ERROR_SUCCESS:<NEW_LINE>case W32Errors.ERROR_MORE_DATA:<NEW_LINE>case W32Errors.ERROR_INSUFFICIENT_BUFFER:<NEW_LINE>return true;<NEW_LINE>case W32Errors.ERROR_FILE_NOT_FOUND:<NEW_LINE>return false;<NEW_LINE>default:<NEW_LINE>throw new Win32Exception(rc);<NEW_LINE>}<NEW_LINE>} finally {<NEW_LINE>if (!WinBase.INVALID_HANDLE_VALUE.equals(phkKey.getValue())) {<NEW_LINE>rc = Advapi32.INSTANCE.RegCloseKey(phkKey.getValue());<NEW_LINE>if (rc != W32Errors.ERROR_SUCCESS) {<NEW_LINE>throw new Win32Exception(rc);<NEW_LINE>}<NEW_LINE>}<NEW_LINE>}<NEW_LINE>} | WinNT.KEY_READ | samDesiredExtra, phkKey); |
1,608,876 | public static ListFlowJobResponse unmarshall(ListFlowJobResponse listFlowJobResponse, UnmarshallerContext _ctx) {<NEW_LINE>listFlowJobResponse.setRequestId(_ctx.stringValue("ListFlowJobResponse.RequestId"));<NEW_LINE>listFlowJobResponse.setPageNumber(_ctx.integerValue("ListFlowJobResponse.PageNumber"));<NEW_LINE>listFlowJobResponse.setPageSize(_ctx.integerValue("ListFlowJobResponse.PageSize"));<NEW_LINE>listFlowJobResponse.setTotal<MASK><NEW_LINE>List<Job> jobList = new ArrayList<Job>();<NEW_LINE>for (int i = 0; i < _ctx.lengthValue("ListFlowJobResponse.JobList.Length"); i++) {<NEW_LINE>Job job = new Job();<NEW_LINE>job.setId(_ctx.stringValue("ListFlowJobResponse.JobList[" + i + "].Id"));<NEW_LINE>job.setGmtCreate(_ctx.longValue("ListFlowJobResponse.JobList[" + i + "].GmtCreate"));<NEW_LINE>job.setGmtModified(_ctx.longValue("ListFlowJobResponse.JobList[" + i + "].GmtModified"));<NEW_LINE>job.setName(_ctx.stringValue("ListFlowJobResponse.JobList[" + i + "].Name"));<NEW_LINE>job.setType(_ctx.stringValue("ListFlowJobResponse.JobList[" + i + "].Type"));<NEW_LINE>job.setDescription(_ctx.stringValue("ListFlowJobResponse.JobList[" + i + "].Description"));<NEW_LINE>job.setFailAct(_ctx.stringValue("ListFlowJobResponse.JobList[" + i + "].FailAct"));<NEW_LINE>job.setMaxRetry(_ctx.integerValue("ListFlowJobResponse.JobList[" + i + "].MaxRetry"));<NEW_LINE>job.setRetryInterval(_ctx.longValue("ListFlowJobResponse.JobList[" + i + "].RetryInterval"));<NEW_LINE>job.setParams(_ctx.stringValue("ListFlowJobResponse.JobList[" + i + "].Params"));<NEW_LINE>job.setParamConf(_ctx.stringValue("ListFlowJobResponse.JobList[" + i + "].ParamConf"));<NEW_LINE>job.setCustomVariables(_ctx.stringValue("ListFlowJobResponse.JobList[" + i + "].CustomVariables"));<NEW_LINE>job.setEnvConf(_ctx.stringValue("ListFlowJobResponse.JobList[" + i + "].EnvConf"));<NEW_LINE>job.setRunConf(_ctx.stringValue("ListFlowJobResponse.JobList[" + i + "].RunConf"));<NEW_LINE>job.setMonitorConf(_ctx.stringValue("ListFlowJobResponse.JobList[" + i + "].MonitorConf"));<NEW_LINE>job.setCategoryId(_ctx.stringValue("ListFlowJobResponse.JobList[" + i + "].CategoryId"));<NEW_LINE>job.setMode(_ctx.stringValue("ListFlowJobResponse.JobList[" + i + "].mode"));<NEW_LINE>job.setAdhoc(_ctx.stringValue("ListFlowJobResponse.JobList[" + i + "].Adhoc"));<NEW_LINE>job.setAlertConf(_ctx.stringValue("ListFlowJobResponse.JobList[" + i + "].AlertConf"));<NEW_LINE>job.setLastInstanceDetail(_ctx.stringValue("ListFlowJobResponse.JobList[" + i + "].LastInstanceDetail"));<NEW_LINE>List<Resource> resourceList = new ArrayList<Resource>();<NEW_LINE>for (int j = 0; j < _ctx.lengthValue("ListFlowJobResponse.JobList[" + i + "].ResourceList.Length"); j++) {<NEW_LINE>Resource resource = new Resource();<NEW_LINE>resource.setPath(_ctx.stringValue("ListFlowJobResponse.JobList[" + i + "].ResourceList[" + j + "].Path"));<NEW_LINE>resource.setAlias(_ctx.stringValue("ListFlowJobResponse.JobList[" + i + "].ResourceList[" + j + "].Alias"));<NEW_LINE>resourceList.add(resource);<NEW_LINE>}<NEW_LINE>job.setResourceList(resourceList);<NEW_LINE>jobList.add(job);<NEW_LINE>}<NEW_LINE>listFlowJobResponse.setJobList(jobList);<NEW_LINE>return listFlowJobResponse;<NEW_LINE>} | (_ctx.integerValue("ListFlowJobResponse.Total")); |
23,640 | public List<ServiceBindingRequirementBuildItem> createServiceBindingDecorators(ApplicationInfoBuildItem applicationInfo, KubernetesServiceBindingConfig config, List<ServiceBindingQualifierBuildItem> qualifiers) {<NEW_LINE>Map<String, ServiceBindingRequirementBuildItem> requirements = new HashMap<>();<NEW_LINE>String applicationName = applicationInfo.getName();<NEW_LINE>// First we add all user provided services<NEW_LINE>config.services.forEach((key, s) -> {<NEW_LINE>createRequirementFromConfig(applicationName, key, config).ifPresent(r -> requirements.put(key, r));<NEW_LINE>});<NEW_LINE>// Then we try to make requirements out of qualifies for services not already provided by the user<NEW_LINE>qualifiers.forEach(q -> {<NEW_LINE>Optional<ServiceBindingRequirementBuildItem> requirement = <MASK><NEW_LINE>requirement.ifPresent(r -> {<NEW_LINE>String id = q.getId();<NEW_LINE>requirements.putIfAbsent(id, r);<NEW_LINE>});<NEW_LINE>});<NEW_LINE>return requirements.values().stream().collect(Collectors.toList());<NEW_LINE>} | createRequirementFromQualifier(applicationName, config, q); |
346,327 | public void write(final ChannelHandlerContext context, final Object message, final ChannelPromise writePromise) {<NEW_LINE>if (message instanceof AcceptNotificationResponse) {<NEW_LINE>final AcceptNotificationResponse acceptNotificationResponse = (AcceptNotificationResponse) message;<NEW_LINE>final Http2Headers headers = new DefaultHttp2Headers().status(HttpResponseStatus.OK.codeAsText()).add(APNS_ID_HEADER, FastUUID.toString(acceptNotificationResponse.getApnsId()));<NEW_LINE>this.encoder().writeHeaders(context, acceptNotificationResponse.getStreamId(), headers, 0, true, writePromise);<NEW_LINE>log.trace("Accepted push notification on stream {}", acceptNotificationResponse.getStreamId());<NEW_LINE>} else if (message instanceof RejectNotificationResponse) {<NEW_LINE>final RejectNotificationResponse rejectNotificationResponse = (RejectNotificationResponse) message;<NEW_LINE>final Http2Headers headers = new DefaultHttp2Headers().status(rejectNotificationResponse.getErrorReason().getHttpResponseStatus().codeAsText()).add(HttpHeaderNames.CONTENT_TYPE, "application/json").add(APNS_ID_HEADER, FastUUID.toString(rejectNotificationResponse.getApnsId()));<NEW_LINE>final byte[] payloadBytes;<NEW_LINE>{<NEW_LINE>final Map<String, Object> errorPayload = new HashMap<>(2, 1);<NEW_LINE>errorPayload.put("reason", rejectNotificationResponse.getErrorReason().getReasonText());<NEW_LINE>if (rejectNotificationResponse.getTimestamp() != null) {<NEW_LINE>errorPayload.put("timestamp", rejectNotificationResponse.timestamp.toEpochMilli());<NEW_LINE>}<NEW_LINE>payloadBytes = JsonSerializer.writeJsonTextAsString(errorPayload).getBytes();<NEW_LINE>}<NEW_LINE>final ChannelPromise headersPromise = context.newPromise();<NEW_LINE>this.encoder().writeHeaders(context, rejectNotificationResponse.getStreamId(), headers, 0, false, headersPromise);<NEW_LINE>final ChannelPromise dataPromise = context.newPromise();<NEW_LINE>this.encoder().writeData(context, rejectNotificationResponse.getStreamId(), Unpooled.wrappedBuffer(payloadBytes), 0, true, dataPromise);<NEW_LINE>final PromiseCombiner promiseCombiner = new PromiseCombiner(context.executor());<NEW_LINE>promiseCombiner.addAll((ChannelFuture) headersPromise, dataPromise);<NEW_LINE>promiseCombiner.finish(writePromise);<NEW_LINE>log.trace("Rejected push notification on stream {}: {}", rejectNotificationResponse.getStreamId(<MASK><NEW_LINE>} else {<NEW_LINE>context.write(message, writePromise);<NEW_LINE>}<NEW_LINE>} | ), rejectNotificationResponse.getErrorReason()); |
932,652 | public void run() {<NEW_LINE>if (null == socket)<NEW_LINE>return;<NEW_LINE>DataInputStream input = null;<NEW_LINE>DataOutputStream output = null;<NEW_LINE>if (DEBUG) {<NEW_LINE>System.out.println("Client connected from " + socket.getRemoteSocketAddress());<NEW_LINE>}<NEW_LINE>try {<NEW_LINE>input = new DataInputStream(socket.getInputStream());<NEW_LINE>output = new DataOutputStream(socket.getOutputStream());<NEW_LINE>// read the message length<NEW_LINE>int msgLen = input.readInt();<NEW_LINE>// create a buffer<NEW_LINE>byte[] data = new byte[msgLen];<NEW_LINE>// read the entire message (blocks until complete)<NEW_LINE>input.readFully(data);<NEW_LINE>if (data.length < 1) {<NEW_LINE>throw new Exception("Client did not send data.");<NEW_LINE>}<NEW_LINE>// now convert the raw bytes to utf-8<NEW_LINE>String tmp = new String(data, "UTF-8");<NEW_LINE><MASK><NEW_LINE>// get the realisation<NEW_LINE>String result = doRealisation(reader).trim();<NEW_LINE>// convert the string to raw bytes<NEW_LINE>byte[] tmp2 = result.getBytes("UTF-8");<NEW_LINE>// write the length<NEW_LINE>output.writeInt(tmp2.length);<NEW_LINE>// write the data<NEW_LINE>output.write(tmp2);<NEW_LINE>if (DEBUG) {<NEW_LINE>String text = "The following realisation was sent to client:";<NEW_LINE>System.out.println(text + "\n\t" + result);<NEW_LINE>}<NEW_LINE>} catch (Exception e) {<NEW_LINE>e.printStackTrace();<NEW_LINE>try {<NEW_LINE>// attempt to send the error message to the client<NEW_LINE>byte[] tmp = ("Exception: " + e.getMessage()).getBytes("UTF-8");<NEW_LINE>output.writeInt(tmp.length);<NEW_LINE>output.write(tmp);<NEW_LINE>} catch (IOException e1) {<NEW_LINE>}<NEW_LINE>} catch (XMLRealiserException e) {<NEW_LINE>e.printStackTrace();<NEW_LINE>try {<NEW_LINE>// attempt to send the error message to the client<NEW_LINE>byte[] tmp = ("Exception: " + e.getMessage()).getBytes("UTF-8");<NEW_LINE>output.writeInt(tmp.length);<NEW_LINE>output.write(tmp);<NEW_LINE>} catch (IOException e1) {<NEW_LINE>}<NEW_LINE>} finally {<NEW_LINE>try {<NEW_LINE>socket.close();<NEW_LINE>socket = null;<NEW_LINE>} catch (IOException e) {<NEW_LINE>System.err.println("Could not close client socket!");<NEW_LINE>}<NEW_LINE>}<NEW_LINE>} | StringReader reader = new StringReader(tmp); |
984,319 | protected CommonAppListFilterViewModel.ListModelLoader onCreateListModelLoader() {<NEW_LINE>AppListItemDescriptionComposer composer = new AppListItemDescriptionComposer(thisActivity());<NEW_LINE>return index -> {<NEW_LINE>if (packageSet == null || packageSet.getPackageCount() == 0) {<NEW_LINE>return Lists.newArrayList();<NEW_LINE>}<NEW_LINE>ThanosManager thanos = ThanosManager.from(getApplicationContext());<NEW_LINE>if (!thanos.isServiceInstalled()) {<NEW_LINE>return Lists.newArrayList();<NEW_LINE>}<NEW_LINE>List<AppListModel> res = new ArrayList<>();<NEW_LINE>PackageManager pm = thanos.getPkgManager();<NEW_LINE>for (String pkg : packageSet.getPkgNames()) {<NEW_LINE>AppInfo <MASK><NEW_LINE>if (appInfo == null) {<NEW_LINE>continue;<NEW_LINE>}<NEW_LINE>res.add(new AppListModel(appInfo, null, null, composer.getAppItemDescription(appInfo)));<NEW_LINE>}<NEW_LINE>Collections.sort(res);<NEW_LINE>return res;<NEW_LINE>};<NEW_LINE>} | appInfo = pm.getAppInfo(pkg); |
1,605,764 | public void marshall(ConnectorSummary connectorSummary, ProtocolMarshaller protocolMarshaller) {<NEW_LINE>if (connectorSummary == null) {<NEW_LINE>throw new SdkClientException("Invalid argument passed to marshall(...)");<NEW_LINE>}<NEW_LINE>try {<NEW_LINE>protocolMarshaller.marshall(connectorSummary.getCapacity(), CAPACITY_BINDING);<NEW_LINE>protocolMarshaller.marshall(connectorSummary.getConnectorArn(), CONNECTORARN_BINDING);<NEW_LINE>protocolMarshaller.marshall(connectorSummary.getConnectorDescription(), CONNECTORDESCRIPTION_BINDING);<NEW_LINE>protocolMarshaller.marshall(connectorSummary.getConnectorName(), CONNECTORNAME_BINDING);<NEW_LINE>protocolMarshaller.marshall(connectorSummary.getConnectorState(), CONNECTORSTATE_BINDING);<NEW_LINE>protocolMarshaller.marshall(connectorSummary.getCreationTime(), CREATIONTIME_BINDING);<NEW_LINE>protocolMarshaller.marshall(connectorSummary.getCurrentVersion(), CURRENTVERSION_BINDING);<NEW_LINE>protocolMarshaller.marshall(connectorSummary.getKafkaCluster(), KAFKACLUSTER_BINDING);<NEW_LINE>protocolMarshaller.marshall(connectorSummary.getKafkaClusterClientAuthentication(), KAFKACLUSTERCLIENTAUTHENTICATION_BINDING);<NEW_LINE>protocolMarshaller.marshall(connectorSummary.getKafkaClusterEncryptionInTransit(), KAFKACLUSTERENCRYPTIONINTRANSIT_BINDING);<NEW_LINE>protocolMarshaller.marshall(connectorSummary.getKafkaConnectVersion(), KAFKACONNECTVERSION_BINDING);<NEW_LINE>protocolMarshaller.marshall(connectorSummary.getLogDelivery(), LOGDELIVERY_BINDING);<NEW_LINE>protocolMarshaller.marshall(connectorSummary.getPlugins(), PLUGINS_BINDING);<NEW_LINE>protocolMarshaller.marshall(connectorSummary.getServiceExecutionRoleArn(), SERVICEEXECUTIONROLEARN_BINDING);<NEW_LINE>protocolMarshaller.marshall(<MASK><NEW_LINE>} catch (Exception e) {<NEW_LINE>throw new SdkClientException("Unable to marshall request to JSON: " + e.getMessage(), e);<NEW_LINE>}<NEW_LINE>} | connectorSummary.getWorkerConfiguration(), WORKERCONFIGURATION_BINDING); |
1,793,399 | private void drawCon2(Graphics g, int x, int y) {<NEW_LINE>g.drawLine(x + 130, y + AbstractTtlGate.PIN_HEIGHT, x + 130, y + 33);<NEW_LINE>g.drawLine(x + 117, y + 33, x + 130, y + 33);<NEW_LINE>g.drawLine(x + 110, y + AbstractTtlGate.PIN_HEIGHT, x + 110, y + 10);<NEW_LINE>g.drawLine(x + 110, y + 10, x + 120, y + 10);<NEW_LINE>g.drawLine(x + 120, y + 10, x + 120, y + 23);<NEW_LINE>g.drawLine(x + 113, y + 23, x + 120, y + 23);<NEW_LINE>g.drawLine(x + 90, y + AbstractTtlGate.PIN_HEIGHT, x + 90, y + 10);<NEW_LINE>g.drawLine(x + 90, y + 10, <MASK><NEW_LINE>g.drawLine(x + 105, y + 10, x + 105, y + 14);<NEW_LINE>g.drawLine(x + 70, y + AbstractTtlGate.PIN_HEIGHT, x + 70, y + 10);<NEW_LINE>g.drawLine(x + 70, y + 10, x + 88, y + 10);<NEW_LINE>g.drawLine(x + 88, y + 10, x + 88, y + 33);<NEW_LINE>g.drawLine(x + 88, y + 33, x + 97, y + 33);<NEW_LINE>g.drawLine(x + 50, y + AbstractTtlGate.PIN_HEIGHT, x + 50, y + 12);<NEW_LINE>g.drawLine(x + 50, y + 12, x + 86, y + 12);<NEW_LINE>g.drawLine(x + 86, y + 12, x + 86, y + 23);<NEW_LINE>g.drawLine(x + 86, y + 23, x + 97, y + 23);<NEW_LINE>g.drawLine(x + 30, y + AbstractTtlGate.PIN_HEIGHT, x + 30, y + 14);<NEW_LINE>g.drawLine(x + 30, y + 14, x + 84, y + 14);<NEW_LINE>g.drawLine(x + 84, y + 14, x + 84, y + 44);<NEW_LINE>g.drawLine(x + 84, y + 44, x + 105, y + 44);<NEW_LINE>g.drawLine(x + 105, y + 43, x + 105, y + 44);<NEW_LINE>} | x + 105, y + 10); |
809,854 | protected Size2D arrangeRR(Graphics2D g2, Range widthRange, Range heightRange) {<NEW_LINE>RectangleEdge position = getPosition();<NEW_LINE>if (position == RectangleEdge.TOP || position == RectangleEdge.BOTTOM) {<NEW_LINE>float maxWidth = (float) widthRange.getUpperBound();<NEW_LINE>g2.setFont(this.font);<NEW_LINE>this.content = TextUtils.createTextBlock(this.text, this.font, this.paint, maxWidth, this.maximumLinesToDisplay, new G2TextMeasurer(g2));<NEW_LINE>this.content.setLineAlignment(this.textAlignment);<NEW_LINE>Size2D contentSize = <MASK><NEW_LINE>if (this.expandToFitSpace) {<NEW_LINE>return new Size2D(maxWidth, contentSize.getHeight());<NEW_LINE>} else {<NEW_LINE>return contentSize;<NEW_LINE>}<NEW_LINE>} else if (position == RectangleEdge.LEFT || position == RectangleEdge.RIGHT) {<NEW_LINE>float maxWidth = (float) heightRange.getUpperBound();<NEW_LINE>g2.setFont(this.font);<NEW_LINE>this.content = TextUtils.createTextBlock(this.text, this.font, this.paint, maxWidth, this.maximumLinesToDisplay, new G2TextMeasurer(g2));<NEW_LINE>this.content.setLineAlignment(this.textAlignment);<NEW_LINE>Size2D contentSize = this.content.calculateDimensions(g2);<NEW_LINE>// transpose the dimensions, because the title is rotated<NEW_LINE>if (this.expandToFitSpace) {<NEW_LINE>return new Size2D(contentSize.getHeight(), maxWidth);<NEW_LINE>} else {<NEW_LINE>return new Size2D(contentSize.height, contentSize.width);<NEW_LINE>}<NEW_LINE>} else {<NEW_LINE>throw new RuntimeException("Unrecognised exception.");<NEW_LINE>}<NEW_LINE>} | this.content.calculateDimensions(g2); |
1,748,394 | public static ClientMessage encodeRequest(java.lang.String name, com.hazelcast.internal.serialization.Data key, com.hazelcast.internal.serialization.Data value, long threadId) {<NEW_LINE>ClientMessage clientMessage = ClientMessage.createForEncode();<NEW_LINE>clientMessage.setRetryable(false);<NEW_LINE>clientMessage.setOperationName("Map.RemoveIfSame");<NEW_LINE>ClientMessage.Frame initialFrame = new ClientMessage.Frame(new byte[REQUEST_INITIAL_FRAME_SIZE], UNFRAGMENTED_MESSAGE);<NEW_LINE>encodeInt(initialFrame.content, TYPE_FIELD_OFFSET, REQUEST_MESSAGE_TYPE);<NEW_LINE>encodeInt(initialFrame.content, PARTITION_ID_FIELD_OFFSET, -1);<NEW_LINE>encodeLong(initialFrame.content, REQUEST_THREAD_ID_FIELD_OFFSET, threadId);<NEW_LINE>clientMessage.add(initialFrame);<NEW_LINE>StringCodec.encode(clientMessage, name);<NEW_LINE><MASK><NEW_LINE>DataCodec.encode(clientMessage, value);<NEW_LINE>return clientMessage;<NEW_LINE>} | DataCodec.encode(clientMessage, key); |
766,281 | public synchronized void moveCursor(Entry newEntry) {<NEW_LINE>if (tc.isEntryEnabled())<NEW_LINE>SibTr.entry(tc, "moveCursor", new Object[] { newEntry });<NEW_LINE>checkEntryParent();<NEW_LINE>// if the entry is the same as the current one<NEW_LINE>// then we don't need to bother doing anything<NEW_LINE>if (newEntry != current) {<NEW_LINE>// make sure we can find the new entry in this list<NEW_LINE>if (newEntry != null && newEntry.parentList == parentList) {<NEW_LINE>LinkedList list = parentList;<NEW_LINE>synchronized (list) {<NEW_LINE>// remove the cursor from it's current postion<NEW_LINE>forceRemove();<NEW_LINE>// insert this cursor before the first on for the new entry<NEW_LINE>next = newEntry.firstCursor;<NEW_LINE>if (next != null)<NEW_LINE>next.previous = this;<NEW_LINE>newEntry.firstCursor = this;<NEW_LINE>previous = null;<NEW_LINE>parentList = list;<NEW_LINE>current = newEntry;<NEW_LINE>}<NEW_LINE>} else // if the new entry is not in this list, throw a runtime exception<NEW_LINE>{<NEW_LINE>SIErrorException e = new SIErrorException(nls.getFormattedMessage("INTERNAL_MESSAGING_ERROR_CWSIP0002", new Object[] { "com.ibm.ws.sib.processor.utils.linkedlist.Cursor", "1:457:1.15" }, null));<NEW_LINE>FFDCFilter.processException(e, "com.ibm.ws.sib.processor.utils.linkedlist.Cursor.moveCursor", "1:463:1.15", this);<NEW_LINE>SibTr.exception(tc, e);<NEW_LINE>if (tc.isEntryEnabled())<NEW_LINE>SibTr.<MASK><NEW_LINE>throw e;<NEW_LINE>}<NEW_LINE>}<NEW_LINE>if (tc.isEntryEnabled())<NEW_LINE>SibTr.exit(tc, "moveCursor");<NEW_LINE>} | exit(tc, "moveCursor", e); |
1,756,155 | private void readObject(java.io.ObjectInputStream stream) throws IOException, ClassNotFoundException {<NEW_LINE>stream.defaultReadObject();<NEW_LINE>int dataSize = stream.readInt();<NEW_LINE>m_data = new ArrayList<Data>(dataSize);<NEW_LINE>for (int i = 0, n = dataSize; i < n; ++i) {<NEW_LINE>int b = stream.readByte();<NEW_LINE>if (b == 1) {<NEW_LINE>int elm = stream.readInt();<NEW_LINE>double x1 = stream.readDouble();<NEW_LINE>double y1 = stream.readDouble();<NEW_LINE>double x2 = stream.readDouble();<NEW_LINE>double y2 = stream.readDouble();<NEW_LINE>Data d = new Data(elm, <MASK><NEW_LINE>m_data.add(d);<NEW_LINE>} else if (b == 0) {<NEW_LINE>m_data.add(null);<NEW_LINE>} else {<NEW_LINE>throw new IOException();<NEW_LINE>}<NEW_LINE>}<NEW_LINE>} | x1, y1, x2, y2); |
1,641,617 | final CreateRegexMatchSetResult executeCreateRegexMatchSet(CreateRegexMatchSetRequest createRegexMatchSetRequest) {<NEW_LINE>ExecutionContext executionContext = createExecutionContext(createRegexMatchSetRequest);<NEW_LINE>AWSRequestMetrics awsRequestMetrics = executionContext.getAwsRequestMetrics();<NEW_LINE>awsRequestMetrics.startEvent(Field.ClientExecuteTime);<NEW_LINE>Request<CreateRegexMatchSetRequest> request = null;<NEW_LINE>Response<CreateRegexMatchSetResult> response = null;<NEW_LINE>try {<NEW_LINE>awsRequestMetrics.startEvent(Field.RequestMarshallTime);<NEW_LINE>try {<NEW_LINE>request = new CreateRegexMatchSetRequestProtocolMarshaller(protocolFactory).marshall<MASK><NEW_LINE>// Binds the request metrics to the current request.<NEW_LINE>request.setAWSRequestMetrics(awsRequestMetrics);<NEW_LINE>request.addHandlerContext(HandlerContextKey.CLIENT_ENDPOINT, endpoint);<NEW_LINE>request.addHandlerContext(HandlerContextKey.ENDPOINT_OVERRIDDEN, isEndpointOverridden());<NEW_LINE>request.addHandlerContext(HandlerContextKey.SIGNING_REGION, getSigningRegion());<NEW_LINE>request.addHandlerContext(HandlerContextKey.SERVICE_ID, "WAF");<NEW_LINE>request.addHandlerContext(HandlerContextKey.OPERATION_NAME, "CreateRegexMatchSet");<NEW_LINE>request.addHandlerContext(HandlerContextKey.ADVANCED_CONFIG, advancedConfig);<NEW_LINE>} finally {<NEW_LINE>awsRequestMetrics.endEvent(Field.RequestMarshallTime);<NEW_LINE>}<NEW_LINE>HttpResponseHandler<AmazonWebServiceResponse<CreateRegexMatchSetResult>> responseHandler = protocolFactory.createResponseHandler(new JsonOperationMetadata().withPayloadJson(true).withHasStreamingSuccessResponse(false), new CreateRegexMatchSetResultJsonUnmarshaller());<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(createRegexMatchSetRequest)); |
1,851,704 | public Dialog onCreateDialog(Bundle savedInstanceState) {<NEW_LINE>@SuppressLint("InflateParams")<NEW_LINE>View view = LayoutInflater.from(getContext()).inflate(R.layout.preference_dialog_now_playing_screen, null);<NEW_LINE>ViewPager viewPager = view.findViewById(R.id.now_playing_screen_view_pager);<NEW_LINE>viewPager.setAdapter(<MASK><NEW_LINE>viewPager.addOnPageChangeListener(this);<NEW_LINE>viewPager.setPageMargin((int) ViewUtil.convertDpToPixel(32, getResources()));<NEW_LINE>viewPager.setCurrentItem(PreferenceUtil.getInstance(getContext()).getNowPlayingScreen().ordinal());<NEW_LINE>InkPageIndicator pageIndicator = view.findViewById(R.id.page_indicator);<NEW_LINE>pageIndicator.setViewPager(viewPager);<NEW_LINE>pageIndicator.onPageSelected(viewPager.getCurrentItem());<NEW_LINE>return new MaterialDialog.Builder(getContext()).title(R.string.pref_title_now_playing_screen_appearance).positiveText(android.R.string.ok).negativeText(android.R.string.cancel).onAny(this).customView(view, false).build();<NEW_LINE>} | new NowPlayingScreenAdapter(getContext())); |
214,893 | public static CameraPinholeBrown loadOpenCV(Reader reader) {<NEW_LINE>CameraPinholeBrown out = new CameraPinholeBrown();<NEW_LINE>try {<NEW_LINE>String filtered = IOUtils.toString(reader);<NEW_LINE>// It doesn't like the header or that class def<NEW_LINE>filtered = filtered.replace("%YAML:1.0", "");<NEW_LINE>filtered = filtered.replace("!!opencv-matrix", "");<NEW_LINE>Representer representer = new Representer();<NEW_LINE>representer.getPropertyUtils().setSkipMissingProperties(true);<NEW_LINE>Yaml yaml = new Yaml(new Constructor(), representer);<NEW_LINE>Map<String, Object> map = yaml.load(filtered);<NEW_LINE>int width = getOrThrow(map, "image_width");<NEW_LINE>int height = getOrThrow(map, "image_height");<NEW_LINE>DMatrixRMaj K = loadOpenCVMatrix(getOrThrow(map, "camera_matrix"));<NEW_LINE>DMatrixRMaj distortion = loadOpenCVMatrix(getOrThrow(map, "distortion_coefficients"));<NEW_LINE>PerspectiveOps.matrixToPinhole(K, width, height, out);<NEW_LINE>if (distortion.getNumElements() >= 5)<NEW_LINE>out.setRadial(distortion.get(0), distortion.get(1)<MASK><NEW_LINE>else if (distortion.getNumElements() >= 2)<NEW_LINE>out.setRadial(distortion.get(0), distortion.get(1));<NEW_LINE>if (distortion.getNumElements() >= 5)<NEW_LINE>out.fsetTangental(distortion.get(2), distortion.get(3));<NEW_LINE>} catch (IOException e) {<NEW_LINE>throw new UncheckedIOException(e);<NEW_LINE>}<NEW_LINE>return out;<NEW_LINE>} | , distortion.get(4)); |
1,472,800 | public void run() {<NEW_LINE>Configure config = null;<NEW_LINE>TraceContext traceContext = null;<NEW_LINE>long elapsedTime = 0L;<NEW_LINE>try {<NEW_LINE>config = Configure.getInstance();<NEW_LINE>config.scouter_stop = true;<NEW_LINE>traceContext = TraceContext.getInstance();<NEW_LINE>traceContext.endTime = System.currentTimeMillis();<NEW_LINE>elapsedTime = (traceContext.endTime - traceContext.startTime);<NEW_LINE>if (config.batch_log_send_elapsed_ms <= elapsedTime) {<NEW_LINE>traceContext.caculateLast();<NEW_LINE><MASK><NEW_LINE>if (config.scouter_standalone || config.sbr_log_make) {<NEW_LINE>saveStandAloneResult(traceContext, result);<NEW_LINE>}<NEW_LINE>Logger.println(result);<NEW_LINE>}<NEW_LINE>} catch (Throwable ex) {<NEW_LINE>Logger.println("Scouter ResultSender(run) Exception: " + ex.getMessage());<NEW_LINE>} finally {<NEW_LINE>try {<NEW_LINE>if (config != null && traceContext != null) {<NEW_LINE>if (!config.scouter_standalone) {<NEW_LINE>if (config.batch_log_send_elapsed_ms <= elapsedTime) {<NEW_LINE>if (config.sfa_dump_enabled && config.sfa_dump_send_elapsed_ms > elapsedTime) {<NEW_LINE>traceContext.isStackLogFile = false;<NEW_LINE>}<NEW_LINE>UdpLocalAgent.sendUdpPackToServer(traceContext.makePack());<NEW_LINE>}<NEW_LINE>if (config.sfa_dump_enabled && config.sfa_dump_send_elapsed_ms <= elapsedTime) {<NEW_LINE>UdpLocalAgent.sendDumpFileInfo(traceContext);<NEW_LINE>}<NEW_LINE>}<NEW_LINE>if (config.sfa_dump_enabled && config.sfa_dump_send_elapsed_ms > elapsedTime) {<NEW_LINE>deleteFiles(traceContext);<NEW_LINE>}<NEW_LINE>UdpLocalAgent.sendEndInfo(traceContext);<NEW_LINE>}<NEW_LINE>} catch (Exception ex) {<NEW_LINE>ex.printStackTrace();<NEW_LINE>}<NEW_LINE>}<NEW_LINE>} | String result = traceContext.toString(); |
1,741,806 | public OriginRequestPolicyCookiesConfig unmarshall(StaxUnmarshallerContext context) throws Exception {<NEW_LINE>OriginRequestPolicyCookiesConfig originRequestPolicyCookiesConfig = new OriginRequestPolicyCookiesConfig();<NEW_LINE>int originalDepth = context.getCurrentDepth();<NEW_LINE>int targetDepth = originalDepth + 1;<NEW_LINE>if (context.isStartOfDocument())<NEW_LINE>targetDepth += 1;<NEW_LINE>while (true) {<NEW_LINE>XMLEvent xmlEvent = context.nextEvent();<NEW_LINE>if (xmlEvent.isEndDocument())<NEW_LINE>return originRequestPolicyCookiesConfig;<NEW_LINE>if (xmlEvent.isAttribute() || xmlEvent.isStartElement()) {<NEW_LINE>if (context.testExpression("CookieBehavior", targetDepth)) {<NEW_LINE>originRequestPolicyCookiesConfig.setCookieBehavior(StringStaxUnmarshaller.getInstance<MASK><NEW_LINE>continue;<NEW_LINE>}<NEW_LINE>if (context.testExpression("Cookies", targetDepth)) {<NEW_LINE>originRequestPolicyCookiesConfig.setCookies(CookieNamesStaxUnmarshaller.getInstance().unmarshall(context));<NEW_LINE>continue;<NEW_LINE>}<NEW_LINE>} else if (xmlEvent.isEndElement()) {<NEW_LINE>if (context.getCurrentDepth() < originalDepth) {<NEW_LINE>return originRequestPolicyCookiesConfig;<NEW_LINE>}<NEW_LINE>}<NEW_LINE>}<NEW_LINE>} | ().unmarshall(context)); |
341,204 | Map<String, Object> mapFieldsFromJson(final String json) throws JsonProcessingException, DotDataException, DotSecurityException {<NEW_LINE>final Contentlet immutableContentlet = immutableFromJson(json);<NEW_LINE>final Map<String, Object> map = new HashMap<>();<NEW_LINE>final String inode = immutableContentlet.inode();<NEW_LINE>final <MASK><NEW_LINE>final String contentTypeId = immutableContentlet.contentType();<NEW_LINE>map.put(INODE_KEY, inode);<NEW_LINE>map.put(IDENTIFIER_KEY, identifier);<NEW_LINE>map.put(STRUCTURE_INODE_KEY, contentTypeId);<NEW_LINE>map.put(MOD_DATE_KEY, Date.from(immutableContentlet.modDate()));<NEW_LINE>map.put(MOD_USER_KEY, immutableContentlet.modUser());<NEW_LINE>map.put(OWNER_KEY, immutableContentlet.owner());<NEW_LINE>map.put(TITTLE_KEY, immutableContentlet.title());<NEW_LINE>map.put(SORT_ORDER_KEY, immutableContentlet.sortOrder());<NEW_LINE>map.put(LANGUAGEID_KEY, immutableContentlet.languageId());<NEW_LINE>map.put(DISABLED_WYSIWYG_KEY, immutableContentlet.disabledWysiwyg());<NEW_LINE>final ContentType contentType = contentTypeAPI.find(contentTypeId);<NEW_LINE>final Map<String, Field> fieldsByVarName = contentType.fields().stream().collect(Collectors.toMap(Field::variable, Function.identity()));<NEW_LINE>final Map<String, FieldValue<?>> contentletFields = immutableContentlet.fields();<NEW_LINE>for (final Entry<String, Field> entry : fieldsByVarName.entrySet()) {<NEW_LINE>final Field field = entry.getValue();<NEW_LINE>if (isNotMappable(field)) {<NEW_LINE>continue;<NEW_LINE>}<NEW_LINE>Object value;<NEW_LINE>if (isSet(identifier) && isFileAsset(contentType, field)) {<NEW_LINE>value = identifierAPI.find(identifier).getAssetName();<NEW_LINE>} else {<NEW_LINE>if (field instanceof BinaryField) {<NEW_LINE>value = getBinary(field, inode).orElse(null);<NEW_LINE>} else {<NEW_LINE>value = getValue(contentletFields, field);<NEW_LINE>}<NEW_LINE>}<NEW_LINE>map.put(field.variable(), value);<NEW_LINE>}<NEW_LINE>return map;<NEW_LINE>} | String identifier = immutableContentlet.identifier(); |
43,228 | public void userEventTriggered(ChannelHandlerContext ctx, Object evt) throws Exception {<NEW_LINE>if (evt instanceof HandshakeComplete) {<NEW_LINE>HandshakeComplete hc = (HandshakeComplete) evt;<NEW_LINE>String ruri = determineWsFrameHandler(hc.requestUri());<NEW_LINE>if (ruri.isBlank()) {<NEW_LINE>JSONStringer jsonObject = new JSONStringer();<NEW_LINE>jsonObject.object().key("errors").array().object().key("status").value("404").key("title").value("URI Path Not Found").key("detail").value("The URI path '" + hc.requestUri() + "' does not have a valid handler").endObject().endArray().endObject();<NEW_LINE>com.gmt2001.Console.debug.println("404 WS: " + hc.requestUri());<NEW_LINE>WebSocketFrameHandler.sendWsFrame(ctx, null, WebSocketFrameHandler.prepareTextWebSocketResponse(jsonObject.toString()));<NEW_LINE>WebSocketFrameHandler.sendWsFrame(ctx, null, WebSocketFrameHandler.prepareCloseWebSocketFrame(WebSocketCloseStatus.POLICY_VIOLATION));<NEW_LINE>ctx.close();<NEW_LINE>} else {<NEW_LINE>com.gmt2001.Console.debug.println("200 WS: " + hc.requestUri() + " Remote: [" + ctx.channel().remoteAddress(<MASK><NEW_LINE>ctx.channel().attr(ATTR_URI).set(ruri);<NEW_LINE>ctx.channel().attr(WsAuthenticationHandler.ATTR_AUTHENTICATED).setIfAbsent(Boolean.FALSE);<NEW_LINE>ctx.channel().closeFuture().addListener((ChannelFutureListener) (ChannelFuture f) -> {<NEW_LINE>WS_SESSIONS.remove(f.channel());<NEW_LINE>});<NEW_LINE>WS_SESSIONS.add(ctx.channel());<NEW_LINE>}<NEW_LINE>}<NEW_LINE>} | ).toString() + "]"); |
1,752,694 | private Precedence visitBinOp(Concrete.Expression left, Concrete.ReferenceExpression infix, List<Concrete.Argument> implicitArgs, Concrete.Expression right, Precedence prec, StringBuilder builder) {<NEW_LINE>Precedence infixPrec = ((GlobalReferable) infix.getReferent()).getRepresentablePrecedence();<NEW_LINE>boolean needParens = prec.priority > infixPrec.priority || prec.priority == infixPrec.priority && (prec.associativity != infixPrec.associativity || prec.associativity == Precedence.Associativity.NON_ASSOC);<NEW_LINE>if (needParens)<NEW_LINE>myBuilder.append('(');<NEW_LINE>PrettyPrintVisitor ppVisitor;<NEW_LINE>Precedence leftPrec = infixPrec.associativity != Precedence.Associativity.LEFT_ASSOC ? new Precedence(Precedence.Associativity.NON_ASSOC, infixPrec.priority, infixPrec.isInfix) : infixPrec;<NEW_LINE>if (left != null) {<NEW_LINE>left.accept(this, leftPrec);<NEW_LINE>ppVisitor = this;<NEW_LINE>} else {<NEW_LINE>ppVisitor = new PrettyPrintVisitor(builder, myIndent, !noIndent);<NEW_LINE>}<NEW_LINE>ppVisitor.myBuilder.append(' ');<NEW_LINE>ppVisitor.printReferenceName(infix, null);<NEW_LINE>for (Concrete.Argument arg : implicitArgs) {<NEW_LINE>ppVisitor.myBuilder.append(" {");<NEW_LINE>arg.expression.accept(ppVisitor, new Precedence(Expression.PREC));<NEW_LINE>ppVisitor.printClosingBrace();<NEW_LINE>}<NEW_LINE>ppVisitor.myBuilder.append(' ');<NEW_LINE>Precedence rightPrec = infixPrec.associativity != Precedence.Associativity.RIGHT_ASSOC ? new Precedence(Precedence.Associativity.NON_ASSOC, infixPrec.priority, infixPrec.isInfix) : infixPrec;<NEW_LINE>if (right != null) {<NEW_LINE><MASK><NEW_LINE>if (needParens)<NEW_LINE>ppVisitor.myBuilder.append(')');<NEW_LINE>return leftPrec;<NEW_LINE>} else {<NEW_LINE>if (needParens)<NEW_LINE>builder.append(')');<NEW_LINE>return rightPrec;<NEW_LINE>}<NEW_LINE>} | right.accept(ppVisitor, rightPrec); |
47,253 | public static Rule createAndAddRepositoryRule(Package.Builder pkg, RuleClass ruleClass, RuleClass bindRuleClass, Map<String, Object> kwargs, StarlarkSemantics semantics, ImmutableList<StarlarkThread.CallStackEntry> callstack) throws RuleFactory.InvalidRuleException, Package.NameConflictException, LabelSyntaxException, InterruptedException {<NEW_LINE>StoredEventHandler eventHandler = new StoredEventHandler();<NEW_LINE>BuildLangTypedAttributeValuesMap attributeValues = new BuildLangTypedAttributeValuesMap(kwargs);<NEW_LINE>Rule rule = RuleFactory.createRule(pkg, ruleClass, attributeValues, eventHandler, semantics, callstack);<NEW_LINE>pkg.addEvents(eventHandler.getEvents());<NEW_LINE>pkg.addPosts(eventHandler.getPosts());<NEW_LINE>overwriteRule(pkg, rule);<NEW_LINE>for (Map.Entry<String, Label> entry : ruleClass.getExternalBindingsFunction().apply(rule).entrySet()) {<NEW_LINE>Label nameLabel = Label.parseAbsolute("//external:" + entry.getKey(<MASK><NEW_LINE>addBindRule(pkg, bindRuleClass, nameLabel, entry.getValue(), semantics, callstack);<NEW_LINE>}<NEW_LINE>// NOTE(wyv): What is this madness?? This is the only instance where a repository rule can<NEW_LINE>// register toolchains upon being instantiated. We should look into converting<NEW_LINE>// android_{s,n}dk_repository into module extensions.<NEW_LINE>ImmutableList.Builder<TargetPattern> toolchains = new ImmutableList.Builder<>();<NEW_LINE>for (String pattern : ruleClass.getToolchainsToRegisterFunction().apply(rule)) {<NEW_LINE>try {<NEW_LINE>toolchains.add(TargetPattern.defaultParser().parse(pattern));<NEW_LINE>} catch (TargetParsingException e) {<NEW_LINE>throw new LabelSyntaxException(e.getMessage());<NEW_LINE>}<NEW_LINE>}<NEW_LINE>pkg.addRegisteredToolchains(toolchains.build());<NEW_LINE>return rule;<NEW_LINE>} | ), ImmutableMap.of()); |
981,968 | private static void pointAddVar(boolean negate, PointExt p, PointAccum r) {<NEW_LINE>int[] a = F.create();<NEW_LINE>int[] b = F.create();<NEW_LINE>int[] c = F.create();<NEW_LINE>int[] d = F.create();<NEW_LINE>int[] e = r.u;<NEW_LINE>int[] f = F.create();<NEW_LINE>int[] g = F.create();<NEW_LINE>int[] h = r.v;<NEW_LINE>int[] nc, nd, nf, ng;<NEW_LINE>if (negate) {<NEW_LINE>nc = d;<NEW_LINE>nd = c;<NEW_LINE>nf = g;<NEW_LINE>ng = f;<NEW_LINE>} else {<NEW_LINE>nc = c;<NEW_LINE>nd = d;<NEW_LINE>nf = f;<NEW_LINE>ng = g;<NEW_LINE>}<NEW_LINE>F.apm(r.y, r.x, b, a);<NEW_LINE>F.apm(p.y, p.x, nd, nc);<NEW_LINE>F.mul(a, c, a);<NEW_LINE>F.mul(b, d, b);<NEW_LINE>F.mul(r.u, r.v, c);<NEW_LINE>F.mul(c, p.t, c);<NEW_LINE>F.<MASK><NEW_LINE>F.mul(r.z, p.z, d);<NEW_LINE>F.add(d, d, d);<NEW_LINE>F.apm(b, a, h, e);<NEW_LINE>F.apm(d, c, ng, nf);<NEW_LINE>F.carry(ng);<NEW_LINE>F.mul(e, f, r.x);<NEW_LINE>F.mul(g, h, r.y);<NEW_LINE>F.mul(f, g, r.z);<NEW_LINE>} | mul(c, C_d2, c); |
1,480,561 | public void change(final Event e, @Nullable final Object[] delta, final ChangeMode mode) {<NEW_LINE>assert delta != null;<NEW_LINE>final int i = ((Number) delta[0]).intValue();<NEW_LINE>final ItemType it = getExpr().getSingle(e);<NEW_LINE>if (it == null)<NEW_LINE>return;<NEW_LINE>final ItemStack is = it.getRandom();<NEW_LINE>if (is == null)<NEW_LINE>return;<NEW_LINE>int type = is.getType().getId();<NEW_LINE>switch(mode) {<NEW_LINE>case ADD:<NEW_LINE>type += i;<NEW_LINE>break;<NEW_LINE>case REMOVE:<NEW_LINE>type -= i;<NEW_LINE>break;<NEW_LINE>case SET:<NEW_LINE>type = i;<NEW_LINE>break;<NEW_LINE>case RESET:<NEW_LINE>case DELETE:<NEW_LINE>case REMOVE_ALL:<NEW_LINE>default:<NEW_LINE>assert false;<NEW_LINE>return;<NEW_LINE>}<NEW_LINE>Material m = null;<NEW_LINE>try {<NEW_LINE>// Got past init<NEW_LINE>assert getMaterialMethod != null;<NEW_LINE>m = (<MASK><NEW_LINE>} catch (Throwable ex) {<NEW_LINE>Skript.exception(ex);<NEW_LINE>}<NEW_LINE>if (m != null) {<NEW_LINE>is.setType(m);<NEW_LINE>if (changeItemStack)<NEW_LINE>getExpr().change(e, new ItemStack[] { is }, ChangeMode.SET);<NEW_LINE>else<NEW_LINE>getExpr().change(e, new ItemType[] { new ItemType(is) }, ChangeMode.SET);<NEW_LINE>}<NEW_LINE>} | Material) getMaterialMethod.invoke(type); |
683,228 | private void extractAndPutDataTo(ExtensionTabData.Builder extensionTab, ExtensionDescription description, ResultSet set) throws SQLException {<NEW_LINE>boolean booleanValue = set.getBoolean(ExtensionPlayerValueTable.BOOLEAN_VALUE);<NEW_LINE>if (!set.wasNull()) {<NEW_LINE>extensionTab.putBooleanData(new ExtensionBooleanData(description, booleanValue));<NEW_LINE>return;<NEW_LINE>}<NEW_LINE>double doubleValue = set.getDouble(ExtensionPlayerValueTable.DOUBLE_VALUE);<NEW_LINE>if (!set.wasNull()) {<NEW_LINE>extensionTab.putDoubleData(new ExtensionDoubleData(description, doubleValue));<NEW_LINE>return;<NEW_LINE>}<NEW_LINE>double percentageValue = set.getDouble(ExtensionPlayerValueTable.PERCENTAGE_VALUE);<NEW_LINE>if (!set.wasNull()) {<NEW_LINE>extensionTab.putPercentageData(new ExtensionDoubleData(description, percentageValue));<NEW_LINE>return;<NEW_LINE>}<NEW_LINE>long numberValue = set.getLong(ExtensionPlayerValueTable.LONG_VALUE);<NEW_LINE>if (!set.wasNull()) {<NEW_LINE>FormatType formatType = FormatType.getByName(set.getString(ExtensionProviderTable.FORMAT_TYPE)).orElse(FormatType.NONE);<NEW_LINE>extensionTab.putNumberData(new ExtensionNumberData(description, formatType, numberValue));<NEW_LINE>return;<NEW_LINE>}<NEW_LINE>String stringValue = set.getString(ExtensionPlayerValueTable.STRING_VALUE);<NEW_LINE>if (stringValue != null) {<NEW_LINE>boolean <MASK><NEW_LINE>extensionTab.putStringData(new ExtensionStringData(description, isPlayerName, stringValue));<NEW_LINE>}<NEW_LINE>} | isPlayerName = set.getBoolean("is_player_name"); |
142,883 | public boolean attachCluster(DataStore dataStore, ClusterScope scope) {<NEW_LINE>final PrimaryDataStoreInfo primaryDataStoreInfo = (PrimaryDataStoreInfo) dataStore;<NEW_LINE>final ClusterVO cluster = clusterDao.findById(primaryDataStoreInfo.getClusterId());<NEW_LINE>final HypervisorType hypervisorType = cluster.getHypervisorType();<NEW_LINE>if (!isSupportedHypervisorType(hypervisorType)) {<NEW_LINE>throw new CloudRuntimeException(hypervisorType + " is not a supported hypervisor type.");<NEW_LINE>}<NEW_LINE>// check if there is at least one host up in this cluster<NEW_LINE>List<HostVO> allHosts = resourceMgr.listAllUpAndEnabledHosts(Host.Type.Routing, primaryDataStoreInfo.getClusterId(), primaryDataStoreInfo.getPodId(), primaryDataStoreInfo.getDataCenterId());<NEW_LINE>if (allHosts.isEmpty()) {<NEW_LINE>_primaryDataStoreDao.expunge(primaryDataStoreInfo.getId());<NEW_LINE>throw new CloudRuntimeException("No host up to associate a storage pool with in cluster " + primaryDataStoreInfo.getClusterId());<NEW_LINE>}<NEW_LINE>List<HostVO> poolHosts = new ArrayList<>();<NEW_LINE>for (HostVO host : allHosts) {<NEW_LINE>try {<NEW_LINE>createStoragePool(host.getId(), primaryDataStoreInfo);<NEW_LINE>_storageMgr.connectHostToSharedPool(host.getId(), primaryDataStoreInfo.getId());<NEW_LINE>poolHosts.add(host);<NEW_LINE>} catch (Exception e) {<NEW_LINE>s_logger.warn("Unable to establish a connection between " + <MASK><NEW_LINE>}<NEW_LINE>}<NEW_LINE>if (poolHosts.isEmpty()) {<NEW_LINE>s_logger.warn("No host can access storage pool '" + primaryDataStoreInfo + "' on cluster '" + primaryDataStoreInfo.getClusterId() + "'.");<NEW_LINE>_primaryDataStoreDao.expunge(primaryDataStoreInfo.getId());<NEW_LINE>throw new CloudRuntimeException("Failed to access storage pool");<NEW_LINE>}<NEW_LINE>dataStoreHelper.attachCluster(dataStore);<NEW_LINE>return true;<NEW_LINE>} | host + " and " + primaryDataStoreInfo, e); |
437,194 | public void run(RegressionEnvironment env) {<NEW_LINE>AtomicInteger milestone = new AtomicInteger();<NEW_LINE>String epl = "@name('s0') select irstream symbol," + "median(all price) as myMedian," + "median(distinct price) as myDistMedian," + "stddev(all price) as myStdev," + "avedev(all price) as myAvedev " + "from SupportMarketDataBean#length(5) " + "where symbol='DELL' or symbol='IBM' or symbol='GE' " + "group by symbol";<NEW_LINE>env.compileDeploy(epl).addListener("s0");<NEW_LINE>tryAssertionStmt(env, milestone);<NEW_LINE>// Test NaN sensitivity<NEW_LINE>env.undeployAll();<NEW_LINE>epl = "@name('s0') select stddev(price) as val from SupportMarketDataBean#length(3)";<NEW_LINE>env.compileDeploy<MASK><NEW_LINE>sendEvent(env, "A", Double.NaN);<NEW_LINE>sendEvent(env, "B", Double.NaN);<NEW_LINE>sendEvent(env, "C", Double.NaN);<NEW_LINE>env.milestoneInc(milestone);<NEW_LINE>sendEvent(env, "D", 1d);<NEW_LINE>sendEvent(env, "E", 2d);<NEW_LINE>env.listenerReset("s0");<NEW_LINE>env.milestoneInc(milestone);<NEW_LINE>sendEvent(env, "F", 3d);<NEW_LINE>env.assertEventNew("s0", event -> {<NEW_LINE>Double result = (Double) event.get("val");<NEW_LINE>assertTrue(result.isNaN());<NEW_LINE>});<NEW_LINE>env.undeployAll();<NEW_LINE>} | (epl).addListener("s0"); |
412,688 | public void fullSync(long agentId, HashMap<String, Pair<Long, Long>> newGroupStates) {<NEW_LINE>ArrayList<Long> affectedVms = new ArrayList<Long>();<NEW_LINE>for (String vmName : newGroupStates.keySet()) {<NEW_LINE>Long vmId = newGroupStates.get(vmName).first();<NEW_LINE>Long seqno = newGroupStates.get(vmName).second();<NEW_LINE>VmRulesetLogVO <MASK><NEW_LINE>if (log != null && log.getLogsequence() != seqno) {<NEW_LINE>affectedVms.add(vmId);<NEW_LINE>}<NEW_LINE>}<NEW_LINE>if (affectedVms.size() > 0) {<NEW_LINE>s_logger.info("Network Group full sync for agent " + agentId + " found " + affectedVms.size() + " vms out of sync");<NEW_LINE>scheduleRulesetUpdateToHosts(affectedVms, false, null);<NEW_LINE>}<NEW_LINE>} | log = _rulesetLogDao.findByVmId(vmId); |
372,906 | public void initSDK(MethodCall methodCall, MethodChannel.Result result) {<NEW_LINE>int sdkAppID = methodCall.argument("sdkAppID");<NEW_LINE>int <MASK><NEW_LINE>String uiPlatform = methodCall.argument("uiPlatform");<NEW_LINE>final String listenerUuid = methodCall.argument("listenerUuid");<NEW_LINE>// Global configuration<NEW_LINE>V2TIMManager.getInstance().callExperimentalAPI("setUIPlatform", uiPlatform, null);<NEW_LINE>// The main thread initializes the SDK<NEW_LINE>// if (SessionWrapper.isMainProcess(context)) {<NEW_LINE>V2TIMSDKConfig config = new V2TIMSDKConfig();<NEW_LINE>config.setLogLevel(logLevel);<NEW_LINE>Boolean res = V2TIMManager.getInstance().initSDK(context, sdkAppID, config, new V2TIMSDKListener() {<NEW_LINE><NEW_LINE>public void onConnecting() {<NEW_LINE>makeEventData("onConnecting", null, listenerUuid);<NEW_LINE>}<NEW_LINE><NEW_LINE>public void onConnectSuccess() {<NEW_LINE>makeEventData("onConnectSuccess", null, listenerUuid);<NEW_LINE>}<NEW_LINE><NEW_LINE>public void onConnectFailed(int code, String error) {<NEW_LINE>HashMap<String, Object> err = new HashMap<String, Object>();<NEW_LINE>err.put("code", code);<NEW_LINE>err.put("desc", error);<NEW_LINE>makeEventData("onConnectFailed", err, listenerUuid);<NEW_LINE>}<NEW_LINE><NEW_LINE>public void onKickedOffline() {<NEW_LINE>makeEventData("onKickedOffline", null, listenerUuid);<NEW_LINE>}<NEW_LINE><NEW_LINE>public void onUserSigExpired() {<NEW_LINE>makeEventData("onUserSigExpired", null, listenerUuid);<NEW_LINE>}<NEW_LINE><NEW_LINE>public void onSelfInfoUpdated(V2TIMUserFullInfo info) {<NEW_LINE>makeEventData("onSelfInfoUpdated", CommonUtil.convertV2TIMUserFullInfoToMap(info), listenerUuid);<NEW_LINE>}<NEW_LINE>});<NEW_LINE>CommonUtil.returnSuccess(result, res);<NEW_LINE>// }<NEW_LINE>} | logLevel = methodCall.argument("logLevel"); |
153,105 | public void marshall(UpdateSlotRequest updateSlotRequest, ProtocolMarshaller protocolMarshaller) {<NEW_LINE>if (updateSlotRequest == null) {<NEW_LINE>throw new SdkClientException("Invalid argument passed to marshall(...)");<NEW_LINE>}<NEW_LINE>try {<NEW_LINE>protocolMarshaller.marshall(updateSlotRequest.getSlotId(), SLOTID_BINDING);<NEW_LINE>protocolMarshaller.marshall(updateSlotRequest.getSlotName(), SLOTNAME_BINDING);<NEW_LINE>protocolMarshaller.marshall(updateSlotRequest.getDescription(), DESCRIPTION_BINDING);<NEW_LINE>protocolMarshaller.marshall(updateSlotRequest.getSlotTypeId(), SLOTTYPEID_BINDING);<NEW_LINE>protocolMarshaller.marshall(updateSlotRequest.getValueElicitationSetting(), VALUEELICITATIONSETTING_BINDING);<NEW_LINE>protocolMarshaller.marshall(updateSlotRequest.getObfuscationSetting(), OBFUSCATIONSETTING_BINDING);<NEW_LINE>protocolMarshaller.marshall(updateSlotRequest.getBotId(), BOTID_BINDING);<NEW_LINE>protocolMarshaller.marshall(<MASK><NEW_LINE>protocolMarshaller.marshall(updateSlotRequest.getLocaleId(), LOCALEID_BINDING);<NEW_LINE>protocolMarshaller.marshall(updateSlotRequest.getIntentId(), INTENTID_BINDING);<NEW_LINE>protocolMarshaller.marshall(updateSlotRequest.getMultipleValuesSetting(), MULTIPLEVALUESSETTING_BINDING);<NEW_LINE>} catch (Exception e) {<NEW_LINE>throw new SdkClientException("Unable to marshall request to JSON: " + e.getMessage(), e);<NEW_LINE>}<NEW_LINE>} | updateSlotRequest.getBotVersion(), BOTVERSION_BINDING); |
1,741,775 | public void initiate(@RequestParam(value = "sp", required = false) String sp, HttpServletRequest request, HttpServletResponse response) {<NEW_LINE>if (!hasText(sp)) {<NEW_LINE>throw new ProviderNotFoundException("Missing sp request parameter. sp parameter must be a valid and configured entity ID");<NEW_LINE>}<NEW_LINE>log.debug("IDP is initiating authentication request to SP[{}]", UaaStringUtils.getCleanedUserControlString(sp));<NEW_LINE>Optional<SamlServiceProviderHolder> holder = configurator.getSamlServiceProviders().stream().filter(serviceProvider -> sp.equals(serviceProvider.getSamlServiceProvider().getEntityId())).findFirst();<NEW_LINE>if (holder.isEmpty()) {<NEW_LINE>log.debug("SP[{}] was not found, aborting saml response", UaaStringUtils.getCleanedUserControlString(sp));<NEW_LINE>throw new ProviderNotFoundException("Invalid sp entity ID. sp parameter must be a valid and configured entity ID");<NEW_LINE>}<NEW_LINE>if (!holder.get().getSamlServiceProvider().isActive()) {<NEW_LINE>log.debug("SP[{}] is disabled, aborting saml response", UaaStringUtils.getCleanedUserControlString(sp));<NEW_LINE>throw new ProviderNotFoundException("Service provider is disabled.");<NEW_LINE>}<NEW_LINE>if (!holder.get().getSamlServiceProvider().getConfig().isEnableIdpInitiatedSso()) {<NEW_LINE>log.debug("SP[{}] initiated login is disabled, aborting saml response"<MASK><NEW_LINE>throw new ProviderNotFoundException("IDP initiated login is disabled for this service provider.");<NEW_LINE>}<NEW_LINE>String nameId = "urn:oasis:names:tc:SAML:1.1:nameid-format:unspecified";<NEW_LINE>try {<NEW_LINE>String assertionLocation = getAssertionConsumerURL(sp);<NEW_LINE>log.debug("IDP is sending assertion for SP[{}] to {}", UaaStringUtils.getCleanedUserControlString(sp), UaaStringUtils.getCleanedUserControlString(assertionLocation));<NEW_LINE>AuthnRequest authnRequest = idpWebSsoProfile.buildIdpInitiatedAuthnRequest(nameId, sp, assertionLocation);<NEW_LINE>SAMLMessageContext samlContext = getSamlContext(sp, authnRequest, request, response);<NEW_LINE>idpWebSsoProfile.sendResponse(SecurityContextHolder.getContext().getAuthentication(), samlContext, getIdpIniatedOptions());<NEW_LINE>log.debug("IDP initiated authentication and responded to SP[{}]", UaaStringUtils.getCleanedUserControlString(sp));<NEW_LINE>} catch (MetadataProviderException | SAMLException | SecurityException | MessageEncodingException | MarshallingException | SignatureException e) {<NEW_LINE>log.debug("IDP is unable to process assertion for SP[{}]", UaaStringUtils.getCleanedUserControlString(sp), e);<NEW_LINE>throw new ProviderNotFoundException("Unable to process SAML assertion. Response not sent.");<NEW_LINE>}<NEW_LINE>} | , UaaStringUtils.getCleanedUserControlString(sp)); |
106,428 | private void writeXpp3DOM(XmlSerializer serializer, Xpp3Dom root, InputLocationTracker rootTracker) throws IOException {<NEW_LINE>StringBuffer b = b(serializer);<NEW_LINE>serializer.startTag(NAMESPACE, root.getName());<NEW_LINE>// need to flush the inner writer, flush on serializer closes tag<NEW_LINE>flush(serializer);<NEW_LINE>int start = b.length() - root.getName().length() - 2;<NEW_LINE>String[] attributeNames = root.getAttributeNames();<NEW_LINE>for (int i = 0; i < attributeNames.length; i++) {<NEW_LINE>String attributeName = attributeNames[i];<NEW_LINE>serializer.attribute(NAMESPACE, attributeName, root.getAttribute(attributeName));<NEW_LINE>}<NEW_LINE>boolean config = rootTracker != null ? rootTracker.getLocation(root.getName()) != null : true;<NEW_LINE>Xpp3Dom[] children = root.getChildren();<NEW_LINE>for (int i = 0; i < children.length; i++) {<NEW_LINE>writeXpp3DOM(serializer, children[i], rootTracker != null ? rootTracker.getLocation(config ? root.getName() : root) : null);<NEW_LINE>}<NEW_LINE>String value = root.getValue();<NEW_LINE>if (value != null) {<NEW_LINE>serializer.text(value);<NEW_LINE>}<NEW_LINE>serializer.endTag(NAMESPACE, root.getName()).flush();<NEW_LINE>logLocation(rootTracker, config ? root.getName() : root, <MASK><NEW_LINE>} | start, b.length()); |
1,295,687 | UserDetailBean makeUserDetailRequest(final UserIdentity userIdentity) throws PwmUnrecoverableException {<NEW_LINE>final Instant startTime = Instant.now();<NEW_LINE>final CacheKey cacheKey = makeCacheKey(UserDetailBean.class.getSimpleName(), userIdentity.toDelimitedKey());<NEW_LINE>{<NEW_LINE>final UserDetailBean cachedOutput = pwmRequest.getPwmDomain().getCacheService().<MASK><NEW_LINE>if (cachedOutput != null) {<NEW_LINE>StatisticsClient.incrementStat(pwmRequest, Statistic.PEOPLESEARCH_CACHE_HITS);<NEW_LINE>return cachedOutput;<NEW_LINE>} else {<NEW_LINE>StatisticsClient.incrementStat(pwmRequest, Statistic.PEOPLESEARCH_CACHE_MISSES);<NEW_LINE>}<NEW_LINE>}<NEW_LINE>checkIfUserIdentityViewable(userIdentity);<NEW_LINE>final UserSearchResults detailResults = doDetailLookup(userIdentity);<NEW_LINE>final Map<String, String> searchResults = detailResults.getResults().get(userIdentity);<NEW_LINE>final UserDetailBean userDetailBean = new UserDetailBean();<NEW_LINE>userDetailBean.setUserKey(userIdentity.toObfuscatedKey(pwmRequest.getPwmApplication()));<NEW_LINE>final List<FormConfiguration> detailFormConfig = this.peopleSearchConfiguration.getSearchDetailForm();<NEW_LINE>final Map<String, AttributeDetailBean> attributeBeans = convertResultMapToBeans(userIdentity, detailFormConfig, searchResults);<NEW_LINE>userDetailBean.setDetail(attributeBeans);<NEW_LINE>final PhotoDataReader photoDataReader = photoDataReader(userIdentity);<NEW_LINE>final Optional<String> photoURL = photoDataReader.figurePhotoURL();<NEW_LINE>photoURL.ifPresent(userDetailBean::setPhotoURL);<NEW_LINE>final List<String> displayName = figureDisplaynames(userIdentity);<NEW_LINE>if (displayName != null) {<NEW_LINE>userDetailBean.setDisplayNames(displayName);<NEW_LINE>}<NEW_LINE>userDetailBean.setLinks(makeUserDetailLinks(userIdentity));<NEW_LINE>LOGGER.trace(pwmRequest, () -> "finished building userDetail result of " + userIdentity + " in " + TimeDuration.fromCurrent(startTime).asCompactString());<NEW_LINE>storeDataInCache(cacheKey, userDetailBean);<NEW_LINE>return userDetailBean;<NEW_LINE>} | get(cacheKey, UserDetailBean.class); |
1,833,139 | public void testMultipleEndpointSameActSpec() throws Exception {<NEW_LINE>MBeanServer mbs = ManagementFactory.getPlatformMBeanServer();<NEW_LINE><MASK><NEW_LINE>assertTrue((Boolean) mbs.invoke(obn, "isPaused", new Object[] { "MsgEndpointApp#MsgEndpointEJB.jar#EndpointBMTNonJMSAutoStartFalse" }, new String[] { String.class.getName() }));<NEW_LINE>assertTrue((Boolean) mbs.invoke(obn, "isPaused", new Object[] { "MsgEndpointApp#MsgEndpointEJB.jar#EndpointBMTNonJMSAutoStartFalseDup" }, new String[] { String.class.getName() }));<NEW_LINE>// Resume BMTNonJMSAutoStartFalse, but not BMTNonJMSAutoStartFalseDup<NEW_LINE>mbs.invoke(obn, "resume", new Object[] { "MsgEndpointApp#MsgEndpointEJB.jar#EndpointBMTNonJMSAutoStartFalse" }, new String[] { String.class.getName() });<NEW_LINE>assertFalse((Boolean) mbs.invoke(obn, "isPaused", new Object[] { "MsgEndpointApp#MsgEndpointEJB.jar#EndpointBMTNonJMSAutoStartFalse" }, new String[] { String.class.getName() }));<NEW_LINE>assertTrue((Boolean) mbs.invoke(obn, "isPaused", new Object[] { "MsgEndpointApp#MsgEndpointEJB.jar#EndpointBMTNonJMSAutoStartFalseDup" }, new String[] { String.class.getName() }));<NEW_LINE>// Now resume BMTNonJMSAutoStartFalseDup<NEW_LINE>mbs.invoke(obn, "resume", new Object[] { "MsgEndpointApp#MsgEndpointEJB.jar#EndpointBMTNonJMSAutoStartFalseDup" }, new String[] { String.class.getName() });<NEW_LINE>assertFalse((Boolean) mbs.invoke(obn, "isPaused", new Object[] { "MsgEndpointApp#MsgEndpointEJB.jar#EndpointBMTNonJMSAutoStartFalse" }, new String[] { String.class.getName() }));<NEW_LINE>assertFalse((Boolean) mbs.invoke(obn, "isPaused", new Object[] { "MsgEndpointApp#MsgEndpointEJB.jar#EndpointBMTNonJMSAutoStartFalseDup" }, new String[] { String.class.getName() }));<NEW_LINE>} | ObjectName obn = new ObjectName(mbeanObjectName); |
1,636,497 | private static Value convertToValue(Object rawObject) {<NEW_LINE>Value.Builder valueBuilder = Value.newBuilder();<NEW_LINE>if (rawObject == null) {<NEW_LINE>valueBuilder.setNullValue(NullValue.NULL_VALUE);<NEW_LINE>} else if (rawObject instanceof Double) {<NEW_LINE>valueBuilder.setNumberValue((Double) rawObject);<NEW_LINE>} else if (rawObject instanceof String) {<NEW_LINE>valueBuilder.setStringValue((String) rawObject);<NEW_LINE>} else if (rawObject instanceof Boolean) {<NEW_LINE>valueBuilder.setBoolValue((Boolean) rawObject);<NEW_LINE>} else if (rawObject instanceof Map) {<NEW_LINE>Struct.<MASK><NEW_LINE>@SuppressWarnings("unchecked")<NEW_LINE>Map<String, ?> map = (Map<String, ?>) rawObject;<NEW_LINE>for (Map.Entry<String, ?> entry : map.entrySet()) {<NEW_LINE>structBuilder.putFields(entry.getKey(), convertToValue(entry.getValue()));<NEW_LINE>}<NEW_LINE>valueBuilder.setStructValue(structBuilder);<NEW_LINE>} else if (rawObject instanceof List) {<NEW_LINE>ListValue.Builder listBuilder = ListValue.newBuilder();<NEW_LINE>List<?> list = (List<?>) rawObject;<NEW_LINE>for (Object obj : list) {<NEW_LINE>listBuilder.addValues(convertToValue(obj));<NEW_LINE>}<NEW_LINE>valueBuilder.setListValue(listBuilder);<NEW_LINE>}<NEW_LINE>return valueBuilder.build();<NEW_LINE>} | Builder structBuilder = Struct.newBuilder(); |
1,646,803 | public static GetSmsConfigResponse unmarshall(GetSmsConfigResponse getSmsConfigResponse, UnmarshallerContext context) {<NEW_LINE>getSmsConfigResponse.setRequestId(context.stringValue("GetSmsConfigResponse.RequestId"));<NEW_LINE>getSmsConfigResponse.setSuccess<MASK><NEW_LINE>getSmsConfigResponse.setCode(context.stringValue("GetSmsConfigResponse.Code"));<NEW_LINE>getSmsConfigResponse.setMessage(context.stringValue("GetSmsConfigResponse.Message"));<NEW_LINE>getSmsConfigResponse.setHttpStatusCode(context.integerValue("GetSmsConfigResponse.HttpStatusCode"));<NEW_LINE>List<SmsConfig> smsConfigs = new ArrayList<SmsConfig>();<NEW_LINE>for (int i = 0; i < context.lengthValue("GetSmsConfigResponse.SmsConfigs.Length"); i++) {<NEW_LINE>SmsConfig smsConfig = new SmsConfig();<NEW_LINE>smsConfig.setId(context.longValue("GetSmsConfigResponse.SmsConfigs[" + i + "].Id"));<NEW_LINE>smsConfig.setInstance(context.stringValue("GetSmsConfigResponse.SmsConfigs[" + i + "].Instance"));<NEW_LINE>smsConfig.setSignName(context.stringValue("GetSmsConfigResponse.SmsConfigs[" + i + "].SignName"));<NEW_LINE>smsConfig.setTemplateCode(context.stringValue("GetSmsConfigResponse.SmsConfigs[" + i + "].TemplateCode"));<NEW_LINE>smsConfig.setScenario(context.integerValue("GetSmsConfigResponse.SmsConfigs[" + i + "].Scenario"));<NEW_LINE>smsConfig.setName(context.stringValue("GetSmsConfigResponse.SmsConfigs[" + i + "].Name"));<NEW_LINE>smsConfig.setDescription(context.stringValue("GetSmsConfigResponse.SmsConfigs[" + i + "].Description"));<NEW_LINE>smsConfig.setExtra(context.stringValue("GetSmsConfigResponse.SmsConfigs[" + i + "].Extra"));<NEW_LINE>smsConfig.setGmtCreate(context.stringValue("GetSmsConfigResponse.SmsConfigs[" + i + "].GmtCreate"));<NEW_LINE>smsConfig.setGmtModified(context.stringValue("GetSmsConfigResponse.SmsConfigs[" + i + "].GmtModified"));<NEW_LINE>smsConfigs.add(smsConfig);<NEW_LINE>}<NEW_LINE>getSmsConfigResponse.setSmsConfigs(smsConfigs);<NEW_LINE>return getSmsConfigResponse;<NEW_LINE>} | (context.booleanValue("GetSmsConfigResponse.Success")); |
945,629 | public static void main(String[] args) {<NEW_LINE>final String authUser = "username";<NEW_LINE>final String authPassword = "password";<NEW_LINE>CredentialsProvider credsProvider = new BasicCredentialsProvider();<NEW_LINE>credsProvider.setCredentials(new AuthScope("10.10.10.10", 8080), new UsernamePasswordCredentials(authUser, authPassword));<NEW_LINE>HttpHost myProxy = new HttpHost("10.10.10.10", 8080);<NEW_LINE>HttpClientBuilder clientBuilder = HttpClientBuilder.create();<NEW_LINE>clientBuilder.setProxy(myProxy).setProxyAuthenticationStrategy(new ProxyAuthenticationStrategy()).setDefaultCredentialsProvider(credsProvider).disableCookieManagement();<NEW_LINE>CloseableHttpClient httpClient = clientBuilder.build();<NEW_LINE>FhirContext ctx = FhirContext.forDstu2();<NEW_LINE>String serverBase = "http://spark.furore.com/fhir/";<NEW_LINE>ctx.getRestfulClientFactory().setHttpClient(httpClient);<NEW_LINE>IGenericClient <MASK><NEW_LINE>IdType id = new IdType("Patient", "123");<NEW_LINE>Patient patient = client.read().resource(Patient.class).withId(id).execute();<NEW_LINE>} | client = ctx.newRestfulGenericClient(serverBase); |
1,687,727 | public <T extends SaveFileFormat> T load(InputStream is, Class<T> format) {<NEW_LINE>entitySerializer.preLoad();<NEW_LINE>Input input = new ByteBufferInput(is);<NEW_LINE>SaveFileFormat partial = new SaveFileFormat((IntBag) null);<NEW_LINE>partial.componentIdentifiers = kryo.readObject(input, SaveFileFormat.ComponentIdentifiers.class);<NEW_LINE>transmuterEntrySerializer.identifiers = partial.componentIdentifiers;<NEW_LINE>partial.archetypes = kryo.readObject(input, ArchetypeMapper.class);<NEW_LINE>entitySerializer.archetypeMapper = partial.archetypes;<NEW_LINE>entitySerializer.serializationState = partial;<NEW_LINE>if (entitySerializer.archetypeMapper != null) {<NEW_LINE>entitySerializer.archetypeMapper.serializationState = partial;<NEW_LINE>transmuterEntrySerializer.identifiers = partial.componentIdentifiers;<NEW_LINE>}<NEW_LINE>referenceTracker.inspectTypes(partial.componentIdentifiers.typeToId.keySet());<NEW_LINE>entitySerializer.factory.<MASK><NEW_LINE>T t = kryo.readObject(input, format);<NEW_LINE>t.tracker = entitySerializer.keyTracker;<NEW_LINE>referenceTracker.translate(intBagEntitySerializer.getTranslatedIds());<NEW_LINE>// TODO do we want to clear those?<NEW_LINE>entitySerializer.clearSerializerCache();<NEW_LINE>return t;<NEW_LINE>} | configureWith(input.readInt()); |
1,211,955 | public void draw(final BoundingBox boundingBox, final byte zoomLevel, final Canvas canvas, final Point topLeftPoint) {<NEW_LINE>if (coordinates == null) {<NEW_LINE>return;<NEW_LINE>}<NEW_LINE>// prepare accuracy circle<NEW_LINE>final float accuracy = coordinates.getAccuracy();<NEW_LINE>if (accuracyCircle == null) {<NEW_LINE>accuracyCircle = AndroidGraphicFactory.INSTANCE.createPaint();<NEW_LINE>accuracyCircle.setStyle(Style.STROKE);<NEW_LINE>accuracyCircle.setStrokeWidth(1.0f);<NEW_LINE>accuracyCircle.setColor(MapLineUtils.getAccuracyCircleColor());<NEW_LINE>accuracyCircleFill = AndroidGraphicFactory.INSTANCE.createPaint();<NEW_LINE>accuracyCircleFill.setStyle(Style.FILL);<NEW_LINE>accuracyCircleFill.setColor(MapLineUtils.getAccuracyCircleFillColor());<NEW_LINE>}<NEW_LINE>if (accuracy >= 0) {<NEW_LINE>final Circle circle = new Circle(location, accuracy, accuracyCircleFill, accuracyCircle);<NEW_LINE>circle.setDisplayModel(this.getDisplayModel());<NEW_LINE>circle.draw(boundingBox, zoomLevel, canvas, topLeftPoint);<NEW_LINE>}<NEW_LINE>// prepare heading indicator<NEW_LINE>final long mapSize = MercatorProjection.getMapSize(zoomLevel, this.displayModel.getTileSize());<NEW_LINE>final double pixelX = MercatorProjection.longitudeToPixelX(this.location.longitude, mapSize);<NEW_LINE>final double pixelY = MercatorProjection.latitudeToPixelY(this.location.latitude, mapSize);<NEW_LINE>final int centerX = (int) (pixelX - topLeftPoint.x);<NEW_LINE>final int centerY = (int) (pixelY - topLeftPoint.y);<NEW_LINE>if (arrow == null) {<NEW_LINE>arrowNative = BitmapFactory.decodeResource(CgeoApplication.getInstance().getResources(), R.drawable.my_location_chevron);<NEW_LINE>rotateArrow();<NEW_LINE>}<NEW_LINE>final int left = centerX - widthArrowHalf;<NEW_LINE>final int top = centerY - heightArrowHalf;<NEW_LINE>final int right = left + this.arrow.getWidth();<NEW_LINE>final int bottom = top + this.arrow.getHeight();<NEW_LINE>final Rectangle bitmapRectangle = new Rectangle(left, top, right, bottom);<NEW_LINE>final Rectangle canvasRectangle = new Rectangle(0, 0, canvas.getWidth(), canvas.getHeight());<NEW_LINE>if (!canvasRectangle.intersects(bitmapRectangle)) {<NEW_LINE>return;<NEW_LINE>}<NEW_LINE>canvas.<MASK><NEW_LINE>} | drawBitmap(arrow, left, top); |
1,511,886 | protected RelDataType deriveRowType() {<NEW_LINE>final RelDataTypeFactory typeFactory = getCluster().getTypeFactory();<NEW_LINE>List<RelDataTypeFieldImpl> columns = new LinkedList<>();<NEW_LINE>columns.add(new RelDataTypeFieldImpl("NO.", 0, typeFactory.createSqlType(SqlTypeName.BIGINT)));<NEW_LINE>columns.add(new RelDataTypeFieldImpl("TRIGGER_NAME", 1, typeFactory.createSqlType(SqlTypeName.VARCHAR)));<NEW_LINE>columns.add(new RelDataTypeFieldImpl("CCL_RULE_COUNT", 2, typeFactory.createSqlType(SqlTypeName.BIGINT)));<NEW_LINE>columns.add(new RelDataTypeFieldImpl("DATABASE", 3, typeFactory.createSqlType(SqlTypeName.VARCHAR)));<NEW_LINE>columns.add(new RelDataTypeFieldImpl("CONDITIONS", 4, typeFactory.createSqlType(SqlTypeName.VARCHAR)));<NEW_LINE>columns.add(new RelDataTypeFieldImpl("RULE_CONFIG", 5, typeFactory.createSqlType(SqlTypeName.VARCHAR)));<NEW_LINE>columns.add(new RelDataTypeFieldImpl("QUERY_RULE_UPGRADE", 6, typeFactory.<MASK><NEW_LINE>columns.add(new RelDataTypeFieldImpl("MAX_CCL_RULE", 7, typeFactory.createSqlType(SqlTypeName.BIGINT)));<NEW_LINE>columns.add(new RelDataTypeFieldImpl("MAX_SQL_SIZE", 8, typeFactory.createSqlType(SqlTypeName.BIGINT)));<NEW_LINE>columns.add(new RelDataTypeFieldImpl("CREATED_TIME", 9, typeFactory.createSqlType(SqlTypeName.DATETIME)));<NEW_LINE>return typeFactory.createStructType(columns);<NEW_LINE>} | createSqlType(SqlTypeName.BIGINT))); |
60,387 | public void deleteByIdWithResponse(String id, Context context) {<NEW_LINE>String deviceName = Utils.getValueFromIdByName(id, "dataBoxEdgeDevices");<NEW_LINE>if (deviceName == null) {<NEW_LINE>throw logger.logExceptionAsError(new IllegalArgumentException(String.format("The resource ID '%s' is not valid. Missing path segment 'dataBoxEdgeDevices'.", id)));<NEW_LINE>}<NEW_LINE>String storageAccountName = <MASK><NEW_LINE>if (storageAccountName == null) {<NEW_LINE>throw logger.logExceptionAsError(new IllegalArgumentException(String.format("The resource ID '%s' is not valid. Missing path segment 'storageAccounts'.", id)));<NEW_LINE>}<NEW_LINE>String resourceGroupName = Utils.getValueFromIdByName(id, "resourceGroups");<NEW_LINE>if (resourceGroupName == null) {<NEW_LINE>throw logger.logExceptionAsError(new IllegalArgumentException(String.format("The resource ID '%s' is not valid. Missing path segment 'resourceGroups'.", id)));<NEW_LINE>}<NEW_LINE>this.delete(deviceName, storageAccountName, resourceGroupName, context);<NEW_LINE>} | Utils.getValueFromIdByName(id, "storageAccounts"); |
393,131 | public ServletContainer start(TreeLogger logger, int port, File appRootDir) throws Exception {<NEW_LINE>TreeLogger branch = logger.branch(TreeLogger.TRACE, "Starting Jetty on port " + port, null);<NEW_LINE>checkStartParams(branch, port, appRootDir);<NEW_LINE>// Setup our branch logger during startup.<NEW_LINE>Log.<MASK><NEW_LINE>// Force load some JRE singletons that can pin the classloader.<NEW_LINE>jreLeakPrevention(logger);<NEW_LINE>// Turn off XML validation.<NEW_LINE>System.setProperty("org.eclipse.jetty.xml.XmlParser.Validating", "false");<NEW_LINE>Server server = new Server();<NEW_LINE>ServerConnector connector = getConnector(server, logger);<NEW_LINE>setupConnector(connector, bindAddress, port);<NEW_LINE>server.addConnector(connector);<NEW_LINE>Configuration.ClassList cl = Configuration.ClassList.setServerDefault(server);<NEW_LINE>try {<NEW_LINE>// from jetty-plus.xml<NEW_LINE>Thread.currentThread().getContextClassLoader().loadClass("org.eclipse.jetty.plus.webapp.PlusConfiguration");<NEW_LINE>cl.addAfter("org.eclipse.jetty.webapp.FragmentConfiguration", "org.eclipse.jetty.plus.webapp.EnvConfiguration", "org.eclipse.jetty.plus.webapp.PlusConfiguration");<NEW_LINE>} catch (ClassNotFoundException cnfe) {<NEW_LINE>logger.log(TreeLogger.Type.DEBUG, "jetty-plus isn't on the classpath, JNDI won't work. This might also affect annotations scanning and JSP.");<NEW_LINE>}<NEW_LINE>try {<NEW_LINE>// from jetty-annotations.xml<NEW_LINE>Thread.currentThread().getContextClassLoader().loadClass("org.eclipse.jetty.annotations.AnnotationConfiguration");<NEW_LINE>cl.addBefore("org.eclipse.jetty.webapp.JettyWebXmlConfiguration", "org.eclipse.jetty.annotations.AnnotationConfiguration");<NEW_LINE>} catch (ClassNotFoundException cnfe) {<NEW_LINE>logger.log(TreeLogger.Type.DEBUG, "jetty-annotations isn't on the classpath, annotation scanning won't work. This might also affect annotations scanning.");<NEW_LINE>}<NEW_LINE>// Create a new web app in the war directory.<NEW_LINE>WebAppContext wac = createWebAppContext(logger, appRootDir);<NEW_LINE>RequestLogHandler logHandler = new RequestLogHandler();<NEW_LINE>logHandler.setRequestLog(new JettyRequestLogger(logger, getBaseLogLevel()));<NEW_LINE>logHandler.setHandler(wac);<NEW_LINE>server.setHandler(logHandler);<NEW_LINE>server.start();<NEW_LINE>server.setStopAtShutdown(true);<NEW_LINE>// Now that we're started, log to the top level logger.<NEW_LINE>Log.setLog(new JettyTreeLogger(logger));<NEW_LINE>// DevMode#doStartUpServer() fails from time to time (rarely) due<NEW_LINE>// to an unknown error. Adding some logging to pinpoint the problem.<NEW_LINE>int connectorPort = connector.getLocalPort();<NEW_LINE>if (connector.getLocalPort() < 0) {<NEW_LINE>branch.log(TreeLogger.ERROR, String.format("Failed to connect to open channel with port %d (return value %d)", port, connectorPort));<NEW_LINE>}<NEW_LINE>return createServletContainer(logger, appRootDir, server, wac, connectorPort);<NEW_LINE>} | setLog(new JettyTreeLogger(branch)); |
1,065,460 | protected CompoundTag translateExplosionToBedrock(CompoundTag explosion, String newName) {<NEW_LINE>CompoundTag newExplosionData = new CompoundTag(newName);<NEW_LINE>if (explosion.get("Type") != null) {<NEW_LINE>newExplosionData.put(new ByteTag("FireworkType", MathUtils.getNbtByte(explosion.get("Type").getValue())));<NEW_LINE>}<NEW_LINE>if (explosion.get("Colors") != null) {<NEW_LINE>int[] oldColors = (int[]) explosion.get("Colors").getValue();<NEW_LINE>byte[] colors = new byte[oldColors.length];<NEW_LINE>int i = 0;<NEW_LINE>for (int color : oldColors) {<NEW_LINE>colors[i++] = FireworkColor.fromJavaRGB(color);<NEW_LINE>}<NEW_LINE>newExplosionData.put(new ByteArrayTag("FireworkColor", colors));<NEW_LINE>}<NEW_LINE>if (explosion.get("FadeColors") != null) {<NEW_LINE>int[] oldColors = (int[]) explosion.get("FadeColors").getValue();<NEW_LINE>byte[] colors = new byte[oldColors.length];<NEW_LINE>int i = 0;<NEW_LINE>for (int color : oldColors) {<NEW_LINE>colors[i++<MASK><NEW_LINE>}<NEW_LINE>newExplosionData.put(new ByteArrayTag("FireworkFade", colors));<NEW_LINE>}<NEW_LINE>if (explosion.get("Trail") != null) {<NEW_LINE>newExplosionData.put(new ByteTag("FireworkTrail", MathUtils.getNbtByte(explosion.get("Trail").getValue())));<NEW_LINE>}<NEW_LINE>if (explosion.get("Flicker") != null) {<NEW_LINE>newExplosionData.put(new ByteTag("FireworkFlicker", MathUtils.getNbtByte(explosion.get("Flicker").getValue())));<NEW_LINE>}<NEW_LINE>return newExplosionData;<NEW_LINE>} | ] = FireworkColor.fromJavaRGB(color); |
603,335 | public void annotate(@NotNull PsiElement o, @NotNull AnnotationHolder holder) {<NEW_LINE>if (!o.isValid())<NEW_LINE>return;<NEW_LINE>if (o instanceof GoImportSpec && ((GoImportSpec) o).isDot()) {<NEW_LINE>// noinspection SynchronizationOnLocalVariableOrMethodParameter<NEW_LINE>synchronized (o) {<NEW_LINE>List<PsiElement> importUsers = o.getUserData(GoReferenceBase.IMPORT_USERS);<NEW_LINE>if (importUsers != null) {<NEW_LINE>List<PsiElement> newImportUsers = ContainerUtil.newSmartList();<NEW_LINE>newImportUsers.addAll(importUsers.stream().filter(PsiElement::isValid).collect(Collectors.toList()));<NEW_LINE>o.putUserData(GoReferenceBase.IMPORT_USERS, newImportUsers.isEmpty() ? null : newImportUsers);<NEW_LINE>}<NEW_LINE>}<NEW_LINE>} else if (o instanceof GoLiteral) {<NEW_LINE>if (((GoLiteral) o).getHex() != null || ((GoLiteral) o).getOct() != null) {<NEW_LINE>setHighlighting(o, holder, NUMBER);<NEW_LINE>}<NEW_LINE>} else if (o instanceof GoReferenceExpressionBase) {<NEW_LINE>PsiReference reference = o.getReference();<NEW_LINE>highlightRefIfNeeded((GoReferenceExpressionBase) o, reference != null ? reference.resolve() : null, holder);<NEW_LINE>} else if (o instanceof GoTypeSpec) {<NEW_LINE>TextAttributesKey key = getColor((GoTypeSpec) o);<NEW_LINE>setHighlighting(((GoTypeSpec) o).getIdentifier(), holder, key);<NEW_LINE>} else if (o instanceof GoConstDefinition) {<NEW_LINE>setHighlighting(o, holder, getColor((GoConstDefinition) o));<NEW_LINE>} else if (o instanceof GoVarDefinition) {<NEW_LINE>setHighlighting(o, holder, getColor((GoVarDefinition) o));<NEW_LINE>} else if (o instanceof GoFieldDefinition) {<NEW_LINE>setHighlighting(o, holder, <MASK><NEW_LINE>} else if (o instanceof GoParamDefinition) {<NEW_LINE>setHighlighting(o, holder, FUNCTION_PARAMETER);<NEW_LINE>} else if (o instanceof GoReceiver) {<NEW_LINE>PsiElement identifier = ((GoReceiver) o).getIdentifier();<NEW_LINE>if (identifier != null) {<NEW_LINE>setHighlighting(identifier, holder, METHOD_RECEIVER);<NEW_LINE>}<NEW_LINE>} else if (o instanceof GoLabelDefinition || o instanceof GoLabelRef) {<NEW_LINE>setHighlighting(o, holder, LABEL);<NEW_LINE>} else if (o instanceof GoNamedSignatureOwner) {<NEW_LINE>PsiElement identifier = ((GoNamedSignatureOwner) o).getIdentifier();<NEW_LINE>if (identifier != null) {<NEW_LINE>setHighlighting(identifier, holder, getColor((GoNamedSignatureOwner) o));<NEW_LINE>}<NEW_LINE>}<NEW_LINE>} | getColor((GoFieldDefinition) o)); |
1,855,259 | public static void initialize() {<NEW_LINE>// Update JavaCore options<NEW_LINE>initializeJavaCoreOptions();<NEW_LINE>// Initialize default preferences<NEW_LINE>IEclipsePreferences defEclipsePrefs = DefaultScope.INSTANCE.getNode(IConstants.PLUGIN_ID);<NEW_LINE>defEclipsePrefs.put("org.eclipse.jdt.ui.typefilter.enabled", "");<NEW_LINE>defEclipsePrefs.put(CodeStyleConfiguration.ORGIMPORTS_IMPORTORDER, String.join(";", Preferences.JAVA_IMPORT_ORDER_DEFAULT));<NEW_LINE>// $NON-NLS-1$<NEW_LINE>defEclipsePrefs.put(MembersOrderPreferenceCacheCommon.APPEARANCE_MEMBER_SORT_ORDER, "T,SF,SI,SM,F,I,C,M");<NEW_LINE>defEclipsePrefs.put(CodeGenerationSettingsConstants.CODEGEN_USE_OVERRIDE_ANNOTATION, Boolean.TRUE.toString());<NEW_LINE>defEclipsePrefs.put(StubUtility.CODEGEN_KEYWORD_THIS, Boolean.FALSE.toString());<NEW_LINE>defEclipsePrefs.put(StubUtility.CODEGEN_IS_FOR_GETTERS, Boolean.TRUE.toString());<NEW_LINE>// $NON-NLS-1$<NEW_LINE>defEclipsePrefs.put(StubUtility.CODEGEN_EXCEPTION_VAR_NAME, "e");<NEW_LINE>defEclipsePrefs.put(StubUtility.CODEGEN_ADD_COMMENTS, Boolean.FALSE.toString());<NEW_LINE>ContextTypeRegistry registry = new ContextTypeRegistry();<NEW_LINE>// Register standard context types from JDT<NEW_LINE>CodeTemplateContextType.registerContextTypes(registry);<NEW_LINE>// Register additional context types<NEW_LINE>registry.addContextType(new CodeTemplateContextType(CodeTemplatePreferences.CLASSSNIPPET_CONTEXTTYPE));<NEW_LINE>registry.addContextType(new CodeTemplateContextType(CodeTemplatePreferences.INTERFACESNIPPET_CONTEXTTYPE));<NEW_LINE>registry.addContextType(new CodeTemplateContextType(CodeTemplatePreferences.RECORDSNIPPET_CONTEXTTYPE));<NEW_LINE>// These should be upstreamed into CodeTemplateContextType & GlobalVariables<NEW_LINE>TemplateContextType tmp = registry.getContextType(CodeTemplateContextType.TYPECOMMENT_CONTEXTTYPE);<NEW_LINE>tmp.addResolver(new CodeTemplatePreferences.Month());<NEW_LINE>tmp.addResolver<MASK><NEW_LINE>tmp.addResolver(new CodeTemplatePreferences.Day());<NEW_LINE>tmp.addResolver(new CodeTemplatePreferences.Hour());<NEW_LINE>tmp.addResolver(new CodeTemplatePreferences.Minute());<NEW_LINE>JavaManipulation.setCodeTemplateContextRegistry(registry);<NEW_LINE>// Initialize templates<NEW_LINE>templates.put(CodeTemplatePreferences.CODETEMPLATE_FIELDCOMMENT, CodeGenerationTemplate.FIELDCOMMENT.createTemplate());<NEW_LINE>templates.put(CodeTemplatePreferences.CODETEMPLATE_METHODCOMMENT, CodeGenerationTemplate.METHODCOMMENT.createTemplate());<NEW_LINE>templates.put(CodeTemplatePreferences.CODETEMPLATE_CONSTRUCTORCOMMENT, CodeGenerationTemplate.CONSTRUCTORCOMMENT.createTemplate());<NEW_LINE>templates.put(CodeTemplatePreferences.CODETEMPLATE_CONSTRUCTORBODY, CodeGenerationTemplate.CONSTRUCTORBODY.createTemplate());<NEW_LINE>templates.put(CodeTemplatePreferences.CODETEMPLATE_DELEGATECOMMENT, CodeGenerationTemplate.DELEGATECOMMENT.createTemplate());<NEW_LINE>templates.put(CodeTemplatePreferences.CODETEMPLATE_OVERRIDECOMMENT, CodeGenerationTemplate.OVERRIDECOMMENT.createTemplate());<NEW_LINE>templates.put(CodeTemplatePreferences.CODETEMPLATE_TYPECOMMENT, CodeGenerationTemplate.TYPECOMMENT.createTemplate());<NEW_LINE>templates.put(CodeTemplatePreferences.CODETEMPLATE_GETTERCOMMENT, CodeGenerationTemplate.GETTERCOMMENT.createTemplate());<NEW_LINE>templates.put(CodeTemplatePreferences.CODETEMPLATE_SETTERCOMMENT, CodeGenerationTemplate.SETTERCOMMENT.createTemplate());<NEW_LINE>templates.put(CodeTemplatePreferences.CODETEMPLATE_GETTERBODY, CodeGenerationTemplate.GETTERBODY.createTemplate());<NEW_LINE>templates.put(CodeTemplatePreferences.CODETEMPLATE_SETTERBODY, CodeGenerationTemplate.SETTERBOY.createTemplate());<NEW_LINE>templates.put(CodeTemplatePreferences.CODETEMPLATE_CATCHBODY, CodeGenerationTemplate.CATCHBODY.createTemplate());<NEW_LINE>templates.put(CodeTemplatePreferences.CODETEMPLATE_METHODBODY, CodeGenerationTemplate.METHODBODY.createTemplate());<NEW_LINE>reloadTemplateStore();<NEW_LINE>} | (new CodeTemplatePreferences.ShortMonth()); |
317,586 | public IBaseResource readOperationDefinition(@IdParam IIdType theId, RequestDetails theRequestDetails) {<NEW_LINE>if (theId == null || theId.hasIdPart() == false) {<NEW_LINE>throw new ResourceNotFoundException(Msg.code(1977) + theId);<NEW_LINE>}<NEW_LINE>RestfulServerConfiguration configuration = getServerConfiguration();<NEW_LINE>Bindings bindings = configuration.provideBindings();<NEW_LINE>List<OperationMethodBinding> operationBindings = bindings.getOperationIdToBindings().get(theId.getIdPart());<NEW_LINE>if (operationBindings != null && !operationBindings.isEmpty()) {<NEW_LINE>return readOperationDefinitionForOperation(theRequestDetails, bindings, operationBindings);<NEW_LINE>}<NEW_LINE>List<SearchMethodBinding> searchBindings = bindings.getSearchNameToBindings().<MASK><NEW_LINE>if (searchBindings != null && !searchBindings.isEmpty()) {<NEW_LINE>return readOperationDefinitionForNamedSearch(searchBindings);<NEW_LINE>}<NEW_LINE>throw new ResourceNotFoundException(Msg.code(1978) + theId);<NEW_LINE>} | get(theId.getIdPart()); |
1,049,531 | private void initLucene() throws Exception {<NEW_LINE>ConfigDao configDao = new ConfigDao();<NEW_LINE>Config luceneStorageConfig = <MASK><NEW_LINE>String luceneStorage = luceneStorageConfig == null ? null : luceneStorageConfig.getValue();<NEW_LINE>// RAM directory storage by default<NEW_LINE>if (luceneStorage == null || luceneStorage.equals("RAM")) {<NEW_LINE>directory = new RAMDirectory();<NEW_LINE>log.info("Using RAM Lucene storage");<NEW_LINE>} else if (luceneStorage.equals("FILE")) {<NEW_LINE>Path luceneDirectory = DirectoryUtil.getLuceneDirectory();<NEW_LINE>log.info("Using file Lucene storage: {}", luceneDirectory);<NEW_LINE>directory = new NIOFSDirectory(luceneDirectory, NoLockFactory.INSTANCE);<NEW_LINE>}<NEW_LINE>// Create an index writer<NEW_LINE>IndexWriterConfig config = new IndexWriterConfig(new StandardAnalyzer());<NEW_LINE>config.setCommitOnClose(true);<NEW_LINE>config.setMergeScheduler(new ConcurrentMergeScheduler());<NEW_LINE>indexWriter = new IndexWriter(directory, config);<NEW_LINE>// Check index version and rebuild it if necessary<NEW_LINE>if (DirectoryReader.indexExists(directory)) {<NEW_LINE>log.info("Checking index health and version");<NEW_LINE>try (CheckIndex checkIndex = new CheckIndex(directory)) {<NEW_LINE>CheckIndex.Status status = checkIndex.checkIndex();<NEW_LINE>if (!status.clean) {<NEW_LINE>throw new Exception("Index is dirty");<NEW_LINE>}<NEW_LINE>}<NEW_LINE>}<NEW_LINE>} | configDao.getById(ConfigType.LUCENE_DIRECTORY_STORAGE); |
813,321 | protected Container createStartContentPane() {<NEW_LINE>JPanel pane = new JPanel(new BorderLayout());<NEW_LINE>menuBar = new JMenuBar();<NEW_LINE>pane.add(menuBar, BorderLayout.NORTH);<NEW_LINE>Locale loc = Locale.getDefault();<NEW_LINE>JMenu menu = new JMenu(messages.getMainMessage("mainMenu.file", loc));<NEW_LINE>menuBar.add(menu);<NEW_LINE>JMenuItem item;<NEW_LINE>item = new JMenuItem(messages<MASK><NEW_LINE>item.addActionListener(e -> showLoginDialog());<NEW_LINE>menu.add(item);<NEW_LINE>item = new JMenuItem(messages.getMainMessage("mainMenu.exit", loc));<NEW_LINE>item.addActionListener(new ValidationAwareActionListener() {<NEW_LINE><NEW_LINE>@Override<NEW_LINE>public void actionPerformedAfterValidation(ActionEvent e) {<NEW_LINE>exit();<NEW_LINE>}<NEW_LINE>});<NEW_LINE>menu.add(item);<NEW_LINE>if (isTestMode()) {<NEW_LINE>menuBar.setName("startMenu");<NEW_LINE>}<NEW_LINE>return pane;<NEW_LINE>} | .getMainMessage("mainMenu.connect", loc)); |
315,888 | public void exec() throws IOException {<NEW_LINE>final Collection<Tojo> tojos = this.scopedTojos().select(row -> row.exists(AssembleMojo.ATTR_EO));<NEW_LINE>int total = 0;<NEW_LINE>for (final Tojo tojo : tojos) {<NEW_LINE>if (tojo.exists(AssembleMojo.ATTR_XMIR)) {<NEW_LINE>final Path xmir = Paths.get(tojo.get(AssembleMojo.ATTR_XMIR));<NEW_LINE>final Path src = Paths.get(tojo<MASK><NEW_LINE>if (xmir.toFile().lastModified() >= src.toFile().lastModified()) {<NEW_LINE>Logger.debug(this, "Already parsed %s to %s (it's newer than the source)", tojo.get("id"), Save.rel(xmir));<NEW_LINE>continue;<NEW_LINE>}<NEW_LINE>}<NEW_LINE>this.parse(tojo);<NEW_LINE>++total;<NEW_LINE>}<NEW_LINE>Logger.info(this, "Parsed %d .EO sources to XMIRs", total);<NEW_LINE>} | .get(AssembleMojo.ATTR_EO)); |
216,427 | private Proxy loadProxy() throws OperationFailedException {<NEW_LINE>final ConfigurationService configSvc = IrcActivator.getConfigurationService();<NEW_LINE>if (configSvc == null) {<NEW_LINE>return null;<NEW_LINE>}<NEW_LINE>final String globalProxyType = configSvc.getString(ProxyInfo.CONNECTION_PROXY_TYPE_PROPERTY_NAME);<NEW_LINE>if (globalProxyType == null || (!globalProxyType.equals(ProxyInfo.ProxyType.SOCKS4.name()) && !globalProxyType.equals(ProxyInfo.ProxyType.SOCKS5.name()))) {<NEW_LINE>// Only SOCKS proxy is supported. The appropriate proxy type is not<NEW_LINE>// configured, so we're done.<NEW_LINE>return null;<NEW_LINE>}<NEW_LINE>final String globalProxyAddress = configSvc.getString(ProxyInfo.CONNECTION_PROXY_ADDRESS_PROPERTY_NAME);<NEW_LINE>final String globalProxyPortStr = configSvc.getString(ProxyInfo.CONNECTION_PROXY_PORT_PROPERTY_NAME);<NEW_LINE>final int globalProxyPort;<NEW_LINE>try {<NEW_LINE>globalProxyPort = Integer.parseInt(globalProxyPortStr);<NEW_LINE>} catch (NumberFormatException e) {<NEW_LINE>throw new OperationFailedException("invalid proxy port", OperationFailedException.INVALID_ACCOUNT_PROPERTIES, e);<NEW_LINE>}<NEW_LINE>return new Proxy(Proxy.Type.SOCKS, <MASK><NEW_LINE>} | new InetSocketAddress(globalProxyAddress, globalProxyPort)); |
1,208,389 | private // ==================================================================================================<NEW_LINE>void runDecompilerAnalysis(Program program, AddressSetView functionEntries, TaskMonitor monitor) throws InterruptedException, Exception {<NEW_LINE>CachingPool<DecompInterface> decompilerPool = new CachingPool<>(new DecompilerFactory(program));<NEW_LINE>QRunnable<Address> callback = new ParallelDecompilerCallback(decompilerPool, program);<NEW_LINE>ConcurrentGraphQ<Address> queue = null;<NEW_LINE>monitor.initialize(functionEntries.getNumAddresses());<NEW_LINE>try {<NEW_LINE><MASK><NEW_LINE>AcyclicCallGraphBuilder builder = new AcyclicCallGraphBuilder(program, functionEntries, true);<NEW_LINE>AbstractDependencyGraph<Address> graph = builder.getDependencyGraph(monitor);<NEW_LINE>if (graph.isEmpty()) {<NEW_LINE>return;<NEW_LINE>}<NEW_LINE>GThreadPool pool = AutoAnalysisManager.getSharedAnalsysThreadPool();<NEW_LINE>queue = new ConcurrentGraphQ<>(callback, graph, pool, monitor);<NEW_LINE>monitor.setMessage(NAME + " - analyzing call conventions...");<NEW_LINE>monitor.initialize(graph.size());<NEW_LINE>queue.execute();<NEW_LINE>} finally {<NEW_LINE>if (queue != null) {<NEW_LINE>queue.dispose();<NEW_LINE>}<NEW_LINE>decompilerPool.dispose();<NEW_LINE>}<NEW_LINE>} | monitor.setMessage(NAME + " - creating dependency graph..."); |
829,367 | public Problem prepare(final RefactoringElementsBag refactoringElementsBag) {<NEW_LINE>final TreePathHandle handle = getHandle();<NEW_LINE>if (handle == null) {<NEW_LINE>return null;<NEW_LINE>}<NEW_LINE>final FileObject file = handle.getFileObject();<NEW_LINE>if (file == null) {<NEW_LINE>return null;<NEW_LINE>}<NEW_LINE>JavaSource jsource = JavaSource.create(ELTypeUtilities.getElimplExtendedCPI(file));<NEW_LINE>if (jsource == null) {<NEW_LINE>return null;<NEW_LINE>}<NEW_LINE>final AtomicReference<Problem> problemRef = new AtomicReference<>();<NEW_LINE>try {<NEW_LINE>jsource.runUserActionTask(new Task<CompilationController>() {<NEW_LINE><NEW_LINE>@Override<NEW_LINE>public void run(CompilationController info) throws Exception {<NEW_LINE>info.<MASK><NEW_LINE>CompilationContext ccontext = CompilationContext.create(file, info);<NEW_LINE>Element element = handle.resolveElement(info);<NEW_LINE>if (element == null) {<NEW_LINE>// NOI18N<NEW_LINE>LOGGER.log(Level.INFO, "Could not resolve Element for TPH: {0}", handle);<NEW_LINE>return;<NEW_LINE>}<NEW_LINE>if ((Kind.METHOD == handle.getKind() || Kind.MEMBER_SELECT == handle.getKind()) && element instanceof ExecutableElement) {<NEW_LINE>problemRef.set(handleProperty(ccontext, refactoringElementsBag, handle, (ExecutableElement) element));<NEW_LINE>}<NEW_LINE>if (TreeUtilities.CLASS_TREE_KINDS.contains(handle.getKind())) {<NEW_LINE>problemRef.set(handleClass(ccontext, refactoringElementsBag, handle, element));<NEW_LINE>}<NEW_LINE>}<NEW_LINE>}, true);<NEW_LINE>} catch (IOException ex) {<NEW_LINE>Exceptions.printStackTrace(ex);<NEW_LINE>}<NEW_LINE>return problemRef.get();<NEW_LINE>} | toPhase(JavaSource.Phase.RESOLVED); |
1,246,641 | public Storage.ReadSession create(TableId table, ImmutableList<String> selectedFields, Optional<String> filter, int parallelism) {<NEW_LINE>TableInfo tableDetails = bigQueryClient.getTable(table);<NEW_LINE>TableInfo actualTable = getActualTable(tableDetails, selectedFields, new String[] {});<NEW_LINE>try (BigQueryStorageClient bigQueryStorageClient = bigQueryStorageClientFactory.createBigQueryStorageClient()) {<NEW_LINE>ReadOptions.TableReadOptions.Builder readOptions = ReadOptions.TableReadOptions.newBuilder().addAllSelectedFields(selectedFields);<NEW_LINE><MASK><NEW_LINE>TableReferenceProto.TableReference tableReference = toTableReference(actualTable.getTableId());<NEW_LINE>Storage.ReadSession readSession = bigQueryStorageClient.createReadSession(// The BALANCED sharding strategy causes the server to<NEW_LINE>Storage.CreateReadSessionRequest.newBuilder().setParent("projects/" + bigQueryClient.getProjectId()).setFormat(Storage.DataFormat.AVRO).setRequestedStreams(parallelism).setReadOptions(readOptions).setTableReference(tableReference).// assign roughly the same number of rows to each stream.<NEW_LINE>setShardingStrategy(Storage.ShardingStrategy.BALANCED).build());<NEW_LINE>return readSession;<NEW_LINE>}<NEW_LINE>} | filter.ifPresent(readOptions::setRowRestriction); |
252,819 | private final void fireModelChange0(@NonNull final PO po, @NonNull final ModelChangeType changeType, @Nullable List<ModelValidator> interceptorsSystem, @Nullable List<ModelValidator> interceptorsClient, @Nullable List<I_AD_Table_ScriptValidator> scriptValidators) {<NEW_LINE>if (interceptorsSystem != null) {<NEW_LINE>// ad_entitytype.modelvalidationclasses<NEW_LINE>invokeModelChangeMethods(po, changeType, interceptorsSystem);<NEW_LINE>}<NEW_LINE>if (interceptorsClient != null) {<NEW_LINE>// ad_client.modelvalidationclasses<NEW_LINE>invokeModelChangeMethods(po, changeType, interceptorsClient);<NEW_LINE>}<NEW_LINE>//<NEW_LINE>// now process the script model validator for this event<NEW_LINE>// metas: tsa: 02380: First check if changeType is available in tableEventValidators<NEW_LINE>// FIXME: refactor it and have it as a regular model validator; then remove it from here<NEW_LINE>{<NEW_LINE>fireModelChangeForScriptValidators(po, <MASK><NEW_LINE>}<NEW_LINE>} | X_AD_Rule.EVENTTYPE_ModelValidatorTableEvent, changeType, scriptValidators); |
508,165 | private static void importTfOnnxSameDiff(OnnxFrameworkImporter onnxFrameworkImporter, TensorflowFrameworkImporter tensorflowFrameworkImporter, Framework framework, File inputFile, String inputFileNameMinusFormat, String format, File saveModelDir) throws IOException {<NEW_LINE>SameDiff sameDiff = null;<NEW_LINE>switch(framework) {<NEW_LINE>case ONNX:<NEW_LINE>case PYTORCH:<NEW_LINE>// filter out invalid files<NEW_LINE>if (format.equals("onnx"))<NEW_LINE>sameDiff = onnxFrameworkImporter.runImport(inputFile.getAbsolutePath(), <MASK><NEW_LINE>break;<NEW_LINE>case TENSORFLOW:<NEW_LINE>if (format.equals("pb"))<NEW_LINE>sameDiff = tensorflowFrameworkImporter.runImport(inputFile.getAbsolutePath(), Collections.emptyMap(), true);<NEW_LINE>break;<NEW_LINE>}<NEW_LINE>// reuse the same model name but with the samediff format<NEW_LINE>File saveModel = new File(saveModelDir, inputFileNameMinusFormat + ".fb");<NEW_LINE>if (sameDiff != null)<NEW_LINE>sameDiff.asFlatFile(saveModel, true);<NEW_LINE>else {<NEW_LINE>System.err.println("Skipping model " + inputFile.getAbsolutePath());<NEW_LINE>}<NEW_LINE>} | Collections.emptyMap(), true); |
1,604,898 | public final ET compile(final ExpressionContext context, final String expressionStr) {<NEW_LINE>// Check if it's an empty expression<NEW_LINE>// NOTE: we are preserving all whitespaces from expressions, so that's why we are not trimming the string<NEW_LINE>if (expressionStr == null || expressionStr.isEmpty()) {<NEW_LINE>return getNullExpression();<NEW_LINE>}<NEW_LINE>String inStr = expressionStr;<NEW_LINE>int i = inStr.indexOf(PARAMETER_TAG);<NEW_LINE>if (i < 0) {<NEW_LINE>return createConstantExpression(context, expressionStr);<NEW_LINE>}<NEW_LINE>final List<Object> chunks = new ArrayList<>();<NEW_LINE>while (i != -1) {<NEW_LINE>// up to first parameter marker<NEW_LINE>if (i > 0) {<NEW_LINE>final String chunk = <MASK><NEW_LINE>chunks.add(chunk);<NEW_LINE>} else {<NEW_LINE>// expression is starting with a parameter<NEW_LINE>// nothing to do here<NEW_LINE>}<NEW_LINE>// from first marker<NEW_LINE>inStr = inStr.substring(i + PARAMETER_TAG_LENGTH);<NEW_LINE>// next parameter marker<NEW_LINE>final int j = inStr.indexOf(PARAMETER_TAG);<NEW_LINE>if (j < 0) {<NEW_LINE>// no second tag<NEW_LINE>throw new ExpressionCompileException("Missing closing tag " + PARAMETER_TAG + " in currentSubstring").appendParametersToMessage().setParameter("currentSubstring", inStr).setParameter("expressionString", expressionStr);<NEW_LINE>} else if (j == 0) {<NEW_LINE>// Double marker (e.g. @@)<NEW_LINE>// => consider it's an escaped marker, so append "@" only<NEW_LINE>chunks.add(PARAMETER_TAG);<NEW_LINE>} else {<NEW_LINE>// Parameter<NEW_LINE>final String token = inStr.substring(0, j);<NEW_LINE>final CtxName parameter = CtxNames.parse(token);<NEW_LINE>chunks.add(parameter);<NEW_LINE>}<NEW_LINE>// from second @ to end<NEW_LINE>inStr = inStr.substring(j + PARAMETER_TAG_LENGTH);<NEW_LINE>i = inStr.indexOf(PARAMETER_TAG);<NEW_LINE>}<NEW_LINE>// Add the remaining chunk, if any<NEW_LINE>if (!inStr.isEmpty()) {<NEW_LINE>chunks.add(inStr);<NEW_LINE>}<NEW_LINE>//<NEW_LINE>// Case: if we are dealing with a string expression which actually it's one parameter binding, no strings before, no strings after<NEW_LINE>// then we have a specialized implementation for that<NEW_LINE>if (chunks.size() == 1 && chunks.get(0) instanceof CtxName) {<NEW_LINE>final CtxName parameter = (CtxName) chunks.get(0);<NEW_LINE>return createSingleParamaterExpression(context, expressionStr, parameter);<NEW_LINE>}<NEW_LINE>return createGeneralExpression(context, expressionStr, chunks);<NEW_LINE>} | inStr.substring(0, i); |
983,105 | public void run() {<NEW_LINE>WatchService watcher;<NEW_LINE>try {<NEW_LINE>watcher = FileSystems.getDefault().newWatchService();<NEW_LINE>Path srcDir = Paths.get("src/main/java/org/glassfish/jersey/examples/reload");<NEW_LINE>registerWatcher(watcher, srcDir);<NEW_LINE>Path configFilePath = Paths.get(".");<NEW_LINE>registerWatcher(watcher, configFilePath);<NEW_LINE>} catch (IOException e) {<NEW_LINE>e.printStackTrace();<NEW_LINE>throw new RuntimeException("Could not initialize watcher service!");<NEW_LINE>}<NEW_LINE>for (; ; ) {<NEW_LINE>try {<NEW_LINE>final WatchKey watchKey = watcher.take();<NEW_LINE>try {<NEW_LINE>for (WatchEvent<?> event : watchKey.pollEvents()) {<NEW_LINE>final WatchEvent.Kind<?> kind = event.kind();<NEW_LINE>if (kind == StandardWatchEventKinds.ENTRY_MODIFY) {<NEW_LINE>WatchEvent<Path> pathEvent = (WatchEvent<Path>) event;<NEW_LINE><MASK><NEW_LINE>System.out.printf("FILE MODIFIED: %s\n", modifiedFile);<NEW_LINE>}<NEW_LINE>}<NEW_LINE>} finally {<NEW_LINE>// so that consecutive events could be processed<NEW_LINE>watchKey.reset();<NEW_LINE>}<NEW_LINE>final File configFile = new File(CONFIG_FILENAME);<NEW_LINE>reloadApp(configFile);<NEW_LINE>} catch (InterruptedException e) {<NEW_LINE>Thread.currentThread().interrupt();<NEW_LINE>}<NEW_LINE>}<NEW_LINE>} | Path modifiedFile = pathEvent.context(); |
586,154 | public CreateProvisioningArtifactResult unmarshall(JsonUnmarshallerContext context) throws Exception {<NEW_LINE>CreateProvisioningArtifactResult createProvisioningArtifactResult = new CreateProvisioningArtifactResult();<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 createProvisioningArtifactResult;<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("ProvisioningArtifactDetail", targetDepth)) {<NEW_LINE>context.nextToken();<NEW_LINE>createProvisioningArtifactResult.setProvisioningArtifactDetail(ProvisioningArtifactDetailJsonUnmarshaller.getInstance().unmarshall(context));<NEW_LINE>}<NEW_LINE>if (context.testExpression("Info", targetDepth)) {<NEW_LINE>context.nextToken();<NEW_LINE>createProvisioningArtifactResult.setInfo(new MapUnmarshaller<String, String>(context.getUnmarshaller(String.class), context.getUnmarshaller(String.class)).unmarshall(context));<NEW_LINE>}<NEW_LINE>if (context.testExpression("Status", targetDepth)) {<NEW_LINE>context.nextToken();<NEW_LINE>createProvisioningArtifactResult.setStatus(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 createProvisioningArtifactResult;<NEW_LINE>} | int originalDepth = context.getCurrentDepth(); |
1,364,218 | public void handle(final HttpExchange t) throws IOException {<NEW_LINE>final String date = new Date().toString();<NEW_LINE>_sensors.get(_name).incrementAndGet();<NEW_LINE>Headers headers = t.getRequestHeaders();<NEW_LINE>Long delay = _delay;<NEW_LINE>if (headers.containsKey("delay")) {<NEW_LINE>List<String> headerValues = headers.get("delay");<NEW_LINE>delay = Long.parseLong<MASK><NEW_LINE>}<NEW_LINE>System.out.println(date + ": " + _serverName + " received a request for the context handler = " + _name);<NEW_LINE>_executorService.schedule(new Runnable() {<NEW_LINE><NEW_LINE>@Override<NEW_LINE>public void run() {<NEW_LINE>String response = "server " + _serverName;<NEW_LINE>try {<NEW_LINE>t.sendResponseHeaders(200, response.length());<NEW_LINE>OutputStream os = t.getResponseBody();<NEW_LINE>os.write(response.getBytes());<NEW_LINE>os.close();<NEW_LINE>} catch (IOException e) {<NEW_LINE>e.printStackTrace();<NEW_LINE>}<NEW_LINE>}<NEW_LINE>}, delay, TimeUnit.MILLISECONDS);<NEW_LINE>} | (headerValues.get(0)); |
1,695,914 | protected final Object _deserializeOther(JsonParser p, DeserializationContext ctxt, JsonToken t) throws IOException {<NEW_LINE>// and then others, generally requiring use of @JsonCreator<NEW_LINE>if (t != null) {<NEW_LINE>switch(t) {<NEW_LINE>case VALUE_STRING:<NEW_LINE>return deserializeFromString(p, ctxt);<NEW_LINE>case VALUE_NUMBER_INT:<NEW_LINE>return deserializeFromNumber(p, ctxt);<NEW_LINE>case VALUE_NUMBER_FLOAT:<NEW_LINE>return deserializeFromDouble(p, ctxt);<NEW_LINE>case VALUE_EMBEDDED_OBJECT:<NEW_LINE>return deserializeFromEmbedded(p, ctxt);<NEW_LINE>case VALUE_TRUE:<NEW_LINE>case VALUE_FALSE:<NEW_LINE>return deserializeFromBoolean(p, ctxt);<NEW_LINE>case VALUE_NULL:<NEW_LINE>return deserializeFromNull(p, ctxt);<NEW_LINE>case START_ARRAY:<NEW_LINE>// these only work if there's a (delegating) creator, or UNWRAP_SINGLE_ARRAY<NEW_LINE>return _deserializeFromArray(p, ctxt);<NEW_LINE>case FIELD_NAME:<NEW_LINE>case // added to resolve [JACKSON-319], possible related issues<NEW_LINE>END_OBJECT:<NEW_LINE>if (_vanillaProcessing) {<NEW_LINE>return <MASK><NEW_LINE>}<NEW_LINE>if (_objectIdReader != null) {<NEW_LINE>return deserializeWithObjectId(p, ctxt);<NEW_LINE>}<NEW_LINE>return deserializeFromObject(p, ctxt);<NEW_LINE>default:<NEW_LINE>}<NEW_LINE>}<NEW_LINE>return ctxt.handleUnexpectedToken(getValueType(ctxt), p);<NEW_LINE>} | vanillaDeserialize(p, ctxt, t); |
1,510,231 | public void stateUpdated(PinpointServer pinpointServer, SocketStateCode updatedStateCode) {<NEW_LINE>ManagedAgentLifeCycle managedAgentLifeCycle = ManagedAgentLifeCycle.getManagedAgentLifeCycleByStateCode(updatedStateCode);<NEW_LINE>if (managedAgentLifeCycle == STATE_NOT_MANAGED) {<NEW_LINE>return;<NEW_LINE>} else {<NEW_LINE>logger.info("stateUpdated(). pinpointServer:{}, updatedStateCode:{}", pinpointServer, updatedStateCode);<NEW_LINE>final long eventTimestamp = System.currentTimeMillis();<NEW_LINE>final Map<Object, Object> channelPropertiesMap = pinpointServer.getChannelProperties();<NEW_LINE>// nullable<NEW_LINE>final ChannelProperties <MASK><NEW_LINE>if (channelProperties == null) {<NEW_LINE>logger.debug("channelProperties is null {}", pinpointServer);<NEW_LINE>return;<NEW_LINE>}<NEW_LINE>final AgentProperty agentProperty = new AgentPropertyChannelAdaptor(channelProperties);<NEW_LINE>final AgentLifeCycleState agentLifeCycleState = managedAgentLifeCycle.getMappedState();<NEW_LINE>final long eventIdentifier = AgentLifeCycleAsyncTaskService.createEventIdentifier(channelProperties.getSocketId(), managedAgentLifeCycle.getEventCounter());<NEW_LINE>this.agentLifeCycleAsyncTaskService.handleLifeCycleEvent(agentProperty, eventTimestamp, agentLifeCycleState, eventIdentifier);<NEW_LINE>AgentEventType agentEventType = managedAgentLifeCycle.getMappedEvent();<NEW_LINE>this.agentEventAsyncTaskService.handleEvent(agentProperty, eventTimestamp, agentEventType);<NEW_LINE>}<NEW_LINE>} | channelProperties = channelPropertiesFactory.newChannelProperties(channelPropertiesMap); |
103,344 | final ListCertificatesByCAResult executeListCertificatesByCA(ListCertificatesByCARequest listCertificatesByCARequest) {<NEW_LINE>ExecutionContext executionContext = createExecutionContext(listCertificatesByCARequest);<NEW_LINE>AWSRequestMetrics awsRequestMetrics = executionContext.getAwsRequestMetrics();<NEW_LINE>awsRequestMetrics.startEvent(Field.ClientExecuteTime);<NEW_LINE>Request<ListCertificatesByCARequest> request = null;<NEW_LINE>Response<ListCertificatesByCAResult> response = null;<NEW_LINE>try {<NEW_LINE>awsRequestMetrics.startEvent(Field.RequestMarshallTime);<NEW_LINE>try {<NEW_LINE>request = new ListCertificatesByCARequestProtocolMarshaller(protocolFactory).marshall(super.beforeMarshalling(listCertificatesByCARequest));<NEW_LINE>// Binds the request metrics to the current request.<NEW_LINE>request.setAWSRequestMetrics(awsRequestMetrics);<NEW_LINE>request.addHandlerContext(HandlerContextKey.CLIENT_ENDPOINT, endpoint);<NEW_LINE>request.addHandlerContext(<MASK><NEW_LINE>request.addHandlerContext(HandlerContextKey.SIGNING_REGION, getSigningRegion());<NEW_LINE>request.addHandlerContext(HandlerContextKey.SERVICE_ID, "IoT");<NEW_LINE>request.addHandlerContext(HandlerContextKey.OPERATION_NAME, "ListCertificatesByCA");<NEW_LINE>request.addHandlerContext(HandlerContextKey.ADVANCED_CONFIG, advancedConfig);<NEW_LINE>} finally {<NEW_LINE>awsRequestMetrics.endEvent(Field.RequestMarshallTime);<NEW_LINE>}<NEW_LINE>HttpResponseHandler<AmazonWebServiceResponse<ListCertificatesByCAResult>> responseHandler = protocolFactory.createResponseHandler(new JsonOperationMetadata().withPayloadJson(true).withHasStreamingSuccessResponse(false), new ListCertificatesByCAResultJsonUnmarshaller());<NEW_LINE>response = invoke(request, responseHandler, executionContext);<NEW_LINE>return response.getAwsResponse();<NEW_LINE>} finally {<NEW_LINE>endClientExecution(awsRequestMetrics, request, response);<NEW_LINE>}<NEW_LINE>} | HandlerContextKey.ENDPOINT_OVERRIDDEN, isEndpointOverridden()); |
898,232 | private void loadInfo(int C_ValidCombination_ID, int C_AcctSchema_ID) {<NEW_LINE>log.fine("C_ValidCombination_ID=" + C_ValidCombination_ID);<NEW_LINE>String sql = "SELECT * FROM C_ValidCombination WHERE C_ValidCombination_ID=? AND C_AcctSchema_ID=?";<NEW_LINE>PreparedStatement pstmt = null;<NEW_LINE>ResultSet rs = null;<NEW_LINE>try {<NEW_LINE>pstmt = DB.prepareStatement(sql, null);<NEW_LINE>pstmt.setInt(1, C_ValidCombination_ID);<NEW_LINE>pstmt.setInt(2, C_AcctSchema_ID);<NEW_LINE>rs = pstmt.executeQuery();<NEW_LINE>if (rs.next()) {<NEW_LINE>if (f_Alias != null)<NEW_LINE>f_Alias.setValue<MASK><NEW_LINE>f_Combination.setValue(rs.getString("Combination"));<NEW_LINE>//<NEW_LINE>loadInfoOf(rs, f_AD_Org_ID, "AD_Org_ID");<NEW_LINE>loadInfoOf(rs, f_Account_ID, "Account_ID");<NEW_LINE>loadInfoOf(rs, f_SubAcct_ID, "C_SubAcct_ID");<NEW_LINE>//<NEW_LINE>loadInfoOf(rs, f_M_Product_ID, "M_Product_ID");<NEW_LINE>loadInfoOf(rs, f_C_BPartner_ID, "C_BPartner_ID");<NEW_LINE>loadInfoOf(rs, f_C_Campaign_ID, "C_Campaign_ID");<NEW_LINE>loadInfoOf(rs, f_C_LocFrom_ID, "C_LocFrom_ID");<NEW_LINE>loadInfoOf(rs, f_C_LocTo_ID, "C_LocTo_ID");<NEW_LINE>loadInfoOf(rs, f_C_Project_ID, "C_Project_ID");<NEW_LINE>loadInfoOf(rs, f_C_SalesRegion_ID, "C_SalesRegion_ID");<NEW_LINE>loadInfoOf(rs, f_AD_OrgTrx_ID, "AD_OrgTrx_ID");<NEW_LINE>loadInfoOf(rs, f_C_Activity_ID, "C_Activity_ID");<NEW_LINE>loadInfoOf(rs, f_User1_ID, "User1_ID");<NEW_LINE>loadInfoOf(rs, f_User2_ID, "User2_ID");<NEW_LINE>loadInfoOf(rs, f_User3_ID, "User3_ID");<NEW_LINE>loadInfoOf(rs, f_User4_ID, "User4_ID");<NEW_LINE>//<NEW_LINE>f_Description.setValue(rs.getString("Description"));<NEW_LINE>}<NEW_LINE>} catch (SQLException e) {<NEW_LINE>log.log(Level.SEVERE, sql, e);<NEW_LINE>} finally {<NEW_LINE>DB.close(rs, pstmt);<NEW_LINE>rs = null;<NEW_LINE>pstmt = null;<NEW_LINE>}<NEW_LINE>} | (rs.getString("Alias")); |
607,967 | private void createActions() {<NEW_LINE>searchAction = new NavigatableContextAction(SEARCH_ACTION_NAME, getName(), false) {<NEW_LINE><NEW_LINE>@Override<NEW_LINE>public void actionPerformed(NavigatableActionContext context) {<NEW_LINE>openSearchDialog();<NEW_LINE>}<NEW_LINE>};<NEW_LINE>searchAction.setHelpLocation(new HelpLocation(this.getName(), "Scalar_Search"));<NEW_LINE>searchAction.setMenuBarData(new MenuData(new String[] { ToolConstants.MENU_SEARCH, <MASK><NEW_LINE>searchAction.setDescription("Search program for scalars");<NEW_LINE>searchAction.addToWindowWhen(NavigatableActionContext.class);<NEW_LINE>tool.addAction(searchAction);<NEW_LINE>//<NEW_LINE>// Unusual Code: This plugin does not use the delete action directly, but our transient<NEW_LINE>// tables do. We need a way to have keybindings shared for this action.<NEW_LINE>// Further, we need to register it now, not when the transient<NEW_LINE>// providers are created, as they would only appear in the options at<NEW_LINE>// that point.<NEW_LINE>//<NEW_LINE>DeleteTableRowAction.registerDummy(tool, getName());<NEW_LINE>} | "For Scalars..." }, null, "search for")); |
1,353,470 | public void addSendFailMetric(String errorMsg, DispatchProfile currentRecord) {<NEW_LINE>Map<String, String> dimensions = new HashMap<>();<NEW_LINE>dimensions.put(SortMetricItem.KEY_CLUSTER_ID, this.getClusterId());<NEW_LINE>dimensions.put(SortMetricItem.KEY_TASK_NAME, this.getTaskName());<NEW_LINE>dimensions.put(SortMetricItem.KEY_SOURCE_ID, "-");<NEW_LINE>dimensions.put(SortMetricItem.KEY_SOURCE_DATA_ID, "-");<NEW_LINE>dimensions.put(SortMetricItem.KEY_SINK_ID, this.getSinkName());<NEW_LINE>dimensions.put(SortMetricItem.KEY_SINK_DATA_ID, errorMsg);<NEW_LINE>dimensions.put(SortMetricItem.KEY_INLONG_GROUP_ID, currentRecord.getInlongGroupId());<NEW_LINE>dimensions.put(SortMetricItem.KEY_INLONG_STREAM_ID, currentRecord.getInlongStreamId());<NEW_LINE>// msgTime<NEW_LINE>long msgTime = System.currentTimeMillis();<NEW_LINE>long auditFormatTime = msgTime - msgTime % CommonPropertiesHolder.getAuditFormatInterval();<NEW_LINE>dimensions.put(SortMetricItem.KEY_MESSAGE_TIME<MASK><NEW_LINE>// find metric<NEW_LINE>SortMetricItem metricItem = this.getMetricItemSet().findMetricItem(dimensions);<NEW_LINE>metricItem.readFailCount.addAndGet(currentRecord.getCount());<NEW_LINE>metricItem.readFailSize.addAndGet(currentRecord.getSize());<NEW_LINE>} | , String.valueOf(auditFormatTime)); |
245,992 | private InferenceState restoreInferenceState() {<NEW_LINE>SearchRequest searchRequest = new SearchRequest(config.getDest().getIndex());<NEW_LINE>searchRequest.indicesOptions(MlIndicesUtils.addIgnoreUnavailable(SearchRequest.DEFAULT_INDICES_OPTIONS));<NEW_LINE>SearchSourceBuilder sourceBuilder = (new SearchSourceBuilder().size(0).query(QueryBuilders.boolQuery().filter(QueryBuilders.termQuery(config.getDest().getResultsField() + "." + DestinationIndex.IS_TRAINING, false))).fetchSource(false).aggregation(AggregationBuilders.max(DestinationIndex.INCREMENTAL_ID).field(DestinationIndex.INCREMENTAL_ID)).trackTotalHits(true));<NEW_LINE>searchRequest.source(sourceBuilder);<NEW_LINE>SearchResponse searchResponse = ClientHelper.executeWithHeaders(config.getHeaders(), ClientHelper.ML_ORIGIN, client, () -> client.search<MASK><NEW_LINE>Max maxIncrementalIdAgg = searchResponse.getAggregations().get(DestinationIndex.INCREMENTAL_ID);<NEW_LINE>long processedTestDocCount = searchResponse.getHits().getTotalHits().value;<NEW_LINE>Long lastIncrementalId = processedTestDocCount == 0 ? null : (long) maxIncrementalIdAgg.value();<NEW_LINE>if (lastIncrementalId != null) {<NEW_LINE>LOGGER.debug(() -> new ParameterizedMessage("[{}] Resuming inference; last incremental id [{}]; processed test doc count [{}]", config.getId(), lastIncrementalId, processedTestDocCount));<NEW_LINE>}<NEW_LINE>return new InferenceState(lastIncrementalId, processedTestDocCount);<NEW_LINE>} | (searchRequest).actionGet()); |
1,612,383 | public void start(Promise<Void> startPromise) {<NEW_LINE>pool = PgPool.pool(vertx, options, new PoolOptions().setMaxSize(5));<NEW_LINE>pool.query("create table jokes(joke varchar(255))").execute().compose(v -> vertx.fileSystem().readFile("jokes.json")).compose(buffer -> {<NEW_LINE>JsonArray array = new JsonArray(buffer);<NEW_LINE>List<Tuple> batch = new ArrayList<>();<NEW_LINE>for (int i = 0; i < array.size(); i++) {<NEW_LINE>String joke = array.getJsonObject(i).getString("joke");<NEW_LINE>batch.add(Tuple.of(joke));<NEW_LINE>}<NEW_LINE>return pool.preparedQuery<MASK><NEW_LINE>}).<Void>mapEmpty().onComplete(startPromise);<NEW_LINE>vertx.createHttpServer().requestHandler(req -> {<NEW_LINE>pool.query("select joke from jokes ORDER BY random() limit 1").execute().onComplete(res -> {<NEW_LINE>if (res.succeeded() && res.result().size() > 0) {<NEW_LINE>Row row = res.result().iterator().next();<NEW_LINE>String joke = row.getString(0);<NEW_LINE>req.response().putHeader("content-type", "text/plain").end(joke);<NEW_LINE>} else {<NEW_LINE>req.response().setStatusCode(500).end("No jokes available");<NEW_LINE>}<NEW_LINE>});<NEW_LINE>}).listen(8082);<NEW_LINE>} | ("insert into jokes values ($1)").executeBatch(batch); |
716,544 | public String describe() {<NEW_LINE>// for #2398. sigh<NEW_LINE>StringBuilder builder = new StringBuilder();<NEW_LINE>ConfigTag configTag = this.getClass().getAnnotation(ConfigTag.class);<NEW_LINE>builder.append("<").append(configTag.value()).append(" ");<NEW_LINE>GoConfigClassWriter cruiseConfigClass = new GoConfigClassWriter(this.getClass()<MASK><NEW_LINE>List<GoConfigFieldWriter> fields = cruiseConfigClass.getAllFields(this);<NEW_LINE>for (GoConfigFieldWriter field : fields) {<NEW_LINE>if (field.isAttribute()) {<NEW_LINE>Object value = field.getValue();<NEW_LINE>if (!field.isDefault(cruiseConfigClass)) {<NEW_LINE>appendIfNotEmpty(builder, value, field.value());<NEW_LINE>}<NEW_LINE>} else {<NEW_LINE>addDescribeOfArguments(builder, configTag, field);<NEW_LINE>}<NEW_LINE>}<NEW_LINE>if (!(this instanceof ExecTask)) {<NEW_LINE>builder.append("/>");<NEW_LINE>}<NEW_LINE>return builder.toString();<NEW_LINE>} | , new ConfigCache(), null); |
2,073 | private List<File> collectFiles(FormatterFactory formatterFactory, FormatterConfig config) {<NEW_LINE>Optional<String> ratchetFrom = formatterFactory.ratchetFrom(config);<NEW_LINE>try {<NEW_LINE>final List<File> files;<NEW_LINE>if (ratchetFrom.isPresent()) {<NEW_LINE>files = collectFilesFromGit(formatterFactory, ratchetFrom.get());<NEW_LINE>} else {<NEW_LINE>files = collectFilesFromFormatterFactory(formatterFactory);<NEW_LINE>}<NEW_LINE>if (filePatterns == null || filePatterns.isEmpty()) {<NEW_LINE>return files;<NEW_LINE>}<NEW_LINE>final String[] includePatterns = <MASK><NEW_LINE>final List<Pattern> compiledIncludePatterns = Arrays.stream(includePatterns).map(Pattern::compile).collect(Collectors.toList());<NEW_LINE>final Predicate<File> shouldInclude = file -> compiledIncludePatterns.stream().anyMatch(filePattern -> filePattern.matcher(file.getAbsolutePath()).matches());<NEW_LINE>return files.stream().filter(shouldInclude).collect(toList());<NEW_LINE>} catch (IOException e) {<NEW_LINE>throw new PluginException("Unable to scan file tree rooted at " + baseDir, e);<NEW_LINE>}<NEW_LINE>} | this.filePatterns.split(","); |
1,041,653 | private List<Paragraph> renderLiteral(Page page, OWLLiteral literal, Color foreground, Color background, boolean isSelected) {<NEW_LINE>if (isLiteralRenderableAsIRI(literal)) {<NEW_LINE>return renderIRI(page, IRI.create(literal.getLiteral()), foreground, background, isSelected, hasFocus());<NEW_LINE>} else {<NEW_LINE>String rendering = EscapeUtils.unescapeString(literal.getLiteral()).trim();<NEW_LINE>List<Paragraph> result = new ArrayList<>();<NEW_LINE>if (rendering.length() > 0) {<NEW_LINE>List<<MASK><NEW_LINE>Paragraph literalParagraph = new Paragraph(rendering, linkSpans);<NEW_LINE>literalParagraph.setForeground(foreground);<NEW_LINE>page.add(literalParagraph);<NEW_LINE>result.add(literalParagraph);<NEW_LINE>// new Paragraph("");<NEW_LINE>Paragraph tagParagraph = literalParagraph;<NEW_LINE>tagParagraph.append(" ", foreground);<NEW_LINE>page.add(tagParagraph);<NEW_LINE>result.add(tagParagraph);<NEW_LINE>tagParagraph.setMarginTop(2);<NEW_LINE>tagParagraph.setTabCount(2);<NEW_LINE>}<NEW_LINE>return result;<NEW_LINE>}<NEW_LINE>} | LinkSpan> linkSpans = extractLinks(rendering); |
1,786,253 | public void messageReceived(LCM lcm, String channel, LCMDataInputStream ins) {<NEW_LINE>System.out.println("Received message on channel " + channel);<NEW_LINE>try {<NEW_LINE>if (channel.equals("EXAMPLE")) {<NEW_LINE>example_t msg = new example_t(ins);<NEW_LINE>System.out.println(" timestamp = " + msg.timestamp);<NEW_LINE>System.out.println(" position = [ " + msg.position[0] + ", " + msg.position[1] + ", " + msg.position[2] + " ]");<NEW_LINE>System.out.println(" orientation = [ " + msg.orientation[0] + ", " + msg.orientation[1] + ", " + msg.orientation[2] + ", " + msg.orientation[3] + " ]");<NEW_LINE>System.out.print(" ranges = [ ");<NEW_LINE>for (int i = 0; i < msg.num_ranges; i++) {<NEW_LINE>System.out.print("" <MASK><NEW_LINE>if (i < msg.num_ranges - 1)<NEW_LINE>System.out.print(", ");<NEW_LINE>}<NEW_LINE>System.out.println(" ]");<NEW_LINE>System.out.println(" name = '" + msg.name + "'");<NEW_LINE>System.out.println(" enabled = '" + msg.enabled + "'");<NEW_LINE>}<NEW_LINE>} catch (IOException ex) {<NEW_LINE>System.out.println("Exception: " + ex);<NEW_LINE>}<NEW_LINE>} | + msg.ranges[i]); |
1,718,076 | public void checkAddonCreationRights(final SubscriptionBase baseSubscription, final Plan targetAddOnPlan, final DateTime requestedDate, final InternalTenantContext context) throws SubscriptionBaseApiException {<NEW_LINE>if (baseSubscription.getState() == EntitlementState.CANCELLED || (baseSubscription.getState() == EntitlementState.PENDING && context.toLocalDate(baseSubscription.getStartDate()).compareTo(context.toLocalDate(requestedDate)) < 0)) {<NEW_LINE>throw new SubscriptionBaseApiException(ErrorCode.<MASK><NEW_LINE>}<NEW_LINE>final Plan currentOrPendingPlan = baseSubscription.getCurrentOrPendingPlan();<NEW_LINE>final Product baseProduct = currentOrPendingPlan.getProduct();<NEW_LINE>if (isAddonIncluded(baseProduct, targetAddOnPlan)) {<NEW_LINE>throw new SubscriptionBaseApiException(ErrorCode.SUB_CREATE_AO_ALREADY_INCLUDED, targetAddOnPlan.getName(), currentOrPendingPlan.getProduct().getName());<NEW_LINE>}<NEW_LINE>if (!isAddonAvailable(baseProduct, targetAddOnPlan)) {<NEW_LINE>throw new SubscriptionBaseApiException(ErrorCode.SUB_CREATE_AO_NOT_AVAILABLE, targetAddOnPlan.getName(), currentOrPendingPlan.getProduct().getName());<NEW_LINE>}<NEW_LINE>} | SUB_CREATE_AO_BP_NON_ACTIVE, targetAddOnPlan.getName()); |
416,231 | public ListTagsLogGroupResult listTagsLogGroup(ListTagsLogGroupRequest listTagsLogGroupRequest) throws AmazonServiceException, AmazonClientException {<NEW_LINE>ExecutionContext executionContext = createExecutionContext(listTagsLogGroupRequest);<NEW_LINE>AWSRequestMetrics awsRequestMetrics = executionContext.getAwsRequestMetrics();<NEW_LINE>awsRequestMetrics.startEvent(Field.ClientExecuteTime);<NEW_LINE>Request<ListTagsLogGroupRequest> request = null;<NEW_LINE>Response<ListTagsLogGroupResult> response = null;<NEW_LINE>try {<NEW_LINE>awsRequestMetrics.startEvent(Field.RequestMarshallTime);<NEW_LINE>try {<NEW_LINE>request = new ListTagsLogGroupRequestMarshaller().marshall(listTagsLogGroupRequest);<NEW_LINE>// Binds the request metrics to the current request.<NEW_LINE>request.setAWSRequestMetrics(awsRequestMetrics);<NEW_LINE>} finally {<NEW_LINE>awsRequestMetrics.endEvent(Field.RequestMarshallTime);<NEW_LINE>}<NEW_LINE>Unmarshaller<ListTagsLogGroupResult, JsonUnmarshallerContext> unmarshaller = new ListTagsLogGroupResultJsonUnmarshaller();<NEW_LINE>JsonResponseHandler<ListTagsLogGroupResult> responseHandler = new JsonResponseHandler<ListTagsLogGroupResult>(unmarshaller);<NEW_LINE>response = invoke(request, responseHandler, executionContext);<NEW_LINE>return response.getAwsResponse();<NEW_LINE>} finally {<NEW_LINE>awsRequestMetrics.endEvent(Field.ClientExecuteTime);<NEW_LINE>endClientExecution(<MASK><NEW_LINE>}<NEW_LINE>} | awsRequestMetrics, request, response, LOGGING_AWS_REQUEST_METRIC); |
1,499,232 | public Condition repeat(String xpathBase, int index, Map<String, Condition> conditionsMap, Map<String, org.opendope.xpaths.Xpaths.Xpath> xpathsMap) {<NEW_LINE>// this Xpathref is a clone already,<NEW_LINE>// but it points to the original xpathObj<NEW_LINE>// org.opendope.xpaths.Xpaths.Xpath xpathObj = XPathsPart.getXPathById(xPaths, id);<NEW_LINE>org.opendope.xpaths.Xpaths.Xpath xpathObj = xpathsMap.get(id);<NEW_LINE>String thisXPath = xpathObj<MASK><NEW_LINE>int xpathBaseIdx = thisXPath.indexOf(xpathBase);<NEW_LINE>if (xpathBaseIdx < 0) {<NEW_LINE>// nothing to do<NEW_LINE>return null;<NEW_LINE>}<NEW_LINE>if (thisXPath.trim().startsWith("count")) {<NEW_LINE>// we are trying to count rows of the repeat eg<NEW_LINE>// eg xpath="count(/oda:answers/oda:repeat[@qref='r1_OE']/oda:row[1]/oda:repeat[@qref='r2_d4']/oda:row)<=7"<NEW_LINE>// or xpath="count(/oda:answers/oda:repeat[@qref='r1_OE']/oda:row)=999"<NEW_LINE>// We want to enhance EXCEPT for the deepest repeat.<NEW_LINE>int pos = xpathBaseIdx + xpathBase.length();<NEW_LINE>String tail = thisXPath.substring(pos);<NEW_LINE>log.debug("the tail: " + tail);<NEW_LINE>if (tail.contains("oda:repeat")) /* oda:answers XML case */<NEW_LINE>{<NEW_LINE>// There are deeper repeats in thisXPath than xpathBase, so enhance<NEW_LINE>log.debug("deeper repeats in count");<NEW_LINE>} else {<NEW_LINE>if (tail.contains("/")) {<NEW_LINE>// There are deeper bits to thisXPath than xpathBase, so enhance normally..<NEW_LINE>log.debug("deeper bits in count");<NEW_LINE>} else if (tail.startsWith("[")) {<NEW_LINE>// if you want to count the elements in a repeat, you won't have [1]; having that means something different.<NEW_LINE>log.debug("index needs enhancement");<NEW_LINE>} else if (tail.startsWith(")")) {<NEW_LINE>// we want to count elements in the repeat, so don't add an index!<NEW_LINE>log.debug("retaining (repeat count): " + thisXPath);<NEW_LINE>return null;<NEW_LINE>} else {<NEW_LINE>// for example?<NEW_LINE>log.info("fallback, enhance: " + thisXPath);<NEW_LINE>}<NEW_LINE>}<NEW_LINE>}<NEW_LINE>final String newPath = enhanceXPath(xpathBase, index + 1, thisXPath);<NEW_LINE>if (log.isDebugEnabled()) {<NEW_LINE>if (thisXPath.equals(newPath)) {<NEW_LINE>log.debug("xpath base " + xpathBase + " enhanced NO CHANGE to " + newPath);<NEW_LINE>} else {<NEW_LINE>log.debug("xpath " + thisXPath + " enhanced to " + newPath + " using xpath base " + xpathBase);<NEW_LINE>}<NEW_LINE>}<NEW_LINE>// Clone the xpath<NEW_LINE>org.opendope.xpaths.Xpaths.Xpath newXPathObj = createNewXPathObject(xpathsMap, newPath, xpathObj, index);<NEW_LINE>// point this at it<NEW_LINE>this.id = newXPathObj.getId();<NEW_LINE>return null;<NEW_LINE>} | .getDataBinding().getXpath(); |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.