Author: cziegeler
Date: Mon Sep 17 06:09:51 2007
New Revision: 576411

URL: http://svn.apache.org/viewvc?rev=576411&view=rev
Log:
Fix for FELIX-367: Set the instance variable in unbind only to null if passed 
service object is the same as the stored one.

Modified:
    
felix/trunk/scrplugin/src/main/java/org/apache/felix/scrplugin/tags/qdox/QDoxJavaClassDescription.java

Modified: 
felix/trunk/scrplugin/src/main/java/org/apache/felix/scrplugin/tags/qdox/QDoxJavaClassDescription.java
URL: 
http://svn.apache.org/viewvc/felix/trunk/scrplugin/src/main/java/org/apache/felix/scrplugin/tags/qdox/QDoxJavaClassDescription.java?rev=576411&r1=576410&r2=576411&view=diff
==============================================================================
--- 
felix/trunk/scrplugin/src/main/java/org/apache/felix/scrplugin/tags/qdox/QDoxJavaClassDescription.java
 (original)
+++ 
felix/trunk/scrplugin/src/main/java/org/apache/felix/scrplugin/tags/qdox/QDoxJavaClassDescription.java
 Mon Sep 17 06:09:51 2007
@@ -35,6 +35,7 @@
 import org.objectweb.asm.ClassAdapter;
 import org.objectweb.asm.ClassReader;
 import org.objectweb.asm.ClassWriter;
+import org.objectweb.asm.Label;
 import org.objectweb.asm.MethodVisitor;
 import org.objectweb.asm.Opcodes;
 import org.objectweb.asm.tree.ClassNode;
@@ -299,10 +300,17 @@
         mv.visitVarInsn(Opcodes.ALOAD, 0);
         if ( bind ) {
             mv.visitVarInsn(type.getOpcode(Opcodes.ILOAD), 1);
+            mv.visitFieldInsn(Opcodes.PUTFIELD, this.getName().replace('.', 
'/'), propertyName, type.toString());
         } else {
+            mv.visitFieldInsn(Opcodes.GETFIELD, this.getName().replace('.', 
'/'), propertyName, type.toString());
+            mv.visitVarInsn(Opcodes.ALOAD, 1);
+            final Label jmpLabel = new Label();
+            mv.visitJumpInsn(Opcodes.IF_ACMPNE, jmpLabel);
+            mv.visitVarInsn(Opcodes.ALOAD, 0);
             mv.visitInsn(Opcodes.ACONST_NULL);
+            mv.visitFieldInsn(Opcodes.PUTFIELD, this.getName().replace('.', 
'/'), propertyName, type.toString());
+            mv.visitLabel(jmpLabel);
         }
-        mv.visitFieldInsn(Opcodes.PUTFIELD, this.getName().replace('.', '/'), 
propertyName, type.toString());
         mv.visitInsn(Opcodes.RETURN);
         mv.visitMaxs(2, 2);
         // add to qdox


Reply via email to