From 14521ab2d9ecfc64a9caa3654903ec7cbae12a97 Mon Sep 17 00:00:00 2001 From: herrtunante Date: Tue, 30 Jul 2024 10:59:51 +0200 Subject: [PATCH] Fix bug if subdivision name not present --- .../earth/ipcc/model/AbstractLandUseSubdivision.java | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/collect-earth/collect-earth-app/src/main/java/org/openforis/collect/earth/ipcc/model/AbstractLandUseSubdivision.java b/collect-earth/collect-earth-app/src/main/java/org/openforis/collect/earth/ipcc/model/AbstractLandUseSubdivision.java index d07b7ce1d8..fd32833408 100644 --- a/collect-earth/collect-earth-app/src/main/java/org/openforis/collect/earth/ipcc/model/AbstractLandUseSubdivision.java +++ b/collect-earth/collect-earth-app/src/main/java/org/openforis/collect/earth/ipcc/model/AbstractLandUseSubdivision.java @@ -3,6 +3,8 @@ import java.util.Objects; import java.util.UUID; +import org.jooq.tools.StringUtils; + public abstract class AbstractLandUseSubdivision implements Comparable>{ protected LandUseCategoryEnum category; @@ -82,6 +84,10 @@ public void setName(String name) { @Override public String toString() { - return getCategory().getCode() + " / " + getManagementType() + " / " + getCode(); + // sometimes the name might be empty if it was not specified in the right language in the survey (i.e. the label is present for Italian but not English ) + if( StringUtils.isEmpty( getName() ) ) { + return getCategory().getCode() + " / " + getManagementType() + " / " + getCode(); + } + return getCategory().getCode() + " / " + getManagementType() + " / " + getName(); } }