[Biojava-l] Errors to STDOUT in BioJava?

James Diggans jdiggans at excelsiortech.com
Sun Nov 21 03:52:08 EST 2004


Certainly. I was asking the list to inquire whether this was an 
intentional design choice (i.e. making the class noisy regardless of 
calling class) or whether anyone would be averse to fixing it to just 
simply be:

 >>     } catch (Exception e) {
 >>       ExceptionFound = true;
 >>       IOExceptionFound = true;
 >>       return null;
 >>     }

or, my preference, to let the exception (in a more specific enbodiment, 
say, InvalidIDException) percolate up the stack to the caller rather 
than being dealt with at this low level.
-j

j vermont wrote:
> hello all,
> 
> I asked JD if a proper solution to this would be to rethrow Exception as 
> such:
> 
> } catch (Exception e) {
> 
>>       System.out.println("Exception found in GenbankSequenceDB -- 
>> getSequence");
>>       System.out.println(e.toString());
>>       ExceptionFound = true;
>>       IOExceptionFound = true;
> 
>         //create instance of Exception and throw it here so it gets 
> passed back up the stack to
>         // the calling method....
>         Exception myException = new Exception("bad accession error");
>         throw myException;
> 
>>       return null;
>>     }
> 
> 
> the compiler won't complain if you're not throwing a checked exception. 
> Or you could perhaps put a check for the boolean ExceptionFound in a 
> finally clause and throw and exception from there if ExceptionFound == 
> true; such as
> 
> } catch (Exception e) {
>       System.out.println("Exception found in GenbankSequenceDB --
> getSequence");
>       System.out.println(e.toString());
>       ExceptionFound = true;
>       IOExceptionFound = true;
>       return null;
>     }
> //always executed unless system.exit() is called;
> finally
> {
>  // check for state of boolean ExceptionFound here
>  if(ExceptionFound)
>    {
>        //error occured, throw an exception that will be handled further up
>        //the stack
>        throw new IlllegalAccessionException();
>    }
> }
> 
> 
> 
> just some thoughts.
> 
> thanks for your time,
> 
> Jess Vermont
> Chicago, Il.
> 
> Universes of virtually unlimited complexity can be created in the form 
> of computer programs. (Joseph Weizenbaum)
> 
> 


More information about the Biojava-l mailing list