You are viewing a plain text version of this content. The canonical link for it is here.
Posted to ivy-commits@incubator.apache.org by xa...@apache.org on 2007/06/05 12:02:43 UTC

svn commit: r544459 [25/36] - in /incubator/ivy/core/trunk: src/java/org/apache/ivy/ src/java/org/apache/ivy/ant/ src/java/org/apache/ivy/core/ src/java/org/apache/ivy/core/cache/ src/java/org/apache/ivy/core/check/ src/java/org/apache/ivy/core/deliver...

Modified: incubator/ivy/core/trunk/src/java/org/apache/ivy/tools/analyser/JarModuleFinder.java
URL: http://svn.apache.org/viewvc/incubator/ivy/core/trunk/src/java/org/apache/ivy/tools/analyser/JarModuleFinder.java?view=diff&rev=544459&r1=544458&r2=544459
==============================================================================
--- incubator/ivy/core/trunk/src/java/org/apache/ivy/tools/analyser/JarModuleFinder.java (original)
+++ incubator/ivy/core/trunk/src/java/org/apache/ivy/tools/analyser/JarModuleFinder.java Tue Jun  5 05:02:27 2007
@@ -27,46 +27,52 @@
 import org.apache.ivy.plugins.resolver.util.ResolverHelper;
 import org.apache.ivy.plugins.resolver.util.URLLister;
 
-
 public class JarModuleFinder {
-	private String _pattern;
-	private String _filePattern;
-	
-	public JarModuleFinder(String pattern) {
-		_pattern = "file:///"+pattern;
-		_filePattern = pattern;
-	}
+    private String _pattern;
+
+    private String _filePattern;
+
+    public JarModuleFinder(String pattern) {
+        _pattern = "file:///" + pattern;
+        _filePattern = pattern;
+    }
 
-	public JarModule[] findJarModules() {
-		List ret = new ArrayList();
-		URLLister lister = new FileURLLister();
-		try {
-			String[] orgs = ResolverHelper.listTokenValues(lister, _pattern, "organisation");
-			for (int i = 0; i < orgs.length; i++) {
-				String orgPattern = IvyPatternHelper.substituteToken(_pattern, IvyPatternHelper.ORGANISATION_KEY, orgs[i]);
-				String[] modules = ResolverHelper.listTokenValues(lister, orgPattern, "module");
-				for (int j = 0; j < modules.length; j++) {
-					String modPattern = IvyPatternHelper.substituteToken(orgPattern, IvyPatternHelper.MODULE_KEY, modules[j]);
-					String [] revs = ResolverHelper.listTokenValues(lister, modPattern, "revision");
-					for (int k = 0; k < revs.length; k++) {
-						File jar = new File(IvyPatternHelper.substitute(_filePattern, orgs[i], modules[j], revs[k], modules[j], "jar", "jar"));
-						if (jar.exists()) {
-							ret.add(new JarModule(ModuleRevisionId.newInstance(orgs[i], modules[j], revs[k]), jar));
-						}
-					}
-				}
-			}
+    public JarModule[] findJarModules() {
+        List ret = new ArrayList();
+        URLLister lister = new FileURLLister();
+        try {
+            String[] orgs = ResolverHelper.listTokenValues(lister, _pattern, "organisation");
+            for (int i = 0; i < orgs.length; i++) {
+                String orgPattern = IvyPatternHelper.substituteToken(_pattern,
+                    IvyPatternHelper.ORGANISATION_KEY, orgs[i]);
+                String[] modules = ResolverHelper.listTokenValues(lister, orgPattern, "module");
+                for (int j = 0; j < modules.length; j++) {
+                    String modPattern = IvyPatternHelper.substituteToken(orgPattern,
+                        IvyPatternHelper.MODULE_KEY, modules[j]);
+                    String[] revs = ResolverHelper.listTokenValues(lister, modPattern, "revision");
+                    for (int k = 0; k < revs.length; k++) {
+                        File jar = new File(IvyPatternHelper.substitute(_filePattern, orgs[i],
+                            modules[j], revs[k], modules[j], "jar", "jar"));
+                        if (jar.exists()) {
+                            ret.add(new JarModule(ModuleRevisionId.newInstance(orgs[i], modules[j],
+                                revs[k]), jar));
+                        }
+                    }
+                }
+            }
 
-		} catch (Exception e) {
-			// TODO: handle exception
-		}		
-		return (JarModule[]) ret.toArray(new JarModule[ret.size()]);
-	}
+        } catch (Exception e) {
+            // TODO: handle exception
+        }
+        return (JarModule[]) ret.toArray(new JarModule[ret.size()]);
+    }
 
-	public static void main(String[] args) {
-		JarModule[] mods = new JarModuleFinder("D:/temp/test2/ivyrep/[organisation]/[module]/[revision]/[artifact].[ext]").findJarModules();
-		for (int i = 0; i < mods.length; i++) {
-			System.out.println(mods[i]);
-		}
-	}
+    public static void main(String[] args) {
+        JarModule[] mods = new JarModuleFinder(
+                "D:/temp/test2/ivyrep/[organisation]/[module]/[revision]/[artifact].[ext]")
+                .findJarModules();
+        for (int i = 0; i < mods.length; i++) {
+            System.out.println(mods[i]);
+        }
+    }
 }

Modified: incubator/ivy/core/trunk/src/java/org/apache/ivy/tools/analyser/RepositoryAnalyser.java
URL: http://svn.apache.org/viewvc/incubator/ivy/core/trunk/src/java/org/apache/ivy/tools/analyser/RepositoryAnalyser.java?view=diff&rev=544459&r1=544458&r2=544459
==============================================================================
--- incubator/ivy/core/trunk/src/java/org/apache/ivy/tools/analyser/RepositoryAnalyser.java (original)
+++ incubator/ivy/core/trunk/src/java/org/apache/ivy/tools/analyser/RepositoryAnalyser.java Tue Jun  5 05:02:27 2007
@@ -26,33 +26,34 @@
 import org.apache.ivy.plugins.parser.xml.XmlModuleDescriptorWriter;
 import org.apache.ivy.util.Message;
 
-
 public class RepositoryAnalyser {
-	public void analyse(String pattern, DependencyAnalyser depAnalyser) {
-		JarModuleFinder finder = new JarModuleFinder(pattern);
-		ModuleDescriptor[] mds = depAnalyser.analyze(finder.findJarModules());
-		Message.info("found "+mds.length+" modules");
-		for (int i = 0; i < mds.length; i++) {
-			File ivyFile = new File(IvyPatternHelper.substitute(pattern, DefaultArtifact.newIvyArtifact(mds[i].getModuleRevisionId(), mds[i].getPublicationDate())));
-			try {
-				Message.info("generating "+ivyFile);
-				XmlModuleDescriptorWriter.write(mds[i], ivyFile);
-			} catch (IOException e) {
-				// TODO Auto-generated catch block
-				e.printStackTrace();
-			}
-		}
-	}
-	
-	public static void main(String[] args) {
-		if (args.length != 2) {
-			System.out.println("usage: ivyanalyser path/to/jarjar.jar absolute-ivy-repository-pattern");
-			return;
-		}
-		String jarjarLocation = args[0];
-		String pattern = args[1];
+    public void analyse(String pattern, DependencyAnalyser depAnalyser) {
+        JarModuleFinder finder = new JarModuleFinder(pattern);
+        ModuleDescriptor[] mds = depAnalyser.analyze(finder.findJarModules());
+        Message.info("found " + mds.length + " modules");
+        for (int i = 0; i < mds.length; i++) {
+            File ivyFile = new File(IvyPatternHelper.substitute(pattern, DefaultArtifact
+                    .newIvyArtifact(mds[i].getModuleRevisionId(), mds[i].getPublicationDate())));
+            try {
+                Message.info("generating " + ivyFile);
+                XmlModuleDescriptorWriter.write(mds[i], ivyFile);
+            } catch (IOException e) {
+                // TODO Auto-generated catch block
+                e.printStackTrace();
+            }
+        }
+    }
+
+    public static void main(String[] args) {
+        if (args.length != 2) {
+            System.out
+                    .println("usage: ivyanalyser path/to/jarjar.jar absolute-ivy-repository-pattern");
+            return;
+        }
+        String jarjarLocation = args[0];
+        String pattern = args[1];
 
-		JarJarDependencyAnalyser a = new JarJarDependencyAnalyser(new File(jarjarLocation));
-		new RepositoryAnalyser().analyse(pattern, a);
-	}
+        JarJarDependencyAnalyser a = new JarJarDependencyAnalyser(new File(jarjarLocation));
+        new RepositoryAnalyser().analyse(pattern, a);
+    }
 }

Modified: incubator/ivy/core/trunk/src/java/org/apache/ivy/util/Checks.java
URL: http://svn.apache.org/viewvc/incubator/ivy/core/trunk/src/java/org/apache/ivy/util/Checks.java?view=diff&rev=544459&r1=544458&r2=544459
==============================================================================
--- incubator/ivy/core/trunk/src/java/org/apache/ivy/util/Checks.java (original)
+++ incubator/ivy/core/trunk/src/java/org/apache/ivy/util/Checks.java Tue Jun  5 05:02:27 2007
@@ -21,18 +21,20 @@
  * Utility class used to perform some checks.
  */
 public class Checks {
-	/**
-	 * Checks that an object is not null, and throw an exception
-	 * if the object is null.
-	 * 
-	 * @param o the object to check
-	 * @param objectName the name of the object to check. This name will be used in the exception message.
-	 * @throws IllegalArgumentException if the object is null
-	 */
-	public static void checkNotNull(Object o, String objectName) {
-		if (o == null) {
-			throw new IllegalArgumentException(objectName+" must not be null");
-		}
-	}
+    /**
+     * Checks that an object is not null, and throw an exception if the object is null.
+     * 
+     * @param o
+     *            the object to check
+     * @param objectName
+     *            the name of the object to check. This name will be used in the exception message.
+     * @throws IllegalArgumentException
+     *             if the object is null
+     */
+    public static void checkNotNull(Object o, String objectName) {
+        if (o == null) {
+            throw new IllegalArgumentException(objectName + " must not be null");
+        }
+    }
 
 }

Modified: incubator/ivy/core/trunk/src/java/org/apache/ivy/util/ChecksumHelper.java
URL: http://svn.apache.org/viewvc/incubator/ivy/core/trunk/src/java/org/apache/ivy/util/ChecksumHelper.java?view=diff&rev=544459&r1=544458&r2=544459
==============================================================================
--- incubator/ivy/core/trunk/src/java/org/apache/ivy/util/ChecksumHelper.java (original)
+++ incubator/ivy/core/trunk/src/java/org/apache/ivy/util/ChecksumHelper.java Tue Jun  5 05:02:27 2007
@@ -29,81 +29,89 @@
 import java.util.Map;
 
 public class ChecksumHelper {
-    
-	private static Map _algorithms = new HashMap();
-	static {
-		_algorithms.put("md5", "MD5");
-		_algorithms.put("sha1", "SHA-1");
-	}
-	
-	/**
-	 * Checks the checksum of the given file against the given checksumFile,
-	 * and throws an IOException if the checksum is not compliant
-	 * 
-	 * @param dest the file to test
-	 * @param checksumFile the file containing the expected checksum
-	 * @param algorithm the checksum algorithm to use
-	 * @throws IOException if an IO problem occur whle reading files or if the checksum is not compliant
-	 */
-	public static void check(File dest, File checksumFile, String algorithm) throws IOException {
-		String csFileContent = FileUtil.readEntirely(new BufferedReader(new FileReader(checksumFile))).trim().toLowerCase();
-		String expected;
-		int spaceIndex = csFileContent.indexOf(' ');
-		if (spaceIndex != -1) {
-			expected = csFileContent.substring(0, spaceIndex);
-		} else {
-			expected = csFileContent;
-		}
-		
-		String computed = computeAsString(dest, algorithm).trim().toLowerCase();
-		if (!expected.equals(computed)) {
-			throw new IOException("invalid "+algorithm+": expected="+expected+" computed="+computed);
-		}
-	}    
-	
+
+    private static Map _algorithms = new HashMap();
+    static {
+        _algorithms.put("md5", "MD5");
+        _algorithms.put("sha1", "SHA-1");
+    }
+
+    /**
+     * Checks the checksum of the given file against the given checksumFile, and throws an
+     * IOException if the checksum is not compliant
+     * 
+     * @param dest
+     *            the file to test
+     * @param checksumFile
+     *            the file containing the expected checksum
+     * @param algorithm
+     *            the checksum algorithm to use
+     * @throws IOException
+     *             if an IO problem occur whle reading files or if the checksum is not compliant
+     */
+    public static void check(File dest, File checksumFile, String algorithm) throws IOException {
+        String csFileContent = FileUtil.readEntirely(
+            new BufferedReader(new FileReader(checksumFile))).trim().toLowerCase();
+        String expected;
+        int spaceIndex = csFileContent.indexOf(' ');
+        if (spaceIndex != -1) {
+            expected = csFileContent.substring(0, spaceIndex);
+        } else {
+            expected = csFileContent;
+        }
+
+        String computed = computeAsString(dest, algorithm).trim().toLowerCase();
+        if (!expected.equals(computed)) {
+            throw new IOException("invalid " + algorithm + ": expected=" + expected + " computed="
+                    + computed);
+        }
+    }
+
     public static String computeAsString(File f, String algorithm) throws IOException {
-    	return byteArrayToHexString(compute(f, algorithm));
+        return byteArrayToHexString(compute(f, algorithm));
     }
-    
+
     private static byte[] compute(File f, String algorithm) throws IOException {
-    	InputStream is = new FileInputStream(f);
+        InputStream is = new FileInputStream(f);
+
+        try {
+            MessageDigest md = getMessageDigest(algorithm);
+            md.reset();
+
+            byte[] buf = new byte[2048];
+            int len = 0;
+            while ((len = is.read(buf)) != -1) {
+                md.update(buf, 0, len);
+            }
+            return md.digest();
+        } finally {
+            is.close();
+        }
+    }
+
+    private static MessageDigest getMessageDigest(String algorithm) {
+        String mdAlgorithm = (String) _algorithms.get(algorithm);
+        if (mdAlgorithm == null) {
+            throw new IllegalArgumentException("unknown algorithm " + algorithm);
+        }
+        try {
+            return MessageDigest.getInstance(mdAlgorithm);
+        } catch (NoSuchAlgorithmException e) {
+            throw new IllegalArgumentException("unknown algorithm " + algorithm);
+        }
+    }
 
-    	try {
-    		MessageDigest md = getMessageDigest(algorithm);
-    		md.reset();
-
-    		byte[] buf = new byte[2048];
-    		int len = 0;
-    		while ((len = is.read(buf)) != -1) {
-    			md.update(buf, 0, len);
-    		}
-    		return md.digest();
-    	} finally {
-    		is.close();
-    	}
-	}
-
-
-	private static MessageDigest getMessageDigest(String algorithm) {
-		String mdAlgorithm = (String) _algorithms.get(algorithm);
-		if (mdAlgorithm == null) {
-			throw new IllegalArgumentException("unknown algorithm "+algorithm);
-		}
-		try {
-			return MessageDigest.getInstance(mdAlgorithm);
-		} catch (NoSuchAlgorithmException e) {
-			throw new IllegalArgumentException("unknown algorithm "+algorithm);
-		}
-	}
-
-
-	// byte to hex string converter
-	private final static char[] CHARS = {'0', '1', '2', '3', '4', '5', '6', '7', '8', '9', 'a', 'b', 'c', 'd', 'e', 'f'};
-	/**
-	 * Convert a byte[] array to readable string format. This makes the "hex" readable!
-	 * @return result String buffer in String format 
-	 * @param in byte[] buffer to convert to string format
-	 */
+    // byte to hex string converter
+    private final static char[] CHARS = {'0', '1', '2', '3', '4', '5', '6', '7', '8', '9', 'a',
+            'b', 'c', 'd', 'e', 'f'};
+
+    /**
+     * Convert a byte[] array to readable string format. This makes the "hex" readable!
+     * 
+     * @return result String buffer in String format
+     * @param in
+     *            byte[] buffer to convert to string format
+     */
     public static String byteArrayToHexString(byte in[]) {
         byte ch = 0x00;
 
@@ -118,9 +126,9 @@
             ch = (byte) (ch >>> 4); // shift the bits down
             ch = (byte) (ch & 0x0F); // must do this is high order bit is on!
 
-            out.append(CHARS[ (int) ch]); // convert the nibble to a String Character
-            ch = (byte) (in[i] & 0x0F); // Strip off low nibble 
-            out.append(CHARS[ (int) ch]); // convert the nibble to a String Character
+            out.append(CHARS[(int) ch]); // convert the nibble to a String Character
+            ch = (byte) (in[i] & 0x0F); // Strip off low nibble
+            out.append(CHARS[(int) ch]); // convert the nibble to a String Character
         }
 
         return out.toString();

Modified: incubator/ivy/core/trunk/src/java/org/apache/ivy/util/ConfigurationUtils.java
URL: http://svn.apache.org/viewvc/incubator/ivy/core/trunk/src/java/org/apache/ivy/util/ConfigurationUtils.java?view=diff&rev=544459&r1=544458&r2=544459
==============================================================================
--- incubator/ivy/core/trunk/src/java/org/apache/ivy/util/ConfigurationUtils.java (original)
+++ incubator/ivy/core/trunk/src/java/org/apache/ivy/util/ConfigurationUtils.java Tue Jun  5 05:02:27 2007
@@ -27,61 +27,60 @@
 
 /**
  * Class containing several utility methods for working with configurations.
- * 
- *
  */
 public class ConfigurationUtils {
-	
-	/**
-	 * Private constructor to avoid instantiation of this class.
-	 */
-	private ConfigurationUtils() {
-	}
-
-	/**
-	 * Replace all the wildcards in the given configuration array. Supported wildcards
-	 * are:
-	 * <ul>
-	 * <li><b><tt>*</tt>:</b>all configurations</li>
-	 * <li><b><tt>*(public)</tt>:</b>all public configurations</li>
-	 * <li><b><tt>*(private)</tt>:</b>all private configurations</li>
-	 * </ul>
-	 * If the given array of configurations is <tt>null</tt>, all configurations are returned.
-	 * 
-	 * @param confs the configurations, can contain wildcards
-	 * @param md the configurations where the wildcards are replaced
-	 * @return
-	 */
-	public static String[] replaceWildcards(String[] confs, ModuleDescriptor md) {
-		Set result = new LinkedHashSet();
-		
-		if (confs == null) {
-			return md.getConfigurationsNames();
-		}
-		
-		for (int i = 0; i < confs.length; i++) {
-			if ("*".equals(confs[i])) {
-				result.addAll(Arrays.asList(md.getConfigurationsNames()));
-			} else if ("*(public)".equals(confs[i])) {
-				Configuration[] all = md.getConfigurations();
-				for (int j = 0; j < all.length; j++) {
-					if (all[j].getVisibility().equals(Visibility.PUBLIC)) {
-						result.add(all[j].getName());
-					}
-				}
-			} else if ("*(private)".equals(confs[i])) {
-				Configuration[] all = md.getConfigurations();
-				for (int j = 0; j < all.length; j++) {
-					if (all[j].getVisibility().equals(Visibility.PRIVATE)) {
-						result.add(all[j].getName());
-					}
-				}
-			} else {
-				result.add(confs[i]);
-			}
-		}
-		
-		return (String[]) result.toArray(new String[result.size()]); 
-	}
-	
+
+    /**
+     * Private constructor to avoid instantiation of this class.
+     */
+    private ConfigurationUtils() {
+    }
+
+    /**
+     * Replace all the wildcards in the given configuration array. Supported wildcards are:
+     * <ul>
+     * <li><b><tt>*</tt>:</b>all configurations</li>
+     * <li><b><tt>*(public)</tt>:</b>all public configurations</li>
+     * <li><b><tt>*(private)</tt>:</b>all private configurations</li>
+     * </ul>
+     * If the given array of configurations is <tt>null</tt>, all configurations are returned.
+     * 
+     * @param confs
+     *            the configurations, can contain wildcards
+     * @param md
+     *            the configurations where the wildcards are replaced
+     * @return
+     */
+    public static String[] replaceWildcards(String[] confs, ModuleDescriptor md) {
+        Set result = new LinkedHashSet();
+
+        if (confs == null) {
+            return md.getConfigurationsNames();
+        }
+
+        for (int i = 0; i < confs.length; i++) {
+            if ("*".equals(confs[i])) {
+                result.addAll(Arrays.asList(md.getConfigurationsNames()));
+            } else if ("*(public)".equals(confs[i])) {
+                Configuration[] all = md.getConfigurations();
+                for (int j = 0; j < all.length; j++) {
+                    if (all[j].getVisibility().equals(Visibility.PUBLIC)) {
+                        result.add(all[j].getName());
+                    }
+                }
+            } else if ("*(private)".equals(confs[i])) {
+                Configuration[] all = md.getConfigurations();
+                for (int j = 0; j < all.length; j++) {
+                    if (all[j].getVisibility().equals(Visibility.PRIVATE)) {
+                        result.add(all[j].getName());
+                    }
+                }
+            } else {
+                result.add(confs[i]);
+            }
+        }
+
+        return (String[]) result.toArray(new String[result.size()]);
+    }
+
 }

Modified: incubator/ivy/core/trunk/src/java/org/apache/ivy/util/Configurator.java
URL: http://svn.apache.org/viewvc/incubator/ivy/core/trunk/src/java/org/apache/ivy/util/Configurator.java?view=diff&rev=544459&r1=544458&r2=544459
==============================================================================
--- incubator/ivy/core/trunk/src/java/org/apache/ivy/util/Configurator.java (original)
+++ incubator/ivy/core/trunk/src/java/org/apache/ivy/util/Configurator.java Tue Jun  5 05:02:27 2007
@@ -32,32 +32,22 @@
 import org.apache.ivy.core.IvyPatternHelper;
 
 /**
- * Ant 1.6.1 like Configurator
- * 
- * This configurator is used to configure elements (initialised with setRoot)
- * using the behaviour defined by ant for its tasks.
- * 
- * Example (based on <a href="http://ant.apache.org/manual/develop.html#writingowntask">Ant Example</a>) :
- * Configurator conf = new Configurator();
- * conf.typeDef("buildpath", "Sample$BuildPath");
- * conf.typeDef("xinterface", "Sample$XInterface");
- * 
- * Sample.MyFileSelector mfs = new Sample.MyFileSelector();
- * conf.setRoot(mfs);
- * conf.startCreateChild("buildpath");
- * conf.setAttribute("path", ".");
- * conf.setAttribute("url", "abc");
- * conf.startCreateChild("xinterface");
- * conf.setAttribute("count", "4");
- * conf.endCreateChild(); // xinterface
- * conf.endCreateChild(); // buildpath
- * 
- *
+ * Ant 1.6.1 like Configurator This configurator is used to configure elements (initialised with
+ * setRoot) using the behaviour defined by ant for its tasks. Example (based on <a
+ * href="http://ant.apache.org/manual/develop.html#writingowntask">Ant Example</a>) : Configurator
+ * conf = new Configurator(); conf.typeDef("buildpath", "Sample$BuildPath");
+ * conf.typeDef("xinterface", "Sample$XInterface"); Sample.MyFileSelector mfs = new
+ * Sample.MyFileSelector(); conf.setRoot(mfs); conf.startCreateChild("buildpath");
+ * conf.setAttribute("path", "."); conf.setAttribute("url", "abc");
+ * conf.startCreateChild("xinterface"); conf.setAttribute("count", "4"); conf.endCreateChild(); //
+ * xinterface conf.endCreateChild(); // buildpath
  */
 public class Configurator {
     public static class Macro {
         private MacroDef _macrodef;
+
         private Map _attValues = new HashMap();
+
         private Map _macroRecords = new HashMap();
 
         public Macro(MacroDef def) {
@@ -66,19 +56,20 @@
 
         public void defineAttribute(String attributeName, String value) {
             if (_macrodef.getAttribute(attributeName) == null) {
-                throw new IllegalArgumentException("undeclared attribute "+attributeName+" on macro "+_macrodef.getName());
+                throw new IllegalArgumentException("undeclared attribute " + attributeName
+                        + " on macro " + _macrodef.getName());
             }
             _attValues.put(attributeName, value);
         }
 
         public MacroRecord recordCreateChild(String name) {
-             MacroRecord macroRecord = new MacroRecord(name);
-             List records = (List)_macroRecords.get(name);
-             if (records == null) {
-                 records = new ArrayList();
-                 _macroRecords.put(name, records);
-             }
-             records.add(macroRecord);
+            MacroRecord macroRecord = new MacroRecord(name);
+            List records = (List) _macroRecords.get(name);
+            if (records == null) {
+                records = new ArrayList();
+                _macroRecords.put(name, records);
+            }
+            records.add(macroRecord);
             return macroRecord;
         }
 
@@ -90,34 +81,43 @@
 
     public static class Attribute {
         private String _name;
+
         private String _default;
-        
+
         public String getDefault() {
             return _default;
         }
+
         public void setDefault(String default1) {
             _default = default1;
         }
+
         public String getName() {
             return _name;
         }
+
         public void setName(String name) {
             _name = name;
         }
     }
-    
+
     public static class Element {
         private String _name;
+
         private boolean _optional = false;
+
         public String getName() {
             return _name;
         }
+
         public void setName(String name) {
             _name = name;
         }
+
         public boolean isOptional() {
             return _optional;
         }
+
         public void setOptional(boolean optional) {
             _optional = optional;
         }
@@ -125,25 +125,33 @@
 
     public static class MacroRecord {
         private String _name;
+
         private Map _attributes = new LinkedHashMap();
+
         private List _children = new ArrayList();
+
         public MacroRecord(String name) {
             _name = name;
         }
+
         public String getName() {
             return _name;
         }
+
         public void recordAttribute(String name, String value) {
             _attributes.put(name, value);
         }
+
         public MacroRecord recordChild(String name) {
             MacroRecord child = new MacroRecord(name);
             _children.add(child);
             return child;
         }
+
         public Map getAttributes() {
             return _attributes;
         }
+
         public List getChildren() {
             return _children;
         }
@@ -151,8 +159,11 @@
 
     public static class MacroDef {
         private String _name;
+
         private Map _attributes = new HashMap();
+
         private Map _elements = new HashMap();
+
         private MacroRecord _macroRecord;
 
         public MacroDef(String macroName) {
@@ -160,16 +171,17 @@
         }
 
         public Attribute getAttribute(String attributeName) {
-            return (Attribute)_attributes.get(attributeName);
+            return (Attribute) _attributes.get(attributeName);
         }
 
         public Object play(Configurator conf, Map attValues, Map macroRecords) {
             for (Iterator iter = _attributes.values().iterator(); iter.hasNext();) {
-                Attribute att = (Attribute)iter.next();
-                String val = (String)attValues.get(att.getName());
+                Attribute att = (Attribute) iter.next();
+                String val = (String) attValues.get(att.getName());
                 if (val == null) {
                     if (att.getDefault() == null) {
-                        throw new IllegalArgumentException("attribute "+att.getName()+" is required in "+getName());
+                        throw new IllegalArgumentException("attribute " + att.getName()
+                                + " is required in " + getName());
                     } else {
                         attValues.put(att.getName(), att.getDefault());
                     }
@@ -178,30 +190,33 @@
             return play(conf, _macroRecord, attValues, macroRecords);
         }
 
-        private Object play(Configurator conf, MacroRecord macroRecord, Map attValues, Map childrenRecords) {
+        private Object play(Configurator conf, MacroRecord macroRecord, Map attValues,
+                Map childrenRecords) {
             conf.startCreateChild(macroRecord.getName());
             Map attributes = macroRecord.getAttributes();
             for (Iterator iter = attributes.keySet().iterator(); iter.hasNext();) {
-                String attName = (String)iter.next();
-                String attValue = replaceParam((String)attributes.get(attName), attValues);
+                String attName = (String) iter.next();
+                String attValue = replaceParam((String) attributes.get(attName), attValues);
                 conf.setAttribute(attName, attValue);
             }
             for (Iterator iter = macroRecord.getChildren().iterator(); iter.hasNext();) {
-                MacroRecord child = (MacroRecord)iter.next();
-                Element elt = (Element)_elements.get(child.getName());
+                MacroRecord child = (MacroRecord) iter.next();
+                Element elt = (Element) _elements.get(child.getName());
                 if (elt != null) {
-                    List elements = (List)childrenRecords.get(child.getName());
+                    List elements = (List) childrenRecords.get(child.getName());
                     if (elements != null) {
                         for (Iterator iterator = elements.iterator(); iterator.hasNext();) {
-                            MacroRecord element = (MacroRecord)iterator.next();
+                            MacroRecord element = (MacroRecord) iterator.next();
                             for (Iterator it2 = element.getChildren().iterator(); it2.hasNext();) {
-                                MacroRecord r = (MacroRecord)it2.next();
+                                MacroRecord r = (MacroRecord) it2.next();
                                 play(conf, r, attValues, Collections.EMPTY_MAP);
                             }
                         }
                     } else if (!elt.isOptional()) {
-                        throw new IllegalArgumentException("non optional element is not specified: "+elt.getName()+" in macro "+getName());
-                    }                    
+                        throw new IllegalArgumentException(
+                                "non optional element is not specified: " + elt.getName()
+                                        + " in macro " + getName());
+                    }
                     continue;
                 }
                 play(conf, child, attValues, childrenRecords);
@@ -216,15 +231,15 @@
         public String getName() {
             return _name;
         }
-        
+
         public void addConfiguredAttribute(Attribute att) {
             _attributes.put(att.getName(), att);
         }
-        
+
         public void addConfiguredElement(Element elt) {
             _elements.put(elt.getName(), elt);
         }
-        
+
         public Macro createMacro() {
             return new Macro(this);
         }
@@ -251,47 +266,52 @@
 
     private static class ObjectDescriptor {
         private Object _obj;
+
         private String _objName;
+
         private Map _createMethods = new HashMap();
+
         private Map _addMethods = new HashMap();
+
         private Map _addConfiguredMethods = new HashMap();
+
         private Map _setMethods = new HashMap();
+
         private Map _typeAddMethods = new HashMap();
+
         private Map _typeAddConfiguredMethods = new HashMap();
-        
+
         public ObjectDescriptor(Object object, String objName) {
             _obj = object;
             _objName = objName;
             Method[] methods = object.getClass().getMethods();
             for (int i = 0; i < methods.length; i++) {
                 Method m = methods[i];
-                if (m.getName().startsWith("create")
-                        && m.getParameterTypes().length == 0
+                if (m.getName().startsWith("create") && m.getParameterTypes().length == 0
                         && !Void.TYPE.equals(m.getReturnType())) {
-                    String name = StringUtils.uncapitalize(m.getName().substring("create".length()));
+                    String name = StringUtils
+                            .uncapitalize(m.getName().substring("create".length()));
                     if (name.length() == 0) {
                         continue;
                     }
                     addCreateMethod(name, m);
                 } else if (m.getName().startsWith("addConfigured")
-                        && m.getParameterTypes().length == 1
-                        && Void.TYPE.equals(m.getReturnType())) {
-                    String name = StringUtils.uncapitalize(m.getName().substring("addConfigured".length()));
+                        && m.getParameterTypes().length == 1 && Void.TYPE.equals(m.getReturnType())) {
+                    String name = StringUtils.uncapitalize(m.getName().substring(
+                        "addConfigured".length()));
                     if (name.length() == 0) {
                         addAddConfiguredMethod(m);
                     }
                     addAddConfiguredMethod(name, m);
                 } else if (m.getName().startsWith("add")
                         && !m.getName().startsWith("addConfigured")
-                        && m.getParameterTypes().length == 1
-                        && Void.TYPE.equals(m.getReturnType())) {
+                        && m.getParameterTypes().length == 1 && Void.TYPE.equals(m.getReturnType())) {
                     String name = StringUtils.uncapitalize(m.getName().substring("add".length()));
                     if (name.length() == 0) {
                         addAddMethod(m);
                     }
                     addAddMethod(name, m);
-                } else if (m.getName().startsWith("set")
-                        && m.getParameterTypes().length == 1
+                } else if (m.getName().startsWith("set") && m.getParameterTypes().length == 1
                         && Void.TYPE.equals(m.getReturnType())) {
                     String name = StringUtils.uncapitalize(m.getName().substring("set".length()));
                     if (name.length() == 0) {
@@ -301,80 +321,95 @@
                 }
             }
         }
+
         public void addCreateMethod(String name, Method m) {
             _createMethods.put(name, m);
         }
+
         public void addAddMethod(String name, Method m) {
             _addMethods.put(name, m);
         }
+
         public void addAddConfiguredMethod(String name, Method m) {
             _addConfiguredMethods.put(name, m);
         }
+
         private void addAddMethod(Method m) {
             _typeAddMethods.put(m.getParameterTypes()[0], m);
         }
+
         private void addAddConfiguredMethod(Method m) {
             _typeAddConfiguredMethods.put(m.getParameterTypes()[0], m);
         }
+
         public void addSetMethod(String name, Method m) {
             _setMethods.put(name, m);
         }
+
         public Object getObject() {
             return _obj;
         }
+
         public Method getCreateMethod(String name) {
-            return (Method)_createMethods.get(name);
+            return (Method) _createMethods.get(name);
         }
+
         public Method getAddMethod(String name) {
-            return (Method)_addMethods.get(name);
+            return (Method) _addMethods.get(name);
         }
+
         public Method getAddConfiguredMethod(String name) {
-            return (Method)_addConfiguredMethods.get(name);
+            return (Method) _addConfiguredMethods.get(name);
         }
+
         public Method getAddMethod(Class type) {
             return getTypeMatchingMethod(type, _typeAddMethods);
         }
+
         public Method getAddConfiguredMethod(Class type) {
             return getTypeMatchingMethod(type, _typeAddConfiguredMethods);
         }
+
         private Method getTypeMatchingMethod(Class type, Map typeMethods) {
-            Method m = (Method)typeMethods.get(type);
+            Method m = (Method) typeMethods.get(type);
             if (m != null) {
                 return m;
             }
             for (Iterator iter = typeMethods.keySet().iterator(); iter.hasNext();) {
-                Class clss = (Class)iter.next();
+                Class clss = (Class) iter.next();
                 if (clss.isAssignableFrom(type)) {
-                    return (Method)typeMethods.get(clss);
+                    return (Method) typeMethods.get(clss);
                 }
             }
             return null;
         }
+
         public Method getSetMethod(String name) {
-            return (Method)_setMethods.get(name);
+            return (Method) _setMethods.get(name);
         }
+
         public String getObjectName() {
             return _objName;
         }
     }
 
     private Map _typedefs = new HashMap();
+
     private Map _macrodefs = new HashMap();
-    
+
     // stack in which the top is current configured object descriptor
     private Stack _objectStack = new Stack();
 
-
     private static final List TRUE_VALUES = Arrays.asList(new String[] {"true", "yes", "on"});
 
     public void typeDef(String name, String className) throws ClassNotFoundException {
         typeDef(name, Class.forName(className));
     }
-    
+
     public void typeDef(String name, Class clazz) {
         _typedefs.put(name, clazz);
     }
-    
+
     public void setRoot(Object root) {
         if (root == null) {
             throw new NullPointerException();
@@ -382,11 +417,11 @@
         _objectStack.clear();
         setCurrent(root, null);
     }
-    
+
     public void clear() {
         _objectStack.clear();
     }
-    
+
     private void setCurrent(Object object, String name) {
         _objectStack.push(new ObjectDescriptor(object, name));
     }
@@ -395,87 +430,93 @@
         if (_objectStack.isEmpty()) {
             throw new IllegalStateException("set root before creating child");
         }
-        ObjectDescriptor parentOD = (ObjectDescriptor)_objectStack.peek();
+        ObjectDescriptor parentOD = (ObjectDescriptor) _objectStack.peek();
         Object parent = parentOD.getObject();
         if (parent instanceof MacroDef) {
             if (!"attribute".equals(name) && !"element".equals(name)) {
-                MacroRecord record = ((MacroDef)parent).recordCreateChild(name);
+                MacroRecord record = ((MacroDef) parent).recordCreateChild(name);
                 setCurrent(record, name);
                 return record;
             }
         }
         if (parent instanceof Macro) {
-            MacroRecord record = ((Macro)parent).recordCreateChild(name);
+            MacroRecord record = ((Macro) parent).recordCreateChild(name);
             setCurrent(record, name);
             return record;
         }
         if (parent instanceof MacroRecord) {
-            MacroRecord record = ((MacroRecord)parent).recordChild(name);
+            MacroRecord record = ((MacroRecord) parent).recordChild(name);
             setCurrent(record, name);
             return record;
         }
         Object child = null;
-        MacroDef macrodef = (MacroDef)_macrodefs.get(name);
+        MacroDef macrodef = (MacroDef) _macrodefs.get(name);
         if (macrodef != null) {
             Macro macro = macrodef.createMacro();
             setCurrent(macro, name);
             return macro;
         }
-        Class childClass = (Class)_typedefs.get(name);
+        Class childClass = (Class) _typedefs.get(name);
         Method addChild = null;
         try {
             if (childClass != null) {
-    	        return addChild(parentOD, childClass, name, null);
+                return addChild(parentOD, childClass, name, null);
             } else {
                 addChild = parentOD.getCreateMethod(name);
-    	        if (addChild != null) {
-    	            child = addChild.invoke(parent, new Object[0]);
-    	            setCurrent(child, name);
-    	            return child;
-    	        }
-    	        addChild = parentOD.getAddMethod(name);
-    	        if (addChild != null) {
-    	            childClass = addChild.getParameterTypes()[0];
-    	            child = childClass.newInstance();
-    	            addChild.invoke(parent, new Object[] {child});
-    	            setCurrent(child, name);
-    	            return child;
-    	        }
-    	        addChild = parentOD.getAddConfiguredMethod(name);
-    	        if (addChild != null) {
-    	            childClass = addChild.getParameterTypes()[0];
-    	            child = childClass.newInstance();
-    	            setCurrent(child, name);
-    	            return child;
-    	        }
+                if (addChild != null) {
+                    child = addChild.invoke(parent, new Object[0]);
+                    setCurrent(child, name);
+                    return child;
+                }
+                addChild = parentOD.getAddMethod(name);
+                if (addChild != null) {
+                    childClass = addChild.getParameterTypes()[0];
+                    child = childClass.newInstance();
+                    addChild.invoke(parent, new Object[] {child});
+                    setCurrent(child, name);
+                    return child;
+                }
+                addChild = parentOD.getAddConfiguredMethod(name);
+                if (addChild != null) {
+                    childClass = addChild.getParameterTypes()[0];
+                    child = childClass.newInstance();
+                    setCurrent(child, name);
+                    return child;
+                }
             }
         } catch (InstantiationException ex) {
-            throw new IllegalArgumentException("no default constructor on "+childClass+" for adding "+name+" on "+parent.getClass());
+            throw new IllegalArgumentException("no default constructor on " + childClass
+                    + " for adding " + name + " on " + parent.getClass());
         } catch (Exception ex) {
-            IllegalArgumentException iae = new IllegalArgumentException("bad method found for "+name+" on "+parent.getClass());
+            IllegalArgumentException iae = new IllegalArgumentException("bad method found for "
+                    + name + " on " + parent.getClass());
             iae.initCause(ex);
             throw iae;
         }
-        throw new IllegalArgumentException("no appropriate method found for adding "+name+" on "+parent.getClass());
+        throw new IllegalArgumentException("no appropriate method found for adding " + name
+                + " on " + parent.getClass());
     }
-    
+
     public void addChild(String name, Object child) {
         if (_objectStack.isEmpty()) {
             throw new IllegalStateException("set root before creating child");
         }
-        ObjectDescriptor parentOD = (ObjectDescriptor)_objectStack.peek();
+        ObjectDescriptor parentOD = (ObjectDescriptor) _objectStack.peek();
         try {
             addChild(parentOD, child.getClass(), name, child);
         } catch (InstantiationException ex) {
-            throw new IllegalArgumentException("no default constructor on "+child.getClass()+" for adding "+name+" on "+parentOD.getObject().getClass());
+            throw new IllegalArgumentException("no default constructor on " + child.getClass()
+                    + " for adding " + name + " on " + parentOD.getObject().getClass());
         } catch (Exception ex) {
-            IllegalArgumentException iae = new IllegalArgumentException("bad method found for "+name+" on "+parentOD.getObject().getClass());
+            IllegalArgumentException iae = new IllegalArgumentException("bad method found for "
+                    + name + " on " + parentOD.getObject().getClass());
             iae.initCause(ex);
             throw iae;
         }
     }
 
-    private Object addChild(ObjectDescriptor parentOD, Class childClass, String name, Object child) throws InstantiationException, IllegalAccessException, InvocationTargetException {
+    private Object addChild(ObjectDescriptor parentOD, Class childClass, String name, Object child)
+            throws InstantiationException, IllegalAccessException, InvocationTargetException {
         Object parent = parentOD.getObject();
         Method addChild;
         addChild = parentOD.getAddMethod(childClass);
@@ -495,37 +536,39 @@
             setCurrent(child, name);
             return child;
         }
-        throw new IllegalArgumentException("no appropriate method found for adding "+name+" on "+parent.getClass());
+        throw new IllegalArgumentException("no appropriate method found for adding " + name
+                + " on " + parent.getClass());
     }
-    
+
     public boolean isTopLevelMacroRecord() {
         if (_objectStack.isEmpty()) {
             return false;
         }
-        ObjectDescriptor od = (ObjectDescriptor)_objectStack.peek();
+        ObjectDescriptor od = (ObjectDescriptor) _objectStack.peek();
         return (od.getObject() instanceof MacroDef);
     }
-    
+
     public void setAttribute(String attributeName, String value) {
         if (_objectStack.isEmpty()) {
             throw new IllegalStateException("set root before setting attribute");
         }
-        ObjectDescriptor od = (ObjectDescriptor)_objectStack.peek();
+        ObjectDescriptor od = (ObjectDescriptor) _objectStack.peek();
         if (od.getObject() instanceof Macro) {
-            ((Macro)od.getObject()).defineAttribute(attributeName, value);
+            ((Macro) od.getObject()).defineAttribute(attributeName, value);
             return;
         }
         if (od.getObject() instanceof MacroRecord) {
-            ((MacroRecord)od.getObject()).recordAttribute(attributeName, value);
+            ((MacroRecord) od.getObject()).recordAttribute(attributeName, value);
             return;
         }
         Method m = od.getSetMethod(attributeName);
         if (m == null) {
-            throw new IllegalArgumentException("no set method found for "+attributeName+" on "+od.getObject().getClass());
+            throw new IllegalArgumentException("no set method found for " + attributeName + " on "
+                    + od.getObject().getClass());
         }
         Object convertedValue = null;
         Class paramClass = m.getParameterTypes()[0];
-		try {
+        try {
             if (paramClass.equals(String.class)) {
                 convertedValue = value;
             } else if (paramClass.equals(Boolean.class) || paramClass.equals(boolean.class)) {
@@ -541,55 +584,60 @@
             } else if (paramClass.equals(Class.class)) {
                 convertedValue = Class.forName(value);
             } else {
-                convertedValue = paramClass.getConstructor(new Class[] {String.class}).newInstance(new Object[] {value});
+                convertedValue = paramClass.getConstructor(new Class[] {String.class}).newInstance(
+                    new Object[] {value});
             }
         } catch (Exception ex) {
-            IllegalArgumentException iae = new IllegalArgumentException("impossible to convert "+value+" to "+paramClass+" for setting "+attributeName+" on "+od.getObject().getClass());
+            IllegalArgumentException iae = new IllegalArgumentException("impossible to convert "
+                    + value + " to " + paramClass + " for setting " + attributeName + " on "
+                    + od.getObject().getClass());
             iae.initCause(ex);
             throw iae;
         }
         try {
             m.invoke(od.getObject(), new Object[] {convertedValue});
         } catch (Exception ex) {
-            IllegalArgumentException iae = new IllegalArgumentException("impossible to set "+attributeName+" to "+convertedValue+" on "+od.getObject().getClass());
+            IllegalArgumentException iae = new IllegalArgumentException("impossible to set "
+                    + attributeName + " to " + convertedValue + " on " + od.getObject().getClass());
             iae.initCause(ex);
             throw iae;
         }
     }
-    
+
     public void addText(String text) {
         if (_objectStack.isEmpty()) {
             throw new IllegalStateException("set root before adding text");
         }
-        ObjectDescriptor od = (ObjectDescriptor)_objectStack.peek();
+        ObjectDescriptor od = (ObjectDescriptor) _objectStack.peek();
         try {
-            od.getObject().getClass().getMethod("addText", new Class[] {String.class}).invoke(od.getObject(), new Object[] {text});
+            od.getObject().getClass().getMethod("addText", new Class[] {String.class}).invoke(
+                od.getObject(), new Object[] {text});
         } catch (Exception ex) {
-            IllegalArgumentException iae = new IllegalArgumentException("impossible to add text on "+od.getObject().getClass());
+            IllegalArgumentException iae = new IllegalArgumentException(
+                    "impossible to add text on " + od.getObject().getClass());
             iae.initCause(ex);
             throw iae;
-        } 
+        }
     }
-    
+
     /**
-     * 
-     * @return the finished child 
+     * @return the finished child
      */
     public Object endCreateChild() {
         if (_objectStack.isEmpty()) {
             throw new IllegalStateException("set root before ending child");
         }
-        ObjectDescriptor od = (ObjectDescriptor)_objectStack.pop();
+        ObjectDescriptor od = (ObjectDescriptor) _objectStack.pop();
         if (_objectStack.isEmpty()) {
             _objectStack.push(od); // back to previous state
             throw new IllegalStateException("cannot end root");
         }
         if (od.getObject() instanceof Macro) {
-            return ((Macro)od.getObject()).play(this);
+            return ((Macro) od.getObject()).play(this);
         }
-        ObjectDescriptor parentOD = (ObjectDescriptor)_objectStack.peek();
+        ObjectDescriptor parentOD = (ObjectDescriptor) _objectStack.peek();
         String name = od.getObjectName();
-        Class childClass = (Class)_typedefs.get(name);
+        Class childClass = (Class) _typedefs.get(name);
         Method m = null;
         if (childClass != null) {
             m = parentOD.getAddConfiguredMethod(childClass);
@@ -602,14 +650,16 @@
             }
             return od.getObject();
         } catch (Exception ex) {
-            IllegalArgumentException iae = new IllegalArgumentException("impossible to add configured child for "+name+" on "+parentOD.getObject().getClass());
+            IllegalArgumentException iae = new IllegalArgumentException(
+                    "impossible to add configured child for " + name + " on "
+                            + parentOD.getObject().getClass());
             iae.initCause(ex);
             throw iae;
         }
     }
-    
+
     public Object getCurrent() {
-        return _objectStack.isEmpty()?null:((ObjectDescriptor)_objectStack.peek()).getObject();
+        return _objectStack.isEmpty() ? null : ((ObjectDescriptor) _objectStack.peek()).getObject();
     }
 
     public int getDepth() {
@@ -623,15 +673,15 @@
     }
 
     public void addMacroAttribute(String attName, String attDefaultValue) {
-        ((MacroDef)getCurrent()).addAttribute(attName, attDefaultValue);
+        ((MacroDef) getCurrent()).addAttribute(attName, attDefaultValue);
     }
 
     public void addMacroElement(String elementName, boolean optional) {
-        ((MacroDef)getCurrent()).addElement(elementName, optional);
+        ((MacroDef) getCurrent()).addElement(elementName, optional);
     }
 
     public void endMacroDef() {
-        addConfiguredMacrodef(((MacroDef)getCurrent()));
+        addConfiguredMacrodef(((MacroDef) getCurrent()));
         _objectStack.pop();
     }
 
@@ -640,6 +690,6 @@
     }
 
     public Class getTypeDef(String name) {
-        return (Class)_typedefs.get(name);
+        return (Class) _typedefs.get(name);
     }
 }

Modified: incubator/ivy/core/trunk/src/java/org/apache/ivy/util/CopyProgressEvent.java
URL: http://svn.apache.org/viewvc/incubator/ivy/core/trunk/src/java/org/apache/ivy/util/CopyProgressEvent.java?view=diff&rev=544459&r1=544458&r2=544459
==============================================================================
--- incubator/ivy/core/trunk/src/java/org/apache/ivy/util/CopyProgressEvent.java (original)
+++ incubator/ivy/core/trunk/src/java/org/apache/ivy/util/CopyProgressEvent.java Tue Jun  5 05:02:27 2007
@@ -22,32 +22,39 @@
  */
 public class CopyProgressEvent {
     private long _totalReadBytes;
+
     private byte[] _buffer;
+
     private int _readBytes;
-    
+
     public CopyProgressEvent() {
     }
+
     public CopyProgressEvent(byte[] buffer, int read, long total) {
         update(buffer, read, total);
     }
+
     public CopyProgressEvent(byte[] buffer, long total) {
         update(buffer, 0, total);
     }
+
     protected CopyProgressEvent update(byte[] buffer, int read, long total) {
         _buffer = buffer;
         _readBytes = read;
         _totalReadBytes = total;
         return this;
     }
+
     public long getTotalReadBytes() {
         return _totalReadBytes;
     }
+
     public byte[] getBuffer() {
         return _buffer;
     }
-    
+
     public int getReadBytes() {
         return _readBytes;
     }
-    
+
 }

Modified: incubator/ivy/core/trunk/src/java/org/apache/ivy/util/CopyProgressListener.java
URL: http://svn.apache.org/viewvc/incubator/ivy/core/trunk/src/java/org/apache/ivy/util/CopyProgressListener.java?view=diff&rev=544459&r1=544458&r2=544459
==============================================================================
--- incubator/ivy/core/trunk/src/java/org/apache/ivy/util/CopyProgressListener.java (original)
+++ incubator/ivy/core/trunk/src/java/org/apache/ivy/util/CopyProgressListener.java Tue Jun  5 05:02:27 2007
@@ -22,6 +22,8 @@
  */
 public interface CopyProgressListener {
     void start(CopyProgressEvent evt);
+
     void progress(CopyProgressEvent evt);
+
     void end(CopyProgressEvent evt);
 }

Modified: incubator/ivy/core/trunk/src/java/org/apache/ivy/util/Credentials.java
URL: http://svn.apache.org/viewvc/incubator/ivy/core/trunk/src/java/org/apache/ivy/util/Credentials.java?view=diff&rev=544459&r1=544458&r2=544459
==============================================================================
--- incubator/ivy/core/trunk/src/java/org/apache/ivy/util/Credentials.java (original)
+++ incubator/ivy/core/trunk/src/java/org/apache/ivy/util/Credentials.java Tue Jun  5 05:02:27 2007
@@ -21,32 +21,38 @@
  * 
  */
 public class Credentials {
-	private String _realm;
-	private String _host;
-	private String _userName;
-	private String _passwd;
-	
-	public Credentials(String realm, String host, String userName, String passwd) {
-		_realm = realm;
-		_host = host;
-		_userName = userName;
-		_passwd = passwd;
-	}
-	
-	public String getHost() {
-		return _host;
-	}
-	public String getPasswd() {
-		return _passwd;
-	}
-	public String getRealm() {
-		return _realm;
-	}
-	public String getUserName() {
-		return _userName;
-	}
+    private String _realm;
 
-	public static String buildKey(String realm, String host) {
+    private String _host;
+
+    private String _userName;
+
+    private String _passwd;
+
+    public Credentials(String realm, String host, String userName, String passwd) {
+        _realm = realm;
+        _host = host;
+        _userName = userName;
+        _passwd = passwd;
+    }
+
+    public String getHost() {
+        return _host;
+    }
+
+    public String getPasswd() {
+        return _passwd;
+    }
+
+    public String getRealm() {
+        return _realm;
+    }
+
+    public String getUserName() {
+        return _userName;
+    }
+
+    public static String buildKey(String realm, String host) {
         if (realm == null || "".equals(realm.trim())) {
             return host;
         } else {
@@ -54,42 +60,43 @@
         }
     }
 
-	/**
-	 * Return a string that can be used for debug purpose.  It contains only stars for each password character.
-	 */
-	public String toString() {
-		return getKey() + " " + getUserName() + "/" + getPasswdAsStars();
-	}
-
-	private String getPasswdAsStars() {
-		if (_passwd == null) {
-			return null;
-		}
-		StringBuffer sb = new StringBuffer();
-		for (int i = _passwd.length(); i>0; i--) {
-			sb.append('*');
-		}
-		return sb.toString();
-	}
-
-	public boolean equals(Object o) {
-		if(o == null) {
-			return false;
-		}
-
-		if(o instanceof Credentials) {
-			Credentials c = (Credentials) o;
-			return getKey().equals(c.getKey());
-		}
-
-		return false;
-	}
-	
-	public int hashCode() {
-		return getKey().hashCode();
-	}
-	
-	public String getKey() {
-		return buildKey(_realm, _host);
-	}
+    /**
+     * Return a string that can be used for debug purpose. It contains only stars for each password
+     * character.
+     */
+    public String toString() {
+        return getKey() + " " + getUserName() + "/" + getPasswdAsStars();
+    }
+
+    private String getPasswdAsStars() {
+        if (_passwd == null) {
+            return null;
+        }
+        StringBuffer sb = new StringBuffer();
+        for (int i = _passwd.length(); i > 0; i--) {
+            sb.append('*');
+        }
+        return sb.toString();
+    }
+
+    public boolean equals(Object o) {
+        if (o == null) {
+            return false;
+        }
+
+        if (o instanceof Credentials) {
+            Credentials c = (Credentials) o;
+            return getKey().equals(c.getKey());
+        }
+
+        return false;
+    }
+
+    public int hashCode() {
+        return getKey().hashCode();
+    }
+
+    public String getKey() {
+        return buildKey(_realm, _host);
+    }
 }

Modified: incubator/ivy/core/trunk/src/java/org/apache/ivy/util/CredentialsUtil.java
URL: http://svn.apache.org/viewvc/incubator/ivy/core/trunk/src/java/org/apache/ivy/util/CredentialsUtil.java?view=diff&rev=544459&r1=544458&r2=544459
==============================================================================
--- incubator/ivy/core/trunk/src/java/org/apache/ivy/util/CredentialsUtil.java (original)
+++ incubator/ivy/core/trunk/src/java/org/apache/ivy/util/CredentialsUtil.java Tue Jun  5 05:02:27 2007
@@ -36,125 +36,126 @@
 
 import org.apache.ivy.Ivy;
 
-
 public class CredentialsUtil {
-	
-	
 
-	private static final class CredentialPanel extends JPanel {
-		JTextField userNameField = new JTextField(20);
+    private static final class CredentialPanel extends JPanel {
+        JTextField userNameField = new JTextField(20);
 
-		JTextField passwordField = new JPasswordField(20);
+        JTextField passwordField = new JPasswordField(20);
 
-		JCheckBox rememberDataCB = new JCheckBox("remember my information");
-		
-		CredentialPanel(Credentials credentials, File passfile) {
-			GridBagLayout layout = new GridBagLayout();
-			setLayout(layout);
-			GridBagConstraints c = new GridBagConstraints();
-			c.insets = new Insets(2,2,2,2);
-			
-			c.gridx = 1;
-			c.gridheight = 1;
-			c.gridwidth = 2;
-			String prompt = credentials.getRealm() != null ? 
-					"Enter username and password for \""+credentials.getRealm()+"\" at "+credentials.getHost() :
-						"Enter username and password for "+credentials.getHost();
-			add(new JLabel(prompt), c);
-
-			c.gridy = 1;
-			c.gridwidth = 1;
-
-			add(new JLabel("username: "), c);
-			c.gridx = 2;
-			add(userNameField, c);
-			c.gridx = 1;
-			c.gridy++;
-
-			if (credentials.getUserName() != null) {
-				userNameField.setText(credentials.getUserName());
-			}
-			
-			if (credentials.getPasswd() == null) {
-				add(new JLabel("passwd:  "), c);
-				c.gridx = 2;
-				add(passwordField, c);
-				c.gridx = 1;
-				c.gridy++;
-			} else {
-				passwordField.setText(credentials.getPasswd());
-			}
-			
-			if (passfile != null) {
-				c.gridwidth = 2;
-				add(rememberDataCB, c);
-				c.gridy++;
-			}
-			c.gridwidth = 2;
-			add(new JLabel(), c); // spacer
-
-		}
-	}
-
-
-	public static Credentials promptCredentials(Credentials c, File passfile) {
-		c = loadPassfile(c, passfile);
-		if (c.getUserName() != null && c.getPasswd() != null) {
-			return c;
-		}
-		CredentialPanel credentialPanel = new CredentialPanel(c, passfile);
-		if (JOptionPane.showOptionDialog(null, credentialPanel, c.getHost()+" credentials", JOptionPane.OK_CANCEL_OPTION, 0, new ImageIcon(Ivy.class.getResource("logo.png")), null, new Integer(JOptionPane.OK_OPTION)) == JOptionPane.OK_OPTION) {
-			String username=credentialPanel.userNameField.getText();
-			String passwd=credentialPanel.passwordField.getText();
-			if (credentialPanel.rememberDataCB.isSelected()) {
-				Properties props = new EncrytedProperties();
-				props.setProperty("username", username);
-				props.setProperty("passwd", passwd);
-				FileOutputStream fos = null;
-				try {
-					fos = new FileOutputStream(passfile);
-					props.store(fos, "");
-				} catch (Exception e) {
-					Message.warn("error occured while saving password file "+passfile+": "+ e);
-				} finally {
-					if (fos != null) {try {fos.close();} catch (Exception e) {}}
-				}
-			}
-			c = new Credentials(c.getRealm(), c.getHost(), username, passwd);
-		}
-		return c;
-	}
-
-
-	public static Credentials loadPassfile(Credentials c, File passfile) {
-		if (passfile != null && passfile.exists()) {
-			Properties props = new EncrytedProperties();
-			FileInputStream fis = null;
-			try {
-				fis = new FileInputStream(passfile);
-				props.load(fis);
-				String username = c.getUserName();
-				String passwd = c.getPasswd();
-				if (username == null) {
-					username = props.getProperty("username");
-				}
-				if (passwd == null) {
-					passwd = props.getProperty("passwd");
-				}
-				return new Credentials(c.getRealm(), c.getHost(), username, passwd);
-			} catch (IOException e) {
-				Message.warn("error occured while loading password file "+passfile+": "+ e);
-			} finally {
-				if (fis != null) {
-					try {
-						fis.close();
-					} catch (IOException e) {
-					}
-				}
-			}
-		}
-		return c;
-	}
+        JCheckBox rememberDataCB = new JCheckBox("remember my information");
 
+        CredentialPanel(Credentials credentials, File passfile) {
+            GridBagLayout layout = new GridBagLayout();
+            setLayout(layout);
+            GridBagConstraints c = new GridBagConstraints();
+            c.insets = new Insets(2, 2, 2, 2);
+
+            c.gridx = 1;
+            c.gridheight = 1;
+            c.gridwidth = 2;
+            String prompt = credentials.getRealm() != null ? "Enter username and password for \""
+                    + credentials.getRealm() + "\" at " + credentials.getHost()
+                    : "Enter username and password for " + credentials.getHost();
+            add(new JLabel(prompt), c);
+
+            c.gridy = 1;
+            c.gridwidth = 1;
+
+            add(new JLabel("username: "), c);
+            c.gridx = 2;
+            add(userNameField, c);
+            c.gridx = 1;
+            c.gridy++;
+
+            if (credentials.getUserName() != null) {
+                userNameField.setText(credentials.getUserName());
+            }
+
+            if (credentials.getPasswd() == null) {
+                add(new JLabel("passwd:  "), c);
+                c.gridx = 2;
+                add(passwordField, c);
+                c.gridx = 1;
+                c.gridy++;
+            } else {
+                passwordField.setText(credentials.getPasswd());
+            }
+
+            if (passfile != null) {
+                c.gridwidth = 2;
+                add(rememberDataCB, c);
+                c.gridy++;
+            }
+            c.gridwidth = 2;
+            add(new JLabel(), c); // spacer
+
+        }
+    }
+
+    public static Credentials promptCredentials(Credentials c, File passfile) {
+        c = loadPassfile(c, passfile);
+        if (c.getUserName() != null && c.getPasswd() != null) {
+            return c;
+        }
+        CredentialPanel credentialPanel = new CredentialPanel(c, passfile);
+        if (JOptionPane.showOptionDialog(null, credentialPanel, c.getHost() + " credentials",
+            JOptionPane.OK_CANCEL_OPTION, 0, new ImageIcon(Ivy.class.getResource("logo.png")),
+            null, new Integer(JOptionPane.OK_OPTION)) == JOptionPane.OK_OPTION) {
+            String username = credentialPanel.userNameField.getText();
+            String passwd = credentialPanel.passwordField.getText();
+            if (credentialPanel.rememberDataCB.isSelected()) {
+                Properties props = new EncrytedProperties();
+                props.setProperty("username", username);
+                props.setProperty("passwd", passwd);
+                FileOutputStream fos = null;
+                try {
+                    fos = new FileOutputStream(passfile);
+                    props.store(fos, "");
+                } catch (Exception e) {
+                    Message.warn("error occured while saving password file " + passfile + ": " + e);
+                } finally {
+                    if (fos != null) {
+                        try {
+                            fos.close();
+                        } catch (Exception e) {
+                        }
+                    }
+                }
+            }
+            c = new Credentials(c.getRealm(), c.getHost(), username, passwd);
+        }
+        return c;
+    }
+
+    public static Credentials loadPassfile(Credentials c, File passfile) {
+        if (passfile != null && passfile.exists()) {
+            Properties props = new EncrytedProperties();
+            FileInputStream fis = null;
+            try {
+                fis = new FileInputStream(passfile);
+                props.load(fis);
+                String username = c.getUserName();
+                String passwd = c.getPasswd();
+                if (username == null) {
+                    username = props.getProperty("username");
+                }
+                if (passwd == null) {
+                    passwd = props.getProperty("passwd");
+                }
+                return new Credentials(c.getRealm(), c.getHost(), username, passwd);
+            } catch (IOException e) {
+                Message.warn("error occured while loading password file " + passfile + ": " + e);
+            } finally {
+                if (fis != null) {
+                    try {
+                        fis.close();
+                    } catch (IOException e) {
+                    }
+                }
+            }
+        }
+        return c;
+    }
 
 }

Modified: incubator/ivy/core/trunk/src/java/org/apache/ivy/util/DefaultMessageImpl.java
URL: http://svn.apache.org/viewvc/incubator/ivy/core/trunk/src/java/org/apache/ivy/util/DefaultMessageImpl.java?view=diff&rev=544459&r1=544458&r2=544459
==============================================================================
--- incubator/ivy/core/trunk/src/java/org/apache/ivy/util/DefaultMessageImpl.java (original)
+++ incubator/ivy/core/trunk/src/java/org/apache/ivy/util/DefaultMessageImpl.java Tue Jun  5 05:02:27 2007
@@ -30,11 +30,11 @@
     public void log(String msg, int level) {
         if (level <= _level) {
             System.out.println(msg);
-        }        
+        }
     }
-    
+
     public void rawlog(String msg, int level) {
-    	log(msg, level);
+        log(msg, level);
     }
 
     public void progress() {

Modified: incubator/ivy/core/trunk/src/java/org/apache/ivy/util/EncrytedProperties.java
URL: http://svn.apache.org/viewvc/incubator/ivy/core/trunk/src/java/org/apache/ivy/util/EncrytedProperties.java?view=diff&rev=544459&r1=544458&r2=544459
==============================================================================
--- incubator/ivy/core/trunk/src/java/org/apache/ivy/util/EncrytedProperties.java (original)
+++ incubator/ivy/core/trunk/src/java/org/apache/ivy/util/EncrytedProperties.java Tue Jun  5 05:02:27 2007
@@ -23,44 +23,43 @@
 import java.util.Properties;
 
 /**
- * An implementation of Properties which stores the values encrypted.
- * 
- * The use is transparent from the user point of view (use as any Properties instance),
- * except that get, put and putAll do not handle encryption/decryption.
- * 
- * This means that get returns the encrypted value, while put and putAll
- * puts given values without encrypting them.
- * 
- * It this thus recommended to void using them, use setProperty and getProperty instead.
- * 
- *
+ * An implementation of Properties which stores the values encrypted. The use is transparent from
+ * the user point of view (use as any Properties instance), except that get, put and putAll do not
+ * handle encryption/decryption. This means that get returns the encrypted value, while put and
+ * putAll puts given values without encrypting them. It this thus recommended to void using them,
+ * use setProperty and getProperty instead.
  */
 public class EncrytedProperties extends Properties {
-	
-	public EncrytedProperties() {
-		super();
-	}
-	
-	public synchronized Object setProperty(String key, String value) {
-		return StringUtils.decrypt((String)super.setProperty(key, StringUtils.encrypt(value)));
-	}
-	public String getProperty(String key) {
-		return StringUtils.decrypt(super.getProperty(key));
-	}
-	public String getProperty(String key, String defaultValue) {
-		return StringUtils.decrypt(super.getProperty(key, StringUtils.encrypt(defaultValue)));
-	}
-	public boolean containsValue(Object value) {
-		return super.containsValue(StringUtils.encrypt((String)value));
-	}
-	public synchronized boolean contains(Object value) {
-		return super.contains(StringUtils.encrypt((String)value));
-	}
-	public Collection values() {
-		List ret = new ArrayList(super.values());
-		for (int i=0; i<ret.size(); i++) {
-			ret.set(i, StringUtils.decrypt((String)ret.get(i)));
-		}
-		return ret;
-	}
+
+    public EncrytedProperties() {
+        super();
+    }
+
+    public synchronized Object setProperty(String key, String value) {
+        return StringUtils.decrypt((String) super.setProperty(key, StringUtils.encrypt(value)));
+    }
+
+    public String getProperty(String key) {
+        return StringUtils.decrypt(super.getProperty(key));
+    }
+
+    public String getProperty(String key, String defaultValue) {
+        return StringUtils.decrypt(super.getProperty(key, StringUtils.encrypt(defaultValue)));
+    }
+
+    public boolean containsValue(Object value) {
+        return super.containsValue(StringUtils.encrypt((String) value));
+    }
+
+    public synchronized boolean contains(Object value) {
+        return super.contains(StringUtils.encrypt((String) value));
+    }
+
+    public Collection values() {
+        List ret = new ArrayList(super.values());
+        for (int i = 0; i < ret.size(); i++) {
+            ret.set(i, StringUtils.decrypt((String) ret.get(i)));
+        }
+        return ret;
+    }
 }

Modified: incubator/ivy/core/trunk/src/java/org/apache/ivy/util/FileUtil.java
URL: http://svn.apache.org/viewvc/incubator/ivy/core/trunk/src/java/org/apache/ivy/util/FileUtil.java?view=diff&rev=544459&r1=544458&r2=544459
==============================================================================
--- incubator/ivy/core/trunk/src/java/org/apache/ivy/util/FileUtil.java (original)
+++ incubator/ivy/core/trunk/src/java/org/apache/ivy/util/FileUtil.java Tue Jun  5 05:02:27 2007
@@ -35,36 +35,39 @@
 
 import org.apache.ivy.util.url.URLHandlerRegistry;
 
-
-
 /**
  *
  */
 public class FileUtil {
-	// tried some other values with empty files... seems to be the best one (512 * 1024 is very bad)
-    // 8 * 1024 is also the size used by ant in its FileUtils... maybe they've done more study about it ;-)
+    // tried some other values with empty files... seems to be the best one (512 * 1024 is very bad)
+    // 8 * 1024 is also the size used by ant in its FileUtils... maybe they've done more study about
+    // it ;-)
     private static final int BUFFER_SIZE = 8 * 1024;
+
     private static final byte[] EMPTY_BUFFER = new byte[0];
 
-    public static void symlink(File src, File dest, CopyProgressListener l, boolean overwrite) throws IOException {
+    public static void symlink(File src, File dest, CopyProgressListener l, boolean overwrite)
+            throws IOException {
         try {
             if (dest.exists()) {
-        	if (!dest.isFile()) {
-                    throw new IOException("impossible to copy: destination is not a file: "+dest);
-        	}
-        	if (!overwrite) {
-                    Message.verbose(dest+" already exists, nothing done");
+                if (!dest.isFile()) {
+                    throw new IOException("impossible to copy: destination is not a file: " + dest);
+                }
+                if (!overwrite) {
+                    Message.verbose(dest + " already exists, nothing done");
                     return;
-        	}
+                }
             }
             if (dest.getParentFile() != null) {
                 dest.getParentFile().mkdirs();
             }
-            
+
             Runtime runtime = Runtime.getRuntime();
-            Message.verbose("executing 'ln -s -f " + src.getAbsolutePath() + " " + dest.getPath() + "'");
-            Process process = runtime.exec(new String[] {"ln", "-s", "-f", src.getAbsolutePath(), dest.getPath()});
-            
+            Message.verbose("executing 'ln -s -f " + src.getAbsolutePath() + " " + dest.getPath()
+                    + "'");
+            Process process = runtime.exec(new String[] {"ln", "-s", "-f", src.getAbsolutePath(),
+                    dest.getPath()});
+
             if (process.waitFor() != 0) {
                 InputStream errorStream = process.getErrorStream();
                 InputStreamReader isr = new InputStreamReader(errorStream);
@@ -73,50 +76,50 @@
                 StringBuffer error = new StringBuffer();
                 String line;
                 while ((line = br.readLine()) != null) {
-                  error.append(line);
-                  error.append('\n');
+                    error.append(line);
+                    error.append('\n');
                 }
-                
+
                 throw new IOException("error symlinking " + src + " to " + dest + ":\n" + error);
             }
-        }
-        catch (IOException x) {
+        } catch (IOException x) {
             Message.verbose("symlink failed; falling back to copy");
             StringWriter buffer = new StringWriter();
             x.printStackTrace(new PrintWriter(buffer));
             Message.debug(buffer.toString());
             copy(src, dest, l, overwrite);
-        }
-        catch (InterruptedException x) {
+        } catch (InterruptedException x) {
             Thread.currentThread().interrupt();
         }
     }
-  
+
     public static boolean copy(File src, File dest, CopyProgressListener l) throws IOException {
         return copy(src, dest, l, false);
     }
-    public static boolean copy(File src, File dest, CopyProgressListener l, boolean overwrite) throws IOException {
+
+    public static boolean copy(File src, File dest, CopyProgressListener l, boolean overwrite)
+            throws IOException {
         if (dest.exists()) {
-        	if (!dest.isFile()) {
-        		throw new IOException("impossible to copy: destination is not a file: "+dest);
-        	}
-        	if (overwrite) {
-        		if (!dest.canWrite()) {
-        			dest.delete();
-        		} // if dest is writable, the copy will overwrite it without requiring a delete
-        	} else {
-        		Message.verbose(dest+" already exists, nothing done");
-        		return false;
-        	}
+            if (!dest.isFile()) {
+                throw new IOException("impossible to copy: destination is not a file: " + dest);
+            }
+            if (overwrite) {
+                if (!dest.canWrite()) {
+                    dest.delete();
+                } // if dest is writable, the copy will overwrite it without requiring a delete
+            } else {
+                Message.verbose(dest + " already exists, nothing done");
+                return false;
+            }
         }
         copy(new FileInputStream(src), dest, l);
         long srcLen = src.length();
         long destLen = dest.length();
         if (srcLen != destLen) {
-        	dest.delete();
-        	throw new IOException("size of source file " + src.toString() + "("
-        			+ srcLen + ") differs from size of dest file " + dest.toString()
-        			+ "(" + destLen + ") - please retry");
+            dest.delete();
+            throw new IOException("size of source file " + src.toString() + "(" + srcLen
+                    + ") differs from size of dest file " + dest.toString() + "(" + destLen
+                    + ") - please retry");
         }
         dest.setLastModified(src.lastModified());
         return true;
@@ -133,34 +136,35 @@
         copy(src, new FileOutputStream(dest), l);
     }
 
-    public static void copy(InputStream src, OutputStream dest, CopyProgressListener l) throws IOException {
+    public static void copy(InputStream src, OutputStream dest, CopyProgressListener l)
+            throws IOException {
         CopyProgressEvent evt = null;
         if (l != null) {
             evt = new CopyProgressEvent();
         }
         try {
-            byte buffer[]=new byte[BUFFER_SIZE];
+            byte buffer[] = new byte[BUFFER_SIZE];
             int c;
             long total = 0;
-            
+
             if (l != null) {
                 l.start(evt);
             }
-            while( (c = src.read(buffer)) != -1 ) {
-            	if (Thread.currentThread().isInterrupted()) {
-            		throw new IOException("transfer interrupted");
-            	}
+            while ((c = src.read(buffer)) != -1) {
+                if (Thread.currentThread().isInterrupted()) {
+                    throw new IOException("transfer interrupted");
+                }
                 dest.write(buffer, 0, c);
                 total += c;
                 if (l != null) {
                     l.progress(evt.update(buffer, c, total));
                 }
             }
-            
+
             if (l != null) {
-            	evt.update(EMPTY_BUFFER, 0, total);
+                evt.update(EMPTY_BUFFER, 0, total);
             }
-            
+
             // close the streams
             src.close();
             dest.close();
@@ -168,15 +172,15 @@
             try {
                 src.close();
             } catch (IOException ex) {
-            	// ignore
+                // ignore
             }
             try {
-            	dest.close();
+                dest.close();
             } catch (IOException ex) {
-            	// ignore
+                // ignore
             }
         }
-        
+
         if (l != null) {
             l.end(evt);
         }
@@ -193,63 +197,63 @@
         in.close();
         return buf.toString();
     }
-    
+
     public static String concat(String dir, String file) {
-        return dir+"/"+file;
+        return dir + "/" + file;
     }
-    
+
     public static void forceDelete(File f) {
         if (f.isDirectory()) {
             File[] sub = f.listFiles();
             for (int i = 0; i < sub.length; i++) {
                 forceDelete(sub[i]);
             }
-        } 
+        }
         f.delete();
     }
+
     /**
-     * Returns a list of Files composed of all directories being
-     * parent of file and child of root + file and root themselves.
-     * 
-     * Example:
-     * getPathFiles(new File("test"), new File("test/dir1/dir2/file.txt"))
-     * => {new File("test/dir1"), new File("test/dir1/dir2"), new File("test/dir1/dir2/file.txt") }
+     * Returns a list of Files composed of all directories being parent of file and child of root +
+     * file and root themselves. Example: getPathFiles(new File("test"), new
+     * File("test/dir1/dir2/file.txt")) => {new File("test/dir1"), new File("test/dir1/dir2"), new
+     * File("test/dir1/dir2/file.txt") } Note that if root is not an ancester of file, or if root is
+     * null, all directories from the file system root will be returned.
+     */
+    public static List getPathFiles(File root, File file) {
+        List ret = new ArrayList();
+        while (file != null && !file.getAbsolutePath().equals(root.getAbsolutePath())) {
+            ret.add(file);
+            file = file.getParentFile();
+        }
+        if (root != null) {
+            ret.add(root);
+        }
+        Collections.reverse(ret);
+        return ret;
+    }
+
+    /**
+     * Returns a collection of all Files being contained in the given directory, recursively,
+     * including directories.
      * 
-     * Note that if root is not an ancester of file, or if root is null, all directories from the
-     * file system root will be returned. 
+     * @param dir
+     * @return
      */
-	public static List getPathFiles(File root, File file) {
-		List ret = new ArrayList();
-		while (file != null && !file.getAbsolutePath().equals(root.getAbsolutePath())) {
-			ret.add(file);
-			file = file.getParentFile();
-		}
-		if (root != null) {
-			ret.add(root);
-		}
-		Collections.reverse(ret);
-		return ret;
-	}
-	/**
-	 * Returns a collection of all Files being contained in the given directory,
-	 * recursively, including directories.
-	 * @param dir
-	 * @return
-	 */
-	public static Collection listAll(File dir) {
-		return listAll(dir, new ArrayList());
-	}
-	private static Collection listAll(File file, Collection list) {
-		if (file.exists()) {
-			list.add(file);
-		}
-		if (file.isDirectory()) {
-			File[] files = file.listFiles();
-			for (int i = 0; i < files.length; i++) {
-				listAll(files[i], list);
-			}
-		}
-		return list;
-	}
+    public static Collection listAll(File dir) {
+        return listAll(dir, new ArrayList());
+    }
+
+    private static Collection listAll(File file, Collection list) {
+        if (file.exists()) {
+            list.add(file);
+        }
+        if (file.isDirectory()) {
+            File[] files = file.listFiles();
+            for (int i = 0; i < files.length; i++) {
+                listAll(files[i], list);
+            }
+        }
+        return list;
+    }
 
 }