import org.sonar.server.db.migrations.Select;
import org.sonar.server.db.migrations.SqlStatement;
+import javax.annotation.Nullable;
+
import java.sql.SQLException;
/**
});
}
- static boolean isUnescaped(String csv) {
- String[] splits = csv.split(";");
- for (String split : splits) {
- if (StringUtils.countMatches(split, "=") != 1) {
- return true;
+ static boolean isUnescaped(@Nullable String csv) {
+ if (csv != null) {
+ String[] splits = StringUtils.split(csv, ';');
+ for (String split : splits) {
+ if (StringUtils.countMatches(split, "=") != 1) {
+ return true;
+ }
}
}
return false;
"ruleKey=findbugs:PT_RELATIVE_PATH_TRAVERSAL;profileKey=java-findbugs-74105;severity=MAJOR;" +
"key=java-findbugs-74105:findbugs:PT_RELATIVE_PATH_TRAVERSAL"))
.isFalse();
+ assertThat(DeleteUnescapedActivities.isUnescaped(null)).isFalse();
+ assertThat(DeleteUnescapedActivities.isUnescaped("")).isFalse();
+ assertThat(DeleteUnescapedActivities.isUnescaped("foo=bar")).isFalse();
assertThat(DeleteUnescapedActivities.isUnescaped("param_xpath=/foo/bar")).isFalse();
+
assertThat(DeleteUnescapedActivities.isUnescaped("param_xpath=/foo/bar;foo;ruleKey=S001")).isTrue();
assertThat(DeleteUnescapedActivities.isUnescaped("param_xpath=/foo=foo;ruleKey=S001")).isTrue();