【发布时间】:2011-11-17 15:05:40
【问题描述】:
我很确定这在以前有效,但是 eclipse 说它在 throw 行中有错误。
try{}
}catch(Exception e){
throw e; }
在我以前的学生项目中,我写道:
try {
Class.forName("org.postgresql.Driver");
this.connection = DriverManager.getConnection(
DataSource.getURL(), DataSource.getUserName(), DataSource.getPassword());
} catch (ClassNotFoundException e) {
System.out.println("Could not find driver to connect to database. Please make"
+ "sure the correseponding postgreSQLjdbc library is added.");
throw e;
} catch (SQLException e) {
System.out.println("Username or password is not correct");
throw e;
}
这是完美的。
只有这种类型有效,但不是我想要的
throw new UnsupportedAddressTypeException();
【问题讨论】: