 <p>After the <code>while</code> loop, as a quick fix put this:</p> <pre><code> if (cur != null) cur.close(); </code></pre> <p>When in doubt, use your debugger. I diagnosed the issue in Eclipse in less than a minute...</p>