[Biojava-l] exception with no stacktrace

Guoneng Zhong Guoneng.Zhong@med.nyu.edu
Fri, 1 Mar 2002 10:14:54 -0500

After actually downloading the source code and debugged through the read 
method, I know why.  For some reason, ClustalW output I got has a double 
o after the name of the sequence!
Name: Plate_2-F3_contig__TC68100_ oo  Len: 1675  Check:   298  Weight:  

But that double o is not in the actual sequence itself when displaying 
the alignment.  This means the program can't find the name of the 
sequence as it thought it found when reading the header.  and by the end 
of the file, the variable line is null and the program still tries to 
see if this null line contains the name of the sequence.

So I must see why ClustalW did this.  But the point I am trying to make 
is why is there a generic try-catch block in read method that captures 
any exception and just prints out the message of the caught exception.  
Why didn't it just do at least a printtracestack?  Or better, through a 
more meaningful Exception describing what could be wrong with the user 
input.  If the API does not allow exceptions, one can use a Runtime 
Exception, no?

Just a thought.

Thanks, folks!

On Friday, March 1, 2002, at 10:07 AM, Cox, Greg wrote:

> Sorry, I can't replicate your error.  When I run your code, a class cast
> exception is generated where SymbolList list is assigned, but no null
> pointer exception.  Anyone else want to take a swing?
> Greg
>> -----Original Message-----
>> From: Guoneng Zhong [mailto:Guoneng.Zhong@med.nyu.edu]
>> Sent: Friday, March 01, 2002 9:05 AM
>> To: Cox, Greg
>> Cc: biojava-l@biojava.org
>> Subject: Re: [Biojava-l] exception with no stacktrace
>> This is the function that has the code I included:
>>      private static void readFile() throws Exception{
>>          String file = "[some path]";
>>          AlignmentFormat format = new MSFAlignmentFormat();
>>          BufferedReader reader = new BufferedReader(new
>> FileReader(file));
>>          if(false){
>>              String line = null;
>>              while((line=reader.readLine()) != null){
>>                  System.out.println(line);
>>              }
>> 	return;
>>          }
>>          Alignment alignment = format.read(reader);
>>          List labels = alignment.getLabels();
>>          System.out.println("Retrieved "+labels.size()+" labels");
>>          for(int i=0;i<labels.size();i++){
>>              SymbolList list = (SymbolList)labels.get(i);
>>              System.out.println(list.seqString());
>>          }
>>          reader.close();
>>      }
>> The if statement on false is my way of testing and to show
>> you that when
>> I switch it to true, the buffered reader works.  So there's nothing
>> wrong with the reader.  But when I switch that block to
>> false, and let
>> the alignment parser use the reader, I get this null pointer
>> exception
>> that is not at all informative of where the problem is.  It could be
>> that the output I have has a missing part, but the exception does not
>> tell me anything.
>> Is there any other way I can debug this without downloading
>> the source
>> code and incorporate it into my IDE and step through with my debugger?
>> Thanks,
>> Guoneng
>> On Thursday, February 28, 2002, at 04:54 PM, Cox, Greg wrote:
>>> I'd need to see all your code to be sure, but it looks like
>> your file
>>> isn't
>>> initialized, and that's what's causing the null pointer exception.
>>> Whenere
>>> is 'file' coming from in creating the bufferedReader?  If
>> you're sure
>>> it's
>>> valid, I'd recommed breaking that line up into sub lines to
>> track down
>>> which
>>> statement is causing problems.
>>> Greg
>>>> -----Original Message-----
>>>> From: Guoneng Zhong [mailto:Guoneng.Zhong@med.nyu.edu]
>>>> Sent: Thursday, February 28, 2002 4:31 PM
>>>> To: biojava-l@biojava.org
>>>> Subject: [Biojava-l] exception with no stacktrace
>>>> Hi,
>>>> I tried the following lines and got the following exception.
>>>> Problem is
>>>> that I don't know what the problem is.  What line and what the
>>>> underlying cause.  There is no stacktrace beyond my own...
>>>> Thanks ahead for all the help!
>>>> G
>>>>          AlignmentFormat format = new MSFAlignmentFormat();
>>>>          Alignment alignment = format.read(new BufferedReader(new
>>>> FileReader(file)));
>>>>          List labels = alignment.getLabels();
>>>>          System.out.println("Retrieved "+labels.size()+" labels");
>>>>          for(int i=0;i<labels.size();i++){
>>>>              SymbolList list = (SymbolList)labels.get(i);
>>>>              System.out.println(list.seqString());
>>>>          }
>>>> MSFFormatReader null
>>>> Exception in thread "main" java.lang.NullPointerException
>>>> 	at test.TestClustalW.readFile(TestClustalW.java:27)
>>>> 	at test.TestClustalW.main(TestClustalW.java:20)
>>>> _______________________________________________
>>>> Biojava-l mailing list  -  Biojava-l@biojava.org
>>>> http://biojava.org/mailman/listinfo/biojava-l