From 15d61bce4cc56b2ee6b87e46eaff2afcf0b7cdaa Mon Sep 17 00:00:00 2001 From: Trygve Laugstøl Date: Sun, 6 Jan 2013 02:28:10 +0100 Subject: o Relaxed parsing of xml files in case the file is missing. --- .../trygvis/esper/testing/web/resource/JenkinsResource.java | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) (limited to 'src/main/java') diff --git a/src/main/java/io/trygvis/esper/testing/web/resource/JenkinsResource.java b/src/main/java/io/trygvis/esper/testing/web/resource/JenkinsResource.java index bd0c613..3169096 100755 --- a/src/main/java/io/trygvis/esper/testing/web/resource/JenkinsResource.java +++ b/src/main/java/io/trygvis/esper/testing/web/resource/JenkinsResource.java @@ -1,5 +1,6 @@ package io.trygvis.esper.testing.web.resource; +import fj.data.*; import io.trygvis.esper.testing.*; import io.trygvis.esper.testing.jenkins.*; import io.trygvis.esper.testing.jenkins.xml.*; @@ -151,9 +152,16 @@ public class JenkinsResource extends AbstractResource { protected SqlF getJenkinsBuildJson = new SqlF() { public JenkinsBuildJson apply(JenkinsBuildDto dto) throws SQLException { - JenkinsBuildXml xml = daos.fileDao.load(dto.file).toFj(). + Option xmlO = daos.fileDao.load(dto.file).toFj(). bind(xmlParser.parseDocument). - bind(JenkinsBuildXml.parse).some(); + bind(JenkinsBuildXml.parse); + + if(xmlO.isNone()) { + return new JenkinsBuildJson(dto.uuid, dto.createdDate, new DateTime(dto.createdDate), + "unknown", 0, 0); + } + + JenkinsBuildXml xml = xmlO.some(); return new JenkinsBuildJson(dto.uuid, dto.createdDate, new DateTime(xml.timestamp), xml.result.orSome("unknown"), xml.number, xml.duration); -- cgit v1.2.3