FULL PRODUCT VERSION :
java version "1.5.0"
Java(TM) 2 Runtime Environment, Standard Edition (build 1.5.0-b64)
Java HotSpot(TM) Client VM (build 1.5.0-b64, mixed mode)
ADDITIONAL OS VERSION INFORMATION :
Microsoft Windows XP [Version 5.1.2600]
A DESCRIPTION OF THE PROBLEM :
An exception is thrown where one should not be.
STEPS TO FOLLOW TO REPRODUCE THE PROBLEM :
The following code throws an exception:
import java.net.*;
/**
*
* @author kitfox
*/
public class NewMain
{
/** Creates a new instance of NewMain */
public NewMain()
{
}
/**
* @param args the command line arguments
*/
public static void main(String[] args)
{
try
{
URI uri = new URI("file:/C:/tmp/imagefade.svg");
String frag = "C:\\svg\\test.png";
URI uri2 = uri.resolve(frag);
System.err.println("" + uri2);
}
catch (Exception e)
{
e.printStackTrace();
}
}
}
EXPECTED VERSUS ACTUAL BEHAVIOR :
EXPECTED -
uri2 should be set to "c:/svg/test.png"
ERROR MESSAGES/STACK TRACES THAT OCCUR :
init:
javacc:
compile:
Compiling 1 source file to C:\dev\cvs.dev.java.net\svgsalamander\classes
run-selected-files:
java.lang.IllegalArgumentException
at java.net.URI.create(URI.java:842)
at java.net.URI.resolve(URI.java:1028)
at com.NewMain.main(NewMain.java:32)
Caused by: java.net.URISyntaxException: Illegal character in opaque part at index 2: C:\svg\test.png
at java.net.URI$Parser.fail(URI.java:2809)
at java.net.URI$Parser.checkChars(URI.java:2982)
at java.net.URI$Parser.parse(URI.java:3019)
at java.net.URI.<init>(URI.java:578)
at java.net.URI.create(URI.java:840)
... 2 more
BUILD SUCCESSFUL (total time: 0 seconds)
REPRODUCIBILITY :
This bug can be reproduced always.
---------- BEGIN SOURCE ----------
/**
*
* @author kitfox
*/
public class NewMain
{
/** Creates a new instance of NewMain */
public NewMain()
{
}
/**
* @param args the command line arguments
*/
public static void main(String[] args)
{
try
{
URI uri = new URI("file:/C:/tmp/imagefade.svg");
String frag = "C:\\svg\\test.png";
URI uri2 = uri.resolve(frag);
System.err.println("" + uri2);
}
catch (Exception e)
{
e.printStackTrace();
}
}
}
---------- END SOURCE ----------
###@###.### 2005-1-21 06:33:14 GMT
java version "1.5.0"
Java(TM) 2 Runtime Environment, Standard Edition (build 1.5.0-b64)
Java HotSpot(TM) Client VM (build 1.5.0-b64, mixed mode)
ADDITIONAL OS VERSION INFORMATION :
Microsoft Windows XP [Version 5.1.2600]
A DESCRIPTION OF THE PROBLEM :
An exception is thrown where one should not be.
STEPS TO FOLLOW TO REPRODUCE THE PROBLEM :
The following code throws an exception:
import java.net.*;
/**
*
* @author kitfox
*/
public class NewMain
{
/** Creates a new instance of NewMain */
public NewMain()
{
}
/**
* @param args the command line arguments
*/
public static void main(String[] args)
{
try
{
URI uri = new URI("file:/C:/tmp/imagefade.svg");
String frag = "C:\\svg\\test.png";
URI uri2 = uri.resolve(frag);
System.err.println("" + uri2);
}
catch (Exception e)
{
e.printStackTrace();
}
}
}
EXPECTED VERSUS ACTUAL BEHAVIOR :
EXPECTED -
uri2 should be set to "c:/svg/test.png"
ERROR MESSAGES/STACK TRACES THAT OCCUR :
init:
javacc:
compile:
Compiling 1 source file to C:\dev\cvs.dev.java.net\svgsalamander\classes
run-selected-files:
java.lang.IllegalArgumentException
at java.net.URI.create(URI.java:842)
at java.net.URI.resolve(URI.java:1028)
at com.NewMain.main(NewMain.java:32)
Caused by: java.net.URISyntaxException: Illegal character in opaque part at index 2: C:\svg\test.png
at java.net.URI$Parser.fail(URI.java:2809)
at java.net.URI$Parser.checkChars(URI.java:2982)
at java.net.URI$Parser.parse(URI.java:3019)
at java.net.URI.<init>(URI.java:578)
at java.net.URI.create(URI.java:840)
... 2 more
BUILD SUCCESSFUL (total time: 0 seconds)
REPRODUCIBILITY :
This bug can be reproduced always.
---------- BEGIN SOURCE ----------
/**
*
* @author kitfox
*/
public class NewMain
{
/** Creates a new instance of NewMain */
public NewMain()
{
}
/**
* @param args the command line arguments
*/
public static void main(String[] args)
{
try
{
URI uri = new URI("file:/C:/tmp/imagefade.svg");
String frag = "C:\\svg\\test.png";
URI uri2 = uri.resolve(frag);
System.err.println("" + uri2);
}
catch (Exception e)
{
e.printStackTrace();
}
}
}
---------- END SOURCE ----------
###@###.### 2005-1-21 06:33:14 GMT
- relates to
-
JDK-8215008 Clear confusion between URL/URI paths and file system paths
-
- Resolved
-