From: jsimomaa Date: Tue, 4 Dec 2018 09:22:07 +0000 (+0200) Subject: Replace e.printStackTrace() with Logger in DependencyChanges X-Git-Tag: v1.43.0~136^2~246 X-Git-Url: https://gerrit.simantics.org/r/gitweb?a=commitdiff_plain;h=ffff80e8ac94df27dfdf23c7c9f1898d5236dd31;p=simantics%2Fplatform.git Replace e.printStackTrace() with Logger in DependencyChanges gitlab #223 Change-Id: Ia0f585e0f78a225959e4a882760b1b3f4c73753f --- diff --git a/bundles/org.simantics.db.layer0/src/org/simantics/db/layer0/genericrelation/DependencyChanges.java b/bundles/org.simantics.db.layer0/src/org/simantics/db/layer0/genericrelation/DependencyChanges.java index a678abfc3..87f06cc41 100644 --- a/bundles/org.simantics.db.layer0/src/org/simantics/db/layer0/genericrelation/DependencyChanges.java +++ b/bundles/org.simantics.db.layer0/src/org/simantics/db/layer0/genericrelation/DependencyChanges.java @@ -2,6 +2,7 @@ package org.simantics.db.layer0.genericrelation; import java.io.IOException; import java.util.ArrayList; +import java.util.Arrays; import java.util.Map; import java.util.TreeMap; @@ -10,7 +11,6 @@ import org.simantics.databoard.annotations.Arguments; import org.simantics.databoard.annotations.Union; import org.simantics.databoard.binding.Binding; import org.simantics.databoard.binding.error.BindingConstructionException; -import org.simantics.databoard.serialization.SerializationException; import org.simantics.databoard.serialization.Serializer; import org.simantics.databoard.serialization.SerializerConstructionException; import org.simantics.db.Metadata; @@ -20,9 +20,13 @@ import org.simantics.db.Session; import org.simantics.db.common.utils.NameUtils; import org.simantics.db.exception.DatabaseException; import org.simantics.layer0.Layer0; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; public class DependencyChanges implements Metadata { - + + private static final Logger LOGGER = LoggerFactory.getLogger(DependencyChanges.class); + public final @Arguments({Resource.class, Change[].class}) TreeMap modelChanges; public final boolean hasUnresolved; @@ -142,18 +146,9 @@ public class DependencyChanges implements Metadata { Binding binding = databoard.getBinding( DependencyChanges.class ); Serializer serializer = databoard.getSerializer( binding ); return serializer.serialize(this); - } catch (SerializationException e) { - e.printStackTrace(); - } catch (IOException e) { - // TODO Auto-generated catch block - e.printStackTrace(); - } catch (SerializerConstructionException e) { - // TODO Auto-generated catch block - e.printStackTrace(); - } catch (BindingConstructionException e) { - // TODO Auto-generated catch block - e.printStackTrace(); - } + } catch (IOException | SerializerConstructionException | BindingConstructionException e) { + LOGGER.error("Could not serialise {} {}", getClass().getSimpleName(), this, e); + } return new byte[0]; } @@ -163,15 +158,9 @@ public class DependencyChanges implements Metadata { Binding binding = databoard.getBinding( DependencyChanges.class ); Serializer serializer = databoard.getSerializer( binding ); return (DependencyChanges) serializer.deserialize(input); - } catch (SerializationException e) { - e.printStackTrace(); - } catch (IOException e) { - e.printStackTrace(); - } catch (SerializerConstructionException e) { - e.printStackTrace(); - } catch (BindingConstructionException e) { - e.printStackTrace(); - } + } catch (IOException | SerializerConstructionException | BindingConstructionException e) { + LOGGER.error("Could not deserialise {}", Arrays.toString(input), e); + } return null; }