Java 类org.apache.commons.lang.exception.NestableException 实例源码

项目:astor    文件:NotImplementedExceptionTest.java   
public void testGetThrowable() {
    NotImplementedException ex = new NotImplementedException(new NestableException("nested 1", new NestableException("nested 2")));

    assertEquals(3, ex.getThrowableCount());

    assertEquals(NotImplementedException.class, ex.getThrowable(0).getClass());
    assertEquals("Code is not implemented", ex.getThrowable(0).getMessage());
    assertEquals(NestableException.class, ex.getThrowable(1).getClass());
    assertEquals("nested 1", ex.getThrowable(1).getMessage());
    assertEquals(NestableException.class, ex.getThrowable(2).getClass());
    assertEquals("nested 2", ex.getThrowable(2).getMessage());

    assertEquals(3, ex.getThrowables().length);
    assertEquals(NotImplementedException.class, ex.getThrowables()[0].getClass());
    assertEquals("Code is not implemented", ex.getThrowables()[0].getMessage());
    assertEquals(NestableException.class, ex.getThrowables()[1].getClass());
    assertEquals("nested 1", ex.getThrowables()[1].getMessage());
    assertEquals(NestableException.class, ex.getThrowables()[2].getClass());
    assertEquals("nested 2", ex.getThrowables()[2].getMessage());
}
项目:astor    文件:NotImplementedExceptionTest.java   
public void testGetThrowable() {
    NotImplementedException ex = new NotImplementedException(new NestableException("nested 1", new NestableException("nested 2")));

    assertEquals(3, ex.getThrowableCount());

    assertEquals(NotImplementedException.class, ex.getThrowable(0).getClass());
    assertEquals("Code is not implemented", ex.getThrowable(0).getMessage());
    assertEquals(NestableException.class, ex.getThrowable(1).getClass());
    assertEquals("nested 1", ex.getThrowable(1).getMessage());
    assertEquals(NestableException.class, ex.getThrowable(2).getClass());
    assertEquals("nested 2", ex.getThrowable(2).getMessage());

    assertEquals(3, ex.getThrowables().length);
    assertEquals(NotImplementedException.class, ex.getThrowables()[0].getClass());
    assertEquals("Code is not implemented", ex.getThrowables()[0].getMessage());
    assertEquals(NestableException.class, ex.getThrowables()[1].getClass());
    assertEquals("nested 1", ex.getThrowables()[1].getMessage());
    assertEquals(NestableException.class, ex.getThrowables()[2].getClass());
    assertEquals("nested 2", ex.getThrowables()[2].getMessage());
}
项目:astor    文件:NotImplementedExceptionTest.java   
public void testPrintStackTrace() {
    NotImplementedException ex = new NotImplementedException(new NestableException("nested 1", new NestableException("nested 2")));
    ByteArrayOutputStream baos = new ByteArrayOutputStream();
    PrintStream ps = new PrintStream(baos);
    PrintStream errStream = System.err;
    System.setErr(ps);
    ex.printStackTrace();
    System.setErr(errStream);
    assertTrue(baos.toString().length() > 0);
}
项目:astor    文件:NotImplementedExceptionTest.java   
public void testPrintStackTrace_Stream() {
    NotImplementedException ex = new NotImplementedException(new NestableException("nested 1", new NestableException("nested 2")));
    ByteArrayOutputStream baos = new ByteArrayOutputStream();
    PrintStream ps = new PrintStream(baos);
    ex.printStackTrace(ps);
    assertTrue(baos.toString().length() > 0);
}
项目:astor    文件:NotImplementedExceptionTest.java   
public void testPrintStackTrace_Writer() {
    NotImplementedException ex = new NotImplementedException(new NestableException("nested 1", new NestableException("nested 2")));
    StringWriter stringWriter = new StringWriter();
    PrintWriter writer = new PrintWriter(stringWriter);
    ex.printStackTrace(writer);
    assertTrue(stringWriter.toString().length() > 0);
}
项目:astor    文件:NotImplementedExceptionTest.java   
public void testPrintPartialStackTrace_Writer() {
    NotImplementedException ex = new NotImplementedException(new NestableException("nested 1", new NestableException("nested 2")));
    StringWriter stringWriter = new StringWriter();
    PrintWriter writer = new PrintWriter(stringWriter);
    ex.printPartialStackTrace(writer);
    assertTrue(stringWriter.toString().length() > 0);
}
项目:astor    文件:NotImplementedExceptionTest.java   
public void testPrintStackTrace() {
    NotImplementedException ex = new NotImplementedException(new NestableException("nested 1", new NestableException("nested 2")));
    ByteArrayOutputStream baos = new ByteArrayOutputStream();
    PrintStream ps = new PrintStream(baos);
    PrintStream errStream = System.err;
    System.setErr(ps);
    ex.printStackTrace();
    System.setErr(errStream);
    assertTrue(baos.toString().length() > 0);
}
项目:astor    文件:NotImplementedExceptionTest.java   
public void testPrintStackTrace_Stream() {
    NotImplementedException ex = new NotImplementedException(new NestableException("nested 1", new NestableException("nested 2")));
    ByteArrayOutputStream baos = new ByteArrayOutputStream();
    PrintStream ps = new PrintStream(baos);
    ex.printStackTrace(ps);
    assertTrue(baos.toString().length() > 0);
}
项目:astor    文件:NotImplementedExceptionTest.java   
public void testPrintStackTrace_Writer() {
    NotImplementedException ex = new NotImplementedException(new NestableException("nested 1", new NestableException("nested 2")));
    StringWriter stringWriter = new StringWriter();
    PrintWriter writer = new PrintWriter(stringWriter);
    ex.printStackTrace(writer);
    assertTrue(stringWriter.toString().length() > 0);
}
项目:astor    文件:NotImplementedExceptionTest.java   
public void testPrintPartialStackTrace_Writer() {
    NotImplementedException ex = new NotImplementedException(new NestableException("nested 1", new NestableException("nested 2")));
    StringWriter stringWriter = new StringWriter();
    PrintWriter writer = new PrintWriter(stringWriter);
    ex.printPartialStackTrace(writer);
    assertTrue(stringWriter.toString().length() > 0);
}
项目:erp    文件:ResultSetToExcel.java   
private void writeCell(HSSFRow row, int col, Object value, FormatType formatType) throws NestableException {
  writeCell(row, col, value, formatType, null, null);
}
项目:erp    文件:ResultSetToExcel.java   
private void writeCell(HSSFRow row, int col, Object value, FormatType formatType, HSSFFont font) throws NestableException {
  writeCell(row, col, value, formatType, null, font);
}
项目:erp    文件:ResultSetToExcel.java   
private void writeCell(HSSFRow row, int col, Object value, FormatType formatType,
                       Short bgColor, HSSFFont font) throws NestableException {
  HSSFCell cell = HSSFCellUtil.createCell(row, col, null);
  if (value == null) {
    return;
  }
  if (font != null) {
    HSSFCellStyle style = workbook.createCellStyle();
    style.setFont(font);
    cell.setCellStyle(style);
    //style.set
  }

  switch (formatType) {
    case TEXT:
      cell.setCellValue(value.toString());
      break;
    case INTEGER:
      cell.setCellValue(((Number) value).intValue());
      /*HSSFCellUtil.setCellStyleProperty(cell, workbook, HSSFCellUtil.DATA_FORMAT,
          HSSFDataFormat.getBuiltinFormat(("#,##0")));*/
      break;
    case FLOAT:
      cell.setCellValue(((Number) value).doubleValue());
      /*HSSFCellUtil.setCellStyleProperty(cell, workbook, HSSFCellUtil.DATA_FORMAT,
          HSSFDataFormat.getBuiltinFormat(("#,##0.00")));*/
      break;
    case DATE:
      cell.setCellValue((Date) value);
      /*HSSFCellUtil.setCellStyleProperty(cell, workbook, HSSFCellUtil.DATA_FORMAT,
          HSSFDataFormat.getBuiltinFormat(("m/d/yy")));*/
      break;
    case MONEY:
      cell.setCellValue(((Number) value).intValue());
      /*HSSFCellUtil.setCellStyleProperty(cell, workbook,
          HSSFCellUtil.DATA_FORMAT, format.getFormat("($#,##0.00);($#,##0.00)"));*/
      break;
    case PERCENTAGE:
      cell.setCellValue(((Number) value).doubleValue());
      /*HSSFCellUtil.setCellStyleProperty(cell, workbook,
          HSSFCellUtil.DATA_FORMAT, HSSFDataFormat.getBuiltinFormat("0.00%"));*/
  }
  /*if (bgColor != null) {
    HSSFCellUtil.setCellStyleProperty(cell, workbook, HSSFCellUtil.FILL_FOREGROUND_COLOR, bgColor);
    HSSFCellUtil.setCellStyleProperty(cell, workbook, HSSFCellUtil.FILL_PATTERN, HSSFCellStyle.SOLID_FOREGROUND);
  }*/
}
项目:astor    文件:NotImplementedExceptionTest.java   
public void testIndexOfThrowable() {
    NotImplementedException ex = new NotImplementedException(new NestableException("nested 1", new NestableException("nested 2")));
    assertEquals(0, ex.indexOfThrowable(NotImplementedException.class));
    assertEquals(1, ex.indexOfThrowable(NestableException.class));
}
项目:astor    文件:NotImplementedExceptionTest.java   
public void testIndexOfThrowable_Index() {
    NotImplementedException ex = new NotImplementedException(new NestableException("nested 1", new NestableException("nested 2")));
    assertEquals(1, ex.indexOfThrowable(NestableException.class, 1));
}
项目:astor    文件:NotImplementedExceptionTest.java   
public void testIndexOfThrowable() {
    NotImplementedException ex = new NotImplementedException(new NestableException("nested 1", new NestableException("nested 2")));
    assertEquals(0, ex.indexOfThrowable(NotImplementedException.class));
    assertEquals(1, ex.indexOfThrowable(NestableException.class));
}
项目:astor    文件:NotImplementedExceptionTest.java   
public void testIndexOfThrowable_Index() {
    NotImplementedException ex = new NotImplementedException(new NestableException("nested 1", new NestableException("nested 2")));
    assertEquals(1, ex.indexOfThrowable(NestableException.class, 1));
}
项目:lams    文件:NestableException.java   
/**
 * Constructs a new <code>NestableException</code> without specified
 * detail message.
 */
public NestableException() {
    super();
}
项目:lams    文件:NestableException.java   
/**
 * Constructs a new <code>NestableException</code> with specified
 * detail message.
 *
 * @param msg The error message.
 */
public NestableException(String msg) {
    super(msg);
}
项目:lams    文件:NestableException.java   
/**
 * Constructs a new <code>NestableException</code> with specified
 * nested <code>Throwable</code>.
 *
 * @param cause the exception or error that caused this exception to be
 * thrown
 */
public NestableException(Throwable cause) {
    super();
    this.cause = cause;
}
项目:lams    文件:NestableException.java   
/**
 * Constructs a new <code>NestableException</code> with specified
 * detail message and nested <code>Throwable</code>.
 *
 * @param msg    the error message
 * @param cause  the exception or error that caused this exception to be
 * thrown
 */
public NestableException(String msg, Throwable cause) {
    super(msg);
    this.cause = cause;
}
项目:parabuild-ci    文件:NestableException.java   
/**
 * Constructs a new <code>NestableException</code> without specified
 * detail message.
 */
public NestableException() {
    super();
}
项目:parabuild-ci    文件:NestableException.java   
/**
 * Constructs a new <code>NestableException</code> with specified
 * detail message.
 *
 * @param msg The error message.
 */
public NestableException(String msg) {
    super(msg);
}
项目:parabuild-ci    文件:NestableException.java   
/**
 * Constructs a new <code>NestableException</code> with specified
 * nested <code>Throwable</code>.
 *
 * @param cause the exception or error that caused this exception to be
 * thrown
 */
public NestableException(Throwable cause) {
    super();
    this.cause = cause;
}
项目:parabuild-ci    文件:NestableException.java   
/**
 * Constructs a new <code>NestableException</code> with specified
 * detail message and nested <code>Throwable</code>.
 *
 * @param msg    the error message
 * @param cause  the exception or error that caused this exception to be
 * thrown
 */
public NestableException(String msg, Throwable cause) {
    super(msg);
    this.cause = cause;
}
项目:cacheonix-core    文件:NestableException.java   
/**
 * Constructs a new <code>NestableException</code> without specified
 * detail message.
 */
public NestableException() {
    super();
}
项目:cacheonix-core    文件:NestableException.java   
/**
 * Constructs a new <code>NestableException</code> with specified
 * detail message.
 *
 * @param msg The error message.
 */
public NestableException(String msg) {
    super( msg );
}
项目:cacheonix-core    文件:NestableException.java   
/**
 * Constructs a new <code>NestableException</code> with specified
 * nested <code>Throwable</code>.
 *
 * @param cause the exception or error that caused this exception to be
 *              thrown
 */
public NestableException(Throwable cause) {
    super();
    this.cause = cause;
}
项目:cacheonix-core    文件:NestableException.java   
/**
 * Constructs a new <code>NestableException</code> with specified
 * detail message and nested <code>Throwable</code>.
 *
 * @param msg   the error message
 * @param cause the exception or error that caused this exception to be
 *              thrown
 */
public NestableException(String msg, Throwable cause) {
    super( msg );
    this.cause = cause;
}
项目:astor    文件:NestableException.java   
/**
 * Constructs a new <code>NestableException</code> without specified
 * detail message.
 */
public NestableException() {
    super();
}
项目:astor    文件:NestableException.java   
/**
 * Constructs a new <code>NestableException</code> with specified
 * detail message.
 *
 * @param msg The error message.
 */
public NestableException(String msg) {
    super(msg);
}
项目:astor    文件:NestableException.java   
/**
 * Constructs a new <code>NestableException</code> with specified
 * nested <code>Throwable</code>.
 *
 * @param cause the exception or error that caused this exception to be
 * thrown
 */
public NestableException(Throwable cause) {
    super();
    this.cause = cause;
}
项目:astor    文件:NestableException.java   
/**
 * Constructs a new <code>NestableException</code> with specified
 * detail message and nested <code>Throwable</code>.
 *
 * @param msg    the error message
 * @param cause  the exception or error that caused this exception to be
 * thrown
 */
public NestableException(String msg, Throwable cause) {
    super(msg);
    this.cause = cause;
}
项目:astor    文件:NestableException.java   
/**
 * Constructs a new <code>NestableException</code> without specified
 * detail message.
 */
public NestableException() {
    super();
}
项目:astor    文件:NestableException.java   
/**
 * Constructs a new <code>NestableException</code> with specified
 * detail message.
 *
 * @param msg The error message.
 */
public NestableException(String msg) {
    super(msg);
}
项目:astor    文件:NestableException.java   
/**
 * Constructs a new <code>NestableException</code> with specified
 * nested <code>Throwable</code>.
 *
 * @param cause the exception or error that caused this exception to be
 * thrown
 */
public NestableException(Throwable cause) {
    super();
    this.cause = cause;
}
项目:astor    文件:NestableException.java   
/**
 * Constructs a new <code>NestableException</code> with specified
 * detail message and nested <code>Throwable</code>.
 *
 * @param msg    the error message
 * @param cause  the exception or error that caused this exception to be
 * thrown
 */
public NestableException(String msg, Throwable cause) {
    super(msg);
    this.cause = cause;
}