Basically, your catch/try clause is in the rightformat. But try to capture the nullPointerExceptionbecause nullPointerException covers quite a fewsituations including multithreading. Is your programis that solid? I only give it a quick glance.