Class Verifier

    • Field Detail

      • dot

        private final Jar dot
      • manifest

        private final java.util.jar.Manifest manifest
      • main

        private final Domain main
      • r3

        private boolean r3
      • usesRequire

        private boolean usesRequire
      • EENAME

        static final java.util.regex.Pattern EENAME
      • EES

        public static final java.lang.String[] EES
      • ReservedFileNames

        public static final java.util.regex.Pattern ReservedFileNames
      • CARDINALITY_PATTERN

        static final java.util.regex.Pattern CARDINALITY_PATTERN
      • RESOLUTION_PATTERN

        static final java.util.regex.Pattern RESOLUTION_PATTERN
      • BUNDLEMANIFESTVERSION

        static final java.util.regex.Pattern BUNDLEMANIFESTVERSION
      • TOKEN

        public static final java.util.regex.Pattern TOKEN
      • EXTENDED_P

        public static final java.util.regex.Pattern EXTENDED_P
      • QUOTEDSTRING_P

        public static final java.util.regex.Pattern QUOTEDSTRING_P
      • ARGUMENT_P

        public static final java.util.regex.Pattern ARGUMENT_P
      • SYMBOLICNAME_STRING

        public static final java.lang.String SYMBOLICNAME_STRING
        See Also:
        Constant Field Values
      • SYMBOLICNAME

        public static final java.util.regex.Pattern SYMBOLICNAME
      • VERSION

        public static final java.util.regex.Pattern VERSION
      • VERSION_P

        public static final java.util.regex.Pattern VERSION_P
      • VERSIONRANGE

        public static final java.util.regex.Pattern VERSIONRANGE
      • VERSIONRANGE_P

        public static final java.util.regex.Pattern VERSIONRANGE_P
      • FILTEROP

        static final java.util.regex.Pattern FILTEROP
      • FILE

        static final java.util.regex.Pattern FILE
      • WILDCARDPACKAGE

        static final java.util.regex.Pattern WILDCARDPACKAGE
      • ISO639

        public static final java.util.regex.Pattern ISO639
      • HEADER_PATTERN

        public static final java.util.regex.Pattern HEADER_PATTERN
      • NUMBERPATTERN

        public static final java.util.regex.Pattern NUMBERPATTERN
      • FLOATPATTERN

        public static final java.util.regex.Pattern FLOATPATTERN
      • BOOLEANPATTERN

        public static final java.util.regex.Pattern BOOLEANPATTERN
      • PACKAGEPATTERN

        public static final java.util.regex.Pattern PACKAGEPATTERN
      • PACKAGEPATTERN_OR_EMPTY

        public static final java.util.regex.Pattern PACKAGEPATTERN_OR_EMPTY
      • MULTIPACKAGEPATTERN

        public static final java.util.regex.Pattern MULTIPACKAGEPATTERN
      • PATHPATTERN

        public static final java.util.regex.Pattern PATHPATTERN
      • FQNPATTERN

        public static final java.util.regex.Pattern FQNPATTERN
      • URLPATTERN

        public static final java.util.regex.Pattern URLPATTERN
      • ANYPATTERN

        public static final java.util.regex.Pattern ANYPATTERN
      • FILTERPATTERN

        public static final java.util.regex.Pattern FILTERPATTERN
      • TRUEORFALSEPATTERN

        public static final java.util.regex.Pattern TRUEORFALSEPATTERN
      • WILDCARDNAMEPATTERN

        public static final java.util.regex.Pattern WILDCARDNAMEPATTERN
      • BUNDLE_ACTIVATIONPOLICYPATTERN

        public static final java.util.regex.Pattern BUNDLE_ACTIVATIONPOLICYPATTERN
      • OSNAMES

        public static final java.lang.String[] OSNAMES
      • PROCESSORNAMES

        public static final java.lang.String[] PROCESSORNAMES
      • frombuilder

        private boolean frombuilder
    • Constructor Detail

      • Verifier

        public Verifier​(Jar jar)
                 throws java.lang.Exception
        Throws:
        java.lang.Exception
      • Verifier

        public Verifier​(Analyzer analyzer)
                 throws java.lang.Exception
        Throws:
        java.lang.Exception
    • Method Detail

      • verifyHeaders

        private void verifyHeaders()
      • verifyNative

        public void verifyNative()
      • doNative

        public void doNative​(java.lang.String nc)
      • verifyFilter

        public boolean verifyFilter​(java.lang.String value)
      • validateFilter

        public static java.lang.String validateFilter​(java.lang.String value)
      • verifyActivator

        private void verifyActivator()
                              throws java.lang.Exception
        Throws:
        java.lang.Exception
      • registerActivatorErrorLocation

        private void registerActivatorErrorLocation​(Reporter.SetLocation location,
                                                    java.lang.String activator,
                                                    Verifier.ActivatorErrorType errorType)
                                             throws java.lang.Exception
        Throws:
        java.lang.Exception
      • verifyComponent

        private void verifyComponent()
      • verifyUnresolvedReferences

        private void verifyUnresolvedReferences()
                                         throws java.lang.Exception
        Check for unresolved imports. These are referrals that are not imported by the manifest and that are not part of our bundle class path. The are calculated by removing all the imported packages and contained from the referred packages.
        Throws:
        java.lang.Exception
      • hasOverlap

        private boolean hasOverlap​(java.util.Set<?> a,
                                   java.util.Set<?> b)
      • verify

        public void verify()
                    throws java.lang.Exception
        Throws:
        java.lang.Exception
      • doVerifierPlugins

        private void doVerifierPlugins()
      • verifyPathNames

        void verifyPathNames()
        Verify of the path names in the JAR are valid on all OS's (mainly windows)
      • verifyImports

        private void verifyImports()
        Verify that the imports properly use version ranges.
      • verifyExports

        private void verifyExports()
        Verify that the exports only use versions.
      • showUnicode

        private java.lang.Object showUnicode​(java.lang.String key)
      • verifyRequirements

        private void verifyRequirements()
                                 throws java.lang.IllegalArgumentException,
                                        java.lang.Exception
        Throws:
        java.lang.IllegalArgumentException
        java.lang.Exception
      • verifyAttrs

        void verifyAttrs​(java.lang.String key,
                         Attrs attrs)
        Parameters:
        attrs -
      • verifyCapabilities

        private void verifyCapabilities()
      • verifyNamespace

        private void verifyNamespace​(java.lang.String ns,
                                     java.lang.String type)
      • verify

        private void verify​(Attrs attrs,
                            java.lang.String ad,
                            java.util.regex.Pattern pattern,
                            boolean mandatory,
                            java.lang.String msg,
                            java.lang.String... args)
      • verifyType

        private void verifyType​(Attrs.Type type,
                                java.lang.String string)
      • verifyDirectives

        private void verifyDirectives​(java.lang.String header,
                                      java.lang.String directives,
                                      java.util.regex.Pattern namePattern,
                                      java.lang.String type)
                               throws java.lang.Exception
        Verify if the header does not contain any other directives
        Parameters:
        header -
        directives -
        namePattern -
        type -
        Throws:
        java.lang.Exception
      • verifyDirectives

        private void verifyDirectives​(java.lang.String header,
                                      java.util.function.Function<java.lang.String,​java.lang.String> directives,
                                      java.util.regex.Pattern namePattern,
                                      java.lang.String type)
                               throws java.lang.Exception
        Verify if the header does not contain any other directives
        Parameters:
        header -
        directives -
        namePattern -
        type -
        Throws:
        java.lang.Exception
      • verifyUses

        private void verifyUses()
        Verify the use clauses
      • verifyActivationPolicy

        public boolean verifyActivationPolicy()
      • verifyActivationPolicy

        public boolean verifyActivationPolicy​(java.lang.String policy)
      • verifyBundleClasspath

        public void verifyBundleClasspath()
      • verifyDynamicImportPackage

        private void verifyDynamicImportPackage()
                  DynamicImport-Package ::= dynamic-description
                      ( ',' dynamic-description )*
        
                  dynamic-description::= wildcard-names ( ';' parameter )*
                  wildcard-names ::= wildcard-name ( ';' wildcard-name )*
                  wildcard-name ::= package-name
                                 | ( package-name '.*' ) // See 1.4.2
                                 | '*'
         
      • verifyManifestFirst

        private void verifyManifestFirst()
      • verifySymbolicName

        private void verifySymbolicName()
      • isBsn

        public static boolean isBsn​(java.lang.String name)
        Parameters:
        name - the String to test
        Returns:
        true if the given name matches a Bundle Symbolic Name, otherwise false
      • verifyFilter

        public static int verifyFilter​(java.lang.String expr,
                                       int index)
                 filter ::= ’(’ filter-comp ’)’
                 filter-comp ::= and | or | not | operation
                 and ::= ’&’ filter-list
                 or ::= ’|’ filter-list
                 not ::= ’!’ filter
                 filter-list ::= filter | filter filter-list
                 operation ::= simple | present | substring
                 simple ::= attr filter-type value
                 filter-type ::= equal | approx | greater | less
                 equal ::= ’=’
                 approx ::= ’˜=’
                 greater ::= ’>=’
                 less ::= ’<=’
                 present ::= attr ’=*’
                 substring ::= attr ’=’ initial any final
                 inital ::= () | value
                 any ::= ’*’ star-value
                 star-value ::= () | value ’*’ star-value
                 final ::= () | value
                 value ::= <see text>
         
        Parameters:
        expr - the String to test
        index - the index within expr to start with
        Returns:
        the index of the last character within expr that was evaluated
      • verifyFilterOperation

        private static int verifyFilterOperation​(java.lang.String expr,
                                                 int index)
      • verifyHeader

        private boolean verifyHeader​(java.lang.String name,
                                     java.util.regex.Pattern regex,
                                     boolean error)
      • verify

        private static boolean verify​(java.lang.String value,
                                      java.util.regex.Pattern regex)
      • verifyListHeader

        private boolean verifyListHeader​(java.lang.String name,
                                         java.util.regex.Pattern regex,
                                         boolean error)
      • isVersion

        public static boolean isVersion​(java.lang.String version)
      • isIdentifier

        public static boolean isIdentifier​(java.lang.String value)
      • isMember

        public static boolean isMember​(java.lang.String value,
                                       java.lang.String[] matches)
      • isFQN

        public static boolean isFQN​(java.lang.String name)
      • verifyChecksums

        public void verifyChecksums​(boolean all)
                             throws java.lang.Exception
        Verify the checksums from the manifest against the real thing.
        Parameters:
        all - true if each resource must be digested, otherwise false
        Throws:
        java.lang.Exception
      • isExtended

        public static boolean isExtended​(java.lang.String key)
        Verify the EXTENDED_S syntax
        Parameters:
        key - the String to test
        Returns:
        true if the given String matches the EXTENDED_S syntax, otherwise false
      • isArgument

        public static boolean isArgument​(java.lang.String arg)
        Verify the ARGUMENT_S syntax
        Parameters:
        arg - the String to test
        Returns:
        true if the given String matches the ARGUMENT_S syntax, otherwise false
      • isQuotedString

        public static boolean isQuotedString​(java.lang.String s)
        Verify the QUOTEDSTRING syntax
        Parameters:
        s - the String to test
        Returns:
        true if the given String matches the QUOTEDSTRING syntax, otherwise false
      • isVersionRange

        public static boolean isVersionRange​(java.lang.String range)
        Verify the VERSION_RANGE_S syntax
        Parameters:
        range - the String to test
        Returns:
        true if the given String matches the VERSION_RANGE_S syntax, otherwise false
      • verifyMetaPersistence

        public void verifyMetaPersistence()
                                   throws java.lang.Exception
        Verify the Meta-Persistence header
        Throws:
        java.lang.Exception
      • isFrombuilder

        public boolean isFrombuilder()
        Returns:
        the frombuilder
      • setFrombuilder

        public void setFrombuilder​(boolean frombuilder)
        Parameters:
        frombuilder - the frombuilder to set
      • isNumber

        public static boolean isNumber​(java.lang.String number)