Example usage for java.io FileNotFoundException printStackTrace

List of usage examples for java.io FileNotFoundException printStackTrace

Introduction

In this page you can find the example usage for java.io FileNotFoundException printStackTrace.

Prototype

public void printStackTrace() 

Source Link

Document

Prints this throwable and its backtrace to the standard error stream.

Usage

From source file:SwiftWork.java

private static void cleanLocalTemp() {
    BufferedReader reader;//from w w w .jav a  2s. c o  m
    try {
        reader = new BufferedReader(new FileReader(getBenchITTemp() + "/" + LOCAL_TEMP_LOG_FILE));
    } catch (FileNotFoundException e) {
        e.printStackTrace();
        System.err.println("Local temp log file is not found, skipping the clean up process.");
        return;
    }
    String line = null;
    boolean res = false;

    try {
        while ((line = reader.readLine()) != null) {
            File tmp = new File(line);
            if (tmp.delete()) {
                System.out.println("File " + line + " is deleted successfully");
            } else {
                System.err.println("File " + line + " is NOT deleted successfully");
                // In case of a locking
                linuxDeleteFile(line);
            }

        }
        // Removing the actual local log file
        reader.close();
        File local_log = new File(getBenchITTemp(), LOCAL_TEMP_LOG_FILE);
        local_log.delete();

    } catch (IOException e) {
        e.printStackTrace();
        System.err.println("Something wrong with the local log file, skipping the cleanup process.");
        return;
    }
}

From source file:controllers.GenerateDocumentsController.java

public static Result previewCV1() throws DocumentException, IOException {
    User user = SingletonDataSource.getInstance().getUserByEmail(session().get("email"));

    if (user == null) {
        return badRequest("No se ha podido generar el CV porque no existe el usuario");
    }/*from  w  w w.j a  va 2  s. c  o m*/
    String route = Files.newPathForNewFile("public/pdf", "pdf");

    Template1 template = new Template1();
    try {
        template.createPdf(route, user, user.personalCharacteristics, user.skill);
        ConfDataSource.addNewGeneratedDoc();
    } catch (FileNotFoundException e) {
        e.printStackTrace();
    } catch (DocumentException e) {
        e.printStackTrace();
    }
    return redirect(routes.Assets.at(route.substring(7)));
}

From source file:controllers.GenerateDocumentsController.java

public static Result previewCV2() throws DocumentException, IOException {
    User user = SingletonDataSource.getInstance().getUserByEmail(session().get("email"));

    if (user == null) {
        return badRequest("No se ha podido generar el CV porque no existe el usuario");
    }/*  w ww .j av  a 2  s .  c  o  m*/
    String route = Files.newPathForNewFile("public/pdf", "pdf");

    Template2 template = new Template2();
    try {
        template.createPdf(route, user, user.personalCharacteristics, user.skill);
        ConfDataSource.addNewGeneratedDoc();
    } catch (FileNotFoundException e) {
        e.printStackTrace();
    } catch (DocumentException e) {
        e.printStackTrace();
    }
    return redirect(routes.Assets.at(route.substring(7)));
}

From source file:controllers.GenerateDocumentsController.java

public static Result previewCV3() throws DocumentException, IOException {
    User user = SingletonDataSource.getInstance().getUserByEmail(session().get("email"));

    if (user == null) {
        return badRequest("No se ha podido generar el CV porque no existe el usuario");
    }/*from  w  ww.j  a  v  a  2 s  .c o  m*/
    String route = Files.newPathForNewFile("public/pdf", "pdf");

    Template3 template = new Template3();
    try {
        template.createPdf(route, user, user.personalCharacteristics, user.skill);
        ConfDataSource.addNewGeneratedDoc();
    } catch (FileNotFoundException e) {
        e.printStackTrace();
    } catch (DocumentException e) {
        e.printStackTrace();
    }
    return redirect(routes.Assets.at(route.substring(7)));
}

From source file:controllers.GenerateDocumentsController.java

public static Result previewCV4() throws DocumentException, IOException {
    User user = SingletonDataSource.getInstance().getUserByEmail(session().get("email"));

    if (user == null) {
        return badRequest("No se ha podido generar el CV porque no existe el usuario");
    }/*from w  w  w  .j  a  v a  2 s .  c o m*/
    String route = Files.newPathForNewFile("public/pdf", "pdf");

    Template4 template = new Template4();
    try {
        template.createPdf(route, user, user.personalCharacteristics, user.skill);
        ConfDataSource.addNewGeneratedDoc(); //Counter of all generated docs
    } catch (FileNotFoundException e) {
        e.printStackTrace();
    } catch (DocumentException e) {
        e.printStackTrace();
    }
    return redirect(routes.Assets.at(route.substring(7)));
}

From source file:Main.java

/**
 * Reads data from specified file./*from  w  w w.  jav a2s  .c o  m*/
 * @param path Path to file.
 * @return 2-dimensional array of data.
 */
public static ArrayList<ArrayList<String>> loadFile(String path) {
    FileReader fr = null;
    String line = "";
    ArrayList<ArrayList<String>> dataArray = new ArrayList<>();

    try {
        fr = new FileReader(path);
    } catch (FileNotFoundException e) {
        // TODO Auto-generated catch block
        System.out.println(e.getMessage());
    }

    BufferedReader br = new BufferedReader(fr);
    ArrayList<String> tokens = new ArrayList<>();

    try {
        while ((line = br.readLine()) != null) {
            tokens = parseLine(line);
            dataArray.add(tokens);
        }
    } catch (IOException e) {
        // TODO Auto-generated catch block
        e.printStackTrace();
    }

    try {
        fr.close();
    } catch (IOException e) {
        // TODO Auto-generated catch block
        e.printStackTrace();
    }

    return dataArray;
}

From source file:Main.java

/**
 * Reads data from specified file.//from   w  w w. j  a v  a2  s. c  o  m
 * @param file A file to read from.
 * @return 2-dimensional array of data.
 */
public static ArrayList<ArrayList<String>> loadFile(File file) {
    FileReader fr = null;
    String line = "";
    ArrayList<ArrayList<String>> dataArray = new ArrayList<>();

    try {
        fr = new FileReader(file);
    } catch (FileNotFoundException e) {
        // TODO Auto-generated catch block
        System.out.println(e.getMessage());
    }

    BufferedReader br = new BufferedReader(fr);
    ArrayList<String> tokens = new ArrayList<>();

    try {
        while ((line = br.readLine()) != null) {
            tokens = parseLine(line);
            dataArray.add(tokens);
        }
    } catch (IOException e) {
        // TODO Auto-generated catch block
        e.printStackTrace();
    }

    try {
        fr.close();
    } catch (IOException e) {
        // TODO Auto-generated catch block
        e.printStackTrace();
    }

    return dataArray;
}