#vulnerable code 
                              @Test
  public void testExceptionConfirmPattern() {
    try {
      final SqlLine line = new SqlLine();
      final ByteArrayOutputStream os = new ByteArrayOutputStream();
      assertThat(line.getOpts().getConfirm(), is(false));
      SqlLine.Status status =
          begin(line, os, false, "-e",
              "!set confirmPattern \"^(?i*:(TRUNCATE|ALTER))\"");
      assertThat(status, equalTo(SqlLine.Status.OK));
      assertThat(os.toString("UTF8"), containsString("invalid regex"));
      os.reset();
    } catch (Throwable e) {
      // fail
      throw new RuntimeException(e);
    }
  } 
                            #location 8 
                            #vulnerability type RESOURCE_LEAK
#fixed code
                              @Test
  public void testExceptionConfirmPattern() {
    try {
      final ByteArrayOutputStream os = new ByteArrayOutputStream();
      assertThat(sqlLine.getOpts().getConfirm(), is(false));
      SqlLine.Status status =
          begin(sqlLine, os, false, "-e",
              "!set confirmPattern \"^(?i*:(TRUNCATE|ALTER))\"");
      assertThat(status, equalTo(SqlLine.Status.OK));
      assertThat(os.toString("UTF8"), containsString("invalid regex"));
      os.reset();
    } catch (Throwable e) {
      // fail
      throw new RuntimeException(e);
    }
  }