Some Eclipse Foundation services are deprecated, or will be soon. Please ensure you've read this important communication.
Bug 367860 - Avoid IllegalArgumentException in Validation filters
Summary: Avoid IllegalArgumentException in Validation filters
Status: RESOLVED FIXED
Alias: None
Product: WTP Common Tools
Classification: WebTools
Component: wst.validation (show other bugs)
Version: 3.3.1   Edit
Hardware: PC Windows XP
: P3 normal (vote)
Target Milestone: 3.3.2   Edit
Assignee: Rosendo Martinez CLA
QA Contact: Chuck Bridgham CLA
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2012-01-04 10:30 EST by Rosendo Martinez CLA
Modified: 2012-01-11 11:50 EST (History)
2 users (show)

See Also:
cbridgha: review+


Attachments
Proposed R3_3_maintenance patch (2.22 KB, patch)
2012-01-04 13:25 EST, Rosendo Martinez CLA
shr31223: iplog+
Details | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Rosendo Martinez CLA 2012-01-04 10:30:19 EST
Build Identifier: 

There have been IllegalArgumentException exceptions when trying to set validation filter rules, Facet and Target Runtime.

Adding try/catch to avoid them.

Reproducible: Always
Comment 1 Rosendo Martinez CLA 2012-01-04 13:25:40 EST
Created attachment 209028 [details]
Proposed R3_3_maintenance patch
Comment 2 Chuck Bridgham CLA 2012-01-05 17:07:31 EST
Rosendo - can you provide more details?  I don't like to ignore exceptions unless we have a very clear reason.
Comment 3 Rosendo Martinez CLA 2012-01-06 10:51:07 EST
Sure, here they are:

1. Time ago there was a requirement to display not only the facet, project nature  and content type ids, but also the names of those filter types in the Validation Filters dialog , see the Bug 302914. 

The main idea was to display the filter rules as following:

Name - id

2. To get the name, the following APIs were used:

ProjectFacetsManager.getProjectFacet(id)
ResourcesPlugin.getWorkspace().getNatureDescriptor(String)
RuntimeManager.getRuntime(id)

Some of those meths throw an IllegalArgumentException exception when the id does not exist in the current workspace facets, so the name is not returned.

3. To avoid that exception, I am adding try/catch pairs. When the exception is thrown, the catch does not need to do something in particular since only the id will be displayed, with no name before it.

Please, let me know any comment/question.
Comment 4 Chuck Bridgham CLA 2012-01-11 09:16:36 EST
ok I approve...  if the runtime or facet is not recognized...  we will handle nicely in this case.
Comment 5 Roberto Sanchez Herrera CLA 2012-01-11 11:50:26 EST
Code committed to R3_3_maintenance and HEAD for WTP 3.3.2 and 3.4. Resolving defect