Skip to content

Commit 09f3537

Browse files
author
Keaton Taylor
committed
Update clone() method so that default constructor does not need to be changed
1 parent 30f5b2d commit 09f3537

File tree

1 file changed

+5
-5
lines changed

1 file changed

+5
-5
lines changed

src/main/java/org/json/XMLParserConfiguration.java

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -156,14 +156,13 @@ public XMLParserConfiguration (final boolean keepStrings, final String cDataTagN
156156
*/
157157
private XMLParserConfiguration (final boolean keepStrings, final String cDataTagName,
158158
final boolean convertNilAttributeToNull, final Map<String, XMLXsiTypeConverter<?>> xsiTypeMap, final Set<String> forceList,
159-
final int maxNestingDepth, final boolean closeEmptyTag, final boolean shouldTrimWhiteSpace) {
159+
final int maxNestingDepth, final boolean closeEmptyTag) {
160160
super(keepStrings, maxNestingDepth);
161161
this.cDataTagName = cDataTagName;
162162
this.convertNilAttributeToNull = convertNilAttributeToNull;
163163
this.xsiTypeMap = Collections.unmodifiableMap(xsiTypeMap);
164164
this.forceList = Collections.unmodifiableSet(forceList);
165165
this.closeEmptyTag = closeEmptyTag;
166-
this.shouldTrimWhiteSpace = shouldTrimWhiteSpace;
167166
}
168167

169168
/**
@@ -176,16 +175,17 @@ protected XMLParserConfiguration clone() {
176175
// item, a new map instance should be created and if possible each value in the
177176
// map should be cloned as well. If the values of the map are known to also
178177
// be immutable, then a shallow clone of the map is acceptable.
179-
return new XMLParserConfiguration(
178+
final XMLParserConfiguration config = new XMLParserConfiguration(
180179
this.keepStrings,
181180
this.cDataTagName,
182181
this.convertNilAttributeToNull,
183182
this.xsiTypeMap,
184183
this.forceList,
185184
this.maxNestingDepth,
186-
this.closeEmptyTag,
187-
this.shouldTrimWhiteSpace
185+
this.closeEmptyTag
188186
);
187+
config.shouldTrimWhiteSpace = this.shouldTrimWhiteSpace;
188+
return config;
189189
}
190190

191191
/**

0 commit comments

Comments
 (0)