[265710] Validator incorrectly flags page value when it is a JSP expression
diff --git a/tests/org.eclipse.jst.jsp.core.tests/src/org/eclipse/jst/jsp/core/tests/JSPCoreTestSuite.java b/tests/org.eclipse.jst.jsp.core.tests/src/org/eclipse/jst/jsp/core/tests/JSPCoreTestSuite.java
index ef16cfa..dba6304 100644
--- a/tests/org.eclipse.jst.jsp.core.tests/src/org/eclipse/jst/jsp/core/tests/JSPCoreTestSuite.java
+++ b/tests/org.eclipse.jst.jsp.core.tests/src/org/eclipse/jst/jsp/core/tests/JSPCoreTestSuite.java
@@ -1,5 +1,5 @@
 /*******************************************************************************
- * Copyright (c) 2004, 2008 IBM Corporation and others.
+ * Copyright (c) 2004, 2009 IBM Corporation and others.
  * All rights reserved. This program and the accompanying materials
  * are made available under the terms of the Eclipse Public License v1.0
  * which accompanies this distribution, and is available at
@@ -26,6 +26,7 @@
 import org.eclipse.jst.jsp.core.tests.translation.JSPJavaTranslatorCoreTest;
 import org.eclipse.jst.jsp.core.tests.validation.JSPActionValidatorTest;
 import org.eclipse.jst.jsp.core.tests.validation.JSPBatchValidatorTest;
+import org.eclipse.jst.jsp.core.tests.validation.JSPDirectiveValidatorTest;
 import org.eclipse.jst.jsp.core.tests.validation.JSPJavaValidatorTest;
 import org.eclipse.jst.jsp.css.core.tests.source.JSPedCSSSourceParserTest;
 
@@ -64,6 +65,7 @@
 		addTest(new TestSuite(TestTaglibCMTests.class, "Custom Tag Library Content Model Tests"));
 		addTest(new TestSuite(JSPActionValidatorTest.class, "Action Validator Tests"));
 		addTest(new TestSuite(JSPBatchValidatorTest.class, "Batch Validator Tests"));
+		addTest(new TestSuite(JSPDirectiveValidatorTest.class, "Directive Validator Tests"));
 
 		if (wtp_autotest_noninteractive != null)
 			System.setProperty("wtp.autotest.noninteractive", wtp_autotest_noninteractive);
diff --git a/tests/org.eclipse.jst.jsp.core.tests/src/org/eclipse/jst/jsp/core/tests/validation/JSPDirectiveValidatorTest.java b/tests/org.eclipse.jst.jsp.core.tests/src/org/eclipse/jst/jsp/core/tests/validation/JSPDirectiveValidatorTest.java
new file mode 100644
index 0000000..f60f432
--- /dev/null
+++ b/tests/org.eclipse.jst.jsp.core.tests/src/org/eclipse/jst/jsp/core/tests/validation/JSPDirectiveValidatorTest.java
@@ -0,0 +1,124 @@
+/*******************************************************************************
+ * Copyright (c) 2009 IBM Corporation and others.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ * 
+ * Contributors:
+ *     IBM Corporation - initial API and implementation
+ *******************************************************************************/
+package org.eclipse.jst.jsp.core.tests.validation;
+
+import java.util.Iterator;
+
+import org.eclipse.core.resources.ResourcesPlugin;
+import org.eclipse.core.runtime.Path;
+import org.eclipse.jdt.core.JavaCore;
+import org.eclipse.jst.jsp.core.internal.JSPCoreMessages;
+import org.eclipse.jst.jsp.core.internal.validation.JSPDirectiveValidator;
+import org.eclipse.jst.jsp.core.tests.taglibindex.BundleResourceUtil;
+import org.eclipse.osgi.util.NLS;
+import org.eclipse.wst.validation.internal.provisional.core.IMessage;
+import org.eclipse.wst.validation.internal.provisional.core.IReporter;
+
+import junit.framework.TestCase;
+
+public class JSPDirectiveValidatorTest extends TestCase {
+	
+	private String wtp_autotest_noninteractive = null;
+	private static final String PROJECT_NAME = "testvalidatejspdirectives";
+	private static final String FRAGMENT_NAME = "fragmentThatDoesntExist.jspf";
+
+	protected void setUp() throws Exception {
+		super.setUp();
+		String noninteractive = System.getProperty("wtp.autotest.noninteractive");
+		if (noninteractive != null)
+			wtp_autotest_noninteractive = noninteractive;
+		System.setProperty("wtp.autotest.noninteractive", "true");
+
+		if (!ResourcesPlugin.getWorkspace().getRoot().getProject(PROJECT_NAME).exists()) {
+			BundleResourceUtil.createSimpleProject(PROJECT_NAME, null, new String[]{JavaCore.NATURE_ID});
+			BundleResourceUtil.copyBundleEntriesIntoWorkspace("/testfiles/" + PROJECT_NAME, "/" + PROJECT_NAME);
+		}
+		assertTrue("project could not be created", ResourcesPlugin.getWorkspace().getRoot().getProject(PROJECT_NAME).exists());
+	}
+
+	protected void tearDown() throws Exception {
+		super.tearDown();
+		if (wtp_autotest_noninteractive != null)
+			System.setProperty("wtp.autotest.noninteractive", wtp_autotest_noninteractive);
+	}
+	
+	public void testBug265710Expression() throws Exception {
+		JSPDirectiveValidator validator = new JSPDirectiveValidator();
+		IReporter reporter = new ReporterForTest();
+		ValidationContextForTest helper = new ValidationContextForTest();
+		String filePath = "/" + PROJECT_NAME + "/WebContent/bug265710expression.jsp";
+		assertTrue("unable to find file: " + filePath, ResourcesPlugin.getWorkspace().getRoot().getFile(new Path(filePath)).exists());
+		helper.setURI(filePath);
+		validator.validate(helper, reporter);
+		
+		if (reporter.getMessages().size() > 0) {
+			Iterator it = reporter.getMessages().iterator();
+			while (it.hasNext()) {
+				IMessage message = (IMessage) it.next();
+				if (message.getLineNumber() == 14 && message.getSeverity() == IMessage.HIGH_SEVERITY) {
+					fail("JSP Directive Validator flagged a JSP expression in the import directive");
+				}
+			}
+		}
+	}
+	
+	public void testBug265710El() throws Exception {
+		JSPDirectiveValidator validator = new JSPDirectiveValidator();
+		IReporter reporter = new ReporterForTest();
+		ValidationContextForTest helper = new ValidationContextForTest();
+		String filePath = "/" + PROJECT_NAME + "/WebContent/bug265710el.jsp";
+		assertTrue("unable to find file: " + filePath, ResourcesPlugin.getWorkspace().getRoot().getFile(new Path(filePath)).exists());
+		helper.setURI(filePath);
+		validator.validate(helper, reporter);
+		
+		if (reporter.getMessages().size() > 0) {
+			Iterator it = reporter.getMessages().iterator();
+			while (it.hasNext()) {
+				IMessage message = (IMessage) it.next();
+				if (message.getLineNumber() == 11 && message.getSeverity() == IMessage.HIGH_SEVERITY) {
+					fail("JSP Directive Validator flagged JSP EL in the import directive");
+				}
+			}
+		}
+	}
+	
+	public void testIncludeDirective() throws Exception {
+		JSPDirectiveValidator validator = new JSPDirectiveValidator();
+		IReporter reporter = new ReporterForTest();
+		ValidationContextForTest helper = new ValidationContextForTest();
+		String filePath = "/" + PROJECT_NAME + "/WebContent/testinclude.jsp";
+		assertTrue("unable to find file: " + filePath, ResourcesPlugin.getWorkspace().getRoot().getFile(new Path(filePath)).exists());
+		helper.setURI(filePath);
+		validator.validate(helper, reporter);
+		
+		boolean foundMissingInclude = false;
+		boolean foundIncludeWithError = false;
+		if (reporter.getMessages().size() > 0) {
+			Iterator it = reporter.getMessages().iterator();
+			boolean foundError = false;
+			while (it.hasNext() && !foundError) {
+				IMessage message = (IMessage) it.next();
+				if (message.getLineNumber() == 11)
+					foundIncludeWithError = true;
+				else if (message.getLineNumber() == 12) {
+					String expectedMsg = NLS.bind(JSPCoreMessages.JSPDirectiveValidator_4, new String[] { FRAGMENT_NAME, "/" + PROJECT_NAME + "/WebContent/" + FRAGMENT_NAME });
+					if (!expectedMsg.equals(message.getText()))
+						fail("Error found on line 12, but was not a missing fragment error.");
+					foundMissingInclude = true;
+					break;
+				}
+			}
+		}
+		
+		assertFalse("JSP Directive Validator reported an error for a fragment that should be locatable.", foundIncludeWithError);
+		assertTrue("JSP Directive Validator did not report the missing fragment.", foundMissingInclude);
+	}
+}
diff --git a/tests/org.eclipse.jst.jsp.core.tests/testfiles/testvalidatejspdirectives/.project b/tests/org.eclipse.jst.jsp.core.tests/testfiles/testvalidatejspdirectives/.project
new file mode 100644
index 0000000..5f2075a
--- /dev/null
+++ b/tests/org.eclipse.jst.jsp.core.tests/testfiles/testvalidatejspdirectives/.project
@@ -0,0 +1,22 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<projectDescription>
+	<name>testvalidatejspactions</name>
+	<comment></comment>
+	<projects>
+	</projects>
+	<buildSpec>
+		<buildCommand>
+			<name>org.eclipse.jdt.core.javabuilder</name>
+			<arguments>
+			</arguments>
+		</buildCommand>
+		<buildCommand>
+			<name>org.eclipse.wst.validation.validationbuilder</name>
+			<arguments>
+			</arguments>
+		</buildCommand>
+	</buildSpec>
+	<natures>
+		<nature>org.eclipse.jdt.core.javanature</nature>
+	</natures>
+</projectDescription>
diff --git a/tests/org.eclipse.jst.jsp.core.tests/testfiles/testvalidatejspdirectives/WebContent/META-INF/MANIFEST.MF b/tests/org.eclipse.jst.jsp.core.tests/testfiles/testvalidatejspdirectives/WebContent/META-INF/MANIFEST.MF
new file mode 100644
index 0000000..254272e
--- /dev/null
+++ b/tests/org.eclipse.jst.jsp.core.tests/testfiles/testvalidatejspdirectives/WebContent/META-INF/MANIFEST.MF
@@ -0,0 +1,3 @@
+Manifest-Version: 1.0
+Class-Path: 
+
diff --git a/tests/org.eclipse.jst.jsp.core.tests/testfiles/testvalidatejspdirectives/WebContent/WEB-INF/web.xml b/tests/org.eclipse.jst.jsp.core.tests/testfiles/testvalidatejspdirectives/WebContent/WEB-INF/web.xml
new file mode 100644
index 0000000..62ebcc8
--- /dev/null
+++ b/tests/org.eclipse.jst.jsp.core.tests/testfiles/testvalidatejspdirectives/WebContent/WEB-INF/web.xml
@@ -0,0 +1,12 @@
+<?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>testvalidatejspactions</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>
+</web-app>
diff --git a/tests/org.eclipse.jst.jsp.core.tests/testfiles/testvalidatejspdirectives/WebContent/bug265710el.jsp b/tests/org.eclipse.jst.jsp.core.tests/testfiles/testvalidatejspdirectives/WebContent/bug265710el.jsp
new file mode 100644
index 0000000..acfff81
--- /dev/null
+++ b/tests/org.eclipse.jst.jsp.core.tests/testfiles/testvalidatejspdirectives/WebContent/bug265710el.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>
+
+<jsp:include page="${param.goto}"></jsp:include>
+
+</body>
+</html>
\ No newline at end of file
diff --git a/tests/org.eclipse.jst.jsp.core.tests/testfiles/testvalidatejspdirectives/WebContent/bug265710expression.jsp b/tests/org.eclipse.jst.jsp.core.tests/testfiles/testvalidatejspdirectives/WebContent/bug265710expression.jsp
new file mode 100644
index 0000000..c259359
--- /dev/null
+++ b/tests/org.eclipse.jst.jsp.core.tests/testfiles/testvalidatejspdirectives/WebContent/bug265710expression.jsp
@@ -0,0 +1,17 @@
+<%@ 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>
+<%
+	String redirect = request.getParameter("goto");
+%>
+
+<jsp:include page="<%= redirect %>"></jsp:include>
+
+</body>
+</html>
\ No newline at end of file
diff --git a/tests/org.eclipse.jst.jsp.core.tests/testfiles/testvalidatejspdirectives/WebContent/fragment.jspf b/tests/org.eclipse.jst.jsp.core.tests/testfiles/testvalidatejspdirectives/WebContent/fragment.jspf
new file mode 100644
index 0000000..c93e4ae
--- /dev/null
+++ b/tests/org.eclipse.jst.jsp.core.tests/testfiles/testvalidatejspdirectives/WebContent/fragment.jspf
@@ -0,0 +1 @@
+<div id="content"></div>
\ No newline at end of file
diff --git a/tests/org.eclipse.jst.jsp.core.tests/testfiles/testvalidatejspdirectives/WebContent/testinclude.jsp b/tests/org.eclipse.jst.jsp.core.tests/testfiles/testvalidatejspdirectives/WebContent/testinclude.jsp
new file mode 100644
index 0000000..efb7d74
--- /dev/null
+++ b/tests/org.eclipse.jst.jsp.core.tests/testfiles/testvalidatejspdirectives/WebContent/testinclude.jsp
@@ -0,0 +1,15 @@
+<%@ 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>
+
+<jsp:include page="fragment.jspf"></jsp:include>
+<jsp:include page="fragmentThatDoesntExist.jspf"></jsp:include>
+
+</body>
+</html>
\ No newline at end of file
diff --git a/tests/org.eclipse.jst.jsp.core.tests/testfiles/testvalidatejspdirectives/src/.keepme b/tests/org.eclipse.jst.jsp.core.tests/testfiles/testvalidatejspdirectives/src/.keepme
new file mode 100644
index 0000000..e69de29
--- /dev/null
+++ b/tests/org.eclipse.jst.jsp.core.tests/testfiles/testvalidatejspdirectives/src/.keepme