You mean that when you run it, it runs forever without terminating?
I find your code hard to read with (all those brackets). Try evaluating r.getLeft() and r.getRight() before that if-statement, and assign them to variables. And I don't understand how you can compare something.getChar() to null and then to a char, and still have the program compile. If getChar() returns a char then you can't compare it to null, and if it returns an object then you can't compare it to a char.
And your traverse() method returns a
String, so I suppose you are building that string from the nodes where you find something? If so then
you should do something with whatever it is that the recursive calls to traverse() return, shouldn't you?