Buggy code:
@ ManagedBean public class SshFileFactoryImpl implements SshFileFactory { private static final Log LOG = LogFactory . getLog ( SshFileFactoryImpl . class ) ; private final TropixObjectService tropixObjectService ; private final TropixFileCreator tropixFileCreator ; private final StorageManager storageManager ; private final FolderService folderService ; private static final String HOME_DIRECTORY_PATH = "//" + ( Locations . MY_HOME ) ; private static final String MY_GROUP_FOLDERS_PATH = "//" + ( Locations . MY_GROUP_FOLDERS ) ; private static final Set < String > META_OBJECT_PATHS = Sets . newHashSet ( "//" , SshFileFactoryImpl . HOME_DIRECTORY_PATH , SshFileFactoryImpl . MY_GROUP_FOLDERS_PATH ) ; @ Inject public SshFileFactoryImpl ( final TropixObjectService tropixObjectService , final TropixFileCreator tropixFileCreator , final StorageManager storageManager , final FolderService folderService ) { } public SshFile getFile ( final Credential credential , final String virtualPath ) { } class SshFileImpl implements SshFile { private final Credential credential ; private final String identity ; private final String virtualPath ; private final String absolutePath ; private final boolean isMetaLocation ; private FileMetadata fileMetadata ; private boolean fileMetadataSet = false ; private TropixObject object ; private void initObject ( ) { } private TropixObject getTropixObject ( final String path ) { } SshFileImpl ( final Credential credential , final String virtualPath ) { } SshFileImpl ( final Credential credential , final String virtualPath , final TropixObject object ) { } SshFileImpl ( final Credential credential , final String virtualPath , final TropixObject object , final FileMetadata fileMetadata ) { } public String getAbsolutePath ( ) { } public String getName ( ) { } public boolean isDirectory ( ) { } public boolean isFile ( ) { } public boolean doesExist ( ) { } private boolean internalDoesExist ( ) { } public boolean isRemovable ( ) { } public SshFile getParentFile ( ) { } public long getLastModified ( ) { } public boolean setLastModified ( final long time ) { } private boolean isTropixFile ( ) { } private String getFileId ( ) { } private void initFileMetadata ( ) { } public long getSize ( ) { } private InputStreamCoercible readFile ( ) { } public void truncate ( ) throws IOException { } public boolean delete ( ) { } public boolean move ( final SshFile destination ) { } public boolean isReadable ( ) { } private void log ( final String message ) { } public boolean isWritable ( ) { } public void handleClose ( ) throws IOException { } private boolean isMetaLocationOrRootFolder ( ) { } public boolean mkdir ( ) { } private TropixObject getParentFolder ( ) { } private boolean parentIsFolder ( ) { } private Folder parentAsFolder ( ) { } public OutputStream createOutputStream ( final long offset ) throws IOException { } public InputStream createInputStream ( final long offset ) throws IOException { } public List < SshFile > listSshFiles ( ) { } private < T extends TropixObject > void buildSshFiles ( final T [ ] objects , final ImmutableList . Builder < SshFile > children ) { final Map < String , Boolean > uniqueName = Maps . newHashMap ( ) ; for ( TropixObject object : objects ) { final String objectName = object . getName ( ) . toUpperCase ( ) ; if ( ! ( uniqueName . containsKey ( objectName ) ) ) { uniqueName . put ( objectName , true ) ; } else { uniqueName . put ( objectName , false ) ; } } final ImmutableList . Builder < TropixFile > tropixFilesBuilder = ImmutableList . builder ( ) ; final ImmutableList . Builder < String > tropixFileIds = ImmutableList . builder ( ) ; for ( TropixObject object : objects ) { if ( object instanceof TropixFile ) { TropixFile tropixFile = ( ( TropixFile ) ( object ) ) ; tropixFilesBuilder . add ( tropixFile ) ; tropixFileIds . add ( tropixFile . getFileId ( ) ) ; } else { final String name = object . getName ( ) ; final String derivedName = ( uniqueName . get ( name . toUpperCase ( ) ) ) ? name : String . format ( "%s<seq2seq4repair_space>[id:%s]" , name , object . getId ( ) ) ; final String childName = Utils . join ( virtualPath , derivedName ) ; SshFileFactoryImpl . LOG . debug ( String . format ( "Creating<seq2seq4repair_space>child<seq2seq4repair_space>with<seq2seq4repair_space>name<seq2seq4repair_space>[%s]" , childName ) ) ; children . add ( new SshFileFactoryImpl . SshFileImpl ( credential , childName , object ) ) ; } } final List < TropixFile > tropixFiles = tropixFilesBuilder . build ( ) ; if ( ! ( tropixFiles . isEmpty ( ) ) ) { final Iterator < FileMetadata > filesMetadataIterator = storageManager . getFileMetadata ( tropixFileIds . build ( ) , identity ) . iterator ( ) ; for ( final TropixFile tropixFile : tropixFiles ) { final String name = tropixFile . getName ( ) ; final String derivedName = ( uniqueName . get ( name . toUpperCase ( ) ) ) ? name : String . format ( "%s<seq2seq4repair_space>[id:%s]" , name , object . getId ( ) ) ; final String childName = Utils . join ( virtualPath , derivedName ) ; SshFileFactoryImpl . LOG . debug ( String . format ( "Creating<seq2seq4repair_space>child<seq2seq4repair_space>with<seq2seq4repair_space>name<seq2seq4repair_space>[%s]" , childName ) ) ; <START_BUG> children . add ( new SshFileFactoryImpl . SshFileImpl ( credential , childName , object , filesMetadataIterator . next ( ) ) ) ; <END_BUG> } } } private boolean isRoot ( ) { } private boolean isMyGroupFolders ( ) { } private boolean isRootGroupFolder ( ) { } private boolean isHomeDirectory ( ) { } public boolean create ( ) throws IOException { } public boolean isExecutable ( ) { } } }

Fix:
children . add ( new SshFileFactoryImpl . SshFileImpl ( credential , childName , tropixFile , filesMetadataIterator . next ( ) ) ) ;