You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@maven.apache.org by vs...@apache.org on 2008/08/02 14:12:20 UTC

svn commit: r681961 - in /maven/plugins/trunk/maven-javadoc-plugin/src: main/java/org/apache/maven/plugin/javadoc/AbstractJavadocMojo.java site/fml/faq.fml

Author: vsiveton
Date: Sat Aug  2 05:12:16 2008
New Revision: 681961

URL: http://svn.apache.org/viewvc?rev=681961&view=rev
Log:
MJAVADOC-206: use ${project.reporting.outputEncoding} as default value for "docencoding" and "charset" parameter and default to UTF-8

o improved logic like discussed in http://maven.markmail.org/message/zwswglatlchvx2fq?q=
o updated documentation

Modified:
    maven/plugins/trunk/maven-javadoc-plugin/src/main/java/org/apache/maven/plugin/javadoc/AbstractJavadocMojo.java
    maven/plugins/trunk/maven-javadoc-plugin/src/site/fml/faq.fml

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=681961&r1=681960&r2=681961&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 Sat Aug  2 05:12:16 2008
@@ -517,7 +517,8 @@
     private String docletPath;
 
     /**
-     * Specifies the encoding name of the source files.
+     * Specifies the encoding name of the source files. If not specificed, the encoding value will be the value of the
+     * <code>file.encoding</code> system property.
      * <br/>
      * See <a href="http://java.sun.com/j2se/1.4.2/docs/tooldocs/windows/javadoc.html#encoding">encoding</a>.
      * <br/>
@@ -734,7 +735,8 @@
     private String bottom;
 
     /**
-     * Specifies the HTML character set for this document. Defaults to the value specified by <code>docencoding</code>.
+     * Specifies the HTML character set for this document. If not specificed, the charset value will be the value of
+     * the <code>docencoding</code> parameter.
      * <br/>
      * See <a href="http://java.sun.com/j2se/1.4.2/docs/tooldocs/windows/javadoc.html#charset">charset</a>.
      * <br/>
@@ -744,7 +746,8 @@
     private String charset;
 
     /**
-     * Specifies the encoding of the generated HTML files.
+     * Specifies the encoding of the generated HTML files. If not specificed, the docencoding value will be the value
+     * of the <code>encoding</code> parameter.
      * <br/>
      * See <a href="http://java.sun.com/j2se/1.4.2/docs/tooldocs/windows/javadoc.html#docencoding">docencoding</a>.
      *
@@ -1389,19 +1392,27 @@
     }
 
     /**
-     * @return the charset attribute or the value of {@link #getDocencoding()} if <code>null</code>
+     * @return the charset attribute or the value of {@link #getDocencoding()} if <code>null</code>.
      */
     private String getCharset()
     {
-        return ( charset == null ) ? getDocencoding() : charset;
+        return ( StringUtils.isEmpty( charset ) ) ? getDocencoding() : charset;
     }
 
     /**
-     * @return the docencoding attribute or <code>UTF-8</code> if <code>null</code>
+     * @return the docencoding attribute or the value of {@link #getEncoding()} if <code>null</code>.
      */
     private String getDocencoding()
     {
-        return ( docencoding == null ) ? ReaderFactory.UTF_8 : docencoding;
+        return ( StringUtils.isEmpty( docencoding ) ) ? getEncoding() : docencoding;
+    }
+
+    /**
+     * @return the encoding attribute or the value of <code>file.encoding</code> system property if <code>null</code>.
+     */
+    private String getEncoding()
+    {
+        return ( StringUtils.isEmpty( encoding ) ) ? ReaderFactory.FILE_ENCODING : encoding;
     }
 
     /**
@@ -3381,9 +3392,9 @@
         throws MavenReportException
     {
         // encoding
-        if ( StringUtils.isNotEmpty( encoding ) && !JavadocUtil.validateEncoding( encoding ) )
+        if ( StringUtils.isNotEmpty( getEncoding() ) && !JavadocUtil.validateEncoding( getEncoding() ) )
         {
-            throw new MavenReportException( "Encoding not supported: " + encoding );
+            throw new MavenReportException( "Encoding not supported: " + getEncoding() );
         }
     }
 
@@ -3524,7 +3535,7 @@
                            "Source files encoding has not been set, using platform encoding "
                                + ReaderFactory.FILE_ENCODING + ", i.e. build is platform dependent!" );
         }
-        addArgIfNotEmpty( arguments, "-encoding", JavadocUtil.quotedArgument( encoding ) );
+        addArgIfNotEmpty( arguments, "-encoding", JavadocUtil.quotedArgument( getEncoding() ) );
 
         addArgIfNotEmpty( arguments, "-exclude", getExcludedPackages( sourcePaths ), SINCE_JAVADOC_1_4 );
 

Modified: maven/plugins/trunk/maven-javadoc-plugin/src/site/fml/faq.fml
URL: http://svn.apache.org/viewvc/maven/plugins/trunk/maven-javadoc-plugin/src/site/fml/faq.fml?rev=681961&r1=681960&r2=681961&view=diff
==============================================================================
--- maven/plugins/trunk/maven-javadoc-plugin/src/site/fml/faq.fml (original)
+++ maven/plugins/trunk/maven-javadoc-plugin/src/site/fml/faq.fml Sat Aug  2 05:12:16 2008
@@ -382,5 +382,23 @@
         </script>
       </answer>
     </faq>
+    <faq id="What are the values of encoding, docencoding and charset parameters">
+      <question>What are the values of <code>encoding</code>, <code>docencoding</code> and <code>charset</code> parameters?</question>
+      <answer>
+        <p>
+          By default, these parameters have the following values:
+          <dl>
+            <dt><code>encoding</code></dt>
+            <dd>Value of <code>${project.build.sourceEncoding}</code> property or the value of the
+              <code>file.encoding</code> system property if not specified.</dd>
+            <dt><code>docencoding</code></dt>
+            <dd>Value of <code>${project.reporting.outputEncoding}</code> property or the value of <code>encoding</code>
+              parameter if not specified.</dd>
+            <dt><code>charset</code></dt>
+            <dd>Value of <code>docencoding</code> parameter if not specified.</dd>
+          </dl>
+        </p>
+      </answer>
+    </faq>
   </part>
 </faqs>
\ No newline at end of file