From d15590926e54a6722ba5387b25461e42b89632af Mon Sep 17 00:00:00 2001 From: Luca Frosini Date: Wed, 8 Jul 2015 09:15:54 +0000 Subject: [PATCH] Fixed bug on object creation from map git-svn-id: https://svn.d4science.research-infrastructures.eu/gcube/trunk/accounting/accounting-lib@117069 82a268e6-3cf1-43bd-a215-b396298e98cf --- .../gcube/accounting/datamodel/BasicUsageRecord.java | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/src/main/java/org/gcube/accounting/datamodel/BasicUsageRecord.java b/src/main/java/org/gcube/accounting/datamodel/BasicUsageRecord.java index 3f50abe..f319bca 100644 --- a/src/main/java/org/gcube/accounting/datamodel/BasicUsageRecord.java +++ b/src/main/java/org/gcube/accounting/datamodel/BasicUsageRecord.java @@ -288,8 +288,8 @@ public abstract class BasicUsageRecord implements UsageRecord, Serializable { */ @Override public void setResourceProperties(Map properties) throws InvalidValueException { - validateProperties(properties); - this.resourceProperties = new HashMap(properties); + Map validated = validateProperties(properties); + this.resourceProperties = new HashMap(validated); } /** @@ -400,11 +400,13 @@ public abstract class BasicUsageRecord implements UsageRecord, Serializable { return checkedValue; } - protected void validateProperties(Map properties) throws InvalidValueException{ + protected Map validateProperties(Map properties) throws InvalidValueException{ + Map validated = new HashMap(); for(String key : properties.keySet()){ Serializable serializable = properties.get(key); - validateField(key, serializable); + validated.put(key, validateField(key, serializable)); } + return validated; } /** @@ -471,7 +473,6 @@ public abstract class BasicUsageRecord implements UsageRecord, Serializable { } return 1; } - @SuppressWarnings("unchecked") protected static Class getClass(String usageRecordName, boolean aggregated) throws ClassNotFoundException {