This Bugzilla instance is deprecated, and most Eclipse projects now use GitHub or Eclipse GitLab. Please see the deprecation plan for details.
Bug 218326 - "No grammar constraints" warnings for system files in the Problems view
Summary: "No grammar constraints" warnings for system files in the Problems view
Status: CLOSED FIXED
Alias: None
Product: WTP Source Editing
Classification: WebTools
Component: wst.xml (show other bugs)
Version: 3.0   Edit
Hardware: PC Windows XP
: P2 normal (vote)
Target Milestone: 3.0 M5   Edit
Assignee: Valentin Baciu CLA
QA Contact: Nitin Dahyabhai CLA
URL:
Whiteboard:
Keywords:
Depends on:
Blocks: 219238
  Show dependency tree
 
Reported: 2008-02-08 11:04 EST by Kaloyan Raev CLA
Modified: 2008-08-04 09:39 EDT (History)
6 users (show)

See Also:
thatnitind: review+


Attachments
screenshot (82.38 KB, image/png)
2008-02-08 11:05 EST, Kaloyan Raev CLA
no flags Details
patch to add some exclusion rules (1.20 KB, patch)
2008-02-11 07:55 EST, Gary Karasiuk CLA
no flags Details | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Kaloyan Raev CLA 2008-02-08 11:04:10 EST
Steps to reproduce:
1. Open the Java EE perspective. 
2. Create a Web project (or EJB project, or else). 
3. Look at the Problems view. 

There are warnings stating:

    No grammar constraints (DTD or XML schema) detected for the document.

While, in general, this warnings are a good thing, they should not be fired for system XML files like: .project, .classpath, files in .settings, etc. 

Messages (warnings and errors) in the Problems view are for the user and it is expected some action by him/her to resolve them. In this particular case the user cannot take any adequate action and these warnings are frustrating for him/her.
Comment 1 Kaloyan Raev CLA 2008-02-08 11:05:31 EST
Created attachment 89260 [details]
screenshot

See the attachment to see how this looks to the user. The Problem view is actually flooded with such warnings.
Comment 2 Valentin Baciu CLA 2008-02-08 11:12:18 EST
Gary, I'm just speculating here but the XML validator has recently been ported to the new validation framework. At the same time the option to report a missing grammar has been swiched to true by default. So perhaps this combination of changes is producing these warnings.

I think the new validation framework will have to avoid passing these system files to the XML validator.
Comment 3 Gary Karasiuk CLA 2008-02-11 07:30:59 EST
(In reply to comment #2)
I think the framework is currently working "as designed".

There is no such thing as a "system" file. (In looking through the documentation on IResource there are derived files, hidden files and team private files, but no concept of a system file).

Since these files all have a content type of XML, and since the XML validator is asking to validate all files with an XML content type, the framework is passing the validator the correct files.

I wonder if the proper fix would be to add .project, .classpath and .settings to an exclusion rule for the XML validator. What do you think? This would require an enhancement to the framework, to be able to specify unqualified file names. (Right now you could specify "MyProject/.project" but there is no way to just specify ".project")



Comment 4 Kaloyan Raev CLA 2008-02-11 07:46:45 EST
Gary, I am not arguing about the functional correctness of the validation framework. It's all about usability and the user's perspective. 

Yes, the idea of exclusion rule is a possible solution. 
Another one, and may be better from design point of view, is to provide DTD or XML schemas for all XML-based "system" files. But I am not sure who would be responsible for this and whether it could be achieved in the Ganymede timeframe. 
Comment 5 Gary Karasiuk CLA 2008-02-11 07:55:52 EST
Created attachment 89393 [details]
patch to add some exclusion rules

If we go the exclusion rule route, here is a patch that will stop the warnings (and the validation) for common "system" files that are created in a dynamic web application.
Comment 6 Gary Karasiuk CLA 2008-02-11 07:57:16 EST
(In reply to comment #4)
> Gary, I am not arguing about the functional correctness of the validation
> framework. It's all about usability and the user's perspective. 

Sorry I didn't mean to sound defensive. I agree with you that this is a usability problem that needs to be fixed.
 

Comment 7 Gary Karasiuk CLA 2008-02-11 08:00:21 EST
(In reply to comment #3)
> 
> I wonder if the proper fix would be to add .project, .classpath and .settings
> to an exclusion rule for the XML validator. What do you think? This would
> require an enhancement to the framework, to be able to specify unqualified file
> names. (Right now you could specify "MyProject/.project" but there is no way to
> just specify ".project")
> 
I was wrong about this. The framework does support this now (as shown by the patch that I just submitted). By "supports this now", I mean that it currently supports project relative file and folder names. 
Comment 8 Gary Karasiuk CLA 2008-02-11 08:02:58 EST
In looking at the XML validator's plugin.xml I see:

<projectNature id="org.eclipse.jst.j2ee.ejb.EJBNature"/>
<projectNature id="org.eclipse.jst.j2ee.EARNature"/>

Are these natures right? I didn't see the EAR one, when I created a new ear project. 
Comment 9 Kaloyan Raev CLA 2008-02-11 08:12:23 EST
(In reply to comment #8)
> In looking at the XML validator's plugin.xml I see:
> 
> <projectNature id="org.eclipse.jst.j2ee.ejb.EJBNature"/>
> <projectNature id="org.eclipse.jst.j2ee.EARNature"/>
> 
> Are these natures right? I didn't see the EAR one, when I created a new ear
> project. 
> 

Hmm, as far as I know Java EE projects are based on facets - not on natures. May be these <projectNature> tags are some legacy. I add Chuck and Kosta in CC to comment on this. 
Comment 10 Kaloyan Raev CLA 2008-02-11 08:27:49 EST
(In reply to comment #5)
> Created an attachment (id=89393) [details]
> patch to add some exclusion rules
> 
> If we go the exclusion rule route, here is a patch that will stop the warnings
> (and the validation) for common "system" files that are created in a dynamic
> web application.
> 

I've tried the patch. It does a good job. All "extra" warnings have disappeared. Just to remark: this patch applies the exclusion rule to all kinds of project - not only dynamic web project. This is correct!
Comment 11 Konstantin Komissarchik CLA 2008-02-11 10:25:26 EST
Regarding the natures, that looks like some old code dating back to WTP 0.7 days that should be updated. All WTP projects use facets rather than natures.
Comment 12 Valentin Baciu CLA 2008-02-15 09:54:31 EST
David, I'd like to request approval to commit and release this fix for M5.
Comment 13 Nitin Dahyabhai CLA 2008-02-15 11:14:09 EST
While I don't agree with the implied severity of this bug causing us to respin, it does appear to be a safe workaround regardless.  A better fix would be to tell the framework to ignore a set of resources outright, not just per validator.
Comment 14 Valentin Baciu CLA 2008-02-15 11:49:41 EST
All XML core and XML validation unit tests are green.

Fix committed and released for WTP 3.0 M5 builds > v200802151147.

I tend to agree with Nitin that for the long term the fix should go in the framework, perhaps by providing a customizable set of resources to ignore for all validators.
Comment 15 Kaloyan Raev CLA 2008-08-04 09:39:17 EDT
Verified with the official Ganymede release.