You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@commons.apache.org by Emmanuel Bourg <e....@cross-systems.com> on 2004/01/28 13:59:54 UTC

[configuration] unescaping properties

Hi, i noticed that unlike java.util.Properties and the old 
ExtendedProperties our PropertiesConfiguration doesn't handle escaped 
characters like \n, \t or unicode characters \u0123. I suggest this 
patch to fix this issue. It only affects PropertiesConfiguration, i 
don't know if it's worth changing AbstractConfiguration.addProperty 
instead to port this feature to all configurations.

Emmanuel Bourg


Re: [configuration] unescaping properties

Posted by Emmanuel Bourg <e....@cross-systems.com>.
I would consider the exception changes i mentioned last week for 1.0

Back to unescaping, we should also escape characters on saving, it can 
be done with this change in BasePropertiesConfiguration:

@@ -428,7 +429,7 @@
  {
      write(key);
      write(" = ");
-    write(value != null ? value : "");
+    write(value != null ? StringEscapeUtils.escapeJava(value) : "");
      write('\n');
  }


Emmanuel Bourg



Eric Pugh wrote:
> Re: [configuration] unescaping propertiesOkay, I'm sold!  I guess we can
> start simple with PropertiesConfiguration and then add it to others if
> usecases come up.  Is there anything else you want in 1.0?  Otherwise I want
> to move to cutting the Release Candatate this weekend.
> 
> Eric
>   -----Original Message-----
>   From: Emmanuel Bourg [mailto:e.bourg@cross-systems.com]
>   Sent: Thursday, January 29, 2004 2:09 PM
>   To: Jakarta Commons Developers List
>   Subject: Re: [configuration] unescaping properties
> 
> 
>   I noticed this issue because i needed \n to be handled in my .properties
>   files, that's the only way to have a line return in a property in such a
>   file. The same is not true for a DatabaseConfiguration for example, the
>   value field can store unescaped characters. Same thing for
>   XMLConfiguration, line returns are naturally accepted in the property
>   values and XML entities can be used for special characters. That's why i
>   would say it's a problem specific to PropertiesConfiguration and
>   AbstractConfiguration doesn't need to be modified.
> 
>   Emmanuel Bourg
> 
> 
> 
>   Eric Pugh wrote:
> 
>   > [configuration] unescaping propertiesWell, it seems like if it is good
>   > enough for Propertiesconfiguration, then it is good enough for all of
> them,
>   > right?  Unless this should be decorator?  Would you always want to
> escape
>   > these characters?  What happens if you don't escape them?
>   >
>   > Eric
> 

RE: [configuration] unescaping properties

Posted by Eric Pugh <ep...@upstate.com>.
I missed that, could you toss a bug in?  Then I'll start working through the
bug list.

Thanks!

> -----Original Message-----
> From: Oliver Heger [mailto:hegero@med.uni-marburg.de]
> Sent: Thursday, January 29, 2004 4:46 PM
> To: Jakarta Commons Developers List
> Subject: Re: [configuration] unescaping properties
>
>
> Eric,
>
> did you notice my posting from January 23rd in which I
> reported problems
> with JNDIConfiguration:
>
> http://nagoya.apache.org/eyebrowse/ReadMsg?listName=commons-de
> v@jakarta.apache.org&msgId=1324778
>
> I am not sure whether this is a bug or maybe a shortcomming
> of the test
> JNDI implementation. But this should be addressed before a release.
> Perhaps I should have added a bugzilla ticket.
>
> Oliver
>
> Eric Pugh schrieb:
>
> > Re: [configuration] unescaping propertiesOkay, I'm sold!  I
> guess we can
> > start simple with PropertiesConfiguration and then add it
> to others if
> > usecases come up.  Is there anything else you want in 1.0?
> Otherwise I want
> > to move to cutting the Release Candatate this weekend.
> >
> > Eric
> [snip]
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: commons-dev-unsubscribe@jakarta.apache.org
> For additional commands, e-mail: commons-dev-help@jakarta.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: commons-dev-unsubscribe@jakarta.apache.org
For additional commands, e-mail: commons-dev-help@jakarta.apache.org


Re: [configuration] unescaping properties

Posted by Oliver Heger <he...@med.uni-marburg.de>.
Eric,

did you notice my posting from January 23rd in which I reported problems 
with JNDIConfiguration:

http://nagoya.apache.org/eyebrowse/ReadMsg?listName=commons-dev@jakarta.apache.org&msgId=1324778

I am not sure whether this is a bug or maybe a shortcomming of the test 
JNDI implementation. But this should be addressed before a release. 
Perhaps I should have added a bugzilla ticket.

Oliver

Eric Pugh schrieb:

> Re: [configuration] unescaping propertiesOkay, I'm sold!  I guess we can
> start simple with PropertiesConfiguration and then add it to others if
> usecases come up.  Is there anything else you want in 1.0?  Otherwise I want
> to move to cutting the Release Candatate this weekend.
> 
> Eric
[snip]


---------------------------------------------------------------------
To unsubscribe, e-mail: commons-dev-unsubscribe@jakarta.apache.org
For additional commands, e-mail: commons-dev-help@jakarta.apache.org


RE: [configuration] unescaping properties

Posted by Eric Pugh <ep...@upstate.com>.
Re: [configuration] unescaping propertiesOkay, I'm sold!  I guess we can
start simple with PropertiesConfiguration and then add it to others if
usecases come up.  Is there anything else you want in 1.0?  Otherwise I want
to move to cutting the Release Candatate this weekend.

Eric
  -----Original Message-----
  From: Emmanuel Bourg [mailto:e.bourg@cross-systems.com]
  Sent: Thursday, January 29, 2004 2:09 PM
  To: Jakarta Commons Developers List
  Subject: Re: [configuration] unescaping properties


  I noticed this issue because i needed \n to be handled in my .properties
  files, that's the only way to have a line return in a property in such a
  file. The same is not true for a DatabaseConfiguration for example, the
  value field can store unescaped characters. Same thing for
  XMLConfiguration, line returns are naturally accepted in the property
  values and XML entities can be used for special characters. That's why i
  would say it's a problem specific to PropertiesConfiguration and
  AbstractConfiguration doesn't need to be modified.

  Emmanuel Bourg



  Eric Pugh wrote:

  > [configuration] unescaping propertiesWell, it seems like if it is good
  > enough for Propertiesconfiguration, then it is good enough for all of
them,
  > right?  Unless this should be decorator?  Would you always want to
escape
  > these characters?  What happens if you don't escape them?
  >
  > Eric

Re: [configuration] unescaping properties

Posted by Emmanuel Bourg <e....@cross-systems.com>.
I noticed this issue because i needed \n to be handled in my .properties 
files, that's the only way to have a line return in a property in such a 
file. The same is not true for a DatabaseConfiguration for example, the 
value field can store unescaped characters. Same thing for 
XMLConfiguration, line returns are naturally accepted in the property 
values and XML entities can be used for special characters. That's why i 
would say it's a problem specific to PropertiesConfiguration and 
AbstractConfiguration doesn't need to be modified.

Emmanuel Bourg


Eric Pugh wrote:

> [configuration] unescaping propertiesWell, it seems like if it is good
> enough for Propertiesconfiguration, then it is good enough for all of them,
> right?  Unless this should be decorator?  Would you always want to escape
> these characters?  What happens if you don't escape them?
> 
> Eric


RE: [configuration] unescaping properties

Posted by Eric Pugh <ep...@upstate.com>.
[configuration] unescaping propertiesWell, it seems like if it is good
enough for Propertiesconfiguration, then it is good enough for all of them,
right?  Unless this should be decorator?  Would you always want to escape
these characters?  What happens if you don't escape them?

Eric
  -----Original Message-----
  From: Emmanuel Bourg [mailto:e.bourg@cross-systems.com]
  Sent: Wednesday, January 28, 2004 2:00 PM
  To: Jakarta Commons Developers List
  Subject: [configuration] unescaping properties


  Hi, i noticed that unlike java.util.Properties and the old
  ExtendedProperties our PropertiesConfiguration doesn't handle escaped
  characters like \n, \t or unicode characters \u0123. I suggest this
  patch to fix this issue. It only affects PropertiesConfiguration, i
  don't know if it's worth changing AbstractConfiguration.addProperty
  instead to port this feature to all configurations.

  Emmanuel Bourg