Skip to content
Permalink

Comparing changes

Choose two branches to see what’s changed or to start a new pull request. If you need to, you can also or learn more about diff comparisons.

Open a pull request

Create a new pull request by comparing changes across two branches. If you need to, you can also . Learn more about diff comparisons here.
base repository: jruby/jruby
Failed to load repositories. Confirm that selected base ref is valid, then try again.
Loading
base: b2919d66e447^
Choose a base ref
...
head repository: jruby/jruby
Failed to load repositories. Confirm that selected head ref is valid, then try again.
Loading
compare: 93bb20672b3f
Choose a head ref
Loading
Showing 768 changed files with 14,414 additions and 9,921 deletions.
21 changes: 14 additions & 7 deletions .travis.yml
Original file line number Diff line number Diff line change
@@ -6,11 +6,14 @@ sudo: false
# directories:
# - $HOME/.m2

before_script:
before_install:
- export MAVEN_SKIP_RC=true
- export MAVEN_OPTS="-Xmx512m -XX:MaxPermSize=256m"
- mvn -Xmx32M -v | grep 1.7.0; if [ $? = 0 ]; then export MAVEN_OPTS="-XX:MaxPermSize=240M"; else export MAVEN_OPTS="-XX:MaxMetaspaceSize=240M -XX:CompressedClassSpaceSize=240M"; fi
- export MAVEN_OPTS="-Xmx512M $MAVEN_OPTS"

before_script:
- unset GEM_PATH GEM_HOME IRBRC JRUBY_OPTS
- "export PATH=`pwd`/bin:$PATH"
- export PATH="`pwd`/bin:$PATH"
- echo $HOME

jdk:
@@ -22,15 +25,16 @@ os:

env:
global:
- JAVA_OPTS="-XX:+TieredCompilation -XX:TieredStopAtLevel=1 -Xmx512M"
- JAVA_OPTS="-XX:+TieredCompilation -XX:TieredStopAtLevel=1 -Xmn48M -Xmx512M"
- MALLOC_ARENA_MAX=2
matrix:
- JT='test specs :command_line'
- JT='test specs :language'
- JT='test specs :core'
- JT='test specs :library'
- JT='test specs :truffle'
- JT='test integration fast'
- JT='test integration long' JAVA_OPTS="$JAVA_OPTS -Xmx512m"
- JT='test integration long' JAVA_OPTS="$JAVA_OPTS -Xmx512m" HAS_REDIS=true

matrix:
include:
@@ -43,9 +47,9 @@ matrix:
- env: JT=check_ambiguous_arguments
jdk: oraclejdk8
- env: JT='test mri'
- env: PHASE='-Pmain'
- env: PHASE='-Pmain --projects !truffle'
jdk: oraclejdk8
- env: PHASE='-Pj2ee'
- env: PHASE='-Pj2ee --projects !truffle'
jdk: oraclejdk7
# NOTE: build seems to never start (waited for any to finish for more than a day) - probably a travis-ci bug
#- env: PHASE='-Pmain'
@@ -83,3 +87,6 @@ notifications:
# we are on a branch
on_success: always
on_failure: never

services:
- redis-server
57 changes: 30 additions & 27 deletions core/src/main/java/org/jruby/NativeException.java
Original file line number Diff line number Diff line change
@@ -52,7 +52,7 @@ public NativeException(Ruby runtime, RubyClass rubyClass, Throwable cause) {
private NativeException(Ruby runtime, RubyClass rubyClass) {
super(runtime, rubyClass);
this.cause = new Throwable();
this.message = runtime.newString();
this.message = RubyString.newEmptyString(runtime);
}

private static ObjectAllocator NATIVE_EXCEPTION_ALLOCATOR = new ObjectAllocator() {
@@ -72,32 +72,43 @@ public static RubyClass createClass(Ruby runtime, RubyClass baseClass) {
}

@JRubyMethod
public final IRubyObject cause() {
return Java.getInstance(getRuntime(), getCause());
}

@Deprecated
public IRubyObject cause(Block unusedBlock) {
return Java.getInstance(getRuntime(), cause);
return cause();
}

public IRubyObject backtrace() {
@Override
public final IRubyObject backtrace() {
IRubyObject rubyTrace = super.backtrace();
if (rubyTrace.isNil()) {
return rubyTrace;
}
if ( rubyTrace.isNil() ) return rubyTrace;

final Ruby runtime = getRuntime();
RubyArray array = (RubyArray) rubyTrace.dup();
StackTraceElement[] stackTrace = cause.getStackTrace();
for (int i = stackTrace.length - 1; i >= 0; i--) {
StackTraceElement element = stackTrace[i];
final RubyArray rTrace = (RubyArray) rubyTrace;
StackTraceElement[] jTrace = cause.getStackTrace();
final IRubyObject[] trace = new IRubyObject[jTrace.length + rTrace.size()];
final StringBuilder line = new StringBuilder(32);
for ( int i = 0; i < jTrace.length; i++ ) {
StackTraceElement element = jTrace[i];
final String className = element.getClassName();
final String line;
line.setLength(0);
if (element.getFileName() == null) {
line = className + ':' + element.getLineNumber() + ":in `" + element.getMethodName() + '\'';
line.append(className).append(':').append(element.getLineNumber()).append(":in `").append(element.getMethodName()).append('\'');
} else {
final int index = className.lastIndexOf('.');
final String packageName = index == -1 ? "" : className.substring(0, index) + '/';
line = packageName.replace('.', '/') + element.getFileName() + ':' + element.getLineNumber() + ":in `" + element.getMethodName() + '\'';
if ( index > - 1 ) {
line.append(className.substring(0, index).replace('.', '/'));
line.append('/');
}
line.append(element.getFileName()).append(':').append(element.getLineNumber()).append(":in `").append(element.getMethodName()).append('\'');
}
array.unshift(runtime.newString(line));
trace[i] = RubyString.newString(runtime, line.toString());
}
return array;
System.arraycopy(rTrace.toJavaArrayMaybeUnsafe(), 0, trace, jTrace.length, rTrace.size());
return RubyArray.newArrayNoCopy(runtime, trace);
}

@Deprecated // not used
@@ -139,14 +150,6 @@ public void trimStackTrace(Member target) {
}
}

public void printBacktrace(PrintStream errorStream) {
super.printBacktrace(errorStream);
if (getRuntime().isDebug()) {
errorStream.println("Complete Java stackTrace");
cause.printStackTrace(errorStream);
}
}

public final Throwable getCause() {
return cause;
}
@@ -155,9 +158,9 @@ private static String searchStackMessage(Throwable cause) {
String message;
do {
message = cause.getMessage();
if ( message != null ) return message;
cause = cause.getCause();
} while (message == null && cause != null);

return message;
} while ( cause != null );
return null;
}
}
Loading