reader = new InputStreamReader(new ByteArrayInputStream(cndContent));
// actually imports the CND
- CndImporter.registerNodeTypes(reader, session, true);
+ try {
+ CndImporter.registerNodeTypes(reader, session, true);
+ } catch (Exception e) {
+ log.error("Cannot import data model " + resUrl, e);
+ return;
+ }
- if (dataModel != null & !dataModel.isNodeType(NodeType.NT_FILE)) {
+ if (dataModel != null && !dataModel.isNodeType(NodeType.NT_FILE)) {
dataModel.remove();
dataModel = null;
}
*/
/** Find which OSGi bundle provided the data model resource */
protected Bundle findDataModelBundle(String resUrl) {
+ if (bundleContext == null)
+ return null;
+
if (resUrl.startsWith("/"))
resUrl = resUrl.substring(1);
String pkg = resUrl.substring(0, resUrl.lastIndexOf('/')).replace('/',
if (exportedPackage != null) {
exportingBundle = exportedPackage.getExportingBundle();
} else {
- throw new ArgeoException("No OSGi exporting package found for "
- + resUrl);
+ // assume this is in the same bundle
+ exportingBundle = bundleContext.getBundle();
+// throw new ArgeoException("No OSGi exporting package found for "
+// + resUrl);
}
return exportingBundle;
}