text:
package org.jenkinsci.plugins.dockerbuildstep.cmd;

import hudson.Extension;
import hudson.model.AbstractBuild;

import java.util.List;

import org.jenkinsci.plugins.dockerbuildstep.action.EnvInvisibleAction;
import org.jenkinsci.plugins.dockerbuildstep.log.ConsoleLogger;
import org.jenkinsci.plugins.dockerbuildstep.util.Resolver;
import org.kohsuke.stapler.DataBoundConstructor;

import com.github.dockerjava.api.DockerClient;
import com.github.dockerjava.api.DockerException;
import com.github.dockerjava.api.model.Container;
import com.github.dockerjava.api.command.InspectContainerResponse;

/**
 * This command starts all containers create from specified image ID. It also exports some build environment variable
 * like IP or started containers.
 *
 * @author vjuranek
 *
 */
public class StartByImageIdCommand extends DockerCommand {

    private final String imageId;

    @DataBoundConstructor
    public StartByImageIdCommand(String imageId) {
        this.imageId = imageId;
    }

    public String getImageId() {
        return imageId;
    }

    @Override
    public void execute(@SuppressWarnings("rawtypes") AbstractBuild build, ConsoleLogger console)
            throws DockerException {
        if (imageId == null || imageId.isEmpty()) {
            throw new IllegalArgumentException("At least one parameter is required");
        }

        String imageIdRes = Resolver.buildVar(build, imageId);

        DockerClient client = getClient(build, null);
        List<Container> containers = client.listContainersCmd().withShowAll(true).exec();
        for (Container c : containers) {
            if (imageIdRes.equalsIgnoreCase(c.getImage())) {
                client.startContainerCmd(c.getId());
                console.logInfo("started container id " + c.getId());

                InspectContainerResponse inspectResp = client.inspectContainerCmd(c.getId()).exec();
                EnvInvisibleAction envAction = new EnvInvisibleAction(inspectResp);
                build.addAction(envAction);
            }
        }
    }

    @Extension
    public static class StartByImageCommandDescriptor extends DockerCommandDescriptor {
        @Override
        public String getDisplayName() {
            return "Start container(s) by image ID";
        }
    }

}


text:
<mat-card class = "public-profile-container">
    <mat-card-title>Einstellungen</mat-card-title>
    <mat-divider></mat-divider>

Öffentliches Profil

	<mat-card-content class = "profile-content-container">
	    <form (ngSubmit)="updateUser()" class = "update-user-form">
 			<mat-form-field>
				<input matInput type = "text" placeholder="Vorname" [(ngModel)]="userData.firstname" name = "firstname">

					<mat-icon class = "mdi-24" fontSet="mdi" fontIcon="mdi-account" svgSrc = "/assets/icon/account.svg"></mat-icon>

			</mat-form-field>
			<mat-form-field>
				<input matInput type = "text" placeholder="Nachname" [(ngModel)]="userData.lastname" name = "lastname">

					<mat-icon class = "mdi-24" fontSet="mdi" fontIcon="mdi-account" svgSrc = "/assets/icon/account.svg"></mat-icon>

			</mat-form-field>
			<mat-form-field>
				<input matInput type = "text" placeholder="Email" [(ngModel)]="userData.email" name = "email">

					<mat-icon class = "mdi-24" fontSet="mdi" fontIcon="mdi-email-open" svgSrc = "/assets/icon/email-open.svg"></mat-icon>

			</mat-form-field>
		  	<mat-form-field>
				<textarea matInput type = "text" placeholder="Bio - erzähl uns was über dich" [(ngModel)]="userData.bio" name = "bio">

						<mat-icon class = "mdi-24" fontSet="mdi" fontIcon="mdi-bio" svgSrc = "/assets/icon/bio.svg"></mat-icon>

				</textarea>
			</mat-form-field>
			<mat-form-field>
			<input matInput type = "text" placeholder="Url" [(ngModel)]="userData.url" name = "url">

					<mat-icon class = "mdi-24" fontSet="mdi" fontIcon="mdi-mail-ru" svgSrc = "/assets/icon/mail-ru.svg"></mat-icon>

			</mat-form-field>
			<mat-form-field>
			<input matInput type = "text" placeholder="Firma" [(ngModel)]="userData.company" name = "company">

					<mat-icon class = "mdi-24" fontSet="mdi" fontIcon="mdi-domain" svgSrc = "/assets/icon/domain.svg"></mat-icon>

			</mat-form-field>
			<mat-form-field>
			<input matInput type = "text" placeholder="Ort" [(ngModel)]="userData.location" name = "location">

					<mat-icon class = "mdi-24" fontSet="mdi" fontIcon="mdi-account-location" svgSrc = "/assets/icon/account-location.svg"></mat-icon>

			</mat-form-field>
		  	<button mat-raised-button type="submit" color = "primary" class = "align-end">Profil aktualisieren</button>
		</form>

			<fileupload [model]="'/User'" [id]="'/' + user._id" [property]="'/image'" (onUpload)="onUpload($event)" class = "file-upload-component"></fileupload>

	</mat-card-content>
</mat-card>

redpajama_set_name: RedPajamaGithub


text:
require 'spec_helper'

class Hash
  def symbolize_keys
    keys.inject({}) do |object_hash, key|
      object_hash[key.to_sym] = self.send(:[], key)
      object_hash
    end
  end
end

module SimplePresenters
  module Tests
    module TestObjectPresenter
      include SimplePresenters::Presenter
      def default
        [:clear_param, :extra_param]
      end

      def method_test
        [:clear_param, :method_param_test]
      end
    end
    class TestObject
      include TestObjectPresenter

      attr_accessor :filtered_param, :clear_param, :extra_param, :test_param

      def self.filtered_parameters
        [:filtered_param]
      end

      def attributes
        { "filtered_param" => self.filtered_param, "clear_param" => self.clear_param, "extra_param" => self.extra_param, "test_param" => 'test_param' }
      end

      def initialize
        self.filtered_param = "this param should not be exposed"
        self.clear_param = "this one should be"
        self.extra_param = "an extra param"
        self.test_param = "a test param"
      end

      def method_param_test
        "Hello World"
      end
    end
  end
end

describe "stub" do
  it "should pass" do
    # pass
  end
end

describe "Tests using PORO" do

  before(:all) do
    @test_object = SimplePresenters::Tests::TestObject.new
  end

  it "should not expose protected attributes" do
    p = @test_object.present_as(:all)
    p.keys.should_not include(:filtered_param)
  end

  it "should expose unprotected attributes by default" do
    p = @test_object.present_as(:all)
    p.keys.should include(:clear_param)
    p.keys.should include(:extra_param)
    p.keys.should include(:test_param)
  end

  it "should not return extra attributes" do
    p = @test_object.present_as(:default)
    p.keys.should include(:clear_param)
    p.keys.should include(:extra_param)
    p.keys.should_not include(:filtered_param)
    p.keys.should_not include(:test_param)
  end

  it "should be able to use methods" do
    p = @test_object.present_as(:method_test)
    p.keys.should include(:clear_param)
    p.keys.should include(:method_param_test)
    p[:method_param_test].should eq("Hello World")
  end

end


text:
var Hoek = require('hoek');
var Defaults = require('./defaults');
var Memory = require('./memory');
// Mongo and Redis are loaded below depending on the configuration

// Declare internals

var internals = {};

module.exports = internals.Client = function (options) {

    Hoek.assert(this.constructor === internals.Client, 'Cache client must be instantiated using new');
    this.settings = Defaults.apply(options);
    Hoek.assert(this.settings.partition && this.settings.partition.match(/^[\w\-]+$/), 'Invalid partition name:' + this.settings.partition);

    // Create internal connection

    var engine = this.settings.engine;
    if (engine === 'extension') {
        this.connection = this.settings.extension;
    }
    else {
        var factory = null;

        if (engine === 'redis') {
            factory = require('./redis');
        }
        else if (engine === 'mongodb') {
            factory = require('./mongo');
        }
        else if (engine === 'memcache') {
            factory = require('./memcache');
        }
        else if (engine === 'memory') {
            factory = Memory;
        }

        Hoek.assert(factory, 'Unknown cache engine type');
        this.connection = new factory.Connection(this.settings);
    }

    return this;
};

internals.Client.prototype.stop = function () {

    this.connection.stop();
};

internals.Client.prototype.start = function (callback) {

    this.connection.start(callback);
};

internals.Client.prototype.isReady = function () {

    return this.connection.isReady();
};

internals.Client.prototype.validateSegmentName = function (name) {

    return this.connection.validateSegmentName(name);
};

internals.Client.prototype.get = function (key, callback) {

    var self = this;

    if (!this.connection.isReady()) {
        // Disconnected
        return callback(new Error('Disconnected'));
    }

    if (key === null) {
        // null key not allowed
        return callback(null, null);
    }

    if (!key || !key.id || !key.segment) {
        return callback(new Error('Invalid key'));
    }

    this.connection.get(key, function (err, result) {

        if (err) {
            // Connection error
            return callback(err);
        }

        if (!result ||
            !result.item) {

            // Not found
            return callback(null, null);
        }

        var now = Date.now();
        var expires = result.stored + result.ttl;
        var ttl = expires - now;
        if (ttl <= 0) {
            // Expired
            return callback(null, null);
        }

        // Valid

        var cached = {
            item: result.item,
            stored: result.stored,
            ttl: ttl
        };

        return callback(null, cached);
    });
};

internals.Client.prototype.set = function (key, value, ttl, callback) {

    if (!this.connection.isReady()) {
        // Disconnected
        return callback(new Error('Disconnected'));
    }

    if (!key || !key.id || !key.segment) {
        return callback(new Error('Invalid key'));
    }

    if (ttl > 2147483647) {                                                         // Math.pow(2, 31)
        return callback(new Error('Invalid ttl (greater than 2147483647)'));
    }

    if (ttl <= 0) {
        // Not cachable (or bad rules)
        return callback();
    }

    this.connection.set(key, value, ttl, callback);
};

internals.Client.prototype.drop = function (key, callback) {

    if (!this.connection.isReady()) {
        // Disconnected
        return callback(new Error('Disconnected'));
    }

    if (!key || !key.id || !key.segment) {
        return callback(new Error('Invalid key'));
    }

    this.connection.drop(key, callback);           // Always drop, regardless of caching rules
};


text:
ActiveRecord::Schema.define(version: 20160709124835) do

  # These are extensions that must be enabled in order to support this database
  enable_extension "plpgsql"

  create_table "courses", force: :cascade do |t|
    t.string   "name"
    t.string   "address1"
    t.string   "address2"
    t.string   "city"
    t.string   "state"
    t.string   "zip"
    t.datetime "created_at", null: false
    t.datetime "updated_at", null: false
  end

end


text:
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">

    <meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
    <title>STKMoog</title>
    <link rel="stylesheet" type="text/css" href="csound.css" />
    <meta name="generator" content="DocBook XSL Stylesheets V1.78.1" />
    <link rel="home" href="index.html" title="Manuel de référence canonique de Csound" />
    <link rel="up" href="OpcodesTop.html" title="Opcodes et opérateurs de l'orchestre" />
    <link rel="prev" href="STKModalBar.html" title="STKModalBar" />
    <link rel="next" href="STKPercFlut.html" title="STKPercFlut" />

          STKMoog

          Précédent
          Opcodes et opérateurs de l'orchestre
           Suivant

          STKMoog

STKMoog —
      STKMoog produit des sons de filtre à balayage comme sur un moog.

Description

      STKMoog produit des sons de filtre à balayage comme sur
      un moog, en utilisant une onde pour l'attaque, une onde pour la boucle et
      une enveloppe ADSR, et en ajoutant deux filtres à balayage de formant.

Syntaxe

asignal STKMoog ifrequency, iamplitude, [kq, kv1[, krate, kv2[, klfo, kv3[, klfodepth, kv4[, kvol, kv5]]]]]

Initialisation

      ifrequency -- Fréquence de la note jouée, en Hz.

      iamplitude -- Amplitude de la note jouée (entre 0 et 1).

Exécution

kq -- contrôleur 2, Q du filtre. kv1 compris entre 0 et 127.

krate -- contrôleur 4, taux de balayage du filtre. kv2 compris entre 0 et 127.

klfo -- contrôleur 11, vitesse de l'oscillateur basse-fréquence. kv3 compris entre 0 et 127.

klfodepth -- contrôleur 1, intensité de l'oscillateur basse-fréquence. kv4 compris entre 0 et 127.

kvol -- contrôleur 128, volume. kv5 compris entre 0 et 127.

              Notes

        Le code pour cet opcode vient directement de la classe
        Moog du Synthesis Toolkit en C++ par Perry R.
        Cook et Gary P. Scavone. On peut en savoir plus sur les classes STK ici :

        https://ccrma.stanford.edu/software/stk/classes.html

        kc1, kv1, kc2, kv2, kc3, kv3, kc4, kv4, kc5, kv5, kc6, kv6, kc7, kv7, kc8, kv8 --
        Jusqu'à 8 paires de contrôle facultatives au taux-k pour les opcodes STK.
        Chaque paire de contrôle est constituée d'un numéro de contrôleur
        (kc) suivi d'une valeur de contrôleur
        (kv). Le numéro de contrôleur ainsi que la valeur
        associée sont des variables de taux-k. Cependant, durant l'exécution,
        les numéros de contrôleur sont habituellement constants tandis que les valeurs
        correspondantes peuvent changer à tout moment. L'ordre des paires de
        contrôle est arbitraire mais elles doivent apparaître après
        iamplitude. Il n'est pas non plus nécessaire d'utiliser
        toutes les paires.

Exemples

      Voici un exemple de l'opcode STKMoog. Il utilise le fichier
      STKMoog.csd.

            Exemple 889. Exemple de l'opcode STKMoog.

<CsoundSynthesizer>
<CsOptions>
; Select audio/midi flags here according to platform
-odac     ;;;realtime audio out
;-iadc    ;;;uncomment -iadc if RT audio input is needed too
; For Non-realtime ouput leave only the line below:
; -o STKMoog.wav -W ;;; for file output any platform
</CsOptions>
<CsInstruments>

sr = 44100
ksmps = 32
nchnls = 2
0dbfs  = 1

instr 1

ifrq	=	p4
kv1	line	p5, p3, p6				;filter Q

asig	STKMoog cpspch(ifrq), 1, 2,kv1, 4, 120, 11, 40, 1, 1, 128, 120
asig	=	asig * .3				;too loud
	outs asig, asig
endin

</CsInstruments>
<CsScore>

i 1 0 .5 6.00 100 0
i 1 + .  5.05 10 127
i 1 + .  7.06 100 0
i 1 + 3  7.00 10 10
e
</CsScore>
</CsoundSynthesizer>

Crédits

            Auteur : Michael Gogins (d'après Perry Cook)

            Irreducible Productions

            New York, NY

Nouveau dans la version 5.11 de Csound.

          Précédent

            Niveau supérieur

           Suivant

          STKModalBar

            Sommaire

           STKPercFlut


text:
package org.cinchapi.concourse.util;

import java.io.IOException;

import org.apache.commons.lang.StringUtils;
import org.cinchapi.concourse.Link;
import org.cinchapi.concourse.Tag;
import org.cinchapi.concourse.thrift.TObject;

import com.google.gson.Gson;
import com.google.gson.GsonBuilder;
import com.google.gson.JsonParser;
import com.google.gson.TypeAdapter;
import com.google.gson.stream.JsonReader;
import com.google.gson.stream.JsonWriter;

/**
 * A generic collection of services for dealing with the data.
 *
 * @author Jeff Nelson
 */
public class DataServices {

    /**
     * Return a serializer for JSON.
     *
     * @return Gson
     */
    public static Gson gson() {
        return GSON;
    }

    /**
     * Return a parser for JSON.
     *
     * @return Json parser
     */
    public static JsonParser jsonParser() {
        return JSON_PARSER;
    }

    /**
     * Perform sanity checks on the {@code key} and {@code value} and throw an
     * exception if necessary.
     *
     * @param key
     * @param value
     */
    public static void sanityCheck(String key, TObject value) { // CON-21
        if(StringUtils.isBlank(key)) {
            throw new IllegalArgumentException("Cannot use a blank key");
        }
        else if(value.isBlank()) {
            throw new IllegalArgumentException("Cannot use a blank value");
        }
    }

    /**
     * A singleton instance of the {@link JavaTypeAdapter}.
     */
    private static JavaTypeAdapter JAVA_TYPE_ADAPTER = new JavaTypeAdapter();

    /**
     * THE Gson.
     */
    private static final Gson GSON = new GsonBuilder()
            .registerTypeAdapter(Object.class, JAVA_TYPE_ADAPTER.nullSafe())
            .registerTypeAdapter(TObject.class,
                    new TObjectTypeAdapter().nullSafe()).disableHtmlEscaping()
            .create();

    /**
     * A JsonParser.
     */
    private static final JsonParser JSON_PARSER = new JsonParser();

    /**
     * Type adapter for Java objects for JSON serialization.
     *
     * @author hyin
     */
    private static class JavaTypeAdapter extends TypeAdapter<Object> {

        @Override
        public Object read(JsonReader reader) throws IOException {
            return null;
        }

        @Override
        public void write(JsonWriter writer, Object value) throws IOException {
            if(value instanceof Double) {
                value = (Double) value;
                writer.value(value.toString() + "D");
            }
            else if(value instanceof Link) {
                writer.value("@" + value.toString() + "@");
            }
            else if(value instanceof Tag) {
                writer.value("'" + value.toString() + "'");
            }
            else if(value instanceof Number) {
                writer.value((Number) value);
            }
            else if(value instanceof Boolean) {
                writer.value((Boolean) value);
            }
            else {
                writer.value(value.toString());
            }
        }
    }

    /**
     * A type adapter for serializing TObjects
     *
     * @author Jeff Nelson
     */
    private static class TObjectTypeAdapter extends TypeAdapter<TObject> {

        @Override
        public TObject read(JsonReader in) throws IOException {
            return null;
        }

        @Override
        public void write(JsonWriter out, TObject value) throws IOException {
            JAVA_TYPE_ADAPTER.write(out, Convert.thriftToJava(value));
        }

    }

}


text:
package org.mule.examples.oauth2connectorexample.entities;

import java.util.HashMap;
import java.util.Map;
import javax.annotation.Generated;
import org.codehaus.jackson.annotate.JsonAnyGetter;
import org.codehaus.jackson.annotate.JsonAnySetter;
import org.codehaus.jackson.annotate.JsonProperty;
import org.codehaus.jackson.annotate.JsonPropertyOrder;
import org.codehaus.jackson.map.annotate.JsonSerialize;

@JsonSerialize(include = JsonSerialize.Inclusion.NON_NULL)
@Generated("com.googlecode.jsonschema2pojo")
@JsonPropertyOrder({
    "id",
    "firstName",
    "lastName",
    "gender",
    "relationship",
    "photo",
    "tips",
    "lists",
    "homeCity",
    "bio",
    "contact"
})
public class User {

    @JsonProperty("id")
    private String id;
    @JsonProperty("firstName")
    private String firstName;
    @JsonProperty("lastName")
    private String lastName;
    @JsonProperty("gender")
    private String gender;
    @JsonProperty("relationship")
    private String relationship;
    @JsonProperty("photo")
    private String photo;
    @JsonProperty("tips")
    private Tips tips;
    @JsonProperty("lists")
    private Lists_ lists;
    @JsonProperty("homeCity")
    private String homeCity;
    @JsonProperty("bio")
    private String bio;
    @JsonProperty("contact")
    private Contact contact;
    private Map<String, Object> additionalProperties = new HashMap<String, Object>();

    @JsonProperty("id")
    public String getId() {
        return id;
    }

    @JsonProperty("id")
    public void setId(String id) {
        this.id = id;
    }

    @JsonProperty("firstName")
    public String getFirstName() {
        return firstName;
    }

    @JsonProperty("firstName")
    public void setFirstName(String firstName) {
        this.firstName = firstName;
    }

    @JsonProperty("lastName")
    public String getLastName() {
        return lastName;
    }

    @JsonProperty("lastName")
    public void setLastName(String lastName) {
        this.lastName = lastName;
    }

    @JsonProperty("gender")
    public String getGender() {
        return gender;
    }

    @JsonProperty("gender")
    public void setGender(String gender) {
        this.gender = gender;
    }

    @JsonProperty("relationship")
    public String getRelationship() {
        return relationship;
    }

    @JsonProperty("relationship")
    public void setRelationship(String relationship) {
        this.relationship = relationship;
    }

    @JsonProperty("photo")
    public String getPhoto() {
        return photo;
    }

    @JsonProperty("photo")
    public void setPhoto(String photo) {
        this.photo = photo;
    }

    @JsonProperty("tips")
    public Tips getTips() {
        return tips;
    }

    @JsonProperty("tips")
    public void setTips(Tips tips) {
        this.tips = tips;
    }

    @JsonProperty("lists")
    public Lists_ getLists() {
        return lists;
    }

    @JsonProperty("lists")
    public void setLists(Lists_ lists) {
        this.lists = lists;
    }

    @JsonProperty("homeCity")
    public String getHomeCity() {
        return homeCity;
    }

    @JsonProperty("homeCity")
    public void setHomeCity(String homeCity) {
        this.homeCity = homeCity;
    }

    @JsonProperty("bio")
    public String getBio() {
        return bio;
    }

    @JsonProperty("bio")
    public void setBio(String bio) {
        this.bio = bio;
    }

    @JsonProperty("contact")
    public Contact getContact() {
        return contact;
    }

    @JsonProperty("contact")
    public void setContact(Contact contact) {
        this.contact = contact;
    }

    @JsonAnyGetter
    public Map<String, Object> getAdditionalProperties() {
        return this.additionalProperties;
    }

    @JsonAnySetter
    public void setAdditionalProperties(String name, Object value) {
        this.additionalProperties.put(name, value);
    }

}


text:
import copy
import itertools

import cloudkitty.api.app
import cloudkitty.collector.gnocchi
import cloudkitty.collector.monasca
import cloudkitty.collector.prometheus
import cloudkitty.config
import cloudkitty.fetcher
import cloudkitty.fetcher.gnocchi
import cloudkitty.fetcher.keystone
import cloudkitty.fetcher.prometheus
import cloudkitty.fetcher.source
import cloudkitty.orchestrator
import cloudkitty.service
import cloudkitty.storage
import cloudkitty.storage.v1.hybrid.backends.gnocchi
import cloudkitty.storage.v2.elasticsearch
import cloudkitty.storage.v2.influx
import cloudkitty.utils

__all__ = ['list_opts']

_opts = [
    ('api', list(itertools.chain(
        cloudkitty.api.app.api_opts,))),
    ('collect', list(itertools.chain(
        cloudkitty.collector.collect_opts))),
    ('collector_gnocchi', list(itertools.chain(
        cloudkitty.collector.gnocchi.collector_gnocchi_opts))),
    ('collector_monasca', list(itertools.chain(
        cloudkitty.collector.monasca.collector_monasca_opts))),
    ('collector_prometheus', list(itertools.chain(
        cloudkitty.collector.prometheus.collector_prometheus_opts))),
    ('fetcher', list(itertools.chain(
        cloudkitty.fetcher.fetcher_opts))),
    ('fetcher_gnocchi', list(itertools.chain(
        cloudkitty.fetcher.gnocchi.gfetcher_opts,
        cloudkitty.fetcher.gnocchi.fetcher_gnocchi_opts))),
    ('fetcher_keystone', list(itertools.chain(
        cloudkitty.fetcher.keystone.fetcher_keystone_opts))),
    ('fetcher_prometheus', list(itertools.chain(
        cloudkitty.fetcher.prometheus.fetcher_prometheus_opts))),
    ('fetcher_source', list(itertools.chain(
        cloudkitty.fetcher.source.fetcher_source_opts))),
    ('orchestrator', list(itertools.chain(
        cloudkitty.orchestrator.orchestrator_opts))),
    ('output', list(itertools.chain(
        cloudkitty.config.output_opts))),
    ('state', list(itertools.chain(
        cloudkitty.config.state_opts))),
    ('storage', list(itertools.chain(
        cloudkitty.storage.storage_opts))),
    ('storage_influxdb', list(itertools.chain(
        cloudkitty.storage.v2.influx.influx_storage_opts))),
    ('storage_elasticsearch', list(itertools.chain(
        cloudkitty.storage.v2.elasticsearch.elasticsearch_storage_opts))),
    ('storage_gnocchi', list(itertools.chain(
        cloudkitty.storage.v1.hybrid.backends.gnocchi.gnocchi_storage_opts))),
    (None, list(itertools.chain(
        cloudkitty.api.app.auth_opts,
        cloudkitty.service.service_opts))),
]

def list_opts():
    return [(g, copy.deepcopy(o)) for g, o in _opts]


text:
<?php

class Sample implements JsonSerializable {
    public function jsonSerialize()
    {
        return [
            'message' => 'message'
        ];
    }
}

echo json_encode(new Sample()) . PHP_EOL;


text:
// -*- C++ -*-

// Copyright (C) 2005, 2006 Free Software Foundation, Inc.
//
// This file is part of the GNU ISO C++ Library.  This library is free
// software; you can redistribute it and/or modify it under the terms
// of the GNU General Public License as published by the Free Software
// Foundation; either version 2, or (at your option) any later
// version.

// This library is distributed in the hope that it will be useful, but
// WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
// General Public License for more details.

// You should have received a copy of the GNU General Public License
// along with this library; see the file COPYING.  If not, write to
// the Free Software Foundation, 59 Temple Place - Suite 330, Boston,
// MA 02111-1307, USA.

// As a special exception, you may use this file as part of a free
// software library without restriction.  Specifically, if other files
// instantiate templates or use macros or inline functions from this
// file, or you compile this file and link it with other files to
// produce an executable, this file does not by itself cause the
// resulting executable to be covered by the GNU General Public
// License.  This exception does not however invalidate any other
// reasons why the executable file might be covered by the GNU General
// Public License.

// Copyright (C) 2004 Ami Tavory and Vladimir Dreizin, IBM-HRL.

// Permission to use, copy, modify, sell, and distribute this software
// is hereby granted without fee, provided that the above copyright
// notice appears in all copies, and that both that copyright notice
// and this permission notice appear in supporting documentation. None
// of the above authors, nor IBM Haifa Research Laboratories, make any
// representation about the suitability of this software for any
// purpose. It is provided "as is" without express or implied
// warranty.

/**
 * @file rand_regression_test.hpp
 * Contains a random-operation test.
 */

#ifndef PB_DS_PQ_RAND_REGRESSION_TEST_HPP
#define PB_DS_PQ_RAND_REGRESSION_TEST_HPP

#include <iostream>
#include <vector>
#include <regression/rand/priority_queue/container_rand_regression_test.hpp>
#include <io/verified_cmd_line_input.hpp>
#include <common_type/priority_queue/common_type.hpp>
#include <regression/basic_type.hpp>
#include <regression/priority_queue/common_type.hpp>

namespace pb_ds
{
namespace test
{
namespace detail
{
#ifndef PB_DS_REGRESSION
#error "Must define PB_DS_REGRESSION"
#endif

  struct rand_reg_test
  {
  public:
    rand_reg_test(size_t seed, size_t n, size_t m, double tp, double ip,
		  double dp, double ep, double cp, double mp, bool d)
    : m_sd(seed), m_n(n), m_m(m), m_tp(tp), m_ip(ip), m_dp(dp), m_ep(ep),
      m_cp(cp), m_mp(mp), m_disp(d)
    { }

    template<typename Cntnr>
    void
    operator()(Cntnr)
    {
      unsigned long ul = static_cast<unsigned long>(m_sd);
      container_rand_regression_test<Cntnr> t(ul, m_n, m_n, m_tp, m_ip, m_dp,
					      m_ep, m_cp, m_mp, m_disp);
      t();
    }

  private:
    const size_t m_sd;
    const size_t m_n;
    const size_t m_m;
    const double m_tp;
    const double m_ip;
    const double m_dp;
    const double m_ep;
    const double m_cp;
    const double m_mp;
    const bool m_disp;
  };

  void
  usage(const std::string& r_name);

  void
  verify_params(size_t&, size_t&, size_t&,
		double&, double&, double&, double&, double&, double&, bool&);
} // namespace detail

  template<typename TL>
  int
  rand_regression_test(size_t iter, size_t keys, const std::string name, TL tl)
  {
    // Sane defaults.
    size_t n = iter;
    size_t m = keys;
    size_t sd = 0; // 0 = time-determined arbitrary
    double tp = 0.2;
    double ip = 0.6;
    double dp = 0.1;
    double ep = 0.2;
    double cp = 0.001;
    double mp = 1;
    bool disp = false; // show progress

    try
      {
	detail::verify_params(sd, n, m, tp, ip, dp, ep, cp, mp, disp);
      }
    catch(pb_ds::test::illegal_input_error&)
      {
	detail::usage(name);
	return -1;
      }
    catch(...)
      {
	return -2;
      };

    xml_test_rand_regression_formatter* p_fmt = NULL;
    if (sd == 0)
      sd = twister_rand_gen::get_time_determined_seed();
    if (disp)
      p_fmt = new xml_test_rand_regression_formatter(sd, n, m, tp, ip, dp,
						     ep, cp, mp);

    try
      {
	detail::rand_reg_test tst(sd, n, m, tp, ip, dp, ep, cp, mp, disp);
	__gnu_cxx::typelist::apply(tst, tl);
      }
    catch(...)
      {
	std::cerr << "Test failed with seed " << sd << std::endl;
	if (disp)
	  delete p_fmt;
	return -1;
      }

    if (disp)
      delete p_fmt;
    return 0;
  }

namespace detail
{
  void
  usage(const std::string& name)
  {
    using namespace std;
    cerr << "usage: " << name << " <sd> <n> <m> <tp> <ip> <dp> <ep> <cp> <mp> ['t' | 'f']" <<
      endl << endl;

    cerr << "This test performs basic regression tests on various priority queues."
      "For each container, it performs a sequence of operations. At each iteration, it does "
      "the following: " << endl;
    cerr << "*  Performs an operation on the container " << endl;
    cerr << "*  Performs the same operation on an cntnr object" << endl;
    cerr << "*  Possibly compares the container to the cntnr object" << endl;
    cerr << "*  Checks that exceptions (thrown by an allocator) "
      "do not violate exception guarantees";

    cerr << endl << endl;

    cerr << "sd = seed for random-number generator; 0 = "
      "time determined value" << endl;
    cerr << "n = number of iterations" << endl;
    cerr << "m = number of distinct values" << endl;
    cerr << "tp = probability that an exception will be actively thrown" << endl;
    cerr << "ip = probability that an operation will be insert" << endl;
    cerr << "dp = probability that an operation will be modify" << endl;
    cerr << "ep = probability that an operation will be erase" << endl;
    cerr << "cp = probability that an operation will be clear" << endl;
    cerr << "(therefore, 1 - (ip + dp + ep + cp) = probability of any other operation)" << endl;
    cerr << "mp = probability that the container will be compared to the cntnr object" << endl;
    cerr << "'t' or 'f' determine whether progress will be displayed" << endl;
  }

  void
  verify_params(size_t& r_seed, size_t& r_n,
		size_t& r_m, double& r_tp, double& r_ip, double& r_dp,
		double& r_ep, double& r_cp, double& r_mp, bool& r_d)
  {
    verify_prob(r_tp);
    verify_prob(r_ip);
    verify_prob(r_dp);
    verify_prob(r_ep);
    verify_prob(r_cp);
    verify_prob(r_mp);
    verify_prob(r_ip + r_dp + r_ep + r_cp);
  }
} // namespace detail
} // namespace test
} // namespace pb_ds

#endif


text:
package br.com.caelum.fj91.banco.tributacao;

import java.math.BigDecimal;

import br.com.caelum.fj91.banco.modelo.Conta;

public interface Tributo {

	/**
	 * Calcula o desconto que deve ser aplicado a essa Conta
	 * @param conta
	 * @return Desconto a ser efetuado
	 */
	public abstract BigDecimal calculaDesconto(Conta conta);

}


text:
        Test for bug 61411: ASSERTION FAILED: !m_layoutRoot->container() || !m_layoutRoot->container()->needsLayout() with generated content

        Test passes if it does not crash.


text:
<!DOCTYPE html>

<meta charset="UTF-8">

<title>class RubyProf::MultiPrinter - ruby-prof</title>

<link href="../css/fonts.css" rel="stylesheet">
<link href="../css/rdoc.css" rel="stylesheet">

    Home

    Pages
    Classes
    Methods

  <form action="#" method="get" accept-charset="utf-8">

      <input id="search-field" role="combobox" aria-label="Search"
             aria-autocomplete="list" aria-controls="search-results"
             type="text" name="search" placeholder="Search" spellcheck="false"
             title="Type to search, Up and Down to navigate, Enter to load">

  </form>

Parent

Object

Methods

::new

#flat_profile

#graph_profile

#print

#stack_profile

#tree_profile

    class RubyProf::MultiPrinter

Helper class to simplify printing profiles of several types from one
profiling run. Currently prints a flat profile, a callgrind profile, a call
stack profile and a graph profile.

Public Class Methods

          new(result)

          click to toggle source

# File lib/ruby-prof/printers/multi_printer.rb, line 7
def initialize(result)
  @stack_printer = CallStackPrinter.new(result)
  @graph_printer = GraphHtmlPrinter.new(result)
  @tree_printer = CallTreePrinter.new(result)
  @flat_printer = FlatPrinter.new(result)
end

Public Instance Methods

          flat_profile()

          click to toggle source

the name of the flat profile file

# File lib/ruby-prof/printers/multi_printer.rb, line 50
def flat_profile
  "#{@directory}/#{@profile}.flat.txt"
end

          graph_profile()

          click to toggle source

the name of the graph profile file

# File lib/ruby-prof/printers/multi_printer.rb, line 40
def graph_profile
  "#{@directory}/#{@profile}.graph.html"
end

          print(options)

          click to toggle source

create profile files under options or the current
directory. options is used as the base name for the
pofile file, defaults to "profile".

# File lib/ruby-prof/printers/multi_printer.rb, line 17
def print(options)
  @profile = options.delete(:profile) || "profile"
  @directory = options.delete(:path) || File.expand_path(".")
  File.open(stack_profile, "w") do |f|
    @stack_printer.print(f, options.merge(:graph => "#{@profile}.graph.html"))
  end
  File.open(graph_profile, "w") do |f|
    @graph_printer.print(f, options)
  end
  File.open(tree_profile, "w") do |f|
    @tree_printer.print(f, options)
  end
  File.open(flat_profile, "w") do |f|
    @flat_printer.print(f, options)
  end
end

          stack_profile()

          click to toggle source

the name of the call stack profile file

# File lib/ruby-prof/printers/multi_printer.rb, line 35
def stack_profile
  "#{@directory}/#{@profile}.stack.html"
end

          tree_profile()

          click to toggle source

the name of the callgrind profile file

# File lib/ruby-prof/printers/multi_printer.rb, line 45
def tree_profile
  "#{@directory}/#{@profile}.grind.dat"
end

Validate

Generated by RDoc 4.2.0.

Based on Darkfish by Michael Granger.


text:
package org.netroc.luabindj;

import java.lang.reflect.Field;
import java.lang.reflect.Method;
import java.lang.reflect.Modifier;
import java.util.HashMap;
import java.util.Map;
import java.util.TreeMap;

import org.luaj.vm2.lib.LibFunction;

public class BindClassConfig {

	/**
	 * 类名
	 */
	private String mLibName;

	/**
	 * 类引用
	 */
	private Class<?> mClass;

	/**
	 * 所有的导出field字段
	 */
	private Map<String, Field> mMapFields;

	/**
	 * 所有的导出方法
	 */
	private Map<String, Method> mMapMethods;

	/**
	 * 所有导出方法的调用桥
	 */
	private Map<String, LibFunction> mMethodBridges;

	/**
	 * 元表的index桥
	 */
	private MetaIndexBridge mMetaIndexBridge;

	private MetaNewIndexBridge mMetaNewIndexBridge;

	/**
	 * 是否导出全部的字段和方法
	 */
	private boolean mExportAll = false;

	/**
	 *
	 * @param strClassName 类名
	 * @param objClass 类的class对象
	 */
	public BindClassConfig(String strClassName, Class<?> objClass, boolean blExportAll) {
		mLibName = strClassName;
		mClass = objClass;
		mExportAll = blExportAll;

		initFromClass();
	}

	/**
	 * 获得类名
	 * @return
	 */
	public String getLibName() {
		return mLibName;
	}

	/**
	 * 获得类对象
	 * @return
	 */
	public Class<?> getClassObject() {
		return mClass;
	}

	/**
	 * 从已设置的class对象进行初始化
	 */
	protected void initFromClass() {
		doFields();
		doMethod();
		mMetaIndexBridge = new MetaIndexBridge(this);
		mMetaNewIndexBridge = new MetaNewIndexBridge(this);
	}

	/**
	 * 处理fields
	 */
	private void doFields() {
		mMapFields = new HashMap<String, Field>();

		Field[] arrField = mClass.getDeclaredFields();
		for( Field f : arrField) {
			//无标注的不处理
			if( f.getAnnotation(LuaExport.class) == null && mExportAll == false) {
				continue;
			}

			mMapFields.put(f.getName(), f);
		}
	}

	/**
	 * 处理方法
	 */
	private void doMethod() {
		mMapMethods = new HashMap<String, Method>();
		mMethodBridges = new TreeMap<String, LibFunction>();

		Method[] arrMethod = mClass.getDeclaredMethods();
		for( Method m : arrMethod) {
			//无标注的不处理
			if( m.getAnnotation(LuaExport.class) == null && mExportAll == false) {
				continue;
			}

			mMapMethods.put(m.getName(), m);

			int nCount = m.getParameterCount();
			LibFunction bridge;
			if( !Modifier.isStatic(m.getModifiers())) {
				nCount++;
			}
			switch( nCount) {
			case 0:
				bridge = new CallBridge0(m);
				break;
			case 1:
				bridge = new CallBridge1(m);
				break;
			case 2:
				bridge = new CallBridge2(m);
				break;
			case 3:
				bridge = new CallBridge3(m);
				break;
			default:
				bridge = new CallBridge(m);
				break;
			}
			mMethodBridges.put(m.getName(), bridge);
		}
	}

	/**
	 * 通过名字获得field
	 * @param strName
	 * @return
	 */
	public Field getField( String strName) {
		return mMapFields.get(strName);
	}

	/**
	 * 通过名字获得method
	 * @param strMethod
	 * @return
	 */
	public Method getMethod( String strMethod) {
		return mMapMethods.get(strMethod);
	}

	/**
	 * 获得field map
	 * @return
	 */
	public Map<String, Field> getFieldMap() {
		return mMapFields;
	}

	/**
	 * 获得Method的map
	 * @return
	 */
	public Map<String, Method> getMethodMap() {
		return mMapMethods;
	}

	/**
	 * 获得Method的bridge map
	 * @return
	 */
	public Map<String, LibFunction> getLibFunctionMap() {
		return mMethodBridges;
	}

	/**
	 * 获得某个方法的bridge
	 * @param strName
	 * @return
	 */
	public LibFunction getFunctonBridge(String strName) {
		return mMethodBridges.get(strName);
	}

	/**
	 * 获得元表的__index桥
	 * @return
	 */
	public MetaIndexBridge getMetaIndexBridge() {
		return mMetaIndexBridge;
	}

	/**
	 * 获得元表的__newindex桥
	 * @return
	 */
	public MetaNewIndexBridge getMetaNewIndexBridge() {
		return mMetaNewIndexBridge;
	}
}


text:
/*
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *     http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */
package io.prestosql.orc;

import com.google.common.collect.ImmutableList;
import com.google.common.collect.ImmutableMap;
import com.google.common.primitives.Longs;
import io.airlift.slice.Slice;
import io.prestosql.orc.metadata.ColumnMetadata;
import io.prestosql.orc.metadata.OrcMetadataReader;
import io.prestosql.orc.metadata.statistics.BloomFilter;
import io.prestosql.orc.metadata.statistics.ColumnStatistics;
import io.prestosql.orc.metadata.statistics.IntegerStatistics;
import io.prestosql.orc.proto.OrcProto;
import io.prestosql.orc.protobuf.CodedInputStream;
import io.prestosql.spi.predicate.Domain;
import io.prestosql.spi.type.RealType;
import io.prestosql.spi.type.Type;
import org.apache.orc.util.Murmur3;
import org.testng.annotations.Test;

import java.io.ByteArrayInputStream;
import java.io.ByteArrayOutputStream;
import java.io.IOException;
import java.io.InputStream;
import java.math.BigDecimal;
import java.sql.Timestamp;
import java.util.Arrays;
import java.util.Collection;
import java.util.List;
import java.util.Map;
import java.util.Optional;
import java.util.concurrent.ThreadLocalRandom;

import static io.airlift.slice.Slices.wrappedBuffer;
import static io.prestosql.orc.TupleDomainOrcPredicate.checkInBloomFilter;
import static io.prestosql.orc.TupleDomainOrcPredicate.extractDiscreteValues;
import static io.prestosql.orc.metadata.OrcColumnId.ROOT_COLUMN;
import static io.prestosql.spi.type.BigintType.BIGINT;
import static io.prestosql.spi.type.BooleanType.BOOLEAN;
import static io.prestosql.spi.type.DateType.DATE;
import static io.prestosql.spi.type.DoubleType.DOUBLE;
import static io.prestosql.spi.type.IntegerType.INTEGER;
import static io.prestosql.spi.type.RealType.REAL;
import static io.prestosql.spi.type.SmallintType.SMALLINT;
import static io.prestosql.spi.type.TimestampType.TIMESTAMP;
import static io.prestosql.spi.type.TinyintType.TINYINT;
import static io.prestosql.spi.type.VarbinaryType.VARBINARY;
import static io.prestosql.spi.type.VarcharType.VARCHAR;
import static java.lang.Float.floatToIntBits;
import static java.lang.Float.intBitsToFloat;
import static java.nio.charset.StandardCharsets.UTF_8;
import static org.testng.Assert.assertEquals;
import static org.testng.Assert.assertFalse;
import static org.testng.Assert.assertTrue;
import static org.testng.Assert.fail;

public class TestOrcBloomFilters
{
    private static final byte[] TEST_STRING = "ORC_STRING".getBytes(UTF_8);
    private static final byte[] TEST_STRING_NOT_WRITTEN = "ORC_STRING_not".getBytes(UTF_8);
    private static final int TEST_INTEGER = 12345;
    private static final String COLUMN_0 = "bigint_0";
    private static final String COLUMN_1 = "bigint_1";

    private static final Map<Object, Type> TEST_VALUES = ImmutableMap.<Object, Type>builder()
            .put(wrappedBuffer(TEST_STRING), VARCHAR)
            .put(wrappedBuffer(new byte[] {12, 34, 56}), VARBINARY)
            .put(4312L, BIGINT)
            .put(123, INTEGER)
            .put(789, SMALLINT)
            .put(77, TINYINT)
            .put(901, DATE)
            .put(987654L, TIMESTAMP)
            .put(234.567, DOUBLE)
            .put((long) floatToIntBits(987.654f), REAL)
            .build();

    @Test
    public void testHiveBloomFilterSerde()
    {
        BloomFilter bloomFilter = new BloomFilter(1_000_000L, 0.05);

        // String
        bloomFilter.add(TEST_STRING);
        assertTrue(bloomFilter.test(TEST_STRING));
        assertTrue(bloomFilter.testSlice(wrappedBuffer(TEST_STRING)));
        assertFalse(bloomFilter.test(TEST_STRING_NOT_WRITTEN));
        assertFalse(bloomFilter.testSlice(wrappedBuffer(TEST_STRING_NOT_WRITTEN)));

        // Integer
        bloomFilter.addLong(TEST_INTEGER);
        assertTrue(bloomFilter.testLong(TEST_INTEGER));
        assertFalse(bloomFilter.testLong(TEST_INTEGER + 1));

        // Re-construct
        BloomFilter newBloomFilter = new BloomFilter(bloomFilter.getBitSet(), bloomFilter.getNumHashFunctions());

        // String
        assertTrue(newBloomFilter.test(TEST_STRING));
        assertTrue(newBloomFilter.testSlice(wrappedBuffer(TEST_STRING)));
        assertFalse(newBloomFilter.test(TEST_STRING_NOT_WRITTEN));
        assertFalse(newBloomFilter.testSlice(wrappedBuffer(TEST_STRING_NOT_WRITTEN)));

        // Integer
        assertTrue(newBloomFilter.testLong(TEST_INTEGER));
        assertFalse(newBloomFilter.testLong(TEST_INTEGER + 1));
    }

    @Test
    public void testOrcHiveBloomFilterSerde()
            throws Exception
    {
        BloomFilter bloomFilterWrite = new BloomFilter(1000L, 0.05);

        bloomFilterWrite.add(TEST_STRING);
        assertTrue(bloomFilterWrite.test(TEST_STRING));
        assertTrue(bloomFilterWrite.testSlice(wrappedBuffer(TEST_STRING)));

        OrcProto.BloomFilter.Builder bloomFilterBuilder = OrcProto.BloomFilter.newBuilder();
        bloomFilterBuilder.addAllBitset(Longs.asList(bloomFilterWrite.getBitSet()));
        bloomFilterBuilder.setNumHashFunctions(bloomFilterWrite.getNumHashFunctions());

        OrcProto.BloomFilter bloomFilter = bloomFilterBuilder.build();
        OrcProto.BloomFilterIndex bloomFilterIndex = OrcProto.BloomFilterIndex.getDefaultInstance();
        byte[] bytes = serializeBloomFilterToIndex(bloomFilter, bloomFilterIndex);

        // Read through method
        InputStream inputStream = new ByteArrayInputStream(bytes);
        OrcMetadataReader metadataReader = new OrcMetadataReader();
        List<BloomFilter> bloomFilters = metadataReader.readBloomFilterIndexes(inputStream);

        assertEquals(bloomFilters.size(), 1);

        assertTrue(bloomFilters.get(0).test(TEST_STRING));
        assertTrue(bloomFilters.get(0).testSlice(wrappedBuffer(TEST_STRING)));
        assertFalse(bloomFilters.get(0).test(TEST_STRING_NOT_WRITTEN));
        assertFalse(bloomFilters.get(0).testSlice(wrappedBuffer(TEST_STRING_NOT_WRITTEN)));

        assertEquals(bloomFilterWrite.getNumBits(), bloomFilters.get(0).getNumBits());
        assertEquals(bloomFilterWrite.getNumHashFunctions(), bloomFilters.get(0).getNumHashFunctions());

        // Validate bit set
        assertTrue(Arrays.equals(bloomFilters.get(0).getBitSet(), bloomFilterWrite.getBitSet()));

        // Read directly: allows better inspection of the bit sets (helped to fix a lot of bugs)
        CodedInputStream input = CodedInputStream.newInstance(bytes);
        OrcProto.BloomFilterIndex deserializedBloomFilterIndex = OrcProto.BloomFilterIndex.parseFrom(input);
        List<OrcProto.BloomFilter> bloomFilterList = deserializedBloomFilterIndex.getBloomFilterList();
        assertEquals(bloomFilterList.size(), 1);

        OrcProto.BloomFilter bloomFilterRead = bloomFilterList.get(0);

        // Validate contents of ORC bloom filter bit set
        assertTrue(Arrays.equals(Longs.toArray(bloomFilterRead.getBitsetList()), bloomFilterWrite.getBitSet()));

        // hash functions
        assertEquals(bloomFilterWrite.getNumHashFunctions(), bloomFilterRead.getNumHashFunctions());

        // bit size
        assertEquals(bloomFilterWrite.getBitSet().length, bloomFilterRead.getBitsetCount());
    }

    private static byte[] serializeBloomFilterToIndex(OrcProto.BloomFilter bloomFilter, OrcProto.BloomFilterIndex bloomFilterIndex)
            throws IOException
    {
        assertTrue(bloomFilter.isInitialized());

        OrcProto.BloomFilterIndex.Builder builder = bloomFilterIndex.toBuilder();
        builder.addBloomFilter(bloomFilter);

        OrcProto.BloomFilterIndex index = builder.build();
        assertTrue(index.isInitialized());
        assertEquals(index.getBloomFilterCount(), 1);

        ByteArrayOutputStream os = new ByteArrayOutputStream();
        index.writeTo(os);
        os.flush();
        return os.toByteArray();
    }

    private static OrcProto.BloomFilter toOrcBloomFilter(BloomFilter bloomFilter)
    {
        OrcProto.BloomFilter.Builder builder = OrcProto.BloomFilter.newBuilder();
        builder.addAllBitset(Longs.asList(bloomFilter.getBitSet()));
        builder.setNumHashFunctions(bloomFilter.getNumHashFunctions());
        return builder.build();
    }

    @Test
    public void testBloomFilterPredicateValuesExisting()
    {
        BloomFilter bloomFilter = new BloomFilter(TEST_VALUES.size() * 10, 0.01);

        for (Map.Entry<Object, Type> testValue : TEST_VALUES.entrySet()) {
            Object o = testValue.getKey();
            if (o instanceof Long) {
                if (testValue.getValue() instanceof RealType) {
                    bloomFilter.addDouble(intBitsToFloat(((Number) o).intValue()));
                }
                else {
                    bloomFilter.addLong((Long) o);
                }
            }
            else if (o instanceof Integer) {
                bloomFilter.addLong((Integer) o);
            }
            else if (o instanceof String) {
                bloomFilter.add(((String) o).getBytes(UTF_8));
            }
            else if (o instanceof BigDecimal) {
                bloomFilter.add(o.toString().getBytes(UTF_8));
            }
            else if (o instanceof Slice) {
                bloomFilter.add(((Slice) o).getBytes());
            }
            else if (o instanceof Timestamp) {
                bloomFilter.addLong(((Timestamp) o).getTime());
            }
            else if (o instanceof Double) {
                bloomFilter.addDouble((Double) o);
            }
            else {
                fail("Unsupported type " + o.getClass());
            }
        }

        for (Map.Entry<Object, Type> testValue : TEST_VALUES.entrySet()) {
            boolean matched = checkInBloomFilter(bloomFilter, testValue.getKey(), testValue.getValue());
            assertTrue(matched, "type " + testValue.getClass());
        }
    }

    @Test
    public void testBloomFilterPredicateValuesNonExisting()
    {
        BloomFilter bloomFilter = new BloomFilter(TEST_VALUES.size() * 10, 0.01);

        for (Map.Entry<Object, Type> testValue : TEST_VALUES.entrySet()) {
            boolean matched = checkInBloomFilter(bloomFilter, testValue.getKey(), testValue.getValue());
            assertFalse(matched, "type " + testValue.getKey().getClass());
        }
    }

    @Test
    public void testExtractValuesFromSingleDomain()
    {
        Map<Type, Object> testValues = ImmutableMap.<Type, Object>builder()
                .put(BOOLEAN, true)
                .put(INTEGER, 1234L)
                .put(SMALLINT, 789L)
                .put(TINYINT, 77L)
                .put(DATE, 901L)
                .put(TIMESTAMP, 987654L)
                .put(BIGINT, 4321L)
                .put(DOUBLE, 0.123)
                .put(REAL, (long) (floatToIntBits(0.456f)))
                .put(VARCHAR, wrappedBuffer(TEST_STRING))
                .build();

        for (Map.Entry<Type, Object> testValue : testValues.entrySet()) {
            Domain predicateDomain = Domain.singleValue(testValue.getKey(), testValue.getValue());
            Optional<Collection<Object>> discreteValues = extractDiscreteValues(predicateDomain.getValues());
            assertTrue(discreteValues.isPresent());
            Collection<Object> objects = discreteValues.get();
            assertEquals(objects.size(), 1);
            assertEquals(objects.iterator().next(), testValue.getValue());
        }
    }

    @Test
    // simulate query on a 2 columns where 1 is used as part of the where, with and without bloom filter
    public void testMatches()
    {
        TupleDomainOrcPredicate predicate = TupleDomainOrcPredicate.builder()
                .setBloomFiltersEnabled(true)
                .addColumn(ROOT_COLUMN, Domain.singleValue(BIGINT, 1234L))
                .build();
        TupleDomainOrcPredicate emptyPredicate = TupleDomainOrcPredicate.builder().build();

        // assemble a matching and a non-matching bloom filter
        BloomFilter bloomFilter = new BloomFilter(1000, 0.01);
        OrcProto.BloomFilter emptyOrcBloomFilter = toOrcBloomFilter(bloomFilter);
        bloomFilter.addLong(1234);
        OrcProto.BloomFilter orcBloomFilter = toOrcBloomFilter(bloomFilter);

        ColumnMetadata<ColumnStatistics> matchingStatisticsByColumnIndex = new ColumnMetadata<>(ImmutableList.of(new ColumnStatistics(
                null,
                0,
                null,
                new IntegerStatistics(10L, 2000L, null),
                null,
                null,
                null,
                null,
                null,
                toBloomFilter(orcBloomFilter))));

        ColumnMetadata<ColumnStatistics> nonMatchingStatisticsByColumnIndex = new ColumnMetadata<>(ImmutableList.of(new ColumnStatistics(
                null,
                0,
                null,
                new IntegerStatistics(10L, 2000L, null),
                null,
                null,
                null,
                null,
                null,
                toBloomFilter(emptyOrcBloomFilter))));

        ColumnMetadata<ColumnStatistics> withoutBloomFilterStatisticsByColumnIndex = new ColumnMetadata<>(ImmutableList.of(new ColumnStatistics(
                null,
                0,
                null,
                new IntegerStatistics(10L, 2000L, null),
                null,
                null,
                null,
                null,
                null,
                null)));

        assertTrue(predicate.matches(1L, matchingStatisticsByColumnIndex));
        assertTrue(predicate.matches(1L, withoutBloomFilterStatisticsByColumnIndex));
        assertFalse(predicate.matches(1L, nonMatchingStatisticsByColumnIndex));
        assertTrue(emptyPredicate.matches(1L, matchingStatisticsByColumnIndex));
    }

    private static BloomFilter toBloomFilter(OrcProto.BloomFilter orcBloomFilter)
    {
        return new BloomFilter(Longs.toArray(orcBloomFilter.getBitsetList()), orcBloomFilter.getNumHashFunctions());
    }

    @Test
    public void testBloomFilterCompatibility()
    {
        for (int n = 0; n < 200; n++) {
            double fpp = ThreadLocalRandom.current().nextDouble(0.01, 0.10);
            int size = ThreadLocalRandom.current().nextInt(100, 10000);
            int entries = ThreadLocalRandom.current().nextInt(size / 2, size);

            BloomFilter actual = new BloomFilter(size, fpp);
            org.apache.orc.util.BloomFilter expected = new org.apache.orc.util.BloomFilter(size, fpp);

            assertFalse(actual.test(null));
            assertFalse(expected.test(null));

            byte[][] binaryValue = new byte[entries][];
            long[] longValue = new long[entries];
            double[] doubleValue = new double[entries];
            float[] floatValue = new float[entries];

            for (int i = 0; i < entries; i++) {
                binaryValue[i] = randomBytes(ThreadLocalRandom.current().nextInt(100));
                longValue[i] = ThreadLocalRandom.current().nextLong();
                doubleValue[i] = ThreadLocalRandom.current().nextDouble();
                floatValue[i] = ThreadLocalRandom.current().nextFloat();
            }

            for (int i = 0; i < entries; i++) {
                assertFalse(actual.test(binaryValue[i]));
                assertFalse(actual.testSlice(wrappedBuffer(binaryValue[i])));
                assertFalse(actual.testLong(longValue[i]));
                assertFalse(actual.testDouble(doubleValue[i]));
                assertFalse(actual.testFloat(floatValue[i]));

                assertFalse(expected.test(binaryValue[i]));
                assertFalse(expected.testLong(longValue[i]));
                assertFalse(expected.testDouble(doubleValue[i]));
                assertFalse(expected.testDouble(floatValue[i]));
            }

            for (int i = 0; i < entries; i++) {
                actual.add(binaryValue[i]);
                actual.addLong(longValue[i]);
                actual.addDouble(doubleValue[i]);
                actual.addFloat(floatValue[i]);

                expected.add(binaryValue[i]);
                expected.addLong(longValue[i]);
                expected.addDouble(doubleValue[i]);
                expected.addDouble(floatValue[i]);
            }

            for (int i = 0; i < entries; i++) {
                assertTrue(actual.test(binaryValue[i]));
                assertTrue(actual.testSlice(wrappedBuffer(binaryValue[i])));
                assertTrue(actual.testLong(longValue[i]));
                assertTrue(actual.testDouble(doubleValue[i]));
                assertTrue(actual.testFloat(floatValue[i]));

                assertTrue(expected.test(binaryValue[i]));
                assertTrue(expected.testLong(longValue[i]));
                assertTrue(expected.testDouble(doubleValue[i]));
                assertTrue(expected.testDouble(floatValue[i]));
            }

            actual.add(null);
            expected.add(null);

            assertTrue(actual.test(null));
            assertTrue(actual.testSlice(null));
            assertTrue(expected.test(null));

            assertEquals(actual.getBitSet(), expected.getBitSet());
        }
    }

    @Test
    public void testHashCompatibility()
    {
        for (int length = 0; length < 1000; length++) {
            for (int i = 0; i < 100; i++) {
                byte[] bytes = randomBytes(length);
                assertEquals(BloomFilter.OrcMurmur3.hash64(bytes), Murmur3.hash64(bytes));
            }
        }
    }

    private static byte[] randomBytes(int length)
    {
        byte[] result = new byte[length];
        ThreadLocalRandom.current().nextBytes(result);
        return result;
    }
}


text:
package net.bitm.events;

import net.bitm.bonytechmod;
import cpw.mods.fml.common.eventhandler.SubscribeEvent;
import cpw.mods.fml.common.gameevent.PlayerEvent;

public class rodcarverevent{

	@SubscribeEvent
	public void onPickup(PlayerEvent.ItemCraftedEvent e) {
		if (e.crafting.getItem() == bonytechmod.stickcarver){
			e.player.addStat(bonytechmod.rodcarverAchievement, 1);
		}
	}
}


text:
/* @test
 * @bug 6313626
 * @bug 6304782
 * @summary This test verifies robustness (to a certain level) of the
 * NIO-mode mux implementation when the VM cannot create any more
 * threads.  See comments for details.
 *
 * @build OutOfThreads
 * @build AbstractSocketFactory
 * @build AbstractServerSocketFactory
 * @build ThreadHog
 * @build NewThreadExecutor
 * @run main/othervm OutOfThreads
 */

import org.apache.river.thread.Executor;
import org.apache.river.thread.GetThreadPoolAction;
import java.io.IOException;
import java.net.Socket;
import java.net.ServerSocket;
import java.nio.ByteBuffer;
import java.nio.channels.ServerSocketChannel;
import java.nio.channels.SocketChannel;
import java.rmi.Remote;
import java.rmi.RemoteException;
import javax.net.ServerSocketFactory;
import net.jini.export.Exporter;
import net.jini.jeri.BasicILFactory;
import net.jini.jeri.BasicJeriExporter;
import net.jini.jeri.InvocationLayerFactory;
import net.jini.jeri.ServerEndpoint;
import net.jini.jeri.tcp.TcpServerEndpoint;

public class OutOfThreads {

    private static final boolean useNIO = true;

    public interface Ping extends Remote {
	void ping() throws RemoteException;
    }

    public static class PingImpl implements Ping {
	PingImpl() { }
	public void ping() { System.err.println("ping() invoked"); }
    }

    public static void main(String[] args) throws Exception {
	System.err.println("\nRegression test for bug 6313626\n");

	/*
	 * Reserve a few unpooled threads to release before VM
	 * shutdown, so that shutdown hooks can be started.
	 */
	ThreadHog unpooledHog = new ThreadHog(new NewThreadExecutor());
	unpooledHog.hogThreads(10);

	try {
	    test();
	} finally {
	    unpooledHog.releaseAll();
	    Thread.sleep(1000);
	}
    }

    private static void test() throws Exception {
	Ping impl = new PingImpl();
	class SF extends AbstractSocketFactory {
	    volatile Socket lastSocket;
	    SF() { }
	    public Socket createSocket() throws IOException {
		Socket s = useNIO ? SocketChannel.open().socket()
				  : new Socket();
		lastSocket = s;
		return s;
	    }
	};
	SF sf = new SF();
	ServerSocketFactory ssf = new AbstractServerSocketFactory() {
	    public ServerSocket createServerSocket() throws IOException {
		return useNIO ? ServerSocketChannel.open().socket()
			      : new ServerSocket();
	    }
	};
	ServerEndpoint se =
	    TcpServerEndpoint.getInstance(null, 0, sf, ssf);
	InvocationLayerFactory ilf =
	    new BasicILFactory(null, null, PingImpl.class.getClassLoader());
	Exporter exporter = new BasicJeriExporter(se, ilf, false, false);
	Ping proxy = (Ping) exporter.export(impl);
	/*
	 * Create this object early to avoid possible FuturePing
	 * verification failure when new threads cannot be created.
	 */
	FuturePing future = new FuturePing(proxy);

	Executor systemThreadPool =
	    (Executor) (new GetThreadPoolAction(false)).run();
	Executor userThreadPool =
	    (Executor) (new GetThreadPoolAction(true)).run();

	/*
	 * Reserve a few workers in the system thread pool.
	 */
	ThreadHog systemHog = new ThreadHog(systemThreadPool);
	systemHog.hogThreads(10);

	/*
	 * Invoke once to cause a connection to be established.
	 */
	System.err.println("[invocation #1:]");
	proxy.ping();

	/*
	 * Consume all threads with workers in the user thread pool.
	 */
	ThreadHog userHog = new ThreadHog(userThreadPool);
	userHog.hogAllThreads();

	/*
	 * Invocation should fail because the user thread pool has no
	 * idle threads and no new threads can be created.
	 */
	System.err.println("[invocation #2:]");
	try {
	    proxy.ping();
	    throw new Error("unexpected success");
	} catch (Throwable t) {
	    t.printStackTrace();
	}

	/*
	 * Release workers in the user thread pool: now tasks can be
	 * executed in it, but its idle workers will still prevent
	 * other threads from being created (like for other pools).
	 */
	userHog.releaseAll();
	Thread.sleep(1000);

	/*
	 * Verify that invocations can succeed again.
	 */
	System.err.println("[invocation #3:]");
	proxy.ping();

	/*
	 * Corrupt connection protocol so that on the next request
	 * attempt, the server side will detect a protocol violation
	 * and shut down the connection.
	 */
	if (useNIO) {
	    sf.lastSocket.getChannel().write(
		(ByteBuffer) ((Buffer) ByteBuffer.allocate(1).put((byte) 0x00)).flip());
	} else {
	    sf.lastSocket.getOutputStream().write(0x00);
	}

	/*
	 * Attempt to invoke again asynchronously.  This invocation
	 * may block for now, because when the connection is shut down
	 * due to the protocol violation, the task to shut down the
	 * associated sessions asynchronously cannot be executed
	 * because the system thread pool has no idle threads and no
	 * new threads can be created).
	 */
	System.err.println("[invocation #4:]");
	userThreadPool.execute(future, "ping");
	Thread.sleep(1000);

	/*
	 * Release workers in the system thread pool.
	 */
	systemHog.releaseAll();
	Thread.sleep(1000);

	/*
	 * Invoke again to cause a new connection to be established.
	 */
	System.err.println("[invocation #5:]");
	proxy.ping();

	/*
	 * When the new connection's idle timeout expires, its
	 * shutdown procedure should execute the lingering tasks to
	 * shut down the sessions associated with the first
	 * connection, allowing the asyncronous invocation to complete
	 * (with a RemoteException).
	 */
	try {
	    future.waitFor();
	    throw new Error("unexpected success");
	} catch (RemoteException e) {
	    e.printStackTrace();
	}

	System.err.println("TEST PASSED");
    }

    private static class FuturePing implements Runnable {
	private final Ping proxy;
	private final Object lock = new Object();
	private boolean completed = false;
	private RemoteException failure = null;

	FuturePing(Ping proxy) {
	    this.proxy = proxy;
	}

	void waitFor() throws InterruptedException, RemoteException {
	    synchronized (lock) {
		while (!completed) {
		    lock.wait();
		}
		if (failure != null) {
		    throw failure;
		}
	    }
	}

	public void run() {
	    RemoteException f = null;
	    try {
		proxy.ping();
	    } catch (RemoteException e) {
		f = e;
	    }
	    synchronized (lock) {
		completed = true;
		failure = f;
		lock.notifyAll();
	    }
	}
    }
}


text:
package cl.monsoon.s1next.view.adapter;

import android.app.Activity;

import cl.monsoon.s1next.data.api.model.Forum;
import cl.monsoon.s1next.view.adapter.delegate.ForumAdapterDelegate;

public final class ForumRecyclerViewAdapter extends BaseRecyclerViewAdapter<Forum> {

    private static final int VIEW_TYPE_FORUM = 1;

    public ForumRecyclerViewAdapter(Activity activity) {
        super(activity);

        addAdapterDelegate(new ForumAdapterDelegate(activity, VIEW_TYPE_FORUM));

        setHasStableIds(true);
    }

    @Override
    public long getItemId(int position) {
        if (getItemViewTypeFromDelegatesManager(position) == VIEW_TYPE_FORUM) {
            return Long.parseLong(((Forum) getItem(position)).getId());
        } else {
            return super.getItemId(position);
        }
    }
}


text:
namespace GlProj
{
	namespace Utilities
	{

	}
}


text:
package org.apache.jmeter.engine.util;

import static org.junit.Assert.assertEquals;
import static org.junit.Assert.assertTrue;

import java.util.ArrayList;
import java.util.List;

import org.apache.jmeter.config.ConfigTestElement;
import org.apache.jmeter.junit.JMeterTestCase;
import org.apache.jmeter.testelement.TestElement;
import org.apache.jmeter.testelement.TestPlan;
import org.apache.jmeter.testelement.property.CollectionProperty;
import org.apache.jmeter.testelement.property.JMeterProperty;
import org.apache.jmeter.testelement.property.StringProperty;
import org.apache.jmeter.threads.JMeterContextService;
import org.apache.jmeter.threads.JMeterVariables;
import org.junit.After;
import org.junit.Before;
import org.junit.Test;

public class TestValueReplacer extends JMeterTestCase {
        private TestPlan variables;

        /** {@inheritDoc} */
        @Before
        public void setUp() {
            variables = new TestPlan();
            variables.addParameter("server", "jakarta.apache.org");
            variables.addParameter("username", "jack");
            // The following used to be jacks_password, but the Arguments class uses
            // HashMap for which the order is not defined.
            variables.addParameter("password", "his_password");
            variables.addParameter("normal_regex", "Hello .*");
            variables.addParameter("bounded_regex", "(<.*>)");
            JMeterVariables vars = new JMeterVariables();
            vars.put("server", "jakarta.apache.org");
            JMeterContextService.getContext().setVariables(vars);
            JMeterContextService.getContext().setSamplingStarted(true);
        }

        @Test
        public void testReverseReplacement() throws Exception {
            ValueReplacer replacer = new ValueReplacer(variables);
            assertTrue(variables.getUserDefinedVariables().containsKey("server"));
            assertTrue(replacer.containsKey("server"));
            TestElement element = new TestPlan();
            element.setProperty(new StringProperty("domain", "jakarta.apache.org"));
            List<Object> argsin = new ArrayList<>();
            argsin.add("username is jack");
            argsin.add("his_password");
            element.setProperty(new CollectionProperty("args", argsin));
            replacer.reverseReplace(element);
            assertEquals("${server}", element.getPropertyAsString("domain"));
            @SuppressWarnings("unchecked")
            List<JMeterProperty> args = (List<JMeterProperty>) element.getProperty("args").getObjectValue();
            assertEquals("username is ${username}", args.get(0).getStringValue());
            assertEquals("${password}", args.get(1).getStringValue());
        }

        @Test
        public void testReverseReplacementXml() throws Exception {
            ValueReplacer replacer = new ValueReplacer(variables);
            assertTrue(variables.getUserDefinedVariables().containsKey("bounded_regex"));
            assertTrue(variables.getUserDefinedVariables().containsKey("normal_regex"));
            assertTrue(replacer.containsKey("bounded_regex"));
            assertTrue(replacer.containsKey("normal_regex"));
            TestElement element = new TestPlan();
            element.setProperty(new StringProperty("domain", "<this><is>xml</this></is>"));
            List<Object> argsin = new ArrayList<>();
            argsin.add("<this><is>xml</this></is>");
            argsin.add("And I say: Hello World.");
            element.setProperty(new CollectionProperty("args", argsin));
            replacer.reverseReplace(element, true);
            @SuppressWarnings("unchecked")
            List<JMeterProperty> args = (List<JMeterProperty>) element.getProperty("args").getObjectValue();
            assertEquals("${bounded_regex}", element.getPropertyAsString("domain"));
            assertEquals("${bounded_regex}", args.get(0).getStringValue());
        }

        @Test
        public void testOverlappingMatches() throws Exception {
            TestPlan plan = new TestPlan();
            plan.addParameter("longMatch", "servername");
            plan.addParameter("shortMatch", ".*");
            ValueReplacer replacer = new ValueReplacer(plan);
            TestElement element = new TestPlan();
            element.setProperty(new StringProperty("domain", "servername.domain"));
            replacer.reverseReplace(element, true);
            String replacedDomain = element.getPropertyAsString("domain");
            assertEquals("${${shortMatch}", replacedDomain);
        }

        @Test
        public void testReplace() throws Exception {
            ValueReplacer replacer = new ValueReplacer();
            replacer.setUserDefinedVariables(variables.getUserDefinedVariables());
            TestElement element = new ConfigTestElement();
            element.setProperty(new StringProperty("domain", "${server}"));
            replacer.replaceValues(element);
            element.setRunningVersion(true);
            assertEquals("jakarta.apache.org", element.getPropertyAsString("domain"));
        }

        @Test
        public void testReplaceStringWithBackslash() throws Exception {
            ValueReplacer replacer = new ValueReplacer();
            replacer.setUserDefinedVariables(variables.getUserDefinedVariables());
            TestElement element = new ConfigTestElement();
            String input = "\\${server} \\ \\\\ \\\\\\ \\, ";
            element.setProperty(new StringProperty("domain", input));
            replacer.replaceValues(element);
            element.setRunningVersion(true);
            assertEquals(input, element.getPropertyAsString("domain"));
        }

        /*
         * This test should be compared with the one above.
         * Here, the string contains a valid variable reference, so all
         * backslashes are also processed.
         *
         * See https://bz.apache.org/bugzilla/show_bug.cgi?id=53534
         */
        @Test
        public void testReplaceFunctionWithBackslash() throws Exception {
            ValueReplacer replacer = new ValueReplacer();
            replacer.setUserDefinedVariables(variables.getUserDefinedVariables());
            TestElement element = new ConfigTestElement();
            String input = "${server} \\ \\\\ \\\\\\ \\, ";
            element.setProperty(new StringProperty("domain", input));
            replacer.replaceValues(element);
            element.setRunningVersion(true);
            assertEquals("jakarta.apache.org \\ \\ \\\\ , ", element.getPropertyAsString("domain"));
        }

        /** {@inheritDoc} */
        @After
        public void tearDown() throws Exception {
            JMeterContextService.getContext().setSamplingStarted(false);
        }
}


text:
package liquibase.executor.jvm;

import liquibase.database.DatabaseConnection;
import liquibase.database.OfflineConnection;
import liquibase.database.PreparedStatementFactory;
import liquibase.database.core.Db2zDatabase;
import liquibase.database.core.OracleDatabase;
import liquibase.database.jvm.JdbcConnection;
import liquibase.exception.DatabaseException;
import liquibase.executor.AbstractExecutor;
import liquibase.logging.LogService;
import liquibase.logging.LogType;
import liquibase.logging.Logger;
import liquibase.sql.CallableSql;
import liquibase.sql.Sql;
import liquibase.sql.visitor.SqlVisitor;
import liquibase.sqlgenerator.SqlGeneratorFactory;
import liquibase.statement.CallableSqlStatement;
import liquibase.statement.CompoundStatement;
import liquibase.statement.ExecutablePreparedStatement;
import liquibase.statement.SqlStatement;
import liquibase.util.JdbcUtils;
import liquibase.util.StringUtils;

import java.sql.CallableStatement;
import java.sql.ResultSet;
import java.sql.SQLException;
import java.sql.Statement;
import java.util.ArrayList;
import java.util.List;
import java.util.Map;

/**
 * Class to simplify execution of SqlStatements.  Based heavily on Spring's JdbcTemplate.
 *

 * Note: This class is currently intended for Liquibase-internal use only and may change without notice in the future
 */
public class JdbcExecutor extends AbstractExecutor {

    private Logger log = LogService.getLog(getClass());

    @Override
    public boolean updatesDatabase() {
        return true;
    }

    public Object execute(StatementCallback action, List<SqlVisitor> sqlVisitors) throws DatabaseException {
        DatabaseConnection con = database.getConnection();
        Statement stmt = null;
        try {
            if (con instanceof OfflineConnection) {
                throw new DatabaseException("Cannot execute commands against an offline database");
            }
            stmt = ((JdbcConnection) con).getUnderlyingConnection().createStatement();
            Statement stmtToUse = stmt;

            return action.doInStatement(stmtToUse);
        }
        catch (SQLException ex) {
            // Release Connection early, to avoid potential connection pool deadlock
            // in the case when the exception translator hasn't been initialized yet.
            JdbcUtils.closeStatement(stmt);
            stmt = null;
            String url;
            if (con.isClosed()) {
                url = "CLOSED CONNECTION";
            } else {
                url = con.getURL();
            }
            throw new DatabaseException("Error executing SQL " + StringUtils.join(applyVisitors(action.getStatement(), sqlVisitors), "; on "+ url)+": "+ex.getMessage(), ex);
        }
        finally {
            JdbcUtils.closeStatement(stmt);
        }
    }

    // Incorrect warning, at least at this point. The situation here is not that we inject some unsanitised parameter
    // into a query. Instead, we process a whole query. The check should be performed at the places where
    // the query is composed.
    @SuppressWarnings("squid:S2077")
    public Object execute(CallableStatementCallback action, List<SqlVisitor> sqlVisitors) throws DatabaseException {
        DatabaseConnection con = database.getConnection();

        if (con instanceof OfflineConnection) {
            throw new DatabaseException("Cannot execute commands against an offline database");
        }

        CallableStatement stmt = null;
        try {
            String sql = applyVisitors(action.getStatement(), sqlVisitors)[0];

            stmt = ((JdbcConnection) con).getUnderlyingConnection().prepareCall(sql);
            return action.doInCallableStatement(stmt);
        }
        catch (SQLException ex) {
            // Release Connection early, to avoid potential connection pool deadlock
            // in the case when the exception translator hasn't been initialized yet.
            JdbcUtils.closeStatement(stmt);
            stmt = null;
            throw new DatabaseException("Error executing SQL " + StringUtils.join(applyVisitors(action.getStatement(), sqlVisitors), "; on "+ con.getURL())+": "+ex.getMessage(), ex);
        }
        finally {
            JdbcUtils.closeStatement(stmt);
        }
    }

    @Override
    public void execute(final SqlStatement sql) throws DatabaseException {
        execute(sql, new ArrayList<SqlVisitor>());
    }

    @Override
    public void execute(final SqlStatement sql, final List<SqlVisitor> sqlVisitors) throws DatabaseException {
        if(sql instanceof ExecutablePreparedStatement) {
            ((ExecutablePreparedStatement) sql).execute(new PreparedStatementFactory((JdbcConnection)database.getConnection()));
            return;
        }
        if (sql instanceof CompoundStatement) {
            if (database instanceof Db2zDatabase) {
                executeDb2ZosComplexStatement(sql);
                return;
            }
        }

        execute(new ExecuteStatementCallback(sql, sqlVisitors), sqlVisitors);
    }

    public Object query(final SqlStatement sql, final ResultSetExtractor rse) throws DatabaseException {
        return query(sql, rse, new ArrayList<SqlVisitor>());
    }

    public Object query(final SqlStatement sql, final ResultSetExtractor rse, final List<SqlVisitor> sqlVisitors) throws DatabaseException {
        if (sql instanceof CallableSqlStatement) {
            return execute(new QueryCallableStatementCallback(sql, rse), sqlVisitors);
        }

        return execute(new QueryStatementCallback(sql, rse, sqlVisitors), sqlVisitors);
    }

    public List query(SqlStatement sql, RowMapper rowMapper) throws DatabaseException {
        return query(sql, rowMapper, new ArrayList());
    }

    public List query(SqlStatement sql, RowMapper rowMapper, List<SqlVisitor> sqlVisitors) throws DatabaseException {
        return (List) query(sql, new RowMapperResultSetExtractor(rowMapper), sqlVisitors);
    }

    public Object queryForObject(SqlStatement sql, RowMapper rowMapper) throws DatabaseException {
        return queryForObject(sql, rowMapper, new ArrayList());
    }

    public Object queryForObject(SqlStatement sql, RowMapper rowMapper, List<SqlVisitor> sqlVisitors) throws DatabaseException {
        List results = query(sql, rowMapper, sqlVisitors);
        try {
            return JdbcUtils.requiredSingleResult(results);
        } catch (DatabaseException e) {
            throw new DatabaseException("Expected single row from " + sql + " but got "+results.size(), e);
        }
    }

    @Override
    public <T> T queryForObject(SqlStatement sql, Class<T> requiredType) throws DatabaseException {
        return (T) queryForObject(sql, requiredType, new ArrayList());
    }

    @Override
    public <T> T queryForObject(SqlStatement sql, Class<T> requiredType, List<SqlVisitor> sqlVisitors) throws DatabaseException {
        return (T) queryForObject(sql, getSingleColumnRowMapper(requiredType), sqlVisitors);
    }

    @Override
    public long queryForLong(SqlStatement sql) throws DatabaseException {
        return queryForLong(sql, new ArrayList());
    }

    @Override
    public long queryForLong(SqlStatement sql, List<SqlVisitor> sqlVisitors) throws DatabaseException {
        Number number = queryForObject(sql, Long.class, sqlVisitors);
        return ((number != null) ? number.longValue() : 0);
    }

    @Override
    public int queryForInt(SqlStatement sql) throws DatabaseException {
        return queryForInt(sql, new ArrayList());
    }

    @Override
    public int queryForInt(SqlStatement sql, List<SqlVisitor> sqlVisitors) throws DatabaseException {
        Number number = queryForObject(sql, Integer.class, sqlVisitors);
        return ((number != null) ? number.intValue() : 0);
    }

    @Override
    public List queryForList(SqlStatement sql, Class elementType) throws DatabaseException {
        return queryForList(sql, elementType, new ArrayList());
    }

    @Override
    public List queryForList(SqlStatement sql, Class elementType, List<SqlVisitor> sqlVisitors) throws DatabaseException {
        return query(sql, getSingleColumnRowMapper(elementType), sqlVisitors);
    }

    @Override
    public List<Map<String, ?>> queryForList(SqlStatement sql) throws DatabaseException {
        return queryForList(sql, new ArrayList());
    }

    @Override
    public List<Map<String, ?>> queryForList(SqlStatement sql, List<SqlVisitor> sqlVisitors) throws DatabaseException {
        return (List<Map<String, ?>>) query(sql, getColumnMapRowMapper(), sqlVisitors);
    }

    @Override
    public int update(final SqlStatement sql) throws DatabaseException {
        return update(sql, new ArrayList());
    }

    // Incorrect warning, at least at this point. The situation here is not that we inject some unsanitised parameter
    // into a query. Instead, we process a whole query. The check should be performed at the places where
    // the query is composed.
    @SuppressWarnings("squid:S2077")
    @Override
    public int update(final SqlStatement sql, final List<SqlVisitor> sqlVisitors) throws DatabaseException {
        if (sql instanceof CallableSqlStatement) {
            throw new DatabaseException("Direct update using CallableSqlStatement not currently implemented");
        }

        class UpdateStatementCallback implements StatementCallback {
            @Override
            public Object doInStatement(Statement stmt) throws SQLException, DatabaseException {
                String[] sqlToExecute = applyVisitors(sql, sqlVisitors);
                if (sqlToExecute.length != 1) {
                    throw new DatabaseException("Cannot call update on Statement that returns back multiple Sql objects");
                }
                log.debug(LogType.WRITE_SQL, sqlToExecute[0]);
                return stmt.executeUpdate(sqlToExecute[0]);
            }

            @Override
            public SqlStatement getStatement() {
                return sql;
            }
        }
        return (Integer) execute(new UpdateStatementCallback(), sqlVisitors);
    }

    /**
     * Create a new RowMapper for reading columns as key-value pairs.
     *
     * @return the RowMapper to use
     * @see ColumnMapRowMapper
     */
    protected RowMapper getColumnMapRowMapper() {
        return new ColumnMapRowMapper();
    }

    /**
     * Create a new RowMapper for reading result objects from a single column.
     *
     * @param requiredType the type that each result object is expected to match
     * @return the RowMapper to use
     * @see SingleColumnRowMapper
     */
    protected RowMapper getSingleColumnRowMapper(Class requiredType) {
        return new SingleColumnRowMapper(requiredType);
    }

    @Override
    public void comment(String message) throws DatabaseException {
        LogService.getLog(getClass()).debug(LogType.LOG, message);
    }

    private void executeDb2ZosComplexStatement(SqlStatement sqlStatement) throws DatabaseException {
        DatabaseConnection con = database.getConnection();

        if (con instanceof OfflineConnection) {
            throw new DatabaseException("Cannot execute commands against an offline database");
        }
        Sql[] sqls = SqlGeneratorFactory.getInstance().generateSql(sqlStatement, database);
        for (Sql sql : sqls) {
            try {
                if (sql instanceof CallableSql) {
                    CallableStatement call = null;
                    ResultSet resultSet = null;
                    try {
                        call = ((JdbcConnection) con).getUnderlyingConnection().prepareCall(sql.toSql());
                        resultSet = call.executeQuery();
                        checkCallStatus(resultSet, ((CallableSql) sql).getExpectedStatus());
                    } finally {
                        JdbcUtils.close(resultSet, call);
                    }
                } else {
                    Statement stmt = null;
                    try {
                        stmt = ((JdbcConnection) con).getUnderlyingConnection().createStatement();
                        stmt.execute(sql.toSql());
                        con.commit();
                    } finally {
                        JdbcUtils.closeStatement(stmt);
                    }
                }
            } catch (Exception e) {
                throw new DatabaseException(e.getMessage() + " [Failed SQL: " + sql.toSql() + "]", e);
            }
        }
    }

    private void checkCallStatus(ResultSet resultSet, String status) throws SQLException, DatabaseException {
        if (status != null) {
            StringBuilder message = new StringBuilder();
            while (resultSet.next()) {
                String string = resultSet.getString(2);
                if (string.contains(status)) {
                    return;
                }
                message.append(string).append("\n");
            }
            throw new DatabaseException(message.toString());
        }
    }

    private class ExecuteStatementCallback implements StatementCallback {

        private final SqlStatement sql;
        private final List<SqlVisitor> sqlVisitors;

        private ExecuteStatementCallback(SqlStatement sql, List<SqlVisitor> sqlVisitors) {
            this.sql = sql;
            this.sqlVisitors = sqlVisitors;
        }

        @Override
        public Object doInStatement(Statement stmt) throws SQLException, DatabaseException {
            for (String statement : applyVisitors(sql, sqlVisitors)) {
                if (database instanceof OracleDatabase) {
                    while (statement.matches("(?s).*[\\s\\r\\n]*/[\\s\\r\\n]*$")) { //all trailing /'s
                        statement = statement.replaceFirst("[\\s\\r\\n]*/[\\s\\r\\n]*$", "");
                    }
                }

                log.info(LogType.WRITE_SQL, String.format("%s", statement));
                if (statement.contains("?")) {
                    stmt.setEscapeProcessing(false);
                }
                try {
                    //if execute returns false, we can retrieve the affected rows count
                    // (true used when resultset is returned)
                    if (!stmt.execute(statement)) {
                        log.debug(Integer.toString(stmt.getUpdateCount()) + " row(s) affected");
                    }
                } catch (Throwable e) {
                    throw new DatabaseException(e.getMessage()+ " [Failed SQL: "+statement+"]", e);
                }
                try {
                    int updateCount = 0;
                    //cycle for retrieving row counts from all statements
                    do {
                        if (!stmt.getMoreResults()) {
                            updateCount = stmt.getUpdateCount();
                            if (updateCount != -1)
                                log.debug(Integer.toString(updateCount) + " row(s) affected");
                        }
                    } while (updateCount != -1);

                } catch (Exception e) {
                    throw new DatabaseException(e.getMessage()+ " [Failed SQL: "+statement+"]", e);
                }
            }
            return null;
        }

        @Override
        public SqlStatement getStatement() {
            return sql;
        }
    }

    private class QueryStatementCallback implements StatementCallback {

        private final SqlStatement sql;
        private final List<SqlVisitor> sqlVisitors;
        private final ResultSetExtractor rse;

        private QueryStatementCallback(SqlStatement sql, ResultSetExtractor rse, List<SqlVisitor> sqlVisitors) {
            this.sql = sql;
            this.rse = rse;
            this.sqlVisitors = sqlVisitors;
        }

        /**
         * 1. Applies all SqlVisitor to the stmt
         * 2. Executes the (possibly modified) stmt
         * 3. Reads all data from the java.sql.ResultSet into an Object and returns the Object.
         * @param stmt A JDBC Statement that is expected to return a ResultSet (e.g. SELECT)
         * @return An object representing all data from the result set.
         * @throws SQLException If an error occurs during SQL processing
         * @throws DatabaseException If an error occurs in the DBMS-specific program code
         */
        @Override
        // Incorrect warning, at least at this point. The situation here is not that we inject some unsanitised
        // parameter into a query. Instead, we process a whole query. The check should be performed at the places where
        // the query is composed.
        @SuppressWarnings("squid:S2077")
        public Object doInStatement(Statement stmt) throws SQLException, DatabaseException {
            ResultSet rs = null;
            try {
                String[] sqlToExecute = applyVisitors(sql, sqlVisitors);

                if (sqlToExecute.length != 1) {
                    throw new DatabaseException("Can only query with statements that return one sql statement");
                }
                log.info(LogType.READ_SQL, sqlToExecute[0]);

                rs = stmt.executeQuery(sqlToExecute[0]);
                ResultSet rsToUse = rs;
                return rse.extractData(rsToUse);
            }
            finally {
                if (rs != null) {
                        JdbcUtils.closeResultSet(rs);
                }
            }
        }

        @Override
        public SqlStatement getStatement() {
            return sql;
        }
    }

    private class QueryCallableStatementCallback implements CallableStatementCallback {

        private final SqlStatement sql;
        private final ResultSetExtractor rse;

        private QueryCallableStatementCallback(SqlStatement sql, ResultSetExtractor rse) {
            this.sql = sql;
            this.rse = rse;
        }

        @Override
        public Object doInCallableStatement(CallableStatement cs) throws SQLException, DatabaseException {
            ResultSet rs = null;
            try {
                rs = cs.executeQuery();
                return rse.extractData(rs);
            }
            finally {
                JdbcUtils.closeResultSet(rs);
            }
        }

        @Override
        public SqlStatement getStatement() {
            return sql;
        }
    }

}


text:
package com.intellij;

import org.springframework.http.server.ServerHttpRequest;
import org.springframework.http.server.ServerHttpResponse;
import org.springframework.web.socket.WebSocketHandler;
import org.springframework.web.socket.server.support.HttpSessionHandshakeInterceptor;

import java.util.Map;

public class SimpleHttpSessionHandshakeInterceptor extends HttpSessionHandshakeInterceptor {

    @Override
    public boolean beforeHandshake(ServerHttpRequest request, ServerHttpResponse response, WebSocketHandler wsHandler, Map<String, Object> attributes) throws Exception {
        return super.beforeHandshake(request, response, wsHandler, attributes);
    }

    @Override
    public void afterHandshake(ServerHttpRequest request, ServerHttpResponse response, WebSocketHandler wsHandler, Exception ex) {
        super.afterHandshake(request, response, wsHandler, ex);
    }
}


text:
<?php

namespace PHPCensor\Plugin;

use PHPCensor\Builder;
use PHPCensor\Common\Exception\RuntimeException;
use PHPCensor\Model\Build;
use PHPCensor\Plugin;
use Symfony\Component\Filesystem\Filesystem;

/**
 * Pdepend Plugin - Allows Pdepend report
 *
 * @package    PHP Censor
 * @subpackage Application
 *
 * @author Johan van der Heide <info@japaveh.nl>
 * @author Dmitry Khomutov <poisoncorpsee@gmail.com>
 */
class Pdepend extends Plugin
{
    protected $args;

    /**
     * @var string
     */
    protected $buildDirectory;

    /**
     * @var string
     */
    protected $buildBranchDirectory;

    /**
     * @var string File where the summary.xml is stored
     */
    protected $summary = 'summary.xml';

    /**
     * @var string File where the chart.svg is stored
     */
    protected $chart = 'chart.svg';

    /**
     * @var string File where the pyramid.svg is stored
     */
    protected $pyramid = 'pyramid.svg';

    /**
     * @var string
     */
    protected $buildLocation;

    /**
     * @var string
     */
    protected $buildBranchLocation;

    /**
     * @return string
     */
    public static function pluginName()
    {
        return 'pdepend';
    }

    /**
     * {@inheritDoc}
     */
    public function __construct(Builder $builder, Build $build, array $options = [])
    {
        parent::__construct($builder, $build, $options);

        $this->executable = $this->findBinary(['pdepend', 'pdepend.phar']);

        $this->buildDirectory       = $build->getBuildDirectory();
        $this->buildBranchDirectory = $build->getBuildBranchDirectory();

        $this->buildLocation       = PUBLIC_DIR . 'artifacts/pdepend/' . $this->buildDirectory;
        $this->buildBranchLocation = PUBLIC_DIR . 'artifacts/pdepend/' . $this->buildBranchDirectory;
    }

    /**
     * Runs Pdepend with the given criteria as arguments
     */
    public function execute()
    {
        $allowPublicArtifacts = (bool)$this->builder->getConfiguration()->get(
            'php-censor.build.allow_public_artifacts',
            false
        );

        $fileSystem = new Filesystem();

        if (!$fileSystem->exists($this->buildLocation)) {
            $fileSystem->mkdir($this->buildLocation, (0777 & ~\umask()));
        }

        if (!\is_writable($this->buildLocation)) {
            throw new RuntimeException(\sprintf(
                'The location %s is not writable or does not exist.',
                $this->buildLocation
            ));
        }

        $pdepend = $this->executable;
        $cmd     = 'cd "%s" && ' . $pdepend . ' --summary-xml="%s" --jdepend-chart="%s" --overview-pyramid="%s" %s "%s"';

        $ignore = '';
        if (\count($this->ignore)) {
            $ignore = \sprintf(' --ignore="%s"', \implode(',', $this->ignore));
        }

        $success = $this->builder->executeCommand(
            $cmd,
            $this->builder->buildPath,
            $this->buildLocation . '/' . $this->summary,
            $this->buildLocation . '/' . $this->chart,
            $this->buildLocation . '/' . $this->pyramid,
            $ignore,
            $this->directory
        );

        if (!$allowPublicArtifacts) {
            $fileSystem->remove($this->buildLocation);
        }
        if ($allowPublicArtifacts && \file_exists($this->buildLocation)) {
            $fileSystem->remove($this->buildBranchLocation);
            $fileSystem->mirror($this->buildLocation, $this->buildBranchLocation);
        }

        if ($allowPublicArtifacts && $success) {
            $this->builder->logSuccess(
                \sprintf(
                    "\nPdepend successful build report.\nYou can use report for this build for inclusion in the readme.md file:\n%s,\n![Chart](%s \"Pdepend Chart\") and\n![Pyramid](%s \"Pdepend Pyramid\")\n\nOr report for last build in the branch:\n%s,\n![Chart](%s \"Pdepend Chart\") and\n![Pyramid](%s \"Pdepend Pyramid\")\n",
                    APP_URL . 'artifacts/pdepend/' . $this->buildDirectory . '/' . $this->summary,
                    APP_URL . 'artifacts/pdepend/' . $this->buildDirectory . '/' . $this->chart,
                    APP_URL . 'artifacts/pdepend/' . $this->buildDirectory . '/' . $this->pyramid,
                    APP_URL . 'artifacts/pdepend/' . $this->buildBranchDirectory . '/' . $this->summary,
                    APP_URL . 'artifacts/pdepend/' . $this->buildBranchDirectory . '/' . $this->chart,
                    APP_URL . 'artifacts/pdepend/' . $this->buildBranchDirectory . '/' . $this->pyramid
                )
            );
        }

        return $success;
    }
}