java.io.FileNotFoundException al crear FileInputStream
Obteniendo un error al intentar abrir un FileInputStream para cargar Map desde un archivo con extensión .ser.
Constructor donde creo un nuevo archivo y método de invocación que carga el mapa del archivo:
protected DriveatorImpl() {
accounts = new ConcurrentHashMap<String, Client>();
db = new File("database.ser"); // oddly this does not create a file if one does not exist
loadDB();
}
@SuppressWarnings("unchecked")
private void loadDB() {
try {
fileIn = new FileInputStream(db);
in = new ObjectInputStream(fileIn);
accounts = (Map<String, Client>) in.readObject();
in.close();
fileIn.close();
} catch (FileNotFoundException e) {
e.printStackTrace();
} catch (IOException e) {
e.printStackTrace();
} catch (ClassNotFoundException e) {
e.printStackTrace();
}
}
Intenté crear el archivo manualmente y ponerlo en el mismo paquete con la clase, pero no ayuda. ¡¿Que esta pasando?!
¡Gracias!