Reduce dependency on commons-io and commons-codec (#10614)

Signed-off-by: Wouter Born <github@maindrain.net>
This commit is contained in:
Wouter Born
2021-04-30 16:53:44 +02:00
committed by GitHub
parent 02b4943a11
commit e6d8dfb7e1
20 changed files with 175 additions and 124 deletions

View File

@@ -33,7 +33,6 @@ import javax.xml.stream.XMLStreamException;
import javax.xml.stream.XMLStreamReader;
import javax.xml.stream.util.StreamReaderDelegate;
import org.apache.commons.io.IOUtils;
import org.eclipse.jdt.annotation.Nullable;
import org.eclipse.jetty.client.HttpClient;
import org.eclipse.jetty.client.api.Response;
@@ -310,7 +309,8 @@ public class DenonMarantzHttpConnector extends DenonMarantzConnector {
XMLInputFactory xif = XMLInputFactory.newInstance();
xif.setProperty(XMLInputFactory.IS_SUPPORTING_EXTERNAL_ENTITIES, false);
xif.setProperty(XMLInputFactory.SUPPORT_DTD, false);
XMLStreamReader xsr = xif.createXMLStreamReader(IOUtils.toInputStream(result));
XMLStreamReader xsr = xif
.createXMLStreamReader(new ByteArrayInputStream(result.getBytes(StandardCharsets.UTF_8)));
xsr = new PropertyRenamerDelegate(xsr);
@SuppressWarnings("unchecked")
@@ -344,7 +344,8 @@ public class DenonMarantzHttpConnector extends DenonMarantzConnector {
JAXBContext jcResponse = JAXBContext.newInstance(response);
@SuppressWarnings("unchecked")
T obj = (T) jcResponse.createUnmarshaller().unmarshal(IOUtils.toInputStream(result));
T obj = (T) jcResponse.createUnmarshaller()
.unmarshal(new ByteArrayInputStream(result.getBytes(StandardCharsets.UTF_8)));
return obj;
}