Skip to content

Instantly share code, notes, and snippets.

View yokolet's full-sized avatar
🏠
Doing Rails dev now

Yoko Harada yokolet

🏠
Doing Rails dev now
View GitHub Profile
package vanilla;
import java.util.Date;
import org.jruby.embed.AttributeName;
import org.jruby.embed.LocalContextScope;
import org.jruby.embed.ScriptingContainer;
public class CallMethodManyTimes {
private String jrubyhome = "/Users/yoko/DevSpace/jruby~main";
6) Error:
test_subclass_initialize_Nokogiri_XML_Attr(Nokogiri::XML::Node::TestSubclass):
ArgumentError: wrong # of arguments(3 for 2)
./test/xml/node/test_subclass.rb:49:in `test_subclass_initialize_Nokogiri_XML_Attr'
7) Error:
test_subclass_initialize_Nokogiri_XML_Comment(Nokogiri::XML::Node::TestSubclass):
ArgumentError: wrong # of arguments(3 for 2)
./test/xml/node/test_subclass.rb:49:in `test_subclass_initialize_Nokogiri_XML_Comment'
/dahlia-noko
org.jruby.embed.EvalFailedException: library `rbconfig' could not be loaded: java.lang.NullPointerException
at org.jruby.embed.internal.EmbedEvalUnitImpl.run(EmbedEvalUnitImpl.java:127)
at org.jruby.embed.ScriptingContainer.runUnit(ScriptingContainer.java:1167)
at org.jruby.embed.ScriptingContainer.runScriptlet(ScriptingContainer.java:1160)
at com.servletgarden.dahlia.DahliaNokogiriServlet.doGet(DahliaNokogiriServlet.java:36)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:693)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:806)
at org.mortbay.jetty.servlet.ServletHolder.handle(ServletHolder.java:511)
at org.mortbay.jetty.servlet.ServletHandler$CachedChain.doFilter(ServletHandler.java:1166)
diff --git a/src/org/jruby/libraries/RbConfigLibrary.java b/src/org/jruby/libraries/RbConfigLibrary.java
index 9d07002..f87d133 100644
--- a/src/org/jruby/libraries/RbConfigLibrary.java
+++ b/src/org/jruby/libraries/RbConfigLibrary.java
@@ -282,6 +282,7 @@ public class RbConfigLibrary implements Library {
private static void setConfig(RubyHash mkmfHash, String key, String value) {
Ruby runtime = mkmfHash.getRuntime();
+ value = value != null ? value : "";
mkmfHash.op_aset(runtime.getCurrentContext(), runtime.newString(key), runtime.newString(value));
713c1c7a6a7587f91fc31bd43f3de8d98b5055fd is the first bad commit
commit 713c1c7a6a7587f91fc31bd43f3de8d98b5055fd
Author: Charles Oliver Nutter <headius@headius.com>
Date: Thu Apr 29 01:25:12 2010 -0500
Possible fix for JRUBY-4764: Memory leak
With no finalize method in RubyIO or OpenFile, the newly hard-referencing fileno-to-ChannelDescriptor map never gets cleaned out, since that happens in OpenFile.cleanup. This adds a finalizer to RubyIO to call OpenFile.cleanup appropriately and appears to fix the simple reproduction I came up with.
:040000 040000 92d6489686ee2c9917227a33d7bdfb8bd8733c34 04659f886c82d2d80599bcc7010e4af66b73fc21 M src
package Canna;
import java.util.Arrays;
import java.util.List;
import org.jruby.embed.LocalContextScope;
import org.jruby.embed.ScriptingContainer;
public class TestText {
private String jrubyhome = "/Users/yoko/Projects/nokogiri/jruby";
1 # -*- coding: utf-8 -*-
2 # Modify the PATH on windows so that the external DLLs will get loaded.
3
4 require 'rbconfig'
5 ENV['PATH'] = [File.expand_path(
6 File.join(File.dirname(__FILE__), "..", "ext", "nokogiri")
7 ), ENV['PATH']].compact.join(';') if RbConfig::CONFIG['host_os'] =~ /(mswin|mingw)/i
8
9 if defined?(RUBY_ENGINE) && RUBY_ENGINE == "jruby"
10 # require 'isorelax.jar'
import javax.script.ScriptContext;
import javax.script.ScriptEngine;
import javax.script.ScriptEngineManager;
import javax.script.ScriptException;
import javax.script.SimpleScriptContext;
public class ParallelEvals {
private ParallelEvals() throws ScriptException {
System.out.println("[" + getClass().getName() + "]");
- Install Bundler
> jruby -S gem install bundle --no-ri --no-rdoc
- Create and Edit Gemfile
> cd [some directory to install gems]
> jruby -S bundle init
> vim Gemfile
# A sample Gemfile
source "http://rubygems.org"
package Canna;
import java.util.Arrays;
import java.util.List;
import org.jruby.embed.LocalContextScope;
import org.jruby.embed.PathType;
import org.jruby.embed.ScriptingContainer;
public class TestXmlSaxPushParser {