[GitHub] [maven-site-plugin] elharo commented on a change in pull request #31: [MSITE-856] - NullPointer on org.apache.maven.plugins.site.render.SiteMap.relativePath

classic Classic list List threaded Threaded
1 message Options
Reply | Threaded
Open this post in threaded view
|

[GitHub] [maven-site-plugin] elharo commented on a change in pull request #31: [MSITE-856] - NullPointer on org.apache.maven.plugins.site.render.SiteMap.relativePath

GitBox

elharo commented on a change in pull request #31:
URL: https://github.com/apache/maven-site-plugin/pull/31#discussion_r434153263



##########
File path: src/it/projects/MSITE-856/pom.xml
##########
@@ -0,0 +1,69 @@
+<?xml version="1.0" encoding="UTF-8"?>
+
+<!--
+Licensed to the Apache Software Foundation (ASF) under one
+or more contributor license agreements.  See the NOTICE file
+distributed with this work for additional information
+regarding copyright ownership.  The ASF licenses this file
+to you under the Apache License, Version 2.0 (the
+"License"); you may not use this file except in compliance
+with the License.  You may obtain a copy of the License at
+
+  http://www.apache.org/licenses/LICENSE-2.0
+
+Unless required by applicable law or agreed to in writing,
+software distributed under the License is distributed on an
+"AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+KIND, either express or implied.  See the License for the
+specific language governing permissions and limitations
+under the License.
+-->
+
+<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+         xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
+    <modelVersion>4.0.0</modelVersion>
+
+    <groupId>msite856</groupId>
+    <artifactId>nullcheck</artifactId>
+    <version>1.0-SNAPSHOT</version>
+    <packaging>pom</packaging>
+    <name>MSITE-856</name>
+
+    <build>
+        <pluginManagement>
+            <plugins>
+                <plugin>
+                    <artifactId>maven-site-plugin</artifactId>
+                    <version>@project.version@</version>
+                    <configuration>
+                        <generateSitemap>true</generateSitemap>
+                    </configuration>
+                    <dependencies><!-- TODO remove when prerequisite is Java 7 -->

Review comment:
       I think java 7 is minimum now

##########
File path: src/it/projects/MSITE-856/pom.xml
##########
@@ -0,0 +1,69 @@
+<?xml version="1.0" encoding="UTF-8"?>
+
+<!--
+Licensed to the Apache Software Foundation (ASF) under one
+or more contributor license agreements.  See the NOTICE file
+distributed with this work for additional information
+regarding copyright ownership.  The ASF licenses this file
+to you under the Apache License, Version 2.0 (the
+"License"); you may not use this file except in compliance
+with the License.  You may obtain a copy of the License at
+
+  http://www.apache.org/licenses/LICENSE-2.0
+
+Unless required by applicable law or agreed to in writing,
+software distributed under the License is distributed on an
+"AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+KIND, either express or implied.  See the License for the
+specific language governing permissions and limitations
+under the License.
+-->
+
+<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+         xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
+    <modelVersion>4.0.0</modelVersion>
+
+    <groupId>msite856</groupId>
+    <artifactId>nullcheck</artifactId>
+    <version>1.0-SNAPSHOT</version>
+    <packaging>pom</packaging>
+    <name>MSITE-856</name>
+
+    <build>

Review comment:
       Maven uses 2 space indents in XML files

##########
File path: src/it/projects/MSITE-856/verify.bsh
##########
@@ -0,0 +1,48 @@
+
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *   http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+import java.io.*;
+import org.codehaus.plexus.util.*;
+
+boolean result = true;
+
+try
+{
+    final File siteDirectory = new File( basedir, "target/generated-site" );
+    if ( !siteDirectory.exists() || !siteDirectory.isDirectory() )
+    {
+        System.err.println( "generated-site is missing or not a directory." );
+        result = false;

Review comment:
       you should probably return here since you know the answer now

##########
File path: src/main/java/org/apache/maven/plugins/site/render/SiteMap.java
##########
@@ -172,9 +172,13 @@ private static void extractItems( List<MenuItem> items, Sink sink )
         for ( MenuItem item : items )
         {
             sink.listItem();
-            sink.link( relativePath( item.getHref() ) );
-            sink.text( item.getName() );
-            sink.link_();
+            if ( !( item.getHref() == null ) )

Review comment:
       != null?




----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

For queries about this service, please contact Infrastructure at:
[hidden email]



---------------------------------------------------------------------
To unsubscribe, e-mail: [hidden email]
For additional commands, e-mail: [hidden email]