Add better checking of reflection errors

At various places dCache uses reflection for creating objects and
invoking methods of an object.  These calls can result in an
InvocationTargetException if the object's code (constructor or
method) throws some Throwable, with the cause being wrapped inside
the InvocationTargetException.

There are several potential problems with InvocationTargetException
handling:

  1.  An Error is thrown during object construction or method
      invocation that is subsequently lost.  Normally dCache
      will shutdown if the Error is a VirtualMachineError.  If
      the Error is lost then dCache could continue trying to
      run in an inconsistant state, which is dangerous.

  2.  A runtime exception (i.e., a bug) is lost.  Such problems
      become difficult to identify and fix as no stack-trace is
      generated.

  3.  The message and stack-trace of the InvocationTargetException
      have little use; the important information is the underlying
      cause of the InvocationTargetException.  If this is not
      reported then debugging the underlying problem is impossible.

The current approach within dCache for handling InvocationTargetExceptions
is inconsistent and error-prone.

This patch introduces a utility method for handling an Exception that
might include an InvocationTargetException.  It returns an Exception
that is either the supplied Exception (if not an
InvocationTargetException) or the cause of the InvocationTargetException.
If the cause is an Error then this is always re-thrown by the method.
If the cause is a RuntimeException then the behaviour is configurable:
either the RuntimeException is thrown or returned.

Target: master
Requires-book: no
Requires-notes: no