Package com.xiaoleilu.hutool.exceptions

Examples of com.xiaoleilu.hutool.exceptions.UtilException


   */
  public static void execute(Runnable runnable) {
    try {
      executor.execute(runnable);
    } catch (Exception e) {
      throw new UtilException("Exception when running task!", e);
    }
  }
View Full Code Here


   */
  public static DateTime parse(String dateStr, SimpleDateFormat simpleDateFormat) {
    try {
      return new DateTime(simpleDateFormat.parse(dateStr));
    } catch (Exception e) {
      throw new UtilException(StrUtil.format("Parse [{}] with format [{}] error!", dateStr, simpleDateFormat.toPattern()), e);
    }
  }
View Full Code Here

        return parse(dateStr, NORM_DATETIME_MINUTE_PATTERN);
      }else if(length == NORM_DATETIME_MS_PATTERN.length()){
        return parse(dateStr, NORM_DATETIME_MS_PATTERN);
      }
    }catch(Exception e) {
      throw new UtilException(StrUtil.format("Parse [{}] with format normal error!", dateStr));
    }
   
    //没有更多匹配的时间格式
    throw new UtilException(StrUtil.format(" [{}] format is not fit for date pattern!", dateStr));
  }
View Full Code Here

  public static <T> T get(String className) {
    Class<?> clazz = null;
    try {
      clazz = Class.forName(className);
    } catch (ClassNotFoundException e) {
      throw new UtilException(e);
    }
   
    return get(clazz);
  }
View Full Code Here

    String encodeContent = null;
    try {
      encodeContent = URLEncoder.encode(content, charset);
    } catch (UnsupportedEncodingException e) {
      throw new UtilException(StrUtil.format("Unsupported encoding: [{}]", charset), e);
    }
    return encodeContent;
  }
View Full Code Here

    if (StrUtil.isBlank(content)) return content;
    String encodeContnt = null;
    try {
      encodeContnt = URLDecoder.decode(content, charset);
    } catch (UnsupportedEncodingException e) {
      throw new UtilException(StrUtil.format("Unsupported encoding: [{}]", charset), e);
    }
    return encodeContnt;
  }
View Full Code Here

      }
     
      try {
        method.invoke(model, ClassUtil.parse(types[0], value));
      } catch (Exception e) {
        throw new UtilException(StrUtil.format("Inject [{}] error!", paramName), e);
      }
    }
  }
View Full Code Here

      }
     
      try {
        method.invoke(model, ClassUtil.parse(types[0], value));
      } catch (Exception e) {
        throw new UtilException(StrUtil.format("Inject [{}] error!", fieldName), e);
      }
    }
  }
View Full Code Here

     
      Object value = null;
      try {
        value = method.invoke(model);
      } catch (Exception e) {
        throw new UtilException(StrUtil.format("Inject map [{}] error!", fieldName), e);
      }
      if(value != null) {
        if(value instanceof String || value.getClass().isPrimitive() || false == isOnlyBasicType) {
          //字段有效的三个条件:1、String 2、基本类型 3、或者允许非基本类型
          map.put(fieldName, value);
View Full Code Here

   * @param mongoSetting MongoDB的配置文件,必须有
   * @param groups 分组列表,当为null或空时使用无分组配置,一个分组使用单一模式,否则使用副本集模式
   */
  public MongoDS(Setting mongoSetting, String... groups) {
    if(mongoSetting == null) {
      throw new UtilException("Mongo setting is null!");
    }
    this.setting = mongoSetting;
    this.groups = groups;
    init();
  }
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.