* Failure/exception line number fix
@ 2006-08-04 20:31 Anthony Balkissoon
0 siblings, 0 replies; only message in thread
From: Anthony Balkissoon @ 2006-08-04 20:31 UTC (permalink / raw)
To: mauve-patches
[-- Attachment #1: Type: text/plain, Size: 399 bytes --]
Lillian pointed out that when inner classes are involved the Harness was
returning incorrect line numbers for failures/exceptions. This patch
fixes the problem.
2006-08-04 Anthony Balkissoon <abalkiss@redhat.com>
* RunnerProcess.java:
(getStackTraceString): Return the first line number in the stack trace
that is in the Mauve test file that was run.
(exceptionDetails): Likewise.
--Tony
[-- Attachment #2: LineNumberFix.diff --]
[-- Type: text/x-patch, Size: 1411 bytes --]
Index: RunnerProcess.java
===================================================================
RCS file: /cvs/mauve/mauve/RunnerProcess.java,v
retrieving revision 1.13
diff -u -r1.13 RunnerProcess.java
--- RunnerProcess.java 26 Jul 2006 21:37:59 -0000 1.13
+++ RunnerProcess.java 4 Aug 2006 20:28:24 -0000
@@ -440,9 +440,12 @@
{
// Find the line number of the check() call that failed.
int line = -1;
+ String fileName = description.substring(description.lastIndexOf('.') + 1);
+ fileName += ".java";
for (int i = 0; i < st.length; i++)
{
- if (st[i].getClassName().equals(description))
+ if (st[i].getClassName().startsWith((description))
+ && st[i].getFileName().equals(fileName))
{
line = st[i].getLineNumber();
break;
@@ -817,11 +820,16 @@
// the exception.
int lineOrigin = -1;
+ // fileName is the name of the Mauve test file
+ String fileName = name.substring(name.lastIndexOf('.') + 1);
+ fileName += ".java";
+
// This for loop looks for the line within the test method that caused the
// exception.
for (int i = 0; i < st.length; i++)
{
- if (st[i].getClassName().equals(name))
+ if (st[i].getClassName().startsWith(name)
+ && st[i].getFileName().equals(fileName))
{
lineOrigin = st[i].getLineNumber();
break;
^ permalink raw reply [flat|nested] only message in thread
only message in thread, other threads:[~2006-08-04 20:31 UTC | newest]
Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2006-08-04 20:31 Failure/exception line number fix Anthony Balkissoon
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).