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,21 +33,22 @@ 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.
*/
public void setOutput(File output)
/**
* Make sure the directory structure exists and
* send the output to a specified file.
*/
public void setOutput( File output )
{
output.getParentFile().mkdirs();
try
{
setOutput(new FileOutputStream(output));
setOutput( new FileOutputStream( output ) );
}
catch (FileNotFoundException e)
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,13 +22,15 @@ 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";
String four = "four";
String five= "five";
String five = "five";
String six = "six";
String seven = "seven";
String eight = "eight";
@ -36,24 +38,26 @@ public class English {
String ten = "ten";
}
public void ten() {
public void ten()
{
String one = "one";
String two = "two";
String three = "three";
String four = "four";
String five= "five";
String five = "five";
String six = "six";
String seven = "seven";
String eight = "eight";
String nine = "nine";
}
public void nine() {
public void nine()
{
String one = "one";
String two = "two";
String three = "three";
String four = "four";
String five= "five";
String five = "five";
String six = "six";
String seven = "seven";
String eight = "eight";

View File

@ -22,13 +22,15 @@ 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";
String four = "four";
String five= "five";
String five = "five";
String six = "six";
String seven = "seven";
String eight = "eight";
@ -36,17 +38,16 @@ public class ExcludeMe {
String ten = "ten";
}
public void iShouldNotBeIncluded2() {
public void iShouldNotBeIncluded2()
{
String one = "one";
String two = "two";
String three = "three";
String four = "four";
String five= "five";
String five = "five";
String six = "six";
String seven = "seven";
String eight = "eight";
String nine = "nine";
}
}

View File

@ -17,36 +17,47 @@ 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.
*
* @return the root directory or jar file where the class is located.
*/
public static File getRoot(Class clazz)
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) != '/' ) {
classFile = "file:/" + classFile.substring(5);
if ( classFile.charAt( 5 ) != '/' )
{
classFile = "file:/" + classFile.substring( 5 );
}
classFile = classFile.replace( '\\','/' );
String uriSpec = classFile.substring(0, classFile.indexOf('!'));
dir = new File( uriSpec );
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,41 +22,44 @@ 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";
String four = "four";
String five= "five";
String five = "five";
String six = "six";
String seven = "seven";
String eight = "eight";
}
public void dix() {
public void dix()
{
String one = "one";
String two = "two";
String three = "three";
String four = "four";
String five= "five";
String five = "five";
String six = "six";
String seven = "seven";
String eight = "eight";
String nine = "nine";
}
public void onze() {
public void onze()
{
String one = "one";
String two = "two";
String three = "three";
String four = "four";
String five= "five";
String five = "five";
String six = "six";
String seven = "seven";
String eight = "eight";
String nine = "nine";
String ten = "ten";
}
}