#vulnerable code 
                              @Test
  public void testPromptWithNickname() {
    ByteArrayOutputStream os = new ByteArrayOutputStream();
    SqlLine sqlLine = new SqlLine();
    try {
      final SqlLine.Status status =
          begin(sqlLine, os, false, "-e", "!set maxwidth 80");
      assertThat(status, equalTo(SqlLine.Status.OK));
      final DispatchCallback dc = new DispatchCallback();
      sqlLine.runCommands(dc, "!connect "
          + SqlLineArgsTest.ConnectionSpec.H2.url + " "
          + SqlLineArgsTest.ConnectionSpec.H2.username + " \"\"");

      // custom prompt with data from connection
      final SqlLineOpts opts = sqlLine.getOpts();
      sqlLine.getDatabaseConnection().setNickname("nickname");
      opts.set(BuiltInProperty.PROMPT, "%u@%n>");
      opts.set(BuiltInProperty.RIGHT_PROMPT, "//%d%c");
      // if nickname is specified for the connection
      // it has more priority than prompt.
      // Right prompt does not care about nickname
      assertThat(sqlLine.getPromptHandler().getPrompt().toAnsi(),
          is("0: nickname> "));
      assertThat(sqlLine.getPromptHandler().getRightPrompt().toAnsi(),
          is("//H20"));
      sqlLine.getDatabaseConnection().close();
    } catch (Exception e) {
      // fail
      throw new RuntimeException(e);
    }
  } 
                            #location 7 
                            #vulnerability type RESOURCE_LEAK
#fixed code
                              @Test
  public void testPromptWithNickname() {
    ByteArrayOutputStream os = new ByteArrayOutputStream();
    try {
      final SqlLine.Status status =
          begin(sqlLine, os, false, "-e", "!set maxwidth 80");
      assertThat(status, equalTo(SqlLine.Status.OK));
      final DispatchCallback dc = new DispatchCallback();
      sqlLine.runCommands(dc, "!connect "
          + SqlLineArgsTest.ConnectionSpec.H2.url + " "
          + SqlLineArgsTest.ConnectionSpec.H2.username + " \"\"");

      // custom prompt with data from connection
      final SqlLineOpts opts = sqlLine.getOpts();
      sqlLine.getDatabaseConnection().setNickname("nickname");
      opts.set(BuiltInProperty.PROMPT, "%u@%n>");
      opts.set(BuiltInProperty.RIGHT_PROMPT, "//%d%c");
      // if nickname is specified for the connection
      // it has more priority than prompt.
      // Right prompt does not care about nickname
      assertThat(sqlLine.getPromptHandler().getPrompt().toAnsi(),
          is("0: nickname> "));
      assertThat(sqlLine.getPromptHandler().getRightPrompt().toAnsi(),
          is("//H20"));
      sqlLine.getDatabaseConnection().close();
    } catch (Exception e) {
      // fail
      throw new RuntimeException(e);
    }
  }