Source code formatting

git-svn-id: https://svn.apache.org/repos/asf/maven/maven-1/plugins/trunk@371231 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
ltheussl 2006-01-22 08:04:40 +00:00
parent 4f0f18c47f
commit 27aef76501
5 changed files with 73 additions and 50 deletions

View File

@ -19,12 +19,11 @@ package org.apache.maven.simian;
import au.com.redhillconsulting.simian.SimianTask;
import java.io.File;
import java.io.FileOutputStream;
import java.io.FileNotFoundException;
import org.apache.tools.ant.BuildException;
import java.io.File;
import java.io.FileNotFoundException;
import java.io.FileOutputStream;
/**
* Simian Task that writes the output to a file.
@ -34,7 +33,6 @@ import org.apache.tools.ant.BuildException;
*/
public class FileSimianTask extends SimianTask
{
/**
* Make sure the directory structure exists and
* send the output to a specified file.
@ -42,13 +40,15 @@ public class FileSimianTask extends SimianTask
public void setOutput( File output )
{
output.getParentFile().mkdirs();
try
{
setOutput( new FileOutputStream( output ) );
}
catch ( FileNotFoundException e )
{
throw new BuildException("Couldn't set output to " + output.getAbsolutePath(), e);
throw new BuildException( "Couldn't set output to "
+ output.getAbsolutePath(), e );
}
}
}

View File

@ -22,8 +22,10 @@ package org.apache.maven.simian;
* @author Aslak Hellesoy
* @version $Revision$
*/
public class English {
public void eleven() {
public class English
{
public void eleven()
{
String one = "one";
String two = "two";
String three = "three";
@ -36,7 +38,8 @@ public class English {
String ten = "ten";
}
public void ten() {
public void ten()
{
String one = "one";
String two = "two";
String three = "three";
@ -48,7 +51,8 @@ public class English {
String nine = "nine";
}
public void nine() {
public void nine()
{
String one = "one";
String two = "two";
String three = "three";

View File

@ -22,8 +22,10 @@ package org.apache.maven.simian;
* @author Eric Pugh
* @version $Revision: 170200 $
*/
public class ExcludeMe {
public void iShouldNotBeIncluded() {
public class ExcludeMe
{
public void iShouldNotBeIncluded()
{
String one = "one";
String two = "two";
String three = "three";
@ -36,7 +38,8 @@ public class ExcludeMe {
String ten = "ten";
}
public void iShouldNotBeIncluded2() {
public void iShouldNotBeIncluded2()
{
String one = "one";
String two = "two";
String three = "three";
@ -47,6 +50,4 @@ public class ExcludeMe {
String eight = "eight";
String nine = "nine";
}
}

View File

@ -17,16 +17,19 @@ package org.apache.maven.simian;
* ====================================================================
*/
import java.util.StringTokenizer;
import java.io.File;
import java.net.URL;
import java.util.StringTokenizer;
/**
*
* @author Aslak Hellesoy
* @version $Revision$
*/
public class FileUtils {
public class FileUtils
{
/**
* Returns the root directory of the package hierarchy where this class is
* located. This will either be a directory or a jar file.
@ -36,17 +39,25 @@ public class FileUtils {
public static File getRoot( Class clazz )
{
File dir;
URL classURL = clazz.getResource( "/" + clazz.getName().replace( '.', '/' ) + ".class" );
URL classURL =
clazz.getResource( "/" + clazz.getName().replace( '.', '/' )
+ ".class" );
String classFile = classURL.getFile();
if( classFile.indexOf('!') != -1 ) {
if ( classFile.indexOf( '!' ) != -1 )
{
// Sometimes (at least on windows) we get file:F:\bla. Convert to file:/F:/bla
if( classFile.charAt(5) != '/' ) {
if ( classFile.charAt( 5 ) != '/' )
{
classFile = "file:/" + classFile.substring( 5 );
}
classFile = classFile.replace( '\\', '/' );
String uriSpec = classFile.substring( 0, classFile.indexOf( '!' ) );
dir = new File( uriSpec );
// NOTE: This used to be here, but I've replaced it with the above single
// line without understanding the ramifications. The code below needs JDK1.4
//try {
@ -55,15 +66,19 @@ public class FileUtils {
// System.err.println("Couldn't create URI for " + uriSpec);
// throw new IllegalStateException(e.getMessage());
//}
} else {
}
else
{
dir = new File( classFile ).getParentFile();
StringTokenizer st = new StringTokenizer( clazz.getName(), "." );
for( int i = 0; i < st.countTokens() - 1; i++ )
for ( int i = 0; i < ( st.countTokens() - 1 ); i++ )
{
dir = dir.getParentFile();
}
}
return dir;
}
}

View File

@ -22,8 +22,10 @@ package org.apache.maven.simian;
* @author Aslak Hellesoy
* @version $Revision$
*/
public class Francais {
public void neuf() {
public class Francais
{
public void neuf()
{
String one = "one";
String two = "two";
String three = "three";
@ -34,7 +36,8 @@ public class Francais {
String eight = "eight";
}
public void dix() {
public void dix()
{
String one = "one";
String two = "two";
String three = "three";
@ -46,7 +49,8 @@ public class Francais {
String nine = "nine";
}
public void onze() {
public void onze()
{
String one = "one";
String two = "two";
String three = "three";
@ -58,5 +62,4 @@ public class Francais {
String nine = "nine";
String ten = "ten";
}
}