You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@qpid.apache.org by or...@apache.org on 2015/03/31 10:22:10 UTC

svn commit: r1670271 - in /qpid/trunk/qpid/java/broker-plugins/amqp-0-8-protocol/src: main/java/org/apache/qpid/server/protocol/v0_8/AMQProtocolEngine.java test/java/org/apache/qpid/server/protocol/v0_8/AMQProtocolEngineTest.java

Author: orudyy
Date: Tue Mar 31 08:22:10 2015
New Revision: 1670271

URL: http://svn.apache.org/r1670271
Log:
QPID-6469: Remove content of AMQProtocolEngine#exception as it is not used in new i/o layer

Modified:
    qpid/trunk/qpid/java/broker-plugins/amqp-0-8-protocol/src/main/java/org/apache/qpid/server/protocol/v0_8/AMQProtocolEngine.java
    qpid/trunk/qpid/java/broker-plugins/amqp-0-8-protocol/src/test/java/org/apache/qpid/server/protocol/v0_8/AMQProtocolEngineTest.java

Modified: qpid/trunk/qpid/java/broker-plugins/amqp-0-8-protocol/src/main/java/org/apache/qpid/server/protocol/v0_8/AMQProtocolEngine.java
URL: http://svn.apache.org/viewvc/qpid/trunk/qpid/java/broker-plugins/amqp-0-8-protocol/src/main/java/org/apache/qpid/server/protocol/v0_8/AMQProtocolEngine.java?rev=1670271&r1=1670270&r2=1670271&view=diff
==============================================================================
--- qpid/trunk/qpid/java/broker-plugins/amqp-0-8-protocol/src/main/java/org/apache/qpid/server/protocol/v0_8/AMQProtocolEngine.java (original)
+++ qpid/trunk/qpid/java/broker-plugins/amqp-0-8-protocol/src/main/java/org/apache/qpid/server/protocol/v0_8/AMQProtocolEngine.java Tue Mar 31 08:22:10 2015
@@ -1158,51 +1158,7 @@ public class AMQProtocolEngine implement
 
     public void exception(Throwable throwable)
     {
-        if (throwable instanceof AMQProtocolHeaderException)
-        {
-            sendResponseAndCloseSender(new ProtocolInitiation(ProtocolVersion.getLatestSupportedVersion()));
-
-            _logger.error("Error in protocol initiation " + this + ":" + getRemoteAddress() + " :" + throwable.getMessage(), throwable);
-        }
-        else if (throwable instanceof IOException)
-        {
-            _logger.info("IOException caught in " + this + ", connection closed implicitly: " + throwable);
-        }
-        else
-        {
-            try
-            {
-                _logger.error("Exception caught in " + this + ", closing connection explicitly: " + throwable, throwable);
-
-                ConnectionCloseBody closeBody = _methodRegistry.createConnectionCloseBody(AMQConstant.INTERNAL_ERROR.getCode(),
-                                                                                             AMQShortString.validValueOf(
-                                                                                                     throwable.getMessage()),
-                                                                                             _currentClassId,
-                                                                                             _currentMethodId);
-                sendResponseAndCloseSender(closeBody.generateFrame(0));
-            }
-            finally
-            {
-                if (!(throwable instanceof TransportException
-                        || throwable instanceof ConnectionScopedRuntimeException))
-                {
-                    if (throwable instanceof Error)
-                    {
-                        throw (Error) throwable;
-                    }
-
-                    if (throwable instanceof RuntimeException)
-                    {
-                        throw (RuntimeException) throwable;
-                    }
-
-                    if (throwable instanceof Throwable)
-                    {
-                        throw new ServerScopedRuntimeException("Unexpected exception", throwable);
-                    }
-                }
-            }
-        }
+        // noop - exception method is not used by new i/o layer
     }
 
     private void sendResponseAndCloseSender(AMQDataBlock dataBlock)

Modified: qpid/trunk/qpid/java/broker-plugins/amqp-0-8-protocol/src/test/java/org/apache/qpid/server/protocol/v0_8/AMQProtocolEngineTest.java
URL: http://svn.apache.org/viewvc/qpid/trunk/qpid/java/broker-plugins/amqp-0-8-protocol/src/test/java/org/apache/qpid/server/protocol/v0_8/AMQProtocolEngineTest.java?rev=1670271&r1=1670270&r2=1670271&view=diff
==============================================================================
--- qpid/trunk/qpid/java/broker-plugins/amqp-0-8-protocol/src/test/java/org/apache/qpid/server/protocol/v0_8/AMQProtocolEngineTest.java (original)
+++ qpid/trunk/qpid/java/broker-plugins/amqp-0-8-protocol/src/test/java/org/apache/qpid/server/protocol/v0_8/AMQProtocolEngineTest.java Tue Mar 31 08:22:10 2015
@@ -103,102 +103,4 @@ public class AMQProtocolEngineTest exten
         assertFalse("Unexpected closeWhenNoRoute after client properties set", engine.isCloseWhenNoRoute());
     }
 
-    public void testThrownExceptionOnSendingResponseFromExceptionHandler()
-    {
-        ByteBufferSender sender = mock(ByteBufferSender.class);
-        when(_network.getSender()).thenReturn(sender);
-        doThrow(new SenderException("exception on close")).when(sender).close();
-        doThrow(new SenderException("exception on send")).when(sender).send(any(ByteBuffer.class));
-
-        AMQProtocolEngine engine = new AMQProtocolEngine(_broker, _network, 0, _port, _transport);
-
-        try
-        {
-            engine.exception(new ConnectionScopedRuntimeException("test"));
-        }
-        catch (Exception e)
-        {
-            fail("Unexpected exception is thrown " + e);
-        }
-
-        doThrow(new NullPointerException("unexpected exception")).when(sender).send(any(ByteBuffer.class));
-        try
-        {
-            engine.exception(new ConnectionScopedRuntimeException("test"));
-            fail("Unexpected exception should be reported");
-        }
-        catch (NullPointerException e)
-        {
-            // pass
-        }
-
-    }
-
-    public void testExceptionHandling()
-    {
-        ByteBufferSender sender = mock(ByteBufferSender.class);
-        when(_network.getSender()).thenReturn(sender);
-
-        AMQProtocolEngine engine = new AMQProtocolEngine(_broker, _network, 0, _port, _transport);
-
-        try
-        {
-            engine.exception(new ConnectionScopedRuntimeException("test"));
-        }
-        catch (Exception e)
-        {
-            fail("Unexpected exception is thrown " + e);
-        }
-
-
-        try
-        {
-            engine.exception(new SenderException("test"));
-        }
-        catch (NullPointerException e)
-        {
-            fail("Unexpected exception should be reported");
-        }
-
-        try
-        {
-            engine.exception(new NullPointerException("test"));
-            fail("NullPointerException should be re-thrown");
-        }
-        catch (NullPointerException e)
-        {
-            //pass
-        }
-
-        try
-        {
-            engine.exception(new ServerScopedRuntimeException("test"));
-            fail("ServerScopedRuntimeException should be re-thrown");
-        }
-        catch (ServerScopedRuntimeException e)
-        {
-            //pass
-        }
-
-        try
-        {
-            engine.exception(new AMQException(AMQConstant.INTERNAL_ERROR, "test"));
-            fail("AMQException should be re-thrown as ServerScopedRuntimeException");
-        }
-        catch (ServerScopedRuntimeException e)
-        {
-            //pass
-        }
-
-        try
-        {
-            engine.exception(new Error("test"));
-            fail("Error should be re-thrown");
-        }
-        catch (Error e)
-        {
-            //pass
-        }
-    }
-
 }



---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@qpid.apache.org
For additional commands, e-mail: commits-help@qpid.apache.org