* File.getCanonicalPath() test to strict
@ 2002-04-05 4:40 Mark Wielaard
0 siblings, 0 replies; only message in thread
From: Mark Wielaard @ 2002-04-05 4:40 UTC (permalink / raw)
To: mauve-discuss
Hi,
The getCanonicalPath() check seems to strict. According to the spec that
call is allowed to throw a IOException which it does with libgcj when
the File does not exist. This patch makes sure that the file actually
exists first.
2002-04-05 Mark Wielaard <mark@klomp.org>
* gnu/testlet/java/io/File/jdk11.java (test): Make sure that file
exists before calling getCanonicalPath().
Any objections?
Cheers,
Mark
Index: gnu/testlet/java/io/File/jdk11.java
===================================================================
RCS file: /cvs/mauve/mauve/gnu/testlet/java/io/File/jdk11.java,v
retrieving revision 1.2
diff -u -r1.2 jdk11.java
--- jdk11.java 2002/04/01 12:13:27 1.2
+++ jdk11.java 2002/04/05 12:37:05
@@ -219,6 +219,11 @@
try
{
+ // Make sure that file exists.
+ cons.mkdir ();
+ FileOutputStream fos = new FileOutputStream (tmp3);
+ fos.write (1);
+ fos.close ();
harness.debug ("tmp3.getCanonicalPath () = " + tmp3.getCanonicalPath ());
harness.debug ("equals? " + srcdirstr + File.separator
+ THIS_FILE + File.separator
@@ -228,6 +233,9 @@
+ THIS_FILE
+ File.separator
+ TMP_FILENAME3), "getCanonicalPath ()");
+ // Remove again
+ tmp3.delete ();
+ cons.delete ();
}
catch (IOException ioe)
{
^ permalink raw reply [flat|nested] only message in thread
only message in thread, other threads:[~2002-04-05 12:40 UTC | newest]
Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2002-04-05 4:40 File.getCanonicalPath() test to strict Mark Wielaard
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).