<commit_before>package com.intellij.appengine.server.run;

import com.intellij.appengine.sdk.AppEngineSdk;
import com.intellij.appengine.server.instance.AppEngineServerModel;
import com.intellij.appengine.server.integration.AppEngineServerData;
import com.intellij.execution.ExecutionException;
import com.intellij.execution.configurations.JavaParameters;
import com.intellij.execution.configurations.ParametersList;
import com.intellij.javaee.run.configuration.CommonModel;
import com.intellij.javaee.run.configuration.JavaCommandLineStartupPolicy;
import com.intellij.openapi.projectRoots.Sdk;
import com.intellij.openapi.roots.ProjectRootManager;
import com.intellij.openapi.util.SystemInfo;
import com.intellij.openapi.util.io.FileUtil;
import com.intellij.openapi.util.text.StringUtil;
import com.intellij.packaging.artifacts.Artifact;

import java.io.File;

/**
 * @author nik
 */
public class AppEngineServerStartupPolicy implements JavaCommandLineStartupPolicy {
  public JavaParameters createCommandLine(CommonModel commonModel) throws ExecutionException {
    final AppEngineServerData data = (AppEngineServerData)commonModel.getApplicationServer().getPersistentData();
    final AppEngineSdk sdk = data.getSdk();
    if (StringUtil.isEmpty(sdk.getSdkHomePath())) {
      throw new ExecutionException("Path to App Engine SDK isn't specified");
    }
    final File toolsApiJarFile = sdk.getToolsApiJarFile();
    if (!toolsApiJarFile.exists()) {
      throw new ExecutionException("'" + sdk.getSdkHomePath() + "' isn't valid App Engine SDK installation: '" + toolsApiJarFile.getAbsolutePath() + "' not found"); 
    }
    final JavaParameters javaParameters = new JavaParameters();
    javaParameters.getClassPath().add(toolsApiJarFile.getAbsolutePath());
    javaParameters.setMainClass("com.google.appengine.tools.development.DevAppServerMain");

    final AppEngineServerModel serverModel = (AppEngineServerModel) commonModel.getServerModel();
    final Artifact artifact = serverModel.getArtifact();
    if (artifact == null) {
      throw new ExecutionException("Artifact isn't specified");
    }
    final Sdk jdk = ProjectRootManager.getInstance(commonModel.getProject()).getProjectJdk();
    if (jdk == null) {
      throw new ExecutionException("JDK isn't specified for the project");
    }
    javaParameters.setJdk(jdk);

    final ParametersList parameters = javaParameters.getProgramParametersList();
    parameters.addParametersString(serverModel.getServerParameters());
    parameters.replaceOrAppend("-p", "");
    parameters.replaceOrAppend("--port", "");
    parameters.add("-p", String.valueOf(serverModel.getLocalPort()));
    parameters.add("--disable_update_check");
<commit_msg>jdk->sdk rename refactoring<commit_after>package com.intellij.appengine.server.run;

import com.intellij.appengine.sdk.AppEngineSdk;
import com.intellij.appengine.server.instance.AppEngineServerModel;
import com.intellij.appengine.server.integration.AppEngineServerData;
import com.intellij.execution.ExecutionException;
import com.intellij.execution.configurations.JavaParameters;
import com.intellij.execution.configurations.ParametersList;
import com.intellij.javaee.run.configuration.CommonModel;
import com.intellij.javaee.run.configuration.JavaCommandLineStartupPolicy;
import com.intellij.openapi.projectRoots.Sdk;
import com.intellij.openapi.roots.ProjectRootManager;
import com.intellij.openapi.util.SystemInfo;
import com.intellij.openapi.util.io.FileUtil;
import com.intellij.openapi.util.text.StringUtil;
import com.intellij.packaging.artifacts.Artifact;

import java.io.File;

/**
 * @author nik
 */
public class AppEngineServerStartupPolicy implements JavaCommandLineStartupPolicy {
  public JavaParameters createCommandLine(CommonModel commonModel) throws ExecutionException {
    final AppEngineServerData data = (AppEngineServerData)commonModel.getApplicationServer().getPersistentData();
    final AppEngineSdk sdk = data.getSdk();
    if (StringUtil.isEmpty(sdk.getSdkHomePath())) {
      throw new ExecutionException("Path to App Engine SDK isn't specified");
    }
    final File toolsApiJarFile = sdk.getToolsApiJarFile();
    if (!toolsApiJarFile.exists()) {
      throw new ExecutionException("'" + sdk.getSdkHomePath() + "' isn't valid App Engine SDK installation: '" + toolsApiJarFile.getAbsolutePath() + "' not found"); 
    }
    final JavaParameters javaParameters = new JavaParameters();
    javaParameters.getClassPath().add(toolsApiJarFile.getAbsolutePath());
    javaParameters.setMainClass("com.google.appengine.tools.development.DevAppServerMain");

    final AppEngineServerModel serverModel = (AppEngineServerModel) commonModel.getServerModel();
    final Artifact artifact = serverModel.getArtifact();
    if (artifact == null) {
      throw new ExecutionException("Artifact isn't specified");
    }
    final Sdk jdk = ProjectRootManager.getInstance(commonModel.getProject()).getProjectSdk();
    if (jdk == null) {
      throw new ExecutionException("JDK isn't specified for the project");
    }
    javaParameters.setJdk(jdk);

    final ParametersList parameters = javaParameters.getProgramParametersList();
    parameters.addParametersString(serverModel.getServerParameters());
    parameters.replaceOrAppend("-p", "");
    parameters.replaceOrAppend("--port", "");
    parameters.add("-p", String.valueOf(serverModel.getLocalPort()));
    parameters.add("--disable_update_check");

{'fraction_non_alphanumeric': 0.10963944076526858, 'fraction_numerical': 0.0, 'mean_word_length': 5.712345679012346, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 4, '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': '4560864', 'n_tokens_mistral': 1569, 'n_tokens_neox': 1541, 'n_words': 268}