From 21b65721e7171dea64d29540e764892aa6f81315 Mon Sep 17 00:00:00 2001 From: Javen O'Neal Date: Wed, 18 Oct 2017 08:10:36 +0000 Subject: [PATCH] simplfy PackagingURIHelper#combine boolean logic using xor and replacing +FORWARD_SLASH_CHAR with FORWARD_SLASH_STRING git-svn-id: https://svn.apache.org/repos/asf/poi/trunk@1812468 13f79535-47bb-0310-9956-ffa450edef68 --- .../org/apache/poi/openxml4j/opc/PackagingURIHelper.java | 8 ++------ 1 file changed, 2 insertions(+), 6 deletions(-) diff --git a/src/ooxml/java/org/apache/poi/openxml4j/opc/PackagingURIHelper.java b/src/ooxml/java/org/apache/poi/openxml4j/opc/PackagingURIHelper.java index fc745a6c5..397e579ab 100644 --- a/src/ooxml/java/org/apache/poi/openxml4j/opc/PackagingURIHelper.java +++ b/src/ooxml/java/org/apache/poi/openxml4j/opc/PackagingURIHelper.java @@ -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 "";