Fix for SVACE reported issues on Simulator Java layer.
[platform/upstream/iotivity.git] / service / simulator / java / eclipse-plugin / ServiceProviderPlugin / src / oic / simulator / serviceprovider / view / MetaPropertiesView.java
index 82ff675..d5fd2d6 100644 (file)
@@ -148,15 +148,14 @@ public class MetaPropertiesView extends ViewPart {
                         updatedIfSet = resource.getResourceInterfaces();
                     }
                 } else {
-                    boolean result = false;
                     Resource resourceInSelection = resourceManagerRef
                             .getCurrentResourceInSelection();
                     if (null != resourceInSelection) {
 
                         // Null Check
-                        result = resourceManagerRef.isPropertyValueInvalid(
-                                resourceInSelection, properties,
-                                Constants.RESOURCE_URI);
+                        boolean result = resourceManagerRef
+                                .isPropertyValueInvalid(resourceInSelection,
+                                        properties, Constants.RESOURCE_URI);
                         if (result) {
                             MessageDialog.openError(parent.getShell(),
                                     "Invalid Resource URI.",
@@ -222,9 +221,9 @@ public class MetaPropertiesView extends ViewPart {
                         // interfaces by
                         // comparing the current interface set and updated
                         // interface set.
-                        if (null != updatedIfSet) {
-                            Set<String> curIfSet = resourceInSelection
-                                    .getResourceInterfaces();
+                        Set<String> curIfSet = resourceInSelection
+                                .getResourceInterfaces();
+                        if (null != curIfSet && null != updatedIfSet) {
                             if (curIfSet.size() != updatedIfSet.size()) {
                                 update = true;
                                 interfaceChange = true;
@@ -417,7 +416,8 @@ public class MetaPropertiesView extends ViewPart {
                 resourceSelectionChangedListener);
     }
 
-    class PropertycontentProvider implements IStructuredContentProvider {
+    private static class PropertycontentProvider implements
+            IStructuredContentProvider {
 
         @Override
         public void dispose() {
@@ -493,20 +493,20 @@ public class MetaPropertiesView extends ViewPart {
                             // Update the local copy of the current resource
                             // interfaces to keep the state for save operation.
                             updatedIfSet.clear();
-                            String newPropValue = "";
+                            StringBuilder newPropValue = new StringBuilder();
                             for (Map.Entry<String, String> entry : curResInterfaces
                                     .entrySet()) {
-                                if (!newPropValue.isEmpty()) {
-                                    newPropValue += ", ";
+                                if (!newPropValue.toString().isEmpty()) {
+                                    newPropValue.append(", ");
                                 }
                                 String value = ifTypes.get(entry.getKey());
-                                newPropValue += value;
+                                newPropValue.append(value);
 
                                 updatedIfSet.add(value);
                             }
                             // Update the model
                             MetaProperty prop = (MetaProperty) element;
-                            prop.setPropValue(newPropValue);
+                            prop.setPropValue(newPropValue.toString());
                             // Update the viewer in a separate UI thread.
                             Display.getDefault().asyncExec(new Runnable() {
                                 @Override