diff --git a/pom.xml b/pom.xml
index df32e41..b3bc460 100644
--- a/pom.xml
+++ b/pom.xml
@@ -3,7 +3,7 @@
4.0.0
de.isas.mztab
mztab-validator-webapp
- 1.0.23
+ 1.0.24
jar
A web-based validator for mzTab format version 1.0 onwards.
MzTab validator webapplication.
@@ -45,12 +45,12 @@
1.8
UTF-8
1.8
- 3.0.4
+ 3.0.9
1.0.4
${project.version}
2.9.2
27.0.1-jre
- 2.1.7.RELEASE
+ 2.2.2.RELEASE
isas
1.4.10
1.18.4
@@ -62,8 +62,8 @@
1.0.3
1.5.16
2.22.2
- 2.9.9
- 2.9.9.2
+ 2.10.1
+ 2.10.1
2.9.9
6.0.7.Final
1.7.25
@@ -269,6 +269,7 @@
com.fasterxml.jackson.dataformat
jackson-dataformat-xml
+ ${jackson.version}
com.fasterxml.jackson.jaxrs
@@ -688,6 +689,14 @@
jcenter
http://jcenter.bintray.com
+
+
+ false
+
+ bintray-lifs-maven
+ bintray-lifs
+ https://dl.bintray.com/lifs/maven
+
false
diff --git a/src/main/java/de/isas/lipidomics/mztab/validator/webapp/service/validation/IsasValidator.java b/src/main/java/de/isas/lipidomics/mztab/validator/webapp/service/validation/IsasValidator.java
index b39b244..5648745 100644
--- a/src/main/java/de/isas/lipidomics/mztab/validator/webapp/service/validation/IsasValidator.java
+++ b/src/main/java/de/isas/lipidomics/mztab/validator/webapp/service/validation/IsasValidator.java
@@ -24,7 +24,6 @@
import de.isas.mztab2.model.MzTab;
import de.isas.mztab2.model.ValidationMessage;
import de.isas.mztab2.validation.CvMappingValidator;
-import java.io.File;
import java.io.IOException;
import java.io.StringWriter;
import java.nio.file.Path;
@@ -37,8 +36,11 @@
import java.util.logging.Logger;
import javax.xml.bind.JAXBException;
import de.isas.mztab2.io.MzTabFileParser;
+import java.io.PrintWriter;
+import java.util.Optional;
+import lombok.extern.slf4j.Slf4j;
import uk.ac.ebi.pride.jmztab2.model.MZTabConstants;
-import uk.ac.ebi.pride.jmztab2.utils.errors.MZTabErrorOverflowException;
+import uk.ac.ebi.pride.jmztab2.utils.errors.MZTabErrorList;
import uk.ac.ebi.pride.jmztab2.utils.errors.MZTabErrorType;
import uk.ac.ebi.pride.jmztab2.utils.errors.MZTabException;
@@ -46,6 +48,7 @@
*
* @author Nils Hoffmann <nils.hoffmann@isas.de>
*/
+@Slf4j
public class IsasValidator implements WebValidator {
private final CvParameterLookupService lookupService;
@@ -56,51 +59,49 @@ public IsasValidator(CvParameterLookupService lookupService) {
@Override
public List validate(Path filepath,
- String validationLevel, int maxErrors, boolean checkCvMapping, Path validationFile) throws IllegalStateException, IOException {
+ String validationLevel, int maxErrors, boolean checkCvMapping, Path validationFile) throws IllegalStateException, IOException {
MzTabFileParser parser = null;
List validationResults = new ArrayList<>();
try {
parser = new MzTabFileParser(filepath.toFile());
- parser.parse(
- System.out, MZTabErrorType.findLevel(validationLevel), maxErrors);
- } catch (MZTabErrorOverflowException ex) {
- Logger.getLogger(IsasValidator.class.getName()).
- log(Level.SEVERE, null, ex);
+ MZTabErrorList errorList = parser.parse(
+ System.out, MZTabErrorType.findLevel(validationLevel), maxErrors);
+ errorList.convertToValidationMessages();
+ } catch (Exception e) {
+ log.error("Caught Exception in IsasValidator:", e);
ValidationMessage vm = new ValidationMessage();
- vm.setCategory(ValidationMessage.CategoryEnum.CROSS_CHECK);
+ vm.setCategory(
+ ValidationMessage.CategoryEnum.FORMAT);
vm.setCode("");
vm.setLineNumber(-1l);
vm.setMessageType(
- ValidationMessage.MessageTypeEnum.ERROR);
- vm.setMessage(ex.getMessage());
+ ValidationMessage.MessageTypeEnum.ERROR);
+ StringWriter sw = new StringWriter();
+ PrintWriter pw = new PrintWriter(sw);
+ e.printStackTrace(pw);
+ vm.setMessage(e.getMessage()!=null?e.getMessage():"Caught an Exception while parsing '"+filepath.getFileName()+"'. Please check your file's tabular structure and inspect further validation messages!" + "\n" +sw.toString());
validationResults.add(vm);
} finally {
if (parser != null) {
validationResults.addAll(parser.getErrorList().
- convertToValidationMessages());
+ convertToValidationMessages());
if (checkCvMapping) {
try {
CvMappingValidator cvValidator = CvMappingValidator.of(
-// IsasValidator.class.getResource(
-// "/static/examples/mzTab-M-mapping.xml"),
- validationFile.toFile(),
- lookupService, checkCvMapping);
- validationResults.addAll(cvValidator.validate(parser.
- getMZTabFile()));
- } catch (JAXBException ex) {
- Logger.getLogger(IsasValidator.class.getName()).
- log(Level.SEVERE, null, ex);
- throw new IOException(ex);
- } catch (IllegalArgumentException iae) {
- Logger.getLogger(IsasValidator.class.getName()).
- log(Level.SEVERE, null, iae);
+ validationFile.toFile(),
+ lookupService, checkCvMapping);
+ List messages = cvValidator.validate(parser.
+ getMZTabFile());
+ validationResults.addAll(Optional.ofNullable(messages).orElse(Collections.emptyList()));
+ } catch (JAXBException | IllegalArgumentException iae) {
+ log.error("Caught Exception in IsasValidator, semantic validation:", iae);
ValidationMessage vm = new ValidationMessage();
vm.setCategory(
- ValidationMessage.CategoryEnum.CROSS_CHECK);
+ ValidationMessage.CategoryEnum.FORMAT);
vm.setCode("");
vm.setLineNumber(-1l);
vm.setMessageType(
- ValidationMessage.MessageTypeEnum.ERROR);
+ ValidationMessage.MessageTypeEnum.ERROR);
vm.setMessage(iae.getMessage());
validationResults.add(vm);
}
@@ -112,11 +113,11 @@ public List validate(Path filepath,
@Override
public Map>> parse(Path filepath,
- String validationLevel, int maxErrors) throws IOException {
+ String validationLevel, int maxErrors) throws IOException {
MzTabFileParser parser = new MzTabFileParser(filepath.toFile());
try {
parser.parse(
- System.out, MZTabErrorType.findLevel(validationLevel), maxErrors);
+ System.out, MZTabErrorType.findLevel(validationLevel), maxErrors);
} finally {
MzTab mzTabFile = parser.getMZTabFile();
if (mzTabFile != null) {
@@ -124,27 +125,27 @@ public Map>> parse(Path filepath,
CsvMapper mapper = writerDefaults.metadataMapper();
CsvSchema schema = writerDefaults.metaDataSchema(mapper);
if (mzTabFile.getMetadata().
- getMzTabVersion() == null) {
+ getMzTabVersion() == null) {
//set default version if not set
mzTabFile.getMetadata().
- mzTabVersion(MZTabConstants.VERSION_MZTAB_M);
+ mzTabVersion(MZTabConstants.VERSION_MZTAB_M);
}
StringWriter writer = new StringWriter();
try {
mapper.writer(schema).
- writeValue(writer, mzTabFile.getMetadata());
+ writeValue(writer, mzTabFile.getMetadata());
} catch (JsonProcessingException ex) {
Logger.getLogger(MzTabNonValidatingWriter.class.getName()).
- log(Level.SEVERE, null, ex);
+ log(Level.SEVERE, null, ex);
}
Map>> mzTabLines = new LinkedHashMap<>();
String[] metaDataLines = writer.toString().
- split(MZTabConstants.NEW_LINE);
+ split(MZTabConstants.NEW_LINE);
List