From dd253bfd2c17044a7f8d2e02f682ce0f091e4830 Mon Sep 17 00:00:00 2001 From: Reino Ruusu Date: Thu, 11 Apr 2019 16:56:15 +0300 Subject: [PATCH] Fix to handling of value access error reporting in synchronization. gitlab #286 Change-Id: I025541c35a9cf9667eaaf845b68451d1da3af6f3 --- .../synchronization/client/Synchronizer.java | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/bundles/org.simantics.structural.synchronization.client/src/org/simantics/structural/synchronization/client/Synchronizer.java b/bundles/org.simantics.structural.synchronization.client/src/org/simantics/structural/synchronization/client/Synchronizer.java index 2552192ef..cfd5fe69b 100644 --- a/bundles/org.simantics.structural.synchronization.client/src/org/simantics/structural/synchronization/client/Synchronizer.java +++ b/bundles/org.simantics.structural.synchronization.client/src/org/simantics/structural/synchronization/client/Synchronizer.java @@ -118,22 +118,26 @@ public class Synchronizer { } return result; } catch (MissingVariableValueException e) { - handler.reportProblem("Failed to read " + name + ". " + e.getMessage()); + handler.reportProblem("Failed to read " + name + ": " + e.getMessage()); Throwable cur = e; while((cur = cur.getCause()) != null) { if(!(cur instanceof MissingVariableValueException)) { - handler.reportProblem(cur.getMessage()); + handler.reportProblem(" " + getSafeDescription(cur)); } } } catch (Exception e) { - handler.reportProblem("Failed to serialize " + name + ": " + e.getMessage(), e); + handler.reportProblem("Failed to serialize " + name + ": " + getSafeDescription(e), e); } return null; } + private String getSafeDescription(Throwable cur) { + return cur.getClass().getName() + (cur == null || cur.getMessage() != null ? ": " + cur.getMessage() : ""); + } + Collection mapProperties(SynchronizationEventHandler handler, Variable child) throws DatabaseException { ArrayList result = new ArrayList(); for(Variable prop : child.getProperties(graph, StructuralResource2.URIs.SynchronizedRelation)) { -- 2.43.2