[279839] JSP Translator does not support IterationTag constructs
diff --git a/tests/org.eclipse.jst.jsp.core.tests/src/org/eclipse/jst/jsp/core/tests/translation/JSPJavaTranslatorCoreTest.java b/tests/org.eclipse.jst.jsp.core.tests/src/org/eclipse/jst/jsp/core/tests/translation/JSPJavaTranslatorCoreTest.java
index 60ac2aa..00c8ab7 100644
--- a/tests/org.eclipse.jst.jsp.core.tests/src/org/eclipse/jst/jsp/core/tests/translation/JSPJavaTranslatorCoreTest.java
+++ b/tests/org.eclipse.jst.jsp.core.tests/src/org/eclipse/jst/jsp/core/tests/translation/JSPJavaTranslatorCoreTest.java
@@ -13,6 +13,7 @@
 
 import java.io.PrintWriter;
 import java.io.StringWriter;
+import java.util.Iterator;
 import java.util.List;
 
 import junit.framework.TestCase;
@@ -30,11 +31,13 @@
 import org.eclipse.core.runtime.OperationCanceledException;
 import org.eclipse.core.runtime.Platform;
 import org.eclipse.core.runtime.jobs.Job;
+import org.eclipse.jdt.core.compiler.IProblem;
 import org.eclipse.jst.jsp.core.internal.JSPCorePlugin;
 import org.eclipse.jst.jsp.core.internal.java.IJSPTranslation;
 import org.eclipse.jst.jsp.core.internal.java.JSPTranslation;
 import org.eclipse.jst.jsp.core.internal.java.JSPTranslationAdapter;
 import org.eclipse.jst.jsp.core.internal.java.JSPTranslationAdapterFactory;
+import org.eclipse.jst.jsp.core.internal.java.JSPTranslationExtension;
 import org.eclipse.jst.jsp.core.internal.modelhandler.ModelHandlerForJSP;
 import org.eclipse.jst.jsp.core.internal.preferences.JSPCorePreferenceNames;
 import org.eclipse.jst.jsp.core.internal.validation.JSPJavaValidator;
@@ -520,4 +523,87 @@
 				model.releaseFromEdit();
 		}
 	}
+
+	public void testIterationTags() throws Exception {
+		String testName = "testIterationTags";
+		IProject project = ResourcesPlugin.getWorkspace().getRoot().getProject(testName);
+		if (!project.isAccessible()) {
+			// Create new project
+			project = BundleResourceUtil.createSimpleProject(testName, null, null);
+			assertTrue(project.exists());
+			BundleResourceUtil.copyBundleEntriesIntoWorkspace("/testfiles/" + testName, "/" + testName);
+		}
+		waitForBuildAndValidation(project);
+		IFile testFile = project.getFile("/WebContent/test.jsp");
+		assertTrue("test.jsp is not accessible", testFile.isAccessible());
+		IDOMModel model = null;
+		try {
+			model = (IDOMModel) StructuredModelManager.getModelManager().getModelForEdit(testFile);
+
+			ModelHandlerForJSP.ensureTranslationAdapterFactory(model);
+
+			JSPTranslationAdapter translationAdapter = (JSPTranslationAdapter) model.getDocument().getAdapterFor(IJSPTranslation.class);
+			JSPTranslationExtension translation = translationAdapter.getJSPTranslation();
+			translation.setProblemCollectingActive(true);
+			assertNotNull("No Java translation found", translation);
+			translation.reconcileCompilationUnit();
+			translation.setProblemCollectingActive(false);
+			List problems = translation.getProblems();
+			assertNotNull("Translation had a null problems list.", problems);
+			Iterator it = problems.iterator();
+			String javaText = translation.getJavaText();
+			int startOffset = javaText.indexOf("<plain:simple>");
+			assertTrue("<plan:simple> scope not found.", startOffset > 0);
+			int endOffset = javaText.indexOf("</plain:simple>", startOffset);
+			assertTrue("</plan:simple> scope not found.", endOffset > 0);
+			// Finds all errors caused by "continue cannot be used outside of a loop" - should only occur between <plain:simple></plain:simple>
+			while (it.hasNext()) {
+				IProblem problem = (IProblem) it.next();
+				if (problem.isError()) {
+					if ("continue cannot be used outside of a loop".equals(problem.getMessage())) {
+						assertTrue("'continue cannot be used outside of a loop' outside of iteration tag: ", problem.getSourceStart() > startOffset && problem.getSourceEnd() < endOffset);
+					}
+					
+				}
+			}
+		}
+		finally {
+			if (model != null)
+				model.releaseFromEdit();
+		}
+	}
+
+	/**
+	 * Tests that an iteration tag will generate 
+	 * @throws Exception
+	 */
+	public void testIterationTagsIncomplete() throws Exception {
+		String testName = "testIterationTags";
+		IProject project = ResourcesPlugin.getWorkspace().getRoot().getProject(testName);
+		if (!project.isAccessible()) {
+			// Create new project
+			project = BundleResourceUtil.createSimpleProject(testName, null, null);
+			assertTrue(project.exists());
+			BundleResourceUtil.copyBundleEntriesIntoWorkspace("/testfiles/" + testName, "/" + testName);
+		}
+		waitForBuildAndValidation(project);
+		IFile testFile = project.getFile("/WebContent/test_missing_end_tag.jsp");
+		assertTrue("test_missing_end_tag.jsp is not accessible", testFile.isAccessible());
+		IDOMModel model = null;
+		try {
+			model = (IDOMModel) StructuredModelManager.getModelManager().getModelForEdit(testFile);
+
+			ModelHandlerForJSP.ensureTranslationAdapterFactory(model);
+
+			JSPTranslationAdapter translationAdapter = (JSPTranslationAdapter) model.getDocument().getAdapterFor(IJSPTranslation.class);
+			JSPTranslationExtension translation = translationAdapter.getJSPTranslation();
+			String javaText = translation.getJavaText();
+			int startOffset = javaText.indexOf("} // [</plain:loop>]");
+			assertTrue("Missing end tag was not accounted for.", startOffset != -1);
+		}
+		finally {
+			if (model != null)
+				model.releaseFromEdit();
+		}
+	}
 }
diff --git a/tests/org.eclipse.jst.jsp.core.tests/testfiles/testIterationTags/.classpath b/tests/org.eclipse.jst.jsp.core.tests/testfiles/testIterationTags/.classpath
new file mode 100644
index 0000000..5fb681c
--- /dev/null
+++ b/tests/org.eclipse.jst.jsp.core.tests/testfiles/testIterationTags/.classpath
@@ -0,0 +1,8 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<classpath>
+	<classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER"/>
+	<classpathentry kind="con" path="org.eclipse.pde.core.requiredPlugins"/>
+	<classpathentry exported="true" kind="con" path="org.eclipse.jst.j2ee.internal.module.container"/>
+	<classpathentry combineaccessrules="false" kind="src" path="src"/>
+	<classpathentry kind="output" path="bin"/>
+</classpath>
diff --git a/tests/org.eclipse.jst.jsp.core.tests/testfiles/testIterationTags/.project b/tests/org.eclipse.jst.jsp.core.tests/testfiles/testIterationTags/.project
new file mode 100644
index 0000000..da021e9
--- /dev/null
+++ b/tests/org.eclipse.jst.jsp.core.tests/testfiles/testIterationTags/.project
@@ -0,0 +1,25 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<projectDescription>
+	<name>bug_178443</name>
+	<comment></comment>
+	<projects>
+	</projects>
+	<buildSpec>
+		<buildCommand>
+			<name>org.eclipse.jdt.core.javabuilder</name>
+			<arguments>
+			</arguments>
+		</buildCommand>
+		<buildCommand>
+			<name>org.eclipse.pde.ManifestBuilder</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.pde.PluginNature</nature>
+	</natures>
+</projectDescription>
diff --git a/tests/org.eclipse.jst.jsp.core.tests/testfiles/testIterationTags/META-INF/MANIFEST.MF b/tests/org.eclipse.jst.jsp.core.tests/testfiles/testIterationTags/META-INF/MANIFEST.MF
new file mode 100644
index 0000000..31502b2
--- /dev/null
+++ b/tests/org.eclipse.jst.jsp.core.tests/testfiles/testIterationTags/META-INF/MANIFEST.MF
@@ -0,0 +1,10 @@
+Manifest-Version: 1.0
+Bundle-ManifestVersion: 2
+Bundle-Name: TestIterationTags
+Bundle-SymbolicName: testIterationTags
+Bundle-Version: 1.0.0.qualifier
+Bundle-Activator: testiterationtags.Activator
+Require-Bundle: javax.servlet.jsp;bundle-version="2.0.0",
+ javax.servlet;bundle-version="2.5.0"
+Bundle-RequiredExecutionEnvironment: J2SE-1.4
+Bundle-ActivationPolicy: lazy
diff --git a/tests/org.eclipse.jst.jsp.core.tests/testfiles/testIterationTags/WebContent/WEB-INF/plain.tld b/tests/org.eclipse.jst.jsp.core.tests/testfiles/testIterationTags/WebContent/WEB-INF/plain.tld
new file mode 100644
index 0000000..828e0a9
--- /dev/null
+++ b/tests/org.eclipse.jst.jsp.core.tests/testfiles/testIterationTags/WebContent/WEB-INF/plain.tld
@@ -0,0 +1,26 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!DOCTYPE taglib PUBLIC "-//Sun Microsystems, Inc.//DTD JSP Tag Library 1.1//EN" "http://java.sun.com/j2ee/dtds/web-jsptaglibrary_1_1.dtd">
+<taglib>
+<tlibversion>1.2</tlibversion>
+<jspversion>1.1</jspversion>
+<shortname>plain</shortname>
+<uri>http://eclipse.org/plain</uri>
+<tag>
+<name>simple</name>
+<tagclass>org.eclipse.SimpleTag</tagclass>
+<bodycontent>JSP</bodycontent>
+<attribute>
+<name>name</name>
+<required>false</required>
+</attribute>
+</tag>
+<tag>
+<name>loop</name>
+<tagclass>org.eclipse.LoopTag</tagclass>
+<bodycontent>JSP</bodycontent>
+<attribute>
+<name>name</name>
+<required>false</required>
+</attribute>
+</tag>
+</taglib>
diff --git a/tests/org.eclipse.jst.jsp.core.tests/testfiles/testIterationTags/WebContent/WEB-INF/web.xml b/tests/org.eclipse.jst.jsp.core.tests/testfiles/testIterationTags/WebContent/WEB-INF/web.xml
new file mode 100644
index 0000000..5aa6dca
--- /dev/null
+++ b/tests/org.eclipse.jst.jsp.core.tests/testfiles/testIterationTags/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>testIterationTags</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/testIterationTags/WebContent/test.jsp b/tests/org.eclipse.jst.jsp.core.tests/testfiles/testIterationTags/WebContent/test.jsp
new file mode 100644
index 0000000..b1fc6f1
--- /dev/null
+++ b/tests/org.eclipse.jst.jsp.core.tests/testfiles/testIterationTags/WebContent/test.jsp
@@ -0,0 +1,20 @@
+<%@ page language="java" contentType="text/html; charset=ISO-8859-1"
+    pageEncoding="ISO-8859-1"%>
+<%@ taglib uri="/WEB-INF/plain.tld" prefix="plain" %>
+<!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>
+<!-- Should generate an error since continue; can't be used in this construct -->
+<plain:simple>
+<% if(true) continue; %>
+</plain:simple>
+
+<plain:loop>
+<% if(true) continue; %>
+</plain:loop>
+</body>
+</html>
diff --git a/tests/org.eclipse.jst.jsp.core.tests/testfiles/testIterationTags/WebContent/test_missing_end_tag.jsp b/tests/org.eclipse.jst.jsp.core.tests/testfiles/testIterationTags/WebContent/test_missing_end_tag.jsp
new file mode 100644
index 0000000..2b4603c
--- /dev/null
+++ b/tests/org.eclipse.jst.jsp.core.tests/testfiles/testIterationTags/WebContent/test_missing_end_tag.jsp
@@ -0,0 +1,17 @@
+<%@ page language="java" contentType="text/html; charset=ISO-8859-1"
+    pageEncoding="ISO-8859-1"%>
+<%@ taglib uri="/WEB-INF/plain.tld" prefix="plain" %>
+<!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>
+
+<!-- Missing end tag for plain:loop -->
+<plain:loop>
+<% if(true) continue; %>
+
+</body>
+</html>
diff --git a/tests/org.eclipse.jst.jsp.core.tests/testfiles/testIterationTags/src/org/eclipse/LoopTag.java b/tests/org.eclipse.jst.jsp.core.tests/testfiles/testIterationTags/src/org/eclipse/LoopTag.java
new file mode 100644
index 0000000..c644898
--- /dev/null
+++ b/tests/org.eclipse.jst.jsp.core.tests/testfiles/testIterationTags/src/org/eclipse/LoopTag.java
@@ -0,0 +1,30 @@
+package org.eclipse;
+
+public class LoopTag implements javax.servlet.jsp.tagext.IterationTag {
+
+	public int doAfterBody() throws javax.servlet.jsp.JspException {
+		return 0;
+	}
+
+	public int doEndTag() throws javax.servlet.jsp.JspException {
+		return 0;
+	}
+
+	public int doStartTag() throws javax.servlet.jsp.JspException {
+		return 0;
+	}
+
+	public javax.servlet.jsp.tagext.Tag getParent() {
+		return null;
+	}
+
+	public void release() {
+	}
+
+	public void setPageContext(javax.servlet.jsp.PageContext pc) {
+	}
+
+	public void setParent(javax.servlet.jsp.tagext.Tag t) {
+	}
+
+}
diff --git a/tests/org.eclipse.jst.jsp.core.tests/testfiles/testIterationTags/src/org/eclipse/SimpleTag.java b/tests/org.eclipse.jst.jsp.core.tests/testfiles/testIterationTags/src/org/eclipse/SimpleTag.java
new file mode 100644
index 0000000..e1adb54
--- /dev/null
+++ b/tests/org.eclipse.jst.jsp.core.tests/testfiles/testIterationTags/src/org/eclipse/SimpleTag.java
@@ -0,0 +1,26 @@
+package org.eclipse;
+
+public class SimpleTag implements javax.servlet.jsp.tagext.Tag {
+
+	public int doEndTag() throws javax.servlet.jsp.JspException {
+		return 0;
+	}
+
+	public int doStartTag() throws javax.servlet.jsp.JspException {
+		return 0;
+	}
+
+	public Tag getParent() {
+		return null;
+	}
+
+	public void release() {
+	}
+
+	public void setPageContext(javax.servlet.jsp.PageContext pc) {
+	}
+
+	public void setParent(javax.servlet.jsp.tagext.Tag t) {
+	}
+
+}