Bug 302587

Summary: Encoding/decoding of problem arguments in Marker fails if argument contains #
Product: [Eclipse Project] JDT Reporter: Markus Keller <markus.kell.r>
Component: CoreAssignee: Olivier Thomann <Olivier_Thomann>
Status: VERIFIED FIXED QA Contact:
Severity: normal    
Priority: P3 CC: Olivier_Thomann
Version: 3.6   
Target Milestone: 3.6 M6   
Hardware: PC   
OS: Windows XP   
Whiteboard:
Attachments:
Description Flags
Proposed fix + regression tests
none
More regression tests none

Description Markus Keller CLA 2010-02-11 10:13:01 EST
Follow-up to bug 302470

The encoding/decoding of problem arguments in a Marker fails if the argument contains a "#".

Steps to reproduce:
- setup from bug 302470 comment 0
- select problem "The method getTaskListeners() is undefined for the type Task<capture#1-of ?>" in the Problems view
- Ctrl+1

In Util.getProblemArgumentsFromMarker(String), the arguments string is: "3:Task<capture#1-of ?>#getTaskListeners#   ".
=> The method fails and returns null because the first argument contains a "#"

Note that the encoding is specified in org.eclipse.jdt.core.IJavaModelMarker.ARGUMENTS, so this definition also needs to be fixed. Since this never worked in the past, it's OK to fix the encoding, as long as existing argument strings that don't contain arguments with a # keep their meaning.

Please also fix the Javadoc of IJavaModelMarker.ARGUMENTS:
- '{ } is encoded as "0: "' is wrong, that should end with "0:"
- the spec does not tell that empty argument strings are actually encoded as
  "   "
- the spec should contain @see CorrectionEngine#getProblemArguments(IMarker)

Encoding # inside an argument as ## would work (only because the empty argument is actually encoded as "   ").
Comment 1 Olivier Thomann CLA 2010-02-11 14:21:46 EST
Created attachment 158898 [details]
Proposed fix + regression tests
Comment 2 Olivier Thomann CLA 2010-02-11 14:33:08 EST
Created attachment 158901 [details]
More regression tests

Same patch with more regression tests.
Comment 3 Olivier Thomann CLA 2010-02-11 15:17:25 EST
Released for 3.6M6.
Regression tests added in:
org.eclipse.jdt.core.tests.model.UtilTests
Comment 4 Frederic Fusier CLA 2010-03-08 13:29:03 EST
Verified for 3.6M6 using build I20100307-2000.