Skip to content

Commit

Permalink
ensure relative_require on root of uri:classloader:/
Browse files Browse the repository at this point in the history
this fixes a regression of 0137667

Sponsored by Lookout Inc.
  • Loading branch information
mkristian committed May 30, 2015
1 parent 0137667 commit 562a240
Show file tree
Hide file tree
Showing 4 changed files with 10 additions and 1 deletion.
2 changes: 1 addition & 1 deletion core/src/main/java/org/jruby/util/URLResource.java
Original file line number Diff line number Diff line change
Expand Up @@ -163,7 +163,7 @@ public static FileResource createClassloaderURI(Ruby runtime, String pathname) {
}
URL url = cl.getResource(pathname);
String[] files = listClassLoaderFiles(cl, pathname);
return new URLResource(URI_CLASSLOADER + pathname,
return new URLResource(URI_CLASSLOADER + "/" + pathname,
cl,
url == null ? null : pathname,
files);
Expand Down
Empty file added test/relative.rb
Empty file.
1 change: 1 addition & 0 deletions test/require_relative.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
require_relative 'relative'
8 changes: 8 additions & 0 deletions test/test_load.rb
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,14 @@ def test_require
assert $loaded_foo_bar
end

# GH-2972
def test_require_relative_via_uri_classloader_protocol
$CLASSPATH << './test'
assert_nothing_raised do
require 'uri:classloader:/require_relative.rb'
end
end

# JRUBY-3231
def test_load_with_empty_string_in_loadpath
begin
Expand Down

0 comments on commit 562a240

Please sign in to comment.