Details
-
Bug
-
Status: Resolved
-
Resolution: Done
-
None
-
None
-
None
-
None
-
Operating System: All
Platform: All
-
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");