#vulnerable code 
                              public void testRetryForResult() {
    // Given retry for null
    inv = new AsyncExecution(callable, new RetryPolicy().retryWhen(null), scheduler, future, null);

    // When / Then
    assertFalse(inv.complete(null));
    assertTrue(inv.retryFor(null));
    inv.prepare();
    assertFalse(inv.retryFor(1));

    // Then
    assertEquals(inv.getExecutions(), 2);
    assertTrue(inv.isComplete());
    assertEquals(inv.getLastResult(), Integer.valueOf(1));
    assertNull(inv.getLastFailure());
    verifyScheduler(1);
    verify(future).complete(1, null, true);

    // Given 2 max retries
    inv = new AsyncExecution(callable, new RetryPolicy().retryWhen(null).withMaxRetries(1), scheduler, future, null);

    // When / Then
    resetMocks();
    assertFalse(inv.complete(null));
    inv.prepare();
    assertTrue(inv.retryFor(null));
    inv.prepare();
    assertFalse(inv.retryFor(null));

    // Then
    assertEquals(inv.getExecutions(), 2);
    assertTrue(inv.isComplete());
    assertNull(inv.getLastResult());
    assertNull(inv.getLastFailure());
    verifyScheduler(1);
    verify(future).complete(null, null, false);
  } 
                            #location 8 
                            #vulnerability type NULL_DEREFERENCE
#fixed code
                              public void testRetryForResult() {
    // Given retry for null
    exec = new AsyncExecution(callable, new RetryPolicy().retryWhen(null), scheduler, future, null);

    // When / Then
    assertFalse(exec.complete(null));
    assertTrue(exec.retryFor(null));
    exec.prepare();
    assertFalse(exec.retryFor(1));

    // Then
    assertEquals(exec.getExecutions(), 2);
    assertTrue(exec.isComplete());
    assertEquals(exec.getLastResult(), Integer.valueOf(1));
    assertNull(exec.getLastFailure());
    verifyScheduler(1);
    verify(future).complete(1, null, true);

    // Given 2 max retries
    exec = new AsyncExecution(callable, new RetryPolicy().retryWhen(null).withMaxRetries(1), scheduler, future, null);

    // When / Then
    resetMocks();
    assertFalse(exec.complete(null));
    exec.prepare();
    assertTrue(exec.retryFor(null));
    exec.prepare();
    assertFalse(exec.retryFor(null));

    // Then
    assertEquals(exec.getExecutions(), 2);
    assertTrue(exec.isComplete());
    assertNull(exec.getLastResult());
    assertNull(exec.getLastFailure());
    verifyScheduler(1);
    verify(future).complete(null, null, false);
  }