[297852] Error log entry for ArrayIndexOutOfBoundsException related to Annotations and EMF
diff --git a/plugins/org.eclipse.jst.common.annotations.core/src/org/eclipse/jst/common/internal/annotations/core/AnnotationTagParser.java b/plugins/org.eclipse.jst.common.annotations.core/src/org/eclipse/jst/common/internal/annotations/core/AnnotationTagParser.java
index 6196693..3c720f4 100644
--- a/plugins/org.eclipse.jst.common.annotations.core/src/org/eclipse/jst/common/internal/annotations/core/AnnotationTagParser.java
+++ b/plugins/org.eclipse.jst.common.annotations.core/src/org/eclipse/jst/common/internal/annotations/core/AnnotationTagParser.java
@@ -31,6 +31,8 @@
 	int pos;
 
 	int endOfLastGoodAttParse;
+	
+	private Object annotationLock = new Object();
 
 	public AnnotationTagParser(TagParseEventHandler tp) {
 		if (tp == null) {
@@ -241,9 +243,11 @@
 	}
 
 	public void setParserInput(char[] text) {
-		input = text;
-		pos = 0;
-		endOfLastGoodAttParse = 0;
+		synchronized(annotationLock) {
+			input = text;
+			pos = 0;
+			endOfLastGoodAttParse = 0;
+		}
 	}
 
 	public void setParserInput(String text) {
@@ -251,15 +255,17 @@
 	}
 
 	public void parse() {
-		while (!eos()) {
-			skipToTagChar();
-			Token tag = expectTag();
-			if (tag == null) {
-				break;
+		synchronized (annotationLock) {
+			while (!eos()) {
+				skipToTagChar();
+				Token tag = expectTag();
+				if (tag == null) {
+					break;
+				}
+				handler.annotationTag(tag);
+				parseAttributes();
+				handler.endOfTag(endOfLastGoodAttParse);
 			}
-			handler.annotationTag(tag);
-			parseAttributes();
-			handler.endOfTag(endOfLastGoodAttParse);
 		}
 	}