Prevent NullPointerException
Change-Id: Id27490dfcae211bb7889090c6a53a400c3a06dbe
Showing
1 changed file
with
3 additions
and
2 deletions
| ... | @@ -15,6 +15,7 @@ | ... | @@ -15,6 +15,7 @@ |
| 15 | */ | 15 | */ |
| 16 | package org.onosproject.net.intent.impl.compiler; | 16 | package org.onosproject.net.intent.impl.compiler; |
| 17 | 17 | ||
| 18 | +import com.google.common.base.Strings; | ||
| 18 | import org.apache.commons.lang3.tuple.Pair; | 19 | import org.apache.commons.lang3.tuple.Pair; |
| 19 | import org.apache.felix.scr.annotations.Activate; | 20 | import org.apache.felix.scr.annotations.Activate; |
| 20 | import org.apache.felix.scr.annotations.Component; | 21 | import org.apache.felix.scr.annotations.Component; |
| ... | @@ -133,8 +134,8 @@ public class OpticalCircuitIntentCompiler implements IntentCompiler<OpticalCircu | ... | @@ -133,8 +134,8 @@ public class OpticalCircuitIntentCompiler implements IntentCompiler<OpticalCircu |
| 133 | //TODO for reduction check if the new capacity is smaller than the size of the current mapping | 134 | //TODO for reduction check if the new capacity is smaller than the size of the current mapping |
| 134 | String propertyString = Tools.get(properties, "maxCapacity"); | 135 | String propertyString = Tools.get(properties, "maxCapacity"); |
| 135 | 136 | ||
| 136 | - //Ignore if propertyString is empty | 137 | + //Ignore if propertyString is empty or null |
| 137 | - if (!propertyString.isEmpty()) { | 138 | + if (!Strings.isNullOrEmpty(propertyString)) { |
| 138 | try { | 139 | try { |
| 139 | int temp = Integer.parseInt(propertyString); | 140 | int temp = Integer.parseInt(propertyString); |
| 140 | //Ensure value is non-negative but allow zero as a way to shutdown the link | 141 | //Ensure value is non-negative but allow zero as a way to shutdown the link | ... | ... |
-
Please register or login to post a comment