Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

asciidoctorj-pdf does not work with JRuby 1.7.23 #3496

Closed
robertpanzer opened this issue Nov 25, 2015 · 11 comments
Closed

asciidoctorj-pdf does not work with JRuby 1.7.23 #3496

robertpanzer opened this issue Nov 25, 2015 · 11 comments

Comments

@robertpanzer
Copy link

When rendering a document with asciidoctorj-pdf on Win7 rendering fails in the Addressable gem where a file is opened that is part of the gem and therefore packaged in a jar.

The error can be reproduced easily with this gradle build file running gradle runTest:

repositories {
    jcenter()
}

configurations {
    run
}

dependencies {
    run 'org.asciidoctor:asciidoctorj:1.5.3.2'
    run 'org.asciidoctor:asciidoctorj-pdf:1.5.0-alpha.10'
    run 'org.asciidoctor:asciidoctorj-diagram:1.3.1'
    run 'org.jruby:jruby-complete:1.7.23'
}

task createTestDoc << {
    new File('test.adoc').text = '''= Test document

Test''' 
}

task runTest(type: JavaExec, dependsOn: createTestDoc) {
    classpath = configurations.run
    main = 'org.asciidoctor.cli.AsciidoctorInvoker'
    args '-r', 'asciidoctor-diagram', '-b', 'pdf', 'test.adoc'
}

Setting the jruby version to 1.7.21 makes the build pass.

The error I see is:

org.jruby.exceptions.RaiseException: (Errno::ENOENT) C:/Users/robert.panzer/.gradle/caches/modules-2/files-2.1/org.asciidoctor/asciidoctorj-pdf/1.5.0-alpha.10/3ba8b2d410fba94473c3550f187c345980e16093/asciidoctorj-pdf-1.5.0-alpha.10.jar!C:/gems/addressable-2.3.8/data/unicode.data
        at org.jruby.RubyFile.initialize(org/jruby/RubyFile.java:370)
        at org.jruby.RubyIO.open(org/jruby/RubyIO.java:1179)
        at RUBY.IDNA(C:/Users/robert.panzer/.gradle/caches/modules-2/files-2.1/org.asciidoctor/asciidoctorj-pdf/1.5.0-alpha.10/3ba8b2d410fba94473c3550f187c345980e16093/asciidoctorj-pdf-1.5.0-alpha.10.jar!/gems/addressable-2.3.8/lib/addressable/idna/pure.rb:331)
        at RUBY.Addressable(C:/Users/robert.panzer/.gradle/caches/modules-2/files-2.1/org.asciidoctor/asciidoctorj-pdf/1.5.0-alpha.10/3ba8b2d410fba94473c3550f187c345980e16093/asciidoctorj-pdf-1.5.0-alpha.10.jar!/gems/addressable-2.3.8/lib/addressable/idna/pure.rb:20)
        at RUBY.(root)(C:/Users/robert.panzer/.gradle/caches/modules-2/files-2.1/org.asciidoctor/asciidoctorj-pdf/1.5.0-alpha.10/3ba8b2d410fba94473c3550f187c345980e16093/asciidoctorj-pdf-1.5.0-alpha.10.jar!/gems/addressable-2.3.8/lib/addressable/idna/pure.rb:19)
        at org.jruby.RubyKernel.require(org/jruby/RubyKernel.java:1040)
        at RUBY.(root)(/C:/Users/robert.panzer/.gradle/caches/modules-2/files-2.1/org.jruby/jruby-complete/1.7.23/98150edb47ccc36917c1ef475d694b91a3356245/jruby-complete-1.7.23.jar!/META-INF/jruby.home/lib/ruby/shared/rubygems/core_ext/kernel_require.rb:1)
        at RUBY.require(/C:/Users/robert.panzer/.gradle/caches/modules-2/files-2.1/org.jruby/jruby-complete/1.7.23/98150edb47ccc36917c1ef475d694b91a3356245/jruby-complete-1.7.23.jar!/META-INF/jruby.home/lib/ruby/shared/rubygems/core_ext/kernel_require.rb:54)
        at org.jruby.RubyKernel.require(org/jruby/RubyKernel.java:1040)
        at RUBY.(root)(C:/Users/robert.panzer/.gradle/caches/modules-2/files-2.1/org.asciidoctor/asciidoctorj-pdf/1.5.0-alpha.10/3ba8b2d410fba94473c3550f187c345980e16093/asciidoctorj-pdf-1.5.0-alpha.10.jar!/gems/addressable-2.3.8/lib/addressable/idna.rb:24)
        at RUBY.(root)(/C:/Users/robert.panzer/.gradle/caches/modules-2/files-2.1/org.jruby/jruby-complete/1.7.23/98150edb47ccc36917c1ef475d694b91a3356245/jruby-complete-1.7.23.jar!/META-INF/jruby.home/lib/ruby/shared/rubygems/core_ext/kernel_require.rb:1)
        at org.jruby.RubyKernel.require(org/jruby/RubyKernel.java:1040)
        at RUBY.require(/C:/Users/robert.panzer/.gradle/caches/modules-2/files-2.1/org.jruby/jruby-complete/1.7.23/98150edb47ccc36917c1ef475d694b91a3356245/jruby-complete-1.7.23.jar!/META-INF/jruby.home/lib/ruby/shared/rubygems/core_ext/kernel_require.rb:54)
        at RUBY.(root)(C:/Users/robert.panzer/.gradle/caches/modules-2/files-2.1/org.asciidoctor/asciidoctorj-pdf/1.5.0-alpha.10/3ba8b2d410fba94473c3550f187c345980e16093/asciidoctorj-pdf-1.5.0-alpha.10.jar!/gems/addressable-2.3.8/lib/addressable/uri.rb:20)
        at org.jruby.RubyKernel.require(org/jruby/RubyKernel.java:1040)
        at RUBY.(root)(/C:/Users/robert.panzer/.gradle/caches/modules-2/files-2.1/org.jruby/jruby-complete/1.7.23/98150edb47ccc36917c1ef475d694b91a3356245/jruby-complete-1.7.23.jar!/META-INF/jruby.home/lib/ruby/shared/rubygems/core_ext/kernel_require.rb:1)
        at RUBY.require(/C:/Users/robert.panzer/.gradle/caches/modules-2/files-2.1/org.jruby/jruby-complete/1.7.23/98150edb47ccc36917c1ef475d694b91a3356245/jruby-complete-1.7.23.jar!/META-INF/jruby.home/lib/ruby/shared/rubygems/core_ext/kernel_require.rb:54)
        at RUBY.(root)(C:/Users/robert.panzer/.gradle/caches/modules-2/files-2.1/org.asciidoctor/asciidoctorj-pdf/1.5.0-alpha.10/3ba8b2d410fba94473c3550f187c345980e16093/asciidoctorj-pdf-1.5.0-alpha.10.jar!/gems/css_parser-1.3.7/lib/css_parser.rb:1)
        at org.jruby.RubyKernel.require(org/jruby/RubyKernel.java:1040)
        at RUBY.(root)(/C:/obert.panzer/.gradle/caches/modules-2/files-2.1/org.jruby/jruby-complete/1.7.23/98150edb47ccc36917c1ef475d694b91a3356245/jruby-complete-1.7.23.jar!/META-INF/jruby.home/lib/ruby/shared/rubygems/core_ext/kernel_require.rb:1)
        at RUBY.require(/C:/Users/robert.panzer/.gradle/caches/modules-2/files-2.1/org.jruby/jruby-complete/1.7.23/98150edb47ccc36917c1ef475d694b91a3356245/jruby-complete-1.7.23.jar!/META-INF/jruby.home/lib/ruby/shared/rubygems/core_ext/kernel_require.rb:54)
        at org.jruby.RubyKernel.require(org/jruby/RubyKernel.java:1040)
        at RUBY.Document(C:/Users/robert.panzer/.gradle/caches/modules-2/files-2.1/org.asciidoctor/asciidoctorj-pdf/1.5.0-alpha.10/3ba8b2d410fba94473c3550f187c345980e16093/asciidoctorj-pdf-1.5.0-alpha.10.jar!/gems/prawn-svg-0.21.0/lib/prawn/svg/document.rb:3)
        at RUBY.(root)(C:/Users/robert.panzer/.gradle/caches/modules-2/files-2.1/org.asciidoctor/asciidoctorj-pdf/1.5.0-alpha.10/3ba8b2d410fba94473c3550f187c345980e16093/asciidoctorj-pdf-1.5.0-alpha.10.jar!/gems/prawn-svg-0.21.0/lib/prawn/svg/document.rb:1)
        at org.jruby.RubyKernel.require(org/jruby/RubyKernel.java:1040)
        at RUBY.(root)(/C:/Users/robert.panzer/.gradle/caches/modules-2/files-2.1/org.jruby/jruby-complete/1.7.23/98150edb47ccc36917c1ef475d694b91a3356245/jruby-complete-1.7.23.jar!/META-INF/jruby.home/lib/ruby/shared/rubygems/core_ext/kernel_require.rb:1)
        at RUBY.require(/C:/Users/robert.panzer/.gradle/caches/modules-2/files-2.1/org.jruby/jruby-complete/1.7.23/98150edb47ccc36917c1ef475d694b91a3356245/jruby-complete-1.7.23.jar!/META-INF/jruby.home/lib/ruby/shared/rubygems/core_ext/kernel_require.rb:54)
        at RUBY.(root)(C:/Users/robert.panzer/.gradle/caches/modules-2/files-2.1/org.asciidoctor/asciidoctorj-pdf/1.5.0-alpha.10/3ba8b2d410fba94473c3550f187c345980e16093/asciidoctorj-pdf-1.5.0-alpha.10.jar!/gems/prawn-svg-0.21.0/lib/prawn-svg.rb:12)
        at org.jruby.RubyKernel.require(org/jruby/RubyKernel.java:1040)
        at RUBY.(root)(/C:/Users/robert.panzer/.gradle/caches/modules-2/files-2.1/org.jruby/jruby-complete/1.7.23/98150c36917c1ef475d694b91a3356245/jruby-complete-1.7.23.jar!/META-INF/jruby.home/lib/ruby/shared/rubygems/core_ext/kernel_require.rb:1)
        at RUBY.require(/C:/Users/robert.panzer/.gradle/caches/modules-2/files-2.1/org.jruby/jruby-complete/1.7.23/98150edb47ccc36917c1ef475d694b91a3356245/jruby-complete-1.7.23.jar!/META-INF/jruby.home/lib/ruby/shared/rubygems/core_ext/kernel_require.rb:54)
@mojavelinux
Copy link

It looks like it is resolving the path incorrectly, as indicated by this segment in the file name:

jar!C:/gems/

@mkristian
Copy link
Member

the same script works with jruby-9.0.4.0 and when jruby picks a locally install gem then it fails a little later:

Exception in thread "main" org.asciidoctor.internal.AsciidoctorCoreException: org.jruby.exceptions.RaiseException: (Errn
o::ENOENT) C:/Users/IEUser/.gradle/caches/modules-2/files-2.1/org.asciidoctor/asciidoctorj-pdf/1.5.0-alpha.10/3ba8b2d410
fba94473c3550f187c345980e16093/asciidoctorj-pdf-1.5.0-alpha.10.jar!Z:/gems/asciidoctor-pdf-1.5.0.alpha.10/data/themes/de
fault-theme.yml
        at org.asciidoctor.internal.JRubyAsciidoctor.renderFile(JRubyAsciidoctor.java:345)
        at org.asciidoctor.internal.JRubyAsciidoctor.renderFile(JRubyAsciidoctor.java:434)
        at org.asciidoctor.cli.AsciidoctorInvoker.renderInput(AsciidoctorInvoker.java:126)
        at org.asciidoctor.cli.AsciidoctorInvoker.invoke(AsciidoctorInvoker.java:65)
        at org.asciidoctor.cli.AsciidoctorInvoker.main(AsciidoctorInvoker.java:183)
Caused by: org.jruby.exceptions.RaiseException: (Errno::ENOENT) C:/Users/IEUser/.gradle/caches/modules-2/files-2.1/org.a
sciidoctor/asciidoctorj-pdf/1.5.0-alpha.10/3ba8b2d410fba94473c3550f187c345980e16093/asciidoctorj-pdf-1.5.0-alpha.10.jar!
Z:/gems/asciidoctor-pdf-1.5.0.alpha.10/data/themes/default-theme.yml
        at org.jruby.RubyIO.read(org/jruby/RubyIO.java:3785)
        at org.jruby.RubyIO.read(org/jruby/RubyIO.java:3968)
        at RUBY.load_file(C:/Users/IEUser/.gradle/caches/modules-2/files-2.1/org.asciidoctor/asciidoctorj-pdf/1.5.0-alph
a.10/3ba8b2d410fba94473c3550f187c345980e16093/asciidoctorj-pdf-1.5.0-alpha.10.jar!/gems/asciidoctor-pdf-1.5.0.alpha.10/l
ib/asciidoctor-pdf/theme_loader.rb:77)
        at RUBY.load_theme(C:/Users/IEUser/.gradle/caches/modules-2/files-2.1/org.asciidoctor/asciidocf/1.5.0-alpha.10/3
ba8b2d410fba94473c3550f187c345980e16093/asciidoctorj-pdf-1.5.0-alpha.10.jar!/gems/asciidoctor-pdf-1.5.0.alpha.10/lib/asc
iidoctor-pdf/theme_loader.rb:72)
        at RUBY.init_pdf(C:/Users/IEUser/.gradle/caches/modules-2/files-2.1/org.asciidoctor/asciidoctorj-pdf/1.5.0-alpha
.10/3ba8b2d410fba94473c3550f187c345980e16093/asciidoctorj-pdf-1.5.0-alpha.10.jar!/gems/asciidoctor-pdf-1.5.0.alpha.10/li
b/asciidoctor-pdf/converter.rb:197)
        at RUBY.convert_document(C:/Users/IEUser/.gradle/caches/modules-2/files-2.1/org.asciidoctor/asciidoctorj-pdf/1.5
.0-alpha.10/3ba8b2d410fba94473c3550f187c345980e16093/asciidoctorj-pdf-1.5.0-alpha.10.jar!/gems/asciidoctor-pdf-1.5.0.alp
ha.10/lib/asciidoctor-pdf/converter.rb:123)
        at RUBY.convert(C:/Users/IEUser/.gradle/caches/modules-2/files-2.1/org.asciidoctor/asciidoctorj-pdf/1.5.0-alpha.
10/3ba8b2d410fba94473c3550f187c345980e16093/asciidoctorj-pdf-1.5.0-alpha.10.jar!/gems/asciidoctor-pdf-1.5.0.alpha.10/lib
/asciidoctor-pdf/converter.rb:98)

same jar!C:/gems thing. not sure if this is really an issue on jruby-1.7.23 only, as jruby-9k just does use of uri:classloader:/ internally but still if some code uses jar-uri paths this could still happen.

@mkristian
Copy link
Member

this is also a jruby-9k bug. but it does not show for the reason I stated above.

@mkristian
Copy link
Member

@robertpanzer @mojavelinux I am about to push a fix for this. would like to verify it work with asciidoctorj or actually would like to verify that the current 1.7.24-SNAPSHOT works with asciidoctorj. how can run its testsuite ? do the tests cover this bug here ?

@mkristian
Copy link
Member

anyways pushed the fix to https://oss.sonatype.org/content/repositories/snapshots/ for jruby-1.7.24-SNAPSHOT

@robertpanzer
Copy link
Author

You should be able to test by downloading the distribution asciidoctorj-1.5.3.2 from here: http://jcenter.bintray.com/org/asciidoctor/asciidoctorj/1.5.3.2/asciidoctorj-1.5.3.2-bin.zip
Unpack it and replace the jruby-complete.jar in the lib folder.
Then create a text file test.adoc with this content:

= Test document

Hello World

== A section

Some content

Go to the bin/ folder and execute asciidoctorj -b pdf test.adoc.
This should crash with jruby 1.7.23.

(All on Windows certainly)

@enebo
Copy link
Member

enebo commented Jan 13, 2016

I tried this on win7 without the fix and have no problems running the example. Did you happen to add a workaround to this version?

@mkristian
Copy link
Member

I can reproduce the error with 1.7.23 and produces a pdf with 1.7.24-SNAPSHOT

closing as fixed it with 6b115fa

@mojavelinux
Copy link

Thanks for fixing and verifying @mkristian! From the test case, it certainly looks like it covers the scenario.

@robertpanzer Is there a test in AsciidoctorJ that can verify this fix? If not, we might want to add one just to be sure we catch any regressions, if they should occur.

@robertpanzer
Copy link
Author

I added an integration test to asciidoctorj-distribution recently on the
1.6.0 branch that should reveal this problem as well.
But it didn't occur with 9.0.4.0 which we use there.

Am Mittwoch, 13. Januar 2016 schrieb Dan Allen :

Thanks for fixing and verifying @mkristian https://github.com/mkristian!
From the test case, it certainly looks like it covers the scenario.

@robertpanzer https://github.com/robertpanzer Is there a test in
AsciidoctorJ that can verify this fix? If not, we might want to add one
just to be sure we catch any regressions, if they should occur.


Reply to this email directly or view it on GitHub
#3496 (comment).

@mojavelinux
Copy link

👍

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

5 participants