Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[sonos] Remove org.apache.common #14438

Merged
merged 3 commits into from
Feb 19, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -14,9 +14,9 @@

import java.io.Serializable;

import org.apache.commons.lang3.StringEscapeUtils;
import org.eclipse.jdt.annotation.NonNullByDefault;
import org.eclipse.jdt.annotation.Nullable;
import org.openhab.binding.sonos.internal.util.StringUtils;

/**
* The {@link SonosEntry} is a datastructure to describe
Expand Down Expand Up @@ -120,7 +120,7 @@ public String getAlbum() {
* @return the URI for the album art.
*/
public String getAlbumArtUri() {
return StringEscapeUtils.unescapeXml(albumArtUri);
return StringUtils.unEscapeXml(albumArtUri);
}

/**
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
/**
* Copyright (c) 2010-2023 Contributors to the openHAB project
*
* See the NOTICE file(s) distributed with this work for additional
* information.
*
* This program and the accompanying materials are made available under the
* terms of the Eclipse Public License 2.0 which is available at
* http://www.eclipse.org/legal/epl-2.0
*
* SPDX-License-Identifier: EPL-2.0
*/
package org.openhab.binding.sonos.internal.util;

/**
* The {@link StringUtils} class defines some static string utility methods
*
* @author Leo Siepel - Initial contribution
*/
public class StringUtils {

/**
* Simple method to un escape XML special characters in String.
* There are five XML Special characters which needs to be escaped :
* & - &
* < - &lt;
* > - &gt;
* " - &quot;
* ' - &apos;
*/
public static String unEscapeXml(String xml) {
xml = xml.replaceAll("&amp;", "&");
xml = xml.replaceAll("&lt;", "<");
xml = xml.replaceAll("&gt;", ">");
xml = xml.replaceAll("&quot;", "\"");
xml = xml.replaceAll("&apos;", "'");
return xml;
}
}