Skip to content

Commit

Permalink
bootloader: remove trailing white spaces when parsing layout file.
Browse files Browse the repository at this point in the history
Ticket: #7100
Acked-by: Tatjana Baranova
Patch: https://rb.dcache.org/r/4403/
  • Loading branch information
kofemann committed May 7, 2012
1 parent ed01d63 commit 538bc1a
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -260,7 +260,7 @@ public synchronized Object put(Object rawKey, Object value)
store(key);
}

return key.hasAnyOf(OBSOLETE_FORBIDDEN) ? null : super.put(name, value);
return key.hasAnyOf(OBSOLETE_FORBIDDEN) ? null : super.put(name, ((String)value).trim());
}


Expand Down
17 changes: 17 additions & 0 deletions modules/dcache/src/test/java/org/dcache/boot/LayoutTests.java
Original file line number Diff line number Diff line change
Expand Up @@ -56,6 +56,23 @@ public void testLoadSingleDomainWithProperty() throws IOException {
assertDomainHasProperty( domain, propertyName, propertyValue);
}

@Test
public void testLoadSingleDomainWithWhiteSpaceProperty() throws IOException {
String domainName = "domainName";
String propertyName = "foo";
String propertyValue = "bar ";

_readerSource.appendDomain(domainName);
_readerSource.addProperty(propertyName, propertyValue);

load();

Domain domain = _layout.getDomain(domainName);
assertNotNull(domain);
assertDomainHasProperty(domain, PROPERTY_DOMAIN_NAME_KEY, domainName);
assertDomainHasProperty(domain, propertyName, propertyValue.trim());
}

@Test
public void testLoadSingleDomainWithGlobalProperty() throws IOException {
String domainName = "domainName";
Expand Down

0 comments on commit 538bc1a

Please sign in to comment.