Revert "Reformatted to code style"
Something creepy is going on @ localhost
This reverts commit 8858a32d7b5c59f230db137d8321ce2be254557b.
git-svn-id: https://svn.apache.org/repos/asf/maven/plugins/trunk@1517906 13f79535-47bb-0310-9956-ffa450edef68
diff --git a/src/it/bootstrap/bundle-pack-target-no-scm/pom.xml b/src/it/bootstrap/bundle-pack-target-no-scm/pom.xml
index 210e30a..cfbe5af 100644
--- a/src/it/bootstrap/bundle-pack-target-no-scm/pom.xml
+++ b/src/it/bootstrap/bundle-pack-target-no-scm/pom.xml
@@ -1,7 +1,6 @@
<?xml version="1.0" encoding="UTF-8"?>
-<project xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"
- xmlns="http://maven.apache.org/POM/4.0.0"
- xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
+<project xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd" xmlns="http://maven.apache.org/POM/4.0.0"
+ xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
<modelVersion>4.0.0</modelVersion>
<parent>
@@ -11,14 +10,14 @@
<relativePath>../../it-parent/pom.xml</relativePath>
</parent>
- <artifactId>bundle-pack-target-no-scm</artifactId>
+ <artifactId>bundle-pack-target-no-scm</artifactId>
<version>1.0</version>
-
+
<name>bundle-pack Target without SCM</name>
<description>Target for the bundle:bundle-pack goal ITs that is missing the SCM section</description>
-
+
<url>http://maven.apache.org/plugins/maven-repository-plugin/test</url>
-
+
<licenses>
<license>
<name>The Apache Software License, Version 2.0</name>
diff --git a/src/it/bootstrap/bundle-pack-target/pom.xml b/src/it/bootstrap/bundle-pack-target/pom.xml
index a3e6ca6..8b09aa5 100644
--- a/src/it/bootstrap/bundle-pack-target/pom.xml
+++ b/src/it/bootstrap/bundle-pack-target/pom.xml
@@ -1,7 +1,6 @@
<?xml version="1.0" encoding="UTF-8"?>
-<project xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"
- xmlns="http://maven.apache.org/POM/4.0.0"
- xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
+<project xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd" xmlns="http://maven.apache.org/POM/4.0.0"
+ xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
<modelVersion>4.0.0</modelVersion>
<parent>
@@ -11,14 +10,14 @@
<relativePath>../../it-parent/pom.xml</relativePath>
</parent>
- <artifactId>bundle-pack-target</artifactId>
+ <artifactId>bundle-pack-target</artifactId>
<version>1.0</version>
-
+
<name>bundle-pack Target</name>
<description>Target for the bundle:bundle-pack goal ITs</description>
-
+
<url>http://maven.apache.org/plugins/maven-repository-plugin/test</url>
-
+
<licenses>
<license>
<name>The Apache Software License, Version 2.0</name>
@@ -26,7 +25,7 @@
<distribution>repo</distribution>
</license>
</licenses>
-
+
<scm>
<url>http://foo/</url>
<connection>scm:svn:http://foo/</connection>
diff --git a/src/main/java/org/apache/maven/plugins/repository/BundleUtils.java b/src/main/java/org/apache/maven/plugins/repository/BundleUtils.java
index 65de794..be71112 100644
--- a/src/main/java/org/apache/maven/plugins/repository/BundleUtils.java
+++ b/src/main/java/org/apache/maven/plugins/repository/BundleUtils.java
@@ -38,10 +38,9 @@
private BundleUtils()
{
}
-
- public static List<File> selectProjectFiles( final File dir, final InputHandler inputHandler,
- final String finalName, final File pom, final Log log,
- final boolean batchMode )
+
+ public static List<File> selectProjectFiles( final File dir, final InputHandler inputHandler, final String finalName,
+ final File pom, final Log log, final boolean batchMode )
throws MojoExecutionException
{
File[] projectFiles = dir.listFiles( new FilenameFilter()
@@ -51,57 +50,50 @@
return new File( dir, name ).isFile() && name.startsWith( finalName );
}
} );
-
+
List<File> result = new ArrayList<File>();
-
+
if ( projectFiles == null )
{
return result;
}
- for ( File projectFile : projectFiles )
- {
- if ( projectFile.getName().endsWith( ".pom" ) )
- {
- if ( !projectFile.equals( pom ) )
- {
- log.info( "Detected POM file will be excluded:\n" + projectFile
- + "\n\nInstead, the bundle will include the POM from:\n" + pom );
+ for (File projectFile : projectFiles) {
+ if (projectFile.getName().endsWith(".pom")) {
+ if (!projectFile.equals(pom)) {
+ log.info("Detected POM file will be excluded:\n" + projectFile
+ + "\n\nInstead, the bundle will include the POM from:\n" + pom);
}
- }
- else if ( projectFile.getName().endsWith( "-bundle.jar" ) )
- {
- log.warn( "Skipping project file which collides with repository bundle filename:\n" + projectFile );
- }
- else
- {
- result.add( projectFile );
+ } else if (projectFile.getName().endsWith("-bundle.jar")) {
+ log.warn("Skipping project file which collides with repository bundle filename:\n" + projectFile);
+ } else {
+ result.add(projectFile);
}
}
-
+
if ( result.isEmpty() )
{
return result;
}
-
+
Collections.sort( result, new Comparator<File>()
{
public int compare( File first, File second )
{
String f = first.getName();
String s = second.getName();
-
+
if ( f.length() == s.length() )
{
return f.compareTo( s );
}
-
+
return f.length() < s.length() ? -1 : 1;
}
} );
-
+
result = reviseFileList( result, inputHandler, log, batchMode );
-
+
return result;
}
@@ -109,28 +101,28 @@
throws MojoExecutionException
{
List<File> result = new ArrayList<File>( input );
-
+
if ( batchMode )
{
return result;
}
-
- while ( true )
+
+ while( true )
{
StringBuilder message = new StringBuilder();
message.append( "The following files are marked for inclusion in the repository bundle:\n" );
message.append( "\n0.) Done" );
-
+
int i = 1;
for ( File f : result )
{
- message.append( "\n" ).append( ( i++ ) ).append( ".) " ).append( f.getName() );
+ message.append( "\n" ).append( (i++) ).append( ".) " ).append( f.getName() );
}
-
+
message.append( "\n\nPlease select the number(s) for any files you wish to exclude, " +
- "or '0' when you're done.\nSeparate the numbers for multiple files with a " +
- "comma (',').\n\nSelection: " );
-
+ "or '0' when you're done.\nSeparate the numbers for multiple files with a " +
+ "comma (',').\n\nSelection: " );
+
log.info( message );
String response;
try
@@ -139,17 +131,16 @@
}
catch ( IOException e )
{
- throw new MojoExecutionException(
- "Project file selection failed with an I/O exception: " + e.getMessage(), e );
+ throw new MojoExecutionException( "Project file selection failed with an I/O exception: " + e.getMessage(), e );
}
-
+
if ( response == null || "0".equals( response ) )
{
break;
}
-
+
StringTokenizer st = new StringTokenizer( response, "," );
-
+
if ( st.countTokens() > 0 )
{
int[] idxs = new int[st.countTokens()];
@@ -157,18 +148,18 @@
{
idxs[j] = Integer.parseInt( st.nextToken().trim() );
}
-
+
Arrays.sort( idxs );
-
- for ( int k = idxs.length - 1; k > -1; k-- )
+
+ for( int k = idxs.length - 1; k > -1; k-- )
{
if ( idxs[k] < 1 || idxs[k] > result.size() )
{
log.warn( "NOT removing: " + idxs[k] + "; no such file." );
continue;
}
-
- File removed = result.remove( idxs[k] - 1 );
+
+ File removed = result.remove( idxs[k] -1 );
log.info( "Removed: " + removed.getName() );
}
}
@@ -177,7 +168,7 @@
break;
}
}
-
+
return result;
}
diff --git a/src/test/java/org/apache/maven/plugins/repository/BundleCreateMojoTest.java b/src/test/java/org/apache/maven/plugins/repository/BundleCreateMojoTest.java
index e7c7442..9c181dc 100644
--- a/src/test/java/org/apache/maven/plugins/repository/BundleCreateMojoTest.java
+++ b/src/test/java/org/apache/maven/plugins/repository/BundleCreateMojoTest.java
@@ -50,7 +50,7 @@
/**
* Test for repository plugin with project.packaging == pom
- *
+ *
* @throws Exception
*/
public void testDefaults_PomPackaging()
@@ -68,7 +68,8 @@
e.printStackTrace();
}
- File bundleSource = new File( getBasedir(), "target/test/unit/pom-only/target/pom-only-bundle.jar" );
+ File bundleSource =
+ new File( getBasedir(), "target/test/unit/pom-only/target/pom-only-bundle.jar" );
assertTrue( FileUtils.fileExists( bundleSource.getAbsolutePath() ) );
Set<String> entryNames = new HashSet<String>();
@@ -81,7 +82,7 @@
/**
* Test for repository plugin default configuration
- *
+ *
* @throws Exception
*/
public void testDefaultconfiguration()
@@ -90,8 +91,8 @@
try
{
- createTestJars( "default-configuration", true, true,
- getBasedir() + "/target/test/unit/default-configuration/target" );
+ createTestJars( "default-configuration", true, true, getBasedir()
+ + "/target/test/unit/default-configuration/target" );
}
catch ( IOException ie )
{
@@ -130,8 +131,8 @@
{
try
{
- createTestJars( "default-configuration", true, true,
- getBasedir() + "/target/test/unit/default-configuration/target" );
+ createTestJars( "default-configuration", true, true, getBasedir()
+ + "/target/test/unit/default-configuration/target" );
}
catch ( IOException ie )
{
@@ -180,8 +181,8 @@
{
try
{
- createTestJars( "default-configuration", true, true,
- getBasedir() + "/target/test/unit/default-configuration/target" );
+ createTestJars( "default-configuration", true, true, getBasedir()
+ + "/target/test/unit/default-configuration/target" );
}
catch ( IOException ie )
{
@@ -230,8 +231,8 @@
{
try
{
- createTestJars( "default-configuration", true, true,
- getBasedir() + "/target/test/unit/default-configuration/target" );
+ createTestJars( "default-configuration", true, true, getBasedir()
+ + "/target/test/unit/default-configuration/target" );
}
catch ( IOException ie )
{
@@ -280,8 +281,8 @@
{
try
{
- createTestJars( "default-configuration", true, true,
- getBasedir() + "/target/test/unit/default-configuration/target" );
+ createTestJars( "default-configuration", true, true, getBasedir()
+ + "/target/test/unit/default-configuration/target" );
}
catch ( IOException ie )
{
@@ -327,7 +328,7 @@
/**
* Test repository plugin when there is no javadoc jar to be included in the bundle
- *
+ *
* @throws Exception
*/
public void testNoJavadocJar()
@@ -370,7 +371,7 @@
/**
* Test repository plugin when there is no sources jar to be included in the bundle
- *
+ *
* @throws Exception
*/
public void testNoSourcesJar()
@@ -413,7 +414,7 @@
/**
* Test repository plugin when there are no javadoc and sources jar files to be included in the bundle
- *
+ *
* @throws Exception
*/
public void testNoJavadocSourcesJars()
@@ -422,8 +423,8 @@
try
{
- createTestJars( "no-javadoc-sources", false, false,
- getBasedir() + "/target/test/unit/no-javadoc-sources/target" );
+ createTestJars( "no-javadoc-sources", false, false, getBasedir()
+ + "/target/test/unit/no-javadoc-sources/target" );
}
catch ( IOException ie )
{
@@ -461,7 +462,7 @@
/**
* Test repository plugin when the scm element is null
- *
+ *
* @throws Exception
*/
public void testNullScm()
@@ -485,7 +486,7 @@
// MREPOSITORY-2 project.scm.connection should not be required for bundle-create
// MREPOSITORY-19 project.scm.{url|connection} are required for project materialization...
- fail( "Must throw an exception on a project element scm is null" );
+ fail( "Must throw an exception on a project element scm is null" );
}
catch ( MojoExecutionException e )
{
@@ -496,7 +497,7 @@
/**
* Test repository plugin when license file does not exist
- *
+ *
* @throws Exception
*/
public void testNoLicense()
@@ -505,8 +506,7 @@
try
{
- createTestJars( "no-license-file", false, false,
- getBasedir() + "/target/test/unit/no-license-file/target" );
+ createTestJars( "no-license-file", false, false, getBasedir() + "/target/test/unit/no-license-file/target" );
}
catch ( IOException ie )
{
@@ -530,7 +530,7 @@
/**
* Test repository plugin when there is no project name specified in the pom
- *
+ *
* @throws Exception
*/
public void testNoProjectName()
@@ -538,8 +538,7 @@
{
try
{
- createTestJars( "no-project-name", false, false,
- getBasedir() + "/target/test/unit/no-project-name/target" );
+ createTestJars( "no-project-name", false, false, getBasedir() + "/target/test/unit/no-project-name/target" );
}
catch ( IOException ie )
{
@@ -563,11 +562,15 @@
/**
* Method for creating the jar files that will be used in testing
- *
- * @param fileName the file name of the jar file(s) to be created
- * @param createJavadocJar specifies whether a javadoc jar file will be created or not
- * @param createSourcesJar specifies whether a sources jar file will be created or not
- * @param destDir the destination directory where the jar file(s) are to be created
+ *
+ * @param fileName
+ * the file name of the jar file(s) to be created
+ * @param createJavadocJar
+ * specifies whether a javadoc jar file will be created or not
+ * @param createSourcesJar
+ * specifies whether a sources jar file will be created or not
+ * @param destDir
+ * the destination directory where the jar file(s) are to be created
* @throws IOException
*/
private void createTestJars( String fileName, boolean createJavadocJar, boolean createSourcesJar, String destDir )
diff --git a/src/test/java/org/apache/maven/plugins/repository/testutil/TestInputHandler.java b/src/test/java/org/apache/maven/plugins/repository/testutil/TestInputHandler.java
index 37309a4..17c1d2e 100644
--- a/src/test/java/org/apache/maven/plugins/repository/testutil/TestInputHandler.java
+++ b/src/test/java/org/apache/maven/plugins/repository/testutil/TestInputHandler.java
@@ -28,11 +28,11 @@
public class TestInputHandler
implements InputHandler
{
-
+
private Stack<String> lineResponses;
-
+
private Stack<List<String>> lineListResponses;
-
+
private Stack<String> passwordResponses;
public String readLine()