We can make local variable final and non-null, improving logic
flow in this method.
Change-Id: I2695acd5cccdef0da61b1f3e246fd9dbcb2e08a2
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
caseCandidate.getClass());
final CaseSchemaNode caseNode = (CaseSchemaNode) caseCandidate;
caseCandidate.getClass());
final CaseSchemaNode caseNode = (CaseSchemaNode) caseCandidate;
- AugmentationSchemaNode augSchema = null;
+ final AugmentationSchemaNode augSchema;
if (choiceCandidate.isAugmenting()) {
augSchema = findCorrespondingAugment(getSchema(), choiceCandidate);
if (choiceCandidate.isAugmenting()) {
augSchema = findCorrespondingAugment(getSchema(), choiceCandidate);
+ } else {
+ augSchema = null;
}
// looking for existing choice
}
// looking for existing choice
}
private AbstractNodeDataWithSchema<?> addSimpleChild(final DataSchemaNode schema) {
}
private AbstractNodeDataWithSchema<?> addSimpleChild(final DataSchemaNode schema) {
- SimpleNodeDataWithSchema<?> newChild = null;
+ final SimpleNodeDataWithSchema<?> newChild;
if (schema instanceof LeafSchemaNode) {
newChild = new LeafNodeDataWithSchema((LeafSchemaNode) schema);
} else if (schema instanceof AnyxmlSchemaNode) {
if (schema instanceof LeafSchemaNode) {
newChild = new LeafNodeDataWithSchema((LeafSchemaNode) schema);
} else if (schema instanceof AnyxmlSchemaNode) {
- AugmentationSchemaNode augSchema = null;
+ final AugmentationSchemaNode augSchema;
if (schema.isAugmenting()) {
augSchema = findCorrespondingAugment(getSchema(), schema);
if (schema.isAugmenting()) {
augSchema = findCorrespondingAugment(getSchema(), schema);
+ } else {
+ augSchema = null;
}
if (augSchema != null) {
augmentationsToChild.put(augSchema, newChild);
}
if (augSchema != null) {
augmentationsToChild.put(augSchema, newChild);
- void addCompositeChild(final CompositeNodeDataWithSchema<?> newChild) {
- AugmentationSchemaNode augSchema = findCorrespondingAugment(getSchema(), newChild.getSchema());
+ final void addCompositeChild(final CompositeNodeDataWithSchema<?> newChild) {
+ final AugmentationSchemaNode augSchema = findCorrespondingAugment(getSchema(), newChild.getSchema());
if (augSchema != null) {
augmentationsToChild.put(augSchema, newChild);
} else {
if (augSchema != null) {
augmentationsToChild.put(augSchema, newChild);
} else {