[YANGTOOLS-336] GeneratedTypeBuilderImpl allows add property with null name Created: 13/Oct/14  Updated: 10/Apr/22  Resolved: 17/Oct/14

Status: Resolved
Project: yangtools
Component/s: None
Affects Version/s: None
Fix Version/s: None

Type: Bug
Reporter: Peter Kajsa Assignee: Peter Kajsa
Resolution: Done Votes: 0
Labels: None
Remaining Estimate: Not Specified
Time Spent: Not Specified
Original Estimate: Not Specified
Environment:

Operating System: All
Platform: All


External issue ID: 2176

 Description   

GeneratedTypeBuilderImpl allows add property with null name. The Preconditions.checkArgument(name != null,"...") test is missing in the method addProperty(String name) in the class AbstractGeneratedTypeBuilder.

Example:

GeneratedTypeBuilderImpl generatedTypeBuilder = new GeneratedTypeBuilderImpl(
"my.package", "MyName");

GeneratedPropertyBuilder propertyBuilderNull = generatedTypeBuilder.addProperty(null);

propertyBuilderNull != null //true

GeneratedType instance = generatedTypeBuilder.toInstance();
List<GeneratedProperty> properties = instance.getProperties();

properties.size() //1
properties.contains(propertyBuilderNull.toInstance(instance)) //true

Notice: The containsProperty method have this check:
public boolean containsProperty(final String name) {
Preconditions.checkArgument(name != null, "Parameter name can't be null");



 Comments   
Comment by Peter Kajsa [ 16/Oct/14 ]

fixed: https://git.opendaylight.org/gerrit/#/c/11996/1

Generated at Wed Feb 07 20:52:55 UTC 2024 using Jira 8.20.10#820010-sha1:ace47f9899e9ee25d7157d59aa17ab06aee30d3d.