diff --git a/app/helpers/timelog_helper.rb b/app/helpers/timelog_helper.rb
index cd2bcf6..d314a96 100644
--- a/app/helpers/timelog_helper.rb
+++ b/app/helpers/timelog_helper.rb
@@ -57,7 +57,7 @@ module TimelogHelper
   	if value.to_s.empty?
   		data.select {|row| row[criteria].blank? }
     else 
-    	data.select {|row| row[criteria] == value}
+    	data.select {|row| row[criteria].to_s == value.to_s}
     end
   end
   
diff --git a/app/models/workflow.rb b/app/models/workflow.rb
index 423c5a4..38a3454 100644
--- a/app/models/workflow.rb
+++ b/app/models/workflow.rb
@@ -32,7 +32,7 @@ class Workflow < ActiveRecord::Base
     trackers.each do |tracker|
       t = []
       roles.each do |role|
-        row = counts.detect {|c| c['role_id'] == role.id.to_s && c['tracker_id'] == tracker.id.to_s}
+        row = counts.detect {|c| c['role_id'].to_s == role.id.to_s && c['tracker_id'].to_s == tracker.id.to_s}
         t << [role, (row.nil? ? 0 : row['c'].to_i)]
       end
       result << [tracker, t]
diff --git a/config/initializers/jdbc.rb b/config/initializers/jdbc.rb
new file mode 100644
index 0000000..313ee8e
--- /dev/null
+++ b/config/initializers/jdbc.rb
@@ -0,0 +1,7 @@
+# This file was generated by the "jdbc" generator, which is provided
+# by the activerecord-jdbc-adapter gem.
+#
+# This file allows the JDBC drivers to be hooked into ActiveRecord
+# such that you don't have to change anything else in your Rails
+# application.
+require 'jdbc_adapter' if defined?(JRUBY_VERSION)
diff --git a/config/initializers/jruby_compat.rb b/config/initializers/jruby_compat.rb
new file mode 100644
index 0000000..c7fe80c
--- /dev/null
+++ b/config/initializers/jruby_compat.rb
@@ -0,0 +1,51 @@
+if defined?(JRUBY_VERSION)
+  ::JdbcSpec::PostgreSQL.class_eval do
+    def table_alias_length
+      @table_alias_length ||= (postgresql_version >= 80000 ? select_one('SHOW max_identifier_length')['max_identifier_length'].to_i : 63)
+    end
+  end
+
+  ::JdbcSpec::SQLite3::Column.class_eval do
+    def type_cast_with_correct_date_handling(value)
+      return nil if value.nil?
+      case type
+      when :datetime, :time
+        JdbcSpec::SQLite3::Column.cast_to_time(value)
+      when :date
+        JdbcSpec::SQLite3::Column.cast_to_date(value)
+      else
+        type_cast_without_correct_date_handling(value)
+      end
+    end
+    alias_method_chain :type_cast, :correct_date_handling
+
+    def type_cast_code_with_correct_date_handling(var_name)
+      case type
+      when :datetime, :time
+        "JdbcSpec::SQLite3::Column.cast_to_time(#{var_name})"
+      when :date
+        "JdbcSpec::SQLite3::Column.cast_to_date(#{var_name})"
+      else
+        type_cast_code_without_correct_date_handling(var_name)
+      end
+    end
+    alias_method_chain :type_cast_code, :correct_date_handling
+
+    def self.cast_to_date(value)
+      return value if value.is_a? Date
+      time = cast_to_time(value)
+      Date.new(time.year, time.month, time.day)
+    end
+  end
+  
+  ::JdbcSpec::SQLite3.class_eval do
+    def quote_with_date_support(value, column = nil)
+      if value.respond_to?(:to_date) && column && column.type == :date
+        quote_without_date_support(value.to_date, column)
+      else
+        quote_without_date_support(value, column)
+      end
+    end
+    alias_method_chain :quote, :date_support
+  end
+end
diff --git a/lib/redcloth3.rb b/lib/redcloth3.rb
index fa48b2d..ffc0e11 100644
--- a/lib/redcloth3.rb
+++ b/lib/redcloth3.rb
@@ -388,7 +388,7 @@ class RedCloth3 < String
                 (?!\-\-)
                 #{rcq}
                 (#{QTAGS_JOIN}|)      # oqa
-                (?=[[:punct:]]|\s|\)|$)/x
+                (?=[[:punct:]]|<|\s|\)|$)/x
             else
                 /(#{rcq})
                 (#{C})
diff --git a/lib/redmine/scm/adapters/abstract_adapter.rb b/lib/redmine/scm/adapters/abstract_adapter.rb
index a3ca61e..8c3006b 100644
--- a/lib/redmine/scm/adapters/abstract_adapter.rb
+++ b/lib/redmine/scm/adapters/abstract_adapter.rb
@@ -190,7 +190,10 @@ module Redmine
           begin
             IO.popen(cmd, "r+") do |io|
               io.close_write
-              block.call(io) if block_given?
+              if block_given?
+                block.call(io)
+                while(io.gets); end
+              end
             end
           rescue Errno::ENOENT => e
             msg = strip_credential(e.message)
diff --git a/lib/redmine/themes.rb b/lib/redmine/themes.rb
index d0c90e3..57cdecb 100644
--- a/lib/redmine/themes.rb
+++ b/lib/redmine/themes.rb
@@ -54,7 +54,7 @@ module Redmine
     private
         
     def self.scan_themes
-      dirs = Dir.glob("#{RAILS_ROOT}/public/themes/*").select do |f|
+      dirs = Dir.glob("#{Rails.public_path}/themes/*").select do |f|
         # A theme should at least override application.css
         File.directory?(f) && File.exist?("#{f}/stylesheets/application.css")
       end
diff --git a/lib/tasks/jdbc.rake b/lib/tasks/jdbc.rake
new file mode 100644
index 0000000..289b3d9
--- /dev/null
+++ b/lib/tasks/jdbc.rake
@@ -0,0 +1,8 @@
+# This file was generated by the "jdbc" generator, which is provided
+# by the activerecord-jdbc-adapter gem.
+#
+# This file allows you to use Rails' various db:* tasks with JDBC.
+if defined?(JRUBY_VERSION)
+  require 'jdbc_adapter'
+  require 'jdbc_adapter/rake_tasks'
+end
diff --git a/test/functional/timelog_controller_test.rb b/test/functional/timelog_controller_test.rb
index 8805273..8a60aed 100644
--- a/test/functional/timelog_controller_test.rb
+++ b/test/functional/timelog_controller_test.rb
@@ -89,7 +89,7 @@ class TimelogControllerTest < ActionController::TestCase
     t = TimeEntry.find_by_comments('Some work on TimelogControllerTest')
     assert_not_nil t
     assert_equal 11, t.activity_id
-    assert_equal 7.3, t.hours
+    assert_equal '7.3', '%.1f' % t.hours
     assert_equal 3, t.user_id
     assert_equal i, t.issue
     assert_equal i.project, t.project
diff --git a/test/test_helper.rb b/test/test_helper.rb
index 48e2c99..2bfb960 100644
--- a/test/test_helper.rb
+++ b/test/test_helper.rb
@@ -84,6 +84,12 @@ class ActiveSupport::TestCase
     return nil
   end
 
+  def self.find_executable(name)
+    ENV['PATH'].split(File::PATH_SEPARATOR).detect do |p| 
+      File.executable?(File.join(p, name))
+    end
+  end
+
   # Shoulda macros
   def self.should_render_404
     should_respond_with :not_found
diff --git a/test/unit/changeset_test.rb b/test/unit/changeset_test.rb
index 8010383..57889b5 100644
--- a/test/unit/changeset_test.rb
+++ b/test/unit/changeset_test.rb
@@ -129,6 +129,12 @@ class ChangesetTest < ActiveSupport::TestCase
   end
   
   def test_invalid_utf8_sequences_in_comments_should_be_stripped
+    if defined?(JRUBY_VERSION) and # only in JRuby
+           (!Gem::Version.correct?('1.5.0.RC1') or # following version check works only in Rubygems >= 1.3.6 - shipped with JRuby > 1.4.x
+            Gem::Version.new(JRUBY_VERSION) < Gem::Version.new('1.5.0.RC1'))
+       puts "JRuby's Iconv //IGNORE support is insufficient before 1.5.0.RC1"
+       return
+    end
     c = Changeset.new
     c.comments = File.read("#{RAILS_ROOT}/test/fixtures/encoding/iso-8859-1.txt")
     assert_equal "Texte encod en ISO-8859-1.", c.comments
diff --git a/test/unit/lib/redmine/scm/adapters/subversion_adapter_test.rb b/test/unit/lib/redmine/scm/adapters/subversion_adapter_test.rb
index e44d12f..b4f1d11 100644
--- a/test/unit/lib/redmine/scm/adapters/subversion_adapter_test.rb
+++ b/test/unit/lib/redmine/scm/adapters/subversion_adapter_test.rb
@@ -15,13 +15,10 @@
 # along with this program; if not, write to the Free Software
 # Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301, USA.
 
-require 'mkmf'
-
 require File.dirname(__FILE__) + '/../../../../../test_helper'
 
 class SubversionAdapterTest < ActiveSupport::TestCase
-  
-  if find_executable0('svn')
+  if find_executable('svn')
     def test_client_version
       v = Redmine::Scm::Adapters::SubversionAdapter.client_version
       assert v.is_a?(Array)
diff --git a/vendor/plugins/engines/lib/engines.rb b/vendor/plugins/engines/lib/engines.rb
index d601710..532e072 100644
--- a/vendor/plugins/engines/lib/engines.rb
+++ b/vendor/plugins/engines/lib/engines.rb
@@ -48,7 +48,7 @@ module Engines
   # The name of the public directory to mirror public engine assets into.
   # Defaults to <tt>RAILS_ROOT/public/plugin_assets</tt>.
   mattr_accessor :public_directory
-  self.public_directory = File.join(RAILS_ROOT, 'public', 'plugin_assets')
+  self.public_directory = File.join(Rails.public_path, 'plugin_assets')
 
   # The table in which to store plugin schema information. Defaults to
   # "plugin_schema_info".
