Early adopting patch for Bug 311048 -  AbortCompilation propagated from CompilationUnitProblemFinder.process()
diff --git a/org.eclipse.jdt.core/model/org/eclipse/jdt/internal/core/CompilationUnitProblemFinder.java b/org.eclipse.jdt.core/model/org/eclipse/jdt/internal/core/CompilationUnitProblemFinder.java
index dd619ed..d7d7009 100644
--- a/org.eclipse.jdt.core/model/org/eclipse/jdt/internal/core/CompilationUnitProblemFinder.java
+++ b/org.eclipse.jdt.core/model/org/eclipse/jdt/internal/core/CompilationUnitProblemFinder.java
@@ -171,20 +171,24 @@
 		return config;
 	}
 // SH}
+	/*
+	 * Can return null if the process was aborted or canceled 
+	 */
 	public static CompilationUnitDeclaration process(
-		CompilationUnit unitElement,
-		SourceElementParser parser,
-		WorkingCopyOwner workingCopyOwner,
-		HashMap problems,
-		boolean creatingAST,
-		int reconcileFlags,
-		IProgressMonitor monitor)
+			CompilationUnit unitElement,
+			SourceElementParser parser,
+			WorkingCopyOwner workingCopyOwner,
+			HashMap problems,
+			boolean creatingAST,
+			int reconcileFlags,
+			IProgressMonitor monitor)
 		throws JavaModelException {
 
 		JavaProject project = (JavaProject) unitElement.getJavaProject();
 		CancelableNameEnvironment environment = null;
 		CancelableProblemFactory problemFactory = null;
 		CompilationUnitProblemFinder problemFinder = null;
+		CompilationUnitDeclaration unit = null;
 		try {
 			environment = new CancelableNameEnvironment(project, workingCopyOwner, monitor);
 			problemFactory = new CancelableProblemFactory(monitor);
@@ -201,10 +205,9 @@
 			if (ignoreMethodBodies) {
 				analyzeAndGenerateCode = false;
 			}
-			CompilationUnitDeclaration unit = null;
-			if (parser != null) {
-				problemFinder.parser = parser;
-				try {
+			try {
+				if (parser != null) {
+					problemFinder.parser = parser;
 					unit = parser.parseCompilationUnit(unitElement, true/*full parse*/, monitor);
 					problemFinder.resolve(
 						unit,
@@ -212,37 +215,38 @@
 						true, // verify methods
 						analyzeAndGenerateCode, // analyze code
 						analyzeAndGenerateCode); // generate code
-				} catch (AbortCompilation e) {
-					problemFinder.handleInternalException(e, unit);
+				} else {
+					unit =
+						problemFinder.resolve(
+							unitElement,
+							true, // verify methods
+							analyzeAndGenerateCode, // analyze code
+							analyzeAndGenerateCode); // generate code
 				}
-			} else {
-				unit =
-					problemFinder.resolve(
-						unitElement,
-						true, // verify methods
-						analyzeAndGenerateCode, // analyze code
-						analyzeAndGenerateCode); // generate code
+			} catch (AbortCompilation e) {
+				problemFinder.handleInternalException(e, unit);
 			}
-			CompilationResult unitResult = unit.compilationResult;
-			CategorizedProblem[] unitProblems = unitResult.getProblems();
-			int length = unitProblems == null ? 0 : unitProblems.length;
-			if (length > 0) {
-				CategorizedProblem[] categorizedProblems = new CategorizedProblem[length];
-				System.arraycopy(unitProblems, 0, categorizedProblems, 0, length);
-				problems.put(IJavaModelMarker.JAVA_MODEL_PROBLEM_MARKER, categorizedProblems);
+			if (unit != null) {
+				CompilationResult unitResult = unit.compilationResult;
+				CategorizedProblem[] unitProblems = unitResult.getProblems();
+				int length = unitProblems == null ? 0 : unitProblems.length;
+				if (length > 0) {
+					CategorizedProblem[] categorizedProblems = new CategorizedProblem[length];
+					System.arraycopy(unitProblems, 0, categorizedProblems, 0, length);
+					problems.put(IJavaModelMarker.JAVA_MODEL_PROBLEM_MARKER, categorizedProblems);
+				}
+				unitProblems = unitResult.getTasks();
+				length = unitProblems == null ? 0 : unitProblems.length;
+				if (length > 0) {
+					CategorizedProblem[] categorizedProblems = new CategorizedProblem[length];
+					System.arraycopy(unitProblems, 0, categorizedProblems, 0, length);
+					problems.put(IJavaModelMarker.TASK_MARKER, categorizedProblems);
+				}
+				if (NameLookup.VERBOSE) {
+					System.out.println(Thread.currentThread() + " TIME SPENT in NameLoopkup#seekTypesInSourcePackage: " + environment.nameLookup.timeSpentInSeekTypesInSourcePackage + "ms");  //$NON-NLS-1$ //$NON-NLS-2$
+					System.out.println(Thread.currentThread() + " TIME SPENT in NameLoopkup#seekTypesInBinaryPackage: " + environment.nameLookup.timeSpentInSeekTypesInBinaryPackage + "ms");  //$NON-NLS-1$ //$NON-NLS-2$
+				}
 			}
-			unitProblems = unitResult.getTasks();
-			length = unitProblems == null ? 0 : unitProblems.length;
-			if (length > 0) {
-				CategorizedProblem[] categorizedProblems = new CategorizedProblem[length];
-				System.arraycopy(unitProblems, 0, categorizedProblems, 0, length);
-				problems.put(IJavaModelMarker.TASK_MARKER, categorizedProblems);
-			}
-			if (NameLookup.VERBOSE) {
-				System.out.println(Thread.currentThread() + " TIME SPENT in NameLoopkup#seekTypesInSourcePackage: " + environment.nameLookup.timeSpentInSeekTypesInSourcePackage + "ms");  //$NON-NLS-1$ //$NON-NLS-2$
-				System.out.println(Thread.currentThread() + " TIME SPENT in NameLoopkup#seekTypesInBinaryPackage: " + environment.nameLookup.timeSpentInSeekTypesInBinaryPackage + "ms");  //$NON-NLS-1$ //$NON-NLS-2$
-			}
-			return unit;
 		} catch (OperationCanceledException e) {
 			// catch this exception so as to not enter the catch(RuntimeException e) below
 			throw e;
@@ -267,16 +271,17 @@
 			if (problemFinder != null && !creatingAST)
 				problemFinder.lookupEnvironment.reset();
 		}
+		return unit;
 	}
 
 	public static CompilationUnitDeclaration process(
-		CompilationUnit unitElement,
-		WorkingCopyOwner workingCopyOwner,
-		HashMap problems,
-		boolean creatingAST,
-		int reconcileFlags,
-		IProgressMonitor monitor)
-		throws JavaModelException {
+			CompilationUnit unitElement,
+			WorkingCopyOwner workingCopyOwner,
+			HashMap problems,
+			boolean creatingAST,
+			int reconcileFlags,
+			IProgressMonitor monitor)
+			throws JavaModelException {
 
 		return process(unitElement, null/*use default Parser*/, workingCopyOwner, problems, creatingAST, reconcileFlags, monitor);
 	}