<commit_before>package com.kodcu.controller;

import com.kodcu.other.Current;
import com.kodcu.other.IOHelper;
import com.kodcu.service.convert.slide.SlideConverter;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.http.ResponseEntity;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.ResponseBody;

import javax.servlet.http.HttpServletRequest;
import java.nio.file.Files;
import java.nio.file.Path;

/**
 * Created by usta on 15.05.2015.
 */
@Controller
public class LiveReloadController {

    @Autowired
    private SlideConverter slideConverter;
    @Autowired
    private Current current;

    @RequestMapping(value = "/livereload/**", produces = "*/*", method = RequestMethod.GET)
    @ResponseBody
    public ResponseEntity slide(HttpServletRequest request) {

        String requestURI = request.getRequestURI();
        if (requestURI.contains("index.reload"))
            return ResponseEntity.ok(current.currentEditorValue());


        Path parent = current.currentPath().get().getParent();

        requestURI = requestURI.replace("/livereload/", "");

        if (requestURI.startsWith("/"))
            requestURI = requestURI.substring(1);

        Path resolve = parent.resolve(requestURI);

        if (Files.exists(resolve))
            return ResponseEntity.ok(IOHelper.readAllBytes(resolve));

        return ResponseEntity.notFound().build();

    }
}<commit_msg> - If file is not saved try working dir<commit_after>package com.kodcu.controller;

import com.kodcu.other.Current;
import com.kodcu.other.IOHelper;
import com.kodcu.service.DirectoryService;
import com.kodcu.service.convert.slide.SlideConverter;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.http.ResponseEntity;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.ResponseBody;

import javax.servlet.http.HttpServletRequest;
import java.nio.file.Files;
import java.nio.file.Path;
import java.util.Objects;

/**
 * Created by usta on 15.05.2015.
 */
@Controller
public class LiveReloadController {

    @Autowired
    private SlideConverter slideConverter;

    @Autowired
    private DirectoryService directoryService;

    @Autowired
    private Current current;

    private Logger logger = LoggerFactory.getLogger(LiveReloadController.class);

    @RequestMapping(value = "/livereload/**", produces = "*/*", method = RequestMethod.GET)
    @ResponseBody
    public ResponseEntity slide(HttpServletRequest request) {

        String requestURI = request.getRequestURI();
        if (requestURI.contains("index.reload"))
            return ResponseEntity.ok(current.currentEditorValue());

        Path parent = null;

        if (current.currentPath().isPresent()) {
            parent = current.currentPath().get().getParent();
        } else {
            parent = directoryService.workingDirectory();
        }

        if(Objects.nonNull(parent))
            logger.error("Workdir or current path is not resolved");

        requestURI = requestURI.replace("/livereload/", "");

        if (requestURI.startsWith("/"))
            requestURI = requestURI.substring(1);

        Path resolve = parent.resolve(requestURI);

        if (Files.exists(resolve))
            return ResponseEntity.ok(IOHelper.readAllBytes(resolve));

        logger.error("Requested file is not found {}", requestURI);

        return ResponseEntity.notFound().build();

    }
}
{'fraction_non_alphanumeric': 0.11241523213354199, 'fraction_numerical': 0.005216484089723527, 'mean_word_length': 3.7699004975124377, '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': '3107320', 'n_tokens_mistral': 1041, 'n_tokens_neox': 1016, 'n_words': 201}