Changeset 895
- Timestamp:
- 10/07/06 21:56:19 (2 years ago)
- Files:
Legend:
- Unmodified
- Added
- Removed
- Modified
- Copied
- Moved
trunk/source/org/kolaka/freecast/NodeConfigurator.java
r883 r895 114 114 DefaultNodeService nodeService = new DefaultNodeService(trackerAddress); 115 115 116 try{116 if (peerProviderConfiguration.containsKey("networkid")) { 117 117 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"); 120 120 } 121 121 trunk/source/org/kolaka/freecast/config/test/ConfigurationLoaderTest.java
r405 r895 24 24 package org.kolaka.freecast.config.test; 25 25 26 import java.util.NoSuchElementException;27 28 26 import junit.framework.TestCase; 29 27 … … 42 40 .getRootConfiguration().subset("tracker"); 43 41 44 try { 45 configuration.getString("dummy"); 46 fail("should throw a NoSuchElementException"); 47 } catch (NoSuchElementException e) { 48 49 } 42 assertNull(configuration.getString("dummy")); 50 43 51 44 assertEquals("http", configuration.getString("connector.class")); trunk/source/org/kolaka/freecast/swing/ConfigurableResources.java
r405 r895 78 78 79 79 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; 86 86 } 87 87 … … 123 123 124 124 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; 130 130 } 131 131
