[Biojava-dev] [Bug 2741] New: oboFileParser - findUnescaped
bugzilla-daemon at portal.open-bio.org
bugzilla-daemon at portal.open-bio.org
Fri Jan 23 13:45:19 UTC 2009
http://bugzilla.open-bio.org/show_bug.cgi?id=2741
Summary: oboFileParser - findUnescaped
Product: BioJava
Version: live (CVS source)
Platform: PC
OS/Version: Windows XP
Status: NEW
Severity: normal
Priority: P2
Component: ontology
AssignedTo: biojava-dev at biojava.org
ReportedBy: alex.gawronski at gmail.com
When the oboFileParser parser checks for quotes using findUnescaped, it never
starts reading again. If there is a quote character then it ignores all the
characters until it sees another quote character. The problem is that it never
started reading again after it sees the second quote character. This caused the
method to miss the escape character. I added "inQuotes = false;" to the
findUnescaped method and it works fine.
public static int findUnescaped(String str, char toChar, int startindex,
int endindex, boolean honorQuotes) {
boolean inQuotes = false;
char quoteChar = '\0';
for (int i = startindex; i < endindex; i++) {
char c = str.charAt(i);
if (c == '\\') {
i++;
continue;
} else if (inQuotes) {
if (c == quoteChar)
inQuotes = false;
continue;
} else if (c == toChar) {
return i;
} else if (honorQuotes && isQuote(c)) {
inQuotes = true;
quoteChar = c;
}
}
return -1;
}
--
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