This Bugzilla instance is a read-only archive of historic NetBeans bug reports. To report a bug in NetBeans please follow the project's instructions for reporting issues.

Bug 50431 - PropertyUtils.resolveFile() should call FileUtil.normalizeFile
Summary: PropertyUtils.resolveFile() should call FileUtil.normalizeFile
Alias: None
Product: projects
Classification: Unclassified
Component: Ant (show other bugs)
Version: 4.x
Hardware: PC Windows XP
: P2 blocker (vote)
Assignee: David Konecny
Depends on:
Blocks: 41535 50433
  Show dependency tree
Reported: 2004-10-14 15:26 UTC by David Konecny
Modified: 2006-03-24 09:58 UTC (History)
0 users

See Also:
Issue Type: DEFECT
Exception Reporter:


Note You need to log in before you can comment on or make changes to this bug.
Description David Konecny 2004-10-14 15:26:40 UTC
SUBJ says all. This method is used for example
from J2SE project when classpath property was read
from properties file and needs to be converted to
io.File. If property file was customized by user
the path might not be normalized.
Comment 1 David Konecny 2004-10-14 15:44:52 UTC
This is cause of issue 50433.
Comment 2 Jesse Glick 2004-10-14 17:51:30 UTC
Note: I think PropertyUtils.resolveFile should *not* call
FileUtil.normalizeFile if using the basedir; rather, the caller of
PU.rF should have assured that the base dir is already normalized. The
reason is that FU.nF is potentially expensive and it should only be
called when receiving a file path from an uncontrolled external
source. When doing internal filename manipulations, it is not
necessary. However when ignoring the basedir and returning an absolute
filename, then it does need to use FU.nF.

The assumption is that a basedir should always be normalized already
(could perhaps be confirmed using IllegalArgumentException if
assertions are turned on - with assertions off, should not waste time
checking it), whereas the "filename" argument is not tightly
constrained and always needs to be sanitized.
Comment 3 David Konecny 2004-10-15 15:08:57 UTC
But even for relative paths, if user customize properties file and use
incorrect case on Windows then they will have problems.

Perhaps I could call FU.nF in PU.rF only when OS is Windows?
Comment 4 Jesse Glick 2004-10-15 19:52:49 UTC
"But even for relative paths, if user customize properties file and use
incorrect case on Windows then they will have problems." - ah, true.
Well I guess you always have to call FU.nF then.
Comment 5 David Konecny 2004-10-18 17:31:30 UTC
Fixed in:
new revision: 1.23; previous revision: 1.22
Comment 6 Jaromir Uhrik 2005-07-14 16:19:20 UTC