Following code would give you the missing keys..
InputStream is = null;
Properties props1 = new Properties();
Properties props2 = new Properties();
ClassLoader classLoader =
Thread.currentThread().getContextClassLoader();
if (classLoader == null) {
classLoader = this.getClass().getClassLoader();
}
is = classLoader.getResourceAsStream("<file1>");
if (is != null) {
try {
props1.load(is);
}
catch (IOException e) {
}
finally {
try {
is.close();
}
catch (IOException e) {
}
}
}
is = classLoader.getResourceAsStream("<file2>");
if (is != null) {
try {
props2.load(is);
}
catch (IOException e) {
}
finally {
try {
is.close();
}
catch (IOException e) {
}
}
}
java.util.Enumeration enum = props1.keys();
while(enum.hasMoreElements())
{
String key = (String) enum.nextElement();
if(!props1.containsKey(key))
{
System.out.println(key);
}
}
Thanks and Regards,
Nitish Kumar
Tavant Technologies Ltd
Bangalore
-----Original Message-----
From: Emmanouil Batsis [mailto:[EMAIL PROTECTED]
Sent: Thursday, June 23, 2005 7:44 PM
To: Struts Users Mailing List
Subject: [OT] Find missing property file keys?
Hi all,
Is there any tool to compare property files based on their keys only ? I
have some really huge ones for different locales but the number of keys
is different and i need to find the missing ones...
Thanks,
Manos
---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]