Revision a8905b5d
Added by Andreas Kohlbecker almost 4 years ago
cdmlib-remote/src/main/java/eu/etaxonomy/cdm/remote/json/processor/bean/TeamOrPersonBaseBeanProcessor.java | ||
---|---|---|
10 | 10 |
|
11 | 11 |
import java.util.List; |
12 | 12 |
|
13 |
import org.hibernate.LazyInitializationException; |
|
14 |
|
|
15 | 13 |
import eu.etaxonomy.cdm.model.agent.TeamOrPersonBase; |
16 | 14 |
import net.sf.json.JSONObject; |
17 | 15 |
import net.sf.json.JsonConfig; |
... | ... | |
33 | 31 |
@Override |
34 | 32 |
public JSONObject processBeanSecondStep(TeamOrPersonBase bean, JSONObject json, |
35 | 33 |
JsonConfig jsonConfig) { |
36 |
//NOTE LazyInitializationException related to author teams are often causing problems |
|
37 |
// so we catch them here in order to avoid breaking the web service response completely |
|
38 |
// The team should be initialized by the TeamAutoInitializer but due to the bug #7331 |
|
39 |
// this seems to be broken in specific cases. |
|
40 |
// The below try-catch should be removed once #7331 but by carefully checking the examples |
|
41 |
// #9095, #9096. Other tickets related to LIEs and eu.etaxonomy.cdm.model.agent.Team.teamMembers |
|
42 |
// should also be checked. |
|
43 |
try { |
|
44 | 34 |
json.element("titleCache", bean.getTitleCache()); |
45 |
} catch (LazyInitializationException e) { |
|
46 |
logger.error("Caught LazyInitializationException at getTitleCache()", e); |
|
47 |
} |
|
48 |
try { |
|
49 | 35 |
json.element("nomenclaturalTitle", bean.getNomenclaturalTitle()); |
50 |
} catch (LazyInitializationException e) { |
|
51 |
logger.error("Caught LazyInitializationException at getNomenclaturalTitle()", e); |
|
52 |
} |
|
53 | 36 |
return json; |
54 | 37 |
} |
55 | 38 |
|
Also available in: Unified diff
reverting commit last for ref #9095, ref #9096, ref #7331 for a better solution