Title: [715] trunk/rails-integration: Update to JRuby 1.0.1
- Revision
- 715
- Author
- tantalon
- Date
- 2007-08-25 02:17:57 -0400 (Sat, 25 Aug 2007)
Log Message
Update to JRuby 1.0.1
Disable assertions during testing, to work around JRUBY-1289
Improved error messages for JRuby failing to load
Modified Paths
Diff
Modified: trunk/rails-integration/pom.xml (714 => 715)
--- trunk/rails-integration/pom.xml 2007-08-25 04:08:23 UTC (rev 714)
+++ trunk/rails-integration/pom.xml 2007-08-25 06:17:57 UTC (rev 715)
@@ -45,13 +45,8 @@
<dependency>
<groupId>org.jruby</groupId>
<artifactId>jruby-complete</artifactId>
- <version>1.0</version>
+ <version>1.0.1</version>
</dependency>
- <dependency>
- <groupId>bouncycastle</groupId>
- <artifactId>bcprov-jdk14</artifactId>
- <version>124</version>
- </dependency>
<dependency>
<groupId>commons-pool</groupId>
@@ -202,9 +197,10 @@
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-surefire-plugin</artifactId>
+ <version>2.1.3</version><!-- forcing version to avoid ignoring of -disableassertions -->
<configuration>
<forkMode>pertest</forkMode>
- <argLine>-Xmx256m</argLine>
+ <argLine>-Xmx256m -disableassertions</argLine>
</configuration>
</plugin>
<plugin>
Modified: trunk/rails-integration/src/main/java/org/jruby/webapp/RailsFactory.java (714 => 715)
--- trunk/rails-integration/src/main/java/org/jruby/webapp/RailsFactory.java 2007-08-25 04:08:23 UTC (rev 714)
+++ trunk/rails-integration/src/main/java/org/jruby/webapp/RailsFactory.java 2007-08-25 06:17:57 UTC (rev 715)
@@ -82,12 +82,11 @@
Ruby runtime;
try {
long startTime = System.currentTimeMillis();
- runtime = createRubyRuntime();
- runtime.getLoadService().init(loadPaths);
- runtime.getLoadService().require("java");
+ runtime = createRubyRuntime(loadPaths);
if (showLoadingInfo) log("JRuby init time: " + (System.currentTimeMillis() - startTime) + "ms");
} catch (RaiseException e) {
- throw new ServletException("Failed to initialize JRuby", e);
+ logRubyException("Failed to initialize JRuby", e);
+ throw new ServletException("Failed to initialize JRuby. See the logs for more details.");
}
// set the initial environment
@@ -123,7 +122,8 @@
try {
runtime.getLoadService().require("rubygems");
} catch (RaiseException e) {
- throw new ServletException("Failed to load rubygems.");
+ logRubyException("Failed to load rubygems", e);
+ throw new ServletException("Failed to load rubygems. See the logs for more details.");
}
// start Rails
@@ -133,17 +133,7 @@
require(runtime, "dispatcher");
if (showLoadingInfo) log("Rails init time: " + (System.currentTimeMillis() - startTime) + "ms");
} catch (RaiseException e) {
- // try to put some helpful information in the logs
- RubyException re = e.getException();
- String rubyMessage = (String)JavaEmbedUtils.rubyToJava(runtime, re.message, String.class);
- String message = "Failed to load Rails: " + rubyMessage + "\n";
- RubyArray backtrace = (RubyArray)re.backtrace();
- for(Iterator traceIt = backtrace.iterator(); traceIt.hasNext(); ) {
- String traceLine = (String)traceIt.next();
- message += "\t" + traceLine + "\n";
- }
- log(message);
- // this is returned to the user
+ logRubyException("Failed to load Rails", e);
throw new ServletException("Could not load Rails. See the logs for more details.");
}
@@ -158,10 +148,24 @@
return runtime;
}
- protected Ruby createRubyRuntime() {
- return Ruby.getDefaultInstance();
+ private void logRubyException(String message, RaiseException e) {
+ // try to put some helpful information in the logs
+ RubyException re = e.getException();
+ Ruby runtime = re.getRuntime();
+ String rubyMessage = (String)JavaEmbedUtils.rubyToJava(runtime, re.message, String.class);
+ message += ": " + rubyMessage + "\n";
+ RubyArray backtrace = (RubyArray)re.backtrace();
+ for(Iterator traceIt = backtrace.iterator(); traceIt.hasNext(); ) {
+ String traceLine = (String)traceIt.next();
+ message += "\t" + traceLine + "\n";
+ }
+ log(message);
}
+ protected Ruby createRubyRuntime(List loadPaths) {
+ return JavaEmbedUtils.initialize(loadPaths);
+ }
+
public boolean validateObject(Object object) {
return true;
}
Modified: trunk/rails-integration/src/test/java/org/jruby/webapp/AbstractTomcat4Test.java (714 => 715)
--- trunk/rails-integration/src/test/java/org/jruby/webapp/AbstractTomcat4Test.java 2007-08-25 04:08:23 UTC (rev 714)
+++ trunk/rails-integration/src/test/java/org/jruby/webapp/AbstractTomcat4Test.java 2007-08-25 06:17:57 UTC (rev 715)
@@ -12,7 +12,6 @@
import org.apache.catalina.logger.SystemOutLogger;
import java.net.InetAddress;
import java.io.File;
-import java.util.Random;
/**
* Test out RailsServlet under Tomcat 4.
*
_______________________________________________
Jruby-extras-devel mailing list
[email protected]
http://rubyforge.org/mailman/listinfo/jruby-extras-devel