FELIX-2876 : <reference> element not generated when name is missing
git-svn-id: https://svn.apache.org/repos/asf/felix/trunk@1079744 13f79535-47bb-0310-9956-ffa450edef68
diff --git a/scrplugin/generator/src/main/java/org/apache/felix/scrplugin/om/Reference.java b/scrplugin/generator/src/main/java/org/apache/felix/scrplugin/om/Reference.java
index 72588e9..2186ece 100644
--- a/scrplugin/generator/src/main/java/org/apache/felix/scrplugin/om/Reference.java
+++ b/scrplugin/generator/src/main/java/org/apache/felix/scrplugin/om/Reference.java
@@ -248,7 +248,7 @@
final JavaMethod method = this.findMethod(specVersion, methodName);
if (method == null) {
if ( !componentIsAbstract ) {
- this.logError( iLog, "Missing method " + methodName + " for reference " + this.getName() );
+ this.logError( iLog, "Missing method " + methodName + " for reference " + (this.getName() == null ? "" : this.getName()));
}
return null;
}
@@ -287,8 +287,15 @@
// append reference name with service interface and ServiceReference
if (method == null) {
- realMethodName = methodName + Character.toUpperCase(this.name.charAt(0))
- + this.name.substring(1);
+ final String info;
+ if (StringUtils.isEmpty(this.name)) {
+ final String interfaceName = this.getInterfacename();
+ final int pos = interfaceName.lastIndexOf('.');
+ info = interfaceName.substring(pos + 1);
+ } else {
+ info = this.name;
+ }
+ realMethodName = methodName + Character.toUpperCase(info.charAt(0)) + info.substring(1);
method = this.javaClassDescription.getMethodBySignature(realMethodName, sig);
}