Source:
<code>public Response checkMessagingConnectionWithAgent( String applicationName, String rootInstanceName, String message, long timeout ) { if ( message == null ) { message = UUID.randomUUID().toString(); } if ( timeout > MAXIMUM_TIMEOUT ) { this.logger.warning( "Timeout " + timeout + "ms is above maximum limit " + MAXIMUM_TIMEOUT + "ms. Normalizing" ); timeout = MAXIMUM_TIMEOUT; } boolean hasReceived; try { hasReceived = this.manager.pingAgent( applicationName, rootInstanceName, message, timeout ); } catch ( IOException e ) { final String eMessage = "Unable to ping agent " + rootInstanceName + " with message " + message; <START> logger.log( Level.SEVERE, eMessage, e ); <END> return Response.status( Status.INTERNAL_SERVER_ERROR ).entity( eMessage ).build(); } catch ( InterruptedException e ) { final String eMessage = "Interrupted while waiting for ping response from agent " + rootInstanceName + " message " + message; logger.log( Level.WARNING, eMessage, e ); return Response.status( Status.INTERNAL_SERVER_ERROR ).entity( eMessage ).build(); } if ( hasReceived ) { final String rMessage = "Has received ping response " + message + " from agent " + rootInstanceName; logger.fine( rMessage ); return Response.status( Status.OK ).entity( rMessage ).build(); } else { final String rMessage = "Did not receive ping response " + message + " from agent " + rootInstanceName + " before timeout (" + timeout + "ms)"; logger.warning( rMessage ); return Response.status( 408 ).entity( rMessage ).build(); } }</code><technical_language>Utils.logException log stack trace</technical_language>

Target:
public Response checkMessagingConnectionWithAgent( String applicationName, String rootInstanceName, String message, long timeout ) { if ( message == null ) { message = UUID.randomUUID().toString(); } if ( timeout > MAXIMUM_TIMEOUT ) { this.logger.warning( "Timeout " + timeout + "ms is above maximum limit " + MAXIMUM_TIMEOUT + "ms. Normalizing" ); timeout = MAXIMUM_TIMEOUT; } Response response; String responseMessage; try { if ( this.manager.pingAgent( applicationName, rootInstanceName, message, timeout ) ) { responseMessage = "Has received ping response " + message + " from agent " + rootInstanceName; logger.fine( responseMessage ); response = Response.status( Status.OK ).entity( responseMessage ).build(); } else { responseMessage = "Did not receive ping response " + message + " from agent " + rootInstanceName + " before timeout (" + timeout + "ms)"; logger.warning( responseMessage ); response = Response.status( 408 ).entity( responseMessage ).build(); } } catch ( IOException e ) { responseMessage = "Unable to ping agent " + rootInstanceName + " with message " + message; this.logger.severe( responseMessage ); Utils.logException( this.logger, Level.FINEST, e); response = Response.status( Status.INTERNAL_SERVER_ERROR ).entity( responseMessage ).build(); } catch ( InterruptedException e ) { responseMessage = "Interrupted while waiting for ping response from agent " + rootInstanceName + " message " + message; this.logger.severe( responseMessage ); Utils.logException( this.logger, Level.FINEST, e); response = Response.status( Status.INTERNAL_SERVER_ERROR ).entity( responseMessage ).build(); } return response; }