1
有幾個類似的問題,但主要是針對C#。catch(Exception ex)block missing
@Override
public void setExtraItemsDone(XMPPResourceConnection session) throws NotAuthorizedException
{
try
{
cp1 = Calendar.getInstance().getTimeInMillis();
try
{
...
} catch (TigaseDBException e) {
...
} catch (UnsupportedOperationException e) {
...
}
} catch (Exception e) {
cp2 = Calendar.getInstance().getTimeInMillis();
throw new NotAuthorizedException(e.getMessage() + "; method took " + (cp2 - cp1) + " ms", e);
}
我基本上希望搭上MySQLTimeoutException,並把它變成一個NotAuthorizedException在最後一個catch塊(同時保持眼睛除了TigaseDBException和UnsupportedOperationException異常任何其他的東西)。不知何故,Java迴避了我的總體規劃。
日誌顯示一條直線
com.mysql.jdbc.exceptions.MySQLTimeoutException: Statement cancelled due to timeout or client request
at com.mysql.jdbc.PreparedStatement.executeInternal(PreparedStatement.java:1754)
at com.mysql.jdbc.PreparedStatement.executeUpdate(PreparedStatement.java:2019)
at com.mysql.jdbc.PreparedStatement.executeUpdate(PreparedStatement.java:1937)
at com.mysql.jdbc.PreparedStatement.executeUpdate(PreparedStatement.java:1922)
at tigase.db.jdbc.JDBCRepository.addDataList(JDBCRepository.java:183)
at tigase.db.jdbc.JDBCRepository.setDataList(JDBCRepository.java:1175)
at tigase.db.UserRepositoryMDImpl.setDataList(UserRepositoryMDImpl.java:651)
at tigase.xmpp.RepositoryAccess.setDataList(RepositoryAccess.java:1152)
at tigase.xmpp.RepositoryAccess.setOfflineDataList(RepositoryAccess.java:1204)
**at tigase.xmpp.impl.XGateRoster.setExtraItemsDone(XGateRoster.java:370)**
at tigase.xmpp.impl.DynamicRoster.setExtraItemsDone(DynamicRoster.java:377)
at tigase.xmpp.impl.JabberIqRoster.dynamicSetRequest(JabberIqRoster.java:178)
at tigase.xmpp.impl.JabberIqRoster.process(JabberIqRoster.java:329)
at tigase.server.xmppsession.SessionManager$ProcessorWorkerThread.process(SessionManager.java:2135)
at tigase.util.WorkerThread.run(WorkerThread.java:132)
據我所知,在堆棧跟蹤粗體顯示的行應改變了異常的NotAuthorizedException品種。我錯過了什麼?
謝謝
我看不出代碼出現問題的方式,但看不到提供的堆棧跟蹤會發生。嘗試使用調試器來確保您輸入的是正確的catch塊,或者在代碼中添加一些打印以查看發生了什麼。 –
發佈整個堆棧跟蹤。我認爲在棧跟蹤中有一個**根**原因。 –
nope,沒有任何缺失,並且不能使用任何調試器/打印件,因爲錯誤不會發生,或者會由於打印太多而發生錯誤。我很確定我已經輸出了正確的.jar ... hmm – kellogs