retrieve support for agurments
parent
d0eff567f5
commit
d4bcff6f8c
@ -1,28 +0,0 @@
|
||||
package tools;
|
||||
|
||||
/** Test if IP are legitimate.
|
||||
* @author Louis Royer
|
||||
* @author Flavien Haas
|
||||
* @author JS Auge
|
||||
* @version 1.0
|
||||
*/
|
||||
public class TestLegitIP {
|
||||
|
||||
public boolean TestIP(String hostname) {
|
||||
if(hostname.equals("localhost")){
|
||||
return true;
|
||||
}
|
||||
else{
|
||||
String[] ipArray = hostname.split("\\.");
|
||||
if(ipArray.length != 4){
|
||||
return false;
|
||||
}
|
||||
for(int i= 0; i < ipArray.length; i++){
|
||||
if((Integer.parseInt(ipArray[i]) > 255) || (Integer.parseInt(ipArray[i]) < 0)){
|
||||
return false;
|
||||
}
|
||||
}
|
||||
}
|
||||
return true;
|
||||
}
|
||||
}
|
Loading…
Reference in New Issue