FrameworkMBean does not log/relay error info
--------------------------------------------

                 Key: ARIES-179
                 URL: https://issues.apache.org/jira/browse/ARIES-179
             Project: Aries
          Issue Type: Bug
          Components: JMX
            Reporter: Thomas Diesler


Various operations on the Framework don't log nor relay what went wrong in case 
of error.

The typical pattern is 

    public long installBundle(String location) throws IOException {
        try {
            Bundle bundle = context.installBundle(location);
            return bundle.getBundleId();
        } catch (BundleException be) {
           throw new IOException("Can't install bundle with location: " + 
location);
        }
    }

Instead, I suggest an approach like this

    public long installBundle(String location) throws IOException {
        try {
            Bundle bundle = context.installBundle(location);
            return bundle.getBundleId();
        } catch (BundleException be) {
           IOException ioex = new IOException("Can't install bundle with 
location: " + location);
           ioex.initCause(be);
           throw ioex;
        }
    }

Alternatively, this would also work 

    public long installBundle(String location) throws IOException {
        try {
            Bundle bundle = context.installBundle(location);
            return bundle.getBundleId();
        } catch (BundleException be) {
           log.error("Can't install bundle with location: " + location, be) 
           throw new IOException("Can't install bundle with location: " + 
location);
        }
    }


-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.

Reply via email to