<!-- 
RSS generated by JIRA (8.20.10#820010-sha1:ace47f9899e9ee25d7157d59aa17ab06aee30d3d) at Wed Feb 07 20:25:26 UTC 2024

It is possible to restrict the fields that are returned in this document by specifying the 'field' parameter in your request.
For example, to request only the issue key and summary append 'field=key&field=summary' to the URL of your request.
-->
<rss version="0.92" >
<channel>
    <title>OpenDaylight JIRA</title>
    <link>https://jira.opendaylight.org</link>
    <description>This file is an XML representation of an issue</description>
    <language>en-us</language>    <build-info>
        <version>8.20.10</version>
        <build-number>820010</build-number>
        <build-date>22-06-2022</build-date>
    </build-info>


<item>
            <title>[NEUTRON-54] Null Pointer Exception while converting from Boolean to boolean</title>
                <link>https://jira.opendaylight.org/browse/NEUTRON-54</link>
                <project id="10145" key="NEUTRON">neutron</project>
                    <description>&lt;p&gt;in neutron-spi/src/main/java/org/opendaylight/neutron/spi/NeutronNetwork.java, Null Pointer Exception while converting from Boolean to Boolean as:&lt;/p&gt;

&lt;p&gt;example:&lt;/p&gt;

&lt;p&gt; public boolean isAdminStateUp() &lt;/p&gt;
{
        return adminStateUp;
 }

&lt;p&gt;//Null Pointer Exception when adminStateUp is null.&lt;/p&gt;


&lt;p&gt;Test Case:&lt;/p&gt;

&lt;p&gt;vagrant@node1:~/neutron$ cat TestA.java; javac TestA.java ; java TestA&lt;br/&gt;
public class TestA {&lt;br/&gt;
     Boolean adminStateUp;&lt;/p&gt;

&lt;p&gt;      public boolean isAdminStateUp() &lt;/p&gt;
{
        return adminStateUp;
      }

&lt;p&gt;     public static void main(String[] args) {&lt;br/&gt;
         TestA a = new TestA();&lt;br/&gt;
         if (a.isAdminStateUp()) &lt;/p&gt;
{
            System.out.println(&quot;here&quot;);
         }
&lt;p&gt;     }&lt;br/&gt;
 }&lt;br/&gt;
Exception in thread &quot;main&quot; java.lang.NullPointerException&lt;br/&gt;
	at TestA.isAdminStateUp(TestA.java:5)&lt;br/&gt;
	at TestA.main(TestA.java:10)&lt;/p&gt;</description>
                <environment>&lt;p&gt;Operating System: All&lt;br/&gt;
Platform: All&lt;/p&gt;</environment>
        <key id="26616">NEUTRON-54</key>
            <summary>Null Pointer Exception while converting from Boolean to boolean</summary>
                <type id="10104" iconUrl="https://jira.opendaylight.org/secure/viewavatar?size=xsmall&amp;avatarId=10303&amp;avatarType=issuetype">Bug</type>
                                                <status id="5" iconUrl="https://jira.opendaylight.org/images/icons/statuses/resolved.png" description="A resolution has been taken, and it is awaiting verification by reporter. From here issues are either reopened, or are closed.">Resolved</status>
                    <statusCategory id="3" key="done" colorName="green"/>
                                    <resolution id="10001">Won&apos;t Do</resolution>
                                        <assignee username="ruijing.guo@intel.com">Ruijing Guo</assignee>
                                    <reporter username="ruijing.guo@intel.com">Ruijing Guo</reporter>
                        <labels>
                    </labels>
                <created>Thu, 9 Jul 2015 03:47:19 +0000</created>
                <updated>Thu, 11 Feb 2016 14:05:31 +0000</updated>
                            <resolved>Thu, 11 Feb 2016 14:05:31 +0000</resolved>
                                    <version>master</version>
                                                    <component>neutron-spi</component>
                        <due></due>
                            <votes>0</votes>
                                    <watches>2</watches>
                                                                                                                <comments>
                            <comment id="53390" author="yamahata" created="Thu, 9 Jul 2015 18:51:00 +0000"  >&lt;p&gt;This applies to other classes in the directory.&lt;br/&gt;
We should address consistently as a whole. &lt;/p&gt;

&lt;p&gt;There is two interfaces&lt;/p&gt;

&lt;ul class=&quot;alternate&quot; type=&quot;square&quot;&gt;
	&lt;li&gt;boolean isXXX() with implicit conversion&lt;br/&gt;
  It may results in null pointer exception.&lt;/li&gt;
	&lt;li&gt;Boolean getXXX() may return null pointer with the current implementation.&lt;br/&gt;
  Is null pointer check the responsibility of the caller?&lt;/li&gt;
&lt;/ul&gt;



&lt;p&gt;possible approach I can think of would be&lt;/p&gt;
&lt;ul class=&quot;alternate&quot; type=&quot;square&quot;&gt;
	&lt;li&gt;add default initialization value.&lt;br/&gt;
  i.e. Boolean adminStateUp = false&lt;/li&gt;
&lt;/ul&gt;


&lt;p&gt;  This changes the semantics of Boolean getXXX(). it doesn&apos;t return null anymore.&lt;br/&gt;
  If we go for this route, other T getXXX() should have same semantics.&lt;br/&gt;
  (where T = String, Interger etc.)&lt;/p&gt;

&lt;ul class=&quot;alternate&quot; type=&quot;square&quot;&gt;
	&lt;li&gt;add null pointer check to all of boolean isXXX()&lt;/li&gt;
&lt;/ul&gt;



&lt;ul class=&quot;alternate&quot; type=&quot;square&quot;&gt;
	&lt;li&gt;Drop all of boolean isXXX()&lt;/li&gt;
&lt;/ul&gt;


&lt;ul class=&quot;alternate&quot; type=&quot;square&quot;&gt;
	&lt;li&gt;any other better way?&lt;/li&gt;
&lt;/ul&gt;


&lt;p&gt;thoughts?&lt;/p&gt;</comment>
                            <comment id="53391" author="ruijing.guo@intel.com" created="Fri, 10 Jul 2015 00:23:17 +0000"  >&lt;p&gt;in NeutronNetwork.java, I like to change:&lt;/p&gt;

&lt;p&gt;1. Change public initDefaults to private function and construction call  initDefaults&lt;/p&gt;

&lt;p&gt;2. deprecated instead of drop isXXX or getXXX.&lt;/p&gt;</comment>
                            <comment id="53392" author="rovarga" created="Sat, 21 Nov 2015 20:23:57 +0000"  >&lt;p&gt;The following would work, too:&lt;/p&gt;

&lt;p&gt;    public boolean isAdminStateUp() &lt;/p&gt;
{
        return Boolean.TRUE.equals(adminStateUp);
    }

&lt;p&gt;The question is whether you need to differentiate the tri-state nature (up, down, unknown?). If not, I would suggest also changing the field type to &apos;boolean&apos;, as that is more memory-efficient.&lt;/p&gt;</comment>
                            <comment id="53393" author="yamahata" created="Thu, 11 Feb 2016 14:05:31 +0000"  >&lt;p&gt;Since this issue was hit during Ruijing was working on his modification and there is no actual impact on the existing code.&lt;br/&gt;
So we won&apos;t fix this bug.&lt;/p&gt;

&lt;p&gt;If this is hit as actual bug, please re-open this bug.&lt;/p&gt;</comment>
                    </comments>
                    <attachments>
                    </attachments>
                <subtasks>
                    </subtasks>
                <customfields>
                                                                            <customfield id="customfield_11400" key="com.atlassian.jira.plugins.jira-development-integration-plugin:devsummary">
                        <customfieldname>Development</customfieldname>
                        <customfieldvalues>
                            
                        </customfieldvalues>
                    </customfield>
                                                                                                                        <customfield id="customfield_10208" key="com.atlassian.jira.plugin.system.customfieldtypes:textfield">
                        <customfieldname>External issue ID</customfieldname>
                        <customfieldvalues>
                            <customfieldvalue>3968</customfieldvalue>

                        </customfieldvalues>
                    </customfield>
                                                                <customfield id="customfield_10201" key="com.atlassian.jira.plugin.system.customfieldtypes:url">
                        <customfieldname>External issue URL</customfieldname>
                        <customfieldvalues>
                            <customfieldvalue><![CDATA[https://bugs.opendaylight.org/show_bug.cgi?id=3968]]></customfieldvalue>

                        </customfieldvalues>
                    </customfield>
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                <customfield id="customfield_10000" key="com.pyxis.greenhopper.jira:gh-lexo-rank">
                        <customfieldname>Rank</customfieldname>
                        <customfieldvalues>
                            <customfieldvalue>0|i02ufb:</customfieldvalue>

                        </customfieldvalues>
                    </customfield>
                                                                                                                                                                                </customfields>
    </item>
</channel>
</rss>