king
I'm new here

Exception handling during FirstSpirit module installation

Dear Community,

it's really a pity that the following interface:

  • de.espirit.firstspirit.module.Component

does not offer a proper exception handling in the following methods:

  • installed()
  • uninstalling()
  • updated()

Up to now, only:

  • RuntimeExceptions

might be thrown due to the lack of the "throws" clause in the upper methods. But even RuntimeException do not lead to a GUI feedback. So, the administrator does not now, whether the module installation process passed successfully or not.

That's really bad. Or is there an alternative available??

0 Kudos
6 Replies
Peter_Jodeleit
Crownpeak employee

What type of exception do you expect in the throws clause of the mentioned methods? If you have some 'expected' exceptions in your implementation why should FirstSpirit handle them?

Runtime exceptions thrown in one of the methods should display a dialog in the client. And the trace should then appear in the log dialog.

Peter
0 Kudos

Hi Peter,

I would expect something like a custom:

  • InstallationException

in the throws clause of the methods. This would allow informing the clients when an exception occurred.

When RuntimeExceptions are thrown, actually nothing happens Smiley Sad. In case of IllegalStateExceptions for instance, no dialog appears in the AdminClient. We just observed a GUI feedback in case of a NullPointerException.

0 Kudos

I just build a module throwing an IllegalStateException in the methods mentioned above. I see the exceptions are logged and an error dialog popping up in the admin client, so everything is ok here. I tested with a current build, but should be the same with the released build (4.2.454 as time of writing).

Peter
0 Kudos

Dear Peter,

with the following code enclosed, we tried to provoke an upcoming dialog box showing an exception during a project component installation run within the FirstSpirit Server and project configuration client:

@Override

public void installed() {

    UserService service = getProject().getUserService();

    TemplateStoreRoot templateStore = service.getTemplateStore();

    /*

     * path separator in ZIP files (here: bosch.fsm) is always a slash:

     * independent of the OS!!!

     */

    try {

        importPackage(FILES + "/" + GROUP_SCRIPT_EXPORT,

        templateStore.getScripts(), "imports.xml");

    } catch (ElementDeletedException e) {

        throw new IllegalStateException(e.getMessage());

    } catch (WorkflowLockException e) {

        throw new IllegalStateException(e.getMessage());

    } catch (IOException e) {

        throw new IllegalStateException(e.getMessage());

    } catch (LockException e) {

        throw new IllegalStateException(e.getMessage());

    }

}

The problem: nothing happened. Did we implement it in the wrong manner?

0 Kudos

Hi Holger,

sorry but my tests are too long ago. I cannot remember my code Smiley Wink

I'll check again when I've got some spare time.

Until then: Against which FirstSpirit version did you check your code?

--Peter

Peter
0 Kudos

Hi Peter,

against FirstSpirit FS 4.2 R4 468. The important thing: here, it is a FirstSpirit project component installation that should handle the unchecked RuntimeExceptions here.

0 Kudos