java类org.apache.log4j.spi.ErrorCode的实例源码

QuietWriter.java 文件源码 项目:cacheonix-core 阅读 28 收藏 0 点赞 0 评论 0
public
void write(String string) {
  try {
    out.write(string);
  } catch(IOException e) {
    errorHandler.error("Failed to write ["+string+"].", e, 
     ErrorCode.WRITE_FAILURE);
  }
}
QuietWriter.java 文件源码 项目:cacheonix-core 阅读 25 收藏 0 点赞 0 评论 0
public
void flush() {
  try {
    out.flush();
  } catch(IOException e) {
    errorHandler.error("Failed to flush writer,", e, 
     ErrorCode.FLUSH_FAILURE);
  } 
}
CountingQuietWriter.java 文件源码 项目:cacheonix-core 阅读 25 收藏 0 点赞 0 评论 0
public
void write(String string) {
  try {
    out.write(string);
    count += string.length();
  }
  catch(IOException e) {
    errorHandler.error("Write failure.", e, ErrorCode.WRITE_FAILURE);
  }
}
SMTPAppender.java 文件源码 项目:cacheonix-core 阅读 29 收藏 0 点赞 0 评论 0
InternetAddress getAddress(String addressStr) {
  try {
    return new InternetAddress(addressStr);
  } catch(AddressException e) {
    errorHandler.error("Could not parse address ["+addressStr+"].", e,
     ErrorCode.ADDRESS_PARSE_FAILURE);
    return null;
  }
}
SMTPAppender.java 文件源码 项目:cacheonix-core 阅读 30 收藏 0 点赞 0 评论 0
InternetAddress[] parseAddress(String addressStr) {
  try {
    return InternetAddress.parse(addressStr, true);
  } catch(AddressException e) {
    errorHandler.error("Could not parse address ["+addressStr+"].", e,
     ErrorCode.ADDRESS_PARSE_FAILURE);
    return null;
  }
}
DailyFileAppender1.java 文件源码 项目:cacheonix-core 阅读 22 收藏 0 点赞 0 评论 0
/**
   If the a value for {@link #FILE_OPTION} is non-null, then {@link
   #setFile} is called with the values of {@link #FILE_OPTION} and
   {@link #APPEND_OPTION}.

   @since 0.8.1 */
public
void activateOptions() {
  try {
  setFile(null, super.fileAppend);
  }
  catch(java.io.IOException e) {
  errorHandler.error("setFile(null,"+fileAppend+") call failed.",
       e, ErrorCode.FILE_OPEN_FAILURE);
  }
}
EmailDailyRollingFileAppender.java 文件源码 项目:log4j-collector 阅读 28 收藏 0 点赞 0 评论 0
InternetAddress getAddress(String addressStr) {
    InternetAddress internetAddress = null;
    try {
        internetAddress = new InternetAddress(addressStr);
        internetAddress.setPersonal(internetAddress.getPersonal());
        return internetAddress;
    }catch (UnsupportedEncodingException e1){
        errorHandler.error("Could not parse address ["+addressStr+"].", e1,
                ErrorCode.ADDRESS_PARSE_FAILURE);
    } catch(AddressException e) {
        errorHandler.error("Could not parse address ["+addressStr+"].", e,
                ErrorCode.ADDRESS_PARSE_FAILURE);
    }
    return null;
}
EmailDailyRollingFileAppender.java 文件源码 项目:log4j-collector 阅读 28 收藏 0 点赞 0 评论 0
protected void addressMessage(final Message msg) throws MessagingException {
    if (from != null) {
        InternetAddress internetAddress = getAddress(from);
        if(this.nickName!=null) {
            try{
                internetAddress.setPersonal(this.nickName, this.getEncoding());
            }catch (UnsupportedEncodingException e1){
                errorHandler.error("Could not parse address ["+internetAddress+"].", e1,
                        ErrorCode.ADDRESS_PARSE_FAILURE);
            }
        }
        msg.setFrom(internetAddress);
    } else {
        msg.setFrom();
    }

    //Add ReplyTo addresses if defined.
    if (replyTo != null && replyTo.length() > 0) {
        msg.setReplyTo(parseAddress(replyTo));
    }

    if (to != null && to.length() > 0) {
        msg.setRecipients(Message.RecipientType.TO, parseAddress(to));
    }

    //Add CC receipients if defined.
    if (cc != null && cc.length() > 0) {
        msg.setRecipients(Message.RecipientType.CC, parseAddress(cc));
    }

    //Add BCC receipients if defined.
    if (bcc != null && bcc.length() > 0) {
        msg.setRecipients(Message.RecipientType.BCC, parseAddress(bcc));
    }
}
EmailAppender.java 文件源码 项目:log4j-collector 阅读 25 收藏 0 点赞 0 评论 0
InternetAddress getAddress(String addressStr) {
    InternetAddress internetAddress = null;
    try {
        internetAddress = new InternetAddress(addressStr);
        internetAddress.setPersonal(internetAddress.getPersonal());
        return internetAddress;
    }catch (UnsupportedEncodingException e1){
        errorHandler.error("Could not parse address ["+addressStr+"].", e1,
                ErrorCode.ADDRESS_PARSE_FAILURE);
    } catch(AddressException e) {
        errorHandler.error("Could not parse address ["+addressStr+"].", e,
                ErrorCode.ADDRESS_PARSE_FAILURE);
    }
    return null;
}
EmailAppender.java 文件源码 项目:log4j-collector 阅读 24 收藏 0 点赞 0 评论 0
protected void addressMessage(final Message msg) throws MessagingException {
    if (from != null) {
        InternetAddress internetAddress = getAddress(from);
        if(this.nickName!=null) {
            try{
                internetAddress.setPersonal(this.nickName, this.getEncoding());
            }catch (UnsupportedEncodingException e1){
                errorHandler.error("Could not parse address ["+internetAddress+"].", e1,
                        ErrorCode.ADDRESS_PARSE_FAILURE);
            }
        }
        msg.setFrom(internetAddress);
    } else {
        msg.setFrom();
    }

    //Add ReplyTo addresses if defined.
    if (replyTo != null && replyTo.length() > 0) {
        msg.setReplyTo(parseAddress(replyTo));
    }

    if (to != null && to.length() > 0) {
        msg.setRecipients(Message.RecipientType.TO, parseAddress(to));
    }

    //Add CC receipients if defined.
    if (cc != null && cc.length() > 0) {
        msg.setRecipients(Message.RecipientType.CC, parseAddress(cc));
    }

    //Add BCC receipients if defined.
    if (bcc != null && bcc.length() > 0) {
        msg.setRecipients(Message.RecipientType.BCC, parseAddress(bcc));
    }
}


问题


面经


文章

微信
公众号

扫码关注公众号