You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@manifoldcf.apache.org by kw...@apache.org on 2022/05/08 23:17:48 UTC

svn commit: r1900711 - in /manifoldcf/trunk/framework/core/src/main/java/org/apache/manifoldcf/core/i18n: MCFVelocityResourceLoader.java Messages.java

Author: kwright
Date: Sun May  8 23:17:48 2022
New Revision: 1900711

URL: http://svn.apache.org/viewvc?rev=1900711&view=rev
Log:
Final fix for CONNECTORS-1712.

Modified:
    manifoldcf/trunk/framework/core/src/main/java/org/apache/manifoldcf/core/i18n/MCFVelocityResourceLoader.java
    manifoldcf/trunk/framework/core/src/main/java/org/apache/manifoldcf/core/i18n/Messages.java

Modified: manifoldcf/trunk/framework/core/src/main/java/org/apache/manifoldcf/core/i18n/MCFVelocityResourceLoader.java
URL: http://svn.apache.org/viewvc/manifoldcf/trunk/framework/core/src/main/java/org/apache/manifoldcf/core/i18n/MCFVelocityResourceLoader.java?rev=1900711&r1=1900710&r2=1900711&view=diff
==============================================================================
--- manifoldcf/trunk/framework/core/src/main/java/org/apache/manifoldcf/core/i18n/MCFVelocityResourceLoader.java (original)
+++ manifoldcf/trunk/framework/core/src/main/java/org/apache/manifoldcf/core/i18n/MCFVelocityResourceLoader.java Sun May  8 23:17:48 2022
@@ -30,8 +30,9 @@ public class MCFVelocityResourceLoader e
   
   /** Constructor.
   */
-  public MCFVelocityResourceLoader()
+  public MCFVelocityResourceLoader(Class classInstance)
   {
+    this.classInstance = classInstance;
   }
 
   public long getLastModified(org.apache.velocity.runtime.resource.Resource resource)
@@ -63,16 +64,6 @@ public class MCFVelocityResourceLoader e
   @Override
   public void init(ExtProperties configurations)
   {
-    String className = (String)configurations.getProperty("classinstance");
-    if (className == null) {
-      className = (String)configurations.getProperty("mcf.resource.loader.classinstance");
-    }
-    // We should be able to load it; if not it's a fatal error and we'll fail to find the resource.
-    try {
-      classInstance = Class.forName(className);
-    } catch (Exception e) {
-      classInstance = null;
-    }
   }
 
   @Override

Modified: manifoldcf/trunk/framework/core/src/main/java/org/apache/manifoldcf/core/i18n/Messages.java
URL: http://svn.apache.org/viewvc/manifoldcf/trunk/framework/core/src/main/java/org/apache/manifoldcf/core/i18n/Messages.java?rev=1900711&r1=1900710&r2=1900711&view=diff
==============================================================================
--- manifoldcf/trunk/framework/core/src/main/java/org/apache/manifoldcf/core/i18n/Messages.java (original)
+++ manifoldcf/trunk/framework/core/src/main/java/org/apache/manifoldcf/core/i18n/Messages.java Sun May  8 23:17:48 2022
@@ -57,12 +57,10 @@ public class Messages
     VelocityEngine engine = new VelocityEngine();
     Properties configuration = new Properties();
     // This is the property that describes the id's of the resource loaders.
-    configuration.setProperty(VelocityEngine.RESOURCE_LOADER,"mcf");
+    configuration.setProperty(VelocityEngine.RESOURCE_LOADERS,"mcf");
     // This is the property which describes the resource loader itself
-    // Used to be ".instance" and accept an instance.  No longer allowed.
-    configuration.setProperty("mcf."+VelocityEngine.RESOURCE_LOADER+".class",MCFVelocityResourceLoader.class.getName() /*new MCFVelocityResourceLoader(classInstance)*/);
-    configuration.setProperty("mcf."+VelocityEngine.RESOURCE_LOADER+".classinstance",classInstance.getName());
     engine.setProperties(configuration);
+    engine.addProperty(VelocityEngine.RESOURCE_LOADER+".mcf.instance",new MCFVelocityResourceLoader(classInstance));
     //engine.setProperty( RuntimeConstants.RUNTIME_LOG_LOGSYSTEM_CLASS,
     //  "org.apache.velocity.runtime.log.Log4JLogChute" );
     //engine.setProperty("runtime.log.logsystem.log4j.logger",