In preprocess for getting platform PCD information, if meet error, put error into...
authorklu2 <klu2@6f19259b-4bc3-4df7-8a09-765794883524>
Sun, 6 Aug 2006 07:26:05 +0000 (07:26 +0000)
committerklu2 <klu2@6f19259b-4bc3-4df7-8a09-765794883524>
Sun, 6 Aug 2006 07:26:05 +0000 (07:26 +0000)
git-svn-id: https://edk2.svn.sourceforge.net/svnroot/edk2/trunk/edk2@1194 6f19259b-4bc3-4df7-8a09-765794883524

Tools/Source/GenBuild/org/tianocore/build/pcd/action/PlatformPcdPreprocessActionForBuilding.java
Tools/Source/PcdTools/org/tianocore/pcd/action/PlatformPcdPreprocessAction.java
Tools/Source/PcdTools/org/tianocore/pcd/entity/MemoryDatabaseManager.java
Tools/Source/PcdTools/org/tianocore/pcd/entity/ModulePcdInfoFromFpd.java

index fd1ae56..7dd9088 100644 (file)
@@ -28,18 +28,19 @@ import java.util.Map;
 import org.apache.xmlbeans.XmlException;\r
 import org.apache.xmlbeans.XmlObject;\r
 import org.tianocore.DynamicPcdBuildDefinitionsDocument.DynamicPcdBuildDefinitions;\r
+import org.tianocore.PcdBuildDefinitionDocument;\r
 import org.tianocore.PlatformSurfaceAreaDocument;\r
+import org.tianocore.build.exception.PlatformPcdPreprocessBuildException;\r
 import org.tianocore.build.fpd.FpdParserTask;\r
 import org.tianocore.build.global.GlobalData;\r
 import org.tianocore.build.id.FpdModuleIdentification;\r
 import org.tianocore.pcd.action.ActionMessage;\r
-import org.tianocore.pcd.entity.ModulePcdInfoFromFpd;\r
+import org.tianocore.pcd.action.PlatformPcdPreprocessAction;\r
 import org.tianocore.pcd.entity.MemoryDatabaseManager;\r
+import org.tianocore.pcd.entity.ModulePcdInfoFromFpd;\r
 import org.tianocore.pcd.entity.Token;\r
 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
@@ -120,7 +121,9 @@ public class PlatformPcdPreprocessActionForBuilding extends PlatformPcdPreproces
 \r
     **/\r
     public void execute() throws PlatformPcdPreprocessBuildException {\r
-        String errorMessageHeader = "Fail to initialize Pcd memory database for building. Because:";\r
+        String errorMessageHeader   = "Fail to initialize Pcd memory database for building. Because:";\r
+        String errorsForPreprocess  = null;\r
+\r
         //\r
         // Get memoryDatabaseManager instance from GlobalData.\r
         // The memoryDatabaseManager should be initialized as static variable\r
@@ -138,6 +141,10 @@ public class PlatformPcdPreprocessActionForBuilding extends PlatformPcdPreproces
         } catch (PlatformPcdPreprocessException exp) {\r
             throw new PlatformPcdPreprocessBuildException(errorMessageHeader + exp.getMessage());\r
         }\r
+        errorsForPreprocess = this.getErrorString();\r
+        if (errorsForPreprocess != null) {\r
+            throw new PlatformPcdPreprocessBuildException(errorMessageHeader + "\r\n" + errorsForPreprocess);\r
+        }\r
 \r
         //\r
         // Generate for PEI, DXE PCD DATABASE's definition and initialization.\r
@@ -228,7 +235,10 @@ public class PlatformPcdPreprocessActionForBuilding extends PlatformPcdPreproces
                                                                  id.getArch(),\r
                                                                  id.getModule().getVersion(),\r
                                                                  id.getModule().getModuleType());\r
-            allModules.add(new ModulePcdInfoFromFpd(usageId, pcdBuildDefinitions.get(id)));\r
+            allModules.add(\r
+                new ModulePcdInfoFromFpd(\r
+                    usageId, \r
+                    ((PcdBuildDefinitionDocument)pcdBuildDefinitions.get(id)).getPcdBuildDefinition()));\r
         }\r
         return allModules;\r
     }\r
@@ -542,7 +552,7 @@ public class PlatformPcdPreprocessActionForBuilding extends PlatformPcdPreproces
                     return exceptionString;\r
                 }\r
             } else {\r
-                exceptionString = String.format("[FPD file error] The datum type of PCD %s in %s is VOID*. For VOID* type, you have three format choise:\n "+\r
+                exceptionString = String.format("[FPD file error] The datum type of PCD %s in %s is VOID*. For VOID* type, you have three format choise:\n"+\r
                                                 "1) UNICODE string: like L\"xxxx\";\r\n"+\r
                                                 "2) ANSIC string: like \"xxx\";\r\n"+\r
                                                 "3) Byte array: like {0x2, 0x45, 0x23}\r\n"+\r
@@ -602,19 +612,18 @@ public class PlatformPcdPreprocessActionForBuilding extends PlatformPcdPreproces
                                             "PCD entry %s in module %s!",\r
                                             token.cName,\r
                                             moduleName);\r
-            throw new PlatformPcdPreprocessException(exceptionString);\r
+            putError(exceptionString);\r
+            return null;\r
         }\r
 \r
         dynamicPcdBuildDataArray = dynamicPcdBuildDefinitions.getPcdBuildDataList();\r
         for (index = 0; index < dynamicPcdBuildDataArray.size(); index ++) {\r
-            try {\r
-                tokenSpaceStrRet = GlobalData.getGuidInfoFromCname(dynamicPcdBuildDataArray.get(index).getTokenSpaceGuidCName());\r
-            } catch (Exception e) {\r
-                throw new PlatformPcdPreprocessException ("Fail to get token space guid for token " + dynamicPcdBuildDataArray.get(index).getCName());\r
-            }\r
+            tokenSpaceStrRet = this.getGuidInfoFromSpd(dynamicPcdBuildDataArray.get(index).getTokenSpaceGuidCName());\r
 \r
             if (tokenSpaceStrRet == null) {\r
-                throw new PlatformPcdPreprocessException ("Fail to get token space guid for token " + dynamicPcdBuildDataArray.get(index).getCName());\r
+                exceptionString = "Fail to get token space guid for token " + dynamicPcdBuildDataArray.get(index).getCName();\r
+                putError(exceptionString);\r
+                continue;\r
             }\r
 \r
             dynamicPrimaryKey = Token.getPrimaryKeyString(dynamicPcdBuildDataArray.get(index).getCName(),\r
@@ -655,6 +664,7 @@ public class PlatformPcdPreprocessActionForBuilding extends PlatformPcdPreproces
 \r
         dynamicPcdBuildDefinitions = fpdDocInstance.getPlatformSurfaceArea().getDynamicPcdBuildDefinitions();\r
         if (dynamicPcdBuildDefinitions == null) {\r
+            putError("There is no <DynamicPcdBuildDefinitions> in FPD file!");\r
             return null;\r
         }\r
 \r
index 04ebf89..ac346d6 100644 (file)
@@ -42,6 +42,24 @@ public abstract class PlatformPcdPreprocessAction {
     ///\r
     private MemoryDatabaseManager pcdDbManager;\r
 \r
+    ///\r
+    /// Errors string when perform preprocess \r
+    /// \r
+    private String                errorString;\r
+\r
+    ///\r
+    /// the count of errors when perform preprocess\r
+    /// \r
+    private int                   errorCount;\r
+\r
+    /**\r
+       Default contructor function  \r
+    **/\r
+    public PlatformPcdPreprocessAction() {\r
+        pcdDbManager = null;\r
+        errorString  = null;\r
+    }\r
+\r
     /**\r
        Set parameter pcdDbManager\r
 \r
@@ -130,6 +148,25 @@ public abstract class PlatformPcdPreprocessAction {
                                             getAllDynamicPcdInfoFromFpd()\r
                                             throws PlatformPcdPreprocessException;\r
 \r
+    /**\r
+       Return the error string after preprocess \r
+\r
+       @return String error string\r
+    **/\r
+    public String getErrorString() {\r
+        return errorString;\r
+    }\r
+\r
+    public void putError(String error) {\r
+        if (errorString == null) {\r
+            errorString = "### ERROR[" + errorCount + "] ###\r\n" + error + "\r\n\r\n";\r
+        } else {\r
+            errorString += "### ERROR[" + errorCount + "] ###\r\n" + error + "\r\n\r\n";\r
+        }\r
+\r
+        errorCount++;\r
+    }\r
+\r
     /**\r
       Collect all PCD information from FPD file into PCD memory database.\r
 \r
@@ -193,9 +230,13 @@ public abstract class PlatformPcdPreprocessAction {
                 tokenSpaceStrRet = getGuidInfoFromSpd(pcdBuildData.getTokenSpaceGuidCName());\r
 \r
                 if (tokenSpaceStrRet == null) {\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
+                    putError("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
+                    // Do not break preprocess, continues to analysis.\r
+                    // All errors will be summary to be shown.\r
+                    // \r
+                    continue;\r
                 }\r
 \r
                 primaryKey   = Token.getPrimaryKeyString(pcdBuildData.getCName(), tokenSpaceStrRet[1]);\r
@@ -215,7 +256,12 @@ public abstract class PlatformPcdPreprocessAction {
                                                     "datum type of this PCD entry is not BOOLEAN!",\r
                                                     pcdBuildData.getCName(),\r
                                                     moduleName);\r
-                    throw new PlatformPcdPreprocessException(exceptionString);\r
+                    putError(exceptionString);\r
+                    //\r
+                    // Do not break preprocess, continues to analysis.\r
+                    // All errors will be summary to be shown.\r
+                    // \r
+                    continue;\r
                 }\r
 \r
                 //\r
@@ -231,7 +277,12 @@ public abstract class PlatformPcdPreprocessAction {
                          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 PlatformPcdPreprocessException(exceptionString);\r
+                         putError(exceptionString);\r
+                         //\r
+                         // Do not break preprocess, continues to analysis.\r
+                         // All errors will be summary to be shown.\r
+                         // \r
+                         continue;\r
                      }\r
 \r
                      //\r
@@ -242,7 +293,12 @@ public abstract class PlatformPcdPreprocessAction {
                                                         datum,\r
                                                         datumType,\r
                                                         maxDatumSize)) != null) {\r
-                         throw new PlatformPcdPreprocessException(exceptionString);\r
+                         putError(exceptionString);\r
+                         //\r
+                         // Do not break preprocess, continues to analysis.\r
+                         // All errors will be summary to be shown.\r
+                         // \r
+                         continue;\r
                      }\r
                 }\r
 \r
@@ -267,7 +323,12 @@ public abstract class PlatformPcdPreprocessAction {
                                                         pcdBuildData.getCName(),\r
                                                         pcdBuildData.getDatumType().toString(),\r
                                                         Token.getStringOfdatumType(token.datumType));\r
-                        throw new PlatformPcdPreprocessException(exceptionString);\r
+                        putError(exceptionString);\r
+                        //\r
+                        // Do not break preprocess, continues to analysis.\r
+                        // All errors will be summary to be shown.\r
+                        // \r
+                        continue;\r
                     }\r
 \r
                     //\r
@@ -277,7 +338,12 @@ public abstract class PlatformPcdPreprocessAction {
                         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 PlatformPcdPreprocessException(exceptionString);\r
+                        putError(exceptionString);\r
+                        //\r
+                        // Do not break preprocess, continues to analysis.\r
+                        // All errors will be summary to be shown.\r
+                        // \r
+                        continue;\r
                     }\r
 \r
                     //\r
@@ -288,7 +354,12 @@ public abstract class PlatformPcdPreprocessAction {
                                                         " is different with others module's",\r
                                                         token.cName,\r
                                                         moduleName);\r
-                        throw new PlatformPcdPreprocessException(exceptionString);\r
+                        putError(exceptionString);\r
+                        //\r
+                        // Do not break preprocess, continues to analysis.\r
+                        // All errors will be summary to be shown.\r
+                        // \r
+                        continue;\r
                     }\r
 \r
                     if (token.isDynamicPCD) {\r
@@ -306,7 +377,12 @@ public abstract class PlatformPcdPreprocessAction {
                                                                 "illega! You could no set <Value> in <ModuleSA> for a dynamic PCD!",\r
                                                                 token.cName,\r
                                                                 moduleName);\r
-                                throw new PlatformPcdPreprocessException(exceptionString);\r
+                                putError(exceptionString);\r
+                                //\r
+                                // Do not break preprocess, continues to analysis.\r
+                                // All errors will be summary to be shown.\r
+                                // \r
+                                continue;\r
                             }\r
                         }\r
 \r
@@ -318,7 +394,12 @@ public abstract class PlatformPcdPreprocessAction {
                                                             moduleName,\r
                                                             maxDatumSize,\r
                                                             token.datumSize);\r
-                            throw new PlatformPcdPreprocessException(exceptionString);\r
+                            putError(exceptionString);\r
+                            //\r
+                            // Do not break preprocess, continues to analysis.\r
+                            // All errors will be summary to be shown.\r
+                            // \r
+                            continue;\r
                         }\r
                     }\r
 \r
@@ -330,10 +411,13 @@ public abstract class PlatformPcdPreprocessAction {
                     tokenSpaceStrRet = this.getGuidInfoFromSpd(pcdBuildData.getTokenSpaceGuidCName());\r
 \r
                     if (tokenSpaceStrRet == null) {\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
+                        putError("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
+                        // Do not break preprocess, continues to analysis.\r
+                        // All errors will be summary to be shown.\r
+                        // \r
+                        continue;\r
                     }\r
 \r
                     token = new Token(pcdBuildData.getCName(), tokenSpaceStrRet[1]);\r
@@ -348,10 +432,12 @@ public abstract class PlatformPcdPreprocessAction {
                         // For Dynamic and Dynamic Ex type, need find the dynamic information\r
                         // in <DynamicPcdBuildDefinition> section in FPD file.\r
                         //\r
-                        updateDynamicInformation(moduleName,\r
-                                                 token,\r
-                                                 datum,\r
-                                                 maxDatumSize);\r
+                        if (null == updateDynamicInformation(moduleName,\r
+                                                             token,\r
+                                                             datum,\r
+                                                             maxDatumSize)) {\r
+                            continue;\r
+                        }\r
                     }\r
 \r
                     pcdDbManager.addTokenToDatabase(primaryKey, token);\r
@@ -375,12 +461,13 @@ public abstract class PlatformPcdPreprocessAction {
                                                   datum,\r
                                                   maxDatumSize);\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
+                    putError(String.format("PCD %s for module %s(%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
+                                           modules.get(index).usageId.moduleGuid,\r
+                                           moduleName,\r
+                                           moduleName));\r
+                    continue;\r
                 }\r
             }\r
         }\r
@@ -437,7 +524,8 @@ public abstract class PlatformPcdPreprocessAction {
                                             "in FPD file, but it is required!",\r
                                             token.cName,\r
                                             moduleName);\r
-            throw new PlatformPcdPreprocessException(exceptionString);\r
+            putError(exceptionString);\r
+            return null;\r
         }\r
 \r
         token.datumSize = dynamicInfo.getMaxDatumSize();\r
@@ -459,7 +547,8 @@ public abstract class PlatformPcdPreprocessAction {
                                             moduleName,\r
                                             maxDatumSize,\r
                                             dynamicInfo.getMaxDatumSize());\r
-            throw new PlatformPcdPreprocessException(exceptionString);\r
+            putError(exceptionString);\r
+            return null;\r
         }\r
         tokenNumber = Long.decode(dynamicInfo.getToken().toString());\r
         if (tokenNumber != token.tokenNumber) {\r
@@ -469,7 +558,8 @@ public abstract class PlatformPcdPreprocessAction {
                                             moduleName,\r
                                             token.tokenNumber,\r
                                             tokenNumber);\r
-            throw new PlatformPcdPreprocessException(exceptionString);\r
+            putError(exceptionString);\r
+            return null;\r
         }\r
 \r
         token.dynamicExTokenNumber = tokenNumber;\r
@@ -499,7 +589,8 @@ public abstract class PlatformPcdPreprocessAction {
                                                    skuInfoList.get(index).getValue().toString(),\r
                                                    token.datumType,\r
                                                    token.datumSize)) != null) {\r
-                    throw new PlatformPcdPreprocessException(exceptionString);\r
+                    putError(exceptionString);\r
+                    return null;\r
                 }\r
 \r
                 token.skuData.add(skuInstance);\r
@@ -514,7 +605,8 @@ public abstract class PlatformPcdPreprocessAction {
                         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 PlatformPcdPreprocessException(exceptionString);\r
+                        putError(exceptionString);\r
+                        return null;\r
                     }\r
                 }\r
                 continue;\r
@@ -530,9 +622,8 @@ public abstract class PlatformPcdPreprocessAction {
                                                     "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 PlatformPcdPreprocessException(exceptionString);\r
-                    }\r
+                    putError(exceptionString);\r
+                    return null;\r
                 }\r
 \r
                 if (skuInfoList.get(index).getVariableOffset() == null) {\r
@@ -540,9 +631,8 @@ public abstract class PlatformPcdPreprocessAction {
                                                     "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 PlatformPcdPreprocessException(exceptionString);\r
-                    }\r
+                    putError(exceptionString);\r
+                    return null;\r
                 }\r
 \r
                 if (skuInfoList.get(index).getHiiDefaultValue() == null) {\r
@@ -550,9 +640,8 @@ public abstract class PlatformPcdPreprocessAction {
                                                     "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 PlatformPcdPreprocessException(exceptionString);\r
-                    }\r
+                    putError(exceptionString);\r
+                    return null;\r
                 }\r
 \r
                 if (skuInfoList.get(index).getHiiDefaultValue() != null) {\r
@@ -571,11 +660,11 @@ public abstract class PlatformPcdPreprocessAction {
 \r
                 offset = Integer.decode(skuInfoList.get(index).getVariableOffset());\r
                 if (offset > 0xFFFF) {\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
+                    putError(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
+                    return null;\r
                 }\r
 \r
                 //\r
@@ -583,10 +672,10 @@ public abstract class PlatformPcdPreprocessAction {
                 //\r
                 variableGuidString = getGuidInfoFromSpd(skuInfoList.get(index).getVariableGuid().toString());\r
                 if (variableGuidString == null) {\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
+                    putError(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
+                    return null;\r
                 }\r
                 String variableStr = skuInfoList.get(index).getVariableName();\r
                 Pattern pattern = Pattern.compile("0x([a-fA-F0-9]){4}");\r
@@ -614,14 +703,16 @@ public abstract class PlatformPcdPreprocessAction {
             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 PlatformPcdPreprocessException(exceptionString);\r
+            putError(exceptionString);\r
+            return null;\r
         }\r
 \r
         if (!hasSkuId0) {\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 PlatformPcdPreprocessException(exceptionString);\r
+            putError(exceptionString);\r
+            return null;\r
         }\r
 \r
         return token;\r
@@ -660,7 +751,8 @@ public abstract class PlatformPcdPreprocessAction {
             tokenSpaceStrRet = this.getGuidInfoFromSpd(pcdBuildData.getTokenSpaceGuidCName());\r
 \r
             if (tokenSpaceStrRet == null) {\r
-                throw new PlatformPcdPreprocessException("Fail to get Token space guid for token" + pcdBuildData.getCName());\r
+                putError("Fail to get Token space guid for token" + pcdBuildData.getCName());\r
+                continue;\r
             }\r
 \r
             primaryKey = Token.getPrimaryKeyString(pcdBuildData.getCName(),\r
@@ -672,9 +764,9 @@ public abstract class PlatformPcdPreprocessAction {
 \r
             pcdType = Token.getPcdTypeFromString(pcdBuildData.getItemType().toString());\r
             if (pcdType != Token.PCD_TYPE.DYNAMIC_EX) {\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
+                putError(String.format("In FPD file, it not allowed for DYNAMIC PCD %s who is no used by any module",\r
+                                       pcdBuildData.getCName()));\r
+                continue;\r
             }\r
 \r
             //\r
@@ -696,7 +788,8 @@ public abstract class PlatformPcdPreprocessAction {
                                           token.datumType,\r
                                           token.datumSize);\r
             if (exceptionString != null) {\r
-                throw new PlatformPcdPreprocessException(exceptionString);\r
+                putError(exceptionString);\r
+                continue;\r
             }\r
 \r
             skuInfoList = pcdBuildData.getSkuInfoList();\r
@@ -724,7 +817,8 @@ public abstract class PlatformPcdPreprocessAction {
                                                        skuInfoList.get(index).getValue().toString(),\r
                                                        token.datumType,\r
                                                        token.datumSize)) != null) {\r
-                        throw new PlatformPcdPreprocessException(exceptionString);\r
+                        putError(exceptionString);\r
+                        continue;\r
                     }\r
 \r
                     token.skuData.add(skuInstance);\r
@@ -742,9 +836,8 @@ public abstract class PlatformPcdPreprocessAction {
                                                         "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 PlatformPcdPreprocessException(exceptionString);\r
-                        }\r
+                        putError(exceptionString);\r
+                        continue;\r
                     }\r
 \r
                     if (skuInfoList.get(index).getVariableOffset() == null) {\r
@@ -752,9 +845,8 @@ public abstract class PlatformPcdPreprocessAction {
                                                         "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 PlatformPcdPreprocessException(exceptionString);\r
-                        }\r
+                        putError(exceptionString);\r
+                        continue;\r
                     }\r
 \r
                     if (skuInfoList.get(index).getHiiDefaultValue() == null) {\r
@@ -762,9 +854,8 @@ public abstract class PlatformPcdPreprocessAction {
                                                         "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 PlatformPcdPreprocessException(exceptionString);\r
-                        }\r
+                        putError(exceptionString);\r
+                        continue;\r
                     }\r
 \r
                     if (skuInfoList.get(index).getHiiDefaultValue() != null) {\r
@@ -778,16 +869,18 @@ public abstract class PlatformPcdPreprocessAction {
                                                        hiiDefaultValue,\r
                                                        token.datumType,\r
                                                        token.datumSize)) != null) {\r
-                        throw new PlatformPcdPreprocessException(exceptionString);\r
+                        putError(exceptionString);\r
+                        continue;\r
                     }\r
 \r
                     offset = Integer.decode(skuInfoList.get(index).getVariableOffset());\r
                     if (offset > 0xFFFF) {\r
-                        throw new PlatformPcdPreprocessException(\r
-                            String.format("In FPD file, for dynamic PCD %s ,  the variable offset defined in sku %d data "+\r
+                        exceptionString = 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
+                                          index);\r
+                        putError(exceptionString);\r
+                        continue;\r
                     }\r
 \r
                     //\r
@@ -795,10 +888,11 @@ public abstract class PlatformPcdPreprocessAction {
                     //\r
                     variableGuidString = this.getGuidInfoFromSpd(skuInfoList.get(index).getVariableGuid().toString());\r
                     if (variableGuidString == null) {\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
+                        exceptionString = 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
+                        putError(exceptionString);\r
+                        continue;\r
                     }\r
                     String variableStr = skuInfoList.get(index).getVariableName();\r
                     Pattern pattern = Pattern.compile("0x([a-fA-F0-9]){4}");\r
@@ -826,14 +920,15 @@ public abstract class PlatformPcdPreprocessAction {
                 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 PlatformPcdPreprocessException(exceptionString);\r
+                putError(exceptionString);\r
             }\r
 \r
             if (!hasSkuId0) {\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 PlatformPcdPreprocessException(exceptionString);\r
+                putError(exceptionString);\r
+                continue;\r
             }\r
 \r
             tokenArray.add(token);\r
index ba0e3ca..2962e74 100644 (file)
@@ -235,6 +235,10 @@ public class MemoryDatabaseManager {
         return getUsageInstanceArrayByKeyString(primaryKey);\r
     }\r
 \r
+    public void clearDatabase() {\r
+        memoryDatabase.clear();\r
+    }\r
+\r
     /**\r
        Get all PCD token for a usage instance according to primary key.\r
 \r
index 09abb6f..fe9f7ec 100644 (file)
@@ -41,8 +41,8 @@ public class ModulePcdInfoFromFpd {
 \r
     **/\r
     public ModulePcdInfoFromFpd(UsageIdentification usageId,\r
-                                XmlObject           pcdBuildDefinition) {\r
+                                PcdBuildDefinition  pcdBuildDefinition) {\r
         this.usageId            = usageId;\r
-        this.pcdBuildDefinition = ((PcdBuildDefinitionDocument)pcdBuildDefinition).getPcdBuildDefinition();\r
+        this.pcdBuildDefinition = pcdBuildDefinition;\r
     }\r
 }\r