jodconverter / jodconverter

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

Got error when using org.jodconverter:jodconverter-local-lo #309

Closed yangyaofei closed 1 year ago

yangyaofei commented 2 years ago

The error like #113

I try libreoffice 7.4.0 or newer got same error: OS: macos with jdk11

[INFO ] 2022-10-08 11:15:42,994 method:org.jodconverter.local.office.OfficeDescriptor.fromExecutablePath(OfficeDescriptor.java:110)
soffice info (from exec path): Product: LibreOffice - Version: ??? - useLongOptionNameGnuStyle: true
/var/folders/dp/x117ssv11xzbycq5tnh7fzdm0000gn/T/NLPIR94117479224535084
Test DOC -> PDF File: /test1.doc 
Oct 08, 2022 11:15:43 AM io.grpc.internal.SerializeReentrantCallsDirectExecutor execute
SEVERE: Exception while executing runnable io.grpc.internal.ServerImpl$JumpToApplicationThreadServerStreamListener$1HalfClosed@39dcf4b0
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:
    0000000: 2bb9 0011 0100 4e2d 1212 b800 132a b600
    0000010: 143a 042d 2cb8 0015 1216 0319 04b8 0017
    0000020: b900 1805 003a 052a 1905 1904 b700 1919
    0000030: 05bb 001a 59b7 001b 121d b600 1e2c b600
    0000040: 1fb6 001e b600 20b8 0013 1905 b03a 04bb
    0000050: 0022 59bb 001a 59b7 001b 121d b600 1e2c
    0000060: b600 1fb6 001e 1223 b600 1e19 04b4 0024
    0000070: b600 25b6 0020 1904 b700 26bf 3a04 bb00
    0000080: 2259 bb00 1a59 b700 1b12 1db6 001e 2cb6
    0000090: 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)

Should I use org.jodconverter:jodconverter-local ? or What I'm doing wrong?

artb1sh commented 2 years ago

bump i have same problem @sbraconnier

gboucherie commented 2 years ago

Hi, I have the same problem today. I think it occurs only when the AbstractLocalOfficeTask#loadDocument() failed and try to catch an IllegalArgumentException (the one coming from openoffice com.sun.star.lang) I open the source code of jodconverter in my IntellIJ and I think the libreoffice and openoffice are not compatible at some point. The IllegalArgumentException in LibreOffice extends RuntimeException (com.sun.star.uno), and the one coming from OpenOffcie extends Exception (com.sun.star.uno)

wybrandvdmeer commented 1 year ago

I got also the same error. It happens in the LocalConverter.doExecute() function when a new LocalConversionTask is started:

  // Create a default conversion task and execute it
  final LocalConversionTask task =
      new LocalConversionTask(source, target, loadProperties, filterChain, storeProperties);

When I run the openoffice lib, I dont get this error.

sbraconnier commented 1 year ago

Sorry for the delay. I finally got time to work on this and I successfully reproduced the issue. It's now my 1rst priority.