This is the mail archive of the mauve-patches@sourceware.org mailing list for the Mauve project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Failure/exception line number fix


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
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;

Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]