Minor update in PW configuration to handle updates better

Change-Id: I055592f8586b3b49539e87572d94f6af445003aa
(cherry picked from commit c41ceb92768e0030f6c4275d44bff8cd45acf180)
diff --git a/apps/segmentrouting/src/main/java/org/onosproject/segmentrouting/config/PwaasConfig.java b/apps/segmentrouting/src/main/java/org/onosproject/segmentrouting/config/PwaasConfig.java
index ed2c067..f9ab36c 100644
--- a/apps/segmentrouting/src/main/java/org/onosproject/segmentrouting/config/PwaasConfig.java
+++ b/apps/segmentrouting/src/main/java/org/onosproject/segmentrouting/config/PwaasConfig.java
@@ -122,13 +122,13 @@
                     .map(this::getPwDescription)
                     .collect(Collectors.toSet());
 
+            // check semantics now and return
+            return configurationValidity(pseudowires);
+
         } catch (IllegalArgumentException e) {
             log.warn("{}", e.getMessage());
             return false;
         }
-
-        // check semantics now and return
-        return configurationValidity(pseudowires);
     }
 
     /**
@@ -656,10 +656,9 @@
         newPw.put(MODE, mode);
 
         object.set(tunnelId, newPw);
-        try {
-            isValid();
-        } catch (IllegalArgumentException e) {
-            log.info("Pseudowire could not be created : {}", e);
+
+        if (!isValid()) {
+            log.info("Pseudowire could not be created : {}");
             object.remove(tunnelId);
             return null;
         }
diff --git a/apps/segmentrouting/src/test/java/org/onosproject/segmentrouting/PwaasConfigTest.java b/apps/segmentrouting/src/test/java/org/onosproject/segmentrouting/PwaasConfigTest.java
index 7686242..60163eb 100644
--- a/apps/segmentrouting/src/test/java/org/onosproject/segmentrouting/PwaasConfigTest.java
+++ b/apps/segmentrouting/src/test/java/org/onosproject/segmentrouting/PwaasConfigTest.java
@@ -303,9 +303,9 @@
         assertFalse(invalidConfigLabel.isValid());
     }
 
-    @Test(expected = IllegalArgumentException.class)
+    @Test
     public void testValid4() {
-        invalidConfigConflictingVlan.isValid();
+        assertFalse(invalidConfigConflictingVlan.isValid());
     }
 
     /**