[Demonstration 1]

[Buggy Method]
public static Result service(String ownerName, String projectName, String service, boolean isAdvertise) throws IOException, UnsupportedOperationException, ServletException {
    if (!isSupportedService(service)) {
        return forbidden(String.format("Unsupported service: '%s'", service));
    }
    Project project = Project.findByOwnerAndProjectName(ownerName, projectName);
    if (project == null) {
        return notFound();
    }
    models.User user = UserApp.currentUser();
    if (!isAllowed(project, service)) {
        if (user.isAnonymous()) {
            return BasicAuthAction.unauthorized(response());
        } else {
            // If you want the Git client showing your custom message to
            // the user, the Content-Type should be exact "text/plain"
            // without any parameter. For more details, see the code at
            // https://github.com/git/git/commit/426e70d4a11ce3b4f70636d57c6a0ab16ae08a00#diff-eea0ad565ec5903a11b6023755d491cfR154
            response().setHeader("Content-Type", "text/plain");
            return forbidden(String.format("'%s' has no permission to '%s/%s'.", user.name, ownerName, projectName));
        }
    }
    if (isAdvertise) {
        return ok(RepositoryService.gitAdvertise(project, service, response()));
    } else {
        if (request().body().isMaxSizeExceeded()) {
            return status(REQUEST_ENTITY_TOO_LARGE);
        } else {
            user.visits(project);
            return ok(RepositoryService.gitRpc(project, service, request(), response()));
        }
    }
}

[Buggy Hunk]
user.name, ownerName, projectName));

[Patch]
user.loginId, ownerName, projectName));

[Demonstration 2]

[Buggy Method]
@ConsoleAction(description = "Create a new project")
public void create(@ConsoleParameter(name = "type", description = "the type of project example: web,webready,console") String type, @ConsoleParameter(name = "name", description = "the name of the project") String name, @ConsoleParameter(name = "package", description = "the package of new project") String pack, @ConsoleParameter(name = "path", description = " the folder where the was created.") String path) {
    properties.put(PROJECT_PACKAGE, pack);
    properties.put(PROJECT_NAME, name);
    properties.put(PROJECT_SOURCE, BASE_SOURCE_FOLDER);
    properties.put(PROJECT_IOC_PATH, BASE_IOC_FOLDER);
    properties.put(PROJECT_IOC_FILE, BASE_IOC_FILE);
    if (path == null || path == "")
        path = ".";
    File workingDir = new File(path);
    if (!workingDir.exists()) {
        log.error("Working path:" + path + " not exist");
        return;
    }
    File projectDir = new File(workingDir.getAbsolutePath() + "/" + name);
    if (projectDir.exists()) {
        log.error("Project directory:" + name + " already exist");
        return;
    }
    ProjectTypes projectTypes = Roma.component(ProjectTypes.class);
    List<ModuleData> modules = null;
    if (projectTypes != null) {
        modules = projectTypes.getModulesOfProject(type);
    }
    if (modules == null) {
        log.error("Project Type selected not exist");
        return;
    }
    projectDir.mkdir();
    try {
        properties.storeToXML(new FileOutputStream(projectDir.getAbsolutePath() + "/" + PROJECT_FILE_NAME), "");
    } catch (Exception e) {
        log.error("Error on write file:" + projectDir.getAbsolutePath() + "/" + PROJECT_FILE_NAME, e);
        return;
    }
    new File(projectDir.getAbsolutePath() + BASE_SOURCE_FOLDER + pack.replace('.', '/') + "/" + BASE_DOMAIN_FOLDER).mkdirs();
    ModuleManager m = new ModuleManager();
    m.initProjectDescriptor(projectDir, name, pack);
    for (ModuleData module : modules) {
        m.add(projectDir.getAbsolutePath(), module, properties);
    }
    File projectInstall = new File(PathHelper.getWizardPath() + "project-install/" + type);
    if (projectInstall.exists()) {
        ModuleManager.install(projectInstall, projectDir, properties);
    }
}

[Buggy Hunk]
if (path == null || path == "")

[Patch]
if (path == null || "".equals(path))

[Demonstration 3]

[Buggy Method]
protected void upgradeFileUploadsConfiguration() throws Exception {
    UserFileUploadsConfiguration defaultConfig = ConfigurableUtil.createConfigurable(UserFileUploadsConfiguration.class, new HashMapDictionary<>());
    Dictionary properties = new HashMapDictionary();
    properties.put("imageCheckToken", _prefsProps.getBoolean(_OLD_KEY_USERS_IMAGE_CHECK_TOKEN, defaultConfig.imageCheckToken()));
    properties.put("imageMaxHeight", _prefsProps.getInteger(_OLD_KEY_USERS_IMAGE_MAX_HEIGHT, defaultConfig.imageMaxHeight()));
    properties.put("imageMaxSize", _prefsProps.getLong(_OLD_KEY_USERS_IMAGE_MAX_SIZE, defaultConfig.imageMaxSize()));
    properties.put("imageMaxWidth", _prefsProps.getInteger(_OLD_KEY_USERS_IMAGE_MAX_WIDTH, defaultConfig.imageMaxWidth()));
    Configuration configuration = _configurationAdmin.getConfiguration(UserFileUploadsConfiguration.class.getName(), StringPool.QUESTION);
    configuration.update(properties);
    PortletPreferences portletPreferences = _prefsProps.getPreferences();
    portletPreferences.reset(_OLD_KEY_USERS_IMAGE_CHECK_TOKEN);
    portletPreferences.reset(_OLD_KEY_USERS_IMAGE_MAX_HEIGHT);
    portletPreferences.reset(_OLD_KEY_USERS_IMAGE_MAX_SIZE);
    portletPreferences.reset(_OLD_KEY_USERS_IMAGE_MAX_WIDTH);
}

[Buggy Hunk]
Dictionary properties = new HashMapDictionary();

[Patch]
Dictionary<String, Object> properties = new HashMapDictionary<>();