diff --git a/build.gradle b/build.gradle index 3b9e8b5..277d01c 100644 --- a/build.gradle +++ b/build.gradle @@ -7,7 +7,7 @@ allprojects { targetCompatibility = "1.6" } -version '1.11.4'+System.getProperty('release','-SNAPSHOT') +version '1.11.5'+System.getProperty('release','-SNAPSHOT') configurations { deployerJars @@ -20,9 +20,10 @@ configurations { //} dependencies { - compile group: 'ch.interlis', name: 'iox-ili', version: '1.20.17' - compile group: 'ch.interlis', name: 'ili2c-tool', version: "5.0.6" - compile group: 'ch.interlis', name: 'ili2c-core', version: "5.0.6" + compile group: 'ch.ehi', name: 'ehibasics', version: '1.3.0' + compile group: 'ch.interlis', name: 'iox-ili', version: '1.20.18' + compile group: 'ch.interlis', name: 'ili2c-tool', version: "5.0.8" + compile group: 'ch.interlis', name: 'ili2c-core', version: "5.0.8" testCompile group: 'junit', name: 'junit', version: '4.12' deployerJars "org.apache.maven.wagon:wagon-ftp:3.3.3" deployerJars "org.apache.maven.wagon:wagon-ssh:3.3.3" diff --git a/docs/CHANGELOG.txt b/docs/CHANGELOG.txt index c017123..1862f3f 100644 --- a/docs/CHANGELOG.txt +++ b/docs/CHANGELOG.txt @@ -1,7 +1,22 @@ LATEST VERSION ----------------------------- -ilivalidator 1.11.4 (2020-02-03) +ilivalidator 1.11.5 (2020-04-01) +----------------------------- +- Missing check when write to "unwriteable" log-file (#228) +- NPE with ili23 / RoadsExgm2ien_Symbols-20160121.xml (#231) +- ArrayIndexOutOfBoundsException with n-ary association (#232) +- Xtf24: wrong xmlns for extended attributes (#235) +- Xtf24: fails to read STRUCTUREs defined at model level (#236) +- Xtf24: missing line number in messages (#237) +- Xtf24: fails to read ref of embedded assoc with attrs (#238) +- GUI: "Job done" message in GUI (#234) +- GUI: scroll log area to end (#234) +- ili2c-5.0.8 +- ehibasics-1.3.0 +- iox-ili-1.20.18 + +ilivalidator 1.11.4 (2020-03-02) ----------------------------- - Command line: use options without a data-file (#223) - java.lang.NullPointerException when starting filelist (#224) diff --git a/src/org/interlis2/validator/Validator.java b/src/org/interlis2/validator/Validator.java index 4e04ad0..f30400c 100644 --- a/src/org/interlis2/validator/Validator.java +++ b/src/org/interlis2/validator/Validator.java @@ -42,7 +42,9 @@ */ public class Validator { - public static boolean runValidation( + public static final String MSG_VALIDATION_DONE = "...validation done"; + public static final String MSG_VALIDATION_FAILED = "...validation failed"; + public static boolean runValidation( String dataFilename, Settings settings ) { @@ -91,12 +93,34 @@ public boolean validate( try{ // setup logging of validation results if(logFilename!=null){ - logfile=new FileLogger(new java.io.File(logFilename)); - EhiLogger.getInstance().addListener(logfile); + File f=new java.io.File(logFilename); + try { + if(isWriteable(f)) { + logfile=new FileLogger(f); + EhiLogger.getInstance().addListener(logfile); + }else { + EhiLogger.logError("failed to write to logfile <"+f.getPath()+">"); + return false; + } + } catch (IOException e) { + EhiLogger.logError("failed to write to logfile <"+f.getPath()+">",e); + return false; + } } if(xtflogFilename!=null){ - xtflog=new XtfErrorsLogger(new java.io.File(xtflogFilename), Main.APP_NAME+"-"+Main.getVersion()); - EhiLogger.getInstance().addListener(xtflog); + File f=new java.io.File(xtflogFilename); + try { + if(isWriteable(f)) { + xtflog=new XtfErrorsLogger(f, Main.APP_NAME+"-"+Main.getVersion()); + EhiLogger.getInstance().addListener(xtflog); + }else { + EhiLogger.logError("failed to write to logfile <"+f.getPath()+">"); + return false; + } + } catch (IOException e) { + EhiLogger.logError("failed to write to logfile <"+f.getPath()+">",e); + return false; + } } if(!TRUE.equals(settings.getValue(SETTING_DISABLE_STD_LOGGER))) { logStderr=new StdLogger(logFilename); @@ -258,9 +282,9 @@ public boolean validate( statistics.write2logger(); // check for errors if(logStderr.hasSeenErrors()){ - EhiLogger.logState("...validation failed"); + EhiLogger.logState(MSG_VALIDATION_FAILED); }else{ - EhiLogger.logState("...validation done"); + EhiLogger.logState(MSG_VALIDATION_DONE); ret=true; } }catch(Throwable ex){ @@ -268,7 +292,7 @@ public boolean validate( statistics.write2logger(); } EhiLogger.logError(ex); - EhiLogger.logState("...validation failed"); + EhiLogger.logState(MSG_VALIDATION_FAILED); }finally{ if(validator!=null){ validator.close(); @@ -297,7 +321,12 @@ public boolean validate( return ret; } - private boolean getVersionControlFormConfigFile(String configFilename) throws IOException { + private static boolean isWriteable(File f) throws IOException { + f.createNewFile(); + return f.canWrite(); + } + + private boolean getVersionControlFormConfigFile(String configFilename) throws IOException { if (configFilename != null) { ValidationConfig modelConfig=new ValidationConfig(); modelConfig.mergeConfigFile(new File(configFilename)); diff --git a/src/org/interlis2/validator/gui/MainFrame.java b/src/org/interlis2/validator/gui/MainFrame.java index 4bf7e39..cf52518 100644 --- a/src/org/interlis2/validator/gui/MainFrame.java +++ b/src/org/interlis2/validator/gui/MainFrame.java @@ -1,6 +1,7 @@ package org.interlis2.validator.gui; import java.awt.Insets; +import java.awt.Toolkit; import java.awt.event.ActionListener; import java.awt.event.ItemEvent; import java.awt.event.KeyEvent; @@ -577,7 +578,10 @@ public void actionPerformed(java.awt.event.ActionEvent e) { SwingWorker worker = new SwingWorker() { public Object construct() { try { - Validator.runValidation(getXtfFile(),getSettings()); + boolean ret=Validator.runValidation(getXtfFile(),getSettings()); + getLogUi().setCaretPosition(getLogUi().getDocument().getLength()); + Toolkit.getDefaultToolkit().beep(); + JOptionPane.showMessageDialog(MainFrame.this, ret?Validator.MSG_VALIDATION_DONE:Validator.MSG_VALIDATION_FAILED); } catch (Exception ex) { EhiLogger.logError(rsrc.getString("MainFrame.generalError"),ex); }