java异常处理时抛出异常冲突问题

在使用apache.common.net时自定义了一个异常,想在初始化方法时扑捉到异常后都抛出该异常,但是遇到了问题,代码如雪啊

    private boolean intconnect(String host, int port) throws TelnetException {
    tc = new TelnetClient();

    TerminalTypeOptionHandler ttopt = new TerminalTypeOptionHandler(
            "VT100", false, false, true, false);
    EchoOptionHandler echoopt = new EchoOptionHandler(true, false, true,
            false);
    SuppressGAOptionHandler gaopt = new SuppressGAOptionHandler(true, true,
            true, true);

    try {
        tc.addOptionHandler(ttopt);
        tc.addOptionHandler(echoopt);
        tc.addOptionHandler(gaopt);

        tc.connect(host, port);
        in = tc.getInputStream();
        out = new PrintStream(tc.getOutputStream());
        return true;
    } catch (InvalidTelnetOptionException e) {
        System.err.println("Error registering option handlers: "
                + e.getMessage());
01      //throw new TelnetException("Error registering option handlers");
    } catch (IOException e) {
        e.printStackTrace();
02      throw new TelnetException("Error registering option handlers");
    }
03  return false;
}

01、02、03行不能同时存在,必须注释掉一行,不然就有编译错误,请高手指点谜经

是不是捕获异常,只有这两种异常,你try中包含了return 了,
如果只有这两种异常,那么肯定不会执行到最后的return 这样编译也就无法通过

第一个异常是你自定义的吧!如果是的话,在1那里被捕捉到了,就不应该在2那里抛出。我觉得1那里可以不注释掉,2那里抛出IOException e。这样应该可以了。