incorrect message being thrown by getIOModesIntFromString ---------------------------------------------------------
Key: JRUBY-5043 URL: http://jira.codehaus.org/browse/JRUBY-5043 Project: JRuby Issue Type: Bug Components: Core Classes/Modules Affects Versions: JRuby 1.5.1, JRuby 1.5, JRuby 1.5.2 Environment: any Reporter: Rick Ohnemus Priority: Minor The message being thrown in getIOModesIntFromString() should contain the invalid mode string instead of the integer value that is the result of converting the mode string to ModeFlags. With jruby, this "File.open('junk', 't')" will fail with "illegal access mode 0 (ArgumentError)". With MRI, the same thing will fail with "illegal access mode t (ArgumentError)". The following patch will change the message to match MRI. {noformat} diff --git a/src/org/jruby/RubyIO.java b/src/org/jruby/RubyIO.java index 24a2c90..de044ae 100644 --- a/src/org/jruby/RubyIO.java +++ b/src/org/jruby/RubyIO.java @@ -562,7 +562,7 @@ public class RubyIO extends RubyObject { modes |= ModeFlags.WRONLY | ModeFlags.TRUNC | ModeFlags.CREAT; break; default : - throw runtime.newArgumentError("illegal access mode " + modes); + throw runtime.newArgumentError("illegal access mode " + modesString); } ModifierLoop: for (int n = 1; n < length; n++) { @@ -579,7 +579,7 @@ public class RubyIO extends RubyObject { case ':': break ModifierLoop; default: - throw runtime.newArgumentError("illegal access mode " + modes); + throw runtime.newArgumentError("illegal access mode " + modesString); } } {noformat} -- 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