jcabi / jcabi-manifests

Java library for convenient reading of MANIFEST.MF files available in classpath
https://manifests.jcabi.com
Other
60 stars 22 forks source link

Not getting correct value #34

Open lamikam opened 8 years ago

lamikam commented 8 years ago

I have generated a new attribute "SCM-Revision" in the war file mainfest.mf. war file is in an ear file:

Manifest-Version: 1.0 Implementation-Title: XXX Implementation-Version: 1.0 SCM-Revision: 5792 Archiver-Version: Plexus Archiver

WHen I callManifests.exists("SCM-Revision"); it returns false.

Any clue why?

dmarkov commented 8 years ago

@yegor256 please take a look at it and dispatch (see par.21)

yegor256 commented 8 years ago

@lamikam I have no idea. it has to work. maybe the MANIFEST.MF file is not in the classpath?

proshin-roman commented 6 years ago

@lamikam I faced with this issue too and got a self-explained error message:

Caused by: java.lang.IllegalArgumentException: Attribute 'SCM-Revision' not found in MANIFEST.MF file(s) among 68 other attribute(s): ["Agent-Class", "Ant-Version", "Archiver-Version", "Automatic-Module-Name", "Bnd-LastModified", "Build-Jdk", "Build-Timestamp", "Built-By", "Bundle-ContactAddress", "Bundle-Description", "Bundle-DocURL", "Bundle-License", "Bundle-ManifestVersion", "Bundle-Name", "Bundle-RequiredExecutionEnvironment", "Bundle-SymbolicName", "Bundle-Vendor", "Bundle-Version", "Can-Redefine-Classes", "Can-Retransform-Classes", "Can-Set-Native-Method-Prefix", "Created-By", "DSTAMP", "DynamicImport-Package", "Export-Package", "Extension-Name", "Extension-name", "Implementation-Build", "Implementation-Build-Date", "Implementation-Title", "Implementation-URL", "Implementation-Vendor", "Implementation-Vendor-Id", "Implementation-Version", "Import-Package", "Include-Resource", "Ion-Java-Build-Time", "Ion-Java-Project-Version", "JCabi-Build", "JCabi-Date", "JCabi-Version", "Java-Vendor", "Java-Version", "Lombok-Version", "Main-Class", "Manifest-Version", "Name", "Originally-Created-By", "Os-Arch", "Os-Name", "Os-Version", "Package", "Premain-Class", "Private-Package", "Require-Capability", "Scm-Connection", "Scm-Revision", "Scm-Url", "Specification-Title", "Specification-Vendor", "Specification-Version", "TODAY", "TSTAMP", "Time-Zone-Database-Version", "Tool", "X-Compile-Source-JDK", "X-Compile-Target-JDK", "url"] at com.jcabi.manifests.Manifests.read(Manifests.java:274) ~[jcabi-manifests-1.1.jar:na]

As you can see there is an attribute "Scm-Revision" - see the difference with the original "SCM-Revision"? I couldn't find any info if this "CamelCase" is a requirement for MANIFEST.MF (at least the library itself doesn't change the case of attributes). But I would suggest to fix the library so that it considers attributes case-insensitively.