mirror of
https://github.com/openhab/openhab-addons.git
synced 2025-01-25 14:55:55 +01:00
[sonos] Fix remaining org.apache.common (#14450)
Signed-off-by: lsiepel <leosiepel@gmail.com>
This commit is contained in:
parent
77f73345d2
commit
b570a454b0
@ -25,9 +25,9 @@ import java.util.Set;
|
||||
import java.util.regex.Matcher;
|
||||
import java.util.regex.Pattern;
|
||||
|
||||
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;
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
import org.xml.sax.Attributes;
|
||||
@ -1084,7 +1084,7 @@ public class SonosXMLParser {
|
||||
upnpClass = resourceMetaData.getUpnpClass();
|
||||
}
|
||||
|
||||
title = StringEscapeUtils.escapeXml(title);
|
||||
title = StringUtils.escapeXml(title);
|
||||
|
||||
String metadata = METADATA_FORMAT.format(new Object[] { id, parentId, title, upnpClass, desc });
|
||||
|
||||
|
@ -12,13 +12,34 @@
|
||||
*/
|
||||
package org.openhab.binding.sonos.internal.util;
|
||||
|
||||
import org.eclipse.jdt.annotation.NonNullByDefault;
|
||||
|
||||
/**
|
||||
* The {@link StringUtils} class defines some static string utility methods
|
||||
*
|
||||
* @author Leo Siepel - Initial contribution
|
||||
*/
|
||||
@NonNullByDefault
|
||||
public class StringUtils {
|
||||
|
||||
/**
|
||||
* Simple method to escape XML special characters in String.
|
||||
* There are five XML Special characters which needs to be escaped :
|
||||
* & - &
|
||||
* < - <
|
||||
* > - >
|
||||
* " - "
|
||||
* ' - '
|
||||
*/
|
||||
public static String escapeXml(String xml) {
|
||||
xml = xml.replaceAll("&", "&");
|
||||
xml = xml.replaceAll("<", "<");
|
||||
xml = xml.replaceAll(">", ">");
|
||||
xml = xml.replaceAll("\"", """);
|
||||
xml = xml.replaceAll("'", "'");
|
||||
return xml;
|
||||
}
|
||||
|
||||
/**
|
||||
* Simple method to un escape XML special characters in String.
|
||||
* There are five XML Special characters which needs to be escaped :
|
||||
|
Loading…
Reference in New Issue
Block a user