Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

Fix for relative require from within a gem on the classpath.

  • Loading branch information...
commit b8bd8e341e1152d78efecafb746e4e3941068c3c 1 parent cb556ed
@akiellor akiellor authored
View
BIN  samples/relative_require.jar
Binary file not shown
View
4 src/org/jruby/runtime/load/LoadService.java
@@ -1178,7 +1178,9 @@ protected LoadServiceResource tryResourceFromHome(SearchState state, String base
protected LoadServiceResource tryResourceFromJarURL(SearchState state, String baseName, SuffixType suffixType) {
// if a jar or file URL, return load service resource directly without further searching
LoadServiceResource foundResource = null;
- if (baseName.startsWith("jar:")) {
+ if (baseName.startsWith("jar:file:")) {
+ return tryResourceFromJarURL(state, baseName.replaceFirst("jar:", ""), suffixType);
+ } else if (baseName.startsWith("jar:")) {
for (String suffix : suffixType.getSuffixes()) {
String namePlusSuffix = baseName + suffix;
try {
View
8 test/test_jar_complete.rb
@@ -117,4 +117,12 @@ def test_binscripts_can_be_run_from_classpath
assert output == "Testing... 1.. 2.. 3..\n"
end
+
+ def test_relative_require_from_gem_on_classpath
+ relative_require_gem = File.expand_path(File.join(File.dirname(__FILE__), "..", "samples", "relative_require.jar"))
+
+ `java -cp \"#{COMPLETE_JAR}:#{relative_require_gem}\" org.jruby.Main -rrelative_require -e "puts RelativeRequire::VERSION"`
+
+ assert $? == 0
+ end
end
Please sign in to comment.
Something went wrong with that request. Please try again.