callicoder / spring-security-react-ant-design-polls-app

Full Stack Polls App built using Spring Boot, Spring Security, JWT, React, and Ant Design
https://www.callicoder.com/spring-boot-spring-security-jwt-mysql-react-app-part-1/
1.77k stars 1.07k forks source link

Remove redundant call according to IDEA inspection #30

Open AaricChenLegacy opened 4 years ago

AaricChenLegacy commented 4 years ago

According to IDEA inspection

Call to 'bearerToken.length()' is redundant 

And Java doc of substring(int) can be used for this purpose.

/**
     * Returns a string that is a substring of this string. The
     * substring begins with the character at the specified index and
     * extends to the end of this string. <p>
     * Examples:
     * <blockquote><pre>
     * "unhappy".substring(2) returns "happy"
     * "Harbison".substring(3) returns "bison"
     * "emptiness".substring(9) returns "" (an empty string)
     * </pre></blockquote>
     *
     * @param      beginIndex   the beginning index, inclusive.
     * @return     the specified substring.
     * @exception  IndexOutOfBoundsException  if
     *             {@code beginIndex} is negative or larger than the
     *             length of this {@code String} object.
     */
    public String substring(int beginIndex)