次のようなクラスがあります。PMD ルールを実行すると、 type の PMD Alert が発生しAvoidThrowingRawExceptionTypes
ます。コンストラクターの throws 句に他の例外タイプを追加するとエラーが発生するため、これを解決できません
new PersistenceManager(CommonConstants.IP_DB)
これを解決するには?誰でもこれについて私を助けることができますか?.
public class PersistenceManager implements CommonConstants {
.....
/**
* Stores the persistence mgr for IPMasterData_DB
*/
public static PersistenceManager IPMasterData_DB = new PersistenceManager(
CommonConstants.IP_DB);
/**
* Configures the data source according to the resource passed.
*
* @param dbName
* Databasename
*/
protected PersistenceManager(String dbName) throws Exception{
String resourceName = "";
if (LOGGER == null) {
LOGGER = Logger.getLogger(PersistenceManager.class);
}
try {
resourceName = getConfigFileName(dbName);
this.sessionFactory = new Configuration().configure(resourceName)
.setProperty("hibernate.jdbc.batch_size",
PersistenceManager.getBatchSize(dbName))
.buildSessionFactory();
} catch (HibernateException ex) {
ex.printStackTrace();
LOGGER
.error("Exception building SessionFactory for configKey ",
ex);
throw new RuntimeException(ErrorConstants.SESSIONFACTORY_BUILD, ex);
}
}
}