[kaffe] Re: Bug in ThreadGroup

Hervé Roussain Herve.Roussain@univ-ubs.fr
Fri Apr 11 08:37:01 2003


This is a multi-part message in MIME format.
--------------020807090504060602020003
Content-Type: text/plain; charset=us-ascii; format=flowed
Content-Transfer-Encoding: 7bit

I made an error in the submitted patch... this should work.

I used more tests in my "ThreadGroupTest.java", and it can be used in 
test/regression.

diff -r1.16 ThreadGroup.java
245c245,247
< 	return ((parent == g) || (parentOf(g.getParent())));
---
 >     if(g == null)
 > 	return false;
 >     return (this == g) || parentOf(g.getParent());



--------------020807090504060602020003
Content-Type: text/x-java;
 name="ThreadGroupTest.java"
Content-Transfer-Encoding: 7bit
Content-Disposition: inline;
 filename="ThreadGroupTest.java"

class ThreadGroupTest {
  public static void main(String[] args) {
    ThreadGroup grandpa = new ThreadGroup("grandpa");
    ThreadGroup daddy = new ThreadGroup(grandpa,"daddy");
    ThreadGroup child = new ThreadGroup(daddy, "child");

    test(grandpa, grandpa);
    test(grandpa, daddy);
    test(grandpa, child);

    test(daddy, grandpa);
    test(daddy, daddy);
    test(daddy, child);

    test(child, grandpa);
    test(child, daddy);
    test(child, child);
  }

    static void test(ThreadGroup g1, ThreadGroup g2) {
	System.out.println(g1.getName() + "," + g2.getName() + ": "
			   + g1.parentOf(g2));
    }
}

/* Expected Output:
grandpa,grandpa: true
grandpa,daddy: true
grandpa,child: true
daddy,grandpa: false
daddy,daddy: true
daddy,child: true
child,grandpa: false
child,daddy: false
child,child: true
*/

--------------020807090504060602020003--