summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorxma2007-07-20 03:52:38 (EDT)
committer xgu2007-07-20 03:52:38 (EDT)
commit3d9a6db88268f3999e8f4d9df72b15edf1a253f6 (patch)
tree3aa8ea719fcff4af4ee464dab5f4950ab885ec41
parenta01ce01235a73497ec60f098cb7c7b69689ef7e1 (diff)
downloadorg.eclipse.datatools.enablement.oda-3d9a6db88268f3999e8f4d9df72b15edf1a253f6.zip
org.eclipse.datatools.enablement.oda-3d9a6db88268f3999e8f4d9df72b15edf1a253f6.tar.gz
org.eclipse.datatools.enablement.oda-3d9a6db88268f3999e8f4d9df72b15edf1a253f6.tar.bz2
Fix Bugzilla Bug 196268
The XML driver should not parse the invalid XML file
-rw-r--r--plugins/org.eclipse.datatools.enablement.oda.xml/META-INF/MANIFEST.MF2
-rw-r--r--plugins/org.eclipse.datatools.enablement.oda.xml/src/org/eclipse/datatools/enablement/oda/xml/util/SaxParser.java14
-rw-r--r--plugins/org.eclipse.datatools.enablement.oda.xml/src/org/eclipse/datatools/enablement/oda/xml/util/ui/SchemaPopulationUtil.java4
3 files changed, 18 insertions, 2 deletions
diff --git a/plugins/org.eclipse.datatools.enablement.oda.xml/META-INF/MANIFEST.MF b/plugins/org.eclipse.datatools.enablement.oda.xml/META-INF/MANIFEST.MF
index 326f678..107f761 100644
--- a/plugins/org.eclipse.datatools.enablement.oda.xml/META-INF/MANIFEST.MF
+++ b/plugins/org.eclipse.datatools.enablement.oda.xml/META-INF/MANIFEST.MF
@@ -2,7 +2,7 @@ Manifest-Version: 1.0
Bundle-ManifestVersion: 2
Bundle-Name: %plugin.name
Bundle-SymbolicName: org.eclipse.datatools.enablement.oda.xml;singleton:=true
-Bundle-Version: 1.0.2.200707061
+Bundle-Version: 1.0.2.200707201
Bundle-ClassPath: .
Bundle-Vendor: Eclipse.org
Bundle-Localization: plugin
diff --git a/plugins/org.eclipse.datatools.enablement.oda.xml/src/org/eclipse/datatools/enablement/oda/xml/util/SaxParser.java b/plugins/org.eclipse.datatools.enablement.oda.xml/src/org/eclipse/datatools/enablement/oda/xml/util/SaxParser.java
index 9116f92..5d581f4 100644
--- a/plugins/org.eclipse.datatools.enablement.oda.xml/src/org/eclipse/datatools/enablement/oda/xml/util/SaxParser.java
+++ b/plugins/org.eclipse.datatools.enablement.oda.xml/src/org/eclipse/datatools/enablement/oda/xml/util/SaxParser.java
@@ -73,6 +73,7 @@ public class SaxParser extends DefaultHandler implements Runnable
private Map cachedValues;
private List filterColumns;
+ private List exceptions;
/**
*
* @param fileName
@@ -88,6 +89,7 @@ public class SaxParser extends DefaultHandler implements Runnable
currentElementRecoder = new HashMap();
stopCurrentThread = false;
cachedValues = new HashMap( );
+ exceptions = new ArrayList( );
}
public SaxParser( XMLDataInputStream xdis,
@@ -143,7 +145,7 @@ public class SaxParser extends DefaultHandler implements Runnable
}
catch ( Exception e )
{
- throw new RuntimeException(e.getLocalizedMessage());
+ exceptions.add( e );
}
finally
{
@@ -151,6 +153,16 @@ public class SaxParser extends DefaultHandler implements Runnable
spConsumer.wakeup( );
}
}
+
+ /**
+ * Indicates whether exception occurred
+ *
+ * @return
+ */
+ public boolean exceptionOccurred( )
+ {
+ return !exceptions.isEmpty( );
+ }
/**
*
diff --git a/plugins/org.eclipse.datatools.enablement.oda.xml/src/org/eclipse/datatools/enablement/oda/xml/util/ui/SchemaPopulationUtil.java b/plugins/org.eclipse.datatools.enablement.oda.xml/src/org/eclipse/datatools/enablement/oda/xml/util/ui/SchemaPopulationUtil.java
index 5e71ad7..d83aa22 100644
--- a/plugins/org.eclipse.datatools.enablement.oda.xml/src/org/eclipse/datatools/enablement/oda/xml/util/ui/SchemaPopulationUtil.java
+++ b/plugins/org.eclipse.datatools.enablement.oda.xml/src/org/eclipse/datatools/enablement/oda/xml/util/ui/SchemaPopulationUtil.java
@@ -213,6 +213,10 @@ final class XMLFileSchemaTreePopulator implements ISaxParserConsumer
{
e1.printStackTrace( );
}
+
+ if ( sp.exceptionOccurred( ) )
+ return null;
+
return root;
}
/**