Author: scabanovich
Date: 2011-10-06 15:40:32 -0400 (Thu, 06 Oct 2011)
New Revision: 35433
Modified:
trunk/cdi/plugins/org.jboss.tools.cdi.seam.config.core/src/org/jboss/tools/cdi/seam/config/core/xml/SAXParser.java
Log:
JBIDE-9855
https://issues.jboss.org/browse/JBIDE-9855
Parser for seam-beans.xml is fixed.
Modified:
trunk/cdi/plugins/org.jboss.tools.cdi.seam.config.core/src/org/jboss/tools/cdi/seam/config/core/xml/SAXParser.java
===================================================================
---
trunk/cdi/plugins/org.jboss.tools.cdi.seam.config.core/src/org/jboss/tools/cdi/seam/config/core/xml/SAXParser.java 2011-10-06
19:31:29 UTC (rev 35432)
+++
trunk/cdi/plugins/org.jboss.tools.cdi.seam.config.core/src/org/jboss/tools/cdi/seam/config/core/xml/SAXParser.java 2011-10-06
19:40:32 UTC (rev 35433)
@@ -29,6 +29,16 @@
*
*/
public class SAXParser extends SAXValidator {
+ /**
+ * If this limit is set to 0, parser will abort on the very first fatal error.
+ * In that case, the completing of parsing process is guaranteed, though parser
+ * will not be so smart as to extract maximum of correct data for the model.
+ *
+ * If this limit is set to a positive number, parser will be smart, but is not
+ * secured against making a mistake.
+ *
+ */
+ static int SUPPRESSED_FATAL_ERROR_LIMIT = 0;
/**
*
@@ -47,7 +57,7 @@
setFeature(parserInstance, VALIDATION_SCHEMA_FEATURE_ID, true);
setFeature(parserInstance, VALIDATION_SCHEMA_CHECKING_FEATURE_ID, false);
setFeature(parserInstance, VALIDATION_DYNAMIC_FEATURE_ID, false);
- setFeature(parserInstance, FATAL_ERROR_PROCESSING_FEATURE_ID, true);
+ setFeature(parserInstance, FATAL_ERROR_PROCESSING_FEATURE_ID,
SUPPRESSED_FATAL_ERROR_LIMIT > 0);
try {
parserInstance.setProperty(ENTITY_RESOLVER_PROPERTY_ID, new XMLEntityResolverImpl());
@@ -81,7 +91,7 @@
} catch (IOException e) {
CommonPlugin.getDefault().logError(e);
} catch (SAXException e) {
- CommonPlugin.getDefault().logError(e);
+ //ignore, that is user data error that will be shown as error marker.
}
return handler.getRootElement();
@@ -205,6 +215,7 @@
public void fatalError(SAXParseException e) throws SAXException {
String message = e.getMessage();
errors.add(message);
+ if(errors.size() > SUPPRESSED_FATAL_ERROR_LIMIT) throw e;
}
/**