Return-Path: X-Original-To: apmail-commons-issues-archive@minotaur.apache.org Delivered-To: apmail-commons-issues-archive@minotaur.apache.org Received: from mail.apache.org (hermes.apache.org [140.211.11.3]) by minotaur.apache.org (Postfix) with SMTP id D34C618723 for ; Fri, 12 Jun 2015 23:57:00 +0000 (UTC) Received: (qmail 79840 invoked by uid 500); 12 Jun 2015 23:57:00 -0000 Delivered-To: apmail-commons-issues-archive@commons.apache.org Received: (qmail 79732 invoked by uid 500); 12 Jun 2015 23:57:00 -0000 Mailing-List: contact issues-help@commons.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: issues@commons.apache.org Delivered-To: mailing list issues@commons.apache.org Received: (qmail 79721 invoked by uid 99); 12 Jun 2015 23:57:00 -0000 Received: from arcas.apache.org (HELO arcas.apache.org) (140.211.11.28) by apache.org (qpsmtpd/0.29) with ESMTP; Fri, 12 Jun 2015 23:57:00 +0000 Date: Fri, 12 Jun 2015 23:57:00 +0000 (UTC) From: "Sebb (JIRA)" To: issues@commons.apache.org Message-ID: In-Reply-To: References: Subject: [jira] [Commented] (LANG-1075) Replace System.getProperty("file|path.separator") with File.separator|pathSeparator MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 7bit X-JIRA-FingerPrint: 30527f35849b9dde25b450d4833f0394 [ https://issues.apache.org/jira/browse/LANG-1075?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=14584295#comment-14584295 ] Sebb commented on LANG-1075: ---------------------------- I'm not suggesting changing how FILE_SEPARATOR or PATH_SEPARATOR are initialised. However, I think they should be deprecated in favour of the File class constants. > Replace System.getProperty("file|path.separator") with File.separator|pathSeparator > ----------------------------------------------------------------------------------- > > Key: LANG-1075 > URL: https://issues.apache.org/jira/browse/LANG-1075 > Project: Commons Lang > Issue Type: Improvement > Reporter: Sebb > Priority: Minor > Fix For: Patch Needed, 3.5 > > > The file separator character is available from both File.separator and System.getProperty("file.separator"). > The former is guaranteed to be a string of length 1, but the latter can be defined as a longer string on the Java command line. Thus the two can be different, but still allow the JVM to start up. > I found the following worked: > java -Dfile.separator=/xyz > for Unix or the equivalent \xyz on Windows. > [Using a different first character does not work - the JVM usually throws an > exception as it cannot find some required files if the sep. is incorrect.] > It looks like only the first character of the property is used by the JVM. > However, this is not done by the application code I have seen, which means that there could be a discrepancy between the two methods. > File.separator has the additional benefit that it is not subject to a privilege > check. > The same reasoning applies to "path.separator" => File.pathSeparator > Commons code should always use the File constants. -- This message was sent by Atlassian JIRA (v6.3.4#6332)