6

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?

CSharpenter
  • 722
  • 8
  • 21
  • By the way, the quotation is from the book UML 2.0 in a nutshell, and can be found at http://flylib.com/books/en/4.282.1.66/1/ – CSharpenter Jan 13 '11 at 10:13

1 Answers1

4

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.

JTMon
  • 3,189
  • 22
  • 24
  • Interesting, never thaught of it in that direction. Thanks for your response, I'm surely going to try it after waiting so much time for an answer to my question. Thanks again. – CSharpenter May 07 '12 at 11:57