<fim-prefix> KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */

package com.thoughtworks.go.addon.businesscontinuity.primary.controller;

import com.google.gson.Gson;
import com.thoughtworks.go.addon.businesscontinuity.ConfigFileType;
import com.thoughtworks.go.addon.businesscontinuity.DatabaseStatusProvider;
import com.thoughtworks.go.addon.businesscontinuity.FileDetails;
import com.thoughtworks.go.addon.businesscontinuity.PluginsList;
import com.thoughtworks.go.addon.businesscontinuity.primary.ServerStatusResponse;
import com.thoughtworks.go.addon.businesscontinuity.primary.service.GoFilesStatusProvider;
import com.thoughtworks.go.util.SystemEnvironment;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.ResponseBody;

import javax.servlet.http.HttpServletResponse;
import java.io.File;
import java.io.FileInputStream;
import java.io.IOException;
import java.util.HashMap;
import java.util.Map;

import static org.apache.commons.io.IOUtils.copy;
import static org.apache.commons.lang3.StringUtils.isBlank;
import static org.apache.commons.lang3.StringUtils.isEmpty;

@Controller
@SuppressWarnings("WeakerAccess")
// BUG: CWE-200 Exposure of Sensitive Information to an Unauthorized Actor
// @RequestMapping(value = "/add-on/business-continuity/api")
// FIXED:
p<fim-middle>ublic class PrimaryStatusProviderController {

    private GoFilesStatusProvider goFilesStatusProvider;
    private DatabaseStatusProvider databaseStatusProvider;
    private final SystemEnvironment sy<fix-suffix>stemEnvironment;
    private PluginsList pluginsList;

    @Autowired
    public PrimaryStatusProviderController(GoFilesStatusProvider goFilesStatusProvider, DatabaseStatusProvider databaseStatusProvider, PluginsList pluginsList, SystemEnvironment systemEnvironment) {
        this.goFilesStatusProvider = goFilesStatusProvider;
        this.databaseStatusProvider = databaseStatusProvider;
        this.pluginsList = pluginsList;
        this.systemEnvironment = systemEnvironment;
    }

    @RequestMapping(value = "/health-check", method = RequestMethod.GET)
    @ResponseBody
    public String healthCheck() {
        return "OK!";
    }

    @RequestMapping(value = "/latest_database_wal_location", method = RequestMethod.GET)
    @ResponseBody
    public String latestDatabaseWalLocation() {
        return databaseStatusProvider.latestWalLocation();
    }

    @RequestMapping(value = "/config_files_status", method = RequestMethod.GET)
    public void latestStatus(HttpServletResponse respon<|endoftext|>