Author: rfscholte
Date: Mon Sep 26 21:09:46 2011
New Revision: 1176059

URL: http://svn.apache.org/viewvc?rev=1176059&view=rev
Log:
Fix for MJAVADOC-325: Incorrect -link is generated when its URL contains a comma

Added:
    maven/plugins/trunk/maven-javadoc-plugin/src/it/MJAVADOC-325/
    
maven/plugins/trunk/maven-javadoc-plugin/src/it/MJAVADOC-325/invoker.properties
    maven/plugins/trunk/maven-javadoc-plugin/src/it/MJAVADOC-325/pom.xml
    maven/plugins/trunk/maven-javadoc-plugin/src/it/MJAVADOC-325/src/
    maven/plugins/trunk/maven-javadoc-plugin/src/it/MJAVADOC-325/src/main/
    maven/plugins/trunk/maven-javadoc-plugin/src/it/MJAVADOC-325/src/main/java/
    
maven/plugins/trunk/maven-javadoc-plugin/src/it/MJAVADOC-325/src/main/java/foo/
    
maven/plugins/trunk/maven-javadoc-plugin/src/it/MJAVADOC-325/src/main/java/foo/Bar.java
    maven/plugins/trunk/maven-javadoc-plugin/src/it/MJAVADOC-325/verify.bsh
Modified:
    
maven/plugins/trunk/maven-javadoc-plugin/src/main/java/org/apache/maven/plugin/javadoc/AbstractJavadocMojo.java

Added: 
maven/plugins/trunk/maven-javadoc-plugin/src/it/MJAVADOC-325/invoker.properties
URL: 
http://svn.apache.org/viewvc/maven/plugins/trunk/maven-javadoc-plugin/src/it/MJAVADOC-325/invoker.properties?rev=1176059&view=auto
==============================================================================
--- 
maven/plugins/trunk/maven-javadoc-plugin/src/it/MJAVADOC-325/invoker.properties 
(added)
+++ 
maven/plugins/trunk/maven-javadoc-plugin/src/it/MJAVADOC-325/invoker.properties 
Mon Sep 26 21:09:46 2011
@@ -0,0 +1 @@
+invoker.goals=clean javadoc:javadoc
\ No newline at end of file

Added: maven/plugins/trunk/maven-javadoc-plugin/src/it/MJAVADOC-325/pom.xml
URL: 
http://svn.apache.org/viewvc/maven/plugins/trunk/maven-javadoc-plugin/src/it/MJAVADOC-325/pom.xml?rev=1176059&view=auto
==============================================================================
--- maven/plugins/trunk/maven-javadoc-plugin/src/it/MJAVADOC-325/pom.xml (added)
+++ maven/plugins/trunk/maven-javadoc-plugin/src/it/MJAVADOC-325/pom.xml Mon 
Sep 26 21:09:46 2011
@@ -0,0 +1,56 @@
+<?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>org.apache.maven.plugins.maven-javadoc-plugin.it</groupId>
+  <artifactId>mjavadoc-325</artifactId>
+  <version>1.0-SNAPSHOT</version>
+
+  <properties>
+    <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
+  </properties>
+
+  <build>
+    <pluginManagement>
+      <plugins>
+        <plugin>
+          <groupId>org.apache.maven.plugins</groupId>
+          <artifactId>maven-compiler-plugin</artifactId>
+          <version>2.3.2</version>
+        </plugin>
+        <plugin>
+          <groupId>org.apache.maven.plugins</groupId>
+          <artifactId>maven-javadoc-plugin</artifactId>
+          <version>2.8.1-SNAPSHOT</version>
+          <configuration>
+            <debug>true</debug>
+            <links>
+              <link>http://download.oracle.com/javase/1,5,0/docs/api/</link>
+            </links>
+          </configuration>
+        </plugin>
+      </plugins>
+    </pluginManagement>
+  </build>
+  
+</project>

Added: 
maven/plugins/trunk/maven-javadoc-plugin/src/it/MJAVADOC-325/src/main/java/foo/Bar.java
URL: 
http://svn.apache.org/viewvc/maven/plugins/trunk/maven-javadoc-plugin/src/it/MJAVADOC-325/src/main/java/foo/Bar.java?rev=1176059&view=auto
==============================================================================
--- 
maven/plugins/trunk/maven-javadoc-plugin/src/it/MJAVADOC-325/src/main/java/foo/Bar.java
 (added)
+++ 
maven/plugins/trunk/maven-javadoc-plugin/src/it/MJAVADOC-325/src/main/java/foo/Bar.java
 Mon Sep 26 21:09:46 2011
@@ -0,0 +1,3 @@
+package foo;
+
+public class Bar {}
\ No newline at end of file

Added: maven/plugins/trunk/maven-javadoc-plugin/src/it/MJAVADOC-325/verify.bsh
URL: 
http://svn.apache.org/viewvc/maven/plugins/trunk/maven-javadoc-plugin/src/it/MJAVADOC-325/verify.bsh?rev=1176059&view=auto
==============================================================================
--- maven/plugins/trunk/maven-javadoc-plugin/src/it/MJAVADOC-325/verify.bsh 
(added)
+++ maven/plugins/trunk/maven-javadoc-plugin/src/it/MJAVADOC-325/verify.bsh Mon 
Sep 26 21:09:46 2011
@@ -0,0 +1,52 @@
+
+/*
+ * 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
+{
+    File optionsFile = new File( basedir, "target/site/apidocs/options" );
+    
+    if( !optionsFile.exists() ) 
+    {
+        System.err.println( optionsFile.getAbsolutePath() + " is missing." );
+        return false;
+    }
+
+       String optionsContent = FileUtils.fileRead( optionsFile );
+       String javaApiLink = 
"-link\r\n'http://download.oracle.com/javase/1,5,0/docs/api'";
+       
+       if ( optionsContent.indexOf( javaApiLink ) < 0 )
+       {
+        System.err.println( "Options is missing the following line:" );
+        System.err.println( javaApiLink );
+        return false;
+       } 
+}
+catch( RuntimeException e )
+{
+    e.printStackTrace();
+    return false;
+}
+
+return result;
\ No newline at end of file

Modified: 
maven/plugins/trunk/maven-javadoc-plugin/src/main/java/org/apache/maven/plugin/javadoc/AbstractJavadocMojo.java
URL: 
http://svn.apache.org/viewvc/maven/plugins/trunk/maven-javadoc-plugin/src/main/java/org/apache/maven/plugin/javadoc/AbstractJavadocMojo.java?rev=1176059&r1=1176058&r2=1176059&view=diff
==============================================================================
--- 
maven/plugins/trunk/maven-javadoc-plugin/src/main/java/org/apache/maven/plugin/javadoc/AbstractJavadocMojo.java
 (original)
+++ 
maven/plugins/trunk/maven-javadoc-plugin/src/main/java/org/apache/maven/plugin/javadoc/AbstractJavadocMojo.java
 Mon Sep 26 21:09:46 2011
@@ -3916,7 +3916,7 @@ public abstract class AbstractJavadocMoj
                 link = link.substring( 0, link.lastIndexOf( "/" ) );
             }
 
-            addArgIfNotEmpty( arguments, "-link", 
JavadocUtil.quotedPathArgument( link ), true );
+            addArgIfNotEmpty( arguments, "-link", 
JavadocUtil.quotedPathArgument( link ), true, false );
         }
     }
 


Reply via email to