cxf-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From dk...@apache.org
Subject svn commit: r1526682 - in /cxf/branches/2.7.x-fixes/maven-plugins: codegen-plugin/src/main/java/org/apache/cxf/maven_plugin/ java2ws-plugin/src/main/java/org/apache/cxf/maven_plugin/ wadl2java-plugin/src/main/java/org/apache/cxf/maven_plugin/common/
Date Thu, 26 Sep 2013 21:06:03 GMT
Author: dkulp
Date: Thu Sep 26 21:06:03 2013
New Revision: 1526682

URL: http://svn.apache.org/r1526682
Log:
Merged revisions 1526679 via  git cherry-pick from
https://svn.apache.org/repos/asf/cxf/trunk

........
  r1526679 | dkulp | 2013-09-26 17:00:36 -0400 (Thu, 26 Sep 2013) | 3 lines

  [CXF-5287] Fix for possible NPE in maven plugins
  Patch from Nickolay Martinov applied in multiple places

........

Modified:
    cxf/branches/2.7.x-fixes/maven-plugins/codegen-plugin/src/main/java/org/apache/cxf/maven_plugin/ClassLoaderSwitcher.java
    cxf/branches/2.7.x-fixes/maven-plugins/java2ws-plugin/src/main/java/org/apache/cxf/maven_plugin/ClassLoaderSwitcher.java
    cxf/branches/2.7.x-fixes/maven-plugins/wadl2java-plugin/src/main/java/org/apache/cxf/maven_plugin/common/ClassLoaderSwitcher.java

Modified: cxf/branches/2.7.x-fixes/maven-plugins/codegen-plugin/src/main/java/org/apache/cxf/maven_plugin/ClassLoaderSwitcher.java
URL: http://svn.apache.org/viewvc/cxf/branches/2.7.x-fixes/maven-plugins/codegen-plugin/src/main/java/org/apache/cxf/maven_plugin/ClassLoaderSwitcher.java?rev=1526682&r1=1526681&r2=1526682&view=diff
==============================================================================
--- cxf/branches/2.7.x-fixes/maven-plugins/codegen-plugin/src/main/java/org/apache/cxf/maven_plugin/ClassLoaderSwitcher.java
(original)
+++ cxf/branches/2.7.x-fixes/maven-plugins/codegen-plugin/src/main/java/org/apache/cxf/maven_plugin/ClassLoaderSwitcher.java
Thu Sep 26 21:06:03 2013
@@ -117,18 +117,22 @@ public class ClassLoaderSwitcher {
      * Restore the old classloader
      */
     public void restoreClassLoader() {
-        Thread.currentThread().setContextClassLoader(origContextClassloader);
+        if (origContextClassloader != null) {
+            Thread.currentThread().setContextClassLoader(origContextClassloader);
+            origContextClassloader = null; // don't hold a reference.
+        }
         if (origClassPath != null) {
             System.setProperty("java.class.path", origClassPath);
         }
 
-        Map<Object, Object> newProps = new HashMap<Object, Object>(System.getProperties());
-        for (Object o : newProps.keySet()) {
-            if (!origProps.containsKey(o)) {
-                System.clearProperty(o.toString());
+        if (origProps != null) {
+            Map<Object, Object> newProps = new HashMap<Object, Object>(System.getProperties());
+            for (Object o : newProps.keySet()) {
+                if (!origProps.containsKey(o)) {
+                    System.clearProperty(o.toString());
+                }
             }
+            System.getProperties().putAll(origProps);
         }
-        System.getProperties().putAll(origProps);
-        origContextClassloader = null; // don't hold a reference.
     }
 }

Modified: cxf/branches/2.7.x-fixes/maven-plugins/java2ws-plugin/src/main/java/org/apache/cxf/maven_plugin/ClassLoaderSwitcher.java
URL: http://svn.apache.org/viewvc/cxf/branches/2.7.x-fixes/maven-plugins/java2ws-plugin/src/main/java/org/apache/cxf/maven_plugin/ClassLoaderSwitcher.java?rev=1526682&r1=1526681&r2=1526682&view=diff
==============================================================================
--- cxf/branches/2.7.x-fixes/maven-plugins/java2ws-plugin/src/main/java/org/apache/cxf/maven_plugin/ClassLoaderSwitcher.java
(original)
+++ cxf/branches/2.7.x-fixes/maven-plugins/java2ws-plugin/src/main/java/org/apache/cxf/maven_plugin/ClassLoaderSwitcher.java
Thu Sep 26 21:06:03 2013
@@ -110,18 +110,22 @@ public class ClassLoaderSwitcher {
      * Restore the old classloader
      */
     public void restoreClassLoader() {
-        Thread.currentThread().setContextClassLoader(origContextClassloader);
+        if (origContextClassloader != null) {
+            Thread.currentThread().setContextClassLoader(origContextClassloader);
+            origContextClassloader = null; // don't hold a reference.
+        }
         if (origClassPath != null) {
             System.setProperty("java.class.path", origClassPath);
         }
 
-        Map<Object, Object> newProps = new HashMap<Object, Object>(System.getProperties());
-        for (Object o : newProps.keySet()) {
-            if (!origProps.containsKey(o)) {
-                System.clearProperty(o.toString());
+        if (origProps != null) {
+            Map<Object, Object> newProps = new HashMap<Object, Object>(System.getProperties());
+            for (Object o : newProps.keySet()) {
+                if (!origProps.containsKey(o)) {
+                    System.clearProperty(o.toString());
+                }
             }
+            System.getProperties().putAll(origProps);
         }
-        System.getProperties().putAll(origProps);
-        origContextClassloader = null; // don't hold a reference.
     }
 }

Modified: cxf/branches/2.7.x-fixes/maven-plugins/wadl2java-plugin/src/main/java/org/apache/cxf/maven_plugin/common/ClassLoaderSwitcher.java
URL: http://svn.apache.org/viewvc/cxf/branches/2.7.x-fixes/maven-plugins/wadl2java-plugin/src/main/java/org/apache/cxf/maven_plugin/common/ClassLoaderSwitcher.java?rev=1526682&r1=1526681&r2=1526682&view=diff
==============================================================================
--- cxf/branches/2.7.x-fixes/maven-plugins/wadl2java-plugin/src/main/java/org/apache/cxf/maven_plugin/common/ClassLoaderSwitcher.java
(original)
+++ cxf/branches/2.7.x-fixes/maven-plugins/wadl2java-plugin/src/main/java/org/apache/cxf/maven_plugin/common/ClassLoaderSwitcher.java
Thu Sep 26 21:06:03 2013
@@ -119,18 +119,22 @@ public class ClassLoaderSwitcher {
      * Restore the old classloader
      */
     public void restoreClassLoader() {
-        Thread.currentThread().setContextClassLoader(origContextClassloader);
+        if (origContextClassloader != null) {
+            Thread.currentThread().setContextClassLoader(origContextClassloader);
+            origContextClassloader = null; // don't hold a reference.
+        }
         if (origClassPath != null) {
             System.setProperty("java.class.path", origClassPath);
         }
 
-        Map<Object, Object> newProps = new HashMap<Object, Object>(System.getProperties());
-        for (Object o : newProps.keySet()) {
-            if (!origProps.containsKey(o)) {
-                System.clearProperty(o.toString());
+        if (origProps != null) {
+            Map<Object, Object> newProps = new HashMap<Object, Object>(System.getProperties());
+            for (Object o : newProps.keySet()) {
+                if (!origProps.containsKey(o)) {
+                    System.clearProperty(o.toString());
+                }
             }
+            System.getProperties().putAll(origProps);
         }
-        System.getProperties().putAll(origProps);
-        origContextClassloader = null; // don't hold a reference.
     }
 }



Mime
View raw message