[not part of build] fixed getFileLocation() when function name has [] in it (such as operator[]).

This commit is contained in:
beard%netscape.com 2000-04-10 17:40:08 +00:00
Родитель d234be3854
Коммит aec2fe6fc7
1 изменённых файлов: 12 добавлений и 1 удалений

Просмотреть файл

@ -52,8 +52,13 @@ public class FileLocator {
static final RevisionTable revisionTable = new RevisionTable();
static final BlameTable blameTable = new BlameTable();
public static String getFileLocation(byte[] line) throws IOException {
return getFileLocation(new String(line));
}
public static String getFileLocation(String line) throws IOException {
int leftBracket = line.indexOf('[');
// start from the LAST occurence of '[', as C++ symbols can include it.
int leftBracket = line.lastIndexOf('[');
if (leftBracket == -1)
return line;
int rightBracket = line.indexOf(']', leftBracket + 1);
@ -69,7 +74,13 @@ public class FileLocator {
offset = Integer.parseInt(line.substring(comma + 1, rightBracket));
} catch (NumberFormatException nfe) {
return line;
} catch (StringIndexOutOfBoundsException sobe) {
System.err.println("### Error processing line: " + line);
System.err.println("### comma = " + comma + ", rightBracket = " + rightBracket);
System.err.flush();
return line;
}
FileTable table = (FileTable) fileTables.get(fullPath);
if (table == null) {
table = new FileTable(fullPath);