[Solved] com.sun.star.lang.WrappedTargetException

Creating a macro - Writing a Script - Using the API

[Solved] com.sun.star.lang.WrappedTargetException

Postby owlbrudder » Wed Aug 02, 2017 5:04 am

I have moved a dialog from the code module associated with a document, into a library I am creating. It used to work fine, but now calling it from my document module throws:
Code: Select all   Expand viewCollapse view
Error 1: An exception occurred
Type: com.sun.star.lang.WrappedTargetException
Message:
TargetException:
  Type: com.sun.star.script.LibraryNotLoadedException
  Message: .
At line : 33
02/08/2017 12:40:54


The dialog is in the library basPrinting and the library code can be run successfully independently, but fails when I call it from a module external to the library.

Here is my library code:
Code: Select all   Expand viewCollapse view
ShowListPrinters
...
   dlgThis = CreateUnoDialog(DialogLibraries.basPrinting.dlgListPrinters)
...


and this is how I call it:
Code: Select all   Expand viewCollapse view
   if Not Globalscope.BasicLibraries.isLibraryLoaded("basPrinting") Then
      Globalscope.BasicLibraries.loadLibrary("basPrinting")
   End If

      Dim strPrinter As String
      Dim boolGoodPrinter As Boolean
      
      boolGoodPrinter = False
      
      While boolGoodPrinter = False
         strPrinter = ShowListPrinters
...


It must be something to do with the external call, but all my other external calls to the library, none of which need dialogs, work fine.

Any ideas would be very welcome.

Kind regards,
Doug
Last edited by owlbrudder on Wed Aug 02, 2017 9:58 am, edited 3 times in total.
LibreOffice Version: 5.3.3.0
Fedora 26 Linux x86_64
Core i7, 8Gb
owlbrudder
 
Posts: 93
Joined: Tue Nov 08, 2016 8:04 am

Re: com.sun.star.lang.WrappedTargetException

Postby owlbrudder » Wed Aug 02, 2017 5:20 am

I moved the dialog out of the library and back to my module. Didn't work. Moved the dialog from the module back to the library. Now it's working fine.

I HATE TRANSIENT BUGS! :crazy:
LibreOffice Version: 5.3.3.0
Fedora 26 Linux x86_64
Core i7, 8Gb
owlbrudder
 
Posts: 93
Joined: Tue Nov 08, 2016 8:04 am

Re: com.sun.star.lang.WrappedTargetException

Postby owlbrudder » Wed Aug 02, 2017 7:00 am

NOT fixed.

1. If I exit LO then restart my application, I always get the WrappedTargetException.

2. If I either a) run the dialog directly from the library, or b) move the dialog from the library to the module then back to the library, everything works fine.

Thus, I can only use the application if I intervene in some way, which is sub-optimal.

Any suggestions?
"8-(
LibreOffice Version: 5.3.3.0
Fedora 26 Linux x86_64
Core i7, 8Gb
owlbrudder
 
Posts: 93
Joined: Tue Nov 08, 2016 8:04 am

Re: com.sun.star.lang.WrappedTargetException

Postby owlbrudder » Wed Aug 02, 2017 9:58 am

Fixed by executing Globalscope.DialogLibraries.loadLibrary("basPrinting") prior to attempting to use it; in other words, I had loaded the Basic library but not the Dialog library.
LibreOffice Version: 5.3.3.0
Fedora 26 Linux x86_64
Core i7, 8Gb
owlbrudder
 
Posts: 93
Joined: Tue Nov 08, 2016 8:04 am


Return to Macros and UNO API

Who is online

Users browsing this forum: No registered users and 9 guests