You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@harmony.apache.org by hi...@apache.org on 2010/06/08 10:49:45 UTC
svn commit: r952573 - in
/harmony/enhanced/java/trunk/classlib/modules/luni/src:
main/java/java/net/URI.java
test/api/common/org/apache/harmony/luni/tests/java/net/URLTest.java
Author: hindessm
Date: Tue Jun 8 08:49:45 2010
New Revision: 952573
URL: http://svn.apache.org/viewvc?rev=952573&view=rev
Log:
Applied patch from "[#HARMONY-6544] [classlib][luni]Windows file path causes
IllegalArgumentException". Then removed tabs and commented out code.
Modified:
harmony/enhanced/java/trunk/classlib/modules/luni/src/main/java/java/net/URI.java
harmony/enhanced/java/trunk/classlib/modules/luni/src/test/api/common/org/apache/harmony/luni/tests/java/net/URLTest.java
Modified: harmony/enhanced/java/trunk/classlib/modules/luni/src/main/java/java/net/URI.java
URL: http://svn.apache.org/viewvc/harmony/enhanced/java/trunk/classlib/modules/luni/src/main/java/java/net/URI.java?rev=952573&r1=952572&r2=952573&view=diff
==============================================================================
--- harmony/enhanced/java/trunk/classlib/modules/luni/src/main/java/java/net/URI.java (original)
+++ harmony/enhanced/java/trunk/classlib/modules/luni/src/main/java/java/net/URI.java Tue Jun 8 08:49:45 2010
@@ -41,6 +41,8 @@ public final class URI implements Compar
static final String someLegal = unreserved + punct;
+ static final String queryLegal = unreserved + reserved + "\\";
+
static final String allLegal = unreserved + reserved;
private String string;
@@ -453,7 +455,7 @@ public final class URI implements Compar
private void validateQuery(String uri, String query, int index)
throws URISyntaxException {
try {
- 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());
Modified: harmony/enhanced/java/trunk/classlib/modules/luni/src/test/api/common/org/apache/harmony/luni/tests/java/net/URLTest.java
URL: http://svn.apache.org/viewvc/harmony/enhanced/java/trunk/classlib/modules/luni/src/test/api/common/org/apache/harmony/luni/tests/java/net/URLTest.java?rev=952573&r1=952572&r2=952573&view=diff
==============================================================================
--- harmony/enhanced/java/trunk/classlib/modules/luni/src/test/api/common/org/apache/harmony/luni/tests/java/net/URLTest.java (original)
+++ harmony/enhanced/java/trunk/classlib/modules/luni/src/test/api/common/org/apache/harmony/luni/tests/java/net/URLTest.java Tue Jun 8 08:49:45 2010
@@ -21,6 +21,7 @@ import java.io.File;
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 @@ public class URLTest extends TestCase {
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)