Silence boring Eclipse warnings: catching all exceptions

Here I make explicit where catching all exceptions is intended.
Mark Harrah corrected one decision during review.
This commit is contained in:
Paolo G. Giarrusso 2012-12-16 20:30:30 +01:00 committed by Mark Harrah
parent 40bc141058
commit 236143be8d
6 changed files with 12 additions and 7 deletions

View File

@ -34,7 +34,7 @@ object Boot
case b: BootException => errorAndExit(b.toString)
case r: xsbti.RetrieveException => errorAndExit("Error: " + r.getMessage)
case r: xsbti.FullReload => Some(r.arguments)
case e =>
case e: Throwable =>
e.printStackTrace
errorAndExit(Pre.prefixError(e.toString))
}
@ -55,7 +55,12 @@ object Boot
System.setProperty("sbt.log.format", "true")
} catch {
case ignore: ClassNotFoundException =>
case ex => println("Jansi found on class path but initialization failed: " + ex)
/* The below code intentionally traps everything. It technically shouldn't trap the
* non-StackOverflowError VirtualMachineErrors and AWTError would be weird, but this is PermGen
* mitigation code that should not render sbt completely unusable if jansi initialization fails.
* [From Mark Harrah, https://github.com/sbt/sbt/pull/633#issuecomment-11957578].
*/
case ex: Throwable => println("Jansi found on class path but initialization failed: " + ex)
}
}
}

View File

@ -35,7 +35,7 @@ object MainLoop
case e: xsbti.FullReload =>
deleteLastLog(logBacking)
throw e // pass along a reboot request
case e =>
case e: Throwable =>
System.err.println("sbt appears to be exiting abnormally.\n The log file for this session is at " + logBacking.file)
deleteLastLog(logBacking)
throw e

View File

@ -34,7 +34,7 @@ object TrapExit
catch
{
case e: TrapExitSecurityException => throw e
case x =>
case x: Throwable =>
code.set(1) //exceptions in the main thread cause the exit code to be 1
throw x
}

View File

@ -82,7 +82,7 @@ object SettingsTest extends Properties("settings")
def evaluate(settings: Seq[Setting[_]]): Settings[Scope] =
try { make(settings)(delegates, scopeLocal, showFullKey) }
catch { case e => e.printStackTrace; throw e }
catch { case e: Throwable => e.printStackTrace; throw e }
}
// This setup is a workaround for module synchronization issues
final class CCR(intermediate: Int)

View File

@ -20,7 +20,7 @@ object ErrorHandling
{
case ex @ (_: Exception | _: StackOverflowError) => Left(ex)
case err @ (_: ThreadDeath | _: VirtualMachineError) => throw err
case x => Left(x)
case x: Throwable => Left(x)
}
def convert[T](f: => T): Either[Exception, T] =

View File

@ -33,7 +33,7 @@ class BufferedLogger(delegate: AbstractLogger) extends BasicLogger
clear()
result
}
catch { case e => stopQuietly(); throw e }
catch { case e: Throwable => stopQuietly(); throw e }
}
def stopQuietly() = synchronized { try { stop() } catch { case e: Exception => () } }