Rev 11 | Go to most recent revision | Show entire file | Regard whitespace | Details | Blame | Last modification | View Log | RSS feed
Rev 11 | Rev 13 | ||
---|---|---|---|
Line 1... | Line 1... | ||
1 | package com.dominicsayers.isemail; |
1 | package com.dominicsayers.isemail; |
2 | 2 | ||
3 | import javax.naming.NamingException; |
3 | import javax.naming.NamingException; |
4 | 4 | ||
5 | /** |
5 | /** |
- | 6 | * This class checks if email addresses are valid or not. |
|
- | 7 | * |
|
6 | * @package isemail |
8 | * @package isemail |
7 | * @author Dominic Sayers <dominic_sayers@hotmail.com>; Translated from PHP into |
9 | * @author Dominic Sayers <dominic_sayers@hotmail.com>; Translated from PHP into |
8 | * Java by Daniel Marschall [www.daniel-marschall.de] |
10 | * Java by Daniel Marschall [www.daniel-marschall.de] |
9 | * @copyright 2010 Dominic Sayers |
11 | * @copyright 2010 Dominic Sayers; Java-Translation 2010 by Daniel Marschall |
10 | * @license http://www.opensource.org/licenses/bsd-license.php BSD License |
12 | * @license http://www.opensource.org/licenses/bsd-license.php BSD License |
11 | * @link http://www.dominicsayers.com/isemail |
13 | * @see http://www.dominicsayers.com/isemail |
12 | * @version 1.17 - Upper length limit corrected to 254 characters; |
14 | * @version 1.17 - Upper length limit corrected to 254 characters; |
13 | * Java-Translation 2010-06-13 |
15 | * Java-Translation 2010-06-13 |
14 | */ |
16 | */ |
15 | 17 | ||
16 | /* |
18 | /* |
Line 615... | Line 617... | ||
615 | .doLookup(domain, DNSType.MX) > 0))) { |
617 | .doLookup(domain, DNSType.MX) > 0))) { |
616 | // Domain doesn't actually exist |
618 | // Domain doesn't actually exist |
617 | return EMailSyntaxDiagnosis.ISEMAIL_DOMAINNOTFOUND; |
619 | return EMailSyntaxDiagnosis.ISEMAIL_DOMAINNOTFOUND; |
618 | } |
620 | } |
619 | } catch (NamingException e) { |
621 | } catch (NamingException e) { |
- | 622 | // Resp.: Internal error |
|
620 | return EMailSyntaxDiagnosis.ISEMAIL_DOMAINNOTFOUND; |
623 | return EMailSyntaxDiagnosis.ISEMAIL_DOMAINNOTFOUND; |
621 | } |
624 | } |
622 | } |
625 | } |
623 | } |
626 | } |
624 | 627 | ||
Line 635... | Line 638... | ||
635 | * @param pos |
638 | * @param pos |
636 | * The position of the char to be replaced |
639 | * The position of the char to be replaced |
637 | * @param c |
640 | * @param c |
638 | * The new char |
641 | * The new char |
639 | * @return The new String |
642 | * @return The new String |
640 | * @see http://www.rgagnon.com/javadetails/java-0030.html |
643 | * @see Source: http://www.rgagnon.com/javadetails/java-0030.html |
641 | */ |
644 | */ |
642 | public static String replaceCharAt(String s, int pos, char c) { |
645 | public static String replaceCharAt(String s, int pos, char c) { |
643 | return s.substring(0, pos) + c + s.substring(pos + 1); |
646 | return s.substring(0, pos) + c + s.substring(pos + 1); |
644 | } |
647 | } |
645 | 648 |