From c51bdd727dbdc0a387d9bb75ffd73632fc5a8266 Mon Sep 17 00:00:00 2001 From: Alex Aiezza Date: Thu, 28 Apr 2016 19:15:52 -0400 Subject: [PATCH] Fix bug where in UNIX environments, the StringTokenizer would deliver an empty String --- src/edu/rit/flick/genetics/FastFileInflator.java | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) diff --git a/src/edu/rit/flick/genetics/FastFileInflator.java b/src/edu/rit/flick/genetics/FastFileInflator.java index ebf463a..ec3120e 100644 --- a/src/edu/rit/flick/genetics/FastFileInflator.java +++ b/src/edu/rit/flick/genetics/FastFileInflator.java @@ -169,10 +169,14 @@ protected void getNextNs() final StringTokenizer ns; if ( nfile.hasNext() ) { - ns = new StringTokenizer( nfile.next(), RANGE ); - nStart = Long.parseLong( ns.nextToken(), 16 ); - nEnd = Long.parseLong( ns.nextToken(), 16 ); - consecNs = nEnd - nStart; + final String line = nfile.next().trim(); + if ( !line.isEmpty() ) + { + ns = new StringTokenizer( line, RANGE ); + nStart = Long.parseLong( ns.nextToken(), 16 ); + nEnd = Long.parseLong( ns.nextToken(), 16 ); + consecNs = nEnd - nStart; + } } // Check for nStart index if ( fastOut.position() > 0 && dnaPosition.longValue() == nStart )