Bug 210537 - [api] Review why ISystemHostPool methods throw exceptions
Summary: [api] Review why ISystemHostPool methods throw exceptions
Status: RESOLVED FIXED
Alias: None
Product: Target Management
Classification: Tools
Component: RSE (show other bugs)
Version: 3.0   Edit
Hardware: All All
: P3 enhancement (vote)
Target Milestone: 3.0 M4   Edit
Assignee: David Dykstal CLA
QA Contact: Martin Oberhuber CLA
URL:
Whiteboard:
Keywords: api
Depends on:
Blocks:
 
Reported: 2007-11-21 10:23 EST by Martin Oberhuber CLA
Modified: 2007-12-18 15:22 EST (History)
0 users

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Martin Oberhuber CLA 2007-11-21 10:23:45 EST
Looking at the SystemHostPool implementation, it turns out that none of the ISystemHostPool methods can actually throw exceptions, although they are declared to do so.

API and implementation should be reviewed what is intended behavior, and under what circumstances the exceptions are expected to be thrown. API docs should be updated accordingly, and "throws" clauses in the interfaces removed if it turns out that we do not really want exceptions to be thrown.
Comment 1 Martin Oberhuber CLA 2007-11-21 10:28:28 EST
At the same time, this code in SystemHostPool line 108 should also be reviewed:

  try {
      //FIXME Class Javadocs say that SystemHostPool is not persisted,
      //so this should be removed! Or should we get the pool contents by
      //restoring the profile instead?
      pool.restore(); // restore connections
  } catch (Exception exc) {
  }

Apart from not really doing anything in restore(), catching away all exceptions in a method that is declared to throw exceptions seems not the right thing.
Comment 2 David Dykstal CLA 2007-12-18 13:41:29 EST
I think throwing "Exception" is weak engineering. If we throw anything it should be something RSEException or SystemException that either translates or wraps the reason - perhaps as an IStatus.

If we can't really throw anything these exceptions should be removed from the signatures. My guess is that they were there when SystemHostPool was implemented with EMF.
Comment 3 David Dykstal CLA 2007-12-18 15:22:27 EST
Removed Exception throwing from ISystemHostPool. Propagated changes to SystemHostPool and SystemRegistry where necessary.

Fixed the restore() method as outlined by Martin.

SystemRegistry should probably be revamped to throw something other than Exception.