rexml pretty printing wrap() error
----------------------------------

                 Key: JRUBY-2003
                 URL: http://jira.codehaus.org/browse/JRUBY-2003
             Project: JRuby
          Issue Type: Bug
            Reporter: Hugh Winkler
            Assignee: Thomas E Enebo


Certain strings canot wrap and rexml/formatters/pretty.rb does not handle the 
case.

patch:
Index: jruby/lib/ruby/1.8/rexml/formatters/pretty.rb
===================================================================
--- jruby/lib/ruby/1.8/rexml/formatters/pretty.rb       (revision 5667)
+++ jruby/lib/ruby/1.8/rexml/formatters/pretty.rb       (working copy)
@@ -128,7 +128,11 @@
         # Recursivly wrap string at width.
         return string if string.length <= width
         place = string.rindex(' ', width) # Position in string with last ' ' 
before cutoff
-        return string[0,place] + "\n" + wrap(string[place+1..-1], width)
+        if place
+           return string[0,place] + "\n" + wrap(string[place+1..-1], width)
+        else
+          return string # cannot wrap
+        end
       end

     end

-- 
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators: 
http://jira.codehaus.org/secure/Administrators.jspa
-
For more information on JIRA, see: http://www.atlassian.com/software/jira

        

---------------------------------------------------------------------
To unsubscribe from this list please visit:

    http://xircles.codehaus.org/manage_email

Reply via email to