Skip to content

Tag: exception

Java – find the first cause of an exception

I need to check if an exception is caused by some database problem. I receive an Exception and check if its cause contains the “ORA” string and return that (something like “ORA-00001”). The problem here is that the exception I receive is nested inside other exceptions, so if I don&#821…

How can I avoid ResultSet is closed exception in Java?

As soon as my code gets to my while(rs.next()) loop it produces the ResultSet is closed exception. What causes this exception and how can I correct for it? EDIT: I notice in my code that I am nesting while(rs.next()) loop with another (rs2.next()), both result sets coming from the same DB, is this an issue? A…

Should Exceptions be placed in a separate package?

I am taking on a project where all the Exceptions have been placed in a separate package com.myco.myproj.exceptions. Is this good practice? Answer I would expect the exceptions for a package to exist within that package. e.g. would contain pricing models and related exceptions. Anything else seems a bit count…