You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@ambari.apache.org by Tom Beerbower <tb...@hortonworks.com> on 2014/02/06 01:46:57 UTC

Review Request 17770: NPE for View instance with no properties.

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

Review request for Ambari, 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


Re: Review Request 17770: NPE for View instance with no properties.

Posted by Artem Baranchuk <ab...@hortonworks.com>.
-----------------------------------------------------------
This is an automatically generated e-mail. To reply, visit:
https://reviews.apache.org/r/17770/#review33784
-----------------------------------------------------------

Ship it!


Ship It!

- Artem Baranchuk


On Feb. 6, 2014, 9:23 a.m., Tom Beerbower wrote:
> 
> -----------------------------------------------------------
> 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
> 
>


Re: Review Request 17770: NPE for View instance with no properties.

Posted by Sumit Mohanty <sm...@hortonworks.com>.
-----------------------------------------------------------
This is an automatically generated e-mail. To reply, visit:
https://reviews.apache.org/r/17770/#review33795
-----------------------------------------------------------

Ship it!


Ship It!

- Sumit Mohanty


On Feb. 6, 2014, 9:23 a.m., Tom Beerbower wrote:
> 
> -----------------------------------------------------------
> 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
> 
>


Re: Review Request 17770: NPE for View instance with no properties.

Posted by Tom Beerbower <tb...@hortonworks.com>.
-----------------------------------------------------------
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