You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@commons.apache.org by "Senthil Kumar (JIRA)" <ji...@apache.org> on 2012/07/26 07:29:34 UTC
[jira] [Created] (VALIDATOR-307) isValid checks if the given
address is only IPV4 address and not IPV6
Senthil Kumar created VALIDATOR-307:
---------------------------------------
Summary: isValid checks if the given address is only IPV4 address and not IPV6
Key: VALIDATOR-307
URL: https://issues.apache.org/jira/browse/VALIDATOR-307
Project: Commons Validator
Issue Type: Improvement
Components: Routines
Affects Versions: 1.4.0 Release
Reporter: Senthil Kumar
Fix For: 1.4.1
function isValid(String inetAddress) checks if the given address is only IPV4 and not IPV6. So the function returns false for a valid IPV6 address. Would it be possible to add IPV6 validation as well?
--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators: https://issues.apache.org/jira/secure/ContactAdministrators!default.jspa
For more information on JIRA, see: http://www.atlassian.com/software/jira
[jira] [Commented] (VALIDATOR-307) isValid checks if the given
address is only IPV4 address and not IPV6
Posted by "Senthil Kumar (JIRA)" <ji...@apache.org>.
[ https://issues.apache.org/jira/browse/VALIDATOR-307?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13423767#comment-13423767 ]
Senthil Kumar commented on VALIDATOR-307:
-----------------------------------------
This is what i'm using in my code for now,
try {
isValid = InetAddress.getByName(address) instanceof Inet6Address;
} catch (UnknownHostException ex) {
isValid = false;
}
and if i had to change the InetAddressValidator.java it would look like,
{code:title=InetAddressValidator.java|borderStyle=solid}
public boolean isValid(String inetAddress) {
boolean isValid = false;
if(isValidInet4Address(inetAddress)){
isValid = true;
} else { //could it be IPV6?
try {
isValid = InetAddress.getByName(address) instanceof Inet6Address;
} catch (UnknownHostException ex) {
isValid = false;
}
}
return isValid;
}
{code}
I searched stackoverflow for proper IPV6 regex validation but in vain, so this what i'm using for now and works for my case. I assume there must be a better way to do it. Thanks.
> isValid checks if the given address is only IPV4 address and not IPV6
> ---------------------------------------------------------------------
>
> Key: VALIDATOR-307
> URL: https://issues.apache.org/jira/browse/VALIDATOR-307
> Project: Commons Validator
> Issue Type: Improvement
> Components: Routines
> Affects Versions: 1.4.0 Release
> Reporter: Senthil Kumar
> Labels: ipv6, validation
> Fix For: 1.4.1
>
>
> function isValid(String inetAddress) checks if the given address is only IPV4 and not IPV6. So the function returns false for a valid IPV6 address. Would it be possible to add IPV6 validation as well?
--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators: https://issues.apache.org/jira/secure/ContactAdministrators!default.jspa
For more information on JIRA, see: http://www.atlassian.com/software/jira
[jira] [Comment Edited] (VALIDATOR-307) isValid checks if the given
address is only IPV4 address and not IPV6
Posted by "Senthil Kumar (JIRA)" <ji...@apache.org>.
[ https://issues.apache.org/jira/browse/VALIDATOR-307?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13423767#comment-13423767 ]
Senthil Kumar edited comment on VALIDATOR-307 at 7/27/12 9:44 AM:
------------------------------------------------------------------
This is what i'm using in my code for now,
try {
isValid = InetAddress.getByName(address) instanceof Inet6Address;
} catch (UnknownHostException ex) {
isValid = false;
}
and if i had to change the InetAddressValidator.java it would look like,
{code:title=InetAddressValidator.java|borderStyle=solid}
public boolean isValid(String inetAddress) {
boolean isValid = false;
if(isValidInet4Address(inetAddress)){
isValid = true;
} else { //could it be IPV6?
try {
isValid = InetAddress.getByName(address) instanceof Inet6Address;
} catch (UnknownHostException ex) {
isValid = false;
}
}
return isValid;
}
{code}
I searched stackoverflow for proper IPV6 regex validation but in vain, so this is what i'm using for now and works for my case. I assume there must be a better way to do it. Thanks.
was (Author: senthilkumar):
This is what i'm using in my code for now,
try {
isValid = InetAddress.getByName(address) instanceof Inet6Address;
} catch (UnknownHostException ex) {
isValid = false;
}
and if i had to change the InetAddressValidator.java it would look like,
{code:title=InetAddressValidator.java|borderStyle=solid}
public boolean isValid(String inetAddress) {
boolean isValid = false;
if(isValidInet4Address(inetAddress)){
isValid = true;
} else { //could it be IPV6?
try {
isValid = InetAddress.getByName(address) instanceof Inet6Address;
} catch (UnknownHostException ex) {
isValid = false;
}
}
return isValid;
}
{code}
I searched stackoverflow for proper IPV6 regex validation but in vain, so this what i'm using for now and works for my case. I assume there must be a better way to do it. Thanks.
> isValid checks if the given address is only IPV4 address and not IPV6
> ---------------------------------------------------------------------
>
> Key: VALIDATOR-307
> URL: https://issues.apache.org/jira/browse/VALIDATOR-307
> Project: Commons Validator
> Issue Type: Improvement
> Components: Routines
> Affects Versions: 1.4.0 Release
> Reporter: Senthil Kumar
> Labels: ipv6, validation
> Fix For: 1.4.1
>
>
> function isValid(String inetAddress) checks if the given address is only IPV4 and not IPV6. So the function returns false for a valid IPV6 address. Would it be possible to add IPV6 validation as well?
--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators: https://issues.apache.org/jira/secure/ContactAdministrators!default.jspa
For more information on JIRA, see: http://www.atlassian.com/software/jira
[jira] [Commented] (VALIDATOR-307) isValid checks if the given
address is only IPV4 address and not IPV6
Posted by "Simone Tripodi (JIRA)" <ji...@apache.org>.
[ https://issues.apache.org/jira/browse/VALIDATOR-307?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13423075#comment-13423075 ]
Simone Tripodi commented on VALIDATOR-307:
------------------------------------------
sure! patches are welcome, if you could provide a patch and attach to that issue, it would be much easier to integrate that functionality!
TIA!
> isValid checks if the given address is only IPV4 address and not IPV6
> ---------------------------------------------------------------------
>
> Key: VALIDATOR-307
> URL: https://issues.apache.org/jira/browse/VALIDATOR-307
> Project: Commons Validator
> Issue Type: Improvement
> Components: Routines
> Affects Versions: 1.4.0 Release
> Reporter: Senthil Kumar
> Labels: ipv6, validation
> Fix For: 1.4.1
>
>
> function isValid(String inetAddress) checks if the given address is only IPV4 and not IPV6. So the function returns false for a valid IPV6 address. Would it be possible to add IPV6 validation as well?
--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators: https://issues.apache.org/jira/secure/ContactAdministrators!default.jspa
For more information on JIRA, see: http://www.atlassian.com/software/jira