diff --git a/src/main/java/seng202/group9/Controller/App.java b/src/main/java/seng202/group9/Controller/App.java index 1a8ffd3..f07a6c2 100644 --- a/src/main/java/seng202/group9/Controller/App.java +++ b/src/main/java/seng202/group9/Controller/App.java @@ -130,7 +130,7 @@ public class App extends Application fileIn.close(); }catch(IOException e){ session = new Session(); - e.printStackTrace(); + System.out.println("New Session File Created"); }catch(ClassNotFoundException e){ System.out.println("Missing Session Class"); System.exit(1); diff --git a/src/main/java/seng202/group9/GUI/Importer.java b/src/main/java/seng202/group9/GUI/Importer.java index a16a9f4..3be619a 100644 --- a/src/main/java/seng202/group9/GUI/Importer.java +++ b/src/main/java/seng202/group9/GUI/Importer.java @@ -26,32 +26,33 @@ public class Importer{ "Text & .csv", "*.txt", "*.csv"); chooser.getExtensionFilters().add(filter); File file = chooser.showOpenDialog(primaryStage); - if (scene == SceneCode.AIRLINE_RAW_DATA){ - try { - showSuccessAlert(parent.getCurrentDataset().importAirline(file.getPath())); - } catch (DataException e) { - e.printStackTrace(); - } - }else if (scene == SceneCode.AIRPORT_RAW_DATA){ - try { - showSuccessAlert(parent.getCurrentDataset().importAirport(file.getPath())); - } catch (DataException e) { - e.printStackTrace(); - } - }else if (scene == SceneCode.ROUTE_RAW_DATA){ - try { - showSuccessAlert(parent.getCurrentDataset().importRoute(file.getPath())); - } catch (DataException e) { - e.printStackTrace(); - } - }else if (scene == SceneCode.FLIGHT_RAW_DATA){ - try { - showSuccessAlert(parent.getCurrentDataset().importFlight(file.getPath())); - } catch (DataException e) { - e.printStackTrace(); + if (file != null) { + if (scene == SceneCode.AIRLINE_RAW_DATA) { + try { + showSuccessAlert(parent.getCurrentDataset().importAirline(file.getPath())); + } catch (DataException e) { + e.printStackTrace(); + } + } else if (scene == SceneCode.AIRPORT_RAW_DATA) { + try { + showSuccessAlert(parent.getCurrentDataset().importAirport(file.getPath())); + } catch (DataException e) { + e.printStackTrace(); + } + } else if (scene == SceneCode.ROUTE_RAW_DATA) { + try { + showSuccessAlert(parent.getCurrentDataset().importRoute(file.getPath())); + } catch (DataException e) { + e.printStackTrace(); + } + } else if (scene == SceneCode.FLIGHT_RAW_DATA) { + try { + showSuccessAlert(parent.getCurrentDataset().importFlight(file.getPath())); + } catch (DataException e) { + e.printStackTrace(); + } } } - } public void showSuccessAlert(String message){