Rewrote the error message output when module cannnot be found in any packages.

git-svn-id: https://edk2.svn.sourceforge.net/svnroot/edk2/trunk/edk2@2133 6f19259b-4bc3-4df7-8a09-765794883524
This commit is contained in:
jwang36
2006-12-22 09:59:49 +00:00
parent 1d67f00e73
commit 89da7ebac5
2 changed files with 30 additions and 9 deletions

View File

@ -302,19 +302,19 @@ public class GlobalData {
PackageIdentification packageId = null; PackageIdentification packageId = null;
Iterator iter = packageList.iterator(); Iterator iter = packageList.iterator();
while (iter.hasNext()) { while (iter.hasNext()) {
packageId = (PackageIdentification)iter.next(); PackageIdentification pid = (PackageIdentification)iter.next();
moduleId.setPackage(packageId); Spd spd = spdTable.get(pid);
Spd spd = spdTable.get(packageId);
File tempMsaFile = null; File tempMsaFile = null;
if ((tempMsaFile = spd.getModuleFile(moduleId)) != null ) { if ((tempMsaFile = spd.getModuleFile(moduleId)) != null ) {
if (tempMsaFile.getParent().equalsIgnoreCase(moduleId.getMsaFile().getParent())) { if (tempMsaFile.getParent().equalsIgnoreCase(moduleId.getMsaFile().getParent())) {
packageId = pid;
break ; break ;
} }
tempMsaFile = null; tempMsaFile = null;
} }
} }
if (packageId == null){ if (packageId == null){
throw new EdkException("Can't find Module [" + moduleId.getName() + "] in any SPD package!"); throw new EdkException("Can't find Module [" + moduleId.getName() + "] in any package!");
} else { } else {
return packageId; return packageId;
} }
@ -648,7 +648,7 @@ public class GlobalData {
return moduleId; return moduleId;
} }
} }
throw new EdkException("Can't find module GUID value " + moduleId.toGuidString() + " in " + packageId + " under the current workspace!"); throw new EdkException("Can't find " + moduleId + " under the current workspace!");
} }
public synchronized static Set<PackageIdentification> getPackageList(){ public synchronized static Set<PackageIdentification> getPackageList(){

View File

@ -129,12 +129,33 @@ public class ModuleIdentification extends Identification {
} }
public String toString() { public String toString() {
if (version == null || version.trim().equalsIgnoreCase("")) { String nameString;
return "Module [" + name + "] in " + packageId; String versionString;
String packageString;
if (name != null && name != "") {
nameString = name;
} else {
if (guid != null && guid != "") {
nameString = guid;
} else {
nameString = "UNKNOWN";
}
} }
else {
return "Module [" + name + " " + version + "] in " + packageId; if (version != null) {
versionString = version;
} else {
versionString = "";
} }
if (packageId != null) {
packageString = packageId.toString();
} else {
packageString = "Package [UNKNOWN]";
}
return "Module [" + nameString + versionString + "] in " + packageString;
} }
/** /**