GP-1956 update metadata on set language

This commit is contained in:
ghidra1 2022-04-25 10:11:40 -04:00
parent 47f76c78d6
commit 352fe6fd8c
2 changed files with 18 additions and 12 deletions

View file

@ -1903,15 +1903,22 @@ public class ProgramDB extends DomainObjectAdapterDB implements Program, ChangeM
throws IllegalStateException, IncompatibleLanguageException, LockException {
if (newLanguage == language) {
setLanguage((LanguageTranslator) null, newCompilerSpecID, forceRedisassembly, monitor);
return;
}
LanguageTranslator languageTranslator =
LanguageTranslatorFactory.getLanguageTranslatorFactory()
.getLanguageTranslator(language, newLanguage);
if (languageTranslator == null) {
throw new IncompatibleLanguageException("Language translation not supported");
else {
LanguageTranslator languageTranslator =
LanguageTranslatorFactory.getLanguageTranslatorFactory()
.getLanguageTranslator(language, newLanguage);
if (languageTranslator == null) {
throw new IncompatibleLanguageException("Language translation not supported");
}
setLanguage(languageTranslator, newCompilerSpecID, forceRedisassembly, monitor);
}
try {
updateMetadata();
}
catch (IOException e) {
dbError(e);
}
setLanguage(languageTranslator, newCompilerSpecID, forceRedisassembly, monitor);
}
/**
@ -1922,7 +1929,7 @@ public class ProgramDB extends DomainObjectAdapterDB implements Program, ChangeM
* @param monitor task monitor
* @throws LockException if exclusive access is missing
*/
public void setLanguage(LanguageTranslator translator, CompilerSpecID newCompilerSpecID,
private void setLanguage(LanguageTranslator translator, CompilerSpecID newCompilerSpecID,
boolean forceRedisassembly, TaskMonitor monitor) throws LockException {
checkExclusiveAccess();