Bug 754199

Summary: AS7 plugin: fix exception handling and remove all output to stdout or stderr
Product: [Other] RHQ Project Reporter: Ian Springer <ian.springer>
Component: PluginsAssignee: Libor Zoubek <lzoubek>
Status: CLOSED CURRENTRELEASE QA Contact: Mike Foley <mfoley>
Severity: medium Docs Contact:
Priority: high    
Version: 4.2CC: ccrouch, hrupp, theute
Target Milestone: ---   
Target Release: RHQ 4.3.0   
Hardware: All   
OS: All   
Fixed In Version: Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2013-08-31 06:15:50 EDT Type: ---
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: --- RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: ---
Bug Depends On:    
Bug Blocks: 707223, 745494    

Description Ian Springer 2011-11-15 12:09:04 EST
The AS7 plugin contains 7 instances of:

        } catch (Exception e) {
            e.printStackTrace(); // TODO: Customise this generated block

Plugins should never output to stdout or stderr, but should instead use a logger. Otherwise, when exceptions occur, users will get stack traces dumped into their agent command prompt (this just happened to me).

Also, any calls to System.out.println() or System.err.println() should be replaced with logging (I see a call to System.out.println() in JmsComponent).

Note, in discovery components, we should make sure to use the following format for exception handling to make sure an exception during discovery of one resource does not prevent discovery of other resources:

        Set<DiscoveredResourceDetails> discoveredResources = new HashSet<DiscoveredResourceDetails>();
        List<ProcessScanResult> processes = discoveryContext.getAutoDiscoveredProcesses();
        for (ProcessScanResult process : processes) {
            try {
               // do discovery ...
            } catch (Exception e) {
               // log and continue on to next process
               log.error("Failed to discover AS instance for process " + process, e);

        return discoveredResources;
Comment 1 Heiko W. Rupp 2011-11-16 07:04:55 EST
d5c745a in master
Comment 4 Heiko W. Rupp 2013-08-31 06:15:50 EDT
Bulk close of old bugs in VERIFIED state.