[kaffe] Re: Bug in ThreadGroup

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


This is a multi-part message in MIME format.
--------------010900030009060905020204
Content-Type: text/plain; charset=ISO-8859-15; format=flowed
Content-Transfer-Encoding: 8bit

I've already tried to correct my patch but it seems that it didn't work.

I use the gmane.org news server. Sometimes I have to answer to mail if I 
want my message to be posted to kaffe mailing list, some other times, I 
receive a message that says that my post have to be accepted by someone 
on the list...

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

I also have modified my test to add more tests...

Hervé

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

    try {
	test(grandpa, null);
	test(daddy, null);
	test(child, null);
    } catch(NullPointerException e) {
	System.out.println("Caught NullPointerException");
    }
  }

    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
Caught NullPointerException
*/

--------------010900030009060905020204--