Buggy code:
public class MigrationJob implements Runnable { private static final Logger LOGGER = LoggerFactory . getLogger ( MigrationJob . class ) ; public MigrationJob ( ) { } public MigrationJob ( MigrationConfiguration migrationConfiguration ) { } private String sourceConfigPath ; private String destinationConfigPath ; private LightblueClient sourceClient ; private LightblueClient destinationClient ; private MigrationConfiguration migrationConfiguration ; private List < MigrationJobExecution > jobExecutions ; MigrationJobExecution currentRun ; private String _id ; private String owner ; private String hostName ; private String pid ; private Date startDate ; private Date endDate ; private Date whenAvailableDate ; private int expectedExecutionMilliseconds ; private boolean hasInconsistentDocuments ; public String get_id ( ) { } public void set_id ( String _id ) { } public MigrationConfiguration getJobConfiguration ( ) { } public void setJobConfiguration ( MigrationConfiguration jobConfiguration ) { } private List < MigrationJobExecution > getJobExecutions ( ) { } public void setJobExecutions ( List < MigrationJobExecution > jobExecutions ) { } public LightblueClient getSourceClient ( ) { } public void setSourceClient ( LightblueClient client ) { } public LightblueClient getDestinationClient ( ) { } public void setDestinationClient ( LightblueClient client ) { } public void setOverwriteDestinationDocuments ( boolean overwriteDestinationDocuments ) { } public boolean shouldOverwriteDestinationDocuments ( ) { } public String getSourceConfigPath ( ) { } public void setSourceConfigPath ( String configPath ) { } public String getDestinationConfigPath ( ) { } public void setDestinationConfigPath ( String configPath ) { } public boolean hasInconsistentDocuments ( ) { } public String getConfigurationName ( ) { } public void setConfigurationName ( String configurationName ) { } public String getOwner ( ) { } public void setOwner ( String owner ) { } public String getHostName ( ) { } public void setHostName ( String hostName ) { } public String getPid ( ) { } public void setPid ( String pid ) { } public Date getStartDate ( ) { } public void setStartDate ( Date startDate ) { } public Date getEndDate ( ) { } public void setEndDate ( Date endDate ) { } public Date getWhenAvailableDate ( ) { } public void setWhenAvailableDate ( Date whenAvailable ) { } public int getExpectedExecutionMilliseconds ( ) { } public void setExpectedExecutionMilliseconds ( int expectedExecutionMilliseconds ) { } public int getDocumentsProcessed ( ) { } public int getConsistentDocuments ( ) { } public int getInconsistentDocuments ( ) { } public int getRecordsOverwritten ( ) { } @ Override public void run ( ) { } private void configureClients ( ) { } private LightblueResponse saveJobDetails ( ) { } private int overwriteLightblue ( List < JsonNode > documentsToOverwrite ) { DataSaveRequest saveRequest = new DataSaveRequest ( getJobConfiguration ( ) . getDestinationEntityName ( ) , getJobConfiguration ( ) . getDestinationEntityVersion ( ) ) ; <START_BUG> saveRequest . create ( documentsToOverwrite ) ; <END_BUG> List < Projection > projections = new ArrayList < > ( ) ; projections . add ( new FieldProjection ( "*" , true , true ) ) ; saveRequest . returns ( projections ) ; LightblueResponse response = callLightblue ( saveRequest ) ; return response . getJson ( ) . findValue ( "modifiedCount" ) . asInt ( ) ; } protected Map < String , JsonNode > getSourceDocuments ( ) { } protected Map < String , JsonNode > getDestinationDocuments ( Map < String , JsonNode > sourceDocuments ) { } protected List < JsonNode > getDocumentsToOverwrite ( Map < String , JsonNode > sourceDocuments , Map < String , JsonNode > destinationDocuments ) { } protected boolean documentsConsistent ( JsonNode sourceDocument , JsonNode destinationDocument ) { } protected Map < String , JsonNode > findSourceData ( LightblueRequest findRequest ) throws IOException { } protected Map < String , JsonNode > findDestinationData ( LightblueRequest findRequest ) throws IOException { } protected LinkedHashMap < String , JsonNode > getJsonNodeMap ( JsonNode [ ] results , List < String > entityKeyFields ) { } protected LightblueResponse callLightblue ( LightblueRequest request ) { } }

Fix:
saveRequest . create ( documentsToOverwrite . toArray ( ) ) ;