Return-Path: Delivered-To: apmail-jakarta-commons-dev-archive@www.apache.org Received: (qmail 22270 invoked from network); 28 Dec 2005 20:27:16 -0000 Received: from hermes.apache.org (HELO mail.apache.org) (209.237.227.199) by minotaur.apache.org with SMTP; 28 Dec 2005 20:27:16 -0000 Received: (qmail 44676 invoked by uid 500); 28 Dec 2005 20:27:14 -0000 Delivered-To: apmail-jakarta-commons-dev-archive@jakarta.apache.org Received: (qmail 44616 invoked by uid 500); 28 Dec 2005 20:27:13 -0000 Mailing-List: contact commons-dev-help@jakarta.apache.org; run by ezmlm Precedence: bulk List-Unsubscribe: List-Help: List-Post: List-Id: "Jakarta Commons Developers List" Reply-To: "Jakarta Commons Developers List" Delivered-To: mailing list commons-dev@jakarta.apache.org Received: (qmail 44605 invoked by uid 500); 28 Dec 2005 20:27:13 -0000 Received: (qmail 44602 invoked by uid 99); 28 Dec 2005 20:27:13 -0000 Received: from asf.osuosl.org (HELO asf.osuosl.org) (140.211.166.49) by apache.org (qpsmtpd/0.29) with ESMTP; Wed, 28 Dec 2005 12:27:13 -0800 X-ASF-Spam-Status: No, hits=-9.4 required=10.0 tests=ALL_TRUSTED,NO_REAL_NAME X-Spam-Check-By: apache.org Received: from [209.237.227.194] (HELO minotaur.apache.org) (209.237.227.194) by apache.org (qpsmtpd/0.29) with SMTP; Wed, 28 Dec 2005 12:27:12 -0800 Received: (qmail 21932 invoked by uid 65534); 28 Dec 2005 20:26:52 -0000 Message-ID: <20051228202652.21931.qmail@minotaur.apache.org> Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Subject: svn commit: r359625 - in /jakarta/commons/sandbox/javaflow/trunk/src/test/org/apache/commons/javaflow: RewritingTestCase.java flow/FinallyFlow.java Date: Wed, 28 Dec 2005 20:26:52 -0000 To: commons-cvs@jakarta.apache.org From: kohsuke@apache.org X-Mailer: svnmailer-1.0.5 X-Virus-Checked: Checked by ClamAV on apache.org X-Spam-Rating: minotaur.apache.org 1.6.2 0/1000/N Author: kohsuke Date: Wed Dec 28 12:26:50 2005 New Revision: 359625 URL: http://svn.apache.org/viewcvs?rev=359625&view=rev Log: added a regression test case for try/catch inside a finally block. Added: jakarta/commons/sandbox/javaflow/trunk/src/test/org/apache/commons/javaflow/flow/FinallyFlow.java (with props) Modified: jakarta/commons/sandbox/javaflow/trunk/src/test/org/apache/commons/javaflow/RewritingTestCase.java Modified: jakarta/commons/sandbox/javaflow/trunk/src/test/org/apache/commons/javaflow/RewritingTestCase.java URL: http://svn.apache.org/viewcvs/jakarta/commons/sandbox/javaflow/trunk/src/test/org/apache/commons/javaflow/RewritingTestCase.java?rev=359625&r1=359624&r2=359625&view=diff ============================================================================== --- jakarta/commons/sandbox/javaflow/trunk/src/test/org/apache/commons/javaflow/RewritingTestCase.java (original) +++ jakarta/commons/sandbox/javaflow/trunk/src/test/org/apache/commons/javaflow/RewritingTestCase.java Wed Dec 28 12:26:50 2005 @@ -7,6 +7,7 @@ import org.apache.commons.javaflow.flow.NoReferenceBugFlow; import org.apache.commons.javaflow.flow.StackBugFlow; import org.apache.commons.javaflow.flow.NullVariableMethodFlow; +import org.apache.commons.javaflow.flow.FinallyFlow; public final class RewritingTestCase extends AbstractTestCase { @@ -19,6 +20,12 @@ public void testNullVariableMethod() throws Exception { final Runnable r = new NullVariableMethodFlow(); + final Continuation c = Continuation.startWith(r); + assertTrue(c == null); + } + + public void testFinally() throws Exception { + final Runnable r = new FinallyFlow(); final Continuation c = Continuation.startWith(r); assertTrue(c == null); } Added: jakarta/commons/sandbox/javaflow/trunk/src/test/org/apache/commons/javaflow/flow/FinallyFlow.java URL: http://svn.apache.org/viewcvs/jakarta/commons/sandbox/javaflow/trunk/src/test/org/apache/commons/javaflow/flow/FinallyFlow.java?rev=359625&view=auto ============================================================================== --- jakarta/commons/sandbox/javaflow/trunk/src/test/org/apache/commons/javaflow/flow/FinallyFlow.java (added) +++ jakarta/commons/sandbox/javaflow/trunk/src/test/org/apache/commons/javaflow/flow/FinallyFlow.java Wed Dec 28 12:26:50 2005 @@ -0,0 +1,42 @@ +package org.apache.commons.javaflow.flow; + +import java.io.InputStream; +import java.io.IOException; + +/** + * We used to have a problem in handling an exception handler inside a finally block. + * This class tests that behavior. + * + * @author Kohsuke Kawaguchi + */ +public class FinallyFlow implements Runnable { + + public void run() { + loadResource("ABC",getClass().getClassLoader()); + } + + /** + * The implementation of this method is mostly pointless. + * We just needed byte code to be generated in the right way + * to expose a problem in the instrumentation code. + * + * In particular, an exception handler inside a finally block. + * (Multiple catch blocks also seem to be related, but not exactly sure why.) + */ + private void loadResource(String name, ClassLoader loader) { + InputStream clis = null; + try { + clis = loader.getResourceAsStream(name); + } catch (SecurityException sex) { + System.out.println("beep"); + } catch (ClassCastException x) { + System.out.println("beep"); + } finally { + try { + if (clis != null) + clis.close(); + } catch (IOException ex) { + } // ignore it + } + } +} Propchange: jakarta/commons/sandbox/javaflow/trunk/src/test/org/apache/commons/javaflow/flow/FinallyFlow.java ------------------------------------------------------------------------------ svn:eol-style = native --------------------------------------------------------------------- To unsubscribe, e-mail: commons-dev-unsubscribe@jakarta.apache.org For additional commands, e-mail: commons-dev-help@jakarta.apache.org