From 27aef7650188bb2c40ea5608b11b5be7caa08b70 Mon Sep 17 00:00:00 2001 From: ltheussl Date: Sun, 22 Jan 2006 08:04:40 +0000 Subject: [PATCH] Source code formatting git-svn-id: https://svn.apache.org/repos/asf/maven/maven-1/plugins/trunk@371231 13f79535-47bb-0310-9956-ffa450edef68 --- .../apache/maven/simian/FileSimianTask.java | 32 +++++++-------- .../test/org/apache/maven/simian/English.java | 18 +++++---- .../org/apache/maven/simian/ExcludeMe.java | 15 +++---- .../org/apache/maven/simian/FileUtils.java | 39 +++++++++++++------ .../org/apache/maven/simian/Francais.java | 19 +++++---- 5 files changed, 73 insertions(+), 50 deletions(-) diff --git a/simian/src/main/org/apache/maven/simian/FileSimianTask.java b/simian/src/main/org/apache/maven/simian/FileSimianTask.java index 04821a0a..aae0dd2c 100644 --- a/simian/src/main/org/apache/maven/simian/FileSimianTask.java +++ b/simian/src/main/org/apache/maven/simian/FileSimianTask.java @@ -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. @@ -32,23 +31,24 @@ import org.apache.tools.ant.BuildException; * @author Aslak Hellesoy * @version $Revision$ */ -public class FileSimianTask extends SimianTask +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 + + try { - setOutput(new FileOutputStream(output)); - } - catch (FileNotFoundException e) + 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 ); } } } diff --git a/simian/src/test/org/apache/maven/simian/English.java b/simian/src/test/org/apache/maven/simian/English.java index 1b3e64a1..357156b7 100644 --- a/simian/src/test/org/apache/maven/simian/English.java +++ b/simian/src/test/org/apache/maven/simian/English.java @@ -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"; diff --git a/simian/src/test/org/apache/maven/simian/ExcludeMe.java b/simian/src/test/org/apache/maven/simian/ExcludeMe.java index 38592ff5..835233da 100644 --- a/simian/src/test/org/apache/maven/simian/ExcludeMe.java +++ b/simian/src/test/org/apache/maven/simian/ExcludeMe.java @@ -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"; } - - } diff --git a/simian/src/test/org/apache/maven/simian/FileUtils.java b/simian/src/test/org/apache/maven/simian/FileUtils.java index 5b698d1d..5acf293f 100644 --- a/simian/src/test/org/apache/maven/simian/FileUtils.java +++ b/simian/src/test/org/apache/maven/simian/FileUtils.java @@ -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; } } diff --git a/simian/src/test/org/apache/maven/simian/Francais.java b/simian/src/test/org/apache/maven/simian/Francais.java index a7453cc7..7935d3ee 100644 --- a/simian/src/test/org/apache/maven/simian/Francais.java +++ b/simian/src/test/org/apache/maven/simian/Francais.java @@ -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"; } - }