Uploaded image for project: 'Runtime'
  1. Runtime
  2. RUNTIME-267

Get rid of "Cannot find CatalogManager.properties" in servlet engine error output stream

XMLWordPrintable

    • Icon: Improvement Improvement
    • Resolution: Fixed
    • Icon: Major Major
    • 2.0.0 M3
    • 1.1.8
    • Kernel
    • None

      At startup, org.apache.cocoon.components.resolver.DefaultResolver creates a CatalogManager which check if there is a CatalogManager.properties in classpath:

      private synchronized void readProperties() {
          try {
            propertyFileURI = CatalogManager.class.getResource("/"+propertyFile);
            InputStream in =
      	CatalogManager.class.getResourceAsStream("/"+propertyFile);
            if (in==null) {
      	if (!ignoreMissingProperties) {
      	  System.err.println("Cannot find "+propertyFile);
      	  // there's no reason to give this warning more than once
      	  ignoreMissingProperties = true;
      	...
          }
      

      In order to avoid this line in the servlet engine error output stream, the java property "xml.catalog.ignoreMissing" can be set.

      Proposed patch:

      Index: test-env/src/org/ametys/runtime/test/AbstractRuntimeTestCase.java
      ===================================================================
      --- test-env/src/org/ametys/runtime/test/AbstractRuntimeTestCase.java	(revision 596)
      +++ test-env/src/org/ametys/runtime/test/AbstractRuntimeTestCase.java	(working copy)
      @@ -87,6 +87,12 @@
            */
           protected CocoonWrapper _startCocoon(String applicationPath) throws Exception
           {
      +        // Set this property in order to avoid a System.err.println (CatalogManager.java)
      +        if (System.getProperty("xml.catalog.ignoreMissing") == null)
      +        {
      +            System.setProperty("xml.catalog.ignoreMissing", "true");
      +        }
      +        
               CocoonWrapper cocoon = new CocoonWrapper(applicationPath, "tmp/work");
               cocoon.initialize();
               
      Index: main/kernel/src/org/ametys/runtime/servlet/RuntimeServlet.java
      ===================================================================
      --- main/kernel/src/org/ametys/runtime/servlet/RuntimeServlet.java	(revision 596)
      +++ main/kernel/src/org/ametys/runtime/servlet/RuntimeServlet.java	(working copy)
      @@ -142,6 +142,12 @@
           @Override
           protected synchronized void createCocoon() throws ServletException
           {
      +        // Set this property in order to avoid a System.err.println (CatalogManager.java)
      +        if (System.getProperty("xml.catalog.ignoreMissing") == null)
      +        {
      +            System.setProperty("xml.catalog.ignoreMissing", "true");
      +        }
      +        
               super.createCocoon();
               
               if (ConfigManager.getInstance().isComplete())
      

            Unassigned Unassigned
            yabon Sébastien Launay (Inactive)
            Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

              Created:
              Updated:
              Resolved: