diff --git a/inception/inception-api-annotation/src/main/java/de/tudarmstadt/ukp/inception/annotation/feature/multistring/MultiValueStringFeatureSupport.java b/inception/inception-api-annotation/src/main/java/de/tudarmstadt/ukp/inception/annotation/feature/multistring/MultiValueStringFeatureSupport.java index 193c7d3c59d..6009aa47e8a 100644 --- a/inception/inception-api-annotation/src/main/java/de/tudarmstadt/ukp/inception/annotation/feature/multistring/MultiValueStringFeatureSupport.java +++ b/inception/inception-api-annotation/src/main/java/de/tudarmstadt/ukp/inception/annotation/feature/multistring/MultiValueStringFeatureSupport.java @@ -137,7 +137,7 @@ public void setFeatureValue(CAS aCas, AnnotationFeature aFeature, int aAddress, FeatureStructure fs = getFS(aCas, aFeature, aAddress); List values = unwrapFeatureValue(aFeature, fs.getCAS(), aValue); - if (values == null) { + if (values == null || values.isEmpty()) { FSUtil.setFeature(fs, aFeature.getName(), (Collection) null); return; } diff --git a/inception/inception-api-schema/src/main/java/de/tudarmstadt/ukp/inception/schema/feature/FeatureUtil.java b/inception/inception-api-schema/src/main/java/de/tudarmstadt/ukp/inception/schema/feature/FeatureUtil.java index be5dd5c63c0..b230822aeed 100644 --- a/inception/inception-api-schema/src/main/java/de/tudarmstadt/ukp/inception/schema/feature/FeatureUtil.java +++ b/inception/inception-api-schema/src/main/java/de/tudarmstadt/ukp/inception/schema/feature/FeatureUtil.java @@ -147,6 +147,11 @@ private static void setLinkFeature(FeatureStructure aFS, AnnotationFeature aFeat public static void setLinkFeatureValue(FeatureStructure aFS, Feature aFeature, List linkFSes) { + if (linkFSes == null || linkFSes.isEmpty()) { + aFS.setFeatureValue(aFeature, null); + return; + } + // Create a new array if size differs otherwise re-use existing one var array = (ArrayFS) ICasUtil.getFeatureFS(aFS, aFeature.getShortName()); if (array == null || (array.size() != linkFSes.size())) { diff --git a/inception/inception-ui-kb/src/main/java/de/tudarmstadt/ukp/inception/ui/kb/feature/MultiValueConceptFeatureSupport.java b/inception/inception-ui-kb/src/main/java/de/tudarmstadt/ukp/inception/ui/kb/feature/MultiValueConceptFeatureSupport.java index ac5f923bbfe..e759337033d 100644 --- a/inception/inception-ui-kb/src/main/java/de/tudarmstadt/ukp/inception/ui/kb/feature/MultiValueConceptFeatureSupport.java +++ b/inception/inception-ui-kb/src/main/java/de/tudarmstadt/ukp/inception/ui/kb/feature/MultiValueConceptFeatureSupport.java @@ -282,7 +282,7 @@ public void setFeatureValue(CAS aCas, AnnotationFeature aFeature, int aAddress, FeatureStructure fs = getFS(aCas, aFeature, aAddress); List values = unwrapFeatureValue(aFeature, fs.getCAS(), aValue); - if (values == null) { + if (values == null || values.isEmpty()) { FSUtil.setFeature(fs, aFeature.getName(), (Collection) null); return; }