[340840] NPE during validating an erroneous jsp file
diff --git a/bundles/org.eclipse.jst.jsp.core/src/org/eclipse/jst/jsp/core/internal/java/JSPTranslation.java b/bundles/org.eclipse.jst.jsp.core/src/org/eclipse/jst/jsp/core/internal/java/JSPTranslation.java
index 2c62bb6..e91499f 100644
--- a/bundles/org.eclipse.jst.jsp.core/src/org/eclipse/jst/jsp/core/internal/java/JSPTranslation.java
+++ b/bundles/org.eclipse.jst.jsp.core/src/org/eclipse/jst/jsp/core/internal/java/JSPTranslation.java
@@ -1,5 +1,5 @@
 /*******************************************************************************
- * Copyright (c) 2004, 2010 IBM Corporation and others.
+ * Copyright (c) 2004, 2011 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
@@ -520,17 +520,12 @@
 		}
 	}
 
-	public void retranslate() {
-		if (fTranslator != null) {
-			// retranslate and initialize this translation
-			fTranslator.reset();
-			fTranslator.translate();
-			initialize();
+	public void retranslate(JSPTranslator translator) {
+		fTranslator = translator;
+		initialize();
 
-			// Also, if we have a compilation unit, reset the contents
-			synchronized (fLock) {
-				setContents(fCompilationUnit);
-			}
+		synchronized (fLock) {
+			setContents(getCompilationUnit());
 		}
 	}
 
diff --git a/bundles/org.eclipse.jst.jsp.core/src/org/eclipse/jst/jsp/core/internal/java/JSPTranslationAdapter.java b/bundles/org.eclipse.jst.jsp.core/src/org/eclipse/jst/jsp/core/internal/java/JSPTranslationAdapter.java
index ac7475e..d89fe0a 100644
--- a/bundles/org.eclipse.jst.jsp.core/src/org/eclipse/jst/jsp/core/internal/java/JSPTranslationAdapter.java
+++ b/bundles/org.eclipse.jst.jsp.core/src/org/eclipse/jst/jsp/core/internal/java/JSPTranslationAdapter.java
@@ -1,5 +1,5 @@
 /*******************************************************************************
- * Copyright (c) 2004, 2010 IBM Corporation and others.
+ * Copyright (c) 2004, 2011 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
@@ -160,11 +160,13 @@
 				StringBuffer emptyContents = translator.getEmptyTranslation();
 				fJavaDocument = new Document(emptyContents.toString());
 			}
-			// it's going to be rebuilt, so we release it here
+			// Just a dirty translation, re-translate
 			if (fJSPTranslation != null) {
 				if (DEBUG)
 					System.out.println("JSPTranslationAdapter retranslating:" + fJSPTranslation); //$NON-NLS-1$
-				fJSPTranslation.retranslate();
+				fJSPTranslation.retranslate(fJavaDocument, translator);
+				fDocumentIsDirty = false;
+				return fJSPTranslation;
 			}
 			fJSPTranslation = new JSPTranslationExtension(getXMLModel().getStructuredDocument(), fJavaDocument, getJavaProject(), translator);
 			fDocumentIsDirty = false;
diff --git a/bundles/org.eclipse.jst.jsp.core/src/org/eclipse/jst/jsp/core/internal/java/JSPTranslationExtension.java b/bundles/org.eclipse.jst.jsp.core/src/org/eclipse/jst/jsp/core/internal/java/JSPTranslationExtension.java
index ad5feea..a0ab715 100644
--- a/bundles/org.eclipse.jst.jsp.core/src/org/eclipse/jst/jsp/core/internal/java/JSPTranslationExtension.java
+++ b/bundles/org.eclipse.jst.jsp.core/src/org/eclipse/jst/jsp/core/internal/java/JSPTranslationExtension.java
@@ -1,5 +1,5 @@
 /*******************************************************************************
- * Copyright (c) 2004, 2010 IBM Corporation and others.
+ * Copyright (c) 2004, 2011 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
@@ -94,6 +94,13 @@
 		addPositionsToDocuments();
 	}
 
+	public void retranslate(IDocument javaDocument, JSPTranslator translator) {
+		fJavaDocument = javaDocument;
+		retranslate(translator);
+
+		addPositionsToDocuments();
+	}
+
 	public IDocument getJspDocument() {
 		return fJspDocument;
 	}