feature: improved handling exception NoSuchElementException
This commit is contained in:
@@ -34,7 +34,7 @@ public class FileDataSource implements DataSource{
|
||||
return null;
|
||||
}
|
||||
catch (NoSuchElementException e){
|
||||
System.out.println("No such element");
|
||||
System.out.println(e.getMessage() + "No such element");
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -56,7 +56,7 @@ public class StudentCsvReader implements Iterator<Student> {
|
||||
public Student next() {
|
||||
lineOfFile++;
|
||||
if (!records.hasNext()) {
|
||||
throw new NoSuchElementException();
|
||||
throw new NoSuchElementException("Problem at line " + lineOfFile + ".");
|
||||
}
|
||||
|
||||
CSVRecord record = records.next();
|
||||
|
||||
Reference in New Issue
Block a user