Avoid a potential NPE in arch
Clean the output of the manipulator during annotation processing.
git-svn-id: https://svn.apache.org/repos/asf/felix/trunk@1058231 13f79535-47bb-0310-9956-ffa450edef68
diff --git a/ipojo/core/src/main/java/org/apache/felix/ipojo/PrimitiveInstanceDescription.java b/ipojo/core/src/main/java/org/apache/felix/ipojo/PrimitiveInstanceDescription.java
index f09686e..e066251 100644
--- a/ipojo/core/src/main/java/org/apache/felix/ipojo/PrimitiveInstanceDescription.java
+++ b/ipojo/core/src/main/java/org/apache/felix/ipojo/PrimitiveInstanceDescription.java
@@ -1,4 +1,4 @@
-/*
+/*
* Licensed to the Apache Software Foundation (ASF) under one
* or more contributor license agreements. See the NOTICE file
* distributed with this work for additional information
@@ -34,11 +34,11 @@
/**
* Primitive Instance Description.
- *
+ *
* @author <a href="mailto:dev@felix.apache.org">Felix Project Team</a>
*/
public class PrimitiveInstanceDescription extends InstanceDescription {
-
+
/**
* Creates a Primitive Instance Description.
* @param type the component type description
@@ -64,7 +64,7 @@
return new String[0];
}
}
-
+
/**
* Gets the instance service dependencies.
* @return the set of dependency description or an empty array if
@@ -79,7 +79,7 @@
.getDescription()).getDependencies();
}
}
-
+
/**
* Gets the instance service dependency matching with the given service specification or id.
* @param specification the service specification of the looked specification.
@@ -97,12 +97,12 @@
|| specification.equals(deps[i].getSpecification())) {
return deps[i];
}
-
+
}
}
return null;
}
-
+
/**
* Gets the instance provided service matching with the given service specification.
* @param specification the provided specification of the looked provided service.
@@ -120,12 +120,12 @@
if (specification.equals(str[j])) {
return pss[i];
}
- }
+ }
}
}
return null;
}
-
+
/**
* Gets the instance provided service.
* @return the set of provided service description or an empty array if
@@ -140,7 +140,7 @@
.getDescription()).getProvidedServices();
}
}
-
+
/**
* Gets the instance properties.
* @return the set of property descriptions or an empty array if
@@ -155,7 +155,7 @@
.getDescription()).getProperties();
}
}
-
+
/**
* Gets the instance description.
* Overridden to add created objects.
@@ -165,14 +165,14 @@
Element elem = super.getDescription();
// Created Object (empty is composite)
String[] objs = getCreatedObjects();
- for (int i = 0; i < objs.length; i++) {
+ for (int i = 0; objs != null && i < objs.length; i++) {
Element obj = new Element("Object", "");
obj.addAttribute(new Attribute("name", ((Object) objs[i]).toString()));
elem.addElement(obj);
}
return elem;
}
-
-
+
+
}
diff --git a/ipojo/manipulator/src/main/java/org/apache/felix/ipojo/manipulator/Pojoization.java b/ipojo/manipulator/src/main/java/org/apache/felix/ipojo/manipulator/Pojoization.java
index 0c82646..e7cf61d 100644
--- a/ipojo/manipulator/src/main/java/org/apache/felix/ipojo/manipulator/Pojoization.java
+++ b/ipojo/manipulator/src/main/java/org/apache/felix/ipojo/manipulator/Pojoization.java
@@ -300,7 +300,8 @@
cr.accept(collector, 0);
if (collector.isIgnoredBecauseOfMissingComponent()) {
- warn("Annotation processing ignored in " + collector.getClassName() + " - @Component missing");
+ // No @Component, just skip.
+ //warn("Annotation processing ignored in " + collector.getClassName() + " - @Component missing");
} else if (collector.isComponentType()) {
boolean toskip = false;
for (int i = 0; !toskip && i < m_metadata.size(); i++) {
@@ -329,7 +330,7 @@
// Instantiate ?
if (collector.getInstanceDeclaration() != null) {
- warn("Declaring an empty instance of " + elem.getAttribute("classname"));
+ //warn("Declaring an empty instance of " + elem.getAttribute("classname"));
m_metadata.add(collector.getInstanceDeclaration());
}
}
diff --git a/ipojo/tests/core/annotations/src/main/java/org/apache/felix/ipojo/test/scenarios/component/NoAnnotation.java b/ipojo/tests/core/annotations/src/main/java/org/apache/felix/ipojo/test/scenarios/component/NoAnnotation.java
new file mode 100644
index 0000000..8e24846
--- /dev/null
+++ b/ipojo/tests/core/annotations/src/main/java/org/apache/felix/ipojo/test/scenarios/component/NoAnnotation.java
@@ -0,0 +1,5 @@
+package org.apache.felix.ipojo.test.scenarios.component;
+
+public class NoAnnotation {
+
+}