svn commit: r231385 - /jakarta/bcel/trunk/src/java/org/apache/bcel/generic/LocalVariableGen.java

[email protected]
Newsgroups gmane.comp.jakarta.bcel.devel
Message-ID <[email protected]>
Author: dbrosius
Date: Wed Aug 10 20:36:32 2005
New Revision: 231385

URL: http://svn.apache.org/viewcvs?rev=231385&view=rev
Log:
fix for 36110 - LocalVariableGen calls setStart and setEnd which add 'this' to a hashset. The problem is that the hash is computed using start and end. since start wasn't computed until after it is added, the add hash and remove hash will be different. Changed ctor to stuff the start and end values before calling setStart and setEnd

Modified:
    jakarta/bcel/trunk/src/java/org/apache/bcel/generic/LocalVariableGen.java

Modified: jakarta/bcel/trunk/src/java/org/apache/bcel/generic/LocalVariableGen.java
URL: http://svn.apache.org/viewcvs/jakarta/bcel/trunk/src/java/org/apache/bcel/generic/LocalVariableGen.java?rev=231385&r1=231384&r2=231385&view=diff
==============================================================================
--- jakarta/bcel/trunk/src/java/org/apache/bcel/generic/LocalVariableGen.java (original)
+++ jakarta/bcel/trunk/src/java/org/apache/bcel/generic/LocalVariableGen.java Wed Aug 10 20:36:32 2005
@@ -58,6 +58,12 @@
     this.name  = name;
     this.type  = type;
     this.index  = index;
+    // setStart and setEnd add 'this' to a HashSet, causing the hash to compute.
+    // The hash uses start and end, so set them before calling setStart/setEnd.
+    // Otherwise, the remove will fail because the hash is different than the add.
+    // Icky, but should be ok. See Bug: 36110  -- dbrosius
+    this.start = start;
+    this.end = end;
     setStart(start);
     setEnd(end);
   }
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.