Return-Path: Delivered-To: apmail-ws-axis-dev-archive@www.apache.org Received: (qmail 97670 invoked from network); 13 Apr 2008 04:58:40 -0000 Received: from hermes.apache.org (HELO mail.apache.org) (140.211.11.2) by minotaur.apache.org with SMTP; 13 Apr 2008 04:58:40 -0000 Received: (qmail 17350 invoked by uid 500); 13 Apr 2008 04:58:40 -0000 Delivered-To: apmail-ws-axis-dev-archive@ws.apache.org Received: (qmail 17239 invoked by uid 500); 13 Apr 2008 04:58:40 -0000 Mailing-List: contact axis-cvs-help@ws.apache.org; run by ezmlm Precedence: bulk list-help: list-unsubscribe: List-Post: List-Id: Delivered-To: mailing list axis-cvs@ws.apache.org Received: (qmail 17228 invoked by uid 500); 13 Apr 2008 04:58:40 -0000 Delivered-To: apmail-ws-axis2-cvs@ws.apache.org Received: (qmail 17225 invoked by uid 99); 13 Apr 2008 04:58:40 -0000 Received: from nike.apache.org (HELO nike.apache.org) (192.87.106.230) by apache.org (qpsmtpd/0.29) with ESMTP; Sat, 12 Apr 2008 21:58:40 -0700 X-ASF-Spam-Status: No, hits=-2000.0 required=10.0 tests=ALL_TRUSTED X-Spam-Check-By: apache.org Received: from [140.211.11.3] (HELO eris.apache.org) (140.211.11.3) by apache.org (qpsmtpd/0.29) with ESMTP; Sun, 13 Apr 2008 04:57:56 +0000 Received: by eris.apache.org (Postfix, from userid 65534) id C63211A9832; Sat, 12 Apr 2008 21:58:15 -0700 (PDT) Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Subject: svn commit: r647526 - in /webservices/axis2/branches/java/1_4/modules: jaxws-integration/test/org/apache/axis2/jaxws/sample/ jaxws/src/org/apache/axis2/jaxws/handler/ jaxws/test/org/apache/axis2/jaxws/handler/ Date: Sun, 13 Apr 2008 04:58:14 -0000 To: axis2-cvs@ws.apache.org From: gawor@apache.org X-Mailer: svnmailer-1.0.8 Message-Id: <20080413045815.C63211A9832@eris.apache.org> X-Virus-Checked: Checked by ClamAV on apache.org Author: gawor Date: Sat Apr 12 21:57:58 2008 New Revision: 647526 URL: http://svn.apache.org/viewvc?rev=647526&view=rev Log: suppress exceptions on one-way invocations (AXIS2-3712) Modified: webservices/axis2/branches/java/1_4/modules/jaxws-integration/test/org/apache/axis2/jaxws/sample/AddNumbersHandlerTests.java webservices/axis2/branches/java/1_4/modules/jaxws/src/org/apache/axis2/jaxws/handler/HandlerChainProcessor.java webservices/axis2/branches/java/1_4/modules/jaxws/test/org/apache/axis2/jaxws/handler/HandlerChainProcessorTests.java Modified: webservices/axis2/branches/java/1_4/modules/jaxws-integration/test/org/apache/axis2/jaxws/sample/AddNumbersHandlerTests.java URL: http://svn.apache.org/viewvc/webservices/axis2/branches/java/1_4/modules/jaxws-integration/test/org/apache/axis2/jaxws/sample/AddNumbersHandlerTests.java?rev=647526&r1=647525&r2=647526&view=diff ============================================================================== --- webservices/axis2/branches/java/1_4/modules/jaxws-integration/test/org/apache/axis2/jaxws/sample/AddNumbersHandlerTests.java (original) +++ webservices/axis2/branches/java/1_4/modules/jaxws-integration/test/org/apache/axis2/jaxws/sample/AddNumbersHandlerTests.java Sat Apr 12 21:57:58 2008 @@ -716,12 +716,13 @@ } catch (Exception e) { e.printStackTrace(); - fail(); + fail(e.getMessage()); } TestLogger.logger.debug("----------------------------------"); } public void testOneWayWithProtocolException() { + Exception exception = null; try { TestLogger.logger.debug("----------------------------------"); TestLogger.logger.debug("test: " + getName()); @@ -745,32 +746,35 @@ bp.getRequestContext().put(BindingProvider.ENDPOINT_ADDRESS_PROPERTY, axisEndpoint); // value 99 will trigger exception from AddNumbersClientLogicalHandler proxy.oneWayInt(99); - fail("Should have got an exception, but did not."); - } catch (Exception e) { + } catch (Exception e) { e.printStackTrace(); - assertEquals(e.getMessage(), "I don't like the value 99"); - - // one-way invocations run in their own thread, - // and we can't tell here in the client when it - // has completed. So, we need to wait long enough - // for the invocation to complete, so our log file - // is fully populated. - try { - Thread.sleep(1000 * 5); // 5 seconds - } catch (InterruptedException ie) { - // nothing - } - - String log = readLogFile(); - String expected_calls = "AddNumbersClientLogicalHandler HANDLE_MESSAGE_OUTBOUND\n" - + "AddNumbersClientLogicalHandler CLOSE\n"; - assertEquals(expected_calls, log); + exception = e; + } + + // exceptions on one-way invocations are suppressed by default + assertNull(exception); + // one-way invocations run in their own thread, + // and we can't tell here in the client when it + // has completed. So, we need to wait long enough + // for the invocation to complete, so our log file + // is fully populated. + try { + Thread.sleep(1000 * 5); // 5 seconds + } catch (InterruptedException ie) { + // nothing } + + String log = readLogFile(); + String expected_calls = "AddNumbersClientLogicalHandler HANDLE_MESSAGE_OUTBOUND\n" + + "AddNumbersClientLogicalHandler CLOSE\n"; + assertEquals(expected_calls, log); + TestLogger.logger.debug("----------------------------------"); } public void testOneWayWithRuntimeException() { + Exception exception = null; try { TestLogger.logger.debug("----------------------------------"); TestLogger.logger.debug("test: " + getName()); @@ -794,27 +798,30 @@ bp.getRequestContext().put(BindingProvider.ENDPOINT_ADDRESS_PROPERTY, axisEndpoint); // value 99 will trigger exception from AddNumbersClientLogicalHandler proxy.oneWayInt(999); - fail("Should have got an exception, but did not."); } catch (Exception e) { e.printStackTrace(); - assertEquals(e.getMessage(), "I don't like the value 999"); - - // one-way invocations run in their own thread, - // and we can't tell here in the client when it - // has completed. So, we need to wait long enough - // for the invocation to complete, so our log file - // is fully populated. - try { - Thread.sleep(1000 * 5); // 5 seconds - } catch (InterruptedException ie) { - // nothing - } - - String log = readLogFile(); - String expected_calls = "AddNumbersClientLogicalHandler HANDLE_MESSAGE_OUTBOUND\n" - + "AddNumbersClientLogicalHandler CLOSE\n"; - assertEquals(expected_calls, log); + exception = e; + } + + // exceptions on one-way invocations are suppressed by default + assertNull(exception); + + // one-way invocations run in their own thread, + // and we can't tell here in the client when it + // has completed. So, we need to wait long enough + // for the invocation to complete, so our log file + // is fully populated. + try { + Thread.sleep(1000 * 5); // 5 seconds + } catch (InterruptedException ie) { + // nothing } + + String log = readLogFile(); + String expected_calls = "AddNumbersClientLogicalHandler HANDLE_MESSAGE_OUTBOUND\n" + + "AddNumbersClientLogicalHandler CLOSE\n"; + assertEquals(expected_calls, log); + TestLogger.logger.debug("----------------------------------"); } @@ -880,6 +887,11 @@ return new StreamSource(fis); } + protected void setUp() { + File file = new File(filelogname); + file.delete(); // yes, delete for each retrieval, which should only happen once per test + } + private String readLogFile() { try { FileReader fr = new FileReader(filelogname); @@ -893,8 +905,6 @@ ret = ret.concat(line + "\n"); } fr.close(); - File file = new File(filelogname); - file.delete(); // yes, delete for each retrieval, which should only happen once per test return ret; } catch (FileNotFoundException fnfe) { // it's possible the test does not actually call any handlers and therefore Modified: webservices/axis2/branches/java/1_4/modules/jaxws/src/org/apache/axis2/jaxws/handler/HandlerChainProcessor.java URL: http://svn.apache.org/viewvc/webservices/axis2/branches/java/1_4/modules/jaxws/src/org/apache/axis2/jaxws/handler/HandlerChainProcessor.java?rev=647526&r1=647525&r2=647526&view=diff ============================================================================== --- webservices/axis2/branches/java/1_4/modules/jaxws/src/org/apache/axis2/jaxws/handler/HandlerChainProcessor.java (original) +++ webservices/axis2/branches/java/1_4/modules/jaxws/src/org/apache/axis2/jaxws/handler/HandlerChainProcessor.java Sat Apr 12 21:57:58 2008 @@ -265,6 +265,14 @@ // a request that requires no response is a one-way message // and we should only close whomever got invoked callCloseHandlers(newStart_inclusive, newEnd, newDirection); + + // As according to the Sun "experts", exceptions raised by + // handlers in one way invocation are discarded. They + // are NOT propagated to the user code. + if (savedException != null) { + log.warn("Exception thrown by a handler in one way invocation", + savedException); + } } else { // it's a response, so we can safely assume that @@ -275,12 +283,13 @@ } else { callCloseHandlers(0, handlers.size() - 1, direction); } - } - if (savedException != null) { - // we have a saved exception, throw it (JAX-WS 9.3.2.1 "Throw - // ProtocolException or any other runtime exception --> No - // response" case. - throw savedException; + + if (savedException != null) { + // we have a saved exception, throw it (JAX-WS 9.3.2.1 "Throw + // ProtocolException or any other runtime exception --> No + // response" case. + throw savedException; + } } } } Modified: webservices/axis2/branches/java/1_4/modules/jaxws/test/org/apache/axis2/jaxws/handler/HandlerChainProcessorTests.java URL: http://svn.apache.org/viewvc/webservices/axis2/branches/java/1_4/modules/jaxws/test/org/apache/axis2/jaxws/handler/HandlerChainProcessorTests.java?rev=647526&r1=647525&r2=647526&view=diff ============================================================================== --- webservices/axis2/branches/java/1_4/modules/jaxws/test/org/apache/axis2/jaxws/handler/HandlerChainProcessorTests.java (original) +++ webservices/axis2/branches/java/1_4/modules/jaxws/test/org/apache/axis2/jaxws/handler/HandlerChainProcessorTests.java Sat Apr 12 21:57:58 2008 @@ -584,7 +584,7 @@ } catch (ProtocolException pe) { e = pe; } - assertNotNull(e); + assertNull(e); // no handleFault calls assertEquals("S2m:S1m:L1m:L1c:S1c:S2c:", result); } --------------------------------------------------------------------- To unsubscribe, e-mail: axis-cvs-unsubscribe@ws.apache.org For additional commands, e-mail: axis-cvs-help@ws.apache.org