Committed by
Gerrit Code Review
Return Collections.emptyList() instead of null to avoid NullPointerException
Change-Id: I763a6d8993e32e2203c9e3be317d3db3e893d886
Showing
1 changed file
with
5 additions
and
4 deletions
providers/openflow/flow/src/main/java/org/onosproject/provider/of/flow/impl/FlowModBuilderVer13.java
... | @@ -186,11 +186,12 @@ public class FlowModBuilderVer13 extends FlowModBuilder { | ... | @@ -186,11 +186,12 @@ public class FlowModBuilderVer13 extends FlowModBuilder { |
186 | } | 186 | } |
187 | 187 | ||
188 | private List<OFAction> buildActions(List<Instruction> treatments) { | 188 | private List<OFAction> buildActions(List<Instruction> treatments) { |
189 | - List<OFAction> actions = new LinkedList<>(); | ||
190 | - boolean tableFound = false; | ||
191 | if (treatment == null) { | 189 | if (treatment == null) { |
192 | - return actions; | 190 | + return Collections.emptyList(); |
193 | } | 191 | } |
192 | + | ||
193 | + boolean tableFound = false; | ||
194 | + List<OFAction> actions = new LinkedList<>(); | ||
194 | for (Instruction i : treatments) { | 195 | for (Instruction i : treatments) { |
195 | switch (i.type()) { | 196 | switch (i.type()) { |
196 | case DROP: | 197 | case DROP: |
... | @@ -230,7 +231,7 @@ public class FlowModBuilderVer13 extends FlowModBuilder { | ... | @@ -230,7 +231,7 @@ public class FlowModBuilderVer13 extends FlowModBuilder { |
230 | if (tableFound && actions.isEmpty()) { | 231 | if (tableFound && actions.isEmpty()) { |
231 | // handles the case where there are no actions, but there is | 232 | // handles the case where there are no actions, but there is |
232 | // a goto instruction for the next table | 233 | // a goto instruction for the next table |
233 | - return null; | 234 | + return Collections.emptyList(); |
234 | } | 235 | } |
235 | return actions; | 236 | return actions; |
236 | } | 237 | } | ... | ... |
-
Please register or login to post a comment