Buggy code:
public class IndexBatchCreator { protected static final Log log = LogUtil . getLog ( IndexBatchCreator . class ) ; private static final double MIN_SIZE_TO_UPLOAD = 0.015 ; private static final double MAX_SIZE_TO_NOT_SPLIT = 190.0 ; private static final double MAX_UPLOAD_SIZE = 195.0 ; public static class RegionCountries { String namePrefix = "" ; String nameSuffix = "" ; Map < String , IndexBatchCreator . RegionSpecificData > regionNames = new LinkedHashMap < String , IndexBatchCreator . RegionSpecificData > ( ) ; String siteToDownload = "" ; } private static class RegionSpecificData { public String cityAdminLevel ; } private boolean uploadToOsmandGooglecode = true ; boolean downloadFiles = false ; boolean generateIndexes = false ; boolean uploadIndexes = false ; boolean skipGeneratedIndexes = false ; MapZooms mapZooms = null ; Integer zoomWaySmoothness = null ; MapRenderingTypes types = MapRenderingTypes . getDefault ( ) ; boolean deleteFilesAfterUploading = true ; File osmDirFiles ; File indexDirFiles ; File workDir ; File backupUploadedFiles ; boolean indexPOI = false ; boolean indexTransport = false ; boolean indexAddress = false ; boolean indexMap = false ; String user ; String password ; private String wget ; String googlePassword = "" ; String cookieHSID = "" ; String cookieSID = "" ; String pagegen = "" ; String token = "" ; public static void main ( String [ ] args ) { } public void runBatch ( Document doc , Document regions ) throws IOException , ParserConfigurationException , SAXException { } private void parseCountriesToDownload ( Document doc , List < IndexBatchCreator . RegionCountries > countriesToDownload ) { } private void parseProcessAttributes ( Element process ) { } public void runBatch ( List < IndexBatchCreator . RegionCountries > countriesToDownload ) { } protected void downloadFilesAndGenerateIndex ( List < IndexBatchCreator . RegionCountries > countriesToDownload , Set < String > alreadyGeneratedFiles , Set < String > alreadyUploadedFiles ) { for ( IndexBatchCreator . RegionCountries regionCountries : countriesToDownload ) { String prefix = regionCountries . namePrefix ; String site = regionCountries . siteToDownload ; String suffix = regionCountries . nameSuffix ; for ( String name : regionCountries . regionNames . keySet ( ) ) { name = name . toLowerCase ( ) ; IndexBatchCreator . RegionSpecificData regionSpecificData = regionCountries . regionNames . get ( name ) ; String url = MessageFormat . format ( site , name ) ; String regionName = prefix + name ; <START_BUG> String fileName = ( prefix + name ) + suffix ; <END_BUG> File bmif = new File ( indexDirFiles , ( ( ( fileName + "_" ) + ( IndexConstants . BINARY_MAP_VERSION ) ) + ( IndexConstants . BINARY_MAP_INDEX_EXT ) ) ) ; if ( ( skipGeneratedIndexes ) && ( bmif . exists ( ) ) ) { continue ; } File toSave = downloadFile ( url , fileName , alreadyGeneratedFiles , alreadyUploadedFiles ) ; if ( ( toSave != null ) && ( generateIndexes ) ) { generateIndex ( toSave , regionName , regionSpecificData , alreadyGeneratedFiles , alreadyUploadedFiles ) ; } } } System . out . println ( "DOWNLOADING<seq2seq4repair_space>FILES<seq2seq4repair_space>FINISHED" ) ; } protected File downloadFile ( String url , String regionName , Set < String > alreadyGeneratedFiles , Set < String > alreadyUploadedFiles ) { } private File wgetDownload ( String url , File toSave ) { } private static final int DOWNLOAD_DEBUG = 1 << 20 ; private static final int MB = 1 << 20 ; private static final int BUFFER_SIZE = 1 << 15 ; private File internalDownload ( String url , File toSave ) { } private static void safeClose ( Closeable ostream , String message ) { } protected void generatedIndexes ( Set < String > alreadyGeneratedFiles , Set < String > alreadyUploadedFiles ) { } protected void generateIndex ( File f , String rName , IndexBatchCreator . RegionSpecificData regionSpecificData , Set < String > alreadyGeneratedFiles , Set < String > alreadyUploadedFiles ) { } protected File [ ] getSortedFiles ( File dir ) { } protected void uploadIndexes ( Set < String > alreadyUploadedFiles ) { } protected void uploadIndex ( final File f , Set < String > alreadyUploadedFiles ) { } private List < File > splitFiles ( File f ) throws IOException { } private boolean uploadFileToServer ( File f , File original , String summary ) throws IOException { } @ SuppressWarnings ( "deprecation" ) private void uploadToDownloadOsmandNet ( File f , String description , String size , String date ) throws IOException { } }

Fix:
String fileName = Algoritms . capitalizeFirstLetterAndLowercase ( ( ( prefix + name ) + suffix ) ) ;