cxf-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From dk...@apache.org
Subject [03/12] cxf git commit: Fix static references in core and "unnecessarily nested within else" warnings
Date Fri, 04 Aug 2017 16:07:26 GMT
Fix static references in core and "unnecessarily nested within else" warnings


Project: http://git-wip-us.apache.org/repos/asf/cxf/repo
Commit: http://git-wip-us.apache.org/repos/asf/cxf/commit/6d35b60b
Tree: http://git-wip-us.apache.org/repos/asf/cxf/tree/6d35b60b
Diff: http://git-wip-us.apache.org/repos/asf/cxf/diff/6d35b60b

Branch: refs/heads/master
Commit: 6d35b60b0fa5466a36cd5d60f010d1adbb1f5b84
Parents: 7443f01
Author: Daniel Kulp <dkulp@apache.org>
Authored: Fri Aug 4 10:18:02 2017 -0400
Committer: Daniel Kulp <dkulp@apache.org>
Committed: Fri Aug 4 10:40:43 2017 -0400

----------------------------------------------------------------------
 .../cxf/bus/extension/ExtensionManagerBus.java  |  3 +-
 .../apache/cxf/common/logging/Log4jLogger.java  | 14 +++---
 .../org/apache/cxf/endpoint/ClientImpl.java     |  4 +-
 .../cxf/staxutils/DepthXMLStreamReader.java     |  2 +-
 .../cxf/staxutils/FragmentStreamReader.java     | 13 ++---
 .../org/apache/cxf/staxutils/StaxUtils.java     | 52 ++++++++++----------
 .../cxf/staxutils/DepthXMLStreamReaderTest.java |  3 +-
 .../cxf/staxutils/FragmentStreamReaderTest.java |  7 +--
 .../org/apache/cxf/staxutils/StaxUtilsTest.java |  9 ++--
 9 files changed, 55 insertions(+), 52 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/cxf/blob/6d35b60b/core/src/main/java/org/apache/cxf/bus/extension/ExtensionManagerBus.java
----------------------------------------------------------------------
diff --git a/core/src/main/java/org/apache/cxf/bus/extension/ExtensionManagerBus.java b/core/src/main/java/org/apache/cxf/bus/extension/ExtensionManagerBus.java
index e86867f..d274267 100644
--- a/core/src/main/java/org/apache/cxf/bus/extension/ExtensionManagerBus.java
+++ b/core/src/main/java/org/apache/cxf/bus/extension/ExtensionManagerBus.java
@@ -29,7 +29,6 @@ import java.util.concurrent.CopyOnWriteArraySet;
 import org.apache.cxf.Bus;
 import org.apache.cxf.BusFactory;
 import org.apache.cxf.binding.BindingFactoryManager;
-import org.apache.cxf.bus.CXFBusFactory;
 import org.apache.cxf.bus.managers.BindingFactoryManagerImpl;
 import org.apache.cxf.bus.managers.ConduitInitiatorManagerImpl;
 import org.apache.cxf.bus.managers.DestinationFactoryManagerImpl;
@@ -84,7 +83,7 @@ public class ExtensionManagerBus extends AbstractBasicInterceptorProvider
implem
 
         state = BusState.INITIAL;
 
-        CXFBusFactory.possiblySetDefaultBus(this);
+        BusFactory.possiblySetDefaultBus(this);
         if (null != props) {
             properties.putAll(props);
         }

http://git-wip-us.apache.org/repos/asf/cxf/blob/6d35b60b/core/src/main/java/org/apache/cxf/common/logging/Log4jLogger.java
----------------------------------------------------------------------
diff --git a/core/src/main/java/org/apache/cxf/common/logging/Log4jLogger.java b/core/src/main/java/org/apache/cxf/common/logging/Log4jLogger.java
index a727ae6..7f52fac 100644
--- a/core/src/main/java/org/apache/cxf/common/logging/Log4jLogger.java
+++ b/core/src/main/java/org/apache/cxf/common/logging/Log4jLogger.java
@@ -117,25 +117,25 @@ public class Log4jLogger extends AbstractDelegatingLogger {
     private Level fromL4J(org.apache.log4j.Level l) {
         Level l2 = null;
         switch (l.toInt()) {
-        case org.apache.log4j.Level.ALL_INT:
+        case org.apache.log4j.Priority.ALL_INT:
             l2 = Level.ALL;
             break;
-        case org.apache.log4j.Level.FATAL_INT:
+        case org.apache.log4j.Priority.FATAL_INT:
             l2 = Level.SEVERE;
             break;
-        case org.apache.log4j.Level.ERROR_INT:
+        case org.apache.log4j.Priority.ERROR_INT:
             l2 = Level.SEVERE;
             break;
-        case org.apache.log4j.Level.WARN_INT:
+        case org.apache.log4j.Priority.WARN_INT:
             l2 = Level.WARNING;
             break;
-        case org.apache.log4j.Level.INFO_INT:
+        case org.apache.log4j.Priority.INFO_INT:
             l2 = Level.INFO;
             break;
-        case org.apache.log4j.Level.DEBUG_INT:
+        case org.apache.log4j.Priority.DEBUG_INT:
             l2 = Level.FINE;
             break;
-        case org.apache.log4j.Level.OFF_INT:
+        case org.apache.log4j.Priority.OFF_INT:
             l2 = Level.OFF;
             break;
         default:

http://git-wip-us.apache.org/repos/asf/cxf/blob/6d35b60b/core/src/main/java/org/apache/cxf/endpoint/ClientImpl.java
----------------------------------------------------------------------
diff --git a/core/src/main/java/org/apache/cxf/endpoint/ClientImpl.java b/core/src/main/java/org/apache/cxf/endpoint/ClientImpl.java
index 8fc116f..b92e48b 100644
--- a/core/src/main/java/org/apache/cxf/endpoint/ClientImpl.java
+++ b/core/src/main/java/org/apache/cxf/endpoint/ClientImpl.java
@@ -764,9 +764,9 @@ public class ClientImpl
             }
 
             String startingAfterInterceptorID = (String) message.get(
-                PhaseInterceptorChain.STARTING_AFTER_INTERCEPTOR_ID);
+                InterceptorChain.STARTING_AFTER_INTERCEPTOR_ID);
             String startingInterceptorID = (String) message.get(
-                PhaseInterceptorChain.STARTING_AT_INTERCEPTOR_ID);
+                InterceptorChain.STARTING_AT_INTERCEPTOR_ID);
             if (startingAfterInterceptorID != null) {
                 chain.doInterceptStartingAfter(message, startingAfterInterceptorID);
             } else if (startingInterceptorID != null) {

http://git-wip-us.apache.org/repos/asf/cxf/blob/6d35b60b/core/src/main/java/org/apache/cxf/staxutils/DepthXMLStreamReader.java
----------------------------------------------------------------------
diff --git a/core/src/main/java/org/apache/cxf/staxutils/DepthXMLStreamReader.java b/core/src/main/java/org/apache/cxf/staxutils/DepthXMLStreamReader.java
index 21db10b..9469498 100644
--- a/core/src/main/java/org/apache/cxf/staxutils/DepthXMLStreamReader.java
+++ b/core/src/main/java/org/apache/cxf/staxutils/DepthXMLStreamReader.java
@@ -87,7 +87,7 @@ public class DepthXMLStreamReader implements XMLStreamReader {
         String ret = reader.getElementText();
         //workaround bugs in some readers that aren't properly advancing to
         //the END_ELEMENT (*cough*jettison*cough*)
-        while (reader.getEventType() != XMLStreamReader.END_ELEMENT) {
+        while (reader.getEventType() != XMLStreamConstants.END_ELEMENT) {
             reader.next();
         }
         depth--;

http://git-wip-us.apache.org/repos/asf/cxf/blob/6d35b60b/core/src/main/java/org/apache/cxf/staxutils/FragmentStreamReader.java
----------------------------------------------------------------------
diff --git a/core/src/main/java/org/apache/cxf/staxutils/FragmentStreamReader.java b/core/src/main/java/org/apache/cxf/staxutils/FragmentStreamReader.java
index b309a3f..2c6c9c2 100644
--- a/core/src/main/java/org/apache/cxf/staxutils/FragmentStreamReader.java
+++ b/core/src/main/java/org/apache/cxf/staxutils/FragmentStreamReader.java
@@ -19,6 +19,7 @@
 
 package org.apache.cxf.staxutils;
 
+import javax.xml.stream.XMLStreamConstants;
 import javax.xml.stream.XMLStreamException;
 import javax.xml.stream.XMLStreamReader;
 
@@ -32,7 +33,7 @@ public class FragmentStreamReader extends DepthXMLStreamReader {
     private boolean doDocEvents = true;
 
     private int depth;
-    private int current = XMLStreamReader.START_DOCUMENT;
+    private int current = XMLStreamConstants.START_DOCUMENT;
     private boolean filter = true;
     private boolean advanceAtEnd = true;
 
@@ -45,7 +46,7 @@ public class FragmentStreamReader extends DepthXMLStreamReader {
         if (!doDocEvents) {
             depth = getDepth();
             current = reader.getEventType();
-            if (current != XMLStreamReader.START_DOCUMENT) {
+            if (current != XMLStreamConstants.START_DOCUMENT) {
                 startElement = true;
             }
         }
@@ -56,19 +57,19 @@ public class FragmentStreamReader extends DepthXMLStreamReader {
     }
 
     public boolean isCharacters() {
-        return current == XMLStreamReader.CHARACTERS;
+        return current == XMLStreamConstants.CHARACTERS;
     }
 
     public boolean isEndElement() {
-        return current == XMLStreamReader.END_ELEMENT;
+        return current == XMLStreamConstants.END_ELEMENT;
     }
 
     public boolean isStartElement() {
-        return current == XMLStreamReader.START_ELEMENT;
+        return current == XMLStreamConstants.START_ELEMENT;
     }
 
     public boolean isWhiteSpace() {
-        return current == XMLStreamReader.CHARACTERS && reader.isWhiteSpace();
+        return current == XMLStreamConstants.CHARACTERS && reader.isWhiteSpace();
     }
 
     public boolean hasNext() throws XMLStreamException {

http://git-wip-us.apache.org/repos/asf/cxf/blob/6d35b60b/core/src/main/java/org/apache/cxf/staxutils/StaxUtils.java
----------------------------------------------------------------------
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 ff9d284..fab8f31 100644
--- a/core/src/main/java/org/apache/cxf/staxutils/StaxUtils.java
+++ b/core/src/main/java/org/apache/cxf/staxutils/StaxUtils.java
@@ -462,7 +462,7 @@ public final class StaxUtils {
     }
 
     public static boolean toNextText(DepthXMLStreamReader reader) {
-        if (reader.getEventType() == XMLStreamReader.CHARACTERS) {
+        if (reader.getEventType() == XMLStreamConstants.CHARACTERS) {
             return true;
         }
 
@@ -470,7 +470,7 @@ public final class StaxUtils {
             int depth = reader.getDepth();
             int event = reader.getEventType();
             while (reader.getDepth() >= depth && reader.hasNext()) {
-                if (event == XMLStreamReader.CHARACTERS && reader.getDepth() == depth
+ 1) {
+                if (event == XMLStreamConstants.CHARACTERS && reader.getDepth() ==
depth + 1) {
                     return true;
                 }
                 event = reader.next();
@@ -484,8 +484,8 @@ public final class StaxUtils {
         try {
             // advance to first tag.
             int x = reader.getEventType();
-            while (x != XMLStreamReader.START_ELEMENT
-                && x != XMLStreamReader.END_ELEMENT
+            while (x != XMLStreamConstants.START_ELEMENT
+                && x != XMLStreamConstants.END_ELEMENT
                 && reader.hasNext()) {
                 x = reader.next();
             }
@@ -500,7 +500,7 @@ public final class StaxUtils {
             int depth = reader.getDepth();
             int event = reader.getEventType();
             while (reader.getDepth() >= depth && reader.hasNext()) {
-                if (event == XMLStreamReader.START_ELEMENT && reader.getName().equals(endTag)
+                if (event == XMLStreamConstants.START_ELEMENT && reader.getName().equals(endTag)
                     && reader.getDepth() == depth + 1) {
                     return true;
                 }
@@ -540,8 +540,8 @@ public final class StaxUtils {
      * returned if the end of the stream is reached.
      */
     public static boolean skipToStartOfElement(XMLStreamReader in) throws XMLStreamException
{
-        for (int code = in.getEventType(); code != XMLStreamReader.END_DOCUMENT; code = in.next())
{
-            if (code == XMLStreamReader.START_ELEMENT) {
+        for (int code = in.getEventType(); code != XMLStreamConstants.END_DOCUMENT; code
= in.next()) {
+            if (code == XMLStreamConstants.START_ELEMENT) {
                 return true;
             }
         }
@@ -549,19 +549,19 @@ public final class StaxUtils {
     }
 
     public static boolean toNextElement(DepthXMLStreamReader dr) {
-        if (dr.getEventType() == XMLStreamReader.START_ELEMENT) {
+        if (dr.getEventType() == XMLStreamConstants.START_ELEMENT) {
             return true;
         }
-        if (dr.getEventType() == XMLStreamReader.END_ELEMENT) {
+        if (dr.getEventType() == XMLStreamConstants.END_ELEMENT) {
             return false;
         }
         try {
             int depth = dr.getDepth();
 
             for (int event = dr.getEventType(); dr.getDepth() >= depth && dr.hasNext();
event = dr.next()) {
-                if (event == XMLStreamReader.START_ELEMENT && dr.getDepth() == depth
+ 1) {
+                if (event == XMLStreamConstants.START_ELEMENT && dr.getDepth() ==
depth + 1) {
                     return true;
-                } else if (event == XMLStreamReader.END_ELEMENT) {
+                } else if (event == XMLStreamConstants.END_ELEMENT) {
                     depth--;
                 }
             }
@@ -573,8 +573,8 @@ public final class StaxUtils {
     }
 
     public static boolean skipToStartOfElement(DepthXMLStreamReader in) throws XMLStreamException
{
-        for (int code = in.getEventType(); code != XMLStreamReader.END_DOCUMENT; code = in.next())
{
-            if (code == XMLStreamReader.START_ELEMENT) {
+        for (int code = in.getEventType(); code != XMLStreamConstants.END_DOCUMENT; code
= in.next()) {
+            if (code == XMLStreamConstants.START_ELEMENT) {
                 return true;
             }
         }
@@ -1984,22 +1984,22 @@ public final class StaxUtils {
         throws XMLStreamException {
 
         switch (event.getEventType()) {
-        case XMLEvent.START_ELEMENT:
+        case XMLStreamConstants.START_ELEMENT:
             writeStartElementEvent(event, writer);
             break;
-        case XMLEvent.END_ELEMENT:
+        case XMLStreamConstants.END_ELEMENT:
             writer.writeEndElement();
             break;
-        case XMLEvent.ATTRIBUTE:
+        case XMLStreamConstants.ATTRIBUTE:
             writeAttributeEvent(event, writer);
             break;
-        case XMLEvent.ENTITY_REFERENCE:
+        case XMLStreamConstants.ENTITY_REFERENCE:
             writer.writeEntityRef(((javax.xml.stream.events.EntityReference)event).getName());
             break;
-        case XMLEvent.DTD:
+        case XMLStreamConstants.DTD:
             writer.writeDTD(((DTD)event).getDocumentTypeDeclaration());
             break;
-        case XMLEvent.PROCESSING_INSTRUCTION:
+        case XMLStreamConstants.PROCESSING_INSTRUCTION:
             if (((javax.xml.stream.events.ProcessingInstruction)event).getData() != null)
{
                 writer.writeProcessingInstruction(
                     ((javax.xml.stream.events.ProcessingInstruction)event).getTarget(),
@@ -2009,7 +2009,7 @@ public final class StaxUtils {
                     ((javax.xml.stream.events.ProcessingInstruction)event).getTarget());
             }
             break;
-        case XMLEvent.NAMESPACE:
+        case XMLStreamConstants.NAMESPACE:
             if (((Namespace)event).isDefaultNamespaceDeclaration()) {
                 writer.writeDefaultNamespace(((Namespace)event).getNamespaceURI());
                 writer.setDefaultNamespace(((Namespace)event).getNamespaceURI());
@@ -2020,17 +2020,17 @@ public final class StaxUtils {
                                  ((Namespace)event).getNamespaceURI());
             }
             break;
-        case XMLEvent.COMMENT:
+        case XMLStreamConstants.COMMENT:
             writer.writeComment(((javax.xml.stream.events.Comment)event).getText());
             break;
-        case XMLEvent.CHARACTERS:
-        case XMLEvent.SPACE:
+        case XMLStreamConstants.CHARACTERS:
+        case XMLStreamConstants.SPACE:
             writer.writeCharacters(event.asCharacters().getData());
             break;
-        case XMLEvent.CDATA:
+        case XMLStreamConstants.CDATA:
             writer.writeCData(event.asCharacters().getData());
             break;
-        case XMLEvent.START_DOCUMENT:
+        case XMLStreamConstants.START_DOCUMENT:
             if (((StartDocument)event).encodingSet()) {
                 writer.writeStartDocument(((StartDocument)event).getCharacterEncodingScheme(),
                                           ((StartDocument)event).getVersion());
@@ -2039,7 +2039,7 @@ public final class StaxUtils {
                 writer.writeStartDocument(((StartDocument)event).getVersion());
             }
             break;
-        case XMLEvent.END_DOCUMENT:
+        case XMLStreamConstants.END_DOCUMENT:
             writer.writeEndDocument();
             break;
         default:

http://git-wip-us.apache.org/repos/asf/cxf/blob/6d35b60b/core/src/test/java/org/apache/cxf/staxutils/DepthXMLStreamReaderTest.java
----------------------------------------------------------------------
diff --git a/core/src/test/java/org/apache/cxf/staxutils/DepthXMLStreamReaderTest.java b/core/src/test/java/org/apache/cxf/staxutils/DepthXMLStreamReaderTest.java
index 502b845..9300ea2 100644
--- a/core/src/test/java/org/apache/cxf/staxutils/DepthXMLStreamReaderTest.java
+++ b/core/src/test/java/org/apache/cxf/staxutils/DepthXMLStreamReaderTest.java
@@ -19,6 +19,7 @@
 
 package org.apache.cxf.staxutils;
 
+import javax.xml.stream.XMLStreamConstants;
 import javax.xml.stream.XMLStreamReader;
 
 import org.junit.Assert;
@@ -35,7 +36,7 @@ public class DepthXMLStreamReaderTest extends Assert {
 
         StaxUtils.toNextElement(dr);
         assertEquals("ItemLookup", dr.getLocalName());
-        assertEquals(XMLStreamReader.START_ELEMENT, reader.getEventType());
+        assertEquals(XMLStreamConstants.START_ELEMENT, reader.getEventType());
 
         assertEquals(1, dr.getDepth());
 

http://git-wip-us.apache.org/repos/asf/cxf/blob/6d35b60b/core/src/test/java/org/apache/cxf/staxutils/FragmentStreamReaderTest.java
----------------------------------------------------------------------
diff --git a/core/src/test/java/org/apache/cxf/staxutils/FragmentStreamReaderTest.java b/core/src/test/java/org/apache/cxf/staxutils/FragmentStreamReaderTest.java
index cb0981f..f1de75e 100644
--- a/core/src/test/java/org/apache/cxf/staxutils/FragmentStreamReaderTest.java
+++ b/core/src/test/java/org/apache/cxf/staxutils/FragmentStreamReaderTest.java
@@ -21,6 +21,7 @@ package org.apache.cxf.staxutils;
 
 import java.io.StringReader;
 
+import javax.xml.stream.XMLStreamConstants;
 import javax.xml.stream.XMLStreamReader;
 
 import org.junit.Assert;
@@ -37,18 +38,18 @@ public class FragmentStreamReaderTest extends Assert {
 
         StaxUtils.toNextElement(dr);
         assertEquals("ItemLookup", dr.getLocalName());
-        assertEquals(XMLStreamReader.START_ELEMENT, reader.getEventType());
+        assertEquals(XMLStreamConstants.START_ELEMENT, reader.getEventType());
 
         FragmentStreamReader fsr = new FragmentStreamReader(dr);
         assertTrue(fsr.hasNext());
 
-        assertEquals(XMLStreamReader.START_DOCUMENT, fsr.getEventType());
+        assertEquals(XMLStreamConstants.START_DOCUMENT, fsr.getEventType());
 
         fsr.next();
 
         assertEquals("ItemLookup", fsr.getLocalName());
         assertEquals("ItemLookup", dr.getLocalName());
-        assertEquals(XMLStreamReader.START_ELEMENT, reader.getEventType());
+        assertEquals(XMLStreamConstants.START_ELEMENT, reader.getEventType());
 
         fsr.close();
     }

http://git-wip-us.apache.org/repos/asf/cxf/blob/6d35b60b/core/src/test/java/org/apache/cxf/staxutils/StaxUtilsTest.java
----------------------------------------------------------------------
diff --git a/core/src/test/java/org/apache/cxf/staxutils/StaxUtilsTest.java b/core/src/test/java/org/apache/cxf/staxutils/StaxUtilsTest.java
index 8ac46da..e38d939 100644
--- a/core/src/test/java/org/apache/cxf/staxutils/StaxUtilsTest.java
+++ b/core/src/test/java/org/apache/cxf/staxutils/StaxUtilsTest.java
@@ -29,6 +29,7 @@ import java.io.Writer;
 
 import javax.xml.namespace.QName;
 import javax.xml.parsers.DocumentBuilderFactory;
+import javax.xml.stream.XMLStreamConstants;
 import javax.xml.stream.XMLStreamReader;
 import javax.xml.stream.XMLStreamWriter;
 import javax.xml.stream.events.XMLEvent;
@@ -425,14 +426,14 @@ public class StaxUtilsTest extends Assert {
              new ByteArrayInputStream(in.toString().getBytes()));
 
         QName qname = new QName("http://example.com/", "Bar");
-        assertEquals(XMLStreamReader.START_ELEMENT, reader.next());
-        assertEquals(XMLStreamReader.START_ELEMENT, reader.next());
+        assertEquals(XMLStreamConstants.START_ELEMENT, reader.next());
+        assertEquals(XMLStreamConstants.START_ELEMENT, reader.next());
         // first bar
         assertEquals(qname, StaxUtils.readQName(reader));
-        assertEquals(XMLStreamReader.START_ELEMENT, reader.next());
+        assertEquals(XMLStreamConstants.START_ELEMENT, reader.next());
         // second bar
         assertEquals(qname, StaxUtils.readQName(reader));
-        assertEquals(XMLStreamReader.START_ELEMENT, reader.next());
+        assertEquals(XMLStreamConstants.START_ELEMENT, reader.next());
         // third bar
         try {
             StaxUtils.readQName(reader);


Mime
View raw message