Author: scabanovich
Date: 2011-10-07 16:38:21 -0400 (Fri, 07 Oct 2011)
New Revision: 35482
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
Test added to seam config parser.
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-07
20:14:37 UTC (rev 35481)
+++
trunk/cdi/plugins/org.jboss.tools.cdi.seam.config.core/src/org/jboss/tools/cdi/seam/config/core/xml/SAXParser.java 2011-10-07
20:38:21 UTC (rev 35482)
@@ -38,8 +38,12 @@
* secured against making a mistake.
*
*/
- static int SUPPRESSED_FATAL_ERROR_LIMIT = 0;
+ int supperssedFatalErrorLimit = 0;
+ public void setSupperssedFatalErrorLimit(int c) {
+ supperssedFatalErrorLimit = c;
+ }
+
/**
*
* @param handler
@@ -57,7 +61,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,
SUPPRESSED_FATAL_ERROR_LIMIT > 0);
+ setFeature(parserInstance, FATAL_ERROR_PROCESSING_FEATURE_ID, supperssedFatalErrorLimit
> 0);
try {
parserInstance.setProperty(ENTITY_RESOLVER_PROPERTY_ID, new XMLEntityResolverImpl());
@@ -73,6 +77,7 @@
}
private String errorMessage = null;
+ List<String> errors = new ArrayList<String>();
public SAXElement parse(InputStream input, IDocument document) {
InputSource s = new InputSource(input);
@@ -94,9 +99,15 @@
//ignore, that is user data error that will be shown as error marker.
}
+ errors = handler.errors;
+
return handler.getRootElement();
}
+ public List<String> getErrors() {
+ return errors;
+ }
+
class ConfigHanlder extends DefaultHandler {
SAXElement root = null;
IDocument document;
@@ -215,7 +226,7 @@
public void fatalError(SAXParseException e) throws SAXException {
String message = e.getMessage();
errors.add(message);
- if(errors.size() > SUPPRESSED_FATAL_ERROR_LIMIT) throw e;
+ if(errors.size() > supperssedFatalErrorLimit) throw e;
}
/**