Author: xavier
Date: Sun Mar 2 01:33:32 2008
New Revision: 632728
URL: http://svn.apache.org/viewvc?rev=632728&view=rev
Log:
checkstyle fix in examples
Modified:
ant/ivy/core/trunk/src/example/chained-resolvers/chainedresolvers-project/src/example/Hello.java
ant/ivy/core/trunk/src/example/configurations/jdbc-example/src/example/ConfigurationsExample.java
ant/ivy/core/trunk/src/example/configurations/multi-projects/filter-framework/src/filter/FilterProvider.java
ant/ivy/core/trunk/src/example/configurations/multi-projects/filter-framework/src/filter/ccimpl/CCFilter.java
ant/ivy/core/trunk/src/example/configurations/multi-projects/filter-framework/src/filter/hmimpl/HMFilter.java
ant/ivy/core/trunk/src/example/configurations/multi-projects/filter-framework/test/filter/AbstractTestFilter.java
ant/ivy/core/trunk/src/example/configurations/multi-projects/myapp/src/myapp/Main.java
ant/ivy/core/trunk/src/example/dependence/dependee/src/standalone/Main.java
ant/ivy/core/trunk/src/example/dependence/depender/src/depending/Main.java
ant/ivy/core/trunk/src/example/dual/project/src/example/Hello.java
ant/ivy/core/trunk/src/example/hello-ivy/src/example/Hello.java
ant/ivy/core/trunk/src/example/multi-project/projects/console/src/console/Main.java
ant/ivy/core/trunk/src/example/multi-project/projects/find/src/find/FindFile.java
ant/ivy/core/trunk/src/example/multi-project/projects/find/src/find/Main.java
ant/ivy/core/trunk/src/example/multi-project/projects/list/src/list/ListFile.java
ant/ivy/core/trunk/src/example/multi-project/projects/list/src/list/Main.java
ant/ivy/core/trunk/src/example/multi-project/projects/size/src/size/FileSize.java
ant/ivy/core/trunk/src/example/multi-project/projects/sizewhere/src/sizewhere/Main.java
ant/ivy/core/trunk/src/example/multi-project/projects/sizewhere/src/sizewhere/SizeWhere.java
ant/ivy/core/trunk/src/example/multi-project/projects/version/src/version/Version.java
Modified:
ant/ivy/core/trunk/src/example/chained-resolvers/chainedresolvers-project/src/example/Hello.java
URL:
http://svn.apache.org/viewvc/ant/ivy/core/trunk/src/example/chained-resolvers/chainedresolvers-project/src/example/Hello.java?rev=632728&r1=632727&r2=632728&view=diff
==============================================================================
---
ant/ivy/core/trunk/src/example/chained-resolvers/chainedresolvers-project/src/example/Hello.java
(original)
+++
ant/ivy/core/trunk/src/example/chained-resolvers/chainedresolvers-project/src/example/Hello.java
Sun Mar 2 01:33:32 2008
@@ -22,11 +22,16 @@
/**
* Simple example world to show how easy it is to retreive libs with ivy !!!
*/
-public class Hello {
+public final class Hello {
public static void main(String[] args) {
String message = "example world !";
System.out.println("standard message :" + message);
- System.out.println("capitalized by " + WordUtils.class.getName() + " :
" + WordUtils.capitalizeFully(message));
- System.out.println("upperCased by " + test.StringUtils.class.getName()
+ " : " + test.StringUtils.upperCase(message));
+ System.out.println("capitalized by " + WordUtils.class.getName()
+ + " : " + WordUtils.capitalizeFully(message));
+ System.out.println("upperCased by " + test.StringUtils.class.getName()
+ + " : " + test.StringUtils.upperCase(message));
+ }
+
+ private Hello() {
}
}
Modified:
ant/ivy/core/trunk/src/example/configurations/jdbc-example/src/example/ConfigurationsExample.java
URL:
http://svn.apache.org/viewvc/ant/ivy/core/trunk/src/example/configurations/jdbc-example/src/example/ConfigurationsExample.java?rev=632728&r1=632727&r2=632728&view=diff
==============================================================================
---
ant/ivy/core/trunk/src/example/configurations/jdbc-example/src/example/ConfigurationsExample.java
(original)
+++
ant/ivy/core/trunk/src/example/configurations/jdbc-example/src/example/ConfigurationsExample.java
Sun Mar 2 01:33:32 2008
@@ -25,37 +25,40 @@
import org.apache.commons.cli.ParseException;
import org.apache.commons.cli.PosixParser;
-public class ConfigurationsExample {
+public final class ConfigurationsExample {
public static void main(String[] args) {
String jdbcPropToLoad = "prod.properties";
CommandLineParser parser = new PosixParser();
Options options = new Options();
- options.addOption("d", "dev", false, "Dev tag to launch app in dev
mode. Means that app will launch embedded mckoi db.");
+ options.addOption("d", "dev", false,
+ "Dev tag to launch app in dev mode. Means that app will launch
embedded mckoi db.");
try {
- CommandLine line = parser.parse( options, args );
- if(line.hasOption("d")) {
+ CommandLine line = parser.parse(options, args);
+ if (line.hasOption("d")) {
System.err.println("App is in DEV mode");
jdbcPropToLoad = "dev.properties";
}
- }
- catch( ParseException exp ) {
- System.err.println( "Parsing failed. Reason: " + exp.getMessage()
);
+ } catch (ParseException exp) {
+ System.err.println("Parsing failed. Reason: " + exp.getMessage());
}
Properties p = new Properties();
try {
-
p.load(ConfigurationsExample.class.getResourceAsStream("/"+jdbcPropToLoad));
+ p.load(ConfigurationsExample.class.getResourceAsStream("/" +
jdbcPropToLoad));
} catch (IOException e) {
- System.err.println( "Properties loading failed. Reason: " +
e.getMessage());
+ System.err.println("Properties loading failed. Reason: " +
e.getMessage());
}
try {
String clazz = p.getProperty("driver.class");
Class.forName(clazz);
- System.out.println(" Jdbc driver loaded :"+clazz);
+ System.out.println(" Jdbc driver loaded :" + clazz);
} catch (ClassNotFoundException e) {
- System.err.println( "Jdbc Driver class loading failed. Reason: "
+ e.getMessage());
+ System.err.println("Jdbc Driver class loading failed. Reason: " +
e.getMessage());
e.printStackTrace();
}
+ }
+
+ private ConfigurationsExample() {
}
}
Modified:
ant/ivy/core/trunk/src/example/configurations/multi-projects/filter-framework/src/filter/FilterProvider.java
URL:
http://svn.apache.org/viewvc/ant/ivy/core/trunk/src/example/configurations/multi-projects/filter-framework/src/filter/FilterProvider.java?rev=632728&r1=632727&r2=632728&view=diff
==============================================================================
---
ant/ivy/core/trunk/src/example/configurations/multi-projects/filter-framework/src/filter/FilterProvider.java
(original)
+++
ant/ivy/core/trunk/src/example/configurations/multi-projects/filter-framework/src/filter/FilterProvider.java
Sun Mar 2 01:33:32 2008
@@ -18,7 +18,7 @@
package filter;
-public class FilterProvider {
+public final class FilterProvider {
public static IFilter getFilter() {
try {
@@ -33,5 +33,8 @@
}
return null;
}
+ }
+
+ private FilterProvider() {
}
}
Modified:
ant/ivy/core/trunk/src/example/configurations/multi-projects/filter-framework/src/filter/ccimpl/CCFilter.java
URL:
http://svn.apache.org/viewvc/ant/ivy/core/trunk/src/example/configurations/multi-projects/filter-framework/src/filter/ccimpl/CCFilter.java?rev=632728&r1=632727&r2=632728&view=diff
==============================================================================
---
ant/ivy/core/trunk/src/example/configurations/multi-projects/filter-framework/src/filter/ccimpl/CCFilter.java
(original)
+++
ant/ivy/core/trunk/src/example/configurations/multi-projects/filter-framework/src/filter/ccimpl/CCFilter.java
Sun Mar 2 01:33:32 2008
@@ -27,17 +27,17 @@
public class CCFilter implements IFilter {
public String[] filter(String[] values, final String prefix) {
- if(values == null) {
+ if (values == null) {
return null;
}
- if(prefix == null) {
+ if (prefix == null) {
return values;
}
List result = new ArrayList(Arrays.asList(values));
CollectionUtils.filter(result, new Predicate() {
public boolean evaluate(Object o) {
- return o!= null && o.toString().startsWith(prefix);
+ return o != null && o.toString().startsWith(prefix);
}
});
return (String[]) result.toArray(new String[result.size()]);
Modified:
ant/ivy/core/trunk/src/example/configurations/multi-projects/filter-framework/src/filter/hmimpl/HMFilter.java
URL:
http://svn.apache.org/viewvc/ant/ivy/core/trunk/src/example/configurations/multi-projects/filter-framework/src/filter/hmimpl/HMFilter.java?rev=632728&r1=632727&r2=632728&view=diff
==============================================================================
---
ant/ivy/core/trunk/src/example/configurations/multi-projects/filter-framework/src/filter/hmimpl/HMFilter.java
(original)
+++
ant/ivy/core/trunk/src/example/configurations/multi-projects/filter-framework/src/filter/hmimpl/HMFilter.java
Sun Mar 2 01:33:32 2008
@@ -24,16 +24,16 @@
public class HMFilter implements IFilter {
public String[] filter(String[] values, String prefix) {
- if(values == null) {
+ if (values == null) {
return null;
}
- if(prefix == null) {
+ if (prefix == null) {
return values;
}
List result = new ArrayList();
for (int i = 0; i < values.length; i++) {
String string = values[i];
- if(string != null && string.startsWith(prefix)) {
+ if (string != null && string.startsWith(prefix)) {
result.add(string);
}
}
Modified:
ant/ivy/core/trunk/src/example/configurations/multi-projects/filter-framework/test/filter/AbstractTestFilter.java
URL:
http://svn.apache.org/viewvc/ant/ivy/core/trunk/src/example/configurations/multi-projects/filter-framework/test/filter/AbstractTestFilter.java?rev=632728&r1=632727&r2=632728&view=diff
==============================================================================
---
ant/ivy/core/trunk/src/example/configurations/multi-projects/filter-framework/test/filter/AbstractTestFilter.java
(original)
+++
ant/ivy/core/trunk/src/example/configurations/multi-projects/filter-framework/test/filter/AbstractTestFilter.java
Sun Mar 2 01:33:32 2008
@@ -34,7 +34,7 @@
/**
* @return
*/
- public abstract IFilter getIFilter() ;
+ public abstract IFilter getIFilter();
public void testFilterNullValues() {
Exception err = null;
@@ -57,7 +57,8 @@
}
public void testFilter() {
- String[] result = getIFilter().filter(new String[]{"test", "nogood",
"mustbe filtered"}, "t");
+ String[] result = getIFilter().filter(
+ new String[]{"test", "nogood", "mustbe filtered"}, "t");
assertNotNull(result);
assertEquals(result.length, 1);
}
Modified:
ant/ivy/core/trunk/src/example/configurations/multi-projects/myapp/src/myapp/Main.java
URL:
http://svn.apache.org/viewvc/ant/ivy/core/trunk/src/example/configurations/multi-projects/myapp/src/myapp/Main.java?rev=632728&r1=632727&r2=632728&view=diff
==============================================================================
---
ant/ivy/core/trunk/src/example/configurations/multi-projects/myapp/src/myapp/Main.java
(original)
+++
ant/ivy/core/trunk/src/example/configurations/multi-projects/myapp/src/myapp/Main.java
Sun Mar 2 01:33:32 2008
@@ -21,13 +21,16 @@
import filter.FilterProvider;
import filter.IFilter;
-public class Main {
+public final class Main {
public static void main(String[] args) {
- String[] toFilter = new String[]{"one", "two", "tree", "four"};
+ String[] toFilter = new String[] {"one", "two", "tree", "four"};
IFilter filter = FilterProvider.getFilter();
- System.out.println("Filtering with:"+filter.getClass());
+ System.out.println("Filtering with:" + filter.getClass());
String[] filtered = filter.filter(toFilter, "t");
- System.out.println("Result :"+Arrays.asList(filtered));
+ System.out.println("Result :" + Arrays.asList(filtered));
+ }
+
+ private Main() {
}
}
Modified:
ant/ivy/core/trunk/src/example/dependence/dependee/src/standalone/Main.java
URL:
http://svn.apache.org/viewvc/ant/ivy/core/trunk/src/example/dependence/dependee/src/standalone/Main.java?rev=632728&r1=632727&r2=632728&view=diff
==============================================================================
--- ant/ivy/core/trunk/src/example/dependence/dependee/src/standalone/Main.java
(original)
+++ ant/ivy/core/trunk/src/example/dependence/dependee/src/standalone/Main.java
Sun Mar 2 01:33:32 2008
@@ -24,7 +24,7 @@
/**
* TODO write javadoc
*/
-public class Main {
+public final class Main {
/**
* Returns the version of the project
* @return a string representation of the version, null if the version
could not be retreived
@@ -49,12 +49,16 @@
* @return null if the string was null, the string with all words
capitalized otherwise
*/
public static String capitalizeWords(String str) {
- System.out.println(" [" + Main.class.getName() + "] capitalizing
string \"" + str + "\" using " + WordUtils.class.getName());
+ System.out.println(" [" + Main.class.getName() + "] capitalizing
string \""
+ + str + "\" using " + WordUtils.class.getName());
return WordUtils.capitalizeFully(str);
}
public static void main(String[] args) {
- String message="sentence to capitalize";
+ String message = "sentence to capitalize";
System.out.println("standard message : " + message);
System.out.println("capitalized message : " +
capitalizeWords(message));
+ }
+
+ private Main() {
}
}
Modified:
ant/ivy/core/trunk/src/example/dependence/depender/src/depending/Main.java
URL:
http://svn.apache.org/viewvc/ant/ivy/core/trunk/src/example/dependence/depender/src/depending/Main.java?rev=632728&r1=632727&r2=632728&view=diff
==============================================================================
--- ant/ivy/core/trunk/src/example/dependence/depender/src/depending/Main.java
(original)
+++ ant/ivy/core/trunk/src/example/dependence/depender/src/depending/Main.java
Sun Mar 2 01:33:32 2008
@@ -20,16 +20,21 @@
/**
* TODO write javadoc
*/
-public class Main {
+public final class Main {
public static void main(String[] args) {
String standaloneVersion = standalone.Main.getVersion();
- if (standaloneVersion!=null) {
- System.out.println("you are using version " + standaloneVersion +
" of class " + standalone.Main.class.getName());
+ if (standaloneVersion != null) {
+ System.out.println("you are using version " + standaloneVersion
+ + " of class " + standalone.Main.class.getName());
} else {
System.err.println("failed to get version of " +
standalone.Main.class.getName());
}
- String message = "i am " + Main.class.getName() + " and " +
standalone.Main.class.getName() + " will do the job for me";
+ String message = "i am " + Main.class.getName()
+ + " and " + standalone.Main.class.getName() + " will do the job
for me";
System.out.println("standard message : " + message);
System.out.println("capitalized message : " +
standalone.Main.capitalizeWords(message));
+ }
+
+ private Main() {
}
}
Modified: ant/ivy/core/trunk/src/example/dual/project/src/example/Hello.java
URL:
http://svn.apache.org/viewvc/ant/ivy/core/trunk/src/example/dual/project/src/example/Hello.java?rev=632728&r1=632727&r2=632728&view=diff
==============================================================================
--- ant/ivy/core/trunk/src/example/dual/project/src/example/Hello.java
(original)
+++ ant/ivy/core/trunk/src/example/dual/project/src/example/Hello.java Sun Mar
2 01:33:32 2008
@@ -17,10 +17,7 @@
*/
package example;
-import java.io.IOException;
-
import org.apache.commons.httpclient.HttpClient;
-import org.apache.commons.httpclient.HttpException;
import org.apache.commons.httpclient.methods.HeadMethod;
import org.apache.commons.lang.WordUtils;
@@ -28,22 +25,27 @@
* Simple hello world example to show how easy it is to retrieve libs with
ivy,
* including transitive dependencies
*/
-public class Hello {
+public final class Hello {
public static void main(String[] args) throws Exception {
String message = "hello ivy !";
System.out.println("standard message : " + message);
- System.out.println("capitalized by " + WordUtils.class.getName() + " :
" + WordUtils.capitalizeFully(message));
+ System.out.println("capitalized by " + WordUtils.class.getName()
+ + " : " + WordUtils.capitalizeFully(message));
HttpClient client = new HttpClient();
HeadMethod head = new HeadMethod("http://www.ibiblio.org/");
client.executeMethod(head);
int status = head.getStatusCode();
- System.out.println("head status code with httpclient: "+status);
+ System.out.println("head status code with httpclient: " + status);
head.releaseConnection();
- System.out.println("now check if httpclient dependency on
commons-logging has been realized");
+ System.out.println(
+ "now check if httpclient dependency on commons-logging has been
realized");
Class clss = Class.forName("org.apache.commons.logging.Log");
- System.out.println("found logging class in classpath: "+clss);
+ System.out.println("found logging class in classpath: " + clss);
+ }
+
+ private Hello() {
}
}
Modified: ant/ivy/core/trunk/src/example/hello-ivy/src/example/Hello.java
URL:
http://svn.apache.org/viewvc/ant/ivy/core/trunk/src/example/hello-ivy/src/example/Hello.java?rev=632728&r1=632727&r2=632728&view=diff
==============================================================================
--- ant/ivy/core/trunk/src/example/hello-ivy/src/example/Hello.java (original)
+++ ant/ivy/core/trunk/src/example/hello-ivy/src/example/Hello.java Sun Mar 2
01:33:32 2008
@@ -28,20 +28,24 @@
/**
* Simple example to show how easy it is to retrieve transitive libs with ivy
!!!
*/
-public class Hello {
+public final class Hello {
public static void main(String[] args) throws Exception {
- Option msg = OptionBuilder.withArgName( "msg" )
- .hasArg()
- .withDescription( "the message to capitalize" )
- .create( "message" );
+ Option msg = OptionBuilder.withArgName("msg")
+ .hasArg()
+ .withDescription("the message to capitalize")
+ .create("message");
Options options = new Options();
options.addOption(msg);
CommandLineParser parser = new GnuParser();
- CommandLine line = parser.parse( options, args );
+ CommandLine line = parser.parse(options, args);
String message = line.getOptionValue("message", "hello ivy !");
System.out.println("standard message : " + message);
- System.out.println("capitalized by " + WordUtils.class.getName() + " :
" + WordUtils.capitalizeFully(message));
+ System.out.println("capitalized by " + WordUtils.class.getName()
+ + " : " + WordUtils.capitalizeFully(message));
+ }
+
+ private Hello() {
}
}
Modified:
ant/ivy/core/trunk/src/example/multi-project/projects/console/src/console/Main.java
URL:
http://svn.apache.org/viewvc/ant/ivy/core/trunk/src/example/multi-project/projects/console/src/console/Main.java?rev=632728&r1=632727&r2=632728&view=diff
==============================================================================
---
ant/ivy/core/trunk/src/example/multi-project/projects/console/src/console/Main.java
(original)
+++
ant/ivy/core/trunk/src/example/multi-project/projects/console/src/console/Main.java
Sun Mar 2 01:33:32 2008
@@ -24,9 +24,11 @@
import java.lang.reflect.Method;
-public class Main {
- private static Collection QUIT_COMMANDS = Arrays.asList(new String[]
{"quit", "q", "exit"});
- private static Collection HELP_COMMANDS = Arrays.asList(new String[]
{"help", "h", "?"});
+public final class Main {
+ private static final Collection QUIT_COMMANDS =
+ Arrays.asList(new String[] {"quit", "q", "exit"});
+ private static final Collection HELP_COMMANDS =
+ Arrays.asList(new String[] {"help", "h", "?"});
public static void main(String[] a) throws Exception {
BufferedReader in = new BufferedReader(new InputStreamReader(System.in));
@@ -49,7 +51,7 @@
try {
String[] args = new String[split.length - 1];
System.arraycopy(split, 1, args, 0, args.length);
- Class cl = Class.forName(split[0]+".Main");
+ Class cl = Class.forName(split[0] + ".Main");
Method m = cl.getMethod("main", new Class[] {String[].class});
m.invoke(null, new Object[] {args});
} catch (Exception ex) {
@@ -65,13 +67,16 @@
System.out.println("\thelp: displays this message");
System.out.println("\tlist -dir <dir>: list files in given directory");
System.out.println("\tfind -dir <dir> -name <name>: list files with
given name in given dir");
- System.out.println("\tsizewhere -dir <dir> -name <name>: compute total
size of files with given name in given dir");
+ System.out.println("\tsizewhere -dir <dir> -name <name>: "
+ + "compute total size of files with given name in given dir");
System.out.println("\thelp: displays this message");
}
private static void error(String command) {
- System.out.println("unknown command "+command);
+ System.out.println("unknown command " + command);
System.out.println("type ? for help");
}
-
+
+ private Main() {
+ }
}
Modified:
ant/ivy/core/trunk/src/example/multi-project/projects/find/src/find/FindFile.java
URL:
http://svn.apache.org/viewvc/ant/ivy/core/trunk/src/example/multi-project/projects/find/src/find/FindFile.java?rev=632728&r1=632727&r2=632728&view=diff
==============================================================================
---
ant/ivy/core/trunk/src/example/multi-project/projects/find/src/find/FindFile.java
(original)
+++
ant/ivy/core/trunk/src/example/multi-project/projects/find/src/find/FindFile.java
Sun Mar 2 01:33:32 2008
@@ -21,13 +21,12 @@
import list.ListFile;
import java.util.Collection;
-import java.util.ArrayList;
import java.io.File;
import org.apache.commons.collections.CollectionUtils;
import org.apache.commons.collections.Predicate;
-public class FindFile {
+public final class FindFile {
static {
Version.register("find");
}
@@ -39,8 +38,11 @@
private static Collection find(Collection files, final String name) {
return CollectionUtils.select(files, new Predicate() {
public boolean evaluate(Object o) {
- return ((File)o).getName().indexOf(name) != -1;
+ return ((File) o).getName().indexOf(name) != -1;
}
});
+ }
+
+ private FindFile() {
}
}
Modified:
ant/ivy/core/trunk/src/example/multi-project/projects/find/src/find/Main.java
URL:
http://svn.apache.org/viewvc/ant/ivy/core/trunk/src/example/multi-project/projects/find/src/find/Main.java?rev=632728&r1=632727&r2=632728&view=diff
==============================================================================
---
ant/ivy/core/trunk/src/example/multi-project/projects/find/src/find/Main.java
(original)
+++
ant/ivy/core/trunk/src/example/multi-project/projects/find/src/find/Main.java
Sun Mar 2 01:33:32 2008
@@ -30,7 +30,7 @@
import org.apache.commons.cli.Options;
import org.apache.commons.cli.ParseException;
-public class Main {
+public final class Main {
private static Options getOptions() {
Option dir = OptionBuilder.withArgName("dir")
.hasArg()
@@ -62,7 +62,7 @@
for (Iterator it = files.iterator(); it.hasNext();) {
System.out.println("\t" + it.next() + "\n");
}
- } catch(ParseException exp) {
+ } catch (ParseException exp) {
// oops, something went wrong
System.err.println("Parsing failed. Reason: " + exp.getMessage());
@@ -70,5 +70,7 @@
formatter.printHelp("find", options);
}
}
-
+
+ private Main() {
+ }
}
Modified:
ant/ivy/core/trunk/src/example/multi-project/projects/list/src/list/ListFile.java
URL:
http://svn.apache.org/viewvc/ant/ivy/core/trunk/src/example/multi-project/projects/list/src/list/ListFile.java?rev=632728&r1=632727&r2=632728&view=diff
==============================================================================
---
ant/ivy/core/trunk/src/example/multi-project/projects/list/src/list/ListFile.java
(original)
+++
ant/ivy/core/trunk/src/example/multi-project/projects/list/src/list/ListFile.java
Sun Mar 2 01:33:32 2008
@@ -22,7 +22,7 @@
import java.util.ArrayList;
import java.io.File;
-public class ListFile {
+public final class ListFile {
static {
Version.register("list");
}
@@ -36,12 +36,15 @@
private static Collection list(File file, Collection files) {
if (file.isDirectory()) {
File[] f = file.listFiles();
- for (int i=0; i<f.length; i++) {
+ for (int i = 0; i < f.length; i++) {
list(f[i], files);
}
} else {
files.add(file);
}
return files;
+ }
+
+ private ListFile() {
}
}
Modified:
ant/ivy/core/trunk/src/example/multi-project/projects/list/src/list/Main.java
URL:
http://svn.apache.org/viewvc/ant/ivy/core/trunk/src/example/multi-project/projects/list/src/list/Main.java?rev=632728&r1=632727&r2=632728&view=diff
==============================================================================
---
ant/ivy/core/trunk/src/example/multi-project/projects/list/src/list/Main.java
(original)
+++
ant/ivy/core/trunk/src/example/multi-project/projects/list/src/list/Main.java
Sun Mar 2 01:33:32 2008
@@ -30,12 +30,12 @@
import org.apache.commons.cli.Options;
import org.apache.commons.cli.ParseException;
-public class Main {
+public final class Main {
private static Options getOptions() {
- Option dir = OptionBuilder.withArgName( "dir" )
+ Option dir = OptionBuilder.withArgName("dir")
.hasArg()
- .withDescription( "list files in given dir" )
- .create( "dir" );
+ .withDescription("list files in given dir")
+ .create("dir");
Options options = new Options();
options.addOption(dir);
@@ -49,20 +49,23 @@
CommandLineParser parser = new GnuParser();
- CommandLine line = parser.parse( options, args );
+ CommandLine line = parser.parse(options, args);
File dir = new File(line.getOptionValue("dir", "."));
Collection files = ListFile.list(dir);
- System.out.println("listing files in "+dir);
- for (Iterator it = files.iterator(); it.hasNext(); ) {
- System.out.println("\t"+it.next()+"\n");
+ System.out.println("listing files in " + dir);
+ for (Iterator it = files.iterator(); it.hasNext();) {
+ System.out.println("\t" + it.next() + "\n");
}
- } catch( ParseException exp ) {
+ } catch (ParseException exp) {
// oops, something went wrong
- System.err.println( "Parsing failed. Reason: " + exp.getMessage() );
+ System.err.println("Parsing failed. Reason: " + exp.getMessage());
HelpFormatter formatter = new HelpFormatter();
- formatter.printHelp( "list", options );
+ formatter.printHelp("list", options);
}
+ }
+
+ private Main() {
}
}
Modified:
ant/ivy/core/trunk/src/example/multi-project/projects/size/src/size/FileSize.java
URL:
http://svn.apache.org/viewvc/ant/ivy/core/trunk/src/example/multi-project/projects/size/src/size/FileSize.java?rev=632728&r1=632727&r2=632728&view=diff
==============================================================================
---
ant/ivy/core/trunk/src/example/multi-project/projects/size/src/size/FileSize.java
(original)
+++
ant/ivy/core/trunk/src/example/multi-project/projects/size/src/size/FileSize.java
Sun Mar 2 01:33:32 2008
@@ -22,7 +22,7 @@
import java.util.Iterator;
import java.io.File;
-public class FileSize {
+public final class FileSize {
static {
Version.register("size");
}
@@ -33,10 +33,13 @@
public static long totalSize(Collection files) {
long total = 0;
- for (Iterator it = files.iterator(); it.hasNext(); ) {
- File f = (File)it.next();
+ for (Iterator it = files.iterator(); it.hasNext();) {
+ File f = (File) it.next();
total += f.length();
}
return total;
}
+
+ private FileSize() {
+ }
}
Modified:
ant/ivy/core/trunk/src/example/multi-project/projects/sizewhere/src/sizewhere/Main.java
URL:
http://svn.apache.org/viewvc/ant/ivy/core/trunk/src/example/multi-project/projects/sizewhere/src/sizewhere/Main.java?rev=632728&r1=632727&r2=632728&view=diff
==============================================================================
---
ant/ivy/core/trunk/src/example/multi-project/projects/sizewhere/src/sizewhere/Main.java
(original)
+++
ant/ivy/core/trunk/src/example/multi-project/projects/sizewhere/src/sizewhere/Main.java
Sun Mar 2 01:33:32 2008
@@ -28,16 +28,16 @@
import org.apache.commons.cli.Options;
import org.apache.commons.cli.ParseException;
-public class Main {
+public final class Main {
private static Options getOptions() {
- Option dir = OptionBuilder.withArgName( "dir" )
+ Option dir = OptionBuilder.withArgName("dir")
.hasArg()
- .withDescription( "give total size of files in given dir" )
- .create( "dir" );
- Option name = OptionBuilder.withArgName( "name" )
+ .withDescription("give total size of files in given dir")
+ .create("dir");
+ Option name = OptionBuilder.withArgName("name")
.hasArg()
- .withDescription( "give total size of files with given name" )
- .create( "name" );
+ .withDescription("give total size of files with given name")
+ .create("name");
Options options = new Options();
options.addOption(dir);
@@ -52,17 +52,20 @@
CommandLineParser parser = new GnuParser();
- CommandLine line = parser.parse( options, args );
+ CommandLine line = parser.parse(options, args);
File dir = new File(line.getOptionValue("dir", "."));
String name = line.getOptionValue("name", "jar");
- System.out.println("total size of files in "+dir+" containing
"+name+": "+SizeWhere.totalSize(dir, name));
- } catch( ParseException exp ) {
+ System.out.println("total size of files in " + dir
+ + " containing " + name + ": " + SizeWhere.totalSize(dir, name));
+ } catch (ParseException exp) {
// oops, something went wrong
- System.err.println( "Parsing failed. Reason: " + exp.getMessage() );
+ System.err.println("Parsing failed. Reason: " + exp.getMessage());
HelpFormatter formatter = new HelpFormatter();
- formatter.printHelp( "sizewhere", options );
+ formatter.printHelp("sizewhere", options);
}
}
+ private Main() {
+ }
}
Modified:
ant/ivy/core/trunk/src/example/multi-project/projects/sizewhere/src/sizewhere/SizeWhere.java
URL:
http://svn.apache.org/viewvc/ant/ivy/core/trunk/src/example/multi-project/projects/sizewhere/src/sizewhere/SizeWhere.java?rev=632728&r1=632727&r2=632728&view=diff
==============================================================================
---
ant/ivy/core/trunk/src/example/multi-project/projects/sizewhere/src/sizewhere/SizeWhere.java
(original)
+++
ant/ivy/core/trunk/src/example/multi-project/projects/sizewhere/src/sizewhere/SizeWhere.java
Sun Mar 2 01:33:32 2008
@@ -21,16 +21,17 @@
import size.FileSize;
import find.FindFile;
-import java.util.Collection;
-import java.util.ArrayList;
import java.io.File;
-public class SizeWhere {
+public final class SizeWhere {
static {
Version.register("sizewhere");
}
public static long totalSize(File dir, String name) {
return FileSize.totalSize(FindFile.find(dir, name));
+ }
+
+ private SizeWhere() {
}
}
Modified:
ant/ivy/core/trunk/src/example/multi-project/projects/version/src/version/Version.java
URL:
http://svn.apache.org/viewvc/ant/ivy/core/trunk/src/example/multi-project/projects/version/src/version/Version.java?rev=632728&r1=632727&r2=632728&view=diff
==============================================================================
---
ant/ivy/core/trunk/src/example/multi-project/projects/version/src/version/Version.java
(original)
+++
ant/ivy/core/trunk/src/example/multi-project/projects/version/src/version/Version.java
Sun Mar 2 01:33:32 2008
@@ -22,7 +22,7 @@
import java.util.Map;
import java.util.HashMap;
-public class Version {
+public final class Version {
static {
versions = new HashMap();
register("version");
@@ -32,15 +32,20 @@
public static void register(String module) {
try {
- InputStream moduleVersion =
Version.class.getResourceAsStream("/"+module+".properties");
+ InputStream moduleVersion = Version.class.getResourceAsStream("/"
+ module
+ + ".properties");
Properties props = new Properties();
props.load(moduleVersion);
- String version = (String)props.get("version");
+ String version = (String) props.get("version");
versions.put(module, version);
- System.out.println("--- using "+module+" v"+version);
+ System.out.println("--- using " + module + " v" + version);
} catch (Exception ex) {
- System.err.println("an error occured while registering "+module+":
"+ex.getMessage());
+ System.err.println("an error occured while registering " + module
+ ": "
+ + ex.getMessage());
ex.printStackTrace();
}
+ }
+
+ private Version() {
}
}