]> source.dussan.org Git - poi.git/commitdiff
simplfy PackagingURIHelper#combine boolean logic using xor and replacing +FORWARD_SLA...
authorJaven O'Neal <onealj@apache.org>
Wed, 18 Oct 2017 08:10:36 +0000 (08:10 +0000)
committerJaven O'Neal <onealj@apache.org>
Wed, 18 Oct 2017 08:10:36 +0000 (08:10 +0000)
git-svn-id: https://svn.apache.org/repos/asf/poi/trunk@1812468 13f79535-47bb-0310-9956-ffa450edef68

src/ooxml/java/org/apache/poi/openxml4j/opc/PackagingURIHelper.java

index fc745a6c515c9066a4fca70a09e9625d6804a3e4..397e579ab31dc98fe95829554d8ec672dca66af8 100644 (file)
@@ -250,13 +250,9 @@ public final class PackagingURIHelper {
         * Combine a string URI with a prefix and a suffix.
         */
        public static String combine(String prefix, String suffix) {
-               if (!prefix.endsWith("" + FORWARD_SLASH_CHAR)
-                               && !suffix.startsWith("" + FORWARD_SLASH_CHAR))
+               if (!prefix.endsWith(FORWARD_SLASH_STRING) && !suffix.startsWith(FORWARD_SLASH_STRING))
                        return prefix + FORWARD_SLASH_CHAR + suffix;
-               else if ((!prefix.endsWith("" + FORWARD_SLASH_CHAR)
-                               && suffix.startsWith("" + FORWARD_SLASH_CHAR) || (prefix
-                               .endsWith("" + FORWARD_SLASH_CHAR) && !suffix.startsWith(""
-                               + FORWARD_SLASH_CHAR))))
+               else if (prefix.endsWith(FORWARD_SLASH_STRING) ^ suffix.startsWith(FORWARD_SLASH_STRING))
                        return prefix + suffix;
                else
                        return "";