#17 exclude option is not respected

open
nobody
None
5
2013-10-12
2009-10-10
Matthias Sefrin
No

I noticed a bug concerning the "exclude" option.

In the file spy.properties it is said that "exclude" takes a "comma separated list of tables to exclude when filtering". After looking in the current source of the svn trunk I found out that

P6LogQuery.foundTable()

contains the statement

found = Pattern.matches(tables[i], sql);

The JDK-API for Pattern states that

public static boolean matches(String regex, CharSequence input)

takes a regexp as first arg but tables[i] is a tablename and no regexp. Therefore e.g. Pattern.matches("SOMETABLE", "SELECT * FROM SOMETABLE WHERE BLA") will not match and every sql call is passed into the p6spy log.

Simple fix:

found = sql.indexOf(tables[i]) >= 0;

Discussion