Hello, I am creating a custom smart service to convert .odt file to .pdf fi

Hello,
I am creating a custom smart service to convert .odt file to .pdf file.I am using xdocReport lib for that.
My code:
String inputFilename = cs.getInternalFilename(inputDocument);
FileInputStream in= new FileInputStream(new File(inputFilename));
OdfTextDocument document = OdfTextDocument.loadDocument(in); // getting error at this line          
PdfOptions options = PdfOptions.create();
OutputStream out = new FileOutputStream(new File(outputFilename));
PdfConverter.getInstance().convert(document, out, options);

It works properly as a standalone java class but when I create a smart service it gives me error like:

ava.lang.VerifyError: (class: org/odftoolkit/odfdom/pkg/OdfPackage, method: getDom signature: (Ljava/lang/String;)Lorg/w3c/dom/Document;) Incompatible object argument for function call
2013-09-12 15:08:22,457 ERROR [STDERR] (WorkManager(2)-88) at org.odftoolkit.odfdom.doc.OdfDocument.loadDocument(OdfDocument.java:219)
it is giving error at load...

OriginalPostID-81081

OriginalPostID-81081

  Discussion posts and replies are publicly visible

Parents
  • Okay, couple of things to test. Since you're telling me that you have independently tested this and it works, I would assume that the issue is retrieving the content from CS. Let's do this.
    First, check that you're injecting the content service and setting the value in the constructor. Next, put logging and find out what the cs holds and also check what cs.getinternalversion.... etc., returns.
    When you retrieve a document, it will return an Array. Ensure you get document[0] and put a log around this to ensure that the values are coming through.
    Let's see what the log says and take it from there.
Reply
  • Okay, couple of things to test. Since you're telling me that you have independently tested this and it works, I would assume that the issue is retrieving the content from CS. Let's do this.
    First, check that you're injecting the content service and setting the value in the constructor. Next, put logging and find out what the cs holds and also check what cs.getinternalversion.... etc., returns.
    When you retrieve a document, it will return an Array. Ensure you get document[0] and put a log around this to ensure that the values are coming through.
    Let's see what the log says and take it from there.
Children
No Data