<commit_before>package se.billy.cloudyank.resource;

import javax.ws.rs.*;
import javax.ws.rs.core.Context;
import javax.ws.rs.core.Request;
import java.util.*;

/**
 * User: bisj
 * Date: 2013-11-22
 * Time: 08:28
 */
@Path("/snippets")
public class SnippetResource {

    private Map<String, String> snippets = new HashMap<String, String>();

    @POST
    @Path("/{user}")
    public void addSnippet(@PathParam("user") String user, String snippet, @Context Request req){
        if(snippet == null || snippet.equals("")){
            return;
        }

        //UGLY mofo. Get my character codes right next time!
        snippet = snippet.replaceAll("\\u0000", "");
        snippets.put(user, snippet);
    }

    @GET
    @Path("/{user}")
    @Produces("text/plain")
    public String getSnippet(@PathParam("user") String user){
        final String storedSnippet = snippets.get(user);

        if(storedSnippet == null){
            return "";
        }

        return storedSnippet;
    }
}<commit_msg>fixed codepage conversion in client, no need to manually strip null strings<commit_after>package se.billy.cloudyank.resource;

import javax.ws.rs.*;
import javax.ws.rs.core.Context;
import javax.ws.rs.core.Request;
import java.util.*;

/**
 * User: bisj
 * Date: 2013-11-22
 * Time: 08:28
 */
@Path("/snippets")
public class SnippetResource {

    private Map<String, String> snippets = new HashMap<String, String>();

    @POST
    @Path("/{user}")
    public void addSnippet(@PathParam("user") String user, String snippet, @Context Request req){
        if(snippet == null || snippet.equals("")){
            return;
        }

        snippets.put(user, snippet);
    }

    @GET
    @Path("/{user}")
    @Produces("text/plain")
    public String getSnippet(@PathParam("user") String user){

        return snippets.get(user)==null?"":snippets.get(user);
    }
}
{'fraction_non_alphanumeric': 0.15413333333333334, 'fraction_numerical': 0.014933333333333333, 'mean_word_length': 2.957805907172996, 'pattern_counts': {'":': 1, '<': 7, '<?xml version=': 0, '>': 7, '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': '5999331', 'n_tokens_mistral': 623, 'n_tokens_neox': 582, 'n_words': 139}