]> source.dussan.org Git - redmine.git/commitdiff
Removes the XML declaration that breaks the parser with JRuby.
authorJean-Philippe Lang <jp_lang@yahoo.fr>
Thu, 26 Apr 2012 17:57:49 +0000 (17:57 +0000)
committerJean-Philippe Lang <jp_lang@yahoo.fr>
Thu, 26 Apr 2012 17:57:49 +0000 (17:57 +0000)
git-svn-id: svn+ssh://rubyforge.org/var/svn/redmine/trunk@9534 e93f8b46-1217-0410-a6f0-8f06a7374b81

lib/redmine/scm/adapters/abstract_adapter.rb
lib/redmine/scm/adapters/mercurial_adapter.rb
lib/redmine/scm/adapters/subversion_adapter.rb

index bf512d1f12a936f083e663a99d980c99b8bf368b..e40d3deb21a4626c7fa7249b04a0161f1b68e986 100644 (file)
@@ -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
index c5525f4e9f91768bb0b6fe26711b982524cd7077..ddc81d6d8ee6863d92de5abaae37282d12891f2d 100644 (file)
@@ -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
index ad982dbc2f29de2668ee6129342adfe8875e834d..a3e642cb1be1c2fbfc0b1b21c04a618fb0865b38 100644 (file)
@@ -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|