提交 ad2d5952 编写于 作者: J Juergen Hoeller

XmlOptionsFactoryBean initializes empty XmlOptions by default and uses efficient entrySet iteration

Issue: SPR-12383
上级 cb095132
/*
* Copyright 2002-2012 the original author or authors.
* Copyright 2002-2014 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
......@@ -30,6 +30,7 @@ import org.springframework.beans.factory.FactoryBean;
* in the {@link XmlBeansMarshaller}.
*
* @author Arjen Poutsma
* @author Juergen Hoeller
* @since 3.0
* @see XmlOptions
* @see #setOptions(java.util.Map)
......@@ -37,7 +38,7 @@ import org.springframework.beans.factory.FactoryBean;
*/
public class XmlOptionsFactoryBean implements FactoryBean<XmlOptions> {
private XmlOptions xmlOptions;
private XmlOptions xmlOptions = new XmlOptions();
/**
......@@ -51,8 +52,8 @@ public class XmlOptionsFactoryBean implements FactoryBean<XmlOptions> {
public void setOptions(Map<String, ?> optionsMap) {
this.xmlOptions = new XmlOptions();
if (optionsMap != null) {
for (String option : optionsMap.keySet()) {
this.xmlOptions.put(option, optionsMap.get(option));
for (Map.Entry<String, ?> option : optionsMap.entrySet()) {
this.xmlOptions.put(option.getKey(), option.getValue());
}
}
}
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册