Skip to content

Commit

Permalink
Merge pull request #1861 from lift/msf_issue_1843
Browse files Browse the repository at this point in the history
Add special handling for UnavailableException

This code adds special handling for javax.servelet.UnavailableException.
This exception is an idiomatic way to signal a full abort to the Java Application
server running the application.

From now on, we will log and re-throw this exception if we see it.
  • Loading branch information
Shadowfiend authored Jun 13, 2017
2 parents dc74f8d + dd33623 commit f03789b
Showing 1 changed file with 21 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -14,9 +14,9 @@
* limitations under the License.
*/

package net.liftweb
package http
package provider
package net.liftweb
package http
package provider

import net.liftweb.common._
import net.liftweb.util._
Expand Down Expand Up @@ -87,12 +87,29 @@ trait HTTPProvider {
preBoot
b.boot
} catch {
// The UnavailableException is the idiomatic way to tell a Java application container that
// the boot process has gone horribly, horribly wrong. That _must_ bubble to the application
// container that is invoking the app. See https://github.com/lift/framework/issues/1843
case unavailableException: javax.servlet.UnavailableException =>
logger.error("------------------------------------------------------------------")
logger.error("------------------------------------------------------------------")
logger.error("------------------------------------------------------------------")
logger.error("------------------------------------------------------------------")
logger.error("********** Failed to Boot! An UnavailableException was thrown and all futher boot activities are aborted", unavailableException);
logger.error("------------------------------------------------------------------")
logger.error("------------------------------------------------------------------")
logger.error("------------------------------------------------------------------")
logger.error("------------------------------------------------------------------")
logger.error("------------------------------------------------------------------")

throw unavailableException

case e: Exception =>
logger.error("------------------------------------------------------------------")
logger.error("------------------------------------------------------------------")
logger.error("------------------------------------------------------------------")
logger.error("------------------------------------------------------------------")
logger.error("********** Failed to Boot! Your application may not run properly", e);
logger.error("********** Failed to Boot! Your application may not run properly", e);
logger.error("------------------------------------------------------------------")
logger.error("------------------------------------------------------------------")
logger.error("------------------------------------------------------------------")
Expand Down

0 comments on commit f03789b

Please sign in to comment.