Bug 412269 - XML dataset: BIRT selects wrong data (using xpath) [OLD BUG]
Bug 412269 - bump version of org.eclipse.datatools.enablement.oda.xml and org.eclipse.datatools.enablement.oda.feature to 1.4.102.qualifier

Signed-off-by: nickboldt <nboldt@redhat.com>
diff --git a/features/org.eclipse.datatools.enablement.oda.feature/feature.xml b/features/org.eclipse.datatools.enablement.oda.feature/feature.xml
index 0387a27..a44e5f4 100644
--- a/features/org.eclipse.datatools.enablement.oda.feature/feature.xml
+++ b/features/org.eclipse.datatools.enablement.oda.feature/feature.xml
@@ -2,7 +2,7 @@
 <feature
       id="org.eclipse.datatools.enablement.oda.feature"
       label="%featureName"
-      version="1.14.101.qualifier"
+      version="1.14.102.qualifier"
       provider-name="%providerName"
       plugin="org.eclipse.datatools.enablement.oda.xml"
       image="eclipse_update_120.jpg">
diff --git a/features/org.eclipse.datatools.enablement.oda.feature/pom.xml b/features/org.eclipse.datatools.enablement.oda.feature/pom.xml
index 5ba5afe..35856f4 100644
--- a/features/org.eclipse.datatools.enablement.oda.feature/pom.xml
+++ b/features/org.eclipse.datatools.enablement.oda.feature/pom.xml
@@ -7,6 +7,7 @@
     <artifactId>features</artifactId>
     <version>1.14.101-SNAPSHOT</version>
   </parent>
+  <version>1.14.102-SNAPSHOT</version>
   <groupId>org.eclipse.datatools.features</groupId>
   <artifactId>org.eclipse.datatools.enablement.oda.feature</artifactId>
   <packaging>eclipse-feature</packaging>
diff --git a/plugins/enablement/org.eclipse.datatools.enablement.oda.xml/META-INF/MANIFEST.MF b/plugins/enablement/org.eclipse.datatools.enablement.oda.xml/META-INF/MANIFEST.MF
index 2a14cde..23003ab 100644
--- a/plugins/enablement/org.eclipse.datatools.enablement.oda.xml/META-INF/MANIFEST.MF
+++ b/plugins/enablement/org.eclipse.datatools.enablement.oda.xml/META-INF/MANIFEST.MF
@@ -2,7 +2,7 @@
 Bundle-ManifestVersion: 2
 Bundle-Name: %plugin.name
 Bundle-SymbolicName: org.eclipse.datatools.enablement.oda.xml;singleton:=true
-Bundle-Version: 1.4.101.qualifier
+Bundle-Version: 1.4.102.qualifier
 Bundle-RequiredExecutionEnvironment: JavaSE-1.8
 Bundle-ClassPath: .
 Bundle-Vendor: Eclipse Data Tools Platform
diff --git a/plugins/enablement/org.eclipse.datatools.enablement.oda.xml/pom.xml b/plugins/enablement/org.eclipse.datatools.enablement.oda.xml/pom.xml
index b292912..e99991f 100644
--- a/plugins/enablement/org.eclipse.datatools.enablement.oda.xml/pom.xml
+++ b/plugins/enablement/org.eclipse.datatools.enablement.oda.xml/pom.xml
@@ -9,6 +9,6 @@
   </parent>
   <groupId>org.eclipse.datatools.plugins</groupId>
   <artifactId>org.eclipse.datatools.enablement.oda.xml</artifactId>
-  <version>1.4.101-SNAPSHOT</version>
+  <version>1.4.102-SNAPSHOT</version>
   <packaging>eclipse-plugin</packaging>
 </project>
diff --git a/plugins/enablement/org.eclipse.datatools.enablement.oda.xml/src/org/eclipse/datatools/enablement/oda/xml/util/SaxParser.java b/plugins/enablement/org.eclipse.datatools.enablement.oda.xml/src/org/eclipse/datatools/enablement/oda/xml/util/SaxParser.java
index cbc4779..962598a 100644
--- a/plugins/enablement/org.eclipse.datatools.enablement.oda.xml/src/org/eclipse/datatools/enablement/oda/xml/util/SaxParser.java
+++ b/plugins/enablement/org.eclipse.datatools.enablement.oda.xml/src/org/eclipse/datatools/enablement/oda/xml/util/SaxParser.java
@@ -315,6 +315,38 @@
 			spConsumer.manipulateData( pathHolder.getCurrentAttrPath( atts.getQName( i ) ),
 					atts.getValue( i ) );
 		}
+		
+		/* 
+		 * Workaround patch for https://bugs.eclipse.org/bugs/show_bug.cgi?id=412269
+		 * 
+		 * SaxParserConsumer.manipulateData() calls SaxParserConsumer.fillNotNestColumn() which is the cause of the bug.
+		 * 
+		 * This ODA SaxParser uses temporary XML columns as helper columns for xpath expressions which contain a filter.
+		 * In case the filter "matches" this xml sub-tree, the corresponding helper column will be set to the filter value.
+		 * This "marks" this temporary column that the filter matched.
+		 * As soon as the real column will be processed, it is checked whether the filter matched previously.
+		 * If so, the value will be assigned to the row.
+		 *  
+		 * The problem is: If the real column value will be processed before the filter column,
+		 * the value is not written to the row, hence the value is discarded.
+		 * Even more, the value from the next matching xml-subtree is used instead (=> wrong value used!)
+		 * 
+		 * This workaround just invokes the faulty method twice. After the first run,
+		 * all filter columns are set correctly set so the next pass will cause the mapping to be right.
+		 * 
+		 * This workaround should be replaced by a real fix which fixes the root cause of the problem (most probably 
+		 * refactoring the filter architecture of ODA datatools) as this workaround may degrade performance.
+		 * 
+		 * 
+		 */		
+		if(spConsumer instanceof SaxParserConsumer)
+		{
+			for ( int i = 0; i < atts.getLength( ); i++ )
+			{
+				spConsumer.manipulateData( pathHolder.getCurrentAttrPath( atts.getQName( i ) ),
+						atts.getValue( i ) );
+			}
+		}
 	}