simonetallevi / maven-replacer-plugin

Automatically exported from code.google.com/p/maven-replacer-plugin
MIT License
0 stars 0 forks source link

TokenValueMap should no be loaded by Properties.load() since it breaks regex syntax #30

Closed GoogleCodeExporter closed 9 years ago

GoogleCodeExporter commented 9 years ago
using a TokenValueMap with regex=true does not work as expected. the
problem is that Properties.load() silently drops backslashes which
basically breaks the expression. there are other limitations with
Properties.load(), e.g. that the first whitespace character in the key will
be treated as the key/value separator, even if a '=' or ':' follows.

Original issue reported on code.google.com by deru...@gmail.com on 22 Mar 2010 at 12:23

GoogleCodeExporter commented 9 years ago
see:
http://java.sun.com/j2se/1.5.0/docs/api/java/util/Properties.html#load%28java.io
.InputStream%29

Original comment by deru...@gmail.com on 22 Mar 2010 at 12:23

GoogleCodeExporter commented 9 years ago
Thanks for the feedback.
This is a very good point, I will be making a change to this in the next 
release.

So far I am going to be using line separators to distinguish between different 
token/value pairs within a file.
If you see a problem with this, please respond.

Original comment by baker.st...@gmail.com on 23 Mar 2010 at 10:38

GoogleCodeExporter commented 9 years ago
do you mean:

token=value
token2=value2

or rather:

token
value
token2
value2

personally i would prefer the first option, but that probably means that you 
would
have to escape '=' within the regex expression, otherwise you may be not sure 
about
the token/value delimiter

option 2 seems to be easier to implement (no escaping required), but option 1 
looks
nicer imho

kind regards,
torben

Original comment by deru...@gmail.com on 23 Mar 2010 at 12:53

GoogleCodeExporter commented 9 years ago
I would like to go for the first option, however, it would require the token 
entered
by the user to be escaped as you mentionde.

e.g.
token\=with\=equals=value

Which does look kind of strange, and confusing to users.
However, those who do not have ='s in their token would have a better 
experience,
which in my opinion is a fair compromise.

Original comment by baker.st...@gmail.com on 24 Mar 2010 at 3:44

GoogleCodeExporter commented 9 years ago
just wondering: how would then treat a regex ending with a '\' ?

e.g.:
token\=value

but i guess the '\' has to be escaped anyway as per the java regex syntax, i.e. 
the
above statement would not be valid. instead you would write something like this 
i guess:

token\\=value

Original comment by deru...@gmail.com on 24 Mar 2010 at 8:45

GoogleCodeExporter commented 9 years ago
I think I am going to go with the simpler split line option (2).

There is less confusion with that option, what you have per line is what you 
get.

Original comment by baker.st...@gmail.com on 28 Mar 2010 at 11:07

GoogleCodeExporter commented 9 years ago
Completed coding and testing. Will be out in next release.
Has been implemented as separate lines for tokens and values, as pairs of lines.

Original comment by baker.st...@gmail.com on 1 Apr 2010 at 8:13

GoogleCodeExporter commented 9 years ago
1.3.1 has been released into the google hosted repo, and I am waiting for it to 
be 
added to the maven central repo, 
see: http://jira.codehaus.org/browse/MAVENUPLOAD-2767

In the meantime, you can point your maven settings at the google repo by 
following 
the instructions in the InstallationGuide.

I will update the project documentation soon.
Thanks,
Steven

Original comment by baker.st...@gmail.com on 17 Apr 2010 at 12:11

GoogleCodeExporter commented 9 years ago
1.3.1 is now within the central maven repository. You can now remove any 
references to 
this projects release repository.

Original comment by baker.st...@gmail.com on 7 May 2010 at 2:26

GoogleCodeExporter commented 9 years ago
Just issue clean up.

Original comment by baker.st...@gmail.com on 17 Sep 2012 at 12:41