Exception Classes

After creating a number of classes in a class diagram, I generated the source code (in Java). In the body of each method in the source code was a throw new of type “UnsupportedOperationException.” I have two questions about this…

  1. Why is the code generation putting this line in the source code for each method?

  2. Is there a way in the diagram to specify which exceptions a method does throw so that this can be included in the signature of the method in the generated code?

– Levi

I would like to know the same thing.

Dear Levi,

  1. This exception is required for methods that return values (such that the generated code can be compiled). It also generated for methods that return void for consistency.

  2. Specifying what exceptions a method will throw is not currently supported. We will consider supporting this feature, thank you for your suggestion.




I have a number of issues with your comments.

  1. I do not want to see any exceptions that I did not specify to appear in generated code, it is unacceptable
  2. I do not want to go thru my entire code base and manually delete exceptions that your tool is inserting.
  3. Everytime I regenerate my code your tool will insert code that I do not want !!!
  4. How can I possibly use this tool to model->generate code->update code manually->go back to my model with any sort of “happy” feeling that everything is how I want it to be.

Note: I used Together Control Center and those guys leave me very happy that whatever I create is how it stays without adding anything that I do not want.

VP is just not ready for prime time in my opinion

Thanks your comment.

We should conside to let user to enable / disable the dummy body code.

Hope this document can help you.

(This document will be updated to version 2.0 soon)


I am having the same issue in my generated Java code: throw new UnsupportedOperationException();

I see this was reported in 2005. Is there a fix for this now?



My error. This is not a problem.