summaryrefslogtreecommitdiff
path: root/eaaf_core/src/main/java/at/gv/egiz/eaaf/core/impl/idp/controller/AbstractController.java
diff options
context:
space:
mode:
authorThomas Lenz <thomas.lenz@egiz.gv.at>2020-10-13 16:31:03 +0200
committerThomas Lenz <thomas.lenz@egiz.gv.at>2020-10-13 16:31:03 +0200
commit54fdf1c8201312ffedec71595aa6602bb11e7640 (patch)
tree66fbf26805f04b3d4495365a6dc66abbea2fe285 /eaaf_core/src/main/java/at/gv/egiz/eaaf/core/impl/idp/controller/AbstractController.java
parent379cd870ec5a3e6d66825d75a37e091e4e181074 (diff)
downloadEAAF-Components-54fdf1c8201312ffedec71595aa6602bb11e7640.tar.gz
EAAF-Components-54fdf1c8201312ffedec71595aa6602bb11e7640.tar.bz2
EAAF-Components-54fdf1c8201312ffedec71595aa6602bb11e7640.zip
Serialize exceptions in error-handler manually to fix problems with Serialization in some caching frameworks
Diffstat (limited to 'eaaf_core/src/main/java/at/gv/egiz/eaaf/core/impl/idp/controller/AbstractController.java')
-rw-r--r--eaaf_core/src/main/java/at/gv/egiz/eaaf/core/impl/idp/controller/AbstractController.java17
1 files changed, 14 insertions, 3 deletions
diff --git a/eaaf_core/src/main/java/at/gv/egiz/eaaf/core/impl/idp/controller/AbstractController.java b/eaaf_core/src/main/java/at/gv/egiz/eaaf/core/impl/idp/controller/AbstractController.java
index e9687833..58c8c0a9 100644
--- a/eaaf_core/src/main/java/at/gv/egiz/eaaf/core/impl/idp/controller/AbstractController.java
+++ b/eaaf_core/src/main/java/at/gv/egiz/eaaf/core/impl/idp/controller/AbstractController.java
@@ -47,6 +47,7 @@ import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.context.ApplicationContext;
+import org.springframework.util.SerializationUtils;
import org.springframework.web.bind.annotation.ExceptionHandler;
/**
@@ -170,11 +171,21 @@ public abstract class AbstractController {
final String errorKey = Random.nextLongRandom();
if (errorToHandle.getFirst() != null) {
revisionsLogger.logEvent(errorToHandle.getFirst(), EventConstants.TRANSACTION_ERROR);
- transactionStorage.put(errorKey, new ExceptionContainer(errorToHandle.getFirst(), errorToHandle
- .getSecond()), -1);
+
+ log.trace("Serializing {} ... ", ExceptionContainer.class.getName());
+ final byte[] serializedError = SerializationUtils.serialize(
+ new ExceptionContainer(errorToHandle.getFirst(), errorToHandle.getSecond()));
+
+ log.trace("Put 'ExceptionContainer' into cache ... ");
+ transactionStorage.put(errorKey, serializedError, -1);
} else {
- transactionStorage.put(errorKey, new ExceptionContainer(null, errorToHandle.getSecond()), -1);
+ log.trace("Serializing {} ... ", ExceptionContainer.class.getName());
+ final byte[] serializedError = SerializationUtils.serialize(
+ new ExceptionContainer(null, errorToHandle.getSecond()));
+
+ log.trace("Put 'ExceptionContainer' into cache ... ");
+ transactionStorage.put(errorKey, serializedError, -1);
}