You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@cxf.apache.org by co...@apache.org on 2019/05/10 16:03:04 UTC
[cxf] branch master updated: Some minor code consolidation
This is an automated email from the ASF dual-hosted git repository.
coheigea pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/cxf.git
The following commit(s) were added to refs/heads/master by this push:
new 2be435c Some minor code consolidation
2be435c is described below
commit 2be435cd07059986f20430fd37790f411b8b3a5e
Author: Colm O hEigeartaigh <co...@apache.org>
AuthorDate: Fri May 10 17:02:48 2019 +0100
Some minor code consolidation
---
.../main/java/org/apache/cxf/helpers/DOMUtils.java | 26 +++++++++++-----------
.../java/org/apache/cxf/staxutils/StaxUtils.java | 8 +++----
2 files changed, 17 insertions(+), 17 deletions(-)
diff --git a/core/src/main/java/org/apache/cxf/helpers/DOMUtils.java b/core/src/main/java/org/apache/cxf/helpers/DOMUtils.java
index 303ed17..c1a6dbd 100644
--- a/core/src/main/java/org/apache/cxf/helpers/DOMUtils.java
+++ b/core/src/main/java/org/apache/cxf/helpers/DOMUtils.java
@@ -84,9 +84,9 @@ public final class DOMUtils {
protected Field computeValue(Class<?> type) {
return ReflectionUtil.getDeclaredField(type, "documentFragment");
}
-
+
};
-
+
static {
try {
Method[] methods = DOMUtils.class.getClassLoader().
@@ -131,24 +131,24 @@ public final class DOMUtils {
loader = getClassLoader(DOMUtils.class);
}
if (loader == null) {
- DocumentBuilderFactory f = DocumentBuilderFactory.newInstance();
- f.setNamespaceAware(true);
- f.setFeature(javax.xml.XMLConstants.FEATURE_SECURE_PROCESSING, true);
- f.setFeature("http://apache.org/xml/features/disallow-doctype-decl", true);
- return f.newDocumentBuilder();
+ return createDocumentBuilder();
}
DocumentBuilder factory = DOCUMENT_BUILDERS.get(loader);
if (factory == null) {
- DocumentBuilderFactory f2 = DocumentBuilderFactory.newInstance();
- f2.setNamespaceAware(true);
- f2.setFeature(javax.xml.XMLConstants.FEATURE_SECURE_PROCESSING, true);
- f2.setFeature("http://apache.org/xml/features/disallow-doctype-decl", true);
- factory = f2.newDocumentBuilder();
+ factory = createDocumentBuilder();
DOCUMENT_BUILDERS.put(loader, factory);
}
return factory;
}
+ private static DocumentBuilder createDocumentBuilder() throws ParserConfigurationException {
+ DocumentBuilderFactory f = DocumentBuilderFactory.newInstance();
+ f.setNamespaceAware(true);
+ f.setFeature(javax.xml.XMLConstants.FEATURE_SECURE_PROCESSING, true);
+ f.setFeature("http://apache.org/xml/features/disallow-doctype-decl", true);
+ return f.newDocumentBuilder();
+ }
+
private static ClassLoader getContextClassLoader() {
final SecurityManager sm = System.getSecurityManager();
if (sm != null) {
@@ -781,7 +781,7 @@ public final class DOMUtils {
}
return node;
}
-
+
/**
* Try to get the DOM DocumentFragment from the SAAJ DocumentFragment with JAVA9 afterwards
* @param DocumentFragment The original documentFragment we need check
diff --git a/core/src/main/java/org/apache/cxf/staxutils/StaxUtils.java b/core/src/main/java/org/apache/cxf/staxutils/StaxUtils.java
index 390fe56..bdb2da4 100644
--- a/core/src/main/java/org/apache/cxf/staxutils/StaxUtils.java
+++ b/core/src/main/java/org/apache/cxf/staxutils/StaxUtils.java
@@ -35,8 +35,8 @@ import java.util.Collections;
import java.util.Deque;
import java.util.Iterator;
import java.util.List;
+import java.util.Queue;
import java.util.concurrent.ArrayBlockingQueue;
-import java.util.concurrent.BlockingQueue;
import java.util.logging.Level;
import java.util.logging.Logger;
@@ -125,9 +125,9 @@ public final class StaxUtils {
private static final Logger LOG = LogUtils.getL7dLogger(StaxUtils.class);
- private static final BlockingQueue<XMLInputFactory> NS_AWARE_INPUT_FACTORY_POOL;
+ private static final Queue<XMLInputFactory> NS_AWARE_INPUT_FACTORY_POOL;
private static final XMLInputFactory SAFE_INPUT_FACTORY;
- private static final BlockingQueue<XMLOutputFactory> OUTPUT_FACTORY_POOL;
+ private static final Queue<XMLOutputFactory> OUTPUT_FACTORY_POOL;
private static final XMLOutputFactory SAFE_OUTPUT_FACTORY;
private static final String XML_NS = "http://www.w3.org/2000/xmlns/";
@@ -706,7 +706,7 @@ public final class StaxUtils {
/**
* Copies the reader to the writer. The start and end document methods must
- * be handled on the writer manually.
+ * be handled on the writer manually.
*
* @param reader
* @param writer