]> git.proxmox.com Git - mirror_edk2.git/commitdiff
Unify the logger and exception in AutoGen.
authorqouyang <qouyang@6f19259b-4bc3-4df7-8a09-765794883524>
Thu, 7 Sep 2006 08:02:44 +0000 (08:02 +0000)
committerqouyang <qouyang@6f19259b-4bc3-4df7-8a09-765794883524>
Thu, 7 Sep 2006 08:02:44 +0000 (08:02 +0000)
git-svn-id: https://edk2.svn.sourceforge.net/svnroot/edk2/trunk/edk2@1493 6f19259b-4bc3-4df7-8a09-765794883524

Tools/Source/GenBuild/org/tianocore/build/autogen/AutoGen.java
Tools/Source/GenBuild/org/tianocore/build/autogen/AutogenLibOrder.java
Tools/Source/GenBuild/org/tianocore/build/exception/GenBuildException.java
Tools/Source/GenBuild/org/tianocore/build/exception/PcdAutogenException.java
Tools/Source/GenBuild/org/tianocore/build/exception/PlatformPcdPreprocessBuildException.java
Tools/Source/GenBuild/org/tianocore/build/exception/TianoToolsException.java
Tools/Source/GenBuild/org/tianocore/build/exception/XmlParseException.java

index 117b6bfe17944810f2348f9d38310d78ab853c29..cf83a871c5c262563d4d50f223eff1fc568dca6b 100644 (file)
@@ -208,29 +208,28 @@ public class AutoGen {
       @throws BuildException\r
                   Failed to creat AutoGen.c & AutoGen.h.\r
     **/\r
-    public void genAutogen() throws BuildException {\r
+    public void genAutogen() throws EdkException {\r
         try {\r
             //\r
             // If outputPath do not exist, create it.\r
             //\r
             File path = new File(outputPath);\r
             path.mkdirs();\r
-\r
-            //\r
-            // Check current is library or not, then call the corresponding\r
-            // function.\r
-            //\r
-            if (this.moduleId.isLibrary()) {\r
-                libGenAutogen();\r
-            } else {\r
-                moduleGenAutogen();\r
-            }\r
-\r
-        } catch (Exception e) {\r
-            throw new BuildException(\r
-                                    "Failed to create AutoGen.c & AutoGen.h!\n"\r
-                                    + e.getMessage());\r
+               } catch (Exception e) {\r
+            throw new AutoGenException(\r
+                                    "Failed to create "\r
+                                    + outputPath + " directory");\r
         }\r
+            \r
+               //\r
+               // Check current is library or not, then call the corresponding\r
+               // function.\r
+               //\r
+               if (this.moduleId.isLibrary()) {\r
+                       libGenAutogen();\r
+               } else {\r
+                       moduleGenAutogen();\r
+               }\r
     }\r
 \r
     /**\r
@@ -241,17 +240,10 @@ public class AutoGen {
       @throws BuildException\r
                   Faile to create module AutoGen.c & AutoGen.h.\r
     **/\r
-    void moduleGenAutogen() throws BuildException {\r
-\r
-        try {\r
-            collectLibInstanceInfo();\r
-            moduleGenAutogenC();\r
-            moduleGenAutogenH();\r
-        } catch (Exception e) {\r
-            throw new BuildException(\r
-                                    "Faile to create module AutoGen.c & AutoGen.h!\n"\r
-                                    + e.getMessage());\r
-        }\r
+    void moduleGenAutogen() throws EdkException {\r
+               collectLibInstanceInfo();\r
+               moduleGenAutogenC();\r
+               moduleGenAutogenH();\r
     }\r
 \r
     /**\r
@@ -262,15 +254,9 @@ public class AutoGen {
       @throws BuildException\r
                   Faile to create library AutoGen.c & AutoGen.h\r
     **/\r
-    void libGenAutogen() throws BuildException {\r
-        try {\r
-            libGenAutogenC();\r
-            libGenAutogenH();\r
-        } catch (Exception e) {\r
-            throw new BuildException(\r
-                                    "Failed to create library AutoGen.c & AutoGen.h!\n"\r
-                                    + e.getMessage());\r
-        }\r
+    void libGenAutogen() throws EdkException {\r
+               libGenAutogenC();\r
+               libGenAutogenH();\r
     }\r
 \r
     /**\r
@@ -281,7 +267,7 @@ public class AutoGen {
       @throws BuildException\r
                   Failed to generate AutoGen.h.\r
     **/\r
-    void moduleGenAutogenH() throws EdkException, AutoGenException {\r
+    void moduleGenAutogenH() throws EdkException {\r
 \r
         Set<String> libClassIncludeH;\r
         String moduleType;\r
@@ -395,7 +381,7 @@ public class AutoGen {
         // Save string buffer content in AutoGen.h.\r
         //\r
         if (!saveFile(outputPath + File.separatorChar + "AutoGen.h", fileBuffer)) {\r
-            throw new BuildException("Failed to generate AutoGen.h !!!");\r
+            throw new AutoGenException("Failed to generate AutoGen.h !!!");\r
         }\r
     }\r
 \r
@@ -407,7 +393,7 @@ public class AutoGen {
       @throws BuildException\r
                   Failed to generate AutoGen.c.\r
     **/\r
-    void moduleGenAutogenC() throws EdkException, AutoGenException {\r
+    void moduleGenAutogenC() throws EdkException {\r
 \r
         StringBuffer fileBuffer = new StringBuffer(8192);\r
         //\r
@@ -511,19 +497,15 @@ public class AutoGen {
                                                  false, \r
                                                  null,\r
                                                  pcdDriverType);\r
-        try {\r
-            this.myPcdAutogen.execute();\r
-        } catch (Exception exp) {\r
-            throw new PcdAutogenException (exp.getMessage());\r
-        }\r
-\r
+        \r
+        this.myPcdAutogen.execute();\r
         if (this.myPcdAutogen != null) {\r
             fileBuffer.append("\r\n");\r
             fileBuffer.append(this.myPcdAutogen.getCAutoGenString());\r
         }\r
 \r
         if (!saveFile(outputPath + File.separatorChar + "AutoGen.c", fileBuffer)) {\r
-            throw new BuildException("Failed to generate AutoGen.c !!!");\r
+            throw new AutoGenException("Failed to generate AutoGen.c !!!");\r
         }\r
 \r
     }\r
@@ -536,7 +518,7 @@ public class AutoGen {
       @throws BuildException\r
                   Failed to generate AutoGen.c.\r
     **/\r
-    void libGenAutogenH() throws EdkException, AutoGenException {\r
+    void libGenAutogenH() throws EdkException {\r
 \r
         Set<String> libClassIncludeH;\r
         String moduleType;\r
@@ -641,7 +623,7 @@ public class AutoGen {
         // Save content of string buffer to AutoGen.h file.\r
         //\r
         if (!saveFile(outputPath + File.separatorChar + "AutoGen.h", fileBuffer)) {\r
-            throw new BuildException("Failed to generate AutoGen.h !!!");\r
+            throw new AutoGenException("Failed to generate AutoGen.h !!!");\r
         }\r
     }\r
 \r
@@ -653,7 +635,7 @@ public class AutoGen {
       @throws BuildException\r
                   Failed to generate AutoGen.c.\r
     **/\r
-    void libGenAutogenC() throws BuildException, PcdAutogenException {\r
+    void libGenAutogenC() throws EdkException {\r
         StringBuffer fileBuffer = new StringBuffer(10240);\r
 \r
         //\r
@@ -672,19 +654,14 @@ public class AutoGen {
                                                  true,\r
                                                  saq.getModulePcdEntryNameArray(),\r
                                                  pcdDriverType);\r
-        try {\r
-            this.myPcdAutogen.execute();\r
-        } catch (Exception e) {\r
-            throw new PcdAutogenException(e.getMessage());\r
-        }\r
-\r
+        this.myPcdAutogen.execute();\r
         if (this.myPcdAutogen != null) {\r
             fileBuffer.append(ToolDefinitions.LINE_SEPARATOR);\r
             fileBuffer.append(this.myPcdAutogen.getCAutoGenString());\r
         }\r
 \r
         if (!saveFile(outputPath + File.separatorChar + "AutoGen.c", fileBuffer)) {\r
-            throw new BuildException("Failed to generate AutoGen.c !!!");\r
+            throw new AutoGenException("Failed to generate AutoGen.c !!!");\r
         }\r
     }\r
 \r
@@ -700,7 +677,7 @@ public class AutoGen {
       @return includeStrList List of *.h file.\r
     **/\r
     Set<String> LibraryClassToAutogenH(String[] libClassList)\r
-    throws EdkException, AutoGenException {\r
+    throws EdkException {\r
         Set<String> includeStrList = new LinkedHashSet<String>();\r
         String includeName[];\r
         String str = "";\r
@@ -781,7 +758,7 @@ public class AutoGen {
       @throws Exception\r
     **/\r
     void EntryPointToAutoGen(String[] entryPointList, String[] unloadImageList, StringBuffer fileBuffer)\r
-    throws BuildException {\r
+    throws EdkException {\r
 \r
         String typeStr = saq.getModuleType();\r
                int unloadImageCount = 0;\r
@@ -795,7 +772,7 @@ public class AutoGen {
         \r
         case CommonDefinition.ModuleTypePeiCore:\r
             if (entryPointList == null ||entryPointList.length != 1 ) {\r
-                throw new BuildException(\r
+                throw new AutoGenException(\r
                                         "Module type = 'PEI_CORE', can have only one module entry point!");\r
             } else {\r
                 fileBuffer.append("EFI_STATUS\r\n");\r
@@ -827,7 +804,7 @@ public class AutoGen {
         case CommonDefinition.ModuleTypeDxeCore:\r
             fileBuffer.append("const UINT32 _gUefiDriverRevision = 0;\r\n");\r
             if (entryPointList == null || entryPointList.length != 1) {\r
-                throw new BuildException(\r
+                throw new AutoGenException(\r
                                         "Module type = 'DXE_CORE', can have only one module entry point!");\r
             } else {\r
 \r
@@ -1294,7 +1271,7 @@ public class AutoGen {
       @throws BuildException\r
                   Protocol name must set.\r
     **/\r
-    void ProtocolGuidToAutogenC(StringBuffer fileBuffer) throws BuildException {\r
+    void ProtocolGuidToAutogenC(StringBuffer fileBuffer) throws EdkException {\r
         String[] cNameGuid = null;\r
 \r
         String[] protocolList = saq.getProtocolArray(this.arch);\r
@@ -1334,7 +1311,7 @@ public class AutoGen {
                 //\r
                 // If can't find protocol GUID declaration in every package\r
                 //\r
-                throw new BuildException("Can not find protocol Guid ["\r
+                throw new AutoGenException("Can not find protocol Guid ["\r
                                          + protocolKeyWord + "] declaration in any SPD package!");\r
             }\r
         }\r
@@ -1395,21 +1372,17 @@ public class AutoGen {
                  String buffer for AutoGen.c\r
       @throws BuildException\r
     **/\r
-    void LibInstanceToAutogenC(StringBuffer fileBuffer) throws BuildException {\r
-        try {\r
-            String moduleType = this.moduleId.getModuleType();\r
-            //\r
-            // Add library constructor to AutoGen.c\r
-            //\r
-            LibConstructorToAutogenC(libConstructList, moduleType,\r
-                                     fileBuffer/* autogenC */);\r
-            //\r
-            // Add library destructor to AutoGen.c\r
-            //\r
-            LibDestructorToAutogenC(libDestructList, moduleType, fileBuffer/* autogenC */);\r
-        } catch (Exception e) {\r
-            throw new BuildException(e.getMessage());\r
-        }\r
+    void LibInstanceToAutogenC(StringBuffer fileBuffer) throws EdkException {\r
+               String moduleType = this.moduleId.getModuleType();\r
+               //\r
+               // Add library constructor to AutoGen.c\r
+               //\r
+               LibConstructorToAutogenC(libConstructList, moduleType,\r
+                                                                fileBuffer/* autogenC */);\r
+               //\r
+               // Add library destructor to AutoGen.c\r
+               //\r
+               LibDestructorToAutogenC(libDestructList, moduleType, fileBuffer/* autogenC */);\r
     }\r
 \r
     /**\r
@@ -1427,7 +1400,7 @@ public class AutoGen {
       @throws Exception\r
     **/\r
     void LibConstructorToAutogenC(List<String> libInstanceList,\r
-                                  String moduleType, StringBuffer fileBuffer) throws Exception {\r
+                                  String moduleType, StringBuffer fileBuffer) throws EdkException {\r
         boolean isFirst = true;\r
 \r
         //\r
@@ -1568,7 +1541,7 @@ public class AutoGen {
       @throws Exception\r
     **/\r
     void LibDestructorToAutogenC(List<String> libInstanceList,\r
-                                 String moduleType, StringBuffer fileBuffer) throws Exception {\r
+                                 String moduleType, StringBuffer fileBuffer) throws EdkException {\r
         boolean isFirst = true;\r
         for (int i = 0; i < libInstanceList.size(); i++) {\r
             switch (CommonDefinition.getModuleType(moduleType)) {\r
@@ -1663,7 +1636,7 @@ public class AutoGen {
                  String buffer for AutoGen.c\r
     **/\r
     void ExternsDriverBindingToAutoGenC(StringBuffer fileBuffer)\r
-    throws BuildException {\r
+    throws EdkException {\r
 \r
         //\r
         // Check what <extern> contains. And the number of following elements\r
@@ -1702,7 +1675,7 @@ public class AutoGen {
         //\r
         if (compNamList != null && compNamList.length != 0) {\r
             if (drvBindList.length != compNamList.length) {\r
-                throw new BuildException(\r
+                throw new AutoGenException(\r
                                         "Different number of Driver Binding and Component Name protocols!");\r
             }\r
 \r
@@ -1719,7 +1692,7 @@ public class AutoGen {
         //\r
         if (compConfList != null && compConfList.length != 0) {\r
             if (drvBindList.length != compConfList.length) {\r
-                throw new BuildException(\r
+                throw new AutoGenException(\r
                                         "Different number of Driver Binding and Driver Configuration protocols!");\r
             }\r
 \r
@@ -1736,7 +1709,7 @@ public class AutoGen {
         //\r
         if (compDiagList != null && compDiagList.length != 0) {\r
             if (drvBindList.length != compDiagList.length) {\r
-                throw new BuildException(\r
+                throw new AutoGenException(\r
                                         "Different number of Driver Binding and Driver Diagnosis protocols!");\r
             }\r
 \r
@@ -1818,7 +1791,7 @@ public class AutoGen {
       @throws BuildException\r
     **/\r
     void ExternCallBackToAutoGenC(StringBuffer fileBuffer)\r
-    throws BuildException {\r
+    throws EdkException {\r
         //\r
         // Collect module's <SetVirtualAddressMapCallBack> and\r
         // <ExitBootServiceCallBack> and add to setVirtualAddList\r
@@ -1879,20 +1852,21 @@ public class AutoGen {
         //  do nothing.\r
         //\r
         if ((!outFile.exists()) ||(inFile.lastModified() - outFile.lastModified()) >= 0) {\r
-            try {\r
-                if (inFile.exists()) {\r
-                    FileInputStream fis = new FileInputStream (inFile);\r
-                    fis.read(buffer);\r
-                    FileOutputStream fos = new FileOutputStream(outFile);\r
-                    fos.write(buffer);\r
-                    fis.close();\r
-                    fos.close();\r
-                } else {\r
-                    throw new AutoGenException("The file, flashMap.h doesn't exist!");\r
-                }\r
-            } catch (Exception e) {\r
-                throw new AutoGenException(e.getMessage());\r
-            }\r
+                       if (inFile.exists()) {\r
+                               try{\r
+                                       FileInputStream fis = new FileInputStream (inFile);\r
+                                   fis.read(buffer);\r
+                                   FileOutputStream fos = new FileOutputStream(outFile);\r
+                                   fos.write(buffer);\r
+                                   fis.close();\r
+                                   fos.close();\r
+                               } catch (IOException e){\r
+                    throw new AutoGenException("The file, flashMap.h can't be open!");\r
+                               }\r
+                               \r
+                       } else {\r
+                               throw new AutoGenException("The file, flashMap.h doesn't exist!");\r
+                       }\r
         }\r
     }\r
 \r
@@ -1914,119 +1888,114 @@ public class AutoGen {
         String[] exitBoots = null;\r
 \r
         ModuleIdentification[] libraryIdList = saq.getLibraryInstance(this.arch);\r
-        try {\r
-            if (libraryIdList != null) {\r
-                //\r
-                // Reorder library instance sequence.\r
-                //\r
-                AutogenLibOrder libOrder = new AutogenLibOrder(libraryIdList,\r
-                                                               this.arch);\r
-                List<ModuleIdentification> orderList = libOrder\r
-                                                       .orderLibInstance();\r
-\r
-                if (orderList != null) {\r
-                    //\r
-                    // Process library instance one by one.\r
-                    //\r
-                    for (int i = 0; i < orderList.size(); i++) {\r
-\r
-                        //\r
-                        // Get library instance basename.\r
-                        //\r
-                        ModuleIdentification libInstanceId = orderList.get(i);\r
-\r
-                        //\r
-                        // Get override map\r
-                        //\r
-\r
-                        Map<String, XmlObject> libDoc = GlobalData.getDoc(libInstanceId, this.arch);\r
-                        saq.push(libDoc);\r
-                        //\r
-                        // Get <PPis>, <Protocols>, <Guids> list of this library\r
-                        // instance.\r
-                        //\r
-                        String[] ppiList = saq.getPpiArray(this.arch);\r
-                        String[] ppiNotifyList = saq.getPpiNotifyArray(this.arch);\r
-                        String[] protocolList = saq.getProtocolArray(this.arch);\r
-                        String[] protocolNotifyList = saq.getProtocolNotifyArray(this.arch);\r
-                        String[] guidList = saq.getGuidEntryArray(this.arch);\r
-                        PackageIdentification[] pkgList = saq.getDependencePkg(this.arch);\r
-\r
-                        //\r
-                        // Add those ppi, protocol, guid in global ppi,\r
-                        // protocol, guid\r
-                        // list.\r
-                        //\r
-                        for (index = 0; index < ppiList.length; index++) {\r
-                            this.mPpiList.add(ppiList[index]);\r
-                        }\r
-\r
-                        for (index = 0; index < ppiNotifyList.length; index++) {\r
-                            this.mPpiList.add(ppiNotifyList[index]);\r
-                        }\r
-\r
-                        for (index = 0; index < protocolList.length; index++) {\r
-                            this.mProtocolList.add(protocolList[index]);\r
-                        }\r
-\r
-                        for (index = 0; index < protocolNotifyList.length; index++) {\r
-                            this.mProtocolList.add(protocolNotifyList[index]);\r
-                        }\r
 \r
-                        for (index = 0; index < guidList.length; index++) {\r
-                            this.mGuidList.add(guidList[index]);\r
-                        }\r
-                        for (index = 0; index < pkgList.length; index++) {\r
-                            if (!this.mDepPkgList.contains(pkgList[index])) {\r
-                                this.mDepPkgList.add(pkgList[index]);\r
-                            }\r
-                        }\r
-\r
-                        //\r
-                        // If not yet parse this library instance's constructor\r
-                        // element,parse it.\r
-                        //\r
-                        libConstructName = saq.getLibConstructorName();\r
-                        libDestructName = saq.getLibDestructorName();\r
-\r
-                        //\r
-                        // Collect SetVirtualAddressMapCallBack and\r
-                        // ExitBootServiceCallBack.\r
-                        //\r
-                        setVirtuals = saq.getSetVirtualAddressMapCallBackArray();\r
-                        exitBoots = saq.getExitBootServicesCallBackArray();\r
-                        if (setVirtuals != null) {\r
-                            for (int j = 0; j < setVirtuals.length; j++) {\r
-                                this.setVirtalAddList.add(setVirtuals[j]);\r
-                            }\r
-                        }\r
-                        if (exitBoots != null) {\r
-                            for (int k = 0; k < exitBoots.length; k++) {\r
-                                this.exitBootServiceList.add(exitBoots[k]);\r
-                            }\r
-                        }\r
-                        saq.pop();\r
-                        //\r
-                        // Add dependent library instance constructor function.\r
-                        //\r
-                        if (libConstructName != null) {\r
-                            this.libConstructList.add(libConstructName);\r
-                        }\r
-                        //\r
-                        // Add dependent library instance destructor fuction.\r
-                        //\r
-                        if (libDestructName != null) {\r
-                            this.libDestructList.add(libDestructName);\r
-                        }\r
-                    }\r
-                }\r
-\r
-            }\r
+               if (libraryIdList != null) {\r
+                       //\r
+                       // Reorder library instance sequence.\r
+                       //\r
+                       AutogenLibOrder libOrder = new AutogenLibOrder(libraryIdList,\r
+                                                                                                                  this.arch);\r
+                       List<ModuleIdentification> orderList = libOrder\r
+                                                                                                  .orderLibInstance();\r
+\r
+                       if (orderList != null) {\r
+                               //\r
+                               // Process library instance one by one.\r
+                               //\r
+                               for (int i = 0; i < orderList.size(); i++) {\r
+\r
+                                       //\r
+                                       // Get library instance basename.\r
+                                       //\r
+                                       ModuleIdentification libInstanceId = orderList.get(i);\r
+\r
+                                       //\r
+                                       // Get override map\r
+                                       //\r
+\r
+                                       Map<String, XmlObject> libDoc = GlobalData.getDoc(libInstanceId, this.arch);\r
+                                       saq.push(libDoc);\r
+                                       //\r
+                                       // Get <PPis>, <Protocols>, <Guids> list of this library\r
+                                       // instance.\r
+                                       //\r
+                                       String[] ppiList = saq.getPpiArray(this.arch);\r
+                                       String[] ppiNotifyList = saq.getPpiNotifyArray(this.arch);\r
+                                       String[] protocolList = saq.getProtocolArray(this.arch);\r
+                                       String[] protocolNotifyList = saq.getProtocolNotifyArray(this.arch);\r
+                                       String[] guidList = saq.getGuidEntryArray(this.arch);\r
+                                       PackageIdentification[] pkgList = saq.getDependencePkg(this.arch);\r
+\r
+                                       //\r
+                                       // Add those ppi, protocol, guid in global ppi,\r
+                                       // protocol, guid\r
+                                       // list.\r
+                                       //\r
+                                       for (index = 0; index < ppiList.length; index++) {\r
+                                               this.mPpiList.add(ppiList[index]);\r
+                                       }\r
+\r
+                                       for (index = 0; index < ppiNotifyList.length; index++) {\r
+                                               this.mPpiList.add(ppiNotifyList[index]);\r
+                                       }\r
+\r
+                                       for (index = 0; index < protocolList.length; index++) {\r
+                                               this.mProtocolList.add(protocolList[index]);\r
+                                       }\r
+\r
+                                       for (index = 0; index < protocolNotifyList.length; index++) {\r
+                                               this.mProtocolList.add(protocolNotifyList[index]);\r
+                                       }\r
+\r
+                                       for (index = 0; index < guidList.length; index++) {\r
+                                               this.mGuidList.add(guidList[index]);\r
+                                       }\r
+                                       for (index = 0; index < pkgList.length; index++) {\r
+                                               if (!this.mDepPkgList.contains(pkgList[index])) {\r
+                                                       this.mDepPkgList.add(pkgList[index]);\r
+                                               }\r
+                                       }\r
+\r
+                                       //\r
+                                       // If not yet parse this library instance's constructor\r
+                                       // element,parse it.\r
+                                       //\r
+                                       libConstructName = saq.getLibConstructorName();\r
+                                       libDestructName = saq.getLibDestructorName();\r
+\r
+                                       //\r
+                                       // Collect SetVirtualAddressMapCallBack and\r
+                                       // ExitBootServiceCallBack.\r
+                                       //\r
+                                       setVirtuals = saq.getSetVirtualAddressMapCallBackArray();\r
+                                       exitBoots = saq.getExitBootServicesCallBackArray();\r
+                                       if (setVirtuals != null) {\r
+                                               for (int j = 0; j < setVirtuals.length; j++) {\r
+                                                       this.setVirtalAddList.add(setVirtuals[j]);\r
+                                               }\r
+                                       }\r
+                                       if (exitBoots != null) {\r
+                                               for (int k = 0; k < exitBoots.length; k++) {\r
+                                                       this.exitBootServiceList.add(exitBoots[k]);\r
+                                               }\r
+                                       }\r
+                                       saq.pop();\r
+                                       //\r
+                                       // Add dependent library instance constructor function.\r
+                                       //\r
+                                       if (libConstructName != null) {\r
+                                               this.libConstructList.add(libConstructName);\r
+                                       }\r
+                                       //\r
+                                       // Add dependent library instance destructor fuction.\r
+                                       //\r
+                                       if (libDestructName != null) {\r
+                                               this.libDestructList.add(libDestructName);\r
+                                       }\r
+                               }\r
+                       }\r
 \r
-        } catch (Exception e) {\r
-            System.out.println(e.getMessage());\r
-            System.out.println("Collect library instance failed!");\r
-        }\r
+               }\r
     }\r
        private void setVirtualAddressToAutogenC(StringBuffer fileBuffer){\r
         //\r
index 28e2a296f156bd91fedfa705aee12aec2f8fc5c8..bddea90aab2dee3f612bb7a7d91e3660415a46f4 100644 (file)
@@ -22,9 +22,11 @@ import java.util.List;
 import java.util.Map;\r
 \r
 import org.apache.xmlbeans.XmlObject;\r
+import org.tianocore.build.exception.AutoGenException;\r
 import org.tianocore.build.global.GlobalData;\r
 import org.tianocore.build.global.SurfaceAreaQuery;\r
 import org.tianocore.build.id.ModuleIdentification;\r
+import org.tianocore.common.exception.EdkException;\r
 \r
 /**\r
   This class This class is to reorder library instance sequence according to\r
@@ -55,7 +57,7 @@ public class AutogenLibOrder {
       @param  libraryList   List of the library instance.\r
       @throws Exception\r
     **/\r
-    AutogenLibOrder(ModuleIdentification[] libraryList, String arch) throws Exception {\r
+    AutogenLibOrder(ModuleIdentification[] libraryList, String arch) throws EdkException {\r
         LibraryInstanceNode libInstanceNode;\r
         String[]       libClassDeclList = null;\r
         String[]       libClassConsmList = null;\r
@@ -80,9 +82,9 @@ public class AutogenLibOrder {
                     classStr[k] = libClassConsmList[k];\r
                 }\r
                 if (this.libInstanceMap.containsKey(libraryList[i])) {\r
-                    throw new Exception(\r
+                    throw new AutoGenException(\r
                             libraryList[i].getName()\r
-                                    + "this library instance already exists, please check the library instance list!");\r
+                                    + "-- this library instance already exists, please check the library instance list!");\r
                 } else {\r
                     this.libInstanceMap.put(libraryList[i], classStr);\r
                 }\r
@@ -98,7 +100,7 @@ public class AutogenLibOrder {
                         System.out.println(libClassDeclList[j]\r
                                 + " class is already implement by "\r
                                 + this.libClassMap.get(libClassDeclList[j]));\r
-                        throw new Exception("Library Class: " + libClassDeclList\r
+                        throw new AutoGenException("Library Class: " + libClassDeclList\r
                                 + " already has a library instance!");\r
                     } else {\r
                         this.libClassMap.put(libClassDeclList[j], libraryList[i]);\r
index c1d77444f159577a28298a3a845e5d2ae1aaa57a..b81d54cba2decbd143ccda488a674d0651863b13 100644 (file)
@@ -28,7 +28,7 @@ public class GenBuildException extends EdkException {
       @param expStr exception message string.\r
     **/\r
     public GenBuildException(String expStr) {\r
-        super("[GenBuildException]:" + expStr);\r
+        super(expStr);\r
     }\r
 \r
     public GenBuildException() {\r
index 558cff990e97a1874106beb6c77459d98b7b3104..3a3430c820bd2a57ad2b4ded4ffbbef9d9d2564b 100644 (file)
@@ -26,7 +26,7 @@ public class PcdAutogenException extends AutoGenException {
       @param expStr exception message string.\r
     **/\r
     public PcdAutogenException(String expStr) {\r
-        super("\r\n[PcdAutogenException] #############################\r\n" + expStr);\r
+        super(expStr);\r
     }\r
     \r
     public PcdAutogenException() {\r
index 894f25e03441518e9dec1dc2d9421f6ed73423e0..6bf61101489de8ef27abd2afb0ed140d1da1a3b2 100644 (file)
@@ -27,7 +27,7 @@ public class PlatformPcdPreprocessBuildException extends GenBuildException {
       @param expStr exception message string.\r
     **/\r
     public PlatformPcdPreprocessBuildException(String expStr) {\r
-        super("\r\n[PlatformPcdPreprocess Failure] #############################\r\n" + expStr);\r
+        super(expStr);\r
     }\r
 \r
     public PlatformPcdPreprocessBuildException() {\r
index 077905a8e86e22461ab066a5968853bd42731b42..bcfe37a8d67e89040a96b6af64b234d57a43217b 100644 (file)
@@ -28,7 +28,7 @@ public class TianoToolsException extends EdkException {
       @param expStr exception message string.\r
     **/\r
     public TianoToolsException(String expStr) {\r
-        super("[TianoToolsException]:" + expStr);\r
+        super(expStr);\r
     }\r
 \r
     public TianoToolsException() {\r
index 0ba1a787aaac814d8332efd43d0a26522493a850..44d3fdc3893278df6a43c616425de2cde1abaa3f 100644 (file)
@@ -26,7 +26,7 @@ public class XmlParseException extends GenBuildException {
       @param expStr exception message string.\r
     **/\r
     public XmlParseException(String expStr) {\r
-        super("[XmlParseException]:" + expStr);\r
+        super(expStr);\r
     }\r
     \r
     public XmlParseException() {\r