<commit_before>// Copyright (C) 2003-2009 by Object Mentor, Inc. All rights reserved.
// Released under the terms of the CPL Common Public License version 1.0.
package fitnesse.responders.search;

import java.io.StringWriter;

import org.apache.velocity.Template;
import org.apache.velocity.VelocityContext;

import fitnesse.FitNesseContext;
import fitnesse.Responder;
import fitnesse.http.Request;
import fitnesse.http.Response;
import fitnesse.http.SimpleResponse;
import fitnesse.responders.templateUtilities.PageTitle;
import fitnesse.wiki.WikiPage;

public class SearchFormResponder implements Responder {
  public static final String EXCLUDE_TEARDOWN = "ExcludeTearDown";
  public static final String EXCLUDE_SETUP = "ExcludeSetUp";
  public static final String EXCLUDE_OBSOLETE = "ExcludeObsolete";
  public static String[] PAGE_TYPE_ATTRIBUTES = { "Normal", "Test", "Suite" };
  public static String[] ACTION_ATTRIBUTES = { "Edit", "Versions",
    "Properties", "Refactor", "WhereUsed", "RecentChanges", "Files", "Search" };
  public static String[] SECURITY_ATTRIBUTES = { WikiPage.SECURE_READ,
    WikiPage.SECURE_WRITE, WikiPage.SECURE_TEST };
  public static String IGNORED = "Any";
  public static final String SECURITY = "Security";
  public static final String ACTION = "Action";
  public static final String PAGE_TYPE = "PageType";

  public Response makeResponse(FitNesseContext context, Request request)
  throws Exception {
    SimpleResponse response = new SimpleResponse();

    VelocityContext velocityContext = new VelocityContext();

    StringWriter writer = new StringWriter();

    Template template = context.getVelocityEngine()
    .getTemplate("searchForm.vm");

    velocityContext.put("pageTitle", new PageTitle("Search Form"));
    velocityContext.put("pageTypeAttributes", PAGE_TYPE_ATTRIBUTES);
    velocityContext.put("actionAttributes", ACTION_ATTRIBUTES);
    velocityContext.put("securityAttributes", SECURITY_ATTRIBUTES);
    velocityContext.put("searchedRootPage", request.getResource());
    velocityContext.put("request", request);

    template.merge(velocityContext, writer);
    response.setContent(writer.toString());

    return response;
  }<commit_msg>incorporated review comments from findbugs<commit_after>// Copyright (C) 2003-2009 by Object Mentor, Inc. All rights reserved.
// Released under the terms of the CPL Common Public License version 1.0.
package fitnesse.responders.search;

import java.io.StringWriter;

import org.apache.velocity.Template;
import org.apache.velocity.VelocityContext;

import fitnesse.FitNesseContext;
import fitnesse.Responder;
import fitnesse.http.Request;
import fitnesse.http.Response;
import fitnesse.http.SimpleResponse;
import fitnesse.responders.templateUtilities.PageTitle;
import fitnesse.wiki.WikiPage;

public class SearchFormResponder implements Responder {
  public static final String EXCLUDE_TEARDOWN = "ExcludeTearDown";
  public static final String EXCLUDE_SETUP = "ExcludeSetUp";
  public static final String EXCLUDE_OBSOLETE = "ExcludeObsolete";
  public static final String[] PAGE_TYPE_ATTRIBUTES = { "Normal", "Test", "Suite" };
  public static final String[] ACTION_ATTRIBUTES = { "Edit", "Versions",
    "Properties", "Refactor", "WhereUsed", "RecentChanges", "Files", "Search" };
  public static final String[] SECURITY_ATTRIBUTES = { WikiPage.SECURE_READ,
    WikiPage.SECURE_WRITE, WikiPage.SECURE_TEST };
  public static final String IGNORED = "Any";
  public static final String SECURITY = "Security";
  public static final String ACTION = "Action";
  public static final String PAGE_TYPE = "PageType";

  public Response makeResponse(FitNesseContext context, Request request)
  throws Exception {
    SimpleResponse response = new SimpleResponse();

    VelocityContext velocityContext = new VelocityContext();

    StringWriter writer = new StringWriter();

    Template template = context.getVelocityEngine()
    .getTemplate("searchForm.vm");

    velocityContext.put("pageTitle", new PageTitle("Search Form"));
    velocityContext.put("pageTypeAttributes", PAGE_TYPE_ATTRIBUTES);
    velocityContext.put("actionAttributes", ACTION_ATTRIBUTES);
    velocityContext.put("securityAttributes", SECURITY_ATTRIBUTES);
    velocityContext.put("searchedRootPage", request.getResource());
    velocityContext.put("request", request);

    template.merge(velocityContext, writer);
    response.setContent(writer.toString());

    return response;
  }
{'fraction_non_alphanumeric': 0.0996185775185102, 'fraction_numerical': 0.004487323311644604, 'mean_word_length': 5.6240713224368495, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '6342204', 'n_tokens_mistral': 1286, 'n_tokens_neox': 1224, 'n_words': 328}