/* * Main.java * * Created on 24. srpen 2005, 16:29 * * To change this template, choose Tools | Options and locate the template under * the Source Creation and Management node. Right-click the template and choose * Open. You can then make changes to the template in the Source Editor. */ package javaapplication3; import java.io.BufferedInputStream; import java.io.File; import java.io.FileInputStream; import java.io.IOException; import java.util.ArrayList; import java.util.HashMap; import java.util.Properties; /** * * @author pb97924 */ public class Main { static HashMap cache = new HashMap(13); static HashMap locations = new HashMap(13); /** * @param args the command line arguments */ public static void main(String[] args) { File root = new File("c:\\nb_all\\web\\project\\src"); try { test(root); } catch (IOException ex) { ex.printStackTrace(); } } public static void test(File f) throws IOException { if (f.isDirectory()) { String ch[] = f.list(); for (String child : ch) { if (!"CVS".equals(child)) { test(new File(f, child)); } } } else if (f.getName().endsWith("properties")) { // System.out.println("check:" + f); Properties p = new Properties(); p.load(new BufferedInputStream(new FileInputStream(f))); for (Object o : p.keySet()) { if (cache.containsKey(o)) { Object value = cache.get(o); ArrayList l = (ArrayList) locations.get(o); l.add(f.getPath()); if (value.equals(p.get(o))) { System.out.println("Duplicate:"+o); } else { System.out.println("Clash:" + o); } for (Object loc : l) { System.out.println(" in file:" + loc); } } else { cache.put(o, p.get(o)); ArrayList l = new ArrayList(); l.add(f.getPath()); locations.put(o, l); } } } } }