ambari-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Tom Beerbower" <tbeerbo...@hortonworks.com>
Subject Re: Review Request 17770: NPE for View instance with no properties.
Date Thu, 06 Feb 2014 09:23:26 GMT

-----------------------------------------------------------
This is an automatically generated e-mail. To reply, visit:
https://reviews.apache.org/r/17770/
-----------------------------------------------------------

(Updated Feb. 6, 2014, 9:23 a.m.)


Review request for Ambari, Artem Baranchuk, Sumit Mohanty, and Sid Wagle.


Bugs: AMBARI-4541
    https://issues.apache.org/jira/browse/AMBARI-4541


Repository: ambari


Description
-------

The method getProperties()  of the class org.apache.ambari.server.view.configuration.InstanceConfig
returns null if no properties are specified for a view instance.  For example ...

{code}
<view>
  <name>SOME_VIEW</name>
  <label>Some View</label>
  <version>1.0.0</version>
  <resource>
    <name>someresource</name>
    <plural-name>someresources</plural-name>
    <id-property>id</id-property>
    <resource-class>org.apache.ambari.view.SomeResource</resource-class>
    <provider-class>org.apache.ambari.view.SomeResourceProvider</provider-class>
    <service-class>org.apache.ambari.view.SomeService</service-class>
  </resource>
  <instance>
    <name>INSTANCE1</name>
  </instance>
</view>
{code}

Any code consuming the instance configuration will likely NPE.
Better to return an empty list.


Diffs
-----

  ambari-server/src/main/java/org/apache/ambari/server/view/configuration/InstanceConfig.java
fd80922 
  ambari-server/src/test/java/org/apache/ambari/server/view/configuration/InstanceConfigTest.java
28fe7f3 
  ambari-server/src/test/java/org/apache/ambari/server/view/configuration/ViewConfigTest.java
0ca6764 

Diff: https://reviews.apache.org/r/17770/diff/


Testing
-------

Added additional unit test for InstanceConfig.


Thanks,

Tom Beerbower


Mime
  • Unnamed multipart/alternative (inline, None, 0 bytes)
View raw message