Skip to main content
summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorfbecker2010-07-06 18:31:21 +0000
committerfbecker2010-07-06 18:31:21 +0000
commit479a33239358219c723f7cc8fe68d2ac54a1bc04 (patch)
treec49cfe48bd17c90499b718d9437f9291bed7cc25 /org.eclipse.mylyn.bugzilla.ui
parentee395092b1bc9444cb92d43e25cef116ef651939 (diff)
downloadorg.eclipse.mylyn.tasks-479a33239358219c723f7cc8fe68d2ac54a1bc04.tar.gz
org.eclipse.mylyn.tasks-479a33239358219c723f7cc8fe68d2ac54a1bc04.tar.xz
org.eclipse.mylyn.tasks-479a33239358219c723f7cc8fe68d2ac54a1bc04.zip
ASSIGNED - bug 304078: [patch] validate URLs pasted into query wizard
https://bugs.eclipse.org/bugs/show_bug.cgi?id=304078
Diffstat (limited to 'org.eclipse.mylyn.bugzilla.ui')
-rw-r--r--org.eclipse.mylyn.bugzilla.ui/src/org/eclipse/mylyn/internal/bugzilla/ui/tasklist/BugzillaCustomQueryWizardPage.java14
-rw-r--r--org.eclipse.mylyn.bugzilla.ui/src/org/eclipse/mylyn/internal/bugzilla/ui/tasklist/Messages.java2
2 files changed, 15 insertions, 1 deletions
diff --git a/org.eclipse.mylyn.bugzilla.ui/src/org/eclipse/mylyn/internal/bugzilla/ui/tasklist/BugzillaCustomQueryWizardPage.java b/org.eclipse.mylyn.bugzilla.ui/src/org/eclipse/mylyn/internal/bugzilla/ui/tasklist/BugzillaCustomQueryWizardPage.java
index 6a9b8891a..c2307f2a9 100644
--- a/org.eclipse.mylyn.bugzilla.ui/src/org/eclipse/mylyn/internal/bugzilla/ui/tasklist/BugzillaCustomQueryWizardPage.java
+++ b/org.eclipse.mylyn.bugzilla.ui/src/org/eclipse/mylyn/internal/bugzilla/ui/tasklist/BugzillaCustomQueryWizardPage.java
@@ -12,6 +12,9 @@
package org.eclipse.mylyn.internal.bugzilla.ui.tasklist;
+import java.util.regex.Matcher;
+import java.util.regex.Pattern;
+
import org.eclipse.jface.dialogs.Dialog;
import org.eclipse.mylyn.internal.bugzilla.core.IBugzillaConstants;
import org.eclipse.mylyn.tasks.core.IRepositoryQuery;
@@ -42,6 +45,8 @@ public class BugzillaCustomQueryWizardPage extends AbstractRepositoryQueryPage {
private static final String DESCRIPTION = Messages.BugzillaCustomQueryWizardPage_Enter_the_title_and_URL_for_the_query;
+ private static final Pattern URL_PATTERN = Pattern.compile("([a-zA-Z][a-zA-Z+.-]{0,10}://[a-zA-Z0-9%._~!$&?#'()*+,;:@/=-]*/buglist.cgi?[a-zA-Z0-9%_~!$&?#'(*+;:@/=-])"); //$NON-NLS-1$
+
private Text queryText;
private final IRepositoryQuery query;
@@ -109,7 +114,14 @@ public class BugzillaCustomQueryWizardPage extends AbstractRepositoryQueryPage {
public boolean isPageComplete() {
if (super.isPageComplete()) {
if (queryText.getText().length() > 0) {
- return true;
+ Matcher m = URL_PATTERN.matcher(queryText.getText());
+ if (m.find()) {
+ return true;
+ } else {
+ setErrorMessage(Messages.BugzillaCustomQueryWizardPage_No_Valid_Buglist_URL);
+
+ return false;
+ }
}
setErrorMessage(Messages.BugzillaCustomQueryWizardPage_Please_specify_Query_URL);
}
diff --git a/org.eclipse.mylyn.bugzilla.ui/src/org/eclipse/mylyn/internal/bugzilla/ui/tasklist/Messages.java b/org.eclipse.mylyn.bugzilla.ui/src/org/eclipse/mylyn/internal/bugzilla/ui/tasklist/Messages.java
index e6a891a5b..b845fa2b6 100644
--- a/org.eclipse.mylyn.bugzilla.ui/src/org/eclipse/mylyn/internal/bugzilla/ui/tasklist/Messages.java
+++ b/org.eclipse.mylyn.bugzilla.ui/src/org/eclipse/mylyn/internal/bugzilla/ui/tasklist/Messages.java
@@ -41,6 +41,8 @@ public class Messages extends NLS {
public static String BugzillaCustomQueryWizardPage_Enter_the_title_and_URL_for_the_query;
+ public static String BugzillaCustomQueryWizardPage_No_Valid_Buglist_URL;
+
public static String BugzillaCustomQueryWizardPage_Please_specify_Query_URL;
public static String BugzillaCustomQueryWizardPage_Query_Title;

Back to the top