idx int32 46 1.86M | input stringlengths 321 6.6k | target stringlengths 9 1.24k |
|---|---|---|
1,407,012 | protected static KodoUnderFileSystem creatInstance(AlluxioURI uri, UnderFileSystemConfiguration conf) {<NEW_LINE>String bucketName = UnderFileSystemUtils.getBucketName(uri);<NEW_LINE>Preconditions.checkArgument(conf.isSet(PropertyKey.KODO_ACCESS_KEY), "Property %s is required to connect to Kodo", PropertyKey.KODO_ACCESS_KEY);<NEW_LINE>Preconditions.checkArgument(conf.isSet(PropertyKey.KODO_SECRET_KEY), "Property %s is required to connect to Kodo", PropertyKey.KODO_SECRET_KEY);<NEW_LINE>Preconditions.checkArgument(conf.isSet(PropertyKey.KODO_DOWNLOAD_HOST), "Property %s is required to connect to Kodo", PropertyKey.KODO_DOWNLOAD_HOST);<NEW_LINE>Preconditions.checkArgument(conf.isSet(PropertyKey.KODO_ENDPOINT), "Property %s is required to connect to Kodo", PropertyKey.KODO_ENDPOINT);<NEW_LINE>String accessKey = conf.getString(PropertyKey.KODO_ACCESS_KEY);<NEW_LINE>String secretKey = conf.getString(PropertyKey.KODO_SECRET_KEY);<NEW_LINE>String endPoint = <MASK><NEW_LINE>String souceHost = conf.getString(PropertyKey.KODO_DOWNLOAD_HOST);<NEW_LINE>Auth auth = Auth.create(accessKey, secretKey);<NEW_LINE>Configuration configuration = new Configuration();<NEW_LINE>OkHttpClient.Builder okHttpBuilder = initializeKodoClientConfig(conf);<NEW_LINE>OkHttpClient okHttpClient = okHttpBuilder.build();<NEW_LINE>KodoClient kodoClient = new KodoClient(auth, bucketName, souceHost, endPoint, configuration, okHttpClient);<NEW_LINE>return new KodoUnderFileSystem(uri, kodoClient, conf);<NEW_LINE>} | conf.getString(PropertyKey.KODO_ENDPOINT); |
1,724,234 | private QuoteFeedData internalGetQuotes(Security security, String feedURL, boolean collectRawResponse, boolean isPreview) {<NEW_LINE>if (feedURL == null || feedURL.length() == 0) {<NEW_LINE>return QuoteFeedData.withError(new IOException(MessageFormat.format(Messages.MsgMissingFeedURL, security.getName())));<NEW_LINE>}<NEW_LINE>QuoteFeedData data = new QuoteFeedData();<NEW_LINE>VariableURL <MASK><NEW_LINE>variableURL.setSecurity(security);<NEW_LINE>SortedSet<LatestSecurityPrice> newPricesByDate = new TreeSet<>(new SecurityPrice.ByDate());<NEW_LINE>long failedAttempts = 0;<NEW_LINE>long maxFailedAttempts = variableURL.getMaxFailedAttempts();<NEW_LINE>for (// NOSONAR<NEW_LINE>// NOSONAR<NEW_LINE>String url : variableURL) {<NEW_LINE>Pair<String, List<LatestSecurityPrice>> answer = cache.lookup(url);<NEW_LINE>if (answer == null || (collectRawResponse && answer.getLeft().isEmpty())) {<NEW_LINE>answer = parseFromURL(url, collectRawResponse, data);<NEW_LINE>if (!answer.getRight().isEmpty())<NEW_LINE>cache.put(url, answer);<NEW_LINE>}<NEW_LINE>if (collectRawResponse)<NEW_LINE>data.addResponse(url, answer.getLeft());<NEW_LINE>int sizeBefore = newPricesByDate.size();<NEW_LINE>newPricesByDate.addAll(answer.getRight());<NEW_LINE>if (newPricesByDate.size() > sizeBefore)<NEW_LINE>failedAttempts = 0;<NEW_LINE>else if (++failedAttempts > maxFailedAttempts)<NEW_LINE>break;<NEW_LINE>if (isPreview && newPricesByDate.size() >= 100)<NEW_LINE>break;<NEW_LINE>}<NEW_LINE>data.addAllPrices(newPricesByDate);<NEW_LINE>return data;<NEW_LINE>} | variableURL = Factory.fromString(feedURL); |
616,370 | private void authenticate(final String username, final String password) {<NEW_LINE>// https://helpcenter.veeam.com/docs/backup/rest/http_authentication.html?ver=95u4<NEW_LINE>final HttpPost request = new HttpPost(apiURI.toString() + "/sessionMngr/?v=v1_4");<NEW_LINE>request.setHeader(HttpHeaders.AUTHORIZATION, "Basic " + Base64.getEncoder().encodeToString((username + ":" + password).getBytes()));<NEW_LINE>try {<NEW_LINE>final HttpResponse response = httpClient.execute(request);<NEW_LINE>checkAuthFailure(response);<NEW_LINE>veeamSessionId = response.<MASK><NEW_LINE>if (StringUtils.isEmpty(veeamSessionId)) {<NEW_LINE>throw new CloudRuntimeException("Veeam Session ID is not available to perform API requests");<NEW_LINE>}<NEW_LINE>if (response.getStatusLine().getStatusCode() != HttpStatus.SC_CREATED) {<NEW_LINE>throw new CloudRuntimeException("Failed to create and authenticate Veeam API client, please check the settings.");<NEW_LINE>}<NEW_LINE>} catch (final IOException e) {<NEW_LINE>throw new CloudRuntimeException("Failed to authenticate Veeam API service due to:" + e.getMessage());<NEW_LINE>}<NEW_LINE>} | getFirstHeader(SESSION_HEADER).getValue(); |
430,133 | public void channelRead0(ChannelHandlerContext ctx, FullHttpRequest req) throws Exception {<NEW_LINE>if (HttpUtil.is100ContinueExpected(req)) {<NEW_LINE>ctx.write(new DefaultFullHttpResponse(HTTP_1_1, CONTINUE, ctx.alloc().buffer(0)));<NEW_LINE>}<NEW_LINE>boolean keepAlive = HttpUtil.isKeepAlive(req);<NEW_LINE>ByteBuf content = ctx.alloc().buffer();<NEW_LINE>content.writeBytes(<MASK><NEW_LINE>ByteBufUtil.writeAscii(content, " - via " + req.protocolVersion() + " (" + establishApproach + ")");<NEW_LINE>FullHttpResponse response = new DefaultFullHttpResponse(HTTP_1_1, OK, content);<NEW_LINE>response.headers().set(CONTENT_TYPE, "text/plain; charset=UTF-8");<NEW_LINE>response.headers().setInt(CONTENT_LENGTH, response.content().readableBytes());<NEW_LINE>if (!keepAlive) {<NEW_LINE>ctx.write(response).addListener(ChannelFutureListener.CLOSE);<NEW_LINE>} else {<NEW_LINE>response.headers().set(CONNECTION, HttpHeaderValues.KEEP_ALIVE);<NEW_LINE>ctx.write(response);<NEW_LINE>}<NEW_LINE>} | HelloWorldHttp2Handler.RESPONSE_BYTES.duplicate()); |
921,715 | public Object calculate(Context ctx) {<NEW_LINE>if (param == null) {<NEW_LINE>MessageManager mm = EngineMessage.get();<NEW_LINE>throw new RQException("ftp_mput" + mm.getMessage("function.missingParam"));<NEW_LINE>}<NEW_LINE><MASK><NEW_LINE>if (size < 3) {<NEW_LINE>MessageManager mm = EngineMessage.get();<NEW_LINE>throw new RQException("ftp_mput" + mm.getMessage("function.invalidParam"));<NEW_LINE>}<NEW_LINE>FtpClientImpl client = null;<NEW_LINE>SFtpClientImpl sclient = null;<NEW_LINE>String localFolder = null;<NEW_LINE>String remoteFolder = null;<NEW_LINE>ArrayList<String> remoteFiles = new ArrayList<String>();<NEW_LINE>boolean overwrite = option != null && option.indexOf("f") >= 0;<NEW_LINE>boolean ignore = option != null && option.indexOf("t") >= 0;<NEW_LINE>if (ignore)<NEW_LINE>overwrite = false;<NEW_LINE>for (int i = 0; i < size; i++) {<NEW_LINE>if (i == 0) {<NEW_LINE>if (param.getSub(i) == null) {<NEW_LINE>MessageManager mm = EngineMessage.get();<NEW_LINE>throw new RQException("ftp_mput" + mm.getMessage("function.invalidParam"));<NEW_LINE>}<NEW_LINE>Object o = param.getSub(i).getLeafExpression().calculate(ctx);<NEW_LINE>if (o instanceof FtpClientImpl)<NEW_LINE>client = (FtpClientImpl) o;<NEW_LINE>else if (o instanceof SFtpClientImpl)<NEW_LINE>sclient = (SFtpClientImpl) o;<NEW_LINE>else<NEW_LINE>throw new RQException("first parameter is not ftp_client");<NEW_LINE>} else if (i == 1) {<NEW_LINE>if (param.getSub(i) == null) {<NEW_LINE>remoteFolder = null;<NEW_LINE>} else<NEW_LINE>remoteFolder = (String) param.getSub(i).getLeafExpression().calculate(ctx);<NEW_LINE>} else if (i == 2) {<NEW_LINE>if (param.getSub(i) == null) {<NEW_LINE>localFolder = null;<NEW_LINE>} else<NEW_LINE>localFolder = (String) param.getSub(i).getLeafExpression().calculate(ctx);<NEW_LINE>} else {<NEW_LINE>remoteFiles.add((String) param.getSub(i).getLeafExpression().calculate(ctx));<NEW_LINE>}<NEW_LINE>}<NEW_LINE>Sequence r = null;<NEW_LINE>try {<NEW_LINE>if (client != null)<NEW_LINE>r = client.mput(localFolder, remoteFolder, remoteFiles, overwrite, ignore);<NEW_LINE>else<NEW_LINE>//<NEW_LINE>throw new RQException("ftp_mput for sftp is not implementing.");<NEW_LINE>} catch (Exception e) {<NEW_LINE>e.printStackTrace();<NEW_LINE>throw new RQException("ftp_mput : " + e.getMessage());<NEW_LINE>}<NEW_LINE>return r;<NEW_LINE>} | int size = param.getSubSize(); |
1,374,530 | public static DeleteAlbumsResponse unmarshall(DeleteAlbumsResponse deleteAlbumsResponse, UnmarshallerContext context) {<NEW_LINE>deleteAlbumsResponse.setRequestId(context.stringValue("DeleteAlbumsResponse.RequestId"));<NEW_LINE>deleteAlbumsResponse.setCode(context.stringValue("DeleteAlbumsResponse.Code"));<NEW_LINE>deleteAlbumsResponse.setMessage(context.stringValue("DeleteAlbumsResponse.Message"));<NEW_LINE>deleteAlbumsResponse.setAction(context.stringValue("DeleteAlbumsResponse.Action"));<NEW_LINE>List<Result> results = new ArrayList<Result>();<NEW_LINE>for (int i = 0; i < context.lengthValue("DeleteAlbumsResponse.Results.Length"); i++) {<NEW_LINE>Result result = new Result();<NEW_LINE>result.setId(context.longValue("DeleteAlbumsResponse.Results[" + i + "].Id"));<NEW_LINE>result.setIdStr(context.stringValue("DeleteAlbumsResponse.Results[" + i + "].IdStr"));<NEW_LINE>result.setCode(context.stringValue<MASK><NEW_LINE>result.setMessage(context.stringValue("DeleteAlbumsResponse.Results[" + i + "].Message"));<NEW_LINE>results.add(result);<NEW_LINE>}<NEW_LINE>deleteAlbumsResponse.setResults(results);<NEW_LINE>return deleteAlbumsResponse;<NEW_LINE>} | ("DeleteAlbumsResponse.Results[" + i + "].Code")); |
813,518 | public NaiveBayesTrainBatchOp linkFrom(BatchOperator<?>... inputs) {<NEW_LINE>BatchOperator<?> in = checkAndGetFirst(inputs);<NEW_LINE>String labelColName = getLabelCol();<NEW_LINE>TypeInformation<?> labelType = in.getColTypes()[TableUtil.findColIndexWithAssertAndHint(in.getColNames(), labelColName)];<NEW_LINE>String[] featureColNames = getFeatureCols();<NEW_LINE>int featureSize = featureColNames.length;<NEW_LINE>int[] featureIndices = TableUtil.findColIndices(in.getColNames(), featureColNames);<NEW_LINE>TypeInformation<?>[] typeCols = new TypeInformation<?>[featureSize];<NEW_LINE>for (int i = 0; i < featureSize; i++) {<NEW_LINE>typeCols[i] = in.getColTypes()[featureIndices[i]];<NEW_LINE>}<NEW_LINE>String weightColName = getWeightCol() == null ? "" : getWeightCol();<NEW_LINE>double smoothing = getSmoothing();<NEW_LINE>String[] originalCategoricalCols = getParams().contains(HasCategoricalCols.CATEGORICAL_COLS) ? getCategoricalCols<MASK><NEW_LINE>boolean[] isCate = generateCategoricalCols(originalCategoricalCols, featureColNames, typeCols, labelColName, getParams());<NEW_LINE>BatchOperator<?> stringIndexerModel = Preprocessing.generateStringIndexerModel(in, getParams());<NEW_LINE>in = Preprocessing.castCategoricalCols(in, stringIndexerModel, getParams());<NEW_LINE>in = Preprocessing.castContinuousCols(in, getParams());<NEW_LINE>// continual columns don't have smooth factor and categorical columns have smooth factor.<NEW_LINE>DataSet<Tuple3<Object, Double, Number[]>> trainData = in.getDataSet().mapPartition(new Transform(TableUtil.findColIndexWithAssertAndHint(in.getColNames(), labelColName), TableUtil.findColIndex(in.getColNames(), weightColName), featureIndices));<NEW_LINE>DataSet<NaiveBayesModelData> naiveBayesModel = trainData.groupBy(new SelectLabel()).reduceGroup(new ReduceItem(isCate)).mapPartition(new GenerateModel(smoothing, featureColNames, labelType, isCate)).withBroadcastSet(stringIndexerModel.getDataSet(), "stringIndexerModel").setParallelism(1);<NEW_LINE>DataSet<Row> model = naiveBayesModel.flatMap(new FlatMapFunction<NaiveBayesModelData, Row>() {<NEW_LINE><NEW_LINE>private static final long serialVersionUID = 4634517702171022715L;<NEW_LINE><NEW_LINE>@Override<NEW_LINE>public void flatMap(NaiveBayesModelData value, Collector<Row> out) throws Exception {<NEW_LINE>new NaiveBayesModelDataConverter(labelType).save(value, out);<NEW_LINE>}<NEW_LINE>}).setParallelism(1);<NEW_LINE>this.setOutput(model, new NaiveBayesModelDataConverter(labelType).getModelSchema());<NEW_LINE>return this;<NEW_LINE>} | () : new String[0]; |
725,942 | public static java.sql.Date toSqlDate(Object value) {<NEW_LINE>if (value == null) {<NEW_LINE>return null;<NEW_LINE>} else if (value instanceof java.sql.Date) {<NEW_LINE>return (java.sql.Date) value;<NEW_LINE>} else if (value instanceof java.util.Date) {<NEW_LINE>return new java.sql.Date(((java.util.Date) value).getTime());<NEW_LINE>} else if (value instanceof Number) {<NEW_LINE>return new java.sql.Date(((Number) value).longValue());<NEW_LINE>} else if (value instanceof LocalDateTime) {<NEW_LINE>return new java.sql.Date(toLong(value));<NEW_LINE>} else {<NEW_LINE>try {<NEW_LINE>return java.sql.Date.valueOf(value.<MASK><NEW_LINE>} catch (IllegalArgumentException e) {<NEW_LINE>throw new ConversionException("failed to convert: '" + value + "' to java.sql.Date", e);<NEW_LINE>}<NEW_LINE>}<NEW_LINE>} | toString().trim()); |
183,229 | public void compile(File inFile, File outFile) throws IOException {<NEW_LINE>Reader reader = new BufferedReader(new FileReader(inFile));<NEW_LINE>OutputStream output = new BufferedOutputStream(new FileOutputStream(outFile));<NEW_LINE>try {<NEW_LINE>TileSet.Builder builder = TileSet.newBuilder();<NEW_LINE><MASK><NEW_LINE>TileSet tileSet = builder.build();<NEW_LINE>String collisionPath = tileSet.getCollision();<NEW_LINE>BufferedImage collisionImage = null;<NEW_LINE>if (!collisionPath.equals("")) {<NEW_LINE>collisionImage = loadImageFile(collisionPath);<NEW_LINE>}<NEW_LINE>String imagePath = tileSet.getImage();<NEW_LINE>BufferedImage image = loadImageFile(imagePath);<NEW_LINE>if (image != null && (image.getWidth() < tileSet.getTileWidth() || image.getHeight() < tileSet.getTileHeight())) {<NEW_LINE>throw new RuntimeException("Invalid tile dimensions");<NEW_LINE>}<NEW_LINE>if (image != null && collisionImage != null && (image.getWidth() != collisionImage.getWidth() || image.getHeight() != collisionImage.getHeight())) {<NEW_LINE>throw new RuntimeException("Image dimensions differ");<NEW_LINE>}<NEW_LINE>String compiledImageName = imagePath;<NEW_LINE>int index = compiledImageName.lastIndexOf('.');<NEW_LINE>compiledImageName = compiledImageName.substring(0, index) + ".texturec";<NEW_LINE>TextureSetResult result = TileSetGenerator.generate(tileSet, image, collisionImage);<NEW_LINE>TextureSet.Builder textureSetBuilder = result.builder;<NEW_LINE>textureSetBuilder.setTexture(compiledImageName).setTileWidth(tileSet.getTileWidth()).setTileHeight(tileSet.getTileHeight());<NEW_LINE>textureSetBuilder.build().writeTo(output);<NEW_LINE>} finally {<NEW_LINE>reader.close();<NEW_LINE>output.close();<NEW_LINE>}<NEW_LINE>} | TextFormat.merge(reader, builder); |
111,540 | public static DescribeGtmRecoveryPlanAvailableConfigResponse unmarshall(DescribeGtmRecoveryPlanAvailableConfigResponse describeGtmRecoveryPlanAvailableConfigResponse, UnmarshallerContext _ctx) {<NEW_LINE>describeGtmRecoveryPlanAvailableConfigResponse.setRequestId(_ctx.stringValue("DescribeGtmRecoveryPlanAvailableConfigResponse.RequestId"));<NEW_LINE>List<Instance> instances = new ArrayList<Instance>();<NEW_LINE>for (int i = 0; i < _ctx.lengthValue("DescribeGtmRecoveryPlanAvailableConfigResponse.Instances.Length"); i++) {<NEW_LINE>Instance instance = new Instance();<NEW_LINE>instance.setInstanceId(_ctx.stringValue("DescribeGtmRecoveryPlanAvailableConfigResponse.Instances[" + i + "].InstanceId"));<NEW_LINE>instance.setInstanceName(_ctx.stringValue("DescribeGtmRecoveryPlanAvailableConfigResponse.Instances[" + i + "].InstanceName"));<NEW_LINE>List<AddrPool> addrPools <MASK><NEW_LINE>for (int j = 0; j < _ctx.lengthValue("DescribeGtmRecoveryPlanAvailableConfigResponse.Instances[" + i + "].AddrPools.Length"); j++) {<NEW_LINE>AddrPool addrPool = new AddrPool();<NEW_LINE>addrPool.setAddrPoolId(_ctx.stringValue("DescribeGtmRecoveryPlanAvailableConfigResponse.Instances[" + i + "].AddrPools[" + j + "].AddrPoolId"));<NEW_LINE>addrPool.setName(_ctx.stringValue("DescribeGtmRecoveryPlanAvailableConfigResponse.Instances[" + i + "].AddrPools[" + j + "].Name"));<NEW_LINE>addrPools.add(addrPool);<NEW_LINE>}<NEW_LINE>instance.setAddrPools(addrPools);<NEW_LINE>instances.add(instance);<NEW_LINE>}<NEW_LINE>describeGtmRecoveryPlanAvailableConfigResponse.setInstances(instances);<NEW_LINE>return describeGtmRecoveryPlanAvailableConfigResponse;<NEW_LINE>} | = new ArrayList<AddrPool>(); |
363,239 | private JPanel makeButtonPanel() {<NEW_LINE>// $NON-NLS-1$<NEW_LINE>showDetail = new JButton(JMeterUtils.getResString("detail"));<NEW_LINE>showDetail.setActionCommand(DETAIL);<NEW_LINE>showDetail.setEnabled(true);<NEW_LINE>// $NON-NLS-1$<NEW_LINE>add = new JButton(JMeterUtils.getResString("add"));<NEW_LINE>add.setActionCommand(ADD);<NEW_LINE>add.setEnabled(true);<NEW_LINE>// A button for adding new arguments to the table from the clipboard<NEW_LINE>// $NON-NLS-1$<NEW_LINE>JButton addFromClipboard = new JButton<MASK><NEW_LINE>addFromClipboard.setActionCommand(ADD_FROM_CLIPBOARD);<NEW_LINE>addFromClipboard.setEnabled(true);<NEW_LINE>// $NON-NLS-1$<NEW_LINE>delete = new JButton(JMeterUtils.getResString("delete"));<NEW_LINE>delete.setActionCommand(DELETE);<NEW_LINE>if (enableUpDown) {<NEW_LINE>// $NON-NLS-1$<NEW_LINE>up = new JButton(JMeterUtils.getResString("up"));<NEW_LINE>up.setActionCommand(UP);<NEW_LINE>// $NON-NLS-1$<NEW_LINE>down = new JButton(JMeterUtils.getResString("down"));<NEW_LINE>down.setActionCommand(DOWN);<NEW_LINE>}<NEW_LINE>checkButtonsStatus();<NEW_LINE>JPanel buttonPanel = new JPanel();<NEW_LINE>buttonPanel.setBorder(BorderFactory.createEmptyBorder(0, 10, 0, 10));<NEW_LINE>if (this.background != null) {<NEW_LINE>buttonPanel.setBackground(this.background);<NEW_LINE>}<NEW_LINE>showDetail.addActionListener(this);<NEW_LINE>add.addActionListener(this);<NEW_LINE>addFromClipboard.addActionListener(this);<NEW_LINE>delete.addActionListener(this);<NEW_LINE>buttonPanel.add(showDetail);<NEW_LINE>buttonPanel.add(add);<NEW_LINE>buttonPanel.add(addFromClipboard);<NEW_LINE>buttonPanel.add(delete);<NEW_LINE>if (enableUpDown) {<NEW_LINE>up.addActionListener(this);<NEW_LINE>down.addActionListener(this);<NEW_LINE>buttonPanel.add(up);<NEW_LINE>buttonPanel.add(down);<NEW_LINE>}<NEW_LINE>return buttonPanel;<NEW_LINE>} | (JMeterUtils.getResString("add_from_clipboard")); |
1,410,551 | void frameMessage(final MessageData message, final ByteBuf buf) {<NEW_LINE>final int frameSize <MASK><NEW_LINE>final int pad = padding16(frameSize);<NEW_LINE>final byte id = (byte) message.getCode();<NEW_LINE>// Generate the header data.<NEW_LINE>final byte[] h = new byte[LENGTH_HEADER_DATA];<NEW_LINE>h[0] = (byte) ((frameSize >> 16) & 0xff);<NEW_LINE>h[1] = (byte) ((frameSize >> 8) & 0xff);<NEW_LINE>h[2] = (byte) (frameSize & 0xff);<NEW_LINE>System.arraycopy(PROTOCOL_HEADER, 0, h, LENGTH_FRAME_SIZE, PROTOCOL_HEADER.length);<NEW_LINE>Arrays.fill(h, LENGTH_FRAME_SIZE + PROTOCOL_HEADER.length, h.length - 1, (byte) 0x00);<NEW_LINE>encryptor.processBytes(h, 0, LENGTH_HEADER_DATA, h, 0);<NEW_LINE>// Generate the header MAC.<NEW_LINE>byte[] hMac = Arrays.copyOf(secrets.getEgressMac(), LENGTH_MAC);<NEW_LINE>macEncryptor.processBlock(hMac, 0, hMac, 0);<NEW_LINE>hMac = secrets.updateEgress(xor(h, hMac)).getEgressMac();<NEW_LINE>hMac = Arrays.copyOf(hMac, LENGTH_MAC);<NEW_LINE>buf.writeBytes(h).writeBytes(hMac);<NEW_LINE>// Encrypt payload.<NEW_LINE>final MutableBytes f = MutableBytes.create(frameSize + pad);<NEW_LINE>final Bytes bv = id == 0 ? RLP.NULL : RLP.encodeOne(Bytes.of(id));<NEW_LINE>assert bv.size() == 1;<NEW_LINE>f.set(0, bv.get(0));<NEW_LINE>// Zero-padded to 16-byte boundary.<NEW_LINE>message.getData().copyTo(f, 1);<NEW_LINE>encryptor.processBytes(f.toArrayUnsafe(), 0, f.size(), f.toArrayUnsafe(), 0);<NEW_LINE>// Calculate the frame MAC.<NEW_LINE>final byte[] fMacSeed = Arrays.copyOf(secrets.updateEgress(f.toArrayUnsafe()).getEgressMac(), LENGTH_MAC);<NEW_LINE>byte[] fMac = new byte[16];<NEW_LINE>macEncryptor.processBlock(fMacSeed, 0, fMac, 0);<NEW_LINE>fMac = Arrays.copyOf(secrets.updateEgress(xor(fMac, fMacSeed)).getEgressMac(), LENGTH_MAC);<NEW_LINE>buf.writeBytes(f.toArrayUnsafe()).writeBytes(fMac);<NEW_LINE>} | = message.getSize() + LENGTH_MESSAGE_ID; |
762,335 | public void zoomToRegion(Position min, Position max, double bufferFactor) {<NEW_LINE>if (min == null || max == null)<NEW_LINE>return;<NEW_LINE>// prevent divide by zero<NEW_LINE>if (this.ySize == 0) {<NEW_LINE>this.ySize = 1;<NEW_LINE>}<NEW_LINE>// Figure out offset compared to the current center.<NEW_LINE>Position regionCenter = VisualizerUtils.findCenter(min, max);<NEW_LINE>this.eye.x = regionCenter.x - this.center.x;<NEW_LINE>this.eye.y = regionCenter.y - this.center.y;<NEW_LINE>// Figure out what the scale factors would be if we reset this object.<NEW_LINE>double _scaleFactorBase = VisualizerUtils.findScaleFactor(this.xSize, this.ySize, min, max, bufferFactor);<NEW_LINE><MASK><NEW_LINE>// Calculate the zoomMultiplier needed to get to that scale, and set it.<NEW_LINE>this.zoomMultiplier = _scaleFactor / this.scaleFactorBase;<NEW_LINE>this.scaleFactor = this.scaleFactorBase * this.zoomMultiplier;<NEW_LINE>} | double _scaleFactor = _scaleFactorBase * this.zoomMultiplier; |
1,524,755 | public Object visitTryFinally(TryFinally node) throws Exception {<NEW_LINE>Label start = new Label();<NEW_LINE>Label end = new Label();<NEW_LINE>Label handlerStart = new Label();<NEW_LINE>Label finallyEnd = new Label();<NEW_LINE>Object ret;<NEW_LINE>ExceptionHandler inFinally = new ExceptionHandler(node);<NEW_LINE>// Do protected suite<NEW_LINE>exceptionHandlers.push(inFinally);<NEW_LINE>int excLocal = code.getLocal<MASK><NEW_LINE>code.aconst_null();<NEW_LINE>code.astore(excLocal);<NEW_LINE>code.label(start);<NEW_LINE>inFinally.exceptionStarts.addElement(start);<NEW_LINE>ret = suite(node.getInternalBody());<NEW_LINE>code.label(end);<NEW_LINE>inFinally.exceptionEnds.addElement(end);<NEW_LINE>inFinally.bodyDone = true;<NEW_LINE>exceptionHandlers.pop();<NEW_LINE>if (ret == NoExit) {<NEW_LINE>inlineFinally(inFinally);<NEW_LINE>code.goto_(finallyEnd);<NEW_LINE>}<NEW_LINE>// Handle any exceptions that get thrown in suite<NEW_LINE>code.label(handlerStart);<NEW_LINE>code.astore(excLocal);<NEW_LINE>code.aload(excLocal);<NEW_LINE>loadFrame();<NEW_LINE>code.invokestatic(p(Py.class), "addTraceback", sig(Void.TYPE, Throwable.class, PyFrame.class));<NEW_LINE>inlineFinally(inFinally);<NEW_LINE>code.aload(excLocal);<NEW_LINE>code.checkcast(p(Throwable.class));<NEW_LINE>code.athrow();<NEW_LINE>code.label(finallyEnd);<NEW_LINE>code.freeLocal(excLocal);<NEW_LINE>inFinally.addExceptionHandlers(handlerStart);<NEW_LINE>// According to any JVM verifiers, this code block might not return<NEW_LINE>return null;<NEW_LINE>} | (p(Throwable.class)); |
295,622 | public Builder mergeFrom(io.prometheus.client.Metrics.MetricFamily other) {<NEW_LINE>if (other == io.prometheus.client.Metrics.MetricFamily.getDefaultInstance())<NEW_LINE>return this;<NEW_LINE>if (other.hasName()) {<NEW_LINE>bitField0_ |= 0x00000001;<NEW_LINE>name_ = other.name_;<NEW_LINE>onChanged();<NEW_LINE>}<NEW_LINE>if (other.hasHelp()) {<NEW_LINE>bitField0_ |= 0x00000002;<NEW_LINE>help_ = other.help_;<NEW_LINE>onChanged();<NEW_LINE>}<NEW_LINE>if (other.hasType()) {<NEW_LINE>setType(other.getType());<NEW_LINE>}<NEW_LINE>if (metricBuilder_ == null) {<NEW_LINE>if (!other.metric_.isEmpty()) {<NEW_LINE>if (metric_.isEmpty()) {<NEW_LINE>metric_ = other.metric_;<NEW_LINE>bitField0_ = (bitField0_ & ~0x00000008);<NEW_LINE>} else {<NEW_LINE>ensureMetricIsMutable();<NEW_LINE>metric_.addAll(other.metric_);<NEW_LINE>}<NEW_LINE>onChanged();<NEW_LINE>}<NEW_LINE>} else {<NEW_LINE>if (!other.metric_.isEmpty()) {<NEW_LINE>if (metricBuilder_.isEmpty()) {<NEW_LINE>metricBuilder_.dispose();<NEW_LINE>metricBuilder_ = null;<NEW_LINE>metric_ = other.metric_;<NEW_LINE><MASK><NEW_LINE>metricBuilder_ = com.google.protobuf.GeneratedMessage.alwaysUseFieldBuilders ? getMetricFieldBuilder() : null;<NEW_LINE>} else {<NEW_LINE>metricBuilder_.addAllMessages(other.metric_);<NEW_LINE>}<NEW_LINE>}<NEW_LINE>}<NEW_LINE>this.mergeUnknownFields(other.getUnknownFields());<NEW_LINE>return this;<NEW_LINE>} | bitField0_ = (bitField0_ & ~0x00000008); |
1,695,618 | public void testBuildApacheConfiguredValidatorFactory(HttpServletRequest request, HttpServletResponse response) throws Exception {<NEW_LINE>if (validatorFactory == null) {<NEW_LINE>throw new IllegalStateException("Injection of ValidatorFactory never occurred.");<NEW_LINE>}<NEW_LINE>boolean isFeature11 = Boolean.parseBoolean<MASK><NEW_LINE>MessageInterpolator mi = validatorFactory.getMessageInterpolator();<NEW_LINE>String expectedInterpolator = "org.apache.bval.jsr303.DefaultMessageInterpolator";<NEW_LINE>String actualInterpolator = mi.getClass().getName();<NEW_LINE>assertEquals("the correct message interpolator wasn't provided: " + actualInterpolator, expectedInterpolator, actualInterpolator);<NEW_LINE>if (isFeature11) {<NEW_LINE>ClassLoader tccl = Thread.currentThread().getContextClassLoader();<NEW_LINE>Class<?> messageInterpolator = tccl.loadClass("org.apache.bval.jsr.DefaultMessageInterpolator");<NEW_LINE>if (!messageInterpolator.isAssignableFrom(mi.getClass())) {<NEW_LINE>fail("even though the message interpolator returned was the correct " + "class, it's not wrapped properly in bval-1.1: " + messageInterpolator + ".isAssignableFrom(" + mi.getClass() + ")");<NEW_LINE>}<NEW_LINE>}<NEW_LINE>} | (request.getParameter("isFeature11")); |
1,785,768 | public StreamEvent find(StateEvent matchingEvent, IndexedEventHolder indexedEventHolder, StreamEventCloner storeEventCloner) {<NEW_LINE>Collection<StreamEvent> leftStreamEvents = leftCollectionExecutor.findEvents(matchingEvent, indexedEventHolder);<NEW_LINE>if (leftStreamEvents == null) {<NEW_LINE>return exhaustiveCollectionExecutor.<MASK><NEW_LINE>} else {<NEW_LINE>Collection<StreamEvent> rightStreamEvents = rightCollectionExecutor.findEvents(matchingEvent, indexedEventHolder);<NEW_LINE>if (rightStreamEvents == null) {<NEW_LINE>return exhaustiveCollectionExecutor.find(matchingEvent, indexedEventHolder, storeEventCloner);<NEW_LINE>} else {<NEW_LINE>ComplexEventChunk<StreamEvent> returnEventChunk = new ComplexEventChunk<>();<NEW_LINE>for (StreamEvent resultEvent : leftStreamEvents) {<NEW_LINE>if (storeEventCloner != null) {<NEW_LINE>returnEventChunk.add(storeEventCloner.copyStreamEvent(resultEvent));<NEW_LINE>} else {<NEW_LINE>returnEventChunk.add(resultEvent);<NEW_LINE>}<NEW_LINE>}<NEW_LINE>for (StreamEvent resultEvent : rightStreamEvents) {<NEW_LINE>if (!leftStreamEvents.contains(resultEvent)) {<NEW_LINE>if (storeEventCloner != null) {<NEW_LINE>returnEventChunk.add(storeEventCloner.copyStreamEvent(resultEvent));<NEW_LINE>} else {<NEW_LINE>returnEventChunk.add(resultEvent);<NEW_LINE>}<NEW_LINE>}<NEW_LINE>}<NEW_LINE>return returnEventChunk.getFirst();<NEW_LINE>}<NEW_LINE>}<NEW_LINE>} | find(matchingEvent, indexedEventHolder, storeEventCloner); |
676,278 | public void paintBorder(ActionButton button, Graphics g, Dimension size, int state) {<NEW_LINE>if (state == ActionButtonComponent.NORMAL && !button.isBackgroundSet())<NEW_LINE>return;<NEW_LINE>Rectangle rect = new Rectangle(button.getSize());<NEW_LINE>JBInsets.removeFrom(rect, button.getInsets());<NEW_LINE>Graphics2D g2 = (Graphics2D) g.create();<NEW_LINE>g2.setRenderingHint(<MASK><NEW_LINE>g2.setRenderingHint(RenderingHints.KEY_STROKE_CONTROL, RenderingHints.VALUE_STROKE_NORMALIZE);<NEW_LINE>try {<NEW_LINE>Color color = state == ActionButtonComponent.PUSHED ? JBUI.CurrentTheme.ActionButton.pressedBorder() : JBUI.CurrentTheme.ActionButton.hoverBorder();<NEW_LINE>g2.setColor(color);<NEW_LINE>float arc = DarculaUIUtil.BUTTON_ARC.getFloat();<NEW_LINE>float lw = DarculaUIUtil.LW.getFloat();<NEW_LINE>Path2D border = new Path2D.Float(Path2D.WIND_EVEN_ODD);<NEW_LINE>border.append(new RoundRectangle2D.Float(rect.x, rect.y, rect.width, rect.height, arc, arc), false);<NEW_LINE>border.append(new RoundRectangle2D.Float(rect.x + lw, rect.y + lw, rect.width - lw * 2, rect.height - lw * 2, arc - lw, arc - lw), false);<NEW_LINE>g2.fill(border);<NEW_LINE>} finally {<NEW_LINE>g2.dispose();<NEW_LINE>}<NEW_LINE>} | RenderingHints.KEY_ANTIALIASING, RenderingHints.VALUE_ANTIALIAS_ON); |
1,658,149 | Node<K, V> findNode(K key) {<NEW_LINE>java.lang.Comparable<K> object = comparator == null ? toComparable((K) key) : null;<NEW_LINE>K keyK = (K) key;<NEW_LINE>Node<K, V> node = root;<NEW_LINE>while (node != null) {<NEW_LINE>K[] keys = node.keys;<NEW_LINE>int left_idx = node.left_idx;<NEW_LINE>int result = cmp(object<MASK><NEW_LINE>if (result < 0) {<NEW_LINE>node = node.left;<NEW_LINE>} else if (result == 0) {<NEW_LINE>return node;<NEW_LINE>} else {<NEW_LINE>int right_idx = node.right_idx;<NEW_LINE>if (left_idx != right_idx) {<NEW_LINE>result = cmp(object, keyK, keys[right_idx]);<NEW_LINE>}<NEW_LINE>if (result > 0) {<NEW_LINE>node = node.right;<NEW_LINE>} else {<NEW_LINE>return node;<NEW_LINE>}<NEW_LINE>}<NEW_LINE>}<NEW_LINE>return null;<NEW_LINE>} | , keyK, keys[left_idx]); |
198,395 | public void deleteById(String id) {<NEW_LINE>String workspaceName = Utils.getValueFromIdByName(id, "workspaces");<NEW_LINE>if (workspaceName == null) {<NEW_LINE>throw LOGGER.logExceptionAsError(new IllegalArgumentException(String.format("The resource ID '%s' is not valid. Missing path segment 'workspaces'.", id)));<NEW_LINE>}<NEW_LINE>String kustoPoolName = Utils.getValueFromIdByName(id, "kustoPools");<NEW_LINE>if (kustoPoolName == null) {<NEW_LINE>throw LOGGER.logExceptionAsError(new IllegalArgumentException(String.format("The resource ID '%s' is not valid. Missing path segment 'kustoPools'.", id)));<NEW_LINE>}<NEW_LINE>String principalAssignmentName = Utils.getValueFromIdByName(id, "principalAssignments");<NEW_LINE>if (principalAssignmentName == null) {<NEW_LINE>throw LOGGER.logExceptionAsError(new IllegalArgumentException(String.format("The resource ID '%s' is not valid. Missing path segment 'principalAssignments'.", id)));<NEW_LINE>}<NEW_LINE>String resourceGroupName = Utils.getValueFromIdByName(id, "resourceGroups");<NEW_LINE>if (resourceGroupName == null) {<NEW_LINE>throw LOGGER.logExceptionAsError(new IllegalArgumentException(String.<MASK><NEW_LINE>}<NEW_LINE>this.delete(workspaceName, kustoPoolName, principalAssignmentName, resourceGroupName, Context.NONE);<NEW_LINE>} | format("The resource ID '%s' is not valid. Missing path segment 'resourceGroups'.", id))); |
429,193 | public Void visitCreateMapExpression(final CreateMapExpression exp, final Context context) {<NEW_LINE>final ImmutableMap<Expression, Expression> map = exp.getMap();<NEW_LINE>if (map.isEmpty()) {<NEW_LINE>throw new KsqlException("Map constructor cannot be empty. Please supply at least one key " + "value pair (see https://github.com/confluentinc/ksql/issues/4239).");<NEW_LINE>}<NEW_LINE>final SqlType keyType = CoercionUtil.coerceUserList(map.keySet(), ExpressionTypeManager.this, context.getLambdaSqlTypeMapping()).commonType().orElseThrow(() -> new KsqlException("Cannot construct a map with all NULL keys " + "(see https://github.com/confluentinc/ksql/issues/4239). As a workaround, you may " + "cast a NULL key to the desired type."));<NEW_LINE>final SqlType valueType = CoercionUtil.coerceUserList(map.values(), ExpressionTypeManager.this, context.getLambdaSqlTypeMapping()).commonType().orElseThrow(() -> new KsqlException<MASK><NEW_LINE>context.setSqlType(SqlMap.of(keyType, valueType));<NEW_LINE>return null;<NEW_LINE>} | ("Cannot construct a map with all NULL values " + "(see https://github.com/confluentinc/ksql/issues/4239). As a workaround, you may " + "cast a NULL value to the desired type.")); |
528,556 | public void sendCustomEventsAsync() {<NEW_LINE>// BEGIN: com.azure.messaging.eventgrid.EventGridPublisherAsyncClient#CreateCustomEventClient<NEW_LINE>// Create a client to send events of custom event<NEW_LINE>EventGridPublisherAsyncClient<BinaryData> customEventPublisherClient = // make sure it accepts custom events<NEW_LINE>new EventGridPublisherClientBuilder().// make sure it accepts custom events<NEW_LINE>endpoint(System.getenv("AZURE_CUSTOM_EVENT_ENDPOINT")).credential(new AzureKeyCredential(System.getenv("AZURE_CUSTOM_EVENT_KEY"))).buildCustomEventPublisherAsyncClient();<NEW_LINE>// END: com.azure.messaging.eventgrid.EventGridPublisherAsyncClient#CreateCustomEventClient<NEW_LINE>// BEGIN: com.azure.messaging.eventgrid.EventGridPublisherAsyncClient#SendCustomEvent<NEW_LINE>// Create an custom event object (both POJO and Map work)<NEW_LINE>Map<String, Object> customEvent = new HashMap<String, Object>() {<NEW_LINE><NEW_LINE>{<NEW_LINE>put("id", UUID.randomUUID().toString());<NEW_LINE>put("subject", "Test");<NEW_LINE>put("foo", "bar");<NEW_LINE>put("type", "Microsoft.MockPublisher.TestEvent");<NEW_LINE>put("data", 100.0);<NEW_LINE>put("dataVersion", "0.1");<NEW_LINE>}<NEW_LINE>};<NEW_LINE>// Send a single custom event<NEW_LINE>customEventPublisherClient.sendEvent(BinaryData.fromObject<MASK><NEW_LINE>// Send a list of EventGridEvents to the EventGrid service altogether.<NEW_LINE>// This has better performance than sending one by one.<NEW_LINE>customEventPublisherClient.sendEvents(Arrays.asList(BinaryData.fromObject(customEvent))).block();<NEW_LINE>// END: com.azure.messaging.eventgrid.EventGridPublisherAsyncClient#SendCustomEvent<NEW_LINE>} | (customEvent)).block(); |
1,746,648 | private void doRequest(HttpServletRequest request, HttpServletResponse response, boolean head) throws IOException {<NEW_LINE>Resource resource;<NEW_LINE>try {<NEW_LINE>resource = new Resource(getFile(request));<NEW_LINE>} catch (RedirectException ex) {<NEW_LINE>logger.log(FINE, "Redirecting client to: " + ex.location);<NEW_LINE>response.setHeader("Location", ex.location);<NEW_LINE>response.sendError(HttpServletResponse.SC_FOUND);<NEW_LINE>return;<NEW_LINE>} catch (IllegalArgumentException e) {<NEW_LINE>logger.log(FINE, "Got an IllegalArgumentException from user code; interpreting it as 400 Bad Request.", e);<NEW_LINE>response.sendError(HttpServletResponse.SC_BAD_REQUEST);<NEW_LINE>return;<NEW_LINE>}<NEW_LINE>if (resource.file == null) {<NEW_LINE>handleFileNotFound(request, response);<NEW_LINE>return;<NEW_LINE>}<NEW_LINE>if (preconditionFailed(request, resource)) {<NEW_LINE>response.sendError(HttpServletResponse.SC_PRECONDITION_FAILED);<NEW_LINE>return;<NEW_LINE>}<NEW_LINE>setCacheHeaders(response, resource, getExpireTime(request, resource.file));<NEW_LINE>if (notModified(request, resource)) {<NEW_LINE>response.setStatus(HttpServletResponse.SC_NOT_MODIFIED);<NEW_LINE>return;<NEW_LINE>}<NEW_LINE>List<Range> ranges = getRanges(request, resource);<NEW_LINE>if (ranges == null) {<NEW_LINE>response.setHeader("Content-Range", "bytes */" + resource.length);<NEW_LINE>response.sendError(HttpServletResponse.SC_REQUESTED_RANGE_NOT_SATISFIABLE);<NEW_LINE>return;<NEW_LINE>}<NEW_LINE>if (!ranges.isEmpty()) {<NEW_LINE>response.setStatus(HttpServletResponse.SC_PARTIAL_CONTENT);<NEW_LINE>} else {<NEW_LINE>// Full content.<NEW_LINE>ranges.add(new Range(0<MASK><NEW_LINE>}<NEW_LINE>String contentType = setContentHeaders(request, response, resource, ranges);<NEW_LINE>if (head) {<NEW_LINE>return;<NEW_LINE>}<NEW_LINE>writeContent(response, resource, ranges, contentType);<NEW_LINE>} | , resource.length - 1)); |
266,007 | private void checkTableInUsed(final ShardingRule shardingRule, final DropTableStatement sqlStatement, final RouteContext routeContext) {<NEW_LINE>Collection<String> inUsedTable = new LinkedList<>();<NEW_LINE>Set<String> dropTables = sqlStatement.getTables().stream().map(each -> each.getTableName().getIdentifier().getValue()).collect(Collectors.toSet());<NEW_LINE>Set<String> actualTables = routeContext.getRouteUnits().stream().flatMap(each -> each.getTableMappers().stream().map(RouteMapper::getActualName)).collect(Collectors.toSet());<NEW_LINE>Collection<String> tableMeta = shardingRule.getTableRules().values().stream().filter(each -> !dropTables.contains(each.getLogicTable())).flatMap(each -> each.getActualDataNodes().stream().map(DataNode::getTableName)).collect(Collectors.toSet());<NEW_LINE>for (String each : actualTables) {<NEW_LINE>if (tableMeta.contains(each)) {<NEW_LINE>inUsedTable.add(each);<NEW_LINE>}<NEW_LINE>}<NEW_LINE>if (!inUsedTable.isEmpty()) {<NEW_LINE><MASK><NEW_LINE>}<NEW_LINE>} | throw new ShardingSphereException("Actual Tables: [%s] are in use.", inUsedTable); |
1,444,253 | protected void addPattern(String classWildcard) {<NEW_LINE>Matcher <MASK><NEW_LINE>StringBuilder patternStr = new StringBuilder();<NEW_LINE>int prevIndex = 0;<NEW_LINE>while (matcher.find()) {<NEW_LINE>int matchStart = matcher.start();<NEW_LINE>int matchEnd = matcher.end();<NEW_LINE>if (matchStart > prevIndex) {<NEW_LINE>patternStr.append(Pattern.quote(classWildcard.substring(prevIndex, matchStart)));<NEW_LINE>}<NEW_LINE>if (matchStart + 1 == matchEnd) {<NEW_LINE>// single * - use class name pattern<NEW_LINE>// class names allow almost any character, see Character.isJavaIdentifierPart<NEW_LINE>// allowing anything except points to exclude packages<NEW_LINE>patternStr.append("[^\\.]*");<NEW_LINE>} else {<NEW_LINE>// multiple * - use class and package pattern<NEW_LINE>patternStr.append(".*");<NEW_LINE>}<NEW_LINE>prevIndex = matchEnd;<NEW_LINE>}<NEW_LINE>if (prevIndex < classWildcard.length()) {<NEW_LINE>patternStr.append(Pattern.quote(classWildcard.substring(prevIndex, classWildcard.length())));<NEW_LINE>}<NEW_LINE>Pattern pattern = Pattern.compile(patternStr.toString());<NEW_LINE>whitelistPatterns.add(pattern);<NEW_LINE>} | matcher = WILDCARD_PATTERN.matcher(classWildcard); |
456,470 | JarFile createBootProxyJar() throws IOException {<NEW_LINE>File dataFile = bundleContext.getDataFile("boot-proxy.jar");<NEW_LINE>// Create the file if it doesn't already exist<NEW_LINE>if (!dataFile.exists()) {<NEW_LINE>dataFile.createNewFile();<NEW_LINE>}<NEW_LINE>// Generate a manifest<NEW_LINE>Manifest manifest = createBootJarManifest();<NEW_LINE>// Create the file<NEW_LINE>FileOutputStream fileOutputStream = new FileOutputStream(dataFile, false);<NEW_LINE>JarOutputStream jarOutputStream <MASK><NEW_LINE>// Add the jar path entries to reduce class load times<NEW_LINE>createDirectoryEntries(jarOutputStream, BOOT_DELEGATED_PACKAGE);<NEW_LINE>// Map the template classes into the delegation package and add to the jar<NEW_LINE>Bundle bundle = bundleContext.getBundle();<NEW_LINE>Enumeration<?> entryPaths = bundle.getEntryPaths(TEMPLATE_CLASSES_PATH);<NEW_LINE>if (entryPaths != null) {<NEW_LINE>while (entryPaths.hasMoreElements()) {<NEW_LINE>URL sourceClassResource = bundle.getEntry((String) entryPaths.nextElement());<NEW_LINE>if (sourceClassResource != null)<NEW_LINE>writeRemappedClass(sourceClassResource, jarOutputStream, BOOT_DELEGATED_PACKAGE);<NEW_LINE>}<NEW_LINE>}<NEW_LINE>jarOutputStream.close();<NEW_LINE>fileOutputStream.close();<NEW_LINE>return new JarFile(dataFile);<NEW_LINE>} | = new JarOutputStream(fileOutputStream, manifest); |
570,801 | /*<NEW_LINE>switch (b) {<NEW_LINE>default: {<NEW_LINE><MASK><NEW_LINE>if (b < 3) {<NEW_LINE>System.out.println("one");<NEW_LINE>} else {<NEW_LINE>System.out.println("two");<NEW_LINE>}<NEW_LINE>}<NEW_LINE>}<NEW_LINE>this(2);<NEW_LINE><NEW_LINE>->><NEW_LINE><NEW_LINE>int footmp;<NEW_LINE>switch (b) {<NEW_LINE>default: {<NEW_LINE>System.out.println("Hello world");<NEW_LINE>if (b < 3) {<NEW_LINE>System.out.println("one");<NEW_LINE>} else {<NEW_LINE>System.out.println("two");<NEW_LINE>}<NEW_LINE>}<NEW_LINE>footmp = 2;<NEW_LINE>}<NEW_LINE>this(footmp);<NEW_LINE><NEW_LINE>*/<NEW_LINE>private boolean rollSingleDefault(RollState rollState) {<NEW_LINE>if (rollState.switchdata.size() != 1)<NEW_LINE>return false;<NEW_LINE>ClassifiedStm t = rollState.switchdata.get(0);<NEW_LINE>if (t.type != ClassifyType.EMPTY_SWITCH)<NEW_LINE>return false;<NEW_LINE>// Try to extract the first expression from the call.<NEW_LINE>if (rollState.remainder.isEmpty())<NEW_LINE>return false;<NEW_LINE>Op04StructuredStatement call = rollState.remainder.get(0);<NEW_LINE>StructuredStatement s = call.getStatement();<NEW_LINE>if (!(s instanceof StructuredExpressionStatement))<NEW_LINE>return false;<NEW_LINE>Expression e = ((StructuredExpressionStatement) s).getExpression();<NEW_LINE>List<Expression> args = null;<NEW_LINE>if (e instanceof MemberFunctionInvokation && ((MemberFunctionInvokation) e).isInitMethod()) {<NEW_LINE>args = ((MemberFunctionInvokation) e).getArgs();<NEW_LINE>} else if (e instanceof SuperFunctionInvokation) {<NEW_LINE>args = ((SuperFunctionInvokation) e).getArgs();<NEW_LINE>}<NEW_LINE>if (args == null)<NEW_LINE>return false;<NEW_LINE>// We have to use the first NON hidden arg - however (of course) we don't necessarily know that here!<NEW_LINE>int idx;<NEW_LINE>for (idx = 0; idx < args.size(); ++idx) {<NEW_LINE>if (!rollState.directs.contains(args.get(idx)))<NEW_LINE>break;<NEW_LINE>}<NEW_LINE>if (idx >= args.size())<NEW_LINE>return false;<NEW_LINE>Expression tmpValue = args.get(idx);<NEW_LINE>LValue tmp = new LocalVariable("cfr_switch_hack2", tmpValue.getInferredJavaType());<NEW_LINE>rollState.switchdata.add(0, new ClassifiedStm(ClassifyType.DEFINITION, new Op04StructuredStatement(new StructuredDefinition(tmp))));<NEW_LINE>addToSwitch(t.stm, new Op04StructuredStatement(new StructuredAssignment(BytecodeLoc.TODO, tmp, tmpValue)));<NEW_LINE>args.set(idx, new LValueExpression(tmp));<NEW_LINE>return true;<NEW_LINE>} | System.out.println("Hello world"); |
282,797 | public MarketoConnectorProfileProperties unmarshall(JsonUnmarshallerContext context) throws Exception {<NEW_LINE>MarketoConnectorProfileProperties marketoConnectorProfileProperties = new MarketoConnectorProfileProperties();<NEW_LINE><MASK><NEW_LINE>String currentParentElement = context.getCurrentParentElement();<NEW_LINE>int targetDepth = originalDepth + 1;<NEW_LINE>JsonToken token = context.getCurrentToken();<NEW_LINE>if (token == null)<NEW_LINE>token = context.nextToken();<NEW_LINE>if (token == VALUE_NULL) {<NEW_LINE>return null;<NEW_LINE>}<NEW_LINE>while (true) {<NEW_LINE>if (token == null)<NEW_LINE>break;<NEW_LINE>if (token == FIELD_NAME || token == START_OBJECT) {<NEW_LINE>if (context.testExpression("instanceUrl", targetDepth)) {<NEW_LINE>context.nextToken();<NEW_LINE>marketoConnectorProfileProperties.setInstanceUrl(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 marketoConnectorProfileProperties;<NEW_LINE>} | int originalDepth = context.getCurrentDepth(); |
533,642 | final GetRolePolicyResult executeGetRolePolicy(GetRolePolicyRequest getRolePolicyRequest) {<NEW_LINE>ExecutionContext executionContext = createExecutionContext(getRolePolicyRequest);<NEW_LINE>AWSRequestMetrics awsRequestMetrics = executionContext.getAwsRequestMetrics();<NEW_LINE>awsRequestMetrics.startEvent(Field.ClientExecuteTime);<NEW_LINE>Request<GetRolePolicyRequest> request = null;<NEW_LINE>Response<GetRolePolicyResult> response = null;<NEW_LINE>try {<NEW_LINE>awsRequestMetrics.startEvent(Field.RequestMarshallTime);<NEW_LINE>try {<NEW_LINE>request = new GetRolePolicyRequestMarshaller().marshall(super.beforeMarshalling(getRolePolicyRequest));<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, "IAM");<NEW_LINE>request.addHandlerContext(HandlerContextKey.OPERATION_NAME, "GetRolePolicy");<NEW_LINE>request.addHandlerContext(HandlerContextKey.ADVANCED_CONFIG, advancedConfig);<NEW_LINE>} finally {<NEW_LINE>awsRequestMetrics.endEvent(Field.RequestMarshallTime);<NEW_LINE>}<NEW_LINE>StaxResponseHandler<GetRolePolicyResult> responseHandler = new StaxResponseHandler<GetRolePolicyResult>(new GetRolePolicyResultStaxUnmarshaller());<NEW_LINE>response = invoke(request, responseHandler, executionContext);<NEW_LINE>return response.getAwsResponse();<NEW_LINE>} finally {<NEW_LINE>endClientExecution(awsRequestMetrics, request, response);<NEW_LINE>}<NEW_LINE>} | HandlerContextKey.ENDPOINT_OVERRIDDEN, isEndpointOverridden()); |
1,605,753 | public Mono<Void> logoutAllSessions(String email) {<NEW_LINE>// This pattern string comes from calling `ReactiveRedisSessionRepository.getSessionKey("*")` private method.<NEW_LINE>return redisOperations.keys("spring:session:sessions:*").flatMap(key -> // The values are maps, containing various pieces of session related information.<NEW_LINE>Mono.// The values are maps, containing various pieces of session related information.<NEW_LINE>zip(// The values are maps, containing various pieces of session related information.<NEW_LINE>Mono.just(key), // One of them, holds the serialized User object. We want just that.<NEW_LINE>redisOperations.opsForHash().entries(key).filter(e -> e.getValue() != null && ("sessionAttr:" + DEFAULT_SPRING_SECURITY_CONTEXT_ATTR_NAME).equals(e.getKey())).map(e -> (User) ((SecurityContext) e.getValue()).getAuthentication().getPrincipal()).// Now we have tuples of session keys, and the corresponding user objects.<NEW_LINE>next())).// Filter the ones we need to clear out.<NEW_LINE>filter(tuple -> StringUtils.equalsIgnoreCase(email, tuple.getT2().getEmail())).map(Tuple2::getT1).collectList().flatMap(keys -> CollectionUtils.isNullOrEmpty(keys) ? Mono.just(0L) : redisOperations.delete(keys.toArray(String[]::new))).doOnError(error -> log.error("Error clearing user sessions"<MASK><NEW_LINE>} | , error)).then(); |
301,701 | public void delete(E entity, EntityProxy<E> proxy) {<NEW_LINE>context.getStateListener().preDelete(entity, proxy);<NEW_LINE>proxy.unlink();<NEW_LINE>if (cacheable) {<NEW_LINE>cache.invalidate(entityClass, proxy.key());<NEW_LINE>}<NEW_LINE>// if cascade delete and the property is not loaded (load it)<NEW_LINE>for (Attribute<E, ?> attribute : associativeAttributes) {<NEW_LINE>boolean delete = attribute.getCascadeActions().contains(CascadeAction.DELETE);<NEW_LINE>if (delete && (stateless || proxy.getState(attribute) == PropertyState.FETCH)) {<NEW_LINE>context.read(type.getClassType()).refresh(entity, proxy, attribute);<NEW_LINE>}<NEW_LINE>}<NEW_LINE>Deletion<? extends Scalar<Integer>> deletion = queryable.delete(entityClass);<NEW_LINE>for (Attribute<E, ?> attribute : whereAttributes) {<NEW_LINE>if (attribute == versionAttribute) {<NEW_LINE>Object version = proxy.get(versionAttribute, true);<NEW_LINE>if (version == null) {<NEW_LINE>throw new MissingVersionException(proxy);<NEW_LINE>}<NEW_LINE>addVersionCondition(deletion, version);<NEW_LINE>} else {<NEW_LINE>QueryAttribute<E, Object> id = Attributes.query(attribute);<NEW_LINE>deletion.where(id.equal(proxy.get(attribute)));<NEW_LINE>}<NEW_LINE>}<NEW_LINE>int rows = deletion<MASK><NEW_LINE>boolean cascaded = clearAssociations(entity, proxy);<NEW_LINE>if (!cascaded) {<NEW_LINE>checkRowsAffected(rows, entity, proxy);<NEW_LINE>}<NEW_LINE>context.getStateListener().postDelete(entity, proxy);<NEW_LINE>} | .get().value(); |
1,133,680 | public RuleResult execute(Map<String, String> ruleParam, Map<String, String> resourceAttributes) {<NEW_LINE>logger.debug("========CheckAWSCloudTrailConfig started=========");<NEW_LINE>Annotation annotation = null;<NEW_LINE>String <MASK><NEW_LINE>String severity = ruleParam.get(PacmanRuleConstants.SEVERITY);<NEW_LINE>String category = ruleParam.get(PacmanRuleConstants.CATEGORY);<NEW_LINE>MDC.put("executionId", ruleParam.get("executionId"));<NEW_LINE>MDC.put("ruleId", ruleParam.get(PacmanSdkConstants.RULE_ID));<NEW_LINE>List<LinkedHashMap<String, Object>> issueList = new ArrayList<>();<NEW_LINE>LinkedHashMap<String, Object> issue = new LinkedHashMap<>();<NEW_LINE>if (!PacmanUtils.doesAllHaveValue(severity, category, cloudTrailInput)) {<NEW_LINE>logger.info(PacmanRuleConstants.MISSING_CONFIGURATION);<NEW_LINE>throw new InvalidInputException(PacmanRuleConstants.MISSING_CONFIGURATION);<NEW_LINE>}<NEW_LINE>String cloudTrail = resourceAttributes.get("cloudtrailname");<NEW_LINE>List<String> cloudtrail = new ArrayList(Arrays.asList(cloudTrail.split(",")));<NEW_LINE>if (!cloudtrail.contains(cloudTrailInput)) {<NEW_LINE>annotation = Annotation.buildAnnotation(ruleParam, Annotation.Type.ISSUE);<NEW_LINE>annotation.put(PacmanSdkConstants.DESCRIPTION, "Cloudtrail multiregion is not enabled!!");<NEW_LINE>annotation.put(PacmanRuleConstants.SEVERITY, severity);<NEW_LINE>annotation.put(PacmanRuleConstants.CATEGORY, category);<NEW_LINE>issue.put(PacmanRuleConstants.VIOLATION_REASON, "Cloudtrail multiregion is not enabled!!");<NEW_LINE>issueList.add(issue);<NEW_LINE>annotation.put("issueDetails", issueList.toString());<NEW_LINE>return new RuleResult(PacmanSdkConstants.STATUS_FAILURE, PacmanRuleConstants.FAILURE_MESSAGE, annotation);<NEW_LINE>}<NEW_LINE>logger.debug("========CheckAWSCloudTrailConfig ended=========");<NEW_LINE>return new RuleResult(PacmanSdkConstants.STATUS_SUCCESS, PacmanRuleConstants.SUCCESS_MESSAGE);<NEW_LINE>} | cloudTrailInput = ruleParam.get("inputCloudTrailName"); |
349,930 | public EnableUserResult unmarshall(JsonUnmarshallerContext context) throws Exception {<NEW_LINE>EnableUserResult enableUserResult = new EnableUserResult();<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 enableUserResult;<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("userId", targetDepth)) {<NEW_LINE>context.nextToken();<NEW_LINE>enableUserResult.setUserId(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 enableUserResult;<NEW_LINE>} | int originalDepth = context.getCurrentDepth(); |
1,489,167 | protected void buildBodyDeclarations(org.eclipse.jdt.internal.compiler.ast.TypeDeclaration expression, AnonymousClassDeclaration anonymousClassDeclaration) {<NEW_LINE>// add body declaration in the lexical order<NEW_LINE>org.eclipse.jdt.internal.compiler.ast.TypeDeclaration[] members = expression.memberTypes;<NEW_LINE>org.eclipse.jdt.internal.compiler.ast.FieldDeclaration[] fields = expression.fields;<NEW_LINE>org.eclipse.jdt.internal.compiler.ast.AbstractMethodDeclaration[] methods = expression.methods;<NEW_LINE>int fieldsLength = fields == null ? 0 : fields.length;<NEW_LINE>int methodsLength = methods == null ? 0 : methods.length;<NEW_LINE>int membersLength = members == null ? 0 : members.length;<NEW_LINE>int fieldsIndex = 0;<NEW_LINE>int methodsIndex = 0;<NEW_LINE>int membersIndex = 0;<NEW_LINE>while ((fieldsIndex < fieldsLength) || (membersIndex < membersLength) || (methodsIndex < methodsLength)) {<NEW_LINE>org.eclipse.jdt.internal.compiler.ast.FieldDeclaration nextFieldDeclaration = null;<NEW_LINE>org.eclipse.jdt.internal.compiler.ast.AbstractMethodDeclaration nextMethodDeclaration = null;<NEW_LINE>org.eclipse.jdt.internal.compiler.ast.TypeDeclaration nextMemberDeclaration = null;<NEW_LINE>int position = Integer.MAX_VALUE;<NEW_LINE>int nextDeclarationType = -1;<NEW_LINE>if (fieldsIndex < fieldsLength) {<NEW_LINE>nextFieldDeclaration = fields[fieldsIndex];<NEW_LINE>if (nextFieldDeclaration.declarationSourceStart < position) {<NEW_LINE>position = nextFieldDeclaration.declarationSourceStart;<NEW_LINE>// FIELD<NEW_LINE>nextDeclarationType = 0;<NEW_LINE>}<NEW_LINE>}<NEW_LINE>if (methodsIndex < methodsLength) {<NEW_LINE>nextMethodDeclaration = methods[methodsIndex];<NEW_LINE>if (nextMethodDeclaration.declarationSourceStart < position) {<NEW_LINE>position = nextMethodDeclaration.declarationSourceStart;<NEW_LINE>// METHOD<NEW_LINE>nextDeclarationType = 1;<NEW_LINE>}<NEW_LINE>}<NEW_LINE>if (membersIndex < membersLength) {<NEW_LINE>nextMemberDeclaration = members[membersIndex];<NEW_LINE>if (nextMemberDeclaration.declarationSourceStart < position) {<NEW_LINE>position = nextMemberDeclaration.declarationSourceStart;<NEW_LINE>// MEMBER<NEW_LINE>nextDeclarationType = 2;<NEW_LINE>}<NEW_LINE>}<NEW_LINE>switch(nextDeclarationType) {<NEW_LINE>case 0:<NEW_LINE>if (nextFieldDeclaration.getKind() == AbstractVariableDeclaration.ENUM_CONSTANT) {<NEW_LINE>anonymousClassDeclaration.bodyDeclarations().add(convert(nextFieldDeclaration));<NEW_LINE>} else {<NEW_LINE>checkAndAddMultipleFieldDeclaration(fields, fieldsIndex, anonymousClassDeclaration.bodyDeclarations());<NEW_LINE>}<NEW_LINE>fieldsIndex++;<NEW_LINE>break;<NEW_LINE>case 1:<NEW_LINE>methodsIndex++;<NEW_LINE>if (!nextMethodDeclaration.isDefaultConstructor() && !nextMethodDeclaration.isClinit()) {<NEW_LINE>anonymousClassDeclaration.bodyDeclarations().add(convert(false, nextMethodDeclaration));<NEW_LINE>}<NEW_LINE>break;<NEW_LINE>case 2:<NEW_LINE>membersIndex++;<NEW_LINE>ASTNode node = convert(nextMemberDeclaration);<NEW_LINE>if (node == null) {<NEW_LINE>anonymousClassDeclaration.setFlags(anonymousClassDeclaration.<MASK><NEW_LINE>} else {<NEW_LINE>anonymousClassDeclaration.bodyDeclarations().add(node);<NEW_LINE>}<NEW_LINE>}<NEW_LINE>}<NEW_LINE>} | getFlags() | ASTNode.MALFORMED); |
1,854,957 | public void unmarkAsToBeDeleted(Transaction transaction) throws SIResourceException {<NEW_LINE>if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled())<NEW_LINE>SibTr.entry(tc, "unmarkAsToBeDeleted", transaction);<NEW_LINE>toBeDeleted = Boolean.FALSE;<NEW_LINE>try {<NEW_LINE>this.requestUpdate(transaction);<NEW_LINE>} catch (MessageStoreException e) {<NEW_LINE>// MessageStoreException shouldn't occur so FFDC.<NEW_LINE>FFDCFilter.processException(e, "com.ibm.ws.sib.processor.impl.store.itemstreams.PtoPMessageItemStream.unmarkAsToBeDeleted", "1:336:1.93.1.14", this);<NEW_LINE>SibTr.exception(tc, e);<NEW_LINE>if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled())<NEW_LINE>SibTr.<MASK><NEW_LINE>throw new SIResourceException(e);<NEW_LINE>}<NEW_LINE>if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled())<NEW_LINE>SibTr.exit(tc, "unmarkAsToBeDeleted");<NEW_LINE>return;<NEW_LINE>} | exit(tc, "unmarkAsToBeDeleted", e); |
383,244 | public com.amazonaws.services.lexmodelbuilding.model.ResourceInUseException unmarshallFromContext(JsonUnmarshallerContext context) throws Exception {<NEW_LINE>com.amazonaws.services.lexmodelbuilding.model.ResourceInUseException resourceInUseException = new com.amazonaws.services.lexmodelbuilding.model.ResourceInUseException(null);<NEW_LINE>int originalDepth = context.getCurrentDepth();<NEW_LINE>String currentParentElement = context.getCurrentParentElement();<NEW_LINE>int targetDepth = originalDepth + 1;<NEW_LINE><MASK><NEW_LINE>if (token == null)<NEW_LINE>token = context.nextToken();<NEW_LINE>if (token == VALUE_NULL) {<NEW_LINE>return null;<NEW_LINE>}<NEW_LINE>while (true) {<NEW_LINE>if (token == null)<NEW_LINE>break;<NEW_LINE>if (token == FIELD_NAME || token == START_OBJECT) {<NEW_LINE>if (context.testExpression("referenceType", targetDepth)) {<NEW_LINE>context.nextToken();<NEW_LINE>resourceInUseException.setReferenceType(context.getUnmarshaller(String.class).unmarshall(context));<NEW_LINE>}<NEW_LINE>if (context.testExpression("exampleReference", targetDepth)) {<NEW_LINE>context.nextToken();<NEW_LINE>resourceInUseException.setExampleReference(ResourceReferenceJsonUnmarshaller.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 resourceInUseException;<NEW_LINE>} | JsonToken token = context.getCurrentToken(); |
1,375,298 | private void decodeFlags(Position position, int flags) {<NEW_LINE>position.setValid(BitUtil.to(flags, 2) > 0);<NEW_LINE>if (BitUtil.check(flags, 1)) {<NEW_LINE>position.set(Position.KEY_APPROXIMATE, true);<NEW_LINE>}<NEW_LINE>if (BitUtil.check(flags, 2)) {<NEW_LINE>position.set(Position.KEY_ALARM, Position.ALARM_FAULT);<NEW_LINE>}<NEW_LINE>if (BitUtil.check(flags, 6)) {<NEW_LINE>position.set(Position.KEY_ALARM, Position.ALARM_SOS);<NEW_LINE>}<NEW_LINE>if (BitUtil.check(flags, 7)) {<NEW_LINE>position.set(Position.KEY_ALARM, Position.ALARM_OVERSPEED);<NEW_LINE>}<NEW_LINE>if (BitUtil.check(flags, 8)) {<NEW_LINE>position.set(<MASK><NEW_LINE>}<NEW_LINE>if (BitUtil.check(flags, 9) || BitUtil.check(flags, 10) || BitUtil.check(flags, 11)) {<NEW_LINE>position.set(Position.KEY_ALARM, Position.ALARM_GEOFENCE);<NEW_LINE>}<NEW_LINE>if (BitUtil.check(flags, 12)) {<NEW_LINE>position.set(Position.KEY_ALARM, Position.ALARM_LOW_BATTERY);<NEW_LINE>}<NEW_LINE>if (BitUtil.check(flags, 15) || BitUtil.check(flags, 14)) {<NEW_LINE>position.set(Position.KEY_ALARM, Position.ALARM_MOVEMENT);<NEW_LINE>}<NEW_LINE>position.set(Position.KEY_RSSI, BitUtil.between(flags, 16, 21));<NEW_LINE>position.set(Position.KEY_CHARGE, BitUtil.check(flags, 22));<NEW_LINE>} | Position.KEY_ALARM, Position.ALARM_FALL_DOWN); |
1,185,060 | protected boolean timerJobForPlanItemInstanceExists(CommandContext commandContext, PlanItemInstanceEntity planItemInstance) {<NEW_LINE>// For the same plan item, only one timer job can ever be active at any given time.<NEW_LINE>// Since the DefaultJobManager creates a new timer job on repeat, we need to make sure<NEW_LINE>// we're not creating duplicate timers on the create or initiate transition (which does need to happen on the first repeat).<NEW_LINE>//<NEW_LINE>// The alternative implementation would be to move the repeating timer creation to the onStateTransition on occur,<NEW_LINE>// but this would also require similar logic to look up the previous timer job, as the previous repeat value is needed to calculate the next.<NEW_LINE>CmmnEngineConfiguration cmmnEngineConfiguration = CommandContextUtil.getCmmnEngineConfiguration(commandContext);<NEW_LINE>List<TimerJobEntity> jobsByScopeIdAndSubScopeId = cmmnEngineConfiguration.getJobServiceConfiguration().getTimerJobEntityManager().findJobsByScopeIdAndSubScopeId(planItemInstance.getCaseInstanceId(<MASK><NEW_LINE>return jobsByScopeIdAndSubScopeId != null && !jobsByScopeIdAndSubScopeId.isEmpty();<NEW_LINE>} | ), planItemInstance.getId()); |
804,286 | public void prepareExpressions() throws UserException {<NEW_LINE>List<Expr> selectList = Expr.cloneList(queryStmt.getBaseTblResultExprs());<NEW_LINE>// check type compatibility<NEW_LINE>int numCols = targetColumns.size();<NEW_LINE>for (int i = 0; i < numCols; ++i) {<NEW_LINE>Column col = targetColumns.get(i);<NEW_LINE>Expr expr = checkTypeCompatibility(col, selectList.get(i));<NEW_LINE>selectList.set(i, expr);<NEW_LINE>exprByName.put(col.getName(), expr);<NEW_LINE>}<NEW_LINE>// reorder resultExprs in table column order<NEW_LINE>for (Column col : targetTable.getFullSchema()) {<NEW_LINE>if (exprByName.containsKey(col.getName())) {<NEW_LINE>resultExprs.add(exprByName.get(col.getName()));<NEW_LINE>} else {<NEW_LINE>Column.<MASK><NEW_LINE>if (defaultValueType == Column.DefaultValueType.NULL) {<NEW_LINE>Preconditions.checkState(col.isAllowNull());<NEW_LINE>resultExprs.add(NullLiteral.create(col.getType()));<NEW_LINE>} else if (defaultValueType == Column.DefaultValueType.CONST) {<NEW_LINE>resultExprs.add(checkTypeCompatibility(col, new StringLiteral(col.calculatedDefaultValue())));<NEW_LINE>} else if (defaultValueType == Column.DefaultValueType.VARY) {<NEW_LINE>throw new AnalysisException("Column " + col.getName() + " has unsupported default value:" + col.getDefaultExpr().getExpr());<NEW_LINE>}<NEW_LINE>}<NEW_LINE>}<NEW_LINE>} | DefaultValueType defaultValueType = col.getDefaultValueType(); |
1,278,546 | private String performReplacement(ReplacementProperty replacementProperty, String content) {<NEW_LINE>String evaluationContent = content;<NEW_LINE>if (evaluationContent == null || evaluationContent.isEmpty() || replacementProperty.isForceValueEvaluation()) {<NEW_LINE>evaluationContent = replacementProperty.getValue();<NEW_LINE>}<NEW_LINE>String result = "";<NEW_LINE>try {<NEW_LINE>result = Optional.ofNullable(expressionEvaluator.evaluate(evaluationContent)).map(x -> x.toString<MASK><NEW_LINE>} catch (Exception e) {<NEW_LINE>log.error("Something went wrong performing the replacement.", e);<NEW_LINE>}<NEW_LINE>if (replacementProperty != null) {<NEW_LINE>result = performTransformationRules(replacementProperty, result, TransformationRule.ApplyEnum.BEFORE);<NEW_LINE>if (replacementProperty.isRegex()) {<NEW_LINE>result = replaceRegex(result, replacementProperty.getToken(), replacementProperty.getValue());<NEW_LINE>} else {<NEW_LINE>result = replaceNonRegex(result, replacementProperty.getToken(), replacementProperty.getValue());<NEW_LINE>}<NEW_LINE>result = performTransformationRules(replacementProperty, result, TransformationRule.ApplyEnum.AFTER);<NEW_LINE>}<NEW_LINE>return result;<NEW_LINE>} | ()).orElse(evaluationContent); |
1,355,588 | private void formulateFolders() {<NEW_LINE>systemDir = addHomeDir(systemDir);<NEW_LINE>schemaDir = addHomeDir(schemaDir);<NEW_LINE>syncDir = addHomeDir(syncDir);<NEW_LINE>tracingDir = addHomeDir(tracingDir);<NEW_LINE>walDir = addHomeDir(walDir);<NEW_LINE>indexRootFolder = addHomeDir(indexRootFolder);<NEW_LINE>extDir = addHomeDir(extDir);<NEW_LINE>udfDir = addHomeDir(udfDir);<NEW_LINE>triggerDir = addHomeDir(triggerDir);<NEW_LINE>mqttDir = addHomeDir(mqttDir);<NEW_LINE>if (TSFileDescriptor.getInstance().getConfig().getTSFileStorageFs().equals(FSType.HDFS)) {<NEW_LINE>String hdfsDir = getHdfsDir();<NEW_LINE>queryDir <MASK><NEW_LINE>for (int i = 0; i < dataDirs.length; i++) {<NEW_LINE>dataDirs[i] = hdfsDir + File.separatorChar + dataDirs[i];<NEW_LINE>}<NEW_LINE>} else {<NEW_LINE>queryDir = addHomeDir(queryDir);<NEW_LINE>for (int i = 0; i < dataDirs.length; i++) {<NEW_LINE>dataDirs[i] = addHomeDir(dataDirs[i]);<NEW_LINE>}<NEW_LINE>}<NEW_LINE>} | = hdfsDir + File.separatorChar + queryDir; |
252,034 | public void buildClassParameters(Collection<? extends Abstract.FieldParameter> absParameters, Concrete.ClassDefinition classDef, List<Concrete.ClassElement> elements) {<NEW_LINE>for (Abstract.FieldParameter absParameter : absParameters) {<NEW_LINE>Concrete.Parameter parameter = buildParameter(absParameter, false, false);<NEW_LINE>if (parameter.getType() != null) {<NEW_LINE>boolean forced = absParameter.isClassifying();<NEW_LINE>boolean explicit = parameter.isExplicit();<NEW_LINE>for (Referable referable : parameter.getReferableList()) {<NEW_LINE>if (referable instanceof TCFieldReferable) {<NEW_LINE>if (forced || explicit) {<NEW_LINE>setClassifyingField(classDef, (TCFieldReferable) referable, parameter, forced);<NEW_LINE>}<NEW_LINE>elements.add(new Concrete.ClassField((TCFieldReferable) referable, classDef, explicit, ClassFieldKind.ANY, new ArrayList<>(), parameter.getType(), null, absParameter.isCoerce()));<NEW_LINE>} else {<NEW_LINE>myErrorReporter.report(new AbstractExpressionError(GeneralError.Level.ERROR, "Incorrect field parameter", referable));<NEW_LINE>}<NEW_LINE>}<NEW_LINE>} else {<NEW_LINE>myErrorReporter.report(new AbstractExpressionError(GeneralError.Level.ERROR, "Expected a typed parameter"<MASK><NEW_LINE>}<NEW_LINE>}<NEW_LINE>} | , parameter.getData())); |
364,482 | default void load(Path path) throws IOException {<NEW_LINE>JsonObject json = Json.parse(FileUtils.readFileToString(path.toFile(), StandardCharsets.UTF_8)).asObject();<NEW_LINE>for (FieldWrapper field : getConfigFields()) {<NEW_LINE>String name = field.key();<NEW_LINE>if (name == null)<NEW_LINE>continue;<NEW_LINE>final JsonValue value = json.get(name);<NEW_LINE>if (value != null) {<NEW_LINE>try {<NEW_LINE>Class<?> type = field.type();<NEW_LINE>if (type.equals(Boolean.TYPE))<NEW_LINE>field.set(value.asBoolean());<NEW_LINE>else if (type.equals(Integer.TYPE))<NEW_LINE>field.<MASK><NEW_LINE>else if (type.equals(Long.TYPE))<NEW_LINE>field.set(value.asLong());<NEW_LINE>else if (type.equals(Float.TYPE))<NEW_LINE>field.set(value.asFloat());<NEW_LINE>else if (type.equals(Double.TYPE))<NEW_LINE>field.set(value.asDouble());<NEW_LINE>else if (type.equals(String.class))<NEW_LINE>field.set(value.asString());<NEW_LINE>else if (type.isEnum())<NEW_LINE>field.set(Enum.valueOf((Class<? extends Enum>) (Class<?>) field.type(), value.asString()));<NEW_LINE>else if (type.equals(Resource.class)) {<NEW_LINE>JsonObject object = value.asObject();<NEW_LINE>String resPath = object.getString("path", null);<NEW_LINE>if (object.getBoolean("internal", true))<NEW_LINE>field.set(Resource.internal(resPath));<NEW_LINE>else<NEW_LINE>field.set(Resource.external(resPath));<NEW_LINE>} else if (type.equals(List.class)) {<NEW_LINE>List<Object> list = new ArrayList<>();<NEW_LINE>JsonArray array = value.asArray();<NEW_LINE>// We're gonna assume our lists just hold strings<NEW_LINE>array.forEach(v -> {<NEW_LINE>if (v.isString())<NEW_LINE>list.add(v.asString());<NEW_LINE>else<NEW_LINE>warn("Didn't properly load config for {}, expected all string arguments", name);<NEW_LINE>});<NEW_LINE>field.set(list);<NEW_LINE>} else if (supported(type))<NEW_LINE>loadType(field, type, value);<NEW_LINE>else<NEW_LINE>warn("Didn't load config for {}, unsure how to serialize.", name);<NEW_LINE>} catch (Exception ex) {<NEW_LINE>error(ex, "Skipping bad option: {} - {}", path.getFileName(), name);<NEW_LINE>}<NEW_LINE>}<NEW_LINE>}<NEW_LINE>onLoad();<NEW_LINE>} | set(value.asInt()); |
1,793,543 | void put(String userId, DateTime returnedTokenRefillTime) {<NEW_LINE>tokensMap.computeIfPresent(userId, (user, availableTokens) -> {<NEW_LINE>DateTime now = clock.nowUtc();<NEW_LINE>int currentTokenCount = availableTokens.value();<NEW_LINE><MASK><NEW_LINE>int newTokenCount;<NEW_LINE>// Check if quota is unlimited.<NEW_LINE>if (!config.hasUnlimitedTokens(userId)) {<NEW_LINE>// Check if refill is enabled and a refill is needed.<NEW_LINE>if (!config.getRefillPeriod(user).isEqual(Duration.ZERO) && !new Duration(availableTokens.timestamp(), now).isShorterThan(config.getRefillPeriod(user))) {<NEW_LINE>currentTokenCount = config.getTokenAmount(user);<NEW_LINE>refillTime = now;<NEW_LINE>}<NEW_LINE>// If the returned token comes from the current pool, add it back, otherwise discard it.<NEW_LINE>newTokenCount = returnedTokenRefillTime.equals(refillTime) ? min(currentTokenCount + 1, config.getTokenAmount(userId)) : currentTokenCount;<NEW_LINE>} else {<NEW_LINE>newTokenCount = SENTINEL_UNLIMITED_TOKENS;<NEW_LINE>}<NEW_LINE>return TimestampedInteger.create(newTokenCount, refillTime);<NEW_LINE>});<NEW_LINE>} | DateTime refillTime = availableTokens.timestamp(); |
848,632 | public ExprNode validate(ExprValidationContext validationContext) throws ExprValidationException {<NEW_LINE>if (validationContext.getContextDescriptor() == null) {<NEW_LINE>throw new ExprValidationException("Context property '" + propertyName + "' cannot be used in the expression as provided");<NEW_LINE>}<NEW_LINE>EventTypeSPI eventType = (EventTypeSPI) validationContext.getContextDescriptor()<MASK><NEW_LINE>if (eventType == null) {<NEW_LINE>throw new ExprValidationException("Context property '" + propertyName + "' cannot be used in the expression as provided");<NEW_LINE>}<NEW_LINE>getter = eventType.getGetterSPI(propertyName);<NEW_LINE>EPType propertyType = eventType.getPropertyEPType(propertyName);<NEW_LINE>if (getter == null || propertyType == null) {<NEW_LINE>throw new ExprValidationException("Context property '" + propertyName + "' is not a known property, known properties are " + Arrays.toString(eventType.getPropertyNames()));<NEW_LINE>}<NEW_LINE>returnType = JavaClassHelper.getBoxedType(propertyType);<NEW_LINE>return null;<NEW_LINE>} | .getContextPropertyRegistry().getContextEventType(); |
1,600,229 | public void visit(ClassDeclaration node) {<NEW_LINE><MASK><NEW_LINE>if (includeWSBeforePHPDoc) {<NEW_LINE>formatTokens.add(new FormatToken(FormatToken.Kind.WHITESPACE_BEFORE_CLASS, ts.offset()));<NEW_LINE>} else {<NEW_LINE>includeWSBeforePHPDoc = true;<NEW_LINE>}<NEW_LINE>scan(node.getAttributes());<NEW_LINE>while (ts.moveNext() && ts.token().id() != PHPTokenId.PHP_CURLY_OPEN) {<NEW_LINE>switch(ts.token().id()) {<NEW_LINE>case PHP_CLASS:<NEW_LINE>if (!ClassDeclaration.Modifier.NONE.equals(node.getModifier())) {<NEW_LINE>FormatToken lastWhitespace = formatTokens.remove(formatTokens.size() - 1);<NEW_LINE>formatTokens.add(new FormatToken(FormatToken.Kind.WHITESPACE_AFTER_MODIFIERS, lastWhitespace.getOffset(), lastWhitespace.getOldText()));<NEW_LINE>}<NEW_LINE>addFormatToken(formatTokens);<NEW_LINE>break;<NEW_LINE>case PHP_IMPLEMENTS:<NEW_LINE>if (node.getInterfaes().size() > 0) {<NEW_LINE>formatTokens.add(new FormatToken(FormatToken.Kind.WHITESPACE_BEFORE_EXTENDS_IMPLEMENTS, ts.offset()));<NEW_LINE>ts.movePrevious();<NEW_LINE>addListOfNodes(node.getInterfaes(), FormatToken.Kind.WHITESPACE_IN_INTERFACE_LIST);<NEW_LINE>}<NEW_LINE>break;<NEW_LINE>case PHP_EXTENDS:<NEW_LINE>formatTokens.add(new FormatToken(FormatToken.Kind.WHITESPACE_BEFORE_EXTENDS_IMPLEMENTS, ts.offset()));<NEW_LINE>addFormatToken(formatTokens);<NEW_LINE>break;<NEW_LINE>default:<NEW_LINE>addFormatToken(formatTokens);<NEW_LINE>}<NEW_LINE>}<NEW_LINE>ts.movePrevious();<NEW_LINE>scan(node.getName());<NEW_LINE>scan(node.getSuperClass());<NEW_LINE>scan(node.getInterfaes());<NEW_LINE>scan(node.getBody());<NEW_LINE>} | addAllUntilOffset(node.getStartOffset()); |
10,472 | public ReleaseStaticIpResult unmarshall(JsonUnmarshallerContext context) throws Exception {<NEW_LINE>ReleaseStaticIpResult releaseStaticIpResult = new ReleaseStaticIpResult();<NEW_LINE>int originalDepth = context.getCurrentDepth();<NEW_LINE>String currentParentElement = context.getCurrentParentElement();<NEW_LINE>int targetDepth = originalDepth + 1;<NEW_LINE><MASK><NEW_LINE>if (token == null)<NEW_LINE>token = context.nextToken();<NEW_LINE>if (token == VALUE_NULL) {<NEW_LINE>return releaseStaticIpResult;<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("operations", targetDepth)) {<NEW_LINE>context.nextToken();<NEW_LINE>releaseStaticIpResult.setOperations(new ListUnmarshaller<Operation>(OperationJsonUnmarshaller.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 releaseStaticIpResult;<NEW_LINE>} | JsonToken token = context.getCurrentToken(); |
682,784 | private void checkSubFieldAndWriteData(String[] subFields, int index, Property parentProp, String dataCell, int forSelectUse, List<String> dataList) throws ClassNotFoundException {<NEW_LINE>if (index < subFields.length) {<NEW_LINE>if (parentProp.getTarget() != null) {<NEW_LINE>Mapper mapper = advancedImportService.getMapper(parentProp.getTarget().getName());<NEW_LINE>Property childProp = mapper.getProperty(subFields[index]);<NEW_LINE>if (childProp != null && childProp.getTarget() != null) {<NEW_LINE>this.checkSubFieldAndWriteData(subFields, index + 1, <MASK><NEW_LINE>} else {<NEW_LINE>if (!Strings.isNullOrEmpty(childProp.getSelection())) {<NEW_LINE>this.writeSelectionData(childProp.getSelection(), dataCell, forSelectUse, dataList);<NEW_LINE>} else {<NEW_LINE>dataList.add(dataCell);<NEW_LINE>}<NEW_LINE>}<NEW_LINE>}<NEW_LINE>}<NEW_LINE>} | childProp, dataCell, forSelectUse, dataList); |
1,549,267 | final DeleteAccessResult executeDeleteAccess(DeleteAccessRequest deleteAccessRequest) {<NEW_LINE>ExecutionContext executionContext = createExecutionContext(deleteAccessRequest);<NEW_LINE>AWSRequestMetrics awsRequestMetrics = executionContext.getAwsRequestMetrics();<NEW_LINE>awsRequestMetrics.startEvent(Field.ClientExecuteTime);<NEW_LINE>Request<DeleteAccessRequest> request = null;<NEW_LINE>Response<DeleteAccessResult> response = null;<NEW_LINE>try {<NEW_LINE>awsRequestMetrics.startEvent(Field.RequestMarshallTime);<NEW_LINE>try {<NEW_LINE>request = new DeleteAccessRequestProtocolMarshaller(protocolFactory).marshall(super.beforeMarshalling(deleteAccessRequest));<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, "Transfer");<NEW_LINE>request.addHandlerContext(HandlerContextKey.OPERATION_NAME, "DeleteAccess");<NEW_LINE>request.addHandlerContext(HandlerContextKey.ADVANCED_CONFIG, advancedConfig);<NEW_LINE>} finally {<NEW_LINE>awsRequestMetrics.endEvent(Field.RequestMarshallTime);<NEW_LINE>}<NEW_LINE>HttpResponseHandler<AmazonWebServiceResponse<DeleteAccessResult>> responseHandler = protocolFactory.createResponseHandler(new JsonOperationMetadata().withPayloadJson(true).withHasStreamingSuccessResponse(false), new DeleteAccessResultJsonUnmarshaller());<NEW_LINE>response = <MASK><NEW_LINE>return response.getAwsResponse();<NEW_LINE>} finally {<NEW_LINE>endClientExecution(awsRequestMetrics, request, response);<NEW_LINE>}<NEW_LINE>} | invoke(request, responseHandler, executionContext); |
148,061 | protected ShapeImpl applyTransition(ShapeImpl shape, Transition transition, boolean append) {<NEW_LINE>if (transition instanceof AddPropertyTransition) {<NEW_LINE>Property property = ((AddPropertyTransition) transition).getProperty();<NEW_LINE>ShapeImpl newShape;<NEW_LINE>if (append) {<NEW_LINE>Property newProperty = property.relocate(shape.allocator().moveLocation(property.getLocation()));<NEW_LINE>newShape = addProperty(shape, newProperty, true);<NEW_LINE>} else {<NEW_LINE>newShape = addProperty(shape, property, false);<NEW_LINE>}<NEW_LINE>return newShape;<NEW_LINE>} else if (transition instanceof ObjectTypeTransition) {<NEW_LINE>return shape.setDynamicType(((ObjectTypeTransition) transition).getObjectType());<NEW_LINE>} else if (transition instanceof ObjectFlagsTransition) {<NEW_LINE>return shape.setFlags(((ObjectFlagsTransition) transition).getObjectFlags());<NEW_LINE>} else if (transition instanceof DirectReplacePropertyTransition) {<NEW_LINE>Property oldProperty = ((DirectReplacePropertyTransition) transition).getPropertyBefore();<NEW_LINE>Property newProperty = ((DirectReplacePropertyTransition) transition).getPropertyAfter();<NEW_LINE>if (append) {<NEW_LINE>boolean sameLocation = oldProperty.getLocation().equals(newProperty.getLocation());<NEW_LINE>oldProperty = shape.getProperty(oldProperty.getKey());<NEW_LINE>Location newLocation;<NEW_LINE>if (sameLocation) {<NEW_LINE>newLocation = oldProperty.getLocation();<NEW_LINE>} else {<NEW_LINE>newLocation = shape.allocator().moveLocation(newProperty.getLocation());<NEW_LINE>}<NEW_LINE>newProperty = newProperty.relocate(newLocation);<NEW_LINE>}<NEW_LINE>return directReplaceProperty(<MASK><NEW_LINE>} else {<NEW_LINE>throw new UnsupportedOperationException(transition.getClass().getName());<NEW_LINE>}<NEW_LINE>} | shape, oldProperty, newProperty, append); |
545,862 | private boolean processStructMembers(XmlTreeNode root, Structure struct, boolean firstPass, boolean isVariableLength) {<NEW_LINE>boolean processedAll = true;<NEW_LINE>Iterator<XmlTreeNode> iter = root.getChildren("MEMBER");<NEW_LINE>while (iter.hasNext()) {<NEW_LINE>XmlTreeNode child = iter.next();<NEW_LINE>XmlElement childElem = child.getStartElement();<NEW_LINE>int offset = XmlUtilities.parseInt(childElem.getAttribute("OFFSET"));<NEW_LINE>DataType memberDT = findDataType(childElem);<NEW_LINE>if (memberDT != null) {<NEW_LINE>if (memberDT instanceof TerminatedStringDataType) {<NEW_LINE>// TerminatedCStringDataType no longer allowed in composites<NEW_LINE>memberDT = new StringDataType();<NEW_LINE>} else if (memberDT instanceof TerminatedUnicodeDataType) {<NEW_LINE>// TerminatedUnicodeStringDataType no longer allowed in composites<NEW_LINE>memberDT = new UnicodeDataType();<NEW_LINE>}<NEW_LINE>if (memberDT.getLength() == 0) {<NEW_LINE>return false;<NEW_LINE>}<NEW_LINE>String memberName = childElem.getAttribute("NAME");<NEW_LINE>String memberComment = getRegularComment(child);<NEW_LINE>int dtSize = memberDT.getLength();<NEW_LINE>int size = childElem.hasAttribute("SIZE") ? XmlUtilities.parseInt(childElem.getAttribute("SIZE")) : -1;<NEW_LINE>if (dtSize <= 0) {<NEW_LINE>dtSize = size;<NEW_LINE>if (dtSize < 0) {<NEW_LINE>log.appendMsg("No SIZE specified for member at offset " + offset + <MASK><NEW_LINE>dtSize = DEFAULT_SIZE;<NEW_LINE>}<NEW_LINE>}<NEW_LINE>// NOTE: Size consistency checking was removed since some types are filled-out<NEW_LINE>// lazily and may not have there ultimate size at this point.<NEW_LINE>DataTypeComponent member = null;<NEW_LINE>if (isVariableLength && offset >= struct.getLength()) {<NEW_LINE>member = struct.add(memberDT, dtSize, memberName, memberComment);<NEW_LINE>} else {<NEW_LINE>member = struct.replaceAtOffset(offset, memberDT, dtSize, memberName, memberComment);<NEW_LINE>}<NEW_LINE>processSettings(child, member.getDefaultSettings());<NEW_LINE>iter.remove();<NEW_LINE>} else {<NEW_LINE>processedAll = false;<NEW_LINE>}<NEW_LINE>}<NEW_LINE>return processedAll;<NEW_LINE>} | " of structure " + struct.getDisplayName()); |
76,346 | public void createTable(ObjectPath tablePath, CatalogBaseTable table, boolean ignoreIfExists) throws TableAlreadyExistException, DatabaseNotExistException, CatalogException {<NEW_LINE>tablePath = new ObjectPath(tablePath.getDatabaseName().toUpperCase(), tablePath.getObjectName().toUpperCase());<NEW_LINE>boolean tableExists = tableExists(tablePath);<NEW_LINE>if (ignoreIfExists && tableExists) {<NEW_LINE>return;<NEW_LINE>} else if (!ignoreIfExists && tableExists) {<NEW_LINE>throw new TableAlreadyExistException(getName(), tablePath);<NEW_LINE>}<NEW_LINE>try {<NEW_LINE>StringBuilder sbd = new StringBuilder();<NEW_LINE>sbd.append("CREATE TABLE ").append(tablePath.getFullName()).append(" (");<NEW_LINE>TableSchema schema = table.getSchema();<NEW_LINE>for (int i = 0; i < schema.getFieldCount(); i++) {<NEW_LINE>if (i > 0) {<NEW_LINE>sbd.append(", ");<NEW_LINE>}<NEW_LINE>String colName = schema.getFieldName(i).orElseThrow(() -> new IllegalArgumentException("Could not find the column in derby.")).toUpperCase();<NEW_LINE>DataType colType = schema.getFieldDataType(i).orElseThrow(() -> new IllegalArgumentException("Could not find the column in derby."));<NEW_LINE>String columnDefinition = flinkType2DerbyColumnDefinition(colType);<NEW_LINE>sbd.append(colName).append(" ").append(columnDefinition);<NEW_LINE>}<NEW_LINE>sbd.append(")");<NEW_LINE><MASK><NEW_LINE>} catch (SQLException ex) {<NEW_LINE>throw new CatalogException(ex);<NEW_LINE>}<NEW_LINE>} | executeSql(sbd.toString()); |
933,735 | public boolean validateMenuItem(final NSMenuItem item) {<NEW_LINE>final Selector action = item.action();<NEW_LINE>if (action.equals(Foundation.selector("paste:"))) {<NEW_LINE>final List<PathPasteboard<MASK><NEW_LINE>if (pasteboards.size() == 1) {<NEW_LINE>for (PathPasteboard pasteboard : pasteboards) {<NEW_LINE>if (pasteboard.size() == 1) {<NEW_LINE>item.setTitle(MessageFormat.format(LocaleFactory.localizedString("Paste {0}"), pasteboard.get(0).getName()));<NEW_LINE>} else {<NEW_LINE>item.setTitle(MessageFormat.format(LocaleFactory.localizedString("Paste {0}"), MessageFormat.format(LocaleFactory.localizedString("{0} Items"), String.valueOf(pasteboard.size())) + ")"));<NEW_LINE>}<NEW_LINE>}<NEW_LINE>} else {<NEW_LINE>item.setTitle(LocaleFactory.localizedString("Paste"));<NEW_LINE>}<NEW_LINE>}<NEW_LINE>return toolbarValidator.validate(action);<NEW_LINE>} | > pasteboards = PathPasteboardFactory.allPasteboards(); |
1,104,836 | public void channelRead(final ChannelHandlerContext ctx, final Object msg) {<NEW_LINE>if (msg instanceof MySQLHandshakePacket) {<NEW_LINE>MySQLHandshakePacket handshake = (MySQLHandshakePacket) msg;<NEW_LINE>MySQLHandshakeResponse41Packet handshakeResponsePacket = new MySQLHandshakeResponse41Packet(1, MAX_PACKET_SIZE, CHARACTER_SET, username);<NEW_LINE>handshakeResponsePacket.setAuthResponse(generateAuthResponse(handshake.getAuthPluginData().getAuthenticationPluginData()));<NEW_LINE>handshakeResponsePacket.setCapabilityFlags(generateClientCapability());<NEW_LINE>handshakeResponsePacket.setDatabase("mysql");<NEW_LINE>handshakeResponsePacket.setAuthPluginName(MySQLAuthenticationMethod.SECURE_PASSWORD_AUTHENTICATION);<NEW_LINE>ctx.<MASK><NEW_LINE>serverInfo = new ServerInfo();<NEW_LINE>serverInfo.setServerVersion(new ServerVersion(handshake.getServerVersion()));<NEW_LINE>return;<NEW_LINE>}<NEW_LINE>if (msg instanceof MySQLAuthSwitchRequestPacket) {<NEW_LINE>MySQLAuthSwitchRequestPacket authSwitchRequest = (MySQLAuthSwitchRequestPacket) msg;<NEW_LINE>ctx.channel().writeAndFlush(new MySQLAuthSwitchResponsePacket(authSwitchRequest.getSequenceId() + 1, PasswordEncryption.encryptWithSha2(password.getBytes(), authSwitchRequest.getAuthPluginData().getAuthenticationPluginData())));<NEW_LINE>seed = authSwitchRequest.getAuthPluginData().getAuthenticationPluginData();<NEW_LINE>return;<NEW_LINE>}<NEW_LINE>if (msg instanceof MySQLAuthMoreDataPacket) {<NEW_LINE>MySQLAuthMoreDataPacket authMoreData = (MySQLAuthMoreDataPacket) msg;<NEW_LINE>handleCachingSha2Auth(ctx, authMoreData);<NEW_LINE>return;<NEW_LINE>}<NEW_LINE>if (msg instanceof MySQLOKPacket) {<NEW_LINE>ctx.channel().pipeline().remove(this);<NEW_LINE>authResultCallback.setSuccess(serverInfo);<NEW_LINE>return;<NEW_LINE>}<NEW_LINE>MySQLErrPacket error = (MySQLErrPacket) msg;<NEW_LINE>ctx.channel().close();<NEW_LINE>throw new RuntimeException(error.getErrorMessage());<NEW_LINE>} | channel().writeAndFlush(handshakeResponsePacket); |
282,830 | <ToModelType> QueryInsertExecutorResult executeInsert(@NonNull final QueryInsertExecutor<ToModelType, T> queryInserter) {<NEW_LINE>Check.assume(!queryInserter.<MASK><NEW_LINE>final List<Object> sqlParams = new ArrayList<>();<NEW_LINE>final boolean collectSqlParamsFromSelectClause = unions == null || unions.isEmpty();<NEW_LINE>final TokenizedStringBuilder sqlToSelectColumns = new TokenizedStringBuilder("\n, ").setAutoAppendSeparator(true);<NEW_LINE>final TokenizedStringBuilder sqlFromSelectColumns = new TokenizedStringBuilder("\n, ").setAutoAppendSeparator(true);<NEW_LINE>for (final Map.Entry<String, IQueryInsertFromColumn> toColumnName2from : queryInserter.getColumnMapping().entrySet()) {<NEW_LINE>// To<NEW_LINE>final String toColumnName = toColumnName2from.getKey();<NEW_LINE>sqlToSelectColumns.append(toColumnName);<NEW_LINE>// From<NEW_LINE>final IQueryInsertFromColumn from = toColumnName2from.getValue();<NEW_LINE>final String fromSql = from.getSql(collectSqlParamsFromSelectClause ? sqlParams : null);<NEW_LINE>sqlFromSelectColumns.append(fromSql);<NEW_LINE>}<NEW_LINE>//<NEW_LINE>// Build sql: SELECT ... FROM ... WHERE ...<NEW_LINE>sqlFromSelectColumns.asStringBuilder().insert(0, "SELECT \n");<NEW_LINE>final StringBuilder fromClause = new StringBuilder(" FROM ").append(getSqlFrom());<NEW_LINE>final String groupByClause = null;<NEW_LINE>// useOrderByClause=false<NEW_LINE>final String sqlFrom = buildSQL(sqlFromSelectColumns.asStringBuilder(), fromClause, groupByClause, false);<NEW_LINE>sqlParams.addAll(getParametersEffective());<NEW_LINE>//<NEW_LINE>// Build sql: INSERT INTO ... SELECT ... FROM ... WHERE ...<NEW_LINE>final StringBuilder sqlInsert = new StringBuilder().append("INSERT INTO ").append(queryInserter.getToTableName()).append(" (").append("\n").append(sqlToSelectColumns).append("\n)\n").append(sqlFrom);<NEW_LINE>//<NEW_LINE>// Wrap the INSERT SQL and create the insert selection ID if required<NEW_LINE>final PInstanceId insertSelectionId;<NEW_LINE>final String sql;<NEW_LINE>if (queryInserter.isCreateSelectionOfInsertedRows()) {<NEW_LINE>insertSelectionId = Services.get(IADPInstanceDAO.class).createSelectionId();<NEW_LINE>final String toKeyColumnName = queryInserter.getToKeyColumnName();<NEW_LINE>sql = //<NEW_LINE>new StringBuilder().append("WITH insert_code AS (").append("\n").append(sqlInsert).append("\n RETURNING ").append(toKeyColumnName).append("\n )").append("\n INSERT INTO T_Selection (AD_PInstance_ID, T_Selection_ID)").append("\n SELECT ").append(insertSelectionId.getRepoId()).append(", ").append(toKeyColumnName).append(//<NEW_LINE>" FROM insert_code").toString();<NEW_LINE>} else {<NEW_LINE>insertSelectionId = null;<NEW_LINE>sql = sqlInsert.toString();<NEW_LINE>}<NEW_LINE>//<NEW_LINE>// Execute the INSERT and return how many records were inserted<NEW_LINE>final int countInsert = DB.executeUpdateEx(sql, sqlParams.toArray(), getTrxName());<NEW_LINE>return QueryInsertExecutorResult.of(countInsert, insertSelectionId);<NEW_LINE>} | isEmpty(), "At least one column to be inserted needs to be specified: {}", queryInserter); |
1,474,262 | public Object aroundReadFrom(ReaderInterceptorContext ric) throws IOException, WebApplicationException {<NEW_LINE><MASK><NEW_LINE>// ric.setInputStream(new FilterInputStream(ric.getInputStream()) {<NEW_LINE>//<NEW_LINE>// final ByteArrayOutputStream baos = new ByteArrayOutputStream();<NEW_LINE>//<NEW_LINE>// @Override<NEW_LINE>// public int read(byte[] b, int off, int len) throws IOException {<NEW_LINE>// baos.write(b, off, len);<NEW_LINE>// // System.out.println("@@@@@@ " + b);<NEW_LINE>// return super.read(b, off, len);<NEW_LINE>// }<NEW_LINE>//<NEW_LINE>// @Override<NEW_LINE>// public void close() throws IOException {<NEW_LINE>// System.out.println("### " + baos.toString());<NEW_LINE>// super.close();<NEW_LINE>// }<NEW_LINE>// });<NEW_LINE>final InputStream old = ric.getInputStream();<NEW_LINE>ByteArrayOutputStream baos = new ByteArrayOutputStream();<NEW_LINE>int c;<NEW_LINE>while ((c = old.read()) != -1) {<NEW_LINE>baos.write(c);<NEW_LINE>}<NEW_LINE>System.out.println("MyClientReaderInterceptor --> " + baos.toString());<NEW_LINE>ric.setInputStream(new ByteArrayInputStream(baos.toByteArray()));<NEW_LINE>return ric.proceed();<NEW_LINE>} | System.out.println("MyClientReaderInterceptor"); |
782,900 | /*<NEW_LINE>* (non-Javadoc)<NEW_LINE>*<NEW_LINE>* @see AAA.summary.Refiner#refineP2Set(soot.jimple.spark.pag.VarNode, soot.jimple.spark.sets.PointsToSetInternal)<NEW_LINE>*/<NEW_LINE>protected boolean refineP2Set(VarNode v, PointsToSetInternal badLocs, HeuristicType heuristic) {<NEW_LINE>// logger.debug(""+badLocs);<NEW_LINE>this.doPointsTo = false;<NEW_LINE>this.fieldCheckHeuristic = HeuristicType.getHeuristic(heuristic, pag.getTypeManager(), getMaxPasses());<NEW_LINE>try {<NEW_LINE>numPasses = 0;<NEW_LINE>while (true) {<NEW_LINE>numPasses++;<NEW_LINE>if (DEBUG_PASS != -1 && numPasses > DEBUG_PASS) {<NEW_LINE>return false;<NEW_LINE>}<NEW_LINE>if (numPasses > maxPasses) {<NEW_LINE>return false;<NEW_LINE>}<NEW_LINE>if (DEBUG) {<NEW_LINE>logger.debug("PASS " + numPasses);<NEW_LINE>logger.debug("" + fieldCheckHeuristic);<NEW_LINE>}<NEW_LINE>clearState();<NEW_LINE>boolean success = false;<NEW_LINE>try {<NEW_LINE>success = refineP2Set(new VarAndContext<MASK><NEW_LINE>} catch (TerminateEarlyException e) {<NEW_LINE>success = false;<NEW_LINE>}<NEW_LINE>if (success) {<NEW_LINE>return true;<NEW_LINE>} else {<NEW_LINE>if (!fieldCheckHeuristic.runNewPass()) {<NEW_LINE>return false;<NEW_LINE>}<NEW_LINE>}<NEW_LINE>}<NEW_LINE>} finally {<NEW_LINE>}<NEW_LINE>} | (v, EMPTY_CALLSTACK), badLocs); |
1,432,643 | public void init(ClassProperties properties) {<NEW_LINE>String platform = properties.getProperty("platform");<NEW_LINE>List<String> preloads = properties.get("platform.preload");<NEW_LINE>List<String> resources = properties.get("platform.preloadresource");<NEW_LINE>// Only apply this at load time since we don't want to copy the CUDA libraries here<NEW_LINE>if (!Loader.isLoadLibraries()) {<NEW_LINE>return;<NEW_LINE>}<NEW_LINE>int i = 0;<NEW_LINE>String[] libs = { "cudart", "cublasLt", "cublas", "curand", "cusolver", "cusparse", "cudnn", "cudnn_ops_infer", "cudnn_ops_train", "cudnn_adv_infer", "cudnn_adv_train", "cudnn_cnn_infer", "cudnn_cnn_train" };<NEW_LINE>for (String lib : libs) {<NEW_LINE>if (platform.startsWith("linux")) {<NEW_LINE>lib += lib.startsWith("cudnn") ? "@.8" : lib.equals("curand") ? "@.10" : lib.equals("cudart") ? "@.11.0" : "@.11";<NEW_LINE>} else if (platform.startsWith("windows")) {<NEW_LINE>lib += lib.startsWith("cudnn") ? "64_8" : lib.equals("curand") ? "64_10" : lib.<MASK><NEW_LINE>} else {<NEW_LINE>// no CUDA<NEW_LINE>continue;<NEW_LINE>}<NEW_LINE>if (!preloads.contains(lib)) {<NEW_LINE>preloads.add(i++, lib);<NEW_LINE>}<NEW_LINE>}<NEW_LINE>if (i > 0) {<NEW_LINE>resources.add("/org/bytedeco/cuda/");<NEW_LINE>}<NEW_LINE>} | equals("cudart") ? "64_110" : "64_11"; |
80,313 | ActionResult<Wo> execute(EffectivePerson effectivePerson, String id, String workId) throws Exception {<NEW_LINE>ActionResult<Wo> result = new ActionResult<>();<NEW_LINE>Wo wo = new Wo();<NEW_LINE>String executorSeed = null;<NEW_LINE>try (EntityManagerContainer emc = EntityManagerContainerFactory.instance().create()) {<NEW_LINE>TaskCompleted taskCompleted = emc.fetch(id, TaskCompleted.class, ListTools.toList(TaskCompleted.job_FIELDNAME));<NEW_LINE>if (null == taskCompleted) {<NEW_LINE>throw new ExceptionEntityNotExist(id, TaskCompleted.class);<NEW_LINE>}<NEW_LINE>executorSeed = taskCompleted.getJob();<NEW_LINE>}<NEW_LINE>Callable<String> callable = new Callable<String>() {<NEW_LINE><NEW_LINE>public String call() throws Exception {<NEW_LINE>try (EntityManagerContainer emc = EntityManagerContainerFactory.instance().create()) {<NEW_LINE>TaskCompleted taskCompleted = emc.find(id, TaskCompleted.class);<NEW_LINE>if (null == taskCompleted) {<NEW_LINE>throw new ExceptionEntityNotExist(id, TaskCompleted.class);<NEW_LINE>}<NEW_LINE>Work work = emc.find(workId, Work.class);<NEW_LINE>if (null == work) {<NEW_LINE>throw new ExceptionEntityNotExist(workId, Work.class);<NEW_LINE>}<NEW_LINE>List<Task> list = emc.listEqual(Task.class, Task.work_FIELDNAME, work.getId());<NEW_LINE>for (Task task : list) {<NEW_LINE>MessageFactory.task_press(task, taskCompleted.getPerson());<NEW_LINE>wo.getValueList().<MASK><NEW_LINE>}<NEW_LINE>emc.beginTransaction(TaskCompleted.class);<NEW_LINE>if (!StringUtils.equals(taskCompleted.getPressActivityToken(), work.getActivityToken())) {<NEW_LINE>taskCompleted.setPressTime(new Date());<NEW_LINE>taskCompleted.setPressActivityToken(work.getActivityToken());<NEW_LINE>taskCompleted.setPressCount(1);<NEW_LINE>} else {<NEW_LINE>if (taskCompleted.getPressCount() != null && taskCompleted.getPressCount() > 0) {<NEW_LINE>taskCompleted.setPressCount(taskCompleted.getPressCount() + 1);<NEW_LINE>taskCompleted.setPressTime(new Date());<NEW_LINE>} else {<NEW_LINE>taskCompleted.setPressTime(new Date());<NEW_LINE>taskCompleted.setPressActivityToken(work.getActivityToken());<NEW_LINE>taskCompleted.setPressCount(1);<NEW_LINE>}<NEW_LINE>}<NEW_LINE>emc.commit();<NEW_LINE>}<NEW_LINE>return "";<NEW_LINE>}<NEW_LINE>};<NEW_LINE>ProcessPlatformExecutorFactory.get(executorSeed).submit(callable).get(300, TimeUnit.SECONDS);<NEW_LINE>result.setData(wo);<NEW_LINE>return result;<NEW_LINE>} | add(task.getPerson()); |
516,707 | private ReferenceBinding[] processClassNames(LookupEnvironment environment) {<NEW_LINE>// check for .class file presence in case of apt processing<NEW_LINE>int length = this.classNames.length;<NEW_LINE>ReferenceBinding[] referenceBindings = new ReferenceBinding[length];<NEW_LINE>ModuleBinding[] modules = new ModuleBinding[length];<NEW_LINE>Set<ModuleBinding> modSet = new HashSet<>();<NEW_LINE>String[] typeNames = new String[length];<NEW_LINE>if (this.complianceLevel <= ClassFileConstants.JDK1_8) {<NEW_LINE>typeNames = this.classNames;<NEW_LINE>} else {<NEW_LINE>for (int i = 0; i < length; i++) {<NEW_LINE>String currentName = this.classNames[i];<NEW_LINE>int idx = currentName.indexOf('/');<NEW_LINE>ModuleBinding mod = null;<NEW_LINE>if (idx > 0) {<NEW_LINE>String m = currentName.substring(0, idx);<NEW_LINE>mod = environment.getModule(m.toCharArray());<NEW_LINE>if (mod == null) {<NEW_LINE>// $NON-NLS-1$<NEW_LINE>throw new IllegalArgumentException(this<MASK><NEW_LINE>}<NEW_LINE>modules[i] = mod;<NEW_LINE>modSet.add(mod);<NEW_LINE>currentName = currentName.substring(idx + 1);<NEW_LINE>}<NEW_LINE>typeNames[i] = currentName;<NEW_LINE>}<NEW_LINE>}<NEW_LINE>for (int i = 0; i < length; i++) {<NEW_LINE>char[][] compoundName = null;<NEW_LINE>String cls = typeNames[i];<NEW_LINE>if (cls.indexOf('.') != -1) {<NEW_LINE>// consider names with '.' as fully qualified names<NEW_LINE>char[] typeName = cls.toCharArray();<NEW_LINE>compoundName = CharOperation.splitOn('.', typeName);<NEW_LINE>} else {<NEW_LINE>compoundName = new char[][] { cls.toCharArray() };<NEW_LINE>}<NEW_LINE>ModuleBinding mod = modules[i];<NEW_LINE>ReferenceBinding type = mod != null ? environment.getType(compoundName, mod) : environment.getType(compoundName);<NEW_LINE>if (type != null && type.isValidBinding()) {<NEW_LINE>if (type.isBinaryBinding()) {<NEW_LINE>referenceBindings[i] = type;<NEW_LINE>type.superclass();<NEW_LINE>}<NEW_LINE>} else {<NEW_LINE>throw new // $NON-NLS-1$<NEW_LINE>IllegalArgumentException(this.bind("configure.invalidClassName", this.classNames[i]));<NEW_LINE>}<NEW_LINE>}<NEW_LINE>return referenceBindings;<NEW_LINE>} | .bind("configure.invalidModuleName", m)); |
198,395 | public void deleteById(String id) {<NEW_LINE>String workspaceName = Utils.getValueFromIdByName(id, "workspaces");<NEW_LINE>if (workspaceName == null) {<NEW_LINE>throw LOGGER.logExceptionAsError(new IllegalArgumentException(String.format("The resource ID '%s' is not valid. Missing path segment 'workspaces'.", id)));<NEW_LINE>}<NEW_LINE>String kustoPoolName = Utils.getValueFromIdByName(id, "kustoPools");<NEW_LINE>if (kustoPoolName == null) {<NEW_LINE>throw LOGGER.logExceptionAsError(new IllegalArgumentException(String.format("The resource ID '%s' is not valid. Missing path segment 'kustoPools'.", id)));<NEW_LINE>}<NEW_LINE>String principalAssignmentName = Utils.getValueFromIdByName(id, "principalAssignments");<NEW_LINE>if (principalAssignmentName == null) {<NEW_LINE>throw LOGGER.logExceptionAsError(new IllegalArgumentException(String.format("The resource ID '%s' is not valid. Missing path segment 'principalAssignments'.", id)));<NEW_LINE>}<NEW_LINE>String resourceGroupName = <MASK><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(workspaceName, kustoPoolName, principalAssignmentName, resourceGroupName, Context.NONE);<NEW_LINE>} | Utils.getValueFromIdByName(id, "resourceGroups"); |
375,364 | public V put(final K key, final V value) {<NEW_LINE>int hash = hash(key);<NEW_LINE>MapEntry<K, V>[] table = this.entries;<NEW_LINE>while (true) {<NEW_LINE>int index = hash & (table.length - 1);<NEW_LINE>MapEntry<K, V> tombstone = null;<NEW_LINE>for (int i = index; i < table.length; i++) {<NEW_LINE>MapEntry<K, V> entry = table[i];<NEW_LINE>if (entry != null && !entry.deleted) {<NEW_LINE>if (entry.hash == hash && entry.key.equals(key)) {<NEW_LINE>return entry.setValue(value);<NEW_LINE>}<NEW_LINE>} else if (entry != null && entry.deleted) {<NEW_LINE>if (tombstone == null) {<NEW_LINE>tombstone = entry;<NEW_LINE>}<NEW_LINE>} else if (tombstone != null) {<NEW_LINE>this.size++;<NEW_LINE>tombstone.key = key;<NEW_LINE>tombstone.hash = hash;<NEW_LINE>tombstone.deleted = false;<NEW_LINE>resizeIfLoadHigh(table);<NEW_LINE>return tombstone.setValue(value);<NEW_LINE>} else {<NEW_LINE>entry = new MapEntry<K, V<MASK><NEW_LINE>table[i] = entry;<NEW_LINE>this.size++;<NEW_LINE>resizeIfLoadHigh(table);<NEW_LINE>return null;<NEW_LINE>}<NEW_LINE>}<NEW_LINE>table = resize(table);<NEW_LINE>setEntries(table);<NEW_LINE>}<NEW_LINE>} | >(key, value, hash); |
1,755,944 | private double euclideanDistance(Location loc1, Location loc2) {<NEW_LINE>double lat1 = Double.parseDouble(loc1.getLat());<NEW_LINE>double lon1 = Double.parseDouble(loc1.getLon());<NEW_LINE>double lat2 = Double.parseDouble(loc2.getLat());<NEW_LINE>double lon2 = Double.parseDouble(loc2.getLon());<NEW_LINE>// Radius of the earth<NEW_LINE>final int R = 6371;<NEW_LINE>Double latDistance = Math.toRadians(lat2 - lat1);<NEW_LINE>Double lonDistance = Math.toRadians(lon2 - lon1);<NEW_LINE>Double a = Math.sin(latDistance / 2) * Math.sin(latDistance / 2) + Math.cos(Math.toRadians(lat1)) * Math.cos(Math.toRadians(lat2)) * Math.sin(lonDistance / 2) * <MASK><NEW_LINE>Double c = 2 * Math.atan2(Math.sqrt(a), Math.sqrt(1 - a));<NEW_LINE>// convert to meters<NEW_LINE>double distance = R * c * 1000;<NEW_LINE>distance = Math.pow(distance, 2);<NEW_LINE>return Math.sqrt(distance);<NEW_LINE>} | Math.sin(lonDistance / 2); |
123,521 | private float collideWithSegment(Vector3f sCenter, Vector3f sVelocity, float velocitySquared, Vector3f l1, Vector3f l2, float t, Vector3f store) {<NEW_LINE>Vector3f edge = temp1.set(l2).subtractLocal(l1);<NEW_LINE>Vector3f base = temp2.set(l1).subtractLocal(sCenter);<NEW_LINE><MASK><NEW_LINE>float baseSquared = base.lengthSquared();<NEW_LINE>float EdotV = edge.dot(sVelocity);<NEW_LINE>float EdotB = edge.dot(base);<NEW_LINE>float a = (edgeSquared * -velocitySquared) + EdotV * EdotV;<NEW_LINE>float b = (edgeSquared * 2f * sVelocity.dot(base)) - (2f * EdotV * EdotB);<NEW_LINE>float c = (edgeSquared * (1f - baseSquared)) + EdotB * EdotB;<NEW_LINE>float newT = getLowestRoot(a, b, c, t);<NEW_LINE>if (!Float.isNaN(newT)) {<NEW_LINE>float f = (EdotV * newT - EdotB) / edgeSquared;<NEW_LINE>if (f >= 0f && f < 1f) {<NEW_LINE>store.scaleAdd(f, edge, l1);<NEW_LINE>return newT;<NEW_LINE>}<NEW_LINE>}<NEW_LINE>return Float.NaN;<NEW_LINE>} | float edgeSquared = edge.lengthSquared(); |
438,164 | public void show() {<NEW_LINE>wizard.setTitle(MessageText.getString("exportTorrentWizard.torrentfile.title"));<NEW_LINE>Composite rootPanel = wizard.getPanel();<NEW_LINE>GridLayout layout = new GridLayout();<NEW_LINE>layout.numColumns = 1;<NEW_LINE>rootPanel.setLayout(layout);<NEW_LINE>Composite panel = new <MASK><NEW_LINE>GridData gridData = new GridData(GridData.VERTICAL_ALIGN_CENTER | GridData.FILL_HORIZONTAL);<NEW_LINE>panel.setLayoutData(gridData);<NEW_LINE>layout = new GridLayout();<NEW_LINE>layout.numColumns = 3;<NEW_LINE>panel.setLayout(layout);<NEW_LINE>Label label = new Label(panel, SWT.WRAP);<NEW_LINE>gridData = new GridData();<NEW_LINE>gridData.horizontalSpan = 3;<NEW_LINE>gridData.widthHint = 380;<NEW_LINE>label.setLayoutData(gridData);<NEW_LINE>Messages.setLanguageText(label, "exportTorrentWizard.torrentfile.message");<NEW_LINE>label = new Label(panel, SWT.NULL);<NEW_LINE>Messages.setLanguageText(label, "exportTorrentWizard.torrentfile.path");<NEW_LINE>final Text textPath = new Text(panel, SWT.BORDER);<NEW_LINE>gridData = new GridData(GridData.FILL_HORIZONTAL);<NEW_LINE>textPath.setLayoutData(gridData);<NEW_LINE>textPath.setText("");<NEW_LINE>Button browse = new Button(panel, SWT.PUSH);<NEW_LINE>Messages.setLanguageText(browse, "exportTorrentWizard.torrentfile.browse");<NEW_LINE>browse.addListener(SWT.Selection, new Listener() {<NEW_LINE><NEW_LINE>@Override<NEW_LINE>public void handleEvent(Event arg0) {<NEW_LINE>FileDialog fd = new FileDialog(wizard.getWizardWindow());<NEW_LINE>fd.setFileName(textPath.getText());<NEW_LINE>fd.setFilterExtensions(new String[] { "*.torrent", "*.tor", Constants.FILE_WILDCARD });<NEW_LINE>String path = fd.open();<NEW_LINE>if (path != null) {<NEW_LINE>textPath.setText(path);<NEW_LINE>}<NEW_LINE>}<NEW_LINE>});<NEW_LINE>textPath.addListener(SWT.Modify, new Listener() {<NEW_LINE><NEW_LINE>@Override<NEW_LINE>public void handleEvent(Event event) {<NEW_LINE>String path = textPath.getText();<NEW_LINE>((ExportTorrentWizard) wizard).setTorrentFile(path);<NEW_LINE>file_valid = false;<NEW_LINE>try {<NEW_LINE>File f = new File(path);<NEW_LINE>if (f.exists()) {<NEW_LINE>if (f.isFile()) {<NEW_LINE>file_valid = true;<NEW_LINE>wizard.setErrorMessage("");<NEW_LINE>} else {<NEW_LINE>wizard.setErrorMessage(MessageText.getString("exportTorrentWizard.torrentfile.invalidPath"));<NEW_LINE>}<NEW_LINE>}<NEW_LINE>} catch (Exception e) {<NEW_LINE>wizard.setErrorMessage(MessageText.getString("exportTorrentWizard.torrentfile.invalidPath"));<NEW_LINE>}<NEW_LINE>wizard.setNextEnabled(file_valid);<NEW_LINE>}<NEW_LINE>});<NEW_LINE>textPath.setText(((ExportTorrentWizard) wizard).getTorrentFile());<NEW_LINE>textPath.setFocus();<NEW_LINE>} | Composite(rootPanel, SWT.NULL); |
915,515 | public OutlierResult run(Relation<O> relation) {<NEW_LINE>QueryBuilder<O> qb = new QueryBuilder<>(relation, distance);<NEW_LINE>KNNSearcher<DBIDRef> knnQuery = qb.kNNByDBID(kplus);<NEW_LINE>DistanceQuery<O<MASK><NEW_LINE>// track the maximum value for normalization<NEW_LINE>DoubleMinMax ldofminmax = new DoubleMinMax();<NEW_LINE>// compute the ldof values<NEW_LINE>WritableDoubleDataStore ldofs = DataStoreUtil.makeDoubleStorage(relation.getDBIDs(), DataStoreFactory.HINT_HOT | DataStoreFactory.HINT_TEMP);<NEW_LINE>// compute LOF_SCORE of each db object<NEW_LINE>if (LOG.isVerbose()) {<NEW_LINE>LOG.verbose("Computing LDOFs");<NEW_LINE>}<NEW_LINE>FiniteProgress progressLDOFs = LOG.isVerbose() ? new FiniteProgress("LDOF for objects", relation.size(), LOG) : null;<NEW_LINE>Mean dxp = new Mean(), Dxp = new Mean();<NEW_LINE>for (DBIDIter iditer = relation.iterDBIDs(); iditer.valid(); iditer.advance()) {<NEW_LINE>KNNList neighbors = knnQuery.getKNN(iditer, kplus);<NEW_LINE>dxp.reset();<NEW_LINE>Dxp.reset();<NEW_LINE>DoubleDBIDListIter neighbor1 = neighbors.iter(), neighbor2 = neighbors.iter();<NEW_LINE>for (; neighbor1.valid(); neighbor1.advance()) {<NEW_LINE>// skip the point itself<NEW_LINE>if (DBIDUtil.equal(neighbor1, iditer)) {<NEW_LINE>continue;<NEW_LINE>}<NEW_LINE>dxp.put(neighbor1.doubleValue());<NEW_LINE>for (neighbor2.seek(neighbor1.getOffset() + 1); neighbor2.valid(); neighbor2.advance()) {<NEW_LINE>// skip the point itself<NEW_LINE>if (DBIDUtil.equal(neighbor2, iditer)) {<NEW_LINE>continue;<NEW_LINE>}<NEW_LINE>Dxp.put(distFunc.distance(neighbor1, neighbor2));<NEW_LINE>}<NEW_LINE>}<NEW_LINE>double ldof = dxp.getMean() / Dxp.getMean();<NEW_LINE>if (Double.isNaN(ldof) || Double.isInfinite(ldof)) {<NEW_LINE>ldof = 1.0;<NEW_LINE>}<NEW_LINE>ldofs.putDouble(iditer, ldof);<NEW_LINE>// update maximum<NEW_LINE>ldofminmax.put(ldof);<NEW_LINE>LOG.incrementProcessed(progressLDOFs);<NEW_LINE>}<NEW_LINE>LOG.ensureCompleted(progressLDOFs);<NEW_LINE>// Build result representation.<NEW_LINE>DoubleRelation scoreResult = new MaterializedDoubleRelation("LDOF Outlier Score", relation.getDBIDs(), ldofs);<NEW_LINE>OutlierScoreMeta scoreMeta = new QuotientOutlierScoreMeta(ldofminmax.getMin(), ldofminmax.getMax(), 0.0, Double.POSITIVE_INFINITY, LDOF_BASELINE);<NEW_LINE>return new OutlierResult(scoreMeta, scoreResult);<NEW_LINE>} | > distFunc = qb.distanceQuery(); |
1,752,307 | private void integrateInertiaSurface() {<NEW_LINE>double x, r1, r2;<NEW_LINE>final double l = length / DIVISIONS;<NEW_LINE>r1 = getRadius(0);<NEW_LINE>// System.out.println(r1);<NEW_LINE>x = 0;<NEW_LINE>longitudinalInertia = 0;<NEW_LINE>rotationalInertia = 0;<NEW_LINE>double surface = 0;<NEW_LINE>for (int n = 1; n <= DIVISIONS; n++) {<NEW_LINE>r2 = getRadius(x + l);<NEW_LINE>final double hyp = MathUtil.hypot(r2 - r1, l);<NEW_LINE>final double outer <MASK><NEW_LINE>final double dS = hyp * (r1 + r2) * Math.PI;<NEW_LINE>rotationalInertia += dS * pow2(outer);<NEW_LINE>longitudinalInertia += dS * ((6 * pow2(outer) + pow2(l)) / 12 + pow2(x + l / 2));<NEW_LINE>surface += dS;<NEW_LINE>// Update for next iteration<NEW_LINE>r1 = r2;<NEW_LINE>x += l;<NEW_LINE>}<NEW_LINE>if (MathUtil.equals(surface, 0)) {<NEW_LINE>longitudinalInertia = 0;<NEW_LINE>rotationalInertia = 0;<NEW_LINE>return;<NEW_LINE>}<NEW_LINE>longitudinalInertia /= surface;<NEW_LINE>rotationalInertia /= surface;<NEW_LINE>// Shift longitudinal inertia to CG<NEW_LINE>longitudinalInertia = Math.max(longitudinalInertia - pow2(getComponentCG().x), 0);<NEW_LINE>} | = (r1 + r2) / 2; |
1,720,105 | public void performIterationsClassifyEarlyStop(final LearningMethod train, final ClassificationAlgorithm model, final List<BasicData> validationData, final int tolerate) {<NEW_LINE>int iterationNumber = 0;<NEW_LINE>boolean done = false;<NEW_LINE>double bestError = Double.POSITIVE_INFINITY;<NEW_LINE>int badIterations = 0;<NEW_LINE>double[] bestParams = new double[model.getLongTermMemory().length];<NEW_LINE>double bestTrainingError = 0.0;<NEW_LINE>do {<NEW_LINE>iterationNumber++;<NEW_LINE>train.iteration();<NEW_LINE>double validationError = DataUtil.calculateClassificationError(validationData, model);<NEW_LINE>if (validationError < bestError) {<NEW_LINE>badIterations = 0;<NEW_LINE>bestError = validationError;<NEW_LINE>bestTrainingError = train.getLastError();<NEW_LINE>System.arraycopy(model.getLongTermMemory(), 0, bestParams, 0, bestParams.length);<NEW_LINE>} else {<NEW_LINE>badIterations++;<NEW_LINE>}<NEW_LINE>if (train.done()) {<NEW_LINE>done = true;<NEW_LINE>} else if (badIterations > tolerate) {<NEW_LINE>done = true;<NEW_LINE>} else if (Double.isNaN(train.getLastError())) {<NEW_LINE>System.out.println("Weights unstable, stopping training.");<NEW_LINE>done = true;<NEW_LINE>}<NEW_LINE>System.out.println("Iteration #" + iterationNumber + ", training error=" + train.getLastError() + ", Validation # incorrect= %" + validationError * 100.0 + <MASK><NEW_LINE>} while (!done);<NEW_LINE>train.finishTraining();<NEW_LINE>System.out.println("Best training error: " + bestTrainingError);<NEW_LINE>System.out.println("Restoring weights to best iteration");<NEW_LINE>System.arraycopy(bestParams, 0, model.getLongTermMemory(), 0, bestParams.length);<NEW_LINE>} | ", " + train.getStatus()); |
1,782,970 | public View onCreateView(@NonNull LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {<NEW_LINE>notificationsViewModel = new ViewModelProvider(this, new ViewModelProvider.NewInstanceFactory()).get(NotificationsViewModel.class);<NEW_LINE>View root = inflater.inflate(R.layout.fragment_notifications, container, false);<NEW_LINE>final TextView textView = root.findViewById(R.id.text_notifications);<NEW_LINE>notificationsViewModel.getText().observe(getViewLifecycleOwner(), new Observer<String>() {<NEW_LINE><NEW_LINE>@Override<NEW_LINE>public void onChanged(@Nullable String s) {<NEW_LINE>textView.setText(s);<NEW_LINE>}<NEW_LINE>});<NEW_LINE>// Gif loading for testing<NEW_LINE>sharedViewModel = new ViewModelProvider(requireActivity()).get(SharedViewModel.class);<NEW_LINE>final ImageView imageView = root.findViewById(R.id.img_notifications);<NEW_LINE>sharedViewModel.getImageSrc().observe(getViewLifecycleOwner(), new Observer<String>() {<NEW_LINE><NEW_LINE>@Override<NEW_LINE>public void onChanged(String s) {<NEW_LINE>Glide.with(requireActivity()).load(s).diskCacheStrategy(DiskCacheStrategy.NONE).skipMemoryCache(true).into(imageView);<NEW_LINE>}<NEW_LINE>});<NEW_LINE>// Recycler View setup<NEW_LINE>RecyclerView numbersList = root.<MASK><NEW_LINE>LinearLayoutManager layoutManager = new LinearLayoutManager(requireActivity());<NEW_LINE>ListAdapter listAdapter = new ListAdapter(NUM_LIST_ITEMS);<NEW_LINE>numbersList.setLayoutManager(layoutManager);<NEW_LINE>numbersList.setHasFixedSize(true);<NEW_LINE>numbersList.setAdapter(listAdapter);<NEW_LINE>return root;<NEW_LINE>} | findViewById(R.id.rv_fragment_notifications); |
1,604,291 | private static StreamingHttpResponse newErrorResponse(final Throwable cause, final HttpServiceContext ctx, final StreamingHttpRequest request, final StreamingHttpResponseFactory responseFactory) {<NEW_LINE>final HttpResponseStatus status;<NEW_LINE>if (cause instanceof RejectedExecutionException) {<NEW_LINE>status = SERVICE_UNAVAILABLE;<NEW_LINE>LOGGER.error("Task rejected by service processing for connection={}, request='{} {} {}'. Returning: {}", ctx, request.method(), request.requestTarget(), request.<MASK><NEW_LINE>} else if (cause instanceof SerializationException) {<NEW_LINE>// It is assumed that a failure occurred when attempting to deserialize the request.<NEW_LINE>status = UNSUPPORTED_MEDIA_TYPE;<NEW_LINE>LOGGER.error("Failed to deserialize or serialize for connection={}, request='{} {} {}'. Returning: {}", ctx, request.method(), request.requestTarget(), request.version(), status, cause);<NEW_LINE>} else if (cause instanceof PayloadTooLargeException) {<NEW_LINE>status = PAYLOAD_TOO_LARGE;<NEW_LINE>} else {<NEW_LINE>status = INTERNAL_SERVER_ERROR;<NEW_LINE>LOGGER.error("Unexpected exception during service processing for connection={}, request='{} {} {}'. " + "Trying to return: {}", ctx, request.method(), request.requestTarget(), request.version(), status, cause);<NEW_LINE>}<NEW_LINE>return responseFactory.newResponse(status).setHeader(CONTENT_LENGTH, ZERO);<NEW_LINE>} | version(), status, cause); |
492,766 | public Answer execute(final SecurityGroupRulesCmd command, final LibvirtComputingResource libvirtComputingResource) {<NEW_LINE>String vif = null;<NEW_LINE>String brname = null;<NEW_LINE>try {<NEW_LINE>final LibvirtUtilitiesHelper libvirtUtilitiesHelper = libvirtComputingResource.getLibvirtUtilitiesHelper();<NEW_LINE>final Connect conn = libvirtUtilitiesHelper.getConnectionByVmName(command.getVmName());<NEW_LINE>final List<InterfaceDef> nics = libvirtComputingResource.getInterfaces(conn, command.getVmName());<NEW_LINE>vif = nics.get(0).getDevName();<NEW_LINE>brname = nics.<MASK><NEW_LINE>final VirtualMachineTO vm = command.getVmTO();<NEW_LINE>if (!libvirtComputingResource.applyDefaultNetworkRules(conn, vm, true)) {<NEW_LINE>s_logger.warn("Failed to program default network rules for vm " + command.getVmName());<NEW_LINE>return new SecurityGroupRuleAnswer(command, false, "programming default network rules failed");<NEW_LINE>}<NEW_LINE>} catch (final LibvirtException e) {<NEW_LINE>return new SecurityGroupRuleAnswer(command, false, e.toString());<NEW_LINE>}<NEW_LINE>final boolean result = libvirtComputingResource.addNetworkRules(command.getVmName(), Long.toString(command.getVmId()), command.getGuestIp(), command.getGuestIp6(), command.getSignature(), Long.toString(command.getSeqNum()), command.getGuestMac(), command.stringifyRules(), vif, brname, command.getSecIpsString());<NEW_LINE>if (!result) {<NEW_LINE>s_logger.warn("Failed to program network rules for vm " + command.getVmName());<NEW_LINE>return new SecurityGroupRuleAnswer(command, false, "programming network rules failed");<NEW_LINE>} else {<NEW_LINE>s_logger.debug("Programmed network rules for vm " + command.getVmName() + " guestIp=" + command.getGuestIp() + ",ingress numrules=" + command.getIngressRuleSet().size() + ",egress numrules=" + command.getEgressRuleSet().size());<NEW_LINE>return new SecurityGroupRuleAnswer(command);<NEW_LINE>}<NEW_LINE>} | get(0).getBrName(); |
760,436 | public void onCompletion(Void result, Exception exception) {<NEW_LINE>callbackTracker.markOperationEnd();<NEW_LINE>if (exception == null) {<NEW_LINE>try {<NEW_LINE><MASK><NEW_LINE>logger.trace("Forwarding {} to the IdConverter/Router", restMethod);<NEW_LINE>String receivedId = getRequestPath(restRequest).getOperationOrBlobId(false);<NEW_LINE>switch(restMethod) {<NEW_LINE>case GET:<NEW_LINE>InboundIdConverterCallback idConverterCallback = new InboundIdConverterCallback(restRequest, restResponseChannel, getCallback);<NEW_LINE>idConverter.convert(restRequest, receivedId, idConverterCallback);<NEW_LINE>break;<NEW_LINE>case HEAD:<NEW_LINE>idConverterCallback = new InboundIdConverterCallback(restRequest, restResponseChannel, headCallback);<NEW_LINE>idConverter.convert(restRequest, receivedId, idConverterCallback);<NEW_LINE>break;<NEW_LINE>case DELETE:<NEW_LINE>idConverterCallback = new InboundIdConverterCallback(restRequest, restResponseChannel, deleteCallback);<NEW_LINE>idConverter.convert(restRequest, receivedId, idConverterCallback);<NEW_LINE>break;<NEW_LINE>default:<NEW_LINE>exception = new IllegalStateException("Unrecognized RestMethod: " + restMethod);<NEW_LINE>}<NEW_LINE>} catch (Exception e) {<NEW_LINE>exception = Utils.extractFutureExceptionCause(e);<NEW_LINE>}<NEW_LINE>}<NEW_LINE>if (exception != null) {<NEW_LINE>submitResponse(restRequest, restResponseChannel, null, exception);<NEW_LINE>}<NEW_LINE>callbackTracker.markCallbackProcessingEnd();<NEW_LINE>} | RestMethod restMethod = restRequest.getRestMethod(); |
62,121 | public static int serializeDouble(ByteBuf buf, double[] arr, int start, int end, int numBits) {<NEW_LINE>long startTime = System.currentTimeMillis();<NEW_LINE>if (numBits < 2 || numBits > 32 || (numBits & (numBits - 1)) != 0) {<NEW_LINE>numBits = 8;<NEW_LINE>LOG.error("Compression bits should be in {2,4,8,16,32}");<NEW_LINE>}<NEW_LINE>int len = end - start;<NEW_LINE>buf.writeInt(len);<NEW_LINE>buf.writeInt(numBits);<NEW_LINE>double maxAbs = 0.0;<NEW_LINE>for (int i = start; i < end; i++) {<NEW_LINE>if (Math.abs(arr[i]) > maxAbs)<NEW_LINE>maxAbs = Math.abs(arr[i]);<NEW_LINE>}<NEW_LINE>buf.writeDouble(maxAbs);<NEW_LINE>int byteSum = 0;<NEW_LINE>int maxPoint = (int) Math.pow(<MASK><NEW_LINE>int itemPerByte = 8 / numBits;<NEW_LINE>int bytePerItem = numBits / 8;<NEW_LINE>for (int i = start; i < end; ) {<NEW_LINE>if (bytePerItem >= 1) {<NEW_LINE>int point = quantify(arr[i], maxAbs, maxPoint);<NEW_LINE>byte[] tmp = serializeInt(point, numBits / 8);<NEW_LINE>buf.writeBytes(tmp);<NEW_LINE>byteSum += bytePerItem;<NEW_LINE>i++;<NEW_LINE>} else {<NEW_LINE>int[] tmpQ = new int[itemPerByte];<NEW_LINE>for (int j = 0; j < itemPerByte; j++) {<NEW_LINE>if (i + j >= end)<NEW_LINE>tmpQ[j] = 0;<NEW_LINE>else<NEW_LINE>tmpQ[j] = quantify(arr[i + j], maxAbs, maxPoint);<NEW_LINE>}<NEW_LINE>byte tmp = serializeInt(tmpQ, itemPerByte);<NEW_LINE>buf.writeByte(tmp);<NEW_LINE>byteSum++;<NEW_LINE>i += itemPerByte;<NEW_LINE>}<NEW_LINE>}<NEW_LINE>// LOG.info("original double length: " + len + Arrays.toString(Arrays.copyOfRange(arr, start, end)));<NEW_LINE>LOG.info(String.format("compress %d doubles to %d bytes, max abs: %f, max point: %d, cost %d ms", len, byteSum, maxAbs, maxPoint, System.currentTimeMillis() - startTime));<NEW_LINE>return arr.length;<NEW_LINE>} | 2, numBits - 1) - 1; |
586,469 | public static AuthResult authenticateIdentityCookie(KeycloakSession session, RealmModel realm, boolean checkActive) {<NEW_LINE>Cookie cookie = CookieHelper.getCookie(session.getContext().getRequestHeaders().getCookies(), KEYCLOAK_IDENTITY_COOKIE);<NEW_LINE>if (cookie == null || "".equals(cookie.getValue())) {<NEW_LINE>logger.debugv("Could not find cookie: {0}", KEYCLOAK_IDENTITY_COOKIE);<NEW_LINE>return null;<NEW_LINE>}<NEW_LINE><MASK><NEW_LINE>AuthResult authResult = verifyIdentityToken(session, realm, session.getContext().getUri(), session.getContext().getConnection(), checkActive, false, null, true, tokenString, session.getContext().getRequestHeaders(), VALIDATE_IDENTITY_COOKIE);<NEW_LINE>if (authResult == null) {<NEW_LINE>expireIdentityCookie(realm, session.getContext().getUri(), session.getContext().getConnection());<NEW_LINE>expireOldIdentityCookie(realm, session.getContext().getUri(), session.getContext().getConnection());<NEW_LINE>return null;<NEW_LINE>}<NEW_LINE>authResult.getSession().setLastSessionRefresh(Time.currentTime());<NEW_LINE>return authResult;<NEW_LINE>} | String tokenString = cookie.getValue(); |
413,406 | public void marshall(ParameterDefinition parameterDefinition, ProtocolMarshaller protocolMarshaller) {<NEW_LINE>if (parameterDefinition == null) {<NEW_LINE>throw new SdkClientException("Invalid argument passed to marshall(...)");<NEW_LINE>}<NEW_LINE>try {<NEW_LINE>protocolMarshaller.marshall(parameterDefinition.getAllowedPattern(), ALLOWEDPATTERN_BINDING);<NEW_LINE>protocolMarshaller.marshall(parameterDefinition.getAllowedValues(), ALLOWEDVALUES_BINDING);<NEW_LINE>protocolMarshaller.marshall(parameterDefinition.getConstraintDescription(), CONSTRAINTDESCRIPTION_BINDING);<NEW_LINE>protocolMarshaller.marshall(parameterDefinition.getDefaultValue(), DEFAULTVALUE_BINDING);<NEW_LINE>protocolMarshaller.marshall(parameterDefinition.getDescription(), DESCRIPTION_BINDING);<NEW_LINE>protocolMarshaller.marshall(parameterDefinition.getMaxLength(), MAXLENGTH_BINDING);<NEW_LINE>protocolMarshaller.marshall(<MASK><NEW_LINE>protocolMarshaller.marshall(parameterDefinition.getMinLength(), MINLENGTH_BINDING);<NEW_LINE>protocolMarshaller.marshall(parameterDefinition.getMinValue(), MINVALUE_BINDING);<NEW_LINE>protocolMarshaller.marshall(parameterDefinition.getName(), NAME_BINDING);<NEW_LINE>protocolMarshaller.marshall(parameterDefinition.getNoEcho(), NOECHO_BINDING);<NEW_LINE>protocolMarshaller.marshall(parameterDefinition.getReferencedByResources(), REFERENCEDBYRESOURCES_BINDING);<NEW_LINE>protocolMarshaller.marshall(parameterDefinition.getType(), TYPE_BINDING);<NEW_LINE>} catch (Exception e) {<NEW_LINE>throw new SdkClientException("Unable to marshall request to JSON: " + e.getMessage(), e);<NEW_LINE>}<NEW_LINE>} | parameterDefinition.getMaxValue(), MAXVALUE_BINDING); |
206,127 | public Response<Void> deleteByIdWithResponse(String id, Context context) {<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>String accountName = <MASK><NEW_LINE>if (accountName == null) {<NEW_LINE>throw logger.logExceptionAsError(new IllegalArgumentException(String.format("The resource ID '%s' is not valid. Missing path segment 'videoAnalyzers'.", id)));<NEW_LINE>}<NEW_LINE>String videoName = Utils.getValueFromIdByName(id, "videos");<NEW_LINE>if (videoName == null) {<NEW_LINE>throw logger.logExceptionAsError(new IllegalArgumentException(String.format("The resource ID '%s' is not valid. Missing path segment 'videos'.", id)));<NEW_LINE>}<NEW_LINE>return this.deleteWithResponse(resourceGroupName, accountName, videoName, context);<NEW_LINE>} | Utils.getValueFromIdByName(id, "videoAnalyzers"); |
1,663,497 | public void start() {<NEW_LINE>// Create the client object<NEW_LINE>ProcessorService service = new ProcessorServiceImpl();<NEW_LINE>// Register the handler<NEW_LINE>new ServiceBinder(vertx).setAddress("vertx.processor").register(ProcessorService.class, service);<NEW_LINE>Router <MASK><NEW_LINE>// Allow events for the designated addresses in/out of the event bus bridge<NEW_LINE>SockJSBridgeOptions opts = new SockJSBridgeOptions().addInboundPermitted(new PermittedOptions().setAddress("vertx.processor")).addOutboundPermitted(new PermittedOptions().setAddress("vertx.processor"));<NEW_LINE>// Create the event bus bridge and add it to the router.<NEW_LINE>router.mountSubRouter("/eventbus", SockJSHandler.create(vertx).bridge(opts));<NEW_LINE>router.route().handler(StaticHandler.create());<NEW_LINE>//<NEW_LINE>vertx.createHttpServer().requestHandler(router).listen(8080);<NEW_LINE>} | router = Router.router(vertx); |
1,304,068 | public static void zdemo7(int rows, int columns, boolean print) {<NEW_LINE>// for reliable benchmarks, call this method twice: once with small dummy parameters to "warm up" the jitter, then with your real work-load<NEW_LINE>System.out.println("\n\n");<NEW_LINE>System.out.println("now initializing... ");<NEW_LINE>final cern.jet.math.Functions F = cern.jet.math.Functions.functions;<NEW_LINE>DoubleMatrix2D A = cern.colt.matrix.DoubleFactory2D.dense.make(rows, columns);<NEW_LINE>// initialize randomly<NEW_LINE>A.assign(new cern.jet.random.engine.DRand());<NEW_LINE>DoubleMatrix2D B = A.copy();<NEW_LINE>double[] v1 = A.viewColumn(0).toArray();<NEW_LINE>double[] v2 = A.viewColumn(0).toArray();<NEW_LINE>System.out.print("now quick sorting... ");<NEW_LINE>cern.colt.Timer timer = new cern.colt.Timer().start();<NEW_LINE>quickSort.sort(A, 0);<NEW_LINE>timer.stop().display();<NEW_LINE>System.out.print("now merge sorting... ");<NEW_LINE>timer.reset().start();<NEW_LINE>mergeSort.sort(A, 0);<NEW_LINE>timer.stop().display();<NEW_LINE>System.out.print("now quick sorting with simple aggregation... ");<NEW_LINE>timer.reset().start();<NEW_LINE>quickSort.sort(A, v1);<NEW_LINE>timer.stop().display();<NEW_LINE>System.out.print("now merge sorting with simple aggregation... ");<NEW_LINE>timer.reset().start();<NEW_LINE>mergeSort.sort(A, v2);<NEW_LINE>timer<MASK><NEW_LINE>} | .stop().display(); |
835,615 | protected Object validateUnion(DataElement element, UnionDataSchema schema, Object object) {<NEW_LINE>if (object == Data.NULL) {<NEW_LINE>if (schema.getTypeByMemberKey(DataSchemaConstants.NULL_TYPE) == null) {<NEW_LINE>addMessage(element, "null is not a member type of union %1$s", schema);<NEW_LINE>}<NEW_LINE>} else if (_options.isAvroUnionMode()) {<NEW_LINE>// Avro union default value does not include member type discriminator<NEW_LINE>List<UnionDataSchema.Member> members = schema.getMembers();<NEW_LINE>if (members.isEmpty()) {<NEW_LINE>addMessage(element, "value %1$s is not valid for empty union", object.toString());<NEW_LINE>} else {<NEW_LINE>DataSchema memberSchema = members.get(0).getType();<NEW_LINE>assert (_recursive);<NEW_LINE><MASK><NEW_LINE>}<NEW_LINE>} else if (object instanceof DataMap) {<NEW_LINE>// Pegasus mode<NEW_LINE>DataMap map = (DataMap) object;<NEW_LINE>// we allow empty union<NEW_LINE>if (map.size() > 1) {<NEW_LINE>addMessage(element, "DataMap should have no more than one entry for a union type");<NEW_LINE>} else if (map.size() == 1) {<NEW_LINE>Map.Entry<String, Object> entry = map.entrySet().iterator().next();<NEW_LINE>String key = entry.getKey();<NEW_LINE>DataSchema memberSchema = schema.getTypeByMemberKey(key);<NEW_LINE>if (memberSchema == null) {<NEW_LINE>addMessage(element, "\"%1$s\" is not a member type of union %2$s", key, schema);<NEW_LINE>} else if (_recursive) {<NEW_LINE>Object value = entry.getValue();<NEW_LINE>MutableDataElement memberElement = new MutableDataElement(value, key, memberSchema, element);<NEW_LINE>validate(memberElement, memberSchema, value);<NEW_LINE>}<NEW_LINE>} else if (!schema.isPartialSchema()) {<NEW_LINE>addMessage(element, "DataMap should have at least one entry for a union type");<NEW_LINE>}<NEW_LINE>} else {<NEW_LINE>addMessage(element, "union type is not backed by a DataMap or null");<NEW_LINE>}<NEW_LINE>return object;<NEW_LINE>} | validate(element, memberSchema, object); |
824,270 | protected void persistSendingMessage(EntityManager em, SendingMessage message, MessagePersistingContext context) throws FileStorageException {<NEW_LINE>boolean useFileStorage = config.isFileStorageUsed();<NEW_LINE>if (useFileStorage) {<NEW_LINE>byte<MASK><NEW_LINE>FileDescriptor contentTextFile = createBodyFileDescriptor(message, bodyBytes);<NEW_LINE>fileStorage.saveFile(contentTextFile, bodyBytes);<NEW_LINE>context.files.add(contentTextFile);<NEW_LINE>em.persist(contentTextFile);<NEW_LINE>message.setContentTextFile(contentTextFile);<NEW_LINE>message.setContentText(null);<NEW_LINE>}<NEW_LINE>em.persist(message);<NEW_LINE>for (SendingAttachment attachment : message.getAttachments()) {<NEW_LINE>if (useFileStorage) {<NEW_LINE>FileDescriptor contentFile = createAttachmentFileDescriptor(attachment);<NEW_LINE>fileStorage.saveFile(contentFile, attachment.getContent());<NEW_LINE>context.files.add(contentFile);<NEW_LINE>em.persist(contentFile);<NEW_LINE>attachment.setContentFile(contentFile);<NEW_LINE>attachment.setContent(null);<NEW_LINE>}<NEW_LINE>em.persist(attachment);<NEW_LINE>}<NEW_LINE>} | [] bodyBytes = bodyTextToBytes(message); |
872,237 | // @Override<NEW_LINE>@Override<NEW_LINE>public void init(int WindowNo, FormFrame frame) {<NEW_LINE>if (s_instance != null) {<NEW_LINE><MASK><NEW_LINE>throw new AdempiereException("@de.metas.callcenter.FrontPanelAlreadyOpened@");<NEW_LINE>}<NEW_LINE>//<NEW_LINE>int checkIntervalSec = Services.get(ISysConfigBL.class).getIntValue(SYSCONFIG_CheckInterval, 60, Env.getAD_Client_ID(Env.getCtx()));<NEW_LINE>m_updater = new Timer(checkIntervalSec * 1000, e -> {<NEW_LINE>try {<NEW_LINE>refreshAll(false);<NEW_LINE>} catch (Exception ex1) {<NEW_LINE>log.error("Error", ex1);<NEW_LINE>}<NEW_LINE>});<NEW_LINE>//<NEW_LINE>m_frame = frame;<NEW_LINE>m_model = new CallCenterModel(Env.getCtx(), WindowNo);<NEW_LINE>m_frame.addWindowListener(new WindowAdapter() {<NEW_LINE><NEW_LINE>@Override<NEW_LINE>public void windowActivated(WindowEvent e) {<NEW_LINE>if (!m_frame.isEnabled() && e.getSource() == m_frame && m_requestFrame != null) {<NEW_LINE>AEnv.showWindow(m_requestFrame);<NEW_LINE>}<NEW_LINE>}<NEW_LINE><NEW_LINE>@Override<NEW_LINE>public void windowClosed(WindowEvent e) {<NEW_LINE>dispose();<NEW_LINE>}<NEW_LINE>});<NEW_LINE>m_frame.setIconImage(getImage("callcenter.png"));<NEW_LINE>s_instance = this;<NEW_LINE>//<NEW_LINE>m_updater.setInitialDelay(0);<NEW_LINE>m_updater.setRepeats(true);<NEW_LINE>m_updater.setCoalesce(true);<NEW_LINE>//<NEW_LINE>dynInit();<NEW_LINE>} | AEnv.showWindow(s_instance.m_frame); |
759,672 | public void decodeSelectionRowKeys(FacesContext context, DataTable table) {<NEW_LINE>Set<String> rowKeys = null;<NEW_LINE>ValueExpression selectionVE = table.getValueExpression(DataTableBase.PropertyKeys.selection.name());<NEW_LINE>if (selectionVE != null) {<NEW_LINE>Object selection = selectionVE.getValue(context.getELContext());<NEW_LINE>if (selection != null) {<NEW_LINE>rowKeys = new HashSet<>();<NEW_LINE>if (table.isSingleSelectionMode()) {<NEW_LINE>rowKeys.add<MASK><NEW_LINE>} else {<NEW_LINE>Class<?> clazz = selection.getClass();<NEW_LINE>boolean isArray = clazz != null && clazz.isArray();<NEW_LINE>if (clazz != null && !isArray && !List.class.isAssignableFrom(clazz)) {<NEW_LINE>throw new FacesException("Multiple selection reference must be an Array or a List for datatable " + table.getClientId());<NEW_LINE>}<NEW_LINE>List<Object> selectionTmp = isArray ? Arrays.asList((Object[]) selection) : (List<Object>) selection;<NEW_LINE>for (int i = 0; i < selectionTmp.size(); i++) {<NEW_LINE>Object o = selectionTmp.get(i);<NEW_LINE>rowKeys.add(table.getRowKey(o));<NEW_LINE>}<NEW_LINE>}<NEW_LINE>}<NEW_LINE>}<NEW_LINE>table.setSelectedRowKeys(rowKeys);<NEW_LINE>} | (table.getRowKey(selection)); |
636,997 | public ProviderResourceGroupRoles deleteProviderResourceGroupRoles(String tenantDomain, String provDomain, String provService, String resourceGroup, String auditRef) {<NEW_LINE>WebTarget target = base.path("/domain/{tenantDomain}/provDomain/{provDomain}/provService/{provService}/resourceGroup/{resourceGroup}").resolveTemplate("tenantDomain", tenantDomain).resolveTemplate("provDomain", provDomain).resolveTemplate("provService", provService).resolveTemplate("resourceGroup", resourceGroup);<NEW_LINE>Invocation.Builder invocationBuilder = target.request("application/json");<NEW_LINE>if (credsHeader != null) {<NEW_LINE>invocationBuilder = credsHeader.startsWith("Cookie.") ? invocationBuilder.cookie(credsHeader.substring(7), credsToken) : invocationBuilder.header(credsHeader, credsToken);<NEW_LINE>}<NEW_LINE>if (auditRef != null) {<NEW_LINE>invocationBuilder = invocationBuilder.header("Y-Audit-Ref", auditRef);<NEW_LINE>}<NEW_LINE>Response response = invocationBuilder.delete();<NEW_LINE><MASK><NEW_LINE>switch(code) {<NEW_LINE>case 204:<NEW_LINE>return null;<NEW_LINE>default:<NEW_LINE>throw new ResourceException(code, response.readEntity(ResourceError.class));<NEW_LINE>}<NEW_LINE>} | int code = response.getStatus(); |
692,669 | public void createIndex(String index, String type, String mapping, Integer shards, Integer replicas, String alias) {<NEW_LINE>RestHighLevelClient client = EsClientHolder.getClient();<NEW_LINE>boolean acknowledged = false;<NEW_LINE>CreateIndexRequest request = new CreateIndexRequest(index);<NEW_LINE>if (StringUtils.hasText(mapping)) {<NEW_LINE>request.mapping(type, mapping, XContentType.JSON);<NEW_LINE>}<NEW_LINE>if (!Objects.isNull(shards) && !Objects.isNull(replicas)) {<NEW_LINE>request.settings(// 5<NEW_LINE>Settings.builder().// 5<NEW_LINE>put(// 5<NEW_LINE>"index.number_of_shards", // 1<NEW_LINE>shards).// 1<NEW_LINE>put(// 1<NEW_LINE>"index.number_of_replicas", replicas));<NEW_LINE>}<NEW_LINE>if (StringUtils.hasText(alias)) {<NEW_LINE>request.<MASK><NEW_LINE>}<NEW_LINE>try {<NEW_LINE>CreateIndexResponse createIndexResponse = client.indices().create(request, RequestOptions.DEFAULT);<NEW_LINE>acknowledged = createIndexResponse.isAcknowledged();<NEW_LINE>} catch (IOException e) {<NEW_LINE>log.error("create es index exception", e);<NEW_LINE>}<NEW_LINE>if (acknowledged) {<NEW_LINE>log.info("create es index success");<NEW_LINE>isIndexExist.set(true);<NEW_LINE>} else {<NEW_LINE>log.error("create es index fail");<NEW_LINE>throw new RuntimeException("cannot auto create thread-pool state es index");<NEW_LINE>}<NEW_LINE>} | alias(new Alias(alias)); |
1,285,475 | protected Collection<MonitoringDoc> doCollect(final MonitoringDoc.Node node, final long interval, final ClusterState clusterState) {<NEW_LINE>NodesStatsRequest request = new NodesStatsRequest("_local");<NEW_LINE>request.indices(FLAGS);<NEW_LINE>request.addMetrics(NodesStatsRequest.Metric.OS.metricName(), NodesStatsRequest.Metric.JVM.metricName(), NodesStatsRequest.Metric.PROCESS.metricName(), NodesStatsRequest.Metric.THREAD_POOL.metricName(), NodesStatsRequest.Metric.FS.metricName());<NEW_LINE><MASK><NEW_LINE>final NodesStatsResponse response = client.admin().cluster().nodesStats(request).actionGet();<NEW_LINE>ensureNoTimeouts(getCollectionTimeout(), response);<NEW_LINE>// if there's a failure, then we failed to work with the<NEW_LINE>// _local node (guaranteed a single exception)<NEW_LINE>if (response.hasFailures()) {<NEW_LINE>throw response.failures().get(0);<NEW_LINE>}<NEW_LINE>final String clusterUuid = clusterUuid(clusterState);<NEW_LINE>final NodeStats nodeStats = response.getNodes().get(0);<NEW_LINE>return Collections.singletonList(new NodeStatsMonitoringDoc(clusterUuid, nodeStats.getTimestamp(), interval, node, node.getUUID(), clusterState.getNodes().isLocalNodeElectedMaster(), nodeStats, BootstrapInfo.isMemoryLocked()));<NEW_LINE>} | request.timeout(getCollectionTimeout()); |
1,303,300 | public static double floatToDoubleUpper(float f) {<NEW_LINE>if (Float.isNaN(f)) {<NEW_LINE>return Double.NaN;<NEW_LINE>}<NEW_LINE>if (Float.isInfinite(f)) {<NEW_LINE>return f > 0 ? Double.POSITIVE_INFINITY : Double.longBitsToDouble(0xc7efffffffffffffL);<NEW_LINE>}<NEW_LINE>long bits = Double.doubleToRawLongBits((double) f);<NEW_LINE>if ((bits & 0x8000000000000000L) == 0) {<NEW_LINE>// Positive<NEW_LINE>if (bits == 0L) {<NEW_LINE>return Double.longBitsToDouble(0x3690000000000000L);<NEW_LINE>}<NEW_LINE>if (f == Float.MIN_VALUE) {<NEW_LINE>// bits += 0x7_ffff_ffff_ffffl;<NEW_LINE>return Double.longBitsToDouble(0x36a7ffffffffffffL);<NEW_LINE>}<NEW_LINE>if (Float.MIN_NORMAL > f && f >= Double.MIN_NORMAL) {<NEW_LINE>// The most tricky case:<NEW_LINE>// a denormalized float, but a normalized double<NEW_LINE>final long bits2 = Double.doubleToRawLongBits((double) Math.nextUp(f));<NEW_LINE>bits = (bits >>> 1) + (bits2 >>> 1) - 1L;<NEW_LINE>} else {<NEW_LINE>// 28 extra bits<NEW_LINE>bits += 0xfffffffL;<NEW_LINE>}<NEW_LINE>return Double.longBitsToDouble(bits);<NEW_LINE>} else {<NEW_LINE>if (bits == 0x8000000000000000L) {<NEW_LINE>return -0.0d;<NEW_LINE>}<NEW_LINE>if (f == -Float.MIN_VALUE) {<NEW_LINE>// bits -= 0xf_ffff_ffff_ffffl;<NEW_LINE>return Double.longBitsToDouble(0xb690000000000001L);<NEW_LINE>}<NEW_LINE>if (-Float.MIN_NORMAL < f && f <= -Double.MIN_NORMAL) {<NEW_LINE>// The most tricky case:<NEW_LINE>// a denormalized float, but a normalized double<NEW_LINE>final long bits2 = Double.doubleToRawLongBits((double<MASK><NEW_LINE>bits = (bits >>> 1) + (bits2 >>> 1) + 1L;<NEW_LINE>} else {<NEW_LINE>// 28 extra bits<NEW_LINE>bits -= 0xfffffffL;<NEW_LINE>}<NEW_LINE>return Double.longBitsToDouble(bits);<NEW_LINE>}<NEW_LINE>} | ) Math.nextUp(f)); |
853,249 | public static HoodieTableMetaClient initTableAndGetMetaClient(Configuration hadoopConf, String basePath, Properties props) throws IOException {<NEW_LINE>LOG.info("Initializing " + basePath + " as hoodie table " + basePath);<NEW_LINE>Path basePathDir = new Path(basePath);<NEW_LINE>final FileSystem fs = FSUtils.getFs(basePath, hadoopConf);<NEW_LINE>if (!fs.exists(basePathDir)) {<NEW_LINE>fs.mkdirs(basePathDir);<NEW_LINE>}<NEW_LINE>Path metaPathDir = new Path(basePath, METAFOLDER_NAME);<NEW_LINE>if (!fs.exists(metaPathDir)) {<NEW_LINE>fs.mkdirs(metaPathDir);<NEW_LINE>}<NEW_LINE>// create schema folder<NEW_LINE>Path schemaPathDir = new Path(metaPathDir, SCHEMA_FOLDER_NAME);<NEW_LINE>if (!fs.exists(schemaPathDir)) {<NEW_LINE>fs.mkdirs(schemaPathDir);<NEW_LINE>}<NEW_LINE>// if anything other than default archive log folder is specified, create that too<NEW_LINE>String archiveLogPropVal = new HoodieConfig(props).getStringOrDefault(HoodieTableConfig.ARCHIVELOG_FOLDER);<NEW_LINE>if (!StringUtils.isNullOrEmpty(archiveLogPropVal)) {<NEW_LINE>Path archiveLogDir = new Path(metaPathDir, archiveLogPropVal);<NEW_LINE>if (!fs.exists(archiveLogDir)) {<NEW_LINE>fs.mkdirs(archiveLogDir);<NEW_LINE>}<NEW_LINE>}<NEW_LINE>// Always create temporaryFolder which is needed for finalizeWrite for Hoodie tables<NEW_LINE>final Path temporaryFolder = new <MASK><NEW_LINE>if (!fs.exists(temporaryFolder)) {<NEW_LINE>fs.mkdirs(temporaryFolder);<NEW_LINE>}<NEW_LINE>// Always create auxiliary folder which is needed to track compaction workloads (stats and any metadata in future)<NEW_LINE>final Path auxiliaryFolder = new Path(basePath, HoodieTableMetaClient.AUXILIARYFOLDER_NAME);<NEW_LINE>if (!fs.exists(auxiliaryFolder)) {<NEW_LINE>fs.mkdirs(auxiliaryFolder);<NEW_LINE>}<NEW_LINE>initializeBootstrapDirsIfNotExists(hadoopConf, basePath, fs);<NEW_LINE>HoodieTableConfig.create(fs, metaPathDir, props);<NEW_LINE>// We should not use fs.getConf as this might be different from the original configuration<NEW_LINE>// used to create the fs in unit tests<NEW_LINE>HoodieTableMetaClient metaClient = HoodieTableMetaClient.builder().setConf(hadoopConf).setBasePath(basePath).build();<NEW_LINE>LOG.info("Finished initializing Table of type " + metaClient.getTableConfig().getTableType() + " from " + basePath);<NEW_LINE>return metaClient;<NEW_LINE>} | Path(basePath, HoodieTableMetaClient.TEMPFOLDER_NAME); |
1,625,356 | public SwordContext doAuth(AuthCredentials authCredentials) throws SwordAuthException, SwordError, DSpaceSwordException {<NEW_LINE>// if there is no supplied username, then we should request a retry<NEW_LINE>if (authCredentials.getUsername() == null) {<NEW_LINE>throw new SwordAuthException(true);<NEW_LINE>}<NEW_LINE>// first authenticate the request<NEW_LINE>// note: this will build our various DSpace contexts for us<NEW_LINE>SwordAuthenticator auth = new SwordAuthenticator();<NEW_LINE>SwordContext <MASK><NEW_LINE>// log the request<NEW_LINE>String un = authCredentials.getUsername() != null ? authCredentials.getUsername() : "NONE";<NEW_LINE>String obo = authCredentials.getOnBehalfOf() != null ? authCredentials.getOnBehalfOf() : "NONE";<NEW_LINE>log.info(LogHelper.getHeader(sc.getContext(), "sword_auth_request", "username=" + un + ",on_behalf_of=" + obo));<NEW_LINE>return sc;<NEW_LINE>} | sc = auth.authenticate(authCredentials); |
1,177,563 | public JwtTokenForTest validateJWSToken(Page response) throws Exception {<NEW_LINE>String thisMethod = "validateJWSToken";<NEW_LINE>String jwtTokenString = BuilderHelpers.<MASK><NEW_LINE>Log.info(thisClass, thisMethod, "");<NEW_LINE>if (jwtTokenString == null) {<NEW_LINE>fail("Test failed to find the JWT in the builder response");<NEW_LINE>}<NEW_LINE>JsonWebStructure joseObject = JsonWebStructure.fromCompactSerialization(jwtTokenString);<NEW_LINE>// we should have a JWE, not a JWS<NEW_LINE>if (joseObject instanceof JsonWebEncryption) {<NEW_LINE>fail("Token is encrypted");<NEW_LINE>}<NEW_LINE>JwtTokenForTest tokenForTest = new JwtTokenForTest(jwtTokenString);<NEW_LINE>JsonObject jweHeader = tokenForTest.getJsonJWEHeader();<NEW_LINE>if (jweHeader != null) {<NEW_LINE>fail("Token was not a proper JWS - JWE Header was populated");<NEW_LINE>}<NEW_LINE>Log.info(thisClass, thisMethod, "Validation of the JWS was successful");<NEW_LINE>return tokenForTest;<NEW_LINE>} | extractJwtTokenFromResponse(response, JWTBuilderConstants.BUILT_JWT_TOKEN); |
1,278,571 | private void parseQueryCacheInternal(BeanDefinitionBuilder builder, Node node, String nodeName, String textContent) {<NEW_LINE>if ("predicate".equals(nodeName)) {<NEW_LINE>BeanDefinitionBuilder predicateBuilder = getPredicate(node, textContent);<NEW_LINE>builder.addPropertyValue("predicateConfig", predicateBuilder.getBeanDefinition());<NEW_LINE>} else if ("entry-listeners".equals(nodeName)) {<NEW_LINE>ManagedList listeners = getEntryListeners(node);<NEW_LINE>builder.addPropertyValue("entryListenerConfigs", listeners);<NEW_LINE>} else if ("include-value".equals(nodeName)) {<NEW_LINE>builder.addPropertyValue("includeValue", textContent);<NEW_LINE>} else if ("batch-size".equals(nodeName)) {<NEW_LINE>builder.addPropertyValue("batchSize", textContent);<NEW_LINE>} else if ("buffer-size".equals(nodeName)) {<NEW_LINE>builder.addPropertyValue("bufferSize", textContent);<NEW_LINE>} else if ("delay-seconds".equals(nodeName)) {<NEW_LINE>builder.addPropertyValue("delaySeconds", textContent);<NEW_LINE>} else if ("in-memory-format".equals(nodeName)) {<NEW_LINE>String value = textContent.trim();<NEW_LINE>builder.addPropertyValue("inMemoryFormat", InMemoryFormat.valueOf(upperCaseInternal(value)));<NEW_LINE>} else if ("coalesce".equals(nodeName)) {<NEW_LINE>builder.addPropertyValue("coalesce", textContent);<NEW_LINE>} else if ("populate".equals(nodeName)) {<NEW_LINE><MASK><NEW_LINE>} else if ("serialize-keys".equals(nodeName)) {<NEW_LINE>builder.addPropertyValue("serializeKeys", textContent);<NEW_LINE>} else if ("indexes".equals(nodeName)) {<NEW_LINE>ManagedList indexes = getIndexes(node);<NEW_LINE>builder.addPropertyValue("indexConfigs", indexes);<NEW_LINE>} else if ("eviction".equals(nodeName)) {<NEW_LINE>builder.addPropertyValue("evictionConfig", getEvictionConfig(node, false, false));<NEW_LINE>}<NEW_LINE>} | builder.addPropertyValue("populate", textContent); |
834,706 | static byte[] decode_base64(String s, int maxolen) throws IllegalArgumentException {<NEW_LINE>StringBuilder rs = new StringBuilder();<NEW_LINE>int off = 0, slen = s.length(), olen = 0;<NEW_LINE>byte[] ret;<NEW_LINE>byte c1, c2, c3, c4, o;<NEW_LINE>if (maxolen <= 0)<NEW_LINE>throw new IllegalArgumentException("Invalid maxolen");<NEW_LINE>while (off < slen - 1 && olen < maxolen) {<NEW_LINE>c1 = char64(s.charAt(off++));<NEW_LINE>c2 = char64(s.charAt(off++));<NEW_LINE>if (c1 == -1 || c2 == -1)<NEW_LINE>break;<NEW_LINE>o = (byte) (c1 << 2);<NEW_LINE>o |= (c2 & 0x30) >> 4;<NEW_LINE>rs.append((char) o);<NEW_LINE>if (++olen >= maxolen || off >= slen)<NEW_LINE>break;<NEW_LINE>c3 = char64(s.charAt(off++));<NEW_LINE>if (c3 == -1)<NEW_LINE>break;<NEW_LINE>o = (byte) ((c2 & 0x0f) << 4);<NEW_LINE>o |= (c3 & 0x3c) >> 2;<NEW_LINE>rs.append((char) o);<NEW_LINE>if (++olen >= maxolen || off >= slen)<NEW_LINE>break;<NEW_LINE>c4 = char64(<MASK><NEW_LINE>o = (byte) ((c3 & 0x03) << 6);<NEW_LINE>o |= c4;<NEW_LINE>rs.append((char) o);<NEW_LINE>++olen;<NEW_LINE>}<NEW_LINE>ret = new byte[olen];<NEW_LINE>for (off = 0; off < olen; off++) ret[off] = (byte) rs.charAt(off);<NEW_LINE>return ret;<NEW_LINE>} | s.charAt(off++)); |
1,377,890 | protected void sync() {<NEW_LINE>inSync = true;<NEW_LINE>WSDLComponent secBinding = null;<NEW_LINE>WSDLComponent topSecBinding = SecurityPolicyModelHelper.getSecurityBindingTypeElement(comp);<NEW_LINE>WSDLComponent protTokenKind = SecurityTokensModelHelper.getTokenElement(topSecBinding, ProtectionToken.class);<NEW_LINE>WSDLComponent protToken = SecurityTokensModelHelper.getTokenTypeElement(protTokenKind);<NEW_LINE>boolean secConv = (protToken instanceof SecureConversationToken);<NEW_LINE>setChBox(secConvChBox, secConv);<NEW_LINE>if (secConv) {<NEW_LINE>WSDLComponent bootPolicy = SecurityTokensModelHelper.getTokenElement(protToken, BootstrapPolicy.class);<NEW_LINE>secBinding = SecurityPolicyModelHelper.getSecurityBindingTypeElement(bootPolicy);<NEW_LINE>Policy p = (Policy) secBinding.getParent();<NEW_LINE>setChBox(derivedKeysChBox, SecurityPolicyModelHelper.isRequireDerivedKeys(protToken));<NEW_LINE>setChBox(reqSigConfChBox, SecurityPolicyModelHelper.isRequireSignatureConfirmation(p));<NEW_LINE>setChBox(encryptSignatureChBox<MASK><NEW_LINE>setChBox(encryptOrderChBox, SecurityPolicyModelHelper.isEncryptBeforeSigning(bootPolicy));<NEW_LINE>} else {<NEW_LINE>secBinding = SecurityPolicyModelHelper.getSecurityBindingTypeElement(comp);<NEW_LINE>setChBox(derivedKeysChBox, false);<NEW_LINE>setChBox(reqSigConfChBox, SecurityPolicyModelHelper.isRequireSignatureConfirmation(comp));<NEW_LINE>setChBox(encryptSignatureChBox, SecurityPolicyModelHelper.isEncryptSignature(comp));<NEW_LINE>setChBox(encryptOrderChBox, SecurityPolicyModelHelper.isEncryptBeforeSigning(comp));<NEW_LINE>}<NEW_LINE>WSDLComponent tokenKind = SecurityTokensModelHelper.getTokenElement(secBinding, ProtectionToken.class);<NEW_LINE>WSDLComponent token = SecurityTokensModelHelper.getTokenTypeElement(tokenKind);<NEW_LINE>setChBox(reqDerivedKeys, SecurityPolicyModelHelper.isRequireDerivedKeys(token));<NEW_LINE>setCombo(algoSuiteCombo, AlgoSuiteModelHelper.getAlgorithmSuite(secBinding));<NEW_LINE>setCombo(layoutCombo, SecurityPolicyModelHelper.getMessageLayout(secBinding));<NEW_LINE>if (secConv) {<NEW_LINE>tokenKind = SecurityTokensModelHelper.getSupportingToken(secBinding.getParent(), suppTokenTypeUsed);<NEW_LINE>} else {<NEW_LINE>tokenKind = SecurityTokensModelHelper.getSupportingToken(comp, suppTokenTypeUsed);<NEW_LINE>}<NEW_LINE>token = SecurityTokensModelHelper.getTokenTypeElement(tokenKind);<NEW_LINE>setChBox(reqDerivedKeysIssued, SecurityPolicyModelHelper.isRequireDerivedKeys(token));<NEW_LINE>setCombo(tokenTypeCombo, SecurityTokensModelHelper.getIssuedTokenType(token));<NEW_LINE>setCombo(keyTypeCombo, SecurityTokensModelHelper.getIssuedKeyType(token));<NEW_LINE>setCombo(keySizeCombo, SecurityTokensModelHelper.getIssuedKeySize(token));<NEW_LINE>issuerAddressField.setText(SecurityTokensModelHelper.getIssuedIssuerAddress(token));<NEW_LINE>issuerMetadataField.setText(SecurityTokensModelHelper.getIssuedIssuerMetadataAddress(token));<NEW_LINE>enableDisable();<NEW_LINE>inSync = false;<NEW_LINE>} | , SecurityPolicyModelHelper.isEncryptSignature(bootPolicy)); |
1,140,847 | public void secureMessageEncrypt(String message, ReadableArray privateKey, ReadableArray publicKey, Callback successCallback, Callback errorCallback) {<NEW_LINE>if (privateKey == null || privateKey.size() == 0) {<NEW_LINE>errorCallback.invoke(privateKeyRequired);<NEW_LINE>return;<NEW_LINE>}<NEW_LINE>if (publicKey == null || publicKey.size() == 0) {<NEW_LINE>errorCallback.invoke(publicKeyRequired);<NEW_LINE>return;<NEW_LINE>}<NEW_LINE>byte[] bkey;<NEW_LINE>PrivateKey pvtKey;<NEW_LINE>PublicKey pubKey;<NEW_LINE>try {<NEW_LINE>bkey = dataDeserialize(privateKey);<NEW_LINE>pvtKey = new PrivateKey(bkey);<NEW_LINE>bkey = dataDeserialize(publicKey);<NEW_LINE>pubKey = new PublicKey(bkey);<NEW_LINE>} catch (ByteOverflowException e) {<NEW_LINE>errorCallback.invoke(e.getMessage());<NEW_LINE>return;<NEW_LINE>}<NEW_LINE>byte[] msg = message.getBytes(StandardCharsets.UTF_8);<NEW_LINE>SecureMessage secureMessage <MASK><NEW_LINE>try {<NEW_LINE>byte[] encrypted = secureMessage.wrap(msg, pubKey);<NEW_LINE>WritableArray response = dataSerialize(encrypted);<NEW_LINE>successCallback.invoke(response);<NEW_LINE>} catch (NullArgumentException | SecureMessageWrapException e) {<NEW_LINE>errorCallback.invoke(e.getMessage());<NEW_LINE>}<NEW_LINE>} | = new SecureMessage(pvtKey, pubKey); |
1,169,950 | private void save(ServerIntFloatRow row, PSMatrixSaveContext saveContext, MatrixPartitionMeta meta, DataOutputStream out) throws IOException {<NEW_LINE>int startCol = <MASK><NEW_LINE>IntFloatVector vector = ServerRowUtils.getVector(row);<NEW_LINE>IntFloatElement element = new IntFloatElement();<NEW_LINE>if (vector.isDense()) {<NEW_LINE>float[] data = vector.getStorage().getValues();<NEW_LINE>for (int i = 0; i < data.length; i++) {<NEW_LINE>element.rowId = row.getRowId();<NEW_LINE>element.colId = startCol + i;<NEW_LINE>element.value = data[i];<NEW_LINE>save(element, out);<NEW_LINE>}<NEW_LINE>} else {<NEW_LINE>if (saveContext.sortFirst()) {<NEW_LINE>int[] indices = vector.getStorage().getIndices();<NEW_LINE>float[] values = vector.getStorage().getValues();<NEW_LINE>Sort.quickSort(indices, values, 0, indices.length - 1);<NEW_LINE>for (int i = 0; i < indices.length; i++) {<NEW_LINE>element.rowId = row.getRowId();<NEW_LINE>element.colId = indices[i] + startCol;<NEW_LINE>element.value = values[i];<NEW_LINE>save(element, out);<NEW_LINE>}<NEW_LINE>} else {<NEW_LINE>ObjectIterator<Int2FloatMap.Entry> iter = vector.getStorage().entryIterator();<NEW_LINE>Int2FloatMap.Entry entry;<NEW_LINE>while (iter.hasNext()) {<NEW_LINE>entry = iter.next();<NEW_LINE>element.rowId = row.getRowId();<NEW_LINE>element.colId = entry.getIntKey() + startCol;<NEW_LINE>element.value = entry.getFloatValue();<NEW_LINE>save(element, out);<NEW_LINE>}<NEW_LINE>}<NEW_LINE>}<NEW_LINE>} | (int) meta.getStartCol(); |
1,822,884 | public cn.wildfirechat.proto.WFCMessage.SetGroupManagerRequest buildPartial() {<NEW_LINE>cn.wildfirechat.proto.WFCMessage.SetGroupManagerRequest result = new cn.wildfirechat.proto.WFCMessage.SetGroupManagerRequest(this);<NEW_LINE>int from_bitField0_ = bitField0_;<NEW_LINE>int to_bitField0_ = 0;<NEW_LINE>if (((from_bitField0_ & 0x00000001) == 0x00000001)) {<NEW_LINE>to_bitField0_ |= 0x00000001;<NEW_LINE>}<NEW_LINE>result.groupId_ = groupId_;<NEW_LINE>if (((from_bitField0_ & 0x00000002) == 0x00000002)) {<NEW_LINE>to_bitField0_ |= 0x00000002;<NEW_LINE>}<NEW_LINE>result.type_ = type_;<NEW_LINE>if (((bitField0_ & 0x00000004) == 0x00000004)) {<NEW_LINE>userId_ = new com.google.protobuf.UnmodifiableLazyStringList(userId_);<NEW_LINE><MASK><NEW_LINE>}<NEW_LINE>result.userId_ = userId_;<NEW_LINE>if (((bitField0_ & 0x00000008) == 0x00000008)) {<NEW_LINE>toLine_ = java.util.Collections.unmodifiableList(toLine_);<NEW_LINE>bitField0_ = (bitField0_ & ~0x00000008);<NEW_LINE>}<NEW_LINE>result.toLine_ = toLine_;<NEW_LINE>if (((from_bitField0_ & 0x00000010) == 0x00000010)) {<NEW_LINE>to_bitField0_ |= 0x00000004;<NEW_LINE>}<NEW_LINE>if (notifyContentBuilder_ == null) {<NEW_LINE>result.notifyContent_ = notifyContent_;<NEW_LINE>} else {<NEW_LINE>result.notifyContent_ = notifyContentBuilder_.build();<NEW_LINE>}<NEW_LINE>result.bitField0_ = to_bitField0_;<NEW_LINE>onBuilt();<NEW_LINE>return result;<NEW_LINE>} | bitField0_ = (bitField0_ & ~0x00000004); |
615,091 | public static BigDecimal convertBase(SetGetModel model, String DateName, String SourceAmtName, String AmtName, String changedColumnName) {<NEW_LINE>// If Currency changed, reset rate<NEW_LINE>if (changedColumnName != null && "C_Currency_ID".equalsIgnoreCase(changedColumnName)) {<NEW_LINE>model.set_AttrValue("CurrencyRate", Env.ZERO);<NEW_LINE>}<NEW_LINE>// Source Amount<NEW_LINE>BigDecimal sourceAmt = SetGetUtil.get_AttrValueAsBigDecimal(model, SourceAmtName);<NEW_LINE>if (sourceAmt == null || sourceAmt.signum() == 0) {<NEW_LINE>if (AmtName != null) {<NEW_LINE>model.set_AttrValue(AmtName, Env.ZERO);<NEW_LINE>}<NEW_LINE>return Env.ZERO;<NEW_LINE>}<NEW_LINE>// AD_Client_ID<NEW_LINE>int AD_Client_ID = SetGetUtil.get_AttrValueAsInt(model, "AD_Client_ID");<NEW_LINE>// Currency To<NEW_LINE>int C_Currency_ID_To = MClient.get(model.getCtx(), AD_Client_ID).getAcctSchema().getC_Currency_ID();<NEW_LINE>// ~ model.set_AttrValue("C_Currency_ID_To", Integer.valueOf(C_Currency_ID_To));<NEW_LINE>// Get Rate<NEW_LINE>BigDecimal rate = SetGetUtil.get_AttrValueAsBigDecimal(model, "CurrencyRate");<NEW_LINE>if (rate == null || rate.signum() == 0) {<NEW_LINE>int AD_Org_ID = SetGetUtil.get_AttrValueAsInt(model, "AD_Client_ID");<NEW_LINE>Timestamp ConvDate = SetGetUtil.get_AttrValueAsDate(model, DateName);<NEW_LINE>int C_Currency_ID = SetGetUtil.get_AttrValueAsInt(model, "C_Currency_ID");<NEW_LINE>if (C_Currency_ID == C_Currency_ID_To) {<NEW_LINE>rate = Env.ONE;<NEW_LINE>} else {<NEW_LINE>int C_ConversionType_ID = SetGetUtil.get_AttrValueAsInt(model, "C_ConversionType_ID");<NEW_LINE>rate = MConversionRate.getRate(C_Currency_ID, C_Currency_ID_To, ConvDate, C_ConversionType_ID, AD_Client_ID, AD_Org_ID);<NEW_LINE>if (rate == null) {<NEW_LINE>// NoCurrencyConversion<NEW_LINE>throw new NoCurrencyConversionException(C_Currency_ID, C_Currency_ID_To, ConvDate, C_ConversionType_ID, AD_Client_ID, AD_Org_ID);<NEW_LINE>}<NEW_LINE>}<NEW_LINE>}<NEW_LINE>model.set_AttrValue("CurrencyRate", rate);<NEW_LINE>// Calculate converted amount<NEW_LINE>BigDecimal amt = sourceAmt.multiply(rate);<NEW_LINE>int stdPrecision = MCurrency.getStdPrecision(<MASK><NEW_LINE>amt = amt.setScale(stdPrecision, RoundingMode.HALF_UP);<NEW_LINE>// Update model<NEW_LINE>if (AmtName != null)<NEW_LINE>model.set_AttrValue(AmtName, amt);<NEW_LINE>// Return amt<NEW_LINE>if (CLogMgt.isLevelFine())<NEW_LINE>s_log.fine("amt=" + sourceAmt + " * " + rate + "=" + amt + ", scale=" + stdPrecision);<NEW_LINE>return amt;<NEW_LINE>} | model.getCtx(), C_Currency_ID_To); |
1,423,785 | public void mutate() {<NEW_LINE>Mutation mutation = getMutation();<NEW_LINE>try {<NEW_LINE>context.getZooReaderWriter().mutateOrCreate(context.getZooKeeperRoot() + RootTable.ZROOT_TABLET, new byte[0], currVal -> {<NEW_LINE>// Earlier, it was checked that root tablet metadata did not exists. However the<NEW_LINE>// earlier check does handle race conditions. Race conditions are unexpected. This is<NEW_LINE>// a sanity check when making the update in ZK using compare and set. If this fails<NEW_LINE>// and its not a bug, then its likely some concurrency issue. For example two managers<NEW_LINE>// concurrently running upgrade could cause this to fail.<NEW_LINE>Preconditions.checkState(currVal.length == 0, "Expected root tablet metadata to be empty!");<NEW_LINE>var rtm = new RootTabletMetadata();<NEW_LINE>rtm.update(mutation);<NEW_LINE><MASK><NEW_LINE>log.info("Upgrading root tablet metadata, writing following to ZK : \n {}", json);<NEW_LINE>return json.getBytes(UTF_8);<NEW_LINE>});<NEW_LINE>} catch (Exception e) {<NEW_LINE>throw new RuntimeException(e);<NEW_LINE>}<NEW_LINE>} | String json = rtm.toJson(); |
1,714,478 | public I_C_Print_Package createResponse(final I_C_Print_Package printPackage) {<NEW_LINE>final Properties envCtxToUse = InterfaceWrapperHelper.getCtx(printPackage);<NEW_LINE>// create/update information for Druck-Clients<NEW_LINE>final IPrintClientsBL printClientsBL = Services.get(IPrintClientsBL.class);<NEW_LINE>printClientsBL.createPrintClientsEntry(envCtxToUse<MASK><NEW_LINE>boolean packageUpdated = false;<NEW_LINE>final I_C_Print_Package responsePrintPackage;<NEW_LINE>try {<NEW_LINE>packageUpdated = updatePrintPackage(printPackage);<NEW_LINE>} finally {<NEW_LINE>if (packageUpdated) {<NEW_LINE>responsePrintPackage = printPackage;<NEW_LINE>} else {<NEW_LINE>logger.debug("There was no update on print package. Deleting it");<NEW_LINE>InterfaceWrapperHelper.delete(printPackage);<NEW_LINE>responsePrintPackage = null;<NEW_LINE>}<NEW_LINE>}<NEW_LINE>return responsePrintPackage;<NEW_LINE>} | , printClientsBL.getHostKeyOrNull(envCtxToUse)); |
339,683 | public ApiResponse<RegistrationInformationSubuser> registrationRegisterAccountSubuserWithHttpInfo(String userid) throws ApiException {<NEW_LINE>Object localVarPostBody = null;<NEW_LINE>// verify the required parameter 'userid' is set<NEW_LINE>if (userid == null) {<NEW_LINE><MASK><NEW_LINE>}<NEW_LINE>// create path and map variables<NEW_LINE>String localVarPath = "/v4/registration/user/{userid}".replaceAll("\\{" + "userid" + "\\}", apiClient.escapeString(userid.toString()));<NEW_LINE>// query params<NEW_LINE>List<Pair> localVarQueryParams = new ArrayList<Pair>();<NEW_LINE>Map<String, String> localVarHeaderParams = new HashMap<String, String>();<NEW_LINE>Map<String, Object> localVarFormParams = new HashMap<String, Object>();<NEW_LINE>final String[] localVarAccepts = { "application/json", "text/json" };<NEW_LINE>final String localVarAccept = apiClient.selectHeaderAccept(localVarAccepts);<NEW_LINE>final String[] localVarContentTypes = {};<NEW_LINE>final String localVarContentType = apiClient.selectHeaderContentType(localVarContentTypes);<NEW_LINE>String[] localVarAuthNames = new String[] { "oauth2" };<NEW_LINE>GenericType<RegistrationInformationSubuser> localVarReturnType = new GenericType<RegistrationInformationSubuser>() {<NEW_LINE>};<NEW_LINE>return apiClient.invokeAPI(localVarPath, "GET", localVarQueryParams, localVarPostBody, localVarHeaderParams, localVarFormParams, localVarAccept, localVarContentType, localVarAuthNames, localVarReturnType);<NEW_LINE>} | throw new ApiException(400, "Missing the required parameter 'userid' when calling registrationRegisterAccountSubuser"); |
253,562 | public ModelApiResponse uploadFile(Long petId, String additionalMetadata, File file) throws RestClientException {<NEW_LINE>Object postBody = null;<NEW_LINE>// verify the required parameter 'petId' is set<NEW_LINE>if (petId == null) {<NEW_LINE>throw new HttpClientErrorException(HttpStatus.BAD_REQUEST, "Missing the required parameter 'petId' when calling uploadFile");<NEW_LINE>}<NEW_LINE>// create path and map variables<NEW_LINE>final Map<String, Object> uriVariables = new HashMap<String, Object>();<NEW_LINE>uriVariables.put("petId", petId);<NEW_LINE>String path = UriComponentsBuilder.fromPath("/pet/{petId}/uploadImage").buildAndExpand(uriVariables).toUriString();<NEW_LINE>final MultiValueMap<String, String> queryParams = new <MASK><NEW_LINE>final HttpHeaders headerParams = new HttpHeaders();<NEW_LINE>final MultiValueMap<String, Object> formParams = new LinkedMultiValueMap<String, Object>();<NEW_LINE>if (additionalMetadata != null)<NEW_LINE>formParams.add("additionalMetadata", additionalMetadata);<NEW_LINE>if (file != null)<NEW_LINE>formParams.add("file", new FileSystemResource(file));<NEW_LINE>final String[] accepts = { "application/json" };<NEW_LINE>final List<MediaType> accept = apiClient.selectHeaderAccept(accepts);<NEW_LINE>final String[] contentTypes = { "multipart/form-data" };<NEW_LINE>final MediaType contentType = apiClient.selectHeaderContentType(contentTypes);<NEW_LINE>String[] authNames = new String[] { "petstore_auth" };<NEW_LINE>ParameterizedTypeReference<ModelApiResponse> returnType = new ParameterizedTypeReference<ModelApiResponse>() {<NEW_LINE>};<NEW_LINE>return apiClient.invokeAPI(path, HttpMethod.POST, queryParams, postBody, headerParams, formParams, accept, contentType, authNames, returnType);<NEW_LINE>} | LinkedMultiValueMap<String, String>(); |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.