Buggy code:
private static final byte [ ] GENERIC_FILER_TIME_INDEX_KEY = new byte [ ] { 0 } ; private static final byte [ ] GENERIC_FILER_SIP_INDEX_KEY = new byte [ ] { 1 } ; private final MiruSchemaProvider schemaProvider ; private final MiruActivityInternExtern activityInternExtern ; private final MiruReadTrackingWALReader readTrackingWALReader ; private final Map < MiruBackingStorage , MiruChunkAllocator > allocators ; private final MiruResourceLocator diskResourceLocator ; private final MiruBackingStorage defaultStorage ; private final int partitionAuthzCacheSize ; private final StripingLocksProvider < MiruTermId > fieldIndexStripingLocksProvider ; private final StripingLocksProvider < MiruStreamId > streamStripingLocksProvider ; private final StripingLocksProvider < String > authzStripingLocksProvider ; public MiruContextFactory ( MiruSchemaProvider schemaProvider , MiruActivityInternExtern activityInternExtern , MiruReadTrackingWALReader readTrackingWALReader , Map < MiruBackingStorage , MiruChunkAllocator > allocators , MiruResourceLocator diskResourceLocator , MiruBackingStorage defaultStorage , int partitionAuthzCacheSize , StripingLocksProvider < MiruTermId > fieldIndexStripingLocksProvider , StripingLocksProvider < MiruStreamId > streamStripingLocksProvider , StripingLocksProvider < String > authzStripingLocksProvider ) { } public MiruBackingStorage findBackingStorage ( MiruPartitionCoord coord ) throws Exception { } private MiruChunkAllocator getAllocator ( MiruBackingStorage storage ) { } public < BM > MiruContext < BM > allocate ( MiruBitmaps < BM > bitmaps , MiruPartitionCoord coord , MiruBackingStorage storage ) throws Exception { } private < BM > MiruContext < BM > allocate ( MiruBitmaps < BM > bitmaps , MiruPartitionCoord coord , ChunkStore [ ] chunkStores ) throws Exception { MiruSchema schema = schemaProvider . getSchema ( coord . tenantId ) ; KeyedFilerStore genericFilerStore = new TxKeyedFilerStore ( chunkStores , keyBytes ( "generic" ) ) ; MiruFilerTimeIndex timeIndex = new MiruFilerTimeIndex ( Optional . < MiruFilerTimeIndex . TimeOrderAnomalyStream > absent ( ) , new com . jivesoftware . os . miru . service . index . KeyedFilerProvider ( genericFilerStore , MiruContextFactory . GENERIC_FILER_TIME_INDEX_KEY ) , new com . jivesoftware . os . filer . keyed . store . TxKeyValueStore ( chunkStores , new LongIntKeyValueMarshaller ( ) , keyBytes ( "timeIndex-timestamps" ) , 8 , false , 4 , false ) ) ; TxKeyedFilerStore activityFilerStore = new TxKeyedFilerStore ( chunkStores , keyBytes ( "activityIndex" ) ) ; MiruFilerActivityIndex activityIndex = new MiruFilerActivityIndex ( activityFilerStore , new MiruInternalActivityMarshaller ( ) , new com . jivesoftware . os . miru . service . index . KeyedFilerProvider ( activityFilerStore , keyBytes ( "activityIndex-size" ) ) ) ; @ SuppressWarnings ( "unchecked" ) MiruFilerFieldIndex < BM > [ ] fieldIndexes = new MiruFilerFieldIndex [ MiruFieldType . values ( ) . length ] ; for ( MiruFieldType fieldType : MiruFieldType . values ( ) ) { KeyedFilerStore [ ] indexes = new KeyedFilerStore [ schema . fieldCount ( ) ] ; for ( MiruFieldDefinition fieldDefinition : schema . getFieldDefinitions ( ) ) { int fieldId = fieldDefinition . fieldId ; if ( ( ( ( fieldType == ( MiruFieldType . latest ) ) && ( ! ( fieldDefinition . indexLatest ) ) ) || ( ( fieldType == ( MiruFieldType . pairedLatest ) ) && ( fieldDefinition . pairedLatestFieldNames . isEmpty ( ) ) ) ) || ( ( fieldType == ( MiruFieldType . bloom ) ) && ( fieldDefinition . bloomFieldNames . isEmpty ( ) ) ) ) { indexes [ fieldId ] = null ; } else { indexes [ fieldId ] = new TxKeyedFilerStore ( chunkStores , keyBytes ( ( ( ( "field-" + ( fieldType . name ( ) ) ) + "-" ) + fieldId ) ) ) ; } } fieldIndexes [ fieldType . getIndex ( ) ] = new MiruFilerFieldIndex ( bitmaps , indexes , fieldIndexStripingLocksProvider ) ; } MiruFieldIndexProvider < BM > fieldIndexProvider = new MiruFieldIndexProvider ( fieldIndexes ) ; MiruSipIndex sipIndex = new MiruFilerSipIndex ( new com . jivesoftware . os . miru . service . index . KeyedFilerProvider ( genericFilerStore , MiruContextFactory . GENERIC_FILER_SIP_INDEX_KEY ) ) ; MiruAuthzUtils < BM > authzUtils = new MiruAuthzUtils ( bitmaps ) ; Cache < VersionedAuthzExpression , BM > authzCache = CacheBuilder . newBuilder ( ) . maximumSize ( partitionAuthzCacheSize ) . expireAfterAccess ( 1 , TimeUnit . MINUTES ) . build ( ) ; MiruFilerAuthzIndex < BM > authzIndex = new MiruFilerAuthzIndex ( bitmaps , new TxKeyedFilerStore ( chunkStores , keyBytes ( "authzIndex" ) ) , new com . jivesoftware . os . miru . service . index . auth . MiruAuthzCache ( bitmaps , authzCache , activityInternExtern , authzUtils ) , authzStripingLocksProvider ) ; MiruFilerRemovalIndex < BM > removalIndex = new MiruFilerRemovalIndex ( bitmaps , new TxKeyedFilerStore ( chunkStores , keyBytes ( "removalIndex" ) ) , new byte [ ] { 0 } , ( - 1 ) , new Object ( ) ) ; MiruFilerUnreadTrackingIndex < BM > unreadTrackingIndex = new MiruFilerUnreadTrackingIndex ( bitmaps , new TxKeyedFilerStore ( chunkStores , keyBytes ( "unreadTrackingIndex" ) ) , streamStripingLocksProvider ) ; MiruFilerInboxIndex < BM > inboxIndex = new MiruFilerInboxIndex ( bitmaps , new TxKeyedFilerStore ( chunkStores , keyBytes ( "inboxIndex" ) ) , streamStripingLocksProvider ) ; StripingLocksProvider < MiruStreamId > streamLocks = new StripingLocksProvider ( 64 ) ; <START_BUG> return new MiruContext ( schema , timeIndex , activityIndex , fieldIndexProvider , sipIndex , authzIndex , removalIndex , unreadTrackingIndex , inboxIndex , readTrackingWALReader , activityInternExtern , streamLocks , Optional . < ChunkStore [ ] > absent ( ) , Optional . < MiruResourcePartitionIdentifier > absent ( ) ) ; <END_BUG> } public < BM > MiruContext < BM > copy ( MiruBitmaps < BM > bitmaps , MiruPartitionCoord coord , MiruContext < BM > from , MiruBackingStorage toStorage ) throws Exception { } public void markStorage ( MiruPartitionCoord coord , MiruBackingStorage marked ) throws Exception { } private boolean checkMarkedStorage ( MiruPartitionCoord coord , MiruBackingStorage storage ) throws Exception { } public void cleanDisk ( MiruPartitionCoord coord ) throws IOException { } public < BM > void close ( MiruContext < BM > context , MiruBackingStorage storage ) { } public < BM > void releaseCaches ( MiruContext < BM > context , MiruBackingStorage storage ) throws IOException { } private byte [ ] keyBytes ( String key ) { } }

Fix:
return new MiruContext ( schema , timeIndex , activityIndex , fieldIndexProvider , sipIndex , authzIndex , removalIndex , unreadTrackingIndex , inboxIndex , readTrackingWALReader , activityInternExtern , streamLocks , Optional . of ( chunkStores ) , Optional . < MiruResourcePartitionIdentifier > absent ( ) ) ;