Bug 886287
| Summary: | NullPointerException when another exception should have been thrown | ||
|---|---|---|---|
| Product: | [Other] RHQ Project | Reporter: | Jesse Sightler <jsightle> |
| Component: | Agent | Assignee: | Jirka Kremser <jkremser> |
| Status: | CLOSED CURRENTRELEASE | QA Contact: | Mike Foley <mfoley> |
| Severity: | unspecified | Docs Contact: | |
| Priority: | unspecified | ||
| Version: | 4.5 | CC: | hrupp, jkremser, jsightle |
| Target Milestone: | --- | ||
| Target Release: | RHQ 4.6 | ||
| Hardware: | Unspecified | ||
| OS: | Unspecified | ||
| Whiteboard: | |||
| Fixed In Version: | Doc Type: | Bug Fix | |
| Doc Text: | Story Points: | --- | |
| Clone Of: | Environment: | ||
| Last Closed: | 2013-09-03 14:46:10 UTC | Type: | Bug |
| Regression: | --- | Mount Type: | --- |
| Documentation: | --- | CRM: | |
| Verified Versions: | Category: | --- | |
| oVirt Team: | --- | RHEL 7.3 requirements from Atomic Host: | |
| Cloudforms Team: | --- | Target Upstream Version: | |
| Embargoed: | |||
thanks, it is fixed now http://git.fedorahosted.org/cgit/rhq/rhq.git/diff/?id=49a48ea47 time: Fri Dec 14 14:50:57 2012 +0100 commit: 49a48ea47dde77506b48bb1c699dd6aab0ab8a20 author: Jirka Kremser - jkremser message: [BZ 886287 - NullPointerException when another exception should have been thrown] quick fix, lazy evaluation of Java should ensure the prevention of throwing NPE Bulk closing of issues in old RHQ releases that are in production for a while now. Please open a new issue when running into an issue. |
Description of problem: root/modules/common/ant-bundle/src/main/java/org/rhq/bundle/ant/type/SystemServiceType.java The init method contains this: if (this.configFile != null && !this.configFile.exists() || this.configFile.isDirectory()) { throw new BuildException("The 'configFile' attribute must be set to the path of an existing regular file."); } Because of the lack of parenthesis, and the operator precendence rules of Java, this will not actually check that the config file is non-null. Ie, if configFile is null, then this.configFile.isDirectory will still be called, resulting in a NullPointerException. I believe this should be changed to: if (this.configFile != null && (!this.configFile.exists() || this.configFile.isDirectory())) { throw new BuildException("The 'configFile' attribute must be set to the path of an existing regular file."); }