You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@maven.apache.org by rf...@apache.org on 2018/12/22 11:15:41 UTC
[maven-javadoc-plugin] 01/01: [MJAVADOC-551] Error if path to
project contains a spaces
This is an automated email from the ASF dual-hosted git repository.
rfscholte pushed a commit to branch MJAVADOC-551
in repository https://gitbox.apache.org/repos/asf/maven-javadoc-plugin.git
commit bbecee40d1615b02959a81ccf3a5f9720c28b94d
Author: rfscholte <rf...@apache.org>
AuthorDate: Sat Dec 22 12:15:31 2018 +0100
[MJAVADOC-551] Error if path to project contains a spaces
---
.../MJAVADOC-551 spaces/invoker.properties | 18 ++++++++
src/it/projects/MJAVADOC-551 spaces/pom.xml | 48 ++++++++++++++++++++++
.../src/main/java/fix/test/App.java | 46 +++++++++++++++++++++
.../plugins/javadoc/AbstractFixJavadocMojo.java | 13 +++++-
4 files changed, 124 insertions(+), 1 deletion(-)
diff --git a/src/it/projects/MJAVADOC-551 spaces/invoker.properties b/src/it/projects/MJAVADOC-551 spaces/invoker.properties
new file mode 100644
index 0000000..e02dbac
--- /dev/null
+++ b/src/it/projects/MJAVADOC-551 spaces/invoker.properties
@@ -0,0 +1,18 @@
+# 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.
+
+invoker.goals=javadoc:fix
diff --git a/src/it/projects/MJAVADOC-551 spaces/pom.xml b/src/it/projects/MJAVADOC-551 spaces/pom.xml
new file mode 100644
index 0000000..6270acf
--- /dev/null
+++ b/src/it/projects/MJAVADOC-551 spaces/pom.xml
@@ -0,0 +1,48 @@
+<?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-551</artifactId>
+ <version>1.0-SNAPSHOT</version>
+
+ <url>https://issues.apache.org/jira/browse/MJAVADOC-551</url>
+
+ <properties>
+ <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
+ </properties>
+
+ <build>
+ <pluginManagement>
+ <plugins>
+ <plugin>
+ <groupId>org.apache.maven.plugins</groupId>
+ <artifactId>maven-javadoc-plugin</artifactId>
+ <version>@project.version@</version>
+ <configuration>
+ <force>true</force>
+ <ignoreClirr>true</ignoreClirr>
+ </configuration>
+ </plugin>
+ </plugins>
+ </pluginManagement>
+ </build>
+</project>
diff --git a/src/it/projects/MJAVADOC-551 spaces/src/main/java/fix/test/App.java b/src/it/projects/MJAVADOC-551 spaces/src/main/java/fix/test/App.java
new file mode 100644
index 0000000..ee6f1f9
--- /dev/null
+++ b/src/it/projects/MJAVADOC-551 spaces/src/main/java/fix/test/App.java
@@ -0,0 +1,46 @@
+package fix.test;
+
+/*
+ * 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.
+ */
+
+/**
+ * App class
+ *
+ * @generatorClass toto
+ * @todo review it
+ * @version 1.0
+ * @author <a href="mailto:vincent.siveton@gmail.com">Vincent Siveton</a>
+ */
+public class App
+{
+ /**
+ * The main method
+ *
+ * @param args an array of strings that contains the arguments
+ */
+ public static void main( String[] args )
+ {
+ System.out.println( "Sample Application." );
+ }
+
+ protected void sampleMethod( String str )
+ {
+ System.out.println( str );
+ }
+}
diff --git a/src/main/java/org/apache/maven/plugins/javadoc/AbstractFixJavadocMojo.java b/src/main/java/org/apache/maven/plugins/javadoc/AbstractFixJavadocMojo.java
index 6922813..f8fac33 100644
--- a/src/main/java/org/apache/maven/plugins/javadoc/AbstractFixJavadocMojo.java
+++ b/src/main/java/org/apache/maven/plugins/javadoc/AbstractFixJavadocMojo.java
@@ -66,8 +66,10 @@ import java.io.StringReader;
import java.io.StringWriter;
import java.lang.reflect.Method;
import java.net.MalformedURLException;
+import java.net.URISyntaxException;
import java.net.URL;
import java.net.URLClassLoader;
+import java.nio.file.Paths;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.Collection;
@@ -990,7 +992,16 @@ public abstract class AbstractFixJavadocMojo
return;
}
- File javaFile = new File( javaClass.getSource().getURL().getFile() );
+ File javaFile;
+ try
+ {
+ javaFile = Paths.get( javaClass.getSource().getURL().toURI() ).toFile();
+ }
+ catch ( URISyntaxException e )
+ {
+ throw new MojoExecutionException( e.getMessage() );
+ }
+
// the original java content in memory
final String originalContent = StringUtils.unifyLineSeparators( FileUtils.fileRead( javaFile, encoding ) );