Better UnknownHostException in RubySocket class -----------------------------------------------
Key: JRUBY-3534 URL: http://jira.codehaus.org/browse/JRUBY-3534 Project: JRuby Issue Type: Improvement Components: Core Classes/Modules Affects Versions: JRuby 1.2 Environment: OS: Linux engel 2.6.28-ARCH #1 SMP PREEMPT Tue Mar 17 06:42:43 UTC 2009 i686 Intel(R) Core(TM)2 CPU 6600 @ 2.40GHz GenuineIntel GNU/Linux Java: java version "1.6.0_12" \ Java(TM) SE Runtime Environment (build 1.6.0_12-b04) \ Java HotSpot(TM) Server VM (build 11.2-b01, mixed mode) MRI: ruby 1.8.7 (2008-08-11 patchlevel 72) [i686-linux] Reporter: Dharivs Hax Priority: Trivial Attachments: main.rb While handling UnkownHostException in RubySocket class, instead of giving a hard-coded message in the thrown sockerr, it would be more clear if it throws this with the UnknownHostException's message. For example, executing the attached script which creates a Webrick HTTPServer, by default on port 80, as a non-privileged user, you get this: [2009-03-26 22:53:56] INFO WEBrick 1.3.1 [2009-03-26 22:53:56] INFO ruby 1.8.6 (2009-03-16) [java] [2009-03-26 22:53:56] WARN TCPServer Error: initialize: name or service not known /home/dharivs/software/opt/jruby-1.2.0/lib/ruby/1.8/webrick/utils.rb:73:in `new': initialize: name or service not known (SocketError) from /home/dharivs/software/opt/jruby-1.2.0/lib/ruby/1.8/webrick/utils.rb:73:in `create_listeners' from /home/dharivs/software/opt/jruby-1.2.0/lib/ruby/1.8/webrick/utils.rb:70:in `each' from /home/dharivs/software/opt/jruby-1.2.0/lib/ruby/1.8/webrick/utils.rb:70:in `create_listeners' from /home/dharivs/software/opt/jruby-1.2.0/lib/ruby/1.8/webrick/server.rb:75:in `listen' from /home/dharivs/software/opt/jruby-1.2.0/lib/ruby/1.8/webrick/server.rb:63:in `initialize' from /home/dharivs/software/opt/jruby-1.2.0/lib/ruby/1.8/webrick/httpserver.rb:24:in `initialize' from src/main.rb:26 But if you execute the same under MRI, you get this, which is more clear: [2009-03-26 22:48:24] INFO WEBrick 1.3.1 [2009-03-26 22:48:24] INFO ruby 1.8.7 (2008-08-11) [i686-linux] [2009-03-26 22:48:24] WARN TCPServer Error: Permission denied - bind(2) [2009-03-26 22:48:24] WARN TCPServer Error: Permission denied - bind(2) /usr/lib/ruby/1.8/webrick/utils.rb:73:in `initialize': Permission denied - bind(2) (Errno::EACCES) from /usr/lib/ruby/1.8/webrick/utils.rb:73:in `new' from /usr/lib/ruby/1.8/webrick/utils.rb:73:in `create_listeners' from /usr/lib/ruby/1.8/webrick/utils.rb:70:in `each' from /usr/lib/ruby/1.8/webrick/utils.rb:70:in `create_listeners' from /usr/lib/ruby/1.8/webrick/server.rb:75:in `listen' from /usr/lib/ruby/1.8/webrick/server.rb:63:in `initialize' from /usr/lib/ruby/1.8/webrick/httpserver.rb:24:in `initialize' from src/main.rb:26:in `new' from src/main.rb:26 Maybe UnknownHostException doesn't give more insight about the cause of itself, but it would be worth to check this, because I find myself fighting with this simple error and I didn't find any answer about this. -- 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