jodconverter / jodconverter

JODConverter automates document conversions using LibreOffice or Apache OpenOffice.
https://github.com/jodconverter/jodconverter
Other
1.38k stars 283 forks source link

Why does my document conversion fail when I use jodconverter-local-lo, but it succeeds when I use jodconverter-local? #380

Closed Lampkins closed 3 months ago

Lampkins commented 5 months ago

when I use jodconverter-local-lo to convert documents to PDF, the following errors occur.

<dependency>
    <groupId>org.jodconverter</groupId>
    <artifactId>jodconverter-local-lo</artifactId>
    <version>4.4.4</version>
</dependency>

error logs:

Exception in thread "JCPool-1" java.lang.VerifyError: Stack map does not match the one at exception handler 124
Exception Details:
  Location:
    org/jodconverter/local/task/AbstractLocalOfficeTask.loadDocument(Lorg/jodconverter/local/office/LocalOfficeContext;Ljava/io/File;)Lcom/sun/star/lang/XComponent; @124: astore
  Reason:
    Type 'com/sun/star/lang/IllegalArgumentException' (current frame, stack[0]) is not assignable to 'com/sun/star/uno/Exception' (stack map, stack[0])
  Current Frame:
    bci: @13
    flags: { }
    locals: { 'org/jodconverter/local/task/AbstractLocalOfficeTask', 'org/jodconverter/local/office/LocalOfficeContext', 'java/io/File', 'com/sun/star/frame/XComponentLoader' }
    stack: { 'com/sun/star/lang/IllegalArgumentException' }
  Stackmap Frame:
    bci: @124
    flags: { }
    locals: { 'org/jodconverter/local/task/AbstractLocalOfficeTask', 'org/jodconverter/local/office/LocalOfficeContext', 'java/io/File', 'com/sun/star/frame/XComponentLoader' }
    stack: { 'com/sun/star/uno/Exception' }
  Bytecode:
    0x0000000: 2bb9 0011 0100 4e2d 1212 b800 132a b600
    0x0000010: 143a 042d 2cb8 0015 1216 0319 04b8 0017
    0x0000020: b900 1805 003a 052a 1905 1904 b700 1919
    0x0000030: 05bb 001a 59b7 001b 121d b600 1e2c b600
    0x0000040: 1fb6 001e b600 20b8 0013 1905 b03a 04bb
    0x0000050: 0022 59bb 001a 59b7 001b 121d b600 1e2c
    0x0000060: b600 1fb6 001e 1223 b600 1e19 04b4 0024
    0x0000070: b600 25b6 0020 1904 b700 26bf 3a04 bb00
    0x0000080: 2259 bb00 1a59 b700 1b12 1db6 001e 2cb6
    0x0000090: 001f b600 1eb6 0020 1904 b700 26bf     
  Exception Handler Table:
    bci [13, 76] => handler: 77
    bci [13, 76] => handler: 124
    bci [13, 76] => handler: 124
  Stackmap Table:
    full_frame(@77,{Object[#101],Object[#116],Object[#117],Object[#118]},{Object[#119]})
    same_locals_1_stack_item_frame(@124,Object[#120])

    at org.jodconverter.local.LocalConverter$LocalConversionJob.doExecute(LocalConverter.java:162)
    at org.jodconverter.core.job.AbstractConversionJob.execute(AbstractConversionJob.java:62)

But I can successfully convert documents to PDF when using jodconverter-local.

<dependency>
    <groupId>org.jodconverter</groupId>
    <artifactId>jodconverter-local</artifactId>
    <version>4.4.4</version>
</dependency>
sbraconnier commented 3 months ago

Well, when you use jodconverter-local (or jodconverter-local-oo), jodconverter is used with the org.openoffice artifacts:

- org.openoffice:juh:$ooVersion
- org.openoffice:jurt:$ooVersion
- org.openoffice:ridl:$ooVersion
- org.openoffice:unoil:$ooVersion

while when you use jodconverter-local-lo, jodconverter is used with the org.libreoffice artifacts:

- org.libreoffice:libreoffice:$loVersion

There are some slight differences between the 2 implementations that lead to problems whether you use jodconverter with LibreOffice or OpenOffice (you hit one of these problems). Some older versions of LibreOffice must be used with the openoffice dependencies.