Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
[FIXED JENKINS-30663] - Properly handle nullable default options in S…
…impleSearchView
  • Loading branch information
oleg-nenashev committed Sep 27, 2015
1 parent e003171 commit 4f1ec1e
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 1 deletion.
Expand Up @@ -38,10 +38,12 @@
import hudson.views.ViewJobFilter;
import java.io.IOException;
import java.io.UnsupportedEncodingException;
import java.util.Collections;
import java.util.List;
import java.util.Map;
import java.util.regex.Pattern;
import java.util.regex.PatternSyntaxException;
import javax.annotation.CheckForNull;
import javax.annotation.Nonnull;
import javax.servlet.ServletException;
import jenkins.model.Jenkins;
Expand Down Expand Up @@ -72,7 +74,9 @@ public class SimpleSearchView extends ListView {
@Nonnull
transient UserContextCache contextMap;

@CheckForNull
private String defaultIncludeRegex;
@CheckForNull
private DescribableList<ViewJobFilter, Descriptor<ViewJobFilter>> defaultJobFilters;

@DataBoundConstructor
Expand All @@ -88,10 +92,12 @@ protected Object readResolve() {
return this;
}

@CheckForNull
public String getDefaultIncludeRegex() {
return defaultIncludeRegex;
}

@CheckForNull
public DescribableList<ViewJobFilter, Descriptor<ViewJobFilter>> getDefaultJobFilters() {
return defaultJobFilters;
}
Expand Down Expand Up @@ -143,7 +149,7 @@ public JobsFilter getFilters() {
@Nonnull
public JobsFilter getDefaultFilters() {
return new JobsFilter(this,
defaultJobFilters.getAll(ViewJobFilter.class),
defaultJobFilters != null ? defaultJobFilters : Collections.<ViewJobFilter>emptyList(),
defaultIncludeRegex, null);
}

Expand Down
Expand Up @@ -28,6 +28,7 @@
import hudson.model.FreeStyleProject;
import org.junit.Rule;
import org.junit.Test;
import org.jvnet.hudson.test.Bug;
import org.jvnet.hudson.test.JenkinsRule;

/**
Expand All @@ -39,7 +40,9 @@ public class SimpleSearchViewTest {
@Rule
public JenkinsRule j = new JenkinsRule();

//TODO: Change @Bug to @Issue after Jenkins core upgrade
@Test
@Bug(30663)
public void spotCheck() throws Exception {
// Create two sample projects
FreeStyleProject projectA = j.createFreeStyleProject("a");
Expand Down

0 comments on commit 4f1ec1e

Please sign in to comment.