`
ivywjhua
  • 浏览: 21579 次
  • 性别: Icon_minigender_1
  • 来自: 上海
社区版块
存档分类
最新评论

奇怪的 throws exception

阅读更多
org.springframework.mail.MailSender
void send(SimpleMailMessage simpleMessage) throws MailException;



private static JavaMailSender mailSender = null;
 mailSender = (JavaMailSender) xxx;

public static void sendMail(SimpleMailMessage msg)
    {
        mailSender.send(msg);
    }


为什么sendMail不需要catch exception  或者 throw出去?

分享到:
评论
1 楼 zhxing 2009-10-15  
public abstract class MailException extends NestedRuntimeException {

不懂的看源码能解决很多问题,这个是运行期异常,可以不用try catch

相关推荐

    jsp的多个文件上传下载

    * @throws Exception 运行异常 */ public boolean upLoad(HttpServletRequest request) throws Exception; /** * 释放系统资源. * @return 析构情况 * @throws Exception 运行异常. */ public boolean ...

    import java.io.*; public class FirstPart{ public static void main(String[] args) throws Exception{ System.out.print("The input Fahrenheit is "); BufferedReader br = new BufferedReader(new InputStreamReader(System.in)); int f = Integer.parseInt(br.re

    public static void main(String[] args) throws Exception{ System.out.print("The input Fahrenheit is "); BufferedReader br = new BufferedReader(new InputStreamReader(System.in)); int f = Integer....

    struts demo

    public String execute() throws Exception { service.find2(); return SUCCESS; }

    java ZIP 解压缩

    public static byte[] compress(byte[] data) throws Exception { ByteArrayInputStream bais = new ByteArrayInputStream(data); ByteArrayOutputStream baos = new ByteArrayOutputStream(); // 压缩 ...

    移动代理服务器MAS开发包和开发手册

    public final void initConn() throws Exception 初始化和EIE系统的连接。 public final void initConn(String confFile) throws Exception 初始化和EIE系统的连接。 public final void initConn(Map args) throws ...

    java xml解析

    public static Element getChildElement( Element parentElement, String childName, String attributeName, String attributeValue ) throws Exception { /** * 得到某节点下的某个子节点(通过指定子节点...

    mysql+java课程设计学生管理系统

    public boolean existBookByBookTypeId(Connection con,String bookTypeId)throws Exception{ String sql="select * from t_book where bookTypeId=?"; PreparedStatement pstmt=con.prepareStatement(sql); ...

    android客户端从服务器端获取json数据并解析的实现代码

    代码如下:/** * 从指定的URL中获取数组 * @param urlPath * @return * @throws Exception */ public static String readParse(String urlPath) throws Exception { ByteArrayOutputStream outStream = new ...

    eSaleSys源码,可直接运行

    public String saveOrder() throws Exception{ try { item.setOdrId(System.currentTimeMillis()); Long result=saleOrderServiceImpl.save(item); System.out.println(result); session.put("item", item); ...

    spring 高性能 代码

    public void testObject() throws Exception{ Finder finder=new Finder("select id from [Users] where 1=1 "); finder.append("and userId=:userId").setParam("userId", 6); Integer id = baseFangService....

    ActiveMQ-demo

    public static void main(String[] args) throws Exception { //加载spring配置 ApplicationContext ac = new ClassPathXmlApplicationContext("spring/applicationContext-jms-producer.xml"); //获取生产...

    JAVA教程 第四讲 Java的例外处理和IO流

    JAVA教程 第四讲 Java的例外处理和IO流

    java throws声明异常实例一

    java throws声明异常实例一 java throws声明异常实例一

    androidRSA加密

    public static byte[] decryptBASE64(String key) throws Exception { return (new BASE64Decoder()).decodeBuffer(key); } public static String encryptBASE64(byte[] key) throws Exception { return ...

    异常处理throws关键字

    hrows关键字通常被应用在声明方法时,用来指定可能抛出的异常,throws 用于抛出方法层次的异常,并且直接由些方法调用异常处理类来处理该异常

    获取IP地址和MAC地址

    public String getIpAddr(HttpServletRequest request) throws Exception { String ip = request.getHeader("x-forwarded-for"); if (ip == null || ip.length() == 0 || "unknown".equalsIgnoreCase(ip)) { ...

    高仿JPA自定义通用DAO

    int insert(T obj) throws Exception; int update(T obj) throws Exception; int deleteByPrimaryKey(Object key) throws Exception; int selectCount() throws SQLException; List<T> selectPage(Integer ...

    struts高级日记

    public void setUp() throws Exception { super.setUp(); setContextDirectory(new File("E:\\webapp\\webContext")); } protected void tearDown() throws Exception { super.tearDown(); } public ...

    Java异常处理与throws关键字用法分析

    主要介绍了Java异常处理与throws关键字用法,结合实例形式分析了java常见的异常、错误处理及throws关键字相关使用技巧、注意事项,需要的朋友可以参考下

    中小公司人事管理系统

    public static Session getsession()throws Exception{ s=sessionThread.get(); try{ if(s==null){//如果当前的session线程中没有session对象的情况就sf打开一个session s=sf.openSession(); ...

Global site tag (gtag.js) - Google Analytics