craigwblake / redline

Pure Java Rpm Library
http://redline-rpm.org
MIT License
128 stars 97 forks source link

Support for Header types other than String is not provided #103

Open sc1478 opened 8 years ago

sc1478 commented 8 years ago

I am trying to implement a method for putting a changelog into an RPM. From studying the C source code of rpm, it is clear that this involves creating headers. At least one of these headers must be of Integer type. Given the current codebase, this is not possible. The only method for adding a header through the Builder is

`public void addHeaderEntry( final Tag tag, final String value)`

which means that all value, regardless of the type implied in the Tag parameter must be passed in as a String. The code invoked by this method in AbstractHeader.java

`public Entry< String[]> createEntry( Tag tag, CharSequence value) {`

creates an Entry of the proper type implied by the tag parameter, but makes no attempt to convert the value parameter to an object of that type, resulting in ClassCastException being thrown, making the above-mentioned effort to add changelogs impossible as the code is currently implemented.