Index: kernel-impl/src/test/java/org/sakaiproject/component/impl/BasicConfigurationServiceTest.java =================================================================== --- kernel-impl/src/test/java/org/sakaiproject/component/impl/BasicConfigurationServiceTest.java (revision 121412) +++ kernel-impl/src/test/java/org/sakaiproject/component/impl/BasicConfigurationServiceTest.java (working copy) @@ -100,15 +100,21 @@ assertEquals("Aaron Zeckoski", basicConfigurationService.getConfig("test7", "default") ); } - public void disabled_testKNL1038() throws Exception { - // KNL-1038 - "${sakai.home}/samigo/answerUploadRepositoryPath" + public void testKNL1038() throws Exception { + /* KNL-1038 - "${sakai.home}/samigo/answerUploadRepositoryPath" + * This is basically testing whether replacements work in default values + * (as they should) + */ String val = null; val = basicConfigurationService.getString("name"); - assertNotNull(val); + assertNotSame("", val); assertEquals("Aaron", val); + // namePlusLast should NOT exist + val = basicConfigurationService.getString("namePlusLast"); + assertEquals("", val); val = basicConfigurationService.getString("namePlusLast", "${name} Zeckoski"); - assertNotNull(val); + assertNotSame("", val); assertEquals("Aaron Zeckoski", val); } Index: kernel-impl/src/main/java/org/sakaiproject/component/impl/BasicConfigurationService.java =================================================================== --- kernel-impl/src/main/java/org/sakaiproject/component/impl/BasicConfigurationService.java (revision 121411) +++ kernel-impl/src/main/java/org/sakaiproject/component/impl/BasicConfigurationService.java (working copy) @@ -498,8 +498,6 @@ if (ci != null) { if (ci.getValue() != null) { value = StringUtils.trimToNull(ci.getValue().toString()); - // check if we need to do any variable replacement - value = dereferenceValue(value); } else { // if the default value is set then we will return that instead if (ci.getDefaultValue() != null) { @@ -509,6 +507,10 @@ } } } + if (StringUtils.isNotEmpty(value)) { + // check if we need to do any variable replacement + value = dereferenceValue(value); + } return value; }