导航菜单

页面标题

页面副标题

小柿子 v1.3.8 - d.java 源代码

正在查看: 小柿子 v1.3.8 应用的 d.java JAVA 源代码文件

本页面展示 JAVA 反编译生成的源代码文件,支持语法高亮显示。 仅供安全研究与技术分析使用,严禁用于任何非法用途。请遵守相关法律法规。


package c6;

import e6.g;
import e6.n;
import java.io.StringReader;
import java.net.URI;
import java.net.URL;
import java.util.logging.Logger;
import javax.xml.parsers.DocumentBuilder;
import javax.xml.parsers.DocumentBuilderFactory;
import k6.i;
import k6.k;
import k6.l;
import org.fourthline.cling.binding.xml.Descriptor$Device$ELEMENT;
import org.fourthline.cling.binding.xml.DescriptorBindingException;
import org.fourthline.cling.model.ValidationException;
import org.fourthline.cling.model.types.DLNADoc;
import org.fourthline.cling.model.types.InvalidValueException;
import org.fourthline.cling.model.types.h;
import org.fourthline.cling.model.types.r;
import org.fourthline.cling.model.types.s;
import org.fourthline.cling.model.types.z;
import org.w3c.dom.Document;
import org.w3c.dom.Element;
import org.w3c.dom.Node;
import org.w3c.dom.NodeList;
import org.xml.sax.ErrorHandler;
import org.xml.sax.InputSource;
import org.xml.sax.SAXException;
import org.xml.sax.SAXParseException;

public class d implements a, ErrorHandler {
    public static Logger a = Logger.getLogger(a.class.getName());

    public static URI r(String str) {
        if (str.startsWith("www.")) {
            str = "http://" + str;
        }
        if (str.contains(" ")) {
            str = str.replaceAll(" ", "%20");
        }
        try {
            return URI.create(str);
        } catch (Throwable th) {
            a.fine("Illegal URI, trying with ./ prefix: " + org.seamless.util.a.a(th));
            try {
                return URI.create("./" + str);
            } catch (IllegalArgumentException e) {
                a.warning("Illegal URI '" + str + "', ignoring value: " + org.seamless.util.a.a(e));
                return null;
            }
        }
    }

    @Override
    public <D extends k6.a> D a(D d, String str) throws DescriptorBindingException, ValidationException {
        if (str == null || str.length() == 0) {
            throw new DescriptorBindingException("Null or empty descriptor");
        }
        try {
            a.fine("Populating device from XML descriptor: " + d);
            DocumentBuilderFactory newInstance = DocumentBuilderFactory.newInstance();
            newInstance.setNamespaceAware(true);
            DocumentBuilder newDocumentBuilder = newInstance.newDocumentBuilder();
            newDocumentBuilder.setErrorHandler(this);
            return (D) e(d, newDocumentBuilder.parse(new InputSource(new StringReader(str.trim()))));
        } catch (ValidationException e) {
            throw e;
        } catch (Exception e2) {
            throw new DescriptorBindingException("Could not parse device descriptor: " + e2.toString(), e2);
        }
    }

    @Override
    public String b(k6.a aVar, l6.c cVar, g gVar) throws DescriptorBindingException {
        try {
            a.fine("Generating XML descriptor from device model: " + aVar);
            return n.h(c(aVar, cVar, gVar));
        } catch (Exception e) {
            throw new DescriptorBindingException("Could not build DOM: " + e.getMessage(), e);
        }
    }

    public Document c(k6.a aVar, l6.c cVar, g gVar) throws DescriptorBindingException {
        try {
            a.fine("Generating DOM from device model: " + aVar);
            DocumentBuilderFactory newInstance = DocumentBuilderFactory.newInstance();
            newInstance.setNamespaceAware(true);
            Document newDocument = newInstance.newDocumentBuilder().newDocument();
            i(gVar, aVar, newDocument, cVar);
            return newDocument;
        } catch (Exception e) {
            throw new DescriptorBindingException("Could not generate device descriptor: " + e.getMessage(), e);
        }
    }

    public <D extends k6.a> D d(D d, b6.d dVar) throws ValidationException {
        return (D) dVar.a(d);
    }

    public <D extends k6.a> D e(D d, Document document) throws DescriptorBindingException, ValidationException {
        try {
            a.fine("Populating device from DOM: " + d);
            b6.d dVar = new b6.d();
            o(dVar, document.getDocumentElement());
            return (D) d(d, dVar);
        } catch (ValidationException e) {
            throw e;
        } catch (Exception e2) {
            throw new DescriptorBindingException("Could not parse device DOM: " + e2.toString(), e2);
        }
    }

    @Override
    public void error(SAXParseException sAXParseException) throws SAXException {
        throw sAXParseException;
    }

    public void f(g gVar, k6.a aVar, Document document, Element element, l6.c cVar) {
        Element a2 = n.a(document, element, Descriptor$Device$ELEMENT.device);
        n.e(document, a2, Descriptor$Device$ELEMENT.deviceType, aVar.getType());
        k6.b n = aVar.n(cVar);
        n.e(document, a2, Descriptor$Device$ELEMENT.friendlyName, n.d());
        if (n.e() != null) {
            n.e(document, a2, Descriptor$Device$ELEMENT.manufacturer, n.e().a());
            n.e(document, a2, Descriptor$Device$ELEMENT.manufacturerURL, n.e().b());
        }
        if (n.f() != null) {
            n.e(document, a2, Descriptor$Device$ELEMENT.modelDescription, n.f().a());
            n.e(document, a2, Descriptor$Device$ELEMENT.modelName, n.f().b());
            n.e(document, a2, Descriptor$Device$ELEMENT.modelNumber, n.f().c());
            n.e(document, a2, Descriptor$Device$ELEMENT.modelURL, n.f().d());
        }
        n.e(document, a2, Descriptor$Device$ELEMENT.serialNumber, n.i());
        n.e(document, a2, Descriptor$Device$ELEMENT.UDN, aVar.r().b());
        n.e(document, a2, Descriptor$Device$ELEMENT.presentationURL, n.g());
        n.e(document, a2, Descriptor$Device$ELEMENT.UPC, n.j());
        if (n.c() != null) {
            for (DLNADoc dLNADoc : n.c()) {
                n.g(document, a2, "dlna:" + Descriptor$Device$ELEMENT.X_DLNADOC, dLNADoc, "urn:schemas-dlna-org:device-1-0");
            }
        }
        n.g(document, a2, "dlna:" + Descriptor$Device$ELEMENT.X_DLNACAP, n.b(), "urn:schemas-dlna-org:device-1-0");
        n.g(document, a2, "sec:" + Descriptor$Device$ELEMENT.ProductCap, n.h(), "http://www.sec.co.kr/dlna");
        n.g(document, a2, "sec:" + Descriptor$Device$ELEMENT.X_ProductCap, n.h(), "http://www.sec.co.kr/dlna");
        h(gVar, aVar, document, a2);
        j(gVar, aVar, document, a2);
        g(gVar, aVar, document, a2, cVar);
    }

    @Override
    public void fatalError(SAXParseException sAXParseException) throws SAXException {
        throw sAXParseException;
    }

    public void g(g gVar, k6.a aVar, Document document, Element element, l6.c cVar) {
        if (aVar.w()) {
            Element a2 = n.a(document, element, Descriptor$Device$ELEMENT.deviceList);
            for (k6.a aVar2 : aVar.p()) {
                f(gVar, aVar2, document, a2, cVar);
            }
        }
    }

    public void h(g gVar, k6.a aVar, Document document, Element element) {
        if (aVar.x()) {
            Element a2 = n.a(document, element, Descriptor$Device$ELEMENT.iconList);
            for (k6.d dVar : aVar.q()) {
                Element a3 = n.a(document, a2, Descriptor$Device$ELEMENT.icon);
                n.e(document, a3, Descriptor$Device$ELEMENT.mimetype, dVar.f());
                n.e(document, a3, Descriptor$Device$ELEMENT.width, Integer.valueOf(dVar.h()));
                n.e(document, a3, Descriptor$Device$ELEMENT.height, Integer.valueOf(dVar.e()));
                n.e(document, a3, Descriptor$Device$ELEMENT.depth, Integer.valueOf(dVar.c()));
                if (aVar instanceof i) {
                    n.e(document, a3, Descriptor$Device$ELEMENT.url, dVar.g());
                } else if (aVar instanceof k6.e) {
                    n.e(document, a3, Descriptor$Device$ELEMENT.url, gVar.j(dVar));
                }
            }
        }
    }

    public void i(g gVar, k6.a aVar, Document document, l6.c cVar) {
        Element createElementNS = document.createElementNS("urn:schemas-upnp-org:device-1-0", Descriptor$Device$ELEMENT.root.toString());
        document.appendChild(createElementNS);
        k(gVar, aVar, document, createElementNS);
        f(gVar, aVar, document, createElementNS, cVar);
    }

    public void j(g gVar, k6.a aVar, Document document, Element element) {
        if (aVar.y()) {
            Element a2 = n.a(document, element, Descriptor$Device$ELEMENT.serviceList);
            for (l lVar : aVar.u()) {
                Element a3 = n.a(document, a2, Descriptor$Device$ELEMENT.service);
                n.e(document, a3, Descriptor$Device$ELEMENT.serviceType, lVar.g());
                n.e(document, a3, Descriptor$Device$ELEMENT.serviceId, lVar.f());
                if (lVar instanceof k) {
                    k kVar = (k) lVar;
                    n.e(document, a3, Descriptor$Device$ELEMENT.SCPDURL, kVar.o());
                    n.e(document, a3, Descriptor$Device$ELEMENT.controlURL, kVar.n());
                    n.e(document, a3, Descriptor$Device$ELEMENT.eventSubURL, kVar.p());
                } else if (lVar instanceof k6.f) {
                    k6.f fVar = (k6.f) lVar;
                    n.e(document, a3, Descriptor$Device$ELEMENT.SCPDURL, gVar.e(fVar));
                    n.e(document, a3, Descriptor$Device$ELEMENT.controlURL, gVar.c(fVar));
                    n.e(document, a3, Descriptor$Device$ELEMENT.eventSubURL, gVar.i(fVar));
                }
            }
        }
    }

    public void k(g gVar, k6.a aVar, Document document, Element element) {
        Element a2 = n.a(document, element, Descriptor$Device$ELEMENT.specVersion);
        n.e(document, a2, Descriptor$Device$ELEMENT.major, Integer.valueOf(aVar.v().a()));
        n.e(document, a2, Descriptor$Device$ELEMENT.minor, Integer.valueOf(aVar.v().b()));
    }

    public void l(b6.d dVar, Node node) throws DescriptorBindingException {
        NodeList childNodes = node.getChildNodes();
        for (int i = 0; i < childNodes.getLength(); i++) {
            Node item = childNodes.item(i);
            if (item.getNodeType() == 1) {
                if (Descriptor$Device$ELEMENT.deviceType.equals(item)) {
                    dVar.d = n.l(item);
                } else if (Descriptor$Device$ELEMENT.friendlyName.equals(item)) {
                    dVar.e = n.l(item);
                } else if (Descriptor$Device$ELEMENT.manufacturer.equals(item)) {
                    dVar.f = n.l(item);
                } else if (Descriptor$Device$ELEMENT.manufacturerURL.equals(item)) {
                    dVar.g = r(n.l(item));
                } else if (Descriptor$Device$ELEMENT.modelDescription.equals(item)) {
                    dVar.i = n.l(item);
                } else if (Descriptor$Device$ELEMENT.modelName.equals(item)) {
                    dVar.h = n.l(item);
                } else if (Descriptor$Device$ELEMENT.modelNumber.equals(item)) {
                    dVar.j = n.l(item);
                } else if (Descriptor$Device$ELEMENT.modelURL.equals(item)) {
                    dVar.k = r(n.l(item));
                } else if (Descriptor$Device$ELEMENT.presentationURL.equals(item)) {
                    dVar.n = r(n.l(item));
                } else if (Descriptor$Device$ELEMENT.UPC.equals(item)) {
                    dVar.m = n.l(item);
                } else if (Descriptor$Device$ELEMENT.serialNumber.equals(item)) {
                    dVar.l = n.l(item);
                } else if (Descriptor$Device$ELEMENT.UDN.equals(item)) {
                    dVar.a = z.b(n.l(item));
                } else if (Descriptor$Device$ELEMENT.iconList.equals(item)) {
                    n(dVar, item);
                } else if (Descriptor$Device$ELEMENT.serviceList.equals(item)) {
                    p(dVar, item);
                } else if (Descriptor$Device$ELEMENT.deviceList.equals(item)) {
                    m(dVar, item);
                } else if (Descriptor$Device$ELEMENT.X_DLNADOC.equals(item) && "dlna".equals(item.getPrefix())) {
                    String l = n.l(item);
                    try {
                        dVar.o.add(DLNADoc.c(l));
                    } catch (InvalidValueException unused) {
                        a.info("Invalid X_DLNADOC value, ignoring value: " + l);
                    }
                } else if (Descriptor$Device$ELEMENT.X_DLNACAP.equals(item) && "dlna".equals(item.getPrefix())) {
                    dVar.p = h.b(n.l(item));
                }
            }
        }
    }

    public void m(b6.d dVar, Node node) throws DescriptorBindingException {
        NodeList childNodes = node.getChildNodes();
        for (int i = 0; i < childNodes.getLength(); i++) {
            Node item = childNodes.item(i);
            if (item.getNodeType() == 1 && Descriptor$Device$ELEMENT.device.equals(item)) {
                b6.d dVar2 = new b6.d();
                dVar2.t = dVar;
                dVar.s.add(dVar2);
                l(dVar2, item);
            }
        }
    }

    public void n(b6.d dVar, Node node) throws DescriptorBindingException {
        NodeList childNodes = node.getChildNodes();
        for (int i = 0; i < childNodes.getLength(); i++) {
            Node item = childNodes.item(i);
            if (item.getNodeType() == 1 && Descriptor$Device$ELEMENT.icon.equals(item)) {
                b6.e eVar = new b6.e();
                NodeList childNodes2 = item.getChildNodes();
                for (int i2 = 0; i2 < childNodes2.getLength(); i2++) {
                    Node item2 = childNodes2.item(i2);
                    if (item2.getNodeType() == 1) {
                        if (Descriptor$Device$ELEMENT.width.equals(item2)) {
                            eVar.b = Integer.valueOf(n.l(item2)).intValue();
                        } else if (Descriptor$Device$ELEMENT.height.equals(item2)) {
                            eVar.c = Integer.valueOf(n.l(item2)).intValue();
                        } else if (Descriptor$Device$ELEMENT.depth.equals(item2)) {
                            String l = n.l(item2);
                            try {
                                eVar.d = Integer.valueOf(l).intValue();
                            } catch (NumberFormatException e) {
                                a.warning("Invalid icon depth '" + l + "', using 16 as default: " + e);
                                eVar.d = 16;
                            }
                        } else if (Descriptor$Device$ELEMENT.url.equals(item2)) {
                            eVar.e = r(n.l(item2));
                        } else if (Descriptor$Device$ELEMENT.mimetype.equals(item2)) {
                            try {
                                String l2 = n.l(item2);
                                eVar.a = l2;
                                org.seamless.util.c.f(l2);
                            } catch (IllegalArgumentException unused) {
                                a.warning("Ignoring invalid icon mime type: " + eVar.a);
                                eVar.a = "";
                            }
                        }
                    }
                }
                dVar.f2q.add(eVar);
            }
        }
    }

    public void o(b6.d dVar, Element element) throws DescriptorBindingException {
        if (element.getNamespaceURI() == null || !element.getNamespaceURI().equals("urn:schemas-upnp-org:device-1-0")) {
            a.warning("Wrong XML namespace declared on root element: " + element.getNamespaceURI());
        }
        if (!element.getNodeName().equals(Descriptor$Device$ELEMENT.root.name())) {
            throw new DescriptorBindingException("Root element name is not <root>: " + element.getNodeName());
        }
        NodeList childNodes = element.getChildNodes();
        Node node = null;
        for (int i = 0; i < childNodes.getLength(); i++) {
            Node item = childNodes.item(i);
            if (item.getNodeType() == 1) {
                if (Descriptor$Device$ELEMENT.specVersion.equals(item)) {
                    q(dVar, item);
                } else if (Descriptor$Device$ELEMENT.URLBase.equals(item)) {
                    try {
                        String l = n.l(item);
                        if (l != null && l.length() > 0) {
                            dVar.c = new URL(l);
                        }
                    } catch (Exception e) {
                        throw new DescriptorBindingException("Invalid URLBase: " + e.getMessage());
                    }
                } else if (!Descriptor$Device$ELEMENT.device.equals(item)) {
                    a.finer("Ignoring unknown element: " + item.getNodeName());
                } else {
                    if (node != null) {
                        throw new DescriptorBindingException("Found multiple <device> elements in <root>");
                    }
                    node = item;
                }
            }
        }
        if (node == null) {
            throw new DescriptorBindingException("No <device> element in <root>");
        }
        l(dVar, node);
    }

    public void p(b6.d dVar, Node node) throws DescriptorBindingException {
        NodeList childNodes = node.getChildNodes();
        for (int i = 0; i < childNodes.getLength(); i++) {
            Node item = childNodes.item(i);
            if (item.getNodeType() == 1 && Descriptor$Device$ELEMENT.service.equals(item)) {
                NodeList childNodes2 = item.getChildNodes();
                try {
                    b6.f fVar = new b6.f();
                    for (int i2 = 0; i2 < childNodes2.getLength(); i2++) {
                        Node item2 = childNodes2.item(i2);
                        if (item2.getNodeType() == 1) {
                            if (Descriptor$Device$ELEMENT.serviceType.equals(item2)) {
                                fVar.a = s.d(n.l(item2));
                            } else if (Descriptor$Device$ELEMENT.serviceId.equals(item2)) {
                                fVar.b = r.c(n.l(item2));
                            } else if (Descriptor$Device$ELEMENT.SCPDURL.equals(item2)) {
                                fVar.c = r(n.l(item2));
                            } else if (Descriptor$Device$ELEMENT.controlURL.equals(item2)) {
                                fVar.d = r(n.l(item2));
                            } else if (Descriptor$Device$ELEMENT.eventSubURL.equals(item2)) {
                                fVar.e = r(n.l(item2));
                            }
                        }
                    }
                    dVar.r.add(fVar);
                } catch (InvalidValueException e) {
                    a.warning("UPnP specification violation, skipping invalid service declaration. " + e.getMessage());
                }
            }
        }
    }

    public void q(b6.d dVar, Node node) throws DescriptorBindingException {
        NodeList childNodes = node.getChildNodes();
        for (int i = 0; i < childNodes.getLength(); i++) {
            Node item = childNodes.item(i);
            if (item.getNodeType() == 1) {
                if (Descriptor$Device$ELEMENT.major.equals(item)) {
                    String trim = n.l(item).trim();
                    if (!trim.equals("1")) {
                        a.warning("Unsupported UDA major version, ignoring: " + trim);
                        trim = "1";
                    }
                    dVar.b.a = Integer.valueOf(trim).intValue();
                } else if (Descriptor$Device$ELEMENT.minor.equals(item)) {
                    String trim2 = n.l(item).trim();
                    if (!trim2.equals("0")) {
                        a.warning("Unsupported UDA minor version, ignoring: " + trim2);
                        trim2 = "0";
                    }
                    dVar.b.b = Integer.valueOf(trim2).intValue();
                }
            }
        }
    }

    @Override
    public void warning(SAXParseException sAXParseException) throws SAXException {
        a.warning(sAXParseException.toString());
    }
}