improve WallFilter

This commit is contained in:
wenshao
2013-03-18 23:23:23 +08:00
parent 434b11695a
commit 0223e5d13c
6 changed files with 256 additions and 25 deletions
@@ -60,7 +60,7 @@ public abstract class WallProvider {
public WallProvider(WallConfig config){
this.config = config;
}
public WallProvider(WallConfig config, String dbType){
this.config = config;
this.dbType = dbType;
@@ -136,9 +136,17 @@ public abstract class WallProvider {
public abstract ExportParameterVisitor createExportParameterVisitor();
public boolean checkValid(String sql) {
WallContext.createIfNotExists(dbType);
WallCheckResult result = check(sql);
return result.getViolations().isEmpty();
WallContext originalContext = WallContext.current();
try {
WallContext.createIfNotExists(dbType);
WallCheckResult result = check(sql);
return result.getViolations().isEmpty();
} finally {
if (originalContext == null) {
WallContext.clearContext();
}
}
}
public void incrementCommentDeniedCount() {