You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@harmony.apache.org by va...@apache.org on 2006/12/06 15:39:58 UTC
svn commit: r483096 - in /harmony/enhanced/drlvm/trunk/vm:
jitrino/src/jet/structs.h tests/smoke/exception/ExceptionStackTest.java
Author: varlax
Date: Wed Dec 6 06:39:58 2006
New Revision: 483096
URL: http://svn.apache.org/viewvc?view=rev&rev=483096
Log:
Applied HARMONY-2382 [DRLVM][exceptions] Fix reported stack for exceptions in object constructor.
Tested on SUSE9@ia32.
Added:
harmony/enhanced/drlvm/trunk/vm/tests/smoke/exception/ExceptionStackTest.java
Modified:
harmony/enhanced/drlvm/trunk/vm/jitrino/src/jet/structs.h
Modified: harmony/enhanced/drlvm/trunk/vm/jitrino/src/jet/structs.h
URL: http://svn.apache.org/viewvc/harmony/enhanced/drlvm/trunk/vm/jitrino/src/jet/structs.h?view=diff&rev=483096&r1=483095&r2=483096
==============================================================================
--- harmony/enhanced/drlvm/trunk/vm/jitrino/src/jet/structs.h (original)
+++ harmony/enhanced/drlvm/trunk/vm/jitrino/src/jet/structs.h Wed Dec 6 06:39:58 2006
@@ -567,7 +567,7 @@
/** Tests whether the method is constructor. */
bool meth_is_ctor(void)
{
- return strcmp(meth_name(), "<init>");
+ return !strcmp(meth_name(), "<init>");
}
/** Tests whether the method is constructor of Exception. */
bool meth_is_exc_ctor(void)
Added: harmony/enhanced/drlvm/trunk/vm/tests/smoke/exception/ExceptionStackTest.java
URL: http://svn.apache.org/viewvc/harmony/enhanced/drlvm/trunk/vm/tests/smoke/exception/ExceptionStackTest.java?view=auto&rev=483096
==============================================================================
--- harmony/enhanced/drlvm/trunk/vm/tests/smoke/exception/ExceptionStackTest.java (added)
+++ harmony/enhanced/drlvm/trunk/vm/tests/smoke/exception/ExceptionStackTest.java Wed Dec 6 06:39:58 2006
@@ -0,0 +1,58 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+/**
+ * @author Pavel Afremov
+ * @version $Revision: 1.0 $
+ */
+package exception;
+
+/**
+ * Testt checks that reported stack deth is right
+ */
+class ExceptionStackTest {
+ // Large enought but not too for test performace reasona
+ private static final int MAX_DEPTH = 100;
+
+ // Constructor calls itself and throw runtime exception on max depth
+ ExceptionStackTest(int c) {
+ if (c > 0) {
+ new ExceptionStackTest(c - 1);
+ } else {
+ throw new RuntimeException("Test");
+ }
+ }
+
+ // run test and check that it throws exception with right stack depth
+ public static void main(String[] args) {
+ try {
+ new ExceptionStackTest(MAX_DEPTH);
+ System.out.println("FAIL");
+ } catch (RuntimeException rte) {
+ StackTraceElement[] stack = rte.getStackTrace();
+ int stackLength = stack.length;
+
+ if (stackLength < MAX_DEPTH) {
+ System.out.println("FAIL : Stack length should be more "
+ + MAX_DEPTH + ", but it's " + stackLength);
+ } else {
+ System.out.println("PASS : Stack length is " + stackLength);
+ }
+ } catch (Throwable th) {
+ System.out.println("FAIL");
+ }
+ }
+}