Class JNLPMatcher


  • public final class JNLPMatcher
    extends java.lang.Object
    To compare launching JNLP file with signed APPLICATION.JNLP or APPLICATION_TEMPLATE.jnlp.

    Used by net.sourceforge.jnlp.runtime.JNLPCLassLoader

    • Constructor Summary

      Constructors 
      Constructor Description
      JNLPMatcher​(java.io.InputStream appTemplate, java.io.InputStream launchJNLP, boolean isTemplate, ParserSettings p)
      Public constructor
    • Method Summary

      All Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      private void closeInputStream​(java.io.InputStream stream)
      Closes an input stream
      private void closeOutputStream​(java.io.OutputStream stream)
      Closes an output stream
      boolean isMatch()
      Compares both JNLP files
      private boolean matchAttributes​(XmlNode templateNode, XmlNode launchNode)
      Compares attributes of two Nodes regardless of order
      private boolean matchNodes​(XmlNode appTemplate, XmlNode launchJNLP)
      Compares two Nodes regardless of the order of their children/attributes
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • Field Detail

      • LOG

        private static final Logger LOG
      • appTemplateNode

        private final XmlNode appTemplateNode
      • launchJNLPNode

        private final XmlNode launchJNLPNode
      • isTemplate

        private final boolean isTemplate
    • Constructor Detail

      • JNLPMatcher

        public JNLPMatcher​(java.io.InputStream appTemplate,
                           java.io.InputStream launchJNLP,
                           boolean isTemplate,
                           ParserSettings p)
                    throws JNLPMatcherException
        Public constructor
        Parameters:
        appTemplate - the reader stream of the signed APPLICATION.jnlp or APPLICATION_TEMPLATE.jnlp
        launchJNLP - the reader stream of the launching JNLP file
        isTemplate - a boolean that specifies if appTemplateFile is a template
        p - settings of parser
        Throws:
        JNLPMatcherException - if IOException, XMLParseException is thrown during parsing; Or launchJNLP/appTemplate is null
    • Method Detail

      • isMatch

        public boolean isMatch()
        Compares both JNLP files
        Returns:
        true if both JNLP files are 'matched', otherwise false
      • matchNodes

        private boolean matchNodes​(XmlNode appTemplate,
                                   XmlNode launchJNLP)
        Compares two Nodes regardless of the order of their children/attributes
        Parameters:
        appTemplate - signed application or template's Node
        launchJNLP - launching JNLP file's Node
        Returns:
        true if both Nodes are 'matched', otherwise false
      • matchAttributes

        private boolean matchAttributes​(XmlNode templateNode,
                                        XmlNode launchNode)
        Compares attributes of two Nodes regardless of order
        Parameters:
        templateNode - signed application or template's XmlNode with attributes
        launchNode - launching JNLP file's XmlNode with attributes
        Returns:
        true if both Nodes have 'matched' attributes, otherwise false
      • closeInputStream

        private void closeInputStream​(java.io.InputStream stream)
        Closes an input stream
        Parameters:
        stream - The input stream that will be closed
      • closeOutputStream

        private void closeOutputStream​(java.io.OutputStream stream)
        Closes an output stream
        Parameters:
        stream - The output stream that will be closed