Deprecate org.springframework.batch.item.xml.StaxUtils
This commit deprecates org.springframework.batch.item.xml.StaxUtils in favor of org.springframework.util.xml.StaxUtils. Resolves #3779
This commit is contained in:
@@ -45,6 +45,7 @@ import org.springframework.oxm.Unmarshaller;
|
||||
import org.springframework.util.Assert;
|
||||
import org.springframework.util.ClassUtils;
|
||||
import org.springframework.util.StringUtils;
|
||||
import org.springframework.util.xml.StaxUtils;
|
||||
|
||||
/**
|
||||
* Item reader for reading XML input based on StAX.
|
||||
@@ -81,7 +82,7 @@ ResourceAwareItemReaderItemStream<T>, InitializingBean {
|
||||
|
||||
private boolean strict = true;
|
||||
|
||||
private XMLInputFactory xmlInputFactory = StaxUtils.createXmlInputFactory();
|
||||
private XMLInputFactory xmlInputFactory = StaxUtils.createDefensiveInputFactory();
|
||||
|
||||
private String encoding = DEFAULT_ENCODING;
|
||||
|
||||
@@ -269,7 +270,7 @@ ResourceAwareItemReaderItemStream<T>, InitializingBean {
|
||||
|
||||
try {
|
||||
@SuppressWarnings("unchecked")
|
||||
T mappedFragment = (T) unmarshaller.unmarshal(StaxUtils.getSource(fragmentReader));
|
||||
T mappedFragment = (T) unmarshaller.unmarshal(StaxUtils.createStaxSource(fragmentReader));
|
||||
item = mappedFragment;
|
||||
}
|
||||
finally {
|
||||
|
||||
@@ -59,6 +59,7 @@ import org.springframework.util.Assert;
|
||||
import org.springframework.util.ClassUtils;
|
||||
import org.springframework.util.CollectionUtils;
|
||||
import org.springframework.util.StringUtils;
|
||||
import org.springframework.util.xml.StaxUtils;
|
||||
|
||||
/**
|
||||
* An implementation of {@link ItemWriter} which uses StAX and
|
||||
@@ -578,7 +579,7 @@ ResourceAwareItemWriterItemStream<T>, InitializingBean {
|
||||
* @return a result for writing to
|
||||
*/
|
||||
protected Result createStaxResult() {
|
||||
return StaxUtils.getResult(eventWriter);
|
||||
return StaxUtils.createStaxResult(eventWriter);
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2006-2019 the original author or authors.
|
||||
* Copyright 2006-2020 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.
|
||||
@@ -33,8 +33,11 @@ import javax.xml.transform.stax.StAXSource;
|
||||
*
|
||||
* @author Josh Long
|
||||
* @author Mahmoud Ben Hassine
|
||||
*
|
||||
* @deprecated in favor of {@link org.springframework.util.xml.StaxUtils}
|
||||
*
|
||||
*/
|
||||
@Deprecated
|
||||
public abstract class StaxUtils {
|
||||
|
||||
public static Source getSource(XMLEventReader r) throws XMLStreamException {
|
||||
|
||||
@@ -22,11 +22,11 @@ import java.util.List;
|
||||
import javax.xml.stream.XMLInputFactory;
|
||||
|
||||
import org.springframework.batch.item.xml.StaxEventItemReader;
|
||||
import org.springframework.batch.item.xml.StaxUtils;
|
||||
import org.springframework.core.io.Resource;
|
||||
import org.springframework.oxm.Unmarshaller;
|
||||
import org.springframework.util.Assert;
|
||||
import org.springframework.util.StringUtils;
|
||||
import org.springframework.util.xml.StaxUtils;
|
||||
|
||||
/**
|
||||
* A fluent builder for the {@link StaxEventItemReader}
|
||||
@@ -54,7 +54,7 @@ public class StaxEventItemReaderBuilder<T> {
|
||||
|
||||
private int currentItemCount;
|
||||
|
||||
private XMLInputFactory xmlInputFactory = StaxUtils.createXmlInputFactory();
|
||||
private XMLInputFactory xmlInputFactory = StaxUtils.createDefensiveInputFactory();
|
||||
|
||||
private String encoding = StaxEventItemReader.DEFAULT_ENCODING;
|
||||
|
||||
|
||||
Reference in New Issue
Block a user