Skip to main content
summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMarvin Mueller2016-02-24 07:35:40 +0000
committerSebastian Struckmann2016-03-01 09:25:19 +0000
commitf5b072bd5e64b0e91d8478ed26a78e0fc0722d07 (patch)
tree81b28cdfec419fd57c69925f89fb57e149a979aa
parent5c7d27069c50775c6b98b549d2331af80a6292e0 (diff)
downloadorg.eclipse.jubula.core-8.2.2.050.tar.gz
org.eclipse.jubula.core-8.2.2.050.tar.xz
org.eclipse.jubula.core-8.2.2.050.zip
Non-sprint task - fix for Bug 488218v8.2.2.050
We are now persisting the Unicode null symbol to the database instead of empty strings. This is necessary due to the fact that in an Oracle database an empty string is treated as null and therefore in the list are gaps between the data which are persisted that way. see http://eclip.se/488218 for more information Change-Id: If72e0fcd63490c43ab76f56f852e133c6abb7984
-rw-r--r--org.eclipse.jubula.client.archive/src/org/eclipse/jubula/client/archive/XmlExporter.java8
-rw-r--r--org.eclipse.jubula.client.archive/src/org/eclipse/jubula/client/archive/XmlImporter.java2
-rw-r--r--org.eclipse.jubula.client.core/src/org/eclipse/jubula/client/core/model/DataSetPO.java37
-rw-r--r--org.eclipse.jubula.client.core/src/org/eclipse/jubula/client/core/model/IDataSetPO.java4
-rw-r--r--org.eclipse.jubula.client.core/src/org/eclipse/jubula/client/core/model/ParamNodePO.java4
-rw-r--r--org.eclipse.jubula.client.core/src/org/eclipse/jubula/client/core/model/TDManagerPO.java10
-rw-r--r--org.eclipse.jubula.tools/src/org/eclipse/jubula/tools/internal/constants/StringConstants.java5
7 files changed, 52 insertions, 18 deletions
diff --git a/org.eclipse.jubula.client.archive/src/org/eclipse/jubula/client/archive/XmlExporter.java b/org.eclipse.jubula.client.archive/src/org/eclipse/jubula/client/archive/XmlExporter.java
index 7b1b21c34..858289301 100644
--- a/org.eclipse.jubula.client.archive/src/org/eclipse/jubula/client/archive/XmlExporter.java
+++ b/org.eclipse.jubula.client.archive/src/org/eclipse/jubula/client/archive/XmlExporter.java
@@ -1123,11 +1123,11 @@ class XmlExporter {
for (IDataSetPO row : po.getDataSets()) {
TestDataRow xmlRow = xml.addNewRow();
xmlRow.setRowCount(rowCnt++);
- int colCnt = 1;
- for (String td : row.getColumns()) {
+
+ for (int col = 0; col < row.getColumnCount(); col++) {
TestDataCell xmlCell = xmlRow.addNewData();
- xmlCell.setColumnCount(colCnt++);
- xmlCell.setValue(td);
+ xmlCell.setColumnCount(col + 1);
+ xmlCell.setValue(row.getValueAt(col));
}
}
}
diff --git a/org.eclipse.jubula.client.archive/src/org/eclipse/jubula/client/archive/XmlImporter.java b/org.eclipse.jubula.client.archive/src/org/eclipse/jubula/client/archive/XmlImporter.java
index 08173c12a..f92c88060 100644
--- a/org.eclipse.jubula.client.archive/src/org/eclipse/jubula/client/archive/XmlImporter.java
+++ b/org.eclipse.jubula.client.archive/src/org/eclipse/jubula/client/archive/XmlImporter.java
@@ -1831,7 +1831,7 @@ class XmlImporter {
}
List<String> tdList = null;
try {
- tdList = tdman.getDataSet(tdRow).getColumns();
+ tdList = tdman.getDataSet(tdRow).getColumnsCopy();
} catch (IndexOutOfBoundsException ioobe) {
// Component, Action, and/or Parameter could not be found in config xml
// only log and continue -> import of projects with missing plugins
diff --git a/org.eclipse.jubula.client.core/src/org/eclipse/jubula/client/core/model/DataSetPO.java b/org.eclipse.jubula.client.core/src/org/eclipse/jubula/client/core/model/DataSetPO.java
index 864610916..8c752683d 100644
--- a/org.eclipse.jubula.client.core/src/org/eclipse/jubula/client/core/model/DataSetPO.java
+++ b/org.eclipse.jubula.client.core/src/org/eclipse/jubula/client/core/model/DataSetPO.java
@@ -12,6 +12,7 @@ package org.eclipse.jubula.client.core.model;
import java.util.ArrayList;
import java.util.List;
+import java.util.ListIterator;
import javax.persistence.Basic;
import javax.persistence.CollectionTable;
@@ -27,6 +28,7 @@ import javax.persistence.Table;
import javax.persistence.Transient;
import javax.persistence.Version;
+import org.apache.commons.lang.StringUtils;
import org.eclipse.jubula.tools.internal.constants.StringConstants;
import org.eclipse.persistence.annotations.BatchFetch;
import org.eclipse.persistence.annotations.BatchFetchType;
@@ -62,6 +64,13 @@ class DataSetPO implements IDataSetPO {
if (list == null) {
setColumns(new ArrayList<String>());
} else {
+ // this is a workaround for null/or empty Strings in the list
+ for (ListIterator<String> iterator = list.listIterator(); iterator
+ .hasNext();) {
+ String string = iterator.next();
+ iterator.set(StringUtils.defaultIfEmpty(string,
+ StringConstants.UNICODE_NULL));
+ }
setColumns(list);
}
}
@@ -146,12 +155,17 @@ class DataSetPO implements IDataSetPO {
/** {@inheritDoc} */
public String getValueAt(int column) {
- return getColumns().get(column);
+ String value = getColumns().get(column);
+ if (StringConstants.UNICODE_NULL.equals(value)) {
+ return null;
+ }
+ return value;
}
/** {@inheritDoc} */
public void setValueAt(int column, String value) {
- getColumns().set(column, value);
+ getColumns().set(column, StringUtils.defaultIfEmpty(value,
+ StringConstants.UNICODE_NULL));
}
/** {@inheritDoc} */
@@ -162,7 +176,8 @@ class DataSetPO implements IDataSetPO {
/** {@inheritDoc} */
public void addColumn(String value) {
- getColumns().add(value);
+ getColumns().add(StringUtils.defaultIfEmpty(value,
+ StringConstants.UNICODE_NULL));
}
/** {@inheritDoc} */
@@ -181,7 +196,7 @@ class DataSetPO implements IDataSetPO {
@OrderColumn(name = "IDX")
@JoinColumn(name = "TEST_DATA_LIST_ID")
@BatchFetch(value = BatchFetchType.JOIN)
- public List<String> getColumns() {
+ private List<String> getColumns() {
return m_columns;
}
@@ -191,4 +206,18 @@ class DataSetPO implements IDataSetPO {
void setColumns(List<String> columns) {
m_columns = columns;
}
+
+ /** {@inheritDoc} */
+ @Transient
+ public List<String> getColumnsCopy() {
+ List<String> list = new ArrayList<String>(getColumnCount());
+ for (String string : getColumns()) {
+ if (StringConstants.UNICODE_NULL.equals(string)) {
+ list.add(null);
+ } else {
+ list.add(string);
+ }
+ }
+ return list;
+ }
}
diff --git a/org.eclipse.jubula.client.core/src/org/eclipse/jubula/client/core/model/IDataSetPO.java b/org.eclipse.jubula.client.core/src/org/eclipse/jubula/client/core/model/IDataSetPO.java
index 09804a9a7..cf74a3b36 100644
--- a/org.eclipse.jubula.client.core/src/org/eclipse/jubula/client/core/model/IDataSetPO.java
+++ b/org.eclipse.jubula.client.core/src/org/eclipse/jubula/client/core/model/IDataSetPO.java
@@ -21,9 +21,9 @@ import java.util.List;
*/
public interface IDataSetPO extends IPersistentObject {
/**
- * @return the list of columns
+ * @return a copy of the list of columns
*/
- public abstract List<String> getColumns();
+ public abstract List<String> getColumnsCopy();
/** @return empty string */
public abstract String getName();
diff --git a/org.eclipse.jubula.client.core/src/org/eclipse/jubula/client/core/model/ParamNodePO.java b/org.eclipse.jubula.client.core/src/org/eclipse/jubula/client/core/model/ParamNodePO.java
index 9c36fdc0f..728201fee 100644
--- a/org.eclipse.jubula.client.core/src/org/eclipse/jubula/client/core/model/ParamNodePO.java
+++ b/org.eclipse.jubula.client.core/src/org/eclipse/jubula/client/core/model/ParamNodePO.java
@@ -342,8 +342,8 @@ abstract class ParamNodePO extends NodePO implements IParamNodePO {
*/
private void addParamReferences(List <TDCell> references,
IDataSetPO row, int dataSetRow) {
- int col = 0;
- for (String testData : row.getColumns()) {
+ for (int col = 0; col < row.getColumnCount(); col++) {
+ String testData = row.getValueAt(col);
String uniqueId = getDataManager().getUniqueIds().get(col);
IParamDescriptionPO desc = getParameterForUniqueId(uniqueId);
ParamValueConverter conv = new ModelParamValueConverter(
diff --git a/org.eclipse.jubula.client.core/src/org/eclipse/jubula/client/core/model/TDManagerPO.java b/org.eclipse.jubula.client.core/src/org/eclipse/jubula/client/core/model/TDManagerPO.java
index e5bb19d0f..08f044105 100644
--- a/org.eclipse.jubula.client.core/src/org/eclipse/jubula/client/core/model/TDManagerPO.java
+++ b/org.eclipse.jubula.client.core/src/org/eclipse/jubula/client/core/model/TDManagerPO.java
@@ -414,7 +414,7 @@ class TDManagerPO implements ITDManager {
List<IDataSetPO> dataTable = getDataTable();
if (dataTable.size() > 0) {
IDataSetPO listW = dataTable.get(0);
- columns = listW.getColumns().size();
+ columns = listW.getColumnCount();
}
} catch (IndexOutOfBoundsException e) { // NOPMD by al on 3/19/07 1:37 PM
@@ -434,10 +434,10 @@ class TDManagerPO implements ITDManager {
}
tdMan.clear();
for (IDataSetPO dataSet : getDataSets()) {
- List<String> newRow = new ArrayList<String> (
- dataSet.getColumnCount());
- for (String testData : dataSet.getColumns()) {
- newRow.add(testData);
+ int columncount = dataSet.getColumnCount();
+ List<String> newRow = new ArrayList<String> (columncount);
+ for (int i = 0; i < columncount; i++) {
+ newRow.add(dataSet.getValueAt(i));
}
tdMan.insertDataSet(PoMaker.createListWrapperPO(newRow),
tdMan.getDataSetCount());
diff --git a/org.eclipse.jubula.tools/src/org/eclipse/jubula/tools/internal/constants/StringConstants.java b/org.eclipse.jubula.tools/src/org/eclipse/jubula/tools/internal/constants/StringConstants.java
index c9eea3a90..3a2817654 100644
--- a/org.eclipse.jubula.tools/src/org/eclipse/jubula/tools/internal/constants/StringConstants.java
+++ b/org.eclipse.jubula.tools/src/org/eclipse/jubula/tools/internal/constants/StringConstants.java
@@ -156,4 +156,9 @@ public interface StringConstants {
* <code>NULL</code>
*/
public static final String NULL = "NULL"; //$NON-NLS-1$
+
+ /**
+ * <code>NULL</code>
+ */
+ public static final String UNICODE_NULL = "\u0000"; //$NON-NLS-1$
}

Back to the top