Duplicate :
|
|
Relates :
|
|
Relates :
|
Name: nt126004 Date: 07/31/2002 FULL PRODUCT VERSION : java version "1.4.1-beta" Java(TM) 2 Runtime Environment, Standard Edition (build 1.4.1-beta-b14) Java HotSpot(TM) Client VM (build 1.4.1-beta-b14, mixed mode) FULL OPERATING SYSTEM VERSION : Microsoft Windows 2000 [Version 5.00.2195] Service Pack 2 A DESCRIPTION OF THE PROBLEM : Calling URI.normalize() on a URI that was derived from a file that is a UNC will ruin the URI. I understand that URI.normalize() follows RFC 2396, and I have no problem with that. I guess the issue is that File.toURI() creates a URI that may not conform to the spec. If I do not normalize the URI I can use the URI to create a File object later that correctly points to the UNC and I can access it. Once normalize() has been called, and I want to call it to be sure I have unique URIs for unique files, the File I construct from the URI will no longer be able to access the UNC file. STEPS TO FOLLOW TO REPRODUCE THE PROBLEM : 1. Run the test program. EXPECTED VERSUS ACTUAL BEHAVIOR : Start File: \\S840700\pub\request.asp Start URI: file:////S840700/pub/request.asp After normalization. Result URI: file:/S840700/pub/request.asp Result File: \S840700\pub\request.asp REPRODUCIBILITY : This bug can be reproduced always. ---------- BEGIN SOURCE ---------- import java.io.File; import java.net.URI; public class TestFile { public static final void main( String[] aaParamters ) { File oStartFile = new File( "\\\\S840700\\pub\\request.asp" ); URI oStartURI = oStartFile.toURI(); String sStartString = oStartURI.toString(); System.out.println( "Start File: " + oStartFile ); System.out.println( "Start URI: " + oStartURI ); URI oURI = oStartURI.normalize(); File oFile = new File( oURI ); System.out.println( "After normalization." ); System.out.println( "Result URI: " + oURI ); System.out.println( "Result File: " + oFile ); } } ---------- END SOURCE ---------- (Review ID: 159930) ====================================================================== ###@###.### 10/13/04 06:29 GMT
|