Changeset 5126


Ignore:
Timestamp:
Oct 9, 2009, 2:36:36 PM (12 years ago)
Author:
Nicklas Nordborg
Message:

Fixes #1392: Incorrect warning about non-default platform/variant from validator

File:
1 edited

Legend:

Unmodified
Added
Removed
  • branches/2.13-stable/src/core/net/sf/basedb/util/overview/validator/PlatformValidator.java

    r4764 r5126  
    2424import net.sf.basedb.core.BasicItem;
    2525import net.sf.basedb.core.DbControl;
     26import net.sf.basedb.core.FileStoreEnabled;
    2627import net.sf.basedb.core.Item;
    2728import net.sf.basedb.core.Platform;
     
    7172    BasicItem defaultVariant = OverviewUtil.getProjectDefaultItem(dc, project, Project.Default.PLATFORM_VARIANT);
    7273    Platform platform = (Platform)node.getItem();
    73     Node variantNode = node.getChild("variant");
    74     PlatformVariant variant = variantNode == null ? null : (PlatformVariant)node.getItem();
     74    PlatformVariant variant = null;
     75    boolean failedVariant = false;
    7576    BasicItem parentItem = parentNode.getItem();
     77    try
     78    {
     79      variant = ((FileStoreEnabled)parentItem).getVariant();
     80    }
     81    catch (Throwable t)
     82    {
     83      // Failure to load the variant is detected by other validators
     84      failedVariant = true;
     85    }
    7686    String parentTypeName = parentNode.getItemType().toString().toLowerCase();
    7787    boolean canChangePlatform = false;
     
    8393   
    8494    if ((defaultPlatform != null && !defaultPlatform.equals(platform)) ||
    85       (defaultVariant != null && !defaultVariant.equals(variant)))
     95      (defaultVariant != null && !defaultVariant.equals(variant) && !failedVariant))
    8696    {
    8797      context.createFailure(Validator.NONDEFAULT_PLATFORM, parentNode, null,
Note: See TracChangeset for help on using the changeset viewer.