felix-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From clem...@apache.org
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 GMT
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 <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 @@ 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 {
+
+}



Mime
View raw message