text:
#!/usr/bin/env ruby

require 'fileutils'
require 'ftools'
require 'optparse'

$:.unshift File.join(File.dirname(__FILE__), '..', '..', 'lib')

require 'phusion_passenger'

CFGLIMIT=%w{fedora-{13,14} epel-5}

stage_dir='./stage'

mock_base_dir = '/var/lib/mock'
mock_repo_dir = "#{mock_base_dir}/passenger-build-repo"
mock_etc_dir='/etc/mock'
#mock_etc_dir='/tmp/mock'

# If rpmbuild-md5 is installed, use it for the SRPM, so EPEL machines can read it.
rpmbuild = '/usr/bin/rpmbuild' + (File.exist?('/usr/bin/rpmbuild-md5') ? '-md5' : '')
rpmtopdir = `rpm -E '%_topdir'`.chomp
rpmarch = `rpm -E '%_arch'`.chomp

@verbosity = 0

@can_build	 = {
	'i386'		=> %w{i586 i686},
	'i686'		=> %w{i586 i686},
	'ppc'			=> %w{},
	'ppc64'		=> %w{ppc},
	's390x'		=> %w{},
	'sparc'		=> %w{},
	'sparc64' => %w{sparc},
	'x86_64'	=> %w{i386 i586 i686},
}

#@can_build.keys.each {|k| @can_build[k].push k}
@can_build = @can_build[rpmarch.to_s == '' ? 'x86_64' : rpmarch]
@can_build.push rpmarch

bindir=File.dirname(File.expand_path __FILE__)

configs = Dir["#{mock_etc_dir}/{#{CFGLIMIT.join ','}}*"].map {|f| f.gsub(%r{.*/([^.]*).cfg}, '\1')}

def limit_configs(configs, limits)
	tree = configs.inject({}) do |m,c|
		(distro,version,arch) = c.split /-/
		next m unless @can_build.include?(arch)
		[
			# Rather than construct this list programatically, just spell it out
			'',
			distro,
			"#{distro}-#{version}",
			"#{distro}-#{version}-#{arch}",
			"#{distro}--#{arch}",
			"--#{arch}",
			# doubtful these will be used, but for completeness
			"-#{version}",
			"-#{version}-#{arch}",
		].each do |pattern|
			unless m[pattern]
				m[pattern] = []
			end
			m[pattern].push c
		end
		m
	end
	tree.default = []
	# Special case for no arguments
	limits = [nil] if limits.empty?
	# By splitting and rejoining we normalize the distro--, etc. cases.
	return limits.map do |l|
		parts = l.to_s.split(/-/).map {|v| v == '*' ? nil : v}
		if parts[2] && !@can_build.include?(parts[2])
			abort "ERROR: Cannot build '#{parts[2]}' packages on '#{rpmarch}'"
		end
		tree[parts.join '-']
	end.flatten
end

def noisy_system(*args)
	puts(args.join(' ')) if @verbosity > 0
	system(*args)
end

############################################################################
options = {}
OptionParser.new do |opts|
	opts.banner = "Usage: #{$0} [options] [distro-version-arch] [distro-version] [distro--arch] [*--arch]"

	opts.on("-v", "--[no-]verbose", "Run verbosely. Add more -v's to increase @verbosity") do |v|
		@verbosity += v ? 1 : -1
	end

	opts.on('-s', '--single', 'Only build a single distro-rev-arch set (for this machine)') do |v|
		options[:single] = true
	end

	# Do these with options, because the order matters
	opts.on('-b', '--mock-base-dir DIR', "Mock's base directory. Default: #{mock_base_dir}") do |v|
		#mock_repo_dir = v
		options[:mock_base_dir] = v
	end

	opts.on('-m', '--mock-repo-dir DIR', "Directory for special mock yum repository. Default: #{mock_repo_dir}") do |v|
		#mock_repo_dir = v
		options[:mock_repo_dir] = v
	end

	opts.on("-c", "--mock-config-dir DIR", "Directory for mock configuration. Default: #{mock_etc_dir}") do |v|
		if File.directory?(v)
			mock_etc_dir=v
		else
			abort "No such directory: #{v}"
		end
	end

	opts.on('-d', '--stage-dir DIR', "Staging directory. Default: #{stage_dir}") do |v|
		stage_dir = v
	end

	opts.on('-e', '--extra-packages DIR', "Directory for extra packages to install.") do |v|
		options[:extra_packages] = v
	end

	opts.on('-r', '--include-release', "Also build passenger-release packages") do
		options[:release] = true
	end

	opts.on_tail("-h", "--help", "Show this message") do
		puts opts
		exit
	end
end.parse!

if options.key?(:mock_base_dir) || options.key?(:mock_repo_dir)
	if options.key?(:mock_base_dir)
		mock_base_dir = options[:mock_base_dir]
		mock_repo_dir = "#{mock_base_dir}/passenger-build-repo"
	end
	if options.key?(:mock_repo_dir)
		mock_repo_dir = options[:mock_repo_dir]
		unless mock_repo_dir[0] == '/'[0]
			mock_repo_dir = "#{mock_base_dir}/#{mock_repo_dir}"
		end
	end
end

limit = ARGV
if options.key?(:single)
	# This can probably be simplified
	limit = [`rpm --queryformat '%{name}\t%{version}' -qf /etc/redhat-release`.sub(/(\w+)-release\t(\d+)/,'\1-\2').sub(/^(rhel|centos|sl)-/,'epel-') + "-#{`rpm -E '%{_host_cpu}'`.strip}"]
end

configs = limit_configs(configs, limit)

if configs.empty?
	abort "Can't find a set of configs for '#{ARGV[0]}' (hint try 'fedora' or 'fedora-14' or even 'fedora-14-x86_64')"
end

puts "BUILD:\n	" + configs.join("\n	") if @verbosity >= 2

# Too much of what follows expects this. Revisit it later.
Dir.chdir(File.join(File.dirname(__FILE__), '..'))

FileUtils.rm_rf(stage_dir, :verbose => @verbosity > 0)
FileUtils.mkdir_p(stage_dir, :verbose => @verbosity > 0)

ENV['BUILD_VERBOSITY'] = @verbosity.to_s

# Check the ages of the configs for validity
mtime = File.mtime("#{bindir}/mocksetup.sh")
if configs.any? {|c| mtime > File.mtime("#{mock_etc_dir}/passenger-#{c}.cfg") rescue true }
	unless noisy_system("#{bindir}/mocksetup.sh", mock_repo_dir, mock_etc_dir)
		abort <<EndErr
Unable to run "#{bindir}/mocksetup.sh #{mock_repo_dir}". It is likely that you
need to run this command as root the first time, but if you have already done
that, it could also be that the current user (or this shell) is not in the
'mock' group.
EndErr
	end
end

srcdir=`rpm -E '%{_sourcedir}'`.chomp

FileUtils.ln_sf(Dir["#{Dir.getwd}/{config/,patches/,release/RPM-GPG}*"], srcdir, :verbose => @verbosity > 0)

# Force the default versions in the spec file to be the ones in the source so a given SRPM doesn't need a --define to set versions.
specdir="/tmp/#{`whoami`.strip}-specfile-#{Process.pid}"
FileUtils.rm_rf(specdir, :verbose => @verbosity > 0)
begin
	FileUtils.mkdir_p(specdir, :verbose => @verbosity > 0)
	FileUtils.cp('passenger.spec', specdir, :verbose => @verbosity > 0)
	# + must be escaped, but * doesn't? And people wonder why I hate sed.
	abort "Can't edit specfile" unless noisy_system('sed', '-i',
		'-e', "s/^\\(\\([[:space:]]*\\)%define[[:space:]]\\+passenger_version[[:space:]]\\)\\+[0-9.]\\+.*/\\2# From Passenger Source\\n\\1#{PhusionPassenger::VERSION_STRING}/",
		'-e', "s/^\\(\\([[:space:]]*\\)%define[[:space:]]\\+nginx_version[[:space:]]\\)\\+[0-9.]\\+.*/\\2# From Passenger Source\\n\\1#{PhusionPassenger::PREFERRED_NGINX_VERSION}/",
		"#{specdir}/passenger.spec")
	# No dist for SRPM
	unless noisy_system(rpmbuild, *((@verbosity > 0 ? [] : %w{--quiet}) + ['--define', 'dist %nil', '-bs', "#{specdir}/passenger.spec"]))
		abort "No SRPM was built. See above for the error"
	end
ensure
	 FileUtils.rm_rf(specdir, :verbose => @verbosity > 0)
end

srpm="rubygem-passenger-#{PhusionPassenger::VERSION_STRING}-#{`grep '%define passenger_release' passenger.spec | awk '{print $3}'`.strip}.src.rpm".sub(/%\{[^}]+\}/, '')

FileUtils.mkdir_p(stage_dir + '/SRPMS', :verbose => @verbosity > 0)

FileUtils.cp("#{rpmtopdir}/SRPMS/#{srpm}", "#{stage_dir}/SRPMS", :verbose => @verbosity > 0)

if options[:release]
	# It's not EXACTLY equivalent, is it? (REALLY doesn't want to symlink to a different name)
	# FileUtils.ln_sf(Dir["#{Dir.getwd}/release/mirrors"], "#{srcdir}/mirrors-passenger", :verbose => @verbosity > 0)
	FileUtils.ln_sf(Dir["#{Dir.getwd}/release/mirrors"], srcdir, :verbose => @verbosity > 0)
	FileUtils.rm_f( "#{srcdir}/mirrors-passenger", :verbose => @verbosity > 0)
	FileUtils.mv("#{srcdir}/mirrors", "#{srcdir}/mirrors-passenger", :force => true, :verbose => @verbosity > 0)
	unless noisy_system(rpmbuild, *((@verbosity > 0 ? [] : %w{--quiet}) + ['--define', 'dist %nil', '-bs', "passenger-release.spec"]))
		abort "No passenger-release SRPM was built. See above for the error"
	end
	rel_version = `grep '^Version:' passenger-release.spec | awk '{print $2}'`.to_i
	rel_release = `grep '^Release:' passenger-release.spec | awk '{print $2}'`.to_i
	@rel_srpm = "passenger-release-#{rel_version}-#{rel_release}.src.rpm"
	FileUtils.cp("#{rpmtopdir}/SRPMS/passenger-release-#{rel_version}-#{rel_release}.src.rpm",
							 "#{stage_dir}/SRPMS", :verbose => @verbosity > 0)
end

mockvolume = @verbosity >= 2 ? %w{-v} : @verbosity < 0 ? %w{-q} : []

@release_cache = {}

configs.each do |cfg|
	puts "---------------------- Building #{cfg}" if @verbosity >= 0
	pcfg = 'passenger-' + cfg

	idir = './pkg'

	unless options.key?(:single)
		idir = File.join stage_dir, cfg.split(/-/)
	end

	# Move *mockvolume to the end, since it causes Ruby to cry in the middle
	# Alt sol'n: *(foo + ['bar'] )
	unless noisy_system('mock', '-r', pcfg, "#{stage_dir}/SRPMS/#{srpm}", *mockvolume)
		abort "Mock failed. See above for details"
	end
	FileUtils.mkdir_p(idir, :verbose => @verbosity > 0)
	FileUtils.cp(Dir["#{mock_base_dir}/#{pcfg}/result/*.rpm"],
							 idir, :verbose => @verbosity > 0)
	if options.key?(:extra_packages)
		FileUtils.cp(Dir["#{options[:extra_packages]}/*.rpm"], idir, :verbose => @verbosity > 0)
	end

	if options[:release]
		cache_key = cfg.split(/-/).first(2).join('-')
		# There is little sense in rebuilding a noarch package over & over
		if @release_cache[cache_key]
			FileUtils.cp(@release_cache[cache_key], idir, :verbose => @verbosity > 0)
		else
			unless noisy_system('mock', '-r', pcfg, "#{stage_dir}/SRPMS/#{@rel_srpm}", *mockvolume)
				abort "Release Mock failed. See above for details"
			end

			FileUtils.cp(Dir["#{mock_base_dir}/#{pcfg}/result/*.rpm"],
									 idir, :verbose => @verbosity > 0)
			@release_cache[cache_key] = Dir["#{idir}/passenger-release*noarch.rpm"].last
		end
	end

	FileUtils.rm_f(Dir["#{idir}/*.src.rpm"], :verbose => @verbosity > 1)
end

unless options.key?(:single)
	if File.directory?("#{stage_dir}/epel")
		FileUtils.mv "#{stage_dir}/epel", "#{stage_dir}/rhel", :verbose => @verbosity > 0
	end
end

if options[:release]
	Dir["#{stage_dir}/*/*"].each do |distro_version|
		next unless File.directory?(distro_version)
		arch = Dir["#{distro_version}/{#{@can_build.sort.join ','}}"].last
		pkg = Dir["#{arch}/passenger-release*rpm"].last
		pkg = pkg.split(/#{File::SEPARATOR}/).last(2)
		FileUtils.ln_sf(File.join(pkg), "#{distro_version}/passenger-release.noarch.rpm", :verbose => @verbosity > 0)
	end
end

unless `rpm -E '%{?_gpg_name}'`.strip == ''
	signor=`rpm -E '%{_gpg_name}'`.strip
	key=`gpg --list-key #{signor} | grep '^pub' | awk '{print $2}' | cut -d/ -f2`
	# Don't re-sign packages already signed by your key
	files=Dir["#{options.key?(:single) ? 'pkg' : stage_dir}/**/*.rpm"].select do |rpm|
		!File.symlink?(rpm) && (`rpm --checksig #{rpm}` !~ /#{key}/)
	end

	noisy_system('rpm', '--addsign', *files)
end


text:
require "spec_helper"
require "fauxhai"

def pf_reports_true_for(*args)
  args.each do |method|
    it "reports true for #{method}" do
      expect(described_class.send(method, node)).to be true
    end
  end
  (PLATFORM_FAMILY_HELPERS - [ :windows_ruby? ] - args).each do |method|
    it "reports false for #{method}" do
      expect(described_class.send(method, node)).to be false
    end
  end
end

RSpec.describe ChefUtils::DSL::PlatformFamily do
  let(:node) { Fauxhai.mock(options).data }

  ( HELPER_MODULES - [ described_class ] ).each do |klass|
    it "does not have methods that collide with #{klass}" do
      expect((klass.methods - Module.methods) & PLATFORM_FAMILY_HELPERS).to be_empty
    end
  end

  ( PLATFORM_FAMILY_HELPERS - [ :windows_ruby? ]).each do |helper|
    it "has the #{helper} in the ChefUtils module" do
      expect(ChefUtils).to respond_to(helper)
    end
  end

  context "on ubuntu" do
    let(:options) { { platform: "ubuntu" } }

    pf_reports_true_for(:debian?)
  end

  context "on raspbian" do
    let(:options) { { platform: "raspbian" } }

    pf_reports_true_for(:debian?)
  end

  context "on linuxmint" do
    let(:options) { { platform: "linuxmint" } }

    pf_reports_true_for(:debian?)
  end

  context "on debian" do
    let(:options) { { platform: "debian" } }

    pf_reports_true_for(:debian?)
  end

  context "on aix" do
    let(:options) { { platform: "aix" } }

    pf_reports_true_for(:aix?)
  end

  context "on amazon" do
    let(:options) { { platform: "amazon" } }

    pf_reports_true_for(:amazon?, :amazon_linux?, :rpm_based?, :fedora_derived?)
  end

  context "on arch" do
    let(:options) { { platform: "arch" } }

    pf_reports_true_for(:arch?, :arch_linux?)
  end

  context "on centos6" do
    let(:options) { { platform: "centos", version: "6.10" } }

    pf_reports_true_for(:rhel?, :rpm_based?, :fedora_derived?, :redhat_based?, :el?, :rhel6?)
  end

  context "on centos7" do
    let(:options) { { platform: "centos", version: "7.7.1908" } }

    pf_reports_true_for(:rhel?, :rpm_based?, :fedora_derived?, :redhat_based?, :el?, :rhel7?)
  end

  context "on centos8" do
    let(:options) { { platform: "centos", version: "8" } }

    pf_reports_true_for(:rhel?, :rpm_based?, :fedora_derived?, :redhat_based?, :el?, :rhel8?)
  end

  context "on clearos7" do
    let(:options) { { platform: "clearos", version: "7.4" } }

    pf_reports_true_for(:rhel?, :rpm_based?, :fedora_derived?, :redhat_based?, :el?, :rhel7?)
  end

  context "on dragonfly4" do
    let(:options) { { platform: "dragonfly4" } }

    pf_reports_true_for(:dragonflybsd?)
  end

  context "on fedora" do
    let(:options) { { platform: "fedora" } }

    pf_reports_true_for(:fedora?, :rpm_based?, :fedora_derived?, :redhat_based?)
  end

  context "on freebsd" do
    let(:options) { { platform: "freebsd" } }

    pf_reports_true_for(:freebsd?, :bsd_based?)
  end

  context "on gentoo" do
    let(:options) { { platform: "gentoo" } }

    pf_reports_true_for(:gentoo?)
  end

  context "on mac_os_x" do
    let(:options) { { platform: "mac_os_x" } }

    pf_reports_true_for(:mac_os_x?, :mac?, :osx?, :macos?)
  end

  context "on openbsd" do
    let(:options) { { platform: "openbsd" } }

    pf_reports_true_for(:openbsd?, :bsd_based?)
  end

  context "on opensuse" do
    let(:options) { { platform: "opensuse" } }

    pf_reports_true_for(:suse?, :rpm_based?)
  end

  context "on oracle6" do
    let(:options) { { platform: "oracle", version: "6.10" } }

    pf_reports_true_for(:rhel?, :rpm_based?, :fedora_derived?, :redhat_based?, :el?, :rhel6?)
  end

  context "on oracle7" do
    let(:options) { { platform: "oracle", version: "7.6" } }

    pf_reports_true_for(:rhel?, :rpm_based?, :fedora_derived?, :redhat_based?, :el?, :rhel7?)
  end

  context "on redhat6" do
    let(:options) { { platform: "redhat", version: "6.10" } }

    pf_reports_true_for(:rhel?, :rpm_based?, :fedora_derived?, :redhat_based?, :el?, :rhel6?)
  end

  context "on redhat7" do
    let(:options) { { platform: "redhat", version: "7.6" } }

    pf_reports_true_for(:rhel?, :rpm_based?, :fedora_derived?, :redhat_based?, :el?, :rhel7?)
  end

  context "on redhat8" do
    let(:options) { { platform: "redhat", version: "8" } }

    pf_reports_true_for(:rhel?, :rpm_based?, :fedora_derived?, :redhat_based?, :el?, :rhel8?)
  end

  context "on smartos" do
    let(:options) { { platform: "smartos" } }

    pf_reports_true_for(:smartos?, :solaris_based?)
  end

  context "on solaris2" do
    let(:options) { { platform: "solaris2" } }

    pf_reports_true_for(:solaris?, :solaris2?, :solaris_based?)
  end

  context "on suse" do
    let(:options) { { platform: "suse" } }

    pf_reports_true_for(:suse?, :rpm_based?)
  end

  context "on windows" do
    let(:options) { { platform: "windows" } }

    pf_reports_true_for(:windows?)
  end

  context "node-independent windows APIs" do
    if RUBY_PLATFORM.match?(/mswin|mingw32|windows/)
      it "reports true for :windows_ruby?" do
        expect(described_class.windows_ruby?).to be true
      end
    else
      it "reports false for :windows_ruby?" do
        expect(described_class.windows_ruby?).to be false
      end
    end
  end
end

redpajama_set_name: RedPajamaGithub


text:
001
017    package net.sf.log4jdbc;
018
019    import java.io.InputStream;
020    import java.io.Reader;
021    import java.math.BigDecimal;
022    import java.net.URL;
023    import java.sql.Array;
024    import java.sql.Blob;
025    import java.sql.CallableStatement;
026    import java.sql.Clob;
027    import java.sql.Date;
028    import java.sql.Ref;
029    import java.sql.SQLException;
030    import java.sql.Time;
031    import java.sql.Timestamp;
032    import java.util.Calendar;
033    import java.util.Map;
034
035    /**
036     * Wraps a CallableStatement and reports method calls, returns and exceptions.
037     *
038     * @author Arthur Blake
039     */
040    public class CallableStatementSpy extends PreparedStatementSpy implements CallableStatement
041    {
042      protected void reportAllReturns(String methodCall, String msg)
043      {
044        log.methodReturned(this, methodCall, msg);
045      }
046
047      /**
048       * The real underlying CallableStatement that this CallableStatementSpy wraps.
049       */
050      private CallableStatement realCallableStatement;
051
052      /**
053       * Get the real underlying CallableStatement that this CallableStatementSpy wraps.
054       *
055       * @return the real underlying CallableStatement.
056       */
057      public CallableStatement getRealCallableStatement()
058      {
059        return realCallableStatement;
060      }
061
062      /**
063       * Create a CallableStatementSpy (JDBC 3 version) to spy upon a CallableStatement.
064       *
065       * @param sql                   The SQL used for this CallableStatement
066       * @param connectionSpy         The ConnectionSpy which produced this CallableStatementSpy
067       * @param realCallableStatement The real CallableStatement that is being spied upon
068       */
069      public CallableStatementSpy(String sql, ConnectionSpy connectionSpy, CallableStatement realCallableStatement)
070      {
071        super(sql, connectionSpy, realCallableStatement);
072        this.realCallableStatement = realCallableStatement;
073      }
074
075      public String getClassType()
076      {
077        return "CallableStatement";
078      }
079
080      // forwarding methods
081
082      public Date getDate(int parameterIndex) throws SQLException
083      {
084        String methodCall = "getDate(" + parameterIndex + ")";
085        try
086        {
087          return (Date) reportReturn(methodCall, realCallableStatement.getDate(parameterIndex));
088        }
089        catch (SQLException s)
090        {
091          reportException(methodCall, s);
092          throw s;
093        }
094      }
095
096      public Date getDate(int parameterIndex, Calendar cal) throws SQLException
097      {
098        String methodCall = "getDate(" + parameterIndex + ", " + cal + ")";
099        try
100        {
101          return (Date) reportReturn(methodCall, realCallableStatement.getDate(parameterIndex, cal));
102        }
103        catch (SQLException s)
104        {
105          reportException(methodCall, s);
106          throw s;
107        }
108      }
109
110      public Ref getRef(String parameterName) throws SQLException
111      {
112        String methodCall = "getRef(" + parameterName + ")";
113        try
114        {
115          return (Ref) reportReturn(methodCall, realCallableStatement.getRef(parameterName));
116        }
117        catch (SQLException s)
118        {
119          reportException(methodCall, s);
120          throw s;
121        }
122      }
123
124      public Time getTime(String parameterName) throws SQLException
125      {
126        String methodCall = "getTime(" + parameterName + ")";
127        try
128        {
129          return (Time) reportReturn(methodCall, realCallableStatement.getTime(parameterName));
130        }
131        catch (SQLException s)
132        {
133          reportException(methodCall, s);
134          throw s;
135        }
136      }
137
138      public void setTime(String parameterName, Time x) throws SQLException
139      {
140        String methodCall = "setTime(" + parameterName + ", " + x + ")";
141        try
142        {
143          realCallableStatement.setTime(parameterName, x);
144        }
145        catch (SQLException s)
146        {
147          reportException(methodCall, s);
148          throw s;
149        }
150        reportReturn(methodCall);
151      }
152
153      public Blob getBlob(int i) throws SQLException
154      {
155        String methodCall = "getBlob(" + i + ")";
156        try
157        {
158          return (Blob) reportReturn(methodCall, realCallableStatement.getBlob(i));
159        }
160        catch (SQLException s)
161        {
162          reportException(methodCall, s);
163          throw s;
164        }
165      }
166
167      public Clob getClob(int i) throws SQLException
168      {
169        String methodCall = "getClob(" + i + ")";
170        try
171        {
172          return (Clob) reportReturn(methodCall, realCallableStatement.getClob(i));
173        }
174        catch (SQLException s)
175        {
176          reportException(methodCall, s);
177          throw s;
178        }
179      }
180
181      public Array getArray(int i) throws SQLException
182      {
183        String methodCall = "getArray(" + i + ")";
184        try
185        {
186          return (Array) reportReturn(methodCall, realCallableStatement.getArray(i));
187        }
188        catch (SQLException s)
189        {
190          reportException(methodCall, s);
191          throw s;
192        }
193      }
194
195      public byte[] getBytes(int parameterIndex) throws SQLException
196      {
197        String methodCall = "getBytes(" + parameterIndex + ")";
198        try
199        {
200          return (byte[]) reportReturn(methodCall, realCallableStatement.getBytes(parameterIndex));
201        }
202        catch (SQLException s)
203        {
204          reportException(methodCall, s);
205          throw s;
206        }
207      }
208
209      public double getDouble(int parameterIndex) throws SQLException
210      {
211        String methodCall = "getDouble(" + parameterIndex + ")";
212        try
213        {
214          return reportReturn(methodCall, realCallableStatement.getDouble(parameterIndex));
215        }
216        catch (SQLException s)
217        {
218          reportException(methodCall, s);
219          throw s;
220        }
221      }
222
223      public int getInt(int parameterIndex) throws SQLException
224      {
225        String methodCall = "getInt(" + parameterIndex + ")";
226        try
227        {
228          return reportReturn(methodCall, realCallableStatement.getInt(parameterIndex));
229        }
230        catch (SQLException s)
231        {
232          reportException(methodCall, s);
233          throw s;
234        }
235      }
236
237      public boolean wasNull() throws SQLException
238      {
239        String methodCall = "wasNull()";
240        try
241        {
242          return reportReturn(methodCall, realCallableStatement.wasNull());
243        }
244        catch (SQLException s)
245        {
246          reportException(methodCall, s);
247          throw s;
248        }
249      }
250
251      public Time getTime(int parameterIndex) throws SQLException
252      {
253        String methodCall = "getTime(" + parameterIndex + ")";
254        try
255        {
256          return (Time) reportReturn(methodCall, realCallableStatement.getTime(parameterIndex));
257        }
258        catch (SQLException s)
259        {
260          reportException(methodCall, s);
261          throw s;
262        }
263      }
264
265      public Time getTime(int parameterIndex, Calendar cal) throws SQLException
266      {
267        String methodCall = "getTime(" + parameterIndex + ", " + cal + ")";
268        try
269        {
270          return (Time) reportReturn(methodCall, realCallableStatement.getTime(parameterIndex, cal));
271        }
272        catch (SQLException s)
273        {
274          reportException(methodCall, s);
275          throw s;
276        }
277      }
278
279      public Timestamp getTimestamp(String parameterName) throws SQLException
280      {
281        String methodCall = "getTimestamp(" + parameterName + ")";
282        try
283        {
284          return (Timestamp) reportReturn(methodCall, realCallableStatement.getTimestamp(parameterName));
285        }
286        catch (SQLException s)
287        {
288          reportException(methodCall, s);
289          throw s;
290        }
291      }
292
293      public void setTimestamp(String parameterName, Timestamp x) throws SQLException
294      {
295        String methodCall = "setTimestamp(" + parameterName + ", " + x + ")";
296        try
297        {
298          realCallableStatement.setTimestamp(parameterName, x);
299        }
300        catch (SQLException s)
301        {
302          reportException(methodCall, s);
303          throw s;
304        }
305        reportReturn(methodCall);
306      }
307
308      public String getString(int parameterIndex) throws SQLException
309      {
310        String methodCall = "getString(" + parameterIndex + ")";
311        try
312        {
313          return (String) reportReturn(methodCall, realCallableStatement.getString(parameterIndex));
314        }
315        catch (SQLException s)
316        {
317          reportException(methodCall, s);
318          throw s;
319        }
320      }
321
322      public void registerOutParameter(int parameterIndex, int sqlType) throws SQLException
323      {
324        String methodCall = "registerOutParameter(" + parameterIndex + ", " + sqlType + ")";
325        argTraceSet(parameterIndex, null, "<OUT>");
326        try
327        {
328          realCallableStatement.registerOutParameter(parameterIndex, sqlType);
329        }
330        catch (SQLException s)
331        {
332          reportException(methodCall, s);
333          throw s;
334        }
335        reportReturn(methodCall);
336      }
337
338      public void registerOutParameter(int parameterIndex, int sqlType, int scale) throws SQLException
339      {
340        String methodCall = "registerOutParameter(" + parameterIndex + ", " + sqlType + ", " + scale + ")";
341        argTraceSet(parameterIndex, null, "<OUT>");
342        try
343        {
344          realCallableStatement.registerOutParameter(parameterIndex, sqlType, scale);
345        }
346        catch (SQLException s)
347        {
348          reportException(methodCall, s);
349          throw s;
350        }
351        reportReturn(methodCall);
352      }
353
354      public void registerOutParameter(int paramIndex, int sqlType, String typeName) throws SQLException
355      {
356        String methodCall = "registerOutParameter(" + paramIndex + ", " + sqlType + ", " + typeName + ")";
357        argTraceSet(paramIndex, null, "<OUT>");
358        try
359        {
360          realCallableStatement.registerOutParameter(paramIndex, sqlType, typeName);
361        }
362        catch (SQLException s)
363        {
364          reportException(methodCall, s);
365          throw s;
366        }
367        reportReturn(methodCall);
368      }
369
370      public byte getByte(String parameterName) throws SQLException
371      {
372        String methodCall = "getByte(" + parameterName + ")";
373        try
374        {
375          return reportReturn(methodCall, realCallableStatement.getByte(parameterName));
376        }
377        catch (SQLException s)
378        {
379          reportException(methodCall, s);
380          throw s;
381        }
382      }
383
384      public double getDouble(String parameterName) throws SQLException
385      {
386        String methodCall = "getDouble(" + parameterName + ")";
387        try
388        {
389          return reportReturn(methodCall, realCallableStatement.getDouble(parameterName));
390        }
391        catch (SQLException s)
392        {
393          reportException(methodCall, s);
394          throw s;
395        }
396      }
397
398      public float getFloat(String parameterName) throws SQLException
399      {
400        String methodCall = "getFloat(" + parameterName + ")";
401        try
402        {
403          return reportReturn(methodCall, realCallableStatement.getFloat(parameterName));
404        }
405        catch (SQLException s)
406        {
407          reportException(methodCall, s);
408          throw s;
409        }
410      }
411
412      public int getInt(String parameterName) throws SQLException
413      {
414        String methodCall = "getInt(" + parameterName + ")";
415        try
416        {
417          return reportReturn(methodCall, realCallableStatement.getInt(parameterName));
418        }
419        catch (SQLException s)
420        {
421          reportException(methodCall, s);
422          throw s;
423        }
424      }
425
426      public long getLong(String parameterName) throws SQLException
427      {
428        String methodCall = "getLong(" + parameterName + ")";
429        try
430        {
431          return reportReturn(methodCall, realCallableStatement.getLong(parameterName));
432        }
433        catch (SQLException s)
434        {
435          reportException(methodCall, s);
436          throw s;
437        }
438      }
439
440      public short getShort(String parameterName) throws SQLException
441      {
442        String methodCall = "getShort(" + parameterName + ")";
443        try
444        {
445          return reportReturn(methodCall, realCallableStatement.getShort(parameterName));
446        }
447        catch (SQLException s)
448        {
449          reportException(methodCall, s);
450          throw s;
451        }
452      }
453
454      public boolean getBoolean(String parameterName) throws SQLException
455      {
456        String methodCall = "getBoolean(" + parameterName + ")";
457        try
458        {
459          return reportReturn(methodCall, realCallableStatement.getBoolean(parameterName));
460        }
461        catch (SQLException s)
462        {
463          reportException(methodCall, s);
464          throw s;
465        }
466      }
467
468      public byte[] getBytes(String parameterName) throws SQLException
469      {
470        String methodCall = "getBytes(" + parameterName + ")";
471        try
472        {
473          return (byte[]) reportReturn(methodCall, realCallableStatement.getBytes(parameterName));
474        }
475        catch (SQLException s)
476        {
477          reportException(methodCall, s);
478          throw s;
479        }
480      }
481
482      public void setByte(String parameterName, byte x) throws SQLException
483      {
484        String methodCall = "setByte(" + parameterName + ", " + x + ")";
485        try
486        {
487          realCallableStatement.setByte(parameterName, x);
488        }
489        catch (SQLException s)
490        {
491          reportException(methodCall, s);
492          throw s;
493        }
494        reportReturn(methodCall);
495      }
496
497      public void setDouble(String parameterName, double x) throws SQLException
498      {
499        String methodCall = "setDouble(" + parameterName + ", " + x + ")";
500        try
501        {
502          realCallableStatement.setDouble(parameterName, x);
503        }
504        catch (SQLException s)
505        {
506          reportException(methodCall, s);
507          throw s;
508        }
509        reportReturn(methodCall);
510      }
511
512      public void setFloat(String parameterName, float x) throws SQLException
513      {
514        String methodCall = "setFloat(" + parameterName + ", " + x + ")";
515        try
516        {
517          realCallableStatement.setFloat(parameterName, x);
518        }
519        catch (SQLException s)
520        {
521          reportException(methodCall, s);
522          throw s;
523        }
524        reportReturn(methodCall);
525      }
526
527      public void registerOutParameter(String parameterName, int sqlType) throws SQLException
528      {
529        String methodCall = "registerOutParameter(" + parameterName + ", " + sqlType + ")";
530        try
531        {
532          realCallableStatement.registerOutParameter(parameterName, sqlType);
533        }
534        catch (SQLException s)
535        {
536          reportException(methodCall, s);
537          throw s;
538        }
539        reportReturn(methodCall);
540      }
541
542      public void setInt(String parameterName, int x) throws SQLException
543      {
544        String methodCall = "setInt(" + parameterName + ", " + x + ")";
545        try
546        {
547          realCallableStatement.setInt(parameterName, x);
548        }
549        catch (SQLException s)
550        {
551          reportException(methodCall, s);
552          throw s;
553        }
554        reportReturn(methodCall);
555      }
556
557      public void setNull(String parameterName, int sqlType) throws SQLException
558      {
559        String methodCall = "setNull(" + parameterName + ", " + sqlType + ")";
560        try
561        {
562          realCallableStatement.setNull(parameterName, sqlType);
563        }
564        catch (SQLException s)
565        {
566          reportException(methodCall, s);
567          throw s;
568        }
569        reportReturn(methodCall);
570      }
571
572      public void registerOutParameter(String parameterName, int sqlType, int scale) throws SQLException
573      {
574        String methodCall = "registerOutParameter(" + parameterName + ", " + sqlType + ", " + scale + ")";
575        try
576        {
577          realCallableStatement.registerOutParameter(parameterName, sqlType, scale);
578        }
579        catch (SQLException s)
580        {
581          reportException(methodCall, s);
582          throw s;
583        }
584        reportReturn(methodCall);
585      }
586
587      public void setLong(String parameterName, long x) throws SQLException
588      {
589        String methodCall = "setLong(" + parameterName + ", " + x + ")";
590        try
591        {
592          realCallableStatement.setLong(parameterName, x);
593        }
594        catch (SQLException s)
595        {
596          reportException(methodCall, s);
597          throw s;
598        }
599        reportReturn(methodCall);
600      }
601
602      public void setShort(String parameterName, short x) throws SQLException
603      {
604        String methodCall = "setShort(" + parameterName + ", " + x + ")";
605        try
606        {
607          realCallableStatement.setShort(parameterName, x);
608        }
609        catch (SQLException s)
610        {
611          reportException(methodCall, s);
612          throw s;
613        }
614        reportReturn(methodCall);
615      }
616
617      public void setBoolean(String parameterName, boolean x) throws SQLException
618      {
619        String methodCall = "setBoolean(" + parameterName + ", " + x + ")";
620        try
621        {
622          realCallableStatement.setBoolean(parameterName, x);
623        }
624        catch (SQLException s)
625        {
626          reportException(methodCall, s);
627          throw s;
628        }
629        reportReturn(methodCall);
630      }
631
632      public void setBytes(String parameterName, byte[] x) throws SQLException
633      {
634        //todo: dump byte array?
635        String methodCall = "setBytes(" + parameterName + ", " + x + ")";
636        try
637        {
638          realCallableStatement.setBytes(parameterName, x);
639        }
640        catch (SQLException s)
641        {
642          reportException(methodCall, s);
643          throw s;
644        }
645        reportReturn(methodCall);
646      }
647
648      public boolean getBoolean(int parameterIndex) throws SQLException
649      {
650        String methodCall = "getBoolean(" + parameterIndex + ")";
651        try
652        {
653          return reportReturn(methodCall, realCallableStatement.getBoolean(parameterIndex));
654        }
655        catch (SQLException s)
656        {
657          reportException(methodCall, s);
658          throw s;
659        }
660      }
661
662      public Timestamp getTimestamp(int parameterIndex) throws SQLException
663      {
664        String methodCall = "getTimestamp(" + parameterIndex + ")";
665        try
666        {
667          return (Timestamp) reportReturn(methodCall, realCallableStatement.getTimestamp(parameterIndex));
668        }
669        catch (SQLException s)
670        {
671          reportException(methodCall, s);
672          throw s;
673        }
674      }
675
676      public void setAsciiStream(String parameterName, InputStream x, int length) throws SQLException
677      {
678        String methodCall = "setAsciiStream(" + parameterName + ", " + x + ", " + length + ")";
679        try
680        {
681          realCallableStatement.setAsciiStream(parameterName, x, length);
682        }
683        catch (SQLException s)
684        {
685          reportException(methodCall, s);
686          throw s;
687        }
688        reportReturn(methodCall);
689      }
690
691      public void setBinaryStream(String parameterName, InputStream x, int length) throws SQLException
692      {
693        String methodCall = "setBinaryStream(" + parameterName + ", " + x + ", " + length + ")";
694        try
695        {
696          realCallableStatement.setBinaryStream(parameterName, x, length);
697        }
698        catch (SQLException s)
699        {
700          reportException(methodCall, s);
701          throw s;
702        }
703        reportReturn(methodCall);
704      }
705
706      public void setCharacterStream(String parameterName, Reader reader, int length) throws SQLException
707      {
708        String methodCall = "setCharacterStream(" + parameterName + ", " + reader + ", " + length + ")";
709        try
710        {
711          realCallableStatement.setCharacterStream(parameterName, reader, length);
712        }
713        catch (SQLException s)
714        {
715          reportException(methodCall, s);
716          throw s;
717        }
718        reportReturn(methodCall);
719      }
720
721      public Object getObject(String parameterName) throws SQLException
722      {
723        String methodCall = "getObject(" + parameterName + ")";
724        try
725        {
726          return reportReturn(methodCall, realCallableStatement.getObject(parameterName));
727        }
728        catch (SQLException s)
729        {
730          reportException(methodCall, s);
731          throw s;
732        }
733      }
734
735      public void setObject(String parameterName, Object x) throws SQLException
736      {
737        String methodCall = "setObject(" + parameterName + ", " + x + ")";
738        try
739        {
740          realCallableStatement.setObject(parameterName, x);
741        }
742        catch (SQLException s)
743        {
744          reportException(methodCall, s);
745          throw s;
746        }
747        reportReturn(methodCall);
748      }
749
750      public void setObject(String parameterName, Object x, int targetSqlType) throws SQLException
751      {
752        String methodCall = "setObject(" + parameterName + ", " + x + ", " + targetSqlType + ")";
753        try
754        {
755          realCallableStatement.setObject(parameterName, x, targetSqlType);
756        }
757        catch (SQLException s)
758        {
759          reportException(methodCall, s);
760          throw s;
761        }
762        reportReturn(methodCall);
763      }
764
765      public void setObject(String parameterName, Object x, int targetSqlType, int scale) throws SQLException
766      {
767        String methodCall = "setObject(" + parameterName + ", " + x + ", " + targetSqlType + ", " + scale + ")";
768        try
769        {
770          realCallableStatement.setObject(parameterName, x, targetSqlType, scale);
771        }
772        catch (SQLException s)
773        {
774          reportException(methodCall, s);
775          throw s;
776        }
777        reportReturn(methodCall);
778      }
779
780      public Timestamp getTimestamp(int parameterIndex, Calendar cal) throws SQLException
781      {
782        String methodCall = "getTimestamp(" + parameterIndex + ", " + cal + ")";
783        try
784        {
785          return (Timestamp) reportReturn(methodCall, realCallableStatement.getTimestamp(parameterIndex, cal));
786        }
787        catch (SQLException s)
788        {
789          reportException(methodCall, s);
790          throw s;
791        }
792      }
793
794      public Object getObject(String parameterName, Map map) throws SQLException
795      {
796        String methodCall = "getObject(" + parameterName + ", " + map + ")";
797        try
798        {
799          return reportReturn(methodCall, realCallableStatement.getObject(parameterName, map));
800        }
801        catch (SQLException s)
802        {
803          reportException(methodCall, s);
804          throw s;
805        }
806      }
807
808      public Date getDate(String parameterName, Calendar cal) throws SQLException
809      {
810        String methodCall = "getDate(" + parameterName + ", " + cal + ")";
811        try
812        {
813          return (Date) reportReturn(methodCall, realCallableStatement.getDate(parameterName, cal));
814        }
815        catch (SQLException s)
816        {
817          reportException(methodCall, s);
818          throw s;
819        }
820      }
821
822      public Time getTime(String parameterName, Calendar cal) throws SQLException
823      {
824        String methodCall = "getTime(" + parameterName + ", " + cal + ")";
825        try
826        {
827          return (Time) reportReturn(methodCall, realCallableStatement.getTime(parameterName, cal));
828        }
829        catch (SQLException s)
830        {
831          reportException(methodCall, s);
832          throw s;
833        }
834      }
835
836      public Timestamp getTimestamp(String parameterName, Calendar cal) throws SQLException
837      {
838        String methodCall = "getTimestamp(" + parameterName + ", " + cal + ")";
839        try
840        {
841          return (Timestamp) reportReturn(methodCall, realCallableStatement.getTimestamp(parameterName, cal));
842        }
843        catch (SQLException s)
844        {
845          reportException(methodCall, s);
846          throw s;
847        }
848      }
849
850      public void setDate(String parameterName, Date x, Calendar cal) throws SQLException
851      {
852        String methodCall = "setDate(" + parameterName + ", " + x + ", " + cal + ")";
853        try
854        {
855          realCallableStatement.setDate(parameterName, x, cal);
856        }
857        catch (SQLException s)
858        {
859          reportException(methodCall, s);
860          throw s;
861        }
862        reportReturn(methodCall);
863      }
864
865      public void setTime(String parameterName, Time x, Calendar cal) throws SQLException
866      {
867        String methodCall = "setTime(" + parameterName + ", " + x + ", " + cal + ")";
868        try
869        {
870          realCallableStatement.setTime(parameterName, x, cal);
871        }
872        catch (SQLException s)
873        {
874          reportException(methodCall, s);
875          throw s;
876        }
877        reportReturn(methodCall);
878      }
879
880      public void setTimestamp(String parameterName, Timestamp x, Calendar cal) throws SQLException
881      {
882        String methodCall = "setTimestamp(" + parameterName + ", " + x + ", " + cal + ")";
883        try
884        {
885          realCallableStatement.setTimestamp(parameterName, x, cal);
886        }
887        catch (SQLException s)
888        {
889          reportException(methodCall, s);
890          throw s;
891        }
892        reportReturn(methodCall);
893      }
894
895      public short getShort(int parameterIndex) throws SQLException
896      {
897        String methodCall = "getShort(" + parameterIndex + ")";
898        try
899        {
900          return reportReturn(methodCall, realCallableStatement.getShort(parameterIndex));
901        }
902        catch (SQLException s)
903        {
904          reportException(methodCall, s);
905          throw s;
906        }
907      }
908
909      public long getLong(int parameterIndex) throws SQLException
910      {
911        String methodCall = "getLong(" + parameterIndex + ")";
912        try
913        {
914          return reportReturn(methodCall, realCallableStatement.getLong(parameterIndex));
915        }
916        catch (SQLException s)
917        {
918          reportException(methodCall, s);
919          throw s;
920        }
921      }
922
923      public float getFloat(int parameterIndex) throws SQLException
924      {
925        String methodCall = "getFloat(" + parameterIndex + ")";
926        try
927        {
928          return reportReturn(methodCall, realCallableStatement.getFloat(parameterIndex));
929        }
930        catch (SQLException s)
931        {
932          reportException(methodCall, s);
933          throw s;
934        }
935      }
936
937      public Ref getRef(int i) throws SQLException
938      {
939        String methodCall = "getRef(" + i + ")";
940        try
941        {
942          return (Ref) reportReturn(methodCall, realCallableStatement.getRef(i));
943        }
944        catch (SQLException s)
945        {
946          reportException(methodCall, s);
947          throw s;
948        }
949      }
950
951      /**
952       * @deprecated
953       */
954      public BigDecimal getBigDecimal(int parameterIndex, int scale) throws SQLException
955      {
956        String methodCall = "getBigDecimal(" + parameterIndex + ", " + scale + ")";
957        try
958        {
959          return (BigDecimal) reportReturn(methodCall, realCallableStatement.getBigDecimal(parameterIndex, scale));
960        }
961        catch (SQLException s)
962        {
963          reportException(methodCall, s);
964          throw s;
965        }
966      }
967
968      public URL getURL(int parameterIndex) throws SQLException
969      {
970        String methodCall = "getURL(" + parameterIndex + ")";
971        try
972        {
973          return (URL) reportReturn(methodCall, realCallableStatement.getURL(parameterIndex));
974        }
975        catch (SQLException s)
976        {
977          reportException(methodCall, s);
978          throw s;
979        }
980
981      }
982
983      public BigDecimal getBigDecimal(int parameterIndex) throws SQLException
984      {
985        String methodCall = "getBigDecimal(" + parameterIndex + ")";
986        try
987        {
988          return (BigDecimal) reportReturn(methodCall, realCallableStatement.getBigDecimal(parameterIndex));
989        }
990        catch (SQLException s)
991        {
992          reportException(methodCall, s);
993          throw s;
994        }
995      }
996
997      public byte getByte(int parameterIndex) throws SQLException
998      {
999        String methodCall = "getByte(" + parameterIndex + ")";
1000        try
1001        {
1002          return reportReturn(methodCall, realCallableStatement.getByte(parameterIndex));
1003        }
1004        catch (SQLException s)
1005        {
1006          reportException(methodCall, s);
1007          throw s;
1008        }
1009      }
1010
1011      public Object getObject(int parameterIndex) throws SQLException
1012      {
1013        String methodCall = "getObject(" + parameterIndex + ")";
1014        try
1015        {
1016          return reportReturn(methodCall, realCallableStatement.getObject(parameterIndex));
1017        }
1018        catch (SQLException s)
1019        {
1020          reportException(methodCall, s);
1021          throw s;
1022        }
1023      }
1024
1025      public Object getObject(int i, Map map) throws SQLException
1026      {
1027        String methodCall = "getObject(" + i + ", " + map + ")";
1028        try
1029        {
1030          return reportReturn(methodCall, realCallableStatement.getObject(i, map));
1031        }
1032        catch (SQLException s)
1033        {
1034          reportException(methodCall, s);
1035          throw s;
1036        }
1037      }
1038
1039      public String getString(String parameterName) throws SQLException
1040      {
1041        String methodCall = "getString(" + parameterName + ")";
1042        try
1043        {
1044          return (String) reportReturn(methodCall, realCallableStatement.getString(parameterName));
1045        }
1046        catch (SQLException s)
1047        {
1048          reportException(methodCall, s);
1049          throw s;
1050        }
1051      }
1052
1053      public void registerOutParameter(String parameterName, int sqlType, String typeName) throws SQLException
1054      {
1055        String methodCall = "registerOutParameter(" + parameterName + ", " + sqlType + ", " + typeName + ")";
1056        try
1057        {
1058          realCallableStatement.registerOutParameter(parameterName, sqlType, typeName);
1059        }
1060        catch (SQLException s)
1061        {
1062          reportException(methodCall, s);
1063          throw s;
1064        }
1065        reportReturn(methodCall);
1066      }
1067
1068      public void setNull(String parameterName, int sqlType, String typeName) throws SQLException
1069      {
1070        String methodCall = "setNull(" + parameterName + ", " + sqlType + ", " + typeName + ")";
1071        try
1072        {
1073          realCallableStatement.setNull(parameterName, sqlType, typeName);
1074        }
1075        catch (SQLException s)
1076        {
1077          reportException(methodCall, s);
1078          throw s;
1079        }
1080        reportReturn(methodCall);
1081      }
1082
1083      public void setString(String parameterName, String x) throws SQLException
1084      {
1085        String methodCall = "setString(" + parameterName + ", " + x + ")";
1086
1087        try
1088        {
1089          realCallableStatement.setString(parameterName, x);
1090        }
1091        catch (SQLException s)
1092        {
1093          reportException(methodCall, s);
1094          throw s;
1095        }
1096        reportReturn(methodCall);
1097      }
1098
1099      public BigDecimal getBigDecimal(String parameterName) throws SQLException
1100      {
1101        String methodCall = "getBigDecimal(" + parameterName + ")";
1102        try
1103        {
1104          return (BigDecimal) reportReturn(methodCall, realCallableStatement.getBigDecimal(parameterName));
1105        }
1106        catch (SQLException s)
1107        {
1108          reportException(methodCall, s);
1109          throw s;
1110        }
1111      }
1112
1113      public void setBigDecimal(String parameterName, BigDecimal x) throws SQLException
1114      {
1115        String methodCall = "setBigDecimal(" + parameterName + ", " + x + ")";
1116        try
1117        {
1118          realCallableStatement.setBigDecimal(parameterName, x);
1119        }
1120        catch (SQLException s)
1121        {
1122          reportException(methodCall, s);
1123          throw s;
1124        }
1125        reportReturn(methodCall);
1126      }
1127
1128      public URL getURL(String parameterName) throws SQLException
1129      {
1130        String methodCall = "getURL(" + parameterName + ")";
1131        try
1132        {
1133          return (URL) reportReturn(methodCall, realCallableStatement.getURL(parameterName));
1134        }
1135        catch (SQLException s)
1136        {
1137          reportException(methodCall, s);
1138          throw s;
1139        }
1140      }
1141
1142      public void setURL(String parameterName, URL val) throws SQLException
1143      {
1144        String methodCall = "setURL(" + parameterName + ", " + val + ")";
1145        try
1146        {
1147          realCallableStatement.setURL(parameterName, val);
1148        }
1149        catch (SQLException s)
1150        {
1151          reportException(methodCall, s);
1152          throw s;
1153        }
1154        reportReturn(methodCall);
1155      }
1156
1157      public Array getArray(String parameterName) throws SQLException
1158      {
1159        String methodCall = "getURL(" + parameterName + ")";
1160        try
1161        {
1162          return (Array) reportReturn(methodCall, realCallableStatement.getArray(parameterName));
1163        }
1164        catch (SQLException s)
1165        {
1166          reportException(methodCall, s);
1167          throw s;
1168        }
1169      }
1170
1171      public Blob getBlob(String parameterName) throws SQLException
1172      {
1173        String methodCall = "getBlob(" + parameterName + ")";
1174        try
1175        {
1176          return (Blob) reportReturn(methodCall, realCallableStatement.getBlob(parameterName));
1177        }
1178        catch (SQLException s)
1179        {
1180          reportException(methodCall, s);
1181          throw s;
1182        }
1183      }
1184
1185      public Clob getClob(String parameterName) throws SQLException
1186      {
1187        String methodCall = "getClob(" + parameterName + ")";
1188        try
1189        {
1190          return (Clob) reportReturn(methodCall, realCallableStatement.getClob(parameterName));
1191        }
1192        catch (SQLException s)
1193        {
1194          reportException(methodCall, s);
1195          throw s;
1196        }
1197      }
1198
1199      public Date getDate(String parameterName) throws SQLException
1200      {
1201        String methodCall = "getDate(" + parameterName + ")";
1202        try
1203        {
1204          return (Date) reportReturn(methodCall, realCallableStatement.getDate(parameterName));
1205        }
1206        catch (SQLException s)
1207        {
1208          reportException(methodCall, s);
1209          throw s;
1210        }
1211      }
1212
1213      public void setDate(String parameterName, Date x) throws SQLException
1214      {
1215        String methodCall = "setDate(" + parameterName + ", " + x + ")";
1216        try
1217        {
1218          realCallableStatement.setDate(parameterName, x);
1219        }
1220        catch (SQLException s)
1221        {
1222          reportException(methodCall, s);
1223          throw s;
1224        }
1225        reportReturn(methodCall);
1226      }
1227    }


text:
from tornado.httpclient import AsyncHTTPClient
from tornado.concurrent import Future
from tornado import gen

from util import stop_loop, start_loop

@gen.coroutine
def fetch_many_coroutine(urls):
    http_client = AsyncHTTPClient()
    response1, response2 = yield [http_client.fetch(urls[0]), http_client.fetch(urls[1])]
    raise gen.Return([response1, response2])

@gen.coroutine
def fetch_coroutine(urls):
    http_client = AsyncHTTPClient()
    responses = yield [http_client.fetch(url) for url in urls]
    raise gen.Return(responses)

def fetch_coroutine_callback(future):
    print('coroutine callback')
    for result in future.result():
        print(
            result.request.url,
            result.code, result.reason, result.request_time)
    stop_loop(2)

if __name__ == '__main__':
    """
    使用gen.coroutine 可以很方便让包含 yield 的函数返回future
    """
    result_future = fetch_coroutine(['https://baidu.com', 'https://baidu.com'])
    result_future.add_done_callback(fetch_coroutine_callback)
    result_future = fetch_many_coroutine(['https://baidu.com', 'https://baidu.com'])
    result_future.add_done_callback(fetch_coroutine_callback)
    start_loop()


text:
//
// C++ Interface: textstyle
//
// Description:
//
//
// Author: Lorenzo Bettini <http://www.lorenzobettini.it>, (C) 2005
//
// Copyright: See COPYING file that comes with this distribution
//
//

#ifndef _TEXTSTYLE_H_
#define _TEXTSTYLE_H_

#include <string>
#include <vector>
#include <map>
#include <boost/regex.hpp>

#define STYLE_VAR_TEXT "$style" // the text of the style variable
#define TEXT_VAR_TEXT "$text" // the text of the text variable
#define STYLE_VAR "\\" STYLE_VAR_TEXT // the name of the style variable as regexp
#define TEXT_VAR "\\" TEXT_VAR_TEXT // the name of the text variable as regexp

typedef std::map<std::string, std::string> SubstitutionMapping;

class TextStyle
{
private:
  typedef std::vector<std::string> StringVector;
  typedef std::vector<int> IndexVector;
  typedef std::map<std::string, IndexVector> SubstitutionIndexes;
  boost::regex var_exp; // the regular expression to find variable occurrences

    std::string repr;
    StringVector parts; // contains all the string parts of this TextStyle.
    SubstitutionIndexes substitutions;
    // contains the indexes of parts where to substitute $vars.
    bool invalid;
    // whether to rebuild the vectors

    void build_vectors();

public:
    TextStyle(const std::string &s = "", const char **vars = 0);
    ~TextStyle();

    /**
     * substitutes $text with text and $style with style
     */
    std::string output(const std::string &text, const std::string &style = "");
    /**
     * for each i substitutes: subst_map[i].first occurrence with subst_map[i].second
     */
    std::string output(SubstitutionMapping &subst_map);
    /**
     * substitutes $style with style
     */
    std::string subst_style(const std::string &style = "");

    const std::string &toString() const { return repr; }

    /**
     * substitutes $text with the string representation of inner
     * e.g., if this is $text and inner is $text
     * this will return $text
     */
    TextStyle compose(const TextStyle &inner);

    /**
     * as compose, but acts on this instance
     */
    void update(const TextStyle &inner);
    void update(const std::string &inner);
    void update(const std::string &text, const std::string &style);

    /**
     * Whether this TextStyle contains the $style variable
     */
    bool containsStyleVar() const;

    /**
     * Whether it is only $style or $text
     */
    bool empty() const;
};

#endif /*_TEXTSTYLE_H_*/


text:
"""
Module that provides a class that filters profanities

"""

__author__ = "leoluk"
__modifiedby__ = "iorch"
__version__ = '0.0.2'

import random
from bs4 import BeautifulSoup
import re
import unicodedata
import os
import sys
sys.path.append(os.path.dirname(__file__))
import malas_palabras

my_list = malas_palabras.__una_palabra__

class ProfanitiesFilter(object):
    def __init__(self, filterlist, ignore_case=True, replacements="$@%-?!",
                 complete=True, inside_words=False):
        """
        Inits the profanity filter.

        filterlist -- a list of regular expressions that
        matches words that are forbidden
        ignore_case -- ignore capitalization
        replacements -- string with characters to replace the forbidden word
        complete -- completely remove the word or keep the first and last char?
        inside_words -- search inside other words?

        """

        self.badwords = filterlist
        self.ignore_case = ignore_case
        self.replacements = replacements
        self.complete = complete
        self.inside_words = inside_words

    def remove_accents(self, input_str):
        nkfd_form = unicodedata.normalize('NFKD', input_str)
        return u"".join([c for c in nkfd_form if not unicodedata.combining(c)])

    def review_words(self, raw_text):
        review_text = BeautifulSoup(raw_text).get_text()
        letters_only = re.sub("^(\w+)[0-9]@", " ", review_text)
        callback = lambda pat: pat.group(0).decode('utf-8').lower()
        iac = re.sub(u"Ă", u"í", letters_only)
        ene = re.sub(u"Ñ", u"ñ", iac)
        no_accents = self.remove_accents(ene)
        meaningful_words = re.sub("(\w+)", callback, no_accents).split()
        return u" ".join(meaningful_words)

    def profanity_score(self, my_string0):
        # The score is the number of bad words in the string. The bad words are
        # defined in the malas_palabras.py file.
        compiled_bw = {}
        isabadword = {}
        to_test = re.compile(".*-.*")
        my_string = self.review_words(my_string0)
        for j in my_string.split(' '):
            isabadword[j] = 0
            for i in self.badwords:
                i = self.remove_accents(i)
                compiled_bw[i] = re.compile(i)
                if isabadword[j] == 0:
                    __replacement__ = compiled_bw[i].sub(self.__replacer,j)
                    test = to_test.match(__replacement__)
                    isabadword[j] = 0 if test is None else 1
                else:
                    next

        print isabadword
        return reduce(lambda x, y: x+y, isabadword.values(), 0)

    def _make_clean_word(self, length):
        """
        Generates a random replacement string of a given length
        using the chars in self.replacements.

        """
        return ''.join([random.choice(self.replacements) for i in
                        range(length)])

    def __replacer(self, match):
        value = match.group()
        if self.complete:
            return self._make_clean_word(len(value))
        else:
            return value[0]+self._make_clean_word(len(value)-2)+value[-1]

    def clean(self, text):
        """Cleans a string from profanity."""

        regexp_insidewords = {
            True: r'(%s)',
            False: r'\b(%s)\b',
            }

        regexp = (regexp_insidewords[self.inside_words] %
                  '|'.join(self.badwords))

        r = re.compile(regexp, re.IGNORECASE if self.ignore_case else 0)

        return r.sub(self.__replacer, text)

if __name__ == '__main__':

    f = ProfanitiesFilter(my_list, replacements="-")
    example = u"I am doing pendejadas chingonas encabronadas porque ese maldito coño de funcionario me hizo emputar, " \
              u"y es un pinche maricón mirón de mierda."

    print f.clean(example)
    # Returns "I am doing --- ------ badlike things."

    f.inside_words = True
    print f.clean(example)
    # Returns "I am doing --- ------ ---like things."

    f.complete = False
    print f.clean(example)
    # Returns "I am doing b-d u----d b-dlike things."`
    print f.profanity_score(example)


text:
package com.packtpub.java7.concurrency.chapter1.recipe7.task;

import java.util.Date;
import java.util.Deque;

import com.packtpub.java7.concurrency.chapter1.recipe7.event.Event;

/**
 * Class that review the Event data structure and delete
 * the events older than ten seconds
 *
 */
public class CleanerTask extends Thread {

	/**
	 * Data structure that stores events
	 */
	private Deque<Event> deque;

	/**
	 * Constructor of the class
	 * @param deque data structure that stores events
	 */
	public CleanerTask(Deque<Event> deque) {
		this.deque = deque;
		// Establish that this is a Daemon Thread
		setDaemon(true);
	}

	/**
	 * Main method of the class
	 */
	@Override
	public void run() {
		while (true) {
			Date date = new Date();
			clean(date);
		}
	}

	/**
	 * Method that review the Events data structure and delete
	 * the events older than ten seconds
	 * @param date
	 */
	private void clean(Date date) {
		long difference;
		boolean delete;

		if (deque.size()==0) {
			return;
		}

		delete=false;
		do {
			Event e = deque.getLast();
			difference = date.getTime() - e.getDate().getTime();
			if (difference > 10000) {
				System.out.printf("Cleaner: %s\n",e.getEvent());
				deque.removeLast();
				delete=true;
			}
		} while (difference > 10000);
		if (delete){
			System.out.printf("Cleaner: Size of the queue: %d\n",deque.size());
		}
	}
}


text:
package app;

import com.jfoenix.controls.*;
import de.jensd.fx.glyphs.fontawesome.FontAwesomeIcon;
import javafx.collections.ObservableList;
import javafx.fxml.FXML;
import javafx.geometry.Insets;
import javafx.scene.Parent;
import javafx.scene.control.Label;
import javafx.scene.control.SelectionMode;
import javafx.scene.control.Tab;
import javafx.scene.control.TableView;
import javafx.scene.layout.AnchorPane;
import javafx.scene.layout.HBox;
import javafx.scene.layout.Region;
import javafx.scene.layout.StackPane;
import javafx.scene.paint.Paint;
import javafx.scene.text.Font;
import javafx.util.Pair;

import java.sql.Connection;
import java.sql.ResultSet;
import java.sql.SQLException;
import java.util.*;

public class MainController {

    @FXML
    public StackPane root;

    @FXML
    public JFXTabPane tabs;
    @FXML
    public JFXSnackbar messageQueue;

    private Connection conn;

    @FXML
    public void initialize(){
        try {
            //for testing, if conn is null create a new one
            Connection connection = conn == null ? DBConnection.getConnection("homewrk", "root", "") : conn;

            ResultSet tableData = connection.createStatement().executeQuery("show tables;");
            System.out.printf("%s,%s",connection, tableData);
            Map<String, List> tableToTableView = new HashMap<>();
            while(tableData.next()){
                String tableName = tableData.getString(1);
                Tab nTab = new Tab(tableName);

                AnchorPane nRoot = new AnchorPane();
                nRoot.setMinHeight(0);
                nRoot.setMinWidth(0);

                TableView tbl = new TableView();
                tbl.setEditable(true);
                AnchorPane.setBottomAnchor(tbl, 50.0);
                AnchorPane.setTopAnchor(tbl, 50.0);
                AnchorPane.setRightAnchor(tbl, 50.0);
                AnchorPane.setLeftAnchor(tbl, 50.0);

                HBox btnRoot = new HBox();
                btnRoot.setSpacing(20);
                AnchorPane.setRightAnchor(btnRoot, 50.0);
                AnchorPane.setTopAnchor(btnRoot, 5.0);

                //Add
                JFXRippler btnR1 = new JFXRippler();
                btnR1.setPosition(JFXRippler.RipplerPos.BACK);
                btnR1.getStyleClass().add("icons-rippler");

                HBox icnRoot1 = new HBox();
                icnRoot1.setPadding(new Insets(10));

                FontAwesomeIcon icn1 = new FontAwesomeIcon();
                icn1.setFill(Paint.valueOf("#4CAF50"));
                icn1.setGlyphName("PLUS");
                icn1.setSize("1.5em");
                icn1.getStyleClass().add("icon");

                Label lbl1 = new Label("   Add");
                lbl1.setStyle("-fx-font-weight: bold; -fx-text-fill: #4CAF50;");

                //Remove
                JFXRippler btnR2 = new JFXRippler();
                btnR2.setPosition(JFXRippler.RipplerPos.BACK);
                btnR2.getStyleClass().add("icons-rippler");

                HBox icnRoot2 = new HBox();
                icnRoot2.setPadding(new Insets(10));

                FontAwesomeIcon icn2 = new FontAwesomeIcon();
                icn2.setFill(Paint.valueOf("#F44336"));
                icn2.setGlyphName("MINUS");
                icn2.setSize("1.5em");
                icn2.getStyleClass().add("icon");

                Label lbl2 = new Label("   Remove");
                lbl2.setStyle("-fx-font-weight: bold; -fx-text-fill: #F44336;");

                icnRoot1.getChildren().addAll(icn1, lbl1);
                btnR1.getChildren().add(icnRoot1);
                icnRoot2.getChildren().addAll(icn2, lbl2);
                btnR2.getChildren().add(icnRoot2);

                btnRoot.getChildren().addAll(btnR1, btnR2);
                nRoot.getChildren().addAll(tbl, btnRoot);
                nTab.setContent(nRoot);
                tabs.getTabs().add(nTab);

                tableToTableView.put(tableName, Arrays.asList(tbl, btnR1, btnR2));
            }

            Map<String, Table> tables = new HashMap<>();

            tableToTableView.forEach((tableName, dat) -> {
                Table table = new Table(tableName, connection);
                tables.put(tableName, table);
                table.registerMessageImpl(this::sendMessage);
                table.projectOntoTable((TableView) dat.get(0));
                ((TableView) dat.get(0)).getSelectionModel().setSelectionMode(SelectionMode.MULTIPLE);

                //add
                ((JFXRippler)dat.get(1)).setOnMouseClicked(d -> {
                    Pair<Region, AddEntityController> addEntityContent = FXMLUtil.load("AddEntity.fxml");
                    addEntityContent.getValue().format(table.getMetaData());
                    JFXDialog dialog = new JFXDialog(root, addEntityContent.getKey(), JFXDialog.DialogTransition.TOP, true);
                    addEntityContent.getValue().setOnSubmit(newRow -> {
                        try {
                            System.out.println(newRow);
                            table.add(newRow);
                            dialog.close();
                            sendMessage("Add of " + tableName + " successful!");
                        }
                        catch (SQLException se){
                            sendMessage(se.getMessage());
                        }
                    });
                    dialog.show();
                });

                //rmv
                ((JFXRippler)dat.get(2)).setOnMouseClicked(d -> {
                    ObservableList selectedRows = ((TableView)dat.get(0)).getSelectionModel().getSelectedItems();
                    for(Object row: selectedRows){
                        try {
                            table.delete((ObservableList)row);
                            sendMessage("Successful delete of " + tableName);

                        } catch (SQLException e) {
                            e.printStackTrace();
                            sendMessage(e.getMessage());
                        }
                    }
                });
            });
            messageQueue.registerSnackbarContainer(root);

        } catch (SQLException e) {
            e.printStackTrace();
        } catch (ClassNotFoundException e) {
            e.printStackTrace();
        }
    }

    public void sendMessage(String message){
        messageQueue.fireEvent(new JFXSnackbar.SnackbarEvent(message));
    }

    public void setConnection(Connection conn) {
        this.conn = conn;
    }
}


text:
package benchmarks.regression;

import com.google.caliper.Param;
import com.google.caliper.Runner;
import com.google.caliper.SimpleBenchmark;

public class IntConstantDivisionBenchmark extends SimpleBenchmark {
    public int timeDivideIntByConstant2(int reps) {
        int result = 1;
        for (int i = 0; i < reps; ++i) {
            result /= 2;
        }
        return result;
    }
    public int timeDivideIntByConstant8(int reps) {
        int result = 1;
        for (int i = 0; i < reps; ++i) {
            result /= 8;
        }
        return result;
    }
    public int timeDivideIntByConstant10(int reps) {
        int result = 1;
        for (int i = 0; i < reps; ++i) {
            result /= 10;
        }
        return result;
    }
    public int timeDivideIntByConstant100(int reps) {
        int result = 1;
        for (int i = 0; i < reps; ++i) {
            result /= 100;
        }
        return result;
    }
    public int timeDivideIntByConstant100_HandOptimized(int reps) {
        int result = 1;
        for (int i = 0; i < reps; ++i) {
            result = (int) ((0x51eb851fL * result) >>> 37);
        }
        return result;
    }
    public int timeDivideIntByConstant2048(int reps) {
        int result = 1;
        for (int i = 0; i < reps; ++i) {
            result /= 2048;
        }
        return result;
    }
    public int timeDivideIntByVariable2(int reps) {
        int result = 1;
        int factor = 2;
        for (int i = 0; i < reps; ++i) {
            result /= factor;
        }
        return result;
    }
    public int timeDivideIntByVariable10(int reps) {
        int result = 1;
        int factor = 10;
        for (int i = 0; i < reps; ++i) {
            result /= factor;
        }
        return result;
    }
}


text:
package fd

import (
	"net"
	"unsafe"
)

func ConnFD(conn net.Conn) (fd int) {
	return int(getNetFD(conn).FieldByName("sysfd").Int())
}

func SetConnFD(conn net.Conn, fd int) {
	addr := getNetFD(conn).FieldByName("sysfd").UnsafeAddr()
	*(*int)(unsafe.Pointer(addr)) = fd
}


text:
## requirer()
ensure you have some-module installed

**Kind**: global function


text:
<Record>
<Term>Barth Syndrome</Term>
<SemanticType>Disease or Syndrome</SemanticType>
<ParentTerm>Genetic Diseases, X-Linked</ParentTerm>
<ParentTerm>Lipid Metabolism, Inborn Errors</ParentTerm>
<ParentTerm>Heart Defects, Congenital</ParentTerm>
<ParentTerm>Abnormalities, Multiple</ParentTerm>
<ClassificationPath>Congenital, Hereditary, and Neonatal Diseases and Abnormalities/Congenital Abnormalities/Cardiovascular Abnormalities/Heart Defects, Congenital/Barth Syndrome</ClassificationPath>
<ClassificationPath>Congenital, Hereditary, and Neonatal Diseases and Abnormalities/Congenital Abnormalities/Abnormalities, Multiple/Barth Syndrome</ClassificationPath>
<ClassificationPath>Congenital, Hereditary, and Neonatal Diseases and Abnormalities/Genetic Diseases, Inborn/Metabolism, Inborn Errors/Lipid Metabolism, Inborn Errors/Barth Syndrome</ClassificationPath>
<ClassificationPath>Cardiovascular Diseases/Cardiovascular Abnormalities/Heart Defects, Congenital/Barth Syndrome</ClassificationPath>
<ClassificationPath>Cardiovascular Diseases/Heart Diseases/Heart Defects, Congenital/Barth Syndrome</ClassificationPath>
<ClassificationPath>Nutritional and Metabolic Diseases/Metabolic Diseases/Metabolism, Inborn Errors/Lipid Metabolism, Inborn Errors/Barth Syndrome</ClassificationPath>
<ClassificationPath>Congenital, Hereditary, and Neonatal Diseases and Abnormalities/Genetic Diseases, Inborn/Genetic Diseases, X-Linked/Barth Syndrome</ClassificationPath>
<BroaderTerm>Genetic Diseases, Inborn</BroaderTerm>
<BroaderTerm>Barth Syndrome</BroaderTerm>
<BroaderTerm>Genetic Diseases, X-Linked</BroaderTerm>
<BroaderTerm>Nutritional and Metabolic Diseases</BroaderTerm>
<BroaderTerm>Heart Diseases</BroaderTerm>
<BroaderTerm>Cardiovascular Diseases</BroaderTerm>
<BroaderTerm>Abnormalities, Multiple</BroaderTerm>
<BroaderTerm>Metabolic Diseases</BroaderTerm>
<BroaderTerm>Congenital, Hereditary, and Neonatal Diseases and Abnormalities</BroaderTerm>
<BroaderTerm>Metabolism, Inborn Errors</BroaderTerm>
<BroaderTerm>Cardiovascular Abnormalities</BroaderTerm>
<BroaderTerm>Heart Defects, Congenital</BroaderTerm>
<BroaderTerm>Lipid Metabolism, Inborn Errors</BroaderTerm>
<BroaderTerm>Congenital Abnormalities</BroaderTerm>
<Synonym>3-methylglutaconicaciduria type 2s</Synonym>
<Synonym>Barth Syndrome</Synonym>
<Synonym>3 methylglutaconicaciduria type 2</Synonym>
<Synonym>MGA type IIs</Synonym>
<Synonym>3-methylglutaconicaciduria type II</Synonym>
<Synonym>3-methylglutaconicaciduria type 2</Synonym>
<Synonym>MGA Type 2</Synonym>
<Synonym>3-methylglutaconicaciduria type IIs</Synonym>
<Synonym>MGA type II</Synonym>
<Description>Rare congenital X-linked disorder of lipid metabolism. Barth syndrome is transmitted in an X-linked recessive pattern. The syndrome is characterized by muscular weakness, growth retardation, DILATED CARDIOMYOPATHY, variable NEUTROPENIA, 3-methylglutaconic aciduria (type II) and decreases in mitochondrial CARDIOLIPIN level. Other biochemical and morphological mitochondrial abnormalities also exist.</Description>
<Source>MeSH</Source>
</Record>