use of org.motechproject.mds.exception.loader.LookupsJsonReadException in project motech by motech.
the class EditableLookupsLoader method loadEntitiesLookups.
private List<EntityLookups> loadEntitiesLookups(Bundle bundle) {
URL lookupsResource = getLookupsResource(bundle);
if (lookupsResource == null) {
return new ArrayList<>();
}
try (InputStream stream = lookupsResource.openStream()) {
String lookupsJson = toLookupsJson(bundle, stream);
List<EntityLookups> entitiesLookups = new ArrayList<>();
if (!StringUtils.isBlank(lookupsJson)) {
entitiesLookups.addAll(Arrays.asList(GSON.fromJson(lookupsJson, EntityLookups[].class)));
}
return entitiesLookups;
} catch (JsonSyntaxException e) {
throw new MalformedLookupsJsonException(bundle.getSymbolicName(), e);
} catch (IOException e) {
throw new LookupsJsonReadException(bundle.getSymbolicName(), e);
}
}
Aggregations