Fix issue with multiline comment in OSGI properties
If a component property as a multiline comment the app activation
will throw an exception and no property for that component would be initialized.
This patch address that in two ways:
- Make sure that if we cannot parse a line from cfgdef the other properties are enabled and logs a warn.
- Changes the onos-maven-plugin so that it removes new lines when generating the .cfgdef file
Bumping version as plugin is already published from onos-2.5 branch
Change-Id: I550c23624118782fe6d79c9abbaf75ae59ea0eab
diff --git a/tools/package/maven-plugin/pom.xml b/tools/package/maven-plugin/pom.xml
index 488c806..8b2da91 100644
--- a/tools/package/maven-plugin/pom.xml
+++ b/tools/package/maven-plugin/pom.xml
@@ -26,7 +26,7 @@
<groupId>org.onosproject</groupId>
<artifactId>onos-maven-plugin</artifactId>
- <version>2.4-SNAPSHOT</version>
+ <version>2.5.0-SNAPSHOT</version>
<packaging>maven-plugin</packaging>
<description>Maven plugin for packaging ONOS applications or generating
diff --git a/tools/package/maven-plugin/src/main/java/org/onosproject/maven/OnosCfgMojo.java b/tools/package/maven-plugin/src/main/java/org/onosproject/maven/OnosCfgMojo.java
index 60d5f63..4397357 100644
--- a/tools/package/maven-plugin/src/main/java/org/onosproject/maven/OnosCfgMojo.java
+++ b/tools/package/maven-plugin/src/main/java/org/onosproject/maven/OnosCfgMojo.java
@@ -174,7 +174,11 @@
}
JavaField field = javaClass.getFieldByName(name);
if (field != null) {
+ // make sure that the new lines are removed from the comment, they will break the property loading.
String comment = field.getComment();
+ if (comment != null) {
+ comment = comment.replace("\n", " ").replace("\r", " ");
+ }
return comment != null ? comment : NO_DESCRIPTION;
}
throw new IllegalStateException("cfgdef could not find a variable named " + name + " in " + javaClass.getName());