import java.util.TreeSet;
import java.util.stream.Collectors;
+import org.apache.commons.lang.StringUtils;
+
import eu.etaxonomy.cdm.hibernate.HibernateProxyHelper;
import eu.etaxonomy.cdm.model.agent.AgentBase;
import eu.etaxonomy.cdm.model.common.IdentifiableSource;
fieldUnit = getFieldUnit((DerivedUnit)specimenOrObservation);
}
if (fieldUnit != null){
- AgentBase collector = fieldUnit.getGatheringEvent().getCollector();
- String fieldNumberString = fieldUnit.getFieldNumber() != null ? " - " + fieldUnit.getFieldNumber(): "";
-
-
+ AgentBase collector = null;
+ if (fieldUnit.getGatheringEvent() != null){
+ collector = fieldUnit.getGatheringEvent().getCollector();
+ }
+ String fieldNumberString = fieldUnit.getFieldNumber() != null ? fieldUnit.getFieldNumber(): "";
if (collector != null){
- collectorsString = collector.getTitleCache() + fieldNumberString;
+ collectorsString = collector.getTitleCache();
}
+ collectorsString = StringUtils.isBlank(collectorsString)? fieldNumberString: collectorsString + " - " + fieldNumberString;
}
addDeterminations(specimenOrObservation.getDeterminations());
setDeterminations(specimenOrObservation.getDeterminations().stream()