<commit_before>package com.gurkensalat.osm.mosques;

import com.gurkensalat.osm.entity.DitibPlace;
import com.gurkensalat.osm.entity.OsmPlace;
import com.gurkensalat.osm.repository.DitibPlaceRepository;
import com.gurkensalat.osm.repository.OsmPlaceRepository;
import org.apache.commons.lang3.text.ExtendedMessageFormat;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.boot.autoconfigure.EnableAutoConfiguration;
import org.springframework.stereotype.Controller;
import org.springframework.ui.Model;
import org.springframework.web.bind.annotation.RequestMapping;

import java.util.Locale;

@Controller
@EnableAutoConfiguration
public class MapController
{
    private static final Logger LOGGER = LoggerFactory.getLogger(MapController.class);

    private static final String MEDIATYPE_JAVASCRIPT = "application/javascript";

    @Autowired
    private DitibPlaceRepository ditibPlaceRepository;

    @Autowired
    private OsmPlaceRepository osmPlaceRepository;

    @RequestMapping("/map")
    String map(Model model)
    {
        StringBuffer result = new StringBuffer();
        result.append("\n");

        ExtendedMessageFormat mf = new ExtendedMessageFormat("[{0}, {1}, \"{2}\"]", Locale.ENGLISH);

        result.append("var ditibAddressPoints = [");
        result.append("\n");

        for (DitibPlace place : ditibPlaceRepository.findAll())
        {
            String popupHtml = place.getAddress().getCity() + " / " + place.getName();
            result.append(mf.format(new Object[]{place.getLat(), place.getLon(), popupHtml}));
            result.append(",\n");
        }

        result.append("\n");
        result.append("]\n");

        result.append("var osmAddressPoints = [");
        result.append("\n");

        for (OsmPlace place : osmPlaceRepository.findAll())
        {
            String popupHtml = "OSM / " + place.getAddress().getCity() + " / " + place.getName();
            result.append(mf.format(new Object[]{place.getLat(), place.getLon(), popupHtml}));
            result.append(",\n");
        }

        result.append("\n");
        result.append("]\n");

        model.addAttribute("placemarkers_as_js", result.toString());
        return "map/index";
    }
}
<commit_msg>Avoid usage of messageformat, gives bad precision<commit_after>package com.gurkensalat.osm.mosques;

import com.gurkensalat.osm.entity.DitibPlace;
import com.gurkensalat.osm.entity.OsmPlace;
import com.gurkensalat.osm.repository.DitibPlaceRepository;
import com.gurkensalat.osm.repository.OsmPlaceRepository;
import org.apache.commons.lang3.text.ExtendedMessageFormat;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.boot.autoconfigure.EnableAutoConfiguration;
import org.springframework.stereotype.Controller;
import org.springframework.ui.Model;
import org.springframework.web.bind.annotation.RequestMapping;

import java.util.Locale;

@Controller
@EnableAutoConfiguration
public class MapController
{
    private static final Logger LOGGER = LoggerFactory.getLogger(MapController.class);

    private static final String MEDIATYPE_JAVASCRIPT = "application/javascript";

    @Autowired
    private DitibPlaceRepository ditibPlaceRepository;

    @Autowired
    private OsmPlaceRepository osmPlaceRepository;

    @RequestMapping("/map")
    String map(Model model)
    {
        StringBuffer result = new StringBuffer();
        result.append("\n");

        ExtendedMessageFormat mf = new ExtendedMessageFormat("[{0}, {1}, \"{2}\"]", Locale.ENGLISH);

        result.append("var ditibAddressPoints = [");
        result.append("\n");

        for (DitibPlace place : ditibPlaceRepository.findAll())
        {
            String popupHtml = place.getAddress().getCity() + " / " + place.getName();
            result.append("[" + place.getLat() + ", " + place.getLon() + ", \"" + popupHtml + "\"]");
            // result.append(mf.format(new Object[]{place.getLat(), place.getLon(), popupHtml}));
            result.append(",\n");
        }

        result.append("\n");
        result.append("]\n");

        result.append("var osmAddressPoints = [");
        result.append("\n");

        for (OsmPlace place : osmPlaceRepository.findAll())
        {
            String popupHtml = "OSM / " + place.getAddress().getCity() + " / " + place.getName();
            result.append("[" + place.getLat() + ", " + place.getLon() + ", \"" + popupHtml + "\"]");
            // [48.136, 11.387, "OSM / Germering / <NAME>"],
            // result.append(mf.format(new Object[]{place.getLat(), place.getLon(), popupHtml}));
            result.append(",\n");

            if ("82110".equals(place.getAddress().getPostcode()))
            {
                String foo = mf.format(new Object[]{place.getLat(), place.getLon(), popupHtml});
                int breakpoint = 42;
            }
        }

        result.append("\n");
        result.append("]\n");

        model.addAttribute("placemarkers_as_js", result.toString());
        return "map/index";
    }
}

{'fraction_non_alphanumeric': 0.14235976789168278, 'fraction_numerical': 0.005609284332688588, 'mean_word_length': 3.1870445344129554, 'pattern_counts': {'":': 0, '<': 4, '<?xml version=': 0, '>': 4, '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': '2018188', 'n_tokens_mistral': 1553, 'n_tokens_neox': 1511, 'n_words': 250}