Some Eclipse Foundation services are deprecated, or will be soon. Please ensure you've read this important communication.

Bug 357889

Summary: NPE when using publishSmart and ignore
Product: [WebTools] WTP ServerTools Reporter: Rajeev Dayal <rdayal>
Component: wst.serverAssignee: wst.server <wst.server-inbox>
Status: NEW --- QA Contact: Elson Yuen <eyuen7>
Severity: normal    
Priority: P3    
Version: unspecified   
Target Milestone: ---   
Hardware: PC   
OS: Linux   
Whiteboard:

Description Rajeev Dayal CLA 2011-09-15 17:45:15 EDT
Build Identifier:  20110615-0604

When using ignore paths with publishSmart, an NPE can occur if any of the ignored paths have subdirectories. 

Take a look at lines 349-370:

http://dev.eclipse.org/viewcvs/viewvc.cgi/servertools/plugins/org.eclipse.wst.server.core/servercore/org/eclipse/wst/server/core/util/PublishHelper.java?view=markup&revision=1.9&root=WebTools_Project

If you have an ignore path (suppose WEB-INF/foo), and a subdirectory of WEB-INF/foo exists on disk (such as WEB-INF/foo/bar), then, at the point in the recursion where WEB-INF is being processed as the path, and the ignore list is "foo", an empty element is going to be added to ignoreChildPaths at line 360. 

In the following recursive call, the path to be processed will be WEB-INF/foo, and the ignore list will be an array of 1 element, containing an empty path. At line 359, there will be an NPE, because preservePath.segment(0) will be null.




Reproducible: Always