Program: 145787
Project: 145787
Buggy source:
public void doPost(HttpServletRequest request,HttpServletResponse response) throws ServletException, IOException {
  HttpSession session=request.getSession(false);
  if (null == session) {
    response.sendRedirect(SnipLink.absoluteLink(request,"String_Node_Str"));
    return;
  }
  Map errors=new HashMap();
  session.removeAttribute("String_Node_Str");
  Configuration serverConfig=(Configuration)session.getAttribute(CommandHandler.ATT_CONFIG);
  User admin=(User)session.getAttribute(CommandHandler.ATT_ADMIN);
  if (null == serverConfig || (serverConfig.getAdminLogin() != null && admin == null)) {
    response.sendRedirect(SnipLink.absoluteLink(request,"String_Node_Str"));
    return;
  }
  AppConfiguration config=new AppConfiguration();
  session.setAttribute("String_Node_Str",config);
  PrintWriter out=new PrintWriter(System.out);
  writeMessage(out,"String_Node_Str");
  String tagline=request.getParameter("String_Node_Str");
  config.setTagLine(tagline != null && tagline.length() > 0 ? tagline : "String_Node_Str");
  String logo=request.getParameter("String_Node_Str");
  if (logo != null && logo.length() > 0) {
    config.setLogoImage(logo);
  }
  config.setLogger("String_Node_Str");
  config.setProperty(AppConfiguration.APP_CACHE,"String_Node_Str");
  config.setProperty(AppConfiguration.APP_TIMEZONE,"String_Node_Str");
  config.setProperty(AppConfiguration.APP_WEBLOG_DATE_FORMAT,"String_Node_Str");
  config.setProperty(AppConfiguration.APP_PERM + "String_Node_Str" + AppConfiguration.PERM_WEBLOGS_PING,"String_Node_Str");
  writeMessage(out,"String_Node_Str");
  String appName=request.getParameter("String_Node_Str");
  if (null == appName || appName.length() == 0) {
    System.err.println("String_Node_Str");
    errors.put("String_Node_Str","String_Node_Str");
  }
  config.setName(appName != null ? appName : "String_Node_Str");
  writeMessage(out,"String_Node_Str");
  String adminName=request.getParameter("String_Node_Str");
  if (!checkUserName(adminName)) {
    System.err.println("String_Node_Str");
    errors.put("String_Node_Str","String_Node_Str");
  }
 else {
    config.setAdminLogin(adminName);
  }
  config.setAdminEmail(request.getParameter("String_Node_Str"));
  String password=request.getParameter("String_Node_Str");
  String password2=request.getParameter("String_Node_Str");
  if (!checkPassword(password,password2)) {
    System.err.println("String_Node_Str");
    errors.put("String_Node_Str","String_Node_Str");
  }
 else {
    config.setAdminPassword(password);
  }
  writeMessage(out,"String_Node_Str");
  config.setHost(request.getParameter("String_Node_Str"));
  try {
    config.setPort(Integer.parseInt(request.getParameter("String_Node_Str")));
  }
 catch (  NumberFormatException e) {
    System.err.println("String_Node_Str" + request.getParameter("String_Node_Str") + "String_Node_Str");
    errors.put("String_Node_Str","String_Node_Str" + request.getParameter("String_Node_Str") + "String_Node_Str");
  }
  String context=request.getParameter("String_Node_Str");
  if (context != null) {
    if (context.length() > 1 && !context.startsWith("String_Node_Str")) {
      context="String_Node_Str" + context;
    }
    if (context.endsWith("String_Node_Str")) {
      context=context.substring(0,context.length() - 2);
    }
    config.setContextPath(context);
  }
  if (errors.size() != 0) {
    sendError(session,errors,request,response);
    return;
  }
  InetAddrPort addrPort=new InetAddrPort();
  try {
    String host=config.getHost();
    if (host != null && host.length() > 0) {
      addrPort.setHost(host);
    }
 else {
      addrPort.setHost(InetAddrPort.__0_0_0_0);
    }
    addrPort.setPort(config.getPort());
  }
 catch (  UnknownHostException e) {
    System.err.println("String_Node_Str" + e);
    errors.put("String_Node_Str","String_Node_Str");
    sendError(session,errors,request,response);
    return;
  }
  String autoUrl=request.getParameter("String_Node_Str");
  config.setAutoUrl(autoUrl != null ? "String_Node_Str" : "String_Node_Str");
  String domain=request.getParameter("String_Node_Str");
  if (domain != null) {
    config.setUrl(domain);
  }
  String mailhost=request.getParameter("String_Node_Str");
  if (mailhost != null) {
    config.setMailHost(mailhost);
  }
 else {
    writeMessage(out,"String_Node_Str");
  }
  String maildomain=request.getParameter("String_Node_Str");
  if (maildomain != null) {
    config.setMailDomain(maildomain);
  }
  File webAppRoot=new File(serverConfig.getProperty(Configuration.WEBAPP_ROOT) + "String_Node_Str" + normalize(config.getName()));
  writeMessage(out,"String_Node_Str");
  if (!webAppRoot.mkdirs()) {
    System.err.println("String_Node_Str");
    errors.put("String_Node_Str","String_Node_Str" + webAppRoot);
    sendError(session,errors,request,response);
    return;
  }
  File webInf=new File(webAppRoot,"String_Node_Str");
  webInf.mkdir();
  File dbDir=new File(webInf,"String_Node_Str");
  dbDir.mkdir();
  File logDir=new File(webInf,"String_Node_Str");
  logDir.mkdir();
  writeMessage(out,"String_Node_Str");
  try {
    Checksum checksum=JarUtil.extract(new JarFile("String_Node_Str",true),webAppRoot);
    checksum.store(new File(webInf,"String_Node_Str"));
  }
 catch (  IOException e) {
    System.err.println("String_Node_Str" + e);
    errors.put("String_Node_Str","String_Node_Str");
    sendError(session,errors,request,response);
    return;
  }
  String theme=request.getParameter("String_Node_Str");
  if (theme == null || theme.length() == 0) {
    errors.put("String_Node_Str","String_Node_Str");
    sendError(session,errors,request,response);
  }
  if (theme != null && theme.length() != 0) {
    config.setProperty(AppConfiguration.APP_THEME,"String_Node_Str" + theme);
    writeMessage(out,"String_Node_Str");
    try {
      JarFile themeJar=new JarFile("String_Node_Str" + theme + "String_Node_Str",true);
      Checksum checksum=JarUtil.checksumJar(themeJar);
      Set files=checksum.getFileNames();
      List install=new ArrayList();
      Iterator it=files.iterator();
      while (it.hasNext()) {
        String name=(String)it.next();
        if (name != null && (name.startsWith("String_Node_Str") || name.startsWith("String_Node_Str"))) {
          install.add(name);
        }
      }
      JarUtil.extract(themeJar,webAppRoot,install,null);
      install=Arrays.asList(new Object[]{theme + "String_Node_Str"});
      JarUtil.extract(themeJar,webInf,install,null);
      checksum.store(new File(webInf,"String_Node_Str"));
    }
 catch (    IOException e) {
      System.err.println("String_Node_Str" + e);
      errors.put("String_Node_Str","String_Node_Str");
      sendError(session,errors,request,response);
      return;
    }
  }
  Application app=Application.getInstance(session);
  System.out.println("String_Node_Str" + app);
  app.setConfiguration(config);
  writeMessage(out,"String_Node_Str");
  config.setFile(new File(webInf.getAbsoluteFile(),"String_Node_Str"));
  writeMessage(out,"String_Node_Str");
  boolean useMcKoi=request.getParameter("String_Node_Str") != null ? true : false;
  String jdbcURL=request.getParameter("String_Node_Str");
  String jdbcDrv=request.getParameter("String_Node_Str");
  if (useMcKoi || jdbcURL == null || jdbcURL.length() == 0) {
    useMcKoi=true;
    File dbConfFile=new File(webInf,"String_Node_Str");
    MckoiEmbeddedJDBCDriver.register();
    jdbcURL=MckoiEmbeddedJDBCDriver.MCKOI_PREFIX + dbConfFile.getPath();
    jdbcDrv="String_Node_Str";
    config.setJDBCURL(jdbcURL + "String_Node_Str");
    config.setJDBCDriver(jdbcDrv);
    try {
      Properties dbConf=new Properties();
      dbConf.load(new FileInputStream("String_Node_Str"));
      dbConf.store(new FileOutputStream(dbConfFile),"String_Node_Str" + config.getName());
      CreateDB.createDB(config);
    }
 catch (    IOException e) {
      System.err.println("String_Node_Str" + e);
      errors.put("String_Node_Str","String_Node_Str");
      sendError(session,errors,request,response);
      return;
    }
    config.setJDBCURL(jdbcURL);
  }
 else {
    config.setJDBCURL(jdbcURL);
    config.setJDBCDriver(jdbcDrv);
    CreateDB.createDB(config);
  }
  writeMessage(out,"String_Node_Str");
  CreateDB.createAdmin(config);
  CreateDB.insertData(config,new FileInputStream("String_Node_Str"));
  CreateDB.postFirst(config);
  File themeSnip=new File(webInf,theme + "String_Node_Str");
  if (themeSnip.exists()) {
    writeMessage(out,"String_Node_Str" + theme);
    CreateDB.insertData(config,new FileInputStream(themeSnip));
  }
  if (useMcKoi) {
    try {
      MckoiEmbeddedJDBCDriver.deregister();
    }
 catch (    SQLException e) {
      System.err.println("String_Node_Str" + e);
    }
  }
  config.store();
  writeMessage(out,"String_Node_Str");
  Thread thread=Thread.currentThread();
  ClassLoader currentClassLoader=thread.getContextClassLoader();
  try {
    thread.setContextClassLoader(currentClassLoader.getParent());
    ApplicationLoader.loadApplication(config);
  }
 catch (  Exception e) {
    System.err.println("String_Node_Str" + e);
    e.printStackTrace();
    errors.put("String_Node_Str","String_Node_Str" + e);
    sendError(session,errors,request,response);
    return;
  }
 finally {
    thread.setContextClassLoader(currentClassLoader);
  }
  if (serverConfig.getAdminLogin() == null && serverConfig.getAdminPassword() == null) {
    System.out.println("String_Node_Str" + config.getAdminLogin());
    serverConfig.setAdminLogin(config.getAdminLogin());
    serverConfig.setAdminPassword(config.getAdminPassword());
    serverConfig.setAdminEmail(config.getAdminEmail());
    serverConfig.store();
  }
  writeMessage(out,"String_Node_Str");
  session.removeAttribute("String_Node_Str");
  String url=config.getUrl();
  System.out.println("String_Node_Str" + url);
  response.sendRedirect(url);
}

Fixed version (ground truth):
public void doPost(HttpServletRequest request,HttpServletResponse response) throws ServletException, IOException {
  HttpSession session=request.getSession(false);
  if (null == session) {
    response.sendRedirect(SnipLink.absoluteLink(request,"String_Node_Str"));
    return;
  }
  Map errors=new HashMap();
  session.removeAttribute("String_Node_Str");
  Configuration serverConfig=(Configuration)session.getAttribute(CommandHandler.ATT_CONFIG);
  User admin=(User)session.getAttribute(CommandHandler.ATT_ADMIN);
  if (null == serverConfig || (serverConfig.getAdminLogin() != null && admin == null)) {
    response.sendRedirect(SnipLink.absoluteLink(request,"String_Node_Str"));
    return;
  }
  AppConfiguration config=new AppConfiguration();
  session.setAttribute("String_Node_Str",config);
  PrintWriter out=new PrintWriter(System.out);
  writeMessage(out,"String_Node_Str");
  String tagline=request.getParameter("String_Node_Str");
  config.setTagLine(tagline != null && tagline.length() > 0 ? tagline : "String_Node_Str");
  String logo=request.getParameter("String_Node_Str");
  if (logo != null && logo.length() > 0) {
    config.setLogoImage(logo);
  }
  config.setLogger("String_Node_Str");
  config.setProperty(AppConfiguration.APP_CACHE,"String_Node_Str");
  config.setProperty(AppConfiguration.APP_TIMEZONE,"String_Node_Str");
  config.setProperty(AppConfiguration.APP_WEBLOG_DATE_FORMAT,"String_Node_Str");
  if (request.getParameter("String_Node_Str") != null) {
    config.setProperty(AppConfiguration.APP_PERM + "String_Node_Str" + AppConfiguration.PERM_WEBLOGS_PING,"String_Node_Str");
  }
 else {
    config.setProperty(AppConfiguration.APP_PERM + "String_Node_Str" + AppConfiguration.PERM_WEBLOGS_PING,"String_Node_Str");
  }
  writeMessage(out,"String_Node_Str");
  String appName=request.getParameter("String_Node_Str");
  if (null == appName || appName.length() == 0) {
    System.err.println("String_Node_Str");
    errors.put("String_Node_Str","String_Node_Str");
  }
  config.setName(appName != null ? appName : "String_Node_Str");
  writeMessage(out,"String_Node_Str");
  String adminName=request.getParameter("String_Node_Str");
  if (!checkUserName(adminName)) {
    System.err.println("String_Node_Str");
    errors.put("String_Node_Str","String_Node_Str");
  }
 else {
    config.setAdminLogin(adminName);
  }
  config.setAdminEmail(request.getParameter("String_Node_Str"));
  String password=request.getParameter("String_Node_Str");
  String password2=request.getParameter("String_Node_Str");
  if (!checkPassword(password,password2)) {
    System.err.println("String_Node_Str");
    errors.put("String_Node_Str","String_Node_Str");
  }
 else {
    config.setAdminPassword(password);
  }
  writeMessage(out,"String_Node_Str");
  config.setHost(request.getParameter("String_Node_Str"));
  try {
    config.setPort(Integer.parseInt(request.getParameter("String_Node_Str")));
  }
 catch (  NumberFormatException e) {
    System.err.println("String_Node_Str" + request.getParameter("String_Node_Str") + "String_Node_Str");
    errors.put("String_Node_Str","String_Node_Str" + request.getParameter("String_Node_Str") + "String_Node_Str");
  }
  String context=request.getParameter("String_Node_Str");
  if (context != null) {
    if (context.length() > 1 && !context.startsWith("String_Node_Str")) {
      context="String_Node_Str" + context;
    }
    if (context.endsWith("String_Node_Str")) {
      context=context.substring(0,context.length() - 2);
    }
    config.setContextPath(context);
  }
  if (errors.size() != 0) {
    sendError(session,errors,request,response);
    return;
  }
  InetAddrPort addrPort=new InetAddrPort();
  try {
    String host=config.getHost();
    if (host != null && host.length() > 0) {
      addrPort.setHost(host);
    }
 else {
      addrPort.setHost(InetAddrPort.__0_0_0_0);
    }
    addrPort.setPort(config.getPort());
  }
 catch (  UnknownHostException e) {
    System.err.println("String_Node_Str" + e);
    errors.put("String_Node_Str","String_Node_Str");
    sendError(session,errors,request,response);
    return;
  }
  String autoUrl=request.getParameter("String_Node_Str");
  config.setAutoUrl(autoUrl != null ? "String_Node_Str" : "String_Node_Str");
  String domain=request.getParameter("String_Node_Str");
  if (domain != null) {
    config.setUrl(domain);
  }
  String mailhost=request.getParameter("String_Node_Str");
  if (mailhost != null) {
    config.setMailHost(mailhost);
  }
 else {
    writeMessage(out,"String_Node_Str");
  }
  String maildomain=request.getParameter("String_Node_Str");
  if (maildomain != null) {
    config.setMailDomain(maildomain);
  }
  File webAppRoot=new File(serverConfig.getProperty(Configuration.WEBAPP_ROOT) + "String_Node_Str" + normalize(config.getName()));
  writeMessage(out,"String_Node_Str");
  if (!webAppRoot.mkdirs()) {
    System.err.println("String_Node_Str");
    errors.put("String_Node_Str","String_Node_Str" + webAppRoot);
    sendError(session,errors,request,response);
    return;
  }
  File webInf=new File(webAppRoot,"String_Node_Str");
  webInf.mkdir();
  File dbDir=new File(webInf,"String_Node_Str");
  dbDir.mkdir();
  File logDir=new File(webInf,"String_Node_Str");
  logDir.mkdir();
  writeMessage(out,"String_Node_Str");
  try {
    Checksum checksum=JarUtil.extract(new JarFile("String_Node_Str",true),webAppRoot);
    checksum.store(new File(webInf,"String_Node_Str"));
  }
 catch (  IOException e) {
    System.err.println("String_Node_Str" + e);
    errors.put("String_Node_Str","String_Node_Str");
    sendError(session,errors,request,response);
    return;
  }
  String theme=request.getParameter("String_Node_Str");
  if (theme == null || theme.length() == 0) {
    errors.put("String_Node_Str","String_Node_Str");
    sendError(session,errors,request,response);
  }
  if (theme != null && theme.length() != 0) {
    config.setProperty(AppConfiguration.APP_THEME,"String_Node_Str" + theme);
    writeMessage(out,"String_Node_Str");
    try {
      JarFile themeJar=new JarFile("String_Node_Str" + theme + "String_Node_Str",true);
      Checksum checksum=JarUtil.checksumJar(themeJar);
      Set files=checksum.getFileNames();
      List install=new ArrayList();
      Iterator it=files.iterator();
      while (it.hasNext()) {
        String name=(String)it.next();
        if (name != null && (name.startsWith("String_Node_Str") || name.startsWith("String_Node_Str"))) {
          install.add(name);
        }
      }
      JarUtil.extract(themeJar,webAppRoot,install,null);
      install=Arrays.asList(new Object[]{theme + "String_Node_Str"});
      JarUtil.extract(themeJar,webInf,install,null);
      checksum.store(new File(webInf,"String_Node_Str"));
    }
 catch (    IOException e) {
      System.err.println("String_Node_Str" + e);
      errors.put("String_Node_Str","String_Node_Str");
      sendError(session,errors,request,response);
      return;
    }
  }
  Application app=Application.getInstance(session);
  System.out.println("String_Node_Str" + app);
  app.setConfiguration(config);
  writeMessage(out,"String_Node_Str");
  config.setFile(new File(webInf.getAbsoluteFile(),"String_Node_Str"));
  writeMessage(out,"String_Node_Str");
  boolean useMcKoi=request.getParameter("String_Node_Str") != null ? true : false;
  String jdbcURL=request.getParameter("String_Node_Str");
  String jdbcDrv=request.getParameter("String_Node_Str");
  if (useMcKoi || jdbcURL == null || jdbcURL.length() == 0) {
    useMcKoi=true;
    File dbConfFile=new File(webInf,"String_Node_Str");
    MckoiEmbeddedJDBCDriver.register();
    jdbcURL=MckoiEmbeddedJDBCDriver.MCKOI_PREFIX + dbConfFile.getPath();
    jdbcDrv="String_Node_Str";
    config.setJDBCURL(jdbcURL + "String_Node_Str");
    config.setJDBCDriver(jdbcDrv);
    try {
      Properties dbConf=new Properties();
      dbConf.load(new FileInputStream("String_Node_Str"));
      dbConf.store(new FileOutputStream(dbConfFile),"String_Node_Str" + config.getName());
      CreateDB.createDB(config);
    }
 catch (    IOException e) {
      System.err.println("String_Node_Str" + e);
      errors.put("String_Node_Str","String_Node_Str");
      sendError(session,errors,request,response);
      return;
    }
    config.setJDBCURL(jdbcURL);
  }
 else {
    config.setJDBCURL(jdbcURL);
    config.setJDBCDriver(jdbcDrv);
    CreateDB.createDB(config);
  }
  writeMessage(out,"String_Node_Str");
  CreateDB.createAdmin(config);
  CreateDB.insertData(config,new FileInputStream("String_Node_Str"));
  CreateDB.postFirst(config);
  File themeSnip=new File(webInf,theme + "String_Node_Str");
  if (themeSnip.exists()) {
    writeMessage(out,"String_Node_Str" + theme);
    CreateDB.insertData(config,new FileInputStream(themeSnip));
  }
  if (useMcKoi) {
    try {
      MckoiEmbeddedJDBCDriver.deregister();
    }
 catch (    SQLException e) {
      System.err.println("String_Node_Str" + e);
    }
  }
  config.store();
  writeMessage(out,"String_Node_Str");
  Thread thread=Thread.currentThread();
  ClassLoader currentClassLoader=thread.getContextClassLoader();
  try {
    thread.setContextClassLoader(currentClassLoader.getParent());
    ApplicationLoader.loadApplication(config);
  }
 catch (  Exception e) {
    System.err.println("String_Node_Str" + e);
    e.printStackTrace();
    errors.put("String_Node_Str","String_Node_Str" + e);
    sendError(session,errors,request,response);
    return;
  }
 finally {
    thread.setContextClassLoader(currentClassLoader);
  }
  if (serverConfig.getAdminLogin() == null && serverConfig.getAdminPassword() == null) {
    System.out.println("String_Node_Str" + config.getAdminLogin());
    serverConfig.setAdminLogin(config.getAdminLogin());
    serverConfig.setAdminPassword(config.getAdminPassword());
    serverConfig.setAdminEmail(config.getAdminEmail());
    serverConfig.store();
  }
  writeMessage(out,"String_Node_Str");
  session.removeAttribute("String_Node_Str");
  String url=config.getUrl();
  System.out.println("String_Node_Str" + url);
  response.sendRedirect(url);
}