Skip to main content
aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorTobias Schwarz2013-06-13 09:18:21 +0000
committerTobias Schwarz2013-06-24 05:22:16 +0000
commitd8ffd34268b2e7be7bd4120c0ffab4b550030616 (patch)
tree636508a513fc5ba926a5355ab2462aad15932f19 /target_explorer
parent3baa73c50a63c8c4b00abb0b7b66e831e30500e3 (diff)
downloadorg.eclipse.tcf-d8ffd34268b2e7be7bd4120c0ffab4b550030616.tar.gz
org.eclipse.tcf-d8ffd34268b2e7be7bd4120c0ffab4b550030616.tar.xz
org.eclipse.tcf-d8ffd34268b2e7be7bd4120c0ffab4b550030616.zip
Target Explorer: fix hostname validation
Diffstat (limited to 'target_explorer')
-rw-r--r--target_explorer/plugins/org.eclipse.tcf.te.ui.controls/src/org/eclipse/tcf/te/ui/controls/validator/NameOrIPValidator.java4
-rw-r--r--target_explorer/plugins/org.eclipse.tcf.te.ui.controls/src/org/eclipse/tcf/te/ui/controls/validator/NameOrIPVerifyListener.java13
2 files changed, 8 insertions, 9 deletions
diff --git a/target_explorer/plugins/org.eclipse.tcf.te.ui.controls/src/org/eclipse/tcf/te/ui/controls/validator/NameOrIPValidator.java b/target_explorer/plugins/org.eclipse.tcf.te.ui.controls/src/org/eclipse/tcf/te/ui/controls/validator/NameOrIPValidator.java
index f4862af56..f758910f8 100644
--- a/target_explorer/plugins/org.eclipse.tcf.te.ui.controls/src/org/eclipse/tcf/te/ui/controls/validator/NameOrIPValidator.java
+++ b/target_explorer/plugins/org.eclipse.tcf.te.ui.controls/src/org/eclipse/tcf/te/ui/controls/validator/NameOrIPValidator.java
@@ -16,12 +16,12 @@ package org.eclipse.tcf.te.ui.controls.validator;
public class NameOrIPValidator extends Validator {
// regular expressions for validator
- private static final String IP_CHARACTERS_REGEX = "[0-9\\.]+"; //$NON-NLS-1$
+ private static final String IP_CHARACTERS_REGEX = "[0-9][0-9\\.]*"; //$NON-NLS-1$
public static final String IP_REGEX = NameOrIPVerifyListener.IP_FRAGMENT_REGEX + "(\\." + //$NON-NLS-1$
NameOrIPVerifyListener.IP_FRAGMENT_REGEX + "){3}[ ]*"; //$NON-NLS-1$
// RFC 1034 - ftp://ftp.rfc-editor.org/in-notes/std/std13.txt
- private static final String NAME_CHARACTERS_REGEX = "[0-9a-zA-Z\\-_\\.]+"; //$NON-NLS-1$
+ private static final String NAME_CHARACTERS_REGEX = "[a-zA-Z][0-9a-zA-Z\\-_\\.]*"; //$NON-NLS-1$
public static final String NAME_REGEX = NameOrIPVerifyListener.NAME_FRAGMENT_REGEX + "(\\." + //$NON-NLS-1$
NameOrIPVerifyListener.NAME_FRAGMENT_REGEX + ")*[ ]*"; //$NON-NLS-1$
diff --git a/target_explorer/plugins/org.eclipse.tcf.te.ui.controls/src/org/eclipse/tcf/te/ui/controls/validator/NameOrIPVerifyListener.java b/target_explorer/plugins/org.eclipse.tcf.te.ui.controls/src/org/eclipse/tcf/te/ui/controls/validator/NameOrIPVerifyListener.java
index c4a721832..cfab6b4d2 100644
--- a/target_explorer/plugins/org.eclipse.tcf.te.ui.controls/src/org/eclipse/tcf/te/ui/controls/validator/NameOrIPVerifyListener.java
+++ b/target_explorer/plugins/org.eclipse.tcf.te.ui.controls/src/org/eclipse/tcf/te/ui/controls/validator/NameOrIPVerifyListener.java
@@ -19,14 +19,13 @@ public class NameOrIPVerifyListener extends RegexVerifyListener {
private static final String NAME_START_REGEX = "[a-zA-Z]"; //$NON-NLS-1$
// characters that can be set after the starting character
private static final String NAME_FOLLOW_REGEX = "[a-zA-Z0-9-_]"; //$NON-NLS-1$
- // allowed separators in fragments
- private static final String NAME_SEPERATOR_REGEX = "(\\-|_)"; //$NON-NLS-1$
- // complete name fragment
- public static final String NAME_FRAGMENT_REGEX = "(" + NAME_START_REGEX + NAME_FOLLOW_REGEX + "*)"; //$NON-NLS-1$ //$NON-NLS-2$
+ // characters that can be set at the end
+ private static final String NAME_END_REGEX = "[a-zA-Z0-9]"; //$NON-NLS-1$
+ // single name fragment
+ public static final String NAME_FRAGMENT_REGEX = "(" + NAME_START_REGEX + "(" + NAME_FOLLOW_REGEX + "*" + NAME_END_REGEX + ")?)"; //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$
// open name fragment during typing
- private static final String OPEN_NAME_FRAGMENT_REGEX =
- "(" + NAME_FRAGMENT_REGEX + NAME_SEPERATOR_REGEX + "?)"; //$NON-NLS-1$ //$NON-NLS-2$
- // multiple
+ public static final String OPEN_NAME_FRAGMENT_REGEX = "(" + NAME_START_REGEX + NAME_FOLLOW_REGEX + "*)"; //$NON-NLS-1$ //$NON-NLS-2$
+ // open name during typing
public static final String OPEN_NAME_REGEX =
"((" + NAME_FRAGMENT_REGEX + "\\.)*" + OPEN_NAME_FRAGMENT_REGEX + "?)?[ ]*"; //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$

Back to the top