Bug 302587 - Encoding/decoding of problem arguments in Marker fails if argument contains #
Summary: Encoding/decoding of problem arguments in Marker fails if argument contains #
Status: VERIFIED FIXED
Alias: None
Product: JDT
Classification: Eclipse Project
Component: Core (show other bugs)
Version: 3.6   Edit
Hardware: PC Windows XP
: P3 normal (vote)
Target Milestone: 3.6 M6   Edit
Assignee: Olivier Thomann CLA
QA Contact:
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2010-02-11 10:13 EST by Markus Keller CLA
Modified: 2010-03-15 05:50 EDT (History)
1 user (show)

See Also:


Attachments
Proposed fix + regression tests (11.32 KB, patch)
2010-02-11 14:21 EST, Olivier Thomann CLA
no flags Details | Diff
More regression tests (12.87 KB, patch)
2010-02-11 14:33 EST, Olivier Thomann CLA
no flags Details | Diff

Note You need to log in before you can comment on or make changes to this bug.
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.