Solve a simple bug in the iPOJO Manipulator when a class is already manipulated.
git-svn-id: https://svn.apache.org/repos/asf/felix/trunk@561046 13f79535-47bb-0310-9956-ffa450edef68
diff --git a/ipojo/manipulator/pom.xml b/ipojo/manipulator/pom.xml
index 0c8248b..b2d308b 100644
--- a/ipojo/manipulator/pom.xml
+++ b/ipojo/manipulator/pom.xml
@@ -45,10 +45,10 @@
<instructions>
<Bundle-Name>iPOJO Manipulator</Bundle-Name>
<Bundle-Vendor>Clement ESCOFFIER</Bundle-Vendor>
- <Bundle-Description> iPOJO Manipulator </Bundle-Description>
+ <Bundle-Description> iPOJO Manipulator </Bundle-Description>
+ <Export-Package>org.apache.felix.ipojo.manipulator</Export-Package>
<Private-Package>
org.apache.felix.ipojo.manipulation,
- org.apache.felix.ipojo.manipulator,
org.apache.felix.ipojo.xml.parser,
org.objectweb.asm,
org.objectweb.asm.commons,
diff --git a/ipojo/manipulator/src/main/java/org/apache/felix/ipojo/manipulation/Manipulator.java b/ipojo/manipulator/src/main/java/org/apache/felix/ipojo/manipulation/Manipulator.java
index f614b96..2cad656 100644
--- a/ipojo/manipulator/src/main/java/org/apache/felix/ipojo/manipulation/Manipulator.java
+++ b/ipojo/manipulator/src/main/java/org/apache/felix/ipojo/manipulation/Manipulator.java
@@ -201,7 +201,11 @@
finalWriter = cw0;
}
// The file is in the bundle
- return finalWriter.toByteArray();
+ if (ck.isalreadyManipulated()) {
+ return new byte[0];
+ } else {
+ return finalWriter.toByteArray();
+ }
}
/**
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 eac5afa..6c4b43b 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
@@ -147,7 +147,7 @@
try {
inputJar = new JarFile(in);
} catch (IOException e) {
- error("Cannot the input file is not a JarFile : " + in.getAbsolutePath());
+ error("The input file is not a JarFile : " + in.getAbsolutePath());
return;
}
@@ -182,6 +182,7 @@
jos.write(outClazz);
jos.closeEntry();
} else { // The class is already manipulated
+ jos.putNextEntry(curEntry);
InputStream currIn = inputJar.getInputStream(curEntry);
int c;
int i = 0;
@@ -415,7 +416,9 @@
for (int i = 0; i < m_metadata.length; i++) {
meta += buildManifestMetadata(m_metadata[i], "");
}
- att.putValue("iPOJO-Components", meta);
+ if (!meta.equals("")) {
+ att.putValue("iPOJO-Components", meta);
+ }
}
/**
@@ -555,7 +558,7 @@
}
if (meta == null || meta.length == 0) {
- warn("Neither component, neither instance in " + path);
+ warn("Neither component types, nor instances in " + path);
}
return meta;
@@ -595,3 +598,4 @@
}
}
+
diff --git a/ipojo/metadata/pom.xml b/ipojo/metadata/pom.xml
index 1d14370..56f4c5e 100644
--- a/ipojo/metadata/pom.xml
+++ b/ipojo/metadata/pom.xml
@@ -7,7 +7,25 @@
</parent>
<modelVersion>4.0.0</modelVersion>
<artifactId>org.apache.felix.ipojo.metadata</artifactId>
- <packaging>jar</packaging>
+ <packaging>bundle</packaging>
<version>0.7.3-SNAPSHOT</version>
<name>Apache Felix iPOJO Metadata</name>
+ <build>
+ <plugins>
+ <plugin>
+ <groupId>org.apache.felix</groupId>
+ <artifactId>maven-bundle-plugin</artifactId>
+ <version>1.1.0-SNAPSHOT</version>
+ <extensions>true</extensions>
+ <configuration>
+ <instructions>
+ <Bundle-Name>iPOJO Manipulator</Bundle-Name>
+ <Bundle-Vendor>Clement ESCOFFIER</Bundle-Vendor>
+ <Bundle-Description> iPOJO Metadata </Bundle-Description>
+ <Export-Package>org.apache.felix.ipojo.metadata</Export-Package>
+ </instructions>
+ </configuration>
+ </plugin>
+ </plugins>
+ </build>
</project>