Bug 251786 - [Content Type] ContentTypeCatalog uses the first content type's description only
Summary: [Content Type] ContentTypeCatalog uses the first content type's description only
Status: REOPENED
Alias: None
Product: Platform
Classification: Eclipse Project
Component: Resources (show other bugs)
Version: 3.5   Edit
Hardware: PC Windows XP
: P3 normal (vote)
Target Milestone: ---   Edit
Assignee: Nitin Dahyabhai CLA
QA Contact:
URL:
Whiteboard:
Keywords:
Depends on:
Blocks: 258343
  Show dependency tree
 
Reported: 2008-10-22 17:55 EDT by Nick Sandonato CLA
Modified: 2020-05-14 14:42 EDT (History)
6 users (show)

See Also:


Attachments
xmlcontentdescriber patch (884 bytes, patch)
2008-12-10 16:16 EST, Nick Sandonato CLA
no flags Details | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Nick Sandonato CLA 2008-10-22 17:55:30 EDT
The method getDescriptionFor(ContentTypeMatcher, ILazySource, String, QualifiedName[]) in ContentTypeCatalog will only process the description for the first content type in the selected array, even if it turns out that the content for that type is invalid.

If a content type is determined to be invalid (i.e., the call to internalGetDescriptionFor returns null), could the other  content types be checked for validity or is the priority of the first element so high that no others can be checked?

The case that we have is another XML content describer that is not able to try and describe the content because XMLContentDescriber is the first in the selected queue. The XMLContentDescriber identifies something like the encoding as invalid, whereas our content describer may be a little more forgiving in identifying the content so that we can associate our editor with the file.
Comment 1 Szymon Brandys CLA 2008-10-23 10:14:58 EDT
Interesting case. I'll look at it.
Comment 2 Nick Sandonato CLA 2008-12-10 16:16:35 EST
Created attachment 120120 [details]
xmlcontentdescriber patch

I'm attaching a patch that doesn't change the ContentTypeCatalog at all. Instead, to address our problems, I've changed the XMLContentDescriber so that when the description == null, it's described as INDETERMINATE instead of VALID.

This permits our content describer to declare itself VALID and have a higher priority than the INDERTMINATE XMLContentDescriber for some malformed XML that our editor can handle (e.g., <?xml version="1.0" encoding=""?>).
Comment 3 Szymon Brandys CLA 2008-12-11 08:17:35 EST
One runtime test fails with the patch. This can be problem with the test itself, however I'm not looking at it now.
Comment 4 David Carver CLA 2009-01-05 11:12:07 EST
(In reply to comment #3)
> One runtime test fails with the patch. This can be problem with the test
> itself, however I'm not looking at it now.
> 

Which unit test is failing, I might have some time to take a look and provide a patch.
Comment 5 Nick Sandonato CLA 2011-03-07 16:04:39 EST
Hi, Szymon. I know it's been quite awhile, but is there any way this can be revisted?
Comment 6 Szymon Brandys CLA 2015-04-01 09:50:40 EDT
I am no longer involved in Platform Core development.
Comment 7 Mickael Istria CLA 2017-07-12 04:56:44 EDT
@Nick: could you please rebase your patch on top of master and submit it via Gerrit? Also, it would be nice if you could add some automated tests for the issue you got to prevent from regressions.
Comment 8 Eclipse Genie CLA 2020-03-27 18:47:15 EDT
This bug hasn't had any activity in quite some time. Maybe the problem got resolved, was a duplicate of something else, or became less pressing for some reason - or maybe it's still relevant but just hasn't been looked at yet. As such, we're closing this bug.

If you have further information on the current state of the bug, please add it and reopen this bug. The information can be, for example, that the problem still occurs, that you still want the feature, that more information is needed, or that the bug is (for whatever reason) no longer relevant.

--
The automated Eclipse Genie.
Comment 9 Mickael Istria CLA 2020-03-28 04:04:41 EDT
This is still an issue, and still worth a fix at some point.
Comment 10 Lars Vogel CLA 2020-05-11 15:53:23 EDT
Please reopen if the problem still persists.
Comment 11 Eclipse Genie CLA 2020-05-11 17:34:20 EDT
New Gerrit change created: https://git.eclipse.org/r/162854
Comment 13 Andrey Loskutov CLA 2020-05-13 14:11:38 EDT
This causes regression in platform resources tests, please check bug 563139. May be test must be updated, may be the patch here.