Index: trunk/src/org/openstreetmap/josm/data/validation/tests/MultipolygonTest.java
===================================================================
--- trunk/src/org/openstreetmap/josm/data/validation/tests/MultipolygonTest.java	(revision 3807)
+++ trunk/src/org/openstreetmap/josm/data/validation/tests/MultipolygonTest.java	(revision 3824)
@@ -26,4 +26,6 @@
 import org.openstreetmap.josm.gui.mappaint.ElemStyles;
 import org.openstreetmap.josm.gui.mappaint.MapPaintStyles;
+import org.openstreetmap.josm.gui.mappaint.StyleCache;
+import org.openstreetmap.josm.gui.mappaint.xml.AreaPrototype;
 
 public class MultipolygonTest extends Test {
@@ -53,5 +55,5 @@
     public void initialize() throws Exception {
         styles = MapPaintStyles.getStyles();
-    }
+}
 
     private List<List<Node>> joinWays(Collection<Way> ways) {
@@ -113,6 +115,6 @@
     public void visit(Way w) {
         if (styles != null && !w.isClosed()) {
-            ElemStyle e = styles.getArea(w);
-            if (e instanceof AreaElemStyle && !((AreaElemStyle)e).closed) {
+            AreaPrototype e = styles.getAreaProto(w);
+            if (e != null && ! e.closed) {
                 errors.add( new TestError(this, Severity.WARNING, tr("Area style way is not closed"), NOT_CLOSED,  w));
             }
@@ -140,15 +142,27 @@
             List<List<Node>> innerWays = joinWays(polygon.getInnerWays()); // Side effect - sets nonClosedWays
             List<List<Node>> outerWays = joinWays(polygon.getOuterWays());
-
             if (styles != null) {
-                ElemStyle wayStyle = styles.get(r);
-
+                StyleCache sc = styles.get(r);
+
+                AreaElemStyle area = null;
+                for (ElemStyle s : sc.getStyles()) {
+                    if (s instanceof AreaElemStyle) {
+                        area = (AreaElemStyle) s;
+                        break;
+                    }
+                }
                 // If area style was not found for relation then use style of ways
-                if (!(wayStyle instanceof AreaElemStyle)) {
+                if (area == null) {
                     errors.add( new TestError(this, Severity.OTHER, tr("No style in multipolygon relation"),
                     NO_STYLE_POLYGON, r));
                     for (Way w : polygon.getOuterWays()) {
-                        wayStyle = styles.getArea(w);
-                        if(wayStyle != null) {
+
+                        for (ElemStyle s : styles.getArea(w).getStyles()) {
+                            if (s instanceof AreaElemStyle) {
+                                area = (AreaElemStyle) s;
+                                break;
+                            }
+                        }
+                        if (area != null) {
                             break;
                         }
@@ -156,8 +170,15 @@
                 }
 
-                if (wayStyle instanceof AreaElemStyle) {
+                if (area != null) {
                     for (Way wInner : polygon.getInnerWays()) {
-                        ElemStyle innerStyle = styles.get(wInner);
-                        if (wayStyle != null && wayStyle.equals(innerStyle)) {
+                        AreaElemStyle areaInner = null;
+                        for (ElemStyle s : styles.get(wInner).getStyles()) {
+                            if (s instanceof AreaElemStyle) {
+                                areaInner = (AreaElemStyle) s;
+                                break;
+                            }
+                        }
+
+                        if (areaInner != null && area.equals(areaInner)) {
                             List<OsmPrimitive> l = new ArrayList<OsmPrimitive>();
                             l.add(r);
@@ -168,6 +189,12 @@
                     }
                     for (Way wOuter : polygon.getOuterWays()) {
-                        ElemStyle outerStyle = styles.get(wOuter);
-                        if (outerStyle instanceof AreaElemStyle && !wayStyle.equals(outerStyle)) {
+                        AreaElemStyle areaOuter = null;
+                        for (ElemStyle s : styles.get(wOuter).getStyles()) {
+                            if (s instanceof AreaElemStyle) {
+                                areaOuter = (AreaElemStyle) s;
+                                break;
+                            }
+                        }
+                        if (areaOuter != null && !area.equals(areaOuter)) {
                             List<OsmPrimitive> l = new ArrayList<OsmPrimitive>();
                             l.add(r);
