/*
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* under the terms of the GNU General Public License version 2 only, as
* published by the Free Software Foundation.
*
* This code is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
* version 2 for more details (a copy is included in the LICENSE file that
* accompanied this code).
*
* You should have received a copy of the GNU General Public License version
* 2 along with this work; if not, write to the Free Software Foundation,
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
*
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
* or visit www.oracle.com if you need additional information or have any
* questions.
*/
/* @test
@bug 4032066 4039597 4046914 4054511 4065189 4109131 4875229 6983520
@summary General exhaustive test of win32 pathname handling
@author Mark Reinhold
@build General GeneralWin32
*/
/**
* Hardwired UNC pathnames used for testing
*
* This test attempts to use the host and share names defined in this class
* to test UNC pathnames. The test will not fail if the host or share
* don't exist, but it will print a warning saying that it was unable to
* test UNC pathnames completely.
*/
/* Pathnames relative to working directory */
/* Use long names here to avoid 8.3 format, which Samba servers often
force to lowercase */
if (!f.exists()) {
if (!d.exists()) {
if (!d.mkdirs()) {
throw new RuntimeException("Can't create directory " + d);
}
}
OutputStream o = new FileOutputStream(f);
o.close();
}
o.close();
}
/* Computing the canonical path of a Win32 file should expose the true
case of filenames, rather than just using the input case */
}
try {
f.getCanonicalPath();
} catch (IOException x) {
return;
}
throw new Exception("Wildcard path not rejected: " + f);
}
}
}
/* Pathnames with drive specifiers */
private static char findInactiveDrive() {
for (char d = 'Z'; d >= 'E'; d--) {
return d;
}
}
throw new RuntimeException("Can't find an inactive drive");
}
private static char findActiveDrive() {
for (char d = 'C'; d <= 'Z'; d--) {
}
throw new RuntimeException("Can't find an active drive");
}
throws Exception
{
}
}
/* UNC pathnames */
+ "\\" + NONEXISTENT_UNC_SHARE);
ensureNon(s);
checkSlashes(2, false, s, s);
" does not exist, unable to test UNC pathnames");
return;
}
checkSlashes(2, false, s, s);
}
/* This test is only valid on win32 systems */
return;
}
}
}