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

org.jruby.exceptions.RaiseException: (TypeError) can't convert nil into String #229

Closed
odrotbohm opened this issue Dec 8, 2014 · 17 comments
Assignees
Milestone

Comments

@odrotbohm
Copy link

I just tried to use asciidoctorj-pdf from the Asciidoctor Maven Plugin in version 1.5.0. I basically added the pdf dependency to the plugin and added an execution with backend pdf. HTML, Docbook and EPUB run fine. When running the build with -X I get this stacktrace (partial).

Anything on my side I am doing wrong or wanna check my input documents for?

Caused by: org.jruby.exceptions.RaiseException: (TypeError) can't convert nil into String
    at org.jruby.RubyString.replace(org/jruby/RubyString.java:1448)
    at org.jruby.RubyString.initialize(org/jruby/RubyString.java:1636)
    at RUBY.initialize(/Users/olivergierke/.m2/repository/org/asciidoctor/asciidoctorj-pdf/1.5.0-alpha.6/asciidoctorj-pdf-1.5.0-alpha.6.jar!/gems/pdf-core-0.2.5/lib/pdf/core/name_tree.rb:160)
    at RUBY.add(/Users/olivergierke/.m2/repository/org/asciidoctor/asciidoctorj-pdf/1.5.0-alpha.6/asciidoctorj-pdf-1.5.0-alpha.6.jar!/gems/pdf-core-0.2.5/lib/pdf/core/name_tree.rb:40)
    at RUBY.add_dest(/Users/olivergierke/.m2/repository/org/asciidoctor/asciidoctorj-pdf/1.5.0-alpha.6/asciidoctorj-pdf-1.5.0-alpha.6.jar!/gems/pdf-core-0.2.5/lib/pdf/core/destinations.rb:30)
    at RUBY.convert_section(/Users/olivergierke/.m2/repository/org/asciidoctor/asciidoctorj-pdf/1.5.0-alpha.6/asciidoctorj-pdf-1.5.0-alpha.6.jar!/gems/asciidoctor-pdf-1.5.0.alpha.6/lib/asciidoctor-pdf/converter.rb:214)
    at RUBY.theme_font(/Users/olivergierke/.m2/repository/org/asciidoctor/asciidoctorj-pdf/1.5.0-alpha.6/asciidoctorj-pdf-1.5.0-alpha.6.jar!/gems/asciidoctor-pdf-1.5.0.alpha.6/lib/asciidoctor-pdf/converter.rb:1316)
    at RUBY.font(/Users/olivergierke/.m2/repository/org/asciidoctor/asciidoctorj-pdf/1.5.0-alpha.6/asciidoctorj-pdf-1.5.0-alpha.6.jar!/gems/prawn-1.2.1/lib/prawn/font.rb:63)
    at RUBY.save_font(/Users/olivergierke/.m2/repository/org/asciidoctor/asciidoctorj-pdf/1.5.0-alpha.6/asciidoctorj-pdf-1.5.0-alpha.6.jar!/gems/prawn-1.2.1/lib/prawn/font.rb:208)
    at RUBY.font(/Users/olivergierke/.m2/repository/org/asciidoctor/asciidoctorj-pdf/1.5.0-alpha.6/asciidoctorj-pdf-1.5.0-alpha.6.jar!/gems/prawn-1.2.1/lib/prawn/font.rb:61)
    at RUBY.font(/Users/olivergierke/.m2/repository/org/asciidoctor/asciidoctorj-pdf/1.5.0-alpha.6/asciidoctorj-pdf-1.5.0-alpha.6.jar!/gems/asciidoctor-pdf-1.5.0.alpha.6/lib/asciidoctor-pdf/prawn_ext/extensions.rb:97)
    at RUBY.theme_font(/Users/olivergierke/.m2/repository/org/asciidoctor/asciidoctorj-pdf/1.5.0-alpha.6/asciidoctorj-pdf-1.5.0-alpha.6.jar!/gems/asciidoctor-pdf-1.5.0.alpha.6/lib/asciidoctor-pdf/converter.rb:1315)
    at RUBY.convert_section(/Users/olivergierke/.m2/repository/org/asciidoctor/asciidoctorj-pdf/1.5.0-alpha.6/asciidoctorj-pdf-1.5.0-alpha.6.jar!/gems/asciidoctor-pdf-1.5.0.alpha.6/lib/asciidoctor-pdf/converter.rb:200)
    at RUBY.convert(/Users/olivergierke/.m2/repository/org/asciidoctor/asciidoctorj-pdf/1.5.0-alpha.6/asciidoctorj-pdf-1.5.0-alpha.6.jar!/gems/asciidoctor-pdf-1.5.0.alpha.6/lib/asciidoctor-pdf/converter.rb:65)
    at RUBY.convert(/Users/olivergierke/.m2/repository/org/asciidoctor/asciidoctorj/1.5.2/asciidoctorj-1.5.2.jar!/gems/asciidoctor-1.5.2/lib/asciidoctor/abstract_block.rb:71)
    at RUBY.content(/Users/olivergierke/.m2/repository/org/asciidoctor/asciidoctorj/1.5.2/asciidoctorj-1.5.2.jar!/gems/asciidoctor-1.5.2/lib/asciidoctor/abstract_block.rb:80)
    at org.jruby.RubyArray.map(org/jruby/RubyArray.java:2412)
    at RUBY.content(/Users/olivergierke/.m2/repository/org/asciidoctor/asciidoctorj/1.5.2/asciidoctorj-1.5.2.jar!/gems/asciidoctor-1.5.2/lib/asciidoctor/abstract_block.rb:80)
    at RUBY.convert_content_for_block(/Users/olivergierke/.m2/repository/org/asciidoctor/asciidoctorj-pdf/1.5.0-alpha.6/asciidoctorj-pdf-1.5.0-alpha.6.jar!/gems/asciidoctor-pdf-1.5.0.alpha.6/lib/asciidoctor-pdf/converter.rb:81)
@mojavelinux
Copy link
Member

Could you point me to the source you are running this one.

Disclaimer...Asciidoctor PDF needs to see more real world examples to flesh out all the edge cases (PDF generation is a lot tougher than HTML). On the upside, we're ready to fix those issues rapidly, so bring it on!

@odrotbohm
Copy link
Author

I extracted the relevant parts into an example project you can find here: https://github.com/olivergierke/asciidoctor-pdf-example

What's also weird though is that the EPUB module seems to have issues with the level offsets but that's probably something worth reporting in a separate ticket.

@mojavelinux
Copy link
Member

Thanks @olivergierke! I'll have a look asap!

@lordofthejars
Copy link
Member

Have you tried without maven plugin? Or with native Ruby gem (if it is possible of course). I said that to try to see if the problem is on the Maven plugin, on asciidoctorj or in asciidoctor-pdf.

@mojavelinux
Copy link
Member

I'm quite confident the AsciidoctorJ PDF issues & Asciidoctor PDF (Ruby)
issues will be 1-to-1 (by design), which is why we should address the
issues here.

@odrotbohm
Copy link
Author

I've tried following the instructions here but failed on the bundle install step:

Serendipity-6:asciidoctor-pdf @ master olivergierke $ bundle install
Fetching gem metadata from https://rubygems.org/........
Enter your password to install the bundled RubyGems to your system: 
Installing rake (10.4.2) 
Installing Ascii85 (1.0.2) 
Installing afm (0.2.2) 
Installing asciidoctor (1.5.2) 
Installing pdf-core (0.2.5) 
Gem::InstallError: pdf-core requires Ruby version >= 1.9.3.
An error occurred while installing pdf-core (0.2.5), and Bundler cannot continue.
Make sure that `gem install pdf-core -v '0.2.5'` succeeds before bundling.
Serendipity-6:asciidoctor-pdf @ master olivergierke $ ruby --version
ruby 2.0.0p481 (2014-05-08 revision 45883) [universal.x86_64-darwin13]

Feels a bit like I am getting into jak-shaving mode here :).

@lordofthejars
Copy link
Member

Ok then let's see what's happen on both sides :)

@lordofthejars
Copy link
Member

BTW Dan I think we should create two more labels one called asciidoctor-pdf and another one asciidoctor-epub3, because currently all implementations share the same repo and it would be helpful to categorize the issues.

@mojavelinux
Copy link
Member

@lordofthejars We could certainly do that, but I would rather just have them filed in the upstream issue tracker and label the one here as "tracking".

@mojavelinux
Copy link
Member

Btw, I'll dive into this issue later today and try to provide some insight.

@mojavelinux
Copy link
Member

Aha! I located the problem. You have sectids disabled, yet the PDF converter relies on them to create internal references. What I can probably do is force this attribute to be enabled in the PDF backend since they are completely internal to the PDF. I'll file an issue and link it here.

@mojavelinux
Copy link
Member

asciidoctor/asciidoctor-pdf#70

Btw, the simple solution here is to enable sectids explicitly in the configuration for pdf in your pom.xml.

@mojavelinux mojavelinux added this to the v1.5.3 milestone Dec 10, 2014
@lordofthejars
Copy link
Member

Do you think we can do something in asciidoctorj like setting it or you prefer to have it in Asciidoctor core.

@mojavelinux
Copy link
Member

We can do a submodule release of the AsciidoctorJ PDF component once there is a new alpha release available of Asciidoctor PDF.

@mojavelinux
Copy link
Member

Let me sort out how I'm going to address it in Asciidoctor PDF. If I decide it's something that AsciidoctorJ could help with, I'll definitely let you know.

@lordofthejars
Copy link
Member

ok perfect. If not we must remember to close this issue :).

@mojavelinux
Copy link
Member

The upstream issue is fixed and released, so this can now be closed.

@mojavelinux mojavelinux self-assigned this Nov 1, 2015
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

3 participants