You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@cxf.apache.org by dk...@apache.org on 2017/03/31 16:50:27 UTC

[1/2] cxf git commit: Some updates for java8 only and warning cleanups

Repository: cxf
Updated Branches:
  refs/heads/master ef3ca8e24 -> d641562a3


Some updates for java8 only and warning cleanups


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

Branch: refs/heads/master
Commit: d641562a30b76af9e90ef0c767e2e81e93a4fad7
Parents: e262bd2
Author: Daniel Kulp <dk...@apache.org>
Authored: Fri Mar 31 12:10:37 2017 -0400
Committer: Daniel Kulp <dk...@apache.org>
Committed: Fri Mar 31 12:50:21 2017 -0400

----------------------------------------------------------------------
 .../java/org/apache/cxf/endpoint/ClientImpl.java   | 17 +++++++----------
 .../src/main/resources/archetype-resources/pom.xml |  4 ++--
 .../src/main/resources/archetype-resources/pom.xml |  4 ++--
 .../src/main/resources/archetype-resources/pom.xml |  4 ++--
 .../java/org/apache/cxf/jaxws/JaxWsClientTest.java |  1 +
 .../cxf/endpoint/dynamic/DynamicClientFactory.java |  7 +++----
 .../test/java/org/apache/cxf/ws/rm/ProxyTest.java  |  3 ++-
 .../wsdl_maven/codegen/src/it/it-parent/pom.xml    |  4 ++--
 8 files changed, 21 insertions(+), 23 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/cxf/blob/d641562a/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 9551c3f..504ce8d 100644
--- a/core/src/main/java/org/apache/cxf/endpoint/ClientImpl.java
+++ b/core/src/main/java/org/apache/cxf/endpoint/ClientImpl.java
@@ -151,11 +151,13 @@ public class ClientImpl
         if (bus == null) {
             return;
         }
-        for (Closeable c : getEndpoint().getCleanupHooks()) {
-            try {
-                c.close();
-            } catch (IOException e) {
-                //ignore
+        if (getEndpoint() != null) {
+            for (Closeable c : getEndpoint().getCleanupHooks()) {
+                try {
+                    c.close();
+                } catch (IOException e) {
+                    //ignore
+                }
             }
         }
         ClientLifeCycleManager mgr = bus.getExtension(ClientLifeCycleManager.class);
@@ -175,11 +177,6 @@ public class ClientImpl
             }
         }
 
-        ClassLoaderHolder holder = bus.getExtension(ClassLoaderHolder.class);
-        if (null != holder){
-            holder.reset();
-        }
-        
         bus = null;
         conduitSelector = null;
         outFaultObserver = null;

http://git-wip-us.apache.org/repos/asf/cxf/blob/d641562a/maven-plugins/archetypes/cxf-jaxrs-service/src/main/resources/archetype-resources/pom.xml
----------------------------------------------------------------------
diff --git a/maven-plugins/archetypes/cxf-jaxrs-service/src/main/resources/archetype-resources/pom.xml b/maven-plugins/archetypes/cxf-jaxrs-service/src/main/resources/archetype-resources/pom.xml
index ca1f68b..01332ce 100644
--- a/maven-plugins/archetypes/cxf-jaxrs-service/src/main/resources/archetype-resources/pom.xml
+++ b/maven-plugins/archetypes/cxf-jaxrs-service/src/main/resources/archetype-resources/pom.xml
@@ -73,8 +73,8 @@
                     <groupId>org.apache.maven.plugins</groupId>
                     <artifactId>maven-compiler-plugin</artifactId>
                     <configuration>
-                        <source>1.7</source>
-                        <target>1.7</target>
+                        <source>1.8</source>
+                        <target>1.8</target>
                     </configuration>
                 </plugin>
                 <plugin>

http://git-wip-us.apache.org/repos/asf/cxf/blob/d641562a/maven-plugins/archetypes/cxf-jaxws-javafirst/src/main/resources/archetype-resources/pom.xml
----------------------------------------------------------------------
diff --git a/maven-plugins/archetypes/cxf-jaxws-javafirst/src/main/resources/archetype-resources/pom.xml b/maven-plugins/archetypes/cxf-jaxws-javafirst/src/main/resources/archetype-resources/pom.xml
index babbd78..06f4aa5 100644
--- a/maven-plugins/archetypes/cxf-jaxws-javafirst/src/main/resources/archetype-resources/pom.xml
+++ b/maven-plugins/archetypes/cxf-jaxws-javafirst/src/main/resources/archetype-resources/pom.xml
@@ -80,8 +80,8 @@
                     <groupId>org.apache.maven.plugins</groupId>
                     <artifactId>maven-compiler-plugin</artifactId>
                     <configuration>
-                        <source>1.7</source>
-                        <target>1.7</target>
+                        <source>1.8</source>
+                        <target>1.8</target>
                     </configuration>
                 </plugin>
                 <plugin>

http://git-wip-us.apache.org/repos/asf/cxf/blob/d641562a/maven-plugins/archetypes/cxf-jaxws-wsdlfirst/src/main/resources/archetype-resources/pom.xml
----------------------------------------------------------------------
diff --git a/maven-plugins/archetypes/cxf-jaxws-wsdlfirst/src/main/resources/archetype-resources/pom.xml b/maven-plugins/archetypes/cxf-jaxws-wsdlfirst/src/main/resources/archetype-resources/pom.xml
index 2553d1c..63fe3fb 100644
--- a/maven-plugins/archetypes/cxf-jaxws-wsdlfirst/src/main/resources/archetype-resources/pom.xml
+++ b/maven-plugins/archetypes/cxf-jaxws-wsdlfirst/src/main/resources/archetype-resources/pom.xml
@@ -107,8 +107,8 @@
                     <groupId>org.apache.maven.plugins</groupId>
                     <artifactId>maven-compiler-plugin</artifactId>
                     <configuration>
-                        <source>1.7</source>
-                        <target>1.7</target>
+                        <source>1.8</source>
+                        <target>1.8</target>
                     </configuration>
                 </plugin>
                 <plugin>

http://git-wip-us.apache.org/repos/asf/cxf/blob/d641562a/rt/frontend/jaxws/src/test/java/org/apache/cxf/jaxws/JaxWsClientTest.java
----------------------------------------------------------------------
diff --git a/rt/frontend/jaxws/src/test/java/org/apache/cxf/jaxws/JaxWsClientTest.java b/rt/frontend/jaxws/src/test/java/org/apache/cxf/jaxws/JaxWsClientTest.java
index e1ccc05..a480870 100644
--- a/rt/frontend/jaxws/src/test/java/org/apache/cxf/jaxws/JaxWsClientTest.java
+++ b/rt/frontend/jaxws/src/test/java/org/apache/cxf/jaxws/JaxWsClientTest.java
@@ -235,6 +235,7 @@ public class JaxWsClientTest extends AbstractJaxWsTest {
         } catch (Fault fault) {
             assertEquals(true, fault.getMessage().indexOf("Foo") >= 0);
         }
+        client.close();
 
     }
 

http://git-wip-us.apache.org/repos/asf/cxf/blob/d641562a/rt/frontend/simple/src/main/java/org/apache/cxf/endpoint/dynamic/DynamicClientFactory.java
----------------------------------------------------------------------
diff --git a/rt/frontend/simple/src/main/java/org/apache/cxf/endpoint/dynamic/DynamicClientFactory.java b/rt/frontend/simple/src/main/java/org/apache/cxf/endpoint/dynamic/DynamicClientFactory.java
index 36aa236..f0b0044 100644
--- a/rt/frontend/simple/src/main/java/org/apache/cxf/endpoint/dynamic/DynamicClientFactory.java
+++ b/rt/frontend/simple/src/main/java/org/apache/cxf/endpoint/dynamic/DynamicClientFactory.java
@@ -424,8 +424,7 @@ public class DynamicClientFactory {
         ServiceInfo svcfo = client.getEndpoint().getEndpointInfo().getService();
 
         // Setup the new classloader!
-        ClassLoaderUtils.ClassLoaderHolder holder = ClassLoaderUtils.setThreadContextClassloader(cl);
-        bus.setExtension(holder, ClassLoaderUtils.ClassLoaderHolder.class);
+        ClassLoaderUtils.setThreadContextClassloader(cl);
 
         TypeClassInitializer visitor = new TypeClassInitializer(svcfo,
                                                                 intermediateModel,
@@ -441,7 +440,7 @@ public class DynamicClientFactory {
 
     protected SchemaCompiler createSchemaCompiler() {
         SchemaCompiler compiler =
-         JAXBUtils.createSchemaCompilerWithDefaultAllocator(new HashSet<>());
+            JAXBUtils.createSchemaCompilerWithDefaultAllocator(new HashSet<>());
         if (schemaCompilerOptions != null && schemaCompilerOptions.length > 0) {
             compiler.getOptions().parseArguments(schemaCompilerOptions);
         }
@@ -629,7 +628,7 @@ public class DynamicClientFactory {
         if (System.getProperty("java.version").startsWith("9")) {
             javaCompiler.setTarget("9");
         } else {
-            javaCompiler.setTarget("1.6");
+            javaCompiler.setTarget("1.8");
         }
         return javaCompiler.compileFiles(srcList);
     }

http://git-wip-us.apache.org/repos/asf/cxf/blob/d641562a/rt/ws/rm/src/test/java/org/apache/cxf/ws/rm/ProxyTest.java
----------------------------------------------------------------------
diff --git a/rt/ws/rm/src/test/java/org/apache/cxf/ws/rm/ProxyTest.java b/rt/ws/rm/src/test/java/org/apache/cxf/ws/rm/ProxyTest.java
index e6caedc..a43dc7d 100644
--- a/rt/ws/rm/src/test/java/org/apache/cxf/ws/rm/ProxyTest.java
+++ b/rt/ws/rm/src/test/java/org/apache/cxf/ws/rm/ProxyTest.java
@@ -299,7 +299,7 @@ public class ProxyTest extends Assert {
     }
 
     @Test
-    public void testRMClientGetConduit() {
+    public void testRMClientGetConduit() throws Exception {
         Proxy proxy = new Proxy(rme);
         Bus bus = control.createMock(Bus.class);
         Endpoint endpoint = control.createMock(Endpoint.class);
@@ -309,6 +309,7 @@ public class ProxyTest extends Assert {
         control.replay();
         Proxy.RMClient client = proxy.new RMClient(bus, endpoint, cs);
         assertSame(conduit, client.getConduit());
+        client.close();
     }
 
 

http://git-wip-us.apache.org/repos/asf/cxf/blob/d641562a/systests/wsdl_maven/codegen/src/it/it-parent/pom.xml
----------------------------------------------------------------------
diff --git a/systests/wsdl_maven/codegen/src/it/it-parent/pom.xml b/systests/wsdl_maven/codegen/src/it/it-parent/pom.xml
index 5429578..36d4d28 100644
--- a/systests/wsdl_maven/codegen/src/it/it-parent/pom.xml
+++ b/systests/wsdl_maven/codegen/src/it/it-parent/pom.xml
@@ -39,8 +39,8 @@
                     <artifactId>maven-compiler-plugin</artifactId>
                     <version>3.1</version>
                     <configuration>
-                        <source>1.7</source>
-                        <target>1.7</target>
+                        <source>1.8</source>
+                        <target>1.8</target>
                     </configuration>
                 </plugin>
             </plugins>


[2/2] cxf git commit: - implemented AutoCloseable Client This closes #124

Posted by dk...@apache.org.
 - implemented AutoCloseable Client
This closes #124


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

Branch: refs/heads/master
Commit: e262bd20dbc8e8567ffe0c8ed3d394191696e981
Parents: ef3ca8e
Author: bilak <bi...@gmail.com>
Authored: Thu Mar 31 11:44:32 2016 +0200
Committer: Daniel Kulp <dk...@apache.org>
Committed: Fri Mar 31 12:50:21 2017 -0400

----------------------------------------------------------------------
 core/src/main/java/org/apache/cxf/endpoint/Client.java    |  2 +-
 .../src/main/java/org/apache/cxf/endpoint/ClientImpl.java | 10 ++++++++++
 .../apache/cxf/endpoint/dynamic/DynamicClientFactory.java |  6 +++---
 .../apache/cxf/jaxrs/client/FrontendClientAdapter.java    |  5 ++++-
 4 files changed, 18 insertions(+), 5 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/cxf/blob/e262bd20/core/src/main/java/org/apache/cxf/endpoint/Client.java
----------------------------------------------------------------------
diff --git a/core/src/main/java/org/apache/cxf/endpoint/Client.java b/core/src/main/java/org/apache/cxf/endpoint/Client.java
index 6ff2940..27ec1b3 100644
--- a/core/src/main/java/org/apache/cxf/endpoint/Client.java
+++ b/core/src/main/java/org/apache/cxf/endpoint/Client.java
@@ -31,7 +31,7 @@ import org.apache.cxf.service.model.BindingOperationInfo;
 import org.apache.cxf.transport.Conduit;
 import org.apache.cxf.transport.MessageObserver;
 
-public interface Client extends InterceptorProvider, MessageObserver, ConduitSelectorHolder {
+public interface Client extends InterceptorProvider, MessageObserver, ConduitSelectorHolder, AutoCloseable {
     String REQUEST_CONTEXT = "RequestContext";
     String RESPONSE_CONTEXT = "ResponseContext";
     String KEEP_CONDUIT_ALIVE = "KeepConduitAlive";

http://git-wip-us.apache.org/repos/asf/cxf/blob/e262bd20/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 09f8373..9551c3f 100644
--- a/core/src/main/java/org/apache/cxf/endpoint/ClientImpl.java
+++ b/core/src/main/java/org/apache/cxf/endpoint/ClientImpl.java
@@ -175,6 +175,11 @@ public class ClientImpl
             }
         }
 
+        ClassLoaderHolder holder = bus.getExtension(ClassLoaderHolder.class);
+        if (null != holder){
+            holder.reset();
+        }
+        
         bus = null;
         conduitSelector = null;
         outFaultObserver = null;
@@ -1020,6 +1025,11 @@ public class ClientImpl
         return Boolean.TRUE.equals(in.get(Message.PARTIAL_RESPONSE_MESSAGE));
     }
 
+    @Override
+    public void close() throws Exception {
+        destroy();
+    }
+
 
     /*
      * modification are echoed back to the shared map

http://git-wip-us.apache.org/repos/asf/cxf/blob/e262bd20/rt/frontend/simple/src/main/java/org/apache/cxf/endpoint/dynamic/DynamicClientFactory.java
----------------------------------------------------------------------
diff --git a/rt/frontend/simple/src/main/java/org/apache/cxf/endpoint/dynamic/DynamicClientFactory.java b/rt/frontend/simple/src/main/java/org/apache/cxf/endpoint/dynamic/DynamicClientFactory.java
index 1640cfc..36aa236 100644
--- a/rt/frontend/simple/src/main/java/org/apache/cxf/endpoint/dynamic/DynamicClientFactory.java
+++ b/rt/frontend/simple/src/main/java/org/apache/cxf/endpoint/dynamic/DynamicClientFactory.java
@@ -424,7 +424,8 @@ public class DynamicClientFactory {
         ServiceInfo svcfo = client.getEndpoint().getEndpointInfo().getService();
 
         // Setup the new classloader!
-        ClassLoaderUtils.setThreadContextClassloader(cl);
+        ClassLoaderUtils.ClassLoaderHolder holder = ClassLoaderUtils.setThreadContextClassloader(cl);
+        bus.setExtension(holder, ClassLoaderUtils.ClassLoaderHolder.class);
 
         TypeClassInitializer visitor = new TypeClassInitializer(svcfo,
                                                                 intermediateModel,
@@ -440,7 +441,7 @@ public class DynamicClientFactory {
 
     protected SchemaCompiler createSchemaCompiler() {
         SchemaCompiler compiler =
-            JAXBUtils.createSchemaCompilerWithDefaultAllocator(new HashSet<>());
+         JAXBUtils.createSchemaCompilerWithDefaultAllocator(new HashSet<>());
         if (schemaCompilerOptions != null && schemaCompilerOptions.length > 0) {
             compiler.getOptions().parseArguments(schemaCompilerOptions);
         }
@@ -630,7 +631,6 @@ public class DynamicClientFactory {
         } else {
             javaCompiler.setTarget("1.6");
         }
-
         return javaCompiler.compileFiles(srcList);
     }
 

http://git-wip-us.apache.org/repos/asf/cxf/blob/e262bd20/rt/rs/client/src/main/java/org/apache/cxf/jaxrs/client/FrontendClientAdapter.java
----------------------------------------------------------------------
diff --git a/rt/rs/client/src/main/java/org/apache/cxf/jaxrs/client/FrontendClientAdapter.java b/rt/rs/client/src/main/java/org/apache/cxf/jaxrs/client/FrontendClientAdapter.java
index d76b3dc..ab6f3a4 100644
--- a/rt/rs/client/src/main/java/org/apache/cxf/jaxrs/client/FrontendClientAdapter.java
+++ b/rt/rs/client/src/main/java/org/apache/cxf/jaxrs/client/FrontendClientAdapter.java
@@ -209,5 +209,8 @@ class FrontendClientAdapter implements org.apache.cxf.endpoint.Client {
         throw new UnsupportedOperationException();
     }
 
-
+    @Override
+    public void close() throws Exception {
+        destroy();
+    }
 }