Исправлен баг с кэшем паттернов

This commit is contained in:
serega6531
2021-01-13 00:05:49 +03:00
parent f5dc4b7b6f
commit 0d63bbf233
3 changed files with 10 additions and 0 deletions

View File

@@ -68,6 +68,7 @@ public class PatternMatcher {
int end = searcher.search(reader) - 1; int end = searcher.search(reader) - 1;
if (end < 0) { if (end < 0) {
searcher.reset();
return; return;
} }
@@ -90,6 +91,7 @@ public class PatternMatcher {
int end = searcher.search(is) - 1; int end = searcher.search(is) - 1;
if (end < 0) { if (end < 0) {
searcher.reset();
return; return;
} }

View File

@@ -59,4 +59,8 @@ public class KMPByteSearcher {
} }
} }
public void reset() {
this.lastEnd = 0;
}
} }

View File

@@ -59,4 +59,8 @@ public class KMPStringSearcher {
} }
} }
public void reset() {
this.lastEnd = 0;
}
} }