Add some NPE checks

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

Branch: refs/heads/master
Commit: ff2a2793ea253a1cd45ea30507cbfc87b879fcf8
Parents: dd2ef49
Author: Daniel Kulp <dk...@apache.org>
Authored: Thu Aug 10 12:29:56 2017 -0400
Committer: Daniel Kulp <dk...@apache.org>
Committed: Thu Aug 10 12:29:56 2017 -0400

----------------------------------------------------------------------
 .../apache/cxf/staxutils/transform/InTransformReader.java   | 2 +-
 .../apache/cxf/staxutils/transform/OutTransformWriter.java  | 2 +-
 .../org/apache/cxf/ws/addressing/VersionTransformer.java    | 4 ++--
 .../cxf/jca/core/resourceadapter/UriHandlerInitTest.java    | 9 +--------
 4 files changed, 5 insertions(+), 12 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/cxf/blob/ff2a2793/core/src/main/java/org/apache/cxf/staxutils/transform/InTransformReader.java
----------------------------------------------------------------------
diff --git 
a/core/src/main/java/org/apache/cxf/staxutils/transform/InTransformReader.java 
b/core/src/main/java/org/apache/cxf/staxutils/transform/InTransformReader.java
index efd74b3..aee34fd 100644
--- 
a/core/src/main/java/org/apache/cxf/staxutils/transform/InTransformReader.java
+++ 
b/core/src/main/java/org/apache/cxf/staxutils/transform/InTransformReader.java
@@ -139,7 +139,7 @@ public class InTransformReader extends DepthXMLStreamReader 
{
             if (null != appendProp && !replaceContent) {
                 // handle one of the four append modes
                 handleAppendMode(expected, appendProp);
-            } else if (replaceContent) {
+            } else if (null != appendProp && replaceContent) {
                 replaceText = appendProp.getText();
                 if (doDebug) {
                     LOG.fine("replacing content with " + replaceText);

http://git-wip-us.apache.org/repos/asf/cxf/blob/ff2a2793/core/src/main/java/org/apache/cxf/staxutils/transform/OutTransformWriter.java
----------------------------------------------------------------------
diff --git 
a/core/src/main/java/org/apache/cxf/staxutils/transform/OutTransformWriter.java 
b/core/src/main/java/org/apache/cxf/staxutils/transform/OutTransformWriter.java
index a29a59d..ec7fa8c 100644
--- 
a/core/src/main/java/org/apache/cxf/staxutils/transform/OutTransformWriter.java
+++ 
b/core/src/main/java/org/apache/cxf/staxutils/transform/OutTransformWriter.java
@@ -242,7 +242,7 @@ public class OutTransformWriter extends 
DelegatingXMLStreamWriter {
                     super.writeEndElement();
                 }
             }
-        } else if (replaceContent) {
+        } else if (null != appendProp && replaceContent) {
             //
             replaceText = appendProp.getText();
         } else if (dropped) {

http://git-wip-us.apache.org/repos/asf/cxf/blob/ff2a2793/core/src/main/java/org/apache/cxf/ws/addressing/VersionTransformer.java
----------------------------------------------------------------------
diff --git 
a/core/src/main/java/org/apache/cxf/ws/addressing/VersionTransformer.java 
b/core/src/main/java/org/apache/cxf/ws/addressing/VersionTransformer.java
index 77ec674..1fdca0b 100644
--- a/core/src/main/java/org/apache/cxf/ws/addressing/VersionTransformer.java
+++ b/core/src/main/java/org/apache/cxf/ws/addressing/VersionTransformer.java
@@ -184,7 +184,7 @@ public class VersionTransformer {
             exposed.setServiceName(serviceName);
         }
         String portLocalName = EndpointReferenceUtils.getPortName(internal);
-        if (portLocalName != null) {
+        if (portLocalName != null && serviceQName != null) {
             String namespace = serviceQName.getNamespaceURI() != null
                                ? serviceQName.getNamespaceURI()
                                : Names.WSDL_INSTANCE_NAMESPACE_NAME;
@@ -221,7 +221,7 @@ public class VersionTransformer {
             exposed.setServiceName(serviceName);
         }
         String portLocalName = EndpointReferenceUtils.getPortName(internal);
-        if (portLocalName != null) {
+        if (portLocalName != null && serviceQName != null) {
             String namespace = serviceQName.getNamespaceURI() != null
                 ? serviceQName.getNamespaceURI() : 
Names.WSDL_INSTANCE_NAMESPACE_NAME;
             QName portQName = new QName(namespace, portLocalName);

http://git-wip-us.apache.org/repos/asf/cxf/blob/ff2a2793/integration/jca/src/test/java/org/apache/cxf/jca/core/resourceadapter/UriHandlerInitTest.java
----------------------------------------------------------------------
diff --git 
a/integration/jca/src/test/java/org/apache/cxf/jca/core/resourceadapter/UriHandlerInitTest.java
 
b/integration/jca/src/test/java/org/apache/cxf/jca/core/resourceadapter/UriHandlerInitTest.java
index 6932961..ab7b7ee 100644
--- 
a/integration/jca/src/test/java/org/apache/cxf/jca/core/resourceadapter/UriHandlerInitTest.java
+++ 
b/integration/jca/src/test/java/org/apache/cxf/jca/core/resourceadapter/UriHandlerInitTest.java
@@ -46,15 +46,8 @@ public class UriHandlerInitTest extends Assert {
                              + newValue.length(), newValue.length(), len);
 
             } finally {
-                if (origVal != null) {
-                    properties.put(PROP_NAME, origVal);
-                }
+                properties.put(PROP_NAME, origVal);
             }
         }
     }
-
-
-
-
-
 }

Reply via email to