Load Java scripts with class loaders

Bug #1097744 reported by Björn Michaelsen on 2013-01-09
6
This bug affects 1 person
Affects Status Importance Assigned to Milestone
LibreOffice
Fix Released
Critical
libreoffice (Ubuntu)
Undecided
Björn Michaelsen

Bug Description

On LibreOffice 3.5, see fdo#46102 for details

Created attachment 57095
Scriptdispatch.oxt

with lo3.5 it is not possible to install script dispatch java extension.

steps to reproduce:

- try to install attached *.oxt from command line:

  unopkg add ScriptDispatch.oxt --shared --verbose

  [...]
  ERROR: Fehler beim Aktivieren von: ScriptDispatch
   Cause: (com.sun.star.lang.IllegalArgumentException) { {
   Message = "Failed to register package
   for vnd.sun.star.expand:$UNO_SHARED_PACKAGES_CACHE/
   uno_packages/lu145p4x.tmp_/ScriptDispatch.oxt/
   ScriptDispatch/", Context = (com.sun.star.uno.XInterface) @0 },
   ArgumentPosition = (short) 2 }
unopkg failed.
?????????????????????

with lo 3.4.5 same *.oxt can be installed without any problems.
to verify, open attached "StartScriptDispatch.odt" and press button.

Created attachment 57096
StartScriptDispatch.odt

Confirm. Also, preinstalled Java macroses (/opt/libreoffice3.5/share/Scripts/java) do not appear in the "Run Macro..." dialog (menu Tools/Macros/Run Macro...)

why is this bug not fixed in lo3.5.1?

I wonder if it is related to removing of the 3-layer structure.

It affects an extensions that is not installed by default => It most likely affects only limited group of users => It can't block the release => lowering the severity a bit.

Rather a regression introduced with gbuild'ification; ScriptProviderForJava.jar no longer contains a RegistrationClassName in its META-INF/MANIFEST.MF.

Also I do not see /opt/libreoffice3.5/share/extensions/script-provider-for-javascript. I am not sure if it is not longer needed.

> ScriptProviderForJava.jar no longer contains a
> RegistrationClassName in its META-INF/MANIFEST.MF.

using "ScriptProviderForJava.jar" from lo3.4.5 works for me

(In reply to comment #6)
> Also I do not see
> /opt/libreoffice3.5/share/extensions/script-provider-for-javascript. I am not
> sure if it is not longer needed.

The script providers for Java (BeanShell) and JavaScript are not implemented as .oxt extensions (unlike the script provider for Python), so do not end up in share/extensions/.

So will it be fixed for 3.5.2 ? Added to most annoying 3.5 bugs ?

Alex

bugfix should be quite simple:

take "MANIFEST.MF" from lo3.4.6 and copy
into META-INF/MANIFEST.MF from lo 3.5.1's
"ScriptProviderForJava.jar"

<http://cgit.freedesktop.org/libreoffice/core/commit/?id=91d60be7eeafa1f7872bda452bfb38936003f517> "fdo#46102: Fix scripting jar manifests after gbuild'ification" fixes the META-INF/MANIFEST.MF files of the various Script*.jar. However, this is not enough to make Java scripts actually work. (However, it apparently suffices to make this issue's original problem of a failing unopkg add go away -- even if subsequent testing of StartScriptDispatch.odt fails.)

Stephan Bergmann committed a patch related to this issue.
It has been pushed to "master":

http://cgit.freedesktop.org/libreoffice/core/commit/?id=dd6c4f4db1d62268d73e09ae52d23f760a967dcc

fdo#46102: Load Java scripts with class loaders that actually find them

Stephan Bergmann committed a patch related to this issue.
It has been pushed to "master":

http://cgit.freedesktop.org/libreoffice/core/commit/?id=0b9fda25f321ce2697179064e330843237177668

fdo#46102: Fix Java script examples after gbuild'ification

@brinzing: With the above three commits, Java scripts in general work again (and esp. the preinstalled examples mentioned in comment 2).

However, your attached ScriptDispatch.oxt/StartScriptDispatch.odt still do not work for, but do not work for me in LO 3.4.5, either. In both versions I get an
error message "Cannot resolve script location for script = org.test.java.ScriptDispatch.execute."

I'm intending these fixes for inclusion in LO 3.5.x, potentially even still LO 3.5.2, see <http://lists.freedesktop.org/archives/libreoffice/2012-March/028759.html> "[REVIEW-3-5][REVIEW-3-5-2?] fdo#46102 script dispatch java extensions are broken."

you have to install the "ScriptDispatch.oxt" with "--shared" option, for example:

 unopkg add ScriptDispatch.oxt --shared --verbose

cause the command button url contains the location "share":

vnd.sun.star.script:ScriptDispatch.org.test.java.ScriptDispatch.execute?language=Java&location=share:uno_packages/ScriptDispatch.oxt"

OK, then it indeed works on my LO master.

Stephan Bergmann committed a patch related to this issue.
It has been pushed to "libreoffice-3-5":

http://cgit.freedesktop.org/libreoffice/core/commit/?id=c1b9cd2471162f9bf365be4ab7c1d236c4e8e32d&g=libreoffice-3-5

fdo#46102: Fix scripting jar manifests after gbuild'ification

It will be available in LibreOffice 3.5.3.

Stephan Bergmann committed a patch related to this issue.
It has been pushed to "libreoffice-3-5":

http://cgit.freedesktop.org/libreoffice/core/commit/?id=de5e886382f829176a55eefeda98d31e27672cc8&g=libreoffice-3-5

fdo#46102: Load Java scripts with class loaders that actually find them

It will be available in LibreOffice 3.5.3.

Stephan Bergmann committed a patch related to this issue.
It has been pushed to "libreoffice-3-5":

http://cgit.freedesktop.org/libreoffice/core/commit/?id=a6604b06a1d5ff997c38b27c7860f20f48e302d3&g=libreoffice-3-5

fdo#46102: Fix Java script examples after gbuild'ification

It will be available in LibreOffice 3.5.3.

Stephan Bergmann committed a patch related to this issue.
It has been pushed to "libreoffice-3-5-2":

http://cgit.freedesktop.org/libreoffice/core/commit/?id=addffddbc4acf9745e6bfeba322d6488b3c12605&g=libreoffice-3-5-2

fdo#46102: Fix scripting jar manifests after gbuild'ification

It will be available already in LibreOffice 3.5.2.

Stephan Bergmann committed a patch related to this issue.
It has been pushed to "libreoffice-3-5-2":

http://cgit.freedesktop.org/libreoffice/core/commit/?id=a9caee65b7c76e54b2362ded366075249d0f858d&g=libreoffice-3-5-2

fdo#46102: Fix Java script examples after gbuild'ification

It will be available already in LibreOffice 3.5.2.

Stephan Bergmann committed a patch related to this issue.
It has been pushed to "libreoffice-3-5-2":

http://cgit.freedesktop.org/libreoffice/core/commit/?id=a574a38a73b252498ac061dcf08d96a84b48b6af&g=libreoffice-3-5-2

fdo#46102: Load Java scripts with class loaders that actually find them

It will be available already in LibreOffice 3.5.2.

I added Fix submitter as assignee because this will ease queries and bug tracking.

Looks like <http://cgit.freedesktop.org/libreoffice/core/commit/?id=dd6c4f4db1d62268d73e09ae52d23f760a967dcc> "fdo#46102: Load Java scripts with class loaders that actually find them" was not necessary after all and rather caused new regressions, see bug 49517.

Changed in libreoffice (Ubuntu):
status: New → In Progress
assignee: nobody → Björn Michaelsen (bjoern-michaelsen)
Changed in df-libreoffice:
importance: Unknown → Critical
status: Unknown → Fix Released

lp#1097744: released on Fedora 17 and upstream, revert of hurting commit by original author

Changed in libreoffice (Ubuntu):
status: Fix Committed → Fix Released
To post a comment you must log in.
This report contains Public information  Edit
Everyone can see this information.

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.