Author: nfilotto
Date: 2010-02-25 14:28:16 -0500 (Thu, 25 Feb 2010)
New Revision: 1953
Modified:
kernel/trunk/exo.kernel.container/src/main/java/org/exoplatform/container/configuration/ConfigurationUnmarshaller.java
kernel/trunk/exo.kernel.container/src/main/java/org/exoplatform/container/configuration/NoKernelNamespaceSAXFilter.java
Log:
EXOJCR-547: Log level reduced to Trace
Modified:
kernel/trunk/exo.kernel.container/src/main/java/org/exoplatform/container/configuration/ConfigurationUnmarshaller.java
===================================================================
---
kernel/trunk/exo.kernel.container/src/main/java/org/exoplatform/container/configuration/ConfigurationUnmarshaller.java 2010-02-25
18:18:49 UTC (rev 1952)
+++
kernel/trunk/exo.kernel.container/src/main/java/org/exoplatform/container/configuration/ConfigurationUnmarshaller.java 2010-02-25
19:28:16 UTC (rev 1953)
@@ -26,9 +26,7 @@
import org.jibx.runtime.IBindingFactory;
import org.jibx.runtime.IUnmarshallingContext;
import org.w3c.dom.Document;
-import org.xml.sax.EntityResolver;
import org.xml.sax.ErrorHandler;
-import org.xml.sax.InputSource;
import org.xml.sax.SAXException;
import org.xml.sax.SAXParseException;
@@ -41,7 +39,6 @@
import java.util.Collections;
import java.util.Set;
-import javax.xml.XMLConstants;
import javax.xml.parsers.DocumentBuilder;
import javax.xml.parsers.DocumentBuilderFactory;
import javax.xml.parsers.FactoryConfigurationError;
@@ -53,10 +50,6 @@
import javax.xml.transform.sax.SAXTransformerFactory;
import javax.xml.transform.sax.TransformerHandler;
import javax.xml.transform.stream.StreamResult;
-import javax.xml.transform.stream.StreamSource;
-import javax.xml.validation.Schema;
-import javax.xml.validation.SchemaFactory;
-import javax.xml.validation.Validator;
/**
* Unmarshall a configuration.
@@ -91,7 +84,8 @@
{
if (exception.getMessage().equals("cvc-elt.1: Cannot find the declaration
of element 'configuration'."))
{
- log.info("The document "
+ log
+ .info("The document "
+ url
+ " does not contain a schema declaration, it should have an
"
+ "XML declaration similar to\n"
@@ -103,7 +97,7 @@
else
{
log.error("In document " + url + " at (" +
exception.getLineNumber() + "," + exception.getColumnNumber()
- + ") :" + exception.getMessage());
+ + ") :" + exception.getMessage());
}
valid = false;
}
@@ -141,11 +135,9 @@
public boolean isValid(URL url) throws NullPointerException, IOException
{
DocumentBuilderFactory factory = DocumentBuilderFactory.newInstance();
- String[] schemas = {
- Namespaces.KERNEL_1_0_URI,
- Namespaces.KERNEL_1_1_URI
- };
-
factory.setAttribute("http://java.sun.com/xml/jaxp/properties/schema...;,
"http://www.w3.org/2001/XMLSchema");
+ String[] schemas = {Namespaces.KERNEL_1_0_URI, Namespaces.KERNEL_1_1_URI};
+ factory
+
.setAttribute("http://java.sun.com/xml/jaxp/properties/schemaLanguage",
"http://www.w3.org/2001/XMLSchema");
factory.setAttribute("http://java.sun.com/xml/jaxp/properties/schema...;,
schemas);
factory.setNamespaceAware(true);
factory.setValidating(true);
@@ -175,11 +167,11 @@
{
if (PropertyManager.isDevelopping())
{
- boolean valid = isValid(url);
- if (!valid)
- {
- log.info("The configuration file " + url + " was not found
valid according to its XSD");
- }
+ boolean valid = isValid(url);
+ if (!valid)
+ {
+ log.info("The configuration file " + url + " was not found
valid according to its XSD");
+ }
}
//
@@ -188,9 +180,12 @@
{
// With Java 6, it's safer to precise the builder factory class name as it
may result:
// java.lang.AbstractMethodError:
org.apache.xerces.dom.DeferredDocumentImpl.getXmlStandalone()Z
- // at com.sun.org.apache.xalan.internal.xsltc.trax.DOM2TO.setDocumentInfo(Unknown
Source)
+ // at
com.sun.org.apache.xalan.internal.xsltc.trax.DOM2TO.setDocumentInfo(Unknown Source)
Method dbfniMethod =
DocumentBuilderFactory.class.getMethod("newInstance", String.class,
ClassLoader.class);
- factory = (DocumentBuilderFactory)dbfniMethod.invoke(null,
"com.sun.org.apache.xerces.internal.jaxp.DocumentBuilderFactoryImpl",
Thread.currentThread().getContextClassLoader());
+ factory =
+ (DocumentBuilderFactory)dbfniMethod.invoke(null,
+
"com.sun.org.apache.xerces.internal.jaxp.DocumentBuilderFactoryImpl",
Thread.currentThread()
+ .getContextClassLoader());
}
catch (InvocationTargetException e)
{
@@ -246,7 +241,8 @@
String document = buffer.toString();
// Debug
- log.debug("About to parse configuration file " + document);
+ if (log.isTraceEnabled())
+ log.trace("About to parse configuration file " + document);
//
IBindingFactory bfact = BindingDirectory.getFactory(Configuration.class);
Modified:
kernel/trunk/exo.kernel.container/src/main/java/org/exoplatform/container/configuration/NoKernelNamespaceSAXFilter.java
===================================================================
---
kernel/trunk/exo.kernel.container/src/main/java/org/exoplatform/container/configuration/NoKernelNamespaceSAXFilter.java 2010-02-25
18:18:49 UTC (rev 1952)
+++
kernel/trunk/exo.kernel.container/src/main/java/org/exoplatform/container/configuration/NoKernelNamespaceSAXFilter.java 2010-02-25
19:28:16 UTC (rev 1953)
@@ -18,6 +18,9 @@
*/
package org.exoplatform.container.configuration;
+import static org.exoplatform.container.configuration.Namespaces.KERNEL_1_0_URI;
+import static org.exoplatform.container.configuration.Namespaces.KERNEL_1_1_URI;
+
import org.exoplatform.services.log.ExoLogger;
import org.exoplatform.services.log.Log;
import org.xml.sax.Attributes;
@@ -29,7 +32,6 @@
import java.util.HashSet;
import java.util.Set;
-import static org.exoplatform.container.configuration.Namespaces.*;
/**
* Removes kernel namespace declaration from the document to not confuse the jibx thing.
@@ -79,12 +81,14 @@
if (KERNEL_1_0_URI.equals(uri) || KERNEL_1_1_URI.equals(uri) ||
XSI_URI.equals(uri))
{
blackListedPrefixes.add(prefix);
- log.debug("Black listing prefix " + prefix + " with uri " +
uri);
+ if (log.isTraceEnabled())
+ log.trace("Black listing prefix " + prefix + " with uri "
+ uri);
}
else
{
contentHandler.startPrefixMapping(prefix, uri);
- log.debug("Start prefix mapping " + prefix + " with uri " +
uri);
+ if (log.isTraceEnabled())
+ log.trace("Start prefix mapping " + prefix + " with uri "
+ uri);
}
}
@@ -92,31 +96,34 @@
{
if (!blackListedPrefixes.remove(prefix))
{
- log.debug("Ending prefix mapping " + prefix);
+ if (log.isTraceEnabled())
+ log.trace("Ending prefix mapping " + prefix);
contentHandler.endPrefixMapping(prefix);
}
else
{
- log.debug("Removed prefix mapping " + prefix + " from black list
");
+ if (log.isTraceEnabled())
+ log.trace("Removed prefix mapping " + prefix + " from black
list ");
}
}
public void startElement(String uri, String localName, String qName, Attributes atts)
throws SAXException
{
- Set<String> profiles = null;
AttributesImpl noNSAtts = new AttributesImpl();
- for (int i = 0;i < atts.getLength();i++)
+ for (int i = 0; i < atts.getLength(); i++)
{
String attQName = atts.getQName(i);
if ((attQName.equals("xmlns")) &&
blackListedPrefixes.contains(""))
{
// Skip
- log.debug("Skipping black listed xmlns attribute");
+ if (log.isTraceEnabled())
+ log.trace("Skipping black listed xmlns attribute");
}
else if (attQName.startsWith("xmlns:") &&
blackListedPrefixes.contains(attQName.substring(6)))
{
// Skip
- log.debug("Skipping black listed " + attQName + "
attribute");
+ if (log.isTraceEnabled())
+ log.trace("Skipping black listed " + attQName + "
attribute");
}
else
{
@@ -129,12 +136,14 @@
if (XSI_URI.equals(attURI))
{
// Skip
- log.debug("Skipping XSI " + attQName + " attribute");
+ if (log.isTraceEnabled())
+ log.trace("Skipping XSI " + attQName + "
attribute");
continue;
}
else if (KERNEL_1_0_URI.equals(attURI) || KERNEL_1_1_URI.equals(attURI))
{
- log.debug("Requalifying prefixed attribute " + attQName + "
attribute to " + localName);
+ if (log.isTraceEnabled())
+ log.trace("Requalifying prefixed attribute " + attQName +
" attribute to " + localName);
attURI = null;
attQName = localName;
}
@@ -147,7 +156,8 @@
//
if (KERNEL_1_0_URI.equals(uri) || KERNEL_1_1_URI.equals(uri))
{
- log.debug("Requalifying active profile " + qName + " start
element to " + localName);
+ if (log.isTraceEnabled())
+ log.trace("Requalifying active profile " + qName + " start
element to " + localName);
qName = localName;
uri = null;
}
@@ -160,13 +170,15 @@
{
if (KERNEL_1_0_URI.equals(uri) || KERNEL_1_1_URI.equals(uri))
{
- log.debug("Requalifying " + qName + " end element");
+ if (log.isTraceEnabled())
+ log.trace("Requalifying " + qName + " end element");
qName = localName;
uri = null;
}
//
- log.debug("Propagatting " + qName + " end element");
+ if (log.isTraceEnabled())
+ log.trace("Propagatting " + qName + " end element");
contentHandler.endElement(uri, localName, qName);
}