aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJames Ahlborn <jtahlborn@yahoo.com>2013-08-16 01:06:27 +0000
committerJames Ahlborn <jtahlborn@yahoo.com>2013-08-16 01:06:27 +0000
commit790b943d773fc72a11089b6acaf17aa341f92ae4 (patch)
tree2f5b04fe80c8d0f4b441774d0ecae0b781b9a2ad
parent9b9e2af1aa4ada730d716aa03ab3ce8602ed932a (diff)
downloadjackcess-790b943d773fc72a11089b6acaf17aa341f92ae4.tar.gz
jackcess-790b943d773fc72a11089b6acaf17aa341f92ae4.zip
Fix reading of Properties with multiple value blocks (issue 96)
git-svn-id: https://svn.code.sf.net/p/jackcess/code/jackcess/trunk@780 f203690c-595d-4dc9-a70b-905162fa7fd2
-rw-r--r--src/changes/changes.xml5
-rw-r--r--src/java/com/healthmarketscience/jackcess/impl/PropertyMapImpl.java19
-rw-r--r--src/java/com/healthmarketscience/jackcess/impl/PropertyMaps.java8
3 files changed, 27 insertions, 5 deletions
diff --git a/src/changes/changes.xml b/src/changes/changes.xml
index 6886107..28c348f 100644
--- a/src/changes/changes.xml
+++ b/src/changes/changes.xml
@@ -4,6 +4,11 @@
<author email="javajedi@users.sf.net">Tim McCune</author>
</properties>
<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">
<action dev="jahlborn" type="fix" system="SourceForge2Features"
issue="25">
diff --git a/src/java/com/healthmarketscience/jackcess/impl/PropertyMapImpl.java b/src/java/com/healthmarketscience/jackcess/impl/PropertyMapImpl.java
index e267c9b..7b2b919 100644
--- a/src/java/com/healthmarketscience/jackcess/impl/PropertyMapImpl.java
+++ b/src/java/com/healthmarketscience/jackcess/impl/PropertyMapImpl.java
@@ -88,6 +88,25 @@ public class PropertyMapImpl implements PropertyMap
return _props.values().iterator();
}
+ public PropertyMapImpl merge(PropertyMapImpl opm) {
+ if(opm == null) {
+ return this;
+ }
+
+ // merge into least map type
+ PropertyMapImpl dest = opm;
+ PropertyMapImpl src = this;
+ if(dest._mapType < src._mapType) {
+ dest = this;
+ src = opm;
+ }
+
+ dest._props.putAll(src._props);
+
+ return dest;
+ }
+
+
@Override
public String toString() {
StringBuilder sb = new StringBuilder();
diff --git a/src/java/com/healthmarketscience/jackcess/impl/PropertyMaps.java b/src/java/com/healthmarketscience/jackcess/impl/PropertyMaps.java
index 41468aa..adc556b 100644
--- a/src/java/com/healthmarketscience/jackcess/impl/PropertyMaps.java
+++ b/src/java/com/healthmarketscience/jackcess/impl/PropertyMaps.java
@@ -101,7 +101,8 @@ public class PropertyMaps implements Iterable<PropertyMapImpl>
* Adds the given PropertyMap to this group.
*/
public void put(PropertyMapImpl map) {
- _maps.put(DatabaseImpl.toLookupName(map.getName()), map);
+ String mapName = DatabaseImpl.toLookupName(map.getName());
+ _maps.put(mapName, map.merge(_maps.get(mapName)));
}
public Iterator<PropertyMapImpl> iterator() {
@@ -179,11 +180,8 @@ public class PropertyMaps implements Iterable<PropertyMapImpl>
if(type == PROPERTY_NAME_LIST) {
propNames = readPropertyNames(bbBlock);
- } else if((type == DEFAULT_PROPERTY_VALUE_LIST) ||
- (type == COLUMN_PROPERTY_VALUE_LIST)) {
- maps.put(readPropertyValues(bbBlock, propNames, type));
} else {
- throw new IOException("Unknown property block type " + type);
+ maps.put(readPropertyValues(bbBlock, propNames, type));
}
bb.position(endPos);