views:

85

answers:

1

Hello,

I'm trying to change values in my application.properties file and I'm running into issues with an extra "\" character when trying to substitute url addresses. It doesn't happen when I'm replacing regular text.

Here's the section of the properties file I'm attempting to modify:

# Web Info
web.url=http://www.testaddress.com
web.user=TestAccount

Here's the section of my script that's not working correctly:

<propertyfile file="application.properties">
  <entry key="web.url" operation="=" value="${webaddress}" />
  <entry key="web.user" operation="=" value="${username}" />
</propertyfile>

What happens is that the web.user is replaced just fine but the address comes out looking like so:

# Web Info
web.url=http\://www.realaddress.com
web.user=RealAccount

I can't account for the backslash, if I echo the ${webaddress} variable it doesn't have it. Any idea as to what may be going on?

Thanks.

+1  A: 

Check out the "store" method of the Properties object. The javadoc specifically states:

The key and element characters #, !, =, and : are written with a preceding backslash to ensure that they are properly loaded.

digitaljoel