org.jdom.DataConversionException Java Examples

The following examples show how to use org.jdom.DataConversionException. You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: RGTConfigService.java    From redis-game-transaction with Apache License 2.0 5 votes vote down vote up
public JedisPoolConfig initRediPoolConfig() throws DataConversionException {
    Element element = JdomUtils.getRootElemet(FileUtil.getConfigURL(GlobalConstants.RedisConfigFile.REDIS_POOL_CONIFG).getFile());
    JedisPoolConfig jedisPoolConfig = new JedisPoolConfig();
    int maxIdle = element.getAttribute("maxIdle").getIntValue();
    boolean testWhileIdle = element.getAttribute("testWhileIdle").getBooleanValue();
    int timeBetweenEvictionRunsMillis = element.getAttribute("timeBetweenEvictionRunsMillis").getIntValue();
    int numTestsPerEvictionRun = element.getAttribute("numTestsPerEvictionRun").getIntValue();
    int minEvictableIdleTimeMillis = element.getAttribute("minEvictableIdleTimeMillis").getIntValue();
    jedisPoolConfig.setTestWhileIdle(testWhileIdle);
    jedisPoolConfig.setMaxIdle(maxIdle);
    jedisPoolConfig.setTimeBetweenEvictionRunsMillis(timeBetweenEvictionRunsMillis);
    jedisPoolConfig.setNumTestsPerEvictionRun(numTestsPerEvictionRun);
    jedisPoolConfig.setMinEvictableIdleTimeMillis(minEvictableIdleTimeMillis);
    return jedisPoolConfig;
}
 
Example #2
Source File: RedisServiceTest.java    From redis-game-transaction with Apache License 2.0 5 votes vote down vote up
public static void main(String[] args) throws DataConversionException {
    RGTConfigService RGTConfigService = new RGTConfigService();
    RGTRedisService RGTRedisService = new RGTRedisService();
    RGTRedisService.setJedisPool(RGTConfigService.initRedis(RGTConfigService.initRediPoolConfig()));

    String testKey = "ketest100";
    RGTRedisService.setString(testKey, "100");
    String number = RGTRedisService.getString(testKey);
    System.out.println(number);
}
 
Example #3
Source File: SlackProjectSettings.java    From TCSlackNotifierPlugin with MIT License 5 votes vote down vote up
public void readFrom(Element element) {
    Element channelElement = element.getChild(ELEMENT_CHANNEL);
    Element logoElement = element.getChild(ELEMENT_LOGO_URL);
    Attribute enabledAttr = element.getAttribute(ATTR_ENABLED);

    if( enabledAttr != null )
    {
        try {
            enabled = enabledAttr.getBooleanValue() ;
        } catch (DataConversionException e) {
            enabled = true ;
        }
    }
    else
    {
        enabled = true ;
    }

    if( channelElement != null ) {
        this.channel = channelElement.getText();
    }

    if( logoElement != null )
    {
        this.logoUrl = logoElement.getText();
    }
}
 
Example #4
Source File: ProjectLevelVcsManagerImpl.java    From consulo with Apache License 2.0 5 votes vote down vote up
@Override
public void loadState(Element state) {
  mySerialization.readExternalUtil(state, myOptionsAndConfirmations);
  final Attribute attribute = state.getAttribute(SETTINGS_EDITED_MANUALLY);
  if (attribute != null) {
    try {
      myHaveLegacyVcsConfiguration = attribute.getBooleanValue();
    }
    catch (DataConversionException ignored) {
    }
  }
}