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

Exception in prawn when generating a PDF from IDE #337

Closed
ahus1 opened this issue Sep 28, 2019 · 8 comments · Fixed by #338
Closed

Exception in prawn when generating a PDF from IDE #337

ahus1 opened this issue Sep 28, 2019 · 8 comments · Fixed by #338
Assignees
Labels

Comments

@ahus1
Copy link
Contributor

ahus1 commented Sep 28, 2019

It looking at the exception, it looks like an issue with prawn and syntax highlighting: prawn.text.formatted.wrap

I locked the trigger down to the quick-start.adoc file and reduced it to the following snippet that fails with the PDF generation in the IDE.

[source,java]
----
                    .exchange("http://" + Constants.REST_COMPUTE_SERVICE + "/compute", HttpMethod.PUT)
----

The project you referenced doesn't include a PDF generation, therefore I am not sure what versions you use to create a PDF.

The IntelliJ plugin uses asciidoctorj-pdf:1.5.0-beta.4 together with the latest AsciiDoctorJ runtime.

Please use the latest versions of asciidoctorj and asciidoctorj-pdf in your maven build. If you see the same problem there, please raise an issue with asciidoctor-pdf with a minimal example (usually not asciidoctorj-pdf, as this is just a re-packaging).

Once you have a working Maven build with the latest versions and still have a failing IntelliJ plugin, please raise an issue with the plugin.

Originally posted by @ahus1 in #325 (comment)

@mojavelinux
Copy link
Member

mojavelinux commented Sep 28, 2019 via email

@ahus1 ahus1 added the bug label Sep 28, 2019
@ahus1
Copy link
Contributor Author

ahus1 commented Sep 28, 2019

@mojavelinux - it is happening with asciidoctorj-pdf beta.5. Something in prawn. I copy the JRuby stack trace here. Wasn't able to reproduce it on the command line, but the JRuby command line seems to use a different version. Seems to happen once the verbatim content has an automatic line break, but not without the line break.

I'm about to create a minimal test case for it.

Invalid start: 1
java.lang.AssertionError: Invalid start: 1
	at org.jruby.util.ByteList.append(ByteList.java:542)
	at org.jruby.util.ByteList.dup(ByteList.java:330)
	at org.jruby.util.ByteList.dup(ByteList.java:300)
	at org.jruby.RubyString.modify(RubyString.java:965)
	at org.jruby.RubyString.modify19(RubyString.java:976)
	at org.jruby.RubyString.force_encoding(RubyString.java:6089)
	at org.jruby.RubyString.force_encoding(RubyString.java:6084)
	at org.jruby.RubyString$INVOKER$i$1$0$force_encoding.call(RubyString$INVOKER$i$1$0$force_encoding.gen)
	at org.jruby.runtime.callsite.CachingCallSite.cacheAndCall(CachingCallSite.java:339)
	at org.jruby.runtime.callsite.CachingCallSite.call(CachingCallSite.java:170)
	at uri_3a_classloader_3a_.gems.prawn_minus_2_dot_2_dot_2.lib.prawn.text.formatted.wrap.invokeOther0:force_encoding(uri:classloader:/gems/prawn-2.2.2/lib/prawn/text/formatted/wrap.rb:106)
	at uri_3a_classloader_3a_.gems.prawn_minus_2_dot_2_dot_2.lib.prawn.text.formatted.wrap.RUBY$block$print_line$0(uri:classloader:/gems/prawn-2.2.2/lib/prawn/text/formatted/wrap.rb:106)
	at org.jruby.runtime.CompiledIRBlockBody.yieldDirect(CompiledIRBlockBody.java:146)
	at org.jruby.runtime.MixedModeIRBlockBody.yieldDirect(MixedModeIRBlockBody.java:124)
	at org.jruby.runtime.BlockBody.yield(BlockBody.java:114)
	at org.jruby.runtime.Block.yield(Block.java:165)
	at org.jruby.RubyArray.collect(RubyArray.java:2563)
	at org.jruby.RubyArray.map19(RubyArray.java:2577)
	at org.jruby.RubyArray$INVOKER$i$0$0$map19.call(RubyArray$INVOKER$i$0$0$map19.gen)
	at org.jruby.internal.runtime.methods.JavaMethod$JavaMethodZeroBlock.call(JavaMethod.java:555)
	at org.jruby.runtime.callsite.CachingCallSite.call(CachingCallSite.java:80)
	at org.jruby.runtime.callsite.CachingCallSite.callIter(CachingCallSite.java:89)
	at org.jruby.ir.instructions.CallBase.interpret(CallBase.java:537)
	at org.jruby.ir.interpreter.InterpreterEngine.processCall(InterpreterEngine.java:362)
	at org.jruby.ir.interpreter.StartupInterpreterEngine.interpret(StartupInterpreterEngine.java:72)
	at org.jruby.ir.interpreter.InterpreterEngine.interpret(InterpreterEngine.java:80)
	at org.jruby.internal.runtime.methods.MixedModeIRMethod.INTERPRET_METHOD(MixedModeIRMethod.java:138)
	at org.jruby.internal.runtime.methods.MixedModeIRMethod.call(MixedModeIRMethod.java:125)
	at org.jruby.internal.runtime.methods.DynamicMethod.call(DynamicMethod.java:192)
	at org.jruby.runtime.callsite.CachingCallSite.cacheAndCall(CachingCallSite.java:318)
	at org.jruby.runtime.callsite.CachingCallSite.call(CachingCallSite.java:139)
	at org.jruby.ir.interpreter.InterpreterEngine.processCall(InterpreterEngine.java:346)
	at org.jruby.ir.interpreter.StartupInterpreterEngine.interpret(StartupInterpreterEngine.java:72)
	at org.jruby.internal.runtime.methods.MixedModeIRMethod.INTERPRET_METHOD(MixedModeIRMethod.java:105)
	at org.jruby.internal.runtime.methods.MixedModeIRMethod.call(MixedModeIRMethod.java:92)
	at org.jruby.ir.runtime.IRRuntimeHelpers.unresolvedSuper(IRRuntimeHelpers.java:1191)
	at org.jruby.ir.instructions.UnresolvedSuperInstr.interpret(UnresolvedSuperInstr.java:102)
	at org.jruby.ir.interpreter.InterpreterEngine.processCall(InterpreterEngine.java:362)
	at org.jruby.ir.interpreter.StartupInterpreterEngine.interpret(StartupInterpreterEngine.java:72)
	at org.jruby.ir.interpreter.InterpreterEngine.interpret(InterpreterEngine.java:86)
	at org.jruby.internal.runtime.methods.MixedModeIRMethod.INTERPRET_METHOD(MixedModeIRMethod.java:171)
	at org.jruby.internal.runtime.methods.MixedModeIRMethod.call(MixedModeIRMethod.java:158)
	at org.jruby.internal.runtime.methods.DynamicMethod.call(DynamicMethod.java:200)
	at org.jruby.runtime.callsite.CachingCallSite.call(CachingCallSite.java:168)
	at org.jruby.ir.interpreter.InterpreterEngine.processCall(InterpreterEngine.java:317)
	at org.jruby.ir.interpreter.StartupInterpreterEngine.interpret(StartupInterpreterEngine.java:72)
	at org.jruby.ir.interpreter.Interpreter.INTERPRET_BLOCK(Interpreter.java:128)
	at org.jruby.runtime.MixedModeIRBlockBody.commonYieldPath(MixedModeIRBlockBody.java:151)
	at org.jruby.runtime.IRBlockBody.yieldSpecific(IRBlockBody.java:89)
	at org.jruby.runtime.Block.yieldSpecific(Block.java:134)
	at org.jruby.ir.runtime.IRRuntimeHelpers.yieldSpecific(IRRuntimeHelpers.java:482)
	at org.jruby.ir.instructions.YieldInstr.interpret(YieldInstr.java:76)
	at org.jruby.ir.interpreter.StartupInterpreterEngine.processOtherOp(StartupInterpreterEngine.java:178)
	at org.jruby.ir.interpreter.StartupInterpreterEngine.interpret(StartupInterpreterEngine.java:104)
	at org.jruby.internal.runtime.methods.MixedModeIRMethod.INTERPRET_METHOD(MixedModeIRMethod.java:105)
	at org.jruby.internal.runtime.methods.MixedModeIRMethod.call(MixedModeIRMethod.java:92)
	at org.jruby.ir.runtime.IRRuntimeHelpers.unresolvedSuper(IRRuntimeHelpers.java:1191)
	at uri_3a_classloader_3a_.gems.asciidoctor_minus_pdf_minus_1_dot_5_dot_0_dot_beta_dot_5.lib.asciidoctor_minus_pdf.prawn_ext.extensions.invokeSuper30:-unknown-super-target-(uri:classloader:/gems/asciidoctor-pdf-1.5.0.beta.5/lib/asciidoctor-pdf/prawn_ext/extensions.rb:249)
	at uri_3a_classloader_3a_.gems.asciidoctor_minus_pdf_minus_1_dot_5_dot_0_dot_beta_dot_5.lib.asciidoctor_minus_pdf.prawn_ext.extensions.RUBY$method$font_size$0(uri:classloader:/gems/asciidoctor-pdf-1.5.0.beta.5/lib/asciidoctor-pdf/prawn_ext/extensions.rb:249)

@ahus1 ahus1 self-assigned this Sep 28, 2019
@mojavelinux
Copy link
Member

It seems like this should be an Asciidoctor PDF issue.

I looked at the offending line and I can't see how that would fail. I'll definitely be interested in seeing the test case.

@ahus1
Copy link
Contributor Author

ahus1 commented Sep 28, 2019

For the moment it only appears within IntelliJ, not with any test case outside of it. Once I found out how to reproduce it and we can narrow down the source, we can move the issue.

@mojavelinux
Copy link
Member

I tried it with Asciidoctor PDF using JRuby and with AsciidoctorJ PDF and I don't get a failure in either case.

@ahus1
Copy link
Contributor Author

ahus1 commented Sep 28, 2019

Tracing the error down to the line where it happend, I see that the assert has changed in the latest version of JRuby 9.2.8.0 - see jruby/jruby@43a760d#diff-a5f421af42e54a570765fce7f7504579 - see jruby/jruby#5693. Apparently IntelliJ has asserts enabled when running the IDE.

Although I wasn't able to write a test case to show it stand alone, it fixes the exception occuring in the IDE. I'll see if upgrading JRuby introduces other problems. If it works well, I'll open a PR with AsciidoctorJ next week.

@ahus1
Copy link
Contributor Author

ahus1 commented Sep 30, 2019

@gudaoxuri - I managed to trace down the AssertionError to an issue that was fixed in the latest JRuby release. I've updated the JRuby version included in the plugin and created a new pre-release 0.30.8.

Note: this doesn't relate to the fonts in the PDF. To get CN fonts in the PDF you'll need to specify a theme.

The new pre-release of the plugin is available from GitHub releases and the IntelliJ AsciiDoc EAP repository.

Please give it a try and report problems either in this issue or new issues.

@gudaoxuri
Copy link

@gudaoxuri - I managed to trace down the AssertionError to an issue that was fixed in the latest JRuby release. I've updated the JRuby version included in the plugin and created a new pre-release 0.30.8.

Note: this doesn't relate to the fonts in the PDF. To get CN fonts in the PDF you'll need to specify a theme.

The new pre-release of the plugin is available from GitHub releases and the IntelliJ AsciiDoc EAP repository.

Please give it a try and report problems either in this issue or new issues.

Wonderful, thanks.

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

Successfully merging a pull request may close this issue.

3 participants