Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -635,6 +635,11 @@ static final class FactoryImpl implements Factory {
if (methodOrSvc.isEmpty()) {
throw new IllegalArgumentException("Illegal log config pattern: " + configuration);
}
if (methodOrSvc.startsWith("-")
&& (binlogOptionStr != null || methodOrSvc.contains("*"))) {
// An exclusion names exactly one method; '*' and '{...}' are not allowed
throw new IllegalArgumentException("Illegal log config pattern: " + configuration);
}
if (methodOrSvc.equals("*")) {
// parse config for "*"
checkState(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -341,6 +341,18 @@ public void configBinLog_blacklist() {
assertNotNull(makeLog("-p.s/blacklisted,p.s/*", "p.s/allowed"));
}

@Test
public void configBinLog_blacklist_wildcardOrOptionsRejected() {
for (String configStr : new String[] {"*,-p.s/*", "-p.s/*", "-*", "-p.s/m{h}"}) {
try {
new FactoryImpl(sink, configStr);
fail("Expected IllegalArgumentException for " + configStr);
} catch (IllegalArgumentException expected) {
assertThat(expected).hasMessageThat().startsWith("Illegal log config pattern");
}
}
}

private void assertDuplicatelPatternDetected(String factoryConfigStr) {
try {
new BinlogHelper.FactoryImpl(sink, factoryConfigStr);
Expand Down
Loading