<commit_before>package br.usp.ime.choreos.nodepoolmanager;

import java.net.URI;
import java.net.URISyntaxException;
import java.util.ArrayList;
import java.util.List;

import javax.ws.rs.GET;
import javax.ws.rs.POST;
import javax.ws.rs.Path;
import javax.ws.rs.core.Response;

@Path("/nodes")
public class NodesResource {

    public static List<Node> nodes = new ArrayList<Node>();

    @GET
    public List<Node> getNodes() {
        return nodes;
    }

    @POST
    public Response createNode(Node node) throws URISyntaxException {
        node.setIp("fakeIp");
        node.setId((long) (Math.random() * 100000));
        nodes.add(node);
        return Response.created(new URI("/nodes/" + node.getId())).build();
    }

}<commit_msg>refactoring to use uribuilder instead of hardcoded url<commit_after>package br.usp.ime.choreos.nodepoolmanager;

import java.net.URISyntaxException;
import java.util.ArrayList;
import java.util.List;

import javax.ws.rs.GET;
import javax.ws.rs.POST;
import javax.ws.rs.Path;
import javax.ws.rs.core.Context;
import javax.ws.rs.core.Response;
import javax.ws.rs.core.UriBuilder;
import javax.ws.rs.core.UriInfo;

@Path("/nodes")
public class NodesResource {

    public static List<Node> nodes = new ArrayList<Node>();

    @GET
    public List<Node> getNodes() {
        return nodes;
    }

    @POST
    public Response createNode(Node node, @Context UriInfo uriInfo) throws URISyntaxException {
        node.setIp("fakeIp");
        node.setId((long) (Math.random() * 100000));
        nodes.add(node);
        UriBuilder uriBuilder = uriInfo.getBaseUriBuilder();
        uriBuilder.path(NodeResource.class);
        return Response.created(uriBuilder.build(node.getId())).build();
    }

}
{'fraction_non_alphanumeric': 0.13256484149855907, 'fraction_numerical': 0.0069164265129683, 'mean_word_length': 3.5564304461942258, 'pattern_counts': {'":': 0, '<': 9, '<?xml version=': 0, '>': 9, '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': '3440279', 'n_tokens_mistral': 575, 'n_tokens_neox': 553, 'n_words': 116}