Re: [csv] j2se1.3 compatibility / header line writer
Probably worth checking if it's performant or not first :) I just got my laptop back after a couple of weeks on a spare, so ready to get JProfiler up and running for testing. Maybe a good time to check YourKit out too. Hen On 5/22/06, sebb [EMAIL PROTECTED] wrote: OK, I see. Whatever method is chosen, it's worth documenting the reasons for the strange coding... If a release is being built to support 1.3 and above, it might be worth using the 1.3 compiler - or at least using the 1.3 jars. - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: [csv] j2se1.3 compatibility / header line writer
urs hardegger wrote: netcetera suggests the following changes to commons csv: 1) CSVPartser.java: StringBuffer.append(StringBuffer) is no supported in JDK 1.3. It would be a pitty to have an incompatibility because of this issue. In case this is performance critical, we surround this with an if statement for the JDK version. It is supported in jdk1.3.. Just cast the stringbuffer passed in to an object, so like StringBuffer.append((Object) StringBuffer)). Much more efficient than an if... Mvgr, Martin - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: [csv] j2se1.3 compatibility / header line writer
It is supported in jdk1.3.. Just cast the stringbuffer passed in to an object, so like StringBuffer.append((Object) StringBuffer)). Much more efficient than an if... Surely a StringBuffer is already an Object? Or am I missing something here? StringBuffer has a new method in Java 1.4 to append another Stringbuffer without invoking it's toSring() method. Code that uses StringBuffer.append(stb) and compiled by a JDK 1.4 will not work on Java 1.3. I miself recommand Using StringBuffer.append(stb.toString()) that looks better than an apparently useless (Object) cast : checkstyle or IDE may warn for unecessary cast. Nico. This message contains information that may be privileged or confidential and is the property of the Capgemini Group. It is intended only for the person to whom it is addressed. If you are not the intended recipient, you are not authorized to read, print, retain, copy, disseminate, distribute, or use this message or any part thereof. If you receive this message in error, please notify the sender immediately and delete all copies of this message. - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: [csv] j2se1.3 compatibility / header line writer
On 22/05/06, Nicolas De Loof [EMAIL PROTECTED] wrote: It is supported in jdk1.3.. Just cast the stringbuffer passed in to an object, so like StringBuffer.append((Object) StringBuffer)). Much more efficient than an if... Surely a StringBuffer is already an Object? Or am I missing something here? StringBuffer has a new method in Java 1.4 to append another Stringbuffer without invoking it's toSring() method. Code that uses StringBuffer.append(stb) and compiled by a JDK 1.4 will not work on Java 1.3. I miself recommand Using StringBuffer.append(stb.toString()) that looks better than an apparently useless (Object) cast : checkstyle or IDE may warn for unecessary cast. But that won't work so well on Java 1.4+. Can't one just use: sb1.append(sb2); for both 1.3 and 1.4, and let the method do the work as needed? - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: [csv] j2se1.3 compatibility / header line writer
Nicolas De Loof wrote: It is supported in jdk1.3.. Just cast the stringbuffer passed in to an object, so like StringBuffer.append((Object) StringBuffer)). Much more efficient than an if... Surely a StringBuffer is already an Object? Or am I missing something here? StringBuffer has a new method in Java 1.4 to append another Stringbuffer without invoking it's toSring() method. Code that uses StringBuffer.append(stb) and compiled by a JDK 1.4 will not work on Java 1.3. I miself recommand Using StringBuffer.append(stb.toString()) that looks better than an apparently useless (Object) cast : checkstyle or IDE may warn for unecessary cast. Also may be a solution, which looks more readable. Though I fixed all these StringBuffer issues I had personally by adding the not very useless Object cast (this way you prevent the usage of the overloaded method which takes a StringBuffer). This way I don't have to worry whats under the covers , which in this case is according to you a toString(). Mvgr, Martin - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: [csv] j2se1.3 compatibility / header line writer
compiled on a JDK 1.4, sb1.append(sb2) will not work on java 1.3 JRE : it requires append(StringBuffer). compiled on a JDK 1.3, it is equivalent to a toString() call as append(Object) method is used by compiler. It will work on all JRE but will be non-optimal on JDK 1.4 Only two versions of the jar may solve this issue, or some JDK compatibility test : pseudo-code final static boolean jdk13 = System.getProperty(|java.vm.version|).startWith(1.3); if (jdk13) { stb1.append(stb2.toString()); } else { stb1.append(stb2); } /pseudo-code AFAIK, this code, compiled using JDK 1.4 will run under Java 1.3 without noSuchMethodException AND uses Java1.4 Stringbuffer optimizations sebb a écrit : On 22/05/06, Nicolas De Loof [EMAIL PROTECTED] wrote: It is supported in jdk1.3.. Just cast the stringbuffer passed in to an object, so like StringBuffer.append((Object) StringBuffer)). Much more efficient than an if... Surely a StringBuffer is already an Object? Or am I missing something here? StringBuffer has a new method in Java 1.4 to append another Stringbuffer without invoking it's toSring() method. Code that uses StringBuffer.append(stb) and compiled by a JDK 1.4 will not work on Java 1.3. I miself recommand Using StringBuffer.append(stb.toString()) that looks better than an apparently useless (Object) cast : checkstyle or IDE may warn for unecessary cast. But that won't work so well on Java 1.4+. Can't one just use: sb1.append(sb2); for both 1.3 and 1.4, and let the method do the work as needed? - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] This message contains information that may be privileged or confidential and is the property of the Capgemini Group. It is intended only for the person to whom it is addressed. If you are not the intended recipient, you are not authorized to read, print, retain, copy, disseminate, distribute, or use this message or any part thereof. If you receive this message in error, please notify the sender immediately and delete all copies of this message. - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: [csv] j2se1.3 compatibility / header line writer
That just works when compiling on jdk1.3 and will not work on jdk1.3 when compiled on jdk1.4 To prevent this, you specifically have to cast it to object to say use the append which takes an object or as Nicolas suggested a toString(), but the last one is not my favorite solution.. Mvgr, Martin sebb wrote: On 22/05/06, Nicolas De Loof [EMAIL PROTECTED] wrote: It is supported in jdk1.3.. Just cast the stringbuffer passed in to an object, so like StringBuffer.append((Object) StringBuffer)). Much more efficient than an if... Surely a StringBuffer is already an Object? Or am I missing something here? StringBuffer has a new method in Java 1.4 to append another Stringbuffer without invoking it's toSring() method. Code that uses StringBuffer.append(stb) and compiled by a JDK 1.4 will not work on Java 1.3. I miself recommand Using StringBuffer.append(stb.toString()) that looks better than an apparently useless (Object) cast : checkstyle or IDE may warn for unecessary cast. But that won't work so well on Java 1.4+. Can't one just use: sb1.append(sb2); for both 1.3 and 1.4, and let the method do the work as needed? - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: [csv] j2se1.3 compatibility / header line writer
OK, I see. Whatever method is chosen, it's worth documenting the reasons for the strange coding... If a release is being built to support 1.3 and above, it might be worth using the 1.3 compiler - or at least using the 1.3 jars. S. On 22/05/06, Martin van den Bemt [EMAIL PROTECTED] wrote: That just works when compiling on jdk1.3 and will not work on jdk1.3 when compiled on jdk1.4 To prevent this, you specifically have to cast it to object to say use the append which takes an object or as Nicolas suggested a toString(), but the last one is not my favorite solution.. Mvgr, Martin sebb wrote: On 22/05/06, Nicolas De Loof [EMAIL PROTECTED] wrote: It is supported in jdk1.3.. Just cast the stringbuffer passed in to an object, so like StringBuffer.append((Object) StringBuffer)). Much more efficient than an if... Surely a StringBuffer is already an Object? Or am I missing something here? StringBuffer has a new method in Java 1.4 to append another Stringbuffer without invoking it's toSring() method. Code that uses StringBuffer.append(stb) and compiled by a JDK 1.4 will not work on Java 1.3. I miself recommand Using StringBuffer.append(stb.toString()) that looks better than an apparently useless (Object) cast : checkstyle or IDE may warn for unecessary cast. But that won't work so well on Java 1.4+. Can't one just use: sb1.append(sb2); for both 1.3 and 1.4, and let the method do the work as needed? - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: [csv] j2se1.3 compatibility / header line writer
Any chance you could submit these in Jira? http://issues.apache.org/jira to the Commons Sandbox project. Makes it easier to manage and not have things get lost; and a better public history for showing active contributors. Hen On 5/17/06, urs hardegger [EMAIL PROTECTED] wrote: netcetera suggests the following changes to commons csv: 1) CSVPartser.java: StringBuffer.append(StringBuffer) is no supported in JDK 1.3. It would be a pitty to have an incompatibility because of this issue. In case this is performance critical, we surround this with an if statement for the JDK version. 2) CSVWriter: CSVConfig.fieldHeader not honored Setting CSVConfig.fieldHeader has no effect. Because neighter the CSVWriter nor CSVConfig do hold the has the header been written state I propose to add CSVWriter.writeHeader() method. check the supplied svn-patches for coding details. - urs.hardegger -- Urs Hardegger Netcetera AG | 8040 Zuerich | Switzerland | http://netcetera.ch - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]