mirror of
https://github.com/bancika/diy-layout-creator
synced 2026-11-11 01:32:08 +10:00
protect PropertyWrapper writeTo call
This commit is contained in:
@@ -236,7 +236,7 @@ public class InstantiationManager {
|
||||
|
||||
@SuppressWarnings("unchecked")
|
||||
public List<IDIYComponent<?>> instantiateComponent(ComponentType componentType, Template template, Point point,
|
||||
Project currentProject) throws Exception {
|
||||
Project currentProject) throws InstantiationException, IllegalAccessException {
|
||||
LOG.info("Instatiating component of type: " + componentType.getInstanceClass().getName());
|
||||
|
||||
// Instantiate the component.
|
||||
@@ -321,8 +321,7 @@ public class InstantiationManager {
|
||||
* @throws NoSuchMethodException
|
||||
* @throws SecurityException
|
||||
*/
|
||||
public void fillWithDefaultProperties(Object object, Template template) throws IllegalArgumentException,
|
||||
IllegalAccessException, InvocationTargetException, SecurityException, NoSuchMethodException {
|
||||
public void fillWithDefaultProperties(Object object, Template template) {
|
||||
// Extract properties.
|
||||
List<PropertyWrapper> properties = ComponentProcessor.getInstance().extractProperties(object.getClass());
|
||||
Map<String, PropertyWrapper> propertyCache = new HashMap<String, PropertyWrapper>();
|
||||
@@ -333,8 +332,12 @@ public class InstantiationManager {
|
||||
ConfigurationManager.getInstance().readObject(
|
||||
Presenter.DEFAULTS_KEY_PREFIX + object.getClass().getName() + ":" + property.getName(), null);
|
||||
if (defaultValue != null) {
|
||||
property.setValue(defaultValue);
|
||||
property.writeTo(object);
|
||||
property.setValue(defaultValue);
|
||||
try {
|
||||
property.writeTo(object);
|
||||
} catch (Exception e) {
|
||||
LOG.error("Could not write property " + property.getName(), e);
|
||||
}
|
||||
}
|
||||
}
|
||||
if (template != null) {
|
||||
@@ -344,8 +347,12 @@ public class InstantiationManager {
|
||||
LOG.warn("Cannot find property " + pair.getKey());
|
||||
} else {
|
||||
LOG.debug("Filling value from template for " + pair.getKey());
|
||||
property.setValue(pair.getValue());
|
||||
property.writeTo(object);
|
||||
property.setValue(pair.getValue());
|
||||
try {
|
||||
property.writeTo(object);
|
||||
} catch (Exception e) {
|
||||
LOG.error("Could not write property " + property.getName(), e);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user