text:
.class public Lcom/sun/org/apache/xml/internal/security/signature/SignedInfo;
.super Lcom/sun/org/apache/xml/internal/security/signature/Manifest;

# instance fields
.field private _c14nizedBytes:[B

.field private _signatureAlgorithm:Lcom/sun/org/apache/xml/internal/security/algorithms/SignatureAlgorithm;

# direct methods
.method public constructor <init>(Lorg/w3c/dom/Document;)V
    .locals 2
    .annotation system Ldalvik/annotation/Throws;
        value = {
            Lcom/sun/org/apache/xml/internal/security/exceptions/XMLSecurityException;
        }
    .end annotation

    const-string/jumbo v0, "http://www.w3.org/2000/09/xmldsig#dsa-sha1"

    const-string/jumbo v1, "http://www.w3.org/TR/2001/REC-xml-c14n-20010315"

    invoke-direct {p0, p1, v0, v1}, Lcom/sun/org/apache/xml/internal/security/signature/SignedInfo;-><init>(Lorg/w3c/dom/Document;Ljava/lang/String;Ljava/lang/String;)V

    return-void
.end method

.method public constructor <init>(Lorg/w3c/dom/Document;Ljava/lang/String;ILjava/lang/String;)V
    .locals 4
    .annotation system Ldalvik/annotation/Throws;
        value = {
            Lcom/sun/org/apache/xml/internal/security/exceptions/XMLSecurityException;
        }
    .end annotation

    const/4 v3, 0x0

    invoke-direct {p0, p1}, Lcom/sun/org/apache/xml/internal/security/signature/Manifest;-><init>(Lorg/w3c/dom/Document;)V

    iput-object v3, p0, Lcom/sun/org/apache/xml/internal/security/signature/SignedInfo;->_signatureAlgorithm:Lcom/sun/org/apache/xml/internal/security/algorithms/SignatureAlgorithm;

    iput-object v3, p0, Lcom/sun/org/apache/xml/internal/security/signature/SignedInfo;->_c14nizedBytes:[B

    iget-object v1, p0, Lcom/sun/org/apache/xml/internal/security/utils/ElementProxy;->_doc:Lorg/w3c/dom/Document;

    const-string/jumbo v2, "CanonicalizationMethod"

    invoke-static {v1, v2}, Lcom/sun/org/apache/xml/internal/security/utils/XMLUtils;->createElementInSignatureSpace(Lorg/w3c/dom/Document;Ljava/lang/String;)Lorg/w3c/dom/Element;

    move-result-object v0

    const-string/jumbo v1, "Algorithm"

    invoke-interface {v0, v3, v1, p4}, Lorg/w3c/dom/Element;->setAttributeNS(Ljava/lang/String;Ljava/lang/String;Ljava/lang/String;)V

    iget-object v1, p0, Lcom/sun/org/apache/xml/internal/security/utils/ElementProxy;->_constructionElement:Lorg/w3c/dom/Element;

    invoke-interface {v1, v0}, Lorg/w3c/dom/Node;->appendChild(Lorg/w3c/dom/Node;)Lorg/w3c/dom/Node;

    iget-object v1, p0, Lcom/sun/org/apache/xml/internal/security/utils/ElementProxy;->_constructionElement:Lorg/w3c/dom/Element;

    invoke-static {v1}, Lcom/sun/org/apache/xml/internal/security/utils/XMLUtils;->addReturnToElement(Lorg/w3c/dom/Element;)V

    if-gtz p3, :cond_0

    new-instance v1, Lcom/sun/org/apache/xml/internal/security/algorithms/SignatureAlgorithm;

    iget-object v2, p0, Lcom/sun/org/apache/xml/internal/security/utils/ElementProxy;->_doc:Lorg/w3c/dom/Document;

    invoke-direct {v1, v2, p2}, Lcom/sun/org/apache/xml/internal/security/algorithms/SignatureAlgorithm;-><init>(Lorg/w3c/dom/Document;Ljava/lang/String;)V

    :goto_0
    iput-object v1, p0, Lcom/sun/org/apache/xml/internal/security/signature/SignedInfo;->_signatureAlgorithm:Lcom/sun/org/apache/xml/internal/security/algorithms/SignatureAlgorithm;

    iget-object v1, p0, Lcom/sun/org/apache/xml/internal/security/utils/ElementProxy;->_constructionElement:Lorg/w3c/dom/Element;

    iget-object v2, p0, Lcom/sun/org/apache/xml/internal/security/signature/SignedInfo;->_signatureAlgorithm:Lcom/sun/org/apache/xml/internal/security/algorithms/SignatureAlgorithm;

    invoke-virtual {v2}, Lcom/sun/org/apache/xml/internal/security/utils/ElementProxy;->getElement()Lorg/w3c/dom/Element;

    move-result-object v2

    invoke-interface {v1, v2}, Lorg/w3c/dom/Node;->appendChild(Lorg/w3c/dom/Node;)Lorg/w3c/dom/Node;

    iget-object v1, p0, Lcom/sun/org/apache/xml/internal/security/utils/ElementProxy;->_constructionElement:Lorg/w3c/dom/Element;

    invoke-static {v1}, Lcom/sun/org/apache/xml/internal/security/utils/XMLUtils;->addReturnToElement(Lorg/w3c/dom/Element;)V

    return-void

    :cond_0
    new-instance v1, Lcom/sun/org/apache/xml/internal/security/algorithms/SignatureAlgorithm;

    iget-object v2, p0, Lcom/sun/org/apache/xml/internal/security/utils/ElementProxy;->_doc:Lorg/w3c/dom/Document;

    invoke-direct {v1, v2, p2, p3}, Lcom/sun/org/apache/xml/internal/security/algorithms/SignatureAlgorithm;-><init>(Lorg/w3c/dom/Document;Ljava/lang/String;I)V

    goto :goto_0
.end method

.method public constructor <init>(Lorg/w3c/dom/Document;Ljava/lang/String;Ljava/lang/String;)V
    .locals 1
    .annotation system Ldalvik/annotation/Throws;
        value = {
            Lcom/sun/org/apache/xml/internal/security/exceptions/XMLSecurityException;
        }
    .end annotation

    const/4 v0, 0x0

    invoke-direct {p0, p1, p2, v0, p3}, Lcom/sun/org/apache/xml/internal/security/signature/SignedInfo;-><init>(Lorg/w3c/dom/Document;Ljava/lang/String;ILjava/lang/String;)V

    return-void
.end method

.method public constructor <init>(Lorg/w3c/dom/Document;Lorg/w3c/dom/Element;Lorg/w3c/dom/Element;)V
    .locals 2
    .annotation system Ldalvik/annotation/Throws;
        value = {
            Lcom/sun/org/apache/xml/internal/security/exceptions/XMLSecurityException;
        }
    .end annotation

    const/4 v1, 0x0

    invoke-direct {p0, p1}, Lcom/sun/org/apache/xml/internal/security/signature/Manifest;-><init>(Lorg/w3c/dom/Document;)V

    iput-object v1, p0, Lcom/sun/org/apache/xml/internal/security/signature/SignedInfo;->_signatureAlgorithm:Lcom/sun/org/apache/xml/internal/security/algorithms/SignatureAlgorithm;

    iput-object v1, p0, Lcom/sun/org/apache/xml/internal/security/signature/SignedInfo;->_c14nizedBytes:[B

    iget-object v0, p0, Lcom/sun/org/apache/xml/internal/security/utils/ElementProxy;->_constructionElement:Lorg/w3c/dom/Element;

    invoke-interface {v0, p3}, Lorg/w3c/dom/Node;->appendChild(Lorg/w3c/dom/Node;)Lorg/w3c/dom/Node;

    iget-object v0, p0, Lcom/sun/org/apache/xml/internal/security/utils/ElementProxy;->_constructionElement:Lorg/w3c/dom/Element;

    invoke-static {v0}, Lcom/sun/org/apache/xml/internal/security/utils/XMLUtils;->addReturnToElement(Lorg/w3c/dom/Element;)V

    new-instance v0, Lcom/sun/org/apache/xml/internal/security/algorithms/SignatureAlgorithm;

    invoke-direct {v0, p2, v1}, Lcom/sun/org/apache/xml/internal/security/algorithms/SignatureAlgorithm;-><init>(Lorg/w3c/dom/Element;Ljava/lang/String;)V

    iput-object v0, p0, Lcom/sun/org/apache/xml/internal/security/signature/SignedInfo;->_signatureAlgorithm:Lcom/sun/org/apache/xml/internal/security/algorithms/SignatureAlgorithm;

    iget-object v0, p0, Lcom/sun/org/apache/xml/internal/security/utils/ElementProxy;->_constructionElement:Lorg/w3c/dom/Element;

    iget-object v1, p0, Lcom/sun/org/apache/xml/internal/security/signature/SignedInfo;->_signatureAlgorithm:Lcom/sun/org/apache/xml/internal/security/algorithms/SignatureAlgorithm;

    invoke-virtual {v1}, Lcom/sun/org/apache/xml/internal/security/utils/ElementProxy;->getElement()Lorg/w3c/dom/Element;

    move-result-object v1

    invoke-interface {v0, v1}, Lorg/w3c/dom/Node;->appendChild(Lorg/w3c/dom/Node;)Lorg/w3c/dom/Node;

    iget-object v0, p0, Lcom/sun/org/apache/xml/internal/security/utils/ElementProxy;->_constructionElement:Lorg/w3c/dom/Element;

    invoke-static {v0}, Lcom/sun/org/apache/xml/internal/security/utils/XMLUtils;->addReturnToElement(Lorg/w3c/dom/Element;)V

    return-void
.end method

.method public constructor <init>(Lorg/w3c/dom/Element;Ljava/lang/String;)V
    .locals 9
    .annotation system Ldalvik/annotation/Throws;
        value = {
            Lcom/sun/org/apache/xml/internal/security/exceptions/XMLSecurityException;
        }
    .end annotation

    const/4 v6, 0x0

    invoke-direct {p0, p1, p2}, Lcom/sun/org/apache/xml/internal/security/signature/Manifest;-><init>(Lorg/w3c/dom/Element;Ljava/lang/String;)V

    iput-object v6, p0, Lcom/sun/org/apache/xml/internal/security/signature/SignedInfo;->_signatureAlgorithm:Lcom/sun/org/apache/xml/internal/security/algorithms/SignatureAlgorithm;

    iput-object v6, p0, Lcom/sun/org/apache/xml/internal/security/signature/SignedInfo;->_c14nizedBytes:[B

    invoke-virtual {p0}, Lcom/sun/org/apache/xml/internal/security/signature/SignedInfo;->getCanonicalizationMethodURI()Ljava/lang/String;

    move-result-object v0

    const-string/jumbo v6, "http://www.w3.org/TR/2001/REC-xml-c14n-20010315"

    invoke-virtual {v0, v6}, Ljava/lang/String;->equals(Ljava/lang/Object;)Z

    move-result v6

    if-eqz v6, :cond_1

    :cond_0
    :goto_0
    new-instance v6, Lcom/sun/org/apache/xml/internal/security/algorithms/SignatureAlgorithm;

    invoke-virtual {p0}, Lcom/sun/org/apache/xml/internal/security/signature/SignedInfo;->getSignatureMethodElement()Lorg/w3c/dom/Element;

    move-result-object v7

    invoke-virtual {p0}, Lcom/sun/org/apache/xml/internal/security/utils/ElementProxy;->getBaseURI()Ljava/lang/String;

    move-result-object v8

    invoke-direct {v6, v7, v8}, Lcom/sun/org/apache/xml/internal/security/algorithms/SignatureAlgorithm;-><init>(Lorg/w3c/dom/Element;Ljava/lang/String;)V

    iput-object v6, p0, Lcom/sun/org/apache/xml/internal/security/signature/SignedInfo;->_signatureAlgorithm:Lcom/sun/org/apache/xml/internal/security/algorithms/SignatureAlgorithm;

    return-void

    :cond_1
    const-string/jumbo v6, "http://www.w3.org/TR/2001/REC-xml-c14n-20010315#WithComments"

    invoke-virtual {v0, v6}, Ljava/lang/String;->equals(Ljava/lang/Object;)Z

    move-result v6

    if-nez v6, :cond_0

    const-string/jumbo v6, "http://www.w3.org/2001/10/xml-exc-c14n#"

    invoke-virtual {v0, v6}, Ljava/lang/String;->equals(Ljava/lang/Object;)Z

    move-result v6

    if-nez v6, :cond_0

    const-string/jumbo v6, "http://www.w3.org/2001/10/xml-exc-c14n#WithComments"

    invoke-virtual {v0, v6}, Ljava/lang/String;->equals(Ljava/lang/Object;)Z

    move-result v6

    if-nez v6, :cond_0

    :try_start_0
    invoke-virtual {p0}, Lcom/sun/org/apache/xml/internal/security/signature/SignedInfo;->getCanonicalizationMethodURI()Ljava/lang/String;

    move-result-object v6

    invoke-static {v6}, Lcom/sun/org/apache/xml/internal/security/c14n/Canonicalizer;->getInstance(Ljava/lang/String;)Lcom/sun/org/apache/xml/internal/security/c14n/Canonicalizer;

    move-result-object v1

    iget-object v6, p0, Lcom/sun/org/apache/xml/internal/security/utils/ElementProxy;->_constructionElement:Lorg/w3c/dom/Element;

    invoke-virtual {v1, v6}, Lcom/sun/org/apache/xml/internal/security/c14n/Canonicalizer;->canonicalizeSubtree(Lorg/w3c/dom/Node;)[B

    move-result-object v6

    iput-object v6, p0, Lcom/sun/org/apache/xml/internal/security/signature/SignedInfo;->_c14nizedBytes:[B

    invoke-static {}, Ljavax/xml/parsers/DocumentBuilderFactory;->newInstance()Ljavax/xml/parsers/DocumentBuilderFactory;

    move-result-object v2

    const/4 v6, 0x1

    invoke-virtual {v2, v6}, Ljavax/xml/parsers/DocumentBuilderFactory;->setNamespaceAware(Z)V

    invoke-virtual {v2}, Ljavax/xml/parsers/DocumentBuilderFactory;->newDocumentBuilder()Ljavax/xml/parsers/DocumentBuilder;

    move-result-object v3

    new-instance v6, Ljava/io/ByteArrayInputStream;

    iget-object v7, p0, Lcom/sun/org/apache/xml/internal/security/signature/SignedInfo;->_c14nizedBytes:[B

    invoke-direct {v6, v7}, Ljava/io/ByteArrayInputStream;-><init>([B)V

    invoke-virtual {v3, v6}, Ljavax/xml/parsers/DocumentBuilder;->parse(Ljava/io/InputStream;)Lorg/w3c/dom/Document;

    move-result-object v4

    iget-object v6, p0, Lcom/sun/org/apache/xml/internal/security/utils/ElementProxy;->_doc:Lorg/w3c/dom/Document;

    invoke-interface {v4}, Lorg/w3c/dom/Document;->getDocumentElement()Lorg/w3c/dom/Element;

    move-result-object v7

    const/4 v8, 0x1

    invoke-interface {v6, v7, v8}, Lorg/w3c/dom/Document;->importNode(Lorg/w3c/dom/Node;Z)Lorg/w3c/dom/Node;

    move-result-object v5

    iget-object v6, p0, Lcom/sun/org/apache/xml/internal/security/utils/ElementProxy;->_constructionElement:Lorg/w3c/dom/Element;

    invoke-interface {v6}, Lorg/w3c/dom/Node;->getParentNode()Lorg/w3c/dom/Node;

    move-result-object v6

    iget-object v7, p0, Lcom/sun/org/apache/xml/internal/security/utils/ElementProxy;->_constructionElement:Lorg/w3c/dom/Element;

    invoke-interface {v6, v5, v7}, Lorg/w3c/dom/Node;->replaceChild(Lorg/w3c/dom/Node;Lorg/w3c/dom/Node;)Lorg/w3c/dom/Node;

    check-cast v5, Lorg/w3c/dom/Element;

    iput-object v5, p0, Lcom/sun/org/apache/xml/internal/security/utils/ElementProxy;->_constructionElement:Lorg/w3c/dom/Element;
    :try_end_0
    .catch Ljavax/xml/parsers/ParserConfigurationException; {:try_start_0 .. :try_end_0} :catch_0
    .catch Ljava/io/IOException; {:try_start_0 .. :try_end_0} :catch_1
    .catch Lorg/xml/sax/SAXException; {:try_start_0 .. :try_end_0} :catch_2

    goto :goto_0

    :catch_0
    move-exception v1

    new-instance v6, Lcom/sun/org/apache/xml/internal/security/exceptions/XMLSecurityException;

    const-string/jumbo v7, "empty"

    invoke-direct {v6, v7, v1}, Lcom/sun/org/apache/xml/internal/security/exceptions/XMLSecurityException;-><init>(Ljava/lang/String;Ljava/lang/Exception;)V

    throw v6

    :catch_1
    move-exception v1

    new-instance v6, Lcom/sun/org/apache/xml/internal/security/exceptions/XMLSecurityException;

    const-string/jumbo v7, "empty"

    invoke-direct {v6, v7, v1}, Lcom/sun/org/apache/xml/internal/security/exceptions/XMLSecurityException;-><init>(Ljava/lang/String;Ljava/lang/Exception;)V

    throw v6

    :catch_2
    move-exception v1

    new-instance v6, Lcom/sun/org/apache/xml/internal/security/exceptions/XMLSecurityException;

    const-string/jumbo v7, "empty"

    invoke-direct {v6, v7, v1}, Lcom/sun/org/apache/xml/internal/security/exceptions/XMLSecurityException;-><init>(Ljava/lang/String;Ljava/lang/Exception;)V

    throw v6
.end method

# virtual methods
.method public createSecretKey([B)Ljavax/crypto/SecretKey;
    .locals 2

    new-instance v0, Ljavax/crypto/spec/SecretKeySpec;

    iget-object v1, p0, Lcom/sun/org/apache/xml/internal/security/signature/SignedInfo;->_signatureAlgorithm:Lcom/sun/org/apache/xml/internal/security/algorithms/SignatureAlgorithm;

    invoke-virtual {v1}, Lcom/sun/org/apache/xml/internal/security/algorithms/SignatureAlgorithm;->getJCEAlgorithmString()Ljava/lang/String;

    move-result-object v1

    invoke-direct {v0, p1, v1}, Ljavax/crypto/spec/SecretKeySpec;-><init>([BLjava/lang/String;)V

    return-object v0
.end method

.method public getBaseLocalName()Ljava/lang/String;
    .locals 1

    const-string/jumbo v0, "SignedInfo"

    return-object v0
.end method

.method public getCanonicalizationMethodURI()Ljava/lang/String;
    .locals 5

    const/4 v4, 0x0

    iget-object v1, p0, Lcom/sun/org/apache/xml/internal/security/utils/ElementProxy;->_constructionElement:Lorg/w3c/dom/Element;

    invoke-interface {v1}, Lorg/w3c/dom/Node;->getFirstChild()Lorg/w3c/dom/Node;

    move-result-object v1

    const-string/jumbo v2, "CanonicalizationMethod"

    const/4 v3, 0x0

    invoke-static {v1, v2, v3}, Lcom/sun/org/apache/xml/internal/security/utils/XMLUtils;->selectDsNode(Lorg/w3c/dom/Node;Ljava/lang/String;I)Lorg/w3c/dom/Element;

    move-result-object v0

    if-eqz v0, :cond_0

    const-string/jumbo v1, "Algorithm"

    invoke-interface {v0, v4, v1}, Lorg/w3c/dom/Element;->getAttributeNS(Ljava/lang/String;Ljava/lang/String;)Ljava/lang/String;

    move-result-object v1

    return-object v1

    :cond_0
    return-object v4
.end method

.method public getCanonicalizedOctetStream()[B
    .locals 4
    .annotation system Ldalvik/annotation/Throws;
        value = {
            Lcom/sun/org/apache/xml/internal/security/c14n/CanonicalizationException;,
            Lcom/sun/org/apache/xml/internal/security/c14n/InvalidCanonicalizerException;,
            Lcom/sun/org/apache/xml/internal/security/exceptions/XMLSecurityException;
        }
    .end annotation

    const/4 v3, 0x0

    iget-object v1, p0, Lcom/sun/org/apache/xml/internal/security/signature/SignedInfo;->_c14nizedBytes:[B

    if-eqz v1, :cond_0

    :goto_0
    iget-object v1, p0, Lcom/sun/org/apache/xml/internal/security/signature/SignedInfo;->_c14nizedBytes:[B

    array-length v1, v1

    new-array v0, v1, [B

    iget-object v1, p0, Lcom/sun/org/apache/xml/internal/security/signature/SignedInfo;->_c14nizedBytes:[B

    array-length v2, v0

    invoke-static {v1, v3, v0, v3, v2}, Ljava/lang/System;->arraycopy(Ljava/lang/Object;ILjava/lang/Object;II)V

    return-object v0

    :cond_0
    invoke-virtual {p0}, Lcom/sun/org/apache/xml/internal/security/signature/SignedInfo;->getCanonicalizationMethodURI()Ljava/lang/String;

    move-result-object v1

    invoke-static {v1}, Lcom/sun/org/apache/xml/internal/security/c14n/Canonicalizer;->getInstance(Ljava/lang/String;)Lcom/sun/org/apache/xml/internal/security/c14n/Canonicalizer;

    move-result-object v0

    iget-object v1, p0, Lcom/sun/org/apache/xml/internal/security/utils/ElementProxy;->_constructionElement:Lorg/w3c/dom/Element;

    invoke-virtual {v0, v1}, Lcom/sun/org/apache/xml/internal/security/c14n/Canonicalizer;->canonicalizeSubtree(Lorg/w3c/dom/Node;)[B

    move-result-object v1

    iput-object v1, p0, Lcom/sun/org/apache/xml/internal/security/signature/SignedInfo;->_c14nizedBytes:[B

    goto :goto_0
.end method

.method public getInclusiveNamespaces()Ljava/lang/String;
    .locals 9

    const/4 v8, 0x0

    const/4 v7, 0x0

    iget-object v4, p0, Lcom/sun/org/apache/xml/internal/security/utils/ElementProxy;->_constructionElement:Lorg/w3c/dom/Element;

    invoke-interface {v4}, Lorg/w3c/dom/Node;->getFirstChild()Lorg/w3c/dom/Node;

    move-result-object v4

    const-string/jumbo v5, "CanonicalizationMethod"

    invoke-static {v4, v5, v8}, Lcom/sun/org/apache/xml/internal/security/utils/XMLUtils;->selectDsNode(Lorg/w3c/dom/Node;Ljava/lang/String;I)Lorg/w3c/dom/Element;

    move-result-object v0

    if-eqz v0, :cond_1

    const-string/jumbo v4, "Algorithm"

    invoke-interface {v0, v7, v4}, Lorg/w3c/dom/Element;->getAttributeNS(Ljava/lang/String;Ljava/lang/String;)Ljava/lang/String;

    move-result-object v1

    const-string/jumbo v4, "http://www.w3.org/2001/10/xml-exc-c14n#"

    invoke-virtual {v1, v4}, Ljava/lang/String;->equals(Ljava/lang/Object;)Z

    move-result v4

    if-eqz v4, :cond_2

    :cond_0
    invoke-interface {v0}, Lorg/w3c/dom/Node;->getFirstChild()Lorg/w3c/dom/Node;

    move-result-object v4

    const-string/jumbo v5, "http://www.w3.org/2001/10/xml-exc-c14n#"

    const-string/jumbo v6, "InclusiveNamespaces"

    invoke-static {v4, v5, v6, v8}, Lcom/sun/org/apache/xml/internal/security/utils/XMLUtils;->selectNode(Lorg/w3c/dom/Node;Ljava/lang/String;Ljava/lang/String;I)Lorg/w3c/dom/Element;

    move-result-object v2

    if-nez v2, :cond_3

    return-object v7

    :cond_1
    return-object v7

    :cond_2
    const-string/jumbo v4, "http://www.w3.org/2001/10/xml-exc-c14n#WithComments"

    invoke-virtual {v1, v4}, Ljava/lang/String;->equals(Ljava/lang/Object;)Z

    move-result v4

    if-nez v4, :cond_0

    return-object v7

    :cond_3
    :try_start_0
    new-instance v4, Lcom/sun/org/apache/xml/internal/security/transforms/params/InclusiveNamespaces;

    const-string/jumbo v5, "http://www.w3.org/2001/10/xml-exc-c14n#"

    invoke-direct {v4, v2, v5}, Lcom/sun/org/apache/xml/internal/security/transforms/params/InclusiveNamespaces;-><init>(Lorg/w3c/dom/Element;Ljava/lang/String;)V

    invoke-virtual {v4}, Lcom/sun/org/apache/xml/internal/security/transforms/params/InclusiveNamespaces;->getInclusiveNamespaces()Ljava/lang/String;
    :try_end_0
    .catch Lcom/sun/org/apache/xml/internal/security/exceptions/XMLSecurityException; {:try_start_0 .. :try_end_0} :catch_0

    move-result-object v3

    return-object v3

    :catch_0
    move-exception v3

    return-object v7
.end method

.method public getSignatureMethodElement()Lorg/w3c/dom/Element;
    .locals 3

    iget-object v0, p0, Lcom/sun/org/apache/xml/internal/security/utils/ElementProxy;->_constructionElement:Lorg/w3c/dom/Element;

    invoke-interface {v0}, Lorg/w3c/dom/Node;->getFirstChild()Lorg/w3c/dom/Node;

    move-result-object v0

    const-string/jumbo v1, "SignatureMethod"

    const/4 v2, 0x0

    invoke-static {v0, v1, v2}, Lcom/sun/org/apache/xml/internal/security/utils/XMLUtils;->selectDsNode(Lorg/w3c/dom/Node;Ljava/lang/String;I)Lorg/w3c/dom/Element;

    move-result-object v0

    return-object v0
.end method

.method public getSignatureMethodURI()Ljava/lang/String;
    .locals 3

    const/4 v2, 0x0

    invoke-virtual {p0}, Lcom/sun/org/apache/xml/internal/security/signature/SignedInfo;->getSignatureMethodElement()Lorg/w3c/dom/Element;

    move-result-object v0

    if-nez v0, :cond_0

    return-object v2

    :cond_0
    const-string/jumbo v1, "Algorithm"

    invoke-interface {v0, v2, v1}, Lorg/w3c/dom/Element;->getAttributeNS(Ljava/lang/String;Ljava/lang/String;)Ljava/lang/String;

    move-result-object v1

    return-object v1
.end method

.method public signInOctectStream(Ljava/io/OutputStream;)V
    .locals 5
    .annotation system Ldalvik/annotation/Throws;
        value = {
            Lcom/sun/org/apache/xml/internal/security/c14n/CanonicalizationException;,
            Lcom/sun/org/apache/xml/internal/security/c14n/InvalidCanonicalizerException;,
            Lcom/sun/org/apache/xml/internal/security/exceptions/XMLSecurityException;
        }
    .end annotation

    iget-object v2, p0, Lcom/sun/org/apache/xml/internal/security/signature/SignedInfo;->_c14nizedBytes:[B

    if-eqz v2, :cond_0

    :try_start_0
    iget-object v2, p0, Lcom/sun/org/apache/xml/internal/security/signature/SignedInfo;->_c14nizedBytes:[B

    invoke-virtual {p1, v2}, Ljava/io/OutputStream;->write([B)V
    :try_end_0
    .catch Ljava/io/IOException; {:try_start_0 .. :try_end_0} :catch_0

    :goto_0
    return-void

    :cond_0
    invoke-virtual {p0}, Lcom/sun/org/apache/xml/internal/security/signature/SignedInfo;->getCanonicalizationMethodURI()Ljava/lang/String;

    move-result-object v2

    invoke-static {v2}, Lcom/sun/org/apache/xml/internal/security/c14n/Canonicalizer;->getInstance(Ljava/lang/String;)Lcom/sun/org/apache/xml/internal/security/c14n/Canonicalizer;

    move-result-object v0

    invoke-virtual {v0, p1}, Lcom/sun/org/apache/xml/internal/security/c14n/Canonicalizer;->setWriter(Ljava/io/OutputStream;)V

    invoke-virtual {p0}, Lcom/sun/org/apache/xml/internal/security/signature/SignedInfo;->getInclusiveNamespaces()Ljava/lang/String;

    move-result-object v1

    if-eqz v1, :cond_1

    iget-object v2, p0, Lcom/sun/org/apache/xml/internal/security/utils/ElementProxy;->_constructionElement:Lorg/w3c/dom/Element;

    invoke-virtual {v0, v2, v1}, Lcom/sun/org/apache/xml/internal/security/c14n/Canonicalizer;->canonicalizeSubtree(Lorg/w3c/dom/Node;Ljava/lang/String;)[B

    goto :goto_0

    :cond_1
    iget-object v2, p0, Lcom/sun/org/apache/xml/internal/security/utils/ElementProxy;->_constructionElement:Lorg/w3c/dom/Element;

    invoke-virtual {v0, v2}, Lcom/sun/org/apache/xml/internal/security/c14n/Canonicalizer;->canonicalizeSubtree(Lorg/w3c/dom/Node;)[B

    goto :goto_0

    :catch_0
    move-exception v0

    new-instance v2, Ljava/lang/RuntimeException;

    new-instance v3, Ljava/lang/StringBuffer;

    invoke-direct {v3}, Ljava/lang/StringBuffer;-><init>()V

    const-string/jumbo v4, ""

    invoke-virtual {v3, v4}, Ljava/lang/StringBuffer;->append(Ljava/lang/String;)Ljava/lang/StringBuffer;

    move-result-object v3

    invoke-virtual {v3, v0}, Ljava/lang/StringBuffer;->append(Ljava/lang/Object;)Ljava/lang/StringBuffer;

    move-result-object v3

    invoke-virtual {v3}, Ljava/lang/StringBuffer;->toString()Ljava/lang/String;

    move-result-object v3

    invoke-direct {v2, v3}, Ljava/lang/RuntimeException;-><init>(Ljava/lang/String;)V

    throw v2
.end method

.method public verify()Z
    .locals 1
    .annotation system Ldalvik/annotation/Throws;
        value = {
            Lcom/sun/org/apache/xml/internal/security/signature/MissingResourceFailureException;,
            Lcom/sun/org/apache/xml/internal/security/exceptions/XMLSecurityException;
        }
    .end annotation

    const/4 v0, 0x0

    invoke-super {p0, v0}, Lcom/sun/org/apache/xml/internal/security/signature/Manifest;->verifyReferences(Z)Z

    move-result v0

    return v0
.end method

.method public verify(Z)Z
    .locals 1
    .annotation system Ldalvik/annotation/Throws;
        value = {
            Lcom/sun/org/apache/xml/internal/security/signature/MissingResourceFailureException;,
            Lcom/sun/org/apache/xml/internal/security/exceptions/XMLSecurityException;
        }
    .end annotation

    invoke-super {p0, p1}, Lcom/sun/org/apache/xml/internal/security/signature/Manifest;->verifyReferences(Z)Z

    move-result v0

    return v0
.end method


text:
module Moneta
  module Api
    module Requests
      # Запрос на получение списка операций по заданному фильтру.
      # Обязательными в фильтре являются только поля с датами периода.
      # Все остальные поля в фильтре необязательные.
      # Если данные не найдены, то size в ответе равен 0.
      # Transaction searching by given filter.
      # Filter requires date period values to be set.
      # Other parameters are optional.
      # Response element "size" is 0 if no data found.

      class FindOperationsListRequest
        include Moneta::Api::DataMapper

        # @return [Moneta::Api::Types::Pager] Настройки страницы данных. Необязательное поле.
        #   / Paging settings. Optional.
        property :pager

        # @return [Moneta::Api::Types::FindOperationsListRequestFilter] Фильтр, по которому ищем операции.
        #   / Transactions filter.
        property :filter
      end
    end
  end
end

redpajama_set_name: RedPajamaGithub


text:
module.exports = function (data, options) {
    return options.fn( data.info[0] );
};


text:
package org.waveprotocol.box.server.util;

import com.google.common.base.Preconditions;

import org.waveprotocol.wave.model.util.Pair;
import org.waveprotocol.wave.util.logging.Log;

import java.util.concurrent.CountDownLatch;
import java.util.concurrent.TimeUnit;
import java.util.concurrent.atomic.AtomicReference;

/**
 * A {@code SuccessFailCallback} which supports blocking for a response.  Note that neither
 * {@link #onSuccess} not {@link #onFailure} will accept a null argument.
 *
 * TODO: the behaviour for unexpected conditions is a bit harsh, should log not crash (but it
 * requires more work, currently unwarranted).
 */
public class BlockingSuccessFailCallback<S, F> implements SuccessFailCallback<S, F> {

  private final static Log LOG = Log.get(BlockingSuccessFailCallback.class);

  private final AtomicReference<S> successResult = new AtomicReference<S>(null);
  private final AtomicReference<F> failureResult = new AtomicReference<F>(null);
  private final CountDownLatch awaitLatch = new CountDownLatch(1);
  private final String description;

  private BlockingSuccessFailCallback(String description) {
    this.description = description;
  }

  public static <S, F> BlockingSuccessFailCallback<S, F> create() {
    StackTraceElement caller = new Throwable().getStackTrace()[1];
    return new BlockingSuccessFailCallback<S, F>("Created at " + caller.getClassName() + "."
        + caller.getMethodName() + ":" + caller.getLineNumber());
  }

  /**
   * Wait for either {@link #onSuccess} or {@link #onFailure} to be called and return both results.
   * Either the first of the pair (success value) or second of the pair (failure value) will hold
   * a not-null result indicating which method was run, while the other is guaranteed to contain
   * null.
   *
   * The return result may be null if the await did not return within the timeout.
   *
   * @param timeout
   * @param unit
   * @return pair of (success value, failure value) where exactly one will be not-null, or null
   *         if the await timed out
   */
  public Pair<S, F> await(long timeout, TimeUnit unit) {
    try {
      long startMs = System.currentTimeMillis();
      if (!awaitLatch.await(timeout, unit)) {
        LOG.warning(description + ": timed out while waiting for " + timeout + " " + unit);
        return null;
      }
      LOG.fine(description + ": await took " + (System.currentTimeMillis() - startMs) + " ms");
    } catch (InterruptedException e) {
      LOG.severe(description + ": interrupted while waiting", e);
      throw new IllegalStateException(e);
    }
    return Pair.of(successResult.get(), failureResult.get());
  }

  @Override
  public void onFailure(F failureValue) {
    LOG.warning(description + ": onFailure(" + failureValue + ")");
    Preconditions.checkArgument(failureValue != null);
    Preconditions.checkState(failureResult.getAndSet(failureValue) == null);
    Preconditions.checkState(successResult.get() == null);
    awaitLatch.countDown();
  }

  @Override
  public void onSuccess(S successValue) {
    LOG.fine(description + ": onSuccess(" + successValue + ")");
    Preconditions.checkArgument(successResult != null);
    Preconditions.checkState(successResult.getAndSet(successValue) == null);
    Preconditions.checkState(failureResult.get() == null);
    awaitLatch.countDown();
  }
}


text:
var dialog = (function ($) {
	var openDialogHelper = function(item, elementID, URL) {
    item.html($(""));
    $('#' + elementID + '_iframe').load(function () {
        $(this)[0].style.display = 'block';
        $(this).hide().fadeIn(500);
        $(this).contents().find('body').show().css('display', 'block');
        $(this).get(0).contentWindow.window.onbeforeunload = function () {
            $('#' + elementID + '_iframe').fadeOut(500, function () {
                $(this).css('display', 'none');
            });
        };
    });
}

	var createDialogURL = function(URL, height, width, id, title, modal) {
    return createDlg(URL, title, height, width, modal, id);
}

String.prototype.hashCode = function() {
    var hash = 0;
    if (this.length == 0) return hash;
    for (i = 0; i < this.length; i++) {
        char = this.charCodeAt(i);
        hash = ((hash << 5) - hash) + char;
        hash = hash & hash; // Convert to 32bit integer
    }
    return hash;
}

	var setDlgIcon = function(imageUrl,dlg) {
    if (window != window.top) {
        return parent.setDlgIcon(imageUrl,getCurrentIframe().parent());
    }
    if(dlg){
        dlg.parent().find('.dlgIcon').remove();
        dlg.parent().find('.ui-dialog-title').prepend(' ');
    	return dlg.parent().find('.dlgIcon');
    }
    return null;
}

	var getCurrentIframe = function() {
		var iframe = null;
		if (top === self)
			return false; // Not in an iframe
		$('iframe', parent.document).each(function (value) {
			if ($(this).prop('src').indexOf(document.domain) > -1) {
				if ($(this).contents().find('body').html() == $(document).contents().find('body').html()) {
					iframe = $(this);
				}
			}
		});
		return iframe;
	}

	var addButtons = function(dlg, Buttons) {
		dlg = $(dlg);
		var iframe = dlg.find('iframe');
		var newbuttons = [];
		if (Buttons != null)
			jQuery.each(Buttons, function(key, value) {

				if (jQuery.isPlainObject(value)) {
					for (var akey in value)
						key = akey;

					value = Buttons[index][key];
				}
				var buttonName = key;
				var isSelector = false;
				if (key.indexOf("#") != 0 && key.indexOf(".") != 0)
					key = "#" + key;
				else
					isSelector = true;
				var frameButton = iframe.contents().find(key);
				if (frameButton.length > 0) {
					buttonName = frameButton.attr("value");
					frameButton.css('display', 'none');
				}
				if (frameButton.length > 0 || !isSelector) {
					newbuttons.push({
						text: buttonName,
						click: function() {
							var retval = true;
							if (jQuery.isFunction(value)) retval = !value();
							frameButton.click()
							if (retval) $(this).dialog("close");
						}
					});
				}
			});
		var options = { buttons: newbuttons };
		dlg.dialog('option', options);
	}

	var createDlg = function(URL, title, height, width, modal, id, Buttons) {
		if (window != window.top) {
			return parent.dialog.createDlg(URL, title, height, width, modal, id, Buttons);
		}
		if (!title) title = "";
		if (!width) width = 400;
		if (!height) height = 400;
		if (!id) id = "dynamicDiv_" + URL.hashCode();
		$('#' + id).remove(); //Maybe we should hid the id.. maybe I should create a new ID each time a dialog is created..
		if ($('#' + id).length == 0) {
			var dlgDiv = $("

")
			$($('form')[0]).append(dlgDiv);
			dlgDiv.dialog({
				autoOpen: false,
				open: function (event, ui) {
					dlgDiv.parent().hide();
					$('body').first().css('overflow', 'hidden');
					$('#' + id + '_iframe').load(function() { addButtons($('#' + id), Buttons); });
					dlgDiv.parent().fadeIn(10); //I'm doing a fade-in so you don't see the parent reposition itself.
					dialog.openDialogHelper($(this), id, URL);
					$('.ui-widget-overlay').css('z-index', getMaxZ("*") + 1);
					$('.ui-dialog').css('z-index', getMaxZ("*") + 1);
				},
				close: function (event, ui) {
					$('body').first().css('overflow', '');
				},
				buttons: {},
				modal: modal,
				width: width,
				height: height,
				hide: "fade"
			}).dialogExtend({ 'dblclick': 'maximize' });
		}
		//$('#' + id).appendTo($('form:first'));
		$('#' + id).dialog('open');
		return $('#' + id);
	}

	var addButtonsOnLoad = function(dlg, Buttons) {
		dlg = $(dlg);
		var iframe = dlg.find('iframe');
		iframe.load(function() { addButtons(dlg, Buttons); });
	}

	var closeCurrentDlg = function() {
		var iframe = dialog.getCurrentDlg();
		if(iframe)
			window.parent.closeAll($(iframe).parent().parent().find('.ui-dialog-content').attr('id'));
	}

	var getCurrentDlg = function(){
			if (top === self)
				return false; // Not in an iframe
			var iframe = getCurrentIframe();
			if(!iframe) return false; //Can't find the iframe..
			if (iframe.parent().hasClass("ui-dialog-content")){ //is it in a dialog
				return iframe;
			}
		return false;
	}

	var addButtonsFromFrame = function(Buttons) {
		var iframe = getCurrentDlg();
		if(!iframe) return false; //Can't find the iframe or dialog..
		parent.addButtons($(iframe.parent()), Buttons);
		parent.addButtonsOnLoad($(iframe.parent()), Buttons);

	}

	window.openDialogHelper = openDialogHelper;
	window.createDialogURL = createDialogURL;
	window.setDlgIcon = setDlgIcon;
	window.getCurrentIframe = getCurrentIframe;
	window.addButtons = addButtons;
	window.createDlg = createDlg;
	window.addButtonsOnLoad = addButtonsOnLoad;
	window.closeCurrentDlg = closeCurrentDlg;
	window.getCurrentDlg = getCurrentDlg;
	window.addButtonsFromFrame = addButtonsFromFrame;

	return {
		openDialogHelper: openDialogHelper, createDialogURL: createDialogURL, setDlgIcon: setDlgIcon, getCurrentIframe: getCurrentIframe, addButtons: addButtons, createDlg: createDlg,
		addButtonsOnLoad: addButtonsOnLoad, closeCurrentDlg: closeCurrentDlg, getCurrentDlg: getCurrentDlg, addButtonsFromFrame: addButtonsFromFrame
	}

})(jQuery);


text:
#ifndef OSS_SDK_CPP_MESSAGE_OPTION_OBJECT_RESULT_H_
#define OSS_SDK_CPP_MESSAGE_OPTION_OBJECT_RESULT_H_

#include <string>
#include "oss_sdk_cpp/base/base.h"
#include "oss_sdk_cpp/message/bucket.h"

namespace oss {

class OptionObjectResult {
 public:
  void ParseFromHeader(const StringMap& headers);

  const std::string& GetAllowOrigin();

  const std::string& GetAllowMethods();

  const std::string& GeExposeHeaders();

 private:
  std::string allow_origin_;
  std::string allow_methods_;
  std::string expose_headers_;
};

}  // namespace oss

#endif  // OSS_SDK_CPP_MESSAGE_OPTION_OBJECT_RESULT_H_


text:
<?xml version="1.0" encoding="UTF-8"?>
<!--
    Licensed to the Apache Software Foundation (ASF) under one or more
    contributor license agreements.  See the NOTICE file distributed with
    this work for additional information regarding copyright ownership.
    The ASF licenses this file to You under the Apache License, Version 2.0
    (the "License"); you may not use this file except in compliance with
    the License.  You may obtain a copy of the License at

    http://www.apache.org/licenses/LICENSE-2.0

    Unless required by applicable law or agreed to in writing, software
    distributed under the License is distributed on an "AS IS" BASIS,
    WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
    See the License for the specific language governing permissions and
    limitations under the License.
-->
<beans xmlns="http://www.springframework.org/schema/beans"
       xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
       xsi:schemaLocation="
       http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans.xsd
       http://camel.apache.org/schema/spring http://camel.apache.org/schema/spring/camel-spring.xsd
    ">

  <!-- use a dummy rest consumer factory for the rest engine -->
  <bean id="dummy-rest" class="org.apache.camel.component.rest.DummyRestConsumerFactory"/>

  <camelContext xmlns="http://camel.apache.org/schema/spring">

    <rest path="/say/hello">
      <get>
        <to uri="direct:hello"/>
      </get>
    </rest>
    <rest path="/say/bye">
      <get consumes="application/json">
          <param name="header_count" type="header" description="header param description1" dataType="integer" defaultValue="1" allowMultiple="false" required="true" access="acc1">
              <allowableValues>
                  <value>1</value>
                  <value>2</value>
                  <value>3</value>
                  <value>4</value>
              </allowableValues>
          </param>
          <param name="header_letter" type="query" description="header param description2" dataType="string" defaultValue="b" allowMultiple="true" required="false" access="acc2">
              <allowableValues>
                  <value>a</value>
                  <value>b</value>
                  <value>c</value>
                  <value>d</value>
              </allowableValues>
          </param>
          <responseMessage code="300" message="test msg" responseModel="java.lang.Integer"/>
          <responseMessage code="error" message="does not work"/>
          <to uri="direct:bye"/>
      </get>
      <post>
        <to uri="mock:update"/>
      </post>
    </rest>

    <route>
      <from uri="direct:hello"/>
      <transform>
        <constant>Hello World</constant>
      </transform>
    </route>
    <route>
      <from uri="direct:bye"/>
      <transform>
        <constant>Bye World</constant>
      </transform>
    </route>

  </camelContext>

</beans>


text:
package Basic;

import org.openqa.selenium.*;
import org.openqa.selenium.WebDriver.Navigation;

import java.io.File;
import java.io.IOException;
import java.text.SimpleDateFormat;
import java.util.Date;
import java.util.NoSuchElementException;

import org.apache.commons.io.FileUtils;

import Basic.properties;

public class BasicDriver extends properties{
	public BasicDriver() throws IOException {
		super();
		// TODO Auto-generated constructor stub
	}

	public static WebDriver driver;
	public static Navigation navigation;

	//启动浏览器进入指定网址,最大化浏览器
	public static void open() throws InterruptedException{
		navigation.to(url);
		driver.manage().window().maximize();
	}

	//登录
	public static void login() throws InterruptedException{
		driver.findElement(By.name("email")).sendKeys(email);
		WebElement pw = driver.findElement(By.name("pwd"));
		pw.sendKeys("" + password);
		pw.submit();
		Thread.sleep(1000);
	}

	//判断元素是否存在
	public static boolean isElementExist(By by){
	    try{
	    	driver.findElement(by);
	    	return true;
	    }catch(Exception e){
	        return false;
	    }

	}

	//屏幕截图
	public static void takeScreenshots(String path){
	    File screenshot = ((TakesScreenshot)driver).getScreenshotAs(OutputType.FILE);
	    try {
			FileUtils.copyFile(screenshot, new File(path));
		} catch (IOException e) {
			e.printStackTrace();
		}
	}

	//窗口切换
	public static void windows(int i){
		String[] handles = new String[driver.getWindowHandles().size()];
		driver.getWindowHandles().toArray(handles);
		driver.switchTo().window(handles[i]);
	}

	//时间方法
	public static String time(){
		Date date = new Date();
		SimpleDateFormat dateFormat = new SimpleDateFormat("yyyy/MM/dd HH:mm:ss");
		return dateFormat.format(date);
	}

	//获得某元素的文本描述信息
	public static String getElementText(By by){
		try{
			return driver.findElement(by).getText();
		}catch(NoSuchElementException e){
			return "Text does not exist!";
		}
	}

    /*
     *** 某些元素由于属于某个iframe的需要先定义到frame然后再在此frame里边查找该元素
     *** 此方法适合定位文本链接型元素
     */
	public static void frame(By by,String text){
	    	WebElement element = driver.switchTo().frame(text).findElement(by);
	    	element.click();
	}

	 /*
     *** 某些元素由于属于某个iframe的需要先定义到frame然后再在此frame里边查找该元素
     *** 此方法适合定位文本输入框型元素
     */
	public static void frameElementSendKey(By by,String text){
			WebElement element = driver.switchTo().frame(text).findElement(by);
			element.sendKeys(text);
	}

}


text:
title: SpiceHTML5
category: feature
authors: fkobzik
wiki_category: Feature
wiki_title: Features/SpiceHTML5
wiki_revision_count: 3
wiki_last_updated: 2013-07-12
---

# Spice HTML5

## Summary

This feature adds spice-html5 console to the engine. spice-html5 is a spice answer to novnc webbrowser console client. spice-html5 is still a little bit experimental yet under active development. Similarly to the novnc, spice-html5 uses websockets to communicate with websocket proxy which talks directly to spice server.

## Owner

*   Name: Frank Kobzik (Fkobzik)
*   Email: <fkobzik@redhat.com>

## Design

The design, architecture and implementation is almost same as the noVNC case. That means:

*   we use same (modified) websocket proxy python-websockify
*   we make use of external package with the client (spice-html5) and slightly modified client page that is served by jboss

For more info please visit [Features/noVNC_console](/develop/release-management/features/virt/novnc-console/)

      Note: In future the websockets support for SPICE will be implemented in QEMU. When this happens, the implementation of spice-html5 in the engine should use this feature instead of using websocket proxy.

However, there is one difference, which is worth noting - in VNC case, there is only one port which the clients connects to. With SPICE, there is secured port and unsecured one. If the client is using the secured one, it is required to pass this information to websockify. This information is passed in the url path.

## Testing

### Test case 1 - Websocket Proxy on the engine's machine

Prerequisities: Browser that has proper websockets and postmessage support (tested with FF and Chrome)

*   Install the engine and in the engine-setup answer 'Yes' to 'Configure websocket proxy on the machine'
*   Import CA of the engine in your browser
*   Set up a VM as usual, set its Display Type to SPICE and run it.
*   In Console Options dialog, select 'SPICE HTML5 browser client'
*   Click the console button to invoke the console.
    -   (The console opens in a new tab and this behavior is usualy blocked by browsers. For opening the console you must allow displaying pop-up windows from engine's domain.)

Results: The new browser tab with spice-html5 session appears.


text:
""" parquet compat """

from warnings import catch_warnings
from distutils.version import LooseVersion
from pandas import DataFrame, RangeIndex, Int64Index, get_option
from pandas.compat import string_types
import pandas.core.common as com
from pandas.io.common import get_filepath_or_buffer, is_s3_url

def get_engine(engine):
    """ return our implementation """

    if engine == 'auto':
        engine = get_option('io.parquet.engine')

    if engine == 'auto':
        # try engines in this order
        try:
            return PyArrowImpl()
        except ImportError:
            pass

        try:
            return FastParquetImpl()
        except ImportError:
            pass

        raise ImportError("Unable to find a usable engine; "
                          "tried using: 'pyarrow', 'fastparquet'.\n"
                          "pyarrow or fastparquet is required for parquet "
                          "support")

    if engine not in ['pyarrow', 'fastparquet']:
        raise ValueError("engine must be one of 'pyarrow', 'fastparquet'")

    if engine == 'pyarrow':
        return PyArrowImpl()
    elif engine == 'fastparquet':
        return FastParquetImpl()

class BaseImpl(object):

    api = None  # module

    @staticmethod
    def validate_dataframe(df):

        if not isinstance(df, DataFrame):
            raise ValueError("to_parquet only supports IO with DataFrames")

        # must have value column names (strings only)
        if df.columns.inferred_type not in {'string', 'unicode'}:
            raise ValueError("parquet must have string column names")

        # index level names must be strings
        valid_names = all(
            isinstance(name, string_types)
            for name in df.index.names
            if name is not None
        )
        if not valid_names:
            raise ValueError("Index level names must be strings")

    def write(self, df, path, compression, **kwargs):
        raise com.AbstractMethodError(self)

    def read(self, path, columns=None, **kwargs):
        raise com.AbstractMethodError(self)

class PyArrowImpl(BaseImpl):

    def __init__(self):
        # since pandas is a dependency of pyarrow
        # we need to import on first use
        try:
            import pyarrow
            import pyarrow.parquet
        except ImportError:
            raise ImportError(
                "pyarrow is required for parquet support\n\n"
                "you can install via conda\n"
                "conda install pyarrow -c conda-forge\n"
                "\nor via pip\n"
                "pip install -U pyarrow\n"
            )
        if LooseVersion(pyarrow.__version__) < '0.4.1':
            raise ImportError(
                "pyarrow >= 0.4.1 is required for parquet support\n\n"
                "you can install via conda\n"
                "conda install pyarrow -c conda-forge\n"
                "\nor via pip\n"
                "pip install -U pyarrow\n"
            )

        self._pyarrow_lt_060 = (
            LooseVersion(pyarrow.__version__) < LooseVersion('0.6.0'))
        self._pyarrow_lt_070 = (
            LooseVersion(pyarrow.__version__) < LooseVersion('0.7.0'))

        self.api = pyarrow

    def write(self, df, path, compression='snappy',
              coerce_timestamps='ms', index=None, **kwargs):
        self.validate_dataframe(df)

        # Only validate the index if we're writing it.
        if self._pyarrow_lt_070 and index is not False:
            self._validate_write_lt_070(df)
        path, _, _, _ = get_filepath_or_buffer(path, mode='wb')

        if index is None:
            from_pandas_kwargs = {}
        else:
            from_pandas_kwargs = {'preserve_index': index}

        if self._pyarrow_lt_060:
            table = self.api.Table.from_pandas(df, timestamps_to_ms=True,
                                               **from_pandas_kwargs)
            self.api.parquet.write_table(
                table, path, compression=compression, **kwargs)

        else:
            table = self.api.Table.from_pandas(df, **from_pandas_kwargs)
            self.api.parquet.write_table(
                table, path, compression=compression,
                coerce_timestamps=coerce_timestamps, **kwargs)

    def read(self, path, columns=None, **kwargs):
        path, _, _, should_close = get_filepath_or_buffer(path)
        if self._pyarrow_lt_070:
            result = self.api.parquet.read_pandas(path, columns=columns,
                                                  **kwargs).to_pandas()
        else:
            kwargs['use_pandas_metadata'] = True
            result = self.api.parquet.read_table(path, columns=columns,
                                                 **kwargs).to_pandas()
        if should_close:
            try:
                path.close()
            except:  # noqa: flake8
                pass

        return result

    def _validate_write_lt_070(self, df):
        # Compatibility shim for pyarrow < 0.7.0
        # TODO: Remove in pandas 0.23.0
        from pandas.core.indexes.multi import MultiIndex
        if isinstance(df.index, MultiIndex):
            msg = (
                "Multi-index DataFrames are only supported "
                "with pyarrow >= 0.7.0"
            )
            raise ValueError(msg)
        # Validate index
        if not isinstance(df.index, Int64Index):
            msg = (
                "pyarrow < 0.7.0 does not support serializing {} for the "
                "index; you can .reset_index() to make the index into "
                "column(s), or install the latest version of pyarrow or "
                "fastparquet."
            )
            raise ValueError(msg.format(type(df.index)))
        if not df.index.equals(RangeIndex(len(df))):
            raise ValueError(
                "pyarrow < 0.7.0 does not support serializing a non-default "
                "index; you can .reset_index() to make the index into "
                "column(s), or install the latest version of pyarrow or "
                "fastparquet."
            )
        if df.index.name is not None:
            raise ValueError(
                "pyarrow < 0.7.0 does not serialize indexes with a name; you "
                "can set the index.name to None or install the latest version "
                "of pyarrow or fastparquet."
            )

class FastParquetImpl(BaseImpl):

    def __init__(self):
        # since pandas is a dependency of fastparquet
        # we need to import on first use
        try:
            import fastparquet
        except ImportError:
            raise ImportError(
                "fastparquet is required for parquet support\n\n"
                "you can install via conda\n"
                "conda install fastparquet -c conda-forge\n"
                "\nor via pip\n"
                "pip install -U fastparquet"
            )
        if LooseVersion(fastparquet.__version__) < '0.1.0':
            raise ImportError(
                "fastparquet >= 0.1.0 is required for parquet "
                "support\n\n"
                "you can install via conda\n"
                "conda install fastparquet -c conda-forge\n"
                "\nor via pip\n"
                "pip install -U fastparquet"
            )
        self.api = fastparquet

    def write(self, df, path, compression='snappy', index=None, **kwargs):
        self.validate_dataframe(df)
        # thriftpy/protocol/compact.py:339:
        # DeprecationWarning: tostring() is deprecated.
        # Use tobytes() instead.

        if is_s3_url(path):
            # path is s3:// so we need to open the s3file in 'wb' mode.
            # TODO: Support 'ab'

            path, _, _, _ = get_filepath_or_buffer(path, mode='wb')
            # And pass the opened s3file to the fastparquet internal impl.
            kwargs['open_with'] = lambda path, _: path
        else:
            path, _, _, _ = get_filepath_or_buffer(path)

        with catch_warnings(record=True):
            self.api.write(path, df, compression=compression,
                           write_index=index, **kwargs)

    def read(self, path, columns=None, **kwargs):
        if is_s3_url(path):
            # When path is s3:// an S3File is returned.
            # We need to retain the original path(str) while also
            # pass the S3File().open function to fsatparquet impl.
            s3, _, _, should_close = get_filepath_or_buffer(path)
            try:
                parquet_file = self.api.ParquetFile(path, open_with=s3.s3.open)
            finally:
                s3.close()
        else:
            path, _, _, _ = get_filepath_or_buffer(path)
            parquet_file = self.api.ParquetFile(path)

        return parquet_file.to_pandas(columns=columns, **kwargs)

def to_parquet(df, path, engine='auto', compression='snappy', index=None,
               **kwargs):
    """
    Write a DataFrame to the parquet format.

    Parameters
    ----------
    df : DataFrame
    path : string
        File path
    engine : {'auto', 'pyarrow', 'fastparquet'}, default 'auto'
        Parquet library to use. If 'auto', then the option
        ``io.parquet.engine`` is used. The default ``io.parquet.engine``
        behavior is to try 'pyarrow', falling back to 'fastparquet' if
        'pyarrow' is unavailable.
    compression : {'snappy', 'gzip', 'brotli', None}, default 'snappy'
        Name of the compression to use. Use ``None`` for no compression.
    index : bool, default None
        If ``True``, include the dataframe's index(es) in the file output. If
        ``False``, they will not be written to the file. If ``None``, the
        engine's default behavior will be used.

        .. versionadded 0.24.0
    kwargs
        Additional keyword arguments passed to the engine
    """
    impl = get_engine(engine)
    return impl.write(df, path, compression=compression, index=index, **kwargs)

def read_parquet(path, engine='auto', columns=None, **kwargs):
    """
    Load a parquet object from the file path, returning a DataFrame.

    .. versionadded 0.21.0

    Parameters
    ----------
    path : string
        File path
    columns: list, default=None
        If not None, only these columns will be read from the file.

        .. versionadded 0.21.1
    engine : {'auto', 'pyarrow', 'fastparquet'}, default 'auto'
        Parquet library to use. If 'auto', then the option
        ``io.parquet.engine`` is used. The default ``io.parquet.engine``
        behavior is to try 'pyarrow', falling back to 'fastparquet' if
        'pyarrow' is unavailable.
    kwargs are passed to the engine

    Returns
    -------
    DataFrame

    """

    impl = get_engine(engine)
    return impl.read(path, columns=columns, **kwargs)


text:
<?xml version="1.0" encoding="UTF-8"?>
<!--  Copyright (C) 2008 The Android Open Source Project

     Licensed under the Apache License, Version 2.0 (the "License");
     you may not use this file except in compliance with the License.
     You may obtain a copy of the License at

          http://www.apache.org/licenses/LICENSE-2.0

     Unless required by applicable law or agreed to in writing, software
     distributed under the License is distributed on an "AS IS" BASIS,
     WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
     See the License for the specific language governing permissions and
     limitations under the License.
 -->

<resources xmlns:android="http://schemas.android.com/apk/res/android"
    xmlns:xliff="urn:oasis:names:tc:xliff:document:1.2">
    <string name="exchange_name_alternate" msgid="5772529644749041052">"Microsoft Exchange ActiveSync"</string>
    <string name="meeting_accepted" msgid="8796609373330400268">"Geaccepteerd: <xliff:g id="SUBJECT">%s</xliff:g>"</string>
    <string name="meeting_declined" msgid="6707617183246608552">"Afgewezen: <xliff:g id="SUBJECT">%s</xliff:g>"</string>
    <string name="meeting_tentative" msgid="8250995722130443785">"Voorlopig: <xliff:g id="SUBJECT">%s</xliff:g>"</string>
    <string name="meeting_canceled" msgid="3949893881872084244">"Geannuleerd: <xliff:g id="SUBJECT">%s</xliff:g>"</string>
    <string name="meeting_updated" msgid="8529675857361702860">"Bijgewerkt: <xliff:g id="SUBJECT">%s</xliff:g>"</string>
    <string name="meeting_when" msgid="2765696159697448656">"Wanneer: <xliff:g id="WHEN">%s</xliff:g>"</string>
    <string name="meeting_where" msgid="5992367535856553079">"Waar: <xliff:g id="WHERE">%s</xliff:g>"</string>
    <string name="meeting_recurring" msgid="3134262212606714023">"Wanneer: <xliff:g id="EVENTDATE">%s</xliff:g> (herhalen)"</string>
    <string name="meeting_allday" msgid="6696389765484663513">"Wanneer: <xliff:g id="EVENTDATE">%s</xliff:g> (hele dag)"</string>
    <string name="meeting_allday_recurring" msgid="2320264182781062684">"Wanneer: <xliff:g id="EVENTDATE">%s</xliff:g> (hele dag, herhalen)"</string>
    <string name="notification_exchange_calendar_added" msgid="6823659622379350159">"Exchange-agenda toegevoegd"</string>
    <string name="app_name" msgid="5316597712787122829">"Exchange Services"</string>
    <string name="exception_cancel" msgid="6160117429428313805">"Deze afspraak is geannuleerd voor: <xliff:g id="DATE">%s</xliff:g>"</string>
    <string name="exception_updated" msgid="3397583105901142050">"De details van deze afspraak zijn gewijzigd voor: <xliff:g id="DATE">%s</xliff:g>"</string>
    <string name="policy_dont_allow_storage_cards" msgid="2765447013574188473">"Geheugenkaarten niet toestaan"</string>
    <string name="policy_dont_allow_unsigned_apps" msgid="4896164334956001479">"Niet-ondertekende apps niet toestaan"</string>
    <string name="policy_dont_allow_unsigned_installers" msgid="1326544905185523540">"Niet-ondertekende appinstallers weigeren"</string>
    <string name="policy_dont_allow_wifi" msgid="3109487776704143995">"Wifi niet toestaan"</string>
    <string name="policy_dont_allow_text_messaging" msgid="7846141657345860427">"Sms\'en niet toestaan"</string>
    <string name="policy_dont_allow_pop_imap" msgid="4702932192358698651">"POP3- of IMAP-accounts niet toestaan"</string>
    <string name="policy_dont_allow_irda" msgid="1848561629495912430">"Infraroodcommunicatie niet toestaan"</string>
    <string name="policy_dont_allow_html" msgid="5888652525907651489">"HTML-e-mail niet toestaan"</string>
    <string name="policy_dont_allow_browser" msgid="1018764395507493616">"Browsers niet toestaan"</string>
    <string name="policy_dont_allow_consumer_email" msgid="6958427300686692292">"Consumenten-e-mail niet toestaan"</string>
    <string name="policy_dont_allow_internet_sharing" msgid="2370083814654927695">"Internet delen niet toestaan"</string>
    <string name="policy_require_smime" msgid="673557150920820590">"SMIME-berichten vereisen"</string>
    <string name="policy_bluetooth_restricted" msgid="5248824127186039567">"Het gebruik van Bluetooth beperken"</string>
    <string name="policy_app_blacklist" msgid="8169194058285873461">"Opgegeven apps niet toestaan"</string>
    <string name="policy_app_whitelist" msgid="3670572644342165306">"Alleen opgegeven apps toestaan"</string>
    <string name="policy_text_truncation" msgid="1783448050735715818">"Tekstgrootte van e-mail beperken"</string>
    <string name="policy_html_truncation" msgid="102158408055486343">"Grootte van HTML-e-mails beperken"</string>
    <string name="policy_require_sd_encryption" msgid="366468398301273342">"Codering van SD-kaart vereisen"</string>
    <string name="policy_dont_allow_attachments" msgid="6250520458670348907">"Bijlagen niet toestaan"</string>
    <string name="policy_max_attachment_size" msgid="4020279603050888661">"Grootte van bijlagen beperken"</string>
    <string name="policy_require_manual_sync_roaming" msgid="6637416341015662148">"Alleen handm. synchr. toestn bij roaming"</string>
    <string name="policy_require_encryption" msgid="7984702283392885348">"Apparaatencryptie vereisen"</string>
    <string name="account_setup_options_mail_window_auto" msgid="4188895354366183790">"Automatisch"</string>
    <string name="account_setup_options_mail_window_1day" msgid="3965715241135811407">"Eén dag"</string>
    <string name="account_setup_options_mail_window_3days" msgid="736181102295878114">"Drie dagen"</string>
    <string name="account_setup_options_mail_window_1week" msgid="5639718031108023741">"Eén week"</string>
    <string name="account_setup_options_mail_window_2weeks" msgid="4567049268124213035">"Twee weken"</string>
    <string name="account_setup_options_mail_window_1month" msgid="5846359669750047081">"Eén maand"</string>
    <string name="account_setup_options_mail_window_all" msgid="5372861827683632364">"Alles"</string>
</resources>


text:
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
    package="com.travelcheck"
    android:versionCode="5"
    android:versionName="1.4" >

    <uses-sdk
        android:minSdkVersion="11"
        android:targetSdkVersion="17" />

    <supports-screens
        android:largeScreens="true"
        android:normalScreens="true"
        android:smallScreens="true"
        android:xlargeScreens="true" />

    <uses-permission android:name="android.permission.INTERNET" />
    <uses-permission android:name="com.google.android.providers.gsf.permission.READ_GSERVICES" />
    <uses-permission android:name="android.permission.ACCESS_NETWORK_STATE" />
    <uses-permission android:name="android.permission.ACCESS_COARSE_LOCATION" />
    <uses-permission android:name="android.permission.READ_CONTACTS" />
    <uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE" />
    <uses-permission android:name="android.permission.ACCESS_FINE_LOCATION" />

    <!-- Required OpenGL ES 2.0. for Maps V2 -->
    <uses-feature
        android:glEsVersion="0x00020000"
        android:required="true" />
    <uses-permission android:name="android.permission.CALL_PHONE"/>

    <application
        android:name="com.travelcheck.UILApplication"
        android:allowBackup="true"
        android:icon="@drawable/app_logo_final"
        android:label="@string/app_name" >
        <activity
            android:name="com.travelcheck.SplashActivity"
            android:configChanges="orientation|keyboardHidden"
            android:label="@string/app_name"
            android:screenOrientation="portrait"
            android:theme="@android:style/Theme.NoTitleBar.Fullscreen"
            android:windowSoftInputMode="stateHidden" >
            <intent-filter>
                <action android:name="android.intent.action.MAIN" />

                <category android:name="android.intent.category.LAUNCHER" />
            </intent-filter>
        </activity>
        <activity android:name="com.travelcheck.UserSettingsActivity"
             />

        <activity
            android:name="com.travelcheck.FavouritesContacts"
            android:configChanges="orientation|keyboardHidden"
            android:icon="@drawable/menu"
            android:screenOrientation="portrait"
            android:windowSoftInputMode="adjustPan" />
        <activity
            android:name="com.travelcheck.MainActivity"
            android:configChanges="orientation|keyboardHidden"
            android:icon="@drawable/menu"
            android:screenOrientation="portrait"
            android:windowSoftInputMode="adjustPan" />

        <activity
            android:name="com.travelcheck.Follow_me"
            android:configChanges="orientation|keyboardHidden"
            android:icon="@drawable/menu"
            android:screenOrientation="portrait"
            android:windowSoftInputMode="adjustPan" />

        <!-- Goolge Maps API Key -->
        <meta-data
            android:name="com.google.android.maps.v2.API_KEY"
            android:value="AIzaSyCWKIDSDzaOrDwD0bmoLekyE9wYIB7mg9Y" />

    </application>

</manifest>


text:
module Arel
  module Nodes
    class Grouping < Unary
      include Arel::Predications
    end
  end
end


text:
<?php

namespace ClientFavorite\Service;

use ClientFavorite\Entity\FavoriteEntity;

/**
 *
 * @author jaimie <pacificnm@gmail.com>
 * @version 2.5.0
 *
 */
interface FavoriteServiceInterface
{

    /**
     *
     * @param array $filter
     * @return FavoriteEntity
     */
    public function getAll($filter);

    /**
     *
     * @param number $id
     * @return FavoriteEntity
     */
    public function get($id);

    /**
     *
     * @param FavoriteEntity $entity
     * @return FavoriteEntity
     */
    public function save(FavoriteEntity $entity);

    /**
     *
     * @param FavoriteEntity $entity
     * @return boolean
     */
    public function delete(FavoriteEntity $entity);

    /**
     *
     * @param number $clientId
     * @param number $authId
     * @return boolean
     */
    public function hasFavorite($clientId, $authId);
}


text:
void initialize()
{
    InitializeFuzzingContext();
}

void test_one_input(const std::vector<uint8_t>& buffer)
{
    FuzzedDataProvider fuzzed_data_provider{buffer.data(), buffer.size()};
    FuzzedFileProvider fuzzed_file_provider = ConsumeFile(fuzzed_data_provider);
    FILE* fuzzed_block_file = fuzzed_file_provider.open();
    if (fuzzed_block_file == nullptr) {
        return;
    }
    FlatFilePos flat_file_pos;
    LoadExternalBlockFile(Params(), fuzzed_block_file, fuzzed_data_provider.ConsumeBool() ? &flat_file_pos : nullptr);
}


text:
#ifndef QMITKTHRESHOLDACTION_H
#define QMITKTHRESHOLDACTION_H

#include <org_mitk_gui_qt_segmentation_Export.h>

// Parent classes
#include <QObject>
#include <mitkIContextMenuAction.h>

// Data members
#include <mitkDataStorage.h>
#include <mitkToolManager.h>

class MITK_QT_SEGMENTATION QmitkThresholdAction : public QObject, public mitk::IContextMenuAction
{
  Q_OBJECT
  Q_INTERFACES(mitk::IContextMenuAction)

public:
  QmitkThresholdAction();
  ~QmitkThresholdAction();

  // IContextMenuAction
  void Run(const QList<mitk::DataNode::Pointer> &selectedNodes);
  void SetDataStorage(mitk::DataStorage *dataStorage);
  void SetSmoothed(bool smoothed);
  void SetDecimated(bool decimated);
  void SetFunctionality(berry::QtViewPart *functionality);

  void OnThresholdingToolManagerToolModified();

private:
  QmitkThresholdAction(const QmitkThresholdAction &);
  QmitkThresholdAction & operator=(const QmitkThresholdAction &);

  mitk::DataNode::Pointer m_SelectedNode;
  mitk::DataStorage::Pointer m_DataStorage;
  mitk::ToolManager::Pointer m_ThresholdingToolManager;
};

#endif


text:
using DogAgilityCompetition.Circe;

namespace DogAgilityCompetition.Controller.Engine.Visualization.Changes;

/// <summary>
/// A visualization change that updates/clears the number of faults.
/// </summary>
public sealed class FaultCountUpdate : NullableVisualizationChange<int?>
{
    public static FaultCountUpdate Hidden => new(null);
    public static FaultCountUpdate Zero => new(0);

    public FaultCountUpdate(int? value)
        : base(value)
    {
    }

    public override void ApplyTo(IVisualizationActor actor)
    {
        Guard.NotNull(actor, nameof(actor));
        actor.SetOrClearFaultCount(Value);
    }
}


text:
package org.gradle.api.internal.artifacts.dsl;

import com.google.common.collect.Lists;
import org.gradle.api.Action;
import org.gradle.api.InvalidUserCodeException;
import org.gradle.api.Transformer;
import org.gradle.api.artifacts.ComponentMetadata;
import org.gradle.api.artifacts.ComponentMetadataContext;
import org.gradle.api.artifacts.ComponentMetadataDetails;
import org.gradle.api.artifacts.ModuleVersionIdentifier;
import org.gradle.api.artifacts.VariantMetadata;
import org.gradle.api.artifacts.component.ComponentIdentifier;
import org.gradle.api.attributes.AttributeContainer;
import org.gradle.api.internal.artifacts.ComponentMetadataProcessor;
import org.gradle.api.internal.artifacts.MetadataResolutionContext;
import org.gradle.api.internal.artifacts.dsl.dependencies.PlatformSupport;
import org.gradle.api.internal.artifacts.ivyservice.ivyresolve.UserProvidedMetadata;
import org.gradle.api.internal.artifacts.repositories.resolver.ComponentMetadataDetailsAdapter;
import org.gradle.api.internal.artifacts.repositories.resolver.DependencyConstraintMetadataImpl;
import org.gradle.api.internal.artifacts.repositories.resolver.DirectDependencyMetadataImpl;
import org.gradle.api.internal.attributes.AttributeContainerInternal;
import org.gradle.api.internal.attributes.ImmutableAttributesFactory;
import org.gradle.api.internal.project.ProjectInternal;
import org.gradle.internal.Actions;
import org.gradle.internal.action.ConfigurableRule;
import org.gradle.internal.action.DefaultConfigurableRules;
import org.gradle.internal.action.InstantiatingAction;
import org.gradle.internal.component.external.model.ModuleComponentResolveMetadata;
import org.gradle.internal.component.external.model.MutableModuleComponentResolveMetadata;
import org.gradle.internal.component.external.model.VariantDerivationStrategy;
import org.gradle.internal.component.external.model.ivy.DefaultIvyModuleResolveMetadata;
import org.gradle.internal.component.external.model.ivy.RealisedIvyModuleResolveMetadata;
import org.gradle.internal.component.external.model.maven.DefaultMavenModuleResolveMetadata;
import org.gradle.internal.component.external.model.maven.RealisedMavenModuleResolveMetadata;
import org.gradle.internal.reflect.Instantiator;
import org.gradle.internal.resolve.ModuleVersionResolveException;
import org.gradle.internal.resolve.caching.ComponentMetadataRuleExecutor;
import org.gradle.internal.rules.RuleAction;
import org.gradle.internal.rules.SpecRuleAction;
import org.gradle.internal.serialize.InputStreamBackedDecoder;
import org.gradle.internal.serialize.OutputStreamBackedEncoder;
import org.gradle.internal.serialize.Serializer;
import org.gradle.internal.typeconversion.NotationParser;

import java.io.ByteArrayInputStream;
import java.io.ByteArrayOutputStream;
import java.io.IOException;
import java.util.ArrayList;
import java.util.Collection;
import java.util.List;

public class DefaultComponentMetadataProcessor implements ComponentMetadataProcessor {

    private final static boolean FORCE_REALIZE = Boolean.getBoolean("org.gradle.integtest.force.realize.metadata");

    private static final Transformer<ModuleComponentResolveMetadata, WrappingComponentMetadataContext> DETAILS_TO_RESULT = componentMetadataContext -> {
        ModuleComponentResolveMetadata metadata = componentMetadataContext
            .getImmutableMetadataWithDerivationStrategy(componentMetadataContext.getVariantDerivationStrategy());
        return realizeMetadata(metadata);
    };

    private ModuleComponentResolveMetadata maybeForceRealisation(ModuleComponentResolveMetadata metadata) {
        if (FORCE_REALIZE) {
            metadata = realizeMetadata(metadata);
            metadata = forceSerialization(metadata);
        }
        return metadata;
    }

    private static ModuleComponentResolveMetadata realizeMetadata(ModuleComponentResolveMetadata metadata) {
        if (metadata instanceof DefaultIvyModuleResolveMetadata) {
            metadata = RealisedIvyModuleResolveMetadata.transform((DefaultIvyModuleResolveMetadata) metadata);
        } else if (metadata instanceof DefaultMavenModuleResolveMetadata) {
            metadata = RealisedMavenModuleResolveMetadata.transform((DefaultMavenModuleResolveMetadata) metadata);
        } else {
            throw new IllegalStateException("Invalid type received: " + metadata.getClass());
        }
        return metadata;
    }

    private ModuleComponentResolveMetadata forceSerialization(ModuleComponentResolveMetadata metadata) {
        Serializer<ModuleComponentResolveMetadata> serializer = ruleExecutor.getComponentMetadataContextSerializer();
        ByteArrayOutputStream byteArrayOutputStream = new ByteArrayOutputStream();
        byte[] bytes;
        try {
            serializer.write(new OutputStreamBackedEncoder(byteArrayOutputStream), metadata);
            bytes = byteArrayOutputStream.toByteArray();
        } catch (Exception e) {
            throw new RuntimeException(e);
        } finally {
            try {
                byteArrayOutputStream.close();
            } catch (IOException e) {
                throw new RuntimeException(e);
            }
        }
        try {
            ModuleComponentResolveMetadata forceRead = serializer.read(new InputStreamBackedDecoder(new ByteArrayInputStream(bytes)));
            // TODO: CC cannot enable this assertion because moduleSource is not serialized, so doesn't appear in the deserialized form
            //assert metadata.equals(forceRead);
            metadata = forceRead;
        } catch (Exception e) {
            throw new RuntimeException(e);
        }
        return metadata;
    }

    private final Instantiator instantiator;
    private final NotationParser<Object, DirectDependencyMetadataImpl> dependencyMetadataNotationParser;
    private final NotationParser<Object, DependencyConstraintMetadataImpl> dependencyConstraintMetadataNotationParser;
    private final NotationParser<Object, ComponentIdentifier> componentIdentifierNotationParser;
    private final ImmutableAttributesFactory attributesFactory;
    private final ComponentMetadataRuleExecutor ruleExecutor;
    private final MetadataResolutionContext metadataResolutionContext;
    private final ComponentMetadataRuleContainer metadataRuleContainer;
    private final PlatformSupport platformSupport;

    public DefaultComponentMetadataProcessor(ComponentMetadataRuleContainer metadataRuleContainer,
                                             Instantiator instantiator,
                                             NotationParser<Object, DirectDependencyMetadataImpl> dependencyMetadataNotationParser,
                                             NotationParser<Object, DependencyConstraintMetadataImpl> dependencyConstraintMetadataNotationParser,
                                             NotationParser<Object, ComponentIdentifier> componentIdentifierNotationParser,
                                             ImmutableAttributesFactory attributesFactory,
                                             ComponentMetadataRuleExecutor ruleExecutor,
                                             PlatformSupport platformSupport,
                                             MetadataResolutionContext resolutionContext) {
        this.metadataRuleContainer = metadataRuleContainer;
        this.instantiator = instantiator;
        this.dependencyMetadataNotationParser = dependencyMetadataNotationParser;
        this.dependencyConstraintMetadataNotationParser = dependencyConstraintMetadataNotationParser;
        this.componentIdentifierNotationParser = componentIdentifierNotationParser;
        this.attributesFactory = attributesFactory;
        this.ruleExecutor = ruleExecutor;
        this.platformSupport = platformSupport;
        this.metadataResolutionContext = resolutionContext;
    }

    @Override
    public ModuleComponentResolveMetadata processMetadata(ModuleComponentResolveMetadata origin) {
        VariantDerivationStrategy curStrategy = metadataRuleContainer.getVariantDerivationStrategy();
        ModuleComponentResolveMetadata metadata = origin.withDerivationStrategy(curStrategy);
        ModuleComponentResolveMetadata updatedMetadata;
        if (metadataRuleContainer.isEmpty()) {
            updatedMetadata = maybeForceRealisation(metadata);
        } else if (metadataRuleContainer.isClassBasedRulesOnly()) {
            Action<ComponentMetadataContext> action = collectRulesAndCreateAction(metadataRuleContainer.getOnlyClassRules(), metadata.getModuleVersionId(), metadataResolutionContext.getInjectingInstantiator());
            if (action instanceof InstantiatingAction) {
                InstantiatingAction<ComponentMetadataContext> ia = (InstantiatingAction<ComponentMetadataContext>) action;
                if (shouldCacheComponentMetadataRule(ia, metadata)) {
                    updatedMetadata = processClassRuleWithCaching(ia, metadata, metadataResolutionContext);
                } else {
                    MutableModuleComponentResolveMetadata mutableMetadata = metadata.asMutable();
                    processClassRule(action, metadata, createDetails(mutableMetadata));
                    updatedMetadata = maybeForceRealisation(mutableMetadata.asImmutable());
                }
            } else {
                updatedMetadata = maybeForceRealisation(metadata);
            }
        } else {
            MutableModuleComponentResolveMetadata mutableMetadata = metadata.asMutable();
            ComponentMetadataDetails details = createDetails(mutableMetadata);
            processAllRules(metadata, details, metadata.getModuleVersionId());
            updatedMetadata = maybeForceRealisation(mutableMetadata.asImmutable());
        }

        if (!updatedMetadata.getStatusScheme().contains(updatedMetadata.getStatus())) {
            throw new ModuleVersionResolveException(updatedMetadata.getModuleVersionId(), () -> String.format("Unexpected status '%s' specified for %s. Expected one of: %s", updatedMetadata.getStatus(), updatedMetadata.getId().getDisplayName(), updatedMetadata.getStatusScheme()));
        }
        return updatedMetadata;
    }

    private boolean shouldCacheComponentMetadataRule(InstantiatingAction<ComponentMetadataContext> action, ModuleComponentResolveMetadata metadata) {
        return action.getRules().isCacheable() && metadata.isComponentMetadataRuleCachingEnabled();
    }

    protected ComponentMetadataDetails createDetails(MutableModuleComponentResolveMetadata mutableMetadata) {
        return instantiator.newInstance(ComponentMetadataDetailsAdapter.class, mutableMetadata, instantiator, dependencyMetadataNotationParser, dependencyConstraintMetadataNotationParser, componentIdentifierNotationParser, platformSupport);
    }

    @Override
    public ComponentMetadata processMetadata(ComponentMetadata metadata) {
        ComponentMetadata updatedMetadata;
        if (metadataRuleContainer.isEmpty()) {
            updatedMetadata = metadata;
        } else {
            ShallowComponentMetadataAdapter details = new ShallowComponentMetadataAdapter(componentIdentifierNotationParser, metadata, attributesFactory);
            processAllRules(null, details, metadata.getId());
            updatedMetadata = details.asImmutable();
        }
        if (!updatedMetadata.getStatusScheme().contains(updatedMetadata.getStatus())) {
            throw new ModuleVersionResolveException(updatedMetadata.getId(), () -> String.format("Unexpected status '%s' specified for %s. Expected one of: %s", updatedMetadata.getStatus(), updatedMetadata.getId().toString(), updatedMetadata.getStatusScheme()));
        }
        return updatedMetadata;
    }

    @Override
    public int getRulesHash() {
        return metadataRuleContainer.getRulesHash();
    }

    private void processAllRules(ModuleComponentResolveMetadata metadata, ComponentMetadataDetails details, ModuleVersionIdentifier id) {
        for (MetadataRuleWrapper wrapper : metadataRuleContainer) {
            if (wrapper.isClassBased()) {
                Collection<SpecConfigurableRule> rules = wrapper.getClassRules();
                Action<ComponentMetadataContext> action = collectRulesAndCreateAction(rules, id, metadataResolutionContext.getInjectingInstantiator());
                processClassRule(action, metadata, details);
            } else {
                processRule(wrapper.getRule(), metadata, details);
            }
        }
    }

    private void processClassRule(Action<ComponentMetadataContext> action, final ModuleComponentResolveMetadata metadata, final ComponentMetadataDetails details) {
        DefaultComponentMetadataContext componentMetadataContext = new DefaultComponentMetadataContext(details, metadata);
        try {
            action.execute(componentMetadataContext);
        } catch (InvalidUserCodeException e) {
            throw e;
        } catch (Exception e) {
            throw new InvalidUserCodeException(String.format("There was an error while evaluating a component metadata rule for %s.", details.getId()), e);
        }
    }

    private ModuleComponentResolveMetadata processClassRuleWithCaching(InstantiatingAction<ComponentMetadataContext> action, final ModuleComponentResolveMetadata metadata, MetadataResolutionContext metadataResolutionContext) {
        try {
            return ruleExecutor.execute(metadata, action, DETAILS_TO_RESULT,
                moduleVersionIdentifier -> new WrappingComponentMetadataContext(metadata, instantiator, dependencyMetadataNotationParser, dependencyConstraintMetadataNotationParser, componentIdentifierNotationParser, platformSupport), metadataResolutionContext.getCachePolicy());
        } catch (InvalidUserCodeException e) {
            throw e;
        } catch (Exception e) {
            throw new InvalidUserCodeException(String.format("There was an error while evaluating a component metadata rule for %s.", metadata.getModuleVersionId()), e);
        }
    }

    private Action<ComponentMetadataContext> collectRulesAndCreateAction(Collection<SpecConfigurableRule> rules, ModuleVersionIdentifier id, Instantiator instantiator) {
        if (rules.isEmpty()) {
            return Actions.doNothing();
        }
        ArrayList<ConfigurableRule<ComponentMetadataContext>> collectedRules = new ArrayList<>();
        for (SpecConfigurableRule classBasedRule : rules) {
            if (classBasedRule.getSpec().isSatisfiedBy(id)) {
                collectedRules.add(classBasedRule.getConfigurableRule());
            }
        }
        return new InstantiatingAction<>(new DefaultConfigurableRules<>(collectedRules), instantiator, new ExceptionHandler());
    }

    private void processRule(SpecRuleAction<? super ComponentMetadataDetails> specRuleAction, ModuleComponentResolveMetadata metadata, final ComponentMetadataDetails details) {
        if (!specRuleAction.getSpec().isSatisfiedBy(details)) {
            return;
        }
        final RuleAction<? super ComponentMetadataDetails> action = specRuleAction.getAction();
        if (!shouldExecute(action, metadata)) {
            return;
        }

        List<?> inputs = gatherAdditionalInputs(action, metadata);
        executeAction(action, inputs, details);
    }

    private void executeAction(RuleAction<? super ComponentMetadataDetails> action, List<?> inputs, ComponentMetadataDetails details) {
        try {
            synchronized (this) {
                action.execute(details, inputs);
            }
        } catch (InvalidUserCodeException e) {
            throw e;
        } catch (Exception e) {
            throw new InvalidUserCodeException(String.format("There was an error while evaluating a component metadata rule for %s.", details.getId()), e);
        }
    }

    private boolean shouldExecute(RuleAction<? super ComponentMetadataDetails> action, ModuleComponentResolveMetadata metadata) {
        List<Class<?>> inputTypes = action.getInputTypes();
        if (!inputTypes.isEmpty()) {
            return inputTypes.stream().anyMatch(input -> MetadataDescriptorFactory.isMatchingMetadata(input, metadata));
        }
        return true;
    }

    private List<?> gatherAdditionalInputs(RuleAction<? super ComponentMetadataDetails> action, ModuleComponentResolveMetadata metadata) {
        final List<Object> inputs = Lists.newArrayList();
        for (Class<?> inputType : action.getInputTypes()) {
            MetadataDescriptorFactory descriptorFactory = new MetadataDescriptorFactory(metadata);
            Object descriptor = descriptorFactory.createDescriptor(inputType);
            if (descriptor != null) {
                inputs.add(descriptor);
            }
        }
        return inputs;
    }

    private static class ExceptionHandler implements InstantiatingAction.ExceptionHandler<ComponentMetadataContext> {

        @Override
        public void handleException(ComponentMetadataContext context, Throwable throwable) {
            throw new InvalidUserCodeException(String.format("There was an error while evaluating a component metadata rule for %s.", context.getDetails().getId()), throwable);
        }
    }

    static class ShallowComponentMetadataAdapter implements ComponentMetadataDetails {
        private final NotationParser<Object, ComponentIdentifier> componentIdentifierNotationParser;
        private final ModuleVersionIdentifier id;
        private boolean changing;
        private List<String> statusScheme;
        private final AttributeContainerInternal attributes;

        public ShallowComponentMetadataAdapter(NotationParser<Object, ComponentIdentifier> componentIdentifierNotationParser, ComponentMetadata source, ImmutableAttributesFactory attributesFactory) {
            this.componentIdentifierNotationParser = componentIdentifierNotationParser;
            id = source.getId();
            changing = source.isChanging();
            statusScheme = source.getStatusScheme();
            attributes = attributesFactory.mutable((AttributeContainerInternal) source.getAttributes());
        }

        @Override
        public void setChanging(boolean changing) {
            this.changing = changing;
        }

        @Override
        public void setStatus(String status) {
            this.attributes.attribute(ProjectInternal.STATUS_ATTRIBUTE, status);
        }

        @Override
        public void setStatusScheme(List<String> statusScheme) {
            this.statusScheme = statusScheme;
        }

        @Override
        public void withVariant(String name, Action<? super VariantMetadata> action) {

        }

        @Override
        public void allVariants(Action<? super VariantMetadata> action) {

        }

        @Override
        public void addVariant(String name, Action<? super VariantMetadata> action) {

        }

        @Override
        public void addVariant(String name, String base, Action<? super VariantMetadata> action) {

        }

        @Override
        public void maybeAddVariant(String name, String base, Action<? super VariantMetadata> action) {

        }

        @Override
        public void belongsTo(Object notation) {

        }

        @Override
        public void belongsTo(Object notation, boolean virtual) {

        }

        @Override
        public ModuleVersionIdentifier getId() {
            return id;
        }

        @Override
        public boolean isChanging() {
            return changing;
        }

        @Override
        public String getStatus() {
            return attributes.getAttribute(ProjectInternal.STATUS_ATTRIBUTE);
        }

        @Override
        public List<String> getStatusScheme() {
            return statusScheme;
        }

        @Override
        public ComponentMetadataDetails attributes(Action<? super AttributeContainer> action) {
            action.execute(attributes);
            return this;
        }

        @Override
        public AttributeContainer getAttributes() {
            return attributes;
        }

        public ComponentMetadata asImmutable() {
            return new UserProvidedMetadata(id, statusScheme, attributes.asImmutable());
        }
    }
}


text:
<?php
/**
 * Forum repository decorator, providing caching of forums.
 *
 * @author    MyBB Group
 * @version   2.0.0
 * @package   mybb/core
 * @license   http://www.mybb.com/licenses/bsd3 BSD-3
 */

namespace MyBB\Core\Database\Repositories\Decorators\Forum;

use Illuminate\Contracts\Auth\Guard;
use Illuminate\Contracts\Cache\Repository as CacheRepository;
use Illuminate\Database\Eloquent\Collection;
use MyBB\Core\Database\Models\{
    Forum, Post, Topic
};
use MyBB\Core\Database\Repositories\ForumRepositoryInterface;
use MyBB\Core\Permissions\PermissionChecker;

class CachingDecorator implements ForumRepositoryInterface
{
    /**
     * @var ForumRepositoryInterface
     */
    private $decoratedRepository;

    /**
     * @var CacheRepository
     */
    private $cache;

    /**
     * @var PermissionChecker
     */
    private $permissionChecker;

    /**
     * @var Guard
     */
    private $guard;

    /**
     * @param ForumRepositoryInterface $decorated
     * @param CacheRepository $cache
     * @param PermissionChecker $permissionChecker
     * @param Guard $guard
     */
    public function __construct(
        ForumRepositoryInterface $decorated,
        CacheRepository $cache,
        PermissionChecker $permissionChecker,
        Guard $guard
    ) {
        $this->decoratedRepository = $decorated;
        $this->cache = $cache;
        $this->permissionChecker = $permissionChecker;
        $this->guard = $guard;
    }

    /**
     * Get all forums.
     *
     * @return mixed
     */
    public function all()
    {
        if (($forums = $this->cache->get('forums.all')) == null) {
            $forums = $this->decoratedRepository->all();
            $this->cache->forever('forums.all', $forums);
        }

        return $forums;
    }

    /**
     * Get a single forum by ID.
     *
     * @param int $id The ID of the forum.
     *
     * @return mixed
     */
    public function find(int $id = 0)
    {
        return $this->decoratedRepository->find($id);
    }

    /**
     * Get a single forum by slug (name, sluggified, eg: 'my-first-forum').
     *
     * @param string $slug The slug for the forum.
     *
     * @return mixed
     */
    public function findBySlug(string $slug = '')
    {
        return $this->decoratedRepository->findBySlug($slug);
    }

    /**
     * Get the forum tree for the index, consisting of root forums (categories), and one level of descendants.
     *
     * @param bool $checkPermissions
     *
     * @return mixed
     */
    public function getIndexTree(bool $checkPermissions = true)
    {
        if (($forums = $this->cache->get('forums.index_tree')) == null) {
            $forums = $this->decoratedRepository->getIndexTree(false);
            $this->cache->forever('forums.index_tree', $forums);
        }

        if ($checkPermissions) {
            $forums = $this->filterUnviewableForums($forums);
        }

        return $forums;
    }

    /**
     * Increment the number of posts in the forum by one.
     *
     * @param int $id The ID of the forum to increment the post count for.
     *
     * @return mixed
     */
    public function incrementPostCount(int $id = 0)
    {
        // TODO: It'd be better to update the cache instead of forgetting it
        $this->cache->forget('forums.index_tree');
        $this->cache->forget('forums.all');

        return $this->decoratedRepository->incrementPostCount($id);
    }

    /**
     * Increment the number of topics in the forum by one.
     *
     * @param int $id The ID of the forum to increment the topic count for.
     *
     * @return mixed
     */
    public function incrementTopicCount(int $id = 0)
    {
        // TODO: It'd be better to update the cache instead of forgetting it
        $this->cache->forget('forums.index_tree');
        $this->cache->forget('forums.all');

        return $this->decoratedRepository->incrementTopicCount($id);
    }

    /**
     * Update the last post for this forum
     *
     * @param Forum $forum The forum to update
     * @param Post $post
     *
     * @return void
     */
    public function updateLastPost(Forum $forum, Post $post = null)
    {
        // TODO: It'd be better to update the cache instead of forgetting it
        $this->cache->forget('forums.index_tree');
        $this->cache->forget('forums.all');
        $this->decoratedRepository->updateLastPost($forum, $post);
    }

    /**
     * Filters a forum collection by the "canView" permission
     *
     * @param Collection $forums
     *
     * @return Collection
     */
    private function filterUnviewableForums(Collection $forums) : Collection
    {
        return $forums->filter(function (Forum $forum) {
            return $this->permissionChecker->hasPermission(
                'forum',
                $forum->getContentId(),
                $forum::getViewablePermission(),
                $this->guard->user()
            );
        });
    }

    /**
     * @param Topic $topic
     * @param Forum $forum
     */
    public function moveTopicToForum(Topic $topic, Forum $forum)
    {
        $this->cache->forget('forums.index_tree');
        $this->cache->forget('forums.all');

        return $this->decoratedRepository->moveTopicToForum($topic, $forum);
    }

    /**
     * {@inheritdoc}
     */
    public function create(array $details = [])
    {
        $this->cache->forget('forums.index_tree');
        $this->cache->forget('forums.all');

        return $this->decoratedRepository->create($details);
    }

    /**
     * {@inheritdoc}
     */
    public function getForum(int $id)
    {
        return $this->decoratedRepository->getForum($id);
    }

    /**
     * {@inheritdoc}
     */
    public function isEmpty() : bool
    {
        return $this->decoratedRepository->isEmpty();
    }

    /**
     * {@inheritdoc}
     */
    public function delete(Forum $forum) : bool
    {
        $this->cache->forget('forums.index_tree');
        $this->cache->forget('forums.all');

        return $this->decoratedRepository->delete($forum);
    }

    /**
     * {@inheritdoc}
     */
    public function update(Forum $forum, $details)
    {
        $this->cache->forget('forums.index_tree');
        $this->cache->forget('forums.all');

        return $this->decoratedRepository->update($forum, $details);
    }

    /**
     * {@inheritdoc}
     */
    public function changeParent(Forum $forum, int $newParent)
    {
        $this->decoratedRepository->changeParent($forum, $newParent);
        $this->cache->forget('forums.index_tree');
        return $this->cache->forget('forums.all');
    }

    /**
     * {@inheritdoc}
     */
    public function onlyChildren()
    {
        return $this->decoratedRepository->onlyChildren();
    }
}


text:
module VipAlert
  class Settings
    include Singleton

    attr_reader :account, :config

    def initialize
      settings = YAML::load(File.open("config.yml"))
      account  = settings["account"]
      @account = Account.new(account["email"],
                             account["password"],
                             account["phone"],
                             account["twillo_token"],
                             account["twillo_sid"],
                             account["twillo_phone"])
      @config  = Config.new(settings["vips"])
    end
  end
end


text:
package be.eliwan.tapestry5.high.test;

import com.thoughtworks.selenium.Wait;
import org.apache.tapestry5.test.SeleniumTestCase;
import org.testng.annotations.Test;

public class HighchartsOneRequestTest extends SeleniumTestCase {

    @Test
    public void testJSFile() throws Exception {
        open("/HighchartsOneRequest");

        //Thread.sleep(600000);

        new Wait() {

            @Override
            public boolean until() {
                return isElementPresent("//head/script[contains(@src,'highcharts.src.js')]");
            }
        }.wait("The Highcharts JavaScript file is missing.", 50000l);
    }
}


text:
export type Assertion<T>   = (actual: T) => PromiseLike<void>;
export type Expectation<T> = (expected: T) => Assertion<T>;


text:
package net.bytebuddy.agent;

import net.bytebuddy.test.utility.MockitoRule;
import org.junit.After;
import org.junit.Before;
import org.junit.Rule;
import org.junit.Test;
import org.junit.rules.TestRule;
import org.mockito.Mock;

import java.lang.instrument.Instrumentation;
import java.lang.reflect.Constructor;
import java.lang.reflect.Field;
import java.lang.reflect.InvocationTargetException;

import static org.hamcrest.CoreMatchers.is;
import static org.hamcrest.MatcherAssert.assertThat;
import static org.junit.Assert.fail;

public class ByteBuddyAgentInstallerTest {

    private static final String FOO = "foo";

    private static final String INSTRUMENTATION = "instrumentation";

    private static final Object STATIC_FIELD = null;

    @Rule
    public final TestRule mockitoRule = new MockitoRule(this);

    @Mock
    private Instrumentation instrumentation;

    private Instrumentation actualInstrumentation;

    @Before
    public void setUp() throws Exception {
        Field field = ByteBuddyAgent.Installer.class.getDeclaredField(INSTRUMENTATION);
        field.setAccessible(true);
        actualInstrumentation = (Instrumentation) field.get(STATIC_FIELD);
    }

    @After
    public void tearDown() throws Exception {
        Field field = ByteBuddyAgent.Installer.class.getDeclaredField(INSTRUMENTATION);
        field.setAccessible(true);
        field.set(STATIC_FIELD, actualInstrumentation);
    }

    @Test
    public void testPreMain() throws Exception {
        ByteBuddyAgent.Installer.premain(FOO, instrumentation);
        assertThat(ByteBuddyAgent.getInstrumentation(), is(instrumentation));
    }

    @Test
    public void testAgentMain() throws Exception {
        ByteBuddyAgent.Installer.agentmain(FOO, instrumentation);
        assertThat(ByteBuddyAgent.getInstrumentation(), is(instrumentation));
    }

    @Test(expected = UnsupportedOperationException.class)
    public void testConstructorThrowsException() throws Exception {
        Constructor<?> constructor = ByteBuddyAgent.Installer.class.getDeclaredConstructor();
        constructor.setAccessible(true);
        try {
            constructor.newInstance();
            fail();
        } catch (InvocationTargetException e) {
            throw (Exception) e.getCause();
        }
    }
}