<commit_before>package template.java;

import java.sql.Types;
import java.util.List;

import jdbc.ColumnInfo;
import jdbc.TableInfo;
import other.Utils;
import template.API;

public class JavaAPI implements API {

	@Override
	public String getClassImport(List<String> className) {
		StringBuilder result = new StringBuilder();
		
		result.append("import java.io.*;\r\n");
		result.append("import java.sql.*;\r\n");
		result.append("import java.util.*;\r\n");
		result.append("import javax.servlet.http.*;\r\n");
		result.append("import javax.servlet.ServletException;\r\n");
		result.append("import javax.servlet.annotation.WebServlet;\r\n");
		
		for (String temp: className){
			result.append(temp + ";\r\n");
		}
		
		return result.toString();
	}

	@Override
	public String getClassHeader(String className) {
		StringBuilder result = new StringBuilder();
		className = Utils.formatFileName(className);
		
		result.append("@WebServlet(\"/" + className + "\") \r\n");
		result.append("public class " + className + " extends HttpServlet { \r\n");
		result.append("\t");
		result.append("private static final long serialVersionUID = 1L;");
		
		return result.toString();
	}

	@Override
	public String getClassConstructor(String className) {
		return "public " + Utils.formatFileName(className) + "(){ super(); }";
	}

	@Override
	public String getDoGetMethod(String pojoName, String daoName, TableInfo tableInfo) {
		StringBuilder result = new StringBuilder();
		
		result.append("protected void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException { \r\n");
		result.append("\t\t");
		result.append("HttpSession session = request.getSession(); \r\n");
		result.append("\t\t");
		result.append("Connection  conn    = null; \r\n");
		result.append("\t\t");
		result.append(pojoName + " pojo = getPOJO(request); \r\n");
		result.append("\t\t");
		result.append(daoName  + " dao = new " + daoName + "(); \r\n");
		result.append("\t\t");
		result.append("String result = \"\"; \r\n");
		result.append("\t\t");
		result.append("if (\"\".equals(result)){ \r\n");
		result.append("\t\t\t");
		result.append("result = dao.checkSearchPOJO(pojo);  \r\n");
		result.append("\t\t\t");
		result.append("request.setAttribute(\"List\", dao.search(pojo, conn)); \r\n");
		result.append("\t\t");
		result.append("} else{ \r\n");
		result.append("\t\t\t");
		result.append("request.setAttribute(\"result\", result); \r\n");
		result.append("\t\t");
		result.append("} \r\n");
		result.append("\t\t");
		result.append("request.getRequestDispatcher(\"WEB-INF/" + tableInfo.getTableName() + ".jsp\").forward(request, response); \r\n");
		result.append("\t");
		result.append("}");
		<commit_msg>Solve Bug<commit_after>package template.java;

import java.sql.Types;
import java.util.List;

import jdbc.ColumnInfo;
import jdbc.TableInfo;
import other.Utils;
import template.API;

public class JavaAPI implements API {

	@Override
	public String getClassImport(List<String> className) {
		StringBuilder result = new StringBuilder();
		
		result.append("import java.io.*;\r\n");
		result.append("import java.sql.*;\r\n");
		result.append("import java.util.*;\r\n");
		result.append("import javax.servlet.http.*;\r\n");
		result.append("import javax.servlet.ServletException;\r\n");
		result.append("import javax.servlet.annotation.WebServlet;\r\n");
		
		for (String temp: className){
			result.append(temp + ";\r\n");
		}
		
		return result.toString();
	}

	@Override
	public String getClassHeader(String className) {
		StringBuilder result = new StringBuilder();
		className = Utils.formatFileName(className);
		
		result.append("@WebServlet(\"/" + className + "\") \r\n");
		result.append("public class " + className + " extends HttpServlet { \r\n");
		result.append("\t");
		result.append("private static final long serialVersionUID = 1L;");
		
		return result.toString();
	}

	@Override
	public String getClassConstructor(String className) {
		return "public " + Utils.formatFileName(className) + "(){ super(); }";
	}

	@Override
	public String getDoGetMethod(String pojoName, String daoName, TableInfo tableInfo) {
		StringBuilder result = new StringBuilder();
		
		result.append("protected void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException { \r\n");
		result.append("\t\t");
		result.append("HttpSession session = request.getSession(); \r\n");
		result.append("\t\t");
		result.append("Connection  conn    = null; \r\n");
		result.append("\t\t");
		result.append(pojoName + " pojo = getPOJO(request); \r\n");
		result.append("\t\t");
		result.append(daoName  + " dao = new " + daoName + "(); \r\n");
		result.append("\t\t");
		result.append("String result = \"\"; \r\n");
		result.append("\t\t");
		result.append("result = dao.checkSearchPOJO(pojo);  \r\n");
		result.append("\t\t");
		result.append("if (\"\".equals(result)){ \r\n");
		result.append("\t\t\t");
		result.append("request.setAttribute(\"List\", dao.search(pojo, conn)); \r\n");
		result.append("\t\t");
		result.append("} else{ \r\n");
		result.append("\t\t\t");
		result.append("request.setAttribute(\"result\", result); \r\n");
		result.append("\t\t");
		result.append("} \r\n");
		result.append("\t\t");
		result.append("request.getRequestDispatcher(\"WEB-INF/" + tableInfo.getTableName() + ".jsp\").forward(request, response); \r\n");
		result.append("\t");
		result.append("}");
		
{'fraction_non_alphanumeric': 0.1951802796173657, 'fraction_numerical': 0.0003679175864606328, 'mean_word_length': 4.28377065111759, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 5, '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': '5537382', 'n_tokens_mistral': 1901, 'n_tokens_neox': 1758, 'n_words': 333}