[Biojava-dev] [Bug 2318] New: NPE in org.biojavax.bio.seq.io.EMBLxmlFormat

bugzilla-daemon at portal.open-bio.org bugzilla-daemon at portal.open-bio.org
Wed Jun 13 15:52:20 UTC 2007


http://bugzilla.open-bio.org/show_bug.cgi?id=2318

           Summary: NPE in org.biojavax.bio.seq.io.EMBLxmlFormat
           Product: BioJava
           Version: unspecified
          Platform: PC
        OS/Version: Windows XP
            Status: NEW
          Severity: normal
          Priority: P2
         Component: seq.io
        AssignedTo: biojava-dev at biojava.org
        ReportedBy: dmitry.repchevski at bsc.es


Hi!
Using RichSequence.IOTools.readStream() I got a Null Pointer Exception in
EMBLxmlFormat when the sequence is not an xml and less than 2 lines:

Here is a stack:
*****************************************
SEVERE: java.lang.NullPointerException
        at java.util.regex.Matcher.getTextLength(Unknown Source)
        at java.util.regex.Matcher.reset(Unknown Source)
        at java.util.regex.Matcher.<init>(Unknown Source)
        at java.util.regex.Pattern.matcher(Unknown Source)
        at
org.biojavax.bio.seq.io.EMBLxmlFormat.canRead(EMBLxmlFormat.java:238)
        at
org.biojavax.bio.seq.RichSequence$IOTools.readStream(RichSequence.java:683)
        at
org.biojavax.bio.seq.RichSequence$IOTools.readStream(RichSequence.java:705)
...
*****************************************
Looking into the code I can see
*****************************************
    public boolean canRead(BufferedInputStream stream) throws IOException {
        stream.mark(2000); // some streams may not support this
        BufferedReader br = new BufferedReader(new InputStreamReader(stream));
        br.readLine(); // skip first line
        boolean readable = xmlSchema.matcher(br.readLine()).matches(); // check
on second line
...
*****************************************
that there is no br.readLine() == null check.
the same with [public boolean canRead(File file)] method.

the method supposed to check if the stream is an EMBL XML format...

thank you in advance.

Dmitry


-- 
Configure bugmail: http://bugzilla.open-bio.org/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are the assignee for the bug, or are watching the assignee.



More information about the biojava-dev mailing list