Return-Path: Delivered-To: apmail-felix-commits-archive@www.apache.org Received: (qmail 9304 invoked from network); 12 Jan 2011 16:57:00 -0000 Received: from hermes.apache.org (HELO mail.apache.org) (140.211.11.3) by minotaur.apache.org with SMTP; 12 Jan 2011 16:57:00 -0000 Received: (qmail 9232 invoked by uid 500); 12 Jan 2011 16:57:00 -0000 Delivered-To: apmail-felix-commits-archive@felix.apache.org Received: (qmail 9138 invoked by uid 500); 12 Jan 2011 16:56:58 -0000 Mailing-List: contact commits-help@felix.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: dev@felix.apache.org Delivered-To: mailing list commits@felix.apache.org Received: (qmail 9130 invoked by uid 99); 12 Jan 2011 16:56:58 -0000 Received: from athena.apache.org (HELO athena.apache.org) (140.211.11.136) by apache.org (qpsmtpd/0.29) with ESMTP; Wed, 12 Jan 2011 16:56:58 +0000 X-ASF-Spam-Status: No, hits=-2000.0 required=10.0 tests=ALL_TRUSTED X-Spam-Check-By: apache.org Received: from [140.211.11.4] (HELO eris.apache.org) (140.211.11.4) by apache.org (qpsmtpd/0.29) with ESMTP; Wed, 12 Jan 2011 16:56:57 +0000 Received: by eris.apache.org (Postfix, from userid 65534) id 550B223888FD; Wed, 12 Jan 2011 16:56:31 +0000 (UTC) Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Subject: svn commit: r1058231 - in /felix/trunk/ipojo: core/src/main/java/org/apache/felix/ipojo/ manipulator/src/main/java/org/apache/felix/ipojo/manipulator/ tests/core/annotations/src/main/java/org/apache/felix/ipojo/test/scenarios/component/ Date: Wed, 12 Jan 2011 16:56:31 -0000 To: commits@felix.apache.org From: clement@apache.org X-Mailer: svnmailer-1.0.8 Message-Id: <20110112165631.550B223888FD@eris.apache.org> Author: clement Date: Wed Jan 12 16:56:30 2011 New Revision: 1058231 URL: http://svn.apache.org/viewvc?rev=1058231&view=rev Log: Avoid a potential NPE in arch Clean the output of the manipulator during annotation processing. Added: felix/trunk/ipojo/tests/core/annotations/src/main/java/org/apache/felix/ipojo/test/scenarios/component/NoAnnotation.java Modified: felix/trunk/ipojo/core/src/main/java/org/apache/felix/ipojo/PrimitiveInstanceDescription.java felix/trunk/ipojo/manipulator/src/main/java/org/apache/felix/ipojo/manipulator/Pojoization.java Modified: felix/trunk/ipojo/core/src/main/java/org/apache/felix/ipojo/PrimitiveInstanceDescription.java URL: http://svn.apache.org/viewvc/felix/trunk/ipojo/core/src/main/java/org/apache/felix/ipojo/PrimitiveInstanceDescription.java?rev=1058231&r1=1058230&r2=1058231&view=diff ============================================================================== --- felix/trunk/ipojo/core/src/main/java/org/apache/felix/ipojo/PrimitiveInstanceDescription.java (original) +++ felix/trunk/ipojo/core/src/main/java/org/apache/felix/ipojo/PrimitiveInstanceDescription.java Wed Jan 12 16:56:30 2011 @@ -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 @@ import org.apache.felix.ipojo.metadata.E /** * Primitive Instance Description. - * + * * @author Felix Project Team */ public class PrimitiveInstanceDescription extends InstanceDescription { - + /** * Creates a Primitive Instance Description. * @param type the component type description @@ -64,7 +64,7 @@ public class PrimitiveInstanceDescriptio return new String[0]; } } - + /** * Gets the instance service dependencies. * @return the set of dependency description or an empty array if @@ -79,7 +79,7 @@ public class PrimitiveInstanceDescriptio .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 @@ public class PrimitiveInstanceDescriptio || 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 @@ public class PrimitiveInstanceDescriptio 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 @@ public class PrimitiveInstanceDescriptio .getDescription()).getProvidedServices(); } } - + /** * Gets the instance properties. * @return the set of property descriptions or an empty array if @@ -155,7 +155,7 @@ public class PrimitiveInstanceDescriptio .getDescription()).getProperties(); } } - + /** * Gets the instance description. * Overridden to add created objects. @@ -165,14 +165,14 @@ public class PrimitiveInstanceDescriptio 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; } - - + + } Modified: felix/trunk/ipojo/manipulator/src/main/java/org/apache/felix/ipojo/manipulator/Pojoization.java URL: http://svn.apache.org/viewvc/felix/trunk/ipojo/manipulator/src/main/java/org/apache/felix/ipojo/manipulator/Pojoization.java?rev=1058231&r1=1058230&r2=1058231&view=diff ============================================================================== --- felix/trunk/ipojo/manipulator/src/main/java/org/apache/felix/ipojo/manipulator/Pojoization.java (original) +++ felix/trunk/ipojo/manipulator/src/main/java/org/apache/felix/ipojo/manipulator/Pojoization.java Wed Jan 12 16:56:30 2011 @@ -300,7 +300,8 @@ public class Pojoization { 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 @@ public class Pojoization { // 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()); } } Added: felix/trunk/ipojo/tests/core/annotations/src/main/java/org/apache/felix/ipojo/test/scenarios/component/NoAnnotation.java URL: http://svn.apache.org/viewvc/felix/trunk/ipojo/tests/core/annotations/src/main/java/org/apache/felix/ipojo/test/scenarios/component/NoAnnotation.java?rev=1058231&view=auto ============================================================================== --- felix/trunk/ipojo/tests/core/annotations/src/main/java/org/apache/felix/ipojo/test/scenarios/component/NoAnnotation.java (added) +++ felix/trunk/ipojo/tests/core/annotations/src/main/java/org/apache/felix/ipojo/test/scenarios/component/NoAnnotation.java Wed Jan 12 16:56:30 2011 @@ -0,0 +1,5 @@ +package org.apache.felix.ipojo.test.scenarios.component; + +public class NoAnnotation { + +}