FazBrowse GitHub Viewer | Trending |
URL:
| Home
Tools: [Download Repo ZIP]   [Original HTTPS Page]

Fixes to improve DRb tests by headius · Pull Request #8802 · jruby/jruby · GitHub

/ jruby Public
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension .java  (2) All 1 file type selected
Viewed files
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Unified
Split
Hide whitespace
Diff view
Unified
Split
Hide whitespace
8 changes: 6 additions & 2 deletions core/src/main/java/org/jruby/Ruby.java
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode characters
Original file line number Diff line number Diff line change
Expand Up @@ -2874,7 +2874,7 @@ public RubyModule getClassFromPath(final String path, RubyClass undefinedExcepti

if ( p < length && path.charAt(p) == ':' ) {
if ( ++p < length && path.charAt(p) != ':' ) {
throw newRaiseException(undefinedExceptionClass, str(this, "undefined class/module ", ids(this, path)));
throw classPathUndefinedException(path, undefinedExceptionClass, p);
}
pbeg = ++p;
}
Expand All @@ -2883,7 +2883,7 @@ public RubyModule getClassFromPath(final String path, RubyClass undefinedExcepti
IRubyObject cc = flexibleSearch || isJavaPackageOrJavaClassProxyType(clazz) ?
clazz.getConstant(context, str) : clazz.getConstantAt(context, str);

if (!flexibleSearch && cc == null) return null;
if (cc == null) throw classPathUndefinedException(path, undefinedExceptionClass, p);

if (!(cc instanceof RubyModule mod)) {
throw typeError(context, str(this, ids(this, path), " does not refer to class/module"));
Expand All @@ -2894,6 +2894,10 @@ public RubyModule getClassFromPath(final String path, RubyClass undefinedExcepti
return clazz;
}

private RaiseException classPathUndefinedException(String path, RubyClass undefinedExceptionClass, int p) {
return newRaiseException(undefinedExceptionClass, str(this, "undefined class/module ", ids(this, path.substring(0, p))));
}

private static boolean isJavaPackageOrJavaClassProxyType(final RubyModule type) {
return type instanceof JavaPackage || ClassUtils.isJavaClassProxyType(type);
}
Expand Down
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode characters
Original file line number Diff line number Diff line change
Expand Up @@ -148,7 +148,6 @@ public static RubyModule getModuleFromPath(ThreadContext context, String path) {
public static RubyClass getClassFromPath(ThreadContext context, String path) {
Ruby runtime = context.runtime;
final RubyModule value = runtime.getClassFromPath(path, runtime.getArgumentError(), false);
if (value == null) throw argumentError(context, "undefined class/module " + path);
if ( ! value.isClass() ) throw argumentError(context, path + " does not refer class");
return (RubyClass) value;
}
Expand Down

Back | FazBrowse Home | New Git URL