Some Eclipse Foundation services are deprecated, or will be soon. Please ensure you've read this important communication.
Bug 348801 - JavaEESingleRootCallback#hasDefaultWebResourceMappings returns errors for valid (but redundant) resource mappings
Summary: JavaEESingleRootCallback#hasDefaultWebResourceMappings returns errors for val...
Status: RESOLVED FIXED
Alias: None
Product: WTP Java EE Tools
Classification: WebTools
Component: jst.j2ee (show other bugs)
Version: 3.2.4   Edit
Hardware: PC Windows XP
: P3 normal (vote)
Target Milestone: 3.2.5   Edit
Assignee: Roberto Sanchez Herrera CLA
QA Contact: Chuck Bridgham CLA
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2011-06-08 16:10 EDT by Roberto Sanchez Herrera CLA
Modified: 2011-06-23 11:29 EDT (History)
1 user (show)

See Also:
cbridgha: review+


Attachments
Proposed patch (3.09 KB, patch)
2011-06-08 17:24 EDT, Roberto Sanchez Herrera CLA
no flags Details | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Roberto Sanchez Herrera CLA 2011-06-08 16:10:46 EDT
I have a web project with the following entries in the org.eclipse.wst.common.component file:

<?xml version="1.0" encoding="UTF-8"?>
<project-modules id="moduleCoreId" project-version="1.5.0">
    <wb-module deploy-name="MyWeb">
        <wb-resource deploy-path="/" source-path="/WebContent"/>
        <wb-resource deploy-path="/WEB-INF/classes" source-path="/src"/>
        <wb-resource deploy-path="/WEB-INF/web.xml" source-path="/WebContent/WEB-INF/web.xml"/>
        <property name="context-root" value="MyWeb"/>
        <property name="java-output-path" value="/MyWeb/build/classes"/>
    </wb-module>
</project-modules>


The method JavaEESingleRootCallback#hasDefaultWebResourceMappings returns the error JavaEESingleRootCallback.RUNTIME_PATH_NOT_ROOT_OR_WEBINF_CLASSES (and therefore the project is not considered as single root) because of this entry:

<wb-resource deploy-path="/WEB-INF/web.xml" source-path="/WebContent/WEB-INF/web.xml"/>

But technically, that entry should not make the project non-single root, because 
there is another entry that maps everything under /WebContent to /. The entry is redundant and unnecessary , and we could warn the caller of this.
Comment 1 Roberto Sanchez Herrera CLA 2011-06-08 17:24:57 EDT
Created attachment 197649 [details]
Proposed patch

With this patch, a warning is returned (instead of an error) in JavaEESingleRootCallback#hasDefaultWebResourceMappings when a redundant entry is found. By redundant entry, I mean that the path mapped to / (in this case, /WebContent) concatenated to the deploy path of the entry (in this case, /WEB-INF/web.xml") is equals to the source path of the entry. This way, we would not allow entries that map files or folders to other folders different from the source path (e.g.,mapping /WebContent/WEB-INF/web.xml to /WEB-INF/otherFolder/web.xml)
Comment 2 Chuck Bridgham CLA 2011-06-20 16:40:14 EDT
approved
Comment 3 Roberto Sanchez Herrera CLA 2011-06-20 18:04:36 EDT
Code committed to R3_2_maintenance for WTP 3.2.5. I will keep this defect open
until branch for 3.3.1 is available to commit to 3.3.1 and HEAD
Comment 4 Roberto Sanchez Herrera CLA 2011-06-23 11:29:41 EDT
Committed to HEAD. That will cover WTP 3.3.1 and 3.4