From 123ffb4e766047e37270bfffd46363ac85cdc4f9 Mon Sep 17 00:00:00 2001 From: Tuukka Lehtonen Date: Thu, 2 Nov 2017 14:56:16 +0200 Subject: [PATCH] Fixed databoard set binding getAll indexing bug All *SetBindings were missing a simple i++ increment which caused serialization of a TreeSet<..> structure to fail with NPE when the set contained more than 1 elements. refs #7592 Change-Id: Ic0f10324dfbfbafe527c624d7d092928a2f10bb7 --- .../simantics/databoard/binding/impl/DefaultSetBinding.java | 3 ++- .../org/simantics/databoard/binding/impl/HashSetBinding.java | 3 ++- .../org/simantics/databoard/binding/impl/TreeSetBinding.java | 3 ++- 3 files changed, 6 insertions(+), 3 deletions(-) diff --git a/bundles/org.simantics.databoard/src/org/simantics/databoard/binding/impl/DefaultSetBinding.java b/bundles/org.simantics.databoard/src/org/simantics/databoard/binding/impl/DefaultSetBinding.java index 1e8a56e02..6c0328801 100644 --- a/bundles/org.simantics.databoard/src/org/simantics/databoard/binding/impl/DefaultSetBinding.java +++ b/bundles/org.simantics.databoard/src/org/simantics/databoard/binding/impl/DefaultSetBinding.java @@ -116,7 +116,8 @@ public class DefaultSetBinding extends MapBinding { for (Object k : _setFrom) { keys[i] = k; values[i] = null; - } + i++; + } } @Override diff --git a/bundles/org.simantics.databoard/src/org/simantics/databoard/binding/impl/HashSetBinding.java b/bundles/org.simantics.databoard/src/org/simantics/databoard/binding/impl/HashSetBinding.java index 7a6230b2d..ce245d187 100644 --- a/bundles/org.simantics.databoard/src/org/simantics/databoard/binding/impl/HashSetBinding.java +++ b/bundles/org.simantics.databoard/src/org/simantics/databoard/binding/impl/HashSetBinding.java @@ -121,7 +121,8 @@ public class HashSetBinding extends MapBinding { for (Object k : _setFrom) { keys[i] = k; values[i] = null; - } + i++; + } } @Override diff --git a/bundles/org.simantics.databoard/src/org/simantics/databoard/binding/impl/TreeSetBinding.java b/bundles/org.simantics.databoard/src/org/simantics/databoard/binding/impl/TreeSetBinding.java index b030b9c5a..b36e016aa 100644 --- a/bundles/org.simantics.databoard/src/org/simantics/databoard/binding/impl/TreeSetBinding.java +++ b/bundles/org.simantics.databoard/src/org/simantics/databoard/binding/impl/TreeSetBinding.java @@ -118,7 +118,8 @@ public class TreeSetBinding extends MapBinding { for (Object k : _setFrom) { keys[i] = k; values[i] = null; - } + i++; + } } @Override -- 2.47.1