Merge pull request #16 from apache/DIRAPI-368-fix-stackoverflow

DIRAPI-368, DIRSERVER-2340: Fix StackOverflowError