I did consider that, but the values of all the fields are known at
compile time, and so the compiler can construct a fixed string - and I
think that's what it does.

But to be sure, one could do what you suggest ...

On 17/01/2008, [EMAIL PROTECTED] <[EMAIL PROTECTED]> wrote:
> Just a minor point:
> Wouldn't it  be better to have a static final field CSV_QUOTE_QUOTE =
> CSV_QUOTE_STR + CSV_QUOTE_STR
> Considering performances issues, since the String would be constructed
> (and garbage collected) each time the method is called,
>
> Julien
>
>
> On 17/01/2008, [EMAIL PROTECTED] <[EMAIL PROTECTED]> wrote:
> > Author: ggregory
> > Date: Wed Jan 16 23:54:21 2008
> > New Revision: 612746
> >
> > URL: http://svn.apache.org/viewvc?rev=612746&view=rev
> > Log:
> > Remove dependency on Java 1.4.2. Stick with Java 1.3.1.
> >
> > Modified:
> >
> commons/proper/lang/trunk/src/java/org/apache/commons/lang/StringEscapeUtils.java
> >
> > Modified:
> commons/proper/lang/trunk/src/java/org/apache/commons/lang/StringEscapeUtils.java
> > URL:
> http://svn.apache.org/viewvc/commons/proper/lang/trunk/src/java/org/apache/commons/lang/StringEscapeUtils.java?rev=612746&r1=612745&r2=612746&view=diff
>
> >
> ==============================================================================
> > ---
> commons/proper/lang/trunk/src/java/org/apache/commons/lang/StringEscapeUtils.java
> (original)
> > +++
> commons/proper/lang/trunk/src/java/org/apache/commons/lang/StringEscapeUtils.java
> Wed Jan 16 23:54:21 2008
> > @@ -42,6 +42,7 @@
> >
> >     private static final char CSV_DELIMITER = ',';
> >     private static final char CSV_QUOTE = '"';
> > +    private static final String CSV_QUOTE_STR =
> String.valueOf(CSV_QUOTE);
> >     private static final char[] CSV_SEARCH_CHARS = new char[]
> {CSV_DELIMITER, CSV_QUOTE, CharUtils.CR, CharUtils.LF};
> >
> >     /**
> > @@ -850,7 +851,7 @@
> >
> >         if ( StringUtils.containsAny(quoteless, CSV_SEARCH_CHARS) ) {
> >             // deal with escaped quotes; ie) ""
> > -            str = StringUtils.replace(quoteless, "" + CSV_QUOTE +
> CSV_QUOTE, Character.toString(CSV_QUOTE));
> > +            str = StringUtils.replace(quoteless, "" + CSV_QUOTE +
> CSV_QUOTE, CSV_QUOTE_STR);
>
> Surely that would be easier to read expressed as:
>
> str = StringUtils.replace(quoteless, CSV_QUOTE_STR + CSV_QUOTE_STR,
> CSV_QUOTE_STR);
>
> >         }
> >
> >         out.write(str);
> >
> >
> >
>
> *************************************************************************
> This message and any attachments (the "message") are confidential and 
> intended solely for the addressee(s).
> Any unauthorised use or dissemination is prohibited. E-mails are susceptible 
> to alteration.
> Neither SOCIETE GENERALE nor any of its subsidiaries or affiliates shall be 
> liable for the message if altered, changed or
> falsified.
>                              ************
> Ce message et toutes les pieces jointes (ci-apres le "message") sont 
> confidentiels et etablis a l'intention exclusive de ses
> destinataires. Toute utilisation ou diffusion non autorisee est interdite. 
> Tout message electronique est susceptible d'alteration.
> La SOCIETE GENERALE et ses filiales declinent toute responsabilite au titre 
> de ce message s'il a ete altere, deforme ou falsifie.
> *************************************************************************
>

---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to