From: PJ Fanning Date: Sat, 6 Oct 2018 09:38:58 +0000 (+0000) Subject: add stax entries to forbidden apis due to android issues X-Git-Tag: REL_4_0_1~61 X-Git-Url: https://source.dussan.org/?a=commitdiff_plain;h=ecc4485e27661b20eb29f36768b51f6511dad9d0;p=poi.git add stax entries to forbidden apis due to android issues git-svn-id: https://svn.apache.org/repos/asf/poi/trunk@1843009 13f79535-47bb-0310-9956-ffa450edef68 --- diff --git a/build.xml b/build.xml index abe465528d..c55aff3047 100644 --- a/build.xml +++ b/build.xml @@ -244,8 +244,8 @@ under the License. - - + + @@ -652,6 +652,7 @@ under the License. + diff --git a/src/java/org/apache/poi/util/StaxHelper.java b/src/java/org/apache/poi/util/StaxHelper.java index 58a4959699..31530c2e7b 100644 --- a/src/java/org/apache/poi/util/StaxHelper.java +++ b/src/java/org/apache/poi/util/StaxHelper.java @@ -34,7 +34,7 @@ public final class StaxHelper { * Creates a new StAX XMLInputFactory, with sensible defaults */ public static XMLInputFactory newXMLInputFactory() { - XMLInputFactory factory = XMLInputFactory.newFactory(); + XMLInputFactory factory = XMLInputFactory.newInstance(); trySetProperty(factory, XMLInputFactory.IS_NAMESPACE_AWARE, true); trySetProperty(factory, XMLInputFactory.IS_VALIDATING, false); trySetProperty(factory, XMLInputFactory.SUPPORT_DTD, false); @@ -46,7 +46,7 @@ public final class StaxHelper { * Creates a new StAX XMLOutputFactory, with sensible defaults */ public static XMLOutputFactory newXMLOutputFactory() { - XMLOutputFactory factory = XMLOutputFactory.newFactory(); + XMLOutputFactory factory = XMLOutputFactory.newInstance(); trySetProperty(factory, XMLOutputFactory.IS_REPAIRING_NAMESPACES, true); return factory; } diff --git a/src/resources/devtools/forbidden-signatures.txt b/src/resources/devtools/forbidden-signatures.txt index e64d7e02cf..9fda92e1b6 100644 --- a/src/resources/devtools/forbidden-signatures.txt +++ b/src/resources/devtools/forbidden-signatures.txt @@ -123,6 +123,11 @@ java.util.concurrent.Future#cancel(boolean) @defaultMessage Don't use ...InputStream.available() as it gives wrong result for certain streams - use IOUtils.toByteArray to read the stream fully and then count the available bytes java.io.InputStream#available() +@defaultMessage Use newInstance, as newFactory does not seem to work on Android - https://github.com/centic9/poi-on-android/issues/44#issuecomment-426517981 +javax.xml.stream.XMLEventFactory#newFactory() +javax.xml.stream.XMLInputFactory#newFactory() +javax.xml.stream.XMLOutputFactory#newFactory() + @defaultMessage Unnecessary, inefficient, and confusing conversion of String.toString java.lang.String#toString()