]> git.proxmox.com Git - mirror_edk2.git/blobdiff - Tools/Java/Source/FrameworkWizard/src/org/tianocore/frameworkwizard/platform/ui/FpdFileContents.java
Add new-line characters in error message to make them shorter in multi-lines.
[mirror_edk2.git] / Tools / Java / Source / FrameworkWizard / src / org / tianocore / frameworkwizard / platform / ui / FpdFileContents.java
index b59d3420c27e86f68913615d331a64167d323226..d08202b94ec9f924c3ed691cffc4e418d6089580 100644 (file)
@@ -62,6 +62,7 @@ import org.tianocore.frameworkwizard.platform.ui.global.WorkspaceProfile;
 import org.tianocore.frameworkwizard.platform.ui.global.SurfaceAreaQuery;\r
 import org.tianocore.frameworkwizard.module.Identifications.ModuleIdentification;\r
 import org.tianocore.frameworkwizard.packaging.PackageIdentification;\r
+import org.tianocore.frameworkwizard.workspace.Workspace;\r
 \r
 /**\r
  This class processes fpd file contents such as add remove xml elements. \r
@@ -383,7 +384,7 @@ public class FpdFileContents {
         cursor.dispose();\r
     }\r
     \r
-    public boolean adjustPcd (int seqModuleSa) throws Exception {\r
+    public boolean adjustPcd (int seqModuleSa, Vector<String> vExceptions) throws Exception {\r
         boolean dataModified = false;\r
         ModuleSADocument.ModuleSA moduleSa = getModuleSA(seqModuleSa);\r
         int pcdCount = getPcdDataCount(seqModuleSa);\r
@@ -403,6 +404,7 @@ public class FpdFileContents {
         getLibraryInstances(moduleKey, saaLib);\r
         ModuleIdentification mi = WorkspaceProfile.getModuleId(moduleKey);\r
         if (mi == null) {\r
+            vExceptions.add("Module " + mg + " does NOT exist in workspace.");\r
             throw new Exception ("Module does NOT exist in workspace.");\r
         }\r
         Vector<ModuleIdentification> vMi = new Vector<ModuleIdentification>();\r
@@ -413,7 +415,9 @@ public class FpdFileContents {
         for (int j = 0; j < saaLib.length; ++j) {\r
             String libKey = saaLib[j][1] + " " + saaLib[j][2] + " " + saaLib[j][3] + " " + saaLib[j][4];\r
             ModuleIdentification libMi = WorkspaceProfile.getModuleId(libKey);\r
-            vMi.add(libMi);\r
+            if (libMi != null) {\r
+                vMi.add(libMi);\r
+            }\r
         }\r
         \r
     nextPcd:for (int i = 0; i < saaModuleSaPcd.length; ++i) {\r
@@ -458,8 +462,13 @@ public class FpdFileContents {
                         //\r
                         // ToDo Error \r
                         //\r
-                        throw new PcdDeclNotFound("No Declaration for PCD Entry " + msaPcd.getCName() + " in Module "\r
-                                                  + mi.getName());\r
+                        String errorMessage = "No Declaration for PCD Entry " + msaPcd.getCName() + " in Module "\r
+                        + mi.getName();\r
+                        if (i != 0) {\r
+                            errorMessage += " Library Instance " + vMi.get(i).getName(); \r
+                        }\r
+                        vExceptions.add(errorMessage);\r
+                        throw new PcdDeclNotFound(errorMessage);\r
                     }\r
                     //\r
                     // AddItem to ModuleSA PcdBuildDefinitions\r
@@ -821,7 +830,7 @@ public class FpdFileContents {
         XmlCursor cursor = instance.newCursor();\r
         try{\r
             String comment = "Pkg: " + pn + " Mod: " + mn \r
-                + " Path: " + libMi.getPath().substring(System.getenv("WORKSPACE").length() + 1);\r
+                + " Path: " + libMi.getPath().substring(Workspace.getCurrentWorkspace().length() + 1);\r
             cursor.insertComment(comment);\r
         }\r
         catch (Exception e){\r
@@ -1175,8 +1184,8 @@ public class FpdFileContents {
                 //\r
                 // ToDo Error \r
                 //\r
-                throw new PcdDeclNotFound("No Declaration for PCD Entry " + msaPcd.getCName() + " in Module "\r
-                                          + mi.getName());\r
+                throw new PcdDeclNotFound("No Declaration for PCD Entry " + msaPcd.getCName() + "\n used by Module "\r
+                                          + mi.getName() + " or its Library Instances.");\r
             }\r
             //\r
             // AddItem to ModuleSA PcdBuildDefinitions\r
@@ -1224,7 +1233,7 @@ public class FpdFileContents {
         XmlCursor cursor = msa.newCursor();\r
         try{\r
             String comment = "Mod: " + mi.getName() + " Type: " + SurfaceAreaQuery.getModuleType(mi) + " Path: "\r
-                            + mi.getPath().substring(System.getenv("WORKSPACE").length() + 1);\r
+                            + mi.getPath().substring(Workspace.getCurrentWorkspace().length() + 1);\r
             cursor.insertComment(comment);\r
         }\r
         catch(Exception e){\r
@@ -1337,7 +1346,7 @@ public class FpdFileContents {
         fpdPcd.setDatumType(PcdDataTypes.Enum.forString(dataType));\r
         fpdPcd.setItemType(PcdItemTypes.Enum.forString(itemType));\r
         \r
-        if (defaultVal != null){\r
+        if (defaultVal != null && defaultVal.length() > 0){\r
             fpdPcd.setValue(defaultVal);\r
         }\r
         else {\r
@@ -1348,7 +1357,7 @@ public class FpdFileContents {
                 fpdPcd.setValue("FALSE");\r
             }\r
             if (dataType.equals("VOID*")) {\r
-                fpdPcd.setValue("");\r
+                fpdPcd.setValue("L\"\"");\r
             }\r
         }\r
         //\r
@@ -1499,7 +1508,7 @@ public class FpdFileContents {
             saa[i][1] = dynPcd.getToken().toString();\r
             saa[i][2] = dynPcd.getTokenSpaceGuidCName();\r
             saa[i][3] = dynPcd.getMaxDatumSize()+"";\r
-            saa[i][4] = dynPcd.getDatumType().toString();\r
+            saa[i][4] = dynPcd.getDatumType()+"";\r
             \r
             ++i;\r
         }\r
@@ -1724,9 +1733,10 @@ public class FpdFileContents {
                 return;\r
             }\r
             else {\r
-                QName qSkuInfo = new QName(xmlNs, "SkuInfo");\r
-                cursor.toChild(qSkuInfo);\r
-                cursor.removeXml();\r
+               pcdData.getSkuInfoList().clear();\r
+//                QName qSkuInfo = new QName(xmlNs, "SkuInfo");\r
+//                cursor.toChild(qSkuInfo);\r
+//                cursor.removeXml();\r
             }\r
         }\r
         cursor.dispose();\r
@@ -3693,10 +3703,10 @@ class PcdItemTypeConflictException extends Exception {
     PcdItemTypeConflictException (String pcdName, String info) {\r
         ModuleIdentification mi = WorkspaceProfile.getModuleId(info);\r
         if (mi != null) {\r
-            details = pcdName + " ItemType Conflicts with " + mi.getName() + " in Pkg " + mi.getPackageId().getName();    \r
+            details = pcdName + " ItemType Conflicts with " + mi.getName() + "\n in Pkg " + mi.getPackageId().getName();    \r
         }\r
         else {\r
-            details = pcdName + " ItemType Conflicts with " + info;\r
+            details = pcdName + " ItemType Conflicts with \n" + info;\r
         }\r
     }\r
     \r
@@ -3719,7 +3729,7 @@ class PcdItemTypeConflictException extends Exception {
             moduleInfo2 = info2;\r
         }\r
         \r
-        details = pcdName + " ItemType Conflicts in " + moduleInfo1 + " and " + moduleInfo2;\r
+        details = pcdName + " ItemType Conflicts in \n" + moduleInfo1 + "\n and " + moduleInfo2;\r
     }\r
     \r
     public String getMessage() {\r