Permalink
Browse files

Temporary fix for JRUBY-4749: require 'rbconfig' fails on GAE because…

… of NullPointerException
  • Loading branch information...
1 parent bdd6889 commit 9e1d154c224aa6adaa9fe26a2f61eca0d7812fd4 @headius headius committed Apr 26, 2010
Showing with 9 additions and 2 deletions.
  1. +9 −2 src/org/jruby/libraries/RbConfigLibrary.java
@@ -90,6 +90,13 @@ public static String getOSName() {
return theOSName == null ? OSName : theOSName;
}
+
+ public static String getArchitecture() {
+ String architecture = Platform.ARCH;
+ if (architecture == null) architecture = "unknown";
+
+ return architecture;
+ }
/**
* Just enough configuration settings (most don't make sense in Java) to run the rubytests
* unit tests. The tests use <code>bindir</code>, <code>RUBY_INSTALL_NAME</code> and
@@ -140,11 +147,11 @@ public void load(Ruby runtime, boolean wrap) {
setConfig(configHash, "host_os", getOSName());
setConfig(configHash, "host_vendor", System.getProperty("java.vendor"));
- setConfig(configHash, "host_cpu", Platform.ARCH);
+ setConfig(configHash, "host_cpu", getArchitecture());
setConfig(configHash, "target_os", getOSName());
- setConfig(configHash, "target_cpu", Platform.ARCH);
+ setConfig(configHash, "target_cpu", getArchitecture());
String jrubyJarFile = "jruby.jar";
URL jrubyPropertiesUrl = Ruby.getClassLoader().getResource(Constants.JRUBY_PROPERTIES);

0 comments on commit 9e1d154

Please sign in to comment.