summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJean-Philippe Lang <jp_lang@yahoo.fr>2012-04-26 17:57:49 +0000
committerJean-Philippe Lang <jp_lang@yahoo.fr>2012-04-26 17:57:49 +0000
commitcb16661d365c4ec16adde6ebfc8f2817f616b7aa (patch)
tree4ca51b8edca6f3f6c294bd7bd5f043a56a79708c
parent8d73ddf73ffc2cefbe16ca06970377e13d4bead0 (diff)
downloadredmine-cb16661d365c4ec16adde6ebfc8f2817f616b7aa.tar.gz
redmine-cb16661d365c4ec16adde6ebfc8f2817f616b7aa.zip
Removes the XML declaration that breaks the parser with JRuby.
git-svn-id: svn+ssh://rubyforge.org/var/svn/redmine/trunk@9534 e93f8b46-1217-0410-a6f0-8f06a7374b81
-rw-r--r--lib/redmine/scm/adapters/abstract_adapter.rb7
-rw-r--r--lib/redmine/scm/adapters/mercurial_adapter.rb6
-rw-r--r--lib/redmine/scm/adapters/subversion_adapter.rb8
3 files changed, 14 insertions, 7 deletions
diff --git a/lib/redmine/scm/adapters/abstract_adapter.rb b/lib/redmine/scm/adapters/abstract_adapter.rb
index bf512d1f1..e40d3deb2 100644
--- a/lib/redmine/scm/adapters/abstract_adapter.rb
+++ b/lib/redmine/scm/adapters/abstract_adapter.rb
@@ -267,6 +267,13 @@ module Redmine
nil
end
end
+
+ def parse_xml(xml)
+ if RUBY_PLATFORM == 'java'
+ xml = xml.sub(%r{<\?xml[^>]*\?>}, '')
+ end
+ ActiveSupport::XmlMini.parse(xml)
+ end
end
class Entries < Array
diff --git a/lib/redmine/scm/adapters/mercurial_adapter.rb b/lib/redmine/scm/adapters/mercurial_adapter.rb
index c5525f4e9..ddc81d6d8 100644
--- a/lib/redmine/scm/adapters/mercurial_adapter.rb
+++ b/lib/redmine/scm/adapters/mercurial_adapter.rb
@@ -135,7 +135,7 @@ module Redmine
output.force_encoding('UTF-8')
end
begin
- @summary = ActiveSupport::XmlMini.parse(output)['rhsummary']
+ @summary = parse_xml(output)['rhsummary']
rescue
end
end
@@ -151,7 +151,7 @@ module Redmine
output.force_encoding('UTF-8')
end
begin
- ActiveSupport::XmlMini.parse(output)['rhmanifest']['repository']['manifest']
+ parse_xml(output)['rhmanifest']['repository']['manifest']
rescue
end
end
@@ -199,7 +199,7 @@ module Redmine
end
begin
# Mercurial < 1.5 does not support footer template for '</log>'
- ActiveSupport::XmlMini.parse("#{output}</log>")['log']
+ parse_xml("#{output}</log>")['log']
rescue
end
end
diff --git a/lib/redmine/scm/adapters/subversion_adapter.rb b/lib/redmine/scm/adapters/subversion_adapter.rb
index ad982dbc2..a3e642cb1 100644
--- a/lib/redmine/scm/adapters/subversion_adapter.rb
+++ b/lib/redmine/scm/adapters/subversion_adapter.rb
@@ -71,7 +71,7 @@ module Redmine
output.force_encoding('UTF-8')
end
begin
- doc = ActiveSupport::XmlMini.parse(output)
+ doc = parse_xml(output)
# root_url = doc.elements["info/entry/repository/root"].text
info = Info.new({:root_url => doc['info']['entry']['repository']['root']['__content__'],
:lastrev => Revision.new({
@@ -103,7 +103,7 @@ module Redmine
output.force_encoding('UTF-8')
end
begin
- doc = ActiveSupport::XmlMini.parse(output)
+ doc = parse_xml(output)
each_xml_element(doc['lists']['list'], 'entry') do |entry|
commit = entry['commit']
commit_date = commit['date']
@@ -146,7 +146,7 @@ module Redmine
output.force_encoding('UTF-8')
end
begin
- doc = ActiveSupport::XmlMini.parse(output)
+ doc = parse_xml(output)
each_xml_element(doc['properties']['target'], 'property') do |property|
properties[ property['name'] ] = property['__content__'].to_s
end
@@ -173,7 +173,7 @@ module Redmine
output.force_encoding('UTF-8')
end
begin
- doc = ActiveSupport::XmlMini.parse(output)
+ doc = parse_xml(output)
each_xml_element(doc['log'], 'logentry') do |logentry|
paths = []
each_xml_element(logentry['paths'], 'path') do |path|