Buggy code:
public void resetCacheStats ( String cacheName ) { } void flush ( LogInstant instant ) throws StandardException { } private void syncSideLog ( long bipLocation ) throws StandardException { } LogFactory getLogFactory ( ) { } RawStoreFactory getRawStoreFactory ( ) { } public String getRootDirectory ( ) { } Cacheable newContainerObject ( ) { } private void pageToDirty ( RawTransaction t , StoredPage page ) throws StandardException { } private PageActions getLoggablePageActions ( ) throws StandardException { } private AllocationActions getLoggableAllocationActions ( ) { } synchronized StorageFile getTempDirectory ( ) { } private synchronized void removeTempDirectory ( ) { } public StorageFile getContainerPath ( ContainerKey containerId , boolean stub ) { } private synchronized StorageFile getContainerPath ( ContainerKey containerId , boolean stub , int code ) { } public StorageFile getAlternateContainerPath ( ContainerKey containerId , boolean stub ) { } private synchronized void removeStubs ( ) { } public void stubFileToRemoveAfterCheckPoint ( StorageFile file , LogInstant logInstant , Object identity ) { } public void removeDroppedContainerFileStubs ( LogInstant redoLWM ) throws StandardException { } private synchronized long findMaxContainerId ( ) { } private void bootLogFactory ( boolean create , Properties startParams ) throws StandardException { } private boolean handleServiceType ( Properties startParams , String type ) { } private void getJBMSLockOnDB ( UUID myUUID , UUIDFactory uuidFactory , String databaseDirectory ) throws StandardException { } private void privGetJBMSLockOnDB ( ) throws StandardException { } private void releaseJBMSLockOnDB ( ) { } private void privReleaseJBMSLockOnDB ( ) throws IOException { } private void logMsg ( String msg ) { } public final boolean databaseEncrypted ( ) { } public int encrypt ( byte [ ] cleartext , int offset , int length , byte [ ] ciphertext , int outputOffset ) throws StandardException { } public int decrypt ( byte [ ] ciphertext , int offset , int length , byte [ ] cleartext , int outputOffset ) throws StandardException { } public int getEncryptionBlockSize ( ) { } public String getVersionedName ( String name , long generationId ) { } public long getMaxContainerId ( ) throws StandardException { } synchronized long getNextId ( ) { } int random ( ) { } void fileToRemove ( StorageFile file , boolean remove ) { } public void postRecovery ( ) throws StandardException { } public void freezePersistentStore ( ) throws StandardException { } public void unfreezePersistentStore ( ) { } public void writeInProgress ( ) throws StandardException { } public void writeFinished ( ) { } private void restoreDataDirectory ( String backupPath ) throws StandardException { } private void privRestoreDataDirectory ( ) throws StandardException { } public boolean isReadOnly ( ) { } public StorageFactory getStorageFactory ( ) { } public Object run ( ) throws Exception { switch ( actionCode ) { case BaseDataFileFactory . BOOT_ACTION : readOnly = storageFactory . isReadOnlyDatabase ( ) ; supportsRandomAccess = storageFactory . supportsRandomAccess ( ) ; return null ; case BaseDataFileFactory . GET_TEMP_DIRECTORY_ACTION : return storageFactory . getTempDir ( ) ; case BaseDataFileFactory . REMOVE_TEMP_DIRECTORY_ACTION : StorageFile tempDir = storageFactory . getTempDir ( ) ; if ( tempDir != null ) tempDir . deleteAll ( ) ; return null ; case BaseDataFileFactory . GET_CONTAINER_PATH_ACTION : case BaseDataFileFactory . GET_ALTERNATE_CONTAINER_PATH_ACTION : { StringBuffer sb = new StringBuffer ( "seg" ) ; sb . append ( containerId . getSegmentId ( ) ) ; sb . append ( storageFactory . getSeparator ( ) ) ; if ( ( actionCode ) == ( BaseDataFileFactory . GET_CONTAINER_PATH_ACTION ) ) { sb . append ( ( stub ? 'd' : 'c' ) ) ; sb . append ( Long . toHexString ( containerId . getContainerId ( ) ) ) ; sb . append ( ".dat" ) ; } else { sb . append ( ( stub ? 'D' : 'C' ) ) ; <START_BUG> sb . append ( containerId . getContainerId ( ) ) ; <END_BUG> sb . append ( ".DAT" ) ; } return storageFactory . newStorageFile ( sb . toString ( ) ) ; } case BaseDataFileFactory . REMOVE_STUBS_ACTION : { char separator = storageFactory . getSeparator ( ) ; StorageFile root = storageFactory . newStorageFile ( null ) ; String [ ] segs = root . list ( ) ; for ( int s = ( segs . length ) - 1 ; s >= 0 ; s -- ) { if ( segs [ s ] . startsWith ( "seg" ) ) { StorageFile seg = storageFactory . newStorageFile ( root , segs [ s ] ) ; if ( ( seg . exists ( ) ) && ( seg . isDirectory ( ) ) ) { String [ ] files = seg . list ( ) ; for ( int f = ( files . length ) - 1 ; f >= 0 ; f -- ) { if ( ( files [ f ] . startsWith ( "D" ) ) || ( files [ f ] . startsWith ( "d" ) ) ) { StorageFile stub = storageFactory . newStorageFile ( root , ( ( ( segs [ s ] ) + separator ) + ( files [ f ] ) ) ) ; stub . delete ( ) ; } } } } } break ; } case BaseDataFileFactory . FIND_MAX_CONTAINER_ID_ACTION : { long maxnum = 1 ; StorageFile seg = storageFactory . newStorageFile ( "seg0" ) ; if ( ( seg . exists ( ) ) && ( seg . isDirectory ( ) ) ) { String [ ] files = seg . list ( ) ; for ( int f = ( files . length ) - 1 ; f >= 0 ; f -- ) { try { long fileNumber = Long . parseLong ( files [ f ] . substring ( 1 , ( ( files [ f ] . length ( ) ) - 4 ) ) , 16 ) ; if ( fileNumber > maxnum ) maxnum = fileNumber ; }

Fix:
sb . append ( Long . toHexString ( containerId . getContainerId ( ) ) ) ;