I need to rename the file which comes without extension, then i need to pass the the renamed file(with extension). But after renaming when im assigning the that object to new file object still i'm getting the old file object(file without extension) see below code
srcFileName = tempFile.getName();
file = new File(uploadDir + srcFileName);
indexF = srcFileName.lastIndexOf(".xml");
extFile = srcFileName.substring(indexF + 1, indexF + 4);
if (!extFile.equalsIgnoreCase("zip"))
{
if (indexF == -1)
{
extFile = "xml";
srcFileName = srcFileName + "." + extFile;
boolean rename = file.renameTo(new File(uploadDir + srcFileName));
File renamedFile = new File(uploadDir + srcFileName);
indexF = srcFileName.lastIndexOf(".xml");
extFile = srcFileName.substring(indexF + 1, indexF + 4);
long len = 0;
len = renamedFile.length();
debug("renamed file Length::" + len);
//tempFile=renamedFile;
allDetailsMap.put("listOfFiles", renamedFile);
}
}