Author: ltheussl
Date: Fri Jan 14 06:22:44 2011
New Revision: 1058859

URL: http://svn.apache.org/viewvc?rev=1058859&view=rev
Log:
catch null values early

Modified:
    
maven/doxia/doxia-sitetools/trunk/doxia-decoration-model/src/main/java/org/apache/maven/doxia/site/decoration/inheritance/DefaultDecorationModelInheritanceAssembler.java

Modified: 
maven/doxia/doxia-sitetools/trunk/doxia-decoration-model/src/main/java/org/apache/maven/doxia/site/decoration/inheritance/DefaultDecorationModelInheritanceAssembler.java
URL: 
http://svn.apache.org/viewvc/maven/doxia/doxia-sitetools/trunk/doxia-decoration-model/src/main/java/org/apache/maven/doxia/site/decoration/inheritance/DefaultDecorationModelInheritanceAssembler.java?rev=1058859&r1=1058858&r2=1058859&view=diff
==============================================================================
--- 
maven/doxia/doxia-sitetools/trunk/doxia-decoration-model/src/main/java/org/apache/maven/doxia/site/decoration/inheritance/DefaultDecorationModelInheritanceAssembler.java
 (original)
+++ 
maven/doxia/doxia-sitetools/trunk/doxia-decoration-model/src/main/java/org/apache/maven/doxia/site/decoration/inheritance/DefaultDecorationModelInheritanceAssembler.java
 Fri Jan 14 06:22:44 2011
@@ -53,54 +53,61 @@ public class DefaultDecorationModelInher
     public void assembleModelInheritance( String name, DecorationModel child, 
DecorationModel parent,
                                           String childBaseUrl, String 
parentBaseUrl )
     {
-        URLContainer urlContainer = new URLContainer( parentBaseUrl, 
childBaseUrl );
-
         // cannot inherit from null parent.
-        if ( parent != null )
+        if ( parent == null )
         {
-            if ( child.getBannerLeft() == null && parent.getBannerLeft() != 
null )
-            {
-                child.setBannerLeft( (Banner) parent.getBannerLeft().clone());
-                rebaseBannerPaths( child.getBannerLeft(), urlContainer );
-            }
+            return;
+        }
 
-            if ( child.getBannerRight() == null && parent.getBannerRight() != 
null)
-            {
-                child.setBannerRight( (Banner) 
parent.getBannerRight().clone());
-                rebaseBannerPaths( child.getBannerRight(), urlContainer );
-            }
+        URLContainer urlContainer = new URLContainer( parentBaseUrl, 
childBaseUrl );
 
-            if ( child.getPublishDate() == null && parent.getPublishDate() != 
null )
-            {
-                child.setPublishDate( (PublishDate) 
parent.getPublishDate().clone());
-            }
+        if ( child.getBannerLeft() == null && parent.getBannerLeft() != null )
+        {
+            child.setBannerLeft( (Banner) parent.getBannerLeft().clone());
+            rebaseBannerPaths( child.getBannerLeft(), urlContainer );
+        }
 
-            if ( child.getVersion() == null && parent.getVersion() != null )
-            {
-                child.setVersion( (Version) parent.getVersion().clone());
-            }
+        if ( child.getBannerRight() == null && parent.getBannerRight() != null)
+        {
+            child.setBannerRight( (Banner) parent.getBannerRight().clone());
+            rebaseBannerPaths( child.getBannerRight(), urlContainer );
+        }
 
-            if ( child.getSkin() == null && parent.getSkin() != null )
-            {
-                child.setSkin( (Skin) parent.getSkin().clone());
-            }
+        if ( child.getPublishDate() == null && parent.getPublishDate() != null 
)
+        {
+            child.setPublishDate( (PublishDate) 
parent.getPublishDate().clone());
+        }
 
-            child.setPoweredBy( mergePoweredByLists( child.getPoweredBy(), 
parent.getPoweredBy(), urlContainer ) );
+        if ( child.getVersion() == null && parent.getVersion() != null )
+        {
+            child.setVersion( (Version) parent.getVersion().clone());
+        }
 
-            if ( parent.getLastModified() > child.getLastModified() )
-            {
-                child.setLastModified( parent.getLastModified() );
-            }
+        if ( child.getSkin() == null && parent.getSkin() != null )
+        {
+            child.setSkin( (Skin) parent.getSkin().clone());
+        }
 
-            assembleBodyInheritance( name, child, parent, urlContainer );
+        child.setPoweredBy( mergePoweredByLists( child.getPoweredBy(), 
parent.getPoweredBy(), urlContainer ) );
 
-            assembleCustomInheritance( child, parent );
+        if ( parent.getLastModified() > child.getLastModified() )
+        {
+            child.setLastModified( parent.getLastModified() );
         }
+
+        assembleBodyInheritance( name, child, parent, urlContainer );
+
+        assembleCustomInheritance( child, parent );
     }
 
     /** {@inheritDoc} */
     public void resolvePaths( final DecorationModel decoration, final String 
baseUrl )
     {
+        if ( baseUrl == null )
+        {
+            return;
+        }
+
         if ( decoration.getBannerLeft() != null )
         {
             relativizeBannerPaths( decoration.getBannerLeft(), baseUrl );


Reply via email to