From: Reino Ruusu Date: Thu, 11 Apr 2019 13:56:15 +0000 (+0300) Subject: Fix to handling of value access error reporting in synchronization. X-Git-Tag: v1.43.0~136^2~165 X-Git-Url: https://gerrit.simantics.org/r/gitweb?a=commitdiff_plain;h=refs%2Fchanges%2F49%2F2849%2F2;p=simantics%2Fplatform.git Fix to handling of value access error reporting in synchronization. gitlab #286 Change-Id: I025541c35a9cf9667eaaf845b68451d1da3af6f3 --- 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)) {