You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@tomcat.apache.org by Jack Lauman <jl...@nwcascades.com> on 2004/09/12 04:47:46 UTC

error: duplicate local variable

I have the following piece of code that changes a password.  Eclipse 
gives the following
error message for line 11: duplicate local variable 'values'

Any help would be appreciated.

Thanks,

Jack


else if(pathInfo.equals("/changePassword")) {
   sql.setSqlValue("SELECT * FROM User WHERE UserID = ? AND Password = 
MD5(?)");
      List values = new ArrayList();
      values.add(request.getParameter("userName"));
      values.add(request.getParameter("oldPassword"));
      sql.setValues(values);
      Result res = sql.executeQuery();
      if(res != null && res.getRowCount() > 0)
         {
          sql.setSqlValue("UPDATE User SET Password = MD5(?) WHERE 
UserID = ?");
            List values = new ArrayList();             <<< Error 
duplicate local variable 'values'
            values.add(request.getParameter("newPassword"));
            values.add(request.getParameter("userName"));
            sql.setValues(values);
            sql.executeUpdate();
            result = 1;
            }
            else{
               response.sendError(500, "Incorrect old password.");
               }
            }


---------------------------------------------------------------------
To unsubscribe, e-mail: tomcat-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: tomcat-user-help@jakarta.apache.org


AW: error: duplicate local variable

Posted by SH Solutions <sh...@gmx.net>.
Hi

> You already had declared another List named "values" just a few lines
above, as shown in the edited version below:

Though it should work, since the second "values" is in another scope.

Regards,
  Steffen


---------------------------------------------------------------------
To unsubscribe, e-mail: tomcat-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: tomcat-user-help@jakarta.apache.org


Re: error: duplicate local variable

Posted by Kelly Denehy <kd...@gmail.com>.
You already had declared another List named "values" just a few lines
above, as shown in the edited version below:

On Sat, 11 Sep 2004 19:47:46 -0700, Jack Lauman <jl...@nwcascades.com> wrote:
> I have the following piece of code that changes a password.  Eclipse
> gives the following
> error message for line 11: duplicate local variable 'values'
>
>       List values = new ArrayList();
>       if(res != null && res.getRowCount() > 0)
>          {
>             List values = new ArrayList();             <<< Error
> duplicate local variable 'values'

---------------------------------------------------------------------
To unsubscribe, e-mail: tomcat-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: tomcat-user-help@jakarta.apache.org