Sho SHIMIZU
Committed by Gerrit Code Review

Narrow the scope of the variable

Change-Id: I14be43184e1ebd8d9ab16ab0728d6f84d64699d7
...@@ -99,14 +99,13 @@ public class PathIntentCompiler implements IntentCompiler<PathIntent> { ...@@ -99,14 +99,13 @@ public class PathIntentCompiler implements IntentCompiler<PathIntent> {
99 // TODO: implement recompile behavior 99 // TODO: implement recompile behavior
100 100
101 List<Link> links = intent.path().links(); 101 List<Link> links = intent.path().links();
102 - List<FlowRule> rules = new LinkedList<>();
103 102
104 Optional<EncapsulationConstraint> encapConstraint = intent.constraints().stream() 103 Optional<EncapsulationConstraint> encapConstraint = intent.constraints().stream()
105 .filter(constraint -> constraint instanceof EncapsulationConstraint) 104 .filter(constraint -> constraint instanceof EncapsulationConstraint)
106 .map(x -> (EncapsulationConstraint) x).findAny(); 105 .map(x -> (EncapsulationConstraint) x).findAny();
107 //if no encapsulation or is involved only a single switch use the default behaviour 106 //if no encapsulation or is involved only a single switch use the default behaviour
108 if (!encapConstraint.isPresent() || links.size() == 1) { 107 if (!encapConstraint.isPresent() || links.size() == 1) {
109 - 108 + List<FlowRule> rules = new LinkedList<>();
110 for (int i = 0; i < links.size() - 1; i++) { 109 for (int i = 0; i < links.size() - 1; i++) {
111 ConnectPoint ingress = links.get(i).dst(); 110 ConnectPoint ingress = links.get(i).dst();
112 ConnectPoint egress = links.get(i + 1).src(); 111 ConnectPoint egress = links.get(i + 1).src();
...@@ -119,6 +118,7 @@ public class PathIntentCompiler implements IntentCompiler<PathIntent> { ...@@ -119,6 +118,7 @@ public class PathIntentCompiler implements IntentCompiler<PathIntent> {
119 return ImmutableList.of(new FlowRuleIntent(appId, null, rules, intent.resources())); 118 return ImmutableList.of(new FlowRuleIntent(appId, null, rules, intent.resources()));
120 } 119 }
121 120
121 + List<FlowRule> rules = Collections.emptyList();
122 if (EncapsulationType.VLAN == encapConstraint.get().encapType()) { 122 if (EncapsulationType.VLAN == encapConstraint.get().encapType()) {
123 rules = manageVlanEncap(intent); 123 rules = manageVlanEncap(intent);
124 } else if (EncapsulationType.MPLS == encapConstraint.get().encapType()) { 124 } else if (EncapsulationType.MPLS == encapConstraint.get().encapType()) {
......