<commit_before>package org.springframework.social.tumblr.api.impl.json;

import org.codehaus.jackson.JsonNode;
import org.codehaus.jackson.JsonParser;
import org.codehaus.jackson.JsonProcessingException;
import org.codehaus.jackson.map.DeserializationContext;
import org.codehaus.jackson.map.JsonDeserializer;
import org.codehaus.jackson.map.annotate.JsonDeserialize;
import org.codehaus.jackson.node.ArrayNode;
import org.springframework.social.tumblr.api.*;

import java.io.IOException;
import java.util.ArrayList;
import java.util.List;

@JsonDeserialize(using = PostMixin.PostDeserializer.class)
class PostMixin {

    static class PostDeserializer extends JsonDeserializer<Post> {

        @Override
        public Post deserialize(JsonParser jp, DeserializationContext ctxt) throws IOException, JsonProcessingException {
            JsonNode root = jp.readValueAsTree();

            Post post = new Post();

            post.setId(root.get("id").getLongValue());
            post.setBlogName(root.get("blog_name").getTextValue());
            post.setType(PostType.getByType(root.get("type").getTextValue()));
            post.setPostUrl(root.get("post_url").getTextValue());
            post.setTimestamp(root.get("timestamp").getLongValue());
            post.setGmtDateString(root.get("date").getTextValue());
            post.setFormat(root.get("format").getTextValue());
            post.setReblogKey(root.get("reblog_key").getTextValue());
            List<String> tags = new ArrayList<String>();
            JsonNode tagsNode = root.get("tags");
            if (tagsNode != null && tagsNode.isArray()) {
                ArrayNode tagsArray = (ArrayNode) tagsNode;
                for (int i = 0; i < tagsArray.size(); i++) {
                    tags.add(tagsArray.get(i).getTextValue());
                }
            }
            post.setTags(tags);
            if (root.get("note_count") != null) {
                post.setNoteCount(root.get("note_count").getIntValue());
            }
            post.setCreatedViaBookmarklet(root.get("bookmarklet") != null);
            post.setCreatedViaMobile(root.get("mobile") != null);
            if (root.get("source_url") != null) {
                post.setSourceUrl(root.get("source_url").getTextValue());
            }
            if (root.get("source_title") != null) {
                post.setSourceTitle(root.get("source_title").getTextValue());
            }

            switch (post.getType()) {
                case TEXT:
                    if (root.get("title") != null) {
                        post.setTitle(root.get("title").getTextValue());
                    }
                    post.setTitle(root.get("body").getTextValue());
                    break;
                case PHOTO:
                    if (root.get("caption") != null) {
                        post.setCaption(root.get("caption").getTextValue());
                    }
                    if (root.get("width") != null) {
                        post.setWidth(root.get("width").getIntValue());
                    }
                    if (root.get("height") != null) {
                        post.setHeight(root.get("height").getIntValue());<commit_msg>fixed PostMixin.deserialize - setBody typo<commit_after>package org.springframework.social.tumblr.api.impl.json;

import org.codehaus.jackson.JsonNode;
import org.codehaus.jackson.JsonParser;
import org.codehaus.jackson.JsonProcessingException;
import org.codehaus.jackson.map.DeserializationContext;
import org.codehaus.jackson.map.JsonDeserializer;
import org.codehaus.jackson.map.annotate.JsonDeserialize;
import org.codehaus.jackson.node.ArrayNode;
import org.springframework.social.tumblr.api.*;

import java.io.IOException;
import java.util.ArrayList;
import java.util.List;

@JsonDeserialize(using = PostMixin.PostDeserializer.class)
class PostMixin {

    static class PostDeserializer extends JsonDeserializer<Post> {

        @Override
        public Post deserialize(JsonParser jp, DeserializationContext ctxt) throws IOException, JsonProcessingException {
            JsonNode root = jp.readValueAsTree();

            Post post = new Post();

            post.setId(root.get("id").getLongValue());
            post.setBlogName(root.get("blog_name").getTextValue());
            post.setType(PostType.getByType(root.get("type").getTextValue()));
            post.setPostUrl(root.get("post_url").getTextValue());
            post.setTimestamp(root.get("timestamp").getLongValue());
            post.setGmtDateString(root.get("date").getTextValue());
            post.setFormat(root.get("format").getTextValue());
            post.setReblogKey(root.get("reblog_key").getTextValue());
            List<String> tags = new ArrayList<String>();
            JsonNode tagsNode = root.get("tags");
            if (tagsNode != null && tagsNode.isArray()) {
                ArrayNode tagsArray = (ArrayNode) tagsNode;
                for (int i = 0; i < tagsArray.size(); i++) {
                    tags.add(tagsArray.get(i).getTextValue());
                }
            }
            post.setTags(tags);
            if (root.get("note_count") != null) {
                post.setNoteCount(root.get("note_count").getIntValue());
            }
            post.setCreatedViaBookmarklet(root.get("bookmarklet") != null);
            post.setCreatedViaMobile(root.get("mobile") != null);
            if (root.get("source_url") != null) {
                post.setSourceUrl(root.get("source_url").getTextValue());
            }
            if (root.get("source_title") != null) {
                post.setSourceTitle(root.get("source_title").getTextValue());
            }

            switch (post.getType()) {
                case TEXT:
                    if (root.get("title") != null) {
                        post.setTitle(root.get("title").getTextValue());
                    }
                    post.setBody(root.get("body").getTextValue());
                    break;
                case PHOTO:
                    if (root.get("caption") != null) {
                        post.setCaption(root.get("caption").getTextValue());
                    }
                    if (root.get("width") != null) {
                        post.setWidth(root.get("width").getIntValue());
                    }
                    if (root.get("height") != null) {
                        post.setHeight(root.get("height").getIntValue());
{'fraction_non_alphanumeric': 0.1379738968303294, 'fraction_numerical': 0.00031075201988812925, 'mean_word_length': 2.160039273441335, 'pattern_counts': {'":': 0, '<': 11, '<?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': '2499941', 'n_tokens_mistral': 1775, 'n_tokens_neox': 1703, 'n_words': 246}