Skip to content

Commit

Permalink
Added check on empty String and fixed test
Browse files Browse the repository at this point in the history
  • Loading branch information
salvatore-coppola committed Nov 14, 2024
1 parent 41e55f7 commit 3621d50
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 5 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -342,7 +342,7 @@ private static ScaleOffsetType getScaleOffsetType(final Map<String, Object> prop
private static Number getValueScale(final Map<String, Object> properties) {
final String valueScale = (String) properties.get(VALUE_SCALE.value());

if (valueScale == null) {
if (valueScale == null || valueScale.isEmpty()) {
return 1.0d;
}
return parseScaleOffsetTypedValue(getScaleOffsetType(properties), valueScale);
Expand All @@ -351,7 +351,7 @@ private static Number getValueScale(final Map<String, Object> properties) {
private static Number getValueOffset(final Map<String, Object> properties) {
final String valueOffset = (String) properties.get(VALUE_OFFSET.value());

if (valueOffset == null) {
if (valueOffset == null || valueOffset.isEmpty()) {
return 0.0d;
}
return parseScaleOffsetTypedValue(getScaleOffsetType(properties), valueOffset);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -120,17 +120,17 @@ public class Snippets {
+ " },\n" //
+ " {\n" //
+ " \"name\": \"scale\",\n" //
+ " \"description\": \"Scale to be applied to the numeric value of the channel\",\n" //
+ " \"description\": \"Scale to be applied to the numeric value of the channel.\",\n" //
+ " \"id\": \"+scale\",\n" //
+ " \"type\": \"DOUBLE\",\n" //
+ " \"type\": \"STRING\",\n" //
+ " \"cardinality\": 0,\n" //
+ " \"isRequired\": false\n" //
+ " },\n" //
+ " {\n" //
+ " \"name\": \"offset\",\n" //
+ " \"description\": \"Offset to be applied to the numeric value of the channel\",\n" //
+ " \"id\": \"+offset\",\n" //
+ " \"type\": \"DOUBLE\",\n" //
+ " \"type\": \"STRING\",\n" //
+ " \"cardinality\": 0,\n" //
+ " \"isRequired\": false\n" //
+ " },\n" //
Expand Down

0 comments on commit 3621d50

Please sign in to comment.