if (this.ffsFileType.equals("")) {\r
throw new BuildException ("Must set ffsFileType!\n");\r
}\r
-\r
//\r
// Create ffs file. File name = FfsFileGuid + BaseName + ffsSuffix.\r
// If outputDir's value was set, file will output to the outputDir.\r
\r
String ffsFilePath = outputPath + this.ffsFileGuid + '-' + this.baseName + ffsSuffix;\r
File ffsFile = new File (ffsFilePath);\r
- genFfs(ffsFile);\r
+ try{\r
+ genFfs(ffsFile);\r
+ }catch (BuildException e){\r
+ if (ffsFile != null && ffsFile.exists()){\r
+ ffsFile.deleteOnExit();\r
+ }\r
+ throw new BuildException(e.getMessage());\r
+ \r
+ }\r
+ \r
} \r
\r
/**\r
@param ffsFile Name of FFS file.\r
@param isOrg Flag to indicate generate ORG ffs file or not.\r
**/\r
- private void genFfs(File ffsFile) {\r
+ private void genFfs(File ffsFile) throws BuildException {\r
Section sect;\r
int fileSize;\r
int fileDataSize;\r
//\r
sect.toBuffer((DataOutputStream)dataBuffer);\r
} catch (Exception e) {\r
+ if (dataBuffer != null){\r
+ dataBuffer.close();\r
+ }\r
throw new BuildException (e.getMessage());\r
}\r
}\r