commons-issues mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Chris Molozian (Created) (JIRA)" <>
Subject [jira] [Created] (CONFIGURATION-480) Reading Manifest files using PropertiesConfiguration
Date Fri, 24 Feb 2012 11:27:48 GMT
Reading Manifest files using PropertiesConfiguration

                 Key: CONFIGURATION-480
             Project: Commons Configuration
          Issue Type: Bug
    Affects Versions: 1.7
            Reporter: Chris Molozian

I've searched through the documentation and online with Google. The documentation for PropertiesConfiguration
explains that it can parse files with '=' or ':' or ' ' as delimiters. I have a MANIFEST.MF
file with the following format:

Manifest-Version: 1.0
Implementation-Title: webapp
Implementation-Version: 0.0.1
Created-By: Gradle 1.0-milestone-6
Build-Jdk: 1.6.0_26


I've tried to use the PropertiesConfiguration to parse this file, assuming that the ' ' delimiter
would be used to divide key-value pairs. Instead I get the following error:

java.lang.IllegalArgumentException: Key for add operation must be defined!
	at org.apache.commons.configuration.tree.DefaultExpressionEngine.prepareAdd(
	at org.apache.commons.configuration.HierarchicalConfiguration.addPropertyDirect(
	at org.apache.commons.configuration.AbstractHierarchicalFileConfiguration.addPropertyDirect(
	at org.apache.commons.configuration.AbstractConfiguration.addPropertyValues(
	at org.apache.commons.configuration.AbstractConfiguration.append(

At the moment I've created a (very rough) custom PropertiesReader as suggested by the User
Guide for handling "unconventional formats".

private static class ManifestPropertiesReader
            extends PropertiesConfiguration.PropertiesReader {
    public ManifestPropertiesReader(final Reader in, final char delimiter) {
        super(in, delimiter);

    protected void parseProperty(final String line) {
        final int pos = line.indexOf(':');
        final String key = line.substring(0, pos).trim();
        final String value = line.substring(pos + 1).trim();



private static class ManifestIOFactory
        extends PropertiesConfiguration.DefaultIOFactory {
    /** Use a custom {@code PropertiesReader} for Manifest files. */
    public PropertiesReader createPropertiesReader(final Reader in,
            final char delimiter) {
        return new ManifestPropertiesReader(in, delimiter);

Should all this be necessary to parse MANIFEST.MF files or have I missed something?

This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators:!default.jspa
For more information on JIRA, see:


View raw message