"Doesn't matter, you don't name an instance variable and a parameter the same thing."???
Unless I'm completely missing the point of your comment, "Of course you can." I do it all the time, and it's in lots of books that way. Prefixing with "this." separates the two variables. Your suggestion of looking at the generated code is a good one. Tomcat may have trouble parsing a JSP with an inner class, and be generating something different than what we'd expect. I don't see anything obviously wrong looking at the sample code. Jay > -----Original Message----- > From: Phillip Morelock [mailto:[EMAIL PROTECTED]] > Sent: Wednesday, May 29, 2002 1:15 PM > To: Tomcat Users List > Subject: Re: Memory Leak? > > > Doesn't matter, you don't name an instance variable and a > parameter the same > thing. > > Was that really the code from your page? Because there were > syntax errors > (no semicolon, etc.). > > It might be a very good idea to go into /work and find out if what you > *think* it's translating to is really what it is (/work is > where tomcat puts > the .java files it translates from your jsp and then compiles > them into > servlets). I have found very rare instances where my > personal concept of > how tomcat is parsing my code is different from the reality. > > fillup > > > > On 5/29/02 11:10 AM, "Mark Shurgot" <[EMAIL PROTECTED]> wrote: > > > That doesn't seem to be the problem. Regardless of > variable names, the > > problem still occurs (we tried changing them around earlier > as a last > > resort). The parameter is already corrupt after being > received by the > > constructor, and before any assignment. > > > > Also, the local instance variable is identified by "this." > > > > -----Original Message----- > > From: Phillip Morelock [mailto:[EMAIL PROTECTED]] > > Sent: Wednesday, May 29, 2002 11:02 AM > > To: Tomcat Users List > > Subject: Re: Memory Leak? > > > > > > You are using the same name for the parameter to the > constructor and the > > instance variable for your inner class. > > > > fillup > > > > > > On 5/29/02 10:55 AM, "Mark Shurgot" > <[EMAIL PROTECTED]> wrote: > > > >> I am having the strangest problem with Tomcat and inner > classes. In a few > >> JSP pages, we use inner classes (beefed up structs) to > store information > >> retrieved from a database into a collection class (Vector). > >> > >> It seems that somewhere between getting the data from the > result set and > >> constructing and storing an instance of the (data holding) > inner class in > > a > >> Vector, the data is getting corrupted (doubles only). > >> > >> Example: > >> > >> ---- JSP ----- > >> > >> <%! > >> // inner class > >> class SomeClass > >> { > >> public double dSomeDouble; > >> > >> public SomeClass(double dSomeDouble) > >> { > >> // label: point 2 > >> this.dSomeDouble = dSomeDouble; > >> // some other data members > >> } > >> } > >> %> > >> > >> <% > >> // execute some query to get info, get results as JDBC ResultSet > >> oResult > >> > >> Vector oVecResults = new Vector() > >> double dDoubleVal = oResult.getDobule(1); > >> // label: point 1 (dDobuleVal is intact) > >> > >> oVecResults.add(new SomeClass(dDoubleVal)); > >> // label: point 3 > >> %> > >> > >> ---- END JSP ---- > >> > >> At "point 1" the values retrieved from the database are > intact, and remain > >> so until passed into the constructor of the inner class. > At "point 2" > >> dSomeDouble becomes corrupt (some random number out of memory), and > > remains > >> so past "point 3". > >> > >> Added twist: This problem only occurs after a page has > been hit 5 times > > (3 > >> times for larger pages). (1st time, Tomcat compiles the > page, next four > >> times the page is loaded in memory). > >> > >> Config: Apache Tomcat 4.0.1 (exact same problem found in Linux and > > Windows > >> versions). > >> > >> Any ideas? Extracting the inner class from the page fixes > the problem, > > but > >> is not a desired solution. Any help is appreciated. > >> > >> -- -- To unsubscribe, e-mail: <mailto:[EMAIL PROTECTED]> For additional commands, e-mail: <mailto:[EMAIL PROTECTED]>
