Bug 99668 - UNO: API Java example won't run (ArrayOutOfBounds)
Summary: UNO: API Java example won't run (ArrayOutOfBounds)
Status: NEW
Alias: None
Product: LibreOffice
Classification: Unclassified
Component: framework (show other bugs)
Version:
(earliest affected)
5.1.2.2 release
Hardware: x86-64 (AMD64) Linux (All)
: medium normal
Assignee: Not Assigned
URL:
Whiteboard:
Keywords:
Depends on:
Blocks: Java-Runtime-JRE
  Show dependency treegraph
 
Reported: 2016-05-04 09:09 UTC by Daniel Brenzel
Modified: 2022-12-27 21:55 UTC (History)
4 users (show)

See Also:
Crash report or crash signature:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Daniel Brenzel 2016-05-04 09:09:48 UTC
Since some time I tried to convert office files to PDF. The libre office command-line args doesn't block until the process is finished so I had to search another solution for converting in Java. 

After some Problems with dlls (solved) I get the API started. But in the Java example from: http://api.libreoffice.org/examples/java/DocumentHandling/DocumentConverter.java
has a bug. First you need 4 cli arguments(only 3 are requiered). additionally the System.outs need to be updatet for the fourth argument. 

I put the following arguments to the program:

"/home/user/projects/test" "pdf" "pdf"  "/tmp/"

 I got an other error:

com.sun.star.task.ErrorCodeIOException: SfxBaseModel::impl_store <file:////tmp/File.pdf> failed: 0x81a
	at com.sun.star.lib.uno.environments.remote.Job.remoteUnoRequestRaisedException(Job.java:160)
	at com.sun.star.lib.uno.environments.remote.Job.execute(Job.java:124)
	at com.sun.star.lib.uno.environments.remote.JobQueue.enter(JobQueue.java:319)
	at com.sun.star.lib.uno.environments.remote.JobQueue.enter(JobQueue.java:288)
	at com.sun.star.lib.uno.environments.remote.JavaThreadPool.enter(JavaThreadPool.java:80)
	at com.sun.star.lib.uno.bridges.java_remote.java_remote_bridge.sendRequest(java_remote_bridge.java:617)
	at com.sun.star.lib.uno.bridges.java_remote.ProxyFactory$Handler.request(ProxyFactory.java:144)
	at com.sun.star.lib.uno.bridges.java_remote.ProxyFactory$Handler.invoke(ProxyFactory.java:128)
	at com.sun.proxy.$Proxy5.storeAsURL(Unknown Source)
	at DocumentConverter.traverse(DocumentConverter.java:136)
	at DocumentConverter.main(DocumentConverter.java:215)
	at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
	at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
	at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
	at java.lang.reflect.Method.invoke(Method.java:498)
	at com.intellij.rt.execution.application.AppMain.main(AppMain.java:144)
Comment 1 Julien Nabet 2016-05-04 21:37:29 UTC
I'm not sure to understand your test.
You noticed (and I agree you), that DocumentConverter needs 4 args, not 3.
But you tried this:
"/home/user/projects/test" "pdf" "pdf"  "/tmp/"
(your program with 3 args)
What about this:
"/home/user/projects/test" "<directory which contain original files>" "pdf" "pdf"  "/tmp/"
?

For the moment the only patch would be:
diff --git a/odk/examples/java/DocumentHandling/DocumentConverter.java b/odk/examples/java/DocumentHandling/DocumentConverter.java
index fe0460c..022ae4d 100644
--- a/odk/examples/java/DocumentHandling/DocumentConverter.java
+++ b/odk/examples/java/DocumentHandling/DocumentConverter.java
@@ -170,7 +170,7 @@ public class DocumentConverter {
      *             and the wanted extension
      */
     public static void main( String args[] ) {
-        if ( args.length < 3 ) {
+        if ( args.length < 4 ) {
             System.out.println("usage: java -jar DocumentConverter.jar " +
                 "\"<directory to convert>\" \"<type to convert to>\" " +
                 "\"<extension>\" \"<output_directory>\"");
@@ -207,7 +207,7 @@ public class DocumentConverter {
             // origin document
             sExtension = args[2];
 
-            // Getting the given type to convert to
+            // Getting the output directory
             sOutputDir = args[3];
 
             // Starting the conversion of documents in the given directory

Stephan: since it concerns UNO+Java, thought you might be interested in this one.
Comment 2 QA Administrators 2017-05-22 13:40:17 UTC Comment hidden (obsolete)
Comment 3 QA Administrators 2019-12-03 15:01:39 UTC Comment hidden (obsolete)
Comment 4 QA Administrators 2021-12-03 04:46:49 UTC
Dear Daniel Brenzel,

To make sure we're focusing on the bugs that affect our users today, LibreOffice QA is asking bug reporters and confirmers to retest open, confirmed bugs which have not been touched for over a year.

There have been thousands of bug fixes and commits since anyone checked on this bug report. During that time, it's possible that the bug has been fixed, or the details of the problem have changed. We'd really appreciate your help in getting confirmation that the bug is still present.

If you have time, please do the following:

Test to see if the bug is still present with the latest version of LibreOffice from https://www.libreoffice.org/download/

If the bug is present, please leave a comment that includes the information from Help - About LibreOffice.
 
If the bug is NOT present, please set the bug's Status field to RESOLVED-WORKSFORME and leave a comment that includes the information from Help - About LibreOffice.

Please DO NOT

Update the version field
Reply via email (please reply directly on the bug tracker)
Set the bug's Status field to RESOLVED - FIXED (this status has a particular meaning that is not 
appropriate in this case)


If you want to do more to help you can test to see if your issue is a REGRESSION. To do so:
1. Download and install oldest version of LibreOffice (usually 3.3 unless your bug pertains to a feature added after 3.3) from https://downloadarchive.documentfoundation.org/libreoffice/old/

2. Test your bug
3. Leave a comment with your results.
4a. If the bug was present with 3.3 - set version to 'inherited from OOo';
4b. If the bug was not present in 3.3 - add 'regression' to keyword


Feel free to come ask questions or to say hello in our QA chat: https://web.libera.chat/?settings=#libreoffice-qa

Thank you for helping us make LibreOffice even better for everyone!

Warm Regards,
QA Team

MassPing-UntouchedBug