aboutsummaryrefslogtreecommitdiff
path: root/src/main/java
diff options
context:
space:
mode:
authorTrygve Laugstøl <trygvis@inamo.no>2013-01-06 02:28:10 +0100
committerTrygve Laugstøl <trygvis@inamo.no>2013-01-06 02:28:47 +0100
commit15d61bce4cc56b2ee6b87e46eaff2afcf0b7cdaa (patch)
treef79ee79b982ab46724bbd94577bb0c3eb7fca16a /src/main/java
parent9199316feef9d751ce73bb71d065345b585d3126 (diff)
downloadesper-testing-15d61bce4cc56b2ee6b87e46eaff2afcf0b7cdaa.tar.gz
esper-testing-15d61bce4cc56b2ee6b87e46eaff2afcf0b7cdaa.tar.bz2
esper-testing-15d61bce4cc56b2ee6b87e46eaff2afcf0b7cdaa.tar.xz
esper-testing-15d61bce4cc56b2ee6b87e46eaff2afcf0b7cdaa.zip
o Relaxed parsing of xml files in case the file is missing.
Diffstat (limited to 'src/main/java')
-rwxr-xr-xsrc/main/java/io/trygvis/esper/testing/web/resource/JenkinsResource.java12
1 files changed, 10 insertions, 2 deletions
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<JenkinsBuildDto, JenkinsBuildJson> getJenkinsBuildJson = new SqlF<JenkinsBuildDto, JenkinsBuildJson>() {
public JenkinsBuildJson apply(JenkinsBuildDto dto) throws SQLException {
- JenkinsBuildXml xml = daos.fileDao.load(dto.file).toFj().
+ Option<JenkinsBuildXml> 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);