catch (IOException ex) {
logger.log(ex);
throw ex;
catch (SQLException ex) {
logger.log(ex);
throw ex;
}
In releases prior to Java SE 7, it is difficult to create a common method to eliminate the duplicated code because the variable ex has different types.
The following example, which is valid in Java SE 7 and later, eliminates the duplicated code:
catch (IOException|SQLException ex) {
logger.log(ex);
throw ex;
}
Thank you,
Nathan
try {
foo = new Foo()
}
catch(ex : IOException) {
//handle or throw
}
catch(ex : SQLException) {
//handle or throw
}
catch(ex : Exception) {
//handle or ??
}
finally {
//...
}
--
You received this message because you are subscribed to the Google Groups "gosu-lang" group.
To unsubscribe from this group and stop receiving emails from it, send an email to gosu-lang+...@googlegroups.com.
To post to this group, send email to gosu...@googlegroups.com.
Visit this group at https://groups.google.com/group/gosu-lang.
For more options, visit https://groups.google.com/d/optout.