diff --git a/src/main/java/com/smartharvester/service/MappingService.java b/src/main/java/com/smartharvester/service/MappingService.java index 5ba05834516b0b3380fc64e8da8e7c6f9be4431a..5b40586988770031c1ca32f5c42010e391372d46 100644 --- a/src/main/java/com/smartharvester/service/MappingService.java +++ b/src/main/java/com/smartharvester/service/MappingService.java @@ -2,6 +2,7 @@ package com.smartharvester.service; import com.jayway.jsonpath.DocumentContext; import com.jayway.jsonpath.JsonPath; +import com.jayway.jsonpath.PathNotFoundException; import com.smartharvester.model.mapping.Path; import com.smartharvester.model.mapping.request.PublishedRequest; import com.smartharvester.util.SmartHarvesterRequestUtil; @@ -112,7 +113,13 @@ public class MappingService { for (Path path: paths) { assert json != null; DocumentContext jsonContext = JsonPath.parse(json.toString()); - Object value = jsonContext.read(path.getPath()); + Object value; + try { + value = jsonContext.read(path.getPath()); + } catch (PathNotFoundException e) { + value = "undefined"; + } + if (value instanceof String) { String valueString = (String) value; if (path.getDcatClass().equals("dcat:dataset")) {