Limpieza de comentarios y codigo final
This commit is contained in:
@@ -19,14 +19,12 @@ public class ContinenteDaoFichero implements IContinenteDAO {
|
||||
try (BufferedReader br = new BufferedReader(new FileReader("continentes.txt"))) {
|
||||
String linea;
|
||||
while ((linea = br.readLine()) != null) {
|
||||
// Lógica simple para leer tus líneas del fichero
|
||||
String[] partes = linea.split(",");
|
||||
if (partes.length >= 2) {
|
||||
lista.add(new Continente(partes[0].trim(), partes[1].trim()));
|
||||
}
|
||||
}
|
||||
} catch (IOException e) {
|
||||
// AQUÍ ESTÁ LA CLAVE DE LA ACTIVIDAD: Si falla el fichero, lanzamos nuestra excepción
|
||||
throw new AccesoDatosException("Error al leer el archivo de continentes", e);
|
||||
}
|
||||
|
||||
|
||||
@@ -31,7 +31,7 @@ public class Continente {
|
||||
this.nombre = nombre;
|
||||
}
|
||||
|
||||
// ToString para ver los datos por consola
|
||||
// ToString para datos consola
|
||||
@Override
|
||||
public String toString() {
|
||||
return "Continente [codigo=" + codigo + ", nombre=" + nombre + "]";
|
||||
|
||||
Reference in New Issue
Block a user