我的问题是如果假设CalTransactionFactory未初始化或类不存在。然后,我想捕获该异常并抛出异常。所以它应该在RuntimeException或Exception之下。下面是代码如何处理异常
try {
calTransaction = CalTransactionFactory.create("PDS_GeoLocationService");
calTransaction.setName("GetLocationByIp");
calEvent=CalEventFactory.create("PersonalizationGeoLocationService");
calEvent.setName("IPAddress");
calEvent.addData("RemoteIP",ipAddress);
calEvent.completed();
calTransaction.setStatus("0");
} catch (RuntimeException re) {
calTransaction.setStatus(re);
getLogger().log(LogLevel.ERROR, "CAL is not initialized" +re.getMessage());
throw re;
}
catch (Exception e) {
getLogger().log(LogLevel.ERROR, "CAL is not initialized" +e.getMessage());
}
究竟是什么问题? – talnicolas 2012-03-09 20:18:00
看我的第一行。 – AKIWEB 2012-03-09 21:37:23