troubleshooting Question

Ignoring IP's in a java properties file

Avatar of judsonV
judsonV asked on
13 Comments1 Solution359 ViewsLast Modified:
I have an application that reads incoming packets from specific IP address. Testing is changing and adding IP's to the boxes and they are providing me with a list of IP's they want me to code into the app to ignore.

The existing code look like this :
if (localIP != null && localIP != "" && localIP != "" && (localIP.equals(WebUtil.getDevIPAddress()) || localIP.equals(WebUtil.getUaIPAddress()) || localIP.equals(WebUtil.getProdIPAddress())))

As you can see I hard coded the first two IP's they provided to me to ignore. But now they are saying there could be up to 20 IP's which would make an huge if statement. I'm normally a 'net guy and this is java app so i'm a little out of my element.

I know I could make a properties file that could contain all the ip's (they are stored as strings currently thankfully enough) and just basically in that if statement tell the app to ignore everything in that properties file.  

I have created the properties file which looks like:
# Redundant IP's in the test/UA environment as of 2011-08-10

Now in the code how do call that and tell the app to ignore every IP in that file?

Join the community to see this answer!
Join our exclusive community to see this answer & millions of others.
Unlock 1 Answer and 13 Comments.
Join the Community
Learn from the best

Network and collaborate with thousands of CTOs, CISOs, and IT Pros rooting for you and your success.

Andrew Hancock - VMware vExpert
See if this solution works for you by signing up for a 7 day free trial.
Unlock 1 Answer and 13 Comments.
Try for 7 days

”The time we save is the biggest benefit of E-E to our team. What could take multiple guys 2 hours or more each to find is accessed in around 15 minutes on Experts Exchange.

-Mike Kapnisakis, Warner Bros