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
This commit is contained in:
parent
afa5be82d3
commit
21b65721e7
@ -250,13 +250,9 @@ public final class PackagingURIHelper {
|
|||||||
* Combine a string URI with a prefix and a suffix.
|
* Combine a string URI with a prefix and a suffix.
|
||||||
*/
|
*/
|
||||||
public static String combine(String prefix, String suffix) {
|
public static String combine(String prefix, String suffix) {
|
||||||
if (!prefix.endsWith("" + FORWARD_SLASH_CHAR)
|
if (!prefix.endsWith(FORWARD_SLASH_STRING) && !suffix.startsWith(FORWARD_SLASH_STRING))
|
||||||
&& !suffix.startsWith("" + FORWARD_SLASH_CHAR))
|
|
||||||
return prefix + FORWARD_SLASH_CHAR + suffix;
|
return prefix + FORWARD_SLASH_CHAR + suffix;
|
||||||
else if ((!prefix.endsWith("" + FORWARD_SLASH_CHAR)
|
else if (prefix.endsWith(FORWARD_SLASH_STRING) ^ suffix.startsWith(FORWARD_SLASH_STRING))
|
||||||
&& suffix.startsWith("" + FORWARD_SLASH_CHAR) || (prefix
|
|
||||||
.endsWith("" + FORWARD_SLASH_CHAR) && !suffix.startsWith(""
|
|
||||||
+ FORWARD_SLASH_CHAR))))
|
|
||||||
return prefix + suffix;
|
return prefix + suffix;
|
||||||
else
|
else
|
||||||
return "";
|
return "";
|
||||||
|
Loading…
Reference in New Issue
Block a user