diff options
author | Artur Signell <artur@vaadin.com> | 2014-12-15 08:41:45 +0200 |
---|---|---|
committer | Matti Hosio <mhosio@vaadin.com> | 2014-12-15 16:35:54 +0200 |
commit | 8eafe7aee31b3e2f80c87b39c4e42e260a86a5eb (patch) | |
tree | 93bf9f429390e5643a55f503076a391469359ce2 /server/src/com/vaadin/ui/declarative | |
parent | 3b75f2b14833f78c00d0032cbd76b09fca058100 (diff) | |
download | vaadin-framework-8eafe7aee31b3e2f80c87b39c4e42e260a86a5eb.tar.gz vaadin-framework-8eafe7aee31b3e2f80c87b39c4e42e260a86a5eb.zip |
Do not create default instances while reading designs (#7749)
Change-Id: I26cb6d8d43200d10ebf8c0ac22c538b4272f5ecd
Diffstat (limited to 'server/src/com/vaadin/ui/declarative')
-rw-r--r-- | server/src/com/vaadin/ui/declarative/DesignAttributeHandler.java | 23 |
1 files changed, 8 insertions, 15 deletions
diff --git a/server/src/com/vaadin/ui/declarative/DesignAttributeHandler.java b/server/src/com/vaadin/ui/declarative/DesignAttributeHandler.java index b410fd0001..0a58fc549f 100644 --- a/server/src/com/vaadin/ui/declarative/DesignAttributeHandler.java +++ b/server/src/com/vaadin/ui/declarative/DesignAttributeHandler.java @@ -99,16 +99,12 @@ public class DesignAttributeHandler implements Serializable { * the attribute map. If the attributes does not contain the * requested attribute, the value is retrieved from the * <code> defaultInstance</code> - * @param defaultInstance - * the default instance of the class for fetching the default - * values * @return true on success */ public static boolean readAttribute(Component component, String attribute, - Attributes attributes, Component defaultInstance) { + Attributes attributes) { String value = null; - if (component == null || attribute == null || attributes == null - || defaultInstance == null) { + if (component == null || attribute == null || attributes == null) { throw new IllegalArgumentException( "Parameters with null value not allowed"); } @@ -129,13 +125,10 @@ public class DesignAttributeHandler implements Serializable { setter.invoke(component, param); success = true; } else { - // otherwise find the getter for the attribute - Method getter = findGetterForAttribute(component.getClass(), - attribute); - // read the default value from defaults - Object defaultValue = getter.invoke(defaultInstance); - setter.invoke(component, defaultValue); - success = true; + getLogger().log( + Level.WARNING, + "Attribute value for " + attribute + + " is null, this should not happen"); } } catch (Exception e) { getLogger().log(Level.WARNING, @@ -256,13 +249,13 @@ public class DesignAttributeHandler implements Serializable { */ @SuppressWarnings("unchecked") public static <T> T readAttribute(String attribute, Attributes attributes, - T defaultValue, Class<T> outputType) { + Class<T> outputType) { if (!isSupported(outputType)) { throw new IllegalArgumentException("output type: " + outputType.getName() + " not supported"); } if (!attributes.hasKey(attribute)) { - return defaultValue; + return null; } else { try { String value = attributes.get(attribute); |