[399017] Errors while attempting to work with JSP model when JSF/JSTL facets are installed
diff --git a/tests/org.eclipse.jst.jsp.core.tests/src/org/eclipse/jst/jsp/core/tests/util/FMCSTests.java b/tests/org.eclipse.jst.jsp.core.tests/src/org/eclipse/jst/jsp/core/tests/util/FMCSTests.java
index d0dbb0d..fabfb9f 100644
--- a/tests/org.eclipse.jst.jsp.core.tests/src/org/eclipse/jst/jsp/core/tests/util/FMCSTests.java
+++ b/tests/org.eclipse.jst.jsp.core.tests/src/org/eclipse/jst/jsp/core/tests/util/FMCSTests.java
@@ -12,7 +12,6 @@
 
 import java.io.IOException;
 
-import junit.framework.Test;
 import junit.framework.TestCase;
 
 import org.eclipse.core.resources.IProject;
@@ -24,19 +23,6 @@
 import org.eclipse.jst.jsp.core.tests.taglibindex.BundleResourceUtil;
 
 public class FMCSTests extends TestCase {
-
-	public FMCSTests(String name) {
-		super(name);
-	}
-
-	public FMCSTests() {
-		super();
-	}
-
-	public static Test suite() {
-		return new FMCSTests();
-	}
-
 	private IProject createProject(String name) throws CoreException {
 		IProject project = ResourcesPlugin.getWorkspace().getRoot().getProject(name);
 		if (!project.exists())
@@ -57,4 +43,22 @@
 
 		assertEquals("/BugDemo2/src/META-INF/resources/referenced.jsp", "" + FacetModuleCoreSupport.resolve(new Path("BugDemo1/WebContent/index.jsp"), "referenced.jsp"));
 	}
+	public void testFacetModuleAbstractionWithoutWebFragment() throws Exception {
+		IProject bd1 = createProject("BugDemo1");
+		IProject bd2 = createProject("BugDemo2");
+		BundleResourceUtil.copyBundleZippedEntriesIntoWorkspace("/testfiles/jsp_include_false_error.zip", Path.ROOT);
+
+		bd1.refreshLocal(IResource.DEPTH_INFINITE, null);
+		bd2.refreshLocal(IResource.DEPTH_INFINITE, null);
+
+		assertEquals("/BugDemo2/WEB-INF/web.xml", "" + FacetModuleCoreSupport.resolve(new Path("/BugDemo2/src/META-INF/resources/referenced.jsp"), "/WEB-INF/web.xml"));
+	}
+	public void testFacetModuleAbstractionInDynamicWebProject() throws Exception {
+		IProject bd1 = createProject("bug_399017");
+		BundleResourceUtil.copyBundleEntriesIntoWorkspace("/testfiles/bug_399017", bd1.getFullPath().toString());
+
+		bd1.refreshLocal(IResource.DEPTH_INFINITE, null);
+
+		assertEquals("/bug_399017/WebContent/header.jspf", "" + FacetModuleCoreSupport.resolve(new Path("/bug_399017/WebContent/main.jsp"), "header.jspf"));
+	}
 }
diff --git a/tests/org.eclipse.jst.jsp.core.tests/testfiles/bug_399017/.classpath b/tests/org.eclipse.jst.jsp.core.tests/testfiles/bug_399017/.classpath
new file mode 100644
index 0000000..4600e2b
--- /dev/null
+++ b/tests/org.eclipse.jst.jsp.core.tests/testfiles/bug_399017/.classpath
@@ -0,0 +1,5 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<classpath>
+	<classpathentry kind="lib" path="WebContent/WEB-INF/lib/struts.jar"/>
+	<classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/jdk1.5.0_08"/>
+</classpath>
diff --git a/tests/org.eclipse.jst.jsp.core.tests/testfiles/bug_399017/.project b/tests/org.eclipse.jst.jsp.core.tests/testfiles/bug_399017/.project
new file mode 100644
index 0000000..fd713f6
--- /dev/null
+++ b/tests/org.eclipse.jst.jsp.core.tests/testfiles/bug_399017/.project
@@ -0,0 +1,30 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<projectDescription>
+	<name>bug_399017</name>
+	<comment></comment>
+	<projects>
+	</projects>
+	<buildSpec>
+		<buildCommand>
+			<name>org.eclipse.jdt.core.javabuilder</name>
+			<arguments>
+			</arguments>
+		</buildCommand>
+		<buildCommand>
+			<name>org.eclipse.wst.common.project.facet.core.builder</name>
+			<arguments>
+			</arguments>
+		</buildCommand>
+		<buildCommand>
+			<name>org.eclipse.wst.validation.validationbuilder</name>
+			<arguments>
+			</arguments>
+		</buildCommand>
+	</buildSpec>
+	<natures>
+		<nature>org.eclipse.wst.common.project.facet.core.nature</nature>
+		<nature>org.eclipse.jdt.core.javanature</nature>
+		<nature>org.eclipse.wst.common.modulecore.ModuleCoreNature</nature>
+		<nature>org.eclipse.jem.workbench.JavaEMFNature</nature>
+	</natures>
+</projectDescription>
diff --git a/tests/org.eclipse.jst.jsp.core.tests/testfiles/bug_399017/WebContent/WEB-INF/lib/.keepme b/tests/org.eclipse.jst.jsp.core.tests/testfiles/bug_399017/WebContent/WEB-INF/lib/.keepme
new file mode 100644
index 0000000..e69de29
--- /dev/null
+++ b/tests/org.eclipse.jst.jsp.core.tests/testfiles/bug_399017/WebContent/WEB-INF/lib/.keepme
diff --git a/tests/org.eclipse.jst.jsp.core.tests/testfiles/bug_399017/WebContent/WEB-INF/web.xml b/tests/org.eclipse.jst.jsp.core.tests/testfiles/bug_399017/WebContent/WEB-INF/web.xml
new file mode 100644
index 0000000..34906a0
--- /dev/null
+++ b/tests/org.eclipse.jst.jsp.core.tests/testfiles/bug_399017/WebContent/WEB-INF/web.xml
@@ -0,0 +1,18 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<web-app id="WebApp_ID" version="2.4" xmlns="http://java.sun.com/xml/ns/j2ee" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://java.sun.com/xml/ns/j2ee http://java.sun.com/xml/ns/j2ee/web-app_2_4.xsd">
+	<display-name>
+	TagTest</display-name>
+	<welcome-file-list>
+		<welcome-file>index.html</welcome-file>
+		<welcome-file>index.htm</welcome-file>
+		<welcome-file>index.jsp</welcome-file>
+		<welcome-file>default.html</welcome-file>
+		<welcome-file>default.htm</welcome-file>
+		<welcome-file>default.jsp</welcome-file>
+	</welcome-file-list>
+	<jsp-config>
+		<jsp-property-group>
+			<url-pattern>*.jsp</url-pattern>
+			<include-prelude>/header.jspf</include-prelude>
+		</jsp-property-group></jsp-config>
+</web-app>
diff --git a/tests/org.eclipse.jst.jsp.core.tests/testfiles/bug_399017/WebContent/header.jspf b/tests/org.eclipse.jst.jsp.core.tests/testfiles/bug_399017/WebContent/header.jspf
new file mode 100644
index 0000000..4dc2f5b
--- /dev/null
+++ b/tests/org.eclipse.jst.jsp.core.tests/testfiles/bug_399017/WebContent/header.jspf
@@ -0,0 +1,5 @@
+<%@ taglib prefix="logic" uri="http://jakarta.apache.org/struts/tags-logic"%>

+<%! int alpha = 5; %>

+<%@ taglib prefix="bean" uri="http://jakarta.apache.org/struts/tags-bean"%>

+

+<%  %>

diff --git a/tests/org.eclipse.jst.jsp.core.tests/testfiles/bug_399017/WebContent/main.jsp b/tests/org.eclipse.jst.jsp.core.tests/testfiles/bug_399017/WebContent/main.jsp
new file mode 100644
index 0000000..5d094dc
--- /dev/null
+++ b/tests/org.eclipse.jst.jsp.core.tests/testfiles/bug_399017/WebContent/main.jsp
@@ -0,0 +1,14 @@
+<%@ page language="java" contentType="text/html; charset=ISO-8859-1"
+    pageEncoding="ISO-8859-1"%>
+<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
+<html>
+<head>
+<meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1">
+<title>Insert title here</title>
+</head>
+<body>
+<!-- note: the directive for bean exists in header.jspf as specified in the web.xml file -->
+<bean:define id="foo" ></bean:define>
+<%=alpha%>

+</body>
+</html>