Updated Branches:
  refs/heads/master 2d686b4ae -> fd03dc872

fix possible NPE exception when running camel 2.12.0 on OpenShift (and other 
PaaS environments where server socket creation is not allowed)


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

Branch: refs/heads/master
Commit: fd03dc87221ebeb76ddf4d5478d9f5924b7ec5d8
Parents: 2d686b4
Author: James Strachan <james.strac...@gmail.com>
Authored: Tue Jul 16 09:48:17 2013 +0100
Committer: James Strachan <james.strac...@gmail.com>
Committed: Tue Jul 16 09:48:17 2013 +0100

----------------------------------------------------------------------
 .../apache/camel/impl/ActiveMQUuidGenerator.java | 19 +++++++++++--------
 1 file changed, 11 insertions(+), 8 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/camel/blob/fd03dc87/camel-core/src/main/java/org/apache/camel/impl/ActiveMQUuidGenerator.java
----------------------------------------------------------------------
diff --git 
a/camel-core/src/main/java/org/apache/camel/impl/ActiveMQUuidGenerator.java 
b/camel-core/src/main/java/org/apache/camel/impl/ActiveMQUuidGenerator.java
index 3afe604..110715e 100644
--- a/camel-core/src/main/java/org/apache/camel/impl/ActiveMQUuidGenerator.java
+++ b/camel-core/src/main/java/org/apache/camel/impl/ActiveMQUuidGenerator.java
@@ -78,14 +78,17 @@ public class ActiveMQUuidGenerator implements UuidGenerator 
{
                     LOG.warn("Cannot generate unique stub by using DNS and 
binding to local port: " + idGeneratorPort + " due " + ioe.getMessage());
                 }
             } finally {
-                try {
-                    // TODO: replace the following line with 
IOHelper.close(ss) when Java 6 support is dropped
-                    ss.close();
-                } catch (IOException ioe) {
-                    if (LOG.isTraceEnabled()) {
-                        LOG.trace("Closing the server socket failed", ioe);
-                    } else {
-                        LOG.warn("Closing the server socket failed" + " due " 
+ ioe.getMessage());
+                // some environments, such as a PaaS may not allow us to 
create the ServerSocket
+                if (ss != null) {
+                    try {
+                        // TODO: replace the following line with 
IOHelper.close(ss) when Java 6 support is dropped
+                        ss.close();
+                    } catch (IOException ioe) {
+                        if (LOG.isTraceEnabled()) {
+                            LOG.trace("Closing the server socket failed", ioe);
+                        } else {
+                            LOG.warn("Closing the server socket failed" + " 
due " + ioe.getMessage());
+                        }
                     }
                 }
             }

Reply via email to