(String host)
| 611 | } |
| 612 | |
| 613 | private boolean isValidDomainName(String host) { |
| 614 | try { |
| 615 | URIEncoderDecoder.validateSimple(host, "-."); //$NON-NLS-1$ |
| 616 | } catch (URISyntaxException e) { |
| 617 | return false; |
| 618 | } |
| 619 | |
| 620 | String label = null; |
| 621 | StringTokenizer st = new StringTokenizer(host, "."); //$NON-NLS-1$ |
| 622 | while (st.hasMoreTokens()) { |
| 623 | label = st.nextToken(); |
| 624 | if (label.startsWith("-") || label.endsWith("-")) { //$NON-NLS-1$ //$NON-NLS-2$ |
| 625 | return false; |
| 626 | } |
| 627 | } |
| 628 | |
| 629 | if (!label.equals(host)) { |
| 630 | char ch = label.charAt(0); |
| 631 | if (ch >= '0' && ch <= '9') { |
| 632 | return false; |
| 633 | } |
| 634 | } |
| 635 | return true; |
| 636 | } |
| 637 | |
| 638 | private boolean isValidIPv4Address(String host) { |
| 639 | int index; |
no test coverage detected