try {
stopWatch.start("createModel");
final Type type = new TypeToken<WroModel>() {}.getType();
final InputStream is = getModelResourceAsStream();
if (is == null) {
throw new WroRuntimeException("Invalid model stream provided!");
}
final WroModel model = new Gson().fromJson(new InputStreamReader(getModelResourceAsStream()), type);
LOG.debug("json model: {}", model);
if (model == null) {
throw new WroRuntimeException("Invalid content provided, cannot build model!");
}
return model;
} catch (final Exception e) {
throw new WroRuntimeException("Invalid model found!", e);
} finally {
stopWatch.stop();
LOG.debug(stopWatch.prettyPrint());
}
}