Fix issues with loadObject
authorMathieu Baudier <mbaudier@argeo.org>
Wed, 11 Nov 2009 13:18:45 +0000 (13:18 +0000)
committerMathieu Baudier <mbaudier@argeo.org>
Wed, 11 Nov 2009 13:18:45 +0000 (13:18 +0000)
git-svn-id: https://svn.argeo.org/commons/trunk@3084 4cfe0d0a-d680-48aa-b62c-e0a02a3f76cc

server/runtime/org.argeo.server.jxl/src/main/java/org/argeo/server/jxl/dao/JxlDaoSupport.java

index 79fa2a606efb0d699b9cc0f4a5d46dd11ad43218..64bcf03dc46e4f82aa72dd72289f49c9ab31a704 100644 (file)
@@ -215,6 +215,8 @@ public class JxlDaoSupport extends AbstractTabularDaoSupport implements
                                        for (int col = 1; col < currentRow.length; col++) {
                                                subKeys.add(getCellValue(currentRow[col]));
                                        }
+                                       if (log.isTraceEnabled())
+                                               log.trace("   subKeys=" + subKeys);
                                        row++;
                                        String firstColContents = firstColumn[row].getContents();
                                        mapRows: for (; row < firstColumn.length; row++) {
@@ -223,9 +225,9 @@ public class JxlDaoSupport extends AbstractTabularDaoSupport implements
                                                Object key = firstColContents;
                                                Map<Object, Object> subMap = new HashMap<Object, Object>();
 
-                                               for (int col = 0; col < currentRow.length
-                                                               && col < subKeys.size(); col++) {
-                                                       Object subKey = subKeys.get(col);
+                                               for (int col = 1; col < currentRow.length
+                                                               && col < subKeys.size() + 1; col++) {
+                                                       Object subKey = subKeys.get(col - 1);
                                                        Cell cell = currentRow[col];
                                                        if (log.isTraceEnabled())
                                                                log.trace("   row=" + row
@@ -244,6 +246,7 @@ public class JxlDaoSupport extends AbstractTabularDaoSupport implements
                                                if (bw.isWritableProperty(firstColContents)
                                                                || firstColContents.trim().equals("")
                                                                || row == firstColumn.length - 1) {
+                                                       log.trace(map);
                                                        bw.setPropertyValue(propertyName, map);
                                                        if (log.isTraceEnabled())
                                                                log.trace(" set map " + propertyName