Bug 1138805 - remote agent install gets NPE during port check
Summary: remote agent install gets NPE during port check
Status: CLOSED CURRENTRELEASE
Alias: None
Product: JBoss Operations Network
Classification: JBoss
Component: Core Server
Version: JON 3.3.0
Hardware: Unspecified
OS: Unspecified
unspecified
unspecified
Target Milestone: ER03
: JON 3.3.0
Assignee: John Mazzitelli
QA Contact: Armine Hovsepyan
URL:
Whiteboard:
Keywords:
Depends On:
Blocks:
TreeView+ depends on / blocked
 
Reported: 2014-09-05 16:20 UTC by John Mazzitelli
Modified: 2015-09-03 00:03 UTC (History)
2 users (show)

(edit)
Clone Of:
(edit)
Last Closed: 2014-12-11 14:02:41 UTC


Attachments (Terms of Use)

Description John Mazzitelli 2014-09-05 16:20:45 UTC
when installing a remote agent, if the check-for-used-port returns null, we through an NPE. We should not bomb out but keep going. Right now you just get an useless error message.

This code:

        // try to see if we can figure out what the port will be that the agent will bind to
        // this will use awk to find a line in the agent config xml that matches this:
        //    <entry key="rhq.communications.connector.bind-port" value="16163" />
        // where we use " as the field separator and the port number will be the fourth field.
        String agentPortAwkCommand = "awk '-F\"' '/key.*=.*" + AgentInstallInfo.AGENT_PORT_PROP + "/ {print $4}' "
            + "'" + agentConfigXmlFilename + "'";
        String portStr = executeCommand(agentPortAwkCommand, "Determine the agent's bind port", info);
        try {
            int port = Integer.parseInt(portStr.trim());
            info.setAgentPort(port);
        } catch (NumberFormatException nfe) {
            info.setAgentPort(0); // indicate that we don't know it
        }

Rather than just catch NumberFormatException, we should just catch Exception - that way, the NPE will get caught too - and we want to do the same thing - just indicate we don't know the port.

Comment 1 John Mazzitelli 2014-09-05 16:23:24 UTC
To master:

commit 0a87c043f2088934f3b66488c87f14e7b83b9e17
Author: John Mazzitelli <mazz@redhat.com>
Date:   Fri Sep 5 12:21:50 2014 -0400

    BZ 1138805 - NPE check

To release/jon3.3.x:

commit abe0958e98015fc7dfa12fc93a93d23f6c33bd03
Author: John Mazzitelli <mazz@redhat.com>
Date:   Fri Sep 5 12:21:50 2014 -0400

    BZ 1138805 - NPE check
    (cherry picked from commit 0a87c043f2088934f3b66488c87f14e7b83b9e17)

Comment 2 Simeon Pinder 2014-09-17 02:49:34 UTC
Moving to ON_QA as available for test with the following brew build:
https://brewweb.devel.redhat.com//buildinfo?buildID=385149

Comment 3 Armine Hovsepyan 2014-09-19 13:09:06 UTC
verified in JON 3.3 ER03
thank you


Note You need to log in before you can comment on or make changes to this bug.