docs: @Override
      public InstalledIdentity getInstalledIdentity(String productName, String productVersion) throws PatchingException {
          final String defaultIdentityName = defaultIdentity.getIdentity().getName();
          if(productName == null) {
              productName = defaultIdentityName;
          }
  
          final File productConf = new File(installedImage.getInstallationMetadata(), productName + Constants.DOT_CONF);
          final String recordedProductVersion;
          if(!productConf.exists()) {
              recordedProductVersion = null;
          } else {
              final Properties props = loadProductConf(productConf);
              recordedProductVersion = props.getProperty(Constants.CURRENT_VERSION);
          }
  
          if(defaultIdentityName.equals(productName)) {
              if(recordedProductVersion != null && !recordedProductVersion.equals(defaultIdentity.getIdentity().getVersion())) {
                  // this means the patching history indicates that the current version is different from the one specified in the server's version module,
                  // which could happen in case:
                  // - the last applied CP didn't include the new version module or
                  // - the version module version included in the last CP didn't match the version specified in the CP's metadata, or
                  // - the version module was updated from a one-off, or
                  // - the patching history was edited somehow
                  // In any case, here I decided to rely on the patching history.
                  defaultIdentity = loadIdentity(productName, recordedProductVersion);
              }
              if(productVersion != null && !defaultIdentity.getIdentity().getVersion().equals(productVersion)) {
                  throw new PatchingException(PatchLogger.ROOT_LOGGER.productVersionDidNotMatchInstalled(
                          productName, productVersion, defaultIdentity.getIdentity().getVersion()));
              }
              return defaultIdentity;
          }
  
          if(recordedProductVersion != null && !Constants.UNKNOWN.equals(recordedProductVersion)) {
              if(productVersion != null) {
                  if (!productVersion.equals(recordedProductVersion)) {
                      throw new PatchingException(PatchLogger.ROOT_LOGGER.productVersionDidNotMatchInstalled(productName, productVersion, recordedProductVersion));
                  }
              } else {
                  productVersion = recordedProductVersion;
              }
          }
  
          return loadIdentity(productName, productVersion);
      }