Skip to content

Commit 822b72e

Browse files
Jesse WilsonAndroid (Google) Code Review
authored andcommitted
Merge "Rename Uri.normalize() to Uri.normalizeScheme()." into jb-dev
2 parents a1dc761 + abc43dd commit 822b72e

File tree

4 files changed

+18
-20
lines changed

4 files changed

+18
-20
lines changed

api/current.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12487,7 +12487,7 @@ package android.net {
1248712487
method public abstract boolean isHierarchical();
1248812488
method public boolean isOpaque();
1248912489
method public abstract boolean isRelative();
12490-
method public android.net.Uri normalize();
12490+
method public android.net.Uri normalizeScheme();
1249112491
method public static android.net.Uri parse(java.lang.String);
1249212492
method public abstract java.lang.String toString();
1249312493
method public static android.net.Uri withAppendedPath(android.net.Uri, java.lang.String);

core/java/android/content/Intent.java

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -4573,7 +4573,7 @@ public Intent setAction(String action) {
45734573
* <p><em>Note: scheme matching in the Android framework is
45744574
* case-sensitive, unlike the formal RFC. As a result,
45754575
* you should always write your Uri with a lower case scheme,
4576-
* or use {@link Uri#normalize} or
4576+
* or use {@link Uri#normalizeScheme} or
45774577
* {@link #setDataAndNormalize}
45784578
* to ensure that the scheme is converted to lower case.</em>
45794579
*
@@ -4599,7 +4599,7 @@ public Intent setData(Uri data) {
45994599
* previously set (for example, by {@link #setType}).
46004600
*
46014601
* <p>The data Uri is normalized using
4602-
* {@link android.net.Uri#normalize} before it is set,
4602+
* {@link android.net.Uri#normalizeScheme} before it is set,
46034603
* so really this is just a convenience method for
46044604
* <pre>
46054605
* setData(data.normalize())
@@ -4612,10 +4612,10 @@ public Intent setData(Uri data) {
46124612
*
46134613
* @see #getData
46144614
* @see #setType
4615-
* @see android.net.Uri#normalize
4615+
* @see android.net.Uri#normalizeScheme
46164616
*/
46174617
public Intent setDataAndNormalize(Uri data) {
4618-
return setData(data.normalize());
4618+
return setData(data.normalizeScheme());
46194619
}
46204620

46214621
/**
@@ -4687,7 +4687,7 @@ public Intent setTypeAndNormalize(String type) {
46874687
* <p><em>Note: MIME type and Uri scheme matching in the
46884688
* Android framework is case-sensitive, unlike the formal RFC definitions.
46894689
* As a result, you should always write these elements with lower case letters,
4690-
* or use {@link #normalizeMimeType} or {@link android.net.Uri#normalize} or
4690+
* or use {@link #normalizeMimeType} or {@link android.net.Uri#normalizeScheme} or
46914691
* {@link #setDataAndTypeAndNormalize}
46924692
* to ensure that they are converted to lower case.</em>
46934693
*
@@ -4700,7 +4700,7 @@ public Intent setTypeAndNormalize(String type) {
47004700
* @see #setType
47014701
* @see #setData
47024702
* @see #normalizeMimeType
4703-
* @see android.net.Uri#normalize
4703+
* @see android.net.Uri#normalizeScheme
47044704
* @see #setDataAndTypeAndNormalize
47054705
*/
47064706
public Intent setDataAndType(Uri data, String type) {
@@ -4716,7 +4716,7 @@ public Intent setDataAndType(Uri data, String type) {
47164716
* data with your own type given here.
47174717
*
47184718
* <p>The data Uri and the MIME type are normalize using
4719-
* {@link android.net.Uri#normalize} and {@link #normalizeMimeType}
4719+
* {@link android.net.Uri#normalizeScheme} and {@link #normalizeMimeType}
47204720
* before they are set, so really this is just a convenience method for
47214721
* <pre>
47224722
* setDataAndType(data.normalize(), Intent.normalizeMimeType(type))
@@ -4732,10 +4732,10 @@ public Intent setDataAndType(Uri data, String type) {
47324732
* @see #setData
47334733
* @see #setDataAndType
47344734
* @see #normalizeMimeType
4735-
* @see android.net.Uri#normalize
4735+
* @see android.net.Uri#normalizeScheme
47364736
*/
47374737
public Intent setDataAndTypeAndNormalize(Uri data, String type) {
4738-
return setDataAndType(data.normalize(), normalizeMimeType(type));
4738+
return setDataAndType(data.normalizeScheme(), normalizeMimeType(type));
47394739
}
47404740

47414741
/**

core/java/android/net/Uri.java

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1718,9 +1718,7 @@ public boolean getBooleanQueryParameter(String key, boolean defaultValue) {
17181718
}
17191719

17201720
/**
1721-
* Return a normalized representation of this Uri.
1722-
*
1723-
* <p>A normalized Uri has a lowercase scheme component.
1721+
* Return an equivalent URI with a lowercase scheme component.
17241722
* This aligns the Uri with Android best practices for
17251723
* intent filtering.
17261724
*
@@ -1740,7 +1738,7 @@ public boolean getBooleanQueryParameter(String key, boolean defaultValue) {
17401738
* @see {@link android.content.Intent#setData}
17411739
* @see {@link #setNormalizedData}
17421740
*/
1743-
public Uri normalize() {
1741+
public Uri normalizeScheme() {
17441742
String scheme = getScheme();
17451743
if (scheme == null) return this; // give up
17461744
String lowerScheme = scheme.toLowerCase(Locale.US);

core/java/android/nfc/NdefRecord.java

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -321,7 +321,7 @@ public static NdefRecord createApplicationRecord(String packageName) {
321321
* and {@link #RTD_URI}. This is the most efficient encoding
322322
* of a URI into NDEF.<p>
323323
* The uri parameter will be normalized with
324-
* {@link Uri#normalize} to set the scheme to lower case to
324+
* {@link Uri#normalizeScheme} to set the scheme to lower case to
325325
* follow Android best practices for intent filtering.
326326
* However the unchecked exception
327327
* {@link IllegalArgumentException} may be thrown if the uri
@@ -338,7 +338,7 @@ public static NdefRecord createApplicationRecord(String packageName) {
338338
public static NdefRecord createUri(Uri uri) {
339339
if (uri == null) throw new NullPointerException("uri is null");
340340

341-
uri = uri.normalize();
341+
uri = uri.normalizeScheme();
342342
String uriString = uri.toString();
343343
if (uriString.length() == 0) throw new IllegalArgumentException("uri is empty");
344344

@@ -364,7 +364,7 @@ public static NdefRecord createUri(Uri uri) {
364364
* and {@link #RTD_URI}. This is the most efficient encoding
365365
* of a URI into NDEF.<p>
366366
* The uriString parameter will be normalized with
367-
* {@link Uri#normalize} to set the scheme to lower case to
367+
* {@link Uri#normalizeScheme} to set the scheme to lower case to
368368
* follow Android best practices for intent filtering.
369369
* However the unchecked exception
370370
* {@link IllegalArgumentException} may be thrown if the uriString
@@ -665,7 +665,7 @@ public String toMimeType() {
665665
* actually valid: it always attempts to create and return a URI if
666666
* this record appears to be a URI record by the above rules.<p>
667667
* The returned URI will be normalized to have a lower case scheme
668-
* using {@link Uri#normalize}.<p>
668+
* using {@link Uri#normalizeScheme}.<p>
669669
*
670670
* @return URI, or null if this is not a URI record
671671
*/
@@ -688,13 +688,13 @@ private Uri toUri(boolean inSmartPoster) {
688688
}
689689
} catch (FormatException e) { }
690690
} else if (Arrays.equals(mType, RTD_URI)) {
691-
return parseWktUri().normalize();
691+
return parseWktUri().normalizeScheme();
692692
}
693693
break;
694694

695695
case TNF_ABSOLUTE_URI:
696696
Uri uri = Uri.parse(new String(mType, Charsets.UTF_8));
697-
return uri.normalize();
697+
return uri.normalizeScheme();
698698

699699
case TNF_EXTERNAL_TYPE:
700700
if (inSmartPoster) {

0 commit comments

Comments
 (0)