diff --git a/common.gradle b/common.gradle index 4699ec57b..db8820bd6 100644 --- a/common.gradle +++ b/common.gradle @@ -6,7 +6,7 @@ apply plugin: 'java' apply plugin: 'maven' String mavenGroupId = 'org.cirdles' -String mavenVersion = '0.0.3' +String mavenVersion = '0.0.4' sourceCompatibility = '1.8' diff --git a/squidApp/src/main/java/org/cirdles/squid/gui/SquidUIController.java b/squidApp/src/main/java/org/cirdles/squid/gui/SquidUIController.java index 1f2d23e52..25147c266 100644 --- a/squidApp/src/main/java/org/cirdles/squid/gui/SquidUIController.java +++ b/squidApp/src/main/java/org/cirdles/squid/gui/SquidUIController.java @@ -134,15 +134,24 @@ private void launchProjectManager() { private void newSquidProjectAction(ActionEvent event) { squidProject = new SquidProject(); - CalamariFileManager.initProjectFiles(squidProject.getPrawnFileHandler(), "1.4.5"); + CalamariFileManager.initProjectFiles(squidProject.getPrawnFileHandler()); try { if (squidProject.selectPrawnFile(primaryStageWindow)) { launchProjectManager(); } } catch (IOException | JAXBException | SAXException anException) { + String message = anException.getMessage(); + if (message == null){ + try { + message = anException.getCause().getMessage(); + } catch (Exception e) { + } + } + SquidMessageDialog.showWarningDialog( - "Squid encountered an error while trying to open the selected file.", + "Squid encountered an error while trying to open the selected file:\n\n" + + message, primaryStageWindow); } } @@ -158,15 +167,24 @@ private void newSquidProjectByMergeAction(ActionEvent event) { squidProject = new SquidProject(); - CalamariFileManager.initProjectFiles(squidProject.getPrawnFileHandler(), "1.4.5"); + CalamariFileManager.initProjectFiles(squidProject.getPrawnFileHandler()); try { if (squidProject.selectAndMergeTwoPrawnFile(primaryStageWindow)) { launchProjectManager(); } } catch (IOException | JAXBException | SAXException anException) { + String message = anException.getMessage(); + if (message == null){ + try { + message = anException.getCause().getMessage(); + } catch (Exception e) { + } + } + SquidMessageDialog.showWarningDialog( - "Squid encountered an error while trying to open and join the selected files.", + "Squid encountered an error while trying to open and join the selected files:\n\n" + + message, primaryStageWindow); } diff --git a/squidCore/build.gradle b/squidCore/build.gradle index c427dc68e..742762118 100644 --- a/squidCore/build.gradle +++ b/squidCore/build.gradle @@ -24,7 +24,7 @@ repositories { dependencies { compile "com.github.cirdles:Commons:-SNAPSHOT" - compile 'com.github.bowring.Calamari:core:v1.4.5' + compile 'com.github.bowring.Calamari:core:v1.4.8' antlr "org.antlr:antlr4:4.6" compile 'org.antlr:antlr4-runtime:4.6' diff --git a/squidCore/src/main/java/org/cirdles/squid/fileManagement/CalamariFileManager.java b/squidCore/src/main/java/org/cirdles/squid/fileManagement/CalamariFileManager.java index 86da5c41c..51cd9a817 100644 --- a/squidCore/src/main/java/org/cirdles/squid/fileManagement/CalamariFileManager.java +++ b/squidCore/src/main/java/org/cirdles/squid/fileManagement/CalamariFileManager.java @@ -69,14 +69,14 @@ public static void initExamplePrawnFiles() { } } - public static void initProjectFiles(PrawnFileHandler prawnFileHandler, String calamariVersion) { + public static void initProjectFiles(PrawnFileHandler prawnFileHandler) { try { // point to directory, but no default choice prawnFileHandler.setCurrentPrawnFileLocation(exampleFolder.getCanonicalPath()); } catch (IOException iOException) { } - File defaultCalamariReportsFolder = new File("CalamariReports_v" + calamariVersion); + File defaultCalamariReportsFolder = new File("CalamariReports_v" + PrawnFileHandler.VERSION); prawnFileHandler.getReportsEngine() .setFolderToWriteCalamariReports(defaultCalamariReportsFolder); diff --git a/squidCore/src/main/java/org/cirdles/squid/projects/SquidProject.java b/squidCore/src/main/java/org/cirdles/squid/projects/SquidProject.java index 2df576b74..b53fb6e34 100644 --- a/squidCore/src/main/java/org/cirdles/squid/projects/SquidProject.java +++ b/squidCore/src/main/java/org/cirdles/squid/projects/SquidProject.java @@ -125,10 +125,14 @@ public boolean selectPrawnFile(Window ownerWindow) File prawnXMLFileNew = fileChooser.showOpenDialog(ownerWindow); if (prawnXMLFileNew != null) { - retVal = true; - prawnXMLFile = prawnXMLFileNew; - updatePrawnFileHandlerWithFileLocation(); - prawnFile = prawnFileHandler.unmarshallCurrentPrawnFileXML(); + if (prawnXMLFileNew.getName().toLowerCase(Locale.US).endsWith(".xml")) { + retVal = true; + prawnXMLFile = prawnXMLFileNew; + updatePrawnFileHandlerWithFileLocation(); + prawnFile = prawnFileHandler.unmarshallCurrentPrawnFileXML(); + } else { + throw new IOException("Filename does not end with '.xml'"); + } } return retVal; diff --git a/squidCore/src/main/java/org/cirdles/squid/utilities/SquidSerializer.java b/squidCore/src/main/java/org/cirdles/squid/utilities/SquidSerializer.java index b1636d453..d7aaee23c 100644 --- a/squidCore/src/main/java/org/cirdles/squid/utilities/SquidSerializer.java +++ b/squidCore/src/main/java/org/cirdles/squid/utilities/SquidSerializer.java @@ -73,7 +73,10 @@ public static Object GetSerializedObjectFromFile(String filename) { "The file you are attempting to open does not exist:\n" + " " + filename, null); } - } catch (IOException | ClassNotFoundException ex) { + } catch (IOException ex) { + SquidMessageDialog.showWarningDialog( + "The file you are attempting to open is not a valid '*.squid' file.", null); + } catch (ClassNotFoundException ex) { SquidMessageDialog.showWarningDialog( "The file you are attempting to open is not compatible with this version of Squid3.", null); }