Fix frame generation error in the inner class manipulation. This commit is related to FELIX-4255 Extend the inner class manipulation to allow method interception,

git-svn-id: https://svn.apache.org/repos/asf/felix/trunk@1529113 13f79535-47bb-0310-9956-ffa450edef68
diff --git a/ipojo/manipulator/manipulator/src/main/java/org/apache/felix/ipojo/manipulation/InnerClassAdapter.java b/ipojo/manipulator/manipulator/src/main/java/org/apache/felix/ipojo/manipulation/InnerClassAdapter.java
index 86de35f..b63f436 100644
--- a/ipojo/manipulator/manipulator/src/main/java/org/apache/felix/ipojo/manipulation/InnerClassAdapter.java
+++ b/ipojo/manipulator/manipulator/src/main/java/org/apache/felix/ipojo/manipulation/InnerClassAdapter.java
@@ -81,6 +81,17 @@
         m_fields = manipulator.getFields().keySet();
     }
 
+    @Override
+    public void visit(int version, int access, String name, String signature, String superName, String[] interfaces) {
+        // If version = 1.7, use 1.6 if the ipojo.downgrade.classes system property is either
+        // not set of set to true.
+        int theVersion = version;
+        String downgrade = System.getProperty("ipojo.downgrade.classes");
+        if ((downgrade == null  || "true".equals(downgrade))  && version == Opcodes.V1_7) {
+            theVersion = Opcodes.V1_6;
+        }
+        super.visit(theVersion, access, name, signature, superName, interfaces);
+    }
 
     /**
      * Visits a method.
diff --git a/ipojo/manipulator/manipulator/src/main/java/org/apache/felix/ipojo/manipulation/Manipulator.java b/ipojo/manipulator/manipulator/src/main/java/org/apache/felix/ipojo/manipulation/Manipulator.java
index ce533ce..ce1579d 100644
--- a/ipojo/manipulator/manipulator/src/main/java/org/apache/felix/ipojo/manipulation/Manipulator.java
+++ b/ipojo/manipulator/manipulator/src/main/java/org/apache/felix/ipojo/manipulation/Manipulator.java
@@ -115,7 +115,6 @@
      * @throws IOException : if an error occurs during the manipulation.
      */
     public byte[] manipulate(byte[] origin) throws IOException {
-        ClassWriter finalWriter = null;
         if (!m_alreadyManipulated) {
             InputStream is2 = new ByteArrayInputStream(origin);
             ClassReader cr0 = new ClassReader(is2);