You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@causeway.apache.org by ah...@apache.org on 2023/09/26 14:22:42 UTC

[causeway] branch master updated: CAUSEWAY-3606: adds OID info to invalidFieldAccess exception

This is an automated email from the ASF dual-hosted git repository.

ahuber pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/causeway.git


The following commit(s) were added to refs/heads/master by this push:
     new 537abf53fc CAUSEWAY-3606: adds OID info to invalidFieldAccess exception
537abf53fc is described below

commit 537abf53fc3ec0b856b4ade31be69436db893298
Author: Andi Huber <ah...@apache.org>
AuthorDate: Tue Sep 26 16:22:37 2023 +0200

    CAUSEWAY-3606: adds OID info to invalidFieldAccess exception
---
 .../jdo/datanucleus/entities/DnStateManagerForHollow.java    | 12 ++++++------
 1 file changed, 6 insertions(+), 6 deletions(-)

diff --git a/persistence/jdo/datanucleus/src/main/java/org/apache/causeway/persistence/jdo/datanucleus/entities/DnStateManagerForHollow.java b/persistence/jdo/datanucleus/src/main/java/org/apache/causeway/persistence/jdo/datanucleus/entities/DnStateManagerForHollow.java
index e5dd07c7fc..64f13340b9 100644
--- a/persistence/jdo/datanucleus/src/main/java/org/apache/causeway/persistence/jdo/datanucleus/entities/DnStateManagerForHollow.java
+++ b/persistence/jdo/datanucleus/src/main/java/org/apache/causeway/persistence/jdo/datanucleus/entities/DnStateManagerForHollow.java
@@ -225,9 +225,6 @@ class DnStateManagerForHollow implements DNStateManager<Persistable> {
     @Override public void checkInheritance(final FieldValues fv) { }
     @Override public void markFieldsAsLoaded(final int[] fieldNumbers) { }
 
-    private final static String INVALID_FIELD_ACCESS_MSG =
-            "JDO entity %s is in HOLLOW state, its fields are no longer valid.";
-
     @Override public boolean getBooleanField(final Persistable pc, final int field, final boolean currentValue) {
         throw invalidFieldAccess(pc);
     }
@@ -270,10 +267,13 @@ class DnStateManagerForHollow implements DNStateManager<Persistable> {
         //return null; // mimics behavior as if there was no StateManager
     }
 
-    static RuntimeException invalidFieldAccess(final @Nullable Persistable pc) {
+    private final static String INVALID_FIELD_ACCESS_MSG =
+            "JDO entity %s(oid=%s) is in HOLLOW state, its fields are no longer valid.";
+
+    private RuntimeException invalidFieldAccess(final @Nullable Persistable pc) {
         return pc==null
-            ? _Exceptions.unrecoverable(INVALID_FIELD_ACCESS_MSG, "Persistable") // just in case
-            : _Exceptions.unrecoverable(INVALID_FIELD_ACCESS_MSG, pc.getClass().getName()); // free of side effects
+            ? _Exceptions.unrecoverable(INVALID_FIELD_ACCESS_MSG, "Persistable", "oidStringified") // just in case
+            : _Exceptions.unrecoverable(INVALID_FIELD_ACCESS_MSG, pc.getClass().getName(), oidStringified); // free of side effects
     }
 
 }