You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@maven.apache.org by hb...@apache.org on 2008/08/13 00:06:49 UTC

svn commit: r685339 - in /maven/plugins/trunk/maven-javadoc-plugin/src: it/MJAVADOC-206/ it/MJAVADOC-206/default/ it/MJAVADOC-206/default/src/main/java/ main/java/org/apache/maven/plugin/javadoc/ site/fml/

Author: hboutemy
Date: Tue Aug 12 15:06:48 2008
New Revision: 685339

URL: http://svn.apache.org/viewvc?rev=685339&view=rev
Log:
o updated code and documentation to match proposal after user poll: default reporting encoding is UTF-8
o improved IT to check when default reporting encoding is different from source encoding

Modified:
    maven/plugins/trunk/maven-javadoc-plugin/src/it/MJAVADOC-206/default/pom.xml
    maven/plugins/trunk/maven-javadoc-plugin/src/it/MJAVADOC-206/default/src/main/java/Test.java
    maven/plugins/trunk/maven-javadoc-plugin/src/it/MJAVADOC-206/verify.bsh
    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/it/MJAVADOC-206/default/pom.xml
URL: http://svn.apache.org/viewvc/maven/plugins/trunk/maven-javadoc-plugin/src/it/MJAVADOC-206/default/pom.xml?rev=685339&r1=685338&r2=685339&view=diff
==============================================================================
--- maven/plugins/trunk/maven-javadoc-plugin/src/it/MJAVADOC-206/default/pom.xml (original)
+++ maven/plugins/trunk/maven-javadoc-plugin/src/it/MJAVADOC-206/default/pom.xml Tue Aug 12 15:06:48 2008
@@ -29,4 +29,8 @@
 
   <name>Default encoding</name>
   <description>should be UTF-8</description>
+
+  <properties>
+    <project.build.sourceEncoding>ISO-8859-15</project.build.sourceEncoding>
+  </properties>
 </project>
\ No newline at end of file

Modified: maven/plugins/trunk/maven-javadoc-plugin/src/it/MJAVADOC-206/default/src/main/java/Test.java
URL: http://svn.apache.org/viewvc/maven/plugins/trunk/maven-javadoc-plugin/src/it/MJAVADOC-206/default/src/main/java/Test.java?rev=685339&r1=685338&r2=685339&view=diff
==============================================================================
--- maven/plugins/trunk/maven-javadoc-plugin/src/it/MJAVADOC-206/default/src/main/java/Test.java (original)
+++ maven/plugins/trunk/maven-javadoc-plugin/src/it/MJAVADOC-206/default/src/main/java/Test.java Tue Aug 12 15:06:48 2008
@@ -19,9 +19,9 @@
 
 /**
  * Sample class with non-ascii characters:
- * {non-ascii chars delimiter}french: äëïöüàèìòù, greek: αβγδεζηθ, japanese: あいうえお{non-ascii chars delimiter}
+ * {non-ascii chars delimiter}french: äëïöüàèìòù, euro: ¤{non-ascii chars delimiter}
  *
- * @author Hervé Boutemy
+ * @author Hervé Boutemy
  */
 public class Test
 {

Modified: maven/plugins/trunk/maven-javadoc-plugin/src/it/MJAVADOC-206/verify.bsh
URL: http://svn.apache.org/viewvc/maven/plugins/trunk/maven-javadoc-plugin/src/it/MJAVADOC-206/verify.bsh?rev=685339&r1=685338&r2=685339&view=diff
==============================================================================
--- maven/plugins/trunk/maven-javadoc-plugin/src/it/MJAVADOC-206/verify.bsh (original)
+++ maven/plugins/trunk/maven-javadoc-plugin/src/it/MJAVADOC-206/verify.bsh Tue Aug 12 15:06:48 2008
@@ -22,17 +22,18 @@
 
 boolean result = true;
 
-boolean checkEncoding( String module, String encoding )
+boolean checkEncoding( String module, String sourceEncoding, String reportingEncoding )
 {
-    print( "module " + module + ", encoding " + encoding );
+    print( "module " + module + ", source encoding " + sourceEncoding
+           + ", expected reporting encoding " + reportingEncoding );
 
     File source = new File( basedir, module + "/src/main/java/Test.java" );
     File javadoc = new File( basedir, module + "/target/site/apidocs/Test.html" );
 
-    String java = IOUtil.toString( new FileInputStream( source ), "UTF-8" );
-    String html = IOUtil.toString( new FileInputStream( javadoc ), encoding );
+    String java = IOUtil.toString( new FileInputStream( source ), sourceEncoding );
+    String html = IOUtil.toString( new FileInputStream( javadoc ), reportingEncoding );
 
-    if ( html.indexOf( "text/html; charset=" + encoding ) < 0 )
+    if ( html.indexOf( "text/html; charset=" + reportingEncoding ) < 0 )
     {
         System.err.println( "charset not specified in content-type of " + javadoc );
         return false;
@@ -49,7 +50,9 @@
 
 try
 {
-    result = checkEncoding( "default", "UTF-8") && checkEncoding( "encoding", "UTF-16" ) && checkEncoding( "docencoding", "UTF-16" );
+    result = checkEncoding( "default", "ISO-8859-15", "UTF-8")
+             && checkEncoding( "encoding", "UTF-8", "UTF-16" )
+             && checkEncoding( "docencoding", "UTF-8", "UTF-16" );
 }
 catch( IOException e )
 {

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=685339&r1=685338&r2=685339&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 Tue Aug 12 15:06:48 2008
@@ -751,8 +751,8 @@
     private String charset;
 
     /**
-     * Specifies the encoding of the generated HTML files. If not specificed, the docencoding value will be the value
-     * of the <code>encoding</code> parameter.
+     * Specifies the encoding of the generated HTML files. If not specificed, the docencoding value will be
+     * <code>UTF-8</code>.
      * <br/>
      * See <a href="http://java.sun.com/j2se/1.4.2/docs/tooldocs/windows/javadoc.html#docencoding">docencoding</a>.
      *
@@ -1410,11 +1410,11 @@
     }
 
     /**
-     * @return the docencoding attribute or the value of {@link #getEncoding()} if <code>null</code>.
+     * @return the docencoding attribute or <code>UTF-8</code> if <code>null</code>.
      */
     private String getDocencoding()
     {
-        return ( StringUtils.isEmpty( docencoding ) ) ? getEncoding() : docencoding;
+        return ( StringUtils.isEmpty( docencoding ) ) ? ReaderFactory.UTF_8 : docencoding;
     }
 
     /**

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=685339&r1=685338&r2=685339&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 Tue Aug 12 15:06:48 2008
@@ -392,8 +392,7 @@
             <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>
+            <dd>Value of <code>${project.reporting.outputEncoding}</code> property or <code>UTF-8</code> if not specified.</dd>
             <dt><code>charset</code></dt>
             <dd>Value of <code>docencoding</code> parameter if not specified.</dd>
           </dl>