[YANGTOOLS-461] NPE in a setter method for a length-restricted string. Created: 09/Jun/15 Updated: 10/Apr/22 Resolved: 09/Jun/15 |
|
| Status: | Resolved |
| Project: | yangtools |
| Component/s: | None |
| Affects Version/s: | None |
| Fix Version/s: | None |
| Type: | Bug | ||
| Reporter: | Shigeru Yasuda | Assignee: | Unassigned |
| Resolution: | Done | Votes: | 0 |
| Labels: | None | ||
| Remaining Estimate: | Not Specified | ||
| Time Spent: | Not Specified | ||
| Original Estimate: | Not Specified | ||
| Environment: |
Operating System: All |
||
| External issue ID: | 3643 |
| Description |
|
The following patch changed behavior of builder class generated by yangtools. commit 7998081d8e1761bf4798c1642e8e6107fc4666fc BUG-1485: convert BuilderTemplate to use LengthGenerator Before that patch was merged, a setter method for a length-restricted string accepts a null string. YANG model: } Setter method in a builder class: } } But after that patch was merged, a setter method for a length-restricted string causes NPE when a null string is passed. private static void check_nameLength(final String value) { throw new IllegalArgumentException(String.format("Invalid length: %s, expected: [[1‥31]].", value)); public TestBuilder setName(java.lang.String value) { check_nameLength(value); this._name = value; return this; }I think a setter method should accept a null string even if a length restriction is applied. |
| Comments |
| Comment by Colin Dixon [ 09/Jun/15 ] |
|
Tony says it should be fixed by: https://git.opendaylight.org/gerrit/#/c/22189/ |