Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 055678b5 authored by Andreas Gampe's avatar Andreas Gampe
Browse files

Frameworks/base: Remove unnecessary Pattern instance

Using a static Pattern in UriMatcher prevents compile-time
initialization.

It is also not efficient, as String.split has a fast path for simple
splits.

Bug: 19542228

Change-Id: Ie9e5bfe6da04c6d05ec10b1426d0cd136ef46ef2
parent e59b7ce2
Loading
Loading
Loading
Loading
+1 −4
Original line number Diff line number Diff line
@@ -20,7 +20,6 @@ import android.net.Uri;

import java.util.ArrayList;
import java.util.List;
import java.util.regex.Pattern;

/**
Utility class to aid in matching URIs in content providers.
@@ -171,7 +170,7 @@ public class UriMatcher
            if (path.length() > 0 && path.charAt(0) == '/') {
                newPath = path.substring(1);
            }
            tokens = PATH_SPLIT_PATTERN.split(newPath);
            tokens = newPath.split("/");
        }

        int numTokens = tokens != null ? tokens.length : 0;
@@ -207,8 +206,6 @@ public class UriMatcher
        node.mCode = code;
    }

    static final Pattern PATH_SPLIT_PATTERN = Pattern.compile("/");

    /**
     * Try to match against the path in a url.
     *