Skip to content

Instantly share code, notes, and snippets.

@Serabe
Created June 22, 2009 22:25
Show Gist options
  • Select an option

  • Save Serabe/134223 to your computer and use it in GitHub Desktop.

Select an option

Save Serabe/134223 to your computer and use it in GitHub Desktop.
@JRubyMethod
public IRubyObject native_write_to(ThreadContext context, IRubyObject io, IRubyObject encoding, IRubyObject indentString, IRubyObject options) {
StringWriter sw = new StringWriter();
try {
Transformer t = TransformerFactory.newInstance().newTransformer();
t.setOutputProperty(OutputKeys.OMIT_XML_DECLARATION, "yes");
t.transform(new DOMSource(this.node), new StreamResult(sw));
} catch (TransformerException te) {
throw context.getRuntime().newRuntimeError("couldn't transform the node back to string");
}
RuntimeHelpers.invoke(context, io, "write", context.getRuntime().newString(sw.toString()));
return io;
}
java.lang.NegativeArraySizeException
at org.objectweb.asm.Frame.a(Unknown Source)
at org.objectweb.asm.MethodWriter.visitMaxs(Unknown Source)
at org.jruby.compiler.impl.SkinnyMethodAdapter.visitMaxs(SkinnyMethodAdapter.java:877)
at org.jruby.internal.runtime.methods.InvocationMethodFactory.endMethod(InvocationMethodFactory.java:1131)
at org.jruby.internal.runtime.methods.InvocationMethodFactory.getAnnotatedMethodClass(InvocationMethodFactory.java:745)
at org.jruby.internal.runtime.methods.InvocationMethodFactory.getAnnotatedMethod(InvocationMethodFactory.java:677)
at org.jruby.RubyModule.defineAnnotatedMethod(RubyModule.java:793)
at org.jruby.RubyModule.defineAnnotatedMethod(RubyModule.java:761)
at org.jruby.anno.TypePopulator$DefaultTypePopulator.populate(TypePopulator.java:54)
at org.jruby.RubyModule.defineAnnotatedMethodsIndividually(RubyModule.java:678)
at org.jruby.RubyModule.defineAnnotatedMethods(RubyModule.java:580)
at nokogiri.NokogiriService.init_xml_node(NokogiriService.java:107)
at nokogiri.NokogiriService.init(NokogiriService.java:29)
at nokogiri.NokogiriService.basicLoad(NokogiriService.java:18)
at org.jruby.runtime.load.ClassExtensionLibrary.load(ClassExtensionLibrary.java:50)
at org.jruby.runtime.load.LoadService.tryLoadingLibraryOrScript(LoadService.java:596)
at org.jruby.runtime.load.LoadService.smartLoad(LoadService.java:303)
at org.jruby.runtime.load.LoadService.require(LoadService.java:314)
at org.jruby.runtime.load.LoadService.lockAndRequire(LoadService.java:287)
at org.jruby.RubyKernel.require(RubyKernel.java:902)
at org.jruby.RubyKernel$s_method_1_0$RUBYFRAMEDINVOKER$require.call(org/jruby/RubyKernel$s_method_1_0$RUBYFRAMEDINVOKER$require.gen)
at org.jruby.internal.runtime.methods.JavaMethod$JavaMethodOneOrNBlock.call(JavaMethod.java:312)
at org.jruby.internal.runtime.methods.AliasMethod.call(AliasMethod.java:61)
at org.jruby.runtime.callsite.CachingCallSite.call(CachingCallSite.java:115)
at org.jruby.ast.FCallOneArgNode.interpret(FCallOneArgNode.java:36)
at org.jruby.ast.NewlineNode.interpret(NewlineNode.java:104)
at org.jruby.ast.RescueNode.executeBody(RescueNode.java:225)
at org.jruby.ast.RescueNode.interpretWithJavaExceptions(RescueNode.java:147)
at org.jruby.ast.RescueNode.interpret(RescueNode.java:110)
at org.jruby.internal.runtime.methods.InterpretedMethod.call(InterpretedMethod.java:173)
at org.jruby.internal.runtime.methods.DefaultMethod.call(DefaultMethod.java:155)
at org.jruby.runtime.callsite.CachingCallSite.cacheAndCall(CachingCallSite.java:278)
at org.jruby.runtime.callsite.CachingCallSite.call(CachingCallSite.java:117)
at org.jruby.ast.FCallOneArgNode.interpret(FCallOneArgNode.java:36)
at org.jruby.ast.NewlineNode.interpret(NewlineNode.java:104)
at org.jruby.ast.IfNode.interpret(IfNode.java:114)
at org.jruby.ast.NewlineNode.interpret(NewlineNode.java:104)
at org.jruby.ast.BlockNode.interpret(BlockNode.java:71)
at org.jruby.ast.RootNode.interpret(RootNode.java:129)
at org.jruby.Ruby.loadFile(Ruby.java:2383)
at org.jruby.runtime.load.ExternalScript.load(ExternalScript.java:58)
at org.jruby.runtime.load.LoadService.tryLoadingLibraryOrScript(LoadService.java:596)
at org.jruby.runtime.load.LoadService.smartLoad(LoadService.java:303)
at org.jruby.runtime.load.LoadService.require(LoadService.java:314)
at org.jruby.runtime.load.LoadService.lockAndRequire(LoadService.java:287)
at org.jruby.RubyKernel.require(RubyKernel.java:902)
at org.jruby.RubyKernel$s_method_1_0$RUBYFRAMEDINVOKER$require.call(org/jruby/RubyKernel$s_method_1_0$RUBYFRAMEDINVOKER$require.gen)
at org.jruby.internal.runtime.methods.JavaMethod$JavaMethodOneOrNBlock.call(JavaMethod.java:312)
at org.jruby.internal.runtime.methods.AliasMethod.call(AliasMethod.java:61)
at org.jruby.runtime.callsite.CachingCallSite.call(CachingCallSite.java:115)
at org.jruby.ast.FCallOneArgNode.interpret(FCallOneArgNode.java:36)
at org.jruby.ast.NewlineNode.interpret(NewlineNode.java:104)
at org.jruby.ast.RescueNode.executeBody(RescueNode.java:225)
at org.jruby.ast.RescueNode.interpretWithJavaExceptions(RescueNode.java:147)
at org.jruby.ast.RescueNode.interpret(RescueNode.java:110)
at org.jruby.internal.runtime.methods.InterpretedMethod.call(InterpretedMethod.java:173)
at org.jruby.internal.runtime.methods.DefaultMethod.call(DefaultMethod.java:155)
at org.jruby.runtime.callsite.CachingCallSite.cacheAndCall(CachingCallSite.java:278)
at org.jruby.runtime.callsite.CachingCallSite.call(CachingCallSite.java:117)
at org.jruby.ast.FCallOneArgNode.interpret(FCallOneArgNode.java:36)
at org.jruby.ast.NewlineNode.interpret(NewlineNode.java:104)
at org.jruby.ast.BlockNode.interpret(BlockNode.java:71)
at org.jruby.ast.RootNode.interpret(RootNode.java:129)
at org.jruby.Ruby.loadFile(Ruby.java:2383)
at org.jruby.runtime.load.ExternalScript.load(ExternalScript.java:58)
at org.jruby.runtime.load.LoadService.tryLoadingLibraryOrScript(LoadService.java:596)
at org.jruby.runtime.load.LoadService.smartLoad(LoadService.java:303)
at org.jruby.runtime.load.LoadService.require(LoadService.java:314)
at org.jruby.runtime.load.LoadService.lockAndRequire(LoadService.java:287)
at org.jruby.RubyKernel.require(RubyKernel.java:902)
at org.jruby.RubyKernel$s_method_1_0$RUBYFRAMEDINVOKER$require.call(org/jruby/RubyKernel$s_method_1_0$RUBYFRAMEDINVOKER$require.gen)
at org.jruby.internal.runtime.methods.JavaMethod$JavaMethodOneOrNBlock.call(JavaMethod.java:312)
at org.jruby.runtime.callsite.CachingCallSite.cacheAndCall(CachingCallSite.java:278)
at org.jruby.runtime.callsite.CachingCallSite.call(CachingCallSite.java:117)
at org.jruby.ast.FCallOneArgNode.interpret(FCallOneArgNode.java:36)
at org.jruby.ast.NewlineNode.interpret(NewlineNode.java:104)
at org.jruby.ast.BlockNode.interpret(BlockNode.java:71)
at org.jruby.ast.RootNode.interpret(RootNode.java:129)
at org.jruby.Ruby.loadFile(Ruby.java:2383)
at org.jruby.runtime.load.ExternalScript.load(ExternalScript.java:58)
at org.jruby.runtime.load.LoadService.load(LoadService.java:253)
at org.jruby.RubyKernel.load(RubyKernel.java:914)
at org.jruby.RubyKernel$s_method_0_1$RUBYFRAMEDINVOKER$load.call(org/jruby/RubyKernel$s_method_0_1$RUBYFRAMEDINVOKER$load.gen)
at org.jruby.internal.runtime.methods.DynamicMethod.call(DynamicMethod.java:168)
at org.jruby.internal.runtime.methods.DynamicMethod.call(DynamicMethod.java:164)
at org.jruby.runtime.callsite.CachingCallSite.cacheAndCall(CachingCallSite.java:278)
at org.jruby.runtime.callsite.CachingCallSite.call(CachingCallSite.java:117)
at test.test_jruby.__file__(test_jruby.rb:4)
at test.test_jruby.load(test_jruby.rb)
at org.jruby.Ruby.runScript(Ruby.java:592)
at org.jruby.Ruby.runNormally(Ruby.java:514)
at org.jruby.Ruby.runFromMain(Ruby.java:360)
at org.jruby.Main.run(Main.java:268)
at org.jruby.Main.run(Main.java:113)
at org.jruby.Main.main(Main.java:97)
java.lang.NegativeArraySizeException
at org.objectweb.asm.Frame.a(Unknown Source)
at org.objectweb.asm.MethodWriter.visitMaxs(Unknown Source)
at org.jruby.compiler.impl.SkinnyMethodAdapter.visitMaxs(SkinnyMethodAdapter.java:877)
at org.jruby.internal.runtime.methods.InvocationMethodFactory.endMethod(InvocationMethodFactory.java:1131)
at org.jruby.internal.runtime.methods.InvocationMethodFactory.getAnnotatedMethodClass(InvocationMethodFactory.java:745)
at org.jruby.internal.runtime.methods.InvocationMethodFactory.getAnnotatedMethod(InvocationMethodFactory.java:677)
at org.jruby.RubyModule.defineAnnotatedMethod(RubyModule.java:793)
at org.jruby.RubyModule.defineAnnotatedMethod(RubyModule.java:761)
at org.jruby.anno.TypePopulator$DefaultTypePopulator.populate(TypePopulator.java:54)
at org.jruby.RubyModule.defineAnnotatedMethodsIndividually(RubyModule.java:678)
at org.jruby.RubyModule.defineAnnotatedMethods(RubyModule.java:580)
at nokogiri.NokogiriService.init_xml_node(NokogiriService.java:107)
at nokogiri.NokogiriService.init(NokogiriService.java:29)
at nokogiri.NokogiriService.basicLoad(NokogiriService.java:18)
at org.jruby.runtime.load.ClassExtensionLibrary.load(ClassExtensionLibrary.java:50)
at org.jruby.runtime.load.LoadService.tryLoadingLibraryOrScript(LoadService.java:596)
at org.jruby.runtime.load.LoadService.smartLoad(LoadService.java:303)
at org.jruby.runtime.load.LoadService.require(LoadService.java:314)
at org.jruby.runtime.load.LoadService.lockAndRequire(LoadService.java:287)
at org.jruby.RubyKernel.require(RubyKernel.java:902)
at org.jruby.RubyKernel$s_method_1_0$RUBYFRAMEDINVOKER$require.call(org/jruby/RubyKernel$s_method_1_0$RUBYFRAMEDINVOKER$require.gen)
at org.jruby.internal.runtime.methods.JavaMethod$JavaMethodOneOrNBlock.call(JavaMethod.java:312)
at org.jruby.internal.runtime.methods.AliasMethod.call(AliasMethod.java:61)
at org.jruby.runtime.callsite.CachingCallSite.call(CachingCallSite.java:115)
at org.jruby.ast.FCallOneArgNode.interpret(FCallOneArgNode.java:36)
at org.jruby.ast.NewlineNode.interpret(NewlineNode.java:104)
at org.jruby.ast.RescueNode.executeBody(RescueNode.java:225)
at org.jruby.ast.RescueNode.interpretWithJavaExceptions(RescueNode.java:147)
at org.jruby.ast.RescueNode.interpret(RescueNode.java:110)
at org.jruby.internal.runtime.methods.InterpretedMethod.call(InterpretedMethod.java:173)
at org.jruby.internal.runtime.methods.DefaultMethod.call(DefaultMethod.java:155)
at org.jruby.runtime.callsite.CachingCallSite.cacheAndCall(CachingCallSite.java:278)
at org.jruby.runtime.callsite.CachingCallSite.call(CachingCallSite.java:117)
at org.jruby.ast.FCallOneArgNode.interpret(FCallOneArgNode.java:36)
at org.jruby.ast.NewlineNode.interpret(NewlineNode.java:104)
at org.jruby.ast.IfNode.interpret(IfNode.java:114)
at org.jruby.ast.NewlineNode.interpret(NewlineNode.java:104)
at org.jruby.ast.BlockNode.interpret(BlockNode.java:71)
at org.jruby.ast.RootNode.interpret(RootNode.java:129)
at org.jruby.Ruby.loadFile(Ruby.java:2383)
at org.jruby.runtime.load.ExternalScript.load(ExternalScript.java:58)
at org.jruby.runtime.load.LoadService.tryLoadingLibraryOrScript(LoadService.java:596)
at org.jruby.runtime.load.LoadService.smartLoad(LoadService.java:303)
at org.jruby.runtime.load.LoadService.require(LoadService.java:314)
at org.jruby.runtime.load.LoadService.lockAndRequire(LoadService.java:287)
at org.jruby.RubyKernel.require(RubyKernel.java:902)
at org.jruby.RubyKernel$s_method_1_0$RUBYFRAMEDINVOKER$require.call(org/jruby/RubyKernel$s_method_1_0$RUBYFRAMEDINVOKER$require.gen)
at org.jruby.internal.runtime.methods.JavaMethod$JavaMethodOneOrNBlock.call(JavaMethod.java:312)
at org.jruby.internal.runtime.methods.AliasMethod.call(AliasMethod.java:61)
at org.jruby.runtime.callsite.CachingCallSite.cacheAndCall(CachingCallSite.java:278)
at org.jruby.runtime.callsite.CachingCallSite.call(CachingCallSite.java:117)
at org.jruby.ast.FCallOneArgNode.interpret(FCallOneArgNode.java:36)
at org.jruby.ast.NewlineNode.interpret(NewlineNode.java:104)
at org.jruby.ast.BlockNode.interpret(BlockNode.java:71)
at org.jruby.ast.IfNode.interpret(IfNode.java:112)
at org.jruby.ast.NewlineNode.interpret(NewlineNode.java:104)
at org.jruby.ast.BlockNode.interpret(BlockNode.java:71)
at org.jruby.ast.RescueBodyNode.interpret(RescueBodyNode.java:108)
at org.jruby.ast.RescueNode.handleException(RescueNode.java:190)
at org.jruby.ast.RescueNode.interpretWithJavaExceptions(RescueNode.java:150)
at org.jruby.ast.RescueNode.interpret(RescueNode.java:110)
at org.jruby.internal.runtime.methods.InterpretedMethod.call(InterpretedMethod.java:173)
at org.jruby.internal.runtime.methods.DefaultMethod.call(DefaultMethod.java:155)
at org.jruby.runtime.callsite.CachingCallSite.cacheAndCall(CachingCallSite.java:278)
at org.jruby.runtime.callsite.CachingCallSite.call(CachingCallSite.java:117)
at org.jruby.ast.FCallOneArgNode.interpret(FCallOneArgNode.java:36)
at org.jruby.ast.NewlineNode.interpret(NewlineNode.java:104)
at org.jruby.ast.BlockNode.interpret(BlockNode.java:71)
at org.jruby.ast.RootNode.interpret(RootNode.java:129)
at org.jruby.Ruby.loadFile(Ruby.java:2383)
at org.jruby.runtime.load.ExternalScript.load(ExternalScript.java:58)
at org.jruby.runtime.load.LoadService.tryLoadingLibraryOrScript(LoadService.java:596)
at org.jruby.runtime.load.LoadService.smartLoad(LoadService.java:303)
at org.jruby.runtime.load.LoadService.require(LoadService.java:314)
at org.jruby.runtime.load.LoadService.lockAndRequire(LoadService.java:287)
at org.jruby.RubyKernel.require(RubyKernel.java:902)
at org.jruby.RubyKernel$s_method_1_0$RUBYFRAMEDINVOKER$require.call(org/jruby/RubyKernel$s_method_1_0$RUBYFRAMEDINVOKER$require.gen)
at org.jruby.internal.runtime.methods.JavaMethod$JavaMethodOneOrNBlock.call(JavaMethod.java:312)
at org.jruby.runtime.callsite.CachingCallSite.cacheAndCall(CachingCallSite.java:278)
at org.jruby.runtime.callsite.CachingCallSite.call(CachingCallSite.java:117)
at org.jruby.ast.FCallOneArgNode.interpret(FCallOneArgNode.java:36)
at org.jruby.ast.NewlineNode.interpret(NewlineNode.java:104)
at org.jruby.ast.BlockNode.interpret(BlockNode.java:71)
at org.jruby.ast.RootNode.interpret(RootNode.java:129)
at org.jruby.Ruby.loadFile(Ruby.java:2383)
at org.jruby.runtime.load.ExternalScript.load(ExternalScript.java:58)
at org.jruby.runtime.load.LoadService.load(LoadService.java:253)
at org.jruby.RubyKernel.load(RubyKernel.java:914)
at org.jruby.RubyKernel$s_method_0_1$RUBYFRAMEDINVOKER$load.call(org/jruby/RubyKernel$s_method_0_1$RUBYFRAMEDINVOKER$load.gen)
at org.jruby.internal.runtime.methods.DynamicMethod.call(DynamicMethod.java:168)
at org.jruby.internal.runtime.methods.DynamicMethod.call(DynamicMethod.java:164)
at org.jruby.runtime.callsite.CachingCallSite.cacheAndCall(CachingCallSite.java:278)
at org.jruby.runtime.callsite.CachingCallSite.call(CachingCallSite.java:117)
at test.test_jruby.__file__(test_jruby.rb:4)
at test.test_jruby.load(test_jruby.rb)
at org.jruby.Ruby.runScript(Ruby.java:592)
at org.jruby.Ruby.runNormally(Ruby.java:514)
at org.jruby.Ruby.runFromMain(Ruby.java:360)
at org.jruby.Main.run(Main.java:268)
at org.jruby.Main.run(Main.java:113)
at org.jruby.Main.main(Main.java:97)
/home/sergio/Programming/projects/jruby/lib/ruby/site_ruby/1.8/rubygems/custom_require.rb:31:in `require': IO error -- nokogiri/nokogiri (LoadError)
from /home/sergio/Programming/projects/jruby/lib/ruby/site_ruby/1.8/rubygems/custom_require.rb:31:in `require'
from /home/sergio/Programming/projects/nokogiri/lib/nokogiri.rb:12
from /home/sergio/Programming/projects/nokogiri/lib/nokogiri.rb:36:in `require'
from /home/sergio/Programming/projects/jruby/lib/ruby/site_ruby/1.8/rubygems/custom_require.rb:36:in `require'
from /home/sergio/Programming/projects/nokogiri/test/helper.rb:10
from /home/sergio/Programming/projects/nokogiri/test/helper.rb:2:in `require'
from test/test_reader.rb:2
from test/test_reader.rb:4:in `load'
from test/test_jruby.rb:4
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment