From: G S Senthil Kumar Date: Fri, 19 Feb 2016 14:36:30 +0000 (+0530) Subject: Fixed minor issues found during integration testing. X-Git-Tag: 1.2.0+RC1~580^2^2~12 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=6c9b1f10fefa3323329977ef93e3ab854a7d5ba2;p=platform%2Fupstream%2Fiotivity.git Fixed minor issues found during integration testing. Correction in validation of primitive data. Change-Id: Iceb2df5d82354b63138fb388d68117158058d7cd Signed-off-by: G S Senthil Kumar Reviewed-on: https://gerrit.iotivity.org/gerrit/5083 Reviewed-by: Harish Marappa Tested-by: jenkins-iotivity Reviewed-by: Madan Lanka --- diff --git a/service/simulator/java/sdk/src/org/oic/simulator/ArrayValueValidator.java b/service/simulator/java/sdk/src/org/oic/simulator/ArrayValueValidator.java index fad211a..99f7d4f 100644 --- a/service/simulator/java/sdk/src/org/oic/simulator/ArrayValueValidator.java +++ b/service/simulator/java/sdk/src/org/oic/simulator/ArrayValueValidator.java @@ -155,7 +155,7 @@ class ArrayValueValidator implements // Validating elements of array AttributeProperty elementProperty = mProperty.getElementProperty(); - if (!elementProperty.isInteger()) { + if (!elementProperty.isString()) { return false; } diff --git a/service/simulator/java/sdk/src/org/oic/simulator/DoubleProperty.java b/service/simulator/java/sdk/src/org/oic/simulator/DoubleProperty.java index 95f5b9c..2daff28 100644 --- a/service/simulator/java/sdk/src/org/oic/simulator/DoubleProperty.java +++ b/service/simulator/java/sdk/src/org/oic/simulator/DoubleProperty.java @@ -88,8 +88,7 @@ public class DoubleProperty extends AttributeProperty { public boolean validate(double value) { if (mHasRange && (value < mMin || value > mMax)) { return false; - } else if (mValues.length > 0 - && -1 == Arrays.binarySearch(mValues, value)) { + } else if (hasValues() && 0 > Arrays.binarySearch(mValues, value)) { return false; } diff --git a/service/simulator/java/sdk/src/org/oic/simulator/IntegerProperty.java b/service/simulator/java/sdk/src/org/oic/simulator/IntegerProperty.java index 0220718..2448c2e 100644 --- a/service/simulator/java/sdk/src/org/oic/simulator/IntegerProperty.java +++ b/service/simulator/java/sdk/src/org/oic/simulator/IntegerProperty.java @@ -87,8 +87,7 @@ public class IntegerProperty extends AttributeProperty { public boolean validate(int value) { if (mHasRange && (value < mMin || value > mMax)) { return false; - } else if (mValues.length > 0 - && -1 == Arrays.binarySearch(mValues, value)) { + } else if (hasValues() && 0 > Arrays.binarySearch(mValues, value)) { return false; } diff --git a/service/simulator/java/sdk/src/org/oic/simulator/StringProperty.java b/service/simulator/java/sdk/src/org/oic/simulator/StringProperty.java index 39945eb..0660d5b 100644 --- a/service/simulator/java/sdk/src/org/oic/simulator/StringProperty.java +++ b/service/simulator/java/sdk/src/org/oic/simulator/StringProperty.java @@ -42,7 +42,8 @@ public class StringProperty extends AttributeProperty { private StringProperty(String value, String[] values) { super(Type.STRING); mDefaultValue = value; - mValues = values; + mValues = Arrays.copyOf(values, values.length); + Arrays.sort(mValues); } @Override @@ -88,8 +89,7 @@ public class StringProperty extends AttributeProperty { int length = value.length(); if (mHasRange && (length < mMin || length > mMax)) { return false; - } else if (mValues.length > 0 - && -1 == Arrays.binarySearch(mValues, value)) { + } else if (hasValues() && 0 > Arrays.binarySearch(mValues, value)) { return false; }