views:

275

answers:

4

is there a tool that tells me redundant keys and values that are there in my one or many properties file.

A: 

It might be easiest just to write one: For each file, and for each property in that file, put the property key/value pair into a Map, but only after ensuring that the key is not already in the Map. If it is, print out the file name, the key, and the two values.

Jim Ferrans
Ya, i am writing one in groovy.But its better to reuse and create,if we have one.
+1  A: 

I don't know if there is an existing tool, but you should be able to write a short java program, or script in a language you are comfortable with that should do this in no time. Then you would also have it for future use.

A quick google search yielded the following http://www.javanb.com/netbeans/1/19793.html

this has a gui tool and a script that will do it.

broschb
Me too found it, but seems to be too old
Too old? What to you mean by that? If it worked then, it will work now. Or did the properties file format change sometime?
jitter
A: 

If you are using an IDE you might find a good tool among their plugins/features.

Eclipse has a ResourceBundle Editor plugin which manages properties files:

http://www.eclipseplugincentral.com/Web_Links-index-req-viewlink-cid-331.html

IntelliJ IDEA 8 and higher is also able to manage properties files and check for duplicate entries.

Tom H
+1  A: 

There is an Ant task, RscBundleCheck, that checks for the existence of duplicate keys in a set of resource files:

http://rscbundlecheck.sourceforge.net/

This would be simple way to integrate checking for duplicate properties into your build process.

shadit