Hao Zhong created ARIES-1749:
--------------------------------
Summary: WarToWabConverterImpl_updateBundleManifest can put
duplicated items
Key: ARIES-1749
URL: https://issues.apache.org/jira/browse/ARIES-1749
Project: Aries
Issue Type: Bug
Reporter: Hao Zhong
The WarToWabConverterImpl_updateBundleManifest method has the following code:
{code:java}
protected Manifest updateBundleManifest(Manifest manifest) throws IOException {
...
webCPath = addSlash(webCPath);
manifest.getMainAttributes().put(new
Attributes.Name(WEB_CONTEXT_PATH), webCPath);
}
{code}
Here, getMainAttributes().put does not check whether the added item already
exists, so duplicated items can be added. ARIES-958 fixed a similar problem.
The buggy code is
{code:java}
public static Manifest parseManifest(InputStream in) throws IOException{
...
if (namedAttribute == null) {
man.getMainAttributes().put(new Attributes.Name(attributeName),
attributeValue);
} else {
man.getAttributes(namedAttribute).put(new
Attributes.Name(attributeName), attributeValue);
}
{code}
The fixed code is
{code:java}
public static Manifest parseManifest(InputStream in) throws IOException{
...
Attributes.Name nameToAdd = new Attributes.Name(attributeName);
if (namedAttribute == null ||
!man.getMainAttributes().containsKey(nameToAdd)) {
man.getMainAttributes().put(nameToAdd, attributeValue);
} else {
man.getAttributes(namedAttribute).put(nameToAdd, attributeValue);
}
}
}
{code}
--
This message was sent by Atlassian JIRA
(v6.4.14#64029)