Some Eclipse Foundation services are deprecated, or will be soon. Please ensure you've read this important communication.

Bug 285941

Summary: hyperlink detector does not check word boundaries
Product: z_Archived Reporter: Steffen Pingel <steffen.pingel>
Component: MylynAssignee: Frank Becker <eclipse>
Status: RESOLVED FIXED QA Contact:
Severity: normal    
Priority: P3 CC: robert.elves
Version: unspecified   
Target Milestone: 3.3.2   
Hardware: PC   
OS: Linux   
Whiteboard:
Attachments:
Description Flags
commited patch
none
mylyn/context/zip
none
new patch
none
mylyn/context/zip
none
commited patch
none
mylyn/context/zip none

Description Steffen Pingel CLA 2009-08-06 16:50:52 EDT
From bug 262515, comment 8:

I have connected to that host using putty.exe and there:
$ ssh -v -v -v testcvs@localhost
debug1: Reading configuration data /etc/ssh/ssh_config
debug1: Applying options for *

"bug1" should not be highlightes as a link.
Comment 1 Frank Becker CLA 2009-11-08 14:40:52 EST
Created attachment 151652 [details]
commited patch
Comment 2 Frank Becker CLA 2009-11-08 14:40:55 EST
Created attachment 151653 [details]
mylyn/context/zip
Comment 3 Frank Becker CLA 2009-11-08 14:42:43 EST
patch is commited bug and task must have a leading space.
Comment 4 Steffen Pingel CLA 2009-11-09 12:05:13 EST
Hyperlink detection now fails if there is no space before "bug", e.g. if it's on a new line:
bug 123

We should also add a few test cases to BugzillaTaskHyperlinkTest to make sure we have this case and the cases mentioned in the description covered.
Comment 5 Frank Becker CLA 2009-11-09 16:14:05 EST
Created attachment 151735 [details]
new patch

(In reply to comment #4)
> Hyperlink detection now fails if there is no space before "bug", e.g. if it's
> on a new line:
> bug 123
> 
> We should also add a few test cases to BugzillaTaskHyperlinkTest to make sure
> we have this case and the cases mentioned in the description covered.

OK I now change the regexp so that withespace and linestart can be before bug and task.

Steffen,

do you want to verify this before commit?
Comment 6 Frank Becker CLA 2009-11-09 16:14:10 EST
Created attachment 151736 [details]
mylyn/context/zip
Comment 7 Steffen Pingel CLA 2009-11-09 16:47:53 EST
This looks better but there is some duplication in the regexp now and we are missing a bunch of cases, e.g. if other characters such as ":" "," "." are used before "bug".
Comment 8 Frank Becker CLA 2009-11-09 16:59:56 EST
(In reply to comment #7)
> This looks better but there is some duplication in the regexp now and we are
> missing a bunch of cases, e.g. if other characters such as ":" "," "." are used
> before "bug".

Should I use (\\W|^)+ for matching linestart or any non wordcharacter

and not 

(\\s|^)+ for matching linestart or whitespace.
Comment 9 Steffen Pingel CLA 2009-12-09 14:16:27 EST
Yes, you could try that. Just make sure that we have test cases to test for common cases, I am not sure how word boundaries are defined exactly. You could try \p{Punct} or specify a list of separators.
Comment 10 Frank Becker CLA 2009-12-17 16:25:20 EST
Created attachment 154709 [details]
commited patch
Comment 11 Frank Becker CLA 2009-12-17 16:25:27 EST
Created attachment 154710 [details]
mylyn/context/zip
Comment 12 Frank Becker CLA 2009-12-17 16:26:23 EST
patch is now in HEAD