Skip to content

Commit

Permalink
Merge branch 'master' into stable
Browse files Browse the repository at this point in the history
  • Loading branch information
claeis committed Apr 1, 2020
2 parents 7c7cecc + 48d6f1a commit 8c3ba86
Show file tree
Hide file tree
Showing 4 changed files with 64 additions and 15 deletions.
9 changes: 5 additions & 4 deletions build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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"
Expand Down
17 changes: 16 additions & 1 deletion docs/CHANGELOG.txt
Original file line number Diff line number Diff line change
@@ -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)
Expand Down
47 changes: 38 additions & 9 deletions src/org/interlis2/validator/Validator.java
Original file line number Diff line number Diff line change
Expand Up @@ -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
) {
Expand Down Expand Up @@ -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);
Expand Down Expand Up @@ -258,17 +282,17 @@ 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){
if(statistics!=null) {
statistics.write2logger();
}
EhiLogger.logError(ex);
EhiLogger.logState("...validation failed");
EhiLogger.logState(MSG_VALIDATION_FAILED);
}finally{
if(validator!=null){
validator.close();
Expand Down Expand Up @@ -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));
Expand Down
6 changes: 5 additions & 1 deletion src/org/interlis2/validator/gui/MainFrame.java
Original file line number Diff line number Diff line change
@@ -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;
Expand Down Expand Up @@ -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);
}
Expand Down

0 comments on commit 8c3ba86

Please sign in to comment.