Narrow the scope of the variable
Change-Id: I14be43184e1ebd8d9ab16ab0728d6f84d64699d7
diff --git a/core/net/src/main/java/org/onosproject/net/intent/impl/compiler/PathIntentCompiler.java b/core/net/src/main/java/org/onosproject/net/intent/impl/compiler/PathIntentCompiler.java
index c7040a5..cb49699 100644
--- a/core/net/src/main/java/org/onosproject/net/intent/impl/compiler/PathIntentCompiler.java
+++ b/core/net/src/main/java/org/onosproject/net/intent/impl/compiler/PathIntentCompiler.java
@@ -99,14 +99,13 @@
// TODO: implement recompile behavior
List<Link> links = intent.path().links();
- List<FlowRule> rules = new LinkedList<>();
Optional<EncapsulationConstraint> encapConstraint = intent.constraints().stream()
.filter(constraint -> constraint instanceof EncapsulationConstraint)
.map(x -> (EncapsulationConstraint) x).findAny();
//if no encapsulation or is involved only a single switch use the default behaviour
if (!encapConstraint.isPresent() || links.size() == 1) {
-
+ List<FlowRule> rules = new LinkedList<>();
for (int i = 0; i < links.size() - 1; i++) {
ConnectPoint ingress = links.get(i).dst();
ConnectPoint egress = links.get(i + 1).src();
@@ -119,6 +118,7 @@
return ImmutableList.of(new FlowRuleIntent(appId, null, rules, intent.resources()));
}
+ List<FlowRule> rules = Collections.emptyList();
if (EncapsulationType.VLAN == encapConstraint.get().encapType()) {
rules = manageVlanEncap(intent);
} else if (EncapsulationType.MPLS == encapConstraint.get().encapType()) {