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 2012/02/26 18:35:52 UTC
svn commit: r1293890 - in
/maven/sandbox/trunk/plugins/asf-svnpubsub-plugin/src/main/java/org/apache/maven/plugins/svnpubsub:
CommonSvnpubsubMojo.java SvnpubsubInventory.java
SvnpubsubLifecycleMojo.java SvnpubsubPublishMojo.java
Author: hboutemy
Date: Sun Feb 26 17:35:51 2012
New Revision: 1293890
URL: http://svn.apache.org/viewvc?rev=1293890&view=rev
Log:
code formatting
Modified:
maven/sandbox/trunk/plugins/asf-svnpubsub-plugin/src/main/java/org/apache/maven/plugins/svnpubsub/CommonSvnpubsubMojo.java
maven/sandbox/trunk/plugins/asf-svnpubsub-plugin/src/main/java/org/apache/maven/plugins/svnpubsub/SvnpubsubInventory.java
maven/sandbox/trunk/plugins/asf-svnpubsub-plugin/src/main/java/org/apache/maven/plugins/svnpubsub/SvnpubsubLifecycleMojo.java
maven/sandbox/trunk/plugins/asf-svnpubsub-plugin/src/main/java/org/apache/maven/plugins/svnpubsub/SvnpubsubPublishMojo.java
Modified: maven/sandbox/trunk/plugins/asf-svnpubsub-plugin/src/main/java/org/apache/maven/plugins/svnpubsub/CommonSvnpubsubMojo.java
URL: http://svn.apache.org/viewvc/maven/sandbox/trunk/plugins/asf-svnpubsub-plugin/src/main/java/org/apache/maven/plugins/svnpubsub/CommonSvnpubsubMojo.java?rev=1293890&r1=1293889&r2=1293890&view=diff
==============================================================================
--- maven/sandbox/trunk/plugins/asf-svnpubsub-plugin/src/main/java/org/apache/maven/plugins/svnpubsub/CommonSvnpubsubMojo.java (original)
+++ maven/sandbox/trunk/plugins/asf-svnpubsub-plugin/src/main/java/org/apache/maven/plugins/svnpubsub/CommonSvnpubsubMojo.java Sun Feb 26 17:35:51 2012
@@ -177,20 +177,22 @@ public abstract class CommonSvnpubsubMoj
// a list (ordered) to maintain sort for ease of comparison.
protected List<File> inventory;
- protected static class DotFilter implements IOFileFilter {
-
- public boolean accept( File file )
- {
- return !file.getName().startsWith( "." );
- }
-
- public boolean accept( File dir, String name )
- {
- return !name.startsWith( "." );
- }
-
+ protected static class DotFilter
+ implements IOFileFilter
+ {
+
+ public boolean accept( File file )
+ {
+ return !file.getName().startsWith( "." );
+ }
+
+ public boolean accept( File dir, String name )
+ {
+ return !name.startsWith( "." );
}
+ }
+
protected CommonSvnpubsubMojo()
{
super();
@@ -217,8 +219,8 @@ public abstract class CommonSvnpubsubMoj
throws MojoFailureException
{
inventory = new ArrayList<File>();
- inventory.addAll(FileUtils.listFiles( checkoutDirectory, new DotFilter(), new DotFilter()));
- Collections.sort(inventory);
+ inventory.addAll( FileUtils.listFiles( checkoutDirectory, new DotFilter(), new DotFilter() ) );
+ Collections.sort( inventory );
SvnpubsubInventory initialInventory = new SvnpubsubInventory();
Set<String> paths = new HashSet<String>();
@@ -251,7 +253,8 @@ public abstract class CommonSvnpubsubMoj
}
}
- protected void readInventory() throws MojoFailureException
+ protected void readInventory()
+ throws MojoFailureException
{
try
{
@@ -259,7 +262,8 @@ public abstract class CommonSvnpubsubMoj
JsonParser parser = factory.createJsonParser( inventoryFile );
SvnpubsubInventory storedInventory = parser.readValueAs( SvnpubsubInventory.class );
inventory = new ArrayList<File>();
- for (String p : storedInventory.getPaths()) {
+ for ( String p : storedInventory.getPaths() )
+ {
inventory.add( new File( p ) );
}
parser.close();
@@ -335,6 +339,4 @@ public abstract class CommonSvnpubsubMoj
}
return releaseDescriptor;
}
-
-
}
\ No newline at end of file
Modified: maven/sandbox/trunk/plugins/asf-svnpubsub-plugin/src/main/java/org/apache/maven/plugins/svnpubsub/SvnpubsubInventory.java
URL: http://svn.apache.org/viewvc/maven/sandbox/trunk/plugins/asf-svnpubsub-plugin/src/main/java/org/apache/maven/plugins/svnpubsub/SvnpubsubInventory.java?rev=1293890&r1=1293889&r2=1293890&view=diff
==============================================================================
--- maven/sandbox/trunk/plugins/asf-svnpubsub-plugin/src/main/java/org/apache/maven/plugins/svnpubsub/SvnpubsubInventory.java (original)
+++ maven/sandbox/trunk/plugins/asf-svnpubsub-plugin/src/main/java/org/apache/maven/plugins/svnpubsub/SvnpubsubInventory.java Sun Feb 26 17:35:51 2012
@@ -1,8 +1,5 @@
package org.apache.maven.plugins.svnpubsub;
-import java.util.HashSet;
-import java.util.Set;
-
/*
* Licensed to the Apache Software Foundation (ASF) under one
* or more contributor license agreements. See the NOTICE file
@@ -22,6 +19,9 @@ import java.util.Set;
* under the License.
*/
+import java.util.HashSet;
+import java.util.Set;
+
/**
* A class designed for json serialization to store the existing inventory, if any. In this version, there's no attempt
* to account for directories as managed items.
Modified: maven/sandbox/trunk/plugins/asf-svnpubsub-plugin/src/main/java/org/apache/maven/plugins/svnpubsub/SvnpubsubLifecycleMojo.java
URL: http://svn.apache.org/viewvc/maven/sandbox/trunk/plugins/asf-svnpubsub-plugin/src/main/java/org/apache/maven/plugins/svnpubsub/SvnpubsubLifecycleMojo.java?rev=1293890&r1=1293889&r2=1293890&view=diff
==============================================================================
--- maven/sandbox/trunk/plugins/asf-svnpubsub-plugin/src/main/java/org/apache/maven/plugins/svnpubsub/SvnpubsubLifecycleMojo.java (original)
+++ maven/sandbox/trunk/plugins/asf-svnpubsub-plugin/src/main/java/org/apache/maven/plugins/svnpubsub/SvnpubsubLifecycleMojo.java Sun Feb 26 17:35:51 2012
@@ -1,8 +1,5 @@
package org.apache.maven.plugins.svnpubsub;
-import org.apache.maven.plugin.MojoExecutionException;
-import org.apache.maven.plugin.MojoFailureException;
-
/*
* Licensed to the Apache Software Foundation (ASF) under one
* or more contributor license agreements. See the NOTICE file
@@ -22,13 +19,17 @@ import org.apache.maven.plugin.MojoFailu
* under the License.
*/
+import org.apache.maven.plugin.MojoExecutionException;
+import org.apache.maven.plugin.MojoFailureException;
+
/**
*
* @goal svnpubsub
* @execute lifecycle="svnpubsub" phase="svnpubsub-publish"
* @aggregate
*/
-public class SvnpubsubLifecycleMojo extends CommonSvnpubsubMojo
+public class SvnpubsubLifecycleMojo
+ extends CommonSvnpubsubMojo
{
public void execute()
Modified: maven/sandbox/trunk/plugins/asf-svnpubsub-plugin/src/main/java/org/apache/maven/plugins/svnpubsub/SvnpubsubPublishMojo.java
URL: http://svn.apache.org/viewvc/maven/sandbox/trunk/plugins/asf-svnpubsub-plugin/src/main/java/org/apache/maven/plugins/svnpubsub/SvnpubsubPublishMojo.java?rev=1293890&r1=1293889&r2=1293890&view=diff
==============================================================================
--- maven/sandbox/trunk/plugins/asf-svnpubsub-plugin/src/main/java/org/apache/maven/plugins/svnpubsub/SvnpubsubPublishMojo.java (original)
+++ maven/sandbox/trunk/plugins/asf-svnpubsub-plugin/src/main/java/org/apache/maven/plugins/svnpubsub/SvnpubsubPublishMojo.java Sun Feb 26 17:35:51 2012
@@ -74,20 +74,23 @@ public class SvnpubsubPublishMojo
*/
private String checkinComment;
- private File relativize(File base, File file)
+ private File relativize( File base, File file )
{
- return new File(base.toURI().relativize(file.toURI()).getPath());
+ return new File( base.toURI().relativize( file.toURI() ).getPath() );
}
-
- private void normalizeNewlines(File f) throws IOException {
+
+ private void normalizeNewlines( File f )
+ throws IOException
+ {
File tmpFile = null;
InputStreamReader isr = null;
OutputStreamWriter osw = null;
- try {
+ try
+ {
tmpFile = File.createTempFile( "asf-svnpubsub-", ".tmp" );
FileUtils.copyFile( f, tmpFile );
- isr = new InputStreamReader ( new FileInputStream ( tmpFile ), siteOutputEncoding );
- osw = new OutputStreamWriter ( new FileOutputStream ( f ), siteOutputEncoding );
+ isr = new InputStreamReader( new FileInputStream( tmpFile ), siteOutputEncoding );
+ osw = new OutputStreamWriter( new FileOutputStream( f ), siteOutputEncoding );
char buffer[] = new char[4096];
int nRead;
while ( ( nRead = isr.read( buffer ) ) > 0 )
@@ -96,7 +99,9 @@ public class SvnpubsubPublishMojo
content = content.replaceAll( "\r", "" );
osw.write( content );
}
- } finally {
+ }
+ finally
+ {
if ( osw != null )
{
osw.close();
@@ -208,7 +213,7 @@ public class SvnpubsubPublishMojo
Collections.sort( dirsToAdd );
- for (File relativized : dirsToAdd )
+ for ( File relativized : dirsToAdd )
{
try
{
@@ -229,9 +234,12 @@ public class SvnpubsubPublishMojo
try
{
AddScmResult addResult = scmProvider.add( scmRepository, addedFileSet, "Adding new site files." );
- if (!addResult.isSuccess()) {
- logError("add operation failed: %s", addResult.getProviderMessage() + " " + addResult.getCommandOutput());
- throw new MojoExecutionException( "Failed to add new files: " + addResult.getProviderMessage() + " " + addResult.getCommandOutput() );
+ if ( !addResult.isSuccess() )
+ {
+ logError( "add operation failed: %s",
+ addResult.getProviderMessage() + " " + addResult.getCommandOutput() );
+ throw new MojoExecutionException( "Failed to add new files: " + addResult.getProviderMessage()
+ + " " + addResult.getCommandOutput() );
}
}
catch ( ScmException e )
@@ -245,15 +253,19 @@ public class SvnpubsubPublishMojo
List<File> deletedList = new ArrayList<File>();
for ( File f : deleted )
{
- deletedList.add(relativize( checkoutDirectory, f ));
+ deletedList.add( relativize( checkoutDirectory, f ) );
}
ScmFileSet deletedFileSet = new ScmFileSet( checkoutDirectory, deletedList );
try
{
- RemoveScmResult deleteResult = scmProvider.remove( scmRepository, deletedFileSet, "Deleting obsolete site files." );
- if (!deleteResult.isSuccess()) {
- logError("delete operation failed: %s", deleteResult.getProviderMessage() + " " + deleteResult.getCommandOutput() );
- throw new MojoExecutionException( "Failed to delete files: " + deleteResult.getProviderMessage() + " " + deleteResult.getCommandOutput() );
+ RemoveScmResult deleteResult =
+ scmProvider.remove( scmRepository, deletedFileSet, "Deleting obsolete site files." );
+ if ( !deleteResult.isSuccess() )
+ {
+ logError( "delete operation failed: %s",
+ deleteResult.getProviderMessage() + " " + deleteResult.getCommandOutput() );
+ throw new MojoExecutionException( "Failed to delete files: " + deleteResult.getProviderMessage()
+ + " " + deleteResult.getCommandOutput() );
}
}
catch ( ScmException e )
@@ -284,9 +296,12 @@ public class SvnpubsubPublishMojo
try
{
CheckInScmResult checkinResult = scmProvider.checkIn( scmRepository, updatedFileSet, checkinComment );
- if (!checkinResult.isSuccess()) {
- logError("delete operation failed: %s", checkinResult.getProviderMessage() + " " + checkinResult.getCommandOutput() );
- throw new MojoExecutionException( "Failed to delete files: " + checkinResult.getProviderMessage() + " " + checkinResult.getCommandOutput() );
+ if ( !checkinResult.isSuccess() )
+ {
+ logError( "delete operation failed: %s",
+ checkinResult.getProviderMessage() + " " + checkinResult.getCommandOutput() );
+ throw new MojoExecutionException( "Failed to delete files: " + checkinResult.getProviderMessage()
+ + " " + checkinResult.getCommandOutput() );
}
}
catch ( ScmException e )
@@ -295,5 +310,4 @@ public class SvnpubsubPublishMojo
}
}
}
-
}