From 31e79ea14f6e1480d8a552224c22f1488c847b77 Mon Sep 17 00:00:00 2001
From: Brett Leslie Porter destinationFile
against the remote source
- * @param proxyHost Proxy Host (if proxy is required), or null
- * @param proxyPort Proxy Port (if proxy is required), or null
- * @param proxyUserName Proxy Username (if authentification is required),
- * or null.
- * @param proxyPassword Proxy Password (if authentification is required),
- * or null.
- * @param useChecksum Flag to indicate the use of the checksum for the retrieved
- * artifact if it is available.
+ * @param ignoreErrors whether to ignore errors during I/O or throw an
+ * exception when they happen
+ * @param useTimestamp whether to check the modified timestamp on the
+ * destinationFile
against the remote source
+ * @param proxyHost Proxy Host (if proxy is required), or null
+ * @param proxyPort Proxy Port (if proxy is required), or null
+ * @param proxyUserName Proxy Username (if authentification is required),
+ * or null.
+ * @param proxyPassword Proxy Password (if authentification is required),
+ * or null.
+ * @param useChecksum Flag to indicate the use of the checksum for the retrieved
+ * artifact if it is available.
* @throws IOException If an I/O exception occurs.
*/
public static void getFile( String url, File destinationFile, boolean ignoreErrors, boolean useTimestamp,
@@ -125,18 +122,18 @@ public class HttpUtils
* Retrieve a remote file. Throws an Exception on errors unless the
* ifnoreErrors flag is set to True
*
- * @param url the of the file to retrieve
+ * @param url the of the file to retrieve
* @param destinationFile where to store it
- * @param ignoreErrors whether to ignore errors during I/O or throw an
- * exception when they happen
- * @param useTimestamp whether to check the modified timestamp on the
- * destinationFile
against the remote source
- * @param proxyHost Proxy Host (if proxy is required), or null
- * @param proxyPort Proxy Port (if proxy is required), or null
- * @param proxyUserName Proxy Username (if authentification is required),
- * or null
- * @param proxyPassword Proxy Password (if authentification is required),
- * or null
+ * @param ignoreErrors whether to ignore errors during I/O or throw an
+ * exception when they happen
+ * @param useTimestamp whether to check the modified timestamp on the
+ * destinationFile
against the remote source
+ * @param proxyHost Proxy Host (if proxy is required), or null
+ * @param proxyPort Proxy Port (if proxy is required), or null
+ * @param proxyUserName Proxy Username (if authentification is required),
+ * or null
+ * @param proxyPassword Proxy Password (if authentification is required),
+ * or null
* @throws IOException If an I/O exception occurs.
*/
public static void getFile( String url, File destinationFile, boolean ignoreErrors, boolean useTimestamp,
@@ -166,17 +163,17 @@ public class HttpUtils
/**
* Retrieve a remote file.
*
- * @param url the URL of the file to retrieve
+ * @param url the URL of the file to retrieve
* @param destinationFile where to store it
- * @param timestamp if provided, the remote URL is only retrieved if it was
- * modified more recently than timestamp. Otherwise, negative value indicates that
- * the remote URL should be retrieved unconditionally.
- * @param proxyHost Proxy Host (if proxy is required), or null
- * @param proxyPort Proxy Port (if proxy is required), or null
- * @param proxyUserName Proxy Username (if authentification is required),
- * or null
- * @param proxyPassword Proxy Password (if authentification is required),
- * or null
+ * @param timestamp if provided, the remote URL is only retrieved if it was
+ * modified more recently than timestamp. Otherwise, negative value indicates that
+ * the remote URL should be retrieved unconditionally.
+ * @param proxyHost Proxy Host (if proxy is required), or null
+ * @param proxyPort Proxy Port (if proxy is required), or null
+ * @param proxyUserName Proxy Username (if authentification is required),
+ * or null
+ * @param proxyPassword Proxy Password (if authentification is required),
+ * or null
* @throws IOException If an I/O exception occurs.
*/
public static void getFile( String url, File destinationFile, long timestamp, String proxyHost, String proxyPort,
@@ -223,8 +220,7 @@ public class HttpUtils
if ( httpConnection.getResponseCode() == HttpURLConnection.HTTP_NOT_FOUND )
{
throw new FileNotFoundException( url.toString() + " (HTTP Error: " + httpConnection.getResponseCode() +
- " " +
- httpConnection.getResponseMessage() + ")" );
+ " " + httpConnection.getResponseMessage() + ")" );
}
if ( httpConnection.getResponseCode() == HttpURLConnection.HTTP_NOT_MODIFIED )
{
@@ -338,12 +334,12 @@ public class HttpUtils
/**
* set the timestamp of a named file to a specified time.
*
- * @param file the file to touch
+ * @param file the file to touch
* @param timemillis in milliseconds since the start of the era
* @return true if it succeeded. False means that this is a java1.1 system
* and that file times can not be set
* @throws RuntimeException Thrown in unrecoverable error. Likely this
- * comes from file access failures.
+ * comes from file access failures.
*/
private static boolean touchFile( File file, long timemillis )
{
diff --git a/maven-mboot2/src/main/java/util/FileUtils.java b/maven-mboot2/src/main/java/util/FileUtils.java
index 871735fe45..f6f95c337e 100644
--- a/maven-mboot2/src/main/java/util/FileUtils.java
+++ b/maven-mboot2/src/main/java/util/FileUtils.java
@@ -236,7 +236,7 @@ public class FileUtils
* Writes data to a file. The file will be created if it does not exist.
*
* @param fileName The name of the file to write.
- * @param data The content to write to the file.
+ * @param data The content to write to the file.
*/
public static void fileWrite( String fileName, String data )
throws IOException
@@ -261,7 +261,7 @@ public class FileUtils
* Waits for NFS to propagate a file creation, imposing a timeout.
*
* @param fileName The name of the file.
- * @param seconds The maximum time in seconds to wait.
+ * @param seconds The maximum time in seconds to wait.
* @return True if file exists.
*/
public static boolean waitFor( String fileName, int seconds )
@@ -308,9 +308,6 @@ public class FileUtils
/**
* Given a directory and an array of extensions return an array of compliant files.
*
- * TODO Should an ignore list be passed in?
- * TODO Should a recurse flag be passed in?
- *
* The given extensions should be like "java" and not like ".java"
*/
public static String[] getFilesFromExtension( String directory, String[] extensions )
@@ -341,7 +338,6 @@ public class FileUtils
continue;
}
-
//ok... transverse into this directory and get all the files... then combine
//them with the current list.
@@ -650,12 +646,12 @@ public class FileUtils
* (and any parent directories) will be created. If a file source
in
* destinationDirectory
exists, it will be overwritten.
*
- * @param source An existing File
to copy.
+ * @param source An existing File
to copy.
* @param destinationDirectory A directory to copy source
into.
* @throws java.io.FileNotFoundException if source
isn't a normal file.
- * @throws IllegalArgumentException if destinationDirectory
isn't a directory.
- * @throws IOException if source
does not exist, the file in
- * destinationDirectory
cannot be written to, or an IO error occurs during copying.
+ * @throws IllegalArgumentException if destinationDirectory
isn't a directory.
+ * @throws IOException if source
does not exist, the file in
+ * destinationDirectory
cannot be written to, or an IO error occurs during copying.
*/
public static void copyFileToDirectory( final String source, final String destinationDirectory )
throws IOException
@@ -668,12 +664,12 @@ public class FileUtils
* (and any parent directories) will be created. If a file source
in
* destinationDirectory
exists, it will be overwritten.
*
- * @param source An existing File
to copy.
+ * @param source An existing File
to copy.
* @param destinationDirectory A directory to copy source
into.
* @throws java.io.FileNotFoundException if source
isn't a normal file.
- * @throws IllegalArgumentException if destinationDirectory
isn't a directory.
- * @throws IOException if source
does not exist, the file in
- * destinationDirectory
cannot be written to, or an IO error occurs during copying.
+ * @throws IllegalArgumentException if destinationDirectory
isn't a directory.
+ * @throws IOException if source
does not exist, the file in
+ * destinationDirectory
cannot be written to, or an IO error occurs during copying.
*/
public static void copyFileToDirectory( final File source, final File destinationDirectory )
throws IOException
@@ -691,13 +687,13 @@ public class FileUtils
* created if they don't already exist. destination
will be overwritten if it
* already exists.
*
- * @param source An existing non-directory File
to copy bytes from.
+ * @param source An existing non-directory File
to copy bytes from.
* @param destination A non-directory File
to write bytes to (possibly
- * overwriting).
- * @throws IOException if source
does not exist, destination
cannot be
- * written to, or an IO error occurs during copying.
+ * overwriting).
+ * @throws IOException if source
does not exist, destination
cannot be
+ * written to, or an IO error occurs during copying.
* @throws java.io.FileNotFoundException if destination
is a directory
- * (use {@link #copyFileToDirectory}).
+ * (use {@link #copyFileToDirectory}).
*/
public static void copyFile( final File source, final File destination )
throws IOException
@@ -741,15 +737,15 @@ public class FileUtils
* The directories up to destination
will be created if they don't already exist.
* destination
will be overwritten if it already exists.
*
- * @param source A URL
to copy bytes from.
+ * @param source A URL
to copy bytes from.
* @param destination A non-directory File
to write bytes to (possibly
- * overwriting).
+ * overwriting).
* @throws IOException if
- *
- *
+ * source
URL cannot be openeddestination
cannot be written to
+ *
*/
public static void copyURLToFile( final URL source, final File destination )
throws IOException
@@ -884,7 +880,7 @@ public class FileUtils
* source
URL cannot be openeddestination
cannot be written tobaseFile
, otherwise it is treated as a normal root-relative path.
*
* @param baseFile Where to resolve filename
from, if filename
is
- * relative.
+ * relative.
* @param filename Absolute or relative file path to resolve.
* @return The canonical File
of filename
.
*/
@@ -916,8 +912,6 @@ public class FileUtils
return file;
}
- // FIXME: I'm almost certain this // removal is unnecessary, as getAbsoluteFile() strips
- // them. However, I'm not sure about this UNC stuff. (JT)
final char[] chars = filename.toCharArray();
final StringBuffer sb = new StringBuffer();
@@ -1374,10 +1368,10 @@ public class FileUtils
* well.
to
may have been deleted
- * already when this happens.
+ * process. Note that to
may have been deleted
+ * already when this happens.
*/
public static void rename( File from, File to )
throws IOException
@@ -1418,10 +1412,10 @@ public class FileUtils
* when the parentDir attribute is
* null.
*
- * @param prefix prefix before the random number
- * @param suffix file extension; include the '.'
+ * @param prefix prefix before the random number
+ * @param suffix file extension; include the '.'
* @param parentDir Directory to create the temporary file in -
- * java.io.tmpdir used if not specificed
+ * java.io.tmpdir used if not specificed
* @return a File reference to the new temporary file.
*/
public static File createTempFile( String prefix, String suffix, File parentDir )
diff --git a/maven-project/src/main/java/org/apache/maven/profiles/activation/FileProfileActivator.java b/maven-project/src/main/java/org/apache/maven/profiles/activation/FileProfileActivator.java
index 99a890c7f7..55a9939cfd 100644
--- a/maven-project/src/main/java/org/apache/maven/profiles/activation/FileProfileActivator.java
+++ b/maven-project/src/main/java/org/apache/maven/profiles/activation/FileProfileActivator.java
@@ -2,7 +2,6 @@ package org.apache.maven.profiles.activation;
import org.apache.maven.model.Activation;
import org.apache.maven.model.ActivationFile;
-import org.apache.maven.model.BuildBase;
import org.apache.maven.model.Profile;
import org.codehaus.plexus.util.FileUtils;
diff --git a/maven-project/src/test/java/org/apache/maven/project/injection/DefaultProfileInjectorTest.java b/maven-project/src/test/java/org/apache/maven/project/injection/DefaultProfileInjectorTest.java
index 3fe79f93dd..dc12f6e55a 100644
--- a/maven-project/src/test/java/org/apache/maven/project/injection/DefaultProfileInjectorTest.java
+++ b/maven-project/src/test/java/org/apache/maven/project/injection/DefaultProfileInjectorTest.java
@@ -1,117 +1,115 @@
package org.apache.maven.project.injection;
+import junit.framework.TestCase;
import org.apache.maven.model.Build;
import org.apache.maven.model.BuildBase;
import org.apache.maven.model.Model;
import org.apache.maven.model.Plugin;
import org.apache.maven.model.Profile;
import org.apache.maven.model.Repository;
-import org.codehaus.plexus.configuration.xml.XmlPlexusConfiguration;
import org.codehaus.plexus.util.xml.Xpp3Dom;
import java.util.List;
-import junit.framework.TestCase;
-
public class DefaultProfileInjectorTest
extends TestCase
{
-
+
public void testProfilePluginConfigurationShouldOverrideModelPluginConfiguration()
{
Plugin mPlugin = new Plugin();
- mPlugin.setGroupId("test");
- mPlugin.setArtifactId("test-artifact");
- mPlugin.setVersion("1.0-SNAPSHOT");
-
- Xpp3Dom mConfigChild = new Xpp3Dom("test");
- mConfigChild.setValue("value");
-
- Xpp3Dom mConfig = new Xpp3Dom("configuration");
+ mPlugin.setGroupId( "test" );
+ mPlugin.setArtifactId( "test-artifact" );
+ mPlugin.setVersion( "1.0-SNAPSHOT" );
+
+ Xpp3Dom mConfigChild = new Xpp3Dom( "test" );
+ mConfigChild.setValue( "value" );
+
+ Xpp3Dom mConfig = new Xpp3Dom( "configuration" );
mConfig.addChild( mConfigChild );
-
- mPlugin.setConfiguration(mConfig);
-
+
+ mPlugin.setConfiguration( mConfig );
+
Build mBuild = new Build();
- mBuild.addPlugin(mPlugin);
-
+ mBuild.addPlugin( mPlugin );
+
Model model = new Model();
- model.setBuild(mBuild);
-
+ model.setBuild( mBuild );
+
Plugin pPlugin = new Plugin();
- pPlugin.setGroupId("test");
- pPlugin.setArtifactId("test-artifact");
- pPlugin.setVersion("1.0-SNAPSHOT");
-
- Xpp3Dom pConfigChild = new Xpp3Dom("test");
- pConfigChild.setValue("replacedValue");
-
- Xpp3Dom pConfig = new Xpp3Dom("configuration");
+ pPlugin.setGroupId( "test" );
+ pPlugin.setArtifactId( "test-artifact" );
+ pPlugin.setVersion( "1.0-SNAPSHOT" );
+
+ Xpp3Dom pConfigChild = new Xpp3Dom( "test" );
+ pConfigChild.setValue( "replacedValue" );
+
+ Xpp3Dom pConfig = new Xpp3Dom( "configuration" );
pConfig.addChild( pConfigChild );
-
- pPlugin.setConfiguration(pConfig);
-
+
+ pPlugin.setConfiguration( pConfig );
+
BuildBase pBuild = new BuildBase();
- pBuild.addPlugin(pPlugin);
-
+ pBuild.addPlugin( pPlugin );
+
Profile profile = new Profile();
- profile.setId("testId");
-
- profile.setBuild(pBuild);
-
- new DefaultProfileInjector().inject(profile, model);
-
+ profile.setId( "testId" );
+
+ profile.setBuild( pBuild );
+
+ new DefaultProfileInjector().inject( profile, model );
+
Build rBuild = model.getBuild();
- Plugin rPlugin = (Plugin) rBuild.getPlugins().get(0);
+ Plugin rPlugin = (Plugin) rBuild.getPlugins().get( 0 );
Xpp3Dom rConfig = (Xpp3Dom) rPlugin.getConfiguration();
-
- Xpp3Dom rChild = rConfig.getChild("test");
-
- assertEquals("replacedValue", rChild.getValue());
+
+ Xpp3Dom rChild = rConfig.getChild( "test" );
+
+ assertEquals( "replacedValue", rChild.getValue() );
}
public void testProfileRepositoryShouldOverrideModelRepository()
{
Repository mRepository = new Repository();
- mRepository.setId("testId");
- mRepository.setName("Test repository");
- mRepository.setUrl("http://www.google.com");
-
+ mRepository.setId( "testId" );
+ mRepository.setName( "Test repository" );
+ mRepository.setUrl( "http://www.google.com" );
+
Model model = new Model();
- model.addRepository(mRepository);
-
+ model.addRepository( mRepository );
+
Repository pRepository = new Repository();
- pRepository.setId("testId");
- pRepository.setName("Test repository");
- pRepository.setUrl("http://www.yahoo.com");
-
+ pRepository.setId( "testId" );
+ pRepository.setName( "Test repository" );
+ pRepository.setUrl( "http://www.yahoo.com" );
+
Profile profile = new Profile();
- profile.setId("testId");
-
- profile.addRepository(pRepository);
-
- new DefaultProfileInjector().inject(profile, model);
-
- Repository rRepository = (Repository) model.getRepositories().get(0);
-
- assertEquals("http://www.yahoo.com", rRepository.getUrl());
+ profile.setId( "testId" );
+
+ profile.addRepository( pRepository );
+
+ new DefaultProfileInjector().inject( profile, model );
+
+ Repository rRepository = (Repository) model.getRepositories().get( 0 );
+
+ assertEquals( "http://www.yahoo.com", rRepository.getUrl() );
}
public void testShouldPreserveModelModulesWhenProfileHasNone()
{
Model model = new Model();
-
- model.addModule("module1");
-
+
+ model.addModule( "module1" );
+
Profile profile = new Profile();
- profile.setId("testId");
-
- new DefaultProfileInjector().inject(profile, model);
-
+ profile.setId( "testId" );
+
+ new DefaultProfileInjector().inject( profile, model );
+
List rModules = model.getModules();
-
- assertEquals( 1, rModules.size());
- assertEquals("module1", rModules.get(0));
+
+ assertEquals( 1, rModules.size() );
+ assertEquals( "module1", rModules.get( 0 ) );
}
}
diff --git a/maven-site/src/site/apt/ant-tasks.apt b/maven-site/src/site/apt/ant-tasks.apt
index 340d7240f7..4c91dd4a7d 100755
--- a/maven-site/src/site/apt/ant-tasks.apt
+++ b/maven-site/src/site/apt/ant-tasks.apt
@@ -390,7 +390,7 @@ Type Reference
*----------------------+--------------------------------------------------------+
| <<