Package com.xiaoleilu.hutool.exceptions

Examples of com.xiaoleilu.hutool.exceptions.UtilException


    }
    final Double[] doubles = new Double[values.length];
    for(int i = 0; i < values.length; i++) {
      final Double v = toDouble(values[i], null);
      if(null == v && isIgnoreConvertError == false) {
        throw new UtilException(StrUtil.format("Convert [{}] to Double error!", values[i]));
      }
      doubles[i] = v;
    }
    return doubles;
  }
View Full Code Here


    }
    final Float[] floats = new Float[values.length];
    for(int i = 0; i < values.length; i++) {
      final Float v = toFloat(values[i], null);
      if(null == v && isIgnoreConvertError == false) {
        throw new UtilException(StrUtil.format("Convert [{}] to Float error!", values[i]));
      }
      floats[i] = v;
    }
    return floats;
  }
View Full Code Here

    }
    final Boolean[] bools = new Boolean[values.length];
    for(int i = 0; i < values.length; i++) {
      final Boolean v = toBool(values[i], null);
      if(null == v && isIgnoreConvertError == false) {
        throw new UtilException(StrUtil.format("Convert [{}] to Boolean error!", values[i]));
      }
      bools[i] = v;
    }
    return bools;
  }
View Full Code Here

 
  public Column(String tableName, ResultSet columnMetaRs) {
    try {
      init(tableName, columnMetaRs);
    } catch (SQLException e) {
      throw new UtilException(StrUtil.format("Get table [{}] meta info error!", tableName));
    }
  }
View Full Code Here

    PrintWriter writer = null;
    try {
      writer = FileUtil.getPrintWriter(destPath, Velocity.getProperty(Velocity.OUTPUT_ENCODING).toString(), false);
      template.merge(context, writer);
    } catch (IOException e) {
      throw new UtilException(StrUtil.format("Write Velocity content to [{}] error!", destPath), e);
    }finally {
      FileUtil.close(writer);
    }
  }
View Full Code Here

  public static String merge(String templateContent, VelocityContext context) {
    final StringWriter writer = new StringWriter();
    try {
      Velocity.evaluate(context, writer, RandomUtil.randomUUID(), templateContent);
    } catch (Exception e) {
      throw new UtilException(e);
    }
    return writer.toString();
  }
View Full Code Here

    Writer writer = null;
    try {
      response.getWriter();
      toWriter(templateFileName, context, writer);
    } catch (Exception e) {
      throw new UtilException(StrUtil.format("Write Velocity content template by [{}] to response error!", templateFileName), e);
    }finally {
      FileUtil.close(writer);
    }
  }
View Full Code Here

        str[k++] = hexDigits[byte0 >>> 4 & 0xf]; // 取字节中高 4 位的数字转换, >>> 为逻辑右移,将符号位一起右移
        str[k++] = hexDigits[byte0 & 0xf]; // 取字节中低 4 位的数字转换
      }
      s = new String(str); // 换后的结果转换为字符串
    } catch (Exception e) {
      throw new UtilException("Get MD5 error!", e);
    }
    return s;
  }
View Full Code Here

    }
   
    try {
      return md5(source.getBytes(charset));
    } catch (UnsupportedEncodingException e) {
      throw new UtilException("Unsupported encoding: " + charset, e);
    }
  }
View Full Code Here

      return source;
    }
    try {
      return new String(source.getBytes(srcCharset), newCharset);
    } catch (UnsupportedEncodingException unex) {
      throw new UtilException(unex);
    }
  }
View Full Code Here

TOP

Related Classes of com.xiaoleilu.hutool.exceptions.UtilException

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.