[81713] fixed 3 things
- cancel indexing job if OSGI framework is shutting down
- fixed the start/stop order in JSPCorePlugin to work more logically
  with dependency order
- added a check if JSPSearchSupport canceled in
  JSPSearchDocument.updateJavaInfo(...), and return if canceled
  since that's a starting point for most of JSP Search class usage
diff --git a/bundles/org.eclipse.jst.jsp.core/src/org/eclipse/jst/jsp/core/internal/JSPCorePlugin.java b/bundles/org.eclipse.jst.jsp.core/src/org/eclipse/jst/jsp/core/internal/JSPCorePlugin.java
index 72e45b5..a01582f 100644
--- a/bundles/org.eclipse.jst.jsp.core/src/org/eclipse/jst/jsp/core/internal/JSPCorePlugin.java
+++ b/bundles/org.eclipse.jst.jsp.core/src/org/eclipse/jst/jsp/core/internal/JSPCorePlugin.java
@@ -102,6 +102,10 @@
 	public void start(BundleContext context) throws Exception {
 		super.start(context);
 		
+		// JSPIndexManager depends on TaglibController, so TaglibController
+		// should be started first
+		TaglibController.startup();
+		
 		// add JSPIndexManager to keep JSP Index up to date
 		// listening for IResourceChangeEvent.PRE_DELETE and IResourceChangeEvent.POST_CHANGE
 		ResourcesPlugin.getWorkspace().addResourceChangeListener(JSPIndexManager.getInstance(), IResourceChangeEvent.POST_CHANGE);
@@ -109,21 +113,20 @@
 		// https://w3.opensource.ibm.com/bugzilla/show_bug.cgi?id=5091
 		// makes sure IndexManager is aware of our indexes
 		JSPIndexManager.getInstance().saveIndexes();
-		
-		TaglibController.startup();
 	}
 	
 	/* (non-Javadoc)
 	 * @see org.eclipse.core.runtime.Plugin#stop(org.osgi.framework.BundleContext)
 	 */
 	public void stop(BundleContext context) throws Exception {
-		TaglibController.shutdown();
+		// stop listening
+		ResourcesPlugin.getWorkspace().removeResourceChangeListener(JSPIndexManager.getInstance());
 		// stop any searching/indexing
 		JSPSearchSupport.getInstance().setCanceled(true);
-		// remove JSPIndexManager
-		ResourcesPlugin.getWorkspace().removeResourceChangeListener(JSPIndexManager.getInstance());
-		super.stop(context);
+		 
+		TaglibController.shutdown();
 		
+		super.stop(context);
 	}
 
 	/**
diff --git a/bundles/org.eclipse.jst.jsp.core/src/org/eclipse/jst/jsp/core/internal/java/search/JSPIndexManager.java b/bundles/org.eclipse.jst.jsp.core/src/org/eclipse/jst/jsp/core/internal/java/search/JSPIndexManager.java
index 826a676..1b14c18 100644
--- a/bundles/org.eclipse.jst.jsp.core/src/org/eclipse/jst/jsp/core/internal/java/search/JSPIndexManager.java
+++ b/bundles/org.eclipse.jst.jsp.core/src/org/eclipse/jst/jsp/core/internal/java/search/JSPIndexManager.java
@@ -36,6 +36,7 @@
 import org.eclipse.jst.jsp.core.internal.JSPCorePlugin;
 import org.eclipse.jst.jsp.core.internal.Logger;
 import org.eclipse.wst.common.encoding.content.IContentTypeIdentifier;
+import org.osgi.framework.Bundle;
 
 /**
  * Responsible for keeping the JSP index up to date.
@@ -71,6 +72,9 @@
 	/** indexing job was canceled in the middle of it, index needs to be rebuilt */
 	public static final int S_CANCELED = 4;
 	
+	/** symbolic name for OSGI framework */
+	private final String OSGI_FRAMEWORK_ID = "org.eclipse.osgi";
+	
 	/**
 	 * Collects JSP files from a resource delta.
 	 */
@@ -86,7 +90,7 @@
 		public boolean visit(IResourceDelta delta) throws CoreException {
 			
 			// in case JSP search was canceled (eg. when closing the editor)
-			if(JSPSearchSupport.getInstance().isCanceled()) {
+			if(JSPSearchSupport.getInstance().isCanceled() || frameworkIsShuttingDown()) {
 				setCanceledState();
 				return false;
 			}
@@ -176,7 +180,7 @@
 		
 		protected IStatus run(IProgressMonitor monitor) {
 			
-			if(isCanceled(monitor)) {
+			if(isCanceled(monitor) || frameworkIsShuttingDown()) {
 				setCanceledState();
 				return Status.CANCEL_STATUS;
 			}
@@ -200,7 +204,7 @@
 				    if(indexManager.awaitingJobsCount() == 0) {
 				        // process a batch of JSP files
 						for(; i<nextEnd; i++) {
-							if(isCanceled(monitor)) {
+							if(isCanceled(monitor) || frameworkIsShuttingDown()) {
 								setCanceledState();
 								return Status.CANCEL_STATUS;
 							}
@@ -216,8 +220,10 @@
 								}
 							}
 							catch (CoreException e) {
-							    String filename = this.jspFiles[i] != null ? this.jspFiles[i].getFullPath().toString() : ""; //$NON-NLS-1$
-								Logger.logException("JSPIndexer problem indexing:" + filename,  e); //$NON-NLS-1$
+								if(!frameworkIsShuttingDown()) {
+								    String filename = this.jspFiles[i] != null ? this.jspFiles[i].getFullPath().toString() : ""; //$NON-NLS-1$
+									Logger.logException("JSPIndexer problem indexing:" + filename,  e); //$NON-NLS-1$
+								}
 							}
 							catch (Exception e){
 							    // RATLC00284776
@@ -228,8 +234,10 @@
 							    // 
 							    // a possible solution is to keep track of the exceptions logged
 							    // and only log a certain amt of the same one, otherwise skip it.
-							    String filename = this.jspFiles[i] != null ? this.jspFiles[i].getFullPath().toString() : ""; //$NON-NLS-1$
-							    Logger.logException("JSPIndexer problem indexing:" + filename,  e); //$NON-NLS-1$
+								if(!frameworkIsShuttingDown()) {
+								    String filename = this.jspFiles[i] != null ? this.jspFiles[i].getFullPath().toString() : ""; //$NON-NLS-1$
+								    Logger.logException("JSPIndexer problem indexing:" + filename,  e); //$NON-NLS-1$
+								}
 							}
 						}// end inner for
 						remaining = this.jspFiles.length - nextEnd;
@@ -506,4 +514,19 @@
 			this.fContentTypeJSP = Platform.getContentTypeManager().getContentType(IContentTypeIdentifier.ContentTypeID_JSP);
 		return this.fContentTypeJSP;
 	}
+	
+	/**
+	 * A check to see if the OSGI framework is shutting down.
+	 * @return true if the System Bundle is stopped (ie. the framework is shutting down)
+	 */
+	boolean frameworkIsShuttingDown() {
+		// in the Framework class there's a note:
+		// set the state of the System Bundle to STOPPING.
+		// this must be done first according to section 4.19.2 from the OSGi R3 spec.  
+		boolean shuttingDown = Platform.getBundle(OSGI_FRAMEWORK_ID).getState() == Bundle.STOPPING;
+		if (DEBUG && shuttingDown) {
+			System.out.println("JSPIndexManager: system is shutting down!");
+		}
+		return shuttingDown;
+	}
 }
\ No newline at end of file
diff --git a/bundles/org.eclipse.jst.jsp.core/src/org/eclipse/jst/jsp/core/internal/java/search/JSPSearchDocument.java b/bundles/org.eclipse.jst.jsp.core/src/org/eclipse/jst/jsp/core/internal/java/search/JSPSearchDocument.java
index f551471..8486ae4 100644
--- a/bundles/org.eclipse.jst.jsp.core/src/org/eclipse/jst/jsp/core/internal/java/search/JSPSearchDocument.java
+++ b/bundles/org.eclipse.jst.jsp.core/src/org/eclipse/jst/jsp/core/internal/java/search/JSPSearchDocument.java
@@ -109,6 +109,9 @@
 		if(!JSPSearchSupport.isJsp(file))
 			return;
 		
+		if(JSPSearchSupport.getInstance().isCanceled())
+			return;
+		
 		XMLModel xmlModel = null;
 		try {
 			// get existing model for read, then get document from it