Fix for SVACE reported issues on Simulator Java layer.
authorG S Senthil Kumar <senthil.gs@samsung.com>
Fri, 1 Apr 2016 12:32:47 +0000 (18:02 +0530)
committerMadan Lanka <lanka.madan@samsung.com>
Tue, 5 Apr 2016 02:21:51 +0000 (02:21 +0000)
Resolved SVACE issues on java sdk and ServiceProvider and ClientController
plugins.

Change-Id: I1ba0b937deef1cf7f7a8d37de6fe0192eb07a82f
Signed-off-by: G S Senthil Kumar <senthil.gs@samsung.com>
Reviewed-on: https://gerrit.iotivity.org/gerrit/7531
Tested-by: jenkins-iotivity <jenkins-iotivity@opendaylight.org>
Reviewed-by: Madan Lanka <lanka.madan@samsung.com>
(cherry picked from commit fef6c484910e41b52f38857b13584664a7dd9799)
Reviewed-on: https://gerrit.iotivity.org/gerrit/7543

20 files changed:
service/simulator/java/eclipse-plugin/ClientControllerPlugin/src/oic/simulator/clientcontroller/manager/ResourceManager.java
service/simulator/java/eclipse-plugin/ClientControllerPlugin/src/oic/simulator/clientcontroller/view/AttributeEditingSupport.java
service/simulator/java/eclipse-plugin/ClientControllerPlugin/src/oic/simulator/clientcontroller/view/AttributeView.java
service/simulator/java/eclipse-plugin/ClientControllerPlugin/src/oic/simulator/clientcontroller/view/LogView.java
service/simulator/java/eclipse-plugin/ClientControllerPlugin/src/oic/simulator/clientcontroller/view/MetaPropertiesView.java
service/simulator/java/eclipse-plugin/ClientControllerPlugin/src/oic/simulator/clientcontroller/view/dialogs/ModelArrayAddItemDialog.java
service/simulator/java/eclipse-plugin/ClientControllerPlugin/src/oic/simulator/clientcontroller/view/dialogs/PostRequestDialog.java
service/simulator/java/eclipse-plugin/ClientControllerPlugin/src/oic/simulator/clientcontroller/view/dialogs/PutRequestDialog.java
service/simulator/java/eclipse-plugin/ServiceProviderPlugin/src/oic/simulator/serviceprovider/model/SerializedServiceProvider.java
service/simulator/java/eclipse-plugin/ServiceProviderPlugin/src/oic/simulator/serviceprovider/view/AttributeEditingSupport.java
service/simulator/java/eclipse-plugin/ServiceProviderPlugin/src/oic/simulator/serviceprovider/view/AttributeView.java
service/simulator/java/eclipse-plugin/ServiceProviderPlugin/src/oic/simulator/serviceprovider/view/DevicePlatformInfoView.java
service/simulator/java/eclipse-plugin/ServiceProviderPlugin/src/oic/simulator/serviceprovider/view/LogView.java
service/simulator/java/eclipse-plugin/ServiceProviderPlugin/src/oic/simulator/serviceprovider/view/MetaPropertiesView.java
service/simulator/java/eclipse-plugin/ServiceProviderPlugin/src/oic/simulator/serviceprovider/view/ResourceObserverView.java
service/simulator/java/eclipse-plugin/ServiceProviderPlugin/src/oic/simulator/serviceprovider/view/dialogs/AddAttributeDialog.java
service/simulator/java/eclipse-plugin/ServiceProviderPlugin/src/oic/simulator/serviceprovider/view/dialogs/DeleteResourcePage.java
service/simulator/java/eclipse-plugin/ServiceProviderPlugin/src/oic/simulator/serviceprovider/view/dialogs/ModelArrayAddItemDialog.java
service/simulator/java/eclipse-plugin/ServiceProviderPlugin/src/oic/simulator/serviceprovider/view/dialogs/SimpleResourceAddAttributePage.java
service/simulator/java/sdk/src/org/oic/simulator/AttributeValue.java

index 6a8a17b..5590881 100644 (file)
@@ -886,7 +886,7 @@ public class ResourceManager {
 
     public void deleteResources(final Set<String> searchTypes) {
         synchronized (resourceMap) {
-            if (null == resourceMap || resourceMap.isEmpty()) {
+            if (resourceMap.isEmpty()) {
                 return;
             }
         }
index 360534c..7f0ac99 100644 (file)
@@ -771,7 +771,8 @@ public class AttributeView extends ViewPart {
             observeResButton.setEnabled(visibility);
     }
 
-    class AttributeContentProvider implements ITreeContentProvider {
+    private static class AttributeContentProvider implements
+            ITreeContentProvider {
 
         @Override
         public void dispose() {
@@ -824,7 +825,7 @@ public class AttributeView extends ViewPart {
         }
     }
 
-    class AttributeLabelProvider implements ITableLabelProvider {
+    private static class AttributeLabelProvider implements ITableLabelProvider {
 
         @Override
         public void addListener(ILabelProviderListener arg0) {
index 1de56ac..c1642d2 100644 (file)
@@ -56,8 +56,9 @@ import org.eclipse.ui.dialogs.PatternFilter;
 import org.eclipse.ui.part.ViewPart;
 
 import java.io.BufferedWriter;
-import java.io.FileWriter;
+import java.io.FileOutputStream;
 import java.io.IOException;
+import java.io.OutputStreamWriter;
 import java.text.DateFormat;
 import java.text.SimpleDateFormat;
 import java.util.Date;
@@ -431,9 +432,10 @@ public class LogView extends ViewPart {
                 String data = sb.toString();
                 BufferedWriter out = null;
                 try {
-                    out = new BufferedWriter(new FileWriter(name));
+                    out = new BufferedWriter(new OutputStreamWriter(
+                            new FileOutputStream(name), "UTF-8"));
                     out.write(data);
-                } catch (IOException e) {
+                } catch (Exception e) {
                     e.printStackTrace();
                     MessageDialog.openError(
                             Display.getDefault().getActiveShell(),
index 7516f00..7f4ec41 100644 (file)
@@ -330,7 +330,8 @@ public class MetaPropertiesView extends ViewPart {
                 devicePlatformInfoUIListener);
     }
 
-    class PropertycontentProvider implements IStructuredContentProvider {
+    private static class PropertycontentProvider implements
+            IStructuredContentProvider {
 
         @Override
         public void dispose() {
index d6ab842..58c110b 100644 (file)
@@ -165,7 +165,8 @@ public class ModelArrayAddItemDialog extends TitleAreaDialog {
         }
     }
 
-    class AttributeContentProvider implements ITreeContentProvider {
+    private static class AttributeContentProvider implements
+            ITreeContentProvider {
 
         @Override
         public void dispose() {
@@ -214,7 +215,7 @@ public class ModelArrayAddItemDialog extends TitleAreaDialog {
         }
     }
 
-    class AttributeLabelProvider implements ITableLabelProvider {
+    private static class AttributeLabelProvider implements ITableLabelProvider {
 
         @Override
         public void addListener(ILabelProviderListener arg0) {
index ee09154..8d694bb 100644 (file)
@@ -645,7 +645,8 @@ public class PostRequestDialog extends TitleAreaDialog {
         return (AttributeElement) item.getData();
     }
 
-    class AttributeContentProvider implements ITreeContentProvider {
+    private static class AttributeContentProvider implements
+            ITreeContentProvider {
 
         @Override
         public void dispose() {
@@ -698,7 +699,7 @@ public class PostRequestDialog extends TitleAreaDialog {
         }
     }
 
-    class AttributeLabelProvider implements ITableLabelProvider {
+    private static class AttributeLabelProvider implements ITableLabelProvider {
 
         @Override
         public void addListener(ILabelProviderListener arg0) {
index e4e22e6..a5ccdb2 100644 (file)
@@ -634,7 +634,8 @@ public class PutRequestDialog extends TitleAreaDialog {
         return (AttributeElement) item.getData();
     }
 
-    class AttributeContentProvider implements ITreeContentProvider {
+    private static class AttributeContentProvider implements
+            ITreeContentProvider {
 
         @Override
         public void dispose() {
@@ -687,7 +688,7 @@ public class PutRequestDialog extends TitleAreaDialog {
         }
     }
 
-    class AttributeLabelProvider implements ITableLabelProvider {
+    private static class AttributeLabelProvider implements ITableLabelProvider {
 
         @Override
         public void addListener(ILabelProviderListener arg0) {
index 3a1690b..777605f 100644 (file)
@@ -28,7 +28,7 @@ import java.util.Map;
 
 public class SerializedServiceProvider implements Serializable {
 
-    public class SerializedAttribute implements Serializable {
+    public static class SerializedAttribute implements Serializable {
 
         public String getName() {
             return m_name;
index 897ddb5..22d7533 100644 (file)
@@ -69,7 +69,7 @@ public class AttributeEditingSupport {
     private AttributeValueEditor attValueEditor;
     private AutomationEditor     automationEditor;
 
-    class SyncValueUpdate {
+    private static class SyncValueUpdate {
         private Boolean valueChangeInProgress;
 
         public boolean isValueChangeInProgress() {
@@ -715,7 +715,7 @@ public class AttributeEditingSupport {
         }
     }
 
-    class AutomationEditor extends EditingSupport {
+    private static class AutomationEditor extends EditingSupport {
 
         private final TreeViewer viewer;
 
index c008f13..f3e2e53 100644 (file)
@@ -760,7 +760,8 @@ public class AttributeView extends ViewPart {
                 automationUIListener);
     }
 
-    class AttributeContentProvider implements ITreeContentProvider {
+    private static class AttributeContentProvider implements
+            ITreeContentProvider {
 
         @Override
         public void dispose() {
index bc42c37..c5357ac 100644 (file)
@@ -339,7 +339,8 @@ public class DevicePlatformInfoView extends ViewPart {
         }
     }
 
-    class PropertycontentProvider implements IStructuredContentProvider {
+    private static class PropertycontentProvider implements
+            IStructuredContentProvider {
 
         @Override
         public void dispose() {
index a43d546..4098cbb 100644 (file)
@@ -56,8 +56,9 @@ import org.eclipse.ui.dialogs.PatternFilter;
 import org.eclipse.ui.part.ViewPart;
 
 import java.io.BufferedWriter;
-import java.io.FileWriter;
+import java.io.FileOutputStream;
 import java.io.IOException;
+import java.io.OutputStreamWriter;
 import java.text.DateFormat;
 import java.text.SimpleDateFormat;
 import java.util.HashMap;
@@ -430,9 +431,10 @@ public class LogView extends ViewPart {
                 String data = sb.toString();
                 BufferedWriter out = null;
                 try {
-                    out = new BufferedWriter(new FileWriter(name));
+                    out = new BufferedWriter(new OutputStreamWriter(
+                            new FileOutputStream(name), "UTF-8"));
                     out.write(data);
-                } catch (IOException e) {
+                } catch (Exception e) {
                     e.printStackTrace();
                     MessageDialog.openError(
                             Display.getDefault().getActiveShell(),
index 11f2dc1..d5fd2d6 100644 (file)
@@ -416,7 +416,8 @@ public class MetaPropertiesView extends ViewPart {
                 resourceSelectionChangedListener);
     }
 
-    class PropertycontentProvider implements IStructuredContentProvider {
+    private static class PropertycontentProvider implements
+            IStructuredContentProvider {
 
         @Override
         public void dispose() {
index 10d468f..4fd8238 100644 (file)
@@ -235,7 +235,8 @@ public class ResourceObserverView extends ViewPart {
                 resourceObserverListChangedListener);
     }
 
-    class ObserverContentProvider implements IStructuredContentProvider {
+    private static class ObserverContentProvider implements
+            IStructuredContentProvider {
 
         @Override
         public void dispose() {
index 17ad973..6dd56fa 100644 (file)
@@ -69,16 +69,16 @@ public class AddAttributeDialog extends TitleAreaDialog {
 
     private Set<AttributeHelper> attributes;
 
-    private final String         defaultMessage   = "Name, Type, and Default Value fields "
+    private static final String  defaultMessage   = "Name, Type, and Default Value fields "
                                                           + "are mandatory.\n\nRange and custom fields allow to set the valid "
                                                           + "values of the attribute.\n\n";
-    private final String         msgForBoolType   = "Possible attribute values of Bool are "
+    private static final String  msgForBoolType   = "Possible attribute values of Bool are "
                                                           + "true and false.\nSo range and custom options are disabled.";
-    private final String         msgForIntType    = "Valid values for Int type can either be "
+    private static final String  msgForIntType    = "Valid values for Int type can either be "
                                                           + "of range type (Ex: 1 - 10) or custom values (Ex: 10, 20, 50, and 100).\n";
-    private final String         msgForDoubleType = "Valid values for Double type can either be "
+    private static final String  msgForDoubleType = "Valid values for Double type can either be "
                                                           + "of range type (Ex: 18.0 - 22.0) or custom values (Ex: 1.5, 2.5, 3.9, 4.8, etc).\n";
-    private final String         msgForStringType = "For String type, range option is not"
+    private static final String  msgForStringType = "For String type, range option is not"
                                                           + "applicable. Hence it is disabled.\n\n"
                                                           + "Custom option is available to provide the valid values.\n\n"
                                                           + "Ex: low, mid, high, etc.";
index 9514b7d..b5bd831 100644 (file)
@@ -233,7 +233,7 @@ public class DeleteResourcePage extends WizardPage {
         }
     }
 
-    class TreeLabelProvider extends LabelProvider {
+    private static class TreeLabelProvider extends LabelProvider {
         @Override
         public String getText(Object element) {
             if (element instanceof TreeViewContentHelper) {
@@ -254,7 +254,7 @@ public class DeleteResourcePage extends WizardPage {
         }
     }
 
-    class TreeViewContentHelper {
+    private static class TreeViewContentHelper {
         List<? extends Resource> resources;
 
         public TreeViewContentHelper(List<? extends Resource> resources) {
index e436e9f..85bc7a4 100644 (file)
@@ -161,7 +161,8 @@ public class ModelArrayAddItemDialog extends TitleAreaDialog {
         }
     }
 
-    class AttributeContentProvider implements ITreeContentProvider {
+    private static class AttributeContentProvider implements
+            ITreeContentProvider {
 
         @Override
         public void dispose() {
@@ -212,7 +213,7 @@ public class ModelArrayAddItemDialog extends TitleAreaDialog {
         }
     }
 
-    class AttributeLabelProvider implements ITableLabelProvider {
+    private static class AttributeLabelProvider implements ITableLabelProvider {
 
         @Override
         public void addListener(ILabelProviderListener arg0) {
index 64decdd..b1eefba 100644 (file)
@@ -337,7 +337,8 @@ public class SimpleResourceAddAttributePage extends WizardPage {
                 });
     }
 
-    class AttributeContentProvider implements ITreeContentProvider {
+    private static class AttributeContentProvider implements
+            ITreeContentProvider {
 
         List<AttributeHelper> attList = new ArrayList<AttributeHelper>();
 
index 281bedd..9298ed9 100644 (file)
@@ -33,7 +33,7 @@ public class AttributeValue {
     /**
      * Class which provides the value type information in detail.
      */
-    public class TypeInfo {
+    public static class TypeInfo {
         public ValueType mType;
         public ValueType mBaseType;
         public int       mDepth;