Author: ltheussl
Date: Thu Jan 8 02:02:43 2009
New Revision: 732668
URL: http://svn.apache.org/viewvc?rev=732668&view=rev
Log:
[DOXIASITETOOLS-13] NPE when generating Maven site and no project URL defined
Submitted by: Adrian Tarau
Modified:
maven/doxia/doxia-sitetools/trunk/doxia-decoration-model/src/main/java/org/apache/maven/doxia/site/decoration/inheritance/PathUtils.java
Modified:
maven/doxia/doxia-sitetools/trunk/doxia-decoration-model/src/main/java/org/apache/maven/doxia/site/decoration/inheritance/PathUtils.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/PathUtils.java?rev=732668&r1=732667&r2=732668&view=diff
==============================================================================
---
maven/doxia/doxia-sitetools/trunk/doxia-decoration-model/src/main/java/org/apache/maven/doxia/site/decoration/inheritance/PathUtils.java
(original)
+++
maven/doxia/doxia-sitetools/trunk/doxia-decoration-model/src/main/java/org/apache/maven/doxia/site/decoration/inheritance/PathUtils.java
Thu Jan 8 02:02:43 2009
@@ -33,9 +33,12 @@
*/
public abstract class PathUtils
{
+ /**
+ * Private constructor.
+ */
private PathUtils()
{
- // nop
+ // do not instantiate
}
/**
@@ -92,11 +95,17 @@
URL oldUrl = oldPathDescriptor.getPathUrl();
URL newUrl = newPathDescriptor.getPathUrl();
+ if ( oldUrl == null || newUrl == null )
+ {
+ // One of the sites has a strange URL. no relative path
possible, bail out.
+ return null;
+ }
+
if ( ( newUrl.getProtocol().equalsIgnoreCase( oldUrl.getProtocol()
) )
&& ( newUrl.getHost().equalsIgnoreCase(
oldUrl.getHost() ) )
&& ( newUrl.getPort() == oldUrl.getPort() ) )
{
- // Both pathes point to the same site. So we can use relative
pathes.
+ // Both paths point to the same site. So we can use relative
paths.
String oldPath = oldPathDescriptor.getPath();
String newPath = newPathDescriptor.getPath();