Changeset 895

Show
Ignore:
Timestamp:
10/07/06 21:56:19 (2 years ago)
Author:
alban
Message:

fix ConfigurationLoaderTest? with commons-configuration 1.3

Files:

Legend:

Unmodified
Added
Removed
Modified
Copied
Moved
  • trunk/source/org/kolaka/freecast/NodeConfigurator.java

    r883 r895  
    114114                DefaultNodeService nodeService = new DefaultNodeService(trackerAddress); 
    115115     
    116     try
     116    if (peerProviderConfiguration.containsKey("networkid"))
    117117      nodeService.setNetworkId(NetworkIdentifier.getInstance(peerProviderConfiguration.getString("networkid"))); 
    118     } catch (NoSuchElementException e)
    119       LogFactory.getLog(getClass()).trace("no network identifier in configuration", e); 
     118    } else
     119      LogFactory.getLog(getClass()).debug("no network identifier in configuration"); 
    120120    } 
    121121     
  • trunk/source/org/kolaka/freecast/config/test/ConfigurationLoaderTest.java

    r405 r895  
    2424package org.kolaka.freecast.config.test; 
    2525 
    26 import java.util.NoSuchElementException; 
    27  
    2826import junit.framework.TestCase; 
    2927 
     
    4240                                .getRootConfiguration().subset("tracker"); 
    4341 
    44                 try { 
    45                         configuration.getString("dummy"); 
    46                         fail("should throw a NoSuchElementException"); 
    47                 } catch (NoSuchElementException e) { 
    48  
    49                 } 
     42                assertNull(configuration.getString("dummy")); 
    5043 
    5144                assertEquals("http", configuration.getString("connector.class")); 
  • trunk/source/org/kolaka/freecast/swing/ConfigurableResources.java

    r405 r895  
    7878 
    7979        private String getString(String name) throws ResourcesException { 
    80                 try { 
    81                         return configuration.getString(name); 
    82                 } catch (NoSuchElementException e) { 
    83                         throw new ResourcesException( 
    84                                         "Can't find the configuration value for '" + name + "'", e); 
    85                 } 
     80    String string = configuration.getString(name); 
     81    if (string == null) { 
     82      throw new ResourcesException( 
     83          "Can't find the configuration value for '" + name + "'"); 
     84    } 
     85    return string; 
    8686        } 
    8787 
     
    123123 
    124124        public Color getColor(String name) throws ResourcesException { 
    125                 try { 
    126                         return configuration.getColor(name); 
    127                 } catch (NoSuchElementException e) { 
    128                         throw new ResourcesException("Can't find the color " + name, e); 
    129                 } 
     125                Color color = configuration.getColor(name); 
     126    if (color == null) { 
     127      throw new ResourcesException("Can't find the color " + name); 
     128    } 
     129    return color; 
    130130        } 
    131131