Skip to content

Commit

Permalink
[GR-30360] Mismatch between catalog and component will fail the insta…
Browse files Browse the repository at this point in the history
…llation.
  • Loading branch information
sdedic committed Mar 24, 2021
1 parent 8128f65 commit 4b3c67f
Show file tree
Hide file tree
Showing 2 changed files with 26 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -406,3 +406,12 @@ UPGRADE_MissingComponentItem=\t{0} ({1})
UPGRADE_MissingComponentListPart={0},\n{1}
# {0} - list contents
UPGRADE_MissingComponentListFinish={0}

@INSTALL_Error_ComponentDiffers_Report=\nBroken component and/or catalog: The remote component differs from the catalog information. \n\
\ Catalog Component package\n\
---------------------------------------------------------------------------------\n\
Id: %1$-35s %2$-35s\n\
Version: %3$-35s %4$-35s\n\n
# The newline at start and the end of above message is deliberate

INSTALL_Error_ComponentDiffers=Component info mismatch.
Original file line number Diff line number Diff line change
Expand Up @@ -159,6 +159,11 @@ public InstallCommand() {
*/
Map<ComponentParam, Installer> realInstallers = new LinkedHashMap<>();

/**
* Original (possibly catalog) ComponentInfos.
*/
Map<ComponentParam, ComponentInfo> parameterInfos = new LinkedHashMap<>();

private String current;

private StringBuilder parameterList = new StringBuilder();
Expand Down Expand Up @@ -636,6 +641,17 @@ void completeInstallers0(List<ComponentParam> in) throws IOException {
Installer i = realInstallers.get(p);
if (i == null) {
MetadataLoader floader = p.createFileLoader();
ComponentInfo initialInfo = parameterInfos.get(p);
ComponentInfo finfo = floader.getComponentInfo();
if (initialInfo != null && (!initialInfo.getId().equals(finfo.getId()) ||
!initialInfo.getVersion().equals(finfo.getVersion()))) {
String msg = String.format(
feedback.l10n("@INSTALL_Error_ComponentDiffers_Report"),
initialInfo.getId(), finfo.getId(),
initialInfo.getVersionString(), finfo.getVersionString());
feedback.verbatimPart(msg, true, false);
throw feedback.failure("INSTALL_Error_ComponentDiffers", null);
}
i = createInstaller(p, floader);
if (!verifyInstaller(i)) {
continue;
Expand Down Expand Up @@ -725,6 +741,7 @@ protected void configureInstaller(Installer inst) {
Installer createInstaller(ComponentParam p, MetadataLoader ldr) throws IOException {
ComponentInfo partialInfo;
partialInfo = ldr.getComponentInfo();
parameterInfos.putIfAbsent(p, partialInfo);
feedback.verboseOutput("INSTALL_PrepareToInstall",
p.getDisplayName(),
partialInfo.getId(),
Expand Down

0 comments on commit 4b3c67f

Please sign in to comment.