From 6e0ed21f85d02e10a199cd141493d97625a7d8f4 Mon Sep 17 00:00:00 2001 From: Charlton Dowding Date: Fri, 8 Nov 2019 14:12:47 +0000 Subject: [PATCH 1/2] fix(#1072): Removed stacktrace and added custom message --- .../deg/profile/serialisation/ProfileDeserialiser.java | 8 +++----- 1 file changed, 3 insertions(+), 5 deletions(-) diff --git a/profile/src/main/java/com/scottlogic/deg/profile/serialisation/ProfileDeserialiser.java b/profile/src/main/java/com/scottlogic/deg/profile/serialisation/ProfileDeserialiser.java index 24bba69dd..18b01cc08 100644 --- a/profile/src/main/java/com/scottlogic/deg/profile/serialisation/ProfileDeserialiser.java +++ b/profile/src/main/java/com/scottlogic/deg/profile/serialisation/ProfileDeserialiser.java @@ -18,12 +18,10 @@ import com.fasterxml.jackson.databind.DeserializationFeature; import com.fasterxml.jackson.databind.ObjectMapper; +import com.scottlogic.deg.common.ValidationException; import com.scottlogic.deg.profile.dtos.ProfileDTO; import com.scottlogic.deg.profile.reader.FileReader; -import java.io.IOException; -import java.io.UncheckedIOException; - public class ProfileDeserialiser { @@ -35,8 +33,8 @@ public static ProfileDTO deserialise(String json, FileReader fileReader) mapper.enable(DeserializationFeature.USE_BIG_DECIMAL_FOR_FLOATS); try { return mapper.readerFor(ProfileDTO.class).readValue(json); - } catch (IOException e) { - throw new UncheckedIOException(e); + } catch (Exception e) { + throw new ValidationException("Profile json is not valid\n" + e.getLocalizedMessage()); } } } From 0943e0cdf2c6c4980d92bb897a46b7dbac4994a2 Mon Sep 17 00:00:00 2001 From: Charlton Dowding Date: Fri, 8 Nov 2019 14:20:31 +0000 Subject: [PATCH 2/2] LocalisedMessage changed to Message --- .../deg/profile/serialisation/ProfileDeserialiser.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/profile/src/main/java/com/scottlogic/deg/profile/serialisation/ProfileDeserialiser.java b/profile/src/main/java/com/scottlogic/deg/profile/serialisation/ProfileDeserialiser.java index 18b01cc08..354d1e952 100644 --- a/profile/src/main/java/com/scottlogic/deg/profile/serialisation/ProfileDeserialiser.java +++ b/profile/src/main/java/com/scottlogic/deg/profile/serialisation/ProfileDeserialiser.java @@ -34,7 +34,7 @@ public static ProfileDTO deserialise(String json, FileReader fileReader) try { return mapper.readerFor(ProfileDTO.class).readValue(json); } catch (Exception e) { - throw new ValidationException("Profile json is not valid\n" + e.getLocalizedMessage()); + throw new ValidationException("Profile json is not valid\n" + e.getMessage()); } } }