Skip to main content
summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--org.eclipse.mylyn.bugzilla.tests/src/org/eclipse/mylyn/bugzilla/tests/ui/BugzillaHyperlinkDetectorTest.java9
-rw-r--r--org.eclipse.mylyn.bugzilla.ui/src/org/eclipse/mylyn/internal/bugzilla/ui/tasklist/BugzillaConnectorUi.java8
2 files changed, 12 insertions, 5 deletions
diff --git a/org.eclipse.mylyn.bugzilla.tests/src/org/eclipse/mylyn/bugzilla/tests/ui/BugzillaHyperlinkDetectorTest.java b/org.eclipse.mylyn.bugzilla.tests/src/org/eclipse/mylyn/bugzilla/tests/ui/BugzillaHyperlinkDetectorTest.java
index 5cb276c3b..c0140a506 100644
--- a/org.eclipse.mylyn.bugzilla.tests/src/org/eclipse/mylyn/bugzilla/tests/ui/BugzillaHyperlinkDetectorTest.java
+++ b/org.eclipse.mylyn.bugzilla.tests/src/org/eclipse/mylyn/bugzilla/tests/ui/BugzillaHyperlinkDetectorTest.java
@@ -11,6 +11,8 @@
package org.eclipse.mylyn.bugzilla.tests.ui;
+import java.util.Arrays;
+
import junit.framework.TestCase;
import org.eclipse.jface.text.Region;
@@ -42,7 +44,8 @@ public class BugzillaHyperlinkDetectorTest extends TestCase {
private void assertHyperlinks(String string, IHyperlink... expected) {
IHyperlink[] links = connector.findHyperlinks(repository, task, string, -1, 0);
if (expected.length == 0) {
- assertNull(links);
+ assertNull("Expected no hyperlinks, but got: " + ((links != null) ? Arrays.asList(links).toString() : ""),
+ links);
return;
}
assertNotNull("Expected hyperlinks in " + string, links);
@@ -129,6 +132,10 @@ public class BugzillaHyperlinkDetectorTest extends TestCase {
assertHyperlinks("bug 123 bug 456", link(0, 7, "123"), link(20, 7, "456"));
}
+ public void testFindHyperlinksLinebreak() {
+ assertHyperlinks("bug\n456");
+ }
+
public void testFindHyperlinksNoAttachment() {
assertHyperlinks("attachment");
assertHyperlinks("attachmen 123");
diff --git a/org.eclipse.mylyn.bugzilla.ui/src/org/eclipse/mylyn/internal/bugzilla/ui/tasklist/BugzillaConnectorUi.java b/org.eclipse.mylyn.bugzilla.ui/src/org/eclipse/mylyn/internal/bugzilla/ui/tasklist/BugzillaConnectorUi.java
index e62da09b0..1a57f3702 100644
--- a/org.eclipse.mylyn.bugzilla.ui/src/org/eclipse/mylyn/internal/bugzilla/ui/tasklist/BugzillaConnectorUi.java
+++ b/org.eclipse.mylyn.bugzilla.ui/src/org/eclipse/mylyn/internal/bugzilla/ui/tasklist/BugzillaConnectorUi.java
@@ -53,13 +53,13 @@ import org.eclipse.mylyn.tasks.ui.wizards.RepositoryQueryWizard;
*/
public class BugzillaConnectorUi extends AbstractRepositoryConnectorUi {
- private static final String BUG = "(?:duplicate of|bug|task)\\s*#?\\s*(\\d+)"; //$NON-NLS-1$
+ private static final String BUG = "(?:duplicate of|bug|task)[ \t]*#?[ \t]*(\\d+)"; //$NON-NLS-1$
- private static final String COMMENT = "comment\\s*#?\\s*(\\d+)"; //$NON-NLS-1$
+ private static final String COMMENT = "comment[ \t]*#?[ \t]*(\\d+)"; //$NON-NLS-1$
- private static final String REGEXP_BUG = "(?:\\W||^)(" + BUG + "(?:\\s*" + COMMENT + ")?)|(" + COMMENT + ")"; //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$
+ private static final String REGEXP_BUG = "(?:\\W||^)(" + BUG + "(?:[ \t]*" + COMMENT + ")?)|(" + COMMENT + ")"; //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$
- private static final String REGEXP_ATTACHMENT = "(?:Created (?:an )?)?attachment\\s*#?\\s*(?:\\(id=)?(\\d+)\\)?"; //$NON-NLS-1$
+ private static final String REGEXP_ATTACHMENT = "(?:Created (?:an )?)?attachment[ \t]*#?[ \t]*(?:\\(id=)?(\\d+)\\)?"; //$NON-NLS-1$
private static final Pattern PATTERN_BUG = Pattern.compile(REGEXP_BUG, Pattern.CASE_INSENSITIVE);

Back to the top