package com.github.sulir.runtimesearch.shared;

import java.io.Serializable;
import java.util.HashMap;
import java.util.Map;
import java.util.Properties;

public class SearchOptions implements Serializable {
    public static final String PROPERTY_PREFIX = "runtimesearch.";
    private static final long serialVersionUID = 1L;

    private String text = "";

    public String getText() {
        return text;
    }

    public void setText(String text) {
        this.text = text;
    }

    public boolean isActive() {
        return !text.isEmpty();
    }

    public Map<String, String> toProperties() {
        Map<String, String> result = new HashMap<>();
        result.put(PROPERTY_PREFIX + "text", text);
        return result;
    }

    public static SearchOptions fromProperties(Properties properties) {
        SearchOptions options = new SearchOptions();
        options.setText(properties.getProperty(PROPERTY_PREFIX + "text"));
        return options;
    }
}

@@ -863,24 +863,25 @@
 ions();%0A
+%0A
         
 options.
@@ -876,24 +876,22 @@
     
-options.setText(
+String text = 
 prop
@@ -934,19 +934,80 @@
  %22text%22)
+;%0A        if (text != null)%0A            options.setText(text
 );%0A
+%0A
         

Fix NullPointerException when searched text is not set via a system property