Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Uncertain about exception handling in UML 2.0 Activity Diagram

HI, I recently was reverse engineering a certain project to UML, and was stuck at a point where I could not reach a conclusion. The code is fairly simple:

            ...
            try
            {
                sj = SendingJob.DeserializeXmlString("....");
                trcSrc.TraceInfo("....");
            }
            catch (FormatException)
            {
                trcSrc.TraceError("....");

                return "00 - Job Content Bad Format.";
            } ...

Firts off I modeled the code as such:


alt text


But after reading the following text:

"If an exception occurs while an action is executing, the execution is abandoned and there is no output from the action. If the action has an exception handler, the handler is executed with the exception information. When the exception handler executes, its output is available to the next action after the protected node, as though the protected node had finished execution."

... but the thing is my exception handler exits the catch block by returning a value, and stopping the activity. I tried to link the exception node to an activity final node, but my tool refuses to do it, and which I'm pretty sure is not the correct way to do it.

So my question is: How to model an activity diagram where an action throws an exception and its handler terminates the activity?

like image 856
CSharpenter Avatar asked Jan 13 '11 08:01

CSharpenter


People also ask

Can we represent exception handling by activity diagram?

Exception Handlers can be modelled on activity diagrams as in the example below.

What is exception in UML?

In the UML, an exception is a specialization of a signal, which is the specification of an asynchronous communication between objects. This means that in interaction diagrams, exceptions are illustrated as asynchronous messages.


1 Answers

As I am not allowed to post images yet I'll try to describe my solution :) In your exception handler, include an action that represents what it does. You can then link that action to the termination node of the activity diagram.

like image 100
JTMon Avatar answered Jan 03 '23 17:01

JTMon