sonar bug fix: might cause NPE 31/30231/1
authorSantosh Yadav <santosh.k.yadav@ril.com>
Mon, 5 Feb 2018 09:36:46 +0000 (15:06 +0530)
committerSantosh Yadav <santosh.k.yadav@ril.com>
Mon, 5 Feb 2018 09:36:46 +0000 (15:06 +0530)
added null check on lpattern variable
ems/boco/src/main/java/org/onap/vfc/nfvo/emsdriver/collector/TaskThread.java

Change-Id: Iad6f2da5ce66a9cce1b54cacc1cb26835308e248
Issue-ID: VFC-692
Signed-off-by: Santosh Yadav <santosh.k.yadav@ril.com>
ems/boco/src/main/java/org/onap/vfc/nfvo/emsdriver/collector/TaskThread.java

index d764bf6..9f2824b 100644 (file)
@@ -1010,8 +1010,13 @@ public class TaskThread implements Runnable {
                 log.error("[" + regular + "]compile fails:" + e.getMessage());
                 e.printStackTrace();
             }
-
-            Matcher matcher = lpattern.matcher(regular);
+            Matcher matcher=null;
+            if(lpattern!=null)
+           matcher = lpattern.matcher(regular);
+            else{
+               //define flow in case lpattern is null
+            }
+            
             if (matcher.find()) {
                 isregular = true;
                 String parpath = matcher.group(1);