[jboss-svn-commits] JBoss Common SVN: r4873 - jbossxb/trunk/src/main/java/org/jboss/xb/util.

jboss-svn-commits at lists.jboss.org jboss-svn-commits at lists.jboss.org
Mon Dec 6 11:39:03 EST 2010


Author: alex.loubyansky at jboss.com
Date: 2010-12-06 11:39:03 -0500 (Mon, 06 Dec 2010)
New Revision: 4873

Modified:
   jbossxb/trunk/src/main/java/org/jboss/xb/util/JBossXBHelper.java
Log:
JBXB-254

Modified: jbossxb/trunk/src/main/java/org/jboss/xb/util/JBossXBHelper.java
===================================================================
--- jbossxb/trunk/src/main/java/org/jboss/xb/util/JBossXBHelper.java	2010-12-06 16:37:56 UTC (rev 4872)
+++ jbossxb/trunk/src/main/java/org/jboss/xb/util/JBossXBHelper.java	2010-12-06 16:39:03 UTC (rev 4873)
@@ -56,6 +56,9 @@
 
    /** Whether to validate */
    private boolean useValidation = true;
+   
+   /** Whether to warn on parser errors or terminate parsing by re-throwing the parsing errors */
+   private boolean warnOnParserErrors;
 
    /**
     * Create a new SchemaResolverDeployer.
@@ -116,6 +119,28 @@
    }
 
    /**
+    * This property controls whether the (underlying) parser errors should be
+    * logged as warnings or should they terminate parsing with errors.
+    * The default is to terminate parsing by re-throwing parser errors.
+    * 
+    * @return false if parser errors should be logged as warnings, otherwise - true
+    */
+   public boolean isWarnOnParserErrors()
+   {
+      return warnOnParserErrors;
+   }
+   
+   /**
+    * This property controls whether the (underlying) parser errors should be
+    * logged as warnings or should they terminate parsing with errors.
+    * The default is to terminate parsing by re-throwing parser errors.
+    */
+   public void setWarnOnParserErrors(boolean value)
+   {
+      this.warnOnParserErrors = value;
+   }
+
+   /**
     * Add class binding.
     *
     * @param namespace the namespace
@@ -228,6 +253,7 @@
       Unmarshaller unmarshaller = factory.newUnmarshaller();
       unmarshaller.setSchemaValidation(isUseSchemaValidation());
       unmarshaller.setValidation(isUseValidation());
+      unmarshaller.setWarnOnParserErrors(isWarnOnParserErrors());
       Object parsed = unmarshaller.unmarshal(source, getResolver());
       if (parsed == null)
          throw new Exception("Failed to resolve Java binding for " + source + " (check the SchemaBinding resolver configuration)");
@@ -274,6 +300,7 @@
       Unmarshaller unmarshaller = factory.newUnmarshaller();
       unmarshaller.setSchemaValidation(isUseSchemaValidation());
       unmarshaller.setValidation(isUseValidation());
+      unmarshaller.setWarnOnParserErrors(isWarnOnParserErrors());
       Object parsed = unmarshaller.unmarshal(source, omf, root);
       if (parsed == null)
          throw new Exception("Failed to resolve Java binding for " + source);



More information about the jboss-svn-commits mailing list