]> gerrit.simantics Code Review - simantics/platform.git/blobdiff - bundles/org.simantics.structural.synchronization.client/src/org/simantics/structural/synchronization/client/Synchronizer.java
Fix to handling of value access error reporting in synchronization.
[simantics/platform.git] / bundles / org.simantics.structural.synchronization.client / src / org / simantics / structural / synchronization / client / Synchronizer.java
index 2552192ef75dfa1f45d215c99855b87e91555a7d..cfd5fe69b4ec3eac4129c38a0c526e1b5e8a6441 100644 (file)
@@ -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<SerializedVariable> mapProperties(SynchronizationEventHandler handler, Variable child) throws DatabaseException {
         ArrayList<SerializedVariable> result = new ArrayList<SerializedVariable>();
         for(Variable prop : child.getProperties(graph, StructuralResource2.URIs.SynchronizedRelation)) {