Reviewers: tbroyer, jlabanca, jat, pdr, rjrjr,

Description:
Make UriUtils#unsafeCastFromUntrustedString gracefully handle null for
backwards compatibility.


Please review this at http://gwt-code-reviews.appspot.com/1443814/

Affected files:
  M user/src/com/google/gwt/safehtml/shared/UriUtils.java


Index: user/src/com/google/gwt/safehtml/shared/UriUtils.java
===================================================================
--- user/src/com/google/gwt/safehtml/shared/UriUtils.java       (revision 10284)
+++ user/src/com/google/gwt/safehtml/shared/UriUtils.java       (working copy)
@@ -263,7 +263,7 @@
    * safe!</strong>
    *
    * @param s the input String
-   * @return a SafeUri instance
+   * @return a SafeUri instance, or null if <code>s</code> is null
    * @deprecated This method is intended only for use in APIs that use
    *             {@link SafeUri} to represent URIs, but for backwards
* compatibility have methods that accept URI parameters as plain
@@ -271,7 +271,11 @@
    */
   @Deprecated
   public static SafeUri unsafeCastFromUntrustedString(String s) {
-    return new SafeUriString(s);
+    if (s != null) {
+      return new SafeUriString(s);
+    } else {
+      return null;
+    }
   }

   // prevent instantiation


--
http://groups.google.com/group/Google-Web-Toolkit-Contributors

Reply via email to