<commit_before>package drive.api;

import com.google.api.services.drive.Drive;
import com.google.api.services.drive.model.File;
import com.google.api.services.drive.model.FileList;
import com.google.inject.Inject;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;

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

/**
 * File Service - Retrieve files from the api
 *
 * <NAME> <<EMAIL>>
 */
public class FileService {
    private static Logger logger = LoggerFactory.getLogger(FileService.class.getSimpleName());
    private DriveService driveService;

    public FileService(){}

    @Inject
    public FileService(DriveService driveService) {
        this.driveService = driveService;
    }

    /**
     * Get all the files on the api
     *
     * @return List of files
     * @throws IOException
     */
    public List<File> getAll() throws IOException{
        List<File> result = new ArrayList<>();

        String fields = "files(createdTime,explicitlyTrashed,id,mimeType,modifiedTime,name,parents,size,trashed,version)";

        Drive.Files.List request = driveService.getDrive().files().list().setFields(fields);

        do {
            try {
                FileList files = request.execute();

                result.addAll(files.getFiles());
                request.setPageToken(files.getNextPageToken());

            } catch (IOException e) {
                Logger logger = LoggerFactory.getLogger(this.getClass().getName());
                logger.error("Error: e %s", e.toString());
                request.setPageToken(null);
            }
        } while (request.getPageToken() != null && request.getPageToken().length() > 0);

        return result;
    }

//    files(createdTime,explicitlyTrashed,id,mimeType,modifiedTime,name,parents,size,trashed,version)

    /**
     * Get file by id
     * @param fileId
     * @return File|null
     */
    public File getFile(String fileId) {
        try {
            return driveService.getDrive().files().get(fileId).execute();
        } catch (IOException e) {

            logger.error("Error: Cannot retrieve the file: " + fileId);
        }
        return null;
    }

    /**
     * Get InputStream for a fileId
     * @param id
     * @return
     * @throws IOException
     */
    public InputStream downloadFile(String id) throws IOException {
        try {
            return driveService.getDrive().files().get(id).executeMediaAsInputStream();
        } catch (IOException e) {
            logger.error("Cannot get file from google drive api: " + id);
            return null;
        }
    }

    /**
     * Get root id
     *
     * @return File root of the drive.
     */
    public File getRoot(){
        try{
            return driveService.getDrive().files().get("root").execute();
        } catch (IOException exception) {
            logger.error(exception.getMessage());
        }

        return null;
    }
}
<commit_msg>catch IO missing config settings file<commit_after>package drive.api;

import com.google.api.services.drive.Drive;
import com.google.api.services.drive.model.File;
import com.google.api.services.drive.model.FileList;
import com.google.inject.Inject;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;

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

/**
 * File Service - Retrieve files from the api
 *
 * <NAME> <<EMAIL>>
 */
public class FileService {
    private static Logger logger = LoggerFactory.getLogger(FileService.class.getSimpleName());
    private DriveService driveService;

    public FileService(){}

    @Inject
    public FileService(DriveService driveService) throws IOException {
        this.driveService = driveService;
    }

    /**
     * Get all the files on the api
     *
     * @return List of files
     * @throws IOException
     */
    public List<File> getAll() throws IOException{
        List<File> result = new ArrayList<>();

        String fields = "files(createdTime,explicitlyTrashed,id,mimeType,modifiedTime,name,parents,size,trashed,version)";

        Drive.Files.List request = driveService.getDrive().files().list().setFields(fields);

        do {
            try {
                FileList files = request.execute();

                result.addAll(files.getFiles());
                request.setPageToken(files.getNextPageToken());

            } catch (IOException e) {
                Logger logger = LoggerFactory.getLogger(this.getClass().getName());
                logger.error("Error: e %s", e.toString());
                request.setPageToken(null);
            }
        } while (request.getPageToken() != null && request.getPageToken().length() > 0);

        return result;
    }

//    files(createdTime,explicitlyTrashed,id,mimeType,modifiedTime,name,parents,size,trashed,version)

    /**
     * Get file by id
     * @param fileId
     * @return File|null
     */
    public File getFile(String fileId) {
        try {
            return driveService.getDrive().files().get(fileId).execute();
        } catch (IOException e) {

            logger.error("Error: Cannot retrieve the file: " + fileId);
        }
        return null;
    }

    /**
     * Get InputStream for a fileId
     * @param id
     * @return
     * @throws IOException
     */
    public InputStream downloadFile(String id) throws IOException {
        try {
            return driveService.getDrive().files().get(id).executeMediaAsInputStream();
        } catch (IOException e) {
            logger.error("Cannot get file from google drive api: " + id);
            return null;
        }
    }

    /**
     * Get root id
     *
     * @return File root of the drive.
     */
    public File getRoot(){
        try{
            return driveService.getDrive().files().get("root").execute();
        } catch (IOException exception) {
            logger.error(exception.getMessage());
        }

        return null;
    }
}

{'fraction_non_alphanumeric': 0.11927369648509079, 'fraction_numerical': 0.0009995002498750624, 'mean_word_length': 2.3692480359147026, 'pattern_counts': {'":': 0, '<': 15, '<?xml version=': 0, '>': 17, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 2, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '5437865', 'n_tokens_mistral': 1682, 'n_tokens_neox': 1629, 'n_words': 375}