harmony-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From py...@apache.org
Subject svn commit: r433515 - in /incubator/harmony/enhanced/classlib/trunk/modules/luni/src: main/java/java/net/URLEncoder.java test/java/org/apache/harmony/tests/java/net/URLEncoderTest.java
Date Tue, 22 Aug 2006 04:53:15 GMT
Author: pyang
Date: Mon Aug 21 21:53:15 2006
New Revision: 433515

URL: http://svn.apache.org/viewvc?rev=433515&view=rev
Log:
Patch applied for HARMONY-1233 ([classlib][net] compatibility: URLEncoder.encode(null, "harmony")
throws NPE on RI and UnsupportedEncodingException on Harmony)

Modified:
    incubator/harmony/enhanced/classlib/trunk/modules/luni/src/main/java/java/net/URLEncoder.java
    incubator/harmony/enhanced/classlib/trunk/modules/luni/src/test/java/org/apache/harmony/tests/java/net/URLEncoderTest.java

Modified: incubator/harmony/enhanced/classlib/trunk/modules/luni/src/main/java/java/net/URLEncoder.java
URL: http://svn.apache.org/viewvc/incubator/harmony/enhanced/classlib/trunk/modules/luni/src/main/java/java/net/URLEncoder.java?rev=433515&r1=433514&r2=433515&view=diff
==============================================================================
--- incubator/harmony/enhanced/classlib/trunk/modules/luni/src/main/java/java/net/URLEncoder.java
(original)
+++ incubator/harmony/enhanced/classlib/trunk/modules/luni/src/main/java/java/net/URLEncoder.java
Mon Aug 21 21:53:15 2006
@@ -91,7 +91,7 @@
 	 */
 	public static String encode(String s, String enc)
 			throws UnsupportedEncodingException {
-		if (enc == null) {
+		if (s == null || enc == null) {
 			throw new NullPointerException();
 		}
 		// check for UnsupportedEncodingException

Modified: incubator/harmony/enhanced/classlib/trunk/modules/luni/src/test/java/org/apache/harmony/tests/java/net/URLEncoderTest.java
URL: http://svn.apache.org/viewvc/incubator/harmony/enhanced/classlib/trunk/modules/luni/src/test/java/org/apache/harmony/tests/java/net/URLEncoderTest.java?rev=433515&r1=433514&r2=433515&view=diff
==============================================================================
--- incubator/harmony/enhanced/classlib/trunk/modules/luni/src/test/java/org/apache/harmony/tests/java/net/URLEncoderTest.java
(original)
+++ incubator/harmony/enhanced/classlib/trunk/modules/luni/src/test/java/org/apache/harmony/tests/java/net/URLEncoderTest.java
Mon Aug 21 21:53:15 2006
@@ -25,7 +25,7 @@
 	/**
 	 * @tests URLEncoder#encode(String, String)
 	 */
-	public void test_encodeLjava_lang_StringLjava_lang_String() {
+	public void test_encodeLjava_lang_StringLjava_lang_String() throws Exception {
 		// Regression for HARMONY-24
         try {
             URLEncoder.encode("str","unknown_enc");
@@ -33,5 +33,12 @@
         } catch (UnsupportedEncodingException e) {
             // expected
         } 
+		//Regression for HARMONY-1233
+		try {
+			URLEncoder.encode(null, "harmony");
+			fail("NullPointerException expected");
+		} catch (NullPointerException e) {
+			//expected
+		}
 	}
 }



Mime
View raw message