]> git.basschouten.com Git - openhab-addons.git/commitdiff
[sonos] Remove org.apache.common (#14438)
authorlsiepel <leosiepel@gmail.com>
Sun, 19 Feb 2023 19:43:01 +0000 (20:43 +0100)
committerGitHub <noreply@github.com>
Sun, 19 Feb 2023 19:43:01 +0000 (20:43 +0100)
Signed-off-by: lsiepel <leosiepel@gmail.com>
bundles/org.openhab.binding.sonos/src/main/java/org/openhab/binding/sonos/internal/SonosEntry.java
bundles/org.openhab.binding.sonos/src/main/java/org/openhab/binding/sonos/internal/util/StringUtils.java [new file with mode: 0644]

index e950b90f3591d07c11f1cc84f3d2e4f24e9aa661..6acea10587e795552d49815dc6cb68e6ade8b800 100644 (file)
@@ -14,9 +14,9 @@ package org.openhab.binding.sonos.internal;
 
 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
@@ -120,7 +120,7 @@ public class SonosEntry implements Serializable {
      * @return the URI for the album art.
      */
     public String getAlbumArtUri() {
-        return StringEscapeUtils.unescapeXml(albumArtUri);
+        return StringUtils.unEscapeXml(albumArtUri);
     }
 
     /**
diff --git a/bundles/org.openhab.binding.sonos/src/main/java/org/openhab/binding/sonos/internal/util/StringUtils.java b/bundles/org.openhab.binding.sonos/src/main/java/org/openhab/binding/sonos/internal/util/StringUtils.java
new file mode 100644 (file)
index 0000000..4127a3d
--- /dev/null
@@ -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 :
+     * & - &amp;
+     * < - &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;
+    }
+}