Index: classlib/modules/luni/src/test/api/common/org/apache/harmony/luni/tests/java/net/URLTest.java =================================================================== --- classlib/modules/luni/src/test/api/common/org/apache/harmony/luni/tests/java/net/URLTest.java (版本 951323) +++ classlib/modules/luni/src/test/api/common/org/apache/harmony/luni/tests/java/net/URLTest.java (工作副本) @@ -21,6 +21,7 @@ import java.io.FileOutputStream; import java.io.IOException; import java.io.InputStream; +import java.net.HttpURLConnection; import java.net.InetAddress; import java.net.InetSocketAddress; import java.net.MalformedURLException; @@ -68,6 +69,35 @@ boolean caught = false; static boolean isSelectCalled; + + + /** + * Check when the argument in url consists of windows path character back-slach + * @tests java.net.URL#openConnection(Proxy) + * @throws Exception + */ + public void test_openConnection_windows_path_character() throws Exception { + int port = 0; + HttpURLConnection con = null; + try { + port = Support_Jetty.startDefaultHttpServer(); + } catch (Exception e) { + fail("Exception during setup jetty : " + e.getMessage()); + } + try { + URL url = new URL("http://0.0.0.0:" + port + "/servlet?ResourceName=C:\\temp\\test.txt"); + con = (HttpURLConnection)url.openConnection(); + con.setDoInput(true); + con.setDoOutput(true); + con.setUseCaches(false); + con.setRequestMethod("GET"); + InputStream is = con.getInputStream(); + } catch (Exception e) { + fail("Unexpected exception : " + e.getMessage()); + } finally { + con.disconnect(); + } + } /** * @tests java.net.URL#URL(java.lang.String) Index: classlib/modules/luni/src/main/java/java/net/URI.java =================================================================== --- classlib/modules/luni/src/main/java/java/net/URI.java (版本 951323) +++ classlib/modules/luni/src/main/java/java/net/URI.java (工作副本) @@ -41,7 +41,9 @@ static final String someLegal = unreserved + punct; - static final String allLegal = unreserved + reserved; + static final String queryLegal = unreserved + reserved + "\\"; + + static final String allLegal = unreserved + reserved; private String string; @@ -453,7 +455,8 @@ private void validateQuery(String uri, String query, int index) throws URISyntaxException { try { - URIEncoderDecoder.validate(query, allLegal); + //URIEncoderDecoder.validate(query, allLegal); + URIEncoderDecoder.validate(query, queryLegal); } catch (URISyntaxException e) { throw new URISyntaxException(uri, Messages.getString("luni.89", e //$NON-NLS-1$ .getReason()), index + e.getIndex());