#vulnerable code 
                              @Test
  public void testNPE() {
    SqlLine sqlLine = new SqlLine();

    ByteArrayOutputStream os = new ByteArrayOutputStream();
    PrintStream sqllineOutputStream = getPrintStream(os);
    sqlLine.setOutputStream(sqllineOutputStream);
    sqlLine.setErrorStream(sqllineOutputStream);

    try {
      sqlLine.runCommands(new DispatchCallback(), "!typeinfo");
      String output = os.toString("UTF8");
      assertThat(
          output, not(containsString("java.lang.NullPointerException")));
      assertThat(output, containsString("No current connection"));

      sqlLine.runCommands(new DispatchCallback(), "!nativesql");
      output = os.toString("UTF8");
      assertThat(
          output, not(containsString("java.lang.NullPointerException")));
      assertThat(output, containsString("No current connection"));
    } catch (Exception e) {
      // fail
      throw new RuntimeException(e);
    }
  } 
                            #location 7 
                            #vulnerability type RESOURCE_LEAK
#fixed code
                              @Test
  public void testNPE() {
    ByteArrayOutputStream os = new ByteArrayOutputStream();
    PrintStream sqllineOutputStream = getPrintStream(os);
    sqlLine.setOutputStream(sqllineOutputStream);
    sqlLine.setErrorStream(sqllineOutputStream);

    try {
      sqlLine.runCommands(new DispatchCallback(), "!typeinfo");
      String output = os.toString("UTF8");
      assertThat(
          output, not(containsString("java.lang.NullPointerException")));
      assertThat(output, containsString("No current connection"));

      sqlLine.runCommands(new DispatchCallback(), "!nativesql");
      output = os.toString("UTF8");
      assertThat(
          output, not(containsString("java.lang.NullPointerException")));
      assertThat(output, containsString("No current connection"));
    } catch (Exception e) {
      // fail
      throw new RuntimeException(e);
    }
  }