improve logging for exception in AbstractPersistentCollection.remoteInitialize()
authorAndreas Müller <a.mueller@bgbm.org>
Mon, 4 Jul 2022 20:02:11 +0000 (22:02 +0200)
committerAndreas Müller <a.mueller@bgbm.org>
Mon, 4 Jul 2022 20:02:39 +0000 (22:02 +0200)
eu.etaxonomy.taxeditor.cdmlib/src/main/java/org/hibernate/collection/internal/AbstractPersistentCollection.java

index 7f124baf0a9e3dc795ef83103901b6f27d989828..1cabe61b8c48a271148deb827dd2647d4051a391 100644 (file)
@@ -1479,12 +1479,14 @@ public abstract class AbstractPersistentCollection implements Serializable, Pers
                    Object collectionType = null;
                    Field field = null;
                    Class<?> clazz = null;
+                   String codePart = "1";
                        try {
                                String role = getRole();
                                String fieldName = role.substring(role.lastIndexOf(".") + 1);
                                LOG.info("--> Remote Lazy Initializing Collection " + getRole() + " , owner : " + getOwner().getClass() + "/" + getKey() + " , field : " + fieldName);
                                Object owner = getOwner();
                                CdmBase cdmBase;
+                   codePart = "2";
                                if(owner instanceof CdmBase) {
                                    cdmBase = (CdmBase)owner;
                                } else {
@@ -1493,30 +1495,38 @@ public abstract class AbstractPersistentCollection implements Serializable, Pers
                                if(configuration == null) {
                                        throw new HibernateException("CdmApplicationRemoteConfiguration not initialized (null)");
                                }
+                codePart = "3";
+
                                ICachedCommonService cachedCommonService = configuration.getCachedCommonService();
                                if(cachedCommonService == null) {
                                        throw new HibernateException("commonService not initialized (null)");
                                }
+                codePart = "4";
 
                                //Object obj = ProxyUtils.deproxyIfInitialized(cachedCommonService.initializeCollection(this));
                                Object obj = ProxyUtils.deproxyIfInitialized(cachedCommonService.initializeCollection(cdmBase.getUuid(), fieldName));
                                if(ProxyUtils.isUninitializedProxy(obj)) {
                                    throw new HibernateException("Persistent Collection initialized but is still a proxy");
                                }
+                codePart = "5";
                                afterInitialize();
 
                                clazz = getClass();
+                codePart = "6";
                                if (clazz != null) {
                                        collectionType = ProxyUtils.getCollectionType(obj, clazz);
-                                   field = clazz.getDeclaredField(collectionType.toString());
+                       codePart = "7";
+                                       field = clazz.getDeclaredField(collectionType.toString());
+                       codePart = "8";
                                        field.setAccessible(true);
                                        field.set(this, obj);
-                                       ProxyUtils.setRoleValueInOwner(owner, role, obj);
+                           codePart = "9";
 
+                                       ProxyUtils.setRoleValueInOwner(owner, role, obj);
                                }
                        } catch (Exception ex) {
                            String originalMessage = ex.getMessage();
-                           String message = originalMessage + "clazz: " + (clazz == null? "" :clazz.getSimpleName())+ "- field: " + field + " - collectionType: " + collectionType;
+                           String message = originalMessage + ", clazz: " + (clazz == null? "" :clazz.getSimpleName())+ ", field: " + field + ", collectionType: " + collectionType + ", at code part: " + codePart;
                            throw new CdmEagerLoadingException(message);
                        }
                }