Program: 7192
Project: 7192
Buggy source:
/** 
 * Reads events from a stream
 * @param streamId ID of the stream
 * @param startTime Timestamp in milliseconds to start reading event from (inclusive)
 * @param endTime Timestamp in milliseconds for the last event to read (exclusive)
 * @param limit Maximum number of events to read
 * @param callback Callback to invoke for each stream event read. If the callback function returns {@code false}upon invocation, it will stops the reading
 * @throws IOException If fails to read from stream
 * @throws StreamNotFoundException If the given stream does not exists
 */
public void getEvents(String streamId,long startTime,long endTime,int limit,Function<? super StreamEvent,Boolean> callback) throws IOException, StreamNotFoundException, UnauthorizedException {
  URL url=config.resolveNamespacedURLV3(String.format("String_Node_Str",streamId,startTime,endTime,limit));
  HttpURLConnection urlConn=(HttpURLConnection)url.openConnection();
  AccessToken accessToken=config.getAccessToken();
  if (accessToken != null) {
    urlConn.setRequestProperty(HttpHeaders.AUTHORIZATION,accessToken.getTokenType() + "String_Node_Str" + accessToken.getValue());
  }
  if (urlConn instanceof HttpsURLConnection && !config.isVerifySSLCert()) {
    try {
      HttpRequests.disableCertCheck((HttpsURLConnection)urlConn);
    }
 catch (    Exception e) {
    }
  }
  try {
    if (urlConn.getResponseCode() == HttpURLConnection.HTTP_UNAUTHORIZED) {
      throw new UnauthorizedException("String_Node_Str");
    }
    if (urlConn.getResponseCode() == HttpURLConnection.HTTP_NOT_FOUND) {
      throw new StreamNotFoundException(streamId);
    }
    if (urlConn.getResponseCode() == HttpURLConnection.HTTP_NO_CONTENT) {
      return;
    }
    JsonReader jsonReader=new JsonReader(new InputStreamReader(urlConn.getInputStream(),Charsets.UTF_8));
    jsonReader.beginArray();
    while (jsonReader.peek() != JsonToken.END_ARRAY) {
      Boolean result=callback.apply(GSON.<StreamEvent>fromJson(jsonReader,StreamEvent.class));
      if (result == null || !result) {
        break;
      }
    }
  }
  finally {
    urlConn.disconnect();
  }
}

Fixed version (ground truth):
/** 
 * Reads events from a stream
 * @param streamId ID of the stream
 * @param startTime Timestamp in milliseconds to start reading event from (inclusive)
 * @param endTime Timestamp in milliseconds for the last event to read (exclusive)
 * @param limit Maximum number of events to read
 * @param callback Callback to invoke for each stream event read. If the callback function returns {@code false}upon invocation, it will stops the reading
 * @throws IOException If fails to read from stream
 * @throws StreamNotFoundException If the given stream does not exists
 */
public void getEvents(String streamId,long startTime,long endTime,int limit,Function<? super StreamEvent,Boolean> callback) throws IOException, StreamNotFoundException, UnauthorizedException {
  URL url=config.resolveNamespacedURLV3(String.format("String_Node_Str",streamId,startTime,endTime,limit));
  HttpURLConnection urlConn=(HttpURLConnection)url.openConnection();
  AccessToken accessToken=config.getAccessToken();
  if (accessToken != null) {
    urlConn.setRequestProperty(HttpHeaders.AUTHORIZATION,accessToken.getTokenType() + "String_Node_Str" + accessToken.getValue());
  }
  if (urlConn instanceof HttpsURLConnection && !config.isVerifySSLCert()) {
    try {
      HttpRequests.disableCertCheck((HttpsURLConnection)urlConn);
    }
 catch (    Exception e) {
    }
  }
  try {
    if (urlConn.getResponseCode() == HttpURLConnection.HTTP_UNAUTHORIZED) {
      throw new UnauthorizedException("String_Node_Str");
    }
    if (urlConn.getResponseCode() == HttpURLConnection.HTTP_NOT_FOUND) {
      throw new StreamNotFoundException(streamId);
    }
    if (urlConn.getResponseCode() == HttpURLConnection.HTTP_NO_CONTENT) {
      return;
    }
    InputStream inputStream=urlConn.getInputStream();
    JsonReader jsonReader=new JsonReader(new InputStreamReader(inputStream,Charsets.UTF_8));
    jsonReader.beginArray();
    while (jsonReader.peek() != JsonToken.END_ARRAY) {
      Boolean result=callback.apply(GSON.<StreamEvent>fromJson(jsonReader,StreamEvent.class));
      if (result == null || !result) {
        break;
      }
    }
    drain(inputStream);
  }
  finally {
    urlConn.disconnect();
  }
}