<commit_before>package ch.sportchef.business.user.boundary;

import ch.sportchef.business.user.entity.User;

import javax.validation.Valid;
import javax.ws.rs.DELETE;
import javax.ws.rs.GET;
import javax.ws.rs.NotFoundException;
import javax.ws.rs.PUT;
import javax.ws.rs.core.Context;
import javax.ws.rs.core.Response;
import javax.ws.rs.core.UriInfo;
import java.net.URI;

public class UserResource {

    private long userId;
    private UserManager manager;

    public UserResource(final long userId, final UserManager manager) {
        this.userId = userId;
        this.manager = manager;
    }

    @GET
    public User find() {
        final User user = this.manager.findByUserId(this.userId);
        if (user == null) {
            throw new NotFoundException(String.format("user with id '%d' not found", userId));
        }
        return user;
    }

    @PUT
    public Response update(@Valid final User user, @Context final UriInfo info) {
        find(); // only update existing users
        user.setUserId(this.userId);
        final User updatedUser = this.manager.save(user);
        final URI uri = info.getAbsolutePathBuilder().build();
        return Response.ok().header("Location", uri.toString()).build();
    }

    @DELETE
    public Response delete() {
        final User user = find(); // only delete existing users
        this.manager.delete(user.getUserId());
        return Response.noContent().build();
    }
<commit_msg>response after updating an user should contain the updated user data closes #19<commit_after>package ch.sportchef.business.user.boundary;

import ch.sportchef.business.user.entity.User;

import javax.validation.Valid;
import javax.ws.rs.DELETE;
import javax.ws.rs.GET;
import javax.ws.rs.NotFoundException;
import javax.ws.rs.PUT;
import javax.ws.rs.core.Context;
import javax.ws.rs.core.Response;
import javax.ws.rs.core.UriInfo;
import java.net.URI;

public class UserResource {

    private long userId;
    private UserManager manager;

    public UserResource(final long userId, final UserManager manager) {
        this.userId = userId;
        this.manager = manager;
    }

    @GET
    public User find() {
        final User user = this.manager.findByUserId(this.userId);
        if (user == null) {
            throw new NotFoundException(String.format("user with id '%d' not found", userId));
        }
        return user;
    }

    @PUT
    public Response update(@Valid final User user, @Context final UriInfo info) {
        find(); // only update existing users
        user.setUserId(this.userId);
        final User updatedUser = this.manager.save(user);
        final URI uri = info.getAbsolutePathBuilder().build();
        return Response.ok(updatedUser).header("Location", uri.toString()).build();
    }

    @DELETE
    public Response delete() {
        final User user = find(); // only delete existing users
        this.manager.delete(user.getUserId());
        return Response.noContent().build();
    }

{'fraction_non_alphanumeric': 0.11400869274490137, 'fraction_numerical': 0.0006686726847208291, 'mean_word_length': 2.9420289855072466, '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': '1565482', 'n_tokens_mistral': 845, 'n_tokens_neox': 848, 'n_words': 226}