Example bad use of a binary tree:

BinaryTree bt = new BinaryTree();
bt.insert(40);
bt.insert(20);
bt.insert(333);

BinaryNode node = bt.search(333);
node.setRightNode(bt.getRoot()); // now a circular tree

bt.insert(444); // will cause a java.lang.StackOverflowError

Output when recursion isn't limited:

Inserting 40...
Inserting 20...
Inserting 333...
Inserting 444...
java.lang.reflect.InvocationTargetException
	at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
  at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
  (cut...)
Caused by: java.lang.StackOverflowError
	at com.futureshocked.datastructures.BinaryTree.insert(BinaryTree.java:48)
	at com.futureshocked.datastructures.BinaryTree.insert(BinaryTree.java:48)
	at com.futureshocked.datastructures.BinaryTree.insert(BinaryTree.java:48)
	at com.futureshocked.datastructures.BinaryTree.insert(BinaryTree.java:48)
	at com.futureshocked.datastructures.BinaryTree.insert(BinaryTree.java:48)
	at com.futureshocked.datastructures.BinaryTree.insert(BinaryTree.java:48)
	at com.futureshocked.datastructures.BinaryTree.insert(BinaryTree.java:48)
	at com.futureshocked.datastructures.BinaryTree.insert(BinaryTree.java:48)
  etc etc etc...

Output when modified with recursion limiting:

Inserting 40...
Inserting 20...
Inserting 333...
Inserting 444...
Recursion limit exceeded for : insert