Package com.xiaoleilu.hutool.exceptions

Examples of com.xiaoleilu.hutool.exceptions.UtilException


      serverAddress = createServerAddress(group);
    }
    try {
      mongo = new MongoClient(serverAddress, buildMongoClientOptions(group));
    } catch (Exception e) {
      throw new UtilException(StrUtil.format("Init MongoDB pool with connection to [{}] error!", serverAddress), e);
    }
   
    log.info("Init MongoDB pool with connection to [{}]", serverAddress);
  }
View Full Code Here


   * [db2]
   * host = 10.11.49.157:27119
   */
  synchronized public void initCloud() {
    if(groups == null || groups.length == 0) {
      throw new UtilException("Please give replication set groups!");
    }
   
    if(setting == null) {
      //若未指定配置文件,则使用默认配置文件
      setting = new Setting(MONGO_CONFIG_PATH, Setting.DEFAULT_CHARSET, true);
View Full Code Here

   * @param group 分组,如果为null默认为无分组
   * @return ServerAddress
   */
  private ServerAddress createServerAddress(String group) {
    if(setting == null) {
      throw new UtilException(StrUtil.format("Please indicate setting file or create default [{}], and define group [{}]", MONGO_CONFIG_PATH, group));
    }
   
    if(group == null) {
      group = StrUtil.EMPTY;
    }
View Full Code Here

   */
  private ServerAddress createServerAddress(String host, int port) {
    try {
      return new ServerAddress(host, port);
    } catch (UnknownHostException e) {
      throw new UtilException(StrUtil.format("Unknow Host: [{}]", host), e);
    }
  }
View Full Code Here

        if(StrUtil.isBlank(table) == false) {
          tables.add(table);
        }
      }
    } catch (Exception e) {
      throw new UtilException("Get tables error!", e);
    }finally {
      close(rs, conn);
    }
    return tables;
  }
View Full Code Here

      for (int i=0; i<labelNames.length; i++) {
        labelNames[i] = rsmd.getColumnLabel(i +1);
      }
      return labelNames;
    } catch (Exception e) {
      throw new UtilException("Get colunms error!", e);
    }
  }
View Full Code Here

      while(rs.next()) {
        columnNames.add(rs.getString("COLUMN_NAME"));
      }
      return columnNames.toArray(new String[columnNames.size()]);
    } catch (Exception e) {
      throw new UtilException("Get columns error!", e);
    }finally {
      close(rs, conn);
    }
  }
View Full Code Here

      rs = metaData.getColumns(conn.getCatalog(), null, tableName, null);
      while(rs.next()) {
        table.setColumn(Column.create(tableName, rs));
      }
    } catch (Exception e) {
      throw new UtilException("Get columns error!", e);
    }finally {
      close(rs, conn);
    }
   
    return table;
View Full Code Here

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

    }
    final Long[] longs = new Long[values.length];
    for(int i = 0; i < values.length; i++) {
      final Long v = toLong(values[i], null);
      if(null == v && isIgnoreConvertError == false) {
        throw new UtilException(StrUtil.format("Convert [{}] to Long error!", values[i]));
      }
      longs[i] = v;
    }
    return longs;
  }
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.