Added some checks to see if the attributes were set - clears up some warning messages when trying to unset an attribute that was not set.

git-svn-id: https://edk2.svn.sourceforge.net/svnroot/edk2/trunk/edk2@1024 6f19259b-4bc3-4df7-8a09-765794883524
This commit is contained in:
lhauch 2006-07-16 08:26:44 +00:00
parent 97796eaa70
commit 322b772308
2 changed files with 45 additions and 17 deletions

View File

@ -340,22 +340,29 @@ public class SpdFileContents {
if (instanceVer != null){ if (instanceVer != null){
lc.setRecommendedInstanceVersion(instanceVer); lc.setRecommendedInstanceVersion(instanceVer);
} else { } else {
lc.unsetRecommendedInstanceVersion(); if (lc.isSetRecommendedInstanceVersion()) {
lc.unsetRecommendedInstanceVersion();
}
} }
} else { } else {
lc.unsetRecommendedInstanceGuid(); if (lc.isSetRecommendedInstanceGuid()) {
lc.unsetRecommendedInstanceVersion(); lc.unsetRecommendedInstanceGuid();
}
} }
if (stringToList(hdrAttribArch) != null){ if (stringToList(hdrAttribArch) != null){
lc.setSupArchList(stringToList(hdrAttribArch)); lc.setSupArchList(stringToList(hdrAttribArch));
} else { } else {
lc.unsetSupArchList(); if (lc.isSetSupArchList()) {
lc.unsetSupArchList();
}
} }
if (stringToList(hdrAttribModType) != null){ if (stringToList(hdrAttribModType) != null){
lc.setSupModuleList(stringToList(hdrAttribModType)); lc.setSupModuleList(stringToList(hdrAttribModType));
} else { } else {
lc.unsetSupModuleList(); if (lc.isSetSupModuleList()) {
lc.unsetSupModuleList();
}
} }
} }
@ -397,22 +404,28 @@ public class SpdFileContents {
e.setGuidValue(guid); e.setGuidValue(guid);
e.setHelpText(hlp); e.setHelpText(hlp);
if (stringToList(guidTypeList) != null) { if (stringToList(guidTypeList) != null) {
e.setGuidTypeList(stringToList(guidTypeList)); e.setGuidTypeList(stringToList(guidTypeList));
} }
else{ else{
if (e.isSetGuidTypeList()) {
e.unsetGuidTypeList(); e.unsetGuidTypeList();
}
} }
if (stringToList(archList) != null){ if (stringToList(archList) != null){
e.setSupArchList(stringToList(archList)); e.setSupArchList(stringToList(archList));
} }
else{ else{
if (e.isSetSupArchList()) {
e.unsetSupArchList(); e.unsetSupArchList();
}
} }
if (stringToList(modTypeList) != null) { if (stringToList(modTypeList) != null) {
e.setSupModuleList(stringToList(modTypeList)); e.setSupModuleList(stringToList(modTypeList));
} }
else{ else{
if (e.isSetSupModuleList()) {
e.unsetSupModuleList(); e.unsetSupModuleList();
}
} }
} }
@ -440,13 +453,17 @@ public class SpdFileContents {
e.setSupArchList(stringToList(archList)); e.setSupArchList(stringToList(archList));
} }
else{ else{
if (e.isSetSupArchList()) {
e.unsetSupArchList(); e.unsetSupArchList();
}
} }
if (stringToList(modTypeList) != null) { if (stringToList(modTypeList) != null) {
e.setSupModuleList(stringToList(modTypeList)); e.setSupModuleList(stringToList(modTypeList));
} }
else{ else{
if (e.isSetSupModuleList()) {
e.unsetSupModuleList(); e.unsetSupModuleList();
}
} }
} }
cursor.dispose(); cursor.dispose();
@ -473,13 +490,17 @@ public class SpdFileContents {
e.setSupArchList(stringToList(archList)); e.setSupArchList(stringToList(archList));
} }
else{ else{
if (e.isSetSupArchList()) {
e.unsetSupArchList(); e.unsetSupArchList();
}
} }
if (stringToList(modTypeList) != null) { if (stringToList(modTypeList) != null) {
e.setSupModuleList(stringToList(modTypeList)); e.setSupModuleList(stringToList(modTypeList));
} }
else{ else{
if (e.isSetSupModuleList()) {
e.unsetSupModuleList(); e.unsetSupModuleList();
}
} }
} }
cursor.dispose(); cursor.dispose();
@ -989,11 +1010,18 @@ public class SpdFileContents {
*/ */
if (hdrAttribArch != null) { if (hdrAttribArch != null) {
lc.setSupArchList(stringToList(hdrAttribArch)); lc.setSupArchList(stringToList(hdrAttribArch));
} else {
if (lc.isSetSupArchList()) {
lc.unsetSupArchList();
}
} }
if (hdrAttribModType != null) { if (hdrAttribModType != null) {
lc.setSupModuleList(stringToList(hdrAttribModType)); lc.setSupModuleList(stringToList(hdrAttribModType));
} else { } else {
lc.unsetSupModuleList(); if (lc.isSetSupModuleList()) {
lc.unsetSupModuleList();
}
} }
} }
@ -1278,12 +1306,16 @@ public class SpdFileContents {
if (archList != null){ if (archList != null){
pe.setSupArchList(stringToList(archList)); pe.setSupArchList(stringToList(archList));
} else { } else {
pe.unsetSupArchList(); if (pe.isSetSupArchList()) {
pe.unsetSupArchList();
}
} }
if (modTypeList != null){ if (modTypeList != null){
pe.setSupModuleList(stringToList(modTypeList)); pe.setSupModuleList(stringToList(modTypeList));
} else { } else {
pe.unsetSupModuleList(); if (pe.isSetSupModuleList()) {
pe.unsetSupModuleList();
}
} }
} }

View File

@ -251,7 +251,6 @@ public class SpdLibClassDecls extends IInternalFrame implements TableModelListen
vModule.add("UEFI_DRIVER"); vModule.add("UEFI_DRIVER");
vModule.add("UEFI_APPLICATION"); vModule.add("UEFI_APPLICATION");
vModule.add("USER_DEFINED"); vModule.add("USER_DEFINED");
vModule.add("NONE");
jTable.getColumnModel().getColumn(cnSupMod).setCellEditor(new ListEditor(vModule)); jTable.getColumnModel().getColumn(cnSupMod).setCellEditor(new ListEditor(vModule));
@ -293,12 +292,8 @@ public class SpdLibClassDecls extends IInternalFrame implements TableModelListen
arch = m.getValueAt(row, cnSupArch).toString(); arch = m.getValueAt(row, cnSupArch).toString();
} }
String module = null; String module = null;
// if (lsm.isSelectionEmpty()) {
if (m.getValueAt(row, cnSupMod) != null) { if (m.getValueAt(row, cnSupMod) != null) {
module = m.getValueAt(row, cnSupMod).toString(); module = m.getValueAt(row, cnSupMod).toString();
if (module == "NONE") {
module = null;
}
} }
String[] rowData = {lib, hdr, hlp}; String[] rowData = {lib, hdr, hlp};
if (!dataValidation(rowData)) { if (!dataValidation(rowData)) {
@ -308,7 +303,9 @@ public class SpdLibClassDecls extends IInternalFrame implements TableModelListen
// LAH getLibInstances(lib); // LAH getLibInstances(lib);
// LAH String guid = nameToGuid(name); if (name != null) {
String guid = nameToGuid(name);
}
// LAH WAS sfc.updateSpdLibClass(row, lib, hdr, hlp, guid, ver, arch, module); // LAH WAS sfc.updateSpdLibClass(row, lib, hdr, hlp, guid, ver, arch, module);
sfc.updateSpdLibClass(row, lib, hdr, hlp, null, null, arch, module); sfc.updateSpdLibClass(row, lib, hdr, hlp, null, null, arch, module);
@ -589,8 +586,7 @@ public class SpdLibClassDecls extends IInternalFrame implements TableModelListen
// //
//convert to GUID before storing recommended lib instance. //convert to GUID before storing recommended lib instance.
// //
getLibInstances(row[0]); getLibInstances(row[cnClassName]);
// LAH recommendGuid = nameToGuid(row[3]); // LAH recommendGuid = nameToGuid(row[3]);
// LAH WAS sfc.genSpdLibClassDeclarations(row[0], recommendGuid, row[1], row[2], row[5], null, null, row[4], null, row[6]); // LAH WAS sfc.genSpdLibClassDeclarations(row[0], recommendGuid, row[1], row[2], row[5], null, null, row[4], null, row[6]);