Browse Source

Fix reading of Properties with multiple value blocks (issue 96)

git-svn-id: https://svn.code.sf.net/p/jackcess/code/jackcess/branches/jackcess-1.2.14@779 f203690c-595d-4dc9-a70b-905162fa7fd2
tags/jackcess-1.2.14.2
James Ahlborn 10 years ago
parent
commit
1eb7bb4bc2

+ 5
- 0
src/changes/changes.xml View File

<author email="javajedi@users.sf.net">Tim McCune</author> <author email="javajedi@users.sf.net">Tim McCune</author>
</properties> </properties>
<body> <body>
<release version="1.2.14.2" date="TBD">
<action dev="jahlborn" type="fix" system="SourceForge2" issue="96">
Fix reading of Properties with multiple value blocks.
</action>
</release>
<release version="1.2.14.1" date="2013-08-11"> <release version="1.2.14.1" date="2013-08-11">
<action dev="jahlborn" type="fix" system="SourceForge2Features" <action dev="jahlborn" type="fix" system="SourceForge2Features"
issue="25"> issue="25">

+ 18
- 0
src/java/com/healthmarketscience/jackcess/PropertyMap.java View File

return _props.values().iterator(); return _props.values().iterator();
} }


PropertyMap merge(PropertyMap opm) {
if(opm == null) {
return this;
}

// merge into least map type
PropertyMap dest = opm;
PropertyMap src = this;
if(dest._mapType < src._mapType) {
dest = this;
src = opm;
}

dest._props.putAll(src._props);

return dest;
}

@Override @Override
public String toString() { public String toString() {
StringBuilder sb = new StringBuilder(); StringBuilder sb = new StringBuilder();

+ 3
- 5
src/java/com/healthmarketscience/jackcess/PropertyMaps.java View File

* Adds the given PropertyMap to this group. * Adds the given PropertyMap to this group.
*/ */
public void put(PropertyMap map) { public void put(PropertyMap map) {
_maps.put(Database.toLookupName(map.getName()), map);
String mapName = Database.toLookupName(map.getName());
_maps.put(mapName, map.merge(_maps.get(mapName)));
} }


public Iterator<PropertyMap> iterator() { public Iterator<PropertyMap> iterator() {


if(type == PROPERTY_NAME_LIST) { if(type == PROPERTY_NAME_LIST) {
propNames = readPropertyNames(bbBlock); propNames = readPropertyNames(bbBlock);
} else if((type == DEFAULT_PROPERTY_VALUE_LIST) ||
(type == COLUMN_PROPERTY_VALUE_LIST)) {
maps.put(readPropertyValues(bbBlock, propNames, type));
} else { } else {
throw new IOException("Unknown property block type " + type);
maps.put(readPropertyValues(bbBlock, propNames, type));
} }


bb.position(endPos); bb.position(endPos);

Loading…
Cancel
Save