jackrabbit-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From thom...@apache.org
Subject svn commit: r640884 - in /jackrabbit/trunk/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/config: ConfigurationParser.java RepositoryConfigurationParser.java
Date Tue, 25 Mar 2008 16:18:48 GMT
Author: thomasm
Date: Tue Mar 25 09:18:45 2008
New Revision: 640884

URL: http://svn.apache.org/viewvc?rev=640884&view=rev
Log:
JCR-1462 log a warning when repository.xml can not be validated (but not for workspace.xml)

Modified:
    jackrabbit/trunk/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/config/ConfigurationParser.java
    jackrabbit/trunk/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/config/RepositoryConfigurationParser.java

Modified: jackrabbit/trunk/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/config/ConfigurationParser.java
URL: http://svn.apache.org/viewvc/jackrabbit/trunk/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/config/ConfigurationParser.java?rev=640884&r1=640883&r2=640884&view=diff
==============================================================================
--- jackrabbit/trunk/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/config/ConfigurationParser.java
(original)
+++ jackrabbit/trunk/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/config/ConfigurationParser.java
Tue Mar 25 09:18:45 2008
@@ -177,6 +177,7 @@
      * Parses the given XML document and returns the DOM root element.
      * A custom entity resolver is used to make the included configuration
      * file DTD available using the specified public identifiers.
+     * This implementation does not validate the XML.
      *
      * @see ConfigurationEntityResolver
      * @param xml xml document
@@ -185,12 +186,30 @@
      *                                not be read or parsed
      */
     protected Element parseXML(InputSource xml) throws ConfigurationException {
+        return parseXML(xml, false);
+    }
+
+    /**
+     * Parses the given XML document and returns the DOM root element.
+     * A custom entity resolver is used to make the included configuration
+     * file DTD available using the specified public identifiers.
+     *
+     * @see ConfigurationEntityResolver
+     * @param xml xml document
+     * @param validate wheter the XML should be validated
+     * @return root element
+     * @throws ConfigurationException if the configuration document could
+     *                                not be read or parsed
+     */
+    protected Element parseXML(InputSource xml, boolean validate) throws ConfigurationException
{
         try {
             DocumentBuilderFactory factory =
                 DocumentBuilderFactory.newInstance();
-            factory.setValidating(true);
+            factory.setValidating(validate);
             DocumentBuilder builder = factory.newDocumentBuilder();
-            builder.setErrorHandler(new ConfigurationErrorHandler());
+            if (validate) {
+                builder.setErrorHandler(new ConfigurationErrorHandler());
+            }
             builder.setEntityResolver(ConfigurationEntityResolver.INSTANCE);
             Document document = builder.parse(xml);
             return document.getDocumentElement();

Modified: jackrabbit/trunk/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/config/RepositoryConfigurationParser.java
URL: http://svn.apache.org/viewvc/jackrabbit/trunk/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/config/RepositoryConfigurationParser.java?rev=640884&r1=640883&r2=640884&view=diff
==============================================================================
--- jackrabbit/trunk/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/config/RepositoryConfigurationParser.java
(original)
+++ jackrabbit/trunk/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/config/RepositoryConfigurationParser.java
Tue Mar 25 09:18:45 2008
@@ -206,7 +206,7 @@
      */
     public RepositoryConfig parseRepositoryConfig(InputSource xml)
             throws ConfigurationException {
-        Element root = parseXML(xml);
+        Element root = parseXML(xml, true);
 
         // Repository home directory
         String home = getVariables().getProperty(REPOSITORY_HOME_VARIABLE);



Mime
View raw message