Skip to content

Commit ad2d595

Browse files
committed
XmlOptionsFactoryBean initializes empty XmlOptions by default and uses efficient entrySet iteration
Issue: SPR-12383
1 parent cb09513 commit ad2d595

File tree

1 file changed

+5
-4
lines changed

1 file changed

+5
-4
lines changed

spring-oxm/src/main/java/org/springframework/oxm/xmlbeans/XmlOptionsFactoryBean.java

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* Copyright 2002-2012 the original author or authors.
2+
* Copyright 2002-2014 the original author or authors.
33
*
44
* Licensed under the Apache License, Version 2.0 (the "License");
55
* you may not use this file except in compliance with the License.
@@ -30,14 +30,15 @@
3030
* in the {@link XmlBeansMarshaller}.
3131
*
3232
* @author Arjen Poutsma
33+
* @author Juergen Hoeller
3334
* @since 3.0
3435
* @see XmlOptions
3536
* @see #setOptions(java.util.Map)
3637
* @see XmlBeansMarshaller#setXmlOptions(XmlOptions)
3738
*/
3839
public class XmlOptionsFactoryBean implements FactoryBean<XmlOptions> {
3940

40-
private XmlOptions xmlOptions;
41+
private XmlOptions xmlOptions = new XmlOptions();
4142

4243

4344
/**
@@ -51,8 +52,8 @@ public class XmlOptionsFactoryBean implements FactoryBean<XmlOptions> {
5152
public void setOptions(Map<String, ?> optionsMap) {
5253
this.xmlOptions = new XmlOptions();
5354
if (optionsMap != null) {
54-
for (String option : optionsMap.keySet()) {
55-
this.xmlOptions.put(option, optionsMap.get(option));
55+
for (Map.Entry<String, ?> option : optionsMap.entrySet()) {
56+
this.xmlOptions.put(option.getKey(), option.getValue());
5657
}
5758
}
5859
}

0 commit comments

Comments
 (0)