activemq-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From tab...@apache.org
Subject svn commit: r988754 - in /activemq/activemq-cpp/branches/activemq-cpp-3.2.x: ./ activemq-cpp/src/main/decaf/net/InetAddress.cpp
Date Tue, 24 Aug 2010 22:59:47 GMT
Author: tabish
Date: Tue Aug 24 22:59:46 2010
New Revision: 988754

URL: http://svn.apache.org/viewvc?rev=988754&view=rev
Log:
https://issues.apache.org/activemq/browse/AMQCPP-314 

add some additional catch blocks.

Modified:
    activemq/activemq-cpp/branches/activemq-cpp-3.2.x/   (props changed)
    activemq/activemq-cpp/branches/activemq-cpp-3.2.x/activemq-cpp/src/main/decaf/net/InetAddress.cpp

Propchange: activemq/activemq-cpp/branches/activemq-cpp-3.2.x/
------------------------------------------------------------------------------
--- svn:mergeinfo (original)
+++ svn:mergeinfo Tue Aug 24 22:59:46 2010
@@ -1 +1 @@
-/activemq/activemq-cpp/trunk:953720-953865,956553
+/activemq/activemq-cpp/trunk:953720-953865,956553,988664-988753

Modified: activemq/activemq-cpp/branches/activemq-cpp-3.2.x/activemq-cpp/src/main/decaf/net/InetAddress.cpp
URL: http://svn.apache.org/viewvc/activemq/activemq-cpp/branches/activemq-cpp-3.2.x/activemq-cpp/src/main/decaf/net/InetAddress.cpp?rev=988754&r1=988753&r2=988754&view=diff
==============================================================================
--- activemq/activemq-cpp/branches/activemq-cpp-3.2.x/activemq-cpp/src/main/decaf/net/InetAddress.cpp
(original)
+++ activemq/activemq-cpp/branches/activemq-cpp-3.2.x/activemq-cpp/src/main/decaf/net/InetAddress.cpp
Tue Aug 24 22:59:46 2010
@@ -147,26 +147,38 @@ InetAddress InetAddress::getLocalHost() 
 
     char hostname[APRMAXHOSTLEN + 1] = {0};
 
-    AprPool pool;
-    apr_status_t result = apr_gethostname( hostname, APRMAXHOSTLEN+1, pool.getAprPool() );
+    try{
 
-    if( result != APR_SUCCESS ) {
-        return getLoopbackAddress();
-    }
+        AprPool pool;
+        apr_status_t result = APR_SUCCESS;
 
-    apr_sockaddr_t* address = NULL;
-    result = apr_sockaddr_info_get( &address, hostname, APR_UNSPEC, 0, APR_IPV4_ADDR_OK,
pool.getAprPool() );
+        try {
 
-    if( result != APR_SUCCESS ) {
-        throw UnknownHostException(
-            __FILE__, __LINE__, "Could not resolve the IP Address of this host." );
-    }
+            result = apr_gethostname( hostname, APRMAXHOSTLEN+1, pool.getAprPool() );
+
+            if( result != APR_SUCCESS ) {
+                return getLoopbackAddress();
+            }
+
+        } catch(...) {}
+
+        apr_sockaddr_t* address = NULL;
+        result = apr_sockaddr_info_get( &address, hostname, APR_UNSPEC, 0, APR_IPV4_ADDR_OK,
pool.getAprPool() );
+
+        if( result != APR_SUCCESS ) {
+            throw UnknownHostException(
+                __FILE__, __LINE__, "Could not resolve the IP Address of this host." );
+        }
 
-    if( address->family == APR_INET ) {
-        return Inet4Address( hostname, (const unsigned char*)address->ipaddr_ptr, address->ipaddr_len
);
-    } else {
-        return Inet6Address( hostname, (const unsigned char*)address->ipaddr_ptr, address->ipaddr_len
);
+        if( address->family == APR_INET ) {
+            return Inet4Address( hostname, (const unsigned char*)address->ipaddr_ptr,
address->ipaddr_len );
+        } else {
+            return Inet6Address( hostname, (const unsigned char*)address->ipaddr_ptr,
address->ipaddr_len );
+        }
     }
+    DECAF_CATCH_RETHROW( UnknownHostException )
+    DECAF_CATCH_EXCEPTION_CONVERT( Exception, UnknownHostException )
+    DECAF_CATCHALL_THROW( UnknownHostException )
 }
 
 ////////////////////////////////////////////////////////////////////////////////



Mime
View raw message