@@ -107,7 +107,7 @@ public class JibxMarshaller extends AbstractMarshaller implements InitializingBe
107
107
108
108
private IBindingFactory bindingFactory ;
109
109
110
- private TransformerFactory transformerFactory = TransformerFactory .newInstance ();
110
+ private final TransformerFactory transformerFactory = TransformerFactory .newInstance ();
111
111
112
112
113
113
/**
@@ -127,6 +127,7 @@ public void setTargetClass(Class<?> targetClass) {
127
127
public void setTargetPackage (String targetPackage ) {
128
128
this .targetPackage = targetPackage ;
129
129
}
130
+
130
131
/**
131
132
* Set the optional binding name for this instance.
132
133
*/
@@ -167,7 +168,7 @@ public void setDocTypeRootElementName(String docTypeRootElementName) {
167
168
}
168
169
169
170
/**
170
- * Set the system Id for the DTD declaration written when marshalling.
171
+ * Set the system id for the DTD declaration written when marshalling.
171
172
* By default, this is {@code null}. Only used when the root element also has been set.
172
173
* <p>Set either this property or {@code docTypePublicId}, not both.
173
174
* @see #setDocTypeRootElementName(String)
@@ -177,7 +178,7 @@ public void setDocTypeSystemId(String docTypeSystemId) {
177
178
}
178
179
179
180
/**
180
- * Set the public Id for the DTD declaration written when marshalling.
181
+ * Set the public id for the DTD declaration written when marshalling.
181
182
* By default, this is {@code null}. Only used when the root element also has been set.
182
183
* <p>Set either this property or {@code docTypeSystemId}, not both.
183
184
* @see #setDocTypeRootElementName(String)
@@ -217,12 +218,12 @@ else if (this.targetPackage != null) {
217
218
bindingName = DEFAULT_BINDING_NAME ;
218
219
}
219
220
if (logger .isInfoEnabled ()) {
220
- logger .info ("Configured for target package [" + targetPackage + "] using binding [" + bindingName + "]" );
221
+ logger .info ("Configured for target package [" + this . targetPackage + "] using binding [" + this . bindingName + "]" );
221
222
}
222
- this .bindingFactory = BindingDirectory .getFactory (bindingName , targetPackage );
223
+ this .bindingFactory = BindingDirectory .getFactory (this . bindingName , this . targetPackage );
223
224
}
224
225
else {
225
- throw new IllegalArgumentException ("either 'targetClass' or 'targetPackage' is required" );
226
+ throw new IllegalArgumentException ("Either 'targetClass' or 'targetPackage' is required" );
226
227
}
227
228
}
228
229
@@ -407,12 +408,13 @@ protected Object unmarshalDomNode(Node node) throws XmlMappingException {
407
408
@ Override
408
409
protected Object unmarshalSaxReader (XMLReader xmlReader , InputSource inputSource )
409
410
throws XmlMappingException , IOException {
411
+
410
412
return transformAndUnmarshal (new SAXSource (xmlReader , inputSource ));
411
413
}
412
414
413
415
private Object transformAndUnmarshal (Source source ) throws IOException {
414
416
try {
415
- Transformer transformer = transformerFactory .newTransformer ();
417
+ Transformer transformer = this . transformerFactory .newTransformer ();
416
418
ByteArrayOutputStream os = new ByteArrayOutputStream ();
417
419
transformer .transform (source , new StreamResult (os ));
418
420
ByteArrayInputStream is = new ByteArrayInputStream (os .toByteArray ());
0 commit comments