<!-- 
RSS generated by JIRA (8.20.10#820010-sha1:ace47f9899e9ee25d7157d59aa17ab06aee30d3d) at Wed Feb 07 20:53:19 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>[YANGTOOLS-461] NPE in a setter method for a length-restricted string.</title>
                <link>https://jira.opendaylight.org/browse/YANGTOOLS-461</link>
                <project id="10188" key="YANGTOOLS">yangtools</project>
                    <description>&lt;p&gt;The following patch changed behavior of builder class generated by yangtools.&lt;/p&gt;

&lt;p&gt;  commit 7998081d8e1761bf4798c1642e8e6107fc4666fc&lt;br/&gt;
  Author: Robert Varga &amp;lt;rovarga@cisco.com&amp;gt;&lt;br/&gt;
  Date:   Sun May 31 19:51:43 2015 +0200&lt;/p&gt;

&lt;p&gt;      BUG-1485: convert BuilderTemplate to use LengthGenerator&lt;/p&gt;

&lt;p&gt;Before that patch was merged, a setter method for a length-restricted string accepts a null string.&lt;/p&gt;

&lt;p&gt;  YANG model:&lt;br/&gt;
    container test {&lt;br/&gt;
        leaf name {&lt;br/&gt;
            type string &lt;/p&gt;
{
                length &quot;1 .. 31&quot;;
            }
&lt;p&gt;        }&lt;br/&gt;
    }&lt;/p&gt;

&lt;p&gt;  Setter method in a builder class:&lt;br/&gt;
    public TestBuilder setName(java.lang.String value) {&lt;br/&gt;
        if (value != null) {&lt;br/&gt;
            BigInteger _constraint = BigInteger.valueOf(value.length());&lt;br/&gt;
            boolean isValidLength = false;&lt;br/&gt;
            for (Range&amp;lt;BigInteger&amp;gt; r : _name_length()) {&lt;br/&gt;
                if (r.contains(_constraint)) &lt;/p&gt;
{
                    isValidLength = true;
                }
&lt;p&gt;            }&lt;br/&gt;
            if (!isValidLength) &lt;/p&gt;
{
                throw new IllegalArgumentException(String.format(&quot;Invalid length: %s, expected: %s.&quot;, value, _name_length));
            }
&lt;p&gt;        }&lt;br/&gt;
        this._name = value;&lt;br/&gt;
        return this;&lt;br/&gt;
    }&lt;/p&gt;

&lt;p&gt;But after that patch was merged, a setter method for a length-restricted string causes NPE when a null string is passed.&lt;/p&gt;

&lt;p&gt;    private static void check_nameLength(final String value) {&lt;br/&gt;
        final int length = value.length();  &amp;lt;=== NPE if value is null&lt;br/&gt;
        if (length &amp;gt;= 1 &amp;amp;&amp;amp; length &amp;lt;= 31) &lt;/p&gt;
{
            return;
        }
&lt;p&gt;        throw new IllegalArgumentException(String.format(&quot;Invalid length: %s, expected: [&lt;span class=&quot;error&quot;&gt;&amp;#91;1&#8229;31&amp;#93;&lt;/span&gt;].&quot;, value));&lt;br/&gt;
    }&lt;/p&gt;

&lt;p&gt;    public TestBuilder setName(java.lang.String value) &lt;/p&gt;
{
        check_nameLength(value);
        this._name = value;
        return this;
    }

&lt;p&gt;I think a setter method should accept a null string even if a length restriction is applied.&lt;/p&gt;</description>
                <environment>&lt;p&gt;Operating System: All&lt;br/&gt;
Platform: All&lt;/p&gt;</environment>
        <key id="22881">YANGTOOLS-461</key>
            <summary>NPE in a setter method for a length-restricted string.</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="10000">Done</resolution>
                                        <assignee username="-1">Unassigned</assignee>
                                    <reporter username="yasuda">Shigeru Yasuda</reporter>
                        <labels>
                    </labels>
                <created>Tue, 9 Jun 2015 11:34:56 +0000</created>
                <updated>Sun, 10 Apr 2022 18:35:33 +0000</updated>
                            <resolved>Tue, 9 Jun 2015 16:27:29 +0000</resolved>
                                                                        <due></due>
                            <votes>0</votes>
                                    <watches>1</watches>
                                                                                                                <comments>
                            <comment id="43397" author="colin@colindixon.com" created="Tue, 9 Jun 2015 16:27:29 +0000"  >&lt;p&gt;Tony says it should be fixed by: &lt;a href=&quot;https://git.opendaylight.org/gerrit/#/c/22189/&quot; class=&quot;external-link&quot; target=&quot;_blank&quot; rel=&quot;nofollow noopener&quot;&gt;https://git.opendaylight.org/gerrit/#/c/22189/&lt;/a&gt;&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>3643</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=3643]]></customfieldvalue>

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

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