2 * Copyright (C) 2016 EDIT
3 * European Distributed Institute of Taxonomy
4 * http://www.e-taxonomy.eu
6 * The contents of this file are subject to the Mozilla Public License Version 1.1
7 * See LICENSE.TXT at the top of this package for the full license terms.
9 package eu
.etaxonomy
.cdm
.hibernate
;
11 import java
.util
.Collection
;
13 import org
.apache
.log4j
.Logger
;
14 import org
.hibernate
.LazyInitializationException
;
18 * Helper class to remove null values from collections which are left over artifacts due to
19 * https://hibernate.atlassian.net/browse/HHH-9751
21 * @author a.kohlbecker
25 public class HHH_9751_Util
{
27 private static final Logger logger
= Logger
.getLogger(HHH_9751_Util
.class);
32 * @return the number of null values removed from the collection
34 static public int removeAllNull(Collection collection
) {
39 if (collection
.contains(null)){
40 while(collection
.contains(null)){
42 collection
.remove(null);
46 } catch (LazyInitializationException e
) {
47 logger
.info("Cannot clean up uninitialized children without a session, skipping.");