maven-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From bri...@apache.org
Subject svn commit: r453456 - in /maven/plugins/branches/mjavadoc-93/src: main/java/org/apache/maven/plugin/javadoc/AbstractJavadocMojo.java test/resources/unit/javadocjar-default/javadocjar-default-plugin-config.xml
Date Fri, 06 Oct 2006 01:46:29 GMT
Author: brianf
Date: Thu Oct  5 18:46:28 2006
New Revision: 453456

URL: http://svn.apache.org/viewvc?view=rev&rev=453456
Log:
MJAVADOC-93: Allow commas in text arguments doctitle, windowtitle, header, footer, and bottom


Modified:
    maven/plugins/branches/mjavadoc-93/src/main/java/org/apache/maven/plugin/javadoc/AbstractJavadocMojo.java
    maven/plugins/branches/mjavadoc-93/src/test/resources/unit/javadocjar-default/javadocjar-default-plugin-config.xml

Modified: maven/plugins/branches/mjavadoc-93/src/main/java/org/apache/maven/plugin/javadoc/AbstractJavadocMojo.java
URL: http://svn.apache.org/viewvc/maven/plugins/branches/mjavadoc-93/src/main/java/org/apache/maven/plugin/javadoc/AbstractJavadocMojo.java?view=diff&rev=453456&r1=453455&r2=453456
==============================================================================
--- maven/plugins/branches/mjavadoc-93/src/main/java/org/apache/maven/plugin/javadoc/AbstractJavadocMojo.java
(original)
+++ maven/plugins/branches/mjavadoc-93/src/main/java/org/apache/maven/plugin/javadoc/AbstractJavadocMojo.java
Thu Oct  5 18:46:28 2006
@@ -1039,16 +1039,16 @@
         if ( StringUtils.isEmpty( doclet ) )
         {
             addArgIf( arguments, author, "-author" );
-            addArgIfNotEmpty( arguments, "-bottom", quotedArgument( getBottomText( project.getInceptionYear()
) ) );
+            addArgIfNotEmpty( arguments, "-bottom", quotedArgument( getBottomText( project.getInceptionYear()
) ), false, false );
             addArgIf( arguments, breakiterator, "-breakiterator", SINCE_JAVADOC_1_4 );
             addArgIfNotEmpty( arguments, "-charset", quotedArgument( charset ) );
             addArgIfNotEmpty( arguments, "-d", quotedPathArgument( javadocOutputDirectory.toString()
) );
             addArgIf( arguments, docfilessubdirs, "-docfilessubdirs", SINCE_JAVADOC_1_4 );
             addArgIfNotEmpty( arguments, "-docencoding", quotedArgument( docencoding ) );
-            addArgIfNotEmpty( arguments, "-doctitle", quotedArgument( doctitle ) );
+            addArgIfNotEmpty( arguments, "-doctitle", quotedArgument( doctitle ), false,
false );
             addArgIfNotEmpty( arguments, "-excludedocfilessubdir", quotedPathArgument( excludedocfilessubdir
),
                               SINCE_JAVADOC_1_4 );
-            addArgIfNotEmpty( arguments, "-footer", quotedArgument( footer ) );
+            addArgIfNotEmpty( arguments, "-footer", quotedArgument( footer ), false, false
);
             if ( groups != null )
             {
                 for ( int i = 0; i < groups.length; i++ )
@@ -1066,7 +1066,7 @@
                     }
                 }
             }
-            addArgIfNotEmpty( arguments, "-header", quotedArgument( header ) );
+            addArgIfNotEmpty( arguments, "-header", quotedArgument( header ), false, false
);
             addArgIfNotEmpty( arguments, "-helpfile", quotedPathArgument( helpfile ) );
             addArgIf( arguments, keywords, "-keywords", SINCE_JAVADOC_1_4_2 );
 
@@ -1140,7 +1140,7 @@
 
             addArgIf( arguments, use, "-use" );
             addArgIf( arguments, version, "-version" );
-            addArgIfNotEmpty( arguments, "-windowtitle", quotedArgument( windowtitle ) );
+            addArgIfNotEmpty( arguments, "-windowtitle", quotedArgument( windowtitle ), false,
false );
         }
 
         // ----------------------------------------------------------------------
@@ -1933,11 +1933,13 @@
      * Moreover, the value could be comma separated.
      *
      * @param arguments
-     * @param key       the argument name.
-     * @param value     the argument value to be added.
-     * @param repeatKey repeat or not the key in the command line
+     * @param key         the argument name.
+     * @param value       the argument value to be added.
+     * @param repeatKey   repeat or not the key in the command line
+     * @param splitValue  if <code>true</code> given value will be tokenized
by comma
      */
-    private void addArgIfNotEmpty( List arguments, String key, String value, boolean repeatKey
)
+    private void addArgIfNotEmpty( List arguments, String key, String value, 
+        boolean repeatKey, boolean splitValue )
     {
         if ( StringUtils.isNotEmpty( value ) )
         {
@@ -1946,23 +1948,43 @@
                 arguments.add( key );
             }
 
-            StringTokenizer token = new StringTokenizer( value, "," );
-            while ( token.hasMoreTokens() )
-            {
-                String current = token.nextToken().trim();
-
-                if ( StringUtils.isNotEmpty( current ) )
-                {
-                    arguments.add( current );
-
-                    if ( token.hasMoreTokens() && repeatKey )
-                    {
-                        arguments.add( key );
+            if (splitValue) {
+                StringTokenizer token = new StringTokenizer( value, "," );
+                while ( token.hasMoreTokens() )
+                {
+                    String current = token.nextToken().trim();
+    
+                    if ( StringUtils.isNotEmpty( current ) )
+                    {
+                        arguments.add( current );
+    
+                        if ( token.hasMoreTokens() && repeatKey )
+                        {
+                            arguments.add( key );
+                        }
                     }
                 }
+            } else {
+                arguments.add( value );
             }
         }
     }
+    
+    /**
+     * Convenience method to add an argument to the <code>command line</code>
+     * if the the value is not null or empty.
+     * <p/>
+     * Moreover, the value could be comma separated.
+     *
+     * @param arguments
+     * @param key       the argument name.
+     * @param value     the argument value to be added.
+     * @param repeatKey repeat or not the key in the command line
+     */
+    private void addArgIfNotEmpty( List arguments, String key, String value, boolean repeatKey
) {
+        addArgIfNotEmpty(arguments, key, value, repeatKey, true);
+    }
+
 
     /**
      * Convenience method to add an argument to the <code>command line</code>

Modified: maven/plugins/branches/mjavadoc-93/src/test/resources/unit/javadocjar-default/javadocjar-default-plugin-config.xml
URL: http://svn.apache.org/viewvc/maven/plugins/branches/mjavadoc-93/src/test/resources/unit/javadocjar-default/javadocjar-default-plugin-config.xml?view=diff&rev=453456&r1=453455&r2=453456
==============================================================================
--- maven/plugins/branches/mjavadoc-93/src/test/resources/unit/javadocjar-default/javadocjar-default-plugin-config.xml
(original)
+++ maven/plugins/branches/mjavadoc-93/src/test/resources/unit/javadocjar-default/javadocjar-default-plugin-config.xml
Thu Oct  5 18:46:28 2006
@@ -39,11 +39,16 @@
           <serialwarn>false</serialwarn>
           <splitindex>false</splitindex>
           <stylesheet>java</stylesheet>
+          <!--commas in following elements are to test MJAVADOC-93-->
+          <doctitle>doc,title</doctitle> 
+          <bottom>bottom,comma test</bottom>  
+          <footer>my footer, and something</footer>
+          <header>my header, and something else</header>
+          <windowtitle>Maven Javadoc Plugin, Javadoc Jar Default Config Test 1.0-SNAPSHOT
API</windowtitle>
           <groups/>
           <tags/>
           <use>true</use>
           <version>true</version>
-          <windowtitle>Maven Javadoc Plugin Javadoc Jar Default Config Test 1.0-SNAPSHOT
API</windowtitle>
           <links>
              <param>http://java.sun.com/j2se/1.4.2/docs/api</param>
           </links>



Mime
View raw message