title: Scope of variable (Is it not set)? [Java]
body: <p>So I'm trying to store the cookies of one connection, and then re-use them in the future. However, it seems as when I set the cookies and then call the next function, they seem to disappear.</p>
  
  <p>Main.java</p>
  
  <pre><code>Bumper thread = Threads.get(x); //looping through a list
  thread.login();
  thread.bump(); 
  </code></pre>
  
  <p>Bumper.java</p>
  
  <pre><code>public class Bumper {
      CookieStore cookies;
  
      public void setCookies(CookieStore cookie){
          this.cookies = cookie;
      }
  
      public CookieStore getCookyz(){
          return this.cookies;
      }
  
      public void login() throws Exception {
  
      HttpClient httpClient = new HttpClient();
      httpClient.setFollowRedirects(false);
      httpClient.start();
  
      Fields fieldForm = new Fields();
  
      fieldForm.add("do","login");
      fieldForm.add("url","");
      fieldForm.add("vb_login_md5password", this.password);
      fieldForm.add("vb_login_md5password_utf", this.password);
      fieldForm.add("s", "");
      fieldForm.add("vb_login_username", this.username);
      fieldForm.add("vb_login_password", "");
  
      FormContentProvider form = new FormContentProvider(fieldForm);
  
  
      ContentResponse response = httpClient.POST("http://www.sythe.org/login.php?do=login")
              .agent("Mozilla/5.0")
              .content(form)
              .send();
  
            this.setCookies(httpClient.getCookieStore());
              for(HttpCookie c : this.getCookyz().getCookies())
                  System.out.println(c.toString());
            System.out.println("Logged In");
      }
  
      public void bump() throws Exception {           
              for(HttpCookie c : this.getCookyz().getCookies())
                  System.out.println(c.toString());
              System.out.println("Bumped"); 
      }
  }
  </code></pre>
  
  <p>What is output</p>
  
  <pre><code>  __cfduid=d059a09bfabef0a5bae2e318891450085011
      bblastvisit=14505011
      bblastactivity=0
      bbsessionhash=7b6c57cd6a62a20e144cd
      Logged In (The termination of the Login function)
      Bumped (The termination of the Bump function)
  </code></pre>
  
  <p>Where on earth did the cookies go from one function to the other? Why are they not preserved? It prints the cookies in one function(login), but then seem to be non-existent in the next (bump).</p>
  
  <p>I have tried putting different identifiers on the "cookies" variable to no avail. Any ideas?</p>