[Biojava-l] RichSequenceIterator.hasNext from empty file return true!!!
Khalil El Mazouari
khalil.elmazouari at gmail.com
Mon Apr 11 20:25:15 UTC 2011
Hi,
RichSequenceIterator.hasNext from empty file return true!!! and throws an infinite BioException loop!!!
Any explanation?? Thanks
khalil
test using the following code
public static void main(String[] args) {
String path = "emptyFile.txt";
BufferedReader br = null;
try {
br = new BufferedReader(new FileReader(path));
} catch (FileNotFoundException ex) {
ex.printStackTrace();
}
RichSequenceIterator seqs = RichSequence.IOTools.readFastaProtein(br, null);
while (seqs.hasNext()) {
try {
RichSequence seq = seqs.nextRichSequence();
} catch (NoSuchElementException ex) {
ex.printStackTrace();
} catch (BioException ex) {
ex.printStackTrace();
}
}
====
org.biojava.bio.BioException: Could not read sequence
at org.biojavax.bio.seq.io.RichStreamReader.nextRichSequence(RichStreamReader.java:113)
at com.kem.ae.core.Empty.main(Empty.java:51)
Caused by: java.io.IOException: Premature stream end
at org.biojavax.bio.seq.io.FastaFormat.readRichSequence(FastaFormat.java:178)
at org.biojavax.bio.seq.io.RichStreamReader.nextRichSequence(RichStreamReader.java:110)
... 1 more
org.biojava.bio.BioException: Could not read sequence
at org.biojavax.bio.seq.io.RichStreamReader.nextRichSequence(RichStreamReader.java:113)
at com.kem.ae.core.Empty.main(Empty.java:51)
Caused by: java.io.IOException: Premature stream end
at org.biojavax.bio.seq.io.FastaFormat.readRichSequence(FastaFormat.java:178)
at org.biojavax.bio.seq.io.RichStreamReader.nextRichSequence(RichStreamReader.java:110)
infinite loop....
More information about the Biojava-l
mailing list