本文整理匯總了Java中edu.umd.cs.findbugs.classfile.UncheckedAnalysisException類的典型用法代碼示例。如果您正苦於以下問題:Java UncheckedAnalysisException類的具體用法?Java UncheckedAnalysisException怎麽用?Java UncheckedAnalysisException使用的例子?那麽, 這裏精選的類代碼示例或許可以為您提供幫助。
UncheckedAnalysisException類屬於edu.umd.cs.findbugs.classfile包,在下文中一共展示了UncheckedAnalysisException類的1個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。
示例1: getDatabase
import edu.umd.cs.findbugs.classfile.UncheckedAnalysisException; //導入依賴的package包/類
public <E> E getDatabase(Class<E> databaseClass, boolean optional) {
Object database = databaseMap.get(databaseClass);
if (database == null) {
try {
// Find the database factory
IDatabaseFactory<?> databaseFactory = databaseFactoryMap.get(databaseClass);
if (databaseFactory == null) {
if (optional) return null;
throw new IllegalArgumentException("No database factory registered for " + databaseClass.getName());
}
// Create the database
database = databaseFactory.createDatabase();
} catch (CheckedAnalysisException e) {
// Error - record the analysis error
database = new AbnormalAnalysisResult(e);
}
// FIXME: should catch and re-throw RuntimeExceptions?
databaseMap.put(databaseClass, database);
}
if (database instanceof AbnormalAnalysisResult) {
throw new UncheckedAnalysisException("Error instantiating " + databaseClass.getName() + " database",
((AbnormalAnalysisResult) database).checkedAnalysisException);
}
return databaseClass.cast(database);
}