import org.tianocore.pcd.entity.UsageIdentification;\r
import org.tianocore.pcd.exception.EntityException;\r
import org.tianocore.pcd.action.PlatformPcdPreprocessAction;\r
+import org.tianocore.build.exception.PlatformPcdPreprocessBuildException;\r
+import org.tianocore.pcd.exception.PlatformPcdPreprocessException;\r
\r
/**\r
This action class is to collect PCD information from MSA, SPD, FPD xml file.\r
from buildAction or UIAction.\r
**/\r
public class PlatformPcdPreprocessActionForBuilding extends PlatformPcdPreprocessAction {\r
- ///\r
- /// Workspacepath hold the workspace information.\r
- ///\r
- private String workspacePath;\r
-\r
///\r
/// FPD file is the root file.\r
///\r
///\r
private PlatformSurfaceAreaDocument fpdDocInstance;\r
\r
- /**\r
- Set WorkspacePath parameter for this action class.\r
-\r
- @param workspacePath parameter for this action\r
- **/\r
- public void setWorkspacePath(String workspacePath) {\r
- this.workspacePath = workspacePath;\r
- }\r
-\r
/**\r
Set action message level for CollectPcdAction tool.\r
\r
/**\r
Common function interface for outer.\r
\r
- @param workspacePath The path of workspace of current build or analysis.\r
- @param fpdFilePath The fpd file path of current build or analysis.\r
- @param messageLevel The message level for this Action.\r
+ @param fpdFilePath The fpd file path of current build or analysis.\r
+ @param messageLevel The message level for this Action.\r
\r
- @throws Exception The exception of this function. Because it can *not* be predict\r
- where the action class will be used. So only Exception can be throw.\r
+ @throws PlatformPreprocessBuildException \r
+ The exception of this function. Because it can *not* be predict\r
+ where the action class will be used. So only Exception can be throw.\r
\r
**/\r
- public void perform(String workspacePath, String fpdFilePath,\r
- int messageLevel) throws Exception {\r
- setWorkspacePath(workspacePath);\r
+ public void perform(String fpdFilePath, int messageLevel) \r
+ throws PlatformPcdPreprocessBuildException {\r
setFPDFilePath(fpdFilePath);\r
setActionMessageLevel(messageLevel);\r
checkParameter();\r
@throws EntityException Exception indicate failed to execute this action.\r
\r
**/\r
- public void execute() throws EntityException {\r
- MemoryDatabaseManager pcdDbManager = null;\r
-\r
+ public void execute() throws PlatformPcdPreprocessBuildException {\r
+ String errorMessageHeader = "Fail to initialize Pcd memory database for building. Because:";\r
//\r
// Get memoryDatabaseManager instance from GlobalData.\r
- // The memoryDatabaseManager should be initialized for whatever build\r
- // tools or wizard tools\r
+ // The memoryDatabaseManager should be initialized as static variable\r
+ // in some Pre-process class.\r
//\r
- if((pcdDbManager = GlobalData.getPCDMemoryDBManager()) == null) {\r
- throw new EntityException("The instance of PCD memory database manager is null");\r
- }\r
-\r
- this.setPcdDbManager(pcdDbManager);\r
+ setPcdDbManager(GlobalData.getPCDMemoryDBManager());\r
\r
//\r
// Collect all PCD information defined in FPD file.\r
// Evenry token defind in FPD will be created as an token into\r
// memory database.\r
//\r
- initPcdMemoryDbWithPlatformInfo();\r
+ try {\r
+ initPcdMemoryDbWithPlatformInfo();\r
+ } catch (PlatformPcdPreprocessException exp) {\r
+ throw new PlatformPcdPreprocessBuildException(errorMessageHeader + exp.getMessage());\r
+ }\r
\r
//\r
// Generate for PEI, DXE PCD DATABASE's definition and initialization.\r
//\r
- genPcdDatabaseSourceCode ();\r
-\r
+ try {\r
+ genPcdDatabaseSourceCode ();\r
+ } catch (EntityException exp) {\r
+ throw new PlatformPcdPreprocessBuildException(errorMessageHeader + exp.getMessage());\r
+ }\r
}\r
\r
/**\r
@param guidCName Guid CName string.\r
\r
@return String[] Guid information from SPD file.\r
+ @throws PlatformPcdPreprocessException\r
+ Fail to get Guid information from SPD file.\r
**/\r
- public String[] getGuidInfoFromSpd(String guidCName) throws EntityException {\r
+ public String[] getGuidInfoFromSpd(String guidCName) throws PlatformPcdPreprocessException {\r
String[] tokenSpaceStrRet = null;\r
try {\r
tokenSpaceStrRet = GlobalData.getGuidInfoFromCname(guidCName);\r
} catch ( Exception e ) {\r
- throw new EntityException ("Failed get Guid CName " + guidCName + "from SPD file!");\r
+ throw new PlatformPcdPreprocessException ("Failed get Guid CName " + guidCName + "from SPD file!");\r
}\r
return tokenSpaceStrRet;\r
}\r
/**\r
This function generates source code for PCD Database.\r
\r
- @param void\r
@throws EntityException If the token does *not* exist in memory database.\r
\r
**/\r
\r
This function maybe provided by some Global class.\r
\r
- @return List<ModuleInfo> the component array.\r
+ @return List<ModuleInfo> the component array.\r
+ @throws PlatformPcdPreprocessException get all modules in <ModuleSA> in FPD file.\r
\r
- */\r
+ **/\r
public List<ModulePcdInfoFromFpd> getComponentsFromFpd()\r
- throws EntityException {\r
+ throws PlatformPcdPreprocessException {\r
List<ModulePcdInfoFromFpd> allModules = new ArrayList<ModulePcdInfoFromFpd>();\r
Map<FpdModuleIdentification, XmlObject> pcdBuildDefinitions = null;\r
UsageIdentification usageId = null;\r
Override function: Verify the datum value according its datum size and datum type, this\r
function maybe moved to FPD verification tools in future.\r
\r
- @param cName\r
- @param moduleName\r
- @param datum\r
- @param datumType\r
- @param maxDatumSize\r
+ @param cName The token name\r
+ @param moduleName The module who use this PCD token\r
+ @param datum The PCD's datum\r
+ @param datumType The PCD's datum type\r
+ @param maxDatumSize The max size for PCD's Datum.\r
\r
- @return String\r
+ @return String exception strings.\r
*/\r
- /***/\r
public String verifyDatum(String cName,\r
String moduleName,\r
String datum,\r
**/\r
public DynamicPcdBuildDefinitions.PcdBuildData getDynamicInfoFromFpd(Token token,\r
String moduleName)\r
- throws EntityException {\r
+ throws PlatformPcdPreprocessException {\r
int index = 0;\r
String exceptionString = null;\r
String dynamicPrimaryKey = null;\r
try {\r
fpdDocInstance = (PlatformSurfaceAreaDocument)XmlObject.Factory.parse(new File(fpdFilePath));\r
} catch(IOException ioE) {\r
- throw new EntityException("File IO error for xml file:" + fpdFilePath + "\n" + ioE.getMessage());\r
+ throw new PlatformPcdPreprocessException("File IO error for xml file:" + fpdFilePath + "\n" + ioE.getMessage());\r
} catch(XmlException xmlE) {\r
- throw new EntityException("Can't parse the FPD xml fle:" + fpdFilePath + "\n" + xmlE.getMessage());\r
+ throw new PlatformPcdPreprocessException("Can't parse the FPD xml fle:" + fpdFilePath + "\n" + xmlE.getMessage());\r
}\r
}\r
\r
"PCD entry %s in module %s!",\r
token.cName,\r
moduleName);\r
- throw new EntityException(exceptionString);\r
+ throw new PlatformPcdPreprocessException(exceptionString);\r
}\r
\r
dynamicPcdBuildDataArray = dynamicPcdBuildDefinitions.getPcdBuildDataList();\r
try {\r
tokenSpaceStrRet = GlobalData.getGuidInfoFromCname(dynamicPcdBuildDataArray.get(index).getTokenSpaceGuidCName());\r
} catch (Exception e) {\r
- throw new EntityException ("Fail to get token space guid for token " + dynamicPcdBuildDataArray.get(index).getCName());\r
+ throw new PlatformPcdPreprocessException ("Fail to get token space guid for token " + dynamicPcdBuildDataArray.get(index).getCName());\r
}\r
\r
if (tokenSpaceStrRet == null) {\r
- throw new EntityException ("Fail to get token space guid for token " + dynamicPcdBuildDataArray.get(index).getCName());\r
+ throw new PlatformPcdPreprocessException ("Fail to get token space guid for token " + dynamicPcdBuildDataArray.get(index).getCName());\r
}\r
\r
dynamicPrimaryKey = Token.getPrimaryKeyString(dynamicPcdBuildDataArray.get(index).getCName(),\r
/**\r
Override function: get all <DynamicPcdBuildDefinition> from FPD file.\r
\r
- @return List<DynamicPcdBuildDefinitions.PcdBuildData>\r
+ @return List<DynamicPcdBuildDefinitions.PcdBuildData> All DYNAMIC PCD list in <DynamicPcdBuildDefinitions> in FPD file.\r
+ @throws PlatformPcdPreprocessBuildException Failure to get dynamic information list.\r
+\r
**/\r
public List<DynamicPcdBuildDefinitions.PcdBuildData>\r
getAllDynamicPcdInfoFromFpd()\r
- throws EntityException {\r
+ throws PlatformPcdPreprocessException {\r
DynamicPcdBuildDefinitions dynamicPcdBuildDefinitions = null;\r
\r
//\r
try {\r
fpdDocInstance = (PlatformSurfaceAreaDocument)XmlObject.Factory.parse(new File(fpdFilePath));\r
} catch(IOException ioE) {\r
- throw new EntityException("File IO error for xml file:" + fpdFilePath + "\n" + ioE.getMessage());\r
+ throw new PlatformPcdPreprocessException("File IO error for xml file:" + fpdFilePath + "\n" + ioE.getMessage());\r
} catch(XmlException xmlE) {\r
- throw new EntityException("Can't parse the FPD xml fle:" + fpdFilePath + "\n" + xmlE.getMessage());\r
+ throw new PlatformPcdPreprocessException("Can't parse the FPD xml fle:" + fpdFilePath + "\n" + xmlE.getMessage());\r
}\r
}\r
\r
/**\r
check parameter for this action.\r
\r
- @throws EntityException Bad parameter.\r
+ @throws PlatformPcdPreprocessBuildException Bad parameter.\r
**/\r
- private void checkParameter() throws EntityException {\r
+ private void checkParameter() throws PlatformPcdPreprocessBuildException {\r
File file = null;\r
\r
- if((fpdFilePath == null) ||(workspacePath == null)) {\r
- throw new EntityException("WorkspacePath and FPDFileName should be blank for CollectPCDAtion!");\r
+ if (fpdFilePath == null) {\r
+ throw new PlatformPcdPreprocessBuildException("WorkspacePath and FPDFileName should be blank for CollectPCDAtion!");\r
}\r
\r
- if(fpdFilePath.length() == 0 || workspacePath.length() == 0) {\r
- throw new EntityException("WorkspacePath and FPDFileName should be blank for CollectPCDAtion!");\r
- }\r
-\r
- file = new File(workspacePath);\r
- if(!file.exists()) {\r
- throw new EntityException("WorkpacePath " + workspacePath + " does not exist!");\r
+ if (fpdFilePath.length() == 0) {\r
+ throw new PlatformPcdPreprocessBuildException("WorkspacePath and FPDFileName should be blank for CollectPCDAtion!");\r
}\r
\r
file = new File(fpdFilePath);\r
\r
if(!file.exists()) {\r
- throw new EntityException("FPD File " + fpdFilePath + " does not exist!");\r
+ throw new PlatformPcdPreprocessBuildException("FPD File " + fpdFilePath + " does not exist!");\r
}\r
}\r
\r
\r
@param argv parameter from command line\r
**/\r
- public static void main(String argv[]) throws EntityException {\r
+ public static void main(String argv[]) throws PlatformPcdPreprocessBuildException {\r
PlatformPcdPreprocessActionForBuilding ca = new PlatformPcdPreprocessActionForBuilding();\r
String projectDir = "x:/edk2";\r
- ca.setWorkspacePath(projectDir);\r
ca.setFPDFilePath(projectDir + "/EdkNt32Pkg/Nt32.fpd");\r
ca.setActionMessageLevel(ActionMessage.MAX_MESSAGE_LEVEL);\r
GlobalData.initInfo("Tools" + File.separator + "Conf" + File.separator + "FrameworkDatabase.db",\r
\r
import org.tianocore.DynamicPcdBuildDefinitionsDocument.DynamicPcdBuildDefinitions;\r
import org.tianocore.PcdBuildDefinitionDocument.PcdBuildDefinition;\r
-import org.tianocore.pcd.entity.MemoryDatabaseManager;\r
-import org.tianocore.pcd.exception.EntityException;\r
import org.tianocore.pcd.entity.*;\r
import org.tianocore.pcd.entity.Token;\r
+import org.tianocore.pcd.entity.MemoryDatabaseManager;\r
+import org.tianocore.pcd.exception.PlatformPcdPreprocessException;\r
\r
/**\r
The abstract parent class PlatformPcdPreprocessAction, This class is to collect platform's\r
\r
/**\r
Get parameter pcdDbManager\r
- \r
+\r
@return MemoryDatabaseManager\r
**/\r
public MemoryDatabaseManager getPcdDbManager() {\r
\r
In building environement, this function will be implementated by FpdParserTask.\r
\r
- @return List<ModuleInfoFromFpd>\r
+ @return List<ModuleInfo> the component array.\r
+ @throws PlatformPcdPreprocessException get all modules in <ModuleSA> in FPD file.\r
+\r
**/\r
public abstract List<ModulePcdInfoFromFpd> getComponentsFromFpd()\r
- throws EntityException;\r
+ throws PlatformPcdPreprocessException;\r
\r
/**\r
Abstract function to get GUID string from SPD file.\r
\r
@param guidCName the CName of GUID\r
\r
- @return String[] Guid Info array contains CName and Guid String\r
+ @return String[] Guid information from SPD file.\r
+ @throws PlatformPcdPreprocessException\r
+ Fail to get Guid information from SPD file.\r
**/\r
public abstract String[] getGuidInfoFromSpd(String guidCName)\r
- throws EntityException;\r
+ throws PlatformPcdPreprocessException;\r
\r
/**\r
Abstract function: Verification the PCD data.\r
In different environment, such as building environment and wizard environment,\r
it has different implementation according to optimization.\r
\r
- @param cName\r
- @param moduleName\r
- @param datum\r
- @param datumType\r
- @param maxDatumSize\r
+ @param cName The token name\r
+ @param moduleName The module who use this PCD token\r
+ @param datum The PCD's datum\r
+ @param datumType The PCD's datum type\r
+ @param maxDatumSize The max size for PCD's Datum.\r
+\r
+ @return String exception strings.\r
\r
- @return String\r
**/\r
public abstract String verifyDatum(String cName,\r
String moduleName,\r
public abstract DynamicPcdBuildDefinitions.PcdBuildData\r
getDynamicInfoFromFpd(Token token,\r
String moduleName)\r
- throws EntityException;\r
+ throws PlatformPcdPreprocessException;\r
\r
/**\r
Abstract function: Get all dynamic PCD information from FPD file.\r
\r
- @return List<DynamicPcdBuildDefinitions.PcdBuildData>\r
+ @return List<DynamicPcdBuildDefinitions.PcdBuildData> All DYNAMIC PCD list in <DynamicPcdBuildDefinitions> in FPD file.\r
+ @throws PlatformPcdPreprocessBuildException Failure to get dynamic information list.\r
+\r
**/\r
public abstract List<DynamicPcdBuildDefinitions.PcdBuildData>\r
getAllDynamicPcdInfoFromFpd()\r
- throws EntityException;\r
+ throws PlatformPcdPreprocessException;\r
\r
/**\r
Collect all PCD information from FPD file into PCD memory database.\r
\r
**/\r
public void initPcdMemoryDbWithPlatformInfo()\r
- throws EntityException {\r
+ throws PlatformPcdPreprocessException {\r
int index = 0;\r
int pcdIndex = 0;\r
List<PcdBuildDefinition.PcdData> pcdBuildDataArray = new ArrayList<PcdBuildDefinition.PcdData>();\r
modules = getComponentsFromFpd();\r
\r
if (modules == null) {\r
- throw new EntityException("[FPD file error] No modules in FPD file, Please check whether there are elements in <FrameworkModules> in FPD file!");\r
+ throw new PlatformPcdPreprocessException(\r
+ "No modules in FPD file, Please check whether there are elements in <FrameworkModules> in FPD file!");\r
}\r
\r
//\r
tokenSpaceStrRet = getGuidInfoFromSpd(pcdBuildData.getTokenSpaceGuidCName());\r
\r
if (tokenSpaceStrRet == null) {\r
- throw new EntityException ("Fail to get Token space guid for token" + pcdBuildData.getCName());\r
+ throw new PlatformPcdPreprocessException(\r
+ "Fail to get Token space guid for token" + pcdBuildData.getCName() +\r
+ " from all SPD files. You must have an <GuidDeclaration> for this token space Guid");\r
}\r
\r
primaryKey = Token.getPrimaryKeyString(pcdBuildData.getCName(), tokenSpaceStrRet[1]);\r
\r
if ((pcdType == Token.PCD_TYPE.FEATURE_FLAG) &&\r
(datumType != Token.DATUM_TYPE.BOOLEAN)){\r
- exceptionString = String.format("[FPD file error] For PCD %s in module %s, the PCD type is FEATRUE_FLAG but "+\r
+ exceptionString = String.format("In FPD file, for PCD %s in module %s, the PCD type is FEATRUE_FLAG but "+\r
"datum type of this PCD entry is not BOOLEAN!",\r
pcdBuildData.getCName(),\r
moduleName);\r
- throw new EntityException(exceptionString);\r
+ throw new PlatformPcdPreprocessException(exceptionString);\r
}\r
\r
//\r
// Value is required.\r
//\r
if (datum == null) {\r
- exceptionString = String.format("[FPD file error] There is no value for PCD entry %s in module %s!",\r
+ exceptionString = String.format("In FPD file, there is no value for PCD entry %s in module %s!",\r
pcdBuildData.getCName(),\r
moduleName);\r
- throw new EntityException(exceptionString);\r
+ throw new PlatformPcdPreprocessException(exceptionString);\r
}\r
\r
//\r
datum,\r
datumType,\r
maxDatumSize)) != null) {\r
- throw new EntityException(exceptionString);\r
+ throw new PlatformPcdPreprocessException(exceptionString);\r
}\r
}\r
\r
// modules.\r
//\r
if (token.datumType != datumType) {\r
- exceptionString = String.format("[FPD file error] The datum type of PCD entry %s is %s, which is different with %s defined in before!",\r
+ exceptionString = String.format("In FPD file, the datum type of PCD entry %s is %s, which is different with %s defined in before!",\r
pcdBuildData.getCName(),\r
pcdBuildData.getDatumType().toString(),\r
Token.getStringOfdatumType(token.datumType));\r
- throw new EntityException(exceptionString);\r
+ throw new PlatformPcdPreprocessException(exceptionString);\r
}\r
\r
//\r
// Check token number is valid\r
//\r
if (tokenNumber != token.tokenNumber) {\r
- exceptionString = String.format("[FPD file error] The token number of PCD entry %s in module %s is different with same PCD entry in other modules!",\r
+ exceptionString = String.format("In FPD file, the token number of PCD entry %s in module %s is different with same PCD entry in other modules!",\r
pcdBuildData.getCName(),\r
moduleName);\r
- throw new EntityException(exceptionString);\r
+ throw new PlatformPcdPreprocessException(exceptionString);\r
}\r
\r
//\r
// For same PCD used in different modules, the PCD type should all be dynamic or non-dynamic.\r
//\r
if (token.isDynamicPCD != Token.isDynamic(pcdType)) {\r
- exceptionString = String.format("[FPD file error] For PCD entry %s in module %s, you define dynamic or non-dynamic PCD type which"+\r
- "is different with others module's",\r
+ exceptionString = String.format("In FPD file, for PCD entry %s in module %s, you define dynamic or non-dynamic PCD type which"+\r
+ " is different with others module's",\r
token.cName,\r
moduleName);\r
- throw new EntityException(exceptionString);\r
+ throw new PlatformPcdPreprocessException(exceptionString);\r
}\r
\r
if (token.isDynamicPCD) {\r
(token.getDefaultSku().type == DynamicTokenValue.VALUE_TYPE.DEFAULT_TYPE) &&\r
(datum != null)) {\r
if (!datum.equalsIgnoreCase(token.getDefaultSku().value)) {\r
- exceptionString = String.format("[FPD file error] For dynamic PCD %s in module %s, the datum in <ModuleSA> is "+\r
+ exceptionString = String.format("In FPD file, for dynamic PCD %s in module %s, the datum in <ModuleSA> is "+\r
"not equal to the datum in <DynamicPcdBuildDefinitions>, it is "+\r
"illega! You could no set <Value> in <ModuleSA> for a dynamic PCD!",\r
token.cName,\r
moduleName);\r
- throw new EntityException(exceptionString);\r
+ throw new PlatformPcdPreprocessException(exceptionString);\r
}\r
}\r
\r
if ((maxDatumSize != 0) &&\r
(maxDatumSize != token.datumSize)){\r
- exceptionString = String.format("[FPD file error] For dynamic PCD %s in module %s, the max datum size is %d which "+\r
+ exceptionString = String.format("In FPD file, for dynamic PCD %s in module %s, the max datum size is %d which "+\r
"is different with <MaxDatumSize> %d defined in <DynamicPcdBuildDefinitions>!",\r
token.cName,\r
moduleName,\r
maxDatumSize,\r
token.datumSize);\r
- throw new EntityException(exceptionString);\r
+ throw new PlatformPcdPreprocessException(exceptionString);\r
}\r
}\r
\r
tokenSpaceStrRet = this.getGuidInfoFromSpd(pcdBuildData.getTokenSpaceGuidCName());\r
\r
if (tokenSpaceStrRet == null) {\r
- throw new EntityException("Fail to get token space guid for token " + token.cName);\r
+ throw new PlatformPcdPreprocessException(\r
+ "Fail to get Token space guid for token" + token.cName +\r
+ " from all SPD files. You must have an <GuidDeclaration> for this token space Guid");\r
+\r
}\r
\r
token = new Token(pcdBuildData.getCName(), tokenSpaceStrRet[1]);\r
pcdType,\r
datum,\r
maxDatumSize);\r
- token.addUsageInstance(usageInstance);\r
+ if (!token.addUsageInstance(usageInstance)) {\r
+ throw new PlatformPcdPreprocessException(\r
+ String.format("PCD %s for module %s has already exist in database, Please check all PCD build entries "+\r
+ "in modules %s in <ModuleSA> to make sure no duplicated definitions in FPD file!",\r
+ token.cName,\r
+ moduleName,\r
+ moduleName));\r
+ }\r
}\r
}\r
\r
Token token,\r
String datum,\r
int maxDatumSize)\r
- throws EntityException {\r
+ throws PlatformPcdPreprocessException {\r
int index = 0;\r
int offset;\r
String exceptionString = null;\r
\r
dynamicInfo = getDynamicInfoFromFpd(token, moduleName);\r
if (dynamicInfo == null) {\r
- exceptionString = String.format("[FPD file error] For Dynamic PCD %s used by module %s, "+\r
+ exceptionString = String.format("In FPD file, for Dynamic PCD %s used by module %s, "+\r
"there is no dynamic information in <DynamicPcdBuildDefinitions> "+\r
"in FPD file, but it is required!",\r
token.cName,\r
moduleName);\r
- throw new EntityException(exceptionString);\r
+ throw new PlatformPcdPreprocessException(exceptionString);\r
}\r
\r
token.datumSize = dynamicInfo.getMaxDatumSize();\r
token.datumType,\r
token.datumSize);\r
if (exceptionString != null) {\r
- throw new EntityException(exceptionString);\r
+ throw new PlatformPcdPreprocessException(exceptionString);\r
}\r
\r
if ((maxDatumSize != 0) &&\r
(maxDatumSize != token.datumSize)) {\r
- exceptionString = String.format("FPD file error] For dynamic PCD %s, the datum size in module %s is %d, but "+\r
+ exceptionString = String.format("In FPD file, for dynamic PCD %s, the datum size in module %s is %d, but "+\r
"the datum size in <DynamicPcdBuildDefinitions> is %d, they are not match!",\r
token.cName,\r
moduleName,\r
maxDatumSize,\r
dynamicInfo.getMaxDatumSize());\r
- throw new EntityException(exceptionString);\r
+ throw new PlatformPcdPreprocessException(exceptionString);\r
}\r
tokenNumber = Long.decode(dynamicInfo.getToken().toString());\r
if (tokenNumber != token.tokenNumber) {\r
- exceptionString = String.format("[FPD file error] For dynamic PCD %s, the token number in module %s is 0x%x, but"+\r
+ exceptionString = String.format("In FPD file, for dynamic PCD %s, the token number in module %s is 0x%x, but"+\r
"in <DynamicPcdBuildDefinictions>, the token number is 0x%x, they are not match!",\r
token.cName,\r
moduleName,\r
token.tokenNumber,\r
tokenNumber);\r
- throw new EntityException(exceptionString);\r
+ throw new PlatformPcdPreprocessException(exceptionString);\r
}\r
\r
token.dynamicExTokenNumber = tokenNumber;\r
skuInfoList.get(index).getValue().toString(),\r
token.datumType,\r
token.datumSize)) != null) {\r
- throw new EntityException(exceptionString);\r
+ throw new PlatformPcdPreprocessException(exceptionString);\r
}\r
\r
token.skuData.add(skuInstance);\r
if (datum != null) {\r
if ((skuInstance.id == 0) &&\r
!datum.toString().equalsIgnoreCase(skuInfoList.get(index).getValue().toString())) {\r
- exceptionString = "[FPD file error] For dynamic PCD " + token.cName + ", the value in module " + moduleName + " is " + datum.toString() + " but the "+\r
+ exceptionString = "In FPD file, for dynamic PCD " + token.cName + ", the value in module " + moduleName + " is " + datum.toString() + " but the "+\r
"value of sku 0 data in <DynamicPcdBuildDefinition> is " + skuInstance.value.value + ". They are must be same!"+\r
" or you could not define value for a dynamic PCD in every <ModuleSA>!";\r
- throw new EntityException(exceptionString);\r
+ throw new PlatformPcdPreprocessException(exceptionString);\r
}\r
}\r
continue;\r
if (skuInfoList.get(index).getVariableName() != null) {\r
exceptionString = null;\r
if (skuInfoList.get(index).getVariableGuid() == null) {\r
- exceptionString = String.format("[FPD file error] For dynamic PCD %s in <DynamicPcdBuildDefinitions> section in FPD "+\r
+ exceptionString = String.format("In FPD file, for dynamic PCD %s in <DynamicPcdBuildDefinitions> section in FPD "+\r
"file, who use HII, but there is no <VariableGuid> defined for Sku %d data!",\r
token.cName,\r
index);\r
if (exceptionString != null) {\r
- throw new EntityException(exceptionString);\r
+ throw new PlatformPcdPreprocessException(exceptionString);\r
}\r
}\r
\r
if (skuInfoList.get(index).getVariableOffset() == null) {\r
- exceptionString = String.format("[FPD file error] For dynamic PCD %s in <DynamicPcdBuildDefinitions> section in FPD "+\r
+ exceptionString = String.format("In FPD file, for dynamic PCD %s in <DynamicPcdBuildDefinitions> section in FPD "+\r
"file, who use HII, but there is no <VariableOffset> defined for Sku %d data!",\r
token.cName,\r
index);\r
if (exceptionString != null) {\r
- throw new EntityException(exceptionString);\r
+ throw new PlatformPcdPreprocessException(exceptionString);\r
}\r
}\r
\r
if (skuInfoList.get(index).getHiiDefaultValue() == null) {\r
- exceptionString = String.format("[FPD file error] For dynamic PCD %s in <DynamicPcdBuildDefinitions> section in FPD "+\r
+ exceptionString = String.format("In FPD file, for dynamic PCD %s in <DynamicPcdBuildDefinitions> section in FPD "+\r
"file, who use HII, but there is no <HiiDefaultValue> defined for Sku %d data!",\r
token.cName,\r
index);\r
if (exceptionString != null) {\r
- throw new EntityException(exceptionString);\r
+ throw new PlatformPcdPreprocessException(exceptionString);\r
}\r
}\r
\r
hiiDefaultValue,\r
token.datumType,\r
token.datumSize)) != null) {\r
- throw new EntityException(exceptionString);\r
+ throw new PlatformPcdPreprocessException(exceptionString);\r
}\r
\r
offset = Integer.decode(skuInfoList.get(index).getVariableOffset());\r
if (offset > 0xFFFF) {\r
- throw new EntityException(String.format("[FPD file error] For dynamic PCD %s , the variable offset defined in sku %d data "+\r
- "exceed 64K, it is not allowed!",\r
- token.cName,\r
- index));\r
+ throw new PlatformPcdPreprocessException(\r
+ String.format("In FPD file, for dynamic PCD %s , the variable offset defined in sku %d data "+\r
+ "exceed 64K, it is not allowed!",\r
+ token.cName,\r
+ index));\r
}\r
\r
//\r
//\r
variableGuidString = getGuidInfoFromSpd(skuInfoList.get(index).getVariableGuid().toString());\r
if (variableGuidString == null) {\r
- throw new EntityException(String.format("[GUID Error] For dynamic PCD %s, the variable guid %s can be found in all SPD file!",\r
- token.cName,\r
- skuInfoList.get(index).getVariableGuid().toString()));\r
+ throw new PlatformPcdPreprocessException(\r
+ String.format("In FPD file, for dynamic PCD %s, the variable guid %s can be found in all SPD file!",\r
+ token.cName,\r
+ skuInfoList.get(index).getVariableGuid().toString()));\r
}\r
String variableStr = skuInfoList.get(index).getVariableName();\r
Pattern pattern = Pattern.compile("0x([a-fA-F0-9]){4}");\r
Matcher matcher = pattern.matcher(variableStr);\r
List<String> varNameList = new ArrayList<String>();\r
while (matcher.find()){\r
- String str = variableStr.substring(matcher.start(),matcher.end());\r
- varNameList.add(str);\r
+ String str = variableStr.substring(matcher.start(),matcher.end());\r
+ varNameList.add(str);\r
}\r
\r
skuInstance.value.setHiiData(varNameList,\r
continue;\r
}\r
\r
- exceptionString = String.format("[FPD file error] For dynamic PCD %s, the dynamic info must "+\r
+ exceptionString = String.format("In FPD file, for dynamic PCD %s, the dynamic info must "+\r
"be one of 'DefaultGroup', 'HIIGroup', 'VpdGroup'.",\r
token.cName);\r
- throw new EntityException(exceptionString);\r
+ throw new PlatformPcdPreprocessException(exceptionString);\r
}\r
\r
if (!hasSkuId0) {\r
- exceptionString = String.format("[FPD file error] For dynamic PCD %s in <DynamicPcdBuildDefinitions>, there are "+\r
+ exceptionString = String.format("In FPD file, for dynamic PCD %s in <DynamicPcdBuildDefinitions>, there are "+\r
"no sku id = 0 data, which is required for every dynamic PCD",\r
token.cName);\r
- throw new EntityException(exceptionString);\r
+ throw new PlatformPcdPreprocessException(exceptionString);\r
}\r
\r
return token;\r
}\r
\r
/**\r
- Get all dynamic PCD defined in <DynamicPcdBuildDefinitions> which unreferenced by \r
+ Get all dynamic PCD defined in <DynamicPcdBuildDefinitions> which unreferenced by\r
any <ModuleSA> in FPD file.\r
- \r
- @return List<Token> Return PCD token \r
+\r
+ @return List<Token> Return PCD token\r
**/\r
- private List<Token> getUnreferencedDynamicPcd () throws EntityException {\r
+ private List<Token> getUnreferencedDynamicPcd () throws PlatformPcdPreprocessException {\r
List<Token> tokenArray = new ArrayList<Token>();\r
Token token = null;\r
List<DynamicPcdBuildDefinitions.PcdBuildData> dynamicPcdBuildDataArray = null;\r
tokenSpaceStrRet = this.getGuidInfoFromSpd(pcdBuildData.getTokenSpaceGuidCName());\r
\r
if (tokenSpaceStrRet == null) {\r
- throw new EntityException ("Fail to get Token space guid for token" + pcdBuildData.getCName());\r
+ throw new PlatformPcdPreprocessException("Fail to get Token space guid for token" + pcdBuildData.getCName());\r
}\r
\r
primaryKey = Token.getPrimaryKeyString(pcdBuildData.getCName(),\r
\r
pcdType = Token.getPcdTypeFromString(pcdBuildData.getItemType().toString());\r
if (pcdType != Token.PCD_TYPE.DYNAMIC_EX) {\r
- throw new EntityException (String.format("[FPD file error] It not allowed for DYNAMIC PCD %s who is no used by any module",\r
- pcdBuildData.getCName()));\r
+ throw new PlatformPcdPreprocessException(\r
+ String.format("In FPD file, it not allowed for DYNAMIC PCD %s who is no used by any module",\r
+ pcdBuildData.getCName()));\r
}\r
\r
//\r
token.datumType,\r
token.datumSize);\r
if (exceptionString != null) {\r
- throw new EntityException(exceptionString);\r
+ throw new PlatformPcdPreprocessException(exceptionString);\r
}\r
\r
skuInfoList = pcdBuildData.getSkuInfoList();\r
skuInfoList.get(index).getValue().toString(),\r
token.datumType,\r
token.datumSize)) != null) {\r
- throw new EntityException(exceptionString);\r
+ throw new PlatformPcdPreprocessException(exceptionString);\r
}\r
\r
token.skuData.add(skuInstance);\r
if (skuInfoList.get(index).getVariableName() != null) {\r
exceptionString = null;\r
if (skuInfoList.get(index).getVariableGuid() == null) {\r
- exceptionString = String.format("[FPD file error] For dynamic PCD %s in <DynamicPcdBuildDefinitions> section in FPD "+\r
+ exceptionString = String.format("In FPD file, for dynamic PCD %s in <DynamicPcdBuildDefinitions> section in FPD "+\r
"file, who use HII, but there is no <VariableGuid> defined for Sku %d data!",\r
token.cName,\r
index);\r
if (exceptionString != null) {\r
- throw new EntityException(exceptionString);\r
+ throw new PlatformPcdPreprocessException(exceptionString);\r
}\r
}\r
\r
if (skuInfoList.get(index).getVariableOffset() == null) {\r
- exceptionString = String.format("[FPD file error] For dynamic PCD %s in <DynamicPcdBuildDefinitions> section in FPD "+\r
+ exceptionString = String.format("In FPD file, for dynamic PCD %s in <DynamicPcdBuildDefinitions> section in FPD "+\r
"file, who use HII, but there is no <VariableOffset> defined for Sku %d data!",\r
token.cName,\r
index);\r
if (exceptionString != null) {\r
- throw new EntityException(exceptionString);\r
+ throw new PlatformPcdPreprocessException(exceptionString);\r
}\r
}\r
\r
if (skuInfoList.get(index).getHiiDefaultValue() == null) {\r
- exceptionString = String.format("[FPD file error] For dynamic PCD %s in <DynamicPcdBuildDefinitions> section in FPD "+\r
+ exceptionString = String.format("In FPD file, for dynamic PCD %s in <DynamicPcdBuildDefinitions> section in FPD "+\r
"file, who use HII, but there is no <HiiDefaultValue> defined for Sku %d data!",\r
token.cName,\r
index);\r
if (exceptionString != null) {\r
- throw new EntityException(exceptionString);\r
+ throw new PlatformPcdPreprocessException(exceptionString);\r
}\r
}\r
\r
hiiDefaultValue,\r
token.datumType,\r
token.datumSize)) != null) {\r
- throw new EntityException(exceptionString);\r
+ throw new PlatformPcdPreprocessException(exceptionString);\r
}\r
\r
offset = Integer.decode(skuInfoList.get(index).getVariableOffset());\r
if (offset > 0xFFFF) {\r
- throw new EntityException(String.format("[FPD file error] For dynamic PCD %s , the variable offset defined in sku %d data "+\r
- "exceed 64K, it is not allowed!",\r
- token.cName,\r
- index));\r
+ throw new PlatformPcdPreprocessException(\r
+ String.format("In FPD file, for dynamic PCD %s , the variable offset defined in sku %d data "+\r
+ "exceed 64K, it is not allowed!",\r
+ token.cName,\r
+ index));\r
}\r
\r
//\r
//\r
variableGuidString = this.getGuidInfoFromSpd(skuInfoList.get(index).getVariableGuid().toString());\r
if (variableGuidString == null) {\r
- throw new EntityException(String.format("[GUID Error] For dynamic PCD %s, the variable guid %s can be found in all SPD file!",\r
- token.cName,\r
- skuInfoList.get(index).getVariableGuid().toString()));\r
+ throw new PlatformPcdPreprocessException(\r
+ String.format("In FPD file, for dynamic PCD %s, the variable guid %s can be found in all SPD file!",\r
+ token.cName,\r
+ skuInfoList.get(index).getVariableGuid().toString()));\r
}\r
String variableStr = skuInfoList.get(index).getVariableName();\r
Pattern pattern = Pattern.compile("0x([a-fA-F0-9]){4}");\r
Matcher matcher = pattern.matcher(variableStr);\r
List<String> varNameList = new ArrayList<String>();\r
while (matcher.find()){\r
- String str = variableStr.substring(matcher.start(),matcher.end());\r
- varNameList.add(str);\r
+ String str = variableStr.substring(matcher.start(),matcher.end());\r
+ varNameList.add(str);\r
}\r
\r
skuInstance.value.setHiiData(varNameList,\r
continue;\r
}\r
\r
- exceptionString = String.format("[FPD file error] For dynamic PCD %s, the dynamic info must "+\r
+ exceptionString = String.format("In FPD file, for dynamic PCD %s, the dynamic info must "+\r
"be one of 'DefaultGroup', 'HIIGroup', 'VpdGroup'.",\r
token.cName);\r
- throw new EntityException(exceptionString);\r
+ throw new PlatformPcdPreprocessException(exceptionString);\r
}\r
\r
if (!hasSkuId0) {\r
- exceptionString = String.format("[FPD file error] For dynamic PCD %s in <DynamicPcdBuildDefinitions>, there are "+\r
+ exceptionString = String.format("In FPD file, for dynamic PCD %s in <DynamicPcdBuildDefinitions>, there are "+\r
"no sku id = 0 data, which is required for every dynamic PCD",\r
token.cName);\r
- throw new EntityException(exceptionString);\r
+ throw new PlatformPcdPreprocessException(exceptionString);\r
}\r
\r
tokenArray.add(token);\r
@return UUID UUID instance\r
**/\r
private UUID translateSchemaStringToUUID(String uuidString)\r
- throws EntityException {\r
+ throws PlatformPcdPreprocessException {\r
String temp;\r
String[] splitStringArray;\r
int index;\r
if ((uuidString.charAt(0) == '0') && ((uuidString.charAt(1) == 'x') || (uuidString.charAt(1) == 'X'))) {\r
splitStringArray = uuidString.split("," );\r
if (splitStringArray.length != 11) {\r
- throw new EntityException ("[FPD file error] Wrong format for UUID string: " + uuidString);\r
+ throw new PlatformPcdPreprocessException ("Wrong format for UUID string: " + uuidString);\r
}\r
\r
//\r