[285285] Removing comment end tag and adding it back leaves validation errors
diff --git a/tests/org.eclipse.jst.jsp.ui.tests/META-INF/MANIFEST.MF b/tests/org.eclipse.jst.jsp.ui.tests/META-INF/MANIFEST.MF
index f54d283..ab5bfce 100644
--- a/tests/org.eclipse.jst.jsp.ui.tests/META-INF/MANIFEST.MF
+++ b/tests/org.eclipse.jst.jsp.ui.tests/META-INF/MANIFEST.MF
@@ -2,7 +2,7 @@
 Bundle-ManifestVersion: 2
 Bundle-Name: %Bundle-Name.0
 Bundle-SymbolicName: org.eclipse.jst.jsp.ui.tests; singleton:=true
-Bundle-Version: 1.0.300.qualifier
+Bundle-Version: 1.0.301.qualifier
 Bundle-ClassPath: jspuitests.jar
 Bundle-Activator: org.eclipse.jst.jsp.ui.tests.JSPUITestsPlugin
 Bundle-Vendor: %Bundle-Vendor.0
diff --git a/tests/org.eclipse.jst.jsp.ui.tests/src/org/eclipse/jst/jsp/ui/tests/validation/JSPHTMLValidatorTest.java b/tests/org.eclipse.jst.jsp.ui.tests/src/org/eclipse/jst/jsp/ui/tests/validation/JSPHTMLValidatorTest.java
index f678005..d920900 100644
--- a/tests/org.eclipse.jst.jsp.ui.tests/src/org/eclipse/jst/jsp/ui/tests/validation/JSPHTMLValidatorTest.java
+++ b/tests/org.eclipse.jst.jsp.ui.tests/src/org/eclipse/jst/jsp/ui/tests/validation/JSPHTMLValidatorTest.java
@@ -1,5 +1,5 @@
 /*******************************************************************************
- * Copyright (c) 2006, 2007 IBM Corporation and others.
+ * Copyright (c) 2006, 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
@@ -10,13 +10,25 @@
  *******************************************************************************/
 package org.eclipse.jst.jsp.ui.tests.validation;
 
+import java.util.ArrayList;
+import java.util.List;
+
 import junit.framework.TestCase;
 
+import org.eclipse.core.resources.IFile;
+import org.eclipse.core.resources.IProject;
 import org.eclipse.core.resources.ResourcesPlugin;
 import org.eclipse.jdt.core.JavaCore;
 import org.eclipse.jst.jsp.core.internal.validation.JSPContentValidator;
+import org.eclipse.jst.jsp.ui.internal.validation.JSPContentSourceValidator;
 import org.eclipse.jst.jsp.ui.tests.util.ProjectUtil;
+import org.eclipse.wst.sse.core.StructuredModelManager;
+import org.eclipse.wst.sse.core.internal.provisional.IStructuredModel;
+import org.eclipse.wst.sse.core.internal.provisional.text.IStructuredDocument;
+import org.eclipse.wst.validation.internal.operations.WorkbenchContext;
+import org.eclipse.wst.validation.internal.provisional.core.IMessage;
 import org.eclipse.wst.validation.internal.provisional.core.IReporter;
+import org.eclipse.wst.validation.internal.provisional.core.IValidator;
 
 /**
  * Tests HTML validator on jsp file
@@ -92,4 +104,96 @@
 
 		assertTrue("bad attribute name is not error when it should be", !reporter.getMessages().isEmpty());
 	}
+	
+	/**
+	 * Regression test for Bug 285285
+	 * 
+	 * @see org.eclipse.wst.xml.ui.internal.validation.TestDelegatingSourceValidatorForXML#testRemoveAndAddBackCommentEndTag
+	 * @see org.eclipse.wst.html.ui.tests.validation.TestHTMLValidator#testRemoveAndAddBackCommentEndTag
+	 * @see org.eclipse.jst.jsp.ui.tests.validation.JSPHTMLValidatorTest#testRemoveAndAddBackCommentEndTag
+	 */
+	public void testRemoveAndAddBackCommentEndTag() throws Exception{
+		JSPContentSourceValidator fValidator = new JSPContentSourceValidator();
+		
+		String projectName = "RemoveAndAddBackCommentEndTag";
+		IProject project = ProjectUtil.createProject(projectName, null, null);
+		
+		IFile testFile = null;
+		IStructuredModel model = null;
+		
+		try {
+			//get test file
+			ProjectUtil.copyBundleEntriesIntoWorkspace("testfiles/RemoveAndAddBackCommentEndTag", projectName);
+			testFile = project.getFile("Test1.jsp");
+			assertTrue("Test file " + testFile + " does not exist", testFile.exists());
+			
+			//get the document
+			model = StructuredModelManager.getModelManager().getModelForEdit(testFile);
+			IStructuredDocument document = model.getStructuredDocument();
+			
+			//set up for fValidator
+			WorkbenchContext context = new WorkbenchContext();
+			List fileList = new ArrayList();
+			fileList.add(testFile.getFullPath().toPortableString());
+			context.setValidationFileURIs(fileList);
+			
+			//validate clean file
+			TestReporter reporter = new TestReporter();
+			fValidator.validate(context, reporter);
+			assertFalse("There should be no validation errors on " + testFile, reporter.isMessageReported());
+			
+			//remove -->
+			document.replace(361, 3, "");
+			
+			//validate file with error
+			reporter = new TestReporter();
+			fValidator.validate(context, reporter);
+			assertTrue("There should be validation errors on " + testFile, reporter.isMessageReported());
+		
+			//replace -->
+			document.replace(361, 0, "-->");
+			
+			//validate clean file
+			reporter = new TestReporter();
+			fValidator.validate(context, reporter);
+			assertFalse("There should be no validation errors on " + testFile, reporter.isMessageReported());
+		} finally {
+			if(model != null) {
+				model.releaseFromEdit();
+			}
+		}
+	}
+	
+	/**
+	 * A <code>IReporter</code> for testing validators
+	 */
+	private class TestReporter implements IReporter {
+		private boolean messageReported = false;
+		
+		public TestReporter(){}
+		
+		public void addMessage(IValidator origin, IMessage message) {
+			messageReported = true;
+		}
+		
+		public boolean isMessageReported() {
+			return messageReported;
+		}
+
+		public void displaySubtask(IValidator validator, IMessage message) {}
+
+		public List getMessages() {
+			return null;
+		}
+
+		public boolean isCancelled() {
+			return false;
+		}
+
+		public void removeAllMessages(IValidator origin, Object object) {}
+
+		public void removeAllMessages(IValidator origin) {}
+
+		public void removeMessageSubset(IValidator validator, Object obj, String groupName) {}
+	}
 }
diff --git a/tests/org.eclipse.jst.jsp.ui.tests/testfiles/RemoveAndAddBackCommentEndTag/Test1.jsp b/tests/org.eclipse.jst.jsp.ui.tests/testfiles/RemoveAndAddBackCommentEndTag/Test1.jsp
new file mode 100644
index 0000000..da1957d
--- /dev/null
+++ b/tests/org.eclipse.jst.jsp.ui.tests/testfiles/RemoveAndAddBackCommentEndTag/Test1.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>

+

+<!--  Test -->

+

+</body>

+</html>
\ No newline at end of file
diff --git a/tests/org.eclipse.wst.html.ui.tests/META-INF/MANIFEST.MF b/tests/org.eclipse.wst.html.ui.tests/META-INF/MANIFEST.MF
index 2898b48..da20b3a 100644
--- a/tests/org.eclipse.wst.html.ui.tests/META-INF/MANIFEST.MF
+++ b/tests/org.eclipse.wst.html.ui.tests/META-INF/MANIFEST.MF
@@ -2,7 +2,7 @@
 Bundle-ManifestVersion: 2
 Bundle-Name: %Bundle-Name.0
 Bundle-SymbolicName: org.eclipse.wst.html.ui.tests; singleton:=true
-Bundle-Version: 1.0.300.qualifier
+Bundle-Version: 1.0.301.qualifier
 Bundle-ClassPath: htmluitests.jar
 Bundle-Activator: org.eclipse.wst.html.ui.tests.HTMLUITestsPlugin
 Bundle-Vendor: %Bundle-Vendor.0
@@ -22,7 +22,8 @@
  org.eclipse.ui.views,
  org.eclipse.core.runtime,
  org.eclipse.core.resources,
- com.ibm.icu
+ com.ibm.icu,
+ org.eclipse.wst.validation
 Eclipse-LazyStart: true
 Bundle-RequiredExecutionEnvironment: J2SE-1.4
 Bundle-ActivationPolicy: lazy
diff --git a/tests/org.eclipse.wst.html.ui.tests/src/org/eclipse/wst/html/ui/tests/HTMLUITestSuite.java b/tests/org.eclipse.wst.html.ui.tests/src/org/eclipse/wst/html/ui/tests/HTMLUITestSuite.java
index ad8564f..aec851f 100644
--- a/tests/org.eclipse.wst.html.ui.tests/src/org/eclipse/wst/html/ui/tests/HTMLUITestSuite.java
+++ b/tests/org.eclipse.wst.html.ui.tests/src/org/eclipse/wst/html/ui/tests/HTMLUITestSuite.java
@@ -1,5 +1,5 @@
 /*******************************************************************************
- * Copyright (c) 2004, 2005 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
@@ -10,6 +10,7 @@
  *******************************************************************************/
 package org.eclipse.wst.html.ui.tests;
 
+import org.eclipse.wst.html.ui.tests.validation.TestHTMLValidator;
 import org.eclipse.wst.html.ui.tests.viewer.TestViewerConfigurationHTML;
 
 import junit.framework.Test;
@@ -28,7 +29,7 @@
 		addTest(new TestSuite(HTMLUIPreferencesTest.class));
 		addTest(new TestSuite(TestViewerConfigurationHTML.class));
 		addTest(new TestSuite(TestEditorConfigurationHTML.class));
+		addTest(new TestSuite(TestHTMLValidator.class, "Test HTMLValidator"));
 		//		addTest(new SSEModelTestSuite());
-
 	}
 }
diff --git a/tests/org.eclipse.wst.html.ui.tests/src/org/eclipse/wst/html/ui/tests/ProjectUtil.java b/tests/org.eclipse.wst.html.ui.tests/src/org/eclipse/wst/html/ui/tests/ProjectUtil.java
new file mode 100644
index 0000000..4286523
--- /dev/null
+++ b/tests/org.eclipse.wst.html.ui.tests/src/org/eclipse/wst/html/ui/tests/ProjectUtil.java
@@ -0,0 +1,155 @@
+/*******************************************************************************
+ * 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.wst.html.ui.tests;
+
+import java.io.ByteArrayInputStream;
+import java.io.ByteArrayOutputStream;
+import java.io.IOException;
+import java.io.InputStream;
+import java.net.URL;
+import java.util.Enumeration;
+
+import org.eclipse.core.resources.IFile;
+import org.eclipse.core.resources.IFolder;
+import org.eclipse.core.resources.IProject;
+import org.eclipse.core.resources.IProjectDescription;
+import org.eclipse.core.resources.IWorkspaceRunnable;
+import org.eclipse.core.resources.ResourcesPlugin;
+import org.eclipse.core.runtime.CoreException;
+import org.eclipse.core.runtime.IPath;
+import org.eclipse.core.runtime.IProgressMonitor;
+import org.eclipse.core.runtime.NullProgressMonitor;
+import org.eclipse.core.runtime.Path;
+
+/**
+ * Some utilities for creating projects, and copying files into the workspace.
+ * Copied from JSP UI tests.
+ * 
+ * @see org.eclipse.wst.xml.ui.tests.ProjectUtil Copy - org.eclipse.wst.xml.ui.tests.ProjectUtil
+ */
+public class ProjectUtil {
+
+	static void _copyBundleEntriesIntoWorkspace(final String rootEntry, final String fullTargetPath) throws CoreException {
+		Enumeration entries = HTMLUITestsPlugin.getDefault().getBundle().getEntryPaths(rootEntry);
+		while (entries != null && entries.hasMoreElements()) {
+			String entryPath = entries.nextElement().toString();
+			String targetPath = new Path(fullTargetPath + "/" + entryPath.substring(rootEntry.length())).toString();
+			if (entryPath.endsWith("/")) {
+				IFolder folder = ResourcesPlugin.getWorkspace().getRoot().getFolder(new Path(targetPath));
+				if (!folder.exists()) {
+					folder.create(true, true, new NullProgressMonitor());
+				}
+				_copyBundleEntriesIntoWorkspace(entryPath, targetPath);
+			}
+			else {
+				_copyBundleEntryIntoWorkspace(entryPath, targetPath);
+			}
+			// System.out.println(entryPath + " -> " + targetPath);
+		}
+	}
+
+	static IFile _copyBundleEntryIntoWorkspace(String entryname, String fullPath) throws CoreException {
+		IFile file = null;
+		URL entry = HTMLUITestsPlugin.getDefault().getBundle().getEntry(entryname);
+		if (entry != null) {
+			try {
+				byte[] b = new byte[2048];
+				InputStream input = entry.openStream();
+				ByteArrayOutputStream output = new ByteArrayOutputStream();
+				int i = -1;
+				while ((i = input.read(b)) > -1) {
+					output.write(b, 0, i);
+				}
+				file = ResourcesPlugin.getWorkspace().getRoot().getFile(new Path(fullPath));
+				if (file != null) {
+					if (!file.exists()) {
+						file.create(new ByteArrayInputStream(output.toByteArray()), true, new NullProgressMonitor());
+					}
+					else {
+						file.setContents(new ByteArrayInputStream(output.toByteArray()), true, false, new NullProgressMonitor());
+					}
+				}
+			}
+			catch (IOException e) {
+				e.printStackTrace();
+			}
+			catch (CoreException e) {
+				e.printStackTrace();
+			}
+		}
+		return file;
+	}
+
+	/**
+	 * @param rootEntry - avoid trailing separators
+	 * @param fullTargetPath
+	 */
+	public static void copyBundleEntriesIntoWorkspace(final String rootEntry, final String fullTargetPath) {
+		IWorkspaceRunnable runnable = new IWorkspaceRunnable() {
+			public void run(IProgressMonitor monitor) throws CoreException {
+				_copyBundleEntriesIntoWorkspace(rootEntry, fullTargetPath);
+				ResourcesPlugin.getWorkspace().checkpoint(true);
+			}
+		};
+		try {
+			ResourcesPlugin.getWorkspace().run(runnable, new NullProgressMonitor());
+		}
+		catch (CoreException e) {
+			e.printStackTrace();
+		}
+	}
+
+	/**
+	 * 
+	 * @param entryname
+	 *            path relative to TEST plugin starting w/ a "/" (eg.
+	 *            "/testfiles/bugnumber/struts-logic.tld")
+	 * @param fullPath
+	 *            path relative to junit test workpace (eg.
+	 *            "/myruntimeproj/struts-logic.tld")
+	 * @return
+	 */
+	public static IFile copyBundleEntryIntoWorkspace(final String entryname, final String fullPath) {
+		final IFile file[] = new IFile[1];
+		IWorkspaceRunnable runnable = new IWorkspaceRunnable() {
+			public void run(IProgressMonitor monitor) throws CoreException {
+				file[0] = _copyBundleEntryIntoWorkspace(entryname, fullPath);
+				ResourcesPlugin.getWorkspace().checkpoint(true);
+			}
+		};
+		try {
+			ResourcesPlugin.getWorkspace().run(runnable, new NullProgressMonitor());
+		}
+		catch (CoreException e) {
+			e.printStackTrace();
+		}
+		return file[0];
+	}
+
+	public static IProject createProject(String name, IPath location, String[] natureIds) {
+		IProjectDescription description = ResourcesPlugin.getWorkspace().newProjectDescription(name);
+		if (location != null) {
+			description.setLocation(location);
+		}
+		if (natureIds != null) {
+			description.setNatureIds(natureIds);
+		}
+		IProject project = ResourcesPlugin.getWorkspace().getRoot().getProject(name);
+		try {
+			project.create(description, new NullProgressMonitor());
+			project.open(new NullProgressMonitor());
+		}
+		catch (CoreException e) {
+			e.printStackTrace();
+		}
+		return project;
+	}
+}
diff --git a/tests/org.eclipse.wst.html.ui.tests/src/org/eclipse/wst/html/ui/tests/validation/TestHTMLValidator.java b/tests/org.eclipse.wst.html.ui.tests/src/org/eclipse/wst/html/ui/tests/validation/TestHTMLValidator.java
new file mode 100644
index 0000000..4071d84
--- /dev/null
+++ b/tests/org.eclipse.wst.html.ui.tests/src/org/eclipse/wst/html/ui/tests/validation/TestHTMLValidator.java
@@ -0,0 +1,143 @@
+/*******************************************************************************
+ * 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.wst.html.ui.tests.validation;
+
+
+import java.util.ArrayList;
+import java.util.List;
+
+import junit.framework.TestCase;
+
+import org.eclipse.core.resources.IFile;
+import org.eclipse.core.resources.IProject;
+import org.eclipse.wst.html.internal.validation.HTMLValidator;
+import org.eclipse.wst.html.ui.tests.ProjectUtil;
+import org.eclipse.wst.sse.core.StructuredModelManager;
+import org.eclipse.wst.sse.core.internal.provisional.IStructuredModel;
+import org.eclipse.wst.sse.core.internal.provisional.text.IStructuredDocument;
+import org.eclipse.wst.validation.internal.operations.WorkbenchContext;
+import org.eclipse.wst.validation.internal.provisional.core.IMessage;
+import org.eclipse.wst.validation.internal.provisional.core.IReporter;
+import org.eclipse.wst.validation.internal.provisional.core.IValidator;
+
+/**
+ * Test for the HTMLValidator
+ * 
+ * @see org.eclipse.wst.html.internal.validation.HTMLValidator
+ */
+public class TestHTMLValidator extends TestCase {
+
+	private HTMLValidator fValidator = new HTMLValidator();
+	
+	/**
+	 * 
+	 */
+	public TestHTMLValidator() {
+		super("Test HTMLValidator");
+	}
+
+	/**
+	 * @param name
+	 */
+	public TestHTMLValidator(String name) {
+		super(name);
+	}
+	
+	/**
+	 * Regression test for Bug 285285
+	 * 
+	 * @see org.eclipse.wst.xml.ui.internal.validation.TestDelegatingSourceValidatorForXML#testRemoveAndAddBackCommentEndTag
+	 * @see org.eclipse.wst.html.ui.tests.validation.TestHTMLValidator#testRemoveAndAddBackCommentEndTag
+	 * @see org.eclipse.jst.jsp.ui.tests.validation.JSPHTMLValidatorTest#testRemoveAndAddBackCommentEndTag
+	 */
+	public void testRemoveAndAddBackCommentEndTag() throws Exception{
+		String projectName = "RemoveAndAddBackCommentEndTag";
+		IProject project = ProjectUtil.createProject(projectName, null, null);
+		
+		IFile testFile = null;
+		IStructuredModel model = null;
+		
+		try {
+			//get test file
+			ProjectUtil.copyBundleEntriesIntoWorkspace("testresources/RemoveAndAddBackCommentEndTag", projectName);
+			testFile = project.getFile("Test1.html");
+			assertTrue("Test file " + testFile + " does not exist", testFile.exists());
+			
+			//get the document
+			model = StructuredModelManager.getModelManager().getModelForEdit(testFile);
+			IStructuredDocument document = model.getStructuredDocument();
+			
+			//set up for fValidator
+			WorkbenchContext context = new WorkbenchContext();
+			List fileList = new ArrayList();
+			fileList.add(testFile.getFullPath().toPortableString());
+			context.setValidationFileURIs(fileList);
+			
+			//validate clean file
+			TestReporter reporter = new TestReporter();
+			fValidator.validate(context, reporter);
+			assertFalse("There should be no validation errors on " + testFile, reporter.isMessageReported());
+			
+			//remove -->
+			document.replace(258, 3, "");
+			
+			//validate file with error
+			reporter = new TestReporter();
+			fValidator.validate(context, reporter);
+			assertTrue("There should be validation errors on " + testFile, reporter.isMessageReported());
+		
+			//replace -->
+			document.replace(258, 0, "-->");
+			
+			//validate clean file
+			reporter = new TestReporter();
+			fValidator.validate(context, reporter);
+			assertFalse("There should be no validation errors on " + testFile, reporter.isMessageReported());
+		} finally {
+			if(model != null) {
+				model.releaseFromEdit();
+			}
+		}
+	}
+	
+	/**
+	 * A <code>IReporter</code> for testing validators
+	 */
+	private class TestReporter implements IReporter {
+		private boolean messageReported = false;
+		
+		public TestReporter(){}
+		
+		public void addMessage(IValidator origin, IMessage message) {
+			messageReported = true;
+		}
+		
+		public boolean isMessageReported() {
+			return messageReported;
+		}
+
+		public void displaySubtask(IValidator validator, IMessage message) {}
+
+		public List getMessages() {
+			return null;
+		}
+
+		public boolean isCancelled() {
+			return false;
+		}
+
+		public void removeAllMessages(IValidator origin, Object object) {}
+
+		public void removeAllMessages(IValidator origin) {}
+
+		public void removeMessageSubset(IValidator validator, Object obj, String groupName) {}
+	}
+}
diff --git a/tests/org.eclipse.wst.html.ui.tests/testresources/RemoveAndAddBackCommentEndTag/Test1.html b/tests/org.eclipse.wst.html.ui.tests/testresources/RemoveAndAddBackCommentEndTag/Test1.html
new file mode 100644
index 0000000..12c020a
--- /dev/null
+++ b/tests/org.eclipse.wst.html.ui.tests/testresources/RemoveAndAddBackCommentEndTag/Test1.html
@@ -0,0 +1,12 @@
+<!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>
+
+<!--  Test -->
+
+</body>
+</html>
\ No newline at end of file
diff --git a/tests/org.eclipse.wst.xml.ui.tests/META-INF/MANIFEST.MF b/tests/org.eclipse.wst.xml.ui.tests/META-INF/MANIFEST.MF
index 2becd12..85bbb22 100644
--- a/tests/org.eclipse.wst.xml.ui.tests/META-INF/MANIFEST.MF
+++ b/tests/org.eclipse.wst.xml.ui.tests/META-INF/MANIFEST.MF
@@ -2,7 +2,7 @@
 Bundle-ManifestVersion: 2
 Bundle-Name: %Bundle-Name.0
 Bundle-SymbolicName: org.eclipse.wst.xml.ui.tests; singleton:=true
-Bundle-Version: 1.0.300.qualifier
+Bundle-Version: 1.0.301.qualifier
 Bundle-ClassPath: xmluitests.jar
 Bundle-Activator: org.eclipse.wst.xml.ui.tests.XMLUITestsPlugin
 Bundle-Vendor: %providerName
diff --git a/tests/org.eclipse.wst.xml.ui.tests/src/org/eclipse/wst/xml/ui/internal/validation/TestDelegatingSourceValidatorForXML.java b/tests/org.eclipse.wst.xml.ui.tests/src/org/eclipse/wst/xml/ui/internal/validation/TestDelegatingSourceValidatorForXML.java
index 4d8408e..562522f 100644
--- a/tests/org.eclipse.wst.xml.ui.tests/src/org/eclipse/wst/xml/ui/internal/validation/TestDelegatingSourceValidatorForXML.java
+++ b/tests/org.eclipse.wst.xml.ui.tests/src/org/eclipse/wst/xml/ui/internal/validation/TestDelegatingSourceValidatorForXML.java
@@ -1,5 +1,5 @@
 /*******************************************************************************
- * Copyright (c) 2006 IBM Corporation and others.
+ * Copyright (c) 2006, 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
@@ -23,11 +23,15 @@
 import org.eclipse.core.runtime.FileLocator;
 import org.eclipse.core.runtime.NullProgressMonitor;
 import org.eclipse.core.runtime.Path;
+import org.eclipse.wst.sse.core.StructuredModelManager;
+import org.eclipse.wst.sse.core.internal.provisional.IStructuredModel;
+import org.eclipse.wst.sse.core.internal.provisional.text.IStructuredDocument;
 import org.eclipse.wst.validation.internal.core.ValidationException;
 import org.eclipse.wst.validation.internal.operations.WorkbenchContext;
 import org.eclipse.wst.validation.internal.provisional.core.IMessage;
 import org.eclipse.wst.validation.internal.provisional.core.IReporter;
 import org.eclipse.wst.validation.internal.provisional.core.IValidator;
+import org.eclipse.wst.xml.ui.tests.ProjectUtil;
 import org.eclipse.wst.xml.ui.tests.XMLUITestsPlugin;
 
 /**
@@ -108,53 +112,95 @@
 		assertFalse("Messages were reported on valid file 2.", reporter2.isMessageReported());
 	}
 	
-	private class TestReporter implements IReporter
-	{
-		protected boolean messageReported = false;
+	/**
+	 * Regression test for Bug 285285
+	 * 
+	 * @see org.eclipse.wst.xml.ui.internal.validation.TestDelegatingSourceValidatorForXML#testRemoveAndAddBackCommentEndTag
+	 * @see org.eclipse.wst.html.ui.tests.validation.TestHTMLValidator#testRemoveAndAddBackCommentEndTag
+	 * @see org.eclipse.jst.jsp.ui.tests.validation.JSPHTMLValidatorTest#testRemoveAndAddBackCommentEndTag
+	 */
+	public void testRemoveAndAddBackCommentEndTag() throws Exception{
+		String projectName = "RemoveAndAddBackCommentEndTag";
+		IProject project = ProjectUtil.createProject(projectName, null, null);
 		
-		public TestReporter(){
+		IFile testFile = null;
+		IStructuredModel model = null;
+		
+		try {
+			//get test file
+			ProjectUtil.copyBundleEntriesIntoWorkspace("testresources/RemoveAndAddBackCommentEndTag", projectName);
+			testFile = project.getFile("Test1.xml");
+			assertTrue("Test file " + testFile + " does not exist", testFile.exists());
 			
+			//get the document
+			model = StructuredModelManager.getModelManager().getModelForEdit(testFile);
+			IStructuredDocument document = model.getStructuredDocument();
+			
+			//set up for validator
+			WorkbenchContext context = new WorkbenchContext();
+			List fileList = new ArrayList();
+			fileList.add(testFile.getFullPath().toPortableString());
+			context.setValidationFileURIs(fileList);
+			
+			//validate clean file
+			TestReporter reporter = new TestReporter();
+			sourceValidator.validate(context, reporter);
+			assertFalse("There should be no validation errors on " + testFile, reporter.isMessageReported());
+			
+			//remove -->
+			document.replace(176, 3, "");
+			
+			//validate file with error
+			reporter = new TestReporter();
+			sourceValidator.validate(context, reporter);
+			assertTrue("There should be validation errors on " + testFile, reporter.isMessageReported());
+		
+			//replace -->
+			document.replace(176, 0, "-->");
+			
+			//validate clean file
+			reporter = new TestReporter();
+			sourceValidator.validate(context, reporter);
+			assertFalse("There should be no validation errors on " + testFile, reporter.isMessageReported());
+		} catch(ValidationException e) {
+			fail("Could not validate test file " + testFile + ": " + e.getMessage());
+		} finally {
+			if(model != null) {
+				model.releaseFromEdit();
+			}
 		}
+	}
+	
+	/**
+	 * A <code>IReporter</code> for testing validators
+	 */
+	private class TestReporter implements IReporter {
+		private boolean messageReported = false;
+		
+		public TestReporter(){}
 		
 		public void addMessage(IValidator origin, IMessage message) {
 			messageReported = true;
-			
 		}
 		
-		public boolean isMessageReported()
-		{
+		public boolean isMessageReported() {
 			return messageReported;
 		}
 
-		public void displaySubtask(IValidator validator, IMessage message) {
-			// TODO Auto-generated method stub
-			
-		}
+		public void displaySubtask(IValidator validator, IMessage message) {}
 
 		public List getMessages() {
-			// TODO Auto-generated method stub
 			return null;
 		}
 
 		public boolean isCancelled() {
-			// TODO Auto-generated method stub
 			return false;
 		}
 
-		public void removeAllMessages(IValidator origin, Object object) {
-			// TODO Auto-generated method stub
-			
-		}
+		public void removeAllMessages(IValidator origin, Object object) {}
 
-		public void removeAllMessages(IValidator origin) {
-			// TODO Auto-generated method stub
-			
-		}
+		public void removeAllMessages(IValidator origin) {}
 
-		public void removeMessageSubset(IValidator validator, Object obj, String groupName) {
-			// TODO Auto-generated method stub
-			
-		}
-		
+		public void removeMessageSubset(IValidator validator, Object obj, String groupName) {}
 	}
 }
diff --git a/tests/org.eclipse.wst.xml.ui.tests/testresources/RemoveAndAddBackCommentEndTag/Test1.xml b/tests/org.eclipse.wst.xml.ui.tests/testresources/RemoveAndAddBackCommentEndTag/Test1.xml
new file mode 100644
index 0000000..2144d8d
--- /dev/null
+++ b/tests/org.eclipse.wst.xml.ui.tests/testresources/RemoveAndAddBackCommentEndTag/Test1.xml
@@ -0,0 +1,9 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<foo
+	xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+	xsi:noNamespaceSchemaLocation="Test1Schema.xsd">
+	
+	<bar>
+		<!-- Test -->
+	</bar>
+</foo>
\ No newline at end of file
diff --git a/tests/org.eclipse.wst.xml.ui.tests/testresources/RemoveAndAddBackCommentEndTag/Test1Schema.xsd b/tests/org.eclipse.wst.xml.ui.tests/testresources/RemoveAndAddBackCommentEndTag/Test1Schema.xsd
new file mode 100644
index 0000000..bfbe391
--- /dev/null
+++ b/tests/org.eclipse.wst.xml.ui.tests/testresources/RemoveAndAddBackCommentEndTag/Test1Schema.xsd
@@ -0,0 +1,10 @@
+<xsd:schema xmlns:xsd="http://www.w3.org/2001/XMLSchema">
+	<xsd:element name="foo" type="xsdFoo" />
+	
+
+	<xsd:complexType name="xsdFoo">
+		<xsd:sequence>
+			<xsd:element name="bar" type="xsd:string" />
+		</xsd:sequence>
+	</xsd:complexType>
+</xsd:schema>
\ No newline at end of file