Re: Adding constant for line.separator and friends

2009-11-12 Thread Alan Bateman
Ulf Zibis wrote: It's also worth pointing out that FileSystem already defines a getSeparator method. Oops, I've overseen this too, but wondering that getPathSeparator is missing there. It's debatable if this would be right or even useful because it extends the notion of PATH to all provider

Re: Adding constant for line.separator and friends

2009-11-12 Thread Ulf Zibis
Alan, didn't you get this post: http://mail.openjdk.java.net/pipermail/core-libs-dev/2009-November/003214.html ? Am 12.11.2009 11:35, Alan Bateman schrieb: It's also worth pointing out that FileSystem already defines a getSeparator method. Oops, I've overseen this too, but wondering that

Re: Adding constant for line.separator and friends

2009-11-12 Thread Alan Bateman
Ulf Zibis wrote: : At least, IMO, fileSeparator() and pathSeparator() would belong to java.io.File or java.nio.file.FileSystem. As I think Martin pointed out, File.separator and File.pathSeparator have always been there. They should of course have been methods rather than fields. In theory the

Re: Adding constant for line.separator and friends

2009-11-11 Thread Ulf Zibis
Am 11.11.2009 22:48, Martin Buchholz schrieb: On Wed, Nov 11, 2009 at 12:46, Stephen Colebourne mailto:scolebou...@joda.org>> wrote: Martin Buchholz wrote: On Wed, Nov 11, 2009 at 10:10, Ulf Zibis mailto:ulf.zi...@gmx.de>

Re: Adding constant for line.separator and friends

2009-11-11 Thread Martin Buchholz
On Wed, Nov 11, 2009 at 12:46, Stephen Colebourne wrote: > Martin Buchholz wrote: > > On Wed, Nov 11, 2009 at 10:10, Ulf Zibis > ulf.zi...@gmx.de>> wrote: >>At least, IMO, fileSeparator() and pathSeparator() would belong to >>java.io.File or java.nio.file.FileSystem. >> Those would have b

Re: Adding constant for line.separator and friends

2009-11-11 Thread Stephen Colebourne
Martin Buchholz wrote: On Wed, Nov 11, 2009 at 10:10, Ulf Zibis > wrote: At least, IMO, fileSeparator() and pathSeparator() would belong to java.io.File or java.nio.file.FileSystem. Those would have been better names, but at this point they are not worth adding.

Re: Adding constant for line.separator and friends

2009-11-11 Thread Martin Buchholz
On Wed, Nov 11, 2009 at 10:10, Ulf Zibis wrote: > At least, IMO, fileSeparator() and pathSeparator() would belong to > java.io.File or java.nio.file.FileSystem. > > Those would have been better names, but at this point they are not worth adding. Martin

Re: Adding constant for line.separator and friends

2009-11-11 Thread Ulf Zibis
Am 11.11.2009 01:40, Martin Buchholz schrieb: On Tue, Nov 10, 2009 at 10:06, Joseph D. Darcy wrote: Martin, If we're settled on a method in System, please send a revised spec and I'll file the ccc paperwork. I'm agnostic about whether it belongs in System or File or elsewhere, A

Re: Adding constant for line.separator and friends

2009-11-10 Thread Joe Darcy
On 11/10/09 04:40 PM, Martin Buchholz wrote: On Tue, Nov 10, 2009 at 10:06, Joseph D. Darcy wrote: Martin, If we're settled on a method in System, please send a revised spec and I'll file the ccc paperwork. I'm agnostic about whether it belongs in System or File or elsewhere, but my

Re: Adding constant for line.separator and friends

2009-11-10 Thread Martin Buchholz
On Tue, Nov 10, 2009 at 10:06, Joseph D. Darcy wrote: > Martin, > > If we're settled on a method in System, please send a revised spec and I'll > file the ccc paperwork. I'm agnostic about whether it belongs in System or File or elsewhere, but my "serious" webrev below puts it in System. http://

Re: Adding constant for line.separator and friends

2009-11-10 Thread Joseph D. Darcy
Mark Reinhold wrote: Date: Mon, 09 Nov 2009 23:07:05 -0800 From: Martin Buchholz On Mon, Nov 9, 2009 at 21:54, Mark Reinhold wrote: ... Yet ... how much of a problem is this outside of the JDK itself and, more generally, for new code rather than old? If there are n (for n <= 4

Re: Adding constant for line.separator and friends

2009-11-10 Thread Ulf Zibis
Am 10.11.2009 18:30, Martin Buchholz schrieb: System.lineSeparator() is a small step, but it's achievable. My 2 cents: I would like to see it in class java.io.File, as those properties occur mainly in text files. Also system property for encoding is named "file.encoding". -Ulf

Re: Adding constant for line.separator and friends

2009-11-10 Thread Mark Reinhold
> Date: Mon, 09 Nov 2009 23:07:05 -0800 > From: Martin Buchholz > On Mon, Nov 9, 2009 at 21:54, Mark Reinhold wrote: >> ... >> Yet ... how much of a problem is this outside of the JDK itself and, >> more generally, for new code rather than old? >> >> If there are n (for n <= 43) problematic use

Re: Adding constant for line.separator and friends

2009-11-10 Thread Martin Buchholz
On Tue, Nov 10, 2009 at 03:05, Stephen Colebourne wrote: > 2009/11/10 Mark Reinhold : > > Yet ... how much of a problem is this outside of the JDK itself and, > > more generally, for new code rather than old? > > > > If there are n (for n <= 43) problematic uses in the JDK then we could > > just f

Re: Adding constant for line.separator and friends

2009-11-10 Thread Alex Miller
I've seen multiple instances of constants for line.separator, etc in just about every application code base I've ever used. I'd heartily vote for standardizing a well-defined way to get this in the JDK. I think methods would be fine and System seems like the best location for them. Alex

Re: Adding constant for line.separator and friends

2009-11-10 Thread Stephen Colebourne
2009/11/10 Mark Reinhold : > Yet ... how much of a problem is this outside of the JDK itself and, > more generally, for new code rather than old? > > If there are n (for n <= 43) problematic uses in the JDK then we could > just fix those without defining any new public API.  For new code we > shoul

Re: Adding constant for line.separator and friends

2009-11-09 Thread Rémi Forax
Le 10/11/2009 08:07, Martin Buchholz a écrit : On Mon, Nov 9, 2009 at 21:54, Mark Reinhold > wrote: > Date: Mon, 09 Nov 2009 20:29:51 -0800 > From: Martin Buchholz mailto:marti...@google.com>> > ... > > Since line.separator is the most popular system

Re: Adding constant for line.separator and friends

2009-11-09 Thread Martin Buchholz
On Mon, Nov 9, 2009 at 21:54, Mark Reinhold wrote: > > Date: Mon, 09 Nov 2009 20:29:51 -0800 > > From: Martin Buchholz > > > ... > > > > Since line.separator is the most popular system property, > > and other system properties like > > java.home have vague security implications > > that would su

Re: Adding constant for line.separator and friends

2009-11-09 Thread Mark Reinhold
> Date: Mon, 09 Nov 2009 20:29:51 -0800 > From: Martin Buchholz > ... > > Since line.separator is the most popular system property, > and other system properties like > java.home have vague security implications > that would suggest they must be protected by > a security manager, we might consid

Re: Adding constant for line.separator and friends

2009-11-09 Thread Martin Buchholz
On Mon, Nov 9, 2009 at 20:14, Joe Darcy wrote: > Martin Buchholz wrote: > >> >> > Hi Martin, > > Given that these values are not true constants since they vary across > platforms, I think it is misleading to make them look like constant by > having them be "public static final" fields with ALL CA

Re: Adding constant for line.separator and friends

2009-11-09 Thread Joe Darcy
Martin Buchholz wrote: (In response to Joe, who once asked me for little things to add to the core libraries) Lots of classes need to use System.getProperty("line.separator"). Many don't do it right because you need to use a doPrivileged block whenever you read a system property. Yet it is no se

Re: Adding constant for line.separator and friends

2009-11-09 Thread Martin Buchholz
More lobbying Here's how many source files in the JDK access this system property. $ rg '"line.separator"' | wc -l 43 Some use doPrivileged, some don't. Some cache statically, some cache in an object, some don't cache at all. Martin

Re: Adding constant for line.separator and friends

2009-11-09 Thread Martin Buchholz
On Mon, Nov 9, 2009 at 16:34, Martin Buchholz wrote: > (In response to Joe, who once asked me for little things to add > to the core libraries) > > Lots of classes need to use System.getProperty("line.separator"). > Many don't do it right because you need to use > a doPrivileged block whenever you

Re: Adding constant for line.separator and friends

2009-11-09 Thread Max (Weijun) Wang
Really necessary? These three system properties are already allowed in the sandbox. $ cat lib/security/java.policy permission java.util.PropertyPermission "file.separator", "read"; permission java.util.PropertyPermission "path.separator", "read"; permission java.uti

Adding constant for line.separator and friends

2009-11-09 Thread Martin Buchholz
(In response to Joe, who once asked me for little things to add to the core libraries) Lots of classes need to use System.getProperty("line.separator"). Many don't do it right because you need to use a doPrivileged block whenever you read a system property. Yet it is no secret - you can divine the